query
stringlengths 9
14.6k
| document
stringlengths 8
5.39M
| metadata
dict | negatives
listlengths 0
30
| negative_scores
listlengths 0
30
| document_score
stringlengths 5
10
| document_rank
stringclasses 2
values |
|---|---|---|---|---|---|---|
create an object contructor for the about page
|
function About(obj) {
this.name = obj.name;
this.giturl = obj.giturl;
this.porturl = obj.porturl;
this.description = obj.description;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function AboutViewModel() {\n \n\t \n\t \n return AboutViewModel();\n }",
"function load_about() {\n\t\tvar about_card = new UI.Card({\n\t\t\tbody: 'WMATA With You\\n' +\n\t\t\t\t'version 2.5\\n' +\n\t\t\t\t'by Alex Lindeman\\n\\n' +\n\t\t\t\t'Built with Pebble.js and the WMATA API.',\n\t\t\tscrollable: true\n\t\t});\n\t\tabout_card.show();\n\t}",
"function About() {\n\n}",
"function displayAbout() {\n\t\t\n\t\tvar newdiv1 = document.createElement(\"div\");\n\t\t$.getJSON(\"https://people.rit.edu/~sarics/web_proxy.php?path=about\")\n \n\t\t.done(function (data) {\n\t\t\t\n\t\t\tvar newdiv2 = document.createElement(\"div\");\n\t\t\tvar newdiv3 = document.createElement(\"div\");\n\t\t\tvar newdiv4 = document.createElement(\"div\");\n\t\t\t\t\t\n\t\t\t$(newdiv1).append(document.createTextNode(data.title));\n\t\t\t$(newdiv1).attr(\"id\",\"title\");\n\t\n \t$(newdiv2).attr(\"id\",\"dscrp\");\n\t\t\t$(newdiv3).attr(\"id\",\"quote\");\n\t\t\t\n\t\t\t$(newdiv4).attr(\"id\",\"Author\");\t\t\t\t\t\n\t\t\t$(newdiv2).append(document.createTextNode(data.description));\n\t\t\t\n\t\t\t$(newdiv3).append(document.createTextNode(data.quote));\n\t\t\t$(newdiv4).append(document.createTextNode(data.quoteAuthor));\n\t\t\t\t\t\n\t\t\t$(\"#about\").append(newdiv1);\n\t\t\t$(\"#about\").append(newdiv2);\n\t\t\t\t\t\n\t\t\t$(\"#about\").append(newdiv3);\n\t\t\t$(\"#about\").append(newdiv4);\n\t\t\t\n\t\t})\n\t\t\n\t\t.fail(function () {\n alert('some Problem occured');\n });\n\t\t\n\t}",
"function renderAboutPage(){\n\t\tvar page = $('.about');\n\t\tpage.addClass('visible');\n\t}",
"function renderAboutPage(){\n\t\tvar page = $('.about');\n\t\tpage.addClass('visible');\n\t}",
"function OogaahTutorialContent1() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}",
"function editor_about(objname) {\r\n showModalDialog(_editor_url + \"/html/egovframework/com/cmm/utl/htmlarea/popups/about.html\", window, \"resizable: yes; help: no; status: no; scroll: no; \");\r\n}",
"constructor(title, author,pages,technology) { // constructor com as informações cosntantes da nova classe\n super(title,author,pages); // informações herdadas da classe superior\n this.technology = technology; // nova atribuição da nova classe.\n\n }",
"constructor(title, author, pages) {\n super(title);\n this._author = author;\n this._pages = pages;\n }",
"function OogaahTutorialContent4() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}",
"function aboutPage()\n {\n // did we already download that?\n if (app.graphs === void 0) {\n $.getJSON(\"static/js/graphs.json\", function(graphs) {\n app.graphs = graphs;\n\n // mutate once to turn 0.75(...) to 75.(...)\n app.graphs.forEach(function (graph) {\n graph.series.forEach(function (member) {\n member.data.forEach(function (datum, _i, data) {\n // mutate array members\n data[_i] = (datum * 100);\n });\n });\n });\n\n // key iteration\n app.graphs.forEach(function (graph) {\n drawLineGraph(graph.title, {series: graph.series}, graph.time, graph.title);\n });\n });\n\n } else {\n // key iteration\n $(\"#line-graphs\").empty();\n\n app.graphs.forEach(function (graph) {\n drawLineGraph(graph.title, {series: graph.series}, graph.time, graph.title);\n });\n }\n\n // Clear graph content and about page if there\n //$('#metro-pie-charts').empty()\n //$('#census-pie-charts').empty()\n }",
"function OogaahTutorialContent3A() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}",
"showAbout(request, response) {\n return response.render('app/pages/about-us');\n }",
"function _(id) {\n\n // About object is returned if there is no 'id' parameter\n var about = {\n Version: 0.5,\n Author: \"Sujeet Srivastava\",\n Created: \"Fall 2015\",\n Updated: \"04 Jun 2015\"\n };\n\n if (id) {\n\n // Avoid clobbering the window scope:\n // return a new _ object if we're in the wrong scope\n if (window === this) {\n return new _(id);\n }\n\n // We're in the correct object scop:\n // Init our element object and return the object\n this.e = document.getElementById(id);\n return this;\n } else {\n // No 'id' paramter was given, return the 'about' object\n return about;\n }\n}",
"async createAboutObject() {\n return this.aic.getAboutData();\n }",
"function loadAboutMe(profileObj) {\n let aboutme = document.getElementById(\"aboutme\");\n createAboutMe(aboutme, profileObj);\n}",
"function getAboutViewModel(callback) {\n var page = topLevelPages.about;\n callback(null, new ViewModel(page.title, page.pageTemplateName));\n }",
"function OogaahTutorialContent2() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}",
"function aboutmeClick(){\r\n\t\tcallAjax(createAboutme, \"aboutme\", \"get\");\r\n\t}",
"constructor(name) {\n this.name = name;\n this.hidden = true;\n if (!overview_instance) overview_instance = this;\n return overview_instance;\n }",
"static initialize(obj, events, pageInfo) { \n obj['events'] = events;\n obj['page_info'] = pageInfo;\n }",
"function initialisePage(){\n\t\t\tcurrent_tab = \"about\";\n\t\t\tgenerateNav(register_navevents);\n\t\t\tgenerateFramework(current_tab, generatePage);\n\t\t\t// Enable button again\n\t\t\tbuttonOff();\n\t\t}",
"static about() {\n return \"a vehicle is a means of transportion.\"\n }",
"function createIntroWindow() {\n pageCollection.showHelp();\n}",
"function OogaahTutorialContent33() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}",
"render () {\n\t\t// se retorna la vista \n\t\treturn (\n\t\t\t// div about\n\t\t\t<div className=\"About\">\n\t\t\t\t// se coloca el titulo \n\t\t\t\t<h1>Acerca de.</h1>\n\t\t\t</div>\n\t\t);\n\t}",
"function OogaahTutorialContent3C() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}",
"function OogaahTutorialContent31() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}",
"function Newhomepage(browser)\n{\n this.browser= browser;\n}"
] |
[
"0.65293044",
"0.65177935",
"0.63212216",
"0.61964065",
"0.61757743",
"0.61757743",
"0.611987",
"0.609772",
"0.6075698",
"0.60373044",
"0.601762",
"0.59945744",
"0.59507304",
"0.59452647",
"0.5937162",
"0.5936154",
"0.5930287",
"0.5927293",
"0.59219724",
"0.59016234",
"0.59012026",
"0.5900575",
"0.5897329",
"0.5895749",
"0.58832705",
"0.5844147",
"0.5838296",
"0.5838295",
"0.58361894",
"0.58140403"
] |
0.75398135
|
0
|
IEEE 80 bit extended float
|
readFloat80 (littleEndian) {
this.read(10, littleEndian)
return float80()
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function writeFloat( buf, v, offset, dirn ) {\n var norm, word, sign = 0;\n if (v < 0) { sign = 0x80000000; v = -v; }\n\n if (! (v && v < Infinity)) {\n if (v === 0) { // -0, +0\n word = (1/v < 0) ? 0x80000000 : 0x00000000;\n }\n else if (v === Infinity) { // -Infinity, +Infinity\n word = sign | 0x7F800000;\n }\n else { // NaN - positive, non-signaling\n word = 0x7FC00000;\n }\n writeWord(buf, word, offset, dirn);\n }\n else {\n norm = normalize(v); // separate exponent and mantissa\n norm.exp += 127; // bias exponent\n\n if (norm.exp <= 0) { // denormalized number\n if (norm.exp <= -25) { // too small, underflow to zero. -24 might round up though.\n norm.mant = 0;\n norm.exp = 0;\n } else { // denormalize\n norm.mant = roundMantissa(norm.mant, pow2(22 + norm.exp));\n norm.exp = 0; // rounding can carry out and re-normalize the number\n if (norm.mant >= 0x800000) { norm.mant -= 0x800000; norm.exp += 1 }\n }\n } else {\n norm.mant = roundMantissa(norm.mant - 1, 0x800000);\n // if rounding overflowed into the hidden 1s place, hide it and adjust the exponent\n if (norm.mant >= 0x800000) { norm.mant -= 0x800000; norm.exp += 1 }\n if (norm.exp > 254) { // overflow to Infinity\n norm.mant = 0;\n norm.exp = 255;\n }\n }\n\n word = sign | (norm.exp << 23) | norm.mant;\n writeWord(buf, word, offset, dirn);\n }\n}",
"function writeFloat( buf, v, offset, dirn ) {\n var norm, word, sign = 0;\n if (v < 0) { sign = 0x80000000; v = -v; }\n\n if (! (v && v < Infinity)) {\n if (v === 0) { // -0, +0\n word = (1/v < 0) ? 0x80000000 : 0x00000000;\n }\n else if (v === Infinity) { // -Infinity, +Infinity\n word = sign | 0x7F800000;\n }\n else { // NaN - positive, non-signaling\n word = 0x7FC00000;\n }\n writeWord(buf, word, offset, dirn);\n }\n else {\n norm = normalize(v); // separate exponent and mantissa\n norm.exp += 127; // bias exponent\n\n if (norm.exp <= 0) { // denormalized number\n if (norm.exp <= -25) { // too small, underflow to zero. -24 might round up though.\n norm.mant = 0;\n norm.exp = 0;\n } else { // denormalize\n norm.mant = roundMantissa(norm.mant, pow2(22 + norm.exp));\n norm.exp = 0; // rounding can carry out and re-normalize the number\n if (norm.mant >= 0x800000) { norm.mant -= 0x800000; norm.exp += 1 }\n }\n } else {\n norm.mant = roundMantissa(norm.mant - 1, 0x800000);\n // if rounding overflowed into the hidden 1s place, hide it and adjust the exponent\n if (norm.mant >= 0x800000) { norm.mant -= 0x800000; norm.exp += 1 }\n if (norm.exp > 254) { // overflow to Infinity\n norm.mant = 0;\n norm.exp = 255;\n }\n }\n\n word = sign | (norm.exp << 23) | norm.mant;\n writeWord(buf, word, offset, dirn);\n }\n}",
"writeBinaryFloat(n) {\n this.writeUInt8(4);\n const buf = this.reserveBytes(4);\n buf.writeFloatBE(n);\n if ((buf[0] & 0x80) === 0) {\n buf[0] |= 0x80;\n } else {\n // We complement the bits for a negative number\n buf[0] ^= 0xff;\n buf[1] ^= 0xff;\n buf[2] ^= 0xff;\n buf[3] ^= 0xff;\n }\n }",
"function float_to_bits(num) {\n fltbuf[0] = num;\n return intbuf[0];\n}",
"function bits_to_float(bits) {\n intbuf[0] = bits;\n return fltbuf[0];\n}",
"function toIEEE754(v, ebits, fbits) {\n \n var bias = (1 << (ebits - 1)) - 1;\n \n // Compute sign, exponent, fraction\n var s, e, f;\n if (isNaN(v)) {\n e = (1 << bias) - 1; f = 1; s = 0;\n }\n else if (v === Infinity || v === -Infinity) {\n e = (1 << bias) - 1; f = 0; s = (v < 0) ? 1 : 0;\n }\n else if (v === 0) {\n e = 0; f = 0; s = (1 / v === -Infinity) ? 1 : 0;\n }\n else {\n s = v < 0;\n v = Math.abs(v);\n \n if (v >= Math.pow(2, 1 - bias)) {\n var ln = Math.min(Math.floor(Math.log(v) / Math.LN2), bias);\n e = ln + bias;\n f = v * Math.pow(2, fbits - ln) - Math.pow(2, fbits);\n }\n else {\n e = 0;\n f = v / Math.pow(2, 1 - bias - fbits);\n }\n }\n \n // Pack sign, exponent, fraction\n var i, bits = [];\n for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = Math.floor(f / 2); }\n for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = Math.floor(e / 2); }\n bits.push(s ? 1 : 0);\n bits.reverse();\n var str = bits.join('');\n \n // Bits to bytes\n var bytes = [];\n while (str.length) {\n bytes.push(parseInt(str.substring(0, 8), 2));\n str = str.substring(8);\n }\n return bytes;\n}",
"function encodeFloat(number) {\n var n = +number,\n status = (n !== n) || n == -Infinity || n == +Infinity ? n : 0,\n exp = 0,\n len = 281, // 2 * 127 + 1 + 23 + 3,\n bin = new Array(len),\n signal = (n = status !== 0 ? 0 : n) < 0,\n n = Math.abs(n),\n intPart = Math.floor(n),\n floatPart = n - intPart,\n i, lastBit, rounded, j, exponent;\n\n if (status !== 0) {\n if (n !== n) {\n return 0x7fc00000;\n }\n if (n === Infinity) {\n return 0x7f800000;\n }\n if (n === -Infinity) {\n return 0xff800000\n }\n }\n\n i = len;\n while (i) {\n bin[--i] = 0;\n }\n\n i = 129;\n while (intPart && i) {\n bin[--i] = intPart % 2;\n intPart = Math.floor(intPart / 2);\n }\n\n i = 128;\n while (floatPart > 0 && i) {\n (bin[++i] = ((floatPart *= 2) >= 1) - 0) && --floatPart;\n }\n\n i = -1;\n while (++i < len && !bin[i]);\n\n if (bin[(lastBit = 22 + (i = (exp = 128 - i) >= -126 && exp <= 127 ? i + 1 : 128 - (exp = -127))) + 1]) {\n if (!(rounded = bin[lastBit])) {\n j = lastBit + 2;\n while (!rounded && j < len) {\n rounded = bin[j++];\n }\n }\n\n j = lastBit + 1;\n while (rounded && --j >= 0) {\n (bin[j] = !bin[j] - 0) && (rounded = 0);\n }\n }\n i = i - 2 < 0 ? -1 : i - 3;\n while(++i < len && !bin[i]);\n (exp = 128 - i) >= -126 && exp <= 127 ? ++i : exp < -126 && (i = 255, exp = -127);\n (intPart || status !== 0) && (exp = 128, i = 129, status == -Infinity ? signal = 1 : (status !== status) && (bin[i] = 1));\n\n n = Math.abs(exp + 127);\n exponent = 0;\n j = 0;\n while (j < 8) {\n exponent += (n % 2) << j;\n n >>= 1;\n j++;\n }\n\n var mantissa = 0;\n n = i + 23;\n for (; i < n; i++) {\n mantissa = (mantissa << 1) + bin[i];\n }\n return ((signal ? 0x80000000 : 0) + (exponent << 23) + mantissa) | 0;\n}",
"function toFloat32(value) {\n var bytes = 0;\n switch (value) {\n case Number.POSITIVE_INFINITY: bytes = 0x7F800000; break;\n case Number.NEGATIVE_INFINITY: bytes = 0xFF800000; break;\n case +0.0: bytes = 0x40000000; break;\n case -0.0: bytes = 0xC0000000; break;\n default:\n if (Number.isNaN(value)) { bytes = 0x7FC00000; break; }\n\n if (value <= -0.0) {\n bytes = 0x80000000;\n value = -value;\n }\n\n var exponent = Math.floor(Math.log(value) / Math.log(2));\n var significand = ((value / Math.pow(2, exponent)) * 0x00800000) | 0;\n\n exponent += 127;\n if (exponent >= 0xFF) {\n exponent = 0xFF;\n significand = 0;\n } else if (exponent < 0) exponent = 0;\n\n bytes = bytes | (exponent << 23);\n bytes = bytes | (significand & ~(-1 << 23));\n break;\n }\n return bytes;\n}",
"parseBinaryFloat(buf) {\n buf = Buffer.from(buf);\n if (buf[0] & 0x80) {\n buf[0] &= 0x7f;\n } else {\n // complement the bits for a negative number\n buf[0] ^= 0xff;\n buf[1] ^= 0xff;\n buf[2] ^= 0xff;\n buf[3] ^= 0xff;\n }\n return buf.readFloatBE();\n }",
"function SimpleFloat(significand, exponent) {\n this.significand = significand;\n this.exponent = exponent;\n}",
"get floatValue() {}",
"function CtoF(C) {\n return (C * 1.8 + 32);\n}",
"function packIEEE754(value, mLen, nBytes) {\n var buffer = new Array(nBytes);\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0;\n var i = 0;\n var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;\n var e, m, c;\n value = abs(value); // eslint-disable-next-line no-self-compare\n\n if (value != value || value === Infinity) {\n // eslint-disable-next-line no-self-compare\n m = value != value ? 1 : 0;\n e = eMax;\n } else {\n e = floor(log(value) / LN2);\n\n if (value * (c = pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * pow(2, 1 - eBias);\n }\n\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * pow(2, eBias - 1) * pow(2, mLen);\n e = 0;\n }\n }\n\n for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8);\n\n e = e << mLen | m;\n eLen += mLen;\n\n for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8);\n\n buffer[--i] |= s * 128;\n return buffer;\n }",
"_calculateExponentAndMantissa(float){\n let integral2 = toBinaryX(parseInt(float, 10), EXP, '0');//on prends uniquement le chiffre avant la virgule en base 2\n let fractional10 = this._getDecimal(float);//on prends uniquement les chiffres après la virgule en base 10\n let fractional2 = ''; //contient les chiffres apres la virgule en base 2\n\n //la fraction est multiplié par 2 tant qu'elle n'est pas egal à 0 et que 23 itération ne se sont pas écoulé\n // si la fraction est plus grande que 1 on enleve le chiffre avant la virgule\n let i = 0;\n //127 + 23 permet de ne perdre aucune précision, en effet si on prends le cas extreme qui serait un nombre entre -1 et 1 tres tres petit, le nombre de décalage maximum\n //serait de 127 etant donné que l'exposant = 127 + décalge, apres 127 décalge il faut encore récupérer la valeur de mantisse donc 23 bit.\n //(cette exemple est pour la version 32 bit mais marche avec les autres version)\n while(fractional10 != 0 && i < D_ + MAN)\n {\n fractional10 = fractional10 * 2;\n if(fractional10 >= 1)\n {\n fractional2 += '1';\n }\n else\n {\n fractional2 += '0';\n }\n fractional10 = this._getDecimal(fractional10);\n i++;\n }\n\n let number2 = (integral2 + '.' + fractional2).split('');//nombre en binaire avec la notation scientifique mais non somplifié (2^0)\n\n let pointIndex = integral2.length;//index du point dans le chiffre\n\n //on itere dans le nombre jusqu'a trouver un 1, on effectue encore une fois j++ pour se placer juste apres le 1, car c'est ici que l'on veut placer la virgule\n let j = 0;\n while(number2[j] != 1)\n {\n j++;\n }\n j++;\n\n let power = 0;\n this.mantissa = (integral2 + fractional2).split('');\n //si le nombre n'est pas compris entre -1 et 1, on regarde de combien on a décalé la virgule,\n //pour la mantisse on enleve les 0 inutile et le 1er 1\n if(float <= -1 || float >= 1)\n {\n power = pointIndex - j;\n this.mantissa.splice(0,j);\n }\n //si le nombre est compris entre -1 et 1, on regarde de combien on a decalé la virgule\n //(+1 car si le nombre est comrpis entre - 1 et 1 on a compté la virgule dans le calcul et il faut enlever)\n //pour la mantisse on enleve les 0 inutile et le 1er 1\n else\n {\n power = pointIndex - j + 1;\n this.mantissa.splice(0, j - 1);\n }\n this.exponent = toBinaryX(D_ + power, EXP, '0');//on calcule l'exposant qu'on converti en binaire\n this.mantissa = fillWithX(this.mantissa.splice(0, MAN).join(\"\"), '0');//on prends les 23 premier bit de la mantisse[splice()], on converti le tableau en string[join()], on remplie la droite de la mantisse avec des 0[fillWith0()]\n }",
"function from11f(v) {\n\t var e = v >> 6;\n\t var m = v & 0x2F;\n\t if (e === 0) {\n\t if (m === 0) {\n\t return 0;\n\t } else {\n\t return Math.pow(2, -14) * (m / 64);\n\t }\n\t } else {\n\t if (e < 31) {\n\t return Math.pow(2, e - 15) * (1 + m / 64);\n\t } else {\n\t if (m === 0) {\n\t return 0; // Inf\n\t } else {\n\t return 0; // Nan\n\t }\n\t }\n\t }\n\t }",
"function float(num) {\n return num * 0.1 * 10;\n}",
"function toHalf( val ) {\n\n\t\t\tfloatView[ 0 ] = val;\n\t\t\tvar x = int32View[ 0 ];\n\n\t\t\tvar bits = ( x >> 16 ) & 0x8000; /* Get the sign */\n\t\t\tvar m = ( x >> 12 ) & 0x07ff; /* Keep one extra bit for rounding */\n\t\t\tvar e = ( x >> 23 ) & 0xff; /* Using int is faster here */\n\n\t\t\t/* If zero, or denormal, or exponent underflows too much for a denormal\n\t\t\t * half, return signed zero. */\n\t\t\tif ( e < 103 ) return bits;\n\n\t\t\t/* If NaN, return NaN. If Inf or exponent overflow, return Inf. */\n\t\t\tif ( e > 142 ) {\n\n\t\t\t\tbits |= 0x7c00;\n\t\t\t\t/* If exponent was 0xff and one mantissa bit was set, it means NaN,\n\t\t\t\t\t\t * not Inf, so make sure we set one mantissa bit too. */\n\t\t\t\tbits |= ( ( e == 255 ) ? 0 : 1 ) && ( x & 0x007fffff );\n\t\t\t\treturn bits;\n\n\t\t\t}\n\n\t\t\t/* If exponent underflows but not too much, return a denormal */\n\t\t\tif ( e < 113 ) {\n\n\t\t\t\tm |= 0x0800;\n\t\t\t\t/* Extra rounding may overflow and set mantissa to 0 and exponent\n\t\t\t\t * to 1, which is OK. */\n\t\t\t\tbits |= ( m >> ( 114 - e ) ) + ( ( m >> ( 113 - e ) ) & 1 );\n\t\t\t\treturn bits;\n\n\t\t\t}\n\n\t\t\tbits |= ( ( e - 112 ) << 10 ) | ( m >> 1 );\n\t\t\t/* Extra rounding. An overflow will set mantissa to 0 and increment\n\t\t\t * the exponent, which is OK. */\n\t\t\tbits += m & 1;\n\t\t\treturn bits;\n\n\t\t}",
"function readFloat(){\n checkLen(4);\n var flt = buf.readFloatLE(pos);\n pos += 4;\n return formSinglePrecision(flt);\n }",
"function caml_log10_float (x) { return Math.LOG10E * Math.log(x); }",
"function packIEEE754(value, mLen, nBytes) {\n\t var buffer = new Array(nBytes);\n\t var eLen = nBytes * 8 - mLen - 1;\n\t var eMax = (1 << eLen) - 1;\n\t var eBias = eMax >> 1;\n\t var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0;\n\t var i = 0;\n\t var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;\n\t var e, m, c;\n\t value = abs(value);\n\t // eslint-disable-next-line no-self-compare\n\t if (value != value || value === Infinity) {\n\t // eslint-disable-next-line no-self-compare\n\t m = value != value ? 1 : 0;\n\t e = eMax;\n\t } else {\n\t e = floor(log(value) / LN2);\n\t if (value * (c = pow(2, -e)) < 1) {\n\t e--;\n\t c *= 2;\n\t }\n\t if (e + eBias >= 1) {\n\t value += rt / c;\n\t } else {\n\t value += rt * pow(2, 1 - eBias);\n\t }\n\t if (value * c >= 2) {\n\t e++;\n\t c /= 2;\n\t }\n\t if (e + eBias >= eMax) {\n\t m = 0;\n\t e = eMax;\n\t } else if (e + eBias >= 1) {\n\t m = (value * c - 1) * pow(2, mLen);\n\t e = e + eBias;\n\t } else {\n\t m = value * pow(2, eBias - 1) * pow(2, mLen);\n\t e = 0;\n\t }\n\t }\n\t for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8) {}\n\t e = e << mLen | m;\n\t eLen += mLen;\n\t for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8) {}\n\t buffer[--i] |= s * 128;\n\t return buffer;\n\t }",
"function packIEEE754(value, mLen, nBytes) {\n\t var buffer = Array(nBytes);\n\t var eLen = nBytes * 8 - mLen - 1;\n\t var eMax = (1 << eLen) - 1;\n\t var eBias = eMax >> 1;\n\t var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0;\n\t var i = 0;\n\t var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;\n\t var e, m, c;\n\t value = abs(value);\n\t // eslint-disable-next-line no-self-compare\n\t if (value != value || value === Infinity) {\n\t // eslint-disable-next-line no-self-compare\n\t m = value != value ? 1 : 0;\n\t e = eMax;\n\t } else {\n\t e = floor(log(value) / LN2);\n\t if (value * (c = pow(2, -e)) < 1) {\n\t e--;\n\t c *= 2;\n\t }\n\t if (e + eBias >= 1) {\n\t value += rt / c;\n\t } else {\n\t value += rt * pow(2, 1 - eBias);\n\t }\n\t if (value * c >= 2) {\n\t e++;\n\t c /= 2;\n\t }\n\t if (e + eBias >= eMax) {\n\t m = 0;\n\t e = eMax;\n\t } else if (e + eBias >= 1) {\n\t m = (value * c - 1) * pow(2, mLen);\n\t e = e + eBias;\n\t } else {\n\t m = value * pow(2, eBias - 1) * pow(2, mLen);\n\t e = 0;\n\t }\n\t }\n\t for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8) {}\n\t e = e << mLen | m;\n\t eLen += mLen;\n\t for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8) {}\n\t buffer[--i] |= s * 128;\n\t return buffer;\n\t }",
"function convertCtoF(cTemp)\n{\n var fTemp = cTemp * 1.8 + 32;\n return fTemp;\n}",
"convertToF (celTemp) {\n return (celTemp * (9 / 5)) + 32;\n }",
"f64() {\n this._convo.u8.set(this.buffer.subarray(this.at, this.at += 8));\n return this._convo.f64[0];\n }",
"function caml_int64_of_float (x) {\n if (x < 0) x = Math.ceil(x);\n return [255,\n x & 0xffffff,\n Math.floor(x * caml_int64_offset) & 0xffffff,\n Math.floor(x * caml_int64_offset * caml_int64_offset) & 0xffff];\n}",
"function packIEEE754(value, mLen, nBytes) {\n var buffer = Array(nBytes);\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0;\n var i = 0;\n var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;\n var e, m, c;\n value = abs(value);\n // eslint-disable-next-line no-self-compare\n if (value != value || value === Infinity) {\n // eslint-disable-next-line no-self-compare\n m = value != value ? 1 : 0;\n e = eMax;\n } else {\n e = floor(log(value) / LN2);\n if (value * (c = pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * pow(2, eBias - 1) * pow(2, mLen);\n e = 0;\n }\n }\n for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8) {}\n e = e << mLen | m;\n eLen += mLen;\n for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8) {}\n buffer[--i] |= s * 128;\n return buffer;\n }",
"function parseXSDFloat(value) {\n const numb = Number(value);\n if (isNaN(numb)) {\n if (value === 'NaN') {\n return NaN;\n }\n if (value === 'INF') {\n return Infinity;\n }\n if (value === '-INF') {\n return -Infinity;\n }\n return undefined;\n }\n return numb;\n}",
"function bytesToFloat(bytes) {\n // JavaScript bitwise operators yield a 32 bits integer, not a float.\n // Assume LSB (least significant byte first).\n var bits = bytes[3]<<24 | bytes[2]<<16 | bytes[1]<<8 | bytes[0];\n var sign = (bits>>>31 === 0) ? 1.0 : -1.0;\n var e = bits>>>23 & 0xff;\n var m = (e === 0) ? (bits & 0x7fffff)<<1 : (bits & 0x7fffff) | 0x800000;\n var f = sign * m * Math.pow(2, e - 150);\n return f;\n }",
"function substringEnergyToFloat(value) {\n\tif (value != null) {\n\t\tvar grab = parseFloat(\n\t\t\t\tvalue.substring(value.indexOf('=') + 1, value.indexOf('H') - 1))\n\t\t\t\t.toPrecision(12); // Energy = -5499.5123027313 Hartree\n\t\tgrab = grab * 2625.50;\n\t\tgrab = Math.round(grab * 1000000000000) / 1000000000000;\n\t}\n\treturn grab;\n}",
"static get floatingPointNumber() {\n return /([+-]?(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*))(?:[eE]([+-]?\\d+))?/;\n }"
] |
[
"0.6808168",
"0.6808168",
"0.64386445",
"0.6378993",
"0.63424796",
"0.63230914",
"0.622323",
"0.61889064",
"0.61809254",
"0.6088265",
"0.60630894",
"0.60406524",
"0.60131747",
"0.6010828",
"0.60093445",
"0.59962416",
"0.5969833",
"0.5946727",
"0.59460145",
"0.5944585",
"0.5937336",
"0.59268516",
"0.59069955",
"0.58996826",
"0.5897209",
"0.58675927",
"0.58654845",
"0.5842235",
"0.58420527",
"0.58241564"
] |
0.7223796
|
0
|
Setup the editor panel for a special shape.
|
function setUpEditPanel(shape) {
//var propertiesPanel = canvas.edit; //access the edit div
var propertiesPanel = document.getElementById("edit");
propertiesPanel.innerHTML = "";
if (shape == null) {
//do nothing
}
else {
switch (shape.oType) {
case 'Group':
//do nothing. We do not want to offer this to groups
break;
case 'Container':
Builder.constructPropertiesPanel(propertiesPanel, shape);
break;
case 'CanvasProps':
Builder.constructCanvasPropertiesPanel(propertiesPanel, shape);
break;
default: //both Figure and Connector
Builder.constructPropertiesPanel(propertiesPanel, shape);
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"addEditor() {\n // Create new editor\n this.editor = $(`\n <div id=\"${this.id}-Editor\" class=\"editCell\">\n <div class=\"editHeader\">\n <p class=\"editHeaderTitle\">${this.id} Editor</p>\n </div>\n <div class=\"editOptionTable\">\n </div>\n </div>\n `);\n propertyEditor.append(this.editor[0]);\n\n // When working within an editor hilight the relevant shape\n this.editor.on(\"mouseenter\", () => {\n this.hover = true;\n canvas.redrawCanvas();\n });\n this.editor.on(\"mouseleave\", () => {\n this.hover = false;\n canvas.redrawCanvas();\n });\n\n // Add button for deleting a shape off of the canvas\n $(`<button class=\"editHeaderButton\">Delete Shape</button>`)\n .on(\"click\", () => canvas.removeShape(this))\n .appendTo(`div#${this.id}-Editor .editHeader`);\n\n // Fill the editor with options relevant to the shape\n this.refillOptions();\n }",
"function setupPanel() {\n // calculate client rect\n opts['panel-before']['clientRect'] = opts['panel-before'][0].getBoundingClientRect();\n opts['panel-after']['clientRect'] = opts['panel-after'][0].getBoundingClientRect();\n pEl['clientRect'] = pEl[0].getBoundingClientRect();\n\n // calculate width/height value of prev, and next sibling node\n opts.panelBeforeSize = opts['panel-before']['clientRect'][opts.size];\n opts.panelAfterSize = opts['panel-after']['clientRect'][opts.size];\n\n opts.elSize = el[0].getBoundingClientRect()[opts.size];\n\n // total width or height for splitter's container node\n setContainerSize(opts.panelBeforeSize + opts.panelAfterSize);\n\n // parent element\n pEl.css(opts.size, pEl['clientRect'][opts.size])\n .attr(opts['namespace'], opts['namespace']);\n }",
"function initEditor(node) {\n node = damas.read(node._id);\n if (!document.querySelector('#panelSecond')) {\n compEditor(createPanel(document.body), node);\n }\n else {\n compEditor(document.querySelector('#panelContent'), node);\n }\n }",
"function new_shape(editor) {\n var side = document.getElementById('sidebarContainer');\n side.style.display = 'block';\n show_sidebar(side, editor);\n}",
"function Editor( el ) {\n \n var self = this;\n this.el = el;\n this.ui = {};\n\n this.init = function() {\n\n self.ui.canvas = $('<div id=\"canvas\" />').appendTo( self.el );\n self.ui.panel = $('<div id=\"panel\" />').appendTo( self.el );\n self.ui.palette = $('<div id=\"palette\" />').appendTo( self.el );\n\n self.ui.paper = false;\n self.boxes = new Boxes({panel: self.ui.panel, paper: self.ui.paper});\n\n $(window).bind('resize', function() {\n if ( self.resize_timer) {\n clearTimeout( self.resize_timer);\n }\n self.resize_timer = setTimeout(self.resize, 100);\n });\n \n self.resize_timer = false;\n setTimeout(self.resize, 10);\n \n for ( var i = 3; i--; i > 0 ) {\n $('<div class=\"box new\" />').appendTo( self.ui.palette );\n }\n\n $(\"#palette .box\").draggable({ \n stack: '.box',\n revert: 'invalid',\n revertDuration: 250,\n appendTo: self.ui.panel,\n opacity: 0.5,\n start: function ( event, ui ) {\n self.disableMove = true;\n },\n helper: 'clone'\n });\n\n self.ui.panel.droppable({ \n accept: function(e) {\n if ( $(e).hasClass('box') ) {\n return true;\n }\n return false;\n },\n drop: function(event, ui) {\n if ( ui.helper.hasClass('new') ) {\n var x = ui.helper.offset().left - self.ui.panel.offset().left;\n var y = ui.helper.offset().top - self.ui.panel.offset().top;\n self.boxes.add({x:x, y:y});\n }\n }\n });\n\n };\n\n this.resize = function () {\n var w = $(window).width();\n var h = $(window).height();\n self.ui.palette.css({ 'width': w-16 });\n var t = self.ui.palette.height() + 16;\n self.ui.canvas.css({ 'top': t, 'width': w-16, 'height': h-t-8 });\n self.ui.panel.css({ 'top': t, 'width': w-16, 'height': h-t-8 });\n self.render();\n };\n\n this.render = function () {\n var rz = 16;\n var w = self.ui.canvas.width();\n var h = self.ui.canvas.height();\n self.ui.canvas.html('');\n self.ui.paper = Raphael( 'canvas', w, h );\n self.ui.paper.clear();\n self.ui.paper.drawGrid( rz/2, rz/2, w - rz, h - rz, (w-rz)/rz, (h-rz)/rz, \"#ccc\");\n self.boxes.paper = self.ui.paper; \n\n };\n\n self.init();\n self.render();\n\n\n}",
"_initShape () {\n // Set default style for shaape\n if (!this.handlePointStyle) {\n this.handlePointStyle = HANDLE_POINT_STYLE\n }\n if (!this.shapeStyle) {\n this.shapeStyle = EDIT_SHAPE_STYLE\n }\n }",
"function initEditor() {\n renderWorkingLine();\n renderTextInput();\n renderFontColorPicker();\n renderFontSize();\n toggleStrokeBtn();\n renderStrokeColorPicker();\n renderStrokeSize();\n renderStickers();\n}",
"addCustomizableElementsPanel() {\n\t\tconst x = 680;\n\t\tconst y = 309;\n\n\t\tconst charBackground = this.game.add.image(x + 28, y + 27, 'character_preview');\n\t\tcharBackground.height = 220;\n\t\tcharBackground.width = 190;\n\n\t\tthis.addPanelElement('Body Type', 'Left', 0, new Piece(this.game, null, null, null, x, y, 'Large_Feminine_OverWorld_Body_A_Down2.png'), 'body');\n\t\tthis.addPanelElement('Hairstyle', 'Left', 1, new Piece(this.game, null, null, null, x, y, 'Large_Feminine_OverWorld_HairStyle_A_Down2.png'), 'hairstyle');\n\t\tthis.addPanelElement('Facial Hair', 'Left', 2, new Piece(this.game, null, null, null, x, y, 'Large_Feminine_OverWorld_FacialHair_A_Down2.png'), 'facialhair');\n\t\tthis.addPanelElement('Upper Body', 'Left', 3, new Piece(this.game, null, null, null, x, y, 'Large_Feminine_OverWorld_UpperBody_A_Down2.png'), 'upperbody');\n\t\tthis.addPanelElement('Lower Body', 'Left', 4, new Piece(this.game, null, null, null, x, y, 'Large_Feminine_OverWorld_LowerBody_A_Down2.png'), 'lowerbody');\n\t\tthis.addPanelElement('Headwear', '', 0, new Piece(this.game, null, null, null, x, y, 'Large_Feminine_OverWorld_HeadWear_A_Down2.png'), 'headwear');\n\t\tthis.addPanelElement('Facewear', '', 1, new Piece(this.game, null, null, null, x, y, 'Large_Feminine_OverWorld_FaceWear_A_Down2.png'), 'facewear');\n\t\tthis.addPanelElement('Hands/Arms', '', 2, new Piece(this.game, null, null, null, x, y, 'Large_Feminine_OverWorld_Hands_A_Down2.png'), 'hands');\n\t\tthis.addPanelElement('Footwear', '', 3, new Piece(this.game, null, null, null, x, y, 'Large_Feminine_OverWorld_FootWear_A_Down2.png'), 'footwear');\n\t\tthis.addPanelElement('Weapon', '', 4, new Piece(this.game, null, null, null, x, y, 'Large_Feminine_OverWorld_Weapon_A_Down_RightHanded2.png'), 'weapon');\n\t\tthis.addEyeColorModifiers(new Piece(this.game, null, null, null, x, y, 'Large_Feminine_OverWorld_EyeColour_A_Down2.png'), 'eyecolour');\n\n\t\tthis.addTurnCharacter();\n\n\t\tthis.characterShuffle();\n\t}",
"register(editor){\n super.register(editor);\n\n let getActive = function(){\n return editor.$editable.find('.grapple-image.active');\n };\n\n let updatePanelPosition = ($image) =>{\n let $panel = this.$panel;\n $panel.css($image.offset()).outerWidth($image.width());\n if($panel.offset().left + $panel.outerWidth() > editor.$editable.width()){\n $panel.css('left', editor.$editable.width() - $panel.outerWidth());\n }\n\n return $panel;\n };\n\n let helperGetSizeClass = (current_class, is_increase) =>{\n let arr_ordered_classes = [\n \"size-ico\",\n \"size-xs\",\n \"size-sm\",\n \"size-md\",\n \"size-lg\",\n \"size-full\"\n ];\n\n let current_index = arr_ordered_classes.indexOf(current_class);\n let new_index = current_index;\n\n if (is_increase){\n if (current_index < arr_ordered_classes.length - 1)\n new_index = current_index + 1;\n }else{\n if (current_index > 0)\n new_index = current_index - 1;\n }\n\n return arr_ordered_classes[new_index];\n };\n\n $(editor.doc).on('click', (evt) =>{\n let $target = $(evt.target);\n\n getActive().removeClass('active');\n\n if($target.hasClass('grapple-image')) {\n $target.addClass('active');\n updatePanelPosition($target).addClass('active');\n\n } else {\n this.$panel.removeClass('active');\n }\n });\n\n $(editor.doc).on('drop', function(){\n updatePanelPosition(getActive());\n });\n\n this.$panel = $('<ul class=\"image-pane\">' +\n '<li class=\"align align-left\" data-class=\"align-left\"></li>' +\n '<li class=\"align align-center\" data-class=\"align-center\"></li>' +\n '<li class=\"align align-right\" data-class=\"align-right\"></li>' +\n '<li class=\"size size-decrease\" data-type=\"decrease\"></li>' +\n '<li class=\"size size-increase\" data-type=\"increase\"></li>' +\n '<li class=\"remove\"></li></ul>')\n .prependTo(editor.doc.body);\n\n this.$panel.on('click', 'li.remove', (evt) =>{\n evt.stopPropagation();\n\n getActive().remove();\n this.$panel.removeClass('active');\n editor.checkChange();\n });\n\n this.$panel.on('click', 'li.align', (evt) =>{\n let $active = getActive();\n evt.stopPropagation();\n\n $active.removeClass('align-left align-right align-center').addClass(evt.target.getAttribute('data-class'));\n editor.checkChange();\n updatePanelPosition($active);\n });\n\n this.$panel.on('click', 'li.size', (evt) =>{\n let $active = getActive();\n evt.stopPropagation();\n\n let action_type = evt.target.getAttribute('data-type');\n let current_class = $active.attr('data-size');\n let new_class = helperGetSizeClass(current_class, (action_type==\"increase\"));\n \n $active.removeClass('size-ico size-xs size-sm size-md size-lg size-full').addClass(new_class);\n $active.attr('data-size', new_class);\n\n editor.checkChange();\n editor.updateHeight();\n updatePanelPosition($active);\n });\n }",
"initEditor() {\n let savedCode = this.service.getCode(this.currentExo.method);\n if (savedCode)\n this.editor.setValue(savedCode);\n\n byId('editor').style.height = this.editorHeight + 'px';\n this.editor.resize();\n }",
"function initializePipelineEditor() {\n pipelineGraphEditor = new GraphEditor($('#pipelineDesigner'),\n createStep,\n handleElementRemove,\n null,\n null,\n function(metaData) {\n // Open the drawer\n loadPropertiesPanel(metaData);\n $('#step-editor-drawer').drawer('show');\n });\n\n // Pipeline Designer\n $('#save-button').click(handleSave);\n $('#new-button').click(handleNew);\n $('#copy-button').click(handleCopy);\n $('#reset-button').click(handleReset);\n $('#delete-button').click(handleDelete);\n $('#layout-pipeline-button').click(function() {\n pipelineGraphEditor.performAutoLayout();\n });\n}",
"function LGraphGUIPanel()\r\n\t{\r\n\t\tthis.addOutput(\"pos\",\"vec2\");\r\n\t\tthis.addOutput(\"enabled\",\"boolean\");\r\n\t\tthis.properties = { enabled: true, draggable: false, title: \"\", color: [0.1,0.1,0.1], opacity: 0.7, titlecolor: [0,0,0], position: [10,10], size: [300,200], rounding: 8, corner: LiteGraph.CORNER_TOP_LEFT };\r\n\t\tthis._area = vec4.create();\r\n\t\tthis._color = vec4.create();\r\n\t\tthis._titlecolor = vec4.create();\r\n\t\tthis._offset = [0,0];\r\n\t}",
"function setupEditor() {\n\tif (!ITTY || !ITTY.editor || !ITTY.editor.ids || typeof ITTY.editor.ids != \"object\") {\n\t\treturn;\n\t}\n\tvar oInputPane = document.getElementById(ITTY.editor.ids.textinput) || document.getElementById(\"ittyMarkdownInput\");\n\tvar oOutputPane = document.getElementById(ITTY.editor.ids.xhtmloutput) || document.getElementById(\"ittyXhtmlOutput\");\n\tvar oCodeInputPane = document.getElementById(ITTY.editor.ids.xhtmlinput) || document.getElementById(\"ittyXhtmlInput\");\n\tvar oLeftContainer = document.getElementById(ITTY.editor.ids.editordiv) || document.getElementById(\"ittyEditor\");\n\tvar oInfoContainer = document.getElementById(ITTY.editor.ids.infodiv) || document.getElementById(\"ittyfooter\");\n\t\n\t/* oPreviewPaneContainer is optional and not particularly desirable! \n\t Don't set unless you want side by side and accomodate it in your CSS.\n\t When not set, the preview goes below the TA, just after the footer/info. --fac \n\t*/\t \n\tvar oPreviewPaneContainer = document.getElementById(ITTY.editor.ids.previewcontainer);\n\tif (oPreviewPaneContainer) {\n\t\toPreviewPaneContainer.className = ITTY.editor.ids.previewcontainerclass || \"\";\n\t} // define the preview pane if you want, otherwise it's appended below the editor\n\t\n\tif (!oInputPane || !oOutputPane || !oCodeInputPane || !oLeftContainer) {\n\t\treturn;\n\t} //check for presence of required\n\t\n\tvar oContainer = document.createElement(\"div\");\n\t\n\tvar oToolbar = ITTY.editor.toolbar.make(oInputPane);\n\t\t/* make a toolbar object: Arguments\n\t\t[0] oInputPane (object): the input textarea element*/\n\t\n\tif (!oToolbar) {return;}\n\t\n\tif (oContainer.appendChild(oToolbar.toolset)) {\n\t\toContainer.setAttribute('class', 'ittyToolbar');\n\t\t\t// matches internal expectations of ittyToolbar's className\n\t\t\n\t\tif (oInputPane.parentNode.insertBefore(oContainer,oInputPane)) {\n\t\t\t// put the toolbar above the input pane\t\n\t\n\t\t\toLogo = document.createElement(\"span\");\n\t\t\tvar tlogoSpace = (ITTY.editor.ids.logotitle && document.createTextNode(ITTY.editor.ids.logotitle)) || document.createTextNode(\"itty logo\");\n\t\t\tif (oLogo) {\n\t\t\t\toLogo.appendChild(tlogoSpace);\n\t\t\t\tif (ITTY.editor.ids.logoclass) {\n\t\t\t\t\tITTY.editor.common.xsetAttribute(oLogo, 'class', ITTY.editor.ids.logoclass);\n\t\t\t\t} else {\n\t\t\t\t\tITTY.editor.common.xsetAttribute(oLogo, 'class', 'ittyLogo');\n\t\t\t\t}\n\t\t\t\toContainer.insertBefore(oLogo, oContainer.lastChild);\n\t\t\t\t\t// brand the toolbar: add a logo (example is a 52 x 60 px alpha png)\n\t\t\t}\n\t\n\t\t\tvar oC = ITTY.editor.converter.make(oToolbar, oOutputPane, oCodeInputPane, oInfoContainer); //, oInfoContainer optional\n\t\t\t\t/* set up Markdown2xhtml converter: Arguments: \n\t\t\t\t[0] oToolbar (object): import toolbar instance;\n\t\t\t\t[1] oOutputPane (object): viewSource textarea element; and \n\t\t\t\t[2] oInfoContainer (object): the empty, extra info container.*/\n\t\t\t\t// make a converter object\n\t\n\t\t\t\t// may reset some variables to coordinate with our page, like shorter or longer delay for auto-conversion\n\t\t}\n\t}\t\n}",
"function initEditorView() {\n shrinkLimit = false;\n scalePercent = 0;\n setOrientation();\n\n dragging = false;\n mainContext = mainCanvas.getContext('2d');\n guideContext = frameCanvas.getContext('2d');\n workingCanvas = document.createElement('canvas');\n workingContext = workingCanvas.getContext('2d');\n scaleSlider.max = image.width;\n scaleSlider.value = image.width;\n scaleSlider.min = w;\n minimumScale = w;\n scaledWidth = image.width;\n scaledHeight = image.height;\n originY = ((image.height - mainCanvas.height) / 2 ) * -1;\n originX = ((image.width - mainCanvas.width) / 2 ) * -1;\n mainContext.clearRect(0, 0, w, h);\n\n document.getElementById('Output').value = '';\n document.getElementById(\"controls\").style.display='block';\n document.getElementById(\"ImageMetrics\").style.display='block';\n document.getElementById(\"ScaleSlider\").style.display='inline-block';\n document.getElementById(\"CropButton\").style.display='inline-block';\n document.getElementById(\"ResetButton\").style.display='inline-block';\n mainCanvas.style.display='block';\n frameCanvas.style.display='block';\n }",
"create() {\n let body = document.getElementsByTagName(\"body\")[0];\n let html = SideTools.HTML;\n html = html.replace(/{pathImage}/g, window.easySafeEditor.options.getValue(\"paths.images\"));\n html = html.replace(/{pageEditTitle}/g, window.easySafeEditor.options.getValue(\"labels.pageEditTitle\"));\n html = html.replace(/{openMenu}/g, window.easySafeEditor.options.getValue(\"labels.openMenu\"));\n html = html.replace(/{closeMenu}/g, window.easySafeEditor.options.getValue(\"labels.closeMenu\"));\n html = html.replace(/{close}/g, window.easySafeEditor.options.getValue(\"labels.close\"));\n \n let nodePanel = createElement(html);\n body.insertBefore(nodePanel, body.firstChild);\n\n this.panelTool = document.getElementById(\"easySafeTools\");\n this.pageTitle = document.getElementById(\"easySafeTools_PageTitle\");\n this.editableContainers = document.getElementById(\"easySafeTools_EditableContainers\");\n this.collapseButton = document.getElementById(\"easySafeTools_collapsePanel\");\n this.uncollapseButton = document.getElementById(\"easySafeTools_uncollapsePanel\");\n this.closeButton = document.getElementById(\"easySafeTools_closePanel\");\n this.buttonsContainer = document.getElementById(\"easySafeTools_sideButtons\");\n\n\n this.collapseButton.addEventListener(\"click\", (event) => this.onCollapseButtonClick(event), true);\n this.uncollapseButton.addEventListener(\"click\", (event) => this.onCollapseButtonClick(event), true);\n this.closeButton.addEventListener(\"click\", (event) => this.onCloseButtonClick(event), true);\n\n this.pageTitle.value = window.easySafeEditor.post.getTitle();\n this.pageTitle.addEventListener(\"input\", (event) => this.onChangeTitle(event), true);\n\n let buttons = window.easySafeEditor.options.getValue(\"sideBar.buttons\");\n buttons.forEach(button => {\n let element = null;\n \n if ((typeof button) == \"string\")\n element = createElement(button);\n else if ((typeof button) == \"HTMLElement\")\n element = button;\n\n if (element != null)\n this.buttonsContainer.append(element);\n });\n }",
"showPropertyEditor() {\n const LayoutMng = require('../layout/layout_mng');\n // create the editor window if not exists\n if (null==this.propEditor) {\n let editor = this.propEditor = this.createFormWindow('Settings Editor #'+this.id, {\n parent: LayoutMng.singleton.uiParent,\n border: 'line',\n top: Math.max(parseInt(LayoutMng.singleton.uiParent.height/2)-20, 1),\n left: 'center',\n width: 35,\n shrink: true,\n });\n editor.compCount = 0;\n editor.comps = new Object();\n this.addPropertyEditorComps();\n let okay = this.createBtn('Okay', {\n parent: editor, \n right: 14, \n top: this.propEditor.compCount*2+1, \n width: 6, height: 1,\n });\n okay.on('press', ()=>{ editor.submit(); });\n editor.on('submit', (data)=>{\n this.propEditor.hide();\n LayoutMng.singleton.screen.render();\n for (let n in data) {\n if (typeof(data[n])!='string') {\n delete data[n];\n continue;\n }\n data[n] = data[n].trim();\n }\n bilog(\"settings submit: \"+JSON.stringify(data));\n this.onPropertyEditorSubmit(data);\n });\n let cancel = this.createBtn('Cancel', {\n parent: editor, \n right: 2, \n top: this.propEditor.compCount*2+1, \n width: 8, height: 1,\n });\n cancel.on('press', ()=>{\n this.propEditor.hide();\n });\n }\n // reset values of all fields\n LayoutMng.singleton.screen.render();\n this.resetPropertyEditorData();\n // show up\n this.propEditor.show();\n this.propEditor.focus();\n LayoutMng.singleton.screen.render();\n }",
"addPanel(component) {\nthis\n.addInfoToComponent(component, formEditorConstants.COMPONENT_TYPE_PANEL)\n.addProperty(component, 'name', this._componentList.findComponentText(component.type, 'name', 'Panel'))\n.addProperty(component, 'zIndex', 0)\n.addProperty(component, 'width', 200)\n.addProperty(component, 'height', 128);\nif (!('containerIds' in component)) {\nthis.addProperty(component, 'containerIds', [this._formEditorState.getNextId()]);\n}\nreturn component;\n}",
"_initializeEditor(editor) {\n const that = this;\n\n if (that.$[editor + 'Editor']) {\n that._editor = that.$[editor + 'Editor'];\n return;\n }\n\n const editorElement = document.createElement('jqx-' + JQX.Utilities.Core.toDash(editor));\n\n if (editor === 'numericTextBox') {\n editorElement.spinButtons = true;\n editorElement.inputFormat = 'floatingPoint';\n }\n else if (editor === 'dateTimePicker') {\n editorElement.dropDownAppendTo = that.$.container;\n editorElement.calendarButton = true;\n editorElement.dropDownDisplayMode = 'auto';\n editorElement.enableMouseWheelAction = true;\n editorElement.locale = that.locale;\n\n if (!editorElement.messages[that.locale]) {\n editorElement.messages[that.locale] = {};\n }\n\n editorElement.messages[that.locale].dateTabLabel = that.localize('dateTabLabel');\n editorElement.messages[that.locale].timeTabLabel = that.localize('timeTabLabel');\n }\n\n editorElement.theme = that.theme;\n editorElement.animation = that.animation;\n editorElement.$.addClass('jqx-hidden underlined');\n that.$.editorsContainer.appendChild(editorElement);\n that._editor = that.$[editor + 'Editor'] = editorElement;\n }",
"function _setupPanel(panel){\r\n\treturn panel\r\n\t\t.on('panelClosing', function(){\r\n\t\t\tif($('.sub-panel').length <= 1){\r\n\t\t\t\t// XXX when not only the editor is using the panels, this\r\n\t\t\t\t// \t\tis not the correct way to go...\r\n\t\t\t\ttoggleEditor('off')\r\n\t\t\t}\r\n\t\t})\r\n\t\t.on('newPanel', function(evt, panel){\r\n\t\t\t_setupPanel(panel)\r\n\t\t})\r\n\t\t// make clicks on unfocusable elements remove focus...\r\n\t\t.click(function(){\r\n\t\t\tif(event.target != $('.panel :focus')[0]){\r\n\t\t\t\t$('.panel :focus').blur()\r\n\t\t\t}\r\n\t\t})\r\n}",
"addPropertyEditorComps() {\n // Postion field\n this.addInputFieldToPropertyEditor('Left,Top', '_lt');\n // Size field\n if (this.resizeable())\n this.addInputFieldToPropertyEditor('Width,Height', '_wh');\n }",
"function PropertyEditor(){}",
"function BaseEditor() { }",
"function BaseEditor() { }",
"function Editor() { }",
"function Editor() { }",
"function PreviewPanel$(config/*:PreviewPanel = null*/){var this$=this;if(arguments.length<=0)config=null;\n var config_$1/*: com.coremedia.cms.editor.sdk.preview.PreviewPanelBase*/ =AS3.cast(com.coremedia.cms.editor.sdk.preview.PreviewPanelBase,{});\n var defaults_$1/*:PreviewPanel*/ =AS3.cast(PreviewPanel,{});\n config = net.jangaroo.ext.Exml.apply(defaults_$1,config);\n config_$1[\"ariaRole\"] = \"region\";\n config_$1[\"focusable\"] = true;\n config_$1.defaultFocus = \":focusable\";\n config_$1.ariaLabel =net.jangaroo.ext.Exml.asString( this.resourceManager.getString('com.coremedia.cms.editor.Editor', 'PreviewPanel_label'));\n AS3.setBindable(config_$1,\"layout\" , \"fit\");\n config_$1.hideCollapseTool = true;\n config_$1.header = false;\n var ui_SwitchingContainer_96_5_$1/*:com.coremedia.ui.components.SwitchingContainer*/ =AS3.cast(com.coremedia.ui.components.SwitchingContainer,{});\n AS3.setBindable(ui_SwitchingContainer_96_5_$1,\"activeItemValueExpression\" , this.getActivePreviewPanelValueExpression());\n var editor_InnerPreviewPanel_99_9_$1/*: com.coremedia.cms.editor.sdk.preview.InnerPreviewPanel*/ =AS3.cast(com.coremedia.cms.editor.sdk.preview.InnerPreviewPanel,{});\n editor_InnerPreviewPanel_99_9_$1.itemId = \"innerPreviewPanel\";\n AS3.setBindable(editor_InnerPreviewPanel_99_9_$1,\"hideDeviceSlider\" , AS3.getBindable(config,\"hideDeviceSlider\"));\n AS3.setBindable(editor_InnerPreviewPanel_99_9_$1,\"metadataService\" , this.getMetadataService());\n var container_102_9_$1/*:ext.container.Container*/ =AS3.cast(Ext.container.Container,{});\n container_102_9_$1.itemId =net.jangaroo.ext.Exml.asString( com.coremedia.cms.editor.sdk.preview.PreviewPanelBase.NO_PREVIEW_ITEM_ID);\n container_102_9_$1.ui =net.jangaroo.ext.Exml.asString( com.coremedia.ui.skins.ContainerSkin.DARK_200);\n var displayField_105_13_$1/*:ext.form.field.DisplayField*/ =AS3.cast(Ext.form.field.Display,{});\n displayField_105_13_$1.ui =net.jangaroo.ext.Exml.asString( com.coremedia.ui.skins.DisplayFieldSkin.ITALIC.getSkin());\n AS3.setBindable(displayField_105_13_$1,\"value\" , AS3.getBindable(config,\"noPreviewAvailableMessage\") || this.resourceManager.getString('com.coremedia.cms.editor.Editor', 'PreviewPanel_emptyPreview'));\n container_102_9_$1.items = [displayField_105_13_$1];\n ui_SwitchingContainer_96_5_$1.items = [editor_InnerPreviewPanel_99_9_$1, container_102_9_$1];\n config_$1.items = [ui_SwitchingContainer_96_5_$1];\n var editor_PreviewPanelToolbar_113_5_$1/*: com.coremedia.cms.editor.sdk.preview.PreviewPanelToolbar*/ =AS3.cast(com.coremedia.cms.editor.sdk.preview.PreviewPanelToolbar,{});\n AS3.setBindable(editor_PreviewPanelToolbar_113_5_$1,\"collapseHandler\" , AS3.getBindable(config,\"collapseHandler\"));\n AS3.setBindable(editor_PreviewPanelToolbar_113_5_$1,\"hidden\" , AS3.getBindable(config,\"hideToolbar\"));\n editor_PreviewPanelToolbar_113_5_$1.ui =net.jangaroo.ext.Exml.asString( com.coremedia.ui.skins.ToolbarSkin.WORKAREA.getSkin());\n AS3.setBindable(editor_PreviewPanelToolbar_113_5_$1,\"reloadHandler\" , function()/*:void*/ { this$.reloadFrame(); if(config.reloadHandler) {config.reloadHandler();} });\n var ui_ValueExpression_118_9_$1/*:com.coremedia.ui.exml.ValueExpression*/ =AS3.cast(com.coremedia.ui.exml.ValueExpression,{});\n AS3.setBindable(ui_ValueExpression_118_9_$1,\"expression\" , \"previewUrl\");\n AS3.setBindable(ui_ValueExpression_118_9_$1,\"context\" , this);\n AS3.setBindable(editor_PreviewPanelToolbar_113_5_$1,\"urlValueExpression\" , new com.coremedia.ui.exml.ValueExpression(ui_ValueExpression_118_9_$1));\n config_$1.tbar = editor_PreviewPanelToolbar_113_5_$1;\n var editor_BookmarkAction_124_5_$1/*:com.coremedia.cms.editor.sdk.bookmarks.BookmarkAction*/ =AS3.cast(com.coremedia.cms.editor.sdk.bookmarks.BookmarkAction,{});\n AS3.setBindable(editor_BookmarkAction_124_5_$1,\"contentValueExpression\" , AS3.getBindable(config,\"bindTo\"));\n AS3.setBindable(config_$1,\"actionList\" , [new com.coremedia.cms.editor.sdk.bookmarks.BookmarkAction(editor_BookmarkAction_124_5_$1)]);\n config_$1[\"actionList$at\"] = net.jangaroo.ext.Exml.APPEND;\n net.jangaroo.ext.Exml.apply(config_$1,config);\n this.super$aMOS(config_$1);\n }",
"static createEditor(params) {\r\n\t\tDOM.createEditor(params);\r\n\t\tInit.editor = Getter.getEditor();\r\n\t\t\r\n\t\tswitch (mode) {\r\n\t\tcase 'balloon':\r\n\t\t\t/*create popup toolbar in balloon mode*/\r\n\t\t\tInit.createToolbar('swe-toolbar-pu', 'swe-none');\r\n\t\t\tInit.setShowingPopupToolbarEvents();\r\n\t\t\t/*set selectionEnd timer value*/\r\n\t\t\tInit.selectionEndTimer = null;\r\n\t\t\tbreak;\r\n\t\tcase 'classic':\r\n\t\tdefault:\r\n\t\t\t/*create fixed toolbar in balloon mode*/\r\n\t\t\tInit.createToolbar('swe-toolbar', params.sticky ? 'swe-toolbar-sticky' : null);\r\n\t\t\tDOM.createBottomPanel();\r\n\t\t\tInit.setEventListener(Init.editor, 'input', Init.setCountersValue);\r\n\t\t\tInit.setCountersValue();\r\n\t\t}\r\n\t\t/*highlight editors images on click*/\r\n\t\tInit.setEventListener(Init.editor, 'mousedown', Images.selectImageOnClick);\r\n\t\tInit.setEventListener(document, 'mousedown', Images.removeImageFrameOnOutsideClick);\t\t\r\n\t\t/*set textarea value on input*/\r\n\t\tInit.setEventListener(Init.editor, 'input', Init.setTextAreaValue);\r\n\t\t/*highlight buttons of toolbar that have the same style as selection*/\r\n\t\tInit.setEventListener(document, 'selectionchange', Init.highlightTheButtons);\r\n\t}",
"async setPanel(_) {\n if (!arguments.length)\n return this._nodeEdgePanel;\n this._nodeEdgePanel = _;\n }",
"async setPanel(_) {\n if (!arguments.length)\n return this._irisPanel;\n this._irisPanel = _;\n }",
"async setPanel(_) {\n if (!arguments.length)\n return this._irisPanel;\n this._irisPanel = _;\n }"
] |
[
"0.70467025",
"0.63430184",
"0.6309362",
"0.6300952",
"0.62441707",
"0.62281024",
"0.6204311",
"0.5986968",
"0.59697926",
"0.58973294",
"0.58360356",
"0.58198124",
"0.5749198",
"0.57448304",
"0.5737035",
"0.5714603",
"0.56999",
"0.5699018",
"0.56742215",
"0.5621828",
"0.55888647",
"0.5557794",
"0.5557794",
"0.55477136",
"0.55477136",
"0.55361235",
"0.5532169",
"0.5527958",
"0.5527838",
"0.5527838"
] |
0.7721231
|
0
|
Makes grid visible or invisible, depedinding of previous value If the "snap to" was active and grid made invisible the "snap to" will be disabled
|
function showGrid() {
/**If grid was visible and snap to was check we need to take measures*/
if (gridVisible) {
if (snapTo) {
snapTo = false;
document.getElementById("snapCheckbox").checked = false;
}
}
gridVisible = !gridVisible;
backgroundImage = null; // reset cached background image of canvas
//trigger a repaint;
draw();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function snap() {\r\n\t\tvar snap = document.getElementById(\"snap\");\r\n\t\tif (snap.checked === true) {\r\n\t\t myDiagram.toolManager.draggingTool.isGridSnapEnabled = true;\r\n\t\t myDiagram.toolManager.resizingTool.isGridSnapEnabled = true;\r\n\t\t} else {\r\n\t\t myDiagram.toolManager.draggingTool.isGridSnapEnabled = false;\r\n\t\t myDiagram.toolManager.resizingTool.isGridSnapEnabled = false;\r\n\t\t}\r\n\t }",
"function setGridInvisible() {\n grid.style.transition = \"none\";\n grid.style.visibility = \"hidden\";\n}",
"function toggleVisible() {\n setVisible(false)\n\n }",
"function toggleGrid()\n{\n\tconsole.log(\"Show Grid: \" + !showGrid);\n\tshowGrid = !showGrid;\n}",
"function grid() {\r\n\t\tvar grid = document.getElementById(\"grid\"); \r\n\t\tif (grid.checked === true) {\r\n\t\t myDiagram.grid.visible = true;\r\n\t\t return;\r\n\t\t} else {\r\n\t\t myDiagram.grid.visible = false; \r\n\t\t}\r\n\t }",
"function setGridState(visible, enabled) {\n var gridContents = document.getElementsByClassName('grid-content');\n var grid = document.getElementById('grid');\n\n if (enabled) {\n grid.setAttribute('enabled', '');\n } else {\n grid.removeAttribute('enabled');\n }\n\n for (var i = 0; i < gridContents.length; i++) {\n if (!visible) {\n gridContents[i].classList.add('invisible');\n } else {\n gridContents[i].classList.remove('invisible');\n }\n }\n}",
"function updateGridOption() {\n myDiagram.startTransaction(\"grid\");\n var grid = document.getElementById(\"grid\");\n myDiagram.grid.visible = (grid.checked === true);\n myDiagram.commitTransaction(\"grid\");\n}",
"function updateSnapOption() {\n // no transaction needed, because we are modifying tools for future use\n var snap = document.getElementById(\"snap\");\n if (snap.checked === true) {\n myDiagram.toolManager.draggingTool.isGridSnapEnabled = true;\n myDiagram.toolManager.resizingTool.isGridSnapEnabled = true;\n } else {\n myDiagram.toolManager.draggingTool.isGridSnapEnabled = false;\n myDiagram.toolManager.resizingTool.isGridSnapEnabled = false;\n }\n}",
"function snapToGrid(activity, xValue, yValue) {\n\n}",
"set visible(value) {\n this._planeHelper.visible = value;\n }",
"checkVisible() {\r\n let squares = this.state.squares;\r\n let mapLevel = this.state.mapLevel;\r\n let p = this.state.playerIndex;\r\n let n = 20;\r\n let visible = [];\r\n const aura = [p, p-2, p-1, p+1, p+2, p+3, p-3,\r\n p-n, p-n-2, p-n-1, p-n+1, p-n+2,\r\n p+n, p+n-2, p+n-1, p+n+1, p+n+2,\r\n p-n*2, p-n*2-1, p-n*2+1,\r\n p+n*2, p+n*2-1, p+n*2+1,\r\n p-4, p+4];\r\n\r\n //only set visible what is on grid and eliminate overflow to other rows\r\n for (let i=0; i<aura.length; i++) {\r\n if (Math.abs(aura[i] % n - p % n) < 4 && aura[i] >= 0 && aura[i] < squares[mapLevel].length) {\r\n visible.push(aura[i]);\r\n }\r\n }\r\n let hidden = [];\r\n for (let i=0; i<squares[mapLevel].length; i++) {\r\n if (!visible.includes(i)) {\r\n hidden.push(i);\r\n }\r\n }\r\n this.setHidden(hidden);\r\n this.setVisible(visible);\r\n }",
"toggleVisibility() {\n this.setVisible(!this.visible);\n }",
"toggle() {\n const v = this.getSetting(\"visible\");\n this.visible = !v;\n this.setSetting(\"visible\", !v);\n\n //If first time, set autofog to opposite so it doesn't reapply it.\n let history = canvas.scene.getFlag(this.layername, \"history\");\n\n if (history === undefined) {\n this.setSetting(\"autoFog\", !v);\n return;\n }\n }",
"function executeSnapGrid(state){\r\n\tif(state){\r\n\t\tcy.snapToGrid('snapOn');\r\n\t\tcy.snapToGrid('gridOn');\r\n\t}\r\n\telse{\r\n\t\tcy.snapToGrid('snapOff');\r\n\t\tcy.snapToGrid('gridOff');\r\n\t}\r\n}",
"function visibilityMoney() {\n setVisible((prevState) => !prevState);\n }",
"set visible(value) {\n if (value) {\n this.node.setAttribute(\"visible\", true);\n } else {\n this.node.removeAttribute(\"visible\");\n this.active = false;\n this.focusWhenActive = false;\n }\n }",
"function toggleSnapping() {\n\t\tvar snapOK = document.getElementById(\"snap\").checked;\n\t\tif (snapOK) {\n\t\t\tsnapping.activate();\n\t\t} else {\n\t\t\tsnapping.deactivate();\n\t\t}\n}",
"setLandingInfoDisplayed(value) {\n this.landingInfoDisplayed = value;\n this.box2.visible = value;\n _.each(_.filter(this.nodes, (node) => node.showCloseToPlanet), (node) => {\n node.shape.visible = value;\n });\n }",
"static set visible(value) {}",
"function toggleGrid() {\n if (!hideGrid) {\n hideGrid = true;\n $('#svgGrid').find('rect').attr('fill', 'white');\n } else {\n hideGrid = false;\n $('#svgGrid').find('rect').attr('fill', 'url(#grid)');\n }\n}",
"setVisible(value) {\n this.visible = value;\n _.each(this.shapes, (shape) => {\n shape.visible = value;\n });\n }",
"function setVisibles() {\n $scope.show_feeding_curves = false; //Wenn Daten vorhanden und nicht Objekt nicht leer, dann auf true\n $scope.show_error_text = false; //Wenn keine Daten vorhanden sind, dann auf true\n //$scope.selectedIndex = -1; //setzt die Klasse \"active\" auf die ausgewaehlte Tabellenzeile\n $scope.leftYLabel = '';\n }",
"function toggleVisibility() {\n setVisibility(isVisible => !isVisible);\n }",
"function toggleVisibility() {\n setVisibility(isVisible => !isVisible);\n }",
"function toggle_to_low(){\n\tisSnapVisible = true;\n\tvideo_out.style.display = 'none';\n\tsnap_out.style.display = 'block';\n\tpause();\n\tsend_img_loop();\n}",
"noGrid() {\n this._gridParams = false;\n }",
"function toggleMovementDisplay() {\n\tisHidden.style.display = 'block';\n}",
"function update() {\n //var snap = snap.prop(\"checked\"), liveSnap = $liveSnap.prop(\"checked\");\n Draggable.create('.box', {\n bounds: container,\n edgeResistance: 0.65,\n type: 'x,y',\n throwProps: true,\n liveSnap: liveSnap,\n snap: {\n x: function (endValue) {\n return snap || liveSnap ? Math.round(endValue / gridWidth) * gridWidth : endValue;\n },\n y: function (endValue) {\n return snap || liveSnap ? Math.round(endValue / gridHeight) * gridHeight : endValue;\n }\n }\n });\n }",
"function snapOut(focus) {\n var keys = Object.keys(visibles);\n if (keys.length > 2 || keys.length < 1) throw \"PLOT: expected 1-2 layers\";\n\n if (Math.abs(10000 - visibles[Object.keys(visibles)[0]].scale.x) > 4) {\n this.zoom(focus, 5);\n return false;\n } else {\n for (var key in visibles) {\n visibles[key].scale.x = 10000;\n }\n return true;\n }\n }",
"function update() {\n var snap = $snap.prop(\"checked\"),\n liveSnap = $liveSnap.prop(\"checked\");\n\tDraggable.create(\".box\", {\n\t\tbounds:$container,\n\t\tedgeResistance:0.65,\n\t\ttype:\"x,y\",\n\t\tthrowProps:true,\n\t\tliveSnap:liveSnap,\n\t\tsnap:{\n\t\t\tx: function(endValue) {\n\t\t\t\treturn (snap || liveSnap) ? Math.round(endValue / gridWidth) * gridWidth : endValue;\n\t\t\t},\n\t\t\ty: function(endValue) {\n\t\t\t\treturn (snap || liveSnap) ? Math.round(endValue / gridHeight) * gridHeight : endValue;\n\t\t\t}\n\t\t}\n\t});\n}"
] |
[
"0.7160396",
"0.6910818",
"0.6657223",
"0.66179657",
"0.66085166",
"0.65047735",
"0.63629955",
"0.63577014",
"0.6345158",
"0.6317878",
"0.63112783",
"0.6302816",
"0.62902975",
"0.6274988",
"0.6164239",
"0.6106401",
"0.60991347",
"0.60934",
"0.6076557",
"0.60635424",
"0.60488003",
"0.6010976",
"0.6002839",
"0.6002839",
"0.59509784",
"0.5913045",
"0.5901443",
"0.58545256",
"0.5852112",
"0.5841842"
] |
0.7035048
|
1
|
Print current diagram Print can be triggered in 3 cases only after diagram was saved: 1 from menu 2 from quick toolbar 3 from Ctrl + P shortcut Copy link to saved diagram's png file to src of image, add it to iframe and call print of last.
|
function print_diagram() {
var printFrameId = "printFrame";
var iframe = document.getElementById(printFrameId);
// if iframe isn't created
if (iframe == null) {
iframe = document.createElement("IFRAME");
iframe.id = printFrameId;
document.body.appendChild(iframe);
}
// get DOM of iframe
var frameDoc = iframe.contentDocument;
var diagramImages = frameDoc.getElementsByTagName('img');
var diagramImage;
if (diagramImages.length > 0) { // if image is already added
diagramImage = diagramImages[0];
// set source of image to png of saved diagram
diagramImage.setAttribute('src', "data/diagrams/" + currentDiagramId + ".png");
} else { // if image isn't created yet
diagramImage = frameDoc.createElement('img');
// set source of image to png of saved diagram
diagramImage.setAttribute('src', "data/diagrams/" + currentDiagramId + ".png");
if (frameDoc.body !== null) {
frameDoc.body.appendChild(diagramImage);
} else {
// IE case for more details
// @see http://stackoverflow.com/questions/8298320/correct-access-of-dynamic-iframe-in-ie
// create body of iframe
frameDoc.src = "javascript:'<body></body>'";
// append image through html of <img>
frameDoc.write(diagramImage.outerHTML);
frameDoc.close();
}
}
// adjust iframe size to main canvas (as it might have been changed)
iframe.setAttribute('width', canvasProps.getWidth());
iframe.setAttribute('height', canvasProps.getHeight());
// print iframe
iframe.contentWindow.print();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function printDiagram() {\n var svgWindow = window.open();\n if (!svgWindow) return; // failure to open a new Window\n var printSize = new go.Size(1700, 2960);\n var bnds = myDiagram.documentBounds;\n var svg = myDiagram.makeSvg({ scale: 1.0, position: new go.Point(0, 0), size: bnds });\n svgWindow.document.body.appendChild(svg);\n}",
"_print() {\n const printWindow = window.open('about:blank', '_new');\n printWindow.document.open();\n printWindow.document.write(`\n <html>\n <head>\n <script>\n function onloadImage() {\n setTimeout('printImage()', 10);\n }\n function printImage() {\n window.print();\n window.close();\n }\n </script>\n </head>\n <body onload='onloadImage()'>\n <img src=\"${this.attachmentViewer.attachment.defaultSource}\" alt=\"\"/>\n </body>\n </html>`);\n printWindow.document.close();\n }",
"function print_custom() {\n if (getNama_custom()) {\n nama = getNama_custom();\n //bersihkan canvas sebelum print\n canvas_custom.discardActiveObject(canvas_custom.getActiveObject());\n canvas_custom.requestRenderAll();\n //timeout menuggu canvas dibersihkan\n setTimeout(function () {\n //printing\n $(\"#c-custom\")\n .get(0)\n .toBlob(function (blob) {\n saveAs(blob, nama);\n },'image/jpeg', 0.99 ); //{JPEG at 99% quality}. Untuk mengganti ekstensi file tinggal ganti aja jpeg ke png atau ke yang lainnya\n }, 1000);\n }\n}",
"function page_print() {\n\twoas._customized_popup(current, woas.getHTMLDiv(d$(\"woas_wiki_area\")),\n\t\t\t'function go_to(page) { alert(\"'+woas.js_encode(woas.i18n.PRINT_MODE_WARN)+'\");}');\n}",
"function printBarCodeA4Sheet(obj) {\r\n\r\n var DocumentContainer = document.getElementById(obj);\r\n var html = '<html><head><title>Online Munim - Print Page www.OnlineMunim.com www.omunim.com</title>' +\r\n '<link href=\"css/index.css\" rel=\"stylesheet\" type=\"text/css\" />' +\r\n '<link href=\"css/ogcss.css\" rel=\"stylesheet\" type=\"text/css\" />' +\r\n '<link href=\"css/orcss.css\" rel=\"stylesheet\" type=\"text/css\" />' +\r\n '<script type=\"text/javascript\" src=\"scripts/emNavigation.js\"></script>' +\r\n '<script type=\"text/javascript\" src=\"scripts/ogNavFunctions.js\"></script>' +\r\n '</head><body>' +\r\n DocumentContainer.innerHTML +\r\n '<br />' +\r\n '<a style=\"cursor: pointer;\" onClick=\"window.print();\" class=\"noPrint\"><img src=\"images/printer32.png\" alt=\"Print\" title=\"Print\" width=\"32px\" height=\"32px\" /></a>' +\r\n '<br />' +\r\n '<br />' +\r\n '</body></html>';\r\n var WindowObject = window.open(\"\", \"PrintWindow\", \"width=1000,height=1000,top=120,left=120,toolbars=no,scrollbars=yes,status=no,resizable=yes\");\r\n WindowObject.document.open();\r\n WindowObject.document.writeln(html);\r\n WindowObject.document.close();\r\n WindowObject.focus();\r\n}",
"function MostrarDialogoImprimir() {\n window.print();\n}",
"function saveAs() {\n var dataURL = renderedCanvas();\n\n// var $diagram = {c:canvas.save(), s:STACK, m:CONNECTOR_MANAGER};\n var $diagram = {c: canvasProps, s: STACK, m: CONNECTOR_MANAGER, p: CONTAINER_MANAGER, v: DIAGRAMO.fileVersion};\n var $serializedDiagram = JSON.stringify($diagram);\n// $serializedDiagram = JSON.stringify($diagram, Util.operaReplacer);\n var svgDiagram = toSVG();\n\n //save the URLs of figures as a CSV\n var lMap = linkMap();\n\n //alert($serializedDiagram);\n\n //see: http://api.jquery.com/jQuery.post/\n $.post(\"./common/controller.php\", {action: 'saveAs', diagram: $serializedDiagram, png: dataURL, linkMap: lMap, svg: svgDiagram},\n function(data) {\n if (data == 'noaccount') {\n Log.info('You must have an account to use that feature');\n //window.location = '../register.php';\n }\n else if (data == 'step1Ok') {\n Log.info('Save as...');\n window.location = './saveDiagram.php';\n }\n }\n );\n}",
"function print() {\n if (getNama()) {\n nama = getNama();\n //bersihkan canvas sebelum print\n canvas.discardActiveObject(canvas.getActiveObject());\n canvas.requestRenderAll();\n //timeout menuggu canvas dibersihkan\n setTimeout(function () {\n //printing\n $(\"#c\")\n .get(0)\n .toBlob(function (blob) {\n saveAs(blob, nama);\n }, 'image/png', 0.99 ); //{PNG at 99% quality}, yang berarti 99%}Untuk mengganti ekstensi file tinggal ganti aja jpeg ke png atau ke yang lainnya\n }, 1000);\n }\n}",
"function print_() {\n\tgetRef();\n\tif( action_ == 0 ) {\n\t\talert( MSG_NOTPRINT_ );\n\t\treturn;\t\n\t}\n\turl = document.location.href+\"&print=1\";\n\tvar atrib = \"toolbar=no,location=no,directories=no,status=no,\" +\n\t\t\t\t\"menubar=no,scrollbars=no,resizable=no\";\n\twindow.open( url, \"print\", atrib );\n\n}",
"function print(id,name) { \t\r\n\tvar value=parent.document.getElementById(id).src;\r\n\t//var ObjectPrint=window.open();\r\n\tif(value != '' ){\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t \t\t\t \r\n\t\twindow.frames[name].window.focus();\r\n\t\twindow.frames[name].window.print();\r\n\t}\r\n}",
"function save() {\n\n //alert(\"save triggered! diagramId = \" + diagramId );\n Log.info('Save pressed');\n\n if (state == STATE_TEXT_EDITING) {\n currentTextEditor.destroy();\n currentTextEditor = null;\n state = STATE_NONE;\n }\n\n var dataURL = null;\n try {\n dataURL = renderedCanvas();\n }\n catch (e) {\n if (e.name === 'SecurityError' && e.code === 18) {\n /*This is usually happening as we load an image from another host than the one Diagramo is hosted*/\n alert(\"A figure contains an image loaded from another host. \\\n \\n\\nHint: \\\n \\nPlease make sure that the browser's URL (current location) is the same as the one saved in the DB.\");\n }\n }\n\n// Log.info(dataURL);\n// return false;\n if (dataURL == null) {\n Log.info('save(). Could not save. dataURL is null');\n alert(\"Could not save. \\\n \\n\\nHint: \\\n \\nCanvas's toDataURL() did not functioned properly \");\n return;\n }\n\n var diagram = {c: canvasProps, s: STACK, m: CONNECTOR_MANAGER, p: CONTAINER_MANAGER, v: DIAGRAMO.fileVersion};\n //Log.info('stringify ...');\n// var serializedDiagram = JSON.stringify(diagram, Util.operaReplacer);\n var serializedDiagram = JSON.stringify(diagram);\n// Log.error(\"Using Util.operaReplacer() somehow break the serialization. o[1,2] \\n\\\n// is transformed into o.['1','2']... so the serialization is broken\");\n// var serializedDiagram = JSON.stringify(diagram);\n //Log.info('JSON stringify : ' + serializedDiagram);\n\n var svgDiagram = toSVG();\n\n// alert(serializedDiagram);\n// alert(svgDiagram);\n //Log.info('SVG : ' + svgDiagram);\n\n //save the URLs of figures as a CSV\n var lMap = linkMap();\n\n //see: http://api.jquery.com/jQuery.post/\n $.post(\"./common/controller.php\",\n {action: 'save', diagram: serializedDiagram, png: dataURL, linkMap: lMap, svg: svgDiagram, diagramId: currentDiagramId},\n function(data) {\n if (data === 'firstSave') {\n Log.info('firstSave!');\n window.location = './saveDiagram.php';\n }\n else if (data === 'saved') {\n //Log.info('saved!');\n alert('saved!');\n }\n else {\n alert('Unknown: ' + data);\n }\n }\n );\n\n\n}",
"function printWithCanvas(){\n document.querySelector(\".button_container\").classList.add(\"hide\");\n html2canvas(document.querySelector(\"body\")).then(canvas => {\n printJS({printable: canvas.toDataURL(), type: 'image'});\n document.querySelector(\".button_container\").classList.remove(\"hide\");\n });\n}",
"function downloadPNG(){\r\n\tcrackPoint.remove();\r\n\tpaper.view.update();\r\n var canvas = document.getElementById(\"paperCanvas\");\r\n var downloadLink = document.createElement(\"a\");\r\n downloadLink.href = canvas.toDataURL(\"image/png;base64\");\r\n downloadLink.download = simText+'.png';\r\n document.body.appendChild(downloadLink);\r\n downloadLink.click();\r\n document.body.removeChild(downloadLink);\r\n\tcrackPoint.insertAbove(concreteObjects[concreteObjects.length-1]);\r\n}",
"function PrintSeccion() {\n document.getElementsByClassName(\"Print-Seccion\")[0].id = \"Print-chart-seccion\"\n if ($(\"#WebChart\").is(\":visible\")) {\n var chart = document.getElementById(\"WebChart\").getElementsByTagName(\"img\")[0].cloneNode(true)\n } else {\n var chart = document.getElementById(\"WebChart1\").getElementsByTagName(\"img\")[0].cloneNode(true)\n }\n var center = document.createElement(\"center\")\n center.setAttribute(\"id\", \"centerDiv\")\n center.appendChild(chart)\n document.getElementsByClassName(\"Print-Seccion\")[0].appendChild(center)\n chart.style.zIndex = \"10000\"\n $(\"#contenedor-print\").hide()\n $(\"#cssmenu\").hide()\n $(\"header\").hide()\n window.print()\n $(\"#centerDiv\").remove()\n document.getElementsByClassName(\"Print-Seccion\")[0].removeAttribute(\"id\")\n $(\"#contenedor-print\").show()\n $(\"#cssmenu\").show()\n $(\"header\").show()\n}",
"function saveAndPreview(){ \n\t\tvar view = tabsFrame.newView;\n\t\t//if (pattern.match(/highlight-thematic/gi) && prefix != 'drill' && view.tableGroups.tables[0].table_name != 'zone'){\n\t\tif (pattern.match(/highlight-thematic/gi)){\n\t\t\tvar drill2 = $('drill2Std').innerHTML;\n\t\t\tvar data = $('dataStd').innerHTML;\n\t\t\tvar requiredMsg = getMessage('required');\n\t\t\tif((drill2 == requiredMsg || data == requiredMsg) && view.tableGroups[0].tables[0].table_name != 'zone'){\n\t\t\t\talert(getMessage('noStandards'));\n\t\t\t} \n\t\t}\n\t\t\t\t\n if ((pattern.match(/paginated-parent/gi) && validateParameterRestrictions(view) == false) || !removeVirtualFields(view)){\n } else if(hasMeasuresInSummarizeBySortOrder() == false){\n \talert(getMessage('noStatistics')); \n } else {\n \ttabsFrame.selectTab('page5');\n \t}\n}",
"function printShow() {\n\t$('.view-print').on('click', function (e) {\n\t\te.preventDefault();\n\t\twindow.print();\n\t})\n}",
"function printShow() {\n\t$('.view-print').on('click', function (e) {\n\t\te.preventDefault();\n\t\twindow.print();\n\t})\n}",
"function print_multi() {\n if (getNama_multi()) {\n nama = getNama_multi();\n //bersihkan canvas sebelum print\n canvas_multi.discardActiveObject(canvas_multi.getActiveObject());\n canvas_multi.requestRenderAll();\n //timeout menuggu canvas dibersihkan\n setTimeout(function () {\n //printing\n $(\"#c-multi\")\n .get(0)\n .toBlob(function (blob) {\n saveAs(blob, nama);\n },'image/png', 0.99 ); //{PNG at 99% quality}. Untuk mengganti ekstensi file tinggal ganti aja jpeg ke png atau ke yang lainnya\n }, 1000);\n }\n}",
"function triggerPrintDialog() {\n window.print();\n }",
"handlePrint() {\n window.print();\n }",
"function printSpecial() {\n if (document.getElementById != null) {\n\n var html = '<HTML>\\n<HEAD>\\n <link rel=\"stylesheet\" href=\"<%=SiteDesign.CssFolder %>print.css\" type=\"text/css\" />';\n\n html += '\\n</HE>\\n<BODY >\\n';\n\n var printReadyElem = document.getElementById(\"printReady\");\n\n if (printReadyElem != null) {\n\n\n\n html += \"<table class='printholder' border='0' cellpadding='0' cellspacing='0' align=center>\"\n html += \"<tr><td class='printheader'></td></tr>\"\n html += \"<tr><td class='printbody'>\"\n\t html += printReadyElem.innerHTML;\n\t html += \"</td></tr>\"\n\t html += \"<tr><td class='printfooter'></td></tr>\"\n\t html += \"</table>\"\n\n\n\t}\n\telse {\n\t alert(\"Could not find the printReady function\");\n\t return;\n\t}\n\n\thtml += '\\n</BO>\\n</HT>';\n\n\tvar printWin = window.open(\"\", \"printSpecial\");\n\tprintWin.document.open();\n\tprintWin.document.write(html);\n\tprintWin.document.close();\n\tif (gAutoPrint)\n\t printWin.print();\n}\nelse {\n alert(\"The print ready feature is only available if you are using an browser. Please update your browswer.\");\n}\n}",
"function printSchedule() {\n var win=window.open();\n win.document.write(\"<head><title>My Class Schedule</title>\");\n win.document.write(\"<style> img { border: 2.5px solid gray; } h1 { font-family: 'Arial'; }</style></head>\");\n win.document.write(\"<body><h1 style='text-align: center; width: 1080;'>\"+_schedule+\"</h1>\");\n win.document.write(\"<img src='\"+_canvas.toDataURL()+\"'></body>\");\n win.print();\n win.close();\n }",
"function quickprintLogic()\n{\n // If the Print Remote button exists, remove it and adjust the Save As dialog to say Quick Print.\n if ($(\"#reportPrint\").length)\n {\n $(\"#reportPrint\").remove();\n $(\"#reportSaveAs\").text(\"Quickprint\");\n }\n\n // Create new functionality for the big Download button.\n if ($(\"#fileDownloadBtn\").length)\n {\n // Exists solely to communicate with the Autoregform.js script.\n // Intended to prevent this script from executing if the regform data\n // was sent over from Student Planner.\n var regformDataAvailable = $(\"#report-browser-pre-text\").attr(\"regform\");\n if (typeof regformDataAvailable === \"undefined\")\n {\n var url = $(\"#fileDownloadBtn\").attr(\"href\");\n\n // Only make a new button if we're in the 'Save As' dialog.\n if (!hasFileExt(url))\n {\n var adjustedBtn = $cloneBtn($(\"#fileDownloadBtn\"))\n .attr(\"id\", \"quickprint\")\n .attr(\"type\", \"button\");\n $(adjustedBtn).text(\"Quickprint\");\n $(\"#fileDownloadBtn\").replaceWith(adjustedBtn);\n adjustedBtn.on(\"click\", function () {\n quickPrint(url);\n });\n\n // PRINT IMMEDIATELY!!! The button solely exists as a failsafe.\n quickPrint(url);\n }\n }\n }\n\n // Remove the data window(s) when we're done.\n if ($(\"#btn_close_report_browser\").length)\n {\n $(\"#btn_close_report_browser\").on(\"click\", function () {\n cleanUp();\n });\n }\n}",
"function printCurrentPage() {\n window.print();\n}",
"function print(){\n window.print();\n }",
"function imprimir(){\n window.print();\n}",
"function save(e) {\n render();\n let url = canvas.toDataURL();\n let image = new Image();\n image.src = url;\n let w = window.open();\n let a = document.createElement(\"a\");\n a.href = url;\n a.download = \"graph\";\n a.textContent = \"Download\";\n a.id = \"download\";\n setTimeout(function(){\n w.document.write(\"<title>Saved Image</title>\")\n w.document.write(image.outerHTML);\n w.document.write(a.outerHTML);\n w.document.write(`\n <style>\n body {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n }\n img {\n margin: 1em;\n }\n #download {\n border-radius: .25em;\n padding: .5em;\n color: black; /*rgb(80, 235, 126)*/\n font-family: 'Segoe UI', Tahoma, Geneva, Verdana, Noto Sans, sans-serif;\n background: white;\n box-shadow: 2px 2px 5px 0 #0004;\n height: min-content;\n width: min-content;\n display: block;\n text-decoration: none;\n }\n #download:hover {\n box-shadow: 1px 1px 3px 0 #0004;\n }\n </style>\n `);\n }, 0);\n }",
"function print_current_page()\n{\nwindow.print();\n}",
"function save() {\n // document.getElementById(\"canvasimg\").style.border = \"2px solid\";\n // const savedImage = canvas.toDataURL();\n // document.getElementById(\"canvasimg\").src = savedImage;\n\n // document.getElementById(\"canvasimg\").style.display = \"inline\"; \n //--- this is prob the line of code that saves it next to the current\n }",
"handlePrint() {\n const { cms } = this.props;\n const label = cms && cms.commonLabels && cms.commonLabels.printLabel ? cms.commonLabels.printLabel : 'print';\n\n this.pushAnalytics(label);\n window.print();\n }"
] |
[
"0.63316315",
"0.62739676",
"0.6170226",
"0.60262626",
"0.60187477",
"0.59463614",
"0.59202445",
"0.5874236",
"0.5873068",
"0.5872673",
"0.58568233",
"0.58197814",
"0.5805974",
"0.57907474",
"0.5730226",
"0.5699699",
"0.5699699",
"0.5694505",
"0.5691409",
"0.5687984",
"0.56847167",
"0.56817514",
"0.56707346",
"0.5670603",
"0.5644998",
"0.5612441",
"0.56012845",
"0.5588926",
"0.5587953",
"0.5574147"
] |
0.7598626
|
0
|
Exports current canvas as SVG
|
function exportCanvas() {
//export canvas as SVG
var v = '<svg width="300" height="200" xmlns="http://www.w3.org/2000/svg" version="1.1">\
<rect x="0" y="0" height="200" width="300" style="stroke:#000000; fill: #FFFFFF"/>\
<path d="M100,100 C200,200 100,50 300,100" style="stroke:#FFAAFF;fill:none;stroke-width:3;" />\
<rect x="50" y="50" height="50" width="50"\
style="stroke:#ff0000; fill: #ccccdf" />\
</svg>';
//get svg
var canvas = getCanvas();
var v2 = '<svg width="' + canvas.width + '" height="' + canvas.height + '" xmlns="http://www.w3.org/2000/svg" version="1.1">';
v2 += STACK.toSVG();
v2 += CONNECTOR_MANAGER.toSVG();
v2 += '</svg>';
alert(v2);
//save SVG into session
//see: http://api.jquery.com/jQuery.post/
$.post("../common/controller.php", {action: 'saveSvg', svg: escape(v2)},
function(data) {
if (data == 'svg_ok') {
//alert('SVG was save into session');
}
else if (data == 'svg_failed') {
Log.info('SVG was NOT save into session');
}
}
);
//open a new window that will display the SVG
window.open('./svg.php', 'SVG', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"_saveContextSVG(){\n this.getGraphicsContext().saveSVG();\n }",
"function saveSVG(){\n\t\t\tvar blob = new Blob([canvas.toSVG()], {type: \"text/plain;charset=utf-8\"});\n\t\t\tsaveAs(blob, \"download.svg\");\n\n\t\t}",
"function canvasToSVG() {\n if (chart.boost &&\n chart.boost.wgl &&\n isChartSeriesBoosting(chart)) {\n chart.boost.wgl.render(chart);\n }\n }",
"function saveCanvas() {\n // Generate SVG.\n var save_button = $('#save');\n var save_svg = $('#canvas').innerHTML.replace('<svg', '<svg xmlns=\"http://www.w3.org/2000/svg\"');\n var data_uri = 'data:image/svg+xml;base64,' + window.btoa(save_svg);\n var filename = 'bustashape-' + window.location.hash.replace('#', '') + '-' + Date.now() + '.svg';\n\n // Prep link for new download.\n save_button.setAttribute('href', data_uri);\n save_button.setAttribute('download', filename);\n}",
"function exportAsImage(){\n \n // variable for image name\n var chartName, svg ;\n \n // Getting svg name from this.id, replacing this.id by save\n // save prefix is for button and replacing it with sample to\n // get the svg chart div name \n\n svg = document.querySelector( '#dendogram svg' );\n \n //\n var svgData = new XMLSerializer().serializeToString( svg );\n\n var canvas = document.createElement( \"canvas\" );\n var ctx = canvas.getContext( \"2d\" );\n \n canvas.height = outerRadius*2;\n canvas.width = outerRadius*2;\n \n var dataUri = '';\n dataUri = 'data:image/svg+xml;base64,' + btoa(svgData);\n \n var img = document.createElement( \"img\" );\n \n img.onload = function() {\n ctx.drawImage( img, 0, 0 );\n \n // Initiate a download of the image\n var a = document.createElement(\"a\");\n \n a.download = \"circularDendogram\" + \".png\";\n a.href = canvas.toDataURL(\"image/png\");\n document.querySelector(\"body\").appendChild(a);\n a.click();\n document.querySelector(\"body\").removeChild(a);\n \n // Image preview in case of \"save image modal\"\n \n /*var imgPreview = document.createElement(\"div\");\n imgPreview.appendChild(img);\n document.querySelector(\"body\").appendChild(imgPreview);\n */\n };\n \n img.src = dataUri;\n}",
"function exportPNG(filename) {\n\n\t$(\".connection\").css(\"fill\", \"none\");\n\t$(\".link-tools\").css(\"display\", \"none\");\n\t$(\".link-tools\").css(\"fill\", \"none\");\n\t\n\tvar svgDoc = paper.svg;\n\tvar serializer = new XMLSerializer();\n\tvar svgString = serializer.serializeToString(svgDoc);\n\n\tvar canvas = document.getElementById(\"canvas\");\n\tvar context = canvas.getContext('2d');\n\t\n\tcanvg(canvas, svgString);\n\t\n\tdestinationCanvas = document.createElement(\"canvas\");\n\tdestinationCanvas.width = canvas.width;\n\tdestinationCanvas.height = canvas.height;\n\n\tdestCtx = destinationCanvas.getContext('2d');\n\t\n\tdestCtx.fillStyle = \"#FFFFFF\";\n\tdestCtx.fillRect(0, 0, canvas.width, canvas.height);\n\t\n\tdestCtx.drawImage(canvas, 0, 0);\n\t\n\tvar img = destinationCanvas.toDataURL(\"image/png\");\n\t\n\tvar downloadLink = document.createElement(\"a\");\n\tdownloadLink.href = img;\n\tdownloadLink.download = filename + \".png\";\n\tdocument.body.appendChild(downloadLink);\n\tdownloadLink.click();\n\tdocument.body.removeChild(downloadLink);\n}",
"function toSVG() {\n return '';\n\n /* Note: Support for SVG is suspended\n *\n var canvas = getCanvas();\n //@see http://www.w3schools.com/svg/svg_example.asp\n var v2 = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>';\n v2 += \"\\n\" + '<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"'\n + canvas.width +'\" height=\"' + canvas.height\n + '\" viewBox=\"0 0 ' + canvas.width + ' ' + canvas.height + '\" version=\"1.1\">';\n INDENTATION++;\n v2 += STACK.toSVG();\n v2 += CONNECTOR_MANAGER.toSVG();\n INDENTATION--;\n v2 += \"\\n\" + '</svg>';\n \n return v2;\n */\n}",
"function convertSVGtoPNG() {\n var canvas = document.getElementById('the-canvas');\n var context = canvas.getContext('2d');\n canvas.width = triOptions.width();\n canvas.height = triOptions.height();\n\n var image = new Image();\n\n $(image).on(\"load\", function() {\n context.drawImage(image, 0, 0);\n $(\"#download-btn\").attr(\"href\", canvas.toDataURL(\"image/png\"));\n });\n\n image.src = currentPattern.dataUri;\n var imagePath = canvas.toDataURL(\"image/png\");\n \n \n\n }",
"saveImage() {\n console.log(this.stripStyles(this.state.svgString));\n canvg('canvas', this.stripStyles(this.state.svgString));\n document.getElementById('canvas').toBlob((blob) => {\n saveAs(blob, `tri2-${new Date().toISOString()}.png`);\n });\n }",
"function exportImage(htmlId) {\n var svg = document.getElementById(htmlId);\n var canvas = document.getElementById('saveCanvas');\n canvas.height = svg.clientHeight;\n canvas.width = svg.clientWidth;\n var ctx = canvas.getContext('2d');\n var data = (new XMLSerializer()).serializeToString(svg);\n var DOMURL = window.URL || window.webkitURL || window;\n\n var img = new Image();\n var svgBlob = new Blob([data], { type: 'image/svg+xml;charset=utf-8' });\n var url = DOMURL.createObjectURL(svgBlob);\n img.src = url;\n\n img.onload = function () {\n ctx.drawImage(img, 0, 0);\n var imgURI = canvas\n .toDataURL('image/png')\n .replace('image/png', 'image/octet-stream');\n\n triggerDownload(imgURI);\n };\n\n}",
"function savePNG() {\n var doctype = '<?xml version=\"1.0\" standalone=\"no\"?>'\n + '<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">';\n var serializer = new XMLSerializer();\n d3.select(\".graphinfo\").style(\"visibility\", \"hidden\")\n var source = serializer.serializeToString(d3.select(\"svg\").node());\n d3.select(\".graphinfo\").style(\"visibility\", \"visible\")\n var blob = new Blob([doctype + source], { type: \"image/svg+xml\" });\n var url = window.URL.createObjectURL(blob);\n\n var canvas = document.querySelector(\"canvas\");\n canvas.setAttribute(\"width\", width);\n canvas.setAttribute(\"height\", height);\n var context = canvas.getContext(\"2d\");\n\n var image = new Image;\n image.src = url;\n image.onload = function () {\n context.drawImage(image, 0, 0);\n var a = document.createElement(\"a\");\n a.download = getFilenameWithoutExtension(curFilename) + \".png\";\n a.href = canvas.toDataURL(\"image/png\");\n a.click();\n };\n}",
"exportSvg(svg) {\n return __awaiter(this, void 0, void 0, function* () {\n const svgFilePath = this._uri.fsPath.replace('.json', '');\n const svgFileUri = yield vscode_1.window.showSaveDialog({\n defaultUri: vscode_1.Uri.parse(svgFilePath).with({ scheme: 'file' }),\n filters: { 'SVG': ['svg'] }\n });\n if (svgFileUri) {\n fs.writeFile(svgFileUri.fsPath, svg, (error) => {\n if (error) {\n const errorMessage = `Failed to save file: ${svgFileUri.fsPath}`;\n this._logger.logMessage(logger_1.LogLevel.Error, 'exportSvg():', errorMessage);\n vscode_1.window.showErrorMessage(errorMessage);\n }\n });\n }\n this.webview.postMessage({ command: 'showMessage', message: '' });\n });\n }",
"function saveSVG() {\n var doctype = '<?xml version=\"1.0\" standalone=\"no\"?>'\n + '<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">';\n var serializer = new XMLSerializer();\n d3.select(\".graphinfo\").style(\"visibility\", \"hidden\")\n var source = serializer.serializeToString(d3.select(\"svg\").node());\n d3.select(\".graphinfo\").style(\"visibility\", \"visible\")\n var blob = new Blob([doctype + source], { type: \"image/svg+xml\" });\n saveAs(blob, getFilenameWithoutExtension(curFilename) + \".svg\");\n}",
"function downloadSVG(){\r\n\tcrackPoint.remove();\r\n\tpaper.view.update();\r\n var svg = project.exportSVG({ asString: true, bounds: 'content' });\r\n var svgBlob = new Blob([svg], {type:\"image/svg+xml;charset=utf-8\"});\r\n var svgUrl = URL.createObjectURL(svgBlob);\r\n var downloadLink = document.createElement(\"a\");\r\n downloadLink.href = svgUrl;\r\n downloadLink.download = simText+\".svg\";\r\n document.body.appendChild(downloadLink);\r\n downloadLink.click();\r\n document.body.removeChild(downloadLink);\r\n\tcrackPoint.insertAbove(concreteObjects[concreteObjects.length-1]);\r\n}",
"function SaveAsSVG(document, newname)\r{\r var targetFolder = Folder(MATERIAL_EXPORT_PATH);\r\r if (! targetFolder.exists) {\r // geef een melding en \r throw(\"Onderstaande folder niet gevonden, is de netwerkverbinding gemaakt? \\n\\n\" +\r MATERIAL_EXPORT_PATH);\r }\r\r var exportOptions = new ExportOptionsSVG();\r var exportType = ExportType.SVG;\r\r var targetFile = MakeTempInvisibleFile(targetFolder, newname, \".ai\");\r // alert(targetFile);\r\r exportOptions.embedRasterImages = true;\r exportOptions.compressed = true;\r exportOptions.embedAllFonts = false;\r exportOptions.fontSubsetting = SVGFontSubsetting.GLYPHSUSED;\r exportOptions.cssProperties = SVGCSSPropertyLocation.PRESENTATIONATTRIBUTES;\r exportOptions.optimezForSVGViewer = true;\r\r document.exportFile( targetFile, exportType, exportOptions );\r document.close( SaveOptions.DONOTSAVECHANGES );\r\r var exportedFile = MakeTempInvisibleFile(targetFolder, newname, \".svgz\");\r // alert(exportedFile);\r if (exportedFile.exists) {\r if (! exportedFile.rename(newname+ \".svgz\")) {\r // bij aanwezig zijn oude file, deze proberen te deleten en vervolgens nogmaal renamen:\r var fl = new File(targetFolder + \"/\" + newname + \".svgz\");\r // alert(fl);\r if (fl.remove()) \r exportedFile.rename(newname+ \".svgz\")\r else\r alert(SCRIPT_NAME + \" is niet goed gelukt, oude file is nog aanwezig en niet te overschrijven!\") \r }\r } \r else\r alert(SCRIPT_NAME + \" is niet goed gelukt!\") \r}",
"function svgToCanvas(downloadlinkid){\n\t\t//get svg element.\n\t\tvar svg = document.getElementById(\"svg\");\n\n\t\t//get svg source.\n\t\tvar serializer = new XMLSerializer();\n\t\tvar source = serializer.serializeToString(svg);\n\n\t\t//add name spaces.\n\t\tif(!source.match(/^<svg[^>]+xmlns=\"http\\:\\/\\/www\\.w3\\.org\\/2000\\/svg\"/)){\n\t\t\tsource = source.replace(/^<svg/, '<svg xmlns=\"http://www.w3.org/2000/svg\"');\n\t\t}\n\t\tif(!source.match(/^<svg[^>]+\"http\\:\\/\\/www\\.w3\\.org\\/1999\\/xlink\"/)){\n\t\t\tsource = source.replace(/^<svg/, '<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\"');\n\t\t}\n\n\t\t//add xml declaration\n\t\tsource = '<?xml version=\"1.0\" standalone=\"no\"?>\\n' + source;\n\n\t\t//convert svg source to URI data scheme.\n\t\tvar url = \"data:image/svg+xml;charset=utf-8,\"+encodeURIComponent(source);\n\n\t\t//set url value to a element's href attribute.\n\t\tdocument.getElementById(downloadlinkid).href = url;\n\t\tdocument.getElementById(downloadlinkid).innerHTML=\"Figure ready,Right click me to save!\"\n\t\t//you can download svg file by right click menu\t\n\t}",
"drawSvg() {\n \n\t}",
"function fromCanvasToSvg(sourceCanvas, targetSVG, x, y, width, height) {\n var imageData = sourceCanvas.getContext('2d').getImageData(\n x, y, width, height);\n var newCanvas = document.createElement(\"canvas\");\n var imgDataurl;\n newCanvas.width = width; newCanvas.height = height;\n newCanvas.getContext(\"2d\").putImageData(imageData, 0, 0);\n imgDataurl = newCanvas.toDataURL(\"image/png\");\n targetSVG.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", imgDataurl);\n }",
"function downloadPNG2x() {\n document.getElementById('svg').removeAttribute('style');\n panZoomInstance.moveTo(0, 0);\n panZoomInstance.zoomAbs(0, 0, 1);\n saveSvgAsPng(document.getElementById(\"svg\"), \"GeometricIllustration.png\", {scale: 2});\n}",
"function exportImage(type) {\n\t\t\t\tvar canvas = document.createElement(\"canvas\");\n\t\t\t\tvar ctx = canvas.getContext('2d');\n\t\n\t\t\t\t// TODO: if (options.keepOutsideViewport), do some translation magic?\n\t\n\t\t\t\tvar svg_img = new Image();\n\t\t\t\tvar svg_xml = _svg.outerHTML;\n\t\t\t\tsvg_img.src = base64dataURLencode(svg_xml);\n\t\n\t\t\t\tsvg_img.onload = function () {\n\t\t\t\t\tdebug(\"exported image size: \" + [svg_img.width, svg_img.height]);\n\t\t\t\t\tcanvas.width = svg_img.width;\n\t\t\t\t\tcanvas.height = svg_img.height;\n\t\t\t\t\tctx.drawImage(svg_img, 0, 0);\n\t\n\t\t\t\t\t// SECURITY_ERR WILL HAPPEN NOW\n\t\t\t\t\tvar image_dataurl = canvas.toDataURL(type);\n\t\t\t\t\tdebug(type + \" length: \" + image_dataurl.length);\n\t\n\t\t\t\t\tif (options.callback) options.callback(image_dataurl);else debug(\"WARNING: no callback set, so nothing happens.\");\n\t\t\t\t};\n\t\n\t\t\t\tsvg_img.onerror = function () {\n\t\t\t\t\tdebug(\"Can't export! Maybe your browser doesn't support \" + \"SVG in img element or SVG input for Canvas drawImage?\\n\" + \"http://en.wikipedia.org/wiki/SVG#Native_support\");\n\t\t\t\t};\n\t\n\t\t\t\t// NOTE: will not return anything\n\t\t\t}",
"function downloadPNG4x() {\n document.getElementById('svg').removeAttribute('style');\n panZoomInstance.moveTo(0, 0);\n panZoomInstance.zoomAbs(0, 0, 1);\n saveSvgAsPng(document.getElementById(\"svg\"), \"GeometricIllustration.png\", {scale: 4});\n}",
"toSVG() {\n if (this.geometryObject &&\n (\n this.geometryObject.geometryIsVisible === false ||\n this.geometryObject.geometryIsHidden === true ||\n this.geometryObject.geometryIsConstaintDraw === true\n )\n ) {\n return '';\n }\n\n let path = this.getSVGPath();\n\n let attributes = {\n d: path,\n stroke: this.strokeColor,\n fill: '#000',\n 'fill-opacity': 0,\n 'stroke-width': this.strokeWidth,\n 'stroke-opacity': 1, // toujours à 1 ?\n };\n\n let path_tag = '<path';\n for (let [key, value] of Object.entries(attributes)) {\n path_tag += ' ' + key + '=\"' + value + '\"';\n }\n path_tag += '/>\\n';\n\n let pointToDraw = [];\n if (app.settings.areShapesPointed && this.name != 'silhouette') {\n if (this.isSegment())\n pointToDraw.push(this.segments[0].vertexes[0]);\n if (!this.isCircle())\n this.segments.forEach(\n (seg) => (pointToDraw.push(seg.vertexes[1])),\n );\n }\n\n this.segments.forEach((seg) => {\n //Points sur les segments\n seg.divisionPoints.forEach((pt) => {\n pointToDraw.push(pt);\n });\n });\n if (this.isCenterShown) pointToDraw.push(this.center);\n\n let point_tags = pointToDraw.filter(pt => {\n pt.visible &&\n pt.geometryIsVisible &&\n !pt.geometryIsHidden\n }).map(pt => pt.svg).join('\\n');\n\n let comment =\n '<!-- ' + this.name.replace('é', 'e').replace('è', 'e') + ' -->\\n';\n\n return comment + path_tag + point_tags + '\\n';\n }",
"function downloadSVG() {\n var svg_root = document.getElementById('svg').outerHTML;\n var svgBlob = new Blob([svg_root], {type:\"image/svg+xml;charset=utf-8\"});\n var svgUrl = URL.createObjectURL(svgBlob);\n var downloadLink = document.createElement(\"a\");\n downloadLink.href = svgUrl;\n downloadLink.download = \"GeometricIllustration.svg\";\n document.body.appendChild(downloadLink);\n downloadLink.click();\n document.body.removeChild(downloadLink);\n}",
"function saveAsPNG() {\n // draw to canvas...\n drawingCanvas.toBlob(function(blob) {\n saveAs(blob, \"canvas.png\");\n });\n }",
"function exportImage() {\n console.log(\"clicked\");\n canvas = document.getElementsByTagName(\"canvas\");\n // document.write('<img src=\"'+canvas[0].toDataURL(\"image/png\")+'\"/>');\n var canvasURL = canvas[0].toDataURL(\"image/png\");\n console.log(\"image copied\")\n var img = document.getElementById(\"image1\").src = canvasURL;\n console.log(img);\n}",
"function downloadPNG() {\n document.getElementById('svg').removeAttribute('style');\n panZoomInstance.moveTo(0, 0);\n panZoomInstance.zoomAbs(0, 0, 1);\n saveSvgAsPng(document.getElementById(\"svg\"), \"GeometricIllustration.png\");\n}",
"function GetSGV() {\r\n var svg = project.exportSVG({ asString: true });\r\n console.log(svg);\r\n}",
"function downloadSVG(sn) {\n // Generate piece.\n var piece = computePiece(sn, {\n cropped: $(\"#cropped\").prop('selected'), \n trapezoidal:$(\"#trapezoidal\").prop('selected')\n });\n \n // Output to SVG.\n var svg = drawSVG(piece, $(\"#tmpSvg svg\")[0]);\n svg.attr('viewBox', \n piece.bbox.x \n + \" \" + piece.bbox.y \n + \" \" \n + (piece.bbox.x2-piece.bbox.x) \n + \" \" \n + (piece.bbox.y2-piece.bbox.y)\n );\n svg.attr({fill: 'none', stroke: 'black', strokeWidth: 0.1});\n\n blob = new Blob([svg.outerSVG()], {type: \"image/svg+xml\"});\n saveAs(blob, sn + \".svg\");\n \n}",
"function downloadSVG(){\n window.URL = window.webkitURL || window.URL;\n var contentType = 'image/svg+xml';\n var svgCode = $('#exportcode').val();\n var svgFile = new Blob([svgCode], {type: contentType});\n\n $('#aDownloadSvg').prop('download','pattern-bar.svg');\n $('#aDownloadSvg').prop('href',window.URL.createObjectURL(svgFile));\n // $('#aDownloadSvg').prop('textContent','<i class=\"fa fa-file-code-o\"></i> Download as SVG');\n}",
"function Export() {\n\n var element = document.createElement('a');\n element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(Canvas.toDataURL()));\n element.setAttribute('download', \"img\");\n element.style.display = 'none';\n document.body.appendChild(element);\n element.click();\n document.body.removeChild(element);\n}"
] |
[
"0.7611495",
"0.760116",
"0.7534128",
"0.7454485",
"0.74182296",
"0.72102493",
"0.71317697",
"0.7026638",
"0.69958067",
"0.686196",
"0.68500465",
"0.67527467",
"0.6705932",
"0.669488",
"0.6677252",
"0.6640134",
"0.66087085",
"0.6607238",
"0.65885",
"0.658524",
"0.6525618",
"0.65045756",
"0.6458751",
"0.6452541",
"0.6444493",
"0.6435622",
"0.64227355",
"0.6366613",
"0.6346368",
"0.63244605"
] |
0.77538526
|
0
|
['Elie', 'Tim', 'Matt', 'Colt'] vowelCount
|
function vowelCount(str){
var vowels ="aeuio";
return str.toLowerCase().split('').reduce(function(acc, nVal){
if(vowels.indexOf(nVal) !== -1){
if(acc[nVal]){
acc[nVal]++;
} else {
acc[nVal] = 1;
}
}
return acc;
}, {});
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function vowelCount(str) {\n\tvar vowels = 'aeiou';\n\treturn str.toLowerCase().split(\"\").reduce(function(acc, next){\n\t\tif(vowels.indexOf(next) !== -1) {\n\t\t\tif(acc[next]) {\n\t\t\t\tacc[next]++;\n\t\t\t} else {\n\t\t\t\tacc[next] = 1;\n\t\t\t}\n\t\t}\n\t\treturn acc;\n\t}, {});\n}",
"function countvowels(text){\n var character = text.toLowerCase().split('')\n var vowels = 'aeiou';\n \n var countvowels = character.reduce(function(acc,current){\n return vowels.indexOf(current) > -1 ? acc + 1 : acc;\n },0);\n \n return countvowels;\n}",
"function getCount(str) {\n var vowelsCount = 0;\n\n // enter your majic here\n str.split('').map(function(x) {\n if(x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') {\n vowelsCount++;\n }\n });\n\n return vowelsCount;\n }",
"function vowelCount(str) {\n const vowels = 'aeiou';\n return str.split('').reduce(function(accumulator, next) {\n let lowerCased = next.toLowerCase();\n if(vowels.indexOf(lowerCased) !== -1) {\n if(accumulator[lowerCased]) {\n accumulator[lowerCased]++;\n } else {\n accumulator[lowerCased] = 1;\n }\n }\n return accumulator;\n }, {})\n}",
"function vowelCount(str){\n const vowels = \"aeiou\";\n return str.split('').reduce(function(accm,next){\n let lowerCased = next.toLowerCase()\n if(vowels.indexOf(lowerCased) !== -1){\n if(accm[lowerCased]){\n accm[lowerCased]++;\n } else {\n accm[lowerCased] = 1;\n }\n }\n return accm;\n }, {});\n}",
"function VowelCount(str) {\n var newStr = str.toLowerCase().split('');\n var vowelCounter = 0;\n for(var i = 0; i<newStr.length; i++) {\n if(newStr[i] === 'a' || newStr[i] === 'e' || newStr[i] === 'i' || newStr[i] === 'o' || newStr[i] === 'u')\n {vowelCounter += 1;}\n }\n return vowelCounter;\n}",
"function vowelCount(word) {\n let letters = word.split(\"\");\n let vowels = letters.filter(\n (letter) =>\n letter === \"a\" ||\n letter === \"e\" ||\n letter === \"i\" ||\n letter === \"o\" ||\n letter === \"u\"\n );\n return vowels.length;\n}",
"function vowel_count(str)\n{\n //code goes here\n}",
"function vowelCount(str) {\n let vowels = ['a', 'e', 'i', 'o', 'u'];\n let lowerCaseSplitStr = str.toLowerCase().split('');\n let count = 0;\n lowerCaseSplitStr.forEach((letter) => {\n if (vowels.includes(letter) === true) {\n count++;\n }\n });\n return count;\n}",
"function getCount(str) {\n var vowelsCount = 0;\n str.split(\"\").forEach(function(x){\n if(x == \"a\" | x == \"e\" | x == \"i\" | x == \"o\" | x == \"u\"){\n vowelsCount += 1;\n }\n }); \n return vowelsCount;\n}",
"function vowelCount( str ) {\n\tvar strArr = str.split('');\n\tvar counter = 0;\n\tfor ( var i = 0; i < strArr.length; i++ ) {\n\t\tif (\n\t\t\tstrArr[i] === \"a\" \n\t\t\t|| strArr[i] === \"e\" \n\t\t\t|| strArr[i] === \"i\" \n\t\t\t|| strArr[i] === \"o\" \n\t\t\t|| strArr[i] === \"u\" \n\t\t) {\n\t\t\tcounter++;\n\t\t}\n\t}\n\n\treturn counter;\n}",
"function countVowels(word) {\n var vowelAmount = 0;\n var i = 0;\n for (i = 0; i < word.length; i++){\n if ( (word[i] === 'a') || (word[i] === 'e') || (word[i] === 'i') || (word[i] === 'o') || (word[i] === 'u') || (word[i] === 'y') ){\n vowelAmount++;\n }\n }\n return vowelAmount;\n}",
"function vowelCounter(str) {\n var count = 0;\n for (var i = 0; i < str.length; i++) {\n var l = str.charAt(i).toLowerCase();\n if (l === 'a' || l === 'e' || l === 'i' || l === 'o' || l === 'u') {\n count++;\n }\n }\n return count;\n}",
"function vowelCount(str) {\n\tvar splitArr = str.toLowerCase().split(\"\");\n\tvar vowels = 'aeiou';\n\tvar obj = {};\n\n\tsplitArr.forEach(function(letter){\n\t\tif(vowels.indexOf(letter) !== -1) {\n\t\t\tif(obj[letter]) {\n\t\t\t\tobj[letter]++;\n\t\t\t} else {\n\t\t\t\tobj[letter] = 1;\n\t\t\t}\n\t\t}\n\t});\n\treturn obj;\n}",
"function vowelsCounter(str){\r\n \r\n var v = [\"a\",\"e\",\"i\",\"o\",\"u\"];\r\n var n = 0;\r\n for (c in str){\r\n for (vi in v){\r\n if (v[vi] == str[c]){\r\n n = n + 1;\r\n }\r\n }\r\n }\r\n return n;\r\n}",
"function countVowels(value){\n var vow = 'aeiou';\n var count = 0;\n for(var x = 0; x < value.length; x++){\n if(vow.toLowerCase().indexOf(value[x]) !== -1){// copied from #44\n count++;\n }\n }\n return count;\n}",
"function vowelCounter(string) {\n var vowelCount = 0;\n var input = string.toLowerCase();\n //loop throught string as an array\n for (var i=0; i < input.length; i++) {\n if (input[i] === 'a' || input[i] === 'e' || input[i] === 'i' || input[i] === 'o' || input[i] === 'u' ) {\n vowelCount++\n }\n }\n return vowelCount;\n }",
"function vowelCount(str){\n var result = 0;\n str = str.split(\"\");\n str.forEach(function(letter){\n if(/[aeiou]/i.test(letter)){\n result ++;\n }\n });//end of forEach\n return result;\n}",
"function VowelCount(str) { \n let count = 0;\n for (let i = 0; i < str.length; i++) {\n if (str[i] === 'a' || str[i] === 'e' || str[i] === 'i' || str[i] === 'o' || str[i] === 'u') {\n count++;\n }\n }\n return count;\n}",
"function numVowels (str) {\n let count = 0;\n let vowels = ['a', 'e', 'i', 'o', 'u'];\n\n for (let char of str) {\n for (let vowel of vowels) {\n if (char.toLowerCase() === vowel) count++;\n }\n }\n\n console.log (`The number of vowels in ${str} is = ${count}`);\n}",
"function vowelCount(str1)\n{\n var vowelList = 'aeiouAEIOU';\n var vlcount = 0;\n \n for(var x = 0; x < str1.length ; x++)\n {\n if (vowelList.indexOf(str1[x]) !== -1)\n {\n vlcount += 1;\n }\n \n }\n return vlcount;\n}",
"function countVowels(arr){\n var str = arr.toString();\n var count = 0;\n count = countVowelsInStr(str, count);\n return count;\n }",
"function vowelCount(str) {\n let splitArr = str.split(\"\")\n let obj = {};\n const vowels = 'aeiou';\n\n splitArr.forEach(function(val) {\n let lowerCasedLetter = val.toLowerCase();\n if(vowels.indexOf(lowerCasedLetter) !== -1) {\n if (obj[lowerCasedLetter]) {\n obj[lowerCasedLetter]++;\n } else {\n obj[lowerCasedLetter] = 1;\n }\n }\n })\n\n}",
"function vowelCount(sentence)\n{\n let vowList = 'aeiouAEIOU';\n let vCount = [];\n \n for(let i = 0; i < sentence.length ; i++) {\n if (vowList.indexOf(sentence[i]) !== -1)\n {\n vCount ++;\n }\n }\n let output2 = `${vCount} vowels found`;\n console.log(output2);\n}",
"function vowel_count(str1)\n{\n var vowel_list = 'aeiouAEIOU';\n var vcount = 0;\n \n for(var x = 0; x < str1.length ; x++)\n {\n if (vowel_list.indexOf(str1[x]) !== -1)\n {\n vcount += 1;\n }\n \n }\n return vcount;\n}",
"function vowel_count(str1)\n{\n var vowel_list = 'aeiouAEIOU';\n var vcount = 0;\n \n for(var x = 0; x < str1.length ; x++)\n {\n if (vowel_list.indexOf(str1[x]) !== -1)\n {\n vcount += 1;\n }\n \n }\n return vcount;\n}",
"function vowel_count(str1) {\n var vowel_list = \"aeAE\";\n var vcount = 0;\n\n for (var x = 0; x < str1.length; x++) {\n if (vowel_list.indexOf(str1[x]) !== -1) {\n vcount += 1;\n }\n }\n return vcount;\n}",
"function vowelCount(str) {\n\n // put all vowels from the string into an array\n var vowels = str.match(/[aeiou]/gi);\n\n // if there are no vowels in the string return 0\n // else return the length of the array containing the vowels\n return (vowels === null) ? 0 : vowels.length;\n\n}",
"function vowelCounter(string) {\n return string.match(/[aeiou]/ig).length\n}",
"function getVowelCount(string){\n var count = 0;\n for (var i = 0; i < string.length; i++) {\n var character = string[i];\n if (character === 'a' || character === 'e' || character === 'i' || character === 'o' || character === 'u') {\n count++;\n }\n }\n return count;\n}"
] |
[
"0.81807715",
"0.79066265",
"0.78577167",
"0.7847525",
"0.7834786",
"0.77947104",
"0.77783763",
"0.76659334",
"0.76409614",
"0.7620593",
"0.7597341",
"0.75891644",
"0.7570892",
"0.7554376",
"0.75438464",
"0.75330657",
"0.75097483",
"0.74998695",
"0.749715",
"0.7488472",
"0.748662",
"0.74841815",
"0.7482876",
"0.7479638",
"0.7475234",
"0.7475234",
"0.7474596",
"0.74726266",
"0.746156",
"0.74596775"
] |
0.81547403
|
1
|
Enable async hooks Hooks are enabled by default.
|
enable () {
this.hook.enable()
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"registerHooks() {\n\n S.addHook(this._hookPre.bind(this), {\n action: 'functionRun',\n event: 'pre'\n });\n\n S.addHook(this._hookPost.bind(this), {\n action: 'functionRun',\n event: 'post'\n });\n\n return BbPromise.resolve();\n }",
"async setup() {\n this.hooks = await this.github.genHooks();\n this.is_setup = true;\n }",
"before (asyncId) {\n fs.writeSync(1, \"\\n\\tHook before \"+asyncId+\"\\n\")\n }",
"enableAsyncRequest() {\n this._asyncRequest = true;\n }",
"function addHook (name, fn) {\n throwIfAlreadyStarted('Cannot call \"addHook\" when fastify instance is already started!')\n\n if (name === 'onSend' || name === 'preSerialization' || name === 'onError' || name === 'preParsing') {\n if (fn.constructor.name === 'AsyncFunction' && fn.length === 4) {\n throw new Error('Async function has too many arguments. Async hooks should not use the \\'done\\' argument.')\n }\n } else if (name === 'onReady') {\n if (fn.constructor.name === 'AsyncFunction' && fn.length !== 0) {\n throw new Error('Async function has too many arguments. Async hooks should not use the \\'done\\' argument.')\n }\n } else {\n if (fn.constructor.name === 'AsyncFunction' && fn.length === 3) {\n throw new Error('Async function has too many arguments. Async hooks should not use the \\'done\\' argument.')\n }\n }\n\n if (name === 'onClose') {\n this.onClose(fn)\n } else if (name === 'onReady') {\n this[kHooks].add(name, fn)\n } else if (name === 'onRoute') {\n this[kHooks].validate(name, fn)\n this[kHooks].add(name, fn)\n } else {\n this.after((err, done) => {\n _addHook.call(this, name, fn)\n done(err)\n })\n }\n return this\n\n function _addHook (name, fn) {\n this[kHooks].add(name, fn)\n this[kChildren].forEach(child => _addHook.call(child, name, fn))\n }\n }",
"setAsync(){\n this.async = true;\n }",
"_initHooks() {\n for (let hook in this.opts.hooks) {\n this.bind(hook, this.opts.hooks[hook]);\n }\n }",
"function hooks() {\n \"use strict\";\n}",
"onEnable() {}",
"init (asyncId, type, triggersAsyncId, resource) {\n fs.writeSync(1, \"\\n\\t>>>>>> Hook init <<<<<<<<\"+asyncId+\"\\n\")\n }",
"attachHooks(hooks){\n if(!hooks){ return false}\n if([] instanceof Array){\n _hooks.concat(hooks)\n }else {\n _hooks.push(hooks)\n }\n return true;\n }",
"function Async(fun, hook) {\n\tthis.fun = fun;\n\tthis.hook = hook;\n}",
"async function initialize() {\n enableLogging = await isLoggingEnabled();\n}",
"bindHooks() {\n //\n }",
"enable() { }",
"addHook (hook) {\n this.hooks.push(hook)\n }",
"updateHook() {\n return true;\n }",
"function setHookCallback(callback){hookCallback=callback;}",
"function setHookCallback(callback){hookCallback=callback;}",
"function setHookCallback(callback){hookCallback=callback;}",
"function setHookCallback(callback){hookCallback=callback;}",
"function hooks(){return hookCallback.apply(null,arguments)}",
"function hooks(){return hookCallback.apply(null,arguments)}",
"function setHookCallback(callback){hookCallback = callback;}",
"function startAsync()/* : void*/\n {\n this.asyncTestHelper$oHM3.startAsync();\n }",
"async registerWebhooks() {\n this.webhookSecret = \"chance_webhook_secret\";\n\n console.log('registering webhooks')\n await this.deleteHooks()\n await this.registerChannelUpdateWebhook();\n await this.registerFollowWebhook();\n }",
"function enable() {\n $(document)\n .on('ajax:error', handleError)\n .on('ajax:success', handleSuccess);\n }",
"function installAutoChangeDetectionStatusHandler(fixture) {\n if (!activeFixtures.size) {\n handleAutoChangeDetectionStatus(({ isDisabled, onDetectChangesNow }) => {\n disableAutoChangeDetection = isDisabled;\n if (onDetectChangesNow) {\n Promise.all(Array.from(activeFixtures).map(detectChanges)).then(onDetectChangesNow);\n }\n });\n }\n activeFixtures.add(fixture);\n}",
"_initAddons() {\n //\tInvoke \"before\" hook.\n this.trigger('initAddons:before');\n for (let addon in Mmenu.addons) {\n Mmenu.addons[addon].call(this);\n }\n //\tInvoke \"after\" hook.\n this.trigger('initAddons:after');\n }",
"function handleStartup() { //Read from local storage\r\n restoreOptions();\r\n enableGoogle();\r\n enableWikipedia();\r\n enableBing();\r\n enableDuckDuckGo();\r\n enableYahoo();\r\n enableBaidu();\r\n enableYoutube();\r\n enableWolframAlpha();\r\n enableYandex();\r\n enableReddit();\r\n enableImdb();\r\n enableDictionarydotcom();\r\n enableThesaurusdotcom();\r\n enableStackOverflow();\r\n enableGitHub();\r\n enableAmazon();\r\n enableEbay();\r\n enableTwitter();\r\n console.log('Twitter enabled on startup');\r\n enableFacebookPeopleSearch();\r\n}"
] |
[
"0.6162924",
"0.6069756",
"0.60573655",
"0.6001707",
"0.591311",
"0.58630574",
"0.57786167",
"0.5667597",
"0.56569",
"0.5647904",
"0.5635138",
"0.56149524",
"0.55609155",
"0.55569375",
"0.55372244",
"0.55340433",
"0.55156875",
"0.5512929",
"0.5512929",
"0.5512929",
"0.5512929",
"0.5495652",
"0.5495652",
"0.53887963",
"0.5375912",
"0.5364669",
"0.5353899",
"0.5337273",
"0.5325812",
"0.532436"
] |
0.6836857
|
0
|
Disable async hooks Context will not be maintained in future event loop iterations.
|
disable () {
this.hook.disable()
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function __onContextDisable() {\n return false;\n }",
"disableAsyncRequest() {\n this._asyncRequest = false;\n }",
"function disable() {\n ['complete', 'addNewTags', 'removeTags']\n .forEach(m => api[m] = () => Promise.resolve([]));\n }",
"function disableSync() {\n detachSyncListeners();\n}",
"disable() {\n this._getContextManager().disable();\n (0, global_utils_1.unregisterGlobal)(API_NAME, diag_1.DiagAPI.instance());\n }",
"disable() { }",
"onDisable() {}",
"function setDomainAsyncContextStrategy() {\n setAsyncContextStrategy({ getCurrentHub, runWithAsyncContext });\n}",
"disable_() {\n const map = this.getMap();\n console.assert(map, 'Map should be set.');\n this.listenerKeys_.forEach(olEvents.unlistenByKey);\n this.listenerKeys_.length = 0;\n }",
"enable () {\n this.hook.enable()\n }",
"async stopAsync() {\n var ref;\n await Promise.allSettled([\n (ref = this.notifier) == null ? void 0 : ref.stopObserving(),\n // Stop all dev servers\n ...devServers.map((server)=>server.stopAsync()\n ),\n // Stop ADB\n AndroidDebugBridge.getServer().stopAsync(), \n ]);\n }",
"disable() {\n (0, global_utils_1.unregisterGlobal)(API_NAME, diag_1.DiagAPI.instance());\n this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider();\n }",
"disable() {\n (0, global_utils_1.unregisterGlobal)(API_NAME, diag_1.DiagAPI.instance());\n }",
"disable() {\n (0, global_utils_1.unregisterGlobal)(API_NAME, diag_1.DiagAPI.instance());\n }",
"function forceDisable( evt ) {\n\tevt.return = false;\n\tevt.stop();\n}",
"function disableDebugTools() {\n delete context.ng;\n}",
"function disableDebugTools() {\n delete context.ng;\n }",
"function disableDebugTools() {\n delete context.ng;\n}",
"disable() {\n tooling.unsubscribe( onChange );\n }",
"disable() {\n\t // leave empty in Widget.js\n\t }",
"disableBrowserContextmenu() {\n return false;\n }",
"function disable() {\n $(document)\n .off('ajax:error', handleError)\n .off('ajax:success', handleSuccess);\n }",
"disable() {\n if (!this.isEnabled) return\n this.isEnabled = false\n }",
"function withAsyncContext(getAwaitable) {\n const ctx = getCurrentInstance();\n if (( true) && !ctx) {\n warn(`withAsyncContext called without active current instance. ` +\n `This is likely a bug.`);\n }\n let awaitable = getAwaitable();\n unsetCurrentInstance();\n if ((0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.isPromise)(awaitable)) {\n awaitable = awaitable.catch(e => {\n setCurrentInstance(ctx);\n throw e;\n });\n }\n return [awaitable, () => setCurrentInstance(ctx)];\n}",
"function withAsyncContext(getAwaitable) {\n const ctx = getCurrentInstance();\n if (( true) && !ctx) {\n warn(`withAsyncContext called without active current instance. ` +\n `This is likely a bug.`);\n }\n let awaitable = getAwaitable();\n unsetCurrentInstance();\n if ((0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.isPromise)(awaitable)) {\n awaitable = awaitable.catch(e => {\n setCurrentInstance(ctx);\n throw e;\n });\n }\n return [awaitable, () => setCurrentInstance(ctx)];\n}",
"set silenceEvents(status) {\n eventStates.silenceEvents = status? true : false;\n }",
"function enable() {\n document.removeEventListener(\"click\", handler,true);\n function handler(e){\n e.stopPropagation();\n }\n}",
"function disableTelemetry() {\n clearInterval(REPORTING_INTERVAL);\n}",
"function _unhook() {\n\t// set the original loader\n\tModule._load = _load;\n\t// reset hooking time\n\t_hookedAt = undefined;\n}",
"function _unhook() {\n\t// set the original loader\n\tModule._load = _load;\n\t// reset hooking time\n\t_hookedAt = undefined;\n}"
] |
[
"0.71950406",
"0.6153484",
"0.6112214",
"0.6021565",
"0.60205686",
"0.591711",
"0.5854089",
"0.5690456",
"0.56767505",
"0.5668639",
"0.562131",
"0.5610665",
"0.55469155",
"0.55469155",
"0.5541081",
"0.553704",
"0.5526142",
"0.55109835",
"0.54716474",
"0.5409741",
"0.5400517",
"0.5366161",
"0.53551483",
"0.5354418",
"0.5354418",
"0.52940404",
"0.52629656",
"0.5253095",
"0.5244755",
"0.5244755"
] |
0.6993661
|
1
|
Modal dynamic centering ===================================================
|
function modalCentering() {
$('.modal').each(function(){
if($(this).hasClass('in') === false){
$(this).show();
}
var contentHeight = $(window.parent, window.parent.document).height() - 60;
var headerHeight = $(this).find('.modal-header').outerHeight() || 2;
var footerHeight = $(this).find('.modal-footer').outerHeight() || 2;
var modalHeight = $(this).find('.modal-content').outerHeight();
var modalYPosition = $(this).find('.modal-dialog').offset().top;
var windowPageYOffset = window.top.pageYOffset;
var windowHeight = $(window).height();
$(this).find('.modal-dialog').addClass('modal-dialog-center').css({
'margin-top': function () {
if ( (((contentHeight - modalHeight) / 2) + windowPageYOffset - 230) < 0) {
return 0;
} else if((((contentHeight - modalHeight) / 2) + windowPageYOffset - 230) < $(window).height() - modalHeight ) {
return (( (contentHeight - modalHeight) / 2) + windowPageYOffset - 230);
}
},
'top': '',
'left': ''
});
if($(this).hasClass('in') === false){
$(this).hide();
}
});
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function centerModals(){\r\n $('.modal').each(function(i){\r\n var $clone = $(this).clone().css('display', 'block').appendTo('body');\r\n var top = Math.round(($clone.height() - $clone.find('.modal-content').height()) / 2);\r\n top = top > 0 ? top : 0;\r\n $clone.remove();\r\n $(this).find('.modal-content').css(\"margin-top\", top);\r\n });\r\n }",
"function centerModals(){\r\n\t $('.modal').each(function(i){\r\n\t\tvar $clone = $(this).clone().css('display', 'block').appendTo('body');\r\n\t\tvar top = Math.round(($clone.height() - $clone.find('.modal-content').height()) / 2);\r\n\t\ttop = top > 0 ? top : 0;\r\n\t\t$clone.remove();\r\n\t\t$(this).find('.modal-content').css(\"margin-top\", top);\r\n\t });\r\n\t}",
"function centerModals(){\n\t $('.modal').each(function(i){\n\t\tvar $clone = $(this).clone().css('display', 'block').appendTo('body');\n\t\tvar top = Math.round(($clone.height() - $clone.find('.modal-content').height()) / 2);\n\t\ttop = top > 0 ? top : 0;\n\t\t$clone.remove();\n\t\t$(this).find('.modal-content').css(\"margin-top\", top);\n\t });\n\t}",
"function centerModals() {\r\n\t$('.modal').each(function(i) {\r\n\t\tvar $clone = $(this).clone().css('display', 'block').appendTo('body');\r\n\t\tvar top = Math.round(($clone.height() - $clone.find('.modal-content').height()) / 2);\r\n\t\ttop = top > 0 ? top : 0;\r\n\t\t$clone.remove();\r\n\t\t$(this).find('.modal-content').css('margin-top', top);\r\n\t});\r\n}",
"function reposition() {\n var modal = $(this),\n dialog = modal.find('.modal-dialog');\n modal.css('display', 'block');\n \n // Dividing by two centers the modal exactly, but dividing by three \n // or four works better for larger screens.\n dialog.css(\"margin-top\", Math.max(0, ($(window).height() - dialog.height()) / 2));\n}",
"function alignModal() {\n var modalDialog = $(this).find(\".modal-dialog\");\n modalDialog.css(\"margin-top\", Math.max(0,\n ($(window).height() - modalDialog.height()) / 2));\n }",
"function reposition() {\r\n\tvar modal = jQuery(this),\r\n\tdialog = modal.find('.modal-dialog');\r\n\tmodal.css('display', 'block');\r\n\t\r\n\t/* Dividing by two centers the modal exactly, but dividing by three \r\n\t or four works better for larger screens. */\r\n\tdialog.css(\"margin-top\", Math.max(0, (jQuery(window).height() - dialog.height()) / 2));\r\n}",
"function positionmodal() {\n\n // Half the width of the modal\n var left = modalwidth / 2;\n\n // Half the width of the mask\n var halfmaskwidth = windowwidth / 2;\n\n // Location of the left side of the popup\n var popupleft = halfmaskwidth - left;\n\n // Top stays static\n popup.css('top', 30);\n\n // Set the left\n popup.css('left', popupleft);\n\n }",
"function reposition() {\n\t\tvar modal = $(this),\n\t\t\tdialog = modal.find('.modal-dialog');\n\t\t\tmodal.css('display', 'block');\n\t\t\tdialog.css(\"margin-top\", Math.max(0, ($(window).height() - dialog.height()) / 2));\n\t\t\t$(\".modal .actions\").css(\"margin-top\", Math.max(0, ($(window).height() - dialog.height()) / 2));\n\t}",
"function SetModalPos(obj) {\n if ($($(obj).data('target')).is(':visible')) {\n var width_0 = $(obj).parent().parent().parent().parent().parent().outerWidth() - $(obj).parent().parent().parent().parent().outerWidth();\n var width = 2 * ($(obj).parent().parent().parent().parent().parent().outerWidth() - (width_0 - 3) / 2);\n $($(obj).data('target')).css({\n 'width': width + 'px'\n });\n $($(obj).data('target')).children().css({\n 'width': width + 'px'\n });\n $($(obj).data('target')).css({\n 'height': $($(obj).data('target')).children().outerHeight() + 'px'\n });\n $('#main').css('min-height', ($(obj).parent().parent().parent().parent().offset().top - 2 + $($(obj).data('target')).children().outerHeight() + 20) + 'px');\n var left = $(obj).parent().parent().parent().parent().offset().left - 1;\n if (left + width > $(window).innerWidth()) left = left - (width + width_0 - 2) / 2;\n $($(obj).data('target')).offset({\n top: $(obj).parent().parent().parent().parent().offset().top - 2,\n left: left\n });\n $($(obj).data('target')).children().offset({\n top: $(obj).parent().parent().parent().parent().offset().top - 2,\n left: left\n });\n }\n}",
"function MyVerticallyCenteredModal(props) {\n return (\n <Modal\n {...props}\n size=\"lg\"\n aria-labelledby=\"contained-modal-title-vcenter\"\n centered\n >\n <Modal.Header closeButton>\n <Modal.Title id=\"contained-modal-title-vcenter\">\n <strong>Apa Itu SmartQ?</strong> \n </Modal.Title>\n </Modal.Header>\n <Modal.Body>\n <p>\n SmartQ merupakan sebuah aplikasi booking dan atau antrian yang dilakukan secara online \n dengan tujuan memberikan konsumen kemudahan, efisiensi, dan efektivitas waktu yang lebih \n baik. Selain itu SmartQ juga memberikan profitabilitas lebih bagi UMKM yang sampai hari \n ini masih memiliki kendala mengenai system antrian. Dengan adanya perbaikan system antrian \n yang ada di Indonesia diharapkan mampu menciptakan, menumbuhkan dan menerapkan kembali \n budaya antri yang sudah mulai menghilang di lingkungan masyarakat saat ini. Selain itu \n budaya antri merupakan sebuah kegiatan yang seharusnya diterapkan oleh setiap orang pada \n tempat dan waktu tertentu. Usaha layanan ini juga dapat mengintegrasikan UMKM yang \n membutuhkan solusi mengenai system antrian yang masih belum berjalan dengan baik sehingga \n dapat meningkatkan pelayanannya terhadap konsumen yang ada pada suatu tempat tersebut, \n sehingga mampu meningkatkan pelayanan yang jauh lebih baik dibandingkan dengan sebelumnya.\n </p>\n </Modal.Body>\n <Modal.Footer>\n <Button variant=\"primary\" onClick={props.onHide}>Close</Button>\n </Modal.Footer>\n </Modal>\n );\n}",
"recenterModalAndHideBtnSurface(){\n this.closeModalAndShowBtnSurface()\n const cameraQuat = r360.getCameraQuaternion()\n infoPanel.recenter(cameraQuat, 'all')\n this.hideSurfacesInPanelArea()\n }",
"function showModalLayout() {\n modal.className = \"fixed z-20 h-full w-full bg-white rounded-lg transform translate-y-0 transition duration-300\";\n}",
"function openModal(modalToOpen) {\n //$(\".modal\").css(\"marginTop\", \"0\");\n $(modalToOpen).css(\"marginLeft\", ($(window).width() - $(modalToOpen).width())/2);\n $(modalToOpen+\"-bg\").fadeIn();\n $(modalToOpen).fadeIn();\n}",
"function showModal(ev){\n clickTarget=ev.target.id-1;\n\n contentBox=document.getElementsByClassName('modal')[clickTarget];\n ev.stopPropagation();\n contentBox.style.display = 'flex';\n contentBox.style.flexDirection='column';\n contentBox.style.justifyContent='center';\n contentBox.style.alignItems='center';\n\n}",
"function display_ws_modal() {\n var id = '#dialog';\n //transition effect \n $('#mask').fadeIn(500); \n $('#mask').fadeTo(\"slow\",0.8); \n \n //Get the window height and width\n var winH = $(window).height();\n var winW = $(window).width();\n \n //Set the popup window to center\n $(id).css('top', winH/2-$(id).height()/2);\n $(id).css('left', winW/2-$(id).width()/2);\n \n //transition effect\n $(id).fadeIn(1000); \n }",
"function _center() {\n\t\tif (data.isMobile) {\n\t\t\tvar newLeft = 0,\n\t\t\t\tnewTop = 0;\n\t\t} else {\n\t\t\tvar newLeft = ($(window).width() - data.$boxer.width() - data.padding) / 2,\n\t\t\t\tnewTop = (data.options.top <= 0) ? (($(window).height() - data.$boxer.height() - data.padding) / 2) : data.options.top;\n\t\t\t\n\t\t\tif (data.options.fixed !== true) {\n\t\t\t\tnewTop += $(window).scrollTop();\n\t\t\t}\n\t\t}\n\t\t\n\t\tdata.$boxer.css({ \n\t\t\tleft: newLeft, \n\t\t\ttop: newTop \n\t\t});\n\t}",
"function adjustAndShow(modal) {\r\n\t$(\"#modal-background\").css(\"height\", document.body.scrollHeight > document.body.offsetHeight ? (document.body.scrollHeight>$(window).height()? document.body.scrollHeight :$(window).height()) : (document.body.offsetHeight>$(window).height()? document.body.offsetHeight:$(window).height()));\r\n\t$(\"#modal-background, \" + modal).show();\r\n\t$(\"#new-modal-window\").css(\"margin-left\", - $(\"#new-modal-window\").width() / 2 + \"px\").css(\"margin-top\", - $(\"#new-modal-window\").height() / 2 + \"px\");\r\n\tvar height = 0;\r\n\t$(modal + \" .outLay .modalBody .modalContent li\").each(function(){\r\n\t\theight += $(this).height();\r\n\t});\r\n\tif(!$(modal+ \" .outLay .modalBody .modalContent\").hasClass(\"multiple\")){\r\n\t\t$(modal+ \" .outLay .modalBody .modalContent li:first\").css(\"padding-top\", ($(\".outLay .modalBody .modalContent\").height() - height) / 2 + \"px\");\r\n\t}\r\n\r\n if (jQuery.browser.msie && jQuery.browser.version == '9.0') {\r\n $(modal + \" .modalBody\").css(\"margin-top\", \"-2px\");\r\n }\r\n}",
"function adjustAndShow(modal) {\n $(\"#modal-background\").css(\"height\", document.body.scrollHeight > document.body.offsetHeight ? (document.body.scrollHeight>$(window).height()? document.body.scrollHeight :$(window).height()) : (document.body.offsetHeight>$(window).height()? document.body.offsetHeight:$(window).height()));\n $(\"#modal-background, \" + modal).show();\n $(\"#new-modal-window\").css(\"margin-left\", - $(\"#new-modal-window\").width() / 2 + \"px\").css(\"margin-top\", - $(\"#new-modal-window\").height() / 2 + \"px\");\n var height = 0;\n $(modal + \".outLay .modalBody .modalContent li\").each(function(){\n height += $(this).height();\n });\n if(!$(modal+ \".outLay .modalBody .modalContent\").hasClass(\"multiple\")){\n $(modal+ \".outLay .modalBody .modalContent li:first\").css(\"padding-top\", ($(\".outLay .modalBody .modalContent\").height() - height) / 2 + \"px\");\n }\n if (jQuery.browser.msie && jQuery.browser.version == '9.0') {\n $(modal + \" .modalBody\").css(\"margin-top\", \"-2px\");\n }\n}",
"function displayModal(modalId)\n\t{\n\t\tvar modal = document.getElementById(modalId)\n\t\tvar background = document.getElementById(\"overlay\");\n\t\tbackground.className = \"overlay\"\n\t\tmodal.className = \"displayModal\";\n\t\tvar width = modal.clientWidth; \n\t\tvar height = modal.clientHeight; \n\t\tvar displacementX = '-'+ (width/2) + 'px';\n\t\tvar displacementY = '-' + (height/2) + 'px'; \n\t\tmodal.style.marginLeft = displacementX;\n\t\tmodal.style.marginTop = displacementY; \n\t}",
"alignCenter() {\n this.setAnchor(0.5);\n this.setStyle({ align: 'center' });\n }",
"function centerDiv(divId) {\t\r\n\tjQuery(function($){\r\n\t\t//request data for centering\r\n\t\tvar popupHeight = $(\"#\" + divId).height();\r\n\t\tvar popupWidth = $(\"#\" + divId).width();\r\n\t\t//centering\r\n\t\t$(\"#\" + divId).css({\r\n\t\t\t//\"top\": windowHeight/2-popupHeight/2,\r\n\t\t\t//\"left\": windowWidth/2-popupWidth/2\r\n\t\t\t\"top\": document.documentElement.clientHeight/2-popupHeight/2,\r\n\t\t\t\"left\": document.documentElement.clientWidth/2-popupWidth/2\r\n\t\t});\r\n\t});\t\r\n}",
"function modalMaker(argument) {\n \treturn m(\".\" + argument.class, {\n \t\tid: argument.id\n \t}, [\n \t\tm(\"div\", {\n \t\t\tclass: \"center\"\n \t\t}, [\n \t\t\tm(argument.body)\n \t\t])\n \t])\n }",
"function displayBox() \n{\t\n\tjQuery.fn.center = function (absolute) {\n\t\treturn this.each(function () {\n\t\t\tvar t = jQuery(this);\n\t\t\n\t\t\tt.css({\n\t\t\t\tposition: absolute ? 'absolute' : 'fixed', \n\t\t\t\tleft: '50%', \n\t\t\t\ttop: '50%', \n\t\t\t\tzIndex: '200000'\n\t\t\t}).css({\n\t\t\t\tmarginLeft: '-' + (t.outerWidth() / 2) + 'px', \n\t\t\t\tmarginTop: '-' + (t.outerHeight() / 2) + 'px'\n\t\t\t});\n\t\t\n\t\t\tif (absolute) {\n\t\t\t\tt.css({\n\t\t\t\t\tmarginTop: parseInt(t.css('marginTop'), 10) + jQuery(window).scrollTop(), \n\t\t\t\t\tmarginLeft: parseInt(t.css('marginLeft'), 10) + jQuery(window).scrollLeft()\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t};\n\tjQuery('#garden_fence_modal').center();\n}",
"function screen_center_pos(PopUpWidth, PopUpHeight)\n{\n\tvar Width = $(window).width()\n\n\tvar Height = $(window).height()\n\n\treturn({\n\t\tx : (Width/2 - PopUpWidth/2) , \n\t\ty : (Height/2 - PopUpHeight/2)\n\t})\n}",
"function center()\n\t{\n\t\tfw.dock(wid, {\n\t\t\twid: that,\n\t\t\tmy: 'center left',\n\t\t\tat: 'center left'\n\t\t});\n\t}",
"function makeItCenter(el)\n {\n if($(\"#Stage\").width() < 1200){\n el.css(\"marginLeft\",\"0px\");\n el.css(\"left\",\"76px\");\n }else{\n el.css(\"marginLeft\",(el.width()/2)*-1);\n el.css(\"left\",\"50%\");\n }\n\n }",
"function modal_message(title, body){\n\t\n\t $('#myModal .modal-title').html(title); \n\t $('#myModal .modal-body').html(body); \n\t $('#myModal .modal-body').css(\"text-align\", \"center\");\n\t $('#myModal').modal(\"show\");\n\n}",
"function show() {\n // Add background overlay when a modal is appeared\n bg = document.createElement(\"div\");\n bg.setAttribute(\"id\", \"overLay\");\n document.body.append(bg);\n // Add style for modal\n modal.style.display = \"block\";\n // Remove background overlay when a background is clicked\n bg.addEventListener(\"click\", hide);\n // Make the modal center\n center(modal);\n}",
"function popupCenter(url, width, height, name) {\n var left = (screen.width/2)-(width/2);\n var top = (screen.height/2)-(height/2);\n return window.open(url, name, \"menubar=no,toolbar=no,status=no,width=\"+width+\",height=\"+height+\",toolbar=no,left=\"+left+\",top=\"+top);\n}"
] |
[
"0.7634573",
"0.75718945",
"0.75614905",
"0.7467109",
"0.72934854",
"0.7237434",
"0.72195196",
"0.71343297",
"0.6906135",
"0.6774058",
"0.6645346",
"0.6619515",
"0.6583715",
"0.6579641",
"0.65769255",
"0.65513873",
"0.6471437",
"0.64542484",
"0.6451589",
"0.6449236",
"0.64283484",
"0.642428",
"0.64003074",
"0.63920903",
"0.6350064",
"0.6318161",
"0.6299136",
"0.62867486",
"0.62789756",
"0.6278783"
] |
0.80270875
|
0
|
Evaluate an arbitrary chunk of script in the scene graph execution context. The script is guaranteed to be evaluated after the scene graph execution context is fully initialized. It is not guaranteed to be evaluated before or after a Model is made available in the scene graph execution context. Note that web browsers do not universally support module scripts ("ESM") in Workers, so for now all scripts must be valid nonmodule scripts.
|
async eval(scriptSource) {
const port = await this[$workerInitializes];
const url = URL.createObjectURL(new Blob([scriptSource], { type: 'text/javascript' }));
port.postMessage({ type: ThreeDOMMessageType.IMPORT_SCRIPT, url });
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"_eval() {\n if (this._alreadyStarted) {\n return;\n }\n\n // TODO: this text check doesn't seem completely the same as the spec, which e.g. will try to execute scripts with\n // child element nodes. Spec bug? https://github.com/whatwg/html/issues/3419\n if (!this.hasAttributeNS(null, \"src\") && this.text.length === 0) {\n return;\n }\n\n if (!this._attached) {\n return;\n }\n\n const scriptBlocksTypeString = this._getTypeString();\n const type = getType(scriptBlocksTypeString);\n\n if (type !== \"classic\") {\n // TODO: implement modules, and then change the check to `type === null`.\n return;\n }\n\n this._alreadyStarted = true;\n\n // TODO: implement nomodule here, **but only after we support modules**.\n\n // At this point we completely depart from the spec.\n\n if (this.hasAttributeNS(null, \"src\")) {\n this._fetchExternalScript();\n } else {\n this._fetchInternalScript();\n }\n }",
"async evaluate(scripts) {\n scripts &&= [].concat(scripts);\n if (!scripts?.length) return;\n\n this.log.debug('Evaluate JavaScript', { ...this.meta, scripts });\n\n for (let script of scripts) {\n if (typeof script === 'string') {\n script = `async eval({ waitFor }) {\\n${script}\\n}`;\n }\n\n await this.eval(script);\n }\n }",
"function runScripts(sceneNode)\n{\n var scripts = sceneNode.userData.scripts;\n if (scripts === undefined) return;\n\n for (var j=0; j<scripts.length; j++) {\n var s = scripts[j];\n var f = window[s]; // look up function by name\n if (f !== undefined) f(sceneNode);\n }\n}",
"function evalScript(script) {\n var module = { exports: {} };\n var require = function require(path) {\n // eslint-disable-line no-unused-vars\n return modules.get(path);\n };\n // don't use Function() here since it changes source locations\n eval(script); // eslint-disable-line no-eval\n return module.exports;\n}",
"function evalScript (content) {\n var script = document.createElement('script');\n\n document.head.appendChild(script);\n script.appendChild(document.createTextNode(content));\n\n return script;\n}",
"function evalmJs(src) { eval(src); }",
"function globalEval(js) {\n const node = document.createElement('script')\n const root = document.documentElement\n\n // make the source available in the \"(no domain)\" tab\n // of Chrome DevTools, with a .js extension\n node.text = js\n\n root.appendChild(node)\n root.removeChild(node)\n}",
"Evaluate() {}",
"function evaluate(script, obj, options) {\n var compiled = interpol(script, options);\n return compiled(obj, options);\n}",
"evalJs(js) {\n // console.log('-----------------------evalJs');\n // console.log(js);\n this.go(`javascript: ${js};` + Math.random());\n }",
"globalEval(code, nonce) {\n var _a, _b, _c;\n const head = (_b = (_a = document.getElementsByTagName(\"head\")) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : (_c = document.documentElement.getElementsByTagName(\"head\")) === null || _c === void 0 ? void 0 : _c[0];\n const script = document.createElement(\"script\");\n if (nonce) {\n if ('undefined' != typeof (script === null || script === void 0 ? void 0 : script.nonce)) {\n script.nonce = nonce;\n }\n else {\n script.setAttribute(\"nonce\", nonce);\n }\n }\n script.type = \"text/javascript\";\n script.innerHTML = code;\n let newScriptElement = head.appendChild(script);\n head.removeChild(newScriptElement);\n return this;\n }",
"globalEval(code, nonce) {\n var _a, _b, _c;\n const head = (_b = (_a = document.getElementsByTagName(\"head\")) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : (_c = document.documentElement.getElementsByTagName(\"head\")) === null || _c === void 0 ? void 0 : _c[0];\n const script = document.createElement(\"script\");\n if (nonce) {\n if ('undefined' != typeof (script === null || script === void 0 ? void 0 : script.nonce)) {\n script.nonce = nonce;\n }\n else {\n script.setAttribute(\"nonce\", nonce);\n }\n }\n script.type = \"text/javascript\";\n script.innerHTML = code;\n let newScriptElement = head.appendChild(script);\n head.removeChild(newScriptElement);\n return this;\n }",
"function Script() {}",
"async function execute() {\n let init_content;\n if (initfile !== null) {\n init_content = await load_init_file(initfile);\n } else {\n init_content = \"\";\n }\n\n let editor_code = await editor.getValue();\n let script = start_script + init_content + editor_code + end_script;\n let resp = await run_code(script);\n\n fillOutput(resp);\n displayOrHideOutputs(resp);\n\n }",
"function runUserJsAndGetRaw(data, code, ctx) {\n return __awaiter(this, void 0, void 0, function () {\n var sandbox, curLoop, context, result, temp, wrapper, script, err_1, e, nerr;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n sandbox = (0, timm_1.merge)(ctx.jsSandbox || {}, {\n __code__: code,\n __result__: undefined,\n }, data, ctx.options.additionalJsContext);\n curLoop = (0, reportUtils_1.getCurLoop)(ctx);\n if (curLoop)\n sandbox.$idx = curLoop.idx;\n Object.keys(ctx.vars).forEach(function (varName) {\n sandbox[\"$\".concat(varName)] = ctx.vars[varName];\n });\n _a.label = 1;\n case 1:\n _a.trys.push([1, 8, , 12]);\n if (!ctx.options.runJs) return [3 /*break*/, 3];\n temp = ctx.options.runJs({ sandbox: sandbox, ctx: ctx });\n context = temp.modifiedSandbox;\n return [4 /*yield*/, temp.result];\n case 2:\n result = _a.sent();\n return [3 /*break*/, 7];\n case 3:\n if (!ctx.options.noSandbox) return [3 /*break*/, 5];\n context = sandbox;\n wrapper = new Function('with(this) { return eval(__code__); }');\n return [4 /*yield*/, wrapper.call(context)];\n case 4:\n result = _a.sent();\n return [3 /*break*/, 7];\n case 5:\n script = new vm_1.default.Script(\"\\n __result__ = eval(__code__);\\n \", {});\n context = vm_1.default.createContext(sandbox);\n script.runInContext(context);\n return [4 /*yield*/, context.__result__];\n case 6:\n result = _a.sent();\n _a.label = 7;\n case 7: return [3 /*break*/, 12];\n case 8:\n err_1 = _a.sent();\n e = err_1 instanceof Error ? err_1 : new Error(\"\".concat(err_1));\n if (!(ctx.options.errorHandler != null)) return [3 /*break*/, 10];\n context = sandbox;\n return [4 /*yield*/, ctx.options.errorHandler(e, code)];\n case 9:\n result = _a.sent();\n return [3 /*break*/, 11];\n case 10: throw new errors_1.CommandExecutionError(e, code);\n case 11: return [3 /*break*/, 12];\n case 12:\n if (!(ctx.options.rejectNullish && result == null)) return [3 /*break*/, 15];\n nerr = new errors_1.NullishCommandResultError(code);\n if (!(ctx.options.errorHandler != null)) return [3 /*break*/, 14];\n return [4 /*yield*/, ctx.options.errorHandler(nerr, code)];\n case 13:\n result = _a.sent();\n return [3 /*break*/, 15];\n case 14: throw nerr;\n case 15:\n // Save the sandbox for later use\n ctx.jsSandbox = (0, timm_1.omit)(context, ['__code__', '__result__']);\n debug_1.logger.debug('JS result', { attach: result });\n return [2 /*return*/, result];\n }\n });\n });\n}",
"function contentEval(source) {\n // Check for function input.\n if ('function' == typeof source) {\n // Execute this function with no arguments, by adding parentheses.\n // One set around the function, required for valid syntax, and a\n // second empty set calls the surrounded function.\n source = '(' + source + ')();'\n }\n\n // Create a script node holding this source code.\n var script = document.createElement('script');\n script.setAttribute(\"type\", \"application/javascript\");\n script.textContent = source;\n\n // Insert the script node into the page, so it will run, and immediately\n // remove it to clean up.\n document.body.appendChild(script);\n document.body.removeChild(script);\n}",
"function include(scriptURL) {\n let xhr = new XMLHttpRequest();\n xhr.open('GET', scriptURL);\n xhr.onreadystatechange = () => {\n if ((xhr.status === 200) && (xhr.readyState === 4)) eval(xhr.responseText);\n };\n xhr.send();\n}",
"script({ content: scriptContent, attributes }) {\n const ext = getScriptExtensionByAttrs(attributes);\n if (![ '.ts', '.tsx', '.coffee', '.jsx' ].includes(ext)) return null;\n // TODO: check if sourcemaps can be usefull for inline scripts\n return compileJS({\n ...ctx,\n path: `${ctx.path}-${scriptIndex++}${ext}`,\n stats: {\n ...ctx.stats,\n ext,\n },\n }, scriptContent, false, { skipHQTrans: true, skipSM: true });\n }",
"function contentEval(source) {\r\n\t// Check for function input.\r\n\tif ('function' == typeof source) {\r\n\t\t// Execute this function with no arguments, by adding parentheses.\r\n\t\t// One set around the function, required for valid syntax, and a second empty set calls the surrounded function.\r\n\t\tsource = '(' + source + ')();'\r\n\t}\r\n\r\n\t// Create a script node holding this source code.\r\n\tvar script = document.createElement('script');\r\n\tscript.setAttribute(\"type\", \"application/javascript\");\r\n\tscript.textContent = source;\r\n\r\n\t// Insert the script node into the page, so it will run, and immediately remove it to clean up.\r\n\tdocument.body.appendChild(script);\r\n\tdocument.body.removeChild(script);\r\n}",
"function contentEval(source) {\r\n // Check for function input.\r\n if ('function' == typeof source) {\r\n // Execute this function with no arguments, by adding parentheses.\r\n // One set around the function, required for valid syntax, and a\r\n // second empty set calls the surrounded function.\r\n source = '(' + source + ')();'\r\n }\r\n // Create a script node holding this source code.\r\n var script = document.createElement('script');\r\n script.setAttribute(\"type\", \"application/javascript\");\r\n script.textContent = source;\r\n // Insert the script node into the page, so it will run, and immediately\r\n // remove it to clean up.\r\n document.body.appendChild(script);\r\n document.body.removeChild(script);\r\n}",
"function contentEval(source) {\r\n // Check for function input.\r\n if ('function' == typeof source) {\r\n // Execute this function with no arguments, by adding parentheses.\r\n // One set around the function, required for valid syntax, and a\r\n // second empty set calls the surrounded function.\r\n source = '(' + source + ')();'\r\n }\r\n // Create a script node holding this source code.\r\n var script = document.createElement('script');\r\n script.setAttribute(\"type\", \"application/javascript\");\r\n script.textContent = source;\r\n\r\n // Insert the script node into the page, so it will run, and immediately\r\n // remove it to clean up.\r\n document.body.appendChild(script);\r\n document.body.removeChild(script);\r\n}",
"globalEval() {\n // phase one, if we have head inserts, we build up those before going into the script eval phase\n let insertHeadElems = new ExtDomQuery_1.ExtDomQuery(...this.internalContext.getIf(Const_1.DEFERRED_HEAD_INSERTS).value);\n insertHeadElems.runHeadInserts(true);\n // phase 2 we run a script eval on all updated elements in the body\n let updateElems = new ExtDomQuery_1.ExtDomQuery(...this.internalContext.getIf(Const_1.UPDATE_ELEMS).value);\n updateElems.runCss();\n // phase 3, we do the same for the css\n updateElems.runScripts();\n }",
"function scripts(ob) {\n\t\tvar v = ob.getElementsByTagName('script');\n\t\tfor (var i=0;i<v.length;i++) {\n\t\t\tdebJ('eval js: '+v[i].textContent);\n\t\t\twith (document) {\n\t\t\t\teval(v[i].textContent);\n\t\t\t}\n\t\t}\n\t}",
"function runScript() {\n\tconsole.time(\"index\");\n var job = tabs.activeTab.attach({\n \tcontentScriptFile: [self.data.url(\"models_50_wif/benign/CompositeBenignCountsA.js\"),\n \t\t\t\t\t\tself.data.url(\"models_50_wif/benign/CompositeBenignCountsAB.js\"),\n\t\t\t\t\t\tself.data.url(\"models_50_wif/benign/CompositeBenignTotal.js\"),\n\t\t\t\t\t\tself.data.url(\"models_50_wif/malicious/CompositeMaliciousTotal.js\"),\n \t\t\t\t\t\tself.data.url(\"models_50_wif/malicious/CompositeMaliciousCountsA.js\"),\n \t\t\t\t\t\tself.data.url(\"models_50_wif/malicious/CompositeMaliciousCountsAB.js\"),\n self.data.url(\"CompositeWordTransform.js\"),\n \t\t\t\t\t\tself.data.url(\"DetectComposite.js\")]\n \n \n });\n \n job.port.on(\"script-response\", function(response) {\n\t\n\tconsole.log(response);\n });\n}",
"function run(transformFn, script) {\n const scriptEl = document.createElement(\"script\");\n scriptEl.text = transformCode(transformFn, script);\n headEl.appendChild(scriptEl);\n}",
"async script (func, args) {\n debug('scripting page', func)\n if (!Array.isArray(args)) {\n args = [args]\n }\n\n return new Promise(resolve => {\n this.pageContext.evaluate((stringyFunc, args) => {\n var invoke = new Function(\n 'return ' + stringyFunc\n )()\n return invoke.apply(null, args)\n },\n func.toString(),\n args,\n (err, result) => {\n if (err) {\n console.error(err)\n }\n resolve(result)\n })\n })\n }",
"function runCode() {\n\tPromise.all(preLoad()).then((neverland) => {\n\t\tif (neverland)\n\t\t\tneverland.forEach((p) => {usr_res[p[0]] = p[1];});\n\t\t//console.log(usr_res);\n\n\t\tstopCode();\n\n\t\tconst code = Blockly.JavaScript.workspaceToCode(workspace);\n\t\ttry {\n\t\t\teval(code);\n\t\t}\n\t\tcatch (e) {\n\t\t\tstopCode();\n\t\t\talert(e);\n\t\t}\n\t}).catch((err) => {\n\t\tconsole.log(err);\n\t});\n}",
"function executeScript(dataIn) {\r\n var script = dataIn.script;\r\n nlapiLogExecution('DEBUG', 'final script = ', script);\r\n var result = eval(script);\r\n\r\n return result;\r\n}",
"function localEval(_script, _scopes, _localScope){\n\t\tif (isDebug) console.log(\"localEval:\"+_script);\n\n\t\ttry {\n\t\t\tvar _res;\n\t\t\tif (_scopes == null || _scopes.length == 0) {\n\t\t\t\twith (_localScope) {\n\t\t\t\t\t_res = eval(_script);\n\t\t\t\t}\n\t\t\t} else if (_scopes.length == 1) {\n\t\t\t\twith (_scopes[0]) {\twith (_localScope) {\n\t\t\t\t\t_res = eval(_script);\n\t\t\t\t}}\n\t\t\t} else {\n\t\t\t\t_res = eval(wrapScopes(_script, _scopes, _localScope));\n\t\t\t}\n\t\t\tif (isDebug) console.log(\"localEval=\" + _res);\n\t\t\treturn _res;\n\t\t} catch (e) {\n\t\t\te.message = \"eval: \"+_script+\"\\n\\n\"+e.message;\n\t\t\t//throw e;\n\t\t\tif (isDebug) alert(e.message+\"\\n\"+e.stack);\n\t\t\tconsole.error(e.message+\"\\n\"+e.stack);\n\t\t\treturn undefined;\n\t\t}\n\t}",
"function run(transformFn, script) {\n\t var scriptEl = document.createElement('script');\n\t scriptEl.text = transformCode(transformFn, script);\n\t headEl.appendChild(scriptEl);\n\t}"
] |
[
"0.61933666",
"0.59797895",
"0.5734536",
"0.5630442",
"0.5562425",
"0.5440175",
"0.5411526",
"0.53185433",
"0.5271838",
"0.52667075",
"0.52625674",
"0.52625674",
"0.5241362",
"0.5230076",
"0.5201438",
"0.51871127",
"0.517867",
"0.516801",
"0.5165879",
"0.51389235",
"0.51377875",
"0.50995314",
"0.5096614",
"0.50834274",
"0.507482",
"0.5069575",
"0.50545114",
"0.5050907",
"0.50430655",
"0.5022922"
] |
0.6708901
|
0
|
Terminates the scene graph execution context, closes the designated messaging port and generally cleans up the ThreeDOMExecutionContext so that it can be properly garbage collected.
|
async terminate() {
this[$worker].terminate();
const modelGraftManipulator = this[$modelGraftManipulator];
if (modelGraftManipulator != null) {
modelGraftManipulator.dispose();
this[$modelGraftManipulator] = null;
}
const port = await this[$workerInitializes];
port.close();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"end() {\n this.medals();\n this.endMessage();\n this.cleanUp();\n this.gc();\n }",
"exitFrame() {\n if (this.contexts && this.contexts.length > 1) {\n this.contexts = this.contexts.slice();\n this.contexts.splice(-1);\n this.currentContextIds.shift();\n }\n else {\n throw new Error('Cannot exit frame, the context is empty');\n }\n }",
"exitFrame() {\n if (this.contexts && this.contexts.length > 1) {\n this.contexts = this.contexts.slice();\n this.contexts.splice(-1);\n this.currentContextIds.shift();\n }\n else {\n throw new Error('Cannot exit frame, the context is empty');\n }\n }",
"destroy() {\n if (this.engineWorker != null) {\n engineLoader.returnEngineWorker(this.engineWorker);\n }\n this.eventEmitter.removeAllListeners();\n }",
"finish() {\n this._ctx.restore();\n }",
"destroy() {\n this.disposables.dispose();\n this.controlView.destroy();\n this.extensionView.destroy();\n this.fileView.destroy();\n this.contentView.destroy();\n this.element.remove();\n // Do not stop external process.\n this.serverProcess = null;\n }",
"exit() {\n this.emitter.emit('exit');\n if (this.browser) this.browser.close();\n }",
"close() {\n this._observers = undefined;\n if (this.notificationQueue != null) {\n // Cancel the notification iterator\n this.notificationQueue.return(undefined).catch(err => {\n this.handleNotificationError(err);\n });\n this.notificationQueue = undefined;\n }\n if (this.context.parent && this._parentContextEventListener) {\n this.context.parent.removeListener('bind', this._parentContextEventListener);\n this.context.parent.removeListener('unbind', this._parentContextEventListener);\n this._parentContextEventListener = undefined;\n }\n }",
"function exitCtx() {\n ctxStack.pop();\n }",
"_exitContext() {\n this._stack.pop();\n }",
"destroy() {\n console.log('[Pipeline] Destroying Pipeline');\n this.abortController_.abort();\n if (this.source_) this.source_.destroy();\n if (this.frameTransform_) this.frameTransform_.destroy();\n if (this.sink_) this.sink_.destroy();\n }",
"destroy() {\n this._end();\n }",
"terminate() {\n this._child.send({\n cmd: 'terminate',\n data: null\n });\n this._child.kill();\n this._child.disconnect();\n }",
"quit() {\n if (this.process) {\n this.process.kill('SIGTERM');\n this.process = null;\n }\n }",
"function terminate() {\n\tt.murder(eventHandlers.cb);\n}",
"exit() {\n this.exit();\n }",
"destroy() {\n this.wt.destroy();\n this.eventManager.destroy();\n }",
"function close() {\n\n ipcRenderer.send('close', 'close')\n\n }",
"close() {\n this.next = () => {};\n if (this.worker) {\n this.worker.next(true);\n }\n delete this.next;\n delete this.ctx;\n }",
"dispose() {\n this.workers.forEach(t => t.dispose());\n if (this.own) {\n this.terminal.dispose();\n }\n }",
"end() {\n\t\tif (this.process)\n\t\t\tthis.process.kill()\n\t}",
"destroy() {\n if (this.$toDestroy) {\n this.$toDestroy.forEach(function(el) {\n el.destroy();\n });\n this.$toDestroy = null;\n }\n if (this.$mouseHandler)\n this.$mouseHandler.destroy();\n this.renderer.destroy();\n this._signal(\"destroy\", this);\n if (this.session)\n this.session.destroy();\n if (this._$emitInputEvent)\n this._$emitInputEvent.cancel();\n this.removeAllListeners();\n }",
"destroy() {\n this._pipe && this._pipe.destroy();\n this._inbound && this._inbound.destroy();\n this._outbound && this._outbound.destroy();\n this._pipe = null;\n this._inbound = null;\n this._outbound = null;\n this._presets = null;\n this._context = null;\n this._proxyRequest = null;\n }",
"destroy() {\n this._destroyed = true;\n\n if (typeof this.freeFromPool === 'function') {\n this.freeFromPool();\n }\n\n if (this.currentMap) {\n this.currentMap.removeObject(this);\n } else if (this.currentScene) {\n this.currentScene.removeObject(this);\n }\n\n this.children.forEach((child) => {\n child.destroy();\n });\n\n // triggers the wave end\n if (this.wave) {\n this.wave.remove(this);\n }\n }",
"destroy () {\n this._socket.close()\n this._rtc.close()\n this._removeEventListeners()\n }",
"endCallingContext() {\n var composer = exports.$composer;\n if ($isNothing(composer)) return;\n var context = composer.resolve(Context);\n\n if (context && context !== this.context) {\n context.End();\n }\n }",
"function appEnding() {\n cleanUpEntities();\n if (coinSpawnTimeout){\n Script.clearTimeout(coinSpawnTimeout);\n coinSpawnTimeout = false;\n }\n if (octreeInterval){\n Script.clearInterval(octreeInterval);\n octreeInterval = false;\n }\n Messages.unsubscribe(MONEY_TREE_CHANNEL);\n Messages.unsubscribe(OPERATOR_CHANNEL);\n Messages.unsubscribe(GIVER_CHANNEL);\n Messages.unsubscribe(RECIPIENT_CHANNEL);\n Messages.messageReceived.disconnect(messageHandler);\n Messages.messageReceived.disconnect(messageHandlerOperator);\n Messages.messageReceived.disconnect(messageHandlerRecipient);\n Messages.messageReceived.disconnect(messageHandlerGiver);\n}",
"endSession() {\r\n this.endScript();\r\n this.cycler.endSession();\r\n }",
"destroy() {\n this.stop();\n\n // Remove listeners\n this.off('controlsMoveEnd', this._onControlsMoveEnd);\n\n var i;\n\n // Remove all controls\n var controls;\n for (i = this._controls.length - 1; i >= 0; i--) {\n controls = this._controls[0];\n this.removeControls(controls);\n controls.destroy();\n };\n\n // Remove all layers\n var layer;\n for (i = this._layers.length - 1; i >= 0; i--) {\n layer = this._layers[0];\n this.removeLayer(layer);\n layer.destroy();\n };\n\n // Environment layer is removed with the other layers\n this._environment = null;\n\n this._engine.destroy();\n this._engine = null;\n\n // Clean the container / remove the canvas\n while (this._container.firstChild) {\n this._container.removeChild(this._container.firstChild);\n }\n\n this._container = null;\n }",
"dispose() {\n this[$port].removeEventListener('message', this[$messageEventHandler]);\n this[$port].close();\n }"
] |
[
"0.61951625",
"0.6139838",
"0.6139838",
"0.60261166",
"0.6016587",
"0.60042286",
"0.5998117",
"0.5997658",
"0.5953353",
"0.594772",
"0.5934514",
"0.5889676",
"0.5885655",
"0.5883969",
"0.58755493",
"0.5869661",
"0.5844082",
"0.58144414",
"0.58104604",
"0.5806847",
"0.5805008",
"0.5780849",
"0.5771893",
"0.5767981",
"0.57568806",
"0.57536715",
"0.5751319",
"0.5723759",
"0.5716239",
"0.5715063"
] |
0.6300904
|
0
|
query search for treatments [autocomplete]
|
function treatmentQuerySearch() {
var tracker = $q.defer();
var results = (editMsVm.treatment.details ? editMsVm.treatments.filter(createFilterForTreatments(editMsVm.treatment.details)) : editMsVm.treatments);
return results;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function _search()\n {\n var allCategoryNames = [];\n // Incorporate all terms into\n var oepterms = $scope.selectedOepTerms ? $scope.selectedOepTerms : [];\n var situations = $scope.selectedSituations ? $scope.selectedSituations : [];\n var allCategories = oepterms.concat(situations);\n allCategories.forEach(function(categoryObj) {\n allCategoryNames.push(categoryObj.name);\n checkEmergencyTerms(categoryObj.name);\n });\n search.search({ category: allCategoryNames.join(',') });\n }",
"search(event){\n this.placeService.textSearch({\n query: `${event.target.value}`,\n type: 'airport'\n }, this.handleSuggestions);\n }",
"get materialSearch() {}",
"searchSuggest(query) {\r\n let finalQuery;\r\n if (typeof query === \"string\") {\r\n finalQuery = { querytext: query };\r\n }\r\n else {\r\n finalQuery = query;\r\n }\r\n return this.create(SearchSuggest).execute(finalQuery);\r\n }",
"function find() {\n\t\tvar query = $(\"#search-query\").val();\n\n\t\t// check to see if the query contains special commands/characters\n\t\tconvert(query);\n\t\t\n\n\t\tfindSimilar(query);\n\t}",
"function deptSearch() {\n connection.query(\n \"SELECT * FROM department\",\n function (err, res) {\n if (err) throw err\n console.table(res)\n beginTracker()\n }\n )\n}",
"function search() {\n console.log(\"search \", search);\n const ingredientsList = ingredients.join(\",\");\n const url = `http://localhost:8888/api?i=${ingredientsList}&q=${inputValue}&p=1`;\n axios\n .get(url)\n .then((res) => {\n console.log(\"res \", res);\n setResults(res.data.results);\n })\n .catch((err) => {\n console.log(\"err \", err);\n });\n }",
"function searchTerm(){\n \n }",
"function searchKeywords() {\n if(searchString.toLowerCase().includes('unit')) {\n if(searchString.toLowerCase().includes('1')) {\n searchBox.value = 'Javascript DOM JQuery CSS function html flexbox arrays';\n } if(searchString.toLowerCase().includes('2')) {\n searchBox.value = 'middleware node express authorization authentication psql ejs fetch api cookies';\n } if(searchString.toLowerCase().includes('3')) {\n searchBox.value = 'react authorization authentication psql git fetch tokens'\n } if(searchString.toLowerCase().includes('4')) {\n searchBox.value = 'ruby rails psql'\n }\n }\n}",
"function search(trm) {\n\n \tterm = trm;\n //re-extend the search results holder, to show the results to the user\n $('#search_results_holder').height(300);\n //use the httpget function to grab the custom google search\n //JSON DATA\n //var json_dta = httpGet('https://www.googleapis.com/customsearch/v1?key=AIzaSyDM8_gZ-5DQVcBUt1y7qq_wAjUDbr4YSTA&cx=009521426283403904660:drg6vvs6o2a&q=' + trm);\n add_results('https://www.googleapis.com/customsearch/v1?key=AIzaSyDM8_gZ-5DQVcBUt1y7qq_wAjUDbr4YSTA&cx=009521426283403904660:drg6vvs6o2a&q=' + trm);\n }",
"search() {\n return db.many(`\n SELECT *\n FROM parks p\n WHERE p.borough LIKE '%ook%'\n `);\n }",
"function querySearch(query) {\n var results = query ? self.lookups.Ingredients.filter(createFilterFor(query)) : self.lookups.Ingredients;\n return results;\n }",
"function createFilterByTreatment (query) {\n\n return function filterFn(personal) {\n if(personal)\n {\n var result = false;\n angular.forEach(personal.treatments, function(value, key){\n if (value.description.indexOf(query) === 0)\n {\n result = true;\n }\n }); \n return result; \n }\n };\n }",
"function manualSearch(e) {\n let term = document.querySelector(\"#searchTerm\").value;\n term = term.trim();\n if (term.length < 1) return;\n manualSearchData(term.toLowerCase());\n}",
"search() {\n this.send('searchWithParams', this.buildSearchQuery());\n }",
"function search() {\n let search_text = $search_text.value;\n decide_search(search_text)\n}",
"function search(_event) {\r\n let inputName = document.getElementById(\"searchname\");\r\n let inputMatrikel = document.getElementById(\"searchmatrikel\");\r\n let query = \"command=search\";\r\n query += \"&nameSearch=\" + inputName.value;\r\n query += \"&matrikelSearch=\" + inputMatrikel.value;\r\n console.log(query);\r\n sendRequest(query, handleSearchResponse);\r\n }",
"function querySearch(query) {\n return $scope.foods.filter(createFilterFor(query));\n }",
"function search() {\n\t\n}",
"function searchProduct(){\r\n \r\n var go = \"Thing(?i)\";\r\n \r\n submitProduct(go); \r\n \r\n }",
"function init_query () {\n window.search_terms = ['pancake']\n if ('q' in query_parameters) {\n if (!$('#q').val()) {\n $('#q').val(query_parameters['q'])\n }\n }\n var terms = $('#q').val().match(/\\w+|\"(?:\\\\\"|[^\"])+\"/g)\n if (terms && terms.length && terms[0].length) {\n window.search_terms = terms\n }\n}",
"search() {\n this.recipeService.filterRecipes(this.searchQuery, 'name')\n .then(res => this.hydrate = res)\n .catch(console.error);\n }",
"function search() {\n let input = getSearchCastInput();\n filterCast(input);\n}",
"function searchRecom() {\n\t// store keyword in localSession\n\twindow.localStorage.setItem('kw', keyWord);\n\t// Fuse options\t\t\t\t\n\tvar options = {\n\t\tshouldSort: true,\n\t\ttokenize: true,\n\t\tthreshold: 0.2,\n\t\tlocation: 0,\n\t\tdistance: 100,\n\t\tincludeScore: true,\n\t\tmaxPatternLength: 32,\n\t\tminMatchCharLength: 2,\n\t\tkeys: [\"title.recommendation_en\",\n\t\t\t \"title.title_recommendation_en\",\n\t\t\t \"topic.topic_en\"]\n\t};\n\t//Fuse search\n\tvar fuse = new Fuse(recommends, options); //https://fusejs.io/\n\tconst results = fuse.search(keyWord);\n\treturn results;\n}",
"function searchDriver() {\n const queries = [\n\t['bre'],\n\t['bread'],\n\t['break'],\n\t['piz'],\n\t['nach'],\n\t['garbage'],\n\n\t['bre', 'piz'],\n\t['bre', 'flour'],\n ];\n for( const q of queries ) {\n\tconsole.log( \"query=[%s]\", q.join(\", \") );\n\tsearchElements( q, recipeIndex );\n }\n}",
"function getResults() {\n var searchText = document.getElementById('search').value;\n \n odkData.query('pediatria', 'regdate = ?', [searchText], null, null, \n \t\tnull, null, null, null, true, cbSRSuccess, cbSRFailure);\n}",
"suggest(query){\n const that = this;\n let maxNumber = this.maxSuggestResults;\n const promises = [];\n promises.push(that.suggestTextQuery(query, maxNumber));\n Object.keys(that.suggestionIndexes).forEach(function(indexKey){\n const set = that.suggestionIndexes[indexKey];\n const intent = set.search(query, maxNumber);\n promises.push(intent);\n });\n const adapters = that.adapters;\n return Promise.all(promises).then(function(dataSets){\n let items = [];\n dataSets.forEach(function(dataSet){\n if (!dataSet || !dataSet.length)\n return ;\n items = items.concat(dataSet.items);\n })\n return new SearchCriteriaDataSet({\n adapters,\n items\n });\n });\n }",
"function handleSearchClick(){\r\n var temp = document.getElementById('searchText').value;\r\n fetchRecipesBySearch(temp);\r\n }",
"function search(term, force_search){\n var source = jQuery.extend(true, [], gon.source); // deep copy - we don't change the gon.source array\n force_search = force_search || false;\n\n // Search for booking id (actually tx id)\n if (term.indexOf(\"BID=\") === 0){\n searchTermOld = term;\n var booking_id = term.substr(4);\n search_for_id_update_gantt(booking_id, source);\n }\n else{\n search_booking_id = 0;\n\n // Show all devices again\n if (term.length < 3){\n term = \"\";\n if (searchTermOld !== term || force_search){\n searchTermOld = term;\n $('#poolTool_search').css(\"background-color\", \"white\");\n $('#poolTool_search').css(\"color\", \"black\");\n updateGanttChart(source);\n gon.search_source = source;\n search_update_booking_dialog();\n $('.home-fluid-thumbnail-grid-item').show();\n }\n }\n\n if (searchTermOld !== term || force_search){\n searchTermOld = term;\n\n search_update_gantt(term, source);\n search_update_booking_dialog();\n }\n }\n }",
"onSearch(value) {\n this.model.query = value;\n }"
] |
[
"0.6473379",
"0.6268314",
"0.61744547",
"0.6118348",
"0.6066907",
"0.6066789",
"0.60286826",
"0.5998705",
"0.597417",
"0.5948177",
"0.59417623",
"0.59346545",
"0.5902784",
"0.5893795",
"0.58632654",
"0.5860122",
"0.5858314",
"0.5842589",
"0.58420855",
"0.5838895",
"0.5833866",
"0.5833397",
"0.58305436",
"0.5828265",
"0.5801992",
"0.579846",
"0.57854164",
"0.57668835",
"0.5745441",
"0.5744828"
] |
0.7134493
|
0
|
repeats the given string string exactly n times.
|
function repeatStr (n, s) {
//input is a string
// output string n times
let repeat = s.repeat(n)
return repeat;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function repeatStringNTimes(string, repCount) {\n let result = string.repeat(repCount);\n console.log(result);\n}",
"function repeatStr(n, s) {\n let newString = \"\";\n for (i = 0; i < n; i++) {\n newString += s;\n }\n return newString;\n}",
"function repeatedString(string, n) {\n const numberOfAsInString = countFrom(string,string.length)\n const remainder = n % string.length\n const timesStringIsRepeated = Math.floor(n/string.length) \n const numberOfAsInStringRemainder = countFrom(string,remainder)\n return numberOfAsInString * timesStringIsRepeated + numberOfAsInStringRemainder;\n}",
"function repeat(str, n) {\r\n var strlen = str.length;\r\n var result = \"\";\r\n for (var i = 0; i < n; i++) {\r\n result += str[i % strlen];\r\n }\r\n return result;\r\n}",
"function repeatStr (n, s) {\n return s.repeat(n);\n}",
"function repeatStr (n, s) {\n return s.repeat(n);\n}",
"function repeatStr (n, s) {\n return s.repeat(n);\n}",
"static repeatString(string, n) {\n if (n === 0) { return ''; }\n\n let repeatedString = string;\n\n while (n && n > 0) {\n --n && (repeatedString += string);\n }\n\n return repeatedString;\n }",
"function repeatStr (n, s) {\n return s.repeat(n);\n}",
"function repeatNtimes(str, num) {\n\t//code here\n\tlet strg = \"\";\n\tlet i = 0;\n\twhile (i < num) {\n\t\tstrg += str;\n\t\ti++;\n\t}\n\treturn strg;\n}",
"function repeatedString(s, n) {\n let count = 0\n let newStr = ''\n const totalNumLoops = Math.floor(n/s.length);\n const remainder = n % s.length;\n let i;\n\n while(i < totalNumLoops) {\n newStr.concat(s);\n i++;\n }\n\n newStr.concat(s.slice[0, remainder + 1]);\n return newStr;\n}",
"function repeat(s, n) {\n\t\tvar res = '';\n\t\tfor(var i = 0; i < n; i++) {\n\t\t\tres += s;\n\t\t}\n\t\treturn res;\n\t}",
"function repeatStr (n, s) {\n\n return s.repeat(n);\n }",
"function repeatedString(s, n) {\n const repeats = n % s.length;\n const repeatMath = (n - repeats)/ s.length;\n let count = 0;\n\n for(let i = 0; i < s.length; i++) {\n if(s[i] === \"a\") {\n count += repeatMath + (i < repeats);\n }\n }\n return count;\n}",
"function repeatedString(s, n) {\n const repeats = n % s.length;\n const repeatMath = (n - repeats)/ s.length;\n let count = 0;\n\n for(let i = 0; i < s.length; i++) {\n if(s[i] === \"a\") {\n count += repeatMath + (i < repeats);\n }\n }\n return count;\n}",
"function repeat(s, n) {var a = []; while(a.length < n) {a.push(s);} return a.join('');}",
"function repeat(str, n){\n\t str = toString(str);\n\t return (new Array(n + 1)).join(str);\n }",
"function repeatedString(s, n) {\n //RangeError: Invalid string length if use .repeat() and input 1000000000000\n // s = s.repeat((n / s.length )) + subStr;\n // let subStr = s.slice(0, n % s.length);\n // s = s.repeat((n / s.length )) + subStr;\n // return (s.match(/a/g) || []).length;\n\n let aCount = (s.match(/a/g) || []).length * Math.floor(n / s.length),\n remainder = n % s.length,\n remainderACount = (s.slice(0, remainder).match(/a/g) || []).length;\n\n return aCount + remainderACount;\n}",
"function repeatStr (n, s) \n{\n\tvar str = \"\";\n\tfor(var i = 0; i<n; i++)\n\t{\n\t\tstr += s;\n\t}\n\n\treturn str;\n}",
"function repeatedString(s, n) {\n // Write your code here\n let fix = Math.floor(n / s.length);\n let count = countA(s) * fix;\n \n let leftOut = n % s.length;\n count = count + countA(s.substring(0,leftOut));\n return count;\n \n}",
"function repeatedString(s, n) {\n const sLength = s.length;\n const remainder = n % sLength;\n const times = (n - remainder) / sLength;\n let aCount = 0;\n let theRest = 0;\n for (let i = 0, j = 0; i < sLength; i += 1, j += 1) {\n const char = s.charAt(i);\n if (char === 'a') {\n aCount += 1;\n if (j < remainder) {\n theRest += 1;\n }\n }\n }\n return aCount * times + theRest;\n}",
"function repeatedString(s, n){\r\n var countA=s=>s.split('a').length-1;\r\n \r\n let len= s.length \r\n let fl=Math.floor(n/len);\r\n let remainder=s.slice(0,n%len);\r\n \r\n return fl*countA(s)+countA(remainder);\r\n }",
"function string_times(string, n){\n var newString = \"\";\n for(var i = 0; i < n; i++){\n newString += string;\n }\n return newString;\n}",
"function repeat(string, numberOfTimes) {\n var result = '';\n for (var i = 0; i < numberOfTimes; i++)\n result += string;\n return result;\n}",
"function repeatedString(s, n) {\n let counter = 0;\n for (let i = 0; i < s.length; i++) {\n if (s[i] === \"a\") {\n counter += 1;\n }\n }\n if (n % s.length === 0) {\n let multiplier = n / s.length;\n return counter * multiplier;\n } else {\n let remainder = n % s.length;\n let multiplier = Math.floor(n / s.length);\n let extra = 0;\n for (let j = 0; j < remainder; j++) {\n if (s[j] === \"a\") {\n extra += 1;\n }\n }\n return counter * multiplier + extra;\n }\n}",
"function repeatedString(s, n) {\n const length = s.length\n const times = Math.floor(n/length)\n const remain = n - times * length\n\n let as = 0\n for (let j = 0; j < s.length; j++) {\n if (s[j] === \"a\") {\n as++\n }\n }\n\n as *= times\n\n for (let i = 0; i < remain; i++) {\n if (s[i] === \"a\") {\n as++\n }\n }\n\n return as\n\n\n\n}",
"function strRepeat(n, str) {\n var ret = '';\n for (var i = 0; i < n; i++) {\n ret += str;\n }\n return ret;\n }",
"function stringRepeat (string, n) {\n\tvar result = '';\n\t\tfor(var i=0; i<n; i++) {\n\t\t\tresult += string;\n\t\t}\n\treturn result;\n}",
"function repeatedString(s, n) {\n if (s === 'a') { return n }\n const getAs = chars => chars.split('').filter(char => char === 'a').length;\n \n const completeS = Math.trunc(n / s.length);\n let totalA = getAs(s) * completeS;\n\n const partialS = n % s.length;\n totalA += getAs(s.slice(0, partialS));\n\n return totalA;\n}",
"function repeat(str, n){\n var result = '';\n str = toString(str);\n n = toInt(n);\n \n if (n < 1) {\n return '';\n }\n\n while (n > 0) {\n if (n % 2) {\n result += str;\n }\n n = Math.floor(n / 2);\n str += str;\n }\n return result;\n}"
] |
[
"0.85007757",
"0.8225302",
"0.8168625",
"0.8129868",
"0.81127983",
"0.81127983",
"0.81127983",
"0.810197",
"0.80864567",
"0.8082709",
"0.8057919",
"0.80425656",
"0.7984281",
"0.7947498",
"0.7947498",
"0.79459924",
"0.79293984",
"0.791726",
"0.79057306",
"0.7879492",
"0.78628856",
"0.78470284",
"0.78297013",
"0.7822442",
"0.7802626",
"0.77922887",
"0.7777218",
"0.7770706",
"0.7760095",
"0.77534163"
] |
0.8264229
|
1
|
Display data sex distribution per category
|
function sex_per_category(data) {
console.log(data);
const indexes = [];
const categories = [];
const males = [];
const females = [];
data.forEach(item => {
indexes.push(parseInt(item.index));
categories.push(item.category);
males.push(parseInt(item.sum_male));
females.push(parseInt(item.sum_female));
});
// X scales
let x_scale_sex_cat_band = d3.scaleBand()
.domain(categories)
.rangeRound([0, width_sex_cat])
.padding(0);
let x_scale_sex_cat_linear = d3.scaleLinear()
.domain([0, d3.max(data, d => d.index)])
.range([0, width_sex_cat]);
// Y scale
let y_scale_sex_cat = d3.scaleLinear()
.domain([0, Math.max(d3.max(males), d3.max(females))])
.range([height_sex_cat, 0]);
// Generate lines
let line_male_sex_cat = d3.line()
.x((d, i) => { return x_scale_sex_cat_linear(i); })
.y(d => { return y_scale_sex_cat(d.sum_male); })
.curve(d3.curveMonotoneX);
let line_female_sex_cat = d3.line()
.x((d, i) => { return x_scale_sex_cat_linear(i); })
.y(d => { return y_scale_sex_cat(d.sum_female); })
.curve(d3.curveMonotoneX);
// Append svg to the page
let svg_sex_cat = d3.select('#sex-per-category')
.append('svg')
.attr('width', width_sex_cat + margin_sex_cat.top + margin_sex_cat.bottom)
.attr('height', height_sex_cat + margin_sex_cat.left + margin_sex_cat.right)
.append('g')
.attr('class', 'sex-per-category--group');
// Call x axis
svg_sex_cat.append('g')
.attr('class', 'axis axis-x axis-categories')
.attr('transform', 'translate(' + (width_sex_cat/14 * -1) + ',' + height_sex_cat + ')')
.call(d3.axisBottom(x_scale_sex_cat_band));
// svg_sex_cat.append('g')
// .attr('class', 'axis axis-x')
// .attr('transform', 'translate(0,' + height_sex_cat + ')')
// .call(d3.axisBottom(x_scale_sex_cat_linear));
// Append path, bind data and call line generator for Males
svg_sex_cat.append('path')
.datum(data)
.attr('class', 'line line-male')
.attr('d', line_male_sex_cat);
svg_sex_cat.append('path')
.datum(data)
.attr('class', 'line line-female')
.attr('d', line_female_sex_cat);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function viewSexTrade() {\n var color = d3.scale.linear()\n .range([\"#fee5d9\", \"#fcbba1\", \"#fc9272\", \"#fb6a4a\", \"#de2d26\", \"#99000d\"]);\n\n var val1 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.sexTotal, b.value.sexTotal); })\n // take the first option\n [0];\n\n var val2 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.sexTotal, b.value.sexTotal); })\n // take the first option\n [5];\n\n var val3 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.sexTotal, b.value.sexTotal); })\n // take the first option\n [22];\n\n var val4 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.sexTotal, b.value.sexTotal); })\n // take the first option\n [37];\n\n var val5 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.sexTotal, b.value.sexTotal); })\n // take the first option\n [48];\n\n var val6 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.sexTotal, b.value.sexTotal); })\n // take the first option\n [50];\n\n color.domain([\n val1.value.sexTotal,\n val2.value.sexTotal,\n val3.value.sexTotal,\n val4.value.sexTotal,\n val5.value.sexTotal,\n val6.value.sexTotal\n ]);\n\n var keys = Object.keys(data);\n /* Interpolate color according to the numbers of tracking crime reported*/\n keys.forEach(function(d){\n data[d].color = color(data[d].sexTotal);\n /*data[d].color = d3.interpolate(\"#fee5d9\", \"#99000d\")((data[d].sexTotal)/30);\n console.log(data[d].color);*/\n });\n /* draw states on id #statesvg */\n var svg = uStates.draw(\"#statesvg\", data, tooltipHtmlSex, \"sexTotal\");\n}",
"function gender_selector(ndx) {\n var genderDim = ndx.dimension(dc.pluck('sex'));\n var genderGroup = genderDim.group();\n\n dc.selectMenu('#genderPercent')\n .dimension(genderDim)\n .group(genderGroup);\n}",
"function showCategoryTitles() {\n\t\tvar categoryData = d3.keys(categoryTitleX);\n\t\tvar categories = svg.selectAll(\".category\")\n\t\t.data(categoryData);\n\n\t\tcategories.enter()\n\t\t.append(\"text\")\n\t\t.attr(\"class\", \"category\")\n\t\t.attr(\"x\", function(d) { return categoryTitleX[d]; })\n .attr(\"y\", 40)\n\t\t.attr(\"text-anchor\", \"middle\")\n\t\t.text(function(d) { return d; });\n\t}",
"function viewSexTradeF() {\n var color = d3.scale.linear()\n .range([\"#fee5d9\", \"#fcbba1\", \"#fc9272\", \"#fb6a4a\", \"#de2d26\", \"#99000d\"]);\n\n var val1 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.femalesSex, b.value.femalesSex); })\n // take the first option\n [0];\n\n var val2 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.femalesSex, b.value.femalesSex); })\n // take the first option\n [5];\n\n var val3 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.femalesSex, b.value.femalesSex); })\n // take the first option\n [22];\n\n var val4 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.femalesSex, b.value.femalesSex); })\n // take the first option\n [37];\n\n var val5 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.femalesSex, b.value.femalesSex); })\n // take the first option\n [48];\n\n var val6 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.femalesSex, b.value.femalesSex); })\n // take the first option\n [50];\n\n color.domain([\n val1.value.femalesSex,\n val2.value.femalesSex,\n val3.value.femalesSex,\n val4.value.femalesSex,\n val5.value.femalesSex,\n val6.value.femalesSex\n ]);\n\n var keys = Object.keys(data);\n /* Interpolate color according to the numbers of tracking crime reported*/\n keys.forEach(function(d){\n data[d].color = color(data[d].femalesSex);\n /*data[d].color = d3.interpolate(\"#fee5d9\", \"#99000d\")((data[d].femalesSex)/30);\n console.log(data[d].color);*/\n });\n /* draw states on id #statesvg */\n var svg = uStates.draw(\"#statesvg\", data, tooltipHtmlSex, \"femalesSex\");\n}",
"function viewSexTradeM() {\n var color = d3.scale.linear()\n .range([\"#fee5d9\", \"#fcbba1\", \"#fc9272\", \"#fb6a4a\", \"#de2d26\", \"#99000d\"]);\n\n var val1 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.malesSex, b.value.malesSex); })\n // take the first option\n [0];\n\n var val2 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.malesSex, b.value.malesSex); })\n // take the first option\n [5];\n\n var val3 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.malesSex, b.value.malesSex); })\n // take the first option\n [22];\n\n var val4 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.malesSex, b.value.malesSex); })\n // take the first option\n [37];\n\n var val5 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.malesSex, b.value.malesSex); })\n // take the first option\n [48];\n\n var val6 = d3.entries(data)\n // sort by value descending\n .sort(function(a, b) { return d3.ascending(a.value.malesSex, b.value.malesSex); })\n // take the first option\n [50];\n\n color.domain([\n val1.value.malesSex,\n val2.value.malesSex,\n val3.value.malesSex,\n val4.value.malesSex,\n val5.value.malesSex,\n val6.value.malesSex\n ]);\n\n var keys = Object.keys(data);\n /* Interpolate color according to the numbers of tracking crime reported*/\n keys.forEach(function(d){\n data[d].color = color(data[d].malesSex);\n /*data[d].color = d3.interpolate(\"#fee5d9\", \"#99000d\")((data[d].malesSex)/30);\n console.log(data[d].color);*/\n });\n /* draw states on id #statesvg */\n var svg = uStates.draw(\"#statesvg\", data, tooltipHtmlSex, \"malesSex\");\n}",
"function showMale() {\n let bigList = document.getElementById(\"bigList\");\n for (var i = 0; i < data.length; i++) {\n \n if (data[i].constructor.name == \"Male\") {\n bigList.innerHTML += data[i].render();\n }\n }\n}",
"function showFemale() {\n let bigList = document.getElementById(\"bigList\");\n for (var i = 0; i < data.length; i++) {\n \n if (data[i].constructor.name == \"Female\") {\n bigList.innerHTML += data[i].render();\n } \n }\n}",
"function categorify(cat) {\n var ret;\n if(typeof cat == \"string\")\n ret = cat\n ;\n else ret = d3.entries(cat) // Overview pseudo-phase\n .filter(function(e) { return e.value === \"Yes\"; })\n .map(function(k) { return k.key.trim(); })\n [0]\n ;\n return ret || \"Not Applicable\";\n } // categorify()",
"function sexValues(sex) {\n fetch(`/api/sex-graph/${sex}`, {\n method: \"GET\",\n headers: { \"Content-Type\": \"application/json\" },\n })\n .then(function (sexInput) {\n return sexInput.json();\n })\n .then(function (sexInput) {\n let yModerna = Object.values(sexInput[0]);\n yModerna.pop();\n yModerna = yModerna.map(Number);\n let yPfizer = Object.values(sexInput[1]);\n yPfizer.pop();\n yPfizer = yPfizer.map(Number);\n let yjandj = Object.values(sexInput[2]);\n yjandj.pop();\n yjandj = yjandj.map(Number);\n drawGraph(yModerna, yPfizer, yjandj);\n });\n }",
"function show_rank_distribution(ndx) {\n\n var dim = ndx.dimension(dc.pluck('sex'));\n\n // step 5-3 the group is the place when the things are getting tricky\n //what percentage of men are professors, assistant professor and asociate professor\n\n // custom reducer written specifically for professors:\n var profByGender = dim.group().reduce(\n function (p, v) {\n p.total++;\n if (v.rank == \"Prof\") {\n p.match++;\n }\n return p;\n },\n function (p, v) {\n p.total--;\n if (v.rank == \"Prof\") {\n p.match--;\n }\n return p;\n },\n function () {\n return { total: 0, match: 0 };\n }\n );\n\n\n // 5-5 let's create the function rank_by_gender:\n function rankByGender(dimension, rank) {\n //as return we copy profByGender from 5-3 and replace Prof with rank variable\n // and dim is dimension:\n return dimension.group().reduce(\n function (p, v) {\n p.total++;\n if (v.rank == rank) {\n p.match++;\n }\n return p;\n },\n function (p, v) {\n p.total--;\n if (v.rank == rank) {\n p.match--;\n }\n return p;\n },\n function () {\n return { total: 0, match: 0 };\n }\n );\n }\n\n // 5-4 we can do the same as above IN 5-3 for assistant professor and we'll have basically the same code\n //but the code is so similar that it's a better way to deal with it.\n // instead of duplicating all the data, let's create a function rank_by_gender see above 5-5:\n\n var professor = rankByGender(dim, \"Prof\");\n var asstProfByGender = rankByGender(dim, \"AsstProf\");\n var assocProfByGender = rankByGender(dim, \"AssocProf\");\n\n //console.log(profByGender.all());\n\n dc.barChart(\"#rank-distribution\")\n .width(350)\n .height(250)\n // var dim is set in a normal way\n .dimension(dim)\n // main group prof group and we stack assitant and associate prof on it:\n .group(profByGender, \"Prof\")\n .stack(asstProfByGender, \"Asst Prof\")\n .stack(assocProfByGender, \"Assoc Prof\")\n\n // because we use reduce function we have to use valueAccessor and indicate\n //which value we want to see\n .valueAccessor(function (d) {\n if (d.value.total > 0) {\n return (d.value.match / d.value.total) * 100;\n }\n else {\n return 0;\n }\n })\n // animation\n .transitionDuration(500)\n // ordinal scale because we don't have numbers only male or female;\n .x(d3.scale.ordinal())\n .xUnits(dc.units.ordinal)\n .legend(dc.legend().x(320).y(20).itemHeight(15).gap(5))\n .margins({ top: 10, right: 100, bottom: 30, left: 50 })\n\n .xAxisLabel(\"Gender\")\n .yAxis().ticks(4);\n}",
"function dessinerGrapheSexAndAge (arr) {\n \n sexAndAgeChart = c3.generate({\n bindto: '#saddBarchart',\n size: {height: chartsHeight},\n padding: {top: 10},\n title: {\n text: 'Sex-disaggregated data along the COVID-19 clinical pathway',\n position: titlePosition\n },\n data: {\n x: 'x',\n columns: [xAxis, sexAndAgeDataArrMen, sexAndAgeDataArrWomen],\n type: 'bar'\n },\n color: {\n pattern: [colorMen, colorWomen]\n },\n axis: {\n x: {\n type: 'category',\n tick: {\n outer: false\n }\n },\n y:{\n max: 90,\n tick: {\n format: d3.format('d'),\n count: 5,\n outer: false\n }\n }\n },\n grid: {\n y: {\n show: true\n }\n },\n bar: {\n width: {\n ratio: 0.5 // this makes bar width 50% of length between ticks\n }\n },\n tooltip:{\n format: {\n value: function(value){\n return value + \" %\";\n }\n }\n }\n });\n\n }//dessinerGrapheSexAndAge",
"function chooseCategory(){\n var cat = document.getElementById(\"mySelect-viz3\").value;\n if (cat==\"age\"&&!by_1000) {\n plot_viz3(str_age);\n svg.selectAll(\"*\").remove();\n }else if (cat==\"sex\"&&!by_1000) {\n plot_viz3(str_gender);\n svg.selectAll(\"*\").remove();\n }\n else if (cat==\"continent\"&&!by_1000){\n plot_viz3(str_cont);\n svg.selectAll(\"*\").remove();\n } else if (cat==\"age\"&&by_1000) {\n plot_viz3(str_age_1000);\n svg.selectAll(\"*\").remove();\n }else if (cat==\"sex\"&&by_1000) {\n plot_viz3(str_gender_1000);\n svg.selectAll(\"*\").remove();\n }\n else if (cat==\"continent\"&&by_1000){\n plot_viz3(str_cont_1000);\n svg.selectAll(\"*\").remove();\n }\n}",
"function showYearTitles() {\n // Another way to do this would be to create\n // the year texts once and then just hide them.\n var yearsData = d3.keys(yearsTitleX);\n var years = svg.selectAll('.year')\n .data(yearsData);\n\n years.enter().append('text')\n .attr('class', 'year')\n .attr('x', function(d) {\n return yearsTitleX[d];\n })\n\n .attr('y', 140)\n .attr('text-anchor', 'middle')\n .text(function(d) {\n return d;\n });\n\n var category = svg.selectAll('.safetynum')\n .data(safetynumdata);\n\n category.enter().append('text')\n .attr('class', 'safetynum')\n .attr('x', function(d) {\n return d.x;\n })\n .attr('y', function(d) {\n return d.y;\n })\n .attr('text-anchor', 'middle')\n\n .each(function(d) {\n var arr = d.label.split(\" \");\n for (i = 0; i < arr.length; i++) {\n d3.select(this).append(\"tspan\")\n .text(arr[i])\n .attr(\"dy\", i ? \"1.2em\" : 0)\n .attr(\"x\", d.x)\n .attr(\"text-anchor\", \"middle\")\n .attr(\"class\", \"tspan\" + i);\n }\n\n });\n }",
"function showDtypes() {\n // Another way to do this would be to create\n // the year texts once and then just hide them.\n var dtypesData = d3.keys(dtypesTitleX);\n var dtypes = svg.selectAll('.dtype')\n .data(dtypesData);\n\n dtypes.enter().append('text')\n .attr('class', 'dtype')\n .attr('x', function (d) { return dtypesTitleX[d]; })\n .attr('y', 40)\n .attr('text-anchor', 'middle')\n .text(function (d) { return d; });\n }",
"function chartGender(deathDetails) {\n\n var margin = {\n left: 10\n };\n\n sexChart.attr('transform', 'translate(' + 750 + ',' + 400 + ')');\n\n var maleCount = 0;\n var femaleCount = 0;\n for (var a = 0; a < deathDetails.length; a++) {\n if (deathDetails[a].gender === \"1\") {\n maleCount++;\n } else if (deathDetails[a].gender === \"0\") {\n femaleCount++;\n }\n }\n\n var maxCount = 290;\n maxCount = d3.max([maleCount, femaleCount]);\n var barxScale = d3.scale.ordinal();\n var baryScale = d3.scale.linear();\n\n barxScale.domain([\"Male\", \"Female\"]).range([0, 50]);\n baryScale.domain([0, maxCount]).range([200, 0]);\n\n\n var barxAxis = d3.svg.axis()\n .scale(barxScale)\n .orient('bottom');\n\n var baryAxis = d3.svg.axis()\n .scale(baryScale)\n .orient('left');\n\n sexChart.append('g')\n .attr('class', 'axis')\n .attr(\"transform\", \"translate(\" + margin.left + \",\" + (200) + \")\")\n .call(barxAxis);\n\n sexChart.append('g')\n .attr('class', 'axis')\n .call(baryAxis);\n\n sexChart.selectAll(\"rect\")\n .data([maleCount, femaleCount])\n .enter()\n .append(\"rect\")\n .attr(\"x\", function (d, i) {\n return barxScale(i);\n })\n .attr(\"y\", function (d) {\n return baryScale(d);\n })\n .attr(\"width\", 20)\n .attr(\"fill\", function (d, i) {\n if (i === 0) {\n return \"purple\";\n } else if (i === 1) {\n return \"coral\";\n }\n })\n .attr(\"height\", function (d, i) {\n return (baryScale(0) - baryScale(d));\n })\n .attr(\"stroke\", \"black\")\n .attr(\"class\", \"bar\");\n\n\n sexChart.append('text')\n .text(\"Deaths\")\n .style('font-size', '11px')\n .style('font-weight', 'bold')\n .attr('transform', 'translate(' + \"-35\" + ',' + 120 + ') rotate(' + 270 + ')');\n\n}",
"function show_phd_to_salary_correlation(ndx) {\n\n var genderColors = d3.scale.ordinal()\n .domain([\"Female\", \"Male\"])\n .range([\"pink\", \"blue\"]);\n\n var pDim = ndx.dimension(dc.pluck(\"yrs_since_phd\"));\n var phdDim = ndx.dimension(function (d) {\n return [d.yrs_since_phd, d.salary, d.rank, d.sex];\n });\n\n var phdSalaryGroup = phdDim.group();\n\n var minPhd = pDim.bottom(1)[0].yrs_since_phd;\n var maxPhd = pDim.top(1)[0].yrs_since_phd;\n\n dc.scatterPlot(\"#phd-salary\")\n .width(800)\n .height(400)\n .x(d3.scale.linear().domain([minPhd, maxPhd]))\n .brushOn(false)\n .symbolSize(8)\n .clipPadding(10)\n .yAxisLabel(\"Salary\")\n .xAxisLabel(\"Years Since PhD\")\n .title(function (d) {\n return d.key[2] + \" earned\" + d.key[1];\n })\n .colorAccessor(function (d) {\n return d.key[3];\n })\n .colors(genderColors)\n .dimension(phdDim)\n .group(phdSalaryGroup)\n .margins({ top: 10, right: 50, bottom: 75, left: 75 });\n}",
"function show_service_to_salary_correlation(ndx) {\n\n // 7-4-1 colors: we need to pick one of the attributes in our data\n //set and map the values in that attribute to the colors that we want\n // we choose gender: \n var genderColors = d3.scale.ordinal()\n .domain([\"Female\", \"Male\"])\n .range([\"pink\", \"blue\"]);\n\n // 7-2 we have to create 2 dimensions\n //first years of service x- axis(min and max years of service)\n var eDim = ndx.dimension(dc.pluck(\"yrs_service\"));\n // second dim function containg 2 pieces of information to plot the dots\n // yrs.service x-coordinate, salary y-coordinate\n var experienceDim = ndx.dimension(function (d) {\n //7-4-2 we have to add the value to pick the color\n // we are adding two here rank and sex\n //but we need only sex - see video explanation\n return [d.yrs_service, d.salary, d.rank, d.sex];\n });\n //creating a group:\n var experienceSalaryGroup = experienceDim.group();\n\n //creating dots on a scatter plot:\n var minExperience = eDim.bottom(1)[0].yrs_service;\n var maxExperience = eDim.top(1)[0].yrs_service;\n\n //create scatter plot:\n dc.scatterPlot(\"#service-salary\")\n .width(800)\n .height(400)\n .x(d3.scale.linear().domain([minExperience, maxExperience]))\n //play with brushOn false/true to see what happens with the graph:\n .brushOn(false)\n //size of the dots:\n .symbolSize(8)\n //leaves room at the top\n .clipPadding(10)\n .yAxisLabel(\"Salary\")\n .xAxisLabel(\"Years Of Service\")\n //what will appear if you hover the mouse over the dot:\n .title(function (d) {\n //d.key[1] see varexpericneDim = d.salary\n //7-4-4 we allso modify titel and adding rank\n return d.key[2] + \" earned\" + d.key[1];\n })\n //7-4-4 we need to add color accessor from var experienceDim\n // sex is array 3\n .colorAccessor(function (d) {\n return d.key[3];\n })\n //7-4-2 adding colors from 7-4-1 to our graph:\n .colors(genderColors)\n .dimension(experienceDim)\n .group(experienceSalaryGroup)\n .margins({ top: 10, right: 50, bottom: 75, left: 75 });\n}",
"function demographics(selector) {\n var filter1 = data.metadata.filter(value => value.id == selector);\n var div = d3.select(\".panel-body\")\n div.html(\"\");\n div.append(\"p\").text(`ID: ${filter1[0].id}`)\n div.append(\"p\").text(`ETHNICITY: ${filter1[0].ethnicity}`)\n div.append(\"p\").text(`GENDER: ${filter1[0].gender}`)\n div.append(\"p\").text(`AGE: ${filter1[0].age}`)\n div.append(\"p\").text(`LOCATION: ${filter1[0].location}`)\n div.append(\"p\").text(`BELLY BUTTON TYPE: ${filter1[0].bbtype}`)\n div.append(\"p\").text(`WASHING FREQUENCY: ${filter1[0].wfreq}`)\n \n}",
"function statistic() {\n let statistic = {\n female: 0,\n male: 0,\n wood: 0,\n woodFem: 0,\n woodMale: 0,\n steel: 0,\n steelFem: 0,\n steelMale: 0,\n spirit: 0,\n spiritFem: 0,\n spiritMale: 0,\n water: 0,\n waterFem: 0,\n waterMale: 0,\n waterIce: 0,\n waterIceFem: 0,\n waterIceMale: 0,\n waterLiquid: 0,\n waterLiquidFem: 0,\n waterLiquidMale: 0,\n waterSream: 0,\n waterSreamFem: 0,\n waterSreamMale: 0,\n };\n {\n allCreatures.forEach((allCreat) => {\n // go through all the creatures of the main array of creatures\n if (allCreat.gender == \"женщина\") { //\"female\"\n statistic.female++; // counter female\n } else {\n statistic.male++; // counter male\n }\n switch (allCreat.CreaturesType) {\n case \"Дерево\" :// \"wood\"\n {\n statistic.wood++; // counter type of Wood (& female, & male)\n if (allCreat.gender == \"женщина\") { // \"female\"\n statistic.woodFem++;\n } else {\n statistic.woodMale++;\n }\n }\n break;\n case \"Сталь\": // steel\n {\n statistic.steel++; // counter type of Steel (& female, & male)\n if (allCreat.gender == \"женщина\") { // \"female\"\n statistic.steelFem++;\n } else {\n statistic.steelMale++;\n }\n }\n break;\n case \"Дух\": // spirit\n {\n statistic.spirit++; // counter type of spirit (& female, & male)\n if (allCreat.gender == \"женщина\") { // \"female\"\n statistic.spiritFem++;\n } else {\n statistic.spiritMale++;\n }\n }\n break;\n case \"Вода\": // water\n {\n statistic.water++; // counter type of Water (& female, & male)\n if (allCreat.gender == \"женщина\") { // \"female\"\n statistic.waterFem++;\n } else {\n statistic.waterMale++;\n }\n switch (allCreat.subType) {\n case \"Лед\": // ice\n {\n statistic.waterIce++; // counter subType of waterIce (& female, & male)\n if (allCreat.gender == \"женщина\") { // \"female\"\n statistic.waterIceFem++;\n } else {\n statistic.waterIceMale++;\n }\n }\n break;\n case \"Жидкость\": // liquid\n {\n statistic.waterLiquid++; // counter subType of liquid (& female, & male)\n if (allCreat.gender == \"женщина\") { // \"female\"\n statistic.waterLiquidFem++;\n } else {\n statistic.waterLiquidMale++;\n }\n }\n break;\n case \"Пар\": // sream\n {\n statistic.waterSream++; // counter subType of waterSream (& female, & male)\n if (allCreat.gender == \"женщина\") { // \"female\"\n statistic.waterSreamFem++;\n } else {\n statistic.waterSreamMale++;\n }\n }\n break;\n }\n }\n break;\n }\n });\n let doStat = 0; // Label for nullified array of statistic =0\n if (labelZeroingType.wood == 1 && statistic.wood == 0) {\n // track the moment of zeroing the number of some kind of creatures for an extraordinary output of statistical data\n labelZeroingType.wood = 0; // for Wood-type Label for nullified\n doStat = 1; // label for ivent\n }\n if (labelZeroingType.steel == 1 && statistic.steel == 0) {\n labelZeroingType.steel = 0; // for Steel-type Label for nullified\n doStat = 1;\n }\n if (labelZeroingType.spirit == 1 && statistic.spirit == 0) {\n // for Spitit-type Label for nullified\n labelZeroingType.spirit = 0;\n doStat = 1;\n }\n if (labelZeroingType.water == 1 && statistic.water == 0) {\n // for Water-type Label for nullified\n labelZeroingType.water = 0;\n doStat = 1;\n }\n\n if (LogSwitch.StatEvery5genOrZeroing != false) {\n // --> Write statistic every 5-th generation & statistic when zeroing amount of any type of creatures\n if (generation % 5 == 0 || doStat == 1) logstat(statistic);\n } else {\n // otherwise --> Write all statistics every time.\n logstat(statistic);\n }\n // todo> Result print to console --> Look 6.logstat(s)\n }\n}",
"function categories() {\n // assign categories object to a variable\n var categories = memory.categories;\n // loop through categories\n for (category in categories) {\n // call categories render method\n memory.categories[category].render();\n //console.log(memory);\n }\n }",
"function ready(error, data, cats) {\n // Logs any error to the console\n if (error) {\n return console.warn(error);\n }\n\n v.DEATH_CATS = cats;\n v.DATA = data;\n console.log('Main Data Object:');\n console.log(data);\n\n // get an array of all the age groups\n v.AGE_GRPS = d3.nest()\n .key(function(d) { return d.death_age; })\n .entries(data)\n .map(function(d) { return d.key; });\n\n var chartData = v.stackData(data, 'h_cat');\n console.log(chartData);\n\n\n // calculate age grp death totals\n // for normalising functions (All, Males, Females)\n v.DEATH_TOTALS.None = sumStackedData(chartData);\n v.DEATH_TOTALS.M = sumStackedData(v.stackData(v.filterData(v.DATA, 'gender', 'M'), 'h_cat'));\n v.DEATH_TOTALS.F = sumStackedData(v.stackData(v.filterData(v.DATA, 'gender', 'F'), 'h_cat'));\n\n\n\n chartData = v.normaliseStackedData(chartData);\n v.initViz(chartData);\n }",
"function addScatterPlotDetailed(fetch_data_array){\r\n\t\r\nvar margin = {top: 20, right: 20, bottom: 30, left: 80},\r\n width = 1200 - margin.left - margin.right,\r\n height = 1800 - margin.top - margin.bottom;\r\n\r\n/* \r\n * value accessor - returns the value to encode for a given data object.\r\n * scale - maps value to a visual display encoding, such as a pixel position.\r\n * map function - maps from data value to display value\r\n * axis - sets up axis\r\n */\r\n\r\n\r\n\r\n// setup x \r\nvar xValue = function(d) { return d.male;}, // data -> value\r\n xScale = d3.scale.linear().range([0, width]), // value -> display\r\n xMap = function(d) { return xScale(xValue(d));}, // data -> display\r\n xAxis = d3.svg.axis().scale(xScale).orient(\"bottom\");\r\n\t\r\n// setup y\r\nvar yValue = function(d) { return d.female;}, // data -> value\r\n yScale = d3.scale.linear().range([height, 0]), // value -> display\r\n yMap = function(d) { return yScale(yValue(d));}, // data -> display\r\n yAxis = d3.svg.axis().scale(yScale).orient(\"left\");\r\n\t\r\n\t// setup fill color\r\nvar cValue = function(d) { return d.cancertypedetailed;},\r\n color = d3.scale.category10();\r\n\t\r\n// add the graph canvas to the body of the webpage\r\n\r\nvar svg = d3.select(\"body\").append(\"svg\")\r\n .attr(\"width\", width + margin.left + margin.right)\r\n .attr(\"height\", height + margin.top + margin.bottom)\r\n .append(\"g\")\r\n .attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\r\n\t\r\n\r\n\t// add the tooltip area to the webpage\r\nvar tooltip = d3.select(\"body\").append(\"div\")\r\n .attr(\"class\", \"tooltip\")\r\n .style(\"opacity\", 0);\r\n\r\n fetch_data_array.forEach(function(d) {\r\n\td.male = +d.male;\r\n d.female = +d.female;\r\n\t\r\n});\r\n\r\n\r\n // don't want dots overlapping axis, so add in buffer to data domain\r\n xScale.domain([d3.min(fetch_data_array, xValue)-1, d3.max(fetch_data_array, xValue)+1]);\r\n yScale.domain([d3.min(fetch_data_array, yValue)-1, d3.max(fetch_data_array, yValue)+1]); \r\n\r\n // x-axis\r\n svg.append(\"g\")\r\n .attr(\"class\", \"x axis\")\r\n .attr(\"transform\", \"translate(0,\" + height + \")\")\r\n .call(xAxis)\r\n .append(\"text\")\r\n .attr(\"class\", \"label\")\r\n .attr(\"x\", width)\r\n .attr(\"y\", -6)\r\n .style(\"text-anchor\", \"end\")\r\n .text(\"Male Count\");\r\n\t \r\n\t // y-axis\r\n svg.append(\"g\")\r\n .attr(\"class\", \"y axis\")\r\n .call(yAxis)\r\n .append(\"text\")\r\n .attr(\"class\", \"label\")\r\n .attr(\"transform\", \"rotate(-90)\")\r\n .attr(\"y\", 66)\r\n .attr(\"dy\", \".71em\")\r\n .style(\"text-anchor\", \"end\")\r\n .text(\"Female Count\");\r\n \r\n// draw dots\r\n svg.selectAll(\".dot\")\r\n .data(fetch_data_array)\r\n .enter().append(\"circle\")\r\n .attr(\"class\", \"dot\")\r\n .attr(\"r\", 6.5)\r\n .attr(\"cx\", xMap)\r\n .attr(\"cy\", yMap)\r\n .style(\"fill\", function(d) { return color(cValue(d));}) \r\n .on(\"mouseover\", function(d) {\r\n tooltip.transition()\r\n .duration(200)\r\n .style(\"opacity\", .9);\r\n tooltip.html(d[\"cancertypedetailed\"] + \"<br/> (\" + xValue(d) \r\n\t + \", \" + yValue(d) + \")\")\r\n .style(\"left\", (d3.event.pageX + 5) + \"px\")\r\n .style(\"top\", (d3.event.pageY - 28) + \"px\");\r\n })\r\n .on(\"mouseout\", function(d) {\r\n tooltip.transition()\r\n .duration(500)\r\n .style(\"opacity\", 0);\r\n });\r\n\r\n// draw legend\r\n var legend = svg.selectAll(\".legend\")\r\n .data(color.domain())\r\n .enter().append(\"g\")\r\n .attr(\"class\", \"legend\")\r\n .attr(\"transform\", function(d, i) { return \"translate(0,\" + i * 20 + \")\"; }); \r\n\r\n // draw legend colored rectangles\r\n legend.append(\"rect\")\r\n .attr(\"x\", width - 18)\r\n .attr(\"width\", 18)\r\n .attr(\"height\", 18)\r\n .style(\"fill\", color); \r\n\t \r\n\t \r\n\r\n // draw legend text\r\n legend.append(\"text\")\r\n .attr(\"x\", width - 24)\r\n .attr(\"y\", 9)\r\n .attr(\"dy\", \".35em\")\r\n .style(\"text-anchor\", \"end\")\r\n .text(function(d) { return d;}) \r\n\t \r\n\t//d3.select(\"svg\").remove();\r\n\r\n}",
"function getCasualitiesByGender(data, gender) {\n\treturn data.filter(p => p.fields.sex === gender && p.fields.survived === 'No').length\n}",
"showSevCatStats() {\n const stats = this.sevcatStats;\n const systems = {};\n for (let severity in stats) {\n for (let category in stats[severity]) {\n for (let system in stats[severity][category]) {\n if (!systems[system]) systems[system] = 0;\n systems[system] += stats[severity][category][system];\n }\n }\n }\n const systemsList = Object.keys(systems);\n const colspan = systemsList.length || 1;\n const th = document.getElementById('marot-sevcat-stats-th');\n th.colSpan = colspan;\n\n systemsList.sort((sys1, sys2) => systems[sys2] - systems[sys1]);\n\n let rowHTML = '<tr><td></td><td></td><td></td>';\n for (const system of systemsList) {\n rowHTML += `<td><b>${system == this.TOTAL ? 'Total' : system}</b></td>`;\n }\n rowHTML += '</tr>\\n';\n this.sevcatStatsTable.insertAdjacentHTML('beforeend', rowHTML);\n\n const sevKeys = Object.keys(stats);\n sevKeys.sort();\n for (const severity of sevKeys) {\n this.sevcatStatsTable.insertAdjacentHTML(\n 'beforeend', `<tr><td colspan=\"${3 + colspan}\"><hr></td></tr>`);\n const sevStats = stats[severity];\n const catKeys = Object.keys(sevStats);\n catKeys.sort(\n (k1, k2) => sevStats[k2][this.TOTAL] - sevStats[k1][this.TOTAL]);\n for (const category of catKeys) {\n const row = sevStats[category];\n let rowHTML = `<tr><td>${severity}</td><td>${category}</td><td></td>`;\n for (const system of systemsList) {\n const val = row.hasOwnProperty(system) ? row[system] : '';\n rowHTML += `<td>${val ? val : ''}</td>`;\n }\n rowHTML += '</tr>\\n';\n this.sevcatStatsTable.insertAdjacentHTML('beforeend', rowHTML);\n }\n }\n }",
"function fillDataArraysFemaleMale(input, group, d) {\r\n dataFemale[input] = roundToTenth(d.female[group]);\r\n dataMale[input] = roundToTenth(d.male[group]);\r\n}",
"function show_average_salary(ndx) {\n var dim = ndx.dimension(dc.pluck('sex'));\n\n function add_item(p, v) {\n p.count++;\n p.total += v.salary;\n p.average = p.total / p.count;\n return p;\n }\n\n function remove_item(p, v) {\n p.count--;\n if (p.count == 0) {\n p.total = 0;\n p.average = 0;\n } else {\n p.total -= v.salary;\n p.average = p.total / p.count;\n }\n return p;\n }\n\n function initialise() {\n return { count: 0, total: 0, average: 0 };\n }\n\n var averageSalaryByGender = dim.group().reduce(add_item, remove_item, initialise);\n\n // step 4 plot barchart:\n\n dc.barChart(\"#average-salary\")\n .width(350)\n .height(250)\n .margins({ top: 10, right: 50, bottom: 30, left: 50 })\n // var dim\n .dimension(dim)\n // var averageSalaryByGender is our group\n .group(averageSalaryByGender)\n\n // because we use reduce function we have to use valueAccessor and indicate\n //which value we want to see, in this case average (function initialise)\n //add toFixed(2) to reduce number of decimals:\n .valueAccessor(function (d) {\n return d.value.average.toFixed(2);\n })\n // animation\n .transitionDuration(500)\n // ordinal scale because we don't have numbers only male or female;\n .x(d3.scale.ordinal())\n .xUnits(dc.units.ordinal)\n\n .elasticY(true)\n\n .xAxisLabel(\"Gender\")\n .yAxis().ticks(4);\n\n}",
"function addScatterPlot(fetch_data_array){\r\n\t\r\nvar margin = {top: 20, right: 20, bottom: 30, left: 80},\r\n width = 1200 - margin.left - margin.right,\r\n height = 800 - margin.top - margin.bottom;\r\n\r\n/* \r\n * value accessor - returns the value to encode for a given data object.\r\n * scale - maps value to a visual display encoding, such as a pixel position.\r\n * map function - maps from data value to display value\r\n * axis - sets up axis\r\n */\r\n\r\n\r\n// setup x \r\nvar xValue = function(d) { return d.male;}, // data -> value\r\n xScale = d3.scale.linear().range([0, width]), // value -> display\r\n xMap = function(d) { return xScale(xValue(d));}, // data -> display\r\n xAxis = d3.svg.axis().scale(xScale).orient(\"bottom\");\r\n\t\r\n// setup y\r\nvar yValue = function(d) { return d.female;}, // data -> value\r\n yScale = d3.scale.linear().range([height, 0]), // value -> display\r\n yMap = function(d) { return yScale(yValue(d));}, // data -> display\r\n yAxis = d3.svg.axis().scale(yScale).orient(\"left\");\r\n\t\r\n\t// setup fill color\r\nvar cValue = function(d) { return d.cancertype;},\r\n color = d3.scale.category10();\r\n\t\r\n// add the graph canvas to the body of the webpage\r\nvar svg = d3.select(\"body\").append(\"svg\")\r\n .attr(\"width\", width + margin.left + margin.right)\r\n .attr(\"height\", height + margin.top + margin.bottom)\r\n .append(\"g\")\r\n .attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\r\n\r\n\t// add the tooltip area to the webpage\r\nvar tooltip = d3.select(\"body\").append(\"div\")\r\n .attr(\"class\", \"tooltip\")\r\n .style(\"opacity\", 0);\r\n\r\n\t//Fetch the data \r\n fetch_data_array.forEach(function(d) {\r\n\td.male = +d.male;\r\n d.female = +d.female;\r\n\t\r\n});\r\n\r\n // don't want dots overlapping axis, so add in buffer to data domain\r\n xScale.domain([d3.min(fetch_data_array, xValue)-1, d3.max(fetch_data_array, xValue)+1]);\r\n yScale.domain([d3.min(fetch_data_array, yValue)-1, d3.max(fetch_data_array, yValue)+1]); \r\n\r\n // x-axis\r\n svg.append(\"g\")\r\n .attr(\"class\", \"x axis\")\r\n .attr(\"transform\", \"translate(0,\" + height + \")\")\r\n .call(xAxis)\r\n .append(\"text\")\r\n .attr(\"class\", \"label\")\r\n .attr(\"x\", width)\r\n .attr(\"y\", -6)\r\n .style(\"text-anchor\", \"end\")\r\n .text(\"Male Count\");\r\n\t \r\n\t // y-axis\r\n svg.append(\"g\")\r\n .attr(\"class\", \"y axis\")\r\n .call(yAxis)\r\n .append(\"text\")\r\n .attr(\"class\", \"label\")\r\n .attr(\"transform\", \"rotate(-90)\")\r\n .attr(\"y\", 6)\r\n .attr(\"dy\", \".71em\")\r\n .style(\"text-anchor\", \"end\")\r\n .text(\"Female Count\");\r\n \r\n// draw dots\r\n svg.selectAll(\".dot\")\r\n .data(fetch_data_array)\r\n .enter().append(\"circle\")\r\n .attr(\"class\", \"dot\")\r\n .attr(\"r\", 6.5)\r\n .attr(\"cx\", xMap)\r\n .attr(\"cy\", yMap)\r\n .style(\"fill\", function(d) { return color(cValue(d));}) \r\n .on(\"mouseover\", function(d) {\r\n tooltip.transition()\r\n .duration(200)\r\n .style(\"opacity\", .9);\r\n tooltip.html(d[\"cancertype\"] + \"<br/> (\" + xValue(d) \r\n\t + \", \" + yValue(d) + \")\")\r\n .style(\"left\", (d3.event.pageX + 5) + \"px\")\r\n .style(\"top\", (d3.event.pageY - 28) + \"px\");\r\n })\r\n .on(\"mouseout\", function(d) {\r\n tooltip.transition()\r\n .duration(500)\r\n .style(\"opacity\", 0);\r\n });\r\n\r\n// draw legend\r\n var legend = svg.selectAll(\".legend\")\r\n .data(color.domain())\r\n .enter().append(\"g\")\r\n .attr(\"class\", \"legend\")\r\n .attr(\"transform\", function(d, i) { return \"translate(0,\" + i * 20 + \")\"; });\r\n\r\n // draw legend colored rectangles\r\n legend.append(\"rect\")\r\n .attr(\"x\", width - 18)\r\n .attr(\"width\", 18)\r\n .attr(\"height\", 18)\r\n .style(\"fill\", color);\r\n\r\n // draw legend text\r\n legend.append(\"text\")\r\n .attr(\"x\", width - 24)\r\n .attr(\"y\", 9)\r\n .attr(\"dy\", \".35em\")\r\n .style(\"text-anchor\", \"end\")\r\n .text(function(d) { return d;})\r\n\r\n}",
"function sexualRatio(selected){\n\t\n\t// JSON result array\n\tvar female_population = [];\n\tvar request = new XMLHttpRequest();\n\n\tvar path = selectedCountries(selected);\n\t\n\tif(!selected.length || selected == \"WLD\"){\n\t\turl = `http://api.worldbank.org/v2/countries/WLD/indicators/SP.POP.TOTL.FE.ZS?date=2017&format=json`;\n\t\t\n\t}else{\n\t\tvar url = `http://api.worldbank.org/v2/countries/${path}/indicators/SP.POP.TOTL.FE.ZS?date=2017&format=json`;\n\t}\n\trequest.open('GET', url, true);\n\trequest.onload = function () {\n\t\t//Begin accessing JSON data here\n\t\tvar requestArray = JSON.parse(this.response);\n\t\trequestArray[1].forEach(element => {\n\t\t\tfemale_population.push({country:`${element.country.id}`,year:`${element.date}`,value:`${element.value}`});\n\t })\n\t //console.log(female_population);\n\n var width=(innerWidth*5/12 - 20)/2;\n\tvar margin = ({top: 30, right: 0, bottom: 10, left: 30});\n\tvar height = female_population.length * 25 + margin.top + margin.bottom;\n\n\n\t//initialize the graphe\n\tsvgRatio.selectAll(\"path\").remove();\n\tsvgRatio.selectAll(\"#male\").remove();\n\tsvgRatio.selectAll(\"#female\").remove();\n\tsvgRatio.selectAll(\"text\").remove();\n\tsvgRatio.selectAll(\"#yAxis\").remove();\n\n\n\tvar x = d3.scaleLinear()\n\t\t.domain([0, 100])\n\t\t.range([margin.left, width - margin.right]);\n\n\tvar y = d3.scaleBand()\n\t\t.domain(female_population.map(d => d.country))\n\t\t.range([margin.top, height - margin.bottom])\n\t\t.padding(0.3);\n\n\n\tvar yAxis = g => g\n\t\t.attr(\"transform\", `translate(${margin.left},0)`)\n\t\t.call(d3.axisLeft(y).tickSizeOuter(0));\n\t\t\n\t\t\n\n\t//male bar\n\tvar bar=svgRatio.append(\"g\")\n\t\t.selectAll(\"rect\")\n\t\t.data(female_population)\n\t\t.enter();\n\tbar.append(\"rect\")\n\t\t.attr(\"fill\", \"#384cff\")\n\t\t.attr(\"height\", y.bandwidth())\n\t\t.attr(\"x\", d => x(0))\n\t\t.attr(\"y\", d => y(d.country))\n\t\t.attr(\"width\", 0)\n\t\t.transition()\n\t\t.duration(2000)\n\t\t.delay(function (d, i) {return i*100;})\n\t\t.attr(\"width\", 200)\n\t\t.attr(\"id\",\"male\");\n\n\t\n\t//female chart \n\t/*var barfemale=svgRatio.append(\"g\")\t \n\t\t.selectAll(\"rect\")\n\t\t.data(female_population)\n\t\t.enter();*/\n\tbar.append(\"rect\")\n\t\t.attr(\"fill\", \"#ff2c29\")\n\t\t.attr(\"height\", y.bandwidth())\n\t\t.attr(\"x\", x(0))\n\t\t.attr(\"y\", d => y(d.country))\n\t\t.attr(\"width\", 0)\n\t\t.transition()\n\t\t.duration(2000)\n\t\t.delay(function (d, i) {return i*100;})\n\t\t.attr(\"width\", d => d.value*2) \n\t\t.attr(\"id\",\"female\");\n\n\t//Y axis\n\tsvgRatio.append(\"g\")\n\t\t\t.attr(\"id\",\"yAxis\")\n\t\t .call(yAxis);\n\t\t\n\tbar.append(\"text\")\n\t\t.data(female_population)\n\t\t.attr(\"height\", y.bandwidth())\n\t\t.attr(\"x\", x(0))\n\t\t.attr(\"y\", d => y(d.country)+10)\n\t\t.attr(\"dy\", \".2em\")\n\t\t.attr(\"fill\",\"white\")\n\t\t.text(function(d) { return parseFloat(d.value).toFixed(2); });\n\n\tsvgRatio.node();\n\t};\n\t//Send request\n\trequest.send();\n\t\n}",
"function hideCategoryTitles() {\n\t\tsvg.selectAll(\".category\").remove()\n\t}",
"function displayStatistics(countyName, race) {\n\tcsvName = getCSVName(countyName.toLowerCase());\n\td3.csv(csvName, function(error, data) {\n\t\tvar groupByOffice = d3.nest()\n\t\t\t.key(function(d) {return d.office})\n\t\t\t.entries(data);\n\t\traceVotes = getVotesByOffice(groupByOffice, race);\n\t\tdisplayPieGraph(raceVotes);\n\n\t\t// pass raceVotes data to piechart so that we can display the pie graph\n\t\tvar voteSummaryString = ''\n\t\tfor (var i = 0; i < raceVotes.length; i++) {\n\t\t\tcandidate = raceVotes[i].candidate;\n\t\t\tcandidateVotes = raceVotes[i].votes;\n\t\t\tvoteSummaryString += candidate + ': ' + candidateVotes + '<br>';\n\t\t}\n map[countyName.toLowerCase()] = voteSummaryString;\n\t\treturn voteSummaryString;\n\t});\n}"
] |
[
"0.5959805",
"0.59451514",
"0.59236306",
"0.59132034",
"0.5898405",
"0.5814487",
"0.57751083",
"0.57670313",
"0.57618374",
"0.57575333",
"0.5697842",
"0.55218154",
"0.550682",
"0.5409061",
"0.5408525",
"0.5245627",
"0.5193849",
"0.5162972",
"0.5139002",
"0.513693",
"0.51311266",
"0.5106883",
"0.50899464",
"0.5065094",
"0.5051191",
"0.50495553",
"0.50399566",
"0.5011716",
"0.50004077",
"0.49893454"
] |
0.6391051
|
0
|
handles mouse events over the lines
|
function handleMouseOverLines(lambdaList) {
canvas.addEventListener("mousemove", e => showLineNumberInBox(e, lambdaList));
canvas.addEventListener("mouseleave", unshowLineNumberInBox);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function interMouseMove() {\n var m = d3.mouse(this);\n line.attr(\"x2\", m[0]-3)\n .attr(\"y2\", m[1]-3);\n}",
"function interMouseMove() {\n var m = d3.mouse(this);\n line.attr(\"x2\", m[0]-3)\n .attr(\"y2\", m[1]-3);\n}",
"function updateMouseHoverLine() {\r\n for (var i=0; i<lineSegments.length; ++i) {\r\n ls = lineSegments[i];\r\n //determine if cursor position is on or very near a line\r\n var TOLERANCE = CELL_SIZE/2;\r\n var mousePos = {x:mouseX,y:mouseY};\r\n var closestPoint = Geometry.getClosestPointOnLineSegment(ls.p1, ls.p2, mousePos, TOLERANCE)\r\n if (closestPoint != false) {\r\n ls.hover = true;\r\n if (debug && currentTool == \"select-line\" || currentTool == \"delete-line\") {\r\n //draw dot for p2\r\n ctx.beginPath();\r\n ctx.arc(closestPoint.x, closestPoint.y, 2, 0, Math.PI*2, true); \r\n ctx.closePath();\r\n ctx.fillStyle = \"purple\";\r\n ctx.fill();\r\n }\r\n } else {\r\n ls.hover = false;\r\n }\r\n }\r\n}",
"function lineMouseOutHandler() {\n for (i = 0; i < dynamicFileList.length; i++) {\n var id = filenameToId(dynamicFileList[i]);\n if (\"line\" + id != this.id) {\n turnOn(filenameToId(dynamicFileList[i]), colorMap.get(id));\n\n }\n }\n}",
"function handoffMouseMove() {\n console.log(\"in the mouse move\");\n var m = d3.mouse(this);\n line.attr(\"x2\", m[0])\n .attr(\"y2\", m[1]);\n //timeline_svg.on(\"click\", handoffMouseClick);\n}",
"function drawline() {\n\n if (isDrawing) {\n linePoint2 = d3.mouse(this);\n gContainer.select('line').remove();\n gContainer.append('line')\n .attr(\"x1\", linePoint1.x)\n .attr(\"y1\", linePoint1.y)\n .attr(\"x2\", linePoint2[0] - 2) //arbitary value must be substracted due to circle cursor hover not working\n .attr(\"y2\", linePoint2[1] - 2); // arbitary values must be tested\n\n }\n }",
"function toolTipLine(){\n var mouseG = svgTs.append(\"g\")\n .attr(\"class\", \"mouse-over-effects\");\n\n mouseG.append(\"path\") // this is the black vertical line to follow mouse\n .attr(\"class\", \"mouse-line\")\n .style(\"stroke\", \"black\")\n .style(\"stroke-width\", \"1px\")\n .style(\"opacity\", \"0\");\n\n var lines = document.getElementsByClassName('line');\n\n var mousePerLine = mouseG.selectAll('.mouse-per-line')\n .data(dataset)\n .enter()\n .append(\"g\")\n .attr(\"class\", \"mouse-per-line\");\n\n // mousePerLine.append(\"circle\")\n // .attr(\"r\", 4)\n // .style(\"stroke\", function(d) {\n // return getColorTs(d.key);\n // })\n // .style(\"fill\", \"none\")\n // .style(\"stroke-width\", \"1px\")\n // .style(\"opacity\", \"0\");\n //\n // mousePerLine.append(\"text\")\n // .attr(\"transform\", \"translate(10,3)\")\n\n mouseG.append('svg:rect') // append a rect to catch mouse movements on canvas\n .attr('width', tsWidth) // can't catch mouse events on a g element\n .attr('height', tsHeight)\n .attr('fill', 'none')\n .attr('pointer-events', 'all')\n .on('mouseout', function() { // on mouse out hide line, circles and text\n d3.select(\".mouse-line\")\n .style(\"opacity\", \"0\");\n // d3.selectAll(\".mouse-per-line circle\")\n // .style(\"opacity\", \"0\");\n // d3.selectAll(\".mouse-per-line text\")\n // .style(\"opacity\", \"0\");\n })\n .on('mouseover', function() { // on mouse in show line, circles and text\n d3.select(\".mouse-line\")\n .style(\"opacity\", \"1\");\n // d3.selectAll(\".mouse-per-line circle\")\n // .style(\"opacity\", \"1\");\n // d3.selectAll(\".mouse-per-line text\")\n // .style(\"opacity\", \"1\");\n })\n .on('mousemove', function() { // mouse moving over canvas\n var mouse = d3.mouse(this);\n d3.select(\".mouse-line\")\n .attr(\"d\", function() {\n var d = \"M\" + mouse[0] + \",\" + tsHeight;\n d += \" \" + mouse[0] + \",\" + 0;\n return d;\n });\n\n\n d3.selectAll(\".mouse-per-line\")\n .attr(\"transform\", function(d, i) {\n console.log(tsWidth/mouse[0])\n\n var xDate = tsxScale.invert(mouse[0]);\n var x1 = d3.timeMinute.every(5).round(xDate),\n\n idx = bisectDate(d.values, x1);\ndebugger\n var beginning = 0,\n end = lines[i].getTotalLength(),\n target = null;\n\n while (true){\n target = Math.floor((beginning + end) / 2);\n pos = lines[i].getPointAtLength(target);\n if ((target === end || target === beginning) && pos.x !== mouse[0]) {\n break;\n }\n if (pos.x > mouse[0]) end = target;\n else if (pos.x < mouse[0]) beginning = target;\n else break; //position found\n }\n\n d3.select(this).select('text')\n .text(tsyScale.invert(pos.y))\n .attr(\"font-size\",\"11px\");\n // \"#dot-\" + d.key + \"-\" + idx.style(\"fill\",\"white\").style(\"opacity\",1);\n let xPos = d3.select(\"#dot-\" + d.key + \"-\" + idx).attr(\"cx\");\n\n let yPos = d3.select(\"#dot-\" + d.key + \"-\" + idx).attr(\"cy\");\ndebugger\n d3.select(\"#carIcon-\" + d.key )\n .transition()\n .duration(2000)\n // .attrTween(\"transform\", translateAlong(tsRoutes.node()))\n .ease(d3.easeLinear)\n .attr(\"x\", xPos-5)\n .attr(\"y\", yPos-5);\n // .attr(\"transform\", (d,i)=> {\n // return \"translate(\" + [projectionTs([d.values[i].Long,d.values[i].Lat])[0]-5,projectionTs([d.values[i].Long,d.values[i].Lat])[1]-5] + \")\";\n // });\n// debugger\n return \"translate(\" + mouse[0] + \",\" + pos.y +\")\";\n });\n });\n }",
"function mousePressed(){\n\tnext = 0;\n\tdrawing = true;\n\tlast.x = mouseX;\n\tlast.y = mouseY;\n\tlines.push(new Line());\n}",
"function mouseoverTrainLine() {\n var lineID = d3.select(this).attr(\"id\");\n d3.select(this).attr(\"style\", \"cursor:pointer\");\n\n var circleID = lineID.replace(\"line\", \"circle\");\n var circle = d3.select(\"#\" + circleID);\n\n if ((popupOpen && circleID != currentCircleID) || editting)\n return;\n\n currentCircleID = circleID;\n currentCircle = circle;\n\n // currentCircle\n // .transition().duration(200)\n // .attr(\"style\", \"cursor:pointer\")\n // .attr(\"r\", 5);\n\n defineChangesFromLine(circleID);\n\n popupOpen = true;\n\n // updatePopupCircleSize(currentCircle);\n // updatePopupCircleContent();\n}",
"mousemove_handler(e) {\n if (!this.mouseDown) { return true; }\n\n const local = this.getLocalCoords(this.mainCanvas, e);\n\n this.scratchLine(local.x, local.y, false);\n\n e.preventDefault();\n return false;\n }",
"function lineMouseOverHandler() {\n for (i = 0; i < dynamicFileList.length; i++) {\n var id = filenameToId(dynamicFileList[i]);\n if (\"line\" + id != this.id) {\n turnOff(filenameToId(dynamicFileList[i]));\n }\n }\n}",
"function onMouseMove(e){\n if (!drawing) { return; }\n drawLine(current.x, current.y, e.clientX, e.clientY, current.color, getLineWidth(), true);\n current.x = e.clientX;\n current.y = e.clientY;\n }",
"function handlePencil(e)\n {\n if(isMousePressed)\n {\n let strokeStyle = state.ctx.strokeColor,\n strokeWidth = state.ctx.lineWidth;\n\n $cvs.drawLine({\n strokeStyle: strokeStyle,\n strokeWidth: strokeWidth,\n rounded: true,\n x1: lastX,\n y1: lastY,\n x2: endX,\n y2: endY,\n layer: true,\n groups: [group]\n });\n\n lastX = endX;\n lastY = endY;\n }\n }",
"function Line(type){\n this.type = type;\n this.position = {\n x1: null, x2: null, y1: null, y2: null\n };\n this.init = function(){\n this.coordinate.hover(true);\n this.coordinate.show(true)\n artboard.on('mousedown',function(e){\n var data = {};\n \n if(e.originalEvent.detail == 2){\n this.clearPosition();\n data.plot = false;\n }\n else\n {\n ($(e.target).hasClass('coordinate') ? \n\n (\n data.x = Number($(e.target).attr('data-x')) + 2 ,\n data.y = Number($(e.target).attr('data-y')) + 2,\n data.plot = false\n ) \n\n :\n\n ( data.x = e.offsetX, data.y = e.offsetY, data.plot = true)\n\n );\n\n data.isFirst = true;\n data.event = e;\n\n if(this.position.x1 == null)\n {\n this.position.x1 = data.x;\n this.position.y1 = data.y;\n }\n else\n {\n this.position.x2 = data.x;\n this.position.y2 = data.y;\n data.isFirst = false;\n }\n\n this.exe(data);\n }\n \n }.bind(this));\n \n }\n this.fin = function(){\n this.coordinate.hover(false);\n this.clearPosition();\n this.coordinate.show(false);\n artboard.off('mousedown');\n } \n }",
"function canvas_mouseDown() {\n mouseDown=1;\n drawLine(ctx,mouseX,mouseY,12);\n\n}",
"function handleMouseDown(event) {\n var lLabel = document.getElementById( \"debug-label-2\" );\n gMmouseDown = true;\n var oldX = gLastMouseXdown;\n var oldY = gLastMouseYdown; \n\n if (event.x != undefined && event.y != undefined) {\n gLastMouseXdown = event.x + document.body.scrollLeft +\n document.documentElement.scrollLeft;\n gLastMouseYdown = event.y + document.body.scrollTop +\n document.documentElement.scrollTop;\n lLabel.innerHTML = \"event.x=\" + event.x + \" event.y=\" + event.y;\n } else {\n // Firefox method to get the position\n gLastMouseXdown = event.clientX + document.body.scrollLeft +\n document.documentElement.scrollLeft;\n gLastMouseYdown = event.clientY + document.body.scrollTop +\n document.documentElement.scrollTop;\n lLabel.innerHTML = \"event.clientX=\" + event.clientX + \" event.clientY=\" + event.clientY;\n }\n\n gLastMouseXdown -= gCanvas.offsetLeft;\n gLastMouseYdown -= gCanvas.offsetTop;\n lLabel.innerHTML += \" handleMouseDown: old(\"+oldX+\",\"+oldY+\")\"+\" new(\"+gLastMouseXdown+\",\"+gLastMouseYdown+\")\"\n\n if (lProx) {\n lEdit = true;\n } else if (vGProx || !moved) {\n vEdit = true;\n } else {\n gLineVertices = [\n oldX, oldY,\n gLastMouseXdown, gLastMouseYdown\n ]; \n }\n\n// refreshCanvas();\n}",
"function lineMouseOver(l, i) {\n var major = getMajorAsClass(l[0].major);\n\n changeElementOpacityForDifferentMajors(\"vis2-line\", major, '.1');\n changeElementOpacityForDifferentMajors(\"vis2-dot\", major, '.1');\n\n // this makes the tooltip visible\n div.transition()\n .duration(50)\n .style(\"opacity\", .9);\n\n var string = \"Women majoring in <i>\" + l[0]['major'] + '</i>';\n\n // this sets the location and content of the tooltip to the point's location/coordinates\n div.html(string)\n .style(\"left\", (d3.event.pageX) + \"px\")\n .style(\"top\", (d3.event.pageY - 28) + \"px\");\n}",
"function onMouseDown(event){\n xSpot = event.clientX;\n ySpot = event.clientY;\n if (xSpot<(window.innerWidth-96) && 96<xSpot && ySpot<(window.innerHeight-32) && 32<ySpot){\n var whichLineInDocuY = Math.floor((ySpot+window.pageYOffset)/(16+lineSpace));\n var whichCharInLineX = Math.floor((xSpot-96)/12);\n var characterLineClickedOn = 0;\n\n if ((whichLineInDocuY-1)<arrayOfLines.length){\n for (var line = 0; line<whichLineInDocuY-1; line++){\n if (arrayOfLines[line].length<lineLength){\n characterLineClickedOn+=arrayOfLines[line].length+1; \n }\n else{\n characterLineClickedOn+=arrayOfLines[line].length;\n }\n }\n\n if (whichCharInLineX < arrayOfLines[whichLineInDocuY-1].length){\n currentCursorSpot=characterLineClickedOn+whichCharInLineX; \n }\n else{\n currentCursorSpot=characterLineClickedOn+arrayOfLines[whichLineInDocuY-1].length;\n }\n draw();\n }\n }\n}",
"function mousemove() {\r\n if (drawing_line && !should_drag) {\r\n var m = d3.mouse(svg.node());\r\n var x = Math.max(0, Math.min(width, m[0]));\r\n var y = Math.max(0, Math.min(height, m[1]));\r\n // debounce - only start drawing line if it gets a bit big\r\n var dx = selected_node.x - x;\r\n var dy = selected_node.y - y;\r\n if (Math.sqrt(dx * dx + dy * dy) > 10) {\r\n // draw a line\r\n if (!new_line) {\r\n new_line = linesg.append(\"line\").attr(\"class\", \"new_line\");\r\n }\r\n new_line.attr(\"x1\", function(d) { return selected_node.x; })\r\n .attr(\"y1\", function(d) { return selected_node.y; })\r\n .attr(\"x2\", function(d) { return x; })\r\n .attr(\"y2\", function(d) { return y; });\r\n }\r\n }\r\n update();\r\n}",
"function mousemove() {\n if (drawing_line && selected_node) {\n var m = d3.mouse(d3.select(\"svg\").node());\n m = d3.zoomTransform(d3.select(\"svg\").node()).invert(m);\n var x = Math.max(0, Math.min(width, m[0]));\n var y = Math.max(0, Math.min(height, m[1]));\n // debounce - only start drawing line if it gets a bit big\n var dx = selected_node.x - x;\n var dy = selected_node.y - y;\n //console.log(\"mouse move: dx=\"+dx+\", dy=\"+dy)\n if (Math.sqrt(dx * dx + dy * dy) > 10) {\n \n // draw a line\n if (!new_line) {\n new_line = g.append(\"line\").attr(\"class\", \"new_line\");\n }\n new_line.attr(\"x1\", function(d) { return selected_node.x; })\n .attr(\"y1\", function(d) { return selected_node.y; })\n .attr(\"x2\", function(d) { return x; })\n .attr(\"y2\", function(d) { return y; });\n }\n }\n //update(link_data, node_data);\n}",
"onLineMouseOver(part) {\n this.setState({...this.state,selectedPart: part})\n }",
"function mouseoutTrainLine() {\n var lineID = d3.select(this).attr(\"id\");\n\n var circleID = lineID.replace(\"line\", \"circle\");\n var circle = d3.select(\"#\" + circleID);\n\n circle\n .transition().duration(200)\n .attr(\"r\", 2);\n if (!editting) {\n popup.style(\"visibility\", \"hidden\");\n popupRect.style(\"visibility\", \"hidden\");\n popupOpen = false;\n }\n}",
"setLineCoordinates() {\n if (this.shown) {\n //if not self link && not linker modified pep\n if (!this.crosslink.isSelfLink() && this.crosslink.toProtein) {\n let x, y;\n const source = this.renderedFromProtein.getRenderedInteractor();\n const target = this.renderedToProtein.getRenderedInteractor();\n if (!source.ix || !source.iy) {\n console.log(\"NOT\");\n }\n // from end\n if (source.type === \"group\" || !source.expanded) {\n x = source.ix;\n y = source.iy;\n } else {\n const coord = this.getResidueCoordinates(this.crosslink.fromResidue, this.renderedFromProtein);\n x = coord[0];\n y = coord[1];\n }\n this.line.setAttribute(\"x1\", x);\n this.line.setAttribute(\"y1\", y);\n this.highlightLine.setAttribute(\"x1\", x);\n this.highlightLine.setAttribute(\"y1\", y);\n\n // to end\n if (target.type === \"group\" || !target.expanded) {\n x = target.ix;\n y = target.iy;\n } else {\n const coord = this.getResidueCoordinates(this.crosslink.toResidue, this.renderedToProtein);\n x = coord[0];\n y = coord[1];\n }\n this.line.setAttribute(\"x2\", x);\n this.line.setAttribute(\"y2\", y);\n this.highlightLine.setAttribute(\"x2\", x);\n this.highlightLine.setAttribute(\"y2\", y);\n\n }\n }\n }",
"mousedown_handler(e) {\n const local = this.getLocalCoords(this.mainCanvas, e);\n this.mouseDown = true;\n\n this.scratchLine(local.x, local.y, true);\n\n e.preventDefault();\n return false;\n }",
"function showCrosshair(e, show){\n if (show){\n var mouseX = d3.mouse(e)[0];\n var mouseY = d3.mouse(e)[1];\n\n hLine.attr(\"y1\", mouseY).attr(\"y2\", mouseY).style(\"opacity\", 1);\n vLine.attr(\"x1\", mouseX).attr(\"x2\", mouseX).style(\"opacity\", 1);\n }else{\n hLine.style(\"opacity\", 0);\n vLine.style(\"opacity\", 0);\n } \n}",
"function started() {\r\n d3.selectAll(\".mouse-line\").classed(\"aleph-hide\", true);\r\n d3.selectAll(\".mouse-per-line\").classed(\"aleph-hide\", true);\r\n d3.selectAll(\".aleph-toolTip-Div\").classed(\"aleph-hide\", true);\r\n\r\n var p = d3.mouse(aleph.mouseoverRectangle);\r\n\r\n aleph.selectionRectangle.rectElement = d3\r\n .select(\"#aleph-line-chart\")\r\n .append(\"rect\")\r\n .attr(\"class\", \"selection\")\r\n .attr(\"rx\", 0)\r\n .attr(\"ry\", 0)\r\n .attr(\"x\", 0)\r\n .attr(\"y\", 0)\r\n .attr(\"width\", 0)\r\n .attr(\"height\", 0);\r\n\r\n aleph.selectionRectangle.originX = p[0];\r\n aleph.selectionRectangle.originY = p[1];\r\n\r\n aleph.selectionRectangle.currentX = p[0];\r\n aleph.selectionRectangle.currentY = p[1];\r\n\r\n getNewAttributes();\r\n\r\n aleph.chartStartDragX = aleph.xMain.invert(\r\n p[0] - aleph.margin.line[aleph.windowSize].left\r\n );\r\n\r\n aleph.chartStartDragY = aleph.yMain.invert(\r\n p[1] - aleph.margin.line[aleph.windowSize].top\r\n );\r\n\r\n aleph.chartDraggedCoordinates = [\r\n [aleph.chartStartDragX, aleph.chartStartDragY],\r\n [0, 0],\r\n ];\r\n\r\n // var chartWidth = aleph.xMain.range()[1] - aleph.xMain.range()[0];\r\n // var chartHeight = aleph.yMain.range()[0] - aleph.yMain.range()[1];\r\n\r\n // d3.selectAll(\".aleph-line-chart\")\r\n // .append(\"svg:image\")\r\n // .attr(\"class\", \"aleph-wasteBin\")\r\n // .attr(\"id\", \"aleph-wasteBin\")\r\n // .attr(\"xlink:href\", \"image/wasteBin.svg\")\r\n // .attr(\"width\", 50)\r\n // .attr(\"height\", 50)\r\n // .attr(\"x\", aleph.margin.line[aleph.windowSize].left + 10)\r\n // .attr(\"y\", aleph.margin.line[aleph.windowSize].top + chartHeight - 55);\r\n\r\n // document.getElementById(\"line-reset-axes\").disabled = false;\r\n\r\n return;\r\n}",
"function OnMouseMove(e) {\n if (!pressed) return;\n en = { x: e.x - rect.left, y: e.y - rect.top };\n clearCanvas();\n drawLineUpperLayer(st, en);\n}",
"function viewport_line(e){\n\tsettings.colors.line=e.srcElement.value;\n\tvp.line=settings.colors.line;\t\n}",
"function mousemove() {\n var x0 = x.invert(d3.mouse(this)[0]),\n i = bisectDate(data, x0, 1),\n d0 = data[i - 1],\n d1 = data[i],\n d = x0 - d0.date > d1.date - x0 ? d1 : d0;\n\n focus\n .select(\".lineHover\")\n .attr(\"transform\", \"translate(\" + x(d.date) + \",\" + height + \")\");\n\n focus\n .select(\".lineHoverDate\")\n .attr(\n \"transform\",\n \"translate(\" + x(d.date) + \",\" + (height + margin.bottom) + \")\"\n )\n .text(formatDate(d.date));\n\n focus\n .selectAll(\".hoverCircle\")\n .attr(\"cy\", (e) => y(d[e]))\n .attr(\"cx\", x(d.date));\n\n focus\n .selectAll(\".lineHoverText\")\n .attr(\"transform\", \"translate(\" + x(d.date) + \",\" + height / 2.5 + \")\")\n .text((e) => e + \" \" + formatValue(d[e]) + \"%\");\n\n x(d.date) > width - width / 4\n ? focus\n .selectAll(\"text.lineHoverText\")\n .attr(\"text-anchor\", \"end\")\n .attr(\"dx\", -10)\n : focus\n .selectAll(\"text.lineHoverText\")\n .attr(\"text-anchor\", \"start\")\n .attr(\"dx\", 10);\n\n //reorders Gantt bars depending on the mouse position\n reorderGanttBars(d.date);\n }",
"mouseOn() {\n if (mouseX > this.x && mouseX < this.x + this.w\n && mouseY > this.y && mouseY < this.y + this.h) {\n this.stroke = 2;\n this.mouseover = true;\n }\n else {\n this.stroke = 1;\n this.mouseover = false;\n }\n }"
] |
[
"0.7554375",
"0.7554375",
"0.74858207",
"0.7247059",
"0.7206811",
"0.71695733",
"0.71290773",
"0.7072641",
"0.7054814",
"0.70529497",
"0.69415504",
"0.68399286",
"0.67913026",
"0.674144",
"0.67294276",
"0.67154515",
"0.6698092",
"0.667147",
"0.6644009",
"0.662962",
"0.66225624",
"0.6600536",
"0.6578939",
"0.65654266",
"0.65609515",
"0.65538156",
"0.6546982",
"0.65384036",
"0.6459691",
"0.6444862"
] |
0.78415483
|
1
|
adds a number to the bootom of the popup box when mouse is over the corresponding line
|
function showLineNumberInBox(e, lambdaList) {
x = e.clientX;
y = e.clientY;
var lineNum = 0;
const xOff = e.offsetX;
if (xOff % 4 <= 2) {
cursor = " ";
lineNum = parseInt(xOff / 4);
if (lambdaList.includes(lineNum)) {
cursor = lineNum;
}
} else {
cursor = " ";
}
document.getElementById("displayArea").style.display = 'block';
document.getElementById("displayArea").innerHTML = 'Wavelength Number: ' + cursor;
document.getElementById("displayArea").style.right = x + 'px';
document.getElementById("displayArea").style.top = y + 'px';
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function showLineNumberInBox(e, lambdaList) {\n // console.log(e.target.getContext(\"2d\"));\n x = e.clientX;\n y = e.clientY;\n var lineNum = 0;\n const xOff = e.offsetX;\n if (xOff % 4 <= 2) {\n cursor = \" \";\n lineNum = parseInt(xOff / 4);\n if (lambdaList.includes(lineNum)) {\n cursor = lineNum;\n }\n } else {\n cursor = \" \";\n }\n document.getElementById(\"displayArea\").style.display = 'block';\n document.getElementById(\"displayArea\").innerHTML = 'Wavelength Number: ' + cursor;\n document.getElementById(\"displayArea\").style.right = x + 'px';\n document.getElementById(\"displayArea\").style.top = y + 'px';\n}",
"function addHover(num) {\n\tmagHolder[num].addEventListener('mouseover', function() {\n\t\tmagText[num].setAttribute(\"style\", \"background-color: white; display: block; border: solid 1px #d5d6d7; z-index: 15; position: absolute; width: 160px; text-align: center; padding: 5px 5px 5px 7px\");\n\t}, false);\n\tmagHolder[num].addEventListener('mouseleave', function() {\n\t\tmagText[num].style.display = 'none';\n\t}, false);\n}",
"function mouseoverTrainLine() {\n var lineID = d3.select(this).attr(\"id\");\n d3.select(this).attr(\"style\", \"cursor:pointer\");\n\n var circleID = lineID.replace(\"line\", \"circle\");\n var circle = d3.select(\"#\" + circleID);\n\n if ((popupOpen && circleID != currentCircleID) || editting)\n return;\n\n currentCircleID = circleID;\n currentCircle = circle;\n\n // currentCircle\n // .transition().duration(200)\n // .attr(\"style\", \"cursor:pointer\")\n // .attr(\"r\", 5);\n\n defineChangesFromLine(circleID);\n\n popupOpen = true;\n\n // updatePopupCircleSize(currentCircle);\n // updatePopupCircleContent();\n}",
"function rect_mouseover() {\n\t\t\tpercentText.style(\"opacity\", 1)\n\t\t\tapproveText.style(\"opacity\", 1)\n\t\t\tfocusDate.style(\"opacity\", 1)\n\t\t}",
"function popup35 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de Julio:\"+feature.properties.Tasa_Contagios_Jul+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup19 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de enero:\"+feature.properties.ene+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup34 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de Julio:\"+feature.properties.Tasa_Mortalidad_Ago+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function lineMouseOver(l, i) {\n var major = getMajorAsClass(l[0].major);\n\n changeElementOpacityForDifferentMajors(\"vis2-line\", major, '.1');\n changeElementOpacityForDifferentMajors(\"vis2-dot\", major, '.1');\n\n // this makes the tooltip visible\n div.transition()\n .duration(50)\n .style(\"opacity\", .9);\n\n var string = \"Women majoring in <i>\" + l[0]['major'] + '</i>';\n\n // this sets the location and content of the tooltip to the point's location/coordinates\n div.html(string)\n .style(\"left\", (d3.event.pageX) + \"px\")\n .style(\"top\", (d3.event.pageY - 28) + \"px\");\n}",
"function popup22 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de abril:\"+feature.properties.abr+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup32 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de Julio:\"+feature.properties.Tasa_Contagios_Ago+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup25 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>índice de aglomeración urbano-poblacional:\"+feature.properties.pce+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup29 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de Junio:\"+feature.properties.Tasa_Contagios+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup17(feature,layer){\n layer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+ \n \"</p>Hacinamiento Crítico (%):\"+feature.properties.hac_cri+\"</p>\"\n);\n layer.on('mouseover', function () { this.openPopup(); })\n}",
"function popup27 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de Junio:\"+feature.properties.Tasa_Contagios+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup24 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Tasa de mortalidad (cada 100 mil hab.):\"+feature.properties.Tasa_Mortalidad+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup20 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de febrero:\"+feature.properties.feb+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup33 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de Agosto:\"+feature.properties.Tasa_Mortalidad_Jul+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup36 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de Julio:\"+feature.properties.Tasa_Contagios_Ago+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup31 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de Julio:\"+feature.properties.Tasa_Contagios_Jul+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup23 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de mayo:\"+feature.properties.may+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup28 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Tasa de mortalidad (cada 100 mil hab.):\"+feature.properties.Tasa_Mortalidad+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup21 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de marzo:\"+feature.properties.mar+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup26 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.NOMBRE+\n \"</p> Casos:\"+feature.properties.nuevos_casos+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popup30 (feature, layer) {\n\tlayer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+\n \"</p>Casos cada cien mil (100.000) habitantes, mes de Mayo:\"+feature.properties.may+\"</p>\",\n \n {minWidth: 150, maxWidth: 200});\n \n layer.on('mouseover', function () { this.openPopup(); })\n\n\n}",
"function popupH (feature,layer){\n layer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+ \n \"</p>Casos cada cien mil (100.000) habitantes, mes de julio:\"+feature.properties.jul+\"</p>\"\n);\n layer.on('mouseover', function () { this.openPopup(); })\n}",
"function popupN(feature,layer){\n layer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+ \n \"</p>Proximidad (Distancia) Km.:\"+feature.properties.Distancia+\"</p>\"\n);\n layer.on('mouseover', function () { this.openPopup(); })\n}",
"function increasePoints(){\n points += 1;\n $('#box').text(points);\n }",
"function pop_ALICE_COUNTY(feature, layer) {\r\n layer.on({\r\n mouseout: function(e) {\r\n for (i in e.target._eventParents) {\r\n e.target._eventParents[i].resetStyle(e.target);\r\n }\r\n },\r\n mouseover: highlightFeature,\r\n });\r\n var popupContent = '<table>\\\r\n <tr>\\\r\n <th>' + (feature.properties['NAMELSAD'] !== null ? autolinker.link(feature.properties['NAMELSAD'].toLocaleString()) : '') +', '+ (feature.properties['STATE_NAME'] !== null ? autolinker.link(feature.properties['STATE_NAME'].toLocaleString()) : '')+ '</th>\\\r\n </tr>\\\r\n <tr>\\\r\n <th scope=\"row\">Total:</th>\\\r\n <td>' + (feature.properties['TOTAL'] !== null ? autolinker.link(feature.properties['TOTAL'].toLocaleString()) : '') + '</td>\\\r\n </tr>\\\r\n <tr>\\\r\n <th scope=\"row\">Poverty:</th>\\\r\n <td>' + (feature.properties['POVERTY'] !== null ? autolinker.link(feature.properties['POVERTY'].toLocaleString()) : '') + '</td>\\\r\n </tr>\\\r\n <tr>\\\r\n <th scope=\"row\">ALICE:</th>\\\r\n <td>' + (feature.properties['ALICE'] !== null ? autolinker.link(feature.properties['ALICE'].toLocaleString()) : '') + '</td>\\\r\n </tr>\\\r\n <tr>\\\r\n <th scope=\"row\">Above ALICE Threshold:</th>\\\r\n <td>' + (feature.properties['ABOVE AT'] !== null ? autolinker.link(feature.properties['ABOVE AT'].toLocaleString()) : '') + '</td>\\\r\n </tr>\\\r\n <tr>\\\r\n <th scope=\"row\">% Below ALICE Threshold:</th>\\\r\n <td>' + (feature.properties['perBAT'] !== null ? autolinker.link(feature.properties['perBAT'].toLocaleString(\"en-US\", {style:\"percent\"})) : '') + '</td>\\\r\n </tr>\\\r\n <tr>\\\r\n <th scope=\"row\">Selection</th>\\\r\n <td>' + (feature.properties['GroupName'] !== null ? autolinker.link(feature.properties['GroupName'].toLocaleString()) : '') + '</td>\\\r\n </tr>\\\r\n </table>';\r\n layer.bindPopup(popupContent, {maxHeight: 400});\r\n}",
"function popupL(feature,layer){\n layer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+ \n \"</p>Casos cada cien mil (100.000) habitantes, mes de noviembre:\"+feature.properties.nov+\"</p>\"\n);\n layer.on('mouseover', function () { this.openPopup(); })\n}",
"function popupK(feature,layer){\n layer.bindPopup(\n \"</p>Nombre: \"+feature.properties.Nombre+ \n \"</p>Casos cada cien mil (100.000) habitantes, mes de octubre:\"+feature.properties.oct+\"</p>\"\n);\n layer.on('mouseover', function () { this.openPopup(); })\n}"
] |
[
"0.67592955",
"0.6614352",
"0.62537307",
"0.6186476",
"0.618575",
"0.61709523",
"0.61543155",
"0.6144594",
"0.6143707",
"0.61396706",
"0.61323035",
"0.61254305",
"0.6089654",
"0.6072405",
"0.6065777",
"0.6059029",
"0.6055843",
"0.6055259",
"0.6049621",
"0.60314864",
"0.6025963",
"0.6017625",
"0.6001186",
"0.59379023",
"0.59349144",
"0.58720756",
"0.58664113",
"0.5863513",
"0.5859782",
"0.5843142"
] |
0.6657385
|
1
|
removes the line number created in method showLineNumberInBox when mouse leaves the line
|
function unshowLineNumberInBox() {
document.getElementById("displayArea").innerHTML = "Wavelength Number: ";
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"timelineUnmarkEvents() {\n this.line.setSelection();\n }",
"function showLineNumberInBox(e, lambdaList) {\n // console.log(e.target.getContext(\"2d\"));\n x = e.clientX;\n y = e.clientY;\n var lineNum = 0;\n const xOff = e.offsetX;\n if (xOff % 4 <= 2) {\n cursor = \" \";\n lineNum = parseInt(xOff / 4);\n if (lambdaList.includes(lineNum)) {\n cursor = lineNum;\n }\n } else {\n cursor = \" \";\n }\n document.getElementById(\"displayArea\").style.display = 'block';\n document.getElementById(\"displayArea\").innerHTML = 'Wavelength Number: ' + cursor;\n document.getElementById(\"displayArea\").style.right = x + 'px';\n document.getElementById(\"displayArea\").style.top = y + 'px';\n}",
"function showLineNumberInBox(e, lambdaList) {\n x = e.clientX;\n y = e.clientY;\n var lineNum = 0;\n const xOff = e.offsetX;\n if (xOff % 4 <= 2) {\n cursor = \" \";\n lineNum = parseInt(xOff / 4);\n if (lambdaList.includes(lineNum)) {\n cursor = lineNum;\n }\n } else {\n cursor = \" \";\n }\n document.getElementById(\"displayArea\").style.display = 'block';\n document.getElementById(\"displayArea\").innerHTML = 'Wavelength Number: ' + cursor;\n document.getElementById(\"displayArea\").style.right = x + 'px';\n document.getElementById(\"displayArea\").style.top = y + 'px';\n}",
"function onDeleteLine() {\n changeCurrMeme('delete-row');\n initCanvasAndEditor();\n}",
"function handleMouseOverLines(lambdaList) {\n\n canvas.addEventListener(\"mousemove\", e => showLineNumberInBox(e, lambdaList));\n canvas.addEventListener(\"mouseleave\", unshowLineNumberInBox);\n}",
"function handleMouseOverLines(lambdaList) {\n\n canvas.addEventListener(\"mousemove\", e => showLineNumberInBox(e, lambdaList));\n canvas.addEventListener(\"mouseleave\", unshowLineNumberInBox);\n}",
"function undoHighlightLine(code_mirror_box, css) {\n var identifier = \"_\" + css\n if (identifier in code_mirror_box) {\n var lineHandle = code_mirror_box[identifier]\n code_mirror_box.removeLineClass(lineHandle, \"background\", css);\n }\n}",
"removeToLineStart() {\n if (this.selection.isEmpty())\n this.selection.selectLineStart();\n if (this.selection.isEmpty())\n this.selection.selectLeft();\n this.session.remove(this.getSelectionRange());\n this.clearSelection();\n }",
"function disable() {\n mouse_highlight.destroy();\n}",
"function mouseoutTrainLine() {\n var lineID = d3.select(this).attr(\"id\");\n\n var circleID = lineID.replace(\"line\", \"circle\");\n var circle = d3.select(\"#\" + circleID);\n\n circle\n .transition().duration(200)\n .attr(\"r\", 2);\n if (!editting) {\n popup.style(\"visibility\", \"hidden\");\n popupRect.style(\"visibility\", \"hidden\");\n popupOpen = false;\n }\n}",
"function deleteAndRaiseFN() {\n let sel = $('#' + $('.selected').attr('id'));\n let pos = sel.offset();\n let subTree = sel.detach();\n $('#' + sel.attr('line-target')).remove();\n subTree.appendTo('body');\n sel.css({\n 'top' : pos.top,\n 'left' : pos.left\n });\n calc_all_lines('#' + sel.attr('id'));\n }",
"function getDeletedLine(event) {\n const isDeleted =\n event.changes[0].text === '' && event.changes[0].range.endColumn === 1;\n return isDeleted ? event.changes[0].range.endLineNumber : 0;\n }",
"function updateTooltip() {\n d3.selectAll('.mouse-per-line')\n .remove();\n }",
"deleteLine(ev){\n this.nameTarget(`lineCell-${ev.target.parentElement.id}`).remove()\n }",
"deleteLine(ev){\n this.nameTarget(`lineCell-${ev.target.parentElement.id}`).remove()\n }",
"doNotDisplayLineText() {\r\n this._ignoredLine = true;\r\n }",
"function handleClick(event)\n {\n if($(_consoleSelector)[0].selectionStart <= _eraseLimit || $(_consoleSelector)[0].selectionEnd <= _eraseLimit)\n {\n $(_consoleSelector)[0].selectionStart = _eraseLimit;\n $(_consoleSelector)[0].selectionEnd = _eraseLimit;\n }\t\n }",
"removeToLineEnd() {\n if (this.selection.isEmpty())\n this.selection.selectLineEnd();\n\n var range = this.getSelectionRange();\n if (range.start.column == range.end.column && range.start.row == range.end.row) {\n range.end.column = 0;\n range.end.row++;\n }\n\n this.session.remove(range);\n this.clearSelection();\n }",
"function ae(e){var t=e.markedSpans;if(t){for(var a=0;a<t.length;++a)t[a].marker.detachLine(e);e.markedSpans=null}}",
"function lineMouseOut(l, i) {\n var major = getMajorAsClass(l[0].major);\n\n changeElementOpacityForDifferentMajors(\"vis2-line\", major, '1');\n changeElementOpacityForDifferentMajors(\"vis2-dot\", major, '1');\n\n div.transition()\n .duration(100)\n .style(\"opacity\", 0);\n}",
"function lineMouseOutHandler() {\n for (i = 0; i < dynamicFileList.length; i++) {\n var id = filenameToId(dynamicFileList[i]);\n if (\"line\" + id != this.id) {\n turnOn(filenameToId(dynamicFileList[i]), colorMap.get(id));\n\n }\n }\n}",
"function cleanUpLine(line) {\r\n line.parent = null;\r\n detachMarkedSpans(line);\r\n}",
"function lineMouseOverHandler() {\n for (i = 0; i < dynamicFileList.length; i++) {\n var id = filenameToId(dynamicFileList[i]);\n if (\"line\" + id != this.id) {\n turnOff(filenameToId(dynamicFileList[i]));\n }\n }\n}",
"function handleMouseout(e){\n\t\t\t\tlet code = e.currentTarget.getAttribute(\"data-code\");\n\t\t\t\tdocument.querySelectorAll(`[data-code=${code}]`).forEach(el => {\n\t\t\t\t\tel.removeAttribute(\"stroke\");\n\t\t\t\t\tel.removeAttribute(\"stroke-width\");\n\t\t\t\t});\n\t\t\t\toutput.innerHTML = \"\";\n\t\t\t}",
"function nodeOutFunction() {\n tooltip.style(\"visibility\", \"hidden\")\n if (clicked_node == null) {\n clearHighlights();\n node_tooltip.style(\"visibility\", \"hidden\")\n }\n highlight_layer.select('#current-node').remove()\n}",
"resetDrawLines() {\n var ctx = this.modal_ctx;\n \n for (var dl of this.drawlines) {\n ctx.editor.removeDrawLine(dl);\n }\n \n this.drawlines.length = 0;\n }",
"function cleanUpLine(line) {\n line.parent = null\n detachMarkedSpans(line)\n}",
"function cleanUpLine(line) {\n line.parent = null\n detachMarkedSpans(line)\n}",
"_treeNodeEditLostFocus(e) {\n e.preventDefault();\n const seltext = e.currentTarget.nextElementSibling;\n seltext.removeAttribute('hidden');\n e.currentTarget.setAttribute('hidden', '');\n }",
"function deselectInkwell()\n{\n // De-highlight any previously highlighted inkwell...\n if (selectedInkwell)\n selectedInkwell.style.strokeDasharray = null;\n\n // Stop remembering the inkwell...\n selectedInkwell = null;\n}"
] |
[
"0.6328683",
"0.63186103",
"0.622773",
"0.6204096",
"0.6202259",
"0.6202259",
"0.6109514",
"0.6082548",
"0.5948113",
"0.5938224",
"0.59150827",
"0.58933675",
"0.5865645",
"0.58542687",
"0.58542687",
"0.5800403",
"0.5773268",
"0.57700723",
"0.5767764",
"0.57254225",
"0.5677842",
"0.5673657",
"0.56544775",
"0.5631028",
"0.56255573",
"0.5621427",
"0.5605511",
"0.5605511",
"0.5602476",
"0.55963135"
] |
0.6563106
|
1
|
write to Google API in batch to respect rate limits
|
function batchWriteToDrive(oauth2Client){
//Google Sheet API Quota: 100req/100s per user.
if (queue.length > 0){
writeToDrive(oauth2Client);
}
setTimeout(function(){
batchWriteToDrive(oauth2Client)
},3000
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function doBatchWrite(batch) {\r\n\r\n let requestBatch = batch.map(function (item) {\r\n return {\r\n PutRequest: {\r\n Item: item\r\n }\r\n };\r\n });\r\n\r\n let params = {\r\n RequestItems: {}\r\n };\r\n\r\n params.RequestItems[tableName] = requestBatch;\r\n\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n const toResolve = docClient.batchWrite(params).promise()\r\n .then(data => {\r\n return data;\r\n });\r\n\r\n resolve(toResolve)\r\n }, writeDelay);\r\n })\r\n }",
"async _writev(chunks, next) {\n const body = chunks\n .map(chunk => chunk.chunk)\n .reduce((arr, obj) => {\n if (this.config.usePartialUpdate) {\n arr.push({ update: { _id: this.idFn(obj) } })\n arr.push({ doc: obj, doc_as_upsert : true })\n } else {\n arr.push({ index: { _id: this.idFn(obj) } })\n arr.push(obj)\n }\n return arr\n }, [])\n debug.extend('_writev')(`writing ${chunks.length} records`)\n\n /**\n * Push the array of actions to ES and indicate that we are ready for the next\n * one. Be sure to propagate any errors:\n */\n\n try {\n await this.client.bulk({\n index: this.config.index,\n type: this.config.type,\n refresh: this.config.refresh,\n body\n })\n this.written += chunks.length\n this.logRate()\n next()\n } catch(err) {\n next(err)\n }\n }",
"writeBatch(callback: WriteCallback): void {\n const batch = this.batch;\n // reset the instance batch\n this.batch = [];\n const tx = this.db.transaction(this.objectStore, \"readwrite\");\n const store = tx.objectStore(this.objectStore);\n for (const item of batch) {\n const toInsert = this.options.extra ? { ...item, ...this.options.extra } : item;\n store.put(toInsert);\n }\n // use setTimeout to yield the thread a bit - even with their quasi-asyncness\n // node streams can sometimes cause a bit too much throughput pressure on writes\n tx.complete.then(() => setTimeout(callback, 1)).catch(callback);\n }",
"function sendBatch(batch)\n{\n var sendRequest = true;\n var attemptNo = 1;\n // While we want to keep making request, please keep making requests. We use the async\n // library here rather than a straight up while loop. This is necessary because the AWS\n // batchWriteItem is async and would cause an ordinary while loop to make repeated same-requests.\n async.whilst(\n // Test function;\n function()\n {\n return attemptNo < 3 && sendRequest;\n },\n // Function to call each time test function passes. This function will be called\n // until the batchWriteItem callback returns no unprocessed items.\n function(cb)\n {\n attemptNo++;\n\n // Request parameters.\n var params = {\n ReturnConsumedCapacity: \"TOTAL\",\n RequestItems: {}\n };\n params.RequestItems[batch.table] = batch.batch;\n\n dynDb.batchWriteItem(params, function(error, awsResults)\n {\n // There is an error. Stop processing immediately.\n if (error)\n {\n log(\"AWS batch write request errored: \" + error);\n log(\"Batch contained \" + batch.batch.length + \" items\");\n sendRequest = false; // Remove this line to make multiple attempts.\n cb();\n return;\n }\n\n // No error. Please continue.\n awsData = awsResults.unprocessedItems;\n // Test the data response. If there are no more unprocessed items,\n // signify that we do not wish to continue making AWS calls.\n if (!awsResults.unprocessedItems) sendRequest = false;\n // We have finished. call the callback.\n cb();\n });\n },\n // Function to call when repeated execution of main function has ceased.\n function(error)\n {\n if (error) log (error);\n }\n );\n}",
"batchPut(table, ) {\n var params = {\n RequestItems: { // A map of TableName to Put or Delete requests for that table\n table_name_1: [ // a list of Put or Delete requests for that table\n { // An example PutRequest\n PutRequest: {\n Item: { // a map of attribute name to AttributeValue \n attribute_name: attribute_value,\n // attribute_value (string | number | boolean | null | Binary | DynamoDBSet | Array | Object)\n // ... more attributes ...\n }\n }\n },\n { // An example DeleteRequest\n DeleteRequest: {\n Key: { \n key_attribute_name: attribute_value, //(string | number | boolean | null | Binary)\n // more primary attributes (if the primary key is hash/range schema)\n }\n }\n },\n // ... more put or delete requests ...\n ],\n // ... more tables ...\n },\n ReturnConsumedCapacity: 'NONE', // optional (NONE | TOTAL | INDEXES)\n ReturnItemCollectionMetrics: 'NONE', // optional (NONE | SIZE)\n };\n docClient.batchWrite(params).promise();\n }",
"function writeToDrive(oauth2Client){\n var data=queue;\n //SPREADSHEET: 1lUstzodzzziKhnLtvcnRhBhKO0sDKOr3yObSDPLplsI\n var sheets = google.sheets('v4');\n var request = {\n spreadsheetId: '1lUstzodzzziKhnLtvcnRhBhKO0sDKOr3yObSDPLplsI', //TODO it should be dynamic and created as needed when data grows\n range: 'Sheet1',\n includeValuesInResponse: 'true',\n valueInputOption: 'USER_ENTERED',\n insertDataOption: 'INSERT_ROWS',\n resource:{\n \"values\": data\n },\n auth: oauth2Client\n };\n\n // sheets.spreadsheets.values.get({spreadsheetId: '1lUstzodzzziKhnLtvcnRhBhKO0sDKOr3yObSDPLplsI',\n // range: 'Sheet1',auth: oauth2Client}, function(err, response){\n // if (err) {\n // console.error(err);\n // return;\n // }\n // }\n // );\n\n console.log(\"%s Writing %s rows to Google drives\",new Date().toISOString(),data.length);\n sheets.spreadsheets.values.append(request, function(err, response) {\n if (err) {\n console.error(err);\n return;\n }\n queue=queue.slice(data.length,queue.length);\n console.log(\"%s remaining rows in the queue:%s\",new Date().toISOString(),queue.length);\n }\n );\n}",
"_bulkSave() {\n let { _saveQueue: saveQueue } = this;\n\n let promises = array();\n for (let i in saveQueue) {\n promises.push(this.add(i, saveQueue[i]));\n saveQueue[i] = array();\n }\n\n return Promise.all(promises, 'indexedDb/_bulkSave');\n }",
"function writeManyRecords() {\n var conn = Jdbc.getCloudSqlConnection(dbUrl, user, userPwd);\n conn.setAutoCommit(false);\n\n var start = new Date();\n var stmt = conn.prepareStatement('INSERT INTO entries ' +\n '(guestName, content) values (?, ?)');\n for (var i = 0; i < 500; i++) {\n stmt.setString(1, 'Name ' + i);\n stmt.setString(2, 'Hello, world ' + i);\n stmt.addBatch();\n }\n\n var batch = stmt.executeBatch();\n conn.commit();\n conn.close();\n\n var end = new Date();\n Logger.log('Time elapsed: %sms for %s rows.', end - start, batch.length);\n}",
"async sendBatch(batch) {\n // We create the errors here to capture the stack traces at this point,\n // the async call that follows would probably loose of the stack trace\n const error = new errors_2.ProviderError(\"HttpProviderError\", -1);\n // we need this to sort the responses\n const idToIndexMap = {};\n const requests = batch.map((r, i) => {\n const jsonRpcRequest = this._getJsonRpcRequest(r.method, r.params);\n idToIndexMap[jsonRpcRequest.id] = i;\n return jsonRpcRequest;\n });\n const jsonRpcResponses = await this._fetchJsonRpcResponse(requests);\n for (const response of jsonRpcResponses) {\n if (isErrorResponse(response)) {\n error.message = response.error.message;\n error.code = response.error.code;\n error.data = response.error.data;\n // eslint-disable-next-line @nomiclabs/only-hardhat-error\n throw error;\n }\n }\n // We already know that it has this type, but TS can't infer it.\n const responses = jsonRpcResponses;\n // we use the id to sort the responses so that they match the order of the requests\n const sortedResponses = responses\n .map((response) => [idToIndexMap[response.id], response.result])\n .sort(([indexA], [indexB]) => indexA - indexB)\n .map(([, result]) => result);\n return sortedResponses;\n }",
"function batchRequest(){\n // Use the lower value of items left in the link array or maxRequests\n var total = (linkArr.length-1 > maxRequests) ? maxRequests : linkArr.length-1;\n for(var i = 0; i<= total; i++) {\n qwest.get(endPoint+encodeURIComponent(linkArr[0]))\n .then(function(response) {\n apiActions.response({pageURL: response.url, report: response.data});\n })\n .catch(function(e, response) {\n console.log('>> Error: ', e, '\\nResponse: ', response);\n })\n // Remove the head from the array\n linkArr.shift();\n }\n\n // Batch request again if there's anything left in the array\n if(linkArr.length > 0) {\n setTimeout(function() {\n batchRequest();\n }, 30*1000);\n }\n}",
"batchWriteParams(_items,options={},params={},meta) {\n // Convert items to array\n let items = (Array.isArray(_items) ? _items : [_items]).filter(x => x) \n\n // Error on no items\n if (items.length === 0)\n error(`No items supplied`)\n\n const {\n capacity,\n metrics,\n ..._args\n } = options\n\n // Remove other valid options from options\n const args = Object.keys(_args).filter(x => !['execute','parse'].includes(x))\n\n // Error on extraneous arguments\n if (args.length > 0)\n error(`Invalid batchWrite options: ${args.join(', ')}`)\n\n // Verify capacity\n if (capacity !== undefined\n && (typeof capacity !== 'string' || !['NONE','TOTAL','INDEXES'].includes(capacity.toUpperCase())))\n error(`'capacity' must be one of 'NONE','TOTAL', OR 'INDEXES'`)\n\n // Verify metrics\n if (metrics !== undefined\n && (typeof metrics !== 'string' || !['NONE','SIZE'].includes(metrics.toUpperCase())))\n error(`'metrics' must be one of 'NONE' OR 'SIZE'`)\n\n // Init RequestItems\n const RequestItems = {}\n \n // Loop through items\n for (const i in items) {\n const item = items[i]\n const table = Object.keys(item)[0]\n\n // Create a table property with an empty array if it doesn't exist\n if (!RequestItems[table]) RequestItems[table] = []\n\n // TODO: Add some validation here?\n\n // Push request onto the table array\n RequestItems[table].push(item[table]) \n }\n\n const payload = Object.assign(\n { RequestItems },\n capacity ? { ReturnConsumedCapacity: capacity.toUpperCase() } : null,\n metrics ? { ReturnItemCollectionMetrics: metrics.toUpperCase() } : null,\n typeof params === 'object' ? params : null\n )\n \n const Tables = {}\n return meta ? { payload, Tables } : payload\n\n }",
"function runBatchGC() {\r\n\r\n if (TheRGC.length == 0) {\r\n console.log(\"nothing to batch geocode\"); // eslint-disable-line no-console\r\n return;\r\n }\r\n\r\n let url = [\"https://batch.geocoder.ls.hereapi.com/6.2/jobs?\",\r\n \"apiKey=\", API_KEY,\r\n \"&mode=retrieveAddresses\",\r\n \"&action=run\",\r\n \"&header=true\",\r\n \"&inDelim=|\",\r\n \"&outDelim=|&outCols=city,county,district,country\",\r\n \"&outputcombined=true\",\r\n \"&language=en\"\r\n ].join(\"\");\r\n\r\n let i = 0;\r\n let body = \"recId|prox\\n\" + TheRGC.map(elt => {\r\n return `${i++}|${elt.latlng}`;\r\n }).join(\"\\n\");\r\n\r\n\r\n\r\n request.post(url)\r\n .send(body)\r\n .set(\"Content-Type\", \"text/plain\")\r\n // .set('Accept', 'application/xml')\r\n .then(res => {\r\n let result = res.body.toString();\r\n\r\n //console.log(result);\r\n // extrait ReqestId\r\n const gid = findXmlTag(result, \"RequestId\");\r\n if (!gid) {\r\n console.error(\"No RequestId found\");\r\n return;\r\n }\r\n console.log(); // eslint-disable-line no-console\r\n console.log(`${TheRGC.length} reverse geocodes sent`); // eslint-disable-line no-console\r\n console.log(`to check status: node plex-place.js -c ${gid} `); // eslint-disable-line no-console\r\n\r\n // write temp file with the request to batch geocoder\r\n const matching = TheRGC.map(elt => elt.ids).join(\"\\n\");\r\n const fileOut = gid2Filename(gid);\r\n fs.writeFile(fileOut, matching, (err) => {\r\n if (err) throw err;\r\n });\r\n })\r\n .catch(err => {\r\n console.error(\"Error requesting batch geocode\", err.message);\r\n });\r\n\r\n}",
"function insertAndGetBatch() {\n var docs = [];\n ['foo', 'bar', 'la', 'bamba'].forEach(function (val) {\n docs.push({value: val});\n });\n\n return dataDb.saveAsync(docs)\n .then(function () {\n return dataDb.viewAsync('data/byValue', {keys: ['foo', 'bar'], limit: 10});\n });\n}",
"_write(chunk: any, encoding: string, callback: WriteCallback) {\n this.batch.push(chunk);\n this.total++;\n if (this.batch.length < (this.options.batchSize || DEFAULT_BATCH_SIZE)) {\n // can handle more data immediately\n callback();\n return;\n }\n // cannot handle more data until transaction completes\n this.writeBatch(callback);\n }",
"static async createBatch() {\n return admin.firestore().batch();\n }",
"async _write(body, enc, next) {\n debug.extend('_write')('writing 1 record')\n\n /**\n * Push the object to ES and indicate that we are ready for the next one.\n * Be sure to propagate any errors:\n */\n\n try {\n await this.client.index({\n index: this.config.index,\n type: this.config.type,\n id: this.idFn(body),\n refresh: this.config.refresh,\n body\n })\n this.written++\n this.logRate()\n next()\n } catch(err) {\n next(err)\n }\n }",
"async fetchDetailsAndWriteIntoLocalFile(params) {\n const oThis = this;\n\n let startOffset = params.startOffset;\n\t\t\t\tlet endOffset = params.endOffset;\n\t\t\t\tlet batchNumber = params.batchNumber;\n\t\t\t\tlet lastProcessTime = params.lastProcessTime;\n\t\t\t\tlet fileName = oThis.localDirFullFilePath + \"/\" + batchNumber + \"_\" + Date.now() + '.csv';\n\t\t\t\tlet offset = startOffset;\n\n\t\t\t\tconsole.info(oThis.model.tableName, \"- started fetchDetailsAndWriteIntoLocalFile for batch\", batchNumber);\n\n let records;\n let totalRecordProcessed = 0;\n\n let localWriteObj = new localWrite({separator: \"|\"});\n let arrayOfList = [];\n const recordsToWriteOnce = 1000;\n\n while (offset < endOffset) {\n\n\t\t\t\t\tlet limit = oThis.mysqlLimit > (endOffset - offset) ? (endOffset - offset) : oThis.mysqlLimit;\n\n records = await oThis.model.fetchData({\n\t\t\t\t\t\t\t\tlastProcessTime: lastProcessTime,\n\t\t\t\t\t\t\t\tlimit: limit,\n offset: offset\n });\n\n\t\t\t\t\t\ttotalRecordProcessed += records.length;\n\n if (totalRecordProcessed >= recordsToWriteOnce) {\n totalRecordProcessed = 0;\n fileName = oThis.localDirFullFilePath + \"/\" + batchNumber + \"_\" + Date.now() + '.csv';\n }\n\n let r = oThis.formatData(records);\n\n if (!r.success) {\n return r;\n }\n\n arrayOfList = r.data.arrayOfList;\n if (arrayOfList.length > 0) {\n\t\t\t\t\t\t\tawait localWriteObj.writeArray(arrayOfList, fileName);\n }\n\n if (arrayOfList.length < limit) {\n return Promise.resolve(responseHelper.successWithData({hasRows: true}));\n }\n\t\t\t\t\toffset += limit;\n }\n\n }",
"function writeMultipleRows() {\n var data = getOrdersData();\n var lastRow = SpreadsheetApp.getActiveSheet().getLastRow();\n SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,1,data.length, data[0].length).setValues(data);\n}",
"batchInsert(tableName, insertItems) {\n // creating the params object\n let params = {\n RequestItems: {}\n };\n let icount = 0;\n let recursive = false;\n const BreakException = {};\n \n // const mapExceptions = { types: { public: 'B', private: 'B' } };\n \n params.RequestItems[tableName] = [];\n \n // processing the items to insert\n // const putRequests = [];\n \n if(insertItems.length > 25) {\n recursive = true;\n }\n \n try {\n insertItems.forEach(item => {\n let request = {\n PutRequest: {\n Item: {}\n }\n };\n \n request.PutRequest.Item['id'] = { 'S': item.key };\n // delete item.key;\n \n let forBinary = {};\n \n let cleanItem = this.cleanObject(item);\n // this.logger.debug(JSON.stringify(item));\n \n request.PutRequest.Item = { ...request.PutRequest.Item, ...attr.wrap(cleanItem) };\n // this.logger.debug(JSON.stringify(request.PutRequest.Item)); process.exit();\n // adding each insert request object\n params.RequestItems[tableName].push(request);\n icount++;\n \n // removing current item from insertItems\n let index = insertItems.findIndex(element => {\n return _.isEqual(element, item);\n });\n \n if(index > -1) {\n insertItems = insertItems.slice(index+1);\n }\n \n if(icount >= 25) {\n // insertItems = insertItems.slice(24);\n icount = 0;\n throw BreakException;\n }\n });\n } catch(e) {\n if (e !== BreakException) throw e;\n }\n \n // this.logger.debug(JSON.stringify(params)); process.exit();\n // console.log(insertItems.length, params.RequestItems[tableName].length); process.exit();\n // this.logger.debug(JSON.stringify(params)); process.exit();\n // this.logger.debug(JSON.stringify(params));\n \n // after generates all the params, then batch to save\n this.dynamodb.batchWriteItem(params, (err, data) => {\n if(err) {\n this.logger.debug(\"Error inserting data. JSON Error: \" + JSON.stringify(err));\n process.exit(1);\n } else {\n if(recursive) {\n this.logger.info('Batch inserted!');\n // this.logger.info('New insert:::::::::::::::');\n // this.logger.debug(JSON.stringify(insertItems));\n this.batchInsert(tableName, insertItems);\n } else {\n this.logger.info('Success: ', data);\n this.logger.info('END the work!');\n process.exit();\n }\n }\n });\n }",
"function SPHttpClientBatch(serviceScope, batchCreationOptions) {\r\n var _this = this;\r\n this._batchedRequests = [];\r\n serviceScope.whenFinished(function () {\r\n _this._fetchProvider = serviceScope.consume(fetchProviderServiceKey);\r\n _this._randomNumberGenerator = serviceScope.consume(RandomNumberGenerator.serviceKey);\r\n _this._digestCache = serviceScope.consume(DigestCache.serviceKey);\r\n });\r\n }",
"_final(callback: WriteCallback) {\n this.writeBatch(callback);\n }",
"function doBatchDelete(batch) {\r\n\r\n const requestBatch = buffer.nextKeys.map((keyVal) => {\r\n return {\r\n DeleteRequest: {\r\n Key: { [keyString]: keyVal }\r\n }\r\n };\r\n });\r\n\r\n let params = {\r\n RequestItems: {}\r\n };\r\n\r\n params.RequestItems[tableName] = requestBatch;\r\n\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n const toResolve = docClient.batchWrite(params).promise()\r\n .then(data => {\r\n return data;\r\n });\r\n\r\n resolve(toResolve)\r\n }, writeDelay);\r\n })\r\n }",
"async flush() {\n if (this._timer) {\n clearTimeout(this._timer);\n delete this._timer;\n }\n const batch = this._requests;\n const batchSize = batch.length;\n const deferred = this._onFlush;\n this._requests = [];\n this.numPendingRequests -= batchSize;\n delete this._onFlush;\n try {\n await this._sendBatch(batch);\n }\n catch (e) {\n this._subscriber.emit('error', e);\n }\n if (deferred) {\n deferred.resolve();\n }\n }",
"async batchMinedPayments( )\n {\n var self = this ;\n\n var unbatched_pmnts = await self.mongoInterface.findAll('balance_payment',{batchId: null})\n\n\n var batchedPayments = 0;\n\n\n const MIN_PAYMENTS_IN_BATCH = 5; //5\n\n if( unbatched_pmnts.length >= MIN_PAYMENTS_IN_BATCH)\n {\n\n\n var batchData = {\n id: web3utils.randomHex(32),\n confirmed: false\n }\n\n await self.mongoInterface.upsertOne('payment_batch',{id: batchData.id}, batchData )\n\n\n\n var paymentsToBatch = unbatched_pmnts.slice(0,25) //max to batch is 25\n\n for( var element of paymentsToBatch ) {\n\n element.batchId = batchData.id;\n\n await self.mongoInterface.upsertOne('balance_payment',{id: element.id}, element )\n\n batchedPayments++;\n\n }\n\n\n }\n\n return {success:true,batchedPayments:batchedPayments} ;\n }",
"function doBulkWrite(db) {\n const data = request.body.data;\n const bulkPromises = [];\n\n for (var collectionName in data) {\n var promise = getBulkWritePromise(db, collectionName, data);\n bulkPromises.push(promise);\n }\n\n return Promise.all(bulkPromises);\n }",
"function gdriveUpload(reader, file, chunk, chunkIdx, data, callNb) {\n // Create a new file with the name provided inside the 'data' buffer\n var uri = 'https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart';\n var requestMessage = Windows.Web.Http.HttpRequestMessage(Windows.Web.Http.HttpMethod.post, new Windows.Foundation.Uri(uri));\n var httpClient = new Windows.Web.Http.HttpClient();\n if (callNb == undefined) {\n callNb = 0;\n }\n requestMessage.content = new Windows.Web.Http.HttpBufferContent(data);\n requestMessage.content.headers.append('Content-Type', 'multipart/related; boundary=trustydrive_separator');\n requestMessage.headers.append('Authorization', 'Bearer ' + chunk.provider.token);\n httpClient.sendRequestAsync(requestMessage).then(function (success) {\n if (success.isSuccessStatusCode) {\n success.content.readAsStringAsync().then(function (jsonInfo) {\n chunk.info[chunkIdx]['id'] = $.parseJSON(jsonInfo)['id'];\n uploadComplete(reader, file);\n });\n } else {\n if (callNb < 5) {\n setTimeout(function () {\n gdriveUpload(reader, file, chunk, chunkIdx, data, callNb + 1);\n }, 1000);\n }\n }\n });\n}",
"function postBulkDataToThingSpeak(bulkData) {\r\n // Build the post string from the given data object\r\n var postData = {\r\n \"write_api_key\" : ThingSpeakSensorWritekey,\r\n \"time_format\" : \"relative\",\r\n \"updates\" : bulkData\r\n };\r\n var postDataStr = JSON.stringify(postData);\r\n \r\n // An object of options to indicate where to post to\r\n var post_options = {\r\n host: 'api.thingspeak.com',\r\n port: '80',\r\n path: '/channels/8203/bulk_update.json',\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Content-Length': Buffer.byteLength(postDataStr)\r\n }\r\n };\r\n\r\n // Set up the request\r\n var post_req = http.request(post_options, function(res) {\r\n res.setEncoding('utf8');\r\n res.on('data', function (chunk) {\r\n console.log('Response: ' + chunk);\r\n });\r\n });\r\n \r\n // post the data\r\n console.log(\"Posting: \" + postDataStr);\r\n post_req.write(postDataStr);\r\n post_req.end();\r\n}",
"async scheduledFlush() {\n for (let k in this.buffers) {\n const buffer = this.buffers[k];\n if (buffer.rec_count !== 0 && buffer.time_limit >0 && new Date(buffer.created.getTime() + 1000 * buffer.time_limit) <= new Date()) {\n await this.close(buffer.domain, buffer.namespace);\n if (!this.shuttingDown) await this.open(buffer.domain, buffer.namespace, buffer.size_limit, buffer.time_limit);\n }\n }\n await this.upload();\n }",
"async function batchYouTubeRequest({ endpoint, ids, playlistIds, ...options }) {\n let idField = 'id';\n let batchSize = MAX_YOUTUBE_BATCH_SIZE;\n const [model, action] = endpoint.split('.');\n const apiOptions = { ...options };\n let response;\n\n // Only the playlists endpoint can't accept batches of IDs and uses a different field name\n if (playlistIds) {\n batchSize = 1;\n idField = 'playlistId';\n ids = playlistIds;\n }\n\n const quotaCost =\n options.part.split(',').reduce((acc, part) => acc + partQuotas[part], 1) *\n Math.ceil(ids.length / batchSize);\n\n const message = `YouTube API quota used for ${endpoint}: ${quotaCost}`;\n logMessage({\n message,\n scope: 'batchYouTubeRequest',\n expiresIn: { days: 60 },\n metaData: { endpoint, quotaCost }\n });\n\n // Loop through each batch of updates (wrap async map in Promise.all())\n return (\n await Promise.all(\n chunks(ids, batchSize).map(async (chunk) => {\n apiOptions[idField] = chunk.join(',');\n\n debug(`batchYouTubeRequest to ${endpoint}`, apiOptions);\n try {\n response = await youtube[model][action](apiOptions);\n } catch (err) {\n throw new APIError(500, `YouTube API error calling ${endpoint} (${err.message})`);\n }\n\n return response.data.items;\n })\n )\n ).flat();\n}",
"function gdriveUpdate(reader, file, chunk, chunkIdx, data, callNb) {\n // Update the content of an existing file from its ID\n var uri = 'https://www.googleapis.com/upload/drive/v3/files/' + chunk.info[chunkIdx].id + '?uploadType=media';\n var requestMessage = Windows.Web.Http.HttpRequestMessage(Windows.Web.Http.HttpMethod.patch, new Windows.Foundation.Uri(uri));\n var httpClient = new Windows.Web.Http.HttpClient();\n if (callNb == undefined) {\n callNb = 0;\n }\n requestMessage.content = new Windows.Web.Http.HttpBufferContent(data);\n requestMessage.content.headers.append('Content-Type', 'application/octet-stream');\n requestMessage.headers.append('Authorization', 'Bearer ' + chunk.provider.token);\n httpClient.sendRequestAsync(requestMessage).then(function (success) {\n if (success.isSuccessStatusCode) {\n uploadComplete(reader, file);\n } else {\n if (callNb < 5) {\n setTimeout(function () {\n gdriveUpdate(reader, file, chunk, chunkIdx, data, callNb + 1);\n }, 1000);\n }\n }\n });\n}"
] |
[
"0.7247172",
"0.6488182",
"0.6431659",
"0.6353969",
"0.62039834",
"0.6197206",
"0.604436",
"0.59201676",
"0.58174837",
"0.57005084",
"0.56742567",
"0.5663563",
"0.5654786",
"0.5646171",
"0.55959135",
"0.55823845",
"0.55812925",
"0.5573223",
"0.55704427",
"0.55629694",
"0.5561079",
"0.5525359",
"0.5522533",
"0.55015516",
"0.54882663",
"0.54791504",
"0.5466293",
"0.5431319",
"0.5429324",
"0.54009527"
] |
0.7140714
|
1
|
renders todo details in modal
|
function renderModalTodo(todo) {
todo = $(todo);
var id = todo.attr('data-id'),
title = todo.attr('data-title'),
priority = todo.attr('data-priority'),
details = todo.attr('data-details'),
created = todo.attr('data-created'),
elapsed = parseInt(todo.attr('data-elapsed')),
finish = todo.attr('data-finish'),
complete = todo.attr('data-complete'),
duration = getDuration(created, elapsed);
modalTodo.find('.modal-header').text(title + " - ");
modalTodo.find('.modal-header').append(
'<span class="'+priority+'-text">'+
priority+
'</span>'+
'<button class="right waves-effect waves-light btn"><i class="material-icons">play_arrow</i></button>'
);
var html =
'<h5>'+
details+
'</h5>'+
'<table>'+
'<tbody>'+
'<tr>'+
'<td>Elapsed time</td>'+
'<td>'+duration+'</td>'+
'</tr>'+
'<tr>'+
'<td>Created</td>'+
'<td>'+moment(created).format("DD/MM/YY, HH:MM:SS")+'</td>'+
'</tr>'+
'<tr>'+
'<td>Finish by</td>'+
'<td>'+moment(finish).format("DD/MM/YY, HH:MM:SS")+'</td>'+
'</tr>'+
'</tbody>'+
'</table>'
;
modalTodo.find('.modal-details').html(html);
modalTodo.find('#trigger-edit').attr('data-id', id);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function renderModalEdit(todo) {\n\t\tvar form = $('#form-todo-edit');\n\t\t\n\t\tvar id = todo.attr('data-id'),\n\t\t\t\ttitle = todo.attr('data-title'),\n\t\t\t\tpriority = todo.attr('data-priority'),\n\t\t\t\tdetails = todo.attr('data-details'),\n\t\t\t\tcreated = todo.attr('data-created'),\n\t\t\t\telapsed = parseInt(todo.attr('data-elapsed')),\n\t\t\t\tfinish = todo.attr('data-finish'),\n\t\t\t\tcomplete = todo.attr('data-complete'),\n\t\t\t\tduration = getElapsed(created, elapsed).split(':');\n\t\t\n\t\tform.find('#inputId').val(id);\n\t\tform.find('#inputTitle').val(title);\n\t\tform.find('#inputPriority').val(priority);\n\t\tform.find('#inputDetails').val(details);\n\t\tform.find('#inputDetails').trigger('autoresize');\n\t\tform.find('#inputCreatedDate').val(getDate(created));\n\t\tform.find('#inputCreatedTime').val(getTime(created));\n\t\tform.find('#inputFinishDate').val(getDate(finish));\n\t\tform.find('#inputFinishTime').val(getTime(finish));\n\t\tform.find('#inputElapsedHours').val(duration[0]);\n\t\tform.find('#inputElapsedMinutes').val(duration[1]);\n\t\tform.find('#inputElapsedSeconds').val(duration[2]);\n\t\t\n\t\tMaterialize.updateTextFields();\n\t\t$('select').material_select();\n\t}",
"function renderTodo(todo) {\n\t\tvar html =\n\t\t\t\t'<a class=\"collection-item\" id=\"'+todo.id+'\" href=\"#modal-todo\"'+\n\t\t\t\t\t'data-id=\"'+todo.id+'\"'+\n\t\t\t\t\t'data-title=\"'+todo.title+'\"'+\n\t\t\t\t\t'data-priority=\"'+todo.priority+'\"'+\n\t\t\t\t\t'data-details=\"'+todo.details+'\"'+\n\t\t\t\t\t'data-created=\"'+todo.createdAt+'\"'+\n\t\t\t\t\t'data-elapsed=\"'+todo.elapsedTime+'\"'+\n\t\t\t\t\t'data-finish=\"'+todo.finishAt+'\"'+\n\t\t\t\t\t'data-complete=\"'+todo.isComplete+'\"'+\n\t\t\t\t'>'+\n\t\t\t\t\t'<span class=\"badge '+todo.priority+'\">'+\n\t\t\t\t\t\ttodo.priority+\n\t\t\t\t\t'</span>'+\n\t\t\t\t\ttodo.title+\n\t\t\t\t'</a>';\n\t\tlist.append(html);\n\t}",
"function showTodo(todo) {\n // Our single todo item template, each todo item is a single LI tag\n // Note that you can run functions and methods within the ${} template strings\n\n // console.log(todo)\n\n var todoTemplate = `<li class=\"list-group-item\">\n <div class=\"row\">\n <div class=\"col-xs-8\">\n <div class=\"checkbox\">\n <label>\n <input type=\"checkbox\" data-id=\"${todo.id}\" />\n ${todo.todo}\n </label>\n </div>\n </div>\n <div class=\"col-sm-2 text-right\">\n <span class=\"label label-danger\">${todo.category.toUpperCase()}</span>\n </div>\n <div class=\"col-sm-2 text-right\">\n <span class=\"label label-default\">${moment(todo.due_date).format('MM/DD/YYYY')}</span>\n </div>\n </div>\n </li>`\n\n // Concatenate our single todo item template onto the end of the existing todo items on the page\n todosContainer.innerHTML += todoTemplate\n}",
"function showTodo(todo) {\n console.log(todo.title + ': ' + todo.text);\n}",
"function renderTodo(todo) {\n //store todo items into browser storage.\n localStorage.setItem(\"todoItem\", JSON.stringify(todoItems));\n //get reference of required elements.\n const list = document.querySelector(\".js-todo-list\");\n const item = document.querySelector(`[data-key='${todo.id}']`);\n\n //Runs a check for deleted items and update the DOM.\n if (todo.deleted) {\n item.remove();\n if (todoItems.length === 0) list.innerHTML = \"\";\n return;\n }\n //Evaluate the done state of a todo entry\n const isChecked = todo.checked ? \"done\" : \"\";\n //create a list item that holds todo entry.\n const listItemElement = document.createElement(\"li\");\n\n // set class and data-key attributes to the todo entry.\n listItemElement.setAttribute(\"class\", `todo-item ${isChecked}`);\n listItemElement.setAttribute(\"data-key\", todo.id);\n //populate the todo entry with required values.\n listItemElement.innerHTML = `\n <input id =\"${todo.id}\" type=\"checkbox\"/>\n <label for=\"${todo.id}\" class=\"tick js-tick\"></label>\n <span>${todo.text}</span>\n <button class=\"delete-todo js-delete-todo\">\n ×\n </button>\n `;\n //Run condition to append the created item to the page.\n if (item) {\n list.replaceChild(listItemElement, item);\n }\n else {\n list.append(listItemElement);\n }\n}",
"function renderTodo(todo) {\n //Store todo items into broser storage\n localStorage.setItem(\"todoItems\", JSON.stringify(todoItems));\n //Get reference of required elements\n const list = document.querySelector(\".js-todo-list\");\n const item = document.querySelector(`[data-key='${todo.id}']`);\n //Runs a check for deleted items and update the DOM\n if (todo.deleted) {\n item.remove();\n if (todoItems.length === 0) list.innerHTML = \"\";\n return;\n }\n //Evaluate the done state of a todo entry\n const ischecked = todo.checked ? \"done\" : \"\";\n //create a list item that holds todo entry\n //set clss and data-key attribute to the todo entry\n const listItemElement = document.createElement(\"li\");\n listItemElement.setAttribute(\"class\", `todo-item ${ischecked}`);\n //populate the required the values\n listItemElement.setAttribute(\"data-key\", todo.id);\n listItemElement.innerHTML = `<input id=\"${todo.id}\" type=\"checkbox\"/>\n <label for =\"${todo.id}\" class=\"tick js-tick\"></label>\n <span>${todo.text}</span>\n <button class=\"delete-todo js-delete-todo\">\n ×\n </button>\n `;\n //Run the condition to append the created item to the page\n if (item) {\n list.replaceChild(listItemElement, item);\n } else {\n list.append(listItemElement);\n }\n\n}",
"function render () {\n $toDoList.empty();// empty existing posts from view\n var toDoHtml = getAllToDoHtml(allToDos); // pass `allToDos` into the template function\n $toDoList.append(toDoHtml);// append html to the view\n}",
"function renderTodo(todo) {\n localStorage.setItem('todoItemsRef', JSON.stringify(todoItems));\n const list = document.querySelector('.js-todo-list');\n const item = document.querySelector(`[data-key='${todo.id}']`);\n\n if (todo.deleted) {\n item.remove();\n if (todoItems.length === 0) list.innerHTML = '';\n return\n }\n\n const isChecked = todo.checked ? 'done': '';\n \n const node = document.createElement(\"li\");\n node.setAttribute('class', `todo-item ${isChecked}`);\n node.setAttribute('data-key', todo.id);\n node.innerHTML = `\n <input id=\"${todo.id}\" type=\"checkbox\"/>\n <label for=\"${todo.id}\" class=\"tick js-tick\"></label>\n <span>${todo.text}</span>\n <button class=\"delete-todo js-delete-todo\">\n <svg><use href=\"#delete-icon\"></use></svg>\n </button>\n `;\n\n if (item) {\n list.replaceChild(node, item);\n } else {\n list.append(node);\n }\n}",
"function populateModal(event)\n{\n\t// If the user clicks an li\n\tif(event.target && !event.target.classList.contains(\"checkmark\") && (event.target.nodeName == \"LI\" || event.target.nodeName == \"SPAN\")) \n\t{\n\t\t//Modal content\n\t\tlet modalText = document.querySelectorAll(\".modal-text\")[0];\n\t\t// Get the <span> element that closes the modal\n\t\tlet spanClose = document.querySelectorAll(\".close\")[0];\n\t\tlet list = event.target.closest(\"UL\");\n\t\tlet tasksArray = localStorage.getItem(\"tasks\") ? JSON.parse(localStorage.getItem(\"tasks\")) : [];\n\n\t\tlet taskID = event.target.id.includes(\"task\") ? event.target.id : event.target.parentNode.id;\n\t\tlet targetTask = tasksArray[getTaskIndex(taskID)];\n\t\tlet deleteButton = createHTMLElement(\"button\", \"Delete\", [\"delete-button\"]);\n\t\tlet targetTaskArray = new Array();\n\t\tlet elementText = \"\";\n\n\t\tfor(let key in targetTask)\n\t\t{\n\t\t\t//We check this to prevent printing out the to do's id as it is not necessary\n\t\t\tif(key !== \"to_do_id\")\n\t\t\t{\n\t\t\t\telementText = key !== \"to_do_due_date\" ? targetTask[key] : formatDate(new Date(targetTask[key]));\n\t\t\t\tlet newElement = createHTMLElement(\"p\", elementText, [\"modal-task-attributes\"]);\n\t\t\t\tmodalText.appendChild(newElement);\n\t\t\t\ttargetTaskArray.push(newElement);\n\t\t\t\tmodalText.insertBefore(labelCreator(key, [\"modal-task-label\"]), newElement);\n\t\t\t}\n\t\t}\n\t\t\n\t\tmodalToggle();\n\n\t\tif(!event.target.classList.contains(\"done-list-item\"))\n\t\t{\n\t\t\tlet editButton = createHTMLElement(\"button\", \"Edit\", [\"edit-button\"]);\n\t\t\tmodalText.appendChild(editButton);\n\n\t\t\teditButton.addEventListener(\"click\", function editTask()\n\t\t\t{\n\t\t\t\tmodalText.removeChild(editButton);\n\t\t\t\tmodalText.removeChild(deleteButton);\n\t\t\t\tpopulateEditModal(taskID, targetTaskArray);\n\t\t\t\teditButton.removeEventListener(\"click\", editTask);\n\t\t\t\t\n\t\t\t});\n\t\t}\n\n\t\tmodalText.appendChild(deleteButton);\n\n\t\t//Delete task button\n\t\t//Removes the task from the list, form memory, and removes the event listener that is created when the modal is opened\n\t\tdeleteButton.addEventListener(\"click\", function removeTask()\n\t\t{\n\t\t\tif(confirm(`The event \"${event.target.textContent}\" will be gone forever. Is this ok?`))\n\t\t\t{\n\t\t\t\tlet targetedListItem = document.querySelector(`#${taskID}`);\n\t\t\t\tlist.removeChild(targetedListItem);\n\t\t\t\tremoveTaskFromMemory(tasksArray, taskID);\n\t\t\t\tdeleteButton.removeEventListener(\"click\", removeTask);\n\t\t\t\tmodalToggle();\n\t\t\t}\n\t\t});\n\n\n\t\t// When the user clicks on <span> (x), close the modal\n\t\tspanClose.addEventListener(\"click\",closeModalEvent, event);\n\t\t// When the user clicks anywhere outside of the modal, close it\n\t\twindow.addEventListener(\"click\", closeModalEvent, event);\n\t\t\n\t}\n}",
"function view()\n{\n\t// This function takes care of rendering the to do list\n\t// All UI elements should be added to the \"container\" \n\t// section of the HTML. \n\n\t// get container element by id\n\tvar container = document.getElementById(\"container\");\n\n\tcontainer.innerHTML = \"\";\n\n\t// go through todo list items and add them\n\tfor(var i = 0; i < todos.length; i ++) {\n\t\tvar div = document.createElement('div');\n\n\t\tdiv.className = 'row';\n\n\t\tvar status = '';\n\n\t\tif(todos[i].status == true) {\n\t\t\tstatus = 'checked';\n\t\t}\n\n\t\tdiv.innerHTML = '<input class=\"todoItem\" type=\"checkbox\" onclick=\"updateStatus('+i+')\" '+status+'>\\\n \t\t\t\t\t\t <label for=\"todoItem\">'+todos[i].name+'</label>'+todos[i].completeDate+' \\\n \t\t\t\t\t\t <br>';\n\n\t\tcontainer.appendChild(div);\n\t}\n\t\n\n // clear the text in the input field for todo item\n\tdocument.getElementsByName(\"task\")[0].value = \"\";\n\n}",
"function TaskModal({ onHide, task }) {\n return (\n <>\n <Modal show={true} onHide={onHide}>\n <Modal.Header closeButton>\n <Modal.Title>{task.title}</Modal.Title>\n </Modal.Header>\n <Modal.Body>{task.textBody}</Modal.Body>\n <Modal.Footer>\n <Button variant=\"secondary\" onClick={onHide}>\n Close\n </Button>\n </Modal.Footer>\n </Modal>\n </>\n );\n}",
"function todoView(item) {\n var todoConfig = U({ editing: false });\n var toggleEditing = C(_ => todoConfig.editing = !Boolean(todoConfig.editing));\n var doneEditing = C(_ => todoConfig.editing = false);\n var edit = C(_ => todoConfig.editing = true );\n \n return E('li') .\n is({ class: { completed: item.completed, editing: config.editing} }) .\n has([\n \n E('div#view') . has ([\n E('input') . is({type: 'checkbox'}) . does({click: 0}) . sets(item.completed),\n LABEL(item.title) . does({ doubleclick: edit })\n ]),\n \n E('input.edit') . sets(item.title) . does({ blur: doneEditing })\n ])\n ;\n }",
"function showCreateTodo() {\n $('.form-create-todo').show()\n $('.my-todo').hide()\n $('.project-menu').hide()\n}",
"function openTodoModal() {\n todoModal.style.display = \"block\";\n}",
"function showDetails() {\n const item = this.options.foodTruck;\n\n document.body.insertAdjacentHTML(\n 'afterbegin',\n `<section id=\"modal\" class=\"modal\">\n <h2>${item.name}</h2>\n <p>Sells ${item.product} for ${item.avgPrice} ${ checkPlural(item.avgPrice, 'coin') }.</p>\n <section class=\"queue\">\n <span>${item.queue}</span>\n <p>${ checkPlural(item.queue, 'person') } waiting</p>\n </section>\n <span class=\"close\" onclick=\"hideDetails()\">✕</span>\n </section>`\n );\n}",
"function handleTaskModal() {\n props.openModal('edit task', props.task);\n }",
"function populateTodos(list) {\n \n list.forEach(function(td, idx) {\n $('#todo-lists').prepend(`\n <div class=\"card\">\n <div class=\"card-header\" id=\"heading${idx}\">\n <h2 class=\"mb-0\">\n <div class=\"todo-data row\">\n <div class=\"todo-title col-6\">\n <button class=\"btn btn-link\" type=\"button\" data-toggle=\"collapse\" data-target=\"#collapse${idx}\" aria-expanded=\"true\" aria-controls=\"collapse${idx}\">\n Todo: ${td.name}\n </button>\n </div>\n <div class=\"todo-updel-buttons col-6\">\n <button id=\"\"complete-todo-button class=\"btn btn-info update-todo\" value=\"${td._id}\" dataTarget=\"#updateModal\" data-id=\"${td._id}\" >Complete</button>\n <button class=\"btn btn-danger delete-todo\" value=\"${td._id}\">Delete</button>\n </div>\n </div>\n </h2>\n </div>\n\n <div id=\"collapse${idx}\" class=\"collapse show\" aria-labelledby=\"heading${idx}\" data-parent=\"#todo-lists\">\n <div class=\"card-body row\">\n <div class=\"col-4\">\n <p class=\"\"desc>Description: ${td.description}</p>\n <p class=\"due_date\">Due: ${td.due_date.toString().slice(0, 10)}</p>\n <p class=\"completed-todo\">Completed: ${td.completed}</p>\n </div>\n <div class=\"col-5\">\n <img src=\"${td.qr_link}\">\n </div>\n </div>\n </div>\n </div>\n `)\n })\n}",
"function showTodosInUI() {\n let todos = [];\n if (localStorage.getItem('todos') === null) {\n todos = [];\n } else {\n todos = JSON.parse(localStorage.getItem('todos'));\n }\n todos.forEach(function (todo) {\n const todoDiv = document.createElement('div');\n todoDiv.classList.add('todo');\n //create li\n const newTodo = document.createElement('li');\n newTodo.innerText = todo;\n newTodo.classList.add('todo-item');\n // put newTodo inside the created div\n todoDiv.appendChild(newTodo);\n\n // COMPLETED BUTTON\n const completedBtn = document.createElement('button');\n completedBtn.innerHTML = '<i class=\"fas fa-check\"></i>';\n completedBtn.classList.add('completed-btn');\n //append completed button to the div\n todoDiv.appendChild(completedBtn);\n\n // DELETE BUTTON\n const deleteBtn = document.createElement('button');\n deleteBtn.innerHTML = '<i class=\"fas fa-trash\"></i>';\n deleteBtn.classList.add('delete-btn');\n //append delete button to the div\n todoDiv.appendChild(deleteBtn);\n // APPEND TODO TO LIST\n todoList.appendChild(todoDiv);\n });\n}",
"async function renderNotes(showDone = showDeleted, sortMethode = sortOrder) {\n const notes = await notesService.getNotes(showDone, sortMethode);\n const todoHtml = await createTodosHtml(notes);\n todoElement.innerHTML = '';\n todoElement.innerHTML = todoHtml;\n}",
"function showNotes(event) {\n event.preventDefault();\n\n // Hide the tooltip for this element so that they don't hang\n // around (Resolves display issues with tooltips after showing\n // the notes modal).\n $(this).tooltip('hide');\n\n // Get the article id so we can find any existing notes.\n const article = $(this).parents('.card').data();\n\n // Ask for any existing notes from the backend.\n $.get(`/api/notes/${article.id}`).done((response) => {\n // Construct the interior of the modal.\n const contentWrap = $('<div>').addClass('container-fluid');\n const existingNotes = $('<ul>').addClass(\n 'list-group list-group-flush note-container'\n );\n const contentBreak = $('<hr>').addClass('my-2');\n const newNoteBox = $('<textarea>').addClass('form-control').attr({\n placeholder: 'Write your notes here...',\n rows: 4,\n cols: 50,\n });\n\n contentWrap.append(existingNotes, contentBreak, newNoteBox);\n\n // Use bootbox.js to build and display the bootstrap modal.\n bootbox.dialog({\n closeButton: true,\n onEscape: true,\n show: true,\n title: `<strong>Notes:</strong><br>${article.title}...`,\n message: contentWrap,\n backdrop: true,\n buttons: {\n save: {\n /* eslint-disable max-len */\n label: '<span class=\"fa fa-pencil-alt\"></span> Save Note',\n /* eslint-enable max-len */\n className: 'btn-primary save-note',\n callback: saveNote,\n },\n close: {\n /* eslint-disable max-len */\n label: '<span class=\"fas fa-times\"></span> Close',\n /* eslint-enable max-len */\n className: 'btn-outline-warning',\n callback: function () {\n bootbox.hideAll();\n },\n },\n },\n });\n\n const notes = {\n id: article.id,\n notes: response || [],\n };\n\n // Attach the existing notes and article id to the save button.\n $('.save-note').data('article', notes);\n\n // Populate the list of existing notes or the message that\n // none have been created yet.\n createNoteList(notes);\n });\n }",
"addOne(todo) {\n\t\tvar view = new TodoView({ model: todo });\n\t\tthis.$('#todo-list').append(view.render().el);\n\t}",
"function showTodo(id){\n $('#todoModal').modal('toggle');\n\n $(\"#btnAddTodo\").hide();\n $(\"#btnUpdateTodo\").show();\n $(\"#btnDeleteTodo\").show();\n\n var xhr = new XMLHttpRequest();\n\txhr.onreadystatechange = function(){\n if (xhr.readyState == 4 && xhr.status == 200){\n var response = xhr.responseText;\n var title = JSON.parse(response).title;\n var category = JSON.parse(response).category;\n var description = JSON.parse(response).description;\n\n var parent1 = document.getElementById(\"titleTodo\");\n var parent2 = document.getElementById(\"categoryTodo\");\n var parent3 = document.getElementById(\"descriptionTodo\");\n\n parent1.value = title;\n parent2.value = category;\n parent3.value = description;\n }else{\n }\n }\n xhr.open('POST','./ajax/todo.show.php');\n\txhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n var data = 'id=' +id;\n\txhr.send(data);\n}",
"function displayNotes(notes) {\n $(\"#todo-list\").empty();\n for (var key in notes) {\n var classes = '';\n if(notes[key].status === 'completed') classes += ' strike';\n else if(notes[key].status === 'archived') continue;\n \n var note = $(`\n <li id='toDoListItem' data-uid=\"${key}\">\n <label class=${classes}>\n <input \n type='checkbox' \n name='todo-item-done' \n class='filled-in todo-item-done' \n value='${notes[key].text}'\n data-uid=\"${key}\" />\n ${notes[key].text}\n <button \n class='todo-item-delete waves-effect waves-light btn deleteItemBtn'\n data-uid=\"${key}\">\n Remove\n </button>\n </label>\n </li>\n `);\n $(\"#todo-list\").append(note);\n }\n }",
"function showEditTodoList() {\n hideTodosLayers();\n var listId = document.forms.todoForm.listId.value;\n if (listId != null && listId != \"null\" && listId != \"\") {\n $(\"editListDiv\").style.display=\"inline\";\n todo_lists.getTodoList(listId, replyEditTodoList);\n document.forms.editListForm.name.focus();\n tracker('/ajax/showEditTodoList');\n }\n}",
"async function renderTodo(todo){\n\n const todoIsComplete = todo.complete\n const taskList = todoIsComplete ? completedTodoList : incompleteTodoList;\n const checked = todoIsComplete ? \"checked\" : \"\";\n\n let todoItemHTML = \n `<div class=\"form-check\">\n <label class=\"form-check-label\">\n <input id=\"${todo.id}\" class=\"js-tick\" type=\"checkbox\" ${checked}/>\n ${todo.name}\n </input>\n <p class=\"input-helper\" id=\"incomplete-list\"></p>\n </label>\n\n <div class=\"editicons\">\n <i class=\"remove mdi mdi-close-circle-outline fas fa-edit customeditbutton\"></i>\n <i class=\"remove mdi mdi-close-circle-outline customdeletebutton\"></i>\n </div>\n </div>\n `;\n \n //Add todo to DOM in either the complete or incomplete Task List Depending on variable value\n taskList.insertAdjacentHTML(\"afterbegin\", todoItemHTML)\n \n\n }",
"function renderTodo(items=[]) {\n\t\t\t\tvar item = ``;\n\t\t\t\tfor(var i=0;i<items.length;i++) {\n\t\t\t\t\t\t\t\titem += `\n\t\t\t\t\t\t\t\t\t\t\t\t<li class=\"collection-item\">\n \t\t\t\t\t\t\t\t\t\t\t${items[i]}\n \t\t\t\t\t\t\t\t\t\t\t<a data-id=\"${i}\" href=\"#!\" class=\"secondary-content delete-todo\">\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t <i class=\"material-icons small red-text\">delete</i>\n \t\t\t\t\t\t\t\t\t\t\t</a>\n \t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t`;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tdocument.querySelector(\".list-todoo\").innerHTML = item;\n\t\t\t\t\n\t\t\t\t// Delete todoo\n \t\tconst btnDeleteTodos = Array.from(document.querySelectorAll(\".delete-todo\"));\n \t\tif (btnDeleteTodos != null ) {\t\t\t\n \t\tbtnDeleteTodos.forEach((btn) => {\n \t\t\t\tbtn.addEventListener(\"click\", function() {\n \t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\tconst id = parseInt(this.dataset.id);\n \t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\tSwal.fire({\n \t\t\t\t\t\t\t\t\t\t\t\ttitle: 'Are you sure?',\n \t\t\t\t\t\t\t\t\t\t\t\ttext: \"You won't be able to revert this!\",\n \t\t\t\t\t\t\t\t\t\t\t\ticon: 'warning',\n \t\t\t\t\t\t\t\t\t\t\t\tshowCancelButton: true,\n \t\t\t\t\t\t\t\t\t\t\t\tconfirmButtonColor: '#3085d6',\n \t\t\t\t\t\t\t\t\t\t\t\tcancelButtonColor: '#d33',\n \t\t\t\t\t\t\t\t\t\t\t\tconfirmButtonText: 'Yes, delete it!'\n\t\t\t\t\t\t\t\t\t\t}).then((result) => {\n \t\t\t\t\t\t\t\t\t\t\t\tif (result.isConfirmed) {\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\titems.splice(id, 1);\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tToast.fire({\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon: 'success',\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttitle: \"Your todo has been deleted\"\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderTodo(items);\n \t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n \t\t\t\t\t\t\t\t\n \t\t\t\t});\n \t\t});\n \t\t\t\n \t\t} \n\t\t\t\n}",
"function buildTodo(todo) {\n var todoHtml = '<div class=\"todo\" id=\"'+ todo.title +'\" ><p>' + todo.description\n + '</p>'\n + '<button class=\"delete-todo\">Delete</button></div>';\n\n return todoHtml;\n}",
"function displayNote(noteid, title, note, completed) {\n\tvar idTag, htmlTag;\n\tif (completed == \"0\" || completed == 0){\n\t\tidTag = \"#notCompletedList\";\n\t\thtmlTag = \"<button class='btn btn-info btn-xs' onclick='toggle(\\\"\"+noteid+\"\\\")'>Mark as Complete</button>\";\n\t}else if(completed == \"1\" || completed == 1){\n\t\tidTag = \"#completedList\";\n\t\thtmlTag = \"<button class='btn btn-info btn-xs' onclick='toggle(\\\"\"+noteid+\"\\\")'>Mark as Not Complete</button>\";\n\t}else\n\t\treturn;\n\n\t$(idTag).append(\n\t\t\"<tr id='\"+noteid+\"'>\"+\n\t\t\t\"<td id='title\"+noteid+\"'>\"+title+\"</td>\"+\n\t\t\t\"<td id='note\"+noteid+\"'>\"+note+\"</td>\"+\n\t\t\t\"<td id='completed\"+noteid+\"' value='\"+completed+\"' style='text-align:center;'>\"+\n\t\t\thtmlTag +\n\t\t\t\" <button class='btn btn-default btn-xs' onclick='editNote(\\\"\"+noteid+\"\\\")'><span title='Edit' class='glyphicon glyphicon-pencil' aria-hidden='true'></span></button>\"+\n\t\t\t\" <button class='btn btn-danger btn-xs' onclick='deleteNote(\\\"\"+noteid+\"\\\")'><span title='Remove' class='glyphicon glyphicon-remove' aria-hidden='true'></span></button></td>\"+\n\t\t\"</tr>\");\n}",
"function displayNotesDetails(note){\n return `<p>title: ${note.title}</p><p style=\"display:block\">note: ${note.body}</p>`\n }",
"function renderTodo(idx, todo) {\n return div([\n span(todo.get('text')),\n input(\".todo-completed\",\n { type: 'checkbox', checked : todo.get('completed'), 'data-todo-id' : idx }),\n span(\".remove-todo\", {'data-todo-id' : idx}, \" x\")\n ])\n}"
] |
[
"0.7492966",
"0.7484302",
"0.6420262",
"0.6416993",
"0.6294539",
"0.6256276",
"0.62361515",
"0.6209705",
"0.6191751",
"0.6191233",
"0.6190431",
"0.61891675",
"0.6180034",
"0.61781734",
"0.6170497",
"0.61701435",
"0.61595416",
"0.6092127",
"0.60896057",
"0.6089572",
"0.6059959",
"0.603424",
"0.6030256",
"0.6029869",
"0.6022022",
"0.6007545",
"0.60069275",
"0.6004284",
"0.59847707",
"0.59785545"
] |
0.82247376
|
0
|
renders todo info on edit modal
|
function renderModalEdit(todo) {
var form = $('#form-todo-edit');
var id = todo.attr('data-id'),
title = todo.attr('data-title'),
priority = todo.attr('data-priority'),
details = todo.attr('data-details'),
created = todo.attr('data-created'),
elapsed = parseInt(todo.attr('data-elapsed')),
finish = todo.attr('data-finish'),
complete = todo.attr('data-complete'),
duration = getElapsed(created, elapsed).split(':');
form.find('#inputId').val(id);
form.find('#inputTitle').val(title);
form.find('#inputPriority').val(priority);
form.find('#inputDetails').val(details);
form.find('#inputDetails').trigger('autoresize');
form.find('#inputCreatedDate').val(getDate(created));
form.find('#inputCreatedTime').val(getTime(created));
form.find('#inputFinishDate').val(getDate(finish));
form.find('#inputFinishTime').val(getTime(finish));
form.find('#inputElapsedHours').val(duration[0]);
form.find('#inputElapsedMinutes').val(duration[1]);
form.find('#inputElapsedSeconds').val(duration[2]);
Materialize.updateTextFields();
$('select').material_select();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function renderModalTodo(todo) {\n\t\ttodo = $(todo);\n\t\t\n\t\tvar id = todo.attr('data-id'),\n\t\t\t\ttitle = todo.attr('data-title'),\n\t\t\t\tpriority = todo.attr('data-priority'),\n\t\t\t\tdetails = todo.attr('data-details'),\n\t\t\t\tcreated = todo.attr('data-created'),\n\t\t\t\telapsed = parseInt(todo.attr('data-elapsed')),\n\t\t\t\tfinish = todo.attr('data-finish'),\n\t\t\t\tcomplete = todo.attr('data-complete'),\n\t\t\t\tduration = getDuration(created, elapsed);\n\t\t\n\t\tmodalTodo.find('.modal-header').text(title + \" - \");\n\t\tmodalTodo.find('.modal-header').append(\n\t\t\t'<span class=\"'+priority+'-text\">'+\n\t\t\t\tpriority+\n\t\t\t'</span>'+\n\t\t\t'<button class=\"right waves-effect waves-light btn\"><i class=\"material-icons\">play_arrow</i></button>'\n\t\t);\n\t\t\n\t\tvar html =\n\t\t\t\t'<h5>'+\n\t\t\t\t\tdetails+\n\t\t\t\t'</h5>'+\n\t\t\t\t'<table>'+\n\t\t\t\t\t'<tbody>'+\n\t\t\t\t\t\t'<tr>'+\n\t\t\t\t\t\t\t'<td>Elapsed time</td>'+\n\t\t\t\t\t\t\t'<td>'+duration+'</td>'+\n\t\t\t\t\t\t'</tr>'+\n\t\t\t\t\t\t'<tr>'+\n\t\t\t\t\t\t\t'<td>Created</td>'+\n\t\t\t\t\t\t\t'<td>'+moment(created).format(\"DD/MM/YY, HH:MM:SS\")+'</td>'+\n\t\t\t\t\t\t'</tr>'+\n\t\t\t\t\t\t'<tr>'+\n\t\t\t\t\t\t\t'<td>Finish by</td>'+\n\t\t\t\t\t\t\t'<td>'+moment(finish).format(\"DD/MM/YY, HH:MM:SS\")+'</td>'+\n\t\t\t\t\t\t'</tr>'+\n\t\t\t\t\t'</tbody>'+\n\t\t\t\t'</table>'\n\t\t\t\t;\n\t\t\n\t\tmodalTodo.find('.modal-details').html(html);\n\t\tmodalTodo.find('#trigger-edit').attr('data-id', id);\n\t}",
"edit(todo) {\n this.editTodo = todo.content;\n todo.isEdited = true;\n }",
"function renderTodo(todo) {\n\t\tvar html =\n\t\t\t\t'<a class=\"collection-item\" id=\"'+todo.id+'\" href=\"#modal-todo\"'+\n\t\t\t\t\t'data-id=\"'+todo.id+'\"'+\n\t\t\t\t\t'data-title=\"'+todo.title+'\"'+\n\t\t\t\t\t'data-priority=\"'+todo.priority+'\"'+\n\t\t\t\t\t'data-details=\"'+todo.details+'\"'+\n\t\t\t\t\t'data-created=\"'+todo.createdAt+'\"'+\n\t\t\t\t\t'data-elapsed=\"'+todo.elapsedTime+'\"'+\n\t\t\t\t\t'data-finish=\"'+todo.finishAt+'\"'+\n\t\t\t\t\t'data-complete=\"'+todo.isComplete+'\"'+\n\t\t\t\t'>'+\n\t\t\t\t\t'<span class=\"badge '+todo.priority+'\">'+\n\t\t\t\t\t\ttodo.priority+\n\t\t\t\t\t'</span>'+\n\t\t\t\t\ttodo.title+\n\t\t\t\t'</a>';\n\t\tlist.append(html);\n\t}",
"function editToDo() {\t\t\n\t\tasync function fetchRequest(path, newData) {\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(`${ AppHelper.API_URL }/users/edit/${ path }/${ id }`, {\n\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\t\tAuthorization: `Bearer ${ token }`\n\t\t\t\t\t},\n\t\t\t\t\tbody: JSON.stringify(newData)\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tconst success = await response.json();\n\t\t\t\t\n\t\t\t\tif (success) {\n\t\t\t\t\t// Clears the form fields when finished\n\t\t\t\t\tclearFields();\n\t\t\t\t\t\n\t\t\t\t\t// Success message\n\t\t\t\t\tSwal.fire({\n\t\t\t\t\t\ticon: 'success',\n\t\t\t\t\t\ttitle: 'Yay!',\n\t\t\t\t\t\ttext: 'Your To Do has been edited.',\n\t\t\t\t\t\tshowConfirmButton: false,\n\t\t\t\t\t\ttimer: 2468\n\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t// router\n\t\t\t\t\trouter.push('/dashboard');\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} catch (err) {\n\t\t\t\tconsole.error(err);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// CONTROL STATEMENTS\n\t\t// If all three fields are filled up\n\t\tif (name !== '' && description !== '' && date !== '') {\n\t\t\tconst editedFields = {\n\t\t\t\tname: name,\n\t\t\t\tdescription: description,\n\t\t\t\ttoDoDate: date\n\t\t\t};\n\t\t\t\n\t\t\tfetchRequest('to-do', editedFields);\n\t\t\t\n\t\t\t// Name field is the only one with content\n\t\t} else if (name !== '') {\n\t\t\tconst editedField = { name: name };\n\t\t\t\n\t\t\tfetchRequest('to-do-name', editedField);\n\t\t\t\n\t\t\t// Description field is the only one with content\n\t\t} else if (description !== '') {\n\t\t\tconst editedField = { description: description };\n\t\t\t\n\t\t\tfetchRequest('to-do-desc', editedField);\n\t\t\t\n\t\t\t// Date field is the only one with content\n\t\t} else if (date !== '') {\n\t\t\tconst editedField = { toDoDate: date };\n\t\t\t\n\t\t\tfetchRequest('to-do-date', editedField);\n\t\t}\n\t}",
"function editItem() {\n todoItem = _.first(todo.where({ todo_id: todo_id }));\n log.debug('[TodoListNewEdit] : Editing todo Item', todoItem);\n\n // Set the title to Edit\n Alloy.Globals.Menu.setTitle(\"Edit Task\");\n\n $.textFieldName.value = todoItem.get('name');\n $.textFieldContent.value = todoItem.get('content');\n\n}",
"function editTask(event){\n const header = event.target.parentElement;\n const task = header.parentElement;\n const id = Number(task.getAttribute(\"data-id\"));\n const val = database.getField(id);\n val.onsuccess = () => {\n const {key, title, description} = val.result;\n var editTitle = document.getElementById(\"editTitle\");\n editTitle.setAttribute(\"value\",title);\n\n var editDescription = document.getElementById(\"editDescription\");\n editDescription.innerHTML = description;\n }\n modal.style.display = \"block\";\n var saveChange = document.querySelector(\"#btnsave\");\n saveChange.setAttribute(\"data-id\",id);\n saveChange.onclick = changeTask;\n }",
"function editButtonPressed(todo) {\n $('#todo_input').val(todo.title);\n $('#text_input').val(todo.text);\n $('#enterdetails').html('Enter Details: (Edit: '+todo.title+')'); // Add a hint that we are now editing\n $('#sendtodo').val('edit'); // Change the Save button from save-mode to edit-mode\n $('#canceltodo').show(); // Show the cancel button\n currentTodo = todo;\n\n if(colorChecked !== '') {\n colorChecked.removeClass( 'circleclicked' );\n }\n colorChecked = $('.circle.'+todo.color);\n $('.circle.'+todo.color).addClass( 'circleclicked' );\n\n console.log(todo);\n }",
"edit() {\n let selected = this.props.todo.selected;\n let input = document.getElementById('input-to-do');\n let val = input.value;\n\n if (this.props.todo.editing) {\n this.props.addEdits(selected, this.props.todo.todo, this.props.todo.totalToDos);\n this.props.turnEditingOn(false);\n input.value = '';\n } else if (selected) {\n let value = selected.value;\n input.value = value;\n this.props.turnEditingOn(true);\n } \n }",
"function showEditTodoList() {\n hideTodosLayers();\n var listId = document.forms.todoForm.listId.value;\n if (listId != null && listId != \"null\" && listId != \"\") {\n $(\"editListDiv\").style.display=\"inline\";\n todo_lists.getTodoList(listId, replyEditTodoList);\n document.forms.editListForm.name.focus();\n tracker('/ajax/showEditTodoList');\n }\n}",
"function editTodo(id){\n // localStorage.setItem(\"id\", id)\n const token = localStorage.getItem('token');\n // e.preventDefault()\n // bikin ajax getById\n $.ajax({\n method: \"GET\",\n headers: {\n acces_token: token\n },\n url: server + `/todos/${id}`\n }).done(todo => {\n console.log(todo)\n $(\"#home-page\").hide()\n $(\"#sign-in-page\").hide()\n $(\"#sign-up-page\").hide()\n $(\"#add-todo-form\").hide()\n $(\"#edit-todo-form\").show() // harusnya di render setelah GET by id\n $(\"#title-edit\").val(todo.title)\n $(\"#description-edit\").val(todo.description)\n $(\"#due-date-edit\").val(todo.due_date)\n $(\"#edit-id\").val(todo.id)\n }).fail(err => {\n console.log(err)\n })\n\n // $(\"#home-page\").hide()\n // $(\"#sign-in-page\").hide()\n // $(\"#sign-up-page\").hide()\n // $(\"#add-todo-form\").hide()\n // $(\"#edit-todo-form\").show() // harusnya di render setelah GET by id\n /* populate data contohnya \n $(\"#title-edit\").val(data.title)\n $(\"#description-edit\").val(data.description)\n $(\"#due-date-edit\").val(data.dueDate)\n */\n}",
"function editTodo(e) {\n let todoItem = e.target.parentNode;\n let todotext = e.target.parentNode.firstChild.innerText\n //remove the content div and replace it with the edit input\n e.target.parentNode.firstChild.remove();\n let editInput = document.createElement('input');\n editInput.className = 'editing'\n editInput.value = todotext;\n todoItem.insertBefore(editInput, e.target.parentNode.firstChild)\n}",
"function edit(todoId, options) {\n let state = dataHub.getState();\n let todo = state.todos.find((todo) => {\n return todo.id === todoId;\n });\n if (options.status) {\n todo.status = options.status;\n }\n dataHub.setTodos(state.todos);\n todosResource.saveTodos(state.todos);\n }",
"function editar_todo(indice,todos){\n const mod_titulo = document.getElementById('mod-titulo')\n mod_titulo.value = todos[indice].titulo\n const mod_descripcion = document.getElementById('mod-descripcion')\n mod_descripcion.value = todos[indice].descripcion\n const btn_modificar = document.getElementById('modificar')\n btn_modificar.addEventListener('click',async ()=>{\n const model = document.getElementById('model')\n model.style.display = 'none'\n let url = window.origin+'/modificar_todo'\n let todo = todos[indice]\n todo.titulo = mod_titulo.value\n todo.descripcion = mod_descripcion.value\n let data = await fetch(url,{\n method: 'PUT',\n credentials: 'include',\n cache: 'no-cache',\n body: JSON.stringify(todo),\n headers: new Headers({\n 'content-type':'application/json'\n })\n })\n render()\n })\n}",
"function EditableTodoList({todos, update, remove}) {\n\n const eTodoList = todos.map(t => <EditableTodo key={t.id} todo={t} update={update} remove={remove}/>);\n return (\n <div>\n {eTodoList}\n </div>\n );\n}",
"function Todo({todos, completeTodo, removeTodo, updateTodo}) {\n const [edit, setEdit] = useState({\n id: null,\n value: ''\n })\n const submitUpdate = value => {\n updateTodo(edit.id, value)\n setEdit ({\n id: null,\n value: ''\n })\n }\n\n if (edit.id) {\n return <TodoForm edit={edit} onSubmit={submitUpdate}/>\n }\n\n\n\n return todos.map((todo, index) => (\n <div className={todo.isComplete ? 'todo-complete' : 'not-complete'} key = {index} style={{\n display: \"flex\",\n alignItems: \"center\",\n cursor:\"pointer\"\n\n }}> \n \n <div key ={todo.id} onClick = {() => completeTodo(todo.id)}\n style = {{padding: \"1rem\"}}\n >\n {todo.text}\n \n </div>\n <button className=\"editButton\" style={{margin: \"0 1rem\"}} onClick={() => setEdit({id: todo.id, value: todo.text})}><FaPen style={{ fontSize: \"1.4rem\", color: \"grey\"}}/></button>\n\n <button className=\"removeButton\" style={{margin: \"0 1rem\"}} onClick={() => removeTodo(todo.id)}><FiTrash2 style ={{fontSize: \"1.4rem\",color: \"grey\"}}/></button>\n \n </div>\n ))\n}",
"function todoView(item) {\n var todoConfig = U({ editing: false });\n var toggleEditing = C(_ => todoConfig.editing = !Boolean(todoConfig.editing));\n var doneEditing = C(_ => todoConfig.editing = false);\n var edit = C(_ => todoConfig.editing = true );\n \n return E('li') .\n is({ class: { completed: item.completed, editing: config.editing} }) .\n has([\n \n E('div#view') . has ([\n E('input') . is({type: 'checkbox'}) . does({click: 0}) . sets(item.completed),\n LABEL(item.title) . does({ doubleclick: edit })\n ]),\n \n E('input.edit') . sets(item.title) . does({ blur: doneEditing })\n ])\n ;\n }",
"update(todo) {\n if (!this.editTodoIsValid) {\n return;\n }\n\n todo.content = this.editTodo;\n todo.isEdited = false;\n\n // Reset the edit todo.\n this.editTodo = null;\n }",
"function editTask(req, res){\n\n\tlet id=req.query.id\n\tTodoList.find({}, function(err,toDoList){\n\t\tif(err){\n\t\t\tconsole.log('Error in editing task');\n\t\t\treturn\n\t\t}\n\t\treturn res.render('home', {\n\t\t\ttitle: \"Home\",\n\t\t\tTask_List: toDoList,\n\t\t\ttaskId: id\n\t\t});\n\t})\n\n}",
"function handleTaskModal() {\n props.openModal('edit task', props.task);\n }",
"function editTodo(i){\n let toDoTask = localStorage.getItem(\"localtodo\");\n saveIndex.value = i;\n let todoObj = JSON.parse(toDoTask);\n todoInp.value = todoObj[i];\n saveBtn.style.display = \"block\";\n addTodo.style.display=\"none\";\n addTodo.setAttribute(\"disabled\", true)\n }",
"function editItem(id) {\n\t\t[...todo].map((item) => {\n\t\t\tif (item.id === id) {\n\t\t\t\tfetch(`http://127.0.0.1:3010/tasks/${id}`, {\n\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\t\t\tbody: JSON.stringify({ id: item.id, text: editText, completed: item.completed, tag: item.tag, lastMod: new Date().getTime(), displayDate: new Date().toLocaleString(), outOfTime: item.outOfTime, alarm: item.alarm })\n\t\t\t\t}).then((resp) => resp.json())\n\t\t\t\t\t.then((data) => { console.log(data) });\n\t\t\t\twindow.location.reload()\n\n\t\t\t}\n\t\t\treturn item\n\t\t})\n\t\tsetEdit(null)\n\t\tsetEditText('')\n\t}",
"function showTodo(id){\n\tconsole.log(\"edit todo : \" + id);\n\tvar todoArr = readTodosArray();\n\tconsole.log(todoArr);\n\tvar content_input = document.getElementById(\"content-input\");\n\tcontent_input.value = todoArr[id-1][CONTENT];\n\tvar due_input = document.getElementById(\"due-input\");\n\tdue_input.value = todoArr[id-1][DUE];\n\tvar due_input = document.getElementById(\"id-input\");\n\tdue_input.value = todoArr[id-1][ID];\n}",
"function renderTodo(todo) {\n //store todo items into browser storage.\n localStorage.setItem(\"todoItem\", JSON.stringify(todoItems));\n //get reference of required elements.\n const list = document.querySelector(\".js-todo-list\");\n const item = document.querySelector(`[data-key='${todo.id}']`);\n\n //Runs a check for deleted items and update the DOM.\n if (todo.deleted) {\n item.remove();\n if (todoItems.length === 0) list.innerHTML = \"\";\n return;\n }\n //Evaluate the done state of a todo entry\n const isChecked = todo.checked ? \"done\" : \"\";\n //create a list item that holds todo entry.\n const listItemElement = document.createElement(\"li\");\n\n // set class and data-key attributes to the todo entry.\n listItemElement.setAttribute(\"class\", `todo-item ${isChecked}`);\n listItemElement.setAttribute(\"data-key\", todo.id);\n //populate the todo entry with required values.\n listItemElement.innerHTML = `\n <input id =\"${todo.id}\" type=\"checkbox\"/>\n <label for=\"${todo.id}\" class=\"tick js-tick\"></label>\n <span>${todo.text}</span>\n <button class=\"delete-todo js-delete-todo\">\n ×\n </button>\n `;\n //Run condition to append the created item to the page.\n if (item) {\n list.replaceChild(listItemElement, item);\n }\n else {\n list.append(listItemElement);\n }\n}",
"function TodoItem({ id, todo, status, updateTodo, removeTodo }) {\n const [editMode, setEditMode] = useState(false);\n\n const handleDelete = removeTodo.bind(null, id);\n\n function handleEdit() {\n setEditMode(true);\n }\n\n function handleToggleStatus() {\n let newStatus = status === \"pending\"\n ? \"complete\"\n : \"pending\";\n\n updateTodo({ id, todo, status: newStatus });\n }\n\n return (\n <li id={id} className=\"TodoItem\">\n <svg className=\"vertical-lines\" width=\"100\" height=\"100\" xmlns=\"http://www.w3.org/2000/svg\">\n <line x1=\"82\" y1=\"0\" x2=\"82\" y2=\"100\" stroke=\"#ff9999\" strokeWidth=\"2\" />\n <line x1=\"89\" y1=\"0\" x2=\"89\" y2=\"100\" stroke=\"#ff9999\" strokeWidth=\"2\" />\n </svg>\n {editMode\n ? <EditTodoForm id={id} currentTodo={todo} updateTodo={updateTodo} />\n : <>\n <span className=\"icon-collection\">\n <svg className=\"icon-delete\" onClick={handleDelete} xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n <path d=\"M12 0a12 12 0 100 24 12 12 0 000-24zm4.2 18L12 13.7 8 18 6 16.2l4-4.2L6 8 7.8 6l4.2 4L16 6l2 1.8-4.2 4.2 4.2 4-1.8 2z\" />\n </svg>\n\n <svg className=\"icon-edit\" onClick={handleEdit} xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n <path d=\"M12 0a12 12 0 100 24 12 12 0 000-24zM7 17l1-4 3.1 3L7 17zm5.2-1.9L9 12 14.8 6 18 9.2l-5.8 6z\" />\n </svg>\n\n <svg className=\"icon-complete-status\" onClick={handleToggleStatus} xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n <path d=\"M12 0a12 12 0 100 24 12 12 0 000-24zm-1.3 17.3l-4.4-4.4L8 11.1l2.6 2.5 5.7-5.8 1.9 1.8-7.6 7.7z\" />\n </svg>\n </span>\n <Todo todo={todo} status={status} /></>}\n </li>\n );\n}",
"function renderTodo(todo) {\n //Store todo items into broser storage\n localStorage.setItem(\"todoItems\", JSON.stringify(todoItems));\n //Get reference of required elements\n const list = document.querySelector(\".js-todo-list\");\n const item = document.querySelector(`[data-key='${todo.id}']`);\n //Runs a check for deleted items and update the DOM\n if (todo.deleted) {\n item.remove();\n if (todoItems.length === 0) list.innerHTML = \"\";\n return;\n }\n //Evaluate the done state of a todo entry\n const ischecked = todo.checked ? \"done\" : \"\";\n //create a list item that holds todo entry\n //set clss and data-key attribute to the todo entry\n const listItemElement = document.createElement(\"li\");\n listItemElement.setAttribute(\"class\", `todo-item ${ischecked}`);\n //populate the required the values\n listItemElement.setAttribute(\"data-key\", todo.id);\n listItemElement.innerHTML = `<input id=\"${todo.id}\" type=\"checkbox\"/>\n <label for =\"${todo.id}\" class=\"tick js-tick\"></label>\n <span>${todo.text}</span>\n <button class=\"delete-todo js-delete-todo\">\n ×\n </button>\n `;\n //Run the condition to append the created item to the page\n if (item) {\n list.replaceChild(listItemElement, item);\n } else {\n list.append(listItemElement);\n }\n\n}",
"function renderTodo(todo) {\n localStorage.setItem('todoItemsRef', JSON.stringify(todoItems));\n const list = document.querySelector('.js-todo-list');\n const item = document.querySelector(`[data-key='${todo.id}']`);\n\n if (todo.deleted) {\n item.remove();\n if (todoItems.length === 0) list.innerHTML = '';\n return\n }\n\n const isChecked = todo.checked ? 'done': '';\n \n const node = document.createElement(\"li\");\n node.setAttribute('class', `todo-item ${isChecked}`);\n node.setAttribute('data-key', todo.id);\n node.innerHTML = `\n <input id=\"${todo.id}\" type=\"checkbox\"/>\n <label for=\"${todo.id}\" class=\"tick js-tick\"></label>\n <span>${todo.text}</span>\n <button class=\"delete-todo js-delete-todo\">\n <svg><use href=\"#delete-icon\"></use></svg>\n </button>\n `;\n\n if (item) {\n list.replaceChild(node, item);\n } else {\n list.append(node);\n }\n}",
"function edit_note(note_id, note_name) {\n fetch(`${note_name}/edit/${note_id}`)\n .then(response => response.json())\n .then(notes => {\n Array.prototype.forEach.call(notes.task, note => {\n document.querySelector(`#edit-note-${note.id}`).style.display == 'block'\n document.getElementById(`edit-note-${note.id}`).innerHTML = `<form id=\"edit_note\"> <textarea rows=\"5\" cols=\"45\" id=\"newnote\">${note.note}</textarea> <br> <button class=\"save_edit btn btn-dark\" type=\"submit\"> Save </button></form>`;\n\n document.querySelector('#edit_note').onsubmit = function() {\n fetch(`${note_name}/edit/${note_id}`, {\n method: 'PUT',\n body: JSON.stringify({\n note: document.querySelector('#newnote').value\n })\n })\n }\n })\n })\n }",
"async edit ({ params, request, response, view }) {\n }",
"async edit ({ params, request, response, view }) {\n }",
"async edit ({ params, request, response, view }) {\n }"
] |
[
"0.7879672",
"0.72978574",
"0.71237314",
"0.679732",
"0.6789736",
"0.6735313",
"0.67139035",
"0.6689956",
"0.6672412",
"0.66141886",
"0.66096693",
"0.6608107",
"0.65953094",
"0.6585301",
"0.656784",
"0.65665364",
"0.6566337",
"0.65657467",
"0.6564237",
"0.65475243",
"0.6471488",
"0.6469861",
"0.6444875",
"0.6404861",
"0.63855267",
"0.6382647",
"0.6348692",
"0.631262",
"0.631262",
"0.631262"
] |
0.8279227
|
0
|
Returns the path at which the asset can be found in the archive
|
function getPathInArchive(asset) {
if (Platform.OS === 'android') {
var assetDir = getBasePath(asset);
// E.g. 'assets_awesomemodule_icon'
// The Android resource system picks the correct scale.
return (assetDir + '/' + asset.name)
.toLowerCase()
.replace(/\//g, '_') // Encode folder structure in file name
.replace(/([^a-z0-9_])/g, '') // Remove illegal chars
.replace(/^assets_/, ''); // Remove "assets_" prefix
} else {
// E.g. 'assets/AwesomeModule/[email protected]'
return getScaledAssetPath(asset);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"get assetPath() {}",
"get assetPath() {}",
"get assetBundleManifestPath() {}",
"get assetpath() {\n // Don't override existing assetpath.\n if (!this.__assetpath) {\n // note: assetpath set via an attribute must be relative to this\n // element's location; accomodate polyfilled HTMLImports\n const owner = window.HTMLImports && HTMLImports.importForElement ? HTMLImports.importForElement(this) || document : this.ownerDocument;\n const url = (0, _resolveUrl.resolveUrl)(this.getAttribute('assetpath') || '', owner.baseURI);\n this.__assetpath = (0, _resolveUrl.pathFromUrl)(url);\n }\n\n return this.__assetpath;\n }",
"function getAssetsPath() {\r\n return getBuildPath() + config.build.assetsPath;\r\n}",
"get assetsDir() {\n let ret = this.YAML.akashaepub\n && this.YAML.akashaepub.assetsDir\n ? this.YAML.akashaepub.assetsDir\n : \"assets\"; // : undefined;\n // This could be an array of values\n if (Array.isArray(ret)) {\n return ret;\n }\n // Make sure assets directory exists\n let stats;\n try {\n stats = fs.statSync(ret);\n } catch (e) {\n stats = undefined;\n }\n if (stats && stats.isDirectory()) {\n return ret;\n } else if (ret === \"assets\") {\n return undefined;\n } else {\n throw new Error(`assetsDir does not exist ${ret}`);\n }\n }",
"getAssetRoots() {\n return [__dirname];\n }",
"get fullPath() {\n return path.join(this.assembly.directory, this.directoryName);\n }",
"function getBasePath(asset) {\n // TODO(frantic): currently httpServerLocation is used both as\n // path in http URL and path within IPA. Should we have zipArchiveLocation?\n var path = asset.httpServerLocation;\n if (path[0] === '/') {\n path = path.substr(1);\n }\n return path;\n}",
"function getAssetPath (category) {\n return process.env.WEBPACK_ENV === 'development' ?\n `${category}/[name].[ext]` :\n `${category}/[hash].[ext]`;\n}",
"get mainAsset() {}",
"function getChunkAssetPath(assetsByChunkName, chunkName) {\n if (assetsByChunkName && assetsByChunkName[chunkName]) {\n if (typeof assetsByChunkName[chunkName] === 'string') {\n return assetsByChunkName[chunkName];\n } else {\n return assetsByChunkName[chunkName][0];\n }\n }\n return null;\n }",
"function buildAssetPath(imgSrc) {\n return `./dist/${imgSrc}`;\n}",
"function getAssetsPath()\n\t{\n\t\tvar generatorConfigFile = new File(\"~/generator.js\");\n\t\tvar cfgObj = {};\n\t\tvar gao = {};\n\t\tvar baseDirectory = undefined;\n\n\t\tif(generatorConfigFile.exists)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar str = JSUI.readFromFile(generatorConfigFile, \"UTF-8\");\n\n\t\t\t\tcfgObj = JSON.parse(str.replace(\"module.exports = \", \"\"));\n\t\t\t\tgao = cfgObj[\"generator-assets\"];\n\t\t\t\tbaseDirectory = gao[\"base-directory\"];\n\n\t\t\t}\n\t\t\tcatch(e)\n\t\t\t{\n\t\t\t\tif($.level) $.writeln(\"Error parsing generator.js\");\n\t\t\t}\n\t\t}\n\t\treturn baseDirectory;\n\t}",
"_getArtifactPathFromFullyQualifiedName(fullyQualifiedName) {\n const { sourceName, contractName } = (0, contract_names_1.parseFullyQualifiedName)(fullyQualifiedName);\n return path.join(this._artifactsPath, sourceName, `${contractName}.json`);\n }",
"async _getArtifactPath(name) {\n if ((0, contract_names_1.isFullyQualifiedName)(name)) {\n return this._getValidArtifactPathFromFullyQualifiedName(name);\n }\n const files = await this.getArtifactPaths();\n return this._getArtifactPathFromFiles(name, files);\n }",
"function assetFinder(combatChoice) {\n return \"assets/\" + combatChoice + \".png\"\n }",
"function getPathOnDevserver(devServerUrl, asset) {\n return devServerUrl + getScaledAssetPath(asset) + '?hash=' + asset.hash;\n}",
"_getArtifactPathSync(name) {\n if ((0, contract_names_1.isFullyQualifiedName)(name)) {\n return this._getValidArtifactPathFromFullyQualifiedNameSync(name);\n }\n const files = this._getArtifactPathsSync();\n return this._getArtifactPathFromFiles(name, files);\n }",
"atPath(fileName) {\n return new ArtifactPath(this, fileName);\n }",
"get localPath() {\n return this._manager.contents.localPath(this._path);\n }",
"get templateFullPath() {\n return path.join(this.assembly.directory, this.templateFile);\n }",
"getSrcPath()\n {\n return path.join(this.getRootPath(), 'src');\n }",
"getResourcePath(staticSymbol) {\n return this.symbolResourcePaths.get(staticSymbol) || staticSymbol.filePath;\n }",
"getResourcePath(staticSymbol) {\n return this.symbolResourcePaths.get(staticSymbol) || staticSymbol.filePath;\n }",
"getResourcePath(staticSymbol) {\n return this.symbolResourcePaths.get(staticSymbol) || staticSymbol.filePath;\n }",
"getResourcePath(staticSymbol) {\n return this.symbolResourcePaths.get(staticSymbol) || staticSymbol.filePath;\n }",
"function getAsset(name, dir, ext){\n\treturn host + \"img/\" + dir + \"/\" + name + \".\" + ext + \"?v=\" + siteVersion;\n}",
"get 'asset-path'() { return process.env.PUBLIC_URL ? `\"${process.env.PUBLIC_URL}\"` : '\"/\"'; }",
"getResourcePath() {\n let annotationAttachment = this.props.model.filterAnnotationAttachments((attachment) => {\n return attachment.getAnnotationName().value === 'resourceConfig';\n })[0];\n annotationAttachment = annotationAttachment || {};\n annotationAttachment.attributes = annotationAttachment.attributes || [];\n const pathAtributeNode = _.filter(annotationAttachment.attributes, (atribute) => {\n return atribute.getName().value === 'path';\n })[0];\n if (pathAtributeNode && pathAtributeNode.getValue() && pathAtributeNode.getValue()) {\n return pathAtributeNode.getValue().getValue().unescapedValue;\n }\n return '/' + this.props.model.name.value;\n }"
] |
[
"0.72988594",
"0.72988594",
"0.6928078",
"0.6344683",
"0.6304178",
"0.62533545",
"0.61659217",
"0.6121274",
"0.59751874",
"0.5935436",
"0.5926797",
"0.5808916",
"0.5782934",
"0.5780586",
"0.57536286",
"0.5746315",
"0.57212144",
"0.56528574",
"0.56408256",
"0.5589051",
"0.55822265",
"0.5570647",
"0.5551792",
"0.5551143",
"0.5551143",
"0.5551143",
"0.5551143",
"0.554026",
"0.5527556",
"0.55122685"
] |
0.73705804
|
0
|
Returns an absolute URL which can be used to fetch the asset from the devserver
|
function getPathOnDevserver(devServerUrl, asset) {
return devServerUrl + getScaledAssetPath(asset) + '?hash=' + asset.hash;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function url(id) {\n var basedir = getCallsiteDirname();\n return 'url(' + requireAssets(id, basedir) + ')';\n}",
"getURL(url) {\n return this.isDev() ? path.join(\"../\", url) : url\n }",
"get 'asset-path'() { return process.env.PUBLIC_URL ? `\"${process.env.PUBLIC_URL}\"` : '\"/\"'; }",
"get assetPath() {}",
"get assetPath() {}",
"getUrl() {\n if (this.state != remote_file) {\n return undefined;\n }\n let [ssName, storageService] = getStorageService();\n return storageService.getUrl(this._obj.location);\n }",
"getPublicPathUrl() {\n return `${this.getServerUrl()}${this.publicPath}`;\n }",
"function getResourceUrl(url) {\n return _baseUrl + url;\n}",
"function getResourceUrl(url) {\n return _baseUrl + url;\n}",
"function getResourceUrl(url) {\n return _baseUrl + url;\n}",
"function getResourceUrl(url) {\n return _baseUrl + url;\n}",
"function getResourceUrl(url) {\r\n return _baseUrl + url;\r\n}",
"function getResourceUrl(url) {\r\n return _baseUrl + url;\r\n}",
"getURL() {\n return Meteor.absoluteUrl(`${ UploadFS.config.storesPath }/${ this.name }`, {\n secure: UploadFS.config.https\n });\n }",
"get BASE_URL() {\n return this.USE_LOCAL_BACKEND ?\n 'http://' + manifest.debuggerHost.split(`:`).shift() + ':3000/' + this.API_VERSION :\n 'https://mhacks.org/' + this.API_VERSION\n }",
"function assetUrl (asset, extraParams) {\n try {\n var url = asset.fields.file.url;\n if (extraParams) {\n var queryString = '';\n for (var key in extraParams) {\n queryString += '&' + key + '=' + extraParams[key];\n }\n url += '?' + queryString.substr(1);\n }\n return url;\n } catch (e) {\n console.error('Asset had no file URL:', asset);\n return 'images/show_item_01.jpg';\n }\n }",
"function getImageBaseUrl (url, config, item) {\n var baseUrl = ''\n if (item.use_file_server) {\n baseUrl = config.file_server\n }\n return baseUrl\n}",
"get url() {\n return `/preview/${this.context.envRuntime.id}`;\n }",
"get url() {\n return artifactAttribute(this, 'URL');\n }",
"function getAsset(name, dir, ext){\n\treturn host + \"img/\" + dir + \"/\" + name + \".\" + ext + \"?v=\" + siteVersion;\n}",
"function dbv_get_static_url() {\n var str = $('#dbv_main_js').attr('src').split('/');\n str.pop();\n return str.join('/');\n}",
"function detectAssetURL() {\n try {\n // Try to get the url from the canonical tag on the page.\n return document.querySelector('link[rel=\"canonical\"]').href;\n } catch (e) {\n window.console.warn(\n 'This page does not include a canonical link tag. Talk has inferred this asset_url from the window object. Query params have been stripped, which may cause a single thread to be present across multiple pages.'\n );\n\n return window.location.origin + window.location.pathname;\n }\n}",
"function getServerURL() {\n const url = isDev ? \"http://localhost:4000\" : document.location.host;\n log(\"Requested server: \", url);\n return url;\n}",
"function SafeResourceUrl() { }",
"function SafeResourceUrl() { }",
"function SafeResourceUrl() { }",
"get() {\n return `${process.env.APP_URL}/files/${this.path}`;\n }",
"get apiUrl() {\n return `http://${this.host}:${this.tempApiPort}/api`; // setups up the url that the api is located at and used as a shortcut for our fetch api scripts to retrieve data\n }",
"getFileUrl(path) { return this.engine.getFileUrl(path); }",
"function getVendorPublicPath() {\n return `http://localhost:9000/vendor/`;\n}"
] |
[
"0.6948651",
"0.6923575",
"0.68518424",
"0.66799545",
"0.66799545",
"0.65441257",
"0.6415133",
"0.63643956",
"0.63643956",
"0.63643956",
"0.63643956",
"0.63579535",
"0.63579535",
"0.62959653",
"0.6251196",
"0.6241207",
"0.6232682",
"0.62325305",
"0.6221429",
"0.62188184",
"0.6217524",
"0.6194065",
"0.6187425",
"0.60993993",
"0.60993993",
"0.60993993",
"0.601842",
"0.5991979",
"0.59798837",
"0.59635025"
] |
0.74271345
|
0
|
Delete snippet by id
|
function delete_snippet(id) {
$(".snippet_row_" + id).remove();
// if there aren't any visible rows (i.e. excluding the 0 row that we use for cloning)
if ($('#manage_snippets_table .snippet_row:visible').length <= 0) {
$('#no_snippets_row').show();
} else {
$('#no_snippets_row').hide();
}
$.ajax({
url: ajaxurl,
data: {
id: id,
action: "orb_ctc_addon_cloud_lib_delete"
},
success: function (json) {
// update max items via js
$('.usage_items').text(get_snippet_count());
if (json.status) {
// the row is deleted anyways so nothing to do.
// just have some coffee.
} else {
alert(json.msg);
}
}
});
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function deleteExercise(id) {\n $.ajax({\n method: \"DELETE\",\n url: \"/api/exercises/\" + id\n })\n .then(function () {\n $(`[data-exercise=${id}]`).remove();\n });\n }",
"function remove(id){\n var direccion = urlDelete.replace('insertIdHere', id);\n $.get(direccion, function(){\n var elemento = $(`#${id}`)[0];\n $(elemento).remove();\n })\n }",
"function remove(id) {\n return db('sections')\n .where({ id })\n .del();\n}",
"delete() {\n $(`comment-${this.config['id']}`).remove();\n }",
"function delTemplate(id) {\n\n\t//該当値行を削除する\n\t$('#' + id).remove();\n}",
"deleteSnippet(index = -1) {\n const numSnippets = this._snippets.length;\n if (index < 0 || index > numSnippets) {\n this._snippets.pop();\n }\n else {\n // Update list\n for (let i = index + 1; i < numSnippets; i++) {\n this._snippets[i].id = this._snippets[i].id - 1;\n }\n this._snippets.splice(index, 1);\n }\n }",
"function deletenote(id) {\n $.ajax({\n method: \"DELETE\",\n url: \"/api/notes/\" + id\n })\n .done(function() {\n getnotes(noteCategorySelect.val());\n });\n }",
"function deleteItem(id) {\n executeHTTPRequest(id, 'DELETE', '/remove')\n}",
"function removeQuoteById(id){\n document.querySelector(`[data-delete-id='${id}']`).parentElement.parentElement.remove()\n }",
"function deleteById(id) {\n return fs.readFile(dbPath, \"utf-8\").then((jsonData) => {\n const articles = JSON.parse(jsonData);\n\n const newArticles = articles.filter((article) => {\n return article.id !== id;\n });\n\n return fs.writeFile(dbPath, JSON.stringify(newArticles));\n });\n}",
"static delete(id) {\n //FIXME\n }",
"function deleteIt(){\n \tupdateDB(\"delete\", pageElements.alertText.dataset.id);\n }",
"async deleteById(id) {\n return await conn.query(\"DELETE FROM Fitness_RoutineExercises WHERE routineExercises_id=?\", id);\n }",
"deleteLike(id)\n {\n // We need the index position of the item\n // with the specified ID\n const index = this.likes.findIndex(element => element.id === id);\n\n // Remove the element from the likes array using the splice() method\n // and the index we found above.\n this.likes.splice(index, 1);\n\n // Use localStorage API to persist data\n this.persistData();\n }",
"function deletePost() {\n\tvar snippet = {\n\t\tquery : {\n\t\t\t// published: false,\n\t\t\tid: \"-K_WonIe_j7iSm-WeyC8\"\n\t\t}\n\t}\n\n\trimer.post.delete(snippet, function(error, value) {\n\t\tif(error) {\n\t\t\tconsole.log(error)\n\t\t}\n\t\telse {\n\t\t\tconsole.log(value)\n\t\t}\n\t})\n}",
"deleteContributedStory({id}) {\n\n return this._getCollection()\n .then(collection => collection.deleteOne({\n _id: MongoDb.ObjectId(id)\n }));\n }",
"deleteNote(id) {\n let index = this.jsonData().findIndex(element => parseInt(element.id) === parseInt(id));\n if (index !== -1) {\n let noteData = this.jsonData();\n noteData.splice(index, 1);\n this.storeData(noteData);\n }\n }",
"function deleteRequest(id){\n //finds the li element in the HTML for quote\n let li1 = document.getElementById(`li-${id}`)\n //fetch request configs\n let config = {\n method: 'DELETE',\n headers: {\n \"Content-Type\": \"application/json\"\n }\n }\n //fetch request to update database\n fetch(quoteUrl + `/${id}`, config)\n .then(response => response.json());\n //removes the li element from the HTML\n li1.remove()\n}",
"function rf(id) { tagger.remove(asInt(id)); }",
"function _delete(id) {\n const requestOptions = {\n method: 'DELETE',\n headers: authHeader(),\n };\n return fetch(`${apiUrl}/articalremove/${id}`, requestOptions).then(handleResponse);\n}",
"function deleteTag (id) {\n fetch(`http://localhost:3001/api/tags/delete/${id}`, {\n method : 'DELETE'\n }).then(res => {\n renderTags()\n toast.error(\"Tag Est Bien Supprimer !!!\", {\n position: \"bottom-right\"\n })\n })\n }",
"function deleteItem(id) {\n axios.delete(\"/delete/\" + id);\n }",
"function _deleteStory(id) {\n const requestOptions = {\n method: 'DELETE',\n url: `story/delete/${id}`\n };\n\n return api(requestOptions)\n}",
"function deleteAnnotationById(id) {\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function() {\n if (xhr.readyState === 4 && xhr.status === 200) {\n console.log(xhr.responseText);\n }\n }\n xhr.open(\"DELETE\", \"https://youtube-annotate-backend.herokuapp.com/api/remove/\" + id, true);\n xhr.send(null);\n}",
"async deleteRecipe(id) {\n if (!id) throw \"You must provide a valid recipe id\";\n\n const recipeCollection = await recipes();\n const deletionInfo = await recipeCollection.removeOne({_id: id});\n if (deletionInfo.deletedCount === 0) {\n throw `Could not delete post with id of ${id}`;\n }\n // console.log(\"Recipe deleted\");\n }",
"function deleteLessonFromMain(id) {\n API.deleteLessonFromMain(id)\n .then(res => loadLessonsMain())\n .catch(err => console.log(err));\n }",
"function deleteItem(id) { //uses incrementing Id to delete individul messages with the \"X\" span.\n console.log(\"DeleteItem\", id);\n const rowEl = document.getElementById(id);\n rowEl.remove();\n }",
"function deleteById(id) {\n id = parseInt(id)\n let exercise = findById(id);\n\n if (!exercise) \n throw new Error(`No exercise for id: ${id}`);\n\n exercises.delete(id)\n\n return exercise;\n}",
"function deleteItem() {\n SidebarActions.deleteItem('Content', $scope.data.thisContent);\n}",
"deleteRecipe(id) {\n this.recipes = this.recipes.filter((recipe) => recipe.id !== id);\n\n // commits changes to local storage\n this._commit(this.recipes);\n }"
] |
[
"0.6677927",
"0.6606545",
"0.6560378",
"0.64950675",
"0.64659834",
"0.6445743",
"0.64454406",
"0.63364446",
"0.6326042",
"0.62944067",
"0.62941897",
"0.62693906",
"0.62572294",
"0.6239765",
"0.62353086",
"0.6210317",
"0.61874735",
"0.61831236",
"0.61811054",
"0.6143782",
"0.6115675",
"0.61076796",
"0.6103657",
"0.6098965",
"0.60966146",
"0.6084505",
"0.60818076",
"0.6075661",
"0.6072149",
"0.6069697"
] |
0.7400315
|
0
|
createSelectionForm Create an item selection form
|
function createSelectionForm(request, response)
{
try
{
//CreateSselection Form
selectionForm = nlapiCreateForm('Add Item',true);
//Create Buttons
selectionForm.addSubmitButton('Submit');
//Create Fields
errorLabel = selectionForm.addField('custpage_errorlabel','text', 'Error').setDefaultValue(errorText);
selectionForm.getField('custpage_errorlabel').setDisplaySize(37, 10);
selectionForm.getField('custpage_errorlabel').setDisplayType(errorDisplay);
hiddenCustomer = selectionForm.addField('custpage_hiddencustomer','integer','Customer Id').setDefaultValue(customer);
selectionForm.getField('custpage_hiddencustomer').setDisplaySize(10, 10);
selectionForm.getField('custpage_hiddencustomer').setDisplayType('hidden');
hiddencustomerBrand = selectionForm.addField('custpage_hiddencustomerbrand','integer','Customer Brand Id').setDefaultValue(custBrandParam);
selectionForm.getField('custpage_hiddencustomerbrand').setDisplaySize(10, 10);
selectionForm.getField('custpage_hiddencustomerbrand').setDisplayType('hidden');
//Create SubList
itemlines = selectionForm.addSubList('custpage_sublist_itemlines', 'inlineeditor', 'Add Items', 'itemlines');
itemCode = itemlines.addField('custpage_custcol_item', 'text', 'Item Code').setMandatory(true);
itemlines.setLineItemValues(itemCode);
qty = itemlines.addField('custpage_custcol_quantity', 'integer', 'Quantity').setMandatory(true);
itemlines.setLineItemValues(qty);
}
catch(e)
{
errorHandler('createSelectionForm ', e);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function OSelect_XFormItem() {}",
"function createSellform(d,item,quant,descid,hash,itemimage,textdesc) {\n var form = document.createElement('form');\n form.setAttribute('name','sellform');\n form.setAttribute('action','managestore.php');\n form.setAttribute('method','post');\n form.setAttribute('style','display:inline;');\n var input = document.createElement('input'); \n input.setAttribute('type','hidden');\n input.setAttribute('name','action');\n input.setAttribute('value','additem');\n form.appendChild(input);\n input = document.createElement('input'); \n input.setAttribute('id','quickmall_hash');\n input.setAttribute('type','hidden');\n input.setAttribute('name','pwd');\n input.setAttribute('value',hash);\n form.appendChild(input);\n if (itemimage) {\n var img = itemimage.cloneNode(false);\n img.setAttribute('id','quickmall_itemimage');\n img.setAttribute('title',textdesc);\n form.appendChild(img);\n }\n input = document.createTextNode('Qty:'); \n form.appendChild(input);\n input = document.createElement('input'); \n input.setAttribute('id','quickmall_quant');\n input.setAttribute('name','qty1');\n input.setAttribute('size','3');\n input.setAttribute('value',quant);\n form.appendChild(input);\n \n input = document.createElement('input'); \n input.setAttribute('id','quickmall_itemdesc');\n input.setAttribute('type','hidden');\n input.setAttribute('name','item1');\n input.setAttribute('value',item);\n input.setAttribute('descid',descid);\n form.appendChild(input);\n \n input = document.createTextNode('Price:'); \n form.appendChild(input);\n input = document.createElement('input'); \n input.setAttribute('name','price1');\n input.setAttribute('size','9');\n form.appendChild(input);\n input = document.createTextNode('Limit:'); \n form.appendChild(input);\n input = document.createElement('input'); \n input.setAttribute('name','limit1');\n input.setAttribute('size','3');\n form.appendChild(input);\n input = document.createElement('input'); \n input.setAttribute('class','button');\n input.setAttribute('type','submit');\n input.setAttribute('value','Add Items to Store');\n form.appendChild(input);\n // and then insert it\n // add a row above this tdnode\n var tbl = document.createElement('table');\n var row = document.createElement('tr');\n var cell = document.createElement('td');\n //cell.setAttribute('colspan','2');\n cell.appendChild(form);\n row.appendChild(cell);\n tbl.appendChild(row);\n d.appendChild(tbl);\n}",
"function PostProcessing_createSelection() {\n var opts = [\"type\", \"title\", \"description\", /*\"start\", \"end\", */ \"tags\" /*, \"key\"*/];\n var sel = document.createElement(\"select\");\n for (var _i = 0, opts_1 = opts; _i < opts_1.length; _i++) {\n var opt = opts_1[_i];\n var optElm = document.createElement(\"option\");\n optElm.value = opt;\n optElm.innerHTML = opt;\n sel.appendChild(optElm);\n }\n return sel;\n }",
"function Select() {\r\n setButtonDisable(add, true);\r\n setButtonDisable(edit, true);\r\n\r\n if (!list.selectedItem) {\r\n setButtonDisable(del, true);\r\n return false;\r\n }\r\n entry.value = list.selectedItem.getAttribute(\"label\");\r\n setButtonDisable(del, false);\r\n return true;\r\n}",
"function itemSelector(request, response)\r\n{\r\n\tif (request.getMethod() == 'GET')\r\n\t{\r\n\t\t//Get the parameters and create the form\r\n\t\tgetParams(request, response);\r\n\t\tcreateSelectionForm(request, response);\r\n\t\tresponse.writePage(selectionForm);\r\n\t}\r\n\t//POST\r\n\telse\r\n\t{\r\n\t\t//Check the Search Criteria\r\n\t\tif(getSearchCriteria(request, response)==true)\r\n\t\t{\r\n\t\t\tpostItems(request, response);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tcreateSelectionForm(request, response);\r\n\t\t\tresponse.writePage(selectionForm);\r\n\t\t}\r\n\t}\r\n}",
"function selectForm(e){\n setActiveForm(e.target.name)\n }",
"function selectionSubItems(subItem, Form, cont_search) {\n\n let items = \"#\" + subItem + \"\";\n fromUpdateSearch = \"#form_search_\" + Form;\n $('.collection-item').css(\"background-color\", \"#fff\");\n $('.collection-item').css(\"color\", \"#26a69a\");\n $(items).css(\"background-color\", \"#26a69a\");\n $(items).css(\"color\", \"#eafaf9\");\n let text = sNameTitle + \" \" + $(items).text();\n $('#titleForm ').text(text);\n\n\n if (cont_search) {\n $('#cont_search_' + Form).css(\"display\", \"block\");\n disableEnableInput(Form, 0);\n disableEnableElementInput(fromUpdateSearch, 1);\n\n } else {\n $('#cont_search_' + Form).css(\"display\", \"none\");\n disableEnableInput(Form, 1);\n disableEnableElementInput(fromUpdateSearch, 0);\n }\n selectForm(Form);\n\n typeSelectionUpdateCreate = subItem.substring(subItem.indexOf(\"_\") + 1, subItem.length);\n\n}",
"function responseToSelectForm(selected_items)\n{\n var prompt = 'You selected: ' + selected_items.join(', ');\n Browser.msgBox(prompt);\n}",
"handleSelect(item) {\n this._selected = item\n this._opener.inputValue = item.text\n }",
"function newField(field, action) {\n var label = document.createElement(field + \"_label\");\n label.id = field + \"_label\";\n \n if (action == \"add\"){\n if (field == 'preacher')\n label.appendChild(document.createTextNode('Please enter preacher\\'s full name: '));\n else if (field == 'series')\n label.appendChild(document.createTextNode('Please enter title of series: '));\n }\n else if (action == \"select\") {\n if (field == 'preacher')\n label.appendChild(document.createTextNode('Preacher: '));\n else if (field == 'series')\n label.appendChild(document.createTextNode('Series: '));\n }\n\n label.setAttribute(\"style\", \"font-weight:normal\");\n\n // replace field label with new label\n var fieldDiv = document.getElementById(field + \"_label\");\n var parentDiv = fieldDiv.parentNode;\n parentDiv.replaceChild(label, fieldDiv);\n\n // create new input box\n if (action == \"add\"){\n var txtbox = document.createElement(\"input\");\n txtbox.setAttribute(\"type\", \"text\");\n }\n else if (action == \"select\") {\n var txtbox = document.createElement(\"select\");\n txtbox.setAttribute(\"size\", \"4\");\n \n // TODO: HERE\n var arr = $.parseJSON('<?php echo json_encode($preacher_list); ?>');\n var i = 0;\n for (i=0; i<=arr.length; i++) {\n var option = document.createElement(arr[i]);\n option.text = arr[i];\n txtbox.add(option);\n }\n }\n \n txtbox.setAttribute(\"id\", field);\n txtbox.setAttribute(\"value\", \"\");\n txtbox.setAttribute(\"name\", field);\n txtbox.setAttribute(\"style\", \"width:200px\");\n\n // replace selection box with input box\n var fieldDiv = document.getElementById(field);\n var parentDiv = fieldDiv.parentNode;\n parentDiv.replaceChild(txtbox, fieldDiv);\n\n // create link to select field instead\n var link = document.createElement('a');\n link.id = \"new_\" + field;\n \n if (action == \"add\") {\n var linkText = document.createTextNode('Select ' + field + ' from list');\n link.setAttribute('href', \"javascript:newField('\" + field + \"','select')\");\n } \n else if (action == \"select\") {\n var linkText = document.createTextNode('New ' + field + '?');\n link.setAttribute('href', \"javascript:newField('\" + field + \"','action')\");\n }\n \n link.appendChild(linkText);\n \n var fieldname = \"new_\" + field;\n var fieldDiv = document.getElementById(fieldname);\n var parentDiv = fieldDiv.parentNode;\n\n // replace existing node sp2 with the new span txtbox sp1\n parentDiv.replaceChild(link, fieldDiv);\n}",
"function productoSeleccionado(event, ui) {\n //recibo la lista de items a mostrar\n var sku = ui.item.value;\n //le paso la lista de items al campo sobre el que escribio la referencia\n $(this).val(sku.Referencia);\n //envio al objeto objRef, el id del formulario sobre el cual estoy situado\n objRef.idForm = $(this).closest(\"div\").attr(\"alt\");\n //con el id del formulario anterior se donde poner los valores de los campos\n $(\"#\" + objRef.idForm + \" #Referencia\").val(sku.Referencia);\n $(\"#\" + objRef.idForm + \" #idSku\").val(sku.idSKU);\n //seteo los precios recibidos, segun la referencia seleccionada\n objRef.precios=sku.Precio;\n event.preventDefault();\n //llenarDetalle(sku.Referencia);\n //lleno el select, con\n procesarSelect(sku.Referencia);\n \n}",
"function loadElementSelectionForm() {\n currentState = \"SelectElementTypes\";\n customInputsTitle.innerText = \"Select Element Types\";\n customInputsContent.innerHTML = \"\";\n var elementSelectionList = document.createElement(\"ul\");\n elementSelectionList.setAttribute(\"id\", \"element-selection-list\");\n elementSelectionList.setAttribute(\"class\", \"selection-list\");\n for (var type in elementSelectionForm.elementTypes) {\n var typeId = type + \"-selection\";\n // create list item element\n var newListItem = document.createElement(\"li\");\n newListItem.setAttribute(\"id\", type + \"-list-item\");\n // create checkbox element\n var newCheckbox = document.createElement(\"input\");\n newCheckbox.setAttribute(\"id\", typeId);\n newCheckbox.setAttribute(\"type\", \"checkbox\");\n newCheckbox.setAttribute(\"name\", \"\");\n newCheckbox.setAttribute(\"value\", type);\n if (elementSelectionForm.elementTypes[type]) {\n newCheckbox.setAttribute(\"checked\", \"checked\");\n newCheckbox.setAttribute(\"disabled\", \"disabled\");\n } else if (elementSelectionForm.selectables[type]) {\n newCheckbox.setAttribute(\"checked\", \"checked\");\n }\n // create label element for checkbox\n var newLabel = document.createElement(\"label\");\n newLabel.setAttribute(\"for\", typeId);\n newLabel.innerText = type;\n // add elements to DOM\n newListItem.appendChild(newCheckbox);\n newListItem.appendChild(newLabel);\n elementSelectionList.appendChild(newListItem);\n }\n customInputsContent.appendChild(elementSelectionList);\n // add event listeners\n\n var _loop2 = function _loop2(_type2) {\n var typeId = _type2 + \"-selection\";\n document.getElementById(typeId).addEventListener(\"click\", function () {\n elementSelectionForm.selectables[_type2] = !elementSelectionForm.selectables[_type2];\n });\n };\n\n for (var _type2 in elementSelectionForm.selectables) {\n _loop2(_type2);\n }\n}",
"function create_select () {\n var contenedor = $(self.container);\n // Div principal MySelect\n var div_principal = $('<div class=\"myselect container '+self.type+'\"></div>');\n div_principal.css({\n 'width': self.width,\n 'font-size': self.font_size,\n 'z-index':self.z_index,\n 'color':self.color,\n 'font-weight': self.font_weight\n });\n // Div de la caja de opciones\n var div_options_box = create_options_box();\n // Div de la caja de seleccion\n var div_select_box = create_select_box(div_principal, div_options_box);\n // Evento de contraer/expandir\n if (self.collapsable)\n div_select_box.on('click', function(){\n div_principal.toggleClass('active');\n div_options_box.stop();\n div_options_box.animate(toggle_animation(div_options_box),self.transition);\n });\n // Añadir las cajas al contenedor\n div_principal.append(div_select_box);\n div_principal.append(div_options_box);\n contenedor.append(div_principal);\n }",
"function addAFormItem(itemNum, itemName) {\n let resultsArea = document.getElementById('results-container');\n createForm(itemName, resultsArea, itemNum);\n\n itemsChosen.push(itemName);\n}",
"createForm () {\n if (document.getElementById('leaderboardButton')) {\n document.getElementById('leaderboardButton').remove();\n }\n crDom.createLeaderboardButton();\n crDom.createForm();\n crDom.createCategoriesChoice(this.filter.category);\n crDom.createDifficultyChoice(this.filter.difficulty);\n crDom.createRangeSlider(this.filter.limit);\n crDom.createStartButton();\n }",
"function newForm() {\n\n var form = document.createElement(\"form\")\n form.style = \"heigth:100px;width:300px;border-style:solid;border-color:black;border-width:1px\"\n form.id = \"form\"\n\n var ObjLabel = document.createElement(\"label\")\n ObjLabel.textContent = \"Object \"\n\n var ObjInput = document.createElement(\"input\")\n ObjInput.id = \"object-input\"\n ObjInput.name = \"object\"\n ObjInput.type = \"text\"\n ObjInput.placeholder = \"Object name\"\n\n var QtyLabel = document.createElement(\"label\")\n QtyLabel.textContent = \"Quantity \"\n\n var QtyInput = document.createElement(\"input\")\n QtyInput.id = \"quantity-input\"\n QtyInput.name = \"quantity\"\n QtyInput.type = \"text\"\n QtyInput.placeholder = \"Please insert a positive number\"\n\n var submit = document.createElement(\"input\")\n submit.id = \"submit\"\n submit.type = \"button\"\n submit.value = \"Confirm\"\n submit.setAttribute(\"onmousedown\", \"addItems()\")\n\n // adding all items under \"form\" in the DOM tree\n form.appendChild(ObjLabel)\n form.appendChild(ObjInput)\n form.appendChild(document.createElement(\"br\"))\n form.appendChild(QtyLabel)\n form.appendChild(QtyInput)\n form.appendChild(document.createElement(\"br\"))\n form.appendChild(submit)\n\n return form\n}",
"function createForm(itemName, resultsArea) {\n // Name input, but disabled because the name is from json file\n let labelElem = document.createElement(\"input\");\n labelElem.setAttribute('name', `item${numOfSelectedItems}`);\n labelElem.setAttribute('class', 'form-control mr-5 mb-4 shadow');\n labelElem.setAttribute('id', `item${numOfSelectedItems}`);\n labelElem.setAttribute('type', 'text');\n labelElem.setAttribute('placeholder', 'Exercise name');\n labelElem.setAttribute('value', itemName);\n labelElem.required = true;\n labelElem.readOnly = true;\n\n // Time input\n let inputTimeElement = document.createElement(\"input\");\n inputTimeElement.setAttribute('type', 'number');\n inputTimeElement.setAttribute('name', `item${numOfSelectedItems}timeInput`);\n inputTimeElement.setAttribute('id', `item${numOfSelectedItems}timeInput`);\n inputTimeElement.setAttribute('class', 'form-control mr-5 mb-4 shadow');\n inputTimeElement.setAttribute('placeholder', 'Minutes exercised');\n inputTimeElement.setAttribute('step', '1');\n inputTimeElement.setAttribute('min', '1');\n inputTimeElement.required = true;\n\n // Remove (X) button\n let removeEntry = document.createElement(\"button\");\n removeEntry.setAttribute('id', `remove${numOfSelectedItems}Entry`);\n removeEntry.setAttribute('class', 'btn btn-danger mb-4 shadow');\n removeEntry.setAttribute('type', 'button');\n removeEntry.innerHTML = \"X\";\n\n // 2 line breakers for space consistency between entries\n let linebreakElem = document.createElement(\"br\");\n linebreakElem.setAttribute('id', `br1${numOfSelectedItems}`);\n let linebreakElem2 = document.createElement(\"br\");\n linebreakElem2.setAttribute('id', `br2${numOfSelectedItems}`);\n\n // Create onclick listner to know when to remove an entry\n removeEntry.setAttribute('onClick', `renameAttributes('item${numOfSelectedItems}',` + \n `'item${numOfSelectedItems}timeInput',` + \n `'remove${numOfSelectedItems}Entry',` +\n `'br1${numOfSelectedItems}',` +\n `'br2${numOfSelectedItems}',` +\n `true)`);\n\n inputTimeElement.setAttribute('onInput', 'validate_time_field(this)');\n \n // Appends the entry components to the entry area\n resultsArea.appendChild(labelElem);\n resultsArea.appendChild(inputTimeElement);\n resultsArea.appendChild(removeEntry);\n resultsArea.appendChild(linebreakElem);\n resultsArea.appendChild(linebreakElem2);\n\n ++numOfSelectedItems;\n}",
"function create_entity_list_form() {\n var str_array = [];\n str_array.push(\"<form name='entities'>\");\n str_array.push(\"<select name='entity' onchange='update_entity_select(this.options[this.selectedIndex].value);'>\");\n for(var ent in Domain.entities) {\n var sel = \"\";\n if(ent == \"User\") {\n sel = \"selected\";\n }\n str_array.push(\"<option value='\" + ent + \"' \" + sel + \">\" + ent + \"</option>\");\n }\n str_array.push(\"</select>\");\n str_array.push(\"</form>\");\n return str_array.join(\"\\n\");\n}",
"function populateForm() {\n\n // TODO(done): Add an <option> tag inside the form's select for each product\n const selectElement = document.getElementById('items');\n\n for (let product of Product.allProducts) {\n let optionElement = document.createElement('option');\n optionElement.textContent = product.name;\n selectElement.appendChild(optionElement);\n }\n\n}",
"if (availableOptions.length > 0) {\n setSelected(newItem);\n setSearch(newItem.label);\n if (onSelect) onSelect({ event, item: newItem });\n }",
"function populateForm() {\n\n //TODO: Add an <option> tag inside the form's select for each product\n var selectElement = document.getElementById('items');\n for (var i in Product.allProducts) {\n var optionEl = document.createElement('option');\n optionEl.textContent = Product.allProducts[i].name;\n selectElement.appendChild(optionEl);\n }\n}",
"function populateForm() {\n //TODO: Add an <option> tag inside the form's select for each product\n Product.allProducts.forEach((prod) => {\n createTheElement('option', prod.name, selectElement);\n });\n\n}",
"function dropDownInsert(txt , selections) {\r\n\tif(window.isIE)\r\n\t{\r\n\t\ttxtBoxInsert(txt);\r\n\t\treturn false;\r\n\t}\r\n\tvar UIX = parseInt( getUniqueID() );\r\n\tvar newID = 'qry'+UIX\r\n\tvar options = selections.split(';');\r\n\t\r\n\tvar nProps = new Object();\r\n\tnProps.id = newID;\r\n\tnProps[\"class\"] = \"qryPart\";\r\n\tnProps.className='qryPart';\r\n\taddElement( 'components_builder' , 'div' , txt , nProps );\r\n\t\r\n\tvar iProps = new Object();\r\n\tiProps.id = 'selector_'+newID;\r\n\tiProps.type = 'text';\r\n\tvar selector = addElement( newID , 'select' , null , iProps );\r\n\t\r\n\tvar props = new Object();\r\n\tprops.id = '';\r\n\tprops. value = '';\t\t\r\n\tfor(var i=0;i<options.length;i++) {\r\n\t\tprops.id = 'option_'+i+'_'+newID;\r\n\t\tprops. value = options[i];\r\n\t\taddElement( 'selector_'+newID , 'option' , options[i] , props );\r\n\t}\r\n\t\r\n\tvar aProps = new Object();\r\n\taProps.id = newID+'_closer';\r\n\taProps.href = 'javascript:;';\r\n\taProps[\"class\"] = \"closer\";\r\n\taProps.className='closer';\r\n\tvar a = addElement( newID , 'span' , 'x' , aProps );\r\n\ta.onclick = function(){ deleteItem( 'components_builder' , newID ); };\r\n}",
"function populateForm() {\n\n // Add an <option> tag inside the form's select for each product\n const selectElement = document.getElementById('items');\n for (let i = 0; i < Product.allProducts.length; i++) {\n const addOptions = document.createElement('option');\n addOptions.innerText = Product.allProducts[i].name;\n addOptions.value = Product.allProducts[i].name;\n selectElement.appendChild(addOptions);\n }\n\n}",
"function createTextToComplet(qElement) {\n if (questions[pageCounter].textToComplet != null) {\n $(document).ready(function () {\n $(\"select\").formSelect();\n });\n\n var item = $('<div class=\"input-field col s12\"><select>');\n var input = \"\";\n for (var i = 0; i < questions[pageCounter].options1.length; i++) {\n input =\n '<option value=\"\">' +\n questions[pageCounter].options1[i] +\n \"</option>\";\n item.append(input);\n }\n item.append(\"</select></div>\");\n qElement.append(item);\n }\n }",
"marginItem(value) {\n \n \n let selectables = this.object_item(value).selectables;\n let selections = this.object_item(value).selections;\n \n \n if (selectables.length > 0) {\n\n selectables.addClass('OPTION-selected')\n .hide();\n\n selections.addClass('OPTION-selected')\n .show();\n\n this.object_item(value).options.prop('selected', true); // active selected original select\n\n\n\n }\n }",
"function createSelectionGroupsHTML(i) {\n var el = document.getElementsByClassName('container-selections');\n var options = createSelectionOptionsHTML(inputInfo[i]);\n var selGroupHTML =\n \"<div class='selection-category bdr-lt bdr-rad-lt'>\" +\n \"<div class='bg-red txt-white txt-md txt-ctr pad-rg'>\" +\n selHeaders[i] + \"</div>\" +\n \"<form class='selection-group bg-white'>\" + options + \"</form>\" +\n \"</div>\";\n el[0].insertAdjacentHTML('afterbegin', selGroupHTML);\n}",
"function SelectMultiChoice(mySelectElement, myFormElement, myAddButton, myDisplaySpace,\n\t\t\t\t\t\t\t\t myRemoveItemClass, myPlaceholder, myContainer) {\n\n\t\t\tmyContainer = (typeof myContainer === 'undefined') ? $(\"body\") : myContainer; // default value\n\n\t\t\tvar container = myContainer; // the container that holds this SelectMultiChoice\n\t\t\tvar selectElement = $(mySelectElement, container);//the actual select element of the form.\n\t\t\tvar formElement = $(myFormElement, container);//the hidden form field where we store the actual data we want as a list\n\t\t\tvar addButton = $(myAddButton, container);//The button we click to add items to this.formElement\n\t\t\tvar displaySpace = $(myDisplaySpace, container);//Where we'll draw our set of jquery-ui boxes showing what's in this.formElement\n\t\t\tvar removeItemClass = myRemoveItemClass;//The class applied to the X's of the jQuery-ui boxes.\n\t\t\tvar placeholder = myPlaceholder;//The text to display in an empty this.displaySpace.\n\n\t\t\t/*a few items we use throughout this object*/\n\t\t\tthis.itemList = new List( $(this.formElement).val() );//fetch a list object of the current values.\n\t\t\tvar itemArray = this.itemList.toArray();//make that list into an array for use with native functions.\n\t\t\tvar isText = selectElement.is(\"input\");//We do a few different behaviors for clearing a form if we're dealing with a text field or a select box.\n\n\t\t\tthis.isTextHelper = isText;\n\t\t\tthis.formElementHelper = formElement;\n\t\t\tthis.selectHelper = selectElement;\n\t\t\t\n\t\t\tvar local = this;//for use in anonymous functions for things like jQuery event handlers.\n\n\t\t\t/* METHODS */\n\n\t\t\t//This method takes a value and loops over the options in this.selectElement, returning the text displayed for the option.\n\t\t\tthis.findSelectOption = function(myValue){\n\t\t\t\tvar textValue = myValue;//default to just showing the straight value.\n\n\t\t\t\t$(\"option\", this.selectElement).each(function(i, item){\n\t\t\t\t\t//have we found a match for myValue?\n\t\t\t\t\tif($(item).attr(\"value\") == myValue){\n\t\t\t\t\t\ttextValue = $(item).html();\n\t\t\t\t\t\treturn false;//returning false is how to break out of an each() loop.\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t//because we use non-breaking spaces to indent items replace all 's with \" \"\n\t\t\t\ttextValue = textValue.replace(/ /g, \" \");//that replace string may look wild, but it's just some RegEx.\n\t\t\t\ttextValue = $.trim(textValue);//also trim any leading/trailing whitespace.\n\n\t\t\t\treturn textValue;\n\t\t\t}\n\n\t\t\t//When we add an item from a select box we'd like to disable it to prevent duplicates.\n\t\t\tthis.disableOption = function(myValue) {\n\t\t\t\t$(\"option\", selectElement).each(function(i, item){\n\t\t\t\t\t//have we found a match for myValue?\n\t\t\t\t\tif($(item).attr(\"value\") == myValue){\n\t\t\t\t\t\t$(item).prop(\"disabled\", 1);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t//Also reset our selector, do this by looping over the options until we hit the first item that isn't disabled.\n\t\t\t\t$(\"option\", selectElement).each(function(i, item){\n\t\t\t\t\tif(!$(item).prop(\"disabled\")){\n\t\t\t\t\t\t$(item).prop(\"selected\", true);\n\t\t\t\t\t\treturn false;//returning false breaks out of an each() loop.\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t//If we remove an item previous selected from a select box re-enable it.\n\t\t\tthis.enableOption = function(myValue) {\n\t\t\t\t$(\"option\", this.selectElement).each(function(i, item){\n\t\t\t\t\t//have we found a match for myValue?\n\t\t\t\t\tif($(item).attr(\"value\") == myValue){\n\t\t\t\t\t\t$(item).removeAttr('disabled');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t//There are a few cases where we will want to re-enable all options.\n\t\t\tthis.enableAllOptions = function() {\n\t\t\t\t$(\"option\", this.selectElement).each(function(i, item){\n\t\t\t\t\t$(item).removeAttr('disabled');\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t//draw the jQuery-UI boxes showing what items are currently in formElement.\n\t\t\tthis.drawUIboxList = function () {\n\t\t\t\t//Use the values of itemArray to build an array of objects, containing the value and what to display in the jQuery-ui boxes\n\t\t\t\tvar dispArray = new Array();\n\n\t\t\t\tfor(var n in itemArray){\n\t\t\t\t\tvar value = {\n\t\t\t\t\t\t\"item\": itemArray[n],\n\t\t\t\t\t\t\"display\": localFindSelectOption(itemArray[n]) /*This calls a method that finds the text displayed for this value in this.selectElement*/\n\t\t\t\t\t}\n\n\t\t\t\t\tdispArray.push(value);\n\t\t\t\t}\n\n\n\t\t\t\t/* if there are no items, write our placeholder text in this.displaySpace */\n\t\t\t\tif(dispArray.length > 0)\n\t\t\t\t\tdisplaySpace.html(\"\");//blank it to make room for our new spans.\n\t\t\t\telse\n\t\t\t\t\tdisplaySpace.html(placeholder);//there's nothing, so just show our placeholder text.\n\n\t\t\t\t/* draw a span for each item in dispArray */\n\t\t\t\t$(dispArray).each(function(n) {\n\n\t\t\t\t\tvar item = dispArray[n];\n\t\t\t\t\tvar cleanItem = item.item.replace(/\"/g, '"');//if the user provides an entry with double-quotes it breaks our setting of the item attribute, this sanitizes the entry.\n\n\t\t\t\t\tvar span = '<span class=\"ui-state-default ui-corner-all\">';\n\t\t\t\t\tspan += item.display;\n\t\t\t\t\tspan += '<span class=\"ui-icon ui-icon-close ' + removeItemClass + '\" style=\"display: inline-block;\" item=\"';\n\t\t\t\t\tspan += cleanItem;\n\t\t\t\t\tspan += '\" index=\"';\n\t\t\t\t\tspan += n;\n\t\t\t\t\tspan += '\" title=\"Remove\"></span></span>';\n\n\t\t\t\t\tdisplaySpace.append(span);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t//this method just fires the formElement.change() event so we draw the default values.\n\t\t\tthis.init = function(){\n\t\t\t\tformElement.change();\n\t\t\t}\n\n\t\t\tvar localFindSelectOption = this.findSelectOption;//We live in a kind of scoping hell since we use anonymous event handling functions with jQuery.\n\t\t\tvar localDrawUIboxList = this.drawUIboxList;\n\t\t\tvar localDisableOption = this.disableOption;\n\t\t\tvar localEnableOption = this.enableOption;\n\t\t\tvar localEnableAllOptions = this.enableAllOptions;\n\n\t\t\t/* Event Handlers */\n\t\t\t//Action to re-draw this.displaySpace each time this.formElement is changed\n\t\t\tformElement.on(\"change\", function(){\n\t\t\t\t//We just got a new value for this.formElement, update our itemList and item array.\n\t\t\t\tlocal.itemList = new List( $(this).val() );//fetch a list object of the current values.\n\t\t\t\titemArray = local.itemList.toArray();//make that list into an array for use with native functions.\n\n\t\t\t\t//if we've wound-up with a fresh item array make sure all our options are re-activated.\n\t\t\t\tif(itemArray.length == 0)\n\t\t\t\t\tlocalEnableAllOptions();\n\n\t\t\t\t//now call the drawUIboxList() method.\n\t\t\t\tlocalDrawUIboxList();\n\t\t\t});\n\n\t\t\t//what happens when we click the button to add an item?\n\t\t\taddButton.on(\"click\", function(e){\n\t\t\t\te.preventDefault();//don't let a click percolate up.\n\t\t\t\tlocal.addValue();\n\t\t\t});\n\n\t\t\tthis.addValue = function(){\n\t\t\t\t//Get the current value of our select box.\n\t\t\t\tvar myVal = selectElement.val();\n\n\t\t\t\t/* don't do anything if the text field is empty */\n\t\t\t\tif(myVal != \"\") {\n\t\t\t\tif (myVal == \"unknown\") {\n\t\t\t\t\t\tmyVal = \"#unknown\";\n\t\t\t\t\t}\n\t\t\t\t\t//now append our value to this.itemList.\n\n\t\t\t\t\tthis.itemList.append(myVal);\n\t\t\t\t\t//if this is a text box clear out the current value.\n\t\t\t\t\tif(isText) {\n\t\t\t\t\t\t selectElement.val(\"\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\t localDisableOption(myVal);\n\t\t\t\t\t}\n\n\t\t\t\t\t//Update this.formElement to match our revised itemList.\n\t\t\t\t\tformElement.val( this.itemList.toString() );\n\t\t\t\t\tformElement.change();//make sure the change event fires.\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//What happens when we remove an item from our display space?\n\t\t\t$(container).on(\"click\", \"span.\" + removeItemClass, function(e){\n\t\t\t\te.preventDefault();//don't let a click percolate up.\n\n\t\t\t\tvar myVal = $(this).attr(\"item\");\n\t\t\t\tvar myIndex = $(this).attr(\"index\");\n\n\t\t\t\t//take our existing list of labs, and remove this one from it.\n\t\t\t\tlocal.itemList.removeByIndex(myIndex); /* remove by index to prevent duplicates from going with it */\n\n\t\t\t\t//having removed it we can re-enable it if this is a select box.\n\t\t\t\tif(!isText) localEnableOption(myVal);\n\n\t\t\t\t//Update this.formElement to match our revised itemList.\n\t\t\t\tformElement.val( local.itemList.toString() );\n\t\t\t\tformElement.change();//make sure the change event fires.\n\t\t\t});\n\n\t\t\t//check for enter key press if this element is focused\n\t\t\t$(selectElement).keypress(function(e) {\n\t\t\t\tif(e.which == 13) {\n\t\t\t\t \tlocal.addValue();\n\t\t\t \treturn false; // stop form from submitting\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t});\n\n\t\t\t/*what to do if a user submits the form with text un-added in a text-based SelectMultiChoice?*/\n\t\t\tif(isText){\n\t\t\t\tselectElement.parents().each(function(i){\n\t\t\t\t\tif ($(this).is(\"form\") && $(this).attr(\"SelectMultiListening\") != 1){\n\t\t\t\t\t\t//add a listener\n\t\t\t\t\t\t$(this).on(\"submit\", function(e){\n\t\t\t\t\t\t\t//only do an automatic addValue() if it is helpful.\n\t\t\t\t\t\t\tif (local.selectHelper.val() != \"\" || local.itemList.toString() == \"\") {\n\t\t\t\t\t\t\t\tlocal.addValue();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t//set SelectMultiListening attribute for this form so we don't put more than one listener on it.\n\t\t\t\t\t\t$(this).attr(\"SelectMultiListening\", 1);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t}",
"function generateSelectionMenu() {\n // Iterate through the river info to determine the dropdow groupings\n var selectionGroups = [];\n for(var i=0; i < riverInfo.length; i++) {\n if(i == 0) {\n selectionGroups.push(riverInfo[i].state);\n } else {\n if(selectionGroups.includes(riverInfo[i].state) == false) {\n selectionGroups.push(riverInfo[i].state);\n }\n }\n }\n\n // Iterate over each selection group, placing the group in the item-list\n for(var i=0; i < selectionGroups.length; i++) {\n var currentGroup = '<div id=\"' + abbrState(selectionGroups[i], 'abbr') + '-group\" class=\"item-group\" data-state=\"' + selectionGroups[i] + '\"></div>';\n $('.item-list').append(currentGroup);\n }\n\n // Iterate over each item in the river info list, placing each one in its appropriate dropdown group\n riverInfo.forEach((riverData, i) => {\n var selectionIDText = riverData.river.toLowerCase().split(\" \").join(\"-\") + \"-selection\";\n var currentItem = document.createElement('div');\n currentItem.id = riverData.river.toLowerCase().split(\" \").join(\"-\") + '-selection';\n currentItem.classList.add('item');\n currentItem.dataset.index = i;\n currentItem.addEventListener('click', () => selectItem(selectionIDText));\n currentItem.innerHTML = riverData.river;\n var itemGroup = '#' + abbrState(riverData.state, 'abbr') + '-group';\n $(itemGroup).append(currentItem);\n })\n}",
"function FillFormSelect() {\n //Categories\n let cat = [];\n for (let el of Categories.values()) {\n cat.push(el);\n }\n $(\"#formCategoryId\").empty();\n $(\"#formCategoryId\").append($('<option>', { value: -1, text: \"New Category\" }));\n cat.sort((a, b) => a.Name < b.Name);\n for (let category of cat) {\n $('<option>', { value: category.Id, text: category.Name }).appendTo(\"#formCategoryId\");\n }\n\n //Publishers\n let pub = [];\n for (let el of Publishers.values()) {\n pub.push(el);\n }\n pub.sort((a, b) => a.Name < b.Name);\n $(\"#formPublisherId\").empty();\n $(\"#formPublisherId\").append($('<option>', { value: -1, text: \"New Publisher\" }));\n for (let publisher of pub) {\n $('<option>', { value: publisher.Id, text: publisher.Name }).appendTo(\"#formPublisherId\");\n }\n\n //Languages\n let lan = [];\n for (let el of Languages.values()) {\n lan.push(el);\n }\n lan.sort((a, b) => a.Name < b.Name);\n $(\"#formLanguageId\").empty();\n $(\"#formLanguageId\").append($('<option>', { value: -1, text: \"New Language\" }));\n for (let language of lan) {\n $('<option>', { value: language.Id, text: language.Name }).appendTo(\"#formLanguageId\");\n }\n\n //Authors\n let auth = [];\n for (let el of Authors.values()) {\n auth.push(el);\n }\n auth.sort((a, b) => `${a.FirstName}${a.LastName}` < `${b.FirstName}${b.LastName}`);\n $(\"#formAuthorId\").empty();\n $(\"#formAuthorId\").append($('<option>', { value: -1, text: \"New Author\" }));\n for (let author of auth) {\n $('<option>', { value: author.Id, text: `${author.FirstName} ${author.LastName}` }).appendTo(\"#formAuthorId\");\n }\n }"
] |
[
"0.6568907",
"0.61604923",
"0.60122895",
"0.59901494",
"0.5973197",
"0.5971516",
"0.59151924",
"0.5914817",
"0.5910627",
"0.5890022",
"0.58494586",
"0.58254844",
"0.58111006",
"0.580995",
"0.5785791",
"0.5781966",
"0.574826",
"0.57324183",
"0.5718386",
"0.56893796",
"0.56878626",
"0.56734836",
"0.5650249",
"0.56472194",
"0.56429833",
"0.5641419",
"0.5637592",
"0.56368023",
"0.561905",
"0.5603623"
] |
0.69874
|
0
|
For paginated scrolling, simply scroll the gallery one item in the given // direction and let css scroll snaping handle the specific alignment.
|
function scrollToNextPage() {
gallery_scroller.scrollBy({
left: gallery_item_size,
top: 0,
behavior: 'smooth'
});
// updateBtns()
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"scroll(direction) {\n // Keeps the index from going higher than the max length or lower than 0\n if (direction === \"left\") {\n this.currentIndex--;\n } else this.currentIndex++;\n if (this.currentIndex < 0) {\n this.currentIndex = this.indexMax;\n return;\n } else if (this.currentIndex > this.indexMax-1) {\n this.currentIndex = 0;\n return;\n } else {\n this.images.forEach((currentValue, index) => {\n if (index === this.currentIndex) {\n currentValue.style.display = \"flex\";\n } else {\n currentValue.style.display = \"none\";\n }\n });\n }\n }",
"function scroll(direction) {\n if (direction === 'prev') {\n itemPositions.push(itemPositions.shift());\n } else if (direction === 'next') {\n itemPositions.unshift(itemPositions.pop());\n }\n $('#scroller .item').removeClass('left-hidden farLeft left middle right farRight right-hidden').each(function(index) {\n $(this).addClass(itemPositions[index]);\n });\n }",
"function drag_scroll(dir)\n {\n if (!drag_active)\n return;\n\n var old_top = list_scroll_top;\n container.parent().get(0).scrollTop += p.scroll_step * dir;\n list_scroll_top = container.parent().scrollTop();\n scroll_timer = null;\n\n if (list_scroll_top != old_top)\n scroll_timer = window.setTimeout(function(){ drag_scroll(dir); }, p.scroll_speed);\n }",
"function scroll(e, dir){\r\n\tif(e.button == 0){\r\n\t\tif(dir){\r\n\t\t\t//scroll right\r\n\t\t\t// v.scrollLeft += (pageWidth*2/5);\r\n\t\t\t$('#scrollBody').animate({\r\n\t\t\t\tscrollLeft: v.scrollLeft + (pageWidth*2/5)\r\n\t\t\t}, 1500);\r\n\t\t\t\r\n\t\t}else{\r\n\t\t\t//scroll left\r\n\t\t\t// v.scrollLeft += -(pageWidth*2/5);\r\n\t\t\t$('#scrollBody').animate({\r\n\t\t\t\tscrollLeft: v.scrollLeft - (pageWidth*2/5)\r\n\t\t\t}, 1500);\r\n\t\t}\r\n\t}\r\n}",
"function navigate(direction) {\n var numberPhotos = self.placePhotos().length;\n var current = self.currentIndex();\n var next = (current + direction) % numberPhotos;\n if (next < 0) {\n next = numberPhotos - 1;\n }\n self.currentPhoto(self.placePhotos()[next]);\n self.currentIndex(next);\n }",
"_snapCarouselPage() {\n this._setTransitionDuration(this.getTransitionDuration());\n\n var leastDistance = 10000;\n var nearestPageIndex = 0;\n\n // Determine nearest snapPoint.\n for (var i = 0; i < this.__pages.length; i++) {\n var snapPoint = -i * this.__carouselWidth;\n var distance = this.__onMoveOffset[0] - snapPoint;\n if (Math.abs(distance) < leastDistance) {\n leastDistance = Math.abs(distance);\n nearestPageIndex = i;\n }\n }\n\n if (this.getCurrentIndex() == nearestPageIndex) {\n this._refreshScrollerPosition();\n } else {\n this.setCurrentIndex(nearestPageIndex);\n }\n }",
"_handlePaginatorClick(direction) {\n this._stopInterval();\n this._scrollHeader(direction);\n }",
"navigateGalleryImage(direction) {\n\n // Get currently displayed image.\n const galleryListEl = this.galleryContentEl.querySelector('.gallery__list');\n const currentImageEl = galleryListEl.querySelector('.visible');\n if (!currentImageEl) return false;\n\n // Get next image and display it.\n const nextImageEl = direction === 'left' ? currentImageEl.previousSibling : currentImageEl.nextSibling;\n if (!nextImageEl) return false;\n currentImageEl.classList.remove('visible');\n nextImageEl.classList.add('visible');\n\n return true;\n }",
"function animateScroll() {\n var time = 1; //Seconds on animation to switch\n\n carousel.scrollLeft += frame; //Scroll \n if (carousel.scrollLeft < initial + width) { //If image isn't fixed within carousel viewport\n window.requestAnimationFrame(animateScroll); //Call next frame\n }\n }",
"function animate() {\n // Get scroll direction\n if (event.deltaY > 0) {\n scrollDirection = 'down';\n } else if (event.deltaY < 0) {\n scrollDirection = 'up';\n }\n myLoop();\n\n // Run animation\n setTimeout(function () {\n $('.page').bind('mousewheel', wheelHandler);\n toogleScrollEvent = true;\n }, 2000);\n}",
"_scrollToItem(idx) {\n const item = this.items[idx];\n if (!item) {\n return;\n }\n\n const props = this._vertical ? ['top', 'bottom'] :\n this._isRTL ? ['right', 'left'] : ['left', 'right'];\n\n const scrollerRect = this._scrollerElement.getBoundingClientRect();\n const nextItemRect = (this.items[idx + 1] || item).getBoundingClientRect();\n const prevItemRect = (this.items[idx - 1] || item).getBoundingClientRect();\n\n let scrollDistance = 0;\n if (!this._isRTL && nextItemRect[props[1]] >= scrollerRect[props[1]] ||\n this._isRTL && nextItemRect[props[1]] <= scrollerRect[props[1]]) {\n scrollDistance = nextItemRect[props[1]] - scrollerRect[props[1]];\n } else if (!this._isRTL && prevItemRect[props[0]] <= scrollerRect[props[0]] ||\n this._isRTL && prevItemRect[props[0]] >= scrollerRect[props[0]]) {\n scrollDistance = prevItemRect[props[0]] - scrollerRect[props[0]];\n }\n\n this._scroll(scrollDistance);\n }",
"function scroller(){\n\t\t\t\t\t$('.scrollPage').click(function(){\n\t\t\t\t\t\tvar elementClicked = $(this).attr(\"href\");\n\t\t\t\t\t\tvar destination = $(elementClicked).offset().top;\n\t\t\t\t\t\t$(\"html:not(:animated),body:not(:animated)\").animate({\n\t\t\t\t\t\t\tscrollTop: destination - 1 //Number being the pixel distance from destination.\n\t\t\t\t\t\t}, 1000, 'easeInOutQuint');\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t}",
"_cycle(direction) {\n let items = this.node.querySelectorAll(`.${ITEM_CLASS}`);\n let index = this._activeIndex;\n let active = this.node.querySelector(`.${ACTIVE_CLASS}`);\n active.classList.remove(ACTIVE_CLASS);\n if (direction === 'up') {\n this._activeIndex = index === 0 ? index : index - 1;\n }\n else {\n this._activeIndex = index < items.length - 1 ? index + 1 : index;\n }\n active = items[this._activeIndex];\n active.classList.add(ACTIVE_CLASS);\n domutils_1.ElementExt.scrollIntoViewIfNeeded(this.node, active);\n }",
"function swipeFunc(e, dir) {\n\t\t\t\t\n\t\t\t\tvar $currentTarget = $(e.currentTarget);\n\n\t\t\t\tif ($currentTarget.data('slideCount') > 1) {\n\t\t\t\t\t$currentTarget.data('dir', '');\n\t\t\t\t\tif (dir === 'left') {\n\t\t\t\t\t\t$currentTarget.cycle('next');\n\t\t\t\t\t}\n\t\t\t\t\tif (dir === 'right') {\n\t\t\t\t\t\t$currentTarget.data('dir', 'prev');\n\t\t\t\t\t\t$currentTarget.cycle('prev');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"function scrollToNextPage() {\n card_scroller.scrollBy(card_item_size, 0);\n }",
"function slide(direction) {\n var directionPositionMapping,\n stringInitialRectClip;\n\n switch (direction) {\n case \"right\":\n directionPositionMapping = 3;\n stringInitialRectClip = \"rect(0px, 958px, 634px, 958px)\";//TODO: needs to get height and width auto\n //now we need to decremnent the pic previous.\n setZIndexAtCarPos(false, intIndexCurrentImg -1);\n // upon touch, decrements pic that lies underneath\n setZIndexAtCarPos(false, intIndexCurrentImg);\n break;\n case \"left\":\n directionPositionMapping = 1;\n stringInitialRectClip = \"rect(0px 0px 634px 0px)\";\n setZIndexAtCarPos(false, intIndexCurrentImg +1);\n // upon touch, decrements pic that lies underneath\n setZIndexAtCarPos(false, intIndexCurrentImg);\n break;\n }\n\n (direction === \"right\") ? intIndexCurrentImg++: intIndexCurrentImg--;\n\n setZIndexAtCarPos(true, intIndexCurrentImg); // for image we want to slide in\n\n imgToSlide = arrayDOMCache[getImageArrayPosModulo(intIndexCurrentImg)];\n imgToSlide.style.clip = stringInitialRectClip;\n itrClipParam = getClipParam(imgToSlide.style.clip, directionPositionMapping);\n intervalTimer(directionPositionMapping, direction, 50);\n }",
"function myLoop() {\n\n // Scrolled down\n if (scrollDirection === 'down') {\n animateDown();\n } else {\n animateUp();\n }\n}",
"function navigate(direction) {\n // hide current image\n current.style.display = 'none';\n //change the index\n index += direction;\n\n // make sure the index isn't negative when using prev\n if (direction === -1 && index < 0) {\n index = amount -1;\n }\n // when the index gets too high and it can't be found set it to 0\n if (direction === 1 && !items[index]) {\n index = 0;\n }\n\n //set set the current image to the current index\n current = carouselImages[index];\n // display the current image\n current.style.display = 'inline-block';\n}",
"function moveSlide(dir) {\n\t// try to advance the current image\n\tcurrentImage += dir;\n\t// check for before the first, or after the last...\n\tif (currentImage < 0) {\n\t\tcurrentImage = images.length - 1;\n\t} else if (currentImage === images.length) {\n\t\tcurrentImage = 0;\n\t}\n\n\t// TODO: make adjustmetns in order to manage the fade out and fade in of the image\n\ttargetImage.src = images[currentImage];\n\ttargetImage.style.opacity = 1;\n}",
"function animateMobile() {\n // Get scroll direction\n if (swipeDirection === 'down') {\n scrollDirection = 'down';\n } else if (swipeDirection === 'up') {\n scrollDirection = 'up';\n }\n myLoop();\n\n // Run animation\n setTimeout(function () {\n mc.on(\"swipedown\", function (e) {\n // scroll down analog - next items animation\n swipeDirection = 'up';\n swipeHandler();\n });\n\n mc.on(\"swipeup\", function (e) {\n // scroll up analog - previuos items animation\n swipeDirection = 'down';\n swipeHandler();\n });\n toogleScrollEvent = true;\n }, 2000);\n}",
"function jumpToPosition(){\n flexImages3.scrollIntoView({behavior: \"smooth\", block: 'center',inline: 'center'});\n}",
"function scroll(dir){\n\t\t//if dir is \"tb\" (top -> bottom) increment current, \n\t\t//else if \"bt\" decrement it\n\t\tcurrent\t= (dir == 'tb')?current + 1:current - 1;\n\t\t\n\t\t//we want a circular slideshow, \n\t\t//so we need to check the limits of current\n\t\tif(current == total) current = 0;\n\t\telse if(current < 0) current = total - 1;\n\t\t\n\t\t//flip the thumb\n\t\t$tf_thumbs.flip({\n\t\t\tdirection\t: dir,\n\t\t\tspeed\t\t: 400,\n\t\t\tonBefore\t: function(){\n\t\t\t\t//the new thumb is set here\n\t\t\t\tvar content\t= '';\n\t\t\t\tif (show_tf_zoom) content = '<span id=\"tf_zoom\" class=\"tf_zoom\"></span>';\n\t\t\t\tcontent\t\t+='<img src=\"' + $tf_bg_images.eq(current).attr('longdesc') + '\" alt=\"Thumb' + (current+1) + '\"/>';\n\t\t\t\t$tf_thumbs.html(content);\n\t\t}\n\t\t});\n\n\t\t//we get the next image\n\t\tvar $tf_bg_img_next\t= $tf_bg_images.eq(current),\n\t\t\t//its dimentions\n\t\t\tdim\t\t\t\t= getImageDim($tf_bg_img_next),\n\t\t\t//the top should be one that makes the image out of the viewport\n\t\t\t//the image should be positioned up or down depending on the direction\n\t\t\t\ttop\t= (dir == 'tb')?$(window).height() + 'px':-parseFloat(dim.height,10) + 'px';\n\t\t\t\t\n\t\t//set the returned values and show the next image\t\n\t\t\t$tf_bg_img_next.css({\n\t\t\t\twidth\t: dim.width,\n\t\t\t\theight\t: dim.height,\n\t\t\t\tleft\t: dim.left,\n\t\t\t\ttop\t\t: top\n\t\t\t}).show();\n\t\t\t\n\t\t//now slide it to the viewport\n\t\t\t$tf_bg_img_next.stop().animate({\n\t\t\t\ttop \t: dim.top\n\t\t\t},1000);\n\t\t\t\n\t\t//we want the old image to slide in the same direction, out of the viewport\n\t\t\tvar slideTo\t= (dir == 'tb')?-$tf_bg_img.height() + 'px':$(window).height() + 'px';\n\t\t\t$tf_bg_img.stop().animate({\n\t\t\t\ttop \t: slideTo\n\t\t\t},1000,function(){\n\t\t\t//hide it\n\t\t\t\t$(this).hide();\n\t\t\t//the $tf_bg_img is now the shown image\n\t\t\t\t$tf_bg_img\t= $tf_bg_img_next;\n\t\t\t//show the description for the new image\n\t\t\t\n\t\t\tvar desc = $tf_content_wrapper.children().eq(current);\n\t\t\tjQuery(\"h2, p\",desc).css(\"opacity\", 0);\n\t\t\tvar speed = 1000, titlesFactor = 0, titlespeed = 1000, titleeasing = 'swing';\n\t\t\t\t\n\t\t\tdesc.show()\n\t\t\t\t\t .find('h2')\n\t\t\t\t\t .css('left', -50 + 'px' )\n\t\t\t\t\t .stop()\n\t\t\t\t\t .delay( speed * titlesFactor )\n\t\t\t\t\t .animate({ left : 0 + 'px', opacity : 1 }, titlespeed, titleeasing)\n\t\t\t\t\t .end()\n\t\t\t\t\t .find('p')\n\t\t\t\t\t .css( 'left', 50 + 'px' )\n\t\t\t\t\t .stop()\n\t\t\t\t\t .delay( speed * titlesFactor )\n\t\t\t\t\t .animate({ left : 0 + 'px', opacity : 1 }, titlespeed, titleeasing)\n\t\t\t\t\t .end();\n\t\t\t\t\t\t\t\t \n\t});\n\t\t//hide the current description\t\n\t\t\t$tf_content_wrapper.children(':visible')\n\t\t\t\t\t\t\t .hide()\n\t\n\t}",
"function updateScroll(event) {\n moveElements();\n}",
"function _snapToPage(size, scrollOffset) {\n\n\t // Check whether pagination is active\n\t if (!this.options.paginated ||\n\t this._scroll.scrollForceCount || //don't paginate while moving\n\t (this._scroll.springPosition !== undefined)) {\n\t return;\n\t }\n\n\t // Local data\n\t var pageOffset = scrollOffset;\n\t var pageLength;\n\t var hasNext;\n\n\t // Lookup page in previous direction\n\t var node = this._nodes.getStartEnumNode(false);\n\t while (node) {\n\t if (!node._invalidated) {\n\t break;\n\t }\n\t if (node.scrollLength !== 0) {\n\t if ((pageOffset <= 0) || (node.scrollLength === undefined)) {\n\t break;\n\t }\n\t hasNext = (pageLength !== undefined);\n\t pageLength = node.scrollLength;\n\t pageOffset -= node.scrollLength;\n\t }\n\t node = node._prev;\n\t }\n\n\t // Lookup page in next direction\n\t if (pageLength === undefined) {\n\t node = this._nodes.getStartEnumNode(true);\n\t while (node) {\n\t if (!node._invalidated) {\n\t break;\n\t }\n\t if (node.scrollLength !== 0) {\n\t if (node.scrollLength === undefined) {\n\t break;\n\t }\n\t hasNext = (pageLength !== undefined);\n\t if (hasNext) {\n\t if ((pageOffset + pageLength) > 0) {\n\t break;\n\t }\n\t pageOffset += pageLength;\n\t }\n\t pageLength = node.scrollLength;\n\t }\n\t node = node._next;\n\t }\n\t }\n\t if (!pageLength) {\n\t return;\n\t }\n\n\t // When velocity exceeds thresshold, treat as flip to\n\t // a certain direction and select that page.\n\t var flipToPrev;\n\t var flipToNext;\n\t if (this.options.paginationEnergyThresshold && (Math.abs(this._scroll.particle.getEnergy()) >= this.options.paginationEnergyThresshold)) {\n\t var velocity = this._scroll.particle.getVelocity1D();\n\t flipToPrev = velocity > 0;\n\t flipToNext = velocity < 0;\n\t }\n\n\t // Determine snap spring-position (not quite working properly yet for alignment = 1...)\n\t var boundOffset = pageOffset;\n\t var snapSpringPosition;\n\t if (!hasNext || flipToPrev || (!flipToNext && ((Math.abs(boundOffset) < Math.abs(boundOffset + pageLength))))) {\n\t snapSpringPosition = (scrollOffset - pageOffset) - (this.options.alignment ? pageLength : 0);\n\t if (snapSpringPosition !== this._scroll.springPosition) {\n\t //_log.call(this, 'setting snap-spring to #1: ', snapSpringPosition, ', previous: ', this._scroll.springPosition);\n\t this._scroll.springPosition = snapSpringPosition;\n\t this._scroll.springSource = SpringSource.SNAPPREV;\n\t }\n\t }\n\t else {\n\t snapSpringPosition = (scrollOffset - (pageOffset + pageLength));\n\t if (snapSpringPosition !== this._scroll.springPosition) {\n\t //_log.call(this, 'setting snap-spring to #2: ', snapSpringPosition, ', previous: ', this._scroll.springPosition);\n\t this._scroll.springPosition = snapSpringPosition;\n\t this._scroll.springSource = SpringSource.SNAPNEXT;\n\t }\n\t }\n\t }",
"function scrollImageList() {\n var imageLink = $('#annotate_image_link_' + gImageId);\n var list = $('#image_list');\n\n var offset = list.offset().top;\n var linkTop = imageLink.offset().top;\n\n // link should be (roughly) in the middle of the element\n offset += parseInt(list.height() / 2);\n\n list.scrollTop(list.scrollTop() + linkTop - offset);\n }",
"function scroll($container, $el, dir, callback) {\n var container = $container[0],\n maxScroll = container.scrollHeight - container.clientHeight;\n if (maxScroll && dir && !interval) {\n // Scroll view if the mouse is over the first or last pixels of the container\n interval = window.setInterval(function () {\n var scrollTop = $container.scrollTop();\n if ((dir === -1 && scrollTop <= 0) || (dir === 1 && scrollTop >= maxScroll)) {\n endScroll($el);\n } else {\n $container.scrollTop(scrollTop + 7 * dir);\n callback($el);\n }\n }, 50);\n }\n }",
"bindMouseEvent () {\n document.addEventListener(\"mousewheel\", (event) => {\n this.direction = event.wheelDelta < 0\n this.changeSlide()\n })\n document.addEventListener(\"DOMMouseScroll\", (event) => {\n this.direction = event.detail == 3 \n this.changeSlide()\n })\n }",
"scrollPageDown() {\n this.$moveByPage(1);\n }",
"scrollSearchToThumbnail()\n {\n if(this.isAnimating || !this.parent.active || this.dragger.position < 1)\n return;\n\n ppixiv.app.scrollSearchToMediaId(this.parent.dataSource, this.parent._wantedMediaId);\n }",
"function moveSlide(direction){\n var activeSection = $(SECTION_ACTIVE_SEL);\n var slides = activeSection.find(SLIDES_WRAPPER_SEL);\n var numSlides = slides.find(SLIDE_SEL).length;\n\n // more than one slide needed and nothing should be sliding\n if (!slides.length || slideMoving || numSlides < 2) {\n return;\n }\n\n var currentSlide = slides.find(SLIDE_ACTIVE_SEL);\n var destiny = null;\n\n if(direction === 'prev'){\n destiny = currentSlide.prev(SLIDE_SEL);\n }else{\n destiny = currentSlide.next(SLIDE_SEL);\n }\n\n //isn't there a next slide in the secuence?\n if(!destiny.length){\n //respect loopHorizontal settin\n if (!options.loopHorizontal) return;\n\n if(direction === 'prev'){\n destiny = currentSlide.siblings(':last');\n }else{\n destiny = currentSlide.siblings(':first');\n }\n }\n\n slideMoving = true;\n\n landscapeScroll(slides, destiny);\n }"
] |
[
"0.70670897",
"0.675597",
"0.67098963",
"0.6574764",
"0.6327665",
"0.61983526",
"0.6159656",
"0.61009616",
"0.60126805",
"0.5959501",
"0.59357655",
"0.592107",
"0.5913941",
"0.58752733",
"0.5864747",
"0.58629566",
"0.5848337",
"0.5841379",
"0.5838567",
"0.58115864",
"0.57982445",
"0.57882947",
"0.57611233",
"0.5761054",
"0.5746845",
"0.5739977",
"0.5739232",
"0.5739195",
"0.5722003",
"0.5719188"
] |
0.6808054
|
1
|
Fill board with moderator
|
fillModerator(grid) {
for (var x = 0; x < this.nCols; x++) {
for (var y = 0; y < this.nRows; y++) {
grid[x][y] = new Moderator(x, y, this);
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function applyBoard(){\n g_wall = new Wall(g_newBoard,0,0);\n reset();\n}",
"function setNewGame() {\n const fieldsArr = board.fields;\n\n for (let i = 0; i <= 64; i++) {\n let startPostion = fieldsArr[i];\n let piece = false;\n\n if (i >= 8 && i <= 15) {\n piece = new Pawn('pawn', 'black', i);\n }\n\n else if (i >= 48 && i <= 55) {\n piece = new Pawn('pawn', 'white', i);\n } \n \n else {\n continue;\n }\n\n if (piece) {\n startPostion.pawn = piece;\n startPostion.td.appendChild(piece.element); \n }\n }\n }",
"fillInBoard(pieces) {\r\n for (let piece of pieces) {\r\n this.fillAt(piece.row, piece.col, piece);\r\n }\r\n }",
"populateBoard() {\n for (let col = 0; col < this.board.getSize(); col++) {\n for (let row = 0; row < this.board.getSize(); row++) {\n // Check the empty candy position (hole), fill with new candy\n if (this.board.getCandyAt(row, col) == null) {\n this.board.addRandomCandy(row, col);\n }\n }\n }\n }",
"function makeBoard() {\n //Make an empty array for board propert cells\n board.cells = [];\n for (let rowNum = 0; rowNum < gridSize; rowNum++) {\n for (let colNum = 0; colNum < gridSize; colNum++) {\n board.cells.push({\n row: rowNum,\n col: colNum,\n isMine: Math.round(Math.random() >= 0.7),\n isMarked: false,\n hidden: true,\n });\n }\n }\n}",
"fillAt(row, col, piece) {\r\n this.board[row][col] = piece;\r\n }",
"function boardGenerator() {\n for (var i = 0; i < boardSize; i++) {\n for (var j = 0; j < boardSize; j++) {\n board.cells.push({\n row: i,\n col: j,\n isMine: randomMines(),\n hidden: true,\n });\n }\n }\n}",
"function setPiece() {\n clearCompleteRows();\n\n // To prevent dis-orientation, keep\n // the column where the user left it,\n // otherwise, put the new piece near\n // the top of the playfield.\n GameData.row = 3;\n GameData.activePiece = generatePiece();\n GameData.activePiece.reset();\n var grid = null;\n for(grid of GameData.activePiece.getOrientation()) {\n GameData.mainPlayField.setBlock(\n GameData.row + grid.getRow(),\n correctColumn(GameData.column + grid.getColumn()),\n GameData.activePiece.getType()\n );\n }\n}",
"setBoardPosition() {\n\n this.forEach((arr, rowIndex) => {\n arr.forEach((block, colIndex) => {\n\n if (block === 0) return;\n\n let absPos = this._getAbsolutePosition(rowIndex, colIndex);\n\n this.board[absPos.row][absPos.col] = this.pieceType;\n });\n });\n }",
"function lockPiece() {\n\tpiece.matrix.forEach(function (value, index, matrix) {\n\t\t// console.log('value:', value, 'index:', index);\n\t\tif (value == piece.id)\n\t\t\tboard = board.subset(\n\t\t\t\tmath.index(index[0] + piece.top, index[1] + piece.left),\n\t\t\t\tpiece.id\n\t\t\t);\n\t});\n}",
"initBoard () {\n\t\tthis.clearBoard();\n\t\t/* Init piece-list */\n\t\t/* White */\n\t\tthis.pieces = [\n\t\t\tnew Lance(COLOR.WHITE, position.toIdx(1, 'a')),\n\t\t\tnew Knight(COLOR.WHITE, position.toIdx(2, 'a')),\n\t\t\tnew Silver(COLOR.WHITE, position.toIdx(3, 'a')),\n\t\t\tnew Gold(COLOR.WHITE, position.toIdx(4, 'a')),\n\t\t\tnew King(COLOR.WHITE, position.toIdx(5, 'a')),\n\t\t\tnew Gold(COLOR.WHITE, position.toIdx(6, 'a')),\n\t\t\tnew Silver(COLOR.WHITE, position.toIdx(7, 'a')),\n\t\t\tnew Knight(COLOR.WHITE, position.toIdx(8, 'a')),\n\t\t\tnew Lance(COLOR.WHITE, position.toIdx(9, 'a')),\n\t\t\tnew Rook(COLOR.WHITE, position.toIdx(2, 'b')),\n\t\t\tnew Bishop(COLOR.WHITE, position.toIdx(8, 'b')),\n\t\t];\n\t\tfor (let i = 1; i <= NUM_COLS; i++) {\n\t\t\tthis.pieces.push(new Pawn(COLOR.WHITE, position.toIdx(i, 'c')));\n\t\t}\n\t\t/* Black */\n\t\tthis.pieces = this.pieces.concat([\n\t\t\tnew Lance(COLOR.BLACK, position.toIdx(1, 'i')),\n\t\t\tnew Knight(COLOR.BLACK, position.toIdx(2, 'i')),\n\t\t\tnew Silver(COLOR.BLACK, position.toIdx(3, 'i')),\n\t\t\tnew Gold(COLOR.BLACK, position.toIdx(4, 'i')),\n\t\t\tnew King(COLOR.BLACK, position.toIdx(5, 'i')),\n\t\t\tnew Gold(COLOR.BLACK, position.toIdx(6, 'i')),\n\t\t\tnew Silver(COLOR.BLACK, position.toIdx(7, 'i')),\n\t\t\tnew Knight(COLOR.BLACK, position.toIdx(8, 'i')),\n\t\t\tnew Lance(COLOR.BLACK, position.toIdx(9, 'i')),\n\t\t\tnew Rook(COLOR.BLACK, position.toIdx(2, 'h')),\n\t\t\tnew Bishop(COLOR.BLACK, position.toIdx(8, 'h')),\n\t\t]);\n\t\tfor (let i = 1; i <= NUM_COLS; i++) {\n\t\t\tthis.pieces.push(new Pawn(COLOR.BLACK, position.toIdx(i, 'g')));\n\t\t}\n\n\t\t/* Put pieces on board */\n\t\tthis.pieces.forEach((piece) => {\n\t\t\tthis.putPiece(piece, piece.pos);\n\t\t});\n\t}",
"function llenarTablero() {\n\tfillBoard();\n}",
"function populateBoard() {\n let newArr = Array(64).fill(null);\n let len = 64;\n let i = 0;\n for (i = 0; i < len; ++i){\n // White\n if(i == 0 || i == 7){\n newArr[i] = 'white/rook' // Position Rook\n }\n if(i == 1 || i == 6){\n newArr[i] = 'white/knight' // Position Knight(Horse; to avoid confusion)\n }\n if(i == 2 || i == 5){\n newArr[i] = 'white/bishop' // Position Bishop\n }\n if(8 <= i && i <= 15){\n newArr[i] = 'white/pawn' // Position Pawn\n }\n if(i == 4){\n newArr[i] = 'white/queen' // Position Queen\n }\n if(i == 3){\n newArr[i] = 'white/king' // Position King\n }\n\n // Black\n if(i == 56 || i == 63){\n newArr[i] = 'black/rook' // Position Rook\n }\n if(i == 57 || i == 62){\n newArr[i] = 'black/knight' // Position Knight(Horse; to avoid confusion)\n }\n if(i == 58 || i == 61){\n newArr[i] = 'black/bishop' // Position Bishop\n }\n if(48 <= i && i <= 55){\n newArr[i] = 'black/pawn' // Position Pawn\n }\n if(i == 59){\n newArr[i] = 'black/queen' // Position Queen\n }\n if(i == 60){\n newArr[i] = 'black/king' // Position King\n }\n }\n return newArr;\n}",
"function initMinesweeperBot(){\n bot = new Bot(ms_row_size, ms_col_size, ms_grid_revealed, ms_mine_num);\n}",
"populateBoard() {\n // add a bubble at every row, col\n for (let row = 0; row < this.rows; row++) {\n for (let col = 0; col < this.cols; col++) {\n let pos = this.getBubbleLocAt(row, col);\n this.pieces[row][col] = this.drawBubbleAt(pos.x, pos.y, row, col);\n }\n }\n this.pieces.forEach(row => {\n row.forEach(bubble => {\n bubble.getNeighbors();\n });\n });\n }",
"function fillBoard() {\n var x, y, type;\n jewels = [];\n\n for (x = 0; x < cols; x++) {\n jewels[x] = [];\n for (y = 0; y < rows; ++y) {\n type = randomJewel();\n\n // Ensure that no chains are created on the initial board fill\n while ((type === getJewel(x - 1, y) && type === getJewel(x - 2, y)) ||\n (type === getJewel(x, y - 1) && type === getJewel(x, y - 2))) {\n type = randomJewel();\n }\n\n jewels[x][y] = type;\n }\n }\n\n // Recursively fill if the generated board has no moves\n if (!hasMoves()) {\n fillBoard();\n }\n }",
"function UpdateBoard(){\n for(var i = 0; i < activeBlock.shapeMatrix[0].length; ++i){\n for(var j = 0; j < activeBlock.shapeMatrix[0].length; ++j){\n if(activeBlock.shapeMatrix[i][j] != 0){\n board[activeBlock.position.y + i][activeBlock.position.x + j] = activeBlock.shapeMatrix[i][j];\n\n }\n }\n }\n updateGrid();\n}",
"function resetBoard() {\n board = [];\n $(__BOARD__).children().remove();\n let nbTilesBuilt = 0;\n let arrayTmp = [];\n board.push(arrayTmp);\n let index1D = 0;\n let index2D = -1;\n while(nbTilesBuilt < nbTiles) {\n if(index2D !== 0 && index2D % (nbColumns - 1) === 0) {\n arrayTmp = [];\n board.push(arrayTmp);\n index1D++;\n index2D = 0;\n } else {\n index2D++;\n }\n arrayTmp.push(__BLACK_TILE_CLASS__);\n $(__BOARD__).append(\"<div data-index-1d='\" + index1D + \"' data-index-2d='\" + index2D + \"' class='\" + __BLACK_TILE_CLASS__ +\n \"' style='width:\"+ sizeTile +\"px; height:\"+ sizeTile +\"px;'></div>\");\n nbTilesBuilt++;\n }\n}",
"function setMines(board, row, col) {\r\n var shuffledCoords = getSuffledCoords(board);\r\n\r\n for (var idx = 0; idx < gLevel.MINES; idx++) {\r\n var { i, j } = shuffledCoords.pop();\r\n\r\n // This condition ensures that on our first click we do not get a mine\r\n if (i === row && j === col) {\r\n idx--;\r\n continue;\r\n }\r\n\r\n board[i][j].isMine = true;\r\n }\r\n}",
"function updateBoard(player, approvedMove){\n let activeCell;\n for(let i = 1; i <= 100; i++){\n activeCell = document.getElementById(i);\n if(approvedMove[i]){\n activeCell.classList.remove('permission');\n }\n if(i === player.colIdWarrior){\n if (activeCell.className === 'knife') {\n activeCell.classList.remove('knife');\n activeCell.classList.add(player.weapon);\n player.weapon = 'knife';\n } else if (activeCell.className === 'star') {\n activeCell.classList.remove('star');\n activeCell.classList.add(player.weapon);\n player.weapon = 'star';\n } else if (activeCell.className === 'star2') {\n activeCell.classList.remove('star2');\n activeCell.classList.add(player.weapon);\n player.weapon = 'star2';\n } else if (activeCell.className === 'tool') {\n activeCell.classList.remove('tool');\n activeCell.classList.add(player.weapon);\n player.weapon = 'tool';\n } else if (activeCell.className === 'sword') {\n activeCell.classList.remove('sword');\n activeCell.classList.add(player.weapon);\n player.weapon = 'sword';\n } else {\n }\n\n activeCell.style.backgroundImage = `url('img/${player.img}.png'), url('img/${player.weapon}.png')`;\n }\n }\n }",
"function setUpBoard () {\n makeCrystalScores();\n makeCrystalButtons();\n }",
"function updateBoard() {\n // Clear the canvas\n board.clear();\n\n // Draw older gen ghosts\n var colors = [\"#777777\", \"#999999\", \"#BBBBBB\", \"#DDDDDD\", \"#EEEEEE\"];\n for (var gen = 0; gen < genGhosts.length; gen++) {\n drawGen(genGhosts[gen], colors[gen]);\n }\n\n // Draw current gen\n drawGen(currentGen, \"#555555\");\n }",
"function resetBoard() {\n\tgame.score = 0;\n\tgame.dot.exists = false;\n\tworms = new Array();\n\n\tfor (var i = 0; i < game.players; i++) {\n\t\tworms.push(new Object());\n\t\tworms[i].direction = \"none\";\n\t\tworms[i].previousCells = new Array();\n\t\tworms[i].length = 1;\n\t\tworms[i].movedThisTurn = false; \n\t\tworms[i].cachedMove = 'none';\n\t\tworms[i].maxSize = 100;\n\n\t\tgame.dots = new Array();\n\t\tgame.foodOut = false;\n\t\t\n\t\tworms[i].position = new Object();\n\t\tworms[i].position.x = 1 + Math.floor(Math.random()*(game.grid.width/game.grid.size - 2));\n\t\tworms[i].position.y = 1 + Math.floor(Math.random()*(game.grid.height/game.grid.size - 2));\n\t}\t\n}",
"function resetBoard() {\n isOneTileFlipped = false;\n lockBoard = false;\n firstTile = null;\n secondTile = null;\n}",
"tick() {\n let newBoard = this.makeBoard();\n let oldBoard = this.board;\n for(let z = 0; z<oldBoard.length; z++){\n let minArr = oldBoard[z];\n for(let x = 0; x<minArr.length; x++){\n if(this.livingNeighbors(z,x) < 2){\n newBoard[z][x] = 0;\n }\n else if(this.livingNeighbors(z,x) > 3){\n newBoard[z][x] = 0;\n }\n else if(oldBoard[z][x] === 0 && this.livingNeighbors(z,x) === 3){\n newBoard[z][x] = 1;\n } else {\n newBoard[z][x] = oldBoard[z][x]\n }\n }\n }\n this.board = newBoard;\n }",
"function expandRoom(rm){\n\t\tlet xMin = randInt(-1,0);\n\t\tlet xMax = randInt(1,2);\n\t\tlet yMin = randInt(-1,0);\n\t\tlet yMax = randInt(1,2);\n\t\tfor (let n = xMin; n < xMax; n++){\n\t\t\tfor (let p = yMin; p<yMax;p++){\n\t\t\t\tdungeon[rm.x+n][rm.y+p] = roomNum;\n\t\t\t}\n\t\t}\n\t\troomNum++;\n\t}",
"function resetBoard()\n{\n\tfor(let i = 0; i < allChips.length; i++)\n\t{\n\t\tfor(let j = 0; j < 6; j++)\n\t\t{\n\t\t\tallChips[i][j] = 0;\n\t\t}\n\t}\n}",
"function buildBoard(){\n\t \t\tvar mineCount = 0;\n\t \t\tfor (var i = 0; i < ROWS; i+=1) {\n\t\t\t\tfor (var j = 0; j < COLS; j+=1) {\n\t\t\t\t\tvar x_shift = Math.floor(0.5*start) + i*stepW;\n\t\t\t\t\tvar y_shift = Math.floor(0.5*start) + j*stepH;\n\t\t\t\t\tvar circleCol = randomColorGenerator(x_shift,y_shift);\n\t\t\t\t\tvar invertedCol = getInvertedColors(circleCol);\n\t\t\t\t\tvar myCircle = new Path.Circle(new Point(x_shift+circleSize,y_shift+circleSize),circleSize).fillColor = circleCol;\n\t\t\t\t\t//initialise space object\n\n\n\t\t\t\t\tvar spaceObj = {\n\t\t\t\t\t\t\t\t\tindex: n, \n\t\t\t\t\t\t\t\t\tcolor: circleCol,\n\t\t\t\t\t\t\t\t\toutline: invertedCol,\n\t\t\t\t\t\t\t\t\tcircleRef: myCircle,\n\t\t\t\t\t\t\t\t\tpos_x: 0, pos_y: 0, \n\t\t\t\t\t\t\t\t\tholdsMine: 0, \n\t\t\t\t\t\t\t\t\tadjacentNeighbours: 0, \n\t\t\t\t\t\t\t\t\tclicked: false,\n\t\t\t\t\t\t\t\t\tflagged: false,\n\t\t\t\t\t\t\t\t\tneighbourIndexList: []\n\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\tspaceObj.pos_x = x_shift+circleSize;\n\t\t\t\t\tspaceObj.pos_y = y_shift+circleSize;\n\t\t\t\t\tspaceObj.holdsMine = assignMine();\n\n\t\t\t\t\tif(spaceObj.holdsMine){\n\t\t\t\t\t\tmineCount++;\n\t\t\t\t\t}\n\n\t\t\t\t\tspaces.push(spaceObj);\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tplayerStats.totalMines = mineCount;\n\t\t\tplayerStats.flags = mineCount;\n\t \t}",
"function initBoards() {\n let boardIds = [\"playerboard\", \"enemyboard\"]\n let rows = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'];\n // init grey spaces\n for (let boardId of boardIds) {\n let board = document.getElementById(boardId);\n let id = boardId[0];\n for (let row of rows) {\n for (let col = 0; col < 10; col++) {\n let div = document.createElement(\"div\");\n div.id = `${id}${row}${col}`;\n div.className = \"opaque\";\n if (boardId === \"enemyboard\") {\n div.onclick = () => handleBoardClick(div.id);\n }\n board.appendChild(div);\n }\n }\n }\n}",
"function resetBoard() {\n\t\tboard = new Array(9);\n\t}"
] |
[
"0.6520373",
"0.6321369",
"0.6300839",
"0.6237424",
"0.61506736",
"0.6076635",
"0.60347265",
"0.600643",
"0.59284896",
"0.5926426",
"0.59053224",
"0.59016913",
"0.58932483",
"0.5882883",
"0.5870567",
"0.58621615",
"0.5853807",
"0.5834048",
"0.58315206",
"0.5778541",
"0.57640344",
"0.5759578",
"0.5745149",
"0.5740691",
"0.5712641",
"0.57104445",
"0.57019895",
"0.5682444",
"0.56729436",
"0.56722265"
] |
0.72101647
|
0
|
Fill edges with walls
|
fillEdges(grid) {
for (var x = 0; x < this.nCols; x++) {
grid[x][0] = new Wall(x, 0, this);
grid[x][this.nRows-1] = new Wall(x, this.nRows-1, this);
}
for (var y = 1; y < this.nRows-1; y++) {
grid[0][y] = new Wall(0, y, this);
grid[this.nCols-1][y] = new Wall(this.nCols-1, y, this);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function fill(edges,inner)\n{\n var r;\n var l;\n var d;\n var u;\n\n var count=0;\n var visited = new Set();\n var visit_later=new Set([intify(inner)]);\n while(visit_later.length != 0)\n {\n v = pointify(Array.from(visit_later)[0]);\n r = intify([v[0]+1,v[1]])\n l = intify([v[0]-1,v[1]])\n d = intify([v[0],v[1]+1])\n u = intify([v[0],v[1]-1])\n\n if(!visited.has(r) && !edges.has(r))\n visit_later.add(r)\n if(!visited.has(l) && !edges.has(l))\n visit_later.add(l)\n if(!visited.has(d) && !edges.has(d))\n visit_later.add(d)\n if(!visited.has(u) && !edges.has(u))\n visit_later.add(u)\n \n visited.add(intify(v));\n visit_later.delete(intify(v));\n\n count++;\n if(count > image.width * image.height * .5){console.log('Diverge');return visited;}\n \n }\n return visited;\n}",
"function putWalls() {\n console.log(\"Walls\");\n for (let i = 0; i < n; i++) {\n for (let j = 0; j < m; j++) {\n if (grid[i][j] != source && grid[i][j] != end) {\n if (random(1) < 0.1) {\n grid[i][j].wall = true;\n }\n }\n }\n }\n\n source.wall = false;\n end.wall = false;\n\n background(\"#FFFFFF\");\n for (let i = 0; i < n; i++) {\n for (let j = 0; j < m; j++) {\n grid[i][j].showCell(color(\"#FFFFFF\"));\n }\n }\n\n source.showCell(color(\"#1a3da6\"));\n end.showCell(color(\"#fd1036\"));\n}",
"function add_boundaries(clean_board) {\n\t// Top wall\n\tfor (var i = 3; i < clean_board[0].length; i += 2) {\n\t\tclean_board[0][i] = EDGE_CLOSED;\n\t}\n\t// Bottom wall\n\tfor (var i = 1; i < clean_board[0].length - 2; i += 2) {\n\t\tclean_board[clean_board.length - 1][i] = EDGE_CLOSED;\n\t}\n\t// Left and right walls\n\tfor (var i = 1; i < clean_board.length; i += 2) {\n\t\tclean_board[i][0] = EDGE_CLOSED;\n\t\tclean_board[i][clean_board[0].length - 1] = EDGE_CLOSED;\n\t}\n\treturn clean_board;\n}",
"function addEdgeWalls(myWalls)\n{\n\tvar newWalls = myWalls;\n\n\tfor (var i = 0; i < dimX; i++)\n\t{\n\t\tnewWalls[i][0] = true;\n\t}\n\n\treturn newWalls;\n}",
"function generate(width, height) {\n\t\n\t// initialize walls\n\tvar map = [];\n\tfor(var x=0;x<width;x++) {\n\t\tmap[x] = [];\n\t\tfor(var y=0;y<height;y++) {\n\t\t\tmap[x][y] = {visited:false, walls: {left:true,right:true,bottom:true,top:true}};\n\t\t}\n\t}\n\n\t// generate walls\n\tvar x = r.nextRange(0, width), y = r.nextRange(0, height);\n\tvar stack = [];\n\twhile(true) {\n\t\tmap[x][y].visited = true;\n\t\t// select the next room to visit\n\t\tvar nextRoomOptions = [];\n\t\tif(x>0 && map[x-1][y].visited == false)\n\t\t\tnextRoomOptions.push({x:x-1,y:y});\n\t\tif(x<width-1 && map[x+1][y].visited == false)\n\t\t\tnextRoomOptions.push({x:x+1,y:y});\n\t\tif(y>0 && map[x][y-1].visited == false)\n\t\t\tnextRoomOptions.push({x:x,y:y-1});\n\t\tif(y<width-1 && map[x][y+1].visited == false)\n\t\t\tnextRoomOptions.push({x:x,y:y+1});\n\t\tif(nextRoomOptions.length == 0) {\n\t\t\tif(stack.length == 0)\n\t\t\t\tbreak;\n\t\t\tvar spos = stack.pop();\n\t\t\tx = spos.x;\n\t\t\ty = spos.y;\n\t\t\tcontinue;\n\t\t}\n\t\tstack.push({x:x,y:y});\n\t\tvar nextPosition = r.choice(nextRoomOptions);\n\t\t// open up the wall between this and the next room\n\t\tif(nextPosition.x < x && y == nextPosition.y) {\n\t\t\tmap[x][y].walls.left = false;\n\t\t\tmap[nextPosition.x][nextPosition.y].walls.right = false;\n\t\t} else if(nextPosition.x > x && y == nextPosition.y) {\n\t\t\tmap[x][y].walls.right = false;\n\t\t\tmap[nextPosition.x][nextPosition.y].walls.left = false;\n\t\t} else if(nextPosition.x == x && nextPosition.y < y) {\n\t\t\tmap[x][y].walls.top = false;\n\t\t\tmap[nextPosition.x][nextPosition.y].walls.bottom = false;\n\t\t} else if(nextPosition.x == x && nextPosition.y > y) {\n\t\t\tmap[x][y].walls.bottom = false;\n\t\t\tmap[nextPosition.x][nextPosition.y].walls.top = false;\n\t\t}\n\n\t\tx = nextPosition.x;\n\t\ty = nextPosition.y;\n\t}\n\t// initialize blocks\n\tvar blocks = [];\n\tfor(var x=0;x<width*2+1;x++) {\n\t\tblocks[x] = [];\n\t\tfor(var y=0;y<height*2+1;y++) {\n\t\t\tblocks[x][y] = true;\n\t\t}\n\t}\n\t// populate blocks\n\tfor(var x=0;x<width;x++) {\n\t\tfor(var y=0;y<height;y++) {\n\t\t\tvar m = map[x][y];\n\t\t\tif(m.visited === false)\n\t\t\t\tcontinue;\n\t\t\tblocks[x*2+1][y*2+1] = false;\n\t\t\tif(x>0 && m.walls.left == false)\n\t\t\t\tblocks[(x*2)-1+1][y*2+1] = false;\n\t\t\tif(x<width-1 && m.walls.right == false)\n\t\t\t\tblocks[(x*2)+1+1][y*2+1] = false;\n\t\t\tif(y>0 && m.walls.top == false)\n\t\t\t\tblocks[x*2+1][(y*2)-1+1] = false;\n\t\t\tif(y<height-1 && m.walls.bottom == false)\n\t\t\t\tblocks[x*2+1][(y*2)+1+1] = false;\n\t\t}\n\t}\n\t// reduce blocks\n\t// creates more open areas instead of narrow corridors\n\t// removes blocks that has 3 free sides\n\tfor(var i=0;i<10;i++) {\n\t\tfor(var x=0;x<blocks.length;x++) {\n\t\t\tfor(var y=0;y<blocks[x].length;y++) {\n\n\t\t\t\tvar sides = 0;\n\n\t\t\t\tif(x>0 && blocks[x-1][y] == false)\n\t\t\t\t\tsides++;\n\n\t\t\t\tif(y>0 && blocks[x][y-1] == false)\n\t\t\t\t\tsides++;\n\n\t\t\t\tif(x<blocks.length-1 && blocks[x+1][y] == false)\n\t\t\t\t\tsides++;\n\n\t\t\t\tif(y<blocks.length-1 && blocks[x][y+1] == false)\n\t\t\t\t\tsides++;\n\n\t\t\t\tif(sides>=3)\n\t\t\t\t\tblocks[x][y] = false;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn blocks;\n}",
"fillMap() {\n const layout = this.config.layout || [[]];\n\n // First pass to assign basic walls\n layout.forEach((row, y) => {\n row.forEach((col, x) => {\n if (col === 1) {\n this.groundLayer.putTileAt(TILES.FLOOR.BASIC, x, y);\n return;\n }\n\n const isWall = Object.values(getNeighbors(x, y))\n .reduce((a, pos) => isFloorTile(layout, pos) || a, false);\n\n if (isWall) {\n layout[y][x] = 2;\n }\n });\n });\n\n // Second pass to determine wall orientation\n layout.forEach((row, y) => {\n row.forEach((col, x) => {\n if (col < 2) {\n return;\n }\n\n const neighbors = getNeighbors(x, y);\n\n let wallHash = 0;\n if (isWallTile(layout, neighbors.t)) {\n wallHash |= WALL_FLAGS.TOP;\n }\n if (isWallTile(layout, neighbors.r)) {\n wallHash |= WALL_FLAGS.RIGHT;\n }\n if (isWallTile(layout, neighbors.b)) {\n wallHash |= WALL_FLAGS.BOTTOM;\n }\n if (isWallTile(layout, neighbors.l)) {\n wallHash |= WALL_FLAGS.LEFT;\n }\n\n switch (wallHash) {\n case 1:\n this.groundLayer.putTileAt(TILES.WALL.VERTICAL.CAP_BOTTOM, x, y);\n break;\n case 2:\n this.groundLayer.putTileAt(TILES.WALL.HORIZONTAL.CAP_LEFT, x, y);\n break;\n case 3:\n this.groundLayer.putTileAt(TILES.CORNER.BOTTOM_LEFT, x, y);\n break;\n case 4:\n this.groundLayer.putTileAt(TILES.WALL.VERTICAL.CAP_TOP, x, y);\n break;\n case 5:\n this.groundLayer.putTileAt(TILES.WALL.VERTICAL.OPEN, x, y);\n break;\n case 6:\n this.groundLayer.putTileAt(TILES.CORNER.TOP_LEFT, x, y);\n break;\n case 7:\n this.groundLayer.putTileAt(TILES.T_CORNER.RIGHT, x, y);\n break;\n case 8:\n this.groundLayer.putTileAt(TILES.WALL.HORIZONTAL.CAP_RIGHT, x, y);\n break;\n case 9:\n this.groundLayer.putTileAt(TILES.CORNER.BOTTOM_RIGHT, x, y);\n break;\n case 10:\n this.groundLayer.putTileAt(TILES.WALL.HORIZONTAL.OPEN, x, y);\n break;\n case 11:\n this.groundLayer.putTileAt(TILES.T_CORNER.TOP, x, y);\n break;\n case 12:\n this.groundLayer.putTileAt(TILES.CORNER.TOP_RIGHT, x, y);\n break;\n case 13:\n this.groundLayer.putTileAt(TILES.T_CORNER.LEFT, x, y);\n break;\n case 14:\n this.groundLayer.putTileAt(TILES.T_CORNER.BOTTOM, x, y);\n break;\n case 15:\n this.groundLayer.putTileAt(TILES.T_CORNER.ALL, x, y);\n break;\n default:\n this.groundLayer.putTileAt(TILES.WALL.HORIZONTAL.CAP_BOTH, x, y);\n }\n });\n });\n }",
"triangleFanFill(seedEdge) {\n var currentEdge = seedEdge;\n do {\n var isTriangle = currentEdge.next.next == currentEdge.prev;\n if (isTriangle) break;\n\n currentEdge = this.insertBoundaryTriangle(currentEdge);\n } while (!isTriangle);\n this.closeTriangleBound(currentEdge);\n }",
"function createWalls(map)\n{\n //var n = [];\n for (var y = 0; y < map.length; y++)\n {\n for (var x = 0; x < map[0].length; x++)\n {\n if (map[y][x] === 1 && map[y][x] !== 2)\n {\n if (y > 0 && y < map.length - 1 && x > 0 && x < map[0].length - 1)\n {\n if (map[y][x + 1] === 0 || map[y + 1][x] === 0)\n map[y][x] = 2;\n if (map[y][x - 1] === 0 || map[y - 1][x] === 0)\n map[y][x] = 2;\n }\n if (y === 0) {\n if (map[y + 1][x] === 0)\n map[y][x] = 2;\n }\n if (y === map.length - 1) {\n if (map[y - 1][x] === 0)\n map[y][x] = 2;\n }\n if (x === 0) {\n if (map[y][x + 1] === 0)\n map[y][x] = 2;\n }\n if (x === map[0].length - 1) {\n if (map[y][x - 1] === 0)\n map[y][x] = 2;\n }\n }\n }\n }\n}",
"function create_wall() {\r\n\t\t/*wall = {\r\n\t\tx: Math.round(Math.random()*(w-cw)/cw),\r\n\t\ty: Math.round(Math.random()*(h-cw)/cw),\r\n\t\t};*/\r\n\t\tvar p,\r\n\t\tq,\r\n\t\tr,\r\n\t\ts;\r\n\t\tvar interseca = false;\r\n\t\tvar length = 10; //\r\n\t\twall_array = []; //Empty array to start with\r\n\r\n\t\tvar walll = new Wall(0, 0, w, 0);\r\n\t\twall_array.push(walll);\r\n\t\twalll = new Wall(w, 0, w, h);\r\n\t\twall_array.push(walll);\r\n\t\twalll = new Wall(0, 0, 0, h);\r\n\t\twall_array.push(walll);\r\n\t\twalll = new Wall(0, h, w, h);\r\n\t\twall_array.push(walll);\r\n\t\tfor (var i = length - 1; i >= 0; i--) {\r\n\r\n\t\t\tdo { //finchè non esce un muro che non si interseca con gli altri\r\n\t\t\t\tinterseca = false;\r\n\t\t\t\tp = Math.round(Math.random() * (w - cw));\r\n\t\t\t\tq = Math.round(Math.random() * (h - cw));\r\n\t\t\t\tr = Math.round(Math.random() * (w - cw));\r\n\t\t\t\ts = Math.round(Math.random() * (h - cw));\r\n\r\n\t\t\t\tfor (var k = 0; k < wall_array.length && !interseca; k++) {\r\n\t\t\t\t\t//\tvar c = wall_array[k];\r\n\t\t\t\t\tinterseca = interseca || intersects(wall_array[k].x1, wall_array[k].y1, wall_array[k].x2, wall_array[k].y2, p, q, r, s);\r\n\t\t\t\t}\r\n\t\t\t} while (interseca);\r\n\r\n\t\t\t//wall_array.push({x: Math.round(Math.random()*(w-cw)/cw), y: Math.round(Math.random()*(h-cw)/cw)});\r\n\r\n\t\t\tvar walll = new Wall(p, q, r, s);\r\n\t\t\twall_array.push(walll);\r\n\t\t\t//wall_array.push({x: Math.round(Math.random()*(w-cw)), y: Math.round(Math.random()*(h-cw))});// FARE I MURI come matrice o disegnarli come righe memorizzandoli a coppie di punti\r\n\r\n\t\t}\r\n\r\n\t\t//This will create a cell with x/y between 0-44\r\n\t\t//Because there are 45(450/10) positions accross the rows and columns\r\n\t}",
"function\ninit_maze(w1, h1)\n{\n var i, j, vedges, hedges;\n var x, y, t, inc, xoff, yoff;\n\n vedges = (w1-1)*h1; /* number of vertical edges */\n hedges = (h1-1)*w1; /* number of horizontal edges */\n redges = edges = vedges + hedges; /* number of removable edges */\n perimeters = 2*w1 + 2*h1;\n vertices = (w1+1)*(h1+1);\n groups = w1*h1;\n\n /* allocate edge array */\n edge = []\n for(i = 0; i < edges; i++)\n edge.push(new Edge())\n\n /* fill in the vertical edges */\n for (i=0; i<vedges; i++) {\n x = Math.floor(i%(w1-1)); /* convert edge number to column */\n y = Math.floor(i/(w1-1)); /* and row */\n j = Math.floor(y*w1 + x); /* convert to cell number */\n edge[i].cell1 = j;\n edge[i].cell2 = j+1;\n edge[i].vertex1 = Math.floor(y*(w1+1) + x+1); /* convert to vertex number */\n edge[i].vertex2 = Math.floor((y+1)*(w1+1) + x+1);\n edge[i].valid = true;\n edge[i].draw = true;\n }\n for (i=vedges; i<edges; i++) {\n j = Math.floor(i - vedges); /* convert to cell number */\n x = Math.floor(j%w1); /* convert edge number to column */\n y = Math.floor(j/w1); /* and row*/\n edge[i].cell1 = j;\n edge[i].cell2 = j + w1;\n edge[i].vertex1 = Math.floor((y+1)*(w1+1) + x); /* convert to vertex number */\n edge[i].vertex2 = Math.floor((y+1)*(w1+1) + x+1);\n edge[i].valid = true;\n edge[i].draw = true;\n }\n\n /* allocate perimeter */\n perimeter = []\n for(var i = 0; i < perimeters; i++)\n perimeter.push(new Edge())\n\n /* fill in horizontal perimeter */\n for (i=0; i<w1; i++) {\n perimeter[2*i].cell1 = i;\n perimeter[2*i].cell2 = i;\n perimeter[2*i].vertex1 = i;\n perimeter[2*i].vertex2 = i + 1;\n perimeter[2*i].valid = true;\n perimeter[2*i].draw = true;\n perimeter[2*i+1].cell1 = Math.floor(i + h1*w1);\n perimeter[2*i+1].cell2 = Math.floor(i + h1*w1);\n perimeter[2*i+1].vertex1 = Math.floor(i + h1*(w1+1));\n perimeter[2*i+1].vertex2 = Math.floor(i + h1*(w1+1) + 1);\n perimeter[2*i+1].valid = true;\n perimeter[2*i+1].draw = true;\n }\n /* fill in vertical perimeter */\n for (i=w1; i<w1+h1; i++) {\n j = i-w1;\n perimeter[2*i].cell1 = Math.floor(j*w1);\n perimeter[2*i].cell2 = Math.floor(j*w1);\n perimeter[2*i].vertex1 = j*(w1+1);\n perimeter[2*i].vertex2 = (j+1)*(w1+1);\n perimeter[2*i].valid = true;\n perimeter[2*i].draw = true;\n perimeter[2*i+1].cell1 = Math.floor((j+1)*w1 - 1);\n perimeter[2*i+1].cell2 = Math.floor((j+1)*w1 - 1);\n perimeter[2*i+1].vertex1 = Math.floor((j+1)*(w1+1) - 1);\n perimeter[2*i+1].vertex2 = Math.floor((j+2)*(w1+1) - 1);\n perimeter[2*i+1].valid = true;\n perimeter[2*i+1].draw = true;\n }\n\n //Verticies handled on a per-object basis, no need to generate vertexes as the maze is built. Generated here for debug only.\n /* allocate vertex array */\n vertex = []\n for(var i = 0; i < vertices; i++)\n vertex.push(vec2())\n\n /* figure out the spacing between vertex coordinates. we want\n square cells so use the minimum spacing */\n inc = (3.6/w1)*10;\n t = (3.6/h1)*10;\n if (t < inc) {\n inc = t;\n }\n /* determine the required offsets to center the maze using the\n spacing calculated above */\n xoff = Math.floor((4.0-w1*inc)/2 - 2.0);\n yoff = Math.floor((4.0-h1*inc)/2 - 2.0);\n /* fill in the vertex array */\n for (i=0; i<vertices; i++) {\n x = Math.floor(i%(w1+1));\n y = Math.floor(i/(w1+1));\n vertex[i][0] = x*inc + xoff;\n vertex[i][1] = y*inc + yoff;\n }\n\n /* allocate the group table */\n group = []\n\n /* set the group table to the identity */\n for (i=0; i<groups; i++) {\n group[i] = i;\n }\n}",
"floodFill() {\n for(var i = 0; i < this.neighbourCells.length; i++){\n var neighbor = this.neighbourCells[i];\n if(neighbor != undefined){\n if (!neighbor.revealed && !neighbor.isFlag) {\n neighbor.reveal();\n }\n }\n } \n }",
"function resetWalls() {\n\n wallSet.clear();\n reset();\n}",
"function generateAdjacentWalls(i) {\n var adjacent = [];\n var emptyAdjacent = [];\n if (isAdjacent(i, upFrom(i))) {\n adjacent.push(upFrom(i));\n }\n if (isAdjacent(i, downFrom(i))) {\n adjacent.push(downFrom(i));\n }\n if (isAdjacent(i, leftFrom(i))) {\n adjacent.push(leftFrom(i));\n }\n if (isAdjacent(i, rightFrom(i))) {\n adjacent.push(rightFrom(i));\n }\n for (var i = 0; i < adjacent.length; i++) {\n if (board[adjacent[i]].length === 0) {\n emptyAdjacent.push(adjacent[i]);\n }\n }\n for (var i = 0; i < emptyAdjacent.length; i++) {\n maybePutWallInTile(emptyAdjacent[i], 40);\n }\n }",
"function\nstep_maze()\n{\n var i, j, k, o, n;\n\n /* randomly select one of the the remaining walls */\n k = Math.floor(Math.random()*redges);\n /* scan down the edge array till we find the kth removeable edge */\n for (i=0; i<edges; i++) {\n if (edge[i].valid == true) {\n if (k == 0) {\n edge[i].valid = false;\n n = group[edge[i].cell1];\n o = group[edge[i].cell2];\n /* if the cells are already connected don't remove the wall */\n if (n != o) {\n edge[i].draw = false;\n done = true;\n /* fix up the group array */\n for (j=0; j<groups; j++) {\n if (group[j] == o) {\n group[j] = n;\n }\n if (group[j] != n) {\n done = false; /* if we have more than one\n group we're not done */\n }\n }\n }\n break;\n } else {\n k--;\n }\n }\n }\n redges--; /* decriment the number of removable edges */\n /* if we're done, create an entrance and exit */\n if (done) {\n for (j=0; j<2; j++) {\n /* randomly select a perimeter edge */\n k = Math.floor(Math.random()*(perimeters-j));\n for (i=0; i<perimeters; i++) {\n if (k == 0) {\n if (perimeter[i].valid == true) {\n perimeter[i].draw = false;\n break;\n }\n }\n else {\n k--;\n }\n }\n }\n }\n}",
"repaint() {\n this.fill_color = background_color;\n this.wall_color = wall_color;\n maze_buff.strokeCap(SQUARE);\n maze_buff.background(this.fill_color);\n\n // Go over all cells in the grid and repaint their left and top walls\n for (let row = 0; row < this.row_count; ++row) {\n for (let col = 0; col < this.col_count; ++col) {\n if (this.has_left_wall(row, col))\n this.vertical_wall(col-1, col, row, row, true);\n else\n this.vertical_wall(col-1, col, row, row, false);\n if (this.has_top_wall(row, col))\n this.horizontal_wall(col, col, row-1, row, true);\n else\n this.horizontal_wall(col, col, row-1, row, false);\n }\n }\n // Then go over the right column to do its right wall\n for (let row = 0; row < this.row_count; ++row) {\n if (this.has_right_wall(row, this.col_count-1))\n this.vertical_wall(this.col_count-1, this.col_count, row, row, true);\n else\n this.vertical_wall(this.col_count-1, this.col_count, row, row, false);\n }\n // And go over the bottom row to do its bottom wall\n for (let col = 0; col < this.col_count; ++col) {\n if (this.has_bot_wall(this.row_count-1, col))\n this.horizontal_wall(col, col, this.row_count-1, this.row_count, true);\n else\n this.horizontal_wall(col, col, this.row_count-1, this.row_count, false);\n }\n }",
"function set_edges() {\n\n dragrect.style(\"stroke\", \"black\");\n\n // Edging goes top, right, bottom, left\n // As a rectangle has 4 sides, there are 2^4 = 16 cases to handle.\n\n\n var numRepeats = Math.floor(rect_geom.width / 4);\n var gap = rect_geom.width - 4 * numRepeats;\n var edge = \"2,2,\".repeat(numRepeats) + gap + \",0\";\n\n var dashArray = \"\";\n\n if (rect_geom.top_fixed){\n dashArray += edge;\n } else {\n dashArray += \"0,\" + rect_geom.width;\n }\n\n if (rect_geom.right_fixed){\n dashArray += \",\" + rect_geom.height + \",0\";\n } else {\n dashArray += \",\" + \"0,\" + rect_geom.height;\n }\n\n if (rect_geom.bottom_fixed){\n dashArray += \",\" + edge;\n } else {\n dashArray += \",\" + \"0,\" + rect_geom.width;\n }\n\n if (rect_geom.left_fixed){\n dashArray += \",\" + rect_geom.height + \",0\";\n } else {\n dashArray += \",\" + \"0,\" + rect_geom.height;\n }\n\n dragrect.style(\"stroke-dasharray\", dashArray);\n common_geom.update_formula();\n }",
"reset(){\n this.vertices.forEach(vertex => {\n vertex.color = 'w';\n vertex.isWall = false;\n vertex.distance = Number.MAX_SAFE_INTEGER;\n vertex.parent = null;\n });\n }",
"function restoreWalls() {\n if (!wallsAreRemoved) {\n return;\n }\n\n if (container_) {\n self.remove(container_);\n }\n\n let leftSize = neighborSizes[corner_].left;\n let rightSize = neighborSizes[corner_].right;\n\n shedWalls[cornerNeighbors[corner_].left].geometry.clip.pop();\n shedWalls[cornerNeighbors[corner_].right].geometry.clip.pop();\n\n if (neighborSizes[corner_].left <= width_) {\n shedWalls[cornerNeighbors[corner_].afterLeft].geometry.clip.pop();\n }\n\n if (neighborSizes[corner_].right <= width_) {\n shedWalls[cornerNeighbors[corner_].beforeRight].geometry.clip.pop();\n }\n\n innerWalls_ = [];\n\n shedColumns_[corner_].visible = true;\n\n if (leftSize <= width_) {\n let nextContainer = (corner_ < 3) ? corner_ + 1 : 0;\n shedColumns_[nextContainer].visible = true;\n }\n\n if (rightSize <= width_) {\n let previousCorner = (corner_ > 0) ? corner_ - 1 : 3;\n shedColumns_[previousCorner].visible = true;\n }\n\n wallsAreRemoved = false;\n }",
"function generateWallTiles(upAndDown,nodeArray,wallNodes){\n var wallDensity = $('#wallDensity').val();\n wallDensity = Number(wallDensity);\n while (wallNodes.length<(maxRow*maxRow*wallDensity)){\n if (!upAndDown){\n isWall = (Math.floor(Math.random()*((maxRow*maxRow-1)-0+1))+0);\n while ((isWall % maxRow == 0) || ((isWall-(maxRow-1))%maxRow == 0) || (isWall == maxRow-1)){\n isWall = (Math.floor(Math.random()*((maxRow*maxRow-1)-0+1))+0);}\n for (var i=0; i<nodeArray.length; i++){\n if (nodeArray[i].id == isWall){\n nodeArray[i].isAWall = true;\n nodeArray[i].backgroundcolor = 'black';\n wallNodes.push(isWall);\n }\n }}\n else{\n isWall = (Math.floor(Math.random()*((maxRow*maxRow-(maxRow+1))-maxRow+1)) + maxRow);\n for (var i=0; i<nodeArray.length; i++){\n if (nodeArray[i].id == isWall){\n nodeArray[i].isAWall = true;\n nodeArray[i].backgroundcolor = 'black';\n wallNodes.push(isWall);\n }\n }}\n }\n return nodeArray\n}",
"function fillBlanks() {\n for (var r = 0; r < n; r++)\n for (var c = 0; c < n + r + 1; c++) {\n var p = v[5] + dx*c + dl*r;\n drawPoly(p, p + dl, p + dl + dr, p + dr, yellow);\n }\n for (var r = n; r < 2*n - 1; r++)\n for (var c = r - n + 1; c < 2*n; c++) {\n var p = v[5] + dx*c + dl*r;\n drawPoly(p, p + dl, p + dl + dr, p + dr, yellow);\n }\n}",
"function initializeEdges() {\n edges = [\n [5, 0, 1],\n [2, 0, 2],\n [10, 0, 3],\n [7, 1, 4],\n [4, 2, 5],\n [1, 1, 3],\n [5, 2, 3],\n [6, 3, 4],\n [3, 3, 6],\n [11, 3, 5],\n [13, 4, 6],\n [9, 5, 6]\n ]\n}",
"function generateGraph(size = Math.ceil(Math.random()*20)+10){ \r\n clearTimeout(currTimeout);\r\n clearTimeout(explore);\r\n clearTimeout(draw);\r\n\r\n size = parseInt(size);\r\n if(size % 2 == 0) size += 1;\r\n\r\n $(function(){\r\n $(\"#currSize\").text(size);\r\n $(\"#sizeInput\").attr(\"placeholder\", size + \" (Odd number 1-101)\");\r\n });\r\n \r\n //console.log(size);\r\n var cellWidth = canvSize/size;\r\n var cellHeight = canvSize/size;\r\n //console.log(cellWidth);\r\n\r\n matrix = new Array();\r\n for(var i=0; i<size; i++){\r\n matrix[i] = new Array();\r\n for(var j=0; j<size; j++){\r\n matrix[i][j] = 0;\r\n // context.fillStyle = (matrix[i][j] == 0) ? \"#000000\" : \"#FFFFFF\";\r\n // context.fillRect(i*cellWidth,j*cellHeight, cellWidth, cellHeight);\r\n }\r\n }\r\n\r\n \r\n innerWalls(1, size-2, 1, size-2, true); //marks interior walls as 1\r\n outerWalls(size); //exterior walls are 1\r\n\r\n for(var i=0; i<size; i++){ //drawing walls\r\n for(var j=0; j<size; j++){\r\n context.fillStyle = (matrix[i][j] == 1) ? \"#000000\" : \"#FFFFFF\";\r\n context.fillRect(i*cellWidth,j*cellHeight, cellWidth, cellHeight);\r\n\r\n context.fillStyle = \"#000000\";\r\n context.fillRect(i*cellWidth,j*cellHeight, 1, cellHeight);\r\n context.fillRect(i*cellWidth,j*cellHeight, cellWidth, 1);\r\n context.fillRect((i+1)*cellWidth-1,j*cellHeight-1, 1, cellHeight);\r\n context.fillRect(i*cellWidth,(j+1)*cellHeight, cellWidth, 1);\r\n\r\n context.fillStyle = \"green\";\r\n context.font = cellWidth/2 + \"px Arial\";\r\n //context.fillText(\"Test\", i*cellWidth, j*cellHeight+(cellHeight/1.5));\r\n }\r\n }\r\n context.fillStyle = \"red\";\r\n context.fillRect(cellWidth, cellHeight, cellWidth, cellHeight);\r\n context.fillRect(cellWidth*(size-2), cellWidth*(size-2), cellWidth, cellHeight);\r\n\r\n context.fillStyle = \"black\";\r\n\r\n\r\n \r\n}",
"function removeWalls() {\n if (wallsAreRemoved) {\n return;\n }\n\n let leftSize = neighborSizes[corner_].left;\n let rightSize = neighborSizes[corner_].right;\n\n if (width_ != depth_) {\n shedWalls[cornerNeighbors[corner_].left].geometry.clip.push(-leftSize * 0.5, ((leftSize == width_) ? width_ : depth_) - leftSize * 0.5);\n shedWalls[cornerNeighbors[corner_].right].geometry.clip.push(rightSize * 0.5 - ((leftSize == width_) ? depth_ : width_), rightSize * 0.5);\n } else {\n shedWalls[cornerNeighbors[corner_].left].geometry.clip.push(-leftSize * 0.5, width_ - leftSize * 0.5);\n shedWalls[cornerNeighbors[corner_].right].geometry.clip.push(rightSize * 0.5 - width_, rightSize * 0.5);\n }\n\n if (leftSize <= width_) {\n shedWalls[cornerNeighbors[corner_].afterLeft].geometry.clip\n .push(-rightSize * 0.5, ((width_ != depth_) ? tools.ft2cm(4) : INNER_WALL_SIZE_12) - rightSize * 0.5);\n }\n\n if (rightSize <= width_) {\n shedWalls[cornerNeighbors[corner_].beforeRight].geometry.clip\n .push(leftSize * 0.5 - ((width_ != depth_) ? tools.ft2cm(4) : INNER_WALL_SIZE_12), leftSize * 0.5);\n }\n\n shedColumns_[corner_].visible = false;\n\n if (leftSize <= width_) {\n let nextContainer = (corner_ < 3) ? corner_ + 1 : 0;\n shedColumns_[nextContainer].visible = false;\n }\n\n if (rightSize <= width_) {\n let previousCorner = (corner_ > 0) ? corner_ - 1 : 3;\n shedColumns_[previousCorner].visible = false;\n }\n\n wallsAreRemoved = true;\n }",
"wallSides(){\n this.boundaries = [];\n for (var i=0; i<this.grid.length; i++){\n for (var j=0; j<this.grid[i].length; j++){\n if(this.grid[i][j] === 1 || this.grid[i][j] === 2 || this.grid[i][j] === \"D\"){\n this.boundaries.push({top: 50*j, \n down: 50*j+50,\n left: 50*i,\n right: 50*i+50})\n }\n }\n } \n }",
"function buildSideFaces() {\n\n var layeroffset = 0;\n sidewalls( contour, layeroffset );\n layeroffset += contour.length;\n\n for ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n ahole = holes[ h ];\n sidewalls( ahole, layeroffset );\n\n //, true\n layeroffset += ahole.length;\n\n }\n\n }",
"function drawWalls(ctx, walls, height) {\n height = height || 40;\n\n // XXX: This function merges a lot of responsibilities and should\n // probably be split out or refactored to be better.\n\n // A \"wall\" has an \"x\", its X position, a \"label\" (which is usually a\n // multiple of the X position -- we scale the band up for demonstration\n // purposes), whether the wall is \"selected\" (used for the walkthrough),\n // and whether the wall is \"open\" (used for the walkthrough -- this means)\n // it draws the fill to the wall position but doesn't draw the wall itself.\n\n function drawWall(w) {\n if (w.open) return;\n\n ctx.save();\n\n if (w.selected)\n ctx.fillStyle = ctx.strokeStyle = 'red';\n else\n ctx.fillStyle = ctx.strokeStyle = 'black';\n\n ctx.textAlign = 'center';\n ctx.textBaseline = 'hanging';\n ctx.fillText(w.label, w.x, height);\n\n ctx.beginPath();\n ctx.lineWidth = 2;\n ctx.moveTo(w.x, 0);\n ctx.lineTo(w.x, height);\n ctx.stroke();\n ctx.restore();\n }\n\n function drawFill(w1, w2) {\n var x1 = w1.x, x2 = w2.x;\n\n var fillPad = 6;\n var w = x2 - x1;\n var y1 = fillPad;\n var h = height - fillPad * 2;\n\n ctx.beginPath();\n ctx.rect(x1, y1, w, h);\n ctx.save();\n ctx.fill();\n ctx.restore();\n\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y1);\n ctx.moveTo(x1, y1+h);\n ctx.lineTo(x2, y1+h);\n ctx.save();\n ctx.lineWidth = 2;\n ctx.strokeStyle = '#666';\n ctx.setLineDash([5, 5]);\n ctx.stroke();\n ctx.restore();\n }\n\n for (var i = 0; i < walls.length; i += 2) {\n var w1 = walls[i], w2 = walls[i+1];\n if (w1 && w2) drawFill(w1, w2);\n if (w1) drawWall(w1);\n if (w2) drawWall(w2);\n }\n }",
"function set_edges() {\n }",
"function fill() {\n\n let newPoints = [];\n\n for (let s = 1; s < waypoints.length; s++) {\n let vector = new Vector(waypoints[s - 1], waypoints[s]);\n\n let numPointsFit = Math.round(Math.ceil(vector.magnitude / fSpacing));\n\n vector = vector.normalize().scale(fSpacing);\n\n for (let i = 0; i < numPointsFit; i++) {\n newPoints.push(waypoints[s - 1].add(vector.scale(i)));\n }\n }\n\n newPoints.push(waypoints[waypoints.length - 1]);\n\n points = newPoints;\n}",
"findingEdges(playedFloodBoard) {\n let cornorColor = playedFloodBoard[0][0];\n let dimension = playedFloodBoard.length;\n let findEdges = true;\n let x = 0,\n y = 0;\n let originColor = [[0, 0]];\n let edges = [];\n let expanding = [[0, 0]];\n\n let present = [];\n while (findEdges) {\n let tempExpanding = [];\n expanding.forEach(arr => {\n x = arr[0];\n y = arr[1];\n let holdTempXY = this.getValidIndexArray(x, y, dimension);\n\n holdTempXY.forEach(arr => {\n if (playedFloodBoard[arr[0]][arr[1]] == cornorColor) {\n present = originColor.filter(index =>\n _.isEqual(index, [arr[0], arr[1]])\n );\n if (present.length == 0) {\n tempExpanding.push([arr[0], arr[1]]);\n originColor.push([arr[0], arr[1]]);\n }\n } else {\n present = edges.filter(index => _.isEqual(index, [arr[0], arr[1]]));\n if (present.length == 0) {\n edges.push([arr[0], arr[1]]);\n }\n }\n });\n });\n expanding = tempExpanding;\n if (expanding.length == 0) {\n findEdges = false;\n }\n }\n\n this.edges = edges;\n this.originColor = originColor;\n }",
"function initializeWalls() {\n walls_board = [\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, 0, 0, 0, 0, 0, 0, 0],\n [0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, 0, 0, 0, 0, WALL, WALL, 0],\n [0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, WALL, WALL, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, WALL, WALL, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n ];\n}"
] |
[
"0.6780318",
"0.665928",
"0.6615446",
"0.6555187",
"0.6404461",
"0.6328344",
"0.62806356",
"0.62559336",
"0.622399",
"0.620246",
"0.6186758",
"0.6156086",
"0.6133909",
"0.6103521",
"0.60797733",
"0.60089236",
"0.5964475",
"0.59593767",
"0.595872",
"0.5914151",
"0.59028786",
"0.5898894",
"0.5881277",
"0.5873556",
"0.5868478",
"0.58419293",
"0.58416563",
"0.583752",
"0.583137",
"0.58286786"
] |
0.76997936
|
0
|
Create reactor from genome's data
|
createReactorFromGenome(genome) {
for (var x = 0; x < this.nCols; x++) {
for (var y = 0; y < this.nRows; y++) {
this.grid[x][y] = new TILE_MAP[genome.grid[x][y]](x, y, this);
}
}
this.fillEdges(this.grid);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"mating (parent1, parent2) {\n // Create a child genome\n let child = new Genome();\n\n parent1.neurons.forEach(neuron => {\n child.pushNeuron(neuron.neuron);\n });\n\n parent1.synapses.forEach(synapse => {\n if (parent2.synapses.id == synapse.id) {\n child.pushSynapse(util.randBool() ? synapse.synapse : parent2.synapse.synapse);\n } else {\n child.pushSynapse(synapse.synapse);\n }\n });\n\n return child;\n }",
"clone() {\n\t\tlet clonedGenes = [];\n\t\tfor(var g of this.genes) {\n\t\t\tclonedGenes.push( Rocket.createCommand(g.thrust, g.steering, g.duration) ); // Thrust, Steering, Duration\n\t\t}\n\t\treturn new DNA(clonedGenes);\n\t}",
"constructor() {\r\n this.genes = new Array();\r\n DNA.target.forEach((d) => {\r\n let res = null;\r\n while (res == null) {\r\n res = generateSingleTimeTable(d.subjects, d.name);\r\n }\r\n this.genes.push(res);\r\n });\r\n }",
"function Reactor(config) {\"use strict\";\n\t if (!(this instanceof Reactor)) {\n\t return new Reactor(config)\n\t }\n\t config = config || {}\n\n\t /**\n\t * The state for the whole cluster\n\t */\n\t this.state = Immutable.Map({})\n\t /**\n\t * Event bus that emits a change event anytime the state\n\t * of the system changes\n\t */\n\t this.__changeEmitter = new ChangeEmitter()\n\t /**\n\t * Holds a map of id => reactor instance\n\t */\n\t this.__stores = Immutable.Map({})\n\n\t this.__initialize(config)\n\t /**\n\t * Change observer interface to observe certain keypaths\n\t * Created after __initialize so it starts with initialState\n\t */\n\t this.__changeObsever = new ChangeObserver(this.state, this.__changeEmitter)\n\t }",
"static from(data){\n return FlowFactory.getFlow(data);\n }",
"newFromData( data = {}, make_dirty = false ) {\n let model = factory.make_reactive_model( this.modelDefinition, data, this._create_context(), false );\n // model._update_data( generated_data, null, true );\n return model\n }",
"constructor( data ){\n this._emitter = new EventTarget();\n this._converters = new Map();\n this._dynamicProperties = false;\n this._data = data;\n }",
"function createInitialPopulation() {\n //inits the array\n genomes = [];\n //for a given population size\n for (var i = 0; i < populationSize; i++) {\n //randomly initialize the 7 values that make up a genome\n //these are all weight values that are updated through evolution\n var genome = {\n //Genomes generation\n generation: clone(generation),\n //unique identifier for a genome\n id: makeid(6),\n //The weight of each row cleared by the given move. the more rows that are cleared, the more this weight increases\n rowsCleared: Math.random() - 0.5,\n //the absolute height of the highest column to the power of 1.5\n //added so that the algorithm can be able to detect if the blocks are stacking too high\n weightedHeight: Math.random() - 0.5,\n //The sum of all the column’s heights\n cumulativeHeight: Math.random() - 0.5,\n //the highest column minus the lowest column\n relativeHeight: Math.random() - 0.5,\n //the sum of all the empty cells that have a block above them (basically, cells that are unable to be filled)\n holes: Math.random() * 0.5,\n // the sum of absolute differences between the height of each column \n //(for example, if all the shapes on the grid lie completely flat, then the roughness would equal 0).\n roughness: Math.random() - 0.5,\n };\n //add them to the array\n genomes.push(genome);\n }\n evaluateNextGenome();\n}",
"function getState(reactor, data) {\n\t\t var state = {}\n\t\t for (var key in data) {\n\t\t state[key] = reactor.evaluate(data[key])\n\t\t }\n\t\t return state\n\t\t}",
"static create(time, dur, bones, morphs) {\nvar frame;\n//------\nframe = new CASFrame();\nframe.set(time, dur, bones, morphs);\nreturn frame;\n}",
"function MakePulse(type, detail, origin) {\n var pulse = {\n type: type,\n detail: detail,\n origin: origin\n };\n\n return pulse;\n }",
"function reproduce() {\n //Choose the best two bird in relation to their normalized fitness\n let brainA = pickOne();\n let brainB = pickOne();\n \n //Get the child from crossover the two parents\n let childBrain = brainA.crossover(brainB);\n \n //mutate the child with a 10% possibility to mutate\n childBrain.mutate(0.1);\n \n return new Bird(childBrain);\n}",
"function GenericIEC(np, seeds, iecOptions)\n{\n var self = this;\n\n self.options = iecOptions || {};\n self.np = np;\n\n //we keep track of new nodes and connections for the session\n self.newNodes = {};\n self.newConnections = {};\n\n //we can send in a seed genome -- to create generic objects when necessary\n self.seeds = seeds;\n\n for(var s=0; s < seeds.length; s++)\n {\n var seed = seeds[s];\n for(var c =0; c < seed.connections.length; c++)\n {\n var sConn = seed.connections[c];\n var cid = '(' + sConn.sourceID + ',' + sConn.targetID + ')';\n self.newConnections[cid] = sConn;\n }\n }\n\n self.cloneSeed = function(){\n\n var seedIx = utilities.next(self.seeds.length);\n\n var seedCopy = NeatGenome.Copy(self.seeds[seedIx]);\n if(self.options.seedMutationCount)\n {\n for(var i=0; i < self.options.seedMutationCount; i++)\n seedCopy.mutate(self.newNodes, self.newConnections, self.np);\n }\n return seedCopy;\n };\n\n self.markParentConnections = function(parents){\n\n for(var s=0; s < parents.length; s++)\n {\n var parent = parents[s];\n for(var c =0; c < parent.connections.length; c++)\n {\n var sConn = parent.connections[c];\n var cid = '(' + sConn.sourceID + ',' + sConn.targetID + ')';\n self.newConnections[cid] = sConn;\n }\n }\n\n };\n\n\n //this function handles creating a genotype from sent in parents.\n //it's pretty simple -- however many parents you have, select a random number of them, and attempt to mate them\n self.createNextGenome = function(parents)\n {\n self.markParentConnections(parents);\n //IF we have 0 parents, we create a genome with the default configurations\n var ng;\n var initialMutationCount = self.options.initialMutationCount || 0,\n postXOMutationCount = self.options.postMutationCount || 0;\n\n var responsibleParents = [];\n\n switch(parents.length)\n {\n case 0:\n\n //parents are empty -- start from scratch!\n ng = self.cloneSeed();\n\n for(var m=0; m < initialMutationCount; m++)\n ng.mutate(self.newNodes, self.newConnections, self.np);\n\n //no responsible parents\n\n break;\n case 1:\n\n //we have one parent\n //asexual reproduction\n ng = parents[0].createOffspringAsexual(self.newNodes, self.newConnections, self.np);\n\n //parent at index 0 responsible\n responsibleParents.push(0);\n\n for(var m=0; m < postXOMutationCount; m++)\n ng.mutate(self.newNodes, self.newConnections, self.np);\n\n break;\n default:\n //greater than 1 individual as a possible parent\n\n //at least 1 parent, and at most self.activeParents.count # of parents\n var parentCount = 1 + utilities.next(parents.length);\n\n if(parentCount == 1)\n {\n //select a single parent for offspring\n var rIx = utilities.next(parents.length);\n\n ng = parents[rIx].createOffspringAsexual(self.newNodes, self.newConnections, self.np);\n //1 responsible parent at index 0\n responsibleParents.push(rIx);\n break;\n }\n\n //we expect active parents to be small, so we grab parentCount number of parents from a small array of parents\n var parentIxs = utilities.RouletteWheel.selectXFromSmallObject(parentCount, parents);\n\n var p1 = parents[parentIxs[0]], p2;\n //if I have 3 parents, go in order composing the objects\n\n responsibleParents.push(parentIxs[0]);\n\n //p1 mates with p2 to create o1, o1 mates with p3, to make o2 -- p1,p2,p3 are all combined now inside of o2\n for(var i=1; i < parentIxs.length; i++)\n {\n p2 = parents[parentIxs[i]];\n ng = p1.createOffspringSexual(p2, self.np);\n p1 = ng;\n responsibleParents.push(parentIxs[i]);\n }\n\n for(var m=0; m < postXOMutationCount; m++)\n ng.mutate(self.newNodes, self.newConnections, self.np);\n\n\n break;\n }\n\n //we have our genome, let's send it back\n\n //the reason we don't end it inisde the switch loop is that later, we might be interested in saving this genome from some other purpose\n return {offspring: ng, parents: responsibleParents};\n };\n\n}",
"function init() {\n createDataReader('heartbeat', true);\n createDataReader('timing');\n createDataReader('telemetry');\n }",
"function Reactor(config) {\"use strict\";\n\t\t if (!(this instanceof Reactor)) {\n\t\t return new Reactor(config)\n\t\t }\n\t\t config = config || {}\n\n\t\t this.debug = !!config.debug\n\n\t\t this.ReactMixin = createReactMixin(this)\n\t\t /**\n\t\t * The state for the whole cluster\n\t\t */\n\t\t this.__state = Immutable.Map({})\n\t\t /**\n\t\t * Holds a map of id => reactor instance\n\t\t */\n\t\t this.__stores = Immutable.Map({})\n\n\t\t this.__evaluator = new Evaluator()\n\t\t /**\n\t\t * Change observer interface to observe certain keypaths\n\t\t * Created after __initialize so it starts with initialState\n\t\t */\n\t\t this.__changeObserver = new ChangeObserver(this.__state, this.__evaluator)\n\t\t }",
"init() {\n this._child = fork('./routes/src/worker/parser.js');\n this._child.on('message', (data) => {\n this._bk_data[0] = data.data[0];\n this._bk_data[1] = data.data[1];\n this._bk_data[2] = data.data[2];\n this._bk_data[3] = data.data[3];\n this._bk_data[4] = data.data[4];\n this._bk_data[5] = data.data[5];\n this._bk_data[6] = data.data[6];\n this._bk_data[7] = data.data[7];\n });\n }",
"function TruckBuilder() {\n this.truck = null;\n \n this.step1 = function() {\n this.truck = new Truck();\n };\n \n this.step2 = function() {\n this.truck.addParts();\n };\n \n this.get = function() {\n return this.truck;\n };\n}",
"function constructPipeline() {\n // console.log($rootScope.CSVdelim);\n // var separator = $rootScope.CSVdelim?$rootScope.CSVdelim:'\\\\,';\n var readDatasetFunct = new jsedn.List([\n new jsedn.sym('read-dataset'),\n new jsedn.sym('data-file')\n ]);\n\n pipeline = null;\n\n pipeline = new jsedn.List([\n jsedn.sym('defpipe'),\n jsedn.sym('my-pipe'),\n 'Grafter pipeline for data clean-up and preparation.',\n new jsedn.Vector([new jsedn.sym('data-file')]),\n new jsedn.List([jsedn.sym('->'), readDatasetFunct])\n ]);\n\n pipelineFunctions.map(function (arg) {\n pipeline.val[4].val.push(arg);\n });\n\n //(read-dataset data-file :format :csv)\n pipelineFunctions = new jsedn.List([]);\n return pipeline;\n}",
"createDependency(data) {\n const source = data.source,\n target = data.target,\n fromSide = data.sourceTerminal.dataset.side,\n toSide = data.targetTerminal.dataset.side,\n type = (fromSide === 'left' ? 0 : 2) + (toSide === 'right' ? 1 : 0);\n return this.dependencyStore.add({\n from: source.id,\n to: target.id,\n type,\n fromSide,\n toSide\n })[0];\n }",
"createDependency(data) {\n const\n source = data.source,\n target = data.target,\n fromSide = data.sourceTerminal.dataset.side,\n toSide = data.targetTerminal.dataset.side,\n type = (fromSide === 'left' ? 0 : 2) + (toSide === 'right' ? 1 : 0);\n\n return this.dependencyStore.add({\n from : source.id,\n to : target.id,\n type,\n fromSide,\n toSide\n })[0];\n }",
"makeData (callback) {\n\t\tthis.init(callback);\n\t}",
"makeData (callback) {\n\t\tthis.init(callback);\n\t}",
"makeData (callback) {\n\t\tthis.init(callback);\n\t}",
"makeData (callback) {\n\t\tthis.init(callback);\n\t}",
"repopulate () {\n const nbToGenerate = this.populationSize - this.currentPopulation.length\n const newGenomes = Array(nbToGenerate).fill('').map(genome => new Genome(this.nbInput, this.nbOutput))\n this.currentPopulation = [...this.currentPopulation, ...newGenomes]\n }",
"makeData (callback) {\n\t\tBoundAsync.series(this, [\n\t\t\tthis.adjustMarkers,\t\t\t// adjust those markers for a different commit\n\t\t\tthis.setData\t\t\t\t// set the data to be used in the request that will result in a message sent\n\t\t], callback);\n\t}",
"function ChannelManager () {\n this.connections = {}\n this.replicators = {}\n\n this.set = function (otherMachineId, connName, datachannel) {\n var replicator = this.replicators[otherMachineId] = this.replicators[otherMachineId] ||\n new PouchReplicator('replicator', PouchDB, db, {batch_size: 50})\n\n replicator.addPeer(connName, datachannel)\n\n var connections = this.connections[otherMachineId] = this.connections[otherMachineId] || {}\n connections[connName] = datachannel\n\n replicator.on('endpeerreplicate', function () {\n for (var i in replicator.datachannels) {\n var dc = replicator.datachannels[i]\n dc.send('<received>')\n }\n app.ports.replication.send([otherMachineId, '<received>'])\n })\n\n datachannel.addEventListener('message', e => {\n console.log(connName + ' says: ' + e.data)\n if (e.data === '<received>') {\n app.ports.replication.send([otherMachineId, '<sent>'])\n db.compact()\n }\n })\n }\n\n this.cleanup = function (otherMachineId, connName) {\n var replicator = this.replicators[otherMachineId]\n if (!replicator) return\n replicator.removePeer(connName)\n }\n\n this.replicate = function () {\n console.log('replicating pouchdb to', Object.keys(this.replicators))\n for (var otherMachineId in this.replicators) {\n console.log('> replicating pouchdb to', otherMachineId)\n\n app.ports.replication.send([otherMachineId, '<replicating>'])\n\n var replicator = this.replicators[otherMachineId]\n replicator.replicate()\n }\n }\n}",
"initReceptors() {\n\t\tthis.noteskin = new Noteskin(this.settings.noteskin);\n\t\tvar keys = this.notetrack.keyCount;\t\t// determined from level file\t\t\n\t\tthis.receptors = [];\t\t\t\t\t// hold receptors for reference\n\t\tfor (var k = 0; k < keys; k++) {\n\t\t\t// downscroll\n\t\t\tif (this.settings.scrollDirection === 'down') {\n\t\t\t\tvar y = this.height-100;\n\t\t\t}\n\t\t\t// upscroll\n\t\t\telse {\n\t\t\t\tvar y = 100;\n\t\t\t}\n\t\t\tvar x = this.getAlignment(this.width/2, keys, 60, 10, k);\n\t\t\tthis.receptors[k] = new Receptor(30,x,y,this.noteskin);\n\t\t\tthis.stage.addChild(this.receptors[k].graphic);\n\t\t\tthis.stage.addChild(this.receptors[k].burstGraphic);\n\t\t\tthis.stage.addChild(this.receptors[k].mineBurstGraphic);\n\t\t}\n\t}",
"createDependency() {\n const me = this,\n data = me.creationData,\n source = data.source,\n target = data.target,\n fromSide = data.sourceTerminal.dataset.side,\n toSide = data.targetTerminal.dataset.side,\n type = (fromSide === 'left' ? 0 : 2) + (toSide === 'right' ? 1 : 0);\n\n me.store.add({\n from: source.id,\n to: target.id,\n type,\n fromSide,\n toSide\n });\n }",
"function constructTweens(container) {\n\n var i=0;\n var j;\n var k;\n var tw;\n var start, end;\n var end_time;\n var duration;\n var start_values, end_values;\n var from_data, to_data;\n var start_transparency, end_transparency;\n var meshes;\n UNDO_TWEENS = [];\n for ( i=0; i < container.tracks.length; i++ ) {\n if ( container.tracks[i] instanceof ContainerTrack ) {\n constructTweens( container.tracks[i] );\n }\n if ( container.tracks[i] instanceof ItemTrack ) {\n if ( container.tracks[i].type === \"camera\" ) {\n j=0;\n for ( j=0; j < container.tracks[i].tracks.length; j++ ) {\n if ( container.tracks[i].tracks[j].property === \"camera\") {\n k=1;\n for ( k=0; k < container.tracks[i].tracks[j].keys.length; k++ ) {\n start = k-1;\n if ( container.tracks[i].tracks[j].keys[k].segment === \"true\" || k === 0 ) {\n start = k;\n }\n end = k;\n var start_camera = container.tracks[i].tracks[j].keys[start];\n start_values = start_camera.values;\n var end_camera = container.tracks[i].tracks[j].keys[end];\n end_values = end_camera.values;\n duration = (end_camera.time - start_camera.time) * SPEED;\n from_data = {\n data: {\n object: defaultCamera,\n fov : {\n top: parseFloat(start_values[TOP]),\n bottom: parseFloat(start_values[BOTTOM]),\n left: parseFloat(start_values[LEFT]),\n right: parseFloat(start_values[RIGHT]),\n depth: parseFloat(start_values[DEPTH])\n },\n position : new THREE.Vector3(parseFloat(start_values[POSX]), parseFloat(start_values[POSY]), parseFloat(start_values[POSZ])),\n quaternion : new THREE.Quaternion(parseFloat(start_values[QX]), parseFloat(start_values[QY]), parseFloat(start_values[QZ]), parseFloat(start_values[QW])),\n center : new THREE.Vector3(parseFloat(start_values[ATX]), parseFloat(start_values[ATY]), parseFloat(start_values[ATZ])),\n scale : parseFloat(start_values[SCALE]),\n mc : start_values[ATD],\n event_callback: {\n type: event_type,\n callback: event_callback\n },\n }\n };\n to_data = {\n data: {\n object: defaultCamera,\n fov : {\n top: parseFloat(end_values[TOP]),\n bottom: parseFloat(end_values[BOTTOM]),\n left: parseFloat(end_values[LEFT]),\n right: parseFloat(end_values[RIGHT]),\n depth: parseFloat(end_values[DEPTH])\n },\n position : new THREE.Vector3(parseFloat(end_values[POSX]), parseFloat(end_values[POSY]), parseFloat(end_values[POSZ])),\n quaternion : new THREE.Quaternion(parseFloat(end_values[QX]), parseFloat(end_values[QY]), parseFloat(end_values[QZ]), parseFloat(end_values[QW])),\n center : new THREE.Vector3(parseFloat(end_values[ATX]), parseFloat(end_values[ATY]), parseFloat(end_values[ATZ])),\n scale : parseFloat(end_values[SCALE]),\n mc : end_values[ATD],\n event_callback: {\n type: event_type,\n callback: event_callback\n },\n }\n };\n if ( isInitalState( duration, start_values, end_values) ) {\n getAnimationAdapter().cameraInitialization(from_data.data);\n }\n else {\n tw = new TWEEN.Tween( from_data );\n tw.to( to_data, duration );\n tw.easing(TWEEN.Easing.Linear.None);\n tw.interpolation(getAnimationAdapter().cameraInterpolation);\n tw.delay( (container.tracks[i].tracks[j].keys[start].time) * SPEED);\n end_time = (container.tracks[i].tracks[j].keys[start].time) * SPEED + duration;\n if ( end_time > RUNNING_TIME ) RUNNING_TIME = end_time;\n ANIMATION_TWEENS.push(tw);\n }\n }\n }\n else {\n console.log(\"Don't yet support track type property \" + container.tracks[i].tracks[j].property);\n }\n }\n }\n else if ( container.tracks[i].type === \"selectionitem\" ) {\n if (DEBUG) console.log (\" Tween \" + container.tracks[i].selectionItem.sbomIdPath);\n for ( j=0; j < container.tracks[i].tracks.length; j++ ) {\n if ( container.tracks[i].tracks[j].property === \"color\") {\n for ( k=0; k < container.tracks[i].tracks[j].keys.length; k++ ) {\n start = k-1;\n if ( container.tracks[i].tracks[j].keys[k].segment === \"true\" || k === 0 ) {\n start = k;\n }\n end = k;\n var start_color = container.tracks[i].tracks[j].keys[start];\n start_values = start_color.values;\n var end_color = container.tracks[i].tracks[j].keys[end];\n end_values = end_color.values;\n duration = (end_color.time - start_color.time) * SPEED;\n meshes = getAnimationAdapter().getGeometryByPath(container.tracks[i].selectionItem.instance);\n if ( meshes === undefined || meshes.length === 0 ) {\n meshes = getAnimationAdapter().getGeometryByPath(container.tracks[i].selectionItem.sbomIdPath);\n }\n if ( meshes === undefined || meshes.length === 0 ) {\n console.log(\"Assembly not processed geometry\" + container.tracks[i].selectionItem.instance + \" nor \" + container.tracks[i].selectionItem.sbomIdPath + \" to change \" + container.tracks[i].tracks[j].property );\n }\n else {\n from_data = {\n data: {\n object: meshes,\n color: [parseFloat(start_values[0]), parseFloat(start_values[1]), parseFloat(start_values[2])]\n }\n };\n to_data = {\n data: {\n color: [parseFloat(end_values[0]), parseFloat(end_values[1]), parseFloat(end_values[2])]\n }\n };\n if ( isInitalState( duration, start_values, end_values) ) {\n getAnimationAdapter().colorInitialization(from_data.data);\n }\n else {\n tw = new TWEEN.Tween( from_data );\n tw.to( to_data, duration );\n tw.easing(TWEEN.Easing.Linear.None);\n tw.interpolation(getAnimationAdapter().colorInterpolation);\n tw.delay(container.tracks[i].tracks[j].keys[start].time * SPEED);\n end_time = (container.tracks[i].tracks[j].keys[start].time) * SPEED + duration;\n if ( end_time > RUNNING_TIME ) RUNNING_TIME = end_time;\n ANIMATION_TWEENS.push(tw);\n }\n }\n }\n }\n else if ( container.tracks[i].tracks[j].property === \"transparency\" ) {\n // This is the opacity of the object\n k=1;\n for ( k=0; k < container.tracks[i].tracks[j].keys.length; k++ ) {\n start = k-1;\n if ( container.tracks[i].tracks[j].keys[k].segment === \"true\" || k === 0 ) {\n start = k;\n }\n end = k;\n start_transparency = container.tracks[i].tracks[j].keys[start];\n start_values = start_transparency.values;\n end_transparency = container.tracks[i].tracks[j].keys[end];\n end_values = end_transparency.values;\n duration = (end_transparency.time - start_transparency.time) * SPEED;\n meshes = getAnimationAdapter().getGeometryByPath(container.tracks[i].selectionItem.instance);\n if ( meshes === undefined || meshes.length === 0 ) {\n meshes = getAnimationAdapter().getGeometryByPath(container.tracks[i].selectionItem.sbomIdPath);\n }\n if ( meshes === undefined || meshes.length === 0 ) {\n console.log(\"Assembly not processed geometry\" + container.tracks[i].selectionItem.instance + \" nor \" + container.tracks[i].selectionItem.sbomIdPath + \" to change \" + container.tracks[i].tracks[j].property );\n }\n else {\n from_data = {\n data: {\n object: meshes,\n transparency: parseFloat(start_values[0])\n }\n };\n to_data = {\n data: {\n transparency: parseFloat(end_values[0])\n }\n };\n if ( isInitalState( duration, start_values, end_values) ) {\n getAnimationAdapter().transparencyInitialization(from_data.data);\n }\n else {\n tw = new TWEEN.Tween( from_data );\n tw.to( to_data, duration );\n tw.easing(TWEEN.Easing.Linear.None);\n tw.interpolation(getAnimationAdapter().transparencyInterpolation);\n tw.delay(container.tracks[i].tracks[j].keys[start].time * SPEED);\n end_time = (container.tracks[i].tracks[j].keys[start].time) * SPEED + duration;\n if ( end_time > RUNNING_TIME ) RUNNING_TIME = end_time;\n ANIMATION_TWEENS.push(tw);\n }\n }\n }\n }\n else if ( container.tracks[i].tracks[j].property === \"visibility\" ) {\n k=1;\n for ( k=0; k < container.tracks[i].tracks[j].keys.length; k++ ) {\n start = k-1;\n if ( container.tracks[i].tracks[j].keys[k].segment === \"true\" || k === 0 ) {\n start = k;\n }\n end = k;\n var start_visibility = container.tracks[i].tracks[j].keys[start];\n start_values = start_visibility.values;\n var end_visibility = container.tracks[i].tracks[j].keys[end];\n end_values = end_visibility.values;\n duration = (end_visibility.time - start_visibility.time) * SPEED;\n meshes = getAnimationAdapter().getGeometryByPath(container.tracks[i].selectionItem.instance);\n if ( meshes === undefined || meshes.length === 0 ) {\n meshes = getAnimationAdapter().getGeometryByPath(container.tracks[i].selectionItem.sbomIdPath);\n }\n if ( meshes === undefined || meshes.length === 0) {\n console.log(\"Assembly not processed geometry\" + container.tracks[i].selectionItem.instance + \" nor \" + container.tracks[i].selectionItem.sbomIdPath + \" to change \" + container.tracks[i].tracks[j].property );\n }\n else {\n end_transparency = 0.0;\n if ( parseFloat(end_values[0]) == 1 ) end_transparency = 1.0;\n start_transparency = 0.0;\n if ( parseFloat(start_values[0]) == 1 ) start_transparency = 1.0;\n if ( meshes !== undefined && meshes !== null ) {\n from_data = {\n data: {\n object: meshes,\n visibility: toBoolean(start_values[0]),\n transparency: start_transparency\n }\n };\n to_data = {\n data: {\n visibility: toBoolean(end_values[0]),\n transparency: end_transparency\n }\n };\n if ( isInitalState( duration, start_values, end_values) ) {\n getAnimationAdapter().visibilityInitialization(from_data.data);\n }\n else {\n tw = new TWEEN.Tween( from_data );\n tw.to( to_data, duration );\n tw.easing(TWEEN.Easing.Linear.None);\n tw.interpolation(getAnimationAdapter().visibilityInterpolation);\n tw.delay(container.tracks[i].tracks[j].keys[start].time * SPEED);\n end_time = (container.tracks[i].tracks[j].keys[start].time) * SPEED + duration;\n if ( end_time > RUNNING_TIME ) RUNNING_TIME = end_time;\n ANIMATION_TWEENS.push(tw);\n }\n }\n }\n }\n }\n else if ( container.tracks[i].tracks[j].property === \"location\" ) {\n k=1;\n for ( k=0; k < container.tracks[i].tracks[j].keys.length; k++ ) {\n start = k-1;\n if ( container.tracks[i].tracks[j].keys[k].segment === \"true\" || k === 0 ) {\n start = k;\n }\n end = k;\n var start_location = container.tracks[i].tracks[j].keys[start];\n start_values = start_location.values;\n var end_location = container.tracks[i].tracks[j].keys[end];\n end_values = end_location.values;\n duration = (end_location.time - start_location.time) * SPEED;\n\n var group = getAnimationAdapter().getSelectedObject(container.tracks[i].selectionItem.instance);\n if ( group === undefined ) {\n group = getAnimationAdapter().getSelectedObject(container.tracks[i].selectionItem.sbomIdPath);\n }\n if ( group === undefined ) {\n console.log(\"Not processing geometry \" + container.tracks[i].selectionItem.instance + \" nor \" + container.tracks[i].selectionItem.sbomIdPath + \" to change \" + container.tracks[i].tracks[j].property );\n }\n else {\n var object = groups;\n var originalpositions = [];\n var originalQuaternions = [];\n var fps = [];\n var tps = [];\n for ( var ig = 0 ; ig < groups.length; ig++ ) {\n for ( var im = 0 ; im < groups[ig].children.length; im++ ) {\n originalpositions.push( new THREE.Vector3( groups[ig].children[im].position.x, groups[ig].children[im].position.y, groups[ig].children[im].position.z) );\n originalQuaternions.push( new THREE.Quaternion(groups[ig].children[im].quaternion.x, groups[ig].children[im].quaternion.y, groups[ig].children[im].quaternion.z, groups[ig].children[im].quaternion.w) );\n // The positions in the animation are relative to the parent, and so need to be rotated, clearly this is a hack for the moment\n var fp = new THREE.Vector3(parseFloat(start_values[POSX]), parseFloat(start_values[POSY]), parseFloat(start_values[POSZ]));\n var mat4 = new THREE.Matrix4();\n mat4.makeRotationFromQuaternion(getAnimationAdapter().getQuaternion(groups[ig].children[im]));\n mat4.setPosition(getAnimationAdapter().getPosition(groups[ig].children[im]));\n var rotmat4 = new THREE.Matrix4();\n rotmat4.copy(mat4);\n rotmat4.elements[12] = 0.0;\n rotmat4.elements[13] = 0.0;\n rotmat4.elements[14] = 0.0;\n fp.applyMatrix4(rotmat4);\n fps.push(fp);\n var tp = new THREE.Vector3(parseFloat(end_values[POSX]), parseFloat(end_values[POSY]), parseFloat(end_values[POSZ]));\n tp.applyMatrix4(rotmat4);\n tps.push(tp);\n }\n }\n\n from_data = {\n data: {\n object: object,\n startPosition : originalpositions,\n startQuaternion : originalQuaternions,\n position: fps,\n quaternion : new THREE.Quaternion(parseFloat(start_values[QX]), parseFloat(start_values[QY]), parseFloat(start_values[QZ]), parseFloat(start_values[QW])),\n center : new THREE.Vector3(parseFloat(start_values[ATX]), parseFloat(start_values[ATY]), parseFloat(start_values[ATZ])),\n scale : parseFloat(start_values[SCALE]),\n mc : start_values[ATD]\n }\n };\n to_data = {\n data: {\n position: tps,\n quaternion : new THREE.Quaternion(parseFloat(end_values[QX]), parseFloat(end_values[QY]), parseFloat(end_values[QZ]), parseFloat(end_values[QW])),\n center : new THREE.Vector3(parseFloat(end_values[ATX]), parseFloat(end_values[ATY]), parseFloat(end_values[ATZ])),\n scale : parseFloat(end_values[SCALE]),\n mc : end_values[ATD]\n }\n };\n if ( isInitalState( duration, start_values, end_values) ) {\n //getAnimationAdapter().locationInitialization(from_data.data, to_data.data);\n }\n else {\n if ( object !== null ) {\n tw = new TWEEN.Tween( from_data );\n tw.to( to_data, duration );\n tw.delay(container.tracks[i].tracks[j].keys[start].time * SPEED);\n tw.interpolation(getAnimationAdapter().seqLocationInterpolation);\n end_time = (container.tracks[i].tracks[j].keys[start].time) * SPEED + duration;\n if ( end_time > RUNNING_TIME ) RUNNING_TIME = end_time;\n ANIMATION_TWEENS.push(tw);\n }\n }\n }\n }\n }\n else {\n console.log(\"Don't yet support selection property \" + container.tracks[i].tracks[j].property);\n }\n }\n }\n else {\n console.log(\"Don't yet support track type \" + container.tracks[i].type);\n }\n }\n }\n }"
] |
[
"0.5178849",
"0.51047647",
"0.47394875",
"0.4737446",
"0.46850276",
"0.46726274",
"0.46125326",
"0.46085462",
"0.45834824",
"0.45480216",
"0.45465487",
"0.45460716",
"0.45187247",
"0.45109233",
"0.45065793",
"0.45057622",
"0.44775924",
"0.44625717",
"0.43933642",
"0.43859088",
"0.43804368",
"0.43804368",
"0.43804368",
"0.43804368",
"0.43734488",
"0.43510708",
"0.4350646",
"0.43152806",
"0.4311808",
"0.42970976"
] |
0.65718883
|
0
|
Returns the reactor's heat
|
getTotalHeat() {
var totalHeat = 0;
for (var x = 0; x < this.nCols; x++) {
for (var y = 0; y < this.nRows; y++) {
totalHeat += this.grid[x][y].heat;
}
}
return totalHeat;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function stats(heat) {\r\n\t\t// If max hasn't been set yet or if the value is bigger, use the current value.\r\n\t\tif (typeof max === 'undefined' || heat > max) max = heat;\r\n\t\t// If min hasn't been set yet or if the value is smaller, use the current value.\r\n\t\tif (typeof min === 'undefined' || heat < min) min = heat;\r\n\r\n\t\t// Return the heat value again so we can daisy chain function calls.\r\n\t\treturn heat;\r\n\t}",
"getCurrentHeatingCoolingState() {\n if (this.isMiotDeviceConnected()) {\n if (this.getDevice().isPowerOn()) {\n if (this.getDevice().isStatusHeating()) {\n return Characteristic.CurrentHeatingCoolingState.HEAT;\n } else if (this.getDevice().isCooling()) {\n return Characteristic.CurrentHeatingCoolingState.COOL;\n } else {\n return Characteristic.CurrentHeatingCoolingState.OFF;\n }\n }\n }\n return Characteristic.CurrentHeatingCoolingState.OFF;\n }",
"getHeaterActiveState() {\n if (this.isMiotDeviceConnected()) {\n return this.getDevice().isHeating() ? Characteristic.Active.ACTIVE : Characteristic.Active.INACTIVE;\n }\n return Characteristic.Active.INACTIVE;\n }",
"get temperature() {\n return (5 / 9) * (this.fahrenheit - 32);\n }",
"energy(){\n\t\treturn this._energy;\n\t}",
"function temperature() {\n var roll = dice.d(20);\n // Its a normal day\n if (roll < 15) {\n return 90 + dice.d(9);\n }\n // extreme heat\n if (roll > 17) {\n return 100 + dice.d(10);\n }\n // random heavy cold front\n if (roll > 14 && roll < 18) {\n return 95 - (dice.d(4) * 10);\n }\n}",
"getHeaterCoolerActiveState() {\n if (this.isMiotDeviceConnected()) {\n return this.getDevice().isPowerOn() ? Characteristic.Active.ACTIVE : Characteristic.Active.INACTIVE;\n }\n return Characteristic.Active.INACTIVE;\n }",
"getHeatMap() {\n\n if(this.activePollutant == null || this.stateDataArray == null || this.stateDataArray.length == 0) return null;\n\n switch(this.activePollutant.toUpperCase()) {\n\n case 'CARBON MONOXIDE' :\n return d3.scaleLinear()\n .domain([0,d3.max(this.stateDataArray, function(d) { if(d) return d['CO'] })])\n .interpolate(d3.interpolateRgb)\n .range([\"#f9fbe7\",\"#c0ca33\"]);\n break;\n\n case 'SULPHUR DIOXIDE' :\n return d3.scaleLinear()\n .domain([0,d3.max(this.stateDataArray, function(d) { if(d) return d['SO2'] })])\n .interpolate(d3.interpolateRgb)\n .range([\"#ffeda0\",\"#f03b20\"]);\n break;\n\n case 'NITROUS OXIDE' :\n return d3.scaleLinear()\n .domain([0,d3.max(this.stateDataArray, function(d) { if(d) return d['NO2'] })])\n .interpolate(d3.interpolateRgb)\n .range([\"#fde0dd\",\"#c51b8a\"]);\n break;\n\n case 'OZONE' :\n return d3.scaleLinear()\n .domain([0,d3.max(this.stateDataArray, function(d) { if(d) return d['O3'] })])\n .interpolate(d3.interpolateRgb)\n .range([\"#ece2f0\",\"#1c9099\"]);\n\n default: return null;\n }\n \n }",
"newPowerLevel(heat) {\n let base = Math.ceil((1 + Math.random()) * 100);\n let level = Math.pow(base, 1 + heat / 1200);\n if(level > 1000000000000000000) level = 1000000000000000000; // JS craps out if we go higher than this\n return level;\n\t}",
"get Health() {\n return this.health;\n }",
"get healthyColor() {}",
"function Heater(actuatorID, actuatorName, actuatorDescription, actuatorCurrentState){\n\t\tActuator.call(this, actuatorID, actuatorName, actuatorDescription, actuatorCurrentState);\n\t}",
"get physicalResist() {\n return this.Constitution;\n }",
"get intensity() {}",
"function HeaterCalc(volumeUnits){\n\t\n\tthis.volumeUnits =volumeUnits;\n\tthis.height = 0;\n\tthis.width = 0;\n\tthis.lenght = 0;\n\tthis.tempRise = 0;\n\tif(volumeUnits == 0.133){\n\t\t//volumeUnits is Feet set default temp Fahrenheit\n\t\tthis.tempUnits = 'F';\n\t}else{\n\t\t//volumeUnits is Meters set default temp Celsius\n\t\tthis.tempUnits = 'C';\n\t}\n\t\n\tthis.setDimensions = function(height,width,length){\n\t\tthis.height = height;\n\t\tthis.width = width;\n\t\tthis.lenght = length;\n\t};\n\n\tthis.setVolumeUnits = function(volumeUnits){\n\t\tthis.volumeUnits =volumeUnits;\n\t};\n\n\tthis.setTempUnits = function(tempUnits){\n\t\tthis.tempUnits = tempUnits;\n\t}\n\t\n\tthis.setTempRise = function(tempRise){\n\t\tthis.tempRise =tempRise;\n\t};\n\t\n\tthis.volume = function(){\n\t\tvar volume = this.height * this.width * this.lenght;\n\t\tif (isNaN(volume)) { \n\t\t\tvolume = \"\"; \n\t }\n\t\treturn volume;\n\t};\n\n\tthis.isVolumeUnitMeters = function(){\n\t\treturn this.volumeUnits > 1;\n\t}\n\n\tthis.c\n\n\t// For Metric height, width, and length always calculate back\n\t// to feet \"in the background\"\n\t// This feature obsoletes - Issue 10 The formula needs to be:\"\n\t// ([total cubic meters of tent/marquee]*2.6)*([Desired Rise in room temp]*1.8)\n\tthis.heatReq = function(){\n\t\tvar roomVolume = this.volume();\n\t\tif(roomVolume==\"\"){\n\t\t\treturn \"\";\n\t\t}\n\t\tif(this.isVolumeUnitMeters()){\n\t\t\t// console.log(\"Metric Volume converting to Feet Volume\");\n\t\t\troomVolume = this.convertMetricToFeetVolume(this.volume());\n\t\t}\n\t\t//tempRise are now all calculated in Fahrenheit\n\t\tvar tempRiseInF = this.tempRise;\n\t\tif(this.tempUnits == 'C'){\n\t\t\t// console.log(\"Feet volume and Celsius calculation \"+this.tempRise);\n\t\t\t// console.log(\"Celsius to Farenheit \"+this.convertCelsiusToFarienheit(this.tempRise));\n\t\t\ttempRiseInF= this.convertCelsiusToFarienheit(this.tempRise);\n\t\t}\n\t\t// console.log(\"Feet volume and Farenheit calculation\");\n\t\treturn Math.round((FEETUNITS * roomVolume) * tempRiseInF);\n\t\t\n\t\t\t\n\t};\n\n\tthis.convertCelsiusToFarienheit = function(tempRiseCelsius) {\n\t\treturn tempRiseCelsius * 1.8;\n\t}\n\n\tthis.convertFarienheitToCelsius = function(tempRiseFarienheit) {\n\t\treturn tempRiseFarienheit / 1.8;\n\t}\n\n\tthis.convertMetricToFeet = function(meters) {\n\t\treturn meters * 3.2808;\n\t}\n\n\tthis.convertFeetToMetric = function(feet) {\n\t\treturn feet / 3.2808;\n\t}\n\n\tthis.convertMetricToFeetVolume = function(squareMeters) {\n\t\treturn squareMeters * 35.315;\n\t}\n\n\tthis.convertFeetToMetricVolume = function(squareFeet) {\n\t\treturn squareFeet / 35.315;\n\t}\n\t\n\tthis.myRound = function(value, places) {\n\t var multiplier = Math.pow(10, places);\n\n\t return (Math.round(value * multiplier) / multiplier);\n\t};\n\t\n\tthis.heatReqBtu = function(){\n\t\tif(this.heatReq()==\"\"){\n\t\t\treturn \"\";\n\t\t}\n\n\t\treturn this.heatReq();\n\t}\n\t\n\tthis.heatReqWatts = function(){\n\t\tif(this.heatReq()==\"\"){\n\t\t\treturn \"\";\n\t\t}\n\n\t\t//Imperial watts to btus ([calculated Watts required]*3.4121414799)/[btuh output available]\n\t\treturn this.heatReq()/3.4121414799;\n\t}\n\t\n\tthis.suggest = function(heater){\n\t\tif(this.heatReq()==\"\"){\n\t\t\treturn \"\";\n\t\t}\n\t\tvar realBtuhReq = this.heatReq();\n\t\t\n\t\tvar raw = realBtuhReq/heater;\n\t\treturn raw.toFixed(1);\n\t};\n\n\tthis.p80 = function(){\n\t\treturn this.suggest(PREMIER_80);\n\t};\n\t\n\tthis.p170 = function(){\n\t\treturn this.suggest(PREMIER_170);\n\t};\n\t\n\tthis.p350 = function(){\n\t\treturn this.suggest(PREMIER_350);\n\t};\n\t\n\tthis.t125 = function(){\n\t\treturn this.suggest(TRADESMAN_125);\n\t};\n\t\n\tthis.t170 = function(){\n\t\treturn this.suggest(TRADESMAN_170);\n\t};\n\t\n\tthis.t400 = function(){\n\t\treturn this.suggest(TRADESMAN_400);\n\t};\n\t\n\tthis.tk75 = function(){\n\t\treturn this.suggest(TRADESMAN_K75);\n\t};\n\t\n\tthis.tk125 = function(){\n\t\treturn this.suggest(TRADESMAN_K125);\n\t};\n\t\n\tthis.tk175 = function(){\n\t\treturn this.suggest(TRADESMAN_K175);\n\t};\n\t\n\tthis.tk210 = function(){\n\t\treturn this.suggest(TRADESMAN_K210);\n\t};\n\t\n\tthis.tk400 = function(){\n\t\treturn this.suggest(TRADESMAN_K400);\n\t};\n\t\n\tthis.tk650 = function(){\n\t\treturn this.suggest(TRADESMAN_K650);\n\t};\n\t\n\tthis.f500 = function(){\n\t\treturn this.suggest(FOREMAN_500);\n\t};\n\tthis.f750 = function(){\n\t\treturn this.suggest(FOREMAN_750);\n\t};\n\t\n\tthis.b400 = function(){\n\t\treturn this.suggest(BOSS_400);\n\t};\n\tthis.b1000 = function(){\n\t\treturn this.suggest(BOSS_1000);\n\t};\n\t\n\tthis.n200 = function(){\n\t\treturn this.suggest(NORSEMAN_200);\n\t};\n\tthis.n250 = function(){\n\t\treturn this.suggest(NORSEMAN_250);\n\t};\n\t\n\tthis.w100 = function(){\n\t\treturn this.suggest(WORKMAN_100);\n\t};\n\tthis.w225 = function(){\n\t\treturn this.suggest(WORKMAN_225);\n\t};\n\t\n\tthis.s15 = function(){\n\t\treturn this.suggest(SUNBLAST_15);\n\t};\n\tthis.s30 = function(){\n\t\treturn this.suggest(SUNBLAST_30);\n\t};\n\t\n\tthis.s35 = function(){\n\t\treturn this.suggest(SUNBLAST_35);\n\t};\n\tthis.s125 = function(){\n\t\treturn this.suggest(SUNBLAST_125);\n\t};\n\n}",
"function getProbeFeatures(){\r\n\r\n\t\t\tvar list = [[settings.stimulus_large, settings.colorred, 0],\r\n\t\t\t\t\t\t[settings.stimulus_large, settings.colorred, 90],\r\n\t\t\t\t\t\t[settings.stimulus_large, settings.colorblue, 0],\r\n\t\t\t\t\t\t[settings.stimulus_large, settings.colorblue, 90]];\r\n\t\t\tvar weight = [0.25, 0.3125, 0.1875, 0.25];\r\n\t\t\tvar weighed_list = general.generateWeighedList(list, weight);\r\n\t\t\tvar random_num = general.rand(0, weighed_list.length-1);\r\n\t\t\treturn weighed_list[random_num];\r\n\t}",
"get tileset() {\n return this._tileset;\n }",
"get tileset() {\n return this._tileset;\n }",
"get temperature() {\n // convertimos los grados F a C\n this.temperature_F = 5 / 9 * (this.temperature_F - 32)\n return this.temperature_F;\n }",
"get health(){ return this._health}",
"updateHeaterState() {\n const temperatureThreshold = 3;\n const temperatureDifference = Math.abs(this.currentTemperature - this.goalTemperature);\n if (temperatureDifference >= temperatureThreshold) {\n if (this.currentTemperature > this.goalTemperature) {\n this.setHeaterState(OFF);\n } else {\n this.setHeaterState(ON);\n }\n }\n }",
"function getHeaterState(){\n execFile('./scripts/heaterRead.sh', (error, stdout, stderr) => {\n if (error) {\n console.error('stderr', stderr);\n throw error;\n }\n console.log('heater ' + stdout);\n readData.heaterState = stdout\n }) \n}",
"function heatGenerate(){\n for(var key in activeArray) {\n if(activeArray[key].heat < 100) {\n activeArray[key].heat += HEAT_PER_TICK;\n }\n var $fill;\n switch (enlarged) {\n case \"\":\n $fill = $(\"#\" + key + \" .gauge-fill\");\n break;\n case key:\n $fill = $(\"#inGame .gauge-fill\");\n break;\n default:\n $fill = $(\".mini-\" + key);\n }\n $fill.height(activeArray[key].heat + \"%\");\n $fill.css(\"background-color\", 'hsl(' + (120 - (activeArray[key].heat / 5 * 6)) + ', 100%, 50%)');\n totalHeat += activeArray[key].heat;\n }\n \n if(totalHeat > 0) {\n totalHeat = totalHeat < COOLANT_LEVEL ? 0 : totalHeat - COOLANT_LEVEL;\n }\n \n if(totalHeat >= MAX_HEAT){\n totalHeat = MAX_HEAT;\n loseGame();\n }\n var meterColour;\n meterColour = 'hsl(' + (120 - ((totalHeat/MAX_HEAT) * 120)) + ', 100%, 50%)';\n heatMeter.setAttribute(\"style\", \"background-position: \" + totalHeat/MAX_HEAT * -100 + \"% 0; \" +\n \"background-image: linear-gradient(to right, transparent, transparent 50%, \" + meterColour + \n \" 50%, \" + meterColour + \" 100%)\"); \n}",
"get physicalResist() {\n return this.Constitution + this.armorRating;\n }",
"function getTemperature() {\n local supplyVoltage = hardware.voltage();\n local voltage = supplyVoltage * Temperature.read() / 65535.0;\n local c = (voltage - 0.5) * 100 ;\n local celsius = format(\"%.01f\", c);\n return(celsius);\n}",
"get noiseSpread() {}",
"get hue() { return this.hsl[0]; }",
"get Fire() {\n return Math.round((this.fire) * this.Effects.Fire/modBase);\n }",
"getEncounterCreatures(){\n if(this.randomEncounter != null){\n return this.randomEncounter.getCreatures();\n }\n }",
"addHeat(data, heat) {\n\t\tif(!data) return;\n\t\tlet multiplier = 10 / Math.max(10, data.maxPopulation);\n let addedHeat = heat * Math.pow(1.05, data.resets) * multiplier;\n data.heat += addedHeat;\n console.log(`Heat increased by ${heat} to ${data.heat}`);\n\t}"
] |
[
"0.5725281",
"0.5705587",
"0.5526374",
"0.5522373",
"0.55149597",
"0.5491786",
"0.5486443",
"0.53699565",
"0.5363011",
"0.53147906",
"0.5285283",
"0.52120245",
"0.5204996",
"0.51845163",
"0.51728326",
"0.5164788",
"0.5143756",
"0.5143756",
"0.51254344",
"0.50591487",
"0.5037834",
"0.5037761",
"0.5029355",
"0.50229347",
"0.49894607",
"0.493903",
"0.49153438",
"0.48970053",
"0.48827776",
"0.487881"
] |
0.5792577
|
0
|
PIN CATEGORY SIDE BAR
|
function category_pin()
{
var category_div = document.getElementById('category_sidebar');
category_div.className = 'pinned';
var button = document.getElementById('category_pin_button');
button.innerHTML = 'открепить';
button.onclick = function(){category_unpin();};
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function category_unpin()\n {\n var category_div = document.getElementById('category_sidebar');\n category_div.className = '';\n var button = document.getElementById('category_pin_button');\n button.innerHTML = 'закрепить';\n button.onclick = function(){category_pin();};\n }",
"function pinSidebar(pin) {\n $('#topbar #close-sidebar').addClass('disabled');\n $('#topbar #close-sidebar').removeClass('fa-rotate-90');\n $('#sidebar').show();\n zoom(true);\n\n mode.pinnedSidebar = mode.pinnedSidebar || []\n if (mode.pinnedSidebar.indexOf(pin) == -1) {\n mode.pinnedSidebar.push(pin);\n }\n}",
"function SIDE$static_(){ToolbarSkin.SIDE=( new ToolbarSkin(\"side\"));}",
"renderCrosshairVert() {\n const className = this.state.checkboxCheck\n ? `map_crosshairs_vert visible`\n : `map_crosshairs_vert visible hidden`;\n return <div className={className} />;\n }",
"get sideBar() {\n return this._sideBar;\n }",
"function showCatInSideBar(catId, catName) {\n reSetMarkers(); // clean up the category and map state\n showDialog(false); // hide our info-dialog, if necessary\n //\n var topicsToShow = getAllTopicsInCat(catId);\n topicsToShow.sort(topicSort); // alphabetical ascending\n var topicIdsToShow = new Array();\n //\n var sideBarCategories = jQuery(\"#sideBarCategories\");\n sideBarCategories.empty();\n sideBarCategories.append(' <b class=\"redTitle\"><a href=\"javascript:renderCritCatListing('+ crtCritIndex+')\" title=\"Zurück\">' +catName + '</a></b><br/> ');\n sideBarCategories.append('<small>('+topicsToShow.length+ ' Objekte)</small><p/>');\n sideBarCategories.append('<table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" id=\"sideBarCategoriesTable\"></table>');\n for (var i = 0; i < topicsToShow.length; i++) {\n jQuery(\"#sideBarCategoriesTable\").append('<tr width=\"100%\" class=\"topicRowDeselected\">'\n + '<td width=\"20px\" class=\"iconCell\" valign=\"center\" align=\"center\">'\n + '<img src=\"http://www.berlin.de/imperia/md/images/system/icon_punkt_rot.gif\"/></td>'\n +' <td><a href=\"#\" id=\"topicRowHref-'+topicsToShow[i].id+'\">'+topicsToShow[i].name+'</a></td></tr>');\n jQuery(\"#topicRow-\"+topicsToShow[i].id).attr('onclick', 'javascript:showTopicInMap(\"'+topicsToShow[i].id+'\");');\n jQuery(\"#topicRowHref-\"+topicsToShow[i].id).attr('href', 'javascript:showTopicInMap(\"'+topicsToShow[i].id+'\");');\n topicIdsToShow.push(topicsToShow[i].id);\n }\n // mark category as currently selected, visible\n markerGroupIds.push(catId);\n // showTopicsInMap(topicsToShow);\n showTopicFeatures(topicIdsToShow, catId);\n // calculateNewBounds if its a \"District\" criteria\n if (onBerlinDe) { // ### fixed hack\n for (i = 0; i < districtNames.length; i++) {\n if (districtNames[i].catName == catName) {\n var districtBounds = getBoundsOfCurrentVisibleFeatures(); // out features inside\n updateVisibleBounds(districtBounds, false, LEVEL_OF_DISTRICT_ZOOM);\n }\n }\n }\n }",
"function toClickNavicon() {\n\t\t\tcount++;\n\t\t\tif (count % 2 != 0) {\n\t\t\t\tsidebar.style.left = 0;\n\t\t\t\tmoveLayout.style.marginLeft = 200 + 'px'\n\t\t\t\twrapper.style.opacity = 0.2;\n\t\t\t\tnavicon.style.color = 'rgb(250,250,250)';\n\t\t\t\tdocument.body.style.overflow = 'hidden';\n\t\t\t} \n\t\t\tif (count % 2 == 0) {\n\t\t\t\tsidebar.style.left = -200 + 'px';\n\t\t\t\tmoveLayout.style.marginLeft = 0;\n\t\t\t\twrapper.style.opacity = 1;\n\t\t\t\tnavicon.style.color = 'rgb(88,77,57)';\n\t\t\t\tdocument.body.style.overflow = 'auto';\n\t\t\t}\n\t\t}",
"static sideBarFunc(){\n navIcon.addEventListener('click', () => {\n sideBar.style.display = 'block';\n })\n }",
"function pinMenu() {\n pinned = true;\n sessionStorage.setItem('offcanvas-pinned', true);\n // Adjust content area padding-left\n $(\".sv-grid-ksgs12\").first().addClass('pinned'); // So CSS can adjust padding rule accordingly\n // Turn off CSS animation (important on initially pinned page)\n $(\".ked-navigation .sidebar\").css({\n transition: 'none'\n });\n // Rotate the pinning icon a bit and let it 100% non-transparent:\n pinIcon.css({\n opacity: 1,\n transform: \"rotate(35deg) scale(1.1)\",\n transformOrigin: '50% 50%'\n });\n // Make menu expanded if not already expanded:\n expandMenu();\n }",
"function Sidebar() {\n return (\n\n <div className=\"sidebar\">\n <h5>IMPEKABLE</h5>\n <ul className=\"side-contents\">\n <li><a className=\"side-text\" ><i className=\"fa fa-home\"></i> Home</a></li>\n <li className=\"active\"><a className=\"side-text\" ><i className=\"fa fa-bar-chart\"></i> Dashboard</a></li>\n <li><a className=\"side-text\"><i className=\"fa fa-envelope\"></i> Inbox</a></li>\n <li><a className=\"side-text\"><i className=\"fa fa-barcode\"></i> Products</a></li>\n </ul>\n\n </div>\n\n )\n}",
"function YATAToggleSideBar(left, show) {\n var item = \"YATAIconNav\";\n var side = (left) ? \"-left\" : \"-right\";\n var div = (left) ? \"YATALeftSide\" : \"YATARightSide\";\n \n divBase = item + side;\n if (show) {\n document.getElementById(divBase + \"-on\").style.display = \"none\";\n document.getElementById(divBase + \"-off\").style.display = \"inline-block\"; \n }\n else {\n document.getElementById(divBase + \"-on\").style.display = \"inline-block\"; \n document.getElementById(divBase + \"-off\").style.display = \"none\"; \n }\n var element = document.getElementById(div);\n element.classList.toggle(\"shinyjs-hide\");\n element.classList.toggle(\"shinyjs-show\");\n}",
"function sidePanel() {\n strokeWeight(0);\n textSize(36);\n textStyle(BOLD);\n textAlign(CENTER);\n textFont(\"Cambria\");\n\n //This makes the side pannel\n fill(0, 45, 72);\n rect(width - 400, 0, width, height);\n\n //This is for the dividers on the side pannel\n fill(0, 140, 174);\n rect(width - 400, 445, width, 8);\n rect(width - 400, 545, width, 8);\n rect(width - 400, 715, width, 8);\n\n //This is just used to label the pen color and pan size sliders\n fill(200, 241, 247);\n text(\"Pen Color\", width - 200, 40);\n text(\"Pen Size\", width - 200, 490);\n}",
"handleClick(){\n this.props.sidebar === \"DISPLAY_INFO_SIDEBAR\" ? this.props.hideInfoSidebar() : this.props.displayInfoSidebar();\n }",
"function SideBarRight() { return (\r\n <div class=\"container-fluid1\">\r\n <ul class=\"list-sidebar bg-defoult\">\r\n <h3 class=\"activity\"><b>Friends Activity</b></h3>\r\n\r\n <h6 class=\"connect\">Connect with Facebook to see what your friends are playing.</h6>\r\n <div class=\"btn\">\r\n <button type=\"button\" class=\"btn btn-primary\" href=\"https://www.facebook.com/\">📱 Connect With Facebook.</button>\r\n </div>\r\n <p class=\"paragraph\">We'll never post anything without your permission. Show and hide Friend Activity from Settings.</p>\r\n <div class=\"strain\"></div>\r\n <div class=\"strain\"></div>\r\n <div class=\"strain\"></div>\r\n <div class=\"strain\"></div>\r\n <div class=\"strain\"></div>\r\n <div class=\"strain\"></div>\r\n <div class=\"strain\"></div>\r\n <div class=\"strain\"></div>\r\n <div class=\"strain\"></div>\r\n <div class=\"strain\"></div>\r\n <div class=\"strain\"></div>\r\n <div class=\"strain\"></div>\r\n</ul>\r\n </div>\r\n )\r\n }",
"function toggleSideBar(action) {\r\n if (action == \"open\") {\r\n sideBar.classList.add(\"visible\");\r\n mapContainer.classList.add(\"shorten\");\r\n\r\n return;\r\n }\r\n\r\n sideBar.classList.toggle(\"visible\");\r\n mapContainer.classList.toggle(\"shorten\");\r\n}",
"function HB_Element_Sidebar() {\n\t \t$( '.hb-sidebar .icon-sidebar' ).click( function() {\n\t\t\t// Add class active\n\t\t\t$(this).closest( '.hb-sidebar' ).addClass( 'active' );\n\t\t\t$( 'html' ).addClass( 'no-scroll' );\n\t\t} );\n\n\t \t$( '.hb-sidebar .content-sidebar > .overlay' ).click( function() {\n\t\t\t// Remove class active\n\t\t\t$(this).closest( '.hb-sidebar' ).removeClass( 'active' );\n\t\t\t$( 'html' ).removeClass( 'no-scroll' );\n\t\t} );\n\t }",
"function Side() { }",
"function addSidebarButtons() {\n for (var i = 0; i < namespace.markers.length; i++) {\n //$(\"#accordion\").append(\n var panelDiv =\n `<div class=\"panel panel-default\">\n <div class=\"shell `+ namespace.markers[i].category +`\">\n <div class=\"panel-heading\" role=\"tab\" id=\"heading`+ i +`\">\n <h4 class=\"panel-title\" onclick=\"markerSelected(`+ i +`);\">\n ` + (i + 1) + `: ` + namespace.markers[i].name + `\n </h4>\n <div class=\"btn btn-link btn-sm pull-right x-button\" onclick=\"removePoint(` + i + `);\">×</div>\n </div>\n </div>\n <div id=\"collapse` + i + `\" class=\"panel-collapse collapse\" role=\"tabpanel\" aria-labelledby=\"heading` +\n i + `\">\n <div class=\"panel-body\">\n ` + namespace.markers[i].summary + `\n </div>\n </div>\n </div>`;\n\n $(\"#accordion\").append(panelDiv);\n namespace.markers[i].popRadius.setVisible(false);\n }\n}",
"function toggleSidebox(context) {\n // Change direction of arrow.\n $(context).find('.sp-chevron .fas').toggleClass('fa-chevron-down fa-chevron-up');\n $(context).toggleClass('sp-closed');\n\n // Toggle sidebox content.\n $(context).next().toggle();\n\n if ($(window).width() < 1024) {\n // Scroll to icon clicked on\n App.sidebarScrollbar\n .overlayScrollbars()\n .scroll($(context).parent().offset().top - $('header').outerHeight(), 500);\n }\n }",
"function addArrowToggle() {\n if( $('.ls-sidebar').length ) {\n $('.ls-sidebar').append('<span class=\"ls-sidebar-toggle ls-ico-shaft-left\"></span>');\n }\n }",
"function handleSideBar() {\n if($('#tab4').hasClass('active'))\n {\n $('#main.well').hide();\n $('#reports.well').show();\n }\n else{\n $('#main.well').show();\n $('#reports.well').hide();\n }\n }",
"function SidebarBottom({ Icon ,title, color}) {\n return (\n <div>\n <div className=\"sidebar-bt\">\n <Icon fontSize=\"large\" style={{color:color}}/>\n <h4>{title}</h4>\n\n </div>\n </div>\n )\n}",
"function sideBarSwitch(event) {\n var element = event.currentTarget;\n if(sideBarTabToContentMap.has(element)) {\n sideBarTabToContentMap.forEach(function(value, key, map) { \n if(element === key) {\n key.classList.add(\"pure-menu-selected\");\n value.style.display = 'block';\n } else {\n key.classList.remove(\"pure-menu-selected\"); \n value.style.display = 'none';\n }\n }); \n }\n}",
"TOGGLE_REDUCE_SIDEBAR(state, val) {\n state.isSidebarReduced = val;\n }",
"function ctg_bar_click_handler(){\n\t\t//variables\n\t\tvar current_active_button;\n\t\tvar prev_active_button;\n\t\tvar active_ctg;\n\t\t// create click handler\n\t\t$('.ctg').click(function(e){\n\t\t\t//save active category\n\t\t\tactive_ctg = $(e.target).attr(\"id\").split('-')[1];\n\t\t\tprev_active_button = current_active_button;\n\t\t\tcurrent_active_button = $(e.target);\n\t\t\t$(prev_active_button).removeClass(\"is-active\").addClass(\"not-active\");\n\t\t\t$(\".tags\").addClass(\"not-visible\");\n\t\t\t//make the clicked object appear active\n \t$(current_active_button).removeClass(\"not-active\").addClass(\"is-active\");\n \t$(\".tag-\" + active_ctg).removeClass(\"not-visible\").addClass(\"is-visible\");\n\t\t});\n\n\t}",
"function RSGoPro_Hider() {\r\n\tRSGoPro_Hider_called = true;\r\n\t$('.sidebar, .mix, .navi, .catalogsorter').hide();\r\n\t$('.catalog .prods').css('marginLeft','0px');\r\n}",
"function toggleSideBar() {\n id(\"tab\").classList.toggle(\"hidden\");\n id(\"options\").classList.toggle(\"move\");\n }",
"function handleSideBar() {\n var $sideBar = jQuery('.sidebar-collapse .nav.metismenu');\n var $breadcrumb = jQuery('.breadcrumb li');\n\n if ($sideBar.lenght < 1 || $breadcrumb.length < 1) {\n return;\n }\n\n var $navigator;\n var navContent;\n var selector;\n var found = false;\n for (var index = 0; index < ($breadcrumb.length > 2 ? 2 : $breadcrumb.length); index++) {\n $navigator = jQuery($breadcrumb[index]);\n navContent = jQuery.trim($navigator.find('a').length > 0 ? $navigator.find('a').text() : $navigator.text());\n if (index === 0) {\n selector = 'a';\n } else {\n selector = '.active a';\n }\n $sideBar.find(selector).each(function(index, value) {\n if (jQuery.trim(jQuery(value).text()) === navContent) {\n found = true;\n jQuery(value).parent().addClass('active');\n if (index === 0) {\n jQuery(value).next().addClass('in');\n }\n }\n });\n if (!found) {\n break;\n }\n }\n }",
"function showSidebar1() {\n showSidebar('Brand', 'New Brand');\n }",
"function setSideBarStatus() {\n if (sideBarIsOpen == 0) {\n openSideBar();\n } else {\n closeSideBar();\n }\n}"
] |
[
"0.6158295",
"0.60753703",
"0.591074",
"0.5605908",
"0.54719955",
"0.5331518",
"0.53056294",
"0.5298818",
"0.5294535",
"0.52878004",
"0.5282211",
"0.5244853",
"0.51596785",
"0.513349",
"0.5128288",
"0.51180726",
"0.5116166",
"0.5092711",
"0.50923866",
"0.5052136",
"0.50391245",
"0.5015874",
"0.50099415",
"0.5008464",
"0.50012237",
"0.49952704",
"0.49595734",
"0.49561125",
"0.49383682",
"0.4926704"
] |
0.6795635
|
0
|
UNPIN CATEGORY SIDE BAR
|
function category_unpin()
{
var category_div = document.getElementById('category_sidebar');
category_div.className = '';
var button = document.getElementById('category_pin_button');
button.innerHTML = 'закрепить';
button.onclick = function(){category_pin();};
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function category_pin()\n {\n var category_div = document.getElementById('category_sidebar');\n category_div.className = 'pinned';\n var button = document.getElementById('category_pin_button');\n button.innerHTML = 'открепить';\n button.onclick = function(){category_unpin();};\n }",
"function SIDE$static_(){ToolbarSkin.SIDE=( new ToolbarSkin(\"side\"));}",
"function showCatInSideBar(catId, catName) {\n reSetMarkers(); // clean up the category and map state\n showDialog(false); // hide our info-dialog, if necessary\n //\n var topicsToShow = getAllTopicsInCat(catId);\n topicsToShow.sort(topicSort); // alphabetical ascending\n var topicIdsToShow = new Array();\n //\n var sideBarCategories = jQuery(\"#sideBarCategories\");\n sideBarCategories.empty();\n sideBarCategories.append(' <b class=\"redTitle\"><a href=\"javascript:renderCritCatListing('+ crtCritIndex+')\" title=\"Zurück\">' +catName + '</a></b><br/> ');\n sideBarCategories.append('<small>('+topicsToShow.length+ ' Objekte)</small><p/>');\n sideBarCategories.append('<table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" id=\"sideBarCategoriesTable\"></table>');\n for (var i = 0; i < topicsToShow.length; i++) {\n jQuery(\"#sideBarCategoriesTable\").append('<tr width=\"100%\" class=\"topicRowDeselected\">'\n + '<td width=\"20px\" class=\"iconCell\" valign=\"center\" align=\"center\">'\n + '<img src=\"http://www.berlin.de/imperia/md/images/system/icon_punkt_rot.gif\"/></td>'\n +' <td><a href=\"#\" id=\"topicRowHref-'+topicsToShow[i].id+'\">'+topicsToShow[i].name+'</a></td></tr>');\n jQuery(\"#topicRow-\"+topicsToShow[i].id).attr('onclick', 'javascript:showTopicInMap(\"'+topicsToShow[i].id+'\");');\n jQuery(\"#topicRowHref-\"+topicsToShow[i].id).attr('href', 'javascript:showTopicInMap(\"'+topicsToShow[i].id+'\");');\n topicIdsToShow.push(topicsToShow[i].id);\n }\n // mark category as currently selected, visible\n markerGroupIds.push(catId);\n // showTopicsInMap(topicsToShow);\n showTopicFeatures(topicIdsToShow, catId);\n // calculateNewBounds if its a \"District\" criteria\n if (onBerlinDe) { // ### fixed hack\n for (i = 0; i < districtNames.length; i++) {\n if (districtNames[i].catName == catName) {\n var districtBounds = getBoundsOfCurrentVisibleFeatures(); // out features inside\n updateVisibleBounds(districtBounds, false, LEVEL_OF_DISTRICT_ZOOM);\n }\n }\n }\n }",
"function RSGoPro_Hider() {\r\n\tRSGoPro_Hider_called = true;\r\n\t$('.sidebar, .mix, .navi, .catalogsorter').hide();\r\n\t$('.catalog .prods').css('marginLeft','0px');\r\n}",
"TOGGLE_REDUCE_SIDEBAR(state, val) {\n state.isSidebarReduced = val;\n }",
"get sideBar() {\n return this._sideBar;\n }",
"function hideSideActions() {\n $('.side-actions').removeClass('active');\n $('.side-actions .item').removeClass('show');\n $('.help-tips').removeClass('hidden');\n}",
"turnActiveOffCatBtns() {\n this.$categoryButtons.children().each(function (index) {\n $(this).removeClass('active');\n });\n }",
"function HB_Element_Sidebar() {\n\t \t$( '.hb-sidebar .icon-sidebar' ).click( function() {\n\t\t\t// Add class active\n\t\t\t$(this).closest( '.hb-sidebar' ).addClass( 'active' );\n\t\t\t$( 'html' ).addClass( 'no-scroll' );\n\t\t} );\n\n\t \t$( '.hb-sidebar .content-sidebar > .overlay' ).click( function() {\n\t\t\t// Remove class active\n\t\t\t$(this).closest( '.hb-sidebar' ).removeClass( 'active' );\n\t\t\t$( 'html' ).removeClass( 'no-scroll' );\n\t\t} );\n\t }",
"function closeGraphSideBar() {\n document.getElementById(\"graphsidebar\").style.width = \"0\";\n}",
"deactivateCondensedSidebar() {\n this.body.removeAttr('data-leftbar-compact-mode');\n }",
"function toggleSideBar(action) {\r\n if (action == \"open\") {\r\n sideBar.classList.add(\"visible\");\r\n mapContainer.classList.add(\"shorten\");\r\n\r\n return;\r\n }\r\n\r\n sideBar.classList.toggle(\"visible\");\r\n mapContainer.classList.toggle(\"shorten\");\r\n}",
"function hideMediaInfoSidebar() {\n $rightSideBar.addClass('d-none');\n }",
"function changeTwoSidedNoData() {\r\n \r\n // change the title\r\n setTitleTwoSided(\"Data is not available for refugees from \" + currentConflictCountryName + \" in \" + countryTwoSided);\r\n\r\n // remove the bars\r\n removeBarsTwoSided(\"rect.left\", dataMale);\r\n removeBarsTwoSided(\"rect.right\", dataFemale);\r\n\r\n // remove all the text\r\n removeAllTextTwoSided();\r\n}",
"function CollectJS_Hider() {\n\tCollectJS_Hider_called = true;\n\t$('.sidebar, .mix, .navi, .catalogsorter').hide();\n\t$('.catalog .prods').css('marginLeft','0px');\n}",
"function toClickNavicon() {\n\t\t\tcount++;\n\t\t\tif (count % 2 != 0) {\n\t\t\t\tsidebar.style.left = 0;\n\t\t\t\tmoveLayout.style.marginLeft = 200 + 'px'\n\t\t\t\twrapper.style.opacity = 0.2;\n\t\t\t\tnavicon.style.color = 'rgb(250,250,250)';\n\t\t\t\tdocument.body.style.overflow = 'hidden';\n\t\t\t} \n\t\t\tif (count % 2 == 0) {\n\t\t\t\tsidebar.style.left = -200 + 'px';\n\t\t\t\tmoveLayout.style.marginLeft = 0;\n\t\t\t\twrapper.style.opacity = 1;\n\t\t\t\tnavicon.style.color = 'rgb(88,77,57)';\n\t\t\t\tdocument.body.style.overflow = 'auto';\n\t\t\t}\n\t\t}",
"function hideCategoryTitles() {\n\t\tsvg.selectAll(\".category\").remove()\n\t}",
"function closeSideBar(){\n setVideochat(false);\n setPeoples(false);\n }",
"function set_category(direction) {\n \n //set previous panels and category\n prev_category = curr_category;\n prev_panel = curr_panel;\n\t\t\t\t\ttimer.start();\n \n switch (direction) {\n case \"up\":\n curr_panel = 1;\n if(curr_category == 1) { \n curr_category = o.categories;\n } else {\n curr_category--;\n }\n\t\t\t\t\t\t\t$( notice ).purr(purrOptions);\n break;\n \n case \"down\":\t\t\t\t\t\t\t\n curr_panel = 1;\n if(curr_category == o.categories) { \n curr_category = 1;\n } else {\n curr_category++;\n } \n\t\t\t\t\t\t\t$( notice ).purr(purrOptions);\n\t\t\t\t\t\t\t\n break;\n \n case \"left\":\n\t\t\t\t\t\t\tpanels = brokenpanels[curr_category-1];\n \n if(curr_panel == 1) {\n if(curr_category == 1) {\n curr_category = o.categories;\n }\n else {\n curr_category--;\n }\n new_panels = brokenpanels[curr_category-1];\n curr_panel = new_panels;\n \n\t\t\t\t\t\t\t\t$( notice ).purr(purrOptions);\n } else {\n curr_panel--;\n }\n break;\n \n case \"right\":\n panels = brokenpanels[curr_category-1];\n if(curr_panel == panels) {\n curr_panel = 1;\n if(curr_category == o.categories) {\n curr_category = 1; \n }\n else { \n curr_category++;\n }\t\t\t\t\t\t\t\t\n $( notice ).purr(purrOptions);\n } else {\n curr_panel++;\n } \n break;\n }\n $(\".notice-body p\").html(brokenCategories[curr_category-1]);\n $(\"#pfCount\").html(curr_panel+\"/\"+brokenpanels[curr_category-1]);\n $(\"#categoryName\").html(brokenCategories[curr_category-1]);\n location.hash = '#'+brokenCategories[curr_category-1].toLowerCase()+'/'+o.hashNames[curr_category-1][curr_panel-1];\n }",
"collapse() {\n this._sideBar.currentTitle = null;\n }",
"hideSortCapsule() {\n this.props.dispatch(couponsActions.toggleSort(true, 4, 'hidden'));\n this.props.dispatch(couponsActions.requestCouponsByCategory(this.props.coupons.filter, 4));\n }",
"function unPinMenu() {\n pinned = false;\n sessionStorage.setItem('offcanvas-pinned', false);\n $(\".sv-grid-ksgs12\").first().removeClass('pinned'); // So CSS can adjust padding rule accordingly\n $(\".ked-navigation .sidebar\").css({\n transition: ''\n });\n pinIcon.css({\n transform: \"none\"\n });\n collapseMenu();\n }",
"function showMediaInfoSidebar() {\n $rightSideBar.removeClass('d-none');\n }",
"function hideCategoryNav() {\n var $tooltipBackground = $('.tooltip-background');\n // Check if a disclaimer is not open or if it doesn't exist\n if ($tooltipBackground.length <= 0 || $tooltipBackground.is(':hidden')) {\n navModelSelect.removeClass(NAV_OPEN_CLASS);\n navModelSelect.find(ACTIVE_SELECTOR).removeClass(ACTIVE_CLASS).stop(true, true).slideUp(SLIDE_DURATION);\n categoriesContainer.find(ACTIVE_SELECTOR).removeClass(ACTIVE_CLASS);\n document.getElementById(\"predictive-container-large\").style.display = \"none\";\n }\n }",
"function YATAToggleSideBar(left, show) {\n var item = \"YATAIconNav\";\n var side = (left) ? \"-left\" : \"-right\";\n var div = (left) ? \"YATALeftSide\" : \"YATARightSide\";\n \n divBase = item + side;\n if (show) {\n document.getElementById(divBase + \"-on\").style.display = \"none\";\n document.getElementById(divBase + \"-off\").style.display = \"inline-block\"; \n }\n else {\n document.getElementById(divBase + \"-on\").style.display = \"inline-block\"; \n document.getElementById(divBase + \"-off\").style.display = \"none\"; \n }\n var element = document.getElementById(div);\n element.classList.toggle(\"shinyjs-hide\");\n element.classList.toggle(\"shinyjs-show\");\n}",
"handleClick(){\n this.props.sidebar === \"DISPLAY_INFO_SIDEBAR\" ? this.props.hideInfoSidebar() : this.props.displayInfoSidebar();\n }",
"function closeCenterSideBar(){\n notifyScreenreader(\"closed accessibility settings\");\n removeSideBar(\"#centerSidebar\", \"#centerSidebarCollapse\");\n}",
"function mSidebarToggle(state) {\n var w;\n var d = \"inline-block\";\n var l = \"\";\n var icon = \"fa-bars\";\n if (state == \"wide\") {\n w = \"0\";\n setState(\"hidden\");\n } else {\n w = \"200px\";\n setState(\"wide\");\n }\n sidebarAnimate(w, d, l, icon, false);\n }",
"function sidebarNoAnimate(width, icon, hide) {\n sideBar.css(\"width\", width);\n toggleIcon.attr(\"class\", \"fa \" + icon);\n mainContent.css(\"padding-left\", width);\n toggle.css(\"left\", \"0\");\n if (hide) {\n span.css(\"display\", \"none\");\n h1.css(\"display\", \"none\");\n }\n }",
"renderCrosshairVert() {\n const className = this.state.checkboxCheck\n ? `map_crosshairs_vert visible`\n : `map_crosshairs_vert visible hidden`;\n return <div className={className} />;\n }"
] |
[
"0.6633049",
"0.61525327",
"0.5794614",
"0.5732173",
"0.5698377",
"0.5660663",
"0.56453115",
"0.5632748",
"0.5581395",
"0.5539151",
"0.5536879",
"0.5531846",
"0.5501331",
"0.547862",
"0.5447614",
"0.54385215",
"0.54380804",
"0.5434021",
"0.5430503",
"0.5367485",
"0.5366992",
"0.53460044",
"0.53456336",
"0.5345364",
"0.5326591",
"0.53211987",
"0.53037506",
"0.5292615",
"0.529041",
"0.5284797"
] |
0.6570702
|
1
|
Change the test depends on the selection from the dropdown box
|
function test_ChangeOption(scope) {
selected_Test = scope.first_test;
current_test=selected_Test;
scope.sample_disable=true;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function test_dialog_dropdown_ui_values_in_the_dropdown_should_be_visible_in_edit_mode() {}",
"function test_user_should_be_able_to_change_the_order_of_values_of_the_drop_down_list() {}",
"fashionselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Fashion').then(option => {\n cy.wrap(option).contains('Fashion');\n option[0].click();\n \n })\n \n }",
"chooseData() {\n // ******* TODO: PART I *******\n //Changed the selected data when a user selects a different\n // menu item from the drop down.\n\n }",
"chooseData() {\n // ******* TODO: PART I *******\n //Changed the selected data when a user selects a different\n // menu item from the drop down.\n\n }",
"beautyselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Beauty').then(option => {\n cy.wrap(option).contains('Beauty');\n option[0].click();\n\n })\n \n }",
"async selectDropDown(ObjectRepo) {\n //Verifying the drop down text\n await Utility.clickOn(ObjectRepo.Register.typeOfMerchant);\n //Accepting the option\n await Utility.clickOn(ObjectRepo.Register.optionOfMerchant);\n }",
"sportsselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Sports').then(option => {\n cy.wrap(option).contains('Sports');\n option[0].click();\n \n })\n \n }",
"animalpartIIselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Animals Part II').then(option => {\n cy.wrap(option).contains('Animals Part II');\n option[0].click(); \n })\n\n }",
"function test_in_dynamic_dropdown_list_the_default_value_should_not_contain_all_the_value_of_the_list() {}",
"function testOptions(){\n\tif (mvOptions.selectLongueur === \"\" || mvOptions.selectDifficulte === \"\") {\n\n\t\tmvOptions.messageError= \"\";\n\n\t\tif (mvOptions.selectLongueur === \"\") {\n\t\t\t\tmvOptions.messageError += \"Veuillez sélectionner la longueur que vous désirez pour l'exercice \\n\";\n\t\t}\n\t\tif (mvOptions.selectDifficulte === \"\") {\n\t\t\tmvOptions.messageError += \"Veuillez sélectionner la difficulté de l'exercice\";\n\t\t}\n\t}\n\telse {\n\t\tverificationDisponibiliteImage(mvOptions.selectLongueur);\n\t}\n}",
"cookingselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Cooking').then(option => {\n cy.wrap(option).contains('Cooking');\n option[0].click();\n \n })\n \n }",
"function selectionMade()\n{\n\t//Get value currently selected\n\tvar e = document.getElementById(\"selector\");\n\tvar value = e.options[e.selectedIndex].value;\n\n //Enter neccessary function\n\tif(value == \"income\"){ setup(); }\n if(value == \"marijuana\"){ marijuana(); }\n}",
"computerprogselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Computer Programming').then(option => {\n cy.wrap(option).contains('Computer Programming');\n option[0].click();\n \n })\n \n }",
"organiccultureselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Organic Culture').then(option => {\n cy.wrap(option).contains('Organic Culture');\n option[0].click();\n \n })\n \n }",
"misceselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Miscellaneous').then(option => {\n cy.wrap(option).contains('Miscellaneous');\n option[0].click();\n \n })\n \n }",
"televisionselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Television/Movies').then(option => {\n cy.wrap(option).contains('Television/Movies');\n option[0].click();\n \n })\n \n }",
"musicselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Music').then(option => {\n cy.wrap(option).contains('Music');\n option[0].click();\n \n })\n \n }",
"autoshowselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Auto Shows').then(option => {\n cy.wrap(option).contains('Auto Shows');\n option[0].click();\n\n })\n \n }",
"function samplechangeOption(scope) {\n selected_sample =scope.select_sample;\n\tsample_number= parseInt(selected_sample)+5;\n\tfor (var i = 5; i < 15; i++) { \n\t\tvar _beaker_name = \"beaker_\" + i;\n\t\tbeaker_name_container = machine_container.getChildByName(_beaker_name);\n\t\tbeaker_name_container.visible=false;\n\t}\n\tmachine_container.getChildByName(\"beaker_\"+sample_number).visible=true; \n\tif(sample_number>=6){\n\t\tsample_selected_flag=true;\n\t\tenable_disable_beaker(false) \n\t\tscope.test_disable=true;\n\t}\n\telse{\n\t\tsample_selected_flag=false;\n\t\tenable_disable_beaker(true) \n\t\tscope.test_disable=false;\n\t}\n}",
"function testjeu() {\n if (selectionmanu == choix) {\n alert (\"Vous avez fait le même choix que l'ordinateur\");\n } else {\n alert (\"Vous avez fait un choix différent de l'ordinateur\");\n }\n}",
"newmovieselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('New Movie Trailers').then(option => {\n cy.wrap(option).contains('New Movie Trailers');\n option[0].click();\n \n })\n \n }",
"function y_select_change(self) {\n $(self).parent().find(\".attr-options\").fadeOut();\n var type = $(self).find(\":selected\").attr('type');\n if(type == \"gene\"){\n $(self).parent().find('.y-gene-attribute-select option:contains(\"select a specification\")').prop('selected', true);\n $(self).parent().find(\".y-gene-attribute-select\").fadeIn();\n var gene = $(self).find(\":selected\").val();\n } else {\n $(self).parent().find('.y-gene-attribute-select option:contains(\"select a specification\")').prop('selected', true);\n $(self).parent().find(\".y-gene-attribute-select\").fadeOut();\n $(self).parent().find(\"#y-data-type-container\").fadeOut();\n }\n }",
"entertainmentselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Entertainment').then(option =>{\n cy.wrap(option).contains('Entertainment');\n option[0].click();\n })\n}",
"spanishselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Spanish').then(option =>{\n cy.wrap(option).contains('Spanish');\n option[0].click();\n })\n }",
"function mySelectEvent() {\n\n var selected = this.selected();\n if (selected === '1') {\n hStep=1;\n ItterNum=1;\n }\n\n if (selected === '2') {\n hStep=0.1;\n ItterNum=10;\n }\n\n if (selected === '3') {\n hStep=0.01;\n ItterNum=100;\n }\n\n}",
"celebritiesselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Celebrities').then(option => {\n cy.wrap(option).contains('Celebrities');\n option[0].click();\n\n })\n \n }",
"mostviewedselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Most Viewed').then(option => {\n cy.wrap(option).contains('Most Viewed');\n option[0].click();\n \n })\n \n }",
"animalvideosselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Animal Videos').then(option => {\n cy.wrap(option).contains('Animal Videos');\n option[0].click();\n })\n }",
"function chooseUnit(unitId,ketuaUnit, namaUnit){\n \n $('#input-unit').val(namaUnit);\n $('#input-unit').attr(\"unit-id\", unitId);\n $('#input-unit').attr(\"ketua-unit\", ketuaUnit);\n $('#dropdown-selection-unit').hide();\n $('#btn-simpan').removeAttr('disabled'); \n}"
] |
[
"0.67946875",
"0.6755283",
"0.6581949",
"0.65648925",
"0.65648925",
"0.6526555",
"0.6436549",
"0.6434502",
"0.6424533",
"0.6420319",
"0.6415478",
"0.6392609",
"0.63565344",
"0.63557845",
"0.635174",
"0.63439506",
"0.62650853",
"0.6246674",
"0.6242976",
"0.6237628",
"0.62326056",
"0.6212851",
"0.61710423",
"0.61591643",
"0.6144029",
"0.6097629",
"0.60825753",
"0.6063046",
"0.6061107",
"0.60603034"
] |
0.7133847
|
0
|
Change the juice sample on the selection from the dropdown box
|
function samplechangeOption(scope) {
selected_sample =scope.select_sample;
sample_number= parseInt(selected_sample)+5;
for (var i = 5; i < 15; i++) {
var _beaker_name = "beaker_" + i;
beaker_name_container = machine_container.getChildByName(_beaker_name);
beaker_name_container.visible=false;
}
machine_container.getChildByName("beaker_"+sample_number).visible=true;
if(sample_number>=6){
sample_selected_flag=true;
enable_disable_beaker(false)
scope.test_disable=true;
}
else{
sample_selected_flag=false;
enable_disable_beaker(true)
scope.test_disable=false;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function optionChanged() {\n // Obtain selected sample from dropdown\n var selectedSample = Plotly.d3.select('select').property('value'); \n console.log('selectsamle_value : ' , selectedSample)\n // Call plot function with the new sample value\n fillOutTable(selectedSample);\n buildCharts(selectedSample);\n buildGauges(selectedSample);\n}",
"function optionChanged(sample) {\n // Pull metadata and sample, then filter by dropdown selection\n d3.json(\"static/Data/samples.json\").then((data)=> {\n var metadata = data.metadata.filter(meta => meta.id.toString() === sample)[0];\n var samples = data.samples.filter(s => s.id.toString() === sample)[0];\n var wfreq=metadata.wfreq\n // Feed data into display functions\n barplot(samples);\n bubbleplot(samples);\n table(metadata);\n gauge(wfreq);\n });\n}",
"function optionChanged(sample) {\n // The parameter being passed in this function is new sample id from dropdown menu\n\n // Update metadata with newly selected sample USE ON CHANGE\n buildMetadata(sample);\n // Update charts with newly selected sample\n buildCharts(sample);\n}",
"function optionChanged(newSample) {\n\n // Display metadata Fucntion and Change\n metadata(newSample);\n\n // Display otu Function and Change \n otu(newSample);\n guage(newSample);\n}",
"function optionChanged(newSampleID) {\n showDemographicInfo(newSampleID); \n drawBarGraph(newSampleID);\n drawBubbleChart(newSampleID); \n\n console.log(\"Dropdown changed to:\", newSampleID);\n}",
"function optionChanged(newsampleID)\n{\n console.log(\"Dropdown changed to:\", newsampleID);\n \n DrawBarGraph(newsampleID);\n DrawBubbleChart(newsampleID);\n ShowMetaData(newsampleID);\n}",
"function onchange_sample(){\n\tvar fn = \"onchange_sample \";\n\tvar szVal = selectGetSelVal(getElementById2(\"selectSample\"));\n\tjslog (JSLOG_JSU, fn + \"szVal=\" + szVal);\n\tfor (var i=1; i<=SAMPLE_MAX_NUM; i++){\n\t\tvar bShow = (szVal == SAMPLE_ALL || szVal == i+\"\");\n\t\tvar elTr = getElementById2(\"tr_sample_\" + i, false);\n\t\tif (elTr){\n\t\t\tjslog (JSLOG_JSU, fn + \"tr i=\" + i + \" bShow=\" + bShow);\n\t\t\telTr.style.display = (bShow) ? \"\" : \"none\";\n\t\t\telTr.style.visibility = bShow;\n\t\t}\n\t}\n}",
"function chooseStimulus1() {makeChoice(selection=1)}",
"function test_ChangeOption(scope) {\n selected_Test = scope.first_test;\n\tcurrent_test=selected_Test;\n\tscope.sample_disable=true;\n}",
"function mySelectEvent() {\n\n var selected = this.selected();\n if (selected === '1') {\n hStep=1;\n ItterNum=1;\n }\n\n if (selected === '2') {\n hStep=0.1;\n ItterNum=10;\n }\n\n if (selected === '3') {\n hStep=0.01;\n ItterNum=100;\n }\n\n}",
"function optionChanged(sample){\r\n \r\n buildplot(sample);\r\n \r\n \r\n }",
"function optionChanged(sample_id){\n // Prevent the page from refreshing\n d3.event.preventDefault();\n // Select the input value from the dropdown\n var sample_id = d3.select(\"#selDataset\").node().value;\n console.log(sample_id);\n\n // d3.select(\"#selDataset\").node().value = \"\";\n // Call the plot and demo functions with the new sample_id\n buildPlots(sample_id);\n buildDemo(sample_id);\n }",
"function optionChanged(sample) {\n console.log(sample)\n getPlots(sample);\n getInfo(sample);\n}",
"function optionChanged(newSample) {\n // Fetch new data each time a new sample is selected\n console.log(\"MOAR SCIENCE\")\n buildCharts(newSample);\n buildMetadata(newSample);\n}",
"function dropDown(sampleData){\n\tsampleData['names'].forEach(name=>{\n\t\tvar newItem = d3.select('#selDataset').append('option');\n\t\tnewItem.text(name);\n\t\tnewItem.property('value', name)\n\t});\n}",
"function optionChanged (sample) {\ndemographic_panel(sample);\ncreate_charts(sample);\n}",
"function selectvillain(selectedvillain) {\n if (selectedvillain == \"darthvader\") {\n actualvillain = darthvader;\n } else {\n if (selectedvillain == \"bobafett\") {\n actualvillain = bobafett;\n } else {\n if (selectedvillain == \"kyloren\") {\n actualvillain = kyloren\n }\n }\n }\n villainhpbarselect.setAttribute(\"aria-valuenow\", actualvillain.hp);\n villainhpbarselect.innerHTML = actualvillain.hp;\n}",
"function ShowSelected3()\n{\n var MedidaAmbientador = document.getElementById(\"MedidaAmbientador\");\n medida = MedidaAmbientador.options[MedidaAmbientador.selectedIndex].text;\n \n if (medida == \"Un litro\" ){\n \n Precio=3500;\n \n }else if (medida == \"Dos litros\" ){\n Precio=13500;\n }else if (medida== \"Galon\" ){\n Precio=20500;\n }else if (medida == \"Garrafa\" ){\n Precio=50000;\n }else if (medida == \"Medio litro\" ){\n Precio=2500;\n }\n}",
"function optionChanged(newSample) {\n var dropDownMenu = d3.select('#selDataset');\n var subject = dropDownMenu.property('value');\n createBarChart(subject);\n createBubbleChart(subject);\n createDemographics(subject);\n createGaugeChart(subject);\n}",
"function select() {\n\t\tif (chosenCategory === randomWord[0]) {\n\t\t\tcategoryName.innerHTML = \"Category: Generation One\";\n\t\t} else if (chosenCategory === randomWord[1]) {\n\t\t\tcategoryName.innerHTML = \"Category: Generation Two\";\n\t\t}\n\t}",
"function optionChanged(newSampleID)\n\n { \n //Log new selection\n console.log(`User selected ${newSampleID}`) ;\n\n //Run functions to display data\n FillMetaData(newSampleID) ;\n\n DrawBarGraph(newSampleID) ;\n\n DrawBubbleChart(newSampleID) ;\n\n }",
"function optionChanged(newSampleId) {\n // console.log(`User selected ${newSampleId}`);\n\n DrawBargraph(newSampleId);\n DrawBubblechart(newSampleId);\n ShowMetadata(newSampleId);\n}",
"function optionChanged(newSample){\n getData(newSample);\n getDemoData(newSample);\n\n}",
"function optionChanged(id) {\n plot_samples(id);\n get_demographics(id);\n}",
"function ShowSelected9()\n{\n var MedidaJabonRey = document.getElementById(\"MedidaJabonRey\");\n medida = MedidaJabonRey.options[MedidaJabonRey.selectedIndex].text;\n \n if (medida == \"Un litro\" ){\n \n PrecioJabonRey=3500;\n\n }else if (medida == \"Medio litro\" ){\n PrecioJabonRey=2500;\n }\n}",
"function optionChanged (newsample){\n createchart(newsample) \n metadata(newsample)\n}",
"function selectMeat(meat) {\n if($scope.model.selectedBurger.meat) {\n $scope.model.selectedBurger.meat.selected = false;\n }\n $scope.model.selectedBurger.meat = meat;\n $scope.model.selectedBurger.meat.selected = true;\n selectStep('cheese');\n }",
"function optionChanged(newSample){\n //alert(newSample);\n chartBuilder(newSample);\n metadataBuilder(newSample);\n }",
"function optionChanged(samplechoice) {\n\n buildCharts(samplechoice);\n meta(samplechoice);\n\n}",
"function setInitalClimateVariable() {\n $('.climate-variables :selected').val('rh_wt');\n $(\"select\").material_select(); \n }"
] |
[
"0.66189796",
"0.6478805",
"0.6455171",
"0.6378742",
"0.6339185",
"0.62233233",
"0.6163575",
"0.61579686",
"0.6103114",
"0.6088636",
"0.6085081",
"0.60725796",
"0.6068693",
"0.6038692",
"0.6037897",
"0.60126996",
"0.5999956",
"0.5995459",
"0.59934384",
"0.5974364",
"0.59738374",
"0.59675986",
"0.5962457",
"0.596094",
"0.5949927",
"0.5928442",
"0.5928177",
"0.58982366",
"0.58574694",
"0.58161366"
] |
0.6771794
|
0
|
function for aspirate the sample
|
function aspirateSample(scope){
aspirate_flag=true;
if(current_test==0){
machine_stage.getChildByName("test_1").text = beaker_values[current_test_beaker_number-1]+" ppm";
changeFlame(1);
}
else{
machine_stage.getChildByName("test_1").text = beaker_values[current_test_beaker_number-1]+" ppm";
changeFlame(0);
if(current_test_beaker_number == 1){
changeFlame(1);
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"Sample() {}",
"Next() {\r\n return this.InternalSample();\r\n }",
"readSample() {\n return 0;\n }",
"function loopRecordedSample(name) {\n }",
"function displayInitialSample(){\n\t\t//probably call it when starwars is clicked\n\t\tclearInfo();\n\t\t$spanInfo.html(\"<h4><b>Sample piece of data from each class on the API</b></h4>\");\n\t\t// $spanInfo.append(\"<h4 class='label label-info lb-md'>Starships, Vehicles, Species, Films, Planets, People</h4>\");\n\t\t$spanInfo.append(\"<table class='table tableHeaderHome label-default lb-sm'><th>Starships</th><th>Vehicles</th><th>Species</th><th>Films</th><th>Planets</th><th>People</th></table>\");\n\t\t$table.show();\n\t\t//print out the sample 1 per each.\n\t\tgenerateStarships(2);//no values on 1\n\t\tgenerateVehicles(4);//no values on first 3\n\t\tgenerateSpecies(1);\n\t\tgenerateFilms(1);\n\t\tgeneratePlanets(1);\n\t\tgeneratePeople(1);\t\t\t\t\t\t\n\t}",
"function updateSample1() {\n playing = false;\n setUpdatingState();\n player.stop();\n setTimeout(() => {\n generateSample(z => {\n z1 = z;\n generateProgressions(setStoppedState);\n });\n }, 0);\n}",
"function startSample(index, arNum) {\n\nvar source = context.createBufferSource()\nsource.buffer = userPad[index][arNum].activeVoice[0]\n\nsource.connect(bus[index].input)\nsource.start(0)\n\nsource.onended = function(){\n\tsource.stop()\n }\n\n}",
"start_sample(val) {\n this._start_sample = val;\n return this;\n }",
"function sample_size() {\n return 5000\n}",
"get humanoidOversampling() {}",
"initiateSampleRemoval() {\n for ( let i = 0; i < this.dataSamples.length; i++ ) {\n this.dataSamples.get( i ).initiateRemove();\n }\n }",
"start() {\n this.stop();\n return this.sampleData();\n }",
"function sample(first, last, output, n) {\r\n var e_1, _a;\r\n // GENERATE REMAINDERS\r\n var step = global_1.distance(first, last);\r\n var remainders = [];\r\n for (var i = 0; i < step; ++i)\r\n remainders.push(i);\r\n //----\r\n // CONSTRUCT INDEXES\r\n //----\r\n var advances = [];\r\n n = Math.min(n, step);\r\n // PICK SAMPLE INDEXES\r\n for (var i = 0; i < n; ++i) {\r\n var idx = randint(0, remainders.length - 1);\r\n advances.push(remainders.splice(idx, 1)[0]);\r\n }\r\n sorting_1.sort(factory_1.begin(advances), factory_1.end(advances));\r\n // CHANGE INDEXES TO ADVANCES\r\n for (var i = n - 1; i >= 1; --i)\r\n advances[i] -= advances[i - 1];\r\n try {\r\n //----\r\n // FILL SAMPLES\r\n //----\r\n for (var advances_1 = __values(advances), advances_1_1 = advances_1.next(); !advances_1_1.done; advances_1_1 = advances_1.next()) {\r\n var adv = advances_1_1.value;\r\n first = global_1.advance(first, adv);\r\n output.value = first.value;\r\n output = output.next();\r\n }\r\n }\r\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\r\n finally {\r\n try {\r\n if (advances_1_1 && !advances_1_1.done && (_a = advances_1.return)) _a.call(advances_1);\r\n }\r\n finally { if (e_1) throw e_1.error; }\r\n }\r\n return output;\r\n}",
"NextDouble() {\r\n return Sample();\r\n }",
"calcTheoSample() {\r\n\r\n let that = this;\r\n\r\n // number of observations in sample\r\n let N = that.sampleData.length;\r\n\r\n // estimate mu parameter from sample data\r\n let mu = 0;\r\n for (let i = 0; i < N; i++) {\r\n mu += that.sampleData[i];\r\n }\r\n mu /= N;\r\n this.mu = mu;\r\n\r\n // estimate variance from sample data\r\n let v = 0;\r\n for (let i = 0; i < N; i++) {\r\n v += (that.sampleData[i] - mu)**2\r\n }\r\n v /= Math.max(N-1, 1);\r\n this.sigma = v**0.5\r\n\r\n // sample from normal distribtuion with estimated parameters\r\n let theo_sample = new Array(N).fill(0);\r\n for (let i = 0; i < N; i++) {\r\n theo_sample[i] = jStat.normal.sample(this.mu, this.sigma);\r\n }\r\n\r\n // return theoretical sample\r\n return theo_sample;\r\n }",
"function sample() {\n return Math.sqrt(-2 * Math.log(Math.random())) * Math.cos(2 * Math.PI * Math.random());\n}",
"function onchange_sample(){\n\tvar fn = \"onchange_sample \";\n\tvar szVal = selectGetSelVal(getElementById2(\"selectSample\"));\n\tjslog (JSLOG_JSU, fn + \"szVal=\" + szVal);\n\tfor (var i=1; i<=SAMPLE_MAX_NUM; i++){\n\t\tvar bShow = (szVal == SAMPLE_ALL || szVal == i+\"\");\n\t\tvar elTr = getElementById2(\"tr_sample_\" + i, false);\n\t\tif (elTr){\n\t\t\tjslog (JSLOG_JSU, fn + \"tr i=\" + i + \" bShow=\" + bShow);\n\t\t\telTr.style.display = (bShow) ? \"\" : \"none\";\n\t\t\telTr.style.visibility = bShow;\n\t\t}\n\t}\n}",
"function doSample(event) {\n var now = Date.now();\n if (lastSampleTimestamp <= 0){\n lastSampleTimestamp = now;\n return; \n }\n var deltaSec = (now - lastSampleTimestamp)/1000;\n\n\n if (sampleRateSamples > 0){\n //Use the first several samples to calculate the device's sample rate\n if (rawSampleRate == null) {\n rawSampleRate = 1 / deltaSec;\n } else {\n rawSampleRate = (rawSampleRate + (1 / deltaSec))/2; //Hz \n }\n sampleRateSamples--;\n\n } else if (sampleRateSamples == 0){\n //We got all our device sample-rate related readings, \n //now calculate the sample-rate related parameters\n sampleIntervalMS = 1000 / rawSampleRate;\n\n var destSampleRate = 2*options.max_stride_freq;\n samplesToSkip = Math.floor(rawSampleRate / destSampleRate) - 1;\n sampleIntervalMS *= (samplesToSkip+1);\n actualSampleRate = 1000/sampleIntervalMS; //Hz\n amplitudeCheckSamples = Math.ceil(actualSampleRate); //look a second back\n\n //store first sample\n var datum = event.accelerationIncludingGravity[options.axis] || 0.5;\n shift(samples, datum);\n\n sampleRateSamples--;\n\n } else {\n //normal measurments\n if (samplesSkipped < samplesToSkip) {\n samplesSkipped++;\n return;\n }\n samplesSkipped = 0;\n\n var datum = event.accelerationIncludingGravity[options.axis] || 0.5;\n\n if (samples[samples.length-1] != 0){ //TODO\n //integrate to get a velocity sample\n var velocity = vSamples[vSamples.length-1] + (datum - samples[samples.length-1])*sampleIntervalMS/1000;\n shift(vSamples, velocity);\n }\n\n var smoothed = datum;//smooth(samples[samples.length-1], datum, options.smooth_alpha);\n shift(samples, smoothed);\n\n var freq = -1;\n switch (options.algorithm) {\n case 'fft':\n freq = getFreqFft(samples);\n break;\n case 'zero-cross':\n freq = getFreqCross(samples);\n break;\n case 'zero-cross-v':\n freq = getFreqCross(vSamples);\n break;\n }\n\n var spm = Math.round(freq*60);\n if (spm > lastSpm) {\n //rising (usually slower than falling)\n spm = Math.round(smooth(lastSpm, spm, options.smooth_alpha_rising));\n } else {\n //falling (it's possible to stop very quickly)\n spm = Math.round(smooth(lastSpm, spm, options.smooth_alpha_falling));\n }\n lastSpm = spm;\n }\n \n lastSampleTimestamp = now;\n }",
"function idChange(newSample) { \n buildCharts(newSample); \n metaData(newSample);}",
"Sample() {\r\n //Including this division at the end gives us significantly improved\r\n //random number distribution.\r\n return this.InternalSample() * (1.0 / this.MBIG);\r\n }",
"fillWithTestData() {\n let sample = 0.0; // Range from -1 to 1.\n for (let i = 0; i < BUFFER_LENGTH; i++) {\n let delta = 2.0 * Math.random() - 1.0; // Range from 1.0 to -1.0\n // If the sample is already high, skew the delta so it goes lower.\n delta -= sample; // If sample is max, delta will only decrease.\n delta *= 0.09; // Only change a bit during each step.\n sample += delta;\n // Convert from -1 to 1 to 0 to 1\n this.dataBuffer[i] = (sample + 1.0) / 2.0;\n }\n }",
"function copy_sample(id,to){\n\tthis[to].push(this['all_samples'][id]['_id']['$id']);\n\n\tthis.update_header('samples');\n}",
"function playSample(sample){\n\tsample.play();\n}",
"play(numsamples) {\n this.write(numsamples);\n }",
"function firstSampleTrigger() {\n if (game.player.resources.beats.amount >= game.resources.samples.resourcesPer) {\n var context = {\n taskId: \"unlockResourceTask\",\n taskName: \"Create First Sample\",\n resource: \"samples\"\n }\n\n appendToOutputContainer(\"After creating a number of solid beats, you're ready to combine them into a short sample.\");\n addTask(context);\n addTrigger(firstSongTrigger);\n return true;\n }\n}",
"function addExample() {\n\n samplesP.html('samples: '+sample++); //see amount of samples collected. \n\n let inputs = getInputs();\n // Get frequency\n let target = classifierLabel;\n // Add data\n brain.addData(inputs, [target]);\n\n}",
"function generateSamples(data) {\n app.drawChartBlank();\n console.log(\"calling back in generateSamples\");\n //var sampleObj = genSampleData();\n var lastDay = -1;\n //console.log(JSON.stringify(sampleObj));\n var count = 0;\n for (var key in data) {\n if (!data.hasOwnProperty(key)) continue;\n var obj = data[key];\n //console.log(JSON.stringify(obj));\n count++;\n var d = new Date(0); // The 0 there is the key, which sets the date to the epoch\n d.setUTCSeconds(obj.epoch);\n // var newSample = {\n // \"epoch\": lastUtc, // unix timestamp\n // \"steps\": currentSteps,\n // \"hr\": getHR(maxHR),\n // \"hrDev\": getHRDev(maxHRDev),\n // \"batt\": currentBattVolts,\n // \"aux1\": getAux(),\n // \"aux2\": getAux(),\n // \"aux3\": getAux()\n // }\n dataArray.push([d, obj.hr, obj.hrDev, obj.steps, obj.aux1, obj.aux2, obj.aux3])\n\n //console.log(\"sample time: \" + obj.epoch + \" Steps: \" + obj.steps + \" hr: \" + obj.hr + \" hr dev: \" + obj.hrDev + \" batt: \" + (obj.batt * 0.0165).toFixed(3));\n //console.log(d.getDay());\n // if(d.getDay()!==lastDay){\n // lastDay = d.getDay();\n // console.log(\"New Day : \"+d.toString()+\" \"+ getWeekNumber(d));\n // }\n //console.log(count);\n //dataArray.push([d, obj.hr, obj.hrDev])\n }\n app.drawChart(dataArray);\n }",
"function optionChanged (newsample){\n createchart(newsample) \n metadata(newsample)\n}",
"function playRandomSample() {\r\n // 1) clear beatArray\r\n beatArray = [];\r\n // 2) fill beatArray with 5 radnom numbers\r\n for (var i_1 = 0; i_1 < 5; i_1++) {\r\n var randomNum = Math.floor(Math.random() * 9);\r\n // fill beatarray with random number\r\n beatArray.push(randomNum);\r\n }\r\n // 3) play beatsArray\r\n boolPlayStop = true;\r\n checkBeat();\r\n // 4) show stop button\r\n toggleClasses(playButton, stopButton);\r\n}",
"function Sample() {\n\t// sample from the popData\n\tpopCost = d3.shuffle(popCost);\n\toneSample.length =sampSize;\n\n\tfor( ndx = 0; ndx < 16; ndx++){\n\t oneSample[ndx] = {\"x\": 30 + ndx * 50,\n\t\t\t \"y\": 10, \"txt\": ndx};\n\t}\n\n\tfor( ndx = 0; ndx < sampSize -0.1; ndx++ ){\n oneSample[ndx].txt = popCost[ndx] ;\n\t}\n\tif(sampSize < 16){\n for( k = 15; k >= sampSize; k-- ){\n\t\toneSample[k].txt = null ;\n\t }\n\t}\n\t//console.log(oneSample);\n\tSampleBox.transition()\n .style(\"stroke\",\"white\")\n .style(\"fill\",\"white\")\n .remove(); // remove the sample button frame\n\tStext.transition() // move the sample text to the bottom\n\t .attr(\"y\", height * 1.16 )\n\t .attr(\"duration\", 100);\n\n\tsFontSize = (sampSize < 15) ? \"30px\": \"20px\";\n\txStepSize = (sampSize > 8) ? 30: (sampSize > 4)? 50: 100;\n\n sampleText = Bootsvg.selectAll(\"text2\") // create the sample text objects\n \t.remove()\n .data(oneSample)\n .enter().append(\"text\")\n .attr(\"y\", function(d){ return d.y ;})\n .attr(\"x\", function(d){ return d.x ;} )\n .text( function(d) { return d.txt ;})\n .style(\"font-size\",\"2px\")\n\t .style(\"fill\",\"black\");\n sampleText.transition()\n\t\t\t// move sample to bottom\n .delay(function(d, i) { return (i+1) * sampTime; })\n .duration(sampTime)\n .attr(\"y\", height * 1.15)\n .attr(\"x\", function(d,i){ return 120 + i * xStepSize ;} )\n .style(\"font-size\", sFontSize);\n\n popText.transition().delay(sampTime * sampSize).remove(function(d) { d.remove;});\n Ptext.transition().delay(sampTime * sampSize).remove(function(d) { d.remove;});\n\n\n Bootsvg.append(\"text\") // create 1 Resample button\n .attr(\"x\", 4 )\n .attr(\"y\",height * 1.25)\n .attr(\"font-size\", 18 + \"px\")\n .style(\"fill-opacity\", 1.0E-6)\n .text(\"1 Resample\")\n .transition(this)\n .delay( sampTime * sampSize)\n .duration(sampTime)\n .style(\"fill-opacity\", 1);\n\n Rbox = Bootsvg.append(\"rect\") // and it's frame and activation\n .attr(\"class\", \"rect\")\n .attr(\"x\", 0)\n .attr(\"y\", height *1.25 - 20)\n .attr(\"width\", 112)\n .attr(\"height\",30)\n .attr(\"rx\", 4)\n .attr(\"ry\", 4)\n .style(\"stroke\", \"blue\" )\n .style(\"stroke-width\",2 )\n .style(\"fill\",\"lightblue\")\n .style(\"fill-opacity\", 1.0E-6)\n .on(\"click\", reSample1);\n// .transition(this)\n// .delay( sampTime * sampSize)\n// .duration(sampTime)\n// .style(\"fill-opacity\", 0.2)\n// .style(\"stroke\", \"blue\" )\n// .style(\"stroke-width\",2 );\n\n Bootsvg.append(\"text\") // create speed buttons\n .attr(\"x\", 126 )\n .attr(\"y\",height * 1.25 - 12)\n .attr(\"font-size\", \"9px\")\n .style(\"fill-opacity\", 1.0E-6)\n .text(\"Slower\")\n .transition(this)\n .delay( sampTime * sampSize)\n .duration(sampTime)\n .style(\"fill-opacity\", 1);\n\n Bootsvg.append(\"text\") // faster label\n .attr(\"x\", 127 )\n .attr(\"y\",height *1.25 +8)\n .attr(\"font-size\", \"9px\")\n .style(\"fill-opacity\", 1.0E-6)\n .text(\"Faster\")\n .transition(this)\n .delay( sampTime * sampSize)\n .duration(sampTime)\n .style(\"fill-opacity\", 1);\n\n SlowBox = Bootsvg.append(\"rect\") // slower button\n .attr(\"class\", \"rect\")\n .attr(\"x\", 122)\n .attr(\"y\", height * 1.25 - 22)\n .attr(\"width\", 40)\n .attr(\"height\",14)\n .attr(\"rx\", 4)\n .attr(\"ry\", 4)\n .style(\"stroke\", \"white\" )\n .style(\"stroke-width\",1 )\n .style(\"fill\",\"lightblue\")\n .style(\"fill-opacity\", 1.0E-6)\n .on(\"click\", function(){ resampTime = resampTime * 1.5;} )\n .transition(this)\n .delay( sampTime * sampSize)\n .duration(sampTime)\n .style(\"fill-opacity\", 0.1)\n .style(\"stroke\", \"blue\" )\n .style(\"stroke-width\", 1);\n\n FastBox = Bootsvg.append(\"rect\") // faster button\n .attr(\"class\", \"rect\")\n .attr(\"x\", 122)\n .attr(\"y\", height * 1.25 - 2 )\n .attr(\"width\", 40)\n .attr(\"height\",14)\n .attr(\"rx\", 4)\n .attr(\"ry\", 4)\n .style(\"stroke\", \"white\" )\n .style(\"stroke-width\",1 )\n .style(\"fill\",\"lightblue\")\n .style(\"fill-opacity\", 1.0E-6)\n .on(\"click\", function(){ resampTime = resampTime * .67;} )\n .transition(this)\n .delay( sampTime * sampSize)\n .duration(sampTime)\n .style(\"fill-opacity\", 0.1)\n .style(\"stroke\", \"blue\" )\n .style(\"stroke-width\",1 );\n\n Bootsvg.append(\"text\") // Many Resamples\n .attr(\"x\", 0 )\n .attr(\"y\", height * 1.38)\n .attr(\"font-size\", \"18px\")\n .text(\"Many Resamples: \")\n .style(\"fill-opacity\", 1.0E-6)\n .transition(this)\n .delay( sampSize * sampTime )\n .duration(sampTime)\n .style(\"fill-opacity\", 1);\n\n // TODO: should be able to build all resample buttons at once,\n // but not sure how to do it with text and rectangle.\n //\t\t Here's a data build as a start. Does display, but only the last box is active.\n\n var resampButtonData = [\n \t{x: 200, wd: 40, txt: \"100\", n: 100, clr: \"red\"},\n \t{x: 250, wd: 40, txt: \"500\", n: 500, clr: \"orange\"},\n \t{x: 300, wd: 48, txt: \"1000\", n: 1000, clr: \"green\"},\n \t{x: 360, wd: 48, txt: \"5000\", n: 5000, clr: \"blue\"},\n \t{x: 430, wd: 54, txt: \"10,000\", n: 10000, clr: \"purple\"}\n ]\n\n\n var manyTexts = Bootsvg.selectAll(\"text4\")\n .data(resampButtonData)\n .enter()\n .append(\"text\")\n .attr(\"x\", function(d){ return d.x;} )\n .attr(\"y\", height * 1.38)\n .attr(\"font-size\", \"16px\")\n .text(function(d){return d.txt;})\n .style(\"fill-opacity\", 1.0E-6)\n .transition(this)\n .delay( sampTime * sampSize)\n .duration(sampTime)\n .style(\"fill-opacity\", 1)\n ;\n var manyBoxes = Bootsvg.selectAll(\"rect\")\n .data(resampButtonData)\n .enter()\n .append(\"rect\")\n .attr(\"x\", function(d){ return d.x -5 ;} )\n .attr(\"y\", height * 1.38 -20)\n .attr(\"width\", function(d){ return d.wd;} )\n .attr(\"height\",30)\n .style(\"fill\",function(d){return(d.clr);})\n .style(\"fill-opacity\", 1.0E-6)\n .on(\"click\", function(d){\n \t\t\t\treSampleMany(d.n);})\n .transition(this)\n .delay( sampTime * sampSize)\n .duration(sampTime)\n .style(\"fill-opacity\", 0.2)\n ;\n\n // Bootsvg.append(\"text\") // create Resample 100 button\n // .attr(\"x\", 200 )\n // .attr(\"y\", height * 1.44 )\n // .attr(\"font-size\", \"16px\")\n // .text(\" 100 \")\n // .style(\"fill-opacity\", 1.0E-6)\n // .transition(this)\n // .delay( sampTime * sampSize)\n // .duration(sampTime)\n // .style(\"fill-opacity\", 1);\n\n // var overlayC = Bootsvg.append(\"rect\") // 100 frame and activation\n // .attr(\"class\", \"rect\")\n // .attr(\"x\", 195)\n // .attr(\"y\", height * 1.38 -20)\n // .attr(\"width\", 40)\n // .attr(\"height\",30)\n // .style(\"fill\",\"red\")\n // .style(\"fill-opacity\", 1.0E-6)\n // .on(\"click\", function(){\n\t//\t\t\t\tBootCount = 100;\n\t//\t\t\t\treSampleMany(BootCount);})\n // .transition(this)\n // .delay( sampTime * sampSize)\n // .duration(sampTime)\n // .style(\"fill-opacity\", 0.2);\n\n Bootsvg.append(\"text\") // create Resample 500 button\n .attr(\"x\", 250 )\n .attr(\"y\", height * 1.38)\n .attr(\"font-size\", \"16px\")\n .text(\" 500 \")\n .style(\"fill-opacity\", 1.0E-6)\n .transition(this)\n .delay( sampTime * sampSize)\n .duration(sampTime)\n .style(\"fill-opacity\", 1);\n\n var overlayD = Bootsvg.append(\"rect\") // 500 frame and activation\n .attr(\"class\", \"rect\")\n .attr(\"x\", 245)\n .attr(\"y\", height * 1.38 -20)\n .attr(\"width\", 40)\n .attr(\"height\",30)\n .style(\"fill\",\"orange\")\n .style(\"fill-opacity\", 1.0E-6)\n .on(\"click\", function(){\n\t\t BootCount = 500;\n \t reSampleMany(BootCount);})\n .transition(this)\n .delay( sampTime * sampSize)\n .duration(sampTime)\n .style(\"fill-opacity\", 0.4);\n\n Bootsvg.append(\"text\") // create Resample 1000 button\n .attr(\"x\", 300 )\n .attr(\"y\", height * 1.38)\n .attr(\"font-size\", \"16px\" )\n .text(\" 1000 \")\n .style(\"fill-opacity\", 1.0E-6)\n .transition(this)\n .delay( sampTime * sampSize)\n .duration(sampTime)\n .style(\"fill-opacity\", 1);\n\n var overlayM = Bootsvg.append(\"rect\") // 1000 frame and activation\n .attr(\"class\", \"rect\")\n .attr(\"x\", 295 )\n .attr(\"y\", height * 1.38 -20)\n .attr(\"width\", 48)\n .attr(\"height\",30)\n .style(\"fill\",\"green\")\n .style(\"fill-opacity\", 1.0E-6)\n .on(\"click\", function(){\n\t BootCount = 1000;\n reSampleMany(BootCount);})\n .transition(this)\n .delay( sampTime * sampSize)\n .duration(sampTime)\n .style(\"fill-opacity\", 0.15);\n\n Bootsvg.append(\"text\") // create Resample 5000 button\n .attr(\"x\", 360 )\n .attr(\"y\", height * 1.38)\n .attr(\"font-size\", \"14px\")\n .text(\" 5000 \")\n .style(\"fill-opacity\", 1.0E-6)\n .transition(this)\n .delay( sampTime * sampSize)\n .duration(sampTime)\n .style(\"fill-opacity\", 1);\n\n // var overlayDX = Bootsvg.append(\"rect\") // 5000 frame and activation\n // .attr(\"class\", \"rect\")\n // .attr(\"x\", 355)\n // .attr(\"y\", height * 1.38 -20)\n // .attr(\"width\", 48)\n// .attr(\"height\",30)\n// .style(\"fill\",\"blue\")\n// .style(\"fill-opacity\", 1.0E-6)\n // .on(\"click\", function(){\n//\t \t\tBootCount = 5000;\n//\t \t\treSampleMany(BootCount);})\n// .transition(this)\n// .delay( sampTime * sampSize)\n// .duration(sampTime)\n// .style(\"fill-opacity\", 0.15);\n\n// Bootsvg.append(\"text\") // create Resample 10000 button\n// .attr(\"x\", 430 )\n// .attr(\"y\", height * 1.38)\n// .attr(\"font-size\", \"14px\")\n// .text(\" 10,000 \")\n// .style(\"fill-opacity\", 1.0E-6)\n// .transition(this)\n// .delay( sampTime * sampSize)\n// .duration(sampTime)\n// .style(\"fill-opacity\", 1);\n\n// var overlayMX = Bootsvg.append(\"rect\") // 10000 frame and activation\n// .attr(\"class\", \"rect\")\n// .attr(\"x\", 425)\n// .attr(\"y\", height * 1.38 -20)\n// .attr(\"width\", 54)\n// .attr(\"height\",30)\n// .style(\"fill\",\"purple\")\n// .style(\"fill-opacity\", 1.0E-6)\n// .on(\"click\", function(){\n//\t BootCount = 10000;\n// reSampleMany(BootCount);})\n// .transition(this)\n// .style(\"fill-opacity\", 0.1)\n// .delay( sampTime * sampSize)\n// .duration(sampTime)\n// .style(\"fill-opacity\", 0.2);\n }"
] |
[
"0.640226",
"0.63033336",
"0.6285483",
"0.6206293",
"0.6042451",
"0.59828913",
"0.5927889",
"0.5922859",
"0.5878001",
"0.58676636",
"0.5837722",
"0.5830816",
"0.581275",
"0.5781232",
"0.5768793",
"0.5758464",
"0.5747044",
"0.57237124",
"0.5721485",
"0.5719678",
"0.5716194",
"0.57059467",
"0.5702057",
"0.5694556",
"0.5689933",
"0.56834155",
"0.5682411",
"0.567226",
"0.5663351",
"0.5648064"
] |
0.67916924
|
0
|
Function for changing the flames inside the machine
|
function changeFlame(flame){
if(flame==1){
machine_container.getChildByName("normal_flame").visible = true;
machine_container.getChildByName("second_flame").visible = false;
}
else{
machine_container.getChildByName("normal_flame").visible = false;
machine_container.getChildByName("second_flame").visible = true;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function lightMode() {\n change(\n \"rgb(255 255 255 / 50%)\",\n \"rgb(0 0 0 / 50%)\",\n \"Light Mode\",\n \"fa-moon\",\n \"fa-sun\",\n \"img/undraw_proud_coder_light.svg\",\n \"img/undraw_feeling_proud_light.svg\",\n \"img/undraw_conceptual_idea_light.svg\"\n );\n \n}",
"function flakesFalling()\r\n{\r\n\t/*\r\n\t\tMake sure the user has the functionality enabled.\r\n\t*/\r\n\t\r\n\tif(arFlakes.length < 1)\r\n\t{\r\n\t\treturn;\r\n\t}\r\n\t\r\n\tswitch(oUser.user_UseFlakes)\r\n\t{\r\n\t\tcase \"1\":\r\n\t\t\tarFlakeRange.low = 30000;\r\n\t\t\tarFlakeRange.high = 45000;\r\n\t\t\tbreak;\r\n\t\tcase \"2\":\r\n\t\t\tarFlakeRange.low = 6000;\r\n\t\t\tarFlakeRange.high = 12000;\r\n\t\t\tbreak;\r\n\t\tcase \"3\":\r\n\t\t\tarFlakeRange.low = 1000;\r\n\t\t\tarFlakeRange.high = 8000;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tHideFlakes();\r\n\t\t\treturn;\t\r\n\t}\r\n\r\n\tfor(i = 0; i < maxFlakes; i++)\r\n\t{\r\n\t\taFlake = arFlakes[i];\r\n\r\n\t\tif(!aFlake)\r\n\t\t{\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tif(aFlake.visible == true)\r\n\t\t{\r\n\t\t\tif(aFlake.yp < 75)\r\n\t\t\t{\r\n\t\t\t\taFlake.yp += aFlake.sty;\r\n\t\t\t\taFlake.dx += aFlake.stx;\r\n\t\t\t\tdocument.getElementById(\"dot\" + aFlake.id).style.top = aFlake.yp + \"px\";\r\n\t\t\t\tdocument.getElementById(\"dot\" + aFlake.id).style.left= aFlake.xp + aFlake.am * Math.sin(aFlake.dx)+\"px\"; \r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t/*\r\n\t\t\t\t\tHide the flake for an arbitrary time after it has\r\n\t\t\t\t\tsat at the bottom of the page\r\n\t\t\t\t*/\r\n\t\t\t\taFlake.counter--;\r\n\t\t\t\tif(aFlake.counter == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tel = document.getElementById(\"dot\" + aFlake.id);\r\n\t\t\t\t\tel.style.visibility = \"hidden\";\r\n\t\t\t\t\taFlake.visible = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t/*\r\n\t\t\t\tWhat this code does is make it so sometimes the flakes\r\n\t\t\t\tare thicker and other times there's fewer of them.\r\n\t\t\t*/\r\n\t\t\tarFlakeRange.counter--;\r\n\t\t\tif(arFlakeRange.counter == 0)\r\n\t\t\t{\r\n\t\t\t\tarFlakeRange.counter = Math.round(Math.random() * (arFlakeRange.high - arFlakeRange.low)) + arFlakeRange.low;\r\n\t\t\t}\r\n\r\n\t\t\trandVal = Math.round(Math.random() * arFlakeRange.counter);\r\n\t\t\t\r\n\t\t\tif(randVal < 2)\r\n\t\t\t{\r\n\t\t\t\tarFlakeRange.counter = Math.round(Math.random() * (arFlakeRange.high - arFlakeRange.low)) + arFlakeRange.low;\t\t\t\t\r\n\t\t\t\tdoc_width = document.body.clientWidth;\r\n\t\t\t\taFlake.dx = 0;\t\t\t\t\t\t\t\t//\tset coordinate variables\r\n\t\t\t\taFlake.xp = Math.random()*(doc_width - 80); \t// set position variables\r\n\t\t\t\taFlake.yp = 0;\t\t\t\t\t\t\t\t//\tStart them all at the top of the page\r\n\t\t\t\taFlake.am = Math.random()*20; \t\t// set amplitude variables\r\n\t\t\t\taFlake.stx = 0.02 + Math.random()/10; \t\t// set step variables\r\n\t\t\t\taFlake.sty = 0.2 + Math.random(); \t\t// set step variables\r\n\t\t\t\taFlake.counter = Math.round(Math.random() * 900) + 150;\r\n\t\t\t\taFlake.visible = true;\r\n\t\r\n\t\t\t\tel = document.getElementById(\"dot\" + aFlake.id);\r\n\t\t\t\tel.style.top = aFlake.yp + \"px\";\r\n\t\t\t\tel.style.left = aFlake.xp + \"px\";\r\n\t\t\t\tel.style.visibility = \"visible\";\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tclearTimeout(snowTimer);\r\n\tsnowTimer = setTimeout(\"flakesFalling()\", 25);\r\n}",
"function P_changePoo()\r\n{\r\n if(health>=30)\r\n {\r\n imgPooPoo = preload.getResult(\"smile\");\r\n }\r\n else\r\n {\r\n imgPooPoo = preload.getResult(\"cry\");\r\n }\r\n\r\n}",
"function flamingSlime(event) {\t\t\t\t\t\t\t//Let's set the \"Slime\" on fire!\r\n\r\n //var entityHit = event.getEntityHit();\t\t\t\t//First, use the getEntityHit() method from projectileHitHook to figure out WHAT was hit...\r\n //var entityHit = event.getEntityType();\t\t\t\t//First, use the getEntityHit() method from projectileHitHook to figure out WHAT was hit...\r\n var entityHit = event.getEntity();\r\n //var projectile = event.getProjectile();\t\t\t\t//...then, use the getProjectile() method from projectileHitHook to figure out WHICH projectile was used...\r\n //var projectile = event.getLastDamageCause().getCause();\r\n var projectile = event.getDamager().getType();\r\n //var thrower = projectile.getThrower();\t\t\t\t//...and finally, use the getThrower() method from projectile to figure out WHO threw the projectile.\r\n echo(projectile);\r\n echo(entityHit); \r\n if (!(projectile == cmSnowBall)){\t\t\t//If the throwable IS NOT a snowball: \"there is nothing to see here, move along.\"\r\n return;\r\n }\r\n //echo('hello');\r\n if (entityHit instanceof cmSlime1){\t\t\t\t//Now, suppose the throwable was a snowball. Did it hit \"Slime\"?\t\t\r\n var slimeSize = entityHit.getSize();\t\t//If so, get the size of the \"Slime\" entity.\r\n var entityWhere = entityHit.getLocation();\t//Also, we get the location of the \"Slime\", to decide where the explosion sound will originate;\r\n entityHit.setFireTicks(100);\t\t\t\t//we then set the \"Slime\" on fire...\r\n // sounds.explode(entityWhere);\t\t\t\t//...and use the sounds plugin to provide the \"explode\" sound effect with origin at the \"Slime\"'s position.\r\n sounds.entityGenericExplode(entityWhere);\r\n function vanquishSlime(){\t\t\t\t\t//Not satisfied with simply setting \"Slime\" on fire, my 9 year-old advisor suggested vanquishing them.\r\n if (!(slimeSize == 'BIG')){\t\t\t\t//So... if the \"Slime\" is BIG, you will need to keep on hitting with snowballs until it breaks apart;\t\t\t\r\n //entityHit.destroy();\t\t\t\t//if the \"Slime\" size < BIG, then the \"Slime\" will be destroyed... \r\n entityHit.setHealth(0);\r\n destroyCount = destroyCount + 1;\t//The counter in then updated ***TO DO: build a decent counter using scoreboard!\r\n //echo(thrower, destroyCount);\t\t//and displays how many \"Slime\" entities were slayed.\r\n }\t\t\r\n }\t\t\r\n setTimeout(vanquishSlime, 2000);\t\t\t//Without a delay, you do not see the flaming \"Slime\"... so we get 2 seconds of fire.\r\n }\r\n}",
"function LaunchFlames()\n{\n timer = 0.1f;\n}",
"function flashAll(){\n\t\tredFlash();\n\t\tyellowFlash();\n\t\tblueFlash();\n\t\tgreenFlash();\n\t}",
"function changePicture() {\n materialPic.diffuse = Textures.get(lPic[next]);\n next = (next+1)%nPic;\n}",
"function fakeLight(){\n pntLight = false;\n}",
"function changeIMG(v){\n\tif(v == '2')\n\t\tnomeImagem = \"../../terra.png\";\n\tif(v == '1')\t\n\t\tnomeImagem = \"../../terrain.png\";\n\tif(v == '3')\n\t\tnomeImagem = \"../../perlin_heightmap.png\";\n\tinitTexture();\n}",
"function flash() {\n for (var i = 0; i < 81; i++) {\n let red = (Math.floor(Math.random() * 256)).toString();\n let green = (Math.floor(Math.random() * 256)).toString();\n let blue = (Math.floor(Math.random() * 256)).toString();\n body.children[i].style.backgroundColor = \"rgb(\" + red + \", \" + green + \", \" + blue + \")\"\n }\n}",
"resetFlicker () {\r\n this.flicker_speed = 4\r\n this.flicker_delay = 1.5\r\n this.flicker_delta = 0\r\n this.flicker_phase = 0\r\n this.flicker_count = 0\r\n this.flicker_max = 25\r\n }",
"function updateFlake(flake) {\n\n //Make the overall direction of the flakes drift over time\n let windDirection = Math.floor(sin(tick/200) * 5);\n flake.staticY -= windDirection;\n\n //Move the flake along and make it travel in a horizontal wave\n flake.x -= flake.speed;\n flake.y = flake.staticY + sin((flake.x + flake.waveOffset)/flake.waveFrequency) * flake.waveHeight;\n if (flake.x < 1) {\n flake.x = width;\n flake.staticY = rand(0, height);\n }\n}",
"function changeColorScheme() {\n\n}",
"function MakeshiftFlashAnimation() {\n if (me.state.isCurrent(me.state.FLASH_ANIMATION)) {\n me.state.change(me.state.PLAY);\n } else {\n me.state.change(me.state.FLASH_ANIMATION);\n }\n}",
"function update_whack_life(life) {\n if (life === 2) {\n document.getElementById(\"life\").src = \"../static/imgs/2_lives.png\";\n } else if (life === 1) {\n document.getElementById(\"life\").src = \"../static/imgs/1_lives.png\";\n } else {\n document.getElementById(\"life\").src = \"../static/imgs/0_lives.png\";\n }\n}",
"function realLight(){\n pntLight = true;\n}",
"fade( o ) {\n\t\tfor( let i = 0; i < 10; i++ ) {\n\t\t\tif( o ) {\n\t\t\t\tgame.fopac = 1;\n\t\t\t}\n\t\t\tgame.setCB( () => {\n\t\t\t\tif( o ) {\n\t\t\t\t\tgame.fopac = Number( ( ( 9 - i ) / 9 ).toFixed( 1 ) );\n\t\t\t\t} else {\n\t\t\t\t\tgame.fopac = Number( ( i / 9 ).toFixed( 1 ) );\n\t\t\t\t}\n\t\t\t}, 8 );\n\t\t}\n\t}",
"function plugF(machine){\n\tmachine.plug.x += 11.5;\n\tmachine.health += 5;\n\tif(machine.plug.x > game.width - 72){\n\t\tmachine.plug.x = game.width - 72;\n\t}\n\tsound1.play();\n}",
"function changeMediumFn(scope) {\n\t/** Set all background image light alpha as 0 */\n\tfor ( var i=1; i<5; i++ ) {\n\t\tgetChild(\"side_view_bg\"+i, side_view_container).alpha = 0;\n\t}\n\tswitch(scope.medium){\n\t \t/** Selected medium is Air */\n\t\tcase \"1\": \n\t\t\tgetChild(\"side_view_bg1\", side_view_container).alpha = 1;\n\t\t\tbreak;\n\t\t/** Selected medium is Helium */\n\t\tcase \"1.000034\": \n\t\t\tgetChild(\"side_view_bg2\", side_view_container).alpha = 1;\n\t\t \tbreak;\n\t\t/** Selected medium is Hydrogen */ \n\t\tcase \"1.000138\": \n\t\t\tgetChild(\"side_view_bg3\", side_view_container).alpha = 1;\n\t\t \tbreak;\n\t\t/** Selected medium is Carbon Dioxide */\n\t\tcase \"1.000449\": \n\t\t\tgetChild(\"side_view_bg4\", side_view_container).alpha = 1;\n\t\t \tbreak;\t\n\t} \n\tcalculateBrewstersAngle(scope); /** Brewsters angle and current calculated in this function */\n\tbrewsters_stage.update();\n}",
"function resetHearts() {\n let source = \"images/liveHeart.png\";\n for (let life of lives) {\n life.src = source;\n }\n}",
"function popo(play, laze){\n \t laze.kill();\n \t timer.start();\n \t flashing = true;\n \t flash();\n \t //add red and blue sprites\n }",
"function changeImageUmbrellaBack() {\n document.images['white-duck-umbrella'].src ='./assets/images/white-duck-umbrella.png'\n }",
"function changeSword() {\n if (sword==0) {\n $('#swords').css({filter:'grayscale(0%)'});\n sword++;\n }\n else if (sword==1) {\n $('#swords').attr('src', 'images/item sprites/Green Sword.png');\n sword++;\n }\n else if (sword==2) {\n $('#swords').attr('src', 'images/item sprites/Red Sword.png');\n sword++;\n }\n else if(sword==3) {\n $('#swords').attr('src', 'images/item sprites/Blue Sword.png');\n sword++;\n }\n else if (sword==4) {\n $('#swords').attr('src', 'images/item sprites/Four Sword.png');\n sword++;\n }\n else {\n $('#swords').attr('src', \"images/item sprites/Smith's Sword.png\");\n $('#swords').css({filter:'grayscale(100%)'});\n sword=0;\n }\n}",
"static turnOn(pix){\r\n\t\tpix.on = true;\r\n\t}",
"makeColor( color ){\n if( color == White ){\n // console.log('white')\n // this.sprite.play(\"White\");\n this.fond.setTint( Black );\n this.sprite.setTint( White );\n this.sprite3.setTint( White );\n \n }\n else if( color == Black ){\n // console.log('black')\n // this.sprite.play(\"Black\");\n this.fond.setTint( White );\n this.sprite.setTint( Black );\n this.sprite3.setTint( White );\n \n }\n }",
"function changeImageMonocleBack() {\n document.images['white-duck-monocle'].src ='./assets/images/white-duck-monocle.png'\n }",
"function changeFlavor(color)\r\n{\r\n console.log(color);\r\n}",
"function flashlight(){\n\tif(!blocks.length) return;\n\tif(flashlighton){\n\t\tgrab(\"prevb\").style.display = grab(\"nextb\").style.display = \"none\";\n\t\tdraw();\n\t\treturn;\n\t}\n\tsortsch(schedules[cursched]); draw();\n\tgrab(\"prevb\").style.display = grab(\"nextb\").style.display = \"initial\";\n\tfor (var i=0; i<blocks.length; i++) blocks[i].style.opacity = 0.1;\n\tcuropq=0;\n\tblocks[0].style.opacity = 0.9;\n\tflashlighton=1;\n}",
"function switchFromFaint(newPoke) {\n document.getElementById('buttonsBattle').style['display'] = 'none';\n currentPlayerPokemon = newPoke;\n currentPlayerPokemonCry = new Audio(currentPlayerPokemon.cry);\n currentPlayerPokemonCry.play();\n playerPokemonImg.src = currentPlayerPokemon.plrSprite;\n playerPokemon.style['display'] = 'block';\n playerHpBar.style['display'] = 'block';\n rollText(\"battle_text\", `Go, ${currentPlayerPokemon.name}!`, 25);\n updateHealth(currentPlayerPokemon);\n setTimeout(function () { menu() }, 2000);\n}",
"function twoLives() {\n getId('hearts1').src= \"images/heartfull.png\";\n getId('hearts2').src= \"images/heartfull.png\";\n getId('hearts3').src= \"images/heartempty.png\"; \n}"
] |
[
"0.6119707",
"0.589232",
"0.5880041",
"0.584753",
"0.58289",
"0.58140135",
"0.5796855",
"0.5793538",
"0.5757344",
"0.5730048",
"0.5710642",
"0.5705972",
"0.5695456",
"0.5693474",
"0.5683954",
"0.5680432",
"0.56637627",
"0.5646314",
"0.56396985",
"0.56367624",
"0.56318754",
"0.56302327",
"0.5630168",
"0.5627751",
"0.5605482",
"0.5603384",
"0.5590672",
"0.55689454",
"0.5566058",
"0.5565923"
] |
0.66716665
|
0
|
form submit delete empty file table
|
function delEmptyFileTable() {
var arrDelNum = new Array();
var tmpSort = 0;
$("[name=attanames]").each(function(i){
var attanamesId = $(this).attr("id");
var delNum = attanamesId.replace('attaname','');
var delFileInfo = '';
if(document.getElementsByName('attafiles') !=null && document.getElementsByName('attafiles')[i] != null)
delFileInfo = document.getElementsByName('attafiles')[i].value;
var delFileInfoPath = '';
if(document.getElementsByName('savePath') != null && document.getElementsByName('savePath')[i] != null)
delFileInfoPath = document.getElementsByName('savePath')[i].value;
if(delFileInfo== null || delFileInfo == '') {
if(delFileInfoPath== null || delFileInfoPath == '') {
arrDelNum[tmpSort] = parseInt(delNum);
tmpSort++;
}
}
});
for(var i= 0;i<arrDelNum.length;i++) {
deleteRow(arrDelNum[i]);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"fileDeleted(){\n let form = this\n let file = ''\n $('#fileupload').bind('fileuploaddestroy', function (e, data) {\n // remove inputs named 'selected_files[]' that will interfere with the back end\n $(\"input[name='selected_files[]']\").remove();\n $(\"input[name='sf_ids']\").each(function(){\n $('div.fields-div').find(`input[name^='${$(this).val()}']`).remove();\n });\n //then remove yourself?\n // $(\"input[name='sf_ids']\").remove();\n });\n $('#fileupload').bind('fileuploaddestroyed', function (e, data) {\n // if student deletes uploaded primary file, we need to remove this param because the backend uses it to know when a browse-everything file is primary\n $('#be_primary_pcdm').remove();\n form.validatePDF()\n });\n\n $('#supplemental_fileupload').bind('fileuploaddestroy', function (e, data) {\n file = $(data.context).find('p.name span').text();\n });\n\n $('#supplemental_fileupload').bind('fileuploaddestroyed', function (e, data) {\n $('#supplemental_files_metadata tr').each(function(){\n if ($(this).find('td').first().text() === file) {\n $(this).remove();\n }\n });\n form.validateSupplementalFiles()\n })\n }",
"function deletePerviousSubmit() {\r\n var table = document.getElementById(\"dataTable\");\r\n while (table.rows.length > 0) {\r\n table.deleteRow(0);\r\n }\r\n }",
"function submitFileDeleteForm() {\r\n\r\n\tdocument.forms[\"CustomUiFileDeleteForm\"].elements[\"action\"].value = \"deleteImages\";\r\n\tdocument.forms[\"CustomUiFileDeleteForm\"].submit();\r\n}",
"function emptyUpload() {\n th.empty()\n th.get(0).value = ''\n }",
"function removefile(txt) {\r\n //remove the file from the post value\r\n var files = document.getElementById('FilesSelected');\r\n var tokens = files.value.split(\"#\");\r\n var newfiles = \"\";\r\n for (var i=0; i < tokens.length-1; i++) {\r\n if (tokens[i] == txt)\r\n continue;\r\n newfiles += tokens[i] + \"#\";\r\n }\r\n\r\n files.setAttribute('value', newfiles);\r\n\r\n // delete the row containing the txt from the table\r\n var filetable = document.getElementById('myfilelist');\r\n\r\n var loop = 0;\r\n for (loop = 0; loop < filetable.rows.length; loop++) {\r\n var row = filetable.rows[loop];\r\n var cell = row.cells[0];\r\n if (row.id == txt + 'id') {\r\n filetable.deleteRow(loop);\r\n loop--;\r\n break;\r\n }\r\n }\r\n\r\n colorTable('myfilebody');\r\n\r\n //Remove the entry from the table in the HTML\r\n\r\n var tbl = document.getElementById('myfilebody');\r\n if (tbl.rows.length == 0){\r\n tbl.insertRow(0);\r\n tbl.rows[0].setAttribute('id', \"nofile\");\r\n var cellLeft = tbl.rows[0].insertCell(0);\r\n cellLeft.innerHTML = \"No files have been added to the code review.\";\r\n tbl.rows[0].appendChild(cellLeft);\r\n cellLeft = tbl.rows[0].insertCell(1);\r\n cellLeft.innerHTML =\"\";\r\n tbl.rows[0].appendChild(cellLeft);\r\n cellLeft = tbl.rows[0].insertCell(2);\r\n cellLeft.innerHTML =\"\";\r\n tbl.rows[0].appendChild(cellLeft);\r\n cellLeft = tbl.rows[0].insertCell(3);\r\n cellLeft.innerHTML =\"\";\r\n tbl.rows[0].appendChild(cellLeft);\r\n }\r\n}",
"function doMultiDeleteFile()\n\t{\n\t\tif(confirm(\"Do you want to delete attached file for this Timesheets?\"))\n\t\t{\n\t\t\tvar form=form=document.sheet;\n\t\t\tvar val=Number(form.rowcou.value);\n\t\t\t\n\t\t\tgetMultiTimeDataFile(val);\n\t\t\tform.action=\"edittimemulti.php\";\n\t\t\tform.acctype.value=\"filedelete\";\n\t\t\tform.submit();\n\t\t}\n\t}",
"function submitUpload() {\n el(\"divRecordNotFound\").style.display = \"none\";\n if (el(\"hdnFileName\").value != '') {\n var tablename = getQStr(\"tablename\");\n if (tablename.toUpperCase() == \"TARIFF\" || tablename.toUpperCase() == \"TARIFF_CODE_DETAIL\") {\n showConfirmMessage(\"Do you really want to upload this File? This will Delete all the existing data from Database and Insert Data from the File.\",\n \"mfs().yesClickTariff();\", \"\", \"\");\n }\n else {\n hideDiv(\"btnSubmit\");\n showLayer(\"Loading..\");\n setTimeout(insertUploadTable, 0);\n }\n }\n else {\n showErrorMessage('Please Upload a file');\n el(\"divifgGrid\").style.display = \"none\";\n el(\"divlnk\").style.display = \"none\";\n }\n}",
"function uploadComplete(file_id){\n var content = \"<tr class='file' name='\" + fileName + \"'lookup='\" +\n file_id + \"'><td><i class='icon-file'></i>\" +\n fileName + \"</td><td><button class='btn delete'>\"\n + \"<i class='icon-remove'></i>delete</button></td></tr>\";\n $(\"#folder_view\").append(content);\n $(\"#upload_file\").empty();\n}",
"function deleteUpload(recordid){\n $('#succMsgContainer').hide();\n $('#id').val(recordid);\n $('#aws-delete-file-modal').modal('show');\n}",
"function borradoElemento () {\n\t/*\n\tinit_listener_file_upload();\n\t$(\".combo_tipo_doc\").val(\"\");\n\tfileUploadPreview ();\n\t\n\t\n\t\tcloseFancy();\n\t\n\t*/\n}",
"function deleteFile(record) {\n $('.deletedFile').each(function() {\n $.post('sop/delete-file.php?edoc='+$(this).val()+'&record='+record, function(data) {\n if (data.status != \"success\") {\n // failure\n alert(\"The file was not able to be deleted. \"+JSON.stringify(data));\n }\n });\n\n });\n}",
"function deleteOutput(id, dir) {\n if (confirm('Are you sure you want to submit?')) {\n var rid = $('[name=rid]').val();\n var fd = new FormData();\n fd.append('delete', dir);\n\n $('#' + rid).find('.' + id).remove();\n\n submit(fd, '/delete');\n }\n}",
"function deleteFile(file, elem) {\n var order = 'filename=' + file;\n\n // POST request\n $.post(\"delete.php\", order, function(response, status, xhr) {\n if (status == \"success\") {\n console.log(response);\n }\n else if (status == \"error\") {\n alert('File could not be deleted.'); \n }\n });\n\n // Remove file row\n $(elem).closest(\"tr\").remove();\n}",
"function clearUploadFile() {\n file = null;\n $(\"#btn-upload\").prop(\"disabled\",true);\n $(\"#file-upload\").empty();\n $(\"#file-name\").empty();\n $(\"#file-size\").empty();\n $(\"#file-type\").empty();\n $(\"#upload-status\").html(\" Upload Status: NO FILE SELECTED \");\n $(\"#upload-data #pagination ul\").empty();\n var listData = $(\"#upload-data table thead\");\n listData.find(\"tr\").empty();\n var scope = listData.scope();\n scope.dataListUpl = [];\n scope.$apply();\n }",
"function deleteThisFile () {\n // only hide the file\n $thisFile.hide();\n // trigger a file deletion operations\n self.emit('_deleteFile', $thisFile.find(ps).text(), function(err) {\n // show back the file on error or remove on success\n if (err) {\n $thisFile.fadeIn();\n } else {\n $thisFile.remove();\n }\n });\n }",
"function deletePhoto(td) {\n\n // remove <td> element from table row\n var row = document.getElementById(\"more-photos\");\n\n for (var i = 0; i < row.children.length; i++) {\n if (row.children[i] === td) { row.deleteCell(i); }\n }\n\n // remove photo from resizedImages array\n var selectedPhoto = td.children[0].id;\n\n for (var j = 0; j < resizedImages.length; j++ ) {\n if (resizedImages[j].filename === selectedPhoto) { delete resizedImages[j]; }\n }\n\n // filter undefined element from array if photo element deleted\n resizedImages = resizedImages.filter(function(k) { return k != undefined }); \n\n // hide Upload button and remove message if last photo element deleted\n if ($(\"#photo_table tr td\").length === 0) {\n\n uploadBtnClasses.add('btnHide');\n document.getElementById('hide_upload_status').style.display = \"none\";\n }\n}",
"function removeFile(name)\r\n{\r\n\t$('#' + name).parent().remove();\r\n\t\r\n\t// Disable the upload button if no files are selected\r\n\tif ($('.file-item').length < 1) {\r\n\t\t$('#submit-button').attr('disabled', 'disabled');\r\n\t}\r\n}",
"function eventDeleteAll(e){\n\t\te.preventDefault();\n\t\tlet filas = document.querySelectorAll(\".btn-delete\");\n\t\tfor (let i = 0; i < filas.length-1; i++) {\n\t\t\tdel(filas[i], false);\n\t\t}\n\t\tdel(filas[filas.length-1], true);\t//suponiendo que los del() no se ejecutan antes por asincronismo\n\t\t/*get();*/\n\t}",
"function delete_all(){\n\n $('#file_div').on(\"click\", \"#delete\", function(){\n // get data from form fields\n var supplier_name = $(\"#supplier option:selected\").text();\n var supplierid = $(\"#supplier\").val();\n\n // console.log(supplier_name);\n // console.log(supplierid);\n // console.log(pricelist_filename);\n // importExcelPricelist(true,supplier_name, supplierid, pricelist_filename, $(this));\n var type = \"delete\";\n var title = \"Are you want to delete?\";\n var message = supplier_name + \"'s pricelist files.\";\n\n confirmAction(type, title, message, null, supplier_name, supplierid, null, null, null, $(this));\n // we return false to prevent page reloading\n return false;\n });\n\n}",
"function fileDelete($href){\n $.post(\"/souche/\"+($(\"#ref\")[0].innerHTML)+\"/suppr/file\", // send HTTP POST request to a page and get the answer\n {\n _token: $('input[name=_token]').val(), // send data\n href:$href\n },\n function(data, status){ //retreive response\n console.log(\"Data: \" + data + \"\\nStatus: \" + status);\n if(status === \"success\"){\n //alerteInfo(data[0].alert, status, data);\n window.location.reload()\n //TODO : décommenter\n }\n else{\n window.location.reload()\n alerteInfo('info', status, data);\n }\n });\n}",
"function delete_file (file_name, reload_flag, media_id)\n{\n var params = {};\n params ['file'] = file_name;\n if (media_id !== undefined)\n params ['media_id'] = media_id; \n $.ajax ({url: '/admin/index/remove',type: 'POST', data: params,\n complete : function (response, status) {if (reload_flag === true) {$.fancybox.close ();reload_list ();}} \n }); \n}",
"function delete_all() {\n\n $(document).on('click', '.del_all', function() {\n $('#form_data').submit();\n });\n \n\n $(document).on('click', '.delBtn', function() {\n var item_checked = $('input[class=\"item_checkbox\"]:checkbox').filter(':checked').length;\n if ( item_checked > 0 ) {\n\n $('.notEmptyRecord').removeClass('hidden') ;\n $('.record_count').text(item_checked);\n $('.emptyRecord').addClass('hidden') ;\n } else {\n $('.emptyRecord').removeClass('hidden') ;\n $('.notEmptyRecord').addClass('hidden') ;\n }\n $('#multipleDelete').modal('show');\n //alert('done');\n });\n}",
"function dataResolutionDeleteUpload() {\r\n\t// If any hidden input doc_id's already exist, they must be deleted, so keep them but mark them for deletion\r\n\t$('#drw_upload_file_container input.drw_upload_doc_id').attr('delete','yes');\r\n\t// Show \"add new document\" link\r\n\t$('#drw_upload_new_container').show();\r\n\t// Hide \"remove document\" link\r\n\t$('#drw_upload_remove_doc').hide();\r\n\t// Hide doc_name link\r\n\t$('#dc-upload_doc_id-label').html('').hide();\r\n}",
"function deleteImage(key){\n\tformid = 'form'+key;\n\tmpdeleteid = 'mpdelete'+key;\n\tdocument.getElementById(mpdeleteid).value = '1';\n\tdocument.getElementById(formid).submit();\n}",
"function delpic(filename)\n{\n\tvar radioid\t= filename.replace('|@SEP@|', '');\n\tvar radiolength\t= $('input[name=rdo_main_pic]').length;\n\tvar selectedIndex\t= $('input[name=rdo_main_pic]:checked').index('input[name=rdo_main_pic]') ;\n\t\n\tif(radiolength > 1)\n\t{\n\t\tif(selectedIndex==0)\n\t\t{\n\t\t\tselectedIndex\t=\t1;\n\t\t}\n\t\telse\n\t\t\tselectedIndex\t= selectedIndex-1;\n\t}\n\t\n\tvar status\t= $('#status');\n\tvar btnuplad = $('#btn_upload');\n\tvar delAJAXurl = base_url +'newsfeed/delete_tmp_image_AJAX/'+ filename.replace('|@SEP@|', '/') + '/extraparam/';\n\t\n\t$.get(delAJAXurl, function(msg){\n\t\t\t\t\t\t\t \n\t\tif(msg === 'ok')\n\t\t{\n\t\t\t//selectedIndex\t= selectedIndex-1;\n\t\t\tif(selectedIndex!= -1)\n\t\t\t{\n\t\t\t\t$('input[name=rdo_main_pic]:eq('+selectedIndex+')').attr('checked', 'checked');\n\t\t\t}\n\t\t\t\n\t\t\t$(\"#div\"+filename.replace('|@SEP@|','')).remove();\t\n\t\t\t$(\"#hid_\"+filename.replace('|@SEP@|','')).remove();\n\t\t\t\n\t\t\t//search_for_other();\n\t\t\t\n\t\t\tstatus.html('<div class=\"ok_msg\">Image deleted successfully ...</div>');\n\t\t\tbtnuplad.show();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tstatus.attr('class', 'ok');\n\t\t\tstatus.html('<div class=\"err_msg\">Image cannot be deleted!</div>');\n\t\t}\n\t});\n}",
"function fn_eliminarArchivo(id) {\n var eliminar = $(\"#total-documentos\").data(\"eliminarfile\") + id + \",\";\n $(\"#total-documentos\").data(\"eliminarfile\", eliminar);\n var cantidad = $(\"#total-documentos\").data(\"cantidad\") - 1;\n $(\"#total-documentos\").data(\"cantidad\", cantidad);\n $(\"#total-documentos\").html($(\"#total-documentos\").data(\"cantidad\") + storedFiles.length);\n $(\"#eliminar-\" + id).remove();\n}",
"function deletePhotos() {\n $('#photoTable :checkbox:checked').parent().parent().remove();\n deleteButton.attr('disabled', true);\n }",
"_controlUploadFile(event) {\n let file = event.target.files[0];\n let fileName = file.name;\n let fileType = fileName.split(\".\")[fileName.split(\".\").length - 1];\n\n if(this.options.tableRender) {\n let table = this._componentRoot.querySelector('[data-component=\"table-custom\"]');\n\n if(table) {\n this._inputData = [];\n table.parentNode.removeChild(table);\n }\n\n this.options.tableRender = false;\n }\n\n let chooseFields = this._componentRoot.querySelector(\"#chooseFields\");\n\n if (chooseFields) {\n chooseFields.parentNode.removeChild(chooseFields);\n }\n\n if(fileType !== 'csv') {\n\n noty({\n text: 'Файл ' + fileName + ' некорректный, выберите корректный файл, формата csv.',\n type: 'error',\n timeout: 3000\n });\n\n return;\n\n } else {\n\n noty({\n text: 'Был выбран файл ' + fileName + '.',\n type: 'success',\n timeout: 3000\n });\n }\n\n this._parseCSV(event, file);\n }",
"deleteForm (event) {\n\n\n // Delete link\n\n let deleteLink = event.currentTarget;\n\n\n // Fetch elt child and retrive the form related\n\n let childs = deleteLink.childNodes;\n\n let form;\n\n childs.forEach(function(e) {\n\n if(e.tagName === \"FORM\")\n\n form = e;\n\n });\n\n\n\n // Submit form\n\n if ( confirm('Confirmer la suppression ?') )\n\n form.submit();\n\n\n }",
"function filesDivPageAction(){\n if ($('#fileActionSelect').val() == 'MCUImg') {\n if (gFileBrowser) {\n gFileBrowser.uploadMCUImage(project.header.DeviceType == 'CC3220FS');\n }\n } else if ($('#fileActionSelect').val() == 'Remove') {\n gFileBrowser.removeSelected();\n }\n \n return;\n\t//action is delete\n\tif ($('#fileActionSelect').val()=='Remove')\n\t{\n\t\tvar toDelete=$('#fileSysDiplayPageDiv .fsLine>.fs1>i.fa-check-square-o');\n\t\tfor (var i=0;i<toDelete.length;i++){\n\t\t\tvar folderarray=toDelete[i].id.replace(\"//FileSelect\", \"\").replace(/---/g, ' ').split(\"//\").reverse();\n\t\t\t//get the first element\n\t\t\tvar elementToDelete=folderarray.pop();\n\t\t\tif(folderarray.length===0){ //is root\n\t\t\t\tif (project.userFiles )\n\t\t\t\t{\n\t\t\t\t\tfor(var j=0;j<project.userFiles.length;j++){\n\t\t\t\t\t\tif(project.userFiles[j].id==elementToDelete){\n\t\t\t\t\t\t\tif(project.userFiles[j].type==\"file\"){ //if it a file\n\t\t\t\t\t\t\t\t//remove the items\n\t\t\t\t\t\t\t\tproject.userFiles.splice(j,1);\n\t\t\t\t\t\t\t\tvar objectToSend={\n\t\t\t\t\t\t\t\t\t'name':projectName,\n\t\t\t\t\t\t\t\t\t'source':\"/\"+elementToDelete\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t//delete from API\n\t\t\t\t\t\t\t\t$.post(\"/api/1/flash/deleteProjectFsFile\", \n\t\t\t\t\t\t\t\t\tobjectToSend,\n\t\t\t\t\t\t\t\t\tfunction(data,status){\n\t\t\t\t\t\t\t\t\t\tif(status=='success' && data.ok){\n\t\t\t\t\t\t\t\t\t\t\t//save project\n\t\t\t\t\t\t\t\t\t\t\tsaveProjectAPI();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse if(data.err){\n\t\t\t\t\t\t\t\t\t\t\talert(\"Error deleteing the file\"+data.err);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse{ //is a folder delete for Project only\n\t\t\t\t\t\t\t\t//remove the items\n\t\t\t\t\t\t\t\tproject.userFiles.splice(j,1);\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tvar folderPath=findFolder(folderarray,project.userFiles);\n\t\t\t\t//now go to all object until find and delete;\n\t\t\t\tif( folderPath && folderPath.object){\n\t\t\t\t\tfor(var j=0;j<folderPath.object.length;j++){\n\t\t\t\t\t\tif(folderPath.object[j].id==elementToDelete){\n\t\t\t\t\t\t\tif(folderPath.object[j].type==\"file\"){ //if it a file\n\t\t\t\t\t\t\t\t//remove the items\n\t\t\t\t\t\t\t\tfolderPath.object.splice(j,1);\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tvar objectToSend={\n\t\t\t\t\t\t\t\t\t'name':projectName,\n\t\t\t\t\t\t\t\t\t'source':\"/\"+folderarray.join(\"/\")+\"/\"+elementToDelete\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t//delete from API\n\t\t\t\t\t\t\t\t$.post(\"/api/1/flash/deleteProjectFsFile\", \n\t\t\t\t\t\t\t\t\tobjectToSend,\n\t\t\t\t\t\t\t\t\tfunction(data,status){\n\t\t\t\t\t\t\t\t\t\tif(status=='success' && data.ok){\n\t\t\t\t\t\t\t\t\t\t\t//save project\n\t\t\t\t\t\t\t\t\t\t\tsaveProjectAPI();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse if(data.err){\n\t\t\t\t\t\t\t\t\t\t\talert(\"Error delete the file\"+data.err);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t//remove the items\n\t\t\t\t\t\t\t\tfolderPath.object.splice(j,1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//erase elements on display\n\t\t$('#fileSysDiplayPageDiv').html(\"\");\n\t\t//redo menus and files\n\t\tbuild_files(project.userFiles,'#fileSysDiplayPageDiv','','');\n \n saveProjectAPI();\n\t}\n\telse if($('#fileActionSelect').val()=='NewFolder'){\n\t\tvar toAction=$('#fileSysDiplayPageDiv .fsLine>.fs1>i.fa-check-square-o');\n\t\tif(toAction.length===0){\n\t\t\tfolderCreate(toAction);\n\t\t\t\n\t\t\t\n\t\t}\n\t\telse{\n\t\t\t//check if there is a file selected\n\t\t\tfor (var i=0;i<toAction.length;i++){\n\t\t\t\tvar type=$(toAction[i]).attr(\"data-type\");\n\t\t\t\tif(type!=\"folder\"){\n\t\t\t\t\t\talert (\"Can't create a folder in a a file\")\n\t\t\t\t\t\treturn;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\tfolderCreate(toAction);\n\t\t}\n\t}\n\telse if($('#fileActionSelect').val()=='Upload'){\n\t\tvar toAction=$('#fileSysDiplayPageDiv .fsLine>.fs1>i.fa-check-square-o');\n\t\tif(toAction.length>1){\n\t\t\talert (\"Please select only one folder!\");\n\t\t\treturn;\n\n\t\t}\n\t\telse{\n\t\t\t//check if there is a file selected\n\t\t\tfor (var i=0;i<toAction.length;i++){\n\t\t\t\tvar type=$(toAction[i]).attr(\"data-type\");\n\t\t\t\tif(type!=\"folder\"){\n\t\t\t\t\talert (\"File can not be uploaded into a file!\");\n\t\t\t\t\treturn;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t//if here display the browser\n $('#fileElement').click();\n\t}\n\telse if($('#fileActionSelect').val()=='Rename'){\n\t\tvar toAction=$('#fileSysDiplayPageDiv .fsLine>.fs1>i.fa-check-square-o');\n\t\tif(toAction.length>1){\n\t\t\talert (\"Please select only one folder!\");\n\t\t\treturn;\n\n\t\t}\n\t\telse{\n\t\t\t//check if there is a file selected\n\t\t\tfor (var i=0;i<toAction.length;i++){\n\t\t\t\tvar type=$(toAction[i]).attr(\"data-type\");\n\t\t\t\tif(type!=\"folder\"){\n\t\t\t\t\talert (\"File can not be uploaded into a file!\");\n\t\t\t\t\treturn;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t//rename\n\t\tvar toAction=$('#fileSysDiplayPageDiv .fsLine>.fs1>i.fa-check-square-o');\n\t\tif(toAction.length>0)\n\t\t{\n\t\t\tfoldername=$(toAction[0]).attr(\"id\").replace('//FileSelect','').replace(/---/g, ' ');\n\t\t\t//rename\n\t\t\tfolderRename(foldername);\n\t\t}\n\t\t\n\t}\n else if($('#fileActionSelect').val()=='MCUImg'){ //Select MCU Img\n $('#MCUImg').val(\"\");\n $('#MCUImg').click();\n //displayFileProperties('/sys/mcuimg.bin');\n }\n\telse if($('#fileActionSelect').val()=='Properties'){ //files properties\n\t\tvar toAction=$('#fileSysDiplayPageDiv .fsLine>.fs1>i.fa-check-square-o');\n\t\tif(toAction.length>1 ){\n\t\t\talert (\"Please select only one file!\");\n\t\t\treturn;\n\n\t\t}\n\t\telse if(toAction.length===0){\n\t\t\talert (\"Please select a file!\");\n\t\t\treturn;\t\n\t\t}\n\t\telse{\n\t\t\t//check if there is a file selected\n\t\t\tfor (var i=0;i<toAction.length;i++){\n\t\t\t\tvar type=$(toAction[i]).attr(\"data-type\");\n\t\t\t\tif(type==\"folder\"){\n\t\t\t\t\talert (\"Please select files only!\");\n\t\t\t\t\treturn;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tdisplayFileProperties($(toAction[0]).attr(\"id\").replace(\"//FileSelect\",\"\").split(\"//\").reverse().join(\"/\"));\n\t\t\n\t}\n}"
] |
[
"0.7204416",
"0.6918951",
"0.6832437",
"0.6826155",
"0.67882264",
"0.67180246",
"0.6670666",
"0.66552645",
"0.6595723",
"0.6572796",
"0.6497151",
"0.64416236",
"0.6421615",
"0.63921726",
"0.638505",
"0.6349582",
"0.63241607",
"0.6256853",
"0.62384754",
"0.6091419",
"0.6085645",
"0.6056951",
"0.60472596",
"0.6039109",
"0.6028296",
"0.6016555",
"0.6002385",
"0.5986312",
"0.59771085",
"0.59735435"
] |
0.7063793
|
1
|
avoiding old IEbug Calculates whether log level passes the given treshold
|
function _passingTreshold(logLevels, logTreshold, logLevel) {
var tresholdValue = _.isNumber(logTreshold) ? logTreshold : logLevels[logTreshold]
, logValue = logLevels[logLevel];
// when 'console' log requested, allow for any treshold greater than 0
return ('console' === logLevel) ? (logTreshold > 0) : logValue >= tresholdValue;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"static toLog(param) {\n const restrictionNum = this.LOG_LEVELS[this.logLevel];\n const requiredNum = this.LOG_LEVELS[param];\n return requiredNum > restrictionNum;\n }",
"function is_level( level ) {\n return log_level > 0\n ? log_level > level\n : log_methods.length + log_level <= level;\n }",
"function shouldLog(level) {\n return _logLevel >= level;\n}",
"function is_level(level) {\n return log_level > 0 ? log_level > level : log_methods.length + log_level <= level;\n }",
"function levelThreshhold(level) {\n return Math.pow(level, 2) * 100;\n}",
"severity_enabled(sev) {\n if (!this._assert_sev(sev)) { return false; }\n let val = this._sev_value(sev);\n if (Util.DebugLevel == Util.LEVEL_TRACE) return true;\n if (Util.DebugLevel == Util.LEVEL_DEBUG) {\n return val >= LoggerUtility.SEVERITIES.DEBUG;\n }\n if (Util.DebugLevel == Util.LEVEL_OFF) {\n return val >= LoggerUtility.SEVERITIES.INFO;\n }\n return val >= LoggerUtility.SEVERITIES.WARN;\n }",
"function logLevel() {\n var match = /[?&]log=([a-z]+)/.exec(window.location.search);\n return match ? match[1] : \"\";\n }",
"function _() {\n return b.logLevel;\n}",
"function N() {\n return S.logLevel;\n}",
"function passesWarning(){\n return (billsTotal() >= warningLevelSet);\n }",
"shouldLog(logLevel) {\n return (!!this._logger &&\n logLevel !== exports.HttpPipelineLogLevel.OFF &&\n logLevel <= this._logger.minimumLogLevel);\n }",
"shouldLog(logLevel) {\n return (!!this._logger &&\n logLevel !== exports.HttpPipelineLogLevel.OFF &&\n logLevel <= this._logger.minimumLogLevel);\n }",
"function getLogLevel(){if(logClient.logLevel===LogLevel.DEBUG){return LogLevel$1.DEBUG;}else if(logClient.logLevel===LogLevel.SILENT){return LogLevel$1.SILENT;}else{return LogLevel$1.ERROR;}}",
"static isMoreOrEqualSevere(a, b) {\n return ConsoleLogger.severity[a] >= ConsoleLogger.severity[b];\n }",
"function _checkLevel(){\n var currentTime = new Date().getTime();\n if (currentTime - levelTime > consts.LEVEL_INTERVAL){\n level += 1;\n interval = calcIntervalByLevel(level);\n views.setLevel(level);\n levelTime = currentTime;\n }\n}",
"function checkThreshold() {\n\n\t\tupTime = null;\n\t\tdownTime = null;\n\n\t\t// don't work out linear yet\n\t\tif ( (vOld < threshold) && (v >= threshold) ) {\n\t\t\tupTime = true;\n\t\t}\n\t\telse if ( (vOld > threshold) && (v <= threshold) ) {\n\t\t\tdownTime = true;\n\t\t}\n\n\t}",
"function T() {\n return E.logLevel;\n}",
"function T() {\n return E.logLevel;\n}",
"function logLevelSeverity(level) {\n switch (level) {\n case LogLevel.DEBUG:\n return 20;\n case LogLevel.INFO:\n return 40;\n case LogLevel.WARN:\n return 60;\n case LogLevel.ERROR:\n return 80;\n default:\n return (0, helpers_1.assertNever)(level);\n }\n}",
"shouldLog(logLevel) {\n return this._options.shouldLog(logLevel);\n }",
"shouldLog(logLevel) {\n return this._options.shouldLog(logLevel);\n }",
"function isBelowThreshold(currentValue) {\r\n return currentValue < 40;\r\n }",
"function checkLogs(){\n\n}",
"function getLevel(l) {\n return LEVELS[l] || 7; // Default to debug\n}",
"function severityLevel(num, severity_type) {\n if (isNaN(num)) return 'NA';\n if (num == 0) return 'Level 0';\n if (num <= severity_type[1]) return 'Level 1';\n if (num <= severity_type[2]) return 'Level 2';\n if (num <= severity_type[3]) return 'Level 3';\n if (num <= severity_type[4]) return 'Level 4';\n return 'Level 5';\n}",
"function checkLevel(){\r\n let r = Math.floor(lines / 10) + 1\r\n if(r > level) {\r\n level = r\r\n }\r\n adjustDropSpeed()\r\n}",
"function checkExperience(experience, level) {\n const y = (BASE*level) * (Math.pow(Math.E, level));\n return experience >= y ? ++level : level;\n}",
"function showLevel (level) {\n switch (level) {\n case 'info':\n return true\n case 'error':\n return false\n default:\n return true\n }\n}",
"function validateLevel(logLevel) {\n return config.logLevelRange.indexOf(logLevel);\n }",
"function _closeToThreshold(abserr, relerr, expected) {\n return Math.max(abserr, relerr * Math.abs(expected));\n }"
] |
[
"0.7078592",
"0.6772465",
"0.67403865",
"0.6683781",
"0.6357224",
"0.6217686",
"0.61500543",
"0.60483897",
"0.59366786",
"0.59135354",
"0.5868117",
"0.5868117",
"0.58139783",
"0.5813451",
"0.5775238",
"0.57187974",
"0.5695288",
"0.5695288",
"0.5657519",
"0.5653344",
"0.5653344",
"0.5645822",
"0.5595264",
"0.55424243",
"0.5511358",
"0.5510357",
"0.5509938",
"0.549997",
"0.54957205",
"0.5457895"
] |
0.78095204
|
0
|
Takes a buffer of bytes and splits it into chunks, each of which starts with a MSG_TOKEN_START An array of these chunks is returned
|
splitBuffer( buf ) {
let chunks = [];
// discard any bytes at the front before the START
let position = buf.indexOf( MSG_TOKEN_START );
if( position > 0 ) {
// Clear the bytes before the start
buf = buf.slice( position );
}
else if( position < 0 ) {
// no START at all... invalid message
return [];
}
// we know buf[0] is a start, so look for another START
let index = 1;
while( (position = buf.indexOf( MSG_TOKEN_START, index )) > -1) {
// If there are no bytes between START bytes, don't put an empty element in the array
// This shouldn't happen based on the protocol design anyway
if( index === position ) {
chunks.push( Buffer.from([]));
}
else {
chunks.push( buf.slice( index-1, position ) );
}
// continue searching at the next byte
index = position + 1;
}
if( index <= buf.length ) {
//console.log('index:', index, 'left: ', buf.slice( index-1 ) );
chunks.push( buf.slice( index-1 ));
}
return chunks;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function getChunk(i, message){\n\tvar m = [];\n\tfor(let j = 0; j < 16; ++j){\n\t\tm[j] = message[(i * 64) + (j * 4) + 0] << 0 |\n\t\t message[(i * 64) + (j * 4) + 1] << 8 |\n\t\t message[(i * 64) + (j * 4) + 2] << 16 |\n\t\t message[(i * 64) + (j * 4) + 3] << 24;\n\t}\n\treturn m;\n}",
"function split(buf, by) {\n const bufs = [];\n let len = buf.length;\n let i = 0;\n\n while (len) {\n if (buf[i] == by) {\n if (i > 0) {\n bufs.push(buf.slice(0, i));\n buf = buf.slice(i + 1);\n }\n\n i = -1; /* reset to 0 for next tick */\n }\n\n ++i;\n --len;\n }\n\n if (i) {\n bufs.push(buf);\n }\n\n return bufs;\n}",
"function splitMessage(message) {\n const messageBlocks = [Buffer.from(message.IV, 'base64')];\n\n const textBuffer = Buffer.from(message.ciphertext, 'base64');\n for(let i = 0; i < textBuffer.length / BLOCK_SIZE; i++) {\n messageBlocks.push(textBuffer.slice(i * BLOCK_SIZE, (i + 1) * BLOCK_SIZE));\n }\n\n return messageBlocks;\n}",
"function read_chunks(socket, buffer) {\n\tvar str = buffer.toString('utf8');\n\tvar type = str.substr(0, 3);\n\tvar pid = socket.remoteAddress + ':' + socket.private_ip;\n\tconsole.log(\"TCP > \" + pid + \" \" + str);\n\n\tif (type === \"reg\"){\n\t\tadd_player(socket.remoteAddress + \":\" + str.substr(3), socket);\n\t}\n\telse if (type === \"nam\"){\n\t\tset_player_name(pid, str.substr(3));\n\t\tsend_str(\"hey\", socket);\n\t} else if (type === \"con\"){\n\n\t}\n}",
"function splitBuffer(buffer, messageNumber, chunkSize) {\r\n \r\n var bufferSize = buffer.byteLength;\r\n //calculate the size of the data (doesn't include extra space in buffer)\r\n \r\n var sizeArray = new Int32Array(buffer, 0, 6*4);\r\n var dataSize = sizeArray[0]; \r\n\r\n console.log(\"dataSize:\", dataSize);\r\n \r\n var maxChunkSize = 1024*16;\r\n if (Number.isFinite(chunkSize)) {maxChunkSize = chunkSize;} //allow specification of a different chunk size. \r\n \r\n var additionalSize = (Math.ceil(dataSize / maxChunkSize) + 4 * 4) * 4; \r\n \r\n //var additionalSize = bufferSize - dataSize;\r\n //var movedDataArray = new Int32Array(buffer, dataSize, additionalSize); //this is where the data overwritten by the header is placed.\r\n //var dataArray = new Int32Array(buffer, 0, dataSize); //this is the original data\r\n var bufferArray = new Int8Array(buffer);\r\n var int32Array = new Int32Array(buffer);\r\n \r\n //var movedDataArrayOffset = dataSize; //this is where we start placing copied data so it won't get permanently overwritten by headers\r\n \r\n var chunkCount = Math.ceil((dataSize + additionalSize) / maxChunkSize);\r\n \r\n for (var i=0; i<chunkCount; i++) {\r\n var dataSource = new Uint8Array(buffer,i*maxChunkSize,4*4);\r\n var movedDataArrayOffset = dataSize + i * 4*4;\r\n bufferArray.set(dataSource, movedDataArrayOffset);\r\n //movedDataArrayOffset += 4*4;\r\n \r\n //after the data is moved then add a header to this chunk\r\n var header = new Uint32Array(buffer, i*maxChunkSize, 4);\r\n header[0] = messageNumber;\r\n header[1] = dataSize;\r\n header[2] = maxChunkSize;\r\n header[3] = i;\r\n }\r\n\r\n return(chunkCount);\r\n}",
"function convert(message){\n var arr = []\n var x = 0;\n var y;\n var i;\n for (i = 0; i < 160; i++) { \n y = x+2\n arr.push(message.slice(x,y))\n x += 4;\n }\n var data = Buffer.concat(arr);\n return data\n}",
"getChunks(content, env) {\n // Parse the whole markdown document and get tokens\n const tokens = this.markdownIt.parse(content, env);\n const chunks = [];\n\n let start = 0;\n let stop = 0;\n\n for (let i = 0; i < tokens.length; i++) {\n // TODO: invert condition to get rid of the 'continue' statement\n if (\n // We are starting tokens walk or in a chunk\n i < start ||\n !(\n // We are (NOT) closing a nested block\n (0 === tokens[i].level && -1 === tokens[i].nesting) ||\n // We are (NOT) in a root block\n (0 === tokens[i].level && 0 === tokens[i].nesting)\n )\n ) {\n continue; // eslint-disable-line no-continue\n }\n\n stop = i + 1;\n chunks.push(tokens.slice(start, stop));\n start = stop;\n }\n\n return chunks;\n }",
"function readTokenToBuffer() {\n\t\t\t// init local variables\n\t\t\tvar startPos, matchPos, matchStr, match, length;\n\n\t\t\tfor (;;) if (tokenRegExp.lastIndex !== inputLength) {\n\t\t\t\tstartPos = tokenRegExp.lastIndex;\n\t\t\t\tif (match = tokenRegExp.exec(inputString)) {\n\t\t\t\t\tmatchStr = match[0], matchPos = match.index;\n\n\t\t\t\t\t// check if we have T_ERR token\n\t\t\t\t\tif (length = matchPos - startPos) {\n\t\t\t\t\t\ttokenBuffer.push({\n\t\t\t\t\t\t\ttype: T_ERR,\n\t\t\t\t\t\t\tpos: startPos,\n\t\t\t\t\t\t\tvalue: inputString.substr(startPos, length)\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tlength = match.length;\n\n\t\t\t\t\t// find matched group index\n\t\t\t\t\twhile (match[length--] === undefined);\n\n\t\t\t\t\t// obtain token info\n\t\t\t\t\tmatch = tokenIds[length];\n\t\t\t\t\t// match next token in case if this one is ignored\n\t\t\t\t\tif (match === IGNORE_START) continue;\n\t\t\t\t\t// return matched token\n\t\t\t\t\treturn tokenBuffer.push({\n\t\t\t\t\t\ttype: match,\n\t\t\t\t\t\tpos: matchPos,\n\t\t\t\t\t\tvalue: matchStr\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// return T_ERR token in case if we couldn't match anything\n\t\t\t\telse return (\n\t\t\t\t\ttokenRegExp.lastIndex = inputLength,\n\t\t\t\t\ttokenBuffer.push({\n\t\t\t\t\t\ttype: T_ERR,\n\t\t\t\t\t\tpos: startPos,\n\t\t\t\t\t\tvalue: inputString.slice(startPos)\n\t\t\t\t\t})\n\t\t\t\t);\n\n\t\t\t}\n\t\t\t// return T_EOF if we reached end of file\n\t\t\telse return tokenBuffer.push({\n\t\t\t\ttype: T_EOF,\n\t\t\t\tpos: inputLength\n\t\t\t});\n\t\t}",
"function customBufferSplitCRLF(buf) {\n var ret = [];\n var effLen = buf.length - 1, start = 0;\n for (var i = 0; i < effLen;) {\n if (buf[i] === 13 && buf[i + 1] === 10) {\n // do include the CRLF in the entry if this is not the first one.\n if (ret.length) {\n i += 2;\n ret.push(buf.slice(start, i));\n }\n else {\n ret.push(buf.slice(start, i));\n i += 2;\n }\n start = i;\n }\n else {\n i++;\n }\n }\n if (!ret.length)\n ret.push(buf);\n else if (start < buf.length)\n ret.push(buf.slice(start, buf.length));\n return ret;\n}",
"function FFString_cutByteStringToArray(msg, maxlength) {\n\tvar str;\n\tvar len=0;\n\tvar temp;\n\tvar count;\n\tvar srTemp = new String(msg);\n\tvar arTemp = Array();\n\n\tlen = srTemp.length;\n\n\tfor(var i=0;srTemp.length>0;i++){\n\t\tcount = 0;\n\t\tfor(k=0 ; k<len ; k++) {\n\t\t\tstr = srTemp;\n\t\t\ttemp = srTemp.charAt(k);\n\t\t\t\n\t\t\tif(escape(temp).length > 4) {\n\t\t\t\tcount += 2;\n\t\t\t}\n\t\t\telse if (temp == '\\r' && srTemp.charAt(k+1) == '\\n') { //in case \\r\\n\n\t\t\t\tcount += 2;\n\t\t\t}\t\t\n\t\t\telse if(temp != '\\n') {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif(count > maxlength) {\n\t\t\t\tstr = srTemp.substring(0,k);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tarTemp[i] = new Array();\n\t\tarTemp[i] = str;\n\t\tsrTemp = srTemp.substring(k);\n\t}\n\treturn arTemp;\n}",
"function chunk(text) {\n //185 characters seems to be longest discord tts reads\n let ii, lastSpaceIndex;\n const maxChunkSize = 184;\n let chunks = [];\n if (text.length > maxChunkSize) {\n for (ii = 0; ii < text.length; ii += lastSpaceIndex) {\n let temp = text.substring(ii, ii + maxChunkSize);\n lastSpaceIndex = temp.lastIndexOf(\" \");\n // need to check for the last \"part\" otherwise last index of space\n // will mean ii is always less than text.length\n if (ii + maxChunkSize > text.length) {\n chunks.push(text.substring(ii, ii + maxChunkSize));\n break;\n } else {\n chunks.push(text.substring(ii, ii + lastSpaceIndex));\n }\n }\n } else {\n chunks.push(text);\n }\n return chunks;\n}",
"function blocks(buf, size) {\n var numBlocks = Math.ceil(buf.length / size);\n var result = [];\n var offset = 0;\n\n for (var i = 0; i < numBlocks; i++ ) {\n result.push(buf.slice(offset, size + offset));\n offset += size;\n }\n\n return result;\n}",
"async readToEOL()\n {\n // Create buffer\n let bufs = [];\n\n while (true)\n {\n if (this.receivedBuffers.length > 0)\n {\n let src = this.receivedBuffers[0]\n let pos = indexInBuf(src, '\\n'.charCodeAt(0));\n if (pos >= 0 && pos < src.length)\n {\n // Use part of the buffer...\n\n // Copy out the bit we want\n let buf = Buffer.alloc(pos);\n src.copy(buf, 0, 0, pos);\n bufs.push(buf);\n\n // Skip the \\n\n pos++;\n\n if (pos < src.length)\n {\n // Split the buffer to extract the part we need\n let subBuf = Buffer.alloc(src.length - pos);\n src.copy(subBuf, 0, pos, pos + subBuf.length);\n this.receivedBuffers.shift();\n this.receivedBuffers.unshift(subBuf);\n }\n else\n {\n this.receivedBuffers.shift();\n }\n\n // Finished\n return bufs.map(x=> x.toString(\"utf8\")).join(\"\");\n }\n else\n {\n // Use the entire buffer\n bufs.push(src);\n this.receivedBuffers.shift().length;\n }\n }\n else\n {\n // Wait for more data\n await new Promise((resolve, reject) => {\n this.waiter = resolve;\n });\n this.waiter = null;\n }\n }\n }",
"static *parse(/** !ArrayBuffer */ buf) {\n const reader = new Reader();\n const view = new DataView(buf);\n let /** number */ pos = 0;\n while (pos < buf.byteLength) {\n // Read the frame header\n const startMs = timeMs(view, pos);\n const len = view.getUint32(pos + 8, true);\n const endMs = pos + 12 + len < buf.byteLength\n ? timeMs(view, pos + 12 + len) : Infinity;\n const frame = new Frame();\n frame.startMs_ = startMs;\n frame.durationMs_ = endMs - startMs;\n reader.add(new DataView(buf, pos + 12, len));\n let cmd;\n while ((cmd = Command.parse(reader))) {\n if (cmd.keyframe) frame.keyframe_ = true;\n frame.commands_.push(cmd);\n }\n yield frame;\n pos += 12 + len;\n }\n }",
"function splitMessage(message) {\n var runNumIndex = message.indexOf(':') + 1;\n return {\n // drop colon from the header\n header: message.toString('ascii', 0, runNumIndex - 1),\n run: message.readUInt32LE(runNumIndex),\n event: message.readUInt32LE(runNumIndex + 4),\n data: message.slice(runNumIndex + 8)\n };\n}",
"function getTokenFromBuffer(offset) {\n\t\t\tvar toRead = offset - tokenBuffer.length + 1;\n\t\t\twhile (toRead-- > 0) readTokenToBuffer();\n\t\t\treturn tokenBuffer[offset];\n\t\t}",
"function createParser() {\n let buffer;\n let position; // current read position\n let fieldLength; // length of the `field` portion of the line\n let discardTrailingNewline = false;\n let message = { event: '', data: '' };\n let pending = [];\n const decoder = new TextDecoder();\n return function parse(chunk) {\n if (buffer === undefined) {\n buffer = chunk;\n position = 0;\n fieldLength = -1;\n }\n else {\n const concat = new Uint8Array(buffer.length + chunk.length);\n concat.set(buffer);\n concat.set(chunk, buffer.length);\n buffer = concat;\n }\n const bufLength = buffer.length;\n let lineStart = 0; // index where the current line starts\n while (position < bufLength) {\n if (discardTrailingNewline) {\n if (buffer[position] === ControlChars.NewLine) {\n lineStart = ++position; // skip to next char\n }\n discardTrailingNewline = false;\n }\n // look forward until the end of line\n let lineEnd = -1; // index of the \\r or \\n char\n for (; position < bufLength && lineEnd === -1; ++position) {\n switch (buffer[position]) {\n case ControlChars.Colon:\n if (fieldLength === -1) {\n // first colon in line\n fieldLength = position - lineStart;\n }\n break;\n // \\r case below should fallthrough to \\n:\n case ControlChars.CchunkiageReturn:\n discardTrailingNewline = true;\n // eslint-disable-next-line no-fallthrough\n case ControlChars.NewLine:\n lineEnd = position;\n break;\n }\n }\n if (lineEnd === -1) {\n // end of the buffer but the line hasn't ended\n break;\n }\n else if (lineStart === lineEnd) {\n // empty line denotes end of incoming message\n if (message.event || message.data) {\n // NOT a server ping (\":\\n\\n\")\n if (!message.event)\n throw new Error('Missing message event');\n const event = common_1.validateStreamEvent(message.event);\n const data = common_1.parseStreamData(event, message.data);\n pending.push({\n event,\n data,\n });\n message = { event: '', data: '' };\n }\n }\n else if (fieldLength > 0) {\n // end of line indicates message\n const line = buffer.subarray(lineStart, lineEnd);\n // exclude comments and lines with no values\n // line is of format \"<field>:<value>\" or \"<field>: <value>\"\n // https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation\n const field = decoder.decode(line.subarray(0, fieldLength));\n const valueOffset = fieldLength + (line[fieldLength + 1] === ControlChars.Space ? 2 : 1);\n const value = decoder.decode(line.subarray(valueOffset));\n switch (field) {\n case 'event':\n message.event = value;\n break;\n case 'data':\n // append the new value if the message has data\n message.data = message.data ? message.data + '\\n' + value : value;\n break;\n }\n }\n // next line\n lineStart = position;\n fieldLength = -1;\n }\n if (lineStart === bufLength) {\n // finished reading\n buffer = undefined;\n const messages = [...pending];\n pending = [];\n return messages;\n }\n else if (lineStart !== 0) {\n // create a new view into buffer beginning at lineStart so we don't\n // need to copy over the previous lines when we get the new chunk\n buffer = buffer.subarray(lineStart);\n position -= lineStart;\n }\n };\n}",
"function splitOnChunk_(self, delimiter) {\n const next = (leftover, delimiterIndex) => CH.readWithCause(inputChunk => {\n const buffer = CK.builder();\n const {\n tuple: [carry, delimiterCursor]\n } = CK.reduce_(inputChunk, Tp.tuple(O.getOrElse_(leftover, () => CK.empty()), delimiterIndex), ({\n tuple: [carry, delimiterCursor]\n }, a) => {\n const concatenated = CK.append_(carry, a);\n\n if (delimiterCursor < CK.size(delimiter) && a === CK.unsafeGet_(delimiter, delimiterCursor)) {\n if (delimiterCursor + 1 === CK.size(delimiter)) {\n buffer.append(CK.take_(concatenated, CK.size(concatenated) - CK.size(delimiter)));\n return Tp.tuple(CK.empty(), 0);\n } else {\n return Tp.tuple(concatenated, delimiterCursor + 1);\n }\n } else {\n return Tp.tuple(concatenated, a === CK.unsafeGet_(delimiter, 0) ? 1 : 0);\n }\n });\n return CH.zipRight_(CH.write(buffer.build()), next(!CK.isEmpty(carry) ? O.some(carry) : O.none, delimiterCursor));\n }, halt => O.fold_(leftover, () => CH.failCause(halt), chunk => CH.zipRight_(CH.write(CK.single(chunk)), CH.failCause(halt))), done => O.fold_(leftover, () => CH.succeed(done), chunk => CH.zipRight_(CH.write(CK.single(chunk)), CH.succeed(done))));\n\n return new C.Stream(self.channel[\">>>\"](next(O.none, 0)));\n}",
"function streamToArrayBuffer(stream) {\n const reader = stream.getReader();\n function next(buffer) {\n return reader.read().then(result => {\n if (result.done)\n return buffer;\n const chunk = result.value;\n const tmpBuffer = new Uint8Array(buffer.byteLength + chunk.byteLength);\n tmpBuffer.set(buffer, 0);\n tmpBuffer.set(chunk, buffer.byteLength);\n return next(tmpBuffer);\n });\n }\n return next(new Uint8Array(0));\n}",
"static unravel(message) {\n let [length, contents] = message.split(/{(.*?)}/g),\n parts = contents.split('░');\n\n // Verify packet length\n if (Number(length) === parts.join('').length) {\n return parts;\n }\n return [];\n }",
"function blobToArrayBufferConverter(blobChunks,callback){\n var blob = new Blob(blobChunks, {type: 'video/webm'});\n var fileReader = new FileReader();\n fileReader.readAsArrayBuffer(blob);\n fileReader.onload = function(progressEvent) {\n callback(this.result);\n }\n }",
"readRecordsFromBuffer(buffer, count, fileOffset) {\n const records = [];\n let bufferOffset = 0;\n for (let i = 0; i < count; i++) {\n const record = this.readRecordFromBuffer(buffer.slice(bufferOffset), fileOffset + bufferOffset);\n bufferOffset += record.end - record.offset;\n records.push(record);\n }\n return records;\n }",
"function extract_string(message_str) {\n\tvar message_arr = message_str.split(delimiter); //convert to array\t\n\treturn message_arr;\n}",
"function split (string, delimiter) {\n let results = [];\n let delimiterLength = delimeter.length;\n for (var index=0; index < string.length; index++) {\n let characters = string.substr(index, delimeterLength);\n // let chunkStart =\n // let chunkEnd\n //console.log(characters, index)\n if (characters === delimiter) {\n //console.log(string.substr(0,index))\n }\n }\n return results\n}",
"function splitPackets(bin) {\n // number of packets\n var num = buf2long(bin.slice(0, 2)),\n j = 2,\n packets = [];\n\n for(var i=0; i<num; i++) {\n // first two bytes is the packet length\n var size = buf2long(bin.slice(j, j+2)),\n packet = bin.slice(j+2, j+2+size);\n\n packets.push(packet);\n\n j += 2 + size;\n }\n\n return packets;\n }",
"split(maxFragmentLength) {\n let start = 0;\n const totalLength = this.fragment.length;\n const fragments = [];\n if (maxFragmentLength == null) {\n maxFragmentLength = RecordLayer_1.RecordLayer.MAX_PAYLOAD_SIZE - FragmentedHandshake.headerLength;\n }\n // loop through the message and fragment it\n while (!fragments.length && start < totalLength) {\n // calculate maximum length, limited by MTU - IP/UDP headers - handshake overhead\n const fragmentLength = Math.min(maxFragmentLength, totalLength - start);\n // slice and dice\n const data = Buffer.from(this.fragment.slice(start, start + fragmentLength));\n if (data.length <= 0) {\n // this shouldn't happen, but we don't want to introduce an infinite loop\n throw new Error(`Zero or less bytes processed while fragmenting handshake message.`);\n }\n // create the message\n fragments.push(new FragmentedHandshake(this.msg_type, totalLength, this.message_seq, start, data));\n // step forward by the actual fragment length\n start += data.length;\n }\n return fragments;\n }",
"function bytesToTuples(buf) {\n const tuples = [];\n let i = 0;\n while (i < buf.length) {\n const code = varint_1.default.decode(buf, i);\n const n = varint_1.default.decode.bytes;\n const p = protocols_1.protocols(code);\n const size = sizeForAddr(p, buf.slice(i + n));\n if (size === 0) {\n tuples.push([code]);\n i += n;\n continue;\n }\n const addr = buf.slice(i + n, i + n + size);\n i += size + n;\n if (i > buf.length) {\n // did not end _exactly_ at buf.length\n throw ParseError('Invalid address Uint8Array');\n }\n // ok, tuple seems good.\n tuples.push([code, addr]);\n }\n return tuples;\n}",
"function chunker(str) {\n var len = str.length;\n if (len < 3)\n return [str];\n\n var result = [];\n result.push(str.substring(len - 3, len));\n str = str.slice(0, len - 3);\n\n for (var i = str.length - 1; i >= 0; i = i - 2) {\n if (i == 0)\n result.push(str.slice(0, 1));\n else\n result.push(str.slice(i - 1, i + 1));\n }\n return result;\n }",
"decodePdu( encoded ) {\n\n let values = [];\n\n let index = 0;\n\n while( index < encoded.length ) {\n if( encoded[index] === MSG_TOKEN_ESC && index < encoded.length-1 ) {\n index++;\n\n if( encoded[index] === MSG_START_STUFF ){\n values.push( MSG_TOKEN_START );\n }\n else if( encoded[index] === MSG_ESC_STUFF ){\n values.push( MSG_TOKEN_ESC );\n }\n\n }\n else {\n values.push( encoded[index] );\n }\n\n index++;\n\n }\n\n return values;\n }",
"function deserializeBinary(buf) {\n var data = new DataView(buf);\n // read the header: 1 + nbufs 32b integers\n var nbufs = data.getUint32(0);\n var offsets = [];\n if (nbufs < 2) {\n throw new Error('Invalid incoming Kernel Message');\n }\n for (var i = 1; i <= nbufs; i++) {\n offsets.push(data.getUint32(i * 4));\n }\n var jsonBytes = new Uint8Array(buf.slice(offsets[0], offsets[1]));\n var msg = JSON.parse((new TextDecoder('utf8')).decode(jsonBytes));\n // the remaining chunks are stored as DataViews in msg.buffers\n msg.buffers = [];\n for (var i = 1; i < nbufs; i++) {\n var start = offsets[i];\n var stop_1 = offsets[i + 1] || buf.byteLength;\n msg.buffers.push(new DataView(buf.slice(start, stop_1)));\n }\n return msg;\n}"
] |
[
"0.61869943",
"0.60298955",
"0.59152037",
"0.5880399",
"0.5838884",
"0.581013",
"0.57597834",
"0.5655488",
"0.5653349",
"0.56403196",
"0.5609602",
"0.5604847",
"0.5600512",
"0.5567884",
"0.5562531",
"0.55203986",
"0.55201626",
"0.5433067",
"0.543182",
"0.54123884",
"0.5411549",
"0.5391166",
"0.53662735",
"0.53545296",
"0.53466576",
"0.52812153",
"0.5278851",
"0.52747536",
"0.52231133",
"0.52192605"
] |
0.8727454
|
0
|
Called to handle a received, validated PDU.
|
onReceive( pdu ) {
// We push it to the Transform object, which spits it out
// the Readable side of the stream as a 'data' event
this.push( Buffer.from( pdu.slice(3, pdu.length-1 )));
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"_transform(chunk, encoding, cb) {\n\n var me = this;\n //console.log('Chunk: ', chunk );\n\n // Concatenate any previous data, and split into an array of\n // encoded PDUs that start with a MSG_START byte\n let encodedPdus = this.splitBuffer( Buffer.concat([this.buffer, chunk]) );\n\n // Now we look through each of the encoded PDUs (which have not\n // yet been validated for length or checksum)\n encodedPdus.forEach( function( encodedPdu, pduIndex ){\n\n // Unstuff the PDU (remove escape codes)\n let pdu = me.decodePdu( encodedPdu );\n\n if( pdu.length >= MIN_MSG_LEN ) {\n\n // it is at least long enough to possibly be complete\n let msgLength = pdu[1]*256 + pdu[2];\n\n // If it's too long, truncate it. This shouldn't really happen\n // under normal circumstances, but no reason to keep extra bytes around.\n if(pdu.length + 3 > msgLength ) {\n pdu = pdu.slice(0, msgLength+3 );\n }\n\n // If it (now) has the expected number of bytes...\n if( msgLength === pdu.length-3 ) {\n\n // check the checksum\n let checksum = me.checksum( pdu, 1, msgLength +1 );\n\n if( checksum === pdu[ msgLength+2 ] ) {\n // Process the received PDU\n me.onReceive( pdu );\n }\n else {\n // report an incorrect checksum\n me.onReceiveError( pdu );\n } \n }\n else if( pduIndex === encodedPdu.length-1 ) {\n // if last PDU is incomplete, save it for later\n me.buffer = Buffer.from( encodedPdu );\n }\n\n }\n else if( pduIndex === encodedPdu.length-1 ) {\n // if last PDU is incomplete, save it for later\n me.buffer = Buffer.from( encodedPdu );\n }\n\n });\n\n // notify the caller that we are done processing the chunk\n cb();\n }",
"function parseIncomingMessage (evt) {\n\n\t// get the notify_resp_type\n\n\t// parse evt.data\n\n\tvar blobReader = new FileReader();\n\tblobReader.onload = function() {\n\t\tvar dv = new DataView(this.result);\n\t\tvar indata = new Uint8Array(this.result);\n\t\tvar notify_resp_type = dv.getUint32(0,true);\n\n\t\tvar msgHeader = new MsgHeader();\n\t\tmsgHeader.Read(dv, 0);\n\n\t\tvar cardchar = \"\";\n\t\tvar cardcharPeer = \"\";\n\t\tvar errorMsg = \"\";\n\t\tvar PUIDindex = \"\";\n\t\tvar percentage = 0;\n\n\t\t// determine what action to take for this response or notification\n\t\tswitch ( msgHeader.dwCommand ) {\n\n\t\t\tcase JS_VERSION_NEG_RES:\n\t\t\t\tconsole.log(\"get VERSION_NEG_RES!\");\n\t\t\t\t//Read data and save it in \"versionNegRes\"\n\t\t\t\tvar versionNegRes = new VersionNegotiationRes();\n\t\t\t\tversionNegRes.Read(dv, MsgHeader.Size);\n\n\n\n\t\t\t\t//Update on Web Interface\n\t\t\t\tif (versionNegRes.dwStatusCode == 0x00) {\n\n\t\t\t\t} else {\n\t\t\t\t\t//alert(\"Negotiation failed!\");\n\t\t\t\t\t$(\"#VNErrorMsg\").effect(\"pulsate\",{times:3},3000);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase JS_SPACE_AVAIL_NOTIFY:\n\t\t\t\tconsole.log(\"get JS_SPACE_AVAIL_NOTIFY!\");\n\t\t\t\t//Read data and save it in \"spaceAvailableNoti\"\n\t\t\t\tvar spaceAvailableNoti = new SpaceAvailableNotification();\n\t\t\t\tspaceAvailableNoti.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//Update on Web Interface\n\t\t\t\tif (spaceAvailableNoti.cbyTotalFreeSpaceCombined >= Math.pow(2,30)) {\n\t\t\t\t\t$(\".TotalFreeSpace\").html(\" \"+(spaceAvailableNoti.cbyTotalFreeSpaceCombined/Math.pow(2,30)).toFixed(2)+\" \");\n\t\t\t\t\t$(\".TotalFreeUnit\").html(\" GB\");\n\t\t\t\t}else if (spaceAvailableNoti.cbyTotalFreeSpaceCombined >= Math.pow(2,20)) {\n\t\t\t\t\t$(\".TotalFreeSpace\").html(\" \"+(spaceAvailableNoti.cbyTotalFreeSpaceCombined/Math.pow(2,20)).toFixed(2)+\" \");\n\t\t\t\t\t$(\".TotalFreeUnit\").html(\" MB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyTotalFreeSpaceCombined >= Math.pow(2,10)) {\n\t\t\t\t\t$(\".TotalFreeSpace\").html(\" \"+(spaceAvailableNoti.cbyTotalFreeSpaceCombined/Math.pow(2,10)).toFixed(2)+\" \");\n\t\t\t\t\t$(\".TotalFreeUnit\").html(\" KB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyTotalFreeSpaceCombined >= 0) {\n\t\t\t\t\t$(\".TotalFreeSpace\").html(\" \"+(spaceAvailableNoti.cbyTotalFreeSpaceCombined).toFixed(2)+\" \");\n\t\t\t\t\t$(\".TotalFreeUnit\").html(\" B\");\n\t\t\t\t}\n\n\t\t\t\tif (spaceAvailableNoti.cbyTotalFreeSpaceOnCardA >= Math.pow(2,30)) {\n\t\t\t\t\t$(\"#totalFreeA\").html(\" \"+(spaceAvailableNoti.cbyTotalFreeSpaceOnCardA/Math.pow(2,30)).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#totalFreeAUnit\").html(\" GB\");\n\t\t\t\t}else if (spaceAvailableNoti.cbyTotalFreeSpaceOnCardA >= Math.pow(2,20)) {\n\t\t\t\t\t$(\"#totalFreeA\").html(\" \"+(spaceAvailableNoti.cbyTotalFreeSpaceOnCardA/Math.pow(2,20)).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#totalFreeAUnit\").html(\" MB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyTotalFreeSpaceOnCardA >= Math.pow(2,10)) {\n\t\t\t\t\t$(\"#totalFreeA\").html(\" \"+(spaceAvailableNoti.cbyTotalFreeSpaceOnCardA/Math.pow(2,10)).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#totalFreeAUnit\").html(\" KB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyTotalFreeSpaceOnCardA >= 0) {\n\t\t\t\t\t$(\"#totalFreeA\").html(\" \"+(spaceAvailableNoti.cbyTotalFreeSpaceOnCardA).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#totalFreeAUnit\").html(\" B\");\n\t\t\t\t}\n\n\t\t\t\tif (spaceAvailableNoti.cbyTotalFreeSpaceOnCardB >= Math.pow(2,30)) {\n\t\t\t\t\t$(\"#totalFreeB\").html(\" \"+(spaceAvailableNoti.cbyTotalFreeSpaceOnCardB/Math.pow(2,30)).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#totalFreeBUnit\").html(\" GB\");\n\t\t\t\t}else if (spaceAvailableNoti.cbyTotalFreeSpaceOnCardB >= Math.pow(2,20)) {\n\t\t\t\t\t$(\"#totalFreeB\").html(\" \"+(spaceAvailableNoti.cbyTotalFreeSpaceOnCardB/Math.pow(2,20)).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#totalFreeBUnit\").html(\" MB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyTotalFreeSpaceOnCardB >= Math.pow(2,10)) {\n\t\t\t\t\t$(\"#totalFreeB\").html(\" \"+(spaceAvailableNoti.cbyTotalFreeSpaceOnCardB/Math.pow(2,10)).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#totalFreeBUnit\").html(\" KB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyTotalFreeSpaceOnCardB >= 0) {\n\t\t\t\t\t$(\"#totalFreeB\").html(\" \"+(spaceAvailableNoti.cbyTotalFreeSpaceOnCardB).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#totalFreeBUnit\").html(\" B\");\n\t\t\t\t}\n\n\t\t\t\tif (spaceAvailableNoti.cbyLargestJBODSpaceOnCardA >= Math.pow(2,30)) {\n\t\t\t\t\t$(\"#possibleJBODA\").html(\" \"+(spaceAvailableNoti.cbyLargestJBODSpaceOnCardA/Math.pow(2,30)).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#possibleJBODAUnit\").html(\" GB\");\n\t\t\t\t}else if (spaceAvailableNoti.cbyLargestJBODSpaceOnCardA >= Math.pow(2,20)) {\n\t\t\t\t\t$(\"#possibleJBODA\").html(\" \"+(spaceAvailableNoti.cbyLargestJBODSpaceOnCardA/Math.pow(2,20)).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#possibleJBODAUnit\").html(\" MB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyLargestJBODSpaceOnCardA >= Math.pow(2,10)) {\n\t\t\t\t\t$(\"#possibleJBODA\").html(\" \"+(spaceAvailableNoti.cbyLargestJBODSpaceOnCardA/Math.pow(2,10)).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#possibleJBODAUnit\").html(\" KB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyLargestJBODSpaceOnCardA >= 0) {\n\t\t\t\t\t$(\"#possibleJBODA\").html(\" \"+(spaceAvailableNoti.cbyLargestJBODSpaceOnCardA).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#possibleJBODAUnit\").html(\" B\");\n\t\t\t\t}\n\n\t\t\t\tif (spaceAvailableNoti.cbyLargestJBODSpaceOnCardB >= Math.pow(2,30)) {\n\t\t\t\t\t$(\"#possibleJBODB\").html(\" \"+(spaceAvailableNoti.cbyLargestJBODSpaceOnCardB/Math.pow(2,30)).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#possibleJBODBUnit\").html(\" GB\");\n\t\t\t\t}else if (spaceAvailableNoti.cbyLargestJBODSpaceOnCardB >= Math.pow(2,20)) {\n\t\t\t\t\t$(\"#possibleJBODB\").html(\" \"+(spaceAvailableNoti.cbyLargestJBODSpaceOnCardB/Math.pow(2,20)).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#possibleJBODBUnit\").html(\" MB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyLargestJBODSpaceOnCardB >= Math.pow(2,10)) {\n\t\t\t\t\t$(\"#possibleJBODB\").html(\" \"+(spaceAvailableNoti.cbyLargestJBODSpaceOnCardB/Math.pow(2,10)).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#possibleJBODBUnit\").html(\" KB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyLargestJBODSpaceOnCardB >= 0) {\n\t\t\t\t\t$(\"#possibleJBODB\").html(\" \"+(spaceAvailableNoti.cbyLargestJBODSpaceOnCardB).toFixed(2)+\" \");\n\t\t\t\t\t$(\"#possibleJBODBUnit\").html(\" B\");\n\t\t\t\t}\n\n\t\t\t\tif (spaceAvailableNoti.cbyLargestStripeSpaceOnCard >= Math.pow(2,30)) {\n\t\t\t\t\t$(\".PossibleStripeSpace\").html(\" \"+(spaceAvailableNoti.cbyLargestStripeSpaceOnCard/Math.pow(2,30)).toFixed(2)+\" \");\n\t\t\t\t\t$(\".PossibleStripeUnit\").html(\" GB\");\n\t\t\t\t}else if (spaceAvailableNoti.cbyLargestStripeSpaceOnCard >= Math.pow(2,20)) {\n\t\t\t\t\t$(\".PossibleStripeSpace\").html(\" \"+(spaceAvailableNoti.cbyLargestStripeSpaceOnCard/Math.pow(2,20)).toFixed(2)+\" \");\n\t\t\t\t\t$(\".PossibleStripeUnit\").html(\" MB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyLargestStripeSpaceOnCard >= Math.pow(2,10)) {\n\t\t\t\t\t$(\".PossibleStripeSpace\").html(\" \"+(spaceAvailableNoti.cbyLargestStripeSpaceOnCard/Math.pow(2,10)).toFixed(2)+\" \");\n\t\t\t\t\t$(\".PossibleStripeUnit\").html(\" KB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyLargestStripeSpaceOnCard >= 0) {\n\t\t\t\t\t$(\".PossibleStripeSpace\").html(\" \"+(spaceAvailableNoti.cbyLargestStripeSpaceOnCard).toFixed(2)+\" \");\n\t\t\t\t\t$(\".PossibleStripeUnit\").html(\" B\");\n\t\t\t\t}\n\n\t\t\t\tif (spaceAvailableNoti.cbyLargestMirrorSpaceOnCard >= Math.pow(2,30)) {\n\t\t\t\t\t$(\".PossibleMirrorSpace\").html(\" \"+(spaceAvailableNoti.cbyLargestMirrorSpaceOnCard/Math.pow(2,30)).toFixed(2)+\" \");\n\t\t\t\t\t$(\".PossibleMirrorUnit\").html(\" GB\");\n\t\t\t\t}else if (spaceAvailableNoti.cbyLargestMirrorSpaceOnCard >= Math.pow(2,20)) {\n\t\t\t\t\t$(\".PossibleMirrorSpace\").html(\" \"+(spaceAvailableNoti.cbyLargestMirrorSpaceOnCard/Math.pow(2,20)).toFixed(2)+\" \");\n\t\t\t\t\t$(\".PossibleMirrorUnit\").html(\" MB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyLargestMirrorSpaceOnCard >= Math.pow(2,10)) {\n\t\t\t\t\t$(\".PossibleMirrorSpace\").html(\" \"+(spaceAvailableNoti.cbyLargestMirrorSpaceOnCard/Math.pow(2,10)).toFixed(2)+\" \");\n\t\t\t\t\t$(\".PossibleMirrorUnit\").html(\" KB\");\n\t\t\t\t} else if (spaceAvailableNoti.cbyLargestMirrorSpaceOnCard >= 0) {\n\t\t\t\t\t$(\".PossibleMirrorSpace\").html(\" \"+(spaceAvailableNoti.cbyLargestMirrorSpaceOnCard).toFixed(2)+\" \");\n\t\t\t\t\t$(\".PossibleMirrorUnit\").html(\" B\");\n\t\t\t\t}\n\n\t\t\t\t//update piechart\n\t\t\t\tvar totalA = parseInt($(\"#cardSizeA\").html());\n\t\t\t\tif (totalA > 0) {\n\t\t\t\t\tvar freeA = (100*spaceAvailableNoti.cbyTotalFreeSpaceOnCardA/totalA).toFixed(2);\n\t\t\t\t\tvar usedA = (100 - freeA).toFixed(2);\n\t\t\t\t\tLoadPieCharts(\"A\", usedA, freeA);\n\t\t\t\t}\n\n\n\t\t\t\tvar totalB = parseInt($(\"#cardSizeB\").html());\n\t\t\t\tif (totalB > 0) {\n\t\t\t\t\tvar freeB = (100*spaceAvailableNoti.cbyTotalFreeSpaceOnCardB/totalB).toFixed(2);\n\t\t\t\t\tvar usedB = (100 - freeB).toFixed(2);\n\t\t\t\t\tLoadPieCharts(\"B\", usedB, freeB);\n\t\t\t\t}\n\n\t\t\t\t//clear previous input value of partition size\n\t\t\t\t$(\"#PartitionSizeA\").val(\"\");\n\t\t\t\t$(\"#PartitionSizeB\").val(\"\");\n\n\t\t\t\t//hide error messages of new partition size\n\t\t\t\t$(\"#volumeSizeErrorMsgA\").hide();\n\t\t\t\t$(\"#volumeSizeErrorMsgB\").hide();\n\t\t\t\t//clear error messages of previous partition activity\n\t\t\t\tdocument.getElementById(\"definePartErrorMsgA\").innerHTML = \"\";\n\t\t\t\tdocument.getElementById(\"definePartErrorMsgB\").innerHTML = \"\";\n\n\t\t\t\tbreak;\n\n\t\t\tcase JS_PART_LIST_UPDATED_NOTIFY:\n\t\t\t\tconsole.log(\"get PART_LIST_UPDATED_NOTIFY!\");\n\t\t\t\t//Read data and save it in \"partListUpdateNoti\"\n\t\t\t\tvar partListUpdateNoti = new PartitionListUpdatedNotification();\n\t\t\t\tpartListUpdateNoti.Read(dv, indata);\n\n\t\t\t\t//console.log(\"cPartitions:\"+partListUpdateNoti.cPartitions);\n\t\t\t\t//Update on Web Interface\n\t\t\t\tvar GUIDA = $(\"#GUIDA\").html();\n\t\t\t\tvar GUIDB = $(\"#GUIDB\").html();\n\n\t\t\t\tvar PartInfoEntry = partListUpdateNoti.pie;\n\n\t\t\t\t//console.log(\"partitionNum:\"+partListUpdateNoti.cPartitions);\n\n\t\t\t\tif (partListUpdateNoti.cPartitions == 0) {\n\n\t\t\t\t\t//accordionVolume();\n\t\t\t\t\t$(\"#CardAPartitionList\").html(\"\");\n\t\t\t\t\t$(\"#CardBPartitionList\").html(\"\");\n\n\t\t\t\t} else {\n\n\t\t\t\t\tvar BstartIndex = partListUpdateNoti.cPartitions;\n\t\t\t\t\tfor (var i=0;i<partListUpdateNoti.cPartitions;i++) {\n\t\t\t\t\t\tif (PartInfoEntry[i].owGUID == GUIDB) {\n\t\t\t\t\t\t\tBstartIndex = i;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t$(\"#PartitionNumA\").html(BstartIndex - 0);\n\t\t\t\t\t$(\"#PartitionNumB\").html(partListUpdateNoti.cPartitions - BstartIndex);\n\n\t\t\t\t\tgeneratePartitionEntries ( PartInfoEntry, 0, BstartIndex, 'CardAPartitionList' );\n\t\t\t\t\tgeneratePartitionEntries ( PartInfoEntry, BstartIndex, partListUpdateNoti.cPartitions, 'CardBPartitionList' );\n\t\t\t\t\t/*if (PartInfoEntry[0].owGUID == GUIDA) {\n\t\t\t\t\t\tPartitionNumA = partListUpdateNoti.cPartitions;\n\t\t\t\t\t\tgeneratePartitionEntries ( PartInfoEntry, partListUpdateNoti.cPartitions, 'CardAPartitionList' );\n\t\t\t\t\t} else if (PartInfoEntry[0].owGUID == GUIDB) {\n\t\t\t\t\t\tPartitionNumB = partListUpdateNoti.cPartitions;\n\t\t\t\t\t\tgeneratePartitionEntries ( PartInfoEntry, partListUpdateNoti.cPartitions, 'CardBPartitionList' );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//GUID not recognized\n\t\t\t\t\t\tconsole.log(\"Unrecognized GUID in pie!\");\n\t\t\t\t\t}*/\n\n\t\t\t\t\taccordionVolume();\n\t\t\t\t\tsetDragArrowJBOD();\n\t\t\t\t\tsetDragArrowMirror();\n\t\t\t\t\tsetDragArrowStripe();\n\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase JS_PROG_REPORT_NOTIFY:\n\t\t\t\tconsole.log(\"get JS_PROG_REPORT_NOTIFY!\");\n\t\t\t\t//Read data and save it in \"progReportNoti\"\n\t\t\t\tvar progReportNoti = new ProgressReportNotification();\n\t\t\t\tprogReportNoti.Read(dv, MsgHeader.Size);\n\t\t\t\t//console.log(\"progReportNoti.dwCommand:\"+progReportNoti.dwCommand);\n\t\t\t\t//Update on Web Interface\n\n\t\t\t\tif (progReportNoti.owGUID == $(\"#GUIDA\").html()) {\n\t\t\t\t\tcardchar = \"A\";\n\t\t\t\t\tcardcharPeer = \"B\";\n\t\t\t\t} else if (progReportNoti.owGUID == $(\"#GUIDB\").html()) {\n\t\t\t\t\tcardchar = \"B\";\n\t\t\t\t\tcardcharPeer = \"A\";\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(\"Wrong GUID in PROG_REPORT_NOTIFY!\");\n\t\t\t\t\tconsole.log(\"GUID:\"+progReportNoti.owGUID);\n\t\t\t\t}\n\n\t\t\t\tif (progReportNoti.dwErrorCode == 0) {\n\t\t\t\t\t//error code is 0\n\t\t\t\t\tconsole.log(progReportNoti.dwTotalStepsCompleted+\":\"+progReportNoti.dwTotalStepsRequired);\n\t\t\t\t\t//clear error message for\n\t\t\t\t\t//document.getElementById(\"CardError\"+cardchar).innerHTML = \"\";\n\t\t\t\t\t//clearCardErrorMsg(cardchar);\n\t\t\t\t\t//display card progress bar\n\t\t\t\t\tif (document.getElementById(\"cardProgArea\"+cardchar).style.display == \"none\" && (progReportNoti.dwTotalStepsCompleted<progReportNoti.dwTotalStepsRequired)) {\n\t\t\t\t\t\tshowCardProg(cardchar);\n\t\t\t\t\t}\n\n\t\t\t\t\tpercentage = 100*progReportNoti.dwTotalStepsCompleted/progReportNoti.dwTotalStepsRequired;\n\n\t\t\t\t\tswitch(progReportNoti.dwCommand) {\n\t\t\t\t\t\tcase JS_WIPE_MEDIA_REQ:\n\n\t\t\t\t\t\t\t$(\"#WipeErrorMark\"+cardchar).fadeTo(0,0);\n\t\t\t\t\t\t\t$(\"#WipeErrorMark\"+cardchar).prop(\"title\",\"\");\n\t\t\t\t\t\t\t$(\"#CardError\" + cardchar + \"WIPE\").html(\"\");\n\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).html(\"Wiping \"+percentage.toFixed(2).slice(0,-3)+\"%\");\n\t\t\t\t\t\t\t$(\"#cardProgCmd\"+cardchar).html(JS_WIPE_MEDIA_REQ);\n\n\t\t\t\t\t\t\tif (progReportNoti.dwTotalStepsCompleted < progReportNoti.dwTotalStepsRequired) {\n\n\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).width(percentage+\"%\");\n\t\t\t\t\t\t\t\t$(\"#BtnWipe\"+cardchar).prop(\"disabled\", true);\n\n\t\t\t\t\t\t\t} else if (progReportNoti.dwTotalStepsCompleted == progReportNoti.dwTotalStepsRequired) {\n\n\t\t\t\t\t\t\t\t$(\"#cardProgArea\"+cardchar).hide();\n\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).width(\"0%\");\n\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).html(\"\");\n\t\t\t\t\t\t\t\t$(\"#cardProgCmd\"+cardchar).html(\"\");\n\t\t\t\t\t\t\t\t$(\"#BtnWipe\"+cardchar).prop(\"disabled\", false);\n\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t//steps field not correct\n\t\t\t\t\t\t\t\tconsole.log(\"JS_PROG_REPORT_NOTIFY ERROR: dwTotalStepsCompleted > dwTotalStepsRequired\");\n\t\t\t\t\t\t\t\t$(\"#BtnWipe\"+cardchar).prop(\"disabled\", false);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase JS_DEFRAG_REQ:\n\n\t\t\t\t\t\t\t$(\"#DefragErrorMark\"+cardchar).fadeTo(0,0);\n\t\t\t\t\t\t\t$(\"#DefragErrorMark\"+cardchar).prop(\"title\",\"\");\n\t\t\t\t\t\t\t$(\"#CardError\" + cardchar + \"DEFRAG\").html(\"\");\n\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).html(\"Defragging \"+percentage.toFixed(2).slice(0,-3)+\"%\");\n\t\t\t\t\t\t\t$(\"#cardProgCmd\"+cardchar).html(JS_DEFRAG_REQ);\n\n\t\t\t\t\t\t\tif (progReportNoti.dwTotalStepsCompleted < progReportNoti.dwTotalStepsRequired) {\n\n\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).width(percentage+\"%\");\n\t\t\t\t\t\t\t\t$(\"#BtnDefrag\"+cardchar).prop(\"disabled\", true);\n\n\t\t\t\t\t\t\t} else if (progReportNoti.dwTotalStepsCompleted == progReportNoti.dwTotalStepsRequired) {\n\n\t\t\t\t\t\t\t\t$(\"#cardProgArea\"+cardchar).hide();\n\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).width(\"0%\");\n\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).html(\"\");\n\t\t\t\t\t\t\t\t$(\"#cardProgCmd\"+cardchar).html(\"\");\n\t\t\t\t\t\t\t\t$(\"#BtnDefrag\"+cardchar).prop(\"disabled\", false);\n\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t//steps field not correct\n\t\t\t\t\t\t\t\t$(\"#BtnDefrag\"+cardchar).prop(\"disabled\", false);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase JS_CONVERT_RAID_TYPE_REQ:\n\n\t\t\t\t\t\t\t$(\"#ConvertErrorMark\"+cardchar).hide();\n\t\t\t\t\t\t\t$(\"#ConvertErrorMark\"+cardchar).prop(\"title\",\"\");\n\t\t\t\t\t\t\t$(\"#CardError\" + cardchar + \"CVT\").html(\"\");\n\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).html(\"Converting \"+percentage.toFixed(2).slice(0,-3)+\"%\");\n\t\t\t\t\t\t\t$(\"#cardProgCmd\"+cardchar).html(JS_CONVERT_RAID_TYPE_REQ);\n\n\t\t\t\t\t\t\tif (progReportNoti.dwTotalStepsCompleted < progReportNoti.dwTotalStepsRequired) {\n\t\t\t\t\t\t\t\tif ($(\"#RAIDTypeStr\"+cardchar).html() == \"Mirror\") {\n\t\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).width(percentage+\"%\");\n\t\t\t\t\t\t\t\t} else if ($(\"#RAIDTypeStr\"+cardchar).html() == \"JBOD\") {\n\t\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).width(percentage+\"%\");\n\t\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardcharPeer).html(\"Converting \"+percentage.toFixed(2).slice(0,-3));\n\t\t\t\t\t\t\t\t\t$(\"#cardProgCmd\"+cardcharPeer).html(JS_CONVERT_RAID_TYPE_REQ);\n\t\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardcharPeer).width(percentage+\"%\");\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (progReportNoti.dwTotalStepsCompleted == progReportNoti.dwTotalStepsRequired) {\n\t\t\t\t\t\t\t\tif ($(\"#RAIDTypeStr\"+cardchar).html() == \"Mirror\") {\n\t\t\t\t\t\t\t\t\t$(\"#cardProgArea\"+cardchar).hide();\n\t\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).width(\"0%\");\n\t\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).html(\"\");\n\t\t\t\t\t\t\t\t\t$(\"#cardProgCmd\"+cardchar).html(\"\");\n\t\t\t\t\t\t\t\t} else if ($(\"#RAIDTypeStr\"+cardchar).html() == \"JBOD\") {\n\t\t\t\t\t\t\t\t\t$(\"#cardProgArea\"+cardchar).hide();\n\t\t\t\t\t\t\t\t\t$(\"#cardProgArea\"+cardcharPeer).hide();\n\t\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).width(\"0%\");\n\t\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardcharPeer).width(\"0%\");\n\t\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).html(\"\");\n\t\t\t\t\t\t\t\t\t$(\"#cardProgCmd\"+cardchar).html(\"\");\n\t\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardcharPeer).html(\"\");\n\t\t\t\t\t\t\t\t\t$(\"#cardProgCmd\"+cardcharPeer).html(\"\");\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t//unknow RAID type\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//hide \"convert\" button\n\t\t\t\t\t\t\t\t$(\"#confirmConvertRAIDType\"+cardchar).hide();\n\t\t\t\t\t\t\t\t$(\"#confirmConvertRAIDType\"+cardchar).prop(\"disabled\", false);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t//steps field is not correct\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase JS_SYNC_MIRROR_REQ:\n\n\t\t\t\t\t\t\t$(\"#CardError\" + cardchar + \"SYNC\").html(\"\");\n\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).html(\"Syncing \"+percentage.toFixed(2).slice(0,-3)+\"%\");\n\t\t\t\t\t\t\t$(\"#cardProgCmd\"+cardchar).html(JS_SYNC_MIRROR_REQ);\n\n\t\t\t\t\t\t\tif (progReportNoti.dwTotalStepsCompleted < progReportNoti.dwTotalStepsRequired) {\n\n\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).width(percentage+\"%\");\n\n\t\t\t\t\t\t\t} else if (progReportNoti.dwTotalStepsCompleted == progReportNoti.dwTotalStepsRequired) {\n\n\t\t\t\t\t\t\t\t$(\"#cardProgArea\"+cardchar).hide();\n\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).width(\"0%\");\n\t\t\t\t\t\t\t\t$(\"#cardProg\"+cardchar).html(\"\");\n\t\t\t\t\t\t\t\t$(\"#cardProgCmd\"+cardchar).html(\"\");\n\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t//steps field not correct\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.log(\"Command in Progress Notification is not recognized!\");\n\t\t\t\t\t\t\tconsole.log(\"progReportNoti.dwCommand=\"+progReportNoti.dwCommand);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//error code is NOT 0\n\t\t\t\t\terrorMsg = parseErrorCode(progReportNoti.dwErrorCode);\n\t\t\t\t\t//reset progress bar for wipe/defrag/convert if error happens to present operation\n\t\t\t\t\t//Say wipe has error while convert is in progress, don't reset.\n\t\t\t\t\tif (progReportNoti.dwCommand == $(\"#cardProgCmd\"+cardchar).html()) {\n\t\t\t\t\t\t$(\"#cardProgArea\"+cardchar).hide();\n\t\t\t\t\t\t$(\"#cardProg\"+cardchar).width(\"0%\");\n\t\t\t\t\t\t$(\"#cardProg\"+cardchar).html(\"\");\n\t\t\t\t\t\t$(\"#cardProgCmd\"+cardchar).html(\"\");\n\t\t\t\t\t}\n\n\t\t\t\t\tif (progReportNoti.dwCommand == JS_CONVERT_RAID_TYPE_REQ) {\n\t\t\t\t\t\tswitch ($(\"#RAIDTypeStr\"+cardchar).html()) {\n\t\t\t\t\t\t\tcase \"JBOD\":\n\t\t\t\t\t\t\t\tdocument.getElementById(\"RAIDType\"+cardchar).selectedIndex = 1;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"Mirror\":\n\t\t\t\t\t\t\t\tdocument.getElementById(\"RAIDType\"+cardchar).selectedIndex = 2;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tdocument.getElementById(\"RAIDType\"+cardchar).selectedIndex = 0;\n\t\t\t\t\t\t\t\tconsole.log(\"convert reset raid type error!\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (progReportNoti.dwCommand == JS_CONVERT_RAID_TYPE_REQ && $(\"#RAIDTypeStr\"+cardchar).html() == \"JBOD\") {\n\t\t\t\t\t\t$(\"#cardProgArea\"+cardcharPeer).hide();\n\t\t\t\t\t\t$(\"#cardProg\"+cardcharPeer).width(\"0%\");\n\t\t\t\t\t\t$(\"#cardProg\"+cardcharPeer).html(\"\");\n\t\t\t\t\t\t$(\"#cardProgCmd\"+cardcharPeer).html(\"\");\n\t\t\t\t\t}\n\n\t\t\t\t\tif (progReportNoti.dwCommand == JS_WIPE_MEDIA_REQ) {\n\t\t\t\t\t\t$(\"#BtnWipe\"+cardchar).prop(\"disabled\", false);\n\t\t\t\t\t}\n\t\t\t\t\tif (progReportNoti.dwCommand == JS_DEFRAG_REQ) {\n\t\t\t\t\t\t$(\"#BtnDefrag\"+cardchar).prop(\"disabled\", false);\n\t\t\t\t\t}\n\n\n\t\t\t\t\t//hide \"convert\" button\n\t\t\t\t\t$(\"#confirmConvertRAIDType\"+cardchar).hide();\n\t\t\t\t\t$(\"#confirmConvertRAIDType\"+cardchar).prop(\"disabled\", false);\n\n\t\t\t\t\t//display error message\n\t\t\t\t\t//var errorMsg = parseErrorCode(progReportNoti.dwErrorCode);\n\t\t\t\t\tconsole.log(\"progReportNoti.dwErrorCode=\"+progReportNoti.dwErrorCode+\",progReportNoti.dwCommand=\"+progReportNoti.dwCommand+\",\"+progReportNoti.dwTotalStepsCompleted+\":\"+progReportNoti.dwTotalStepsRequired);\n\t\t\t\t\t\t//document.getElementById(\"CardError\"+cardchar).innerHTML = \"0x\" + Dw2HexString(progReportNoti.dwErrorCode) + \"  \" + errorMsg.toUpperCase();\n\t\t\t\t\tvar cmd = \"\";\n\t\t\t\t\tswitch(progReportNoti.dwCommand) {\n\t\t\t\t\t\tcase JS_WIPE_MEDIA_REQ:\n\t\t\t\t\t\t\tcmd = \"WIPE\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase JS_DEFRAG_REQ:\n\t\t\t\t\t\t\tcmd = \"DEFRAG\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase JS_CONVERT_RAID_TYPE_REQ:\n\t\t\t\t\t\t\tcmd = \"CVT\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase JS_SYNC_MIRROR_REQ:\n\t\t\t\t\t\t\tcmd = \"SYNC\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.log(\"progReportNoti wrong cmd!\");\n\t\t\t\t\t}\n\t\t\t\t\tupdateCardErrorMsg(cardchar, cmd, progReportNoti.dwErrorCode);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase JS_CHANGE_MEDIA_INFO_RES:\n\t\t\t\tconsole.log(\"get JS_CHANGE_MEDIA_INFO_RES!\");\n\t\t\t\t//Read data and save it in \"changeMediaInfoRes\"\n\t\t\t\tvar changeMediaInfoRes = new ChangeMediaInfoRes();\n\t\t\t\tchangeMediaInfoRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//Update on Web Interface\n\n\t\t\t\tif (changeMediaInfoRes.owCardGUID == $(\"#GUIDA\").html()) {\n\t\t\t\t\tcardchar = \"A\";\n\t\t\t\t} else if (changeMediaInfoRes.owCardGUID == $(\"#GUIDB\").html()) {\n\t\t\t\t\tcardchar = \"B\";\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(\"No match for GUID in CHANGE_MEDIA_INFO_RES!\");\n\t\t\t\t}\n\n\t\t\t\t//hide \"changemediainfo\" button\n\t\t\t\t$(\"#CMediaInfo\"+cardchar).fadeOut();\n\n\t\t\t\t//changeMediaInfo request comment is empty, then no change will be made for comment.\n\t\t\t\t//reset comment to previous one\n\t\t\t\tif ($(\"#CardDesc\"+cardchar).val() == \"\") {\n\t\t\t\t\tvar cmtStr = $(\"#userComment\"+cardchar).html();\n\t\t\t\t\t$(\"#CardDesc\"+cardchar).val(cmtStr);\n\t\t\t\t}\n\n\t\t\t\tif (changeMediaInfoRes.dwErrorCode != 0) {\n\n\t\t\t\t\t//display error message\n\t\t\t\t\tupdateCardErrorMsg(cardchar, \"CMI\", changeMediaInfoRes.dwErrorCode);\n\n\t\t\t\t\terrorMsg = parseErrorCode(changeMediaInfoRes.dwErrorCode);\n\t\t\t\t\tvar comment = $(\"#userComment\"+cardchar).html();\n\t\t\t\t\tif (comment != $(\"#CardDesc\"+cardchar).val()) {\n\t\t\t\t\t\t$(\"#ChangeMediaInfoCmtErrorMark\"+cardchar).prop(\"title\",\"Error: 0x\" + Dw2HexString(changeMediaInfoRes.dwErrorCode) + \" \" + errorMsg.toUpperCase());\n\t\t\t\t\t\t$(\"#ChangeMediaInfoCmtErrorMark\"+cardchar).fadeIn();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (($(\"#SWLockStr\"+cardchar).html() == \"OFF\" && $(\"#SWLock\"+cardchar).prop(\"checked\")) || ($(\"#SWLockStr\"+cardchar).html() == \"ON\" && !$(\"#SWLock\"+cardchar).prop(\"checked\"))) {\n\t\t\t\t\t\t$(\"#ChangeMediaInfoSWLErrorMark\"+cardchar).prop(\"title\",\"Error: 0x\" + Dw2HexString(changeMediaInfoRes.dwErrorCode) + \" \" + errorMsg.toUpperCase());\n\t\t\t\t\t\t$(\"#ChangeMediaInfoSWLErrorMark\"+cardchar).fadeIn();\n\t\t\t\t\t}\n\t\t\t\t\t//console.log(\"changeMediaInfoRes.dwErrorCode = \"+changeMediaInfoRes.dwErrorCode);\n\n\t\t\t\t\t//reset ChangeMediaInfo\n\t\t\t\t\t$(\"#CardDesc\"+cardchar).val(comment);\n\t\t\t\t\tif ($(\"#SWLockStr\"+cardchar).html() == \"ON\") {\n\t\t\t\t\t\t$(\"#SWLock\"+cardchar).prop(\"checked\", true);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$(\"#SWLock\"+cardchar).prop(\"checked\", false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase JS_PREP_MEDIA_FOR_EJECT_RES:\n\t\t\t\tconsole.log(\"get JS_PREP_MEDIA_FOR_EJECT_RES!\");\n\t\t\t\t//Read data and save it in \"mediaEjectRes\"\n\t\t\t\tvar mediaEjectRes = new PrepareMediaForEjectionRes();\n\t\t\t\tmediaEjectRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//Update on Web Interface\n\t\t\t\tif (mediaEjectRes.owGUID == $(\"#GUIDA\").html()) {\n\t\t\t\t\tcardchar = \"A\";\n\t\t\t\t} else if (mediaEjectRes.owGUID == $(\"#GUIDB\").html()) {\n\t\t\t\t\tcardchar = \"B\";\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(\"No match for GUID in JS_PREP_MEDIA_FOR_EJECT_RES!\");\n\t\t\t\t}\n\n\t\t\t\tif (mediaEjectRes.dwErrorCode != 0) {\n\t\t\t\t\t//var errorMsg = parseErrorCode(mediaEjectRes.dwErrorCode);\n\t\t\t\t\t//document.getElementById(\"CardError\"+cardchar).innerHTML = \"EJECT - 0x\" + Dw2HexString(mediaEjectRes.dwErrorCode) + \" \" + errorMsg.toUpperCase();\n\t\t\t\t\tupdateCardErrorMsg(cardchar, \"EJECT\", mediaEjectRes.dwErrorCode);\n\t\t\t\t\tconsole.log(\"mediaEjectRes.dwErrorCode = \"+mediaEjectRes.dwErrorCode);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase JS_MEDIA_INFO_CHANGE_NOTIFY:\n\t\t\t\tconsole.log(\"get MEDIA_INFO_CHANGE_NOTIFY!\");\n\t\t\t\t//Read data and save it in \"mediaInfoChangeNoti\"\n\t\t\t\tvar mediaInfoChangeNoti = new CardMediaInfoChangedNotification();\n\t\t\t\tmediaInfoChangeNoti.Read(dv, indata, MsgHeader.Size);\n\n\t\t\t\t//console.log(MediaInfoCNFlags & CMIC_FLAGS_MEDIA_IN_USE_MASK);//Flags(bit 0)-Media in use\n\t\t\t\t//console.log(MediaInfoCNFlags & CMIC_FLAGS_MEDIA_IS_PHYSICALLY_WRITE_PROTECTED_MASK);//Flags(bit 1)-Media is physically write-protected\n\t\t\t\t//console.log(MediaInfoCNFlags & CMIC_FLAGS_MEDIA_IS_SOFTWARE_WRITE_PROTECTED_MASK);//Flags(bit 2)-Media is software write protected\n\t\t\t\t//console.log(MediaInfoCNFlags & CMIC_FLAGS_MEDIA_QUIESCE_MASK);//Flags(bit 3)-quiesce in progress\n\n\t\t\t\t//Update on Web Interface\n\t\t\t\t//console.log(\"mediaInfoChangeNoti.dwSectorSize:\"+mediaInfoChangeNoti.dwSectorSize);\n\n\t\t\t\t//CardNumber 0x01 for card A and 0x02 for card B\n\t\t\t\tif (mediaInfoChangeNoti.dwCardNumber == 1) {\n\t\t\t\t\tcardchar = \"A\";\n\t\t\t\t\tcardcharPeer = \"B\";\n\t\t\t\t} else if (mediaInfoChangeNoti.dwCardNumber == 2) {\n\t\t\t\t\tcardchar = \"B\";\n\t\t\t\t\tcardcharPeer = \"A\";\n\t\t\t\t} else {\n\n\t\t\t\t}\n\n\t\t\t\tvar cardStatus = \"\";\n\t\t\t\tswitch(mediaInfoChangeNoti.dwReasonCode) {\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\tcardStatus = \"NEW CONNECTION\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tcardStatus = \"CARD INSERTED\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tcardStatus = \"CARD REMOVED\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tcardStatus = \"CHANGED BY REQUEST\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\tcardStatus = \"PARTITION MOUNTED\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 5:\n\t\t\t\t\t\tcardStatus = \"PARTITION DISMOUNTED\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 6:\n\t\t\t\t\t\tcardStatus = \"MEDIA EJECT REQUESTED\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 7:\n\t\t\t\t\t\tcardStatus = \"CARD UNRECOGNIZED\";\n\t\t\t\t\t\tif ($(\"#GUID\"+cardcharPeer).html()!=\"\" && $(\"#GUID\"+cardcharPeer).html()!=\"00000000000000000000000000000000\") {\n\t\t\t\t\t\t\tif ($(\"#RAIDTypeStr\"+cardcharPeer).html()==\"Mirror\") {\n\t\t\t\t\t\t\t\t$(\"#syncBtn\"+cardchar).show();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcardStatus = \"UNKNOWN STATUS\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\n\t\t\t\t//check card HW lock flag\n\t\t\t\tif ((mediaInfoChangeNoti.dwFlags & CMIC_FLAGS_MEDIA_IS_PHYSICALLY_WRITE_PROTECTED_MASK) != 0) {\n\n\t\t\t\t\tdocument.getElementById(\"HWLock\"+cardchar).checked = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdocument.getElementById(\"HWLock\"+cardchar).checked = false;\n\n\t\t\t\t}\n\n\t\t\t\t//check card SW lock flag\n\t\t\t\tif ((mediaInfoChangeNoti.dwFlags & CMIC_FLAGS_MEDIA_IS_SOFTWARE_WRITE_PROTECTED_MASK) != 0) {\n\n\t\t\t\t\t$(\"#SWLock\"+cardchar).prop(\"checked\" ,true);\n\t\t\t\t\t$(\"#SWLockStr\"+cardchar).html(\"ON\");\n\n\t\t\t\t} else {\n\n\t\t\t\t\t$(\"#SWLock\"+cardchar).prop(\"checked\" ,false);\n\t\t\t\t\t$(\"#SWLockStr\"+cardchar).html(\"OFF\");\n\n\t\t\t\t}\n\n\t\t\t\t//check isPrimary flag\n\t\t\t\tif ((mediaInfoChangeNoti.dwFlags & CMIC_FLAGS_MEDIA_IS_PRIMARY_MIRROR_MASK) != 0) {\n\t\t\t\t\t$(\"#isPrimary\"+cardchar).html(\"YES\");\n\t\t\t\t} else {\n\t\t\t\t\t$(\"#isPrimary\"+cardchar).html(\"NO\");\n\t\t\t\t}\n\n\t\t\t\t//update MediaSize\n\t\t\t\tif (mediaInfoChangeNoti.cbySizeOfMedia >= Math.pow(2,30)) {\n\n\t\t\t\t\tdocument.getElementById(\"mediaSize\"+cardchar).innerHTML = (mediaInfoChangeNoti.cbySizeOfMedia/Math.pow(2,30)).toFixed(2) + \" GB\";\n\t\t\t\t\t$(\"#cardSize\"+cardchar).html(mediaInfoChangeNoti.cbySizeOfMedia);\n\n\t\t\t\t} else if (mediaInfoChangeNoti.cbySizeOfMedia >= Math.pow(2,20)) {\n\n\t\t\t\t\tdocument.getElementById(\"mediaSize\"+cardchar).innerHTML = (mediaInfoChangeNoti.cbySizeOfMedia/Math.pow(2,20)).toFixed(2) + \" MB\";\n\t\t\t\t\t$(\"#cardSize\"+cardchar).html(mediaInfoChangeNoti.cbySizeOfMedia);\n\n\t\t\t\t} else if (mediaInfoChangeNoti.cbySizeOfMedia >= Math.pow(2,10)) {\n\n\t\t\t\t\tdocument.getElementById(\"mediaSize\"+cardchar).innerHTML = (mediaInfoChangeNoti.cbySizeOfMedia/Math.pow(2,10)).toFixed(2) + \" KB\";\n\t\t\t\t\t$(\"#cardSize\"+cardchar).html(mediaInfoChangeNoti.cbySizeOfMedia);\n\n\t\t\t\t} else if (mediaInfoChangeNoti.cbySizeOfMedia >= 0) {\n\n\t\t\t\t\tdocument.getElementById(\"mediaSize\"+cardchar).innerHTML = (mediaInfoChangeNoti.cbySizeOfMedia).toFixed(2) + \" B\";\n\t\t\t\t\t$(\"#cardSize\"+cardchar).html(mediaInfoChangeNoti.cbySizeOfMedia);\n\n\t\t\t\t}\n\t\t\t\t//console.log(\"mediaInfoChangeNoti.cbySizeOfMedia=\"+mediaInfoChangeNoti.cbySizeOfMedia);\n\t\t\t\t//console.log(\"mediaInfoChangeNoti.dwSectorSize=\"+mediaInfoChangeNoti.dwSectorSize);\n\n\t\t\t\t//update RAID Type\n\t\t\t\tif (mediaInfoChangeNoti.dwRAIDType == 0) {\n\n\t\t\t\t\tdocument.getElementById(\"RAIDType\"+cardchar).selectedIndex = 1;\n\t\t\t\t\t$(\"#RAIDTypeStr\"+cardchar).html(\"JBOD\");\n\t\t\t\t\t$(\"#syncBtn\"+cardcharPeer).hide();\n\n\t\t\t\t} else if (mediaInfoChangeNoti.dwRAIDType == 1) {\n\n\t\t\t\t\tdocument.getElementById(\"RAIDType\"+cardchar).selectedIndex = 2;\n\t\t\t\t\t$(\"#RAIDTypeStr\"+cardchar).html(\"Mirror\");\n\t\t\t\t\tif ($(\"#GUID\"+cardcharPeer).html()!=\"\" && $(\"#GUID\"+cardcharPeer).html()!=\"00000000000000000000000000000000\") {\n\t\t\t\t\t\t$(\"#syncBtn\"+cardcharPeer).show();\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\t//unknow RAID type\n\n\t\t\t\t}\n\n\t\t\t\tdocument.getElementById(\"GUID\"+cardchar).innerHTML = mediaInfoChangeNoti.owCardGUID;\n\t\t\t\tdocument.getElementById(\"manString\"+cardchar).innerHTML = mediaInfoChangeNoti.achManufacturer;\n\t\t\t\tdocument.getElementById(\"CardDesc\"+cardchar).value = decodeURI(mediaInfoChangeNoti.achUserComment);\n\t\t\t\tdocument.getElementById(\"userComment\"+cardchar).innerHTML = decodeURI(mediaInfoChangeNoti.achUserComment);\n\t\t\t\t//document.getElementById(\"CardError\"+cardchar).innerHTML = \"\";\n\t\t\t\tclearCardErrorMsg(cardchar);\n\t\t\t\tdocument.getElementById(\"CardStatus\"+cardchar).innerHTML = cardStatus;\n\t\t\t\t$(\"#CardStatus\"+cardchar).effect(\"pulsate\",{times:1},1500);\n\n\t\t\t\tif (mediaInfoChangeNoti.dwSectorSize != 0) {\n\t\t\t\t\t//card is present\n\n\t\t\t\t\tif (mediaInfoChangeNoti.dwReasonCode == 2) {\n\t\t\t\t\t\t//card status is removed, disable all operations on card\n\t\t\t\t\t\tdocument.getElementById(\"RAIDType\"+cardchar).disabled = true;\n\t\t\t\t\t\tdocument.getElementById(\"SWLock\"+cardchar).disabled = true;\n\t\t\t\t\t\tdocument.getElementById(\"CardDesc\"+cardchar).disabled = true;\n\t\t\t\t\t\tdocument.getElementById(\"BtnWipe\"+cardchar).disabled = true;\n\t\t\t\t\t\tdocument.getElementById(\"BtnDefrag\"+cardchar).disabled = true;\n\t\t\t\t\t\tdocument.getElementById(\"BtnEject\"+cardchar).disabled = true;\n\n\t\t\t\t\t} else if (mediaInfoChangeNoti.dwReasonCode == 7) {\n\t\t\t\t\t\t//card status is unrecognized, disable all operations except wipe and eject\n\t\t\t\t\t\tdocument.getElementById(\"RAIDType\"+cardchar).disabled = true;\n\t\t\t\t\t\tdocument.getElementById(\"SWLock\"+cardchar).disabled = true;\n\t\t\t\t\t\tdocument.getElementById(\"CardDesc\"+cardchar).disabled = true;\n\t\t\t\t\t\tdocument.getElementById(\"BtnWipe\"+cardchar).disabled = false;\n\t\t\t\t\t\tdocument.getElementById(\"BtnDefrag\"+cardchar).disabled = true;\n\t\t\t\t\t\tdocument.getElementById(\"BtnEject\"+cardchar).disabled = false;\n\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tdocument.getElementById(\"RAIDType\"+cardchar).disabled = false;\n\t\t\t\t\t\tdocument.getElementById(\"SWLock\"+cardchar).disabled = false;\n\t\t\t\t\t\tdocument.getElementById(\"CardDesc\"+cardchar).disabled = false;\n\t\t\t\t\t\tdocument.getElementById(\"BtnWipe\"+cardchar).disabled = false;\n\t\t\t\t\t\tdocument.getElementById(\"BtnDefrag\"+cardchar).disabled = false;\n\t\t\t\t\t\tdocument.getElementById(\"BtnEject\"+cardchar).disabled = false;\n\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//card is not present\n\n\t\t\t\t\t//display default RAID type\n\t\t\t\t\tdocument.getElementById(\"RAIDType\"+cardchar).selectedIndex = 0;\n\t\t\t\t\t$(\"#RAIDTypeStr\"+cardchar).html(\"---\");\n\t\t\t\t\t//hide mirror sync\n\t\t\t\t\t$(\"#syncBtnA\").hide();\n\t\t\t\t\t$(\"#syncBtnB\").hide();\n\t\t\t\t\t//no operation is allowed\n\t\t\t\t\tdocument.getElementById(\"RAIDType\"+cardchar).disabled = true;\n\t\t\t\t\tdocument.getElementById(\"SWLock\"+cardchar).disabled = true;\n\t\t\t\t\tdocument.getElementById(\"CardDesc\"+cardchar).disabled = true;\n\t\t\t\t\tdocument.getElementById(\"BtnWipe\"+cardchar).disabled = true;\n\t\t\t\t\tdocument.getElementById(\"BtnDefrag\"+cardchar).disabled = true;\n\t\t\t\t\tdocument.getElementById(\"BtnEject\"+cardchar).disabled = true;\n\n\t\t\t\t\t//reset upload/download offset area\n\t\t\t\t\tvar cardnum = 0;\n\t\t\t\t\tif (cardchar == \"A\") {\n\t\t\t\t\t\tcardnum = 1;\n\t\t\t\t\t} else if (cardchar == \"B\") {\n\t\t\t\t\t\tcardnum = 2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log(\"MediaChangeInfo error, cardchar=\"+ cardchar);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (var i=0; i<MAX_PARTITION_PER_CARD; i++) {\n\t\t\t\t\t\t$(\"#uploadFileStart\"+cardnum+i).html(0);\n\t\t\t\t\t\t$(\"#uploadOffset\"+cardnum+i).html(0);\n\t\t\t\t\t\t//$(\"#uploadFileSize\"+cardnum+i).html(0); //The file size will get updated every time an upload is issued.\n\t\t\t\t\t\t$(\"#downloadOffset\"+cardnum+i).html(0);\n\t\t\t\t\t}\n\n\t\t\t\t\t//ignore card status in MediaChangeInfo notification\n\t\t\t\t\tdocument.getElementById(\"CardStatus\"+cardchar).innerHTML = \"CARD NOT PRESENT\";\n\t\t\t\t}\n\n\n\t\t\t\t$(\"#CMediaInfo\"+cardchar).fadeOut();\n\t\t\t\t$(\"#confirmConvertRAIDType\"+cardchar).fadeOut();\n\n\t\t\t\tbreak;\n\n\t\t\tcase JS_DEL_PART_RES:\n\t\t\t\tconsole.log(\"get JS_DEL_PART_RES!\");\n\t\t\t\t//Read data and save it in \"deletePartRes\"\n\t\t\t\tvar deletePartRes = new DeletePartitionRes();\n\t\t\t\tdeletePartRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//Update on Web Interface\n\t\t\t\t//console.log(\"deletePartRes.owPUID = \"+deletePartRes.owPUID);\n\t\t\t\tPUIDindex = getPUIDindex(deletePartRes.owPUID);\n\t\t\t\tif (deletePartRes.dwErrorCode != 0){\n\t\t\t\t\terrorMsg = parseErrorCode(deletePartRes.dwErrorCode);\n\t\t\t\t\t$(\"#partActError\"+PUIDindex).html(\"ErrorCode: 0x\" + Dw2HexString(deletePartRes.dwErrorCode) + \"  \" + errorMsg.toUpperCase());\n\t\t\t\t} else {\n\t\t\t\t\t//clear partition activity error message\n\t\t\t\t\t$(\"#partActError\"+PUIDindex).html(\"\");\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tcase JS_BREAK_MIRROR_RES:\n\t\t\t\tconsole.log(\"get JS_BREAK_MIRROR_RES!\");\n\t\t\t\t//Read data and save it in \"breakMirrorRes\"\n\t\t\t\tvar breakMirrorRes = new BreakMirrorRes();\n\t\t\t\tbreakMirrorRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//Update on Web Interface\n\n\t\t\t\t/*process data\n\t\t\t\tconsole.log(dv.getUint32(16,true) + dv.getUint32(20,true) * Math.pow(2,32));//owPUID\n\t\t\t\tconsole.log(dv.getUint32(32,true));//dwErrorCode\n\t\t\t\t*/\n\t\t\t\tbreak;\n\t\t\tcase JS_PART_PROGRESS_NOTIFY:\n\t\t\t\tconsole.log(\"get JS_PART_PROGRESS_NOTIFY!\");\n\t\t\t\t//Read data and save it in \"partProgNoti\"\n\t\t\t\tvar partProgNoti = new PartitionProgressNotification();\n\t\t\t\tpartProgNoti.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//Update on Web Interface\n\t\t\t\tPUIDindex = getPUIDindex(partProgNoti.owPUID);\n\n\t\t\t\t//console.log(\"partProgNoti.dwCommand:\"+partProgNoti.dwCommand);\n\t\t\t\t//console.log(\"partProgNoti.dwFlags:\"+partProgNoti.dwFlags);\n\n\t\t\t\tif (PUIDindex != \"\") {\n\n\t\t\t\t\t//while partition operation is in progress, receive PartitionListUpdateNotification.\n\t\t\t\t\t//Then progress bar for both mirror and its peer will show up. Only one is needed.\n\t\t\t\t\tif ($(\"#partType\"+PUIDindex).html() == \"Mirror\") {\n\t\t\t\t\t\tvar PeerPUID = $(\"#PeerPUIDStr\"+PUIDindex).html();\n\t\t\t\t\t\tvar PeerPUIDindex = getPUIDindex(PeerPUID);\n\t\t\t\t\t\t//hide peer partition progress bar if it's displayed\n\t\t\t\t\t\tif (document.getElementById(\"partProgArea\"+PeerPUIDindex).style.display != \"none\") {\n\t\t\t\t\t\t\tdocument.getElementById(\"partProgArea\"+PeerPUIDindex).style.display = \"none\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\n\t\t\t\t\tif (partProgNoti.dwErrorCode == 0) {\n\n\t\t\t\t\t\t//clear error message\n\t\t\t\t\t\t$(\"#partActError\"+PUIDindex).html(\"\");\n\n\t\t\t\t\t\tpercentage = 100*partProgNoti.dwOperationCompleted/partProgNoti.dwOperationRequired;\n\n\t\t\t\t\t\tswitch(partProgNoti.dwCommand) {\n\t\t\t\t\t\t\tcase JS_REBUILD_PART_REQ:\n\t\t\t\t\t\t\t\tconsole.log(\"value:\"+partProgNoti.dwOperationCompleted+\":\"+partProgNoti.dwOperationRequired);\n\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).html(\"Rebuilding \"+percentage.toFixed(2).slice(0,-3)+\"%\");\n\t\t\t\t\t\t\t\t$(\"#partProgCmd\"+PUIDindex).html(JS_REBUILD_PART_REQ);\n\t\t\t\t\t\t\t\tif (partProgNoti.dwOperationCompleted < partProgNoti.dwOperationRequired) {\n\n\t\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).width(percentage+\"%\");\n\n\t\t\t\t\t\t\t\t} else if (partProgNoti.dwOperationCompleted == partProgNoti.dwOperationRequired) {\n\n\t\t\t\t\t\t\t\t\t$(\"#partProgArea\"+PUIDindex).hide();\n\t\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).width(\"0%\");\n\t\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).html(\"\");\n\t\t\t\t\t\t\t\t\t$(\"#partProgCmd\"+PUIDindex).html(\"\");\n\n\t\t\t\t\t\t\t\t\t//enable partition activity list\n\t\t\t\t\t\t\t\t\t$(\"#actOptionDelete\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionDelete\"+PUIDindex).onclick = function(){showConfirmDelete(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionFormat\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionFormat\"+PUIDindex).onclick = function(){showConfirmFormat(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionRebuild\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionRebuild\"+PUIDindex).onclick = function(){showConfirmRebuild(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionResize\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionResize\"+PUIDindex).onclick = function(){showConfirmResize(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionVerify\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionVerify\"+PUIDindex).onclick = function(){showConfirmVerify(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionShareUnshare\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tif ($(\"#actOptionShareUnshare\"+PUIDindex).html().trim() == \"Share\") {\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionShareUnshare\"+PUIDindex).onclick = function(){showConfirmShare(PUIDindex);};\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionShareUnshare\"+PUIDindex).onclick = function(){showConfirmUnshare(PUIDindex);};\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tArrowPosition(ACT_IDLE, PUIDindex);\n\t\t\t\t\t\t\t\t\t$('#arrow'+PUIDindex).fadeTo(1000,1);\n\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t//step info error\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase JS_FORMAT_PART_REQ:\n\t\t\t\t\t\t\t\tconsole.log(\"value:\"+partProgNoti.dwOperationCompleted+\":\"+partProgNoti.dwOperationRequired);\n\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).html(\"Formatting \"+percentage.toFixed(2).slice(0,-3)+\"%\");\n\t\t\t\t\t\t\t\t$(\"#partProgCmd\"+PUIDindex).html(JS_FORMAT_PART_REQ);\n\t\t\t\t\t\t\t\tif (partProgNoti.dwOperationCompleted < partProgNoti.dwOperationRequired) {\n\n\t\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).width(percentage+\"%\");\n\n\t\t\t\t\t\t\t\t} else if (partProgNoti.dwOperationCompleted == partProgNoti.dwOperationRequired) {\n\n\t\t\t\t\t\t\t\t\t$(\"#partProgArea\"+PUIDindex).hide();\n\t\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).width(\"0%\");\n\t\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).html(\"\");\n\t\t\t\t\t\t\t\t\t$(\"#partProgCmd\"+PUIDindex).html(\"\");\n\n\t\t\t\t\t\t\t\t\t//enable partition activity list\n\t\t\t\t\t\t\t\t\t$(\"#actOptionDelete\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionDelete\"+PUIDindex).onclick = function(){showConfirmDelete(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionFormat\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionFormat\"+PUIDindex).onclick = function(){showConfirmFormat(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionRebuild\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionRebuild\"+PUIDindex).onclick = function(){showConfirmRebuild(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionResize\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionResize\"+PUIDindex).onclick = function(){showConfirmResize(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionVerify\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionVerify\"+PUIDindex).onclick = function(){showConfirmVerify(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionShareUnshare\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tif ($(\"#actOptionShareUnshare\"+PUIDindex).html().trim() == \"Share\") {\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionShareUnshare\"+PUIDindex).onclick = function(){showConfirmShare(PUIDindex);};\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionShareUnshare\"+PUIDindex).onclick = function(){showConfirmUnshare(PUIDindex);};\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tArrowPosition(ACT_IDLE, PUIDindex);\n\t\t\t\t\t\t\t\t\t$('#arrow'+PUIDindex).fadeTo(1000,1);\n\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t//step info error\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase JS_RESIZE_PART_REQ:\n\t\t\t\t\t\t\t\tconsole.log(\"value:\"+partProgNoti.dwOperationCompleted+\":\"+partProgNoti.dwOperationRequired);\n\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).html(\"Resizing \"+percentage.toFixed(2).slice(0,-3)+\"%\");\n\t\t\t\t\t\t\t\t$(\"#partProgCmd\"+PUIDindex).html(JS_RESIZE_PART_REQ);\n\t\t\t\t\t\t\t\tif (partProgNoti.dwOperationCompleted < partProgNoti.dwOperationRequired) {\n\n\t\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).width(percentage+\"%\");\n\n\t\t\t\t\t\t\t\t} else if (partProgNoti.dwOperationCompleted == partProgNoti.dwOperationRequired) {\n\n\t\t\t\t\t\t\t\t\t$(\"#partProgArea\"+PUIDindex).hide();\n\t\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).width(\"0%\");\n\t\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).html(\"\");\n\t\t\t\t\t\t\t\t\t$(\"#partProgCmd\"+PUIDindex).html(\"\");\n\n\t\t\t\t\t\t\t\t\t//enable partition activity list\n\t\t\t\t\t\t\t\t\t$(\"#actOptionDelete\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionDelete\"+PUIDindex).onclick = function(){showConfirmDelete(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionFormat\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionFormat\"+PUIDindex).onclick = function(){showConfirmFormat(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionRebuild\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionRebuild\"+PUIDindex).onclick = function(){showConfirmRebuild(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionResize\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionResize\"+PUIDindex).onclick = function(){showConfirmResize(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionVerify\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionVerify\"+PUIDindex).onclick = function(){showConfirmVerify(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionShareUnshare\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tif ($(\"#actOptionShareUnshare\"+PUIDindex).html().trim() == \"Share\") {\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionShareUnshare\"+PUIDindex).onclick = function(){showConfirmShare(PUIDindex);};\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionShareUnshare\"+PUIDindex).onclick = function(){showConfirmUnshare(PUIDindex);};\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tArrowPosition(ACT_IDLE, PUIDindex);\n\t\t\t\t\t\t\t\t\t$('#arrow'+PUIDindex).fadeTo(1000,1);\n\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t//step info error\n\t\t\t\t\t\t\t\t\tconsole.log(\"Error: partProgNoti.dwOperationCompleted > partProgNoti.dwOperationRequired\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase JS_VERIFY_PART_REQ:\n\t\t\t\t\t\t\t\t//console.log(\"value:\"+partProgNoti.dwOperationCompleted+\":\"+partProgNoti.dwOperationRequired);\n\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).html(\"Verifying \"+percentage.toFixed(2).slice(0,-3)+\"%\");\n\t\t\t\t\t\t\t\t$(\"#partProgCmd\"+PUIDindex).html(JS_VERIFY_PART_REQ);\n\t\t\t\t\t\t\t\tif (partProgNoti.dwOperationCompleted < partProgNoti.dwOperationRequired) {\n\n\t\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).width(percentage+\"%\");\n\n\t\t\t\t\t\t\t\t} else if (partProgNoti.dwOperationCompleted == partProgNoti.dwOperationRequired) {\n\n\t\t\t\t\t\t\t\t\t$(\"#partProgArea\"+PUIDindex).hide();\n\t\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).width(\"0%\");\n\t\t\t\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).html(\"\");\n\t\t\t\t\t\t\t\t\t$(\"#partProgCmd\"+PUIDindex).html(\"\");\n\n\t\t\t\t\t\t\t\t\t//enable partition activity list\n\t\t\t\t\t\t\t\t\t$(\"#actOptionDelete\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionDelete\"+PUIDindex).onclick = function(){showConfirmDelete(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionFormat\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionFormat\"+PUIDindex).onclick = function(){showConfirmFormat(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionRebuild\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionRebuild\"+PUIDindex).onclick = function(){showConfirmRebuild(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionResize\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionResize\"+PUIDindex).onclick = function(){showConfirmResize(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionVerify\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionVerify\"+PUIDindex).onclick = function(){showConfirmVerify(PUIDindex);};\n\t\t\t\t\t\t\t\t\t$(\"#actOptionShareUnshare\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\t\t\t\tif ($(\"#actOptionShareUnshare\"+PUIDindex).html().trim() == \"Share\") {\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionShareUnshare\"+PUIDindex).onclick = function(){showConfirmShare(PUIDindex);};\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById(\"actOptionShareUnshare\"+PUIDindex).onclick = function(){showConfirmUnshare(PUIDindex);};\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tArrowPosition(ACT_IDLE, PUIDindex);\n\t\t\t\t\t\t\t\t\t$('#arrow'+PUIDindex).fadeTo(1000,1);\n\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t//step info error\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tconsole.log(\"Command in Partition Progress Notification is not recognized!!!\");\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//error code is not zero\n\t\t\t\t\t\tconsole.log(\"partProgress ErrorCode:\"+partProgNoti.dwErrorCode);\n\n\t\t\t\t\t\t//reset progress bar\n\t\t\t\t\t\t$(\"#partProgArea\"+PUIDindex).hide();\n\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).width(\"0%\");\n\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).html(\"\");\n\t\t\t\t\t\t$(\"#partProgCmd\"+PUIDindex).html(\"\");\n\n\t\t\t\t\t\t//enable partition activity list\n\t\t\t\t\t\t$(\"#actOptionDelete\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\tdocument.getElementById(\"actOptionDelete\"+PUIDindex).onclick = function(){showConfirmDelete(PUIDindex);};\n\t\t\t\t\t\t$(\"#actOptionFormat\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\tdocument.getElementById(\"actOptionFormat\"+PUIDindex).onclick = function(){showConfirmFormat(PUIDindex);};\n\t\t\t\t\t\t$(\"#actOptionRebuild\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\tdocument.getElementById(\"actOptionRebuild\"+PUIDindex).onclick = function(){showConfirmRebuild(PUIDindex);};\n\t\t\t\t\t\t$(\"#actOptionResize\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\tdocument.getElementById(\"actOptionResize\"+PUIDindex).onclick = function(){showConfirmResize(PUIDindex);};\n\t\t\t\t\t\t$(\"#actOptionVerify\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\tdocument.getElementById(\"actOptionVerify\"+PUIDindex).onclick = function(){showConfirmVerify(PUIDindex);};\n\t\t\t\t\t\t$(\"#actOptionShareUnshare\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\tif ($(\"#actOptionShareUnshare\"+PUIDindex).html().trim() == \"Share\") {\n\t\t\t\t\t\t\tdocument.getElementById(\"actOptionShareUnshare\"+PUIDindex).onclick = function(){showConfirmShare(PUIDindex);};\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.getElementById(\"actOptionShareUnshare\"+PUIDindex).onclick = function(){showConfirmUnshare(PUIDindex);};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//reset activity arrow\n\t\t\t\t\t\tArrowPosition(ACT_IDLE, PUIDindex);\n\t\t\t\t\t\t$('#arrow'+PUIDindex).fadeTo(1000,1);\n\n\t\t\t\t\t\t//show error message\n\t\t\t\t\t\terrorMsg = parseErrorCode(partProgNoti.dwErrorCode);\n\t\t\t\t\t\t$(\"#partActError\"+PUIDindex).html(\"ErrorCode: 0x\" + Dw2HexString(partProgNoti.dwErrorCode) + \"  \" + errorMsg.toUpperCase());\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//no PUID match, show partProgNoti.dwErrorCode???\n\t\t\t\t\tconsole.log(\"partProgress ErrorCode:\"+partProgNoti.dwErrorCode);\n\t\t\t\t}\n\n\n\t\t\t\tbreak;\n\n\t\t\tcase JS_DEFINE_PART_RES:\n\t\t\t\tconsole.log(\"get JS_DEFINE_PART_RES!\");\n\t\t\t\t//Read data and save it in \"definePartRes\"\n\t\t\t\tvar definePartRes = new DefinePartitionRes();\n\t\t\t\tdefinePartRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//Update on Web Interface\n\t\t\t\tif (definePartRes.owCardGUID == $(\"#GUIDA\").html()) {\n\t\t\t\t\tcardchar = \"A\";\n\t\t\t\t} else if (definePartRes.owCardGUID == $(\"#GUIDB\").html()) {\n\t\t\t\t\tcardchar = \"B\";\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(\"Wrong GUID in DEFINE_PART_RES!\");\n\t\t\t\t}\n\t\t\t\t//console.log(\"definePartRes.owPUID = \"+definePartRes.owPUID);\n\t\t\t\tif (definePartRes.dwErrorCode != 0) {\n\n\t\t\t\t\terrorMsg = parseErrorCode(definePartRes.dwErrorCode);\n\t\t\t\t\t$(\"#definePartErrorMsg\"+cardchar).html( \"ErrorCode: 0x\" + Dw2HexString(definePartRes.dwErrorCode) + \"  \" + errorMsg.toUpperCase() );\n\t\t\t\t} else {\n\t\t\t\t\t$(\"#definePartErrorMsg\"+cardchar).html(\"\");\n\t\t\t\t}\n\n\t\t\t\t//print msg in console\n\t\t\t\t/*console.log(\"GUID:\"+definePartRes.owCardGUID);\n\t\t\t\tconsole.log(\"PUID:\"+definePartRes.owPUID);\n\t\t\t\tconsole.log(\"PeerPUID:\"+definePartRes.owPeerPUID);\n\t\t\t\tconsole.log(\"ErrorCode:\"+definePartRes.dwErrorCode);*/\n\n\t\t\t\tbreak;\n\t\t\tcase JS_SET_PART_OPTIONS_RES:\n\t\t\t\tconsole.log(\"get JS_SET_PART_RES!\");\n\t\t\t\t//Read data and save it in \"setPartRes\"\n\t\t\t\tvar setPartRes = new SetPartitionRes();\n\t\t\t\tsetPartRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//Update on Web Interface\n\t\t\t\tPUIDindex = getPUIDindex(setPartRes.owPUID);\n\n\t\t\t\tif (setPartRes.dwErrorCode != 0) {\n\t\t\t\t\t//reset all partition options\n\t\t\t\t\tResetPartOp(PUIDindex);\n\t\t\t\t\t//show error code\n\t\t\t\t\terrorMsg = parseErrorCode(setPartRes.dwErrorCode);\n\t\t\t\t\t$(\"#SetPartError\"+PUIDindex).html(\"ErrorCode: 0x\" + Dw2HexString(setPartRes.dwErrorCode) + \"  \" + errorMsg.toUpperCase() + \"  \");\n\n\t\t\t\t} else {\n\t\t\t\t\t//succeed\n\t\t\t\t\t$(\"#SetPartError\"+PUIDindex).html(\"\");\n\n\t\t\t\t}\n\t\t\t\t//console.log(\"error code:\"+setPartRes.dwErrorCode);\n\t\t\t\tbreak;\n\t\t\tcase JS_CLAIM_PART_RES:\n\t\t\t\tconsole.log(\"get JS_CLAIM_PART_RES!\");\n\t\t\t\t//Read data and save it in \"claimPartRes\"\n\t\t\t\tvar claimPartRes = new ClaimPartitionRes();\n\t\t\t\tclaimPartRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//Update on Web Interface\n\t\t\t\tPUIDindex = getPUIDindex(claimPartRes.owPUID);\n\n\t\t\t\tif (claimPartRes.dwErrorCode != 0) {\n\t\t\t\t\t//hide update reminder\n\t\t\t\t\t$(\"#updateReminder\"+PUIDindex).hide();\n\t\t\t\t\t//reset claim type\n\t\t\t\t\tif (document.getElementById(\"ClaimType\"+PUIDindex).options[0].defaultSelected) {\n\t\t\t\t\t\tdocument.getElementById(\"ClaimType\"+PUIDindex).selectedIndex = 0;\n\t\t\t\t\t} else if (document.getElementById(\"ClaimType\"+PUIDindex).options[1].defaultSelected) {\n\t\t\t\t\t\tdocument.getElementById(\"ClaimType\"+PUIDindex).selectedIndex = 1;\n\t\t\t\t\t} else if (document.getElementById(\"ClaimType\"+PUIDindex).options[2].defaultSelected) {\n\t\t\t\t\t\tdocument.getElementById(\"ClaimType\"+PUIDindex).selectedIndex = 2;\n\t\t\t\t\t}\n\n\t\t\t\t\t//disable update button\n\t\t\t\t\t$(\"#update\"+PUIDindex).prop(\"disabled\", true);\n\t\t\t\t\t//show error code\n\t\t\t\t\terrorMsg = parseErrorCode(claimPartRes.dwErrorCode);\n\t\t\t\t\t$(\"#SetPartError\"+PUIDindex).html(\"ErrorCode: 0x\" + Dw2HexString(claimPartRes.dwErrorCode) + \"  \" + errorMsg.toUpperCase() + \"  \");\n\n\t\t\t\t} else {\n\t\t\t\t\t//succeed\n\t\t\t\t\t$(\"#SetPartError\"+PUIDindex).html(\"\");\n\n\t\t\t\t}\n\t\t\t\t//console.log(\"claim ErrorCode:\"+claimPartRes.dwErrorCode);\n\n\t\t\t\tbreak;\n\t\t\tcase JS_RELEASE_PART_RES:\n\t\t\t\tconsole.log(\"get JS_RELEASE_PART_RES!\");\n\t\t\t\t//Read data and save it in \"releasePartRes\"\n\t\t\t\tvar releasePartRes = new ReleasePartitionRes();\n\t\t\t\treleasePartRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//Update on Web Interface\n\t\t\t\tPUIDindex = getPUIDindex(releasePartRes.owPUID);\n\t\t\t\tif (releasePartRes.dwErrorCode != 0) {\n\t\t\t\t\t//hide update reminder\n\t\t\t\t\t$(\"#updateReminder\"+PUIDindex).hide();\n\t\t\t\t\t//disable update button\n\t\t\t\t\t$(\"#update\"+PUIDindex).prop(\"disabled\", true);\n\t\t\t\t\t//show error code\n\t\t\t\t\terrorMsg = parseErrorCode(releasePartRes.dwErrorCode);\n\t\t\t\t\t$(\"#SetPartError\"+PUIDindex).html(\"ErrorCode: 0x\" + Dw2HexString(releasePartRes.dwErrorCode) + \"  \" + errorMsg.toUpperCase() + \"  \");\n\n\t\t\t\t\t//console.log(\"releasePartRes.dwErrorCode=\"+releasePartRes.dwErrorCode);\n\t\t\t\t} else {\n\t\t\t\t\t//succeed\n\t\t\t\t\t$(\"#SetPartError\"+PUIDindex).html(\"\");\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tcase JS_SHARE_PART_RES:\n\t\t\t\tconsole.log(\"get JS_SHARE_PART_RES!\");\n\t\t\t\t//Read data and save it in \"sharePartRes\"\n\t\t\t\tvar sharePartRes = new SharePartitionRes();\n\t\t\t\tsharePartRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//Updata on Web Interface\n\n\t\t\t\t//show error message\n\t\t\t\tif (sharePartRes.dwErrorCode != 0) {\n\t\t\t\t\tPUIDindex = getPUIDindex(sharePartRes.owPUID);\n\t\t\t\t\terrorMsg = parseErrorCode(sharePartRes.dwErrorCode);\n\t\t\t\t\t$(\"#partActError\"+PUIDindex).html(\"ErrorCode: 0x\" + Dw2HexString(sharePartRes.dwErrorCode) + \"  \" + errorMsg.toUpperCase());\n\t\t\t\t}\n\t\t\t\t//console.log(\"share ErrorCode:\"+sharePartRes.dwErrorCode);\n\n\t\t\t\tbreak;\n\t\t\tcase JS_UNSHARE_PART_RES:\n\t\t\t\tconsole.log(\"get JS_UNSHARE_PART_RES!\");\n\t\t\t\t//Read data and save it in \"unsharePartRes\"\n\t\t\t\tvar unsharePartRes = new UnsharePartitionRes();\n\t\t\t\tunsharePartRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//Update on Web Interface\n\t\t\t\tif (unsharePartRes.dwErrorCode != 0) {\n\t\t\t\t\tPUIDindex = getPUIDindex(unsharePartRes.owPUID);\n\t\t\t\t\terrorMsg = parseErrorCode(unsharePartRes.dwErrorCode);\n\t\t\t\t\t$(\"#partActError\"+PUIDindex).html(\"ErrorCode: 0x\" + Dw2HexString(unsharePartRes.dwErrorCode) + \"  \" + errorMsg.toUpperCase());\n\t\t\t\t}\n\t\t\t\t//console.log(\"unshare ErrorCode:\"+unsharePartRes.dwErrorCode);\n\n\t\t\t\tbreak;\n\t\t\tcase JS_SD_RAW_REGISTERS_RES:\n\t\t\t\tconsole.log(\"get JS_SD_RAW_REGISTERS_RES!\");\n\t\t\t\t//Read data and save it in \"sdRawRegistersRes\"\n\t\t\t\tvar sdRawRegistersRes = new ReadRawRegistersRes();\n\t\t\t\tsdRawRegistersRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//Update on Web Interface\n\t\t\t\tif (sdRawRegistersRes.dwErrorCode == 0) {\n\n\t\t\t\t\tif (sdRawRegistersRes.owCardGUID == $(\"#GUIDA\").html()) {\n\t\t\t\t\t\tcardchar = \"A\";\n\t\t\t\t\t\tcardcharPeer = \"B\";\n\t\t\t\t\t} else if (sdRawRegistersRes.owCardGUID == $(\"#GUIDB\").html()) {\n\t\t\t\t\t\tcardchar = \"B\";\n\t\t\t\t\t\tcardcharPeer = \"A\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log(\"Wrong GUID in SD_RAW_REGISTERS_RES!\");\n\t\t\t\t\t}\n\n\t\t\t\t\t$(\"#OCR\"+cardchar).html(\"0x\"+Dw2HexString(sdRawRegistersRes.sdRawRegisters.dwOCR));\n\t\t\t\t\t$(\"#CID0\"+cardchar).html(\"0x\"+Dw2HexString(sdRawRegistersRes.sdRawRegisters.dwCID[0]));\n\t\t\t\t\t$(\"#CID1\"+cardchar).html(\"0x\"+Dw2HexString(sdRawRegistersRes.sdRawRegisters.dwCID[1]));\n\t\t\t\t\t$(\"#CID2\"+cardchar).html(\"0x\"+Dw2HexString(sdRawRegistersRes.sdRawRegisters.dwCID[2]));\n\t\t\t\t\t$(\"#CID3\"+cardchar).html(\"0x\"+Dw2HexString(sdRawRegistersRes.sdRawRegisters.dwCID[3]));\n\t\t\t\t\t$(\"#CSD0\"+cardchar).html(\"0x\"+Dw2HexString(sdRawRegistersRes.sdRawRegisters.dwCSD[0]));\n\t\t\t\t\t$(\"#CSD1\"+cardchar).html(\"0x\"+Dw2HexString(sdRawRegistersRes.sdRawRegisters.dwCSD[1]));\n\t\t\t\t\t$(\"#CSD2\"+cardchar).html(\"0x\"+Dw2HexString(sdRawRegistersRes.sdRawRegisters.dwCSD[2]));\n\t\t\t\t\t$(\"#CSD3\"+cardchar).html(\"0x\"+Dw2HexString(sdRawRegistersRes.sdRawRegisters.dwCSD[3]));\n\t\t\t\t\t$(\"#RCA\"+cardchar).html(\"0x\"+Dw2HexString(sdRawRegistersRes.sdRawRegisters.dwRCA));\n\t\t\t\t\t$(\"#DSR\"+cardchar).html(\"0x\"+Dw2HexString(sdRawRegistersRes.sdRawRegisters.dwDSR));\n\t\t\t\t\t$(\"#SCR\"+cardchar).html(\"0x\"+Dw2HexString(sdRawRegistersRes.sdRawRegisters.dwSCR));\n\n\t\t\t\t\t$(\"#RawReg\"+cardchar).fadeIn();\n\t\t\t\t\t$(\"#RawReg\"+cardcharPeer).fadeOut();\n\t\t\t\t\t$(\"#sdRawRegTable\").fadeIn();\n\n\t\t\t\t} else {\n\t\t\t\t\t//error\n\t\t\t\t\tconsole.log(\"sdRawRegistersRes.dwErrorCode:\"+sdRawRegistersRes.dwErrorCode);\n\t\t\t\t\t$(\"#sdRawRegTable\").fadeOut();\n\t\t\t\t\t$(\"#RawRegA\").fadeOut();\n\t\t\t\t\t$(\"#RawRegB\").fadeOut();\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase JS_CANCEL_QUEUED_TASK_RES:\n\t\t\t\tconsole.log(\"get JS_CANCEL_QUEUED_TASK_RES!\");\n\t\t\t\t//Read data and save it in \"cancelQueuedTaskRes\"\n\t\t\t\tvar cancelQueuedTaskRes = new CancelQueuedTaskRes();\n\t\t\t\tcancelQueuedTaskRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//check UID to see if it's GUID\n\t\t\t\tif (cancelQueuedTaskRes.owUID == $(\"#GUIDA\").html()) {\n\t\t\t\t\tcardchar = \"A\";\n\t\t\t\t} else if (cancelQueuedTaskRes.owUID == $(\"#GUIDB\").html()) {\n\t\t\t\t\tcardchar = \"B\";\n\t\t\t\t} else {\n\t\t\t\t\t//UID is not GUID\n\n\t\t\t\t}\n\n\t\t\t\t//Update on Web Interface\n\t\t\t\tif (cardchar == \"A\" || cardchar == \"B\") {\n\t\t\t\t\tif (cancelQueuedTaskRes.dwErrorCode == 0) {\n\t\t\t\t\t\t//hide progress bar\n\t\t\t\t\t\t$(\"#cardProgArea\"+cardchar).hide();\n\n\t\t\t\t\t\t//reset progress bar\n\t\t\t\t\t\t$(\"#cardProg\"+cardchar).width(\"0%\");\n\t\t\t\t\t\t$(\"#cardProg\"+cardchar).html(\"\");\n\t\t\t\t\t\t$(\"#cardProgCmd\"+cardchar).html(\"\");\n\n\t\t\t\t\t\t//enable convert button\n\t\t\t\t\t\t$(\"#confirmConvertRAIDType\"+cardchar).prop(\"disabled\", false);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//var errorMsg = parseErrorCode(cancelQueuedTaskRes.dwErrorCode);\n\t\t\t\t\t\t//document.getElementById(\"CardError\"+cardchar).innerHTML = \"CANCEL - 0x\" + Dw2HexString(cancelQueuedTaskRes.dwErrorCode) + \" \" + errorMsg.toUpperCase();\n\t\t\t\t\t\tupdateCardErrorMsg(cardchar, \"CANCEL\", cancelQueuedTaskRes.dwErrorCode);\n\t\t\t\t\t}\n\t\t\t\t} else if (cardchar == \"\") {\n\t\t\t\t\tPUIDindex = getPUIDindex(cancelQueuedTaskRes.owUID);\n\n\t\t\t\t\tif (cancelQueuedTaskRes.dwErrorCode == 0) {\n\t\t\t\t\t\t//hide progress bar\n\t\t\t\t\t\t$(\"#partProgArea\"+PUIDindex).hide();\n\t\t\t\t\t\t//reset activity arrow position\n\t\t\t\t\t\tArrowPosition(ACT_IDLE, PUIDindex);\n\t\t\t\t\t\t$('#arrow'+PUIDindex).fadeTo(1000,1);\n\t\t\t\t\t\t//reset the progress bar\n\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).width(\"0%\");\n\t\t\t\t\t\t$(\"#partProg\"+PUIDindex).html(\"\");\n\t\t\t\t\t\t$(\"#partProgCmd\"+PUIDindex).html(\"\");\n\n\t\t\t\t\t\t//enable partition activity list\n\t\t\t\t\t\t$(\"#actOptionDelete\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\tdocument.getElementById(\"actOptionDelete\"+PUIDindex).onclick = function(){showConfirmDelete(PUIDindex);};\n\t\t\t\t\t\t$(\"#actOptionFormat\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\tdocument.getElementById(\"actOptionFormat\"+PUIDindex).onclick = function(){showConfirmFormat(PUIDindex);};\n\t\t\t\t\t\t$(\"#actOptionRebuild\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\tdocument.getElementById(\"actOptionRebuild\"+PUIDindex).onclick = function(){showConfirmRebuild(PUIDindex);};\n\t\t\t\t\t\t$(\"#actOptionResize\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\tdocument.getElementById(\"actOptionResize\"+PUIDindex).onclick = function(){showConfirmResize(PUIDindex);};\n\t\t\t\t\t\t$(\"#actOptionVerify\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\tdocument.getElementById(\"actOptionVerify\"+PUIDindex).onclick = function(){showConfirmVerify(PUIDindex);};\n\t\t\t\t\t\t$(\"#actOptionShare\"+PUIDindex).addClass(\"activityOption\");\n\t\t\t\t\t\tif ($(\"#actOptionShareUnshare\"+PUIDindex).html().trim() == \"Share\") {\n\t\t\t\t\t\t\tdocument.getElementById(\"actOptionShareUnshare\"+PUIDindex).onclick = function(){showConfirmShare(PUIDindex);};\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.getElementById(\"actOptionShareUnshare\"+PUIDindex).onclick = function(){showConfirmUnshare(PUIDindex);};\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\terrorMsg = parseErrorCode(cancelQueuedTaskRes.dwErrorCode);\n\t\t\t\t\t\t$(\"#partActError\"+PUIDindex).html(\"ErrorCode: 0x\" + Dw2HexString(cancelQueuedTaskRes.dwErrorCode) + \"  \" + errorMsg.toUpperCase());\n\n\t\t\t\t\t\tconsole.log(\"cancelQueuedTaskRes.dwErrorCode=\"+cancelQueuedTaskRes.dwErrorCode);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase JS_RAID_SETTING_RES:\n\t\t\t\tconsole.log(\"get JS_RAID_SETTING_RES!\");\n\t\t\t\t//Read data and save it in \"RAIDSettingRes\"\n\t\t\t\tvar RAIDSettingRes = new ChangeRAIDSettingRes();\n\t\t\t\tRAIDSettingRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//update on web interface\n\t\t\t\tif (RAIDSettingRes.dwErrorCode == 0) {\n\t\t\t\t\tif ($(\"#SyncSettingStr\").html() == \"ON\") {\n\t\t\t\t\t\t$(\"#SyncSettingStr\").html(\"OFF\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$(\"#SyncSettingStr\").html(\"ON\");\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\terrorMsg = parseErrorCode(RAIDSettingRes.dwErrorCode);\n\t\t\t\t\tdocument.getElementById(\"SyncSettingErrorMsg\").innerHTML = \" ErrorCode: 0x\" + Dw2HexString(RAIDSettingRes.dwErrorCode) + \"  \" + errorMsg.toUpperCase();\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase JS_WRITE_COMPLETE_RES:\n\t\t\t\tconsole.log(\"get JS_WRITE_COMPLETE_RES!\");\n\t\t\t\t//Read data and save it in \"writeCompleteRes\"\n\t\t\t\tvar writeCompleteRes = new StorageWriteCompleteRes();\n\t\t\t\twriteCompleteRes.Read(dv, MsgHeader.Size);\n\n\t\t\t\t//update on Web Interface\n\t\t\t\tPUIDindex = getPUIDindex(writeCompleteRes.owPUID);\n\t\t\t\t//console.log(\"PUID:\"+writeCompleteRes.owPUID);\n\t\t\t\t//console.log(\"PUIDindex:\"+PUIDindex);\n\n\t\t\t\tif (writeCompleteRes.dwErrorCode == 0) {\n\t\t\t\t\tif ($(\"#uploadCancelFlag\"+PUIDindex).html()==\"on\") {\n\t\t\t\t\t\t$(\"#uploadProgArea\"+PUIDindex).css(\"visibility\",\"hidden\");\n\t\t\t\t\t\t$(\"#uploadProg\"+PUIDindex).html(\"\");\n\t\t\t\t\t\t$(\"#uploadProg\"+PUIDindex).width(\"0%\");\n\t\t\t\t\t\t$(\"#uploadFileStart\"+PUIDindex).html(0);\n\t\t\t\t\t\t$(\"#uploadOffset\"+PUIDindex).html(0);\n\t\t\t\t\t\t$(\"#uploadCancelFlag\"+PUIDindex).html(\"\");\n\t\t\t\t\t\tconsole.log(\"Upload cancelled!\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar uploadFiles = document.getElementById(\"uploadFiles\"+ PUIDindex).files;\n\t\t\t\t\t//var uploadFile = uploadFiles[0];\n\t\t\t\t\tvar uploadFileSize = parseInt($(\"#uploadFileSize\"+PUIDindex).html());\n\t\t\t\t\tvar start = parseInt($(\"#uploadFileStart\"+PUIDindex).html());\n\t\t\t\t\t//console.log(\"fileStart:uploadFileSize = \" + start + \":\" + uploadFileSize);\n\t\t\t\t\tpercentage = 100*start/uploadFileSize;\n\t\t\t\t\t$(\"#uploadProg\"+PUIDindex).html(\"Uploading \"+percentage.toFixed(2).slice(0,-3)+\"%\");\n\t\t\t\t\t$(\"#uploadProg\"+PUIDindex).width(percentage+\"%\");\n\n\t\t\t\t\tif ((start < uploadFileSize) && (uploadFiles.length != 0)) {\n\t\t\t\t\t\tsendFileChunk(PUIDindex);\n\t\t\t\t\t} else if (start == uploadFileSize) {\n\n\t\t\t\t\t\t$(\"#uploadProgArea\"+PUIDindex).css(\"visibility\",\"hidden\");\n\t\t\t\t\t\t$(\"#uploadProg\"+PUIDindex).html(\"\");\n\t\t\t\t\t\t$(\"#uploadProg\"+PUIDindex).width(\"0%\");\n\t\t\t\t\t\t$(\"#uploadFileStart\"+PUIDindex).html(0);\n\t\t\t\t\t\t$(\"#uploadOffset\"+PUIDindex).html(0);\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log(\"Error: uploadFiles.length=\"+uploadFiles.length);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//error\n\t\t\t\t\tconsole.log(\"ErrorCode:\"+writeCompleteRes.dwErrorCode);\n\n\t\t\t\t\t$(\"#uploadProgArea\"+PUIDindex).css(\"visibility\",\"hidden\");\n\t\t\t\t\t$(\"#uploadProg\"+PUIDindex).html(\"\");\n\t\t\t\t\t$(\"#uploadProg\"+PUIDindex).width(\"0%\");\n\t\t\t\t\t$(\"#uploadFileStart\"+PUIDindex).html(0);\n\t\t\t\t\t$(\"#uploadOffset\"+PUIDindex).html(0);\n\n\t\t\t\t\terrorMsg = parseErrorCode(writeCompleteRes.dwErrorCode);\n\t\t\t\t\tdocument.getElementById(\"uploadErrorMsg\" + PUIDindex).innerHTML = \"Upload ErrorCode: 0x\" + Dw2HexString(writeCompleteRes.dwErrorCode) + \"  \" + errorMsg.toUpperCase() + \" \";\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase JS_READ_NETWORK_RES:\n\t\t\t\tconsole.log(\"get JS_READ_NETWORK_RES!\");\n\t\t\t\t//Read data and save it in \"readResponseNetwork\"\n\t\t\t\tvar readResponseNetwork = new ReadResponseNetwork();\n\t\t\t\treadResponseNetwork.Read(dv, MsgHeader.Size);\n\t\t\t\t//console.log(\"last:\"+readResponseNetwork.byLastReadFromPartition);\n\t\t\t\t//console.log(\"dwOffsetBySector:\"+readResponseNetwork.cNumOfSectors);\n\t\t\t\tvar isChrome = !!window.chrome && !!window.chrome.webstore;\n\t\t\t\tPUIDindex = getPUIDindex(readResponseNetwork.owPUID);\n\t\t\t\tif (readResponseNetwork.dwErrorCode == 0) {\n\t\t\t\t\tif ($(\"#downloadCancelFlag\"+PUIDindex).html()==\"on\") {\n\t\t\t\t\t\t$(\"#downloadProgArea\"+PUIDindex).css(\"visibility\", \"hidden\");\n\t\t\t\t\t\t$(\"#downloadProg\"+PUIDindex).html(\"\");\n\t\t\t\t\t\t$(\"#downloadProg\"+PUIDindex).width(\"0%\");\n\t\t\t\t\t\t$(\"#downloadOffset\"+PUIDindex).html(0);\n\t\t\t\t\t\tbinaryData = null;\n\t\t\t\t\t\t$(\"#downloadCancelFlag\"+PUIDindex).html();\n\t\t\t\t\t\tconsole.log(\"Download Cancelled!\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar offset = parseInt($(\"#downloadOffset\"+PUIDindex).html());\n\t\t\t\t\tvar AlignedImageSize = parseInt($(\"#partImageSize\"+PUIDindex).html()); //qwImageSizeInBytes is sector size alligned\n\n\t\t\t\t\t//Use upload file size to download file with actual size******************This is just for test purpose, backend should provide actual file size*****************\n\t\t\t\t\tvar imageSize = parseInt($(\"#uploadFileSize\"+PUIDindex).html()); //Actual file size in bytes but will be gone if refresh webpage!\n\n\t\t\t\t\tif (imageSize == 0) {\n\t\t\t\t\t\timageSize = AlignedImageSize;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar data = indata.subarray(48);//test code excludes this line\n\n\n\t\t\t\t\tif (imageSize-offset*SECTOR_SIZE_IN_BYTE<readResponseNetwork.cNumOfSectors*SECTOR_SIZE_IN_BYTE) {\n\t\t\t\t\t\tdata = indata.subarray(48,48+imageSize-offset*SECTOR_SIZE_IN_BYTE);\n\t\t\t\t\t}\n\t\t\t\t\t//************************************test code ends*************************************************************************************************************\n\n\n\t\t\t\t\tif (isChrome) {\n\t\t\t\t\t\t//File system API download*****************\n\t\t\t\t\t\tfileStore(PUIDindex, offset, readResponseNetwork.byLastReadFromPartition, data);\n\t\t\t\t\t\t//*************************************\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t//store data in one large blob\n\t\t\t\t\t\tif ( offset == 0) {\n\t\t\t\t\t\t\tbinaryData = new Blob([data],{type: 'application/octet-stream'});\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbinaryData = new Blob([binaryData,data],{type: 'application/octet-stream'});\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (readResponseNetwork.byLastReadFromPartition == 1) {\n\t\t\t\t\t\t$(\"#downloadProgArea\"+PUIDindex).css(\"visibility\", \"hidden\");\n\t\t\t\t\t\t$(\"#downloadProg\"+PUIDindex).html(\"\");\n\t\t\t\t\t\t$(\"#downloadProg\"+PUIDindex).width(\"0%\");\n\t\t\t\t\t\tif (!isChrome) {\n\t\t\t\t\t\t\twindow.open(URL.createObjectURL(binaryData)); //download file as large blob\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$(\"#downloadOffset\"+PUIDindex).html(0);\n\t\t\t\t\t\tbinaryData = null;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpercentage = 100*offset*SECTOR_SIZE_IN_BYTE/imageSize;\n\t\t\t\t\t\t$(\"#downloadOffset\"+PUIDindex).html(offset+readResponseNetwork.cNumOfSectors);\n\t\t\t\t\t\t$(\"#downloadProg\"+PUIDindex).html(\"Downloading \"+percentage.toFixed(2).slice(0,-3)+\"%\");\n\t\t\t\t\t\t$(\"#downloadProg\"+PUIDindex).width(percentage+\"%\");\n\t\t\t\t\t\tsendStorageReadNetworkReq(PUIDindex);\n\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//error\n\t\t\t\t\tconsole.log(\"ErrorCode:\"+readResponseNetwork.dwErrorCode);\n\n\t\t\t\t\t$(\"#downloadProgArea\"+PUIDindex).css(\"visibility\", \"hidden\");\n\t\t\t\t\t$(\"#downloadProg\"+PUIDindex).html(\"\");\n\t\t\t\t\t$(\"#downloadProg\"+PUIDindex).width(\"0%\");\n\t\t\t\t\t$(\"#downloadOffset\"+PUIDindex).html(0);\n\n\t\t\t\t\terrorMsg = parseErrorCode(readResponseNetwork.dwErrorCode);\n\t\t\t\t\tdocument.getElementById(\"downloadErrorMsg\" + PUIDindex).innerHTML = \"Download ErrorCode: 0x\" + Dw2HexString(readResponseNetwork.dwErrorCode) + \"  \" + errorMsg.toUpperCase();\n\t\t\t\t}\n\n\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\talert(\"Undefined command code number:\"+msgHeader.dwCommand);\n\n\t\t}\n\t};\n\tblobReader.readAsArrayBuffer(evt.data);\n}",
"function handleData(data) {\n console.log(\"[Gateway] >>>>>>>>>>\", data);\n\n\t/** Parse Packet **/\n\t/** Packet format: \"mac_addr:seq_num:msg_id:payload\" **/\n\t// \"source_mac_addr:seq_num:msg_type:num_hops:payload\"\n\tvar components = data.split(':');\n\tif (components.length !== 5) {\n\t\tconsole.error(\"Invalid minimum packet length\");\n\t\treturn;\n\t}\n\tvar macAddress = parseInt(components[0]),\n\t msgId = parseInt(components[2]),\n\t payload = components[4];\n\n\tswitch(msgId) {\n\t\tcase OUTLET_SENSOR_MESSAGE:\n\t\t\treturn handleSensorDataMessage(macAddress, payload);\n\t\tcase OUTLET_ACTION_ACK_MESSAGE:\n\t\t\treturn handleActionAckMessage(macAddress, payload);\n\t\tdefault:\n\t\t\tconsole.error(`Unknown Message type: ${msgId}`);\n\t}\n}",
"onTransportReceiveMsg(messageString) {\n const message = Parser.parseMessage(messageString, this.getLogger(\"sip.parser\"));\n if (!message) {\n this.logger.warn(\"Failed to parse incoming message. Dropping.\");\n return;\n }\n if (this.status === _UAStatus.STATUS_USER_CLOSED && message instanceof IncomingRequestMessage) {\n this.logger.warn(`Received ${message.method} request in state USER_CLOSED. Dropping.`);\n return;\n }\n // A valid SIP request formulated by a UAC MUST, at a minimum, contain\n // the following header fields: To, From, CSeq, Call-ID, Max-Forwards,\n // and Via; all of these header fields are mandatory in all SIP\n // requests.\n // https://tools.ietf.org/html/rfc3261#section-8.1.1\n const hasMinimumHeaders = () => {\n const mandatoryHeaders = [\"from\", \"to\", \"call_id\", \"cseq\", \"via\"];\n for (const header of mandatoryHeaders) {\n if (!message.hasHeader(header)) {\n this.logger.warn(`Missing mandatory header field : ${header}.`);\n return false;\n }\n }\n return true;\n };\n // Request Checks\n if (message instanceof IncomingRequestMessage) {\n // This is port of SanityCheck.minimumHeaders().\n if (!hasMinimumHeaders()) {\n this.logger.warn(`Request missing mandatory header field. Dropping.`);\n return;\n }\n // FIXME: This is non-standard and should be a configruable behavior (desirable regardless).\n // Custom SIP.js check to reject request from ourself (this instance of SIP.js).\n // This is port of SanityCheck.rfc3261_16_3_4().\n if (!message.toTag && message.callId.substr(0, 5) === this.options.sipjsId) {\n this.userAgentCore.replyStateless(message, { statusCode: 482 });\n return;\n }\n // FIXME: This should be Transport check before we get here (Section 18).\n // Custom SIP.js check to reject requests if body length wrong.\n // This is port of SanityCheck.rfc3261_18_3_request().\n const len = str_utf8_length(message.body);\n const contentLength = message.getHeader(\"content-length\");\n if (contentLength && len < Number(contentLength)) {\n this.userAgentCore.replyStateless(message, { statusCode: 400 });\n return;\n }\n }\n // Reponse Checks\n if (message instanceof IncomingResponseMessage) {\n // This is port of SanityCheck.minimumHeaders().\n if (!hasMinimumHeaders()) {\n this.logger.warn(`Response missing mandatory header field. Dropping.`);\n return;\n }\n // Custom SIP.js check to drop responses if multiple Via headers.\n // This is port of SanityCheck.rfc3261_8_1_3_3().\n if (message.getHeaders(\"via\").length > 1) {\n this.logger.warn(\"More than one Via header field present in the response. Dropping.\");\n return;\n }\n // FIXME: This should be Transport check before we get here (Section 18).\n // Custom SIP.js check to drop responses if bad Via header.\n // This is port of SanityCheck.rfc3261_18_1_2().\n if (message.via.host !== this.options.viaHost || message.via.port !== undefined) {\n this.logger.warn(\"Via sent-by in the response does not match UA Via host value. Dropping.\");\n return;\n }\n // FIXME: This should be Transport check before we get here (Section 18).\n // Custom SIP.js check to reject requests if body length wrong.\n // This is port of SanityCheck.rfc3261_18_3_response().\n const len = str_utf8_length(message.body);\n const contentLength = message.getHeader(\"content-length\");\n if (contentLength && len < Number(contentLength)) {\n this.logger.warn(\"Message body length is lower than the value in Content-Length header field. Dropping.\");\n return;\n }\n }\n // Handle Request\n if (message instanceof IncomingRequestMessage) {\n this.userAgentCore.receiveIncomingRequestFromTransport(message);\n return;\n }\n // Handle Response\n if (message instanceof IncomingResponseMessage) {\n this.userAgentCore.receiveIncomingResponseFromTransport(message);\n return;\n }\n throw new Error(\"Invalid message type.\");\n }",
"static brokenMsgHandler (rawMsg, conContext) {\n /*\n * Extract the sequence number from the broken message and send a acknowledge message\n */\n KnxNetProtocolExtra.sendAck(KnxNetProtocolExtra.msgGetSeqnum(rawMsg), conContext)\n }",
"onReceiveError( pdu ) {\n //console.log( 'JCOM1939 RX Error');\n this.rxErrors++;\n }",
"function handleMsg(parsed) {\n // Check the type of this message.\n if (parsed.type === 'APP_MANIFEST_OK' || 'APP_MANIFEST_FAIL') {\n var dependencies = app.manifestCheck(parsed);\n verified = true;\n\n } else if (parsed.type === 'MSG_QUERY') {\n console.log('Query received');\n\n } else if (parsed.type === 'MSG_QUERY_SUCCESS') {\n console.log('Query successful');\n\n } else if (parsed.type === 'MSG_QUERY_FAIL') {\n console.error('Query Failed.');\n throw parsed.data.message;\n\n } else {\n console.log('Message Receieved');\n console.log(' - Type: ' + parsed.type);\n console.log(' - Message:' + JSON.stringify(parsed.data));\n }\n \n if (verified) {\n data = {\n text: \"Pickle Unicorns\",\n targetSpeaker: \"speakers\"\n }\n //app.query(client, 'tts', 'stream', data, ['text2speech'], 30);\n }\n \n if (dependencies) {\n \tif (dependencies.logger == 'up'){\n \t\tapp.up(client);\n \t}\n }\n}",
"static rawMsgHandler (rawMsg, rawMsgJson, conContext) {\n /*\n * Check the type of the message - only TUNNELING_REQUESTs are relevant\n */\n if (rawMsgJson.service_type === KnxConstants.SERVICE_TYPE.TUNNELING_REQUEST) {\n /*\n * Check if this message sets of any custom handlers (see checkCallCustomMsgHandler() below)\n */\n CustomMsgHandlers.checkCallCustomMsgHandler(rawMsgJson, conContext)\n\n if (conContext.handlers) {\n if (conContext.handlers.rawMsgCb) {\n /*\n * Construct the raw bus message and pass it on along with rawMsgJson\n */\n conContext.handlers.rawMsgCb(KnxNetProtocolExtra.rebuildMessageBytes(rawMsg), rawMsgJson)\n }\n }\n }\n }",
"receiveInput(input) {\n input = input.toString();\n if (input.length > 2) {\n throw new Error(\"Invalid input received\");\n } else if (Calc._isNumberInput(input)) {\n this._handleNumberInput(input);\n } else if (Calc._isEqualInput(input)) {\n this._handleEqual();\n } else if (Calc._isResetInput(input)) {\n this._handleReset();\n } else if (Calc._isOperationInput(input)) {\n this._handleOperationInput(input);\n } else {\n throw new Error(\"Invalid input received\");\n }\n }",
"function handleMessage(msgEvent) {\n var ev, h;\n\n try {\n ev = JSON.parse(msgEvent.data);\n } catch (e) {\n $log.error('Message.data is not valid JSON', msgEvent.data, e);\n return null;\n }\n if (fs.debugOn('txrx')) {\n $log.debug(' << *Rx* ', ev.event, ev.payload);\n }\n\n if (h = handlers[ev.event]) {\n try {\n h(ev.payload);\n } catch (e) {\n $log.error('Problem handling event:', ev, e);\n return null;\n }\n } else {\n $log.warn('Unhandled event:', ev);\n }\n\n }",
"function handler(buffer) {\n let chunks = buffer.toString().split(\"\\n\");\n\n for (let chunk of chunks) {\n chunk = chunk.replace(/(\\r\\n|\\n|\\r)/gm, \"\").trim();\n\n if (chunk == \"OK\") {\n // if end of message stop listner and return result\n this.removeListener(\"data\", handler);\n resolve(answer);\n\n // if line is busy or another but not error\n } else if (chunk == \"BUSY\" || chunk == \"NO DIAL TONE\" || chunk == \"NO CARRIER\") {\n resolve();\n\n } else if (chunk == \"ERROR\") {\n this.removeListener(\"data\", handler);\n reject(`ERROR result on command - ${command}. Answer - ${chunk}`);\n\n } else {\n // if message is not fully get add to result this chunk\n answer += chunk;\n };\n };\n }",
"_handle(data) {\n // TODO: json-schema validation of received message- should be pretty straight-forward\n // and will allow better documentation of the API\n let msg;\n try {\n msg = deserialise(data);\n } catch (err) {\n this._logger.push({ data }).log('Couldn\\'t parse received message');\n this.send(build.ERROR.NOTIFY.JSON_PARSE_ERROR());\n }\n this._logger.push({ msg }).log('Handling received message');\n switch (msg.msg) {\n case MESSAGE.CONFIGURATION:\n switch (msg.verb) {\n case VERB.NOTIFY:\n case VERB.PATCH: {\n const dup = JSON.parse(JSON.stringify(this._appConfig)); // fast-json-patch explicitly mutates\n jsonPatch.applyPatch(dup, msg.data);\n this._logger.push({ oldConf: this._appConfig, newConf: dup }).log('Emitting new configuration');\n this.emit(EVENT.RECONFIGURE, dup);\n break;\n }\n default:\n this.send(build.ERROR.NOTIFY.UNSUPPORTED_VERB(msg.id));\n break;\n }\n break;\n default:\n this.send(build.ERROR.NOTIFY.UNSUPPORTED_MESSAGE(msg.id));\n break;\n }\n\n }",
"function HandleData(data)\n{\n var avrNum = this.avrNum;\n if (avrNum == null) {\n Log('Data from unknown device!');\n return;\n }\n var str = data.toString();\n // wait for null at end of string\n var j = str.indexOf('\\0');\n if (j > -1) str = str.substr(0, j); // remove null\n // process each response separately\n var lines = str.split(\"\\n\");\n var id;\n for (j=0; j<lines.length; ++j) {\n var str = lines[j];\n if (!str.length) continue;\n if (str.length >= 4 && str.substr(1,1) == '.') {\n id = str.substr(0,1);\n str = str.substr(2);\n }\n if (id != 'e') {\n if (str.substr(0,2) != 'OK') {\n Log('AVR'+avrNum, 'Bad response:', str);\n continue;\n }\n str = str.substr(3);\n }\n // ignore truncated responses (may happen at startup if commands\n // were sent before AVR was fully initialized)\n if (!id) continue;\n avrOK[avrNum] = 1;\n avrNum = HandleResponse(avrNum, id, str);\n }\n}",
"ondecoded(packet) {\n // the nextTick call prevents an exception in a user-provided event listener from triggering a disconnection due to a \"parse error\"\n nextTick(() => {\n this.emitReserved(\"packet\", packet);\n }, this.setTimeoutFn);\n }",
"handleMessage(message) {\n console.log('lmsDemo2: message received:' + JSON.stringify(message));\n if(message.FromWhom == 'lmsdemo1'){\n this.msgrcvd = message.ValuePass;\n }\n }",
"ondecoded(packet) {\n super.emit(\"packet\", packet);\n }",
"ondecoded(packet) {\n super.emit(\"packet\", packet);\n }",
"ondecoded(packet) {\n super.emit(\"packet\", packet);\n }",
"function incoming(self, packet)\n{\n debug(\"INCOMING\", self.hashname, packet.id, \"packet from\", packet.from.address, packet.js, packet.body && packet.body.toString());\n\n // signed packets must be processed and verified straight away\n if(packet.js.sig) inSig(self, packet);\n\n // make sure any to is us (for multihosting)\n if(packet.js.to)\n {\n if(packet.js.to !== self.hashname) return warn(\"packet for\", packet.js.to, \"is not us\");\n delete packet.js.to;\n }\n\n // copy back their sender name if we don't have one yet for the \"to\" on answers\n if(!packet.from.hashname && dhash.isSHA1(packet.js.from)) packet.from.hashname = packet.js.from;\n\n // these are only valid when requested, no trust needed\n if(packet.js.popped) inPopped(self, packet);\n\n // new line creation\n if(packet.js.open) inOpen(self, packet);\n\n // incoming lines can happen out of order or before their open is verified, queue them\n if(packet.js.line)\n {\n // a matching line is required\n packet.line = packet.from = self.lines[packet.js.line];\n if(!packet.line) return queueLine(self, packet);\n packet.line.recvAt = Date.now();\n delete packet.js.line;\n }\n \n // must decrypt and start over\n if(packet.line && packet.js.cipher)\n {\n debug(\"deciphering!\")\n var aes = crypto.createDecipher(\"AES-128-CBC\", packet.line.openSecret);\n var deciphered = decode(Buffer.concat([aes.update(packet.body), aes.final()]));\n deciphered.id = packet.id + (packet.id * .2);\n deciphered.from = packet.from;\n deciphered.ciphered = true;\n return incoming(self, deciphered);\n }\n\n // any ref must be validated as someone we're connected to\n if(packet.js.ref)\n {\n var ref = seen(self, packet.js.ref);\n if(!ref.line) return warn(\"invalid ref of\", packet.js.ref, \"from\", packet.from);\n packet.ref = ref;\n delete packet.js.ref;\n }\n\n // process the who \"key\" responses since we know the sender best now\n if(packet.js.key) inKey(self, packet);\n\n // answer who/see here so we have the best from info to decide if we care\n if(packet.js.who) inWho(self, packet);\n if(packet.js.see) inSee(self, packet);\n\n // everything else must have some level of from trust!\n if(!packet.line && !packet.signed && !packet.ref) return inApp(self, packet);\n\n if(dhash.isSHA1(packet.js.seek)) inSeek(self, packet);\n if(packet.js.pop) inPop(self, packet);\n\n // now, only proceed if there's a line\n if(!packet.line) return inApp(self, packet);\n\n // these are line-only things\n if(packet.js.popping) inPopping(self, packet);\n\n // only proceed if there's a stream\n if(!packet.js.stream) return inApp(self, packet);\n\n // this makes sure everything is in sequence before continuing\n inStream(self, packet);\n\n}",
"ondecoded(packet) {\n this.emitReserved(\"packet\", packet);\n }",
"function handleMessage(event) {\r\n\t\t//console.log('Received message: ' + event.data);\r\n\t\tvar data = JSON.parse(event.data);\r\n\t\thandleReceiveData(data);\r\n\t}",
"dataMessage () {\n if (this._fin) {\n const messageLength = this._messageLength;\n const fragments = this._fragments;\n\n this._totalPayloadLength = 0;\n this._messageLength = 0;\n this._fragmented = 0;\n this._fragments = [];\n\n if (this._opcode === 2) {\n var data;\n\n if (this._binaryType === 'nodebuffer') {\n data = toBuffer(fragments, messageLength);\n } else if (this._binaryType === 'arraybuffer') {\n data = toArrayBuffer(toBuffer(fragments, messageLength));\n } else {\n data = fragments;\n }\n\n this.onmessage(data);\n } else {\n const buf = toBuffer(fragments, messageLength);\n\n if (!Validation(buf)) {\n this.error(new Error('invalid utf8 sequence'), 1007);\n return;\n }\n\n this.onmessage(buf.toString());\n }\n }\n\n this._state = GET_INFO;\n }",
"ondecoded(packet) {\n this.emitReserved(\"packet\", packet);\n }",
"_onData (data) {\n try {\n const message = JSON.parse(data);\n if (typeof message !== 'object' || !message.type) {\n error('Malformed message:', message);\n return panic('Malformed message');\n }\n this._emit('message', message);\n } catch (e) {\n if (e instanceof SyntaxError) {\n error('Non JSON format:', data, e);\n return panic('Non JSON format');\n }\n throw e;\n }\n }",
"function handleChangedValue(event) {\r\n \t let decoder = new TextDecoder('utf-8');\r\n \t let value = event.target.value\r\n \t var now = new Date()\r\n \t console.log('> ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds() + ' Received message is: ' + decoder.decode(value) );\r\n\t mDebugMsg1(1,'> ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds() + ' Received message is: ' + decoder.decode(value) );\r\n \t receivedValue=value;\r\n\t serial.onReceive(receivedValue);\r\n //\t MessageReceived = receivedValue;\r\n mDebugMsg1(1,\"CONNECTED, Acquiring data\");\r\n \t isBTConnected = true;\r\n }",
"function handleTransmission(data)\n{\n var numMessages = data[0]\n var len = data.length\n var currentIndex = 0\n var currentTransmission = 0\n\n for (var index = 1; index < len; index++)\n {\n var dataItem = data[index]\n if (currentIndex == 0)\n {\n //address\n }\n\n else if (currentIndex == 1)\n {\n //data len\n\n }\n\n else\n {\n //data\n }\n\n }\n\n\n}",
"dataMessage () {\n if (this.fin) {\n const messageLength = this.messageLength;\n const fragments = this.fragments;\n\n this.totalPayloadLength = 0;\n this.messageLength = 0;\n this.fragmented = 0;\n this.fragments = [];\n\n if (this.opcode === 2) {\n var data;\n\n if (this.binaryType === 'nodebuffer') {\n data = toBuffer(fragments, messageLength);\n } else if (this.binaryType === 'arraybuffer') {\n data = toArrayBuffer(toBuffer(fragments, messageLength));\n } else {\n data = fragments;\n }\n\n this.onmessage(data, { masked: this.masked, binary: true });\n } else {\n const buf = toBuffer(fragments, messageLength);\n\n if (!isValidUTF8(buf)) {\n this.error(new Error('invalid utf8 sequence'), 1007);\n return;\n }\n\n this.onmessage(buf.toString(), { masked: this.masked });\n }\n }\n\n this.state = GET_INFO;\n }",
"function onMessageReceived(event){\n\t\ttry{\n\t\t\tvar message = event.data;\n\t\t\tvar json = JSON.parse(message);\n\t\t\t\n\t\t\tif(json.errorMessage){\n\t\t\t\tconsole.log(\"Error message received from server (control unit), error message was: \" + json.errorMessage);\n\t\t\t}else if(json.propertyName && json.propertyValue !== undefined){\n\t\t\t\tsetPropertyValue(json.propertyName, json.propertyValue);\n\t\t\t}else if(json.methodName && json.methodParameters){\n\t\t\t\tcallMethod(json.methodName, json.methodParameters);\n\t\t\t}else{\n\t\t\t\tconsole.log(\"Invalid incoming data from server, expected data to contain propertyName and propertyValue\");\n\t\t\t}\n\t\t}catch(e){\n\t\t\tconsole.log(\"onMessageReceived, Exception occured with message: \" + e.message);\n\t\t\tconsole.log(e.stack);\n\t\t}\n\t}",
"function messageHandler (msg) {\n\ttry {\n\t var command = JSON.parse(msg.getData());\n\t switch (command.Name) {\n\t\tcase 'SetTemperature':\n\t\t var temperatura = command.Parameters.Temperatura;\n\t\t console.log (\"\")\n\t\t console.log (\">>>>>> Receiving command <SetTemperature>. Toggling the relay\");\n\t\t console.log (\"\")\n\t\t relayDevice.toggle ()\n\t\t client.complete(msg, printErrorFor('complete'));\n\t\t break;\n\t\tdefault:\n\t\t console.error('Unknown command: ' + command.Name);\n\t\t client.reject(msg, printErrorFor('complete'));\n\t\t break;\n\t }\n\t}\n\tcatch (err) {\n\t printErrorFor('parse received message')(err);\n\t client.reject(msg, printErrorFor('reject'));\n\t}\n}",
"processSid() {\n let input = this.sid\n resetError(input)\n this.changed = true\n\n if (isEmpty(input)) {\n this.valid = false\n } else if (isNumber(input)) {\n this.valid = false\n } else if (exact(input, 10)) {\n this.valid = false\n } else {\n input.success = true\n this.valid = true\n }\n }"
] |
[
"0.5652895",
"0.55782306",
"0.5489844",
"0.5383237",
"0.52497417",
"0.5247988",
"0.51484007",
"0.5133036",
"0.5129151",
"0.51179457",
"0.5115272",
"0.50902283",
"0.5064763",
"0.4984619",
"0.49633747",
"0.49563098",
"0.49541304",
"0.49541304",
"0.4942457",
"0.49421838",
"0.49414855",
"0.49182817",
"0.49116346",
"0.49076697",
"0.49063158",
"0.4869121",
"0.4856443",
"0.4842748",
"0.48333922",
"0.48326713"
] |
0.5923784
|
0
|
calculate 2s complement checksum over a buffer, starting with a byte index
|
checksum( buf, start, length ) {
let sum = 0;
for( var i = start; i < start+length; i++ ) {
sum = sum + buf[i];
}
return ((~sum)+1) & 0xFF;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function crc(buf){return(updateCrc(-1,buf,buf.length)^-1)>>>0;// u32\n}",
"checksum_buf(com){\n\tvar cs=0;\n\tvar cl=com.length;\n\tfor(var b=0; b<cl-1; b++){\n\t var by=com.readUInt8(b);\n\t var csb = ~by & 0x7F;\n\t cs = cs ^ csb;\n\t}\n\tcom.writeUInt8(cs,cl-1);\n\treturn String.fromCharCode(cs);\n }",
"function performTwosCompliment(buffer) {\n var carry = true;\n var i, newByte, value;\n for (i = buffer.length - 1; i >= 0; --i) {\n value = buffer.readUInt8(i);\n newByte = ~value & 0xff;\n if (carry) {\n carry = newByte === 0xff;\n buffer.writeUInt8(newByte + 1, i);\n } else {\n buffer.writeUInt8(newByte, i);\n }\n }\n}",
"static checksumBuffer(buf, length) {\n let checksum = '';\n let checksum_hex = '';\n for (let i = 0; i < (buf.length / length); i++) {\n checksum_hex = this.read64LE(buf, i);\n checksum = this.sumHex64bits(checksum, checksum_hex).substr(-16);\n }\n return checksum;\n }",
"function checksum(s)\n{\n\t// console.log(\"DEBUT CHECK\");\n\ts = s.replace(/^(.(..)*)$/, \"0$1\"); // add a leading zero if needed\n\n\tvar a = s.match(/../g); // split number in groups of two\n\n\tvar C1 = a[0].charAt(0);\n\tvar C2 = a[0].charAt(1);\n\tfor( var i=1; i<a.length;i++ )\n\t{\n\t\tC1 = xor (C1,a[i].charAt(0).toString(16));\n\t\tC2 = xor (C2,a[i].charAt(1).toString(16));\n\t}\n\t// console.log(\"result :\"+C1.toString(16)+C2.toString(16));\n\t// console.log(\"FIN CHECK\");\n\n\treturn ''+C1.toString(16)+C2.toString(16);\n}",
"function checksum(text) {\n var a = 1, b = 0;\n for (var index = 0; index < text.length; ++index) {\n a = (a + text.charCodeAt(index)) % 65521;\n b = (b + a) % 65521;\n }\n return (b << 16) | a;\n }",
"function updateCrc(crc,buf,len){for(let n=0;n<len;n++){crc=crc>>>8^crcTable[(crc^buf[n])&255]}return crc}",
"function checksum(data) {\n\tvar result = 0;\n\n\tfor (var i = 0; i < 13; i++) {\n\t\tresult += parseInt(data[i]) * (3 - i % 2 * 2);\n\t}\n\n\treturn Math.ceil(result / 10) * 10 - result;\n}",
"addChecksum(data) {\n var hash = this.computeChecksum(data)\n // Get first byte of sha256\n var firstChecksumByte = hash[0]\n\n // len() is in bytes so we divide by 4\n var checksumBitLength = data.length / 4\n\n // For each bit of check sum we want we shift the data one the left\n // and then set the (new) right most bit equal to checksum bit at that index\n // staring from the left\n var dataBigInt = new bn(data)\n\n for (var i = 0; i < checksumBitLength; i++) {\n dataBigInt = dataBigInt.mul(bigTwo)\n }\n\n // Set rightmost bit if leftmost checksum bit is set\n if (firstChecksumByte & (1 << (7 - i)) > 0) {\n dataBigInt = dataBigInt.or(bigOne)\n }\n return dataBigInt.toArray(\"be\")\n }",
"function checksum(str){\n\tvar i, checksum = 0;\n\tvar coefficients = [1,7,3,11];\n\tfor(i = 0; i < str.length; i++){\n\t\tchecksum += (coefficients[i % coefficients.length] * str.charCodeAt(i));\n\t}\n\treturn checksum % 10000;\n}",
"function computeChecksum(inString) {\n let MOD_ADLER = 65521;\n let a = 1;\n let b = 0;\n for (let i = 0; i < inString.length; i++) {\n a = (a + inString.charAt(i).charCodeAt()) % MOD_ADLER;\n b = (b + a) % MOD_ADLER;\n }\n return (b ^ a) % 100;\n }",
"function checksum(s, type = 'i')\n{\n var chk = 0x5F378EA8;\n var len = s.length;\n for (var i = 0; i < len; i++) chk += (s.charCodeAt(i) * (i + 1));\n if(type === 's') return (chk & 0xffffffff).toString(16);\n else return (chk & 0xffffffff);\n}",
"removeByteStuffing(buffer) {\n var ff = buffer.indexOf(0xFF, 0);\n if (ff === -1 || buffer[ff+1] !== 0)\n return buffer; /* Nothing to remove */\n var searchIndex = ff+2; /* Where to start next search for 0xFF */\n\n while (true) {\n var ff2 = buffer.indexOf(0xFF, searchIndex);\n\n if (ff2 == -1 || buffer[ff2+1] !== 0) {\n /* We are finished, just need to copy down any trailing bytes and trim buffer length */\n buffer.copy(buffer, ff+1, searchIndex);\n return buffer.slice(0, ff + buffer.length - searchIndex + 1);\n } else {\n /* Copy down the next range of good data, overwriting unwanted zero byte */\n buffer.copy(buffer, ff+1, searchIndex, ff2+1);\n }\n\n ff = ff + ff2 - searchIndex + 1; /* Position which 0xFF was just copied down to */\n searchIndex = ff2+2; /* Where next range of good bytes starts from */\n }\n }",
"function calculateChecksum(payload) {\n var checksum = strkey_Buffer.alloc(2);\n checksum.writeUInt16LE(mjs.crc16xmodem(payload), 0);\n return checksum;\n}",
"function checksumTZ(data) {\n\tlet crc = 0;\n\tfor (let b of data) {\n\t\tfor (let j = 0; j < 8; j++) {\n\t\t\tif (!((b ^ crc) & 1)) crc ^= 0x19;\n\t\t\tb >>= 1;\n\t\t\t// Rotate (shift right, move lost LSB to new MSB)\n\t\t\tcrc = ((crc & 1) << 7) | (crc >> 1);\n\t\t}\n\t}\n\treturn crc ^ 0xbf;\n}",
"function checksum(number){\n\tvar result = 0;\n\n\tvar i;\n\tfor(i = 0; i < 7; i += 2){\n\t\tresult += parseInt(number[i]) * 3;\n\t}\n\n\tfor(i = 1; i < 7; i += 2){\n\t\tresult += parseInt(number[i]);\n\t}\n\n\treturn (10 - (result % 10)) % 10;\n}",
"function checksum(number) {\n\tvar result = 0;\n\n\tvar i;\n\tfor (i = 1; i < 11; i += 2) {\n\t\tresult += parseInt(number[i]);\n\t}\n\tfor (i = 0; i < 11; i += 2) {\n\t\tresult += parseInt(number[i]) * 3;\n\t}\n\n\treturn (10 - result % 10) % 10;\n}",
"function checksum(number) {\n\tvar result = 0;\n\n\tvar i;\n\tfor (i = 1; i < 11; i += 2) {\n\t\tresult += parseInt(number[i]);\n\t}\n\tfor (i = 0; i < 11; i += 2) {\n\t\tresult += parseInt(number[i]) * 3;\n\t}\n\n\treturn (10 - result % 10) % 10;\n}",
"function checksum(number) {\n\tvar result = 0;\n\n\tvar i;\n\tfor (i = 0; i < 7; i += 2) {\n\t\tresult += parseInt(number[i]) * 3;\n\t}\n\n\tfor (i = 1; i < 7; i += 2) {\n\t\tresult += parseInt(number[i]);\n\t}\n\n\treturn (10 - result % 10) % 10;\n}",
"computeDataCrc() {\n let crc = 0xFFFF;\n const index = this.dataIndex;\n const begin = index - 4;\n const end = index + this.getLength();\n for (let i = begin; i < end; i++) {\n crc = Crc16_1.CRC_16_CCITT.update(crc, this.getByte(i));\n }\n return crc;\n }",
"function getFNVChecksum(str) {\n var sum = 0x811c9dc5;\n for (var i = 0; i < str.length; ++i) {\n sum ^= str.charCodeAt(i);\n sum += (sum << 1) + (sum << 4) + (sum << 7) + (sum << 8) + (sum << 24);\n }\n return ((sum >> 15) ^ sum) & 0x7fff;\n}",
"function checksum(number) {\n\tvar result = 0;\n\n\tvar i;\n\tfor (i = 0; i < 12; i += 2) {\n\t\tresult += parseInt(number[i]);\n\t}\n\tfor (i = 1; i < 12; i += 2) {\n\t\tresult += parseInt(number[i]) * 3;\n\t}\n\n\treturn (10 - result % 10) % 10;\n}",
"function sha256_S (X,n){return (X >>> n ) | (X << (32-n));}",
"checkSum(char, characters) {\n let checksum = 0;\n for (let i = 0; i < char.length; i++) {\n let codeNumber = characters.indexOf(char[i]);\n checksum += codeNumber;\n }\n checksum = checksum % 43;\n return checksum;\n }",
"function crc32(buf) {\n let crc = ~0;\n let leftLength = buf.byteLength;\n let bufPos = 0;\n while (leftLength >= 8) {\n crc ^= readU32(buf, bufPos);\n crc = TABLE8[0][buf[7 + bufPos]] ^\n TABLE8[1][buf[6 + bufPos]] ^\n TABLE8[2][buf[5 + bufPos]] ^\n TABLE8[3][buf[4 + bufPos]] ^\n TABLE8[4][(crc >>> 24) & 0xFF] ^\n TABLE8[5][(crc >>> 16) & 0xFF] ^\n TABLE8[6][(crc >>> 8) & 0xFF] ^\n TABLE8[7][crc & 0xFF];\n bufPos += 8;\n leftLength -= 8;\n }\n for (let byte = 0; byte < leftLength; byte++) {\n crc = TABLE[(crc & 0xFF) ^ buf[byte + bufPos]] ^ (crc >>> 8);\n }\n return ~crc;\n}",
"function checksum(array) {\r\n\tvar MODULUS = 65535;\r\n\tvar sum = 0;\r\n\tfor (var i in array) {\r\n\t\tsum = (sum + i) % MODULUS;\r\n\t}\r\n\treturn sum;\r\n}",
"function checksum() {\n const buf = this.buffer();\n if (buf.length !== 4340) {\n throw new Error('Can only checksum a save block');\n }\n\n // Exclude the existing checksum, then CRC the block\n const dbuf = new Buffer(4336);\n buf.copy(dbuf, 0, 4);\n this.set('checksum', ~crc.crc16ccitt(dbuf) & 0xFFFF);\n}",
"getDataCrc() {\n // Bit endian.\n const index = this.dataIndex + this.getLength();\n return (this.getByte(index) << 8) + this.getByte(index + 1);\n }",
"function checksum(creditCardNumber) {\n // console.log(creditCardNumber);\n\n // Iterate over the creditCardNumber\n creditCardNumber = reverseString(creditCardNumber.toString());\n let secondToLastSum = 0;\n for (var i = 0; i < creditCardNumber.length; i++) {\n if ((i + 1) % 2 === 0) {\n if ((parseInt(creditCardNumber[i]) * 2).toString().length === 2) {\n // console.log(parseInt(creditCardNumber[i]) * 2)\n secondToLastSum += sumOfString(parseInt(creditCardNumber[i]) * 2);\n } else {\n secondToLastSum += parseInt(creditCardNumber[i] * 2);\n }\n } else {\n secondToLastSum += parseInt(creditCardNumber[i]);\n }\n }\n // console.log(secondToLastSum)\n return secondToLastSum % 2 === 0;\n }",
"function calculateChecksum(sval) {\n var checksum = 0;\n for (var i = 0; i < sval.length; ++i) {\n checksum += parseInt(sval.charAt(i)) * (ACCOUNT_NUMBER_LENGTH - i);\n }\n return checksum;\n }"
] |
[
"0.71113706",
"0.69702226",
"0.69534045",
"0.66330284",
"0.6595845",
"0.63730997",
"0.6250073",
"0.6237258",
"0.6106878",
"0.59434587",
"0.5887493",
"0.57834655",
"0.57324564",
"0.5727105",
"0.57150084",
"0.57025385",
"0.5680195",
"0.5680195",
"0.566878",
"0.56614137",
"0.5640799",
"0.56342435",
"0.5594379",
"0.55479515",
"0.5519652",
"0.55070525",
"0.54711443",
"0.54577315",
"0.54380554",
"0.54092425"
] |
0.77874213
|
0
|
Gets file from S3.
|
static getFile (bucketName, objectKey) {
const s3 = Storage._getS3Instance();
const params = {
Bucket: bucketName,
Key: objectKey
};
return new Promise((resolve, reject) => {
s3.getObject(params, (err, data) => {
if (err) {
reject(err);
} else {
resolve({
content: data.Body, // buffer
type: data.ContentType, // string
encoding: data.ContentEncoding, // string
size: data.ContentLength // integer
});
}
});
});
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"async getFile(params) {\n try {\n console.log(\"s3.getObject Params: \", params);\n var s3 = new this.AWS.S3();\n let file = await s3.getObject(params).promise();\n return (file);\n } catch (error) {\n console.error('S3.getObject error: ', error);\n return (error);\n }\n }",
"function getObjFromS3(fileName, bucket, callback){\n let params = {Bucket: bucket, Key:fileName};\n s3.getObject(params, function(err, data){\n if(err){\n console.error(\"getObjFromS3 err\",err);\n } else {\n callback(data.Body.toString('utf-8'));\n }\n \n });\n\n}",
"function fetchFromS3(env, callback){\n // get the investigators cached version from AWS.\n if (!isValidEnv(env)){\n callback(\"Invalid env passed into fetchFromS3()\");\n return;\n }\n // construct the filename from the env\n var filename = getS3FilePath(env);\n var params = {\n Bucket: AWS_BUCKET_NAME,\n Key: filename\n };\n // get the file\n console.log(\"Calling s3....\");\n s3.getObject(params, function(err,data){\n if (err){\n callback(\"InvestigatorService S3: \" + err.code);\n } else {\n var text = data.Body.toString('ascii');\n callback(null, text);\n }\n });\n}",
"* get (path) {\n return new Promise((resolve, reject) => {\n this.s3.getObject({\n Bucket: this.disk.bucket,\n Key: path\n }, (err, data) => {\n if (err) return reject(err)\n return resolve(data.Body)\n })\n })\n }",
"function getFileStream(fileKey) {\n const downloadParams = {\n Key: fileKey,\n Bucket: bucketName\n }\n var object = s3.getObject(downloadParams).createReadStream().on('error', (err) => console.log(err + 'ERROR GET FILE FROM 3S'))\n return object\n}",
"function getS3File(bucketName, fileName, versionId, callback) {\n var params = {\n Bucket: bucketName,\n Key: fileName\n };\n if (versionId) {\n params.VersionId = versionId;\n }\n s3.getObject(params, function (err, data) {\n callback(err, data);\n });\n}",
"* getStream (path) {\n return this.s3.getObject({\n Bucket: this.disk.bucket,\n Key: path\n }).createReadStream()\n }",
"async function fetchInputFromS3(s3URL) {\n const tmpDir = await tmp.dir({ dir: \"/tmp\" });\n const parsedS3URL = url.parse(s3URL);\n const localFile = path.join(tmpDir.path, path.basename(parsedS3URL.path));\n console.log(`Downloading ${s3URL} to ${localFile}...`);\n\n const params = {\n Bucket: parsedS3URL.host,\n Key: parsedS3URL.path.slice(1),\n };\n const s3 = new AWS.S3();\n const readStream = s3.getObject(params).createReadStream();\n await new Promise((resolve, reject) => {\n readStream.on(\"error\", reject);\n readStream.on(\"end\", resolve);\n const file = fs.createWriteStream(localFile);\n readStream.pipe(file);\n });\n return localFile;\n}",
"download(fName){\n let client = this.s3Client;\n\n return new Promise((resolve, reject) => {\n client.getFile(fName, (err, res) => {\n if(err) reject(err);\n resolve(res);\n }); \n });\n }",
"function getFileStream(key) {\n const downloadParams = {\n Key: key,\n Bucket: 'week18'\n }\n return s3.getObject(downloadParams).createReadStream()\n}",
"function getFileStream(fileKey) {\n const downloadParams = {\n Key: fileKey,\n Bucket: bucketName,\n };\n\n return s3.getObject(downloadParams).createReadStream();\n}",
"function get_s3_resource(element, signature_view_url) {\n\tvar resource_url = element.src;\n\tvar xhr = new XMLHttpRequest();\n\txhr.open(\"GET\", signature_view_url+\"?resource_url=\"+resource_url);\n\txhr.onreadystatechange = function() {\n\t\tif(xhr.readyState === 4) {\n\t\t\tif(xhr.status === 200) {\n\t\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\t\telement.src = response.signed_request;\n\t\t\t}\n\t\t\telse {\n\t\t\t\talert(\"Could not get signed URL.\");\n\t\t\t}\n\t\t}\n\t};\n\txhr.send();\n}",
"downloadFile(bucket, fileNameToDownload, fileNameToSaveAs) {\n return new Promise((resolve, reject) => {\n var download = this.client.downloadFile({\n localFile: fileNameToSaveAs,\n s3Params: {\n Bucket: bucket,\n Key: fileNameToDownload\n }\n });\n\n download.on('error', error => {\n reject(error);\n });\n\n download.on('end', () => {\n resolve();\n });\n });\n }",
"async function downloadFile(s3Object) {\n const getParams = {Bucket: bucketName, Key: s3Object.Key};\n const fileWriteStream = fs.createWriteStream(path.join(cryptoFolder, s3Object.Key));\n return new Promise((resolve, reject) => {\n s3.getObject(getParams).createReadStream()\n .on('end', () => {\n return resolve();\n }).on('error', (error) => {\n return reject(error);\n }).pipe(fileWriteStream)\n });\n}",
"function getFileStream(fileKey) {\n const downloadParams = {\n Key: fileKey,\n Bucket: AWS_BUCKET_NAME\n }\n\n return s3.getObject(downloadParams).createReadStream()\n}",
"function getFile (params) {\n return new Promise((resolve,reject) => s3.getObject(params, function(err, data) {\n if (err) {\n reject(err);\n // file does not exist\n var attachment = {}\n attachment.text = params[\"Key\"]\n attachment.color = \"#FF0000\"\n attachment.title = \"File Missing!\"\n missingFilesArry.push(attachment)\n }\n else {\n resolve(data);\n //file exists\n receivedFilesArry.push(params[\"Key\"])\n }\n }))\n}",
"function fetchAndStoreObject(bucket, key, fn) {\n\tif (bucket === null) {\n\t\tbucket = constants.defaultBucket;\n\t}\n\tvar params = {\n\t\tBucket : bucket, /* required */\n\t\tKey : key\n\t/* required */\n\t};\n\tconsole.log(\"getObject for \" + JSON.stringify(params));\n\tvar file = fs.createWriteStream('/tmp/' + key);\n\ts3.getObject(params).on('httpData', function(chunk) {\n\t\tfile.write(chunk);\n\t\t// console.log(\"writing chunk in file.\"+key);\n\t}).on('httpDone', function() {\n\t\tfile.end();\n\t\tconsole.log(\"file end.\" + key);\n\t\tfn();\n\t}).send();\n}",
"async get(){\n try {\n let objectResult = await s3.getObject({\n Bucket: this.bucket,\n Key: this.key\n }).promise();\n \n let creds = JSON.parse(objectResult.Body);\n return creds;\n } catch(ex){\n if(ex.code === 'NoSuchKey'){\n return null;\n }\n console.error(ex);\n throw ex;\n }\n }",
"function uploadAndFetch (s3, stream, filename, bucket, key) {\n var deferred = when.defer();\n exports.getFileStream(filename)\n .pipe(stream)\n .on(\"error\", deferred.reject)\n .on(\"finish\", function () {\n deferred.resolve(exports.getObject(s3, bucket, key));\n });\n return deferred.promise;\n}",
"* url (path) {\n return `https://${this.disk.bucket}.s3.amazonaws.com/${path}`\n }",
"function getS3(awsAccessKey, awsSecretKey) {\n return new AWS.S3({\n accessKeyId: awsAccessKey,\n secretAccessKey: awsSecretKey\n });\n}",
"function getFiles(bucketName) {\n if (!bucketName) {\n return Promise.reject({ message: 'Bucket name required to get objects' });\n }\n return new Promise(function (resolve, reject) {\n s3.listObjects({ Bucket: bucketName }, function (err, data) {\n if (err) {\n console.log(\"Error:\", err);\n reject(err);\n } else {\n console.log(\"[getFiles] listObjects returned:\", data);\n resolve(data);\n }\n });\n });\n}",
"getBucket() {\n const headers = {\n Date: this._buildDateHeader(),\n };\n\n const authHeader = this._buildAuthHeader('GET', '', {}, headers);\n const fetchOptions = {\n method: 'GET',\n headers: {\n Authorization: authHeader,\n },\n };\n\n return new Promise((resolve, reject) => {\n fetch(this.bucketBaseUrl, fetchOptions)\n .then(res => resolve(res))\n .catch(err => reject(err));\n });\n }",
"static _getS3Instance () {\n s3instance = s3instance || new AWS.S3({ apiVersion: S3_API_VERSION });\n return s3instance;\n }",
"async function getImage(media_key) {\n const data = s3.getObject({\n Bucket: 'twitterimagesoth',\n Key: media_key\n }\n\n ).promise();\n return data;\n }",
"async function uploadFileToS3(file, getSignedUrl) {\n try {\n const {fileUrl, signedRequestUrl} = await getSignedUrl(file)\n const url = await makeS3Request(fileUrl, signedRequestUrl, file)\n\n return url\n } catch (e) {\n return alert('Could not upload file.')\n }\n}",
"function getSignedUrl(filename, filetype, foldername, operation) {\n const folderName = foldername;\n const params = {\n Bucket: 'gsg-image-uploads',\n Key: `${folderName}/` + filename,\n Expires: 604800\n };\n if(operation==='putObject'){\n params['ContentType'] = filetype;\n }\n return new Promise((resolve, reject) => {\n s3.getSignedUrl(operation, params, function(err, data) {\n if (err) {\n console.log(\"Error\",err);\n reject(err)\n } else {\n resolve(data)\n }\n });\n });\n}",
"getImageFromURL(URL, fileName, bucket, callback) {\n var options = {\n uri: URL,\n encoding: null\n };\n request(options, function (error, response, body) {\n if (error || response.statusCode !== 200) {\n console.log(\"failed to get image\", URL);\n console.log(error);\n if(response.statusCode !== 200){\n console.log(\"200 status not received for URL:\", options.uri);\n }\n } else {\n s3.putObject({\n Body: body,\n Key: fileName,\n Bucket: bucket\n }, function (error, data) {\n if (error) {\n console.log(\"error downloading image to s3\", fileName);\n } else {\n // console.log(\"body:\", body);\n // console.log(\"success uploading to s3\", fileName);\n }\n });\n }\n });\n }",
"async function retrieveFile(file_name){\n let error = null\n let file = null\n try{\n file = await getFileAsync({\n Bucket: config.bucket_name,\n Key: file_name\n })\n }catch(err){error=err}\n\n return new Promise((resolve, reject)=>{\n if(error) {reject(error)}\n else {resolve(file)}\n })\n}",
"function handleGetObject(httpResponse, s3ResultData) {\n let buffer;\n s3ResultData.Body.on('data', chunk => {\n buffer = Buffer.concat([chunk]);\n });\n\n s3ResultData.Body.on('end', () => {\n httpResponse.send({\n status: 'ok',\n result: Buffer.from(buffer).toString()\n });\n });\n}"
] |
[
"0.78079504",
"0.7776254",
"0.7768614",
"0.7666587",
"0.75503224",
"0.7482117",
"0.7363299",
"0.7182902",
"0.7181803",
"0.688952",
"0.6852944",
"0.6791557",
"0.67521936",
"0.6731061",
"0.6689846",
"0.6646522",
"0.6614215",
"0.6455275",
"0.64538085",
"0.64111936",
"0.6358914",
"0.6263799",
"0.62049276",
"0.6166563",
"0.6159789",
"0.61393505",
"0.61264753",
"0.60913664",
"0.6066956",
"0.60619855"
] |
0.78494304
|
0
|
Gets the single S3 instance.
|
static _getS3Instance () {
s3instance = s3instance || new AWS.S3({ apiVersion: S3_API_VERSION });
return s3instance;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function getS3(awsAccessKey, awsSecretKey) {\n return new AWS.S3({\n accessKeyId: awsAccessKey,\n secretAccessKey: awsSecretKey\n });\n}",
"async get(){\n try {\n let objectResult = await s3.getObject({\n Bucket: this.bucket,\n Key: this.key\n }).promise();\n \n let creds = JSON.parse(objectResult.Body);\n return creds;\n } catch(ex){\n if(ex.code === 'NoSuchKey'){\n return null;\n }\n console.error(ex);\n throw ex;\n }\n }",
"function getObjFromS3(fileName, bucket, callback){\n let params = {Bucket: bucket, Key:fileName};\n s3.getObject(params, function(err, data){\n if(err){\n console.error(\"getObjFromS3 err\",err);\n } else {\n callback(data.Body.toString('utf-8'));\n }\n \n });\n\n}",
"async getFile(params) {\n try {\n console.log(\"s3.getObject Params: \", params);\n var s3 = new this.AWS.S3();\n let file = await s3.getObject(params).promise();\n return (file);\n } catch (error) {\n console.error('S3.getObject error: ', error);\n return (error);\n }\n }",
"function get_s3_resource(element, signature_view_url) {\n\tvar resource_url = element.src;\n\tvar xhr = new XMLHttpRequest();\n\txhr.open(\"GET\", signature_view_url+\"?resource_url=\"+resource_url);\n\txhr.onreadystatechange = function() {\n\t\tif(xhr.readyState === 4) {\n\t\t\tif(xhr.status === 200) {\n\t\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\t\telement.src = response.signed_request;\n\t\t\t}\n\t\t\telse {\n\t\t\t\talert(\"Could not get signed URL.\");\n\t\t\t}\n\t\t}\n\t};\n\txhr.send();\n}",
"* get (path) {\n return new Promise((resolve, reject) => {\n this.s3.getObject({\n Bucket: this.disk.bucket,\n Key: path\n }, (err, data) => {\n if (err) return reject(err)\n return resolve(data.Body)\n })\n })\n }",
"function getFileStream(fileKey) {\n const downloadParams = {\n Key: fileKey,\n Bucket: bucketName\n }\n var object = s3.getObject(downloadParams).createReadStream().on('error', (err) => console.log(err + 'ERROR GET FILE FROM 3S'))\n return object\n}",
"static getFile (bucketName, objectKey) {\n const s3 = Storage._getS3Instance();\n const params = {\n Bucket: bucketName,\n Key: objectKey\n };\n return new Promise((resolve, reject) => {\n s3.getObject(params, (err, data) => {\n if (err) {\n reject(err);\n } else {\n resolve({\n content: data.Body, // buffer\n type: data.ContentType, // string\n encoding: data.ContentEncoding, // string\n size: data.ContentLength // integer\n });\n }\n });\n });\n }",
"function fetchFromS3(env, callback){\n // get the investigators cached version from AWS.\n if (!isValidEnv(env)){\n callback(\"Invalid env passed into fetchFromS3()\");\n return;\n }\n // construct the filename from the env\n var filename = getS3FilePath(env);\n var params = {\n Bucket: AWS_BUCKET_NAME,\n Key: filename\n };\n // get the file\n console.log(\"Calling s3....\");\n s3.getObject(params, function(err,data){\n if (err){\n callback(\"InvestigatorService S3: \" + err.code);\n } else {\n var text = data.Body.toString('ascii');\n callback(null, text);\n }\n });\n}",
"function S3Store(options) {\n options = options || {};\n\n this.options = extend({\n path: 'cache/',\n tryget: true,\n s3: {}\n }, options);\n\n\n // check storage directory for existence (or create it)\n if (!fs.existsSync(this.options.path)) {\n fs.mkdirSync(this.options.path);\n }\n\n this.name = 's3store';\n\n // internal array for informations about the cached files - resists in memory\n this.collection = {};\n\n // TODO: need implement!\n // fill the cache on startup with already existing files\n // if (!options.preventfill) {\n // this.intializefill(options.fillcallback);\n // }\n}",
"* getStream (path) {\n return this.s3.getObject({\n Bucket: this.disk.bucket,\n Key: path\n }).createReadStream()\n }",
"static getOrCreate(scope) {\n const stack = core_1.Stack.of(scope);\n const id = 'com.amazonaws.cdk.custom-resources.s3file-provider';\n const x = constructs_1.Node.of(stack).tryFindChild(id) || new S3FileProvider(stack, id);\n return x.provider.serviceToken;\n }",
"function getS3File(bucketName, fileName, versionId, callback) {\n var params = {\n Bucket: bucketName,\n Key: fileName\n };\n if (versionId) {\n params.VersionId = versionId;\n }\n s3.getObject(params, function (err, data) {\n callback(err, data);\n });\n}",
"static instance() {\n if (!singleton) {\n singleton = new Cart()\n }\n return singleton\n }",
"function getS3PreSignedUrl(s3ObjectKey) {\n\n const bucketName = process.env.S3_PERSISTENCE_BUCKET;\n \n const s3PreSignedUrl = s3SigV4Client.getSignedUrl('getObject', {\n Bucket: bucketName,\n Key: s3ObjectKey,\n Expires: 60*1 // the Expires is capped for 1 minute\n });\n\n console.log(`Util.s3PreSignedUrl: ${s3ObjectKey} URL ${s3PreSignedUrl}`); // you can see those on CloudWatch\n\n return s3PreSignedUrl;\n}",
"function getBucket() {\n var request = gapi.client.storage.buckets.get({\n 'bucket': BUCKET\n });\n executeRequest(request, 'getBucket');\n}",
"async function fetchInputFromS3(s3URL) {\n const tmpDir = await tmp.dir({ dir: \"/tmp\" });\n const parsedS3URL = url.parse(s3URL);\n const localFile = path.join(tmpDir.path, path.basename(parsedS3URL.path));\n console.log(`Downloading ${s3URL} to ${localFile}...`);\n\n const params = {\n Bucket: parsedS3URL.host,\n Key: parsedS3URL.path.slice(1),\n };\n const s3 = new AWS.S3();\n const readStream = s3.getObject(params).createReadStream();\n await new Promise((resolve, reject) => {\n readStream.on(\"error\", reject);\n readStream.on(\"end\", resolve);\n const file = fs.createWriteStream(localFile);\n readStream.pipe(file);\n });\n return localFile;\n}",
"static isS3URL(url) {\n const s3Host =\n game.data.files.s3 &&\n game.data.files.s3 &&\n game.data.files.s3.endpoint &&\n game.data.files.s3.endpoint.host\n ? game.data.files.s3.endpoint.host\n : \"\";\n\n if (s3Host === \"\") return false;\n\n const regex = new RegExp(\"http[s]?://([^.]+)?.?\" + s3Host + \"(.+)\");\n const matches = regex.exec(url);\n\n const activeSource = matches ? \"s3\" : null; // can be data or remote\n const bucket = matches && matches[1] ? matches[1] : null;\n const current = matches && matches[2] ? matches[2] : null;\n\n if (activeSource === \"s3\") {\n return {\n activeSource,\n bucket,\n current,\n };\n } else {\n return false;\n }\n }",
"function getCloudWatch(awsAccessKey, awsSecretKey) {\n return new AWS.CloudWatch({\n accessKeyId: awsAccessKey,\n secretAccessKey: awsSecretKey\n });\n}",
"constructor (id, s3) {\n this.s3Prefix = process.env.S3_PREFIX // 'scores-bot'\n this._store = s3\n this.id = id\n this.touch(true)\n this.setDefaultState()\n }",
"async load() {\r\n this._logger.info(\"===> AmazonStorageConfigProvider::load\");\r\n const networkEndpoint = new networkEndPoint_1.NetworkEndPoint(\"https\", `s3.${this._region}.amazonaws.com`, 443);\r\n const networkClient = networkClientFactory_1.NetworkClientFactory.instance().create(\"default\", networkEndpoint, this._logger);\r\n // Use a cache bust when we are doing admin\r\n const cacheBust = objectHelper_1.ObjectHelper.isEmpty(this._credentials) ? \"\" : `?cachebust=${Date.now()}`;\r\n let config;\r\n try {\r\n config = await networkClient.json(undefined, \"GET\", `${this._bucketName}/${this._configName}.json${cacheBust}`);\r\n }\r\n catch (exc) {\r\n let emptyConfig = false;\r\n if (objectHelper_1.ObjectHelper.isType(exc, networkError_1.NetworkError)) {\r\n emptyConfig = true;\r\n }\r\n if (!emptyConfig) {\r\n throw exc;\r\n }\r\n }\r\n this._logger.info(\"<=== AmazonStorageConfigProvider::load\", config);\r\n return config;\r\n }",
"function uploadAndFetch (s3, stream, filename, bucket, key) {\n var deferred = when.defer();\n exports.getFileStream(filename)\n .pipe(stream)\n .on(\"error\", deferred.reject)\n .on(\"finish\", function () {\n deferred.resolve(exports.getObject(s3, bucket, key));\n });\n return deferred.promise;\n}",
"presignedGetObject(bucketName, objectName, expires) {\n if (!validateBucketName(bucketName)) {\n throw new errors.InvalidateBucketNameException('Invalid bucket name: ' + bucketName)\n }\n if (objectName === null || objectName.trim() === '') {\n throw new errors.InvalidObjectNameException('Object name cannot be empty')\n }\n var requestParams = {\n host: this.params.host,\n port: this.params.port,\n protocol: this.params.protocol,\n path: `/${bucketName}/${uriResourceEscape(objectName)}`,\n method: 'GET',\n expires: expires\n }\n return presignSignatureV4(requestParams, this.params.accessKey, this.params.secretKey)\n }",
"function fetchAndStoreObject(bucket, key, fn) {\n\tif (bucket === null) {\n\t\tbucket = constants.defaultBucket;\n\t}\n\tvar params = {\n\t\tBucket : bucket, /* required */\n\t\tKey : key\n\t/* required */\n\t};\n\tconsole.log(\"getObject for \" + JSON.stringify(params));\n\tvar file = fs.createWriteStream('/tmp/' + key);\n\ts3.getObject(params).on('httpData', function(chunk) {\n\t\tfile.write(chunk);\n\t\t// console.log(\"writing chunk in file.\"+key);\n\t}).on('httpDone', function() {\n\t\tfile.end();\n\t\tconsole.log(\"file end.\" + key);\n\t\tfn();\n\t}).send();\n}",
"constructor() {\n if(! Storage.instance){\n Storage.instance = this;\n }\n\n return Storage.instance;\n }",
"getBucket() {\n const headers = {\n Date: this._buildDateHeader(),\n };\n\n const authHeader = this._buildAuthHeader('GET', '', {}, headers);\n const fetchOptions = {\n method: 'GET',\n headers: {\n Authorization: authHeader,\n },\n };\n\n return new Promise((resolve, reject) => {\n fetch(this.bucketBaseUrl, fetchOptions)\n .then(res => resolve(res))\n .catch(err => reject(err));\n });\n }",
"function getKinesis() {\n let params = {\n apiVersion: '2013-12-02',\n region: 'us-east-2',\n };\n\n return new aws.Kinesis(params);\n}",
"get bucketUrl() {\n return this.urlForObject();\n }",
"mfGetItems_LabradorAwsS3Images(){\n\t\treturn mf.modeGetItems_LabradorAwsS3Images(this)\n\t}",
"getInstance() {\n if (!instance) instance = init();\n\n return instance;\n }"
] |
[
"0.6656993",
"0.6265979",
"0.59003764",
"0.5823779",
"0.57539546",
"0.5641354",
"0.5605176",
"0.5571959",
"0.5543661",
"0.5536765",
"0.54907435",
"0.54037434",
"0.5251508",
"0.52197915",
"0.5178293",
"0.51291525",
"0.5107308",
"0.50706774",
"0.50539833",
"0.50228333",
"0.49909058",
"0.49852946",
"0.49837705",
"0.4981952",
"0.49649644",
"0.4962448",
"0.49600095",
"0.4938793",
"0.49190295",
"0.4913765"
] |
0.8515359
|
0
|
post errors to error / warning div
|
function postErrorsAndResetErrorMessage(){
$("#errors").html(errorMessage);
$("#errors").show();
// errorMessage = "";
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function onerror(e){\n\t\t$('#errors').text(e.message);\n\t}",
"function puterrors(error) {\n\tvar errBox = document.getElementById(\"reg-body\");\n\t// set the error box border to solid (from unset/hidden)\n\terrBox.style.borderStyle = \"solid\";\n\t// create a br (line break) element\n\tvar br = document.createElement(\"br\");\n\tvar br2 = document.createElement(\"br\");\n\t//check if there have been any previous errors. If not, create a \"Errors:\" headlines\n\tvar check = document.getElementById(\"errHead\");\n\tif (!check) {\n\t\tvar h4 = document.createElement(\"h4\");\n\t\th4.id = \"errHead\";\n\t\tvar errText = document.createTextNode(\"Errors:\");\n\t\th4.appendChild(errText);\n\t\terrBox.appendChild(h4);\n\t\t//add a line break after the headline\n\t\terrBox.appendChild(br);\n\t}\n\t//create a text node for the error message\n\tvar textNode = document.createTextNode(error);\n\t//add the error message to the error box\n\terrBox.appendChild(textNode);\n\t//add a line break after each error\n\terrBox.appendChild(br2);\n}",
"function writeToErrorDiv(message){\n document.getElementById('errorDiv').innerHTML = message;\n}",
"function displayError (errMsg) {\n $(\"#error-msg\").text(errMsg);\n $(\"#url-form,#loading,#content\").hide();\n $(\"#error\").show();\n}",
"function ajax_error() {\n $(\"#error\").html(\"An error occurred -- try refreshing the page. If the problem persists, please contact the webmaster or try again later :(\").parents(\".alert\").slideDown(\"fast\");\n}",
"function displayError(msg) {\n $(\"#error-message\").html(msg);\n $(\"#error-wrapper\").show();\n $(\"#results-wrapper\").hide();\n}",
"function displayDisplayErrors(errors){\n displayErrors(errors, closeDisplayErrorEntry);\n resizeContent();\n}",
"function onError(err) {\n $('#err').html(err);\n}",
"function onError(){\n\t\n\t$('#erro').show();\n\t$('#sombra').show();\n\t$('#fechar_erro').show();\n\t\n}",
"function error(message) {\r\n\t$('#error').html(message);\r\n\t$('#swatches').hide();\r\n}",
"function placeErrorMessages () {\n\n // Error Message for no text entered\n const enterError = $(\"<div></div>\").addClass(\"tooltip\").text(\n \"Please enter an email address\");\n\n // Error message for incorrect formatting\n const formatError = $(\"<div></div>\").addClass(\"tooltip\").text(\n \"Emails should be formatted in the form ___@___.abc\");\n\n // Adds error messages to the HTML file\n $(\"#mail\").after(enterError, formatError);\n}",
"function error() {\r\n\r\n \t$('#ir-anim-container').addClass('error');\r\n\t\t$('#ir-anim-container #congrats h1').text('Sorry, there was an error');\r\n\t\t$('#ir-anim-container #congrats p').text('Please, try again later');\r\n\t\t$('#ir-anim-container #gift-copy').remove();\r\n\t\t$('#ir-anim-container #gift-image').remove();\r\n\t\t$('#ir-anim-container #congrats').append('<img src=\"img/prize-error.png\" alt=\"Sorry, there was an error\" width=\"200\" height=\"190\" />');\r\n }",
"function error(err) {\r\n notificationElement.style.display = \"block\"\r\n notificationElement.innerHTML = `<p>${err.message}</p>`\r\n}",
"function posterror() { alert( \"There was an error. TODO: Prompt to resubmit here.\" ); }",
"function displayError(errors, input) {\n\n errors.forEach(function (error) {\n $(input).after('<div style=\"color: red\" class=\"error\"><strong>' + error.message + '</strong></div>');\n });\n}",
"function displayErrorMsg(error) {\n $(\".errorOverlay\", selector).text(tr(error));\n $(selector).addClass(\"error\");\n }",
"function displayError() {\n if(originalError instanceof ValidationError) {\n $(\".validation-message--error\").text(`Validation Error: ${originalError.message}`);\n }\n else if(originalError instanceof LocationError) {\n $(\".validation-message--error\").text(`Location Error: ${originalError.message}`);\n }\n else {\n $(\".validation-message--error\").text(`Error: ${originalError.message}`);\n }\n }",
"function handle_error() {\n\tvar snackbar = document.createElement('div');\n\tsnackbar.innerText = 'There was an error processing your request =(';\n\tsnackbar.setAttribute('id', 'snackbar');\n\tdocument.querySelector('.container-fluid').prepend(snackbar);\n\tsetTimeout(function() {\n\t\tdocument.querySelector('.container-fluid').removeChild(document.querySelector('#snackbar'));\n\t}, 5000);\n}",
"function mdm_error(message) { document.getElementById(\"error\").innerHTML = 'try again'; }",
"function edropx_display_error(element_id, message) {\n\n\t$(\"#\" + element_id).html(\"<div class=\\\"alert alert-danger\\\"><strong>Error:</strong>\" + message + \"</div>\");\n\n}",
"function errorHandler () {\n\t\tif ( !document.querySelector( '#zemez-core-error' ) ) {\n\t\t\tlet node = document.createElement( 'div' );\n\t\t\tnode.setAttribute( 'id', 'zemez-core-error' );\n\t\t\tnode.setAttribute( 'style', 'position: fixed; bottom: 1vh; left: 1vw; z-index: 1000; max-width: 98vw; padding: 10px 15px; border-radius: 4px; font-family: monospace; background: #f2564d; color: white;' );\n\t\t\tnode.innerText = 'There was an error on this page, please try again later.';\n\t\t\tdocument.body.appendChild( node );\n\t\t}\n\t}",
"function updateUiError() {\n showElements(statusMessage);\n statusMessage.textContent =\n \"Sorry you have entered invalid value, please try again!\";\n statusMessage.classList.remove(\"success\");\n statusMessage.classList.add(\"error\");\n}",
"function setError(errors, windowName) {\n $('.rentalbikes-' + windowName + '-window .rentalbikes-ajaxlogin-error')\n .text('');\n $('.rentalbikes-' + windowName + '-window .rentalbikes-ajaxlogin-error')\n .hide();\n var errorArr = new Array();\n errorArr = errors.split(',');\n var length = errorArr.length - 1;\n\n for (var i = 0; i < length; i++) {\n var errorText = $('.ytmpa-' + errorArr[i]).text();\n\n $('.rentalbikes-' + windowName + '-window .err-' + errorArr[i])\n .text(errorText);\n }\n $('.rentalbikes-' + windowName + '-window .rentalbikes-ajaxlogin-error')\n .fadeIn();\n }",
"function errorMessage() {\n\t\n\t$loader.html('<span class=\"error typeIt2\">Purrrlease make a selection...... You can do that right meoewwwwermmmm thanks.</span>');\n\n\t//typeIt effect\n\t$('.typeIt2').typeIt({\n\t\tcursor: false,\n\t});\n\n}",
"function setError(msg) {\n $('form:visible .error').text(msg).show();\n window.clearInterval(window.progressTimer );\n}",
"function renderErrorPage() {\n var page = $('.error');\n page.addClass('visible');\n }",
"function displayError() {\n\t\t// Hide loading animations\n\t\tdocument.getElementById(\"loadingmeaning\").style.display = \"none\";\n\t\tdocument.getElementById(\"loadinggraph\").style.display = \"none\";\n\t\tdocument.getElementById(\"loadingcelebs\").style.display = \"none\";\n\t\t\n\t\t// Display error at bottom of the page\n\t\tdocument.getElementById(\"errors\").innerHTML =\n\t\t\t\"Sorry, but an error occured during your server request.\";\n\t}",
"insertErrorMessage(){\n\t\t$(this.element + \"Error\").html(this.errorMessage);\n\t}",
"function display_ajax_alert_error(index, value, mfvid)\r\n{\r\n\tif (index === '__all__'){\r\n\t\t$('div.nonfield-ajax-error').remove();\r\n\t\t$(mfvid).prepend('<div class=\"alert callout nonfield-ajax-error\">'+value[0].message+'</div>');\r\n\t\tdocument.querySelector('.alert.callout.nonfield-ajax-error').scrollIntoView({ \r\n\t\t behavior: 'smooth' \r\n\t\t});\r\n\t}else{\r\n\t\t$(\"[name=\"+index+\"] + small.error\").remove();\t \t\t\t\t\t\r\n\t\t$(\"[name=\"+index+\"]\").after('<small class=\"error\">'+value[0].message+'</small>');\r\n\t}\r\n}",
"error() {\n $(\".content\").html(\"Failed to load content!\");\n }"
] |
[
"0.7345106",
"0.7003722",
"0.70031124",
"0.69754785",
"0.6937411",
"0.6910826",
"0.69068384",
"0.6904859",
"0.6883177",
"0.6868487",
"0.6841011",
"0.68354553",
"0.6824967",
"0.6816095",
"0.67859614",
"0.67851627",
"0.6778072",
"0.67690885",
"0.6754595",
"0.6752317",
"0.67335397",
"0.6719894",
"0.6669534",
"0.66694206",
"0.6669338",
"0.6651689",
"0.66505146",
"0.661412",
"0.66039115",
"0.65995765"
] |
0.7158374
|
1
|
Format static value value => string lang => language by default is ptBR currency => coin local of your country
|
moneyBr(value, lang = 'pt-BR', currency = 'BRL'){
return new Intl.NumberFormat(lang, { style: 'currency', currency: currency }).format(value);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function formatUSCurrency(val) {\r\n return val.toLocaleString('en-US',\r\n {style: \"currency\", currency: \"USD\"});\r\n}",
"callback(value) {\n return formatCurrency(value, 4);\n }",
"formatCurrency(value) {\n // get signal\n const signal = Number(value) < 0 ? '-' : ''\n //clean string\n // \\D -> Encontre tudo que náo é number\n value = String(value).replace(/\\D/g, '')\n // convert \n value = Number(value) / 100\n value = value.toLocaleString(\"pt-BR\", {\n style: \"currency\",\n currency: \"BRL\"\n })\n\n return signal + value\n }",
"function change(val){\r\n \tval = Ext.util.Format.currency(val,' TL',2,true);\r\n return val;\r\n }",
"function currencyFormat(label) {\n let formatCurrency = new Intl.NumberFormat('pt-BR', {\n style: 'currency',\n currency: 'BRL',\n minimumFractionDigits: 2,\n });\n return formatCurrency.format(Number(label));\n }",
"formatToLanguage() {\n const format = this.props.cardToShow.split('.')[this.props.cardToShow.split('.').length-1];\n switch (format) {\n case 'js': return 'javascript';\n case 'py': return 'python3';\n case 'rb': return 'ruby';\n case 'html': return 'html';\n case 'css': return 'html';\n case 'java': return 'java';\n case 'cpp': return 'cpp';\n case 'cs': return 'csharp';\n default: return '';\n }\n }",
"callback(value) {\n return formatCurrency(value, 0);\n }",
"static getLocale() {\n return 'en_US';\n }",
"function langCode(value) {\n switch (value) {\n case 'eng':\n return 'e';\n case 'spa':\n return 's';\n case 'ger':\n return 'g';\n }\n}",
"function formatLocalizedPrice (price) {\n return new Intl.NumberFormat(navigator.language, {style: 'currency', currency: price.currencyCode}).format(price.value);\n }",
"function sign(){\n switch(cto.value){\n case value = \"usdollar\":\n bruh=\"$\"; break;\n case value = 'cadollar':\n bruh=\"CA$\"; break;\n case value = 'euro':\n bruh=\"E\"; break;\n case value = 'pound':\n bruh=\"£\"; break;\n case value = 'moroccan':\n bruh=\"Dh\"; break;\n case value = 'yen':\n bruh=\"¥\"; break;\n default:\n bruh=\"g\"\n }\n return bruh\n}",
"convert() {\n return `${(this.payments.type.price[this.currencyType] / 100)}`;\n }",
"getPrice() {\n return `${this.price} euros`;\n }",
"static formatCurrency(x) {\n return \"₱\" + x.toFixed(2).toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n }",
"function realCurrency(number){\r\n let value = number\r\n \r\n let result = value.toLocaleString('pt-br', {style: 'currency', currency: 'BRL'});\r\n\r\n return result\r\n}",
"function formatoCurrency(valor) {\n var currency = 0;\n currency = valor.toFixed(2).replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, \"$1,\");\n return currency;\n}",
"function formatCurrency(val) {\n\tvar ele = new PM.OutputField();\n\tele.dataType = 'largedecimal';\n\tele.defaultValue = '0';\n\tele.formatter = 'usd';\n\tvar retVal = ele.format(val);\n\tele = null;\n\treturn retVal;\n}",
"currencyString() {\n switch (GameConstants.Currency[this.cost.currency]) {\n case 'money':\n return 'Pokédollars';\n default:\n return `${GameConstants.camelCaseToString(GameConstants.Currency[this.cost.currency])}s`;\n }\n }",
"formatMoney(value) {\n const formatter = new Intl.NumberFormat('en-US', {\n style: 'currency',\n currency: 'USD',\n minimumFractionDigits: 0\n });\n return formatter.format(value);\n }",
"function local() {\r\n let country = \"Portugal\";\r\n }",
"function getLanguage() {\n return 'en-us';\n}",
"function usCurrency$Format(num) {\n return '$' + num.toFixed(2).replace(/(\\d)(?=(\\d{3})+\\.)/g, '$1,');\n }",
"getVatFieldLabel() {\n const vatLabel = get(\n COUNTRIES_VAT_LABEL,\n this.signUpFormCtrl.model.country.toUpperCase(),\n );\n\n if (vatLabel) {\n return this.$filter('translateDefault')(\n `sign_up_activity_field_vat_${this.signUpFormCtrl.model.legalform}_more`,\n 'sign_up_activity_field_vat_more',\n { vatLabel },\n undefined,\n false,\n 'escapeParameters',\n );\n }\n return this.$filter('translateDefault')(\n `sign_up_activity_field_vat_${this.signUpFormCtrl.model.legalform}`,\n `sign_up_activity_field_vat`,\n { vatLabel },\n undefined,\n false,\n 'escapeParameters',\n );\n }",
"getLang(){\n\t\treturn data.lang;\n\t}",
"function getCulturalFloat(obj,culture)\n {\n if(culture==\"nl-NL\")\n {\n obj=obj.replace(\",\",\".\");\n obj=parseFloat(obj).toFixed(2);\n return obj;\n } \n else\n {\n obj=parseFloat(obj).toFixed(2);\n return obj;\n\n }\n}",
"get() {\n return defaultLocale;\n }",
"function currency ( value ) {\n\treturn \"£\" + _number(value);\n}",
"function rd_localize(strVar){\r if(app.isoLanguage === \"en_US\"){\r return strVar[\"en\"];\r }else if(app.isoLanguage === \"de_DE\"){\r return strVar[\"de\"];\r }\r \r\r }",
"function formatCurrency(amount, currency) {\n // return Intl.NumberFormat('en-US'), // you can also leave blank the language but it will not take the sign of the currency\n return Intl.NumberFormat('en-US', {\n style: 'currency',\n currency, // which is the currency you passed in: like: currency: currency,\n }).format(amount);\n}",
"function rd_localize(strVar){\r if(app.isoLanguage === \"en_US\"){\r return strVar[\"en\"];\r }else if(app.isoLanguage === \"de_DE\"){\r return strVar[\"de\"];\r }\r }"
] |
[
"0.651506",
"0.64985025",
"0.6482709",
"0.62792337",
"0.6258011",
"0.6253429",
"0.62495065",
"0.6238753",
"0.62161463",
"0.62109095",
"0.62088484",
"0.61990064",
"0.60094863",
"0.5987913",
"0.5980939",
"0.59350103",
"0.59262705",
"0.5908184",
"0.5867833",
"0.5865651",
"0.58216137",
"0.58195525",
"0.58169216",
"0.5800721",
"0.579371",
"0.5789135",
"0.578848",
"0.57615095",
"0.576037",
"0.57548666"
] |
0.70016795
|
0
|
mask money event => object d = decimal point (string) sm = separator milhar (string) sd = separator decimal (string) return void
|
money(event, d = 2, sm = '.', sd = ','){
let decimal = d,
separator_milhar = sd,
separator_decimal = sd,
decimal_potention = Math.pow(10, decimal),
separator_thousend = `$1` + separator_milhar,
override_value,
value_pointer,
blocks,
parts,
isObj = typeof event == 'object',
isEmpty = event.target.value.length <= 0;
if(!isObj || isEmpty){
throw new Error('Bad format object');
}
event.target.setAttribute('maxLength', 20);
override_value = event.target.value.replace(/\D/g, '');
value_pointer = (override_value / decimal_potention).toFixed(decimal);
blocks = value_pointer.split('.');
parts = blocks[0]
.toString()
.replace(/(\d)(?=(\d{3})+(?!\d))/g, separator_thousend);
event.target.value = `R$ ${typeof blocks[1] === 'undefined' ? parts : parts + separator_decimal + blocks[1]}`;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function inputuang(e) {\n $(e).maskMoney({\n precision:0,\n prefix:'Rp. ', \n // allowNegative: true, \n thousands:'.', \n // decimal:',', \n affixesStay: true\n });\n }",
"function format_amount(e)\r\n {\r\n var keyUnicode = e.charCode || e.keyCode;\r\n\r\n if (e !== undefined) {\r\n switch (keyUnicode) {\r\n case 16: break; // Shift\r\n case 17: break; // Ctrl\r\n case 18: break; // Alt\r\n case 27: this.value = ''; break; // Esc: clear entry\r\n case 35: break; // End\r\n case 36: break; // Home\r\n case 37: break; // cursor left\r\n case 38: break; // cursor up\r\n case 39: break; // cursor right\r\n case 40: break; // cursor down\r\n case 78: break; // N (Opera 9.63+ maps the \".\" from the number key section to the \"N\" key too!) (See: http://unixpapa.com/js/key.html search for \". Del\")\r\n case 110: break; // . number block (Opera 9.63+ maps the \".\" from the number block to the \"N\" key (78) !!!)\r\n case 190: break; // .\r\n default: $(this).formatCurrency({ colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -1, eventOnDecimalsEntered: true });\r\n }\r\n }\r\n var new_val = $(this).val();\r\n var decimal_pos = new_val.indexOf(\".\");\r\n if(decimal_pos <=0) return;\r\n if((new_val.length - decimal_pos - 1) > 2)\r\n {\r\n //strip decimals more than 2 places\r\n $(this).val(new_val.substr(0,new_val.length - 1));\r\n }\r\n }",
"function format_money(Obj, event) {\n _DECIMAL_DELIMITOR = \",\";\n var theKey;\n //var keyCode = (document.layers) ? keyStroke.which : event.keyCode;\n if (typeof (event) == \"undefined\") {\n theKey = window.event.keyCode;\n }\n else {\n theKey = (window.event) ? event.keyCode : event.which;\n }\n //var theKey = event.keyCode;\n // lay vi tri con tro \n var v_vi_tri_con_tro = doGetCaretPosition(Obj);\n var v_is_vi_tri_con_tro_o_cuoi = (v_vi_tri_con_tro == Obj.value.length) ? 1 : 0;\n //phuonghv add 20/08/2016 tim va thay the cac ky tu khong phai la kieu so ve rong.\n Obj.value = Obj.value.replace(/[^0-9,.-]/g, '');\n var theStringNum = Obj.value;\n theSecondStringNum = \"\";\n // Neu ki tu dau tien la \".\" thi bo qua\n if (theStringNum == \".\") {\n Obj.value = \"\";\n return;\n }\n var the_first_char = theStringNum.substr(0, 1);\n if (the_first_char == \"-\") {\n theStringNum = theStringNum.substr(1, theStringNum.length - 1);\n } else {\n the_first_char = \"\";\n }\n var theLen = theStringNum.length;\n\n pos = theStringNum.indexOf(\".\", 0)\n if (pos > 0) {\n arr_numstr = theStringNum.split(\".\");\n theFirstStringNum = theStringNum.substr(0, pos);\n theSecondStringNum = theStringNum.substr(pos + 1, theStringNum.length - pos);\n if (theSecondStringNum.substr(theSecondStringNum.length - 1, 1) == \".\") {\n Obj.value = the_first_char + theStringNum.substr(0, theStringNum.length - 1);\n return;\n }\n theStringNum = theFirstStringNum;\n }\n //Chi nhan cac ky tu la so\n if ((theKey >= 48 && theKey <= 57) || (theKey >= 96 && theKey <= 105) || (theKey == 8)) {\n var theNewString;\n var theSubString;\n var LastIndex;\n LastIndex = 0;\n theSubString = \"\"\n // Thay the ky tu \",\"\n for (var i = 0; i < theStringNum.length; i++) {\n if (theStringNum.substring(i, i + 1) == _DECIMAL_DELIMITOR)\t\t// Tim ky tu \",\"\n {\n theSubString = theSubString + theStringNum.substring(LastIndex, i)\n LastIndex = i + 1;\n }\n }\n theSubString = theSubString + theStringNum.substring(LastIndex, theStringNum.length) // Lay mot doan cuoi cung (vi doan cuoi cung khong co ky tu \",\")\n theStringNum = theSubString;\n\n theNewString = \"\"\n if (theStringNum.length > 3)\n while (theStringNum.length > 3) {\n theSubString = theStringNum.substring(theStringNum.length - 3, theStringNum.length);\n theStringNum = theStringNum.substring(0, theStringNum.length - 3);\n theNewString = _DECIMAL_DELIMITOR + theSubString + theNewString;\n //phuonghv add 20/08/2016 neu vi tri o cuoi thi tu dong cong them 1 vi them phan tach phan nghin boi dau ,\n if (v_is_vi_tri_con_tro_o_cuoi == 1) {\n v_vi_tri_con_tro++;\n }\n\n }\n if (pos > 0)\n theNewString = theStringNum + theNewString + \".\" + theSecondStringNum;\n else\n theNewString = theStringNum + theNewString;\n\n if (theLen > 3)\n Obj.value = the_first_char + theNewString;\n try {\n Obj.onchange();\n } catch (e) { ; }\n }\n // //phuonghv add 20/08/2016 dat lai vi tri con tro chuot vao vi tri nhap lieu\n setCaretPosition(Obj, v_vi_tri_con_tro);\n}",
"function maskMoeda() {\n\t$(function() {\n\t\t$(\"#prc_prod\").maskMoney({\n\t\t\tthousands : '.',\n\t\t\tdecimal : ','\n\t\t});\n\t})\n}",
"function maskQtd() {\n\t$(function() {\n\t\t$(\"#qtd_prod\").maskMoney({\n\t\t\tthousands : '',\n\t\t\tdecimal : ','\n\t\t});\n\t})\n}",
"function Moneyformat() {\n $('.rate , .quantity').keyup(function (event) {\n // skip for arrow keys\n if (event.which >= 37 && event.which <= 40) return;\n // format number\n $(this).val(function (index, value) {\n return value.replace(/\\D/g, \"\").replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n });\n });\n }",
"function perform(e){\n\t//e = t(e);\n\te = accounting.formatMoney(e);\n\te = e.replace(/^\\s+|\\s+$/g,\"\");\n\treturn e;\n\n}",
"function MaskMoney(){ // criando função construtora, colocar as inicializacoes\r\n\t\tthis.decimal =$('.js-decimal'); // em função contrutora deve ser trocado var por this, pois o mesmo sera acesso no contexto da aplicacao\r\n\t\tthis.plain =$('.js-plain');\r\n\t}",
"function setValueMaskMoney(elemento, valor, precision){\n\tvalor = valor.toString().replace('.', ',');\n\telemento.val(valor).focus().blur();\n}",
"function formatMoney(number, c, d, t) {\n var formattedNumber, i, isNegative, j, n, s;\n n = number;\n isNegative = n < 0;\n c = (isNaN(c = Math.abs(c)) ? 2 : c);\n d = (d == null ? \".\" : d);\n t = (t == null ? \",\" : t);\n s = function(number) {\n if (isNegative) {\n return \"-\" + number;\n } else {\n return number;\n }\n };\n i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + \"\";\n j = ((j = i.length) > 3 ? j % 3 : 0);\n formattedNumber = (j ? i.substr(0, j) + t : \"\") + i.substr(j).replace(/(\\d{3})(?=\\d)/g, \"$1\" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : \"\");\n return s(formattedNumber);\n }",
"function convertMoney(money) {\n return `$ ${money.toFixed(2).toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")}`\n}",
"static styleM(input) {\n return parseFloat(input / 1000).toFixed(2).toString().replace(\".\", \",\");\n }",
"function forceCurrency(event) {\n\t// remove disallowed chars\n\tthis.value = this.value.replace(/[^0-9\\.]/g, \"\");\n\n\t// if only showing a dollar amount, add decimal points to show cents\n\tvar indexOfDecimal = this.value.indexOf(\".\");\n\tif (indexOfDecimal === -1) {\n\t\tthis.value += \".00\";\n\t}\n\t// if decimal is there, force exactly 2 digits after it\n\telse {\n\t\tvar charsAfterDecimal = this.value.slice(indexOfDecimal + 1, this.value.length);\n\t\t\n\t\t// add zeroes to the end of value until there are exactly 2 digits there\n\t\twhile (charsAfterDecimal.length < 2) {\n\t\t\tthis.value += \"0\";\n\t\t\tcharsAfterDecimal = this.value.slice(indexOfDecimal + 1, this.value.length);\n\t\t}\n\n\t\t// cut off any digits after decimal if more than 2\n\t\tthis.value = this.value.slice(0, indexOfDecimal + 3);\n\t}\n\n\t// if value starts with decimal point, add a zero in front. It looks better\n\tif (this.value.charAt(0) == \".\") {\n\t\tthis.value = \"0\" + this.value;\n\t}\n}",
"function unformatMoney(money) {\n return parseFloat(money.replace(/[$,]/g, \"\"));\n }",
"function formatoMoedaVolume(_num) {\n _num = _num.toString().replace(/\\$|\\,/g, '');\n if (isNaN(_num))\n _num = \"0\";\n var sign = (_num == (_num = Math.abs(_num)));\n _num = Math.floor(_num * 1000 + 0.50000000001);\n var cents = _num % 1000;\n _num = Math.floor(_num / 1000).toString();\n if (cents < 10)\n cents = \"0\" + cents;\n for (var i = 0; i < Math.floor((_num.length - (1 + i)) / 3); i++)\n _num = _num.substring(0, _num.length - (4 * i + 3)) + ',' + _num.substring(_num.length - (4 * i + 3));\n //retirando a virgula\n var retorno = (((sign) ? '' : '-') + _num + '.' + cents);\n while (retorno.indexOf(',') > - 1)\n retorno = retorno.replace(',', '');\n return retorno;\n}",
"function cleanMoney(num){\n var out = '', str = String(num);\n for (var i = 1; i <= str.length; i++){\n var x = str.charAt(str.length - i);\n out = x + out;\n if (i % 3 === 0 && i < str.length &&\n !((str.includes('.')) && i === 3)){\n out = ',' + out;\n }\n }\n out = '$' + out;\n return out;\n }",
"function formatMoney(num){ \n return num.toFixed(2).replace(/\\d(?=(\\d{3})+\\.)/g, '$&,');\n}",
"changePrice() {\n var parts = this.precio.toFixed(2).toString().split(\".\");\n var result = parts[0].replace(/\\B(?=(\\d{3})+(?=$))/g, \".\") + (parts[1] ? \",\" + parts[1] : \"\");\n return `$${result}`;\n }",
"function dollars(n) {\n document.paycheck.feedback3.value = \"$ \" + n.toFixed(2);\n}",
"function amountChanged() {\n var origAmount = $('#amount').val();\n\n if ($('#amountFormat').val() == \"DECIMAL\") {\n var amt = $.formatNumber(origAmount, {format: \"#,###.00\", locale: \"us\"});\n $('#realCCAmt').html(amt);\n }\n else {\n origAmount + \"00\";\n var amt = Number(origAmount) / 100;\n amt = $.formatNumber(amt, {format: \"#,###.00\", locale: \"us\"});\n $('#realCCAmt').html(amt);\n }\n}",
"function FormatFourDecimal() {\n if (event != null) {\n var obj = event.srcElement;\n if (obj.value != \"\" && !(isNaN(obj.value))) {\n var intDecimalPlace = obj.value.length - obj.value.lastIndexOf(\".\")\n\n if (intDecimalPlace == 1 || intDecimalPlace == 0 || obj.value.lastIndexOf(\".\") == -1) {\n obj.value = obj.value + \".0000\"\n }\n else if (intDecimalPlace == 2) {\n obj.value = obj.value + \"000\"\n }\n else if (intDecimalPlace == 3) {\n obj.value = obj.value + \"00\"\n }\n else if (intDecimalPlace == 4) {\n obj.value = obj.value + \"0\"\n }\n else if (intDecimalPlace == 5) {\n obj.value = obj.value\n }\n }\n }\n}",
"money( num, fixed ) {\n num = parseFloat( num ) || 0;\n fixed = parseInt( fixed ) || 0;\n let o = { style: 'decimal', minimumFractionDigits: fixed, maximumFractionDigits: fixed };\n return new Intl.NumberFormat( 'en-US', o ).format( num );\n }",
"function formatMoney(number){\r\n\treturn '$' + number.toFixed(2).replace(/\\d(?=(\\d{3})+\\.)/g, '$&,');\r\n}",
"function formatMoney(number){\n return '$'+number.toFixed(2).replace(/\\d(?=(\\d{3})+\\.)/g,'$&,');\n}",
"function FormatNumber(num)\r\n{ \r\n var sVal='';\r\n var minus='';\r\n var CommaDelimiter=',';\r\n\t\t\r\n\t\tvar beforeDelimitorValue='';\r\n\t\tvar afterDelimitorValue=''; \r\n\t\tvar delimitarFlag=false;\r\n try \r\n {\r\n\t\tvar theLength=num.length;\r\n\t\t for (var i = 0 ; i < theLength ; i++)\r\n\t\t {\r\n\t\t if(num.charAt(i) == '.'){\r\n\t\t\t\tdelimitarFlag=true;\r\n\t\t\t}\r\n\t\t\tif(!delimitarFlag){\r\n\t\t\t\tbeforeDelimitorValue=beforeDelimitorValue+num.charAt(i);\t\t\r\n\t\t\t}else{\r\n\t\t\t\tafterDelimitorValue=afterDelimitorValue+num.charAt(i);\t\t\r\n\t\t\t}\r\n\t\t }\r\n\t\t var finalAmount=beforeDelimitorValue.toString();\r\n\t if (finalAmount.lastIndexOf(\"-\") == 0) { minus='-'; }\r\n finalAmount = FormatClean(finalAmount);\r\n finalAmount = parseFloat(finalAmount);\r\n var samount = new String(finalAmount);\r\n\t for (var i = 0; i < Math.floor((samount.length-(1+i))/3); i++)\r\n {\r\n samount = samount.substring(0,samount.length-(4*i+3)) + CommaDelimiter + samount.substring(samount.length-(4*i+3));\r\n }\r\n\t }\r\n catch (exception) { }\r\n return minus + samount+afterDelimitorValue;\r\n}",
"function fomartMoney(number) {\n\treturn '$' + number.toFixed(2).replace(/\\d(?=(\\d{3})+\\.)/g, '$&,')\n}",
"function formatMoney(number) {\r\n return '$ ' + number.toFixed(2).replace(/\\d(?=(\\d{3})+\\.)/g, '$&,');\r\n}",
"function formatPrice(num)\n{\n\t num = num.toString().replace(/\\$|\\,/g,'');\n\t if(isNaN(num))\n\t num = \"0\";\n\t sign = (num == (num = Math.abs(num)));\n\t num = Math.floor(num*100+0.50000000001);\n\t cents = num%100;\n\t num = Math.floor(num/100).toString();\n\t if(cents<10)\n\t cents = \"0\" + cents;\n\t for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)\n\t num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3));\t \n\t //return (((sign)?'':'-') + '<?php //echo $this->model_superadmin->generate_isocode_bo()?> ' + num + ',' + cents);\n\t return (((sign)?'':'-') + 'Rp. '+ num +',00');\n}",
"function FormatNum(num,mil,dec){\n\tvar num=new String(num);\n\tvar p=num.indexOf(\".\"); // se for = -1 n tem ponto\n\tif (p==-1){ \n\t\tnum+=\".00\";\n\t} else { \n\t\txy=num.split(\".\");\n\t\tt=xy[1];\n\t\tt=t.length;\n\t\tif (t==1){ num+=\"0\"; }\n\t}\n\tvar xe=num.split(\".\");\n\tvar te=xe[0];\n\tvar tamanho=te.length;\n\tvar vl='';\n\tvar c=0;\n\tvar te=te.replace(\"\",\" \");\n\tfor (i=tamanho; i > 0 ; i--){\t\t\n\t\tn=te.charAt(i);\n\t\tif (c==3){ vl=mil+vl; c=0; }\t\t\t\n\t\tvl=n+vl;\n\t\tc++;\n\t}\n\tif (vl==\"\"){ vl=0; }\n\tvar total=vl+\",\"+xe[1]\n\treturn total;\n}",
"callback(value) {\n return formatCurrency(value, 0);\n }"
] |
[
"0.6767298",
"0.6744517",
"0.67332816",
"0.65413684",
"0.62796265",
"0.6259652",
"0.6182066",
"0.61473644",
"0.6076687",
"0.6056442",
"0.604357",
"0.60005164",
"0.6000347",
"0.59704",
"0.59254843",
"0.58790016",
"0.5857714",
"0.5849423",
"0.58411807",
"0.5815827",
"0.57933676",
"0.57736075",
"0.5754655",
"0.5751449",
"0.57411283",
"0.5726135",
"0.57059216",
"0.56949204",
"0.5694171",
"0.56936055"
] |
0.8255722
|
0
|
mask postal event => object return void
|
postal(event){
let isObj = typeof event == 'object',
isEmpty = event.target.value.length <= 0;
if(!isObj || isEmpty){
throw new Error('Bad format object');
}
event.target.setAttribute('maxLength', 9);
let v = event.target.value;
event.target.value = v
.replace(/\D/g, '')
.replace(/(\d{5})(\d)/, "$1-$2")
.replace(/(-\d{3})\d+?$/, "$1");
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function MaskMarkerVisitor() {\n}",
"onStoreAfterRequest(event) {\n if (this.activeMask && !event.exception) {\n this.unmaskBody();\n }\n }",
"function mask_cpfcnpj(obj, event)\n{\n if ( obj.value.length > 14 )\n MascaraCNPJ(obj, event);\n else\n MascaraCPF(obj, event);\n}",
"function setEventMarker(postal) {\n httpGet('https://maps.googleapis.com/maps/api/geocode/json?address=' + postal + '&sensor=true', function(data) {\n // console.log(data); // Debugging Purpose\n if (data.status = 'OK') {\n if (eventMarker) {\n eventMarker.remove();\n }\n\n var lng = data.results[0].geometry.location.lng,\n lat = data.results[0].geometry.location.lat;\n\n eventMarker = new mapboxgl.Marker({\n color: '#DC3545'\n })\n .setLngLat([lng, lat])\n .addTo(map);\n\n var btnFocus = doc.querySelector('button#zoomEvent');\n btnFocus.setAttribute('data-lng', lng);\n btnFocus.setAttribute('data-lat', lat);\n\n btnFocus.onclick = function() {\n map.flyTo({ center: [this.getAttribute('data-lng'), this.getAttribute('data-lat')] });\n }\n }\n });\n}",
"function ready() {\n $(document).on('click', '.phoneMask', function () {\n $('.phoneMask').mask('X (999) 999-99-99', {\n translation: {\n 'X': {\n pattern: /[7-8]/\n }\n }\n });\n })\n}",
"function maskTelefone(){\r\n $(\".telefoneMask\").mask(\"(99) 9999-9999?9\").focusout(function(event){\r\n var target, phone, element; \r\n target = (event.currentTarget) ? event.currentTarget : event.srcElement; \r\n phone = target.value.replace(/\\D/g, '');\r\n element = $(target); \r\n element.unmask(); \r\n if(phone.length > 10) { \r\n element.mask(\"(99) 99999-999?9\"); \r\n } else { \r\n element.mask(\"(99) 9999-9999?9\"); \r\n } \r\n });\r\n}",
"function addressBarFocused(event){\n clearMask();\n }",
"function markTouch(event) {\n event && (event.zrByTouch = true);\n} // function markTriggeredFromLocal(event) {",
"function markTouch(event) {\n event && (event.zrByTouch = true);\n} // function markTriggeredFromLocal(event) {",
"function maskPhone(selector, masked = '+7 (___) ___-__-__') {\n const elems = document.querySelectorAll(selector);\n\n function mask(event) {\n const keyCode = event.keyCode;\n const template = masked,\n def = template.replace(/\\D/g, \"\"),\n val = this.value.replace(/\\D/g, \"\");\n console.log(template);\n let i = 0,\n newValue = template.replace(/[_\\d]/g, function (a) {\n return i < val.length ? val.charAt(i++) || def.charAt(i) : a;\n });\n i = newValue.indexOf(\"_\");\n if (i != -1) {\n newValue = newValue.slice(0, i);\n }\n let reg = template.substr(0, this.value.length).replace(/_+/g,\n function (a) {\n return \"\\\\d{1,\" + a.length + \"}\";\n }).replace(/[+()]/g, \"\\\\$&\");\n reg = new RegExp(\"^\" + reg + \"$\");\n if (!reg.test(this.value) || this.value.length < 5 || keyCode > 47 && keyCode < 58) {\n this.value = newValue;\n }\n if (event.type == \"blur\" && this.value.length < 5) {\n this.value = \"\";\n }\n\n }\n\n for (const elem of elems) {\n elem.addEventListener(\"input\", mask);\n elem.addEventListener(\"focus\", mask);\n elem.addEventListener(\"blur\", mask);\n }\n\n}",
"function MascaraTelefone(tel, event){ \n if(mascaraInteiro(tel, event)==false){\n event.returnValue = false;\n return false;\n } \n return formataCampo(tel, '(00) 0000-0000', event);\n}",
"function zipBlurFunction() {\n getPlace();\n}",
"_onEditAddress() {\n AddressActions.editAddress();\n }",
"handleAddressChange(e) {\n \n this.setState({\n address: e,\n valid_addr: true\n })\n }",
"function tpostal()\r\n {\r\n var pin_code_js = document.getElementById('to_post');\r\n var pin_code_js_value = pin_code_js.value.trim();\r\n if (pin_code_js_value == null || pin_code_js_value == \"\") {\r\n \tdocument.getElementById(\"tpostal\").innerHTML=\"Postal code must be filled out !\";\r\n $(function(){\r\n $(\"#to_post\").focus() });\r\n \r\n } else if (is_valid = !/^[a-zA-Z0-9 ]+$/.test(pin_code_js_value)) {\r\n \tdocument.getElementById(\"tpostal\").innerHTML=\"Postal code Only charecters and numerics\";\r\n $(function(){\r\n $(\"#to_post\").focus() });\r\n \r\n } else if (pin_code_js_value.length != 6) {\r\n \t document.getElementById(\"tpostal\").innerHTML=\"Postal code must have 6 digits only !\";\r\n $(function(){\r\n $(\"#to_post\").focus() });\r\n \r\n }\r\n else\r\n {\r\n \tcount++;\r\n }\r\n }",
"onStoreAfterRequest(event) {\n if (this.loadMask && !event.exception) {\n this.masked = null;\n this.toggleEmptyText();\n }\n }",
"handleShippingAddressState(e){\n const { rfq } = this.props\n const stateValue = ( null !== e )? e.value : ''\n rfq.shipping_address.state = stateValue\n this.props.updateRFQ( rfq )\n }",
"function initMasks(){\n $(\"[js-cta-phone]\").mask(\"000 000-00-00\", {\n // placeholder: \"+7 (___) ___-____\"\n });\n }",
"function maskEvent(field, field_size, _mask, event) {\r\n\tvar key ='';\r\n\tvar aux='';\r\n\tvar len=0;\r\n\tvar i=0;\r\n\tvar strCheck = '0123456789';\r\n\tvar rcode = (window.Event) ? event.which : event.keyCode;\r\n\r\n\tif((rcode == 13) || (rcode == 8) || (rcode == 9) || (rcode == 0)) {\r\n\t\t//Enter BreakSpace TAB OUTROS\r\n\t\treturn true;\r\n\t}\r\n\r\n if(field.value.length < field_size) {\r\n \t\t//Get key value from key code\r\n\t\tkey=String.fromCharCode(rcode);\r\n\t\r\n\t\tif(strCheck.indexOf(key)==-1) {\r\n\t\t\t//Not a valid key\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\r\n\t\taux=field.value+key;\r\n\t\t//window.alert(aux);\r\n\t\taux=mask(_mask,aux);\r\n\t\t//window.alert(aux);\r\n\t\tfield.value=aux;\t\r\n\t}\r\n\treturn false;\r\n}",
"function applyMask(maskText){\n addressBarElement.style = maskText;\n }",
"function maskInput(input, textbox, location, eventoftxtbox, checkforZipCode, Phonenumber) {\n var currentindex = getCaret(textbox);\n var reg0Str = '^\\d{3}-?\\d{2}-?\\d{4}$';\n\n if (checkforZipCode == undefined) {\n checkforZipCode = false;\n }\n if (Phonenumber == undefined) {\n Phonenumber = false;\n }\n\n if (checkforZipCode) {\n reg0Str = '^\\d{5}-?\\d{4}$';\n }\n\n if (Phonenumber) {\n reg0Str = '^\\d{3}-?\\d{3}-?\\d{4}$';\n }\n\n var reg0 = new RegExp(reg0Str);\n if (reg0.test(input)) return true;\n\n\n if (eventoftxtbox.keyCode != 37 && eventoftxtbox.keyCode != 38 && eventoftxtbox.keyCode != 39 && eventoftxtbox.keyCode != 40 && eventoftxtbox.keyCode != 17) {\n var delimiter = '-';\n if (input != '') {\n input = input.replace(/\\-/g, '');\n }\n if (Phonenumber) {\n input = input.substring(0, 10);\n }\n else {\n if (input.length > 9) {\n input = input.substring(0, 9);\n }\n }\n //Get the delimiter positons\n var locs = location.split(',');\n\n if (checkforZipCode) {\n //Iterate until all the delimiters are placed in the textbox\n for (var delimCount = 0; delimCount <= locs.length; delimCount++) {\n for (var inputCharCount = 0; inputCharCount <= 5; inputCharCount++) {\n\n //Check for the actual position of the delimiter\n if (inputCharCount == locs[delimCount] && input.length > 5) {\n\n //Confirm that the delimiter is not already present in that position\n if (input.substring(inputCharCount, inputCharCount + 1) != delimiter) {\n input = input.substring(0, inputCharCount) + delimiter + input.substring(inputCharCount, input.length);\n if (input.substring(inputCharCount, inputCharCount + 1) != delimiter) {\n input = input.substring(0, inputCharCount) + delimiter + input.substring(inputCharCount, input.length);\n }\n }\n }\n }\n }\n }\n else {\n //Iterate until all the delimiters are placed in the textbox\n for (var delimCount = 0; delimCount <= locs.length; delimCount++) {\n for (var inputCharCount = 0; inputCharCount <= input.length; inputCharCount++) {\n\n //Check for the actual position of the delimiter\n if (inputCharCount == locs[delimCount] && input.length > locs[delimCount]) {\n\n //Confirm that the delimiter is not already present in that position\n if (input.substring(inputCharCount, inputCharCount + 1) != delimiter) {\n input = input.substring(0, inputCharCount) + delimiter + input.substring(inputCharCount, input.length);\n if (input.substring(inputCharCount, inputCharCount + 1) != delimiter) {\n input = input.substring(0, inputCharCount) + delimiter + input.substring(inputCharCount, input.length);\n }\n }\n }\n }\n }\n }\n\n textbox.value = input;\n if (currentindex != 'undefined') {\n\n if (eventoftxtbox.keyCode == 46) {\n textbox.selectionStart = currentindex;\n textbox.selectionEnd = currentindex;\n }\n else {\n textbox.selectionStart = currentindex + 1;\n textbox.selectionEnd = currentindex + 1;\n }\n }\n }\n}",
"function maskPhone(countryCode, fieldInstance) {\n if(countryCode==='CA' || countryCode==='USD') {\n \t fieldInstance.attr('data-inputmask', '\"mask\": \"(999) 999-9999\"');\n } else {\n \t fieldInstance.attr('data-inputmask', \"'mask': ['999-999-9999 [x99999]', '+099 99 99 9999[9]-9999']\");\n }\n $('[data-mask]').inputmask();\n }",
"mask() {\n this.expInfo[\"operation\"] = this.operation.value\n this.expInfo[\"value\"] = this.valueSelector.value\n this.paneOb.altFiltersState[this.id].op = this.operation.value\n this.paneOb.altFiltersState[this.id].val = this.valueSelector.value\n /** The list of 1's and 0's corresponding to whether the element at a particular index in the alternate column passes the logical comparison to the filter's specific operation and value choices */\n this.boolMask = this.paneOb.csvData[this.altColSelect.value].map(e => {\n if (this.operation.value == \"==\") {\n if (e == this.valueSelector.value) {\n return 1\n }\n return 0\n }\n if (this.operation.value == \"!=\") {\n if (e != this.valueSelector.value) {\n return 1\n }\n return 0\n }\n if (this.operation.value == \">\") {\n if (e > parseFloat(this.valueSelector.value)) {\n return 1\n }\n return 0\n }\n if (this.operation.value == \"<\") {\n if (e < parseFloat(this.valueSelector.value)) {\n return 1\n }\n return 0\n }\n })\n // emit event on the holder that the altchanged\n let altchange = new Event(\"altchange\")\n this.outerHolder.dispatchEvent(altchange)\n\n }",
"function Munge(PreOrPost)\n{\n /* Set the value for .AddressStatusCurrent to .AddressStatus, or \"Blank\" if .AddressStatus has no value, strip special char, */\n var selectedUnitPage = findPage('pyWorkPage.BCU.SelectedUnitPage');\n var addressStatus = ALMCB_Helpers.getFieldValue(selectedUnitPage, \"AddressStatus\");\n var addressStatusCurrent = ALMCB_Helpers.getFieldValue(selectedUnitPage, \"AddressStatusCurrent\");\n var addressStatusLast = ALMCB_Helpers.getFieldValue(selectedUnitPage, \"AddressStatusLast\");\n\n /**/\n console.log(\"addressStatus : \" + addressStatus);\n if (addressStatus == \"\")\n {\n addressStatusCurrent =\"\";\n } else {\n /* check for (GQ) and (TL) and remove */ \n if (addressStatus.indexOf(\"(\") >= 0)\n addressStatus = addressStatus.substr(0, addressStatus.length - 4).trim();\n\n /* strip out any special chars*/\n addressStatus = addressStatus.replace(/[`~!@#$%^&*()_|+\\-=?;:'\",.<>\\{\\}\\[\\]\\\\\\/]/gi, '');\n\n switch (PreOrPost) {\n case \"Pre\": \n if (addressStatus == \"Blank\")\n {\n addressStatusCurrent=addressStatus;\n addressStatusLast=addressStatus;\n }\n break;\n case \"Post\": \n addressStatusCurrent=addressStatus;\n if (addressStatusLast == \"\")\n addressStatusLast=addressStatus;\n if (addressStatusLast != addressStatusCurrent)\n addressStatusLast=addressStatusCurrent;\n break;\n }\n }\n selectedUnitPage.put('AddressStatusCurrent', addressStatusCurrent);\n selectedUnitPage.put('AddressStatusLast', addressStatusLast);\n SaveSelectedUnitPage();\n\n console.log(\"addressStatus : \" + addressStatus);\n}",
"hook(evt) {\n if (clipboard.intercept) {\n evt.preventDefault(); // prevents copying highlighted section into clipboard\n evt.clipboardData.setData(\"text/html\", clipboard.data);\n\n // reset when done\n clipboard.intercept = false;\n clipboard.data = \"\";\n }\n }",
"function setDaumPostCode() {\n const layer = document.querySelector(\".address-layer\");\n document.querySelector(\"#btnSearch\").addEventListener(\"click\", function () {\n daum.getAddress(layer);\n });\n}",
"onAddressChange(text) {\n this.props.addressChange(text);\n }",
"EventStreetView () {}",
"function mapClickStreetAddress() {\n\tlet geocode;\n\tmap.addEventListener('click', function (event) {\n\t\tgeocode = [event.latlng.lat, event.latlng.lng].toString()\n\t\tlet prox = `${event.latlng.lat.toString()},`\n\t\tprox += `${event.latlng.lng.toString()}, 100`\n\n\t\tlet reverseGeocodingParameters = {\n\t\t\tprox: prox, // (example)prox: '52.5309,13.3847,150',\n\t\t\tmode: 'retrieveAddresses',\n\t\t\tmaxresults: 1\n\t\t};\n\n\t\tgeocoder.reverseGeocode(reverseGeocodingParameters, onSuccess, function (error) {\n\t\t\tconsole.log('mapClickStreetAddress: error: ', error);\n\t\t});\n\t})\n\tfunction onSuccess(result) {\n\t\tlet address = result.Response.View[0].Result[0].Location.Address\n\t\tconsole.log('the address_string: ', address.Label);\n\n\t\t// let obj = {\n\t\tlet audioFile = {\n\t\t\taddress_string: address.Label,\n\t\t\tstreet_number: address.HouseNumber,\n\t\t\tstreet_name: address.Street,\n\t\t\tcity: address.City,\n\t\t\tstate: address.State,\n\t\t\tpostal_code: address.PostalCode,\n\t\t\tgeocode: geocode\n\t\t}\n\n\t\t// a valid LatLng does NOT mean we have a valid street address ...\n\t\tif (!audioFile.street_number || !audioFile.street_name) {\n\t\t\tresetAddressForm()\n\n\t\t\t$('#geocode').html('<p>Please click again, there is no valid address within 100 meters of where you clicked.</p>').css('background-color', 'pink')\n\t\t\treturn;\n\t\t} else {\n\n\t\t\t// if we have a valid street address, the data is replaced on the DOM, in the address form, for User to edit/accept.\n\t\t\tloadDataToAddressForm(audioFile)\n $('#geocode-label').show()\n\t\t\t$('#voter-preference-form-div').css(\"background-color\", \"rgb(183, 240, 160)\");\n\t\t\t$('#submit-vote-preference-button').css(\"background-color\", \"rgb(183, 240, 160)\");\n\t\t\t$('#geocode').html(`<p>${audioFile.geocode}</p>`)\n\t\t}\n\t}\n}",
"_textBoxKeyUpHandler() {\n const that = this;\n\n that.value = that._getValueWithTextMaskFormat({ start: 0, end: that._mask.length }, that.textMaskFormat);\n }"
] |
[
"0.5835061",
"0.56395924",
"0.5594026",
"0.5395339",
"0.5369281",
"0.5360633",
"0.5350389",
"0.53418493",
"0.53418493",
"0.53011334",
"0.52943146",
"0.5264602",
"0.5187621",
"0.5172707",
"0.51695657",
"0.50957537",
"0.50862104",
"0.50561285",
"0.50167686",
"0.50034493",
"0.49717838",
"0.4961285",
"0.49129292",
"0.49064466",
"0.4906374",
"0.49020448",
"0.487683",
"0.48750716",
"0.48463628",
"0.4832374"
] |
0.56837326
|
1
|
This function check cookie el => (string) return bool
|
checkCookie(el){
let status = this.getCookie(el);
if(status == "" || status == null){
return false;
}
return true;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function chkcookies(){\n\tvar NameOfCookie=\"userID\";\n\tvar c = document.cookie.indexOf(NameOfCookie+\"=\"); \n\tif (c != -1){\n\t\treturn(true);\n\t}\n\telse{\n\t\treturn (false);\n\t}\n}",
"function checkCookie(cname) {\r\n if (getCookie(cname)==\"\") {return false;}\r\n else {return true;}\r\n}",
"function checkCookie(name) {\nvar cookieCheck = getCookie(name);\nif (cookieCheck == \"\") {\n return false;\n} else {\n if (cookieCheck !== \"\" && cookieCheck !== null) {\n return true;\n }\n}\n}",
"function is_cookie_valid(cookie_name, domain, cb_cookie_valid) {\n\n}",
"function GCookieCheck(cname) {\n var val = GCookieGet(cname);\n if (val != null) {\n return true;\n } else {\n return false;\n }\n}",
"function checkCookieCor(name) {\n\tvar nameEQ = name + \"=\";\n\tvar ca = document.cookie.split(';');\n\tfor(var i=0;i < ca.length;i++) {\n\t\tvar c = ca[i];\n\t\twhile (c.charAt(0)==' ') c = c.substring(1,c.length);\n\t\tif (c.indexOf(nameEQ) == 0) return true;\n\t}\n\treturn false;\n}",
"function testCookie() {\n var alreadyAccepted = false;\n\n var ca = document.cookie.split(';');\n for (var i = 0; i < ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(\"acceptedCookies=\") === 0) alreadyAccepted = true;\n }\n if (!alreadyAccepted) document.getElementById(\"cookieNotice\").style.display = \"block\";\n}",
"hasCookie(key) {\n if (this.headers && 'Cookie' in this.headers) {\n const cookies = cookie.parse(this.headers.Cookie);\n if (key in cookies) {\n return true;\n }\n }\n return false;\n }",
"function checkCookie(cookieName) {\n if (document.cookie.indexOf(cookieName) !== -1) {\n return true;\n } else {\n return false;\n }\n }",
"function CookieRead() {\n var allcookies=this.$doc.cookie\n\n if (allcookies==\"\") {\n return false\n }\n\n var start= allcookies.indexOf(this.$name+'=')\n\n if (start== -1) {\n return false\n }\n\n start += this.$name.length+1\n var end=allcookies.indexOf(';',start)\n if (end == -1) end=allcookies.length\n var cookieval = allcookies.substring(start,end)\n var a = cookieval.split('&')\n for (var i=0;i < a.length;i++) a[i]=a[i].split(':')\n for (var i=0;i < a.length;i++) this[a[i][0]]=unescape(a[i][1])\n return true\n}",
"function isLoggedIn() {\n return document.cookie.match(/ twid=/)\n }",
"function parse_cookie(){\n try {\n let cookie = document.cookie\n .split('; ')\n .find(row => row.startsWith('aip_fp'))\n .split('=')[1];\n cookie = JSON.parse(decodeURIComponent(cookie));\n assert(Object.keys(cookie).length === 2);\n assert(Object.keys(cookie).includes('email'));\n assert(Object.keys(cookie).includes('loginToken'));\n return cookie;\n } catch (err){\n document.cookie = 'aip_fp=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';\n return false;\n }\n }",
"function hasCookie(sKey) {\n if (!sKey) { return false; }\n return (new RegExp(\"(?:^|;\\\\s*)\" + encodeURIComponent(sKey).replace(/[\\-\\.\\+\\*]/g, \"\\\\$&\") + \"\\\\s*\\\\=\")).test(document.cookie);\n}",
"function cookieExists(cookie_name) {\n return (getCookie(cookie_name) !== \"\");\n}",
"function checkCookie(claveCookie) {\n var nivell = getCookie(claveCookie);\n if (nivell != \"\") {\n return nivell;\n } else {\n return 0;\n }\n}",
"function lectura_cookies(cookie) {\n let c = document.cookie\n let cookies = c.split(\";\");\n let regex = new RegExp(cookie, \"i\");\n for (indice in cookies) {\n let coincidencia = cookies[indice].search(regex);\n if (coincidencia > -1) {\n var posCookie = indice;\n break;\n }\n else {\n var posCookie = -1;\n }\n }\n if (posCookie != -1) {\n let valor_cookie = cookies[posCookie].split(\"=\")[1];\n return valor_cookie\n }\n else {\n return false\n }\n}",
"function checkACookieExists() {\n if (document.cookie == undefined) return false;\n let field = document.cookie.split('; ').find(row => row.startsWith('likes='));\n if (field == undefined) return false;\n return JSON.parse(field.split('=')[1]);\n}",
"function cookieExists(c_name)\n{\n if (document.cookie.length>0)\n {\n\tc_start=document.cookie.indexOf(c_name + \"=\");\n\tif (c_start!=-1)\n\t{\n\t c_start=c_start + c_name.length+1;\n\t c_end=document.cookie.indexOf(\";\",c_start);\n\t if (c_end==-1) c_end=document.cookie.length;\n\t return 1;\n\t}\n }\n return 0;\n}",
"function GetCookie(e) {\n for (var t = e + \"=\", x = t[\"length\"], o = document[\"cookie\"][\"length\"], i = 0; i < o;) {\n var _ = i + x;\n if (document[\"cookie\"][\"substring\"](i, _) == t) return \"here\";\n if (0 == (i = document[\"cookie\"][\"indexOf\"](\"\", i) + 1)) break\n }\n return null\n}",
"function checkedCookies() {\n\tvar decodedCookie = decodeURIComponent(document.cookie);\n\tvar ca = decodedCookie.split(';');\n\tfor(var i = 0; i <ca.length; i++) {\n\t\tvar c = ca[i];\n\t\twhile (c.charAt(0) == ' ') {\n\t\t\tc = c.substring(1);\n\t\t}\n\t\tif (c.indexOf('redirected') == 0) {\n\t\t\tconsole.log('already redirected');\n\t\t\treturn true;\n\t\t}\n\t}\n\tconsole.log('redirecting');\n\treturn false;\n}",
"function checkCookie() {\n var cookiecontent=getCookie(\"confidence\"); \n //checking cookie called \"pg2pgwhichtouch\", putting contents into cookiecontent \n \n if (cookiecontent == \"novice\") { //if that cookie has been set\n alert(\"You think you don't know anything at all.\"); \n } else if (cookiecontent == \"confident\") { //if that cookie has been set\n alert(\"You think you're alright.\"); \n } else if (cookiecontent == \"genius\") { //if that cookie has been set\n alert(\"You think you're a genius.\"); \n } else {\n alert(\"It's not working :( \");\n }\n \n}",
"function checkCookie() {\n\t// If no cookie \"browser_validation_notified\" found\n\tif ($.cookie('browser_validation_notified') ) {\n\t\tcookie_found = true;\n\t\t//console.log(\"cookie browser_validation_notified found\");\n\t\treturn cookie_found;\n\t} else {\n\t\tcookie_found = false;\n\t\treturn cookie_found;\n\t}\n}",
"function readCookie(e){\n\tvar t=e+\"=\";\n var n=document.cookie.split(\";\");\n\t\n for(var r=0;r<n.length;r++){\n\t\tvar i=n[r];\n while(i.charAt(0)==\" \")i=i.substring(1,i.length);\n if(i.indexOf(t)==0)return i.substring(t.length,i.length)\n\t}\n\t\n\treturn false;\n}",
"function distilledCheckAnalyticsCookie() {\n\tvar cookiename = \"__utma\";\n\tvar cookiecheck = 0;\n\tvar cookies = document.cookie.split(';');\n\tfor (var i=0;i<cookies.length;i++){\n\t\twhile (cookies[i].charAt(0)==' ') cookies[i] = cookies[i].substring(1,cookies[i].length);\n\t\tif (cookies[i].indexOf(cookiename+'=') == 0){\n\t\t\tcookiecheck = 1;\n\t\t} //if\n\t} //for\n\treturn cookiecheck;\n}//distilledCheckAnalyticsCookie",
"function checkForOurCookiesValue() {\n var allTheCookies = document.cookie;\n\n console.log(allTheCookies);\n\n if(allTheCookies.includes(this_cookies_value)) {\n jQuery(\".exampleSection\").css(\"opacity\",1);\n } else {\n jQuery(\".exampleSection\").css(\"opacity\",0);\n };\n\n }",
"function hasRememberMeCookie() {\n\t//alert(\"Inside has RememberMeCookie\");\n\tvar hasCookie = false;\n\tvar cookieValue = getCookie('QwestRememberMe');\n\t\n\tif (cookieValue == null || cookieValue == \"\") {\n\t\thasCookie = false;\n\t} else {\n\t\thasCookie = true;\n\t}\n\t//alert(\"RememberMeCookie present : \" +hasCookie);\n\treturn hasCookie;\n}",
"function getCookie(name) {\n var name = name + \"=\";\n var decodeCookie = decodeURIComponent(document.cookie);\n var ca = decodeCookie.split(';');\n for (var i=0; i<ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0) == ' ') {\n c = c.substring(1);\n }\n if (c.indexOf(name) == 0) {\n var cookieValue = c.substring(name.length, c.length)\n if (cookieValue == \"true\") {return true}\n if (cookieValue == \"false\") {return false}\n }\n }\n return \"\";\n}",
"loggedIn() {\n return !!cookie.load('token');\n }",
"checkSignedIn() {\n if (\n Cookies.get(\"cId\") === undefined ||\n Cookies.get(\"cM\") === undefined ||\n Cookies.get(\"sin\") === undefined ||\n Cookies.get(\"type\") === undefined\n ) {\n return false;\n } else {\n\n\n return true;\n }\n }",
"function checkcookie() {\n\t\tif (document.cookie.indexOf(\"messengerUname\") == -1) {\n\t\t\t\tshowlogin();\n\t\t} else {\n\t\t\t\thideLogin();\n\t\t}\n}"
] |
[
"0.73606443",
"0.72911894",
"0.7180929",
"0.71735245",
"0.71650785",
"0.70307887",
"0.6869332",
"0.68459654",
"0.6831618",
"0.6825115",
"0.67239934",
"0.66806513",
"0.6665405",
"0.6634839",
"0.6592151",
"0.6562246",
"0.65170187",
"0.6499462",
"0.64911544",
"0.64473623",
"0.64401233",
"0.6423531",
"0.64206755",
"0.6389081",
"0.63612723",
"0.63394314",
"0.6308053",
"0.6304153",
"0.630038",
"0.6298872"
] |
0.84635955
|
0
|
React navigation tab stack for Playlist Analyser.
|
function TabOneNavigator() {
return (
<TabOneStack.Navigator>
<TabOneStack.Screen
name="PlaylistAnalyserHome"
component={PlaylistAnalyser}
options={{ headerTitle: 'Playlist Analyser' }}
/>
<TabOneStack.Screen
name="SearchSong"
component={SearchSong}
options={{ headerTitle: 'Playlist Analyser' }}
/>
<TabOneStack.Screen
name="SearchPlaylist"
component={SearchPlaylist}
options={{ headerTitle: 'Playlist Analyser' }}
/>
<TabOneStack.Screen
name="SearchPlaylistResults"
component={SearchPlaylistResults}
options={{ headerTitle: 'Playlist Analyser' }}
/>
<TabOneStack.Screen
name="PlaylistResults"
component={PlaylistResults}
options={{ headerTitle: 'Playlist Analyser' }}
/>
</TabOneStack.Navigator>
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"render(){\n var trackers_list = get_top_trackers()\n\n return (\n <div className=\"flex-container\">\n <Tab.Container id=\"tracker-tabs\" defaultActiveKey=\"first\">\n <Row class=\"tracker-list-box\">\n <Col sm={3}>\n <Nav variant=\"pills\" className=\"flex-column\">\n <Nav.Item>\n <Nav.Link variant=\"primary\" className=\"header-tab\" eventKey=\"first\">Website</Nav.Link>\n </Nav.Item>\n {trackers_list.map(datas =>\n <Nav.Item>\n <Nav.Link variant=\"primary\" eventKey={datas[0]}>{datas[0]}</Nav.Link>\n </Nav.Item>\n )}\n </Nav>\n </Col>\n <Col sm={8}>\n <Tab.Content>\n <Tab.Pane eventKey=\"first\">\n <p className=\"text-for-tabs\"> Click on a tab to view a scrollable list of the trackers on that website!\n </p>\n </Tab.Pane>\n {trackers_list.map(datas =>\n <Tab.Pane eventKey={datas[0]}>\n <ul class=\"tracker-list\">\n {datas[1].map(tracker =>\n <li style={{listStyle: 'circle', marginLeft: '4px', marginTop: '2px', marginBottom: '2px'}}>{tracker}</li>\n )}\n </ul>\n </Tab.Pane>\n )}\n </Tab.Content>\n </Col>\n </Row>\n </Tab.Container>\n </div>\n )\n }",
"renderTabs() {\n return (\n <Tabs defaultActiveKey={1} id=\"tab\" >\n <Tab eventKey={1} title=\"Projects\">\n {this.renderProjs()}\n </Tab>\n <Tab eventKey={2} title=\"Users\">\n {this.renderUsers()}\n </Tab>\n <Tab eventKey={3} title=\"Search\">\n {this.renderSearch()}\n <ListGroup><br /><br />\n {this.renderResult()}\n </ListGroup>\n </Tab>\n </Tabs>\n );\n }",
"function TabStack(props) {\n const tabPress = (e) => {\n global.currenRouter = e.target.split(\"-\")[0];\n };\n return (\n <Tab.Navigator\n initialRouteName=\"Home\"\n activeColor=\"#e91e63\"\n shifting={true}\n barStyle={{\n backgroundColor: \"white\",\n }}\n >\n <Tab.Screen\n name=\"Home\"\n component={CategoriesScreen}\n listeners={{ tabPress }}\n options={{\n title: \"Trang chủ\",\n tabBarIcon: ({ color }) => (\n <Icon color={color} name=\"home\" size={26} />\n ),\n }}\n />\n\n {/* <Tab.Screen name=\"Template\" component={TemplateStackScreen} listeners={{ tabPress }} /> */}\n <Tab.Screen\n name=\"Message\"\n component={MessageScreen}\n listeners={{ tabPress }}\n options={{\n title: \"Tin Nhắn\",\n tabBarIcon: ({ color }) => (\n <Icon color={color} name=\"comment\" size={26} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Account\"\n component={AccountScreen}\n listeners={{ tabPress }}\n options={{\n title: \"Tài Khoản\",\n tabBarIcon: ({ color }) => (\n <Icon color={color} name=\"account-circle\" size={26} />\n ),\n }}\n />\n </Tab.Navigator>\n );\n}",
"renderProjs() {\n return (\n <div className=\"projs\">\n <PageHeader>All Projects</PageHeader>\n <Tabs defaultActiveKey={1} id=\"projtab\" >\n <Tab eventKey={1} title=\"All Projects\">\n <ListGroup>\n {this.renderProjsList(this.state.projs)}\n </ListGroup>\n </Tab>\n <Tab eventKey={2} title=\"Completed Projects\">\n <ListGroup>\n {this.renderCompProjsList(this.state.projs)}\n </ListGroup>\n </Tab>\n <Tab eventKey={3} title=\"Active Projects\">\n <ListGroup>\n {this.renderActiveProjsList(this.state.projs)}\n </ListGroup>\n </Tab>\n <Tab eventKey={4} title=\"Pending Projects\">\n <ListGroup>\n {this.renderPendingProjsList(this.state.projs)}\n </ListGroup>\n </Tab>\n </Tabs>\n </div>\n );\n }",
"function TabTwoNavigator() {\n return (\n <TabTwoStack.Navigator>\n <TabTwoStack.Screen\n name=\"SongAnalyserHome\"\n component={SongAnalyser}\n options={{ headerTitle: 'Song Analyser' }}\n />\n <TabTwoStack.Screen\n name=\"SearchSong\"\n component={SearchSong}\n options={{ headerTitle: 'Song Analyser' }}\n />\n <TabTwoStack.Screen\n name=\"SongResults\"\n component={SongResults}\n options={{ headerTitle: 'Song Analyser' }}\n />\n </TabTwoStack.Navigator>\n );\n}",
"setStackTab() {\n }",
"render() {\n const { appNavigationState } = this.props;\n const { tabs } = appNavigationState;\n const tabKey = tabs.routes[tabs.index].key;\n const scenes = appNavigationState[tabKey];\n\n return (\n <View style={styles.navigator}>\n <NavigationCardStack\n key={`stack_${tabKey}`}\n onNavigateBack={this.back}\n navigationState={scenes}\n renderOverlay={this.renderHeader}\n renderScene={this.renderScene}\n style={styles.navigatorCardStack}\n />\n <YourTabs\n navigationState={tabs}\n />\n </View>\n );\n }",
"function MainView() {\n return (\n <div className=\"col-md-9\">\n <div className=\"feed-toggle\">\n <ul className=\"nav nav-pills outline-active\">\n <YourFeedTab />\n\n <GlobalFeedTab />\n\n <TagFilterTab />\n </ul>\n </div>\n\n <ArticleList />\n </div>\n );\n}",
"phaseTabs() {\n var allPhasesTab = (\n <li key={'all'} className={'tab ' + this.isViewingPhase('all')}>\n <a id={'all'} onClick={this.setPhase}>All Games</a>\n </li>\n );\n var tabList = [allPhasesTab];\n for(var phase in this.props.divisions) {\n if(phase != 'noPhase') {\n var oneTab = (\n <li key={phase} className={'tab ' + this.isViewingPhase(phase)}>\n <a id={phase} onClick={this.setPhase}>{phase}</a>\n </li>\n );\n tabList.push(oneTab);\n }\n }\n var skinny = this.state.overflowTabs ? '' : ' skinny-tabs';\n return (\n <div className=\"nav-content\">\n <ul className={'tabs tabs-transparent' + skinny} id=\"phase-tabs\">\n {tabList}\n </ul>\n </div>\n );\n }",
"function Tabs(props){\n const allTabs = ['synopsis', 'cast', 'episodes', 'related'];\n const tabNames = ['Story', 'Cast', 'Eps.', 'Related'];\n\n const tabs = allTabs.map((tab, index) => {\n const load = (tab === 'synopsis' ? null : 'MAL'); // Whether to load MAL or not\n const onTab = props.currentTab === tab // See if it's on\n const className = `tab-${tab} ` + (onTab ? 'on' : null); // If on, add \"on\"\n\n return(<div key={tab} className={className} onClick={() => props.handleTab(tab, load)}> {tabNames[index]}</div>)\n });\n\n return(\n <div className=\"window-tabs\">\n {tabs}\n </div>\n )\n }",
"render(){\n\n\n return (\n\n\n <Tab.Navigator\n \n >\n \n <Tab.Screen name=\"Profile\" component={ProfileStackScreen} />\n <Tab.Screen name=\"Post\" component={PostStackScreen} />\n <Tab.Screen name=\"Friends\" component={FriendsStackScreen} />\n <Tab.Screen name=\"Chitts\" component={ChittsStackScreen} />\n\n </Tab.Navigator>\n\n )\n }",
"function Interview(props) {\n\n //Creating object of pages\n const navigation = {\n pages: [\n { path: '/', label: 'Welcome', },\n { path: '/about-me', label: 'About Me' },\n { path: '/about-website', label: 'Why this website?' }\n ],\n }\n\n //Handler for Navigation tab changed\n const selectionHandler = (event, value) => {\n props.history.push(value);\n }\n\n return (\n //Website Navigation Tabs \n <Grid className='Interview' style={{height: '100%'}}>\n <CustomTabs\n value={props.history.location.pathname || '/'}\n onChange={selectionHandler}\n centered\n >\n {navigation.pages.map((page) => {\n return (\n <CustomTab value={page.path} label={page.label} key={page.path} />\n )\n })}\n </CustomTabs>\n {/*Configuring Switch to rerender exact page requested*/}\n <Switch>\n <Route path='/about-website'>\n <AboutWebsite />\n </Route>\n <Route path='/about-me'>\n <AboutMe />\n </Route>\n <Route path='/'>\n <Welcome />\n </Route>\n </Switch>\n <Footer />\n </Grid>\n );\n}",
"getRenderedTabs() {\n let changeTab = this.props.changeTab;\n let shownTab = this.props.shownTab;\n\n let addClass = shownTab === TAB_ADD ? 'active' : '';\n let searchClass = shownTab === TAB_SEARCH ? 'active' : '';\n\n return (\n <ul className='nav nav-tabs'>\n <li className={addClass}\n onClick={changeTab.bind(this, TAB_ADD)}\n >\n <a href='#'>Wall</a>\n </li>\n <li className={searchClass}\n onClick={changeTab.bind(this, TAB_SEARCH)}\n >\n <a href='#'>Search</a>\n </li>\n </ul>\n );\n }",
"render() {\n return (\n <div>\n <h1>Ja<span className=\"highlight\">mmm</span>ing</h1>\n <div className=\"App\">\n <SearchBar onSearch={this.search} />\n <div className=\"App-playlist\">\n <SearchResults searchResults={this.state.searchResults}\n onAdd={this.addTrack}/>\n <PlayList name={this.state.playlistName}\n tracks={this.state.playlistTracks} onRemove={this.removeTrack}\n onNameChange={this.updatePlaylistName} onSave={this.savePlaylist} />\n </div>\n </div>\n </div>\n );\n }",
"function TabStackNavigator() {\n return (\n <Stack.Navigator screenOptions={{headerShown: false}}>\n <Stack.Screen name={ROUTES.Tab1} component={Home} />\n <Stack.Screen name={ROUTES.Search} component={Search} />\n <Stack.Screen name={ROUTES.Quotes} component={QuoteStackNavigator} />\n <Stack.Screen name={ROUTES.Clients} component={ClientStackNavigator} />\n <Stack.Screen name={ROUTES.Users} component={UsersStackNavigator} />\n <Stack.Screen name={ROUTES.Orders} component={OrdersStackNavigator} />\n <Stack.Screen name={ROUTES.Products} component={ProductStackNavigator} />\n <Stack.Screen\n name={ROUTES.UploadOrders}\n component={UploadOrdersStackNavigator}\n />\n <Stack.Screen\n name={ROUTES.SupportRequests}\n component={RequestsStackNavigator}\n />\n </Stack.Navigator>\n );\n}",
"render () {\n\t\tlet { tabStates } = this.state;\n\t\tlet { project, diagram } = this.props;\n\t\tlet tabs = [];\n\n\t\ttabs.push(Tab(0, project ? project.name : 'No Project selected', ProjectMenu, this.props));\n\n\t\tif (project) {\n\t\t\ttabs.push(Tab(1, diagram ? diagram.name : 'No Diagram selected', DiagramMenu, this.props));\n\t\t\tif (diagram) {\n\t\t\t\ttabs.push(Tab(2, `Components [${diagram.type}]`, ComponentMenu, this.props));\n\t\t\t}\n\t\t}\n\n\t\treturn <div className=\"side\">\n\t\t\t<Tabs tabs={tabs} toggle={this.setTabState} states={tabStates}/>\n\t\t</div>;\n\t}",
"function NavTabs(props) {\n const {\n tabs = [],\n currentPage,\n handlePageChange,\n } = props;\n \n return (\n <ul className=\"nav nav-tabs ml-auto my-1 mr-2\">\n {tabs.map((tab) => (\n <li\n className=\"nav-item\"\n key={tab}\n style={{\n backgroundColor: \"#122240\",\n color: \"#be8180\",\n }}\n >\n <a\n style={{\n backgroundColor: \"#122240\",\n color: \"#be8180\",\n }}\n href={\"#\" + tab.toLowerCase()}\n // Whenever a tab is clicked on,\n // the current page is set through the handlePageChange props.\n onClick={() => handlePageChange(tab)}\n className={currentPage === tab ? \"nav-link active\" : \"nav-link\"}\n >\n {tab}\n </a>\n </li>\n ))}\n </ul>\n );\n}",
"function HomeBottomTabs() {\n return (\n <Tab.Navigator\n //customize the bottom tabs using the customTabBarStyle\n tabBarOptions={customTabBarStyle}\n >\n <Tab.Screen\n name=\"Classes\"\n //make this tab go to the classes screen\n component={ClassesStackScreen}\n options={{\n //make the icon for this tab a scholar's cap\n tabBarIcon: ({ color, size }) => (\n <Ionicons name=\"school-outline\" size={size} color={color} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Notes\"\n //make this tab go to the library screen\n component={LibraryStackScreen}\n options={{\n //make the icon for this tab a notes icon\n tabBarIcon: ({ color, size }) => (\n <SimpleLineIcons name=\"note\" size={size} color={color} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Folders\"\n //make this tab go to the folders screen\n component={FoldersStackScreen}\n options={{\n //make the icon for this tab a folder\n tabBarIcon: ({ color, size }) => (\n <AntDesign name=\"folder1\" size={size} color={color} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Planner\"\n //make this tab go to the planner screen\n component={PlannerStackScreen}\n options={{\n //make the icon for this tab a calendar\n tabBarIcon: ({ color, size }) => (\n <FontAwesome5 name=\"calendar-check\" size={size} color={color} />\n ),\n }}\n />\n </Tab.Navigator>\n );\n}",
"render() {\n\n return (\n <div className=\"settings-subnav\">\n <Tabs.Tabs className=\"grid-one\">\n <Tabs.Tab label=\"General\">\n <section className=\"grid-one\">\n <div className=\"grid-item\"><BasicCard/></div>\n <div className=\"grid-item\"><BasicCard/></div>\n <div className=\"grid-item\"><Toggle label=\"Toggle Stuff\" defaultToggled={true}/></div>\n </section>\n </Tabs.Tab>\n <Tabs.Tab label=\"Design\" >\n </Tabs.Tab>\n <Tabs.Tab label=\"Modules\" />\n <Tabs.Tab label=\"Notify\" />\n <Tabs.Tab label=\"Priveleges\" />\n </Tabs.Tabs>\n </div>\n // <DropDownMenu menuItems={menuItems} onChange={this.transitionToRoute} />\n );\n }",
"getTabs() {\n let tabList = []\n for (const tabLabel of Object.values(this.props.tabs)) {\n tabList.push(<Tab key={tabLabel} title={tabLabel} tabs={this.props.tabs} updateTabs={() => this.props.updateTabs(this.props.keywordsToSearch)}> </Tab>)\n }\n return tabList\n }",
"function App() {\n return (\n <div className=\"App\">\n <Nav arr={tab}/>\n\n </div>\n );\n}",
"handleNavClicks() {\n if (hasEl(`#${this.playlistNavPrev.id}`)) {\n this.playlistNavPrev.addEventListener('click', (e) => {\n e.preventDefault()\n this.prev()\n })\n }\n if (hasEl(`#${this.playlistNavNext.id}`)) {\n this.playlistNavNext.addEventListener('click', (e) => {\n e.preventDefault()\n this.next()\n })\n }\n }",
"function ClassBottomTabs({ route }) {\n return (\n <Tab.Navigator\n //customize the bottom tabs using the customTabBarStyle\n //edit some of the parameters from the customTabBarStyle to suit the class that the user navigated to\n tabBarOptions={{\n ...customTabBarStyle,\n activeTintColor: route.params.tintColor,\n style: {\n backgroundColor: \"white\",\n },\n }}\n >\n <Tab.Screen\n name=\"Camera\"\n options={{\n //make the bottom tab icon a camera\n tabBarIcon: ({ color, size }) => (\n <Feather name=\"camera\" size={size} color={color} />\n ),\n }}\n >\n {/* Customize the header of the camera screen to suit the class that the user navigated to */}\n {(props) => (\n <CameraStackScreen\n {...props}\n title={route.params.title}\n backgroundColor={route.params.backgroundColor}\n iconName={route.params.iconName}\n />\n )}\n </Tab.Screen>\n <Tab.Screen\n name=\"Notes\"\n options={{\n //make the bottom tab icon a notes icon\n tabBarIcon: ({ color, size }) => (\n <SimpleLineIcons name=\"note\" size={size} color={color} />\n ),\n }}\n >\n {/* Customize the header of the library screen to suit the class that the user navigated to */}\n {(props) => (\n <LibraryStackScreen\n {...props}\n title={route.params.title}\n backgroundColor={route.params.backgroundColor}\n iconName={route.params.iconName}\n />\n )}\n </Tab.Screen>\n <Tab.Screen\n name=\"Folders\"\n options={{\n //make the bottom tab icon a folder\n tabBarIcon: ({ color, size }) => (\n <AntDesign name=\"folder1\" size={size} color={color} />\n ),\n }}\n >\n {/* Customize the header of the folders screen to suit the class that the user navigated to */}\n {(props) => (\n <FoldersStackScreen\n {...props}\n title={route.params.title}\n backgroundColor={route.params.backgroundColor}\n iconName={route.params.iconName}\n />\n )}\n </Tab.Screen>\n <Tab.Screen\n name=\"Planner\"\n options={{\n //make the bottom tab icon a calendar\n tabBarIcon: ({ color, size }) => (\n <FontAwesome5 name=\"calendar-check\" size={size} color={color} />\n ),\n }}\n >\n {/* Customize the header of the planner screen to suit the class that the user navigated to */}\n {(props) => (\n <PlannerStackScreen\n {...props}\n title={route.params.title}\n backgroundColor={route.params.backgroundColor}\n iconName={route.params.iconName}\n />\n )}\n </Tab.Screen>\n </Tab.Navigator>\n );\n}",
"function TabLinks(props) {\n \n const state = useContext(UserContext);\n const { value, setValue } = state;\n\n const handleChange = (event, newValue) => {\n setValue(newValue);\n };\n\n const handleLinks = value => {\n props.history.replace(value)\n };\n\n return (\n <div style={{ flexGrow: \"1\", margin: \"0\"}}>\n <Tabs\n value={value}\n onChange={handleChange}\n indicatorColor=\"primary\"\n textColor=\"primary\"\n variant={$(window).width() < 769 ? \"fullWidth\" : \"standard\"}\n centered\n >\n <Tab label=\"Home\" className={\"tabs\"} onClick={() => handleLinks(\"/\")} />\n <Tab label={$(window).width() < 769 ? \"Upcoming\" : \"Upcoming Items\"} className={\"tabs\"} onClick={() => handleLinks(\"/upcoming\")} />\n <Tab label={$(window).width() < 769 ? \"Weapons\" : \"Weapon Search\"} className={\"tabs\"} onClick={() => handleLinks(\"/weaponsearch\")}/>\n <Tab label={$(window).width() < 769 ? \"Players\" : \"Player Information\"} className={\"tabs\"} onClick={() => handleLinks(\"/playersearch\")}/>\n </Tabs>\n </div>\n );\n}",
"render() {\n if (this.state.error) {\n return <Redirect to=\"/\" />;\n }\n\n return (\n <div>\n <Tabs\n defaultActiveKey=\"0\"\n renderTabBar={() => <ScrollableInkTabBar />}\n renderTabContent={() => <TabContent />}\n >\n { this.getTabPanes() }\n </Tabs>\n </div>\n );\n }",
"_genTab(){\n const tabs = {}\n const {keys,theme} = this.props\n this.preKeys = keys\n keys.forEach((item,index) => {\n if(item.checked){\n tabs[`tab${index}`] = {\n screen: props => <TreadingTabPage theme={theme} {...props} timeSpan={this.state.timeSpan} tabLabel={item.name}/>, // 这是个不错的技巧\n navigationOptions:{\n title:item.name\n }\n }\n }\n });\n return tabs\n }",
"function TabbedPanel(props) {\n const { sections, currentSection } = props;\n\n const [tab, setTab] = React.useState(0);\n const handleChange = (evt, newTab) => {\n setTab(newTab);\n };\n\n if (sections && sections[currentSection]) {\n return (\n <div style={styling.tabbedPanels}>\n <AppBar\n position=\"static\"\n style={{\n backgroundColor: ProfileBackgroundColor,\n borderBottomRightRadius: \"20px\"\n }}\n >\n <Tabs value={tab} onChange={handleChange} aria-label=\"subtabs\">\n {getPanelTabs(sections, currentSection, SUBTAB_STR)}\n </Tabs>\n </AppBar>\n {getPanelStack(sections, currentSection, SUBTAB_STR, tab)}\n </div>\n );\n } else {\n return null;\n }\n}",
"render() {\n const { activeTab } = this.state;\n return (\n <div className=\"Game\">\n <Menu inverted size=\"massive\" widths={4} stackable attached=\"bottom\">\n {this.createTab(\n 'players', 'orange', this.props.lfgCount, 'new recruit', 'Recruit Noobs')}\n {this.createTab(\n 'teams', 'green', this.props.rosterCount, 'free player', 'Group Players into Teams')}\n {this.createTab(\n 'matches', 'red', this.props.teamWaitingCount, 'ready team', 'Battle!')}\n {this.createTab(\n 'stats', 'grey', this.props.newAchievements, 'achievement', 'Progress & Achievements')}\n </Menu>\n <div className=\"GameContent\">\n <Players display={activeTab === 'players'} />\n <Teams display={activeTab === 'teams'} />\n <Matches display={activeTab === 'matches'} />\n </div>\n </div>\n );\n }",
"renderTabs() {\n return React.Children.map(this.props.children, (child, index) => {\n if (!child) return null;\n\n return React.cloneElement(child, {\n index,\n onClick: this.onTabClick,\n isActive: index === this.state.activeTab\n });\n });\n }",
"render() {\n let self = this;\n let count = 0;\n return (\n <div className=\"start\">\n <div className=\"start-header\">\n <div>\n <h1>Weather Report</h1>\n\n </div>\n </div>\n\n <div className=\"start-body\">\n <div>\n <Search\n placeholder=\"Search the weather city\"\n onChange={this.onSearchKeyChange.bind(this)}\n onSearch={this.handleSearch.bind(this)}\n style={{ width: \"50vh\" }}\n\n />\n </div>\n <br />\n\n <Tabs defaultActiveKey=\"1\" onChange={this.callback}>\n <TabPane tab=\"Weather 5 day / 3 hour forecast above 20\" key=\"1\">\n {this.state.allWeatherabove20.map(function (item) {\n return (\n <div>\n <Collapse >\n <Panel header={item.Date}>\n <Descriptions title=\"Weather Info\" bordered>\n <Descriptions.Item label=\"Date Time\">\n {item.Date}\n </Descriptions.Item>\n\n <Descriptions.Item label=\"Temperature\">\n {item.Temperature}\n </Descriptions.Item>\n </Descriptions>\n\n </Panel>\n\n </Collapse>\n </div>\n )\n })}\n\n </TabPane>\n <TabPane tab=\"Sunny/Clear Weather\" key=\"2\">\n {this.state.allclearWeather.map(function (item) {\n return (\n <div>\n <Collapse >\n <Panel header={item.Date}>\n <Descriptions title=\"Weather Info\" bordered>\n <Descriptions.Item label=\"Date Time\">\n {item.Date}\n </Descriptions.Item>\n\n <Descriptions.Item> \n <Image width={100} src={item.Image}\n /> </Descriptions.Item>\n\n <Descriptions.Item label=\"Description\">\n {item.Description}\n </Descriptions.Item>\n </Descriptions>\n\n </Panel>\n\n </Collapse>\n </div>\n )\n })}\n\n </TabPane>\n </Tabs>\n\n\n\n </div>\n\n\n </div>\n\n );\n }"
] |
[
"0.66776645",
"0.6347059",
"0.62501615",
"0.60769594",
"0.6051393",
"0.59929645",
"0.59875596",
"0.59699994",
"0.5966047",
"0.5892641",
"0.58367765",
"0.58248866",
"0.58224255",
"0.580555",
"0.57718146",
"0.5764554",
"0.574374",
"0.5736207",
"0.57299453",
"0.57164484",
"0.5710292",
"0.56965",
"0.56842154",
"0.567119",
"0.5610391",
"0.5599284",
"0.5595739",
"0.5573694",
"0.5558208",
"0.55422467"
] |
0.64225847
|
1
|
React navigation tab stack for Song Analyser.
|
function TabTwoNavigator() {
return (
<TabTwoStack.Navigator>
<TabTwoStack.Screen
name="SongAnalyserHome"
component={SongAnalyser}
options={{ headerTitle: 'Song Analyser' }}
/>
<TabTwoStack.Screen
name="SearchSong"
component={SearchSong}
options={{ headerTitle: 'Song Analyser' }}
/>
<TabTwoStack.Screen
name="SongResults"
component={SongResults}
options={{ headerTitle: 'Song Analyser' }}
/>
</TabTwoStack.Navigator>
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function TabOneNavigator() {\n return (\n <TabOneStack.Navigator>\n <TabOneStack.Screen\n name=\"PlaylistAnalyserHome\"\n component={PlaylistAnalyser}\n options={{ headerTitle: 'Playlist Analyser' }}\n />\n <TabOneStack.Screen\n name=\"SearchSong\"\n component={SearchSong}\n options={{ headerTitle: 'Playlist Analyser' }}\n />\n <TabOneStack.Screen\n name=\"SearchPlaylist\"\n component={SearchPlaylist}\n options={{ headerTitle: 'Playlist Analyser' }}\n />\n <TabOneStack.Screen\n name=\"SearchPlaylistResults\"\n component={SearchPlaylistResults}\n options={{ headerTitle: 'Playlist Analyser' }}\n />\n <TabOneStack.Screen\n name=\"PlaylistResults\"\n component={PlaylistResults}\n options={{ headerTitle: 'Playlist Analyser' }}\n />\n </TabOneStack.Navigator>\n );\n}",
"function TabStack(props) {\n const tabPress = (e) => {\n global.currenRouter = e.target.split(\"-\")[0];\n };\n return (\n <Tab.Navigator\n initialRouteName=\"Home\"\n activeColor=\"#e91e63\"\n shifting={true}\n barStyle={{\n backgroundColor: \"white\",\n }}\n >\n <Tab.Screen\n name=\"Home\"\n component={CategoriesScreen}\n listeners={{ tabPress }}\n options={{\n title: \"Trang chủ\",\n tabBarIcon: ({ color }) => (\n <Icon color={color} name=\"home\" size={26} />\n ),\n }}\n />\n\n {/* <Tab.Screen name=\"Template\" component={TemplateStackScreen} listeners={{ tabPress }} /> */}\n <Tab.Screen\n name=\"Message\"\n component={MessageScreen}\n listeners={{ tabPress }}\n options={{\n title: \"Tin Nhắn\",\n tabBarIcon: ({ color }) => (\n <Icon color={color} name=\"comment\" size={26} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Account\"\n component={AccountScreen}\n listeners={{ tabPress }}\n options={{\n title: \"Tài Khoản\",\n tabBarIcon: ({ color }) => (\n <Icon color={color} name=\"account-circle\" size={26} />\n ),\n }}\n />\n </Tab.Navigator>\n );\n}",
"render(){\n var trackers_list = get_top_trackers()\n\n return (\n <div className=\"flex-container\">\n <Tab.Container id=\"tracker-tabs\" defaultActiveKey=\"first\">\n <Row class=\"tracker-list-box\">\n <Col sm={3}>\n <Nav variant=\"pills\" className=\"flex-column\">\n <Nav.Item>\n <Nav.Link variant=\"primary\" className=\"header-tab\" eventKey=\"first\">Website</Nav.Link>\n </Nav.Item>\n {trackers_list.map(datas =>\n <Nav.Item>\n <Nav.Link variant=\"primary\" eventKey={datas[0]}>{datas[0]}</Nav.Link>\n </Nav.Item>\n )}\n </Nav>\n </Col>\n <Col sm={8}>\n <Tab.Content>\n <Tab.Pane eventKey=\"first\">\n <p className=\"text-for-tabs\"> Click on a tab to view a scrollable list of the trackers on that website!\n </p>\n </Tab.Pane>\n {trackers_list.map(datas =>\n <Tab.Pane eventKey={datas[0]}>\n <ul class=\"tracker-list\">\n {datas[1].map(tracker =>\n <li style={{listStyle: 'circle', marginLeft: '4px', marginTop: '2px', marginBottom: '2px'}}>{tracker}</li>\n )}\n </ul>\n </Tab.Pane>\n )}\n </Tab.Content>\n </Col>\n </Row>\n </Tab.Container>\n </div>\n )\n }",
"render() {\n const { appNavigationState } = this.props;\n const { tabs } = appNavigationState;\n const tabKey = tabs.routes[tabs.index].key;\n const scenes = appNavigationState[tabKey];\n\n return (\n <View style={styles.navigator}>\n <NavigationCardStack\n key={`stack_${tabKey}`}\n onNavigateBack={this.back}\n navigationState={scenes}\n renderOverlay={this.renderHeader}\n renderScene={this.renderScene}\n style={styles.navigatorCardStack}\n />\n <YourTabs\n navigationState={tabs}\n />\n </View>\n );\n }",
"renderTabs() {\n return (\n <Tabs defaultActiveKey={1} id=\"tab\" >\n <Tab eventKey={1} title=\"Projects\">\n {this.renderProjs()}\n </Tab>\n <Tab eventKey={2} title=\"Users\">\n {this.renderUsers()}\n </Tab>\n <Tab eventKey={3} title=\"Search\">\n {this.renderSearch()}\n <ListGroup><br /><br />\n {this.renderResult()}\n </ListGroup>\n </Tab>\n </Tabs>\n );\n }",
"function Tabs(props){\n const allTabs = ['synopsis', 'cast', 'episodes', 'related'];\n const tabNames = ['Story', 'Cast', 'Eps.', 'Related'];\n\n const tabs = allTabs.map((tab, index) => {\n const load = (tab === 'synopsis' ? null : 'MAL'); // Whether to load MAL or not\n const onTab = props.currentTab === tab // See if it's on\n const className = `tab-${tab} ` + (onTab ? 'on' : null); // If on, add \"on\"\n\n return(<div key={tab} className={className} onClick={() => props.handleTab(tab, load)}> {tabNames[index]}</div>)\n });\n\n return(\n <div className=\"window-tabs\">\n {tabs}\n </div>\n )\n }",
"setStackTab() {\n }",
"render(){\n\n\n return (\n\n\n <Tab.Navigator\n \n >\n \n <Tab.Screen name=\"Profile\" component={ProfileStackScreen} />\n <Tab.Screen name=\"Post\" component={PostStackScreen} />\n <Tab.Screen name=\"Friends\" component={FriendsStackScreen} />\n <Tab.Screen name=\"Chitts\" component={ChittsStackScreen} />\n\n </Tab.Navigator>\n\n )\n }",
"function TabStackNavigator() {\n return (\n <Stack.Navigator screenOptions={{headerShown: false}}>\n <Stack.Screen name={ROUTES.Tab1} component={Home} />\n <Stack.Screen name={ROUTES.Search} component={Search} />\n <Stack.Screen name={ROUTES.Quotes} component={QuoteStackNavigator} />\n <Stack.Screen name={ROUTES.Clients} component={ClientStackNavigator} />\n <Stack.Screen name={ROUTES.Users} component={UsersStackNavigator} />\n <Stack.Screen name={ROUTES.Orders} component={OrdersStackNavigator} />\n <Stack.Screen name={ROUTES.Products} component={ProductStackNavigator} />\n <Stack.Screen\n name={ROUTES.UploadOrders}\n component={UploadOrdersStackNavigator}\n />\n <Stack.Screen\n name={ROUTES.SupportRequests}\n component={RequestsStackNavigator}\n />\n </Stack.Navigator>\n );\n}",
"function HomeBottomTabs() {\n return (\n <Tab.Navigator\n //customize the bottom tabs using the customTabBarStyle\n tabBarOptions={customTabBarStyle}\n >\n <Tab.Screen\n name=\"Classes\"\n //make this tab go to the classes screen\n component={ClassesStackScreen}\n options={{\n //make the icon for this tab a scholar's cap\n tabBarIcon: ({ color, size }) => (\n <Ionicons name=\"school-outline\" size={size} color={color} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Notes\"\n //make this tab go to the library screen\n component={LibraryStackScreen}\n options={{\n //make the icon for this tab a notes icon\n tabBarIcon: ({ color, size }) => (\n <SimpleLineIcons name=\"note\" size={size} color={color} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Folders\"\n //make this tab go to the folders screen\n component={FoldersStackScreen}\n options={{\n //make the icon for this tab a folder\n tabBarIcon: ({ color, size }) => (\n <AntDesign name=\"folder1\" size={size} color={color} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Planner\"\n //make this tab go to the planner screen\n component={PlannerStackScreen}\n options={{\n //make the icon for this tab a calendar\n tabBarIcon: ({ color, size }) => (\n <FontAwesome5 name=\"calendar-check\" size={size} color={color} />\n ),\n }}\n />\n </Tab.Navigator>\n );\n}",
"function Interview(props) {\n\n //Creating object of pages\n const navigation = {\n pages: [\n { path: '/', label: 'Welcome', },\n { path: '/about-me', label: 'About Me' },\n { path: '/about-website', label: 'Why this website?' }\n ],\n }\n\n //Handler for Navigation tab changed\n const selectionHandler = (event, value) => {\n props.history.push(value);\n }\n\n return (\n //Website Navigation Tabs \n <Grid className='Interview' style={{height: '100%'}}>\n <CustomTabs\n value={props.history.location.pathname || '/'}\n onChange={selectionHandler}\n centered\n >\n {navigation.pages.map((page) => {\n return (\n <CustomTab value={page.path} label={page.label} key={page.path} />\n )\n })}\n </CustomTabs>\n {/*Configuring Switch to rerender exact page requested*/}\n <Switch>\n <Route path='/about-website'>\n <AboutWebsite />\n </Route>\n <Route path='/about-me'>\n <AboutMe />\n </Route>\n <Route path='/'>\n <Welcome />\n </Route>\n </Switch>\n <Footer />\n </Grid>\n );\n}",
"function App() {\n return (\n <div className=\"App\">\n <Nav arr={tab}/>\n\n </div>\n );\n}",
"phaseTabs() {\n var allPhasesTab = (\n <li key={'all'} className={'tab ' + this.isViewingPhase('all')}>\n <a id={'all'} onClick={this.setPhase}>All Games</a>\n </li>\n );\n var tabList = [allPhasesTab];\n for(var phase in this.props.divisions) {\n if(phase != 'noPhase') {\n var oneTab = (\n <li key={phase} className={'tab ' + this.isViewingPhase(phase)}>\n <a id={phase} onClick={this.setPhase}>{phase}</a>\n </li>\n );\n tabList.push(oneTab);\n }\n }\n var skinny = this.state.overflowTabs ? '' : ' skinny-tabs';\n return (\n <div className=\"nav-content\">\n <ul className={'tabs tabs-transparent' + skinny} id=\"phase-tabs\">\n {tabList}\n </ul>\n </div>\n );\n }",
"render() {\n return (\n <div>\n <h1>Ja<span className=\"highlight\">mmm</span>ing</h1>\n <div className=\"App\">\n <SearchBar onSearch={this.search} />\n <div className=\"App-playlist\">\n <SearchResults searchResults={this.state.searchResults}\n onAdd={this.addTrack}/>\n <PlayList name={this.state.playlistName}\n tracks={this.state.playlistTracks} onRemove={this.removeTrack}\n onNameChange={this.updatePlaylistName} onSave={this.savePlaylist} />\n </div>\n </div>\n </div>\n );\n }",
"render() {\n let self = this;\n let count = 0;\n return (\n <div className=\"start\">\n <div className=\"start-header\">\n <div>\n <h1>Weather Report</h1>\n\n </div>\n </div>\n\n <div className=\"start-body\">\n <div>\n <Search\n placeholder=\"Search the weather city\"\n onChange={this.onSearchKeyChange.bind(this)}\n onSearch={this.handleSearch.bind(this)}\n style={{ width: \"50vh\" }}\n\n />\n </div>\n <br />\n\n <Tabs defaultActiveKey=\"1\" onChange={this.callback}>\n <TabPane tab=\"Weather 5 day / 3 hour forecast above 20\" key=\"1\">\n {this.state.allWeatherabove20.map(function (item) {\n return (\n <div>\n <Collapse >\n <Panel header={item.Date}>\n <Descriptions title=\"Weather Info\" bordered>\n <Descriptions.Item label=\"Date Time\">\n {item.Date}\n </Descriptions.Item>\n\n <Descriptions.Item label=\"Temperature\">\n {item.Temperature}\n </Descriptions.Item>\n </Descriptions>\n\n </Panel>\n\n </Collapse>\n </div>\n )\n })}\n\n </TabPane>\n <TabPane tab=\"Sunny/Clear Weather\" key=\"2\">\n {this.state.allclearWeather.map(function (item) {\n return (\n <div>\n <Collapse >\n <Panel header={item.Date}>\n <Descriptions title=\"Weather Info\" bordered>\n <Descriptions.Item label=\"Date Time\">\n {item.Date}\n </Descriptions.Item>\n\n <Descriptions.Item> \n <Image width={100} src={item.Image}\n /> </Descriptions.Item>\n\n <Descriptions.Item label=\"Description\">\n {item.Description}\n </Descriptions.Item>\n </Descriptions>\n\n </Panel>\n\n </Collapse>\n </div>\n )\n })}\n\n </TabPane>\n </Tabs>\n\n\n\n </div>\n\n\n </div>\n\n );\n }",
"function ClassBottomTabs({ route }) {\n return (\n <Tab.Navigator\n //customize the bottom tabs using the customTabBarStyle\n //edit some of the parameters from the customTabBarStyle to suit the class that the user navigated to\n tabBarOptions={{\n ...customTabBarStyle,\n activeTintColor: route.params.tintColor,\n style: {\n backgroundColor: \"white\",\n },\n }}\n >\n <Tab.Screen\n name=\"Camera\"\n options={{\n //make the bottom tab icon a camera\n tabBarIcon: ({ color, size }) => (\n <Feather name=\"camera\" size={size} color={color} />\n ),\n }}\n >\n {/* Customize the header of the camera screen to suit the class that the user navigated to */}\n {(props) => (\n <CameraStackScreen\n {...props}\n title={route.params.title}\n backgroundColor={route.params.backgroundColor}\n iconName={route.params.iconName}\n />\n )}\n </Tab.Screen>\n <Tab.Screen\n name=\"Notes\"\n options={{\n //make the bottom tab icon a notes icon\n tabBarIcon: ({ color, size }) => (\n <SimpleLineIcons name=\"note\" size={size} color={color} />\n ),\n }}\n >\n {/* Customize the header of the library screen to suit the class that the user navigated to */}\n {(props) => (\n <LibraryStackScreen\n {...props}\n title={route.params.title}\n backgroundColor={route.params.backgroundColor}\n iconName={route.params.iconName}\n />\n )}\n </Tab.Screen>\n <Tab.Screen\n name=\"Folders\"\n options={{\n //make the bottom tab icon a folder\n tabBarIcon: ({ color, size }) => (\n <AntDesign name=\"folder1\" size={size} color={color} />\n ),\n }}\n >\n {/* Customize the header of the folders screen to suit the class that the user navigated to */}\n {(props) => (\n <FoldersStackScreen\n {...props}\n title={route.params.title}\n backgroundColor={route.params.backgroundColor}\n iconName={route.params.iconName}\n />\n )}\n </Tab.Screen>\n <Tab.Screen\n name=\"Planner\"\n options={{\n //make the bottom tab icon a calendar\n tabBarIcon: ({ color, size }) => (\n <FontAwesome5 name=\"calendar-check\" size={size} color={color} />\n ),\n }}\n >\n {/* Customize the header of the planner screen to suit the class that the user navigated to */}\n {(props) => (\n <PlannerStackScreen\n {...props}\n title={route.params.title}\n backgroundColor={route.params.backgroundColor}\n iconName={route.params.iconName}\n />\n )}\n </Tab.Screen>\n </Tab.Navigator>\n );\n}",
"function TabLinks(props) {\n \n const state = useContext(UserContext);\n const { value, setValue } = state;\n\n const handleChange = (event, newValue) => {\n setValue(newValue);\n };\n\n const handleLinks = value => {\n props.history.replace(value)\n };\n\n return (\n <div style={{ flexGrow: \"1\", margin: \"0\"}}>\n <Tabs\n value={value}\n onChange={handleChange}\n indicatorColor=\"primary\"\n textColor=\"primary\"\n variant={$(window).width() < 769 ? \"fullWidth\" : \"standard\"}\n centered\n >\n <Tab label=\"Home\" className={\"tabs\"} onClick={() => handleLinks(\"/\")} />\n <Tab label={$(window).width() < 769 ? \"Upcoming\" : \"Upcoming Items\"} className={\"tabs\"} onClick={() => handleLinks(\"/upcoming\")} />\n <Tab label={$(window).width() < 769 ? \"Weapons\" : \"Weapon Search\"} className={\"tabs\"} onClick={() => handleLinks(\"/weaponsearch\")}/>\n <Tab label={$(window).width() < 769 ? \"Players\" : \"Player Information\"} className={\"tabs\"} onClick={() => handleLinks(\"/playersearch\")}/>\n </Tabs>\n </div>\n );\n}",
"function ChangeTabs(evt, backSymbol) {\n var i, tabcontent, tablinks;\n tabcontent = document.getElementsByClassName(\"tabcontent\");\n for (i = 0; i < tabcontent.length; i++) {\n tabcontent[i].style.display = \"none\";\n }\n tablinks = document.getElementsByClassName(\"tablinks\");\n for (i = 0; i < tablinks.length; i++) {\n tablinks[i].className = tablinks[i].className.replace(\" active\", \"\");\n }\n document.getElementById(backSymbol).style.display = \"block\";\n evt.currentTarget.className += \" active\";\n}",
"function NavTabs(props) {\n const {\n tabs = [],\n currentPage,\n handlePageChange,\n } = props;\n \n return (\n <ul className=\"nav nav-tabs ml-auto my-1 mr-2\">\n {tabs.map((tab) => (\n <li\n className=\"nav-item\"\n key={tab}\n style={{\n backgroundColor: \"#122240\",\n color: \"#be8180\",\n }}\n >\n <a\n style={{\n backgroundColor: \"#122240\",\n color: \"#be8180\",\n }}\n href={\"#\" + tab.toLowerCase()}\n // Whenever a tab is clicked on,\n // the current page is set through the handlePageChange props.\n onClick={() => handlePageChange(tab)}\n className={currentPage === tab ? \"nav-link active\" : \"nav-link\"}\n >\n {tab}\n </a>\n </li>\n ))}\n </ul>\n );\n}",
"renderTab(e) {\n\t\tthis.setState({\n\t\t\tcons:'', \n\t\t\tvowl:'', \n\t\t\ttabData: this.second.current.state.selected.data\n\t\t}, this.props.onClick); \n\t}",
"render(){\n return (\n <div>\n {/*Page header used by bootstrap to name the app */}\n <PageHeader>Title <small>Words to live by</small></PageHeader>\n {/*\n Nav/NavItem used by bootstrap to create links to different routes.\n React-router v4 uses \"Link\" imported from 'react-router-dom' rather\n than simple hrefs. Since bootstrap NavItems use hrefs, we need to\n use LinkContainer to make them play nice.\n */}\n <Nav bsStyle=\"tabs\">\n <LinkContainer exact={true} to =\"/\">\n <NavItem eventKey={1}>\n Home\n </NavItem>\n </LinkContainer>\n <LinkContainer to =\"/route1\">\n <NavItem eventKey={2}>\n Route 1\n </NavItem>\n </LinkContainer>\n <LinkContainer to =\"/route2\">\n <NavItem eventKey={3}>\n Route 2\n </NavItem>\n </LinkContainer>\n </Nav>\n </div>\n )\n }",
"displayTracks(album) {\n var route = {\n albumId: album.id,\n title: album.title,\n scene: 1\n }\n this.props.navigator.push(route);\n }",
"function navAllStories(evt) {\n console.debug(\"navAllStories\");\n hidePageComponents();\n putStoriesOnPage();\n // addStarToStories();\n}",
"renderProjs() {\n return (\n <div className=\"projs\">\n <PageHeader>All Projects</PageHeader>\n <Tabs defaultActiveKey={1} id=\"projtab\" >\n <Tab eventKey={1} title=\"All Projects\">\n <ListGroup>\n {this.renderProjsList(this.state.projs)}\n </ListGroup>\n </Tab>\n <Tab eventKey={2} title=\"Completed Projects\">\n <ListGroup>\n {this.renderCompProjsList(this.state.projs)}\n </ListGroup>\n </Tab>\n <Tab eventKey={3} title=\"Active Projects\">\n <ListGroup>\n {this.renderActiveProjsList(this.state.projs)}\n </ListGroup>\n </Tab>\n <Tab eventKey={4} title=\"Pending Projects\">\n <ListGroup>\n {this.renderPendingProjsList(this.state.projs)}\n </ListGroup>\n </Tab>\n </Tabs>\n </div>\n );\n }",
"render() {\n const { activeTab } = this.state;\n return (\n <div className=\"Game\">\n <Menu inverted size=\"massive\" widths={4} stackable attached=\"bottom\">\n {this.createTab(\n 'players', 'orange', this.props.lfgCount, 'new recruit', 'Recruit Noobs')}\n {this.createTab(\n 'teams', 'green', this.props.rosterCount, 'free player', 'Group Players into Teams')}\n {this.createTab(\n 'matches', 'red', this.props.teamWaitingCount, 'ready team', 'Battle!')}\n {this.createTab(\n 'stats', 'grey', this.props.newAchievements, 'achievement', 'Progress & Achievements')}\n </Menu>\n <div className=\"GameContent\">\n <Players display={activeTab === 'players'} />\n <Teams display={activeTab === 'teams'} />\n <Matches display={activeTab === 'matches'} />\n </div>\n </div>\n );\n }",
"function MainView() {\n return (\n <div className=\"col-md-9\">\n <div className=\"feed-toggle\">\n <ul className=\"nav nav-pills outline-active\">\n <YourFeedTab />\n\n <GlobalFeedTab />\n\n <TagFilterTab />\n </ul>\n </div>\n\n <ArticleList />\n </div>\n );\n}",
"function NavTabs(props) {\n return (\n <div>\n <nav className='navbar pt-3 pb-3 navbar-expand-lg nav-jgMain fixed-top bg-dark'>\n <div className='container'>\n <a className='navbar-brand navbar-brand-jg' href='index.html'>\n JENNERATION\n </a>\n <button\n className='navbar-toggler navbar-dark bg-dark'\n type='button'\n data-toggle='collapse'\n data-target='#navbarNavAltMarkup'\n aria-controls='navbarNavAltMarkup'\n aria-expanded='false'\n aria-label='Toggle navigation'\n >\n <span className='navbar-toggler-icon'></span>\n </button>\n <div\n className='collapse navbar-collapse justify-content-end'\n id='navbarNavAltMarkup'\n >\n <div className='navbar-nav'>\n <a\n className='nav-item nav-link active'\n href='#home'\n onClick={() => props.handlePageChange(\"Home\")}\n className={\n props.currentPage === \"Home\" ? \"nav-link active\" : \"nav-link\"\n }\n >\n Home<span className='sr-only'>(current)</span>\n </a>\n\n <a\n className='nav-item nav-link active'\n href='#projects'\n onClick={() => props.handlePageChange(\"Projects\")}\n className={\n props.currentPage === \"Projects\"\n ? \"nav-link active\"\n : \"nav-link\"\n }\n >\n Works\n </a>\n\n <a\n className='nav-item nav-link active'\n href='#about'\n onClick={() => props.handlePageChange(\"About\")}\n className={\n props.currentPage === \"About\" ? \"nav-link active\" : \"nav-link\"\n }\n >\n About\n </a>\n\n <a\n className='nav-item nav-link active'\n href='#contact'\n onClick={() => props.handlePageChange(\"Contact\")}\n className={\n props.currentPage === \"Contact\"\n ? \"nav-link active\"\n : \"nav-link\"\n }\n >\n Contact\n </a>\n </div>\n </div>\n </div>\n </nav>\n </div>\n );\n}",
"function HistoryTab() {\n\treturn (\n\t\t<div>\n\t\t\t<p>Hello World This is the History Tab</p>\n\t\t\t<img src={Head} />\n\t\t</div>\n\t);\n}",
"function loadTabs() {\n\t\tvar htmlToAppend = '';\n\t\thtmlToAppend += '<ul class=\"nav nav-tabs\">';\n\t\t\n\t\tvar tabsMade = 0;\n\t\tfor(var i = 0; i <tuneJSON.tracks.length; i++) {//create the nav tabs for each nonempty track\n\t\t\tif(typeof tuneJSON.tracks[i].instrument !== 'undefined') {\n\t\t\t\tif(tabsMade === 0) {//if first tab add an active class to it\n\t\t\t\t\ttabsMade++;\n\t\t\t\t\thtmlToAppend +='<li class=\"active\"><a href=\"#track' + i +\n\t\t\t\t\t '\" data-toggle=\"tab\"><span class=\"instrument-name\">' + midiHelper.getInstrumentName(tuneJSON.tracks[i].instrument) + \n\t\t\t\t\t '</span></a></li>';\n\t\t\t\t} else {\n\t\t\t\t\thtmlToAppend += '<li role=\"presentation\"><a href=\"#track' + i + '\" role=\"tab\" data-toggle=\"tab\"><span class=\"instrument-name\">' +\n\t\t\t\t\tmidiHelper.getInstrumentName(tuneJSON.tracks[i].instrument) + \n\t\t\t\t\t'</span><button class=\"remove-tab-button\" id=\"remove-tab' + i + '\"><span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span></button></a></li>';\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t\thtmlToAppend += '</ul><div class=\"tab-content\">';\n\t\t//now add the tab panels\n\t\t\n\t\ttabsMade = 0;\n\n\t\tfor(var i = 0; i <tuneJSON.tracks.length; i++) {//create the tab pane for each nonempty track\n\t\t\tif(typeof tuneJSON.tracks[i].instrument !== 'undefined') {\n\t\t\t\tif(tabsMade === 0) {\n\t\t\t\t\thtmlToAppend += '<div class=\"tab-pane active\" id=\"track' + i +'\"></div>';\n\t\t\t\t\ttabsMade++;\n\t\t\t\t} else {\n\t\t\t\t\thtmlToAppend+= '<div class=\"tab-pane\" id=\"track' + i +'\"></div>';\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\thtmlToAppend += '</div>';\n\t\t$('.canvas').append(htmlToAppend);\n\n\t\t$('.remove-tab-button').click(function() {//add remove event to delete button\n\t\t\tdeleteInstrument(parseInt($(this).attr('id').substring(10), 10));//get index of track\n\t\t});\n\t\t\n\t}",
"getRenderedTabs() {\n let changeTab = this.props.changeTab;\n let shownTab = this.props.shownTab;\n\n let addClass = shownTab === TAB_ADD ? 'active' : '';\n let searchClass = shownTab === TAB_SEARCH ? 'active' : '';\n\n return (\n <ul className='nav nav-tabs'>\n <li className={addClass}\n onClick={changeTab.bind(this, TAB_ADD)}\n >\n <a href='#'>Wall</a>\n </li>\n <li className={searchClass}\n onClick={changeTab.bind(this, TAB_SEARCH)}\n >\n <a href='#'>Search</a>\n </li>\n </ul>\n );\n }"
] |
[
"0.6475666",
"0.6468039",
"0.63124937",
"0.60596925",
"0.60255635",
"0.5970851",
"0.5945669",
"0.59344715",
"0.58610266",
"0.5822944",
"0.58227867",
"0.5788462",
"0.576454",
"0.5754998",
"0.57089555",
"0.56597733",
"0.56468105",
"0.5641285",
"0.56297016",
"0.56173426",
"0.5611835",
"0.56107014",
"0.55886793",
"0.55815524",
"0.5580788",
"0.55792564",
"0.5553785",
"0.5549624",
"0.55380106",
"0.5529344"
] |
0.6485928
|
0
|
React navigation tab stack for About.
|
function TabThreeNavigator() {
return (
<TabThreeStack.Navigator>
<TabThreeStack.Screen
name="AboutHome"
component={About}
options={{ headerTitle: 'About' }}
/>
</TabThreeStack.Navigator>
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function AboutStackNavigator() {\n\treturn (\n\t\t<Stack.Navigator>\n\t\t\t<Stack.Screen name=\"About\" component={AboutScreen} />\n\t\t</Stack.Navigator>\n\t);\n}",
"function TabStack(props) {\n const tabPress = (e) => {\n global.currenRouter = e.target.split(\"-\")[0];\n };\n return (\n <Tab.Navigator\n initialRouteName=\"Home\"\n activeColor=\"#e91e63\"\n shifting={true}\n barStyle={{\n backgroundColor: \"white\",\n }}\n >\n <Tab.Screen\n name=\"Home\"\n component={CategoriesScreen}\n listeners={{ tabPress }}\n options={{\n title: \"Trang chủ\",\n tabBarIcon: ({ color }) => (\n <Icon color={color} name=\"home\" size={26} />\n ),\n }}\n />\n\n {/* <Tab.Screen name=\"Template\" component={TemplateStackScreen} listeners={{ tabPress }} /> */}\n <Tab.Screen\n name=\"Message\"\n component={MessageScreen}\n listeners={{ tabPress }}\n options={{\n title: \"Tin Nhắn\",\n tabBarIcon: ({ color }) => (\n <Icon color={color} name=\"comment\" size={26} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Account\"\n component={AccountScreen}\n listeners={{ tabPress }}\n options={{\n title: \"Tài Khoản\",\n tabBarIcon: ({ color }) => (\n <Icon color={color} name=\"account-circle\" size={26} />\n ),\n }}\n />\n </Tab.Navigator>\n );\n}",
"render(){\n\n\n return (\n\n\n <Tab.Navigator\n \n >\n \n <Tab.Screen name=\"Profile\" component={ProfileStackScreen} />\n <Tab.Screen name=\"Post\" component={PostStackScreen} />\n <Tab.Screen name=\"Friends\" component={FriendsStackScreen} />\n <Tab.Screen name=\"Chitts\" component={ChittsStackScreen} />\n\n </Tab.Navigator>\n\n )\n }",
"function NavTabs(props) {\n return (\n <div>\n <nav className='navbar pt-3 pb-3 navbar-expand-lg nav-jgMain fixed-top bg-dark'>\n <div className='container'>\n <a className='navbar-brand navbar-brand-jg' href='index.html'>\n JENNERATION\n </a>\n <button\n className='navbar-toggler navbar-dark bg-dark'\n type='button'\n data-toggle='collapse'\n data-target='#navbarNavAltMarkup'\n aria-controls='navbarNavAltMarkup'\n aria-expanded='false'\n aria-label='Toggle navigation'\n >\n <span className='navbar-toggler-icon'></span>\n </button>\n <div\n className='collapse navbar-collapse justify-content-end'\n id='navbarNavAltMarkup'\n >\n <div className='navbar-nav'>\n <a\n className='nav-item nav-link active'\n href='#home'\n onClick={() => props.handlePageChange(\"Home\")}\n className={\n props.currentPage === \"Home\" ? \"nav-link active\" : \"nav-link\"\n }\n >\n Home<span className='sr-only'>(current)</span>\n </a>\n\n <a\n className='nav-item nav-link active'\n href='#projects'\n onClick={() => props.handlePageChange(\"Projects\")}\n className={\n props.currentPage === \"Projects\"\n ? \"nav-link active\"\n : \"nav-link\"\n }\n >\n Works\n </a>\n\n <a\n className='nav-item nav-link active'\n href='#about'\n onClick={() => props.handlePageChange(\"About\")}\n className={\n props.currentPage === \"About\" ? \"nav-link active\" : \"nav-link\"\n }\n >\n About\n </a>\n\n <a\n className='nav-item nav-link active'\n href='#contact'\n onClick={() => props.handlePageChange(\"Contact\")}\n className={\n props.currentPage === \"Contact\"\n ? \"nav-link active\"\n : \"nav-link\"\n }\n >\n Contact\n </a>\n </div>\n </div>\n </div>\n </nav>\n </div>\n );\n}",
"function Interview(props) {\n\n //Creating object of pages\n const navigation = {\n pages: [\n { path: '/', label: 'Welcome', },\n { path: '/about-me', label: 'About Me' },\n { path: '/about-website', label: 'Why this website?' }\n ],\n }\n\n //Handler for Navigation tab changed\n const selectionHandler = (event, value) => {\n props.history.push(value);\n }\n\n return (\n //Website Navigation Tabs \n <Grid className='Interview' style={{height: '100%'}}>\n <CustomTabs\n value={props.history.location.pathname || '/'}\n onChange={selectionHandler}\n centered\n >\n {navigation.pages.map((page) => {\n return (\n <CustomTab value={page.path} label={page.label} key={page.path} />\n )\n })}\n </CustomTabs>\n {/*Configuring Switch to rerender exact page requested*/}\n <Switch>\n <Route path='/about-website'>\n <AboutWebsite />\n </Route>\n <Route path='/about-me'>\n <AboutMe />\n </Route>\n <Route path='/'>\n <Welcome />\n </Route>\n </Switch>\n <Footer />\n </Grid>\n );\n}",
"function renderHome(){\n \n const content = document.getElementById('tab-content');\n content.classList.add('flex-lay');\n content.classList.remove('grid-lay');\n \n content.textContent = '';\n \n const aboutSection = createAboutSection();\n \n setBtnActive('home');\n \n content.appendChild(aboutSection);\n}",
"render() {\n const { appNavigationState } = this.props;\n const { tabs } = appNavigationState;\n const tabKey = tabs.routes[tabs.index].key;\n const scenes = appNavigationState[tabKey];\n\n return (\n <View style={styles.navigator}>\n <NavigationCardStack\n key={`stack_${tabKey}`}\n onNavigateBack={this.back}\n navigationState={scenes}\n renderOverlay={this.renderHeader}\n renderScene={this.renderScene}\n style={styles.navigatorCardStack}\n />\n <YourTabs\n navigationState={tabs}\n />\n </View>\n );\n }",
"function TabStackNavigator() {\n return (\n <Stack.Navigator screenOptions={{headerShown: false}}>\n <Stack.Screen name={ROUTES.Tab1} component={Home} />\n <Stack.Screen name={ROUTES.Search} component={Search} />\n <Stack.Screen name={ROUTES.Quotes} component={QuoteStackNavigator} />\n <Stack.Screen name={ROUTES.Clients} component={ClientStackNavigator} />\n <Stack.Screen name={ROUTES.Users} component={UsersStackNavigator} />\n <Stack.Screen name={ROUTES.Orders} component={OrdersStackNavigator} />\n <Stack.Screen name={ROUTES.Products} component={ProductStackNavigator} />\n <Stack.Screen\n name={ROUTES.UploadOrders}\n component={UploadOrdersStackNavigator}\n />\n <Stack.Screen\n name={ROUTES.SupportRequests}\n component={RequestsStackNavigator}\n />\n </Stack.Navigator>\n );\n}",
"function NavTabs(props) {\n const {\n tabs = [],\n currentPage,\n handlePageChange,\n } = props;\n \n return (\n <ul className=\"nav nav-tabs ml-auto my-1 mr-2\">\n {tabs.map((tab) => (\n <li\n className=\"nav-item\"\n key={tab}\n style={{\n backgroundColor: \"#122240\",\n color: \"#be8180\",\n }}\n >\n <a\n style={{\n backgroundColor: \"#122240\",\n color: \"#be8180\",\n }}\n href={\"#\" + tab.toLowerCase()}\n // Whenever a tab is clicked on,\n // the current page is set through the handlePageChange props.\n onClick={() => handlePageChange(tab)}\n className={currentPage === tab ? \"nav-link active\" : \"nav-link\"}\n >\n {tab}\n </a>\n </li>\n ))}\n </ul>\n );\n}",
"function HomeBottomTabs() {\n return (\n <Tab.Navigator\n //customize the bottom tabs using the customTabBarStyle\n tabBarOptions={customTabBarStyle}\n >\n <Tab.Screen\n name=\"Classes\"\n //make this tab go to the classes screen\n component={ClassesStackScreen}\n options={{\n //make the icon for this tab a scholar's cap\n tabBarIcon: ({ color, size }) => (\n <Ionicons name=\"school-outline\" size={size} color={color} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Notes\"\n //make this tab go to the library screen\n component={LibraryStackScreen}\n options={{\n //make the icon for this tab a notes icon\n tabBarIcon: ({ color, size }) => (\n <SimpleLineIcons name=\"note\" size={size} color={color} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Folders\"\n //make this tab go to the folders screen\n component={FoldersStackScreen}\n options={{\n //make the icon for this tab a folder\n tabBarIcon: ({ color, size }) => (\n <AntDesign name=\"folder1\" size={size} color={color} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Planner\"\n //make this tab go to the planner screen\n component={PlannerStackScreen}\n options={{\n //make the icon for this tab a calendar\n tabBarIcon: ({ color, size }) => (\n <FontAwesome5 name=\"calendar-check\" size={size} color={color} />\n ),\n }}\n />\n </Tab.Navigator>\n );\n}",
"function App() {\n return (\n <div className=\"App\">\n <Nav arr={tab}/>\n\n </div>\n );\n}",
"render(){\n return (\n <div>\n {/*Page header used by bootstrap to name the app */}\n <PageHeader>Title <small>Words to live by</small></PageHeader>\n {/*\n Nav/NavItem used by bootstrap to create links to different routes.\n React-router v4 uses \"Link\" imported from 'react-router-dom' rather\n than simple hrefs. Since bootstrap NavItems use hrefs, we need to\n use LinkContainer to make them play nice.\n */}\n <Nav bsStyle=\"tabs\">\n <LinkContainer exact={true} to =\"/\">\n <NavItem eventKey={1}>\n Home\n </NavItem>\n </LinkContainer>\n <LinkContainer to =\"/route1\">\n <NavItem eventKey={2}>\n Route 1\n </NavItem>\n </LinkContainer>\n <LinkContainer to =\"/route2\">\n <NavItem eventKey={3}>\n Route 2\n </NavItem>\n </LinkContainer>\n </Nav>\n </div>\n )\n }",
"function App() {\n const [pages] = useState([\n {\n name: \"about me\",\n page: <About />\n },\n {\n name: \"projects\",\n page: <Portfolio />\n }\n // {\n // name: \"contact\",\n // page: <Contact />\n // },\n // {\n // name: \"resume\",\n // page: <Resume />\n // },\n ]);\n\n const [currentPage, setCurrentPage] = useState(pages[0]);\n\n // function displayPage() {\n // switch (currentPage.name) {\n // case \"about me\":\n // return <About />;\n\n // case \"portfolio\":\n // return <Portfolio />;\n\n // case 'resume':\n // return <Resume/>;\n\n // case 'contact':\n // return <Contact/>;\n\n // default: // defensive programming used to redirect user if information is missing or whatever scenario\n // return <About />;\n // }\n // }\n\n return (\n \n <div>\n <Title/>\n <Nav\n pages={pages}\n currentPage={currentPage}\n setCurrentPage={setCurrentPage}\n />\n <main>\n {currentPage.page}\n </main>\n\n\n \n <Footer />\n\n </div>\n );\n}",
"function HistoryTab() {\n\treturn (\n\t\t<div>\n\t\t\t<p>Hello World This is the History Tab</p>\n\t\t\t<img src={Head} />\n\t\t</div>\n\t);\n}",
"function AboutPageWithStack({ navigation }) {\n return (\n <Stack.Navigator\n initialRouteName=\"About\"\n screenOptions={{\n headerLeft: ()=> <NavigationDrawerStructure navigationProps={navigation} />, //left drawer menu icon from cust component\n headerStyle: {\n backgroundColor: '#0E7AD5', //Set Header background color\n },\n headerTintColor: '#fff', //Set Header text & icon color\n headerTitleStyle: {\n fontWeight: 'bold', //Set Header text font & style\n }\n }}>\n <Stack.Screen\n name=\"About\"\n component={aboutPage}\n options={{\n title: 'About', //Set Header Title\n }}/>\n <Stack.Screen\n name=\"Contact\"\n component={contactPage}\n options={{\n title: 'Contact', //Set Header Title\n }}/>\n </Stack.Navigator>\n );\n}",
"function AppTabScreen({routeName}){\n return(\n <Tab.Navigator\n initialRouteName={routeName}\n screenOptions={({ route }) => ({\n tabBarIcon: ({ focused, color, size }) => {\n let iconName;\n\n if (route.name === 'App') {\n iconName = 'ios-home';\n } \n else if (route.name === 'Options') {\n iconName = focused ? 'ios-list-box' : 'ios-list';\n }\n else if (route.name === 'About') {\n iconName = focused ? 'ios-information-circle' : 'ios-information-circle-outline';\n }\n\n // Qualquer componente pode ser usado\n return <Ionicons name={iconName} size={size} color={color} />;\n },\n })}\n tabBarOptions={{\n activeTintColor: 'red',\n inactiveTintColor: 'black',\n }}\n >\n\n <Tab.Screen name=\"App\" component={AppStack}/>\n <Tab.Screen name=\"Options\" component={OptionsScreen}/>\n <Tab.Screen name=\"About\" component={AboutScreen}/>\n\n </Tab.Navigator>\n );\n}",
"function HomeTabs() {\n return (\n // The route to \"Home\" is rendered on first load of the navigator\n // The screenOptions options in the Navigator sets the default options for\n // each of the child Screens\n // This function is passed down to each individual Screen, which then passes\n // its route prop to this function\n <Tab.Navigator\n initialRouteName=\"Home\"\n screenOptions={({ route }) => ({\n tabBarIcon: ({ color, size }) => {\n // Switch statements that assigns icon based on TabScreen name\n switch (route.name) {\n case 'Diagnostics':\n return <MaterialCommunityIcons name=\"hospital\" size={size} color={color} />;\n case 'Data':\n return <MaterialCommunityIcons name=\"waveform\" size={size} color={color} />;\n case 'Home':\n return <Ionicons name=\"ios-globe-outline\" size={size} color={color} />;\n case 'Ambiance':\n return <FontAwesome5 name=\"lightbulb\" size={size} color={color} />;\n case 'Settings':\n return <Ionicons name=\"settings-outline\" size={size} color={color} />;\n default:\n return <Text>error</Text>;\n }\n },\n })}\n tabBarOptions={{\n activeTintColor: 'black',\n inactiveTintColor: 'gray',\n }}\n >\n {/* The different tabs routes are declared here as Screens */}\n <Tab.Screen name=\"Diagnostics\" component={DiagnosticsTab} />\n <Tab.Screen name=\"Data\" component={DataTab} />\n <Tab.Screen name=\"Home\" component={HomeTab} />\n <Tab.Screen name=\"Ambiance\" component={AmbianceTab} />\n <Tab.Screen name=\"Settings\" component={SettingsTab} />\n </Tab.Navigator>\n );\n}",
"function MainView() {\n return (\n <div className=\"col-md-9\">\n <div className=\"feed-toggle\">\n <ul className=\"nav nav-pills outline-active\">\n <YourFeedTab />\n\n <GlobalFeedTab />\n\n <TagFilterTab />\n </ul>\n </div>\n\n <ArticleList />\n </div>\n );\n}",
"function HomeScreen() {\n return (\n <>\n <Tab.Navigator\n initialRouteName=\"BookList\"\n tabBarOptions={{\n activeTintColor: \"#e91e63\",\n }}\n >\n <Tab.Screen\n name=\"BookListScreen\"\n component={BookListScreen}\n options={{\n tabBarLabel: \"Home\",\n tabBarIcon: ({ color, size }) => (\n <MaterialCommunityIcons name=\"home\" color={color} size={size} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Search\"\n component={BookSearchScreen}\n options={{\n tabBarLabel: \"Search\",\n tabBarIcon: ({ color, size }) => (\n <FAIcon5 name=\"search\" color={color} size={size} />\n ),\n }}\n />\n <Tab.Screen\n name=\"Menu\"\n component={MenuScreen}\n options={{\n tabBarLabel: \"Menu\",\n tabBarIcon: ({ color, size }) => (\n <MaterialCommunityIcons name=\"menu\" color={color} size={size} />\n ),\n }}\n />\n </Tab.Navigator>\n </>\n );\n}",
"function Tabs(props){\n const allTabs = ['synopsis', 'cast', 'episodes', 'related'];\n const tabNames = ['Story', 'Cast', 'Eps.', 'Related'];\n\n const tabs = allTabs.map((tab, index) => {\n const load = (tab === 'synopsis' ? null : 'MAL'); // Whether to load MAL or not\n const onTab = props.currentTab === tab // See if it's on\n const className = `tab-${tab} ` + (onTab ? 'on' : null); // If on, add \"on\"\n\n return(<div key={tab} className={className} onClick={() => props.handleTab(tab, load)}> {tabNames[index]}</div>)\n });\n\n return(\n <div className=\"window-tabs\">\n {tabs}\n </div>\n )\n }",
"function MainStackNavigator() {\n return (\n \n\n // {/* <TabNavigator /> */}\n // <NavigationContainer>\n // <Tab.Navigator>\n // <Tab.Screen name='CommunitiesPublicGoals' component={CommunitiesPublicGoals} />\n // </Tab.Navigator>\n // </NavigationContainer>\n\n <NavigationContainer>\n <Stack.Navigator initialRouteName='Home'>\n <Stack.Screen name='Home' component={Home} />\n <Stack.Screen name='userHome' component={userHome} />\n <Stack.Screen name='UsersIndividualGoal' component={UsersIndividualGoal} />\n <Stack.Screen name='AddNewGoal' component={AddNewGoal} />\n <Stack.Screen name='CommunitiesPublicGoals' component={CommunitiesPublicGoals} />\n\n \n </Stack.Navigator>\n </NavigationContainer>\n )\n}",
"function NavTabs(props) {\n return /*#__PURE__*/Object(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__[\"jsxDEV\"])(\"div\", {\n children: /*#__PURE__*/Object(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__[\"jsxDEV\"])(\"nav\", {\n className: \"navbar pt-3 pb-3 navbar-expand-lg nav-jgMain fixed-top bg-dark\",\n children: /*#__PURE__*/Object(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__[\"jsxDEV\"])(\"div\", {\n className: \"container\",\n children: [/*#__PURE__*/Object(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__[\"jsxDEV\"])(\"a\", {\n className: \"navbar-brand navbar-brand-jg\",\n href: \"index.html\",\n children: \"JENNERATION\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 8,\n columnNumber: 11\n }, this), /*#__PURE__*/Object(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__[\"jsxDEV\"])(\"button\", {\n className: \"navbar-toggler navbar-dark bg-dark\",\n type: \"button\",\n \"data-toggle\": \"collapse\",\n \"data-target\": \"#navbarNavAltMarkup\",\n \"aria-controls\": \"navbarNavAltMarkup\",\n \"aria-expanded\": \"false\",\n \"aria-label\": \"Toggle navigation\",\n children: /*#__PURE__*/Object(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__[\"jsxDEV\"])(\"span\", {\n className: \"navbar-toggler-icon\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 16,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 9,\n columnNumber: 11\n }, this), /*#__PURE__*/Object(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__[\"jsxDEV\"])(\"div\", {\n className: \"collapse navbar-collapse justify-content-end\",\n id: \"navbarNavAltMarkup\",\n children: /*#__PURE__*/Object(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__[\"jsxDEV\"])(\"div\", {\n className: \"navbar-nav\",\n children: [/*#__PURE__*/Object(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__[\"jsxDEV\"])(\"a\", {\n className: \"nav-item nav-link active\",\n href: \"#home\",\n onClick: () => props.handlePageChange(\"Home\"),\n className: props.currentPage === \"Home\" ? \"nav-link active\" : \"nav-link\",\n children: [\"Home\", /*#__PURE__*/Object(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__[\"jsxDEV\"])(\"span\", {\n className: \"sr-only\",\n children: \"(current)\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 26,\n columnNumber: 21\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 23,\n columnNumber: 15\n }, this), /*#__PURE__*/Object(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__[\"jsxDEV\"])(\"a\", {\n className: \"nav-item nav-link active\",\n href: \"#about\",\n onClick: () => props.handlePageChange(\"About\"),\n className: props.currentPage === \"About\" ? \"nav-link active\" : \"nav-link\",\n children: \"About\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 29,\n columnNumber: 15\n }, this), /*#__PURE__*/Object(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__[\"jsxDEV\"])(\"a\", {\n className: \"nav-item nav-link active\",\n href: \"#projects\",\n onClick: () => props.handlePageChange(\"Projects\"),\n className: props.currentPage === \"Projects\" ? \"nav-link active\" : \"nav-link\",\n children: \"Projects\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 35,\n columnNumber: 15\n }, this), /*#__PURE__*/Object(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__[\"jsxDEV\"])(\"a\", {\n className: \"nav-item nav-link active\",\n href: \"#contact\",\n onClick: () => props.handlePageChange(\"Contact\"),\n className: props.currentPage === \"Contact\" ? \"nav-link active\" : \"nav-link\",\n children: \"Contact\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 41,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 22,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 18,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 7,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 6,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 5,\n columnNumber: 5\n }, this);\n}",
"render() {\n return (\n <div className=\"App\">\n\n <nav className=\"Navbar\">\n <h2>btf</h2>\n <ul>\n <li>\n <Link to=\"/about\">about</Link>\n </li>\n <li>\n <Link to=\"/projects\">projects</Link>\n </li>\n <li>\n <Link to=\"/contacts\">contacts</Link>\n </li>\n </ul>\n </nav>\n\n <Switch>\n <Route exact path=\"/\">\n <h1>Home</h1>\n </Route>\n <Route path=\"/about\">\n <h1>About</h1>\n </Route>\n <Route path=\"/projects\">\n <h1>Projects</h1>\n </Route>\n <Route path=\"/contacts\">\n <h1>Contacts</h1>\n </Route>\n\n </Switch>\n\n </div>\n );\n }",
"function renderAbout(){\n const tab = document.getElementById('tab');\n tab.textContent = '';\n tab.appendChild(createAbout());\n}",
"render() {\n console.log('sef a', this.props)\n return (\n <div className=\"intro_container\">\n <div className=\"text_intro\">\n <p>More...</p>\n </div>\n <div className=\"intro_tabs\">\n <div className=\"news_bubble\">\n <img className=\"news_img\" src={feed} alt=\"\"/>\n <button onClick={() => this.props.router.history.push('/feed')} className=\"main_button_tab\">Feed</button>\n </div>\n <div className=\"friends_bubble\">\n <img className=\"friends_img\" src={chat} alt=\"\"/>\n <button onClick={() => this.props.router.history.push('/chat')} className=\"main_button_tab\">Chat</button>\n </div>\n <div className=\"space_station_bubble\">\n <img className=\"ss_img\" src={apod} alt=\"\"/>\n <button onClick={() => this.props.router.history.push('/apod')} className=\"main_button_tab\">APOD</button>\n </div>\n </div>\n <div className=\"bottom_footer\">\n \n </div>\n </div>\n )\n }",
"function AboutPage() {\n return (\n <div>\n <div className=\"component-head\">\n <h1>Technologies Used</h1>\n </div>\n <div className=\"hop-logo\">\n <HopsLogo />\n </div>\n <div className=\"container\">\n <div>\n <ul>\n <li>React</li>\n <li>Redux-Saga</li>\n <li>Email.js</li>\n <li>Moment.js</li>\n <li>Node</li>\n <li>Express</li>\n <li>Material-UI</li>\n <li>HTML</li>\n <li>CSS</li>\n </ul>\n </div>\n </div>\n </div>\n );\n}",
"function NavBar(props) {\n const handleClick = tab => {\n props.dispatch(setCurrentTab(tab));\n };\n\n const handleLogOut = () => {\n props.dispatch(setAuthedUser('null'));\n props.dispatch(setCurrentTab('null'));\n };\n\n const { currentTab, authedUser } = props;\n return (\n <div className='navbar'>\n <Link\n to='/questions'\n onClick={() => handleClick('home')}\n className={`navbar-home-button ${\n currentTab === 'home' ? 'active' : 'passive'\n }`}\n >\n HOME\n </Link>\n <Link\n to='/add'\n onClick={() => handleClick('newQuestion')}\n className={`navbar-post-button ${\n currentTab === 'newQuestion' ? 'active' : 'passive'\n }`}\n >\n POST YOUR QUESTION\n </Link>\n <Link\n to='/leaderboard'\n onClick={() => handleClick('leaderboard')}\n className={`navbar-leaderboard-button ${\n currentTab === 'leaderboard' ? 'active' : 'passive'\n }`}\n >\n LEADERBOARD\n </Link>\n {authedUser !== 'null' && (\n <div>\n <NavAvatar />\n <Link\n to='/signin'\n style={{ textDecoration: 'none' }}\n onClick={handleLogOut}\n >\n <button className='logout-button'>LOG OUT</button>\n </Link>\n </div>\n )}\n </div>\n );\n}",
"function ClassBottomTabs({ route }) {\n return (\n <Tab.Navigator\n //customize the bottom tabs using the customTabBarStyle\n //edit some of the parameters from the customTabBarStyle to suit the class that the user navigated to\n tabBarOptions={{\n ...customTabBarStyle,\n activeTintColor: route.params.tintColor,\n style: {\n backgroundColor: \"white\",\n },\n }}\n >\n <Tab.Screen\n name=\"Camera\"\n options={{\n //make the bottom tab icon a camera\n tabBarIcon: ({ color, size }) => (\n <Feather name=\"camera\" size={size} color={color} />\n ),\n }}\n >\n {/* Customize the header of the camera screen to suit the class that the user navigated to */}\n {(props) => (\n <CameraStackScreen\n {...props}\n title={route.params.title}\n backgroundColor={route.params.backgroundColor}\n iconName={route.params.iconName}\n />\n )}\n </Tab.Screen>\n <Tab.Screen\n name=\"Notes\"\n options={{\n //make the bottom tab icon a notes icon\n tabBarIcon: ({ color, size }) => (\n <SimpleLineIcons name=\"note\" size={size} color={color} />\n ),\n }}\n >\n {/* Customize the header of the library screen to suit the class that the user navigated to */}\n {(props) => (\n <LibraryStackScreen\n {...props}\n title={route.params.title}\n backgroundColor={route.params.backgroundColor}\n iconName={route.params.iconName}\n />\n )}\n </Tab.Screen>\n <Tab.Screen\n name=\"Folders\"\n options={{\n //make the bottom tab icon a folder\n tabBarIcon: ({ color, size }) => (\n <AntDesign name=\"folder1\" size={size} color={color} />\n ),\n }}\n >\n {/* Customize the header of the folders screen to suit the class that the user navigated to */}\n {(props) => (\n <FoldersStackScreen\n {...props}\n title={route.params.title}\n backgroundColor={route.params.backgroundColor}\n iconName={route.params.iconName}\n />\n )}\n </Tab.Screen>\n <Tab.Screen\n name=\"Planner\"\n options={{\n //make the bottom tab icon a calendar\n tabBarIcon: ({ color, size }) => (\n <FontAwesome5 name=\"calendar-check\" size={size} color={color} />\n ),\n }}\n >\n {/* Customize the header of the planner screen to suit the class that the user navigated to */}\n {(props) => (\n <PlannerStackScreen\n {...props}\n title={route.params.title}\n backgroundColor={route.params.backgroundColor}\n iconName={route.params.iconName}\n />\n )}\n </Tab.Screen>\n </Tab.Navigator>\n );\n}",
"function App() {\n return (\n <>\n<LandingPage/>\n<LandingpageTab/>\n </>\n );\n}",
"function About(){\n\treturn(\n\t\t<React.Fragment>\n\t\t\t<h1>About</h1>\n\t\t\t<p>This is the TodoList app v1.0.0. It is part of a React crash course</p>\n\t\t</React.Fragment> \n\t)\n}"
] |
[
"0.70132256",
"0.66482043",
"0.63314754",
"0.63214475",
"0.6297563",
"0.6234316",
"0.6162473",
"0.61617774",
"0.6129372",
"0.606334",
"0.6059632",
"0.6044198",
"0.59987694",
"0.5944048",
"0.5923726",
"0.58679473",
"0.58668506",
"0.58446765",
"0.5799544",
"0.57880574",
"0.57877934",
"0.5752579",
"0.5748793",
"0.57266784",
"0.57110816",
"0.5704802",
"0.56894094",
"0.5675071",
"0.56496096",
"0.56441873"
] |
0.688706
|
1
|
'GET' request an url, and call callback with JSON data
|
function request(url, callback) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', url, true);
xmlhttp.send();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var data = JSON.parse(xmlhttp.responseText);
callback(data);
}
};
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"get(url, callback) {}",
"function jsonGet(url, callback) {\r\n var xhr = new XMLHttpRequest();\r\n\r\n xhr.open('GET', url, true);\r\n xhr.setRequestHeader('Content-Type', 'application/json');\r\n\r\n xhr.onreadystatechange = callback;\r\n\r\n xhr.send();\r\n}",
"function getData(url, callback) {\r\n var xhttp = new XMLHttpRequest();\r\n xhttp.onreadystatechange = function() {\r\n if (this.readyState == 4 && this.status == 200) {\r\n if (callback) {\r\n callback(JSON.parse(xhttp.response));\r\n }\r\n }\r\n };\r\n xhttp.open(\"GET\", url, true);\r\n xhttp.send();\r\n}",
"function request(){\n\n var xhr = GethttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'json';\n xhr.onload = function() {\n var status = xhr.status;\n if (status == 200) {\n callback(status, xhr.response);\n } else {\n callback(status);\n }\n };\n xhr.send();\n }",
"function ajaxCall(url, callback) {\n var ajax=new XMLHttpRequest();\n ajax.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n callback(JSON.parse(this.responseText));\n }\n };\n ajax.open(\"GET\", url, true);\n ajax.send();\n}",
"function ajax_get(url, callback) {\n var xmlhttp = new XMLHttpRequest();\n xmlhttp.onreadystatechange = function() {\n if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {\n //console.log('responseText:' + xmlhttp.responseText);\n try {\n var data = JSON.parse(xmlhttp.responseText);\n } catch (err) {\n //console.log(err.message + \" in \" + xmlhttp.responseText);\n return;\n }\n callback(data);\n }\n };\n\n xmlhttp.open(\"GET\", url, true);\n xmlhttp.send();\n}",
"function getJSON(myUrl, view) { // function that allows us to request json from a url; executes when we query our api\n var request = new XMLHttpRequest();\n request.open('GET', myUrl, true);\n\n request.onload = function() {\n if (request.status >= 200 && request.status < 400) {\n var data = JSON.parse(request.responseText);\n handleData(data, view); //once the data is parsed handle the data\n } else {\n console.log('The target server returned an error');\n }\n };\n\n request.onerror = function() {\n console.log('There was a connection error');\n };\n request.send()\n }",
"function get(url, data, callback) {\n var requestUrl = url + '?' + data;\n request.get(requestUrl, function(error, response, body) {\n callback(response.statusCode, body);\n });\t\n}",
"function SendToFiWareGet(url, callback)\n{\n\tvar req = new XMLHttpRequest();\n\treq.onreadystatechange = function(e)\n\t{\n\t\tif (this.readyState == 4 && this.status == 200)\n\t\t{\n\t\t\ttry \n\t\t\t{\n\t\t\t\tvar json = JSON.parse(this.responseText);\n\t\t\t}\n\t\t\tcatch (e)\n\t\t\t{\n\t\t\t\talert(this.responseText);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcallback(json);\n\t\t}\n\t}\n\treq.open(\"GET\", url);\n\treq.send();\n}",
"function getData(url, callback) {\n http.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n callback(this);\n }\n };\n http.open(\"GET\", url, true);\n http.send();\n}",
"function getJSON(url, callback) { //replacement for $.getJSON\n\thttps.get(url, (response) => {\n\t\tvar body = '';\n\t\tresponse.on('data', function(d) {\n\t\t\tbody += d;\n\t\t});\n\t\tresponse.on('end', function() {\n\t\t\tcallback(null, JSON.parse(body));\n\t\t});\n\t}).on('error', function(e) { //e is a common convention for error, which is why the functino is named e\n\t\tcallback(e);\n\t});\n}",
"function requestJSON(url,callback) {\n var xmlhttp = new XMLHttpRequest();\n\n xmlhttp.onreadystatechange = function () {\n if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {\n var res = JSON.parse(xmlhttp.responseText);\n try {\n callback(res);\n }\n catch (err) {\n console.log(err.message);\n }\n }\n }\n\n xmlhttp.open(\"GET\", url, true);\n xmlhttp.send();\n}",
"function httpGet(url, callback, params){\n \n console.log(\"Http GET to url: \"+url)\n var xmlHttp = new XMLHttpRequest();\n xmlHttp.onreadystatechange = function() { \n if (xmlHttp.readyState == 4 && xmlHttp.status == 200)\n callback(xmlHttp.responseText, params);\n }\n xmlHttp.open(\"GET\", url, true);\n xmlHttp.send(null);\n}",
"function getData(url, callback){\r\n\r\n $.get(url, function(data)\r\n {\r\n \tcallback(data);\r\n }); \r\n}",
"function get(url, callback)\n {\n getfunction(url, callback);\n }",
"function ajax_get_request(callback, url) {\r\n var xhr = new XMLHttpRequest();\r\n xhr.onreadystatechange = function(){\r\n if (callback && xhr.readyState == XMLHttpRequest.DONE\r\n && (xhr.status == 200 || xhr.status == 0))\r\n {\r\n callback(xhr.responseText);\r\n }\r\n };\r\n xhr.open(\"GET\", url, true);\r\n xhr.send();\r\n}",
"function doRequest(url, data, callback) {\n callback({ url, data });\n }",
"function callJson(callback) {\n var directory = window.location.href + '/getJSON';\n var xobj = new XMLHttpRequest();\n xobj.open('GET', directory, true); // Replace 'my_data' with the path to your file\n xobj.onreadystatechange = function() {\n if (xobj.readyState == 4 && xobj.status == \"200\") {\n // Required use of an anonymous callback as .open will NOT return a value but simply returns undefined in asynchronous mode\n callback(xobj.responseText);\n }\n };\n xobj.send(null);\n}",
"function getJSON(url, callback){\n // create XMLHttp request\n const xhr = new XMLHttpRequest();\n // open a request\n xhr.open('GET', url);\n // create a callback function for the callback parameter\n xhr.onload = () => {\n // conditional that checks if xhr request was success\n if(xhr.status === 200){\n let data = JSON.parse(xhr.responseText);\n return callback(data);\n }\n };\n // send the request\n xhr.send();\n}",
"function getJsonData(url, callback){\n request.get({\n headers: {'User-Agent': h.browser()},\n url: url\n }, function (error, response, body) {\n\n if (error) throw new Error(url + ' did not respond');\n\n parseString(body, function (err, result, title) {\n callback(result);\n });\n });\n}",
"function get(url, callback) {\n try {\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function() {\n if (xhr.readyState === 4) {\n callback(xhr.responseText);\n }\n };\n\n xhr.open(\"GET\", url, true);\n xhr.send();\n } catch (e) {\n console.log(e);\n }\n}",
"static _GET(url, cb) {\n jQuery.ajax({\n url: url,\n type: \"GET\",\n })\n .done(function(data, textStatus, jqXHR) {\n Layer.logs.save(\"AJAX get done : \" + jqXHR.statusText + \" \" + jqXHR.status);\n if (jqXHR.responseJSON) {\n cb.setProps(jqXHR.responseJSON);\n } else {\n cb.setHtml(data);\n }\n })\n .fail(function(jqXHR, textStatus, errorThrown) {\n Layer.logs.save(\"AJAX get error : \" + errorThrown);\n })\n .always(function() {\n /* ... */\n Layer.logs.save(\"Executed AJAX get with url : \" + url);\n });\n }",
"function GET(url) {\n\tvar xhr = new XMLHttpRequest();\n\txhr.open('GET', url);\n\txhr.send();\n\txhr.onload = function() {\n\t var json = xhr.responseText; // Response\n\t json = json.replace(/^[^(]*\\(([\\S\\s]+)\\);?$/, '$1'); // Turn JSONP in JSON\n\t json = JSON.parse(json); // Parse JSON\n\t\tdisplay(json);\n\t};\n}",
"function getJSON(requestURL, callback) {\n request({\n url: requestURL,\n json: true\n }, function(error, response, data) {\n // Calls callback passed by one of the API functions\n callback(error, data);\n });\n}",
"function getJson(url, callback) {\n\n\t\tif (!window.XMLHttpRequest) {\n\t\t\t// Not worth it\n\t\t\tcallback({'error': 'Use a modern browser, jeez'});\n\t\t}\n\n\t\tvar xmlhttp = new XMLHttpRequest();\n\n\t\txmlhttp.onreadystatechange = function () {\n\t\t\tif (xmlhttp.readyState == XMLHttpRequest.DONE ) {\n\t\t\t\tif (xmlhttp.status == 200) {\n\t\t\t\t\tcallback (JSON.parse(xmlhttp.responseText));\n\t\t\t\t}\n\t\t\t\telse if (xmlhttp.status == 400) {\n\t\t\t\t\tcallback({'error': 'There was an error 400'});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcallback({'error': 'There was an error'});\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\txmlhttp.open('GET', url, true);\n\t\txmlhttp.setRequestHeader('Content-Type', 'application/json');\n\t\txmlhttp.send();\n\t}",
"function getJSON(url, callback)\n{\n this.bindFunction = function(caller, object) {\n return function() {\n return caller.apply(object, [object]);\n };\n };\n\n this.stateChange = function (object) {\n if (this.request.readyState == 4) {\n var json = null;\n try {\n json = JSON.parse(this.request.responseText);\n } catch (e) {\n json = null;\n }\n this.callback(json);\n }\n };\n\n this.getRequest = function() {\n if (window.ActiveXObject)\n return new ActiveXObject('Microsoft.XMLHTTP');\n else if (window.XMLHttpRequest)\n return new XMLHttpRequest();\n return false;\n };\n\n var data = arguments[2];\n var postbody = [];\n if (data) {\n for (var name in data) {\n var value = encodeURIComponent(data[name]);\n postbody.push(name + \"=\" + value);\n }\n }\n\n this.postBody = postbody.join(\"&\");\n this.callback = callback;\n this.url = url;\n this.request = this.getRequest();\n\n if(this.request) {\n var req = this.request;\n req.onreadystatechange = this.bindFunction(this.stateChange, this);\n req.open(\"POST\", url, true);\n req.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n req.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n req.send(this.postBody);\n }\n}",
"function ajaxGet(url, callback) {\n var req = new XMLHttpRequest();\n req.open(\"GET\", url);\n req.addEventListener(\"load\", function () {\n if (req.status >= 200 && req.status < 400) {\n //Call the callback function with the request response in parameter\n callback(req.responseText);\n } else {\n console.error(req.status + \" \" + req.statusText + \" \" + url);\n }\n });\n req.addEventListener(\"error\", function () {\n console.error(\"Error with this URL : \" + url);\n });\n req.send(null);\n}",
"get(url,cb){\n fetch(url)\n .then(response=>{\n response.json().then(data=>{\n cb(data)\n })\n })\n }",
"function ajax_get_callback(url, callback) {\n var xhr = createCORSRequest(\"GET\", url);\n xhr.onload = function() {\n callback(xhr.responseText);\n }\n xhr.send();\n}",
"function loadData(url, callback){\n\t$.getJSON(url, callback);\n\tconsole.log(url);\n}"
] |
[
"0.78543854",
"0.78474337",
"0.7731454",
"0.7632696",
"0.7539297",
"0.7533426",
"0.7480702",
"0.74681365",
"0.7466682",
"0.74615675",
"0.7448217",
"0.7424495",
"0.74029636",
"0.7398302",
"0.7366457",
"0.7339989",
"0.73132175",
"0.72810423",
"0.7279093",
"0.72603595",
"0.7253938",
"0.72253656",
"0.71923137",
"0.71703196",
"0.7168688",
"0.7163443",
"0.7161844",
"0.7160116",
"0.7139251",
"0.71334225"
] |
0.7996012
|
0
|
make a horizon chart
|
function horizon() {
var hrz = context.horizon();
if (type === 'm') {
return hrz.extent([0, 2])
.colors(['black', 'black', 'teal', '#dd1144']);
} else if (type === 'v') {
return hrz;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function initHorizontalChart() {\n console.log(\"initHorizontalChart\");\n\n // ordinal.rangeRoundBands(interval, padding, outerPadding)\n // computes range values so as to divide the chart area into evenly-spaced, evenly-sized bands\n // assures integers for pixel; values (avoids aliasing)\n // padding: space between bars\n // outerpadding: space before and after bars collection\n\n // ======= data granularity =======\n var vowels = [\"A\", \"E\", \"I\", \"O\", \"U\"];\n\n // ======= chart formatting =======\n var margin = {top: 20, right: 20, bottom: 30, left: 40},\n width = 720 - margin.left - margin.right, // outer width of chart\n height = 500 - margin.top - margin.bottom; // outer height of chart\n\n // ======= scale mapping (data to display) =======\n var x = d3.scale.ordinal() // function that sorts data alphabetically\n .rangeRoundBands([0, width], .1); // .1 specifies space between bars\n\n var y = d3.scale.linear() // function that maps data domain (below) to output range\n .range([height, 0]); // fits max data value into max chart height\n\n // ======= scale label formating =======\n var xAxis = d3.svg.axis() // existing x scale function is bound to xAxis\n .scale(x) // x scale becomes scale function of xAxis object\n .orient(\"bottom\"); // specifies location of axis (top/bottom/left/right)\n\n var yAxis = d3.svg.axis()\n .scale(y) // existing y scale function is bound to yAxis as yAxis function\n .orient(\"left\") // specifies location of axis (top/bottom/left/right)\n .ticks(10, \"%\"); // spacing (10px) and format (%) for ticks\n\n // ======= build svg objects =======\n var svg = d3.select(\"#chartHorizontal\").append(\"svg\") // create and append svg element to container\n .attr(\"width\", width + margin.left + margin.right) // offset chart top/left/right/bottom by margin dimensions\n .attr(\"height\", height + margin.top + margin.bottom)\n .append(\"g\") // g element is parent svg object\n .attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\n\n // ======= get remote data file =======\n d3.tsv(\"data2.tsv\", stringToInt, function(error, dataSet) {\n if (error) throw error;\n\n // ======= get x/y domains (input), bind to ranges (output scale objects) =======\n x.domain(dataSet.map(function(d) { return d.letter; })); // get letter value from data object\n y.domain([0, d3.max(dataSet, function(d) { return d.frequency; })]); // get frequency value from data object\n\n // ======= X scale =======\n svg.append(\"g\") // new \"g\" element contains scale produced by xAxis object methods\n .attr(\"class\", \"x axis\") // \"x\" and \"axis\" classes for general and specific styles\n .attr(\"transform\", \"translate(0,\" + height + \")\")\n .call(xAxis); // calls xAxis methods to create scale\n\n // ======= Y scale (with title) =======\n svg.append(\"g\") // new \"g\" element contains scale produced by yAxis object methods\n .attr(\"class\", \"y axis\") // \"y\" and \"axis\" classes for general and specific styles\n .call(yAxis) // calls yAxis methods to create scale\n .append(\"text\") // append \"Frequency\" scale label to scale\n .attr(\"transform\", \"rotate(-90)\") // rotate label to fit\n .attr(\"y\", 10) // y location of label (moves on x axis due to rotation)\n .attr(\"dy\", \".71em\") // location tweak\n .style(\"text-anchor\", \"end\") // position based on end of text string (vs start of text)\n .text(\"Frequency\"); // text content (\"Frequency\")\n\n // ======= rects for bar graph =======\n svg.selectAll(\".bar\") // new \"g\" element containers to hold rect and text elements\n .data(dataSet)\n .enter().append(\"rect\")\n .attr(\"class\", \"bar\") // enable styling of rects via class name\n .attr(\"x\", function(d) { return x(d.letter); }) // x scale function maps range location (\"x\") to domain\n .attr(\"width\", x.rangeBand()) // rangeBand function spaces bars and inserts padding\n .attr(\"y\", function(d) { return y(d.frequency); }) // y scale function maps range location (\"y\") to domain\n .attr(\"height\", function(d) { return height - y(d.frequency); }) // calculated from height - value\n .style({'fill': function(d, i) { // toggle bar colors (index even/odd)\n var vowelCheck = $.inArray(d.letter, vowels);\n if (vowelCheck > -1) {\n whichColor = 'rebeccapurple';\n } else {\n whichColor = (i % 2 == 0) ? \"#556B2F\":\"#808000\";\n }\n return whichColor;\n }\n });\n });\n\n // ======= stringToInt =======\n function stringToInt(d) {\n // console.log(\"stringToInt\");\n d.frequency = +d.frequency;\n return d;\n }\n}",
"function drawHorizon() {\n push();\n\n // the horizon line\n horizonYAnchor = (hGridNum / 10) * gridH;\n horizonTopY = horizonYAnchor / 2;\n\n fill(greenC);\n beginShape();\n curveVertex(0, horizonYAnchor);\n curveVertex(0, horizonYAnchor);\n curveVertex(width / 2, horizonTopY);\n curveVertex(width, horizonYAnchor);\n curveVertex(width, horizonYAnchor);\n vertex(width, height);\n vertex(0, height);\n vertex(0, horizonYAnchor);\n endShape(CLOSE);\n\n //debug\n //debugE(gridW * (floor(hGridNum/2)-3), trackY);\n //debugE(0, horizonYAnchor);\n //debugE(canvasW / 2, horizonYAnchor / 2);\n //debugE(canvasW, horizonYAnchor)\n pop();\n}",
"function horizontalChart(num1, num2, num3) {\n var star = '*';\n return star.repeat(num1) + \"\\n\" + star.repeat(num2) + \"\\n\" + star.repeat(num3);\n}",
"function chartBarChartHorizontal () {\n\n /* Default Properties */\n var svg = void 0;\n var chart = void 0;\n var classed = \"barChartHorizontal\";\n var width = 400;\n var height = 300;\n var margin = { top: 20, right: 20, bottom: 20, left: 80 };\n var transition = { ease: d3.easeBounce, duration: 500 };\n var colors = palette.categorical(3);\n var dispatch = d3.dispatch(\"customValueMouseOver\", \"customValueMouseOut\", \"customValueClick\", \"customSeriesMouseOver\", \"customSeriesMouseOut\", \"customSeriesClick\");\n\n /* Chart Dimensions */\n var chartW = void 0;\n var chartH = void 0;\n\n /* Scales */\n var xScale = void 0;\n var yScale = void 0;\n var colorScale = void 0;\n\n /**\n * Initialise Data and Scales\n *\n * @private\n * @param {Array} data - Chart data.\n */\n function init(data) {\n chartW = width - (margin.left + margin.right);\n chartH = height - (margin.top + margin.bottom);\n\n var _dataTransform$summar = dataTransform(data).summary(),\n columnKeys = _dataTransform$summar.columnKeys,\n valueMax = _dataTransform$summar.valueMax;\n\n var valueExtent = [0, valueMax];\n\n if (typeof colorScale === \"undefined\") {\n colorScale = d3.scaleOrdinal().domain(columnKeys).range(colors);\n }\n\n yScale = d3.scaleBand().domain(columnKeys).rangeRound([0, chartH]).padding(0.15);\n\n xScale = d3.scaleLinear().domain(valueExtent).range([0, chartW]).nice();\n }\n\n /**\n * Constructor\n *\n * @constructor\n * @alias barChartHorizontal\n * @param {d3.selection} selection - The chart holder D3 selection.\n */\n function my(selection) {\n // Create SVG element (if it does not exist already)\n if (!svg) {\n svg = function (selection) {\n var el = selection._groups[0][0];\n if (!!el.ownerSVGElement || el.tagName === \"svg\") {\n return selection;\n } else {\n return selection.append(\"svg\");\n }\n }(selection);\n\n svg.classed(\"d3ez\", true).attr(\"width\", width).attr(\"height\", height);\n\n chart = svg.append(\"g\").classed(\"chart\", true);\n } else {\n chart = selection.select(\".chart\");\n }\n\n // Update the chart dimensions and add layer groups\n var layers = [\"barChart\", \"xAxis axis\", \"yAxis axis\"];\n chart.classed(classed, true).attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\").attr(\"width\", chartW).attr(\"height\", chartH).selectAll(\"g\").data(layers).enter().append(\"g\").attr(\"class\", function (d) {\n return d;\n });\n\n selection.each(function (data) {\n // Initialise Data\n init(data);\n\n // Horizontal Bars\n var barsHorizontal = component.barsHorizontal().width(chartW).height(chartH).colorScale(colorScale).xScale(xScale).yScale(yScale).dispatch(dispatch);\n\n chart.select(\".barChart\").datum(data).call(barsHorizontal);\n\n // X Axis\n var xAxis = d3.axisBottom(xScale);\n\n chart.select(\".xAxis\").attr(\"transform\", \"translate(0,\" + chartH + \")\").call(xAxis);\n\n // Y Axis\n var yAxis = d3.axisLeft(yScale);\n\n chart.select(\".yAxis\").call(yAxis);\n\n // Y Axis Label\n var yLabel = chart.select(\".yAxis\").selectAll(\".yAxisLabel\").data([data.key]);\n\n yLabel.enter().append(\"text\").classed(\"yAxisLabel\", true).attr(\"y\", -10).attr(\"dy\", \".71em\").attr(\"fill\", \"#000000\").style(\"text-anchor\", \"center\").merge(yLabel).transition().text(function (d) {\n return d;\n });\n });\n }\n\n /**\n * Width Getter / Setter\n *\n * @param {number} _v - Width in px.\n * @returns {*}\n */\n my.width = function (_v) {\n if (!arguments.length) return width;\n width = _v;\n return this;\n };\n\n /**\n * Height Getter / Setter\n *\n * @param {number} _v - Height in px.\n * @returns {*}\n */\n my.height = function (_v) {\n if (!arguments.length) return height;\n height = _v;\n return this;\n };\n\n /**\n * Colors Getter / Setter\n *\n * @param {Array} _v - Array of colours used by color scale.\n * @returns {*}\n */\n my.colors = function (_v) {\n if (!arguments.length) return colors;\n colors = _v;\n return this;\n };\n\n /**\n * Color Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 color scale.\n * @returns {*}\n */\n my.colorScale = function (_v) {\n if (!arguments.length) return colorScale;\n colorScale = _v;\n return this;\n };\n\n /**\n * Transition Getter / Setter\n *\n * @param {d3.transition} _v - D3 transition style.\n * @returns {*}\n */\n my.transition = function (_v) {\n if (!arguments.length) return transition;\n transition = _v;\n return this;\n };\n\n /**\n * Dispatch Getter / Setter\n *\n * @param {d3.dispatch} _v - Dispatch event handler.\n * @returns {*}\n */\n my.dispatch = function (_v) {\n if (!arguments.length) return dispatch();\n dispatch = _v;\n return this;\n };\n\n /**\n * Dispatch on Getter\n *\n * @returns {*}\n */\n my.on = function () {\n var value = dispatch.on.apply(dispatch, arguments);\n return value === dispatch ? my : value;\n };\n\n return my;\n }",
"function createChart(options) {\n var data;\n var highLow;\n\n if (options.distributeSeries) {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n data.normalized.series = data.normalized.series.map(function (value) {\n return [value];\n });\n } else {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n } // Create new svg element\n\n\n this.svg = Chartist.createSvg(this.container, options.width, options.height, options.classNames.chart + (options.horizontalBars ? ' ' + options.classNames.horizontalBars : '')); // Drawing groups in correct order\n\n var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n var seriesGroup = this.svg.elem('g');\n var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\n if (options.stackBars && data.normalized.series.length !== 0) {\n // If stacked bars we need to calculate the high low from stacked values from each series\n var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {\n return Array.prototype.slice.call(arguments).map(function (value) {\n return value;\n }).reduce(function (prev, curr) {\n return {\n x: prev.x + (curr && curr.x) || 0,\n y: prev.y + (curr && curr.y) || 0\n };\n }, {\n x: 0,\n y: 0\n });\n });\n highLow = Chartist.getHighLow([serialSums], options, options.horizontalBars ? 'x' : 'y');\n } else {\n highLow = Chartist.getHighLow(data.normalized.series, options, options.horizontalBars ? 'x' : 'y');\n } // Overrides of high / low from settings\n\n\n highLow.high = +options.high || (options.high === 0 ? 0 : highLow.high);\n highLow.low = +options.low || (options.low === 0 ? 0 : highLow.low);\n var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n var valueAxis, labelAxisTicks, labelAxis, axisX, axisY; // We need to set step count based on some options combinations\n\n if (options.distributeSeries && options.stackBars) {\n // If distributed series are enabled and bars need to be stacked, we'll only have one bar and therefore should\n // use only the first label for the step axis\n labelAxisTicks = data.normalized.labels.slice(0, 1);\n } else {\n // If distributed series are enabled but stacked bars aren't, we should use the series labels\n // If we are drawing a regular bar chart with two dimensional series data, we just use the labels array\n // as the bars are normalized\n labelAxisTicks = data.normalized.labels;\n } // Set labelAxis and valueAxis based on the horizontalBars setting. This setting will flip the axes if necessary.\n\n\n if (options.horizontalBars) {\n if (options.axisX.type === undefined) {\n valueAxis = axisX = new Chartist.AutoScaleAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n\n if (options.axisY.type === undefined) {\n labelAxis = axisY = new Chartist.StepAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, options.axisY);\n }\n } else {\n if (options.axisX.type === undefined) {\n labelAxis = axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, options.axisX);\n }\n\n if (options.axisY.type === undefined) {\n valueAxis = axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n } // Projected 0 point\n\n\n var zeroPoint = options.horizontalBars ? chartRect.x1 + valueAxis.projectValue(0) : chartRect.y1 - valueAxis.projectValue(0); // Used to track the screen coordinates of stacked bars\n\n var stackedBarValues = [];\n labelAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n valueAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\n if (options.showGridBackground) {\n Chartist.createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);\n } // Draw the series\n\n\n data.raw.series.forEach(function (series, seriesIndex) {\n // Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\n var biPol = seriesIndex - (data.raw.series.length - 1) / 2; // Half of the period width between vertical grid lines used to position bars\n\n var periodHalfLength; // Current series SVG element\n\n var seriesElement; // We need to set periodHalfLength based on some options combinations\n\n if (options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we need to use the length of the normaizedData array\n // which is the series count and divide by 2\n periodHalfLength = labelAxis.axisLength / data.normalized.series.length / 2;\n } else if (options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled we'll only get one bar so we should just divide the axis\n // length by 2\n periodHalfLength = labelAxis.axisLength / 2;\n } else {\n // On regular bar charts we should just use the series length\n periodHalfLength = labelAxis.axisLength / data.normalized.series[seriesIndex].length / 2;\n } // Adding the series group to the series element\n\n\n seriesElement = seriesGroup.elem('g'); // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n\n seriesElement.attr({\n 'ct:series-name': series.name,\n 'ct:meta': Chartist.serialize(series.meta)\n }); // Use series class from series data or if not set generate one\n\n seriesElement.addClass([options.classNames.series, series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex)].join(' '));\n data.normalized.series[seriesIndex].forEach(function (value, valueIndex) {\n var projected, bar, previousStack, labelAxisValueIndex; // We need to set labelAxisValueIndex based on some options combinations\n\n if (options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we can use the seriesIndex for later projection\n // on the step axis for label positioning\n labelAxisValueIndex = seriesIndex;\n } else if (options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled, we will only get one bar and therefore always use\n // 0 for projection on the label step axis\n labelAxisValueIndex = 0;\n } else {\n // On regular bar charts we just use the value index to project on the label step axis\n labelAxisValueIndex = valueIndex;\n } // We need to transform coordinates differently based on the chart layout\n\n\n if (options.horizontalBars) {\n projected = {\n x: chartRect.x1 + valueAxis.projectValue(value && value.x ? value.x : 0, valueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - labelAxis.projectValue(value && value.y ? value.y : 0, labelAxisValueIndex, data.normalized.series[seriesIndex])\n };\n } else {\n projected = {\n x: chartRect.x1 + labelAxis.projectValue(value && value.x ? value.x : 0, labelAxisValueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - valueAxis.projectValue(value && value.y ? value.y : 0, valueIndex, data.normalized.series[seriesIndex])\n };\n } // If the label axis is a step based axis we will offset the bar into the middle of between two steps using\n // the periodHalfLength value. Also we do arrange the different series so that they align up to each other using\n // the seriesBarDistance. If we don't have a step axis, the bar positions can be chosen freely so we should not\n // add any automated positioning.\n\n\n if (labelAxis instanceof Chartist.StepAxis) {\n // Offset to center bar between grid lines, but only if the step axis is not stretched\n if (!labelAxis.options.stretch) {\n projected[labelAxis.units.pos] += periodHalfLength * (options.horizontalBars ? -1 : 1);\n } // Using bi-polar offset for multiple series if no stacked bars or series distribution is used\n\n\n projected[labelAxis.units.pos] += options.stackBars || options.distributeSeries ? 0 : biPol * options.seriesBarDistance * (options.horizontalBars ? -1 : 1);\n } // Enter value in stacked bar values used to remember previous screen value for stacking up bars\n\n\n previousStack = stackedBarValues[valueIndex] || zeroPoint;\n stackedBarValues[valueIndex] = previousStack - (zeroPoint - projected[labelAxis.counterUnits.pos]); // Skip if value is undefined\n\n if (value === undefined) {\n return;\n }\n\n var positions = {};\n positions[labelAxis.units.pos + '1'] = projected[labelAxis.units.pos];\n positions[labelAxis.units.pos + '2'] = projected[labelAxis.units.pos];\n\n if (options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode)) {\n // Stack mode: accumulate (default)\n // If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line\n // We want backwards compatibility, so the expected fallback without the 'stackMode' option\n // to be the original behaviour (accumulate)\n positions[labelAxis.counterUnits.pos + '1'] = previousStack;\n positions[labelAxis.counterUnits.pos + '2'] = stackedBarValues[valueIndex];\n } else {\n // Draw from the zero line normally\n // This is also the same code for Stack mode: overlap\n positions[labelAxis.counterUnits.pos + '1'] = zeroPoint;\n positions[labelAxis.counterUnits.pos + '2'] = projected[labelAxis.counterUnits.pos];\n } // Limit x and y so that they are within the chart rect\n\n\n positions.x1 = Math.min(Math.max(positions.x1, chartRect.x1), chartRect.x2);\n positions.x2 = Math.min(Math.max(positions.x2, chartRect.x1), chartRect.x2);\n positions.y1 = Math.min(Math.max(positions.y1, chartRect.y2), chartRect.y1);\n positions.y2 = Math.min(Math.max(positions.y2, chartRect.y2), chartRect.y1);\n var metaData = Chartist.getMetaData(series, valueIndex); // Create bar element\n\n bar = seriesElement.elem('line', positions, options.classNames.bar).attr({\n 'ct:value': [value.x, value.y].filter(Chartist.isNumeric).join(','),\n 'ct:meta': Chartist.serialize(metaData)\n });\n this.eventEmitter.emit('draw', Chartist.extend({\n type: 'bar',\n value: value,\n index: valueIndex,\n meta: metaData,\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n chartRect: chartRect,\n group: seriesElement,\n element: bar\n }, positions));\n }.bind(this));\n }.bind(this));\n this.eventEmitter.emit('created', {\n bounds: valueAxis.bounds,\n chartRect: chartRect,\n axisX: axisX,\n axisY: axisY,\n svg: this.svg,\n options: options\n });\n }",
"function appendAxes() {\n graphImg\n .append(\"g\")\n .call(xAxis)\n .attr(\"class\", \"xAxis\")\n .attr(\n \"transform\",\n \"translate(0,\" + (displayHeight - margin - labelArea) + \")\"\n );\n graphImg\n .append(\"g\")\n .call(yAxis)\n .attr(\"class\", \"yAxis\")\n .attr(\"transform\", \"translate(\" + (margin + labelArea) + \", 0)\");\n }",
"function horizontalChart (a, b, c) {\n let empty = \"\";\n let star = \"* \";\n let newLine = \"\\n\";\n for (let i = 0; i < a; i++) {\n empty += star;\n }\n empty += newLine;\n for (let j = 0; j < b; j++) {\n empty += star;\n }\n empty += newLine; \n for (let k = 0; k < c; k++) {\n empty += star;\n }\n empty += newLine;\n return empty; \n}",
"generateHor(h,w)\n\t{\n\t\tfor(var y = 0; y < h ; y++)\n\t\t{\n\t\t\tfor(var x = 0; x < w-1 ; x++)\n\t\t\t{\n\t\t\t\tvar a = new Dot(x,y);\n\t\t\t\tvar b = new Dot(x+1,y);\n\t\t\t\tvar l = new Line(a,b);\n\t\t\t\tthis.lines.set(l.toString(), l);\n\t\t\t}\n\t\t}\n\t}",
"function createChart(options) {\n this.data = Chartist.normalizeData(this.data);\n var data = {\n raw: this.data,\n normalized: options.distributeSeries ? Chartist.getDataArray(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y').map(function (value) {\n return [value];\n }) : Chartist.getDataArray(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y')\n };\n\n var highLow;\n\n // Create new svg element\n this.svg = Chartist.createSvg(\n this.container,\n options.width,\n options.height,\n options.classNames.chart + (options.horizontalBars ? ' ' + options.classNames.horizontalBars : '')\n );\n\n // Drawing groups in correct order\n var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n var seriesGroup = this.svg.elem('g');\n var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\n if (options.stackBars && data.normalized.length !== 0) {\n // If stacked bars we need to calculate the high low from stacked values from each series\n var serialSums = Chartist.serialMap(data.normalized, function serialSums() {\n return Array.prototype.slice.call(arguments).map(function (value) {\n return value;\n }).reduce(function (prev, curr) {\n return {\n x: prev.x + (curr && curr.x) || 0,\n y: prev.y + (curr && curr.y) || 0\n };\n }, { x: 0, y: 0 });\n });\n\n highLow = Chartist.getHighLow([serialSums], Chartist.extend({}, options, {\n referenceValue: 0\n }), options.horizontalBars ? 'x' : 'y');\n } else {\n highLow = Chartist.getHighLow(data.normalized, Chartist.extend({}, options, {\n referenceValue: 0\n }), options.horizontalBars ? 'x' : 'y');\n }\n // Overrides of high / low from settings\n highLow.high = +options.high || (options.high === 0 ? 0 : highLow.high);\n highLow.low = +options.low || (options.low === 0 ? 0 : highLow.low);\n\n var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n\n var valueAxis,\n labelAxisTicks,\n labelAxis,\n axisX,\n axisY;\n\n // We need to set step count based on some options combinations\n if (options.distributeSeries && options.stackBars) {\n // If distributed series are enabled and bars need to be stacked, we'll only have one bar and therefore should\n // use only the first label for the step axis\n labelAxisTicks = data.raw.labels.slice(0, 1);\n } else {\n // If distributed series are enabled but stacked bars aren't, we should use the series labels\n // If we are drawing a regular bar chart with two dimensional series data, we just use the labels array\n // as the bars are normalized\n labelAxisTicks = data.raw.labels;\n }\n\n // Set labelAxis and valueAxis based on the horizontalBars setting. This setting will flip the axes if necessary.\n if (options.horizontalBars) {\n if (options.axisX.type === undefined) {\n valueAxis = axisX = new Chartist.AutoScaleAxis(Chartist.Axis.units.x, data, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n\n if (options.axisY.type === undefined) {\n labelAxis = axisY = new Chartist.StepAxis(Chartist.Axis.units.y, data, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data, chartRect, options.axisY);\n }\n } else {\n if (options.axisX.type === undefined) {\n labelAxis = axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data, chartRect, options.axisX);\n }\n\n if (options.axisY.type === undefined) {\n valueAxis = axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n }\n\n // Projected 0 point\n var zeroPoint = options.horizontalBars ? (chartRect.x1 + valueAxis.projectValue(0)) : (chartRect.y1 - valueAxis.projectValue(0));\n // Used to track the screen coordinates of stacked bars\n var stackedBarValues = [];\n\n labelAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n valueAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\n // Draw the series\n data.raw.series.forEach(function (series, seriesIndex) {\n // Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\n var biPol = seriesIndex - (data.raw.series.length - 1) / 2;\n // Half of the period width between vertical grid lines used to position bars\n var periodHalfLength;\n // Current series SVG element\n var seriesElement;\n\n // We need to set periodHalfLength based on some options combinations\n if (options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we need to use the length of the normaizedData array\n // which is the series count and divide by 2\n periodHalfLength = labelAxis.axisLength / data.normalized.length / 2;\n } else if (options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled we'll only get one bar so we should just divide the axis\n // length by 2\n periodHalfLength = labelAxis.axisLength / 2;\n } else {\n // On regular bar charts we should just use the series length\n periodHalfLength = labelAxis.axisLength / data.normalized[seriesIndex].length / 2;\n }\n\n // Adding the series group to the series element\n seriesElement = seriesGroup.elem('g');\n\n // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n seriesElement.attr({\n 'ct:series-name': series.name,\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // Use series class from series data or if not set generate one\n seriesElement.addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))\n ].join(' '));\n\n data.normalized[seriesIndex].forEach(function (value, valueIndex) {\n var projected,\n bar,\n previousStack,\n labelAxisValueIndex;\n\n // We need to set labelAxisValueIndex based on some options combinations\n if (options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we can use the seriesIndex for later projection\n // on the step axis for label positioning\n labelAxisValueIndex = seriesIndex;\n } else if (options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled, we will only get one bar and therefore always use\n // 0 for projection on the label step axis\n labelAxisValueIndex = 0;\n } else {\n // On regular bar charts we just use the value index to project on the label step axis\n labelAxisValueIndex = valueIndex;\n }\n\n // We need to transform coordinates differently based on the chart layout\n if (options.horizontalBars) {\n projected = {\n x: chartRect.x1 + valueAxis.projectValue(value && value.x ? value.x : 0, valueIndex, data.normalized[seriesIndex]),\n y: chartRect.y1 - labelAxis.projectValue(value && value.y ? value.y : 0, labelAxisValueIndex, data.normalized[seriesIndex])\n };\n } else {\n projected = {\n x: chartRect.x1 + labelAxis.projectValue(value && value.x ? value.x : 0, labelAxisValueIndex, data.normalized[seriesIndex]),\n y: chartRect.y1 - valueAxis.projectValue(value && value.y ? value.y : 0, valueIndex, data.normalized[seriesIndex])\n }\n }\n\n // If the label axis is a step based axis we will offset the bar into the middle of between two steps using\n // the periodHalfLength value. Also we do arrange the different series so that they align up to each other using\n // the seriesBarDistance. If we don't have a step axis, the bar positions can be chosen freely so we should not\n // add any automated positioning.\n if (labelAxis instanceof Chartist.StepAxis) {\n // Offset to center bar between grid lines, but only if the step axis is not stretched\n if (!labelAxis.options.stretch) {\n projected[labelAxis.units.pos] += periodHalfLength * (options.horizontalBars ? -1 : 1);\n }\n // Using bi-polar offset for multiple series if no stacked bars or series distribution is used\n projected[labelAxis.units.pos] += (options.stackBars || options.distributeSeries) ? 0 : biPol * options.seriesBarDistance * (options.horizontalBars ? -1 : 1);\n }\n\n // Enter value in stacked bar values used to remember previous screen value for stacking up bars\n previousStack = stackedBarValues[valueIndex] || zeroPoint;\n stackedBarValues[valueIndex] = previousStack - (zeroPoint - projected[labelAxis.counterUnits.pos]);\n\n // Skip if value is undefined\n if (value === undefined) {\n return;\n }\n\n var positions = {};\n positions[labelAxis.units.pos + '1'] = projected[labelAxis.units.pos];\n positions[labelAxis.units.pos + '2'] = projected[labelAxis.units.pos];\n\n if (options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode)) {\n // Stack mode: accumulate (default)\n // If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line\n // We want backwards compatibility, so the expected fallback without the 'stackMode' option\n // to be the original behaviour (accumulate)\n positions[labelAxis.counterUnits.pos + '1'] = previousStack;\n positions[labelAxis.counterUnits.pos + '2'] = stackedBarValues[valueIndex];\n } else {\n // Draw from the zero line normally\n // This is also the same code for Stack mode: overlap\n positions[labelAxis.counterUnits.pos + '1'] = zeroPoint;\n positions[labelAxis.counterUnits.pos + '2'] = projected[labelAxis.counterUnits.pos];\n }\n\n // Limit x and y so that they are within the chart rect\n positions.x1 = Math.min(Math.max(positions.x1, chartRect.x1), chartRect.x2);\n positions.x2 = Math.min(Math.max(positions.x2, chartRect.x1), chartRect.x2);\n positions.y1 = Math.min(Math.max(positions.y1, chartRect.y2), chartRect.y1);\n positions.y2 = Math.min(Math.max(positions.y2, chartRect.y2), chartRect.y1);\n\n // Create bar element\n bar = seriesElement.elem('line', positions, options.classNames.bar).attr({\n 'ct:value': [value.x, value.y].filter(Chartist.isNum).join(','),\n 'ct:meta': Chartist.getMetaData(series, valueIndex)\n });\n\n this.eventEmitter.emit('draw', Chartist.extend({\n type: 'bar',\n value: value,\n index: valueIndex,\n meta: Chartist.getMetaData(series, valueIndex),\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n chartRect: chartRect,\n group: seriesElement,\n element: bar\n }, positions));\n }.bind(this));\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n bounds: valueAxis.bounds,\n chartRect: chartRect,\n axisX: axisX,\n axisY: axisY,\n svg: this.svg,\n options: options\n });\n }",
"function createChart(options) {\n\t this.data = Chartist.normalizeData(this.data);\n\t var data = {\n\t raw: this.data,\n\t normalized: options.distributeSeries ? Chartist.getDataArray(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y').map(function(value) {\n\t return [value];\n\t }) : Chartist.getDataArray(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y')\n\t };\n\t\n\t var highLow;\n\t\n\t // Create new svg element\n\t this.svg = Chartist.createSvg(\n\t this.container,\n\t options.width,\n\t options.height,\n\t options.classNames.chart + (options.horizontalBars ? ' ' + options.classNames.horizontalBars : '')\n\t );\n\t\n\t // Drawing groups in correct order\n\t var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n\t var seriesGroup = this.svg.elem('g');\n\t var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\t\n\t if(options.stackBars && data.normalized.length !== 0) {\n\t // If stacked bars we need to calculate the high low from stacked values from each series\n\t var serialSums = Chartist.serialMap(data.normalized, function serialSums() {\n\t return Array.prototype.slice.call(arguments).map(function(value) {\n\t return value;\n\t }).reduce(function(prev, curr) {\n\t return {\n\t x: prev.x + (curr && curr.x) || 0,\n\t y: prev.y + (curr && curr.y) || 0\n\t };\n\t }, {x: 0, y: 0});\n\t });\n\t\n\t highLow = Chartist.getHighLow([serialSums], Chartist.extend({}, options, {\n\t referenceValue: 0\n\t }), options.horizontalBars ? 'x' : 'y');\n\t } else {\n\t highLow = Chartist.getHighLow(data.normalized, Chartist.extend({}, options, {\n\t referenceValue: 0\n\t }), options.horizontalBars ? 'x' : 'y');\n\t }\n\t // Overrides of high / low from settings\n\t highLow.high = +options.high || (options.high === 0 ? 0 : highLow.high);\n\t highLow.low = +options.low || (options.low === 0 ? 0 : highLow.low);\n\t\n\t var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n\t\n\t var valueAxis,\n\t labelAxisTicks,\n\t labelAxis,\n\t axisX,\n\t axisY;\n\t\n\t // We need to set step count based on some options combinations\n\t if(options.distributeSeries && options.stackBars) {\n\t // If distributed series are enabled and bars need to be stacked, we'll only have one bar and therefore should\n\t // use only the first label for the step axis\n\t labelAxisTicks = data.raw.labels.slice(0, 1);\n\t } else {\n\t // If distributed series are enabled but stacked bars aren't, we should use the series labels\n\t // If we are drawing a regular bar chart with two dimensional series data, we just use the labels array\n\t // as the bars are normalized\n\t labelAxisTicks = data.raw.labels;\n\t }\n\t\n\t // Set labelAxis and valueAxis based on the horizontalBars setting. This setting will flip the axes if necessary.\n\t if(options.horizontalBars) {\n\t if(options.axisX.type === undefined) {\n\t valueAxis = axisX = new Chartist.AutoScaleAxis(Chartist.Axis.units.x, data, chartRect, Chartist.extend({}, options.axisX, {\n\t highLow: highLow,\n\t referenceValue: 0\n\t }));\n\t } else {\n\t valueAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data, chartRect, Chartist.extend({}, options.axisX, {\n\t highLow: highLow,\n\t referenceValue: 0\n\t }));\n\t }\n\t\n\t if(options.axisY.type === undefined) {\n\t labelAxis = axisY = new Chartist.StepAxis(Chartist.Axis.units.y, data, chartRect, {\n\t ticks: labelAxisTicks\n\t });\n\t } else {\n\t labelAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data, chartRect, options.axisY);\n\t }\n\t } else {\n\t if(options.axisX.type === undefined) {\n\t labelAxis = axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data, chartRect, {\n\t ticks: labelAxisTicks\n\t });\n\t } else {\n\t labelAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data, chartRect, options.axisX);\n\t }\n\t\n\t if(options.axisY.type === undefined) {\n\t valueAxis = axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data, chartRect, Chartist.extend({}, options.axisY, {\n\t highLow: highLow,\n\t referenceValue: 0\n\t }));\n\t } else {\n\t valueAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data, chartRect, Chartist.extend({}, options.axisY, {\n\t highLow: highLow,\n\t referenceValue: 0\n\t }));\n\t }\n\t }\n\t\n\t // Projected 0 point\n\t var zeroPoint = options.horizontalBars ? (chartRect.x1 + valueAxis.projectValue(0)) : (chartRect.y1 - valueAxis.projectValue(0));\n\t // Used to track the screen coordinates of stacked bars\n\t var stackedBarValues = [];\n\t\n\t labelAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\t valueAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\t\n\t // Draw the series\n\t data.raw.series.forEach(function(series, seriesIndex) {\n\t // Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\n\t var biPol = seriesIndex - (data.raw.series.length - 1) / 2;\n\t // Half of the period width between vertical grid lines used to position bars\n\t var periodHalfLength;\n\t // Current series SVG element\n\t var seriesElement;\n\t\n\t // We need to set periodHalfLength based on some options combinations\n\t if(options.distributeSeries && !options.stackBars) {\n\t // If distributed series are enabled but stacked bars aren't, we need to use the length of the normaizedData array\n\t // which is the series count and divide by 2\n\t periodHalfLength = labelAxis.axisLength / data.normalized.length / 2;\n\t } else if(options.distributeSeries && options.stackBars) {\n\t // If distributed series and stacked bars are enabled we'll only get one bar so we should just divide the axis\n\t // length by 2\n\t periodHalfLength = labelAxis.axisLength / 2;\n\t } else {\n\t // On regular bar charts we should just use the series length\n\t periodHalfLength = labelAxis.axisLength / data.normalized[seriesIndex].length / 2;\n\t }\n\t\n\t // Adding the series group to the series element\n\t seriesElement = seriesGroup.elem('g');\n\t\n\t // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n\t seriesElement.attr({\n\t 'ct:series-name': series.name,\n\t 'ct:meta': Chartist.serialize(series.meta)\n\t });\n\t\n\t // Use series class from series data or if not set generate one\n\t seriesElement.addClass([\n\t options.classNames.series,\n\t (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))\n\t ].join(' '));\n\t\n\t data.normalized[seriesIndex].forEach(function(value, valueIndex) {\n\t var projected,\n\t bar,\n\t previousStack,\n\t labelAxisValueIndex;\n\t\n\t // We need to set labelAxisValueIndex based on some options combinations\n\t if(options.distributeSeries && !options.stackBars) {\n\t // If distributed series are enabled but stacked bars aren't, we can use the seriesIndex for later projection\n\t // on the step axis for label positioning\n\t labelAxisValueIndex = seriesIndex;\n\t } else if(options.distributeSeries && options.stackBars) {\n\t // If distributed series and stacked bars are enabled, we will only get one bar and therefore always use\n\t // 0 for projection on the label step axis\n\t labelAxisValueIndex = 0;\n\t } else {\n\t // On regular bar charts we just use the value index to project on the label step axis\n\t labelAxisValueIndex = valueIndex;\n\t }\n\t\n\t // We need to transform coordinates differently based on the chart layout\n\t if(options.horizontalBars) {\n\t projected = {\n\t x: chartRect.x1 + valueAxis.projectValue(value && value.x ? value.x : 0, valueIndex, data.normalized[seriesIndex]),\n\t y: chartRect.y1 - labelAxis.projectValue(value && value.y ? value.y : 0, labelAxisValueIndex, data.normalized[seriesIndex])\n\t };\n\t } else {\n\t projected = {\n\t x: chartRect.x1 + labelAxis.projectValue(value && value.x ? value.x : 0, labelAxisValueIndex, data.normalized[seriesIndex]),\n\t y: chartRect.y1 - valueAxis.projectValue(value && value.y ? value.y : 0, valueIndex, data.normalized[seriesIndex])\n\t }\n\t }\n\t\n\t // If the label axis is a step based axis we will offset the bar into the middle of between two steps using\n\t // the periodHalfLength value. Also we do arrange the different series so that they align up to each other using\n\t // the seriesBarDistance. If we don't have a step axis, the bar positions can be chosen freely so we should not\n\t // add any automated positioning.\n\t if(labelAxis instanceof Chartist.StepAxis) {\n\t // Offset to center bar between grid lines, but only if the step axis is not stretched\n\t if(!labelAxis.options.stretch) {\n\t projected[labelAxis.units.pos] += periodHalfLength * (options.horizontalBars ? -1 : 1);\n\t }\n\t // Using bi-polar offset for multiple series if no stacked bars or series distribution is used\n\t projected[labelAxis.units.pos] += (options.stackBars || options.distributeSeries) ? 0 : biPol * options.seriesBarDistance * (options.horizontalBars ? -1 : 1);\n\t }\n\t\n\t // Enter value in stacked bar values used to remember previous screen value for stacking up bars\n\t previousStack = stackedBarValues[valueIndex] || zeroPoint;\n\t stackedBarValues[valueIndex] = previousStack - (zeroPoint - projected[labelAxis.counterUnits.pos]);\n\t\n\t // Skip if value is undefined\n\t if(value === undefined) {\n\t return;\n\t }\n\t\n\t var positions = {};\n\t positions[labelAxis.units.pos + '1'] = projected[labelAxis.units.pos];\n\t positions[labelAxis.units.pos + '2'] = projected[labelAxis.units.pos];\n\t\n\t if(options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode)) {\n\t // Stack mode: accumulate (default)\n\t // If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line\n\t // We want backwards compatibility, so the expected fallback without the 'stackMode' option\n\t // to be the original behaviour (accumulate)\n\t positions[labelAxis.counterUnits.pos + '1'] = previousStack;\n\t positions[labelAxis.counterUnits.pos + '2'] = stackedBarValues[valueIndex];\n\t } else {\n\t // Draw from the zero line normally\n\t // This is also the same code for Stack mode: overlap\n\t positions[labelAxis.counterUnits.pos + '1'] = zeroPoint;\n\t positions[labelAxis.counterUnits.pos + '2'] = projected[labelAxis.counterUnits.pos];\n\t }\n\t\n\t // Limit x and y so that they are within the chart rect\n\t positions.x1 = Math.min(Math.max(positions.x1, chartRect.x1), chartRect.x2);\n\t positions.x2 = Math.min(Math.max(positions.x2, chartRect.x1), chartRect.x2);\n\t positions.y1 = Math.min(Math.max(positions.y1, chartRect.y2), chartRect.y1);\n\t positions.y2 = Math.min(Math.max(positions.y2, chartRect.y2), chartRect.y1);\n\t\n\t // Create bar element\n\t bar = seriesElement.elem('line', positions, options.classNames.bar).attr({\n\t 'ct:value': [value.x, value.y].filter(Chartist.isNum).join(','),\n\t 'ct:meta': Chartist.getMetaData(series, valueIndex)\n\t });\n\t\n\t this.eventEmitter.emit('draw', Chartist.extend({\n\t type: 'bar',\n\t value: value,\n\t index: valueIndex,\n\t meta: Chartist.getMetaData(series, valueIndex),\n\t series: series,\n\t seriesIndex: seriesIndex,\n\t axisX: axisX,\n\t axisY: axisY,\n\t chartRect: chartRect,\n\t group: seriesElement,\n\t element: bar\n\t }, positions));\n\t }.bind(this));\n\t }.bind(this));\n\t\n\t this.eventEmitter.emit('created', {\n\t bounds: valueAxis.bounds,\n\t chartRect: chartRect,\n\t axisX: axisX,\n\t axisY: axisY,\n\t svg: this.svg,\n\t options: options\n\t });\n\t }",
"function verticalGridlines() {\n return d3.axisBottom(lineChart.xAxis)\n .ticks(lineChart.years.length)\n}",
"function createChart(options) {\n var data;\n var highLow;\n\n if (options.distributeSeries) {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n data.normalized.series = data.normalized.series.map(function (value) {\n return [value];\n });\n } else {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n }\n\n // Create new svg element\n this.svg = Chartist.createSvg(\n this.container,\n options.width,\n options.height,\n options.classNames.chart + (options.horizontalBars ? ' ' + options.classNames.horizontalBars : '')\n );\n\n // Drawing groups in correct order\n var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n var seriesGroup = this.svg.elem('g');\n var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\n if (options.stackBars && data.normalized.series.length !== 0) {\n\n // If stacked bars we need to calculate the high low from stacked values from each series\n var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {\n return Array.prototype.slice.call(arguments).map(function (value) {\n return value;\n }).reduce(function (prev, curr) {\n return {\n x: prev.x + (curr && curr.x) || 0,\n y: prev.y + (curr && curr.y) || 0\n };\n }, {x: 0, y: 0});\n });\n\n highLow = Chartist.getHighLow([serialSums], options, options.horizontalBars ? 'x' : 'y');\n\n } else {\n\n highLow = Chartist.getHighLow(data.normalized.series, options, options.horizontalBars ? 'x' : 'y');\n }\n\n // Overrides of high / low from settings\n highLow.high = +options.high || (options.high === 0 ? 0 : highLow.high);\n highLow.low = +options.low || (options.low === 0 ? 0 : highLow.low);\n\n var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n\n var valueAxis,\n labelAxisTicks,\n labelAxis,\n axisX,\n axisY;\n\n // We need to set step count based on some options combinations\n if (options.distributeSeries && options.stackBars) {\n // If distributed series are enabled and bars need to be stacked, we'll only have one bar and therefore should\n // use only the first label for the step axis\n labelAxisTicks = data.normalized.labels.slice(0, 1);\n } else {\n // If distributed series are enabled but stacked bars aren't, we should use the series labels\n // If we are drawing a regular bar chart with two dimensional series data, we just use the labels array\n // as the bars are normalized\n labelAxisTicks = data.normalized.labels;\n }\n\n // Set labelAxis and valueAxis based on the horizontalBars setting. This setting will flip the axes if necessary.\n if (options.horizontalBars) {\n if (options.axisX.type === undefined) {\n valueAxis = axisX = new Chartist.AutoScaleAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n\n if (options.axisY.type === undefined) {\n labelAxis = axisY = new Chartist.StepAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, options.axisY);\n }\n } else {\n if (options.axisX.type === undefined) {\n labelAxis = axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, options.axisX);\n }\n\n if (options.axisY.type === undefined) {\n valueAxis = axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n }\n\n // Projected 0 point\n var zeroPoint = options.horizontalBars ? (chartRect.x1 + valueAxis.projectValue(0)) : (chartRect.y1 - valueAxis.projectValue(0));\n // Used to track the screen coordinates of stacked bars\n var stackedBarValues = [];\n\n labelAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n valueAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\n if (options.showGridBackground) {\n Chartist.createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);\n }\n\n // Draw the series\n data.raw.series.forEach(function (series, seriesIndex) {\n // Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\n var biPol = seriesIndex - (data.raw.series.length - 1) / 2;\n // Half of the period width between vertical grid lines used to position bars\n var periodHalfLength;\n // Current series SVG element\n var seriesElement;\n\n // We need to set periodHalfLength based on some options combinations\n if (options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we need to use the length of the normaizedData array\n // which is the series count and divide by 2\n periodHalfLength = labelAxis.axisLength / data.normalized.series.length / 2;\n } else if (options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled we'll only get one bar so we should just divide the axis\n // length by 2\n periodHalfLength = labelAxis.axisLength / 2;\n } else {\n // On regular bar charts we should just use the series length\n periodHalfLength = labelAxis.axisLength / data.normalized.series[seriesIndex].length / 2;\n }\n\n // Adding the series group to the series element\n seriesElement = seriesGroup.elem('g');\n\n // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n seriesElement.attr({\n 'ct:series-name': series.name,\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // Use series class from series data or if not set generate one\n seriesElement.addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))\n ].join(' '));\n\n data.normalized.series[seriesIndex].forEach(function (value, valueIndex) {\n var projected,\n bar,\n previousStack,\n labelAxisValueIndex;\n\n // We need to set labelAxisValueIndex based on some options combinations\n if (options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we can use the seriesIndex for later projection\n // on the step axis for label positioning\n labelAxisValueIndex = seriesIndex;\n } else if (options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled, we will only get one bar and therefore always use\n // 0 for projection on the label step axis\n labelAxisValueIndex = 0;\n } else {\n // On regular bar charts we just use the value index to project on the label step axis\n labelAxisValueIndex = valueIndex;\n }\n\n // We need to transform coordinates differently based on the chart layout\n if (options.horizontalBars) {\n projected = {\n x: chartRect.x1 + valueAxis.projectValue(value && value.x ? value.x : 0, valueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - labelAxis.projectValue(value && value.y ? value.y : 0, labelAxisValueIndex, data.normalized.series[seriesIndex])\n };\n } else {\n projected = {\n x: chartRect.x1 + labelAxis.projectValue(value && value.x ? value.x : 0, labelAxisValueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - valueAxis.projectValue(value && value.y ? value.y : 0, valueIndex, data.normalized.series[seriesIndex])\n }\n }\n\n // If the label axis is a step based axis we will offset the bar into the middle of between two steps using\n // the periodHalfLength value. Also we do arrange the different series so that they align up to each other using\n // the seriesBarDistance. If we don't have a step axis, the bar positions can be chosen freely so we should not\n // add any automated positioning.\n if (labelAxis instanceof Chartist.StepAxis) {\n // Offset to center bar between grid lines, but only if the step axis is not stretched\n if (!labelAxis.options.stretch) {\n projected[labelAxis.units.pos] += periodHalfLength * (options.horizontalBars ? -1 : 1);\n }\n // Using bi-polar offset for multiple series if no stacked bars or series distribution is used\n projected[labelAxis.units.pos] += (options.stackBars || options.distributeSeries) ? 0 : biPol * options.seriesBarDistance * (options.horizontalBars ? -1 : 1);\n }\n\n // Enter value in stacked bar values used to remember previous screen value for stacking up bars\n previousStack = stackedBarValues[valueIndex] || zeroPoint;\n stackedBarValues[valueIndex] = previousStack - (zeroPoint - projected[labelAxis.counterUnits.pos]);\n\n // Skip if value is undefined\n if (value === undefined) {\n return;\n }\n\n var positions = {};\n positions[labelAxis.units.pos + '1'] = projected[labelAxis.units.pos];\n positions[labelAxis.units.pos + '2'] = projected[labelAxis.units.pos];\n\n if (options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode)) {\n // Stack mode: accumulate (default)\n // If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line\n // We want backwards compatibility, so the expected fallback without the 'stackMode' option\n // to be the original behaviour (accumulate)\n positions[labelAxis.counterUnits.pos + '1'] = previousStack;\n positions[labelAxis.counterUnits.pos + '2'] = stackedBarValues[valueIndex];\n } else {\n // Draw from the zero line normally\n // This is also the same code for Stack mode: overlap\n positions[labelAxis.counterUnits.pos + '1'] = zeroPoint;\n positions[labelAxis.counterUnits.pos + '2'] = projected[labelAxis.counterUnits.pos];\n }\n\n // Limit x and y so that they are within the chart rect\n positions.x1 = Math.min(Math.max(positions.x1, chartRect.x1), chartRect.x2);\n positions.x2 = Math.min(Math.max(positions.x2, chartRect.x1), chartRect.x2);\n positions.y1 = Math.min(Math.max(positions.y1, chartRect.y2), chartRect.y1);\n positions.y2 = Math.min(Math.max(positions.y2, chartRect.y2), chartRect.y1);\n\n var metaData = Chartist.getMetaData(series, valueIndex);\n\n // Create bar element\n bar = seriesElement.elem('line', positions, options.classNames.bar).attr({\n 'ct:value': [value.x, value.y].filter(Chartist.isNumeric).join(','),\n 'ct:meta': Chartist.serialize(metaData)\n });\n\n this.eventEmitter.emit('draw', Chartist.extend({\n type: 'bar',\n value: value,\n index: valueIndex,\n meta: metaData,\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n chartRect: chartRect,\n group: seriesElement,\n element: bar\n }, positions));\n }.bind(this));\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n bounds: valueAxis.bounds,\n chartRect: chartRect,\n axisX: axisX,\n axisY: axisY,\n svg: this.svg,\n options: options\n });\n }",
"function createChart(options) {\n var data;\n var highLow;\n\n if(options.distributeSeries) {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n data.normalized.series = data.normalized.series.map(function(value) {\n return [value];\n });\n } else {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n }\n\n // Create new svg element\n this.svg = Chartist.createSvg(\n this.container,\n options.width,\n options.height,\n options.classNames.chart + (options.horizontalBars ? ' ' + options.classNames.horizontalBars : '')\n );\n\n // Drawing groups in correct order\n var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n var seriesGroup = this.svg.elem('g');\n var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\n if(options.stackBars && data.normalized.series.length !== 0) {\n\n // If stacked bars we need to calculate the high low from stacked values from each series\n var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {\n return Array.prototype.slice.call(arguments).map(function(value) {\n return value;\n }).reduce(function(prev, curr) {\n return {\n x: prev.x + (curr && curr.x) || 0,\n y: prev.y + (curr && curr.y) || 0\n };\n }, {x: 0, y: 0});\n });\n\n highLow = Chartist.getHighLow([serialSums], options, options.horizontalBars ? 'x' : 'y');\n\n } else {\n\n highLow = Chartist.getHighLow(data.normalized.series, options, options.horizontalBars ? 'x' : 'y');\n }\n\n // Overrides of high / low from settings\n highLow.high = +options.high || (options.high === 0 ? 0 : highLow.high);\n highLow.low = +options.low || (options.low === 0 ? 0 : highLow.low);\n\n var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n\n var valueAxis,\n labelAxisTicks,\n labelAxis,\n axisX,\n axisY;\n\n // We need to set step count based on some options combinations\n if(options.distributeSeries && options.stackBars) {\n // If distributed series are enabled and bars need to be stacked, we'll only have one bar and therefore should\n // use only the first label for the step axis\n labelAxisTicks = data.normalized.labels.slice(0, 1);\n } else {\n // If distributed series are enabled but stacked bars aren't, we should use the series labels\n // If we are drawing a regular bar chart with two dimensional series data, we just use the labels array\n // as the bars are normalized\n labelAxisTicks = data.normalized.labels;\n }\n\n // Set labelAxis and valueAxis based on the horizontalBars setting. This setting will flip the axes if necessary.\n if(options.horizontalBars) {\n if(options.axisX.type === undefined) {\n valueAxis = axisX = new Chartist.AutoScaleAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n\n if(options.axisY.type === undefined) {\n labelAxis = axisY = new Chartist.StepAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, options.axisY);\n }\n } else {\n if(options.axisX.type === undefined) {\n labelAxis = axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, options.axisX);\n }\n\n if(options.axisY.type === undefined) {\n valueAxis = axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n }\n\n // Projected 0 point\n var zeroPoint = options.horizontalBars ? (chartRect.x1 + valueAxis.projectValue(0)) : (chartRect.y1 - valueAxis.projectValue(0));\n // Used to track the screen coordinates of stacked bars\n var stackedBarValues = [];\n\n labelAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n valueAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\n if (options.showGridBackground) {\n Chartist.createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);\n }\n\n // Draw the series\n data.raw.series.forEach(function(series, seriesIndex) {\n // Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\n var biPol = seriesIndex - (data.raw.series.length - 1) / 2;\n // Half of the period width between vertical grid lines used to position bars\n var periodHalfLength;\n // Current series SVG element\n var seriesElement;\n\n // We need to set periodHalfLength based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we need to use the length of the normaizedData array\n // which is the series count and divide by 2\n periodHalfLength = labelAxis.axisLength / data.normalized.series.length / 2;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled we'll only get one bar so we should just divide the axis\n // length by 2\n periodHalfLength = labelAxis.axisLength / 2;\n } else {\n // On regular bar charts we should just use the series length\n periodHalfLength = labelAxis.axisLength / data.normalized.series[seriesIndex].length / 2;\n }\n\n // Adding the series group to the series element\n seriesElement = seriesGroup.elem('g');\n\n // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n seriesElement.attr({\n 'ct:series-name': series.name,\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // Use series class from series data or if not set generate one\n seriesElement.addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))\n ].join(' '));\n\n data.normalized.series[seriesIndex].forEach(function(value, valueIndex) {\n var projected,\n bar,\n previousStack,\n labelAxisValueIndex;\n\n // We need to set labelAxisValueIndex based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we can use the seriesIndex for later projection\n // on the step axis for label positioning\n labelAxisValueIndex = seriesIndex;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled, we will only get one bar and therefore always use\n // 0 for projection on the label step axis\n labelAxisValueIndex = 0;\n } else {\n // On regular bar charts we just use the value index to project on the label step axis\n labelAxisValueIndex = valueIndex;\n }\n\n // We need to transform coordinates differently based on the chart layout\n if(options.horizontalBars) {\n projected = {\n x: chartRect.x1 + valueAxis.projectValue(value && value.x ? value.x : 0, valueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - labelAxis.projectValue(value && value.y ? value.y : 0, labelAxisValueIndex, data.normalized.series[seriesIndex])\n };\n } else {\n projected = {\n x: chartRect.x1 + labelAxis.projectValue(value && value.x ? value.x : 0, labelAxisValueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - valueAxis.projectValue(value && value.y ? value.y : 0, valueIndex, data.normalized.series[seriesIndex])\n }\n }\n\n // If the label axis is a step based axis we will offset the bar into the middle of between two steps using\n // the periodHalfLength value. Also we do arrange the different series so that they align up to each other using\n // the seriesBarDistance. If we don't have a step axis, the bar positions can be chosen freely so we should not\n // add any automated positioning.\n if(labelAxis instanceof Chartist.StepAxis) {\n // Offset to center bar between grid lines, but only if the step axis is not stretched\n if(!labelAxis.options.stretch) {\n projected[labelAxis.units.pos] += periodHalfLength * (options.horizontalBars ? -1 : 1);\n }\n // Using bi-polar offset for multiple series if no stacked bars or series distribution is used\n projected[labelAxis.units.pos] += (options.stackBars || options.distributeSeries) ? 0 : biPol * options.seriesBarDistance * (options.horizontalBars ? -1 : 1);\n }\n\n // Enter value in stacked bar values used to remember previous screen value for stacking up bars\n previousStack = stackedBarValues[valueIndex] || zeroPoint;\n stackedBarValues[valueIndex] = previousStack - (zeroPoint - projected[labelAxis.counterUnits.pos]);\n\n // Skip if value is undefined\n if(value === undefined) {\n return;\n }\n\n var positions = {};\n positions[labelAxis.units.pos + '1'] = projected[labelAxis.units.pos];\n positions[labelAxis.units.pos + '2'] = projected[labelAxis.units.pos];\n\n if(options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode)) {\n // Stack mode: accumulate (default)\n // If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line\n // We want backwards compatibility, so the expected fallback without the 'stackMode' option\n // to be the original behaviour (accumulate)\n positions[labelAxis.counterUnits.pos + '1'] = previousStack;\n positions[labelAxis.counterUnits.pos + '2'] = stackedBarValues[valueIndex];\n } else {\n // Draw from the zero line normally\n // This is also the same code for Stack mode: overlap\n positions[labelAxis.counterUnits.pos + '1'] = zeroPoint;\n positions[labelAxis.counterUnits.pos + '2'] = projected[labelAxis.counterUnits.pos];\n }\n\n // Limit x and y so that they are within the chart rect\n positions.x1 = Math.min(Math.max(positions.x1, chartRect.x1), chartRect.x2);\n positions.x2 = Math.min(Math.max(positions.x2, chartRect.x1), chartRect.x2);\n positions.y1 = Math.min(Math.max(positions.y1, chartRect.y2), chartRect.y1);\n positions.y2 = Math.min(Math.max(positions.y2, chartRect.y2), chartRect.y1);\n\n var metaData = Chartist.getMetaData(series, valueIndex);\n\n // Create bar element\n bar = seriesElement.elem('line', positions, options.classNames.bar).attr({\n 'ct:value': [value.x, value.y].filter(Chartist.isNumeric).join(','),\n 'ct:meta': Chartist.serialize(metaData)\n });\n\n this.eventEmitter.emit('draw', Chartist.extend({\n type: 'bar',\n value: value,\n index: valueIndex,\n meta: metaData,\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n chartRect: chartRect,\n group: seriesElement,\n element: bar\n }, positions));\n }.bind(this));\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n bounds: valueAxis.bounds,\n chartRect: chartRect,\n axisX: axisX,\n axisY: axisY,\n svg: this.svg,\n options: options\n });\n }",
"function createChart(options) {\n var data;\n var highLow;\n\n if(options.distributeSeries) {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n data.normalized.series = data.normalized.series.map(function(value) {\n return [value];\n });\n } else {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n }\n\n // Create new svg element\n this.svg = Chartist.createSvg(\n this.container,\n options.width,\n options.height,\n options.classNames.chart + (options.horizontalBars ? ' ' + options.classNames.horizontalBars : '')\n );\n\n // Drawing groups in correct order\n var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n var seriesGroup = this.svg.elem('g');\n var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\n if(options.stackBars && data.normalized.series.length !== 0) {\n\n // If stacked bars we need to calculate the high low from stacked values from each series\n var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {\n return Array.prototype.slice.call(arguments).map(function(value) {\n return value;\n }).reduce(function(prev, curr) {\n return {\n x: prev.x + (curr && curr.x) || 0,\n y: prev.y + (curr && curr.y) || 0\n };\n }, {x: 0, y: 0});\n });\n\n highLow = Chartist.getHighLow([serialSums], options, options.horizontalBars ? 'x' : 'y');\n\n } else {\n\n highLow = Chartist.getHighLow(data.normalized.series, options, options.horizontalBars ? 'x' : 'y');\n }\n\n // Overrides of high / low from settings\n highLow.high = +options.high || (options.high === 0 ? 0 : highLow.high);\n highLow.low = +options.low || (options.low === 0 ? 0 : highLow.low);\n\n var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n\n var valueAxis,\n labelAxisTicks,\n labelAxis,\n axisX,\n axisY;\n\n // We need to set step count based on some options combinations\n if(options.distributeSeries && options.stackBars) {\n // If distributed series are enabled and bars need to be stacked, we'll only have one bar and therefore should\n // use only the first label for the step axis\n labelAxisTicks = data.normalized.labels.slice(0, 1);\n } else {\n // If distributed series are enabled but stacked bars aren't, we should use the series labels\n // If we are drawing a regular bar chart with two dimensional series data, we just use the labels array\n // as the bars are normalized\n labelAxisTicks = data.normalized.labels;\n }\n\n // Set labelAxis and valueAxis based on the horizontalBars setting. This setting will flip the axes if necessary.\n if(options.horizontalBars) {\n if(options.axisX.type === undefined) {\n valueAxis = axisX = new Chartist.AutoScaleAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n\n if(options.axisY.type === undefined) {\n labelAxis = axisY = new Chartist.StepAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, options.axisY);\n }\n } else {\n if(options.axisX.type === undefined) {\n labelAxis = axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, options.axisX);\n }\n\n if(options.axisY.type === undefined) {\n valueAxis = axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n }\n\n // Projected 0 point\n var zeroPoint = options.horizontalBars ? (chartRect.x1 + valueAxis.projectValue(0)) : (chartRect.y1 - valueAxis.projectValue(0));\n // Used to track the screen coordinates of stacked bars\n var stackedBarValues = [];\n\n labelAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n valueAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\n if (options.showGridBackground) {\n Chartist.createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);\n }\n\n // Draw the series\n data.raw.series.forEach(function(series, seriesIndex) {\n // Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\n var biPol = seriesIndex - (data.raw.series.length - 1) / 2;\n // Half of the period width between vertical grid lines used to position bars\n var periodHalfLength;\n // Current series SVG element\n var seriesElement;\n\n // We need to set periodHalfLength based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we need to use the length of the normaizedData array\n // which is the series count and divide by 2\n periodHalfLength = labelAxis.axisLength / data.normalized.series.length / 2;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled we'll only get one bar so we should just divide the axis\n // length by 2\n periodHalfLength = labelAxis.axisLength / 2;\n } else {\n // On regular bar charts we should just use the series length\n periodHalfLength = labelAxis.axisLength / data.normalized.series[seriesIndex].length / 2;\n }\n\n // Adding the series group to the series element\n seriesElement = seriesGroup.elem('g');\n\n // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n seriesElement.attr({\n 'ct:series-name': series.name,\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // Use series class from series data or if not set generate one\n seriesElement.addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))\n ].join(' '));\n\n data.normalized.series[seriesIndex].forEach(function(value, valueIndex) {\n var projected,\n bar,\n previousStack,\n labelAxisValueIndex;\n\n // We need to set labelAxisValueIndex based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we can use the seriesIndex for later projection\n // on the step axis for label positioning\n labelAxisValueIndex = seriesIndex;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled, we will only get one bar and therefore always use\n // 0 for projection on the label step axis\n labelAxisValueIndex = 0;\n } else {\n // On regular bar charts we just use the value index to project on the label step axis\n labelAxisValueIndex = valueIndex;\n }\n\n // We need to transform coordinates differently based on the chart layout\n if(options.horizontalBars) {\n projected = {\n x: chartRect.x1 + valueAxis.projectValue(value && value.x ? value.x : 0, valueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - labelAxis.projectValue(value && value.y ? value.y : 0, labelAxisValueIndex, data.normalized.series[seriesIndex])\n };\n } else {\n projected = {\n x: chartRect.x1 + labelAxis.projectValue(value && value.x ? value.x : 0, labelAxisValueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - valueAxis.projectValue(value && value.y ? value.y : 0, valueIndex, data.normalized.series[seriesIndex])\n }\n }\n\n // If the label axis is a step based axis we will offset the bar into the middle of between two steps using\n // the periodHalfLength value. Also we do arrange the different series so that they align up to each other using\n // the seriesBarDistance. If we don't have a step axis, the bar positions can be chosen freely so we should not\n // add any automated positioning.\n if(labelAxis instanceof Chartist.StepAxis) {\n // Offset to center bar between grid lines, but only if the step axis is not stretched\n if(!labelAxis.options.stretch) {\n projected[labelAxis.units.pos] += periodHalfLength * (options.horizontalBars ? -1 : 1);\n }\n // Using bi-polar offset for multiple series if no stacked bars or series distribution is used\n projected[labelAxis.units.pos] += (options.stackBars || options.distributeSeries) ? 0 : biPol * options.seriesBarDistance * (options.horizontalBars ? -1 : 1);\n }\n\n // Enter value in stacked bar values used to remember previous screen value for stacking up bars\n previousStack = stackedBarValues[valueIndex] || zeroPoint;\n stackedBarValues[valueIndex] = previousStack - (zeroPoint - projected[labelAxis.counterUnits.pos]);\n\n // Skip if value is undefined\n if(value === undefined) {\n return;\n }\n\n var positions = {};\n positions[labelAxis.units.pos + '1'] = projected[labelAxis.units.pos];\n positions[labelAxis.units.pos + '2'] = projected[labelAxis.units.pos];\n\n if(options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode)) {\n // Stack mode: accumulate (default)\n // If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line\n // We want backwards compatibility, so the expected fallback without the 'stackMode' option\n // to be the original behaviour (accumulate)\n positions[labelAxis.counterUnits.pos + '1'] = previousStack;\n positions[labelAxis.counterUnits.pos + '2'] = stackedBarValues[valueIndex];\n } else {\n // Draw from the zero line normally\n // This is also the same code for Stack mode: overlap\n positions[labelAxis.counterUnits.pos + '1'] = zeroPoint;\n positions[labelAxis.counterUnits.pos + '2'] = projected[labelAxis.counterUnits.pos];\n }\n\n // Limit x and y so that they are within the chart rect\n positions.x1 = Math.min(Math.max(positions.x1, chartRect.x1), chartRect.x2);\n positions.x2 = Math.min(Math.max(positions.x2, chartRect.x1), chartRect.x2);\n positions.y1 = Math.min(Math.max(positions.y1, chartRect.y2), chartRect.y1);\n positions.y2 = Math.min(Math.max(positions.y2, chartRect.y2), chartRect.y1);\n\n var metaData = Chartist.getMetaData(series, valueIndex);\n\n // Create bar element\n bar = seriesElement.elem('line', positions, options.classNames.bar).attr({\n 'ct:value': [value.x, value.y].filter(Chartist.isNumeric).join(','),\n 'ct:meta': Chartist.serialize(metaData)\n });\n\n this.eventEmitter.emit('draw', Chartist.extend({\n type: 'bar',\n value: value,\n index: valueIndex,\n meta: metaData,\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n chartRect: chartRect,\n group: seriesElement,\n element: bar\n }, positions));\n }.bind(this));\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n bounds: valueAxis.bounds,\n chartRect: chartRect,\n axisX: axisX,\n axisY: axisY,\n svg: this.svg,\n options: options\n });\n }",
"function createChart(options) {\n var data;\n var highLow;\n\n if(options.distributeSeries) {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n data.normalized.series = data.normalized.series.map(function(value) {\n return [value];\n });\n } else {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n }\n\n // Create new svg element\n this.svg = Chartist.createSvg(\n this.container,\n options.width,\n options.height,\n options.classNames.chart + (options.horizontalBars ? ' ' + options.classNames.horizontalBars : '')\n );\n\n // Drawing groups in correct order\n var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n var seriesGroup = this.svg.elem('g');\n var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\n if(options.stackBars && data.normalized.series.length !== 0) {\n\n // If stacked bars we need to calculate the high low from stacked values from each series\n var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {\n return Array.prototype.slice.call(arguments).map(function(value) {\n return value;\n }).reduce(function(prev, curr) {\n return {\n x: prev.x + (curr && curr.x) || 0,\n y: prev.y + (curr && curr.y) || 0\n };\n }, {x: 0, y: 0});\n });\n\n highLow = Chartist.getHighLow([serialSums], options, options.horizontalBars ? 'x' : 'y');\n\n } else {\n\n highLow = Chartist.getHighLow(data.normalized.series, options, options.horizontalBars ? 'x' : 'y');\n }\n\n // Overrides of high / low from settings\n highLow.high = +options.high || (options.high === 0 ? 0 : highLow.high);\n highLow.low = +options.low || (options.low === 0 ? 0 : highLow.low);\n\n var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n\n var valueAxis,\n labelAxisTicks,\n labelAxis,\n axisX,\n axisY;\n\n // We need to set step count based on some options combinations\n if(options.distributeSeries && options.stackBars) {\n // If distributed series are enabled and bars need to be stacked, we'll only have one bar and therefore should\n // use only the first label for the step axis\n labelAxisTicks = data.normalized.labels.slice(0, 1);\n } else {\n // If distributed series are enabled but stacked bars aren't, we should use the series labels\n // If we are drawing a regular bar chart with two dimensional series data, we just use the labels array\n // as the bars are normalized\n labelAxisTicks = data.normalized.labels;\n }\n\n // Set labelAxis and valueAxis based on the horizontalBars setting. This setting will flip the axes if necessary.\n if(options.horizontalBars) {\n if(options.axisX.type === undefined) {\n valueAxis = axisX = new Chartist.AutoScaleAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n\n if(options.axisY.type === undefined) {\n labelAxis = axisY = new Chartist.StepAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, options.axisY);\n }\n } else {\n if(options.axisX.type === undefined) {\n labelAxis = axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, options.axisX);\n }\n\n if(options.axisY.type === undefined) {\n valueAxis = axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n }\n\n // Projected 0 point\n var zeroPoint = options.horizontalBars ? (chartRect.x1 + valueAxis.projectValue(0)) : (chartRect.y1 - valueAxis.projectValue(0));\n // Used to track the screen coordinates of stacked bars\n var stackedBarValues = [];\n\n labelAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n valueAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\n if (options.showGridBackground) {\n Chartist.createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);\n }\n\n // Draw the series\n data.raw.series.forEach(function(series, seriesIndex) {\n // Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\n var biPol = seriesIndex - (data.raw.series.length - 1) / 2;\n // Half of the period width between vertical grid lines used to position bars\n var periodHalfLength;\n // Current series SVG element\n var seriesElement;\n\n // We need to set periodHalfLength based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we need to use the length of the normaizedData array\n // which is the series count and divide by 2\n periodHalfLength = labelAxis.axisLength / data.normalized.series.length / 2;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled we'll only get one bar so we should just divide the axis\n // length by 2\n periodHalfLength = labelAxis.axisLength / 2;\n } else {\n // On regular bar charts we should just use the series length\n periodHalfLength = labelAxis.axisLength / data.normalized.series[seriesIndex].length / 2;\n }\n\n // Adding the series group to the series element\n seriesElement = seriesGroup.elem('g');\n\n // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n seriesElement.attr({\n 'ct:series-name': series.name,\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // Use series class from series data or if not set generate one\n seriesElement.addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))\n ].join(' '));\n\n data.normalized.series[seriesIndex].forEach(function(value, valueIndex) {\n var projected,\n bar,\n previousStack,\n labelAxisValueIndex;\n\n // We need to set labelAxisValueIndex based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we can use the seriesIndex for later projection\n // on the step axis for label positioning\n labelAxisValueIndex = seriesIndex;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled, we will only get one bar and therefore always use\n // 0 for projection on the label step axis\n labelAxisValueIndex = 0;\n } else {\n // On regular bar charts we just use the value index to project on the label step axis\n labelAxisValueIndex = valueIndex;\n }\n\n // We need to transform coordinates differently based on the chart layout\n if(options.horizontalBars) {\n projected = {\n x: chartRect.x1 + valueAxis.projectValue(value && value.x ? value.x : 0, valueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - labelAxis.projectValue(value && value.y ? value.y : 0, labelAxisValueIndex, data.normalized.series[seriesIndex])\n };\n } else {\n projected = {\n x: chartRect.x1 + labelAxis.projectValue(value && value.x ? value.x : 0, labelAxisValueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - valueAxis.projectValue(value && value.y ? value.y : 0, valueIndex, data.normalized.series[seriesIndex])\n }\n }\n\n // If the label axis is a step based axis we will offset the bar into the middle of between two steps using\n // the periodHalfLength value. Also we do arrange the different series so that they align up to each other using\n // the seriesBarDistance. If we don't have a step axis, the bar positions can be chosen freely so we should not\n // add any automated positioning.\n if(labelAxis instanceof Chartist.StepAxis) {\n // Offset to center bar between grid lines, but only if the step axis is not stretched\n if(!labelAxis.options.stretch) {\n projected[labelAxis.units.pos] += periodHalfLength * (options.horizontalBars ? -1 : 1);\n }\n // Using bi-polar offset for multiple series if no stacked bars or series distribution is used\n projected[labelAxis.units.pos] += (options.stackBars || options.distributeSeries) ? 0 : biPol * options.seriesBarDistance * (options.horizontalBars ? -1 : 1);\n }\n\n // Enter value in stacked bar values used to remember previous screen value for stacking up bars\n previousStack = stackedBarValues[valueIndex] || zeroPoint;\n stackedBarValues[valueIndex] = previousStack - (zeroPoint - projected[labelAxis.counterUnits.pos]);\n\n // Skip if value is undefined\n if(value === undefined) {\n return;\n }\n\n var positions = {};\n positions[labelAxis.units.pos + '1'] = projected[labelAxis.units.pos];\n positions[labelAxis.units.pos + '2'] = projected[labelAxis.units.pos];\n\n if(options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode)) {\n // Stack mode: accumulate (default)\n // If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line\n // We want backwards compatibility, so the expected fallback without the 'stackMode' option\n // to be the original behaviour (accumulate)\n positions[labelAxis.counterUnits.pos + '1'] = previousStack;\n positions[labelAxis.counterUnits.pos + '2'] = stackedBarValues[valueIndex];\n } else {\n // Draw from the zero line normally\n // This is also the same code for Stack mode: overlap\n positions[labelAxis.counterUnits.pos + '1'] = zeroPoint;\n positions[labelAxis.counterUnits.pos + '2'] = projected[labelAxis.counterUnits.pos];\n }\n\n // Limit x and y so that they are within the chart rect\n positions.x1 = Math.min(Math.max(positions.x1, chartRect.x1), chartRect.x2);\n positions.x2 = Math.min(Math.max(positions.x2, chartRect.x1), chartRect.x2);\n positions.y1 = Math.min(Math.max(positions.y1, chartRect.y2), chartRect.y1);\n positions.y2 = Math.min(Math.max(positions.y2, chartRect.y2), chartRect.y1);\n\n var metaData = Chartist.getMetaData(series, valueIndex);\n\n // Create bar element\n bar = seriesElement.elem('line', positions, options.classNames.bar).attr({\n 'ct:value': [value.x, value.y].filter(Chartist.isNumeric).join(','),\n 'ct:meta': Chartist.serialize(metaData)\n });\n\n this.eventEmitter.emit('draw', Chartist.extend({\n type: 'bar',\n value: value,\n index: valueIndex,\n meta: metaData,\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n chartRect: chartRect,\n group: seriesElement,\n element: bar\n }, positions));\n }.bind(this));\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n bounds: valueAxis.bounds,\n chartRect: chartRect,\n axisX: axisX,\n axisY: axisY,\n svg: this.svg,\n options: options\n });\n }",
"function createChart(options) {\n var data;\n var highLow;\n\n if(options.distributeSeries) {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n data.normalized.series = data.normalized.series.map(function(value) {\n return [value];\n });\n } else {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n }\n\n // Create new svg element\n this.svg = Chartist.createSvg(\n this.container,\n options.width,\n options.height,\n options.classNames.chart + (options.horizontalBars ? ' ' + options.classNames.horizontalBars : '')\n );\n\n // Drawing groups in correct order\n var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n var seriesGroup = this.svg.elem('g');\n var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\n if(options.stackBars && data.normalized.series.length !== 0) {\n\n // If stacked bars we need to calculate the high low from stacked values from each series\n var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {\n return Array.prototype.slice.call(arguments).map(function(value) {\n return value;\n }).reduce(function(prev, curr) {\n return {\n x: prev.x + (curr && curr.x) || 0,\n y: prev.y + (curr && curr.y) || 0\n };\n }, {x: 0, y: 0});\n });\n\n highLow = Chartist.getHighLow([serialSums], options, options.horizontalBars ? 'x' : 'y');\n\n } else {\n\n highLow = Chartist.getHighLow(data.normalized.series, options, options.horizontalBars ? 'x' : 'y');\n }\n\n // Overrides of high / low from settings\n highLow.high = +options.high || (options.high === 0 ? 0 : highLow.high);\n highLow.low = +options.low || (options.low === 0 ? 0 : highLow.low);\n\n var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n\n var valueAxis,\n labelAxisTicks,\n labelAxis,\n axisX,\n axisY;\n\n // We need to set step count based on some options combinations\n if(options.distributeSeries && options.stackBars) {\n // If distributed series are enabled and bars need to be stacked, we'll only have one bar and therefore should\n // use only the first label for the step axis\n labelAxisTicks = data.normalized.labels.slice(0, 1);\n } else {\n // If distributed series are enabled but stacked bars aren't, we should use the series labels\n // If we are drawing a regular bar chart with two dimensional series data, we just use the labels array\n // as the bars are normalized\n labelAxisTicks = data.normalized.labels;\n }\n\n // Set labelAxis and valueAxis based on the horizontalBars setting. This setting will flip the axes if necessary.\n if(options.horizontalBars) {\n if(options.axisX.type === undefined) {\n valueAxis = axisX = new Chartist.AutoScaleAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n\n if(options.axisY.type === undefined) {\n labelAxis = axisY = new Chartist.StepAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, options.axisY);\n }\n } else {\n if(options.axisX.type === undefined) {\n labelAxis = axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, options.axisX);\n }\n\n if(options.axisY.type === undefined) {\n valueAxis = axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n }\n\n // Projected 0 point\n var zeroPoint = options.horizontalBars ? (chartRect.x1 + valueAxis.projectValue(0)) : (chartRect.y1 - valueAxis.projectValue(0));\n // Used to track the screen coordinates of stacked bars\n var stackedBarValues = [];\n\n labelAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n valueAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\n if (options.showGridBackground) {\n Chartist.createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);\n }\n\n // Draw the series\n data.raw.series.forEach(function(series, seriesIndex) {\n // Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\n var biPol = seriesIndex - (data.raw.series.length - 1) / 2;\n // Half of the period width between vertical grid lines used to position bars\n var periodHalfLength;\n // Current series SVG element\n var seriesElement;\n\n // We need to set periodHalfLength based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we need to use the length of the normaizedData array\n // which is the series count and divide by 2\n periodHalfLength = labelAxis.axisLength / data.normalized.series.length / 2;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled we'll only get one bar so we should just divide the axis\n // length by 2\n periodHalfLength = labelAxis.axisLength / 2;\n } else {\n // On regular bar charts we should just use the series length\n periodHalfLength = labelAxis.axisLength / data.normalized.series[seriesIndex].length / 2;\n }\n\n // Adding the series group to the series element\n seriesElement = seriesGroup.elem('g');\n\n // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n seriesElement.attr({\n 'ct:series-name': series.name,\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // Use series class from series data or if not set generate one\n seriesElement.addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))\n ].join(' '));\n\n data.normalized.series[seriesIndex].forEach(function(value, valueIndex) {\n var projected,\n bar,\n previousStack,\n labelAxisValueIndex;\n\n // We need to set labelAxisValueIndex based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we can use the seriesIndex for later projection\n // on the step axis for label positioning\n labelAxisValueIndex = seriesIndex;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled, we will only get one bar and therefore always use\n // 0 for projection on the label step axis\n labelAxisValueIndex = 0;\n } else {\n // On regular bar charts we just use the value index to project on the label step axis\n labelAxisValueIndex = valueIndex;\n }\n\n // We need to transform coordinates differently based on the chart layout\n if(options.horizontalBars) {\n projected = {\n x: chartRect.x1 + valueAxis.projectValue(value && value.x ? value.x : 0, valueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - labelAxis.projectValue(value && value.y ? value.y : 0, labelAxisValueIndex, data.normalized.series[seriesIndex])\n };\n } else {\n projected = {\n x: chartRect.x1 + labelAxis.projectValue(value && value.x ? value.x : 0, labelAxisValueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - valueAxis.projectValue(value && value.y ? value.y : 0, valueIndex, data.normalized.series[seriesIndex])\n }\n }\n\n // If the label axis is a step based axis we will offset the bar into the middle of between two steps using\n // the periodHalfLength value. Also we do arrange the different series so that they align up to each other using\n // the seriesBarDistance. If we don't have a step axis, the bar positions can be chosen freely so we should not\n // add any automated positioning.\n if(labelAxis instanceof Chartist.StepAxis) {\n // Offset to center bar between grid lines, but only if the step axis is not stretched\n if(!labelAxis.options.stretch) {\n projected[labelAxis.units.pos] += periodHalfLength * (options.horizontalBars ? -1 : 1);\n }\n // Using bi-polar offset for multiple series if no stacked bars or series distribution is used\n projected[labelAxis.units.pos] += (options.stackBars || options.distributeSeries) ? 0 : biPol * options.seriesBarDistance * (options.horizontalBars ? -1 : 1);\n }\n\n // Enter value in stacked bar values used to remember previous screen value for stacking up bars\n previousStack = stackedBarValues[valueIndex] || zeroPoint;\n stackedBarValues[valueIndex] = previousStack - (zeroPoint - projected[labelAxis.counterUnits.pos]);\n\n // Skip if value is undefined\n if(value === undefined) {\n return;\n }\n\n var positions = {};\n positions[labelAxis.units.pos + '1'] = projected[labelAxis.units.pos];\n positions[labelAxis.units.pos + '2'] = projected[labelAxis.units.pos];\n\n if(options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode)) {\n // Stack mode: accumulate (default)\n // If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line\n // We want backwards compatibility, so the expected fallback without the 'stackMode' option\n // to be the original behaviour (accumulate)\n positions[labelAxis.counterUnits.pos + '1'] = previousStack;\n positions[labelAxis.counterUnits.pos + '2'] = stackedBarValues[valueIndex];\n } else {\n // Draw from the zero line normally\n // This is also the same code for Stack mode: overlap\n positions[labelAxis.counterUnits.pos + '1'] = zeroPoint;\n positions[labelAxis.counterUnits.pos + '2'] = projected[labelAxis.counterUnits.pos];\n }\n\n // Limit x and y so that they are within the chart rect\n positions.x1 = Math.min(Math.max(positions.x1, chartRect.x1), chartRect.x2);\n positions.x2 = Math.min(Math.max(positions.x2, chartRect.x1), chartRect.x2);\n positions.y1 = Math.min(Math.max(positions.y1, chartRect.y2), chartRect.y1);\n positions.y2 = Math.min(Math.max(positions.y2, chartRect.y2), chartRect.y1);\n\n var metaData = Chartist.getMetaData(series, valueIndex);\n\n // Create bar element\n bar = seriesElement.elem('line', positions, options.classNames.bar).attr({\n 'ct:value': [value.x, value.y].filter(Chartist.isNumeric).join(','),\n 'ct:meta': Chartist.serialize(metaData)\n });\n\n this.eventEmitter.emit('draw', Chartist.extend({\n type: 'bar',\n value: value,\n index: valueIndex,\n meta: metaData,\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n chartRect: chartRect,\n group: seriesElement,\n element: bar\n }, positions));\n }.bind(this));\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n bounds: valueAxis.bounds,\n chartRect: chartRect,\n axisX: axisX,\n axisY: axisY,\n svg: this.svg,\n options: options\n });\n }",
"function createChart(options) {\n var data;\n var highLow;\n\n if(options.distributeSeries) {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n data.normalized.series = data.normalized.series.map(function(value) {\n return [value];\n });\n } else {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n }\n\n // Create new svg element\n this.svg = Chartist.createSvg(\n this.container,\n options.width,\n options.height,\n options.classNames.chart + (options.horizontalBars ? ' ' + options.classNames.horizontalBars : '')\n );\n\n // Drawing groups in correct order\n var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n var seriesGroup = this.svg.elem('g');\n var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\n if(options.stackBars && data.normalized.series.length !== 0) {\n\n // If stacked bars we need to calculate the high low from stacked values from each series\n var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {\n return Array.prototype.slice.call(arguments).map(function(value) {\n return value;\n }).reduce(function(prev, curr) {\n return {\n x: prev.x + (curr && curr.x) || 0,\n y: prev.y + (curr && curr.y) || 0\n };\n }, {x: 0, y: 0});\n });\n\n highLow = Chartist.getHighLow([serialSums], options, options.horizontalBars ? 'x' : 'y');\n\n } else {\n\n highLow = Chartist.getHighLow(data.normalized.series, options, options.horizontalBars ? 'x' : 'y');\n }\n\n // Overrides of high / low from settings\n highLow.high = +options.high || (options.high === 0 ? 0 : highLow.high);\n highLow.low = +options.low || (options.low === 0 ? 0 : highLow.low);\n\n var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n\n var valueAxis,\n labelAxisTicks,\n labelAxis,\n axisX,\n axisY;\n\n // We need to set step count based on some options combinations\n if(options.distributeSeries && options.stackBars) {\n // If distributed series are enabled and bars need to be stacked, we'll only have one bar and therefore should\n // use only the first label for the step axis\n labelAxisTicks = data.normalized.labels.slice(0, 1);\n } else {\n // If distributed series are enabled but stacked bars aren't, we should use the series labels\n // If we are drawing a regular bar chart with two dimensional series data, we just use the labels array\n // as the bars are normalized\n labelAxisTicks = data.normalized.labels;\n }\n\n // Set labelAxis and valueAxis based on the horizontalBars setting. This setting will flip the axes if necessary.\n if(options.horizontalBars) {\n if(options.axisX.type === undefined) {\n valueAxis = axisX = new Chartist.AutoScaleAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n\n if(options.axisY.type === undefined) {\n labelAxis = axisY = new Chartist.StepAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, options.axisY);\n }\n } else {\n if(options.axisX.type === undefined) {\n labelAxis = axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, options.axisX);\n }\n\n if(options.axisY.type === undefined) {\n valueAxis = axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n }\n\n // Projected 0 point\n var zeroPoint = options.horizontalBars ? (chartRect.x1 + valueAxis.projectValue(0)) : (chartRect.y1 - valueAxis.projectValue(0));\n // Used to track the screen coordinates of stacked bars\n var stackedBarValues = [];\n\n labelAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n valueAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\n if (options.showGridBackground) {\n Chartist.createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);\n }\n\n // Draw the series\n data.raw.series.forEach(function(series, seriesIndex) {\n // Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\n var biPol = seriesIndex - (data.raw.series.length - 1) / 2;\n // Half of the period width between vertical grid lines used to position bars\n var periodHalfLength;\n // Current series SVG element\n var seriesElement;\n\n // We need to set periodHalfLength based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we need to use the length of the normaizedData array\n // which is the series count and divide by 2\n periodHalfLength = labelAxis.axisLength / data.normalized.series.length / 2;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled we'll only get one bar so we should just divide the axis\n // length by 2\n periodHalfLength = labelAxis.axisLength / 2;\n } else {\n // On regular bar charts we should just use the series length\n periodHalfLength = labelAxis.axisLength / data.normalized.series[seriesIndex].length / 2;\n }\n\n // Adding the series group to the series element\n seriesElement = seriesGroup.elem('g');\n\n // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n seriesElement.attr({\n 'ct:series-name': series.name,\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // Use series class from series data or if not set generate one\n seriesElement.addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))\n ].join(' '));\n\n data.normalized.series[seriesIndex].forEach(function(value, valueIndex) {\n var projected,\n bar,\n previousStack,\n labelAxisValueIndex;\n\n // We need to set labelAxisValueIndex based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we can use the seriesIndex for later projection\n // on the step axis for label positioning\n labelAxisValueIndex = seriesIndex;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled, we will only get one bar and therefore always use\n // 0 for projection on the label step axis\n labelAxisValueIndex = 0;\n } else {\n // On regular bar charts we just use the value index to project on the label step axis\n labelAxisValueIndex = valueIndex;\n }\n\n // We need to transform coordinates differently based on the chart layout\n if(options.horizontalBars) {\n projected = {\n x: chartRect.x1 + valueAxis.projectValue(value && value.x ? value.x : 0, valueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - labelAxis.projectValue(value && value.y ? value.y : 0, labelAxisValueIndex, data.normalized.series[seriesIndex])\n };\n } else {\n projected = {\n x: chartRect.x1 + labelAxis.projectValue(value && value.x ? value.x : 0, labelAxisValueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - valueAxis.projectValue(value && value.y ? value.y : 0, valueIndex, data.normalized.series[seriesIndex])\n }\n }\n\n // If the label axis is a step based axis we will offset the bar into the middle of between two steps using\n // the periodHalfLength value. Also we do arrange the different series so that they align up to each other using\n // the seriesBarDistance. If we don't have a step axis, the bar positions can be chosen freely so we should not\n // add any automated positioning.\n if(labelAxis instanceof Chartist.StepAxis) {\n // Offset to center bar between grid lines, but only if the step axis is not stretched\n if(!labelAxis.options.stretch) {\n projected[labelAxis.units.pos] += periodHalfLength * (options.horizontalBars ? -1 : 1);\n }\n // Using bi-polar offset for multiple series if no stacked bars or series distribution is used\n projected[labelAxis.units.pos] += (options.stackBars || options.distributeSeries) ? 0 : biPol * options.seriesBarDistance * (options.horizontalBars ? -1 : 1);\n }\n\n // Enter value in stacked bar values used to remember previous screen value for stacking up bars\n previousStack = stackedBarValues[valueIndex] || zeroPoint;\n stackedBarValues[valueIndex] = previousStack - (zeroPoint - projected[labelAxis.counterUnits.pos]);\n\n // Skip if value is undefined\n if(value === undefined) {\n return;\n }\n\n var positions = {};\n positions[labelAxis.units.pos + '1'] = projected[labelAxis.units.pos];\n positions[labelAxis.units.pos + '2'] = projected[labelAxis.units.pos];\n\n if(options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode)) {\n // Stack mode: accumulate (default)\n // If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line\n // We want backwards compatibility, so the expected fallback without the 'stackMode' option\n // to be the original behaviour (accumulate)\n positions[labelAxis.counterUnits.pos + '1'] = previousStack;\n positions[labelAxis.counterUnits.pos + '2'] = stackedBarValues[valueIndex];\n } else {\n // Draw from the zero line normally\n // This is also the same code for Stack mode: overlap\n positions[labelAxis.counterUnits.pos + '1'] = zeroPoint;\n positions[labelAxis.counterUnits.pos + '2'] = projected[labelAxis.counterUnits.pos];\n }\n\n // Limit x and y so that they are within the chart rect\n positions.x1 = Math.min(Math.max(positions.x1, chartRect.x1), chartRect.x2);\n positions.x2 = Math.min(Math.max(positions.x2, chartRect.x1), chartRect.x2);\n positions.y1 = Math.min(Math.max(positions.y1, chartRect.y2), chartRect.y1);\n positions.y2 = Math.min(Math.max(positions.y2, chartRect.y2), chartRect.y1);\n\n var metaData = Chartist.getMetaData(series, valueIndex);\n\n // Create bar element\n bar = seriesElement.elem('line', positions, options.classNames.bar).attr({\n 'ct:value': [value.x, value.y].filter(Chartist.isNumeric).join(','),\n 'ct:meta': Chartist.serialize(metaData)\n });\n\n this.eventEmitter.emit('draw', Chartist.extend({\n type: 'bar',\n value: value,\n index: valueIndex,\n meta: metaData,\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n chartRect: chartRect,\n group: seriesElement,\n element: bar\n }, positions));\n }.bind(this));\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n bounds: valueAxis.bounds,\n chartRect: chartRect,\n axisX: axisX,\n axisY: axisY,\n svg: this.svg,\n options: options\n });\n }",
"function createChart(options) {\n var data;\n var highLow;\n\n if(options.distributeSeries) {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n data.normalized.series = data.normalized.series.map(function(value) {\n return [value];\n });\n } else {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n }\n\n // Create new svg element\n this.svg = Chartist.createSvg(\n this.container,\n options.width,\n options.height,\n options.classNames.chart + (options.horizontalBars ? ' ' + options.classNames.horizontalBars : '')\n );\n\n // Drawing groups in correct order\n var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n var seriesGroup = this.svg.elem('g');\n var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\n if(options.stackBars && data.normalized.series.length !== 0) {\n\n // If stacked bars we need to calculate the high low from stacked values from each series\n var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {\n return Array.prototype.slice.call(arguments).map(function(value) {\n return value;\n }).reduce(function(prev, curr) {\n return {\n x: prev.x + (curr && curr.x) || 0,\n y: prev.y + (curr && curr.y) || 0\n };\n }, {x: 0, y: 0});\n });\n\n highLow = Chartist.getHighLow([serialSums], options, options.horizontalBars ? 'x' : 'y');\n\n } else {\n\n highLow = Chartist.getHighLow(data.normalized.series, options, options.horizontalBars ? 'x' : 'y');\n }\n\n // Overrides of high / low from settings\n highLow.high = +options.high || (options.high === 0 ? 0 : highLow.high);\n highLow.low = +options.low || (options.low === 0 ? 0 : highLow.low);\n\n var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n\n var valueAxis,\n labelAxisTicks,\n labelAxis,\n axisX,\n axisY;\n\n // We need to set step count based on some options combinations\n if(options.distributeSeries && options.stackBars) {\n // If distributed series are enabled and bars need to be stacked, we'll only have one bar and therefore should\n // use only the first label for the step axis\n labelAxisTicks = data.normalized.labels.slice(0, 1);\n } else {\n // If distributed series are enabled but stacked bars aren't, we should use the series labels\n // If we are drawing a regular bar chart with two dimensional series data, we just use the labels array\n // as the bars are normalized\n labelAxisTicks = data.normalized.labels;\n }\n\n // Set labelAxis and valueAxis based on the horizontalBars setting. This setting will flip the axes if necessary.\n if(options.horizontalBars) {\n if(options.axisX.type === undefined) {\n valueAxis = axisX = new Chartist.AutoScaleAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n\n if(options.axisY.type === undefined) {\n labelAxis = axisY = new Chartist.StepAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, options.axisY);\n }\n } else {\n if(options.axisX.type === undefined) {\n labelAxis = axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, options.axisX);\n }\n\n if(options.axisY.type === undefined) {\n valueAxis = axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n }\n\n // Projected 0 point\n var zeroPoint = options.horizontalBars ? (chartRect.x1 + valueAxis.projectValue(0)) : (chartRect.y1 - valueAxis.projectValue(0));\n // Used to track the screen coordinates of stacked bars\n var stackedBarValues = [];\n\n labelAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n valueAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\n if (options.showGridBackground) {\n Chartist.createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);\n }\n\n // Draw the series\n data.raw.series.forEach(function(series, seriesIndex) {\n // Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\n var biPol = seriesIndex - (data.raw.series.length - 1) / 2;\n // Half of the period width between vertical grid lines used to position bars\n var periodHalfLength;\n // Current series SVG element\n var seriesElement;\n\n // We need to set periodHalfLength based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we need to use the length of the normaizedData array\n // which is the series count and divide by 2\n periodHalfLength = labelAxis.axisLength / data.normalized.series.length / 2;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled we'll only get one bar so we should just divide the axis\n // length by 2\n periodHalfLength = labelAxis.axisLength / 2;\n } else {\n // On regular bar charts we should just use the series length\n periodHalfLength = labelAxis.axisLength / data.normalized.series[seriesIndex].length / 2;\n }\n\n // Adding the series group to the series element\n seriesElement = seriesGroup.elem('g');\n\n // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n seriesElement.attr({\n 'ct:series-name': series.name,\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // Use series class from series data or if not set generate one\n seriesElement.addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))\n ].join(' '));\n\n data.normalized.series[seriesIndex].forEach(function(value, valueIndex) {\n var projected,\n bar,\n previousStack,\n labelAxisValueIndex;\n\n // We need to set labelAxisValueIndex based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we can use the seriesIndex for later projection\n // on the step axis for label positioning\n labelAxisValueIndex = seriesIndex;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled, we will only get one bar and therefore always use\n // 0 for projection on the label step axis\n labelAxisValueIndex = 0;\n } else {\n // On regular bar charts we just use the value index to project on the label step axis\n labelAxisValueIndex = valueIndex;\n }\n\n // We need to transform coordinates differently based on the chart layout\n if(options.horizontalBars) {\n projected = {\n x: chartRect.x1 + valueAxis.projectValue(value && value.x ? value.x : 0, valueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - labelAxis.projectValue(value && value.y ? value.y : 0, labelAxisValueIndex, data.normalized.series[seriesIndex])\n };\n } else {\n projected = {\n x: chartRect.x1 + labelAxis.projectValue(value && value.x ? value.x : 0, labelAxisValueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - valueAxis.projectValue(value && value.y ? value.y : 0, valueIndex, data.normalized.series[seriesIndex])\n }\n }\n\n // If the label axis is a step based axis we will offset the bar into the middle of between two steps using\n // the periodHalfLength value. Also we do arrange the different series so that they align up to each other using\n // the seriesBarDistance. If we don't have a step axis, the bar positions can be chosen freely so we should not\n // add any automated positioning.\n if(labelAxis instanceof Chartist.StepAxis) {\n // Offset to center bar between grid lines, but only if the step axis is not stretched\n if(!labelAxis.options.stretch) {\n projected[labelAxis.units.pos] += periodHalfLength * (options.horizontalBars ? -1 : 1);\n }\n // Using bi-polar offset for multiple series if no stacked bars or series distribution is used\n projected[labelAxis.units.pos] += (options.stackBars || options.distributeSeries) ? 0 : biPol * options.seriesBarDistance * (options.horizontalBars ? -1 : 1);\n }\n\n // Enter value in stacked bar values used to remember previous screen value for stacking up bars\n previousStack = stackedBarValues[valueIndex] || zeroPoint;\n stackedBarValues[valueIndex] = previousStack - (zeroPoint - projected[labelAxis.counterUnits.pos]);\n\n // Skip if value is undefined\n if(value === undefined) {\n return;\n }\n\n var positions = {};\n positions[labelAxis.units.pos + '1'] = projected[labelAxis.units.pos];\n positions[labelAxis.units.pos + '2'] = projected[labelAxis.units.pos];\n\n if(options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode)) {\n // Stack mode: accumulate (default)\n // If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line\n // We want backwards compatibility, so the expected fallback without the 'stackMode' option\n // to be the original behaviour (accumulate)\n positions[labelAxis.counterUnits.pos + '1'] = previousStack;\n positions[labelAxis.counterUnits.pos + '2'] = stackedBarValues[valueIndex];\n } else {\n // Draw from the zero line normally\n // This is also the same code for Stack mode: overlap\n positions[labelAxis.counterUnits.pos + '1'] = zeroPoint;\n positions[labelAxis.counterUnits.pos + '2'] = projected[labelAxis.counterUnits.pos];\n }\n\n // Limit x and y so that they are within the chart rect\n positions.x1 = Math.min(Math.max(positions.x1, chartRect.x1), chartRect.x2);\n positions.x2 = Math.min(Math.max(positions.x2, chartRect.x1), chartRect.x2);\n positions.y1 = Math.min(Math.max(positions.y1, chartRect.y2), chartRect.y1);\n positions.y2 = Math.min(Math.max(positions.y2, chartRect.y2), chartRect.y1);\n\n var metaData = Chartist.getMetaData(series, valueIndex);\n\n // Create bar element\n bar = seriesElement.elem('line', positions, options.classNames.bar).attr({\n 'ct:value': [value.x, value.y].filter(Chartist.isNumeric).join(','),\n 'ct:meta': Chartist.serialize(metaData)\n });\n\n this.eventEmitter.emit('draw', Chartist.extend({\n type: 'bar',\n value: value,\n index: valueIndex,\n meta: metaData,\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n chartRect: chartRect,\n group: seriesElement,\n element: bar\n }, positions));\n }.bind(this));\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n bounds: valueAxis.bounds,\n chartRect: chartRect,\n axisX: axisX,\n axisY: axisY,\n svg: this.svg,\n options: options\n });\n }",
"function componentBarsHorizontal () {\n\n /* Default Properties */\n var width = 400;\n var height = 500;\n var transition = { ease: d3.easeBounce, duration: 500 };\n var colors = palette.categorical(3);\n var dispatch = d3.dispatch(\"customValueMouseOver\", \"customValueMouseOut\", \"customValueClick\", \"customSeriesMouseOver\", \"customSeriesMouseOut\", \"customSeriesClick\");\n var xScale = void 0;\n var yScale = void 0;\n var colorScale = void 0;\n var classed = \"barsHorizontal\";\n\n /**\n * Initialise Data and Scales\n *\n * @private\n * @param {Array} data - Chart data.\n */\n function init(data) {\n var _dataTransform$summar = dataTransform(data).summary(),\n columnKeys = _dataTransform$summar.columnKeys,\n valueMax = _dataTransform$summar.valueMax;\n\n var valueExtent = [0, valueMax];\n\n if (typeof colorScale === \"undefined\") {\n colorScale = d3.scaleOrdinal().domain(columnKeys).range(colors);\n }\n\n if (typeof xScale === \"undefined\") {\n xScale = d3.scaleLinear().domain(valueExtent).range([0, height]).nice();\n }\n\n if (typeof yScale === \"undefined\") {\n yScale = d3.scaleBand().domain(columnKeys).rangeRound([0, width]).padding(0.15);\n }\n }\n\n /**\n * Constructor\n *\n * @constructor\n * @alias barsHorizontal\n * @param {d3.selection} selection - The chart holder D3 selection.\n */\n function my(selection) {\n init(selection.data());\n selection.each(function () {\n\n // Update series group\n var seriesGroup = d3.select(this);\n seriesGroup.classed(classed, true).attr(\"id\", function (d) {\n return d.key;\n }).on(\"mouseover\", function (d) {\n dispatch.call(\"customSeriesMouseOver\", this, d);\n }).on(\"click\", function (d) {\n dispatch.call(\"customSeriesClick\", this, d);\n });\n\n // Add bars to series\n var bars = seriesGroup.selectAll(\".bar\").data(function (d) {\n return d.values;\n });\n\n bars.enter().append(\"rect\").classed(\"bar\", true).attr(\"fill\", function (d) {\n return colorScale(d.key);\n }).attr(\"width\", yScale.bandwidth()).attr(\"y\", function (d) {\n return yScale(d.key);\n }).attr(\"height\", yScale.bandwidth()).on(\"mouseover\", function (d) {\n dispatch.call(\"customValueMouseOver\", this, d);\n }).on(\"click\", function (d) {\n dispatch.call(\"customValueClick\", this, d);\n }).merge(bars).transition().ease(transition.ease).duration(transition.duration).attr(\"x\", 0).attr(\"width\", function (d) {\n return xScale(d.value);\n });\n\n bars.exit().transition().style(\"opacity\", 0).remove();\n });\n }\n\n /**\n * Width Getter / Setter\n *\n * @param {number} _v - Width in px.\n * @returns {*}\n */\n my.width = function (_v) {\n if (!arguments.length) return width;\n width = _v;\n return this;\n };\n\n /**\n * Height Getter / Setter\n *\n * @param {number} _v - Height in px.\n * @returns {*}\n */\n my.height = function (_v) {\n if (!arguments.length) return height;\n height = _v;\n return this;\n };\n\n /**\n * Color Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 color scale.\n * @returns {*}\n */\n my.colorScale = function (_v) {\n if (!arguments.length) return colorScale;\n colorScale = _v;\n return my;\n };\n\n /**\n * Colors Getter / Setter\n *\n * @param {Array} _v - Array of colours used by color scale.\n * @returns {*}\n */\n my.colors = function (_v) {\n if (!arguments.length) return colors;\n colors = _v;\n return my;\n };\n\n /**\n * X Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 scale.\n * @returns {*}\n */\n my.xScale = function (_v) {\n if (!arguments.length) return xScale;\n xScale = _v;\n return my;\n };\n\n /**\n * Y Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 scale.\n * @returns {*}\n */\n my.yScale = function (_v) {\n if (!arguments.length) return yScale;\n yScale = _v;\n return my;\n };\n\n /**\n * Dispatch Getter / Setter\n *\n * @param {d3.dispatch} _v - Dispatch event handler.\n * @returns {*}\n */\n my.dispatch = function (_v) {\n if (!arguments.length) return dispatch();\n dispatch = _v;\n return this;\n };\n\n /**\n * Dispatch On Getter\n *\n * @returns {*}\n */\n my.on = function () {\n var value = dispatch.on.apply(dispatch, arguments);\n return value === dispatch ? my : value;\n };\n\n return my;\n }",
"function horizontalAxis(x, y) {\n newPath(); // Nueva ruta de gráficos\n arrow(x - 20, y, x + 240, y); // Dibuja el eje horizontal\n var t0 = Math.ceil(tU); // hora del primer tick (s)\n var x0 = x + pixT * (t0 - tU); // posición del primer tic \n for (var i = 0; i <= 10; i++) { // para todos los ticks ... \n var xT = x0 + i * pixT; // Coordenada horizontal de la marca\n line(xT, y - 3, xT, y + 3); // dibujar tick\n if (xT >= x + 5 && xT <= x + 215 // Si la marca no está demasiado a la izquierda o a la derecha ...\n &&\n (t0 + i <= 100 || (t0 + i) % 2 == 0)) // ... y espacio para etiquetado disponible ...\n alignText(\"\" + (t0 + i), 1, xT, y + 13); // ... hacer etiquetado\n }\n alignText(symbolTime, 1, DX + 230, DY + 18); // inscripción (t)\n alignText(text16, 1, DX + 230, DY + 30); // especificación de la (s) unidad (es)\n}",
"function createAndDisplayXAxis(data) {\n\n\t// Get oldest date (that is, date of first tweet in the data)\n\tvar oldestDate = new Date(data[data.length - 1].CurrentTweetDate);\n\t// Get newest date (that is, date of latest tweet in the data)\n\tvar newestDate = new Date(data[0].CurrentTweetDate);\n\t// Add 2 weeks at beginning and end of axis for prettier display\n\toldestDate.setDate(oldestDate.getDate() - 14); // go back 14 days\n\tnewestDate.setDate(newestDate.getDate() + 14); // go forward 14 days\n\n\t// Set x-scale domain from newest and oldest date\n\txScale.domain([oldestDate, newestDate]);\n}",
"function displayAxisTitles (options) {\n var xTitle = $(\"<h3></h3\").attr( {\"id\": \"xtitle\",\n \"class\": \"axistitle\"});\n xTitle.text(options.xaxistitle);\n var yTitle = $(\"<h3></h3\").attr( {\"id\": \"ytitle\",\n \"class\": \"axistitle\"});\n yTitle.text(options.yaxistitle);\n $(\"#chartarea\").append(xTitle,yTitle);\n\n $(\"#xtitle\").css({\n \"align-self\": \"center\",\n \"margin\": \"2px\",\n \"padding\": \"5px\",\n \"position\": \"absolute\",\n \"top\": \"105%\",\n \"font-size\": \"medium\"\n });\n\n$(\"#ytitle\").css( {\n \"left\": \"-20%\",\n \"margin\": \"2px\",\n \"padding\": \"2px\",\n \"position\": \"absolute\",\n \"top\":\"50%\",\n \"transform\": \"rotate(-90deg)\",\n \"font-size\": \"medium\"\n });\n\n}",
"function createChart(options){var data;var highLow;if(options.distributeSeries){data=Chartist.normalizeData(this.data,options.reverseData,options.horizontalBars?'x':'y');data.normalized.series=data.normalized.series.map(function(value){return [value];});}else {data=Chartist.normalizeData(this.data,options.reverseData,options.horizontalBars?'x':'y');}// Create new svg element\nthis.svg=Chartist.createSvg(this.container,options.width,options.height,options.classNames.chart+(options.horizontalBars?' '+options.classNames.horizontalBars:''));// Drawing groups in correct order\nvar gridGroup=this.svg.elem('g').addClass(options.classNames.gridGroup);var seriesGroup=this.svg.elem('g');var labelGroup=this.svg.elem('g').addClass(options.classNames.labelGroup);if(options.stackBars&&data.normalized.series.length!==0){// If stacked bars we need to calculate the high low from stacked values from each series\nvar serialSums=Chartist.serialMap(data.normalized.series,function serialSums(){return Array.prototype.slice.call(arguments).map(function(value){return value;}).reduce(function(prev,curr){return {x:prev.x+(curr&&curr.x)||0,y:prev.y+(curr&&curr.y)||0};},{x:0,y:0});});highLow=Chartist.getHighLow([serialSums],options,options.horizontalBars?'x':'y');}else {highLow=Chartist.getHighLow(data.normalized.series,options,options.horizontalBars?'x':'y');}// Overrides of high / low from settings\nhighLow.high=+options.high||(options.high===0?0:highLow.high);highLow.low=+options.low||(options.low===0?0:highLow.low);var chartRect=Chartist.createChartRect(this.svg,options,defaultOptions.padding);var valueAxis,labelAxisTicks,labelAxis,axisX,axisY;// We need to set step count based on some options combinations\nif(options.distributeSeries&&options.stackBars){// If distributed series are enabled and bars need to be stacked, we'll only have one bar and therefore should\n// use only the first label for the step axis\nlabelAxisTicks=data.normalized.labels.slice(0,1);}else {// If distributed series are enabled but stacked bars aren't, we should use the series labels\n// If we are drawing a regular bar chart with two dimensional series data, we just use the labels array\n// as the bars are normalized\nlabelAxisTicks=data.normalized.labels;}// Set labelAxis and valueAxis based on the horizontalBars setting. This setting will flip the axes if necessary.\nif(options.horizontalBars){if(options.axisX.type===undefined){valueAxis=axisX=new Chartist.AutoScaleAxis(Chartist.Axis.units.x,data.normalized.series,chartRect,Chartist.extend({},options.axisX,{highLow:highLow,referenceValue:0}));}else {valueAxis=axisX=options.axisX.type.call(Chartist,Chartist.Axis.units.x,data.normalized.series,chartRect,Chartist.extend({},options.axisX,{highLow:highLow,referenceValue:0}));}if(options.axisY.type===undefined){labelAxis=axisY=new Chartist.StepAxis(Chartist.Axis.units.y,data.normalized.series,chartRect,{ticks:labelAxisTicks});}else {labelAxis=axisY=options.axisY.type.call(Chartist,Chartist.Axis.units.y,data.normalized.series,chartRect,options.axisY);}}else {if(options.axisX.type===undefined){labelAxis=axisX=new Chartist.StepAxis(Chartist.Axis.units.x,data.normalized.series,chartRect,{ticks:labelAxisTicks});}else {labelAxis=axisX=options.axisX.type.call(Chartist,Chartist.Axis.units.x,data.normalized.series,chartRect,options.axisX);}if(options.axisY.type===undefined){valueAxis=axisY=new Chartist.AutoScaleAxis(Chartist.Axis.units.y,data.normalized.series,chartRect,Chartist.extend({},options.axisY,{highLow:highLow,referenceValue:0}));}else {valueAxis=axisY=options.axisY.type.call(Chartist,Chartist.Axis.units.y,data.normalized.series,chartRect,Chartist.extend({},options.axisY,{highLow:highLow,referenceValue:0}));}}// Projected 0 point\nvar zeroPoint=options.horizontalBars?chartRect.x1+valueAxis.projectValue(0):chartRect.y1-valueAxis.projectValue(0);// Used to track the screen coordinates of stacked bars\nvar stackedBarValues=[];labelAxis.createGridAndLabels(gridGroup,labelGroup,this.supportsForeignObject,options,this.eventEmitter);valueAxis.createGridAndLabels(gridGroup,labelGroup,this.supportsForeignObject,options,this.eventEmitter);if(options.showGridBackground){Chartist.createGridBackground(gridGroup,chartRect,options.classNames.gridBackground,this.eventEmitter);}// Draw the series\ndata.raw.series.forEach(function(series,seriesIndex){// Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\nvar biPol=seriesIndex-(data.raw.series.length-1)/2;// Half of the period width between vertical grid lines used to position bars\nvar periodHalfLength;// Current series SVG element\nvar seriesElement;// We need to set periodHalfLength based on some options combinations\nif(options.distributeSeries&&!options.stackBars){// If distributed series are enabled but stacked bars aren't, we need to use the length of the normaizedData array\n// which is the series count and divide by 2\nperiodHalfLength=labelAxis.axisLength/data.normalized.series.length/2;}else if(options.distributeSeries&&options.stackBars){// If distributed series and stacked bars are enabled we'll only get one bar so we should just divide the axis\n// length by 2\nperiodHalfLength=labelAxis.axisLength/2;}else {// On regular bar charts we should just use the series length\nperiodHalfLength=labelAxis.axisLength/data.normalized.series[seriesIndex].length/2;}// Adding the series group to the series element\nseriesElement=seriesGroup.elem('g');// Write attributes to series group element. If series name or meta is undefined the attributes will not be written\nseriesElement.attr({'ct:series-name':series.name,'ct:meta':Chartist.serialize(series.meta)});// Use series class from series data or if not set generate one\nseriesElement.addClass([options.classNames.series,series.className||options.classNames.series+'-'+Chartist.alphaNumerate(seriesIndex)].join(' '));data.normalized.series[seriesIndex].forEach(function(value,valueIndex){var projected,bar,previousStack,labelAxisValueIndex;// We need to set labelAxisValueIndex based on some options combinations\nif(options.distributeSeries&&!options.stackBars){// If distributed series are enabled but stacked bars aren't, we can use the seriesIndex for later projection\n// on the step axis for label positioning\nlabelAxisValueIndex=seriesIndex;}else if(options.distributeSeries&&options.stackBars){// If distributed series and stacked bars are enabled, we will only get one bar and therefore always use\n// 0 for projection on the label step axis\nlabelAxisValueIndex=0;}else {// On regular bar charts we just use the value index to project on the label step axis\nlabelAxisValueIndex=valueIndex;}// We need to transform coordinates differently based on the chart layout\nif(options.horizontalBars){projected={x:chartRect.x1+valueAxis.projectValue(value&&value.x?value.x:0,valueIndex,data.normalized.series[seriesIndex]),y:chartRect.y1-labelAxis.projectValue(value&&value.y?value.y:0,labelAxisValueIndex,data.normalized.series[seriesIndex])};}else {projected={x:chartRect.x1+labelAxis.projectValue(value&&value.x?value.x:0,labelAxisValueIndex,data.normalized.series[seriesIndex]),y:chartRect.y1-valueAxis.projectValue(value&&value.y?value.y:0,valueIndex,data.normalized.series[seriesIndex])};}// If the label axis is a step based axis we will offset the bar into the middle of between two steps using\n// the periodHalfLength value. Also we do arrange the different series so that they align up to each other using\n// the seriesBarDistance. If we don't have a step axis, the bar positions can be chosen freely so we should not\n// add any automated positioning.\nif(labelAxis instanceof Chartist.StepAxis){// Offset to center bar between grid lines, but only if the step axis is not stretched\nif(!labelAxis.options.stretch){projected[labelAxis.units.pos]+=periodHalfLength*(options.horizontalBars?-1:1);}// Using bi-polar offset for multiple series if no stacked bars or series distribution is used\nprojected[labelAxis.units.pos]+=options.stackBars||options.distributeSeries?0:biPol*options.seriesBarDistance*(options.horizontalBars?-1:1);}// Enter value in stacked bar values used to remember previous screen value for stacking up bars\npreviousStack=stackedBarValues[valueIndex]||zeroPoint;stackedBarValues[valueIndex]=previousStack-(zeroPoint-projected[labelAxis.counterUnits.pos]);// Skip if value is undefined\nif(value===undefined){return;}var positions={};positions[labelAxis.units.pos+'1']=projected[labelAxis.units.pos];positions[labelAxis.units.pos+'2']=projected[labelAxis.units.pos];if(options.stackBars&&(options.stackMode==='accumulate'||!options.stackMode)){// Stack mode: accumulate (default)\n// If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line\n// We want backwards compatibility, so the expected fallback without the 'stackMode' option\n// to be the original behaviour (accumulate)\npositions[labelAxis.counterUnits.pos+'1']=previousStack;positions[labelAxis.counterUnits.pos+'2']=stackedBarValues[valueIndex];}else {// Draw from the zero line normally\n// This is also the same code for Stack mode: overlap\npositions[labelAxis.counterUnits.pos+'1']=zeroPoint;positions[labelAxis.counterUnits.pos+'2']=projected[labelAxis.counterUnits.pos];}// Limit x and y so that they are within the chart rect\npositions.x1=Math.min(Math.max(positions.x1,chartRect.x1),chartRect.x2);positions.x2=Math.min(Math.max(positions.x2,chartRect.x1),chartRect.x2);positions.y1=Math.min(Math.max(positions.y1,chartRect.y2),chartRect.y1);positions.y2=Math.min(Math.max(positions.y2,chartRect.y2),chartRect.y1);var metaData=Chartist.getMetaData(series,valueIndex);// Create bar element\nbar=seriesElement.elem('line',positions,options.classNames.bar).attr({'ct:value':[value.x,value.y].filter(Chartist.isNumeric).join(','),'ct:meta':Chartist.serialize(metaData)});this.eventEmitter.emit('draw',Chartist.extend({type:'bar',value:value,index:valueIndex,meta:metaData,series:series,seriesIndex:seriesIndex,axisX:axisX,axisY:axisY,chartRect:chartRect,group:seriesElement,element:bar},positions));}.bind(this));}.bind(this));this.eventEmitter.emit('created',{bounds:valueAxis.bounds,chartRect:chartRect,axisX:axisX,axisY:axisY,svg:this.svg,options:options});}",
"function SVGRowChart() {\r\n }",
"function createChart(h){\n\tvar chart = d3.select(\"#d3chart\")\n\t .attr(\"width\", barWidth+2*x)\n\t .attr(\"height\", barHeight+2*x);\n\t\n\tchart.append(\"rect\")\n\t .attr(\"id\", 'emptyRect')\n\t .attr(\"width\", barWidth+2*x)\n\t .attr(\"height\", barHeight+2*x)\n\t .attr(\"stroke-width\",2*x)\n\t .attr(\"stroke\",\"rgb(12, 244, 75)\");\n\n\tchart.append(\"rect\")\n\t .attr(\"id\",'fullRect')\n\t .attr(\"width\", barWidth)\n\t .attr(\"height\",0);\t\n}",
"function drawVerticalLable(svg, data) {\n\t\tvar categoryLineCount = data.length / months.length; // should be an integer\n\t\tvar categoryData = [];\n\t\tfor(var i = 0 ;i < categoryLineCount; i++) {\n\t\t categoryData.push(0); \n\t\t // it doesn't matter what the data really is, just alternate between 'kwh' and 'therm'\n\t\t}\n\t\tvar categoryLabel = svg.selectAll('.dayLabel')\n\t\t .data(categoryData)\n\t\t .enter()\n\t\t .append('text')\n\t\t .text(function(d, i){\n\t\t return i % 2 === 0? 'kwh': 'therm';\n\t\t })\n\t\t .attr('x', 0)\n\t\t .attr('y', function (d, i){\n\t\t return i * boxWidth;\n\t\t })\n\t\t .style('text-anchor', 'end')\n\t\t .attr('transform', 'translate(-6,'+ boxWidth / 1.5 + ')')\n\t\t .attr(\"class\", function (d, i) { return ((i >= 0 && i <= 4) ? \"dayLabel mono axis axis-workweek\" : \"dayLabel mono axis\"); });\n\t}",
"function SVGStackedRowChart() {\r\n }",
"function horizontalChart3() {\n var star = '';\n for (var i = 0; i < arguments.length; i++) {\n for (j = 0; j < arguments[i]; j++) {\n star += \"*\";\n }\n star += '\\n';\n }\n return star;\n}",
"function drawChart() {\n stroke(0);\n yAxis();\n xAxis();\n}",
"function drawVisualization() {\r\n var style = \"bar-color\";//document.getElementById(\"style\").value;\r\n var showPerspective = true;//document.getElementById(\"perspective\").checked;\r\n // var withValue = [\"bar-color\", \"bar-size\", \"dot-size\", \"dot-color\"].indexOf(style) != -1;\r\n\r\n // Create and populate a data table.\r\n data = [];\r\n\r\n var color = 0;\r\n var steps = 3; // number of datapoints will be steps*steps\r\n var axisMax = 8;\r\n var axisStep = axisMax / steps;\r\n for (var x = 0; x <= axisMax; x += axisStep+1) {\r\n for (var y = 0; y <= axisMax; y += axisStep) {\r\n var z = Math.random();\r\n if (true) {\r\n data.push({\r\n x: x,\r\n y: y,\r\n z: z,\r\n style: {\r\n fill: colors[color],\r\n stroke: colors[color+1]\r\n }\r\n });\r\n }\r\n else {\r\n data.push({ x: x, y: y, z: z });\r\n }\r\n }\r\n color+=1;\r\n }\r\n\r\nvar category = [\"A\",\"B\",\"C\",\"D\"];\r\nvar cat_count = 0;\r\n // specify options\r\n var options = {\r\n width:'100%',\r\n style: style,\r\n xBarWidth: 2,\r\n yBarWidth: 2,\r\n showPerspective: showPerspective,\r\n showShadow: false,\r\n keepAspectRatio: true,\r\n verticalRatio: 0.5,\r\n xCenter:'55%',\r\n yStep:2.5,\r\n xStep:3.5,\r\n animationAutoStart:true,\r\n animationPreload:true,\r\n showShadow:true,\r\n \r\n yLabel: \"Categories (of Abuse)\",\r\n xLabel: \"Groups\",\r\n zLabel: \"Reports\",\r\n yValueLabel: function (y) {\r\n if(y == 0){\r\n return \"Category \" + category[y];\r\n }else{\r\n return \"Category \" +category[Math.ceil(y/3)];\r\n }\r\n },\r\n \r\n xValueLabel: function(x) {\r\n if(x == 0){\r\n return \"Group 1\";\r\n }else{\r\n return \"Group \" + (Math.ceil(x/3));\r\n }\r\n },\r\n tooltip: function(data){\r\n var res = \"\";\r\n if(data.x == 0){\r\n res += \"<strong>Group 1</strong>\";\r\n }else{\r\n res += \"<strong>Group</strong> \" + (Math.ceil(data.x/3));\r\n }\r\n\r\n if(data.y == 0){\r\n res+= \"<br><strong>Category</strong> \" + category[data.y];\r\n }else{\r\n res+= \"<br><strong>Category</strong> \" +category[Math.ceil(data.y/3)];\r\n }\r\n\r\n res+= \"<br><strong>Reports</strong> \" + data.z;\r\n return res;\r\n }\r\n };\r\n\r\n\r\n var camera = graph ? graph.getCameraPosition() : null;\r\n\r\n // create our graph\r\n var container = document.getElementById(\"mygraph\");\r\n graph = new vis.Graph3d(container, data, options);\r\n\r\n if (camera) graph.setCameraPosition(camera); // restore camera position\r\n/*\r\n document.getElementById(\"style\").onchange = drawVisualization;\r\n document.getElementById(\"perspective\").onchange = drawVisualization;\r\n document.getElementById(\"xBarWidth\").onchange = drawVisualization;\r\n document.getElementById(\"yBarWidth\").onchange = drawVisualization;*/\r\n}"
] |
[
"0.6576366",
"0.6515155",
"0.6300424",
"0.6260759",
"0.61928976",
"0.6131376",
"0.6125039",
"0.6079667",
"0.6016706",
"0.60162926",
"0.60162246",
"0.6012936",
"0.5994601",
"0.5994601",
"0.5994601",
"0.5994601",
"0.5994601",
"0.5994601",
"0.5935575",
"0.59330875",
"0.5905058",
"0.5902822",
"0.5886017",
"0.5859823",
"0.5854532",
"0.5841205",
"0.5839117",
"0.58383846",
"0.5801132",
"0.57943404"
] |
0.71342796
|
0
|
Renders a thumbnail view of the image.
|
function renderThumbnail(url) {
var canvas = document.querySelector('#thumbnail');
var context = canvas.getContext('2d');
canvas.width = 100;
canvas.height = 100;
var image = new Image();
image.addEventListener('load', function() {
var src_w = image.width;
var src_h = image.height;
var new_w = canvas.width;
var new_h = canvas.height;
var ratio = src_w / src_h;
if (src_w > src_h) {
new_h /= ratio;
} else {
new_w *= ratio;
}
canvas.width = new_w;
canvas.height = new_h;
context.drawImage(image, 0, 0, src_w, src_h, 0, 0, new_w, new_h);
});
image.src = url;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function display() {\n var content = this.getContent();\n var root = Freemix.getTemplate(\"thumbnail-view-template\");\n\n content.empty();\n content.append(root);\n this._setupViewForm();\n this._setupLabelEditor();\n\n var images = Freemix.property.getPropertiesWithType(\"image\");\n\n var image = content.find(\"#image_property\");\n\n // Set up image property selector\n this._setupPropertySelect(image, \"image\", images);\n this._setupTitlePropertyEditor();\n this._setupMultiPropertySortEditor();\n\n image.change();\n }",
"_renderThumbnail($$) {\n let node = this.props.node\n // TODO: Make this work with tables as well\n let contentNode = node.find('graphic')\n let el = $$('div').addClass('se-thumbnail')\n if (contentNode) {\n el.append(\n $$(this.getComponent(contentNode.type), {\n node: contentNode,\n disabled: this.props.disabled\n })\n )\n } else {\n el.append('No thumb')\n }\n return el\n }",
"render() {\n const { source } = this.props;\n\n return (\n <Thumbnail\n large\n source={source}\n />\n );\n }",
"function render(id, title, imgUrl, height, width, prev, next) {\n var imgContainer = \"<div id='\" + id + \"' class='thumb col-md-3' data-title='\" + title + \"' data-previous='\" + prev + \"' data-next='\"+ next + \"' style='background-repeat: no-repeat; position: relative; max-width:\" + width + \"px; width: 100%; height:\" + height + \"px;'><img src='\" + imgUrl + \"'/></div>\";\n document.getElementById(\"container\").innerHTML += imgContainer;\n }",
"_buildImg(thumb, height) {\n var scaleFactor = height / thumb.h\n var $img = $(\"<img />\").addClass(\"thumbnail-img\").attr(\"src\", thumb.url)\n\n // the container will contain the image positioned so that the correct sprite\n // is visible\n var $container = $(\"<div />\").addClass(\"thumbnail-container\")\n $container.css(\"width\", thumb.w * scaleFactor)\n $container.css(\"height\", height)\n $img.css({\n height: thumb.imageH * scaleFactor,\n left: -1 * thumb.x * scaleFactor,\n top: -1 * thumb.y * scaleFactor\n })\n $container.append($img)\n return $container\n }",
"function PostThumbnail(props) {\n return (\n <div className={css.square}>\n <div className={css.content}>\n <img className={css.image} src={publicUrl(props.src)} alt={props.alt}/>\n </div>\n </div>\n );\n}",
"function ThumbnailRenderer() {\n\tbitsyLog(\"NEW THUMB RENDERER\", \"editor\");\n\n\tvar drawingThumbnailCanvas, drawingThumbnailCtx;\n\tdrawingThumbnailCanvas = document.createElement(\"canvas\");\n\tdrawingThumbnailCanvas.width = tilesize * scale; // TODO: scale constants need to be contained somewhere\n\tdrawingThumbnailCanvas.height = tilesize * scale;\n\tdrawingThumbnailCtx = drawingThumbnailCanvas.getContext(\"2d\");\n\n\tvar thumbnailRenderEncoders = {};\n\tvar cache = {};\n\n\tfunction thumbnailGetImage(drawing, frameIndex) {\n\t\tif (drawing.type === TileType.Sprite || drawing.type === TileType.Avatar) {\n\t\t\treturn getSpriteFrame(sprite[drawing.id], frameIndex);\n\t\t}\n\t\telse if(drawing.type === TileType.Item) {\n\t\t\treturn getItemFrame(item[drawing.id], frameIndex);\n\t\t}\n\t\telse if(drawing.type === TileType.Tile) {\n\t\t\treturn getTileFrame(tile[drawing.id], frameIndex);\n\t\t}\n\t\treturn null;\n\t}\n\n\tfunction thumbnailDraw(drawing, context, x, y, frameIndex) {\n\t\tvar renderedImg = renderTileToCanvas(drawing, frameIndex);\n\t\tif (renderedImg) {\n\t\t\tcontext.drawImage(renderedImg, x, y, tilesize * scale, tilesize * scale);\n\t\t}\n\t\telse {\n\t\t\tbitsyLog(\"oh no! image render for thumbnail failed\", \"editor\");\n\t\t}\n\t}\n\n\tfunction render(imgId,drawing,frameIndex,imgElement) {\n\t\tvar isAnimated = (frameIndex === undefined || frameIndex === null) ? true : false;\n\n\t\tvar palId = getRoomPal(state.room); // TODO : should NOT be hardcoded like this\n\n\t\tvar hexPalette = [];\n\t\tvar roomColors = getPal(palId);\n\t\tfor (i in roomColors) {\n\t\t\tvar hexStr = rgbToHex(roomColors[i][0], roomColors[i][1], roomColors[i][2]).slice(1);\n\t\t\thexPalette.push(hexStr);\n\t\t}\n\n\t\t// bitsyLog(id, \"editor\");\n\n\t\tvar drawingFrameData = [];\n\n\t\tif( isAnimated || frameIndex == 0 ) {\n\t\t\tthumbnailDraw(drawing, drawingThumbnailCtx, 0, 0, 0 /*frameIndex*/);\n\t\t\tdrawingFrameData.push( drawingThumbnailCtx.getImageData(0,0,tilesize*scale,tilesize*scale).data );\n\t\t}\n\t\tif( isAnimated || frameIndex == 1 ) {\n\t\t\tthumbnailDraw(drawing, drawingThumbnailCtx, 0, 0, 1 /*frameIndex*/);\n\t\t\tdrawingFrameData.push( drawingThumbnailCtx.getImageData(0,0,tilesize*scale,tilesize*scale).data );\n\t\t}\n\n\t\t// create encoder\n\t\tvar gifData = {\n\t\t\tframes: drawingFrameData,\n\t\t\twidth: tilesize*scale,\n\t\t\theight: tilesize*scale,\n\t\t\tpalette: hexPalette,\n\t\t\tloops: 0,\n\t\t\tdelay: animationTime / 10 // TODO why divide by 10???\n\t\t};\n\t\tvar encoder = new gif();\n\n\t\t// cancel old encoder (if in progress already)\n\t\tif( thumbnailRenderEncoders[imgId] != null )\n\t\t\tthumbnailRenderEncoders[imgId].cancel();\n\t\tthumbnailRenderEncoders[imgId] = encoder;\n\n\t\t// start encoding new GIF\n\t\tif (imgElement === undefined || imgElement === null) {\n\t\t\timgElement = document.getElementById(imgId);\n\t\t}\n\t\tencoder.encode( gifData, createThumbnailRenderCallback(imgElement) );\n\t}\n\tthis.Render = function(imgId,drawing,frameIndex,imgElement) {\n\t\trender(imgId,drawing,frameIndex,imgElement);\n\t};\n\n\tfunction createThumbnailRenderCallback(img) {\n\t\treturn function(uri) {\n\t\t\t// update image\n\t\t\timg.src = uri;\n\t\t\timg.style.background = \"none\";\n\n\t\t\t// update cache\n\t\t\tcache[img.id] = {\n\t\t\t\turi : uri,\n\t\t\t\toutOfDate : false\n\t\t\t};\n\t\t};\n\t}\n\n\tthis.GetCacheEntry = function(imgId) {\n\t\tif (!cache[imgId]) {\n\t\t\tcache[imgId] = {\n\t\t\t\turi : null,\n\t\t\t\toutOfDate : true\n\t\t\t};\n\t\t}\n\t\treturn cache[imgId];\n\t}\n}",
"function setThumbnail(evt) {\n\tconst imgContainer = document.querySelector(\"#image-container\");\n\n\tconst reader = new FileReader();\n\n\treader.addEventListener(\"load\", (evt) => {\n\t\tconst img = document.createElement(\"img\");\n\t\timg.src = evt.target.result;\n\t\timg.classList.add(\"thumbnail\");\n\t\timgContainer.appendChild(img);\n\t});\n\treader.readAsDataURL(evt.target.files[0]);\n}",
"function thumbnailClickHandler(evt) {\n var target = evt.target;\n if (!target || !target.classList.contains('thumbnail'))\n return;\n\n if (currentView === thumbnailListView || currentView === fullscreenView) {\n showFile(parseInt(target.dataset.index));\n }\n else if (currentView === thumbnailSelectView) {\n updateSelection(target);\n }\n else if (currentView === pickView) {\n cropPickedImage(files[parseInt(target.dataset.index)]);\n }\n}",
"function onPhotoURISuccess(imageURI) {\n showThumbnail(imageURI);\n}",
"function displayThumb(result) {\n var htmlStr = \"\";\n for (var i = 0; i < result.length; i++){\n htmlStr += '<figure><a href=\"' + result[i].url + '\"><img src=\"' + result[i].url + '\" alt=\"' + result[i].description + '\" height=\"200\" width=\"200\"></a><figcaption>' + result[i].description + '</figcaption></figure>';\n }\n $(\"#thumbnails\").html(htmlStr);\n $( \"figure\" ).draggable();\n }",
"function ShowThumbnails( fileUrl, data )\n{\n // this = CKFinderAPI\n var sFileName = this.getSelectedFile().name;\n document.getElementById( 'thumbnails' ).innerHTML +=\n '<div class=\"thumb\">' +\n '<img src=\"' + fileUrl + '\" />' +\n '<div class=\"caption\">' +\n '<a href=\"' + data[\"fileUrl\"] + '\" target=\"_blank\">' + sFileName + '</a> (' + data[\"fileSize\"] + 'KB)' +\n '</div>' +\n '</div>';\n\n document.getElementById( 'preview' ).style.display = \"\";\n // It is not required to return any value.\n // When false is returned, CKFinder will not close automatically.\n return false;\n}",
"preview(file) {\n this.thumbTarget.innerHTML = `<span>${file.type}<br>${file.name}</span>`\n const url = URL.createObjectURL(file.data)\n\n if (file.type.includes(\"image\")) {\n this.thumbTarget.innerHTML = `<img src=\"${url}\">`\n } else if (file.type.includes(\"video\")) {\n this.thumbTarget.innerHTML = `<video src=\"${url}\" preload=\"metadata\"></video>`\n } else {\n this.thumbTarget.innerHTML = `<span>${file.type}<br>${file.name}</span>`\n }\n }",
"function thumb_loaded(event) {\n \"use strict\";\n // prepare the output canvas\n var newImg = new Image();\n newImg.src = event.target.src;\n\n aspectRatio = newImg.width / newImg.height;\n output_canvas.height = defaults.output_height;\n output_canvas.width = defaults.output_height * aspectRatio;\n\n // and render\n go();\n}",
"function createDisplayThumbnail(videoSnippet) {\n var titleEl = $('<h3>');\n titleEl.addClass('video-title');\n $(titleEl).html(videoSnippet.title);\n var thumbnailUrl = videoSnippet.thumbnails.medium.url;\n\n var div = $('<div>');\n div.addClass('video-content');\n div.css('backgroundImage', 'url(\"' + thumbnailUrl + '\")');\n div.append(titleEl);\n $('#video-container').append(div);\n}",
"function clickOnThumbnail() {\n\tgetPhotoUrl($(this));\n\t$container.append($photoviewer.append($photoBox).append($caption));\n\t$photoBox.after($leftClick);\n\t$photoBox.before($rightClick);\n\t$(\"html\").css(\"background\",\"gray\");\n\t//All other images are not visible\n\t$(\".thumbnail\").addClass(\"greyed-out\");\n\t$(\".small-img\").hide();\n\t$leftClick.on(\"click\",leftClick);\n\t$rightClick.on(\"click\",rightClick);\n}",
"function updateThumbnail()\n{\n\tvar thumb_dimension = 100;\n\tvar thumbnail_style = $('#thumbnail');\n\tupdateSelection();\n\t//should be the same\n\tvar X_scale = thumb_dimension/selection.origWidth;\n\tvar Y_scale = thumb_dimension/selection.origHeight;\n\tthumbnail_style.css('width', imgObj.width*X_scale);\n\tthumbnail_style.css('height', imgObj.height*Y_scale);\n\tthumbnail_style.css('left', -selection.origX*X_scale);\n\tthumbnail_style.css('top', -selection.origY*Y_scale);\n}",
"function displayImage(domAAroundImgThumb)\n{\n if (domAAroundImgThumb.attr('href'))\n {\n var newSrc = domAAroundImgThumb.attr('href').replace('thickbox','large');\n if ($('#bigpic').attr('src') != newSrc)\n\t\t{ \n $('#bigpic').fadeIn('fast', function(){\n $(this).attr('src', newSrc).show();\n if (typeof(jqZoomEnabled) != 'undefined' && jqZoomEnabled)\n\t $(this).attr('alt', domAAroundImgThumb.attr('href'));\n });\n }\n $('#views_block li a').removeClass('shown');\n $(domAAroundImgThumb).addClass('shown');\n }\n}",
"function zoto_modal_album_template_thumb_view(options) {\n\toptions = merge({\n\t\t'big_item_class': zoto_modal_album_template_thumb,\n\t\t'view_mode': \"big\",\n\t\t'max_items': 50,\n\t\t'glob': new zoto_glob({}),\n\t\t'edit_mode': true,\n\t\t'select_mode': \"single\"\n\t\t}, options);\n\tthis.$uber(options);\n\tthis.switch_view('big');\n\tthis.update_edit_mode(false);\n\tthis.view_options = [];\n}",
"function renderImage(file){\n var reader = new FileReader();\n reader.onload = function(event){\n the_url = event.target.result\n //of course using a template library like handlebars.js is a better solution than just inserting a string\n preview = document.getElementById(\"blog_body_preview\")\n var oImg=document.createElement(\"img\");\n oImg.setAttribute('src', the_url);\n oImg.setAttribute('height', '300px');\n oImg.setAttribute('width', '450px');\n preview.appendChild(oImg);\n }\n \n //when the file is read it triggers the onload event above.\n reader.readAsDataURL(file);\n }",
"function thumbnail(object) {\nreturn $(\"<div>\")\n .addClass(\"thumb\")\n .css(\"background-image\", \"url(\" + object.webImage.url.replace(\"s0\", \"s128\") +\")\");\n}",
"function previewImage(file) {\n \t\tvar galleryId = \"gallery\";\n\n \t\tvar gallery = document.getElementById(galleryId);\n \t\tvar imageType = /image.*/;\n\n \t\tif (!file.type.match(imageType)) {\n \t\t\tthrow \"File Type must be an image\";\n \t\t}\n\n \t\tvar thumb = document.createElement(\"div\");\n \t\tthumb.classList.add('thumbnail');\n\n \t\tvar img = document.createElement(\"img\");\n \t\timg.file = file;\n \t\tthumb.appendChild(img);\n \t\tgallery.appendChild(thumb);\n\n \t\t// Using FileReader to display the image content\n \t\tvar reader = new FileReader();\n \t\treader.onload = (function(aImg) {\n \t\t\treturn function(e) {\n \t\t\t\taImg.src = e.target.result;\n \t\t\t};\n \t\t})(img);\n \t\treader.readAsDataURL(file);\n \t\t\n\t\tupload(thumb, file);\n \t}",
"function a(e){var t=e.file,n=e.thumbnailMaxWidth,r=e.thumbnailMaxHeight,a=e.enableThumbnails;return t.type&&t.type.startsWith(\"image\")?(t=t instanceof Blob?t:new Blob([t]),new s.default(function(e,n){var r=new Image;r.onload=function(){e(r)},r.onerror=n,r.src=URL.createObjectURL(t)}).then(function(e){var o=(0,c.default)(e,\"height\",\"width\");if(!a)return[null,o,null];var s=i(o,n,r),u=document.createElement(\"canvas\");u.width=s.width,u.height=s.height;var d=u.getContext(\"2d\");(0,l.orient)({orientation:t&&t.image?t.image.orientation:\"\",img:e,x:0,y:0,width:s.width,height:s.height,ctx:d},t);for(var p=u.toDataURL(\"image/png\").split(\",\"),f=atob(p[1]),h=new ArrayBuffer(f.length),m=new DataView(h),v=0;v<f.length;v++)m.setUint8(v,f.charCodeAt(v));return[h,o,s]})):s.default.resolve()}",
"goodPhotoThumbnail(goodId, imageIndex) {\n return `http://${helpers.base}/images/goods/thumbnail/pht_${goodId}_${imageIndex}.jpg`;\n }",
"function buildThumbnailDiv(photo) {\n var APIImgUrl = prepareUrl(photo);\n //Define ltbox elements\n var innerBx = '<div class=\"image-box\">' + '<div class=\"imageholder\"><img src=\"' + APIImgUrl + '\"/>' + '</div></div>';\n var newImgDiv = document.createElement(\"div\");\n newImgDiv.setAttribute(\"class\", \"thumbnail\");\n newImgDiv.setAttribute(\"onClick\", \"displayLtBox(\\'\" + APIImgUrl + \"\\',\\'\" + photo.title + \"\\')\");\n newImgDiv.innerHTML = innerBx;\n return newImgDiv;\n}",
"function thumbnail(id, info)\n{\n // caption, usually contains date\n let cap = document.createElement('span');\n cap.classList.add('cap');\n cap.textContent = info.date;\n\n // this says how many photos/videos gallery has\n let infoContent = [];\n\n if(info.images)\n infoContent.push(document.createTextNode(pl(info.images, 'fotka')));\n if(info.images && info.videos)\n infoContent.push(document.createElement('br'));\n if(info.videos)\n infoContent.push(document.createTextNode(pl(info.videos, 'video')));\n\n let imgInfo = document.createElement('span');\n imgInfo.classList.add('info');\n imgInfo.append(...infoContent);\n\n // thumbnail image, we are adding \"ghost\" src/srcset attributes to be\n // copied to real ones upon becoming visible (ie. lazy loading)\n let image = document.createElement('img');\n if('thumb' in info)\n image.setAttribute('data-src', info.thumb.src);\n if('srcset' in info.thumb)\n image.setAttribute('data-srcset', info.thumb.srcset);\n\n // encompassing DIV element that holds the text content and the image\n let thumb = document.createElement('div');\n thumb.classList.add('th');\n thumb.append(cap, imgInfo, image);\n\n // wrapping A element\n let a = document.createElement('a');\n a.setAttribute('href', id + '/');\n a.classList.add('th');\n a.append(thumb);\n\n return a;\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 createThumbnail(url) {\n const theContainer = document.createElement('div')\n theContainer.classList.add('thumbnail-item');\n \n theContainer.appendChild(createImage(url));\n \n return theContainer;\n\n}",
"function ThumbnailItem(fileData) {\n if (!fileData) {\n throw new Error('fileData should not be null or undefined.');\n }\n this.data = fileData;\n\n this.htmlNode = document.createElement('div');\n this.htmlNode.classList.add('thumbnail');\n this.htmlNode.setAttribute('role', 'button');\n this.imgNode = document.createElement('img');\n this.imgNode.alt = '';\n this.imgNode.classList.add('thumbnailImage');\n this.imgNode.dataset.filename = fileData.name;\n\n // We revoke this url in imageDeleted\n var url = URL.createObjectURL(fileData.metadata.thumbnail);\n this.imgNode.src = url;\n this.htmlNode.appendChild(this.imgNode);\n\n if (navigator.mozL10n.readyState === 'complete') {\n this.localize();\n }\n}",
"function scaleThumb() {\n\n\tjQuery('#thumbBig').remove();\n\n\tvar src\t= jQuery(this).attr('src');\n\n\t\t// dimensions of thumbnail\n\tvar w\t= parseInt(jQuery(this).width());\n\tvar h\t= parseInt(jQuery(this).height());\n\n\t\t// real dimensions of image\n\tvar nw\t= jQuery(this).context.naturalWidth;\n\tvar nh\t= jQuery(this).context.naturalHeight;\n\n\t\t// position of thumbnail\n\tvar x\t= Math.floor(jQuery(this).offset().left);\n\tvar y\t= Math.floor(jQuery(this).offset().top);\n\n\tvar big = jQuery('<img src=\"'+src+'\" width=\"'+w+'\" height=\"'+h+'\" id=\"thumbBig\" style=\"position:absolute; top:'+y+'px; left:'+x+'px;z-index:1000;\" />');\n\tjQuery('body').append(big);\n\n\tjQuery('#thumbBig')\n\t\t.animate({'width':nw+'px','height':nh+'px'},400)\n\t\t.bind('mouseleave',function(){jQuery(this).remove();});\n}"
] |
[
"0.70654005",
"0.6743225",
"0.66222453",
"0.6562471",
"0.6522311",
"0.6441667",
"0.6409667",
"0.64059156",
"0.6402615",
"0.63581777",
"0.62729055",
"0.6243776",
"0.62026244",
"0.61985946",
"0.61974347",
"0.6117547",
"0.6112769",
"0.60977876",
"0.6074607",
"0.6050965",
"0.60023904",
"0.5997335",
"0.5976788",
"0.5956234",
"0.5938654",
"0.592637",
"0.5924481",
"0.59237814",
"0.5874797",
"0.58746386"
] |
0.7134303
|
0
|
import Video from "./SaranyuPlayer/Video";
|
function App() {
return (
<span>
{/* <VideoPlayer src="https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4" /> */}
<SaranyuVideoPlayer />
{/* <Video /> */}
</span>
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function VideoPlayer(){}",
"function onPlayerReady(event) {\n //event.target.playVideo();\n}",
"function onPlayerReady(event) {\n //event.target.playVideo();\n}",
"function onPlayerReady(event) {\r\n //event.target.playVideo();\r\n}",
"function onPlayerReady(event) {\nevent.target.playVideo();\n}",
"render() {\n return (\n\n <div className=\"container is-fluid\">\n\n <div className=\"video-container\">\n\n\t\t <video id=\"video\" preload=\"true\" autoPlay loop muted style={style.video}></video>\n </div>\n\n\n\n </div>\n\n\n\n )\n }",
"function Player(){\n return(\n <div id=\"embeddedPlayer\"><EmbeddedPlayer url=\"https://www.youtube.com/watch?v=GO5FwsblpT8\" controls={true} /></div>\n );\n}",
"function InteractiveVideo(props) {\n const { src, alt } = props;\n\n return (\n <Player playsInline poster=\"/assets/poster.png\" src=\"/static/video/HT-Campaign.mp4\">\n <ControlBar autoHide={false} className=\"my-class\" />\n </Player>\n );\n}",
"function onPlayerReady(event) {\n // event.target.playVideo();\n}",
"function onPlayerReady(event) {\n // event.target.playVideo();\n}",
"render(){\n return(\n <video width=\"300\" height=\"300\" >\n\n </video>\n\n\n )\n }",
"function onPlayerReady(event) {\n event.target.playVideo();\n }",
"function onPlayerReady(event) {\n // event.target.playVideo();\n }",
"function onPlayerReady(event) {\n\t//event.target.playVideo();\n}",
"isVideoTrack() {\n return this.getType() === _service_RTC_MediaType__WEBPACK_IMPORTED_MODULE_3__[\"VIDEO\"];\n }",
"function onPlayerReady (event) {\n event.target.playVideo()\n}",
"function onPlayerReady(event) {\n console.log(\"GO Video\");\n // event.target.playVideo();\n}",
"componentDidMount() {\n let self = this;\n let videoDiv = document.getElementById(this.props.id);\n let player = new Clappr.Player({\n source: self.props.liveurl,\n height: 360,\n width: 640\n });\n player.attachTo(videoDiv);\n }",
"function importPlayer() {\n PlayerDao = require('../../app/player/PlayerDao');\n }",
"function onPlayerReady(event) { \n //event.target.playVideo();\n detenerVideo();\n}",
"render() {\n return (\n <div className=\"video-player\">\n <div data-vjs-player>\n <video ref={node => (this.videoNode = node)} className=\"video-js\" />\n </div>\n </div>\n )\n }",
"function onPlayerReady(event) {\n event.target.playVideo();\n}",
"function onPlayerReady(event) {\n event.target.playVideo();\n}",
"function onPlayerReady(event) {\n event.target.playVideo();\n}",
"function onPlayerReady(event) {\n event.target.playVideo();\n}",
"function onPlayerReady(event) {\n event.target.playVideo();\n}",
"function onPlayerReady(event) {\n event.target.playVideo();\n}",
"function onPlayerReady(event) {\n event.target.playVideo();\n}",
"function onPlayerReady(event) {\n event.target.playVideo();\n}",
"function onPlayerReady(event) {\n event.target.playVideo();\n}"
] |
[
"0.67883414",
"0.628995",
"0.628995",
"0.626998",
"0.62494785",
"0.62154454",
"0.6121657",
"0.6107251",
"0.6103174",
"0.6102647",
"0.60809976",
"0.60392433",
"0.6021456",
"0.60100764",
"0.5986119",
"0.5975372",
"0.5967229",
"0.59636736",
"0.5937823",
"0.5931005",
"0.5924925",
"0.5920608",
"0.5920608",
"0.5920608",
"0.5920608",
"0.5920608",
"0.5920608",
"0.5920608",
"0.5920608",
"0.5920608"
] |
0.7422757
|
0
|
/ / This cheeky function just grabs the first part of the url after the first forward slash It will return just the 'v1' or 'v5' depending on what is passed to it This means there is no need for duplicate code for each iteration oh and it only works up to to v9
|
function getVersion(a) {
var secondBracket = a.url.indexOf('/', 1);
return a.url.substring(1, secondBracket) || "v1";
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function getFirstPart(url) {\n var indexOfTS = url.indexOf(\"//\");\n if(indexOfTS==-1) {\n return url.split(\"/\")[0];\n }\n else {\n var fp = url.substring(indexOfTS+2);\n return url.substring(0,indexOfTS)+\"//\"+fp.split(\"/\")[0];\n }\n\n }",
"function getVersion(path) {\n const url = new URL(path, 'https://foo.bar');\n const segments = url.pathname.split('/');\n return segments.find((segment) => segment.match(/v[0-9]+(.[0-9]+)?/));\n}",
"function getFirstPart(url) {\n var indexOfTS = url.indexOf(\"//\");\n if(indexOfTS==-1) {\n return url.split(\"/\")[0];\n }\n else {\n var fp = url.substring(indexOfTS+2);\n return url.substring(0,indexOfTS)+\"//\"+fp.split(\"/\")[0];\n }\n\n }",
"function getFirstPart(url) {\n var indexOfTS = url.indexOf(\"//\");\n if(indexOfTS==-1) {\n return url.split(\"/\")[0];\n }\n else {\n var fp = url.substring(indexOfTS+2);\n return url.substring(0,indexOfTS)+\"//\"+fp.split(\"/\")[0];\n }\n\n }",
"function getIndexVonMitarbeiter() {\n var query = window.location.href\n console.log(query)\n var vars = query.split(\"/\");\n\n return vars[4]\n\n}",
"function smartUrl(url) {\n\n if (url.indexOf(languagemastersPath) > -1) {\n url = url.split(languagemastersPath)[1];\n } else if (url.indexOf(languagePath) > -1) {\n url = url.split(languagePath)[1];\n } else if (url.indexOf(liveURL) > -1) {\n url = url.split(liveURL)[1].substring(parseInt(languagecodelength) + 2);\n } else if (url.indexOf(publishURL) > -1) {\n url = url.split(publishURL)[1].substring(parseInt(languagecodelength) + 2);\n } else if (url.indexOf(stageLiveURL) > -1) {\n url = url.split(stageLiveURL)[1].substring(parseInt(languagecodelength) + 2);\n } else if (url.indexOf(stagePublishURL) > -1) {\n url = url.split(stagePublishURL)[1].substring(parseInt(languagecodelength) + 2);\n } else if(url.indexOf(previewURL)> -1){\n url = url.split(previewURL)[1].substring(3);\n }\n\n\n if (url.indexOf(\".html\") > -1) {\n url = url.split(\".html\")[0];\n }\n\n return url;\n\n}",
"resource(fullUrl){\n //Pega o caminho da URL ou seja a string que vem após a porta e antes das querys\n //protocolo://domínio:porta/RECURSO/.../RECURSO?query_string#fragmento\n let parsedUrl = url.parse(fullUrl).pathname\n return parsedUrl\n }",
"function getBase(url) {\n\t\t\treturn url.split('?')[0];\t\n\t\t}",
"function getQueryVariableShortened(url){\n\n return url.split(\"/\")[3];\n}",
"GetURLResource(url) {\r\n let parts = url.split('/');\r\n let lastSection = parts.pop() || parts.pop();\r\n if (lastSection) {\r\n return lastSection;\r\n }\r\n else {\r\n return \"unknown\";\r\n }\r\n }",
"function asFullUrl(slug, version, path) {\n return `/${slug}/api/${version}/${stripInitialSlash(path)}`;\n}",
"function serverBase(url) { // 11458\n return url.substring(0, url.indexOf('/', url.indexOf('//') + 2)); // 11459\n} // 11460",
"function _get_url( els ) {\n\treturn basepath + els.join('/');\n}",
"splitURL(url){\n let UrlParts = url.substring(1).split('/');\n return UrlParts;\n }",
"static makeUrlRelative(url) {\r\n if (!isUrlAbsolute(url)) {\r\n // already not absolute, just give it back\r\n return url;\r\n }\r\n let index = url.indexOf(\".com/v1.0/\");\r\n if (index < 0) {\r\n index = url.indexOf(\".com/beta/\");\r\n if (index > -1) {\r\n // beta url\r\n return url.substr(index + 10);\r\n }\r\n }\r\n else {\r\n // v1.0 url\r\n return url.substr(index + 9);\r\n }\r\n // no idea\r\n return url;\r\n }",
"parseDefaultRoute(url) {\n if (url.trim() === '/')\n throw Error('Url is index!');\n if (url[url.length - 1] === '/')\n url = url.slice(0, -1);\n if (url[0] === '/')\n url = url.slice(1, url.length);\n var indexAnyRoute = -1;\n for (var i = 0; i < this.routes.length; i++) {\n let route = this.routes[i];\n let routePath = route.path;\n if (routePath.trim() === '*')\n indexAnyRoute = i;\n if (routePath.trim() === '/')\n continue;\n if (routePath[routePath.length - 1] === '/')\n routePath = routePath.slice(0, -1);\n if (routePath[0] === '/')\n routePath = routePath.slice(1, routePath.length);\n var rBread = routePath.split('/');\n var urlBread = url.split('/');\n if (rBread.length !== urlBread.length)\n continue;\n for (let k = 0; k < urlBread.length; k++) {\n if (urlBread[k] === rBread[k] && k < urlBread.length - 1)\n continue;\n else if (urlBread[k] !== rBread[k] && k < urlBread.length - 1)\n break;\n else {\n if (k === urlBread.length - 1 && rBread[k].trim() === '*') {\n return i;\n }\n }\n }\n }\n if (indexAnyRoute !== -1)\n return indexAnyRoute;\n throw Error('Test');\n }",
"function get_v(page_url){\r\n\tvar v = 0;\r\n\tif (page_url.indexOf(\"&v=\")!=-1){\r\n\t\t//this assumes the v is always at the end, could modify to check that there isn't another & after it\r\n\t\tv = page_url.substring(page_url.indexOf(\"&v=\")+3);\r\n\t}\r\n\treturn v;\r\n}",
"function getVarenummer(){\n var url = window.location.pathname.split('/');\n var varenummer = url[url.length- 1];\n return varenummer;\n}",
"_getPathFromUrl () {\n return window.location.toString().split(/[?#]/)[0]\n }",
"function refineUrl()\n{\n //get full url\n var url = window.location.href;\n //get url after/ \n var value = url = url.slice( 0, url.indexOf('?') );\n //get the part after before ?\n value = value.replace('@System.Web.Configuration.WebConfigurationManager.AppSettings[\"BaseURL\"]',''); \n return value; \n}",
"function recuperaPath(url)\n{\n\ttry {\n\t\tvar result = url.match(/[-_\\w]+[.][\\w]+$/i)[0];\n\t}\n\tcatch(err) {\n\t\t//console.log(err);\n\t\tvar result = \" \";\n\t}\n\treturn result;\n}",
"function serverBase(url){return url.substring(0,url.indexOf('/',url.indexOf('//')+2));}",
"function serverBase(url){return url.substring(0,url.indexOf('/',url.indexOf('//')+2));}",
"function mirrorbrain_getVersionForDownloadFolder( version ) {\n\tvar s = null;\n\tif ( version.indexOf( \"_\" ) > -1 ) {\n\t\ts = version.split( \"_\" )[0];\n\t} else {\n\t\ts = version;\n\t}\n\n\tif ( version == VERSION ) {\n\t\treturn version;\n\t} else if ( version == OLD_VERSION ) {\n\t\treturn version;\n\t} else if ( version == RC_VERSION ) {\n\t\treturn s;\n\t} else if ( version == BETA_VERSION ) {\n\t\treturn version;\n\t} else if ( version == DEV1_VERSION ) {\n\t\treturn version;\n\t} else if ( version == DEV2_VERSION ) {\n\t\treturn version;\n\t} else if ( version == TEST_VERSION ) {\n\t\treturn version;\n\t}\n\t// error\n\treturn null;\n}",
"function what(){\r\n var url = window.location.pathname;\r\n var reg = url.match(/\\/([s])\\/([0-9a-zA-Z]+)/g);\r\n var reg_entries = url.match(/\\/wpisy/);\r\n var reg_comments = url.match(/\\/komentarze/);\r\n console.log ( url );\r\n if( url == '/' ) \r\n\t\treturn \"contents\";\r\n if( reg )\r\n \treturn \"contents\"; \r\n if( reg_entries) \r\n\t\treturn \"entries\";\r\n\tif( reg_comments)\r\n\t\treturn \"content_comments\";\r\n \r\n return false;\r\n}",
"function getVideoId(url)\r\n{\r\n url = url.split(\"?v=\")[1]\r\n try { url = url.split(\"&\")[0]; }\r\n catch (error) {}\r\n return url;\r\n}",
"function getBaseAndPath(u){\n var parts = normalize(u).split('#');\n return [ parts[0], unescapePath(((parts[1] || '').split('/').slice(1) || '')) ];\n}",
"function GetURLResource(url) {\n var parts = url.split('/');\n var lastSection = parts.pop() || parts.pop();\n if (lastSection) {\n return lastSection;\n }\n else {\n return \"unknown\";\n }\n }",
"function getURLSearch() {\n return window.location.search.substring(1);\n}",
"function idFromUrl(url) {\n var last3 = url.slice(-3);\n if (last3[0] === \"/\") return url.slice(-2)\n if (last3[1] === \"/\") return url.slice(-1);\n return last3;\n }"
] |
[
"0.629994",
"0.6248497",
"0.6241973",
"0.6241973",
"0.6169043",
"0.5998651",
"0.58641255",
"0.5807509",
"0.577553",
"0.57436085",
"0.573082",
"0.57080716",
"0.5697199",
"0.56947345",
"0.56690013",
"0.5661327",
"0.5617613",
"0.560411",
"0.55708545",
"0.5549006",
"0.55392975",
"0.5529501",
"0.5529501",
"0.55138206",
"0.550698",
"0.54716414",
"0.54638034",
"0.5426696",
"0.5395617",
"0.53824896"
] |
0.74001163
|
0
|
Resize JS9 in a div (id must be JS9canvas)
|
function resizeJS9InDiv() {
let wWidth = $('#JS9-canvas').width();
let wHeight = window.innerHeight - 200;
$('.JS9Menubar').attr('data-width', wWidth);
$('.JS9Toolbar').attr('data-width', wWidth);
$('.JS9Toolbar').attr('data-height', '30px');
$('.JS9').attr('data-width', wWidth);
$('.JS9').attr('data-height', wHeight);
$('.JS9Colorbar').attr('data-width', wWidth);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function resizeJS9() {\n let wWidth = window.innerWidth / 1.2;\n let wHeight = window.innerHeight - 125;\n $('#JS9-canvas').css('margin-left', (window.innerWidth-wWidth)/2+'px');\n $('.JS9Menubar').attr('data-width', wWidth);\n $('.JS9Toolbar').attr('data-width', wWidth);\n $('.JS9Toolbar').attr('data-height', '30px');\n $('.JS9').attr('data-width', wWidth);\n $('.JS9').attr('data-height', wHeight);\n $('.JS9Colorbar').attr('data-width', wWidth);\n}",
"function resizeVideoJS(){\n\t\tvar width = document.getElementById(id).parentElement.offsetWidth;\n myPlayer.width(width).height( width * aspectRatio );\n }",
"function resizeVideoJS(){\n var width = document.getElementById(myPlayer.el().id).parentElement.offsetWidth;\n var aspectRatio=8/12;\n myPlayer.width(width).height( width * aspectRatio);\n }",
"function resize(){\n let style_height = +getComputedStyle(canvas).getPropertyValue(\"height\").slice(0, -2); \n let style_width = +getComputedStyle(canvas).getPropertyValue(\"width\").slice(0, -2); \n\n canvas.setAttribute('height', style_height * dpi); \n canvas.setAttribute('width', style_width * dpi); \n}",
"_resizeCanvas(htmlId) {\n let canvas = $(`#${htmlId}-canvas`);\n let w = canvas.parent().width();\n let h = canvas.parent().height();\n canvas.attr(\"width\", w);\n canvas.attr(\"height\", h);\n RGraph.Clear(canvas[0]);\n RGraph.Redraw();\n }",
"_resizeCanvas(htmlId) {\n let canvas = $(`#${htmlId}-canvas`);\n let w = canvas.parent().width();\n let h = canvas.parent().height();\n canvas.attr(\"width\", w);\n canvas.attr(\"height\", h);\n RGraph.Clear(canvas[0]);\n RGraph.Redraw();\n }",
"scale(size) {\n document.getElementById(\"guiArea\").style.width = size + \"px\";\n }",
"function resizeVideoJS() {\n var width = document.getElementById(myPlayer.id()).parentElement.offsetWidth;\n myPlayer.width(width).height(width * aspectRatio);\n }",
"function resizeVideoJS(){\n // Get the parent element's actual width\n var width = document.getElementById(myPlayer.id).parentElement.offsetWidth;\n // Set width to fill parent element, Set height\n\tif($(document).width() < 780)\n\t\tmyPlayer.width(width).height( width * aspectRatio );\n\telse\n myPlayer.width(width).height( $(window).height() );\n }",
"function resize() {\n let parStyle = window.getComputedStyle(canvas.elt.parentNode),\n cWidth = parseInt(parStyle.width),\n cHeight = parseInt(parStyle.height);\n\n cHeight -= parseInt(parStyle.paddingTop) + parseInt(parStyle.paddingBottom);\n cWidth -= parseInt(parStyle.paddingLeft) + parseInt(parStyle.paddingRight);\n resizeCanvas(cWidth, cHeight, true);\n}",
"canvasResize()\n {\n View.canvas.setAttribute(\"width\", this.floatToInt(window.innerWidth*0.95));\n View.canvas.setAttribute(\"height\",this.floatToInt(window.innerHeight*0.95));\n\n //update objects with the new size\n this.updateCharacterDim();\n this.updateVirusDim();\n this.updateSyringesDim();\n this.background.resize();\n\n }",
"function resize16x9(element) {\r\n\r\n \t$(\"#\"+element).each(function() {\r\n \t\tw = $(this).width();\r\n \t\th = Math.round((w/16)*9);\r\n \t\t$(this).height(h);\r\n \t});\r\n }",
"function resizeIt(magnification)\r\n\r\n{var new_layout_width=(original_size.w*magnification)+layout_width_offset;\r\n layout.style.width=new_layout_width.toString()+\"px\";\r\n embed_tag.setAttribute(\"width\",original_size.w*magnification);\r\n\r\n embed_tag.setAttribute(\"height\",original_size.h*magnification);\r\n\r\n}",
"function resizeCanvas() {\n let parent = canv.parentNode;\n if (parent == document.body) {\n parent = window;\n canv.style.width = parent.innerWidth + \"px\";\n\n canv.width = parent.innerWidth;\n canv.height = parent.innerHeight;\n }\n else {\n //Take the canvas out of the parent div sive calculation momentarily\n can.style.height = \"0px\";\n can.style.width = \"0px\";\n can.width = 0\n can.height = 0;\n //Then on the next tick put it back in.\n setTimeout(function () {\n let width = parent.clientWidth;\n let height = parent.clientHeight;\n can.style.width = width + \"px\";\n can.style.height = height + \"px\";\n can.width = width;\n can.height = height;\n //console.log(`${parent.clientWidth}-${parent.innerWidth}-${parent.offsetWidth}`)\n console.log(`${can.style.height} ${can.height}`)\n }, 0);\n\n }\n }",
"function resize(){\n rect = Canvas.getBoundingClientRect()\n ratio = S/rect.height\n Canvas.width = S\n Canvas.height = S\n\n for (let i=0; i<Class('image').length; i++){\n let c = Class('image')[i]\n c.width = S\n c.height = S\n }\n}",
"function resizeCanvas(){\n\tlet container = document.getElementById(\"canvasContainer\");\n\t\n\tcanvas.width = $(container).width();\n\tcanvas.height = $(container).height();\n\t\n\tredraw();\n}",
"function resize() {\n let width;\n if ($('.mainArea')[0].offsetWidth > 490) width = $('.mainArea')[0].offsetWidth;\n else width = 490;\n ipcRenderer.send('resize', $('.mainArea')[0].offsetHeight, width);\n}",
"function resize_canvas() {\n\t\t\tcanvas_elem.width = window.innerWidth / 2;\n\t\t\tcanvas_elem.height = window.innerWidth / 2;\n\n\t\t\tupdate_needed = true;\n\t\t}",
"function change_container() {\n var c = document.getElementById('jsmind_container');\n c.style.width = '800px';\n c.style.height = '500px';\n}",
"function resizeCanvas() {\n //low level\n c.width = window.innerWidth;\n c.height = window.innerHeight;\n //update wrapper\n st.canvas.width = c.width;\n st.canvas.height = c.height;\n //update objects and redraw\n updateObjects();\n}",
"function resize(width, height) {\n var ratio = config.width/config.height;\n var x = 0;\n var y = 0;\n var w = 0;\n var h = 0;\n if (width / height >= ratio) {\n w = height * ratio;\n x = (width - w)/2;\n h = height;\n } else {\n w = width;\n h = width / ratio;\n y = (height - h)/2;\n }\n renderer.view.style.width = w + 'px';\n renderer.view.style.height = h + 'px';\n renderer.view.style.left = x + 'px';\n renderer.view.style.top = y + 'px';\n renderer.view.style.position = \"relative\";\n}",
"function resize(width, height) {\n var ratio = config.width/config.height;\n var x = 0;\n var y = 0;\n var w = 0;\n var h = 0;\n if (width / height >= ratio) {\n w = height * ratio;\n x = (width - w)/2;\n h = height;\n } else {\n w = width;\n h = width / ratio;\n y = (height - h)/2;\n }\n renderer.view.style.width = w + 'px';\n renderer.view.style.height = h + 'px';\n renderer.view.style.left = x + 'px';\n renderer.view.style.top = y + 'px';\n renderer.view.style.position = \"relative\";\n}",
"function resizeBoardDOM(width,height) {\n $(\"#board\").attr(\"width\",width);\n $(\"#board\").attr(\"height\",height);\n}",
"function fixCanvas(){\n CANVAS.width=400\n CANVAS.height=225\n CANVAS.style.width = \"400px\"\n CANVAS.style.height = \"225px\"\n}",
"resize(w, h) {\n\n let c = this.canvas;\n let x, y;\n let width, height;\n\n // Find the best multiplier for\n // square pixels\n let mul = Math.min(\n (w / c.width) | 0, \n (h / c.height) | 0);\n \n // Compute properties\n width = c.width * mul;\n height = c.height * mul;\n x = w/2 - width/2;\n y = h/2 - height/2;\n \n // Set style properties\n let top = String(y | 0) + \"px\";\n let left = String(x | 0) + \"px\";\n\n c.style.height = String(height | 0) + \"px\";\n c.style.width = String(width | 0) + \"px\";\n c.style.top = top;\n c.style.left = left;\n }",
"function help_resize() {\n\t\tvar h_height = inner_size()[1];\n\t\tdocument.getElementById('general').style.height = h_height-45;\n\t\tdocument.getElementById('chat').style.height = h_height-45;\n\t\tdocument.getElementById('calendar').style.height = h_height-45;\n\t\tdocument.getElementById('inbox').style.height = h_height-45;\n\t\tdocument.getElementById('compose').style.height = h_height-45;\n\t\tdocument.getElementById('address').style.height = h_height-45;\n\t\tdocument.getElementById('folders').style.height = h_height-45;\n\t\tdocument.getElementById('search').style.height = h_height-45;\n\t\tdocument.getElementById('preferences').style.height = h_height-45;\n\t\tdocument.getElementById('credits').style.height = h_height-45;\n\t}",
"function resizeCanvas() {\n let width = $('#diagram').width();\n $('#myCanvas')[0].attributes[1].nodeValue = width;\n $('#myCanvas')[0].attributes[2].nodeValue = width / 2;\n}",
"function xResizeTo(e,w,h)\r\n{\r\n xWidth(e,w);\r\n xHeight(e,h);\r\n}",
"function resize(width, height) {\n JFCustomWidget.requestFrameResize({\n width: width,\n height: height,\n })\n}",
"function displayResize(evt) {\n var available_height = window.innerHeight - 100,\n available_width = window.innerWidth;\n var tmp_square_height = available_height >> 3,\n tmp_square_width = available_width / 11.5;\n var tmp = tmp_square_height > tmp_square_width ?\n tmp_square_width : tmp_square_height;\n var tmp_square = tmp < 30 ? 30 : tmp;\n game.render_elements(tmp_square, tmp_square);\n var pieces = game.elements.pieces;\n for (var y = 9; y > 1; y--){\n for(var x = 1; x < 9; x++){\n var i = y * 10 + x;\n pieces[i].height = tmp_square;\n pieces[i].width = tmp_square;\n }\n }\n}"
] |
[
"0.730455",
"0.68586385",
"0.6810608",
"0.67658746",
"0.67411005",
"0.67411005",
"0.67367375",
"0.6717239",
"0.66893893",
"0.6601592",
"0.6598368",
"0.65592873",
"0.64905846",
"0.6427998",
"0.6384384",
"0.6364894",
"0.63329726",
"0.6315134",
"0.6311764",
"0.6278579",
"0.6277266",
"0.6277266",
"0.6268742",
"0.6227176",
"0.62221634",
"0.6220806",
"0.6206545",
"0.6177857",
"0.614973",
"0.6144711"
] |
0.77290565
|
0
|
dynamically adjust heights of all regions
|
function adjustRowRegionsHeights() {
// handle region areas for upper rows
if ($(".upperRow").length) {
var rows = $(".regions").find(".upperRow");
rows.each(adjustUpperRowRegionsHeight);
}
// handle region areas for the bottom row
if ($(".bottomRow").length) {
var row = $(".regions").find(".bottomRow");
adjustBottomRowRegionsHeight(row)
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function adjustRowRegionsHeights() {\n // handle region areas for upper rows\n if ($(\".upperRow\").length) {\n var rows = $(\".regions\").find(\".upperRow\");\n rows.each(adjustUpperRowRegionsHeight);\n }\n\n // handle region areas for the bottom row\n if ($(\".bottomRow\").length) {\n var row = $(\".regions\").find(\".bottomRow\");\n adjustBottomRowRegionsHeight(row)\n }\n }",
"function adjustUpperRowRegionsHeight(row) {\n // when called by each, first argument is a number instead of a row value\n var row = (typeof row === 'number') ? $(this) : row;\n\n resetRowsRegionsHeight(row);\n\n // sets total region height to the height of tallest region\n setRowsRegionsHeight(row, getRowRegionsMaxHeight(row));\n\n // refresh sortables cached positions\n getNonLockedRegions().sortable(\"refreshPositions\");\n }",
"function modifyHeight() {\n var $uiSelectorContainer = $(uiSelector);\n var page_header_height = $uiSelectorContainer.find('.page-header').height();\n \n // If page_header's height is changed, then modify the height of main_region\n if(page_header_height !== page_header_current_height) {\n page_header_current_height = page_header_height;\n var $main_region_selector = $uiSelectorContainer.find('#main_content'),\n right_pane_height = $uiSelectorContainer.find('.right-pane').height();\n\n $main_region_selector.outerHeight(right_pane_height - page_header_height);\n }\n }",
"function adjustUpperRowRegionsHeight(row) {\n // when called by each, first argument is a number instead of a row value\n var row = (typeof row === 'number') ? $(this) : row;\n\n resetRowsRegionsHeight(row);\n\n // sets total region height to the height of tallest region\n setRowsRegionsHeight(row, getRowRegionsMaxHeight(row));\n\n // refresh sortables cached positions\n getNonLockedRegions().sortable(\"refreshPositions\");\n }",
"function setRowsRegionsHeight(row, maxHeight) {\n var rowChildren = $(row).children();\n for (var x = 0; x < rowChildren.length; x++) {\n if ($(rowChildren.get(x)).outerHeight() != maxHeight) {\n var defaultPadding = parseInt($(rowChildren.get(x)).css(\"padding-bottom\").replace(\"px\", \"\"));\n $(rowChildren.get(x)).css(\"padding-bottom\", (defaultPadding + maxHeight - $(rowChildren.get(x)).outerHeight()));\n }\n }\n }",
"function adjustBottomRowRegionsHeight(row) {\n resetRowsRegionsHeight(row);\n var bodyHeight = $('body').outerHeight();\n var windowHeight = $(window).height();\n // Instances where no scroll bar currently exists\n if (windowHeight >= bodyHeight) {\n var pageHeight = $(\"#pageContent\").outerHeight();\n var headerHeight = bodyHeight - pageHeight;\n var upperRegionsMaxHeights = 0;\n if ($(\".upperRow\").length) {\n var rows = $(\".regions\").find(\".upperRow\");\n for (var x = 0; x < rows.length; x++) {\n var rowMaxHeight = getRowRegionsMaxHeight(rows.get(x));\n upperRegionsMaxHeights = upperRegionsMaxHeights + rowMaxHeight;\n }\n }\n // determine maximum size possible for bottom region\n // 50 px of buffer also removed to prevent scroll-bar from appearing in any cases\n var bottomPadding = (windowHeight - 50) - (upperRegionsMaxHeights + headerHeight);\n\n setRowsRegionsHeight(row, bottomPadding);\n }\n // Instances where scroll bar currently exists, can default to upper row behavior\n else {\n adjustUpperRowRegionsHeight(row);\n }\n // refresh sortables cached positions\n getNonLockedRegions().sortable(\"refreshPositions\");\n }",
"function setRowsRegionsHeight(row, maxHeight) {\n var rowChildren = $(row).children();\n for (var x = 0; x < rowChildren.length; x++) {\n if ($(rowChildren.get(x)).outerHeight() != maxHeight) {\n var defaultPadding = parseInt($(rowChildren.get(x)).css(\"padding-bottom\").replace(\"px\", \"\"));\n $(rowChildren.get(x)).css(\"padding-bottom\", (defaultPadding + maxHeight - $(rowChildren.get(x)).outerHeight()));\n }\n }\n }",
"function adjustBottomRowRegionsHeight(row) {\n resetRowsRegionsHeight(row);\n var bodyHeight = $('body').outerHeight();\n var windowHeight = $(window).height();\n // Instances where no scroll bar currently exists\n if (windowHeight >= bodyHeight) {\n var pageHeight = $(\"#pageContent\").outerHeight();\n var headerHeight = bodyHeight - pageHeight;\n var upperRegionsMaxHeights = 0;\n if ($(\".upperRow\").length) {\n var rows = $(\".regions\").find(\".upperRow\");\n for (var x = 0; x < rows.length; x++) {\n var rowMaxHeight = getRowRegionsMaxHeight(rows.get(x));\n upperRegionsMaxHeights = upperRegionsMaxHeights + rowMaxHeight;\n }\n }\n // determine maximum size possible for bottom region\n // 50 px of buffer also removed to prevent scroll-bar from appearing in any cases\n var bottomPadding = (windowHeight - 50) - (upperRegionsMaxHeights + headerHeight);\n\n setRowsRegionsHeight(row, bottomPadding);\n }\n // Instances where scroll bar currently exists, can default to upper row behavior\n else {\n adjustUpperRowRegionsHeight(row);\n }\n // refresh sortables cached positions\n getNonLockedRegions().sortable(\"refreshPositions\");\n }",
"function initHeights() {\n jQuery('.california-world .container .col-sm-6').matchHeight();\n jQuery('.equal-heights > .col-sm-6').matchHeight();\n}",
"function adjustVizHeight(){\n viz.style(\"height\", function(){\n w = parseInt(viz.style(\"width\"), 10);\n h = w*heightRatio;\n return h;\n })\n}",
"function resetRowsRegionsHeight(row) {\n // when called by each, first argument is a number instead of a row value\n var row = (typeof row === 'number') ? $(this) : row;\n\n var rowChildren = $(row).children();\n for (var x = 0; x < rowChildren.length; x++) {\n // reset to 5, the initial value before dragging\n $(rowChildren.get(x)).css(\"padding-bottom\", 5);\n }\n }",
"function resetRowsRegionsHeight(row) {\n // when called by each, first argument is a number instead of a row value\n var row = (typeof row === 'number') ? $(this) : row;\n\n var rowChildren = $(row).children();\n for (var x = 0; x < rowChildren.length; x++) {\n // reset to 5, the initial value before dragging\n $(rowChildren.get(x)).css(\"padding-bottom\", 5);\n }\n }",
"innerHeightDependsOnChilds(){if(this.__controlStretchedHeight)return!0;if(this.__rowOptions)for(const rowOption of this.__rowOptions)if(\"Content\"===rowOption.heightMode)return!0;return super.innerHeightDependsOnChilds()}",
"changeClosetHeight(height) {\n if (height > 0) {\n var axesHeight = height / 2;\n var heighpos = this.faces.get(FaceOrientation.TOP).Y()[4]; //TODO: Remove heighpos ?\n this.faces.get(FaceOrientation.TOP).changeYAxis((this.faces.get(FaceOrientation.TOP).Y()-this.faces.get(FaceOrientation.LEFT).height()/2)+axesHeight);\n this.faces.get(FaceOrientation.TOP).changeYAxis((this.faces.get(FaceOrientation.BASE).Y()+this.faces.get(FaceOrientation.LEFT).height()/2)-axesHeight);\n this.faces.get(FaceOrientation.LEFT).changeHeight(height);\n this.faces.get(FaceOrientation.RIGHT).changeHeight(height);\n this.faces.get(FaceOrientation.BACK).changeHeight(height);\n for(let closetSlot of this.getSlotFaces()){\n closetSlot.changeHeight(height);\n }\n }\n }",
"function resizesection2 (nb)\r\n{\r\n\tvar nb = nb;\r\n\tvar height = nb * 150 + 50 ; // 150 / guitare + 25 pout l'en-tête et 25 pour le bas\r\n\t// maj de la hauteur du block\r\n\tdocument.getElementById('Index_Section2').style.height = height+\"px\";\r\n}",
"function setUiGridHeight( ) {\r\n\t\t// apply shadow\r\n\t\t$( '#patientvaluesmultihistory' ).find( '> div:first' ).addClass( 'ui-shadow' );\r\n\t\tvar windowsheight = $( window ).height( );\r\n\t\t/*\r\n\t\t * Random number are paddings and margins of parents and grandparents\r\n\t\t */\r\n\t\tvar allowedHeight = windowsheight - ( windowsheight / 10 + 44 + 30 + 39 + 30 + 100 );\r\n\t\tvar uiBlockHeight = $( '#multi_values_history' ).height( );\r\n\t\tif ( uiBlockHeight > allowedHeight ) {\r\n\t\t\t$( '#values_history_terms' ).height( allowedHeight );\r\n\t\t}\r\n\t}",
"updateInnerHeightDependingOnChilds(){}",
"function Ba(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var a=e.widgets[t],n=a.node.parentNode;n&&(a.height=n.offsetHeight)}}",
"function equalizeHeight()\n{\n\tvar boxHeight = 0;\n\n\t$(\".eq-height\").removeAttr(\"style\");\n\n\t$(\".row\").each(function(){\n\n\t\t$(this).find(\".eq-height\").each(function(){\n\t\t\tvar currentBoxHeight = $(this).innerHeight();\n\t\t\tif(currentBoxHeight > boxHeight) boxHeight = currentBoxHeight;\n\t\t});\n\n\t\t$(this).find(\".eq-height\").css({\"height\":boxHeight-51+\"px\"});\n\t\t$(\".container\").css({\"height\":boxHeight+\"px\"});\n\n\t});\n}",
"function setHeights() {\n halfWindow = $(window).height() / 2;\n nHeight = $(\"#name\").height() - 40;\n rHeight = $(\"#role\").height() - 29;\n tCHeight = $(\"#topContacts\").height() - 19;\n scene2Height = $(\"#workExperience\").height() * 2.5;\n scene3Height = $(\"#projects\").height() * 1.5;\n scene4Height = $(\"#education\").height() * 2;\n}",
"set height(value) {}",
"function getRowRegionsMaxHeight(row) {\n var rowChildren = $(row).children();\n var maxHeight = 100;\n for (var x = 0; x < rowChildren.length; x++) {\n if ($(rowChildren.get(x)).outerHeight() > maxHeight) {\n maxHeight = $(rowChildren.get(x)).outerHeight();\n }\n }\n return maxHeight;\n }",
"function resizeControls() {\n function rc (sel) {\n var els = document.querySelectorAll(sel)\n for (var i=0; i < els.length; i++)\n els[i].style.height = (window.innerHeight - els[i].offsetTop) + 'px'\n }\n try { rc('.full-height') } catch (e) {}\n}",
"function changeAreaSize() {\n changeBackgroundSize();\n for (i = 0; i <= width; i++) {\n changeLineSize(0, i);\n }\n for (i = 0; i <= height; i++) {\n changeLineSize(1, i);\n }\n for (i = 0; i < $MAX_WIDTH_DIMENSION; i++) {\n for (j = 0; j < $MAX_HEIGTH_DIMENSION; j++) {\n changeSquareSize(i, j);\n changeSquareAuxSize(i, j);\n }\n }\n changeCalculatedSize(0);\n changeCalculatedSize(1);\n changeDecreaseArrowSize(0);\n changeIncreaseArrowSize(0);\n changeDecreaseArrowSize(1);\n changeIncreaseArrowSize(1);\n changeDecreaseArrowSize(2);\n changeIncreaseArrowSize(2);\n}",
"function setHeight() {\n $('.voyage').css('height', 'auto');\n var maxHeight = Math.max.apply(null, $(\".voyage\").map(function() {\n return $(this).height();\n }).get());\n $('.voyage').height(maxHeight);\n }",
"function setHeight(obj) {\n $(mainBlock).height(function () {\n return (obj.descriptionHeight + obj.menuListBlock) + 100;\n });\n }",
"function heightses(){\n\t\t$('.page__catalog .catalog-products-list__title').height('auto').equalHeights();\n\t}",
"function getRowRegionsMaxHeight(row) {\n var rowChildren = $(row).children();\n var maxHeight = 100;\n for (var x = 0; x < rowChildren.length; x++) {\n if ($(rowChildren.get(x)).outerHeight() > maxHeight) {\n maxHeight = $(rowChildren.get(x)).outerHeight();\n }\n }\n return maxHeight;\n }",
"function setHeight2() {\n for (var i = 1; i < 5; i++) {\n $('.js-head' + i).css('height', 'auto');\n var maxHeight2 = Math.max.apply(null, $(\".js-head\" + i).map(function() {\n return $(this).height();\n }).get());\n $('.js-head' + i).height(maxHeight2);\n \n }\n\n\n }",
"function resize() {\n var sentinel = false;\n\n for(var i = 0; i < visCount; i++) {\n if ((d3.select(\"#vis\" + i)).attr(\"height\") < 400)\n sentinel = true;\n }\n if(sentinel) {\n height *= 2;\n\n d3.selectAll(\".assignmentContainer\")\n .attr( \"height\", height );\n d3.selectAll(\".svg\")\n .attr( \"height\", height );\n } else {\n height /= 2;\n\n d3.selectAll(\".assignmentContainer\")\n .attr(\"height\", height);\n d3.selectAll(\".svg\")\n .attr(\"height\", height);\n }\n}"
] |
[
"0.767654",
"0.6946048",
"0.6924941",
"0.6866327",
"0.68433464",
"0.68425596",
"0.6821279",
"0.68204063",
"0.6752954",
"0.6700764",
"0.6660623",
"0.6592755",
"0.64511824",
"0.64098984",
"0.64033854",
"0.636346",
"0.63422424",
"0.6335405",
"0.63190836",
"0.6309503",
"0.6297684",
"0.6243906",
"0.6240024",
"0.6239788",
"0.6234569",
"0.62269235",
"0.6217873",
"0.621044",
"0.6199158",
"0.6197121"
] |
0.76559716
|
1
|
Returns the height of the tallest region in row, minimum 100 px
|
function getRowRegionsMaxHeight(row) {
var rowChildren = $(row).children();
var maxHeight = 100;
for (var x = 0; x < rowChildren.length; x++) {
if ($(rowChildren.get(x)).outerHeight() > maxHeight) {
maxHeight = $(rowChildren.get(x)).outerHeight();
}
}
return maxHeight;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"get minHeight() {}",
"function getRowRegionsMaxHeight(row) {\n var rowChildren = $(row).children();\n var maxHeight = 100;\n for (var x = 0; x < rowChildren.length; x++) {\n if ($(rowChildren.get(x)).outerHeight() > maxHeight) {\n maxHeight = $(rowChildren.get(x)).outerHeight();\n }\n }\n return maxHeight;\n }",
"get height()\n\t{\n\t\tlet height = Math.max(this._height, this.minHeight);\n\n\t\tif (this.tree.theme.hasGridBehavior)\n\t\t{\n\t\t\tlet step = this.tree.theme.gridSize;\n\t\t\theight = Math.ceil(height / step) * step;\n\t\t}\n\n\t\treturn height;\n\t}",
"function rowHeights(rows) {\n return rows.map(row => {\n return row.reduce((max, cell) => {\n return Math.max(max, cell.minHeight());\n }, 0);\n });\n}",
"function rowHeights(rows) {\n return rows.map(function(row) {\n return row.reduce(function(max, cell) {\n return Math.max(max, cell.minHeight());\n }, 0);\n });\n}",
"function rowHeights(rows) {\n return rows.map(function(row) {\n return row.reduce(function(max, cell) {\n return Math.max(max, cell.minHeight());\n }, 0);\n });\n}",
"get estimatedHeight() { return -1; }",
"function getRowHeight() {\n var windowWidth, rowHeight;\n\n windowWidth = $(window).width();\n rowHeight = (windowWidth < 900) ? 44 : 32;\n return rowHeight;\n }",
"get contentHeight() {\n const rowManager = this.rowManager;\n return Math.max(rowManager.totalHeight, rowManager.bottomRow ? rowManager.bottomRow.bottom : 0);\n }",
"get maxHeight() {}",
"getMinHeight(){return this.__minHeight}",
"get minHeight()\n\t{\n\t\treturn Math.max(this.tree.theme.nodeMinHeight,\n\t\t\tthis.tree.theme.nodeHeaderSize + this.input.height) + 3;\n\t}",
"function getGridCellSize() {\n return (min(width, height) / 2 - 50) / gridSize;\n}",
"get height() {}",
"getMinHeightUnit(){return this.__minHeightUnit}",
"function minHeightBst(array) {\n return getHalf(null, array, 0, array.length - 1);\n}",
"getLevelHeight() {\n return this.level.tilesHigh;\n }",
"function getMaxHeight(jList){\n var rv = -1;\n for(var i = 0; i < jList.length; i++){\n var cur = jList[i];\n if(parseInt(cur.posY) > rv){\n rv = parseInt(cur.posY)\n }\n }\n return rv - (rv%100);\n}",
"getBlockHeight() {\n return Promise.resolve(-1);\n }",
"gridHeight(x,z,index,col,row) {\n return 0;\n }",
"function getHeight (data) {\n const ROW_SPACING = 198.125\n totalPostNum = data.length\n totalRow = (totalPostNum%stepsX !== 0) ? Math.floor(totalPostNum/stepsX) + 1 : totalPostNum/stepsX\n section_height = (ROW_SPACING * totalRow) + 110\n return section_height\n }",
"async getBlockHeight() {\n // Add your code here\n let blockCount = await this.bd.getBlocksCount();\n return blockCount -1;\n }",
"async getBlockHeight () {\n return await this.getBlockHeightLevel()\n }",
"getViewportRowHeight() {\n return this.viewport.current.gridInfo[this.gridInfoView].aspectRatio;\n }",
"getHeight() {\n return this._executeAfterInitialWait(() => this.currently.getHeight());\n }",
"function findMaxElementHeight(shimmerElements) {\n var shimmerElementsDefaulted = shimmerElements.map(function (element) {\n switch (element.type) {\n case _Shimmer_types__WEBPACK_IMPORTED_MODULE_3__.ShimmerElementType.circle:\n if (!element.height) {\n element.height = _Shimmer_types__WEBPACK_IMPORTED_MODULE_3__.ShimmerElementsDefaultHeights.circle;\n }\n break;\n case _Shimmer_types__WEBPACK_IMPORTED_MODULE_3__.ShimmerElementType.line:\n if (!element.height) {\n element.height = _Shimmer_types__WEBPACK_IMPORTED_MODULE_3__.ShimmerElementsDefaultHeights.line;\n }\n break;\n case _Shimmer_types__WEBPACK_IMPORTED_MODULE_3__.ShimmerElementType.gap:\n if (!element.height) {\n element.height = _Shimmer_types__WEBPACK_IMPORTED_MODULE_3__.ShimmerElementsDefaultHeights.gap;\n }\n break;\n }\n return element;\n });\n var rowHeight = shimmerElementsDefaulted.reduce(function (acc, next) {\n return next.height ? (next.height > acc ? next.height : acc) : acc;\n }, 0);\n return rowHeight;\n}",
"getHeight() {\n return this._rows.length;\n }",
"get pixelHeight() {\n return this.grid.layout.gridItemHeight;\n }",
"function getHeight(root) {}",
"getWidth() {\n return this._rows\n .map((row) => row.getWidth())\n .reduce((x, y) => Math.max(x, y), 0);\n }"
] |
[
"0.7309251",
"0.720936",
"0.7061328",
"0.6928029",
"0.68662304",
"0.6832829",
"0.67522633",
"0.6693658",
"0.66890943",
"0.6603465",
"0.65717226",
"0.6451369",
"0.63987803",
"0.6397883",
"0.6378977",
"0.63679737",
"0.6314717",
"0.62977296",
"0.62957376",
"0.6290153",
"0.62632734",
"0.6260506",
"0.62545955",
"0.6252732",
"0.6226244",
"0.6214307",
"0.620529",
"0.6204759",
"0.61943924",
"0.6193245"
] |
0.722758
|
1
|
Restores the paddingbottom value to the original for all regions in given row
|
function resetRowsRegionsHeight(row) {
// when called by each, first argument is a number instead of a row value
var row = (typeof row === 'number') ? $(this) : row;
var rowChildren = $(row).children();
for (var x = 0; x < rowChildren.length; x++) {
// reset to 5, the initial value before dragging
$(rowChildren.get(x)).css("padding-bottom", 5);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function resetRowsRegionsHeight(row) {\n // when called by each, first argument is a number instead of a row value\n var row = (typeof row === 'number') ? $(this) : row;\n\n var rowChildren = $(row).children();\n for (var x = 0; x < rowChildren.length; x++) {\n // reset to 5, the initial value before dragging\n $(rowChildren.get(x)).css(\"padding-bottom\", 5);\n }\n }",
"function setRowsRegionsHeight(row, maxHeight) {\n var rowChildren = $(row).children();\n for (var x = 0; x < rowChildren.length; x++) {\n if ($(rowChildren.get(x)).outerHeight() != maxHeight) {\n var defaultPadding = parseInt($(rowChildren.get(x)).css(\"padding-bottom\").replace(\"px\", \"\"));\n $(rowChildren.get(x)).css(\"padding-bottom\", (defaultPadding + maxHeight - $(rowChildren.get(x)).outerHeight()));\n }\n }\n }",
"function setRowsRegionsHeight(row, maxHeight) {\n var rowChildren = $(row).children();\n for (var x = 0; x < rowChildren.length; x++) {\n if ($(rowChildren.get(x)).outerHeight() != maxHeight) {\n var defaultPadding = parseInt($(rowChildren.get(x)).css(\"padding-bottom\").replace(\"px\", \"\"));\n $(rowChildren.get(x)).css(\"padding-bottom\", (defaultPadding + maxHeight - $(rowChildren.get(x)).outerHeight()));\n }\n }\n }",
"function adjustBottomRowRegionsHeight(row) {\n resetRowsRegionsHeight(row);\n var bodyHeight = $('body').outerHeight();\n var windowHeight = $(window).height();\n // Instances where no scroll bar currently exists\n if (windowHeight >= bodyHeight) {\n var pageHeight = $(\"#pageContent\").outerHeight();\n var headerHeight = bodyHeight - pageHeight;\n var upperRegionsMaxHeights = 0;\n if ($(\".upperRow\").length) {\n var rows = $(\".regions\").find(\".upperRow\");\n for (var x = 0; x < rows.length; x++) {\n var rowMaxHeight = getRowRegionsMaxHeight(rows.get(x));\n upperRegionsMaxHeights = upperRegionsMaxHeights + rowMaxHeight;\n }\n }\n // determine maximum size possible for bottom region\n // 50 px of buffer also removed to prevent scroll-bar from appearing in any cases\n var bottomPadding = (windowHeight - 50) - (upperRegionsMaxHeights + headerHeight);\n\n setRowsRegionsHeight(row, bottomPadding);\n }\n // Instances where scroll bar currently exists, can default to upper row behavior\n else {\n adjustUpperRowRegionsHeight(row);\n }\n // refresh sortables cached positions\n getNonLockedRegions().sortable(\"refreshPositions\");\n }",
"function adjustBottomRowRegionsHeight(row) {\n resetRowsRegionsHeight(row);\n var bodyHeight = $('body').outerHeight();\n var windowHeight = $(window).height();\n // Instances where no scroll bar currently exists\n if (windowHeight >= bodyHeight) {\n var pageHeight = $(\"#pageContent\").outerHeight();\n var headerHeight = bodyHeight - pageHeight;\n var upperRegionsMaxHeights = 0;\n if ($(\".upperRow\").length) {\n var rows = $(\".regions\").find(\".upperRow\");\n for (var x = 0; x < rows.length; x++) {\n var rowMaxHeight = getRowRegionsMaxHeight(rows.get(x));\n upperRegionsMaxHeights = upperRegionsMaxHeights + rowMaxHeight;\n }\n }\n // determine maximum size possible for bottom region\n // 50 px of buffer also removed to prevent scroll-bar from appearing in any cases\n var bottomPadding = (windowHeight - 50) - (upperRegionsMaxHeights + headerHeight);\n\n setRowsRegionsHeight(row, bottomPadding);\n }\n // Instances where scroll bar currently exists, can default to upper row behavior\n else {\n adjustUpperRowRegionsHeight(row);\n }\n // refresh sortables cached positions\n getNonLockedRegions().sortable(\"refreshPositions\");\n }",
"function fullWidthRowPaddingAdjustCalc() {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ($('#boxed').length == 0) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$('.full-width-section[data-top-percent], .full-width-section[data-bottom-percent], .full-width-content[data-top-percent], .full-width-content[data-bottom-percent]').each(function () {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tvar $windowHeight = $window.width(),\r\n\t\t\t\t\t\t\t$topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip',\r\n\t\t\t\t\t\t\t$bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip';\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//top\r\n\t\t\t\t\t\t\tif ($topPadding != 'skip') {\r\n\t\t\t\t\t\t\t\t$(this).css('padding-top', $windowHeight * (parseInt($topPadding) / 100));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//bottom\r\n\t\t\t\t\t\t\tif ($bottomPadding != 'skip') {\r\n\t\t\t\t\t\t\t\t$(this).css('padding-bottom', $windowHeight * (parseInt($bottomPadding) / 100));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t}",
"function adjustUpperRowRegionsHeight(row) {\n // when called by each, first argument is a number instead of a row value\n var row = (typeof row === 'number') ? $(this) : row;\n\n resetRowsRegionsHeight(row);\n\n // sets total region height to the height of tallest region\n setRowsRegionsHeight(row, getRowRegionsMaxHeight(row));\n\n // refresh sortables cached positions\n getNonLockedRegions().sortable(\"refreshPositions\");\n }",
"function adjustUpperRowRegionsHeight(row) {\n // when called by each, first argument is a number instead of a row value\n var row = (typeof row === 'number') ? $(this) : row;\n\n resetRowsRegionsHeight(row);\n\n // sets total region height to the height of tallest region\n setRowsRegionsHeight(row, getRowRegionsMaxHeight(row));\n\n // refresh sortables cached positions\n getNonLockedRegions().sortable(\"refreshPositions\");\n }",
"function adjustRowRegionsHeights() {\n // handle region areas for upper rows\n if ($(\".upperRow\").length) {\n var rows = $(\".regions\").find(\".upperRow\");\n rows.each(adjustUpperRowRegionsHeight);\n }\n\n // handle region areas for the bottom row\n if ($(\".bottomRow\").length) {\n var row = $(\".regions\").find(\".bottomRow\");\n adjustBottomRowRegionsHeight(row)\n }\n }",
"function adjustRowRegionsHeights() {\n // handle region areas for upper rows\n if ($(\".upperRow\").length) {\n var rows = $(\".regions\").find(\".upperRow\");\n rows.each(adjustUpperRowRegionsHeight);\n }\n\n // handle region areas for the bottom row\n if ($(\".bottomRow\").length) {\n var row = $(\".regions\").find(\".bottomRow\");\n adjustBottomRowRegionsHeight(row)\n }\n }",
"function fullWidthRowPaddingAdjust() {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (nectarDOMInfo.usingMobileBrowser) {\r\n\t\t\t\t\t\tfullWidthRowPaddingAdjustCalc();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t$window.on('resize', fullWidthRowPaddingAdjustCalc);\r\n\t\t\t\t\t\r\n\t\t\t\t}",
"function cookData(array, rowPadding) {\n\t\t\n\t\tvar prev = {i: 0, h: 0, y: 0};\n\t\tvar first = array[0];\n\t\t\n\t\t// discover custom attributes\n\t\tvar attributes = [];\n\t\tfor(key in first) {\n\t\t\tif(!(key in prev)) {\n\t\t\t\tattributes.push(key);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(var i = 0; i < array.length; i++) {\n\t\t\tvar item = array[i];\n\t\t\t\n\t\t\t// copy attributes forward\n\t\t\tfor(var a = 0; a < attributes.length; a++) {\n\t\t\t\tvar attr = attributes[a];\n\t\t\t\tif(!(attr in item)) {\n\t\t\t\t\titem[attr] = prev[attr];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// copy height forward + ensure requested padding\n\t\t\tif(item.h) {\n\t\t\t\titem.h += rowPadding;\n\t\t\t} else {\n\t\t\t\titem.h = prev.h;\n\t\t\t}\n\t\t\t\n\t\t\t// calculate segment height & spanned indices\n\t\t\tvar span = item.i - prev.i;\n\t\t\titem.y = prev.y + span * prev.h;\n\t\t\t\n\t\t\tprev.last = item.i;\n\t\t\tprev.lastY = item.y;\n\t\t\tprev = item;\n\t\t}\n\t\t\n\t\t// last item needs to be given explicitly\n\t\tvar lastEntry = array[array.length - 1];\n\t\tarray.last = lastEntry.i;\n\t\tlastEntry.last = lastEntry.i + 1;\n\n\t\tvar lastSpan = lastEntry.last - lastEntry.i;\n\t\tvar totalHeight = lastEntry.y + lastEntry.h * lastSpan;\n\t\tlastEntry.lastY = totalHeight;\n\t\t\n\t\treturn totalHeight;\n\t}",
"function convertFrontEndPadding() {\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('.vc_element > .wpb_column[class*=\"padding-\"][class*=\"-percent\"]').each(function() {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tvar $elPaddingPercent = 4;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tvar elclassName = this.className.match(/padding-\\d+/);\r\n\t\t\t\t\t\tif (elclassName) {\r\n\t\t\t\t\t\t\t$elPaddingPercent = elclassName[0].match(/\\d+/);\r\n\t\t\t\t\t\t\tif ($elPaddingPercent) {\r\n\t\t\t\t\t\t\t\t$elPaddingPercent = $elPaddingPercent[0] / 100;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t$elPaddingPercent = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ($elPaddingPercent) {\r\n\t\t\t\t\t\t\tvar $parentRowWidth = $(this).parents('.span_12').width();\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ($(this).is('[data-padding-pos=\"all\"]')) {\r\n\t\t\t\t\t\t\t\t$(this).css('padding', $parentRowWidth * $elPaddingPercent);\r\n\t\t\t\t\t\t\t} else if ($(this).is('[data-padding-pos=\"top\"]')) {\r\n\t\t\t\t\t\t\t\t$(this).css('padding-top', $parentRowWidth * $elPaddingPercent);\r\n\t\t\t\t\t\t\t} else if ($(this).is('[data-padding-pos=\"bottom\"]')) {\r\n\t\t\t\t\t\t\t\t$(this).css('padding-bottom', $parentRowWidth * $elPaddingPercent);\r\n\t\t\t\t\t\t\t} else if ($(this).is('[data-padding-pos=\"left\"]')) {\r\n\t\t\t\t\t\t\t\t$(this).css('padding-left', $parentRowWidth * $elPaddingPercent);\r\n\t\t\t\t\t\t\t} else if ($(this).is('[data-padding-pos=\"right\"]')) {\r\n\t\t\t\t\t\t\t\t$(this).css('padding-right', $parentRowWidth * $elPaddingPercent);\r\n\t\t\t\t\t\t\t} else if ($(this).is('[data-padding-pos=\"top-bottom\"]')) {\r\n\t\t\t\t\t\t\t\t$(this).css({\r\n\t\t\t\t\t\t\t\t\t'padding-top': $parentRowWidth * $elPaddingPercent,\r\n\t\t\t\t\t\t\t\t\t'padding-bottom': $parentRowWidth * $elPaddingPercent,\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t} else if ($(this).is('[data-padding-pos=\"top-right\"]')) {\r\n\t\t\t\t\t\t\t\t$(this).css({\r\n\t\t\t\t\t\t\t\t\t'padding-top': $parentRowWidth * $elPaddingPercent,\r\n\t\t\t\t\t\t\t\t\t'padding-right': $parentRowWidth * $elPaddingPercent,\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t} else if ($(this).is('[data-padding-pos=\"bottom-right\"]')) {\r\n\t\t\t\t\t\t\t\t$(this).css({\r\n\t\t\t\t\t\t\t\t\t'padding-right': $parentRowWidth * $elPaddingPercent,\r\n\t\t\t\t\t\t\t\t\t'padding-bottom': $parentRowWidth * $elPaddingPercent,\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t} else if ($(this).is('[data-padding-pos=\"bottom-left\"]')) {\r\n\t\t\t\t\t\t\t\t$(this).css({\r\n\t\t\t\t\t\t\t\t\t'padding-left': $parentRowWidth * $elPaddingPercent,\r\n\t\t\t\t\t\t\t\t\t'padding-bottom': $parentRowWidth * $elPaddingPercent,\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t} else if ($(this).is('[data-padding-pos=\"left-right\"]')) {\r\n\t\t\t\t\t\t\t\t$(this).css({\r\n\t\t\t\t\t\t\t\t\t'padding-left': $parentRowWidth * $elPaddingPercent,\r\n\t\t\t\t\t\t\t\t\t'padding-right': $parentRowWidth * $elPaddingPercent,\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}); \r\n\t\t\t\t\t\r\n\t\t\t\t\t$('.wpb_row[class*=\"vc_custom_\"]').each(function() {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$(this).parent().addClass('no-bottom-margin');\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t}",
"function outputPaddingAdjuster() {\n if (!tutorialSettings.libraries.turtle && !tutorialSettings.libraries.DOM && !tutorialSettings.libraries.csv && !tutorialSettings.libraries.csvAndTurtle) {\n outputBlock.style.paddingLeft = \"40px\";\n } \n else {\n if($(window).width() < 1183){\n outputBlock.style.paddingLeft = \"40px\";\n }\n }\n}",
"function setPad(reference, target){\n var padAmt=((reference.height() - target.height())/2);\n var styles = {\n \"padding-top\": padAmt,\n \"padding-bottom\": padAmt\n };\n target.css( styles );\n}",
"function applyBottomBorderToGoupedValues() {\n var ss = SpreadsheetApp.getActiveSpreadsheet();\n var sheet = ss.getSheetByName('Master Inventory');\n var numColumns = sheet.getLastColumn();\n \n var columnToSearchZeroIndexed = 0;\n var rowRangesArray = getRowRangesOfGroupedValues(columnToSearchZeroIndexed);\n var numGroups = rowRangesArray.length;\n \n for (var i=0; i < numGroups; i++) {\n var firstTempRow = rowRangesArray[i][0];\n var lastTempRow = rowRangesArray[i][1];\n var numTempRows = lastTempRow - firstTempRow;\n \n var tempRange = sheet.getRange(firstTempRow, columnToSearchZeroIndexed+1, numTempRows+1, numColumns);\n tempRange.setBorder(false, false, true, false, false, false);\n }\n}",
"function calculate_padding() {\n padLeft = Math.floor((display.getWidth() - etch.getWidth()) / 2);\n padTop = Math.floor((display.getHeight() - etch.getHeight() - 5) / 2) + 1;\n}",
"function isPadding(cell) {\n return cell[3];\n }",
"function establecerPaddingLateralContenedor(contenedor, padding) {\r\n\tcontenedor.style.paddingRight = padding;\r\n\tcontenedor.style.paddingLeft = padding;\r\n}",
"pad() {\n const paddedGame = Game.duplicate(this);\n\n // add empty rows to top and bottom of grid\n paddedGame.cells[this.origin.y - 1] = {};\n paddedGame.cells[this.origin.y + this.height] = {};\n\n // update Game dimensions\n paddedGame.width += 2;\n paddedGame.height += 2;\n paddedGame.origin.x--;\n paddedGame.origin.y--;\n\n return paddedGame;\n }",
"getVarPaddingBottom() {\n const {\n delta: {\n total, end, keeps, varLastCalcIndex, varAverSize\n }, size\n } = this;\n const last = total - 1;\n if (total - end <= keeps || varLastCalcIndex === last) {\n return this.getVarOffset(last) - this.getVarOffset(end);\n }\n // if unreached last zone or uncalculate real behind offset\n // return the estimate paddingBottom avoid too much calculate.\n return (total - end) * (varAverSize || size);\n }",
"function pad(img, origRows, origCols) {\n\n var rows = powerOf2(origRows);\n var cols = powerOf2(origCols);\n if (rows > cols) {\n cols = rows;\n } else {\n rows = cols;\n }\n var rowDiff = rows - origRows;\n var colDiff = cols - origCols;\n\n for (var i = 0; i < rows; i++) {\n if (i == origRows) {\n origCols = 0;\n }\n for (var j = origCols; j < cols; j++) {\n if (j == 0) {\n img[i] = [];\n }\n img[i][j] = '0';\n }\n }\n}",
"function removeBorders() {\n for (let i = 0; i < resultingMap.length; i++) {\n for (let j = 0; j < resultingMap[i].length; j++) {\n if (i <= 5 || j <= 5 || i + 5 >= resultingMap.length || j + 5 >= resultingMap[i].length) {\n resultingMap[i][j] = 1.5;\n continue;\n }\n }\n }\n }",
"function BottomEdge() {\n $( \"#target\" ).animate({paddingTop:\"+=310px\"});\n }",
"getMaxBottomCellMargin(row) {\n if (isNullOrUndefined(row.childWidgets)) {\n return 0;\n }\n let value = 0;\n for (let i = 0; i < row.childWidgets.length; i++) {\n let cell = row.childWidgets[i];\n let bottomMargin = 0;\n if (cell.cellFormat.hasValue('bottomMargin')) {\n bottomMargin = HelperMethods.convertPointToPixel(cell.cellFormat.bottomMargin);\n }\n else if (row.rowFormat.hasValue('bottomMargin')) {\n bottomMargin = HelperMethods.convertPointToPixel(row.rowFormat.bottomMargin);\n }\n else {\n bottomMargin = HelperMethods.convertPointToPixel(row.ownerTable.tableFormat.bottomMargin);\n }\n if (bottomMargin > value) {\n value = bottomMargin;\n }\n }\n return value;\n }",
"function setBottomPaddingToZero() {\n\tif (window.innerWidth > 700) {\n\t\tnavigation.style.paddingBottom = \"0%\";\n\t}\n}",
"function fixGap() {\n const navPanel = document.querySelector(`td[valign=\"bottom\"]`);\n navPanel.removeAttribute(\"valign\");\n navPanel.removeAttribute(\"align\");\n}",
"function dropRows() {\n var x, y;\n var bottomEmptyRow = null;\n for (y = 0; y < board.BOARD_HEIGHT; ++y) {\n if (isRowEmpty(y)) {\n // Only set the bottom row if it started out as null\n if (null === bottomEmptyRow) {\n bottomEmptyRow = y;\n }\n } else if (bottomEmptyRow !== null) {\n // move the row down\n for (x = 0; x < board.BOARD_WIDTH; ++x) {\n board.space[x][bottomEmptyRow] = board.space[x][y];\n board.space[x][y] = board.SKY;\n }\n bottomEmptyRow += 1;\n }\n }\n }",
"updateRowHeightByCellSpacing(tableCollection, row, viewer) {\n if (row.ownerTable.tableFormat.cellSpacing > 0) {\n // In the Case of tableWidget is greater than one and rowWidget is start at the Top Position of the page. \n // In such case we have update the row height with half of cell spacing.\n // Remaining cases we have to update the entire hight\n // tslint:disable-next-line:max-line-length\n if (tableCollection.length > 1 && row.y === viewer.clientArea.y && viewer instanceof PageLayoutViewer) {\n row.height = row.height - HelperMethods.convertPointToPixel(row.ownerTable.tableFormat.cellSpacing) / 2;\n }\n }\n }",
"function tw_stretch() {\n var i = $(window).width();\n $(\".row .tw-stretch-element-inside-column\").each(function () {\n var $this = $(this),\n row = $this.closest(\".row\"),\n cols = $this.closest('[class^=\"col-\"]'),\n colsheight = $this.closest('[class^=\"col-\"]').height(),\n rect = this.getBoundingClientRect(),\n l = row[0].getBoundingClientRect(),\n s = cols[0].getBoundingClientRect(),\n r = rect.left,\n d = i - rect.right,\n c = l.left + (parseFloat(row.css(\"padding-left\")) || 0),\n u = i - l.right + (parseFloat(row.css(\"padding-right\")) || 0),\n p = s.left,\n f = i - s.right,\n styles = {\n \"margin-left\": 0,\n \"margin-right\": 0\n };\n if (Math.round(c) === Math.round(p)) {\n var h = parseFloat($this.css(\"margin-left\") || 0);\n styles[\"margin-left\"] = h - r;\n }\n if (Math.round(u) === Math.round(f)) {\n var w = parseFloat($this.css(\"margin-right\") || 0);\n styles[\"margin-right\"] = w - d;\n }\n $this.css(styles);\n });\n }"
] |
[
"0.74660003",
"0.6997538",
"0.6979533",
"0.66051126",
"0.6583506",
"0.620614",
"0.6187582",
"0.6145343",
"0.59674925",
"0.5963164",
"0.59057003",
"0.5684015",
"0.56322247",
"0.55764294",
"0.5542175",
"0.5515858",
"0.54533577",
"0.5434285",
"0.54274756",
"0.54113954",
"0.53829485",
"0.5368706",
"0.535968",
"0.535298",
"0.53249824",
"0.5300434",
"0.52986336",
"0.5284723",
"0.52714247",
"0.5209514"
] |
0.7457637
|
1
|
Sets the paddingbottom value, so that the total height is the given value for all regions in given row
|
function setRowsRegionsHeight(row, maxHeight) {
var rowChildren = $(row).children();
for (var x = 0; x < rowChildren.length; x++) {
if ($(rowChildren.get(x)).outerHeight() != maxHeight) {
var defaultPadding = parseInt($(rowChildren.get(x)).css("padding-bottom").replace("px", ""));
$(rowChildren.get(x)).css("padding-bottom", (defaultPadding + maxHeight - $(rowChildren.get(x)).outerHeight()));
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function setRowsRegionsHeight(row, maxHeight) {\n var rowChildren = $(row).children();\n for (var x = 0; x < rowChildren.length; x++) {\n if ($(rowChildren.get(x)).outerHeight() != maxHeight) {\n var defaultPadding = parseInt($(rowChildren.get(x)).css(\"padding-bottom\").replace(\"px\", \"\"));\n $(rowChildren.get(x)).css(\"padding-bottom\", (defaultPadding + maxHeight - $(rowChildren.get(x)).outerHeight()));\n }\n }\n }",
"function resetRowsRegionsHeight(row) {\n // when called by each, first argument is a number instead of a row value\n var row = (typeof row === 'number') ? $(this) : row;\n\n var rowChildren = $(row).children();\n for (var x = 0; x < rowChildren.length; x++) {\n // reset to 5, the initial value before dragging\n $(rowChildren.get(x)).css(\"padding-bottom\", 5);\n }\n }",
"function resetRowsRegionsHeight(row) {\n // when called by each, first argument is a number instead of a row value\n var row = (typeof row === 'number') ? $(this) : row;\n\n var rowChildren = $(row).children();\n for (var x = 0; x < rowChildren.length; x++) {\n // reset to 5, the initial value before dragging\n $(rowChildren.get(x)).css(\"padding-bottom\", 5);\n }\n }",
"function adjustBottomRowRegionsHeight(row) {\n resetRowsRegionsHeight(row);\n var bodyHeight = $('body').outerHeight();\n var windowHeight = $(window).height();\n // Instances where no scroll bar currently exists\n if (windowHeight >= bodyHeight) {\n var pageHeight = $(\"#pageContent\").outerHeight();\n var headerHeight = bodyHeight - pageHeight;\n var upperRegionsMaxHeights = 0;\n if ($(\".upperRow\").length) {\n var rows = $(\".regions\").find(\".upperRow\");\n for (var x = 0; x < rows.length; x++) {\n var rowMaxHeight = getRowRegionsMaxHeight(rows.get(x));\n upperRegionsMaxHeights = upperRegionsMaxHeights + rowMaxHeight;\n }\n }\n // determine maximum size possible for bottom region\n // 50 px of buffer also removed to prevent scroll-bar from appearing in any cases\n var bottomPadding = (windowHeight - 50) - (upperRegionsMaxHeights + headerHeight);\n\n setRowsRegionsHeight(row, bottomPadding);\n }\n // Instances where scroll bar currently exists, can default to upper row behavior\n else {\n adjustUpperRowRegionsHeight(row);\n }\n // refresh sortables cached positions\n getNonLockedRegions().sortable(\"refreshPositions\");\n }",
"function adjustBottomRowRegionsHeight(row) {\n resetRowsRegionsHeight(row);\n var bodyHeight = $('body').outerHeight();\n var windowHeight = $(window).height();\n // Instances where no scroll bar currently exists\n if (windowHeight >= bodyHeight) {\n var pageHeight = $(\"#pageContent\").outerHeight();\n var headerHeight = bodyHeight - pageHeight;\n var upperRegionsMaxHeights = 0;\n if ($(\".upperRow\").length) {\n var rows = $(\".regions\").find(\".upperRow\");\n for (var x = 0; x < rows.length; x++) {\n var rowMaxHeight = getRowRegionsMaxHeight(rows.get(x));\n upperRegionsMaxHeights = upperRegionsMaxHeights + rowMaxHeight;\n }\n }\n // determine maximum size possible for bottom region\n // 50 px of buffer also removed to prevent scroll-bar from appearing in any cases\n var bottomPadding = (windowHeight - 50) - (upperRegionsMaxHeights + headerHeight);\n\n setRowsRegionsHeight(row, bottomPadding);\n }\n // Instances where scroll bar currently exists, can default to upper row behavior\n else {\n adjustUpperRowRegionsHeight(row);\n }\n // refresh sortables cached positions\n getNonLockedRegions().sortable(\"refreshPositions\");\n }",
"getVarPaddingBottom() {\n const {\n delta: {\n total, end, keeps, varLastCalcIndex, varAverSize\n }, size\n } = this;\n const last = total - 1;\n if (total - end <= keeps || varLastCalcIndex === last) {\n return this.getVarOffset(last) - this.getVarOffset(end);\n }\n // if unreached last zone or uncalculate real behind offset\n // return the estimate paddingBottom avoid too much calculate.\n return (total - end) * (varAverSize || size);\n }",
"function setPad(reference, target){\n var padAmt=((reference.height() - target.height())/2);\n var styles = {\n \"padding-top\": padAmt,\n \"padding-bottom\": padAmt\n };\n target.css( styles );\n}",
"function adjustRowRegionsHeights() {\n // handle region areas for upper rows\n if ($(\".upperRow\").length) {\n var rows = $(\".regions\").find(\".upperRow\");\n rows.each(adjustUpperRowRegionsHeight);\n }\n\n // handle region areas for the bottom row\n if ($(\".bottomRow\").length) {\n var row = $(\".regions\").find(\".bottomRow\");\n adjustBottomRowRegionsHeight(row)\n }\n }",
"function adjustRowRegionsHeights() {\n // handle region areas for upper rows\n if ($(\".upperRow\").length) {\n var rows = $(\".regions\").find(\".upperRow\");\n rows.each(adjustUpperRowRegionsHeight);\n }\n\n // handle region areas for the bottom row\n if ($(\".bottomRow\").length) {\n var row = $(\".regions\").find(\".bottomRow\");\n adjustBottomRowRegionsHeight(row)\n }\n }",
"function fullWidthRowPaddingAdjustCalc() {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ($('#boxed').length == 0) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$('.full-width-section[data-top-percent], .full-width-section[data-bottom-percent], .full-width-content[data-top-percent], .full-width-content[data-bottom-percent]').each(function () {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tvar $windowHeight = $window.width(),\r\n\t\t\t\t\t\t\t$topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip',\r\n\t\t\t\t\t\t\t$bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip';\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//top\r\n\t\t\t\t\t\t\tif ($topPadding != 'skip') {\r\n\t\t\t\t\t\t\t\t$(this).css('padding-top', $windowHeight * (parseInt($topPadding) / 100));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//bottom\r\n\t\t\t\t\t\t\tif ($bottomPadding != 'skip') {\r\n\t\t\t\t\t\t\t\t$(this).css('padding-bottom', $windowHeight * (parseInt($bottomPadding) / 100));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t}",
"function adjustUpperRowRegionsHeight(row) {\n // when called by each, first argument is a number instead of a row value\n var row = (typeof row === 'number') ? $(this) : row;\n\n resetRowsRegionsHeight(row);\n\n // sets total region height to the height of tallest region\n setRowsRegionsHeight(row, getRowRegionsMaxHeight(row));\n\n // refresh sortables cached positions\n getNonLockedRegions().sortable(\"refreshPositions\");\n }",
"set height(value) {}",
"function addItemHeight(element) {\n\t\t//get key dimensions to calculate height\n\t\tlet dimensions = [\n\t\t\tparseInt(window.getComputedStyle(element, null).getPropertyValue('margin-top')),\n\t\t\tparseInt(window.getComputedStyle(element, null).getPropertyValue('margin-bottom')),\n\t\t\tparseInt(window.getComputedStyle(element, null).getPropertyValue('padding-top')),\n\t\t\tparseInt(window.getComputedStyle(element, null).getPropertyValue('padding-bottom')),\n\t\t\tparseInt(window.getComputedStyle(element, null).getPropertyValue('height'))\n\t\t];\n\t\titemHeight += arraySum(dimensions);\n\t}",
"function adjustUpperRowRegionsHeight(row) {\n // when called by each, first argument is a number instead of a row value\n var row = (typeof row === 'number') ? $(this) : row;\n\n resetRowsRegionsHeight(row);\n\n // sets total region height to the height of tallest region\n setRowsRegionsHeight(row, getRowRegionsMaxHeight(row));\n\n // refresh sortables cached positions\n getNonLockedRegions().sortable(\"refreshPositions\");\n }",
"function applyTemplateNewLineHeight(item) {\n // the height seems to be calculated by the template row count (how many line of items does the template have)\n var rowCount = _options.panelRows;\n\n //calculate padding requirements based on detail-content..\n //ie. worst-case: create an invisible dom node now &find it's height.\n var lineHeight = 13; //we know cuz we wrote the custom css innit ;)\n item._sizePadding = Math.ceil(((rowCount * 2) * lineHeight) / _grid.getOptions().rowHeight);\n item._height = (item._sizePadding * _grid.getOptions().rowHeight);\n\n var idxParent = _dataView.getIdxById(item.id);\n for (var idx = 1; idx <= item._sizePadding; idx++) {\n _dataView.insertItem(idxParent + idx, getPaddingItem(item, idx));\n }\n }",
"function cookData(array, rowPadding) {\n\t\t\n\t\tvar prev = {i: 0, h: 0, y: 0};\n\t\tvar first = array[0];\n\t\t\n\t\t// discover custom attributes\n\t\tvar attributes = [];\n\t\tfor(key in first) {\n\t\t\tif(!(key in prev)) {\n\t\t\t\tattributes.push(key);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(var i = 0; i < array.length; i++) {\n\t\t\tvar item = array[i];\n\t\t\t\n\t\t\t// copy attributes forward\n\t\t\tfor(var a = 0; a < attributes.length; a++) {\n\t\t\t\tvar attr = attributes[a];\n\t\t\t\tif(!(attr in item)) {\n\t\t\t\t\titem[attr] = prev[attr];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// copy height forward + ensure requested padding\n\t\t\tif(item.h) {\n\t\t\t\titem.h += rowPadding;\n\t\t\t} else {\n\t\t\t\titem.h = prev.h;\n\t\t\t}\n\t\t\t\n\t\t\t// calculate segment height & spanned indices\n\t\t\tvar span = item.i - prev.i;\n\t\t\titem.y = prev.y + span * prev.h;\n\t\t\t\n\t\t\tprev.last = item.i;\n\t\t\tprev.lastY = item.y;\n\t\t\tprev = item;\n\t\t}\n\t\t\n\t\t// last item needs to be given explicitly\n\t\tvar lastEntry = array[array.length - 1];\n\t\tarray.last = lastEntry.i;\n\t\tlastEntry.last = lastEntry.i + 1;\n\n\t\tvar lastSpan = lastEntry.last - lastEntry.i;\n\t\tvar totalHeight = lastEntry.y + lastEntry.h * lastSpan;\n\t\tlastEntry.lastY = totalHeight;\n\t\t\n\t\treturn totalHeight;\n\t}",
"function getBottom(col) {\r\n\treturn (field[col].length - 1) * rowheight;\r\n}",
"function calculate_padding() {\n padLeft = Math.floor((display.getWidth() - etch.getWidth()) / 2);\n padTop = Math.floor((display.getHeight() - etch.getHeight() - 5) / 2) + 1;\n}",
"setHeight(_height) {\n this.bottom = this.top + _height;\n this.updateSecondaryValues();\n return this;\n }",
"function BottomEdge() {\n $( \"#target\" ).animate({paddingTop:\"+=310px\"});\n }",
"function footer_at_bottom() {\n\n var winWidth = $(window).width();\n var $footer = $('#footer');\n var $wrapper = $('#wrapper');\n var $footer_height = $footer.height();\n\n winWidth >= 960 ? $wrapper.css('paddingBottom',$footer_height) : $wrapper.css('paddingBottom',0)\n\n\n }",
"getMaxBottomCellMargin(row) {\n if (isNullOrUndefined(row.childWidgets)) {\n return 0;\n }\n let value = 0;\n for (let i = 0; i < row.childWidgets.length; i++) {\n let cell = row.childWidgets[i];\n let bottomMargin = 0;\n if (cell.cellFormat.hasValue('bottomMargin')) {\n bottomMargin = HelperMethods.convertPointToPixel(cell.cellFormat.bottomMargin);\n }\n else if (row.rowFormat.hasValue('bottomMargin')) {\n bottomMargin = HelperMethods.convertPointToPixel(row.rowFormat.bottomMargin);\n }\n else {\n bottomMargin = HelperMethods.convertPointToPixel(row.ownerTable.tableFormat.bottomMargin);\n }\n if (bottomMargin > value) {\n value = bottomMargin;\n }\n }\n return value;\n }",
"function lnhgt(){\n var lnhite = Math.round((($( window ).height())/3)-50);\n$('.linespace').css('height', lnhite);\n\n}",
"function calcBoxHeight(data) {\n const line_height =\n (LINE_HEIGHT + LINE_VERTICAL_PAD) * data.lines.length + LINE_VERTICAL_PAD;\n // 4 lines means 5 paddings -> n lines means n+1 pads -> + LINE_VERTICAL_PAD\n return line_height;\n}",
"get yAxisAnnotationPaddingBottom() {\r\n return this.i.nl;\r\n }",
"get fixedBottomGap() { return this._fixedBottomGap; }",
"function setBottomPaddingToZero() {\n\tif (window.innerWidth > 700) {\n\t\tnavigation.style.paddingBottom = \"0%\";\n\t}\n}",
"function giveFooterSomeRoom() {\n footer = $('footer#footer');\n padding = footer.outerHeight();\n $('body').css('padding-bottom',padding);\n // console.log('padding applied');\n }",
"function adjustCanvasHeight( callback )\n{\n\t$( \".content\" ).css( \"padding-bottom\", \"50px\" );\n\t$( \".content\" ).css( \"height\", \"auto\" );\n\tcallback();\n}",
"get xAxisAnnotationPaddingBottom() {\r\n return this.i.ng;\r\n }"
] |
[
"0.68334526",
"0.6578797",
"0.6561409",
"0.630481",
"0.6295874",
"0.5793617",
"0.56938",
"0.5602352",
"0.5601591",
"0.55623657",
"0.55230147",
"0.55177695",
"0.54822874",
"0.54765254",
"0.5461051",
"0.5428732",
"0.5417098",
"0.5392952",
"0.53739333",
"0.5355399",
"0.5340248",
"0.5331257",
"0.5323316",
"0.5305571",
"0.5301572",
"0.52733046",
"0.52558535",
"0.52530986",
"0.52315515",
"0.52279156"
] |
0.6856896
|
0
|
Takes care of the UI part of the widget rendering. Depends heavily on the HTML structure
|
function initWidgetUI() {
$(".widget-wrapper").each(function () {
var widgetId = extractObjectIdFromElementId($(this).attr("id"));
styleWidgetButtons(widgetId);
});
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function initHtml () {\n\t\t\t$container.addClass(\"ibm-widget-processed\");\n\n\t\t\tif (config.type === \"simple\") {\n\t\t\t\t$hideables.addClass(\"ibm-hide\");\n\t\t\t}\n\n\t\t\tif (config.type === \"panel\") {\n\t\t\t\t$headings.removeClass(\"ibm-active\");\n\t\t\t\t$containers.slideUp(slideupSpeed);\n\t\t\t}\n\t\t}",
"initHtml() {\n\t\tlet cx = name => className(name, this.service);\n\t\tlet widget = this.widget;\n\t\tlet options = this.options;\n\n\t\t// Remove existing class (.facebook) with a proper one\n\t\twidget.classList.remove(this.service);\n\t\tcx('widget').split(' ').forEach(cls => widget.classList.add(cls));\n\n\t\t// Button:\n\t\t// 1. Normal button with <button> tag.\n\t\t// 2. Link <a> if the service has the clickUrl option.\n\t\t// 3. Link <a> with .social-likes__invisible-button class if has clickUrl option but widget markup has no text.\n\t\t// 4. No button if there’s no text in the markup and no clickUrl option.\n\t\tlet buttonHtml = '';\n\t\tlet oldHtml = widget.innerHTML.trim();\n\t\tif (options.clickUrl || oldHtml) {\n\t\t\tlet buttonTag = 'div';\n\t\t\tlet buttonHref = '';\n\t\t\tlet buttonClasses = cx('button');\n\t\t\tif (options.clickUrl) {\n\t\t\t\tlet url = this.makeUrl(options.clickUrl);\n\t\t\t\tbuttonTag = 'a';\n\t\t\t\tbuttonHref = `href=\"${url}\"`;\n\t\t\t\tif (!oldHtml) {\n\t\t\t\t\tbuttonClasses = cx('invisible-button');\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuttonHtml = `\n\t\t\t\t<${buttonTag} ${buttonHref} class=\"${buttonClasses}\">\n\t\t\t\t\t${oldHtml}\n\t\t\t\t</${buttonTag}>\n\t\t\t`;\n\t\t}\n\t\telse {\n\t\t\twidget.classList.add(className('widget_notext'));\n\t\t}\n\n\t\t// Icon\n\t\tlet svgHtml = svg(this.options.icon, cx('icon'));\n\n\t\twidget.innerHTML = svgHtml + buttonHtml;\n\t}",
"render() {\r\n document.body.insertBefore(this.element, document.querySelector('script'));\r\n\r\n this.append(this.PageContent.element, [this.NewsList, this.Footer]);\r\n this.append(this.Sidebar.element, [this.SidebarTitle, this.SourcesList]);\r\n this.append(this.element, [this.Spinner, this.PageContent, this.Sidebar, this.ToggleBtn]);\r\n }",
"render() {\n this._addChooserHandler();\n this._addLoggerListeners();\n this._addButtonHandler();\n }",
"function buildUI(){\t\n\t\t\n\t\treturn;\n\t\t\n\t}",
"render(){\n\t\tif(this.has_elements){\n\t\t\tthis.$title.html(this.form_data.title);\n\t\t\tthis.$pb_form.hide();\n\t\t\tthis.create_reset_button();\n\t\t\tthis.create_submit_button();\n\t\t\tthis.$content_container.append(this.$wrapper);\n\t\t}\n\t}",
"_render()\n {\n if (this.isDisabled())\n return;\n\n this._setContentSizeCss();\n this._setDirection();\n const paragraph = html`<p>${this.text}</p>`;\n let anchor = \"\";\n let action = \"\";\n if (this.link && this.linkText)\n anchor = html`<a href=\"${this.link}\" target=\"_blank\">${this.linkText}</a>`;\n if (this.action && this.actionText)\n action = html`${anchor ? \" | \" : \"\"}<a href=\"javascript:void(0)\" @click=${this.action}>${this.actionText}</a>`;\n let heading = \"\";\n if (this.heading)\n heading = html`<h4>${this.heading}</h4>`;\n\n render(html`${heading}${paragraph}<div id=\"links\">${anchor}${action}</div>`, this.tooltipElem);\n }",
"function initHtml () {\n\t\t\t$container.addClass(\"ibm-widget-processed\");\n\n\t\t\t$listItems = $container.find(\"li\");\n\t\t\t\n\t\t\t$listItems.each(function () {\n\t\t\t\tvar $li = $(this);\n\n\t\t\t\t// If they coded the HTML with the new way (don't put the link in there), add it.\n\t\t\t\tif ($(\" > a.ibm-twisty-trigger\", $li).length === 0 && $(\" > .ibm-twisty-head\", $li).length === 1){\n\t\t\t\t\t$li.prepend(twistyTriggerHtml);\n\t\t\t\t}\n\n\t\t\t\t// Now adjust the HTML for the v18 way to make the twisty link/control\n\t\t\t\t$(\" > a.ibm-twisty-trigger\", $li).html($(\" > .ibm-twisty-head\", $li).html());\n\t\t\t\t$(\" > .ibm-twisty-head\", $li).remove();\n\n\t\t\t\tif ($li.data(\"open\") !== true) {\n\t\t\t\t\tcollapse($li);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\texpand($li);\n\t\t\t\t}\n\t\t\t});\t\t\t\n\t\t}",
"_render(html){this.$.container.innerHTML=html}",
"_render() {\n\n this._el.innerHTML = `\n <div class='itk-slider'>\n <button class='show-prev-btn'> left </button>\n <img class='slide-img' src=''>\n <button class='show-next-btn'> right </button>\n </div>`;\n\n this.showPrevBtn = this._el.querySelector('.show-prev-btn');\n this.showNextBtn = this._el.querySelector('.show-next-btn');\n this.slideImage = this._el.querySelector('.slide-img');\n }",
"renderHTML() {\n \n }",
"onAfterRendering() {}",
"render() {\n this._userEvent('beforeRender');\n const html = this.template.render({data: this.viewData}, (data) => {\n return this.wrapTemplate(data);\n });\n if (!this.wrapper) {\n this.wrapper = this._createWrapper();\n }\n this.updateNode(this.wrapper, html);\n this.resize();\n this._userEvent('afterRender');\n }",
"render() {\n this.widgets.forEach((widget) => {\n widget.render();\n });\n }",
"_drawUi() {\n\t\tthis.elementReplyForm.reset()\n\t\tthis.elementEditForm.reset()\n\t\tif(this.commentJSON.removed)\n\t\t\tthis._drawRemoved()\n\t\telse if(getToken())\n\t\t\tthis._drawUiAuthenticated()\n\t\telse\n\t\t\tthis._drawUiAnonymous()\n\t}",
"function HTMLUI () {}",
"render(){\n //createDom (tag, type, name, value, domClass, id, parent)\n this.containerDom = this.htmlHelper.createDom('div', this.parentDom,this.domClass + '_conatiner')\n this.dom = this.htmlHelper.createDom('canvas', this.containerDom);\n this.dom.style.touchAction=\"none\"; // prevent default browser actions\n\n this.setContextData(this.defaultLineWidth, '#000000')\n }",
"function _doIt(inWidget) {\r\n\t\t\t\t\tvar subWidgets, container, labelObj, anArray, anObject, aProperty, aValue;\r\n\r\n\t\t\t\t\tif (inWidget) {\r\n\t\t\t\t\t\tswitch (inWidget.kind) {\r\n\t\t\t\t\t\tcase 'dataGrid':\r\n\t\t\t\t\t\t\tinWidget.columns().forEach(function(inColumn) {\r\n\t\t\t\t\t\t\t\tinColumn.title = _getLocalizedValue(inColumn.title);\r\n\t\t\t\t\t\t\t\tinColumn.gridview._private.globals.headerContainerNode.cells[inColumn.columnNumber].title.html(inColumn.title);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase 'autoForm':\r\n\t\t\t\t\t\tcase 'queryForm':\r\n\t\t\t\t\t\t\t// Hum, the autoForm class can be used for an autoForm or a queryForm...\r\n\t\t\t\t\t\t\tanArray = $('#' + inWidget.id + ' .waf-form-att-label-text');\r\n\t\t\t\t\t\t\tif (anArray.length > 0) { // We have a true autoform\r\n\t\t\t\t\t\t\t\tfor (i = 0, max = anArray.length; i < max; i++) {\r\n\t\t\t\t\t\t\t\t\tanObject = anArray[i];\r\n\t\t\t\t\t\t\t\t\tanObject.innerText = _getLocalizedValue(anObject.innerText);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tanArray = $('#' + inWidget.id + ' .attribute-div');\r\n\t\t\t\t\t\t\t\tif (anArray.length > 0) { // We have a queryform\r\n\t\t\t\t\t\t\t\t\tfor (i = 0, max = anArray.length; i < max; i++) {\r\n\t\t\t\t\t\t\t\t\t\tanObject = anArray[i];\r\n\t\t\t\t\t\t\t\t\t\tanObject.innerText = _getLocalizedValue(anObject.innerText);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tcase 'login':\r\n\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\tlabels: Object\r\n\t\t\t\t\t\t\t\tloginAction: \"Login\"\r\n\t\t\t\t\t\t\t\tloginButton: \"Login\"\r\n\t\t\t\t\t\t\t\tloginTitle: \"Login Dialog\"\r\n\t\t\t\t\t\t\t\tlogoutAction: \"Logout\"\r\n\t\t\t\t\t\t\t\tnoUserDisplay: \"\"\r\n\t\t\t\t\t\t\t\tpasswordLabel: \"Password: \"\r\n\t\t\t\t\t\t\t\tuserDisplay: \"Signed in as \"\r\n\t\t\t\t\t\t\t\tuserLabel: \"User:\r\n\t\t\t\t\t\t\t*/\r\n\t\t\t\t\t\t\tif(inWidget.labels) {\r\n\t\t\t\t\t\t\t\tfor(aProperty in inWidget.labels) {\r\n\t\t\t\t\t\t\t\t\taValue = inWidget.labels[aProperty];\r\n\t\t\t\t\t\t\t\t\tif(aValue && typeof aValue === 'string') {\r\n\t\t\t\t\t\t\t\t\t\tinWidget.labels[aProperty] = _getLocalizedValue(aValue);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tinWidget.refresh();\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\tsubWidgets = null;\r\n\t\t\t\t\t\t\t// Every menuItem of a menuBar is part of WAF.widgets => we don't\r\n\t\t\t\t\t\t\t// need to handle them separatly with getChildren()\r\n\t\t\t\t\t\t\tif (inWidget.kind !== 'menuBar') {\r\n\t\t\t\t\t\t\t\tsubWidgets = inWidget.getChildren();\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif (subWidgets && subWidgets.length > 0) {\r\n\t\t\t\t\t\t\t\tsubWidgets.forEach(function(inSubWidget) {\r\n\t\t\t\t\t\t\t\t\t_doIt(inSubWidget);\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tswitch (inWidget.kind) {\r\n\t\t\t\t\t\t\t\tcase 'button':\r\n\t\t\t\t\t\t\t\tcase 'label':\r\n\t\t\t\t\t\t\t\tcase 'richText':\r\n\t\t\t\t\t\t\t\t\tinWidget.setValue(_getLocalizedValue(inWidget.getValue()));\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t\tcase 'menuItem':\r\n\t\t\t\t\t\t\t\t\tdebugger;\r\n\t\t\t\t\t\t\t\t\tinWidget.domNode.innerText = _getLocalizedValue(inWidget.domNode.innerText);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tif (inWidget.getLabel) {\r\n\t\t\t\t\t\t\t\t\tlabelObj = inWidget.getLabel();\r\n\t\t\t\t\t\t\t\t\tif (labelObj) {\r\n\t\t\t\t\t\t\t\t\t\tlabelObj.setValue(_getLocalizedValue(labelObj.getValue()));\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tif (inWidget.domNode && inWidget.domNode.placeholder) {\r\n\t\t\t\t\t\t\t\t\tinWidget.domNode.placeholder = _getLocalizedValue(inWidget.domNode.placeholder);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}",
"render(){if(this.renderer){this.renderer.call(this.owner,this.content,this.owner,this.model)}}",
"static rendered () {}",
"static rendered () {}",
"render() {\n // Subclasses should override\n }",
"render() {\n super.render();\n this._outputView = new OutputArea({\n rendermime: renderMime,\n contentFactory: OutputArea.defaultContentFactory,\n model: this.model.outputs\n });\n this.pWidget.insertWidget(0, this._outputView);\n\n this.pWidget.addClass('jupyter-widgets');\n this.pWidget.addClass('widget-output');\n this.update(); // Set defaults.\n }",
"function buildUI() {\n setPageTitle();\n showMessageFormIfViewingSelf();\n fillMap();\n fetchLanguage();\n getInfo();\n// buildLanguageLinks();\n}",
"function render() {\n\n\t\t\t}",
"render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }",
"render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }",
"render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }",
"function createWidget(html, $original_select) {\n //\n // setup the part_ variables:\n //\n var html_dom = $.parseHTML(html);\n var $part_main = $(\".part_main\", html_dom).first();\n var $part_text = $(\".part_text\", html_dom).first();\n var $part_popup = $(\".part_popup\", html_dom).first();\n //\n // fill the popup list:\n //\n $(\"> option\", $original_select).each(function (index, element) {\n $part_popup.append('<li data-index=\"' + index + '\">' + $(element).text() + '</li>');\n });\n var $popup_items = $(\"> li\", $part_popup);\n //\n // setup the initial selected index:\n //\n setIndex(getOriginalSelectedIndex());\n\n //\n // to adjust the widget when inserted into the page DOM:\n //\n\n function adjust() {\n // adjust the width:\n adjust_main_width();\n // close the popup\n $part_popup.slideUp(0);\n }\n\n $(window).on(\"load\", function () {\n adjust_main_width();\n });\n\n function adjust_main_width() {\n var main_width = $part_main.width();\n var main_innerWidth = $part_main.innerWidth();\n var main_outerWidth = $part_main.outerWidth();\n //\n if ((main_width === main_innerWidth) && (main_width === main_outerWidth)) {\n return; // Chrome, Firefox, Safary: adjust() call when the DOM is not good yet\n }\n //\n var popup_width = $part_popup.width();\n var popup_outerWidth = $part_popup.outerWidth();\n //\n var main_delta = main_outerWidth - main_width;\n var popup_delta = popup_outerWidth - popup_width;\n //\n if ((main_width + main_delta) < popup_outerWidth) {\n $part_main.width(popup_outerWidth - main_delta);\n } else {\n $part_popup.width(main_outerWidth - popup_delta);\n }\n }\n\n //\n // setup the UI event handlers:\n //\n\n $original_select.change(function () {\n setIndex(getOriginalSelectedIndex());\n });\n\n $part_main.click(function () {\n $part_main.focus();\n toggle();\n });\n\n $part_main.blur(function () {\n close();\n });\n\n $part_main.keydown(function (event) {\n var Key = { Space: 32, Esc: 27, Enter: 13, Left: 37, Up: 38, Right: 39, Down: 40, PgUp: 33, PgDn: 34, Home: 36, End: 35 };\n //\n switch (event.which) {\n case Key.Space: open(); break;\n case Key.Esc: close(); break;\n case Key.Enter: close(); break;\n case Key.Home: goFirst(); break;\n case Key.PgUp: goFirst(); break;\n case Key.End: goLast(); break;\n case Key.PgDn: goLast(); break;\n case Key.Left: goPrev(); break;\n case Key.Right: goNext(); break;\n case Key.Up: if (event.altKey) { open(); } else { goPrev(); } break;\n case Key.Down: if (event.altKey) { open(); } else { goNext(); } break;\n }\n });\n\n $part_popup.on(\"click\", \"li\", function () {\n var index = Number($(this).attr(\"data-index\"));\n setIndex(index);\n $part_main.focus();\n });\n\n //\n // utility functions:\n //\n\n function getOriginalSelectedIndex() {\n return $original_select.prop(\"selectedIndex\");\n }\n\n function setOriginalSelectedIndex(value) {\n $original_select.prop(\"selectedIndex\", value);\n }\n\n function setIndex(index) {\n setOriginalSelectedIndex(index);\n //\n $popup_items.removeClass(\"selected\");\n if (index >= 0) {\n var $item = $popup_items.eq(index);\n $item.addClass(\"selected\");\n $part_text.text($item.text());\n }\n };\n\n function goPrev() {\n var index = getOriginalSelectedIndex();\n if (index > 0) setIndex(index - 1);\n }\n\n function goNext() {\n var index = getOriginalSelectedIndex();\n if (index < $popup_items.length - 1) setIndex(index + 1);\n }\n\n function goFirst() {\n setIndex(0);\n }\n\n function goLast() {\n setIndex($popup_items.length - 1);\n }\n\n function open() {\n $part_main.addClass(\"open\");\n $part_popup.slideDown(\"slow\");\n }\n\n function close() {\n $part_popup.slideUp(\"slow\", function () { $part_main.removeClass(\"open\"); });\n }\n\n function toggle() {\n if ($part_main.hasClass(\"open\")) {\n close();\n } else {\n open();\n }\n }\n\n //\n // return the widget object:\n //\n\n return { dom: html_dom, adjust: adjust };\n }",
"_render() {\n const loaderInner = htmlHelper.createDivWithClass('');\n this.loader.appendChild(loaderInner);\n }"
] |
[
"0.70765686",
"0.6610348",
"0.656258",
"0.6483031",
"0.6406047",
"0.63583994",
"0.62854594",
"0.62382495",
"0.6182108",
"0.61615986",
"0.61559427",
"0.6122311",
"0.61053365",
"0.6097434",
"0.6077922",
"0.6069247",
"0.6061592",
"0.603879",
"0.60316366",
"0.6028217",
"0.6028217",
"0.6007857",
"0.5997669",
"0.59916306",
"0.59791684",
"0.5968563",
"0.5968563",
"0.5968563",
"0.5939491",
"0.59242326"
] |
0.6849971
|
1
|
Utility function to generate the html label for a userPref based on if it is required or not
|
function generatePrefLabelMarkup(userPref) {
var markup = [];
var prefLabel = (userPref.required) ? "* " + userPref.displayName : userPref.displayName;
markup.push("<td class='");
markup.push(WIDGET_PREFS_LABEL_CLASS);
if (userPref.required) {
markup.push(" ");
markup.push(WIDGET_PREFS_LABEL_REQUIRED_CLASS);
}
markup.push("'>");
markup.push(prefLabel);
markup.push("</td>");
return markup.join("");
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function generatePrefInputClassMarkup(userPref) {\n var markup = [];\n markup.push(WIDGET_PREFS_INPUT_CLASS);\n if (userPref.required) {\n markup.push(\" \");\n markup.push(WIDGET_PREFS_INPUT_REQUIRED_CLASS);\n }\n return markup.join(\"\");\n }",
"function checkLabel(name, value) {\n let input = doc.querySelector(`.shortcut-input[name=\"${name}\"]`);\n let label = input.previousElementSibling;\n if (label.dataset.l10nId) {\n is(label.dataset.l10nId, value, \"The l10n-id is set\");\n } else {\n is(label.textContent, value, \"The textContent is set\");\n }\n }",
"function SP_RequiredLabelToggle(labelId,setRequired)\n{\n\tif(arguments.length > 2)\n\t{\n\t\tvar label = $('label[for='+labelId+']');\n\t\tif(setRequired == true)\n\t\t{\n\t\t\tif(label.text().indexOf(\"*\") == -1)\n\t\t\t{\n\t\t\t\tlabel.text(\"* \"+ label.text());\n\t\t\t\tlabel.addClass(\"dynamicRequiredLabel\");\n\t\t\t}\n\t\t}\n\t\telse if(setRequired == false)\n\t\t{\n\t\t\tif(label.text().indexOf(\"*\") == 0)\n\t\t\t{\n\t\t\t\tlabel.text(label.text().split(\"*\")[1]);\n\t\t\t\tlabel.removeClass(\"dynamicRequiredLabel\");\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(setRequired == true && SP_HasClass(document.getElementById(labelId),'dynamicLabel'))\n\t\t{\n\t\t\tdocument.getElementById(labelId).innerHTML = \"* \"+document.getElementById(labelId).innerHTML;\n\t\t\tSP_RemoveClass(document.getElementById(labelId),\"dynamicLabel\");\n\t\t\tSP_AddClass(document.getElementById(labelId),\"dynamicRequiredLabel\");\n\t\t}\n\t\telse if(setRequired == false && SP_HasClass(document.getElementById(labelId),'dynamicRequiredLabel'))\n\t\t{\n\t\t\tdocument.getElementById(labelId).innerHTML = document.getElementById(labelId).innerHTML.slice(1);\n\t\t\tSP_AddClass(document.getElementById(labelId),\"dynamicLabel\");\n\t\t\tSP_RemoveClass(document.getElementById(labelId),\"dynamicRequiredLabel\");\n\t\t}\n\t}\n}",
"function tabLabelUpdateHTML() {\n var profileStore = retrieveProfileInfo();\n var userStyle = profileStore.style;\n var userVenue = profileStore.venue;\n if (userVenue === \"Indoor\") {\n $(\"#routes-tab\").text(\"GYMS\");\n } else if (userStyle === \"Boulder\") {\n $(\"#routes-tab\").text(\"PROBLEMS\");\n }\n}",
"function FieldLabel({ model }) {\n const { label, isMandatory } = model;\n\n if (!label || label.length === 0) {\n return null;\n }\n return (\n <div className=\"ff-field-label\" >\n {label}\n {(isMandatory) && (\n <span className=\"ff-field-mandatory\">*</span>\n )}\n </div>\n );\n}",
"getFormLabelContent() {\n\t\tif (this.props.textDictionary.labelText && this.props.textDictionary.labelText.length !== 0) {\n\t\t\treturn (\n\t\t\t\t<label className={ClassNameUtil.getClassNames(['fbra_passwordFormInput_label', 'fbra_test_passwordFormInput_label'])}>{this.props.textDictionary.labelText}</label>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t}",
"static get LABEL_NONE () {return 'none';}",
"label (valueName, postValue, postLabel) {\n let value = ''\n\n try {\n value = this.tags[valueName]\n } catch (error) {\n\n }\n\n if (!value) { return '' }\n // look for any overrides or improvements and apply them if found\n let dataImprovement = dataImprover[valueName]\n let prettyLabel, prettyValue\n // let improverType = typeof (dataImprovement)\n switch (typeof (dataImprovement)) {\n case 'string':\n prettyLabel = dataImprovement\n prettyValue = value\n break\n case 'object':\n prettyLabel = dataImprovement.label\n prettyValue = dataImprovement.value(value)\n break\n default:\n prettyLabel = titleCase(valueName.replace(/[:|-|_]/gi, ' '))\n prettyValue = value\n }\n\n // console.log(prettyLabel,prettyValue);\n let ret =\n ((prettyLabel) ? `<strong>${prettyLabel}:</strong> ` + (postLabel || '') : '') +\n prettyValue +\n ((postValue) || '')\n\n return ret\n }",
"static splash_screen_tutorial_options_html(){\n let result = \"\"\n let labels = persistent_get(\"splash_screen_tutorial_labels\") //might have checkmarks in them.\n for(let name_and_tooltip of this.splash_screen_tutorial_names_and_tooltips){\n let name = name_and_tooltip[0]\n let label = null\n for(let a_label of labels) {\n if(a_label.endsWith(name)){\n label = a_label //might have a checkmark\n break;\n }\n }\n if(!label) { label = \" \" + name } //default is no checkmark\n result += \"<option class='splash_screen_item' \" +\n \"title='\" + name_and_tooltip[1] +\n \"' style='cursor:pointer;'>\" +\n label + \"</option>\\n\"\n }\n return result\n }",
"function getResourceLabel(type, input) {\n switch (type) {\n case \"hasAuthor\": return (input + \" is an author of the document\");\n case \"hasPublicationYear\": return (\"The document was published in \" + input);\n case \"hasTitle\": return (\"The document's title is \" + input);\n case \"hasDOI\": return (\"The document's DOI is \" + input);\n case \"hasURL\": return (\"The document's URL is \" + input);\n case \"hasComment\": return (\"This is the fragment comment: \" + input);\n case \"denotesRhetoric\": return (\"This fragment has got a rhetorical function\"); // da sistemare\n case \"cites\": return (\"This document cites \" + input + \".\")\n default: {\n console.log(\"Something goes wrong with getResourceLabel()\");\n return error;\n }\n }\n}",
"function createLabel(labelValue) {\n let generalLabel = document.createElement('label')\n if (labelValue) {\n generalLabel.innerHTML = 'So early to Heaven? huh!'\n } else {\n generalLabel.setAttribute('value', ' ')\n }\n return generalLabel\n}",
"function badgeTooltipText() {\r\n var tooltip = \"Disable QuietAds on Twitch\";\r\n if (currSite == \"twitch\" && enabled == 1) tooltip = \"Disable QuietAds on Twitch\";\r\n if (currSite == \"twitch\" && enabled == 0) tooltip = \"Enable QuietAds on Twitch\";\r\n if (currSite == \"youtube\" && enabled == 1) tooltip = \"Disable QuietAds on Youtube\";\r\n if (currSite == \"youtube\" && enabled == 0) tooltip = \"Enable QuietAds on Youtube\";\r\n return tooltip;\r\n}",
"_getAriaLabel(title) {\n return !title ? \"Modal Dialog\" : null;\n }",
"function getLabel( key, required ) {\n return getLabelByName( getLabelName(key, required) );\n}",
"get label() {\n if (this.isObject(this.options)) {\n return this.options.label;\n }\n else {\n return '';\n }\n }",
"function fieldLabel(field) { return [field, \"Label\"].join(\"\"); }",
"function getLabelValue(option) {\n\n //Non object? Use its value\n if (!angular.isObject(option)) {\n return option;\n }\n\n //Must have label property\n if (!labelBy) {\n $log.warn('Missing label-by property for check boxes');\n return '';\n }\n\n //Validate property\n if (typeof option[labelBy] === 'undefined') {\n $log.warn('Unknown property `' + labelBy + '` for check box label');\n return '';\n }\n\n //Return the property\n return option[labelBy];\n }",
"yes() {\n if (this.user.state.locale !== 'en') return ' (Yes)';\n return '';\n }",
"function toggleLabel() {\n var input = $(this);\n setTimeout(function() {\n var def = input.attr('title');\n if (!input.val() || (input.val() == def)) {\n input.prev('span').css('visibility', '');\n if (def) {\n var dummy = $('<label></label>').text(def).css('visibility','hidden').appendTo('body');\n input.prev('span').css('margin-left', dummy.width() + 3 + 'px');\n dummy.remove();\n }\n } else {\n input.prev('span').css('visibility', 'hidden');\n }\n }, 0);\n }",
"get promptLabel() {\n\t\treturn this.nativeElement ? this.nativeElement.promptLabel : undefined;\n\t}",
"function removelabelAddlabelToUsers(executionContext) {\n var formContext = executionContext.getFormContext();\n var XrmuserSettings = Xrm.Utility.getGlobalContext().userSettings;\n var userName = XrmuserSettings.userName;\n var userid = XrmuserSettings.userId;\n var usersecurityrolename = XrmuserSettings.securityRole;\n alert(\"logged in user id is:\" + userid + \"logged username:\" + userName);\n alert(\"usersecurityrolename::\" + usersecurityrolename);\n if (userName == \"Mimmy Sree\") {\n formContext.getControl(\"new_studentqualification\").removeOption(1);\n }\n if (userName == \"Srini karra\") {\n formContext.getControl(\"new_studentqualification\").addOption({ value: 1, text: 'MCA' });\n\n }\n\n}",
"static labelOf(t) {\n const label= !t.desc ? Filters.titlecase(t.name.replace(/[-_]/g, ' ')) /* friendlyish name */ :\n (typeof t.desc === 'string') ? t.desc :\n t.desc.label;\n return label;\n }",
"function createFormInput(pref, prefName, text){\r\n var elm = document.createElement('input');\r\n elm.className = \"lc_preferencesInput\";\r\n elm.name = prefName;\r\n switch(typeof pref){\r\n case \"string\":\r\n case \"number\":\r\n elm.value = pref;\r\n if(arguments[3]) elm.size = arguments[3];\r\n break;\r\n case \"boolean\":\r\n elm.type = \"checkbox\";\r\n elm.checked = pref;\r\n break;\r\n case \"object\":\r\n elm.type = \"radio\"; // pref = [\"pref value\", true]\r\n elm.value = pref[0]; // preference value\r\n elm.checked = pref[1]; // true or false\r\n }\r\n preferencesForm.appendChild(document.createElement('label')).appendChild(elm);\r\n elm.parentNode.insertBefore(document.createTextNode(text), elm);\r\n }",
"function appendLabel(view,label,descriptor){\n const text = document.createElement('div');\n text.setAttribute('class','signInLabel');\n text.textContent = label;\n view.appendChild(text);\n const input = document.createElement('input');\n input.setAttribute('class','signIn');\n view.appendChild(input);\n input.setAttribute('id',label+' '+descriptor+' input');\n\n switch (label){\n case 'email address':\n input.type = 'email';\n break;\n case 'password':\n input.type = 'password';\n break;\n case 'confirm password':\n input.type = 'password';\n break;\n }\n\n return input;\n}",
"getAccountTypesLabel(accountTypes) {\n const { isFarmer, isDistributor, isRetailer, isConsumer } = accountTypes;\n return isFarmer\n ? \"Farmer\"\n : isDistributor\n ? \"Distributor\"\n : isRetailer\n ? \"Retailer\"\n : isConsumer\n ? \"Consumer\"\n : \"\";\n }",
"function textSet() {\n getMatchName();\n\n if (!partnerReady()) {\n document.getElementById('partnerLbl').innerText = \"You must complete your profile to continue (and be sure to click \\\"Update\\\").\";\n document.getElementById('profileLbl').innerText = \"There are uncategorized names in this group.\";\n document.getElementById('profileLbl').className = \"error\";\n document.getElementById('profileLbl').style.display = \"block\";\n }\n else {\n document.getElementById('partnerLbl').innerText = \"\";\n document.getElementById('profileLbl').innerText = \"\";\n document.getElementById('profileLbl').style.display = \"none\";\n }\n\n document.getElementById('PartnerPick').disabled = document.getElementById(\"partnerName\").value == \"\" ? false : true;\n}",
"function createOptionLabel(Text,URL){\n if ( URL && !isAllWhite(URL) )\n return ( Text + \" (\" + URL + \")\" );\n else\n return Text ;\n}",
"renderUserLabel() {\n if(this.props.isLoggedIn) {\n return \"Welcome, \" + this.state.cUsername;\n }\n return \"Hello, Guest\";\n }",
"getVatFieldLabel() {\n const vatLabel = get(\n COUNTRIES_VAT_LABEL,\n this.signUpFormCtrl.model.country.toUpperCase(),\n );\n\n if (vatLabel) {\n return this.$filter('translateDefault')(\n `sign_up_activity_field_vat_${this.signUpFormCtrl.model.legalform}_more`,\n 'sign_up_activity_field_vat_more',\n { vatLabel },\n undefined,\n false,\n 'escapeParameters',\n );\n }\n return this.$filter('translateDefault')(\n `sign_up_activity_field_vat_${this.signUpFormCtrl.model.legalform}`,\n `sign_up_activity_field_vat`,\n { vatLabel },\n undefined,\n false,\n 'escapeParameters',\n );\n }",
"function MUA_headertext(mode) {\n let header_text = (mode === \"update\") ? loc.User + \": \" + mod_MUA_dict.username : loc.Add_user;\n if(mod_MUA_dict.user_schoolbase_pk){ header_text = loc.Add_user_to + mod_MUA_dict.user_schoolname;}\n document.getElementById(\"id_MUA_header\").innerText = header_text;\n } // MUA_headertext"
] |
[
"0.6330865",
"0.61747205",
"0.61295223",
"0.580869",
"0.5763793",
"0.5747451",
"0.57332486",
"0.5725752",
"0.5665497",
"0.5649104",
"0.558894",
"0.5561425",
"0.5547449",
"0.5540915",
"0.5517936",
"0.54994637",
"0.54948455",
"0.5455702",
"0.5447712",
"0.54466766",
"0.5428423",
"0.53984404",
"0.5386771",
"0.5386758",
"0.5375602",
"0.5350308",
"0.53329796",
"0.5319705",
"0.5307135",
"0.53069675"
] |
0.8082545
|
0
|
Utility function to generate the css class(es) of a userPref input field based on if it is required or not
|
function generatePrefInputClassMarkup(userPref) {
var markup = [];
markup.push(WIDGET_PREFS_INPUT_CLASS);
if (userPref.required) {
markup.push(" ");
markup.push(WIDGET_PREFS_INPUT_REQUIRED_CLASS);
}
return markup.join("");
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"inputClass () {\n let klass = ''\n\n if (this.state.focus) {\n klass += ' usa-input-focus'\n }\n\n if (this.state.valid) {\n klass += ' usa-input-success'\n }\n\n if (this.state.checked) {\n klass += ' selected'\n }\n\n return klass.trim()\n }",
"labelClass () {\n let klass = ''\n\n if (this.state.error) {\n klass += ' usa-input-error-label'\n }\n\n if (this.state.checked) {\n klass += ' checked'\n }\n\n if (this.state.focus) {\n klass += ' usa-input-focus'\n }\n\n return klass.trim()\n }",
"getCSSClassesNames() {\n var classNames = 'article__textarea article__textarea--style';\n switch (this.state.cssCheck) {\n case 'OK':\n classNames += ' article__textarea--correct';\n break;\n case 'KO':\n classNames += ' article__textarea--wrong';\n break;\n default:\n classNames += ' article__textarea--idle';\n break;\n }\n return classNames;\n }",
"function formStyleHelperClasses() {\r\n $('.form-style').attr('placeholder', '');\r\n\r\n $('.form-style').focus(function() {\r\n\r\n $(this).closest('.form-group').addClass('is-focused');\r\n \r\n }).blur(function() {\r\n \r\n $(this).closest('.form-group').removeClass('is-focused');\r\n \r\n if ( $(this).val() ) {\r\n\r\n $(this).closest('.form-group').addClass('is-not-empty');\r\n\r\n } else {\r\n\r\n $(this).closest('.form-group').removeClass('is-not-empty');\r\n\r\n }\r\n \r\n });\r\n }",
"handleFieldsCheck(){\n let required = document.querySelectorAll('.required')\n let filled = true\n required.forEach( item => {\n if(!item.value) {\n item.classList.add('required-input')\n filled = false\n }\n })\n return filled\n }",
"function generalFromValidationForPresence() {\n var emptyArray = []\n $(this).closest('form').find('.required_field').each(function(){\n if ($(this).val() == \"\") {\n $(this).css({\n \"background-color\":\"#F1D7D7\"\n });\n emptyArray.push($(this));\n } else {\n $(this).css({\n \"background-color\":\"none\"\n }); \n };\n });\n if (typeof(error_declaration_variable) == 'undefined') {\n if (emptyArray.length > 0) {\n $(this).closest('form').find('.missing_field_error').html('<p>Ensure all the required fields above are filled in.</p>');\n $(this).closest('form').find('.missing_field_error').removeClass('hidden');\n return 'missing'\n } else {\n $(this).closest('form').find('.missing_field_error').html('');\n $(this).closest('form').find('.missing_field_error').addClass('hidden');\n return 'okay'\n }\n } else {\n return 'missing'\n }\n}",
"getEnyoClassesNames() {\n var classNames = 'article__textarea article__textarea--html';\n switch (this.state.enyoCheck) {\n case 'OK':\n classNames += ' article__textarea--correct';\n break;\n case 'KO':\n classNames += ' article__textarea--wrong';\n break;\n default:\n classNames += ' article__textarea--idle';\n break;\n }\n return classNames;\n }",
"function requiredFields() {\n\tvar application_type = jQuery(\"input[name='application_type']:checked\").val();\n\tvar requiredAll = ['#degree-start', '#title','#surname','#firstname','#contact-number','#preferred-email','#nationality','#college','#degree','#subject','#term','#term-year','#acc-prefer-1','#acc-prefer-2','#tenancy-accept'];\n\tvar requiredJoint = ['#partner-title','#partner-lastname','#partner-firstname','#partner-relationship','#partner-nationality','#partner-preferred-email','#partner-contact-no','#partner-college','#partner-degree','#partner-subject','#partner-degree-start'];\n\tvar requiredFamily = ['#spouse-title','#spouse-firstname','#spouse-lastname','#spouse-relationship','#spouse-nationality'];\n\t\n\tjQuery('div.required').removeClass('required');\n\t\n\tjQuery(requiredAll).each(function(i,v) {\n\t\tjQuery(v).closest('div').addClass('required');\n\t});\n\t\n\tif (typeof application_type !== 'undefined' && application_type === 'Joint') {\n\t\tjQuery(requiredJoint).each(function(i,v){\n\t\t\tjQuery(v).closest('div').addClass('required');\n\t\t});\n\t}\n\telse if (typeof application_type !== 'undefined' && application_type === 'Couple/Family') {\n\t\tjQuery(requiredFamily).each(function(i,v){\n\t\t\tjQuery(v).closest('div').addClass('required');\n\t\t});\n\t}\n\t\n}",
"function mandatoryInputCheck(){\n\n\tlet filled = true;\n\tfor (i = 0; i < NECESSARY_VAL.length; i++) {\n\n\t\tlet id = \"#\"+NECESSARY_VAL[i];\n\n\t\t\tif ($(id).val()==\"\" || $(id).hasClass(\"w3-red\")==true) {\n\n\t\t\t\t$(id).addClass(\"w3-red\");\n\t\t\t\tfilled = false;\n\t\t\t} else {\n\n\t\t\t\t$(id).removeClass(\"w3-red\");\n\t\t\t};\n\t};\n\treturn filled\n}",
"function addClass(value){\n\t\n if(value.localeCompare(\"N / A\") === 0 ){\n\t\t\n\t\tvalue = \"<div class='no_membership'>\" + value + \"</div>\"; // css style in 'display_members.css' file\n\t}\n else if(value.localeCompare(\"present\") === 0){\n \t\n \tvalue = \"<div class='expired_membership'>N / A</div>\";\n }\n\telse if(value == 0.00){\n\t\t\n\t\tvalue = \"<div class='no_paid'>\" + value + \"</div>\"; // css style in 'display_members.css' file\n\t}\n\t\n\treturn value;\t\n}",
"function class_nameVerify(){\n\t\tif(class_name.value != null || class_name.value != \"\"){\t\t\t\n\t\t\tclass_name.style.border = \"1px solid #5e6e66\";\n\t\t\tdocument.getElementById('class_name_div').style.color = \"#5e6e66\";\n\t\t\tclass_name_error.innerHTML = \"\";\n\t\t\treturn true;\n\t\t}\n\t}",
"function valid(value){\n value.addClass(\"is-valid\");\n value.removeClass(\"is-invalid\");\n}",
"function updateClasses() {\n\n var formField = formCtrl[scope.fieldName];\n element.toggleClass('isValid', formField.$valid);\n element.toggleClass('error', formField.$invalid && (formField.$dirty || formField.$touched || formCtrl.$submitted));\n element.toggleClass('valueEntered', formField.$dirty || (formField.$viewValue !== undefined && \n formField.$viewValue !== null && formField.$viewValue.length > 0));\n }",
"getClasses() {\n let classes = ['indicator-pip'];\n\n if (this.props.final) {\n classes.push('final');\n }\n\n if (this.props.taken) {\n classes.push('taken');\n }\n\n return classes.join(' ');\n }",
"function inputFieldClass() {\n if (event.key >= 'a' && event.key <= 'z') {\n var inputSlice = input.value + event.key;\n var currentWordSlice = randomWords[currentWord].slice(0, inputSlice.length);\n input.className = inputSlice === currentWordSlice ? '' : 'wrong';\n }else if (event.key === 'Backspace') {\n var inputSlice = event.ctrlKey ? '' : input.value.slice(0, input.value.length - 1);\n var currentWordSlice = randomWords[currentWord].slice(0, inputSlice.length);\n input.className = inputSlice === currentWordSlice ? '' : 'wrong';\n } else if (event.key === ' ') {\n input.className = '';\n }\n }",
"get formElementClass() {\n let baseClass = ['slds-form-element'];\n\n if (this.variant && VARIANTS[this.variant]) {\n baseClass = [...baseClass, ...VARIANTS[this.variant]];\n }\n\n if (!this.valid) {\n baseClass = [...baseClass, 'slds-has-error'];\n }\n\n return baseClass.join(' ');\n }",
"function getCountry(c)\n{\n if(c.value !== \"Choix...\")\n c.classList.add(\"is-valid\");\n else\n if(c.classList.contains('is-valid') === true)\n c.classList.remove(\"is-valid\");\n}",
"function buildRequiredCheckboxValidation($formField,validation){var formFieldId=$formField.attr('id');var primarySelector='#'+formFieldId+' input:first-of-type';var secondarySelector='#'+formFieldId+' input';return{selector:primarySelector,triggeredBy:secondarySelector,validate:function validate(cb){var result=false;__WEBPACK_IMPORTED_MODULE_0_jquery___default()(secondarySelector).each(function(index,checkbox){if(checkbox.checked){result=true;return false}});cb(result)},errorMessage:'The \\''+validation.label+'\\' field cannot be blank.'}}",
"render() {\n return (\n <fieldset className={ \"ValidateField\" + (this.status.invalid && \" invalid \") }>\n {this.props.children}\n {this.status.invalid && <span className=\"ValidateStatus\">{this.status.invalid}</span>}\n </fieldset>\n )\n\n }",
"function makeFieldsMandatory(arrayOfFields)\n\t{\n\t for (var i=0; i<arrayOfFields.length; i++) \n\t {\n\t obj = getObj(arrayOfFields[i]);\n\t obj.className=\"mandatoryLabel\"\n\t }\n\t}",
"renderField(field) {\n\n const { meta: { touched, error } } = field;\n const className = touched && error ? \"form-control form-control-lg is-invalid\" : \"form-control form-control-lg\";\n const inputType = field.type;\n const inputPlaceholder = field.placeholder;\n const errorMessageStyling = touched && error ? \"text-danger\" : \"\";\n\n return (\n\n <div>\n <input className={className} type={inputType} placeholder={inputPlaceholder} {...field.input} />\n <div className={errorMessageStyling}>\n <div>{touched ? error : \"\"}</div>\n \n </div>\n </div>\n );\n}",
"function customizeInput(inputClass, styleNotSel, styleSel){\r\n\t\tvar element = $(\".\"+inputClass);\r\n\t\telement.css(\"display\", \"none\");//hide the default style\r\n\t\telement.addClass(styleNotSel); //add not selected style to it\r\n\t\tvar inputType = element.attr(\"type\");\r\n\t\t\r\n\t\tswitch(inputType){\r\n\t\t\r\n\t\tcase \"checkbox\":\r\n\t\t\telement.change(function(){ //toggle styled effects\r\n\t\t if($(this).is(\":checked\")){\r\n\t\t $(this).next(\"label\").addClass(styleSel);\r\n\t\t }else{\r\n\t\t $(this).next(\"label\").removeClass(styleSel);\r\n\t\t }\r\n\t\t });\r\n\t\t\tbreak;\r\n\t\tcase \"radio\":\r\n\t\t\telement.change(function(){\r\n\t\t if($(this).is(\":checked\")){\r\n\t\t $(element + \":not(:checked)\").removeClass(styleSel);\r\n\t\t $(this).next(\"label\").addClass(styleSel);\r\n\t\t }\r\n\t\t }); \r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t}",
"function toggleRequiredClass() {\n var loadType = $('.IA-C-2.IA-C-3:checked').val();\n if (isPartial(loadType)) {\n $('.field-loadcar-model, .field-loadcar-quantity').addClass('required');\n } else {\n $('.field-loadcar-model, .field-loadcar-quantity').removeClass('required');\n }\n}",
"function addClassInput() {\n if (classCnt >= 9) {\n alert('Reached maximum supported inference classes');\n return;\n }\n\n classCnt = classCnt + 1;\n\n let classInput = [];\n classInput.push(` <div class=\"row\" id=\"inference-class-${classCnt}-row\">\\n`);\n classInput.push(` <div class=\"col input-group input-group-sm mb-1\">\\n`);\n classInput.push(` <div class=\"input-group-prepend\">\\n`);\n classInput.push(` <span class=\"input-group-text\" id=\"inference-class-${classCnt}-label\">Class ${classCnt}:</span>\\n`);\n classInput.push(` </div>\\n`);\n classInput.push(` <input type=\"text\" class=\"form-control\" id=\"inference-class-${classCnt}\" placeholder=\"Enter Inference Class ${classCnt}\" aria-label=\"Inference Class ${classCnt}\" aria-describedby=\"inference-class-${classCnt}-label\">\\n`);\n classInput.push(` </div>\\n`);\n classInput.push(` </div>\\n`);\n\n let html = classInput.join(\"\");\n $(html).insertBefore($(\"#inference-class-add-remove\"));\n}",
"renderField(field) {\n //console.log(\"Field Details : \" + JSON.stringify(field));\n const {\n meta: { touched, error },\n type,\n placeholder,\n value\n } = field;\n const className = `form-group form-control-lg ${\n touched && error ? \"has-danger\" : \"\"\n }`;\n console.log(\"className : \" + className);\n return (\n <div class=\"form-group form-control-lg has-danger\">\n <label>{field.label}</label>\n <input\n class=\"form-control form-control-lg border border border-dark\"\n type={type}\n placeholder={placeholder}\n value={value}\n {...field.input}\n />\n <div class={{ className }}>{touched ? error : \"\"}</div>\n </div>\n );\n }",
"getClassText(value) {\n if (parseFloat(value) > 0.0) {\n return \"text-success\"\n } else {\n return \"text-danger\"\n }\n }",
"function AssetClass() {\r\n var assets = $(\"#assets_class\").val()\r\n console.log(\"assets is ---->\", assets)\r\n if (assets.length == \"\") {\r\n\r\n $(\"#assets_class\").addClass(\"has-error\");\r\n $(\"#assets_class_label\").text(\"This Field is required\");\r\n return false;\r\n } \r\n else {\r\n $(\"#assets_class\").removeClass(\"has-error\");\r\n $(\"#assets_class_label\").text(\"\");\r\n return true;\r\n }\r\n\r\n}",
"function checkRequired (color) {\n if(color === \"red\" || color === \"orange\" || color === \"gray\") {\n return \"required\";\n } else {\n return \"\";\n }\n}",
"function generatePrefLabelMarkup(userPref) {\n var markup = [];\n var prefLabel = (userPref.required) ? \"* \" + userPref.displayName : userPref.displayName;\n markup.push(\"<td class='\");\n markup.push(WIDGET_PREFS_LABEL_CLASS);\n if (userPref.required) {\n markup.push(\" \");\n markup.push(WIDGET_PREFS_LABEL_REQUIRED_CLASS);\n }\n markup.push(\"'>\");\n markup.push(prefLabel);\n markup.push(\"</td>\");\n return markup.join(\"\");\n }",
"function validNameRed () { \n if (name.value === '') {\n nameField.classList.add('input-invalid')\n } \n else{\n nameField.classList.add('input-valid')\n }\n}"
] |
[
"0.684388",
"0.6082944",
"0.6043315",
"0.6038432",
"0.58463854",
"0.5785473",
"0.5770614",
"0.57303566",
"0.57255924",
"0.57164735",
"0.5619832",
"0.557445",
"0.5556102",
"0.55518055",
"0.5519978",
"0.5514215",
"0.5513528",
"0.5507767",
"0.5443522",
"0.5426768",
"0.5426207",
"0.5423119",
"0.541276",
"0.5409376",
"0.5398663",
"0.5398403",
"0.5393621",
"0.53847146",
"0.53770936",
"0.53755474"
] |
0.7445592
|
0
|
Utility function to validate a userPref input element
|
function validatePrefInput(element) {
var isValid = true;
var jqEl = $(element);
// if the input is required verify it's trimmed input length is > 0
if (jqEl.hasClass(WIDGET_PREFS_INPUT_REQUIRED_CLASS)) {
isValid = $.trim(jqEl.val()).length > 0;
}
return isValid;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function checkElement(element)\r\n{\r\n var isRequired = element.getAttribute(\"isRequired\");\r\n var inputValue = element.value;\r\n if (inputValue == \"无权限查看\")\r\n return true;\r\n\r\n var validChar = GetValidChar(element.getAttribute(\"validEnum\"));\r\n\r\n //过滤特殊字符\r\n if (inputValue.length > 1 && (element.type == \"text\" || element == \"textarea\"))\r\n {\r\n var temp = \"\\\\(|\\\\)|'|;|and|exec|insert|select|delete|update|count|%|chr|mid|master|truncate|char|declare|&|#|\\\\$\";\r\n var regex1 = new RegExp(temp, \"g\");\r\n\r\n element.value = inputValue.replace(regex1, \"\").trim();\r\n }\r\n\r\n //判断长度\r\n var minLength = element.getAttribute(\"MinLength\");\r\n if (minLength != null && inputValue.length < minLength) {\r\n return false;\r\n }\r\n\r\n if (isRequired == \"true\")\r\n {\r\n if (inputValue.length < 1)\r\n {\r\n return false;\r\n }\r\n else\r\n {\r\n\r\n if (validChar != null)\r\n {\r\n\r\n var regex = new RegExp(validChar);\r\n return regex.test(inputValue);\r\n }\r\n }\r\n }\r\n else\r\n {\r\n if (inputValue.length < 1)\r\n {\r\n return true;\r\n }\r\n else\r\n {\r\n if (validChar != null)\r\n {\r\n var regex = new RegExp(validChar);\r\n return regex.test(inputValue);\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n}",
"function validateUserInput( $input ) {\r\r\n\r\r\n\t\tvar input = $input;\r\r\n\r\r\n\t\t// Check string for #NONE# indicating no vendor type selected\r\r\n\t\tif( input === '#NONE#' ) {\r\r\n\t\t\treturn false;\r\r\n\t\t}\r\r\n\r\r\n\t\t// Check for empty or null values\r\r\n\t\tif( !input.trim() ) {\r\r\n\t\t\treturn false;\r\r\n\t\t}\r\r\n\t\t\r\r\n\t\treturn true;\r\r\n\t}",
"function upnpConfValidate(){\n\n\tvar txtFieldIdArr = new Array();\n txtFieldIdArr[0] = \"tf1_advertPeriod, \"+LANG_LOCALE['12203'];\n txtFieldIdArr[1] = \"tf1_adverttime, \"+LANG_LOCALE['12204'];\n \n if (txtFieldArrayCheck(txtFieldIdArr) == false) \n return false;\n\n if (isProblemCharArrayCheck(txtFieldIdArr, \"'\\\" \", NOT_SUPPORTED) == false) \n return false;\n\n var advObj = document.getElementById('tf1_advertPeriod');\n if (advObj && !advObj.disabled) {\n if (numericValueRangeCheck(advObj, 1, '', 1, 86400, true, LANG_LOCALE['11207']+': ', LANG_LOCALE['11167']) == false) \n return false;\n }\n var advObj = document.getElementById('tf1_adverttime');\n if (advObj && !advObj.disabled) {\n if (numericValueRangeCheck(advObj, 1, '', 1, 255, true, LANG_LOCALE['11208']+': ', LANG_LOCALE['13499']) == false) \n return false;\n }\n return true;\n}",
"function userInput() {\n checkedUpper = window.confirm('Do you want Upper Case Letters?');\n checkedLower = window.confirm('Do you want Lower Case Letters?');\n checkedNumbers = window.confirm('Do you want Numbers?');\n checkedSpecial = window.confirm('Do you want Special Characters?');\n if (!checkedUpper && !checkedLower && !checkedNumbers && !checkedSpecial) {\n alert(\"Must choose at least one\");\n userInput();\n }\n}",
"function verifyField(element)\n{\n if (!element.value)\n {\n flashField(element);\n }\n}",
"function userV() {\n var user = document.getElementById('user').value;\n if (user.length == 0) {\n showWarning(\"User field empty\");\n return false;\n } else if (user.indexOf(' ') !== -1) {\n showWarning(\"No spaces allowed\");\n return false;\n } else if (!user.match(/^[A-Za-z0-9]+$/)) {\n showWarning(\"Only numbers and letters for username\");\n return false;\n }\n\n return true;\n\n}",
"function pWordValidation(pWordInput, pWordConfInput) {\n // Prefix with # to create an id selector\n pWordInput = \"#\" + pWordInput;\n\n // Create label element selector\n let pWordConfLabel = `label[for=\"${pWordConfInput}\"]`;\n\n // Prefix with # to create an id selector\n pWordConfInput = \"#\" + pWordConfInput;\n\n // Define default label text\n let labelText = \"Passwords do not match.\";\n\n // If passwords do not match, or the password is invalid, or is 0 length...\n if (($(pWordInput).val() !== $(pWordConfInput).val()) ||\n $(pWordInput).hasClass(\"invalid\") ||\n $(pWordInput).val().length === 0) {\n // Make the confirmation input invalid\n $(pWordConfInput).removeClass(\"valid\").\n addClass(\"invalid\");\n\n // If the password is invalid, or is 0 length...\n if ($(pWordInput).hasClass(\"invalid\") ||\n $(pWordInput).val().length === 0) {\n // Set the label text\n labelText = \"Invalid Password.\";\n }\n\n /* Update the confirmation input data-error attribute with the label */\n /* text, and return false (validation failed) */\n $(pWordConfLabel).attr(\"data-error\", labelText);\n return false;\n }\n // Otherwise, the password is valid so make the confirmation input valid\n $(pWordConfInput).removeClass(\"invalid\").\n addClass(\"valid\");\n return true; // return true (validation passed)\n}",
"function validateInput(){\n\n}",
"function PasswordTypeCheck() {\n if (!IncludeUpperCase && !IncludeLowerCase && !IncludeNumbers && !IncludeSpecialChar) {\n alert(\"The input type should include at least one character type, please try again!\");\n IsValid = false;\n UserChoice();\n } else {\n IsValid = true;\n console.log(\"The password type choice is valid\")\n }\n}",
"function validateInput(elementName) {\n\n var element = document.getElementById(elementName);\n if ( ! element ) {\n return(true);\n }\n\n var elementType = element.getAttribute(\"axisType\");\n\n switch (elementType) {\n case \"ratingStars\" :\n break;\n\n case \"text\" : return(isValidInputText(elementName));\n break;\n\n case \"textarea\" : return(isValidInputTextArea(elementName));\n break;\n\n case \"email\": return(isValidInputEmail(elementName));\n break;\n\n case \"phone\": return(isValidInputPhone(elementName));\n break;\n\n case \"time_hour\": return(isValidInputHour(elementName));\n break;\n\n case \"time_minutes\": return(isValidInputMinutes(elementName));\n break;\n\n case \"date\": return(isValidInputDate(elementName));\n break;\n\n case \"color\": return(isValidInputColor(elementName));\n break;\n\n case \"icon\": return(isValidInputIcon(elementName));\n break;\n\n case \"password\" : return(isValidInputPassword(elementName));\n break;\n\n case \"pin\" : return(isValidInputPin(elementName));\n break;\n\n case \"number\" : return(isValidInputNumber(elementName));\n break;\n\n case \"zip\" : return(isValidInputZip(elementName));\n break;\n\n case \"city\" : return(isValidInputCity(elementName));\n break;\n\n case \"state\" : return(isValidInputState(elementName));\n break;\n\n case \"signature\" : return(isValidSignature(elementName));\n break;\n }\n return(true);\n}",
"function validateInput(elem, isFieldExits){\n\n var currElement = $(elem);\n var originalClass = currElement.attr('class');\n var errorClassPosition = originalClass.lastIndexOf('error-field');\n \n if(errorClassPosition != -1){\n \n originalClass = originalClass.substring(0,errorClassPosition-1);\n currElement.attr({'class': originalClass});\n }\n \n if (!currElement.val() || isFieldExits === \"true\" ) {\n \n currElement.attr({'class': originalClass + ' error-field'});\n \n \n if(!currElement.val()){\n currElement.attr(\n \"data-content\", \"Это поле не может быть пустым!\"\n );\n currElement.popover(\"enable\");\n currElement.popover(\"show\");\n currElement.change(function(event) {\n currElement.popover(\"disable\");\n });\n }\n \n return false;\n }\n \n return true;\n \n}",
"function checkInput() {\n // Check to see if the (numeric) points input field contains a value\n if ($(\"#quest-points-input\").prop(\"value\") == null || $(\"#quest-points-input\").prop(\"value\").length == 0) {\n $(\"#feedback\").html(\"Enter a point value\");\n $(\"#feedback\").css({\n color: \"red\"\n });\n $(\"#feedback\").show(0);\n $(\"#feedback\").fadeOut(2000);\n } else {\n validInput = true;\n }\n}",
"function isValid(element){\n return element !== \"\"? true : false ;\n }",
"function fn_CheckRequired ( theElement , theElementName )\n\t{\n\t\t/*\n\t\tif ( theElement == undefined )\n\t\t{\n\t\t\talert ( \"要求检查的项目(\" + theElementName\t+ \")并不是一个有效的JavaScript对象\" ) ;\n\t\t\treturn false;\n\t\t}\n\t\t*/\n\t\ttheElement.value = trimString ( theElement.value ) ;\n\t\tif( theElement.value == \"\" )\n\t\t{\n\t\t\talert( \"\\\"\" + theElementName + \"\\\"\" + \"必须填写!\" ) ;\n\t\t\ttheElement.focus();\n\t\t\treturn false ;\n\t\t}\n\t\treturn true;\n\t}",
"function isVaild(ele) {\n var id = ele.id || '';\n var val = ele.value || '';\n var sts = {\n 'isValid': true,\n 'errorMsg': ''\n }\n // Name and title validator\n if (id === 'name' || id === 'title') {\n if (!val.length) {\n sts['isValid'] = false;\n sts['errorMsg'] = `This field is required : ${id}`\n }\n }\n else if (id === 'extension') { // Extension validator\n var ext = Number(val);\n if (isNaN(ext) || ext < 0) {\n sts['isValid'] = false;\n sts['errorMsg'] = `Invalid ext!!`\n }\n }\n return sts;\n }",
"function customValidation(input) { \n}",
"function checkPrincipal()\n{\n var prc = document.getElementById(\"principal\").value;\n \n //If the user did not type in a positive number, they will not be allowed to compute their interest.\n if (prc <= 0)\n {\n alert(\"Please enter a positive number.\")\n document.getElementById(\"principal\").focus();\n return false;\n }\n\n return true;\n}",
"function adjPresAffPlainCheckError() {\n let optionsGroup = document.getElementById(\"adjective-type-group\");\n let errorElement = optionsGroup.getElementsByClassName(\"must-choose-one-text\")[0];\n\n let selected = checkInputsForError(inputsToSelectAdjPresAffPlain, true);\n let unselected = checkInputsForError(inputsToDeselectAdjPresAffPlain, false);\n\n let iAdjInput = document.querySelectorAll('input[name=\"adjectivei\"]')[0];\n let irrAdjInput = document.querySelectorAll('input[name=\"adjectiveirregular\"]')[0];\n let naAdjInput = document.querySelectorAll('input[name=\"adjectivena\"]')[0];\n if (selected && unselected && !naAdjInput.checked && (iAdjInput.checked || irrAdjInput.checked)) {\n toggleError(errorElement, \"*Invalid combination: い/irregular, present, affirmative, plain\", true);\n // element could be hidden because verb is unchecked, so check to enable back button\n checkToEnableBackButton();\n } else if (document.querySelectorAll('input[name=\"adjective\"]')[0].checked){\n optionsGroupCheckError(optionsGroup);\n }\n}",
"function validate (input) {\n \t//ver dps..\n \treturn true;\n }",
"'validateValue'(value) {}",
"function inputAvailable(div) {\n if (div.value) {\n return false;\n } else if (!div.value || div.value === undefined) {\n return true;\n }\n}",
"validateInput(elem){\n\n // checking if the input field is empty and if there are any message not shown\n if (elem.value === '' && elem.nextElementSibling.nextElementSibling.tagName !== 'SPAN'){\n let name;\n if (elem.name === 'name'){\n name = 'Name';\n }else if (elem.name === 'address'){\n name = 'Address';\n }else if (elem.name === 'phone'){\n name = 'Phone';\n }else if (elem.name === 'engineNo'){\n name = 'Engine No';\n }else if (elem.name === 'licenseNo'){\n name = 'License No';\n }\n this.ui.showError(elem, `${name} can not be empty`);\n }else if (elem.value !== '' && elem.nextElementSibling.nextElementSibling.tagName === 'SPAN'){\n this.ui.clearError(elem.nextElementSibling.nextElementSibling);\n }\n }",
"function CheckUserPrefs(){\r\n if(UserPrefs.storePrefs && GM_getValue){\r\n for(opt in UserPrefs){\r\n if(opt == \"storePrefs\"){ continue; }\r\n if(opt == \"message\"){ continue; }\r\n if(typeof UserPrefs[opt] !== \"boolean\"){\r\n GM_log(\"CheckUserPrefs: UserPrefs \" + opt +\r\n \" not boolean - must be true or false\");\r\n UserPrefs[opt] = true;\r\n }\r\n UserPrefs[opt] = SetUserPref(opt, UserPrefs[opt]);\r\n }\r\n }\r\n function SetUserPref(pref,val){\r\n try{\r\n var curPref = GM_getValue(pref);\r\n }catch(e){\r\n GM_log(\"SetUserPref(\\\"\" + pref + \"\\\") thew an exception... \" + e.message);\r\n if(e.name === \"NS_ERROR_UNEXPECTED\") alert(\"You need to restart or set pref: \" + pref);\r\n return false;\r\n }\r\n if(curPref !== undefined) return curPref;\r\n var userval = confirm(\"MU_Bundle UserScript option:\\n \" + UserPrefs.message[pref] + \"?\");\r\n if(typeof userval === \"boolean\"){ val = userval }\r\n else{ GM_log(\"SetUserPref: confirm did not return boolean\") }\r\n GM_setValue(pref, val);\r\n return val;\r\n }\r\n}",
"function checkDesiredCustomProfileURL (input) {\n var check = input.toString().trim()\n\n // Check to make sure characters are legal\n var illegalChar = check.match(/[^A-Za-z0-9_-]+/)\n if (illegalChar && illegalChar.length > 0) {\n return 'Please only use letters, numbers, hyphens, and underscores.'\n }\n // Check string length is OK\n if (check.length < 4) {\n return 'Please enter more than four characters.'\n } else if (check.length > 32) {\n return 'Please enter no more than 32 characters.'\n }\n\n return true\n}",
"function validInput(obj) {\n if(obj.hasClass('i-user')) {\n if(obj.val() == '' || /^[ ]+$/.test(obj.val())) {\n obj.removeClass('ok').addClass('error');\n\n } else if(!/[a-zA-Zа-яА-Я- ]+/.test(obj.val())) {\n obj.removeClass('ok').addClass('error');\n\n } else {\n obj.removeClass('error').addClass('ok');\n }\n\n } else if(obj.hasClass('i-phone')) {\n if(obj.val() == '' ) {\n //if(obj.val() == '' || /[ ]+/.test(obj.val())) {\n obj.removeClass('ok').addClass('error');\n\n } else if(/[_]+/.test(obj.val())) {\n obj.removeClass('ok').addClass('error');\n\n } else {\n obj.removeClass('error').addClass('ok');\n }\n }\n}",
"function isValidInputField(inputElement) {\n if (!inputElement.value){\n inputElement.setAttribute('class', 'validate invalid');\n return false\n }\n return true;\n }",
"function validarProvincia() {\n // comprobaremos que el valor del elemento provincia es igual que alguno de los valores reales, si lo es, devolvera true, si no dara error.\n if ((document.getElementById(\"provincia\").value)!=\"C\" && (document.getElementById(\"provincia\").value)!=\"LU\" && (document.getElementById(\"provincia\").value)!=\"OU\" && (document.getElementById(\"provincia\").value)!=\"PV\"){\n document.getElementById(\"provincia\").value = \"error!\";\n document.getElementById(\"provincia\").focus();\n document.getElementById(\"provincia\").className=\"error\";\n document.getElementById(\"errores\").innerHTML = \"Error, debes seleccionar una provincia.\";\n return false;\n }\n else {\n document.getElementById(\"provincia\").className=\"\";\n document.getElementById(\"errores\").innerHTML = \"\";\n return true;\n }\n}",
"function inputFileCheck()\n{\n\n var element = eval(this.element);\n if ( typeof element != 'undefined' )\n {\n\n this.custom_alert = (typeof this.custom_alert != 'undefined') ? this.custom_alert : '';\n\n this.ref_label = (typeof this.ref_label != 'undefined') ? this.ref_label\n : JS_RESOURCES.getFormattedString('field_name.substitute', [element.name]);\n var val = element.value;\n\n\n if ( this.invalid_chars )\n {\n var arr = val.invalidChars(this.invalid_chars);\n\n if ( arr && arr.length )\n {\n alert(JS_RESOURCES.getFormattedString('validation.invalid_chars',\n [this.ref_label, arr.join(', ')]));\n shiftFocus( element, false);\n return false;\n }\n }\n\n if ( val.length < this.minlength )\n {\n if ( this.minlength == 1 )\n {\n alert(this.custom_alert ? this.custom_alert\n : JS_RESOURCES.getFormattedString('validation.required', [this.ref_label]));\n }\n else\n {\n alert(this.custom_alert ? this.custom_alert\n : JS_RESOURCES.getFormattedString('validation.minimum_length',\n [this.minlength, this.ref_label]));\n }\n\n return false;\n }\n\n if ( this.img_check )\n {\n return image_check(element);\n }\n\n }\n return true;\n}",
"function validateUName() {\n\tvar message = \"\";\n\tvar uName = document.getElementById(\"tUName\").value;\n\tdocument.getElementById(\"tUName\").style.border = \"1px solid #0000ff\";\n\tmessage = message == \"\" ? isEmpty( uName ) : message;\n\tmessage = message == \"\" ? isGTMinlength( uName, 6 ) : message;\n\tmessage = message == \"\" ? isLTMaxlength( uName, 15 ) : message;\n\tif( message == \"\" ) {\n\t\tif( uName.search(/^[\\w]+$/) < 0 ) {\n\t\t\tmessage = \"Please enter only letters from English alphabet or decimal digits or underscore.\"\n\t\t}\n\t}\n\tdocument.getElementById(\"pUName\").innerHTML = message;\n\treturn styleInput(\"tUName\", message);\n}",
"function signUpFieldLocalValidation(input, signUpDiv) {\n let regex=/^.*$/,errorMsg=\"Unknown error\";\n switch(input.attr(\"id\")) {\n case \"email\": {\n regex = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/;\n errorMsg = \"Please input valid email address: [email protected]\";\n break;\n }\n case \"pwd_s\": {\n regex = /^(?=.*[A-Za-z]).{8,}$/;\n errorMsg = \"Password is too weak, it's insecure.\";\n break;\n }\n case \"username_s\": {\n regex = /^[A-Za-z_][A-Za-z_\\-0-9]{4,}$/;\n errorMsg = \"Not a valid username, please see instruction.\";\n break;\n }\n case \"first_name\": {\n regex = /^[A-Za-z]{1,30}$/;\n errorMsg = \"Please input your first name.\";\n break;\n }\n case \"last_name\": {\n regex = /^[A-Za-z]{1,30}$/;\n errorMsg = \"Please input your last name.\";\n break;\n }\n case \"mobile\": {\n regex = /^\\d{10}$/;\n errorMsg = \"Please input valid 10 digits phone number.\";\n break;\n }\n default: break;\n }\n\n if(regex.exec(input.val())) {\n inputDivStatusChange(signUpDiv,\"\",\"succeed\");\n signUpValidation[input.attr('id')]=true;\n signUpButtonValidation();\n return true;\n }\n else {\n inputDivStatusChange(signUpDiv,errorMsg,\"error\");\n signUpValidation[input.attr('id')]=false;\n signUpButtonValidation();\n return false;\n }\n}"
] |
[
"0.625641",
"0.62227505",
"0.6090967",
"0.5930259",
"0.58690655",
"0.5840207",
"0.5833624",
"0.5761783",
"0.5758281",
"0.5725038",
"0.5719227",
"0.570561",
"0.5668139",
"0.56507987",
"0.5622217",
"0.56155854",
"0.5614728",
"0.56125677",
"0.5596227",
"0.5595975",
"0.55951035",
"0.5590117",
"0.5584115",
"0.55784875",
"0.5569334",
"0.5557896",
"0.5540444",
"0.55401796",
"0.55310273",
"0.55305254"
] |
0.7807044
|
0
|
Toggles the display of the widget collapse/restore icon.
|
function toggleCollapseWidgetIcon(widgetId, collapsed) {
var $toggleIcon = $("#widget-" + widgetId + "-collapse");
if (collapsed) {
$toggleIcon.html(WIDGET_TOGGLE_DISPLAY_COLLAPSED_HTML);
} else {
$toggleIcon.html(WIDGET_TOGGLE_DISPLAY_NORMAL_HTML);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function hideShowExpandToggle() {\n if (minWidth) {\n setExpandedWidth(\"60%\");\n } else {\n setExpandedWidth(\"80%\");\n }\n\n if (isExpanded) {\n setExpanded(false);\n } else {\n setExpanded(true);\n }\n }",
"toggle() {\n this.collapsed = !this.collapsed\n }",
"toggle() {\n this.collapsed = !this.collapsed\n }",
"toggle() {\n this.expanded = !this.expanded;\n }",
"toggle() {\n\t\tif (this.isVisible) {\n\t\t\tthis.display();\n\t\t} else {\n\t\t\tthis.hide();\n\t\t}\n\t}",
"collapse () {\n this.root.toggle(true, false);\n }",
"toggle() {\n this.setState({ collapse: !this.state.collapse });\n }",
"_toggle() {\n if (this._isVisible) {\n this._hide();\n } else {\n this._show();\n }\n }",
"toggle() {\n\t\tthis.setState(state => ({ collapse: !state.collapse }));\n\t}",
"function toggle() {\n setOpened(!opened);\n expandedCallback(!opened);\n }",
"_toggleIconAriaHidden() {\n this._renderedLabel = this._renderedLabel || this.label || this.content;\n\n // toggle aria-hidden if tab is labelled\n if (this._elements.icon) {\n const isLabelled = (this._renderedLabel && this._renderedLabel.textContent.trim().length) ||\n this.getAttribute('aria-label') !== null ||\n this.getAttribute('aria-labelledby') !== null;\n\n this._elements.icon[isLabelled ? 'setAttribute' : 'removeAttribute']('aria-hidden', 'true');\n }\n }",
"toggle() {\n if (this.isActive) {\n this.hide();\n } else {\n this.show();\n }\n }",
"toggle(){\n if(zoteroRoam.interface.icon.getAttribute('status') == \"off\"){\n zoteroRoam.extension.load();\n } else {\n zoteroRoam.extension.unload();\n }\n }",
"function collapsePanel() {\n phone.mode = DisplayMode.Minimized;\n $(\".expanded\").hide();\n}",
"toggleVisibility() {\n if (this.isOpen()) {\n this.hide();\n } else {\n this.show();\n }\n }",
"_toggleCollapsedState() {\n const that = this;\n\n if (!that.collapsible) {\n return;\n }\n\n if (!that.collapsed) {\n that.collapse();\n }\n else {\n that.expand();\n }\n }",
"toggle() {\n if (!this.disabled) {\n this.expanded = !this.expanded;\n }\n }",
"toggleIcon_() {\n this.toggleIconEls_.forEach((el) => {\n if (el.classList.contains(cssClass.HIDE)) {\n el.classList.remove(cssClass.HIDE);\n } else {\n el.classList.add(cssClass.HIDE);\n }\n });\n }",
"function setToggleButton() {\n var collapse = $toggleButton.attr(\"data-collapse\");\n var expand = $toggleButton.attr(\"data-expand\");\n if ($panels.next().hasClass('in')) {\n $panels.next().collapse('hide');\n $toggleButton.text(expand);\n $toggleButton.removeClass('closed');\n } else {\n $panels.next().collapse('show');\n $toggleButton.text(collapse);\n $toggleButton.addClass('closed');\n }\n}",
"toggleVisibility() {\n this.setVisible(!this.visible);\n }",
"toggleRegionsDrawingMode() {\n if ($('.regions-drawing-mode').is(':visible')) {\n $('.regions-drawing-mode').hide();\n $('.regions-drawing-mode-toggler').removeClass('collapse-up');\n $('.regions-drawing-mode-toggler').addClass('expand-down');\n } else {\n $('.regions-drawing-mode').show();\n $('.regions-drawing-mode-toggler').removeClass('expand-down');\n $('.regions-drawing-mode-toggler').addClass('collapse-up');\n }\n }",
"function dropIconToggle() {\n if(dropBool) {\n\tdropBool = false;\n\tdocument.getElementById(\"dropDiv\").innerHTML=\n\t 'Advanced Search <i class=\"icon-chevron-down\" data-toggle=\"collapse\"'\n\t\t+ ' data-target=\"#advSearch\"></i>';\n } else {\n\tdropBool = true;\n\tdocument.getElementById(\"dropDiv\").innerHTML=\n\t 'Advanced Search <i class=\"icon-chevron-up\" data-toggle=\"collapse\"'\n\t\t+ ' data-target=\"#advSearch\"></i>';\n }\n}",
"toggleHidden() {\n if (this.isHidden) this.show();\n else this.hide();\n }",
"toggle() {\n const self = this;\n if (!hasClass(self.element, showClass)) self.show();\n else self.hide();\n }",
"function toggleIcon() {\n $(this).toggleClass('open-accordion');\n $(this).find(\".toggle-accordion\").html($(this).text() == 'Ver más' ? 'Ver menos' : 'Ver más');\n }",
"set suiCollapse(value) {\n if (value) {\n this.hide();\n }\n else {\n this.show();\n }\n }",
"function toggleMode() {\n\tif (overviewMode === \"graph\") {\n\t\tmatrixContainer.style.display = \"flex\";\n\t\tgraphContainer.style.display = \"none\";\n\t\toverviewMode = \"matrix\";\n\t\ticonMode.src = \"img/hash.svg\";\n\t} else if (overviewMode === \"matrix\") {\n\t\tmatrixContainer.style.display = \"none\";\n\t\tgraphContainer.style.display = \"flex\";\n\t\toverviewMode = \"graph\";\n\t\ticonMode.src = \"img/git-branch.svg\";\n\t}\n}",
"toggle() {\n this._setState({\n expanded: !this.state.expanded,\n });\n }",
"function collapsePanel() {\n phone.mode = DisplayMode.Minimized;\n document.documentElement.style.setProperty(\"--widgetAreaWidth\", \"0px\");\n $(\".expanded\").hide();\n \n}",
"function toggleScreen() {\n var x = document.getElementById(\"changeIcon\");\n if (x.className === \"fas fa-expand-arrows-alt\") {\n x.className = \"fas fa-compress-arrows-alt\";\n openFullscreen();\n } else {\n x.className = \"fas fa-expand-arrows-alt\";\n closeFullscreen();\n }\n }"
] |
[
"0.70135665",
"0.69897556",
"0.69897556",
"0.686293",
"0.68112946",
"0.6808528",
"0.67870665",
"0.6741469",
"0.6725679",
"0.6628447",
"0.66143376",
"0.65889484",
"0.65522915",
"0.65255564",
"0.65252",
"0.6519703",
"0.6473483",
"0.64279777",
"0.6405912",
"0.63805467",
"0.63708156",
"0.63679034",
"0.636446",
"0.6363127",
"0.63511187",
"0.63497835",
"0.63458073",
"0.63327116",
"0.632157",
"0.6314402"
] |
0.731999
|
0
|
Displays the "empty page" message on the page
|
function displayEmptyPageMessage() {
$("#emptyPageMessageWrapper").removeClass("hidden");
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function displayEmpty() {\n var emptyCase = `\n <div class = \"alert alert-warning\" role = \"alert\">\n <h5>No new articles available.</h5>\n </div>`;\n articleContainer.append(emptyCase);\n }",
"function EmptyPage() {\n return <div>Empty page</div>;\n}",
"function empty() {\n res.send(\n {\n \"response_type\": \"ephemeral\",\n \"text\": \"Sorry, Desk give me any results :(\",\n }\n )\n }",
"function renderEmpty() {\n reviewContainer.empty();\n\n var alertDiv = $(\"<div>\");\n alertDiv.addClass(\"alert alert-danger\");\n alertDiv.text(\"There must be a Review created before you can view one.\");\n reviewContainer.append(alertDiv);\n\n var query = window.location.search;\n var partial = \"\";\n if (movieSelect.val()) {\n partial = \" for Movie Title\" + movieSelect.val();\n }\n\n var message = $(\"<h2>\");\n message.css({ \"text-align\": \"center\", \"margin-top\": \"50px\" });\n message.html(\"No reviews yet\" + partial + \", navigate <a href='/cms\" + query +\n \"'>here</a> in order to get started.\");\n reviewContainer.append(message);\n }",
"function isPageEmpty() {\n return $.isEmptyObject(widgetByIdMap);\n }",
"function displayEmpty() {\n responseContainer.empty();\n var messageh2 = $(\"<h2>\");\n messageh2.css({ \"text-align\": \"center\", \"margin-top\": \"50px\" });\n messageh2.html(\"No responses yet for this category, navigate <a href='/questionnaire'>here</a> in order to create a new response.\");\n responseContainer.append(messageh2);\n }",
"function emptyPage(response, exit) {\n response.writeHead(200, html);\n response.end('');\n if (exit) {\n process.nextTick(process.exit.bind(process, 0));\n }\n}",
"function displayEmpty(id) {\n var query = window.location.search;\n var partial = \"\";\n if (id) {\n partial = \" for restaurant #\" + id;\n }\n menuContainer.empty();\n var messageH2 = $(\"<h2>\");\n messageH2.css({ \"text-align\": \"center\", \"margin-top\": \"50px\" });\n messageH2.html(\"No menus yet\");\n menuContainer.append(messageH2);\n }",
"function renderEmpty() {\n var alertDiv = $(\"<div>\");\n alertDiv.addClass(\"alert alert-info\");\n alertDiv.text(\"No Records Found\");\n inventoryContainer.append(alertDiv);\n }",
"function displayEmpty(id) {\n var query = window.location.search;\n var partial = \"\";\n if (id) {\n partial = \" for Workout #\" + id;\n }\n blogContainer.empty();\n var messageh2 = $(\"<h2>\");\n messageh2.css({ \"text-align\": \"center\", \"margin-top\": \"50px\" });\n messageh2.html(\"No exercises yet\" + partial + \", navigate <a href='/exercise\" + query +\n \"'>here</a> in order to get started.\");\n blogContainer.append(messageh2);\n }",
"function displayEmpty(id) {\n var query = window.location.search;\n var partial = \"\";\n if (id) {\n partial = \" for Patient #\" + id;\n }\n pillboxContainer.empty();\n var messageh2 = $(\"<h2>\");\n messageh2.css({ \"text-align\": \"center\", \"margin-top\": \"50px\" });\n messageh2.html(\"No schedules yet\" + partial + \", navigate <a href='/cms\" + query +\n \"'>here</a> in order to get started.\");\n pillboxContainer.append(messageh2);\n }",
"function displayEmpty(id) {\n var query = window.location.search;\n var partial = \"\";\n if (id) {\n partial = \" for Merchant #\" + id;\n }\n blogContainer.empty();\n var messageH2 = $(\"<h2>\");\n messageH2.css({ \"text-align\": \"center\", \"margin-top\": \"50px\" });\n messageH2.html(\"No products yet\" + partial + \", navigate <a href='/cms\" + query +\n \"'>here</a> in order to get started.\");\n blogContainer.append(messageH2);\n }",
"function displayEmpty() {\n blogContainer.empty();\n var messageH2 = $(\"<h2>\");\n messageH2.css({ \"text-align\": \"center\", \"margin-top\": \"50px\",\"color\":\"gray\" });\n messageH2.html('No posts yet for this category. Click \"Add Post\" at top of page');\n blogContainer.append(messageH2);\n }",
"function displayEmpty(id) {\n var query = window.location.search;\n var partial = \"\";\n if (id) {\n partial = \" for Player #\" + id;\n }\n //listContainer.empty();\n inProgress.empty();\n completed.empty();\n wishList.empty();\n var messageh2 = $(\"<h2>\");\n messageh2.css({ \"text-align\": \"center\", \"margin-top\": \"50px\" });\n messageh2.html(\"No games yet\" + partial + \", navigate <a href='/cms\" + query +\n \"'>here</a> in order to get started.\");\n listContainer.append(messageh2);\n }",
"function displayEmpty() {\n reviewContainer.empty();\n var messageH2 = $(\"<h2>\");\n messageH2.css({ \"text-align\": \"center\", \"margin-top\": \"50px\" });\n messageH2.html(\"No posts yet for this rating.\");\n reviewContainer.append(messageH2);\n }",
"function renderEmpty() {\n const alertText = \"Uh Oh. Looks like we don't have any saved articles.\";\n const alertBox = $('<div/>')\n .addClass('shadow alert alert-warning text-center')\n .append($('<h4/>').text(alertText));\n\n const cardHeaderText = 'Would You Like to Browse Available Articles?';\n const cardHeader = $('<div/>')\n .addClass('card-header d-block')\n .append($('<h3/>').addClass('text-center').text(cardHeaderText));\n\n const browseLink = $('<a/>')\n .addClass('browse-articles')\n .attr({ href: '/' })\n .text('Browse Articles');\n const cardBody = $('<div/>')\n .addClass('card-body text-center')\n .append($('<h4/>').append(browseLink));\n const card = $('<div/>').addClass('card').append(cardHeader, cardBody);\n\n articleContainer.append(alertBox, card);\n }",
"function EmptyPage() {\n return <div id=\"emptyPage\" style={{ width: \"100%\", height: \"100vh\", background: \"rgba(0,0,0,0.4)\", zIndex: \"2\", position: \"fixed\", top: \"0\", left: \"-100%\", transition: \"350ms ease-in-out\" }}></div>\n }",
"function displayEmpty() {\n blogContainer.empty();\n var messageh2 = $(\"<h2>\");\n messageh2.css({ \"text-align\": \"center\", \"margin-top\": \"50px\" });\n messageh2.html(\"No dancers yet\");\n blogContainer.append(messageh2);\n }",
"function displayEmpty(id) {\n var query = window.location.search;\n var partial = \"\";\n if (id) {\n partial = \" for Author #\" + id;\n }\n blogContainer.empty();\n var messageh2 = $(\"<h2>\");\n messageh2.css({ \"text-align\": \"center\", \"margin-top\": \"50%\" });\n messageh2.html(\"This NerdGirl has not posted anything yet.\" );\n blogContainer.append(messageh2);\n }",
"function renderEmpty(){\n // This function renders some HTML to the page explaining we don't have any articles to view\n // using a joined array of HTML string data because it's easier to read/change than a concatenated string\n var emptyAlert =\n $([\"<div calss='alert-warning text-center'>\",\n \"<h4>Uh oh. Looks like we don't have any new articles.</h4>\",\n \"</div>\",\n \"<div class='panel panel-default'>\",\n \"<div class='panel-heading text-center'>\",\n \"<h3>What Would You Like To Do?</h3>\",\n \"</div>\",\n \"<div class='panel-body text-center'>\",\n \"<h4><a class='class'scrape-new'>Try Scraping New Articles</a></h4>\",\n \"</div>\"\n ].join(\"\"));\n // appending this data to the page\n articleContainer.append(emptyAlert);\n}",
"function renderEmpty() {\n var alertDiv = $(\"<div>\");\n alertDiv.addClass(\"alert alert-danger\");\n alertDiv.text(\"You must create an property before you can create a Post.\");\n propertyContainer.append(alertDiv);\n }",
"function displayEmpty() {\n blogContainer.empty();\n var messageh2 = $(\"<h2>\");\n messageh2.css({ \"text-align\": \"center\", \"margin-top\": \"50px\" });\n messageh2.html(\"No parents yet\");\n blogContainer.append(messageh2);\n }",
"function renderEmpty() {\n var alertDiv = $(\"<div>\");\n alertDiv.addClass(\"alert alert-danger\");\n alertDiv.text(\"You must create an Author before you can create a Definition.\");\n authorContainer.append(alertDiv);\n }",
"function displayEmpty() {\n requestsContainer.empty();\n var messageh2 = $(\"<h2>\");\n messageh2.css({ \"text-align\": \"center\", \"margin-top\": \"50px\" });\n messageh2.html(\"No time off requests have been made.\");\n requestsContainer.append(messageh2);\n }",
"function displayEmpty(id) {\n const query = window.location.search;\n let partial = \"\";\n if (id) {\n partial = \" for Organization #\" + id;\n }\n eventFeed.empty();\n const messageH2 = $(\"<h2>\");\n messageH2.css({ \"text-align\": \"center\", \"margin-top\": \"50px\" });\n messageH2.html(\n \"No events yet\" +\n partial +\n \", navigate <a href='/orgLogin\" +\n query +\n \"'>here</a> in order to get started.\"\n );\n eventFeed.append(messageH2);\n }",
"function render_empty()\n {\n var emptyAlert = $(\n [\n \"<div class='alert alert-warning text-center'>\",\n \"<h4>We don't have any saved headlines.</h4>\",\n \"</div>\",\n \"<div class='card'>\",\n \"<div class='card-body'>\",\n \"<div class='card-title text-center'>\",\n \"<h3>Would You Like to Browse Available Articles?</h3>\",\n \"</div>\",\n \"<div class='card-text text-center'>\",\n \"<h4><a href='/'>Browse Articles</a></h4>\",\n \"</div>\",\n \"</div>\",\n \"</div>\"\n ].join(\"\")\n );\n headline_container.append(emptyAlert);\n }",
"function displayIfNoLinks() {\n\n // Used in showing if there are no results\n const page = document.querySelector(\".page\");\n\n // If there is already an h1 tag, it is removed\n if (page.lastElementChild.tagName === \"H1\") {\n page.removeChild(page.lastElementChild);\n }\n\n // If there are 0 links that match the search, then a message is outputted\n if (linksToDisplay.length === 0) {\n const noTextMessage = makeH1(\"No matches found!\");\n\n // Makes h1 tag for output\n page.appendChild(noTextMessage);\n }\n}",
"static renderEmptyInfo() {\n return <span className=\"no-formulae\">The tenet is empty</span>\n }",
"function renderEmpty() {\n var alertDiv = $(\"<div>\");\n alertDiv.addClass(\"alert alert-danger\");\n alertDiv.text(\"Sorry - Nothing to reServe today!\");\n groceryContainer.append(alertDiv);\n }",
"function renderEmpty() {\n const alertDiv = $('<div>');\n alertDiv.addClass('alert alert-danger');\n alertDiv.text('You must create a Segment before you can create a SubSegment.');\n segmentContainer.append(alertDiv);\n }"
] |
[
"0.6837556",
"0.6818285",
"0.681492",
"0.6773253",
"0.67297196",
"0.6642752",
"0.6617391",
"0.6607315",
"0.6561375",
"0.65374064",
"0.6446165",
"0.6436086",
"0.6409814",
"0.63900256",
"0.634226",
"0.6312254",
"0.62965447",
"0.6273451",
"0.6268011",
"0.623355",
"0.62277764",
"0.62193185",
"0.6214428",
"0.6211417",
"0.61808276",
"0.6178295",
"0.61602247",
"0.6157118",
"0.61005235",
"0.60883206"
] |
0.7388173
|
0
|
Determines if a page is empty (has zero widgets)
|
function isPageEmpty() {
return $.isEmptyObject(widgetByIdMap);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function isPaginationEmpty(block) {\n\t return block === void 0 || block === null || block.length <= block.perPage;\n\t}",
"get empty() {\n if(this.children.length === 0) {\n return true\n } else {\n return false\n }\n }",
"isEmpty() {\n\t\treturn this.size === 0;\n\t}",
"empty () { return this.length === 0 }",
"get isEmpty() {\n return isNodeEmpty(this.state.doc);\n }",
"isEmpty() {\r\n\t\treturn size() == 0;\r\n\t}",
"isEmpty() {\n return this._size === 0;\n }",
"isEmpty() {\n\t\treturn this.items.length === 0;\n\t}",
"isEmpty() {\n return (this._size === 0);\n }",
"isEmpty() {\r\n\t\treturn this.heap.length === 0;\r\n\t}",
"isEmpty() {\r\n\t\treturn this.heap.length === 0;\r\n\t}",
"isEmpty() {\n return this.size === 0;\n }",
"isEmpty() {\n return this.size === 0;\n }",
"isEmpty() {\n return this.size === 0;\n }",
"isEmpty() {\n return this.size === 0;\n }",
"isEmpty() {\n return this.size === 0;\n }",
"isEmpty(area) {\n switch (area) {\n case 'bottom':\n return this._bottomPanel.widgets.length === 0;\n case 'down':\n return this._downPanel.stackedPanel.widgets.length === 0;\n case 'header':\n return this._headerPanel.widgets.length === 0;\n case 'left':\n return this._leftHandler.stackedPanel.widgets.length === 0;\n case 'main':\n return this._dockPanel.isEmpty;\n case 'menu':\n return this._menuHandler.panel.widgets.length === 0;\n case 'right':\n return this._rightHandler.stackedPanel.widgets.length === 0;\n case 'top':\n return this._topHandler.panel.widgets.length === 0;\n default:\n return true;\n }\n }",
"isEmpty() {\n\t\treturn this.items == 0;\n\t}",
"isEmpty()\r\n {\r\n if(this.getSize() === 0){\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }",
"isEmpty() {\r\n\t\treturn this.size == 0;\r\n\t}",
"function isEditorEmpty() {\n var childNodes = scribe.el.childNodes;\n var blockCount = childNodes.length;\n\n if (blockCount === 0) {\n return true;\n } else if (blockCount === 1) {\n var node = childNodes[0];\n var nodeName = node.nodeName.toLowerCase();\n\n if (nodeName === 'p' && node.textContent === '') {\n return true;\n }\n }\n\n return false;\n }",
"isEmpty() {\n if (this.Size > 0) {\n return true;\n }\n return false;\n }",
"empty() {\n\t\tif (this.size() === 0) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"isEmpty() {\n return _size == 0;\n }",
"isEmpty() {\n\t\treturn this._length === 0;\n\t}",
"isEmpty() {\n return (this.elements > 0) ? false : true;\n }",
"isEmpty() {\n return (this.elements > 0) ? false : true;\n }",
"empty(){\r\n return this.size == 0;\r\n }",
"isEmpty() {\n\t\treturn this.#hiddenLevels.length === this.#hiddenSize;\n\t}",
"isEmpty() {\n return this.size == 0;\n }"
] |
[
"0.67035246",
"0.6671512",
"0.64998066",
"0.64573294",
"0.6448146",
"0.64434016",
"0.6433765",
"0.6409741",
"0.64053875",
"0.6402961",
"0.6402961",
"0.6370084",
"0.6370084",
"0.6370084",
"0.6370084",
"0.6370084",
"0.63637847",
"0.6327837",
"0.63211155",
"0.6304488",
"0.6291391",
"0.6283182",
"0.62742394",
"0.6268705",
"0.62417006",
"0.62385356",
"0.62385356",
"0.6229602",
"0.6221994",
"0.6212053"
] |
0.87860894
|
0
|
Removes a regionWidgetId from the internal widget map
|
function removeWidgetFromMap(regionWidgetId) {
delete widgetByIdMap[regionWidgetId];
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"remove_widget(widget_id) {\n delete this.data[widget_id];\n }",
"function removeWidget(widget) {\r\n storage.get(\"tiles\", function(storage_data) {\r\n var widgets = storage_data.tiles;\r\n\r\n delete widgets[widget];\r\n\r\n storage.set({\"tiles\": widgets})\r\n });\r\n}",
"function deleteWidget(widgetId) {\n var widget = findWidgetById(widgetId);\n var index = widgets.indexOf(widget);\n widgets.splice(index, 1);\n }",
"removeWidget(id, origin){\n let addOrPanelRemove;\n if (origin === 'Canvas'){\n addOrPanelRemove = this.state.canvasWidgets;\n }\n else {\n addOrPanelRemove = this.state.rightPanelWidgets;\n }\n const newState = addOrPanelRemove.filter( el => el.widgetId !== id );\n return newState;\n }",
"removeWidget(id) {\n this.focus(() => {\n var {\n editorState,\n contentState\n } = this._getDraftData();\n\n var selection = DraftUtils.findPattern(contentState, widgetRegexForId(id)); //eslint-disable-line max-len\n\n var newDraftData = DraftUtils.deleteSelection({\n editorState,\n selection\n });\n\n this._handleChange({\n editorState: newDraftData.editorState\n });\n });\n }",
"moveWidget (widgetId, location) {\n for (var r = 0; r < this.data.length; r++) {\n for (var w = 0; w < this.data[r].length; w++) {\n if (String(this.data[r][w].id) === String(widgetId)) {\n let widget = Object.assign({}, this.data[r][w])\n // Remove from data\n this.data[r].splice(w, 1)\n\n // Add to data\n this.addWidget(widget, location)\n\n this.clean()\n return\n }\n }\n }\n }",
"function unregister(name) {\n var widgetId = nameIdMap[name];\n\n delete registry[widgetId];\n /* delete the entry from the registry */\n delete nameIdMap[name];\n /* delete the entry from the nameIdMap */\n delete returnObj[name];\n }",
"function remover_circunferencia()\n{\n\tif(distanceWidget)\n\t{\n\t\tdistanceWidget.marker.setMap(null);\n\t\tdistanceWidget = null; \n\t}\n}",
"_onWidgetRemoved(sender, widget) {\n if (widget === this._lastCurrent) {\n this._lastCurrent = null;\n }\n ArrayExt.removeAt(this._items, this._findWidgetIndex(widget));\n this._sideBar.removeTab(widget.title);\n this._refreshVisibility();\n }",
"function deleteWidget(widgetId) {\n return Widget.remove({_id: widgetId});\n }",
"_removeWidget( widgetKey ) {\n const { firebaseUrl , boardKey } = this.authStoreState.appConfig;\n let widgetBase = new Firebase( `${firebaseUrl}/widgets/${boardKey}/${widgetKey}` );\n widgetBase.remove();\n widgetBase.off();\n NotificationActions.pushNotif({\n type : 'success',\n message : 'widgetRemoved'\n });\n }",
"removeSlot() {\n this.closet.removeSlot();\n this.updateClosetGV();\n }",
"function onShapeRemove(areaId/*:String*/)/*:void*/ {\n var struct/*:Bean*/ = this.getModifiableStruct();\n var imageMapList/*:Array*/ = struct.get(com.coremedia.cms.studio.im.ImageMapEditorConstants.IMAGEMAP_STRUCT_NAME);\n\n var removed/*:Boolean*/ = imageMapList.every(function (area/*:Bean*/, index/*:Number*/)/*:Boolean*/ {\n if (area.get(com.coremedia.cms.studio.im.ImageMapEditorConstants.AREA_ID) === areaId) {\n struct.removeAt(com.coremedia.cms.studio.im.ImageMapEditorConstants.IMAGEMAP_STRUCT_NAME, index);\n return false;\n }\n return true;\n });\n if (!removed && joo.debug) {\n AS3.trace(\"[WARN] area \", areaId, \"was not found in\", struct.toObject());\n }\n\n this.getSelectedAreaExpression().setValue(null);\n }",
"function removeMapImage() {\n $(\".story-container-item--active .image-map\").remove();\n $(\"#map-caption\").remove();\n}",
"remove() {\n this.setMap(null);\n }",
"removeLayer() {\n if (this.__shown) {\n const map = this.map;\n map.removeLayer(this.uniqueId);\n map.removeLayer(this.uniqueId + 'label');\n map.removeLayer(this.uniqueId + 'citylabel');\n map.removeLayer(this.uniqueId + 'citylabelun');\n this.__shown = false;\n }\n }",
"cleanWidget (widget) {\n if (!widget.id) { widget.id = Math.floor(Math.random() * 1000000) }\n }",
"function removeWidget(){\n\tfrmAnimation.hboxContainer.setVisibility(false, animationConfigDisable);\n}",
"removeAriaLiveRegion() {\n if (this._ariaLiveRegion) {\n var context = this.getCtx();\n context.getContainer().removeChild(this._ariaLiveRegion);\n this._ariaLiveRegion = null;\n }\n }",
"_removeMap(map) {\n const index = this._selectedMaps.indexOf(map);\n\n if (index > -1) {\n this._selectedMaps.splice(index, 1);\n }\n\n this._eventBus.trigger(EVENT.TOGGLE_VIDEO_MAP, this._selectedMaps);\n }",
"removeBlock(editorState, key) {\n const currentContent = editorState.getCurrentContent();\n const blockMap = currentContent.getBlockMap().remove(key);\n\n return EditorState.set(editorState, {\n currentContent: currentContent.merge({\n blockMap: blockMap,\n }),\n });\n }",
"function removePanel(container, region, state) {\n if (!state) state = $.data(container, 'layout');\n var panels = state.panels;\n if (panels[region].length) {\n panels[region].panel('destroy');\n panels[region] = $();\n var expandP = 'expand' + region.substring(0, 1).toUpperCase() + region.substring(1);\n if (panels[expandP]) {\n panels[expandP].panel('destroy');\n panels[expandP] = undefined;\n }\n }\n }",
"function removeLayerParamElement(divNum) {\n var d = document.getElementById('mapParameters');\n var olddiv = document.getElementById(divNum);\n d.removeChild(olddiv);\n}",
"function clearRegionTabBar() {\n $(jqId('region_tab_bar')).empty();\n}",
"unregister(id) {\n const item = this._items.get(id);\n if (item != null) {\n item.template = null;\n item.inflate = null;\n item.defaulte = null;\n this._items.delete(id);\n }\n }",
"function removeMapDiv() {\n\tmap = null;\n\t$('#map-canvas').remove();\n}",
"function clear_rectangles(map_id, layer_id){\n for (i = 0; i < window[map_id + 'googleRectangles' + layer_id].length; i++){\n window[map_id + 'googleRectangles' + layer_id][i].setMap(null);\n }\n window[map_id + 'googleRectangles' + layer_id] = null;\n}",
"function removeArea(areaId) {\n if ( areas[areaId] ) {\n areas[areaId].helper.remove();\n delete areas[areaId];\n }\n }",
"onRegionDelete(deleted_region) {\n this.regions.splice(this.regions.indexOf(deleted_region), 1);\n }",
"mapRemove() {\n\n\t\tthis.map.remove();\n\n\t}"
] |
[
"0.7151344",
"0.6785963",
"0.6577708",
"0.6394485",
"0.6382265",
"0.6328557",
"0.62226796",
"0.6040211",
"0.5929866",
"0.5923567",
"0.5807613",
"0.5766515",
"0.5722185",
"0.57135826",
"0.5709486",
"0.56413305",
"0.5630386",
"0.5606092",
"0.5505306",
"0.5474496",
"0.5463774",
"0.5407469",
"0.54023176",
"0.53869",
"0.53850687",
"0.5381213",
"0.53792983",
"0.535291",
"0.53501976",
"0.5343895"
] |
0.8964363
|
0
|
EURO TO DOLLAR CONVERT FUNCTION
|
function euroTodollar() {
var euro2dollar = 1.10;
var bedrag = document.querySelector("#bedrag").value;
document.getElementById("convert").value = (bedrag * euro2dollar).toFixed(2);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function dollarToeuro() {\n var dollar2euro = 0.91;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * dollar2euro).toFixed(2);\n\n }",
"function pond2euro() {\n var pond2euro = 1.17;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * pond2euro).toFixed(2);\n\n }",
"function toCurrency(){\n\n}",
"function conversion(kelvin) {\n return Math.floor(kelvin * (9/5) - 459.67) + \"°F\";\n}",
"function currencyConversion(euros, exchangeRate) {\n const amount = euros * (exchangeRate / 100);\n const twoDecimal = amount.toFixed(2);\n return euros + ' ' + \"euros at an exchange rate of\" + ' ' + exchangeRate + ' ' + \"is\" + ' ' + twoDecimal + ' ' + \"U.S. dollars\";\n}",
"function convertPrice(price){\n return new Intl.NumberFormat('ru-RU').format(Math.round(price));\n}",
"function convertToCelcius(x){\n let kelvin = 273.15;\n let temp = x - kelvin; \n temp = Math.round(temp);\n return temp;\n}",
"function convert (celsius){\n var fahrenheit = ((celsius * 9/5) +32);\n console.log(celsius +\" degrees celsius equates to: \"+fahrenheit + \" \"+ \"fahrenheit\");\n }",
"function euroTopond() {\n var euro2pond = 0.85;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * euro2pond).toFixed(2);\n\n }",
"function convertToCelsius(num){\n return (num - 32) * 5 / 9;\n}",
"function kelvinToCelcius(K){\n return parseInt(K) - parseInt(273);\n}",
"function eurfunc()\r\n{\r\n inr.value = parseFloat(eur.value) * 1.43448;\r\n usd.value = parseFloat(eur.value) * 0.70641;\r\n cad.value = parseFloat(eur.value) * 0.72037;\r\n aud.value = parseFloat(eur.value) * 0.62382;\r\n}",
"function convertToCurrency(num) {\n return \"AUD \" + num.toFixed(2);\n}",
"function convert() {\n let k = document.getElementById(\"kelvin\").value\n let o = k- 273.15\n document.getElementById(\"out\").innerHTML = o.toFixed(2) + \" degrees C\"\n}",
"function ConverterEuro() {\n var valorElemento = document.getElementById(\"valor\");\n var valor = valorElemento.value;\n var valorEmDolarNumerico = parseFloat(valor);\n var valorEmEuro = valorEmDolarNumerico * 0.85;\n var elementoValorConvertio = document.getElementById(\"valorConvertido\");\n var valorConvertido = \"O resultado em euro é € \" + valorEmEuro + \".\";\n elementoValorConvertio.innerHTML = valorConvertido;\n}",
"function Currency(str) {\n str = str - -0.5;\n var arr = new String(str);\n var arr1 = '';\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] != '.') {\n arr1 = arr1 + arr[i];\n }\n else {\n if (arr[i + 1] >= '5') {\n arr1[i] = arr[i] - -1;\n }\n break;\n }\n }\n var Gia = \"\";\n var dem = 0;\n for (var i = arr1.length - 1; i >= 0; i--) {\n dem++;\n Gia = Gia + arr1[i];\n if (dem == 3 && i != 0) {\n Gia = Gia + \",\";\n dem = 0;\n }\n }\n var arr2 = new String(Gia);\n var GiaMoi = '';\n for (var i = arr2.length - 1; i >= 0; i--) {\n GiaMoi = GiaMoi + arr2[i];\n }\n return GiaMoi;\n }",
"function formatAsEuros (amount) {\n var res = '€'\n , currentPart\n ;\n\n if (amount === 0) { return '0 ' + res; }\n\n while (amount > 0) {\n currentPart = amount - 1000 * Math.floor(amount / 1000);\n if (amount === currentPart) { // No padding if it's the last part\n res = currentPart + ' ' + res;\n } else {\n res = pad(currentPart) + ' ' + res;\n }\n amount = (amount - currentPart) / 1000;\n }\n\n return res;\n}",
"function convertRate(price) {\n if (gCurrLang === 'he') {\n return price * gExcangeRates.quotes.USDILS\n } else if (gCurrLang === 'en') {\n return price\n }\n}",
"function NumberEU(num) {\r\n\tnum = num.replace(\",\", \".\");\r\n\treturn Number(num);\r\n}",
"function Converter(currency, input) {\n\n if (isNaN(input)) {\n number.value = null;\n alert('Nazadal jsi cislo');\n }\n\n switch (currency) {\n\n case 'USD':\n\n usd = 23.61777;\n return (input / usd).toFixed(2) + ' $';\n case 'EUR':\n\n eur = 25.840273;\n return (input / eur).toFixed(2) + ' €';\n\n case 'PLN':\n\n pln = 5.89558584;\n return (input / pln).toFixed(2) + ' zł';\n }\n}",
"function convertToF(celsius) { \n \n return( 9*celsius/5 + 32);\n}",
"function convert (c) {\n \n var f=(9*c/5) + 32;\n return c + '°C is ' + f + '°F';\n \n \n}",
"kelvinToCelsius(kelvin) {\n return Math.floor(kelvin - 273) + \" °C\"\n }",
"function convert(){\r\nvar fsub = f.value-32;\r\nvar fdiv = fsub/1.8;\r\n c.innerHTML=fdiv+\"°C\";\r\n}",
"function currencyConverter(from, to, amount) {\n // It's javascript convention to DECLARE variables at the top of functions\n // before they are actually DEFINED and used. This way it's easier to keep\n // track of the different scopes.\n var result, converter;\n\n // - CURRENCY_CONVERSION_MAP is being accessed like a nested Ruby hash.\n // - CURRENCY_CONVERSION_MAP[from] is an object representing all the ways to\n // convert `from` currency.\n // - CURRENCY_CONVERSION_MAP[from][to] is the anonymous function that converts\n // `from` currency into `to` currency.\n converter = CURRENCY_CONVERSION_MAP[from][to];\n result = converter(amount);\n\n // If we didn't use a constant variable here, this line would be completely\n // unclear to anyone unfamiliar with the toFixed() method!\n return result.toFixed(CURRENCY_PRECISION);\n}",
"function calculateConvertedCurrency() {\n\tlet fromCurr = currFrom.value;\n\tlet toCurr = currTo.value;\n\t\n\tfetch(`https://api.exchangerate-api.com/v4/latest/${fromCurr}`)\n\t\t.then(res => res.json())\n\t\t.then(res => {\n\t\tconst rate = res.rates[toCurr];\n perRate.innerText = `1 ${fromCurr} = ${rate} ${toCurr}`;\n let ans=(amountfrom.value * rate);\n\t\tamountTo.value = ans.toFixed(2);\n\t})\n}",
"function CurrencyConvert(v,idx,full) {\n if(idx==undefined) idx = 0;\n var c = CurrencyData[idx];\n v = parseInt(10000*v/c[2])/10000;\n if(v>1 && v<1000) v=parseInt(10*v)/10;\n if(v>=1000 && v<10000) v=parseInt(v/1000)+\"千\";\n else if(v>=10000 && v<100000000) v=parseInt(v/10000)+\"萬\";\n else if(v>=100000000 && v<1000000000000) v=parseInt(v/100000000)+\"億\";\n else if(v>=1000000000000) v=parseInt(v/1000000000000)+\"兆\";\n return v+(full?c[0]+c[1]:\"\");\n }",
"function celsius2Kelvin(celsius)\n{\n //+ will become string\n return celsius + 273;\n}",
"function convertKelvinToCelsius(kelvin) {\n if (kelvin < (0)) {\n return 'below absolute zero (0 K)';\n } else {\n let celciusVal = kelvin - 273.15\n return Math.round(celciusVal * 100) / 100;\n }\n}",
"function usdfunc()\r\n{\r\n inr.value = parseFloat(usd.value) * 2.03032;\r\n eur.value = parseFloat(usd.value) * 1.41544;\r\n cad.value = parseFloat(usd.value) * 1.01941;\r\n aud.value = parseFloat(usd.value) * 0.88297;\r\n}"
] |
[
"0.7358444",
"0.67566913",
"0.672828",
"0.6651549",
"0.6607016",
"0.63641584",
"0.63308567",
"0.62846744",
"0.6241035",
"0.6185155",
"0.6164351",
"0.61156285",
"0.6078811",
"0.6071066",
"0.6067765",
"0.6011564",
"0.6007596",
"0.59942394",
"0.59901863",
"0.59857875",
"0.5982113",
"0.59763217",
"0.5958582",
"0.5952692",
"0.5950734",
"0.5940736",
"0.59246033",
"0.59006923",
"0.58945286",
"0.5884362"
] |
0.68504477
|
1
|
Dollar To Euro CONVERT FUNCTION
|
function dollarToeuro() {
var dollar2euro = 0.91;
var bedrag = document.querySelector("#bedrag").value;
document.getElementById("convert").value = (bedrag * dollar2euro).toFixed(2);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function euroTodollar() {\n var euro2dollar = 1.10;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * euro2dollar).toFixed(2);\n\n }",
"function toCurrency(){\n\n}",
"function convertToCurrency(num) {\n return \"AUD \" + num.toFixed(2);\n}",
"function currencyConversion(euros, exchangeRate) {\n const amount = euros * (exchangeRate / 100);\n const twoDecimal = amount.toFixed(2);\n return euros + ' ' + \"euros at an exchange rate of\" + ' ' + exchangeRate + ' ' + \"is\" + ' ' + twoDecimal + ' ' + \"U.S. dollars\";\n}",
"function convertPrice(price){\n return new Intl.NumberFormat('ru-RU').format(Math.round(price));\n}",
"function ConverterEuro() {\n var valorElemento = document.getElementById(\"valor\");\n var valor = valorElemento.value;\n var valorEmDolarNumerico = parseFloat(valor);\n var valorEmEuro = valorEmDolarNumerico * 0.85;\n var elementoValorConvertio = document.getElementById(\"valorConvertido\");\n var valorConvertido = \"O resultado em euro é € \" + valorEmEuro + \".\";\n elementoValorConvertio.innerHTML = valorConvertido;\n}",
"function pond2euro() {\n var pond2euro = 1.17;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * pond2euro).toFixed(2);\n\n }",
"function formatCurrency(number){\n return \"$\"+number+\".00\"\n}",
"changePrice() {\n var parts = this.precio.toFixed(2).toString().split(\".\");\n var result = parts[0].replace(/\\B(?=(\\d{3})+(?=$))/g, \".\") + (parts[1] ? \",\" + parts[1] : \"\");\n return `$${result}`;\n }",
"function convertMoney(money) {\n return `$ ${money.toFixed(2).toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")}`\n}",
"function numtocurrency(num) {\n num = num.toString().replace(/\\$|\\./g, '');\n\n if (isNaN(num)) num = \"0\";\n\n sign = (num == (num = Math.abs(num)));\n num = Math.floor(num * 100 + 0.50000000001);\n cents = num % 100;\n num = Math.floor(num / 100).toString();\n\n if (cents == 0) cents = '';\n else if (cents < 10) cents = \",0\" + cents;\n else cents = ',' + cents;\n\n for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)\n num = num.substring(0, num.length -(4 * i + 3)) + '.' + num.substring(num.length - (4 * i + 3));\n\n return(((sign) ? '' : '-') + num + cents);\n}",
"function formatPrice(num)\n{\n\t num = num.toString().replace(/\\$|\\,/g,'');\n\t if(isNaN(num))\n\t num = \"0\";\n\t sign = (num == (num = Math.abs(num)));\n\t num = Math.floor(num*100+0.50000000001);\n\t cents = num%100;\n\t num = Math.floor(num/100).toString();\n\t if(cents<10)\n\t cents = \"0\" + cents;\n\t for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)\n\t num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3));\t \n\t //return (((sign)?'':'-') + '<?php //echo $this->model_superadmin->generate_isocode_bo()?> ' + num + ',' + cents);\n\t return (((sign)?'':'-') + 'Rp. '+ num +',00');\n}",
"function usCurrency$Format(num) {\n return '$' + num.toFixed(2).replace(/(\\d)(?=(\\d{3})+\\.)/g, '$1,');\n }",
"function formatEuroNumber(number) {\r\n\tvar str = String(number);\r\n\tvar res;\r\n\tif(str) {\r\n\t\tres = \"€ \" + str;\r\n\t}\r\n\treturn res;\r\n}",
"function currency (value){\n return '$ ' + value\n .toFixed(2)\n .replace(/(\\d)(?=(\\d{3})+\\.)/g, '$1,').replace('.00', '')\n }",
"function formatCurrency(num) {\nnum = num.toString().replace(/\\$|\\,/g,'');\nif(isNaN(num))\nnum = \"0\";\nsign = (num == (num = Math.abs(num)));\nnum = Math.floor(num*100+0.50000000001);\ncents = num%100;\nnum = Math.floor(num/100).toString();\nif(cents<10)\ncents = \"0\" + cents;\nfor (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)\nnum = num.substring(0,num.length-(4*i+3))+','+\nnum.substring(num.length-(4*i+3));\nreturn (((sign)?'':'-') + num + '.' + cents);\n}",
"function totalPrice(price) {\n return `$${price.toFixed(2)}`;\n}",
"function formatCurrency(num) {\n return 'PKR ' + (num).toFixed(2).replace(/\\d(?=(\\d{3})+\\.)/g, '$&,');\n}",
"function centsToDollars(num){\n return num / 100; \n}",
"function toPrice(value) {\n value /= 100;\n return parseFloat(Math.round(value + \"e\" + 2) + \"e-\" + 2).toFixed(2);\n}",
"function convertMoney(num){\n\n inputdollar = document.forms[0].inputdollar.value;\n var euro = inputdollar * .883785;\n var inputString = \"You entered $\" + inputdollar + \" USD\" + \"</br>\";\n var convertString = \"You exchanged $\" + inputdollar + \" U.S. Dollars for $\" + euro.toFixed(2) + \" Euros\" + \"</br>\";\n var outPutString = inputString + convertString;\n document.getElementById('moneyForm').innerHTML = outPutString;\n}",
"function convertTotal(money){\n input = money.toString();\n var test = input.split(\"\");\n if (input.match(/\\./) !== null) {\n var part2;\n for (var i = 0; i < test.length; i++) {\n if (test[i] == \".\") {\n part2 = test.slice(i, i+3);\n test = test.slice(0, i);\n break;\n }\n };\n }\n if (test.length > 3) {\n for (var i = test.length - 3; i > 0; i = i - 3) {\n test.splice(i, 0, \",\");\n };\n }\n if (part2) {\n test = test.concat(part2);\n }\n input = test.join(\"\");\n return '$' + input;\n }",
"function CurrencyConvert(v,idx,full) {\n if(idx==undefined) idx = 0;\n var c = CurrencyData[idx];\n v = parseInt(10000*v/c[2])/10000;\n if(v>1 && v<1000) v=parseInt(10*v)/10;\n if(v>=1000 && v<10000) v=parseInt(v/1000)+\"千\";\n else if(v>=10000 && v<100000000) v=parseInt(v/10000)+\"萬\";\n else if(v>=100000000 && v<1000000000000) v=parseInt(v/100000000)+\"億\";\n else if(v>=1000000000000) v=parseInt(v/1000000000000)+\"兆\";\n return v+(full?c[0]+c[1]:\"\");\n }",
"function convertToUSDWithCommas(num) {\n numString = num.toFixed(2).replace(/(\\d)(?=(\\d{3})+\\.)/g, '$1,');\n numString = \"$\" + numString;\n return numString;\n}",
"function formatAsEuros (amount) {\n var res = '€'\n , currentPart\n ;\n\n if (amount === 0) { return '0 ' + res; }\n\n while (amount > 0) {\n currentPart = amount - 1000 * Math.floor(amount / 1000);\n if (amount === currentPart) { // No padding if it's the last part\n res = currentPart + ' ' + res;\n } else {\n res = pad(currentPart) + ' ' + res;\n }\n amount = (amount - currentPart) / 1000;\n }\n\n return res;\n}",
"function Converter(currency, input) {\n\n if (isNaN(input)) {\n number.value = null;\n alert('Nazadal jsi cislo');\n }\n\n switch (currency) {\n\n case 'USD':\n\n usd = 23.61777;\n return (input / usd).toFixed(2) + ' $';\n case 'EUR':\n\n eur = 25.840273;\n return (input / eur).toFixed(2) + ' €';\n\n case 'PLN':\n\n pln = 5.89558584;\n return (input / pln).toFixed(2) + ' zł';\n }\n}",
"function convertRate(price) {\n if (gCurrLang === 'he') {\n return price * gExcangeRates.quotes.USDILS\n } else if (gCurrLang === 'en') {\n return price\n }\n}",
"function convertToNumber(numText) {\n var number;\n number = numText.replace('€', '');\n number = number.replace(',', '.');\n number = number.replace('.', ' ');\n number = parseFloat(number);\n\n if (number != 'NaN') {\n return number;\n } else {\n return 0;\n }\n }",
"function priceConversion(productPrice) {\n return Intl.NumberFormat(\"fr-FR\", {\n style: \"currency\",\n currency: \"EUR\",\n minimumFractionDigits: 2,\n }).format(`${productPrice}` / 100);\n}",
"function dollars(n) {\n document.paycheck.feedback3.value = \"$ \" + n.toFixed(2);\n}"
] |
[
"0.7718889",
"0.75523186",
"0.7517815",
"0.75133",
"0.7273224",
"0.7204205",
"0.70954895",
"0.7047062",
"0.69806165",
"0.69283384",
"0.69272465",
"0.69200283",
"0.6892008",
"0.68343306",
"0.68201447",
"0.681075",
"0.6803525",
"0.67761314",
"0.6742312",
"0.6741504",
"0.67400306",
"0.6736792",
"0.6725499",
"0.6717963",
"0.6707017",
"0.66755056",
"0.6667433",
"0.6651093",
"0.66451895",
"0.6643601"
] |
0.8191923
|
0
|
Euro To Pond CONVERT FUNCTION
|
function euroTopond() {
var euro2pond = 0.85;
var bedrag = document.querySelector("#bedrag").value;
document.getElementById("convert").value = (bedrag * euro2pond).toFixed(2);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function pond2euro() {\n var pond2euro = 1.17;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * pond2euro).toFixed(2);\n\n }",
"function dollarToeuro() {\n var dollar2euro = 0.91;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * dollar2euro).toFixed(2);\n\n }",
"function euroTodollar() {\n var euro2dollar = 1.10;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * euro2dollar).toFixed(2);\n\n }",
"function toCurrency(){\n\n}",
"function CurrencyConvert(v,idx,full) {\n if(idx==undefined) idx = 0;\n var c = CurrencyData[idx];\n v = parseInt(10000*v/c[2])/10000;\n if(v>1 && v<1000) v=parseInt(10*v)/10;\n if(v>=1000 && v<10000) v=parseInt(v/1000)+\"千\";\n else if(v>=10000 && v<100000000) v=parseInt(v/10000)+\"萬\";\n else if(v>=100000000 && v<1000000000000) v=parseInt(v/100000000)+\"億\";\n else if(v>=1000000000000) v=parseInt(v/1000000000000)+\"兆\";\n return v+(full?c[0]+c[1]:\"\");\n }",
"function ConverterEuro() {\n var valorElemento = document.getElementById(\"valor\");\n var valor = valorElemento.value;\n var valorEmDolarNumerico = parseFloat(valor);\n var valorEmEuro = valorEmDolarNumerico * 0.85;\n var elementoValorConvertio = document.getElementById(\"valorConvertido\");\n var valorConvertido = \"O resultado em euro é € \" + valorEmEuro + \".\";\n elementoValorConvertio.innerHTML = valorConvertido;\n}",
"function conversion(kelvin) {\n return Math.floor(kelvin * (9/5) - 459.67) + \"°F\";\n}",
"function currencyConversion(euros, exchangeRate) {\n const amount = euros * (exchangeRate / 100);\n const twoDecimal = amount.toFixed(2);\n return euros + ' ' + \"euros at an exchange rate of\" + ' ' + exchangeRate + ' ' + \"is\" + ' ' + twoDecimal + ' ' + \"U.S. dollars\";\n}",
"function Currency(str) {\n str = str - -0.5;\n var arr = new String(str);\n var arr1 = '';\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] != '.') {\n arr1 = arr1 + arr[i];\n }\n else {\n if (arr[i + 1] >= '5') {\n arr1[i] = arr[i] - -1;\n }\n break;\n }\n }\n var Gia = \"\";\n var dem = 0;\n for (var i = arr1.length - 1; i >= 0; i--) {\n dem++;\n Gia = Gia + arr1[i];\n if (dem == 3 && i != 0) {\n Gia = Gia + \",\";\n dem = 0;\n }\n }\n var arr2 = new String(Gia);\n var GiaMoi = '';\n for (var i = arr2.length - 1; i >= 0; i--) {\n GiaMoi = GiaMoi + arr2[i];\n }\n return GiaMoi;\n }",
"function convertPrice(price){\n return new Intl.NumberFormat('ru-RU').format(Math.round(price));\n}",
"function convertToCurrency(num) {\n return \"AUD \" + num.toFixed(2);\n}",
"convert() {\n return `${(this.payments.type.price[this.currencyType] / 100)}`;\n }",
"convert($geez_number) {\n const $parsed = this.parse($geez_number);\n\n return this.calculate($parsed);\n }",
"function convertToCelsius(num){\n return (num - 32) * 5 / 9;\n}",
"function cvtC(p){\n\tvar s = \"$\";\n\t s+= Number(p.toFixed(2) ).toLocaleString();\n\treturn s;\n}",
"function convertMoney(money) {\n return `$ ${money.toFixed(2).toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")}`\n}",
"changePrice() {\n var parts = this.precio.toFixed(2).toString().split(\".\");\n var result = parts[0].replace(/\\B(?=(\\d{3})+(?=$))/g, \".\") + (parts[1] ? \",\" + parts[1] : \"\");\n return `$${result}`;\n }",
"function convert (c) {\n \n var f=(9*c/5) + 32;\n return c + '°C is ' + f + '°F';\n \n \n}",
"function convertX(p) {\r\n return 0.2504 * p - 381.399\r\n}",
"function convert(){\r\nvar fsub = f.value-32;\r\nvar fdiv = fsub/1.8;\r\n c.innerHTML=fdiv+\"°C\";\r\n}",
"function formatNumberToIndianRupee ( number, options ) {\n\n\tif ( ! number )\n\t\treturn 0;\n\n\toptions = options || { };\n\tvar formattedNumber;\n\n\tnumber = parseStringToNumber( number );\n\tvar roundedNumber = number.toFixed( 0 );\n\tvar integerAndFractionalParts = ( roundedNumber + \"\" ).split( \".\" );\n\tvar integerPart = integerAndFractionalParts[ 0 ];\n\tvar fractionalPart = integerAndFractionalParts[ 1 ];\n\n\tvar lastThreeDigitsOfIntegerPart = integerPart.slice( -3 );\n\tvar allButLastThreeDigitsOfIntegerPart = integerPart.slice( 0, -3 );\n\n\tformattedNumber = allButLastThreeDigitsOfIntegerPart.replace( /\\B(?=(\\d{2})+(?!\\d))/g, \",\" );\n\n\tif ( allButLastThreeDigitsOfIntegerPart ) {\n\t\tformattedNumber += \",\";\n\t}\n\tformattedNumber += lastThreeDigitsOfIntegerPart;\n\n\tif ( fractionalPart ) {\n\t\tformattedNumber += \".\" + fractionalPart;\n\t}\n\n\tvar symbol = options.symbol === false ? \"\" : \"₹\";\n\tif ( /^-/.test( formattedNumber ) ) {\n\t\tformattedNumber = formattedNumber.replace( /^-/, \"minus \" + symbol );\n\t}\n\telse {\n\t\tformattedNumber = symbol + formattedNumber;\n\t}\n\n\treturn formattedNumber;\n\n}",
"function convertirDolarAEuro() {\n var listaPrecios = $('.precioProducto');\n var listaPreciosLength = listaPrecios.length;\n\n var _loop = function _loop(i) {\n $.getJSON(urlBasica.forex, {\n quantity: parseInt($(listaPrecios[i]).text(), 10),\n api_key: apiKey.Forex,\n format: 'json'\n }).done(function (response) {\n var posA = response.text.indexOf(' USD');\n var dolar = (response.text + \"\").substring(0, posA);\n var eur = response.value.toFixed(2);\n $(listaPrecios[i]).text(eur + '\\u20AC');\n });\n };\n\n for (var i = 0; i < listaPreciosLength; i += 1) {\n _loop(i);\n }\n}",
"function convertirDolarAEuro() {\n const listaPrecios = $('.precioProducto');\n const listaPreciosLength = listaPrecios.length;\n for (let i = 0; i < listaPreciosLength; i += 1) {\n $.getJSON(urlBasica.forex, {\n quantity: parseInt($(listaPrecios[i]).text(), 10),\n api_key: apiKey.Forex,\n format: 'json',\n }).done(function (response) {\n const posA = (response.text).indexOf(' USD');\n const dolar = (response.text+\"\").substring(0, posA);\n const eur = response.value.toFixed(2);\n $(listaPrecios[i]).text(`${eur}€`);\n });\n }\n}",
"function convertRate(price) {\n if (gCurrLang === 'he') {\n return price * gExcangeRates.quotes.USDILS\n } else if (gCurrLang === 'en') {\n return price\n }\n}",
"function convertToPennies(AmountFieldValue) {\n // if there is '£' sign only then the value is in GBP style.\n // Also, if there is a combination of both '£' and 'p' it will be in GBP style.\n //\n if (isValidInput(AmountFieldValue)) {\n var newAmountVal = cleanAmountText(AmountFieldValue);\n\n if (AmountFieldValue.charAt(0) == '£' || (AmountFieldValue.charAt(0) == '£' && AmountFieldValue.charAt(AmountFieldValue.length - 1) == 'p')) {\n //number is in GBP style\n return (Math.floor(parseFloat(newAmountVal) * 100));\n } else if (AmountFieldValue.charAt(AmountFieldValue.length - 1) == 'p' && newAmountVal.indexOf(\".\") == -1) {\n // if the input doesn't have a floating point, then it is Pennies style.\n // No conversion required!\n return (Math.floor(parseFloat(newAmountVal)));\n } else if (AmountFieldValue.charAt(AmountFieldValue.length - 1) == 'p' && newAmountVal.indexOf(\".\") >= 0) {\n // if the input has a floating point, then it is GBP style and it needs to be converted.\n return (Math.floor(parseFloat(newAmountVal) * 100));\n } else if (newAmountVal.indexOf(\".\") >= 0) {\n // if the input has a floating point, then it is GBP style and it needs to be converted.\n return (Math.floor(parseFloat(newAmountVal) * 100));\n } else {\n // if the input doesn't have a floating point, '£' or 'p', then it is Pennies style.\n // No conversion required!\n return (Math.floor(parseFloat(newAmountVal)));\n }\n } else {\n // the input does not match the input pattern\n return -1;\n }\n\n}",
"function formatEuroNumber(number) {\r\n\tvar str = String(number);\r\n\tvar res;\r\n\tif(str) {\r\n\t\tres = \"€ \" + str;\r\n\t}\r\n\treturn res;\r\n}",
"function parseEuroNumber(number) {\r\n\t// number muss ein String sein!\r\n\tvar str = String(number);\r\n\tvar res;\r\n\tif(str) {\r\n\t\tstr = str.replace(\"EUR\", \"\");\r\n\t\tstr = str.replace(\"€\", \"\");\r\n\t\tres = str;\r\n\t}\r\n\treturn res;\r\n}",
"function ConverterLibra() {\n var valorElemento = document.getElementById(\"valor\");\n var valor = valorElemento.value;\n var valorEmDolarNumerico = parseFloat(valor);\n var valorEmLibra = valorEmDolarNumerico * 0.72;\n var elementoValorConvertio = document.getElementById(\"valorConvertido\");\n var valorConvertido = \"O resultado em libra é £ \" + valorEmLibra + \".\";\n elementoValorConvertio.innerHTML = valorConvertido;\n}",
"function convert(){\n var c = document.querySelector(\"#c\").value;\n var f = c * 9/5 +32;\n document.querySelector(\"h3\").innerHTML = \"Result: \" + f+ \"°\"+ \"F\";\n}",
"function PWM_Func_DecimalPrice(Price, Format) {\n try {\n\n ///int\n var nPrice = 0, nFrac1 = 0, nFrac2 = 0, nFrac3 = 0;\n //Decimal\n //var dPrice = 0M;\n var dPrice = 0;\n //string[]\n var PriceParts = Price.toString().split('#');\n\n if (PriceParts.length > 0) {\n for (var index = 0; index < PriceParts.length; index++) {\n if (index == 0)\n nPrice = parseInt(PriceParts[index]);\n else if (index == 1) {\n if (Format < 16)\n nFrac1 = parseInt(PriceParts[index].substring(0, PriceParts[index].indexOf(\"/\")));\n else\n nFrac1 = parseInt(PriceParts[index]);\n }\n else if (index == 2)\n nFrac2 = parseInt(PriceParts[index]);\n else if (index == 3)\n nFrac3 = parseInt(PriceParts[index]);\n }\n dPrice = parseFloat(nPrice);\n if (Format == 0) //1/2=eHalfs\n {\n if (nFrac1 == 0)\n return (nPrice + \"^\" + dPrice);\n else\n return (nPrice + \"-\" + nFrac1 + \"/2\" + \"^\" + (dPrice + parseFloat(nFrac1) / 2));\n }\n else if (Format == 1) //1/4=eQuarters\n {\n if (nFrac1 == 0)\n return (nPrice + \"^\" + dPrice);\n else\n return (nPrice + \"-\" + nFrac1 + \"/4\" + \"^\" + (dPrice + parseFloat(nFrac1) / 4));\n }\n else if (Format == 2) //1/8=eEighths\n {\n return (nPrice + \"'\" + nFrac1 + \"^\" + (dPrice + parseFloat(nFrac1) / 8));\n }\n else if (Format == 3) //1/16=eSixteenths\n {\n if (nFrac1 == 0)\n return (nPrice + \"''00\" + \"^\" + dPrice);\n else if (nFrac1 > 0 && nFrac1 < 10)\n return (nPrice + \"''0\" + nFrac1 + \"^\" + (dPrice + parseFloat(nFrac1) / 16));\n else\n return (nPrice + \"''\" + nFrac1 + \"^\" + (dPrice + parseFloat(nFrac1) / 16));\n }\n else if (Format == 4) //1/32=eThirtySeconds\n {\n if (nFrac1 == 0)\n return (nPrice + \"-00\" + \"^\" + dPrice);\n else if (nFrac1 > 0 && nFrac1 < 10)\n return (nPrice + \"-0\" + nFrac1 + \"^\" + (dPrice + parseFloat(nFrac1) / 32));\n else\n return (nPrice + \"-\" + nFrac1 + \"^\" + (dPrice + parseFloat(nFrac1) / 32));\n }\n else if (Format == 5) //1/64=eSixtyFourths\n {\n if (nFrac1 == 0)\n return (nPrice + \"^\" + dPrice);\n else\n return (nPrice + \"-\" + nFrac1 + \"/64\" + \"^\" + (dPrice + parseFloat(nFrac1) / 64));\n }\n else if (Format == 6) //1/128=eOneTwentyEights\n {\n if (nFrac1 == 0)\n return (nPrice + \"^\" + dPrice);\n else\n return (nPrice + \"-\" + nFrac1 + \"/128\" + \"^\" + (dPrice + parseFloat(nFrac1) / 128));\n }\n else if (Format == 7) //1/256=eTwoFiftySixths\n {\n if (nFrac1 == 0)\n return (nPrice + \"^\" + dPrice);\n else\n return (nPrice + \"-\" + nFrac1 + \"/256\" + \"^\" + (dPrice + parseFloat(nFrac1) / 256));\n }\n else if (Format == 8) {\n if (nFrac2 == 4) // if 2nd fraction is 4 then display \"+\" after 1st fraction\n {\n return (nPrice + \"-\" + ((nFrac1 == 0) ? \"00\" : nFrac1.toString()) + \"+\" + \"^\" + (dPrice + parseFloat(nFrac1) / 32 + parseFloat(0.031250 / 8 * nFrac2)));\n }\n else if (nFrac2 == 0) //if 2nd fraction is 0 then no need to display 2nd fraction\n {\n return (nPrice + \"-\" + ((nFrac1 == 0) ? \"00\" : nFrac1.toString()) + \"^\" + (dPrice + parseFloat(nFrac1) / 32));\n }\n else //show 2nd fraction after 1st fraction and dot\n {\n return (nPrice + \"-\" + ((nFrac1 == 0) ? \"00\" : nFrac1.toString()) + \".\" + nFrac2 + \"^\" + (dPrice + parseFloat(nFrac1) / 32 + parseFloat(0.031250 / 8 * nFrac2)));\n }\n }\n else if (Format == 9) //1/4R=eQuartersReduced\n {\n if (nFrac1 == 0)\n return (nPrice + \"^\" + dPrice);\n else if (nFrac1 == 2)\n return (nPrice + \"-\" + PWM_Func_GetReducedFraction(nFrac1, 4) + \"^\" + (dPrice + parseFloat(nFrac1) / 4));\n else\n return (nPrice + \"-\" + nFrac1 + \"/4\" + \"^\" + (dPrice + parseFloat(nFrac1) / 4));\n }\n else if (Format == 10) //1/8R=eEighthsReduced\n {\n if (nFrac1 == 0)\n return (nPrice + \"^\" + dPrice);\n else if (nFrac1 % 2 == 0)\n return (nPrice + \"-\" + PWM_Func_GetReducedFraction(nFrac1, 8) + \"^\" + (dPrice + parseFloat(nFrac1) / 8));\n else\n return (nPrice + \"-\" + nFrac1 + \"/8\" + \"^\" + (dPrice + parseFloat(nFrac1) / 8));\n }\n else if (Format == 11) //1/16R=eSixteenthsReduced\n {\n if (nFrac1 == 0)\n return (nPrice + \"^\" + dPrice);\n else if (nFrac1 % 2 == 0)\n return (nPrice + \"-\" + PWM_Func_GetReducedFraction(nFrac1, 16) + \"^\" + (dPrice + parseFloat(nFrac1) / 16));\n else\n return (nPrice + \"-\" + nFrac1 + \"/16\" + \"^\" + (dPrice + parseFloat(nFrac1) / 16));\n }\n else if (Format == 12) //1/32R=eThirtySecondsReduced\n {\n if (nFrac1 == 0)\n return (nPrice + \"^\" + dPrice);\n else if (nFrac1 % 2 == 0)\n return (nPrice + \"-\" + PWM_Func_GetReducedFraction(nFrac1, 32) + \"^\" + (dPrice + parseFloat(nFrac1) / 32));\n else\n return (nPrice + \"-\" + nFrac1 + \"/32\" + \"^\" + (dPrice + parseFloat(nFrac1) / 32));\n }\n else if (Format == 13) //1/64R=eSixtyFourthsReduced\n {\n if (nFrac1 == 0)\n return (nPrice + \"^\" + dPrice);\n else if (nFrac1 % 2 == 0)\n return (nPrice + \"-\" + PWM_Func_GetReducedFraction(nFrac1, 64) + \"^\" + (dPrice + parseFloat(nFrac1) / 64));\n else\n return (nPrice + \"-\" + nFrac1 + \"/64\" + \"^\" + (dPrice + parseFloat(nFrac1) / 64));\n }\n else if (Format == 14) //1/128R=eOneTwentyEightsReduced\n {\n if (nFrac1 == 0)\n return (nPrice + \"^\" + dPrice);\n else if (nFrac1 % 2 == 0)\n return (nPrice + \"-\" + PWM_Func_GetReducedFraction(nFrac1, 128) + \"^\" + (dPrice + parseFloat(nFrac1) / 128));\n else\n return (nPrice + \"-\" + nFrac1 + \"/128\" + \"^\" + (dPrice + parseFloat(nFrac1) / 128));\n }\n else if (Format == 15) //1/256R=eTwoFiftySixthsReduced\n {\n if (nFrac1 == 0)\n return (nPrice + \"^\" + dPrice);\n else if (nFrac1 % 2 == 0)\n return (nPrice + \"-\" + PWM_Func_GetReducedFraction(nFrac1, 256) + \"^\" + (dPrice + parseFloat(nFrac1) / 256));\n else\n return (nPrice + \"-\" + nFrac1 + \"/256\" + \"^\" + (dPrice + parseFloat(nFrac1) / 256));\n }\n else if (Format == 16) //1=e0DecimalPlaces\n {\n return (nPrice + \"^\" + dPrice);\n }\n else if (Format == 17) //0.1=e1DecimalPlace\n {\n return (nPrice + \".\" + (nFrac1.toString()).substring(0, 1) + \"^\" + dPrice + \".\" + nFrac1);\n }\n else if (Format == 18) //0.01=e2DecimalPlaces\n {\n return (nPrice + \".\" + nFrac1 + (nFrac2.toString()).substring(0, 1) + \"^\" + dPrice + \".\" + nFrac1 + nFrac2);\n }\n else if (Format == 19) //0.001=e3DecimalPlaces\n {\n return (nPrice + \".\" + nFrac1 + nFrac2 + (nFrac3.toString()).substring(0, 1) + \"^\" + dPrice + \".\" + nFrac1 + nFrac2 + nFrac3);\n }\n else if (Format == 20) //0.001=eFurtureRateHalfs\n {\n if (nFrac3 == 0)\n return (nPrice + \".\" + nFrac1 + nFrac2 + \"^\" + dPrice + \".\" + nFrac1 + nFrac2);\n else\n return (nPrice + \".\" + nFrac1 + nFrac2 + \"+\" + \"^\" + dPrice + \".\" + nFrac1 + nFrac2 + \"5\");\n }\n else if (Format == 21) //0.001=eFurtureRateQuarters\n {\n if (nFrac3 == 0)\n return (nPrice + \".\" + nFrac1 + nFrac2 + \"^\" + dPrice + \".\" + nFrac1 + nFrac2);\n else if (nFrac3 == 2)\n return (nPrice + \".\" + nFrac1 + nFrac2 + \"+\" + \"^\" + dPrice + \".\" + nFrac1 + nFrac2 + \"5\");\n else\n return (nPrice + \".\" + nFrac1 + nFrac2 + \".\" + nFrac3 + \"^\" + dPrice + \".\" + nFrac1 + nFrac2 + ((nFrac3 == 1) ? \"25\" : \"75\"));\n }\n }\n }\n catch (err) {\n PWM_Func_HandleJsError(\"PWM_Func_DecimalPrice\", err);\n }\n}"
] |
[
"0.7509184",
"0.70787",
"0.69346756",
"0.66679895",
"0.66138965",
"0.6537474",
"0.64933497",
"0.63803834",
"0.63189256",
"0.6294522",
"0.62887555",
"0.6285561",
"0.62005484",
"0.6194006",
"0.61798245",
"0.6174534",
"0.6166513",
"0.6156343",
"0.61549664",
"0.6137713",
"0.61114407",
"0.6110679",
"0.60973704",
"0.6085253",
"0.60544854",
"0.6039962",
"0.60295403",
"0.6024236",
"0.60055625",
"0.5997333"
] |
0.7094993
|
1
|
Pond To Euro CONVERT FUNCTION
|
function pond2euro() {
var pond2euro = 1.17;
var bedrag = document.querySelector("#bedrag").value;
document.getElementById("convert").value = (bedrag * pond2euro).toFixed(2);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function euroTopond() {\n var euro2pond = 0.85;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * euro2pond).toFixed(2);\n\n }",
"function dollarToeuro() {\n var dollar2euro = 0.91;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * dollar2euro).toFixed(2);\n\n }",
"function euroTodollar() {\n var euro2dollar = 1.10;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * euro2dollar).toFixed(2);\n\n }",
"function conversion(kelvin) {\n return Math.floor(kelvin * (9/5) - 459.67) + \"°F\";\n}",
"function toCurrency(){\n\n}",
"function CurrencyConvert(v,idx,full) {\n if(idx==undefined) idx = 0;\n var c = CurrencyData[idx];\n v = parseInt(10000*v/c[2])/10000;\n if(v>1 && v<1000) v=parseInt(10*v)/10;\n if(v>=1000 && v<10000) v=parseInt(v/1000)+\"千\";\n else if(v>=10000 && v<100000000) v=parseInt(v/10000)+\"萬\";\n else if(v>=100000000 && v<1000000000000) v=parseInt(v/100000000)+\"億\";\n else if(v>=1000000000000) v=parseInt(v/1000000000000)+\"兆\";\n return v+(full?c[0]+c[1]:\"\");\n }",
"function ConverterEuro() {\n var valorElemento = document.getElementById(\"valor\");\n var valor = valorElemento.value;\n var valorEmDolarNumerico = parseFloat(valor);\n var valorEmEuro = valorEmDolarNumerico * 0.85;\n var elementoValorConvertio = document.getElementById(\"valorConvertido\");\n var valorConvertido = \"O resultado em euro é € \" + valorEmEuro + \".\";\n elementoValorConvertio.innerHTML = valorConvertido;\n}",
"function currencyConversion(euros, exchangeRate) {\n const amount = euros * (exchangeRate / 100);\n const twoDecimal = amount.toFixed(2);\n return euros + ' ' + \"euros at an exchange rate of\" + ' ' + exchangeRate + ' ' + \"is\" + ' ' + twoDecimal + ' ' + \"U.S. dollars\";\n}",
"function formatEuroNumber(number) {\r\n\tvar str = String(number);\r\n\tvar res;\r\n\tif(str) {\r\n\t\tres = \"€ \" + str;\r\n\t}\r\n\treturn res;\r\n}",
"function convertToCelsius(num){\n return (num - 32) * 5 / 9;\n}",
"function convert(){\r\nvar fsub = f.value-32;\r\nvar fdiv = fsub/1.8;\r\n c.innerHTML=fdiv+\"°C\";\r\n}",
"function convertToCurrency(num) {\n return \"AUD \" + num.toFixed(2);\n}",
"function convertirDolarAEuro() {\n const listaPrecios = $('.precioProducto');\n const listaPreciosLength = listaPrecios.length;\n for (let i = 0; i < listaPreciosLength; i += 1) {\n $.getJSON(urlBasica.forex, {\n quantity: parseInt($(listaPrecios[i]).text(), 10),\n api_key: apiKey.Forex,\n format: 'json',\n }).done(function (response) {\n const posA = (response.text).indexOf(' USD');\n const dolar = (response.text+\"\").substring(0, posA);\n const eur = response.value.toFixed(2);\n $(listaPrecios[i]).text(`${eur}€`);\n });\n }\n}",
"function convertirDolarAEuro() {\n var listaPrecios = $('.precioProducto');\n var listaPreciosLength = listaPrecios.length;\n\n var _loop = function _loop(i) {\n $.getJSON(urlBasica.forex, {\n quantity: parseInt($(listaPrecios[i]).text(), 10),\n api_key: apiKey.Forex,\n format: 'json'\n }).done(function (response) {\n var posA = response.text.indexOf(' USD');\n var dolar = (response.text + \"\").substring(0, posA);\n var eur = response.value.toFixed(2);\n $(listaPrecios[i]).text(eur + '\\u20AC');\n });\n };\n\n for (var i = 0; i < listaPreciosLength; i += 1) {\n _loop(i);\n }\n}",
"function parseEuroNumber(number) {\r\n\t// number muss ein String sein!\r\n\tvar str = String(number);\r\n\tvar res;\r\n\tif(str) {\r\n\t\tstr = str.replace(\"EUR\", \"\");\r\n\t\tstr = str.replace(\"€\", \"\");\r\n\t\tres = str;\r\n\t}\r\n\treturn res;\r\n}",
"function convertPrice(price){\n return new Intl.NumberFormat('ru-RU').format(Math.round(price));\n}",
"function formatNumberToIndianRupee ( number, options ) {\n\n\tif ( ! number )\n\t\treturn 0;\n\n\toptions = options || { };\n\tvar formattedNumber;\n\n\tnumber = parseStringToNumber( number );\n\tvar roundedNumber = number.toFixed( 0 );\n\tvar integerAndFractionalParts = ( roundedNumber + \"\" ).split( \".\" );\n\tvar integerPart = integerAndFractionalParts[ 0 ];\n\tvar fractionalPart = integerAndFractionalParts[ 1 ];\n\n\tvar lastThreeDigitsOfIntegerPart = integerPart.slice( -3 );\n\tvar allButLastThreeDigitsOfIntegerPart = integerPart.slice( 0, -3 );\n\n\tformattedNumber = allButLastThreeDigitsOfIntegerPart.replace( /\\B(?=(\\d{2})+(?!\\d))/g, \",\" );\n\n\tif ( allButLastThreeDigitsOfIntegerPart ) {\n\t\tformattedNumber += \",\";\n\t}\n\tformattedNumber += lastThreeDigitsOfIntegerPart;\n\n\tif ( fractionalPart ) {\n\t\tformattedNumber += \".\" + fractionalPart;\n\t}\n\n\tvar symbol = options.symbol === false ? \"\" : \"₹\";\n\tif ( /^-/.test( formattedNumber ) ) {\n\t\tformattedNumber = formattedNumber.replace( /^-/, \"minus \" + symbol );\n\t}\n\telse {\n\t\tformattedNumber = symbol + formattedNumber;\n\t}\n\n\treturn formattedNumber;\n\n}",
"convert($geez_number) {\n const $parsed = this.parse($geez_number);\n\n return this.calculate($parsed);\n }",
"function convert (c) {\n \n var f=(9*c/5) + 32;\n return c + '°C is ' + f + '°F';\n \n \n}",
"function convertRate(price) {\n if (gCurrLang === 'he') {\n return price * gExcangeRates.quotes.USDILS\n } else if (gCurrLang === 'en') {\n return price\n }\n}",
"function convertToEpic(input) {\n\tswitch (input) {\n\t\tcase 0:\n\t\toutput = 0;\n\t\tbreak;\n\t\tcase 1:\n\t\toutput = 1;\n\t\tbreak;\n\t\tcase 2:\n\t\toutput = 2;\n\t\tbreak;\n\t\tcase 3:\n\t\toutput = 4;\n\t\tbreak;\n\t\tcase 4:\n\t\toutput = 7;\n\t\tbreak;\n\t\tcase 5:\n\t\toutput = 11;\n\t\tbreak;\n\t\tcase 6:\n\t\toutput = 16;\n\t\tbreak;\n\t\tcase 7:\n\t\toutput = 22;\n\t\tbreak;\n\t\tcase 8:\n\t\toutput = 29;\n\t\tbreak;\n\t\tcase 9:\n\t\toutput = 37;\n\t\tbreak;\n\t\tcase 10:\n\t\toutput = 46;\n\t\tbreak;\n\t}\n\treturn output;\n}",
"function Currency(str) {\n str = str - -0.5;\n var arr = new String(str);\n var arr1 = '';\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] != '.') {\n arr1 = arr1 + arr[i];\n }\n else {\n if (arr[i + 1] >= '5') {\n arr1[i] = arr[i] - -1;\n }\n break;\n }\n }\n var Gia = \"\";\n var dem = 0;\n for (var i = arr1.length - 1; i >= 0; i--) {\n dem++;\n Gia = Gia + arr1[i];\n if (dem == 3 && i != 0) {\n Gia = Gia + \",\";\n dem = 0;\n }\n }\n var arr2 = new String(Gia);\n var GiaMoi = '';\n for (var i = arr2.length - 1; i >= 0; i--) {\n GiaMoi = GiaMoi + arr2[i];\n }\n return GiaMoi;\n }",
"function convert(){\n var c = document.querySelector(\"#c\").value;\n var f = c * 9/5 +32;\n document.querySelector(\"h3\").innerHTML = \"Result: \" + f+ \"°\"+ \"F\";\n}",
"function eurfunc()\r\n{\r\n inr.value = parseFloat(eur.value) * 1.43448;\r\n usd.value = parseFloat(eur.value) * 0.70641;\r\n cad.value = parseFloat(eur.value) * 0.72037;\r\n aud.value = parseFloat(eur.value) * 0.62382;\r\n}",
"function convert (celsius){\n var fahrenheit = ((celsius * 9/5) +32);\n console.log(celsius +\" degrees celsius equates to: \"+fahrenheit + \" \"+ \"fahrenheit\");\n }",
"function convertX(p) {\r\n return 0.2504 * p - 381.399\r\n}",
"convert() {\n return `${(this.payments.type.price[this.currencyType] / 100)}`;\n }",
"function convertToCelsius(fahrenheit){\n let temp = (Number(fahrenheit)-32) * 5/9;\n return temp.toFixed(2);\n }",
"kelvinToCelsius(kelvin) {\n return Math.floor(kelvin - 273) + \" °C\"\n }",
"function convertToCelcius(x){\n let kelvin = 273.15;\n let temp = x - kelvin; \n temp = Math.round(temp);\n return temp;\n}"
] |
[
"0.7081263",
"0.70436895",
"0.6820045",
"0.65416956",
"0.65415627",
"0.6422886",
"0.6411635",
"0.62857646",
"0.628178",
"0.6262123",
"0.621799",
"0.61933947",
"0.6176558",
"0.6171094",
"0.61676157",
"0.6163205",
"0.6142973",
"0.61243206",
"0.6101886",
"0.609606",
"0.60783726",
"0.6074158",
"0.60454917",
"0.5983474",
"0.5968209",
"0.596324",
"0.5961785",
"0.59148455",
"0.5887957",
"0.5885275"
] |
0.74830157
|
0
|
randomly change the light
|
function changeLight() {
if (OrangeCounter > 0) {
LIGHT = "Orange";
OrangeCounter -= 1;
}
else if (random() < ChangeProb) {
newLIGHT = ((LIGHT == "Red") ? "Green" : "Red");
OrangeCounter = OrangeTime;
} else if (OrangeCounter <= 0) {
OrangeCounter = 0;
LIGHT = newLIGHT;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function fakeLight(){\n pntLight = false;\n}",
"function randomStopLight() {\n var randomNumber = Math.floor(Math.random() * 10);\n if (randomNumber < 3) {\n return \"Red\";\n } else if(randomNumber >= 3 && randomNumber <= 6) {\n return \"Yellow\";\n } else {\n return \"Green\";\n }\n}",
"function realLight(){\n pntLight = true;\n}",
"alterWind() {\n var change = Math.random() * 0.1;\n if(Math.random() > 0.5)\n change *= -1;\n\n if(Math.random() > 0.6)\n this.wind[0] += change;\n else\n this.wind[2] += change;\n vec3.normalize(this.wind, this.wind);\n\n vec3.scale(this.wind, this.wind, this.windStrength);\n }",
"function changeColor()\n{\n if (this.style.backgroundColor === 'rgb(255, 255, 255)' || flag === 1)\n {\n this.style.backgroundColor = 'rgb(' + Math.floor(Math.random() * 256) + ','\n + Math.floor(Math.random() * 256) + ',' + Math.floor(Math.random() * 256) + ')';\n }\n else if (flag === 0)\n {\n let lightness = parseInt(this.style.filter.match(/\\d+/));\n lightness != 0 ? this.style.filter = `brightness(${lightness - 10}%)` : false;\n }\n}",
"setRandomColor() {\n const r = Math.floor(Math.random() * 255);\n const g = Math.floor(Math.random() * 255);\n const b = Math.floor(Math.random() * 255);\n \n this.setColorState([r, g, b]);\n }",
"function getRandomLightColor() {\n var letters = '0123456789ABCDEF';\n var color = '#';\n for (var i = 0; i < 6; i++) {\n color += letters[(Math.floor(Math.random() * 15)+1)];\n }\n return color;\n }",
"function buttonRainbowMode() {\n randomBirdsColourChange();\n}",
"function pickRandomColors(element, lightness) {\n element.style.setProperty(\"--lightness\", lightness);\n element.style.background = `hsl(${getRndInteger(0, 361)},${getRndInteger(0, 101)}%,${lightness}%)`;\n}",
"function updateLights(gl){\n if(isDisco){ // If disco mode is on\n xDisco+=1;\n for(var i=0; i<12; i++){\n lightColours[i]=randomLights[i].getVal(xDisco); // Randomise the lights\n }\n }else{\n for(var i=0; i<12; i++){\n lightColours[i]=1; // Set the lights to 1\n }\n }\n if(sunOn){\n if(sunTime+0.005>2*Math.PI){\n sunTime=0;\n }else{\n sunTime+=0.001;\n }if(won){ // If you got all the entities on the roof\n xSun+=1;\n gl.uniform3f(program.u_AmbientLight, randomSun[0].getVal(xSun), randomSun[1].getVal(xSun), randomSun[2].getVal(xSun)); // Randomise the ambient light\n gl.clearColor(randomSun[0].getVal(xSun), randomSun[1].getVal(xSun), randomSun[2].getVal(xSun),1); // Randomise the clear colour\n }else{\n sunBrightness=0.6+0.4*Math.sin(sunTime);\n gl.uniform3f(program.u_AmbientLight, sunBrightness, sunBrightness, sunBrightness); // Do the day/night cycle\n gl.clearColor(0,0,sunBrightness,1-0.6*sunBrightness);\n }\n }else{\n gl.uniform3f(program.u_AmbientLight, 0.7, 0.7, 0.7);\n }\n gl.uniform1iv(program.lightsOn, lightsOn); // Set whether the point lights are on\n gl.uniform3fv(program.lightColours, lightColours); // Set the point light colours\n gl.uniform3fv(program.lightPositions, lightPositions); // Set the point light positions\n\n}",
"function lightningGenerator() {\n\n let odds = random(0, 1);\n\n //FLASHING EFFECT//\n lightning.alpha = lightning.alpha - lightning.speed;\n lightingInside.alpha = lightingInside.alpha - lightingInside.speed;\n\n //PLAYS LIGHTNING AT ADJUSTABLE ODDS//\n if (odds > 0.998) {\n\n if (isOutside) {\n\n //EFFECTS ONLY OUTSIDE LIGHNING EFFECT//\n lightningSFX.setVolume(1);\n lightningSFX.play();\n lightning.alpha = 210;\n } else {\n\n //EFFECTS INSIDE AND OUTSIDE LIGHTNING EFFECT//\n lightningSFX.setVolume(0.3);\n lightningSFX.play();\n lightning.alpha = 210;\n lightingInside.alpha = 200;\n }\n\n }\n\n push();\n fill(lightning.color, lightning.alpha);\n rect(0, 0, width, height);\n pop();\n}",
"function changeColor() {\n const random = Math.floor(Math.random() * colorsArray.length);\n event.target.style.color = colorsArray[random];\n}",
"function lightMode() {\n change(\n \"rgb(255 255 255 / 50%)\",\n \"rgb(0 0 0 / 50%)\",\n \"Light Mode\",\n \"fa-moon\",\n \"fa-sun\",\n \"img/undraw_proud_coder_light.svg\",\n \"img/undraw_feeling_proud_light.svg\",\n \"img/undraw_conceptual_idea_light.svg\"\n );\n \n}",
"function switchLight(lightNumber) {\n allOff();\n var light = LIGHTS[lightNumber];\n light.classList.add(\"on\");\n\n if (lightNumber == 0)\n red();\n\n if (lightNumber == 2)\n ready();\n}",
"function assignRandomColor1(){\r\n color1.value = getRandomColor();\r\n setGradient();\r\n}",
"function colorChange() {\n let x = Math.floor(Math.random() * 248);\n let y = Math.floor(Math.random() * 248);\n let z = Math.floor(Math.random() * 248);\n let linkColor = \"rgb(\" + x + \",\" + y + \",\" + z + \")\";\n return linkColor;\n}",
"function RandomColor()\n{\nif( shapeColor.length > 0)\n {\nvar newColor = Random.Range(0,shapeColor.length);\nGetComponent.<Renderer>().material.color = shapeColor[newColor];\n }\n}",
"function changeGray() {\n gray = random(0, 255, 0);\n}",
"function lightChangingFunction() {\n nextActive = chooseNewNumber(active);\n\n lightButtons[nextActive].classList.toggle(\"chosenButton\");\n lightButtons[active].classList.remove(\"chosenButton\");\n\n timesBlinked++;\n blinked.push(timesBlinked);\n\n if (blinked.length > 3) {\n stopTheGame();\n return;\n }\n\n active = nextActive;\n\n function chooseNewNumber(active) {\n pressedOnce = false;\n let nextActive = getRandomNumber(0, 3);\n if (nextActive != active) {\n return nextActive;\n } else {\n return chooseNewNumber(active);\n }\n }\n\n timer = setTimeout(lightChangingFunction, gameSpeed);\n}",
"function light(){\n\n console.log('SHOW TIME');\n gsap.set(\"#light\",{display:\"block\", scale:.75, alpha:.25, transformOrigin:\"center center\"});\n\n lightTL.to(\"#light\",{duration:1, scale:1, aplha:1, yoyo:true, repeat:-1, ease:\"back.out\"});\n\n lightTL.play()\n }",
"function randnomColor(){\n randnomColorCalcVar = true;\n opacityTaggle(\"false\");\n hoverActivate();\n\n}",
"function toggleLight() {\n setLit(!islit);\n }",
"function resetLight() {\r\n\tgl.uniform4fv(gl.getUniformLocation(program, \"ambientProduct\"), flatten(ambientProduct));\r\n\tgl.uniform4fv(gl.getUniformLocation(program, \"specularProduct\"), flatten(specularProduct));\r\n}",
"function randomOn() {\n if (blinks < blink) {\n i = Math.floor(Math.random() * antall);\n on[i] = true;\n blinks++;\n startTime = new Date().getTime();\n updateView();\n timeID = setTimeout(off, 1500);\n updateView();\n } else { clearInterval(blinkID); }\n \n}",
"function changeGray() {\n g = random(0, 255);\n}",
"function flashy_random_color() {\n //to get flashy color let red to 255 and change green and blue\n var g=Math.floor(255*Math.random())\n var b=Math.floor(255*Math.random())\n return \"rgb(255,\"+g+\",\"+b+\")\"\n}",
"illuminateColor(color){\r\n this.color[color].classList.add('light')\r\n setTimeout(()=>this.turnOffColor(color),350)\r\n}",
"function randomColor(e){\n let randomColor = '#' + Math.floor(Math.random()*16777215).toString(16);\n e.target.style.setProperty('--random-color', randomColor);\n e.target.classList.add('colorChange');\n e.target.classList.remove('greyScale');\n}",
"function generateRed() {\n choice = randomIntFromInterval(0, 1);\n switch (choice) {\n case 0:\n hue = randomIntFromInterval(Hrainbow.red.low1, Hrainbow.red.high1);\n \n case 1:\n hue = randomIntFromInterval(Hrainbow.red.low2, Hrainbow.red.high2);\n }\n return hue;\n}",
"function changeColor() {\n let colorArr = [\"red\", \"green\", \"blue\", \"yellow\", \"pink\", \"purple\", \"grey\"];\n let colorChangeIdx = Math.floor(Math.random() * colorArr.length);\n let body = document.getElementsByTagName(\"body\")[0];\n body.style.backgroundColor = colorArr[colorChangeIdx];\n}"
] |
[
"0.73495024",
"0.7308613",
"0.7187673",
"0.6919768",
"0.6912044",
"0.6880123",
"0.6871698",
"0.6805461",
"0.6795812",
"0.671041",
"0.6692147",
"0.6655923",
"0.6650478",
"0.66353744",
"0.6598286",
"0.6590681",
"0.6583609",
"0.6563177",
"0.6562443",
"0.65593904",
"0.6536377",
"0.6521601",
"0.6518582",
"0.6501367",
"0.6499987",
"0.6496285",
"0.6481375",
"0.6463587",
"0.64288753",
"0.6421147"
] |
0.7821203
|
0
|
This function is in charge of loading up all the cupcakes we have in the db so we can display them on the page. The function calls the getCupcakes() method of Class CupcakeList and stores the instance in our cupcakes global variable like mentioned above. The function also calls the createHTML function that will generate the list element with the cupcake information We add eventlisteners to each individual delete button as well
|
async function loadCupcakes() {
let response = await CupcakeList.getCupcakes();
cupcakes = response;
console.log(cupcakes)
$cupcakeList.empty();
for (let cc of cupcakes.cupcakes) {
console.log(cc)
const html = createHTML(cc);
$cupcakeList.append(html);
let delBtn = document.getElementById(`del-btn-${cc.id}`);
delBtn.addEventListener("click",deleteCupcake);
let editBtn = document.getElementById(`edit-btn-${cc.id}`);
editBtn.addEventListener("click",showEditForm);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function generateAndAppendCupcakeHtml(cupcake) {\n let html = `\n <li>\n Flavor:${cupcake.flavor}, \n Rating: ${cupcake.rating}, \n Size: ${cupcake.size}\n </li>\n <img src=${cupcake.image}><img>\n `;\n $updateCupcakeList.append(html);\n}",
"async function showCupcakes() {\n let response = await axios.get(BASE_URL);\n let cupcakes = response.data.cupcakes;\n\n $cupcakeList.empty();\n addCupcakesToDOM(cupcakes);\n}",
"function generateCupcakeHTML(cupcake) {\r\n return `\r\n <div data-cupcake-id=${cupcake.id}>\r\n <li>\r\n ${cupcake.flavor} / ${cupcake.size} / ${cupcake.rating}\r\n <button class=\"delete-button\">X</button>\r\n </li>\r\n <img class=\"Cupcake-img\"\r\n src=\"${cupcake.image}\"\r\n alt=\"(no image provided)\">\r\n </div>\r\n `;\r\n}",
"async function deleteCupcake() {\r\n let $id = $(this).data('id');\r\n let response = await CupcakeList.deleteCupcake($id,cupcakes);\r\n cupcakes = response;\r\n console.log(cupcakes)\r\n $(this).parent().parent().parent().remove();\r\n }",
"async function displayCupcakes() {\n const response = await axios.get(`${BASE_URL}/cupcakes`);\n\n for (let cupcake of response.data.cupcakes) {\n let addCupcake = $(cupcakeHTML(cupcake));\n $(\"#menu-list\").append(addCupcake);\n }\n}",
"async function makeCupcake() {\n\t// Get values\n\tconst flavor = $('#flavor').val();\n\tconst size = $('#size').val();\n\tconst rating = $('#rating').val();\n\tconst image = $('#image').val() ? $('#image').val() : null;\n\t// API POST Request\n\tif (image !== null) {\n\t\tconst response = await axios.post(BASE_URL, { flavor, size, rating, image });\n\t} else {\n\t\tconst response = await axios.post(BASE_URL, { flavor, size, rating });\n\t}\n\t// Append new cupcake to DOM\n\tcupcake = response.data.cupcake;\n\t$cupcakeList.prepend(makeLI(cupcake));\n}",
"async function createCupcake() {\r\n let flavor = $flavor.val();\r\n let size = $size.val();\r\n let rating = $rating.val();\r\n let image = $ccImage.val();\r\n\r\n let newCupcake = {flavor,size,rating,image}\r\n await CupcakeList.createCupcake(newCupcake)\r\n await loadCupcakes();\r\n }",
"async function getAndDisplayCupcakes() {\n\n let cupcakes = await getCupcakes();\n\n for (let cupcake of cupcakes) {\n generateAndAppendCupcakeHtml(cupcake);\n }\n}",
"async function showCupcakesOnStart(){\n\n let response = await axios.get(`${BASE_URL}cupcakes`);\n let cupcakes = response.data.cupcakes;\n\n for (let cupcake of cupcakes){\n let $cupcakeDiv = $('<div>');\n let $cupcakeImg = $('<img>').attr(\"src\", cupcake.image);\n let $cupcakeFlavor = $('<h3>').text(cupcake.flavor);\n let $cupcakeRating = $('<h3>').text(cupcake.rating);\n let $cupcakeSize = $('<h3>').text(cupcake.size);\n $cupcakeDiv.append($cupcakeFlavor)\n .append($cupcakeImg)\n .append($cupcakeRating)\n .append($cupcakeSize)\n let $cupcakeListItem = $('<li>').append($cupcakeDiv);\n $cupcakeList.append($cupcakeListItem);\n }\n\n}",
"async function showInitialCupcakes() {\r\n const response = await axios.get(`${BASE_URL}/cupcakes`);\r\n\r\n for (let cupcakeData of response.data.cupcakes) {\r\n let newCupcake = $(generateCupcakeHTML(cupcakeData));\r\n $(\"#cupcakes-list\").append(newCupcake);\r\n }\r\n}",
"function createHTML(cupcake) {\r\n const cupcakeHTML = $(`\r\n <div class=\"card col-3 m-3 card-${cupcake.id}\">\r\n <h1 class=\"text-center\">${cupcake.flavor}</h1>\r\n <img src=\"${cupcake.image}\" class=\"card-img-top\" id=\"cupcake-image\">\r\n <div class=\"card-body d-flex justify-content-center flex-column\">\r\n <h3>Size: <span class=\"h3-size ms-2\">${cupcake.size}</span></h3>\r\n <h3>Rating: <span class=\"h3-rating ms-2\">${cupcake.rating}</span></h3>\r\n <div class=\"d-flex flex-row\">\r\n <button class=\"btn btn-sm btn-success ms-2\" id=\"edit-btn-${cupcake.id}\" data-id=\"${cupcake.id}\">Edit</button>\r\n <button class=\"btn btn-sm btn-danger ms-2\" id=\"del-btn-${cupcake.id}\" data-id=\"${cupcake.id}\">X</button>\r\n </div> \r\n </div>\r\n </div>\r\n `);\r\n return cupcakeHTML;\r\n }",
"async function displayCupcakes() {\n\tresponse = await axios.get(BASE_URL);\n\tcupcakes = response.data.cupcakes;\n\tfor (cupcake of cupcakes) {\n\t\t$cupcakeContainer.append(makeDiv(cupcake));\n\t}\n}",
"function renderCafe(doc) {\n let li = document.createElement('li')\n let name = document.createElement('span')\n let city = document.createElement('span')\n // creating element for deleting\n let cross = document.createElement('div')\n\n li.setAttribute('data-id', doc.id) // to get the document's ID from firestore\n // setting the text contents for the elts we created\n name.textContent = doc.data().name\n city.textContent = doc.data().city\n cross.textContent = 'x'\n\n // next, gotta append the name & city to the li\n li.appendChild(name)\n li.appendChild(city)\n li.appendChild(cross)\n\n // lastly, gotta append the li we created to the ul element of cafeList\n cafeList.appendChild(li)\n\n // deleting data\n cross.addEventListener('click', (e) => {\n let id = e.target.parentElement.getAttribute(\"data-id\") // note that this 'data-id' is actually the doc.id... ref line 22\n db.collection('cafes').doc(id).delete()\n })\n}",
"function renderCafe(doc) {\n let li = document.createElement('li');\n li.setAttribute('data-id', doc.id);\n\n let name = document.createElement('span');\n name.textContent = doc.data().name;\n li.appendChild(name);\n\n let city = document.createElement('span');\n city.textContent = doc.data().city;\n li.appendChild(city);\n\n let deleteButton = document.createElement('div');\n deleteButton.textContent = 'x';\n li.appendChild(deleteButton);\n deleteButton.addEventListener('click', (evt) => {\n evt.stopPropagation();\n let id = evt.target.parentElement.getAttribute('data-id');\n db.collection('cafes').doc(id).delete();\n })\n\n cafeList.append(li);\n}",
"function renderCafe(doc) {\n let li = document.createElement('li');\n let name = document.createElement('span');\n let city = document.createElement('span');\n let cross = document.createElement('div');\n // We don't need to put 'doc.data.id' because the id is stored at the top of the document, no inside the data!\n li.setAttribute('data-id', doc.id);\n name.textContent = doc.data().name; // remember to call the method data() WITH PARENTHESIS!!!\n city.textContent = doc.data().city;\n cross.textContent = 'x';\n\n li.appendChild(name);\n li.appendChild(city);\n li.appendChild(cross);\n cafeList.appendChild(li); // Add this custom li to the ul #cafe-list\n\n // Deleting data:\n cross.addEventListener('click', (e) => {\n e.stopPropagation();\n let id = e.target.parentElement.getAttribute('data-id') // We set the data-id attribute as doc.id of the database\n db.collection('cafes').doc(id).delete();\n })\n}",
"function renderCafe(doc) {\n\tlet li = document.createElement('li');\n\tlet name = document.createElement('span');\n\tlet city = document.createElement('span');\n\tlet cross = document.createElement('div');\n\t// setting data into our element/attribute\n\tli.setAttribute('data-id', doc.id);\n\tname.textContent = doc.data().name;\n\tcity.textContent = doc.data().city;\n\tcross.textContent = 'x';\n\t// append our elements\n\tli.appendChild(name);\n\tli.appendChild(city);\n\tli.appendChild(cross);\n\t//append to cafeList - document\n\tcafeList.appendChild(li);\n\n\t//delete data by Id from firestore db\n\tcross.addEventListener('click', (e) => {\n\t\te.stopPropagation();\n\t\tlet id = e.target.parentElement.getAttribute('data-id');\n //console.log(id);\n db.collection('cafes').doc(id).delete();\n\t})\n}",
"function renderCafe(doc){\n let li = document.createElement('tr');\n li.setAttribute('class', 'table-success');\n let blank = document.createElement('td');\n blank.setAttribute('class', 'table-success');\n let name = document.createElement('td');\n name.setAttribute('class', 'table-success');\n let city = document.createElement('td');\n city.setAttribute('class', 'table-success');\n\n let tdDelete = document.createElement('td');\n let tdUpdate = document.createElement('td');\n var btnDelete = document.createElement(\"BUTTON\");\n btnDelete.setAttribute('class', 'btn btn-danger');\n btnDelete.textContent = 'X'; \n tdDelete.appendChild(btnDelete);\n\n\n var btnUpdate = document.createElement(\"BUTTON\");\n btnUpdate.setAttribute('class', 'btn btn-warning');\n btnUpdate.textContent = '!';\n tdUpdate.appendChild(btnUpdate);\n\n li.setAttribute('data-id', doc.id);\n name.textContent = doc.data().name;\n city.textContent = doc.data().city;\n\n li.appendChild(blank);\n li.appendChild(name);\n li.appendChild(city);\n li.appendChild(tdDelete);\n li.appendChild(tdUpdate);\n\n cafeTableList.appendChild(li);\n\n // deleting data\n btnDelete.addEventListener('click', (e) => {\n e.stopPropagation();\n let id = doc.id;\n db.collection('cafes').doc(id).delete();\n });\n // updating data\n btnUpdate.addEventListener('click', (e) => {\n idCafe = doc.id;\n window.location.href = '../../pages/products/update.html?id='+doc.id+'?imageUrl='+'https://firebasestorage.googleapis.com/v0/b/daniela-store.appspot.com/o/'+doc.id;\n });\n}",
"function addCupFunction() {\r\n\tvar cupID = ++rowCount;\r\n\t$(\"div#row_to_insert table tbody tr\").attr(\"name\", cupID);\r\n\tvar str = $(\"div#row_to_insert table tbody\").html();\r\n\r\n\t// append html as a cup\r\n\t$(\"#table_order tr#add_new\").before(str);\r\n\t$(\"div#row_to_insert table tbody tr\").attr(\"name\", \"cup0\");\r\n\r\n\t// create cup object\r\n\tvar cup = new Cup(cupID);\r\n\tlistCup[cupID] = cup;\r\n\r\n\tdisableCheckoutButton(false);\r\n}",
"function allCats() {\n\n let cats = document.querySelector(\"body > main > section > ul\")\n fetch(\"database.json\")\n .then(response => response.json())\n .then(json => {\n Object.entries(json.cats).forEach(entry => {\n const [id, cat] = entry\n const {name, description, image, breed} = cat;\n let li = htmlFactory('li');\n let img = htmlFactory('img', 'src', image)\n let h3 = htmlFactory('h3');\n h3.textContent = name;\n let pOne = htmlFactory('p');\n pOne.innerHTML = `<span>Breed: </span> ${json.breed[breed]}`\n let pTwo = htmlFactory('p');\n pTwo.innerHTML = `<span>Description: </span> ${description}`\n let ul = htmlFactory('ul', 'class', 'buttons');\n let liOne = htmlFactory('li', 'class', 'btn edit');\n let editLink = htmlFactory(\"a\", 'href', `${id}`)\n editLink.textContent = 'Change Info'\n liOne.appendChild(editLink)\n let liTwo = htmlFactory('li', 'class', 'btn delete');\n let deleteLink = htmlFactory(\"a\", 'href', `${id}`)\n deleteLink.textContent = 'New Home'\n liTwo.appendChild(deleteLink)\n ul.append(liOne, liTwo)\n\n li.append(img, h3, pOne, pTwo, ul)\n // console.log(li)\n cats.appendChild(li)\n // let option = document.createElement(\"option\");\n // option.setAttribute(\"value\", key);\n // option.textContent = value;\n // breeds.appendChild(option)\n });\n });\n}",
"function populateTable(){\n var tableContent = '';\n // empty array to store all of our cuisine types\n var cuisines = [];\n // empty string to eventually store our select cuisine menu data\n var cuisineContent = '';\n\n // jquery AJAX call for JSON\n $.getJSON('/recipes/recipelist', function (data){\n\n // adds all recipe info from database to the global variable\n recipeListData = data;\n\n // for each item in our JSON, add a table row and cells to the content string\n $.each(data, function(){\n tableContent += '<tr>';\n // this checks the global selectedRecipes to see if the recipe has been selected already\n // if it has, it puts it in the table with a checked checkbox\n if (selectedRecipes.indexOf(this.name) === -1) {\n tableContent += '<td><input type=\"checkbox\" id=\"' + this.name.replace(/\\s+/g, '_') + 'Checkbox\" class=\"recipeCheckbox\"></td>';\n } else {\n tableContent += '<td><input type=\"checkbox\" id=\"' + this.name.replace(/\\s+/g, '_') + 'Checkbox\" class=\"recipeCheckbox\" checked></td>';\n }\n tableContent += '<td><a href=\"#\" class=\"linkshowuser\" rel=\"' + this.name + '\">' + this.name + '</a></td>';\n tableContent += '<td>' + this.cuisine + '</td>';\n tableContent += '</tr>';\n });\n\n // inject the whole content string into our existing HTML table\n $('#recipeList table tbody').html(tableContent);\n\n // create cuisine array to populate the select cuisine menu\n $.each(data, function(i){\n if (cuisines.indexOf(this.cuisine)=== -1) {\n cuisines.push(this.cuisine);\n }\n });\n\n // this function populates the Select Cuisine menu with all of the cuisines from the global recipeListData\n (function(){\n cuisineContent += '<option value=\"select\" selected>All Cuisines</option>';\n cuisines.forEach(function(item){\n cuisineContent += '<option value=\"' + item +'\">' + item + \"</option>\";\n });\n //menuContent += '</select>';\n })();\n\n $('#cuisine-select select').html(cuisineContent);\n });\n}",
"function populateList(){\n var members = membersXMLDoc.getElementsByTagName(\"Member\");//Retrieving xml document.\n var html = \"<ul id='delete-button-list'>\";// Creating the unordered list.\n //Iterating through the members and adding a li element for each of them.\n for (var i = 0; i < members.length; i++) {\n //Selecting the needed information from each member instance.\n var firstname = members[i].getElementsByTagName(\"Firstname\")[0].childNodes[0].nodeValue;\n //Inserting delete button list item into the list with the firstname of the member.\n html +=\"<li class='delete-button' value=\" + i + \">Delete: \" + firstname + \"</li>\";\n }\n //Closing unordered list and adding it into the list-container.\n html += \"</ul>\";\n $('#list-container').append(html);\n\n /* Adding functionality to the delete list items to delete the selected member from the xml\n file and reload the list, table and select element.\n */\n $(\".delete-button\").click(function(){\n membersXMLDoc.getElementsByTagName(\"Member\")[$(this).val()].remove();\n /*\n Saving xml document as a string into a cookie. New lines and returns were removed\n using a regular expression as only the first line of the document was being saved.\n Note: In a future release this should be saving to the server side.\n */\n document.cookie += \"=;expires=Thu, 05 Oct 1990 00:00:01 GMT;\";\n document.cookie = new XMLSerializer().serializeToString(membersXMLDoc).replace(/[\\r\\n]/g, '');\n removeCurrentContent();\n populateSelectElement();\n populateTable();\n populateList();\n });\n }",
"function listCatches() // Refreshes the list | Sorts them by id \n {\n fetch(CREATE_AND_LIST__URL)\n .then(res => res.json())\n .then(data => \n {\n elements.catchesForm.innerHTML = \"\";\n \n for (var catche in data) \n {\n var obj = data[catche];\n var catchDiv = document.createElement('div');\n catchDiv.classList.add('catch');\n var dataId = document.createAttribute('data-id');\n dataId.value = catche;\n catchDiv.setAttributeNode(dataId);\n \n catchDiv.innerHTML = `<label>Angler</label>`\n + `<input type=\"text\" class=\"angler\" value=\"${obj.angler}\" />`\n + `<hr>`\n + `<label>Weight</label>` \n + `<input type=\"number\" class=\"weight\" value=\"${obj.weight}\" />`\n + `<hr>`\n + `<label>Species</label>`\n + `<input type=\"text\" class=\"species\" value=\"${obj.species}\" />`\n + `<hr>`\n + `<label>Location</label>`\n + `<input type=\"text\" class=\"location\" value=\"${obj.location}\" />`\n + `<hr>`\n + `<label>Bait</label>`\n + `<input type=\"text\" class=\"bait\" value=\"${obj.bait}\" />`\n + `<hr>`\n + `<label>Capture Time</label>`\n + `<input type=\"number\" class=\"captureTime\" value=\"${obj.captureTime}\" />`\n + `<hr>`;\n //+ `<button class=\"update\">Update</button>`\n //+ `<button class=\"delete\">Delete</button>`;\n\n //Create update button\n let updateBtn = document.createElement(\"button\");\n updateBtn.classList.add(\"update\");\n updateBtn.textContent = \"Update\";\n updateBtn.addEventListener('click', updateCatch);\n catchDiv.appendChild(updateBtn);\n //Create delete button\n let deleteBtn = document.createElement(\"button\");\n deleteBtn.classList.add(\"delete\");\n deleteBtn.textContent = \"Delete\";\n deleteBtn.addEventListener('click', deleteCatch);\n catchDiv.appendChild(deleteBtn);\n\n elements.catchesForm.appendChild(catchDiv);\n }\n })\n .catch(e => console.log(e));\n }",
"function getCocktail() {\n\n var cocktailURL = \"https://www.thecocktaildb.com/api/json/v1/1/search.php?s=\" + cockName;\n\n $.getJSON(cocktailURL, function (response) {\n if (response.drinks === null) {\n \n M.toast({\n html: \"<div class='message'>Not found!</div>\",\n classes: 'rounded',\n displayLength: 1500,\n\n })\n }\n\n //display the coctail detail page\n // display the image\n $(\".blueLagoon\").hide();\n\n $(\".cocktailThumb\").attr(\"src\", response.drinks[0].strDrinkThumb);\n // display the instructions\n $(\"#strInstructions\").html(response.drinks[0].strInstructions);\n\n $(\"#strDrink\").text(response.drinks[0].strDrink);\n // clear the ingredients list\n $(\"#strIngredients\").html(\"\");\n // display the ingredients as a list, with the measures beside them\n if (response.drinks[0].strIngredient1 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient1 + \" \" + response.drinks[0].strMeasure1);\n\n }\n if (response.drinks[0].strIngredient2 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient2 + \" \" + response.drinks[0].strMeasure2);\n\n }\n if (response.drinks[0].strIngredient3 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient3 + \" \" + response.drinks[0].strMeasure3);\n\n }\n if (response.drinks[0].strIngredient4 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient4 + \" \" + response.drinks[0].strMeasure4);\n\n }\n if (response.drinks[0].strIngredient5 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient5 + \" \" + response.drinks[0].strMeasure5);\n }\n if (response.drinks[0].strIngredient6 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient6 + \" \" + response.drinks[0].strMeasure6);\n }\n if (response.drinks[0].strIngredient7 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient7 + \" \" + response.drinks[0].strMeasure7);\n }\n if (response.drinks[0].strIngredient8 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient8 + \" \" + response.drinks[0].strMeasure8);\n }\n if (response.drinks[0].strIngredient9 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient9 + \" \" + response.drinks[0].strMeasure9);\n }\n if (response.drinks[0].strIngredient10 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient10 + \" \" + response.drinks[0].strMeasure10);\n }\n if (response.drinks[0].strIngredient11 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient11 + \" \" + response.drinks[0].strMeasure11);\n }\n if (response.drinks[0].strIngredient12 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient12 + \" \" + response.drinks[0].strMeasure12);\n }\n if (response.drinks[0].strIngredient13 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient13 + \" \" + response.drinks[0].strMeasure13);\n }\n if (response.drinks[0].strIngredient14 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient14 + \" \" + response.drinks[0].strMeasure14);\n }\n if (response.drinks[0].strIngredient15 !== null) {\n $(\"#strIngredients\").append(\"<li>\" + response.drinks[0].strIngredient15 + \" \" + response.drinks[0].strMeasure15);\n }\n\n window.scrollTo(0, 0);\n fillCards(response);\n\n });\n}",
"function renderCafe(doc) {\n let li = document.createElement(\"li\");\n let name = document.createElement(\"span\");\n let city = document.createElement(\"span\");\n\n li.setAttribute(\"data-id\", doc.id);\n name.textContent = doc.data().name;\n city.textContent = doc.data().city;\n\n li.appendChild(name);\n li.appendChild(city);\n\n cafeList.appendChild(li);\n\n //delete data\n}",
"static render(){\n let find_card = document.querySelector('.card')\n if (User.all.length !== 0 ){\n if(find_card === null){\n listCardsDiv.style.display = 'table'\n randJokeParentDiv.style.display = 'none'\n\n //iterate through each list belonging to this user\n\n let thisUserLists = List.all\n thisUserLists.forEach(list => {\n\n let cardDiv = document.createElement('div')\n\n //create card elements\n //iterate thru user list names and each of their associated jokes\n\n let listCard = document.createElement('div')\n listCard.className ='card'\n listCard.style.display = 'inline-table'\n let cardContentDiv = document.createElement('div')\n cardContentDiv.className = 'content'\n let headerDiv = document.createElement('div')\n headerDiv.className = 'content'\n headerDiv.innerHTML = `${list.name}`\n\n let ulJokeDiv = document.createElement('div')\n ulJokeDiv.className = 'ui celled list'\n\n list.jokes.forEach(joke => {\n let jokeListItem = document.createElement('div')\n jokeListItem.className = 'item'\n jokeListItem.dataset.id = joke.id\n jokeListItem.innerHTML = `${joke.phrase}`\n let line_break = document.createElement('br')\n let deleteJokeButton = document.createElement('button')\n deleteJokeButton.className = 'mini ui red button'\n deleteJokeButton.type = 'button'\n deleteJokeButton.dataset.deleteJokeId = joke.id\n deleteJokeButton.innerText = 'Delete Joke'\n deleteJokeButton.onclick = (event) => {\n event.preventDefault()\n let list_joke = event.currentTarget\n fetch(`http://localhost:3000/joke_lists/delete`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json'\n },\n body: JSON.stringify({\n 'list_id': list.id,\n 'joke_id': joke.id\n })\n })\n list_joke.parentElement.remove()\n }\n jokeListItem.append(line_break, deleteJokeButton)\n ulJokeDiv.appendChild(jokeListItem)\n\n })\n let btnDiv = document.createElement('div')\n btnDiv.className = 'ui bottom attached button'\n btnDiv.innerHTML = \"<i class='trash alternate outline icon'></i> Delete List\"\n btnDiv.dataset.id = list.id\n btnDiv.onclick = event => {\n fetch(`http://localhost:3000/lists/${list.id}`, {\n method: 'DELETE',\n headers: {\n 'Content-Type': `application/json`\n }\n })\n event.target.parentElement.remove()\n }\n //append div 'items' to div 'ui bulleted list', append bulleted list, img, div class header to content div\n\n listCard.append(headerDiv, ulJokeDiv, btnDiv)\n\n\n //append content div to cardDiv (class= card), append cardDiv to cardParent (look this up)\n let uiCardsDiv = document.getElementById('ui-cards-div')\n uiCardsDiv.append(listCard)\n })\n }\n else{\n if (listCardsDiv.style.display === 'none'){\n listCardsDiv.style.display = 'table'\n randJokeParentDiv.style.display = 'none'\n }\n }\n }\n else{\n modal.style.display = \"block\";\n login_form.addEventListener('submit', (e)=>{\n e.preventDefault()\n User.fetchUser()\n })\n }\n }",
"function makeCake(){\n\t// Ik maak een variable cake met een array erin.\n\tvar cake = ['slagroom', 'frambozen', 'chocolade',];\n\n\treturn {\n\t\t//Hier maak ik gebruk van een object literal\n\t\tgetCake: function() {\n\t\t\t/* \tHier log ik een zinnetje met daarin cake.pop(). \n\t\t\t*\tcake alleen geeft mij de volledige array terug. \n\t\t\t*\tcake.pop() verwijderd het laatste element in de array en stuurt die terug. \n\t\t\t*\tReference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop\n\t\t\t*/\n\t\t\tconsole.log('Ik heb nu een ' + cake.pop() + 'taart');\n\t\t}\n\t};\n}",
"function addFoodList(){\n var pricing = getPrice[0].innerHTML;\n var priceVal = pricing.replace(/[^0-9.]/g, \"\");\n var getting = priceVal * getValue;\n var newLine = '<div class=\"orderBox\">';\n newLine += '\t <p class=\"nameOfFood\">';\n newLine += look[\"0\"].textContent +' x '+ getValue ;\n newLine +=' $ '\n newLine += ' <span class = subtotal>'\n newLine += parseFloat(getting);\n newLine += ' </span>'\n newLine += ' </p>';\n newLine += ' <div class= \"closeBtn\">';\n newLine += ' <i class=\"fa fa-times closing\"></i>'\n newLine += ' </div>'\n newLine += '</div>';\n $('.foodList').append(newLine);\n deleteItem ();\n lengthCheck();\n } // fires in line 44",
"function populateItems() {\n $(\"#dvLoading\").show();\n var projectName = datastore.getId();\n var projectTitle = datastore.getTitle();\n $('#project-data h2').text(projectTitle);\n\n // Update the list, once on inital open and subsequently on\n // changes to the datastore.\n function updateList() {\n console.log(\"starting updateList\");\n var items = datastore.getTable(tableName).query();\n var numItems = 0;\n \n // Rebuild the list of items\n $('#project-data tbody').empty().append(\n _.chain(items)\n // Sort by created date\n .sortBy(function (record) {\n return record.get(sortParameter);\n }) //.reverse() for descending ordering\n // Convert to list items like this:\n // <li id=\"{record ID}\"><button>X</button>{text}</li>\n .map(function (record) {\n var fileName = record.get('LOCAL_FILENAME').split('/');\n var filePath = projectName + '/' + fileName[fileName.length-1];\n var thumbnail_url = client.thumbnailUrl(filePath, {size: \"large\"});\n \n numItems++;\n var html = _.template('<tr id=\"${id}\"><td id=\"num\">${number}.</td><td id=\"thumb\"><a href=\"${pictureUrl}\" target=\"_blank\"><img src=\"${thumbnail}\" alt=\"Thumbnail\"></a></td><td id=\"date\">${date}</td><td id=\"location\">${location}</td><td id=\"artifact\">${artifact}</td><td id=\"description\">${description}</td><td id=\"gps\">${GPS}</td><td id=\"edit\"><a href=\"#\" id=\"record_edit\"><span class=\"glyphicon glyphicon-pencil\"></span></a><a href=\"#\" id=\"record_delete\"><span class=\"glyphicon glyphicon-trash\"></span></a></td></tr>', {\n id: record.getId(),\n number: numItems,\n pictureUrl: record.get('INTERNET_URL'),\n thumbnail: thumbnail_url,\n date: record.get('DATE'),\n location: record.get('LOCATION'),\n artifact: record.get('ARTIFACT_TYPE'),\n description: record.get('DESCRIPTION'),\n GPS: record.get('LONGITUDE').toString() + \" \" + record.get('LATITUDE').toString()\n });\n\n return $(html);\n\n }).value()\n );\n \n $(\"#dvLoading\").hide();\n\n //updateUIBasedOnRole();\n\n // Reflect the latest ACLs in the sharing dialog\n //$('#public').val(datastore.getRole('public'));\n //$('#team').val(datastore.getRole('team'));\n //$('.role').prop('disabled', datastore.getEffectiveRole() === 'viewer');\n\n // Handle deleting a record\n $(\"#project-data tr a#record_delete\").confirm({\n title:\"Delete record\",\n text: \"Are you sure you want to delete this record?\",\n confirm: function(button) {\n var recordId = $(button).parents('tr').attr('id');\n var filePath = getImageFilePath(recordId);\n\n // Delete the datastore record\n datastore.getTable(tableName).get(recordId).deleteRecord();\n\n // Delete the image associated with that record\n client.remove(filePath,\n function (error, data) {\n if (error) {\n return console.log(\"ERROR: \" + error); // Something went wrong.\n }\n \n // otherwise file is deleted \n }); \n },\n cancel: function(button) {\n // do nothing\n },\n confirmButton: \"Yes I am\",\n cancelButton: \"No\"\n });\n\n // Handle editing a record\n $(\"#project-data tr a#record_edit\").click(function (e) {\n e.preventDefault();\n // Get the proper record details\n var recordId = $(this).parents('tr').attr('id');\n selectedRecId = recordId;\n var record = datastore.getTable(tableName).get(recordId);\n var location = record.get('LOCATION');\n var artifact = record.get('ARTIFACT_TYPE');\n var description = record.get('DESCRIPTION');\n\n // Show the form\n $('#form-modal').addClass('md-show');\n\n // Display current values in form\n $('#form_location').val(location);\n $('#form_artifact_dropdown').val(artifact);\n $('#form_description').val(description);\n });\n }\n\n // Update on changes.\n datastore.recordsChanged.addListener(updateList);\n \n // Update UI with initial data.\n updateList();\n\n }",
"function makePage(){\n\n codeFellows.makeList();\n disneyLand.makeList();\n}",
"function renderCafe(doc){\r\n let li = document.createElement('li');\r\n let todo = document.createElement('span');\r\n let deadline = document.createElement('span');\r\n let cross = document.createElement('button');\r\n li.setAttribute('data-id', doc.id);\r\n todo.textContent = doc.data().todo;\r\n deadline.textContent = doc.data().deadline;\r\n cross.textContent='Delete_this';\r\n li.appendChild(todo);\r\n li.appendChild(deadline);\r\n li.appendChild(cross);\r\nconsole.log(li);\r\n plan.appendChild(li);\r\n\r\n //deleting data\r\n cross.addEventListener('click',(e)=>{\r\n e.stopPropagation();\r\n let id = e.target.parentElement.getAttribute('data-id');\r\n db.collection(email1).doc(email1).collection('todo').doc(id).delete();\r\n });\r\n}"
] |
[
"0.70023316",
"0.68733466",
"0.6830285",
"0.6762316",
"0.6643639",
"0.65214336",
"0.65027267",
"0.6493298",
"0.6473084",
"0.64505863",
"0.63219684",
"0.6290712",
"0.58831215",
"0.57692075",
"0.5597494",
"0.5576444",
"0.5563202",
"0.55607176",
"0.5525044",
"0.5514034",
"0.53895664",
"0.53762484",
"0.5340757",
"0.52652854",
"0.52514255",
"0.521215",
"0.52120924",
"0.5184776",
"0.517785",
"0.5174755"
] |
0.8008406
|
0
|
this is a function we use for creating a cupcake. This createCupcake function calls the createCupcake method of the CupcakeList class and passes in the values from our form. We then call the loadCupcakes function again to load the page with the newly created cupcake
|
async function createCupcake() {
let flavor = $flavor.val();
let size = $size.val();
let rating = $rating.val();
let image = $ccImage.val();
let newCupcake = {flavor,size,rating,image}
await CupcakeList.createCupcake(newCupcake)
await loadCupcakes();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"async function makeCupcake() {\n\t// Get values\n\tconst flavor = $('#flavor').val();\n\tconst size = $('#size').val();\n\tconst rating = $('#rating').val();\n\tconst image = $('#image').val() ? $('#image').val() : null;\n\t// API POST Request\n\tif (image !== null) {\n\t\tconst response = await axios.post(BASE_URL, { flavor, size, rating, image });\n\t} else {\n\t\tconst response = await axios.post(BASE_URL, { flavor, size, rating });\n\t}\n\t// Append new cupcake to DOM\n\tcupcake = response.data.cupcake;\n\t$cupcakeList.prepend(makeLI(cupcake));\n}",
"async function loadCupcakes() {\r\n let response = await CupcakeList.getCupcakes();\r\n cupcakes = response;\r\n console.log(cupcakes)\r\n $cupcakeList.empty();\r\n\r\n for (let cc of cupcakes.cupcakes) {\r\n console.log(cc)\r\n const html = createHTML(cc);\r\n $cupcakeList.append(html);\r\n let delBtn = document.getElementById(`del-btn-${cc.id}`);\r\n delBtn.addEventListener(\"click\",deleteCupcake);\r\n let editBtn = document.getElementById(`edit-btn-${cc.id}`);\r\n editBtn.addEventListener(\"click\",showEditForm);\r\n }\r\n }",
"async function handleCupcakeForm(evt) { \n evt.preventDefault();\n\n //CODE REVIEW: These variables don't nede the dollar sign because it's just the values and not jquery data\n let $flavor = $(\"#cupcake-flavor\").val();\n let $rating = $(\"#cupcake-rating\").val();\n let $size = $(\"#cupcake-size\").val();\n let $image = $(\"#cupcake-image\").val();\n\n const newCupcake = {\n flavor: $flavor,\n rating: $rating,\n size: $size,\n image: $image\n };\n\n console.log(\"this ran\");\n console.log(\"newCupcake=\",newCupcake);\n await addNewCupcake(newCupcake);\n\n generateAndAppendCupcakeHtml(newCupcake);\n}",
"function generateAndAppendCupcakeHtml(cupcake) {\n let html = `\n <li>\n Flavor:${cupcake.flavor}, \n Rating: ${cupcake.rating}, \n Size: ${cupcake.size}\n </li>\n <img src=${cupcake.image}><img>\n `;\n $updateCupcakeList.append(html);\n}",
"function generateCupcakeHTML(cupcake) {\r\n return `\r\n <div data-cupcake-id=${cupcake.id}>\r\n <li>\r\n ${cupcake.flavor} / ${cupcake.size} / ${cupcake.rating}\r\n <button class=\"delete-button\">X</button>\r\n </li>\r\n <img class=\"Cupcake-img\"\r\n src=\"${cupcake.image}\"\r\n alt=\"(no image provided)\">\r\n </div>\r\n `;\r\n}",
"function createHTML(cupcake) {\r\n const cupcakeHTML = $(`\r\n <div class=\"card col-3 m-3 card-${cupcake.id}\">\r\n <h1 class=\"text-center\">${cupcake.flavor}</h1>\r\n <img src=\"${cupcake.image}\" class=\"card-img-top\" id=\"cupcake-image\">\r\n <div class=\"card-body d-flex justify-content-center flex-column\">\r\n <h3>Size: <span class=\"h3-size ms-2\">${cupcake.size}</span></h3>\r\n <h3>Rating: <span class=\"h3-rating ms-2\">${cupcake.rating}</span></h3>\r\n <div class=\"d-flex flex-row\">\r\n <button class=\"btn btn-sm btn-success ms-2\" id=\"edit-btn-${cupcake.id}\" data-id=\"${cupcake.id}\">Edit</button>\r\n <button class=\"btn btn-sm btn-danger ms-2\" id=\"del-btn-${cupcake.id}\" data-id=\"${cupcake.id}\">X</button>\r\n </div> \r\n </div>\r\n </div>\r\n `);\r\n return cupcakeHTML;\r\n }",
"async function showInitialCupcakes() {\r\n const response = await axios.get(`${BASE_URL}/cupcakes`);\r\n\r\n for (let cupcakeData of response.data.cupcakes) {\r\n let newCupcake = $(generateCupcakeHTML(cupcakeData));\r\n $(\"#cupcakes-list\").append(newCupcake);\r\n }\r\n}",
"async function showCupcakes() {\n let response = await axios.get(BASE_URL);\n let cupcakes = response.data.cupcakes;\n\n $cupcakeList.empty();\n addCupcakesToDOM(cupcakes);\n}",
"async function addNewCupcake(newCupcake) {\n const response = await axios({\n url: `${BASE_URL}/cupcakes`,\n method: \"POST\",\n data: newCupcake\n })\n\n return response.data.cupcake;\n}",
"function addCupFunction() {\r\n\tvar cupID = ++rowCount;\r\n\t$(\"div#row_to_insert table tbody tr\").attr(\"name\", cupID);\r\n\tvar str = $(\"div#row_to_insert table tbody\").html();\r\n\r\n\t// append html as a cup\r\n\t$(\"#table_order tr#add_new\").before(str);\r\n\t$(\"div#row_to_insert table tbody tr\").attr(\"name\", \"cup0\");\r\n\r\n\t// create cup object\r\n\tvar cup = new Cup(cupID);\r\n\tlistCup[cupID] = cup;\r\n\r\n\tdisableCheckoutButton(false);\r\n}",
"async function showCupcakesOnStart(){\n\n let response = await axios.get(`${BASE_URL}cupcakes`);\n let cupcakes = response.data.cupcakes;\n\n for (let cupcake of cupcakes){\n let $cupcakeDiv = $('<div>');\n let $cupcakeImg = $('<img>').attr(\"src\", cupcake.image);\n let $cupcakeFlavor = $('<h3>').text(cupcake.flavor);\n let $cupcakeRating = $('<h3>').text(cupcake.rating);\n let $cupcakeSize = $('<h3>').text(cupcake.size);\n $cupcakeDiv.append($cupcakeFlavor)\n .append($cupcakeImg)\n .append($cupcakeRating)\n .append($cupcakeSize)\n let $cupcakeListItem = $('<li>').append($cupcakeDiv);\n $cupcakeList.append($cupcakeListItem);\n }\n\n}",
"async function displayCupcakes() {\n const response = await axios.get(`${BASE_URL}/cupcakes`);\n\n for (let cupcake of response.data.cupcakes) {\n let addCupcake = $(cupcakeHTML(cupcake));\n $(\"#menu-list\").append(addCupcake);\n }\n}",
"function _createCoffeeShop(email, brandId, address, phone, coffeeCode, longitude, latitude, callback) // this creates a new CoffeeShop\n{\n\n validate.valCoffeeshop(email, brandId, address, phone, coffeeCode, longitude, latitude, function (data)\n {\n if (data)\n {\n CoffeeShop.createCoffeeShop(email, brandId, address, phone, coffeeCode, longitude, latitude, function (data2)\n {\n\n callback(data2)\n })\n } else callback(false)\n })\n\n}",
"async function deleteCupcake() {\r\n let $id = $(this).data('id');\r\n let response = await CupcakeList.deleteCupcake($id,cupcakes);\r\n cupcakes = response;\r\n console.log(cupcakes)\r\n $(this).parent().parent().parent().remove();\r\n }",
"async function getAndDisplayCupcakes() {\n\n let cupcakes = await getCupcakes();\n\n for (let cupcake of cupcakes) {\n generateAndAppendCupcakeHtml(cupcake);\n }\n}",
"async function displayCupcakes() {\n\tresponse = await axios.get(BASE_URL);\n\tcupcakes = response.data.cupcakes;\n\tfor (cupcake of cupcakes) {\n\t\t$cupcakeContainer.append(makeDiv(cupcake));\n\t}\n}",
"function makeCake(){\n\t// Ik maak een variable cake met een array erin.\n\tvar cake = ['slagroom', 'frambozen', 'chocolade',];\n\n\treturn {\n\t\t//Hier maak ik gebruk van een object literal\n\t\tgetCake: function() {\n\t\t\t/* \tHier log ik een zinnetje met daarin cake.pop(). \n\t\t\t*\tcake alleen geeft mij de volledige array terug. \n\t\t\t*\tcake.pop() verwijderd het laatste element in de array en stuurt die terug. \n\t\t\t*\tReference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop\n\t\t\t*/\n\t\t\tconsole.log('Ik heb nu een ' + cake.pop() + 'taart');\n\t\t}\n\t};\n}",
"function createPage(){\nvar header = document.createElement('h3');\nheader.innerText = \"Shopping List\";\ndocument.body.appendChild(header);\ncreateForm();\npopulateList();\n}",
"function setUpForm()\r\n {\r\n var form = {\r\n patients : patients,\r\n phlebotomists : phlebotomists,\r\n pscs : pscs,\r\n labTests : labTests,\r\n diagnoses : diagnoses\r\n };\r\n\r\n if (appId)\r\n {\r\n form.title = \"Updating Appointment \" + appId;\r\n // fill form with preexisting appointment info\r\n } else\r\n form.title = \"Create New Appointment\";\r\n\r\n container.append(appointmentFormTemplate(form));\r\n\r\n // Updating fields\r\n $(\"select#patient\").change(function()\r\n {\r\n $(\"span#patient\").html(patients[$(this).val()].name);\r\n $(\"span#physician\").html(patients[$(this).val()].physician.name);\r\n }).change();\r\n\r\n $(\"select#phlebotomist\").change(function()\r\n {\r\n $(\"span#phlebotomist\").html(phlebotomists[$(this).val()].name);\r\n }).change();\r\n\r\n $(\"select#psc\").change(function()\r\n {\r\n $(\"span#psc\").html(pscs[$(this).val()].name);\r\n }).change();\r\n\r\n $(\"input#addLabTest\").click(function()\r\n {\r\n $(\"div#labTestsBlock\").append(labTestTemplate(form));\r\n\r\n $(\"select#labTests\").change(function()\r\n {\r\n $(this).parent().children(\"span#labTest\").html(labTests[$(this).val()].name);\r\n }).change();\r\n\r\n $(\"select#diagnosis\").change(function()\r\n {\r\n $(this).parent().children(\"span#diagnosis\").html(diagnoses[$(this).val()].name);\r\n }).change();\r\n });\r\n\r\n $(\"input#pushAppointment\").click(function()\r\n {\r\n // convert to XML and send to server\r\n var app = {\r\n date : $(\"input#date\").val(),\r\n time : $(\"input#time\").val(),\r\n patient : $(\"select#patient\").val(),\r\n physician : patients[$(\"select#patient\").val()].physician.id,\r\n psc : $(\"select#psc\").val(),\r\n phlebotomist : $(\"select#phlebotomist\").val(),\r\n labTests : {}\r\n };\r\n\r\n $.each(_.map($(\"div#labTestsBlock\").children(\"div\"), function(val)\r\n {\r\n return {\r\n id : $(val).children(\"p\").children(\"select\")[0].value,\r\n dxcode : $(val).children(\"p\").children(\"select\")[1].value\r\n };\r\n }), function(i, o)\r\n {\r\n app.labTests[o.id] = o.dxcode;\r\n });\r\n\r\n var xml = appointmentXMLTemplate(app);\r\n\r\n function success(resp)\r\n {\r\n container.empty();\r\n var app = $(resp).children().children(\"uri\").html();\r\n var title = appId ? \"Appointment \" + appId + \" Updated\" : \"New Appointment Created\";\r\n container.append(\"<h3>\" + title + \"</h3><p style='padding-left:40px;'><a href='\" + app + \"'>\" + app + \"</a></p>\");\r\n appointmentWidget.refresh();\r\n }\r\n function error(resp)\r\n {\r\n container.empty();\r\n container.append($(resp.responseText).children(\"error\"));\r\n }\r\n\r\n if (appId)\r\n {\r\n $.ajax({\r\n url : serverURL + \"Appointments/\" + appId,\r\n method : \"PUT\",\r\n async : false,\r\n contentType : \"application/xml\",\r\n data : xml.trim()\r\n }).done(success).fail(error);\r\n } else\r\n {\r\n $.ajax({\r\n url : serverURL + \"Appointments\",\r\n method : \"POST\",\r\n async : false,\r\n contentType : \"application/xml\",\r\n data : xml.trim()\r\n }).done(success).fail(error);\r\n }\r\n });\r\n\r\n if (appId)\r\n {\r\n var app = appointments[appId];\r\n\r\n $(\"input#date\")[0].defaultValue = app.appointment.date;\r\n $(\"input#time\")[0].defaultValue = app.appointment.time;\r\n $(\"select#patient\").val(app.patient.id).change();\r\n $(\"select#phlebotomist\").val(app.phlebotomist.id).change();\r\n $(\"select#psc\").val(app.psc.id).change();\r\n\r\n // For as many labtests as this appointment has, click addLabTest\r\n // They are returned in order, so fill them in order\r\n for (var i = 0; i < app.labTests.tests.length; i++)\r\n $(\"input#addLabTest\").click();\r\n\r\n $.each($(\"select#labTests\"), function(i)\r\n {\r\n $(this).val(app.labTests.tests[i].labTest.id).change();\r\n });\r\n\r\n $.each($(\"select#diagnosis\"), function(i)\r\n {\r\n $(this).val(app.labTests.tests[i].diagnosis.dxcode).change();\r\n });\r\n\r\n } else\r\n {\r\n $(\"input#date\")[0].defaultValue = \"2015-05-20\";\r\n $(\"input#time\")[0].defaultValue = \"10:00\";\r\n }\r\n }",
"function _createCoffeeBrand(CoffeeBrandName, NumbersOfCoffeesNeeded, callback)\n{\n validate.valBrand(CoffeeBrandName, NumbersOfCoffeesNeeded, function (data)\n {\n if (data)\n {\n CoffeeBrand.createCoffeeBrand(CoffeeBrandName, NumbersOfCoffeesNeeded, function (data2)\n {\n callback(data2)\n })\n } else callback(false)\n })\n\n\n}",
"function fillDonutCreation() {\r\n\tlogger.info(\"fillDonutCreation(): Filling donut creation list.\");\r\n var donutCreateTemplate = _.template($(\"#donutCreateTemplate\").html());\r\n\r\n // Populate donut menu\r\n $(\"#donutSelection > tbody\").empty(); // Clear old entries\r\n for (var i = 0; i < constants.donuts.length; i++) {\r\n if (!player.donuts[i]) {\r\n continue;\r\n }\r\n\r\n var donut = constants.donuts[i];\r\n var donutInfo = donutCreateTemplate({\r\n img: `<img src=\"img/${donut.imagePath}\" style=\"max-height: ${constants.imgSize}px; max-width: ${constants.imgSize}px;\" />`,\r\n flavor: donut.flavor,\r\n cost: displayMoney(donut.cost),\r\n createId: `create${i}`,\r\n sellForId: `sellFor${i}`,\r\n id: i\r\n });\r\n\r\n $(\"#donutSelection > tbody\").append(donutInfo);\r\n }\r\n\r\n if (!player.unlockedDonuts.size) {\r\n $(\"#donutSelection > tbody\").append(\"No donuts. Head to the Upgrades tab to buy some ingredients!\");\r\n }\r\n\r\n // Fill with user's previous prices\r\n for (var i = 0; i < constants.donuts.length; i++) {\r\n if (!player.donuts[i]) {\r\n continue;\r\n }\r\n\r\n $(`#create${i}`).val(player.selectedQuantities[i]);\r\n $(`#sellFor${i}`).val(player.sellPrices[i]);\r\n }\r\n\r\n $(\"#donutSelling\").hide();\r\n $(\"#donutSelection\").show();\r\n logger.info(\"fillDonutCreation(): Filled donut creation list.\");\r\n}",
"function startCreateTripPage() {\n\t$(\"#txtFromSteertAddress\").val(\"\");\n\t$(\"#txtFromCity\").val(\"\");\n\t$(\"#txtFromState\").val(\"\");\n\t$(\"#txtFromZipCode\").val(\"\");\n\t$('#lblFromSteertAddress').css('display', 'none');\n\t$('#lblFromCity').css('display', 'none');\n\t$('#lblFromState').css('display', 'none');\n\t$('#lblFromZipCode').css('display', 'none');\n\n\t$(\"#txtToSteertAddress\").val(\"\");\n\t$(\"#txtToCity\").val(\"\");\n\t$(\"#txtToState\").val(\"\");\n\t$(\"#txtToZipCode\").val(\"\");\n\t$('#lblToZipCode').css('display', 'none');\n\n\t$(\"#txtTruckID\").val(\"\");\n\t$(\"#txtOdometer\").val(\"\");\n\t$('#lblTruckID').css('display', 'none');\n\t$('#lblOdometer').css('display', 'none');\n\n\t$(\"#form_FromLocation\").css(\"display\", \"block\");\n\t$(\"#form_ToLocation\").css(\"display\", \"none\");\n\t$(\"#form_CreateTrip\").css(\"display\", \"none\");\n\t$(\"#divToAddress\").css('display', 'block');\n\t$(\"#divToEndTrip\").css('display', 'none');\n\n\tvar now = new Date();\n\tvar day = (\"0\" + now.getDate()).slice(-2);\n\tvar month = (\"0\" + (now.getMonth() + 1)).slice(-2);\n\tvar today = (month) + \"/\" + (day) + \"/\" + now.getFullYear();\n\t$('#txtCuDate').val(today);\n\n\tif (useToEndTripDiv == \"yes\") {\n\t\t$(\"#form_FromLocation\").css(\"display\", \"none\");\n\t\t$(\"#form_ToLocation\").css(\"display\", \"block\");\n\t\t$(\"#divToAddress\").css('display', 'none');\n\t\t$(\"#divToEndTrip\").css('display', 'block');\n\t} else {\n\t\tGlobalcontrollerref.myControllers.insControllerfnAjaxCall.fireAjaxCall(\"GET\", ServiceUrl + \"TripService/ShowVehicleList?CreatedById=0&DriverId=\" + JSON.parse(localStorage.DriverUserDetails).userid, {}, \"json\", C_TruckListSuccess, C_TruckListError);\n\t}\n\tuseToEndTripDiv = \"no\";\n}",
"function createContent(cafe) {\n\tvar popupData = \"<h3>\" + cafe.name + \"</h3>\" +\n\t\t\"<div>\"+cafe.location+\"</div>\" +\t\t\n\t\t\"<div class='donuts'>Nearby Donuts Shops</div>\";\n\treturn popupData;\n}",
"function addProduct () {\n event.preventDefault();\n var addCoffee = document.getElementById(\"new-coffee\");\n var addRoast = document.getElementById(\"new-roast\");\n var newCoffee = {\n name: addCoffee.value,\n roast: addRoast.value\n };\n coffees.push(newCoffee);\n outputHTML.innerHTML = renderCoffees(coffees);\n}",
"function load_page (num_toppings, size) {\n\n document.querySelector('#addtocart').disabled = false;\n removeMessages();\n\n // set size option with selection, but keep hidden\n var size_selection = document.getElementById('size');\n if (size_selection.options[0].innerHTML == size)\n size_selection.selectedIndex = 0;\n else\n size_selection.selectedIndex = 1; \n\n var count_toppings = 0;\n\n // only display toppings if pizza type selection is not cheese\n if (count_toppings < num_toppings) {\n\n // show topping options for customer to select and submit\n document.getElementById('topping-selections').style.display = 'block'; \n document.getElementById('topping-title').style.display = 'block'; \n document.getElementById('1').style.display = 'block'; \n document.getElementById('topping1').style.display = 'inline-block'; \n\n // set toppings based on pizza order selections\n var ul = document.getElementById('topping-selections');\n var topping1 = document.getElementById('topping1');\n var item = [];\n \n // if special, get items included\n if (num_toppings == 4) {\n for (var i = 0; i < topping1.length; i++) {\n if (topping1.options[i].text.includes(\"*\")) {\n item[count_toppings++] = topping1.options[i].value;\n }\n }\n num_toppings = count_toppings;\n }\n\n // create selection for each additional topping in pizza type\n for (var i = 1; i < num_toppings; i++) { \n\n var new_dropdown = topping1.cloneNode(true);\n new_dropdown.name = \"topping\" + (i+1);\n new_dropdown.id = \"topping\" + (i+1);\n\n var li = document.createElement(\"li\");\n li.id = (i+1);\n li.appendChild(new_dropdown);\n ul.appendChild(li);\n ul.style.display = 'inline-block'; \n }\n }\n else {\n document.getElementById('topping-selections').style.display = 'none'; \n document.getElementById('topping-title').style.display = 'none'; \n document.getElementById('1').style.display = 'none'; \n document.getElementById('topping1').style.display = 'none';\n }\n\n // if special, set selection to next included\n if (num_toppings > 3) {\n for (var i = 0; i < item.length; i++){\n var t = 0;\n var found = false;\n while ((t < topping1.length) && (!found)) { \n if (topping1.options[t].value == item[i]) {\n var el_id = \"topping\" + (i+1);\n var el = document.getElementById(el_id)\n el.selectedIndex = t;\n found = true;\n }\n t++;\n }\n }\n }\n}",
"function buildPage(){\n addItems('make', make);\n addItems('model', model);\n addItems('keywords', keywords);\n checkAll();\n}",
"function makePage(){\n\n codeFellows.makeList();\n disneyLand.makeList();\n}",
"function CallCreate() {\n if (_contentBody != null && _contentBody != \"MasterBody\") { \n $(\"#\" + _contentBody).LoadView({ url: \"~/\" + _controller + \"Create?windowId=\" + _contentBody });\n }\n else {\n window.location.href = \"Create\";\n }\n }",
"function makeListing() {\n\tconsole.log(\"Make Listing Button Pressed.\");\n\n\t//numberOfWhateverUnits variables initialized in 'make-a-listing-page.js'\n\tpost = {\n\t\tnumFashion: numberOfFashionUnits,\n\t\tnumElectronics: numberOfElectronicsUnits,\n\t\tnumCollectables: numberOfCollectablesUnits,\n\t\tquantity: 1, //default for now. Possibly based on user input down the road. \n\t\titemName: selectedItemType,\n\t\tprice: price\n\t}\n\n\t$.ajax({\n method: \"POST\",\n url: \"/api/new-listing\",\n data: post\n })\n .done(function(data) {\n \tif (data.success)\n \t\twindow.location = data.redirectTo;\n });\n}",
"create() {\n\t\t$.when($.ajax(CREATE_URL))\n\t\t\t.then((data, textStatus, jqXHR) => {\n\t\t\t\tif (data.success) {\n\t\t\t\t\tthis.update(data);\n\t\t\t\t\t//save deck_id if we've just created a new deck.\n\t\t\t\t\tthis.vent.pub('save');\n\t\t\t\t\tthis.vent.pub('appReady');\n\t\t\t\t} else {\n\t\t\t\t\tthis.vent.pub('error');\n\t\t\t\t}\n\t\t\t});\n\t}"
] |
[
"0.7346524",
"0.685683",
"0.6635601",
"0.632516",
"0.62356895",
"0.62309295",
"0.58870226",
"0.58545685",
"0.5793856",
"0.57675123",
"0.5728257",
"0.5715081",
"0.56606233",
"0.5653223",
"0.5548992",
"0.54937255",
"0.5357425",
"0.53390926",
"0.5289341",
"0.52825797",
"0.52370125",
"0.52177626",
"0.52085686",
"0.519254",
"0.5174701",
"0.5171806",
"0.5158023",
"0.5152129",
"0.5142441",
"0.5129613"
] |
0.7673387
|
0
|
This function does what its name implies, deletes a given cupcake It calls the deleteCupcake method of class CupcakeList and stores the updated CupcakeList object into the global cupcakes variable so we have an updated frontend object list to work with without making another get request.
|
async function deleteCupcake() {
let $id = $(this).data('id');
let response = await CupcakeList.deleteCupcake($id,cupcakes);
cupcakes = response;
console.log(cupcakes)
$(this).parent().parent().parent().remove();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"async function loadCupcakes() {\r\n let response = await CupcakeList.getCupcakes();\r\n cupcakes = response;\r\n console.log(cupcakes)\r\n $cupcakeList.empty();\r\n\r\n for (let cc of cupcakes.cupcakes) {\r\n console.log(cc)\r\n const html = createHTML(cc);\r\n $cupcakeList.append(html);\r\n let delBtn = document.getElementById(`del-btn-${cc.id}`);\r\n delBtn.addEventListener(\"click\",deleteCupcake);\r\n let editBtn = document.getElementById(`edit-btn-${cc.id}`);\r\n editBtn.addEventListener(\"click\",showEditForm);\r\n }\r\n }",
"function generateCupcakeHTML(cupcake) {\r\n return `\r\n <div data-cupcake-id=${cupcake.id}>\r\n <li>\r\n ${cupcake.flavor} / ${cupcake.size} / ${cupcake.rating}\r\n <button class=\"delete-button\">X</button>\r\n </li>\r\n <img class=\"Cupcake-img\"\r\n src=\"${cupcake.image}\"\r\n alt=\"(no image provided)\">\r\n </div>\r\n `;\r\n}",
"async function createCupcake() {\r\n let flavor = $flavor.val();\r\n let size = $size.val();\r\n let rating = $rating.val();\r\n let image = $ccImage.val();\r\n\r\n let newCupcake = {flavor,size,rating,image}\r\n await CupcakeList.createCupcake(newCupcake)\r\n await loadCupcakes();\r\n }",
"async function showCupcakes() {\n let response = await axios.get(BASE_URL);\n let cupcakes = response.data.cupcakes;\n\n $cupcakeList.empty();\n addCupcakesToDOM(cupcakes);\n}",
"async function makeCupcake() {\n\t// Get values\n\tconst flavor = $('#flavor').val();\n\tconst size = $('#size').val();\n\tconst rating = $('#rating').val();\n\tconst image = $('#image').val() ? $('#image').val() : null;\n\t// API POST Request\n\tif (image !== null) {\n\t\tconst response = await axios.post(BASE_URL, { flavor, size, rating, image });\n\t} else {\n\t\tconst response = await axios.post(BASE_URL, { flavor, size, rating });\n\t}\n\t// Append new cupcake to DOM\n\tcupcake = response.data.cupcake;\n\t$cupcakeList.prepend(makeLI(cupcake));\n}",
"function removeClimb() {\n fetch(`${url}`, {\n method: 'DELETE'\n }).then(res => res.json()).then((results) => alert(`Deleted Climb: ${results.confirmation._id}`))\n\n history.goBack()\n }",
"function delete_checklist(args, done) {\n var checklist = args.checklist;\n\n var cardent = seneca.make$('card/card');\n var projectent = seneca.make$('sys/project');\n\n cardent.load$(checklist, function(err, checklist) {\n projectent.load$(checklist.parent, function(err, project) {\n // Remove checklist from project.checklists\n project.checklists = project.checklists.filter(function(checklistId) {\n return checklistId !== checklist.id;\n });\n\n project.save$();\n\n cardent.remove$({id:checklist.id}, function(err, out) {\n if (err) return done(err);\n done(null, {deleted:true});\n });\n });\n });\n }",
"function generateAndAppendCupcakeHtml(cupcake) {\n let html = `\n <li>\n Flavor:${cupcake.flavor}, \n Rating: ${cupcake.rating}, \n Size: ${cupcake.size}\n </li>\n <img src=${cupcake.image}><img>\n `;\n $updateCupcakeList.append(html);\n}",
"async deleteSandwich(sandwich) {\n // Can't delete the last sandwich in the cart\n if (this.items.length === 1) {\n return\n }\n\n // Remove the sandwich from the server\n await fetch(`http://localhost:3001/cart/${sandwich.id}`, {\n method: 'DELETE',\n })\n\n // Remove the sandwich locally\n this.items = this.items.filter(x => x !== sandwich)\n if (this.selectedSandwich.id === sandwich.id) {\n this.selectSandwich(this.items[0])\n } else {\n this.render()\n }\n }",
"function makeCake(){\n\t// Ik maak een variable cake met een array erin.\n\tvar cake = ['slagroom', 'frambozen', 'chocolade',];\n\n\treturn {\n\t\t//Hier maak ik gebruk van een object literal\n\t\tgetCake: function() {\n\t\t\t/* \tHier log ik een zinnetje met daarin cake.pop(). \n\t\t\t*\tcake alleen geeft mij de volledige array terug. \n\t\t\t*\tcake.pop() verwijderd het laatste element in de array en stuurt die terug. \n\t\t\t*\tReference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop\n\t\t\t*/\n\t\t\tconsole.log('Ik heb nu een ' + cake.pop() + 'taart');\n\t\t}\n\t};\n}",
"function renderCafe(doc) {\n let li = document.createElement('li')\n let name = document.createElement('span')\n let city = document.createElement('span')\n // creating element for deleting\n let cross = document.createElement('div')\n\n li.setAttribute('data-id', doc.id) // to get the document's ID from firestore\n // setting the text contents for the elts we created\n name.textContent = doc.data().name\n city.textContent = doc.data().city\n cross.textContent = 'x'\n\n // next, gotta append the name & city to the li\n li.appendChild(name)\n li.appendChild(city)\n li.appendChild(cross)\n\n // lastly, gotta append the li we created to the ul element of cafeList\n cafeList.appendChild(li)\n\n // deleting data\n cross.addEventListener('click', (e) => {\n let id = e.target.parentElement.getAttribute(\"data-id\") // note that this 'data-id' is actually the doc.id... ref line 22\n db.collection('cafes').doc(id).delete()\n })\n}",
"static deleteFoods(foods) {\n foods.forEach(food => {\n fetch(`${this.url}/foods/${food.id}`, {\n method: 'DELETE'\n })\n .then(response => response.json())\n .then(data => {\n Food.delete(data.id);\n AppContainer.renderFoods();\n })\n .catch(err => alert(err))\n })\n \n }",
"function deleteCm(evt) {\n var target = evt.target;\n console.log(target.getAttribute('delete'));\n coffeemakers = JSON.parse(localStorage.getItem('coffeemakers'));\n delete coffeemakers[target.getAttribute('delete')];\n localStorage.setItem('coffeemakers', JSON.stringify(coffeemakers));\n get_list();\n}",
"function delFromList () {\n /* get rid of the button and bullet from our arrays before deleting it */\n listItems.splice(delBtns.indexOf(this), 1)\n delBtns.splice(delBtns.indexOf(this), 1)\n\n /* also get rid of the drop zone below the element being deleted */\n dropZones.splice(delBtns.indexOf(this), 1)\n\n redrawList()\n}",
"function renderCafe(doc) {\n let li = document.createElement('li');\n li.setAttribute('data-id', doc.id);\n\n let name = document.createElement('span');\n name.textContent = doc.data().name;\n li.appendChild(name);\n\n let city = document.createElement('span');\n city.textContent = doc.data().city;\n li.appendChild(city);\n\n let deleteButton = document.createElement('div');\n deleteButton.textContent = 'x';\n li.appendChild(deleteButton);\n deleteButton.addEventListener('click', (evt) => {\n evt.stopPropagation();\n let id = evt.target.parentElement.getAttribute('data-id');\n db.collection('cafes').doc(id).delete();\n })\n\n cafeList.append(li);\n}",
"async function deleteFlower(idFlower, owner) {\n //write your query delete here\n await FlowerOwner.destroy({\n where: {\n flowerName: idFlower,\n ownerName: owner\n }\n })\n return response\n }",
"update(cache, { data }) {\n console.log(data);\n const existingcocktails = cache.readQuery({ query: GET_COCKTAILS });\n const updatedCocktails = existingcocktails.cocktails.filter(\n (cocktail) => cocktail.id !== data.deleteCocktail.id\n );\n cache.writeQuery({\n query: GET_COCKTAILS,\n data: {\n cocktails: updatedCocktails,\n },\n });\n }",
"function clearList() {\n for (i in cats) {\n var div = document.getElementById(i)\n while (div.hasChildNodes()) {\n var nodes = div.childNodes;\n div.removeChild(nodes[0]);\n }\n }\n drinkIdx = 0;\n breakfastIdx = 0;\n lunchIdx = 0;\n dinnerIdx = 0;\n sweetIdx = 0;\n clearTotal();\n}",
"deleteFood(food){\n let foods = this.items.foods[food]\n foods.pop();\n if(foods.length < 1){\n delete this.items.foods[food]\n }\n }",
"function list_destroy(prop)\n {\n if (!me.notebooks[prop.id]) {\n return;\n }\n\n notebookslist.remove(prop.id);\n delete me.notebooks[prop.id];\n\n if (me.selected_list == prop.id) {\n for (id in me.notebooks) {\n if (me.notebooks[id]) {\n notebookslist.select(id);\n break;\n }\n }\n }\n }",
"async function displayCupcakes() {\n const response = await axios.get(`${BASE_URL}/cupcakes`);\n\n for (let cupcake of response.data.cupcakes) {\n let addCupcake = $(cupcakeHTML(cupcake));\n $(\"#menu-list\").append(addCupcake);\n }\n}",
"async function deleteHabit(_, args) {\n const db = getDb();\n // save deleted habit\n const deleteObject = await db\n .collection(\"users\")\n .findOneAndUpdate(\n { email: args.email },\n { $pull: { habitList: { _id: ObjectID(args._id) } } },\n { returnOriginal: true }\n );\n\n // Get the deleted habit from deleteObject\n const deletedHabit = deleteObject.value.habitList.find((habit) => {\n if (habit._id == args._id) {\n return habit;\n }\n });\n\n // Push deleted habit on to deletedhabits list\n await db\n .collection(\"users\")\n .updateOne(\n { email: args.email },\n { $push: { deletedHabits: deletedHabit } }\n );\n\n // return the habit object\n return deletedHabit;\n}",
"deleteCategory(trigger) {\n\t\t\tthis.$http.put('category/deactivate/'+trigger.catId, {}, {\n\t\t\t\theaders: {Authorization: JSON.parse(localStorage.user).token}\n\n\t\t\t}).then((res) => {\n\t\t\t\tif(res.status == 200) {\n\t\t\t\t\t// If the updates were successfully persisted to the database, update the state to reflect the changes\n\t\t\t\t\tthis.$store.commit('deleteCategory', trigger.catIndex);\n\t\t\t\t\tthis.displayFlashMsg('Your category was successfully deleted!', 'success');\n\t\t\t\t}\n\n\t\t\t}).catch((res) => {\n\t\t\t\tthis.handleApiError(res);\n\t\t\t});\n\t\t}",
"function renderCafe(doc) {\n\tlet li = document.createElement('li');\n\tlet name = document.createElement('span');\n\tlet city = document.createElement('span');\n\tlet cross = document.createElement('div');\n\t// setting data into our element/attribute\n\tli.setAttribute('data-id', doc.id);\n\tname.textContent = doc.data().name;\n\tcity.textContent = doc.data().city;\n\tcross.textContent = 'x';\n\t// append our elements\n\tli.appendChild(name);\n\tli.appendChild(city);\n\tli.appendChild(cross);\n\t//append to cafeList - document\n\tcafeList.appendChild(li);\n\n\t//delete data by Id from firestore db\n\tcross.addEventListener('click', (e) => {\n\t\te.stopPropagation();\n\t\tlet id = e.target.parentElement.getAttribute('data-id');\n //console.log(id);\n db.collection('cafes').doc(id).delete();\n\t})\n}",
"async function deleteCat(){\n let url = \"/api/produktkategorier/\" + deleteCategorySelector.value;\n fetch(url, {method: \"DELETE\"});\n populateCategoryDropDown();\n}",
"async function addNewCupcake(newCupcake) {\n const response = await axios({\n url: `${BASE_URL}/cupcakes`,\n method: \"POST\",\n data: newCupcake\n })\n\n return response.data.cupcake;\n}",
"function delete_meal_from_meal_list()\n{\n if (!current_meal.is_calendar_meal) {\n if (confirm(\"Are you sure you want to remove \" + current_meal.name + \" from your meals? (This cannot be undone)\")) {\n // Get the meal id\n var meal_id = current_meal.id;\n\n // Remove that one item from the calendar in HTML\n var meal_element_to_be_removed = document.getElementById(\"meal_list_item_\" + meal_id);\n meal_element_to_be_removed.parentElement.removeChild(meal_element_to_be_removed);\n\n // Delete the meal from the Users_Meals in the database\n var meal_record_to_remove = firebase_database.ref(\"Users_Meals/\" + user.uid + \"/\" + meal_id);\n meal_record_to_remove.remove();\n\n // Remove the meal from the \"meals\" in memory\n for (var i = 0; i < meals.length; i++) {\n if (meals[i].id == meal_id) {\n meals.splice(i, 1);\n break;\n }\n }\n }\n }\n}",
"removeFromList(name) {\n console.log(\"Requested to remove word \" + name);\n let success = this.list.delete(name);\n console.log(\"Remove \" + name + \" success: \" + success);\n }",
"function renderCafe(doc){\r\n let li = document.createElement('li');\r\n let todo = document.createElement('span');\r\n let deadline = document.createElement('span');\r\n let cross = document.createElement('button');\r\n li.setAttribute('data-id', doc.id);\r\n todo.textContent = doc.data().todo;\r\n deadline.textContent = doc.data().deadline;\r\n cross.textContent='Delete_this';\r\n li.appendChild(todo);\r\n li.appendChild(deadline);\r\n li.appendChild(cross);\r\nconsole.log(li);\r\n plan.appendChild(li);\r\n\r\n //deleting data\r\n cross.addEventListener('click',(e)=>{\r\n e.stopPropagation();\r\n let id = e.target.parentElement.getAttribute('data-id');\r\n db.collection(email1).doc(email1).collection('todo').doc(id).delete();\r\n });\r\n}",
"function deleteListItem() {\n item.remove();\n }"
] |
[
"0.64524615",
"0.58138084",
"0.5637916",
"0.5599224",
"0.54098934",
"0.53802365",
"0.5373107",
"0.53454834",
"0.53035015",
"0.5276876",
"0.5218314",
"0.51598454",
"0.5117401",
"0.50604266",
"0.5028493",
"0.5021291",
"0.5000801",
"0.49943683",
"0.49820977",
"0.49787343",
"0.49764514",
"0.4971032",
"0.4965829",
"0.49518254",
"0.49284244",
"0.49201062",
"0.49181333",
"0.4914746",
"0.4875091",
"0.48652983"
] |
0.8137888
|
0
|
Extension of EventEmitter that represents an offset in a Place heirarchy. Stores references to all child nodes in the heirarchy.
|
function OffsetEventEmitter() {
EventEmitter.call(this);
this._children = {};
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function PlaceEventEmitter() {\n this._root = new OffsetEventEmitter();\n}",
"function offsetTree(t, offset, offsetFunction) {\n for (var i = 0; i < t.length; i++) {\n var offsetpaths = offsetFunction(t[i], offset);\n if (offsetpaths.length == 1) {\n // replace array items in place\n Array.prototype.splice.apply(t[i], [0, t[i].length].concat(offsetpaths[0]));\n }\n\n if (t[i].childNodes && t[i].childNodes.length > 0) {\n offsetTree(t[i].childNodes, -offset, offsetFunction);\n }\n }\n }",
"function append(node, item, offset) {\n\n\t\titem.offset = ++offset;\n\t\tsiblingIndex.add(item);\n\t\tnode.children.push(item);\n\t\titem.parent = node;\n\t\titem.id = id++;\n\t\ttree.push(item);\n\n\t}",
"function mapDOMtoPosition() {\n var i;\n var node;\n for (i = 0; i < config.doi.length; i++) {\n node = config.doi[i][\"node\"];\n config.doi[i][\"id\"] = \"doi-\" + i;\n config.doi[i][\"y\"] = node.offsetTop;\n }\n config.doiSnappingPosition = screen.height / 2.5;\n // console.log(config.doi, config.doiSnappingPosition);\n // TODO sort based on offset?\n }",
"function patch(nodes, location, offset) {\n var index = -1\n var start = offset\n var end\n var node\n\n while (++index < nodes.length) {\n node = nodes[index]\n\n if (node.children) {\n patch(node.children, location, start)\n }\n\n end = start + toString(node).length\n\n node.position = {\n start: location.toPoint(start),\n end: location.toPoint(end)\n }\n\n start = end\n }\n\n return nodes\n }",
"function registerEvents(Position) {\n for(var e in events) {\n let event = events[e];\n Position.hook(e, emitEvent(event));\n }\n}",
"emit(eventName, param) {\n var walk = (toks, tree, match) => {\n if (tree == null) {\n return;\n }\n let t = toks[0];\n if (toks.length === 1) {\n let h;\n if (t in tree) {\n for (h of Array.from(tree[t].__ehs)) {\n h(eventName, param, match.slice(0, -1));\n }\n }\n if ('*' in tree) {\n for (h of tree['*'].__ehs) {\n h(eventName, param, match + t);\n }\n }\n }\n else {\n if (t in tree) {\n walk(toks.slice(1), tree[t], match);\n }\n if ('*' in tree) {\n walk(toks.slice(1), tree['*'], match + t + \".\");\n }\n }\n };\n walk(eventName.split(\".\"), this.evTree, '');\n }",
"function traverse(node, item, offset) {\n\t\tif(overlaps(node, item)) {\n\t\t\tif(iterate(siblingIndex.get(offset+1), item, offset+1)) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tappend(node, item, offset);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"constructor($pos) {\n let node = $pos.nodeAfter;\n let $end = $pos.node(0).resolve($pos.pos + node.nodeSize);\n super($pos, $end);\n this.node = node;\n }",
"function location(node, location, config) {\n var result = position(location)\n var tail\n var key\n var props\n\n if (node.type === 'element') {\n tail = node.children[node.children.length - 1]\n\n // Bug for unclosed with children.\n // See: <https://github.com/inikulin/parse5/issues/109>.\n if (!location.endTag && tail && tail.position && tail.position.end) {\n result.end = Object.assign({}, tail.position.end)\n }\n\n if (config.verbose) {\n props = {}\n\n for (key in location.attrs) {\n props[find(config.schema, key).property] = position(location.attrs[key])\n }\n\n node.data = {\n position: {\n opening: position(location.startTag),\n closing: location.endTag ? position(location.endTag) : null,\n properties: props\n }\n }\n }\n }\n\n return result\n}",
"dispatchAt(x, y, type) {\r\n const object = this._getObjectUnderPointRecursive(x, y, this._stage);\r\n const target = (object === null) ? this._stage : object;\r\n let current = target;\r\n while (current !== null) {\r\n current.emit(type, { x: x, y: y, target: target });\r\n current = current.parent;\r\n }\r\n }",
"function mkEventNode(cmdMap, emitter) {\n\treturn { parent: undefined, emitter: emitter, cmdMap: cmdMap};\n}",
"function LevelUP (location, options) {\n this.__proto__.__proto__ = EventEmitter.prototype\n EventEmitter.call(this)\n this._options = extend(extend({}, defaultOptions), options)\n this._location = location\n this._status = 'new'\n}",
"static async getTxChildListFromAddressByPageAndOffset (address, pageNumber, offset) {\n let txChildList = await EtherscanServices.getNormalTransactionByAddress(address, pageNumber, offset)\n return txChildList\n }",
"appendInto(e){this.startNode=e.appendChild(createMarker()),this.endNode=e.appendChild(createMarker())}",
"assignPosition(node, position) {\n\t\tif(node.parentNode && position<node.parentNode.position){\n\t\t\tposition = node.parentNode.position;\n\t\t}\n\t\twhile(this.positionMap.get(`${node.level},${position}`)){\n\t\t\tposition++;\n\t\t}\n\t\tnode.position = position;\n\t\tthis.positionMap.set(`${node.level},${position}`, true);\n\t\tfor(var i in node.children){\n\t\t\tthis.assignPosition(node.children[i], position+Number(i));\n\t\t}\n\t}",
"function translateLoc(loc) {\n let result = `${twoSpace}wrapper.find('#${loc[0]}').`;\n for (let i = 1; i < loc.length; i++) {\n result += `childAt(${loc[i]}).`; \n }\n return result; \n}",
"handlePosition(node) {\n return 'middle top'; // sets the position of the handle in the format of \"X-AXIS Y-AXIS\" such as \"left top\", \"middle top\"\n }",
"on(name, cb) {\n let array = name.split(\".\"), adjustedLength = Math.max(array.length, 1), path = array.slice(0, adjustedLength - 1), last = array[adjustedLength - 1];\n let tree = this.evTree;\n for (let t of path) {\n tree = tree[t] || (tree[t] = { __ehs: [] });\n } // make tree via path\n if (!tree[last]) {\n tree[last] = { __ehs: [] };\n }\n tree[last].__ehs.push(cb); // store cb\n }",
"function recursiveTraversalPosition(actNode, childShift) {\n\n\t\ttmpNodes.push(actNode);\n\n if (actNode.value === \"0\") {\n actNode.xPosition = rectLength * 1.5;\n actNode.yPosition = rectLength;\n } else {\n actNode.xPosition = actNode.parent.xPosition;\n actNode.yPosition = actNode.parent.yPosition + rectLength * 2;\n }\n\n actNode.xPosition += childShift;\n\n var shift = 0;\n var children = actNode.children;\n if (children === undefined)\n return 0;\n for (var i = 0; i < children.length; i++) {\n\n if (i > 0) {\n shift += rectLength * 2;\n }\n shift += recursiveTraversalPosition(children[i], shift * 2);\n\n }\n actNode.xPosition += shift;\n\n return shift;\n }",
"posAtDOM(node, offset = 0) {\n return this.docView.posFromDOM(node, offset);\n }",
"function markBranchNodeChanged( offset ) {\n\t\tvar item, newItem,\n\t\t\tadj = isReversed ? -1 : 1,\n\t\t\ti = offset - 1;\n\n\t\twhile ( i >= 0 ) {\n\t\t\titem = document.data.getData( i-- );\n\t\t\tif ( !(\n\t\t\t\tve.dm.LinearData.static.isOpenElementData( item ) &&\n\t\t\t\tve.dm.nodeFactory.lookup(\n\t\t\t\t\tve.dm.LinearData.static.getType( item )\n\t\t\t\t).prototype instanceof ve.dm.BranchNode\n\t\t\t) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif ( item.internal && item.internal.changesSinceLoad !== undefined ) {\n\t\t\t\t// Guard against marking the same node twice\n\t\t\t\tif ( changedBranchNodes.indexOf( item ) === -1 ) {\n\t\t\t\t\tnewItem = ve.copy( item );\n\t\t\t\t\tchangedBranchNodes.push( newItem );\n\t\t\t\t\tnewItem.internal.changesSinceLoad += adj;\n\t\t\t\t\tdocument.data.splice( i + 1, 1, ve.deepFreeze( newItem ) );\n\t\t\t\t}\n\t\t\t}\n\t\t\t// This is a branch node boundary, so go no further\n\t\t\tbreak;\n\t\t}\n\t}",
"function findLeaf(node, offset) {\n\t\t\t\tif (offset === undef) {\n\t\t\t\t\toffset = node.nodeType === 3 ? node.length : node.childNodes.length;\n\t\t\t\t}\n\n\t\t\t\twhile (node && node.hasChildNodes()) {\n\t\t\t\t\tnode = node.childNodes[offset];\n\t\t\t\t\tif (node) {\n\t\t\t\t\t\toffset = node.nodeType === 3 ? node.length : node.childNodes.length;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn {node: node, offset: offset};\n\t\t\t}",
"function findLeaf(node, offset) {\n\t\t\t\tif (offset === undef) {\n\t\t\t\t\toffset = node.nodeType === 3 ? node.length : node.childNodes.length;\n\t\t\t\t}\n\n\t\t\t\twhile (node && node.hasChildNodes()) {\n\t\t\t\t\tnode = node.childNodes[offset];\n\t\t\t\t\tif (node) {\n\t\t\t\t\t\toffset = node.nodeType === 3 ? node.length : node.childNodes.length;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn {node: node, offset: offset};\n\t\t\t}",
"function findLeaf(node, offset) {\n\t\t\t\tif (offset === undef) {\n\t\t\t\t\toffset = node.nodeType === 3 ? node.length : node.childNodes.length;\n\t\t\t\t}\n\n\t\t\t\twhile (node && node.hasChildNodes()) {\n\t\t\t\t\tnode = node.childNodes[offset];\n\t\t\t\t\tif (node) {\n\t\t\t\t\t\toffset = node.nodeType === 3 ? node.length : node.childNodes.length;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn {node: node, offset: offset};\n\t\t\t}",
"assignPosition(node, position) {\n // update the position of the node\n node.position = position;\n \n // the base case\n if (node.children.length === 0)\n {\n leafNodeCounter = leafNodeCounter + 1;\n return node;\n }\n // recursive case\n else\n {\n leafNodeCounter = 0;\n for (var d = 0; d < node.children.length; d++)\n {\n // this is a really bad hack and there is definitely something better out there. \n // However, it gets the job done\n if (node.children[d].name === \"Protosomes\")\n {\n leafNodeCounter = leafNodeCounter + 2;\n }\n\n this.assignPosition(node.children[d], node.position + leafNodeCounter);\n }\n }\n\n }",
"function ECHOTreeMap(instanceId, resourceType, refid, data) {\n if (refid == null) {\n refid = null;\n }\n if (data == null) {\n data = null;\n }\n ECHOTreeMap.__super__.constructor.call(this, instanceId, resourceType, refid);\n this._isSubtree = refid != null;\n if (data != null) {\n this._copyData(data);\n }\n }",
"function EventEmitter(){}// Shortcuts to improve speed and size",
"annotateNodes() {\n this.nodeIdMap.clear();\n this.nodeNIdMap.clear();\n\n let lastNode = null;\n let nid = 0;\n\n const loop = (nodes, parent, level) => {\n nodes.forEach((node, i) => {\n node.parent = parent;\n node.path = parent ? parent.path + (\",\" + i) : i.toString();\n node.level = level;\n node[\"aria-setsize\"] = nodes.length;\n node[\"aria-posinset\"] = i + 1;\n node.nid = nid++;\n if (lastNode) {\n node.prev = lastNode;\n lastNode.next = node;\n }\n this.nodeIdMap.set(node.id, node);\n this.nodeNIdMap.set(node.nid, node);\n lastNode = node;\n loop([...node.children()], node, level + 1);\n });\n };\n loop(this.rootNodes, null, 1);\n }",
"function fromNodeOffset(node, offset) {\n if (node.nodeType === 3) {\n return text(node, offset);\n }\n\n if (offset === node.childNodes.length) {\n return end(node);\n }\n\n assert(offset >= 0 && offset < node.childNodes.length,\n 'invalid offset for', node, offset);\n\n return before(node.childNodes[offset]);\n}"
] |
[
"0.6935553",
"0.51984113",
"0.5137182",
"0.50804555",
"0.5039342",
"0.49131727",
"0.47989413",
"0.4793834",
"0.4783685",
"0.47726554",
"0.47673708",
"0.46785817",
"0.46739691",
"0.46738926",
"0.46738812",
"0.46596697",
"0.4644038",
"0.46140343",
"0.4613553",
"0.4611032",
"0.45987627",
"0.45950767",
"0.45858487",
"0.45858487",
"0.45858487",
"0.4574881",
"0.45740896",
"0.4570801",
"0.45657918",
"0.45448068"
] |
0.69467854
|
0
|
Wrapper around OffsetEventEmitter to allow for listening and firing on instances of Place. Not an extension of EventEmitter, so not all of the original methods are necessarily supported.
|
function PlaceEventEmitter() {
this._root = new OffsetEventEmitter();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function OffsetEventEmitter() {\n EventEmitter.call(this);\n this._children = {};\n}",
"function EventEmitter(){}// Shortcuts to improve speed and size",
"function EventEmitter() {} // Shortcuts to improve speed and size",
"function LokiEventEmitter() {}",
"function LokiEventEmitter() {}",
"function LokiEventEmitter() { }",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}",
"function EventEmitter() {}"
] |
[
"0.7669674",
"0.6133002",
"0.60935825",
"0.6057339",
"0.6057339",
"0.5927509",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257",
"0.59125257"
] |
0.8410292
|
0
|
Insert User in Google Analytics Accounts
|
function insertUser() {
var profiledata;
var email = document.getElementById('email'); //Email Input Field
var id = document.getElementById('account-id'); //Account ID input Field
if( email.value == '' || id.value == '' ){
alert('Please fill out the field!!');
return;
}
else {
var request = gapi.client.analytics.management.webproperties.list({
'accountId': id.value
})
request.execute(function (response) {
if(response.code == 400 || response.code == 403 || response.code == 500){
alert('Invalid');
return;
}
else {
profiledata = response;
if (profiledata.result.items && profiledata.result.items.length) {
var propertyId = profiledata.result.items[0].id;
var accountId = id.value;
var profileId = profiledata.result.items[0].defaultProfileId;
var request = gapi.client.analytics.management.profileUserLinks.insert({
'accountId': accountId,
'webPropertyId': propertyId,
'profileId': profileId,
'resource': {
'permissions': {
'effective': [
'COLLABORATE',
'READ_AND_ANALYZE'
],
'local': [
'COLLABORATE',
'READ_AND_ANALYZE'
]
},
'userRef': {
'email': email.value
}
}
});
request.execute(function (response) {
if(response.code == 400 || response.code == 403 || response.code == 500){
console.log(response);
alert('Invalid');
return;
}
else {
alert('User has been added succesfully');
console.log(response);
return;
}
});
}
}
});
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function addUser() {\n var user = {\n primaryEmail: '[email protected]',\n name: {\n givenName: 'Elizabeth',\n familyName: 'Smith'\n },\n // Generate a random password string.\n password: Math.random().toString(36)\n };\n user = AdminDirectory.Users.insert(user);\n Logger.log('User %s created with ID %s.', user.primaryEmail, user.id);\n}",
"function storeUserCallback (err) {\n if (err) {console.log(\"account already in database, moving on\");}\n else {console.log(\"inserted user into db\");}\n //I set googleid as primary key so uniqueness is forced.\n }",
"function addUserToCustomerIO(){\n if (hasSignedUp()) return;\n\n var email = $(\"#cio-email\").val();\n var firstName = $(\"#cio-firstname\").val();\n var source = $(\"#cio-source\").val();\n var id = email.replace('@', '_');\n id = id.replace('.', '_');\n\n _cio.identify({\n // Required Items\n id: id,\n email: email,\n created_at: Math.round( new Date().getTime()/1000), // seconds since the epoch\n\n // Optional (these are examples. You can name attributes what you wish)\n type: 'lead',\n first_name: firstName,\n source: 'leads',\n referrer: document.referrer\n });\n\n setSignedUp();\n }",
"function storeGoogleUser(user = new User(), profile, token, callback) {\n console.log(profile.emails[0].value)\n user.google.id = profile.id\n user.google.token = token\n user.google.name = profile.displayName\n user.google.email = profile.emails[0].value\n user.save(err => {\n if (err) {\n throw err\n }\n callback(err, user)\n })\n}",
"updateUser(googleId, email) {\n axios.post(`https://studyjs-ga.herokuapp.com/auth/google`, {\n googleId: googleId,\n username: email\n })\n .then((response) => {\n this.getUserData(localStorage.userToken)\n })\n .catch((err) => {console.log(err)})\n }",
"function insert(data) {\n return baseService.post(`/api/campaigns/${data.user_id}`, data);\n}",
"function registerUser(){\n Cloud.Users.create({\n username: \"push123x\",\n password: \"push123x\",\n password_confirmation: \"push123x\",\n first_name: \"Firstname\",\n last_name: \"Lastname\"\n }, function (e) {\n if (e.success) {\n \talert(\"User Created\");\n \tloginUser();\n } else {\n \talert(\"Error :\"+e.message);\n }\n });\n}",
"function onSignIn(googleUser) {\n var profile = googleUser.getBasicProfile();\n console.log('ID: ' + profile.getId());\n console.log('Name: ' + profile.getName());\n console.log('Image URL: ' + profile.getImageUrl());\n console.log('Email: ' + profile.getEmail());\n console.log('id_token: ' + googleUser.getAuthResponse().id_token);\n \n //do not post all above info to the server because that is not secure.\n //just send the id_token\n \n var redirectUrl = 'account?action=login';\n \n //using jquery to post data dynamically\n var form = $('<form action=\"' + redirectUrl + '\" method=\"post\">' +\n '<input type=\"hidden\" name=\"id_token\" value=\"' +\n googleUser.getAuthResponse().id_token + '\" />' +\n '</form>');\n $('body').append(form);\n form.submit();\n}",
"function onSignIn(googleUser) {\n var profile = googleUser.getBasicProfile();\n console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.\n console.log('Name: ' + profile.getName());\n console.log('Image URL: ' + profile.getImageUrl());\n console.log('Email: ' + profile.getEmail());\n\t \n\t // The ID token you need to pass to your backend:\n var id_token = googleUser.getAuthResponse().id_token;\n console.log(\"ID Token: \" + id_token);\n}",
"function attachNewUserToIncident() {\n attachNewUser = true;\n $(\"#user_add_username\").val($(\"#user_name\").val());\n openAddUser();\n }",
"function registerUser() {\n addUser()\n }",
"setUser(id) {\n if (!this.service) {\n throw new Error('Google Analytics hasn\\'t been installed on this page');\n }\n if (this.enabled) {\n this.timeout(`user|${id}`, () => {\n console.log('Service', `Set user ID: ${id}`);\n this.service('set', 'userId', id);\n this.event('authentication', 'user-id available');\n }, 100);\n }\n }",
"function setUserId(gtagFunction, analyticsId, id, options) {\r\n if (options && options.global) {\r\n gtagFunction(GtagCommand.SET, { 'user_id': id });\r\n }\r\n else {\r\n gtagFunction(GtagCommand.CONFIG, analyticsId, {\r\n update: true,\r\n 'user_id': id\r\n });\r\n }\r\n}",
"function setUserId(gtagFunction, analyticsId, id, options) {\r\n if (options && options.global) {\r\n gtagFunction(GtagCommand.SET, { 'user_id': id });\r\n }\r\n else {\r\n gtagFunction(GtagCommand.CONFIG, analyticsId, {\r\n update: true,\r\n 'user_id': id\r\n });\r\n }\r\n}",
"function onSignIn(googleUser) {\n\n var auth2 = gapi.auth2.getAuthInstance();\n auth2.disconnect();\n\n // useful data for your client-side scripts:\n let profile = googleUser.getBasicProfile();\n console.log(\"ID: \" + profile.getId());\n console.log('Full Name: ' + profile.getName());\n console.log('Given Name: ' + profile.getGivenName());\n console.log('Family Name: ' + profile.getFamilyName());\n console.log(\"Image URL: \" + profile.getImageUrl());\n console.log(\"Email: \" + profile.getEmail());\n let email = profile.getEmail();\n\n // if email matches RegEx (if its a valid email)\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if(re.test(email)){\n // if email matches RegEx2 (if its a carnal mail)\n const re2=/^[^@\\s][email protected]$/;\n if(re2.test(email)){\n document.getElementById(\"msgError\").innerHTML = '';\n\n // ID token to pass to the backend:\n let id_token = googleUser.getAuthResponse().id_token;\n console.log(\"ID Token: \" + id_token);\n\n //ajax request to send data to the backend (to create user ?) so that we keep a trace of imports in database)\n $.ajax({\n type: \"POST\",\n headers: {\n 'X-CSRF-TOKEN': $('meta[name=\"csrf-token\"]').attr('content')\n },\n url: \"user/login/\"+id_token ,\n data: {// all profile data\n _token : $('meta[name=\"csrf-token\"]').attr('content'),\n _token_google_client : id_token ,\n _id_google : profile.getId(),\n _full_name : profile.getName() ,\n _given_name : profile.getGivenName() ,\n _family_name : profile.getFamilyName() ,\n _image_url : profile.getImageUrl() ,\n _email : profile.getEmail(),\n },\n dataType: \"text\",\n //if succes then redirect to the dashboard with a session mail stored\n success:function(data) {\n console.log(data);\n window.location=\"/dashboard\"\n }\n });\n }else{\n //if email isnt a carnal mail\n document.getElementById(\"msgError\").innerHTML = \"Invalid email address, carnalmedia.com needed\";\n }\n }else{\n //if email isnt a valid email\n document.getElementById(\"msgError\").innerHTML = \"Please enter a valid email address.\";\n }\n\n\n }",
"async function insertNewClientIntoDB() {\r\n const userEmail = sessionStorage.getItem('email');\r\n const userNickname = sessionStorage.getItem('nickname');\r\n const user = await getUserWithMail(userEmail);\r\n if (!user) {\r\n const userDataObj = {\r\n firstName: userNickname,\r\n lastName: \"\",\r\n dateOfBirth: \"\",\r\n phoneNumber: \"\",\r\n email: userEmail,\r\n role: \"user\"\r\n }\r\n\r\n await insertUser(userDataObj);\r\n\r\n }\r\n\r\n}",
"function pushUserData(accountType){\n\tif (accountType === 'newAccount'){\t\n\t\tcreateUserInformation();\n\t}\n\tif (accountType === 'updateAccount'){\n\t\tupdateUserInformation();\n\t}\n}",
"function insertUser(data) {\n\treturn db(\"team_members\").insert(data);\n}",
"addNewUser({name, email, location}) {\n return mPool.collection(\"users\").\n insertOne({\n \"name\": name, \n \"email\": email,\n \"location\": location\n });\n }",
"function register( trackingID_in, clientID_in, appName_in, appVersion_in, appID_in )\n{\n\tanalyticsVersion = 1;\n\tpropertyID = trackingID_in;\n\tclientID = clientID_in;\n\tappName = appName_in;\n\tappVersion = appVersion_in;\n\tappID = appID_in;\n\n}",
"async registerUser(userInfo) {}",
"function writeInitialUserData(userId, dAacc, email) {\n var database = firebase.database();\n firebase.database().ref('users/' + userId).set({\n dAaccount: dAacc,\n email: email,\n userExp: 0,\n coins: 0\n });\n }",
"function insertNewUser({ username, firstname, lastname, email, password, admin }) {\n}",
"function addToRegisteredUsers( obj ) {\n\t// alter this function if mongoDB is used later\n\tconsole.log(\"pushing the new user to the storage\");\n\tregisteredUsers.push(obj);\n\t//obj = {};\n}",
"function writeUserData(userId, name, email, imageUrl) {\n firebase.database().ref('users/' + userId).set({\n username: name,\n email: email,\n profile_picture : imageUrl\n }).then(() =>\n firebase.database().ref('logins').push().set({\n userId: userId,\n email: email,\n logindate : Date()\n }) \n );\n }",
"function onSignIn(googleUser) {\n // const profile = googleUser.getBasicProfile();\n const id_token = googleUser.getAuthResponse().id_token;\n $.ajax({\n url:`${url}/user/signin?loginVia=google`,\n method:'POST',\n headers:{\n token_id: id_token\n }\n })\n .done(response => {\n notif('top-end', 'success', 'Sign in Success');\n localStorage.setItem('token', response.token);\n user._id = response.userId;\n user.name = response.userName;\n isSignIn();\n })\n .fail(err => {\n notif('top-end', 'error', response.responseJSON.err)\n })\n}",
"function createAccount(event) {\n event.preventDefault();\n var displayName = $('#userName').val();\n var email = $('#emailR').val();\n var password = $('#pwdR').val();\n var reenterPwd = $('#reenterpwd').val();\n\n firebase.auth().createUserWithEmailAndPassword(email, password)\n .then(function(user) {\n user.updateProfile({ displayName: displayName });\n $(\"#user-name\").html(\", \" + displayName);\n })\n .catch(function(error) {\n console.log('register error', error);\n });\n }",
"function post_user(name, sub) {\n var key = datastore.key(USER);\n const new_user = { \"name\": name, \"sub\": sub };\n return datastore.save({ \"key\": key, \"data\": new_user }).then(() => { return key })\n}",
"function addUserToDB(id , name) {\n url = serverURL + \"/sendUserInfo\";\n sendPostRequest(url, {'id': id,'name': name});\n}",
"function onSignIn(googleUser) {\n var profile = googleUser.getBasicProfile();\n console.log('ID: ' + profile.getId()); \n console.log('Name: ' + profile.getName());\n console.log('Image URL: ' + profile.getImageUrl());\n console.log('Email: ' + profile.getEmail()); \n}"
] |
[
"0.6451452",
"0.6419818",
"0.6313721",
"0.6161532",
"0.61206234",
"0.6060208",
"0.6040147",
"0.6021",
"0.5988509",
"0.59821326",
"0.5913855",
"0.5874089",
"0.5868384",
"0.5868384",
"0.5868341",
"0.5867974",
"0.5854902",
"0.58396184",
"0.5795388",
"0.57788146",
"0.5764151",
"0.57614875",
"0.57582814",
"0.57265264",
"0.57095623",
"0.57018834",
"0.5697301",
"0.5689081",
"0.5682238",
"0.5676828"
] |
0.6815875
|
0
|
Init line chart button listeners
|
initLineChartButtons() {
// add the Line chart buttons to the feature panel
for (let i = 0; i < this.swarm_features.length; i++) {
let capitalized_feature_string = this.swarm_features[i].split('_').join(' ');
capitalized_feature_string = capitalized_feature_string.charAt(0).toUpperCase() + capitalized_feature_string.slice(1);
$('#line-chart-feature-checkboxes')
.append('<tr><th> <div class="pretty p-switch p-fill p-bigger"><input type="checkbox" class="line-chart-check-box" id="draw-' +
this.swarm_features[i] + '" data="#' + this.swarm_features[i] + 'Line" /><div class="state"><label>' +
capitalized_feature_string + '</label></div></div></th></tr>');
}
$('.line-chart-check-box').change(function() {
let checkbox = $(this);
if (checkbox.prop('checked')) {
$(checkbox.attr('data')).show();
} else {
$(checkbox.attr('data')).hide();
}
});
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function SVGLineChart() {\r\n }",
"_addEventsXAxis(btnDecrease, btnIncrease){\n $(btnDecrease).click(() => { this.zoomXAxis(false); });\n $(btnIncrease).click(() => { this.zoomXAxis(true); });\n }",
"function initLine() {\n console.log(\"Initializing line chart...\");\n\n // Get current pdf data\n pdf = getCurrentPDF();\n pdfF = getCurrentPDFFemale();\n pdfM = getCurrentPDFMale();\n\n // Init filter options\n addFilterMenu();\n\n // Init axes\n drawAxes();\n\n // Draw new lines\n if ([\"f\",\"cmp\"].includes(selectedGender)){\n drawLines(getSelection(\"f\"), selectedGender==\"cmp\");\n }\n if ([\"m\",\"cmp\"].includes(selectedGender)){\n drawLines(getSelection(\"m\"), false);\n }\n if (\"all\" == selectedGender){\n drawLines(getSelection(\"all\"), false);\n }\n\n console.log(\"Done.\");\n\n // Stop loader animation\n d3.selectAll('.spinningLine').classed('hidden', true);\n}",
"function init() {\n if (!buttons || !graph || !container || !infoQuantity || !infoDuration) {\n console.error('could not find all necessary elements');\n return;\n }\n\n buttons.forEach((button) => {\n button.addEventListener('click', _handleButtonClick);\n });\n\n CHART_CONTEXT = graph.getContext('2d');\n}",
"function process_click_chart(ele) {\n\n var url = ele.attr('key');\n\n var jqxhr = $.getJSON(url, function() {\n console.log('successful get');\n })\n .done( function(data) {\n\n var chart_labels = [];\n var chart_data = [];\n\n for (var key in data) {\n chart_labels.push(key);\n chart_data.push(data[key]);\n }\n\n if (chart_data.length == 1 && chart_labels.length == 1) {\n chart_data.push(null);\n chart_data.unshift(null);\n chart_labels.push('');\n chart_labels.unshift('');\n }\n\n console.log(chart_data);\n\n var myLineChart = new Chart(ele, {\n type: 'line',\n data: {\n\n labels: chart_labels,\n datasets: [{\n label: 'Number of clicks',\n data: chart_data,\n backgroundColor:\n 'rgba(66, 139, 202, 0.50)',\n borderColor:\n 'rgba(66, 139, 202, 0.50)',\n hoverBackgroundColor:\n 'rgba(66, 139, 202, 0.50)',\n borderWidth: 1,\n }]\n },\n\n options: {\n scales: {\n yAxes: [{\n ticks: {\n min: 0,\n stepSize: calculate_step( find_max(chart_data) ),\n }\n }]\n }\n }\n });\n\n });\n}",
"_registerListeners() {\n\t\teventManager.addEventListener('approximationsUpdated', this.buildChart.bind(this));\n\t}",
"_initEvents() {\n document.documentElement.addEventListener(Globals.colorAttributeChange, (event) => {\n this._horizontalTooltipChart && this._horizontalTooltipChart.destroy();\n this._initCustomTooltipBar();\n });\n }",
"function initStepToolbarEventHandler() {\n initAddFieldSetEventHandler();\n initPreviewToggle();\n }",
"function componentLineChart () {\n\n /* Default Properties */\n var width = 400;\n var height = 400;\n var transition = { ease: d3.easeLinear, duration: 0 };\n var colors = palette.categorical(3);\n var colorScale = void 0;\n var xScale = void 0;\n var yScale = void 0;\n var dispatch = d3.dispatch(\"customValueMouseOver\", \"customValueMouseOut\", \"customValueClick\", \"customSeriesMouseOver\", \"customSeriesMouseOut\", \"customSeriesClick\");\n var classed = \"lineChart\";\n\n /**\n * Initialise Data and Scales\n *\n * @private\n * @param {Array} data - Chart data.\n */\n function init(data) {\n var _dataTransform$summar = dataTransform(data).summary(),\n rowKeys = _dataTransform$summar.rowKeys,\n valueMax = _dataTransform$summar.valueMax;\n\n var valueExtent = [0, valueMax];\n\n // TODO: Use dataTransform() to calculate date domains?\n var dateDomain = d3.extent(data[0].values, function (d) {\n return d.key;\n });\n\n if (typeof colorScale === \"undefined\") {\n colorScale = d3.scaleOrdinal().domain(rowKeys).range(colors);\n }\n\n if (typeof xScale === \"undefined\") {\n xScale = d3.scaleTime().domain(dateDomain).range([0, width]);\n }\n\n if (typeof yScale === \"undefined\") {\n yScale = d3.scaleLinear().domain(valueExtent).range([height, 0]).nice();\n }\n }\n\n /**\n * Constructor\n *\n * @constructor\n * @alias lineChart\n * @param {d3.selection} selection - The chart holder D3 selection.\n */\n function my(selection) {\n init(selection.data());\n selection.each(function () {\n\n // Line generation function\n var line = d3.line().curve(d3.curveCardinal).x(function (d) {\n return xScale(d.key);\n }).y(function (d) {\n return yScale(d.value);\n });\n\n // Line animation tween\n var pathTween = function pathTween(data) {\n var interpolate = d3.scaleQuantile().domain([0, 1]).range(d3.range(1, data.length + 1));\n return function (t) {\n return line(data.slice(0, interpolate(t)));\n };\n };\n\n // Update series group\n var seriesGroup = d3.select(this);\n seriesGroup.classed(classed, true).attr(\"id\", function (d) {\n return d.key;\n }).on(\"mouseover\", function (d) {\n dispatch.call(\"customSeriesMouseOver\", this, d);\n }).on(\"click\", function (d) {\n dispatch.call(\"customSeriesClick\", this, d);\n });\n\n // Create series group\n var seriesLine = seriesGroup.selectAll(\".seriesLine\").data(function (d) {\n return [d];\n });\n\n seriesLine.enter().append(\"path\").attr(\"class\", \"seriesLine\").attr(\"stroke-width\", 1.5).attr(\"stroke\", function (d) {\n return colorScale(d.key);\n }).attr(\"fill\", \"none\").merge(seriesLine).transition().duration(transition.duration).attrTween(\"d\", function (d) {\n return pathTween(d.values);\n });\n\n seriesLine.exit().transition().style(\"opacity\", 0).remove();\n });\n }\n\n /**\n * Width Getter / Setter\n *\n * @param {number} _v - Width in px.\n * @returns {*}\n */\n my.width = function (_v) {\n if (!arguments.length) return width;\n width = _v;\n return this;\n };\n\n /**\n * Height Getter / Setter\n *\n * @param {number} _v - Height in px.\n * @returns {*}\n */\n my.height = function (_v) {\n if (!arguments.length) return height;\n height = _v;\n return this;\n };\n\n /**\n * Color Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 color scale.\n * @returns {*}\n */\n my.colorScale = function (_v) {\n if (!arguments.length) return colorScale;\n colorScale = _v;\n return my;\n };\n\n /**\n * Colors Getter / Setter\n *\n * @param {Array} _v - Array of colours used by color scale.\n * @returns {*}\n */\n my.colors = function (_v) {\n if (!arguments.length) return colors;\n colors = _v;\n return my;\n };\n\n /**\n * X Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 scale.\n * @returns {*}\n */\n my.xScale = function (_v) {\n if (!arguments.length) return xScale;\n xScale = _v;\n return my;\n };\n\n /**\n * Y Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 scale.\n * @returns {*}\n */\n my.yScale = function (_v) {\n if (!arguments.length) return yScale;\n yScale = _v;\n return my;\n };\n\n /**\n * Dispatch Getter / Setter\n *\n * @param {d3.dispatch} _v - Dispatch event handler.\n * @returns {*}\n */\n my.dispatch = function (_v) {\n if (!arguments.length) return dispatch();\n dispatch = _v;\n return this;\n };\n\n /**\n * Dispatch On Getter\n *\n * @returns {*}\n */\n my.on = function () {\n var value = dispatch.on.apply(dispatch, arguments);\n return value === dispatch ? my : value;\n };\n\n return my;\n }",
"function chartLineChart () {\n\n /* Default Properties */\n var svg = void 0;\n var chart = void 0;\n var classed = \"lineChart\";\n var width = 400;\n var height = 300;\n var margin = { top: 20, right: 20, bottom: 40, left: 40 };\n var transition = { ease: d3.easeBounce, duration: 500 };\n var colors = palette.categorical(3);\n var dispatch = d3.dispatch(\"customValueMouseOver\", \"customValueMouseOut\", \"customValueClick\", \"customSeriesMouseOver\", \"customSeriesMouseOut\", \"customSeriesClick\");\n\n /* Chart Dimensions */\n var chartW = void 0;\n var chartH = void 0;\n\n /* Scales */\n var xScale = void 0;\n var yScale = void 0;\n var colorScale = void 0;\n\n /* Other Customisation Options */\n var yAxisLabel = null;\n\n /**\n * Initialise Data and Scales\n *\n * @private\n * @param {Array} data - Chart data.\n */\n function init(data) {\n chartW = width - margin.left - margin.right;\n chartH = height - margin.top - margin.bottom;\n\n var _dataTransform$summar = dataTransform(data).summary(),\n rowKeys = _dataTransform$summar.rowKeys,\n valueMax = _dataTransform$summar.valueMax;\n\n var valueExtent = [0, valueMax];\n\n // TODO: Use dataTransform() to calculate date domains?\n data.forEach(function (d, i) {\n d.values.forEach(function (b, j) {\n data[i].values[j].key = new Date(b.key * 1000);\n });\n });\n var dateDomain = d3.extent(data[0].values, function (d) {\n return d.key;\n });\n\n if (typeof colorScale === \"undefined\") {\n colorScale = d3.scaleOrdinal().domain(rowKeys).range(colors);\n }\n\n xScale = d3.scaleTime().domain(dateDomain).range([0, chartW]);\n\n yScale = d3.scaleLinear().domain(valueExtent).range([chartH, 0]).nice();\n }\n\n /**\n * Constructor\n *\n * @constructor\n * @alias lineChart\n * @param {d3.selection} selection - The chart holder D3 selection.\n */\n function my(selection) {\n // Create SVG element (if it does not exist already)\n if (!svg) {\n svg = function (selection) {\n var el = selection._groups[0][0];\n if (!!el.ownerSVGElement || el.tagName === \"svg\") {\n return selection;\n } else {\n return selection.append(\"svg\");\n }\n }(selection);\n\n svg.classed(\"d3ez\", true).attr(\"width\", width).attr(\"height\", height);\n\n chart = svg.append(\"g\").classed(\"chart\", true);\n } else {\n chart = selection.select(\".chart\");\n }\n\n // Update the chart dimensions and add layer groups\n var layers = [\"zoomArea\", \"lineGroups\", \"xAxis axis\", \"yAxis axis\"];\n chart.classed(classed, true).attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\").attr(\"width\", chartW).attr(\"height\", chartH).selectAll(\"g\").data(layers).enter().append(\"g\").attr(\"class\", function (d) {\n return d;\n });\n\n selection.each(function (data) {\n // Initialise Data\n init(data);\n\n // Add Clip Path (Proof of Concept)\n chart.append('defs').append('clipPath').attr('id', 'plotAreaClip').append('rect').attr('width', chartW).attr('height', chartH);\n\n // Line Chart\n var lineChart = component.lineChart().width(chartW).height(chartH).colorScale(colorScale).xScale(xScale).yScale(yScale).dispatch(dispatch);\n\n // Scatter Plot\n var scatterPlot = component.scatterPlot().width(chartW).height(chartH).colorScale(colorScale).yScale(yScale).xScale(xScale).dispatch(dispatch);\n\n var lineGroups = chart.select(\".lineGroups\").attr('clip-path', \"url(\" + window.location + \"#plotAreaClip)\").append(\"g\");\n\n var seriesGroup = lineGroups.selectAll(\".seriesGroup\").data(data);\n\n seriesGroup.enter().append(\"g\").attr(\"class\", \"seriesGroup\").style(\"fill\", function (d) {\n return colorScale(d.key);\n }).merge(seriesGroup).call(lineChart).call(scatterPlot);\n\n seriesGroup.exit().remove();\n\n // X Axis\n var xAxis = d3.axisBottom(xScale).tickFormat(d3.timeFormat(\"%d-%b-%y\"));\n\n chart.select(\".xAxis\").attr(\"transform\", \"translate(0,\" + chartH + \")\").call(xAxis).selectAll(\"text\").style(\"text-anchor\", \"end\").attr(\"dx\", \"-.8em\").attr(\"dy\", \".15em\").attr(\"transform\", \"rotate(-65)\");\n\n // Y Axis\n var yAxis = d3.axisLeft(yScale);\n\n chart.select(\".yAxis\").call(yAxis).append(\"text\").attr(\"transform\", \"rotate(-90)\").attr(\"y\", -40).attr(\"dy\", \".71em\").attr(\"fill\", \"#000000\").style(\"text-anchor\", \"end\").text(yAxisLabel);\n\n // Zoom\n var zoom = d3.zoom().extent([[0, 0], [chartW, chartH]]).scaleExtent([1, 8]).translateExtent([[0, 0], [chartW, chartH]]).on(\"zoom\", zoomed);\n\n chart.select(\".zoomArea\").append(\"rect\").attr(\"width\", chartW).attr(\"height\", chartH).attr(\"fill\", \"none\").attr(\"pointer-events\", \"all\").call(zoom);\n\n function zoomed() {\n var xScaleZoomed = d3.event.transform.rescaleX(xScale);\n\n xAxis.scale(xScaleZoomed);\n lineChart.xScale(xScaleZoomed);\n scatterPlot.xScale(xScaleZoomed);\n\n chart.select(\".xAxis\").call(xAxis).selectAll(\"text\").style(\"text-anchor\", \"end\").attr(\"dx\", \"-.8em\").attr(\"dy\", \".15em\").attr(\"transform\", \"rotate(-65)\");\n\n lineGroups.selectAll(\".seriesGroup\").call(lineChart).call(scatterPlot);\n }\n });\n }\n\n /**\n * Width Getter / Setter\n *\n * @param {number} _v - Width in px.\n * @returns {*}\n */\n my.width = function (_v) {\n if (!arguments.length) return width;\n width = _v;\n return this;\n };\n\n /**\n * Height Getter / Setter\n *\n * @param {number} _v - Height in px.\n * @returns {*}\n */\n my.height = function (_v) {\n if (!arguments.length) return height;\n height = _v;\n return this;\n };\n\n /**\n * Margin Getter / Setter\n *\n * @param {number} _v - Margin in px.\n * @returns {*}\n */\n my.margin = function (_v) {\n if (!arguments.length) return margin;\n margin = _v;\n return this;\n };\n\n /**\n * Y Axix Label Getter / Setter\n *\n * @param {number} _v - Label text.\n * @returns {*}\n */\n my.yAxisLabel = function (_v) {\n if (!arguments.length) return yAxisLabel;\n yAxisLabel = _v;\n return this;\n };\n\n /**\n * Transition Getter / Setter\n *\n * @param {d3.transition} _v - D3 transition style.\n * @returns {*}\n */\n my.transition = function (_v) {\n if (!arguments.length) return transition;\n transition = _v;\n return this;\n };\n\n /**\n * Colors Getter / Setter\n *\n * @param {Array} _v - Array of colours used by color scale.\n * @returns {*}\n */\n my.colors = function (_v) {\n if (!arguments.length) return colors;\n colors = _v;\n return this;\n };\n\n /**\n * Color Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 color scale.\n * @returns {*}\n */\n my.colorScale = function (_v) {\n if (!arguments.length) return colorScale;\n colorScale = _v;\n return this;\n };\n\n /**\n * Dispatch Getter / Setter\n *\n * @param {d3.dispatch} _v - Dispatch event handler.\n * @returns {*}\n */\n my.dispatch = function (_v) {\n if (!arguments.length) return dispatch();\n dispatch = _v;\n return this;\n };\n\n /**\n * Dispatch On Getter\n *\n * @returns {*}\n */\n my.on = function () {\n var value = dispatch.on.apply(dispatch, arguments);\n return value === dispatch ? my : value;\n };\n\n return my;\n }",
"function initCharts(charts) {\n\n var chartLines = {\n series: {\n lines: {\n show: true,\n lineWidth: 1,\n fill: true,\n fillColor: { colors: [ { opacity: 0.1 }, { opacity: 0.13 } ] }\n },\n points: {\n show: true,\n lineWidth: 2,\n radius: 3\n },\n shadowSize: 0,\n stack: true\n },\n grid: {\n hoverable: true,\n clickable: true,\n tickColor: \"#f9f9f9\",\n borderWidth: 0\n },\n legend: {\n show: true,\n labelBoxBorderColor: \"#fff\"\n },\n colors: [\"#a7b5c5\", \"#30a0eb\"],\n xaxis: {\n ticks: [[1, \"Jan\"], [2, \"Feb\"], [3, \"Mar\"], [4, \"Apr\"], [5, \"May\"], [6, \"Jun\"],\n [7, \"Jul\"], [8, \"Aug\"], [9, \"Sep\"], [10, \"Oct\"], [11, \"Nov\"], [12, \"Dec\"]],\n font: {\n size: 12,\n family: \"Open Sans, Arial\",\n color: \"#697695\"\n }\n },\n yaxis: {\n ticks: 3,\n tickDecimals: 0,\n font: {size: 12, color: \"#9da3a9\"}\n }\n };\n // A custom label formatter used by several of the plots\n\n function labelFormatter(label, series) {\n return \"<div class='chart-label'>\" + label + \"<br/>\" + Math.round(series.percent) + \"%</div>\";\n }\n var zoomOpts = {\n series: {\n lines: {\n show: true\n },\n shadowSize: 0\n },\n colors: [\"#30a0eb\"],\n xaxis: {\n zoomRange: [0.1, 10],\n panRange: [-10, 10]\n },\n yaxis: {\n zoomRange: [0.1, 10],\n panRange: [-10, 10]\n },\n zoom: {\n interactive: true\n },\n pan: {\n interactive: true\n },\n grid: {\n tickColor: \"#f9f9f9\",\n borderColor: \"#fff\"\n }\n }\n var chartBars = {\n series: {\n bars: {\n show: true,\n lineWidth: 1,\n fill: true,\n fillColor: { colors: [ { opacity: 0.1 }, { opacity: 0.13 } ] }\n }\n },\n legend: {\n show: true,\n labelBoxBorderColor: \"#fff\"\n },\n colors: [\"#30a0eb\"],\n bars: {\n horizontal: false,\n barWidth: 0.7\n },\n grid: {\n hoverable: true,\n clickable: true,\n tickColor: \"#f9f9f9\",\n borderWidth: 0\n },\n xaxis: {\n ticks: [[1, \"Jan\"], [2, \"Feb\"], [3, \"Mar\"], [4, \"Apr\"], [5, \"May\"], [6, \"Jun\"],\n [7, \"Jul\"], [8, \"Aug\"], [9, \"Sep\"], [10, \"Oct\"], [11, \"Nov\"], [12, \"Dec\"]],\n font: {\n size: 12,\n family: \"Open Sans, Arial\",\n color: \"#697695\"\n }\n },\n yaxis: {\n ticks: 5,\n tickDecimals: 0,\n font: {size: 12, color: \"#9da3a9\"}\n }\n };\n\n var horizontalBars = {\n series: {\n bars: {\n show: true,\n lineWidth: 1,\n fill: true,\n fillColor: { colors: [ { opacity: 0.1 }, { opacity: 0.13 } ] }\n }\n },\n colors: [\"#30a0eb\"],\n bars: {\n align: \"center\",\n barWidth: 0.7,\n horizontal: true\n },\n xaxis: {\n axisLabel: \"Price (USD/oz)\",\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 12,\n axisLabelFontFamily: 'Verdana, Arial',\n axisLabelPadding: 9,\n max: 2000,\n tickFormatter: function (v, axis) {\n return v;\n },\n color: \"#697695\"\n },\n yaxis: {\n axisLabel: \"Precious Metals\",\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 12,\n axisLabelFontFamily: 'Verdana, Arial',\n axisLabelPadding: 3,\n ticks: [ [0, \"Gold\"], [1, \"Silver\"], [2, \"Platinum\"], [3, \"Palldium\"], [4, \"Rhodium\"], [5, \"Ruthenium\"], [6, \"Iridium\"]],\n color: \"#697695\"\n },\n legend: {\n noColumns: 0,\n labelBoxBorderColor: \"#fff\",\n position: \"ne\"\n },\n grid: {\n hoverable: true,\n tickColor: \"#f9f9f9\",\n borderColor: \"#fff\"\n }\n };\n\n var realTimeBars = {\n series: {\n shadowSize: 0\t// Drawing is faster without shadows\n },\n colors: [\"#30a0eb\"],\n yaxis: {\n min: 0,\n max: 100\n },\n xaxis: {\n show: false\n },\n grid: {\n tickColor: \"#f9f9f9\",\n borderColor: \"#fff\"\n }\n };\n var pieOpts = {\n series: {\n pie: {\n show: true,\n radius: 1,\n label: {\n show: true,\n radius: 3/4,\n formatter: labelFormatter,\n background: {\n opacity: 0.5\n }\n }\n }\n },\n legend: {\n show: false\n }\n };\n var donutOpts = {\n series: {\n pie: {\n innerRadius: 0.5,\n show: true,\n radius: 1,\n label: {\n show: true,\n radius: 3/4,\n formatter: labelFormatter,\n background: {\n opacity: 0.5\n }\n }\n }\n },\n legend: {\n show: false\n }\n };\n\n function showTooltip(x, y, color, contents) {\n $('<div id=\"tooltip\">' + contents + '</div>').css({\n top: y - 25,\n left: x - 35,\n 'border-color': color\n }).appendTo(\"body\").fadeIn(200);\n }\n function showHorizontalBarTooltip(x, y, color, contents) {\n $('<div id=\"tooltip\">' + contents + '</div>').css({\n top: y - 10,\n left: x + 5,\n 'border-color': color\n }).appendTo(\"body\").fadeIn(200);\n }\n\n $.each(charts, function (id, value) {\n if (!$(id).length){\n return;\n }\n var opts = null;\n switch (value.type){\n case 'bars': opts = chartBars; break;\n case 'zoom': opts = zoomOpts; break;\n case 'horizontal': opts = horizontalBars; break;\n case 'realTime':\n var updateInterval = value.updateInterval;\n $(\"#updateInterval\").val(updateInterval).change(function () {\n var v = $(this).val();\n if (v && !isNaN(+v)) {\n updateInterval = +v;\n if (updateInterval < 1) {\n updateInterval = 1;\n } else if (updateInterval > 2000) {\n updateInterval = 2000;\n }\n $(this).val(\"\" + updateInterval);\n }\n });\n value.data = [getRandomData()];\n opts = realTimeBars;\n break;\n case 'pie': opts = pieOpts; break;\n case 'donut': opts = donutOpts; break;\n default:\n opts = chartLines;\n };\n var plot = $.plot($(id), value.data, opts),\n previousPoint = null,\n previousLabel = null;\n\n //used on real time chart\n function update() {\n plot.setData([getRandomData()]);\n // Since the axes don't change, we don't need to call plot.setupGrid()\n plot.draw();\n setTimeout(update, updateInterval);\n }\n // little helper for taking the repetitive work out of placing\n // panning arrows\n function addArrow(dir, right, top, offset) {\n $(\"<img class='zoomBtn' src='img/charts/arrow-\" + dir + \".gif' style='right:\" + right + \"px;top:\" + top + \"px'>\")\n .appendTo($(id))\n .click(function (e) {\n e.preventDefault();\n plot.pan(offset);\n });\n }\n\n switch (value.type){\n case 'bars':\n //bind tooltip for bars chart\n $(id).bind(\"plothover\", function (event, pos, item) {\n if (item) {\n if (previousPoint != item.dataIndex) {\n previousPoint = item.dataIndex;\n $(\"#tooltip\").remove();\n var x = item.datapoint[0].toFixed(0),\n y = item.datapoint[1].toFixed(0),\n month = item.series.xaxis.ticks[item.dataIndex].label,\n color = item.series.color;\n showTooltip(item.pageX, item.pageY, color,\n item.series.label + \" of \" + month + \": \" + y);\n }\n } else {\n $(\"#tooltip\").remove();\n previousPoint = null;\n }\n });\n break;\n case 'zoom':\n // show pan/zoom messages to illustrate events\n $(id).bind(\"plotpan\", function (event, plot) {\n plot.getAxes();\n });\n $(id).bind(\"plotzoom\", function (event, plot) {\n plot.getAxes();\n });\n // add zoom out button\n $(\"<div class='btn btn-primary btn-xs'>zoom out</div>\")\n .appendTo($(id))\n .click(function (event) {\n event.preventDefault();\n plot.zoomOut();\n });\n // and add panning buttons\n addArrow(\"left\", 33, 35, { left: -100 });\n addArrow(\"right\", 3, 35, { left: 100 });\n addArrow(\"up\", 18, 20, { top: -100 });\n addArrow(\"down\", 18, 50, { top: 100 });\n break;\n case 'horizontal':\n //bind tooltip for horizontal chart\n $(id).bind(\"plothover\", function (event, pos, item) {\n if (item) {\n if ((previousLabel != item.series.label) ||\n (previousPoint != item.dataIndex)) {\n previousPoint = item.dataIndex;\n previousLabel = item.series.label;\n $(\"#tooltip\").remove();\n var x = item.datapoint[0],\n y = item.datapoint[1],\n color = item.series.color;\n showHorizontalBarTooltip(item.pageX,\n item.pageY,\n color,\n \"<strong>\" + item.series.label + \"</strong><br>\" + item.series.yaxis.ticks[y].label +\n \" : <strong>\" + x + \"</strong> USD/oz\");\n }\n } else {\n $(\"#tooltip\").remove();\n previousPoint = null;\n }\n });\n break;\n case 'realTime':\n update();\n break;\n\n };\n\n });\n }",
"function initQCPlotPSMScoreVsScoreClickHandlers() {\t\n\tqcChartPSMScoreVsScores.init();\n}",
"function initListeners() {\n $('#key').on('click', '.key-show-control', function(ev) {\n dispatch.keyShowLine($(this).data('line-id'));\n });\n\n $('#key').on('click', 'a.key-duplicate-control', function(ev) {\n ev.preventDefault();\n dispatch.keyDuplicateLine($(this).data('line-id'));\n });\n\n $('#key').on('click', 'a.key-delete-control', function(ev) {\n ev.preventDefault();\n dispatch.keyDeleteLine($(this).data('line-id'));\n });\n\n $('#key').on('click', 'a.key-edit-control', function(ev) {\n ev.preventDefault();\n dispatch.keyEditLine($(this).data('line-id'));\n });\n }",
"function updatePlot() {\n // Get the value of the button\n xlim = this.value\n\n // Update X axis\n x.domain([0,xlim])\n s3g1xAxis.transition().duration(1000).call(d3.axisBottom(x))\n\n // Update chart\n myline\n .datum(data)\n .transition()\n .duration(2000)\n .attr(\"d\", d3.line()\n .curve(d3.curveBasis) // Just add that to have a curve instead of segments\n .x(function(d) { return x(d.Period); })\n .y(function(d) { return y(d.Value); })\n ) \n }",
"function charts() {\n var ctx = $(\".chart\"),\n myLineChart = new Chart(ctx, {\n type: 'line',\n data: data,\n options: options\n });\n }",
"function drawLine() {\n\n var data = new google.visualization.DataTable();\n data.addColumn('number', 'X');\n data.addColumn('number', 'Clients');\n data.addRows(self.charts.line.rows);\n\n var options = self.charts.line.options;\n\n var chart = new google.visualization.LineChart(document.getElementById('chart_div'));\n\n chart.draw(data, options);\n }",
"function UpdateLineChart(){\n var doc = document.getElementById(\"line_chart__\");\n\n doc.height = $('.bars').height() + 70\n doc.width = $('.bars').width()\n $('.line_chart,.lines,#line_chart__').width($('.bar_wrapper').width());\n $('.line_chart,.lines,#line_chart__').height($('.bar_wrapper').height() + 70);\n\n if(!isLineChartInizialized){\n isLineChartInizialized = true;\n chart = new Chart(doc, {\n type: 'line',\n data: {\n labels: getDateArray(),\n datasets: [{ \n data: getOnlyAnwsersFromArray($scope.first_patient_calculated),\n label: $scope.patients[$scope.patient1 - 1],\n borderColor: color1,\n fill: false\n }, { \n data: getOnlyAnwsersFromArray($scope.second_patient_calculated),\n label: $scope.patients[$scope.patient2 - 1],\n borderColor: color2,\n fill: false\n }\n ]\n },\n options: {\n legend: {\n display: false\n },\n scales: {\n yAxes: [{\n ticks: {\n stepSize: 1,\n beginAtZero: true,\n suggestedMax: 4\n }\n }]\n },\n options: {\n events: []\n },\n animation: {\n duration: 2000, // general animation time\n easing:\"easeInOutExpo\"\n },\n elements: {\n line: {\n tension: 0, // disables bezier curves\n }\n },\n label:{\n display: false\n }\n }\n });\n }else{\n chart.data.labels = getDateArray(),\n chart.data.datasets = [{ \n data: getOnlyAnwsersFromArray($scope.first_patient_calculated),\n label: \"Patient \" + $scope.patient1,\n borderColor: color1,\n fill: false\n }, { \n data: getOnlyAnwsersFromArray($scope.second_patient_calculated),\n label: \"Patient \" + $scope.patient2,\n borderColor: color2,\n fill: false\n }\n ]\n chart.update();\n }\n }",
"didCreateChart (chart) {\n google.visualization.events.addListener (chart, 'ready', this.didReady.bind (this));\n google.visualization.events.addListener (chart, 'select', this.didSelect.bind (this));\n google.visualization.events.addListener (chart, 'error', this.didError.bind (this));\n google.visualization.events.addListener (chart, 'onmouseover', this.didMouseOver.bind (this));\n google.visualization.events.addListener (chart, 'onmouseout', this.didMouseOut.bind (this));\n }",
"function init() {\n\n // AXIS LABELS\n // Set yAxis label to class 'yAxis-label'\n graph\n .append('text')\n .attr('class','yAxis-label')\n \n // Set xAxis label to class 'xAxis-label'\n graph\n .append('text')\n .attr('class','xAxis-label')\n\n // AXIS GROUPS\n // Create axisX group with class 'axisX'\n graph\n .append('g')\n .attr('class','axisX')\n .attr('id','axisX')\n \n // Create axisY group with class 'axisY'\n graph\n .append('g')\n .attr('class','axisY')\n .attr('id','axisY')\n\n\n // add event listner for any resizes (listener is debounced)\n window.addEventListener(\"resize\", debounce(resize, 200));\n drawChart(rawData, props);\n }",
"function myClickFunction() {\n console.log(\"myClickFunction\");\n //chart is accessible from here\n //this refers to the yaxis group, which has the .on attribute set.\n console.log(this);\n }",
"function initChart() {\n if (!showChart) {\n return\n }\n\n addTimelineChart(ee.Geometry(Map.getCenter(true)).centroid(10));\n\n Map.onClick(function (coords) {\n coords = ee.Dictionary(coords);\n print('Map clicked: ', coords);\n let newCenter = ee.Geometry.Point([coords.get('lon'), coords.get('lat')]);\n addTimelineChart(newCenter)\n })\n }",
"function SetUpChannelChartsListeners() {\n const spans = document.getElementsByClassName(\"channelChartIcon\");\n\n for (let i = 0; i < spans.length; i++) {\n spans[i].addEventListener('click', function() {\n DrawChannelChart(spans[i].dataset['name'])\n }); \n }\n\n}",
"function addSeriesCB(){\n\t\t\tstx.createDataSet();\n\t\t\tstx.draw();\n\t\t}",
"function click() {\n // var n = data.length - 1,\n // i = Math.floor(Math.random() * n / 2),\n // j = i + Math.floor(Math.random() * n / 2) + 1;\n // x.domain([data[i].date, data[j].date]);\n // var t = svg.transition().duration(750);\n // t.select(\".x.axis\").call(xAxis);\n // t.select(\".line\").attr(\"d\", line(data));\n}",
"function initChart() {\n var originalLineDraw=Chart.controllers.line.prototype.draw;\n var originalInitialize=Chart.controllers.line.prototype.initialize;\n\n // Extend the line chart, in order to override the draw function.\n Chart.controllers.NRHighlightLine=Chart.controllers.line.extend({\n xHighlightRange: null,\n\n initialize: function(chart) {\n this.xHighlightRange=chart.chart.config.data.datasets[0].xHighlightRange;\n\n originalInitialize.apply(this, arguments);\n },\n //clear: function() {},\n draw: function() {\n var chart=this.chart;\n // Get the object that determines the region to highlight.\n var xHighlightRange=this.xHighlightRange;\n\n\n // If the object exists.\n if(xHighlightRange!==undefined) {\n var ctx=chart.ctx;\n\n var xRangeBegin=xHighlightRange.begin;\n var xRangeEnd=xHighlightRange.end;\n\n var xaxis=chart.scales['x-axis-0'];\n var yaxis=chart.scales['y-axis-0'];\n\n var xRangeBeginPixel=xaxis.getPixelForTick(xRangeBegin);\n var xRangeEndPixel=xaxis.getPixelForTick(xRangeEnd);\n\n ctx.save();\n\n // The fill style of the rectangle we are about to fill.\n ctx.fillStyle='rgba(255, 0, 0, 0.3)';\n // Fill the rectangle that represents the highlight region. The parameters are the closest-to-starting-point pixel's x-coordinate,\n // the closest-to-starting-point pixel's y-coordinate, the width of the rectangle in pixels, and the height of the rectangle in pixels, respectively.\n ctx.fillRect(Math.min(xRangeBeginPixel, xRangeEndPixel), 0, Math.max(xRangeBeginPixel, xRangeEndPixel)-Math.min(xRangeBeginPixel, xRangeEndPixel), yaxis.bottom);\n\n ctx.restore();\n }\n\n // Apply the original draw function for the line chart.\n originalLineDraw.apply(this, arguments);\n }\n });\n\n Chart.defaults.NRHighlightLine=Chart.defaults.line;\n }",
"function addLines(lines) {\n for (var j=0; j<lines.length;j++) {\n // create new line\n var linechart = newLine(lines[j].id)\n // attach data\n linechart\n .data(lines[j].values)\n // refresh\n linechart(); \n }\n }",
"function drawLineChart($scope){\n\tif(!$scope.chartTypeToggle.line){\n\t\treturn;\n\t}\n\tvar svg = $scope.svg;\n\tvar $axisProvider = $scope.$axisProvider;\n\tvar $lineChartProvider = $scope.$injector.get(\"$lineChartProvider\");\n\t$scope.$lineChartProvider = $lineChartProvider;\n\t$lineChartProvider.axisProvider = $axisProvider;\n\t$lineChartProvider.svg = svg;\n\t$lineChartProvider.data = getDataFromScope($scope);\n\t$lineChartProvider.effect = $scope.chartEffect;\n\t$lineChartProvider.dataX = $scope.chartX;\n\t$lineChartProvider.dataY = $scope.chartY;\n\t$lineChartProvider.animate = $scope.chartAnimate;\n \n\t$lineChartProvider.draw();\n\t\n\t$scope.$watch('chartAnimate',function(newValue,oldValue){\n\t\t$lineChartProvider.animate = newValue;\n\t\t//redraw only when animate was turned on from off.\n\t\tif(!oldValue && newValue && $scope.chartTypeToggle.line){\n\t\t\t$lineChartProvider.draw();\n\t\t}\n\t});\n\t$scope.$watch('chartEffect',function(newValue,oldValue){\n\t\t$lineChartProvider.effect = newValue;\n\t\tif(oldValue!=newValue && $scope.chartTypeToggle.line){\n\t\t\t$lineChartProvider.draw();\n\t\t}\n\t});\t\n}",
"constructor(props){\n\tsuper(props)\n\tthis.createLineChart = this.createLineChart.bind(this)\n }",
"function chart(){\r\n var canvas = document.getElementById('Chart');\r\n var data = {\r\n labels: [],\r\n // varje dictionary i dataset är en line som visualiseras i grafen \r\n datasets: [\r\n {\r\n label: \"Ärvärdet David\",\r\n fill: false,\r\n lineTension: 0.1,\r\n backgroundColor: \"rgb(0, 0, 0)\",\r\n borderColor: \"rgb(0, 0, 0)\",\r\n borderCapStyle: 'butt',\r\n borderDash: [],\r\n borderDashOffset: 0.0,\r\n borderJoinStyle: 'miter',\r\n data: [],\r\n }, {\r\n label: \"Börvärdet\",\r\n fill: false,\r\n lineTension: 0.1,\r\n backgroundColor: \"rgb(103, 187, 243)\",\r\n borderColor: \"rgb(103, 187, 243)\",\r\n borderCapStyle: 'butt',\r\n borderDash: [],\r\n borderDashOffset: 0.0,\r\n borderJoinStyle: 'miter',\r\n data: [],\r\n },\r\n {\r\n label: \"Ärvärdet Amjad\",\r\n fill: false,\r\n lineTension: 0.1,\r\n backgroundColor: \"rgba(75,192,192,0.4)\",\r\n borderColor: \"rgb(63, 191, 191)\",\r\n borderCapStyle: 'butt',\r\n borderDash: [],\r\n borderDashOffset: 0.0,\r\n borderJoinStyle: 'miter',\r\n data: [],\r\n },\r\n ]\r\n};\r\nvar option = {\r\nchart: {\r\n height: 100,\r\n type: 'line',\r\n animations: {\r\n enabled: true,\r\n easing: 'linear',\r\n dynamicAnimation: {\r\n speed: 1000\r\n }\r\n },\r\n toolbar: {\r\n show: true\r\n },\r\n zoom: {\r\n enabled: true\r\n }\r\n},\r\ndataLabels: {\r\n enabled: false\r\n},\r\nstroke: {\r\n curve: 'smooth'\r\n},\r\nseries: [{\r\n data: data,\r\n}],\r\nmarkers: {\r\n size: 0\r\n},\r\nyaxis: {\r\n max: 200\r\n},\r\nlegend: {\r\n show: false\r\n},\r\n}\r\nmyLineChart = Chart.Line(canvas,{\r\ndata:data,\r\noptions:option\r\n });\r\n}",
"function setupButtons() {\r\n d3.select('#toolbar')\r\n .selectAll('.button')\r\n .on('click', function () {\r\n // Remove active class from all buttons\r\n d3.selectAll('.button').classed('active', false);\r\n // Find the button just clicked\r\n var button = d3.select(this);\r\n\r\n // Set it as the active button\r\n button.classed('active', true);\r\n\r\n // Get the id of the button\r\n var buttonId = button.attr('id');\r\n var dataArr = [];\r\n\r\n // Toggle the bubble chart based on\r\n // the currently clicked button.\r\n myBubbleChart.toggleDisplay(buttonId);\r\n });\r\n}"
] |
[
"0.6141154",
"0.60903716",
"0.6055163",
"0.5978363",
"0.5973254",
"0.5958651",
"0.5955628",
"0.5910048",
"0.5902986",
"0.58939797",
"0.5872552",
"0.5857542",
"0.58491594",
"0.5827673",
"0.5817656",
"0.581118",
"0.5796051",
"0.5764969",
"0.5758807",
"0.57560277",
"0.5739931",
"0.57295746",
"0.57275033",
"0.5700485",
"0.5697922",
"0.56454456",
"0.5643324",
"0.5626582",
"0.5625543",
"0.5622939"
] |
0.67187685
|
0
|
/ ObjectObserver provides concrete observer independent source and target synchronization / functionality for a particular object source with related user interface / interactive capabilities. / ObjectObserver extends from ActivityObserver and for information about activity / functions refer here.
|
function ObjectObserver(options) {
var instance = (options.instance !== null && options.instance !== undefined) ? options.instance : this;
var extender = new InstanceExtender();
instance = extender.extendFieldObserver({ 'instance': instance, 'field': 'InputObject', 'observer': options.observer });
instance = extender.extendFieldObserver({ 'instance': instance, 'field': 'OutputObject', 'observer': options.observer });
if (options.observer !== null && options.observer !== undefined) {
if (typeof (options.observer) === "string") {
//select and initializes observer.
if (options.observer === "kn") {
instance.Observer = new ObjectKNObserver(options);
}
} else {
//if observer is provided it is selected.
instance.Observer = options.observer;
}
} else {
//if observer is not provided a default observer is initialized and selected.
instance.Observer = new ObjectKNObserver(options);
}
if (options.instance === null || options.instance === undefined) {
instance = extender.extendNewInstance({ 'instance': instance, 'newparameter': instance.Observer, 'options': options});
}
instance = extender.extendContentObserver({'instance': instance,
'observer': instance.Observer
});
instance = extender.extendObserverInterface({'instance': instance,
'observer': instance.Observer
});
//extend from activity observer
instance = ActivityObserver({'instance': instance, 'observer': instance.Observer});
/// <summary>Gets the type of the function construct.</summary>
instance.getType = function () {
return "ObjectObserver";
};
/// <summary>Sets form observer object with optional original key.</summary>
instance.setFormObject = function (data) {
instance.getObserver().setFormObject(data);
};
/// <summary>Gets form object.</summary>
instance.getFormObject = function () {
return instance.getObserver().getFormObject();
};
/// <summary>Gets observable form object.</summary>
instance.getObservableFormObject = function () {
return instance.getObserver().getObservableFormObject();
};
/// <summary>Gets form's stringified JSON object.</summary>
instance.getFormStringifiedObject = function () {
return instance.getObserver().getFormStringifiedObject();
};
/// <summary>Gets form's JSON object.</summary>
instance.getFormJSONObject = function () {
return instance.getObserver().getFormJSONObject();
};
/// <summary>Validate form object.</summary>
instance.validateFormObject = function () {
return instance.getObserver().validateFormObject();
};
/// <summary>Resets form object and view mode.</summary>
instance.resetForm = function () {
instance.getObserver().resetForm();
};
if (options.instance !== null && options.instance !== undefined) {
return Object.create(instance);
}
return instance;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function Observer() {}",
"function Observer() {\n this.update = function () {\n // /* ... */\n };\n}",
"function Observer(){\n this.update = function(){\n // ...\n };\n}",
"function ObserverSet(hostObject) {\n\t\tvar _observers = {};\n\t\t/** .add registers a *property name*, to notify an *observer*, via a *callback*.\n\t\t\t\n\t\t\tExample: \n\t\t\tModelObject.observers.add(\"name\", DOMNode, function(object, newVal, propName) {\n\t\t\t\tthis.textContenxt = \"Name is now: \" + newVal;\n\t\t\t}); \n\t\t*/\n\t\tthis.add = function(property, observer, cb) {\n\t\t\tif (!_observers.hasOwnProperty(property)) {\n\t\t\t\t_observers[property] = [];\n\t\t\t}\n\t\t\tvar alreadyPresent = _observers[property].some(function(registration) {\n\t\t\t\treturn registration.observer === observer;\n\t\t\t});\n\t\t\tif (!alreadyPresent) {\n\t\t\t\t_observers[property].push({\"observer\":observer, \"callback\": cb});\n\t\t\t\tvar currentValue = this[property];\n\t\t\t\tif (typeof currentValue !== 'undefined') {\n\t\t\t\t\tcb.call(observer, this, currentValue, property);\n\t\t\t\t}\n\t\t\t}\n\t\t}.bind(hostObject);\n\t\t/** When removing properties, you may supply undefined as the property name to\n\t\tremove all registrations owned by observer. */\n\t\tthis.remove = function(property, observer) {\n\t\t\tif (typeof property === 'undefined') {\n\t\t\t\t// console.log(\"Removing all properties for observer\", observer);\n\t\t\t\tvar properties = Object.getOwnPropertyNames(_observers);\n\t\t\t\tvar propertiesLen = properties.length >>> 0;\n\t\t\t\tfor (var i = 0; i < propertiesLen; i++) {\n\t\t\t\t\tvar propName = properties[i];\n\t\t\t\t\t_observers[propName] = _observers[propName].filter( function(registration) {\n\t\t\t\t\t\treturn registration.observer !== observer;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (_observers.hasOwnProperty(property)) {\n\t\t\t\t_observers[property] = _observers[property].filter( function(registration) {\n\t\t\t\t\treturn registration.observer !== observer;\n\t\t\t\t});\n\t\t\t}\n\t\t}.bind(hostObject);\n\t\tthis.notify = function(property, value) {\n\t\t\t// console.log(\"Notifying\", property, value, _observers[property]);\n\t\t\tif (_observers.hasOwnProperty(property)) {\n\t\t\t\tvar registrations = _observers[property];\n\t\t\t\tregistrations.forEach(function(registration) {\n\t\t\t\t\tregistration.callback.call(registration.observer, this, value, property);\n\t\t\t\t}.bind(this));\n\t\t\t}\n\t\t}.bind(hostObject);\n\t\treturn this;\n\t}",
"function observe(obj, callback) {\n var patches = [];\n var observer;\n var mirror = getMirror(obj);\n if (!mirror) {\n mirror = new Mirror(obj);\n beforeDict.set(obj, mirror);\n }\n else {\n var observerInfo = getObserverFromMirror(mirror, callback);\n observer = observerInfo && observerInfo.observer;\n }\n if (observer) {\n return observer;\n }\n observer = {};\n mirror.value = Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"_deepClone\"])(obj);\n if (callback) {\n observer.callback = callback;\n observer.next = null;\n var dirtyCheck = function () {\n generate(observer);\n };\n var fastCheck = function () {\n clearTimeout(observer.next);\n observer.next = setTimeout(dirtyCheck);\n };\n if (typeof window !== 'undefined') { //not Node\n window.addEventListener('mouseup', fastCheck);\n window.addEventListener('keyup', fastCheck);\n window.addEventListener('mousedown', fastCheck);\n window.addEventListener('keydown', fastCheck);\n window.addEventListener('change', fastCheck);\n }\n }\n observer.patches = patches;\n observer.object = obj;\n observer.unobserve = function () {\n generate(observer);\n clearTimeout(observer.next);\n removeObserverFromMirror(mirror, observer);\n if (typeof window !== 'undefined') {\n window.removeEventListener('mouseup', fastCheck);\n window.removeEventListener('keyup', fastCheck);\n window.removeEventListener('mousedown', fastCheck);\n window.removeEventListener('keydown', fastCheck);\n window.removeEventListener('change', fastCheck);\n }\n };\n mirror.observers.set(callback, new ObserverInfo(callback, observer));\n return observer;\n}",
"function observe(obj, callback) {\n var patches = [];\n var observer;\n var mirror = getMirror(obj);\n if (!mirror) {\n mirror = new Mirror(obj);\n beforeDict.set(obj, mirror);\n }\n else {\n var observerInfo = getObserverFromMirror(mirror, callback);\n observer = observerInfo && observerInfo.observer;\n }\n if (observer) {\n return observer;\n }\n observer = {};\n mirror.value = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(obj);\n if (callback) {\n observer.callback = callback;\n observer.next = null;\n var dirtyCheck = function () {\n generate(observer);\n };\n var fastCheck = function () {\n clearTimeout(observer.next);\n observer.next = setTimeout(dirtyCheck);\n };\n if (typeof window !== 'undefined') { //not Node\n window.addEventListener('mouseup', fastCheck);\n window.addEventListener('keyup', fastCheck);\n window.addEventListener('mousedown', fastCheck);\n window.addEventListener('keydown', fastCheck);\n window.addEventListener('change', fastCheck);\n }\n }\n observer.patches = patches;\n observer.object = obj;\n observer.unobserve = function () {\n generate(observer);\n clearTimeout(observer.next);\n removeObserverFromMirror(mirror, observer);\n if (typeof window !== 'undefined') {\n window.removeEventListener('mouseup', fastCheck);\n window.removeEventListener('keyup', fastCheck);\n window.removeEventListener('mousedown', fastCheck);\n window.removeEventListener('keydown', fastCheck);\n window.removeEventListener('change', fastCheck);\n }\n };\n mirror.observers.set(callback, new ObserverInfo(callback, observer));\n return observer;\n}",
"function _observe(observer, obj) {\n if (Object.observe) {\n Object.observe(obj, observer);\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n var v = obj[key];\n if (v && typeof (v) === \"object\") {\n _observe(observer, v);\n }\n }\n }\n }\n return observer;\n }",
"function observe(obj, callback) {\n\t var patches = [];\n\t var root = obj;\n\t var observer;\n\t var mirror = getMirror(obj);\n\t if (!mirror) {\n\t mirror = new Mirror(obj);\n\t beforeDict.push(mirror);\n\t }\n\t else {\n\t observer = getObserverFromMirror(mirror, callback);\n\t }\n\t if (observer) {\n\t return observer;\n\t }\n\t observer = {};\n\t mirror.value = deepClone(obj);\n\t if (callback) {\n\t observer.callback = callback;\n\t observer.next = null;\n\t var dirtyCheck = function () {\n\t generate(observer);\n\t };\n\t var fastCheck = function () {\n\t clearTimeout(observer.next);\n\t observer.next = setTimeout(dirtyCheck);\n\t };\n\t if (typeof window !== 'undefined') {\n\t if (window.addEventListener) {\n\t window.addEventListener('mouseup', fastCheck);\n\t window.addEventListener('keyup', fastCheck);\n\t window.addEventListener('mousedown', fastCheck);\n\t window.addEventListener('keydown', fastCheck);\n\t window.addEventListener('change', fastCheck);\n\t }\n\t else {\n\t document.documentElement.attachEvent('onmouseup', fastCheck);\n\t document.documentElement.attachEvent('onkeyup', fastCheck);\n\t document.documentElement.attachEvent('onmousedown', fastCheck);\n\t document.documentElement.attachEvent('onkeydown', fastCheck);\n\t document.documentElement.attachEvent('onchange', fastCheck);\n\t }\n\t }\n\t }\n\t observer.patches = patches;\n\t observer.object = obj;\n\t observer.unobserve = function () {\n\t generate(observer);\n\t clearTimeout(observer.next);\n\t removeObserverFromMirror(mirror, observer);\n\t if (typeof window !== 'undefined') {\n\t if (window.removeEventListener) {\n\t window.removeEventListener('mouseup', fastCheck);\n\t window.removeEventListener('keyup', fastCheck);\n\t window.removeEventListener('mousedown', fastCheck);\n\t window.removeEventListener('keydown', fastCheck);\n\t }\n\t else {\n\t document.documentElement.detachEvent('onmouseup', fastCheck);\n\t document.documentElement.detachEvent('onkeyup', fastCheck);\n\t document.documentElement.detachEvent('onmousedown', fastCheck);\n\t document.documentElement.detachEvent('onkeydown', fastCheck);\n\t }\n\t }\n\t };\n\t mirror.observers.push(new ObserverInfo(callback, observer));\n\t return observer;\n\t }",
"function observe(obj, callback) {\n\t var patches = [];\n\t var root = obj;\n\t var observer;\n\t var mirror = getMirror(obj);\n\t if (!mirror) {\n\t mirror = new Mirror(obj);\n\t beforeDict.push(mirror);\n\t }\n\t else {\n\t observer = getObserverFromMirror(mirror, callback);\n\t }\n\t if (observer) {\n\t return observer;\n\t }\n\t observer = {};\n\t mirror.value = deepClone(obj);\n\t if (callback) {\n\t observer.callback = callback;\n\t observer.next = null;\n\t var dirtyCheck = function () {\n\t generate(observer);\n\t };\n\t var fastCheck = function () {\n\t clearTimeout(observer.next);\n\t observer.next = setTimeout(dirtyCheck);\n\t };\n\t if (typeof window !== 'undefined') {\n\t if (window.addEventListener) {\n\t window.addEventListener('mouseup', fastCheck);\n\t window.addEventListener('keyup', fastCheck);\n\t window.addEventListener('mousedown', fastCheck);\n\t window.addEventListener('keydown', fastCheck);\n\t window.addEventListener('change', fastCheck);\n\t }\n\t else {\n\t document.documentElement.attachEvent('onmouseup', fastCheck);\n\t document.documentElement.attachEvent('onkeyup', fastCheck);\n\t document.documentElement.attachEvent('onmousedown', fastCheck);\n\t document.documentElement.attachEvent('onkeydown', fastCheck);\n\t document.documentElement.attachEvent('onchange', fastCheck);\n\t }\n\t }\n\t }\n\t observer.patches = patches;\n\t observer.object = obj;\n\t observer.unobserve = function () {\n\t generate(observer);\n\t clearTimeout(observer.next);\n\t removeObserverFromMirror(mirror, observer);\n\t if (typeof window !== 'undefined') {\n\t if (window.removeEventListener) {\n\t window.removeEventListener('mouseup', fastCheck);\n\t window.removeEventListener('keyup', fastCheck);\n\t window.removeEventListener('mousedown', fastCheck);\n\t window.removeEventListener('keydown', fastCheck);\n\t }\n\t else {\n\t document.documentElement.detachEvent('onmouseup', fastCheck);\n\t document.documentElement.detachEvent('onkeyup', fastCheck);\n\t document.documentElement.detachEvent('onmousedown', fastCheck);\n\t document.documentElement.detachEvent('onkeydown', fastCheck);\n\t }\n\t }\n\t };\n\t mirror.observers.push(new ObserverInfo(callback, observer));\n\t return observer;\n\t }",
"function observe(obj, callback) {\r\n var patches = [];\r\n var root = obj;\r\n var observer;\r\n var mirror = getMirror(obj);\r\n if (!mirror) {\r\n mirror = new Mirror(obj);\r\n beforeDict.push(mirror);\r\n }\r\n else {\r\n observer = getObserverFromMirror(mirror, callback);\r\n }\r\n if (observer) {\r\n return observer;\r\n }\r\n observer = {};\r\n mirror.value = helpers_1._deepClone(obj);\r\n if (callback) {\r\n observer.callback = callback;\r\n observer.next = null;\r\n var dirtyCheck = function () {\r\n generate(observer);\r\n };\r\n var fastCheck = function () {\r\n clearTimeout(observer.next);\r\n observer.next = setTimeout(dirtyCheck);\r\n };\r\n if (typeof window !== 'undefined') {\r\n if (window.addEventListener) {\r\n window.addEventListener('mouseup', fastCheck);\r\n window.addEventListener('keyup', fastCheck);\r\n window.addEventListener('mousedown', fastCheck);\r\n window.addEventListener('keydown', fastCheck);\r\n window.addEventListener('change', fastCheck);\r\n }\r\n else {\r\n document.documentElement.attachEvent('onmouseup', fastCheck);\r\n document.documentElement.attachEvent('onkeyup', fastCheck);\r\n document.documentElement.attachEvent('onmousedown', fastCheck);\r\n document.documentElement.attachEvent('onkeydown', fastCheck);\r\n document.documentElement.attachEvent('onchange', fastCheck);\r\n }\r\n }\r\n }\r\n observer.patches = patches;\r\n observer.object = obj;\r\n observer.unobserve = function () {\r\n generate(observer);\r\n clearTimeout(observer.next);\r\n removeObserverFromMirror(mirror, observer);\r\n if (typeof window !== 'undefined') {\r\n if (window.removeEventListener) {\r\n window.removeEventListener('mouseup', fastCheck);\r\n window.removeEventListener('keyup', fastCheck);\r\n window.removeEventListener('mousedown', fastCheck);\r\n window.removeEventListener('keydown', fastCheck);\r\n }\r\n else {\r\n document.documentElement.detachEvent('onmouseup', fastCheck);\r\n document.documentElement.detachEvent('onkeyup', fastCheck);\r\n document.documentElement.detachEvent('onmousedown', fastCheck);\r\n document.documentElement.detachEvent('onkeydown', fastCheck);\r\n }\r\n }\r\n };\r\n mirror.observers.push(new ObserverInfo(callback, observer));\r\n return observer;\r\n}",
"function Observable() {\n\t/**\n\t * Lista di osservatori che richiedono di essere notificati ad un cambiamento di stato.\n\t * @type {Array.<Observer>}\n\t * @private\n\t */\n\tthis.observers = [];\n\n}",
"function observe(obj, callback) {\n var patches = [];\n var root = obj;\n var observer;\n var mirror = getMirror(obj);\n if (!mirror) {\n mirror = new Mirror(obj);\n beforeDict.push(mirror);\n }\n else {\n observer = getObserverFromMirror(mirror, callback);\n }\n if (observer) {\n return observer;\n }\n observer = {};\n mirror.value = deepClone(obj);\n if (callback) {\n observer.callback = callback;\n observer.next = null;\n var dirtyCheck = function () {\n generate(observer);\n };\n var fastCheck = function () {\n clearTimeout(observer.next);\n observer.next = setTimeout(dirtyCheck);\n };\n if (typeof window !== 'undefined') {\n if (window.addEventListener) {\n window.addEventListener('mouseup', fastCheck);\n window.addEventListener('keyup', fastCheck);\n window.addEventListener('mousedown', fastCheck);\n window.addEventListener('keydown', fastCheck);\n window.addEventListener('change', fastCheck);\n }\n else {\n document.documentElement.attachEvent('onmouseup', fastCheck);\n document.documentElement.attachEvent('onkeyup', fastCheck);\n document.documentElement.attachEvent('onmousedown', fastCheck);\n document.documentElement.attachEvent('onkeydown', fastCheck);\n document.documentElement.attachEvent('onchange', fastCheck);\n }\n }\n }\n observer.patches = patches;\n observer.object = obj;\n observer.unobserve = function () {\n generate(observer);\n clearTimeout(observer.next);\n removeObserverFromMirror(mirror, observer);\n if (typeof window !== 'undefined') {\n if (window.removeEventListener) {\n window.removeEventListener('mouseup', fastCheck);\n window.removeEventListener('keyup', fastCheck);\n window.removeEventListener('mousedown', fastCheck);\n window.removeEventListener('keydown', fastCheck);\n }\n else {\n document.documentElement.detachEvent('onmouseup', fastCheck);\n document.documentElement.detachEvent('onkeyup', fastCheck);\n document.documentElement.detachEvent('onmousedown', fastCheck);\n document.documentElement.detachEvent('onkeydown', fastCheck);\n }\n }\n };\n mirror.observers.push(new ObserverInfo(callback, observer));\n return observer;\n }",
"function EventObserver() {\n this.observers = [];\n}",
"function Observer() {\n if (this === undefined) {\n return new Observer();\n }\n this.observers = [];\n}",
"function Observer(value) {\n\t\t this.value = value;\n\t\t this.dep = new Dep();\n\t\t this.vmCount = 0;\n\t\t def(value, '__ob__', this);\n\t\t if (Array.isArray(value)) {\n\t\t var augment = hasProto ? protoAugment : copyAugment;\n\t\t augment(value, arrayMethods, arrayKeys);\n\t\t this.observeArray(value);\n\t\t } else {\n\t\t this.walk(value);\n\t\t }\n\t\t }",
"function TestObserver() {\n\n\tthis.isUpdated = false;\n\n\tthis.isInstanceOf = this.isInstanceOf || function(fnc) {return fnc === app.IObserver;};\n\n\tthis.update = function() {this.isUpdated = true;};\n}",
"constructor(observer) {\n this.observer = observer;\n }",
"function observe(obj) {\n // 判断类型\n if (!obj || typeof obj !== 'object') {\n return\n }\n\n Object.keys(obj).forEach(key => {\n defineReactive(obj, key, obj[key])\n })\n}",
"processEvent(obj,changes) {\n var id = new ID(Object.keys(obj)[0],Object.values(obj)[0]);\n this.log(\"processing changes on \"+id);\n if ( this.scene.has(id.toString())) {\n var object = this.scene.get(id.toString());\n Object.assign(object,changes);\n // TODO: route event to mesh/script\n // TODO: notify listeners\n object.notifyListeners(changes);\n } else {\n this.log(\"Unknown object \"+id);\n }\n }",
"function Observer(value) {\n this.value = value;\n this.dep = new Dep();\n this.vmCount = 0;\n def(value, '__ob__', this);\n if (Array.isArray(value)) {\n var augment = hasProto ? protoAugment : copyAugment;\n augment(value, arrayMethods, arrayKeys);\n this.observeArray(value);\n } else {\n this.walk(value);\n }\n }",
"function getObservedObject(observer, object, arrayObserve) {\n var dir = observedObjectCache.pop() || newObservedObject();\n dir.open(observer);\n dir.observe(object, arrayObserve);\n return dir;\n }",
"function observer(value) {\n let ob = null;\n if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {\n ob = value.__ob__;\n } else if (Array.isArray(value) || isObject(value)) {\n ob = new Observer(value);\n }\n return ob;\n }",
"addObserver(observer){\n\n if(observer instanceof Observer){\n\n this.observers.push(observer);\n }\n }",
"function observe(value) {\n\t\t if (!isObject(value)) {\n\t\t return;\n\t\t }\n\t\t var ob = void 0;\n\t\t if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {\n\t\t ob = value.__ob__;\n\t\t } else if (observerState.shouldConvert && !config._isServer && (Array.isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue) {\n\t\t ob = new Observer(value);\n\t\t }\n\t\t return ob;\n\t\t}",
"function AbstractObserver() {\n\t this.isStopped = false;\n\t __super__.call(this);\n\t }",
"function AbstractObserver() {\n\t this.isStopped = false;\n\t __super__.call(this);\n\t }",
"function AbstractObserver() {\n\t this.isStopped = false;\n\t __super__.call(this);\n\t }",
"function observe (value) {\n\t if (!isObject(value)) {\n\t return\n\t }\n\t var ob\n\t if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {\n\t ob = value.__ob__\n\t } else if (\n\t observerState.shouldConvert &&\n\t !config._isServer &&\n\t (Array.isArray(value) || isPlainObject(value)) &&\n\t Object.isExtensible(value) &&\n\t !value._isVue\n\t ) {\n\t ob = new Observer(value)\n\t }\n\t return ob\n\t}",
"function cam_eventObjectTransfer(obj, from)\n{\n\tif (from === CAM_HUMAN_PLAYER && obj.player === NEXUS && __camNexusActivated === true)\n\t{\n\t\tvar snd;\n\t\tif (obj.type === STRUCTURE)\n\t\t{\n\t\t\tif (obj.stattype === DEFENSE)\n\t\t\t{\n\t\t\t\tsnd = DEFENSE_ABSORBED;\n\t\t\t}\n\t\t\telse if (obj.stattype === RESEARCH_LAB)\n\t\t\t{\n\t\t\t\tsnd = RES_ABSORBED;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsnd = STRUCTURE_ABSORBED;\n\t\t\t}\n\n\t\t\tif (obj.stattype === FACTORY ||\n\t\t\t\tobj.stattype === CYBORG_FACTORY ||\n\t\t\t\tobj.stattype === VTOL_FACTORY)\n\t\t\t{\n\t\t\t\t//TODO: add to the factory list.\n\t\t\t}\n\t\t}\n\t\telse if (obj.type === DROID)\n\t\t{\n\t\t\tsnd = UNIT_ABSORBED;\n\t\t}\n\n\t\tif (camDef(snd))\n\t\t{\n\t\t\tplaySound(snd);\n\t\t}\n\t\tqueue(\"camNexusLaugh\", camSecondsToMilliseconds(1.5));\n\t}\n}",
"function observe (value) {\n\t if (!isObject(value)) {\n\t return\n\t }\n\t var ob;\n\t if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {\n\t ob = value.__ob__;\n\t } else if (\n\t observerState.shouldConvert &&\n\t !config._isServer &&\n\t (Array.isArray(value) || isPlainObject(value)) &&\n\t Object.isExtensible(value) &&\n\t !value._isVue\n\t ) {\n\t ob = new Observer(value);\n\t }\n\t return ob\n\t}"
] |
[
"0.6643939",
"0.6363023",
"0.635718",
"0.62948453",
"0.6239872",
"0.62268287",
"0.61886686",
"0.6037796",
"0.6037796",
"0.6008519",
"0.5995865",
"0.5980973",
"0.5956034",
"0.5950164",
"0.58681566",
"0.5849587",
"0.5827112",
"0.58248043",
"0.5750588",
"0.56799453",
"0.56287414",
"0.5622242",
"0.5616009",
"0.55749863",
"0.5523433",
"0.5523433",
"0.5523433",
"0.55180025",
"0.5514862",
"0.551442"
] |
0.73092365
|
0
|
Sets node data when the component mounts.
|
componentDidMount() {
this.setNodeData();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function assignData(node, data) {\n node.__data__ = data;\n}",
"setNodeData() {\n const curNode = this.props.node;\n this.setState({\n ref: curNode.getRef(),\n fetching: true,\n asserts: [],\n invAsserts: [],\n elemClass: '',\n });\n\n API.getElemClass(curNode).then((elemClass) => {\n this.setState({elemClass: elemClass})\n });\n\n curNode.fetchRemoteData().then(() => {\n this.setState({\n asserts: curNode.assertions,\n invAsserts: curNode.invAssertions,\n fetching: false,\n });\n });\n }",
"function setNodes(data){\n payload = data;\n\n if(kontx.args.deep === true){\n async.eachSeries(data, loadChild, sendNext);\n }\n else {\n sendNext();\n }\n }",
"componentDidMount() {\n const {width, height } = this.props;\n\n d3.forceSimulation(data.nodes)\n .force(\"links\", d3.forceLink(data.links).distance(50))\n .force(\"charge\", d3.forceManyBody().strength(-120))\n .force('center', d3.forceCenter(width / 2, height / 2));\n\n const svg = d3.select(this.refs.mountPoint)\n .append(\"svg\")\n .attr(\"width\", width)\n .attr(\"height\", height);\n\n const link = svg.selectAll('line')\n .data(data.links)\n .enter()\n .append('line')\n .style('stroke-width', 3.5)\n .style('stroke', '#030100')\n .style('stroke-opacity', 0.6);\n\n const node = svg.selectAll(\"circle\")\n .data(data.nodes)\n .enter()\n .append(\"circle\")\n .attr(\"r\", 10)\n .style('stroke', '#FFFFFF')\n .style('stroke-width', 3.5)\n .style(\"fill\", function(d){ return d.color});\n /* .style(\"fill\",function() {\n return \"hsl(\" + Math.random() * 360 + \",100%,50%)\";\n });*/\n\n node.append(\"text\")\n .attr(\"x\", function(d) { return d.x-30; })\n .attr(\"y\", function(d) { return d.y; })\n .text(function (d) { return d.text; });\n\n\n d3.forceSimulation().on('tick', () => {\n link\n .attr(\"x1\", function(d) {\n return d.source.x;\n })\n .attr(\"y1\", function(d) {\n return d.source.y;\n })\n .attr(\"x2\", function(d) {\n return d.target.x;\n })\n .attr(\"y2\", function(d) {\n return d.target.y;\n });\n\n node\n .attr(\"cx\", function(d) {\n return d.x;\n })\n .attr(\"cy\", function(d) {\n return d.y;\n })\n });\n\n console.log(data.nodes);\n console.log(data.links);\n }",
"componentDidMount() {\n this.setData();\n }",
"componentWillMount() {\n console.log('before initData call');\n this.initData(); \n\t}",
"init(node) {\n const properties = node.props;\n const eid = properties.id;\n const data_node = {\n eid,\n type: node.type,\n name: properties.name,\n children: reduce(properties.children, (acc, child) => { if (is.not.string(child)) {\n acc.push(child.props.id);\n } return acc; }, []),\n };\n this.bitmasks[eid] = BitSet.create();\n this.views[eid] = Reflect.getMetadata('link:structure-view', node); // link view hacky\n this.add('node', eid, data_node);\n this.add('transform', eid);\n each(properties, (data, name_cell) => {\n name_cell = startsWith(name_cell, 'c-') ? rightOf(name_cell, 'c-') : '';\n if (!name_cell) {\n return;\n } // continue\n this.add(name_cell, eid, data);\n });\n each(properties.children, (child) => {\n if (is.string(child)) {\n return;\n }\n this.init(child);\n });\n return this;\n }",
"function precacheNode(inst, node) {\n\t\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t\t hostInst._hostNode = node;\n\t\t node[internalInstanceKey] = hostInst;\n\t\t}",
"function precacheNode(inst, node) {\n\t\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t\t hostInst._hostNode = node;\n\t\t node[internalInstanceKey] = hostInst;\n\t\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}",
"function precacheNode(inst, node) {\n\t var hostInst = getRenderedHostOrTextFromComponent(inst);\n\t hostInst._hostNode = node;\n\t node[internalInstanceKey] = hostInst;\n\t}"
] |
[
"0.6853854",
"0.6525394",
"0.6380003",
"0.58837354",
"0.5823948",
"0.58108044",
"0.5785606",
"0.5751807",
"0.5751807",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555",
"0.57361555"
] |
0.7599304
|
0
|
Use Yarn if available, it's much faster than the npm client. Return the version of yarn installed on the system, null if yarn is not available.
|
function getYarnVersionIfAvailable() {
let yarnVersion;
try {
// execSync returns a Buffer -> convert to string
yarnVersion = (
execSync('yarn --version', {
stdio: [0, 'pipe', 'ignore'],
}).toString() || ''
).trim();
} catch (error) {
return null;
}
return yarnVersion;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function getUpdateCommand() {\n if (YARN_INSTALL_METHOD === 'tar') {\n return 'curl -o- -L https://yarnpkg.com/install.sh | bash';\n }\n\n if (YARN_INSTALL_METHOD === 'homebrew') {\n return 'brew upgrade yarn';\n }\n\n if (YARN_INSTALL_METHOD === 'deb') {\n return 'sudo apt-get update && sudo apt-get install yarn';\n }\n\n if (YARN_INSTALL_METHOD === 'rpm') {\n return 'sudo yum install yarn';\n }\n\n if (YARN_INSTALL_METHOD === 'npm') {\n return 'npm upgrade --global yarn';\n }\n\n if (YARN_INSTALL_METHOD === 'chocolatey') {\n return 'choco upgrade yarn';\n }\n\n return null;\n}",
"async function yarn() {\n console.log( taskHeader(\n '1/5',\n 'Dependencies',\n 'Install',\n 'Yarn'\n ) );\n\n try {\n const { stdout, stderr } = await execa.commandSync( 'yarn install --non-interactive' );\n console.log( stdout );\n console.log( stderr );\n } catch( error ) {\n console.error( error.stdout );\n }\n}",
"function getYarnBinPath() {\n if (isWebpackBundle) {\n return __filename;\n } else {\n return path.join(__dirname, '..', 'bin', 'yarn.js');\n }\n}",
"function preferredCliVersion() {\n const pjLocation = findUp('package.json', __dirname);\n if (!pjLocation) {\n return undefined;\n }\n const pj = JSON.parse(fs.readFileSync(pjLocation, { encoding: 'utf-8' }));\n return pj.preferredCdkCliVersion ? `${pj.preferredCdkCliVersion}` : undefined;\n}",
"function installPackages() {\n\tconst command = `${path.normalize(ENV_YARN)} ${YARN_INSTALL_COMMAND}`;\n\tconsole.log('\\nInstalling Packages');\n\n\tverbose(`Executing: ${command}`);\n\tverbose(`Using Node Version: ${execSync(`${path.normalize(ENV_NODE)} -v`)}`);\n\texecSync(command, {\n\t\tstdio: [0, 1, 2]\n\t});\n\n\treturn symlinkNodeBinary();\n}",
"install() {\n const hasYarn = commandExists('yarn');\n\n this.installDependencies({\n npm: !hasYarn, // Use npm as fallback, if yarn is not installed\n bower: false, // Do not use bower\n yarn: hasYarn,\n skipMessage: this.options['skip-install-msg'],\n skipInstall: this.options['skip-install']\n });\n }",
"function resolveGlobalYarnPath(tracer) {\r\n let yarnCommand = 'yarn';\r\n let options = {\r\n encoding: 'utf8'\r\n };\r\n if (isWindows()) {\r\n yarnCommand = 'yarn.cmd';\r\n options.shell = true;\r\n }\r\n let handler = () => { };\r\n try {\r\n process.on('SIGPIPE', handler);\r\n let results = child_process_1.spawnSync(yarnCommand, ['global', 'dir', '--json'], options);\r\n let stdout = results.stdout;\r\n if (!stdout) {\r\n if (tracer) {\r\n tracer(`'yarn global dir' didn't return a value.`);\r\n if (results.stderr) {\r\n tracer(results.stderr);\r\n }\r\n }\r\n return undefined;\r\n }\r\n let lines = stdout.trim().split(/\\r?\\n/);\r\n for (let line of lines) {\r\n try {\r\n let yarn = JSON.parse(line);\r\n if (yarn.type === 'log') {\r\n return path.join(yarn.data, 'node_modules');\r\n }\r\n }\r\n catch (e) {\r\n // Do nothing. Ignore the line\r\n }\r\n }\r\n return undefined;\r\n }\r\n catch (err) {\r\n return undefined;\r\n }\r\n finally {\r\n process.removeListener('SIGPIPE', handler);\r\n }\r\n}",
"function resolveGlobalYarnPath(tracer) {\r\n let yarnCommand = 'yarn';\r\n let options = {\r\n encoding: 'utf8'\r\n };\r\n if (isWindows()) {\r\n yarnCommand = 'yarn.cmd';\r\n options.shell = true;\r\n }\r\n let handler = () => { };\r\n try {\r\n process.on('SIGPIPE', handler);\r\n let results = child_process_1.spawnSync(yarnCommand, ['global', 'dir', '--json'], options);\r\n let stdout = results.stdout;\r\n if (!stdout) {\r\n if (tracer) {\r\n tracer(`'yarn global dir' didn't return a value.`);\r\n if (results.stderr) {\r\n tracer(results.stderr);\r\n }\r\n }\r\n return undefined;\r\n }\r\n let lines = stdout.trim().split(/\\r?\\n/);\r\n for (let line of lines) {\r\n try {\r\n let yarn = JSON.parse(line);\r\n if (yarn.type === 'log') {\r\n return path.join(yarn.data, 'node_modules');\r\n }\r\n }\r\n catch (e) {\r\n // Do nothing. Ignore the line\r\n }\r\n }\r\n return undefined;\r\n }\r\n catch (err) {\r\n return undefined;\r\n }\r\n finally {\r\n process.removeListener('SIGPIPE', handler);\r\n }\r\n}",
"async function resolvePackage({ scoped, name, version }) {\n const tempVersion = version || 'latest'\n const parsedVersion = semver.valid(tempVersion)\n\n if (parsedVersion) {\n return { scoped, name, version: parsedVersion }\n }\n try {\n // Version info of scoped packages cannot be\n // fetched directly, hence we must fetch data\n // for all versions, which is expensive :(\n // @see https://github.com/npm/registry/issues/34\n if (scoped) {\n const [scopePart, namePart] = name.split('/')\n const response = await fetch(`https://registry.yarnpkg.com/${scopePart}${encodeURIComponent('/')}${namePart}`)\n const packageInfo = await response.json()\n\n if (!response.ok || !packageInfo['dist-tags'] || !packageInfo['dist-tags'][tempVersion]) {\n throw new CustomError('PackageNotFoundError', { statusText: response.statusText })\n }\n\n return { scoped, name, version: packageInfo['dist-tags'][tempVersion] }\n\n } else {\n const response = await fetch(`https://registry.yarnpkg.com/${name}/${tempVersion}`)\n\n if (!response.ok) {\n throw new CustomError('PackageNotFoundError', { statusText: response.statusText })\n }\n\n const packageInfo = await response.json()\n return { scoped, name, version: packageInfo.version }\n }\n } catch (err) {\n throw new CustomError('PackageNotFoundError', err)\n }\n}",
"async function getNewVersion() {\n const sharedPackage = core.getInput('shared-package');\n const result = await exec(`npm view ${sharedPackage} version`);\n const newVersion = bumpMinorVersion(result.stdout);\n return newVersion;\n}",
"function yarnIntegrityCheck() {\n shell.cd(cwd);\n let out = shell.exec('yarn check --integrity').code;\n return out ? false : true;\n}",
"function which_node_gyp() {\n var node_gyp_bin;\n if (process.env.npm_config_node_gyp) {\n try {\n node_gyp_bin = process.env.npm_config_node_gyp;\n if (existsSync(node_gyp_bin)) {\n return node_gyp_bin;\n }\n } catch (err) {}\n }\n try {\n var node_gyp_main = /*require.resolve*/(!(function webpackMissingModule() { var e = new Error(\"Cannot find module \\\"node-gyp\\\"\"); e.code = 'MODULE_NOT_FOUND'; throw e; }()));\n node_gyp_bin = path.join(path.dirname(path.dirname(node_gyp_main)), 'bin/node-gyp.js');\n if (existsSync(node_gyp_bin)) {\n return node_gyp_bin;\n }\n } catch (err) {}\n if (process.execPath.indexOf('iojs') === -1) {\n try {\n var npm_main = /*require.resolve*/(!(function webpackMissingModule() { var e = new Error(\"Cannot find module \\\"npm\\\"\"); e.code = 'MODULE_NOT_FOUND'; throw e; }()));\n node_gyp_bin = path.join(path.dirname(path.dirname(npm_main)), 'node_modules/node-gyp/bin/node-gyp.js');\n if (existsSync(node_gyp_bin)) {\n return node_gyp_bin;\n }\n } catch (err) {}\n }\n var npm_base = path.join(path.dirname(path.dirname(process.execPath)), 'lib/node_modules/npm/');\n node_gyp_bin = path.join(npm_base, 'node_modules/node-gyp/bin/node-gyp.js');\n if (existsSync(node_gyp_bin)) {\n return node_gyp_bin;\n }\n}",
"function getPackageName() {\n let name;\n try {\n name = require(path.join(process.cwd(), \"package.json\")).name;\n // strip NPM scope, if possible\n const nameSplit = name.split(\"/\");\n if (nameSplit.length > 1) {\n name = nameSplit[1];\n }\n } catch (e) {\n console.error(\"[webpack-build-scripts] Couldn't read package name from package.json\", e);\n }\n return name;\n}",
"function yarnGlobalFolder() {\n var userHome = os.homedir();\n if (process.platform === \"linux\" && process.env.USER === \"root\") {\n userHome = resolve(\"/usr/local/share\");\n }\n if (process.platform === \"win32\" && process.env.LOCALAPPDATA) {\n return join(process.env.LOCALAPPDATA, \"Yarn\", \"global\", \"node_modules\");\n }\n return join(userHome, \".yarn-config\", \"global\", \"node_modules\");\n}",
"function installDeps() {\n exec('node --version', function (err, stdout, stderr) {\n const nodeVersion = stdout && parseFloat(stdout.substring(1));\n if (nodeVersion < 5 || err) {\n installDepsCallback(err || 'Unsupported node.js version, make sure you have the latest version installed.');\n } else {\n exec('yarn --version', function (err, stdout, stderr) {\n if (parseFloat(stdout) < 0.15 || err || process.env.USE_YARN === 'false') {\n process.stdout.write('yarn not found, normal npm i');\n process.stdout.write(chalk.yellow('\\nnpm installing...'));\n exec('npm install', addCheckMark.bind(null, installDepsCallback));\n } else {\n process.stdout.write(chalk.yellow('\\nyarn installing...'));\n exec('yarn install', addCheckMark.bind(null, installDepsCallback));\n }\n });\n }\n });\n}",
"async hasYarnLock (\n nativeApplicationName: string,\n platformName: string,\n versionName: string,\n key: string\n ) : Promise<boolean> {\n const version = await this.getVersion(nativeApplicationName, platformName, versionName)\n if (!version) {\n throw new Error(`${versionName} version does not exist for ${nativeApplicationName} ${platformName}`)\n }\n if (version.yarnLocks && version.yarnLocks[key]) {\n return true\n } else {\n return false\n }\n }",
"function getPackageVersion() {\n return JSON.parse(fs.readFileSync('./package.json')).version;\n}",
"static version_lookup() {\n return require('../package.json').version;\n }",
"function getGlobalInstallCommand() {\n if (hasYarn()) {\n const { stdout: yarnGlobalDir } = execa.sync('yarn', ['global', 'dir'])\n if (__dirname.includes(yarnGlobalDir)) {\n return 'yarn global add'\n } \n }\n const { stdout: npmGlobalPrefix } = execa.sync('npm', ['config', 'get', 'prefix'])\n if (__dirname.includes(npmGlobalPrefix)) {\n return 'npm i -g'\n }\n}",
"function getVersion(){\n // skip this commit if there isn't a package.json to get the version\n if (!fs.existsSync('package.json')) {\n return null;\n }\n var pkg = fs.readFileSync('package.json');\n // get the version of the application in that commit\n try {\n return JSON.parse(pkg).version;\n } catch (err) {\n return (/\"version\": \"([\\d.]+)\"/g.exec(pkg))[1];\n }\n}",
"function getVersion() {\n var pkg = JSON.parse(fs.readFileSync('package.json'));\n return pkg.version;\n}",
"function getPackageVersion(command,packageName) {\n\tlet sep;\n\tif (command == \"npm\") {\n\t\tsep = \"@\";\n\t} else if (command == \"bower\") {\n\t\tsep = \"#\";\n\t} else {\n\t\treturn Promise.reject(\"Unsupported package command\");\n\t}\n\n\tif (!packageName) {\n\t\treturn Promise.reject(\"Package name not specified\");\n\t}\n\n\treturn new Promise(function (resolve,reject) {\n\t\tlet npm = child_process.exec(command + \" list \" + packageName);\n\t\tlet output = \"\";\n\t\tlet version = \"\";\n\t\tnpm.stdout.on(\"data\", function (data) {\n\t\t\toutput += data;\n\t\t\tconsole.log(data);\n\t\t});\n\t\tnpm.stderr.on(\"data\", function (data) {\n\t\t\tconsole.log(data);\n\t\t});\n\t\tnpm.on(\"close\", function (code) {\n\t\t\tif (!code) {\n\t\t\t\tlet reText = packageName + sep + \"(\\\\d*\\\\.\\\\d*\\\\.\\\\d*)\";\n\t\t\t\tlet re = new RegExp(reText);\n\t\t\t\tlet m = output.match(re);\n\t\t\t\tif (m) {\n\t\t\t\t\tversion = m[1];\n\t\t\t\t\treturn resolve(version);\n\t\t\t\t}\n\t\t\t}\n\t\t\treject(\"Could not get version\");\n\t\t});\n\t\tnpm.on(\"error\", function (err) {\n\t\t\tconsole.log(err);\n\t\t});\n\t});\n}",
"async function findNpmName(npmClis) {\n if (!npmClis || npmClis.length === 0) {\n // Fallback to npm if no special npm CLI is found.\n return \"npm\";\n }\n\n const [currentCli, ...otherClis] = npmClis;\n\n try {\n await execute(`${currentCli} --version`);\n\n return currentCli;\n } catch (e) {\n return findNpmName(otherClis);\n }\n}",
"getNPMVersion() {\n\t\tlet npmVersion = {};\n\t\tfor (let npm_version of shell.exec('npm version', {silent:true}).replace(/[\\'{}]/g, \"\").split(\",\")) {\n\t\t\tlet entry = npm_version.split(\":\");\n\t\t\tif (entry.length == 2) {\n\t\t\tnpmVersion[entry[0].trim()] = entry[1].trim();\n\t\t\t}\n\t\t}\n\t\treturn npmVersion;\n\t}",
"function getBabel() {\n if (!babel) {\n babel = require('babel-core');\n }\n return babel;\n}",
"ensureCompatibility() {\n if (this.name !== workspace_schema_1.PackageManager.Npm) {\n return;\n }\n try {\n const version = (0, semver_1.valid)(this.version);\n if (!version) {\n return;\n }\n if ((0, semver_1.satisfies)(version, '>=7 <7.5.6')) {\n // eslint-disable-next-line no-console\n console.warn(`npm version ${version} detected.` +\n ' When using npm 7 with the Angular CLI, npm version 7.5.6 or higher is recommended.');\n }\n }\n catch {\n // npm is not installed.\n }\n }",
"function loadPackageVersionGracefully(packageName) {\n try {\n return require(`${packageName}/package.json`).version;\n }\n catch (_a) {\n return null;\n }\n}",
"function getSystemNodeVers(cb) {\n exec('node -v', function(err, stdout) {\n if (err) {\n return cb(err, null);\n }\n cb(null, stdout.slice(1).replace('\\n',''));\n });\n}",
"function linkNVM () {\n if (process.platform !== \"win32\") { return process.platform; }\n const source = shell.env[\"NVM_SYMLINK\"];\n if (!source) { return \"nvm not exists\"; }\n const target = `${shell.env[\"APPDATA\"]}/npm`;\n const exists = shell.test(\"-L\", target);\n if (exists) { return \"already link before\"; }\n shell.ln(\"-sf\", source, target);\n}",
"function getPackageName(installPackage) {\n if (installPackage.match(/^.+\\.(tgz|tar\\.gz)$/)) {\n return getTemporaryDirectory()\n .then((obj) => {\n let stream;\n if (/^http/.test(installPackage)) {\n stream = hyperquest(installPackage);\n } else {\n stream = fs.createReadStream(installPackage);\n }\n return extractStream(stream, obj.tmpdir).then(() => obj);\n })\n .then((obj) => {\n // eslint-disable-next-line global-require\n const packageName = require(path.join(obj.tmpdir, 'package.json')).name;\n obj.cleanup();\n return packageName;\n })\n .catch((err) => {\n // The package name could be with or without semver version, e.g. react-scripts-0.2.0-alpha.1.tgz\n // However, this function returns package name only without semver version.\n console.log(\n `Could not extract the package name from the archive: ${err.message}`\n );\n const assumedProjectName = installPackage.match(\n /^.+\\/(.+?)(?:-\\d+.+)?\\.(tgz|tar\\.gz)$/\n )[1];\n console.log(\n `Based on the filename, assuming it is \"${chalk.cyan(\n assumedProjectName\n )}\"`\n );\n return Promise.resolve(assumedProjectName);\n });\n // eslint-disable-next-line no-else-return\n } else if (installPackage.indexOf('git+') === 0) {\n // Pull package name out of git urls e.g:\n // git+https://github.com/mycompany/react-scripts.git\n // git+ssh://github.com/mycompany/react-scripts.git#v1.2.3\n return Promise.resolve(installPackage.match(/([^/]+)\\.git(#.*)?$/)[1]);\n } else if (installPackage.match(/.+@/)) {\n // Do not match @scope/ when stripping off @version or @tag\n return Promise.resolve(\n installPackage.charAt(0) + installPackage.substr(1).split('@')[0]\n );\n } else if (installPackage.match(/^file:/)) {\n const installPackagePath = installPackage.match(/^file:(.*)?$/)[1];\n // eslint-disable-next-line global-require\n const installPackageJson = require(path.join(\n installPackagePath,\n 'package.json'\n ));\n return Promise.resolve(installPackageJson.name);\n }\n return Promise.resolve(installPackage);\n}"
] |
[
"0.6483819",
"0.626947",
"0.5778673",
"0.5402558",
"0.53739995",
"0.53731817",
"0.5348117",
"0.5348117",
"0.5253786",
"0.51260597",
"0.5035994",
"0.49301445",
"0.48574874",
"0.48516303",
"0.48436052",
"0.48392144",
"0.48259783",
"0.47912624",
"0.4769956",
"0.47394714",
"0.4628358",
"0.46187118",
"0.45899862",
"0.4586422",
"0.45794937",
"0.45756552",
"0.4568088",
"0.45339468",
"0.45286795",
"0.45163763"
] |
0.86356133
|
0
|
When a movie is clicked, this function is invoked and updates the state of the `selectedMovie` property to that movie
|
onMovieClick(movie) {
this.setState({
selectedMovie: movie,
});
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"setSelectedMovie(movie) {\n this.setState({\n selectedMovie: movie\n });\n }",
"selectedMovie(movie) {\n // Display selected movie\n this.displaySingleMovie(movie)\n }",
"selectMovie(id) {\n this.movieById(movie => {\n this.selectedMovie(movie)\n }, id)\n }",
"function loadSelectedMovie(pos) {\n loadMovieDescription(pos);\n if(useTrailers) loadTrailer(pos);\n postEvent('Selected movie', movies[pos]._id);\n updateHoveredMovies(movies[pos]._id);\n}",
"function displaySelectedMovie(movieData) {\n movieSelectorContainer.style.display = \"none\";\n movieSelectedScreen.style.display = \"block\";\n\n var posterUrl = \"https://image.tmdb.org/t/p/w500\" + movieData.poster_path;\n\n var filmTitle = document.getElementById(\"film-title\");\n filmTitle.textContent = movieData.original_title;\n var posterImage = document.getElementById(\"poster\");\n posterImage.setAttribute(\"src\", posterUrl);\n var ageCertificate = document.getElementById(\"age\");\n ageCertificate.textContent = movieData.adult;\n ageCertificate.style.color = \"orange\";\n var countryLanguage = document.getElementById(\"country\");\n countryLanguage.textContent = movieData.original_language;\n countryLanguage.style.color = \"orange\";\n var yearReleased = document.getElementById(\"year-released\");\n yearReleased.textContent = movieData.release_date;\n yearReleased.style.color = \"orange\";\n var filmSynopsis = document.getElementById(\"synopsis\");\n filmSynopsis.textContent = movieData.overview;\n filmSynopsis.classList.add(\"filmSynopsis\");\n document\n .getElementById(\"back-btn\")\n .addEventListener(\"click\", function goBack() {\n window.history.back();\n });\n document.getElementById(\"save-btn\").addEventListener(\"click\", function (e) {\n e.preventDefault();\n saveFilmHistory(movieData.id);\n });\n}",
"function selectSeat(e) {\n //find the selected movie\n if (e.target.className === \"seat\") {\n e.target.classList.add(\"selected\")\n addUI()\n } else if (e.target.className === \"seat selected\") {\n e.target.classList.remove(\"selected\")\n removeUI()\n }\n}",
"getChosenMovie () {\n\t\t\t\treturn chosenMovie;\n\t\t\t}",
"function getSelectedMovie(id, movieArr){\n\tvar selectedMovie;\n\tfor(var x=0; x<movieArr.length; x++){\n\t\tif(movieArr[x].id == id){\n\t\t\tselectedMovie=movieArr[x];\n\t\t}\n\t}\n\treturn selectedMovie;\n}",
"async function handleClick(imdbID) {\n console.log(\"user clicked on : \" + imdbID)\n //call the api and set the data in 'selectedMovieDetail' state\n try {\n var url =\n ApiDetails.BASEURL +\n ApiDetails.APIKEY +\n ApiDetails.PARAMETER_SEPERATOR +\n ApiDetails.BY_ID.replace(\"<ID_TO_SEARCH>\", imdbID)\n console.log(url)\n const response = await Axios.get(url)\n //console.log(response.data)\n setSelectedMovieDetail(response.data)\n } catch (err) {\n setSelectedMovieDetail({})\n console.log(\"Error occurred! \" + err)\n }\n //open the dialog\n setDialogOpen(true)\n }",
"changeMovieWatched(movieClicked){\n // change movie.watched property:\n movieClicked.watched = !movieClicked.watched;\n\n // update state.movies with the updated movie:\n this.setState((state) => {\n return {\n movies: state.movies\n .filter(\n movie => movie.title !== movieClicked.title\n )\n .concat(movieClicked)\n }\n })\n \n }",
"onOptionSelection(movie) {\n document.querySelector(\".tutorial\").classList.add(\"is-hidden\");\n onMovieSelection(movie, document.querySelector(\"#left-summary\"), \"left\");\n }",
"function movieSelected(id) {\n sessionStorage.setItem('movieId', id);\n window.location = './movie.html';\n return false;\n}",
"function movieVariable() {\n\n $(\".movie-selected\").on('click', function() {\n var movie_id = $(this).attr(\"data\");\n localStorage.setItem('selected_movie', movie_id);\n });\n }",
"onOptionSelection(movie) {\n document.querySelector(\".tutorial\").classList.add(\"is-hidden\");\n onMovieSelection(movie, document.querySelector(\"#right-summary\"), \"right\");\n }",
"function getMovieData(e) {\n // Retrieve local storage - Movies\n var getMovieData = JSON.parse(localStorage.getItem(\"film\"));\n var movieId = e.target.getAttribute(\"data-id\");\n var selected = getMovieData.filter((film) => film.id === parseInt(movieId));\n\n if (selected.length > 0) {\n selected = selected[0];\n }\n hideMovie.classList.remove(\"hidden\");\n movieTitle.textContent = selected.original_title;\n overviewDiv.textContent = selected.overview;\n\n var movieposter = \"https://image.tmdb.org/t/p/w500/\" + selected.poster_path;\n MovieImage.src = movieposter;\n}",
"function displayMovie(event){\n let target = event.target || event.srcElement;\n\n // Retrieves title if parent element selected\n if(target.className == \"movie\"){\n target = target.getElementsByClassName(\"title\")\n target = target[0];\n }\n\n // sends an API request for the specific movie to be displayed\n searchByTitle(target).then(result => {\n let movies = result[\"Title\"];\n displayMovieResult(result);\n });\n}",
"onSelectActor(item) {\n this.selectedActor = item;\n }",
"function movieSelected(id) {\n sessionStorage.setItem(\"movieId\", id);\n window.location = \"movie.html\";\n return false;\n}",
"handleClick(movie) {\n console.log('CLICKED MOVIE:', movie);\n if (!this.props.favorites.includes(movie.id)) {\n this.props.saveMovie(movie);\n } else {\n this.props.deleteMovie(movie);\n }\n \n }",
"function movieVariable(){\r\n\r\n $(\".movie-selected\").on('click', function(){\r\n var movie_id = $(this).attr(\"data\");\r\n localStorage.setItem('selected_movie', movie_id);\r\n });\r\n}",
"function handleClick(movie){\n console.log(movie)\n localStorage.setItem('movieData',JSON.stringify(movie))\n history.push('/movie')\n }",
"function onClick(e) {\r\n // Pause the animation\r\n story.pauseAnimation();\r\n // If it is already selected resume the animation\r\n // otherwise pause and move to the selected month\r\n if (e.yValue === story.getFrameValue()) {\r\n story.startAnimation();\r\n } else {\r\n story.goToFrame(e.yValue);\r\n story.pauseAnimation();\r\n }\r\n }",
"function tmdbSelectedMovie(id) {\n $.getJSON(\n `${trendingApi.detailsBase}movie/${id}?api_key=${trendingApi.key}&language=en-US` // accesses api data\n ).then(function (detailsResponse) {\n let movieImdb = detailsResponse.imdb_id; // stores particilar data needed within a variable\n selectedMovie(movieImdb); // performs next function, selectedMovie() on search.js page\n });\n}",
"chooseVideo(selected) {\n this.setState({\n selectedVideo: selected\n });\n }",
"function movieSelected(id) {\n sessionStorage.setItem(\"movieID\", id);\n window.location = \"movie_info.html\";\n return false;\n}",
"function onClick(e) {\n // Pause the animation\n story.pauseAnimation();\n // If it is already selected resume the animation\n // otherwise pause and move to the selected month\n if (e.yValue === story.getFrameValue()) {\n story.startAnimation();\n } else {\n story.goToFrame(e.yValue);\n story.pauseAnimation();\n }\n }",
"function select(){\n // function executes when movie is cliked\n\t$(\".result\").click(function(event){\n\t\t\n\t\t// pull movie ID when element is clicked\n\t\tdocument.getElementById(\"choice\").innerHTML = \"<img id='exit' src='/img/exit.gif'/>\";\n\t\t\n\t\t// initiate GET request with omdb api through $.getJSON\n\t\tvar omdb = \"http://www.omdbapi.com/\"\n\t\tvar id = \"i=\" + event.target.id + \"&plot=full\";\t\t\n\t\t$.getJSON(omdb, id, function(data){\n\t\t\tvar info = [\"Title\", \"Year\", \"Runtime\", \"Genre\", \"Director\", \"Actors\", \"imdbRating\", \"Plot\"];\n\t\t\tvar JSON = [data.Title, data.Year, data.Runtime, data.Genre, data.Director, data.Actors, data.imdbRating, data.Plot];\n\t\t\tvar imdbID = data.imdbID;\n\t\t\t\n\t\t\t// instantiate poster\n\t\t\t$(\"#choice\").append(\"<img alt='poster' class='poster' src='\" + data.Poster + \"'/>\");\t\t\t\n\t\t\t\n\t\t\t// loops through JSON data to instantiate movie info\n\t\t\tfor (var i = 0, j = 15; i < info.length; i++, j+=25){\n\t\t\t\t$(\"#choice\").append(\"<div class='info' style='top: \" + j + \"px;'>\" + info[i] + \": \" + JSON[i] + \"</div>\");\n\t\t\t}\n\t\t\t$(\"#choice\").append(\"<button id='select' type='submit'>Add to List</button>\");\t\t\t\n\t\t\t$(\"#choice\").fadeIn();\n\n // sends movie data to php server via AJAX call once \"Add to List\" button is clicked\n\t\t\t$(\"#select\").click(function(){\n\t\t\t $.ajax({\t\t\t \n\t\t\t url: \"search.php\",\n\t\t\t method: \"POST\",\n\t\t\t dataType: \"text\",\n\t\t\t data: \"title=\" + data.Title + \"&year=\" + data.Year + \"&runtime=\" + data.Runtime +\n\t\t\t \"&genre=\" + data.Genre + \"&director=\" + data.Director + \"&actors=\" + data.Actors +\n\t\t\t \"&rating=\" + data.imdbRating + \"&plot=\" + data.Plot + \"&poster=\" + data.Poster + \"&imdbID=\" + imdbID, \n\t\t\t success: function(){\n\t\t\t $(\"#choice\").hide();\n\t\t\t\t $(\"#confirm\").fadeIn();\n\t\t\t\t setTimeout(function(){$(\"#confirm\").fadeOut()}, 1500);\n\t\t\t }\t\t\t \n\t\t\t });\t\t\t \n\t\t\t event.preventDefault();\t\t\t\t\t\t\n\t\t\t});\n\t\t});\t\n\t\t\n\t\t// closes window if exit button is clicked\n\t\t$(\"#exit\").click(function(){\n\t\t\t$(\"#choice\").hide();\n\t\t});\t\t\n\t});\t\n}",
"componentDidMount(){\n for ( let movie of this.props.movies ) {\n if ( movie.id === this.props.selectedMovie ) {\n this.setState({\n ...this.state,\n title: movie.title,\n description: movie.description,\n })\n }\n }\n }",
"function selectedMovie(id) {\n $.when(sessionStorage.setItem(\"movieId\", id)).then(getMovie);\n}",
"function movieSelected(id) {\n sessionStorage.setItem(\"movieId\", id);\n location.replace(\"movie-page.html\");\n return false;\n}"
] |
[
"0.7750631",
"0.7736081",
"0.7163471",
"0.67256916",
"0.6488958",
"0.64247245",
"0.6397385",
"0.63854253",
"0.6332612",
"0.6308762",
"0.63058543",
"0.6278801",
"0.6277684",
"0.62595034",
"0.6229581",
"0.62176365",
"0.6200571",
"0.6186401",
"0.6181037",
"0.61073023",
"0.60980624",
"0.6081581",
"0.6068781",
"0.6053863",
"0.60513",
"0.6042735",
"0.60265803",
"0.6013283",
"0.6012679",
"0.6005203"
] |
0.8339763
|
0
|
Adds a table of size "size" at "xCord","yCord" with id "id" then redraws the map
|
function addTable (xCord, yCord, size, id) {
for (i = 0; i < size; i++) {
for (j = 0; j < size; j++) {
if (yCord + i < dimension && xCord + j < dimension) {
currentMap[yCord + i][xCord + j] = id
}
}
}
draw(currentMap)
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function mapResize(newSize){\r\n\r\n // Get current position\r\n var map_x = unsafeWindow.mapX;\r\n var map_y = unsafeWindow.mapY;\r\n var map_s = unsafeWindow.mapSize;\r\n\r\n // Calculate new X and Y\r\n var delta = parseInt((map_s - newSize) / 2);\r\n\r\n // Overwrite values\r\n map_x += delta;\r\n map_y += delta;\r\n\r\n // InnerHTML\r\n var ihtml = \"\";\r\n ihtml += '<tr>';\r\n ihtml += '<td height=\"38\">' + map_y + '</td>';\r\n ihtml += '<td colspan=\"' + newSize + '\" rowspan=\"' + newSize + '\">';\r\n ihtml += '<div style=\"background-image:url(graphic/map/gras4.png); position:relative; width:' + (53 * newSize) + 'px; height:' + (38 * newSize) +'px; overflow:hidden\" id=\"map\">';\r\n ihtml += '<div id=\"mapOld\" style=\"position:absolute; left:0px; top:0px\">';\r\n ihtml += '<div style=\"color:white; margin:10px\">Lade Karte...</div>';\r\n ihtml += '</div>';\r\n ihtml += '<div id=\"mapNew\" style=\"position:absolute; left:0px; top:0px\"></div>';\r\n ihtml += '</div>';\r\n ihtml += '</td>';\r\n ihtml += '</tr>';\r\n for(jj=1; jj<newSize; jj++){\r\n ihtml += '<tr><td width=\"20\" height=\"38\">' + (map_y + jj) + '</td></tr>';\r\n }\r\n ihtml += '<tr id=\"map_x_axis\">';\r\n ihtml += '<td height=\"20\"></td>';\r\n for(jj=0; jj<newSize; jj++){\r\n ihtml += '<td align=\"center\" width=\"53\">' + (map_x + jj) + '</td>';\r\n }\r\n ihtml += '</tr>';\r\n var tmp = document.getElementById(\"mapCoords\").innerHTML = ihtml;\r\n\r\n // Update data\r\n var url = \"http://\"+(\"\"+location.href).split(\"/\")[2] + \"/\" + unsafeWindow.mapURL + '&start_x=' + map_x + '&start_y=' + map_y + '&size_x=' + newSize + '&size_y=' + newSize;\r\n GM_xmlhttpRequest({\r\n method:\"GET\",\r\n url:url,\r\n onload:function(details){\r\n document.getElementById(\"mapOld\").innerHTML = details.responseText;\r\n }\r\n });\r\n\r\n // mapMoveTopo()\r\n var scrollX = map_x;\r\n var scrollY = map_y;\r\n unsafeWindow.scrollX = scrollX;\r\n unsafeWindow.scrollY = scrollY;\r\n var topoX = parseInt(document.getElementsByName('min_x')[0].value); //minimalstes x auf Karte rechts\r\n var topoY = parseInt(document.getElementsByName('min_y')[0].value); //minimalstes y auf Karte rechts\r\n\r\n var relX = scrollX - topoX;\r\n if(unsafeWindow.globalYDir == 1){\r\n var relY = scrollY - topoY;\r\n }else{\r\n var relY = (45-mapSize) - (scrollY-topoY);\r\n }\r\n \r\n // Rechteck verschieben\r\n document.getElementById('topoRect').style.left = (5*(relX)) + 'px';\r\n document.getElementById('topoRect').style.top = (5*(relY)) + 'px';\r\n document.getElementById('topoRect').style.width = (5*(newSize)) + 'px';\r\n document.getElementById('topoRect').style.height = (5*(newSize)) + 'px';\r\n\t \r\n\t unsafeWindow.ajaxMapInit(parseInt(unsafeWindow.mapX), parseInt(unsafeWindow.mapY), parseInt(newSize) , \"game.php?\"+getUrlParam(\"village\")+\"&screen=map&xml\", 1, 1);\r\n\t \r\n }",
"function MapDisplay() {\n //setup map dims from html form\n let mapHeight = document.getElementById('height').value;\n let mapWidth = document.getElementById('width').value;\n\n var mapArray = FullMap(mapHeight, mapWidth);\n\n const mapTable = document.getElementById(\"mapTable\");\n \n //clears old map, if it exists\n while(mapTable.firstChild) {\n mapTable.removeChild(mapTable.firstChild);\n }\n \n //draw the map out\n for (let i = 0; i < mapArray.length; i++ ) {\n var newRow = mapTable.insertRow(i);\n newRow.setAttribute(\"id\", \"mapRow\");\n\n for (let j = 0; j < mapArray[i].length; j++) {\n var newCell = newRow.insertCell(j);\n if (mapArray[i][j].cellValue == 1) {\n newCell.setAttribute(\"id\", \"mapCellWall\");\n }\n else {\n newCell.setAttribute(\"id\", \"mapCellSpace\");\n }\n }\n }\n}",
"function redrawTable(id){ \n clearTable();\n removeFromList(id);\n povoateTable(); \n setupDeleteListener();\n setfilter();\n}",
"function table(size){\r\n\tvar div=document.getElementById(\"div\"); //select the div to draw grid on it\r\n\tvar createTable=document.createElement(\"table\"); \r\n\tdiv.appendChild(createTable); \r\n\tvar rows=[];\r\n\tvar rowsData=[];\r\n\tfor(var i=0;i<size;i++)\r\n\t{\r\n\t\t rows[i]=$(\"<tr></tr>\");\r\n\t\t createTable.appendChild(rows[i][0]);\r\n\t\t for(var j=0;j<size;j++)\r\n\t\t {\r\n var tdEle=$(\"<td></td>\");\r\n tdEle.css(\"width\",\"35px\");\r\n tdEle.css(\"height\",\"15px\");\r\n rowsData.push(tdEle);\r\n\t\t\t rows[i].append(tdEle); \r\n\t\t } \r\n\t}\r\n createTable.setAttribute(\"border\",\"1\");\r\n\tcreateTable.style.width=\"80%\";\r\n\t$(\"td\").on(\"click\",triggerTile); //set click event on the cells of the grid\r\n\treturn rowsData; //return array of cells\r\n}",
"function drawTable() {\n var stat = getState(cm);\n _replaceSelection(cm, stat.table, insertTexts.table);\n}",
"function redraw() {\n var i, j, str, myEl, x, val;\n for(i = 0; i < size; i++) {\n for(j = 0; j < size; j++) {\n x = 4*i + j;\n str = \"\" + x;\n myEl = document.getElementById(str);\n if(mat[i][j] !== 0) {\n val = \"\" + mat[i][j];\n myEl.innerHTML = val;\n changeTileColor(str, mat[i][j]);\n }\n else {\n val = \"\";\n myEl.innerHTML = val;\n myEl.style.backgroundColor = \"rgb(205, 193, 180)\";\n }\n }\n } \n }",
"function createMap(){\n document.write(\"<table>\");\n\n for (let y = 0; y < height; y++) {\n document.write(\"<tr>\");\n for (let x = 0; x < width; x++) {\n if (x == 0 || x == width -1 || y == 0 || y == height -1) {\n document.write(\"<td class='wall' id= '\" + x + \"-\" + y +\"'></td>\");\n } else {\n document.write(\"<td class='blank' id= '\" + x + \"-\" + y +\"'></td>\");\n }\n }\n document.write(\"</tr>\");\n }\n document.write(\"</table>\");\n\n}",
"function addToShipTable (id){\r\n for(let ship of shipList){\r\n if(ship.id == id){\r\n shipInTable.push(ship);\r\n break;\r\n }\r\n }\r\n\r\n shipTableBuilder();\r\n}",
"renderMap() {\n $('#gameMap').append('<table></table>');\n for (let j = ((this.width - 1) / 2); j >= (-(this.width - 1) / 2); j--) {\n $('table').append('<tr></tr>');\n for (let i = (-(this.height - 1) / 2); i <= ((this.height - 1) / 2); i++) {\n $('tr:last').append('<td data-x=\"' + i + '\" data-y=\"' + j +\n '\" class=\"floorClass\"></td>');\n }\n }\n }",
"function update_board(id){\n\t \tvar t = $('#'+id);\n\t \tfor (var k = parseInt(t.attr('col'))-1; k < parseInt(t.attr('col'))+parseInt(t.attr('sizex'))-1; k++) {\n\t \t\tfor (var j = parseInt(t.attr('row'))-1; j < parseInt(t.attr('row'))+parseInt(t.attr('sizey'))-1; j++) {\n\t \t\t\tboard[k][j].occupied = 1;\n\t \t\t\tboard[k][j].tile = id;\n\t \t\t};\n\t \t};\n\t }",
"function drawBoard(size) {\n var parent = document.getElementById(\"game\");\n var table = document.createElement('table'); // create table\n table.id='board';\n var counter = 1;\n\n for (let i = 0; i < size; i++)\n {\n var row = document.createElement(\"tr\"); // create rows\n\n for(let x = 0; x < size; x++)\n {\n var col = document.createElement(\"td\"); // create columns\n col.innerHTML = \"\";\n col.id = counter; // the counter will go from 1 to 9, giving each cell its own id\n counter += 1;\n row.appendChild(col); // append columns as children of rows\n }\n table.appendChild(row); // append rows as children of table \n } \n parent.appendChild(table); // append table as child of main div\n var btn = document.createElement('button');\n btn.innerHTML = 'Play Again';\n parent.appendChild(btn); // append Play Again button as child of main div\n var sCode = document.createElement('p');\n sCode.innerHTML = '[ <a href=\"https://github.com/mariobox/tic-tac-toe\">Source Code</a> ]';\n parent.appendChild(sCode); // append link to source code as child of main div\n \n}",
"function customTableFromArray(tbl, map) {\r\n var rows = map.length;\r\n var rowCount = 0\r\n var columns = map[0].length;\r\n var cell;\r\n\r\n\r\n for(var r=rows - 1;r>=0;r--) { \r\n var x=document.getElementById(tbl).insertRow(rowCount);\r\n for(var c=0;c<parseInt(columns,10);c++) {\r\n cell = map[r][c];\r\n \r\n var y= x.insertCell(c); \r\n $(y).attr(\"data-row\", (rows - rowCount - 1));\r\n $(y).attr(\"data-col\", c);\r\n $(y).attr(\"data-djsteps\", cell.djSteps);\r\n //$(y).text(cell.djSteps);\r\n\r\n if(cell.onPath) {$(y).attr(\"class\", \"onpath\");}\r\n\r\n //\r\n if(cell.borderTop) {y.style.borderTop = \"1px solid black\";};\r\n if(cell.borderRight) {y.style.borderRight = \"1px solid black\";};\r\n if(cell.borderBottom) {y.style.borderBottom = \"1px solid black\";};\r\n if(cell.borderLeft) {y.style.borderLeft = \"1px solid black\";};\r\n\r\n if(cell.entrance) {\r\n $(y).attr(\"id\", \"entrance\");\r\n }else if(cell.exit) {\r\n $(y).attr(\"id\", \"exit\");\r\n };\r\n \r\n //debugger;\r\n };\r\n rowCount += 1;\r\n };\r\n}",
"function draw_field( id, width, height ) {\n\tif( width * height > 2500 ) {\n\t\tif( ! confirm( \"Resizing to fields larger than 2500 cells can slow down your PC or will freeze your browser. Do you really wan't to proceed?\" ) ) return;\n\t}\n\t\n\t// unset current content\n\twhile( document.getElementById(id).firstChild ) {\n\t\tdocument.getElementById(id).removeChild( document.getElementById(id).firstChild );\n\t}\n\n\t// store width and height in global vars\n\tgame_field_width = width;\n\tgame_field_height = height;\n\n\t// start creating the playing field table\n\tvar table = document.createElement(\"table\");\n\ttable.id = id + \"_panel\";\n\ttable.setAttribute(\"cellpadding\", 0);\n\ttable.setAttribute(\"cellspacing\", 0);\n\n\tvar i = 0;\n\tfor( var y = 0; y < height; y++ ) {\n\t\t// start new table row\n\t\tvar tr = document.createElement(\"tr\");\n\t\t\n\t\tfor( var x = 0; x < width; x++ ) {\n\t\t\ti++;\n\t\t\tvar td = document.createElement(\"td\");\n\t\t\ttd.className = \"fields_game_unchecked\";\n\t\t\ttd.id = id + \"_td_\" + i;\n\t\t\t// td.title = i;\n\n\t\t\tvar img = document.createElement(\"img\");\n\t\t\timg.setAttribute ( \"onclick\", \"javascript: switch_td_state( document.getElementById('\"+ id +\"_td_\"+ i +\"'), true );\" );\n\t\t\timg.src = \"game_of_life.png\";\n\t\t\timg.className = \"fields_game_img\"\n\n\t\t\ttd.appendChild( img );\n\t\t\ttr.appendChild( td );\n\t\t\n\t\t}\n\n\t\ttable.appendChild( tr );\n\n\t}\n\n\tgame_fields = i;\n\n\treturn table;\n}",
"function genMapTable(){\r\n\t\tif (get('tabla_mapa')) removeElement(get('tabla_mapa'));\r\n\r\n\t\tvar table = document.createElement('TABLE');\r\n\r\n\t\ttable.setAttribute(\"id\", \"tabla_mapa\");\r\n\t\ttable.setAttribute(\"sortCol\", -1);\r\n\t\ttable.setAttribute(\"class\", \"tbg\");\r\n\t\ttable.setAttribute(\"align\", \"left\");\r\n\t\ttable.setAttribute(\"cellspacing\", \"1\");\r\n\t\ttable.setAttribute(\"cellpadding\", \"2\");\r\n\t\tvar thead = document.createElement(\"THEAD\");\r\n\t\tvar tbody = document.createElement(\"TBODY\");\r\n\t\tvar fila = document.createElement('TR');\r\n\t\tfila.setAttribute('class', \"rbg\");\r\n\t\tthead.appendChild(fila);\r\n\t\ttable.appendChild(thead);\r\n//\t\tvar etiquetas_tabla = [\"JUGADOR\", \"ALIANZA\", \"ALDEA\", \"HAB\", \"COORD\", \"ACCION\"];\r\n\t\tvar etiquetas_tabla = [\"JUGADOR\", \"ALIANZA\", \"ALDEA\", \"HAB\"];\r\n\t\tfor (var i = 0; i < etiquetas_tabla.length; i++){\r\n\t\t\tvar td = elem('TD', T(etiquetas_tabla[i]));\r\n\t\t\tif (i < 4){\r\n\t\t\t\tswitch(i){\r\n\t\t\t\t\tcase 3: td.addEventListener(\"click\", sortTable('tabla_mapa', i, 'int'), 0); break;\r\n\t\t\t\t\tdefault: td.addEventListener(\"click\", sortTable('tabla_mapa', i), 0);\r\n\t\t\t\t}\r\n\t\t\t\ttd.style.cursor = \"pointer\";\r\n\t\t\t}\r\n\t\t\tfila.appendChild(td);\r\n\t\t}\r\n\t\tvar datos = 0;\r\n\t\tvar area;\r\n\t\tfor(var i = 0; i < 7; i++)\r\n\t\t\tfor(var j = 0; j < 7; j++) {\r\n\t\t\t\tarea = document.getElementById('a_'+i+'_'+j).wrappedJSObject;//.getAttribute('details');//lmc.ad[i][j];\r\n\t\t\t\tvar cellinfo=area.details;\r\n//\t\t\t\tlog(1,'cellinfo i:'+i+' j:'+j+' x: '+cellinfo.x+' y: '+cellinfo.y);\r\n\t\t\t\tif (cellinfo && cellinfo.name !=null ) {\r\n\t\t\t\t\tdatos=1;\r\n\t\t\t\t\tvar inforow = document.createElement('TR');\r\n\t\t\t\t\tvar href=area.href;\r\n\r\n\t\t\t\t\tinforow.appendChild(elem('TD', cellinfo.name));\r\n\t\t\t\t\tinforow.appendChild(elem('TD', cellinfo.ally));\r\n\t\t\t\t\tinforow.appendChild(elem('TD', '<a href=\"' + href + '\">' + cellinfo.dname + '</a>'));\r\n\t\t\t\t\tinforow.appendChild(elem('TD', cellinfo.ew));\r\n\r\n//\t\t\t\t\tinforow.appendChild(elem('TD', '<a href=\"' + href + '\">' + cellinfo.x + \", \" + cellinfo.y + '</a>'));\r\n//\t\t\t\t\tinforow.appendChild(elem('TD', '<a href=\"' + href.replace(\"karte.php?d\", \"a2b.php?z\") + '\">' + T('ATACAR') + '</a> / <a href=\"' + href.replace(\"karte.php?d\", \"build.php?z\") + '&gid=17\">' + T('COMERCIAR') + '</a>'));\r\n\t\t\t\t\ttbody.appendChild(inforow);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\ttable.appendChild(tbody);\r\n\t\tif (datos == 1) {\r\n\r\n\t\t\tif (get('tabla_mapa_div')) {\r\n\t\t\t\tvar divt = get('tabla_mapa_div');\r\n\t\t\t} else {\r\n\t\t\t\tvar divt = document.createElement('DIV');\r\n\t\t\t\tdivt.style.display = 'block';\r\n\t\t\t\tdivt.style.position = 'absolute';\r\n\t\t\t\tdivt.id = 'tabla_mapa_div';\r\n\t\t\t\tdivt.style.top = 610 + longitudPantalla() + 'px';\r\n\t\t\t\tdocument.body.appendChild(divt);\r\n\t\t\t}\r\n\r\n\t\t\tdivt.appendChild(table);\r\n\r\n\t\t\tplayerLinks();\r\n\r\n//\t\t\tvar middleblock = get('lmidall');\r\n//\t\t\t//middleblock.appendChild(document.createElement('BR'));\r\n//\t\t\tmiddleblock.appendChild(table);\r\n\t\t}\r\n\t}",
"function drawMap(mapDivId, mapToDraw) {\r\n var mapdiv = document.getElementById(mapDivId);\r\n mapdiv.innerHTML = mapToDraw.getMapTable();\r\n }",
"function makeGrid(height, width) {//takes the width and height input from the user\r\n $('tr').remove(); //remove previous table if any\r\n for(var i =1; i<=width;i++){\r\n $('#pixelCanvas').append('<tr id = table' + i + '></tr>');//the tableid plus table data\r\n for (var j =1; j <=height; j++){\r\n $('#table' + i).append('<td></td');\r\n }\r\n\r\n }\r\n\r\n //getting more interesting with adding color\r\n $('td').click(function addColor(){\r\n color = $('#colorPicker').val();\r\n\r\n if ($(this).attr('style')){\r\n $(this).removeAttr('style')\r\n } else {\r\n $(this).attr('style', 'background-color:' + color);\r\n }\r\n })\r\n\r\n}",
"function resizeBoard() {\n var elTable = document.querySelector('table');\n if (gLevel.size === 4) elTable.style.width = elTable.style.height = '300px';\n else if (gLevel.size === 8) elTable.style.width = elTable.style.height = '400px';\n else if (gLevel.size === 12) elTable.style.width = elTable.style.height = '500px';\n}",
"function drawTable(){ \n \n //table\n pushMatrix();\n mat4.translate(modelview,modelview,[200,-70,-200]);\n mat4.scale(modelview,modelview,[20,25,20]);\n currentColor = [.5098,.3215, .0039,1];\n table.render();\n popMatrix();\n\n //skull\n pushMatrix();\n mat4.translate(modelview,modelview,[210,-25,-210]);\n mat4.scale(modelview,modelview,[7,7,7]);\n mat4.rotateY(modelview,modelview,(-40)/180*Math.PI);\n mat4.rotateX(modelview,modelview,(-15)/180*Math.PI);\n currentColor = [0.8901, 0.8549,0.7882,1];\n gl.uniform3f( u_material.specularColor, .8862,.3450,.1333 );\n gl.uniform1f( u_material.specularExponent, 20 );\n gl.uniform3f( u_material.emissiveColor,0.08901, 0.08549,0.07882); \n skull.render();\n gl.uniform3f( u_material.emissiveColor,0, 0,0); \n popMatrix();\n\n //candle with holder\n drawCandle(u_lights[7], [172,-2,-198]);\n pushMatrix();\n mat4.translate(modelview,modelview,[172,-15,-200]);\n mat4.scale(modelview,modelview,[2,2,2]);\n currentColor = [.8039,.5843, .4588,1];\n candleholder.render();\n popMatrix();\n}",
"function MapTable() {\r\n}",
"function drawBoard() {\n\tvar tableHTML = '';\n\tvar position = 0;\n\n\tfor(var i = 0; i < 10; i++){\n\t\ttableHTML += '<tr>';\n\t\tfor(var j = 0; j < 10; j++){\n\t\t\tcurrentPosition = positionOrder[position];\n\t\t\ttableHTML += '<td id=\"' + currentPosition + '\" class=\"\" onclick=\"sendLocationPlayed(this)\">' + currentPosition + '</td>';\n\t\t\tposition++;\n\t\t}\n\t\ttableHTML += '</tr>';\n\t}\n\tdocument.getElementById(\"board\").innerHTML = tableHTML;\n}",
"function fillShape(id){\n //renders starts if its not gameOver || table Data already placed\nif(!fields[id] && !gameOver){\n //inactivates player of previous move\n inacPlayer(currentShape);\n //next click on square will make it a move of not inactive player\n fields[id]=shapeShifter(currentShape);\n draw();\n //checking winning condition. if wins is true animations inits and game gets aborted\n if (checkWin()){animateBar(fields);gameOver=true;}\n}\n}",
"function addTableDB(Xpos, Ypos, table_id) {\n var div = document.createElement('div');\n div.id = 'twoPtable';\n div.draggable = true;\n \n switch (getOrderLock(table_id)) {\n case 1:\n div.style.backgroundColor = \"red\";\n break;\n case 2:\n div.style.backgroundColor = \"yellow\";\n break;\n case 3:\n div.style.backgroundColor = \"green\";\n break;\n default:\n break;\n }\n \n setTranslate(Xpos, Ypos, div);\n\n var button = document.createElement('button');\n button.style = \"width: 90%; height: 40%; margin-top: 5%; font-size:0.5vw\";\n button.id = \"orderbtn\";\n button.textContent = \"Order\";\n button.setAttribute(\"onClick\", \"javascript: showOrder(\"+table_id+\")\");\n div.appendChild(button);\n\n var innerDiv = document.createElement('p');\n var text = document.createTextNode(table_id);\n innerDiv.style = \"font-size: 1vw; margin-top:5%; float:left; margin-left:5%\";\n innerDiv.appendChild(text);\n div.appendChild(innerDiv);\n\n container.appendChild(div);\n}",
"updateShapeTable(){\n let self = this;\n let keys = Object.keys(this._shapes);\n let values = Object.values(this._shapes);\n /* these are the DOM elements in each row of the table */\n let rowComponents = [\n { 'type': 'div', 'attr':[['class', 'flex-cell display']] },\n { 'type': 'div', 'attr':[['class', 'flex-cell label']] },\n { 'type': 'span', 'attr':[['class', 'flex-cell small-close']] },\n ];\n super.initTableRows('#shape-table', 'shape', keys, rowComponents);\n /* we customize the DOM elements according to the values of the shapes list */\n d3.select('#shape-table').selectAll('.display')\n .data(values)\n .append('svg')\n .attr('class', 'display-cell')\n .attr('viewBox', '-5 -5 10 10')\n .append('path')\n .attr('fill', 'black')\n .attr('d', (d) => { return d3.symbol().type(d3['symbol'+d]).size(10)(); })\n ;\n /* set the label for each row */\n d3.select('#shape-table').selectAll('.label')\n .data(keys)\n .text(d => d)\n ;\n /* update the small-close span element */\n let close = d3.select(\"#shape-table\").selectAll('.small-close')\n .data(keys)\n .attr('data-key', d => d)\n .html('×')\n .on('click', function(){\n if( this.dataset.key === 'Default' ) return;\n delete( self._shapes[this.dataset.key] );\n self.assignShapes();\n self.updateShapeTable();\n self.plot();\n })\n ;\n }",
"function addRow(action)\n{\n\tvar theAction = action;\n var table = document.getElementById('maplist');\n var theRows = table.rows.length;\n var inkrement = theRows;\n var row = table.insertRow(theRows);\n\t\n\t// gibt nen text wie \"map #1\" aus\n\tvar cell0 = row.insertCell(0);\n\tvar textNode = document.createTextNode('map #' + inkrement);\n\tif(theAction=='edit') {\n\t\tvar ele0 = document.createElement('input');\n\t\t\tele0.setAttribute('type', 'hidden');\n\t\t\tele0.setAttribute('name', 'map_id[]');\n\t\t\tele0.setAttribute('value', inkrement);\n\t\tcell0.appendChild(ele0);\n\t}\n\tcell0.appendChild(textNode);\n\t// mapname\n var cell1 = row.insertCell(1);\n var ele1 = document.createElement('input');\n\t\tele1.setAttribute('type', 'text');\n\t\tele1.setAttribute('name', 'map_name[]');\n\t\tele1.setAttribute('id', 'map_name_' + inkrement);\n\t\tele1.setAttribute('size', '35');\n\t\tele1.className='form_off';\n cell1.appendChild(ele1);\n\t// results: home\n var cell2 = row.insertCell(2);\n var ele2 = document.createElement('input');\n\t\tele2.setAttribute('type', 'text');\n\t\tele2.setAttribute('name', 'map_result_home[]');\n\t\tele2.setAttribute('id', 'map_result_home_' + inkrement);\n\t\tele2.setAttribute('size', '3');\n\t\tele2.className='form_off';\n\tcell2.appendChild(ele2);\n\t// results: opponent\n\tvar cell3 = row.insertCell(3);\n\tvar ele3 = document.createElement('input');\n\t\tele3.setAttribute('type', 'text');\n\t\tele3.setAttribute('name', 'map_result_opp[]');\n\t\tele3.setAttribute('id', 'map_result_opp_' + inkrement);\n\t\tele3.setAttribute('size', '3');\n\t\tele3.className='form_off';\n\tcell3.appendChild(ele3);\n\t// create delete-selection for edit-function\n\tif(theAction=='edit') {\n\t\tvar cell4 = row.insertCell(4);\n\t\tvar ele4 = document.createElement('input');\n\t\t\tele4.setAttribute('type', 'checkbox');\n\t\t\tele4.setAttribute('name', 'delete['+inkrement+']');\n\t\t\tele4.setAttribute('value', inkrement);\n\t\t\tele4.className='form_off';\n\t\tcell4.appendChild(ele4);\n\t} else {\n\t\tvar cell4 = row.insertCell(4);\n\t}\n}",
"updateSize() {\n this.map.invalidateSize()\n }",
"function setTable()\n{\n\ttableObj = {\n\t\t\"settings\":{\"offsetX\":181,\"offsetY\":39,\"targWidth\":80,\"targHeight\":55,\"noRows\":3, \"noZero\":1},\n\t\t\"targs\":{\n\t\t\t\"targ0\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ1\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ2\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ3\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ4\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ5\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ6\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ7\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ8\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ9\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ10\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ11\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ12\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ13\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ14\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ15\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ16\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ17\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ18\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ19\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ20\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ21\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ22\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ23\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ24\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ25\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ26\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ27\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ28\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ29\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ30\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ31\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ32\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ33\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ34\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ35\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 },\n\t\t\t\"targ36\":{\"x\":0, \"y\":0, \"chips\":[], \"container\":0 }\n\t\t}\n\t};\n\t\n\t// ??? Need to Make Dynamic\n\t/*\n\ttableObj.settings.targWidth = 80;\n\ttableObj.settings.targHeight = 55;\n\ttableObj.settings.offsetX = 140;\n\ttableObj.settings.offsetY = 80;\n\t*/\n\n\tlet targW = tableObj.settings.targWidth;\n\tlet targH = tableObj.settings.targHeight;\n\tlet targOffX = tableObj.settings.offsetX;\n\tlet targOffY = tableObj.settings.offsetY;\n\n\tlet loopLimit = tableObj.settings.noRows;\n\tlet loopCount = -Math.abs(tableObj.settings.noZero);\n\tlet row = 0;\n\t//console.log(\"loopCount: \"+loopCount);\n\t//let table = new PIXI.Container();\n\t//app.stage.addChild(table);\n\t\n\tlet targs = tableObj.targs;\n\tfor (var key in targs) {\n\tif (targs.hasOwnProperty(key)) {\n\t\t //console.log(key + \" -> \" + targs[key]);\n\t\t //console.log(\"loop % loopLimit:\"+loopCount % loopLimit);\n\t\t let div = loopCount % loopLimit;\n\t\t loopCount++;\n\t\tswitch(div) {\n\t\t\tcase -2:\n\t\t\t\t// top - roulette with two Zero's\n\t\t\t\tbreak;\n\t\t\tcase -1:\n\t\t\t\t// top - roulette with one Zero\n\t\t\t\ttableObj.targs[key].y = tableObj.settings.offsetY;\n\t\t\t\ttableObj.targs[key].x = targW + tableObj.settings.offsetX;\n\t\t\t\tbreak;\n\t\t\tcase 0:\n\t\t\t\t// All left hand - new row\n\t\t\t\trow++;\n\t\t\t\ttableObj.targs[key].y = (targH * row) + tableObj.settings.offsetY;\n\t\t\t\ttableObj.targs[key].x = tableObj.settings.offsetX;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t// All other Boxes\n\t\t\t\ttableObj.targs[key].y = (targH * row) + tableObj.settings.offsetY;\n\t\t\t\ttableObj.targs[key].x = (targW * div) + tableObj.settings.offsetX;\n\t\t} \n\t\t\n\t}\n\t}\n\ttableObj.targs = targs;\n\t\n\t//let str = JSON.stringify(tableObj, null, 4); // (Optional) beautiful indented output.\n\t//console.log(str); // Logs output to dev tools console.\n\t\n\ttargs = tableObj.targs;\n\tfor (var key in targs) \n\t{\n\t\ttableObj.targs[key].container = app.stage.addChild(makeTarg(key));\n\t\t//console.log(\">>>> container: \"+tableObj.targs[key].container);\n\t}\n\t\n\t// let str = JSON.stringify(app.stage.children, null, 4); // (Optional) beautiful indented output.\n\t// console.log(str); // Logs output to dev tools console.\n}",
"function addTiles(co,jk,jj,dp,dn,dq,dk,dj,dl,dh,dg,di){xc_eg(co,\"jn\",\"jn\",{\"width\":jk,\"height\":jj,\"jn\":[dp||\"\",dn||\"\",dq||\"\",dk||\"\",dj||\"\",dl||\"\",dh||\"\",dg||\"\",di||\"\"],\"ca\":0,\"bs\":0,\"id\":\"\"},0)}",
"function placeInTable(x, y,player) {\n let piece = document.createElement(\"div\");\n piece.classList.add(\"piece\")\n piece.classList.add(`Player${player}`)\n let target_cell = document.getElementById(`${x}-${y}`)\n target_cell.append(piece);\n\n}",
"function drawTable() {\n let hour_chart_data = new google.visualization.DataTable();\n hour_chart_data.addColumn('string', 'Δραστηριότητα');\n hour_chart_data.addColumn('string', 'Ώρα Περισσότερων Εγγραφών');\n hour_chart_data.addRow(['IN_VEHICLE', hour_data['IN_VEHICLE']]);\n hour_chart_data.addRow(['ON_BICYCLE', hour_data['ON_BICYCLE']]);\n hour_chart_data.addRow(['ON_FOOT', hour_data['ON_FOOT']]);\n hour_chart_data.addRow(['RUNNING', hour_data['RUNNING']]);\n hour_chart_data.addRow(['STILL', hour_data['STILL']]);\n hour_chart_data.addRow(['TILTING', hour_data['TILTING']]);\n hour_chart_data.addRow(['UNKNOWN', hour_data['UNKNOWN']]);\n\n var hour_table = new google.visualization.Table(document.getElementById('hour-table-div'));\n hour_table.draw(hour_chart_data, {showRowNumber: false, width: '100%', height: '100%'});\n }",
"function redraw() {\n width = document.getElementById('container_map').offsetWidth;\n height = width / 2;\n d3.select('svg').remove();\n setup(width,height);\n draw(topo);\n}"
] |
[
"0.65854883",
"0.63076633",
"0.6164537",
"0.615061",
"0.60348946",
"0.6024019",
"0.5992851",
"0.5977376",
"0.5976345",
"0.5932729",
"0.5929121",
"0.58895046",
"0.5881419",
"0.5801246",
"0.57981557",
"0.5783472",
"0.5775159",
"0.577508",
"0.577232",
"0.57554066",
"0.5744306",
"0.5685112",
"0.5684867",
"0.5665309",
"0.5643316",
"0.5629409",
"0.5592821",
"0.5578227",
"0.5553081",
"0.5552125"
] |
0.8765483
|
0
|
get popular films from API DB
|
async fetchPopularFilms() {
let popularFilms = 'trending/movie/week?';
try {
const response = await axios.get(
BASE_URL +
popularFilms +
API_KEY +
'&language=en-US&page=' +
`&page=${this.localService.getPaginationPage()}`,
);
this.localService.setLocalTotalCards(response.data.total_results);
this.localService.setPaginationPage(response.data.page);
return response.data;
} catch (error) {
return error;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"async getAllFilms() {\n const responseData = await fetch(\"https://ghibliapi.herokuapp.com/films\");\n\n const response = await responseData.json();\n\n return response;\n }",
"function getPopularMovies(){\n var url = \"https://api.themoviedb.org/3/movie/popular?api_key=\" + api_key + \"&language=fr\";\n return get(url);\n}",
"function fetchPopularFilmsByPage(page) {\n newApiService.pageNum = page;\n return newApiService.insertGenresToMovieObj();\n}",
"function getMostPopular() {\r\n var url = 'https://api.nytimes.com/svc/mostpopular/v2/mostemailed/Magazine/30.json';\r\n let params = {\r\n q: 'query',\r\n 'api-key': '85b2939e3df349dd8502775e8623d350'\r\n }\r\n url += '?' + $.param(params)\r\n $.ajax({\r\n url: url, \r\n method: 'GET',\r\n }).done(function(result) {\r\n console.log(result);\r\n // Define which results will be displayed and display them\r\n var article_url = results.url;\r\n var title = results.title;\r\n $('#results').append(\"<li><h3>\" + title + \r\n \"</h3>\" + article_url + \"</li>\");\r\n }).fail(function(err) {\r\n throw err;\r\n });\r\n }",
"getPopularMovies() {\n const requestSettings = {\n method: 'GET',\n baseURL: API_BASE_URL,\n url: AVAILABLE_API_METHODS.getPopular,\n params: {\n api_key: API_KEY\n }\n };\n\n return axios(requestSettings);\n }",
"function loadMoreMovies(){\n console.log(\"Page Number = \" + pageNum)\n const endpoint = `${topRatedFilms_url}${api_key}&page=${pageNum += 1}`;\n fetchMovies(endpoint)\n }",
"async fetchQueriedFilms() {\n try {\n const response = await axios.get(\n // need to verify request's url (url ok)\n BASE_URL +\n this.endPoint +\n API_KEY +\n '&language=en-US&page=' +\n `${this.localService.getPaginationPage()}&query=${this.query}`,\n );\n return response.data;\n } catch (error) {\n return error;\n }\n }",
"function getPopularMovies() {\n\tif(G.hasInternet()) {\n\t\tvar url = CFG[\"URLS\"][\"MOVIES\"][\"POPULAR\"] + G.URL_PARAMETERS.API_KEY;\n\t\tvar xhr = Ti.Network.createHTTPClient({\n\t\t\ttimeout: 10000,\n\t\t\tonerror: function onerror(e) {\n\t\t\t\tG.info(e);\n\t\t\t},\n\t\t\tonload: function onload(e) {\n\t\t\t\ttry {\n\t\t\t\t\tparseResponse(this.responseText);\n\t\t\t\t\t$.movies.trigger('change');\n\t\t\t\t\t$.ptr.hide();\n\t\t\t\t} catch(e) {\n\t\t\t\t\tG.info(e);\t\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\txhr.open(\"GET\", url);\n\t\txhr.send();\n\t} else {\n\t\tinfo(\"No internet connection\");\n\t}\n}",
"async findAllFilms(){\n return Movie.find();\n }",
"async GetMovies( page = 1) {\n const data = await fetch(\n `${global.apiUrl}/popular?api_key=${global.apiKey}&language=${\n global.lang\n }&page=${page}`)\n\n const json = await data.json()\n return json\n }",
"function getSevenBestMovies(url, doc){\n getMovies(url).then(function(response){\n let movies = [];\n let i = 0;\n let max = 7;\n\n while (i < response.results.length){\n movies.push(response.results[i]);\n i++;\n }\n\n if (movies.length < max){\n max = max - movies.length;\n getMovies(response.next).then(function(response){\n i = 0;\n while (i < max){\n movies.push(response.results[i]);\n i++\n };\n\n for (movie of movies){\n\n getInfos(movie, doc)\n\n }\n })\n }\n })\n}",
"async function getPopularMovies() {\n const popularMoviesUrl = getUrl(\"/movie/popular\");\n const result = await getData(`${popularMoviesUrl}`);\n\n state.movies.popular = result.results;\n\n return result;\n}",
"async function getMostWatched(chId, vidCount){\n // https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={ch_id}&key={key}&maxResults=5&order=viewcount\n\n const getReqTemp = `https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=${chId}&key=${keys.apiKey}&maxResults=${vidCount}&order=viewcount&type=video`\n\n const response = await fetch(getReqTemp)\n const data = await response.json()\n const topVids = data.items\n\n return topVids\n}",
"function howManyMovies(movies){\n if (movies == 0){}\n else {\n var dramaFilms = [];\n for (var i = 0; i < movies.length; i++){\n for (var j = 0; j < movies[i].genre.length; j++){\n if (movies[i].genre[j] === 'Drama'){\n dramaFilms.push(movies[i])\n }\n }\n}\n var stevenFilms = dramaFilms.filter(function(elm){\n return elm.director == 'Steven Spielberg';\n });\n return 'Steven Spielberg directed ' + stevenFilms.length + ' drama movies!'\n}\n}",
"static async getData () {\n return await App.getPage('popular', 1);\n }",
"getPopularTv() {\n return apiClient.get(\n `/tv/popular?api_key=6c1e80dae659cb7d1abdf16afd8bb0e3&language=en-US&page=1`\n )\n }",
"function getAllMoviesCount(cb) {\n Movie.find({}, (err, mlist) => {\n if(err) {\n cb(err, null);\n return;\n }\n cb(null, mlist.length);\n });\n}",
"function getMovies (req, resp) {\n console.log(\"\\tgetMovies called\");\n var filter = sharedVars.parseFilter(req.swagger.params);\n getFilteredMovies(filter, function(getError, data) {\n if (getError) {// If an error occured, just say it failed\n sharedVars.sendError(resp, 500, 'Failed to get a list of movies.', data);\n } else {// If successful, send json back\n // Update analytics for all the movies\n console.log(\"\\tSending analytics for movie list...\");\n for(var movieIndex in data.entities) {\n sharedVars.sendAnalytic(data.entities[movieIndex].name);\n }\n if (!sharedVars.shouldGetReviews(req.swagger.params)) {\n // If no reviews needed, just return the data\n resp.json(data);\n\n } else {\n // Add reviews to each movie in the list\n console.log(\"\\t\\tAppending reviews to list...\");\n async.each(data.entities, function(movie, callback) { // Is called for each request\n // Manually ask for connections...\n getReviews(movie, function(revError, revData) {\n movie.reviews = revData;\n if (revError) // If couldn't append reviews to movie, report error\n callback(revData);\n else // If reviews appended successfully, return\n callback();\n });\n }, function(error) { // Is called after all requests are done\n if (error) { // If an error occurred, set error message\n resp.statusCode = 500;\n data.message = error;\n }\n resp.json(data);\n });\n }\n }\n });\n}",
"async findAllFilms(filmCollection){\n return movie.find(filmCollection);\n }",
"function howManyMovies(collection){\n var filterMovies;\n if(collection === undefined || collection.length === 0){\n return undefined;\n }\n else{\n filterMovies = collection.filter(function(movie){\n return (movie.genre.includes(\"Drama\") && movie.director.includes(\"Steven Spielberg\"));\n });\n var numberOfMovies;\n if (filterMovies.length === 0){\n numberOfMovies = 0;\n }\n else{\n numberOfMovies = filterMovies.length;\n }\n var msg = \"Steven Spielberg directed \"+ numberOfMovies +\" drama movies!\"\n return msg;\n }\n}",
"function howManyMovies (movies) {\n \n}",
"function getGenres(){\n var url = \"http://api.themoviedb.org/3/genre/movie/list?api_key=\" + api_key + \"&language=fr\";\n return get(url);\n}",
"function searchFilm() {\n if (searchQuery.length === 0) {\n searchQuery = \"Mr. Nobody\"\n }\n request(`http://www.omdbapi.com/?t=${searchQuery}&plot=short&apikey=5d94fa00`, function (error, response, body) {\n if (!error && response.statusCode === 200) {\n console.log(`Movie: ${JSON.parse(body).Title}`);\n console.log(`Starring: ${JSON.parse(body).Actors}`);\n console.log(`Year: ${JSON.parse(body).Year}`);\n console.log(`Origin: ${JSON.parse(body).Country}`);\n console.log(`Language: ${JSON.parse(body).Language}`);\n console.log(`IMDB Rating: ${JSON.parse(body).imdbRating}`);\n console.log(`Tomato-meter: ${JSON.parse(body).Ratings[1].Value}`);\n console.log(`Synopsis: ${JSON.parse(body).Plot}`); \n }\n });\n}",
"function howManyMovies(movies) {\n const filterd = movies.filter(function(movie) {\n return movie.director === 'Steven Spielberg' &&\n movie.genre.includes('Drama')\n })\n}",
"function obterFilmesPalavraChave(palavraChave) {\n\t\tlet valorPagina = $('#paginaPesquisar').val()\n\t\tvar maximoPagina = \" \";\n\t\tconsole.log('key')\n\t\tlet xmlHttp = new XMLHttpRequest();\n\t\txmlHttp.open('GET', 'https://api.themoviedb.org/3/keyword/' + palavraChave + '/movies?api_key=bd9f051458a4c87fe4c873ef463542e3&page=' + valorPagina +'language=pt-BR&include_adult=false');\n\t\t//Pecorrendo o array xmlHttp\n\t\txmlHttp.onreadystatechange = () => {\n\t\t\t//verificando o status e o state da API.\n\t\t\tif(xmlHttp.readyState == 4 & xmlHttp.status == 200){\t\t\t\n\t\t\t\t//Criando um objeto com o response do json\n\t\t\t\tlet XMLFilmes = xmlHttp.responseText; \n\t\t\t\tlet jsonFilmes = JSON.parse(XMLFilmes);\n\t\t\t\t//tamanho = jsonFilmes.total_pages\n\t\t\t\t//Criando uma coluna para outras informações\n\n\t\t\t\tvar maximoPagina = jsonFilmes.total_pages\n\t\t\t\tconsole.log(maximoPagina)\n\t\t\t\tfor(let i in jsonFilmes['results']){\n\t\t\t\t\tlet item = \tjsonFilmes['results'][i]\n\t\t\t\t\tif(jsonFilmes['results'][i].length == 0){\n\t\t\t\t\t\t$('#botaoMostrarMais').addClass('d-none')\n\t\t\t\t\t}\n\t\t\t\t\tlet a = document.createElement('a');\n\t\t\t\t\tlet img = document.createElement('img')\n\t\t\t\t\tif(item.poster_path !== null){\n\t\t\t\t\t\ta.href = \"mistermovies_controller.php?idFilme=\" + item.id + \"&controle=9\"\n a.id = \"filme\";\n\t\t\t\t\t\timg.className = \"item round float-left mx-1 my-1 my-sm-1 mx-sm-1 my-md-3 mx-md-2\";\n\t\t\t\t\t\timg.src = \"https://image.tmdb.org/t/p/original\" + item.poster_path\n\t\t\t\t\t\t//Criando a árvore do DOM\n\t\t\t\t\t\ta.appendChild(img);\n\t\t\t\t\t\tdocument.getElementById('listaPesquisa').appendChild(a);\n\t\t\t\t\t}\t\n\t\t\t\t}\n\t\t\t\tif(valorPagina < maximoPagina){\n\t\t\t\t\tconsole.log('entrou no if')\n\t\t\t\t\tlet paginaInt = parseInt(valorPagina);\n\t\t\t\t\tconsole.log(paginaInt)\n\t\t\t\t\tlet pagina = paginaInt + 1;\n\t\t\t\t\t$('#paginaPesquisar').val('')\n\t\t\t\t\t$('#paginaPesquisar').val(pagina)\n\t\t\t\t}else {\n\t\t\t\t\t$('#botaoMostrarMais').attr('disabled', true);\n\t\t\t\t}\t\t\n\t\t\t}\n\t\t\t//Tratamento do erro 401/404\n\t\t\telse if(xmlHttp.readyState == 4 & xmlHttp.status == 401 || xmlHttp.status == 404){\t\t\n\t\t}\n\t}\n\t\n\t\t\n\t\t\n\t\t//enviado a requisição\n\t\txmlHttp.send();\n\t}",
"function howManyMovies(movies){\n\n}",
"function fetchSimilars() {\n Books.getSimilar($stateParams.id)\n .then(function(result) {\n $scope.similars = result.collection;\n })\n .catch(function(error) {\n $scope.error = error;\n });\n }",
"function howManyMovies (data){\n if(data.length === 0){\n return 0\n }\n \n let directorArray = data.filter(function(el){\n return el.director == 'Steven Spielberg' && el.genre.includes('Drama')\n })\n\n return directorArray.length\n}",
"function addMovies() {\n fetch('https://ghibliapi.herokuapp.com/films')\n .then(response => response.json())\n .then(movies => movies.forEach(movie => addCard(movie)))\n .catch(err => console.err);\n}",
"function getMoreTweets(req, res, next) {\n\n User.find({}).sort({tweets_app: -1}).limit(20).exec(\n function (err, users) {\n res.status(200).json(users);\n }\n );\n\n }"
] |
[
"0.7264159",
"0.6814281",
"0.67827076",
"0.651927",
"0.63706785",
"0.6318846",
"0.6297376",
"0.62494904",
"0.6239027",
"0.61255807",
"0.6123391",
"0.6102843",
"0.60699",
"0.60353565",
"0.6029459",
"0.60192186",
"0.5958336",
"0.595364",
"0.5898756",
"0.5896913",
"0.5889747",
"0.58589065",
"0.5855343",
"0.58546096",
"0.5851182",
"0.58500826",
"0.58432245",
"0.58400714",
"0.5832589",
"0.58232874"
] |
0.77615607
|
0
|
================fetch trailer by ID==============
|
async fetchTrailerById() {
try {
const response = await axios.get(
`${BASE_URL}movie/${this.movieId}/videos?${API_KEY}&language=en-US`,
);
return response.data.results;
} catch (error) {
return error;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function getTrailer(mID, cb) {\n return $.ajax({\n type: 'GET',\n url: '/api/trailer',\n data: {\n id: mID\n },\n dataType: 'json',\n success: function(data) {\n cb(data.result);\n },\n error: function(err) {\n cb(null);\n currentTrailer = null;\n console.log(err.responseText);\n }\n });\n}",
"function getTrailer(title){\n\tconst userQuery = {\n q: `${title} official trailer`,\n part: \"snippet\",\n key: YOUTUBE_API_AUTH,\n type: \"video\",\n maxResults: 1,\n };\n $.getJSON(YOUTUBE_SEARCH_URL, userQuery, function (data){\n const showVideo = data.items.map((value, index) => displayTrailer(value));\n $('.modal-movie-detail .modal-video').html(showVideo);\n });\n}",
"function fetchMovieInfo(id) {\n const movieUrl = `http://www.omdbapi.com/?i=${id}&apikey=${apiKey}`;\n fetch(movieUrl)\n .then(response => response.json())\n .then(body => movieInfoTempate(body));\n}",
"movieById(cb, id) {\n let movieById = `https://api.themoviedb.org/3/movie/${id}?api_key=${this.API_KEY}&language=en-US`\n fetch(movieById)\n .then(response => {\n return response.json()\n }).then(movie => {\n cb(movie)\n })\n }",
"function getMovieDetails(id, callback){\n\tconst query = {\n\t\tapi_key: TMDB_API_AUTH.KEY,\n\t};\n\t$.getJSON(TMDB_SEARCH_URL_MOVIES_DETAILS+id, query, callback);\n}",
"function getOneMovie(id) {\n AJAXRequest(`${serverURL}/${id}`).then(responseData => console.log(responseData))\n }",
"function appendInfo (id) {\n return fetch(`${moviesURL}/${id}`, {\"method\": \"GET\", headers: header})\n .then(res => res.json())\n .catch(console.error)\n }",
"function getMovie(id) {\n //Making changes is easy in the cloud and desktop!\n let url = 'https://www.omdbapi.com/?i='+id+'&apikey=CHANGEDONDESKTOPWITHCLOUDSPACESEXTENSION'\n return axios.get(url);\n}",
"function getRacerHistoryById(id, callback) {\n getPage(id, (err, $) => {\n if(err) {\n callback(err);\n }\n else {\n let hobj = {},\n heats = $('#Table1').find('a').map((i, el) => {\n let raceHistory = helpers.extractRaceHistory(el.children[0].data),\n skill = helpers.extractSkill(el.parent.next.next.children[0].data);\n\n return {\n id: helpers.extractHeatNo(el.attribs.href),\n kart: raceHistory.kart,\n desc: raceHistory.desc,\n date: el.parent.next.children[0].data.trim(),\n skill: skill.skill,\n skillDelta: skill.skillDelta,\n bestTime: el.parent.next.next.next.children[0].data,\n position: helpers.extractPosition(el.parent.next.next.next.next.children[0].data)\n };\n }).get();\n\n heats.forEach((heat) => {\n hobj[heat.id] = heat;\n });\n\n callback(null, {\n id: id,\n name: $('#lblRacerName').text(),\n skill: $('#lblSpeedLimit').text(),\n heats: hobj\n });\n }\n });\n }",
"readById(id, callback) {\n visitorTimelineModel.visitor_timeline.find({ where: { visitorId: id } }).then((visitorTimeline) => {\n callback(visitorTimeline);\n });\n }",
"function getTrailerIFrame() {\n return document.getElementById(\"trailer-iframe\");\n}",
"function getObject(id) {\n\n for (var i = 0; i < MAR.objects.length; i++) {\n if (MAR.objects[i].id === id) {\n return MAR.objects[i];\n }\n }\n\n return null;\n\n}",
"function getCastDetails(id, callback){\n\tconst query = {\n\t\tapi_key: TMDB_API_AUTH.KEY,\n\t};\n\t$.getJSON(TMDB_SEARCH_URL_MOVIES_DETAILS+id+\"/credits\", query, callback);\n}",
"function getMovieById(id) {\r\n for(let i = 0; i < movies.length; i++){\r\n if (movies[i].imdbID === id)\r\n return movies[i]\r\n }\r\n return null\r\n}",
"async function getMovieInfo(id) {\n let response = await fetch('https://swapi.dev/api/films/');\n let json = await response.json();\n let selectedFilm;\n json.results.forEach((film) => {\n if (film.episode_id == id) {\n selectedFilm = {\n name: film.title,\n episodeID: film.episode_id,\n characters: film.characters,\n };\n }\n });\n return selectedFilm;\n}",
"async function fetchTrailer() {\n setLoading(true);\n //If item is a movie -> trailer is fetched from TMDb API in first request.\n //else if item is a TV,serial,webseries -> trailer is fetched from TMDb API in second request.\n await axios\n .get(\n `/movie/${itemDetails?.id}/videos?api_key=${API_KEY}&language=en-US`\n )\n .then((responseMovieTrailer) => {\n if (\n responseMovieTrailer.data?.results?.length === 0 ||\n !responseMovieTrailer.data?.results[0]?.key ||\n itemDetails?.media_type === \"tv\"\n ) {\n throw new Error(\"Trailer not available!\");\n } else {\n setTrailerUrl(responseMovieTrailer.data.results[0].key);\n trailerBox.current.focus();\n }\n })\n .catch(() => {\n axios\n .get(\n `/tv/${itemDetails?.id}/videos?api_key=${API_KEY}&language=en-US`\n )\n .then((responseTvTrailer) => {\n if (\n responseTvTrailer.data?.results?.length === 0 ||\n !responseTvTrailer.data?.results[0]?.key\n ) {\n setLoading(false);\n alert(\n \"Trailer not available.\\nTry:\\n1.Checking the connection.\\n2.Playing different TV,Movie trailer.\"\n );\n } else {\n setTrailerUrl(responseTvTrailer.data.results[0].key);\n trailerBox.current.focus();\n }\n })\n .catch(() => {\n // No Trailer is available for item in TMDb\n setLoading(false);\n alert(\n \"Trailer not available.\\nTry:\\n1.Checking the connection.\\n2.Playing different TV,Movie trailer.\"\n );\n });\n });\n }",
"function getMovieDetail(imdbid) {\n return fetch(\"http://www.omdbapi.com/?apikey=cc5844e4&i=\" + imdbid)\n .then((response) => response.json())\n .then((result) => result);\n}",
"static getVideoForBookmark(id){\n let realmVideos = realm.objects('Video').filtered('_id = $0', id)\n return realmVideos[0] //should never be 0 because should be loaded before bookmarks\n }",
"searchResultID(id) {\n const requestUrl = 'http://api.tvmaze.com/shows/' + id;\n\n return fetch(requestUrl)\n .then(response => {\n return response.json();\n })\n }",
"async function getRecipesDetals(id){\n\n let recipeDetails;\n let apiResponse = await fetch(`https://forkify-api.herokuapp.com/api/get?rId=${id}`);\n apiResponse = await apiResponse.json();\n recipeDetails= apiResponse.recipe;\n displayRecipeDetsils(recipeDetails);\n\n}",
"function get(id) {\n return $.getJSON(\"/api/movies/\" + id);\n }",
"getDetail(id) {\n return this.fetch(`${this.api}/${this.resource}/${id}`);\n }",
"function table_getObjectFromID(id)\r\n {\r\n var scrollable = true;\r\n if (document.getElementById(id+'_header') == null) scrollable = false;\r\n if (scrollable == true)\r\n return document.getElementById(id+'_data')\r\n else\r\n return document.getElementById(id)\r\n }",
"async findById({id: id}) {\n return movie.findOne({id: id});\n }",
"function read(id) {\n return wvy.api.read(id);\n }",
"getMovieInfo (id) {\n\t\t\t\treturn $http\n\t\t\t\t\t.get(`${API_URL}i=${id}`)\n\t\t\t\t\t.then(result => result.data)\n\t\t\t\t\t.then(t => chosenMovie = t) // 't' is whatever is returned from the previous .then\n\t\t\t}",
"readById(id, callback) {\n visitorHistoryModel.visitor_history.find({ where: { visitorId: id } }).then((visitorHistory) => {\n callback(visitorHistory);\n });\n }",
"async function getMovieDetails(id) {\n var movObj;\n var apiUrl = \"https://api.themoviedb.org/3/movie/\" + id + \"?api_key=\" + apiKey;\n fetch(apiUrl).then(function (response) {\n if (response.ok) {\n response.json().then(function (data) {\n var movieTitle = data.title;\n var imdbId = data.imdb_id;\n var posterUrl = data.poster_path;\n movObj = {\n id: id,\n title: movieTitle,\n imdb: imdbId,\n poster: posterUrl\n };\n displayMovie(movObj);\n });\n }\n else {\n alert(\"Something went wrong\");\n }\n });\n}",
"function crisisReadMore(id) {\n // Make an AJAX Call to ReliefWeb Reports with the ID\n $.ajax({\n type: \"GET\",\n url: `https://api.reliefweb.int/v1/reports/${id}`,\n dataType: \"json\",\n contentType: \"application/json\"\n })\n // If Done, Render the Result\n .done(result => renderSingleCrisis(result))\n // If Fail, Log the Error\n .fail(err => console.log(err));\n}",
"static find(id, cb){\n db.get('SELECT * FROM artwork WHERE id=?', id, cb);\n }"
] |
[
"0.71374357",
"0.66372436",
"0.65327764",
"0.618922",
"0.6118345",
"0.6107566",
"0.6033754",
"0.602162",
"0.6006127",
"0.5993829",
"0.5944225",
"0.59165883",
"0.59071666",
"0.5898653",
"0.5877318",
"0.5862976",
"0.5845037",
"0.5840162",
"0.5780638",
"0.57175267",
"0.5688476",
"0.56796104",
"0.56531817",
"0.5633389",
"0.5626464",
"0.5619435",
"0.56180966",
"0.5616676",
"0.56072336",
"0.5605941"
] |
0.7265544
|
0
|
TeamDetailController Team Detail controller use detail.html view
|
function TeamDetailController($scope, $timeout, $stateParams, RestFul) {
if (!$stateParams.ud) { return; }
$scope.teamDetailLoading = true;
RestFul.error(
{"action": "Account:TeamDetail", "params": {"team": $stateParams.ud}},
function(response) {
if (!response) { return; };
if (response.hasOwnProperty('message') && response.hasOwnProperty('data')) {
$scope.team = response.data;
$timeout(function() { $scope.teamDetailLoading = false; }, 300)
} else { $timeout(function() { $scope.teamDetailLoading = false; }, 300) }
}
)
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function showTeamDetails(context) {\n context.loggedIn = sessionStorage.getItem('authtoken') !== null;\n context.username = sessionStorage.getItem('username');\n context.teamId = context.params._id.substring(1);\n context.isOnTeam = sessionStorage.getItem('teamId') !== \"undefined\"\n && sessionStorage.getItem('teamId') === context.teamId;\n\n auth.getUsers()\n .then(resp => {\n context.members = resp.filter((key) => key.teamId === context.teamId);\n\n this.loadPartials({\n header: './templates/common/header.hbs',\n footer: './templates/common/footer.hbs',\n teamMember: './templates/catalog/teamMember.hbs',\n teamControls: './templates/catalog/teamControls.hbs'\n }).then(function () {\n teamsService.loadTeamDetails(context.teamId)\n .then(res => {\n context.isAuthor = sessionStorage.getItem('userId') === res._acl.creator;\n context.name = res.name;\n context.comment = res.comment;\n\n this.partial('./templates/catalog/details.hbs');\n }).catch(auth.handleError);\n });\n\n }).catch(auth.handleError);\n }",
"function showDetail() {\n showModal('detail.html');\n}",
"function showMyTeamDetails(context) {\n const myTeamId = sessionStorage.getItem('teamId');\n context.redirect(`#/catalog/:${myTeamId}`);\n }",
"function getTeam() {\n $http.get('/assets/json/people.json')\n .success(function (data) {\n $scope.team = data;\n });\n }",
"function getTeam() {\n teamDataService.getTeam(vm.team.id)\n .then(function (data) {\n vm.team = data;\n });\n }",
"function viewDetail() {\n if(typeof($scope.detail) == 'function') {\n $scope.detail();\n }\n }",
"TeamViewInSpace (baseUrl,username,spacename,teamname){\n browser.get(baseUrl + username + \"/\" + spacename +\"/teams/\" + teamname);\n }",
"function getTeamDetail() {\n return new Promise((resolve, reject) => {\n let id = localStorage.getItem(\"team_id\") || null;\n if (!id) loadPage(\"home\");\n\n if (\"caches\" in window) {\n caches.match(`${BASE_URL}teams/${id}`).then((res) => {\n if (res) {\n res.json().then((data) => {\n renderSingleCard(data);\n resolve(data);\n });\n }\n });\n }\n\n fetch(`${BASE_URL}teams/${id}`, header)\n .then(status)\n .then(json)\n .then((data) => {\n renderSingleCard(data);\n\n resolve(data);\n })\n .catch(error);\n });\n}",
"function teamDetails(msg, done, team) {\n const snippets = robot.brain.get(team);\n if (!Array.isArray(snippets)) {\n return teamDoesNotExist(msg, team, done)\n }\n\n msg.send(`Details for ${team}:\\n${snippets.map(snippet => ` - ${snippet}`).join('\\n')}`, done);\n }",
"function getTeam() {\n // Ambil nilai query parameter (?id=)\n let urlParams = new URLSearchParams(window.location.search);\n let idParam = urlParams.get(\"id\");\n\n fetch(`${base_url}competitions/${idParam}/teams`, {\n headers: {\n 'X-Auth-Token': authToken\n }\n })\n .then(res=>{\n return res.json()\n })\n .then(resjson=>{\n showTeam(resjson)\n })\n}",
"function handleClick(index) {\n control.openDetailView(\n data.getTableId(),\n index,\n 'tables/femaleClients/html/femaleClients_detail.html');\n}",
"function viewCaseworker(caseworker_id) {\n console.log('view details clicked ', caseworker_id);\n $http.get('/caseworkers/' + caseworker_id).then(function(response) {\n caseworker.selected = response.data;\n console.log('Caseworker record back from db: ', caseworker.selected);\n });\n }",
"function viewIssue() {\n getTicketDetails(\n function (data) {\n client.interface.trigger(\"showModal\", {\n title: \"Github Issue Details\",\n template: \"./modal/modal.html\",\n data: data.ticket,\n });\n },\n function (error) {\n console.error(error);\n }\n );\n}",
"@route('/studios/:studio.id/movies/:id') get ItemWithStudioPage() {\n return function () {\n return `Movie #${this.id}`;\n };\n }",
"function openDetail () {\n\t\t\t$state.go('about.detail');\n\t\t}",
"async details({ params, view }) {\n const post = await Post.find(params.id)\n //redirecting to the details page\n return view.render('posts.details', {\n post: post\n })\n }",
"function showTargetView(data){\n\t\tvar view = this;\n\t\tvar $e = view.$el;\n\t\tvar reportType = view.reportType;\n\t\tvar mailingSetName = view.mailingSetName;\n\t\tvar $content = $e.find(\".viewEmailsPicker-content\");\n\t\t$content.empty();\n\t\t$content.html(data.data);\n\t}",
"async show({ params, request, response, view }) {\n }",
"async show({ params, request, response, view }) {}",
"function showProjectDetails( urlObj, options )\n{\n var pid = urlObj.hash.replace( /.*pid=/, \"\" ),\n\n // The pages we use to display our content are already in\n // the DOM. The id of the page we are going to write our\n // content into is specified in the hash before the '?'.\n pageSelector = urlObj.hash.replace( /\\?.*$/, \"\" );\n pw.projects.getProjectEx(\n {'pid' : pid},\n //success callback\n function(myProject){\n // Get the page we are going to dump our content into.\n var $page = $( pageSelector );\n pw.activeProject = pid;\n pw.activeProjectObject = myProject;\n renderProjectDetails(myProject);\n\t\t\trenderAssetsList(myProject);\n renderProjectDetailsScripts();\n\n // Pages are lazily enhanced. We call page() on the page\n // element to make sure it is always enhanced before we\n // attempt to enhance the listview markup we just injected.\n // Subsequent calls to page() are ignored since a page/widget\n // can only be enhanced once.\n $page.page();\n\n // We don't want the data-url of the page we just modified\n // to be the url that shows up in the browser's location field,\n // so set the dataUrl option to the URL for the category\n // we just loaded.\n options.dataUrl = urlObj.href;\n\n // Now call changePage() and tell it to switch to\n // the page we just modified.\n $.mobile.changePage( $page, options );\n\n //console.log(\"OPTIONS: \" + JSON.stringify(options));\n },function(e){\n console.log(\"ERROR in showProjectDetails: {0}\".format(JSON.stringify(e)));\n }\n );\n}",
"function viewProject(elmnt){\n var title = projects[elmnt.id].title;\n var desc = projects[elmnt.id].desc;\n var date = projects[elmnt.id].date;\n var products = projects[elmnt.id].products;\n displayModal(title, desc, date, products, elmnt.id);\n}",
"async viewProjDetails({\n view,\n params\n }) {\n const service = await Service.find(params.id)\n return view.render('/services/serviceview', {\n service: service.toJSON()\n })\n }",
"function getTeam(teamId) {\n var teamURL = selectTeam(teamId);\n \n // Displays basic team records \n function populateScreenTeam (teamObj){\n let team = \"<p>\" + teamObj.name + \"</p>\";\n let wins = \"<p style='color: #2b9642'>\";\n wins += teamObj.wins;\n wins += \" wins</p>\";\n let losses = \"<p style='color: #7a212c'>\";\n losses += teamObj.losses;\n losses += \" losses</p>\";\n $('#about-team').append(team);\n $('#about-team').append(wins);\n $('#about-team').append(losses);\n }\n \n // If sessions contains a team, we use that, otherwise we ajax call the team object\n if (sessionStorage.getItem(teamURL) != null && sessionStorage.getItem(teamURL) !== undefined) {\n var storedTeam = sessionStorage.getItem(teamURL);\n var data = $.parseJSON(storedTeam);\n setTimeout(populateScreenTeam(data), 2000);\n } else {\n $.ajax({\n url: teamURL,\n method: 'GET',\n success: function(result) {\n sessionStorage.setItem(teamURL, JSON.stringify(result));\n populateScreenTeam(result);\n }\n });\n }\n }",
"function detailPage(ind){\n displayDetails(formatDetails('detail', json.list[ind]));\n // console.log(json.list[ind]);\n document.getElementById(\"homepage\").style.display = \"none\";\n document.getElementById(\"detailpage\").style.display = \"block\";\n }",
"function GrouponDetailView() {\n BaseView.apply(this, arguments);\n }",
"async show ({ params, request, response, view }) {\n }",
"async show ({ params, request, response, view }) {\n }",
"async show ({ params, request, response, view }) {\n }",
"async show ({ params, request, response, view }) {\n }",
"async show ({ params, request, response, view }) {\n }"
] |
[
"0.6645024",
"0.6386735",
"0.6361377",
"0.594887",
"0.5912718",
"0.58985436",
"0.5890389",
"0.57476956",
"0.5669936",
"0.56580126",
"0.56304306",
"0.5623452",
"0.5599954",
"0.5529331",
"0.5481744",
"0.54762566",
"0.5456242",
"0.5450122",
"0.5447499",
"0.5447481",
"0.54187036",
"0.5408716",
"0.5408264",
"0.5405531",
"0.5403181",
"0.5377768",
"0.5377768",
"0.5377768",
"0.5377768",
"0.5377768"
] |
0.66104364
|
1
|
As a user I want to participate into a colormez by clicking on participate button I can go to colorme view
|
participate(useruid, colormezid) {
this.$state.go('colorme', { useruid: useruid, colormezid: colormezid });
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function joined(e) {\n userId = e.id;\n $('#controls').show();\n startPrompts();\n}",
"getResult(userId, colormezId) {\n this.$state.go('outro');\n }",
"function reply() {\r\n var fromWhere = JSON.parse(localStorage.getItem(\"emailToView\")).fromWhere;\r\n if (fromWhere == FROM_ADMIN_INBOX) {\r\n linkAdminCompose(fromWhere);\r\n } else if (fromWhere == FROM_STUDENT_INBOX) {\r\n linkStudentCompose(fromWhere);\r\n }\r\n}",
"async function clickedChat(l) {\n // //console.log(\"userToken\", String(userToken).length);\n \n // var userToken = await AsyncStorage.getItem('userToken');\n // if(token!=null){\n\n // navigation.navigate(\"ChatSpecificScreenFinal\", {\n // name: l.uservisibility.name,\n // profilePic: l.uservisibility.profilePic,\n // jid: l.jid_main,\n // });\n // // return (<LoginToAccessScreen></LoginToAccessScreen>)\n // } else {\n // Login.current.open();\n // }\n if (token!=null) {\n var found =false;\n chat_roster_main.forEach(list=>{\n //console.log('sdsdsd',list.jid,l.jid)\n if(list.jid == l.jid){\n found = true;\n }\n })\n\n if(found){\n navigation.navigate(\"ChatSpecificScreen\", {\n // name: l.uservisibility.name.substr(0, 15),\n // profilePic: l.uservisibility.profilePic,\n // jid: l.jid_main,\n\n name: l.uservisibility.name.substr(0, 15),\n profilePic: l.uservisibility.profilePic,\n jid: l.jid,\n xmpp: null,\n messages: [],\n media: []\n });\n }else{\n alert('Sorry')\n }\n \n // return (<LoginToAccessScreen></LoginToAccessScreen>)\n } else {\n Login.current.open();\n }\n }",
"function navProfile() {\n var cUser = null;\n socket.emit('isMe', token,cUser , function(res){\n window.location = \"/user/\"+res[1];\n });\n}",
"function goToChat() {\n origin;\n jQuery(\".chat_banner\").hide();\n jQuery(\".banner-modal-box\").slideDown();\n jQuery(\"#history_div\").mCustomScrollbar({\n theme: \"dark-thick\",\n });\n document.getElementById('input_area').focus();\n chat();\n}",
"function onClickFollow(){\n if(compname === \"\"){\n notification['warning']({\n message: 'Function Error',\n description:\n 'There is no company selected.',\n });\n }else{\n notification['success']({\n message: 'Operation Success',\n description:\n `${compname} has been added to the following list. `,\n });\n }\n }",
"function appear_connected(){\n var conectados = document.createElement(\"div\");\n conectados.innerHTML = \"<div class='user'>\" +\n \"<div class='avatar mycon'><img src='\" + avatarPath + \"''></div>\" +\n \"<p class='userme mycon'>\" + guestname + \"</p>\" +\n \"</div>\";\n var people = document.querySelector(\"#pp\"); // cogemos el sitio donde iran los conectados\n people.appendChild(conectados);\n\n // EL PRIMERO QUE SE CONECTE NO NECESITA \n // NINGUN TIPO DE HANDSHAKING\n setCamera(myList[0]);\n myList[0].active = true;\n}",
"function onConnectionSuccess(){\n\t\t\tconsole.log(\"onConnectionSuccess getting my display Name ::: \" + _roomCredentials.name);\n\t\t\t\n\t\t _room = _connection.initJitsiConference(_roomCredentials.name, _roomConfOptions);\n\t\t \n\t\t _room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);\n\t\t _room.on(JitsiMeetJS.events.conference.TRACK_REMOVED, function (track) {\n\t\t console.log(\"track removed!!!\" + track);\n\t\t });\n\t\t _room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);\n\t\t _room.on(JitsiMeetJS.events.conference.CONFERENCE_FAILED, onConferenceFailed);\n\t\t _room.on(JitsiMeetJS.events.conference.KICKED, onUserKicked);\n\t\t \n\t\t //room.on(JitsiMeetJS.events.conference.USER_JOINED, function(id){ console.log(\"user join\");remoteTracks[id] = [];});\n\t\t _room.on(JitsiMeetJS.events.conference.USER_JOINED, onUserJoined);\n\t\t \n\t\t _room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);\n\n _room.addCommandListener(CONFERENCE_BROADCAST.MEETING_ENDED,function (values) {\n // onUserKicked();\n\t\t\t\t$rootScope.$broadcast(MEETING_CUSTOM_COMMANDS.CUSTOM_END,values.attributes)\n });\n\n // room.addCommandListener(MEETING_CUSTOM_COMMANDS.MEMBER_REMOVED,function (values) {\n //\n // });\n\n\t\t /* room.on(JitsiMeetJS.events.conference.USER_ROLE_CHANGED, function (id ,role){\n\t\t \t console.log(\"USER_ROLE_CHANGED :: \"+id + \" - \" + role);\n\t\t \t userRole = role;\n\t\t \t console.log(\"USER_ROLE_CHANGED :: userRole ==== \"+userRole);\n\t\t \t var userDisplayName =\"Name : \" + id + \", Role : \" + userRole + \", Id : \" + id;\n\t\t \t var userRemoveRoleName =\"Name : \" + id + \", Role : \" + participantString + \", Id : \" + id;\n\t\t \t \n\t\t \t var index = participentsList.indexOf(userRemoveRoleName);\n\t\t \t if (index > -1) {\n\t\t \t \tparticipentsList.splice(index, 1);\n\t\t \t }\n\t\t \t setParticipentsList(participentsList);\n\t\t \t participentsList.push(userDisplayName);\n\t\t \t if(id === localId){\n\t\t \t\t isModerator = true;\n\t\t \t\t console.log(\"I'm moderator, locking room with password\" + password);\n\t\t \t\t room.lock(password);\n\t\t \t }\n\t\t \t \n\t\t \t getUserList();\n\t\t });\n\t\t \n\t\t \n\t\t */\n\t\t JitsiMeetJS.mediaDevices.addEventListener(JitsiMeetJS.events.mediaDevices.PERMISSION_PROMPT_IS_SHOWN, function(environmentType ){\n\t\t \t//environmentTypes : 'chrome'|'opera'|'firefox'|'iexplorer'|'safari'|'nwjs'|'react-native'|'android'\n\t\t\t\t // alert(\"Enable browser permission to access audio devices for \" + environmentType +\"browser.\" );\n\t\t\t });\n\t\t \n\t\t console.info('Room Joined ');\n\t\t \n\t\t // var password = \"sagar\";\n\t\t _room.setDisplayName(_roomCredentials.displayName);\n\t\t \n\t\t if (! _connectorRole.MODERATOR) {\n\t\t\t console.log(\"not moderator\");\n\t\t\t _room.join(_roomCredentials.password);\n\t\t } else {\n\t\t \tconsole.log(\" moderator\");\n\t\t \t_room.join();\n\t\t \t_room.lock(_roomCredentials.password);\n\t\t }\n\t\t \n\t\t _room.addCommandListener(\"AddedNewParticipant\", function(values){\n\t\t\t console.log(\"========= New participant is added to the conference =============\");\n\t\t });\n\t\t \n\t\t JitsiMeetJS.createLocalTracks({devices: [\"audio\"]}, true).\n\t\t then(onLocalTracks).catch(function (error) {\n\t\t \t console.log(\"connect localtrack erroe=r ::;\");\n\t\t throw error;\n\t\t });\n\t\t \n\t\t _room.addCommandListener(MEETING_CUSTOM_COMMANDS.NEW_MEMBER_ADDED, function (values) {\n\t\t\t console.log(\"MEETING_CUSTOM_COMMANDS.NEW_MEMBER_ADDED ::: \"+angular.toJson(values));\n\t\t\t\t$rootScope.$broadcast(MEETING_CUSTOM_COMMANDS.NEW_MEMBER_ADDED, {userDetails : values,\n\t\t\t});\n\t\t });\n\t\t \n\t\t _room.addCommandListener(MEETING_CUSTOM_COMMANDS.MEMBER_REMOVED, function (values) {\n\t\t\t console.log(\"MEETING_CUSTOM_COMMANDS.MEMBER_REMOVED ::: \"+angular.toJson(values));\n\t\t\t\t$rootScope.$broadcast(MEETING_CUSTOM_COMMANDS.MEMBER_REMOVED, {userDetails : values,\n\t\t\t});\n\t\t });\n\t\t \n\t\t _room.addCommandListener(MEETING_CUSTOM_COMMANDS.MEETING_EXTENDED, function (values) {\n\t\t\t console.log(\"MEETING_CUSTOM_COMMANDS.MEETING_EXTENDED ::: \"+angular.toJson(values));\n\t\t\t\t$rootScope.$broadcast(MEETING_CUSTOM_COMMANDS.MEETING_EXTENDED, values.attributes);\n\t\t });\n\t\t \n\t\t \n\t\t \n\t\t}",
"function setJoinCallBtn() {\n joinCallBtn.addEventListener(\"click\", async (e) => {\n window.location.href='/join/' + roomId;\n });\n}",
"async connect() {\n Channel.botMessage('Welcome to Routefusion Chat!\\n\\n');\n this.user = await this.setUser();\n this.greetUser();\n }",
"function showPersonalChat(event)\n{\n var spot = $(event.currentTarget).parent();\n showPersonalChatWithSpot(spot.get(0));\n $(\"#msgBoard > input.chatTo\", spot).focus();\n}",
"function connect() {\n\n\n var username = document.getElementById(\"userNameField\").value;\n var password = document.getElementById(\"passwordField\").value;\n if (username) {\n easyrtc.setUsername(username);\n }\n if (password) {\n easyrtc.setCredential({password: password});\n }\n\n\n connectToRoom(room);\n easyrtc.setPeerListener(dispatchIncomingData);// set callback function on reception of message\n easyrtc.setRoomOccupantListener(generateRoomOccupants);\n\n\n if (room === \"default\" && firstConnect === true) {\n easyrtc.connect(\"multichat\", loginSuccess, loginFailure);\n firstConnect = false;\n }\n //console.log(easyrtc.username);\n\n //pouchDB\n updateRoomListIndex();\n connectToDb(room);\n //vis.js\n generateGraph(room);\n\n const $sendStuff = $(\"#sendStuff\");\n $sendStuff.on(\"click\", sendMessage);// FIXME some things can be moved outside this function to avoid being called several times unnecessarily\n $sendStuff.html(\"Send to room: \" + room);\n\n //experimental stuff :\n if (experimental) {\n showRooms();\n }\n}",
"function reply() {\r\n try {\r\n var fromWhere = JSON.parse(localStorage.getItem(\"emailToView\")).fromWhere;\r\n if (fromWhere == FROM_ADMIN_INBOX) {\r\n linkAdminCompose(fromWhere);\r\n } else if (fromWhere == FROM_STUDENT_INBOX) {\r\n linkStudentCompose(fromWhere);\r\n }\r\n } catch(e) {\r\n alert(e.name + \"\\n\" + e.message);\r\n }\r\n}",
"function aboutmeClick(){\r\n\t\tcallAjax(createAboutme, \"aboutme\", \"get\");\r\n\t}",
"function inviteToChat() {\n if (selectedContactRegIds.length > 0) {\n messenger.chatInvite(selectedChatId, selectedContactRegIds).then(function () {\n console.log(\"inviteToChat: done for \" + selectedContactRegIds);\n });\n }\n\n //Switch back to the chat tab\n showTab(\"chat\");\n}",
"render() {\n const currentUser = JSON.parse(sessionStorage.getItem(\"credentials\"))\n if (parseInt(this.props.user.userId) === currentUser.id) {\n return <></>\n } else {\n if (this.props.user.vetoad === true && this.props.user.canSuggestEvent === false) {\n return (\n <Card className='participantCard'>\n <Card.Content className='participantCard'>\n <li>\n <div className='participantButtonContainer'>\n <p className='addEventUserName'>{this.props.user.name}</p>\n <div className='addEventButtonContainer'>\n <Button className='addEventButtons' color='green' onClick={() => this.props.updateVetoad(this.props.user.userId)}>Vetoad</Button>\n <Button className='addEventButtons' onClick={() => this.props.updateCanSuggestEvent(this.props.user.userId)}>Make Contributor</Button>\n <Button className='addEventButtons' icon='trash alternate outline' onClick={() => this.props.removeParticipant(this.props.user.userId)}></Button>\n </div>\n </div>\n </li>\n </Card.Content>\n </Card>\n )\n } else if (this.props.user.canSuggestEvent === true && this.props.user.vetoad === false) {\n return (\n <Card className='participantCard'>\n <Card.Content className='participantCard'>\n <li>\n <div className='participantButtonContainer'>\n <p className='addEventUserName'>{this.props.user.name}</p>\n <div className='addEventButtonContainer'>\n <Button className='addEventButtons' onClick={() => this.props.updateVetoad(this.props.user.userId)}>Vetoad</Button>\n <Button className='addEventButtons' color='green' onClick={() => this.props.updateCanSuggestEvent(this.props.user.userId)}>Make Contributor</Button>\n <Button className='addEventButtons' icon='trash alternate outline' onClick={() => this.props.removeParticipant(this.props.user.userId)}></Button>\n </div>\n </div>\n </li>\n </Card.Content>\n </Card>\n )\n } else if (this.props.user.canSuggestEvent === true && this.props.user.vetoad === true) {\n return (\n <Card className='participantCard'>\n <Card.Content className='participantCard'>\n <li>\n <div className='participantButtonContainer'>\n <p className='addEventUserName'>{this.props.user.name}</p>\n <div className='addEventButtonContainer'>\n <Button className='addEventButtons' color='green' onClick={() => this.props.updateVetoad(this.props.user.userId)}>Vetoad</Button>\n <Button className='addEventButtons' onClick={() => this.props.updateCanSuggestEvent(this.props.user.userId)} color='green'>Make Contributor</Button>\n <Button className='addEventButtons' icon='trash alternate outline' onClick={() => this.props.removeParticipant(this.props.user.userId)}></Button>\n </div>\n </div>\n </li>\n </Card.Content>\n </Card>\n )\n } else {\n return (\n <Card className='participantCard'>\n <Card.Content className='participantCard'>\n <li>\n <div className='participantButtonContainer'>\n <p className='addEventUserName'>{this.props.user.name}</p>\n <div className='addEventButtonContainer'>\n <Button className='addEventButtons' onClick={() => this.props.updateVetoad(this.props.user.userId)}>Vetoad</Button>\n <Button className='addEventButtons' onClick={() => this.props.updateCanSuggestEvent(this.props.user.userId)}>Make Contributor</Button>\n <Button className='addEventButtons' icon='trash alternate outline' onClick={() => this.props.removeParticipant(this.props.user.userId)}></Button>\n </div>\n </div>\n </li>\n </Card.Content>\n </Card>\n )\n }\n }\n }",
"function onClickName() {\n /*\n document.getElementById(\"dark-mode-user-name\").textContent = prompt(\"What do you want your name to be\");\n picture = prompt(\"Link for image\");\n name = document.getElementById(\"dark-mode-user-name\").textContent;\n socket.emit('profile', picture);\n socket.emit('new-user', name);\n */\n var closeModal = document.getElementById('close-modal');\n var okProfile = document.getElementById('ok-profile');\n okProfile.addEventListener('click', profileInputHandle);\n closeModal.addEventListener('click', cancelModal);\n ShowModal();\n \n}",
"function userLoggedInListener (roomName, occupants, isPrimary) {\n //update the global occupants list for this user.\n all_occupants_list = occupants;\n\n //as this callback method is also called on any user disconnection...\n //remove any 'zombie' easyrtc id from 'all_occupants_details' variable\n removeZombieClientsFromOccupantsDetails(occupants);\n\n //update the online/offline status as per the new list.\n //this update is important for someone leaves the connection.\n updateOnlineStatusOfClients(all_occupants_details);\n\n //spawn telepointers for the logged in users.\n spawnTelepointers(occupants);\n\n //inform my email, name along with easyrtc id, which is later used for different tracking\n informMyDetailsToAllOtherClients(occupants);\n\n //notifyAll('disconnected', \"Hello\");\n\n\n //FOR VIDEO STRM\n clearConnectList();\n var otherClientDiv = document.getElementById(\"otherClients\");\n for(var easyrtcid in occupants) {\n var button = document.createElement(\"button\");\n button.onclick = function(easyrtcid) {\n return function() {\n performCall(easyrtcid);\n };\n }(easyrtcid);\n var label = document.createTextNode(\"Call \" + getNameForAnEasyRTCid( easyrtc.idToName(easyrtcid) ) );\n button.appendChild(label);\n otherClientDiv.appendChild(button);\n }\n\n\n\n\n\n}",
"goToChat(roomId, title, active, trainerPic, opponentId) {\n if (this.props.connectedToSendBird)\n this.props.gotoChatView({\n roomId,\n title,\n active,\n trainerPic,\n opponentId\n });\n }",
"joined() {\n this.app.setAlert(<Alert type=\"success\">{i18n('followed')}</Alert>);\n\n this.setState({\n changePending: false,\n });\n\n // Analytics tracking\n Backbone.trigger(\n 'analytics:trackEvent',\n 'Activity',\n 'Followed ' + this.props.followType,\n this.props.trackLabel,\n );\n }",
"function switchToConnected() {\n // show and hide the proper navbar sections\n document.getElementById(\"connectedNav\").style.display = \"inherit\";\n document.getElementById(\"notConnectedNav\").style.display = \"none\";\n // display the welcome message\n document.getElementById(\"welcomeUser\").innerHTML = \"Bienvenue <b>\" + getUsername() + \"</b>\";\n // display the list of users\n displayUsersList();\n}",
"function loggedInAttend(I,result,source){\n if(result.status == 1){\n userData.visitorId = result.visitor_id ;\n userData.encodeId = result.encode_id ;\n profileUpdate();\n if(source == 'interest'){\n $('.covid-follow').remove();\n }\n if(pageType == 'live' && (source == 'video_comment')){\n user_profile_complete(I,result,'video_comment');\n }\n if(result.isComplete==1)\n gaEvent(\"Goal\",\"Thank You after 2nd screen\");\n if((pageType=='live') && ($(I).hasClass('live-eve-follow') || $(I).hasClass('vid-eve-follow'))){\n if($(I).hasClass('vid-eve-follow')){\n $('#TenTimes-Modal').modal('hide');\n $('.vid-eve-follow').html(\"<i class='fa fa-check fa-fw'></i> Following\").addClass('disabled');\n }\n return true;\n } \n if( pageType == 'profile' || source== 'followVs' || pageType == 'org_detail' || (typeof only_thankyou!=='undefined' && only_thankyou==1)){\n // consentup(10);\n if($(eventData.dis).hasClass(\"action-dir\")) {\n map_open($(\"#event_latitude\").html(),$(\"#event_longude\").html(),1);\n hitMyData();\n return true;\n }\n showThank('event');\n }\n else if(pageType == 'about' && $(I).hasClass('download_brochure')){\n window.open($(I).data('url'));\n download_brochure($('#br_id').val());\n return true;\n }\n else if(pageType == 'dashboard_events'){\n // consentup(10);\n swap_function(I,source);\n } \n else if(source.search(/orgdetails/)>-1){ \n \n \n if($('#modalData').html() == \"\")\n $('#modalData').html(getModal());\n $('#TenTimes-Modal .modal-dialog').removeClass('modal-500');\n $('#TenTimes-Modal .modal-dialog').addClass('modal-740');\n $('#TenTimes-Modal .modal-title').replaceWith(function() { return \"<h3 class='modal-title' id='myModalLabel'\"+\">\" + this.innerHTML + \"</h3>\"; });\n $('#TenTimes-Modal .modal-title').html('');\n var data = {\n pageType:pageType,\n for:'verify_modal',\n orgdetailsSource:orgdetailsSource\n };\n var messageHtml='';\n $.ajax({\n type: \"POST\",\n url: site_url_attend + \"/ajax/modaldata\",\n data:data,\n success: function(n) {\n messageHtml=$.parseJSON(n);\n $('#TenTimes-Modal .modal-title').html(messageHtml.title);\n $('#TenTimes-Modal .modal-title').siblings('h5').remove();\n $('#TenTimes-Modal .modal-body').html('');\n $('#TenTimes-Modal').modal('show');\n if(orgdetailsSource == \"ticket\"){\n var requestfor = \"ticket\";\n }\n else if(orgdetailsSource == \"webinar\"){\n var requestfor = \"webinar\";\n }\n else {\n var requestfor = \"eventContact\"; \n }\n var userResult = result;\n var userResult = result; \n if (typeof $(\"#privateFlag\").val()!='undefined' ){\n var privateFlag=1\n }\n else{\n var privateFlag=0\n }\n \n $.ajax({type: \"GET\", url: site_url_attend + \"/ajax?for=\"+requestfor+\"&eventId=\"+eventData.id+\"&privateFlag=\"+privateFlag,\n success: function(result) {\n var newData= JSON.parse(result);\n if(orgdetailsSource == \"website\" || orgdetailsSource == \"ticket\") {\n if(orgdetailsSource == \"website\"){\n contactWebsite = newData.event_website;\n var websiteIsValid = newData.websiteIsValid;\n }\n else {\n if(newData.status == '1' || newData.status.code == 1) {\n contactWebsite = newData.data;\n var websiteIsValid = newData.isvalid;\n }\n }\n if (websiteIsValid == 1) {\n var websiteTab = window.open();\n if(websiteTab == null) { \n showPopupBlockMessage(contactWebsite , orgdetailsSource);\n }\n else{\n $('#TenTimes-Modal').modal('hide');\n websiteTab.location.href = contactWebsite;\n }\n }\n else {\n showOrgWebsite(orgdetailsSource,userResult);\n }\n }\n if(orgdetailsSource == \"webinar\") {\n var agendaTitles = [];\n var webcastUrls = [];\n var webinarUrl = '';\n for(var i=0; i < newData['data']['agenda'].length ; i++){\n let data = newData[\"data\"][\"agenda\"][i];\n agendaTitles.push(data[\"title\"]);\n if(newData['data']['agenda'][i]['id'] == $(eventData.dis).attr('data-id')){\n webinarUrl = newData['data']['agenda'][i]['attachment']['webcasturl'];\n } else {\n if(nullCheck(data[\"attachment\"])) {\n data = data[\"attachment\"];\n if(nullCheck(data['webcasturl'])) {\n webcastUrls.push(data['webcasturl']);\n }\n }\n }\n }\n webcastUrls.push(webinarUrl);\n showPopupBlockMessage(webcastUrls, orgdetailsSource, agendaTitles);\n }\n if(orgdetailsSource == \"contact\") {\n contactName = newData['contacts'][0]['name'];\n contactEmail = newData['contacts'][0]['email'];\n contactPhone = newData['contacts'][0]['phone'];\n showOrgContact(newData['contacts']);\n }\n }\n });\n },\n error: function(data){\n showToast('Something went wrong!!!');\n }\n });\n \n \n }\n else if(pageType == \"live\"){\n if(source=='bookmark'){\n $(I).removeAttr('onclick');\n $(I).children().removeClass('fa-bookmark-o').addClass('fa-bookmark');\n $(I).children().addClass('text-orange').removeClass('text-muted');\n showThank('event');\n }\n }\n else if(\"ProfileDash\" == pageType)\n dashboardAttendResponse(I, source)\n else if(typeof source != \"undefined\" && getStallFlag(source) == 1){\n if(result.stallAnswer==1)\n redirectTo(result,source);\n else\n openQuestion(source,result);\n }\n else if(pageType == 'listing' || pageType==\"org_detail\" || pageType=='venue_detail' || pageType.search('top100')>-1 || pageType=='homepage'){\n if(source.search(\"follow\") > -1 || source.search(\"bookmark\") > -1 || source.search(\"interest\") > -1){\n if(pageType=='venue_detail' || pageType=='homepage' || pageType == 'org_detail')\n hitMyData();\n\n show_thankyou == true ? showThank('event') : postActionResponse();\n }\n else{ \n redirectTo(result,source);\n }\n }\n else if (pageType=='group' && source=='going'){\n hitMyData();\n showThank('event');\n }\n else if (pageType=='thankyou_new' || pageType=='register_new' || pageType=='login_new')\n updateActionButtonsThankyou(source,I);\n else if (pageType=='udash_recommendation')\n {\n updateActionButton(source,I); \n showThank('event'); \n }\n else{\n if($(I).hasClass(\"stopRedirection\"))\n {\n if(pageType == \"about\"){\n if(source=='interest'){\n $(I).html('<i class=\"fa fa-check text-orange\" aria-hidden=\"true\"></i> Interested').removeAttr( \"onClick\" );\n $(I).css(\"pointer-events\",\"none\");\n $(I).addClass(\"text-orange\");\n $(I).parent().siblings().find(\".orgEventbm\")\n $(I).parent().siblings().find(\".orgEventbm\").removeAttr('onclick');\n $(I).parent().siblings().find(\".orgEventbm\").children().removeClass('fa-bookmark-o').addClass('fa-bookmark');\n $(I).parent().siblings().find(\".orgEventbm\").children().addClass('text-orange');\n showThank('event');\n }\n else if(source == 'bookmark'){\n $(I).removeAttr('onclick');\n $(I).children().removeClass('fa-bookmark-o').addClass('fa-bookmark');\n $(I).children().addClass('text-orange');\n showThank('event');\n }\n }\n if((pageType == \"speakers\" || pageType == \"visitors\") && source == \"bookmark\")\n {\n $(I).removeClass('fa-bookmark-o text-muted').addClass('fa-bookmark text-orange').removeAttr( \"onClick\" );\n $(I).css(\"pointer-events\",\"none\");\n }\n if((pageType == \"speakers\" || pageType == \"visitors\") && source == \"interested_attend\")\n {\n $(I).html('<i class=\"fa fa-check\" aria-hidden=\"true\"></i> Join Community').css('opacity','0.7').removeAttr( \"onClick\" );\n $(I).css(\"pointer-events\",\"none\");\n }\n return true;\n }\n if($(I).hasClass(\"agendaWatch\")){\n if($('.action-in').text() == 'Interested')\n var actionBtn = 'Interested';\n else if($('.action-in').text() == 'Follow')\n var actionBtn = 'Following';\n else if($('.action-in').text() == 'Register')\n var actionBtn = 'Registered'; \n if($(I).hasClass(\"a-m\")) {\n $('.action-in').html('<i class=\"fa fa-check\" aria-hidden=\"true\"></i> '+actionBtn).unbind('click').click(function(){alreadyClickAction(this)});\n $('.action-fix-in').html('<i class=\"fa fa-check\" aria-hidden=\"true\"></i> '+actionBtn).unbind('click').click(function(){alreadyClickAction(this)});\n $(\".action-save\").html(\"<i class='fa fa-bookmark fa-fw text-orange'></i> \"+actionBtn).unbind('click').click(function(){alreadyClickAction(this)});\n }\n postActionResponse();\n return true;\n } \n redirectTo(result,source);\n }\n }\n\n else{\n showloading(); \n if(result.status == 0 && result.hasOwnProperty('error') && result.hasOwnProperty('userData') && result.userData.hasOwnProperty('id') && result.error.hasOwnProperty('invalidData')){\n $( \".modal-backdrop\" ).removeClass('modal-backdrop');\n var attendInput = ['fields','title','social','subtitle','actionName','actionLabel','eventId','eventName'];\n var tag = source.search(\"follow\");\n if(tag > -1){\n attendInput['fields'] = ['name','user','city','company','designation','phone'];\n attendInput['actionLabel'] = 'Follow Now';\n }\n else if(hide_individual == 1)\n {\n attendInput['fields'] = ['name','user','city','company','designation','phone','autointroduce'];\n attendInput['actionLabel'] = 'Send Stall Booking Request';\n }\n else{\n attendInput['fields'] = ['name','user','city','company','designation','phone','autointroduce'];\n attendInput['actionLabel'] = 'Submit'; \n }\n attendInput['title'] = getTitle();\n attendInput['subtitle'] = getSubTitle();\n attendInput['eventName'] = getEventName();\n attendInput['eventId'] = getEventId();\n attendInput['actionName'] = \"gaEvent('User','Basic Popup Submit');RegisterForm();\";\n getForm(function (modalHtml){\n $(\"#modalData\").html(modalHtml.mainHtml); \n \n if(hide_individual == 1)\n $(\"#checkDiv\").hide();\n if(!document.getElementById('userSource')){\n $(\"#TenTimes-Modal\").append(addHidden('user_source','userSource','')); \n }\n $(\"#TenTimes-Modal\").modal(\"show\");\n if(result.userData.userCompany==null || result.userData.userCompany==''){\n getcompanydata(function(z){\n result.userData.userCompany=z.data[0].name;\n $('#userCompany').val(z.data[0].name);\n $('.alert_company').css('display','none');\n });\n }\n showValidationError(result);\n calling_detail();\n profileUpdate();\n gaEvent('User','Basic Popup Open');\n hideloading(); \n clickCompany();\n postFormOpenSettings(result.userData.country);\n var phoneno='';\n if(getCookie('user_token'))\n phoneno=result.userData.number_valid.nationalFormat;\n\n vcardopen(result.userData.name,result.userData.email,result.userData.designation,result.userData.userCompany,result.userData.cityName,result.userData.countryName,'',result.userData.id,result.userData.profilepicture,phoneno,result.userData.place_id);\n\n $('[data-toggle=\"tooltip\"]').tooltip();\n $(\"#TenTimes-Modal #userSource\").val(source);\n openform();\n },attendInput,source);\n }\n else{\n // consentup(10);\n window.location.assign(login_url + \"/ticket_transaction/going/\" + eventData.id);\n }\n hideloading();\n }\n}",
"function handleClickOnSeparatePersonChat() {\n var eventPersonId = Number($(this).attr(\"data-inter-id\"));\n\n if (eventPersonId === currentActiveDiscussionId) {\n return;\n }\n $(chatInterContElement).removeClass(\"is-active\");\n $(this).addClass(\"is-active\");\n refreshEventsList(eventPersonId);\n } // end of click on separate person in interpreters list handler function",
"function i(e){return(0,w.default)(e.participants,{state:\"JOINED\"})}",
"function onConnect() {\n // Once a connection has been made, make a subscription and send a message.\n console.log(\"onConnect\");\n //document.getElementById('no-connection').style.visibility = 'hidden';\n $('#myModal').modal('hide');\n client.subscribe(\"shercolor/#\", {\n qos: 2\n });\n}",
"function selectConciergeFromList(){\n var parentUl = $('.user-content').children('ul');\n var users = parentUl.children('li');\n var user = users.get(0);\n\n // Clear message contents..\n $('#messages').html('');\n\n // Set user to select..\n for(var i = 0; i < users.length; i++) {\n user = users.get(i);\n user.setAttribute(\"style\", \"\");\n }\n users.get(0).setAttribute(\"style\", \"background-color: #eee;\");\n selectedIndex = 0;\n\n disableActionButton();\n var oneUser = {\n id : \"CONCIERGE\",\n contact_id: \"Concierge_\" + userSelf.email,\n username : \"Concierge\",\n email : \"CONCIERGE EMAIL\",\n img : \"/images/concierge.png\"\n };\n\n selectFlag = \"CON\";\n userSelected = oneUser;\n\n showUserInfo(oneUser);\n\n curConvId = \"Concierge_\" + userSelf.email;\n // Load conversation content of this user..\n var msgObj = {\n from: userSelf.email,\n contact_id: \"Concierge_\" + userSelf.email\n };\n socket.emit('loadConv', msgObj);\n}",
"function activateChat() {\n $('#helpandchatimg').attr('alt', 'Chat');\n $('#helpandchatimg').attr('src', '/sites/all/themes/corvusbie/images/comment-discussion.svg');\n $('#helpandchattext').text('Ask a Librarian');\n $('#helpandchatlink').attr('href', '#');\n $('#helpandchatlink').click(function( event ) {\n event.preventDefault();\n window.open(\"https://ca.libraryh3lp.com/chat/[email protected]?skin=15653\", \"AskUs\", \"resizable=1,width=375,height=350\");\n });\n }",
"function displayWelcome() {\n Reddcoin.messenger.getAppState(response => {\n if (!response.walletObj.dataAvailable) {\n $('#frame-wallet-interact').hide();\n $('#frame-wallet-interact').removeClass('active');\n $('#menuRegister').hide();\n $('#nav').hide();\n\n let bubbles = $(\".intro-bubble\"),\n frame;\n\n setInterval(function() {\n if (!$('#frame-intro').hasClass('active')) {\n return;\n }\n\n for (let i = 0, n = bubbles.length; i < n; i++) {\n let bubble = bubbles[i];\n\n if (bubble.classList.contains('active')) {\n let attribute = bubble.getAttribute('data-frame');\n\n frame = parseInt(attribute[attribute.length - 1]) + 1;\n\n if (frame > 4) {\n frame = 1;\n }\n\n $(`[data-frame='intro-${frame}']`).trigger('click');\n return;\n }\n }\n }, 1000 * 10);\n }\n else {\n $('#frame-intro').hide();\n $('#menuRegister').show();\n $('#nav').show();\n\n $('#header').show();\n\n $('#frames').addClass('frames--wallet');\n\n displayWallet();\n\n Reddcoin.messenger.getUserIds(function (result) {\n debug.log(`${result.length} user ids registered`);\n\n if (result.length > 0) {\n $('.reddid--greyed').addClass('disabled');\n\n $('.reddid--button-replace').replaceWith(`\n <div class=\"create-reddid button button--center button--faded button--full button--red button--large button--static\">\n ${result[0]}\n </div>\n `);\n }\n });\n }\n });\n}",
"function inviteOthers() {\n //specify inviteContacts as tab so it will customize button\n showTab(\"inviteContacts\");\n}"
] |
[
"0.6197418",
"0.6117911",
"0.5996526",
"0.590721",
"0.58773685",
"0.5848359",
"0.5722655",
"0.56414956",
"0.56211436",
"0.5587096",
"0.5571765",
"0.5542437",
"0.5498132",
"0.5498008",
"0.54924893",
"0.5484999",
"0.54826796",
"0.5481697",
"0.54814404",
"0.547902",
"0.54433036",
"0.54333913",
"0.5412315",
"0.5405626",
"0.5373386",
"0.53625923",
"0.53589964",
"0.5356966",
"0.5353379",
"0.5335486"
] |
0.75869477
|
0
|
Functions: Loads list of available website crawlers.
|
function loadCrawlers(e) {
var datalist = document.getElementById('website-crawlers');
var country = $('input[name=country]:checked').val();
var crawlers = {
uk: [
'Yell.com'
],
us: [
'Citysearch.com',
'Yellowpages.com',
'Restaurant.com',
'Tripdavisor.com',
'Yelp.com'
]
}
var crawler;
if (country == 'United States') {
crawler = crawlers['us'];
} else if (country == 'United Kingdom') {
crawler = crawlers['uk'];
}
if (datalist.hasChildNodes()) {
while (datalist.firstChild) {
datalist.removeChild(datalist.firstChild);
}
}
for (var i = 0; i < crawler.length; i++) {
var option = document.createElement('option');
option.value = crawler[i];
datalist.appendChild(option);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function getDeslideSupportedSites() {\n return { \n 'about.com': '*.about.com', 'accessatlanta.com': '*.accessatlanta.com', 'answers.com': '*.answers.com', 'aol.com': '*.aol.com', 'askmen.com': '*.askmen.com', 'bleacherreport.com': '*.bleacherreport.com', 'cafemom.com': '*.cafemom.com', 'cbslocal.com': '*.cbslocal.com', 'cnn.com': '*.cnn.com', 'competitor.com': '*.competitor.com', 'complex.com': '*.complex.com', 'egotastic.com': '*.egotastic.com', 'eonline.com': '*.eonline.com', 'ew.com': '*.ew.com', 'fark.com': '*.fark.com', 'forbes.com': '*.forbes.com', 'howstuffworks.com': '*.howstuffworks.com', 'ibtimes.com': '*.ibtimes.com', 'imageshack.us': '*.imageshack.us', 'instyle.com': '*.instyle.com', 'latimes.com': '*.latimes.com', 'likes.com': '*.likes.com', 'mercurynews.com': '*.mercurynews.com', 'metromix.com': '*.metromix.com', 'msn.com': '*.msn.com', 'nymag.com': '*.nymag.com', 'nytimes.com': '*.nytimes.com', 'omaha.com': '*.omaha.com', 'photobucket.com': '*.photobucket.com', 'reuters.com': '*.reuters.com', 'seriouseats.com': '*.seriouseats.com', 'sfgate.com': '*.sfgate.com', 'slate.com': '*.slate.com', 'talkingpointsmemo.com': '*.talkingpointsmemo.com', 'theglobeandmail.com': '*.theglobeandmail.com', 'time.com': '*.time.com', 'topix.com': '*.topix.com', 'uproxx.com': '*.uproxx.com', 'viralnova.com': '*.viralnova.com', 'wtnh.com': '*.wtnh.com', 'yahoo.com': '*.yahoo.com', 'diply.com': '*diply.com', 'wildammo.com': '*wildammo.com', //' ': 'Coppermine galleries', // huh?\n 'abcnews.go.com': 'abcnews.go.com', \n 'espn.go.com': 'espn.go.com', 'all-that-is-interesting.com': 'all-that-is-interesting.com', 'animal.discovery.com': 'animal.discovery.com', 'arstechnica.com': 'arstechnica.com', 'austin.culturemap.com': 'austin.culturemap.com', 'blastr.com': 'blastr.com', 'blog.chron.com': 'blog.chron.com', 'blog.laptopmag.com': 'blog.laptopmag.com', 'blog.makezine.com': 'blog.makezine.com', 'blog.moviefone.com': 'blog.moviefone.com', 'blog.seattlepi.com': 'blog.seattlepi.com', 'blog.timesunion.com': 'blog.timesunion.com', 'blog.amctv.com': 'blogs.amctv.com', 'blog.laweekly.com': 'blogs.laweekly.com', 'bossip.com': 'bossip.com', 'boston.com': 'boston.com', 'thestreet.com': 'business-news.thestreet.com', 'bustedcoverage.com': 'bustedcoverage.com', 'buzzlie.com': 'buzzlie.com', 'celebritytoob.com': 'celebritytoob.com', 'celebuzz.com': 'celebslam.celebuzz.com', 'coed.com': 'coed.com', 'coedmagazine.com': 'coedmagazine.com', 'collegecandy.com': 'collegecandy.com', 'kiplinger.com': 'content.kiplinger.com', 'dailycaller.ca': 'dailycaller.ca', 'dailycaller.com': 'dailycaller.com', 'dailysanctuary.com': 'dailysanctuary.com', 'dallas.culturemap.com': 'dallas.culturemap.com', 'darkroom.baltimoresun.com': 'darkroom.baltimoresun.com', 'deadspin.com': 'deadspin.com', 'definition.org': 'definition.org', 'diffuser.fm': 'diffuser.fm', 'dvice.com': 'dvice.com', 'einestages.spiegel.de': 'einestages.spiegel.de', 'emgn.com': 'emgn.com', 'empireonline.com': 'empireonline.com', 'english.caixin.com': 'english.caixin.com', \n 'fansided.com': 'fansided.com', 'fashion.telegraph.co.uk': 'fashion.telegraph.co.uk', 'firstwefeast.com': 'firstwefeast.com', 'flavorwire.com': 'flavorwire.com', 'fu-berlin.de': 'fu-berlin.de', 'funnie.st': 'funnie.st', 'gamedayr.com': 'gamedayr.com', 'gamerant.com': 'gamerant.com', 'gamingbolt.com': 'gamingbolt.com', 'gawker.com': 'gawker.com', // Gawker Are Fucking Dead\n 'gizmodo.com': 'gizmodo.com', 'gothamist.com': 'gothamist.com', 'guff.com': 'guff.com', 'guyism.com': 'guyism.com', 'hdden.com': 'hdden.com', 'heavy.com': 'heavy.com', 'heldendesalltags.net': 'heldendesalltags.net', 'hollywoodlife.com': 'hollywoodlife.com', 'houston.culturemap.com': 'houston.culturemap.com', 'humorsignals.com': 'humorsignals.com', 'idolator.com': 'idolator.com', 'images.businessweek.com': 'images.businessweek.com', 'imgur.com': 'imgur.com', 'io9.com': 'io9.com', 'jalopnik.com': 'jalopnik.com', 'jezebel.com': 'jezebel.com', 'juicyceleb.com': 'juicyceleb.com', 'justviral.eu': 'justviral.eu', 'kittentoob.com': 'kittentoob.com', 'kotaku.com': 'kotaku.com', 'lifehacker.com': 'lifehacker.com', 'listcovery.com': 'listcovery.com', 'lotsoflaughters.com': 'lotoflaughters.com', 'm.n4g.com': 'm.n4g.com', 'm.spiegel.de': 'm.spiegel.de', 'madamenoire.com': 'madamenoire.com', 'makezine.com': 'makezine.com', 'mashable.com': 'mashable.com', 'mediacenter.dailycamera.com': 'mediacenter.dailycamera.com', 'mediagallery.usatoday.com': 'mediagallery.usatoday.com', 'menify.com': 'menify.com', 'mentalflare.com': 'mentalflare.com', 'metv.com': 'metv.com', 'mommynoire.com': 'mommynoire.com', 'motherjones.com': 'motherjones.com', 'moviesum.com': 'movieseum.com', 'msn.foxsports.com': 'msn.foxsports.com', 'myfox8.com': 'myfox8.com', 'n4g.com': 'n4g.com', 'natmonitor.com': 'natmonitor.com', 'news.cincinnati.com': 'news.cincinnati.com', 'news.cnet.com': 'news.cnet.com', 'news.discovery.com': 'news.discovery.com', 'news.moviefone.com': 'news.moviefone.com', 'news.nationalgeographic.com': 'news.nationalgeographic.com', 'news.xinhuanet.com': 'news.xinhuanet.com', 'nflspinzone.com': 'nflspinzone.com', 'noisey.vice.com': 'noisey.vice.com', 'nypost.com': 'nypost.com', 'opinion.people.com.cn': 'opinion.people.com.cn', 'origin.wtsp.com': 'origin.wtsp.com', 'perezhilton.com': 'perezhilton.com', 'photos.caixin.com': 'photos.caixin.com', 'photos.denverpost.com': 'photos.denverpost.com', 'photos.ellen.warnerbros.com': 'photos.ellen.warnerbros.com', 'photos.nj.com': 'photos.nj.com', 'photos.pennlive.com': 'photos.pennlive.com', 'photos.tmz.com': 'photos.tmz.com', 'photos.toofab.com': 'photos.toofab.com', 'picasaweb.google.com': 'picasaweb.google.com', 'popnhop.com': 'popnhop.com', 'puppytoob.com': 'puppytoob.com', 'pyz.am': 'pyz.am', 'radaronline.com': 'radaronline.com', 'rantchic.com': 'rantchic.com', 'regretfulmorning.com': 'regretfulmorning.com', 'reviews.cnet.com': 'reviews.cnet.com', 'ripbird.com': 'ripbird.com', 'rottenpanda.com': 'rottenpanda.com', 'runt-of-the-web.com': 'runt-of-the-web.com', 'salary.com': 'salary.com', 'screencrush.com': 'screencrush.com', 'screenrant.com': 'screenrant.com', 'seattletimes.com': 'seattletimes.com', 'seattletimes.nwsource.com': 'seattletimes.nwsource.com', 'shortlist.com': 'shortlist.com', 'slideshow.nbcnews.com': 'slideshow.nbcnews.com', 'slideshow.today.com': 'slideshow.today.com', 'slideshows.collegehumor.com': 'slideshows.collegehumor.com', 'socialitelife.com': 'socialitelife.com', 'static.thefrisky.com': 'static.thefrisky.com', 'story.wittyfeed.com': 'story.wittyfeed.com', 'styleblazer.com': 'styleblazer.com', 'sz-magazin.sueddeutsche.de': 'sz-magazin.sueddeutsche.de', 'theblemish.com': 'theblemish.com', 'thehill.com': 'thehill.com', 'theweek.com': 'theweek.com', 'thewire.co.uk': 'thewire.co.uk', 'time.com': 'time.com', 'travel.allwomenstalk.com': 'travel.allwomenstalk.com', // always wonder how to parse this - \"all women's talk\" or \"all women stalk\"??\n 'twentytwowords.com': 'twentytwowords.com', 'venturebeat.com': 'venturebeat.com', 'viewmixed.com': 'viewmixed.com', 'wallstcheatsheet.com': 'wallstcheatsheet.com', 'whatculture.com': 'whatculture.com', 'worldwideinterweb.com': 'worldwideinterweb.com', 'worthly.com': 'worthly.com', 'wtkr.com': 'wtkr.com', 'wtvr.com': 'wtvr.com', '10best.com': 'www.10best.com', '123inspiration.com': 'www.123inspiration.com', '29-95.com': 'www.29-95.com', 'aarp.org': 'www.aarp.org', 'adweek.com': 'www.adweek.com', 'ajc.com': 'www.ajc.com', 'animalplanet.com': 'www.animalplanet.com', 'aolnews.com': 'www.aolnews.com', 'art-magazin.de': 'www.art-magazin.de', 'autobild.de': 'www.autobild.de', 'azcentral.com': 'www.azcentral.com', 'azfamily.com': 'www.azfamily.com', 'babble.com': 'www.babble.com', 'baltimoresun.com': 'www.baltimoresun.com', 'bankrate.com': 'www.bankrate.com', 'bbc.co.uk': 'www.bbc.co.uk', 'bbc.com': 'www.bbc.com', 'belfasttelegraph.co.uk': 'www.belfasttelegraph.co.uk', 'bellasugar.com': 'www.bellasugar.com', 'berliner-zeitung.de': 'www.berliner-zeitung.de', 'bild.de': 'www.bild.de', 'bizjournals.com': 'www.bizjournals.com', 'blastr.com': 'www.blastr.com', 'bleedingcool.com': 'www.bleedingcool.com', 'bloomberg.com': 'www.bloomberg.com', 'bobvila.com': 'www.bobvila.com', 'bonappetit.com': 'www.bonappetit.com', 'boredlion.com': 'www.boredlion.com', 'boston.com': 'www.boston.com', 'bostonherald.com': 'www.bostonherald.com', 'bracketsdaily.com': 'www.bracketsdaily.com', 'brainjet.com': 'www.brainjet.com', 'break.com': 'www.break.com', 'brisbanetimes.com.au': 'www.brisbanetimes.com.au', 'brobible.com': 'www.brobible.com', // ew\n 'buddytv.com': 'www.buddytv.com', 'businessinsider.com': 'www.businessinsider.com', 'businessnewsdaily.com': 'www.businessnewsdaily.com', 'bustle.com': 'www.bustle.com', 'buzzfeed.com': 'www.buzzfeed.com', 'buzzsugar.com': 'www.buzzsugar.com', 'bytesized.me': 'www.bytesized.me', 'canberratimes.com.au': 'www.canberratimes.com.au', 'casasugar.com': 'www.casasugar.com', 'cbc.ca': 'www.cbc.ca', 'cbs.com': 'www.cbs.com', 'cbsnews.com': 'www.cbsnews.com', 'cbssports.com': 'www.cbssports.com', 'celebritynetworth.com': 'www.celebritynetworth.com', 'celebstyle.com': 'www.celebstyle.com', // ' ': 'www.celebuzz.com', \n 'celebzen.com': 'www.celebzen.com', 'celebzen.com.au': 'www.celebzen.com.au', 'chacha.com': 'www.chacha.com', 'cheatcc.com': 'www.cheatcc.com', 'chicagotribune.com': 'www.chicagotribune.com', 'chip.de': 'www.chip.de', 'chron.com': 'www.chron.com', 'cinemablend.com': 'www.cinemablend.com', 'cio.com': 'www.cio.com', 'classicfm.com': 'www.classicfm.com', 'clickorlando.com': 'www.clickorlando.com', 'cnbc.com': 'www.cnbc.com', 'cntraveler.com': 'www.cntraveler.com', 'collegehumor.com': 'www.collegehumor.com', 'comicbookmovie.com': 'www.comicbookmovie.com', 'complexmag.ca': 'www.complexmag.ca', 'complexmag.com': 'www.complexmag.com', 'computerworld.com': 'www.computerworld.com', 'corriere.it': 'www.corriere.it', 'cosmopolitan.co.uk': 'www.cosmopolitan.co.uk', 'cosmopolitan.com ': 'www.cosmopolitan.com', 'courant.com': 'www.courant.com', 'cracked.com': 'www.cracked.com', 'csmonitor.com': 'www.csmonitor.com', 'csoonline.com': 'www.csoonline.com', 'ctnow.com': 'www.ctnow.com', 'dailyfunlists.com': 'www.dailyfunlists.com', 'dailygazette.com': 'www.dailygazette.com', 'dallasobserver.com': 'www.dallasobserver.com', 'darkreading.com': 'www.darkreading.com', 'daytondailynews.com': 'www.daytondailynews.com', 'delish.com': 'www.delish.com', 'designsponge.com': 'www.designsponge.com', 'desmoinesregister.com': 'www.desmoinesregister.com', 'digitalone.com.sg': 'www.digitalone.com.sg', 'digitalspy.co.uk': 'www.digitalspy.co.uk', 'digitalspy.com': 'www.digitalspy.com', 'digitalspy.com.au': 'www.digitalspy.com.au', 'dispatch.com': 'www.dispatch.com', 'dorkly.com': 'www.dorkly.com', 'ebaumsworld.com': 'www.ebaumsworld.com', 'elle.com': 'www.elle.com', 'empireonline.com': 'www.empireonline.com', 'entertainmentwise.com': 'www.entertainmentwise.com', 'environmentalgraffiti.com': 'www.environmentalgraffiti.com', 'escapehere.com': 'www.escapehere.com', 'esquire.com': 'www.esquire.com', 'everyjoe.com': 'www.everyjoe.com', 'eweek.com': 'www.eweek.com', 'examiner.com': 'www.examiner.com', 'fabsugar.com': 'www.fabsugar.com', 'fame10.com': 'www.fame10.com', 'fastcodesign.com': 'www.fastcodesign.com', 'faz.net': 'www.faz.net', 'fieldandstream.com': 'www.fieldandstream.com', 'fitsugar.com': 'www.fitsugar.com', 'flavorwire.com': 'www.flavorwire.com', 'focus.de': 'www.focus.de', 'food.com': 'www.food.com', 'foodandwine.com': 'www.foodandwine.com', 'footballnation.com': 'www.footballnation.com', 'foreignpolicy.com': 'www.foreignpolicy.com', 'fox2now.com': 'www.fox2now.com', 'fox40.com': 'www.fox40.com', 'fox59.com': 'www.fox59.com', 'fox5sandiego.com': 'www.fox5sandiego.com', 'foxnews.com': 'www.foxnews.com', 'fr-online.de': 'www.fr-online.de', 'gameranx.com': 'www.gameranx.com', 'gamesblog.it': 'www.gamesblog.it', 'gamespot.com': 'www.gamespot.com', 'gamesradar.com': 'www.gamesradar.com', 'geeksaresexy.net': 'www.geeksaresexy.net', 'geeksugar.com': 'www.geeksugar.com', 'gigwise.com': 'www.gigwise.com', 'gizmopod.com': 'www.gizmopod.com', 'golf.com': 'www.golf.com', 'gq.com': 'www.gq.com', 'grated.com': 'www.grated.com', 'guardian.co.uk': 'www.guardian.co.uk', 'haikudeck.com': 'www.haikudeck.com', 'harpersbazaar.com': 'www.harpersbazaar.com', 'health.com': 'www.health.com', 'heise.de': 'www.heise.de', 'hgtvremodels.com': 'www.hgtvremodels.com', 'highrated.net': 'www.highrated.net', 'hitfix.com': 'www.hitfix.com', 'hlntv.com': 'www.hlntv.com', 'hollyscoop.com': 'www.hollyscoop.com', 'hollywood.com': 'www.hollywood.com', 'hollywoodreporter.com': 'www.hollywoodreporter.com', 'hollywoodtuna.com': 'www.hollywoodtuna.com', 'houstonpress.com': 'www.houstonpress.com', 'huffingtonpost.com': 'www.huffingtonpost.*', // TODO\n 'idolator.com': 'www.idolator.com', 'ign.com': 'www.ign.com', 'imdb.com': 'www.imdb.com', 'informationweek.com': 'www.informationweek.com', 'infoworld.com': 'www.infoworld.com', 'irishcentral.com': 'www.irishcentral.com', 'itworld.com': 'www.itworld.com', 'ivillage.com': 'www.ivillage.com', 'kare11.com': 'www.kare11.com', 'katu.com': 'www.katu.com', 'kentucky.com': 'www.kentucky.com', 'kicker.de': 'www.kicker.de', 'killsometime.com': 'www.killsometime.com', 'kiplinger.com': 'www.kiplinger.com', 'kitv.com': 'www.kitv.com', 'ktla.com': 'www.ktla.com', 'ktvu.com': 'www.ktvu.com', 'kvia.com': 'www.kvia.com', 'laudable.com': 'www.laudable.com', 'laweekly.com': 'www.laweekly.com', 'life.com': 'www.life.com', 'lifebuzz.com': 'www.lifebuzz.com', 'lifedaily.com': 'www.lifedaily.com', 'lifescript.com': 'www.lifescript.com', 'lilsugar.com': 'www.lilsugar.com', 'littlethings.com': 'www.littlethings.com', 'livescience.com': 'www.livescience.com', 'livestrong.com': 'www.livestrong.com', 'local10.com': 'www.local10.com', 'london2012.com': 'www.london2012.com', 'makezine.com': 'www.makezine.com', 'mandatory.com': 'www.mandatory.com', 'marketwatch.com': 'www.marketwatch.com', 'mcall.com': 'www.mcall.com', 'menshealth.com': 'www.menshealth.com', 'miamiherald.com': 'www.miamiherald.com', 'mirror.co.uk': 'www.mirror.co.uk', 'mlive.com': 'www.mlive.com', 'mnn.com': 'www.mnn.com', 'monopol-magazin.de': 'www.monopol-magazin.de', 'motherjones.com': 'www.motherjones.com', 'myfox8.com': 'www.myfox8.com', 'myhealthnewsdaily.com': 'www.myhealthnewsdaily.com', 'mysanantonio.com': 'www.mysanantonio.com', 'nationaltimes.com.au': 'www.nationaltimes.com.au', 'nba.com': 'www.nba.com', 'nbc.com': 'www.nbc*', // TODO\n 'nbcnews.com': 'www.nbcnews.com', 'networkworld.com': 'www.networkworld.com', 'neverunderdressed.com': 'www.neverunderdressed.com', 'news800.com': 'www.news800.com', 'newsarama.com': 'www.newsarama.com', 'newser.com': 'www.newser.com', 'newstimes.com': 'www.newstimes.com', 'newyorker.com': 'www.newyorker.com', 'nfl.com': 'www.nfl.com', 'ngz-online.de': 'www.ngz-online.de', 'nj.com': 'www.nj.com', 'nme.com': 'www.nme.com', 'notsafeforwhat.com': 'www.notsafeforwhat.com', 'npr.org': 'www.npr.org', 'nsmbl.nl': 'www.nsmbl.nl', 'numberfire.com': 'www.numberfire.com', 'nuts.co.uk': 'www.nuts.co.uk', 'nydailynews.com': 'www.nydailynews.com', 'nypost.com': 'www.nypost.com', 'ocregister.com': 'www.ocregister.com', 'ocweekly.com': 'www.ocweekly.com', 'officialplaystationmagazine.co.uk': 'www.officialplaystationmagazine.co.uk', 'omghacks.com': 'www.omghacks.com', 'opposingviews.com': 'www.opposingviews.com', 'oregonlive.com': 'www.oregonlive.com', 'orlandosentinel.com': 'www.orlandosentinel.com', 'ouramazingplanet.com': 'www.ouramazingplanet.com', 'parenting.com': 'www.parenting.com', 'parents.com': 'www.parents.com', 'parentsociety.com': 'www.parentsociety.com', 'pcgamer.com': 'www.pcgamer.com', 'pcmag.com': 'www.pcmag.com', 'pcworld.com': 'www.pcworld.com', 'people.com': 'www.people.com', 'peoplepets.com': 'www.peoplepets.com', 'peoplestylewatch.com': 'www.peoplestylewatch.com', 'petsugar.com': 'www.petsugar.com', 'philly.com': 'www.philly.com', 'phoenixnewtimes.com': 'www.phoenixnewtimes.com', 'politico.com': 'www.politico.com', 'popcrunch.com': 'www.popcrunch.com', 'popsci.com': 'www.popsci.com', 'popsugar.com': 'www.popsugar.com', 'popularmechanics.com': 'www.popularmechanics.com', 'press-citizen.com': 'www.press-citizen.com', 'pressroomvip.com': 'www.pressroomvip.com', 'q13fox.com': 'www.q13fox.com', 'ranker.com': 'www.ranker.com', 'rantchic.com': 'www.rantchic.com', 'rantfood.com': 'www.rantfood.com', 'rantlifestyle.com': 'www.rantlifestyle.com', 'rantsports.com': 'www.rantsports.com', 'rd.com': 'www.rd.com', 'readersdigest.ca': 'www.readersdigest.ca', 'realclearscience.com': 'www.realclearscience.com', 'realclearworld.com': 'www.realclearworld.com', 'realsimple.com': 'www.realsimple.com', 'realtor.com': 'www.realtor.com', 'rebelcircus.com': 'www.rebelcircus.com', 'redeyechicago.com': 'www.redeyechicago.com', 'refinedguy.com': 'www.refinedguy.com', 'refinery29.com': 'www.refinery29.com', 'repubblica.it': 'www.repubblica.it', 'riverfronttimes.com': 'www.riverfronttimes.com', 'roasted.com': 'www.roasted.com', 'rollingstone.com': 'www.rollingstone.com', 'rottenpanda.com': 'www.rottenpanda.com', 'rottentomatoes.com': 'www.rottentomatoes.com', 'rp-online.de': 'www.rp-online.de', 'rsvlts.com': 'www.rsvlts.com', // 'salary.com': 'www.salary.com', \n 'salon.com': 'www.salon.com', 'savvysugar.com': 'www.savvysugar.com', 'seattlepi.com': 'www.seattlepi.com', 'seattleweekly.com': 'www.seattleweekly.com', 'sfweekly.com': 'www.sfweekly.com', 'sfx.co.uk': 'www.sfx.co.uk', 'shape.com': 'www.shape.com', 'shebudgets.com': 'www.shebudgets.com', 'shefinds.com': 'www.shefinds.com', 'shortlist.com': 'www.shortlist.com', 'si.com': 'www.si.com', 'slideshare.net': 'www.slideshare.net', 'sltrib.com': 'www.sltrib.com', 'smh.com.au': 'www.smh.com.au', 'smithsonianmag.com': 'www.smithsonianmag.com', 'snakkle.com': 'www.snakkle.com', 'southernliving.com': 'www.southernliving.com', 'space.com': 'www.space.com', 'spiegel.de': 'www.spiegel.de', 'spin.com': 'www.spin.com', 'sportal.de': 'www.sportal.de', 'sportsradiokjr.com': 'www.sportsradiokjr.com', 'stamfordadvocate.com': 'www.stamfordadvocate.com', 'star-telegram.com': 'www.star-telegram.com', 'starpulse.com': 'www.starpulse.com', 'stereogum.com': 'www.stereogum.com', 'stereotude.com': 'www.stereotude.com', 'stern.de': 'www.stern.de', 'stuff.co.nz': 'www.stuff.co.nz', 'stuffyoushouldknow.com': 'www.stuffyoushouldknow.com', 'stylebistro.com': 'www.stylebistro.com', 'stylelist.com': 'www.stylelist.com', 'stylist.co.uk': 'www.stylist.co.uk', 'sueddeutsche.de': 'www.sueddeutsche.de', 'suggest.com': 'www.suggest.com', 'sun-sentinel.com': 'www.sun-sentinel.com', 'tagesschau.de': 'www.tagesschau.de', 'tagesspiegel.de': 'www.tagesspiegel.de', 'takepart.com': 'www.takepart.com', 'techconnect.com': 'www.techconnect.com', 'technewsdaily.com': 'www.technewsdaily.com', 'techradar.com': 'www.techradar.com', 'techrepublic.com': 'www.techrepublic.com', 'techworld.com.au': 'www.techworld.com.au', 'telegraph.co.uk': 'www.telegraph.co.uk', 'theage.com.au': 'www.theage.com.au', 'theatlantic.com': 'www.theatlantic.com', 'thedailybeast.com': 'www.thedailybeast.com', 'thedailymeal.com': 'www.thedailymeal.com', 'thefiscaltimes.com': 'www.thefiscaltimes.com', 'thefrisky.com': 'www.thefrisky.com', 'thefumble.com': 'www.thefumble.com', 'theguardian.com': 'www.theguardian.com', 'theleek.com': 'www.theleek.com', 'thelocal.com': 'www.thelocal.*', // TODO\n 'theonion.com': 'www.theonion.com', 'thepostgame.com': 'www.thepostgame.com', 'therichest.com': 'www.therichest.com', 'thesmokinggun.com': 'www.thesmokinggun.com', 'thestreet.com': 'www.thestreet.com', 'thesun.co.uk': 'www.thesun.co.uk', 'thesuperficial.com': 'www.thesuperficial.com', 'thevine.com.au': 'www.thevine.com.au', 'thewrap.com': 'www.thewrap.com', 'thinkadvisor.com': 'www.thinkadvisor.com', 'thisoldhouse.com': 'www.thisoldhouse.com', 'tmz.com': 'www.tmz.com', 'today.com': 'www.today.com', 'tomorrowoman.com': 'www.tomorrowoman.com', 'tomsguide.com': 'www.tomsguide.com', 'tomshardware.com': 'www.tomshardware.com', 'topgear.com': 'www.topgear.com', 'torontosun.com': 'www.torontosun.com', 'totalfilm.com': 'www.totalfilm.com', 'totalprosports.com': 'www.totalprosports.com', 'travelandleisure.com': 'www.travelandleisure.com', 'treehugger.com': 'www.treehugger.com', 'tressugar.com': 'www.tressugar.com', 'trutv.com': 'www.trutv.com', 'tvguide.com': 'www.tvguide.com', 'tvovermind.com': 'www.tvovermind.com', 'upi.com': 'www.upi.com', 'usmagazine.com': 'www.usmagazine.com', 'usnews.com': 'www.usnews.com', 'vanityfair.com': 'www.vanityfair.com', 'vg247.com': 'www.vg247.com', 'vh1.com': 'www.vh1.com', 'vice.com': 'www.vice.com', 'villagevoice.com': 'www.villagevoice.com', 'viralands.com': 'www.viralands.com', 'vulture.com': 'www.vulture.com', 'washingtonpost.com': 'www.washingtonpost.com', 'watoday.com.au': 'www.watoday.com.au', 'wbaltv.com': 'www.wbaltv.com', 'wcvb.com': 'www.wcvb.com', 'weather.com': 'www.weather.com', 'weblyest.com': 'www.weblyest.com', 'welt.de': 'www.welt.de', 'wesh.com': 'www.wesh.com', 'westworld.com': 'www.westword.com', 'wftv.com': 'www.wftv.com', 'wgal.com': 'www.wgal.com', 'whas11.com': 'www.whas11.com', 'wholeliving.com': 'www.wholeliving.com', 'wired.co.uk': 'www.wired.co.uk', 'wired.com': 'www.wired.com', 'wisn.com': 'www.wisn.com', 'wittyfeed.com': 'www.wittyfeed.com', 'wlac.com': 'www.wlac.com', 'wlsam.com': 'www.wlsam.com', 'wlwt.com': 'www.wlwt.com', 'wmtw.com': 'www.wmtw.com', 'wowthatscool.com': 'www.wowthatscool.com', 'wpix.com': 'www.wpix.com', 'wptv.com': 'www.wptv.com', 'wsbtv.com': 'www.wsbtv.com', 'wtae.com': 'www.wtae.com', 'wtkr.com': 'www.wtkr.com', 'wtsp.com': 'www.wtsp.com', 'wusa9.com': 'www.wusa9.com', 'wwe.com': 'www.wwe.com', 'wwtdd.com': 'www.wwtdd.com', 'yumsugar.com': 'www.yumsugar.com', 'zagat.com': 'www.zagat.com', 'zap2it.com': 'www.zap2it.com', 'zdnet.com': 'www.zdnet.com', 'zeit.de': 'www.zeit.de', 'zimbio.com': 'www.zimbio.com', 'www2.tbo.com': 'www2.tbo.com', 'xfinity.comcast.net': 'xfinity.comcast.net', 'xhamster.com': 'xhamster.com' // not sure about this one\n };\n}",
"function Crawler() {\n // Array of files and directories\n this.alldirs = [];\n this.allfiles = [];\n\n this.crawlingCompleted = null;\n this.filesCount = 1;\n}",
"function getSupportedSitesInfo() {\n var sites = {\n\n // Example URLs:\n // http://www.refinery29.com/2016/12/133127/how-to-wrap-presents\n \"refinery29.com\": {\n loadAll: function (thisInfo, fullArticleContainer, url) {\n addClassToDOMElements('.opener', 'isVisible active', function (unused) {\n addClassToDOMElements('.slide', 'isVisible active', function (msg) {\n displayResult('Loaded ' + (msg.numLoaded ? msg.numLoaded : 'all') + ' slides');\n });\n });\n }\n },\n\n \"knowable.com\": {\n // Example URLs:\n // http://www.knowable.com/a/23-people-were-asked-what-is-the-most-messed-up-family-secret-you-know/p-1\n getReplaceFormat: function (url) {\n var ret = '';\n var regex = /(http[s]?:\\/\\/)?(www\\.)*(knowable\\.com\\/a\\/[^\\/]+)((\\/p-)([0-9]+))?(.*)/i;\n var matches = url.match(regex);\n if (!matches) {\n renderStatus('Invalid URL format :(');\n return ret;\n }\n // Reconstruct URL\n ret += (matches[1] ? matches[1] : '') // http://\n + (matches[2] ? matches[2] : '') // www.\n + (matches[3]) // knowable.com/a/article-title-here\n + (matches[4] ? matches[5] + '{0}' : '/p-{0}') // /p-X\n + (matches[7] ? matches[7] : ''); // anything after that\n return ret;\n },\n articleMeatSelector: '.article-body',\n isLastPage: function (responseText) {\n // If there isn't a 'Next' button, or there is one that links to '/t/end-gallery',\n // this is the last page\n var html = $.parseHTML(responseText);\n var nextLink = $(html).find('.article-body .btn-next-xl');\n return (!nextLink.length || nextLink.attr('href') == '/t/end-gallery');\n },\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Recursively retrieve pages of article until the last one\n var urlFormat = thisInfo.getReplaceFormat(url);\n var addPage = function (pageNum) {\n httpGet(urlFormat.format(pageNum), function (responseText) {\n // Get the meat of the article and append it to our fullArticleContainer element\n var html = $.parseHTML(responseText);\n var articleMeat = $(html).find(thisInfo.articleMeatSelector);\n if (pageNum > 1) { // hide article title after page 1\n articleMeat.find('.article-header').addClass('hidden');\n }\n articleMeat.find('.article-footer-v2').addClass('hidden');\n fullArticleContainer.append(articleMeat);\n // Examine the page. If it's the last one, add the elements to the page;\n // otherwise, keep going.\n if (thisInfo.isLastPage(responseText)) {\n fullArticleContainer.addClass(thisInfo.articleMeatSelector);\n // Done - get the appropriate element on the page and replace it with \n // the element that we created.\n replaceDOMElements(thisInfo.articleMeatSelector, fullArticleContainer[0].outerHTML, function (msg) {\n if (msg && msg.success) {\n displayResult('Loaded ' + (pageNum) + ' pages');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n else {\n addPage(pageNum + 1);\n }\n });\n }\n addPage(1);\n }\n },\n\n \"suggest.com\": { // also applies to minq.com\n // Example URLs:\n // http://www.suggest.com/lifestyle/1600362/how-did-they-even-get-hired-employees-share-their-17-most-insane-crazy-employee-stories?story_page=1\n // http://www.minq.com/lifestyle/1599990/21-people-share-awesome-stories-about-how-they-became-friends-with-their-bffs?story_page=1\n getReplaceFormat: function (url) {\n var ret = '';\n var regex = /(http[s]?:\\/\\/)?(www\\.)*(.+\\.com\\/[^\\/]+\\/[^\\/]+\\/[^\\/]+)((\\/\\?story_page=)([0-9]+))?(.*)/i;\n var matches = url.match(regex);\n if (!matches) {\n renderStatus('Invalid URL format :(');\n return ret;\n }\n // Reconstruct URL\n ret += (matches[1] ? matches[1] : '') // http://\n + (matches[2] ? matches[2] : '') // www.\n + (matches[3]) // suggest.com/section/1234/article-title-here OR minq.com/...\n + (matches[4] ? matches[5] + '{0}' : '/?story_page={0}') // /?story_page=X\n + (matches[7] && matches[7] != '/' ? matches[7] : ''); // anything after that\n return ret;\n },\n articleMeatSelector: '.slide',\n isLastPage: function (responseText) {\n // If there isn't a 'Next' button, or there is one that links to '#',\n // this is the last page\n var html = $.parseHTML(responseText);\n var nextLink = $(html).find('.next-story');\n return (!nextLink.length || nextLink.attr('href').indexOf('story_page') == -1); // next page is a new article\n },\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Recursively retrieve pages of article until the last one\n var urlFormat = thisInfo.getReplaceFormat(url);\n var addPage = function (pageNum) {\n httpGet(urlFormat.format(pageNum), function (responseText) {\n // Get the meat of the article and append it to our fullArticleContainer element\n var html = $.parseHTML(responseText);\n var articleMeat = $(html).find(thisInfo.articleMeatSelector);\n fullArticleContainer.append(articleMeat);\n // Examine the page. If it's the last one, add the elements to the page;\n // otherwise, keep going.\n if (thisInfo.isLastPage(responseText)) {\n fullArticleContainer.addClass(thisInfo.articleMeatSelector + ' partial content_story_pages_slide primary');\n // Done - get the appropriate element on the page and replace it with \n // the element that we created.\n replaceDOMElements('.slot[data-slot=\"center\"]', fullArticleContainer[0].outerHTML, function (msg) {\n if (msg && msg.success) {\n displayResult('Loaded ' + (pageNum) + ' pages');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n else {\n addPage(pageNum + 1);\n }\n });\n }\n addPage(1);\n }\n },\n\n \"emgn.com\": {\n // Example URL:\n // http://emgn.com/s2/19-extreme-body-transformations-thatll-leave-jaw-aching/1\n getReplaceFormat: function (url) {\n var ret = '';\n var regex = /(http[s]?:\\/\\/)?(www\\.)*(emgn\\.com\\/[^\\/]+\\/[^\\/]+)((\\/)([0-9]*))?(.*)/i;\n var matches = url.match(regex);\n if (!matches) {\n renderStatus('Invalid URL format :(');\n return ret;\n }\n // Reconstruct URL\n ret += (matches[1] ? matches[1] : '') // http://\n + (matches[2] ? matches[2] : '') // www.\n + (matches[3]) // emgn.com/something/article-title-here\n + (matches[4] ? matches[5] + '{0}' : '/{0}') // /X\n + (matches[7] ? matches[7] : ''); // anything after that\n return ret;\n },\n articleMeatSelector: '.content > *:not(aside):not(.pagination):not(.rrssb-holder)',\n isPastLastPage: function (responseText) {\n // If there isn't a 'Next' button, or there is one with text 'Next Article',\n // we've past the last page\n var html = $.parseHTML(responseText);\n var nextDiv = $(html).find('.pagination .next');\n return (nextDiv.length && (nextDiv[0].innerText).indexOf('Article') >= 0); // this is the junky page before next article\n },\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Function to execute after retrieving all of the article content\n var afterLastPage = function (pageNum) {\n fullArticleContainer.addClass('content');\n // Done - get the appropriate element on the page and replace it with \n // the element that we created.\n replaceDOMElements('article.content', fullArticleContainer[0].outerHTML, function (msg) {\n if (msg && msg.success) {\n displayResult('Loaded ' + (pageNum) + ' pages');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n // Recursively retrieve pages of article until the last one\n var urlFormat = thisInfo.getReplaceFormat(url);\n var addPage = function (pageNum) {\n httpGet(urlFormat.format(pageNum), function (responseText) {\n // Get the meat of the article and append it to our fullArticleContainer element\n var html = $.parseHTML(responseText);\n if (thisInfo.isPastLastPage(responseText)) {\n afterLastPage(pageNum);\n }\n else {\n if (pageNum > 1) {\n thisInfo.articleMeatSelector += ':not(h1)'; // don't show the title more than once\n }\n var articleMeat = $(html).find(thisInfo.articleMeatSelector);\n fullArticleContainer.append(articleMeat);\n addPage(pageNum + 1);\n }\n });\n }\n addPage(1);\n }\n },\n\n \"lifebuzz.com\": {\n // Example URL:\n // http://www.lifebuzz.com/princess-diana/1/\n getReplaceFormat: function (url) {\n var ret = '';\n var regex = /(http[s]?:\\/\\/)?(www\\.)*(lifebuzz\\.com\\/[^\\/]+)((\\/)([0-9]*))?(.*)/i;\n var matches = url.match(regex);\n if (!matches) {\n renderStatus('Invalid URL format :(');\n return ret;\n }\n // Reconstruct URL\n ret += (matches[1] ? matches[1] : '') // http://\n + (matches[2] ? matches[2] : '') // www.\n + (matches[3]) // lifebuzz.com/article-title-here\n + (matches[4] ? matches[5] + '{0}' : '/{0}') // /X\n + (matches[7] ? matches[7] : ''); // anything after that\n return ret;\n },\n articleMeatSelector: '.single > *:not(#desktop-below-post-trending)',\n isLastPage: function (responseText) {\n // If there isn't a 'Next' button, or there is one that links to '/t/end-gallery',\n // this is the last page\n var html = $.parseHTML(responseText);\n var nextLink = $(html).find('a.next-post');\n return (nextLink.length);\n },\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Recursively retrieve pages of article until the last one\n var urlFormat = thisInfo.getReplaceFormat(url);\n var addPage = function (pageNum) {;\n httpGet(urlFormat.format(pageNum), function (responseText) {\n // Get the meat of the article and append it to our fullArticleContainer element\n var html = $.parseHTML(responseText);\n var articleMeat = $(html).find(thisInfo.articleMeatSelector);\n articleMeat.find('img.lazy').each(function (index, listItem) {\n $(listItem).attr('src', $(listItem).attr('data-original'));\n });\n fullArticleContainer.append(articleMeat);\n // Examine the page. If it's the last one, add the elements to the page;\n // otherwise, keep going.\n if (thisInfo.isLastPage(responseText)) {\n // Done - get the appropriate element on the page and replace it with \n // the element that we created.\n fullArticleContainer.addClass('single');\n fullArticleContainer.find('.post-pagination').addClass('hidden');\n fullArticleContainer.find('.share-bar').addClass('hidden');\n replaceDOMElements('.single', fullArticleContainer[0].outerHTML, function (msg) {\n if (msg && msg.success) {\n displayResult('Loaded ' + (pageNum) + ' pages');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n else {\n addPage(pageNum + 1);\n }\n });\n }\n addPage(1);\n }\n },\n\n \"forbes.com\": {\n buttonNote: '(will open in new window)',\n // Example URL:\n // http://www.forbes.com/sites/michaelbobelian/2016/12/16/democrats-best-hope-to-defeat-trumps-cabinet-picks-lies-in-glare-of-confirmation-process/\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Click the 'print' button\n triggerEventOnDOMElement('.print a', 'click', function (msg) {\n if (msg && msg.success) {\n displayResult('Opened full article');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n },\n }\n\n // minq.com has the same format as suggest.com (wat)\n sites['minq.com'] = sites['suggest.com'];\n\n return sites;\n}",
"function loadBlockedSites() {\n chrome.cookies.getAll({ url: \"http://example.com/\" }, function(cookies) {\n // if (cookies.length == 0) {\n blockedSites = [];\n // } \n for (var i = 0; i < cookies.length; i++) {\n var cookieStr = JSON.stringify(cookies[i]);\n var obj = JSON.parse(cookieStr);\n var website = obj.name.substring(0, obj.name.length - 1).substr(1);\n if (!blockedSites.includes(website)) {\n blockedSites.push(website);\n }\n }\n });\n}",
"function getUrls() {\n\t// Get all URLs\n\tqueue = [...document.querySelectorAll( 'a:not([data-nocache])' )]\n\t\t.reduce( ( acc, url ) => {\n\n\t\t\t// Bail if the URL does not have an href\n\t\t\tif ( url.href === undefined ) {\n\t\t\t\treturn acc\n\t\t\t}\n\n\t\t\turl = new Url( url.href )\n\n\t\t\t// Bail if url is an asset\n\t\t\tif ( url.pathname.includes( '.' ) ) {\n\t\t\t\treturn acc\n\t\t\t}\n\n\t\t\t// If local, bail\n\t\t\tif ( !url.isLocal() ) {\n\t\t\t\treturn acc\n\t\t\t}\n\n\t\t\t// If admin, bail\n\t\t\tif ( url.pathname.includes( 'wp-admin' ) || url.pathname.includes( 'wp-login' ) ) {\n\t\t\t\treturn acc\n\t\t\t}\n\n\t\t\t// If cached, bail\n\t\t\tif ( url.getCache() ) {\n\t\t\t\treturn acc\n\t\t\t}\n\n\t\t\t// If the URL is already in the queue, bail\n\t\t\tif ( acc.find( accUrl => accUrl.matchesUrl( url ) ) ) {\n\t\t\t\treturn acc\n\t\t\t}\n\n\t\t\tacc.push( url )\n\n\t\t\treturn acc\n\t\t}, [] )\n}",
"function crawlingPage(){\n\t\n\tpage.open(get_url(), function(status) {\n\n \t\t/* ------------------------------------------------------------ */\n \t\t/* get DOM to parse from loaded url */\n \t\tvar current = page.evaluate(function() {\n \treturn document.getElementById(\"b_results\").querySelector(\".sb_pagS\").textContent;\n \t});\n\t\t\n\t\t/* ------------------------------------------------------------ */\n \t/* Check is browser have more pages and if doesnt kill proces */\n \tif(current == pagina){\n \t\tfs.write(path, content, 'w');\n \t\tconsole.log( '------------------------------------------------------------');\n\t\t\tconsole.log( ' _____ ___ ___ _____ ___ ___ _ _ ___ ___ _ _ ___ ___ ');\n\t\t\tconsole.log( ' |_ _| __/ __|_ _| | __|_ _| \\| |_ _/ __| || | __| \\ ');\n\t\t\tconsole.log( ' | | | _|\\__ \\ | | | _| | || .` || |\\__ \\ __ | _|| |) | ');\n\t\t\tconsole.log( ' |_| |___|___/ |_| |_| |___|_|\\_|___|___/_||_|___|___/ ');\n\t\t\tconsole.log( '');\n\t\t\tconsole.log( '------------------------------------------------------------');\n \t\tconsole.log( 'Summary. Cravled '+pagina+' Bing sites and '+counter+' urls' );\n \t\tphantom.exit();\n \t}\n\t\t\n\t\t/* ------------------------------------------------------------ */\n\t\t/* Grab URLs from current page */\n\t\tvar content_to_parse = page.evaluate(function() {\n\t\t\t//return document.body.innerHTML;\n\t\t\treturn document.getElementById(\"b_results\").innerHTML;\n\t\t});\n\n\t\t/* ------------------------------------------------------------ */\n\t\t/* Get result data array */\n\t\tvar result = extractUrls(content_to_parse); \n\t\tfor (var i = 0; i < result.length; i++) {\n\t\t\tvar res = get_host(result[i]);\n\n\t\t\t/* filter bing translator urls */\n\t\t\tif(res != 'www.microsofttranslator.com'){\n\t\t\t\tconsole.log( get_host(result[i]) );\n\t\t\t\tcontent += get_host(result[i])+\"\\n\";\n\t\t\t\t//content += get_host(result[i])+\",\"+query+\"\\n\";\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t};\n\t\t\n\t\t/* ------------------------------------------------------------ */\n\t\t/* increment page and run crawler again */\n\t\tpagina++;\n\t\tcrawlingPage(); \n\n\t});\n}",
"function scrapeSite(){\n\n scrapeIt(sitePath + 'shirts.php', {\n\n pages: {\n listItem: 'ul.products li',\n data: {\n url: {\n selector: 'a',\n attr: 'href'\n }\n }\n }\n }).then(({ data, response }) => {\n\n pages = data.pages;\n scrapePages(pages);\n\n }).catch( (error) => {\n const errorMsg = `Cannot connect to ${sitePath}`;\n writeErrorLog(errorMsg);\n });\n}",
"function loadURLs(urls, fDone, individualClasses) {\n var fNext = function() {\n if (urls.length > 0) {\n var url = urls.shift();\n if (url.search(/http/) == 0) {\n // For coursews data\n \tExhibit.importers[\"application/jsonp\"].load(\n url, \n window.database, \n fNext, \n function(json) {\n return processOfficialData(json, individualClasses);\n });\n } else { loadStaticData(url, window.database, fNext); }\n } else { fDone(); }\n };\n fNext();\n}",
"function crawlWeb (seed){\n\tvar toCrawl = [seed];\n\tvar crawled = [];\n\twhile (toCrawl.length > 0){\n\t\tvar page = toCrawl.pop();\n\t\tfor(var i = 0; i < crawled.length; i++){\n\t\t\tif (page == crawled[i]){\n\t\t\t\treturn crawled;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tunion(tocrawl, getAllLinks(page))\n\t\t\t\tcrawled.push(page);\n\n\t\t\t}\n\t\t}\n\n\t\t\n\n\t}\n\n}",
"static getWebsites() {\r\n let websites;\r\n if (localStorage.getItem('websites') === null) {\r\n websites = [];\r\n } else {\r\n websites = JSON.parse(localStorage.getItem('websites'));\r\n }\r\n return websites;\r\n }",
"async function listAllItemUrls(page) {\n await page.goto(url)\n const html = await page.content()\n const $ = cheerio.load(html)\n\n await page.waitForSelector('.title')\n const results = $('.title').map((index, item) => { return 'https://webscraper.io' + $(item).attr('href') }).get()\n\n return results\n}",
"async function scraper(urls) {\n return Promise.all(\n urls.map(async (url) => {\n const addJob = await crawlQueue.add({ url }, { removeOnComplete: true });\n return addJob;\n }),\n );\n}",
"function getOffersPages() {\n\n return getHtml(URL_RH_website)\n .catch(err => {\n console.log(err);\n })\n .then(html => {\n var $ = cheerio.load(html);\n //Get the list of urls where there are offers\n var list_url_pages = [];\n list_url_pages[0] = URL_RH_website;\n $('#resultatPagination').first().find('a')\n .filter((i, el) => {\n // Remove the last element\n return el.attribs['id'] != \"ctl00_ctl00_corpsRoot_corps_Pagination_linkSuivPage\";\n })\n .each((i, el) => {\n list_url_pages.push(el.attribs['href']);\n });\n return list_url_pages;\n });\n}",
"getComscoreSites(cb) {\n //get all sites /sites\n let self = this;\n this.getGlobalConfig((err) => {\n if (err) cb(err);\n let sites = [];\n self.services.forEach((row) => {\n sites.push('/sites/' + row.site);\n });\n cb(null, sites);\n });\n }",
"function spider(url) {\n\n\t// first we make sure to add this to the list of visited URLs\n\t// otherwise we could (and probably would) get into an infinite loop\n\tif( visited.indexOf(url) >= 0 ){\n\t\treturn;\n\t}else{\n\t\tvisited.push(url);\n\t}\n\n /***********************************************************\n\t\tURLs\n\n\t \tfirst we look for an exact URL match\n\t **********************************************************/\n\turlStatus = findMatch( url, data.urls, \"url\" );\n\n\t//if that came back false\n\tif( !urlStatus ){\n\n\t /***********************************************************\n\t\t\tFilenames\n\n\t\t \tif we didn't find a match there we get just the filename\n\t\t \tas sometimes the URL doesn't match perfectly due to\n\t\t \tquerystring parameters\n\t\t **********************************************************/\n\t\t// parse out the filename\n\t\tfilename = url.replace( baseUrl, '');\n\t\tif( filename.indexOf('?') >= 0 ){\n\t\t\tfilename = filename.substring(0,filename.indexOf('?'));\n\t\t}\n\t\turlStatus = findMatch( filename, data.filenames, \"filename\" );\n\n\t}\n\n\t// however we got here we now figure out what to do with this url\n\tswitch( urlStatus ){\n\t\tcase \"allow\":\n\t\t\tcasper.echo( urlResult( 'allowed', 'green', url ) );\n\t\t\tpage.open(url,function(){\n\t\t\t\tcasper.echo(url+' opened');\n\t\t\t});\n\t\t\t/*\n\t\t\tcasper.open(url).then(function() {\n\t\t\t\t// Find links present on this page\n\t\t\t\tvar links = this.evaluate(function() {\n\t\t\t\t\tvar links = [];\n\t\t\t\t\tArray.prototype.forEach.call(__utils__.findAll('a'), function(e) {\n\t\t\t\t\t\tlinks.push(e.getAttribute('href'));\n\t\t\t\t\t});\n\t\t\t\t\treturn links;\n\t\t\t\t});\n\n\t\t\t\tArray.prototype.forEach.call(links, function(link) {\n\t\t\t\t\tvar newUrl = helpers.absoluteUri(baseUrl, link);\n\t\t\t\t\tif ( spiderLinks.indexOf(newUrl) == -1 ) {\n\t\t\t\t\t\tspiderLinks.push(newUrl);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tcasper.echo( spiderLinks );\n\n\t\t\t});\n\t\t\t*/\n\n\t\t\tbreak;\n\t\tcase \"block\":\n\t\t\tcasper.echo(colorizer.format(\"BLOCKED: \", { fg: 'red', bg: 'black', bold: true }) + ' ' + url);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tcasper.echo(colorizer.format(\"PENDING: \", { fg: 'magenta', bg: 'black', bold: true }) + ' ' + url);\n\t\t\tdata.urls.push({\"url\":url,\"status\":\"pending\"});\n\t\t\tbreak;\n\t}\n\n\tcasper.echo( spiderLinks.length );\n\n}",
"async getPageLinks() {\n const browser = await this.puppeteer.launch({\n ...this.browserConfig,\n ...{ userDataDir: this.users[this.getRandomInt(this.users.length)] }\n });\n const page = await browser.newPage();\n await page.setRequestInterception(true);\n page.on('request', request => {\n // console.log(new URL(request.url()).host);\n if (['image', 'stylesheet', 'font'].indexOf(request.resourceType()) != -1) {\n request.abort();\n }\n else if (this.domainsToExlcude.includes(new URL(request.url()).host)) {\n console.log(\"Blocked: \" + request.url());\n request.abort();\n }\n else {\n request.continue();\n }\n\n });\n await page.goto(this.url);\n var pages = [\n {\n page: \"1\",\n url: this.url\n }\n ];\n var allPages = await page.evaluate(() => {\n return Array.from(document.querySelectorAll(\"a.page-links\")).map((pageLink) => {\n return {\n page: pageLink.innerText.trim(),\n url: pageLink.href\n };\n });\n });\n await browser.close();\n return [...pages, ...allPages];\n }",
"function load() {\n cy.visit('https://wordsmith.automatedinsights.com/')\n cy.url()\n .should('include', 'wordsmith.automatedinsights.com')\n}",
"function crawler() {\n var _this = this;\n\n this.articles = {\n /**\n * @description Gets all articleUrls from a open news web page\n */\n getUrls: function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, articleListSelector) {\n var browser, page, html, $, articles, _articleUrls, i;\n\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n\n console.log(_colors2.default.yellow('> [Crawling] for article Urls ' + url));\n // const browser = await puppeteer.launch({ args: ['--no-sandbox, --disable-setuid-sandbox'], headless: true, ignoreHTTPSErrors: true });\n _context.next = 4;\n return _puppeteer2.default.launch({ headless: true });\n\n case 4:\n browser = _context.sent;\n _context.next = 7;\n return browser.newPage();\n\n case 7:\n page = _context.sent;\n _context.next = 10;\n return page.goto(url, { waitUntil: ['load', 'domcontentloaded', 'networkidle2'], timeout: 60000 });\n\n case 10:\n _context.next = 12;\n return page.content();\n\n case 12:\n html = _context.sent;\n $ = _cheerio2.default.load(html);\n articles = $(articleListSelector);\n _articleUrls = [];\n\n // Push all articles into array\n\n for (i = 0; i < articles.length; i++) {\n _articleUrls.push('' + articles[i].attribs.href);\n }\n\n // Clean articles to remove duplicate links if any\n _articleUrls = (0, _underscore.uniq)(_articleUrls);\n console.log(_colors2.default.green.bold('> Found ' + _articleUrls.length + ' unique article links'));\n _context.next = 21;\n return browser.close();\n\n case 21:\n return _context.abrupt('return', _articleUrls);\n\n case 24:\n _context.prev = 24;\n _context.t0 = _context['catch'](0);\n\n console.log('> Error in crawling for article urls: ', _context.t0.message);\n\n case 27:\n case 'end':\n return _context.stop();\n }\n }\n }, _callee, _this, [[0, 24]]);\n }));\n\n function getUrls(_x, _x2) {\n return _ref.apply(this, arguments);\n }\n\n return getUrls;\n }(),\n /**\n * @description Gets article content from an article web page\n */\n getContent: function () {\n var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(crawlParams) {\n var articleUrls, articlePrependUrl, articleHeaderSelector, articleDateSelector, articleTextSelector, hasWriter, hasHeader, hasDate, siteArticles, browser, i, articleUrl, page, html, $, articleHeader, articleWriter, articleDate, articleText, article;\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n articleUrls = crawlParams.articleUrls, articlePrependUrl = crawlParams.articlePrependUrl, articleHeaderSelector = crawlParams.articleHeaderSelector, articleDateSelector = crawlParams.articleDateSelector, articleTextSelector = crawlParams.articleTextSelector, hasWriter = crawlParams.hasWriter, hasHeader = crawlParams.hasHeader, hasDate = crawlParams.hasDate;\n siteArticles = [];\n _context2.next = 4;\n return _puppeteer2.default.launch({ headless: true });\n\n case 4:\n browser = _context2.sent;\n i = 0;\n\n case 6:\n if (!(i < articleUrls.length)) {\n _context2.next = 33;\n break;\n }\n\n _context2.prev = 7;\n articleUrl = articleUrls[i];\n\n console.log(_colors2.default.bold.green('> [Scraping] article url for content: ' + articlePrependUrl + articleUrl));\n // const browser = await puppeteer.launch({ args: ['--no-sandbox, --disable-setuid-sandbox'], headless: true, ignoreHTTPSErrors: true });\n _context2.next = 12;\n return browser.newPage();\n\n case 12:\n page = _context2.sent;\n _context2.next = 15;\n return page.goto('' + articlePrependUrl + articleUrl, { waitUntil: ['load', 'domcontentloaded', 'networkidle2'], timeout: 60000 });\n\n case 15:\n _context2.next = 17;\n return page.content();\n\n case 17:\n html = _context2.sent;\n $ = _cheerio2.default.load(html);\n articleHeader = hasHeader ? $(articleHeaderSelector).text() : '';\n articleWriter = hasWriter ? $(articleHeaderSelector).text() : '';\n articleDate = hasDate ? $(articleDateSelector).text() : '';\n articleText = $(articleTextSelector).text();\n article = {\n date: articleDate,\n header: articleHeader,\n text: articleText,\n writer: articleWriter,\n url: '' + articlePrependUrl + articleUrl\n // TODO: Do not push all article that are written more than 24 hours ago.\n };\n siteArticles.push(article);\n _context2.next = 30;\n break;\n\n case 27:\n _context2.prev = 27;\n _context2.t0 = _context2['catch'](7);\n\n console.log('Error scraping url: ' + articleUrls[i] + ': \\n ' + _context2.t0.message);\n\n case 30:\n i++;\n _context2.next = 6;\n break;\n\n case 33:\n _context2.next = 35;\n return browser.close();\n\n case 35:\n return _context2.abrupt('return', siteArticles);\n\n case 36:\n case 'end':\n return _context2.stop();\n }\n }\n }, _callee2, _this, [[7, 27]]);\n }));\n\n function getContent(_x3) {\n return _ref2.apply(this, arguments);\n }\n\n return getContent;\n }(),\n /**\n * @description Crawl all article urls from a list of company sites and subsequently crawl all their contents\n */\n getAll: function () {\n var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(companies) {\n var allSitesArticles, i, company, _articleUrls2, _siteArticles, siteArticlesWithInfo;\n\n return regeneratorRuntime.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n allSitesArticles = [];\n i = 0;\n\n case 2:\n if (!(i < companies.length)) {\n _context3.next = 21;\n break;\n }\n\n _context3.prev = 3;\n company = companies[i];\n _context3.next = 7;\n return _this.articles.getUrls(company.url, company.articleListSelector);\n\n case 7:\n _articleUrls2 = _context3.sent;\n _context3.next = 10;\n return _this.articles.getContent({\n articleUrls: _articleUrls2,\n articlePrependUrl: company.articlePrependUrl,\n articleHeaderSelector: company.articleHeaderSelector,\n articleDateSelector: company.articleDateSelector,\n articleTextSelector: company.articleTextSelector,\n hasWriter: company.hasWriter,\n hasHeader: company.hasHeader,\n hasDate: company.hasDate\n });\n\n case 10:\n _siteArticles = _context3.sent;\n siteArticlesWithInfo = {\n siteArticles: _siteArticles,\n name: company.name,\n url: company.url\n };\n\n allSitesArticles.push(siteArticlesWithInfo);\n _context3.next = 18;\n break;\n\n case 15:\n _context3.prev = 15;\n _context3.t0 = _context3['catch'](3);\n\n console.log('> Error in getAll: ', _context3.t0.message);\n\n case 18:\n i++;\n _context3.next = 2;\n break;\n\n case 21:\n return _context3.abrupt('return', allSitesArticles);\n\n case 22:\n case 'end':\n return _context3.stop();\n }\n }\n }, _callee3, _this, [[3, 15]]);\n }));\n\n function getAll(_x4) {\n return _ref3.apply(this, arguments);\n }\n\n return getAll;\n }(),\n /**\n * @description save each article from each\n */\n saveAndSummarizeToDb: function () {\n var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {\n var allSitesArticles, i, siteArticlesWithInfo, _name, _url, _siteArticles2, j;\n\n return regeneratorRuntime.wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n _context5.next = 2;\n return _this.articles.getAll(_constants.COMPANY_SITES);\n\n case 2:\n allSitesArticles = _context5.sent;\n i = 0;\n\n case 4:\n if (!(i < allSitesArticles.length)) {\n _context5.next = 22;\n break;\n }\n\n siteArticlesWithInfo = allSitesArticles[i];\n _name = siteArticlesWithInfo.name, _url = siteArticlesWithInfo.url, _siteArticles2 = siteArticlesWithInfo.siteArticles;\n j = 0;\n\n case 8:\n if (!(j < _siteArticles2.length)) {\n _context5.next = 19;\n break;\n }\n\n _context5.prev = 9;\n return _context5.delegateYield( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {\n var article, originalText, originalHeader, options, _ref5, summary_title, summary_points, summarizedArticle, query;\n\n return regeneratorRuntime.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n article = _siteArticles2[j];\n originalText = article.text;\n originalHeader = article.header;\n options = {\n title: article.header,\n text: article.text,\n summary_length: 10,\n coref: false,\n sort_by_salience: true,\n include_all_sentences: false\n };\n _context4.next = 6;\n return _Agolo2.default.summarizer.summarize(options);\n\n case 6:\n _ref5 = _context4.sent;\n summary_title = _ref5.summary_title;\n summary_points = _ref5.summary_points;\n summarizedArticle = {\n summary_title: summary_title,\n summary_points: summary_points,\n site_name: _name,\n site_url: _url,\n article_url: article.url,\n original_text: originalText,\n original_header: originalHeader,\n summarized: true,\n project: 'IB-III',\n date_written: article.date\n };\n query = { article_url: summarizedArticle.article_url };\n // Only save articles of unique article urls\n\n _context4.next = 13;\n return _article2.default.findOneAndUpdate(query, summarizedArticle, { upsert: true }, function (error) {\n if (error) {\n console.log('> Error saving article:', error.message);\n }\n console.log(_colors2.default.bold.cyan('> [Saving] Summarized Article to Db: ' + summarizedArticle.article_url));\n });\n\n case 13:\n case 'end':\n return _context4.stop();\n }\n }\n }, _callee4, _this);\n })(), 't0', 11);\n\n case 11:\n _context5.next = 16;\n break;\n\n case 13:\n _context5.prev = 13;\n _context5.t1 = _context5['catch'](9);\n\n console.log('Error in summarizing article:: \\n' + _context5.t1.message);\n\n case 16:\n j++;\n _context5.next = 8;\n break;\n\n case 19:\n i++;\n _context5.next = 4;\n break;\n\n case 22:\n case 'end':\n return _context5.stop();\n }\n }\n }, _callee5, _this, [[9, 13]]);\n }));\n\n function saveAndSummarizeToDb() {\n return _ref4.apply(this, arguments);\n }\n\n return saveAndSummarizeToDb;\n }(),\n getPage: function () {\n var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {\n var browser, page, url, html;\n return regeneratorRuntime.wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n _context6.next = 2;\n return _puppeteer2.default.launch({ headless: true });\n\n case 2:\n browser = _context6.sent;\n _context6.next = 5;\n return browser.newPage();\n\n case 5:\n page = _context6.sent;\n url = 'http://localhost:3000/';\n _context6.next = 9;\n return page.goto(url, { waitUntil: ['load', 'domcontentloaded', 'networkidle2'], timeout: 60000 });\n\n case 9:\n _context6.next = 11;\n return page.content();\n\n case 11:\n html = _context6.sent;\n _context6.next = 14;\n return browser.close;\n\n case 14:\n return _context6.abrupt('return', html);\n\n case 15:\n case 'end':\n return _context6.stop();\n }\n }\n }, _callee6, _this);\n }));\n\n function getPage() {\n return _ref6.apply(this, arguments);\n }\n\n return getPage;\n }()\n };\n}",
"function load_domains() {\n chrome.storage.sync.get({ includedDomainsList: [] }, function (items) {\n // Process the domains\n var includedDomains = document.getElementById('includedDomains');\n for (var i = 0; i < items.includedDomainsList.length; i++) {\n var url = items.includedDomainsList[i];\n var opt = document.createElement('option');\n opt.text = url;\n opt.value = url;\n includedDomains.add(opt);\n }\n });\n chrome.storage.sync.get({ excludedDomainsList: [] }, function (items) {\n // Process the domains\n var excludedDomains = document.getElementById('excludedDomains');\n for (var i = 0; i < items.excludedDomainsList.length; i++) {\n var url = items.excludedDomainsList[i];\n var opt = document.createElement('option');\n opt.text = url;\n opt.value = url;\n excludedDomains.add(opt);\n }\n });\n}",
"function first_start() {\n // add sites 1 by 1 in sync\n blackListSite(\"facebook.com\", function() {\n blackListSite(\"youtube.com\", function() {\n blackListSite(\"instagram.com\");\n });\n });\n}",
"function preloadUrls() {\n\tgetUrls()\n\n\t// If the queue is empty, bail\n\tif ( queue.length === 0 ) {\n\t\treturn\n\t}\n\n\t// grab the next 10 URLs and get the paths\n\tconst requestUrls = queue.slice( 0, 10 )\n\n\t// hack off the 10 items just placed in requestUrls.\n\tqueue = queue.slice( 10 )\n\n\t// fetch the data\n\tnew Promise( async ( res, rej ) => {\n\t\tconst data = await fetch( {\n\t\t\tpath: `/nicholas/v1/page-info?paths=${requestUrls.map( url => url.pathname )}`,\n\t\t} )\n\n\t\t// Loop through each dataset and set the cache from the request URL\n\t\tdata.forEach( ( datum, key ) => {\n\t\t\tsetTimeout( () => {\n\t\t\t\trequestUrls[key].updateCache( datum )\n\t\t\t}, 100 * key )\n\t\t} )\n\t} )\n}",
"function scrapeWebpack(url) {\n\n // test for bad url\n\n var options = {\n uri: url,\n transform: function transform(body) {\n return cheerio.load(body);\n }\n };\n\n var scrapedURLS = rp(options).then(function ($) {\n var result = [];\n\n var elems = $('#wiki>ul li');\n // find the name, desc and URL for every\n elems.each(function (i, elem) {\n var scrapedLoader = {};\n scrapedLoader.desc = $(elem).text();\n scrapedLoader.name = $(elem).children('a').text();\n scrapedLoader.url = $(elem).children('a').attr('href');\n result.push(scrapedLoader);\n });\n return result;\n }).catch(function (err) {\n // crawling failed or cheerio choked\n throw err;\n });\n\n return scrapedURLS;\n}",
"async function get_urls() {\n const getUrls = await fetch(\"http://localhost:3000\").then((data) => data.json());\n \n getUrls.urls.map( ({name, url}) => writeUrl({name, url}) ); // Add all URLs.\n}",
"function getShirtUrls (url) {\n\tconsole.log('Getting shirt URLs from ' + url);\n\n\t//start the crawler at url\n\turlCrawler.direct({ \n\t\turi: url,\n\t\tskipEventRequest: false,\n\t\tcallback : function (error, response) {\n\t\t\t\n\t\t\t//proceed if no errors\n\t\t\tif (response.statusCode === 200 && !error) {\n\t\t\t\tvar shirtUrls = []; //empty array for storing URLs\n\t\t\t\tvar $ = response.$; //get all HTML in Jquery format\n\t\t\t\t\n\t\t\t\t//find the URLs, and loop thru them\n\t\t\t\t$('.products').find('a').each(function() {\n\t\t\t\t\tshirtUrls.push($(this).attr('href')); //store them in the array\n\t\t\t\t\t\n\t\t\t\t\t//check if we now have all the URLs we need\n\t\t\t\t\tif (shirtUrls.length === shirtsToScrape) { //yes, we do\n\t\t\t\t\t\tconsole.log(\"All shirt URLs collected!\");\n\t\t\t\t\t\tscrapeShirts(shirtUrls); //go to scraping the shirtUrls we've found\n\t\t\t\t\t} //if not, loop will continue\n\t\t\t\t});\n\t\t\t}\n\t\t\t\n\t\t\t//there's been an error\n\t\t\telse {\n\t\t\t\thandleError(url, response.statusCode, error); //handle it\n\t\t\t}\n\t\t}\n\t});\n}",
"async function runTestOnAllHtmlUrls() {\n\tconst testUrls = [\n\t\t 'http://example.com',\n\t\t /*\n \t 'https://www.theguardian.com/environment/2016/aug/02/environment-climate-change-records-broken-international-report', // https://github.com/hypothesis/client/issues/73\n\t\t 'https://telegra.ph/whatsapp-backdoor-01-16', // https://github.com/hypothesis/client/issues/558\n\t\t 'https://dashboard.wikiedu.org/training/students/wikipedia-essentials/policies-and-guidelines-basic-overview', // https://github.com/hypothesis/product-backlog/issues/493\n\t\t 'https://www.theatlantic.com/magazine/archive/1945/07/as-we-may-think/303881/',\n\t\t 'https://www.poetryfoundation.org/poems/50364/neutral-tones',\n\t\t 'https://hackernoon.com/why-native-app-developers-should-take-a-serious-look-at-flutter-e97361a1c073',\n\t\t 'https://lincolnmullen.com/projects/spatial-workshop/literacy.html',\n\t\t 'https://www.greenpeace.org/usa/reports/click-clean-virginia/',\n\t\t 'https://www.fastcompany.com/28905/brand-called-you',\n\t\t 'https://www.forbes.com/sites/danschawbel/2011/12/21/reviving-work-ethic-in-america/#67ab8458449a',\n\t\t 'http://mmcr.education/courses/pls206-01-W19/readings/marbury_v_madison.html',\n\t\t 'https://www.si.com/vault/2002/03/25/320766/the-real-new-york-giants',\n\t\t 'https://www.nytimes.com/2018/12/08/opinion/college-gpa-career-success.html',\n\t\t 'https://www.dartmouth.edu/~milton/reading_room/pl/book_3/text.shtml',\n\t\t 'http://mikecosgrave.com/annotation/reclaiming-conversation-social-media/',\n\t\t 'https://english.writingpzimmer.net/about/snow-day-billy-collins/',\n\t\t 'https://www.facinghistory.org/resource-library/video/day-learning-2013-binna-kandola-diffusing-bias',\n\t\t 'http://codylindley.com/frontenddevbooks/es2015enlightenment/'\n\t\t */\n\t]\n\tconst omitted = [\n // embeds client, cannot work. note: no highlights at libretexts, they are missing our css\t\t\n\t\t// 'https://human.libretexts.org/Bookshelves/Composition/Book%3A_Successful_College_Composition_(Crowther_et_al.)/3%3A_Rhetorical_Modes_of_Writing/3.1%3A_Narration', \n\t]\n\tlet results = {}\n\tfor (let testUrlIndex = 0; testUrlIndex < testUrls.length; testUrlIndex++) {\n\t\tlet testUrl = testUrls[testUrlIndex]\n\t\tlet result = await runHtmlTest(testUrl) \n\t\twriteResults(testUrlIndex, result, 'html', '0')\n\t\tresults[testUrl] = result\n\t}\n\twriteResults('all', results, 'html')\n}",
"function loadWebsites(){\r\n storage.local.get([\"customWebsites\"], function(items){\r\n /* Default websites loading */\r\n\r\n if(items.customWebsites !== undefined){\r\n var customWebsites = items.customWebsites;\r\n var table = document.getElementById(\"customTable\");\r\n table.innerHTML = tableHead;\r\n\r\n for(var index in customWebsites){\r\n var website = customWebsites[index];\r\n var checked = website.on ? \"checked\" : \"\";\r\n var element = fillTemplate(tableElementTemplate, {\"id\": \"custom\"+index, \"el\": website.url, \"checked\": checked});\r\n\r\n table.innerHTML += element;\r\n }\r\n\r\n attachEvents();\r\n }\r\n });\r\n }",
"function getBuiltInWhiteList() {\n return news_sites.sites;\n}",
"function getMicrositeList( ) {\n return $.getJSON('javascript/microsites.json').pipe(function (data) {\n return data.sites;\n });\n }",
"function doTheWork() {\n getUrlsFromPage()\n // .then(urls => {\n // // check in reddis if url exists\n // // return filtered array\n // })\n .then((urls) => {\n urls.forEach(url => {\n //return console.log(url);\n crawl(url).then((car) => {\n printCar(car);\n // send email\n // for later us: client.set(\"string key\", \"string val\", redis.print);\n });\n });\n })\n}",
"async function getList (url) {\n const options = {\n uri: url,\n transform: (body) => {\n return cheerio.load(body);\n }\n };\n let list = [];\n await rp(options)\n .then(async ($) => {\n\n // get libraries\n $('.im-title').each((i, element) => {\n const href = $(element.children[1]).attr('href').split('/')[1];\n list.push(href);\n });\n\n // navigate to next page\n const next = $('.search-nav').children().last();\n if (!next.hasClass('current')) {\n const nextPage = next.children().last().attr('href');\n list = list.concat(await getList(repository + nextPage));\n }\n });\n\n return list;\n}"
] |
[
"0.59339124",
"0.59148914",
"0.5872807",
"0.58536553",
"0.5815739",
"0.566842",
"0.56557167",
"0.5648528",
"0.56320465",
"0.5626788",
"0.56198066",
"0.56151825",
"0.5570971",
"0.55442506",
"0.54660624",
"0.54622036",
"0.545772",
"0.5441777",
"0.5440059",
"0.54212856",
"0.54100126",
"0.540572",
"0.5395057",
"0.53831756",
"0.5378659",
"0.53784245",
"0.5374922",
"0.5374532",
"0.5343069",
"0.5334735"
] |
0.7160564
|
0
|
Wraps the global timer methods to collect their return values, which can be later cleared in clearImaApp function
|
function _installTimerWrappers() {
global.setInterval = (...args) => {
let timer = setIntervalNative(...args);
timers.push({ timer, clear: () => global.clearInterval(timer) });
return timer;
};
global.setTimeout = (...args) => {
let timer = setTimeoutNative(...args);
timers.push({ timer, clear: () => global.clearTimeout(timer) });
return timer;
};
global.setImmediate = (...args) => {
let timer = setImmediateNative(...args);
timers.push({ timer, clear: () => global.clearImmediate(timer) });
return timer;
};
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function timerWrapper () {}",
"function Timer() {}",
"clearAllTimers() {\n for (let status of ROUND_TIMED_STATUSES) {\n this.clearFlag(status);\n }\n }",
"function xTimerMgr()\r\n{\r\n this.tmr = null;\r\n this.timers = new Array();\r\n}",
"function checkTimers(){\n createTimerCallback(amatriadata.sleepTimes)\n console.log( Date(Date.now()) + 'Checking Timers')\n}",
"stopExtantTimers() {\n gExtantTimers.clear()\n }",
"function resetTimer() {\n app.second = 0;\n app.minute = 0;\n app.hour = 0;\n clearInterval(app.interval);\n app.timer.innerHTML = \"0:00\";\n}",
"function Timer(){\n}",
"function Timer() {\n /* class that has a method to replace window.setTimeout */\n this.lastid = 0;\n this.functions = {};\n \n this.registerFunction = function(object, func, timeout) {\n /* register a function to be called with a timeout\n\n args: \n func - the function\n timeout - timeout in millisecs\n \n all other args will be passed 1:1 to the function when called\n */\n var args = new Array();\n for (var i=0; i < arguments.length - 3; i++) {\n args.push(arguments[i + 3]);\n }\n var id = this._createUniqueId();\n this.functions[id] = new Array(object, func, args);\n setTimeout(\"timer_instance._handleFunction(\" + id + \")\", timeout);\n };\n\n this._handleFunction = function(id) {\n /* private method that does the actual function call */\n var obj = this.functions[id][0];\n var func = this.functions[id][1];\n var args = this.functions[id][2];\n this.functions[id] = null;\n func.apply(obj, args);\n };\n\n this._createUniqueId = function() {\n /* create a unique id to store the function by */\n while (this.lastid in this.functions && this.functions[this.lastid]) {\n this.lastid++;\n if (this.lastid > 100000) {\n this.lastid = 0;\n }\n }\n return this.lastid;\n };\n}",
"function resetTimer () {\n window.clearInterval(timerIntervalId);\n timerIntervalId = null;\n window.clearInterval(pageTitleIntervallId);\n pageTitleIntervallId = null;\n timerStartFinishTimestamp = null;\n timerPauseTimestamp = null;\n timeobject = {\n hours: '00',\n minutes: '00',\n seconds: '00',\n milliseconds: '00'\n };\n printTimedisplayFromTimestamp(0);\n startPauseButton.innerHTML = 'Start';\n if (getActiveMode() == 'countdown') {\n startPauseButton.setAttribute('onclick', 'startCountdown();');\n dialpad.classList.remove('hide');\n updatePageTitle('Countdown');\n } else if (getActiveMode() == 'stopwatch') {\n startPauseButton.setAttribute('onclick', 'startStopwatch();');\n lapContainer.classList.add('hide');\n updatePageTitle('Stopwatch');\n lapLog.innerHTML = \"\";\n };\n}",
"function mytick() {\n\t//console.log(\"from timer tick: \"+new Date() + \", and current count: \"+appTimer.currentCount);\n\tmyTime = moment().format(\"hh:mm:ss A\");\n\tmyDate = moment().format(\"dddd, MMMM DD, YYYY\");\n\n\tdocument.getElementById(\"timeDiv\").innerHTML = myTime;\n\tdocument.getElementById(\"dateDiv\").innerHTML = myDate;\n\tdocument.getElementById(\"timeLeft\").innerHTML = \"Seconds left until next refresh: \" + (secondsToNextRefresh--);\n\t//console.log(myDate+\" \"+myTime+\" timer current count: \"+appTimer.currentCount);\n\tif (appTimer.currentCount == dataRefreshInterval_seconds) {\n\n\t\t//refresh the MIM data\n\t\t//console.log('refreshing data');\n\t\t//proxy.getSegmentsMedianTravelTimes(\"00:15:00\", new Async(travelTimeDataSuccess, travelTimeDataError));\n\n\t\tgetTranscomLinkData();\n\t\tgetWifiLinkData();\n\n\t\t//reset the timer so the current count resets as well\n\t\tappTimer.Reset();\n\t\tdocument.getElementById(\"disclaimerDateTime\").innerHTML = moment().format('MMMM Do YYYY, h:mm:ss a');\n\t\tsecondsToNextRefresh = dataRefreshInterval_seconds;\n\t}\n\n}",
"eventTimer() {throw new Error('Must declare the function')}",
"function setTimer() {\n // get the shortRest\n // get the largeRest\n }",
"function Clearup() {\n App.Timer.ClearTime();\n }",
"function setupTimeoutTimer() {\n updateTimeoutInfo(undefined);\n }",
"function clearTimer() {\n\t\t\tif (sys.timer) {\n\t\t\t\twindow.clearTimeout(sys.timer);\n\t\t\t}\n\t\t\tsys.timer = null;\n\t\t}",
"function resetMainTimer(seconds) {\n changeFavicon('red');\n timer.pause();\n timer = new CountdownTimer(seconds); \n timer.onTick(setTimeOnAllDisplays);\n }",
"function startTimer (){\n clear = setInterval(timer, 1000)\n }",
"function util_fun(){\r\n gametime = document.getElementById(\"timer\");\r\n\t\tgametime.innerHTML=\"0\";\r\n\t\tgame_secs=0;\r\n\t\tgame_mins=0;\r\n totalsecscount = 0;\r\n setInterval(setInfoTandR, 1000);\r\n}",
"function resetTimer() {\n inactiveTime = 0;\n}",
"runTimers() {\n\t\tfor (var timer in this.Vars._Timers) {\n\t\t\tif (this.Vars._timerMod % this.Vars._Timers[timer].freq === 0) {\n\t\t\t\tthis.Vars._Timers[timer].func.call()\n\t\t\t}\n\t\t}\n\t\tthis.Vars._timerMod++\n\t}",
"function startTime() {\n setTimer();\n}",
"handleTimer() {\n this.setTimerInterrupt(true);\n }",
"function coreTimer()\n{\n\t// If the document.hidden property doesn't work, this timer doesn't function\n\tif(typeof(document.hidden) != \"undefined\")\n\t{\n\t\tif(document.hidden != true)\n\t\t{\n\t\t\tcoreTimeCount++;\n\t\t}\n\t}\n\t\n\t// If you're logged in, run the user's update handlers\n\tif(typeof(JSUser) == \"string\")\n\t{\n\t\t// Notifications Updater\n\t\tif(coreTimeCount >= timers.notifications.next)\n\t\t{\n\t\t\ttimers.notifications.next = coreTimeCount + timers.notifications.interval;\n\t\t\trunNotifications();\n\t\t}\n\t\t\n\t\t// Friend Updater\n\t\tif(coreTimeCount >= timers.friends.next)\n\t\t{\n\t\t\ttimers.friends.next = coreTimeCount + timers.friends.interval;\n\t\t\trunFriendList();\n\t\t}\n\t\t\n\t\t// User Chat Updater\n\t\tif(coreTimeCount >= timers.userchat.next)\n\t\t{\n\t\t\ttimers.userchat.next = coreTimeCount + timers.userchat.interval;\n\t\t\trunUserChat();\n\t\t}\n\t}\n\t\n\t// Chat Updater\n\tif(coreTimeCount >= timers.chat.next)\n\t{\n\t\ttimers.chat.next = coreTimeCount + timers.chat.interval;\n\t\trunChatUpdate();\n\t}\n}",
"function initTimers(){\n Timers = [\n {\n tag: \"Work\",\n time: 25,\n seconds:0,\n defaultSound: true,\n soundType: \"ding\", \n volume: 80,\n index: 0\n },\n {\n tag: \"Short Break\",\n time: 5,\n seconds:0,\n defaultSound: false,\n soundType: \"elevator\", \n volume: 50,\n index: 1\n },\n {\n tag: \"Long Break\",\n time: 10,\n seconds:0,\n defaultSound: true,\n soundType: \"tone\", \n volume: 100,\n index: 2\n },\n {\n tag: \"Custom 1\",\n time: 25,\n seconds:0,\n defaultSound: true,\n soundType: \"bell\", \n volume: 100,\n index: 3,\n on: false\n },\n {\n tag: \"Custom 2\",\n time: 25,\n seconds:0,\n defaultSound: true,\n soundType: \"jingle\", \n volume: 100,\n index: 4,\n on: false\n }\n ]\n}",
"function clearAllTimers() {\n\tfor (var i = 1; i < 9999; i++)\n\t\twindow.clearTimer(i);\n}",
"function startTimer(){\n setTimeout(setIntervals, 300);\n setTimeout(rail_lights, 3000);\n setTimeout(getAudio, 3300);\n setTimeout(empty_window, 9000);\n}",
"bindTimerFunction() {\n this.sweepCaches = this.sweepCaches.bind(this);\n this.sweepOldUpdates = this.sweepOldUpdates.bind(this);\n this.processGatewayQueue = this.processGatewayQueue.bind(this);\n }",
"function timer () {\n const start = Date.now()\n\n return function stopTimer () {\n return Date.now() - start\n }\n}",
"function clearAllTimers(flag)\n{\n\tif (flag & TIMER_CPULOAD) {\n\t\tfor (i = 0; i < timeout_cpuload.length; i++) {\n\t\t\tclearTimeout(timeout_cpuload[i]);\n\t\t}\n\t\ttimeout_cpuload = [];\n\t}\n}"
] |
[
"0.7024895",
"0.6216643",
"0.6178682",
"0.6061379",
"0.6042539",
"0.60242134",
"0.6019928",
"0.59608024",
"0.59482926",
"0.593258",
"0.59140414",
"0.5906312",
"0.5891599",
"0.58909",
"0.588722",
"0.58843887",
"0.5851347",
"0.5840052",
"0.5838455",
"0.57992816",
"0.57936734",
"0.5790353",
"0.5761593",
"0.5731722",
"0.5730334",
"0.5729955",
"0.5724675",
"0.571764",
"0.57097626",
"0.5695559"
] |
0.681154
|
1
|
custom destroyAll watcher TODO: check this has been merged then use native destroyAll method see:
|
destroyAllWatchers(){
let watchers = scrollMonitor.watchers,
eventTypes = scrollMonitor.eventTypes;
for (var w = 0, x = watchers.length; w < x; w++) {
for (var i = 0, j = eventTypes.length; i < j; i++) {
watchers[w].callbacks[eventTypes[i]].length = 0;
}
}
watchers.length = 0;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"beforeDestroy () {\n unwatchAll(this);\n }",
"removeAll() {\n this.listeners.forEach(listener => listener.destroy());\n this.listeners = [];\n }",
"removeAllEvents() {\n this.destroy();\n }",
"destroyAll(...data) {\n return Promise.resolve().then(() => {\n const _destroyPlugin = (i = this.plugins.length - 1) => {\n return -1 < i ? Promise.resolve().then(() => {\n const pluginName = this.plugins[i].name;\n // emit event\n return this.plugins[i].destroy().then(() => {\n this.emit(\"destroyed\", pluginName, ...data);\n return Promise.resolve();\n // loop\n }).then(() => {\n return _destroyPlugin(i - 1);\n });\n }) : Promise.resolve();\n };\n return _destroyPlugin();\n // end\n }).then(() => {\n this.plugins = [];\n this.emit(\"alldestroyed\", ...data);\n return Promise.resolve();\n // remove all external resources\n }).then(() => {\n return (0, rmdirp_1.default)(this.externalRessourcesDirectory);\n });\n }",
"doDestroy() {\n this.trigger('destroy');\n this.removeAllListeners();\n super.doDestroy();\n }",
"cleanUpEvents() {\n for (let idx in this.eventsToClean) {\n this.eventsToClean[idx].removeCleanupListeners();\n }\n }",
"beforeDestroy () {\n if (watchers) { // unwatch the model\n watchers.forEach((unwatch) => unwatch());\n watchers = [];\n }\n }",
"beforeDestroy () {\n if (watchers) { // unwatch the model\n watchers.forEach((unwatch) => unwatch());\n watchers = [];\n }\n }",
"destroy() {\n let i;\n for (let type in this._listeners) {\n let arr = this._listeners[type];\n for (i = 0; i < arr.length; i += 1) {\n arr[i] = null;\n }\n }\n }",
"destroy(cb) {\n this.removeAll(cb);\n }",
"destroy(all = false) {\n this.removeEventListeners();\n this.removeAllEvents();\n if (all) {\n this.teardown();\n }\n }",
"destroy() {\n if (Object.values(this.events).length) {\n for (let event in this.events) {\n window.removeEventListener(event.name, event.fn);\n }\n }\n }",
"static destroyAll() {\n applications.forEach(proc => {\n try {\n proc.destroy(false);\n } catch (e) {\n logger.warn('Exception on destroyAll', e);\n }\n });\n\n applications.splice(0, applications.length);\n }",
"doDestroy() {\n const me = this;\n\n me.trigger('destroy');\n if (me.listeners && me.listeners.detacher) {\n me.listeners.detacher();\n }\n me.removeAllListeners();\n\n super.doDestroy();\n }",
"destroy() {\n if (!this.destroyed) {\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n this.destroyed = true;\n this.dispose();\n }\n }",
"function destroyAll(t) {\n every(t, (obj) => {\n destroy(obj);\n });\n }",
"destroy () {\n this.eventListeners = null;\n }",
"destroy() {\n this.removeDomListeners()\n // 238-4\n this.unsubscribers.forEach(unsub => unsub())\n }",
"destroy() {\n this.listeners = null;\n }",
"destroy() {\n this.removeDOMListeners();\n this.unsubscribers.forEach((unsub) => unsub());\n }",
"destroy() {\n const deleteList = Object.keys(this.workers).map((worker) => new Worker(worker));\n\n deleteList.forEach((worker) => {\n this.deleteWorker(worker, true);\n })\n }",
"destroy() {\n this.eventTracker.removeAll();\n }",
"destroy () {\n\n this.particles.forEach((particle) => {\n\n this.emit('particle.destroy', particle)\n })\n\n this.recycleBin = []\n this.particles = []\n }",
"teardown () {\n if (this.active) {\n // remove self from vm's watcher list\n // this is a somewhat expensive operation so we skip it\n // if the vm is being destroyed.\n if (!this.vm._isBeingDestroyed) {\n remove(this.vm._watchers, this);\n }\n var i = this.deps.length;\n while (i--) {\n this.deps[i].removeSub(this);\n }\n this.active = false;\n }\n }",
"Destroy() {\n for (const key in this.plugins) {\n if (this.plugins.hasOwnProperty(key)) {\n const plugin = this.plugins[key];\n if(plugin.destroy){\n plugin.destroy();\n }\n }\n }\n }",
"function DestroyAllViewers()\n{\n if (rmxfViewers != null)\n for (var i = 0; i < rmxfViewers.length; i++)\n if (rmxfViewers[i] != null)\n rmxfViewers[i].Destroy();\n rmxfViewers = null;\n}",
"destroyAllBugs(){\n this.bugs = this.chort.getBugs()\n this.bugs.clear(true) // not working?!\n //tell chort\n this.chort.setBugs(this.bugs)\n }",
"removeAllListeners() {\n const listeners = this.eventListeners;\n let i, thisObj;\n\n for (const event in listeners) {\n const bucket = listeners[event]; // We iterate backwards since we call removeListener which will splice out of\n // this array as we go...\n\n for (i = bucket.length; i-- > 0;)\n /* empty */\n {\n const cfg = bucket[i];\n this.removeListener(event, cfg);\n thisObj = cfg.thisObj;\n\n if (thisObj && thisObj.untrackDetachers) {\n thisObj.untrackDetachers(this);\n }\n }\n }\n }",
"destroy() {\n this.emit('destroy');\n this.removeAllListeners();\n }",
"destroy () {\n this.subscribers.forEach(subscriber => subscriber.unsubscribe());\n }"
] |
[
"0.76400393",
"0.6712945",
"0.6694455",
"0.6648352",
"0.66223437",
"0.6534911",
"0.65277785",
"0.65277785",
"0.6472088",
"0.64587104",
"0.64398474",
"0.64390737",
"0.64331716",
"0.64135945",
"0.6378474",
"0.6375794",
"0.63658154",
"0.6304516",
"0.628469",
"0.62536114",
"0.62522095",
"0.62521654",
"0.62224036",
"0.62207615",
"0.6220072",
"0.6208112",
"0.61995995",
"0.6189896",
"0.6179659",
"0.6166776"
] |
0.69550574
|
1
|
Set the active event to 0 to not have any event marked as active This function also gets called from the child component
|
unClickEvent() {
this.setState({activeEvent: 0})
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"activate() {\n this.active = true;\n }",
"clearActive() {\n this.handleMenuItemChange(\"active\");\n }",
"function handleActive(e) {\r\n //REMOVE ACTIVE CLASS\r\n e.target.parentElement.querySelectorAll(\".active\").forEach((el) => {\r\n el.classList.remove(\"active\");\r\n });\r\n // Add class active\r\n e.target.classList.add(\"active\");\r\n}",
"activate() {\n let event;\n this.active = true;\n\n while (event = this.emits.shift()) {\n super.emit.apply(this, event);\n }\n }",
"disable() {\n this.active = false;\n }",
"if (prevProps.isActive && !this.props.isActive) {\n this.props.onLoadEventsFunctionsExtensions();\n }",
"onActiveChange(value) {\n if (!value) {\n this.onBlur()\n }\n }",
"_active() {\n this._sequence = [];\n this.tag(\"Items\").childList.clear();\n\n this._setState(\"Buttons\");\n }",
"onStateChanged() {\n console.log('onStateChanged is not overwritten', this.activeNode);\n }",
"touchableHandleActivePressIn(e) {\n this.start(e)\n this.props.onPressIn && this.props.onPressIn(e)\n }",
"parentActivated() {\n this.algedonodeActive = true\n }",
"setActive(e) {\n if (e.direction === 'left') {\n this._setNextActive();\n } else if (e.direction === 'right') {\n this._setPrevActive();\n }\n }",
"setActiveState(active) {\n // If (cast) active value has changed:\n if (!!this._isActive !== active) {\n // Update to the new value.\n this._isActive = active;\n // Fire the appropriate activation event.\n if (active) {\n this.onActivate.emit();\n }\n else {\n this.onDeactivate.emit();\n }\n }\n // Regardless, emit a change to `isActive`, so [(isActive)] works correctly.\n this.isActiveChange.emit(active);\n }",
"_activeAppChanged(newValue, oldValue) {\n if (typeof oldValue !== typeof undefined && newValue != null) {\n this.hasActive = true;\n } else {\n this.hasActive = false;\n }\n }",
"_handleActiveState() {\n const that = this;\n\n //Remove the active state of all windows on page\n const allWindowsOnPage = document.getElementsByClassName('jqx-window');\n\n for (let w = 0; w < allWindowsOnPage.length; w++) {\n if (!allWindowsOnPage[w].contains(that) && !that.contains(allWindowsOnPage[w])) {\n allWindowsOnPage[w].removeAttribute('active');\n }\n }\n\n that.setAttribute('active', '');\n }",
"makeInactive() {\n this._active = false;\n }",
"toggleActive() {\n\t\tif (this.active) {\n\t\t\tthis.deactivate();\n\t\t}\n\t\telse {\n\t\t\tthis.activate();\n\t\t}\n\t}",
"focus(suppressEvent = false) {\n this.parentItem.setActiveComponentItem(this, true, suppressEvent);\n }",
"activeSelect(e,itemIndex) {\n this.state.active === itemIndex ? \n this.setState({active: null}) : \n this.setState({active: itemIndex})\n }",
"function dragEnd(e) {\n active = false;\n}",
"handleLeave() {\n this.setState({ active: 0 });\n }",
"handleLeave() {\n this.setState({ active: 0 });\n }",
"_setActiveClass(e) {\n\t\tlet className = e.target.className;\n\t\tlet els = document.getElementsByClassName(className)\n\n\t\tArray.from(els).forEach((el) => {\n\t\t\tel.parentElement.classList.remove(\"active\");\n\t\t});\n\n\t\te.target.parentElement.classList.add(\"active\");\n\t}",
"clearActiveElement() {\n if (this.activeElement) {\n if (this.activeElement !== this.activeRegion && this.activeElement !== this.activeSection) {\n this.activeElement.classList.remove(A11yClassNames.ACTIVE);\n this.activeElement.dispatchEvent(new Event(A11yCustomEventTypes.DEACTIVATE));\n }\n this.activeElement.removeEventListener(A11yCustomEventTypes.UPDATE, this.handleActiveElementUpdate);\n this.activeElement = null;\n }\n }",
"_updateActiveFlag() {\n // Calculate active flag.\n let newActive = this.isActive();\n if (this._active !== newActive) {\n if (newActive) {\n this._setActiveFlag();\n } else {\n this._unsetActiveFlag();\n }\n\n let children = this._children.get();\n if (children) {\n let m = children.length;\n if (m > 0) {\n for (let i = 0; i < m; i++) {\n children[i]._updateActiveFlag();\n }\n }\n }\n\n // Run this after all _children because we'd like to see (de)activating a branch as an 'atomic' operation.\n if (newActive) {\n this.emit('active');\n } else {\n this.emit('inactive');\n }\n }\n }",
"_onActiveChanged(sender, args) {\n if (args.newValue) {\n args.newValue.title.className += ` ${ACTIVE_CLASS}`;\n }\n if (args.oldValue) {\n args.oldValue.title.className = args.oldValue.title.className.replace(ACTIVE_CLASS, '');\n }\n this._activeChanged.emit(args);\n }",
"onclick(e) {\n if(e.target.id != this.state.active) {\n this.setState({active: e.target.id}, function() {\n this.props.changeBase(this.state.objects[this.state.active])\n });\n }\n }",
"activate() {\r\n if (this.div !== null) this.div.classList.add('is-active');\r\n }",
"init(){\n\t\tthis._active = true\n\t}",
"_handleActiveTabs() {\n this.dispatchEvent(\n new CustomEvent(\"active-tabs-changed\", {\n bubbles: true,\n cancelable: true,\n composed: false,\n detail: this,\n })\n );\n }"
] |
[
"0.65781116",
"0.6545466",
"0.6515821",
"0.6304341",
"0.627972",
"0.6235652",
"0.62111646",
"0.6155374",
"0.6117066",
"0.61030644",
"0.6091726",
"0.60815614",
"0.6068617",
"0.60581005",
"0.6040956",
"0.60160506",
"0.60120153",
"0.5998196",
"0.5996773",
"0.5992884",
"0.5961184",
"0.5961184",
"0.59500146",
"0.59421366",
"0.59263456",
"0.5921895",
"0.59188634",
"0.59055",
"0.58961296",
"0.5882721"
] |
0.717747
|
0
|
Initialize stores for the db
|
initializeStores() {
this.stores.forEach((store) => {
let [ver, storeDef] = store;
console.log('Registering version %s of stores:\n%s', ver, Object.keys(storeDef).join(', '));
this.db.version(ver).stores(storeDef);
});
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function setup_stores()\n{\n\t// Init Files \n\tmodels['Files'] = new IDBStore({\n\t storeName: 'Files',\n\t keyPath: 'id',\n\t dbVersion: site.config.indexeddb.Files.version,\n\t storePrefix: '',\n\t autoIncrement: true,\n\t\tindexes: site.config.indexeddb.Files.indexes,\t \n\t onStoreReady: get_files_data\n\t});\n}",
"async initialize () {\n super.initialize()\n\n this.stores = _.mapValues(this.app.config.stores, (store, storeName) => {\n return {\n knex: knex(Object.assign({ }, store)),\n models: _.pickBy(this.app.models, { store: storeName }),\n migrate: store.migrate\n }\n })\n return this.migrate()\n }",
"init() {\n if (this.__isInitialized) {\n return; // silently do nothing.\n }\n\n this.__isInitialized = true;\n let data = this.cursor.fetch();\n\n data.forEach(doc => {\n this.store[doc._id] = doc;\n });\n }",
"init() {\n console.log('initializing store...')\n }",
"initialiseStore(state) {\n\t\t\t// Check if the ID exists\n\t\t\tif(localStorage.getItem('store')) {\n\t\t\t\t// Replace the state object with the stored item\n\t\t\t\tthis.replaceState(\n\t\t\t\t\tObject.assign(state, JSON.parse(localStorage.getItem('store')))\n\t\t\t\t);\n\t\t\t}\n\t\t}",
"init(options = {}) {\n const { store } = options;\n if (!store) throw new Error('Require store');\n this._store = store;\n }",
"function init() {\n setStore();\n handleHistory();\n }",
"initialiseStore (state) {\n if (localStorage.getItem('store')) {\n this.replaceState(\n Object.assign(state, JSON.parse(localStorage.getItem('store')))\n )\n }\n }",
"function initData(callback) {\n initLanguage(); // set the system language if not set\n DB.loadAll(function() {\n if(getUsers() === null){\n setUsers(DB.users);\n console.log('storing users in localStorage');\n }\n if(getBeverages() === null){\n setBeverages(DB.beverages);\n console.log('Storing beverages in localstorage');\n }\n if(getOrders() === null){\n setOrders([]);\n }\n if(callback) callback();\n });\n}",
"function initializeStore() {\r\n // Create the sqlite store\r\n store = new WindowsAzure.MobileServiceSqliteStore('store.db');\r\n\r\n // Define the table schema\r\n return store.defineTable({\r\n name: tableName,\r\n columnDefinitions: {\r\n id: 'string',\r\n score: 'number',\r\n }\r\n }).then(function() {\r\n // Initialize the sync context\r\n syncContext = client.getSyncContext();\r\n\r\n // Define an overly simplified push handler that discards\r\n // local changes whenever there is an error or conflict.\r\n // Note that a real world push handler will have to take action according\r\n // to the nature of conflict.\r\n syncContext.pushHandler = {\r\n onConflict: function (pushError) {\r\n return pushError.cancelAndDiscard();\r\n },\r\n onError: function (pushError) {\r\n return pushError.cancelAndDiscard();\r\n }\r\n };\r\n\r\n return syncContext.initialize(store);\r\n })\r\n .then(function() {\r\n scoreTable = client.getSyncTable(tableName);\r\n });\r\n }",
"initialize(initProps) {\n this.bind(_appStore, this.onStoreUpdate.bind(this));\n }",
"function initDatabases(callback) {\n db = {};\n\n db.games = new Datastore({\n filename: './databases/games.db',\n autoload: true\n });\n\n db.achievements = new Datastore({\n filename: './databases/achievements.db',\n autoload: true\n });\n\n db.activities = new Datastore({\n filename: './databases/activities.db',\n autoload: true\n });\n\n db.network = new Datastore({\n filename: './databases/network.db',\n autoload: true\n });\n\n db.messages = new Datastore({\n filename: './databases/messages.db',\n autoload: true\n });\n\n db.favorites = new Datastore({\n filename: './databases/favorites.db',\n autoload: true\n });\n\n // Find and Merge all New Achievements\n storeGet(null, \"achievements\", function(prevAchievements) {\n if (prevAchievements) {\n achievementHelpers.storeAchievementFiles(prevAchievements);\n }\n\n });\n\n}",
"function getStores() {\n return [MainStore];\n}",
"constructor(rootStore) {\n this.rootStore = rootStore;\n }",
"initialiseStore(state) {\n\t\t\tif(localStorage.getItem(LOCAL_STORAGE_KEY)) {\n\t\t\t\t// Replace the state object with the stored item\n\t\t\t\tthis.replaceState(\n\t\t\t\t\tObject.assign(state, JSON.parse(localStorage.getItem(LOCAL_STORAGE_KEY)))\n\t\t\t\t);\n\t\t\t}\n\t\t}",
"constructor(root, store) {\n this.root = root;\n this.store = store;\n this.init();\n }",
"constructor() {\n this.initStore(this.constructor.fields());\n this.registerFields();\n }",
"constructor(root, store) {\n this.root = root;\n this.store = store;\n init();\n }",
"_initSchema() {\n this.version(1).stores({\n pages: 'url, *terms, *titleTerms, *urlTerms, domain',\n visits: '[time+url], url',\n bookmarks: 'url, time',\n tags: '[name+url], name, url',\n })\n\n // ... add versions/migration logic here\n\n // Set up model classes\n this.pages.mapToClass(Page)\n this.visits.mapToClass(Visit)\n this.bookmarks.mapToClass(Bookmark)\n this.tags.mapToClass(Tag)\n }",
"function initialize(dir, callback) {\n\tif (store)\n\t\treturn callback(\"data store is already initialized\");\n\n\tvar ready = false;\n\tchokidar.watch(dir, {\n\t\tignored : /[\\/\\\\]\\./\n\t}).on('error', function(error) {\n\t\tlog.warn(\"Error watching %s : %s\", dir, error)\n\t}).on('ready', function() {\n\t\tload(dir, function(err) {\n\t\t\tif (err)\n\t\t\t\treturn callback(err);\n\t\t\tlog.info(\"data store loaded\");\n\t\t\tready = true;\n\t\t\tcallback(null);\n\t\t});\n\t}).on('all', function(event, path) {\n\t\tif ( !ready )\n\t\t\treturn;\n\t\tlog.debug({ event: event, path: path }, \"data store changed\");\n\t\tload(dir, function(err, result) {\n\t\t\tif (err)\n\t\t\t\tlog.err(err);\n\t\t\tlog.debug(\"data store reloaded\");\n\t\t});\n\t});\n}",
"constructor() {\r\n super();\r\n this._store = {};\r\n }",
"initStore (state, value) {\n state.$storage = value.storage;\n state.$electron = value.electron;\n }",
"function initializeDatabase() {\n //Drop collections\n mTools.dropCollection(GlobalAttributes, \"GlobalAttributes\", {}, function(cbParams) { console.log(\"[Info] Collection GlobalAttributes dropped!\"); });\n try {\n mTools.dropCollection(User, \"Users\", {}, function(cbParams) { console.log(\"[Info] Collection Users dropped!\"); });\n } catch (e) {\n console.log(\"[Notice] Users collection not dropped.\");\n }\n\n //Load GlobalStats Objects\n let newGSArr = [];\n newGSArr.push(new BlankGlobalAttribute(-1, 0, true)); //Global Clicks\n newGSArr.push(new BlankGlobalAttribute(-2, 0, true)); //Global Level\n newGSArr.push(new BlankGlobalAttribute(-3, 0, false)); //Global Ascensions\n batchLoadDBObjects(GlobalAttributes, newGSArr);\n\n checkListening();\n}",
"constructor() {\n this.#database = new Datastore({\n filename: \"./server/database/rooms.db\",\n autoload: true,\n });\n }",
"static setup() {\n this.dbPromise = idb.open('mws-db', 2, upgradeDb => {\n switch (upgradeDb.oldVersion) {\n case 0:\n upgradeDb.createObjectStore('restaurants', { keyPath: 'id' });\n console.log('created db v1');\n case 1:\n let reviewsStore = upgradeDb.createObjectStore('reviews', { keyPath: 'id' });\n reviewsStore.createIndex('restaurant_id', 'restaurant_id', { unique: false });\n console.log('created db v2');\n }\n });\n }",
"function initialize() {\n var db = getDatabase();\n db.transaction(\n function(tx) {\n // Create the settings table if it doesn't already exist\n // If the table exists, this is skipped\n tx.executeSql('CREATE TABLE IF NOT EXISTS units(name TEXT UNIQUE, quantity TEXT, value FLOAT)');\n });\n}",
"async initializePage(context) {\n await context.getters.harvester.setStore(context)\n await context.getters.rich.setStore(context)\n await context.getters.timeline.setStore(context).initialFetch()\n }",
"Store() {\n\n }",
"function databaseInitialize() {\n zip_content_db = loki_db.getCollection(\"zipInfo\");\n if (zip_content_db === null) {\n zip_content_db = loki_db.addCollection(\"zipInfo\", { indices: ['filePath'] });\n }\n var entryCount = zip_content_db.count();\n console.log(\"[zipInfoDb] number of entries in database : \" + entryCount);\n}",
"static async init () {\n if (!collections.STATION_COLL) {\n throw new Error('Missing env variable');\n }\n Station.COLLECTION = collections.STATION_COLL;\n Station.validator = new SchemaValidator();\n const instance = Mongo.instance();\n\n await Station.validator.init({ schemas: [schema] });\n\n Station.db = instance.getDb();\n }"
] |
[
"0.7627842",
"0.74474126",
"0.7218285",
"0.7168389",
"0.7030366",
"0.6853619",
"0.6839941",
"0.6811335",
"0.67141503",
"0.668069",
"0.66200006",
"0.6615841",
"0.65716076",
"0.64706916",
"0.64464134",
"0.64430267",
"0.6414425",
"0.63931113",
"0.6374085",
"0.63714373",
"0.6364521",
"0.6354357",
"0.6343527",
"0.6333009",
"0.6327083",
"0.62896836",
"0.6265042",
"0.62349504",
"0.6217156",
"0.6209801"
] |
0.82220805
|
0
|
videoListUp controls theatre mode effect and animations
|
function videoListUp(){
$('.listUpWrap').hide();
$('.listDropWrap').slideDown();
$('.videoRowWrapper').velocity({
'height': '60%'
}, 600);
$('#listContentWrap').velocity({
'height': '40%'
}, 600);
$('.videoListRowWrapper').fadeIn(500, ()=>{
$('#text-carousel').slideDown(800);
$('.thRow').fadeIn(700);
$('.listDropWrap').slideDown(700);
});
$('#mainVideo').velocity({
'width': '98vh',
'height': '55vh'
}, 600);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function overVideoControl() {\n videoCtrlTl.reverse();\n }",
"function WeBack(theMode) {\n Mode = theMode;\n ModeCheck(Mode);\n\n areAnimated = [false, false, false, false];\n document.getElementById(\"nextVid\").style.display = \"none\";\n Learn_video.currentTime = 0;\n Learn_video.src = arrVideoList[0].name;\n Learn_video.play();\n console.log(arrVideoList[0].emotions);\n}",
"function Learn_show() {\n console.log('Learn_show()');\n\n setInterval(Learn_onVideoUpdate, 50);\n\n Learn_setGreenLights();\n Learn_setVideoControls();\n\n Learn_setInteractionCallbacksLearn();\n CheckClick(clickCount);\n NextButtonClick();\n\n console.log(arrVideoList[0].emotions);\n\n videoCounter = arrVideoList.length;\n\n window.onresize = Learn_onResize;\n\n //Learn_setFullscreen();\n\n Learn_video.play();\n}",
"function Learn_show(theMode) {\n //console.log('Learn_show()');\n\n Mode = theMode;\n console.log(\"STARTED IN MODE: \" + Mode);\n\n setInterval(Learn_onVideoUpdate, 50);\n\n Learn_setGreenLights();\n Learn_setVideoControls();\n Learn_setInteractionCallbacksLearn();\n\n if(Mode == \"play\") {\n CheckNew();\n //NextButtonClick();\n document.getElementById(\"button-gallery\").style.display = \"none\";\n }\n else {\n document.getElementById(\"button-gallery\").style.display = \"block\";\n }\n NextButtonClick();\n console.log(arrVideoList[0].emotions);\n\n window.onresize = Learn_onResize;\n //Learn_setFullscreen();\n\n Learn_video.src = arrVideoList[0].name;\n Learn_video.play();\n}",
"function hoverVideo(e) { \n\t $('video', this).get(0).play(); \n $('video', this).removeClass('gris');\n // $('video', this).get(0).currentTime = 3;\n \n\n\t}",
"function addUp() \n {\n for (i=0; i<= pauses.length-1; i++) \n {\n vidSum[i] = pauses[i] - plays[i];\n }\n\n durVid = vidSum.reduce(add, 0) / 1000;\n\n // Somewhat arbitrary amount in seconds to mark the video as \"watched\". \n if (durVid >= 3) \n {\n var vidId = vidlog.event.split(\"%\")[5];\n\n if (!finishedContentIds.includes(vidId))\n {\n var elements = document.getElementsByClassName(\"hd hd-2\"); \n var videoTitle = \"\"; \n\n if (elements.length > 0)\n {\n videoTitle = elements[0].innerText; \n }\n\n logVideoEvent(videoTitle);\n finishedContentIds.push(vidId)\n }\n }\n }",
"function getVideo(event) { \n if (event.target.id == 'arrow-right') {\n activeIndex += 1;\n if (activeIndex == srcList.length) {\n activeIndex = 0;\n }\n }\n\n else if (event.target.id == 'arrow-left') {\n activeIndex -= 1;\n if (activeIndex < 0 ) {\n activeIndex = srcList.length - 1;\n }\n } \n \n else if (event.target.id == 'button-1') {\n activeIndex = 0;\n }\n\n else if (event.target.id == 'button-2') {\n activeIndex = 1;\n }\n\n else if (event.target.id == 'button-3') {\n activeIndex = 2;\n }\n \n setVideo(srcList[activeIndex]); // calling a function with the active video source in order to play the video\n activeButton(activeIndex);\n}",
"function outVideoControl() {\n videoCtrlTl.play();\n }",
"function buildVideoList(id, activeId, media) {\n var list = document.getElementById(id);\n \n // clear old content\n list.innerHTML = '';\n\n var n = media.length;\n \n console.log('Building menu ('+id+') with ' + n + ' elements');\n \n for (var i = 0; i < n; i++) {\n var video = media[i];\n \n \n var title = video.title;\n if (video.grandparentTitle) {\n title = video.grandparentTitle;\n }\n var meta = ' <img src=\"images/bullet1.png\" alt=\"\" /> ' + video.year;\n var offset = (video.viewOffset) ? video.viewOffset : 0;\n \n var item = document.createElement('li');\n item.setAttribute('data-key', video.key);\n\n if(video.type == \"photo\")\n item.setAttribute('data-type', (video.type));\n else\n item.setAttribute('data-type', (video.container) ? 'container' : 'video');\n item.setAttribute('data-title', title);\n item.setAttribute('data-meta', meta);\n item.setAttribute('data-offset', offset);\n //item.setAttribute('onclick', 'jump(,\"'+(i*140)+'px\");');\n\n var thumb = video.thumb;\n if (video.grandparentThumb) {\n thumb = video.grandparentThumb;\n }\n\n if (Settings.useBlobs()) {\n if(Blobs.retrieveBlob(thumb, \"small\"))\n var scaledThumb = Blobs.retrieveBlob(thumb, \"small\");\n else\n var scaledThumb = plexAPI.getScaledImageURL(plexAPI.getURL(thumb), 121, 170);\n }\n else\n var scaledThumb = plexAPI.getScaledImageURL(plexAPI.getURL(thumb), 121, 170);\n \n var imageContainer = document.createElement(\"div\");\n imageContainer.className = \"imagecnt\";\n \n var img = new Image();\n img.onerror = posterErrorHandler;\n \n /* this needs fixing \n if (i < PRELOADED_IMAGES) {\n img.src = scaledThumb;\n img.setAttribute('data-src', scaledThumb);\n }\n else {\n img.src = PLACEHOLDER_IMAGE;\n img.setAttribute('data-src', scaledThumb);\n }\n */\n img.src = scaledThumb;\n img.setAttribute('data-src', scaledThumb); \n \n var episdeSeason;\n if(video.season){\n episdeSeason = document.createElement(\"span\");\n episdeSeason.className = \"episodeseason\";\n episdeSeason.innerHTML = \"S\" + video.season + \" <span class='icon-small'></span> E\" + video.episode;\n }\n \n var photoTitle;\n if(video.type == \"photo\") {\n photoTitle = document.createElement(\"span\");\n photoTitle.className = \"photo-subtitle\";\n photoTitle.innerHTML = video.title; \n } \n \n \n var progressImage;\n \n if (offset > 0)\n progressImage = \"images/OverlayInProgress.png\";\n else if (!video.viewCount) \n progressImage = \"images/OverlayUnwatched.png\";\n \n if(progressImage){ \n var progress = new Image();\n progress.src = progressImage;\n progress.className = \"progress\";\n }\n \n item.appendChild(imageContainer);\n imageContainer.appendChild(img);\n if(photoTitle)\n imageContainer.appendChild(photoTitle);\n if(episdeSeason)\n item.appendChild(episdeSeason);\n if(progressImage)\n item.appendChild(progress); \n list.appendChild(item);\n\n if (i === 0) {\n item.setAttribute('id',activeId);\n }\n\n }\n }",
"function playVideoJanFeb()\r\n{\r\n\r\n\t\t$('#image3').transition({ rotateX: '-105deg' }, 700, 'in-out', function(){ $(\"#image3\").css(\"display\",\"none\"); $(\"#image3back\").css(\"display\",\"none\"); });\r\n\t\t$('#image2').transition({ rotateX: '-105deg' , delay: 600}, 700, 'in-out', function(){ $(\"#image2\").css(\"display\",\"none\"); $(\"#image2back\").css(\"display\",\"none\"); });\r\n\t\t$('#image1').transition({ rotateX: '-105deg' , delay: 1200}, 700, 'in-out', function(){ \r\n\t\t\t\t\r\n\t\t\t\t$(\"#image1\").css(\"display\",\"none\"); \r\n\t\t\t\t$(\"#image1back\").css(\"display\",\"none\");\r\n\t\t\t\t$('#episodeVideoWindow').css(\"display\",\"block\"); \r\n\t\t\t\t$('#episodeVideoWindowBack').css(\"display\",\"block\"); \r\n\t\t\t\t$('#episodeVideoWindow').transition({ rotateX: '0deg' }, 700, 'in-out',function(){ \r\n\t\t\t\t\t//console.log(\"ROTATE ANIM END\");\r\n\t\t\t\t\t//$(\"#episodeVideoFrame\").remove(); \r\n\t\t\t\t\t$(\"#episodeVideo\").css(\"display\",\"inline-block\"); \r\n\t\t\t\t\r\n\t\t\t\t}); \r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t});\r\n\t\t\r\n\t\t$(\"#playVideoJanFavBTN\").css(\"display\", \"block\");\r\n\t\t\r\n\t\t$(\"#playVideoBtn\").off(\"click\",monthsToShow[currentSelectedMonth].playVideo);\r\n\t\t//console.log(\"Video Off\",$(\"#playVideoBtn\"));\r\n\t\t\r\n\t\tTweenMax.to($(\"#playVideoBtn\"),0.5,{css:{opacity: 0}, ease: Expo.easeInOut, onComplete: function(){\r\n\t\t\t$(\"#playVideoBtn\").css(\"display\",\"none\");\r\n\t\t}});\r\n\t\t$(\"#closeVideoBtn\").css(\"opacity\",\"0\").css(\"display\",\"block\");\r\n\t\t\r\n\t\t\r\n\t\t$(\"#closeVideoBtn\").on(\"click\",monthsToShow[currentSelectedMonth].reverseVideo);\r\n\t\t\r\n\t\tTweenMax.to($(\"#closeVideoBtn\"),0.5,{css:{opacity: 1}, delay: 0.5, ease: Expo.easeInOut});\r\n\t\t\r\n\t\tmonthsToShow[currentSelectedMonth].videoStatus = true;\r\n\t\t\r\n}",
"function init()\n{\n isTouchable = hasTouchScreen();\n VideoSource = document.getElementById(\"video\");\n loader = document.getElementById(\"collapse-loader\");\n animation = document.getElementById(\"animation\");\n banner = document.getElementById(\"banner\");\n loader.addEventListener(\"click\", clickthrough);\n var images = [];\n images.push(Enabler.getUrl('img/bg_perso.jpg'));\n images.push(Enabler.getUrl('img/coke_1.png'));\n images.push(Enabler.getUrl('img/fade.png'));\n images.push(Enabler.getUrl('img/t_episodes.png'));\n images.push(Enabler.getUrl('img/arrow_expand.png'));\n images.push(Enabler.getUrl('img/t_demarrez_votre_mois_gratuit.png'));\n \n if (!isMobile.any())\n {\n \n images.push(Enabler.getUrl('img/arrow_expand_red.png'));\n images.push(Enabler.getUrl('img/t_demarrez_votre_mois_gratuit_rollover.png'));\n }\n \n\n \n\n// IF YOU HAVE A CTA INSIDE YOUR VIDEO OR INTO YOUR ENDSHOT\n// USE THIS FUNCTION TO DISPLAYED DIFFERENT IMAGE/VIDEO\n\n\n preloadImages(images, startAd);\n}",
"function videoClickEvent(item,container,opt,simpleframe) {\n\n\n\t\t\t item.css({transform:\"none\",'-moz-transform':'none','-webkit-transform':'none'});\n\t\t\t item.closest('.esg-overflowtrick').css({transform:\"none\",'-moz-transform':'none','-webkit-transform':'none'});\n\t\t\t item.closest('ul').css({transform:\"none\",'-moz-transform':'none','-webkit-transform':'none'});\n\n\n\t\t\t // PREPARE THE CONTAINERS FOR MEDIAS\n\t\t\t if (!simpleframe)\n\t\t\t\t item.find('.esg-media-video').each(function() {\n\t\t\t\t var prep = jQuery(this);\n\t\t\t\t if (prep.data('youtube')!=undefined && item.find('.esg-youtube-frame').length==0) {\n\t\t\t\t\t var media= item.find('.esg-entry-media');\n\t\t\t\t \t var ytframe = \"https://www.youtube.com/embed/\"+prep.data('youtube')+\"?version=3&enablejsapi=1&html5=1&controls=1&autohide=1&rel=0&showinfo=0\";\n\t\t\t\t\t media.append('<iframe class=\"esg-youtube-frame\" wmode=\"Opaque\" style=\"position:absolute;top:0px;left:0px;display:none\" width=\"'+prep.attr(\"width\")+'\" height=\"'+prep.attr(\"height\")+'\" data-src=\"'+ytframe+'\" src=\"about:blank\"></iframe>');\n\t\t\t\t }\n\n\t\t\t\t if (prep.data('vimeo')!=undefined && item.find('.esg-vimeo-frame').length==0) {\n\t\t\t\t\t var media= item.find('.esg-entry-media');\n\t\t\t\t \t var vimframe = \"http://player.vimeo.com/video/\"+prep.data('youtube')+\"?title=0&byline=0&html5=1&portrait=0&api=1;\";\n\t\t\t\t\t media.append('<iframe class=\"esg-vimeo-frame\" allowfullscreen=\"false\" style=\"position:absolute;top:0px;left:0px;display:none\" webkitallowfullscreen=\"\" mozallowfullscreen=\"\" allowfullscreen=\"\" width=\"'+prep.attr(\"width\")+'\" height=\"'+prep.attr(\"height\")+'\" data-src=\"'+vimframe+'\" src=\"about:blank\"></iframe>');\n\t\t\t\t }\n\t\t\t\t\tif (prep.data('wistia')!=undefined && item.find('.esg-wistia-frame').length==0) {\n\t\t\t\t\t var media= item.find('.esg-entry-media');\n\t\t\t\t \t var wsframe = \"https://fast.wistia.net/embed/iframe/\"+prep.data('wistia')+\"?version=3&enablejsapi=1&html5=1&controls=1&autohide=1&rel=0&showinfo=0\";\n\t\t\t\t\t media.append('<iframe class=\"esg-wistia-frame\" wmode=\"Opaque\" style=\"position:absolute;top:0px;left:0px;display:none\" width=\"'+prep.attr(\"width\")+'\" height=\"'+prep.attr(\"height\")+'\" data-src=\"'+wsframe+'\" src=\"about:blank\"></iframe>');\n\t\t\t\t }\n\t\t\t\t if (prep.data('soundcloud')!=undefined && item.find('.esg-soundcloud-frame').length==0) {\n\t\t\t\t\t var media = item.find('.esg-entry-media');\n\t\t\t\t\t var scframe = 'https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/'+prep.data('soundcloud')+'&auto_play=false&hide_related=false&visual=true&show_artwork=true';\n\t\t\t\t\t media.append('<iframe class=\"esg-soundcloud-frame\" allowfullscreen=\"false\" style=\"position:absolute;top:0px;left:0px;display:none\" webkitallowfullscreen=\"\" mozallowfullscreen=\"\" allowfullscreen=\"\" width=\"'+prep.attr(\"width\")+'\" height=\"'+prep.attr(\"height\")+'\" scrolling=\"no\" frameborder=\"no\" data-src=\"'+scframe+'\" src=\"about:blank\"></iframe>');\n\t\t\t\t }\n\n\t\t\t\t if ((prep.data('mp4')!=undefined || prep.data('webm')!=undefined || prep.data('ogv')!=undefined) && item.find('.esg-video-frame').length==0 ) {\n\t\t\t\t \t var media= item.find('.esg-entry-media');\n\t\t\t media.append('<video class=\"esg-video-frame\" style=\"position:absolute;top:0px;left:0px;display:none\" width=\"'+prep.attr(\"width\")+'\" height=\"'+prep.attr(\"height\")+'\" data-origw=\"'+prep.attr(\"width\")+'\" data-origh=\"'+prep.attr(\"height\")+'\" ></video');\n\t\t\t\t if (prep.data('mp4')!=undefined) media.find('video').append('<source src=\"'+prep.data(\"mp4\")+'\" type=\"video/mp4\" />');\n\t\t\t\t if (prep.data('webm')!=undefined) media.find('video').append('<source src=\"'+prep.data(\"webm\")+'\" type=\"video/webm\" />');\n\t\t\t\t if (prep.data('ogv')!=undefined) media.find('video').append('<source src=\"'+prep.data(\"ogv\")+'\" type=\"video/ogg\" />');\n\t\t\t\t }\n\n\t\t\t\t })\n\n\t\t\t adjustMediaSize(item,true,null,opt);\n\n\t\t\t var ifr = item.find('.esg-youtube-frame');\n\t\t\t if (ifr.length==0) ifr=item.find('.esg-vimeo-frame');\n\t\t\t if (ifr.length==0) ifr=item.find('.esg-wistia-frame');\n\t\t\t if (ifr.length==0) ifr=item.find('.esg-soundcloud-frame');\n\t\t\t if (ifr.length==0) ifr=item.find('.esg-video-frame');\n\n\t\t\t var cover = item.find('.esg-entry-cover');\n\t\t\t var poster = item.find('.esg-media-poster');\n\n\n\n\t\t\t // IN CASE NO FRAME IS PREDEFINED YET WE NEED TO LOAD API, AND VIDEO, AND CHANGE SRC\n\n\t\t\t if (ifr.attr('src')==\"about:blank\") {\n\t\t\t\t ifr.attr('src',ifr.data('src'));\n\n\t\t\t\t loadVideoApis(container,opt);\n\t\t\t\t if (!simpleframe) punchgs.TweenLite.set(ifr,{opacity:0,display:\"block\"});\n\t\t\t\t var intr = setInterval(function() {\n\n\t\t\t\t \t// CHECK IF YOUTUBE MEDIA IS IN THE CONTAINER\n\t\t\t\t \tif (ifr.attr('src').toLowerCase().indexOf('youtube')>0) {\n\t\t\t\t \t if (prepareYT(ifr)==true) {\n\n\t\t\t\t \t\t\tclearInterval(intr);\n\t\t\t\t \t\t\tif (!simpleframe) {\n\t\t\t\t \t\t\t\tif (is_mobile()) {\n\t\t\t\t\t \t\t\t\tpunchgs.TweenLite.set(ifr,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(poster,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(cover,{autoAlpha:0});\n\t\t\t\t \t\t\t\t} else {\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(ifr,0.5,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(poster,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(cover,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tplayYT(ifr,simpleframe);\n\t\t\t\t\t\t\t \t}\n\n\t\t\t\t\t\t \t}\n\t\t\t\t \t }\n\t\t\t\t \t}\n\n\t\t\t\t \telse\n\n\t\t\t\t\t// CHECK IF VIMEO MEDIA IS IN THE CONTAINER\n\t\t\t\t \tif (ifr.attr('src').toLowerCase().indexOf('vimeo')>0) {\n\t\t\t\t \t if (prepareVimeo(ifr)==true) {\n\t\t\t\t \t \t\tclearInterval(intr);\n\t\t\t\t \t \t\tif (!simpleframe) {\n\t\t\t\t\t \t \t\tif (is_mobile()) {\n\t\t\t\t\t \t\t\t\tpunchgs.TweenLite.set(ifr,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(poster,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(cover,{autoAlpha:0});\n\t\t\t\t \t\t\t\t} else {\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(ifr,0.5,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(poster,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(cover,0.5,{autoAlpha:0});\n\n\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t\t \tplayVimeo(ifr,simpleframe);\n\t\t\t\t\t\t \t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t \telse\n\t\t\t\t\t\n\t\t\t\t\t// CHECK IF wistia MEDIA IS IN THE CONTAINER\n\t\t\t\t\tif (ifr.attr('src').toLowerCase().indexOf('wistia')>0) {\n\t\t\t\t\t\tif (prepareWs(ifr)==true) {\n\n\t\t\t\t \t\t\tclearInterval(intr);\n\t\t\t\t \t\t\tif (!simpleframe) {\n\t\t\t\t \t\t\t\tif (is_mobile()) {\n\t\t\t\t\t \t\t\t\tpunchgs.TweenLite.set(ifr,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(poster,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(cover,{autoAlpha:0});\n\t\t\t\t \t\t\t\t} else {\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(ifr,0.5,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(poster,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(cover,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tplayYT(ifr,simpleframe);\n\t\t\t\t\t\t\t \t}\n\n\t\t\t\t\t\t \t}\n\t\t\t\t\t\t}\n\t\t\t\t \t}\n\n\t\t\t\t\telse\n\n\t\t\t\t\t// CHECK IF VIMEO MEDIA IS IN THE CONTAINER\n\t\t\t\t \tif (ifr.attr('src').toLowerCase().indexOf('soundcloud')>0) {\n\t\t\t\t \t if (prepareSoundCloud(ifr)==true) {\n\t\t\t\t \t \t\tclearInterval(intr);\n\t\t\t\t \t \t\tif (!simpleframe) {\n\t\t\t\t\t\t \t\tif (is_mobile()) {\n\t\t\t\t\t \t\t\t\tpunchgs.TweenLite.set(ifr,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(poster,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(cover,{autoAlpha:0});\n\t\t\t\t \t\t\t\t} else {\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(ifr,0.5,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(poster,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(cover,0.5,{autoAlpha:0});\n\n\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t \t\tplaySC(ifr,simpleframe);\n\t\t\t\t\t\t \t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t},100);\n\t\t\t} else\n\n\t\t\tif (ifr.hasClass(\"esg-video-frame\")) {\n\n\t\t\t\t loadVideoApis(container,opt);\n\t\t\t\t punchgs.TweenLite.set(ifr,{opacity:0,display:\"block\"});\n\t\t\t\t // CHECK IF VIDEO MEDIA IS IN THE CONTAINER\n\t\t\t\t var intr = setInterval(function() {\n\t\t\t\t \t if (prepareVideo(ifr)==true) {\n\t\t\t\t \t \t\tclearInterval(intr);\n\t\t\t\t \t \t\tif (!simpleframe) {\n\t\t\t\t\t \t \t\tif (is_mobile()) {\n\t\t\t\t\t \t\t\t\tpunchgs.TweenLite.set(ifr,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(poster,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(cover,{autoAlpha:0});\n\t\t\t\t \t\t\t\t} else {\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(ifr,0.5,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(poster,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(cover,0.5,{autoAlpha:0});\n\n\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t\t \tplayVideo(ifr,simpleframe);\n\t\t\t\t\t\t \t}\n\n\t\t\t\t\t\t}\n\t\t\t\t },100)\n\n\t\t\t } else {\n\t\t\t\tif (!simpleframe) {\n\t\t\t\t\tif (is_mobile()) {\n\t\t \t\t\t\tpunchgs.TweenLite.set(ifr,{autoAlpha:1});\n\t\t\t\t \t\tpunchgs.TweenLite.set(poster,{autoAlpha:0});\n\t\t\t\t \t\tpunchgs.TweenLite.set(cover,{autoAlpha:0});\n\t\t\t\t \t} else {\n\n\t\t\t\t\t\tpunchgs.TweenLite.set(ifr,{opacity:0,display:\"block\"});\n\t\t\t\t \t\tpunchgs.TweenLite.to(ifr,0.5,{autoAlpha:1});\n\t\t\t\t \t\tpunchgs.TweenLite.to(poster,0.5,{autoAlpha:0});\n\t\t\t\t \t\tpunchgs.TweenLite.to(cover,0.5,{autoAlpha:0});\n\t\t\t\t \t}\n\t\t\t \t}\n\t\t \t\tif (ifr.attr('src') !=undefined) {\n\t\t\t \t\tif (ifr.attr('src').toLowerCase().indexOf('youtube')>0)\n\t\t\t\t\t \tplayYT(ifr,simpleframe);\n\t\t\t\t\tif (ifr.attr('src').toLowerCase().indexOf('vimeo')>0)\n\t\t\t\t\t \tplayVimeo(ifr,simpleframe);\n\t\t\t\t\tif (ifr.attr('src').toLowerCase().indexOf('wistia')>0)\n\t\t\t\t\t \tplayWs(ifr,simpleframe);\n\t\t\t\t\tif (ifr.attr('src').toLowerCase().indexOf('soundcloud')>0)\n\t\t\t\t\t \tplaySC(ifr,simpleframe);\n\n\t\t\t\t}\n\t\t\t }\n}",
"function setUpPlaylist(input){\n var player=input.player, playlistId=input.playlistId, div=input.div, \n actionClick=input.actionClick, actionEnter=input.actionEnter, actionLeave=input.actionLeave;\n styleNowPlaying=input.styleNowPlaying, styleNotPlaying=input.styleNotPlaying;\n //div.style.display=\"block\";\n var sampleNode=div.getElementsByClassName('sampleNode')[0].cloneNode(true);\n while (div.firstChild) {\n div.removeChild(div.firstChild);\n }\n div.appendChild(sampleNode);\n var templateNode = sampleNode.cloneNode(true);\n sampleNode.style.display = \"none\";\n //get playlist video Ids as array\n var playlist=[],item=[],len;\n var styled=false;\n followPlaylist(player, div, styleNowPlaying, styleNotPlaying);\n if(typeof playlistId===\"string\"){//use playlistId, Max 50 items\n playlistInfo(playlistId,getlist);\n }\n else {//use Array, no maximun\n playlist=playlistId;\n len=playlist.length;\n for(var i=0;i<len;i++){\n display(i);\n }\n } \n function getlist(data1){\n len=data1.items.length;//test2.innerHTML+=\" playlistData:\"+len;\n for(var i=0;i<len;i++){\n playlist[i]=data1.items[i].contentDetails.videoId;\n display(i); \n }\n }\n function display(i){\n videoInfo(playlist[i],construction);\n function construction(data){\n\n //item[i]=div.getElementsByClassName('sampleNode')[0].cloneNode(true);//true:clone with all descendants\n item[i] = templateNode.cloneNode(true); //true:clone with all descendants\n // item[i].style.display=\"block\";\n if(item[i].getElementsByClassName(\"title\")[0]!=null) \n item[i].getElementsByClassName(\"title\")[0].innerHTML=data.items[0].snippet.title;\n if(item[i].getElementsByClassName(\"channelTitle\")[0]!=null)\n item[i].getElementsByClassName(\"channelTitle\")[0].innerHTML=data.items[0].snippet.channelTitle;\n if(item[i].getElementsByClassName(\"thumbnail\")[0]!=null){ \n var image=document.createElement('img');\n //image.setAttribute('src',data.items[0].snippet.thumbnails.default.url);\n image.setAttribute('src', 'http://img.youtube.com/vi/' + playlist[i] + '/default.jpg');\n item[i].getElementsByClassName(\"thumbnail\")[0].appendChild(image);\n }\n\n item[i].className += \" playlistItem \"+i+\" \"+playlist[i];\n //item[i].id=\"position:\"+i;\n //test2.innerHTML+=item[i].id;\n if(input.actionClick!=null) item[i].addEventListener(\"click\",click);\n if(input.actionEnter!=null)item[i].addEventListener(\"mouseenter\",cursorEnter);//better to use css :hover\n if(input.actionLeave!=null)item[i].addEventListener(\"mouseleave\",cursorLeave);\n //insert item in the right order\n if (i === len - 1) {\n div.appendChild(item[i]);\n //div.getElementsByClassName('sampleNode')[0].style.display = \"none\";\n }\n for(var j=i+1;j<len;j=j+1){\n if(item[j]!=undefined){\n div.insertBefore(item[i], item[j]);\n break;\n }\n if(j===len-1) div.appendChild(item[i]);\n }\n\n //check if now playing\n if(styled===false){\n var videoId=getQueryVariable(player.getVideoUrl(),'v');\n if(playlist[i]===videoId) {\n var event={data:player.getPlayerState()};\n if (styleNowPlaying) styleNowPlaying(event, item[i]);\n styled=true;\n } \n }\n function click(event){\n //loadVideo(player,playlist[i]);\n actionClick(event,i,item[i]);\n }\n function cursorEnter(event){\n actionEnter(event,i,item[i]);\n }\n function cursorLeave(event){\n actionLeave(event,i,item[i]);\n }\n }\n } \n function followPlaylist(player, playlistDiv,styleNowPlaying,styleNotPlaying) {\n //but eventlistenr seems always happen before div setting\n // test2.innerHTML+=\" eventListener\";\n player.addEventListener(\"onStateChange\",nowPlaying);\n function nowPlaying(event){\n //if(event.data===-1){\n var videoId=getQueryVariable(player.getVideoUrl(),'v');\n var itemDiv=playlistDiv.getElementsByClassName(videoId)[0];\n var listItems=playlistDiv.getElementsByClassName(\"playlistItem\");\n if(styleNotPlaying!=null) {for(var i=0;i<listItems.length;i++) styleNotPlaying(event,listItems[i]);}\n if(styleNowPlaying!=null) styleNowPlaying(event,itemDiv);\n //}\n }\n } \n}",
"function videoEndHandler1(e) {\n //creative.dom.video1.vid.currentTime = 0;\n creative.dom.video1.vid.pause();\n //creative.dom.video1.vidPauseBtn.style.visibility = 'hidden';\n //creative.dom.video1.vidPlayBtn.style.visibility = 'visible';\n creative.isClick1 = true;\n\n /**\n * Hide video container ONlY and not the controls \n */\n\n //creative.dom.video1.vidContainer\n creative.dom.video1.vid.style.display = 'block'; \n creative.dom.expandedBgr.style.display = 'block';\n creative.dom.expandedHeading.style.visibility = 'visible';\n creative.dom.expandedHeading.style.display = 'block';\n\n //start end frame tween animation\n endFrameAnimation();\n}",
"function playVideo(index) {\n var num\n thumbnails[index].addEventListener(\"click\", function chooseVideo(){\n position = index * (-62)\n imageHolder.style.left = String(position) + \"vw\"\n imageHolder.style.transition =\"all 1s ease\"\n num = position / (-62)\n videoTitle.textContent = ids[num][\"title\"]\n description.textContent = ids[num][\"info\"]\n })\n thumbnails[index].addEventListener(\"mouseover\", function changeSize() {\n thumbnails[index].style.marginLeft = \"0vw\"\n thumbnails[index].style.marginRight = \"0vw\"\n thumbnails[index].style.marginTop = \"-0.5vw\"\n thumbnails[index].style.width = \"8vw\"\n thumbnails[index].style.height = \"4.5vw\"\n //thumbnails[index].style.opacity = \"0.5\"\n })\n thumbnails[index].addEventListener(\"mouseout\", function changeSize() {\n thumbnails[index].style.marginLeft = \"0.5vw\"\n thumbnails[index].style.marginRight = \"0.5vw\"\n thumbnails[index].style.marginTop = \"0vw\"\n thumbnails[index].style.width = \"7vw\"\n thumbnails[index].style.height = \"4vw\"\n //thumbnails[index].style.opacity = \"1\"\n })\n}",
"function playerControler() {\n var video = document.getElementById(\"Videotv\");\n var image = document.getElementById(\"Imagetv\");\n var count =0; // conta os elementos\n var toplay; //guarda o url do item a reproduzir :)\n var value = 4;\n var playlistsize = $(\"#playlistsize\").val();\n playlist = String($(\"#playlist\").val()).split(\";\");\n for(var i=0;i<playlistsize;i++){\n if($(\"#nextmultimedia\").val()==playlistsize || $(\"#nextmultimedia\").val()==0){\n $(\"#nextmultimedia\").val(1);\n toplay = playlist[1];\n break;\n }else{\n if(count==$(\"#nextmultimedia\").val() && $(\"#nextmultimedia\").val()<playlistsize){\n toplay = playlist[value-3];\n $(\"#nextmultimedia\").val(count+1);\n break;\n }\n }\n value=value+4;\n count++;\n }\n if(playlist[value-2]=='video'){\n $('#Imagetv').hide();\n $(\"#Videotv\").show();\n video.src = toplay;\n video.play();\n videoManager();\n }else if(playlist[value-2]=='image'){\n $(\"#Videotv\").hide();\n $('#Imagetv').show();\n $('#targetTime').val(playlist[value-1]);\n image.src = toplay;\n startImageTime();\n }\n}",
"function videoEndHandler1(e) {\r\n //creative.dom.video1.vid.currentTime = 0;\r\n console.log('expanded intro video ended')\r\n creative.dom.video1.vid.pause();\r\n creative.dom.video1.vidPauseBtn.style.visibility = 'hidden';\r\n creative.dom.video1.vidPlayBtn.style.visibility = 'visible';\r\n creative.isClick1 = true;\r\n ShowExpandedEndFrame ();\r\n}",
"function playPrevVideo() {\n var index\n if (position < 0) {\n position = position + 62\n imageHolder.style.left = String(position) + \"vw\"\n imageHolder.style.transition =\"all 1s ease\"\n index = position / (-62)\n videoTitle.textContent = ids[index][\"title\"]\n description.textContent = ids[index][\"info\"]\n } else if (position === 0) {\n position = (ids.length-1) * (-62)\n imageHolder.style.left = String(position) + \"vw\"\n imageHolder.style.transition = \"left 0.5s ease\"\n index = position / (-62)\n videoTitle.textContent = ids[index][\"title\"]\n description.textContent = ids[index][\"info\"]\n }\n}",
"restoreDown(){\n let restore=document.querySelectorAll(\".restore_down\");\n let video=document.querySelectorAll(\".video_1\");\n let title=document.querySelector(\"#movie_title_iframe\");\n let player=document.querySelector(\"#video_player \");\n let isRestoreDown=true;\n\n\n restore.forEach(function (el) {\n\n el.addEventListener(\"click\", function (event) {\n event.preventDefault();\n if (isRestoreDown) {\n isRestoreDown = false;\n\n video[0].style.cssText = \"height: 140%;\";\n el.style.cssText = \"margin-left: 2%;\";\n if (title.textContent.length >= 42) {\n\n title.style.cssText = \" padding-right:1%;\"\n } else {\n title.style.cssText = \"padding-right:16%;\"\n }\n player.style.cssText = \" border-radius: 2px; width: 40%; height: 25%;display:block;margin-top:272px;padding-top:1%;padding-bottom:8%;margin-left:800px\"\n } else {\n isRestoreDown = true;\n\n if (title.textContent.length > 30) {\n\n title.style.cssText = \" padding-right:38%;\"\n } else {\n title.style.cssText = \"padding-right:54%;\"\n }\n video[0].style.cssText = \"height: 60%;\";\n player.style.cssText = \" border-radius: none; width: 100%; height: 100%;display:block;margin-top:0;margin-left:0px;padding-top:5%;padding-bottom:7%;\"\n\n }\n\n\n })\n\n })\n }",
"function switchVideo(n) {\r\n document.getElementsByTagName(\"video\")[0].pause();\r\n\r\n document.getElementById(\"mp4\").src = movieInfo[n].src;\r\n document.getElementById(\"ogg\").src =\r\n movieInfo[n].src.substring(0, movieInfo[n].src.length - 3) + \"ogg\";\r\n document.getElementsByTagName(\"video\")[0].load();\r\n\r\n // Change the position in the list\r\n position = n + 1;\r\n}",
"function mouseUp (e) {\n if (onplayhead === true) {\n moveplayhead(e)\n window.removeEventListener('mousemove', moveplayhead, true)\n // change current time\n player.currentTime = player.duration * clickPercent(e, timeline, timelineWidth)\n player.addEventListener('timeupdate', timeUpdate, false)\n }\n if (onVolhead === true) {\n console.log('Vol Up')\n moveVolHead(e)\n window.removeEventListener('mousemove', moveVolHead, true)\n // change current time\n player.volume = volPercent(e)\n }\n onVolhead = false\n onplayhead = false\n $('*').removeClass('nonselectable')\n }",
"function forwardButtonTrigger() {\n if (window.currentVideoSelectedForPlayback) {\n setCurrentlyPlaying(false)\n const currentNode = window.currentVideoSelectedForPlayback\n const currentTime = currentNode.data.videoCore.currentTime\n const currentVideoEnd = currentNode.data.metadata.endTime\n\n if (currentTime + 1 < currentVideoEnd) {\n currentNode.data.videoCore.currentTime += 1\n } else if (currentNode.next) {\n const remainingTime = 1 - currentTime\n window.currentVideoSelectedForPlayback = currentNode.next\n const nextStartTime = window.currentVideoSelectedForPlayback.data.metadata.startTime\n window.currentVideoSelectedForPlayback.data.videoCore.currentTime = nextStartTime + remainingTime\n } else {\n window.currentVideoSelectedForPlayback.data.videoCore.currentTime = currentVideoEnd\n }\n renderUIAfterFrameChange(window.currentVideoSelectedForPlayback)\n }\n}",
"showVideoOnTop(){\n this.scrollToTop(200)\n this.box.video = !this.box.video\n }",
"function landingPlayVideo(e) {\n\n\t\t\t// play all videos\n\t\t\tvideoOne.play();\n\t\t\tvideoTwo.play();\n\t\t\tvideoThree.play();\n\n\t\t\taudioThree.play();\n\t\t\taudioOne.play();\n\n\t\t\taudioThree.volume = 0.15;\n\n\t\t\tvideoWindow.classList.add(\"move-content\");\n\n\t\t\t// change videoPlay button text to pause\n\t\t\tvideoPlay.innerHTML = \"Pause\";\n\t\t\t// add \"playing\" class to video play button\n\t\t\tvideoPlay.classList.add(\"playing\");\n\n\t\t}",
"function playNextVideo() {\n var index\n if (position === (ids.length-1) * (-62)) {\n position = 0\n imageHolder.style.left = String(position) + \"vw\"\n imageHolder.style.transition = \"left 0.5s ease\"\n index = position / (-62)\n videoTitle.textContent = ids[index][\"title\"]\n description.textContent = ids[index][\"info\"]\n } else if (position <= 0) {\n position = position - 62\n imageHolder.style.left = String(position) + \"vw\"\n imageHolder.style.transition =\"all 1s ease\"\n index = position / (-62)\n videoTitle.textContent = ids[index][\"title\"]\n description.textContent = ids[index][\"info\"]\n }\n}",
"function playvideo(event){\n var addanimation=document.querySelector(\".\"+event);\n addanimation.classList.add(\"pressed\");\n setTimeout(function(){\n addanimation.classList.remove(\"pressed\")\n },100);\n\n}",
"function thumbNowPlaying() {\n var offset = $(curTarget).offset();\n if (thumbTimeout) {\n clearInterval(thumbTimeout);\n }\n $(video_thumb).css(offset);\n //console.log(\"Moving video to \" + offset);\n $(video_thumb).show();\n thumbTimeout = setInterval(thumbShotTrigger, (extractTime(segment_list[cur_segment].end) - extractTime(segment_list[cur_segment].begin)) * 1000);\n video_thumb.removeEventListener(\"playing\", thumbNowPlaying);\n }",
"function renderMovieList (list, $container, category) {\n $container.children[0].remove();\n list.forEach((movie) => {\n const HTMLString = videoItemTemmplate(movie, category);\n const movieElement = createTemplate(HTMLString);\n $container.append(movieElement);\n const image = movieElement.querySelector('img');\n image.addEventListener('load', (event) => {\n event.srcElement.classList.add('fadeIn');\n // debugger\n });\n addEventClick(movieElement);\n });\n }",
"enableTheaterModeForNewLayout() {\n this.centerVideoPlayer();\n }",
"function videoGalleryBox() {\n if ($('.video-box').length) {\n var wrapper = $('.video-box');\n var imgLi = wrapper.find('ul.img-list').children('li');\n var imgCount = imgLi.length;\n var mainImg = wrapper.find('.main-box .img-box').children('img');\n var videoPreview = wrapper.find('.main-box').find('a.play-video');\n\n var videoImg = imgLi.map(function() {\n return $(this).data('video-img');\n });\n var videoUrl = imgLi.map(function() {\n return $(this).data('video-url');\n });\n var current = 1;\n\n // setting up values on init\n videoPreview.attr('href', wrapper.find('ul.img-list').children('li.active').data('video-url'));\n\n $('.vid-nav').find('a').on('click', function() {\n var dir = $(this).data('dir');\n if (dir === 'next') {\n current = current + 1;\n } else {\n current = current - 1;\n };\n if (current === 0) {\n current = imgCount;\n dir = 'next';\n } else if (current - 1 === imgCount) {\n current = 1;\n };\n console.log(current);\n\n makeSwitch();\n\n return false;\n });\n\n\n function makeSwitch() {\n var i = current - 1;\n var mainImgSrc = videoImg[i];\n var mainVideoSrc = videoUrl[i];\n\n imgLi.removeClass('active');\n imgLi.eq(i).addClass('active');\n mainImg.fadeOut(500, function() {\n mainImg.attr(\"src\", mainImgSrc);\n mainImg.fadeIn(500);\n });\n // mainImg.attr('src', mainImgSrc);\n videoPreview.attr('href', mainVideoSrc);\n }\n\n\n };\n}"
] |
[
"0.63554186",
"0.6338707",
"0.6247146",
"0.6129791",
"0.60924506",
"0.60314065",
"0.5993365",
"0.59597695",
"0.593787",
"0.59194374",
"0.5875801",
"0.5864315",
"0.58640885",
"0.5816547",
"0.578954",
"0.57855105",
"0.57586527",
"0.5750631",
"0.57198644",
"0.57128775",
"0.56889534",
"0.56693983",
"0.56266487",
"0.56150055",
"0.5603418",
"0.5599872",
"0.558806",
"0.558623",
"0.55815506",
"0.557895"
] |
0.7239287
|
0
|
fastForwardVideo moves video forward in time 15s
|
function fastForwardVideo() {
var fastForward = player.getCurrentTime();
var add15Seconds = fastForward + 15;
player.seekTo(add15Seconds);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function fastForward() {\n target = this.classList[1] - 1;\n\n shownMedia[target].currentTime += 5;\n\n // If fast forward exceeds video length, goes back to beginning of video and pauses\n if(shownMedia[target].currentTime >= shownMedia[target].duration) {\n shownMedia[target].pause();\n shownMedia[target].currentTime = 0;\n playPauseBtn[target].textContent = 'Play';\n }\n }",
"function forwardVideo(increment) {\n player.currentTime += increment;\n}",
"function forwardButtonTrigger() {\n if (window.currentVideoSelectedForPlayback) {\n setCurrentlyPlaying(false)\n const currentNode = window.currentVideoSelectedForPlayback\n const currentTime = currentNode.data.videoCore.currentTime\n const currentVideoEnd = currentNode.data.metadata.endTime\n\n if (currentTime + 1 < currentVideoEnd) {\n currentNode.data.videoCore.currentTime += 1\n } else if (currentNode.next) {\n const remainingTime = 1 - currentTime\n window.currentVideoSelectedForPlayback = currentNode.next\n const nextStartTime = window.currentVideoSelectedForPlayback.data.metadata.startTime\n window.currentVideoSelectedForPlayback.data.videoCore.currentTime = nextStartTime + remainingTime\n } else {\n window.currentVideoSelectedForPlayback.data.videoCore.currentTime = currentVideoEnd\n }\n renderUIAfterFrameChange(window.currentVideoSelectedForPlayback)\n }\n}",
"function skipForward10Sec()\r\n\t{\r\n\t\tmyVideo.currentTime = myVideo.currentTime + 10; //the playback time increases by ten second\r\n\t}",
"onFastForward(){\n var { player } = this.state;\n var intervalFunc = setInterval(function(){\n var currentTime = player.getCurrentTime();\n player.seekTo(currentTime + 5, true);\n }, 250);\n this.setState({\n goForward: intervalFunc\n })\n }",
"function forward(seconds) {\n var operation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n action: 'forward-' + seconds,\n source: ''\n };\n\n this.video.forward(seconds);\n\n return {\n type: OPERATE,\n operation: operation\n };\n}",
"function moveForward() {\n if (autoMove) {\n if (new Date() - time > 10) {\n // Update view matrix via the camera\n mat4.invert(camera, viewMat);\n mat4.translate(camera, camera, vec3.fromValues(0, 0, -.01));\n mat4.invert(viewMat, camera);\n\n time = Date.now();\n }\n // Refresh screen then keep running in a loop\n gl.uniformMatrix4fv(viewUnif, false, viewMat);\n drawScene();\n //window.requestAnimFrame(moveForward);\n }\n}",
"function forward(seconds) {\n\t var operation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n\t action: 'forward-' + seconds,\n\t source: ''\n\t };\n\n\t this.video.forward(seconds);\n\n\t return {\n\t type: OPERATE,\n\t operation: operation\n\t };\n\t}",
"function rewindVideo() {\n var fastForward = player.getCurrentTime();\n var minus15Seconds = fastForward - 15;\n player.seekTo(minus15Seconds);\n }",
"function startPlayback() { \n setTimeout(moveForward, slideInterval);\n}",
"function forwardStep(e) {\n setMedia();\n media.currentTime = media.currentTime + trjs.param.forwardskip;\n }",
"function run_forward() {\n const motor_dur = 50;\n const motor_spd = -1000;\n \n ev3_runForTime(motorA, motor_dur, motor_spd);\n ev3_runForTime(motorB, motor_dur, motor_spd);\n ev3_pause(10);\n}",
"function run_forward() {\n const motor_dur = 50;\n const motor_spd = -1000;\n \n ev3_runForTime(motorA, motor_dur, motor_spd);\n ev3_runForTime(motorB, motor_dur, motor_spd);\n ev3_pause(10);\n}",
"function scrollPlay(){ \n var frameNumber = window.pageYOffset/playbackConst;\n vid.currentTime = frameNumber;\n window.requestAnimationFrame(scrollPlay);\n }",
"fastForward() {\n this.frame = window.requestAnimationFrame(()=>this.immediate());\n }",
"function playOneSegment(videoSrc, inPoint, outPoint) {\n video.src = videoSrc\n video.load\n video.currentTime = inPoint\n video.play()\n video.ontimeupdate = function () {\n stopAtOutPoint()\n }\n counter += 1\n }",
"function forward(){\n if(curFrame <= frames.length-1)\n drawCurFrame();\n}",
"function adelantar() {\n\n \n video.currentTime += 10;\n console.log(video.currentTime)\n}",
"function rewindVideo(increment) {\n player.currentTime -= increment;\n}",
"function skipBackward30Sec()\r\n\t{\r\n\t\tmyVideo.currentTime = myVideo.currentTime - 30; //the playback time decreases by 30 seconds\r\n\t}",
"function nextFrame(){\n // Protecting upper bounds\n if (frame === 7781){\n console.log('End of Frames')\n return\n }\n setFrame(frame + 1)\n console.log('Next Frame')\n playerRef.current.seekTo(frame / 60)\n console.log(frame)\n console.log(frame / 60)\n }",
"onVideoSeeked() {\n this.videoFrameReady = true;\n this.drawCurrentFrame();\n }",
"function handleForward(){\n audio.currentTime += 3;\n if(audio.currentTime >= audio.duration || audio.paused){\n audio.pause();\n audio.currentTime = 0;\n player.innerHTML = hdlPlay\n }\n }",
"function forward() {\n const currProgress = parseInt(progressInp.value, 10);\n const maxProgress = parseInt(progressInp.max, 10);\n\n if ((currProgress + 2000) < maxProgress) {\n progressInp.value = currProgress + 2000;\n } else {\n progressInp.value = maxProgress;\n }\n\n updateDuration();\n updateReplay();\n}",
"function seek_video()\n {\n if (!(current in timecodes)) return;\n if (!video_elt.contentWindow) video_elt.currentTime = timecodes[current];\n else video_elt.contentWindow.postMessage([\"seek\", timecodes[current]], \"*\");\n }",
"function runForward($el, $bgWidth, duration, frameRate, dir){\n\n var frameWidth = $el.width();\n var frameHeight = $el.height();\n var frameNum = $bgWidth/frameWidth;\n var rate = duration/frameRate;\n var countFrame = 0\n\n var backgroundPos = $el.css('backgroundPosition').split(\" \");\n var xPos = backgroundPos[0],\n yPos = backgroundPos[1];\n\n\n function runStrip() {\n\n setInterval(function() {\n\n if (dir == 'h'){\n if(countFrame<frameNum) {\n $el.css({backgroundPosition: -frameWidth*countFrame + \"px \"+yPos});\n }\n else if(countFrame==frameNum) {\n //run on complete\n }\n }\n\n\n else if (dir == 'v'){\n if(countFrame<frameNum) {\n $el.css({backgroundPosition: xPos+\" \"+ (-frameWidth*countFrame) + \"px\"});\n }\n else if(countFrame==frameNum) {\n //run on complete\n }\n }\n\n\n countFrame++;\n\n }, rate);\n\n }\n\n runStrip();\n}",
"function retroceder() {\n\n video.currentTime -= 10;\n console.log(video.currentTime)\n}",
"function fastForward() {\r\n if(window.HTMLAudioElement){\r\n try {\r\n var mySong = document.getElementById('music')\r\n mySong.currentTime += 30.0; \r\n }\r\n catch(e) {\r\n // Fail silently but show in F12 developer tools console\r\n if(window.console&&console.error(\"Error:\"+e));\r\n }\r\n }\r\n}",
"goToFrame(frame) {\n this._video.onPlay();\n return this._video.gotoFrame(frame, true);\n }",
"function nextFrame() {\n _timeController.proposeNextFrame();\n }"
] |
[
"0.77340055",
"0.7658001",
"0.6955349",
"0.69523954",
"0.68846303",
"0.6644918",
"0.66411155",
"0.661723",
"0.65360624",
"0.6456723",
"0.6333538",
"0.6300024",
"0.6300024",
"0.62600034",
"0.622176",
"0.6207095",
"0.6189372",
"0.618286",
"0.6170801",
"0.60887",
"0.6076027",
"0.6035013",
"0.6001117",
"0.5988999",
"0.59826845",
"0.5982169",
"0.5974545",
"0.5946753",
"0.5934535",
"0.59284836"
] |
0.858113
|
0
|
playTYVideo pause and play functionality with tooltip and icon changes
|
function playYtVideo() {
player.playVideo();
if (this.classList.value === playFaClass) {
$('.playButton').tooltip('hide')
$('.playButton').removeClass(playFaClass).toggleClass(pauseFaClass);
$(this).attr('data-original-title','Pause')
} else {
$('.pauseButton').tooltip('hide');
$('.pauseButton').removeClass(pauseFaClass).toggleClass(playFaClass);
$(this).attr('data-original-title','Play')
player.pauseVideo()
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function action_toggle_play() {\n if (video.paused) {\n video.play();\n change_icon('play'); \n } else {\n video.pause();\n change_icon('pause'); \n }\n delay = delay_value;\n}",
"function playVideo() {\r\n video.play();\r\n play.innerHTML = '<i class=\"fas fa-pause fa-2x\"></i>';\r\n}",
"function updateIcons() {\n // Check if video is paused or playing \n if (video.paused) {\n // if video is paused, show the play button \n play.innerHTML = '<i class=\"fa fa-play fa-2x\">'\n } else {\n // if video is playing, show the pause button\n play.innerHTML = '<i class=\"fa fa-pause fa-2x\">'\n }\n\n}",
"function pauseVideo() {\r\n video.pause();\r\n play.innerHTML = '<i class=\"fas fa-play fa-2x\"></i>';\r\n}",
"function play() {\n player.playVideo();\n launch_progress_timer();\n play_pause_button.setAttribute('title', 'Pause');\n play_pause_snap_button.toState(1);\n\n var is_hover_bottom_bar = el.querySelector('.mp-bottom-bar:hover');\n if (!is_hover_bottom_bar) {\n setTimeout(hideControls, 2000);\n }\n }",
"function togglePlayVideo() {\n let icon = playbtn.querySelector('.video-ctrl-bt');\n if(video.paused) {\n videoduration = convertSecondsToMinutes(video.duration);\n overvideo.style.backgroundColor = 'transparent';\n video.play();\n playToPauseBtn(icon);\n videobtn.style.display = 'none';\n addVideoListeners();\n outVideoControl();\n videoPlaying = true;\n }\n else {\n video.pause();\n pauseToPlayBtn(icon);\n videobtn.style.display = 'block';\n removeVideoListeners();\n videoCtrlTl.reverse();\n videoPlaying = false;\n }\n }",
"function togglePlay() {\n if (elements.video.paused) {\n elements.video.play();\n elements.playBtn.classList.replace('fa-play', 'fa-pause');\n elements.playBtn.setAttribute('title', 'Pause');\n } else {\n elements.video.pause();\n showPlayIcon();\n }\n}",
"function play() {\n video.play();\n play_pause_button.setAttribute('title', 'Pause');\n play_pause_snap_button.toState(1);\n\n var is_hover_bottom_bar = el.querySelector('.mp-bottom-bar:hover');\n if (!is_hover_bottom_bar) {\n setTimeout(hideControls, 2000);\n }\n }",
"function togglePlay() {\n if(isPlaying) {\n domVideo.pause();\n isPlaying = false;\n playButton.innerHTML = '<img src=\"video-plugin/video-img/play.png\" />';\n } else {\n domVideo.play();\n isPlaying = true;\n playButton.innerHTML = '<img src=\"video-plugin/video-img/pause.png\" />';\n }\n}",
"function togglePlayPause() {\n if (video.paused || video.ended) {\n playpause.title = 'pause';\n playpause.innerHTML = '<img src=\"icons/pause-icon.png\">';\n playpause.className = 'pause';\n video.play();\n}\n else {\n playpause.title = 'play';\n playpause.innerHTML = '<img src=\"icons/play-icon.png\">';\n playpause.className = 'play';\n video.pause();\n }\n}",
"function hoverVideo(e) { \n\t $('video', this).get(0).play(); \n $('video', this).removeClass('gris');\n // $('video', this).get(0).currentTime = 3;\n \n\n\t}",
"function togglePlay() {\n var theSVG = this.firstElementChild;\n poster.classList.add('hide');\n videoControls.classList.remove('invisible');\n vidPlayer.classList.remove('hide');\n\n if (vidPlayer.paused) {\n theSVG.dataset.icon = \"pause-circle\";\n vidPlayer.play();\n } else {\n theSVG.dataset.icon = \"play-circle\";\n vidPlayer.pause();\n }\n }",
"$mediaplayerPlay() {\n // console.log('mediaplayerPlay');\n this.tag('Stop').patch({\n visible: false\n }, false);\n this.tag('Play').patch({\n visible: false \n }, false);\n \n}",
"function myFunction() {\n if (video.paused) {\n video.play();\n btn.innerHTML = \"<i class='fas fa-pause'></i>\";\n } else {\n video.pause();\n btn.innerHTML = \"<i class='fas fa-play'></i>\";\n }\n}",
"function playPauseFun() {\t\t//Play and Pause button functionality...\n\tif (myVideoVar.paused) {\n\t\tmyVideoVar.play();\n\t\tupdatemyStreamBarVar = setInterval(streamingFun, 10);\t\t//Calls streamingFun function every 10ms...\n\t\tmyPlayButtonVar.className = \"fa fa-pause fa-3x\";\t//Changes play icon to pause icon...\n\t\tmyStatusVar.innerHTML = \"Playing ...\";\n\t} else {\n\t\tmyVideoVar.pause();\n\t\twindow.clearInterval(updatemyStreamBarVar);\t\t//Stops running 'streamingFun' when paused... this line of code can be omitted...\n\t\tmyPlayButtonVar.className = \"fa fa-play fa-3x\";\t\t//Changes pause icon to play icon...\n\t\tmyStatusVar.innerHTML = \"Paused ...\";\n\t}\n}",
"function playVideo() { \n\tif($video[0].paused) {\n\t\t$video[0].play();\n\t\t$playButton.find(\"img\").attr(\"src\", \"icons/pause-icon.png\"); \n\t\t$buttonControls.hide();\n\t\t$videoControls.css(\"margin-top\", \"5%\");\t \t\n\t} else {\n\t\t$video[0].pause();\n\t\t$playButton.find(\"img\").attr(\"src\", \"icons/play-icon.png\");\t\t\t\n\t}\t\t\n}",
"playPause() {\n let video = document.getElementById('video');\n\n if (video) { \n if (video.ended) {\n this.setState({play_icon: \"replay\"})\n } else if (video.paused) {\n this.setState({ play_icon: \"play_arrow\" })\n } else {\n this.setState({ play_icon: \"pause\" })\n }\n }\n }",
"playCallback(e) {\n if (this.isCurrentTrack()) {\n this.setBigPlay()\n } else {\n this.bigPlayLoaded = false\n Rails.fire(this.loadTrackTarget, 'click')\n }\n this.registeredListen = false\n this.playTarget.classList.replace('play_button', 'pause_button')\n this.playTarget.firstElementChild.setAttribute('data-icon', 'pause')\n }",
"swapPlayPause() {\n let video = document.getElementById('video');\n if (video.paused || video.ended) {\n video.play()\n this.setState({ play_icon: \"pause\" })\n // this.playPause()\n } else {\n video.pause()\n this.setState({ play_icon: \"play_arrow\" })\n // this.playPause()\n }\n }",
"function pauseTrack() {\n curr_track.pause();\n isPlaying = false;\n\n // Replace icon with the play icon \n playpause_btn.innerHTML = '<i class=\"fa fa-play-circle fa-5x\"></i>';\n}",
"function updateIcon() {\n\tconst ctrl = document.querySelector('.player__button[title=\"Toggle Play\"]');\n\tif(video_application.paused) {\n\t\tctrl.textContent = '>';\n\t}\n\telse {\n\t\tctrl.textContent = '||';\n\t}\n}",
"function togglePlay() {\n // if (selectors.video.paused) {\n // selectors.video.play();\n // } else {\n // selectors.video.pause();\n // }\n\n const method = selectors.video.paused ? \"play\" : \"pause\";\n selectors.video[method]();\n}",
"function playTrack() {\n curr_track.play();\n isPlaying = true;\n \n // To replace icon with pause icon\n playpause_btn.innerHTML = '<i class=\"fa fa-pause-circle fa-5x\"></i>';\n}",
"function clickPlayPauseList() {\n // Update status of other btn's (If pause icons replace by play icons)\n var btnPauseStatus = document.querySelectorAll(\".mdi-pause-circle-outline\");\n btnPauseStatus.forEach(element => {\n element.classList.remove(\"mdi-pause-circle-outline\");\n element.classList.add(\"mdi-play-circle-outline\");\n })\n\n last_url = this.getAttribute(\"url\");\n // Si player en pause alors lire\n if (player.paused) {\n if (last_url !== url) {\n url = last_url;\n change(last_url);\n }\n player.play();\n lastbtn = this;\n btnPlayPause.setAttribute(\"value\", \"Pause\");\n playPause_Icons(this, false);\n }\n else // Si player en lecture alors pause\n {\n // Compare l'url du bouton et celui en cours dans le lecteur (Si pas les mêmes changer l'url du lecteur par la nouvelle reçu puis relancer automatiquement la lecture)\n if (last_url !== url) {\n url = last_url;\n change(last_url);\n player.play();\n lastbtn = this;\n btnPlayPause.setAttribute(\"value\", \"Pause\");\n playPause_Icons(this, false);\n }\n else {\n player.pause();\n btnPlayPause.setAttribute(\"value\", \"Play\");\n playPause_Icons(this, true);\n }\n }\n}",
"function video_play(i){\n\ttrack_index = i ;\n\tlive_video = i ;\n\tif (!videoPause) {\n\t\tvideo_stop();\n\t \tgetFlashObject().SetVariable(\"method:setUrl\", flvArray[i]);\n \t}\n\tgetFlashObject().SetVariable(\"method:play\", \"\");\n\tvideoPause = false ; \n\tjQuery(\".playliste li:eq(\"+i+\")\").addClass(\"play_on\");\n}",
"function togglePlay() {\n const method = video.paused ? 'play' : 'pause' ;\n video[method]();\n}",
"function togglePlay() {\n video[video.paused ? 'play' : 'pause']();\n}",
"function myFunction() {\n if (video.paused) {\n video.play();\n btn.innerHTML = \"Stop video\";\n } else {\n video.pause();\n btn.innerHTML = \"Watch video\";\n }\n}",
"function toggle_play_pause(ev)\n {\n ev.preventDefault();\n if (video_elt.paused || video_elt.ended) play_video(); else pause_video();\n }",
"function togglePlayVideo()\r\n\t{\r\n\t\t //if statement; outcome differs depending on conditions\r\n\t\tif ( myVideo.paused === true ) //video is paused\r\n\t\t{\r\n\t\t\tmyVideo.play(); //the DOM play method plays the video, when clicked\r\n\t\t\tplayButton.innerHTML = \"▐▐\"; //updates inside HTML button selector: turns into a pause icon made from two same Unicode characters\r\n\t\t\tisPaused = false; //boolean variable is assigned to false\r\n\t\t}\r\n\t\telse //if the video is playing\r\n\t\t{\r\n\t\t\tmyVideo.pause(); //the DOM pause method pauses the video, when clicked\r\n\t\t\tplayButton.innerHTML = \"►\" ; //updates inside HTML button selector when clicked: turns into a right-pointing pointer made from single Unicode character\r\n\t\t\tisPaused = true; //boolean variable is assigned to true\r\n\t\t} //ends if statement\r\n\t} //ends function \"togglePlayVideo\""
] |
[
"0.75403845",
"0.72437173",
"0.7180169",
"0.7180067",
"0.710993",
"0.7079209",
"0.70605505",
"0.69493806",
"0.69403315",
"0.68844175",
"0.68768364",
"0.6874432",
"0.6864135",
"0.6862987",
"0.6852703",
"0.6849988",
"0.679399",
"0.6791494",
"0.6780978",
"0.6716388",
"0.6700786",
"0.6695665",
"0.6693363",
"0.66523737",
"0.66442126",
"0.6637657",
"0.6637408",
"0.66213566",
"0.66206557",
"0.6612732"
] |
0.81265557
|
0
|
rewindVideo moves video back in time 15s
|
function rewindVideo() {
var fastForward = player.getCurrentTime();
var minus15Seconds = fastForward - 15;
player.seekTo(minus15Seconds);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function rewindVideo(increment) {\n player.currentTime -= increment;\n}",
"function fastForwardVideo() {\n var fastForward = player.getCurrentTime();\n var add15Seconds = fastForward + 15;\n player.seekTo(add15Seconds);\n }",
"function restoreTime () {\n const restoreTime = thiz.$videoPlayerRestoreTime(\n videoUrl,\n videoProgress\n )\n if (restoreTime > 0) {\n player.mute()\n player.playVideo()\n setTimeout(function () {\n player.pauseVideo()\n player.seekTo(restoreTime, true)\n player.unMute()\n }, 2000)\n }\n }",
"rewind() {\r\n\t\t\tthis.looping = false;\r\n\t\t\tthis.goToFrame(0);\r\n\t\t}",
"function rewind() {\n target = this.classList[1] - 1;\n\n shownMedia[target].currentTime -= 5;\n }",
"rewind() {\n\t\t\t\tthis.frame = 0;\n\t\t\t}",
"function retroceder() {\n\n video.currentTime -= 10;\n console.log(video.currentTime)\n}",
"resetVideo() {\n this.videoElt.pause();\n this.videoElt.currentTime = 0;\n this.videoElt.style.display = 'none';\n }",
"function skipBackward30Sec()\r\n\t{\r\n\t\tmyVideo.currentTime = myVideo.currentTime - 30; //the playback time decreases by 30 seconds\r\n\t}",
"function skipForward10Sec()\r\n\t{\r\n\t\tmyVideo.currentTime = myVideo.currentTime + 10; //the playback time increases by ten second\r\n\t}",
"rewindGameTime()\n {\n this.specialEffects.prepareCanvasLayersForEffects();\n\n if (this.timeIsRewinding)\n {\n console.log(\"Rewinding\");\n this.specialEffects.performRewindTimeSpecialEffects();\n }\n }",
"function reiniciar() {\n\n video.load();\n playPause();\n}",
"function stopVideo() {\n // Reset the time to zero\n video.currentTime = 0;\n video.pause();\n\n}",
"function resetVid(data){\n\n myPlayer.currentTime(0);\n myPlayer.loop(true);\n myPlayer.play();\n console.log(\"video reset \");\n\n\n}",
"function reloadVideo() {\n let icon = playbtn.querySelector('.video-ctrl-bt');\n video.load();\n pauseToPlayBtn(icon);\n videobtn.style.display = 'block';\n videotime.innerHTML = '0:00 / '+videoduration;\n removeVideoListeners();\n videoCtrlTl.reverse();\n videoPlaying = false;\n progressbar.style.width = null;\n }",
"function resetVideo(){\n video.removeAttribute('controls')\n video.autoplay=true\n video.src = URL.createObjectURL(stream);\n}",
"function forwardVideo(increment) {\n player.currentTime += increment;\n}",
"function rWindVid() {\n vidPlayer.currentTime = 0;\n clipBar.value = 0;\n }",
"function seek_video()\n {\n if (!(current in timecodes)) return;\n if (!video_elt.contentWindow) video_elt.currentTime = timecodes[current];\n else video_elt.contentWindow.postMessage([\"seek\", timecodes[current]], \"*\");\n }",
"function scrubVideo()\r\n\t{\r\n\t\tconst scrubTime = myVideo.duration * ( scrubSlider.value/100 ); //to get the time on the slider; a percentage is formed from the duration of the video multiplied by the slider value divided by 100\r\n\t\tmyVideo.currentTime = scrubTime; //whenever the user uses the slider, it will show the current time of the video (e.g. 100% will be when the video ends)\r\n\t}",
"onPreviousVideo() {\n const { controller } = this.props;\n if (typeof controller.rewindOrRequestPreviousVideo === 'function') {\n controller.rewindOrRequestPreviousVideo();\n }\n }",
"function skipBackwardToStart()\r\n\t{\r\n\t\tmyVideo.currentTime = 0; //the playback time returns back to 0 seconds\r\n\t\t//if statement; outcome differs depending on conditions\r\n\t\tif ( myVideo.currentTime === 0 )\r\n\t\t{\r\n\t\t\tmyVideo.pause(); //the DOM pause method pauses the video, when clicked\r\n\t\t\tplayButton.innerHTML = \"►\" ; //updates inside HTML button selector when clicked: turns into a right-pointing pointer made from single Unicode\r\n\t\t\tmyVideo.load(); //DOM load() method re-loads the video\r\n\t\t\tscrubSlider.value = 0; //reset the slider for video playback to zero\r\n\t\t} //end if statement\r\n\t}",
"function setVideoTime() {\r\n togglePlayPause();\r\n video.currentTime = (progress.value / 100) * video.duration;\r\n togglePlayPause();\r\n}",
"function stepBack(mediaId, rewindBy){\r\n if (!getCurrentPlayer(mediaId))\r\n {\r\n setCurrentPlayer(mediaId);\r\n }\r\n var newTime;\r\n var currentTime;\r\n if(currentPlayer.currentTime)\r\n currentTime = currentPlayer.currentTime\r\n else\r\n currentTime = convertDisplayTimeToSeconds($(\"#ucatJumpToTimeTB_\"+mediaId).val());\r\n \r\n newTime = currentTime - rewindBy;\r\n if(newTime <= rewindBy || newTime <= 0){\r\n newTime = 0;\r\n }\r\n ucatMediaJumpToTime(mediaId, newTime, currentPlayer.isPlaying);\r\n}",
"function shiftRight() {\n\tright_video = current_video - 1;\n\tif(right_video < 1) {\n\t\tright_video = vid_array.length-1;\n\t}\n\tswitchToVideo(right_video);\n}",
"function seekVideo(browser, currentTime){\n\tbrowser.execute(function(currentTime) {\n\t\t// get the video at a given point\n\t\tvar videoElement = arSession.arSource.domElement\n\t\tvideoElement.pause()\n\t\tvideoElement.currentTime = 4.0\n\t}, currentTime)\t\n}",
"function fastForward() {\n target = this.classList[1] - 1;\n\n shownMedia[target].currentTime += 5;\n\n // If fast forward exceeds video length, goes back to beginning of video and pauses\n if(shownMedia[target].currentTime >= shownMedia[target].duration) {\n shownMedia[target].pause();\n shownMedia[target].currentTime = 0;\n playPauseBtn[target].textContent = 'Play';\n }\n }",
"async reset() {\n this.setState({\n paused: true,\n rate: 1,\n showHeader: false,\n }, () => this.videoPlayer && this.videoPlayer.seek(0)\n )\n this.progressBar && this.progressBar.updateProgress(0)\n \n }",
"onRewind(){\n var { player } = this.state;\n var norm = this.returnToNorm;\n var intervalFunc = setInterval(function(){\n var currentTime = player.getCurrentTime();\n if(currentTime > 5) {\n player.seekTo(currentTime - 5, true);\n } else {\n player.seekTo(0, true);\n norm();\n }\n }, 250);\n this.setState({\n goForward: intervalFunc\n })\n }",
"function replayVideo() {\n var icon = document.getElementById(\"replay-icon\");\n var replayText = document.getElementById(\"play-again-txt\");\n var video = document.getElementById(\"save-sharing-video\");\n if (video.paused) {\n video.currentTime = 0;\n video.play();\n icon.style.display = \"none\";\n replayText.style.display = \"none\";\n }\n}"
] |
[
"0.7942025",
"0.7152836",
"0.7088374",
"0.69246083",
"0.67662406",
"0.6706276",
"0.66731083",
"0.6651095",
"0.6614244",
"0.65366465",
"0.6421747",
"0.64172256",
"0.6397",
"0.6352967",
"0.63216233",
"0.62962365",
"0.62938714",
"0.62787235",
"0.6264922",
"0.6215699",
"0.6154194",
"0.61524236",
"0.61304194",
"0.6110867",
"0.60500175",
"0.6043044",
"0.60158974",
"0.600735",
"0.59870523",
"0.59743136"
] |
0.858974
|
0
|
carouselLeftArrow carousel controls on bottom
|
function carouselLeftArrow(){
$(".carousel").carousel('prev');
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function slideLeft() {\n var parent = $(this).closest('.carousel');\n var items = $.makeArray(parent.find('.item:not(.hidden)'));\n if (items.length == 1) {\n //already at the end\n return;\n }\n var item = $(items.shift());\n item.animate({'margin-left': item.width()*-1, opacity: '0%'}, 'slow', 'linear', function() {\n item.addClass('hidden').removeClass('active')\n $(items.shift()).addClass('active');\n setIndicator(parent);\n });\n}",
"function addCarouselMoving($carousel)\n {\n $carousel.find('.owl-item').on('click', function(){\n if($(this).prev().hasClass('center')) {\n $carousel.trigger('next.owl.carousel');\n } else if ($(this).next().hasClass('center')) {\n $carousel.trigger('prev.owl.carousel');\n }\n });\n }",
"function leftArrowHandle(){\n let new_val = slides[slides.length - 1].props.slideNum + slides_count -1\n if (new_val > slides_arr.length-1) new_val = new_val - slides_arr.length\n if (slides_count ===1){\n new_val = slides[0].props.slideNum -1\n if (new_val < 0) new_val = slides_arr.length - 1\n }\n const updated = slides.slice(0,slides_count-1)\n setSlides([slides_arr[new_val],...updated])\n }",
"function carouselRightArrow(){\n if($('#tdList-20').attr('videoID') === '') {\n return;\n } else if ($('#tdList-40').attr('videoID') === '' && currentSlideNumber % 2 === 0) {\n return;\n }\n $(\".carousel\").carousel('next');\n}",
"function shiftCarousel(carousel, direction) {\n const numberOfSlides = carousel.querySelectorAll('.iw-carousel__inner img').length;\n const currentSlideIndex = Number(carousel.querySelector('.iw-carousel__indicators .active').dataset.slideTo);\n let newSlideIndex = currentSlideIndex + direction;\n if (newSlideIndex >= numberOfSlides)\n newSlideIndex = 0;\n if (newSlideIndex < 0)\n newSlideIndex = numberOfSlides - 1;\n showCarouselSlide(carousel, newSlideIndex);\n}",
"function checkCarouselSlide() {\n var arrow_left = $(\".message_bot_area .footer_message_input .carousel_slide [data-slide='prev']\"),\n arrow_right = $(\".message_bot_area .footer_message_input .carousel_slide [data-slide='next']\");\n\n if ($('.message_bot_area .generic_group.active .generic_container .generic_box').length > 1) {\n if($('.message_bot_area .generic_group.active .generic_container .generic_box:last-child').hasClass('active')) {\n arrow_right.hide();\n arrow_left.show();\n } else if($('.message_bot_area .generic_group.active .generic_container .generic_box:first-child').hasClass('active')) {\n arrow_right.show();\n arrow_left.hide();\n } else {\n arrow_right.show();\n arrow_left.show();\n }\n } else {\n arrow_right.hide();\n arrow_left.hide();\n }\n //re-active Carousel indicator (Because move indicator to outsite Carousel div)\n var indexActive = $('.message_bot_area .generic_container .generic_box.active').index();\n $('.message_bot_area .footer_message_input .generic_indicators li').removeClass('active');\n $('.message_bot_area .footer_message_input .generic_indicators li').eq(indexActive).addClass('active');\n}",
"function moveCarousel(btn) {\n const inner = $($(btn).parent()).find(\".CustomCarousel-inner\");\n let items = inner.find(\".item\");\n let visibleItems = inner.find(\".item.Visib\").length;\n let amount = visibleItems;\n if (items.length - visibleItems < visibleItems)\n amount = items.length - visibleItems;\n\n const condition = $(btn).hasClass(\"btn-prev\");\n items.hide();\n for (let i = 0; i < amount; i++) {\n items = inner.find(\".item\");\n if (condition) {\n items[0].before(items[items.length - 1]);\n } else {\n items[items.length - 1].after(items[0]);\n }\n }\n resizeCarousel(inner.parent());\n}",
"function setSlickArrow(){\n\n if ( $(\".slider-destination .slick-slide\").length){\n var s = Math.round($('.slider-destination img').height() + 6);\n $( '.slider-destination .slick-prev, .slider-destination .slick-next').css('top', s);\n\n } \n }",
"prev() {\n const self = this;\n $('.mdi-chevron-right').removeClass('product-carousel__icon--disable'); \n\n const slider = $('.product-carousel__slider');\n const offsetLeft = parseInt(slider.css('left').replace('px', '')); \n const divider = (Math.abs(offsetLeft) / this.state.productSize);\n\n if (Math.abs(offsetLeft) < this.state.productSize) {\n this.updateDimensions(self);\n } \n else {\n let left = 0; \n \n if (offsetLeft < 0) { \n if (divider % 1 == 0) {\n left = offsetLeft + this.state.productSize;\n }\n else {\n const extraSpace = offsetLeft - -Math.abs(this.state.productSize * Math.floor(divider));\n left = offsetLeft - extraSpace; \n }\n }\n \n slider.css(\"left\",`${left}px`);\n } \n }",
"renderArrowBtns () {\n const { theme } = this.props\n return (\n <div className={`carouselNav`}>\n <a className={cls(style.prevIcon, theme.prevIcon)} onClick={(e) => this.moveSlide('prev')} />\n <a className={cls(style.nextIcon, theme.nextIcon)} onClick={(e) => this.moveSlide('next')} />\n </div>\n )\n }",
"function slideRight() {\n var parent = $(this).closest('.carousel');\n var items = $.makeArray(parent.find('.item.hidden'));\n if (items.length == 0) {\n //already at the beginning\n return;\n }\n parent.find('.item.active').removeClass('active');\n var item = $(items.pop());\n item.removeClass('hidden').animate({'margin-left': '0', opacity: '100%'}, 'slow', 'linear', function(){ setIndicator(parent);}).addClass('active');\n}",
"function myMoveLeft() { //ad ogni click sulla freccia di sinistra\n scrollPosition = scrollPosition - scrollChange; //sottraggo alla posizione iniziale il valore di cambiamento settato \n carousel.scrollTo(scrollPosition, 0); //vado ad assegnare la posizione finale al contenitore sull'asse x\n}",
"function setPositionSliderArrows() {\r\n let slideWidth = document.querySelector(\".together-cheaper-box\").offsetWidth;\r\n let currentSliderWidth = document.querySelector(\".together-cheaper-slider\").offsetWidth;\r\n let sliderArrowPrev = document.getElementsByClassName(\"together-cheaper-slider-arr-prev\")[0];\r\n let sliderArrowNext = document.getElementsByClassName(\"together-cheaper-slider-arr-next\")[0];\r\n let sliderArrowWidth = sliderArrowPrev.offsetWidth;\r\n let sliderArrowPosition = currentSliderWidth/2-slideWidth/2-sliderArrowWidth/2;\r\n sliderArrowPrev.style.left = sliderArrowPosition+\"px\";\r\n sliderArrowNext.style.right = sliderArrowPosition+\"px\";\r\n}",
"function slideArrowHandler() {\n var section = $(this).closest(SECTION_SEL);\n\n if ($(this).hasClass(SLIDES_PREV)) {\n if (isScrollAllowed.m.left) {\n moveSlideLeft(section);\n }\n } else {\n if (isScrollAllowed.m.right) {\n moveSlideRight(section);\n }\n }\n }",
"function prev(){\n // If on first item go to end, otherwise go to previous item\n if ( currentItem - 1 < 0 ){\n currentItem = carouselItems.length - 1;\n } else {\n currentItem--;\n }\n updateCarousel();\n }",
"function slideArrowHandler(){\n var section = $(this).closest(SECTION_SEL);\n\n if ($(this).hasClass(SLIDES_PREV)) {\n if(isScrollAllowed.m.left){\n moveSlideLeft(section);\n }\n } else {\n if(isScrollAllowed.m.right){\n moveSlideRight(section);\n }\n }\n }",
"function slideArrowHandler(){\n var section = $(this).closest(SECTION_SEL);\n\n if ($(this).hasClass(SLIDES_PREV)) {\n if(isScrollAllowed.m.left){\n moveSlideLeft(section);\n }\n } else {\n if(isScrollAllowed.m.right){\n moveSlideRight(section);\n }\n }\n }",
"function slide(dir) {\n let active_index = $('.active-img').index();\n let new_index;\n if (dir == 'right') {\n new_index = active_index + 1;\n if (new_index == $('.carousel').children('li').length - 1) {\n new_index = 0;\n };\n } else if (dir == 'left') {\n new_index = active_index - 1;\n if (new_index == 0) {\n new_index = $('.carousel').children('li').length - 1;\n };\n };\n slideTo(new_index);\n}",
"function slideArrowHandler(){\n var section = $(this).closest(SECTION_SEL);\n\n if ($(this).hasClass(SLIDES_PREV)) {\n if(isScrollAllowed.m.left){\n FP.moveSlideLeft(section);\n }\n } else {\n if(isScrollAllowed.m.right){\n FP.moveSlideRight(section);\n }\n }\n }",
"function slideArrowHandler(){\n var section = $(this).closest(SECTION_SEL);\n\n if ($(this).hasClass(SLIDES_PREV)) {\n if(isScrollAllowed.m.left){\n FP.moveSlideLeft(section);\n }\n } else {\n if(isScrollAllowed.m.right){\n FP.moveSlideRight(section);\n }\n }\n }",
"function nextArrow(){\r\n // Utilizziamo una variabile per indicare la condizione iniziale dell'active, il quale si dovrà spostare nelle immagini successive al click.\r\n var immagini = $('.images img.active');\r\n // Dobbiamo prima togliere la classe 'active' dall'immagine iniziale e, dopo, aggiungere 'active' all'immagine successiva.\r\n immagini.removeClass('active');\r\n immagini.next().addClass('active');\r\n // La condizione if permette di far ritornare la classe 'active' dall'ultima immagine (last) alla prima immagine (first).\r\n if (immagini.hasClass('last')) {\r\n $('.images img.first').addClass('active');\r\n }\r\n // Adesso dobbiamo cambiare il colore dei pallini della navbar che devono diventare blu quando si clicca. Utilizziamo una variabile per indicare la condizione iniziale dell'active.\r\n var pallinoBlu = $('.nav i.active');\r\n // La classe 'active' passa dal primo pallino (first) al pallino successivo.\r\n pallinoBlu.removeClass('active');\r\n pallinoBlu.next().addClass('active');\r\n // if permette di far ritornare la classe 'active' dall'ultimo pallino (last) al prima pallino (first).\r\n if (pallinoBlu.hasClass('last')) {\r\n $('.nav i.first').addClass('active');\r\n }\r\n}",
"function rightArrowHandle(){\n let new_val = slides[0].props.slideNum + slides_count\n if (new_val > slides_arr.length-1) new_val = new_val - slides_arr.length\n const updated = slides.slice(1,slides_count)\n setSlides([...updated,slides_arr[new_val]])\n }",
"function slideArrowHandler(){\r\n var section = $(this).closest(SECTION_SEL);\r\n\r\n if ($(this).hasClass(SLIDES_PREV)) {\r\n if(isScrollAllowed.m.left){\r\n moveSlideLeft(section);\r\n }\r\n } else {\r\n if(isScrollAllowed.m.right){\r\n moveSlideRight(section);\r\n }\r\n }\r\n }",
"function slideArrowHandler(){\r\n var section = $(this).closest(SECTION_SEL);\r\n\r\n if ($(this).hasClass(SLIDES_PREV)) {\r\n if(isScrollAllowed.m.left){\r\n moveSlideLeft(section);\r\n }\r\n } else {\r\n if(isScrollAllowed.m.right){\r\n moveSlideRight(section);\r\n }\r\n }\r\n }",
"function slideArrowHandler(){\r\n var section = $(this).closest(SECTION_SEL);\r\n\r\n if ($(this).hasClass(SLIDES_PREV)) {\r\n if(isScrollAllowed.m.left){\r\n moveSlideLeft(section);\r\n }\r\n } else {\r\n if(isScrollAllowed.m.right){\r\n moveSlideRight(section);\r\n }\r\n }\r\n }",
"function moveCarousel() {\n let transformValue = carouselItemsActiveIndex * carouselWrapWidth;\n carouselList.style.transform =\n \"translate3d(-\" + transformValue + \"px, 0px, 0px)\";\n addActiveToItem();\n addTransition();\n setActivePagination();\n setButtonAttr();\n}",
"function leftArrow() {\n clearInterval(autoAdvance);\n for (var i = 0; i < 5; i++) {\n if ((photoOrder[i] - 1) === 0) {\n photoOrder[i] = 5;\n } else {\n photoOrder[i] -= 1;\n }\n populateFigures();\n }\n}",
"function moveCarousel(direction) {\n\tif (direction == 'next') { // if next button was clicked\n\t\tif (currentImgIndex + 1 == leftArray.length) { // if moving forward will go past the length of carousel children\n\t\t\tcurrentImgIndex = -1; // set currentImgIndex to beginning of array and carousel children (-1 because 1 must be added in the next line)\n\t\t}\n\t\tcurrentImgIndex++; // increase currentImgIndex to go to the next image\n\t\tcarousel.css('left', leftArray[currentImgIndex]); // set 'left' to value to center proper image\n\t} else if (direction == 'prev') { // if prev button was clicked\n\t\tif (currentImgIndex - 1 < 0) { // if moving backward will index -1 (not an index)\n\t\t\tcurrentImgIndex = leftArray.length; // set currentImgIndex to end of array and carousel children\n\t\t}\n\t\tcurrentImgIndex--; // decrease currentImgIndex to got to previous image\n\t\tcarousel.css('left', leftArray[currentImgIndex]); // set 'left' to value to center proper image\n\t} else { // else, you fucked up\n\t\tconsole.error('Slider: moveCarousel() accepts \"next\" or \"prev\" parameters');\n\t}\n\n\tvar i = 0; // index to keep track of current carousel child loop is on\n\tcarousel.children().each(function() {\n\t\ti++; // increase index\n\t\tif (i == currentImgIndex + 1) { // if this child is the center image RN, make it opaque\n\t\t\t$(this).css('opacity', '1');\n\t\t} else { // all others are set to half opacitiy\n\t\t\t$(this).css('opacity', '.5');\n\t\t}\n\t});\n}",
"initializeLeftArrow() {\n const leftArrowWrapper = document.createElement(\"div\");\n const leftArrow = document.createElement(\"div\");\n\n leftArrowWrapper.className += ` ${style.slider_arrow_wrapper}`;\n leftArrow.className += ` ${style.slider_arrow} ${style.slider_left_arrow}`;\n leftArrowWrapper.style.order = -2;\n leftArrowWrapper.appendChild(leftArrow);\n leftArrowWrapper.addEventListener(\"click\", () =>\n this.animateAllSlides(this.childrens, this.slideLeft.bind(this))\n );\n\n return leftArrowWrapper;\n }",
"render(){\n return (\n <div>\n <Carousel moveArray={this.handleMoveArray} pictures={this.state.items} amount={this.state.amount}/>\n <button className=\"navigation previous\" onClick={() => this.handleMoveArray('left')}><ion-icon name=\"arrow-back\"></ion-icon></button>\n <button className=\"navigation next\" onClick={() => this.handleMoveArray('right')}><ion-icon name=\"arrow-forward\"></ion-icon></button>\n </div>\n );\n }"
] |
[
"0.6882294",
"0.6827787",
"0.67363364",
"0.6665643",
"0.6549694",
"0.6548015",
"0.65184164",
"0.65014553",
"0.64959544",
"0.6490066",
"0.6479246",
"0.6466931",
"0.64633083",
"0.64388466",
"0.64321345",
"0.63685733",
"0.63685733",
"0.6358446",
"0.6349347",
"0.6349347",
"0.6319655",
"0.62971663",
"0.6296328",
"0.6296328",
"0.6296328",
"0.628821",
"0.624765",
"0.6223017",
"0.6212633",
"0.6194725"
] |
0.7947538
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.