Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Write examples of all the fonts to console
function showAll (text) { asciify.getFonts(function (err, fonts) { if (err) { return console.error(err); } var padSize = ('' + fonts.length).length; fonts.forEach(function(font, index) { var opts = { font: font, color: argv.color }; asciify(exampleText, opts, function (err, result) { console.log(pad(padSize, index+1, '0') + ': ' + font); console.log(result); console.log(''); }); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listFonts () {\n\n\tasciify.getFonts(function (err, fonts) {\n\t\tif (err) { return console.error(err); }\n\n\t\tvar padSize = ('' + fonts.length).length;\n\n\t\tfonts.forEach(function (font, index) {\n\t\t\tconsole.log(pad(padSize, index+1, '0') + ': ' + font);\n\t\t});\n\t});\n}", "function fonts(cb) {\n src(fon.in)\n .pipe(dest(fon.out))\n watch(fon.watch, series(fonts, browsersync.reload))\n cb()\n}", "function drawFontExample () {\r\n\t\r\n\tvar fontFamily = \"\";\r\n\tif (document.forms[\"fontPaneForm\"].elements[\"fontFamily\"]) {\r\n\t\tfontFamily = \" font-family: \" + document.forms[\"fontPaneForm\"].elements[\"fontFamily\"].value + \"; \";\r\n\t}\r\n\t\r\n\tvar fontSize = \"\";\r\n\tif (document.forms[\"fontPaneForm\"].elements[\"fontSize\"]) {\r\n\t\tfontSize = \" font-size: \" + document.forms[\"fontPaneForm\"].elements[\"fontSize\"].value + \"; \";\r\n\t}\r\n\t\r\n\tvar fontColor = \"\"\r\n\tif (document.forms[\"fontPaneForm\"].elements[\"fontColor\"]) {\r\n\t\tfontColor = \" color: \" + document.forms[\"fontPaneForm\"].elements[\"fontColor\"].value + \"; \";\r\n\t}\r\n\t\r\n\tvar backgroundColor = \"\";\r\n\tif (document.forms[\"fontPaneForm\"].elements[\"backgroundColor\"]) {\r\n\t\tbackgroundColor = \" background-color: \" + document.forms[\"fontPaneForm\"].elements[\"backgroundColor\"].value + \"; \";\r\n\t}\r\n\t\t\r\n\tvar fontWeight = \"\";\r\n\tif (document.forms[\"fontPaneForm\"].elements[\"fontWeight\"]) {\r\n\t\tif (document.forms[\"fontPaneForm\"].elements[\"fontWeight\"].checked == true) {\r\n\t\t\tfontWeight = \" font-weight: bold; \"; \r\n\t\t}\r\n\t}\r\n\t\r\n\tvar fontStyle = \"\";\r\n\tif (document.forms[\"fontPaneForm\"].elements[\"fontStyle\"]) {\r\n\t\tif (document.forms[\"fontPaneForm\"].elements[\"fontStyle\"].checked == true) {\r\n\t\t\tfontStyle = \" font-style: italic; \"; \r\n\t\t}\r\n\t}\r\n\t\r\n\tvar fontDecoration = \"\";\r\n\tif (document.forms[\"fontPaneForm\"].elements[\"fontDecoration\"]) {\r\n\t\tif (document.forms[\"fontPaneForm\"].elements[\"fontDecoration\"].checked == true) {\r\n\t\t\tfontDecoration = \" text-decoration: underline; \"; \r\n\t\t}\r\n\t}\r\n\t\r\n\t// Localization\r\n\tvar d = \"<SPAN style=\\\"\" + fontFamily + fontSize + fontColor + backgroundColor + fontWeight + fontStyle + \r\n\t\t\tfontDecoration + \"\\\">\" + top.A0700ICustomUiFontExample + \"</SPAN> \";\r\n\t\r\n\twriteDiv(\"fontExampleContainer\", d);\r\n}", "async function list(options) {\n const opts = Object.assign({ concurrency: 4, language: 'en', onFontError: null }, options);\n // TODO: support woff, woff2, ttc\n const files = await get_system_fonts_1.default({ extensions: ['ttf', 'otf'] });\n // Process each font in parallel, swallowing any errors found along the way.\n const results = await parallelize(async (file) => {\n try {\n const fontData = await parse_1.default(file);\n return getMetadata(file, fontData, opts.language);\n }\n catch (e) {\n if (opts.onFontError) {\n opts.onFontError(file, e);\n }\n }\n }, files, opts.concurrency);\n // Group the fonts by their font family\n const fonts = {};\n for (let _a of results.filter(font => font)) {\n const { name } = _a, font = __rest(_a, [\"name\"]);\n if (!fonts[name]) {\n fonts[name] = [];\n }\n fonts[name].push(font);\n }\n return fonts;\n}", "function fontsStyle() {\n let file_content = fs.readFileSync(source + '/scss/fonts.scss');\n if (file_content == '') {\n fs.writeFile(source + '/scss/fonts.scss', '', cb);\n return fs.readdir(path.build.fonts, function (err, items) {\n if (items) {\n let c_fontname;\n for (var i = 0; i < items.length; i++) {\n let fontname = items[i].split('.');\n fontname = fontname[0];\n if (c_fontname != fontname) {\n fs.appendFile(source + '/scss/fonts.scss', '@include font(\"' + fontname + '\", \"' + fontname + '\", \"400\", \"normal\");\\r\\n', cb);\n }\n c_fontname = fontname;\n }\n }\n })\n }\n}", "function changeText() {\n for (var i = 0; i < max; i++) {\n elements[i] = fontProp(all[i],'font-family').toLowerCase()\n window.console.log(elements[i])\n\n if ($.inArray(elements[i], validfonts) == -1) {\n window.console.log('Not a valid font.')\n all[i].style.fontFamily = defaultFont\n }\n } \n}", "function cFontDisplay (str , format){\n CFonts.say(str, {\n font: format, // define the font face\n align: 'center', // define text alignment\n colors: ['magenta','blue','cyan'], // define all colors\n background: 'transparent', // define the background color, you can also use `backgroundColor` here as key\n letterSpacing: 0, // define letter spacing\n lineHeight: 0, // define the line height\n space: false, // define if the output text should have empty lines on top and on the bottom\n maxLength: '0', // define how many character can be on one line\n });\n}", "function displayFont(fontFamily, fontCategory) {\n fontNameDisplay.textContent = fontFamily + \", \" + fontCategory;\n}", "function help() {\n console.log(\" \");\n console.log(\n \" ╔════════════════════════════════════════════════════════════════════════╗\"\n .rainbow\n );\n console.log(\n \" ║ ║\"\n .rainbow\n );\n console.log(\n \" ║ Hi my name is LUIRI, like Siri but better, Ill be assisting you... ║\"\n .rainbow\n );\n console.log(\n \" ║ ║\"\n .rainbow\n );\n console.log(\n \" ╠════════════════════════════════════════════════════════════════════════╣\"\n .rainbow\n );\n console.log(\n \" ║ To see your tweets: luiri tweets ║\"\n .red\n );\n console.log(\n ' ║ To track a tweet: luiri twitterTrack \"word\" ║'\n .red\n );\n console.log(\n ' ║ To search for a song: luiri spotify \"song name\" ║'\n .green\n );\n console.log(\n ' ║ To search for a movie: luiri movie \"movie name\" ║'\n .yellow\n );\n console.log(\n \" ║ Saved: luiri saved ║\"\n .blue\n );\n console.log(\n \" ║ To view the log: luiri log ║\"\n .green\n );\n console.log(\n \" ╚════════════════════════════════════════════════════════════════════════╝\"\n .rainbow\n );\n}", "function changeAllFonts(){\n var cnt = 0;\n var allowedFonts = ['Wingdings' , 'perkinelmer', 'perkinelmer4'];\n for (var k in font){\n allowedFonts.push(font[k]);\n }\n\n for (var i = 0; i < numFields; i++) {\n var fName = getNthFieldName(i);\n if((allowedFonts.indexOf(getField(fName).textFont)== -1)){\n console.println( fName + ': ' + getField(fName).textFont );\n getField(fName).textFont = 'Helvetica';\n cnt++;\n }\n }\n console.println( \"\\n\\rnumFields \" + numFields );\n console.println(cnt + \" set to Helvetica\" );\n\n}", "function updateFontDetails() {\r\n $( \".typography-sample\" ).each( function() {\r\n var fontName = getFontName( $( this ) ),\r\n fontColor = $( this ).css( \"color\" ),\r\n fontDetails = $( this ).next( \"[class*=font-details-]\" );\r\n\r\n fontDetails.children( \".font-name\" ).html( fontName );\r\n fontDetails.children( \".font-color\" ).html( fontColor );\r\n } ); \r\n }", "function preload() {\n for(var i = 0;i<HOWMANYFONTS;i++)\n {\n var fontname = './data/font'+i+'.otf';\n console.log(fontname);\n thefont[i] = loadFont(fontname);\n }\n}", "function fontA(response) { // SYSTEM.RES\n global.clog(\"[ss_reqHan][favicon][SENT]\");\n var img = fs.readFileSync(views.com() + '/orangekid.ttf');\n response.writeHead(200, { \"Content-Type\": \"application/x-font-truetype\" });\n response.end(img, 'binary');\n}", "function add_console()\n{\n if(Math.random()*0.8>Math.random())\n {\n return;\n }\n var cmd=document.createElement(\"FONT\");\n var txt=document.createTextNode(\"#\"+Math.floor(Math.random()*20000+10000).toString(10)+\">> \"+phrases[Math.floor(Math.random()*phrases.length)]);\n \n cmd.appendChild(txt)\n con_txt.appendChild(document.createElement(\"BR\"));\n con_txt.appendChild(cmd);\n \n if(con_txt.children.length>line_limit*2)\n {\n con_txt.children[0].remove();\n con_txt.children[0].remove();\n }\n}", "function writeInstructions() {\n noStroke();\n fill(252, 118, 172);\n textSize(54)\n text('my name is', width / 2, height / 3)\n text('i was born in', width / 2, height * 1 / 2);\n textSize(25);\n text('click on your sign to get your horoscope!', width / 2, height * 2 / 3)\n}", "function setFontAndStyle( ctx, iSpec) {\n var canvasFont = '';\n\n function addToCanvasFont(iPropValue, iDefault, iSuffix) {\n if( (undefined !== iPropValue) && (iPropValue !== iDefault)) {\n if( canvasFont.length > 0)\n canvasFont += ' ';\n canvasFont += iPropValue;\n if( iSuffix)\n canvasFont += iSuffix;\n }\n }\n\n addToCanvasFont( iSpec['font-weight'], 'normal');\n addToCanvasFont( iSpec['font-style'], 'normal');\n addToCanvasFont( iSpec['font-size'], '', 'px');\n addToCanvasFont( iSpec['font-family']);\n \n if( canvasFont.length > 0)\n ctx.font = canvasFont;\n \n if( undefined !== iSpec.color)\n ctx.fillStyle = iSpec.color;\n }", "function loadFont() {\n var loader = new THREE.FontLoader();\n loader.load( 'assets/Roboto/Roboto_Regular.json', function ( response ) {\n font = response;\n createTexts();\n });\n}", "function testAndShow(fontName) {\n var result = d.detect(fontName);\n var tbody = document.getElementById('font-table');\n tbody.innerHTML = tbody.innerHTML + '<tr><td><span class=\"' + (result ? 'name-match' : 'name-no-match') + '\" style=\"font-family: ' + quotedFontIfNecessary(fontName.replace(/\"'/g,'')) + ', monospace\">' + fontName.replace(/</g,'&lt;') + '</span></td><td>' + (result ? '<span class=\"yes\">Yes</span>' : '<span class=\"no\">No</span>') + '</td>';\n}", "function printWelcomeMessage(){\r\n console.log(figlet.textSync('Hang Man!', {\r\n font: 'Standard'\r\n })\r\n ); \r\n}", "function fonts () {\n return gulp\n .src(paths.fonts.src)\n .pipe(gulp.dest(paths.fonts.dest))\n}", "function setup() {\n createCanvas(500, 280);\n textFont(\"Source Code Pro\");\n textSize(38);\n \n }", "function getSystemFonts(options) {\n const opts = Object.assign({ extensions: ['ttf', 'otf', 'ttc', 'woff', 'woff2'], additionalFolders: [] }, options);\n const platform = os.platform();\n const getDirs = directories[platform];\n if (!getDirs) {\n throw new Error(`Unsupported platform: ${platform}`);\n }\n const dirs = getDirs();\n return recursiveWalk_1.default([...dirs, ...opts.additionalFolders], opts.extensions);\n}", "function buildFonts(env) {\n return gulp.src(PATHS.src.fonts)\n // print out the file deets\n .pipe(size(SIZE_OPTS))\n // write the result\n .pipe(gulp.dest(`${PATHS.build[env].root}/font`));\n}", "async function printFontAlignVoiceSupport() {\n\n /**\n * 〈BR〉: line break (if there is a closing tag (e.g. 〈/C〉), it should be placed in front of the closing tag, two consecutive line breaks indicate adding a null string.\n * 〈L〉〈/L〉: left aligned\n * 〈C〉〈/C〉: center aligned\n * 〈R〉〈/R〉: right aligned\n * 〈N〉〈/C〉: normal font size\n * 〈HB〉〈/HB〉: double font in height\n * 〈WB〉〈/WB〉: double font in width\n * 〈B〉〈/B〉: double font in size\n * 〈CB〉〈/CB〉: double font in size centred\n * 〈HB2〉〈/HB2〉: three times the font in height\n * 〈WB2〉〈/WB2〉: three times the font in width\n * 〈B2〉〈/B2〉: three times the font in size\n * 〈BOLD〉〈/BOLD〉: bold font\n * 〈LOGO〉〈/LOGO〉: logo (the tag content is a character string in Base64 format, temporarily not opened)\n * 〈OR〉〈/QR〉: QR code (the tag content is a value of QR code, which cannot exceed 256 characters)\n * 〈BARCODE〉〈/BARCODE〉: barcode (the content is a value of barcode)\n * 〈CUT〉: cutter command (active paper cutting, only valid for cutter printer. Note: the print order of cutter printer has a cutter instruction by default in the end.)\n */\n\n\nlet printContent= `no element:default font<BR>\n<BR>\nL element: <L>left<BR></L>\n<BR>\nR element: <R>right<BR></R>\n<BR>\nC element: <C>center<BR></C>\n<BR>\nN element:<N>normal font size<BR></N>\n<BR>\nHB element: <HB>double font height<BR></HB>\n<BR>\nWB element: <WB>double font width<BR></WB>\n<BR>\nB element: <B>double font size<BR></B>\n<BR>\nHB2 element: <HB2>triple font height<BR></HB2>\n<BR>\nWB2 element: <WB2>triple font width<BR></WB2>\n<BR>\nB2 element: <B2>triple font size<BR></B2>\n<BR>\nBOLD element: <BOLD>bold font<BR></BOLD>`\n\n\n\n printContent=printContent + '<BR>';\n // neseted using font and align element\n printContent=printContent + '<C>nested use:<BOLD>center bold</BOLD><BR></C>';\n\n // print barcode and QR\n printContent=printContent+'<BR>';\n printContent=printContent+'<C><BARCODE>9884822189</BARCODE></C>';\n printContent=printContent+'<C><QR>https://www.xpyun.net</QR></C>';\n\n let request = new model.PrinterRequest();\n\trequest.user = USER_NAME;\n\trequest.userKey = USER_KEY;\n\n\t//*Required*: The serial number of the printer\n\trequest.sn = OK_PRINTER_SN;\n\trequest.generateSign();\n\n\t//*Required*: The content to be printed can’t exceed 12288 bytes.\n\trequest.content=printContent;\n\n\t//The number of printed copies is 1 by default.\n\trequest.copies=1;\n\n //Print mode:\n //If the value is 0 or not specified, it will check whether the printer is online. If not online, it will not generate a print order and directly return the status code of an offline device.\n //If online, it will generate a print order and return the print order number.If the value is 1, it will not check whether the printer is online, directly generate a print order and return the print order number.\n //If the printer is not online, the order will be cached in the print queue and will be printed automatically when the printer is normally online.\n request.mode=0;\n\n //payment method:\n //Value range 41~55:\n //Alipay 41, WeChat 42, Cloud Payment 43, UnionPay Swipe 44, UnionPay Payment 45, Member Card Consumption 46, Member Card Recharge 47, Yipay 48, Successful Collection 49, Jialian Payment 50, One Wallet 51, JD Pay 52, Quick money payment 53, Granville payment 54, Xiangqian payment 55\n //It is only used for Xinye cloud printers that support the amount broadcast.\n request.payType=41;\n\n //Pay or not:\n //Value range 59~61:\n //Refund 59 to account 60 consumption 61.\n //It is only used for Xinye cloud printers that support the amount broadcast.\n\n request.payMode=60;\n\n //Payment amount:\n //Up to 2 decimal places are allowed.\n //It is only used for Xinye cloud printers that support the amount broadcast.\n request.money=20.15;\n\n let result = await service.xpYunPrint(request);\n\tconsole.log(result.httpStatusCode);\n\tconsole.log(result.content);\n\tconsole.log(result.content.code);\n\tconsole.log(result.content.msg);\n\n\t//resp.data: Return to order No. correctly \n\tconsole.log(result.content.data);\t\n}", "initFonts() {\n this.font_spritesheet = new MySpriteSheet(this, './scenes/images/fonts.png', 26, 5);\n this.font_characters = {'0':0, '1':1, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, '!':10, '?':11, '@':12, '#':13, '$':14, '%':15, '&':16, '\\'':17, '\"':18, '(':19, ')':20, '+':21, '-':22, '=':23, ',':24, '.':25,\n 'A':26, 'B':27, 'C':28, 'D':29, 'E':30, 'F':31, 'G':32, 'H':33, 'I':34, 'J':35, 'K':36, 'L':37, 'M':38, 'N':39, 'O':40, 'P':41, 'Q':42, 'R':43, 'S':44, 'T':45, 'U':46, 'V':47, 'W':48, 'X':49, 'Y':50, 'Z':51,\n 'a':52, 'b':53, 'c':54, 'd':55, 'e':56, 'f':57, 'g':58, 'h':59, 'i':60, 'j':61, 'k':62, 'l':63, 'm':64, 'n':65, 'o':66, 'p':67, 'q':68, 'r':69, 's':70, 't':71, 'u':72, 'v':73, 'w':74, 'x':75, 'y':76, 'z':77,\n '<':78, '>':79, '[':80, ']':81, '{':82, '}':83, '\\\\':84, '/':85, '`':86, 'á':87, 'ã':88, 'à':89, 'é':90, 'ë':91, 'è':92, 'í':93, 'ó':94, 'õ':95, 'ú':96, 'ù':97, 'ü':98, 'ñ':99, 'Ç':100, 'ç':101, '¡':102, '¿':103,\n '©':104, '®':105, '™':106, '·':107, '§':108, '†':109, '‡':110, '‐':111, '‒':112, '¶':113, '÷':114, '°':115, '¤':116, '¢':117, 'ß':118, 'Þ':119, ':':120, ';':121, '^':122, '~':123, '♂':124, '♀':125, '♥':126, '♪':127, '♫':128, '☼':129\n };\n }", "function greetings(term) {\n term.echo(\n\"'||''|. || '||' '||' . \\n\" +\n\" || || .... .... ... .. ... ... . || || .... .... ... .. .||. .... \\n\" +\n\" ||''|' '' .|| .| '' || || || || || ||''''|| .|...|| '' .|| ||' '' || ||. ' \\n\" +\n\" || |. .|' || || || || || |'' || || || .|' || || || . '|.. \\n\" +\n\".||. '|' '|..'|' '|...' .||. .||. ||. '||||. .||. .||. '|...' '|..'|' .||. '|.' |'..|' \\n\" +\n\" .|....'\\n\" +\n 'DailyBurn Hackathon 2015\\n'+\n 'Chris Sturgill, Kevin Spector, Luke Arntson\\n'+\n 'https://github.com/sturgill/racing-hearts\\n\\n' +\n 'Welcome to Racing Hearts\\n');\n }", "function preload() {\n font = loadFont ('data/FreightBigBlack.otf');\n font2 = loadFont('data/wildwordsitalic.ttf');\n}", "function Font(options) {\n options = options || {};\n\n // OS X will complain if the names are empty, so we put a single space everywhere by default.\n this.familyName = options.familyName || ' ';\n this.styleName = options.styleName || ' ';\n this.designer = options.designer || ' ';\n this.designerURL = options.designerURL || ' ';\n this.manufacturer = options.manufacturer || ' ';\n this.manufacturerURL = options.manufacturerURL || ' ';\n this.license = options.license || ' ';\n this.licenseURL = options.licenseURL || ' ';\n this.version = options.version || 'Version 0.1';\n this.description = options.description || ' ';\n this.copyright = options.copyright || ' ';\n this.trademark = options.trademark || ' ';\n this.unitsPerEm = options.unitsPerEm || 1000;\n this.ascender = options.ascender;\n this.descender = options.descender;\n this.supported = true;\n this.glyphs = new glyphset.GlyphSet(this, options.glyphs || []);\n this.encoding = new encoding.DefaultEncoding(this);\n this.tables = {};\n}", "function fonts() {\n return gulp\n .src(config.src + 'fonts/**/**')\n .pipe(gulp.dest(config.assets + 'fonts'));\n}", "function listFonts()\n{\n\tvar all_items = dom.library.items;\n\t\n\t\n\t\n\t// ----------------------------------------------------------------------------\n\t// Find embedded fonts\n\t\n\t\n\t\n\tfl.outputPanel.trace(\"\");\n\tfl.outputPanel.trace(\"\");\n\tfl.outputPanel.trace(\"Embedded fonts\");\n\tfl.outputPanel.trace(\"=======================================\");\n\t\n\t\n\tvar i = all_items.length;\n\t\n\t\n\twhile(i--)\n\t{\n\t\tvar library_item = all_items[i];\n\t\t\n\t\t\n\t\t// Skip non-fonts\n\t\t// \n\t\tif(\"font\" != library_item.itemType)\n\t\t{\n\t\t\tcontinue;\n\t\t}\n\t\t\n\t\t\n\t\tvar font_name = library_item.name;\n\t\t\n\t\t\n\t\t// Remove folder from font name if applicable.\n\t\t// \n\t\tif(-1 != font_name.indexOf(\"/\"))\n\t\t{\n\t\t\tfont_name = font_name.substr(font_name.lastIndexOf(\"/\") + 1);\n\t\t}\n\t\t\n\t\tfont_name = fill(font_name, 30, \" \");\n\t\tfont_name += library_item.font;\n\t\t\n\t\tvar installed = \"\";\n\t\t\n\t\tif(fl.isFontInstalled(library_item.font))\n\t\t{\n\t\t\tinstalled = \"\\tInstalled\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tinstalled = \"\\tNot installed\";\n\t\t}\n\t\t\n\t\tfont_name = fill(font_name, 60, \" \");\n\t\tfont_name += installed;\n\t\t\n\t\tfl.outputPanel.trace(font_name);\n\t}\n\t\n\t\n\t\n\t// ----------------------------------------------------------------------------\n\t// Find all TextField instances\n\t\n\t\n\tfl.outputPanel.trace(\"\");\n\tfl.outputPanel.trace(\"\");\n\tfl.outputPanel.trace(\"TextFields\");\n\tfl.outputPanel.trace(\"=======================================\");\n\t\n\t\n\tvar i = all_items.length;\n\t\n\t\n\t// Library items\n\t// \n\twhile(i--)\n\t{\n\t\tvar library_item = all_items[i];\n\t\t\n\t\t\n\t\t// Should we skip the current library item?\n\t\t// \n\t\tif(\"movie clip\" != library_item.itemType && \"graphic\" != library_item.itemType && \"button\" != library_item.itemType)\n\t\t{\n\t\t\tcontinue;\n\t\t}\n\t\t\n\t\t\n\t\tvar layers = library_item.timeline.layers;\n\t\tvar j = layers.length;\n\t\t\n\t\tvar layer_instance_names = [];\n\t\t\n\t\tvar buffer = \"\\n\\n\" + library_item.symbolType + \": \" + library_item.name + \"\\n\";\n\t\t\n\t\t\n\t\t// Layers\n\t\t// \n\t\twhile(j--)\n\t\t{\n\t\t\tvar layer = layers[j];\n\t\t\tvar frames = layer.frames;\n\t\t\tvar k = frames.length;\n\t\t\t\n\t\t\t\n\t\t\t// Frames\n\t\t\t// \n\t\t\twhile(k--)\n\t\t\t{\n\t\t\t\tvar elements = frames[k].elements;\n\t\t\t\tvar m = elements.length;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t// Stage elements\n\t\t\t\t// \n\t\t\t\telementLoop: while(m--)\n\t\t\t\t{\n\t\t\t\t\tvar element = elements[m];\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t// --------------------------------\n\t\t\t\t\t// Stage instance type check\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t// If the current stage element is not a TextField, we can move on\n\t\t\t\t\t// \n\t\t\t\t\tif(\"text\" != element.elementType)\n\t\t\t\t\t{\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// If the current TextField is static, we must skip it\n\t\t\t\t\t// \n\t\t\t\t\tif(\"static\" == element.textType)\n\t\t\t\t\t{\n\t\t\t\t\t\tbuffer += \" \";\n\t\t\t\t\t\tbuffer += fill(\"\", 30, \" \");\n\t\t\t\t\t\tbuffer += fill(\"(Skipping static TextField)\", 50, \" \");\n\t\t\t\t\t\tbuffer += fill(layer.name, 30, \" \");\n\t\t\t\t\t\tbuffer += \"\\n\";\n\t\t\t\t\t\t\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t// --------------------------------\n\t\t\t\t\t// Check duplicates\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tvar c = layer_instance_names.length;\n\t\t\t\t\tvar layer_instance_name = library_item.name + \"_\" + layer.name + \"_\" + element.name;\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\twhile(c--)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(layer_instance_name[c] == layer_instance_name)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbreak elementLoop;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t// --------------------------------\n\t\t\t\t\t// Output\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tvar text_runs = element.textRuns;\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif(0 != text_runs.length)\n\t\t\t\t\t{\n\t\t\t\t\t\tfont_name = text_runs[0].textAttrs.face;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tfont_name = \"[Unknown]\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tbuffer += \" \";\n\t\t\t\t\tbuffer += fill(element.name, 30, \" \");\n\t\t\t\t\tbuffer += fill(font_name, 50, \" \");\n\t\t\t\t\tbuffer += fill(layer.name, 30, \" \");\n\t\t\t\t\t\n\t\t\t\t\tfl.outputPanel.trace(buffer);\n\t\t\t\t\t\n\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\t\n\t\t\t\t\tlayer_instance_names.push(layer_instance_name);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function init() {\n const args = minimist(process.argv.slice(2))\n const types = (args.types || 'svg,ttf,woff,woff2,eot')\n .split(',')\n .map(ext => ext.trim())\n const options = {\n paths : getPaths(args._),\n outputDir : args.o || args.out,\n fontName : args.n || args.name,\n fontsPath : args.f || args.fontspath,\n types : types,\n css : args.c || args.css,\n cssPath : args.csspath,\n cssTemplate : args.csstp,\n json : args.j || args.json,\n jsonPath : args.jsonpath,\n html : args.html,\n htmlPath : args.htmlpath,\n htmlTemplate : args.htmltp,\n silent : args.s || args.silent || false,\n classPrefix : args.p || args.prefix,\n baseTag : args.t || args.tag,\n normalize : args.normalize,\n round : args.round,\n descent : args.descent,\n fixedWidth : args.mono,\n fontHeight : args.height,\n centerHorizontally : args.center\n }\n const calledEmpty = Object.keys(args).length === 1 && args._.length === 0\n const formats = [ 'json' ]\n\n // Parse Boolean values that default to true\n formats.forEach(key => {\n if (typeof options[key] !== 'undefined') {\n options[key] = options[key] === 'true'\n }\n })\n\n // Show usage if missing any arguments or called with -h / --help\n if (args.h || args.help || calledEmpty) {\n showHelp()\n return process.exit()\n }\n\n run(options)\n}", "function fn_fontstart()\r\n{ \r\n return \"<font face = \" + chr(34) +\"Calibri\" + chr(34) + \">\" + Chr(10);\r\n}", "function addFont() {\r\n /*This function is used to add font resources to windows via qsfox.dll\r\n *Before adding font resources it checks for operating system. If it is not windows font will not be installed\r\n */\r\n\r\n var osString = Components.classes[\"@mozilla.org/xre/app-info;1\"]\r\n .getService(Components.interfaces.nsIXULRuntime).OS;\r\n if(osString==\"WINNT\"){\r\n\t\r\n\t\r\n const cid = \"@qsfox/qsfox;1\";\r\n var obj = Components.classes[cid].createInstance();\r\n obj = obj.QueryInterface(Components.interfaces.Iqsfox);\r\n\r\n\r\n var MY_ID = \"[email protected]\";\r\n var em = Components.classes[\"@mozilla.org/extensions/manager;1\"].\r\n getService(Components.interfaces.nsIExtensionManager);\r\n var file = em.getInstallLocation(MY_ID).getItemFile(MY_ID, \"content/other/FM-MalithiUW46.ttf\");\r\n var filestring = file.path;\r\n var res = obj.addfont(filestring);\r\n }\r\n\r\n}", "function loadFont() {\r\n\r\n var loader = new THREE.FontLoader();\r\n loader.load('../fonts/work_sans_regular.json', function (response) {\r\n\r\n font = response;\r\n\r\n refreshText();\r\n });\r\n}", "function customFont1() {\n ExtensionUtils.addEmbeddedStyleSheet(\".CodeMirror{text-rendering: optimizeLegibility;font-family: 'SourceCodePro-Medium' ,MS ゴシック !important;}\");\n }", "function setUpText() {\n textImg = createGraphics(width, height);\n textImg.pixelDensity(1);\n textImg.background(255);\n textImg.textStyle(fontStyle);\n textImg.textFont('Roboto');\n textImg.textSize(fontSize);\n textImg.textAlign(CENTER, CENTER);\n textImg.text(type, width / 2, height / 4 + fontSize / 6);\n textImg.loadPixels();\n}", "function fonts() {\n return gulp.src(path.src.fonts)\n .pipe(gulp.dest(path.build.fonts))\n .pipe(reload({stream: true}))\n}", "function logLoadedFontsCount( when = \"\" ) {\r\n const loaded_fonts = [ ...document.fonts ]\r\n .filter( ({status}) => status === \"loaded\" );\r\n console.log( \"%s fonts loaded %s\", loaded_fonts.length, when );\r\n}", "instructions() {\n this.canvas[1].font = \"20px Arial\";\n this.canvas[1].fillText('Goal: Avoid the monsters. Reach the princess.',10,105);\n }", "function withFonto(filePath) {\n //const DomParser = require(\"dom-parser\");\n //const parser = new DomParser();\n\n fs.readFile(filePath, \"utf8\", (err, data) => {\n //console.error(data);\n for (let i = 0; i < 1; i++) {\n // slimdom-sax-parser is quite strict and requires injection of additional namespaces and entities\n\n const options = {\n additionalNamespaces: {\n ac: \"http://www.atlassian.com/schema/confluence/4/ac/\",\n ri: \"http://www.atlassian.com/schema/confluence/4/ri/\"\n },\n additionalEntities: {\n nbsp: 160\n }\n };\n const dom = sync(data, options);\n\n console.error(evaluateXPathToNodes(\"//ac:structured-macro\", dom, domFacade, null,\n {\n namespaceResolver: prefix => options.additionalNamespaces[prefix]\n }).length+\" macros\");\n console.error(evaluateXPathToNodes(\"//ac:rich-text-body/ac:structured-macro[@ac:name='plantuml']\", dom, domFacade, null,\n {\n namespaceResolver: prefix => options.additionalNamespaces[prefix]\n }).length+\" PlantUMLs\");\n console.error(evaluateXPathToNodes(\"//ac:structured-macro[@ac:name='plantuml']\", dom, domFacade, null,\n {\n namespaceResolver: prefix => options.additionalNamespaces[prefix]\n }).length+\" PlantUMLs\");\n console.error(evaluateXPathToNodes(\"//ac:structured-macro[@ac:name='jira']\", dom, domFacade, null,\n {\n namespaceResolver: prefix => options.additionalNamespaces[prefix]\n }).length+\" JIRAs\");\n\n // Extract:\n evaluateXPathToNodes(\"//ac:rich-text-body/ac:structured-macro[@ac:name='plantuml']/ac:plain-text-body\", dom, domFacade, null,\n {\n namespaceResolver: prefix => options.additionalNamespaces[prefix]\n }).forEach((n, index) => {\n //console.log(`______ ${n.id}`)\n //console.log(n.firstChild.F)\n createFilePlus (`${filePath}_uml`, `diag_${index}.puml`, n.firstChild.F);\n })\n }\n });\n}", "function Font(family, weight, style, variant, ascent, descent, unitsPerEm) {\n this.family = family;\n this.weight = weight;\n this.style = style;\n this.variant = variant;\n this.metrics = { ascent: ascent || 0, descent: descent || 0, unitsPerEm: unitsPerEm || 0 };\n }", "function gfonts_setValue(name, data) {\n\tvar values = data.split('|');\n\t// Set font family\n\tif (values.length > 0) {\n\t if (values[0].length > 0) {\n\t $(name+'-family').set('text', values[0]);\n\t $(name+'-family').setStyle('font-family', values[0]);\n\t } else {\n\t $(name+'-family').set('text', '-- Not applied --');\n\t $(name+'-family').setStyle('font-family', 'inherit');\n\t }\n\t}\n\t// Set font info\n\tif (values.length > 3) {\n\t var font_info = [];\n\t if (values[3].length > 0) { // Variant\n\t font_info.push('<strong>Variant:</strong> ' + values[3]);\n\t // Set style\n\t var variant = gfonts_split_variant(values[3]);\n\t $(name+'-family').setStyle('font-weight', variant[0]);\n\t if (variant[1] != '') {\n\t $(name+'-family').setStyle('font-style', variant[1]);\n\t } else {\n\t $(name+'-family').setStyle('font-style', 'inherit');\n\t }\n\t } else {\n\t $(name+'-family').setStyle('font-weight', 'inherit');\n\t $(name+'-family').setStyle('font-style', 'inherit');\n\t\t}\n\t if (values.length > 4 && values[4].length > 0) {\n\t font_info.push('<strong>Subset:</strong> ' + values[4]);\n\t }\n\t font_info = font_info.join(', ');\n if (font_info.length > 0) {\n $(name+'-info').innerHTML = font_info;\n $(name+'-info').setStyle('display', 'block');\n } else {\n $(name+'-info').setStyle('display', 'none');\n }\n\t} else {\n\t $(name+'-info').setStyle('display', 'none');\n\t}\n\t// Set font custom\n\tif (values.length > 2 && values[1] && values[2].length > 0) {\n\t var custom = '<strong>Custom:</strong> <br />' + values[2].replace(/\\n/g, '<br />');\n\t $(name+'-custom').innerHTML = custom;\n\t $(name+'-custom').setStyle('display', 'block');\n\t} else {\n\t $(name+'-custom').innerHTML = '';\n\t $(name+'-custom').setStyle('display', 'none');\n\t}\n\t// Store data\n\t$(name).value = data;\n\t// Replace link fetch font from gogole\n\tif (gfonts_replace_link._run == undefined) {\n\t gfonts_replace_link._run = true;\n\t gfonts_replace_link.delay(1000);\n\t}\n}", "function doFirst(){\r\n console.log(\"สั่งสินค้า\");\r\n}", "function pipeFonts(cb){\n\tgulp.src(fontSrc)\n\t.pipe(gulp.dest(fontDest));\n\tcb();\n}", "function onSelectFontFamily(fontFamily) {\n changeCurrMeme('font-family', fontFamily);\n renderCanvas();\n}", "function setFontEncoding(encoding) {\n write(Buffer.from([0x1C, 0x65, encoding]))\n}", "function welcomeJonn(){\n console.log(\"%c _ _ _ \\n\\\n| | | | | | \\n\\\n| |__| | ___ _ _ | | ___ _ __ _ __ \\n\\\n| __ |/ _ \\\\ | | | _ | |/ _ \\\\| '_ \\\\| '_ \\\\ \\n\\\n| | | | __/ |_| | | |__| | (_) | | | | | | | \\n\\\n|_| |_|\\\\___|\\\\__, | \\\\____/ \\\\___/|_| |_|_| |_| \\n\\\n __/ | \\n\\\n |___/\", \"font-family:monospace\");\n}", "setFontFamily(name) {\n this.font.family = name;\n this.setFont();\n }", "function consoleHello() {\n var userAgent = navigator.userAgent.toLowerCase();\n var supported = /(chrome|firefox)/;\n\n if (supported.test(userAgent.toLowerCase())) {\n var dark = ['padding: 18px 5px 16px', 'background-color: #171718', 'color: #e74c3c'].join(';');\n\n if (userAgent.indexOf('chrome') > -1) {\n dark += ';';\n dark += ['padding: 18px 5px 16px 40px', 'background-image: url(\"https://i.imgur.com/ElEn6VW.png\")', 'background-position: 10px 9px', 'background-repeat: no-repeat', 'background-size: 30px 30px'].join(';');\n }\n\n var red = ['padding: 18px 5px 16px', 'background-color: #e74c3c', 'color: #ffffff'].join(';');\n\n var spacer = ['background-color: transparent'].join(';');\n\n var msg = '%c Crafted with ❤ by SBG Bots %c https://github.com/bhumikabhatia/sbg-bots %c';\n\n console.log(msg, dark, red, spacer);\n } else if (window.console) console.log('Crafted with love by SBG Bots || https://github.com/bhumikabhatia/sbg-bots');\n}", "function waitForWebfonts() {\n\t\tfor(var i = 0, l = fontNames.length; i < l; i++) {\n\t\t\tvar profile = fontNames[i].split(':');\n\t\t\tfor(var n = 0, weights = profile[1].split(','); n < weights.length; n++) {\n\t\t\t\tfontProfiles.push({\n\t\t\t\t\tfontName: profile[0].replace(/\\+/g, ' '),\n\t\t\t\t\tfontWeight: weights[n],\n\t\t\t\t\tloaded: false\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\t\n for (var i = 0, l = fontProfiles.length; i < l; ++i) {\n var node = document.createElement('span');\n\n // Characters that vary significantly among different fonts\n node.innerHTML = 'giItT1WQy@!-/#';\n\n // Visible - so we can measure it - but not on the screen\n node[style].position = 'absolute';\n node[style].top = '-1000em';\n\n // Large font size makes even subtle changes obvious\n node[style].fontSize = '300px';\n\n // Reset any font properties\n node[style].fontFamily = 'serif';\n node[style].fontVariant = normal;\n node[style].fontStyle = normal;\n node[style].fontWeight = fontProfiles[i].fontWeight;\n node[style].letterSpacing = 0;\n document.body.appendChild(node);\n\n // Remember the initial width so we can check later\n fontProfiles[i].node = node;\n fontProfiles[i].baseWidth = node.offsetWidth;\n \n // Setting a 'serif' fallback ensures we don't inherit the site's CSS font family\n // which would trigger a false positive checking the width later\n node[style].fontFamily = \"'\" + fontProfiles[i].fontName + \"', serif\";\n }\n \n (function checkNodes() {\n \tvar profile;\n for (var i = 0, l = fontProfiles.length; i < l; i++) {\n \tprofile = fontProfiles[i];\n \tif( !profile.loaded ) {\n\t if (profile.baseWidth == profile.node.offsetWidth) {\n\t // one of the fonts has not loaded. Wait a little longer\n\t setTimeout(checkNodes, 50);\n\t return;\n\t } else {\n\t // The font has loaded. Clean things up and reset the timer\n\t profile.node.parentNode.removeChild(profile.node);\n\t profile.loaded = true;\n\t \n\t clearTimeout(timer);\n\t timer = setTimeout(showText, 500)\n\t }\n \t}\n }\n // Pass \"true\" so that we know the fail-safe timer didn't fire.'\n showText(true);\n }());\n }", "async function startup() {\n\tfont = new FontFace(\n\t\t\"PressStart2P\",\n\t\t\"url(css/PressStart2P.ttf)\"\n\t);\n\n\tawait font.load();\n\tdocument.fonts.add(font);\n\n\tinit();\n}", "async function listVariants(name, options) {\n const fonts = await list(options);\n return fonts[name] || [];\n}", "function testLty() {\n console.log(\"en\");\n console.log(\"ch\");\n}", "function gulpFontgen(options) {\n\n\t// Creating a stream through which each file will pass\n\tvar stream = through.obj(function(file, enc, callback) {\n\n\t\toptions.source = file.path;\n\n\t\tvar font = file.path;\n\t\tvar extension = path.extname(font);\n var fontname = path.basename(font, extension);\n\n\t\toptions.css = options.fontface + '/' + fontname + options.ext;\n\t\toptions.css_fontpath = options.relative;\n\n mkdirp(options.fontface);\n\n\t\tfontface(options);\n\n\t\tthis.push(file);\n\t\treturn callback();\n\n\t});\n\n\treturn stream;\n}", "function calculateFonts() {\n //title font size calculations\n titleFont.fontSize =\n allDimensions.titleBarHeight * titleFont.fontSizeFactor\n\n //bottom font size calculations\n bottomFont.fontSize =\n allDimensions.bottomBarHeight / 3 * bottomFont.fontSizeFactor\n}", "function setup() {\n createCanvas(625, 280);\n textFont(\"Source Code Pro\");\n fill(0);\n stroke(255);\n \n }", "function typo(font, size, message, startX, startY){\n fill(200, 0, 200);\n // here we set the font as whatever font is passed through the function as a parameter\n textFont(font);\n // here we set the size as whatever font is passed through the function as a parameter\n textSize(size);\n // use the alingn fuction to adjust where the text is drawn\n textAlign(RIGHT);\n // here we set the font as whatever message, and starting coordinates are passed through the function as a parameter\n text(message, startX, startY);\n}", "function help() {\n console.log(\n \"\\n\" +\n \"STRUCTURE\" +\n \"\\033[38;5;6m\" + \"\\n node liri.js (command) + (search(artist, concert, movie))\\n\" + \"\\033[0m\" +\n \"\\nCOMMAND OPTIONS\" +\n \"\\033[38;5;10m\" +\n \"\\n spotify-this-song\" + \"\\033[0m\" + \" search for artist details\" +\n \"\\033[38;5;10m\" +\n \"\\n concert-this\" + \"\\033[0m\" + \" search for concert details\" +\n \"\\033[38;5;10m\" +\n \"\\n movie-this\" + \"\\033[0m\" + \" search for movie details\" +\n \"\\033[38;5;10m\" +\n \"\\n do-what-it-says\" + \"\\033[0m\" + \" run a search based on what is written in 'random.txt'\"\n )\n}", "function DefaultEncoding(font) {\n this.font = font;\n}", "function setupAdditionalCufonFontReplacement()\r\n{\r\n Cufon.replace(\".tabHeader\", {fontWeight: 400});\r\n Cufon.replace(\".tabsHeader\", {fontWeight: 700});\r\n \r\n Cufon.replace(\".accordionDescHeader\", {fontWeight: 700});\r\n Cufon.replace(\"#servicesProductsHeader\", {fontWeight: 300});\r\n Cufon.replace(\"#latestNewsHeader\", {fontWeight: 300});\r\n}", "function wtfInit() {}", "function generateFontFaces(fontsList, fontSource, dest) {\n for (let i = fontsList.length - 1; i >= 0; i -= 1) {\n const font = fontsList[i];\n const extension = path.extname(font);\n\n // Test with embedded ttf\n if (extension === '.ttf' || extension === '.otf') {\n fontfacegen({\n source: path.join(fontSource, font),\n dest,\n collate: false,\n });\n }\n }\n}", "function sayHello() {\n\tconsole.log('你好, 世界')\n}", "function BOT_printStandardChar() {\r\n\tvar botobject = eval(BOT_theBotId);\r\n\tvar bottopicid = botobject.topicId;\r\n\tvar prefix = BOT_get(bottopicid,\"_htmlprefix\",\"VAL\"); // HTML prefix == 'fifi'\r\n\tif(prefix) {\r\n\t\tvar elem = document.getElementById(prefix+\"balloon\");\r\n\t\tif(elem) {\r\n\t\t\tif(BOT_reqAnswerLong == BOT_theLastAnswerLong) {\r\n\t\t\t\tif(elem.style.fontFamily == BOT_standardFontNormal) elem.style.fontFamily = BOT_standardFontSlanted;\r\n\t\t\t\telse elem.style.fontFamily = BOT_standardFontNormal;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\telem.style.fontFamily = BOT_standardFontNormal;\r\n\t\t\t\telem.value = BOT_reqEmote+\": \"+ BOT_reqAnswerLong;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "function applyFont(font) {\n let items = document.getElementsByClassName(\"font\");\n items.forEach(function(item) {\n item.style.fill = font;\n });\n settings.font = font;\n}", "function writeSamplesInfo()\r\n{\r\n\tif (typeof g_samplesInstalled != \"undefined\" && g_samplesInstalled == true)\r\n\t{\r\n\t\twith (document)\r\n\t\t{\r\n\t\t\twrite(\"<br><hr width='80%'>\");\r\n\t\t\twrite(\"<h2><a name='Samples'>Samples installed</a></h2>\");\r\n\t\t\twrite(\"Some samples require the server platform to be installed in order to run the application in that server environment.\");\r\n\t\t\tif (true == g_samplesASP)\r\n\t\t\t\twrite(\"<li>ASP Samples\");\r\n\t\t\tif (true == g_samplesASPNET)\r\n\t\t\t\twrite(\"<li>ASP.NET Samples (Microsoft .NET server needs to be installed.)\");\r\n\t\t\tif (true == g_samplesColdFusion)\r\n\t\t\t\twrite(\"<li>ColdFusion Samples (ColdFusion server needs to be installed.)\");\r\n\t\t\tif (true == g_samplesHTML)\r\n\t\t\t\twrite(\"<li>HTML Samples\");\r\n\t\t\tif (true == g_samplesJSP)\r\n\t\t\t\twrite(\"<li>JSP Samples (JSP server needs to be installed.)\");\r\n\t\t\tif (true == g_samplesPHP)\r\n\t\t\t\twrite(\"<li>PHP Samples (PHP server needs to be installed.)\");\r\n\t\t\tif (true == g_samplesLasso)\r\n\t\t\t\twrite(\"<li>Lasso Samples (Lasso server needs to be installed.)\");\r\n\t\t\tif (true == g_samplesXML)\r\n\t\t\t\twrite(\"<li>XML Samples\");\r\n\t\t\tif (true == g_samplesDataDesign)\r\n\t\t\t\twrite(\"<li>Data Design Samples\");\r\n\t\t\tif (true == g_samplesWebImageFX)\r\n\t\t\t\twrite(\"<li>WebImageFX Samples\");\r\n\t\t\twriteln(\"<br>\");\r\n\t\t}\r\n\t}\r\n}", "function createSymbolPreviewInnerHTML(font) {\n var html, abc, numbers, i, f, e;\n html = '';\n abc = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];\n numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];\n html += '<br><br><br><br>';\n for (i = 0; i < abc.length; i++) {\n html += '<div>' + abc[i] + ': <span style=\"font-family:' + font + ';\">' + abc[i] + '</span><span>&nbsp;&nbsp;</span></div>';\n }\n html += '<br><br>';\n for (f = 0; f < abc.length; f++) {\n html += '<div>' + abc[f].toUpperCase() + ': <span style=\"font-family:' + font + ';\">' + abc[f].toUpperCase() + '</span><span>&nbsp;&nbsp;</span></div>';\n }\n html += '<br><br>';\n for (e = 0; e < numbers.length; e++) {\n html += '<div>' + numbers[e] + ': <span style=\"font-family:' + font + ';\">' + numbers[e] + '</span><span>&nbsp;&nbsp;</span></div>';\n }\n return html;\n }", "function setup() {\n createCanvas(1000, 1000);\n\n textSize(40);\n text(255);\n textFont('Courier New'); \n textAlign(CENTER);\n rectMode(CENTER);\n }", "function speechToText(){\n push();\n textSize(20);\n fill(255);\n textFont(speechFont);\n //appears randomly on the screen\n text(theWords,random(0,width/3),random(0,height));\n pop();\n}", "function runCleanFont(cb) {\n del(global.getDest('font'), cb);\n}", "function runCleanFont(cb) {\n del(global.getDest('font'), cb);\n}", "function fontsCopy(done) {\n gulp.src('src/fonts/**/*')\n .pipe(errorNotify('Error On Copy Fonts'))\n .pipe(gulp.dest('app/assets/fonts/'));\n done();\n}", "function printInstructions(){\n console.log(\"\\nHello! My Name is Liri. I am an AI assistant.\");\n console.log(\"I can perform the following tasks:\");\n console.log(`\\n\"my-tweets\": This command will return Yuen's latest tweets.`);\n console.log(`\\n\"spotify-this-song\": This command will return information about a song of your choice.`);\n console.log(`\\n\"movie-this\": This command will return information about a movie of your choice.`);\n console.log(`\\n\"do-what-it-says\": This command will perform a random command on a predefined query`);\n console.log(`-------------------`);\n}", "function saveFont() {\n M.toast({ html: '❤️' })\n}", "function gfonts_init(family_obj, variant_obj, subset_obj, custom_obj, style_obj, apply_button, cancel_button) {\n // Setup blur event when leave family input\n family_obj.addEvent('blur', function(e) {\n gfonts_get_properties(null, null);\n });\n\n // Setup click event for checkbox custom\n custom_obj.addEvent('click', function(e) {\n var display = style_obj.getStyle('display');\n if (display == 'none') {\n style_obj.setStyle('display', 'block');\n } else {\n style_obj.setStyle('display', 'none');\n }\n });\n\n // Setup click event for apply button\n apply_button.addEvent('click', function(e) {\n var popup = $('ja-popup-gfont');\n var family = family_obj.value;\n var variant = variant_obj.value;\n var subset = subset_obj.value;\n var custom = custom_obj.checked;\n var style = style_obj.value;\n popup.setGFont(family, variant, subset, custom, style);\n popup.setStyle('display', 'none');\n });\n\n // Setup click event for cancel button\n cancel_button.addEvent('click', function(e) {\n var popup = $('ja-popup-gfont');\n popup.setStyle('display', 'none');\n });\n\n // Setup autocompleter\n gfonts_setup_autocomplete(family_obj);\n\n // Prevent fire body click event when click autocompleter\n $$('ul.autocompleter-choices')[0].addEvent('click', function(e) {\n if(e) e.stopPropagation();\n });\n}", "async function getFonts() {\n var temp = document.getElementById(\"fontsList\");\n fontList\n .getFonts()\n .then((fonts) => {\n // fonts=fonts.slice(240)\n fonts.forEach((element) => {\n element = element.replace(/^\"(.*)\"$/, \"$1\");\n let option = document.createElement(\"option\");\n // option.style.fontFamily=element\n option.innerHTML = element;\n\n temp.add(option);\n });\n })\n .catch((err) => {\n console.log(err);\n });\n}", "function fHeaderFonts(s1, s2, s3, s5){\n h1.css ({\"fontSize\": s1 + \"em\"});\n h2.css ({\"fontSize\": s2 + \"em\"});\n h3.css ({\"fontSize\": s3 + \"em\"});\n imgTitle.css ({\"fontSize\": s5 + \"em\"});\n }", "function setFont(font) {\n $(\"*\").css(\"font-family\", font);\n console.log(\"font changed successful!\");\n}", "function glyphs (params) {\n params = params || {};\n\n var defFont = params.font || this.settings('glyphFont'),\n defFontStyle = params.fontStyle || this.settings('glyphFontStyle'),\n defFontScale = params.fontScale || this.settings('glyphFontScale'),\n defStrokeColor = params.strokeColor || this.settings('glyphStrokeColor'),\n defLineWidth = params.lineWidth || this.settings('glyphLineWidth'),\n defFillColor = params.fillColor || this.settings('glyphFillColor'),\n defScale = params.scale || this.settings('glyphScale'),\n defTextColor = params.textColor || this.settings('glyphTextColor'),\n defTextThreshold = params.textThreshold || this.settings('glyphTextThreshold'),\n defStrokeIfText = ('strokeIfText' in params) ? params.strokeIfText : this.settings('glyphStrokeIfText'),\n defThreshold = params.threshold || this.settings('glyphThreshold'),\n defDraw = ('draw' in params) ? params.draw : this.settings('drawGlyphs');\n\n if(!defDraw){\n return;\n }\n\n\n if (!this.domElements['glyphs']) {\n this.initDOM('canvas', 'glyphs');\n this.domElements['glyphs'].width = this.container.offsetWidth;\n this.domElements['glyphs'].height = this.container.offsetHeight;\n this.container.insertBefore(\n this.domElements['glyphs'],\n this.domElements['mouse']\n );\n }\n this.drawingContext = this.domElements['glyphs'].getContext('2d');\n this.drawingContext.textAlign = 'center';\n this.drawingContext.textBaseline = 'middle';\n this.drawingContext.lineWidth = defLineWidth;\n this.drawingContext.strokeStyle = defStrokeColor;\n\n var self = this,\n nodes = this.nodesOnScreen || [],\n prefix = this.options.prefix || '',\n cos45 = Math.cos(degreesToRadians(45)),\n sin45 = Math.sin(degreesToRadians(45)),\n cos135 = Math.cos(degreesToRadians(135)),\n sin135 = Math.sin(degreesToRadians(135)),\n cos225 = Math.cos(degreesToRadians(225)),\n sin225 = Math.sin(degreesToRadians(225)),\n cos315 = Math.cos(degreesToRadians(315)),\n sin315 = Math.sin(degreesToRadians(315));\n\n function draw (o, context) {\n // console.log(o.draw);\n if (o.draw && o.x && o.y && o.radius > o.threshold) {\n var x = o.x,\n y = o.y;\n\n switch (o.position) {\n case 'top-right':\n x += o.nodeSize * cos315;\n y += o.nodeSize * sin315;\n break;\n case 'top-left':\n x += o.nodeSize * cos225;\n y += o.nodeSize * sin225;\n break;\n case 'bottom-left':\n x += o.nodeSize * cos135;\n y += o.nodeSize * sin135;\n break;\n case 'bottom-right':\n x += o.nodeSize * cos45;\n y += o.nodeSize * sin45;\n break;\n }\n\n // Glyph rendering\n context.fillStyle = o.fillColor;\n if (o.strokeColor !== context.strokeStyle) {\n context.strokeStyle = o.strokeColor;\n }\n context.beginPath();\n context.arc(x, y, o.radius, 2 * Math.PI, false);\n context.closePath();\n if (!o.strokeIfText || o.radius > o.textThreshold) {\n context.stroke();\n }\n context.fill();\n\n // Glyph content rendering\n if (o.radius > o.textThreshold) {\n var fontSize = Math.round(o.fontScale * o.radius);\n var font = o.fontStyle + ' ' + fontSize + 'px ' + o.font;\n if (font !== context.font) {\n context.font = font;\n }\n context.fillStyle = o.textColor;\n context.fillText(o.content, x, y);\n }\n }\n };\n\n var display;\n nodes.forEach(function(node) {\n if (node.glyphs) {\n node.glyphs.forEach(function(glyph) {\n display = !node.hidden;\n if (display && 'draw' in glyph) {\n display = glyph.draw;\n }\n\n draw(\n {\n x: node[prefix + 'x'],\n y: node[prefix + 'y'],\n nodeSize: node[prefix + 'size'] || 0,\n position: glyph.position,\n radius: glyph.size || node[prefix + 'size'] * defScale,\n content: (glyph.content || '').toString() || '',\n lineWidth: glyph.lineWidth || defLineWidth,\n fillColor: resolve(glyph.fillColor, node) || defFillColor,\n textColor: resolve(glyph.textColor, node) || defTextColor,\n strokeColor: resolve(glyph.strokeColor, node) || defStrokeColor,\n strokeIfText: ('strokeIfText' in glyph) ? glyph.strokeIfText : defStrokeIfText,\n fontStyle: glyph.fontStyle || defFontStyle,\n font: glyph.font || defFont,\n fontScale: glyph.fontScale || defFontScale,\n threshold: glyph.threshold || defThreshold,\n textThreshold: glyph.textThreshold || defTextThreshold,\n draw: display\n },\n self.drawingContext\n );\n });\n }\n });\n }", "function clearFonts(){\n\n spinner.text = 'removing fonts...';\n spinner.start();\n\n shell.rm('-r', path.join(fontPath,'/*') );\n shell.touch( path.join(fontPath,'/fonts.css') );\n\n spinner.succeed();\n}", "function Glyph(options) {\n // By putting all the code on a prototype function (which is only declared once)\n // we reduce the memory requirements for larger fonts by some 2%\n this.bindConstructorValues(options);\n}", "function preload() {\n inconsolata = loadFont('data/inconsolata.otf');\n DIN = loadFont('data/DIN.otf');\n coldera=loadFont('data/Coldera.otf');\n}", "function usage() {\n console.log( \"Usage: node wetness.js -f /path/to/file.css\" );\n console.log( \"\\tor\" );\n console.log( \"Usage: node wetness.js -f /path/to/file.css -v\" );\n}", "function main(){\r// setup some variables\rvar d = app.documents.add(); // active doc\rvar pg = d.pages.item(0); // first page\rvar tf = pg.textFrames.add(); // the one textframe that is there\r\r// the function buildBounds(app.documents.item());\r// calculates the size of the textframe\rtf.geometricBounds = buildBounds(d);\r\r\rtf.contents = \"Hello World\";\r\r// now we can loop thru the text\r\rfor(var i = 0;i < tf.characters.length; i++){\r\tvar c = tf.characters[i];\r\t// the next line loops thru all characters in the text\r\tc.pointSize = calcVal(23);\r\t}\r\r\r}", "function setup() {\n createCanvas(600,200);\n\n line1 = new RiGrammar();\n line2 = new RiGrammar();\n line3 = new RiGrammar();\n lexicon = new RiLexicon();\n line1.addRule('<start>', '<l1w1> <l1w2> <l1w3>', 1);\n line1.addRule('<l1w1>', lexicon.randomWord(\"nn\",2), 1);\n line1.addRule('<l1w2>', lexicon.randomWord(\"vbz\",1), 1);\n line1.addRule('<l1w3>', lexicon.randomWord(\"rb\",2), 1);\n\n line2.addRule('<start>', '<l2w1> <l2w2> <l2w3> <l2w4> <l2w5>', 1);\n line2.addRule('<l2w1>', lexicon.randomWord(\"dt\",1), 1);\n line2.addRule('<l2w2>', lexicon.randomWord(\"jj\",2), 1);\n line2.addRule('<l2w3>', lexicon.randomWord(\"nn\",1), 1);\n line2.addRule('<l2w4>', lexicon.randomWord(\"vbz\",1), 1);\n line2.addRule('<l2w5>', lexicon.randomWord(\"rb\",2), 1);\n\n line3.addRule('<start>', '<l3w1> <l3w2> <l3w3>', 1);\n line3.addRule('<l3w1>', lexicon.randomWord(\"rb\",1), 1);\n line3.addRule('<l3w2>', lexicon.randomWord(\"vbz\",2), 1);\n line3.addRule('<l3w3>', lexicon.randomWord(\"nn\",2), 1);\n}", "function renderNewFont () {\n \n var item = chooseNumber();\n\n currentFontFamily = fontData.items[item].family;\n currentFontLink = fontData.items[item].files.regular;\n\n //append new stylesheet to head\n $(\"head\").append(\"<link href='https://fonts.googleapis.com/css2?family=\" + currentFontFamily + \"' rel='stylesheet'>\");\n \n //applies font family to card content\n fontNameDisplay.style.fontFamily = currentFontFamily;\n quoteDisplayEl.style.fontFamily = currentFontFamily;\n\n displayFont(fontData.items[item].family, fontData.items[item].category);\n }", "async function printFontAlign() {\n\n\n /**\n * 〈BR〉: line break (if there is a closing tag (e.g. 〈/C〉), it should be placed in front of the closing tag, two consecutive line breaks indicate adding a null string.\n * 〈L〉〈/L〉: left aligned\n * 〈C〉〈/C〉: center aligned\n * 〈R〉〈/R〉: right aligned\n * 〈N〉〈/C〉: normal font size\n * 〈HB〉〈/HB〉: double font in height\n * 〈WB〉〈/WB〉: double font in width\n * 〈B〉〈/B〉: double font in size\n * 〈CB〉〈/CB〉: double font in size centred\n * 〈HB2〉〈/HB2〉: three times the font in height\n * 〈WB2〉〈/WB2〉: three times the font in width\n * 〈B2〉〈/B2〉: three times the font in size\n * 〈BOLD〉〈/BOLD〉: bold font\n * 〈LOGO〉〈/LOGO〉: logo (the tag content is a character string in Base64 format, temporarily not opened)\n * 〈OR〉〈/QR〉: QR code (the tag content is a value of QR code, which cannot exceed 256 characters)\n * 〈BARCODE〉〈/BARCODE〉: barcode (the content is a value of barcode)\n * 〈CUT〉: cutter command (active paper cutting, only valid for cutter printer. Note: the print order of cutter printer has a cutter instruction by default in the end.)\n */\n\n\nlet printContent= `no element:default font<BR>\n<BR>\nL element: <L>left<BR></L>\n<BR>\nR element: <R>right<BR></R>\n<BR>\nC element: <C>center<BR></C>\n<BR>\nN element:<N>normal font size<BR></N>\n<BR>\nHB element: <HB>double font height<BR></HB>\n<BR>\nWB element: <WB>double font width<BR></WB>\n<BR>\nB element: <B>double font size<BR></B>\n<BR>\nHB2 element: <HB2>triple font height<BR></HB2>\n<BR>\nWB2 element: <WB2>triple font width<BR></WB2>\n<BR>\nB2 element: <B2>triple font size<BR></B2>\n<BR>\nBOLD element: <BOLD>bold font<BR></BOLD>`\n\n\n\n printContent=printContent + '<BR>';\n // neseted using font and align element\n printContent=printContent + '<C>nested use:<BOLD>center bold</BOLD><BR></C>';\n\n // print barcode and QR\n printContent=printContent+'<BR>';\n printContent=printContent+'<C><BARCODE>9884822189</BARCODE></C>';\n printContent=printContent+'<C><QR>https://www.xpyun.net</QR></C>';\n\n let request = new model.PrinterRequest();\n\trequest.user = USER_NAME;\n\trequest.userKey = USER_KEY;\n\n\t//*Required*: The serial number of the printer\n\trequest.sn = OK_PRINTER_SN;\n\trequest.generateSign();\n\n\t//*Required*: The content to be printed can’t exceed 12288 bytes.\n\trequest.content=printContent;\n\n\t//The number of printed copies is 1 by default.\n\trequest.copies=1;\n\n //Print mode:\n //If the value is 0 or not specified, it will check whether the printer is online. If not online, it will not generate a print order and directly return the status code of an offline device.\n //If online, it will generate a print order and return the print order number.If the value is 1, it will not check whether the printer is online, directly generate a print order and return the print order number.\n //If the printer is not online, the order will be cached in the print queue and will be printed automatically when the printer is normally online.\n request.mode=0;\n\n let result = await service.xpYunPrint(request);\n\tconsole.log(result.httpStatusCode);\n\tconsole.log(result.content);\n\tconsole.log(result.content.code);\n\tconsole.log(result.content.msg);\n\n //resp.data: Return to order No. correctly \n\tconsole.log(result.content.data);\t\n}", "function onFontChange(){\n changeFontScreen();\n setCurrentFontDisplay();\n}", "function printConsole () {\n\t// Test victoire\n\tconsole.log(\"Gagné : \"+win);\n\t// Affiche cases du J2\n\tvar str = \"\";\n\tfor(var i=0; i<casesJ2.length ; i++) str+= casesJ2[i]+\",\";\n\tconsole.log(\"Joueur 2 : [\"+str+\"]\");\n\t// Affiche cases du J1\n\tstr = \"\";\n\tfor(var i=0; i<casesJ1.length ; i++) str+= casesJ1[i]+\",\";\n\tconsole.log(\"Joueur 1 : [\"+str+\"]\");\n}", "function print(str)\r\n{\r\nCheat.PrintColor( [ 0, 255, 0, 255 ], \"[SoundBase] \" + str + \"\\n\" );\r\nCheat.PrintChat(\"[SoundBase] \" + str + \"\\n\")\r\n}", "function showHelpText() {\n ctx.save();\n\n if (lastUsedInput === 'keyboard') {\n setFont(18);\n ctx.fillStyle = 'white';\n ctx.fillText(translation.spacebar + ' ' + translation.select, 28 - fontMeasurement, kontra.canvas.height - 25 + fontMeasurement / 2.5);\n }\n else if (lastUsedInput === 'gamepad') {\n drawAButton(28, kontra.canvas.height - 25);\n setFont(18);\n ctx.fillStyle = 'white';\n ctx.fillText(translation.select, 28 + fontMeasurement * 1.75, kontra.canvas.height - 25 + fontMeasurement / 2.5);\n }\n\n ctx.restore();\n}", "function herAbout() { //\"Musician\"\n for (var k = 0; k < data.results.length; k++) {\n var showherAbout = data.results[k].about;\n textSize(12);\n fill(255);\n text(showherAbout, random(0, 400), random(0, 400));\n\n }\n}", "set Font(value) {\n this._font = value;\n }", "function gfonts_popup(name) {\n var edit = $(name+'-edit');\n var info = $(name+'-info');\n var popup = $('ja-popup-gfont');\n var position = edit.getPosition();\n var height = edit.offsetHeight;\n var variant = '';\n var subset = '';\n // Set info for popup\n var font = $(name).value; //info.get('text');\n font = font.split('|');\n $('gfont-family').value = font[0];\n // Set font variant\n if (font.length > 3) variant = font[3];\n // Set font subset\n if (font.length > 4) subset = font[4];\n // Set custom style\n if (font.length > 1 && font[1]) {\n $('gfont-custom').checked = true;\n $('gfont-style').setStyle('display', 'block');\n } else {\n $('gfont-custom').checked = false;\n $('gfont-style').setStyle('display', 'none');\n }\n if (font.length > 2) {\n $('gfont-style').value = font[2];\n }\n // Fetch variants and subsets of font family\n gfonts_get_properties(variant, subset);\n // Show popup\n popup.setStyles({\n top: position.y + height,\n left: position.x,\n display: 'block'\n });\n // Defined set gfont function\n popup.setGFont = function(family, variant, subset, custom, style) {\n var data = family + '|' + (custom?'1':'') + '|' + style + '|' + variant + '|' + subset;\n gfonts_setValue(name, data);\n gfonts_replace_link();\n };\n}", "function getFonts(textLayer) {\nvar font_content_detection = false;\n function markReturnedContentText(text) {\n if (font_content_detection) {\n return font_content_detection_symbols[0] + text + font_content_detection_symbols[1] + \"\\r\";\n } else {\n return text;\n }\n }\n if (textLayer.kind == LayerKind.TEXT) {\n app.activeDocument.activeLayer = textLayer;\n var ref = new ActionReference();\n ref.putEnumerated(charIDToTypeID(\"Lyr \"), charIDToTypeID(\"Ordn\"), charIDToTypeID(\"Trgt\"));\n var layerDesc = executeActionGet(ref);\n var textDesc = layerDesc.getObjectValue(stringIDToTypeID('textKey'));\n var rangeList = textDesc.getList(stringIDToTypeID('textStyleRange'));\n var fonts = [];\n for (var m = 0; m < rangeList.count; m++) {\n var styleDesc = rangeList.getObjectValue(m).getObjectValue(stringIDToTypeID('textStyle'));\n var aFrom = rangeList.getObjectValue(m).getInteger(stringIDToTypeID('from'));\n var aTo = rangeList.getObjectValue(m).getInteger(stringIDToTypeID('to'));\n if (m > 0) {\n if (rangeList.getObjectValue(m - 1)\n .getInteger(stringIDToTypeID('from')) == aFrom && rangeList.getObjectValue(m - 1)\n .getInteger(stringIDToTypeID('to')) == aTo) continue;\n }\n var theLetters = app.activeDocument.activeLayer.textItem.contents.substring(aFrom, aTo);\n var aFont = styleDesc.getString(stringIDToTypeID('fontPostScriptName'));\n var aSize = new UnitValue(styleDesc.getUnitDoubleValue(stringIDToTypeID('size')), \"px\");\n //Check if font has been transformed\n if (textDesc.hasKey(stringIDToTypeID('transform'))) {\n var mFactor = textDesc.getObjectValue(stringIDToTypeID('transform')).getUnitDoubleValue (stringIDToTypeID(\"yy\") );\n aSize = Math.round(aSize * mFactor);\n }\n var aColor = getColorFromDescriptor(styleDesc.getObjectValue(charIDToTypeID(\"Clr \")), typeIDToCharID(styleDesc.getClass(charIDToTypeID(\"Clr \"))));\n\n if (styleDesc.hasKey(stringIDToTypeID('leading'))) {\n var aLeading = new UnitValue(styleDesc.getUnitDoubleValue(stringIDToTypeID('leading')), \"px\");\n } else {\n var aLeading = \"\";\n }\n var txt = theLetters;\n var merged = false;\n if (txt.length > 0) {\n for (var x = 0; x < m; x++) {\n try {\n if (fonts[x].font === aFont && fonts[x].size === aSize && fonts[x].color.rgb.hexValue === aColor.rgb.hexValue && fonts[x].leading === aLeading) {\n // It's a hack!!!\n if (fonts[x].text !== txt) {\n fonts[x].text += markReturnedContentText(txt);\n }\n merged = true;\n }\n } catch (e) {}\n }\n if (!merged) {\n fonts.push({\n text: markReturnedContentText(txt),\n font: aFont,\n size: aSize,\n color: aColor,\n leading: aLeading\n });\n }\n }\n };\n return fonts;\n }\n }", "function royalGoogleFontsPreview( db, name, selector ) {\n\n\t\t// get subsets from database\n\t\tvar label \t\t= royal_options.typography.subsets_label,\n\t\t\tlatin \t\t= royal_options.typography.latin_subset,\n\t\t\tcyrillic \t= royal_options.typography.cyrillic_subset,\n\t\t\tgreek \t\t= royal_options.typography.greek_subset,\n\t\t\tvietnamese \t= royal_options.typography.vietnamese_subset;\n\n\t\t// subsets in array\n\t\tvar subsets = [];\n\t\tif ( label === true ) {\n\n\t\t\tif ( latin === true ) {\n\t\t\t\tsubsets.push('latin');\n\t\t\t\tsubsets.push('latin-ext');\n\t\t\t}\n\t\t\tif ( cyrillic === true ) {\n\t\t\t\tsubsets.push('cyrillic');\n\t\t\t\tsubsets.push('cyrillic-ext');\n\t\t\t}\t\n\t\t\tif ( greek === true ) {\n\t\t\t\tsubsets.push('greek');\n\t\t\t\tsubsets.push('greek-ext');\n\t\t\t}\n\t\t\tif ( vietnamese === true ) {\n\t\t\t\tsubsets.push('vietnamese');\n\t\t\t}\n\n\t\t\tsubsets = '&subset='+ subsets.join(',');\n\n\t\t} else {\n\t\t\tsubsets = '';\n\t\t}\n\n\n\t\t// font live preview\n\t\troyalLivePreview( db, name, function( nValue ) {\n\n\t\t\t// get font link and CSS font family value\n\t\t\tvar fontId = nValue.split('+').join('_'),\n\t\t\t\tfontLink = '<link id=\"royal_enqueue_'+ fontId +'-css\" rel=\"stylesheet\" type=\"text/css\" href=\"http://fonts.googleapis.com/css?family='+ nValue +':100,200,300,400,500,600,700,800,900'+ subsets +'\">',\n\t\t\t\tfamilyCSS = nValue.split('+').join(' ');\n\n\t\t\t// load font if it's not already loaded\n\t\t\tif ( $('head').find( '#royal_enqueue_'+ fontId +'-css' ).length === 0 ) {\n\t\t\t\t$('head').append( fontLink );\n\t\t\t}\n\n\t\t\tselector.css( 'font-family', '\"'+ familyCSS +'\", \"sans-serif\"' );\n\n\t\t});\n\n\t}", "function addFontsToIndex(options) {\n return async (host) => {\n const workspace = await (0, workspace_1.getWorkspace)(host);\n const project = (0, schematics_2.getProjectFromWorkspace)(workspace, options.project);\n const projectIndexFiles = (0, schematics_2.getProjectIndexFiles)(project);\n if (!projectIndexFiles.length) {\n throw new schematics_1.SchematicsException('No project index HTML file could be found.');\n }\n const preconnect = `<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\">`;\n const fonts = [\n 'https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap',\n 'https://fonts.googleapis.com/icon?family=Material+Icons',\n ];\n projectIndexFiles.forEach(indexFilePath => {\n (0, schematics_2.appendHtmlElementToHead)(host, indexFilePath, preconnect);\n fonts.forEach(font => {\n (0, schematics_2.appendHtmlElementToHead)(host, indexFilePath, `<link href=\"${font}\" rel=\"stylesheet\">`);\n });\n });\n };\n}", "function gulpFontgen(options) {\n\n if (!options.dest) {\n throw new PluginError(PLUGIN_NAME, \"options.dest is missing\");\n }\n\n // Creating a stream through which each file will pass\n var stream = through.obj(function(file, enc, callback) {\n\n options.source = file.path;\n fontface(options);\n\n this.push(file);\n return callback();\n\n });\n\n return stream;\n}", "function fontManager() {\n function createFont(path, size) {\n var f = new _Font(this.mAtlas, 'fonts/' + path + '.ttf', size);\n f.load('!\"#$%&\\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~');\n return f;\n }\n\n function init() {\n mFontsDB['fat_40'] = this.createFont('fat', 40);\n mFontsDB['fat_20'] = this.createFont('fat', 20);\n }\n\n function findFont(name, size) {\n return mFontsDB[name + '_' + size] || ( mFontsDB[name + '_' + size] = createFont(name, size));\n }\n\n function textNode(font, size, text) {\n var pText = new _Text(_program.textBlack.material(mAtlas), findFont(font, size));\n if (text) {\n pText.setText(text);\n }\n return pText;\n }\n\n return {\n 'createFont': createFont,\n 'init': init,\n 'findFont': findFont,\n 'textNode': textNode\n };\n}", "function help() {\n printLine('The following commands work. Hover them for more information.');\n printLine('' +\n ' <span class=\"yellow\" title=\"Explain the list of commands\">help</span>,' +\n ' <span class=\"yellow\" title=\"Clear the screen for freshness\">clear</span>,' +\n ' <span class=\"yellow\" title=\"List all the files in this directory\">ls</span>,' +\n ' <span class=\"yellow\" title=\"List all links on the website\">tree</span>,' +\n ' <span class=\"yellow\" title=\"Change directory to `dirname`\">cd </span>' +\n '<span class=\"blue\" title=\"Change directory to `dirname`\"><em>dirname</em></span>,' +\n ' <span class=\"yellow\" title=\"Show the contents of `filename`\">cat </span>' +\n '<span class=\"green\" title=\"Show the contents of `filename`\"><em>filename</em></span>'\n );\n printLine('<br>');\n printLine('You can also use the' +\n ' <kbd class=\"cyan\">Up</kbd> and' +\n ' <kbd class=\"cyan\">Down</kbd>' +\n ' keys to navigate through your command history.'\n );\n printLine('You can click on tree nodes if CLI is not your thing.' +\n ' You\\'ll still need to hit <kbd class=\"cyan\">Enter</kbd>.'\n );\n}" ]
[ "0.68187654", "0.638602", "0.5888868", "0.5866639", "0.58145434", "0.5797385", "0.5756701", "0.57539225", "0.5693272", "0.56023425", "0.55444175", "0.54966766", "0.5493995", "0.5487679", "0.54576886", "0.54560536", "0.54505223", "0.5408863", "0.5402523", "0.5392015", "0.5366903", "0.5331516", "0.53297037", "0.53254604", "0.53089166", "0.5305959", "0.5299228", "0.52907526", "0.5290435", "0.5273565", "0.5264789", "0.52556", "0.52432656", "0.5241239", "0.5238926", "0.5235066", "0.5229011", "0.5225144", "0.5221146", "0.52000195", "0.5191249", "0.5186627", "0.51679933", "0.5163053", "0.5162448", "0.51605946", "0.5153394", "0.51480883", "0.51476496", "0.51411575", "0.5137674", "0.51281464", "0.5122455", "0.5114089", "0.5109387", "0.50906646", "0.50734407", "0.5071241", "0.50688726", "0.5068772", "0.50659186", "0.50650555", "0.5059372", "0.5057715", "0.5048495", "0.50473726", "0.50473607", "0.50350285", "0.5033815", "0.50263864", "0.50263864", "0.50243396", "0.5024281", "0.5016093", "0.5011287", "0.5001754", "0.4995756", "0.49861568", "0.49770236", "0.49742925", "0.49723536", "0.49691194", "0.4960428", "0.49546504", "0.49532375", "0.49490166", "0.49454796", "0.49451554", "0.4944411", "0.49440277", "0.49418923", "0.49267602", "0.49206963", "0.49167612", "0.49105456", "0.4907462", "0.49043563", "0.49034393", "0.490332", "0.49008083" ]
0.6774358
1
Function to submit the new comment form
function addComment(event){ event.preventDefault(); let commentData ={ c_content: this.elements['c_content'].value, c_author: Auth.getUser(), c_post: Model.getPost(this.dataset.id) } Model.addComment(commentData); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitComment() {\n var id = \"comment\";\n var commentText = getValueById(id);\n disableFieldById(id);\n var callback = function(response) {\n resetFieldById(id);\n updateComments(response);\n };\n var params = buildCommentParamsForPost(commentText);\n ajaxHandleResponse(\"addComment.php\", callback, \"POST\", params);\n}", "function submitComment(e) {\n e.preventDefault();\n let newCommentData = { text: newComment, userId: user.id, postId: postId }\n console.log(newCommentData);\n\n API.Comment.createComment(newCommentData)\n .then(res => {\n console.log(\"Comment created!\");\n loadPosts()\n })\n .catch(err => console.log(err));\n e.target.reset();\n }", "function handleFormSubmit(event) {\n event.preventDefault();\n // Wont submit the post if we are missing a comment\n if (!comInput.val().trim()) {\n return;\n }\n // Constructing a newCom object to hand to the database\n let newCom = {\n comment: comInput.val().trim(),\n QuoteId: comInput.attr(\"data-id\"),\n };\n\n postComment(newCom);\n }", "function submitComment(evt) {\n evt.preventDefault();\n\n const comment = $('#comment')\n\n $.post('/community', comment, (response) => {\n $('#d-flex flex-column comment-section').append(`${response.global_comment}`);\n } )\n console.log('posted')\n}", "function submitComment(commentControl) {\n // TODO - Call API\n}", "function submitComment() {\r\n submitCmt.click(function () {\r\n $(\".default-cmt__content__cmt-block__cmt-box\").find('.messages').hide();\r\n if (checkGuestFormValidate()) {\r\n var cmtText = cmtBox.val();\r\n if (cmtText.trim().length) {\r\n $('.default-cmt_loading').show();\r\n $(this).prop('disabled', true);\r\n var ajaxRequest = ajaxCommentActions(cmtText, submitCmt);\r\n ajaxRequest.done(function () {\r\n cmtBox.val('');\r\n $('.default-cmt_loading').hide();\r\n $(this).prop('disabled', false);\r\n }.bind(this));\r\n } else {\r\n $('.default-cmt__content__cmt-block__cmt-box__cmt-input').parent().append(messengerBox.cmt_warning);\r\n }\r\n }\r\n });\r\n }", "function submitComment() {\n\t\tcurrent_comment = this;\n\t\tcurrent_textbox = current_comment.parentNode.childNodes[1].value;\n\t\tif (!current_textbox.match(/\\S/)) {\n\t\t\talert(\"Type something in.\");\n\t\t\tevent.preventDefault();\n\t\t} else {\n\t\t\tvar reply_count = current_comment.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[3].childNodes[3]\n\t\t\tvar reply_text = reply_count.textContent.split(' ');\n\t\t\tif (reply_text.length == 2) {\n\t\t\t\tvar reply_text1 = reply_text.shift();\n\t\t\t\treply_text1 = parseInt(reply_text1);\n\t\t\t\treply_text1 = reply_text1 + 1;\n\t\t\t\treply_text1 = reply_text1.toString();\n\t\t\t\treply_text = reply_text1 + \" \" + reply_text;\n\t\t\t\treply_count.textContent = reply_text;\n\t\t\t\tcreateNewComment(current_textbox, current_comment);\n\t\t\t\tcurrent_comment.parentNode.childNodes[1].value = \"\"\n\t\t\t\tevent.preventDefault();\n\t\t\t} else {\n\t\t\t\treply_count.textContent = \"1 replies\";\n\t\t\t\tcreateNewComment(current_textbox, current_comment);\n\t\t\t\tcurrent_comment.parentNode.childNodes[1].value = \"\"\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\t}", "function submitComment(id, form) {\n const commentsValue = {\n name: selector('#userName').value,\n comment: selector('#comments').value,\n };\n comments.push(commentsValue);\n article.comments = comments;\n article.views = views;\n database.ref('/articles/' + id).set(article, (error) => {\n if (error) {\n console.log(error);\n } else {\n form.reset();\n }\n });\n}", "function approvedComment(i) {\n\tdocument.getElementById(\"form-approved-comment-\" + i).submit();\n}", "async function newComment() {\n //if there's another comment form open, close it before continuing\n if (document.querySelector(\"#newCommentForm\") != null)\n cancelNewComment();\n\n //hide this button\n hiddenCommentBtn = this;\n this.style.display = \"none\";\n\n //create the content structure\n const newCommentForm = document.createElement(\"form\");\n newCommentForm.action = \"./postArticle\";\n newCommentForm.method = \"post\";\n newCommentForm.id = \"newCommentForm\";\n this.parentNode.appendChild(newCommentForm);\n\n const parentId = document.createElement(\"input\");\n parentId.type = \"hidden\";\n parentId.name = \"parentId\";\n parentId.value = this.id.replace(\"comment-\", \"\");\n parentId.value = parentId.value.substring(0, parentId.value.indexOf(\"-\"));\n console.log(\"parent: \" + parentId.value);\n newCommentForm.appendChild(parentId);\n const rootArticle = document.createElement(\"input\");\n rootArticle.type = \"hidden\";\n rootArticle.name = \"rootArticle\";\n rootArticle.value = this.id.substring(this.id.indexOf(\"-\") + 1);\n rootArticle.value = rootArticle.value.substring(rootArticle.value.indexOf(\"-\") + 1);\n newCommentForm.appendChild(rootArticle);\n console.log(\"root: \" + rootArticle.value);\n\n const title = document.createElement(\"input\");\n title.name = \"title\";\n parentTitle = document.querySelector(`#title-${parentId.value}`).innerText;\n title.value = `re: ${parentTitle}`;\n newCommentForm.appendChild(title);\n title.required = true;\n const content = document.createElement(\"textarea\");\n content.id = \"newComment\";\n content.name = \"content\";\n newCommentForm.appendChild(content);\n\n const submitButton = document.createElement(\"input\");\n submitButton.type = \"submit\";\n submitButton.name = \"submit\";\n submitButton.id = \"submitButton\";\n submitButton.value = \"Submit\";\n newCommentForm.appendChild(submitButton);\n const cancelButton = document.createElement(\"button\");\n cancelButton.innerText = \"Cancel\";\n cancelButton.name = \"cancel\";\n cancelButton.id = \"cancelButton\";\n newCommentForm.appendChild(cancelButton);\n cancelButton.addEventListener(\"click\", cancelNewComment);\n\n //text editor\n await tinymce.init({\n selector: '#newComment',\n plugins: 'image autoresize',\n image_description: false,\n image_dimensions: false,\n image_uploadtab: true,\n images_upload_url: './articleImage'\n });\n tinymce.activeEditor.focus();\n }", "function submitComment(e) {\n e.preventDefault();\n const postId = parseInt(e.target.getAttribute(\"id\"));\n const commentData = {\n comment: e.target.comments.value,\n };\n\n const options = {\n method: \"PATCH\",\n body: JSON.stringify(commentData),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n };\n\n fetch(`https://bloguefp.herokuapp.com/${postId}`, options)\n .then((r) => r.json())\n .catch(console.warn);\n\n commentsFunction(commentData, e.target);\n e.target.comments.value = \"\";\n}", "function createNewCommentForm() {\n var userSession = RB.UserSession.instance,\n yourcomment_id = \"yourcomment_\" + review_id + \"_\" +\n context_type;\n if (sectionId) {\n yourcomment_id += \"_\" + sectionId;\n }\n\n yourcomment_id += \"-draft\";\n\n var yourcomment = $(\"<li/>\")\n .addClass(\"reply-comment draft editor\")\n .attr(\"id\", yourcomment_id + \"-item\")\n .append($(\"<dl/>\")\n .append($(\"<dt/>\")\n .append($(\"<label/>\")\n .attr(\"for\", yourcomment_id)\n .append($(\"<a/>\")\n .attr(\"href\", userSession.get('userPageURL'))\n .html(userSession.get('fullName'))\n )\n )\n .append('<dd><pre id=\"' + yourcomment_id + '\"/></dd>')\n )\n )\n .appendTo(commentsList);\n\n var yourcommentEl = $(\"#\" + yourcomment_id);\n createCommentEditor(yourcommentEl);\n yourcommentEl\n .inlineEditor(\"startEdit\")\n .on(\"cancel\", function(el, initialValue) {\n if (initialValue == \"\") {\n yourcomment.remove();\n }\n });\n\n addCommentLink.hide();\n }", "function onCommentFormSubmit(e) {\n e.preventDefault();\n // Check that the user entered a message and is signed in.\n if (commentInputElement.value && checkSignedInWithMessage()) {\n saveComment(commentInputElement.value).then(function () {\n // Clear comment text field and re-enable the SEND button.\n resetMaterialTextfield(commentInputElement);\n toggleCommentButton();\n });\n }\n}", "addCommentClick(place, formID, inputClass, inputID, errorMsg, confirmMsg) {\n $('body').on('click', `#addComment${place.id}`, () => {\n this.display.addCommentAnim(place)\n // POST NEW COMMENT\n let formTag = document.getElementById(`${form[1].id}`)\n formTag.addEventListener('submit', evt => {\n evt.preventDefault()\n this.operator.postComment(place, formID, inputClass, inputID, errorMsg, confirmMsg)\n })\n })\n }", "function formHandler(event) {\n\t// prevent page refresh\n\tevent.preventDefault();\n\t// construct a new comment and POST to backend\n\tconst name = event.target.name.value;\n\tconst content = event.target.content.value;\n\tif (name !== \"\" && content !== \"\") {\n\t\tpostComment(event, {\n\t\t\tname: name,\n\t\t\tcomment: content,\n\t\t});\n\t} else {\n\t\talert(\"Please add name and/or comment\");\n\t}\n}", "function postComment() {\n\tvar form = this;\n\t// Comprobación local de campos\n\tfunction checkElements(elem) {\n\t\tvar checkResult=[];\n\t\tfor (var i=0; i<elem.length; i++) {\n\t\t\tvar f = elem[i];\n\t\t\tif (!f.hasAttribute(\"name\")) continue;\n\t\t\tvar fname = f.name, fval=f.value;\n\t\t\tif ((fname==\"c_name\") && (!fval)) checkResult.push(\"no_name\");\n\t\t\telse if (fname==\"c_email\") {\n\t\t\t\tif (!fval) checkResult.push(\"no_email\");\n\t\t\t\telse if (!checkEmail(fval)) checkResult.push(\"nv_email\");\n\t\t\t}\n\t\t\telse if ((fname==\"c_points\") && (!fval) && (!document.getElementById(\"c_replyto\").value)) \n\t\t\t\tcheckResult.push(\"no_points\");\n\t\t\telse if ((fname==\"c_content\") && (!fval)) \n\t\t\t\tcheckResult.push(\"no_content\");\n\t\t\telse if ((fname==\"recaptcha_response_field\") && (!fval)) \n\t\t\t\tcheckResult.push(\"no_captcha\");\n\t\t}\n\t\treturn checkResult;\n\t}\n\t// Limpieza del formulario\n\tfunction clearForm() {\n\t\tvar elements = form.elements;\n\t\tfor (var i=0;i<elements.length;i++) {\n\t\t\tvar e=elements[i];\n\t\t\tif (e.type!=\"submit\") e.value=e.className=\"\";\n\t\t}\n\t\tinitPoints();\n\t\tRecaptcha.reload();\n\t\tvar replyBtn = document.getElementById(\"replyto_cancel\");\n\t\tif (replyBtn && replyBtn.onclick) replyBtn.onclick();\t// para limpiar respuesta a \n\t}\n\t/* Ocultar el resultado de la publicación */\n\tfunction hideResult() {\n\t\tdocument.body.removeChild(document.getElementById(\"result-container\"));\n\t\twindow.onclick = null;\n\t}\n\t/* Mostrar el resultado de la publicación */\n\tfunction showResult(response,local) {\n\t\tconsole.log(response);\n\t\twindow.onclick = hideResult;\n\t\tvar rDiv = document.createElement(\"div\");\n\t\trDiv.id=\"result\";\n\t\tif (response.hasOwnProperty(\"OK\")) {\n\t\t\tclearForm();\t// limpiamos el formulario\n\t\t\trDiv.innerHTML = \"<p>Michas gracias por tu valoración.<br>Tu comentario ha sido publicado y se mostrará en unos instantes.</p><div class='bullets'></div>\";\n\t\t\tvar nBullet=0;\n\t\t\tvar interval = setInterval(function() {\n\t\t\t\tnBullet++;\n\t\t\t\tvar rd = document.getElementById(\"result\");\n\t\t\t\tif (rd) {\n\t\t\t\t\tvar bullet = rd.getElementsByClassName(\"bullets\")[0];\n\t\t\t\t\tbullet.innerHTML+=\"&#8226;\";\n\t\t\t\t\tif (nBullet==40){\n\t\t\t\t\t\tclearInterval(interval);\n\t\t\t\t\t\thideResult();\n\t\t\t\t\t}\n\t\t\t\t} else clearInterval(interval);\n\t\t\t},50);\n\t\t\t// Los nuevos comentarios\n\t\t\tvar newID = response[\"OK\"];\n\t\t\tgetApiData(\"comments\", function(d) {\n\t\t\t\tfillComments(d);\n\t\t\t\tvar newComment = document.getElementById(\"comment-\"+newID);\n\t\t\t\tnewComment.scrollIntoView();\n\t\t\t\tnewComment.className=\"c_comment strong\";\n\t\t\t}, true);\n\t\t} else {\n\t\t\tvar errors=response.ERROR;\n\t\t\trDiv.className = \"e\";\n\t\t\trDiv.innerHTML = \"<p>Se han detectado errores en el formulario:</p>\";\n\t\t\tfor (var i=0;i<errors.length;i++) {\n\t\t\t\tvar e=errors[i],\n\t\t\t\t\tfieldID=POST_ERRORS[e][0],\t// campo del formulario\n\t\t\t\t\temsg=POST_ERRORS[e][1];\t\t// mensaje de error\n\t\t\t\tif (fieldID) {\n\t\t\t\t\tvar field=document.getElementById(fieldID);\n\t\t\t\t\tfield.className = \"error\";\n\t\t\t\t}\n\t\t\t\trDiv.innerHTML+=(\"<div>\"+emsg+\"</div>\");\n\t\t\t}\n\t\t\trDiv.innerHTML+=\"<div class='button'>De acuerdo, me ha quedado claro.</div>\";\n\t\t\t// captcha correcto, no se puede reutilizar\n\t\t\tif ((errors.indexOf(\"bad_captcha\")<0)&&(!local)) Recaptcha.reload();\n\t\t}\n\t\tvar rCont = document.createElement(\"div\");\n\t\trCont.id=\"result-container\";\n\t\tdocument.body.appendChild(rCont);\n\t\trCont.appendChild(rDiv);\n\t}\n\tvar elements = form.elements,\n\t\tsegments = [];\n\t// Primera comprobación local de los campos, para no 'molestar' al servidor\n\tvar check = checkElements(elements);\n\tif (check.length==0) {\t// todo ok \n\t\tfor (var nItem=0; nItem<elements.length; nItem++) {\n\t\t\tfield = elements[nItem];\n\t\t\t if (!field.hasAttribute(\"name\")) continue;\n\t\t\t segments.push(field.name+\"=\"+encodeURIComponent(clearHtmlTags(field.value)));\n\t\t}\n\t\tvar req = new XMLHttpRequest();\n\t\treq.open(\"POST\", document.URL.replace(\"ficha\", \"api/c\"), true);\n\t\treq.setRequestHeader(\"content-type\", \"application/x-www-form-urlencoded; charset=utf-8\");\n\t\treq.onload = function(r) {showResult(JSON.parse(this.responseText),false);}\n\t\treq.send(segments.join(\"&\"));\n\t} else {\n\t\tshowResult({\"ERROR\":check},true);\n\t}\n\treturn false;\n}", "function submitComment() {\n var name = document.getElementById(\"commentName\").value;\n var comment = document.getElementById(\"commentText\").value;\n var d = getDate();\n\n comments.push({\"Name\":name, \"Comment\":comment, \"Date\":d});\n\n setComments();\n displayComments();\n}", "function submitForm14()\n\t {\n\t\t\tvar data = $(\"#com-form\").serialize();\n\n\t\t\t$.ajax({\n\n\t\t\ttype : 'POST',\n\t\t\turl : 'comment_proce.php',\n\t\t\tdata : data,\n\t\t\tbeforeSend: function()\n\t\t\t{\n\t\t\t\t$(\"#error\").fadeOut();\n\t\t\t\t$(\"#btn-reply\").html('<span class=\"glyphicon glyphicon-transfer\"></span> &nbsp; sending ...');\n\t\t\t},\n\t\t\tsuccess : function(response)\n\t\t\t {\n\t\t\t\t\tif(response==\"ok\"){\n\n\t\t\t\t\t\t//$(\"#btn-reply\").html('<img src=\"btn-ajax-loader.gif\" /> &nbsp; Posting .....');\n//\t\t\t\t\t\tsetTimeout(' window.location.href = \"index\"; ',4000);\n window.history.go(0);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\n\t\t\t\t\t\t$(\"#error\").fadeIn(1000, function(){\n\t\t\t\t$(\"#error\").html('<div class=\"alert alert-danger\"> <span class=\"glyphicon glyphicon-info-sign\"></span> &nbsp; '+response+' !</div>');\n\t\t\t\t\t\t\t\t\t\t\t$(\"#btn-reply\").html('<span class=\"glyphicon glyphicon-log-in\"></span> &nbsp; Post');\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t }\n\t\t\t});\n\t\t\t\treturn false;\n\t\t}", "function comment() {\n let newComment = {\n placeId: id,\n comment: $('#commentbox').val()\n }\n\n // Send new comments to server\n fetch(`https://tiny-lasagna-server.herokuapp.com/collections/commentTestCollection/`, {\n method: \"POST\",\n body: JSON.stringify(newComment),\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n }\n })\n .then((results) => {\n return results.json();\n })\n .then((commentResult) => {\n console.log('This is the post result', commentResult)\n location.reload();\n })\n }", "function postComment (){\n\t\t\t\t\t$(\".btn-postcomment\").click(function(){\n\t\t\t\t\tvar index = $(this).data(\"id\");\n\t\t\t\t\tvar comment = $('textarea[data-id=\"comments-' + index + '\"]')\n\t\t\t\t\t\n\t\t\t\t\tvar name = $(\"input[data-id='name-\" + index + \"']\")\n\t\t\t\t\tvar appId = appArray[index].id;\n\t\t\t\t\tvar commentArray = appArray[index].comments + \", \" + comment.val(); \n\t\t\t\t\t\n\n\n\t\t\t\t\tstoreComment(appId, commentArray, name, index);\n\t\t\t\t\tname.val(\" \");\n\t\t\t\t\tcomment.val(\" \");\n\t\t\t\t\tappendComments();\n\n\t\t\t\t\t});\n \t\t\t\t}", "function submitMainComment() {\n\t\tcurrent_comment = this;\n\t\tcurrent_textbox = current_comment.parentNode.childNodes[1].value;\n\t\tif (!current_textbox.match(/\\S/)) {\n\t\t\talert(\"Type something in.\");\n\t\t\tevent.preventDefault();\n\t\t} else {\n\t\t\tvar reply_count = current_comment.parentNode.parentNode.parentNode.parentNode.childNodes[1].childNodes[3];\n\t\t\tvar test = reply_count.textContent.split(' ');\n\t\t\tvar test1 = test.shift();\n\t\t\ttest1 = parseInt(test1);\n\t\t\ttest1 = test1 + 1;\n\t\t\ttest1 = test1.toString();\n\t\t\ttest = test1 + \" \" + test;\n\t\t\treply_count.textContent = test;\n\t\t\tcreateNewMainComment(current_textbox);\n\t\t\tcurrent_comment.parentNode.childNodes[1].value = \"\"\n\t\t\tevent.preventDefault();\n\t\t}\n\t}", "function submitComment(){\n var time = new Date().getTime()\n var newComment = {\n articleId : $(this).attr(\"data-id\"),\n name : $(\"input.comment-name\").val().trim(),\n body : $(\"textarea.comment-body\").val().trim(),\n time : time\n }\n var query = \"api/comments/\" + newComment.articleId;\n $.post(query, newComment, function(){\n }).then(function(){\n loadComments(newComment.articleId);\n }).catch(function(err){\n console.log(err);\n });\n\n}", "function handleCommentFormSubmit(event) {\n event.preventDefault();\n // Don't do anything if the name fields hasn't been filled out\n if (!usernameInput.val().trim().trim() || !commentInput.val().trim().trim()) {\n return;\n }\n\n // Calling the upsertAuthor function and passing in the value of the name input\n upsertComment({\n username: usernameInput\n .val()\n .trim(),\n body: commentInput\n .val()\n .trim(),\n PostId : postId\n });\n }", "function validateNewComment() {\n ambra.formUtil.disableFormFields(_annotationForm);\n var submitMsg = dojo.byId('submitMsg');\n\n if(submitMsg.style.display != 'none') {\n var ani = dojo.fx.wipeOut({ node:submitMsg, duration: 500 });\n dojo.connect(ani, \"onEnd\", function () { startValidateNewComment(); });\n ani.play();\n } else {\n startValidateNewComment();\n }\n}", "function commentSubmit(form)\r\n{\r\n var ratingValue = document.getElementById('commentBoxRating');\r\n var rating = document.getElementsByClassName('rating')[0];\r\n\tvar comment = document.getElementById('commentArea');\r\n\r\n\tif (ratingValue.value == null || comment.value == \"\") {\r\n\t\talert('Rating or comment cannot be empty');\r\n\t\treturn false;\r\n\t}\r\n \r\n rating.value = ratingValue.value;\r\n \r\n // Remove these elements from form so that the data from them won't be sent\r\n form.removeChild(ratingValue);\r\n \r\n return true;\r\n}", "function l() {\n z(\"#comment-form\")\n .find(\"input#submit\")\n .before('<p id=\"ajax-response\"></p>');\n var n = z(\"#comment-form\"),\n a = z(\"#comments-list\"),\n i = n.find(\"#name\"),\n s = n.find(\"#email\"),\n r = n.find(\"#comment\"),\n l = n.find(\"input#submit\"),\n d = z(\"#ajax-response\");\n i.focus(function () {\n d.text(\"\");\n }),\n s.focus(function () {\n d.text(\"\");\n }),\n r.focus(function () {\n d.text(\"\");\n }),\n n.submit(function (e) {\n var t = !0,\n o = /^([\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4})?$/;\n 0 < i.length && i.val().length < 3 && (t = !1),\n 0 < s.length && !o.test(s.val()) && (t = !1),\n 0 < r.length && r.val().length < 3 && (t = !1),\n t\n ? (z.ajax({\n type: n.prop(\"method\"),\n url: n.prop(\"action\"),\n data: n.serialize(),\n success: function (e, t, o) {\n a.html(z(e).find(\"#comments-list\")[0]),\n d.text(langObj.posted_comment),\n l.removeClass(\"disabled\").val(langObj.post_comment);\n },\n error: function (e, t, o) {\n 409 == e.status &&\n (d.text(langObj.duplicate_comment),\n l.removeClass(\"disabled\").val(langObj.post_comment));\n },\n }),\n l.addClass(\"disabled\").val(langObj.posting_comment))\n : d.text(langObj.required_comment),\n e.preventDefault();\n });\n }", "function sendRequest ()\n\t{\n\t\t// Create post comment request queries\n\t\tvar postQueries = queries.concat ([\n\t\t\tbutton.name + '=' + encodeURIComponent (button.value)\n\t\t]);\n\n\t\t// Send request to post a comment\n\t\thashover.ajax ('POST', form.action, postQueries, commentHandler, true);\n\t}", "function setEditCommentOnSubmit()\n {\n //Submit comment edit and refresh page on submit click\n if($('.edit-comment-form').length)\n {\n $('.edit-comment-form').submit(function() {\n $(this).find('.comment-validation').text(\"\");\n if($(this).find('[name=\"commentText\"]').val().length < 10)\n {\n $(this).find('.comment-validation').text(\"Comment length cannot be under 10 characters.\");\n return false;\n }\n else if($(this).find('[name=\"commentText\"]').val().length > 1000)\n {\n $(this).find('.comment-validation').text(\"Comment length cannot exceed 1000 characters.\");\n return false;\n }\n \n var form = $(this);\n var serializedForm = form.serialize() + \"&action=3\";\n request = $.ajax({\n url: \"mediaViewAjax.php\",\n type: \"POST\",\n data: serializedForm\n });\n\n //If submit succeeds, refresh comments\n request.done(function(data, textStatus, jqXHR) {\n if(data === \"success\")\n refreshComments();\n else\n form.find('.comment-validation').text(data);\n });\n\n //Warn user if the submit fails\n request.fail(function(jqXHR, textStatus, errorThrown) {\n form.find('.comment-validation').text(\"Failed to submit comment.\");\n });\n \n return false;\n });\n }\n \n //If someone cancels editing a comment, refresh comments\n if($('.btn-comment-edit-cancel').length)\n {\n $('.btn-comment-edit-cancel').click(function() {\n refreshComments(); \n });\n }\n }", "function updateCommentForm(commentForm, imageId) {\n commentForm.onsubmit = function(e) {\n e.preventDefault();\n document.getElementById('error_box').innerHTML = '';\n //let author = this.querySelector('#comment-author');\n let content = this.querySelector('#comment-content');\n let imageId = document.getElementById('gallery-img').getAttribute('alt');\n //api.addComment(author.value, content.value);\n api.addComment(content.value);\n //author.value = '';\n content.value = '';\n };\n }", "function commentsToPage() {\n $.ajax({\n type: 'POST',\n url: formURL,\n data: {comment: {description: description}},\n success: function(data) {\n console.log(\"Success with data!\", data);\n\n // append new comment to page\n $(\"#comment-display\").append(\n data.description);\n\n // reset form values\n $(\"#description-val\").val(\"\");\n },\n error: function(data) {\n console.log(\"ERROR\");\n }\n }); //closing AJAX\n } //closing function commentsToPage", "function addNewComment() {\r\n const commentForm = document.querySelector('.comments__form')\r\n\r\n commentForm.addEventListener('submit', event => {\r\n event.preventDefault();\r\n axios.post(`https://project-1-api.herokuapp.com/comments${apiKey}`, {\r\n name: event.target['user-name'].value,\r\n comment: event.target['new-comment'].value,\r\n })\r\n .then(() => {\r\n const commentSection = document.querySelector('.comments__old-comments');\r\n\r\n let removeCommentList = document.querySelector('.comments__list');\r\n removeCommentList.remove();\r\n \r\n let createCommentList = document.createElement('ul');\r\n createCommentList.classList.add('comments__list');\r\n \r\n commentSection.appendChild(createCommentList);\r\n displayCommentApi()\r\n event.target['user-name'].value = '';\r\n event.target['new-comment'].value = '';\r\n })\r\n .catch((error) => {\r\n console.error(error);\r\n })\r\n })\r\n}", "function NewComments({currentVideoId, addComment}) {\r\n\r\n const handleSubmit = event => {\r\n event.preventDefault()\r\n\r\n let newComment = {\r\n name: \"Annonymous\",\r\n comment: event.target.commentCopy.value\r\n }\r\n\r\n let type = { 'content-type': 'application/json' }\r\n\r\n axios.post(api_url + `/${currentVideoId}/comments` + my_key, newComment, type)\r\n .then(response => {\r\n\r\n addComment(response.data, currentVideoId) \r\n\r\n }).catch(err => console.log(err));\r\n \r\n\r\n event.target.reset()\r\n \r\n }\r\n\r\n return (\r\n <form className=\"comments__form\" onSubmit={handleSubmit}>\r\n <label className=\"comment-label\">\r\n <h5>Join the conversation</h5>\r\n </label>\r\n <textarea placeholder=\"Add a new comment\" name=\"commentCopy\" required></textarea>\r\n <button className=\"comments__form--button\">Comment</button>\r\n </form>\r\n )\r\n}", "function newCommentListener() {\n newCommentForm.addEventListener('submit', (e) => {\n e.preventDefault();\n let postId = document.getElementById('PI').value\n let content = document.getElementById('content').value\n let post = allPosts[postId]\n createComment(content, postId)\n post.comments.push(new Comment(currentUser.id, content))\n })\n}", "onSubmitButtonClick(eventObject) {\n /* Disable the button on click so the user does not accidentally press it multiple times */\n let submitButton = eventObject.target;\n submitButton.disabled = true;\n let inputField = this.representedHTMLElement.querySelector(\".at_textarea\");\n let thing_id = (this.parentClass instanceof RoKA.CommentThread)\n ? this.parentClass.threadInformation.name : this.parentClass.commentObject.name;\n if (this.edit) {\n /* Send the edit comment request to reddit */\n new RoKA.Reddit.EditCommentRequest(thing_id, inputField.value, function (responseText) {\n this.parentClass.commentObject.body = inputField.value;\n let editedCommentBody = this.parentClass.representedHTMLElement.querySelector(\".at_commentcontent\");\n editedCommentBody.innerHTML = SnuOwnd.getParser().render(inputField.value);\n this.parentClass.representedHTMLElement.classList.add(\"edited\");\n /* The comment box is no longer needed, remove it and clear outselves out of memory */\n this.representedHTMLElement.parentNode.removeChild(this.representedHTMLElement);\n });\n }\n else {\n /* Send the comment to Reddit */\n new RoKA.Reddit.CommentRequest(thing_id, inputField.value, function (responseText) {\n let responseObject = JSON.parse(responseText);\n let comment = new RoKA.Comment(responseObject.json.data.things[0].data, this.commentThread);\n this.parentClass.children.push(comment);\n /* Find the correct insert location and append the new comment to DOM */\n if (this.parentClass instanceof RoKA.CommentThread) {\n this.parentClass.threadContainer.appendChild(comment.representedHTMLElement);\n new CommentField(this.parentClass);\n }\n else {\n this.parentClass.representedHTMLElement.querySelector(\".at_replies\").appendChild(comment.representedHTMLElement);\n }\n this.parentClass.children.push(comment);\n /* Scroll the new comment in to view */\n comment.representedHTMLElement.scrollIntoView(false);\n /* The comment box is no longer needed, remove it and clear outselves out of memory */\n this.representedHTMLElement.parentNode.removeChild(this.representedHTMLElement);\n });\n }\n }", "function form_submit()\n {\n /* Get reply form */\n var form = submit_btn.form;\n\n /* The fields we need when do a post */\n var fields = [\"followup\", \"rootid\", \"subject\", \"upfilerename\",\n \"username\", \"passwd\", \"star\", \"totalusetable\", \"content\",\n \"expression\", \"signflag\"];\n\n /* The fields we need to encode when post */\n var encode_fields = [ \"content\" ];\n\n /* Do ajax post */\n ajax_post(form, fields, encode_fields, {\"onreadystatechange\": post_callback});\n }", "function onsubmitPostComment() {\n // This line adds the name of the user creating the comment to formDataComment.\n formDataComment.name = user.name;\n axios\n .post(\n `${process.env.REACT_APP_API_URL}/api/usercomment/`,\n formDataComment,\n {\n headers: {\n Authorization: `JWT ${localStorage.getItem('access')}`,\n 'Content-Type': 'application/json',\n accept: 'application/json',\n },\n }\n )\n .then(() => {\n exerciseFeedback.length = 0;\n getContent();\n setFormDataComment({\n ...formDataComment,\n comment: '',\n });\n })\n .catch((e) => {\n return e;\n });\n }", "function createCommentForm(imageId) {\n let commentFormSection = document.getElementById('comment-form-section');\n let commentForm = document.createElement('form');\n commentForm.id = 'comment-form';\n commentForm.innerHTML=`\n <div class=\"section-header\">\n <h4>Add a Comment</h4>\n </div>\n <div class=\"line\"></div>\n<!--\n <div>\n <label for=\"comment-author\">Your Name</label>\n <input id=\"comment-author\" type=\"text\" required>\n </div>\n-->\n <div>\n <label for=\"comment-content\">Your Comment</label>\n <textarea rows=\"4\" id=\"comment-content\" required></textarea>\n </div>\n <div>\n <input class=\"btn btn-green\" type=\"submit\" value=\"Post Comment\">\n </div>\n `;\n commentFormSection.innerHTML = '';\n commentFormSection.append(commentForm);\n updateCommentForm(commentForm, imageId);\n }", "function CommentPage({ addacomment }) {\n return (\n <form onSubmit={addacomment}>\n <label>\n <b>comment </b>\n </label>\n <input type=\"text\" placeholder=\"Enter comment\" name=\"comment\" required />\n <button type=\"submit\">submit</button>\n <button type=\"button\">Cancel</button>\n </form>\n );\n}", "function submit_comment() {\r\n\tif (!this.allow_comments) {\r\n\t\treturn this.notfound();\r\n\t}\r\n\r\n\tif (req.data.comment_type == \"OpenID\") {\r\n\t\tvar identity = req.data.openid_identifier;\r\n\t\tvar identity_server;\r\n\t\tvar identity_delegation;\r\n\t\ttry {\r\n\t\t\tvar openid_info = this.get_openid_info(identity);\r\n\t\t\tidentity_server = openid_info.server;\r\n\t\t\tidentity_delegate = openid_info.delegate;\r\n\t\t} catch(e) {\r\n\t\t\tres.redirect(this.getURI(\"?submit_failed=true\"));\r\n\t\t}\r\n\r\n\t\tvar unique_string = session._id + \"-\" + new Date().valueOf();\r\n\t\tvar comment = req.data.comment;\r\n\t\tif (typeof session.data.pending_comments == \"undefined\") {\r\n\t\t\tsession.data.pending_comments = {};\r\n\t\t}\r\n\t\tsession.data.pending_comments[unique_string] = {};\r\n\t\tsession.data.pending_comments[unique_string].identity = identity;\r\n\t\tsession.data.pending_comments[unique_string].identity_server = identity_server;\r\n\t\tsession.data.pending_comments[unique_string].body = comment;\r\n\r\n\t\tif (identity_delegate) {\r\n\t\t\tidentity = identity_delegate;\r\n\t\t}\r\n\t\tapp.log(\"ID/Delegate: \" + identity);\r\n\t\t\r\n\t\tres.redirect(identity_server + \"?openid.mode=checkid_setup&openid.identity=\" + escape(identity) + \"&openid.return_to=\" + escape(\"http://\" + req.data.http_host + this.getURI(\"submit_comment?comment_id=\" + unique_string)));\r\n\t}\r\n\r\n\tif (req.data[\"openid.mode\"] == \"id_res\") {\r\n\t\tapp.log(req.data.toSource());\r\n\t\tvar server = session.data.pending_comments[req.data.comment_id].identity_server;\r\n\t\tvar identity = session.data.pending_comments[req.data.comment_id].identity;\r\n\t\tvar body = session.data.pending_comments[req.data.comment_id].body;\r\n\r\n\t\tvar signed_params = req.data[\"openid.signed\"].split(\",\");\r\n\t\tvar params = {};\r\n\t\tfor (var i = 0; i < signed_params.length; i++) {\r\n\t\t\tvar current_param = signed_params[i];\r\n\t\t\tparams[\"openid.\" + current_param] = req.data[\"openid.\" + current_param];\r\n\t\t}\r\n\t\tparams[\"openid.mode\"] = \"check_authentication\";\r\n\t\tparams[\"openid.signed\"] = req.data[\"openid.signed\"];\r\n\t\tparams[\"openid.assoc_handle\"] = req.data[\"openid.assoc_handle\"];\r\n\t\tparams[\"openid.sig\"] = req.data[\"openid.sig\"];\r\n\r\n\r\n\t\t// Curl Command for verification\r\n\t\tvar postbody = [];\r\n\t\tfor (var p in params) {\r\n\t\t\tpostbody.push(p + \"=\" + escape(params[p]));\r\n\t\t}\r\n\t\tapp.log(\"curl -d \\\"\" + postbody.join(\"&\") + \"\\\" \"+server);\r\n\t\t// End\r\n\r\n\r\n\t\ttry {\r\n\t\t\tvar client = new org.apache.commons.httpclient.HttpClient();\r\n\t\t\tvar method = new org.apache.commons.httpclient.methods.PostMethod(server);\r\n\t\t\tfor (var j in params) {\r\n\t\t\t\tmethod.addParameter(j, params[j]);\r\n\t\t\t}\r\n\t\t\tvar statusCode = client.executeMethod(method);\r\n\t\t\tvar result = \"\";\r\n\t\t\tif (statusCode != -1) {\r\n\t\t\t\tresult = method.getResponseBodyAsString();\r\n\t\t\t}\r\n\t\t\tmethod.releaseConnection();\r\n\t\t} catch (e) {\r\n\t\t\tapp.log(\"Error Posting Verification: \" + e.message);\r\n\t\t\tres.redirect(this.getURI(\"?submit_failed=true\"));\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (result.match(/is_valid:true/g)) { \r\n\t\t\tvar whitelisted = get_home_page().openid_whitelist.contains(identity);\r\n\t\t\tvar data = {};\r\n\t\t\tdata.name = null;\r\n\t\t\tdata.email = null;\r\n\t\t\tdata.openid_identifier = identity;\r\n\t\t\tdata.comment_type = \"OpenID\";\r\n\t\t\tdata.body = new XMLList(body.replace(/\\&(?!amp;)/g, \"&amp;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\").replace(/\\n/g,\"<br/>\"));\r\n\t\t\tdata.approved = whitelisted;\r\n\t\t\tthis.add_comment(data);\r\n\t\t\tdelete session.data.pending_comments[req.data.comment_id];\r\n\r\n\t\t\tif (check_setting('comment_notifications',true)) {\r\n\t\t\t\tvar mailer = new Mail();\r\n\t\t\t\tvar admin = app.getObjects(\"User\",{username:\"admin\"})[0];\r\n\t\t\t\tvar hp = get_home_page();\r\n\t\t\t\tmailer.setFrom(admin.email, admin.fullname);\r\n\t\t\t\tvar author = this.author.getTarget();\r\n\t\t\t\tmailer.setSubject(\"Axiom Blog - Comment Notification\");\r\n\t\t\t\tmailer.setTo(author.email);\r\n\t\t\t\tmailer.addText(author.fullname+\",\\n\\nYour Post, \\\"\" + this.title + \"\\\" has received a new comment.\\n\\nPlease visit http://\"+req.data.http_host+hp.getURI('manage_postings')+\" to Manage Posts.\");\r\n\t\t\t\tmailer.send();\r\n\t\t\t}\r\n\r\n\t\t\tif (whitelisted) {\r\n\t\t\t\tres.redirect(this.getURI(\"?submitted_whitelist=true\"));\r\n\t\t\t} else {\r\n\t\t\t\tres.redirect(this.getURI(\"?submitted=true\"));\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t} else {\r\n\t\t\tres.redirect(this.getURI(\"?submit_failed=true\"));\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\tif (req.data.comment_type == \"Anonymous\") {\r\n\t\tvar data = {};\r\n\t\tdata.name = req.data.name;\r\n\t\tdata.email = req.data.email;\r\n\t\tdata.openid_identifier = null;\r\n\t\tdata.comment_type = req.data.comment_type;\r\n\t\tdata.body = new XMLList(req.data.comment.replace(/\\&(?!amp;)/g, \"&amp;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\").replace(/\\n/g,\"<br/>\"));\r\n\t\tdata.approved = false;\r\n\t\tthis.add_comment(data);\r\n\r\n\t\tif (check_setting('comment_notifications',true)) {\r\n\t\t\tvar mailer = new Mail();\r\n\t\t\tvar admin = app.getObjects(\"User\",{username:\"admin\"})[0];\r\n\t\t\tvar hp = get_home_page();\r\n\t\t\tmailer.setFrom(admin.email, admin.fullname);\r\n\t\t\tvar author = this.author.getTarget();\r\n\t\t\tmailer.setSubject(\"Axiom Blog - Comment Notification\");\r\n\t\t\tmailer.setTo(author.email);\r\n\t\t\tmailer.addText(author.fullname+\",\\n\\nYour Post, \\\"\" + this.title + \"\\\" has received a new comment.\\n\\nPlease visit http://\"+req.data.http_host+hp.getURI('manage_postings')+\" to Manage Posts.\");\r\n\t\t\tmailer.send();\r\n\t\t}\r\n\t\tres.redirect(this.getURI(\"?submitted=true\"));\r\n\t}\r\n\r\n}", "function commentSubmitEnter() {\n $('#cambox-chat-form textarea').keypress(function(e){\n if ( e.which == 13 ) {\n $('#cambox-chat-form').submit();\n e.preventDefault();\n }\n });\n}", "function postComment() {\n\tcomment_field = document.getElementById('inputText');\n\tif(comment_field.value != \"\") {\n\t\tjson_array[index].activity_comments++;\n\t\tdisplayData();\n\t}\n}", "function insertCommentForm(pinId, cmntT, cmntId){\n\tvar html = \"\"\n\thtml += '<form action=\"\" enctype=\"multipart/form-data\" method=\"post\" name=\"pin-cmnt-form\" class=\"pin-cmnt-form form\">';\n\t\thtml += '<div id=\"div_comment\" class=\"\">'\n\t\t\thtml += '<label id=\"comment_label\" class=\"control-label\" for=\"comment\"></label>'\n\t\t\thtml += '<span class=\"help-inline control-label\"></span>'\n\t\t\thtml += '<div class=\"controls\">'\n\t\t\t\tconsole.log(cmntId)\n\t\t\t\tif (cmntId){html += '<input type=\"hidden\" name=\"id\" id=\"id_id\" value='+cmntId+'>'}\n\t\t\t\thtml += '<textarea id=\"id_comment\" placeholder=\"Enter your comment here.\" name=\"comment\">'\n\t\t\t\tif(cmntT){html += cmntT}\n\t\t\t\thtml +='</textarea>'\n\t\t\t\t//html += '<input type=\"hidden\" name=\"object_pk\" value='+pinId+' id=\"id_object_pk\">'\n\t\t\t\t//html += '<input type=\"hidden\" name=\"content_type_id\" value=\"10\" id=\"id_content_type_id\">'\n\t\t\t\t//html += '<input type=\"hidden\" name=\"content_type\" value=\"/api/v1/contrib/contenttype/10/\" id=\"id_content_type\">'\n\t\t\t\thtml += '<input type=\"hidden\" name=\"content_object\" value=\"/api/v1/pin/'+pinId+'/\" id=\"id_content_object\">'\n\t\t\t\thtml += '<input type=\"hidden\" name=\"site_id\" value=1 id=\"id_site_id\">'\n\t\t\thtml += '</div>'\n\t\t\thtml += '<button href=\"\" class=\"cancel btn btn-mini\">Cancel</button>'\n\t\t\thtml += '<button type=\"submit\" class=\"btn btn-mini btn-primary\">Post</button>'\n\t\thtml += '</div>'\n\thtml += '</form>';\n\treturn html;\n}", "handleSubmit(event){\n //Prevent page reload\n event.preventDefault();\n\n //Create a new comment from the form\n //Post ID and user ID are automatically filled in\n const new_comment = {\n comment_content: this.refs.comment_content.value.replace(/'/g, \"\"),\n image: this.refs.image.value.replace(/'/g, \"\"),\n user_id: this.props.loggedUser.id,\n post_id: this.props.post.id\n }\n\n //If this is a comment EDIT then add the passed in comment ID\n //And execute the PUT function for comments\n if(this.props.comment){\n new_comment[\"id\"] = this.props.comment.id;\n this.props.closeComments();\n this.props.functionExecute2(new_comment);\n } else {\n //If this is a new comment\n //Execute the POST function for comments\n this.props.closeComments();\n this.props.functionExecute(new_comment);\n }\n }", "function onClickSubmit() {\n // Grab comment\n console.log(document.getElementById(\"comment_box\").value);\n var feedback = document.getElementById(\"feedback\");\n checkSelection();\n if (!noStoreSelected) {\n checkRating();\n }\n // Add or modify a review if selections are valid\n if (!noStoreSelected && !noRating) {\n addReview(store);\n // Display success message and direct users back to the main page\n document.getElementById(\"feedback\").innerHTML = \"Thanks for your feedback!\";\n $(feedback).css({\n color: \"green\"\n });\n $(feedback).show(0);\n $(feedback).fadeOut(2500);\n setTimeout(function () {\n location.href = \"/web/member/main.html\"\n }, 2300);\n }\n}", "function handlerSubmit(e) {\n e.preventDefault();\n if (!comment || !rating) {\n dispatch(\n showMessageWithTimeout(\"danger\", true, \"Please fill out all the fields\")\n );\n } else if (token === null) {\n dispatch(\n showMessageWithTimeout(\n \"danger\",\n true,\n \"You need to log in to leave a comment\"\n )\n );\n } else if (user.isCandidate) {\n dispatch(\n showMessageWithTimeout(\n \"danger\",\n true,\n \"You can leave a review only if you are register as owner\"\n )\n );\n } else {\n dispatch(addReview(rating, comment, profile.id));\n }\n setRating(0);\n setComment(\"\");\n }", "function createComment(ev) {\n\t\tev.preventDefault();\n\t\tlet contentInput = $('#cmtContent');\n\t\tlet courseId = $(this).attr('data-id');\n\t\tlet username = sessionStorage.getItem('username');\n\t\tlet content = contentInput.val();\n\n\t\tcommentsService.createComment(username, content, courseId)\n\t\t\t.then(() => {\n\t\t\t\tshowInfo('Comment created.');\n\t\t\t\tloadCourseDetails(courseId);\n\t\t\t\tcontentInput.val('');\n\t\t\t}).catch(handleError);\n\t}", "async handleSubmit(event) {\n event.preventDefault();\n // get currently logged in user\n const author = await Auth.currentUserInfo();\n if (!author) {\n alert('Please log in to comment.');\n return;\n }\n const { handleComment } = this.props;\n const { content } = this.state;\n // pass user details and content to callback\n handleComment(author.attributes.sub, author.username, content);\n }", "function insert_marks_and_comment(form_name){\n\t\t$(form_name).submit(function(evt){\n\t\t\tevt.preventDefault();\n\t\t\tvar clientIp = $('.check-client-ip').attr('attr');\n\t\t\t//alert(clientIp);\n\t\t\t\n\t\t\t\tvar commentContent = tinyMCE.get('comment_article').getContent();\n\t\t\t\t//alert(commentContent);\n\t\t\t\tvar postData = $(this).serialize() + commentContent;\n\t\t\t\tvar url = $(this).attr('action');\n\t\t\t\t$.post(url, postData, function(php_table_data){\n\t\t\t\t\t$(form_name)[0].reset();\n\t\t\t\t\talert('Hvala Vam na glasanju.');\n\t\t\t\t\tlocation.reload();\n\t\t\t\t\tconsole.log(postData);\n\t\t\t\t});\n\t\t\t\n\t\t});\t\n\t}", "function plusOne()\n{\n // Could be on one of the non-comment tabs, so get on to the first tab first\n $('.js-pull-request-tab')[0].click();\n // Populate the comment\n $('textarea').val(':+1:');\n // Submit the form\n $('.js-new-comment-form').submit();\n}", "handleSubmit(event) {\n let post = this.props.data\n\n fetch('/api/submitComment', {\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n pid: post._id,\n c_id: post.comments.length+1,\n user: this.props.user,\n content: this.state.value,\n })\n }).then(\n window.location.reload()\n )\n \n\n event.preventDefault()\n }", "function createComment(taskId, comment) {\n\n var createCommentUrl = baseUrl + '/api/call.php?createComment=true';\n $.ajax({\n url: createCommentUrl,\n type: 'POST',\n data: {taskId: taskId, comment: comment},\n success: function (data) {\n location.reload();\n },\n error: function () {\n }\n });\n}", "function addComment(form) {\r\n var dorm; // select control for dorm\r\n var newComment; // textarea for the new comment\r\n var allComments; // textarea for combined comments\r\n var addedVerbiage; // text to add to blog\r\n\r\n dorm = form.elements[\"dorm\"];\r\n newComment = form.elements[\"newComment\"];\r\n allComments = form.elements[\"allComments\"];\r\n\r\n if (!form.checkValidity()) {\r\n document.getElementById(\"error\").style.display = \"block\";\r\n }\r\n else {\r\n document.getElementById(\"error\").style.display = \"none\";\r\n if (allComments.value == \"\") {\r\n addedVerbiage = dorm.value + \":\\n\" + newComment.value;\r\n }\r\n else {\r\n addedVerbiage = dorm.value + \":\\n\" + newComment.value + \"\\n\\n\";\r\n }\r\n allComments.value = addedVerbiage + allComments.value;\r\n dorm.selectedIndex = 0;\r\n newComment.value = \"\";\r\n } // end else\r\n} // end addComment", "handleCommentSubmit() {\n // Check if user is logged in before comment submit\n if (this.props.loginStatus) {\n var date = new Date();\n date = (date.getMonth() + 1) + \"/\" + date.getDate() + \"/\" + date.getFullYear() + \" @ \" + date.getHours() + \":\" + date.getMinutes() + \":\" + date.getSeconds();\n\n API.newComment({\n post: this.state.postId,\n user: this.state.userId,\n text: this.state.text,\n date: date\n }).then((response) => {\n //when we are done submitting the new comment then tell the parent (PostPage)\n this.props.updateCommentingStatus(false);\n });\n\n }\n }", "function addComment() {\n\n var xmlhttp = new XMLHttpRequest();\n xmlhttp.onreadystatechange = function () {\n if (xmlhttp.readyState == 4) {\n collectComments();\n }\n };\n\n // get value from the form\n var name = document.getElementById(\"name\").value;\n var comment = document.getElementById(\"comment\").value;\n\n // blank out the form\n document.getElementById(\"name\").value = '';\n document.getElementById(\"comment\").value = '';\n\n // make and send the request\n var params = \"requestType=collectComments&name=\" + name + \"&comment=\" + comment;\n xmlhttp.open(\"POST\", \"cgi-bin/image_interface.cgi\", true);\n xmlhttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n xmlhttp.send(params);\n\n // Note that this function creates a POST request. This behaves the same as a GET request except the parameter do not\n // appear in the url. Instead, we send the parameters inside the send function. This is processed in python in\n // the same way as a GET request. We have a need for POST requests since the inputs can now contain spaces which\n // are not allowed inside a url.\n\n //getElementById(elementId)\n}", "_handleOnSubmit(event) {\n const { id } = this.props.post\n const { author, comment } = this.state.form\n\n event.preventDefault()\n this.props.newComment(comment, author, id)\n\n this.setState({\n form: {\n author: '',\n comment: '',\n },\n })\n }", "function reply() {\n var commentlink = $(this).closest(\".comments\").next();\n var commentlinkId = commentlink.attr(\"id\");\n var clone = $(\"#clone-of-\" + commentlinkId);\n var username = goodify($(this).prev().text().replace(/♦/, \"\")).substr(0,3).toLowerCase();\n clone.hide();\n commentlink.click();\n var formid = commentlinkId.replace(/^.*-(\\d+)$/, \"add-comment-$1\");\n var ta = $(\"#\" + formid + \" textarea\")[0];\n var start = ta.selectionStart;\n var end = ta.selectionEnd;\n var shift = username.length + 3;\n ta.value = \"@\" + username + \" \" + ta.value;\n ta.focus();\n ta.selectionStart = start + shift;\n ta.selectionEnd = end + shift;\n }", "function CreateSubCommentForm(props) {\n //state to store message of the comment\n const [message, setMessage] = useState('');\n const [name, setName] = useState('');\n\n function handleSubmit(e, comment_message, comment_name) {\n e.preventDefault();\n // start\n if (comment_name === '' || comment_message === '') {\n console.log(\"User attempted to comment an empty comment...\");\n return false;\n } else {\n console.log(\"Comment is valid...\");\n }\n props.createComment(comment_name, comment_message);\n let data = {\n comment_name: comment_name,\n comment_message : comment_message,\n post_id : props.post_id\n };\n console.log(data);\n fetch(`${BACKEND_PORT}/forum_comments/`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(data)\n });\n // end\n props.hide();\n setMessage('');\n }\n\n return (\n <form>\n <input\n value={name}\n onChange={e => setName(e.target.value)}\n placeholder=\"Commenter Name\"\n name=\"thread_name\"\n />\n <input\n value={message}\n onChange={e => setMessage(e.target.value)}\n placeholder=\"Comment Message\"\n name=\"thread_message\"\n />\n <button\n type=\"submit\"\n //className=\"*need comment-button class*\"\n onClick={(e) => handleSubmit(e, message, name)}\n >\n Comment\n </button>\n <button\n type=\"submit\"\n onClick={() => props.hide()}\n >\n Cancel\n </button>\n </form>\n );\n }", "function postComment() {\n let resource;\n let params;\n let data;\n let session_key,username,park_id,c_comment,c_date;\n \n username = document.getElementById(\"greeting-name\").innerHTML;\n \n if ( username === \"Guest\" ) {\n return; //user not logged in\n } else { //user is logged in\n \n c_comment = document.getElementById(\"comment-ta\").value;\n if ( !c_comment ) {\n alert(\"Please enter some text.\");\n return; //no text entered for comment\n }\n \n session_key = localStorage.getItem(\"session_key\");\n park_id = document.getElementsByTagName(\"body\")[0].id;\n park_id = park_id.substring(8, park_id.length);\n c_date = getDateWithUTCFormatting( new Date() );\n \n params = { \"session_key\":session_key, \"username\":username, \"park_id\":park_id, \"c_date\":c_date, \"c_comment\":c_comment };\n data = JSON.stringify(params);\n resource = \"/comments\";\n xhttp.open('POST', endPointRoot+resource, true);\n xhttp.setRequestHeader(\"Content-Type\", \"application/json\");\n xhttp.send(data);\n xhttp.onreadystatechange = function () {\n if ( this.readyState == 4 ) {\n if ( this.status == 201 ) { \n \n //n is current comment number\n let n = document.getElementsByClassName(\"user-says\");\n n = n.length + 1;\n \n //new comment div for new comment\n duplicateCommentDiv(n);\n document.getElementById(\"comment-user_\"+n).innerHTML = username;\n document.getElementById(\"comment-time_\"+n).innerHTML = c_date;\n document.getElementById(\"comment-body_\"+n).innerHTML = c_comment;\n moveCommentBoxToBottomOfPage();\n document.getElementById(\"comment-ta\").value = \"\";\n \n hideUsersEditAndDoneEditButtons(false);\n } else {\n alert( this.responseText );\n }\n }\n }\n }\n}", "static submitComment(req) {\n return new Promise((resolve, reject) => {\n models.comment.create({\n commentedby: req.commentedby,\n commentcontent: req.commentcontent,\n postid: req.postid,\n commentedon: new Date()\n })\n .then(newPost => {\n resolve(newPost);\n }, (error) => {\n reject(error);\n });\n });\n }", "handleSubmit(e) {\n e.preventDefault();\n let temp = Object.assign({});\n temp[\"comment\"] = this.cmt.value;\n temp[\"version\"] = 1;\n e.target.reset();\n let that = this;\n api.sendComment(id, temp, function (err, result) {\n if (err) {\n Notification(\"error\", \"Error\", err.data === undefined ? err : err.data._error_message)\n } else {\n that.props.total_comment(result.total_comments)\n api.getComment(id, (err, result) => {\n if (err) {\n Notification(\"error\", \"Error\", err.data === undefined ? err : err.data._error_message)\n } else {\n that.setState({ dataComment: result });\n }\n })\n }\n });\n }", "function handleFormSubmit() {\r\n\tif(window.event) window.event.preventDefault(); \r\n\tvar inputUsername = document.getElementById(\"input-username\").value;\r\n\tvar inputCaption = document.getElementById(\"input-caption\").value;\r\n\tvar inputPicture = document.getElementById(\"input-picture\").value;\r\n addNewPost(inputUsername, fileLocations[inputPicture], inputCaption);\r\n}", "function SubmitNewQuestion(textarea, nid, level, container){\n\n\tvar content = textarea.value;\n\tdid++;\n\n\t$.ajax({\n\t\tasync: true, \n\t\ttype: 'POST', \n\t\turl: \"../API/Discussion/discussion.php\",\n\t\tdata: {action: \"save\", nid: nid, level: level, content: content, classOrConcept: classOrConcept}, \n\t\tsuccess: function(result){\n\t\t\ttextarea.value = \"\";\n\t\t\tAddTextContainer(content, container, did, myname);\n\t\t}\n\t}); \n\n\treturn false;\n}", "async handleSubmit(evt) {\n evt.preventDefault();\n\n if (this.props.formType === \"Edit\") {\n this.props.updatePost({...this.state, \n comments: this.props.post.comments });\n } else {\n const { title, description, body } = this.state;\n await this.props.sendPostToAPI({ title, description, body });\n\n this.props.history.push('/');\n }\n }", "function addComment(){\n let messages = $('#courseName')[0].innerText.split('-')\n if (!$('#inputContent')[0].value){\n return alert(\"Please type in some comment.\")\n }\n requestModels.leaveComment({\n \"code\":messages[0],\n \"section\":messages[1],\n \"semester\":messages[2].split(\":\")[0],\n \"comment\": $('#inputContent')[0].value,\n \"rate\": currentScore\n }, updateCommentView)\n}", "function handleSubmit(e) {\n // function to create a new contact and then close the model\n e.preventDefault();\n createContact(idRef.current.value,nameRef.current.value);\n closeModal();\n\n // create contact\n }", "async function commentPlacement(event) {\n event.preventDefault();\n\n const commentText = document.querySelector('input[name=\"commentPlace\"]').value.trim();\n\n const postID = window.location.toString().split('/')[\n window.location.toString().split('/').length - 1\n ];\n\n if (comment_text) {\n const response = await fetch('/api/comments', {\n method: 'POST',\n body: JSON.stringify({\n post_id,\n comment_text\n }),\n headers: {\n 'Content-Type': 'application/json'\n }\n });\n\n if (response.ok) {\n document.location.reload();\n\n } else {\n alert(response.statusText);\n document.querySelector('#commentFormes').style.display = \"block\";\n }\n }\n}", "function postComment(){\n\tvar textArea = document.getElementById('commentBox')\n\tvar text = textArea.value.trim()\n\tvar xmlDoc = document.implementation.createDocument(null, null, null);\n\tvar xml = xmlDoc.createElement('comment');\n\tif(text == \"\")\n\t\treturn;\n//\t\txml.appendChild( xmlDoc.createTextNode( \" \") );\n\tvar reg = /</\n\tvar match = text.search(reg)\n\tif(text.search(/</) != -1 || text.search(/>/) != -1){\n\t\ttext = text.replace(/</g, \"&lt\")\n\t\ttext = text.replace(/>/g, \"&gt\")\n\t}\n\txml.appendChild( xmlDoc.createTextNode( text) );\n\txmlDoc.appendChild( xml );\n\t\n\tvar req = new XMLHttpRequest();\n\tvar url = 'servlet/addChild/comments/' + imgSrc;\n\treq.open(\"POST\", url, true);\n\t\treq.onreadystatechange = function() {\n\t\tif ( req.readyState == 4) {\n\t\t\tvar div = document.getElementById('comment-field');\n\t\t\tvar comment = req.responseText.trim();\n\t\t\tgetComments()\n\t\t\ttextArea.value = \"\"\n\t\t\t}\t\n\t\t\t\n\t\t}\n\treq.send(xmlDoc);\n\ttext.value = '';\n}", "function handleFormSubmit(event) {\n event.preventDefault();\n // Wont submit the post if we are missing a body, title, or author\n if (!nameInput.val().trim() || !emailInput.val().trim()) {\n return;\n }\n // Constructing a newPost object to hand to the database\n var newPost = {\n email: emailInput\n .val()\n .trim(),\n name: nameInput\n .val()\n .trim(),\n //AuthorId: authorSelect.val()\n };\nconsole.log('4');\n // If we're updating a post run updatePost to update a post\n // Otherwise run submitPost to create a whole new post\n if (updating) {\n newCustomer.id = customerId;\n updateCustomer(newCustomer);\n }\n else {\n submitCustomer(newCustomer);\n }\n }", "async function _saveNewComment() {\n document.getElementById('saveButton').disabled = true;\n \n page.notice.setNotice('saving comment...', true);\n\n var postParams = {\n sourcefileid: settings.spreadsheetid,\n tags: document.getElementById('tagInput').value,\n comment: document.getElementById('commentInput').value,\n hovertext: document.getElementById('hovertextInput').value\n }\n\n var requestResult = await googleSheetWebAPI.webAppPost(apiInfo, 'newcomment', postParams, page.notice);\n if (requestResult.success) {\n page.notice.setNotice('copy succeeded', false);\n }\n\n document.getElementById('saveButton').disabled = false;\n }", "function insertComm() {\n var us = document.getElementById(\"user\");\n var co = document.getElementById(\"comment\");\n var pt = document.getElementById(\"pto\");\n var id = document.getElementById(\"featureid\");\n var xmlhttp = new XMLHttpRequest();\n //Make the post to the batabse\n xmlhttp.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n //Update the map with the new point\n comments.getSource().updateParams({\"time\": Date.now()});\n //And delete the feature with the form.\n DeleteFeature(id.value);\n }\n };\n xmlhttp.open(\"POST\", \"insertComment.php?u=\"+us.value+\"&c=\"+co.value+\"&p=\"+pt.value, true);\n xmlhttp.send();\n}", "function addCommentClick(event){\n\n event.stopPropagation();\n \n //get user inputs\n var comTitle = $('input[name=\"commTitle\"]').val().trim();\n var comContent = $('textarea[name=\"commContent\"]').val().trim();\n\tvar articleId = $('article[data-value]').attr('data-value');\n\tvar errorComment = $('#error-comment');\n\t\n\t//Check user logged in\n\tif(user.isLogged === false){\n setError(errorComment,\"*You must be logged in to post comments!\");\n return;\n }else{\n \n //validate user inputs\n if(comTitle.length === 0 || comContent.length === 0){\n setError(errorComment,\"*Please fill in both Title and Content for your comment!\");\n return;\n }else{\n resetError(errorComment);\n }\n }\n \n //Create comment if associated article id is known\n\tif(articleId){\n\n\t var comm = {\n\t title: comTitle,\n\t content: comContent,\n\t article_id: articleId,\n\t user_id:user.loggedUserId,\n\t };\n\t \n\t var comment = new Comments();\n\t comment.add(comm).done(commentsOperation);\n\t}\n\telse{\n\t popUp(\"error\",\"Saving comment not possible. Failed to get target article ID!\");\n\t}\n\t\n}//END saveCommentClick", "submitComment(){\n var formData = new FormData();\n formData.append(\"admin_email\", this.props.user.email);\n formData.append(\"content\", this.props.comment_html);\n //set loading to true, set it to false after response is complete\n this.props.setCommentSaveLoading(true);\n fetch('http://helpdesk.dev/api/tickets/'+this.props.ticket_id+'/comment', {\n method: 'POST',\n headers: {\n 'Accept': 'application/json'\n },\n body: formData\n }).then(response=>response.json())\n .then(responseJson=>{\n console.log(responseJson);\n this.props.setCommentSaveLoading(false);\n this.props.requestCommentError(false);\n if(responseJson.status === 'OK'){\n this.props.setEditorState(EditorState.createEmpty()); //clear the editor\n this.props.pushComment(responseJson.body.comment); //push the newly created comment to the array for displaying purposes\n }else{\n //input is invalid\n this.props.requestCommentError();\n }\n }).catch(err=>{\n //handle error\n this.props.setCommentSaveLoading(false);\n console.log(err)\n this.props.requestCommentError();\n }) \n }", "submitForm(e) {\n e.preventDefault();\n window.M.updateTextFields();\n let data = Util.getDataElementsForm(e.target, false);\n\n MakeRequest({\n method: 'post',\n url: 'actividad/post',\n data : data\n }).then(response => {\n if (response.error) {\n return Util.getMsnDialog('danger', Util.getModelErrorMessages(response.message));\n }\n\n this.getActivitiesByCategory();\n return Util.getMsnDialog('success', 'Created');\n });\n }", "function submit(){\n\tvar codeSnippet = {\n\n\t\ttitle:$(\"#title\").val(),\n\t\tcode:$(\"#code\").val(),\n\t\ttagIt:$(\"#tagIt\").val(),\n\t\tcomments: $(\"#comments\").val()\n\n\n\t}; \n\n\t// this line clears out the form \n \t$('#title, #code, #tagIt , #comments').val('');\n\n \t// add to firebase repository \n\tobjectsInFirebase.push(codeSnippet);\n\n\n}", "async function submitNewStory(e) {\n console.debug(\"submitNewStory\");\n e.preventDefault();\n\n // collect all info from form\n const author = $(\"#author\").val();\n const title = $(\"#title\").val();\n const url = $(\"#url\").val();\n const username = currentUser.username;\n const storyData = { title, url, author, username };\n\n const story = await storyList.addStory(currentUser, storyData);\n\n const $story = generateStoryMarkup(story);\n $allStoriesList.prepend($story);\n\n // hide the form and reset\n $submitForm.slideUp(\"slow\");\n $submitForm.trigger(\"reset\");\n}", "onCommentSubmited(){\n this.refs.commentSection.onSuccesComment()\n this.props.dispatch(addNewComment(this.props.comment.comment))\n }", "function approvedPost() {\n\tdocument.getElementById(\"form-approved-post\").submit();\n}", "submit(values) { \n // if comments already exist for this blog then add new comment \n if (this.props.blog && this.props.blog.toolId) { \n const comments = \n this.formatComments( this.props.currentUser.username, values.content , values.rating); \n return this.props.dispatch(updateBlog( this.props.blog.id, comments)) \n }\n // if this is first blog comment then create the blog and comment \n return this.props\n .dispatch(createBlog(this.props.currentUser.username, \n this.props.params.toolId, values.content, values.rating)) \n }", "function formSubmitted(e) {\n\n var action = e.target.getAttribute('action');\n\n if (action[0] === '#') {\n e.preventDefault();\n trigger('POST', action, e, serialize(e.target));\n }\n }", "postNewComment() {\n const commentContent = DiscussionArea.#ELEMENT_POST_TEXTAREA.value;\n const commentTimestampMs = this.#currentTimeMs;\n /* eslint-disable indent */\n const commentType =\n DiscussionArea.#ELEMENT_NEW_COMMENT_TYPES\n .querySelector(DiscussionArea.#SELECTOR_SELECTED_TYPE)\n .value;\n /* eslint-enable indent */\n\n const currentTranscriptLine =\n this.#transcriptArea.transcriptSeeker().currentTranscriptLine();\n let currentTranscriptLineId = null;\n if (currentTranscriptLine != null) {\n currentTranscriptLineId =\n currentTranscriptLine.transcriptLine.transcriptKey.id;\n }\n\n this.#manager\n .postRootComment(\n commentContent, commentTimestampMs, commentType,\n currentTranscriptLineId)\n .then(() => {\n this.updateDiscussion();\n });\n\n DiscussionArea.#ELEMENT_POST_TEXTAREA.value = '';\n }", "function unapprovedComment(i) {\n\tdocument.getElementById(\"form-unapproved-comment-\" + i).submit();\n}", "function comment_add() {\n $('#comments .form').fadeIn(2000);\n $('#comments .boutons').remove();\n $('#comments .form input[type=\"text\"]:first').focus();\n comment_focus();\n}", "function insertComments(){\n var form = document.querySelector('.commentForm');\n\n var inputBox = form.querySelector('.inputBox');\n var inputs = inputBox.querySelectorAll('input');\n var contentBox = form.querySelector('textarea');\n\n var name = inputs[0].value;\n var password = inputs[1].value;\n var content = contentBox.value;\n var typeCheck = document.querySelector('.commentHidden');\n\n if(name == \"\"){\n alert(\"닉네임을 입력해주세요.\");\n return;\n }else if(password == \"\"){\n alert(\"비밀번호를 입력해주세요.\");\n return;\n }else if(content == \"\"){\n alert(\"내용을 입력해주세요.\");\n return;\n }\n\n const fetchInit = {\n method:\"get\"\n }\n fetch('../work_php/insert_comments.php?'+\"name=\" +name + \"&\" + \"password=\" + password + \"&\" + \"content=\"+ content + \"&\" + \"typeCheck=\" + typeCheck.value, fetchInit)\n // body 로 값넣기\n .then(\n function (response){\n response.text().then(function(text){\n inputs[0].value = \"\";\n inputs[1].value = \"\";\n contentBox.value = \"\";\n alert(\"댓글등록이 성공하였습니다.\");\n selectComments();\n\n })\n }\n )\n}", "function handleFormSubmit() {\n API.saveReviews(formObject)\n .then((data) => {\n console.log(data);\n console.log(\"I hit the route\");\n })\n .catch((err) => console.log(err));\n }", "handleSubmit(evt) {\n evt.preventDefault();\n this.props.addComment(this.state.comment, this.props.postId);\n this.setState({\n comment: ''\n });\n }", "function submitForm () {\n\n\t\t\t// Add submitting state\n\t\t\tform.setAttribute('data-submitting', true);\n\n\t\t\t// Send the data to the MailChimp API\n\t\t\tsendData(serializeForm(form));\n\n\t\t}", "function addNewComment() {\n var comment = document.getElementById(\"submitted-comment\").value;\n\n if (comment != \"\") {\n $.ajax({\n url: '/chatstorer',\n method: 'POST',\n data: {\n \"submitted-comment\" : comment\n },\n success : function(resultText){\n console.log(\"it worked\");\n },\n error : function(jqXHR, exception){\n console.log('Errror occured');\n }\n });\n }\n document.getElementById(\"submitted-comment\").value = \"\";\n}", "function addComment(event, id) {\n event.preventDefault()\n const formComment = document.querySelector(`.formComment-${id}`)\n\n const commentBody = {\n comment: formComment.elements.comment.value,\n\n }\n axios.post(`https://vast-chamber-06347.herokuapp.com/api/posts/${id}/comment`, commentBody, {\n headers: {\n Authorization: localStorage.token\n }\n })\n .then(response => {\n\n getPosts()\n })\n .catch(error => {\n console.log(error.response.data)\n })\n}", "function onSubmit() {\n const post = { postHeader, postContent, creatorName, postId: shortid.generate() }\n submitPost(post)\n }", "function commentsFunction(commentData, formComment) {\n const newCommentContainer = document.createElement(\"div\");\n const newCommentMessage = document.createElement(\"p\");\n newCommentMessage.setAttribute(\"class\", \"newCommentMessage\");\n newCommentMessage.textContent = `${commentData.comment}`;\n newCommentContainer.append(newCommentMessage);\n formComment.append(newCommentContainer);\n}", "function formPOST(){\n\n\tthis.submit();\n\n}", "function commentEditor(id, postID) {\n if (id) {\n // Edit comment\n comment = $(`#commentBody${id}`).text().trim();\n commentID = `<input type=\"hidden\" name=\"cid\" value=\"${id}\">`;\n target = `#commentPosterTarget${id}`;\n\n // Hide original comment\n $(`#commentBody${id}`).hide();\n restore = `#commentBody${id}`;\n action = `Save Comment`;\n } else {\n // New comment\n comment = '';\n commentID = '';\n target = `#commentPosterBody${postID}`;\n restore = `#commentPosterActions${postID}`;\n action = `Post Comment`;\n }\n\n var posterName = `poster${postID}${id}`;\n var poster = `<div class=\"text-right\"><input type=\"hidden\" name=\"pid\" value=\"${postID}\">${commentID}<textarea id=\"${posterName}\" class=\"form-control\" name=\"comment\" placeholder=\"Enter Comment\" rows=\"8\" autofocus required>${comment}</textarea><a href=\"#\" class=\"btn btn-sm btn-secondary mt-2 mr-2\" tabindex=\"1\" onclick=\"return commentCancel('${restore}', '${target}');\">Cancel</a><input type=\"submit\" value=\"${action}\" tabindex=\"0\" class=\"btn-sm btn btn-primary mt-2\"></div>`;\n $(target).html(poster);\n $(target).show();\n $(restore).hide();\n $(`#${posterName}`).focus();\n}", "function previewComment(){\n f = document.getElementById('add-comment-form');\n \n title= f['title'].value;\n description = f['description'].value;\n type=$('#add-comment-form input:checked')[0].value;\n if(type==\"Other\")\n type=f['other'].value;\n f.reset();\n tmpComment = new Comment(title, description, type, 0);\n console.log(tmpComment);\n return tmpComment;\n}", "function addComment() {\n console.log(currentIndex);\n var newCommentModal = new Modal(document.getElementById(\"newCommentModal\"));\n var messageModal = new Modal(document.getElementById(\"thankyouModal\"));\n var comment = new Object();\n\n newCommentModal.hide();\n comment.movieId = movie_array[currentIndex]._id;\n comment.movie = movie_array[currentIndex].title;\n comment.username = document.getElementById(\"nickname\").value;\n comment.review = document.getElementById(\"userComments\").value;\n // comment.datePosted = new Date().toString();\n comment.rating = rating;\n\n var postComment = new XMLHttpRequest(); // new HttpRequest instance\n\n postComment.open(\"POST\", comment_url, true); //For Local Comments DB\n\n\n postComment.setRequestHeader(\"Content-Type\", \"application/json\");\n postComment.onload = function () {\n fetchComments();\n messageModal.show();\n\n };\n postComment.send(JSON.stringify(comment));\n}", "function submitComment(parseId){\n\n \n let xhttp=new XMLHttpRequest();\n let com=document.getElementById(\"commentText\").value;\n xhttp.onreadystatechange=function(){\n if(this.readyState==4 && this.status==200){\n let obj = JSON.parse(xhttp.responseText);\n html=\"\";\n html+=(\"<button type='button' id='\"+parseId+\"' onclick='submitComment(\"+parseId+\")' class='registerbtn'>Submit</button>\");\n obj.forEach(element => {\n html+=(\"<div class='usersComment' id='comment'>User \"+element['FullName']+\" said => \"+element['comment']+\"</div>\")\n \n \n });\n document.getElementById(\"commentsContainer\").innerHTML=html;\n }else{\n document.getElementById(\"commentsContainer\").innerHTML=\"<span style='color:red;'><h3>\"+this.responseText+\"</h3></span>\";\n }\n };\n xhttp.open(\"GET\",\"/submitComment?id=\"+parseId+\"&comment=\"+com,true);\n xhttp.setRequestHeader(\"Content-type\", \"application/json\");\n xhttp.send();\n \n\n }", "function ajoutComment(idProjet) {\n\tevent.preventDefault();\n\tform = recupCom(\"inputCom\", idProjet);\n\n\tfetch('../router.php/comments', { method: 'POST', body: JSON.stringify(form)}) \n\t.then(response => response.json())\n .then (data =>{\n\t\tdisplayProjetComments(data);\n\t})\n\t.catch(error => { console.log(error) });\n}", "function submitFormOnClick(event) {\n event.preventDefault()\n // debugger\n let quote = document.getElementById('new-quote').value\n let author = document.getElementById('author').value\n form.reset()\n // console.log(quote)\n // console.log(author)\n fetch(quotesPostUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\"\n },\n body: JSON.stringify({\n quote, author\n })\n })\n .then(response => response.json())\n .then(data => createQuoteItem(data))\n}", "function postComment()\n{\n\tvar postID = window.location.search.substring(1); //grabbing URL variable \n\tvar splitVariables = postID.split('='); //split at = and store in array\n\tpostID = splitVariables[1]; //we want index 2 because list should be: 'name', variableNeeded\n\n\tvar posterName = document.getElementById('name').value;\n\tvar posterEmail = document.getElementById('email').value;\n\tvar posterImage = document.getElementById('imageURLbox').value;\n\tvar posterComment = document.getElementById('comment').value;\n\tvar posterDate = \"Just now!\";\n\n\t//==============================TEMPORARY COMMENTS - DELETES ON REFRESH =====================\n\tstringBody = stringBody + \"<li><div class='comment-img'><img src='\" + posterImage + \"0'/></div><div class='comment-text'><strong><a href=''>\" + posterName +\n \"</a></strong><p>\" + posterComment + \"</p> <span class='date sub-text'>on \"\n + posterDate + \"</span></div></li>\";\n document.getElementById('comments').innerHTML = \"<b>Comments:</b>\" + stringHeader + stringBody + stringFooter;\n //=======================SAVE TO DATABASE HERE ===============================\n\n\t//Add to database!!!\t\t\n\txmlhttp=new XMLHttpRequest();\n\txmlhttp.onreadystatechange=function() {\n\t\tif (xmlhttp.readyState==4 && xmlhttp.status==200) {//executed when state = done and status = OK\n\t\t\tresponse=xmlhttp.responseText;\n\t\t\tconsole.log('Insert comment response: ' + response);\n\t\t}\n\t}\n\txmlhttp.open(\"GET\",\"comment.php?id=\"+postID+\"&text=\"+posterComment+\"&email=\"+posterEmail, true);\n\txmlhttp.send();\n\tposterComment = document.getElementById('comment').value = \"\"; //erase comment from box\n}", "onCommentButtonClick() {\n let header = document.querySelector(\".at_thread\");\n let previousCommentBox = header.querySelector(\".at_commentfield\");\n if (previousCommentBox) {\n previousCommentBox.parentNode.removeChild(previousCommentBox);\n }\n new RoKA.CommentField(this);\n }", "function addComment(id) {\n\tvar text = document.getElementById(\"addCommentTextArea\").value;\n\tvar requestUrl = \"/\"+ appName +\"/action?type=addComment_task&tid=\" +id;\n\tvar requestPayload = \t\"<addComment><text><![CDATA[\"+text +\"]]></text></addComment>\";\n\t\n\t$.ajax({\n\t\ttype: 'POST',\n\t\turl: httpUrl + requestUrl,\n\t\tdata: requestPayload,\n\t\tcontentType: \"text/xml\",\n\t\tdataType: \"xml\",\n\t\tsuccess: function(data){\n\t\t\tvar success = data.firstChild.getElementsByTagName('success')[0].textContent;\n\t\t\tif (success == 'true'){\n\t\t\t\t//successful\n\t\t\t\talert(\"Task ADDCOMMENT success : \" +id);\n\t\t\t}else{\n\t\t\t\t//unsuccessful\n\t\t\t\talert(\"Unable to ADDCOMMENT the task : \" +id);\n\t\t\t}\n },\n error:function(response){\n \talert('Failed : ERROR OCCURED');\n \t}\n\t});\n\n\t$('#addCommentModal').modal('hide');\n\t$('#addCommentModal').on('hidden.bs.modal', function (e) {\n\t\t//update comment list in ui\n\t\tupdateComments(id);\n\t});\n\t\t\n}" ]
[ "0.7888377", "0.7785239", "0.77180445", "0.76531845", "0.7597335", "0.7382302", "0.7349144", "0.73389566", "0.724076", "0.7239504", "0.7228025", "0.7226964", "0.7107598", "0.7088479", "0.7044001", "0.70259774", "0.70160455", "0.69854", "0.6953784", "0.69208604", "0.6918673", "0.68816984", "0.68717974", "0.68401396", "0.6822035", "0.68159425", "0.6759481", "0.6757658", "0.6750128", "0.6740523", "0.67326933", "0.67021596", "0.6686339", "0.6673192", "0.66640383", "0.6660388", "0.6658094", "0.6653255", "0.66477454", "0.6628901", "0.6625303", "0.66200244", "0.6616963", "0.6602588", "0.6598147", "0.6585561", "0.6575159", "0.6519461", "0.6518995", "0.6496908", "0.64954555", "0.6492652", "0.64876246", "0.64713794", "0.64706117", "0.6470025", "0.64594585", "0.6459076", "0.64567155", "0.64505565", "0.6427797", "0.63920724", "0.6392067", "0.6387239", "0.63848245", "0.63720113", "0.63717145", "0.63568133", "0.6354599", "0.63102835", "0.6302303", "0.62965", "0.6295228", "0.6294429", "0.6284895", "0.6281638", "0.6278716", "0.62524515", "0.62497014", "0.62478346", "0.62398034", "0.6217622", "0.62112105", "0.6208164", "0.61983216", "0.61744344", "0.6174026", "0.61695015", "0.6158814", "0.61574334", "0.61550796", "0.61457187", "0.61451924", "0.61401355", "0.6139961", "0.61379594", "0.61285853", "0.61253184", "0.6124183", "0.6122376" ]
0.6497431
49
Main function to draw and set up the visualization, once we have the data.
function createVisualization(json) { // Basic setup of page elements. initializeBreadcrumbTrail(); drawLegend(); d3.select("#togglelegend").on("click", toggleLegend); // Bounding circle underneath the sunburst, to make it easier to detect // when the mouse leaves the parent g. vis.append("svg:circle") .attr("r", radius) .style("opacity", 0); // Turn the data into a d3 hierarchy and calculate the sums. var root = d3.hierarchy(json) .sum(function(d) { return d.size; }) .sort(function(a, b) { return b.value - a.value; }); // For efficiency, filter nodes to keep only those large enough to see. var nodes = partition(root).descendants() .filter(function(d) { return (d.x1 - d.x0 > 0.005); // 0.005 radians = 0.29 degrees }); var path = vis.data([json]).selectAll("path") .data(nodes) .enter().append("svg:path") .attr("display", function(d) { return d.depth ? null : "none"; }) .attr("d", arc) .attr("fill-rule", "evenodd") .style("fill", function(d) { return colors[d.data.name]; }) .style("opacity", 1) .on("mouseover", mouseover); // Add the mouseleave handler to the bounding circle. d3.select("#container").on("mouseleave", mouseleave); // Get total size of the tree = value of root node from partition. totalSize = path.datum().value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function makeVisualization(){\n {\n console.log(\"loading local data\");\n data = await getData('dataSelection.json');\n }\n console.log({ data });\n \n setupScales();\n setupAxes(group);\n drawBars(group);\n setupInput();\n }", "function drawVisualization() {\n // create the data table.\n data = new vis.DataSet();\n\n // create the animation data\n for (var i = 0; i < field1.length; i++) {\n x = field1[i];\n y = field2[i];\n z = field3[i];\n var style = clusters[i] == 0 ? \"#FFA500\" : clusters[i] == 1 ? \"#0000FF\" : clusters[i] == 2 ? \"#008000\" : clusters[i] == 3 ? \"#FFFF00\" : clusters[i] == 4 ? \"#4B0082\" : \"#000000\";\n\n data.add({ x: x, y: y, z: z, style: style });\n }\n\n // specify options\n var options = {\n width: \"100%\",\n height: \"100%\",\n style: \"dot-color\",\n showPerspective: true,\n showGrid: true,\n keepAspectRatio: true,\n verticalRatio: 1.0,\n showLegend: false,\n tooltip: {\n color: \"red\",\n },\n cameraPosition: {\n horizontal: -0.35,\n vertical: 0.22,\n distance: 1.8,\n },\n xLabel: field1Name,\n yLabel: field2Name,\n zLabel: field3Name\n };\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n graph.on(\"click\", onclick);\n }", "function setup() {\n const canvasSideLength = Math.min(windowWidth, windowHeight);\n createCanvas(canvasSideLength, canvasSideLength);\n frameRate(IDEAL_FRAME_RATE);\n unitLength = Math.min(width, height) / 640;\n unitSpeed = unitLength / IDEAL_FRAME_RATE;\n strokeWeight(Math.max(1, 1 * unitLength));\n textAlign(CENTER);\n textSize(20 * unitLength);\n visualizerSet.add(new StackVisualizer(0.25 * width, 0.25 * height));\n visualizerSet.add(new SetVisualizer(0.75 * width, 0.25 * height));\n visualizerSet.add(new TableVisualizer(0.25 * width, 0.75 * height));\n visualizerSet.add(new GraphVisualizer(0.75 * width, 0.75 * height));\n}", "function initVisualization() {\n var svg = d3.select(\"#simulation\")\n .append(\"svg\")\n .attr(\"width\", w)\n .attr(\"height\", h);\n}", "function setup(){\n loadData(\"life_expectancy_data_csv.csv\", \"fertility_rate_data_csv.csv\", \"africa_scatterplot.csv\");\n _vis = document.getElementById(\"vis\");\n _vis = d3.select(\"#vis\");\n // grab our container's dimension\n _vis_width = d3.select(\"#vis\").node().getBoundingClientRect().width;\n _vis_height = d3.select(\"#vis\").node().getBoundingClientRect().height;\n\n _vis2 = document.getElementById(\"vis2\");\n _vis2 = d3.select(\"#vis2\");\n // grab our container's dimension\n _vis2_width = d3.select(\"#vis2\").node().getBoundingClientRect().width;\n _vis2_height = d3.select(\"#vis2\").node().getBoundingClientRect().height;\n}", "function new_vis(){\r\n var pic = document.getElementById(\"vis\");\r\n var x;\r\n \r\n //Clear any previous drawings\r\n while (pic.hasChildNodes()) { pic.removeChild(pic.lastChild); }\r\n \r\n //Draw new graph if data is available.\r\n if (data_avail) {\r\n var cell, header, myCanvas;\r\n\r\n //Add Collapsable icon.\r\n cell = document.createElement(\"img\");\r\n cell.setAttribute(\"src\", \"IMG/Collapse.JPG\");\r\n cell.setAttribute(\"onClick\", \"visualization(false)\")\r\n pic.appendChild(cell);\r\n \r\n //Add Header\r\n cell = document.createElement(\"caption\");\r\n header = document.createTextNode(\"Web Crawler Search Results - Visualization\");\r\n cell.appendChild(header);\r\n cell.setAttribute(\"id\", \"vis_header\");\r\n pic.appendChild(cell);\r\n\r\n //Create Visualization Background:\r\n myCanvas = createCanvas(vis_width, vis_height);\r\n myCanvas.parent(\"vis\");\r\n strokeWeight(4);\r\n rectMode(CORNER);\r\n rect(0, 0, vis_width, vis_height, 20);\r\n \r\n //Draw lines first:\r\n stroke(color(0, 0, 0));\r\n strokeWeight(3);\r\n noFill();\r\n for (x = 1; x < vis_count; x++){\r\n var c = {x:0, y:0};\r\n var p = {x:0, y:0};\r\n var horiz_shift;\r\n \r\n //Identify node locations\r\n c.x = node_locations[x][0] + center_adjust;\r\n c.y = node_locations[x][1];\r\n p.x = node_locations[x][2] + center_adjust;\r\n p.y = node_locations[x][3];\r\n horiz_shift = ((c.x + p.x) / 3);\r\n\r\n //Draw connecting curve.\r\n curve(c.x, c.y + 450, c.x, c.y, p.x, p.y, p.x, p.y - 450);\r\n }\r\n\r\n //Draw nodes & #'s' next:\r\n textSize(25);\r\n textStyle(NORMAL);\r\n stroke(color(0, 0, 128));\r\n strokeWeight(4);\r\n for (x = 0; x < vis_count; x++){\r\n var shift;\r\n strokeWeight(4);\r\n fill(256,256,256);\r\n //Turn node red if termination node.\r\n if (terminated && x == node_locations.length - 1) { stroke(color(256, 0, 0)); }\r\n ellipse(node_locations[x][0] + center_adjust, node_locations[x][1], 50, 50);\r\n if (x < 9) { shift = 7; }\r\n else { shift = 14; }\r\n stroke(color(0, 0, 128));\r\n strokeWeight(1);\r\n fill(0, 0, 70);\r\n text(x + 1, node_locations[x][0] - shift + center_adjust, node_locations[x][1] + 8);\r\n }\r\n\r\n //Add Page Titles to Node.\r\n textSize(11);\r\n textStyle(NORMAL);\r\n textAlign(CENTER);\r\n rectMode(CENTER);\r\n color(128);\r\n for (x = 0; x < vis_count; x++){\r\n //Draw white background so title can be read against lines:\r\n noStroke();\r\n fill(256,256,256);\r\n rect(node_locations[x][0] + center_adjust, node_locations[x][1] + 33, 6.5 * node_locations[x][4].length, 11);\r\n //Print title:\r\n stroke(color(0, 0, 128));\r\n strokeWeight(1);\r\n fill(0, 0, 70);\r\n text(node_locations[x][4], node_locations[x][0] + center_adjust, node_locations[x][1] + 36);\r\n }\r\n\r\n //Draw Visualization Key (\"0 - Webpage Found 0(red) - Page contained termination keyword, Web_Crawl terminated.\")\r\n //Seperating Line:\r\n stroke(color(0, 0, 0));\r\n strokeWeight(2);\r\n line(25, vis_height - 85, vis_width - 25, vis_height - 85);\r\n\r\n //Key Header:\r\n textSize(18);\r\n textStyle(BOLD);\r\n stroke(color(0, 0, 128));\r\n strokeWeight(1);\r\n text(\"KEY:\", 50, vis_height - 42);\r\n \r\n //Basic Node Image:\r\n stroke(color(0, 0, 128));\r\n strokeWeight(4);\r\n fill(256,256,256);\r\n ellipse(115, vis_height - 50, 50, 50);\r\n //Termination Node Image\r\n stroke(color(256, 0, 0));\r\n ellipse(320, vis_height - 50, 50, 50);\r\n\r\n //Node Labels\r\n textStyle(NORMAL);\r\n textSize(25);\r\n stroke(color(0, 0, 128));\r\n strokeWeight(1);\r\n fill(0, 0, 70);\r\n text(\"ID\", 116, vis_height - 42);\r\n text(\"ID\", 321, vis_height - 42);\r\n textSize(11);\r\n text(\"Page Title\", 115, vis_height - 14);\r\n text(\"Page Title\", 321, vis_height - 14);\r\n\r\n //Add Explaination Text\r\n textSize(13);\r\n textStyle(NORMAL);\r\n stroke(color(0, 0, 70));\r\n strokeWeight(1);\r\n text(\"- Webpage Found\", 198, vis_height - 44);\r\n text(\"-\", 355, vis_height - 44);\r\n textAlign(LEFT)\r\n text(\"Webpage contained termination keyword\", 362, vis_height - 49);\r\n text(\"Web Crawl terminated\", 362, vis_height - 35);\r\n \r\n //Add Play/Pause Buttons Images and functionality.\r\n var section, div, cell, images, funct, i;\r\n \r\n //Define Images & Function Calls to add.\r\n images = [\"IMG/Restart.JPG\", \"IMG/StepBack.JPG\", \"IMG/Pause.JPG\", \"IMG/Play.JPG\", \"IMG/StepFwd.JPG\", \"IMG/End.JPG\"];\r\n funct = [\"cont_reset()\", \"cont_back()\", \"cont_pause()\", \"cont_play()\", \"cont_fwd()\", \"cont_end()\"];\r\n\r\n //Add Player Control Images with onclick() functions to div following visualization.\r\n section = document.getElementById(\"vis\");\r\n div = document.createElement(\"div\");\r\n div.setAttribute(\"id\", \"control\");\r\n for (i = 0; i < images.length; i++){\r\n cell = document.createElement(\"img\");\r\n cell.setAttribute(\"src\", images[i]);\r\n cell.setAttribute(\"onclick\", funct[i]);\r\n div.appendChild(cell); \r\n }\r\n section.appendChild(div);\r\n }\r\n \r\n //Otherwise only draw expandable icon and header. results only == null at page load when we want to draw nothing.\r\n else if (results != null){\r\n var cell, header;\r\n \r\n //Add Collapsable icon.\r\n cell = document.createElement(\"img\");\r\n cell.setAttribute(\"src\", \"IMG/Expand.JPG\");\r\n cell.setAttribute(\"onClick\", \"visualization(true)\")\r\n pic.appendChild(cell);\r\n \r\n //Add Header\r\n cell = document.createElement(\"caption\");\r\n header = document.createTextNode(\"Web Crawler Search Results - Visualization\");\r\n cell.appendChild(header);\r\n cell.setAttribute(\"id\", \"vis_header\");\r\n pic.appendChild(cell);\r\n }\r\n}", "function drawVisualization() {\n // create the data table.\n data = new vis.DataSet();\n\n // create the animation data\n for (var i = 0; i < pc1.length; i++) {\n x = pc1[i];\n y = pc2[i];\n z = pc3[i];\n var style = \"#0000CD\";\n\n data.add({ x: x, y: y, z: z, style: style });\n }\n\n // specify options\n var options = {\n width: \"100%\",\n height: \"100%\",\n style: \"dot-color\",\n showPerspective: true,\n showGrid: true,\n keepAspectRatio: true,\n verticalRatio: 1.0,\n showLegend: false,\n tooltip: {\n color: \"red\",\n },\n cameraPosition: {\n horizontal: -0.35,\n vertical: 0.22,\n distance: 1.8,\n },\n xLabel: \"PC1\",\n yLabel: \"PC2\",\n zLabel: \"PC3\"\n };\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n graph.on(\"click\", onclick);\n }", "function drawVisualization() {\n\t\t//default graph as an exampe; for when there is no data running ie the car not in race\n\t\tdata = new google.visualization.DataTable();\n\t\tdata.addColumn('string', 'Example Time'); \n\t\tdata.addColumn('number', 'Example Speed(sec)'); \n\t\tdata.addRows([\n\t\t['56',32],\n\t\t['57', 46],\n\t\t['58', 63],\n\t\t['59', 63],\n\t\t['60', 43]\n\t\t]);\t\n\t\t\n\t\n\t// Sets up options on how the graph will look and feel\n\toptions = {curveType: \"function\",\n \t\t\tbackgroundColor: '#F8F8F8',\n width: 320, height: 180,\n colors: ['#5a2260', \"red\", \"#acf\", \"#1BE032\"],\n legend: {position: 'top'},\n hAxis: {title: 'Time'},\n \tvAxis: {title: 'Speed',\n\t\t\t\t\t\t\t\t\tviewWindow:{\n\t\t\t\t\t\t\t\t\tmin:0 }\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\tcurveType: \"function\",\n\t\t\t\t\t\ttitle: 'Real Time Stats',\n\t\t\t\t\t\tanimation:{\n\t\t\t\t\t\tduration: 1000,\n\t\t\t\t\t\teasing: 'linear'\n }\n }\n\t \n // Create the graph\n chart = new google.visualization.LineChart(document.getElementById('visualization'));\n chart.draw(data, options);\n }", "function drawVisualization() {\n // create the data table.\n data = new vis.DataSet();\n\n // create the animation data\n\n for (var i = 0; i < pc1.length; i++) {\n x = pc1[i];\n y = pc2[i];\n z = pc3[i];\n var style = clusters[i] == 0 ? \"#FFA500\" : clusters[i] == 1 ? \"#0000FF\" : clusters[i] == 2 ? \"#008000\" : clusters[i] == 3 ? \"#FFFF00\" : clusters[i] == 4 ? \"#4B0082\" : \"#000000\";\n\n data.add({ x: x, y: y, z: z, style: style });\n }\n\n // specify options\n var options = {\n width: \"100%\",\n height: \"100%\",\n style: \"dot-color\",\n showPerspective: true,\n showGrid: true,\n keepAspectRatio: true,\n verticalRatio: 1.0,\n showLegend: false,\n tooltip: {\n color: \"red\",\n },\n cameraPosition: {\n horizontal: -0.35,\n vertical: 0.22,\n distance: 1.8,\n },\n xLabel: \"PC1\",\n yLabel: \"PC2\",\n zLabel: \"PC3\"\n };\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n graph.on(\"click\", onclick);\n }", "function initVis() {\r\n\r\n createMapChart();\r\n populateTable();\r\n createLineCharts();\r\n}", "draw() {\n // Set up the nodes and links of the graph.\n this.addNodes();\n this.addLinks();\n\n // Create the d3 simulation.\n this.createSimulation();\n\n // Set up SVG to draw the simulation.\n this.setupSvg();\n }", "function 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 draw() {\n const data = getData();\n const svg = d3.select('body').append('svg');\n const plot = getPlotArea();\n const paddingGroup = chartUtils.setupSvgAndPaddingGroup(svg, plot);\n const scales = makeScales(data, plot);\n defineDashedLine(svg);\n appendYAxisDashedLines(paddingGroup, scales, plot);\n appendXAxis(paddingGroup, scales, plot);\n appendYAxis(paddingGroup, scales);\n appendBars(paddingGroup, data, scales, plot);\n appendScoreToday(paddingGroup, data, scales);\n appendScoreLastYear(paddingGroup, data, scales);\n appendChartTitle(svg, plot);\n appendYAxisTitle(svg, plot);\n appendFootnote(svg, plot);\n }", "run() {\n this.chart.drawChart();\n this.demographicsChart.drawChart(this.createCurrentStats().sum());\n this.model.setupCommunity();\n this.model.run();\n this.reset();\n }", "function setupChart() {\n\t\tvar $ = cmg.query,\n\t\t\tdata_list = cmg.display.data[0],\n\t\t\tdata = [];\n\n\t\tif (chart_type == \"bar\") {\n\t\t\tfor (i in data_list) {\n\t\t\t\tvar obj = {\n\t\t\t\t\tcategory: data_list[i][x_axis_column],\n\t\t\t\t\tprice: cmg.display.parse_float_liberally(data_list[i][y_axis_columns])\n\t\t\t\t}\n\t\t\t\tdata.push(obj);\n\t\t\t}\n\t\t} else {\n\t\t\tfor(var i in data_list) data.push(data_list[i]);\n\t\t}\n\n\t\t// SET UP THE SVG FOR THE CHART\n\t\tvis = d3.select(\"#dataVizChart\")\n\t\t\t.append(\"svg\")\n\t\t\t.attr({\n\t\t\t\t\"width\": width,\n\t\t\t\t\"height\": height,\n\t\t\t\t\"preserveAspectRatio\": \"xMinYMid\",\n\t\t\t\t\"viewBox\": \"0 0 \" + width + \" \" + height\n\t\t\t})\n\t\t\t.append('g')\n\t\t\t.attr({\n\t\t\t\t'transform': 'translate(0, 0)'\n\t\t\t})\n\n\t\taspect = chart_container.width() / chart_container.height();\n\n\t\t// SET UP THE LEGEND\n\t\tlegend = d3.select(\"#dataVizLegend\")\n\t\t\t.append(\"div\")\n\t\t\t.attr({\n\t\t\t\t\"class\": \"legend\",\n\t\t\t});\n\n\t\tdrawBarChart(data);\n\t}", "function createVisualization() {\n\t\n\t// -----------------------------------------------------------\n\t// Transition container\n\t// -----------------------------------------------------------\n\n\t// Create container\n\tconst contentContainer = document.querySelector('.content');\n\tconst rootBody = document.querySelector('body');\n\tconst container = contentContainer || rootBody;\n\tconst fileContainer = document.createElement('div');\n\n\t// Add loading transition HTML\n\tfileContainer.innerHTML = `\n\t\t<head><link rel=\"stylesheet\" type=\"text/css\" href=\"loader.css\"></head>\n\n\t\t<div class=\"center\">\n\t\t<div class=\"lds-spinner\"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>\n\t\t<p style=\"text-align:center\">LOADING</p>\n\t\t</div>\n\t\t<div class=\"center2\">\n\t\t<p style=\"text-align:center\">VTK DATA VR VISUALIZATION</p>\n\t\t<p style=\"text-align:center\">FEDERICO RAFAEL GARCIA GARCIA - 2019</p>\n\t\t</div>\n\t\t`;\n\tcontainer.appendChild(fileContainer);\n\t\n\t// -----------------------------------------------------------\n\t// Read and process data\n\t// -----------------------------------------------------------\n\n\t// Read data from URL\n\tconst reader = vtkPolyDataReader.newInstance();\n\t\n\t// After reading, do everything\n\treader.setUrl(fileURL).then(() => {\n\t\t\n\t\t// -----------------------------------------------------------\n\t\t// Divide polydata into multiple actors\n\t\t// -----------------------------------------------------------\n\n\t\t// Get data from file\n\t\tconst polydataFull = reader.getOutputData(0);\n\n\t\t// To store lines\n\t\tlet lines = [];\n\t\tlet linesCombined = [];\n\n\t\t// To store actors\n\t\tlet actorsTubesCombined = [];\n\t\tlet actorsTubesOriginal = [];\n\t\tlet actorsLines = [];\n\t\t\n\t\tlineFunctions.getLinesAndTubes(polydataFull, lines, linesCombined, actorsTubesCombined, actorsTubesOriginal, actorsLines,\n detailLevels, vertexDensity, decimation, minRadius, maxRadius, tubeResolution);\n\t\t\n\t\t// -----------------------------------------------------------\n\t\t// Rendering and camera\n\t\t// -----------------------------------------------------------\n\n\t\t// Empty loading transition container and add screen renderer container\n\t\twhile (container.firstChild) {\n\t\t\tcontainer.removeChild(container.firstChild);\n\t\t}\n\n\t\tconst fullScreenRenderer = vtkFullScreenRenderWindow.newInstance({\n\t\t\trootContainer: container,\n\t\t\tcontainerStyle: { height: '100%', width: '100%', position: 'absolute' },\n\t\t});\n\n\t\t// Camera properties and configuration\n\t\tconst cameraFocalPoint = [0, 0, -1];\n\t\tconst cameraViewUp = [0, 1, 0];\n\t\tconst disableTouchNext = false;\n\t\tconst cameraCenterY = 0.0;\n\n\t\tconst cameraConfiguration = {\n\t\t\tfocalPoint: cameraFocalPoint,\n\t\t\tposition: [0, 0, 0],\n\t\t\tviewAngle: cameraViewAngle,\n\t\t\tphysicalViewNorth: cameraFocalPoint,\n\t\t\tviewUp: cameraViewUp,\n\t\t\tphysicalViewUp: cameraViewUp,\n\t\t};\n\t\t\n\t\t// Get the window renderers and interactor\n\t\tconst renderWindow = fullScreenRenderer.getRenderWindow();\n\t\tconst mainRenderer = fullScreenRenderer.getRenderer();\n\t\tconst interactor = fullScreenRenderer.getInteractor();\n\t\t\n\t\t// Set color\n\t\tif(backgroundColor === 'Black')\n\t\t\tmainRenderer.setBackground(0, 0, 0);\n\t\telse if(backgroundColor === 'White')\n\t\t\tmainRenderer.setBackground(1, 1, 1);\n\t\telse if(backgroundColor === 'Gray')\n\t\t\tmainRenderer.setBackground(0.4, 0.4, 0.4);\n\t\t\n\t\t// Set cameras and other variables here (null for now)\n\t\tlet leftRenderer = null;\n\t\tlet rightRenderer = null;\n\t\tlet leftCamera = null;\n\t\tlet rightCamera = null;\n\t\tlet camera = mainRenderer.getActiveCamera();\n\t\tlet updateCameraCallBack = mainRenderer.resetCameraClippingRange;\n\t\tlet distPass = null;\n\t\t\n\t\t// Create the selector\n\t\tselector.createSelector(0.1);\n\t\t\t\n\t\t// Make actors transparent\n\t\tfor (let i = 0; i < actorsTubesCombined.length; i++)\n\t\t\tmisc.setTransparent(false, actorsTubesCombined[i], opacity);\n\t\t\n\t\tfor (let i = 0; i < actorsTubesOriginal.length; i++)\n\t\t\tmisc.setTransparent(false, actorsTubesOriginal[i], opacity);\n\t\t\n\t\t// Make actors shiny\n\t\tfor (let i = 0; i < actorsTubesCombined.length; i++)\n\t\t\tmisc.setShiny(actorsTubesCombined[i]);\n\t\t\n\t\tfor (let i = 0; i < actorsTubesOriginal.length; i++)\n\t\t\tmisc.setShiny(actorsTubesOriginal[i]);\n\n\t\t// Set properties depending if its VR mode or not\n\t\tif(mode === 'vr') {\n\t\t\tleftRenderer = vtkRenderer.newInstance();\n\t\t\trightRenderer = vtkRenderer.newInstance();\n\n\t\t\t// Configure left/right renderers\n\t\t\tleftRenderer.setViewport(0, 0, 0.5, 1);\n\t\t\tleftCamera = leftRenderer.getActiveCamera();\n\t\t\tleftCamera.set(cameraConfiguration);\n\t\t\tleftCamera.setWindowCenter(-eyeSpacing, -cameraCenterY);\n\n\t\t\trightRenderer.setViewport(0.5, 0, 1, 1);\n\t\t\trightCamera = rightRenderer.getActiveCamera();\n\t\t\trightCamera.set(cameraConfiguration);\n\t\t\trightCamera.setWindowCenter(eyeSpacing, -cameraCenterY);\n\t\t\t\n\t\t\t\n\t\t\t// Set color\n\t\t\tif(backgroundColor === 'Black') {\n\t\t\t\tleftRenderer.setBackground(0, 0, 0);\n\t\t\t\trightRenderer.setBackground(0, 0, 0);\n\t\t\t}\n\t\t\telse if(backgroundColor === 'White') {\n\t\t\t\tleftRenderer.setBackground(1, 1, 1);\n\t\t\t\trightRenderer.setBackground(1, 1, 1);\n\t\t\t}\n\t\t\telse if(backgroundColor === 'Gray') {\n\t\t\t\tleftRenderer.setBackground(0.4, 0.4, 0.4);\n\t\t\t\trightRenderer.setBackground(0.4, 0.4, 0.4);\n\t\t\t}\n\n\t\t\t// Add actors for each renderer\n\t\t\tfor (let i = 0; i < actorsTubesCombined.length; i++) {\n\t\t\t\tleftRenderer.addActor(actorsTubesCombined[i]);\n\t\t\t\trightRenderer.addActor(actorsTubesCombined[i]);\n\t\t\t}\n\t\t\t\n\t\t\t// Add selector's actor\n\t\t\tleftRenderer.addActor(selector.actorCylinder);\n\t\t\trightRenderer.addActor(selector.actorCylinder);\n\t\t\t\n\t\t\t// Provide custom update callback + fake camera\n\t\t\tupdateCameraCallBack = () => {\n\t\t\t leftRenderer.resetCameraClippingRange();\n\t\t\t rightRenderer.resetCameraClippingRange();\n\t\t\t};\n\t\t\tcamera = {\n\t\t\t setDeviceAngles(alpha, beta, gamma, screen) {\n\t\t\t\tleftCamera.setDeviceAngles(alpha, beta, gamma, screen);\n\t\t\t\trightCamera.setDeviceAngles(alpha, beta, gamma, screen);\n\t\t\t },\n\t\t\t};\n\n\t\t\t// Reconfigure render window\n\t\t\trenderWindow.addRenderer(leftRenderer);\n\t\t\trenderWindow.addRenderer(rightRenderer);\n\t\t\trenderWindow.removeRenderer(mainRenderer);\n\n\t\t\tdistPass = vtkRadialDistortionPass.newInstance();\n\t\t\tdistPass.setK1(distk1);\n\t\t\tdistPass.setK2(distk1);\n\t\t\tdistPass.setCameraCenterY(cameraCenterY);\n\t\t\tdistPass.setCameraCenterX1(-eyeSpacing);\n\t\t\tdistPass.setCameraCenterX2(eyeSpacing);\n\t\t\tdistPass.setDelegates([vtkForwardPass.newInstance()]);\n\t\t\tfullScreenRenderer.getOpenGLRenderWindow().setRenderPasses([distPass]);\n\n\t\t\t// Hide any controller\n\t\t\t//fullScreenRenderer.setControllerVisibility(false);\n\t\t}\n\t\telse {\n\t\t\t// Create camera\n\t\t\tcamera = mainRenderer.getActiveCamera();\n\t\t\tupdateCameraCallBack = mainRenderer.resetCameraClippingRange;\n\n\t\t\tcamera.set(cameraConfiguration);\n\n\t\t\t// Add actors\n\t\t\tfor (let i = 0; i < actorsTubesCombined.length; i++)\n\t\t\t\tmainRenderer.addActor(actorsTubesCombined[i]);\n\t\t\t\n\t\t\t// Add selector's actor\n\t\t\tmainRenderer.addActor(selector.actorCylinder);\n\t\t}\n\t\t\n\t\t// Render the window\n\t\trenderWindow.render();\n\t \n\t\t// -----------------------------------------------------------\n\t\t// UI control handling\n\t\t// -----------------------------------------------------------\n\n\t\t// Add the UI (control panel) to the screen\n\t\tfullScreenRenderer.addController(controlPanel);\n\t\t\n\t\tdocument.querySelector('.showpanel').addEventListener('change', (e) => {\n\t\t\tfor(let i=1; i<=9; i++) {\n\t\t\t\tlet elem = document.querySelector('.tr'+i);\n\t\t\t\t\n\t\t\t\tif(elem.style.display === \"block\")\n\t\t\t\t\telem.style.display = \"none\"\n\t\t\t\telse\n\t\t\t\t\telem.style.display = \"block\"\n\t\t\t}\n\t\t});\n\n\t\tdocument.querySelector('.simpleview').addEventListener('change', (e) => {\n\t\t\tconst simple = !!e.target.checked;\n\t\t\t\n\t\t\tselector.actorCylinder.setVisibility(simple);\n\t\t\t\n\t\t\tfor (let i = 0; i < actorsTubesCombined.length; i++) {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tif(simple) {\n\t\t\t\t\t\tif(mode === 'vr') {\n\t\t\t\t\t\t\tleftRenderer.removeActor(actorsTubesOriginal[i]);\n\t\t\t\t\t\t\tleftRenderer.addActor(actorsTubesCombined[i]);\n\t\t\t\t\t\t\trightRenderer.removeActor(actorsTubesOriginal[i]);\n\t\t\t\t\t\t\trightRenderer.addActor(actorsTubesCombined[i]);\n\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tmainRenderer.removeActor(actorsTubesOriginal[i]);\n\t\t\t\t\t\t\tmainRenderer.addActor(actorsTubesCombined[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif(mode === 'vr') {\n\t\t\t\t\t\t\tleftRenderer.removeActor(actorsTubesCombined[i]);\n\t\t\t\t\t\t\trightRenderer.removeActor(actorsTubesCombined[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tmainRenderer.removeActor(actorsTubesCombined[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tif(intersections[i]) {\n\t\t\t\t\t\t\tif(mode === 'vr') {\n\t\t\t\t\t\t\t\tleftRenderer.addActor(actorsTubesOriginal[i]);\n\t\t\t\t\t\t\t\trightRenderer.addActor(actorsTubesOriginal[i]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tmainRenderer.addActor(actorsTubesOriginal[i]);\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\trenderWindow.render();\n\t\t\t\t}, actorRedrawTime*i);\n\t\t\t}\n\t\t});\n\t\t\n\t\t// Update camera control\n\n\t\t// If the device supports orientation (like the gyroscope of a phone),\n\t\t// make the interactor (and thus the camera) move with the device's orientation\n\t\tif (vtkDeviceOrientationToCamera.isDeviceOrientationSupported()) {\n\t\t\t// Make the window listen to the device orientation\n\t\t\tvtkDeviceOrientationToCamera.addWindowListeners();\n\t\t\tconst cameraListenerId = vtkDeviceOrientationToCamera.addCameraToSynchronize(\n\t\t\t\tinteractor,\n\t\t\t\tcamera,\n\t\t\t\tupdateCameraCallBack\n\t\t\t);\n\t\t\t\n\t\t\t// Make the interactor react to the device orientation\n\t\t\tinteractor.requestAnimation('deviceOrientation');\n\t\t\t\n\t\t\t// Test again after 100ms\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (!vtkDeviceOrientationToCamera.isDeviceOrientationSupported()) {\n\t\t\t\t\tvtkDeviceOrientationToCamera.removeCameraToSynchronize(cameraListenerId);\n\t\t\t\t\tvtkDeviceOrientationToCamera.removeWindowListeners();\n\t\t\t\t\tinteractor.cancelAnimation('deviceOrientation');\n\t\t\t\t}\n\t\t\t}, 100);\n\t\t}\n\t\t\n\t\t// Poll widget's buttons' that control the selector\n\t\tselector.selectorUI(renderWindow);\n\n\t\t// If opacity is changed\n\t\tdocument.querySelector('.opacity').addEventListener('input', (e) => {\n\t\t\topacity = parseFloat(e.target.value);\n\t\t});\n\t\t\n\t\t// Every milisecond check if there have been intersections with lines and selector.\n\t\tfor (let i = 0; i < actorsTubesOriginal.length; i++)\n\t\t\tintersections.push(false);\n\t\t\n\t\tlet iii=0;\n\t\tsetInterval(() => {\n\t\t\tfor(let i=0; i<5; i++) {\n\t\t\t\tif(math.intersection(linesCombined[iii].line,\n\t\t\t\t [selector.x, selector.y, selector.z], [selector.nx, selector.ny, selector.nz], selector.selectorRadius)) {\n\t\t\t\t\tintersections[iii] = true;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tintersections[iii] = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tmisc.setTransparent(!intersections[iii], actorsTubesCombined[iii], opacity);\n\t\t\t\t\n\t\t\t\tiii = (iii+1) % actorsTubesCombined.length;\n\t\t\t}\n\t\t}, 1);\n\t\t\n\t});\n}", "function drawVisualization() {\n // Create and populate a data table.\n formArrayFromObj(satData);\n\n\n // specify options\n var options = {\n width: '600px',\n height: '600px',\n style: 'dot',\n showPerspective: true,\n showGrid: true,\n showShadow: false,\n keepAspectRatio: true,\n verticalRatio: 0.5,\n tooltip: getName\n };\n\n // Instantiate our graph object.\n var container = document.getElementById('myGraph');\n graph = new vis.Graph3d(container, data, options);\n\n}", "draw() {\n this._updateWidthHeight();\n\n this.initSvg();\n // bar char\n if (this.keysBar) {\n this.aggregateLabelsByKeys(this.selection, this.keysBar);\n }\n\n if (this.keysX && this.keysY) {\n this.aggregateValuesByKeys(this.selection, this.keysX, this.keysY);\n }\n\n this.barChart.draw();\n // scatterplot\n // this.scatter.draw();\n }", "function drawVisualization() {\n // Create and populate a data table.\n var data = new vis.DataSet();\n\n $.getJSON('/rawstars', function(stars) { \n for (i in stars) {\n var x = stars[i].x,\n y = stars[i].y,\n z = stars[i].z;\n starMemos[getKey(stars[i])] = stars[i];\n data.add({\n x: x,\n y: y,\n z: z,\n style: stars[i].lum\n });\n }\n\n // specify options\n var options = {\n width: '100%',\n height: '100%',\n style: 'dot-color',\n showPerspective: true,\n showGrid: true,\n showShadow: false,\n keepAspectRatio: true,\n verticalRatio: 0.5,\n legendLabel: \"Luminosity\",\n tooltip: function(star) {return generateTooltip(star);}\n };\n\n // create a graph3d\n var container = document.getElementById('mygraph');\n graph3d = new vis.Graph3d(container, data, options);\n });\n}", "draw() {\n this.plot = this.svg.append('g')\n .classed(\"plot\", true)\n .attr('transform', `translate(${this.margin.left},${this.margin.top})`);\n\n // Add the background\n this.plot.append(\"rect\")\n .attrs({\n fill: \"white\",\n x: 0,\n y: 0,\n height: this.innerHeight,\n width: this.innerWidth\n });\n\n if ( this.opts.nav !== false ) {\n this.drawNav();\n }\n\n // Add the title\n this.svg.append('text')\n .attr('transform', `translate(${this.width / 2},${this.margin.top / 2})`)\n .attr(\"class\", \"chart-title\")\n .attr('x', 0)\n .attr('y', 0)\n .text(this.title);\n }", "function drawViz(){\n\n let currentYearData = incomingData.filter(filterYear);\n console.log(\"---\\nthe currentYearData array now carries the data for year\", currentYear);\n\n\n // Below here is where your coding should take place! learn from lab 6:\n // https://github.com/leoneckert/critical-data-and-visualization-spring-2020/tree/master/labs/lab-6\n // the three steps in the comments below help you to know what to aim for here\n\n // bind currentYearData to elements\n\n\n\n // take care of entering elements\n\n\n\n // take care of updating elements\n\n\n\n\n\n\n\n\n\n\n }", "function visualizationLogic(){\n console.log(\"Visualization Logic\")\n //text\n //INFO from: https://earthquake.usgs.gov/earthquakes/browse/significant.php#sigdef\n // let t2 = createP('Events in this list and shown in red on our real-time earthquake map and list are considered “significant events’,<br>and they are determined by a combination of magnitude, number of Did You Feel It responses, and PAGER alert level.');\n // t2.class('small');\n // t2.parent('canvas1');\n // t2.position(0,0);\n\n //-------------------------------------------------------------//\n // 1. Magnitude Level //\n //-------------------------------------------------------------//\n\n //Variables for All\n let legendW = 60;\n //Variables for Magnitude\n let Mag_Legends = [0, 1, 3, 4.5, 6, 9];\n let Mag_xPos = (cWidth - Mag_Legends.length * legendW)/2; //CENTER THEM\n let Mag_margin = 10;\n let Mag_angle = 0;\n\n //Variables for Significance\n let minSig = minValue(quakes, 'sig');\n let maxSig = maxValue(quakes, 'sig');\n console.log(`MinSig is ${minSig} MaxSig is ${maxSig}`);\n let sig_Legends = [0, 100, 200, 400, 600, 1000, 1500];\n let sig_xPos = (cWidth - sig_Legends.length * legendW)/2; //CENTER THEM\n let sig_margin = 10;\n\n textFont(font1);\n //\n push();\n translate(Mag_xPos, legendW); \n for (let i = 0; i < Mag_Legends.length; i ++) {\n let myAPT_W, myAPT_H;\n myAPT_W = map(1000, 0, 1500, 1, legendW/2); \n myAPT_H = 2 * myAPT_W;\n Mag_angle = radians ( map(Mag_Legends[i], 0, 9, 0, 90) ); //Input, min, max, 0, 90\n //This is the class for the buildings;\n //\n push();\n let xTrans = legendW/2 - myAPT_W/2;\n translate(xTrans, 0); // ****************. FIX THIS PART\n rotate(Mag_angle);\n //2. Building \n let mySigC = sigScale(1000).hex();\n let myMagC = magScale(Mag_Legends[i]).hex();\n myMagC = color(myMagC);\n myMagC.setAlpha(150); // Add Alpha\n fill(mySigC);\n strokeWeight(1);\n stroke('#000000');\n rect(0, 0, myAPT_W, - myAPT_H);//x, y, w, h\n //3. Window\n fill('#ffffff');\n strokeWeight(0.5);\n let myWindowW = map(400, 0, 1500, 1, legendW/7);\n let myWindwX1 = legendW/2 - myAPT_W/5 - myWindowW/2 - xTrans;\n let myWindwX2 = myWindwX1 + 2*(myAPT_W/5) ;\n rect(myWindwX1, - myAPT_H/4 + myWindowW/2, myWindowW, - myWindowW); \n rect(myWindwX1, - (myAPT_H/4) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(myWindwX1, - (myAPT_H/4) * 3 + myWindowW/2, myWindowW, - myWindowW);\n rect(myWindwX2, - myAPT_H/4 + myWindowW/2, myWindowW, - myWindowW); \n rect(myWindwX2, - (myAPT_H/4) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(myWindwX2, - (myAPT_H/4) * 3 + myWindowW/2, myWindowW, - myWindowW);\n //4. Rooftop\n let x1, y1;\n x1 = legendW/2 - myAPT_W/2 - xTrans;\n y1 = - myAPT_H;\n let h = map(1000, 0, 1500, 1, myWindowW);\n line(x1, y1, x1 - h, y1 - h); //Left\n line(x1 + myAPT_W, y1, x1 + myAPT_W + h, y1 - h); //Right\n line(x1 - h, y1 - h, x1 + myAPT_W + h, y1 - h); //top\n pop();\n //1. Ground\n noStroke(); \n fill(myMagC);\n rect(Mag_margin, 0, legendW - 2 * Mag_margin, 15 * map(Mag_Legends[i], 0, 9, 0, 90)/90 ); ////x, y, w, h\n //5. -- Legend Text Below -- //\n noStroke();\n fill('orange');\n textSize(12);\n textAlign(CENTER);\n text(Mag_Legends[i], legendW/2, 35); //text,x, y\n //6. //Move to the next spot to the Right (Add scale)\n translate(legendW, 0); \n }\n pop();\n //Text Description\n textAlign(CENTER);\n textSize(15);\n text(\"Magnitude Level\", cWidth/2, legendW*1.9); \n\n //-------------------------------------------------------------//\n // 2. Significance Level //\n //-------------------------------------------------------------//\n // Cali range 0 from 640, World Range from 0 to 1492\n\n push();\n translate(sig_xPos, legendYPos + legendW + sig_margin); //x, y\n for (let i = 0; i < sig_Legends.length; i ++) {\n let myAPT_W, myAPT_H;\n myAPT_W = map(sig_Legends[i], 0, 1500, 1, legendW/2); //Input, min, max,\n myAPT_H = 2 * myAPT_W; //2 Times over -> Max will be 60\n //This is the class for the buildings;\n //1. Ground\n // noStroke();\n // fill(magScale(0).hex()); //Show the Color at Mag = 0;\n // //fill('rgba(150, 75, 0, 0.5)'); // Brown //************** Should be re-written \n // rect(sig_margin, 0, legendW - 2 * sig_margin, 20); ////x, y, w, h\n //2. Building //Half Point: legendW/2\n let myC = sigScale(sig_Legends[i]).hex();\n fill(myC);\n strokeWeight(1);\n stroke('#000000');\n rect(legendW/2 - myAPT_W/2, 0, myAPT_W, - myAPT_H);//x, y, w, h\n //3. Apartment Windows\n fill('#ffffff');\n strokeWeight(0.5);\n let myWindowW = map(sig_Legends[3], 0, 1500, 1, legendW/7);\n if (sig_Legends[i] < 200) { // No Window\n console.log(\"Sig level below 200 - No Window\");\n }\n if (sig_Legends[i] >= 200 && sig_Legends[i] < 400) { //One Window\n console.log(\"Sig level between 200 & 400\"); \n rect(legendW/2 - myWindowW/2, - myAPT_H/2 + myWindowW/2, myWindowW, - myWindowW); \n } \n if (sig_Legends[i] >= 400 && sig_Legends[i] < 600) { //Two Windows\n console.log(\"Sig level between 400 & 600\"); \n rect(legendW/2 - myWindowW/2, - myAPT_H/3 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 - myWindowW/2, - (myAPT_H/3) * 2 + myWindowW/2, myWindowW, - myWindowW);\n }\n if (sig_Legends[i] >= 600 && sig_Legends[i] < 1000) { //Two Windows * 2 Cols\n console.log(\"Sig level between 600 & 1000\"); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - myAPT_H/3 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/3) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - myAPT_H/3 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/3) * 2 + myWindowW/2, myWindowW, - myWindowW);\n }\n if (sig_Legends[i] >= 1000 && sig_Legends[i] < 1500) { //Two Windows * 3 Cols\n console.log(\"Sig level between 1000 & 1500\"); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - myAPT_H/4 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/4) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/4) * 3 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - myAPT_H/4 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/4) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/4) * 3 + myWindowW/2, myWindowW, - myWindowW);\n }\n if (sig_Legends[i] >= 1500) { //Two Windows * 3 Cols\n console.log(\"Sig level Over 1500\"); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - myAPT_H/6 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 3 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 4 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 5 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - myAPT_H/6 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 3 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 4 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 5 + myWindowW/2, myWindowW, - myWindowW);\n }\n //4. RoofTop - 3 lines;\n let x1, y1, x2, y2;\n x1 = legendW/2 - myAPT_W/2;\n y1 = - myAPT_H;\n let h = map(sig_Legends[i], 0, 1500, 1, myWindowW);\n line(x1, y1, x1 - h, y1 - h); //Left\n line(x1 + myAPT_W, y1, x1 + myAPT_W + h, y1 - h); //Right\n line(x1 - h, y1 - h, x1 + myAPT_W + h, y1 - h); //top\n //5. -- Legend Text Below -- //\n noStroke();\n fill('#cccccc');\n textSize(12);\n textAlign(CENTER);\n text(sig_Legends[i], legendW/2, 15); //text,x, y\n //6. //Move to the next spot to the Right (Add scale)\n translate(legendW, 0); \n }\n pop();\n //Text Description\n textAlign(CENTER);\n textSize(15);\n fill('#000000');\n text(\"Significance Level\", cWidth/2, legendYPos + legendW*1.75);\n\n\n}", "init() {\n\t\t\t\tstructureData()\n\n\t\t\t\t$tooltip = d3.selectAll('.chart figure').append('div').attr('class', 'tooltip')\n\t\t\t\t$vertical = d3.selectAll('.chart figure').append('div').attr('class', 'vertical')\n\n\t\t\t\t$svg = $sel.append('svg').attr('class', 'pudding-chart');\n\t\t\t\t$axis = $svg.append('g').attr('class', 'g-axis');\n\t\t\t\tconst $g = $svg.append('g');\n\n\t\t\t\t// offset chart for margins\n\t\t\t\t$g.attr('transform', `translate(${marginLeft}, ${marginTop})`);\n\n\t\t\t\t// create axis\n\t\t\t\txAxisGroup = $axis.append('g')\n\t\t\t\t\t.attr('class', 'x axis')\n\n\t\t\t\tyAxisGroup = $axis.append('g')\n\t\t\t\t\t.attr('class', 'y axis')\n\n\t\t\t\t$fLabel = $g.append('text').attr('class', 'f-label').text('Women')\n\t\t\t\t$mLabel = $g.append('text').attr('class', 'm-label').text('Men')\n\n\t\t\t\t$biggerLabelGroup = $svg.append('g')\n\t\t\t\t$smallerLabelGroup = $svg.append('g')\n\n\t\t\t\t$biggerLabel = $biggerLabelGroup.append('text')\n\t\t\t\t\t\t.text('Bigger median hair')\n\t\t\t\t\t\t.attr('class', 'axis-label bigger-axis-label')\n\n\t\t\t\t$smallerLabel = $smallerLabelGroup.append('text')\n\t\t\t\t\t\t.text('Smaller median hair')\n\t\t\t\t\t\t.attr('class', 'axis-label smaller-axis-label')\n\n\t\t\t\t$upArrow = $biggerLabelGroup.append('svg:image')\n\t\t\t\t\t\t.attr('xlink:href', `assets/images/arrow-up.svg`)\n\t\t\t\t\t\t.attr('width', '20px')\n\t\t\t\t\t\t.attr('height', '20px')\n\n\t\t\t\t$downArrow = $smallerLabelGroup.append('svg:image')\n\t\t\t\t\t\t.attr('xlink:href', `assets/images/arrow-down.svg`)\n\t\t\t\t\t\t.attr('width', '20px')\n\t\t\t\t\t\t.attr('height', '20px')\n\n\t\t\t\t// setup viz group\n\t\t\t\t$vis = $g.append('g').attr('class', 'g-vis');\n\n\t\t\t\tlineGroup = $svg.select('.g-vis')\n\n\t\t\t\tfemaleLine = lineGroup.append('path')\n\t\t\t\t\t.datum(femaleData)\n\t\t\t\t\t.attr('class', 'Female')\n\n\t\t\t\tmaleLine = lineGroup.append('path')\n\t\t\t\t\t.datum(maleData)\n\t\t\t\t\t.attr('class', 'Male')\n\n\t\t\t\tdrawArea = $vis.append('path')\n\t\t\t\t\t.datum(dataByYear)\n\t\t\t\t\t.attr('class', 'area')\n\n\t\t\t\tChart.resize();\n\t\t\t\tChart.render();\n\t\t\t}", "function initialize() {\n\n //Here we set our <code>viz</code> variable by instantiating the <code>vizuly.viz.corona</code> function.\n //All vizuly components require a parent DOM element at initialization so they know where to inject their display elements.\n viz = vizuly.viz.corona(document.getElementById(\"viz_container\"));\n\n //Using the function chain syntax we can now set various properties of the bar chart.\n //\n //Both the <code>x</code> and <code>y</code> properties are used to map the data values\n //to the corresponding x and y axis within the chart.\n viz.data(data)\n .margin({top: \"15%\", left: \"0%\", right: \"0%\", bottom: \"10%\"})\n .outerRadius(350)\n .y(function (d, i) {\n return d.views; //Value to use for the radius (y)\n })\n .x(function (d, i) {\n return d.hour; //Value to use fo the angle (x)\n })\n .interpolate(\"cardinal-closed\") //Vertex type for line and area paths\n .on(\"validate\", onValidate) //Called when all public properties have been set\n .on(\"mouseover\", onMouseOver) //Called on each datatip mouseover\n .on(\"mouseout\", onMouseOut) //Called on each datatip mouseout\n .on(\"measure\", onMeasure); //Called each time viz measures itself prior to update\n\n\n //** Themes and skins ** play a big role in vizuly, and are designed to make it easy to make subtle or drastic changes\n //to the look and feel of any component. Here we choose a theme and skin to use for our bar chart.\n // *See this <a href=''>guide</a> for understanding the details of themes and skins.*\n theme = vizuly.theme.radial_linearea(viz)\n .skin(vizuly.skin.LINEAREA_OCEAN);\n\n\n //The <code>viz.selection()</code> property refers to the parent\n //container that was used at the object construction. With this <code>selection</code> property we can use D3\n //add, remove, or manipulate elements within the component. In this case we add a title label and heading to our chart.\n viz_title = viz.selection().select(\"svg\").append(\"text\").attr(\"class\", \"title\")\n .attr(\"y\", 35).attr(\"text-anchor\", \"middle\")\n .text(\"WWW.BRIGHTPOINTINC.COM - PAGE VIEWS BY HOUR\");\n viz_heading = viz.selection().select(\"svg\").append(\"text\").attr(\"class\", \"heading\")\n .attr(\"y\", 55).attr(\"text-anchor\", \"middle\")\n .text(\"Google Analytics - Dec 01, 2015\");\n\n\n // Set the viz size based on the container\n changeSize(d3.select(\"#currentDisplay\").attr(\"item_value\"));\n\n\n\n /*\n // This code is for the purposes of the demo and simply cycles through the various skins\n // The user can stop this by clicking anywhere on the page.\n var reel = vizuly.showreel(theme, ['Sunset', 'Neon', 'Ocean'], 2000).start();\n d3.select(\"body\").on(\"mousedown.reel\", function () {\n //Stop show reel\n reel.stop();\n //Remove event listener\n d3.select(\"body\").on(\"mousedown.reel\", null);\n })\n */\n}", "function initialize() {\n\t\t\n\t\tsvg = scope.selection.append(\"svg\").attr(\"id\", scope.id).style(\"overflow\", \"visible\").attr(\"class\", \"vizuly\");\n\t\tbackground = svg.append(\"rect\").attr(\"class\", \"vz-background\");\n\t\tdefs = vizuly2.util.getDefs(viz);\n\t\tplot = svg.append('g');\n\t\t\n\t\tscope.dispatch.apply('initialized', viz);\n\t}", "async function main() {\n new p5((p_) => {\n p = p_;\n p.setup = setup;\n p.draw = draw;\n }, elements.container);\n\n // Settings\n const lineSettings = gui.addFolder('Line');\n lineSettings.add(settings, 'radius', 10, 800).step(1).onChange(redraw);\n lineSettings\n .add(settings, 'lineControlPoint', 5, 25)\n .step(1)\n .onChange(redraw);\n lineSettings.add(settings, 'lineWidth', 1, 10).step(1).onChange(redraw);\n lineSettings.add(settings, 'yStep', 1, 100).step(1).onChange(redraw);\n\n const noiseSettings = gui.addFolder('Noise');\n noiseSettings.add(settings, 'noiseSpeed', 0.1, 1).step(0.1).onChange(redraw);\n noiseSettings.add(settings, 'noiseXStep', 0.1, 10).step(0.1).onChange(redraw);\n noiseSettings\n .add(settings, 'noiseYFactor', 0.01, 1)\n .step(0.01)\n .onChange(redraw);\n\n const viewSettings = gui.addFolder('View');\n viewSettings.addColor(settings, 'bgColor').listen().onChange(redraw);\n viewSettings.addColor(settings, 'lineColorUp').listen().onChange(redraw);\n viewSettings.addColor(settings, 'lineColorDown').listen().onChange(redraw);\n viewSettings.add(settings, 'randomizeColors');\n\n gui.add(settings, 'redraw');\n gui.add(settings, 'saveImage');\n gui.close();\n\n if (ENABLE_STATS) {\n stats.showPanel(0);\n elements.stats.appendChild(stats.dom);\n }\n}", "init() {\n\n\n\t\t\t\tChart.resize();\n\t\t\t\tChart.render();\n\t\t\t}", "function main() {\r\n init();\r\n draw();\r\n}", "function visualize(theData){\r\n\t// Part 1: Essential Local Variables and Functions\r\n\t// ===============================================\r\n\t// curX and curY will determine what data get's represented in each axis\r\n\r\n}", "function init() {\n\n svg = d3\n .select(\"#d3-container-1\")\n .append(\"svg\")\n\n draw(); // calls the draw function\n }", "function setup() {\n\tpixelDensity(HD);\n\tcnv = createCanvas(100, 100);\n\tcnv.parent(\"bottomCenter\");\n\tplot1 = new GPlot(this);\n\tplot1.setPos(10, 0);\n\tplot1.setOuterDim(100, 100);\n\tplot1.setYLim(0, 1);\n\tplot1.getXAxis().getAxisLabel().setText(\"time (s)\");\n\tplot1.getYAxis().getAxisLabel().setText(\"mass of ice melted (g)\");\n\tplot1.getTitle().setText(\"mass of ice melted\");\n\n\tplot2 = new GPlot(this);\n\tplot2.setPos(10, 0);\n\tplot2.setOuterDim(100, 100);\n\tplot2.setYLim(0, 400);\n\tplot2.getXAxis().getAxisLabel().setText(\"time (s)\");\n\tplot2.getYAxis().getAxisLabel().setText(\"temperature (°C)\");\n\tplot2.getTitle().setText(\"temperature of blocks\");\n\n\tsmooth();\n }", "function makeVis() {\n ScatterPlot = new ScatterPlot(\"scatter_plot\", all_data, lottery_data, round_1_data, round_2_data);\n Slider = new Slider('slider', all_data);\n\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}", "function init() {\n\n getCourses(program);\n getPreqs(courses);\n drawGraph();\n\n //set zoom view level\n zoomOut();\n\n //loading done\n $('#spin1').hide();\n}", "function setup() {\n createCanvas(windowWidth, windowHeight);\n setStationLocations();\n initDots();\n}", "function drawViz(){\n\n let currentYearData = incomingData.filter(filterYear);\n console.log(\"---\\nthe currentYearData array now carries the data for year\", currentYear);\n\n\n // Below here is where your coding should take place! learn from lab 6:\n // https://github.com/leoneckert/critical-data-and-visualization-spring-2020/tree/master/labs/lab-6\n // the three steps in the comments below help you to know what to aim for here\n\n // bind currentYearData to elements\n function getGroupLocation(d,i){\n let x = xScale(d.fert);\n let y = yScale(d.life);\n return \"translate(\" + x + \",\" + y + \")\";\n }\n\n let datagroups = vizGroup.selectAll(\".datagroup\").data(currentYearData,function(d,i){\n console.log(d.Country);\n return d.Country;\n });\n\n // take care of entering elements\n let enteringElements = datagroups.enter()\n .append(\"g\")\n .attr(\"class\",\"datagroup\")\n ;\n\n enteringElements.append(\"circle\")\n .attr(\"r\",10)\n .attr(\"fill\",color)\n ;\n\n enteringElements.append(\"text\")\n .text(function(d,i){\n return d.Country;\n })\n .attr(\"x\",12)\n .attr(\"y\",7)\n .attr(\"font-family\",\"sans-serif\")\n .attr(\"font-size\",\"15px\")\n .attr(\"fill\",\"purple\")\n ;\n\n // take care of updating elements\n enteringElements.transition().attr(\"transform\",getGroupLocation);\n datagroups.transition().ease(d3.easeLinear).attr(\"transform\",getGroupLocation);\n\n function color(d,i){\n country = d.Country;\n if (country == \"Afghanistan\" || country == \"Albania\" || country == \"Algeria\" || country == \"Angola\" || country == \"Argentina\" || country == \"Australia\" || country == \"Austria\"){\n color = \"#9FE7F7\";\n }else if (country == \"Bahrain\" || country == \"Bangladesh\" || country == \"Belgium\" || country == \"Benin\" || country == \"Bolivia\" || country == \"Bosnia and Herzegovina\" || country == \"Botswana\" || country == \"Brazil\" || country == \"Bulgaria\" || country == \"Burkina Faso\" || country == \"Burundi\"){\n color = \"#F7D59F\";\n }else if (country == \"Cambodia\" || country == \"Cameroon\" || country == \"Canada\" || country == \"Central African Republic\" || country == \"Chad\" || country == \"Chile\" || country == \"China\" || country == \"Colombia\" || country == \"Comoros\" || country == \"Congo, Dem. Rep.\" || country == \"Congo, Rep.\" || country == \"Costa Rica\" || country == \"Cote d'Ivoire\" || country == \"Croatia\" || country == \"Cuba\" || country == \"Czech Republic\"){\n color = \"#F7F39F\"\n }else if (country == \"Denmark\" || country == \"Djibouti\" || country == \"Dominican Republic\" ){\n color = \"#D9F99C\"\n }else if (country == \"Ecuador\" || country == \"Egypt\" || country == \"El Salvador\" || country == \"Equatorial Guinea\" || country == \"Eritrea\" || country == \"Ethiopia\" ){\n color = \"#C1C1FB\"\n }else if (country == \"Finland\" || country == \"France\" ){\n color = \"#EFC1FB\"\n }else if (country == \"Gabon\" || country == \"Gambia\" || country == \"Germany\" || country == \"Ghana\" || country == \"Greece\" || country == \"Guatemala\" || country == \"Guinea\" || country == \"Guinea-Bissau\" ){\n color = \"#C1DFFB\"\n }else if (country == \"Haiti\" || country == \"Honduras\" || country == \"Hong Kong, China\" || country == \"Hungary\"){\n color = \"#3297F6\"\n }else if (country == \"Iceland\" || country == \"India\" || country == \"Indonesia\" || country == \"Iran\" || country == \"Iraq\" || country == \"Ireland\" || country == \"Israel\" || country == \"Italy\"){\n color = \"#6FFBAC\"\n }else if (country == \"Jamaica\" || country == \"Japan\" || country == \"Jordan\" ){\n color = \"#FBD86F\"\n }else if (country == \"Kenya\" || country == \"Kuwait\" ){\n color = \"#FEA4B2\"\n }else if (country == \"Lebanon\" || country == \"Lesotho\" || country == \"Liberia\" || country == \"Libya\"){\n color = \"#FC6179\"\n }else if (country == \"Madagascar\" || country == \"Malawi\" || country == \"Malaysia\" || country == \"Mali\" || country == \"Mauritania\" || country == \"Mauritius\" || country == \"Mexico\" || country == \"Mongolia\" || country == \"Montenegro\" || country == \"Morocco\" || country == \"Mozambique\" || country == \"Myanmar\" ){\n color = \"#F7A5E4\"\n }else if (country == \"Namibia\" || country == \"Nepal\" || country == \"Netherlands\" || country == \"New Zealand\" || country == \"Nicaragua\" || country == \"Niger\" || country == \"Nigeria\" || country == \"Norway\"){\n color = \"#4E62F7\"\n }else if (country == \"Oman\"){\n color = \"#4EF7E5\"\n }else if (country == \"Pakistan\" || country == \"Panama\" || country == \"Paraguay\" || country == \"Peru\" || country == \"Philippines\" || country == \"Poland\" || country == \"Portugal\" || country == \"Puerto Rico\" ){\n color = \"#D2AF6D\"\n }else if (country == \"Reunion\" || country == \"Romania\" || country == \"Rwanda\"){\n color = \"#6DD295\"\n }else if (country == \"Sao Tome and Principe\" || country == \"Saudi Arabia\" || country == \"Senegal\" || country == \"Serbia\" || country == \"Sierra Leone\" || country == \"Singapore\" || country == \"Slovak Republic\" || country == \"Slovenia\" || country == \"Somalia\" || country == \"South Africa\" || country == \"Spain\" || country == \"Sri Lanka\" || country == \"Sudan\" || country == \"Swaziland\" || country == \"Sweden\" || country == \"Switzerland\" || country == \"Syria\"){\n color = \"#D2976D\"\n }else if (country == \"Taiwan\" || country == \"Tanzania\" || country == \"Thailand\" || country == \"Togo\" || country == \"Trinidad and Tobago\" || country == \"Tunisia\" || country == \"Turkey\"){\n color = \"#6D6FD2\"\n }else if (country == \"Uganda\" || country == \"United Kingdom\" || country == \"United States\" || country == \"Uruguay\"){\n color = \"#74C443\"\n }else if (country == \"Venezuela\" || country == \"Vietnam\"){\n color = \"#E88022\"\n }else if (country == \"West Bank and Gaza\"){\n color = \"#139236\"\n }else if (country == \"Zambia\" || country == \"Zimbabwe\"){\n color = \"white\"\n }\n return color;\n }\n\n }", "function initialize() {\n\n // Here we set our <code>viz</code> variable by instantiating the <code>vizuly.viz.corona</code> function.\n // All vizuly components require a parent DOM element at initialization so they know where to inject their display elements.\n viz = vizuly.viz.halo_cluster(document.getElementById(\"viz_container\"));\n\n viz.data(data)\n .width(800).height(600) // Initial display size\n .haloKey(function (d) {\n return d.CMTE_ID; }) // The property that determines each PAC\n .nodeKey(function (d) {\n return d.CAND_ID; }) // The property that determines Candidate\n .nodeGroupKey(function (d) {\n return d.PTY; }) // The property that determines candidate Party affiliation\n .value(function (d) {\n return Number(d.TRANSACTION_AMT); }) // The property that determines the weight/size of the link path\n .on(\"update\", onUpdate) // Callback for viz update\n .on(\"nodeover\",node_onMouseOver) // Callback for mouseover on the candidates\n .on(\"nodeout\",onMouseOut) // Callback for mouseout on from the candidate\n .on(\"arcover\",arc_onMouseOver) // Callback for mouseover on each PAC\n .on(\"arcout\",onMouseOut) // Callback for mouseout on each PAC\n .on(\"linkover\",link_onMouseOver) // Callback for mousover on each contribution\n .on(\"linkout\",onMouseOut) // Callback for mouseout on each contribution\n .on(\"nodeclick\",node_onClick)\n\n //** Themes and skins ** play a big role in vizuly, and are designed to make it easy to make subtle or drastic changes\n //to the look and feel of any component. Here we choose a theme and skin to use for our bar chart.\n // *See this <a href=''>guide</a> for understanding the details of themes and skins.*\n theme = vizuly.theme.halo(viz);\n\n // This example shows how you can use a custom skin and add it to the theme.\n // You can see how this skin is made at the end of this file.\n theme.skins()[\"custom\"]=customSkin;\n theme.skin(\"custom\");\n\n //The <code>viz.selection()</code> property refers to the parent\n //container that was used at the object construction. With this <code>selection</code> property we can use D3\n //add, remove, or manipulate elements within the component. In this case we add a title label and heading to our chart.\n viz_title = viz.selection().select(\"svg\").append(\"text\").attr(\"class\", \"title\")\n .style(\"font-family\",\"Raleway\")\n .attr(\"x\", viz.width() / 2).attr(\"y\", 40).attr(\"text-anchor\", \"middle\").style(\"font-weight\",300).text(\"\"); // TITLE\n\n //Update the size of the component\n changeSize(d3.select(\"#currentDisplay\").attr(\"item_value\"));\n\n /*\n // This code is for the purposes of the demo and simply cycles through the various skins\n // The user can stop this by clicking anywhere on the page.\n var reel = vizuly.showreel(theme,['Fire','Sunset','Neon','Ocean','custom'],2000).start();\n d3.select(\"body\").on(\"mousedown.reel\",function () {\n //Stop show reel\n reel.stop();\n //Remove event listener\n d3.select(\"body\").on(\"mousedown.reel\",null);\n })\n */\n}", "function setup() {\n // http://datamx.io/dataset/salario-minimo-historico-1877-2019\n loadTable('../../data/mx_salariominimo_1877-2019.csv', 'csv', 'header', gotData);\n createCanvas(windowWidth, windowHeight);\n}", "function setup() {\n createCanvas(1600, 1900);\n setupUI();\n angleMode(DEGREES);\n colorMode(HSB);\n rectMode(CORNER);\n noStroke();\n loadJSON(\"P2stateCensusData.json\", readStates, fileMistake);\n\n //loadJSON(\"usDeaths2020.json\"); //COVID data\n\n /* creates a default selection */\n uiBoss.radio.selected(\"race\");\n uiBoss.checkbox1.checked(true);\n uiBoss.checkbox2.checked(true);\n}", "function init() {\n d3.json(\"samples.json\").then(function(data){\n buildPlots(data.names[0]);\n buildDemo(data.names[0]);\n })}", "function render() {\n if (window._env === 'development') console.debug('RENDER');\n initDynamicSentence();\n initMapChart();\n initHighcharts();\n initBubbleChart();\n initSankeyChart();\n initBubbleChart();\n initTableBody();\n }", "function initDashboard() {\n console.log(\"Initializing Screen\");\n \n // The Initialize function needs to do the following:\n // Populate the dropdown box with all the IDs - create variable to select the dropdown\n var selector = d3.select(\"#selDataset\");\n\n // Read json file with data, then populate the dropdown using the key from the data (names in this case)\n d3.json(\"samples.json\").then((data) => {\n var sampleNames = data.names;\n\n // For each sample, use the value from the key to populate the contents of the dropdown box -\n // append an option to it, set text to it and assign a property\n sampleNames.forEach((sampleID) => { \n selector\n .append(\"option\") \n .text(sampleID)\n .property(\"value\", sampleID); \n });\n \n var sampleID = sampleNames[0];\n\n // Populate Demographic Information\n showDemographicInfo(sampleID);\n // Draw bargraph\n drawBarGraph(sampleID);\n // // Draw bubble chart\n drawBubbleChart(sampleID);\n\n });\n\n }", "function draw(datatable) {\n // Define look and feel parameters using options object to override defaults.\n var width = options.width || 300;\n var backgroundColor = options.backgroundColor;\n var globalStyle = options.globalStyle || {fontFamily:'sans-serif'};\n var titleStyle = options.titleStyle || {fontWeight:'bold'};\n var captionStyle = options.captionStyle || {fontSize:'0.70em'};\n var powerRange = options.powerRange || 6000;\n var title = options.title || source;\n\n // Create a datatable with this source's data and baseline.\n datatable = addBaseline(datatable);\n\n // Get the top-level div where this visualization should go.\n element = document.getElementById(viz_id);\n\n // Now add the elements.\n addGlobalStyle(element, backgroundColor, width, globalStyle);\n addTitleDiv(element, viz_id, title, titleStyle);\n addMeterDiv(element, viz_id, datatable, backgroundColor, width, powerRange);\n addCaptionDiv(element, viz_id, captionStyle, datatable);\n }", "function main() {\n init(fontSize);\n\n renderModel = ReadModel();\n renderUI = ReaderBaseFrame(RootContainer);\n renderModel.init(function (data) {\n renderUI(data);\n });\n\n EventHandler();\n }", "function setup() { //things that need to be done only once\n createCanvas(960, 540); \n initializeCensus('MY_API_KEY'); \n requestUSData(dataYear, povertyCode);\n requestUSData(dataYear, totalCode);\n requestUSMap();\n //stateColor = color('#18759e');\n //changes colorMode in order to create a gradient\n colorMode(HSB);\n\n //Loop to go through different data years \n //for (var i = 0, i < dataYears.length; i++){\n //dataYear(i); \n //}\n}", "function initialize() {\n\tinitialColorScale(imageData);\n\tloadIconImages(imageData);\n\tdrawBarChart(imageData);\n\tdrawSliderBar(imageData);\n\tdrawTreemap(imageData);\n}", "function setup() {\r\n createCanvas(windowWidth, windowHeight);\r\n noStroke();\r\n }", "function setup() {\n println(\"done\")\n println(\"setting up canvas\")\n createCanvas(windowWidth, windowHeight);\n colorMode(HSB, 100);\n println(\"done\")\n setupTitles();\n getTweets();\n createHashtag();\n}", "function _drawVisualization() {\n // Create and populate a data table.\n var data = new google.visualization.DataTable();\n data.addColumn('datetime', 'start');\n data.addColumn('datetime', 'end');\n data.addColumn('string', 'content');\n data.addColumn('string', 'group');\n\n var date = new Date(2014, 04, 25, 8, 0, 0);\n\n var loader_text = '<img src=\"/res/qsl/img/loader33x16.png\" width=\"33px\" height=\"16px\"> L-105';\n var inspe_text =\n '<div title=\"Inspection\" class=\"order\">' +\n '<i class=\"fa fa-lg fa-wrench\"></i> ' +\n 'Inspection' +\n '</div>';\n var inspe_start = new Date(date);\n var inspe_end = new Date(date.setHours(date.getHours() + 6));\n\n data.addRow([inspe_start, inspe_end, inspe_text, loader_text]);\n\n var vessl_text =\n '<div title=\"Snoekgracht\" class=\"order\">' +\n '<i class=\"fa fa-lg fa-anchor\"></i> ' +\n 'Snoekgracht' +\n '</div>';\n var inspe_start = new Date(date.setHours(date.getHours() + 6));\n var inspe_end = new Date(date.setHours(date.getHours() + 48));\n\n data.addRow([inspe_start, inspe_end, vessl_text, loader_text]);\n\n // specify options\n var options = {\n width: \"100%\",\n //height: \"300px\",\n height: \"auto\",\n layout: \"box\",\n editable: true,\n eventMargin: 5, // minimal margin between events\n eventMarginAxis: 0, // minimal margin beteen events and the axis\n showMajorLabels: false,\n axisOnTop: true,\n // groupsWidth : \"200px\",\n groupsChangeable: true,\n groupsOnRight: false,\n stackEvents: false\n };\n\n // Instantiate our timeline object.\n that.timeline = new links.Timeline(document.getElementById(that.optio.vva_id_regn));\n\n // Draw our timeline with the created data and options\n that.timeline.draw(data, options);\n }", "init() {\n // Add label\n $sel.append('text')\n .text(d => `${d.key}`)\n\n const container = $sel.append('div.container')\n\n // Add svg for front pockets\n\t\t\t\t$svgFront = container.append('svg.area-front');\n\t\t\t\tconst $gFront = $svgFront.append('g');\n\n\t\t\t\t// setup viz group\n\t\t\t\t$visFront = $gFront.append('g.g-vis');\n\n // Add svg for back pockets\n $svgBack = container.append('svg.area-back');\n const $gBack = $svgBack.append('g');\n\n // setup viz group\n $visBack = $gBack.append('g.g-vis');\n\n\t\t\t\tChart.resize();\n\t\t\t\tChart.render();\n\t\t\t}", "function initializeVisualization(createStaticElements) {\n d3.json(\"data/\" + global.dataset.file, function(data) {\n // Cache the dataset\n global.papers = data.papers;\n\n // Initialize some global parameters\n global.computeOldestLatestPublicationYears();\n global.computeMedianMaximalNormalizedCitationCountsPerYear();\n\n // Restore data from previous session\n sessionManager.loadPreviousSession();\n\n // If no seed papers, won't do anything\n algorithm.updateFringe();\n view.initializeView(createStaticElements);\n\n // setup autocomplete popup\n $('#dialog .typeahead').typeahead({\n hint: true,\n highlight: true,\n minLength: 3\n }, {\n name: 'titles',\n displayKey: 'value',\n source: substringMatcher(Object.keys(global.papers)\n .map(function(doi) {\n return global.papers[doi].title;\n }))\n });\n });\n}", "function initializeVisualization(campaign, state, board) {\n\n initHintModal(board)\n\n drawBoardContainer(board)\n drawCells(board)\n drawInitMarkers(board)\n drawTraps(board)\n\n // TODO: refactor so that you pass board as a param\n drawCoins()\n drawBots()\n drawBlocks()\n}", "function setup() {\n createCanvas(windowWidth, windowHeight);\n\n // Center our drawing objects\n imageMode(CENTER);\n textAlign(CENTER);\n textSize(24);\n\n // set to one for startup\n drawFunction = drawOne;\n}", "function setupGraph() {\n graphImg = d3\n .select(\"#plotarea\")\n .append(\"svg\")\n .attr(\"width\", displayWidth)\n .attr(\"height\", displayHeight)\n .attr(\"class\", \"chart\");\n\n // X - Axis\n // We create a group element to nest our bottom axes labels.\n graphImg.append(\"g\").attr(\"class\", \"xText\");\n graphImg.append(\"g\").attr(\"class\", \"yText\");\n}", "init() {\n\t\t\t\tstructureData()\n\t\t\t\ttyper.prepare($trendText1);\n\t\t\t\ttyper.prepare($trendText2);\n\t\t\t\ttyper.prepare($outro1);\n\n\t\t\t\twidth = $sel.node().offsetWidth - marginLeft - marginRight;\n\t\t\t\theight = $sel.node().offsetHeight - marginTop - marginBottom;\n\n\t\t\t\t$svg = $sel.append('svg')\n\t\t\t\t\t.attr('class', 'pudding-chart')\n\t\t\t\t\t.attr('width', width + marginLeft + marginRight)\n\t\t\t\t\t.attr('height', height + marginTop + marginBottom);\n\n\t\t\t\tconst $g = $svg.append('g');\n\n\t\t\t\t// offset chart for margins\n\t\t\t\t$g.attr('transform', `translate(${marginLeft}, ${marginTop})`);\n\n\t\t\t\t// create axis\n\t\t\t\t$axis = $svg.append('g').attr('class', 'g-axis');\n\n\t\t\t\txAxisGroup = $axis.append('g')\n\t\t\t\t\t.attr('class', 'x axis')\n\t\t\t\t\t.attr('transform', `translate(${marginLeft},${height})`)\n\n\t\t\t\tyAxisGroup = $axis.append('g')\n\t\t\t\t\t.attr('class', 'y axis')\n\n\t\t\t\txScale\n\t\t\t\t\t.domain([minX, maxX])\n\t\t\t\t\t.range([0, width])\n\n\t\t\t\tyScale\n\t\t\t\t\t.domain([0, maxY])\n\t\t\t\t\t.range([height, 0])\n\n\t\t\t\txAxis = d3\n\t\t\t\t\t.axisBottom(xScale)\n\t\t\t\t\t.tickPadding(8)\n\t\t\t\t\t.ticks(10)\n\t\t\t\t\t.tickFormat(d3.format('d'))\n\n\t\t\t\tyAxis = d3\n\t\t\t\t\t.axisLeft(yScale)\n\t\t\t\t\t.tickPadding(8)\n\t\t\t\t\t.tickSize(-width)\n\t\t\t\t\t.ticks(8)\n\n\t\t\t\t$axis.select('.x')\n\t\t\t\t\t.attr('transform', `translate(${marginLeft},510)`)\n\t\t\t\t\t.call(xAxis);\n\n\t\t\t\t$axis.select('.y')\n\t\t\t\t\t.attr('transform', `translate(${marginLeft + 20},0)`)\n\t\t\t\t\t.call(yAxis);\n\n\t\t\t\t// setup viz group\n\t\t\t\t$vis = $g.append('g').attr('class', 'g-vis');\n\n\t\t\t\tgenderLines = d3.line()\n\t\t\t\t\t.x(d => xScale(d.year))\n\t\t\t\t\t.y(d => yScale(d.flat))\n\n\t\t\t\tgenderArea = d3.area()\n\t\t\t\t\t.x(d => xScale(d.key))\n\t\t\t\t\t.y0(d => yScale(d.value.female))\n\t\t\t\t\t.y1(d => yScale(d.value.male))\n\n\t\t\t\tdrawArea = $vis.append('path')\n\t\t\t\t\t.datum(dataByYear)\n\t\t\t\t\t.attr('class', 'area')\n\t\t\t\t\t.attr('d', genderArea)\n\n\t\t\t\tlineGroup = $svg.select('.g-vis')\n\n\t\t\t\tfemaleLine = lineGroup.append('path')\n\t\t\t\t\t.datum(femaleData)\n\t\t\t\t\t.attr('class', 'Female')\n\t\t\t\t\t.attr('d', genderLines)\n\n\t\t\t\tmaleLine = lineGroup.append('path')\n\t\t\t\t\t.datum(maleData)\n\t\t\t\t\t.attr('class', 'Male')\n\t\t\t\t\t.attr('d', genderLines)\n\n\t\t\t\tconst xTicks = d3.selectAll('.x.axis text')\n\n\t\t\t\txTicks.attr('transform', `translate(32,0)`)\n\n\t\t\t}", "function startVisualization(data) {\n /*****************************************************************************\n * Extract data\n *****************************************************************************/\n\n // United States topojson\n let unitedStates = data[0] // Unpack data\n\n // Convert the read csv to a lookup table to map FIPS to county name\n let fips2County = {}\n data[1].forEach((item, index) => {\n fips2County[item[\"fips\"]] = item[\"county_name\"];\n })\n\n /*****************************************************************************\n * Select HTML elements\n *****************************************************************************/\n\n let svg = d3.select(\"#wildfire-visualization\")\n .append('svg')\n .attr(\"width\", width)\n .attr(\"height\", height);\n\n let svgLegend = d3.select(\"#legend\")\n .append('svg')\n .attr(\"width\", '100%')\n .attr(\"height\", '600')\n\n let wildfireCheckbox = document.getElementById('wildfire-checkbox');\n let fuelRadioButton = document.getElementById('fuel-radio');\n let tempRadioButton = document.getElementById('temperature-radio')\n let rainRadioButton = document.getElementById('rain-radio');\n let windRadioButton = document.getElementById('wind-radio');\n let mlpredsRadioButton = document.getElementById('mlpreds-radio');\n\n\n /*****************************************************************************\n * Append a marker definition\n *\n * https://stackoverflow.com/questions/36579339/how-to-draw-line-with-arrow-using-d3-js\n * or\n * https://observablehq.com/@harrylove/draw-an-arrowhead-marker-connected-to-a-line-in-d3\n *****************************************************************************/\n svg.append(\"svg:defs\").append(\"svg:marker\")\n .attr(\"id\", \"triangle\")\n .attr(\"refX\", 2)\n .attr(\"refY\", 2)\n .attr(\"markerWidth\", 10)\n .attr(\"markerHeight\", 20)\n .attr(\"orient\", \"auto\")\n .append(\"path\")\n .attr(\"d\", \"M 0 0 4 2 0 4 1 2\")\n .style(\"fill\", \"black\");\n\n const projection = d3.geoAlbersUsa()\n\n /**\n * This function augments the projection defined above because it sometimes just\n * returns `null` when the requested coordinates are outside the specified range.\n * Therefore, just convert them to some value.\n *\n * @param longLat\n * @returns {number[]|*}\n */\n const safeProjection = longLat =>\n {\n let p = projection(longLat);\n if (p != null) return p;\n else return [-width, -height];\n }\n\n const pathGenerator = d3.geoPath().projection(projection);\n\n let tip = d3.tip()\n .attr('class', 'd3-tip')\n .offset([-8, -6])\n .html(d => {\n let id = d.id;\n return `${fips2County[id]}`;\n });\n\n // The group for wildfire visualization\n const g = svg.append('g');\n g.call(tip);\n\n // The group for legend\n const legendGroup = svgLegend.append('g');\n\n function countyColor(d) {\n const defaultColor = 'rgb(194,194,194)';\n\n let fips = d.id;\n\n if (tempRadioButton.checked) {\n if (lastDataFromBackend.fipsToTempPrecp.hasOwnProperty(fips)) {\n let tavg = lastDataFromBackend.fipsToTempPrecp[fips].tavg;\n return temperatureQuantileScale(tavg);\n }\n }\n\n if (rainRadioButton.checked) {\n if (lastDataFromBackend.fipsToTempPrecp.hasOwnProperty(fips)) {\n let prcp = lastDataFromBackend.fipsToTempPrecp[fips].prcp;\n return precpQuantileScale(prcp);\n }\n }\n\n if (mlpredsRadioButton.checked) {\n\n //yand add \n wildfireCheckbox.checked = false;\n\n if (lastDataFromBackend.fipsToMLPreds.hasOwnProperty(fips)) {\n let pred = lastDataFromBackend.fipsToMLPreds[fips].predicted_class;\n // debugging\n // window.alert(pred) //correct\n // mlpredsOrdinalScale(pred) bug\n return ml_color[pred];\n }\n }\n\n // none of these radio buttons is checked\n return defaultColor;\n }\n\n /**\n * Redraw the counties. This function depends on the global variable and\n * other variables defined outside it, especially for updating choropleth colors.\n */\n function redrawCounties(group) {\n let update = group.selectAll('path .counties')\n .data(topojson.feature(unitedStates, unitedStates.objects.counties).features);\n\n update.enter().append('path')\n .attr('class', 'counties')\n .attr('stroke', 'white')\n .attr('stroke-width', '0.5')\n .attr('d', pathGenerator)\n .on('mouseover', tip.show)\n .on('mouseout', tip.hide)\n .merge(update)\n .attr('fill', countyColor({'id': 'We need to draw the base color first'}))\n .attr('fill', countyColor);\n\n update.exit().remove();\n\n const stateBorderColor = 'rgba(56,56,56,0.5)';\n\n let stateUpdate = g.selectAll('path .states')\n .data(topojson.feature(unitedStates, unitedStates.objects.states).features);\n\n stateUpdate.enter().append('path')\n .attr('class', 'states')\n .attr('fill', 'None')\n .attr('d', pathGenerator)\n .merge(stateUpdate)\n .attr('stroke-width', '1')\n .attr('stroke', stateBorderColor)\n }\n\n /**\n * This function is used to redraw all the map. It handles which layers need to be drawn first to last.\n *\n * @param group\n * @param legendGroup\n */\n function redrawAll(group, legendGroup) {\n // For choropleth: temperature, precipitation, and ml predictions\n redrawCounties(group);\n\n let dataSelected = \"\"\n\n if (tempRadioButton.checked) dataSelected = \"temperature\";\n if (rainRadioButton.checked) dataSelected = \"precipitation\";\n if (mlpredsRadioButton.checked) dataSelected = \"mlpredictions\"\n\n if (fuelRadioButton.checked) {\n drawFuel(group, lastDataFromBackend['fuel'], safeProjection);\n dataSelected = \"fuel\";\n } else drawFuel(group, [], safeProjection);\n\n if (windRadioButton.checked) {\n drawWind(group, lastDataFromBackend['wind'], safeProjection);\n dataSelected = \"wind\";\n } else drawWind(group, [], safeProjection);\n\n if (wildfireCheckbox.checked) {\n drawWildfires(group, lastDataFromBackend['wildfire'], safeProjection);\n // yang added \n mlpredsRadioButton.checked = false;\n // document.getElementById('timeSelected').backgroundColor = \"red\";\n\n } else {\n drawWildfires(group, [], safeProjection);\n }\n\n\n drawLegend(legendGroup, dataSelected);\n }\n\n let slider = document.getElementById('timeSelector');\n $(slider).attr('step', 1.0/daysInYear); // Set the tolerance to a month\n\n slider.addEventListener('input', sliderInput);\n slider.addEventListener('change', sliderChange);\n\n // Update the displayed time with the initial value\n // This will also trigger the data request from the backend.\n sliderInput(null);\n sliderChange(null);\n\n wildfireCheckbox.addEventListener('change', e => {redrawAll(g, legendGroup);});\n fuelRadioButton.addEventListener('change', e => {redrawAll(g, legendGroup);});\n tempRadioButton.addEventListener('change', e => {redrawAll(g, legendGroup);});\n rainRadioButton.addEventListener('change', e => {redrawAll(g, legendGroup);});\n windRadioButton.addEventListener('change', e => {redrawAll(g, legendGroup);});\n mlpredsRadioButton.addEventListener('change', e => {redrawAll(g, legendGroup); });\n\n\n socket.on('connect', ()=>{\n socket.emit('data request', {'time': +(document.getElementById('timeSelector').value)})\n })\n\n /**\n * This function is called when there is some data broadcast from the Python\n * backend to the web browser.\n *\n * The wildfire visualization is updated as per the data returned by the backend.\n */\n socket.on('data broadcast', dataFromBackend => {\n // Update the global variable\n lastDataFromBackend = dataFromBackend\n\n let tempPrecp = dataFromBackend['temp_precp']\n\n // Create a lookup table from FIPS -> Temperature and precipitation\n let fipsToTempPrecp = {};\n tempPrecp.forEach(item => {\n fipsToTempPrecp[item[\"county_fips\"]] = {tmax: item.tmax, tmin: item.tmin, tavg: item.tavg, prcp: item.prcp};\n });\n lastDataFromBackend['fipsToTempPrecp'] = fipsToTempPrecp;\n\n let fipsToMLPreds = {};\n let mlPreds = dataFromBackend['mlpreds'];\n mlPreds.forEach(item => {\n fipsToMLPreds[item['fips']] = {predicted_class: item.predicted_class};\n })\n\n lastDataFromBackend['fipsToMLPreds'] = fipsToMLPreds;\n\n redrawAll(g, legendGroup);\n });\n}", "function display(data) {\n \n // create a new plot and\n // display it\n plot = scrollVis();\n d3.select('#vis')\n .datum(data)\n .call(plot);\n\n // setup scroll functionality\n var scroll = scroller().container(d3.select('#graphic'));\n scroll(d3.selectAll('.step'));\n \n // setup event handling\n scroll.on('active', function (index) {\n\n if( tjb.isReloaded==true ){\n index = 0;\n tjb.isReloaded=false;\n }\n else{\n index = index;\n }\n \n onScrolling(index);\n });\n}", "function visualiseData(data) {\n\n //some test logs\n console.log(data);\n\n //appending the svg 'canvas'\n var graph_l = d3.select(\"#dataVis\").append(\"svg\")\n .attr(\"width\", '50%')\n .attr(\"height\", height + margin.top + margin.bottom)\n .append(\"g\")\n .attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\n\n var graph_r = d3.select(\"#dataVis\").append(\"svg\")\n .attr(\"width\", '50%')\n .attr(\"height\", height + margin.top + margin.bottom)\n .append(\"g\")\n .attr(\"transform\", \"translate(\" + 5 + \",\" + margin.top + \")\");\n axisUpdateExample1()\n\n // setting bases variables for dynamic axes\n var xScale = d3.scaleTime();\n var yScale = d3.scaleLinear();\n\n var xAxisCall = d3.axisBottom()\n var yAxisCall = d3.axisLeft()\n\n //appending the axes to the graphs\n initAxis();\n\n\n graph_l.append(\"text\")\n .attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", 0 - margin.left)\n .attr(\"x\", 0 - (height / 2))\n .attr(\"dy\", \"1.25em\")\n .attr('class', 'yLabel')\n .style(\"text-anchor\", \"middle\")\n .text(\"Temperatur in °C\");\n\n //appending the 2 constants\n appendConstants();\n\n //calculated data graph\n graph_r.append(\"g\")\n .attr(\"transform\", \"translate(0,\" + height + \")\")\n .attr(\"class\", 'axis')\n .call(xAxisCalc);\n\n graph_r.append(\"g\")\n .attr(\"class\", 'axis')\n .call(yAxisCalc);\n\n\n var line = d3.line()\n .x(function (d, i) {\n if (i <= 0) {\n };\n if (i < 31) {\n return x(i);\n }\n })\n .y(function (d, i) { return y(d.DATA) });\n\n\n // graphline gets constructed here\n graph_l.append(\"path\")\n .data([data])\n .attr(\"class\", \"line\")\n .attr(\"d\", line(data));\n\n\n setInterval(function () {\n\n var v = data.slice(0, 10);\n data.push(v);\n\n redrawWithAnimation();\n\n axisUpdater(data);\n\n computeOilQuality(data[0].werte.Tavg_temp, data[0].werte.Qualitaetsgrenze);\n\n\n\n drawValues(data[29]);\n\n }, 10000)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n function axisUpdater(data) {\n\n setScale(data);\n updateAxis();\n\n function updateAxis() {\n var t = d3.transition()\n .duration(500)\n\n svg.select(\".x\")\n .transition(t)\n .call(xAxisCall)\n\n svg.select(\".y\")\n .transition(t)\n .call(yAxisCall)\n\n }\n\n function setScale(data) {\n\n xScale.domain([data[0].datum, data[29].datum]).range([0, width])\n yScale.domain([0, d3.max(data, function (d) { return d.DATA })]).range([height, 0])\n\n\n }\n }\n\n function axisUpdateExample1() {\n var svg = d3.select(\"#example1\")\n\n var xScale = d3.scaleLinear()\n var yScale = d3.scaleLinear()\n\n var xAxisCall = d3.axisBottom()\n var yAxisCall = d3.axisLeft()\n\n\n setScale1()\n initAxis()\n\n\n setInterval(toggle(\n function () {\n setScale2()\n updateAxis()\n },\n function () {\n setScale1()\n updateAxis()\n\n }), 2000)\n\n function setScale1() {\n xScale.domain([0, 1000]).range([0, width - (margin.top + margin.bottom)])\n yScale.domain([0, 1000]).range([height - (margin.top + margin.bottom), 0])\n\n }\n\n function setScale2() {\n xScale.domain([0, 100]).range([0, width - (margin.top + margin.bottom)])\n yScale.domain([0, 100]).range([height - (margin.top + margin.bottom), 0])\n\n }\n\n\n function initAxis() {\n svg.append(\"g\")\n .attr(\"class\", \"x axis\")\n .attr(\"transform\", \"translate(\" + [margin.left, height - margin.top] + \")\")\n .call(xAxisCall)\n\n svg.append(\"g\")\n .attr(\"class\", \"y axis\")\n .attr(\"transform\", \"translate(\" + [margin.left, margin.top] + \")\")\n .call(yAxisCall)\n }\n\n function updateAxis() {\n var t = d3.transition()\n .duration(500)\n\n svg.select(\".x\")\n .transition(t)\n .call(xAxisCall)\n\n svg.select(\".y\")\n .transition(t)\n .call(yAxisCall)\n\n }\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n function initAxis() {\n graph_l.append(\"g\")\n .attr(\"class\", \"x axis\")\n .attr(\"transform\", \"translate(\" + [margin.left, height - margin.top] + \")\")\n .call(xAxisCall)\n\n graph_l.append(\"g\")\n .attr(\"class\", \"y axis\")\n .attr(\"transform\", \"translate(\" + [margin.left, margin.top] + \")\")\n .call(yAxisCall)\n }\n\n\n function redrawWithAnimation() {\n // update with animation\n graph_l.selectAll(\".line\")\n .data([data]) // set the new data\n .attr(\"transform\", \"translate(0,\" + x(1) + \")\") // set the transform to the right by x(1) pixels (6 for the scale we've set) to hide the new value\n .attr(\"d\", line) // apply the new data values ... but the new value is hidden at this point off the right of the canvas\n .transition() // start a transition to bring the new value into view\n\n .duration(10000) // for this demo we want a continual slide so set this to the same as the setInterval amount below\n .attr(\"transform\", \"translate(0,\" + x(0) + \")\"); // animate a slide to the left back to x(0) pixels to reveal the new value\n\n }\n\n\n\n function appendConstants() {\n graph_l.append(\"svg:line\")\n .attr(\"x1\", 0)\n .attr(\"x2\", width)\n .attr(\"y1\", y(75))\n .attr(\"y2\", y(75))\n .style(\"stroke\", \"orange\")\n .style(\"stroke-width\", \"4px\");\n\n graph_l.append(\"svg:line\")\n .attr(\"x1\", 0)\n .attr(\"x2\", width)\n .attr(\"y1\", y(90))\n .attr(\"y2\", y(90))\n .style(\"stroke\", \"red\")\n .style(\"stroke-width\", \"4px\");\n\n graph_r.append(\"svg:line\")\n .attr(\"x1\", 0)\n .attr(\"x2\", width)\n .attr(\"y1\", y(75))\n .attr(\"y2\", y(75))\n .style(\"stroke\", \"orange\")\n .style(\"stroke-width\", \"4px\");\n\n graph_r.append(\"svg:line\")\n .attr(\"x1\", 0)\n .attr(\"x2\", width)\n .attr(\"y1\", y(90))\n .attr(\"y2\", y(90))\n .style(\"stroke\", \"red\")\n .style(\"stroke-width\", \"4px\");\n\n }\n\n\n\n}", "function visualize(data) {\n\n // Configure scales.\n configureScales(data);\n\n var vis = d3.select('#chart')\n .append('svg:svg')\n .attr('width', WIDTH)\n .attr('height', HEIGHT)\n .attr('class', 'zoom');\n\n // Background rect to catch zoom clicks.\n vis.append('svg:rect')\n .attr('class', 'zoom')\n .attr('x', 0)\n .attr('y', 0)\n .attr('width', WIDTH)\n .attr('height', HEIGHT)\n .style('opacity', 0.0);\n\n\n var tempScale = d3.scale.linear()\n .domain([0, 10])\n .range( [0, 100]);\n // Add safety car element.\n //addSafetyElement(vis, data.safety);\n // Add lapped element.\n //addLappedElement(vis, data.lapped);\n\n // Lap tick-lines.\n addLapTickLines(vis, data.lapCount);\n\n //Lap labels.\n addLapLabels(vis, data.lapCount, (SCALES.y.range()[0]) - PADDING.bottom, '0.0em', 'top');\n addLapLabels(vis, data.lapCount, SCALES.y.range()[1] + PADDING.top, '0.35em', 'bottom');\n\n // Add placings poly-lines.\n addPlacingsLines(vis, data.laps);\n\n // Add name labels.\n addDriverLabels(vis, data.laps, 'pole', SCALES.x(0) - PADDING.right, 'end')\n .attr('y', function (d) {\n\n return SCALES.y(d.placing[0] - 1);\n });\n addDriverLabels(vis, data.laps, 'flag', SCALES.x(data.lapCount) + PADDING.left, 'start')\n .attr('y', function (d, i) {\n\n return SCALES.y(i);\n });\n\n // Add markers.\n //addMarkers(vis, data.pitstops, \"pitstop\", \"P\");\n //addMarkers(vis, data.mechanical, \"mechanical\", \"M\");\n addMarkers(vis, data.accident, \"accident\", \"X\");\n\n // Listen for clicks -> zoom.\n vis.selectAll('.zoom')\n .on(\"click\", function() {\n\n toggleZoom(vis, d3.mouse(this)[0]);\n });\n\n\n\n// Get the data\n\n\n // scale the range of the data\n x.domain(d3.extent(data, function(d) { return d.years; }));\n y.domain([0, d3.max(data, function(d) { return d.placing; })]);\n\n \n // add the dots with tooltips\n svg.selectAll(\"dot\")\n .data(data)\n .enter().append(\"circle\")\n .attr(\"r\", 5)\n .attr(\"cx\", function(d) { return x(d.years); })\n .attr(\"cy\", function(d) { return y(d.placing); })\n .on(\"mouseover\", function(d) {\n div.transition()\n .duration(200)\n .style(\"opacity\", .9);\n div.html(formatTime(d.years) + \"<br/>\" + d.placing)\n .style(\"left\", (d3.event.pageX) + \"px\")\n .style(\"top\", (d3.event.pageY - 28) + \"px\");\n })\n .on(\"mouseout\", function(d) {\n div.transition()\n .duration(500)\n .style(\"opacity\", 0);\n });\n\n // add the X Axis\n svg.append(\"g\")\n .attr(\"transform\", \"translate(0,\" + height + \")\")\n .call(d3.axisBottom(x));\n\n // add the Y Axis\n svg.append(\"g\")\n .call(d3.axisLeft(y));\n\n\n\n}", "function draw() {\n\t\t\tdrawGrid();\n\t\t\tdrawLabels();\n\t\t\tfor(var i = 0; i < series.length; i++){\n\t\t\t\tdrawSeries(series[i]);\n\t\t\t}\n\t\t}", "setUp() {\n this.g = d3\n .select(this.root)\n .append(\"g\");\n this.update();\n }", "function main(){\n\t//Initialice with first episode\n\tvar sel_episodes = [1]\n\t//collage(); //Create a collage with all the images as initial page of the app\n\tpaintCharacters();\n\tpaintEpisodes();\n\tpaintLocations(sel_episodes);\n}", "function setup ( ){\n createCanvas( 400, 400 ) ;\n background( 0 ) ;\n \n currWindow = new DataSeries( 50 ) ;\n \n // In constrast to RBG, HSV allows us to adjust the \"hotness\" of colors to correspond\n // to altitudes. This allows 100 possible shades of color\n colorMode ( HSB, 100, 100, 100 ) ;\n \n // Scale the centroid\n centroidY = map( centroidLat, minLat, maxLat, 0, height ) ;\n centroidX = map ( centroidLon, maxLon, minLon, 0, width ) ;\n\n // Use a window of 100 points for now\n currWindow = new DataSeries ( 500 ) ;\n \n // reference points\n var westLong = map ( minLon, minLon, maxLon, 5, width - 5) ;\n var eastLong = map ( maxLon, minLon, maxLon, 5, width - 20) ;\n var northLat = map( minLat, minLat, maxLat, 20, height ) ;\n var southLat = map( maxLat, minLat, maxLat, 5, height - 20 ) ;\n fill( 10, 100, 100 ) ;\n textSize ( 32 ) ;\n text ( \"W\", westLong, 200 ) ;\n text( \"E\", eastLong, 200 ) ;\n text ( \"N\", width / 2, northLat, 40 ) ;\n text ( \"S\", width / 2, southLat, 20 ) ;\n //rect ( eastLong, 200, 10, 10 ) ;\n}", "function setup() {\n createCanvas(windowWidth, windowHeight);\n\n // Center our drawing objects\n imageMode(CENTER);\n textAlign(CENTER);\n textSize(24);\n\n // set to one for startup\n drawFunction = drawHouse;\n}", "drawPlot(){\n\n // Insert HTML elements\n\n d3.select(\".dataviz-element\").remove(); // remove old element\n d3.select(\".viz-header\").remove(); // remove old header\n const container = d3.select(\".dataviz-elements\");\n const header = container.append(\"div\")\n .attr(\"class\", \"dataviz-element\")\n .attr(\"id\", \"dataviz-scatterplot\")\n .append(\"div\")\n .attr(\"class\", \"viz-header--scatterplot\");\n header.append(\"div\")\n .attr(\"class\", \"viz-header__text--scatterplot\")\n .html(\"Scatterplot</br>\")\n .append(\"text\")\n .text(\"Click to view building on map.\");\n\n // Create svg\n\n d3.select('#dataviz-scatterplot').append('div').attr('id', 'chart-view');\n let mainSvg=d3.select('#chart-view')\n .append('svg').classed('plot-svg', true)\n .attr(\"width\", this.width + this.margin.left + this.margin.right)\n .attr(\"height\", this.height + this.margin.top + this.margin.bottom);\n\n mainSvg.attr('xlmns','http://www.w3.org/2000/svg').attr('xmlns:xlink','http://www.w3.org/1999/xlink').append('filter').attr('id','shadow').append('feGaussianBlur').attr('in','SourceGraphic').attr('stdDeviation',3)\n mainSvg.append('g').attr('id','BG_g').append('rect').attr('x','1%').attr('y','1%')\n .attr('width','98%').attr('height','98%')\n .style('filter','url(#shadow)').style('fill','#a2a2a2').classed('BG_rect',true);\n mainSvg.select('#BG_g').append('rect').attr('x','2%').attr('y','2%')\n .attr('width','96%').attr('height','96%')\n .style('fill','#d9d9d9').classed('BG_rect',true);\n d3.select('#chart-view').select('.plot-svg').append('g').classed(\"brush\", true);\n let svgGroup = d3.select('#chart-view').select('.plot-svg').append('g').classed('wrapper-group', true);\n\n // Add axes\n\n svgGroup.append('g').attr('id', 'axesX');\n svgGroup.append('g').attr('id', 'axesY');\n svgGroup.append('text').attr('id', 'axesXlabel').attr('x',0).attr('y',0)\n svgGroup.append('text').attr('id', 'axesYlabel').attr('x',0).attr('y',0)\n\n // Create dropdown panel\n\n let dropdownWrap = d3.select('#chart-view').append('div').classed('dropdown-wrapper', true);\n let cWrap = dropdownWrap.append('div').classed('dropdown-panel', true);\n\n // Add legend and axis labels\n\n cWrap.append('div').classed('c-label', true)\n .append('text')\n .text('Circle Size').classed('SP_DD_text',true);\n\n cWrap.append('div').attr('id', 'dropdown_c').classed('dropdown', true).append('div').classed('dropdown-content', true)\n .append('select');\n\n let xWrap = dropdownWrap.append('div').classed('dropdown-panel', true);\n\n xWrap.append('div').classed('x-label', true)\n .append('text')\n .text('X Axis Data').classed('SP_DD_text',true);\n\n xWrap.append('div').attr('id', 'dropdown_x').classed('dropdown', true).append('div').classed('dropdown-content', true)\n .append('select');\n\n let yWrap = dropdownWrap.append('div').classed('dropdown-panel', true);\n\n yWrap.append('div').classed('y-label', true)\n .append('text')\n .text('Y Axis Data').classed('SP_DD_text',true);\n\n yWrap.append('div').attr('id', 'dropdown_y').classed('dropdown', true).append('div').classed('dropdown-content', true)\n .append('select');\n\n d3.select('#chart-view')\n .append('div')\n .classed('circle-legend', true)\n .append('svg').attr('width', 250)\n .append('g').classed('sizeLegend',true)\n .attr('transform', 'translate(0, 0)');\n d3.select('#chart-view')\n .select('.circle-legend').select('svg')\n .append('g').classed('typeLegend',true);\n\n // Draws default scatterplot and dropdown behavior\n\n this.updatePlot('DamageRatio', 'GroundAcceleration(m/s2)', 'Stories')\n this.drawDropDown('DamageRatio', 'GroundAcceleration(m/s2)', 'Stories')\n this.lineRender()\n\n }", "function init() {\n\tinitalizeGrid();\n\tupdateCanvasGrid();\n\tdrawPalette();\n\tdrawCurrentColor();\n\tdecodeOnFirstLoad();\n}", "function setup(){\n // String IDs of the 3 SVG containers\n var svgIdList = [\"vis1\", \"vis2\", \"vis3\"];\n\n // Foreach SVG container in the HTML page, save their references and dimensions into the appropriate global list variables\n for (i = 0; i < 3; i++) {\n var svgTuple = grabSvgDimensions(svgIdList[i]);\n svg_list.push(svgTuple[0]);\n svg_width_list.push(svgTuple[1]);\n svg_height_list.push(svgTuple[2]);\n }\n\n loadData(\"Pokemon-Dataset.csv\");\n}", "function updateViz() {\n background(\"seashell\");\n\n loadImage(\"USVizLegend.png\", displayLegend);\n if (stateArray.length > 0) {\n for (let i = 1; i < stateArray.length; i++) {\n stateArray[i].display();\n }\n }\n else { //handles error if stateArray does not contain data\n text(\"Waiting to load data files...\", width / 2, height / 2);\n }\n}", "createVis(debugData, otherDebugData, cp_idx, tc_idx) {\n\t\t// Deep copy object arrays. Transform it to\n\t\t// be able to differentiate between the current\n\t\t// run's and the other run's data\n\t\tvar dataArr1 = debugData.dataArray.map((el, i) => {\n\t\t\treturn JSON.parse(JSON.stringify(el));\n\t\t});\n\t\tvar dataArr2 = otherDebugData.dataArray.map((el, i) => {\n\t\t\treturn JSON.parse(JSON.stringify(el));\n\t\t});\n\n\t\tvar data1 = dataArr1.map((el, i) => {\n\t\t\tif (el[\"@current\"] === undefined) el[\"@current\"] = true;\n\t\t\treturn el;\n\t\t});\n\t\tvar data2 = dataArr2.map((el, i) => {\n\t\t\tif (el[\"@current\"] === undefined) el[\"@current\"] = false;\n\t\t\treturn el;\n\t\t});\n\n\t\t// Trick to maintain the color saliency of rendering; if we have\n\t\t// the display of data of another run overlaid, we want to maintain\n\t\t// the color mapping of (blue: another run result, orange: this run result)\n\t\t//var data = data2.concat(data1);\n\t\tvar data = data2.concat(data1);\n\n\t\t// If the student changed the variable names...\n\t\tvar varDataSet1 = debugData.localVarNames;\n\t\tvar varDataSet2 = otherDebugData.localVarNames;\n\t\tvar varData = Array.from(new Set(function*() { yield* varDataSet1; yield* varDataSet2; }()));\n\t\tvarData.push(\"@line no.\");\n\t\tvarData.push(\"@execution step\");\n\n\t\tvar width = 780,\n\t\t\theight = 780,\n\t\t\tpadding = 20,\n\t\t size = (width - 2 * padding) / varData.length;\n\t\t\n\t\tvar x = d3.scale.linear()\n\t\t .range([padding / 2, size - padding / 2]);\n\n\t\tvar y = d3.scale.linear()\n\t\t .range([size - padding / 2, padding / 2]);\n\n\t\tvar xAxis = d3.svg.axis()\n\t\t .scale(x)\n\t\t .orient(\"bottom\")\n\t\t .ticks(6);\n\n\t\tvar yAxis = d3.svg.axis()\n\t\t .scale(y)\n\t\t .orient(\"left\")\n\t\t .ticks(6);\n\n\t\tvar color = d3.scale.category10();\n\n\t\tvar domainByVarName = {},\n\t\t\tvarNames = d3.values(varData),\n\t\t\tn = varData.length;\n\n\t\tvarData.forEach(function (name) {\n\t\t\tvar tmpDomain = d3.extent(data, function(d) { return d[name]; });\n\t\t\tif (tmpDomain[0] === tmpDomain[1]) { // If there's only value in the domain, extend it\n\t\t\t\t\t\t\t\t\t\t\t\t // by including its -1 and +1 values\n\t\t\t\tdomainByVarName[name] = [tmpDomain[0] - 1, tmpDomain[1] + 1];\n\t\t\t} else {\n\t\t\t\tdomainByVarName[name] = tmpDomain;\n\t\t\t}\n\t\t});\n\n\t\txAxis.tickSize(size * n);\n\t\tyAxis.tickSize(-size * n);\n\t\t\n\t\t// Remove the old SVG\n\t\td3.select(\"#cross-vis-div-svg\" + cp_idx + \"-\" + tc_idx).remove();\n\n\t\t// Create a new one\n\t\tvar svg = d3.select(\"#cross-vis-div\" + cp_idx + \"-\" + tc_idx)\n\t\t\t\t .append(\"svg\")\n\t\t\t\t .attr(\"id\", () => { return \"cross-vis-div-svg\" + cp_idx + \"-\" + tc_idx; })\n\t\t\t\t\t.attr(\"width\", width)\n\t\t\t\t\t.attr(\"height\", height)\n\t\t\t\t\t.append(\"g\")\n\t\t\t\t\t.attr(\"transform\", \"translate(\" + padding + \",\" + padding + \")\");\n\n\t\tvar brush = d3.svg.brush()\t\t\n\t\t .x(x)\t\t\n\t\t .y(y)\t\t\n\t\t .on(\"brushstart\", brushstart)\n\t\t .on(\"brush\", (p) => { // Highlight the selected circles.\n\t\t\t\tvar e = brush.extent();\n\t\t\t\tvar brushedCircleLines1 = new Set();\n\t\t\t\tvar brushedCircleLines2 = new Set();\n\t\t\t\tsvg.selectAll(\"circle\").classed(\"hidden\", function(d) {\n\t\t\t\t\t// NOTE: e[0][0] = x0, e[0][1] = y0, e[1][0] = x1, e[1][1] = y1,\n\t\t\t\t\t// where [x0, y0] is the top-left corner\n\t\t\t\t\t// and [x1, y1] is the bottom-right corner\n\t\t\t\t\tif (e[0][0] > d[p.x] || d[p.x] > e[1][0]\n\t\t\t\t\t|| e[0][1] > d[p.y] || d[p.y] > e[1][1]) {\n\t\t\t\t\t\t// Hide the circles\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\n\t\t\t\t\td[\"@current\"] ? brushedCircleLines1.add(d[\"@line no.\"])\n\t\t\t\t\t\t\t\t : brushedCircleLines2.add(d[\"@line no.\"]);\n\t\t\t\t\treturn false;\n\t\t\t\t});\n\n\t\t\t\tthis.removeMouseupGutterHighlights();\n\t\t\t\tthis.highlightCodeLines(Array.from(brushedCircleLines1));\n\t\t\t\tthis.highlightCodeLinesInDiffView(Array.from(brushedCircleLines2));\n\t\t })\n\t\t .on(\"brushend\", () => { // If the brush is empty, select all circles.\n\t\t \tif (brush.empty()) {\n\t\t \t\tsvg.selectAll(\".hidden\").classed(\"hidden\", false);\n\t\t \t\tthis.removeMouseupGutterHighlights();\n\t\t \t\tthis.dehighlightPrevCodeLinesInDiffView();\n\t\t \t}\n\t\t });\n\n\t\tsvg.selectAll(\".x.axis\")\n\t\t\t.data(varNames)\n\t\t.enter().append(\"g\")\n\t\t\t.attr(\"class\", \"x axis\")\n\t\t\t.attr(\"transform\", function(d,i) { return \"translate(\" + (n - i - 1) * size + \",0)\"; })\n\t\t\t.each(function(d) { x.domain(domainByVarName[d]); d3.select(this).call(xAxis); });\n\n\t\tsvg.selectAll(\".y.axis\")\n\t\t\t.data(varNames)\n\t\t.enter().append(\"g\")\n\t\t\t.attr(\"class\", \"y axis\")\n\t\t\t.attr(\"transform\", function(d, i) { return \"translate(0,\" + i * size + \")\"; })\n\t\t\t.each(function(d) { y.domain(domainByVarName[d]); d3.select(this).call(yAxis); });\n\n\t\tvar cell = svg.selectAll(\".cell\")\n\t\t\t\t\t.data(this.cross(varNames, varNames))\n\t\t\t\t.enter().append(\"g\")\n\t\t\t\t\t.filter(function(d) { return d.i > d.j; })\n\t\t\t\t\t.attr(\"class\", \"cell\")\n\t\t\t\t\t.attr(\"transform\", function(d) { return \"translate(\" + (n - d.i - 1) * size + \",\" + d.j * size + \")\"; });\n\n\t\t// y axis labels\n\t\tcell.filter(function(d) { return (d.i - d.j) === 1; })\n\t\t\t.append(\"text\")\n\t\t\t.attr(\"x\", function(d, i) { return d.i * size + padding; })\n\t\t\t.attr(\"y\", function(d, i) { return size / 2; })\n\t\t\t.attr(\"dy\", \".71em\")\n\t\t\t.text(function(d) { return d.y; });\n\n\t\t// x axis labels\n\t\tcell.filter(function(d) { return (d.i - d.j) === 1; })\n\t\t\t.append(\"text\")\n\t\t\t.attr(\"x\", function(d, i) { return padding; })\n\t\t\t.attr(\"y\", function(d, i) { return (n - 1 - d.j) * size + padding; })\n\t\t\t.attr(\"dy\", \".71em\")\n\t\t\t.text(function(d) { return d.x; });\n\n\t\tcell.call(brush);\n\t\tcell.each(plot);\n\t\tcell.selectAll(\"circle\")\n\t\t .on(\"mouseover\", function() {\n\t\t \treturn tooltip.style(\"visibility\", \"visible\");\n\t\t })\n\t \t\t.on(\"mousemove\", (d) => {\n\t \t\t\tconsole.log(cell);\n\t \t\t\tvar cell = d3.select(this); // we replaced this with the outer context by using the (d) => {} function...\n\t \t\t\t//console.log(d);\n\t \t\t\t//console.log(cell.data()[0]);\n\t \t\t\t//console.log(cell.data());\n\t \t\t\t//var x = cell.data()[0].x;\n\t \t\t\t//var y = cell.data()[0].y;\n\n\t \t\t\t//var translate = d3.transform(cell.attr(\"transform\")).translate;\n\t \t\t\tvar coordinates = d3.mouse(svg.node()); // position relative to the svg element\n\t \t\t\t\n\t \t\t\ttooltip.html(\"<p><strong>Execution step\" + \": \" + d[\"@execution step\"] + \"</strong></p><p><strong>Code line: \" + d[\"@line no.\"] + \"</strong></p>\");\n\t \t\t\tthis.removeMouseupGutterHighlights();\n\t \t\t\td[\"@current\"] ? this.highlightCodeLines([d[\"@line no.\"]])\n\t \t\t\t\t\t\t : this.highlightCodeLinesInDiffView([d[\"@line no.\"]]);\n\n\t \t\t\treturn tooltip.style(\"top\", (coordinates[1] + 500) + \"px\")\n\t \t\t\t\t\t\t .style(\"left\", coordinates[0] + \"px\");\n\t \t\t})\n\t \t\t.on(\"mouseout\", () => {\n\t \t\t\tthis.removeMouseupGutterHighlights();\n\t \t\t\tthis.dehighlightPrevCodeLinesInDiffView();\n\t \t\t\treturn tooltip.style(\"visibility\", \"hidden\");\n\t \t\t});\n\n\t\tvar svgContainer = d3.select(\"#cross-vis-div\" + cp_idx + \"-\" + tc_idx);\n\t\tvar tooltip = svgContainer.append(\"div\")\n\t\t\t\t\t\t\t\t .style(\"position\", \"absolute\")\n\t\t\t\t\t\t\t\t .style(\"z-index\", \"1001\")\n\t\t\t\t\t\t\t\t .style(\"visibility\", \"hidden\");\n\n\t\tvar brushCell;\n\n\t\tfunction plot(p) {\n\t\t\tvar cell = d3.select(this);\n\n\t\t\tx.domain(domainByVarName[p.x]);\n\t\t\ty.domain(domainByVarName[p.y]);\n\n\t\t\tcell.append(\"rect\")\n\t\t\t .attr(\"class\", \"frame\")\n\t\t\t .attr(\"x\", padding / 2)\n\t\t\t .attr(\"y\", padding / 2)\n\t\t\t .attr(\"width\", size - padding)\n\t\t\t .attr(\"height\", size - padding)\n\t\t\t .style(\"pointer-events\", \"none\");\n\n\t\t\t// Cross for other data\n\t\t\tcell.selectAll(\"path\")\n\t\t\t .data(data)\n\t\t\t .enter().append(\"path\")\n\t\t\t .filter(function(d) { return (d[p.x] !== undefined) && (d[p.y] !== undefined) && !d[\"@current\"]; })\n\t\t\t \t.attr(\"d\", d3.svg.symbol()\n\t\t\t \t\t.size(function(d) { return 5 * 5; }) // size in square pixels\n\t\t\t \t\t.type(function(d) { return \"diamond\"; }))\n\t\t\t \t.attr(\"transform\", function(d) { return \"translate(\" + x(d[p.x]) + \",\" + y(d[p.y]) +\")\"; })\n\t\t\t .style(\"fill\", function(d) { return d3.rgb(82,209,255,0.2); });\n\n\t\t\t// Dot for current data\n\t\t\tcell.selectAll(\"circle\")\n\t\t\t .data(data)\n\t\t\t .enter().append(\"circle\")\n\t\t\t .filter(function(d) { return (d[p.x] !== undefined) && (d[p.y] !== undefined) && d[\"@current\"]; })\n\t\t\t .attr(\"cx\", function(d) { return x(d[p.x]); })\n\t\t\t .attr(\"cy\", function(d) { return y(d[p.y]); })\n\t\t\t .attr(\"r\", 2)\n\t\t\t .style(\"fill\", function(d) { return d3.rgb(255,127,80,0.2); });\n\t\t}\n\n\t\t// Clear the previously-active brush, if any.\n\t\tfunction brushstart(p) {\n\t\t\tif (brushCell !== this) {\t\t\n\t\t\t\td3.select(brushCell).call(brush.clear());\t\t\n\t\t\t\tx.domain(domainByVarName[p.x]);\t\t\n\t\t\t\ty.domain(domainByVarName[p.y]);\t\t\n\t\t\t\tbrushCell = this;\t\t\n\t\t\t}\t\t\n\t\t}\n\t}", "function setup() {\n d3.select(\"#dropper\").on(\"click\", drop);\n window.addEventListener(\"resize\", resize);\n resize();\n vises.push(stripChart);\n vises.push(dotplot);\n vises.push(beeswarm);\n vises.push(wheatplot);\n vises.push(boxWhisker);\n vises.push(meanError);\n vises.push(histogram);\n vises.push(kdeChart);\n vises.push(gradient);\n vises.push(twoTone);\n vises.push(violin);\n\n vises.forEach(function(v){\n v.make();\n });\n\n}", "function visualize() {\n d3.selectAll(\"svg > *\").remove();\n\n var color = d3.scaleLinear()\n .domain([0, 5])\n .range([\"hsl(152,80%,80%)\", \"hsl(228,30%,40%)\"])\n .interpolate(d3.interpolateHcl)\n\n var format = d3.format(\",d\")\n\n var width = document.getElementById('chart').clientWidth;\n var height = width\n\n var pack = data => d3.pack()\n .size([width, height])\n .padding(10)\n\n (d3.hierarchy(data)\n .sum(d => d.value)\n .sort((a, b) => b.value - a.value))\n\n tooltip = d3.select(\"body\")\n\t.append(\"div\")\n\t.style(\"position\", \"absolute\")\n\t.style(\"z-index\", \"10\")\n\t.style(\"visibility\", \"hidden\")\n .classed(\"card\", true)\n .classed(\"group\", true)\n .on(\"mouseover\", function() {\n return tooltip.style(\"visibility\", \"visible\");\n })\n\n tooltipName = tooltip\n .append(\"h5\")\n .classed(\"name\", true)\n\n tooltipEmail = tooltip\n .append(\"div\")\n .classed(\"email\", true)\n\n tooltipDescription = tooltip\n .append(\"div\")\n .classed(\"description\", true)\n \n tooltipRole = tooltip\n .append(\"select\")\n .classed(\"role\", true)\n .classed(\"form-control\", true)\n .attr(\"id\", \"tooltip-role-sel\")\n\n var tooltipRoleMember = tooltipRole\n .append(\"option\")\n .attr(\"value\", \"Member\")\n .text(\"Member\")\n var tooltipRoleManager = tooltipRole\n .append(\"option\")\n .attr(\"value\", \"Manager\")\n .text(\"Manager\")\n var tooltipRoleOwner = tooltipRole\n .append(\"option\")\n .attr(\"value\", \"Owner\")\n .text(\"Owner\")\n\n tooltipLink = tooltip\n .append(\"a\")\n .classed(\"link\", true)\n .text(\"Click to view more\")\n\n tooltipButtons = tooltip\n .append(\"div\")\n .classed(\"flex\", true)\n\n tooltipAddMember = tooltipButtons\n .append(\"button\")\n .classed(\"btn\", true)\n .classed(\"btn-collapse\", true)\n .attr(\"id\", \"add-member-btn\")\n\n var tooltipAddMemberSpan = tooltipAddMember\n .append(\"span\")\n .attr(\"data-hover\", \"Add member\")\n var tooltipAddMemberIcon = tooltipAddMemberSpan\n .append(\"i\")\n .classed(\"fa\", true)\n .classed(\"fa-user-plus\", true)\n\n tooltipRemove = tooltipButtons\n .append(\"button\")\n .classed(\"btn\", true)\n .classed(\"btn-collapse\", true)\n .attr(\"id\", \"remove-btn\")\n\n var tooltipRemoveSpan = tooltipRemove\n .append(\"span\")\n .attr(\"data-hover\", \"Remove member\")\n var tooltipRemoveIcon = tooltipRemoveSpan\n .append(\"i\")\n .classed(\"fa\", true)\n .classed(\"fa-times\", true)\n\n const root = pack(data);\n var focus = root;\n var view;\n\n const svg = d3.create(\"svg\")\n .attr(\"viewBox\", `-${width / 2} -${height / 2} ${width} ${height}`)\n .style(\"display\", \"block\")\n .style(\"background\", color(0))\n .style(\"cursor\", \"pointer\")\n .style(\"max-width\", width + \"px\")\n .style(\"max-height\", height + \"px\")\n .on(\"click\", () => zoom(root));\n\n const node = svg.append(\"g\")\n .selectAll(\"circle\")\n .data(root.descendants().splice(1))\n .join(\"circle\")\n .attr(\"fill\", d => d.data.type == \"USER\" ? \"white\" : (d.data.children ? color(d.depth) : \"rgb(116, 215, 202)\"))\n .on(\"mouseover\", function(d) { \n d3.select(this).attr(\"stroke\", \"#000\");\n if (d.data.type == \"USER\") {\n makeUserTooltip(d, d.parent.data.id)\n tooltipDescription.classed(\"hidden\", true)\n tooltipRole.classed(\"hidden\", false)\n tooltipAddMember.classed(\"hidden\", true)\n } else {\n makeGroupTooltip(d, d.parent.data.id);\n tooltipRole.classed(\"hidden\", true)\n tooltipDescription.classed(\"hidden\", false)\n tooltipAddMember.classed(\"hidden\", false)\n }\n if (!d.parent.data.id) {\n tooltipRemove.classed(\"hidden\", true);\n } else {\n tooltipRemove.classed(\"hidden\", false);\n }\n var pageY = event.pageY;\n var pageX = event.pageX;\n displayTooltip = true;\n tooltip.style(\"top\", (pageY)+\"px\").style(\"left\",(pageX+10)+\"px\")\n // show hover card after 500 ms if cursor is still on the same circle\n setTimeout(function() {\n if (displayTooltip == true) return tooltip.style(\"visibility\", \"visible\");\n }, 500)\n })\n .on(\"mouseout\", function(d) { \n d3.select(this).attr(\"stroke\", null);\n displayTooltip = false;\n return tooltip.style(\"visibility\", \"hidden\");\n })\n .on(\"click\", function(d) {\n if (d.data.type != \"USER\" && d.data.children) focus !== d && (zoom(d), d3.event.stopPropagation())\n });\n\n const label = svg.append(\"g\")\n .style(\"font\", \"1.25em sans-serif\")\n .attr(\"pointer-events\", \"none\")\n .attr(\"text-anchor\", \"middle\")\n .selectAll(\"text\")\n .data(root.descendants())\n .join(\"text\")\n .style(\"fill-opacity\", d => d.parent === root ? 1 : 0)\n .style(\"display\", d => d.parent === root ? \"inline\" : \"none\")\n .text(d => d.data.name);\n\n function zoomTo(v) {\n const k = width / v[2];\n\n view = v;\n\n label.attr(\"transform\", d => `translate(${(d.x - v[0]) * k},${(d.y - v[1]) * k})`);\n node.attr(\"transform\", d => `translate(${(d.x - v[0]) * k},${(d.y - v[1]) * k})`);\n node.attr(\"r\", d => d.r * k);\n }\n\n function zoom(d) {\n const focus0 = focus;\n\n focus = d;\n\n const transition = svg.transition()\n .duration(d3.event.altKey ? 7500 : 750)\n .tween(\"zoom\", d => {\n const i = d3.interpolateZoom(view, [focus.x, focus.y, focus.r * 2]);\n return t => zoomTo(i(t));\n });\n\n label\n .filter(function(d) { return d.parent === focus || this.style.display === \"inline\"; })\n .transition(transition)\n .style(\"fill-opacity\", d => d.parent === focus ? 1 : 0)\n .on(\"start\", function(d) { if (d.parent === focus) this.style.display = \"inline\"; })\n .on(\"end\", function(d) { if (d.parent !== focus) this.style.display = \"none\"; });\n }\n\n function hovered(hover) {\n return function(d) {\n d3.selectAll(d.ancestors().map(function(d) {}));\n };\n }\n\n var chartElement = document.getElementById(\"chart\");\n while (chartElement.lastElementChild.id != \"create-btn\") {\n chartElement.removeChild(chartElement.lastChild);\n }\n chartElement.appendChild(svg.node());\n\n if (groups.length > 0) {\n zoomTo([root.x, root.y, root.r * 2]);\n } else {\n // Show no search results\n var div = document.createElement(\"div\");\n div.classList.add(\"no-search-results\")\n var p = document.createElement(\"P\");\n p.innerHTML = \"There were no results for your search.\"; \n var btn = document.createElement(\"BUTTON\");\n btn.innerHTML = \"Reset all\";\n btn.classList.add(\"btn\");\n btn.classList.add(\"btn-light\");\n btn.onclick = clearFilters;\n\n div.appendChild(p);\n div.appendChild(btn);\n chartElement.appendChild(div);\n }\n\n isLoading = false;\n setLoadingOverlay();\n\n return svg.node();\n}", "function setup() {\n\n // init globals\n InitializeGlobals();\n\n // cnv = createCanvas(WIDTH, HEIGHT, WEBGL);\n cnv = createCanvas(windowWidth, windowHeight, WEBGL);\n // createCanvas(600, 600, P3D);\n background(backgroundColor);\n\n if (useTests) {\n createTests();\n }\n else if (generatedReady) {\n // should not be the case at setup, unless an example were to be shown\n }\n\n gui = new GUI();\n if (DEBUG) {\n // this.debuggui = newGUIdebug();\n }\n}", "function display(data) {\n // create a new plot and\n // display it\n var plot = scrollVis();\n d3.select(\"#vis\")\n .datum(data)\n .call(plot);\n\n // setup scroll functionality\n var scroll = scroller()\n .container(d3.select('#graphic'));\n\n // pass in .step selection as the steps\n scroll(d3.selectAll('.step'));\n\n // setup event handling\n scroll.on('active', function(index) {\n // highlight current step text\n d3.selectAll('.step')\n .style('opacity', function(d,i) { return i == index ? 1 : 0.1; });\n\n // activate current section\n plot.activate(index);\n });\n\n scroll.on('progress', function(index, progress){\n plot.update(index, progress);\n });\n}", "function InitDash() \n\n {\n //Console log initialization\n console.log(`Calling InitDash()`) ;\n\n //Link to Subject ID selector\n var selector = d3.select(\"#selDataset\") ;\n\n //Get all data\n d3.json(\"data/samples.json\").then((data) => \n\n {\n //Log all data\n console.log(data) ;\n\n //Get sample ID names\n var sampleNames = data.names ;\n\n //Populate the selector with all of the sample IDs\n sampleNames.forEach((sampleID) => \n \n {\n\n selector.append(\"option\")\n .text(sampleID)\n .property(\"value\", sampleID) ;\n\n }) ;\n\n //Choose starting sample ID\n var sampleID = sampleNames[0] ;\n\n console.log(\"Starting Sample: \", sampleID) ;\n\n //Initialize page by displaying data for starting sample ID\n FillMetaData(sampleID) ;\n \n DrawBarGraph(sampleID) ;\n \n DrawBubbleChart(sampleID) ;\n\n }) ;\n\n }", "function main(data) {\n chart(data);\n adjustLineChartColors();\n ganttChart(data2);\n}", "function visualise(){\r\n//sets the background to grey to hide any text that was previously on it\r\n background(80);\r\n\r\n//creates a button that calls the function priceDraw when pressed\r\n visPrice = createButton('Prices');\r\n visPrice.position(10,630);\r\n visPrice.size(100,30);\r\n visPrice.mousePressed(priceDraw);\r\n\r\n//creates a button that calls the function quanDraw when pressed\r\n visQuan = createButton('Quantity');\r\n visQuan.position(10,600);\r\n visQuan.size(100,30);\r\n visQuan.mousePressed(quanDraw);\r\n\r\n//hides the other buttons so they don't interfere\r\n listButtons.hide();\r\n graphButton.hide();\r\n visButton.hide();\r\n }", "async function main() {\n image = await loadImage('./Apollo11HP-128539876.jpg');\n imageData = await readImageData(image);\n\n new p5((p_) => {\n p = p_;\n p.setup = setup;\n }, elements.container);\n\n // Settings\n gui.add(settings, 'omega', 0, 1).step(0.01).onFinishChange(drawThrottled);\n gui.add(settings, 'phase', 0, 1).step(0.01).onFinishChange(drawThrottled);\n gui.add(settings, 'quantVal', 1, 30).step(0.1).onFinishChange(drawThrottled);\n gui.add(settings, 'saveImage');\n gui.close();\n\n if (ENABLE_STATS) {\n stats.showPanel(0);\n elements.stats.appendChild(stats.dom);\n }\n}", "function setup() {\ncreateCanvas(windowWidth, windowHeight);\nbackground(170);\nfill(40);\nnoStroke();\nrect(0,0,width,height/2) //rettangolo nero della parte superiore dello schermo\nframeRate(60);\nloadJSON(url,gotSpreadsheet);\nloadJSON(url,gotSpreadsheet_1);\n\n\n}", "function finalDraw() {\n\t Shapes.drawAll(gd);\n\t Images.draw(gd);\n\t Plotly.Annotations.drawAll(gd);\n\t Legend.draw(gd);\n\t RangeSlider.draw(gd);\n\t RangeSelector.draw(gd);\n\t }", "initVis() {\n let vis = this;\n\n // Define size of SVG drawing area\n vis.svg = d3.select(vis.config.parentElement)\n .attr('width', vis.config.containerWidth)\n .attr('height', vis.config.containerHeight)\n .attr(\"rx\", 20).attr(\"ry\", 20);\n\n // add a lightgray outline for the rect of lexis svg\n vis.svg\n .append(\"rect\")\n .attr(\"width\", vis.config.containerWidth)\n .attr(\"height\", vis.config.containerHeight)\n .attr(\"stroke\", \"lightgray\")\n .attr(\"fill\", \"none\");\n\n\n // Append group element that will contain our actual chart \n // and position it according to the given margin config\n vis.chartArea = vis.svg.append('g')\n .attr('transform', `translate(${vis.config.margin.left},${vis.config.margin.top})`);\n\n\n\n // define inner box size\n vis.innerHeight =\n vis.config.containerHeight -\n vis.config.margin.top -\n vis.config.margin.bottom;\n\n vis.innerWidth =\n vis.config.containerWidth -\n vis.config.margin.left -\n vis.config.margin.right;\n\n vis.chart = vis.chartArea.append('g');\n\n\n /**\n * Have implemented this part in HTML file\n */\n // Create default arrow head\n // Can be applied to SVG lines using: `marker-end`\n // vis.chart.append('defs').append('marker')\n // .attr('id', 'arrow-head')\n // .attr('markerUnits', 'strokeWidth')\n // .attr('refX', '2')\n // .attr('refY', '2')\n // .attr('markerWidth', '10')\n // .attr('markerHeight', '10')\n // .attr('orient', 'auto')\n // .append('path')\n // .attr('d', 'M0,0 L2,2 L 0,4')\n // .attr('stroke', '#ddd')\n // .attr('fill', 'none');\n\n\n // apply clipping mask to 'vis.chart', restricting the region at the very beginning and end of a year\n vis.chart\n .append(\"defs\")\n .append(\"clipPath\")\n .attr(\"id\", \"chart-mask\")\n .append(\"rect\")\n .attr(\"width\", vis.config.containerWidth)\n .attr(\"height\", vis.config.containerHeight);\n vis.chart.attr(\"clip-path\", \"url(#chart-mask)\");\n\n // text label for lexischart\n vis.svg\n .append(\"text\")\n .attr(\"y\", 25)\n .attr(\"x\", 10)\n .attr(\"class\", \"text-label\")\n .text(\"Age\");\n\n // Todo: initialize scales, axes, static elements, etc.\n\n // define x-axis scale\n vis.yearScale = d3\n .scaleLinear()\n .domain([1950, 2021])\n .range([0, vis.innerWidth]);\n\n // define y-axis scale\n vis.ageScale = d3\n .scaleLinear()\n .domain([25, 95])\n .range([vis.innerHeight, 0]);\n\n //define y-axis\n vis.chartArea\n .append(\"g\")\n .call(d3.axisLeft(vis.ageScale).tickValues([40, 50, 60, 70, 80, 90]));\n\n // define x-axis\n vis.chartArea\n .append(\"g\")\n .attr(\"transform\", `translate(0,${vis.innerHeight})`)\n .call(d3.axisBottom(vis.yearScale).tickFormat(d3.format(\"\"))); // tickFormat can make x-axis tick's label without comma, like 1,950\n\n // remove path on the axis\n vis.chartArea.selectAll(\"path\").remove();\n\n // define tooltip\n d3.select(\"body\")\n .append(\"div\")\n .attr(\"class\", \"tip\")\n .attr(\"visible\", \"hidden\")\n .style(\"position\", \"absolute\");\n }", "function setup() {\n\tcreateCanvas(windowWidth, windowHeight);\n\n\tbackground(0);\n\ttextAlign(CENTER);\n\ttextSize(200);\n\tfill(255, 167, 15);\n\tnoStroke();\n}", "function drawViz(vData, space) {\n // Declare d3 layout\n var vLayout = d3.pack().size([vWidth, vHeight]);\n\n // Layout + Data\n var vRoot = d3.hierarchy(vData).sum(function (d) { \n var value = 0\n for(key in d){\n if (key != \"genre\" && key != \"children\"){\n value = d[key];\n }\n else{\n value = d.children;\n }\n }\n \n return value; \n });\n \n var vNodes = vRoot.descendants();\n vLayout(vRoot);\n \n var vSlices = space.selectAll('circle').data(vNodes).enter().append('circle').on(\"click\", function(d){\n for (key in d.data){\n d3.select(\"#wordcloud svg\").remove(); // only for 1st iteration\n wordcloud(key)\n \n d3.select(\".legendCells\").selectAll(\".cell\").attr(\"opacity\",\"0.2\");\n }\n })\n .on(\"mouseover\", function(thisElement, index){\n // grey out all legends \n genre = '';\n for(key in thisElement.data){\n genre = key;\n }\n \n d3.selectAll(\".cell\").attr(\"opacity\", function(d){\n value = 0.2;\n if (d==genre){\n value=1;\n }\n return value;\n });\n \n\n //showTooltip(thisElement.id,10,10);\n })\n .on(\"mouseout\", function(thisElement, index){\n d3.select(\".legendCells\").selectAll(\".cell\").attr(\"opacity\",\"1\"); // back to normal\n\n //hideTooltip();\n });\n \n var labels = [];\n \n for(d in vNodes){\n for(key in vNodes[d].data){\n if(key != 'name' && key!= 'children'){\n labels.push(key);\n }\n }\n }\n \n labels.sort();\n colorScheme.domain(labels);\n console.log(labels);\n \n // Draw on screen\n vSlices.attr('cx', function (d) { return d.x; })\n .attr('cy', function (d) { return d.y; })\n .attr('r', function (d) { return d.r; })\n .style('opacity',0.9)\n .attr('fill', function (d) { \n cat = '';\n for(key in d.data){\n if(key != 'name' && key!= 'children'){\n cat = key; \n }\n }\n return colorScheme(cat); \n });\n \n vSlices.attr(\"fill\", function(d){\n color=\"\";\n if(d.x == 275){\n color=\"lightgray\";\n }\n else {\n for (key in d.data){\n if(key != 'name' && key!= 'children'){\n color = colorScheme(key); \n }\n }\n }\n return color;\n });\n \n // Encapsulate the word cloud functionality\n \n \n var fill = d3.scaleOrdinal(d3.schemeCategory10);\n\n width = 400;\n height = 300;\n\n // FUNCTION GENERATES WORD CLOUD OF MOVIES FOR SELECTED GENRE -----------------------\n function wordcloud(selectedGenre) {\n var myWords= [];\n d3.select(\"#wordcloud svg\").remove();\n \n // append the svg object to the body of the page\n svgWC = d3.select(\"#wordcloud\").append(\"svg\")\n .attr(\"width\", 800)\n .attr(\"height\", 400)\n .append(\"g\")\n .attr(\"transform\",\n \"translate(\" + 20 + \",\" + 20 + \")\");\n\n // Parse the Data\n d3.csv(\"data/moviecloud.csv\", function(data) {\n for (i in data) {\n d = data[i];\n if (d['genre'] == selectedGenre){\n myWords[myWords.length] = d;\n }\n }\n \n // Constructs a new cloud layout instance. It run an algorithm to find the position of words that suits your requirements\n // Wordcloud features that are different from one word to the other must be here\n var layout = d3.layout.cloud()\n .size([width, height])\n .words(myWords.map(function(d) {\n console.log(d['movie_title']);\n return {text: d['movie_title'], size:parseFloat(d['imdb_score']), color: fill(d['movie_title']) }; \n }))\n .padding(15) //space between words\n .rotate(function() { return ~~(Math.random()*2) * 90; })\n .fontSize(function(d) { \n return (2*d.size); \n }) // font size of words\n .on(\"end\", draw);\n \n layout.start(); \n\n // This function takes the output of 'layout' above and draw the words\n // Wordcloud features that are THE SAME from one word to the other can be here\n function draw(words) {\n console.log(words);\n svgWC\n .append(\"g\")\n .attr(\"transform\", \"translate(\" + layout.size()[0] / 2 + \",\" + layout.size()[1] / 2 + \")\")\n .selectAll(\"text\")\n .data(words)\n .enter().append(\"text\")\n .style(\"font-size\", function(d) { \n return (d.size)+\"px\"; \n })\n .style(\"fill\", function(d) { return d.color; })\n .attr(\"text-anchor\", \"middle\")\n .style(\"font-family\",\"Impact\")\n .attr(\"transform\", function(d) {\n return \"translate(\" + [d.x, d.y] + \")rotate(\" + d.rotate + \")\";\n })\n .text(function(d) { return d.text; });\n }\n }); \n }\n \n // Legend -----------------------------------------------\n var g = space.append(\"g\")\n .attr(\"class\", \"legendThreshold\")\n .attr(\"transform\", \"translate(10,40)\")\n .style(\"font-size\",\"12px\");\n\n g.append(\"text\")\n .attr(\"class\", \"caption\")\n .attr(\"x\", 0)\n .attr(\"y\", -6)\n .text(\"Movie Genres\")\n .style(\"font-size\",\"14px\")\n .style(\"font-weight\",\"bold\");\n\n var legend = d3.legendColor()\n .labels(function (d) { \n var lbl = '';\n if(labels[d.i] != undefined){\n lbl = labels[d.i];\n \n }\n return lbl; \n })\n .shapePadding(0)\n .scale(colorScheme);\n\n space.select(\".legendThreshold\")\n .call(legend); \n \n }", "function drawVis(dataset) {\n\n // Axes should not change in length when data is filtered.\n var x = d3.scaleLinear()\n .domain([0, 100])\n .range([0, w]);\n\n var y = d3.scaleLinear()\n .domain([0, 100])\n .range([h, 0]);\n\n var xAxis = d3.axisBottom()\n .scale(x);\n\n var yAxis = d3.axisLeft()\n .scale(y);\n\n // plot foods\n var circle = chart.selectAll(\"circle\").data(dataset);\n\n circle\n .attr(\"cx\", function(d) { return x(d[xNutrient]); })\n .attr(\"cy\", function(d) { return y(d[yNutrient]); });\n\n circle.exit().remove();\n\n circle.enter().append(\"circle\")\n .attr(\"cx\", function(d) { return x(d[xNutrient]); })\n .attr(\"cy\", function(d) { return y(d[yNutrient]); })\n .attr(\"r\", 4)\n .on(\"mouseover\", function(d) {\n tooltip.transition()\n .duration(200)\n .style(\"opacity\",.9);\n // display food name and nutritional content\n tooltip.html('<b>' + d.Shrt_Desc + '</b><br />' + xNutrient + \": \" + d[xNutrient] + \"(g)\" + '<br />' + yNutrient + \": \" + d[yNutrient] + \"(g)\")\n .style(\"left\",(d3.event.pageX + 5) + \"px\")\n .style(\"top\", (d3.event.pageY - 28) + \"px\");\n d3.select(this).attr(\"r\", 10).style(\"fill\", \"#f6931f\");\n })\n .on(\"mouseout\", function(d) {\n tooltip.transition()\n .duration(500)\n .style(\"opacity\", 0);\n d3.select(this).attr(\"r\", 4).style(\"fill\", \"black\");\n })\n .style(\"stroke\", \"black\")\n .style(\"opacity\", 0.5);\n}", "function setup() {\n\tcreateCanvas(windowWidth, windowHeight);\n}", "function drawchart() {\r\n const filters = getFilters();\r\n const drawData = filterData(\r\n filters[\"startDate\"],\r\n filters[\"endDate\"],\r\n filters[\"provincesFilter\"]\r\n );\r\n timeLapseChart = new TimeLapseChart(\"timelapse-chart\");\r\n timeLapseChart\r\n .setTitle(\"COVID-19 ARGENTINA - EVOLUCIÓN EN EL TIEMPO\")\r\n .setColumnsStyles(columnNames)\r\n .addDatasets(drawData)\r\n .render();\r\n}", "function initializeDisplay() {\n // set the data and properties of link lines\n link = svg.append(\"g\")\n .attr(\"class\", \"links\")\n .selectAll(\"line\")\n .data(graph.links)\n .enter().append(\"line\");\n\n // set the data and properties of node circles\n node = svg.append(\"g\")\n .attr(\"class\", \"nodes\")\n .selectAll(\"circle\")\n .data(graph.nodes)\n .enter()\n .append(\"circle\")\n .call(d3.drag()\n .on(\"start\", dragstarted)\n .on(\"drag\", dragged)\n .on(\"end\", dragended));\n\n node.append(\"title\")\n .text(function (d) {\n return d.id;\n });\n\n link.append(\"title\")\n .text(function (d) {\n return d.value;\n });\n \n // visualize the graph\n updateDisplay();\n}", "function GraphVisualization() {\n this.element = null; // DOM element to display in\n this.selection = null; // d3 selection of DOM element\n this.dataSource = null; // Data source for vertices/edges\n this.svg = null; // SVG inside DOM element\n this.width = 100; // Width of visualization\n this.height = 100; // Height of visualization\n this.onvertexmousedown = null; // Mouse down event on a vertex\n this.onedgemousedown = null; // Mouse down event on an edge\n this.oncanvasmouseodwn = null; // Mouse down event on the background\n this.force = d3.layout.force(); // d3 force layout underlying visualization\n this.edgeStroke = \"black\"; // Edge stroke color\n this.edgeRadius = 1; // Edge radius\n this.vertexStroke = \"black\"; // Vertex stroke color\n this.vertexFill = \"blue\"; // Vertex fill color\n this.vertexRadius = 8; // Vertex radius\n this.edgeLength = 50; // Edge length\n\n /*\n * Bind the visualization to a DOM element\n */\n this.bindElement = function(element) {\n this.element = element;\n this.selection = d3.select(element);\n this.svg = this.selection.append(\"svg\");\n\n this.updateSVGAttribs();\n this.refresh();\n\n return this;\n };\n\n /*\n * Bind the visualization to a data source\n */\n this.bindDataSource = function(dataSource) {\n this.dataSource = dataSource;\n this.refresh();\n\n return this;\n };\n\n /*\n * Set the size of the visualization\n */\n this.size = function(width, height) {\n this.force.size([width, height]);\n\n this.width = width;\n this.height = height;\n\n this.updateSVGAttribs();\n this.refresh();\n\n return this;\n };\n\n /*\n * Update attributes SVG for color, size, etc. Called when these properties\n * change or the DOM element is rebound.\n */\n this.updateSVGAttribs = function() {\n this.svg\n .attr(\"width\", this.width)\n .attr(\"height\", this.height);\n };\n\n /*\n * Update the visualization when the data from the data source changes. This\n * is called automatically when the visualization is bound to a new data\n * source or DOM element.\n */\n this.refresh = function() {\n if (!this.dataSource || !this.svg)\n return;\n\n var vertices = this.dataSource.getVertices();\n var edges = this.dataSource.getEdges();\n\n var edge = this.svg.selectAll(\".link\")\n .data(edges);\n edge.enter()\n .append(\"line\")\n .attr(\"class\", \"link\")\n .attr(\"stroke-width\", this.edgeRadius)\n .style(\"stroke\", this.edgeStroke);\n edge.exit()\n .remove();\n\n var node = this.svg.selectAll(\".node\")\n .data(vertices);\n node.enter()\n .append(\"circle\")\n .attr(\"class\", \"node\")\n .attr(\"r\", this.vertexRadius)\n .style(\"fill\", this.vertexFill)\n .style(\"stroke\", this.vertexStroke)\n .call(this.force.drag);\n node.exit()\n .remove();\n\n this.edgeSelection = edge;\n this.nodeSelection = node;\n\n this.updateEvents();\n\n var tick = function(e) {\n edge.attr(\"x1\", function(d) { return d.source.x; })\n .attr(\"y1\", function(d) { return d.source.y; })\n .attr(\"x2\", function(d) { return d.target.x; })\n .attr(\"y2\", function(d) { return d.target.y; });\n\n node.attr(\"cx\", function(d) { return d.x; })\n .attr(\"cy\", function(d) { return d.y; });\n };\n\n this.force\n .nodes(vertices)\n .links(edges)\n .on(\"tick\", tick)\n .linkDistance(this.edgeLength)\n .start();\n };\n\n /*\n * Update events on d3 selections\n */\n this.updateEvents = function() {\n if (!this.edgeSelection)\n return;\n\n this.edgeSelection.on(\"mousedown\", this.edgemousedown);\n this.nodeSelection.on(\"mousedown\", this.vertexmousedown);\n this.svg.on(\"mousedown\", this.canvasmousedown);\n };\n\n /*\n * Handle various events:\n *\n * vertexmousedown: Mouse down on a vertex\n * edgemousedown: Mouse down on an edge\n * canvasmousedown: Mouse down on background\n */\n this.on = function(evt_name, f) {\n if (evt_name == \"vertexmousedown\")\n this.vertexmousedown = f;\n else if (evt_name == \"edgemousedown\")\n this.edgemousedown = f;\n else if (evt_name == \"canvasmousedown\")\n this.canvasmousedown = f;\n\n this.updateEvents();\n\n return this;\n };\n}", "function createVisualization(json) {\n\n // Basic setup of page elements.\n initializeBreadcrumbTrail();\n //drawLegend();\n //drawwans();\n// d3.select(\"#toggleanswer\").on(\"click\", showans);\n\n // Bounding circle underneath the sunburst, to make it easier to detect\n // when the mouse leaves the parent g.\n vis.append(\"svg:circle\")\n .attr(\"r\", radius)\n .style(\"opacity\", 0);\n\n // For efficiency, filter nodes to keep only those large enough to see.\n var nodes = partition.nodes(json)\n .filter(function(d) {\n return (d.dx > 0.001); // 0.005 radians = 0.29 degrees\n });\n\n var path = vis.data([json]).selectAll(\"path\")\n .data(nodes)\n .enter().append(\"svg:path\")\n .attr(\"display\", function(d) { return d.depth ? null : \"none\"; })\n .attr(\"d\", arc)\n .attr(\"fill-rule\", \"evenodd\")\n .style(\"fill\", function(d) { return getColor(colors, d.name);})\n .style(\"opacity\", 0.5)\n .on(\"mouseover\", mouseover)\n .on(\"click\", click);\n\n // Add the mouseleave handler to the bounding circle.\n d3.select(\"#chart-container\").on(\"mouseleave\", mouseleave);\n\n // Get total size of the tree = value of root node from partition.\n totalSize = path.node().__data__.value;\n }", "function setup(){\n createCanvas(windowWidth,windowHeight);\n background(150); //draw grey canvas width and height of window.\n }", "function setup() {\n createCanvas(windowWidth, windowHeight);\n updateCanvasScale();\n frameRate(IDEAL_FRAME_RATE);\n networkArray = new CleanableSpriteArray();\n hiddentext = new HiddenText(networkArray);\n cursorShapeColor = new ShapeColor(null, color(255));\n backgroundColor = color(0);\n}", "function draw(){\n\n drawGrid();\n var seriesIndex;\n\n if(!graph.hasData) {\n return;\n }\n\n if(graph.options.axes.x1.show){\n if(!graph.options.axes.x1.labels || graph.options.axes.x1.labels.length === 0) {\n seriesIndex = graph.options.axes.x1.seriesIndex;\n graph.options.axes.x1.labels= getXLabels(graph.allSeries[seriesIndex].series[0], graph.options.labelDateFormat);\n }\n drawXLabels(graph.options.axes.x1);\n }\n if(graph.options.axes.x2.show && graph.hasData){\n if (!graph.options.axes.x2.labels || graph.options.axes.x2.labels.length === 0) {\n seriesIndex = graph.options.axes.x2.seriesIndex;\n graph.options.axes.x2.labels = getXLabels(graph.allSeries[seriesIndex].series[0], graph.options.labelDateFormat);\n }\n drawXLabels(graph.options.axes.x2);\n }\n\n if (graph.options.axes.y1.show) {\n drawYLabels(graph.maxVals[graph.options.axes.y1.seriesIndex], graph.minVals[graph.options.axes.y1.seriesIndex], graph.options.axes.y1);\n }\n if (graph.options.axes.y2.show) {\n drawYLabels(graph.maxVals[graph.options.axes.y2.seriesIndex], graph.minVals[graph.options.axes.y2.seriesIndex], graph.options.axes.y2);\n }\n }", "function drawChart() {\n\n // Create the data table.\n var data = new google.visualization.DataTable();\n data.addColumn('string', 'Topping');\n data.addColumn('number', 'Slices');\n data.addRows([\n ['Mushrooms', 3],\n ['Onions', 1],\n ['Olives', 1],\n ['Zucchini', 1],\n ['Pepperoni', 2]\n ]);\n\n // Set chart options\n var options = {'title':'Global Share',\n 'width':300,\n 'height':200,\n 'is3D': true,};\n\n // Instantiate and draw our chart, passing in some options.\n var chart = new google.visualization.PieChart(document.getElementById('chart_div'));\n chart.draw(data, options);\n }", "run() {\n this.update();\n this.display();\n this.checkEdges();\n }", "function drawChart() {\n\n // Create the data table.\n var data = new google.visualization.DataTable();\n data.addColumn('string', 'Topping');\n data.addColumn('number', 'Slices');\n data.addRows([\n ['Acertos', acertos],\n ['Erros', erros]\n ]);\n\n // Set chart options\n var options = {'width':800,\n 'height':600,\n 'backgroundColor': 'none',\n 'fontSize': 15,\n 'is3D':true};\n\n // Instantiate and draw our chart, passing in some options.\n var chart = new google.visualization.PieChart(document.getElementById('chart_div'));\n chart.draw(data, options);\n }", "function setup() {\n createCanvas(windowWidth, windowHeight)\n background(backgroundColour);\n walker = new Walker();\n}", "run() {\n try {\n this.createCanvas()\n this.createShaders()\n this.createProgram()\n this.createVertexArray()\n // Initial drawing on the canvas\n {\n // Random points\n for (let i = 0, max = 100000; i < max; i++) {\n this.data.positions.push(Math.random() * 2 - 1, Math.random() * 2 - 1)\n this.data.colors.push(Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255), 0)\n }\n // White point in the middle.\n this.data.positions.push(0, 0)\n this.data.colors.push(...this.colors.white)\n }\n this.drawScene()\n\n } catch (error) {\n console.error(error)\n }\n }", "function setup() {\n createCanvas(windowWidth,windowHeight);\n createDog();\n createAnimals();\n}", "function drawGraphic()\n\t{\n\t\t\t\n\t\tvar w = window.innerWidth;\n\t\tvar h = window.innerHeight;\t\n\t\t\n\t\t\t\n\t\t// clear out existing graphics and footer\n\t\tgraphic.empty();\n\t\tdeadspace.empty();\n\t\tfooter.empty();\n\t\t\t\t\t\t\t\t\n\t\tvar requiredResolution = 'thunderbolt';\n\t\t/*\n\t\tgraphSpace = {\n\t\t\t\t\t\twidth:screenResolution[requiredResolution].width ,\n\t\t\t\t\t\theight:screenResolution[requiredResolution].height*ratios.topRatio\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\tdeadSpace= {\n\t\t\t\t\t\twidth:screenResolution[requiredResolution].width ,\n\t\t\t\t\t\theight:screenResolution[requiredResolution].height*ratios.bottomRatio\n\t\t\t\t\t}\n\t\t*/\n\t\t/*\n\t\tgraphSpace = {\n\t\t\t\t\t\twidth:screenResolution[requiredResolution].width ,\n\t\t\t\t\t\theight:screenResolution[requiredResolution].height*0.75\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\tdeadSpace= {\n\t\t\t\t\t\twidth:screenResolution[requiredResolution].width ,\n\t\t\t\t\t\theight:screenResolution[requiredResolution].height*0.0\n\t\t\t\t\t}\n\t\t\t\t\t*/\n\t\t\t\t\t\n\t\t\t\t\t\n\t\tvar aspectRatio = [ 16, 9 ];\n\n\t\tgraphSpace = {\n\t\t\t\t\t\twidth : graphic.width() ,\n\t\t\t\t\t\theight : Math.ceil(((graphic.width() - margin.top.left - margin.top.right) * aspectRatio[1]) / aspectRatio[0]) - margin.top.top - margin.top.bottom\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\tdeadSpace= {\n\t\t\t\t\t\twidth:graphic.width() ,\n\t\t\t\t\t\theight:0.0\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t/* TOP BAR CHART */\n\t\t\n\t\td3.select(\"#graphic\").append(\"h1\").attr(\"id\" , \"viewCounter\").style(\"text-align\" , \"center\").text(titles[viewCounter]);\n\t\t\n\t\t\n\t\tsvg = d3.select(\"#graphic\")\n\t\t\t.append(\"svg\")\n\t\t\t.attr(\"class\" , \"svg\")\n\t\t\t.attr(\"id\" , \"svg\")\n\t\t\t.attr(\"width\" , graphSpace.width )\n\t\t\t.attr(\"height\" , graphSpace.height*ratios.topRatio )\n\t\t\t.attr(\"x\" , 0 )\n\t\t\t.attr(\"y\" , 0 ); \t\t\t\n\n\t\t\t\t\t\t\t\t\t\t\t \n\t\t// define and construct y axis domain and ranges\n\t\tvis.yTop = d3.scale.linear().domain([yAxisRanges.top.minimum , yAxisRanges.top.maximum]).range([ ((graphSpace.height*ratios.topRatio)-margin.top.top-margin.top.bottom) , margin.top.top ]);\n\t\tvis.yAxisTop = d3.svg.axis().scale(vis.yTop).orient(\"left\").ticks(10).tickFormat(d3.format(\",.1f\"));\t\t\t\t\t\t\n\t\td3.select(\"#svg\")\n\t\t\t.append(\"g\")\n\t\t\t.attr(\"class\", \"y axis\")\n\t\t\t.attr(\"id\", \"topYAxis\")\n\t\t\t.attr(\"transform\", \"translate(\" + margin.top.left + \",\" + margin.top.top + \")\")\n\t\t\t.call(vis.yAxisTop);\n\t\t\t\n\t\tvis.yticksTop = svg.selectAll('#topYAxis').selectAll('.tick');\t\t\t\t\t \n\t\tvis.yticksTop.append('svg:line')\n\t\t\t.attr( 'id' , \"yAxisTicksTop\" )\n\t\t\t.attr( 'y0' , 0 )\n\t\t\t.attr( 'y1' , 0 )\n\t\t\t.attr( 'x1' , 0 )\n\t\t\t.attr( 'x2', graphSpace.width-margin.bottom.left*2)\n\t\t\t.style(\"opacity\" , 0.05);\n\t\t\n\t\t\n\t\t\t\t\t\t \n\t\t// define and construct y axis domain and ranges\t\t\t\t\n\t\tvis.xTop = d3.time.scale().range([margin.top.left, (graphSpace.width - margin.top.left/* - margin.top.right*/)]);\n\t\tvis.xTop.domain(d3.extent(view2, function(d) { return d.formattedDate; }));\n\t\tvis.xAxisTop = d3.svg.axis().scale(vis.xTop).orient(\"bottom\");\n\t\t\n\t\t\t\t\t\n\t\tvis.xAxisTop = d3.svg.axis()\n\t\t\t.scale(vis.xTop)\n\t\t\t.orient(\"bottom\")\n\t\t\t.tickFormat(function(d,i) {\n\t\t\t\tvar fmt = d3.time.format(\"%I%p\");\n\t\t\t\tstr = fmt(d);\n\t\t\t\treturn (str.toString())[0] == '0' ? str = str.slice(1,str.length) : str = str.slice(0,str.length);\n\t\t\t})\n\t\t\t.tickPadding(5);\t\t\t\t\t\n\t\n\t\td3.select(\"#svg\")\n\t\t\t.append(\"text\")\n\t\t\t.attr( \"class\" , \"yAxisLabels\")\n\t\t\t.attr( \"id\" , function(d,i){ return \"yAxisLabel\"; })\n\t\t\t.attr(\"x\" , margin.top.left)\n\t\t\t.attr(\"y\" , 25)\n\t\t\t.style(\"font-size\" , \"1.0em\")\n\t\t\t.style(\"fill\" , \"white\")\n\t\t\t.text(\"Sentiment\");\n\t\t\t\t \n\t\tvar dots = svg.selectAll(\".dots1\")\n\t\t\t.data(View1_dots['sentiment'])\n\t\t\t.enter()\n\t\t\t.append(\"circle\");\n\t\t\t \n\t\tvar circleAttributes = dots\n\t\t\t.attr(\"class\", function (d,i) {\n\t\t\t\tvar classStr = \"dots1 index-\" + d.index;\n\t\t\t\tif ( d.color_1 != 0 ) { classStr = classStr + \" view0\"; }\n\t\t\t\tif ( d.color_2 != 0 ) { classStr = classStr + \" view1\"; }\n\t\t\t\tif ( d.index == 33 ) { classStr = classStr + \" mainTweet pulse\"; }\n\t\t\t\tif ( d.color_3 != 0 ) { classStr = classStr + \" view2\"; }\n\t\t\t\tif ( d.color_4 != 0 ) { classStr = classStr + \" view3\"; }\n\t\t\t\t\n\t\t\t\treturn classStr;\n\t\t\t})\n\t\t\t.attr(\"id\", function (d,i) { return \"dot1-\" + d.index; })\n\t\t\t.attr(\"cx\", function (d,i) { return vis.xTop(d.formattedDate); })\n\t\t\t.attr(\"cy\", function (d,i) { return margin.top.top+vis.yTop(d.sentiment); })\n\t\t\t.attr(\"r\", function (d,i) { return 5/*circleScale(d.markersize_1)*/; })\n\t\t\t.style(\"opacity\", function(d,i) { return 1.0; })\n\t\t\t.style(\"fill\" , function(d,i){ return colors[d.color_1]; })\n\t\t\t.style(\"stroke\" , function(d,i){\n\t\t\t\tif ( d.index == 33 ) { return \"#FFFFFF\"; }\n\t\t\t\telse { return colors[d.color_1]; }\n\t\t\t})\n\t\t\t.style(\"stroke-width\" , \"2px\")\n\t\t\t.style(\"fill-opacity\" , 0.50);\n\t\t\t \n\t\t//create x axis\n\t\td3.select(\"#svg\")\n\t\t\t.append('g')\n\t\t\t.attr('class', 'x axis')\n\t\t\t.attr('id', 'topXAxis')\n\t\t\t.attr('transform', function(d, i){ return \"translate(\" + (0) + \",\" + (margin.top.top + vis.yTop(0)) + \")\"; })\n\t\t\t.call(vis.xAxisTop);\n\n\t\t\t\t\n\t\t/* BOTTOM BAR CHART */\n\t\t\t\n\t\tsvgBottom = d3.select(\"#graphic\")\n\t\t\t.append(\"svg\")\n\t\t\t.attr(\"class\" , \"svg\")\n\t\t\t.attr(\"id\" , \"svgBottom\")\n\t\t\t.attr(\"width\" , graphSpace.width )\n\t\t\t.attr(\"height\" , graphSpace.height*ratios.bottomRatio )\n\t\t\t.attr(\"x\" , 0 )\n\t\t\t.attr(\"y\" , 0 ); \n\t\t\t\t\t\t\n\t\tvis.xBottom = d3.time.scale().range([margin.top.left, (graphSpace.width - margin.top.left/* - margin.top.right*/)]);\n\t\tvis.xBottom.domain(d3.extent(view1, function(d) { return d.formattedDate; }));\n\t\tvis.xAxisBottom = d3.svg.axis().scale(vis.xBottom).orient(\"bottom\");\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t// define and construct y axis domain and ranges\n\t\tvis.yBottom = d3.scale.linear().domain([yAxisRanges.bottom.minimum , yAxisRanges.bottom.maximum]).range([ ((graphSpace.height*ratios.bottomRatio)-margin.bottom.top-margin.bottom.bottom) , margin.bottom.top ]);\n\t\tvis.yAxisBottom = d3.svg.axis().scale(vis.yBottom).orient(\"left\").ticks(10).tickFormat(d3.format(\",.0f\"));\t\n\t\t\t\t\n\t\tvar dots = svgBottom.selectAll(\".dots2\")\n\t\t\t.data(View2_dots['number_articles_per_minute'])\n\t\t\t.enter()\n\t\t\t.append(\"circle\"); \n\t\t \n\t\tvar circleAttributes = dots\n\t\t\t.attr(\"class\", function (d,i) { return \"dots2 index\"; })\n\t\t\t.attr(\"id\", function (d,i) { return \"dot2-\" + d.index; })\n\t\t\t.attr(\"cx\", function (d,i) { return vis.xBottom(d.formattedDate); })\n\t\t\t.attr(\"cy\", function (d,i) { return vis.yBottom(d.number_articles_per_minute); })\n\t\t\t.attr(\"r\", function (d,i) { return 1; })\n\t\t\t.style(\"opacity\", function(d,i) { return 1.0; })\n\t\t\t.style(\"fill\" , \"#00497F\")\n\t\t\t.style(\"stroke\" , \"#00497F\")\n\t\t\t.style(\"stroke-width\" , \"1px\")\n\t\t\t.style(\"fill-opacity\" , 1.00);\n\t\t\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t\t \n\t\t\n\t\t\n\t\t// define clipPath around scatter plot frame\n\t\tsvgBottom.append(\"defs\").append(\"clipPath\")\n\t\t\t.attr(\"id\", \"clip\")\n\t\t\t.append(\"rect\")\n\t\t\t.attr(\"width\", graphSpace.width )\n\t\t\t.attr(\"height\", graphSpace.height*ratios.bottomRatio - margin.bottom.top - margin.bottom.bottom )\n\t\t\t.attr(\"transform\" , \"translate(\" + margin.bottom.left + \",\" + 0 + \")\");\n\t\t\t\n\t\t\t\n\t\tvar line = d3.svg.line()\n\t\t\t.x(function(d) { return vis.xBottom(d.formattedDate); })\n\t\t\t.y(function(d) { return vis.yBottom(+d.number_articles_per_minute); })\n\t\t\t\t\t\t\t\t\n\t\tvar area = d3.svg.area()\n\t\t\t.x(function(d) { return vis.xBottom(d.formattedDate); })\n\t\t\t.y0(graphSpace.height*ratios.bottomRatio)\n\t\t\t.y1(function(d) { return vis.yBottom(+d.number_articles_per_minute);; });\t\n\t\t\n\t\tsvgBottom.append(\"path\")\n\t\t\t.datum(view2)\n\t\t\t.attr(\"class\", \"line\")\n\t\t\t.attr(\"id\", \"line\")\n\t\t\t.style(\"fill\" , \"#none\")\n\t\t\t.style(\"stroke\" , \"#005DA2\")\n\t\t\t.style(\"stroke-width\" , \"2px\")\n\t\t\t.style(\"fill-opacity\" , 0.5)\n\t\t\t.attr(\"clip-path\", \"url(#clip)\")\n\t\t\t.attr(\"d\", line); \n\t\t\t\t\t\t\n\t\tsvgBottom.append(\"path\")\n\t\t\t.datum(view2)\n\t\t\t.attr(\"class\", \"area\")\n\t\t\t.attr(\"id\", \"area\")\n\t\t\t.style(\"fill\" , \"#005DA2\")\n\t\t\t.style(\"stroke\" , \"#005DA2\")\n\t\t\t.style(\"stroke-width\" , \"2px\")\n\t\t\t.style(\"fill-opacity\" , 0.5)\n\t\t\t.attr(\"clip-path\", \"url(#clip)\")\t\n\t\t\t.attr(\"d\", area);\n\t\t\t\n\t/*\t\t\t\n\t\t svgBottom.append(\"linearGradient\")\n\t\t\t .attr(\"id\", \"temperature-gradient\")\n\t\t\t .attr(\"gradientUnits\", \"userSpaceOnUse\")\n\t\t\t .attr(\"x1\", 0)\n\t\t\t .attr(\"y1\", vis.yBottom(0) )\n\t\t\t .attr(\"x2\", 900)\n\t\t\t .attr(\"y2\", vis.yBottom(4) )\n\t\t\t.selectAll(\"stop\")\n\t\t\t .data([\n\t\t\t\t{offset: \"0%\", color: \"steelblue\"},\n\t\t\t\t{offset: \"50%\", color: \"gray\"},\n\t\t\t\t{offset: \"100%\", color: \"red\"}\n\t\t\t ])\n\t\t\t.enter().append(\"stop\")\n\t\t\t .attr(\"offset\", function(d) { return d.offset; })\n\t\t\t .attr(\"stop-color\", function(d) { return d.color; });\n*/\n\n\t\td3.select(\"#svgBottom\")\n\t\t\t.append(\"g\")\n\t\t\t.attr(\"class\", \"y axis\")\n\t\t\t.attr(\"id\", \"bottomYAxis\")\n\t\t\t.attr(\"transform\", \"translate(\" + margin.bottom.left + \",\" + (0) + \")\")\n\t\t\t.call(vis.yAxisBottom);\n\t\t\n\t\td3.select(\"#svgBottom\")\n\t\t\t.append(\"text\")\n\t\t\t.attr( \"class\" , \"yAxisLabels\")\n\t\t\t.attr( \"id\" , function(d,i){ return \"yAxisLabel\"; })\n\t\t\t.attr(\"x\" , margin.bottom.left)\n\t\t\t.attr(\"y\" , 20)\n\t\t\t.style(\"font-size\" , \"1.0em\")\n\t\t\t.style(\"fill\" , \"white\")\n\t\t\t.text(\"Number of tweets per minute\");\n\t\t\t\n\t\tvis.yticksBottom = svgBottom.selectAll('#bottomYAxis').selectAll('.tick');\t\t\t\t\t \n\t\tvis.yticksBottom.append('svg:line')\n\t\t\t.attr( 'id' , \"yAxisTicksBottom\" )\n\t\t\t.attr( 'y0' , 0 )\n\t\t\t.attr( 'y1' , 0 )\n\t\t\t.attr( 'x1' , 0 )\n\t\t\t.attr( 'x2', graphSpace.width-margin.bottom.left*2)\n\t\t\t.style(\"opacity\" , 0.05);\n\t\t\n\t\t\t\t\t\n\t\tvis.xAxisBottom = d3.svg.axis()\n\t\t\t.scale(vis.xBottom)\n\t\t\t.orient(\"bottom\")\n\t\t\t.tickFormat(function(d,i) {\n\t\t\t\tvar fmt = d3.time.format(\"%I%p\");\n\t\t\t\tstr = fmt(d);\n\t\t\t\treturn (str.toString())[0] == '0' ? str = str.slice(1,str.length) : str = str.slice(0,str.length);\n\t\t\t})\n\t\t\t.tickPadding(5);\t\n\t\t\t\n\t\t//create brush x axis\n\t\td3.select(\"#svgBottom\")\n\t\t\t.append('g')\n\t\t\t.attr('class', 'x axis')\n\t\t\t.attr('id', 'bottomXAxis')\n\t\t\t.attr('transform', function(d, i){ return \"translate(\" + (0) + \",\" + ( + vis.yBottom(0)) + \")\"; })\n\t\t\t.call(vis.xAxisBottom);\n\t\t\t\n\t\tsvgDeadSpace = d3.select(\"#deadspace\")\n\t\t\t.append(\"svg\")\n\t\t\t.attr(\"class\" , \"svg\")\n\t\t\t.attr(\"id\" , \"svgDeadSpace\")\n\t\t\t.attr(\"width\" , deadSpace.width )\n\t\t\t.attr(\"height\" , deadSpace.height )\n\t\t\t.attr(\"x\" , 0 )\n\t\t\t.attr(\"y\" , 0 ); \t\t\t\n\t\t\t \n\t\td3.select(\"#footer\")\n\t\t\t.append(\"a\")\n\t\t\t .attr(\"href\", \"http://innovation.thomsonreuters.com/en/labs.html\")\n\t\t\t .attr(\"target\" , \"_blank\")\n\t\t\t .html(\"</br>Data visualisation by Thomson Reuters Labs\");\n\t\t\n\t\tdrawLegend();\n\t\t\n\t\tif ( auto == true ){\n\t\t\t\n\t\t myInterval = setInterval(function () {\n\t\t\t \n\t\t\t\ttransitionData();\n\t\t\t\tviewCounter++;\n\t\t\t\tif ( viewCounter === 4 ) {\n\t\t\t\t\tclearInterval(myInterval);\n\t\t\t\t}\n\t\t\t}, 6000);\n\t\t}\n\t\t\t \n\t\t//use pym to calculate chart dimensions\t\n\t\tif (pymChild) { pymChild.sendHeight(); }\n\n\t\treturn;\n\n\t}", "function update() {\n // Update size of the vis\n vis.width(window.innerWidth)\n .height(window.innerHeight);\n\n // Update size of the vis container and redraw\n d3.select('.pv-vis-demo')\n .attr('width', window.innerWidth)\n .attr('height', window.innerHeight)\n .datum(data)\n .call(vis);\n }", "function ready(error, data, gerOutline, gerCountries) {\n if (error) throw error;\n \n console.log({data: data, gerOutline: gerOutline, gerCountries: gerCountries});\n\n \n /* Sequence */\n /* -------- */\n\n // Global data\n vis.nodes = data;\n\n // Set up and get visual variables\n setUpVisual();\n\n // Set the initial node layout\n initialVisualLayout(vis.nodes);\n\n // Set up the map\n setupMap(gerOutline, gerCountries);\n\n // Draw the map\n drawMap();\n\n // Calculate y scale for positioning (pull the lower end up a little to leave space for the text)\n vis.yScale = d3.scaleLinear().domain([0, Math.ceil(vis.nodes.length/2)]).range([vis.dims.height*0.05, vis.dims.height*0.85]);\n\n // Calculate and augment positions\n vis.nodes = nodesAlphabeticalCinema(vis.nodes);\n vis.nodes = nodesAlphabeticalCity(vis.nodes);\n vis.nodes = nodesVisitingOrder(vis.nodes);\n\n // play intro\n story();\n\n\n /* Interactivity elements */\n /* ---------------------- */\n\n // Zoom\n var zoom = d3.zoom().scaleExtent([0.75, 2.5]).on('zoom', zoomed);\n d3.select('#visual svg').call(zoom);\n\n\n // circles\n d3.selectAll('.node').on('mouseover', circleOver);\n d3.selectAll('.node').on('mousedown', circleDown);\n d3.selectAll('.node').on('mouseout', circleOut);\n d3.selectAll('.node-text').on('mouseover', textOver);\n d3.selectAll('.node-text').on('mousedown', textDown);\n d3.selectAll('.node-text').on('mouseout', textOut);\n\n}", "function setup() {\n createCanvas(windowWidth, windowHeight); // maximise canvas space!\n frameRate(60);\n\n colorMode(HSB, 255); // Use Hue, Saturation, Brightness, range of 0..255\n // imageMode(CENTER);\n\n background(0); // black background (greyscale)\n\n // add a control panel\n const gui = new dat.GUI();\n gui.add(controls, 'velocityScale', -1, 1);\n gui.add(controls, 'edgeMode', ['bounce', 'wrap']);\n gui.add(controls, 'distanceThreshold', 0, 400);\n gui.add(controls, 'collisionDetection', true, false);\n\n // stroke(255, 0, 0); // outline colour R,G,B\n //\n // line(\n // 10, 10,// form x,y\n // 500, 500// to x,y\n // );\n //\n // const greenish = [0, 200, 0];\n // fill(...greenish); // what colour to fill in solid shapes with\n // // stroke(0, 0, 255);\n //\n // noStroke();\n //\n // rect(\n // 300, 100, // top left corner x, y\n // 300, 300 // width, height\n // );\n //\n // fill(0, 0, 255);\n //\n // triangle(\n // 400, 200, // top point\n // 100, 500, // bottom left point\n // 700, 500 // bottom right\n // );\n\n} // setup()" ]
[ "0.75986487", "0.7109804", "0.70620495", "0.70358115", "0.7035261", "0.70205706", "0.70154977", "0.6985418", "0.69848764", "0.6943313", "0.6880603", "0.68083197", "0.68079954", "0.6793471", "0.6770307", "0.6743557", "0.6737102", "0.670131", "0.66928375", "0.66716325", "0.6650864", "0.66391206", "0.66166514", "0.66135705", "0.65755904", "0.6553427", "0.6546395", "0.65437454", "0.65266967", "0.65145254", "0.6513407", "0.65012693", "0.64950454", "0.64881545", "0.64811784", "0.64768547", "0.64760935", "0.64419127", "0.6430125", "0.6375236", "0.6358516", "0.63540643", "0.6346965", "0.6339604", "0.6326764", "0.6324118", "0.6319412", "0.63141716", "0.6310467", "0.6292848", "0.6292416", "0.6290249", "0.62880725", "0.62821835", "0.62784195", "0.6277937", "0.62766457", "0.6275573", "0.62668437", "0.62646496", "0.6261038", "0.625953", "0.6255473", "0.6249607", "0.624485", "0.62415135", "0.62369335", "0.6225988", "0.62155634", "0.6203453", "0.6198651", "0.6197286", "0.6195234", "0.61901414", "0.6186592", "0.618405", "0.61774504", "0.6175554", "0.61694026", "0.615836", "0.6158298", "0.61581457", "0.61569375", "0.6156277", "0.6153271", "0.61501324", "0.6147438", "0.6145755", "0.61387974", "0.613816", "0.6138066", "0.6135576", "0.6132365", "0.6117777", "0.61152667", "0.61130995", "0.6111501", "0.6105992", "0.6105631", "0.61047435", "0.61046624" ]
0.0
-1
Fade all but the current sequence, and show it in the breadcrumb trail.
function mouseover(d) { var percentage = (100 * d.value / totalSize).toPrecision(3); var percentageString = percentage + "%"; if (percentage < 0.1) { percentageString = "< 0.1%"; } d3.select("#percentage") .text(percentageString); d3.select("#explanation") .style("visibility", ""); var sequenceArray = d.ancestors().reverse(); sequenceArray.shift(); // remove root node from the array updateBreadcrumbs(sequenceArray, percentageString); // Fade all the segments. d3.selectAll("path") .style("opacity", 0.3); // Then highlight only those that are an ancestor of the current segment. vis.selectAll("path") .filter(function(node) { return (sequenceArray.indexOf(node) >= 0); }) .style("opacity", 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fadeIn(config, $previous, $targets) {\n // Clear previous active class + styles touched by tram\n // We cannot remove the whole inline style because it could be dynamically bound\n $previous.removeClass(tabActive).css({\n opacity: '',\n transition: '',\n transform: '',\n width: '',\n height: ''\n });\n // Add active class to new target\n\n $targets.addClass(tabActive).each(ix.intro);\n Webflow.redraw.up();\n // Set opacity immediately if intro is zero\n\n if (!config.intro) {\n return tram($targets).set({\n opacity: 1\n });\n }\n // Otherwise fade in opacity\n\n tram($targets).set({\n opacity: 0\n }).redraw().add('opacity ' + config.intro + 'ms ' + config.easing, {\n fallback: safari\n }).start({\n opacity: 1\n });\n }", "function FADER() {\n $('.FADE').hide(0).delay(500).fadeIn(500);\n console.log('done');\n }", "function fadeOutThePreviousButton() {\n\t\n\t\t\t\t$(\"a\",\"#\"+prevId).fadeTo(0,0); \n\t\n\t\t\t\t}", "function blink(currentColour) {\n currentColour.fadeOut(100).fadeIn(100);\n}", "function flashUsedSequence () {\n\tusedSequence.forEach(function(element, index) {\n\t\tsetTimeout(function() {\n\t\t\t\t$(element).animate({\n\t\t\t\t\topacity: \"1\"\n\t\t\t\t}, 800).animate({\n\t\t\t\t\topacity: \"0.5\"\n\t\t\t\t}, 200)\n\t\t\t}, index * 1000);\n\t})\n}", "startFade(){\n this.last_update = Date.now();\n this.color = \"#f4d742\";\n this.fade_rate = .2; //fades 20% every 100 ms\n this.transparency = 1;\n }", "fadeUp(){\n this.animating = true;\n const item = this.getItem({foreground:this.index})\n \n this.tween = fromTo(\n this.setArtToNextAndCloak(item),\n DISSOLVE_DURATION / 1000,\n {opacity:0},\n {opacity:1, ease:Power4.easeOut, onComplete:this.onFadeUpComplete}\n )\n \n }", "CrossFade() {}", "function flashLastAddedColor(lastAddedColor) {\n $(\".\" + lastAddedColor).animate({opacity: 0.5}, 200);\n $(\".\" + lastAddedColor).animate({opacity: 1}, 200);\n}", "function fadeInAll(callback)\n\t{\n\t\tvar duration = _options.animationDuration;\n\n\t\t// fade-in hidden elements\n\n\t\t_svg.selectAll(\".pdb-chain-group\")\n\t\t\t.transition().duration(duration)\n\t\t\t.attr(\"opacity\", 1);\n\n\t\t_svg.selectAll(\".pdb-selection-rectangle-group\")\n\t\t\t.transition().duration(duration)\n\t\t\t.attr(\"opacity\", 1);\n\n\t\t_svg.selectAll(\".pdb-panel-y-axis-label-group\")\n\t\t\t.transition().duration(duration)\n\t\t\t.attr(\"opacity\", 1)\n\t\t\t.each(\"end\", function(){\n\t\t\t\tif (_.isFunction(callback)) {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t});\n\t}", "function startFade() {\n fader.addClass('fadeOut');\n setTimeout(teardownFade, FADE_DURATION_MS);\n }", "function slide_fadeFromForeToBack() {\n var delay = 100;\n var i = 0;\n var bgop=0;\n var fgop=1;\n\n document.getElementById(backImage).style.visibility = 'visible';\n\n if (fade_cursor < 1.01) {\n bgop = fade_cursor;\n fgop = 1-fade_cursor;\n setOpacity(foreImage,fgop);\n setOpacity(backImage,bgop);\n fade_cursor += 0.2;\n window.setTimeout(slide_fadeFromForeToBack, delay);\n }\n else {\n // End of the effect, we put backImage on the foreground\n fade_cursor = 0;\n\n slide_switchFgBg();\n\n setOpacity(foreImage,1);\n setOpacity(backImage,0);\n }\n}", "function fadeBands(){\n d3.selectAll('path.band')\n .each(function(d){\n // Bring the non-faded bands to the front\n if(d.a.faded() || d.b.faded()){ d3.select(this).moveToBack(); }\n // if(!d.a.faded() && !d.b.faded()){ d3.select(this).moveToFront(); }\n })\n .transition()\n .duration(500)\n .style('stroke', function(d){ return bandColor(d); });\n }", "function fadeAway() {\n $('body').children().fadeOut(\"slow\");\n $('body').html(\"<h1>Goodbye Matt!</h1>\");\n}", "function intro() {\n // Clear previous active class + styles touched by tram\n // We cannot remove the whole inline style because it could be dynamically bound\n $previous.removeClass(tabActive).css({\n opacity: '',\n transition: '',\n transform: '',\n width: '',\n height: ''\n });\n\n // Add active class to new target\n $targets.addClass(tabActive).each(ix.intro);\n Webflow.redraw.up();\n\n // Set opacity immediately if intro is zero\n if (!config.intro) return tram($targets).set({ opacity: 1 });\n\n // Otherwise fade in opacity\n tram($targets)\n .set({ opacity: 0 })\n .redraw()\n .add('opacity ' + config.intro + 'ms ' + easing, { fallback: safari })\n .start({ opacity: 1 });\n }", "function back(){\n $(\".page4\").fadeToggle(1000);\n $(\".page2\").delay(2000).fadeToggle(1200);\n}", "function flashAll(){\n\t\tredFlash();\n\t\tyellowFlash();\n\t\tblueFlash();\n\t\tgreenFlash();\n\t}", "function innlasting() {\n $('.sitat').fadeIn(2000);\n $('.hvaOgHvem').fadeIn(2000);\n}", "function FadeBanner(classDiv) {\n //se ho un solo bannere non animo\n if ($('.' + classDiv + ' A').length == 1) return\n\n\n var $active = $('.' + classDiv + ' A.active');\n if ($active.length == 0) $active = $('.' + classDiv + ' A:last');\n\n var $next = $active.next().length ? $active.next() : $('.' + classDiv + ' A:first');\n $active.addClass('last-active');\n $next.css({ opacity: 0.0 })\n .addClass('active')\n .animate({ opacity: 1.0 }, 1000, function () {\n $active.removeClass('active last-active');\n });\n}", "function effectFade () {\n pauseSlideshow();\n effect = 1;\n runSlideshow();\n }", "function fade($ele) {\n\t$ele.fadeIn(1000).delay(2000).fadeOut(1000, function() {\n\t\tvar $next = $(this).next('.a-testimonial');\n\t\tfade($next.length > 0 ? $next : $(this).parent().children().first());\n\t});\n}", "function advanceStep() {\n formSteps[i][currentStep].fadeOut(500).addClass('hidden').queue(function() { \n \n if (currentStep !== maxSteps[i]) {\n formSteps[i][currentStep + 1].hide().removeClass('hidden').fadeIn(500);\n } \n \n currentStep++;\n \n }).dequeue();\n }", "function intro() {\r\n\t // Clear previous active class + styles touched by tram\r\n\t // We cannot remove the whole inline style because it could be dynamically bound\r\n\t $previous.removeClass(tabActive).css({\r\n\t opacity: '',\r\n\t transition: '',\r\n\t transform: '',\r\n\t width: '',\r\n\t height: ''\r\n\t });\r\n\r\n\t // Add active class to new target\r\n\t $targets.addClass(tabActive).each(ix.intro);\r\n\t Webflow.redraw.up();\r\n\r\n\t // Set opacity immediately if intro is zero\r\n\t if (!config.intro) return tram($targets).set({ opacity: 1 });\r\n\r\n\t // Otherwise fade in opacity\r\n\t tram($targets)\r\n\t .set({ opacity: 0 })\r\n\t .redraw()\r\n\t .add('opacity ' + config.intro + 'ms ' + easing, { fallback: safari })\r\n\t .start({ opacity: 1 });\r\n\t }", "function flashThisThing(t) {\r\n var fadeSpeed = 500;\r\n t.fadeIn(fadeSpeed).fadeOut(fadeSpeed).fadeIn(fadeSpeed).fadeOut(fadeSpeed).fadeIn(fadeSpeed);\r\n}", "function showControllers(show){\n\tif(show){\n\t\tback.style = \"opacity:1;\"\n\t\tnext.style = \"opacity:1;\"\n\t}else{\n\t\tback.style = \"opacity:0;\"\n\t\tnext.style = \"opacity:0;\"\n\t}\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 show() {\n\t var time = arguments.length <= 0 || arguments[0] === undefined ? 200 : arguments[0];\n\t\n\t this.transition().duration(time).style('opacity', 1);\n\t }", "function fadeSlide() {\n grabNextSlide();\n image.src = slides[currentSlide].image;\n caption = slides[currentSlide].caption;\n sequence.innerHTML = (currentSlide + 1) + \" / \" + slides.length;\n\n bufferCtx.canvas.width = slideshow.width;\n bufferCtx.canvas.height = slideshow.height;\n\n ctx.globalAlpha = 0.1;\n\n clearInterval(fadeTime);\n fadeTime = setInterval(fadeIn, 180);\n }", "function allFadeIn(){\n $('.info').fadeIn();\n}", "function init_breadcrumb() {\n\tif ($(\"breadcrumb\")) {\n\n\t\tvar item_y = null;\n\t\tvar isInFollowingLine = false;\n\n\t\t$A($(\"breadcrumb\").getElementsByTagName(\"dd\")).each(function(item) {\n\t\t\titem = $(item);\n\n\t\t\t//calculate the y-offset position of the current breadcrumb item\n\t\t\tif(item_y == null) {\n\t\t\t\titem_y = Position.cumulativeOffset(item)[1];\n\t\t\t}\n\t\t\tif(item_y < Position.cumulativeOffset(item)[1]) {\n\t\t\t\tisInFollowingLine = true;\n\t\t\t}\n\n\t\t\t//reduce the z-index of the current item\n\t\t\tif(isInFollowingLine) {\n\t\t\t\titem.setStyle({'zIndex':parseInt(item.getStyle('zIndex')) - 1 });\n\t\t\t}\n\n\t\t\t//breadcrumb JS hover only needed for IE<7\n\t\t\tif (Info.browser.isIEpre7) {\n\t\t\t\tvar curBreadcrumbLayer = item.down(\"div\");\n\n\t\t\t\tif(typeof curBreadcrumbLayer == \"undefined\") {\n\t\t\t\t\t// special treatment IE5.5\n\t\t\t\t\tcurBreadcrumbLayer = item.getElementsByTagName(\"DIV\")[0];\n\t\t\t\t}\n\n\t\t\t\tif(curBreadcrumbLayer) {\n\t\t\t\t\tvar iframeLining = new IframeLining(curBreadcrumbLayer);\n\n\t\t\t\t\titem.observe(\"mouseover\", function(e) {\n\t\t\t\t\t\tthis.addClassName(\"active\");\n\t\t\t\t\t\tiframeLining.show();\n\t\t\t\t\t}.bindAsEventListener(item));\n\n\t\t\t\t\titem.observe(\"mouseout\", function(e) {\n\t\t\t\t\t\tvar relatedTarget = $(e.relatedTarget || e.toElement);\n\n\t\t\t\t\t\tif(relatedTarget!=this && relatedTarget.childOf(this)==false) {\n\t\t\t\t\t\t\tthis.removeClassName(\"active\");\n\t\t\t\t\t\t\tiframeLining.hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bindAsEventListener(item));\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}", "function update_breadcrumb(currentSlide) {\n const bs = currentSlide.getElementsByClassName(\"breadcrumb-data\")[0];\n if (bs !== undefined ) {\n breadcrumb_bar.textContent = bs.textContent\n } else {\n breadcrumb_bar.textContent = ''\n }\n }", "function backTutorial() {\n if (slide == 1) {\n $('.tutorial').hide();\n $('.tutorialImg').hide();\n $('main').fadeIn(1000, function() {\n $(this).css('display', 'block');\n });\n $('.menu').fadeIn(1000, function() {\n $(this).css('display', 'block');\n });\n $('.content nav').show();\n return;\n }\n $('#tutorial' + slide--).hide();\n $('#tutorial' + slide).show(); \n}", "function fadeLinks() {\n links.forEach((link) => {\n link.classList.toggle(\"fade\");\n });\n}", "setupFade(fadeTime, from, to, onFadeDone) {}", "function smfFader()\n{\n\tif (smfFadeContent.length <= 1)\n\t\treturn;\n\n\t// A fix for Internet Explorer 4: wait until the document is loaded so we can use setInnerHTML().\n\tif (typeof(window.document.readyState) != \"undefined\" && window.document.readyState != \"complete\")\n\t{\n\t\twindow.setTimeout('smfFader();', 20);\n\t\treturn;\n\t}\n\n\t// Starting out? Set up the first item.\n\tif (smfFadeIndex == -1)\n\t{\n\t\tsetInnerHTML(smfFadeScroller, smfFadeBefore + smfFadeContent[0] + smfFadeAfter);\n\t\tsmfFadeIndex = 1;\n\n\t\t// In Mozilla, text jumps around from this when 1 or 0.5, etc...\n\t\tif (typeof(smfFadeScroller.style.MozOpacity) != \"undefined\")\n\t\t\tsmfFadeScroller.style.MozOpacity = \"0.90\";\n\t\telse if (typeof(smfFadeScroller.style.opacity) != \"undefined\")\n\t\t\tsmfFadeScroller.style.opacity = \"0.90\";\n\t\t// In Internet Explorer, we have to define this to use it.\n\t\telse if (typeof(smfFadeScroller.style.filter) != \"undefined\")\n\t\t\tsmfFadeScroller.style.filter = \"alpha(opacity=100)\";\n\t}\n\n\t// Are we already done fading in? If so, fade out.\n\tif (smfFadePercent >= 510)\n\t\tsmfFadeSwitch = !smfFadeSwitch;\n\t// All the way faded out?\n\telse if (smfFadePercent <= -64)\n\t{\n\t\tsmfFadeSwitch = !smfFadeSwitch;\n\n\t\t// Go to the next item, or first if we're out of items.\n\t\tsetInnerHTML(smfFadeScroller, smfFadeBefore + smfFadeContent[smfFadeIndex++] + smfFadeAfter);\n\t\tif (smfFadeIndex >= smfFadeContent.length)\n\t\t\tsmfFadeIndex = 0;\n\t}\n\n\t// Increment or decrement the fade percentage.\n\tif (smfFadeSwitch)\n\t\tsmfFadePercent -= 255 / smfFadeDelay * 2;\n\telse\n\t\tsmfFadePercent += 255 / smfFadeDelay * 2;\n\n\t// If it's not outside 0 and 256... (otherwise it's just delay time.)\n\tif (smfFadePercent < 256 && smfFadePercent > 0)\n\t{\n\t\t// Easier... also faster...\n\t\tvar tempPercent = smfFadePercent / 255, rounded;\n\n\t\tif (typeof(smfFadeScroller.style.MozOpacity) != \"undefined\")\n\t\t{\n\t\t\trounded = Math.round(tempPercent * 100) / 100;\n\t\t\tsmfFadeScroller.style.MozOpacity = rounded == 1 ? \"0.99\" : rounded;\n\t\t}\n\t\telse if (typeof(smfFadeScroller.style.opacity) != \"undefined\")\n\t\t{\n\t\t\trounded = Math.round(tempPercent * 100) / 100;\n\t\t\tsmfFadeScroller.style.opacity = rounded == 1 ? \"0.99\" : rounded;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar done = false;\n\t\t\tif (typeof(smfFadeScroller.filters.alpha) != \"undefined\")\n\t\t\t{\n\t\t\t\t// Internet Explorer 4 just can't handle \"try\".\n\t\t\t\teval(\"try\\\n\t\t\t\t\t{\\\n\t\t\t\t\t\tsmfFadeScroller.filters.alpha.opacity = Math.round(tempPercent * 100);\\\n\t\t\t\t\t\tdone = true;\\\n\t\t\t\t\t}\\\n\t\t\t\t\tcatch (err)\\\n\t\t\t\t\t{\\\n\t\t\t\t\t}\");\n\t\t\t}\n\n\t\t\tif (!done)\n\t\t\t{\n\t\t\t\t// Get the new R, G, and B. (it should be bottom + (range of color * percent)...)\n\t\t\t\tvar r = Math.ceil(smfFadeTo.r + smfFadeRange.r * tempPercent);\n\t\t\t\tvar g = Math.ceil(smfFadeTo.g + smfFadeRange.g * tempPercent);\n\t\t\t\tvar b = Math.ceil(smfFadeTo.b + smfFadeRange.b * tempPercent);\n\n\t\t\t\t// Set the color in the style, thereby fading it.\n\t\t\t\tsmfFadeScroller.style.color = 'rgb(' + r + ', ' + g + ', ' + b + ')';\n\t\t\t}\n\t\t}\n\t}\n\n\t// Keep going.\n\twindow.setTimeout('smfFader();', 20);\n}", "function FadeIn(element, callback) { StartShow(element, Config.Timer.Fade, Type.Fade, callback); }", "function fadeOut(a){return a.style.opacity=1,function b(){(a.style.opacity-=.1)<0?a.style.display=\"none\":requestAnimationFrame(b)}(),!0}", "fadeIn() {\n const self = this;\n const $el = $(this.newContainer);\n // Hide old Container\n $(this.oldContainer).hide();\n\n $el.css({\n visibility: 'visible',\n opacity: 0\n });\n\n TweenMax.to($el, 0.4, {\n opacity: 1,\n onComplete: () => {\n this.done();\n }\n });\n }", "function invFade(obj)\n {\n obj.removeClass('invisible')\n .addClass('animated fadeIn')\n }", "function highlight() {\n $section.prev('h3').css('background', 'linear-gradient(#226758, #32957B)').fadeOut(1000, function() {\n $section.prev('h3').css('background', 'linear-gradient(#272822, #3B3A32)').fadeIn(400);\n });\n }", "function cycleQuote() {\n var currentQuote = $(quoteDivs).eq(quoteIndex);\n $(currentQuote).fadeIn(1200);\n currentQuote.delay(4000);\n $(currentQuote).fadeOut(1200, cycleQuote);\n currentQuote.delay(1200);\n quoteIndex = ++quoteIndex % quoteDivs.length;\n}", "function aniLinkOn()\n{\n $(this).animate({opacity:'1'}, {duration:LINK_FADE_TIME,queue:false});\n}", "function fadeStuffs() {\n $(\".hidden\").fadeIn('slow', 'swing').removeClass('hidden');\n }", "function fadeInSlide(next) {\n next.fadeIn(animationDuration);\n }", "transitionToTutorial() {\n if (this.tick <= 50) {\n this.logo.alpha -= 0.02;\n this.pressAnyKey.alpha -= 0.02;\n this.titleText.alpha -= 0.02;\n }\n else if (this.tick <= 100) {\n this.tutorial.alpha += 0.02;\n }\n else {\n this.state = 2;\n this.tick = 0;\n this.fireToContinue.setAlpha(1);\n }\n }", "function tab(cur) {\n $li.find('img').fadeOut('slow');\n // $dot_li.removeClass('cur');\n $li.eq(cur).find('img').fadeIn('slow');\n // $dot_li.eq(cur).addClass('cur');\n // $li.find('img').removeClass('cur');\n // $li.eq(cur).find('img').addClass('cur');\n }", "function blink(selector){\n let count = 0;\n while(count<6) {\n $(selector).fadeOut('slow', function(){\n $(this).fadeIn('slow', function(){\n blink(this);\n });\n });\n count++;\n }\n}", "function flash_animations() {\n if ($('#notify > div').length > 0) {\n $('#notify').show();\n }\n\n $('#flash').delay(500).fadeIn('normal', function () {\n $(this).delay(4000).fadeOut('normal', function () {\n $(this).hide();\n $('#notify').hide();\n });\n });\n}", "function do_fade() {\n \t\tif (!fadeFinished)\t\t\t\t\t\t\t\t// If we're still fading...\n\t \t\tvar noOfScreens = fadescreens.length;\t\t\t// ... get the number of layers we're fading.\n\t \t\tif (opacity > 0) {\t\t\t\t\t\t\t\t// If they're sill visible...\n\t \t\t\topacity -= 0.025;\t\t\t\t\t\t\t// ... fade the opacity a little bit for this frame ...\n\t \t\t\tfor ( var i = 0; i < noOfScreens; i++ )\t\t// ... and apply this to all the layers we need to fade\n\t \t\t\t\tfadescreens[i].canvas.style.opacity = opacity;\n\t \t\t}\n\t \t\telse {\t\t\t\t\t\t\t\t\t\t\t// If they're not visible ...\n\t \t\t\tfor ( var i = 0; i < noOfScreens; i++ )\t\t// ... hide all the layers ...\n\t \t\t\t\tfadescreens[i].hide();\n\t \t\t\tfadeFinished = true;\t\t\t\t\t\t// ... and stop the fade.\n\t \t\t}\n \t}", "function FancyTitleText(){\n\t\t\t$('.titletext').fadeOut(1500); \t\n $('.titletext').fadeIn(1500);\n }", "function fadeInDisplay(el) {\nel.style.display = 'block';\nel.style.opacity = 0;\nvar last = +new Date();\nvar tick = function() {\n el.style.opacity = +el.style.opacity + (new Date() - last) / 400;\n last = +new Date();\n if (+el.style.opacity < 1) {\n (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);\n }\n};\ntick();\n}", "function display(event) {\n \n $(event.currentTarget).next().fadeIn(\"slow\");\n \n}//end of display", "function jumpToHistory(){\n $(\"#end\").hide();\n $(\"#header\").hide();\n $(\"#history\").show();\n }", "function onAfter() {\n $('h1, h2', this).fadeIn();\n }", "function fade() {\n for (var i = 0; i < logos.length; i++) {\n logos[i].style.display = (logos[i].style.display === \"block\") ? 'none' : 'block';\n }\n\n setTimeout(\"fade()\", 3000);\n}", "function blinkAnimate(){\r\n\t\t\tif (gameState.currentState != states.gameover \r\n\t\t\t\t&& gameState.currentState != states.demo){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tel.style.opacity = Tween.easeInOutQuad(t,start,change,dur);\r\n\t\t\tt++;\r\n\t\t\t\r\n\t\t\tt = t % (dur*2);\r\n\t\t\t\r\n\t\t\tsetTimeout(function(){\r\n\t\t\t\tblinkAnimate();\r\n\t\t\t},20)\r\n\t\t}", "function fadeIn() {\n\n if (ctx.globalAlpha < 1) {\n ctx.globalAlpha += 0.001;\n paint(); }\n }", "function setStatus(node) {\n var elements = [];\n $(node).each(function() {\n elements.push($(node).nextAll());\n });\n for (var i = 0; i < elements.length; i++) {\n if (elements[i].css(\"display\") == \"none\") {\n elements[i].fadeIn();\n } else {\n elements[i].fadeOut(0);\n }\n }\n if (elements[0].css(\"display\") != \"none\") {\n $(node).addClass(\"active\");\n } else {\n $(node).removeClass(\"active\");\n }\n }", "function flash() {\n if (front.style.visibility != \"hidden\") {\n front.style.visibility = \"hidden\";\n back.style.visibility = \"visible\";\n } else {\n front.style.visibility = \"visible\";\n back.style.visibility = \"hidden\";\n }\n }", "function initializeBreadcrumbTrail() {\r\n // Add the svg area.\r\n var trail = d3.select(el).select(\".sunburst-sequence\").append(\"svg\")\r\n .attr(\"width\", width)\r\n //.attr(\"height\", 50)\r\n .attr(\"id\", el.id + \"-trail\");\r\n // Add the label at the end, for the percentage.\r\n trail.append(\"text\")\r\n .attr(\"id\", el.id + \"-endlabel\")\r\n .style(\"fill\", \"#000\");\r\n }", "goHigher () {\n if (this.breadcrumbs.length <= 1) {\n return;\n }\n const parts = this.breadcrumbs.slice(0, this.breadcrumbs.length - 1);\n this.goToPath('/' + parts.join('/'));\n }", "function _changeBg(index, arrayEl, time){\n\t\tif(index===0)\n\t\t\t$(arrayEl[0]).fadeIn(2000);\n\t\tsetTimeout(function(){\n $(arrayEl[index]).fadeOut(2000);\n if(index+1 < arrayEl.length)\n \t$(arrayEl[index+1]).fadeIn(2000);\n\n return index+1 === arrayEl.length ? _changeBg(0, arrayEl, time): _changeBg(index+1, arrayEl, time);\n }, time);\n\t}", "function firstStage() {\n\tstage.first().fadeIn(500).addClass('active');\n}", "function aniLinkOff()\n{\n $(this).animate({opacity:'0.3'}, {duration:LINK_FADE_TIME,queue:false});\n}", "fadeOutAll() {\n this._rippleRenderer.fadeOutAll();\n }", "fadeOutAll() {\n this._rippleRenderer.fadeOutAll();\n }", "fadeOutAll() {\n this._rippleRenderer.fadeOutAll();\n }", "function Hide(){\n // This sets it so it will subtract .10 to count every time it loops\n count-=.10;\n // calls the fade function\n fade();\n // It will loop through once\n if (count > 0){\n setTimeout(Hide, 100); \n }\n}", "CrossFadeQueued() {}", "_show() {\n $.setDataset(this._target, { uiAnimating: 'in' });\n\n $.addClass(this._target, 'active');\n $.addClass(this._node, 'active');\n\n $.fadeIn(this._target, {\n duration: this._options.duration,\n }).then((_) => {\n $.setAttribute(this._node, { 'aria-selected': true });\n $.removeDataset(this._target, 'uiAnimating');\n $.triggerEvent(this._node, 'shown.ui.tab');\n }).catch((_) => {\n if ($.getDataset(this._target, 'uiAnimating') === 'in') {\n $.removeDataset(this._target, 'uiAnimating');\n }\n });\n }", "function ShowHighlight() {\n \n // Change Scene\n if ( current_Scene.attr('id') != 'Highlight' ) {\n \n current_Scene.fadeOut(1000);\n current_Scene = $('#Highlight');\n current_Scene.fadeIn(1000); \n AdobeEdge.getComposition('OTF-Highlight').getStage().getSymbol('Highlight_All').getSymbol('HighLight_PInfo').stop(0);\n AdobeEdge.getComposition('OTF-Highlight').getStage().getSymbol('Highlight_All').getSymbol('HighLight_PInfo2').stop(0);\n AdobeEdge.getComposition('OTF-Highlight').getStage().play(0);\n \n }\n \n}", "function homeFlashyChainTitleHide(){\n\t$('#title')\n\t\t.transition({\n\t\t\tanimation : 'tada',\n\t\t\tduration : '.9s',\n\t\t})\n\t\t.transition({\n\t\t\tanimation : 'scale',\n\t\t\tonComplete : function() {\n\t\t\t\thomeFlashyChainQuoteSlideIn();\n\t\t\t}\n\t\t})\n\t;\n}", "function fadeOut() {\n transitionPlane.emit('fadeOut');\n setTimeout(setBackwards, 100);\n}", "function display(event) {\n \n $(event.currentTarget) .next() .fadeIn(\"slow\");\n \n}//end of display", "function display(event) { \n \n $(event.currentTarget) .next() .fadeIn(\"slow\"); \n\n}//end of display", "function backtomenu() {\n $(document).ready(function () {\n $(\"#menu\").fadeIn(\"500\");\n });\n}", "function addFadeIn (val) {\n val.classList.add(\"fadeInAnimation\"); // add fade in animation to the content\n val.style.opacity = 1; // set the content to be visible after the animation\n}", "function dm3_fade_in_title(obj) {\r\n\tobj.each(function() {\r\n\t\tvar title = $(this);\r\n\t\tvar parent = title.parent();\r\n\t\t\r\n\t\ttitle.css('opacity', 0);\r\n\t\t\r\n\t\tparent.hover(function() {\r\n\t\t\t$(this).find('.fade_in_title:first').stop().animate({opacity: 0.8}, {duration: 600});\r\n\t\t}, function() {\r\n\t\t\t$(this).find('.fade_in_title:first').stop().animate({opacity: 0}, {duration: 800});\r\n\t\t});\r\n\t});\r\n}", "function fadeOut(target) {\n var sopac = 1;\n var fopac = 0;\n var elem = document.getElementById(target);\n var id = setInterval(frame, 10);\n var ms = 100;\n sopac = sopac * ms;\n\n function frame() {\n if ((sopac) === (fopac)) {\n clearInterval(id);\n elem = \"<p> <br> </p>\";\n } else {\n sopac -= 1;\n elem.style.opacity = sopac / ms;\n }\n }\n}", "function forwardTutorial() {\n if (slide == SLIDE_SIZE) {\n slide = 1;\n $('.tutorial').hide();\n $('.tutorialImg').hide();\n $('main').fadeIn(1000, function() {\n $(this).css('display', 'block');\n });\n $('.menu').fadeIn(1000, function() {\n $(this).css('display', 'block');\n });\n $('.content nav').show();\n return;\n }\n $('#tutorial' + slide++).hide();\n $('#tutorial' + slide).show();\n}", "function backClicked(){\n rightThird.innerHTML = rightThird.innerHTML; //maintains the rightThird text for the duration of the fade out animation (I think- idk if this is necessary)\n \n textFadeOut.play(); //plays the animation to fade out the text\n \n\n anime({ //animation to reset the suit to its default position\n targets: mainImg,\n scale: 1,\n translateX: 0,\n translateY: 0,\n easing: 'easeInOutCubic'\n });\n\n anime({ //fades the dots back in\n targets: allDots,\n opacity: 100,\n delay: anime.stagger(200)\n });\n\n setTimeout(restoreDefaultContent, 1000); //after a 1000ms delay, triggers restoreDefaultContent\n}", "function blink_text() {\n $('#blinker').fadeOut(250);\n $('#blinker').fadeIn(250);\n}", "function displaySequence() {\n waitingForInput = false;\n for (var i = 0; i < history.length; i++) {\n (function (i) {\n window.setTimeout(activateColor, 1000 * (i + 1), i);\n })(i);\n }\n }", "function _previousStep() {\n if(this._currentStep == 0)\n return;\n\n _showElement.call(this, this._introItems[--this._currentStep].element);\n }", "function fadeInStepsInPage(page, steps) {\n if(steps.length > 0) {\n $('#page_' + page + ' .step_' + steps[0]).fadeIn(1000, function() {\n fadeInStepsInPage(page, steps.slice(1));\n });\n }\n}", "function show() {\n\t\ttID = null;\n\t\tif ((!IE || !$.fn.bgiframe) && settings(current).fade) {\n\t\t\tif (helper.parent.is(\":animated\"))\n\t\t\t\thelper.parent.stop().show().fadeTo(settings(current).fade, current.tOpacity);\n\t\t\telse\n\t\t\t\thelper.parent.is(':visible') ? helper.parent.fadeTo(settings(current).fade, current.tOpacity) : helper.parent.fadeIn(settings(current).fade);\n\t\t} else {\n\t\t\thelper.parent.show();\n\t\t}\n\t\tupdate();\n\t}", "function animateFlashElement(divElem) {\n $(divElem).fadeIn(100).fadeOut(100).fadeIn(100);\n}", "function setBreadcrumb(breadcrumb) {\n $(\"#breadcrumbs\").html(\"<p><a href='dashboard.php'><i class='fas fa-home'></i></a> / \" + breadcrumb + \"</p>\");\n}", "function display(event) {\n \n $(event.currentTarget).next().fadeIn('slow');\n\n }", "function sequentialContentReveal(){\n \n var visibilityTrigger = true;\n var countVisibleElements = 0;\n $(\"#passages>.passage\").children().each(\n function (){\n // Find first hidden paragraph and check whether code has already been executed before\n if($(this).css(\"opacity\") == \"0\" && visibilityTrigger == true){ \n $(\"#scrollIcon\").css(\"visibility\",\"visible\");\n $(this).css(\"max-height\",$(this).css(\"height\"));\n $(this).css(\"width\",\"0px\");\n $(this).animate({\"width\":\"864px\",\"opacity\":\"1\"},750,\"linear\");\n visibilityTrigger = false;\n if($(\"#passages>.passage\").children().length-1 == countVisibleElements)\n countVisibleElements++;\n }else{\n countVisibleElements++;\n }\n if($(\"#passages>.passage\").children().length == countVisibleElements && $(window).scrollTop() == $(document).height()-$(window).height())\n $(\"#scrollIcon\").css(\"visibility\",\"hidden\");\n }\n );\n}", "function fadeIn(ms) {\n\t// array of random steps\n\tsteps = [];\n\tvar rows = cipherblock.length;\n\tvar cols = cipherblock[0].length;\n\tfor (var row=0; row<rows; row++) {\n\t\tsteps[row] = [];\n\t\tfor (var col=0; col<cols; col++) {\n\t\t\tsteps[row][col] = Math.max(Math.random()/20, 0.02);\n\t\t\tcipherblock[row][col].style.opacity = 0;\n\t\t}\n\t}\n\t\n\tvar total = cipherblock.length * cipherblock[0].length;\n\tvar completed = 0;\n\t\n\tvar id = setInterval(frame, ms);\n\tvar count = 0;\n\tvar opacity;\n\tfunction frame() {\n\t\tfor (var row=0; row<rows; row++) {\n\t\t\tfor (var col=0; col<cols; col++) {\n\t\t\t\topacity = parseFloat(cipherblock[row][col].style.opacity);\n\t\t\t\tif (opacity >= 1) continue; // already finished this one\n\t\t\t\topacity += steps[row][col];\n\t\t\t\tif (opacity >= 1) {\n\t\t\t\t\topacity = 1;\n\t\t\t\t\tcompleted++;\n\t\t\t\t}\n\t\t\t\tcipherblock[row][col].style.opacity = opacity;\n\t\t\t}\n\t\t}\n\t\tif (completed == total) {\n\t\t\tclearInterval(id);\n\t\t}\n\t}\n}", "function hide() {\n\t var time = arguments.length <= 0 || arguments[0] === undefined ? 200 : arguments[0];\n\t\n\t this.transition().duration(time).style('opacity', 0);\n\t }", "function fadeIn(listItem) {\n listItem.style.opacity = 0;\n // listItem.style.backgroundColor = '#99C262';\n\n\n var tick = function() {\n listItem.style.opacity = +listItem.style.opacity + 0.05;\n\n if (+listItem.style.opacity < 1) {\n (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16)\n }\n\n };\n\n tick();\n listItem.style.backgroundColor = 'hsl(75, 100%, 1%)';\n var d = 1;\n for (var i = 75; i <= 100; i = i + 0.05) { //i represents the lightness\n d += 4.75;\n (function(ii, dd) {\n setTimeout(function() {\n listItem.style.backgroundColor = 'hsl(220, 100%, ' + ii + '%)';\n }, dd);\n })(i, d);\n }\n }", "function teardownFade() {\n fader.removeClass('show fadeOut');\n }", "function triBackHome() {\n\n\tpos = $('#navigation ul li a.current').position();\n\t\n\tif(pos) {\n\t\t$(\"#triSlideContainer img\").stop().animate({marginLeft:(pos.left+(widest/2+10))+\"px\"}, 1000);\n\t} else {\n\t\t$(\"#triSlideContainer img\").css(\"display\", \"none\");\n\t}\n\t\n}", "function display(event) {\n \n $(event.currentTarget).css(\"background-color\", \"#FAFF7E\");\n $(event.currentTarget).next().toggle(\"slow\");\n $(event.currentTarget).next().children().css(\"background-color\", \"#51FF0D\");\n \n \n\n}//end of display", "function blink(selector){\n $(selector).animate({opacity:0}, 50, \"linear\", function(){\n $(this).delay(700);\n $(this).animate({opacity:1}, 50, function(){\n blink(this);\n });\n $(this).delay(700);\n });\n}", "function pulse_flash() {\n $('.flash, .flash p').effect('highlight', {}, 3000)\n}", "function next_step(idx){\r\n /*$(\"#steps li\").eq(idx-1).velocity(\"fadeOut\", {delay : 0, duration: 200, complete : function(){ */\r\n\t\t$('#steps li').eq(idx-1).removeClass('current_step');\r\n\t\t$('#steps li').eq(idx).addClass('current_step');\r\n\t\tupdate_progress(idx+1);\r\n /*}});*/\r\n\t}", "function next_step(idx){\r\n /*$(\"#steps li\").eq(idx-1).velocity(\"fadeOut\", {delay : 0, duration: 200, complete : function(){ */\r\n\t\t$('#steps li').eq(idx-1).removeClass('current_step');\r\n\t\t$('#steps li').eq(idx).addClass('current_step');\r\n\t\tupdate_progress(idx+1);\r\n /*}});*/\r\n\t}", "function fade(fadeElem, cachedElem) {\n\t\topacityUp += 0.01;\n\t\topacityDown -= 0.01;\n\t\t\n\t\t\n\t\tfadeElem.style.opacity = opacityUp.toFixed(2); \n\t\tlastElem.style.opacity = opacityDown.toFixed(2);\n\t\n\t\tif (opacityUp.toFixed(2) == 1.00) \n\t\t {\n\t\t\t clearInterval(opct);\n\t\t\t lastElem.style.display = 'none';\n\t\t }\t\t \n\t }// end fade function\t " ]
[ "0.5835933", "0.5644747", "0.56027085", "0.5581989", "0.552389", "0.5522895", "0.5458817", "0.542649", "0.5417551", "0.53699005", "0.5362727", "0.5361431", "0.5331247", "0.5320483", "0.53136295", "0.53136086", "0.5297041", "0.527579", "0.5220569", "0.5220565", "0.5202862", "0.52008194", "0.5198412", "0.5190194", "0.5188257", "0.5186737", "0.51841563", "0.5179645", "0.5167357", "0.51605755", "0.5152935", "0.51528966", "0.5145925", "0.5143285", "0.51386803", "0.51357", "0.51339537", "0.51322556", "0.51292086", "0.5124053", "0.5117058", "0.5112809", "0.51116866", "0.51090866", "0.5108492", "0.51037866", "0.50962573", "0.50930667", "0.50881416", "0.5077017", "0.5072916", "0.5072619", "0.50624615", "0.50607795", "0.50586784", "0.50564575", "0.50552726", "0.5053954", "0.5053735", "0.5050295", "0.5049996", "0.50493544", "0.50491434", "0.50378525", "0.50268555", "0.50268555", "0.50268555", "0.5024842", "0.50245064", "0.50208694", "0.50182027", "0.50101537", "0.50087035", "0.5006271", "0.5001377", "0.4982681", "0.49796596", "0.49764043", "0.49721786", "0.49633345", "0.49572667", "0.49556842", "0.49481732", "0.49481606", "0.49468502", "0.49380937", "0.49319148", "0.4930761", "0.4923685", "0.49229264", "0.49221265", "0.4921299", "0.49208426", "0.4918002", "0.49165413", "0.49140614", "0.49121088", "0.4911645", "0.49064177", "0.49064177", "0.49009132" ]
0.0
-1
Restore everything to full opacity when moving off the visualization.
function mouseleave(d) { // Hide the breadcrumb trail d3.select("#trail") .style("visibility", "hidden"); // Deactivate all segments during transition. d3.selectAll("path").on("mouseover", null); // Transition each segment to full opacity and then reactivate it. d3.selectAll("path") .transition() .duration(1000) .style("opacity", 1) .on("end", function() { d3.select(this).on("mouseover", mouseover); }); d3.select("#explanation") .style("visibility", "hidden"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "reset() {\n this.alpha = 0;\n this.y = 0;\n }", "function changeOpacity() {\n heatmap.set(\"opacity\", heatmap.get(\"opacity\") ? null : 0.2);\n }", "function opacityUp() {\n for (let ii = 0; ii < props.activeLayers.length; ii++) {\n let ind = props.activeLayers[ii];\n if (props.mainComp.layers[ind].opacity < 0.9) {\n props.mainComp.layers[ind].opacity += 0.1;\n } else {\n props.mainComp.layers[ind].opacity = 1.0;\n }\n }\n props.changeOneTimeEvent(\"redrawCanvas\");\n }", "changeOpacity() {\n this.heatmap.set('opacity', this.heatmap.get('opacity') ? null : 0.2);\n }", "kill() {\n this.segments.forEach(s => s.el.style.opacity = '0.5');\n }", "function animateOut() {\n\n chartRing.selectAll('.chart-ring')\n .style('opacity', 1)\n .transition()\n .duration(DURATION)\n .delay(function (d, i) {\n return (DELAY + (i * 100));\n })\n .style('opacity', 0);\n }", "function vizToggleCleanup(){\n setRangeSliderThumbOpacity();\n layerObj[id].visible = layer.visible;\n layerObj[id].opacity = layer.opacity;\n }", "function mouseout() {\n\t\t\t// Transition each segment to full opacity and then reactivate it.\n\t\t\tsvg.selectAll('path').style('opacity', 1);\n\t\t}", "ClearChartElementHighlight() {\n this.chartElement.style.opacity = 1;\n }", "reset() {\n this.makeNormal();\n this.lighten();\n }", "opacityOff() {\n [].forEach.call(this.elements, (el) => {\n if (el.classList.contains('out')) {\n el.classList.remove('out');\n }\n });\n }", "resetOpacity() {\n for (const key of Object.keys(this.meshDict)) {\n if (!this.meshDict[key]['background']) {\n if (!('morph_type' in this.meshDict[key]) ||\n (this.meshDict[key]['morph_type'] != 'Synapse SWC')) {\n for (let i in this.meshDict[key].object.children) {\n if (this.meshDict[key]['opacity'] >= 0.){\n this.meshDict[key].object.children[i].material.opacity = this.meshDict[key]['opacity'] * this.settings.defaultOpacity;\n } else {\n this.meshDict[key].object.children[i].material.opacity = this.settings.defaultOpacity;\n }\n }\n } else {\n for (let i in this.meshDict[key].object.children){\n if (this.meshDict[key]['opacity'] >= 0.){\n this.meshDict[key].object.children[i].material.opacity = this.meshDict[key]['opacity'] * this.settings.synapseOpacity;\n } else {\n this.meshDict[key].object.children[i].material.opacity = this.settings.synapseOpacity;\n }\n }\n }\n } else {\n if (this.meshDict[key]['opacity'] >= 0.){\n this.meshDict[key].object.children[0].material.opacity = this.meshDict[key]['opacity'] * this.settings.backgroundOpacity;\n this.meshDict[key].object.children[1].material.opacity = this.meshDict[key]['opacity'] * this.settings.backgroundWireframeOpacity;\n } else{\n this.meshDict[key].object.children[0].material.opacity = this.settings.backgroundOpacity;\n this.meshDict[key].object.children[1].material.opacity = this.settings.backgroundWireframeOpacity;\n }\n }\n }\n }", "function defaultOpacity() {\n ionInstance.update({from: 1});\n censusblockLyr.opacity = 1;\n }", "onEnterBack() {\n state.glassBottle.alpha = 0;\n clear(state.ctx.glassBottle);\n }", "onEnterBack() {\n state.glassBottle.alpha = 0;\n clear(state.ctx.glassBottle);\n }", "transitionOut() {\n // default to clear all layers\n for (let i = 0; i < this.game.Canvas.layers.length; i++) {\n this.game.Canvas.layers[i].clear();\n }\n }", "function setBackToNoraml() {\n liveFloorview.style.transform = 'scale(.4)';\n liveFloorview.style.opacity = '0';\n workstation.style.transform = 'translateX(100%)'\n}", "function resetStyle($el, fx) {\r\n\t\t\t$el.css({ display: '' });\r\n\t\t\tif (!$.support.opacity && fx.opacity) {\r\n\t\t\t\t$el[0].style.removeAttribute('filter');\r\n\t\t\t}\r\n\t\t}", "transitionOut() {\n const layersToClear = ['menu'];\n for (let i = 0; i < layersToClear.length; i++) {\n this.Canvas.getLayerByName(layersToClear[i]).clear();\n }\n }", "function reset() {\n svg2.transition().duration(750).call(\n zoom.transform,\n d3.zoomIdentity,\n d3.zoomTransform(svg.node()).invert([width / 2, height / 2])\n );\n // set transparency to 0 so that it looks like disappeared\n svg2.selectAll('path')\n .attr(\"fill-opacity\", 0)\n }", "function endMove(event) {\n current.win.style.opacity = 1;\n }", "function unhighlight(vis) {\n\n // Reset opacity.\n vis.selectAll('polyline')\n .style('opacity', HIGHLIGHT_OPACITY);\n vis.selectAll('circle')\n .style('opacity', HIGHLIGHT_OPACITY);\n vis.selectAll('text.label')\n .style('opacity', HIGHLIGHT_OPACITY);\n}", "function mouseOff() {\n $(this).fadeTo(500,0.2);\n }", "function resetStyle( $el, fx ) {\n\t\t\t$el.css( \"display\", \"\" );\n\t\t\tif ( !$.support.opacity && fx.opacity ) {\n\t\t\t\t$el[ 0 ].style.removeAttribute( \"filter\" );\n\t\t\t}\n\t\t}", "function resetStyle( $el, fx ) {\n\t\t\t$el.css( \"display\", \"\" );\n\t\t\tif ( !$.support.opacity && fx.opacity ) {\n\t\t\t\t$el[ 0 ].style.removeAttribute( \"filter\" );\n\t\t\t}\n\t\t}", "function resetStyle( $el, fx ) {\n\t\t\t$el.css( \"display\", \"\" );\n\t\t\tif ( !$.support.opacity && fx.opacity ) {\n\t\t\t\t$el[ 0 ].style.removeAttribute( \"filter\" );\n\t\t\t}\n\t\t}", "clearHighlight() {\n // ++++++++ BEGIN CUT +++++++++++\n d3.select('#country-detail').style('opacity', 0);\n // ++++++++ END CUT +++++++++++\n }", "function resetStyle($el, fx) {\n $el.css({\n display: ''\n });\n if ($.browser.msie && fx.opacity) $el[0].style.removeAttribute('filter');\n }", "function lowlight() { // remove any highlight\n if (OldTarget) {\n OldTarget.scale = 1.0;\n OldTarget = null;\n }\n }", "function mainPanelOff() {\n (Settings.niceView) ? mainPanel1.setAttributeNS(null, \"fill\", \"#000\") : mainPanel0.setAttributeNS(null, \"fill\", \"#000\");\n}", "function dis(element, event) \n{\n if (element.style.opacity)\n element.style = \"\";\n else\n element.style.opacity = 0;\n}", "function resetStyle($el, fx) {\n\t\t\t$el.css({ display: '' });\n\t\t\tif ($.browser.msie && fx.opacity) {\n\t\t\t\t$el[0].style.removeAttribute('filter');\n\t\t\t}\n\t\t}", "function allOff() {\n facetsOff();\n }", "'transparent'(callback) {\n\t\tthis.style('opacity', 0, callback);\n\t}", "function grayOut() {\r\n that.surface.createRect({\r\n x: 0, y: 0, width: that.width, height: that.height\r\n }).setFill([255, 255, 255, 0.4]);\r\n }", "runPreLoadActions() {\n this.el.style.opacity = 0;\n }", "invert() {\n this.addEffect(new Effects.Invert());\n }", "desaturate() {\n this.saturate(-1);\n }", "visualEffectOnDeactivation(endColour) {\n this.changeColour(endColour);\n this.removeScale();\n }", "function fadeCanvasBackIn() {\n //Transition settings\n const duration = 250;\n const ease = d3.easeQuadInOut;\n\n //Calculate the opacity interpolator\n nodes.forEach(n => {\n n.interpolate_opacity = d3.interpolate(n.opacity, 1);\n });\n edges_concepts.forEach(l => {\n l.interpolate_opacity = d3.interpolate(\n l.opacity,\n opacity_concept_default\n );\n });\n edges_elements.forEach(l => {\n l.interpolate_opacity = d3.interpolate(\n l.opacity,\n opacity_element_default\n );\n });\n\n //Fade everything back in\n timer_draw = d3.timer(elapsed => {\n //How far along the total duration are we (taking the easing into account)\n let t = ease(Math.min(1, elapsed / duration));\n\n //Set new opacities\n nodes.forEach(n => {\n n.opacity = n.interpolate_opacity(t);\n });\n edges_concepts.forEach(l => {\n l.opacity = l.interpolate_opacity(t);\n });\n edges_elements.forEach(l => {\n l.opacity = l.interpolate_opacity(t);\n });\n\n //Draw the canvas\n drawCanvas();\n\n //Stop when the duration has been reached\n if (elapsed >= duration) timer_draw.stop();\n }); //timer\n } //function fadeCanvasBackIn", "function deactivate(){\n\n /* Mark the initiate_coloring_walls as false that no need to color the rects */\n initiate_coloring_walls = false;\n}", "removeHighlight(teamName) {\n this.changeOpacity(\".curve\", Canvas.normalOpacity);\n }", "function reset(){\n\t\tsetSorting(false);\n\t\t// setDataBottom(new Array(rectNum).fill(new Rect(0,Math.round(maxWidth/rectNum),0)));\n\t\tsetLightUp([]);\n\t\t// setLightUpBottom([]);\n\n\t}", "function backToNormal() {\n gPacman.isSuper = false;\n gGhosts.forEach(function changeBackColor(ghost, idx) {\n ghost.color = gOriginalColors[idx];\n })\n while (gGhosts.length < 3) {\n createGhost(gBoard);\n }\n}", "function handleReset() {\n setBlur((blur = 0));\n setBrightness((brightness = 100));\n setContrast((contrast = 100));\n setGrayscale((grayscale = 0));\n setHue((hue = 0));\n setInvert((invert = 0));\n setOpacity((opacity = 100));\n setSaturate((saturate = 100));\n setSepia((sepia = 0));\n }", "function setVisual () {\n window.cancelAnimationFrame(drawVisual)\n visualize()\n }", "removeHighlight() {\n if (this._highlight) {\n this._highlight.setStyle({\n fillOpacity: 0,\n });\n }\n }", "function windowSaveOriginalOpacity() {\n if (!(originalOpacity in this))\n this[originalOpacity] = this.get_opacity();\n}", "function whiteout()\n {\n $('.square').css({'opacity':'1','background-color':'#FFF'});\n }", "function hideWMLoading(){\n\t\tcreatejs.Tween.removeTweens(wmLoading);\n\t\tcreatejs.Tween.get(wmLoading).to({alpha: 0}, 250);\n\t}", "reset() {\n this.parts.forEach((part) => part.setVisible(false));\n this.visibleIndex = -1;\n }", "restore () {\n\t\tthis.$element.removeClass('screenlayer-minimized');\n\t\tthis.show();\n\t}", "function _reset() {\n Df.style.backgroundColor = '';\n }", "function reset$1(source) {\n source.forEach(function(item) { item.opacity = 1; });\n return source;\n }", "function eraserFigureDraw()\n {\n figureCanvas.setAttribute(\"style\", \"opacity:0; height: 0;\");\n display.ds_01.setAttribute(\"style\", \"opacity:0;\");\n display.ds_02.setAttribute(\"style\", \"opacity:0;\");\n display.ds_03.setAttribute(\"style\", \"opacity:0;\");\n display.ds_04.setAttribute(\"style\", \"opacity:0;\");\n setTimeout(() =>\n {\n figureSplash.splash01.setAttribute(\"style\", \"opacity:0; margin-left: -300px;\");\n figureSplash.splash02.setAttribute(\"style\", \"opacity:0; margin-left: -300px;\");\n figureSplash.splash03.setAttribute(\"style\", \"opacity:0; margin-left: -300px;\");\n figureSplash.splash04.setAttribute(\"style\", \"opacity:0; margin-left: -300px;\");\n }, 300\n );\n }", "fadeOutAllNonPersistent() {\n this._rippleRenderer.fadeOutAllNonPersistent();\n }", "fadeOutAllNonPersistent() {\n this._rippleRenderer.fadeOutAllNonPersistent();\n }", "function ChangeOpacity(value) {\n guiData.opacity = value;\n p.getBubbleDrawer().adjustOpacity(value);\n if (!isPlaying)\n refreshDisplay();\n}", "function _sh_overview_hidden(){\n\tin_overview = false;\n\twrap_plane_clone.visible = false;\n\tif( paused_preserve ) pause();\n}", "function erase() {\n let grid = document.querySelectorAll('.grid-item');\n grid.forEach(element => {\n element.style.opacity = 0.1;\n })\n}", "function setEraser() {\n\tmouse.status = (mouse.status == mouseStatus.erase) ?\n\t\tmouseStatus.other : mouseStatus.erase;\n\tsetAllBtnColor();\n}", "function opacityChanged(){\n\n\tscribble_canvas.alpha = document.getElementById(\"opacitybtn\").value/100;\n\tscribble_canvas.UpdateSize( true );\n\tscribble_canvas.redraw();\n \n}", "visualEffectOnActivation() {\n this.transitionEndListenerOn();\n this.changeColour(this.colourGo);\n this.scale(0.97);\n }", "function resetHighlight() {\n\tfor (i in fgTileLayer.children) {\n\t\tfgTileLayer.children[i].setFill('rgba(0,0,0,0)');\n\t\tfgTileLayer.children[i].highlighted = false;\n\t}\n\tfgTileLayer.draw();\n}", "function toggleTransparency() {\n enableTransparency = !enableTransparency;\n}", "function resetHighlight(e) {\n var layer = e.target;\n layer.setStyle({\n weight: 3,\n opacity: 1,\n fillColor: '#faebd7'\n });\n }", "clear() {\n this.stop();\n this.scene.remove.apply(this.scene, this.scene.children);\n this.scene.background = null;\n this.mixers.splice(0, this.mixers.length);\n this.sceneMeshes.splice(0, this.sceneMeshes.length);\n $(\"#picker\").spectrum(\"hide\");\n }", "function toggleOpacity() {\n if (container.style.opacity === \"0\") {\n container.style.opacity = \"1\";\n backgrounds.childNodes.forEach(function(image, index) {\n if (index%2) {\n image.style.filter = \"brightness(0.5)\";\n }\n });\n }\n else {\n container.style.opacity = \"0\";\n backgrounds.childNodes.forEach(function(image, index) {\n if (index%2) {\n image.style.filter = \"brightness(1)\";\n }\n });\n }\n}", "function dimAllMarkers(){\n _markersSetOpacity(.3);\n dimVenues();\n}", "function dragleave(ev) {\n ev.target.style.opacity = \"1\";\n}", "function unfocusBars() {\r\n // Return all bars and logos to full opacity\r\n G_BARS.selectAll(\".data-bar\")\r\n .classed(\"focused\", false)\r\n .transition()\r\n .duration(HOVER_TRANS_TIME)\r\n .style(\"opacity\", 1);\r\n\r\n G_BARS.selectAll(\".data-image\")\r\n .classed(\"focused\", false)\r\n .transition()\r\n .duration(HOVER_TRANS_TIME)\r\n .style(\"opacity\", 1);\r\n\r\n // Hide tooltip\r\n TIP.hide();\r\n }", "function clear() {\n contentVeil.reset();\n contentVeil.hide();\n removePreviewLegend();\n unwrapInterestingRange();\n }", "function mouseOut() {\n d3.select(this).attr('filter', null);\n m_group.selectAll('circle,rect,path').transition()\n .duration(m_highlightDur)\n .style('fill', function (d) {\n return m_lowContrast[d.fill] || null;\n })\n .style('stroke', function (d) {\n return m_lowContrast[d.stroke] || null;\n });\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 clearOverLayWithTrigger(){/*CLOSE THE OVERLAY IN FADEOUT WITH TRIGER*/\n\n let diminution =0.02;\n let speed =100;\n let elem =overLay;\n if(!elem.style.opacity)\n {\n elem.style.opacity = 1;\n }\n let fadeEffect =setInterval(function(){\n\n elem.style.opacity -= diminution;\n if(elem.style.opacity ==0){\n\n clearInterval(fadeEffect);\n\n if(_(\"_ov_1inH\")){\n\n _(\"_ov_1inH\").innerHTML =null;\n document.body.removeChild(_(\"_ov_1inH\"));\n \n }\n overLay.setAttribute(\"class\",\"_ov_1in\");\n overLay.innerHTML=null;document.body.removeChild(overLay);\n document.body.removeAttribute(\"class\");\n let home_nav =_(\"home-nav\");\n if(home_nav){\n home_nav.classList.remove(\"hnsy\")\n }\n elem.style.opacity = 1;\n }\n }, speed /Math.round(50));\n\n}", "function reset() {\n $('header, footer').addClass('active');\n card.removeClass('active');\n planets.classed('inactive', false);\n active.classed('active', false);\n active = d3.select(null);\n\n svg.transition()\n .duration(750)\n .call(zoom.transform, initialTransform);\n }", "function clearDarkenenedState() {\n var selected = svgDoc.getElementsByClassName('bordered');\n if (selected.length > 0) {\n var className = selected[0].getAttribute('class').replace('bordered','').trim();\n selected[0].setAttribute('class', className);\n }\n }", "function Start() {\n fullAlpha = renderer.material.color.a;\n timeout = 0;\n full = true;\n }", "function turnOff(){\n ga('send', 'event', 'layer-off', layer.layerType,layer.name);\n if(layer.layerType === 'dynamicMapService'){\n layer.layer.setMap(null);\n layer.visible = false;\n layer.percent = 0;\n layer.rangeOpacity = 0;\n setRangeSliderThumbOpacity();\n updateProgress();\n $('#'+layer.legendDivID).hide();\n } else if(layer.layerType !== 'geeVector' && layer.layerType !== 'geoJSONVector'){\n layer.visible = false;\n layer.map.overlayMapTypes.setAt(layer.layerId,null);\n layer.percent = 0;\n updateProgress();\n $('#'+layer.legendDivID).hide();\n layer.rangeOpacity = 0;\n if(layer.layerType !== 'tileMapService' && layer.layerType !== 'dynamicMapService' && layer.canQuery){\n queryObj[queryID].visible = layer.visible;\n }\n }else{\n layer.visible = false;\n \n layer.percent = 0;\n updateProgress();\n $('#'+layer.legendDivID).hide();\n layer.layer.setMap(null);\n layer.rangeOpacity = 0;\n $('#' + spinnerID+'2').hide();\n // geeTileLayersDownloading = 0;\n // updateGEETileLayersLoading();\n if(layer.layerType === 'geeVector' && layer.canQuery){\n queryObj[queryID].visible = layer.visible;\n }\n \n }\n layer.loading = false;\n updateGEETileLayersDownloading();\n \n $('#'+spinnerID + '2').hide();\n $('#'+spinnerID + '3').hide();\n vizToggleCleanup();\n }", "function mouse_info_reset(d, i) {\n\td3.select(this)\n\t\t.transition()\n\t\t.duration(250)\n\t\t.attr(\"opacity\", \"1\");\n}", "setAlphas() {\n this.room2_map.alpha = 0.0;\n this.room2_notebook.alpha = 0.0;\n this.room2_activityLocked.alpha = 0.0;\n this.room2_E_KeyImg.alpha = 0.0;\n this.room2_help_menu.alpha = 0.0;\n this.hideActivities();\n this.room2_hole_activity.alpha = 0.0;\n this.room2_hole_nextRoom.alpha = 0.0;\n this.leftArrow.alpha = 0;\n this.rightArrow.alpha = 0;\n\t this.returnDoor.alpha = 1;\n this.countCoin.alpha = 0.0;\n this.coin0.alpha = 0.0;\n this.coinHead.alpha = 0.0;\n this.profile.alpha = 0.0;\n }", "function bug_workaround(canvas) {\n canvas.style.opacity = 0.99;\n setTimeout(function() {\n canvas.style.opacity = 1;\n }, 1);\n}", "function restoreAppearance()\n {\n this.style.color = \"black\";\n this.style.border = \"2px solid black\";\n \n }", "function mouseOverReset() {\n if (timer_draw) timer_draw.stop();\n mouse_hover_active = false;\n hover_type = null;\n current_hover = null;\n\n //Animate the opacities coming back\n fadeCanvasBackIn();\n } //function mouseOverReset", "function ResetRenderingConditions() {\n var defaultAlpha = 0.1;\n context.globalAlpha = defaultAlpha;\n var defaultColour = \"rgb(25%, 65%,75%)\";\n context.fillStyle = defaultColour;\n context.fillRect(defaultRect.x, defaultRect.y, defaultRect.height, defaultRect.width);\n}", "deactivateHouse() {\r\n this.lightOn = false;\r\n this.light.visible = false;\r\n }", "function mouseOverReset() {\n if (timer_draw) timer_draw.stop();\n mouse_hover_active = false;\n hover_type = null;\n current_hover = null; //Animate the opacities coming back\n\n fadeCanvasBackIn();\n } //function mouseOverReset", "function mouseOverReset() {\n if (timer_draw) timer_draw.stop();\n mouse_hover_active = false;\n hover_type = null;\n current_hover = null; //Animate the opacities coming back\n\n fadeCanvasBackIn();\n } //function mouseOverReset", "function fadeCanvasBackIn() {\n //Transition settings\n var duration = 250;\n var ease = d3__WEBPACK_IMPORTED_MODULE_4__[\"easeQuadInOut\"]; //Calculate the opacity interpolator\n\n nodes.forEach(function (n) {\n n.interpolate_opacity = d3__WEBPACK_IMPORTED_MODULE_4__[\"interpolate\"](n.opacity, 1);\n });\n edges_concepts.forEach(function (l) {\n l.interpolate_opacity = d3__WEBPACK_IMPORTED_MODULE_4__[\"interpolate\"](l.opacity, opacity_concept_default);\n });\n edges_elements.forEach(function (l) {\n l.interpolate_opacity = d3__WEBPACK_IMPORTED_MODULE_4__[\"interpolate\"](l.opacity, opacity_element_default);\n }); //Fade everything back in\n\n timer_draw = d3__WEBPACK_IMPORTED_MODULE_4__[\"timer\"](function (elapsed) {\n //How far along the total duration are we (taking the easing into account)\n var t = ease(Math.min(1, elapsed / duration)); //Set new opacities\n\n nodes.forEach(function (n) {\n n.opacity = n.interpolate_opacity(t);\n });\n edges_concepts.forEach(function (l) {\n l.opacity = l.interpolate_opacity(t);\n });\n edges_elements.forEach(function (l) {\n l.opacity = l.interpolate_opacity(t);\n }); //Draw the canvas\n\n drawCanvas(); //Stop when the duration has been reached\n\n if (elapsed >= duration) timer_draw.stop();\n }); //timer\n } //function fadeCanvasBackIn", "function fadeCanvasBackIn() {\n //Transition settings\n var duration = 250;\n var ease = d3__WEBPACK_IMPORTED_MODULE_4__[\"easeQuadInOut\"]; //Calculate the opacity interpolator\n\n nodes.forEach(function (n) {\n n.interpolate_opacity = d3__WEBPACK_IMPORTED_MODULE_4__[\"interpolate\"](n.opacity, 1);\n });\n edges_concepts.forEach(function (l) {\n l.interpolate_opacity = d3__WEBPACK_IMPORTED_MODULE_4__[\"interpolate\"](l.opacity, opacity_concept_default);\n });\n edges_elements.forEach(function (l) {\n l.interpolate_opacity = d3__WEBPACK_IMPORTED_MODULE_4__[\"interpolate\"](l.opacity, opacity_element_default);\n }); //Fade everything back in\n\n timer_draw = d3__WEBPACK_IMPORTED_MODULE_4__[\"timer\"](function (elapsed) {\n //How far along the total duration are we (taking the easing into account)\n var t = ease(Math.min(1, elapsed / duration)); //Set new opacities\n\n nodes.forEach(function (n) {\n n.opacity = n.interpolate_opacity(t);\n });\n edges_concepts.forEach(function (l) {\n l.opacity = l.interpolate_opacity(t);\n });\n edges_elements.forEach(function (l) {\n l.opacity = l.interpolate_opacity(t);\n }); //Draw the canvas\n\n drawCanvas(); //Stop when the duration has been reached\n\n if (elapsed >= duration) timer_draw.stop();\n }); //timer\n } //function fadeCanvasBackIn", "function mouseOverReset() {\n if (timer_draw) timer_draw.stop();\n mouse_hover_active = false;\n hover_type = null;\n current_hover = null;\n chosen_domain_color = default_grey;\n fadeCanvasBackIn(); // //The domain to ICH element arcs as normal\n // edges_domain.forEach(n => { n.opacity = opacity_edge_default })\n // //All domain arcs as normal\n // domain_arcs.forEach(n => { n.opacity = 1 })\n // //The ICH element arcs as normal\n // element_arcs.forEach(n => { n.opacity = 1 })\n // //The ICH circles\n // elements.forEach(n => { n.opacity = 1 })\n // //The edges between the ICH and countries\n // edges_country.forEach(n => { n.opacity = 0 })\n // //The country arcs\n // area_arcs.forEach(n => {\n // n.opacity = 0.5\n // n.opacity_text = 1\n // })\n // //The country diamonds around the outside\n // countries.forEach(n => {\n // n.opacity = 1\n // n.opacity_text = country_text_opacity\n // })\n // drawCanvas()\n } //function mouseOverReset", "function fadeCanvasBackIn() {\n //Transition settings\n var duration = 500;\n var ease = d3__WEBPACK_IMPORTED_MODULE_6__[\"easeQuadInOut\"]; //Calculate the opacity interpolator\n\n nodes.forEach(function (n) {\n n.interpolate_opacity = d3__WEBPACK_IMPORTED_MODULE_6__[\"interpolate\"](n.opacity, 1);\n });\n edges_primary.forEach(function (l) {\n l.interpolate_opacity = d3__WEBPACK_IMPORTED_MODULE_6__[\"interpolate\"](0, 1);\n }); //Fade everything back in\n\n timer_draw = d3__WEBPACK_IMPORTED_MODULE_6__[\"timer\"](function (elapsed) {\n //How far along the total duration are we (taking the easing into account)\n var t = ease(Math.min(1, elapsed / duration));\n clearCanvas([ctx_edges, ctx_nodes, ctx_hover, ctx_hidden]); // //Test to draw the centers of the communities\n // drawCommunityCenters()\n //Set new opacities and draw\n\n nodes.forEach(function (n) {\n n.opacity = n.interpolate_opacity(t);\n drawNodes(ctx_nodes, n, n.r, n.opacity);\n }); //Concept labels\n\n renderNodeLabels(ctx_nodes, nodes);\n edges_primary.forEach(function (l) {\n var opacity = l.interpolate_opacity(t);\n ctx_edges.globalAlpha = opacity;\n drawEdges(ctx_edges, l, l.gradient);\n });\n ctx_edges.globalAlpha = 1; //Stop when the duration has been reached\n\n if (elapsed >= duration) timer_draw.stop();\n }); //timer\n } //function fadeCanvasBackIn", "shiftOpacity() {\n\t\tconst shift = (Math.random() - 0.5) * this.opacityVar;\n\t\tthis.opacity = shift;\n\t}", "toggleAxes() {\n if(this.options.axes){\n this.yAxisElement.style(\"opacity\", \"0\");\n this.xAxisElement.style(\"opacity\", \"0\");\n } else {\n this.yAxisElement.style(\"opacity\", \"1\");\n this.xAxisElement.style(\"opacity\", \"1\");\n }\n\n this.options.axes = !this.options.axes;\n }", "reset()\n {\n // unbind any VAO if they exist..\n if (this.nativeVaoExtension)\n {\n this.nativeVaoExtension.bindVertexArrayOES(null);\n }\n\n // reset all attributes..\n this.resetAttributes();\n\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.setBlendMode(0);\n\n // TODO?\n // this.setState(this.defaultState);\n }", "function mouseClicked() {\n background(0);\n if (myalpha > backFade) {\n myalpha = backFade;\n lineStroke = 20;\n } else { \n myalpha = 255;\n lineStroke = 120;\n }\n}", "_onEndAnim() {\n if (this._overlay) {\n this._peer.getChart().getPlotArea().removeChild(this._overlay);\n this._overlay = null;\n }\n }", "function abortControlsAutoHide( viewer ) {\n var i;\n viewer.controlsShouldFade = false;\n for ( i = viewer.controls.length - 1; i >= 0; i-- ) {\n viewer.controls[ i ].setOpacity( 1.0 );\n }\n}", "exitElements(){\n this.itemg.exit()\n .transition(this.transition)\n .style(\"opacity\", 0)\n .remove();\n }", "function fadeIn() {\n\n if (ctx.globalAlpha < 1) {\n ctx.globalAlpha += 0.001;\n paint(); }\n }", "function unforceSeriesMarkerOptions(series) {\n const resetMarkerOptions = series.resetA11yMarkerOptions;\n if (resetMarkerOptions) {\n const originalOpactiy = resetMarkerOptions.states &&\n resetMarkerOptions.states.normal &&\n resetMarkerOptions.states.normal.opacity;\n series.update({\n marker: {\n enabled: resetMarkerOptions.enabled,\n states: {\n normal: { opacity: originalOpactiy }\n }\n }\n });\n }\n }" ]
[ "0.6916777", "0.6858069", "0.6770393", "0.6730349", "0.66382015", "0.6624713", "0.6615948", "0.6584663", "0.65811986", "0.6551229", "0.6513192", "0.64832026", "0.6400679", "0.637652", "0.637652", "0.6355269", "0.6339875", "0.631377", "0.629427", "0.62934625", "0.6276164", "0.6253925", "0.6243048", "0.6194079", "0.6194079", "0.6194079", "0.61477846", "0.6139498", "0.6117332", "0.61105144", "0.6077054", "0.6068001", "0.60652876", "0.6060669", "0.6030893", "0.6024738", "0.60169715", "0.60075814", "0.59986854", "0.5983892", "0.5975808", "0.59676236", "0.5962655", "0.5953524", "0.5937284", "0.592178", "0.5921219", "0.59003246", "0.5896799", "0.5884296", "0.58625007", "0.5857367", "0.5850153", "0.58491176", "0.5844845", "0.5844296", "0.5844296", "0.583964", "0.5835141", "0.5826415", "0.58253324", "0.5815916", "0.58113533", "0.58080745", "0.58020186", "0.5789441", "0.5784179", "0.5783884", "0.577633", "0.5771834", "0.5769326", "0.5768145", "0.57676756", "0.5764779", "0.57615817", "0.5757391", "0.5755657", "0.5750353", "0.5748569", "0.5747967", "0.5745558", "0.574537", "0.57392627", "0.5736131", "0.5720453", "0.57144046", "0.57116455", "0.57116455", "0.57037884", "0.57037884", "0.57000905", "0.569304", "0.5692028", "0.56830764", "0.56758064", "0.56685585", "0.5662371", "0.56623244", "0.56536925", "0.5651487", "0.56512314" ]
0.0
-1
Generate a string that describes the points of a breadcrumb polygon.
function breadcrumbPoints(d, i) { var points = []; points.push("0,0"); points.push(b.w + ",0"); points.push(b.w + b.t + "," + (b.h / 2)); points.push(b.w + "," + b.h); points.push("0," + b.h); if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex. points.push(b.t + "," + (b.h / 2)); } return points.join(" "); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function breadcrumbPoints(d, i) {\r\n var points = [];\r\n points.push(\"0,0\");\r\n if (b.w <= 0) {\r\n // calculate breadcrumb width based on string length\r\n points.push(d.string_length + \",0\");\r\n points.push(d.string_length + b.t + \",\" + (b.h / 2));\r\n points.push(d.string_length + \",\" + b.h);\r\n } else {\r\n points.push(b.w + \",0\");\r\n points.push(b.w + b.t + \",\" + (b.h / 2));\r\n points.push(b.w + \",\" + b.h);\r\n }\r\n points.push(\"0,\" + b.h);\r\n\r\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\r\n points.push(b.t + \",\" + (b.h / 2));\r\n }\r\n return points.join(\" \");\r\n }", "breadcrumbPoints(i) {\n\t\t\tconst points = [];\n\t\t\tpoints.push(\"0,0\");\n\t\t\tpoints.push(`${this.b.w},0`);\n\t\t\tpoints.push(`${this.b.w + this.b.t},${this.b.h / 2}`);\n\t\t\tpoints.push(`${this.b.w},${this.b.h}`);\n\t\t\tpoints.push(`0,${this.b.h}`);\n\t\t\tif (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n\t\t\t\tpoints.push(`${this.b.t},${this.b.h / 2}`);\n\t\t\t}\n\t\t\treturn points.join(\" \");\n\t\t}", "breadcrumbPoints(d, i) {\n var points = [];\n var b = this.opt.breadcrumbs;\n points.push(\"0,0\");\n points.push(b.w + \",0\");\n points.push(b.w + b.t + \",\" + (b.h / 2));\n points.push(b.w + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) {\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n }", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push(\"0,0\");\n points.push(d.policyTitle.length*charToPix+charPadding + \",0\");\n points.push(d.policyTitle.length*charToPix+charPadding + b.t + \",\" + (b.h / 2));\n points.push(d.policyTitle.length*charToPix+charPadding + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n}", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push(\"0,0\");\n points.push(b.w + \",0\");\n points.push(b.w + b.t + \",\" + (b.h / 2));\n points.push(b.w + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n }", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push(\"0,0\");\n points.push(b.w + \",0\");\n points.push(b.w + b.t + \",\" + (b.h / 2));\n points.push(b.w + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n }", "function breadcrumbPoints(d, i) {\r\n var points = [];\r\n points.push(\"0,0\");\r\n points.push(b.w + \",0\");\r\n points.push(b.w + b.t + \",\" + (b.h / 2));\r\n points.push(b.w + \",\" + b.h);\r\n points.push(\"0,\" + b.h);\r\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\r\n points.push(b.t + \",\" + (b.h / 2));\r\n }\r\n return points.join(\" \");\r\n }", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push(\"0,0\");\n points.push(b.w + \",0\");\n points.push(b.w + b.t + \",\" + (b.h / 2));\n points.push(b.w + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n }", "function breadcrumbPoints(d, i) {\n\tvar points = [];\n\tpoints.push(\"0,0\");\n\tpoints.push(b.w + \",0\");\n\tpoints.push(b.w + b.t + \",\" + (b.h / 2));\n\tpoints.push(b.w + \",\" + b.h);\n\tpoints.push(\"0,\" + b.h);\n\tif (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n\t\tpoints.push(b.t + \",\" + (b.h / 2));\n\t}\n\treturn points.join(\" \");\n}", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push('0,0');\n points.push(b.w + ',0');\n points.push(b.w + b.t + ',' + (b.h / 2));\n points.push(b.w + ',' + b.h);\n points.push('0,' + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + ',' + (b.h / 2));\n }\n return points.join(' ');\n }", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push(\"0,0\");\n points.push(b.w*4 + \",0\");\n points.push(b.w*4 + b.t + \",\" + (b.h / 2));\n points.push(b.w*4 + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n}", "function breadcrumbPoints(d, i) {\n const points = [];\n points.push('0,0');\n points.push(`${b.w},0`);\n points.push(`${b.w + b.t},${b.h / 2}`);\n points.push(`${b.w},${b.h}`);\n points.push(`0,${b.h}`);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(`${b.t},${b.h / 2}`);\n }\n return points.join(' ');\n}", "function breadcrumbPoints(datum, index) {\n\t\tvar points = [];\n\t\tpoints.push(\"0,0\");\n\t\tpoints.push(breadcrumbDim.w + \",0\");\n\t\tpoints.push(breadcrumbDim.w + breadcrumbDim.t + \",\" + (breadcrumbDim.h / 2));\n\t\tpoints.push(breadcrumbDim.w + \",\" + breadcrumbDim.h);\n\t\tpoints.push(\"0,\" + breadcrumbDim.h);\n\t\tif (index > 0) {\n\t\t\tpoints.push(breadcrumbDim.t + \",\" + (breadcrumbDim.h / 2));\n\t\t}\n\t\treturn points.join(\" \");\n\t}", "function _breadcrumbPoints(d, i) {\n var points = [];\n\n points.push('0,0');\n points.push(options.trail.b.w + ',0');\n points.push(options.trail.b.w + options.trail.b.t + ',' + (options.trail.b.h / 2));\n points.push(options.trail.b.w + ',' + options.trail.b.h);\n points.push('0,' + options.trail.b.h);\n\n if (i > 0) {\n points.push(options.trail.b.t + ',' + (options.trail.b.h / 2));\n }\n\n return points.join(' ');\n }", "function path_string( center, points, scores){\n var vertex = [];\n for( var i = 0; i < points.length; i++){\n var x = lined_on( center.x, points[i].x, scores[i]);\n var y = lined_on( center.y, points[i].y, scores[i]);\n vertex.push( \"\" + x + \" \" + y);\n }\n return \"M \" + vertex.join(\"L \") + \"z\";\n }", "toString() {\n const { _coords } = this\n let result = '[Polygon'\n const numPoints = this.numVertices\n\n if (numPoints > 0) result += '\\n'\n\n for (let i = 0; i < numPoints; ++i) {\n result +=\n ' [Vertex ' +\n i +\n ': ' +\n 'x=' +\n _coords[i * 2].toFixed(1) +\n ', ' +\n 'y=' +\n _coords[i * 2 + 1].toFixed(1) +\n ']' +\n (i === numPoints - 1 ? '\\n' : ',\\n')\n }\n\n return result + ']'\n }", "function pointsToString(points) {\n\n // first point //\n var string = 'M' + points[0].x + ' '+points[0].y;\n\n // remaining points //\n for (var i=1; i<points.length; i++) {\n string += ' L' + points[i].x + ' '+points[i].y;\n }\n return string;\n}", "toString() {\n return `${Point.name} [x=${this.x},y=${this.y}]`;\n }", "toString() {\n const array = []\n // convert to a poly point string\n for (let i = 0, il = this.length; i < il; i++) {\n array.push(this[i].join(','))\n }\n\n return array.join(' ')\n }", "toString() {\n // convert to a poly point string\n for (var i = 0, il = this.length, array = []; i < il; i++) {\n array.push(this[i].join(','));\n }\n\n return array.join(' ');\n }", "function initiateBreadcrumbs (){\n\n // variables\n let width = $('#breadcrumbs').width(),\n height = $('#breadcrumbs').height();\n\n // dimensions\n let partitionHeight = height/6,\n partitionWidth = width,\n border = 3;\n\n /* initialize 'start' breadcrumb */\n breadcrumbDIV.append('polygon')\n .attr('id', 'polygonOne')\n .attr('points', createPointsOne(0, partitionWidth, partitionHeight))\n .attr('stroke', 'black')\n .attr('stroke-width', '0.7px')\n .attr('fill', 'white')\n .attr('opacity', 1)\n .on('mouseover', function(d){d3.select(this).attr('stroke-width', '1.2px').attr('fill','#d8d8d8')})\n .on('mouseout', function(d){d3.select(this).attr('stroke-width', '0.7px').attr('fill','white')})\n .on('click', function(d){d3.select('#select').dispatch('click')});\n\n breadcrumbDIV.append('text')\n .attr('id', 'polygonOneText')\n .attr('class', 'polygonText')\n .attr(\"x\", partitionWidth/2)\n .attr(\"y\", partitionHeight/2)\n .attr(\"fill\", \"#000000\")\n .attr(\"text-anchor\", \"middle\")\n .text('start selecting');\n\n /* initialize other breadcrumbs */\n createBreadcrumbElement('polygonTwo', partitionHeight+border);\n createBreadcrumbElement('polygonThree', 2*(partitionHeight+border));\n createBreadcrumbElement('polygonFour', 3*(partitionHeight+border));\n createBreadcrumbElement('polygonFive', 4*(partitionHeight+border));\n\n function createBreadcrumbElement(id, start){\n\n breadcrumbDIV.append('polygon')\n .attr('id', id)\n .attr('points', createPointsTwo(start, partitionWidth, partitionHeight))\n .attr('stroke', 'black')\n .attr('stroke-width', '0.7px')\n .attr('fill', '#ffffff')\n .attr('opacity', 0);\n\n breadcrumbDIV.append('text')\n .attr('id', id + 'Text')\n .attr('class', 'polygonText')\n .attr(\"x\", partitionWidth/2)\n .attr(\"y\", partitionHeight/2 + start - border)\n .attr(\"fill\", \"#000000\")\n .attr(\"text-anchor\", \"middle\")\n .text('');\n }\n}", "function pointsToPath(points) {\n\t\treturn points.map(function(point, iPoint) {\n\t\t\treturn (iPoint>0?'L':'M') + point[0] + ' ' + point[1];\n\t\t}).join(' ')+'Z';\n\t}", "function getWaypointsString() {\n\t\t\tvar layer = this.theMap.getLayersByName(this.ROUTE_POINTS)[0];\n\n\t\t\t//serialize these features to string\n\t\t\tvar wpString = \"\";\n\t\t\tfor (var i = 0; i < layer.features.length; i++) {\n\t\t\t\tvar ft = layer.features[i].geometry;\n\t\t\t\tft = new OpenLayers.LonLat(ft.x, ft.y);\n\t\t\t\tft = util.convertPointForDisplay(ft);\n\t\t\t\twpString = wpString + ft.lon + ',' + ft.lat + ',';\n\t\t\t}\n\t\t\t//slice away the last separator ','\n\t\t\twpString = wpString.substring(0, wpString.length - 3);\n\t\t\treturn wpString;\n\t\t}", "function convertPointArrayToPath(pointArray) {\n\n if(pointArray.length == 0) {\n return \"\";\n }\n\n var path = [];\n\n path.push(\"M\");\n path.push(pointArray[0].x);\n path.push(pointArray[0].y);\n for(var i = 1; i < pointArray.length; i++) {\n path.push(\"L\", pointArray[i].x, pointArray[i].y);\n }\n\n return path.join(\" \");\n}", "function makeCurlyBrace(x1, y1, x2, y2, w, q) {\n //Calculate unit vector\n let dx = x1 - x2\n let dy = y1 - y2\n let len = Math.sqrt(dx * dx + dy * dy)\n dx = dx / len\n dy = dy / len\n\n //Calculate Control Points of path,\n let qx1 = x1 + q * w * dy\n let qy1 = y1 - q * w * dx\n let qx2 = x1 - 0.25 * len * dx + (1 - q) * w * dy\n let qy2 = y1 - 0.25 * len * dy - (1 - q) * w * dx\n let tx1 = x1 - 0.5 * len * dx + w * dy\n let ty1 = y1 - 0.5 * len * dy - w * dx\n let qx3 = x2 + q * w * dy\n let qy3 = y2 - q * w * dx\n let qx4 = x1 - 0.75 * len * dx + (1 - q) * w * dy\n let qy4 = y1 - 0.75 * len * dy - (1 - q) * w * dx\n\n return (\n \"M \" +\n x1 +\n \" \" +\n y1 +\n \" Q \" +\n qx1 +\n \" \" +\n qy1 +\n \" \" +\n qx2 +\n \" \" +\n qy2 +\n \" T \" +\n tx1 +\n \" \" +\n ty1 +\n \" M \" +\n x2 +\n \" \" +\n y2 +\n \" Q \" +\n qx3 +\n \" \" +\n qy3 +\n \" \" +\n qx4 +\n \" \" +\n qy4 +\n \" T \" +\n tx1 +\n \" \" +\n ty1\n )\n}", "function arrow(x, y, width, height) {\n let arrowTipY = height/2;\n let str = \"M \" + x + \" \" + y\n + \" H \" + (x + width - arrowTipX)\n + \" L \" + (x + width) + \" \" + (y + arrowTipY)\n + \" L \" + (x + width - arrowTipX) + \" \" + (y + (arrowTipY*2))\n + \" H \" + (x)\n + \" L \" + (x + arrowTipX) + \" \" + (y + arrowTipY)\n + \" Z \";\n return str;\n}", "function genPointString(vectorArray,radius){\n var pointString = \"\";\n for (i=0; i < vectorArray.length; i++){\n pointString = pointString + \" \" + (radius*vectorArray[i][0]).toString() +\",\" + (radius*vectorArray[i][1]).toString();\n }\n return pointString\n}", "function genPointString(vectorArray,radius){\n var pointString = \"\";\n for (i=0; i < vectorArray.length; i++){\n pointString = pointString + \" \" + (radius*vectorArray[i][0]).toString() +\",\" + (radius*vectorArray[i][1]).toString();\n }\n return pointString\n}", "function makeCSVPolygon(){\r\n //[[arrayOfPoints], wheretoo, opacity, color, window, index]\r\n var text = \"Points,WhereTo,Opacity,Color,Window\\n\"\r\n var i = 0;\r\n while(i < polygonArray.length){\r\n text = text + \"\\\"\" + polygonArray[i][0] + \"\\\"\" + \",\" + polygonArray[i][1] + \",\" + polygonArray[i][2] + \",\" + polygonArray[i][3] + \",\" + polygonArray[i][4] + \"\\n\"\r\n i++;\r\n }\r\n return text;\r\n\r\n}", "function getCubicBezierPathStr(ps/*: number[][]*/) {\r\n let [[x0,y0],[x1,y1],[x2,y2],[x3,y3]] = ps;\r\n return `M${x0} ${y0} C${x1} ${y1} ${x2} ${y2} ${x3} ${y3}`;\r\n}", "getPoints(options: Object, widthIn: number, heightIn: number) {\n const {\n side,\n } = options;\n let leftPoints;\n let rightPoints;\n let width;\n let height;\n if (side === 'left' || side === 'right') {\n [leftPoints, rightPoints, width, height] = this.getLeftPoints(\n options, widthIn, heightIn,\n );\n } else {\n [leftPoints, rightPoints, width, height] = this.getLeftPoints(\n options, heightIn, widthIn,\n );\n }\n\n // The points of the glyph are for side 'left' by default\n // Transform the glyph to the correct side and have it's lower left corner\n // at (0, 0) and be\n let t;\n if (side === 'right') {\n t = new Transform().scale(-1, 1).translate(width, 0);\n } else if (side === 'top') {\n t = new Transform()\n .translate(0, -height / 2)\n .rotate(-Math.PI / 2)\n .translate(height / 2, width);\n } else if (side === 'bottom') {\n t = new Transform()\n .translate(0, -height / 2)\n .rotate(Math.PI / 2)\n .translate(height / 2, 0);\n } else {\n t = new Transform();\n }\n const newPointsLeft = leftPoints.map(p => p.transformBy(t.m()));\n const newPointsRight = rightPoints.map(p => p.transformBy(t.m()));\n const points = [];\n newPointsLeft.forEach((r1p, index) => {\n const r2p = newPointsRight[index];\n points.push(r1p);\n points.push(r2p);\n });\n if (side === 'top' || side === 'bottom') {\n return [points, height, width, 'STRIP'];\n }\n return [points, width, height, 'STRIP'];\n }", "function pointsToPath(rings, closed) {\n var str = '',\n i,\n j,\n len,\n len2,\n points,\n p;\n\n for (i = 0, len = rings.length; i < len; i++) {\n points = rings[i];\n\n for (j = 0, len2 = points.length; j < len2; j++) {\n p = points[j];\n str += (j ? 'L' : 'M') + p.x + ' ' + p.y;\n } // closes the ring for polygons; \"x\" is VML syntax\n\n\n str += closed ? svg ? 'z' : 'x' : '';\n } // SVG complains about empty path strings\n\n\n return str || 'M0 0';\n }", "toString(pointConverter)\n {\n let text = '';\n let lastY = Number.Infinity;\n\n for (let entry of this._iterate())\n {\n if (entry.y !== lastY)\n {\n text += (lastY === Number.Infinity ? '' : '\\n');\n lastY = entry.y;\n }\n\n if (pointConverter === undefined)\n text += (entry.value === undefined ? '-' : 'X');\n else\n text += pointConverter(entry.value);\n }\n\n return text;\n }", "function makeCurlyBrace(x1,y1,x2,y2,w,q) {\r\n\t//Calculate unit vector\r\n\tvar dx = x1-x2;\r\n\tvar dy = y1-y2;\r\n\tvar len = Math.sqrt(dx*dx + dy*dy);\r\n\tdx = dx / len;\r\n\tdy = dy / len;\r\n\r\n\t//Calculate Control Points of path,\r\n\tvar qx1 = x1 + q*w*dy;\r\n\tvar qy1 = y1 - q*w*dx;\r\n\tvar qx2 = (x1 - .25*len*dx) + (1-q)*w*dy;\r\n\tvar qy2 = (y1 - .25*len*dy) - (1-q)*w*dx;\r\n\tvar tx1 = (x1 - .5*len*dx) + w*dy;\r\n\tvar ty1 = (y1 - .5*len*dy) - w*dx;\r\n\tvar qx3 = x2 + q*w*dy;\r\n\tvar qy3 = y2 - q*w*dx;\r\n\tvar qx4 = (x1 - .75*len*dx) + (1-q)*w*dy;\r\n\tvar qy4 = (y1 - .75*len*dy) - (1-q)*w*dx;\r\n\r\n\treturn ( \"M \" + x1 + \" \" + y1 +\r\n\t\t\" Q \" + qx1 + \" \" + qy1 + \" \" + qx2 + \" \" + qy2 + \r\n\t\t\" T \" + tx1 + \" \" + ty1 +\r\n\t\t\" M \" + x2 + \" \" + y2 +\r\n\t\t\" Q \" + qx3 + \" \" + qy3 + \" \" + qx4 + \" \" + qy4 + \r\n\t\t\" T \" + tx1 + \" \" + ty1 );\r\n}", "function buildPointInfoString(point) {\n var commonKeys = ['name', 'id', 'category', 'x', 'value', 'y'],\n specialKeys = ['z', 'open', 'high', 'q3', 'median', 'q1', 'low', 'close'],\n infoString,\n hasSpecialKey = false;\n\n for (var i = 0; i < specialKeys.length; ++i) {\n if (point[specialKeys[i]] !== undefined) {\n hasSpecialKey = true;\n break;\n }\n }\n\n // If the point has one of the less common properties defined, display all that are defined\n if (hasSpecialKey) {\n H.each(commonKeys.concat(specialKeys), function (key) {\n var value = point[key];\n if (value !== undefined) {\n infoString += '. ' + key + ', ' + value;\n }\n });\n } else {\n // Pick and choose properties for a succint label\n infoString = (point.name || point.category || point.id || 'x, ' + point.x) + ', ' +\n (point.value !== undefined ? point.value : point.y);\n }\n\n return (point.index + 1) + '. ' + infoString + (point.description ? '. ' + point.description : '');\n }", "function makeCurlyBrace(x1,y1,x2,y2,w,q) {\n //Calculate unit vector\n var dx = x1-x2;\n var dy = y1-y2;\n var len = Math.sqrt(dx*dx + dy*dy);\n dx = dx / len;\n dy = dy / len;\n\n //Calculate Control Points of path,\n var qx1 = x1 + q*w*dy;\n var qy1 = y1 - q*w*dx;\n\n var qx2 = (x1 - .25*len*dx) + (1-q)*w*dy;\n var qy2 = (y1 - .25*len*dy) - (1-q)*w*dx;\n\n var tx1 = (x1 - .5*len*dx) + w*dy;\n var ty1 = (y1 - .5*len*dy) - w*dx;\n\n var qx3 = x2 + q*w*dy;\n var qy3 = y2 - q*w*dx;\n\n var qx4 = (x1 - .75*len*dx) + (1-q)*w*dy;\n var qy4 = (y1 - .75*len*dy) - (1-q)*w*dx;\n\n\n return ( \"M \" + x1 + \" \" + y1 +\n \" Q \" + qx1 + \" \" + qy1 + \" \" + qx2 + \" \" + qy2 + \n \" T \" + tx1 + \" \" + ty1 +\n \" M \" + x2 + \" \" + y2 +\n \" Q \" + qx3 + \" \" + qy3 + \" \" + qx4 + \" \" + qy4 + \n \" T \" + tx1 + \" \" + ty1 );\n}", "function get_poly_points(row, column){\n var x = [];\n var y = [];\n var retStr = \"\";\n for(var i = 0; i < 3; i++){\n x[i] = (column + i) * 25;\n }\n for(i = 0; i < 3; i++){\n y[i] = row * 43 + 21.5 + 21.5 * Math.pow(-1, column + row + i + 1);\n }\n for(var i = 0; i < 3; i++){\n retStr += `${x[i]},${y[i]} `;\n }\n return retStr;\n}", "function polypoint(w, h, sides, steps) {\n\n let centerX, centerY, lengthX, lengthY;\n let d, endpoint\n\n // find center point\n centerX = ( h/2 );\n centerY = ( w/2 );\n lengthX = (centerX-(h%steps) );\n lengthY = (centerY-(w%steps) );\n stepX = lengthX/steps\n stepY = lengthY/steps\n //_______ find end points_______\n // d = (2*pi/side) => d = ( 2*(Math.PI/side) )\n // will return the angle for\n d = angles(sides)\n // find the coords for each one. and return them as a tuple array to 2 decimals\n endpoints= new Array(sides).fill([])\n data = new Object\n\n for (let i = 0; i < sides; i++) {\n\n data[`_${i}`]={\n x:[Math.round( (lengthX*Math.cos(d*i)) +centerX)],\n y:[Math.round( (lengthY*Math.sin(d*i)) +centerY)]\n }\n\n endpoints[i] = [\n Math.round( (lengthX*Math.cos(d*i)) +centerX),\n Math.round( (lengthY*Math.sin(d*i)) +centerY)\n ];\n }\n endpoints.reverse()\n console.log(`endpoints ${endpoints}`.red);\n console.log(`data`.red, data);\n console.log(`variables lengthX ${lengthX}, lengthY ${lengthY}`.blue);\n console.log(`variables centerX ${centerX}, centerY ${centerY}`.blue);\n\n // there are steps involving changing it to a SVG coord system\n\n // create the step arrays.\n // find step length\nconsole.log(\"endpoints\".blue,endpoints);\n for (let i = 0; i < endpoints.length; i++) {\n for (let j = 1; j < sides; j++) {\n if (centerX < endpoints[i][0]) {//\n\n endpoints[i].push(centerX,endpoints[i][1]-j*stepX)\n\n }else if (centerX > endpoints[i][0]) {//\n\n endpoints[i].push(centerX,endpoints[i][1]+j*stepX)\n\n }else if (centerX == endpoints[i][0] ) {\n\n endpoints[i].push(endpoints[i][0]+j*stepX,centerX)\n\n }else if (centerY < endpoints[i][1]) {\n\n endpoints[i].push(endpoints[i][1]-j*stepY,centerY)\n\n }\n else if (centerY > endpoints[i][1]) {\n\n endpoints[i].push(endpoints[i][1]+j*stepY,centerY)\n\n }else if (centerY == endpoints[i][1] ) {\n\n endpoints[i].push(endpoints[i][1]+j*stepY,centerY)\n\n }\n }\n }\n console.log(\"endpoints\".green,endpoints);\n for (let i = 0; i < endpoints.length; i++) {\n if (i%2 == 0) {// reverse in pairs\n endpoints[i].reverse()\n }\n }\n console.log(\"endpoints\".green,endpoints);\n /*\n\n console.log(`endpoints`.red,endpoints );\n console.log(`variables lengthX ${lengthX}, lengthY ${lengthY}`.blue);\n console.log(`variables centerX ${centerX}, centerY ${centerY}`.blue);\n\n*/\n\n/*\n{\n _1:{ x:[1,2,4,5],y:[1,2,3,4] },\n _2:{ x:[1,2,4,5],y:[1,2,3,4] },\n _3:{ x:[1,2,4,5],y:[1,2,3,4] },\n _4:{ x:[1,2,4,5],y:[1,2,3,4] }\n}\n*/\n\n\n console.log(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${w}px\" height=\"${h}\" viewbox=\"0 0 ${w} ${h}\">\n <g class=\"polypoint\" id=\"_${sides}_${steps}\">`.green\n +\n `<polygon points=\"${endpoints}\" />`.green\n +\n `</g>\n </svg>`.green);\n}", "function buildPointInfoString(point) {\n\t\t\tvar infoString = '',\n\t\t\t\thasSpecialKey = false;\n\n\t\t\tfor (var i = 0; i < specialKeys.length; ++i) {\n\t\t\t\tif (point[specialKeys[i]] !== undefined) {\n\t\t\t\t\thasSpecialKey = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If the point has one of the less common properties defined, display all that are defined\n\t\t\tif (hasSpecialKey) {\n\t\t\t\tH.each(commonKeys.concat(specialKeys), function (key) {\n\t\t\t\t\tvar value = point[key];\n\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\tinfoString += (infoString ? '. ' : '') + key + ', ' + value;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// Pick and choose properties for a succint label\n\t\t\t\tinfoString = (point.name || point.category || point.id || 'x, ' + point.x) + ', ' +\n\t\t\t\t\t(point.value !== undefined ? point.value : point.y);\n\t\t\t}\n\n\t\t\treturn (point.index + 1) + '. ' + (point.description ? point.description + '. ' : '') + infoString + '.';\n\t\t}", "function getLinePathStr(ps/*: number[][]*/) {\r\n let [[x0,y0],[x1,y1]] = ps;\r\n return `M${x0} ${y0} L${x1} ${y1}`;\r\n}", "function pointsToString(c)\n{\n return c.map(function(x) { return String.fromCharCode(x); }).join(\"\");\n}", "function drawStrings(){\n noFill();\n stroke(255);\n strokeWeight(1);\n smooth();\n line(370,0,800,435);\n line(290,0,0,285);\n line(370,0,800,200);\n line(290,0,0,500);\n\n for(var i = -20; i < 1000; i = i + 60){\n fill(255, 80, 80);\n noStroke();\n smooth();\n triangle(200 - i, 81 + i, 258 - i, 20 + i, 286 - i, 75 + i);\n triangle(388 + i, 17 + i, 450 + i, 75 + i, 398 + i, 81 + i);\n }\n}", "function lineTo(point) {\n return \" L\" + _utils_Math__WEBPACK_IMPORTED_MODULE_0__[\"round\"](point.x, 4) + \",\" + _utils_Math__WEBPACK_IMPORTED_MODULE_0__[\"round\"](point.y, 4) + \" \";\n}", "function buildTriangle(x){\n var str=\"\";\n for(var i=1;i<=x;i++){\n str+=makeLine(i);\n }\n return str;\n}", "function scorify (score) {\n var path = score.leaf.path;\n var html = '';\n var beforelet = '<b>';\n var afterlet = '</b>';\n var index = 0;\n for (var i = score.indexes.length - 1; i >= 0; i--) {\n html += htmlEscape(path.slice(index, score.indexes[i])) + beforelet\n + htmlEscape(path[score.indexes[i]]) + afterlet;\n index = score.indexes[i] + 1; \n }\n html += htmlEscape(path.slice(index));\n return html;\n}", "function getBreadcrumbString(string) {\n\tvar res = \"\";\n\tvar tokens = string.split(\" \");\n\tvar cleanTokens = [];\n\tfor (var i = 0; i < tokens.length; i++) {\n\t\tif (tokens[i][0] != null && tokens[i][0].match(/[A-Z]|É|-/)) {\n\t\t\tcleanTokens.push(tokens[i]);\n\t\t}\n\t}\n\n\tfor (var i = 0; i < cleanTokens.length; i++) {\n\t\tif (cleanTokens[i].length > 12) {\n\t\t\tcleanTokens[i] = cleanTokens[i].substring(0, 11) + \".\";\n\t\t}\n\n\t\tif (cleanTokens.length <= 2) {\n\t\t\tres += cleanTokens[i] + \" \";\n\t\t} else if (cleanTokens.length == 3) {\n\t\t\tres += cleanTokens[i].substring(0, 6) + \". \";\n\t\t} else if (cleanTokens.length == 4) {\n\t\t\tres += cleanTokens[i].substring(0, 4) + \". \";\n\t\t} else {\n\t\t\tres += cleanTokens[i].substring(0, 4) + \". \";\n\t\t\tif (i == 3) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}", "function displayLetter() {\n //var xypoints = [-0.18000000000000044,-0.3239999999999997,-0.30800000000000055,-0.3239999999999997,-0.30800000000000055,-0.3239999999999997,-0.30800000000000055,-0.3239999999999997,-0.30800000000000055,-0.3239999999999997,-0.30800000000000055,-0.3239999999999997,-0.30800000000000055,-0.3239999999999997,-0.30800000000000055,-0.3239999999999997,-0.30800000000000055,-0.3239999999999997,-0.2440000000000005,-0.3239999999999997,-0.2440000000000005,-0.3239999999999997,-0.2440000000000005,-0.2599999999999996,-0.2440000000000005,-0.2599999999999996,-0.2440000000000005,-0.2599999999999996,-0.2440000000000005,-0.2599999999999996,-0.2440000000000005,-0.2599999999999996,-0.18000000000000044,-0.2599999999999996,-0.18000000000000044,-0.2599999999999996,-0.18000000000000044,-0.2599999999999996,-0.18000000000000044,-0.2599999999999996,-0.18000000000000044,-0.2599999999999996,-0.18000000000000044,-0.2599999999999996,-0.18000000000000044,-0.2599999999999996,-0.11600000000000038,-0.2599999999999996,-0.11600000000000038,-0.2599999999999996,-0.11600000000000038,-0.2599999999999996,-0.11600000000000038,-0.2599999999999996,-0.11600000000000038,-0.2599999999999996,-0.11600000000000038,-0.2599999999999996,-0.11600000000000038,-0.2599999999999996,-0.11600000000000038,-0.2599999999999996,-0.11600000000000038,-0.2599999999999996,-0.052000000000000324,-0.2599999999999996,-0.052000000000000324,-0.2599999999999996,-0.052000000000000324,-0.2599999999999996,-0.052000000000000324,-0.19599999999999956,-0.052000000000000324,-0.19599999999999956,-0.052000000000000324,-0.19599999999999956,-0.052000000000000324,-0.19599999999999956,-0.052000000000000324,-0.19599999999999956,0.011999999999999733,-0.19599999999999956,0.011999999999999733,-0.19599999999999956,0.011999999999999733,-0.19599999999999956,0.011999999999999733,-0.19599999999999956,0.011999999999999733,-0.19599999999999956,0.011999999999999733,-0.19599999999999956,0.011999999999999733,-0.19599999999999956,0.011999999999999733,-0.19599999999999956,0.07599999999999979,-0.19599999999999956,0.07599999999999979,-0.19599999999999956,0.07599999999999979,-0.19599999999999956,0.07599999999999979,-0.19599999999999956,0.07599999999999979,-0.19599999999999956,0.07599999999999979,-0.19599999999999956,0.13999999999999985,-0.19599999999999956,0.13999999999999985,-0.19599999999999956,0.13999999999999985,-0.1319999999999995,0.13999999999999985,-0.1319999999999995,0.13999999999999985,-0.1319999999999995,0.13999999999999985,-0.1319999999999995,0.13999999999999985,-0.1319999999999995,0.13999999999999985,-0.1319999999999995,0.13999999999999985,-0.1319999999999995,0.13999999999999985,-0.1319999999999995,0.13999999999999985,-0.1319999999999995,0.13999999999999985,-0.1319999999999995,0.2039999999999999,-0.1319999999999995,0.2039999999999999,-0.1319999999999995,0.2039999999999999,-0.1319999999999995,0.2039999999999999,-0.1319999999999995,0.2039999999999999,-0.06799999999999945,0.2039999999999999,-0.06799999999999945,0.2039999999999999,-0.06799999999999945,0.2039999999999999,-0.06799999999999945,0.2039999999999999,-0.06799999999999945,0.26799999999999996,-0.06799999999999945,0.26799999999999996,-0.06799999999999945,0.26799999999999996,-0.06799999999999945,0.26799999999999996,-0.003999999999999393,0.26799999999999996,-0.003999999999999393,0.26799999999999996,-0.003999999999999393,0.26799999999999996,-0.003999999999999393,0.26799999999999996,-0.003999999999999393,0.26799999999999996,-0.003999999999999393,0.26799999999999996,-0.003999999999999393,0.26799999999999996,-0.003999999999999393,0.26799999999999996,-0.003999999999999393,0.26799999999999996,0.060000000000000664,0.26799999999999996,0.060000000000000664,0.26799999999999996,0.060000000000000664,0.26799999999999996,0.060000000000000664,0.26799999999999996,0.060000000000000664,0.26799999999999996,0.060000000000000664,0.26799999999999996,0.12400000000000072,0.26799999999999996,0.12400000000000072,0.26799999999999996,0.12400000000000072,0.26799999999999996,0.12400000000000072,0.26799999999999996,0.12400000000000072,0.26799999999999996,0.12400000000000072,0.2039999999999999,0.12400000000000072,0.2039999999999999,0.12400000000000072,0.2039999999999999,0.12400000000000072,0.2039999999999999,0.12400000000000072,0.2039999999999999,0.12400000000000072,0.2039999999999999,0.12400000000000072,0.2039999999999999,0.12400000000000072,0.13999999999999985,0.12400000000000072,0.13999999999999985,0.18800000000000078,0.13999999999999985,0.18800000000000078,0.13999999999999985,0.18800000000000078,0.13999999999999985,0.18800000000000078,0.13999999999999985,0.18800000000000078,0.13999999999999985,0.18800000000000078,0.13999999999999985,0.18800000000000078,0.13999999999999985,0.18800000000000078,0.13999999999999985,0.18800000000000078,0.07599999999999979,0.18800000000000078,0.07599999999999979,0.18800000000000078,0.07599999999999979,0.18800000000000078,0.07599999999999979,0.18800000000000078,0.07599999999999979,0.18800000000000078,0.07599999999999979,0.18800000000000078,0.07599999999999979,0.18800000000000078,0.07599999999999979,0.18800000000000078,0.011999999999999733,0.18800000000000078,0.011999999999999733,0.18800000000000078,0.011999999999999733,0.18800000000000078,0.011999999999999733,0.18800000000000078,0.011999999999999733,0.18800000000000078,0.011999999999999733,0.18800000000000078,-0.052000000000000324,0.18800000000000078,-0.052000000000000324,0.18800000000000078,-0.052000000000000324,0.18800000000000078,-0.052000000000000324,0.18800000000000078,-0.052000000000000324,0.18800000000000078,-0.052000000000000324,0.18800000000000078,-0.11600000000000038,0.18800000000000078,-0.11600000000000038,0.18800000000000078,-0.11600000000000038,0.18800000000000078,-0.11600000000000038,0.25200000000000083,-0.11600000000000038,0.25200000000000083,-0.11600000000000038,0.25200000000000083,-0.11600000000000038,0.25200000000000083,-0.11600000000000038,0.25200000000000083,-0.11600000000000038,0.25200000000000083,-0.18000000000000044,0.25200000000000083,-0.18000000000000044,0.25200000000000083,-0.18000000000000044,0.25200000000000083,-0.18000000000000044,0.25200000000000083,-0.18000000000000044,0.25200000000000083,-0.18000000000000044,0.25200000000000083,-0.18000000000000044,0.25200000000000083,-0.18000000000000044,0.25200000000000083,-0.2440000000000005,0.25200000000000083,-0.2440000000000005,0.25200000000000083,-0.2440000000000005,0.25200000000000083,-0.2440000000000005,0.316,-0.2440000000000005,0.316,-0.2440000000000005,0.316,-0.2440000000000005,0.316,-0.2440000000000005,0.316,-0.2440000000000005,0.316,-0.2440000000000005,0.316,-0.2440000000000005,0.316,-0.2440000000000005,0.316,-0.2440000000000005,0.316,-0.2440000000000005,0.38000000000000006,-0.30800000000000055,0.38000000000000006,-0.30800000000000055,0.38000000000000006,-0.30800000000000055,0.38000000000000006,-0.30800000000000055,0.38000000000000006,-0.30800000000000055,0.38000000000000006,-0.30800000000000055,0.38000000000000006,-0.30800000000000055,0.4440000000000001,-0.30800000000000055,0.4440000000000001,-0.30800000000000055,0.4440000000000001,-0.30800000000000055,0.4440000000000001,-0.2440000000000005,0.4440000000000001,-0.2440000000000005,0.4440000000000001,-0.2440000000000005,0.4440000000000001,-0.2440000000000005,0.4440000000000001,-0.2440000000000005,0.4440000000000001,-0.2440000000000005,0.5080000000000002,-0.2440000000000005,0.5080000000000002,-0.2440000000000005,0.5080000000000002,-0.2440000000000005,0.5080000000000002,-0.18000000000000044,0.5080000000000002,-0.18000000000000044,0.5080000000000002,-0.18000000000000044,0.5080000000000002,-0.18000000000000044,0.5080000000000002,-0.18000000000000044,0.5080000000000002,-0.18000000000000044,0.5080000000000002,-0.18000000000000044,0.5080000000000002,-0.18000000000000044,0.5080000000000002,-0.18000000000000044,0.5080000000000002,-0.11600000000000038,0.5080000000000002,-0.11600000000000038,0.5720000000000003,-0.11600000000000038,0.5720000000000003,-0.11600000000000038,0.5720000000000003,-0.11600000000000038,0.5720000000000003,-0.11600000000000038,0.5720000000000003,-0.11600000000000038,0.5720000000000003,-0.11600000000000038,0.5720000000000003,-0.052000000000000324,0.5720000000000003,-0.052000000000000324,0.5720000000000003,-0.052000000000000324,0.5720000000000003,-0.052000000000000324,0.5720000000000003,-0.052000000000000324,0.5720000000000003,-0.052000000000000324,0.5720000000000003,-0.052000000000000324,0.5720000000000003,0.011999999999999733,0.5720000000000003,0.011999999999999733,0.5720000000000003,0.011999999999999733,0.5720000000000003,0.011999999999999733,0.5720000000000003,0.011999999999999733,0.5720000000000003,0.011999999999999733,0.5720000000000003,0.011999999999999733,0.5720000000000003,0.07599999999999979,0.5720000000000003,0.07599999999999979,0.5720000000000003,0.07599999999999979,0.5720000000000003,0.07599999999999979,0.5720000000000003,0.07599999999999979,0.5720000000000003,0.07599999999999979,0.5720000000000003,0.07599999999999979,0.5720000000000003,0.13999999999999985,0.5720000000000003,0.13999999999999985,0.5720000000000003,0.13999999999999985,0.5720000000000003,0.13999999999999985,0.5720000000000003,0.13999999999999985,0.5720000000000003,0.13999999999999985,0.5720000000000003,0.13999999999999985,0.5720000000000003,0.2039999999999999,0.5720000000000003,0.2039999999999999,0.5720000000000003,0.2039999999999999,0.5720000000000003,0.2039999999999999,0.5720000000000003,0.2039999999999999,0.5720000000000003,0.2039999999999999,0.5720000000000003,0.26799999999999996,0.5720000000000003,0.26799999999999996,0.6360000000000003,0.26799999999999996,0.6360000000000003,0.26799999999999996,0.6360000000000003,0.26799999999999996,0.6360000000000003,0.26799999999999996,0.6360000000000003,0.26799999999999996,0.6360000000000003,0.26799999999999996,0.7000000000000004,0.26799999999999996,0.7000000000000004,0.26799999999999996,0.7000000000000004,0.26799999999999996,0.7000000000000004];\n //var xypoints = [0.20, 0.84, 0.22, 0.84, 0.22, 0.84, 0.22, 0.84, 0.22, 0.84, 0.22, 0.84, 0.22, 0.84, 0.22, 0.84, 0.22, 0.84, 0.21, 0.84, 0.21, 0.84, 0.21, 0.85, 0.21, 0.85, 0.21, 0.85, 0.21, 0.85, 0.21, 0.85, 0.20, 0.85, 0.20, 0.85, 0.20, 0.85, 0.20, 0.85, 0.20, 0.85, 0.20, 0.85, 0.20, 0.85, 0.19, 0.85, 0.19, 0.85, 0.19, 0.85, 0.19, 0.85, 0.19, 0.85, 0.19, 0.85, 0.19, 0.85, 0.19, 0.85, 0.19, 0.85, 0.18, 0.85, 0.18, 0.85, 0.18, 0.85, 0.18, 0.86, 0.18, 0.86, 0.18, 0.86, 0.18, 0.86, 0.18, 0.86, 0.17, 0.86, 0.17, 0.86, 0.17, 0.86, 0.17, 0.86, 0.17, 0.86, 0.17, 0.86, 0.17, 0.86, 0.17, 0.86, 0.16, 0.86, 0.16, 0.86, 0.16, 0.86, 0.16, 0.86, 0.16, 0.86, 0.16, 0.86, 0.15, 0.86, 0.15, 0.86, 0.15, 0.87, 0.15, 0.87, 0.15, 0.87, 0.15, 0.87, 0.15, 0.87, 0.15, 0.87, 0.15, 0.87, 0.15, 0.87, 0.15, 0.87, 0.15, 0.87, 0.14, 0.87, 0.14, 0.87, 0.14, 0.87, 0.14, 0.87, 0.14, 0.88, 0.14, 0.88, 0.14, 0.88, 0.14, 0.88, 0.14, 0.88, 0.13, 0.88, 0.13, 0.88, 0.13, 0.88, 0.13, 0.89, 0.13, 0.89, 0.13, 0.89, 0.13, 0.89, 0.13, 0.89, 0.13, 0.89, 0.13, 0.89, 0.13, 0.89, 0.13, 0.89, 0.13, 0.90, 0.13, 0.90, 0.13, 0.90, 0.13, 0.90, 0.13, 0.90, 0.13, 0.90, 0.13, 0.91, 0.13, 0.91, 0.13, 0.91, 0.13, 0.91, 0.13, 0.91, 0.13, 0.91, 0.14, 0.91, 0.14, 0.91, 0.14, 0.91, 0.14, 0.91, 0.14, 0.91, 0.14, 0.91, 0.14, 0.91, 0.15, 0.91, 0.15, 0.92, 0.15, 0.92, 0.15, 0.92, 0.15, 0.92, 0.15, 0.92, 0.15, 0.92, 0.15, 0.92, 0.15, 0.92, 0.15, 0.92, 0.16, 0.92, 0.16, 0.92, 0.16, 0.92, 0.16, 0.92, 0.16, 0.92, 0.16, 0.92, 0.16, 0.92, 0.16, 0.92, 0.17, 0.92, 0.17, 0.92, 0.17, 0.92, 0.17, 0.92, 0.17, 0.92, 0.17, 0.92, 0.18, 0.92, 0.18, 0.92, 0.18, 0.92, 0.18, 0.92, 0.18, 0.92, 0.18, 0.92, 0.19, 0.92, 0.19, 0.92, 0.19, 0.92, 0.19, 0.93, 0.19, 0.93, 0.19, 0.93, 0.19, 0.93, 0.19, 0.93, 0.19, 0.93, 0.20, 0.93, 0.20, 0.93, 0.20, 0.93, 0.20, 0.93, 0.20, 0.93, 0.20, 0.93, 0.20, 0.93, 0.20, 0.93, 0.21, 0.93, 0.21, 0.93, 0.21, 0.93, 0.21, 0.94, 0.21, 0.94, 0.21, 0.94, 0.21, 0.94, 0.21, 0.94, 0.21, 0.94, 0.21, 0.94, 0.21, 0.94, 0.21, 0.94, 0.21, 0.94, 0.21, 0.95, 0.22, 0.95, 0.22, 0.95, 0.22, 0.95, 0.22, 0.95, 0.22, 0.95, 0.22, 0.95, 0.22, 0.96, 0.22, 0.96, 0.22, 0.96, 0.22, 0.96, 0.21, 0.96, 0.21, 0.96, 0.21, 0.96, 0.21, 0.96, 0.21, 0.96, 0.21, 0.97, 0.21, 0.97, 0.21, 0.97, 0.21, 0.97, 0.20, 0.97, 0.20, 0.97, 0.20, 0.97, 0.20, 0.97, 0.20, 0.97, 0.20, 0.97, 0.20, 0.97, 0.20, 0.97, 0.20, 0.97, 0.19, 0.97, 0.19, 0.98, 0.19, 0.98, 0.19, 0.98, 0.19, 0.98, 0.19, 0.98, 0.19, 0.98, 0.19, 0.98, 0.18, 0.98, 0.18, 0.98, 0.18, 0.98, 0.18, 0.98, 0.18, 0.98, 0.18, 0.98, 0.18, 0.98, 0.17, 0.98, 0.17, 0.98, 0.17, 0.98, 0.17, 0.98, 0.17, 0.98, 0.17, 0.98, 0.17, 0.98, 0.16, 0.98, 0.16, 0.98, 0.16, 0.98, 0.16, 0.98, 0.16, 0.98, 0.16, 0.98, 0.16, 0.98, 0.15, 0.98, 0.15, 0.98, 0.15, 0.98, 0.15, 0.98, 0.15, 0.98, 0.15, 0.98, 0.15, 0.98, 0.14, 0.98, 0.14, 0.98, 0.14, 0.98, 0.14, 0.98, 0.14, 0.98, 0.14, 0.98, 0.13, 0.98, 0.13, 0.99, 0.13, 0.99, 0.13, 0.99, 0.13, 0.99, 0.13, 0.99, 0.13, 0.99, 0.13, 1.00, 0.13, 1.00, 0.13, 1.00, 0.13, 1.00];\n var xypoints = [125,526,141,526,140,526,140,527,139,527,138,528,137,528,136,529,135,529,134,529,133,529,133,530,132,530,131,530,130,531,129,531,128,531,127,531,126,531,126,532,125,532,124,533,123,533,122,533,121,533,120,533,120,534,119,534,118,534,117,534,117,535,116,535,115,535,115,536,114,536,114,537,113,537,112,537,111,537,110,537,109,537,108,537,108,538,107,538,106,538,106,539,105,539,104,539,103,539,102,540,101,540,100,541,99,541,98,542,97,542,96,542,96,543,95,543,94,543,94,544,93,544,92,544,92,545,92,546,91,546,91,547,90,547,89,547,89,548,88,548,88,549,87,549,86,550,86,551,85,551,84,552,84,553,83,554,83,555,83,556,82,556,82,557,82,558,82,559,82,560,81,560,81,561,81,562,81,563,81,564,81,565,81,566,81,567,81,568,82,568,82,569,83,569,83,570,84,570,85,570,86,570,86,571,87,571,88,571,89,572,90,573,91,573,91,574,92,574,93,574,94,574,94,575,95,575,96,575,97,575,97,576,98,576,98,577,99,577,100,577,101,577,102,577,102,578,103,578,104,578,105,578,106,578,107,578,108,578,109,578,110,578,111,579,112,579,113,579,114,579,115,579,116,579,117,579,118,579,118,580,119,580,120,581,121,581,122,581,122,582,123,582,124,582,125,583,126,583,126,584,127,584,127,585,128,585,129,585,129,586,130,586,130,587,131,587,131,588,132,588,132,589,133,589,133,590,134,590,134,591,134,592,134,593,135,593,135,594,135,595,135,596,135,597,135,598,135,599,135,600,135,601,135,602,134,603,133,603,133,604,132,604,132,605,132,606,131,606,129,606,129,607,128,607,127,608,127,609,126,609,125,609,125,610,124,610,124,611,123,611,122,611,121,612,120,612,120,613,119,613,118,614,117,614,116,614,115,614,114,614,114,615,113,615,112,615,111,615,110,615,109,615,109,616,108,616,107,616,106,616,105,616,104,616,103,616,102,616,102,617,101,617,100,617,99,617,98,617,97,617,96,617,95,617,94,617,93,617,92,617,91,617,90,617,89,617,88,617,87,617,86,617,85,617,84,617,84,618,84,619,84,620,84,621,84,622,84,623,84,624,84,625,84,626,84,627];\n \n var x;\n var even = true;\n xypoints = $.map(xypoints, function (v) {\n x= v/627.0;\n x = (x * 1.6) - 1\n if (even) {\n x = (x * -1) - .8\n even = false;\n }\n else {\n x = x - .5\n even = true;\n }\n\n return ((x * 4) + .3);\n return(x);\n });\n //alert(xypoints);\n var numbers = new Float32Array(xypoints);\n squareTryangleCircle = \"letter\";\n var colors = [1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0];\n\n var bufferId = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, bufferId);\n gl.bufferData(gl.ARRAY_BUFFER, numbers, gl.STATIC_DRAW);\n\n var aPosition = gl.getAttribLocation(program, \"aPosition\");\n gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(aPosition);\n\n cBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, cBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(colors), gl.STATIC_DRAW); //new Float32Array(colors)\n\n var aColor = gl.getAttribLocation(program, \"aColor\");\n //3 points colors?\n gl.vertexAttribPointer(aColor, 3, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(aColor);\n\n render(\"red\");\n // gl.clear(gl.COLOR_BUFFER_BIT);\n // gl.drawArrays(gl.LINE_STRIP, 0, 240);\n\n}", "function convertLeafletCoordsToString(coordinates){\n\tvar coords = \"'POLYGON((\";\n\tfor(var j = 0; j < coordinates.length; j++){\n\t\tif(j != 0){\n\t\t\tcoords = coords + \", \";\n\t\t}\n\t\tcoords = coords + coordinates[j].lng + \" \" + coordinates[j].lat;\n\t}\n\t// first coordinate again (required by DB!)\n\tcoords = coords + \", \" + coordinates[0].lng + \" \" + coordinates[0].lat;\n\tcoords = coords + \"))'\"\n\treturn coords;\n}", "function levelsToTriangle(octant, levels, normalizePoles) {\n\t\n\tif (typeof(levels) === 'String') {\n\t\tlevels = levels.split();\n\t}\n\t\n\tvar location1 = {\n\t\toctant: octant,\n\t\tlevels: levels,\n\t\tx: 0,\n\t\ty: 0\n\t}\n\t\n\tvar location2 = {\n\t\toctant: octant,\n\t\tlevels: levels,\n\t\tx: 0,\n\t\ty: 1\n\t}\n\t\n\tvar location3 = {\n\t\toctant: octant,\n\t\tlevels: levels,\n\t\tx: 1,\n\t\ty: 0\n\t}\n\t\n\tcomputeLatLng(location1);\n\tcomputeLatLng(location2);\n\tcomputeLatLng(location3);\n\t\n\tif (normalizePoles) {\n\t\t//Edge case: the triangle has a pole, return a square instead of a triangle.\n\t\tif (Math.abs(location2.lat) == 90) {\n\t\t\tvar location2a = {\n\t\t\t\toctant: octant,\n\t\t\t\tlevels: levels,\n\t\t\t\tx: 0,\n\t\t\t\ty: 1,\n\t\t\t\tlat: location2.lat,\n\t\t\t\tlng: location1.lng\n\t\t\t}\n\t\t\tvar location2b = {\n\t\t\t\toctant: octant,\n\t\t\t\tlevels: levels,\n\t\t\t\tx: 0,\n\t\t\t\ty: 1,\n\t\t\t\tlat: location2.lat,\n\t\t\t\tlng: location3.lng\n\t\t\t}\n\t\t\treturn [location1,location2a,location2b,location3];\n\t\t}\n\t}\n\t\n\treturn [location1,location2,location3];\n}", "toString () {\n let brd = [];\n\n let rowMin = this.topLeftCorner.row;\n let rowMax = this.bottomRightCorner.row;\n let colMin = this.topLeftCorner.col;\n let colMax = this.bottomRightCorner.col;\n\n for (let i=rowMin; i<= rowMax; i++) {\n for (let j=colMin; j<=colMax; j++) {\n if (this.isWhite(i, j)) {\n brd.push('W');\n } else {\n brd.push('B');\n }\n }\n brd.push('\\n');\n }\n\n return brd.toString();\n }", "toString() {\n const tileToString = {\n HEAD: 'O',\n TAIL: 'c',\n APPLE: 'x',\n EMPTY: '_'\n };\n return R.range(0, this.size.height).map(y =>\n R.range(0, this.size.width).map(x =>\n ({x, y})).map(pos => this.getTileContents(pos)).map(t => tileToString[t]).join('.')).join('\\n');\n }", "function hexPath(x,y,H,S,C,cornerSize,extra){\n\treturn \"M \"+x+\" \"+y + \n\t\t \" h \"+(H*(1-2 *cornerSize)/2) +\n\t\t \" q \"+(cornerSize*H)+\" 0 \" + (cornerSize * (S + H) ) + \" \" + (cornerSize * C) +\n\t\t \" l \"+(S * (1 - 2 * cornerSize)*(1+extra)) + \" \" + (C * (1 - 2 * cornerSize)*(1+extra)) + \n\t\t \" q \"+(cornerSize*S)+ \" \" + (cornerSize * C) + \" \" + \" 0 \" + (2 * cornerSize * C) +\n\t\t \" l \"+(-S * (1 - 2 * cornerSize) * (1+extra)) + \" \" + (C * (1 - 2 * cornerSize) * (1+extra)) +\n\t\t \" q \"+(-cornerSize * S) + \" \" + (cornerSize*C) + \" \" + (-(S+H) * cornerSize) + \" \" + (cornerSize*C) +\n\t\t \" h \"+(-H*(1-2*cornerSize)) +\n\t\t \" q \"+(-cornerSize * H) + \" 0 \" + (-cornerSize * (H + S)) + \" \" + (-cornerSize*C) +\n\t\t \" l \"+(-(1-2*cornerSize)*S * (1+extra)) + \" \" + (-(1-2*cornerSize)*C * (1+extra)) +\n\t\t \" q \"+(-cornerSize*S) + \" \" + (-cornerSize*C) + \" 0 \" + (-2 * cornerSize*C) +\n\t\t \" l \"+((1-2*cornerSize)*S * (1+extra)) + \" \" + (-(1-2*cornerSize)*C * (1+extra)) +\n\t\t \" q \"+(cornerSize*S) + \" \" + (-cornerSize*C) + \" \" + (cornerSize*(S+H)) + \" \" + (-cornerSize*C) +\n\t\t \" z\";\n}", "function drawLabel(x, y) {\n var subPolygonLabel = doc.layers['sub-polygon labels'].textFrames.add(); \n subPolygonLabel.contents = subPolygonNumber; \n subPolygonLabel.textRange.characterAttributes.fillColor = hexToRGB(textColor);\n subPolygonLabel.textRange.characterAttributes.size = textSize;\n var expanded = subPolygonLabel.createOutline();\n expanded.top = y + expanded.height/2;\n expanded.left = x - expanded.width/2;\n subPolygonLabelCounter += 1; \n}", "function svgLineTo(point) {\n return `L${point[0]},${point[1]}`;\n}", "function updateBreadcrumbs(nodeArray) {\r\n\r\n // Data join; key function combines name and depth (= position in sequence).\r\n var g = d3.select(el).select(\"#\" + el.id + \"-trail\")\r\n .selectAll(\"g\")\r\n .data(nodeArray, function(d) { return d.name + d.depth; });\r\n\r\n // Add breadcrumb and label for entering nodes.\r\n var entering = g.enter().append(\"g\");\r\n\r\n\r\n if (b.w <= 0) {\r\n // Create a node array that contains all the breadcrumb widths\r\n // Calculate positions of breadcrumbs based on string lengths\r\n var curr_breadcrumb_x = 0;\r\n nodeArray[0].breadcrumb_x = 0;\r\n nodeArray[0].breadcrumb_h = 0;\r\n\r\n entering.append(\"polygon\")\r\n .style(\"z-index\",function(d,i) { return(999-i); })\r\n .style(\"fill\", function(d) { return colors(d.label); });\r\n\r\n entering.append(\"text\")\r\n .attr(\"x\", b.t + 2)\r\n .attr(\"y\", b.h / 2)\r\n .attr(\"dy\", \"0.35em\")\r\n .attr(\"text-anchor\", \"left\")\r\n .text(function(d) { return d.name; });\r\n\r\n // Remove exiting nodes.\r\n g.exit().remove();\r\n\r\n // loop through each g element\r\n // calculate string length\r\n // draw the breadcrumb polygon\r\n // and determine if breadcrumb should be wrapped to next row\r\n g.each(function(d,k){\r\n var crumbg = d3.select(this);\r\n var my_string_length = crumbg.select(\"text\").node().getBoundingClientRect().width;\r\n nodeArray[k].string_length = my_string_length + 12;\r\n crumbg.select(\"polygon\").attr(\"points\", function(d){\r\n return breadcrumbPoints(d, k);\r\n });\r\n var my_g_length = crumbg.node().getBoundingClientRect().width;\r\n curr_breadcrumb_x += k===0 ? 0 : nodeArray[k-1].string_length + b.s;\r\n nodeArray[k].breadcrumb_h = k===0 ? 0 : nodeArray[k-1].breadcrumb_h;\r\n\r\n if (curr_breadcrumb_x + my_g_length > width*0.99) {\r\n nodeArray[k].breadcrumb_h += b.h; // got to next line\r\n curr_breadcrumb_x = b.t + b.s; // restart counter\r\n }\r\n nodeArray[k].breadcrumb_x = curr_breadcrumb_x;\r\n });\r\n\r\n\r\n // Set position for entering and updating nodes.\r\n g.attr(\"transform\", function(d, i) {\r\n return \"translate(\" + d.breadcrumb_x + \", \"+d.breadcrumb_h+\")\";\r\n });\r\n\r\n\r\n\r\n\r\n } else {\r\n entering.append(\"polygon\")\r\n .attr(\"points\", breadcrumbPoints)\r\n .style(\"fill\", function(d) { return colors(d.label); });\r\n\r\n entering.append(\"text\")\r\n .attr(\"x\", (b.w + b.t) / 2)\r\n .attr(\"y\", b.h / 2)\r\n .attr(\"dy\", \"0.35em\")\r\n .attr(\"text-anchor\", \"middle\")\r\n .text(function(d) { return d.name; });\r\n\r\n // Set position for entering and updating nodes.\r\n g.attr(\"transform\", function(d, i) {\r\n return \"translate(\" + i * (b.w + b.s) + \", 0)\";\r\n });\r\n\r\n // Remove exiting nodes.\r\n g.exit().remove();\r\n\r\n\r\n }\r\n\r\n // Make the breadcrumb trail visible, if it's hidden.\r\n d3.select(el).select(\"#\" + el.id + \"-trail\")\r\n .style(\"visibility\", \"\");\r\n\r\n }", "function stringifyLine(startingCoordinates, endingCoordinates) {\n return `{(${ startingCoordinates.x },${ startingCoordinates.y }) - (${ endingCoordinates.x },${ endingCoordinates.y })}`;\n}", "toString(descriptor = {}, renderer = (point) => (point ? point.value : ' ')) {\n const position = [...this.dimensions].fill(0);\n for (const [prop, value] of Object.entries(descriptor)) {\n const index = this.dimensionIndexFor(prop);\n position[index] = value;\n }\n\n const minD0 = this.min(0);\n const maxD0 = this.max(0);\n const minD1 = this.min(1);\n const maxD1 = this.max(1);\n\n let string = '';\n for (let d1 = minD1; d1 <= maxD1; ++d1) {\n for (let d0 = minD0; d0 <= maxD0; ++d0) {\n position[0] = d0;\n position[1] = d1;\n string += renderer(this.getPoint(position));\n }\n string += '\\n';\n }\n return string;\n }", "function drawPoly(coOrdStr)\n{\n if (typeof coOrdStr === 'undefined')\n return;\n\n hdc.beginPath();\n hdc.lineWidth = 10;\n hdc.globalAlpha = 0.8;\n hdc.fillStyle = randomColor();\n\n var mCoords = coOrdStr.split(',');\n var i, n;\n n = mCoords.length;\n\n hdc.beginPath();\n hdc.moveTo(mCoords[0], mCoords[1]);\n for (i=2; i<n; i+=2)\n {\n hdc.lineTo(mCoords[i], mCoords[i+1]);\n }\n hdc.lineTo(mCoords[0], mCoords[1]);\n hdc.stroke();\n hdc.fill();\n}", "draw() {\n if (!this.lines[1]) { return; }\n let left = this.endpoints[0].x;\n let right = this.endpoints[1].x + this.endpoints[1].boxWidth;\n\n let lOffset = -this.endpoints[0].boxWidth / 2;\n let rOffset = this.endpoints[1].boxWidth / 2;\n\n if (this.endpoints[0].row === this.endpoints[1].row) {\n // draw left side of the brace and align text\n let center = (-left + right) / 2;\n this.x = center + lOffset;\n this.svgText.x(center + lOffset);\n this.lines[0].plot('M' + lOffset + ',33c0,-10,' + [center,0,center,-8]);\n this.lines[1].plot('M' + rOffset + ',33c0,-10,' + [-center,0,-center,-8]);\n }\n else {\n // draw right side of brace extending to end of row and align text\n let center = (-left + this.endpoints[0].row.rw) / 2 + 10;\n this.x = center + lOffset;\n this.svgText.x(center + lOffset);\n\n this.lines[0].plot('M' + lOffset\n + ',33c0,-10,' + [center,0,center,-8]\n + 'c0,10,' + [center,0,center,8]\n );\n this.lines[1].plot('M' + rOffset\n + ',33c0,-10,' + [-right + 8, 0, -right + 8, -8]\n + 'c0,10,' + [-right + 8, 0, -right + 8, 8]\n );\n }\n\n // propagate draw command to parent links\n this.links.forEach(l => l.draw(this));\n }", "function arrow(size, source, styles) {\n\t\t\tvar sign = source ? -1 : 1;\n\t\t\tvar marker = {\n\t\t\t\tviewBox: new _Rectangle2.default(-5, -5, 10, 10),\n\t\t\t\tsize: size,\n\t\t\t\tref: [4 * sign, 0],\n\t\t\t\tfill: styles.color\n\t\t\t};\n\t\t\tmarker.shape = {\n\t\t\t\tname: 'Polygon',\n\t\t\t\tpoints: [[-2 * sign, 0], [-4 * sign, 4], [4 * sign, 0], [-4 * sign, -4]]\n\t\t\t};\n\t\t\treturn marker;\n\t\t}", "function generateBreadcrumb () {\n let cloneBreadcrumb = module.exports.internal.breadcrumb.cloneNode(false)\n module.exports.internal.breadcrumb.parentNode.replaceChild(cloneBreadcrumb, module.exports.internal.breadcrumb)\n module.exports.internal.breadcrumb = cloneBreadcrumb\n\n let spanHome = document.createElement('span')\n spanHome.innerHTML = 'Home'\n spanHome.className = 'link'\n spanHome.onclick = () => { module.exports.internal.stateManager.showState('pick-a-season', 'pick-a-team') }\n module.exports.internal.breadcrumb.appendChild(spanHome)\n\n let spanSep1 = document.createElement('span')\n spanSep1.innerHTML = '&nbsp;&gt;&nbsp;'\n module.exports.internal.breadcrumb.appendChild(spanSep1)\n\n let spanTeam = document.createElement('span')\n spanTeam.innerHTML = module.exports.internal.dataObj.name\n module.exports.internal.breadcrumb.appendChild(spanTeam)\n}", "function polyline(points) {\n let polyline = document.createElementNS(Svg.svgNS, \"polyline\");\n let pointsStr = \"\";\n for (let i = 0; i < points.length; i++) {\n pointsStr += \" \" + points[i] + \" \";\n }\n polyline.setAttribute(\"points\", pointsStr);\n return polyline;\n }", "toString() {\n return `(${this.x},${this.y})`;\n }", "function generateBreadcrumb () {\n let cloneBreadcrumb = module.exports.internal.breadcrumb.cloneNode(false)\n module.exports.internal.breadcrumb.parentNode.replaceChild(cloneBreadcrumb, module.exports.internal.breadcrumb)\n module.exports.internal.breadcrumb = cloneBreadcrumb\n\n let spanHome = document.createElement('span')\n spanHome.innerHTML = 'Home'\n spanHome.className = 'link'\n spanHome.onclick = () => { module.exports.internal.stateManager.showState('main-branch', 'pick-a-team') }\n module.exports.internal.breadcrumb.appendChild(spanHome)\n\n let spanSep1 = document.createElement('span')\n spanSep1.innerHTML = '&nbsp;&gt;&nbsp;'\n module.exports.internal.breadcrumb.appendChild(spanSep1)\n\n let spanTeam = document.createElement('span')\n spanTeam.innerHTML = module.exports.internal.dataObj.name\n spanTeam.className = 'link'\n spanTeam.onclick = () => { module.exports.internal.stateManager.showState('main-branch', 'pick-a-season') }\n module.exports.internal.breadcrumb.appendChild(spanTeam)\n\n let spanSep2 = document.createElement('span')\n spanSep2.innerHTML = '&nbsp;&gt;&nbsp;'\n module.exports.internal.breadcrumb.appendChild(spanSep2)\n\n let spanSeason = document.createElement('span')\n spanSeason.innerHTML = module.exports.internal.dataObj.seasons[module.exports.internal.seasonId].name\n module.exports.internal.breadcrumb.appendChild(spanSeason)\n}", "function arrowPath(x0, x1, y, height, reverse) {\n const arr_width = height / 2 * (reverse ? -1 : 1);\n if (reverse) {\n const tmp = x0;\n x0 = x1;\n x1 = tmp;\n }\n\n const path = d3.path();\n // starting corner\n path.moveTo(x0, y);\n // straight across\n path.lineTo(x1 - arr_width, y);\n // diagonal to tip of pointed end\n path.lineTo(x1, y + height/2);\n // diagonal back to \"floor\"\n path.lineTo(x1 - arr_width, y + height);\n // straight back\n path.lineTo(x0, y + height);\n return path.toString();\n}", "function createTriPts(x, y) {\n return x + \",\" + (y-munit*4) //X & Y positions of the right side of the rectangle\n + \" \" + x + \",\" + y //X & Y positions of the right bottom corner of the rectangle\n + \" \" + (x-munit*4) + \",\" + y; //X & Y positions of the bottom of the rectangle\n}", "function pathString(path){\n var result = '';\n for (var s in path){\n var val = path[s] * display.scale;\n if (!(s % 2)){\n result += (s == 0 ? \"M\" : \"L\");\n }\n result += val + \" \";\n }\n return result;\n}", "function printTriangle(length) {\n\tfor(var i = 1; i <= length; i++) {\n\n\t\tvar level = '';\n\n\t\tfor(var a = 0; a < i; a++) {\n\t\t\tlevel += '*';\n\t\t}\n\n\t\tconsole.log(level);\n\t}\n}", "squarePath (x, y, l) {\n return \"M\" + x + \",\" + y + \" \" +\n \"m\" + -l/2 + \",0 \" +\n \"m\" + \"0,\" + -l/2 + \" \" +\n \"h\" + \"0,\" + l + \" \" +\n \"v\" + l + \",0 \" + // l + \" \" +\n \"h 0,\" + -l + \" \" + //,0 \" +\n \"v0,0Z\";\n }", "function makeTriangle(pts, step) {\n var ax = pts[0][0];\n var ay = pts[0][1];\n var bx = pts[1][0];\n var by = pts[1][1];\n var cx = pts[2][0];\n var cy = pts[2][1];\n\n // Get AC line length\n var a_dx = cx - ax,\n a_dy = cy - ay;\n var ac_len = Math.sqrt(a_dx * a_dx + a_dy * a_dy);\n // Get BC line length\n var b_dx = cx - bx,\n b_dy = cy - by;\n bc_len = Math.sqrt(b_dx * b_dx + b_dy * b_dy);\n\n // Whichever line is shortest will determine the number of steps\n var len = (ac_len < bc_len) ? ac_len : bc_len;\n\n // ac step amounts\n a_dx = step * a_dx / len;\n a_dy = step * a_dy / len;\n\n // bc step amounts\n b_dx = step * b_dx / len;\n b_dy = step * b_dy / len;\n\n var poly = [];\n // first two points\n poly.push(ax);\n poly.push(ay);\n poly.push(bx);\n poly.push(by);\n while (len > step) {\n // step along the ac and bc lines\n ax += a_dx;\n ay += a_dy;\n bx += b_dx;\n by += b_dy;\n // add the line going from the bc line to the ac line\n poly.push(bx);\n poly.push(by);\n poly.push(ax);\n poly.push(ay);\n len -= step;\n if (len < step) break;\n // step again\n ax += a_dx;\n ay += a_dy;\n bx += b_dx;\n by += b_dy;\n // add line going back again\n poly.push(ax);\n poly.push(ay);\n poly.push(bx);\n poly.push(by);\n len -= step;\n }\n poly.push(cx);\n poly.push(cy);\n\n var tri = document.createElementNS(\"http://www.w3.org/2000/svg\", \"polyline\");\n tri.setAttribute(\"fill\", \"none\");\n tri.setAttribute(\"stroke\", \"black\");\n tri.setAttribute(\"stroke-width\", 0.5);\n tri.setAttribute(\"points\", poly.join(\",\"));\n return tri;\n}", "breadcrumb (state, getters, rootState) {\n let breadcrumb = {}\n\n if (state.hovered) {\n const { id, label } = state.hovered\n breadcrumb = { id, label }\n\n if ((rootState.components.dragging.status || state.dragging.status) && state.dropline.position.bottom) {\n const parent = NodeHelpers.getRealParent(state.hovered.id)\n if (parent) {\n breadcrumb = { id: parent.id, label: parent.label }\n }\n }\n }\n\n return breadcrumb\n }", "function toLine(item) {\nreturn [\"M\", item.a.x, item.a.y, \"L\", item.b.x, item.b.y].join(\" \"); }", "function getQuadBezierPathStr(ps/*: number[][]*/) {\r\n let [[x0,y0],[x1,y1],[x2,y2]] = ps;\r\n return `M${x0} ${y0} Q${x1} ${y1} ${x2} ${y2}`;\r\n}", "boundaryToSVG() {\n var points = this.getOrientedEdges();\n var svgString = \"M\";\n for (var i = 0; i < points.length; i++) {\n var point = points[i];\n svgString += point.x.toString() + \" \" + point.y.toString() + \" \";\n }\n svgString += points[0].x.toString() + \" \" + points[0].y.toString() + \" \";\n this.svg = svgString;\n return svgString;\n }", "calculatePath(startPoint, endPoint) {\n var end = endPoint * this.UNIT;\n var start = startPoint * this.UNIT;\n\n var curve = this.ELLIPSE_CONST + ' ' + end + ' ' + this.Y;\n var arrowHead = ' v-10 m -5 2 l5 7';\n\n return 'M' + start + ' ' + this.Y + curve + arrowHead;\n }", "function computeLatLng(location) {\n\tvar l = location.levels.length;\n\tvar x = location.x;\n\tvar y = location.y;\n\t\n\tfor (var i=l-1; i>=0; i--) {\n\t\tvar level = +location.levels[i];\n\t\tif (level === 1) {\n\t\t\tx /= 2;\n\t\t\ty = y/2 + 0.5;\n\t\t} else if (level === 2) {\n\t\t\tx /= 2;\n\t\t\ty /= 2;\n\t\t} else if (level === 3) {\n\t\t\tx = x/2 + 0.5;\n\t\t\ty /= 2;\n\t\t} else if (level === 0) {\n\t\t\tx = (1 - x)/2;\n\t\t\ty = (1 - y)/2;\n\t\t}\n// \t\tconsole.log(level, x,y);\n\t}\n\t\n\tx /= 1 - y;\n\tx *= 90;\n\ty *= 90;\n\t\n\tif (location.octant == 0) {\n\t\tx -= 180;\n\t} else if (location.octant == 1) {\n\t\tx -= 90;\n\t} else if (location.octant == 2) {\n\t\tx += 0;\n\t} else if (location.octant == 3) {\n\t\tx += 90;\n\t} else if (location.octant == 4) {\n\t\tx -= 180;\n\t\ty = -y;\n\t} else if (location.octant == 5) {\n\t\tx -= 90;\n\t\ty = -y;\n\t} else if (location.octant == 6) {\n\t\tx += 0;\n\t\ty = -y;\n\t} else if (location.octant == 7) {\n\t\tx += 90;\n\t\ty = -y;\n\t}\n\t\n\tlocation.lat = y;\n\tlocation.lng = x;\n\t\n\treturn location;\n}", "_getLabelLatlng(geometry) {\n const coords = geometry.coordinates;\n let biggestRing;\n\n if (geometry.type === 'Point') {\n return [coords[1], coords[0]];\n } else if (geometry.type === 'Polygon') {\n biggestRing = coords;\n } else if (geometry.type === 'MultiPolygon') {\n biggestRing = coords[0];\n\n // If more than one polygon, place the label on the polygon with the biggest area\n if (coords.length > 1) {\n let biggestSize = 0;\n\n coords.forEach((ring) => {\n const size = geojsonArea.ring(ring[0]); // Area calculation\n\n if (size > biggestSize) {\n biggestRing = ring;\n biggestSize = size;\n }\n });\n }\n }\n\n // Returns pole of inaccessibility, the most distant internal point from the polygon outline\n return polylabel(biggestRing, 2).reverse();\n }", "toString() {\n\t\treturn \"Bullet (starting position): \" + this.originalPosition.toString();\n\t}", "function buildTriangle(height) {\n var star = \"\";\n for (var k = 1; k <= height; k++) {\n star += makeLine(k);\n }\n return star;\n}", "function pointsText(){\n fill(255);\n textSize(12);\n textFont('Helvetica');\n\n //red\n if(num < 20) fill(241, 136, 113);\n text('100 100', 300, 530);\n\n //orange\n if(num < 60) fill(237, 162, 85);\n text('200 200', 300, 485);\n\n //yellow\n if(num < 110) fill(243, 230, 77);\n text('300 300', 300, 440);\n\n //light green\n if(num < 158) fill(54, 234, 75);\n text('400 400', 300, 395);\n\n //turquoise\n if(num < 200) fill(54, 234, 201);\n text('500 500', 300, 350);\n\n //turquoise\n if(num < 242) fill(77, 243, 207);\n text('600 600', 300, 305);\n\n //light blue\n if(num < 285) fill(77, 210, 243);\n text('700 700', 300, 260);\n\n //blue\n if(num < 330) fill(171, 162, 247);\n text('800 800', 300, 215);\n\n //purple\n if(num < 375) fill(221, 162, 247);\n text('900 900', 300, 170);\n\n //pink\n if(num < 420) fill(238, 162, 247);\n text('1000 1000', 300, 125);\n}", "function arrow (size, source, styles) {\n let sign = source ? -1 : 1\n let marker = {\n viewBox: new Rectangle(-5, -5, 10, 10),\n size: size,\n ref: [4 * sign, 0],\n fill: styles.color\n }\n marker.shape = {\n name: 'Polygon',\n points: [[-2 * sign, 0], [-4 * sign, 4], [4 * sign, 0], [-4 * sign, -4]]\n }\n return marker\n }", "function drawPointList(points) {\n var points = imageSet.images[currentImageIndex].points;\n var dataString = '';\n var dataStringArray = [];\n \n $('#pointlistDiv ul').html('');\n \n points.forEach(function(p) {\n \n // dataString for each point is \"<imageName>, x, y\"\n dataString = imageSet.images[currentImageIndex].name + ', '+p.x+', '+p.y;\n dataStringArray.push(dataString);\n \n var newPointLi = '<li>' + dataString + '</li>';\n $('#pointlistDiv ul').append(newPointLi);\n });\n \n //writePointData(dataStringArray);\n}", "function PolygonEdge() {\n}", "function draw_poly(row, column) {\n var poly = document.createElementNS(\"http://www.w3.org/2000/svg\",\"polygon\");\n poly.setAttribute(\"class\", 'name');\n points = get_poly_points(row, column);\n poly.setAttribute(\"points\", points);\n \n $('#main').append(poly);\n}", "function updateBreadcrumbs(nodeArray, percentageString) {\n\n // Data join; key function combines name and depth (= position in sequence).\n var g = d3.select(\"#trail\")\n .selectAll(\"g\")\n .data(nodeArray, function(d) { return d.name + d.depth; });\n\n // Add breadcrumb and label for entering nodes.\n var entering = g.enter()\n .append(\"svg:g\");\n\n entering/*.append(\"a\")\n .attr(\"xlink:href\", function(d){ return \"https://en.wikipedia.org\"+d.policyURL;} )\n .attr(\"target\",\"_blank\")*/\n .style(\"cursor\", function(d){\n //if(+d.depth >1)\n // return \"zoom-in\";\n //else\n return \"default\";\n })\n .append(\"svg:polygon\")\n .attr(\"points\", breadcrumbPoints)\n .style(\"fill\", function(d,i) { \n if(+d.depth>0)\n return color_random(d.name.replace(\"Wikipedia:\",\"\")); //colors[d.name]; \n else\n return \"#ddd\";\n });\n entering.append(\"svg:text\")\n .attr(\"x\",function(d){ return (d.policyTitle.length*charToPix+charPadding + b.t) / 2; })\n .attr(\"y\", b.h / 2)\n .attr(\"dy\", \"0.40em\")\n .attr(\"text-anchor\", \"middle\")\n .attr(\"font-size\", \"12\")\n .style(\"fill\", \"#333\")\n .style(\"font-weight\", \"500\")\n .text(function(d) { return d.policyTitle ; });\n\n // Set position for entering and updating nodes.\n g.attr(\"transform\", function(d, i) {\n var xShift = 0;\n for (var j = 0; j < i; j++) {\n xShift += nodeArray[j].policyTitle.length*charToPix+charPadding + b.s;\n }\n return \"translate(\" + xShift + \", 0)\";\n });\n // Remove exiting nodes.\n g.exit().remove();\n \n // Make the breadcrumb trail visible, if it's hidden.\n d3.select(\"#trail\")\n .style(\"visibility\", \"\");\n}", "function link1 (d) {\n return \"M\" + d.x + \",\" + d.y\n + \"C\" + (d.x + d.parent.x) / 2 + \",\" + d.y\n + \" \" + (d.x + d.parent.x) / 2 + \",\" + d.parent.y\n + \" \" + d.parent.x + \",\" + d.parent.y;\n }", "function path_L(d) {\n const [p0, p1] = d\n return `M ${xSc(p0.col)} ${ySc(p0.row)} L ${xSc(p1.col)} ${ySc(p1.row)}`\n }", "function poscurToDisplay(pos){\n \"use strict\";\n var bd, fun = function(x){\n\tvar res;\n\tif(x===1){\n\t res = \" X \";\n\t}\n\telse if(x===-1){\n\t res = \" O \";\n\t}\n\telse if(x===0){\n\t res = \" \";\n\t}\n\treturn res;\n };\n bd = pos.map(function(r,i){\n\t\t return pos[i].map(fun);\n\t });\n return bd;\n}", "function generateBreadcrumbs (path){\n\t\t$(\"#perc-chart-breadcrumb-list\").html(\"\");\n\t\tbreadcrumbItems = [];\n\t\tbreadcrumbItems = path.split(\"/\");\n\t\tvar siteName = prefs.getString(SITE_NAME);\n\t\tif (siteName == \"@all\"){\n $(\"#perc-chart-breadcrumb-list\").append(' <li atitle = \"\" ><span id = \"perc-breadcrumb-items\" atitle = \"\">All Sites</span></li><span class = \"perc-breadcrumb-separator\" >&nbsp;>&nbsp;</span>');\t\t\t \t\n\t\t}\n\t\tvar pathValue = breadcrumbItems[0];\n\t\t\n\t\t$(\"#perc-yaxis-label\").html(\"\");\n\t\tif(breadcrumbItems[0] == \"\"){\n\t\t\t$(\".perc-breadcrumb-separator\").hide();\n\t\t\t$(\"#perc-yaxis-label\").append(\"Sites\");\n\t\t}\n\t\telse{\n\t\t\t$(\"#perc-yaxis-label\").append(\"Sections\");\n\t\t}\n\n\n\t\t$(\"#perc-chart-breadcrumb-list\").append('<li atitle = \"'+ breadcrumbItems[0] + '\" ><span id = \"perc-breadcrumb-items\" atitle = \"'+ breadcrumbItems[0] +'\">' +breadcrumbItems[0]+'</span></li>');\n\t\t\n\t\tfor (i=1; i< breadcrumbItems.length; i++)\n\t\t{\n\t\t\t pathValue += '/' + breadcrumbItems[i];\n\t\t\t$(\"#perc-chart-breadcrumb-list\").append(' <span>>&nbsp;</span><li atitle = \"'+ pathValue + '\" ><span id = \"perc-breadcrumb-items\" atitle = \"'+ pathValue +'\">' +breadcrumbItems[i]+'</span></li>');\t\n\t\t}\n\t}", "function renderPath(path) {\n var data = path.split('/');\n var chosePathComponent = document.getElementById('chosePathComponent');\n var componentHtmlData = '';\n data.forEach(function (element, index) {\n componentHtmlData += '<a href=\"#!\" id=\"' + index + '\"' + 'class=\"breadcrumb\" onclick=\"newPathLevel(this.id)\">' + element + '</a>';\n }, this);\n chosePathComponent.innerHTML = componentHtmlData;\n}", "function createLeaves(inters, originPath, leafShape){\r\n\r\n\tvar calcLine = new Path();\r\n\tif(inters[0] === undefined){\r\n\t\t//leaf can not be calculated here\r\n\t\treturn null;\r\n\t}\r\n\r\n\tcalcLine.add(inters[0].point);\r\n\tcalcLine.add(inters[inters.length-1].point);\r\n\tvar point = calcLine.getPointAt(calcLine.length/2);\r\n\tvar normal = calcLine.getNormalAt(calcLine.length/2);\r\n\r\n\tif(originPath.contains(point.add(normal.multiply(5)))){\r\n\t\tnormal = normal.multiply(-1);\r\n\t}\r\n\r\n\tvar middleLine = new Path();\r\n\tmiddleLine.strokeWidth = 6;\r\n\tmiddleLine.strokeColor = leafColor;\r\n\tmiddleLine.opacity = 0;\r\n\tvar angle = normal.angle+90;\r\n\tif(angle>180){\r\n\t\tangle = angle-360;\r\n\t}\r\n\tvar side = 1;\r\n\tif(angle<0){\r\n\t\tside = -1\r\n\t}\r\n\r\n\tvar height = state.getNextInt(20,40);\r\n\ttip = point.add(normal.multiply(height));\r\n\r\n\tvar l1 = state.getNextInt(15,20);\r\n\tvar l2 = state.getNextInt(20,40);\r\n\tvar l3 = state.getNextInt(45,70);\r\n\tvar outerLine = new Path();\r\n\touterLine.strokeColor = leafColor;\r\n\touterLine.opacity = 0;\r\n\touterLine.strokeWidth = 6;\r\n\touterLine.add(point);\r\n\touterLine.add(tip);\r\n\touterLine.lineBy(0,-l1);\r\n\touterLine.lineBy(side*l2,-l2);\r\n\touterLine.lineBy(side*l3,0);\r\n\r\n\tvar innerLine = new Path();\r\n\tinnerLine.strokeColor = leafColor;\r\n\tinnerLine.opacity = 0;\r\n\tinnerLine.strokeWidth = 6;\r\n\tinnerLine.add(tip);\r\n\tinnerLine.lineBy(side*l2,-l2);\r\n\tinnerLine.lineBy(side*l3*0.5,0);\r\n\r\n\touterLine.add(new Point(innerLine.lastSegment.point.x, tip.y));\r\n\touterLine.add(new Point(innerLine.segments[1].point.x, tip.y));\r\n\r\n\tvar innerCircle = new Path.Circle(innerLine.lastSegment.point, 6);\r\n\tinnerCircle.fillColor = leafColor;\r\n\tvar outerCircle = new Path.Circle(outerLine.lastSegment.point, 6);\r\n\touterCircle.fillColor = leafColor;\r\n\r\n\tvar offs1 = leafShape.getOffsetOf(inters[0].point);\r\n\tvar offs2 = leafShape.getOffsetOf(inters[inters.length-1].point);\r\n\tconsole.log(offs1+\" \"+offs2);\r\n\tvar root = new Path();\r\n\troot.add(tip);\r\n\troot.add(inters[0].point);\r\n\tfor(var i = 0; i<leafShape.segments.length; i++){\r\n\t\tvar offs = leafShape.getOffsetOf(leafShape.segments[i].point);\r\n\t\tif(offs>offs1 && offs<offs2){\r\n\t\t\troot.add(leafShape.segments[i].point);\r\n\t\t}\r\n\t}\r\n\troot.add(inters[inters.length-1].point);\r\n\troot.fillColor = leafColor;\r\n\troot.opacity = 0;\r\n\tconsole.log(root);\r\n\r\n\tvar leafGroup = new Group();\r\n\tleafGroup.addChild(root);\r\n\tleafGroup.addChild(innerLine);\r\n\tleafGroup.addChild(outerLine);\r\n\tleafGroup.addChild(innerCircle);\r\n\tleafGroup.addChild(outerCircle);\r\n\treturn leafGroup;\r\n}", "computeCatmullClarkPoints()\n { \n // Calcul des tous les face points\n for(var i = 0; i < this.polygones.length; ++i)\n {\n this.polygones[i].computeFacePoint();\n this.pushCatmullClarkVertex(this.polygones[i].facePoint);\n }\n \n // Calcul des tous les edge points\n for(var i = 0; i < this.edges.length; ++i)\n {\n this.edges[i].computeEdgePoint();\n this.pushCatmullClarkVertex(this.edges[i].edgePoint);\n }\n \n // Calcul des tous les vertice points\n for(var i = 0; i < this.vertice.length; ++i)\n {\n this.vertice[i].computeVertexPoint();\n this.pushCatmullClarkVertex(this.vertice[i].vertexPoint);\n }\n }", "function polygonize (str, properties) {\n var coordinates = str.split(' ').map(function (pairStr) {\n return pairStr.split(',').reverse().map(Number);\n });\n\n return polygon([coordinates], properties);\n}", "function prepForPath(points){\n let arr = points.slice();\n return arr.push(arr[arr.length - 1]);\n}", "function drawPolygon(polygon) {\n var path = svg.append(\"g\").selectAll(\"path\");\n\n path = path\n .data(polygon, polygonF);\n path.exit()\n path.enter()\n .append(\"path\")\n .attr(\"class\", function(d, i) {\n return \"celula q\" + (i % 9) + \"-9\";\n })\n .attr(\"d\", polygonF);\n\n path.order();\n}", "function renderTempPath() {\n if (!svl.ribbon) {\n // return if the ribbon menu is not correctly loaded.\n return false;\n }\n\n var i = 0;\n var pathLen = tempPath.length;\n var labelColor = getLabelColors()[svl.ribbon.getStatus('selectedLabelType')];\n\n var pointFill = labelColor.fillStyle;\n pointFill = svl.util.color.changeAlphaRGBA(pointFill, 0.5);\n\n\n // Draw the first line.\n ctx.strokeStyle = 'rgba(255,255,255,1)';\n ctx.lineWidth = 2;\n if (pathLen > 1) {\n var curr = tempPath[1];\n var prev = tempPath[0];\n var r = Math.sqrt(Math.pow((tempPath[0].x - mouseStatus.currX), 2) + Math.pow((tempPath[0].y - mouseStatus.currY), 2));\n\n // Change the circle radius of the first point depending on the distance between a mouse cursor and the point coordinate.\n if (r < properties.radiusThresh && pathLen > 2) {\n svl.util.shape.lineWithRoundHead(ctx, prev.x, prev.y, 2 * properties.tempPointRadius, curr.x, curr.y, properties.tempPointRadius, 'both', 'rgba(255,255,255,1)', pointFill, 'none', 'rgba(255,255,255,1)', pointFill);\n } else {\n svl.util.shape.lineWithRoundHead(ctx, prev.x, prev.y, properties.tempPointRadius, curr.x, curr.y, properties.tempPointRadius, 'both', 'rgba(255,255,255,1)', pointFill, 'none', 'rgba(255,255,255,1)', pointFill);\n }\n }\n\n // Draw the lines in between\n for (i = 2; i < pathLen; i++) {\n var curr = tempPath[i];\n var prev = tempPath[i-1];\n svl.util.shape.lineWithRoundHead(ctx, prev.x, prev.y, 5, curr.x, curr.y, 5, 'both', 'rgba(255,255,255,1)', pointFill, 'none', 'rgba(255,255,255,1)', pointFill);\n }\n\n if (r < properties.radiusThresh && pathLen > 2) {\n svl.util.shape.lineWithRoundHead(ctx, tempPath[pathLen-1].x, tempPath[pathLen-1].y, properties.tempPointRadius, tempPath[0].x, tempPath[0].y, 2 * properties.tempPointRadius, 'both', 'rgba(255,255,255,1)', pointFill, 'none', 'rgba(255,255,255,1)', pointFill);\n } else {\n svl.util.shape.lineWithRoundHead(ctx, tempPath[pathLen-1].x, tempPath[pathLen-1].y, properties.tempPointRadius, mouseStatus.currX, mouseStatus.currY, properties.tempPointRadius, 'both', 'rgba(255,255,255,1)', pointFill, 'stroke', 'rgba(255,255,255,1)', pointFill);\n }\n }", "function printPath(s2) {\n if(s2.prev === undefined || is_empty_list(s2.prev)) {\n return s2.name;\n } else {\n //display(s2.name);\n s2.name = s2.name === \"CG0\" ? \"CG\" : s2.name;\n var sl = filter(function(x) { \n return x.name.substring(0,2) === s2.name.substring(0,2);\n }, s2.prev);\n if(is_empty_list(sl)) {\n return printPath(head(s2.prev)) + \"->\" + s2.name;\n } else {\n return printPath(head(sl)) + \"->\" + s2.name;\n }\n }\n }", "function generateBreadcrumbs(nextDir){\n\t\t\tvar path = [data.name].concat(nextDir.split(data.name)[1].split('/').filter(function(e){return e}).slice(0));\n\t\t\tfor(var i=1;i<path.length;i++){\n\t\t\t\tpath[i] = path[i-1]+ '/' +path[i];\n\t\t\t}\n\t\t\treturn path;\n\t\t}", "printText () {\n\n push();\n\n translate ( this.xCoord, this.yCoord );\n\n fill ( 250, 250, 250 );\n noStroke();\n\n triangle( 0, - this.size / 3, this.size / 5, -this.size / 2, - this.size / 5, -this.size / 2 );\n ellipse ( 0, - 2 * (this.size / 3), this.size - 20, this.size / 2 );\n\n textAlign( CENTER );\n textStyle ( BOLD );\n textSize ( this.size / 12 );\n fill ( 70, 70, 70 );\n\n text ( this.name, 0, - 15 * ( this.size / 20 ) );\n textSize ( this.size / 16 );\n text ( \"Pre\", -this.size / 5, - 13 * (this.size / 20 ) );\n text ( \"Post\", this.size / 5, - 13 * (this.size / 20 ) );\n\n textSize ( this.size / 12 );\n text ( this.preCovidPercentage + \"%\", - this.size / 5, - 11 * ( this.size / 20 ));\n text ( this.postCovidPercentage + \"%\", this.size / 5, - 11 * ( this.size / 20 ));\n\n pop();\n }" ]
[ "0.7508625", "0.7496226", "0.7268039", "0.7244852", "0.72284234", "0.7202926", "0.71885484", "0.7159244", "0.7126875", "0.709076", "0.7055904", "0.70478076", "0.70160043", "0.68495303", "0.6755773", "0.6524368", "0.63802934", "0.5969802", "0.5944424", "0.5928913", "0.5868209", "0.580209", "0.56950474", "0.5583385", "0.55713314", "0.5563694", "0.5533139", "0.5533139", "0.5515146", "0.5509741", "0.5506342", "0.5504383", "0.5503155", "0.54940903", "0.54824674", "0.54680747", "0.54666233", "0.5418906", "0.5407322", "0.54054743", "0.5398032", "0.53806853", "0.5364153", "0.53510934", "0.53489494", "0.53343683", "0.53225476", "0.53173834", "0.5308642", "0.5299593", "0.52966267", "0.5273976", "0.52421993", "0.52309597", "0.5224259", "0.5206629", "0.52011645", "0.5192589", "0.5189679", "0.51724625", "0.5165412", "0.5161434", "0.5147881", "0.5128609", "0.51221836", "0.5118154", "0.511802", "0.5108363", "0.51053154", "0.5090101", "0.50873566", "0.5081396", "0.5077325", "0.50704587", "0.50703603", "0.506628", "0.5061404", "0.50579566", "0.5050899", "0.5049779", "0.50490457", "0.5028653", "0.5028646", "0.50177014", "0.50080925", "0.49896753", "0.49867868", "0.4985587", "0.4984929", "0.49844658", "0.498147", "0.49814674", "0.49790254", "0.49783823", "0.49699324", "0.49546695", "0.49522516", "0.49508986", "0.4946469" ]
0.710516
10
Update the breadcrumb trail to show the current sequence and percentage.
function updateBreadcrumbs(nodeArray, percentageString) { // Data join; key function combines name and depth (= position in sequence). var trail = d3.select("#trail") .selectAll("g") .data(nodeArray, function(d) { return d.data.name + d.depth; }); // Remove exiting nodes. trail.exit().remove(); // Add breadcrumb and label for entering nodes. var entering = trail.enter().append("svg:g"); entering.append("svg:polygon") .attr("points", breadcrumbPoints) .style("fill", function(d) { return colors[d.data.name]; }); entering.append("svg:text") .attr("x", (b.w + b.t) / 2) .attr("y", b.h / 2) .attr("dy", "0.35em") .attr("text-anchor", "middle") .text(function(d) { return d.data.name; }); // Merge enter and update selections; set position for all nodes. entering.merge(trail).attr("transform", function(d, i) { return "translate(" + i * (b.w + b.s) + ", 0)"; }); // Now move and update the percentage at the end. d3.select("#trail").select("#endlabel") .attr("x", (nodeArray.length + 0.5) * (b.w + b.s)) .attr("y", b.h / 2) .attr("dy", "0.35em") .attr("text-anchor", "middle") .text(percentageString); // Make the breadcrumb trail visible, if it's hidden. d3.select("#trail") .style("visibility", ""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateBreadcrumbs(sequence, value, percentage) {\n var that = this;\n var b = this.opt.breadcrumbs;\n //console.log(that);\n // Data join; key function combines name and depth (= position in sequence).\n var trail = d3.select(\"#trail\")\n .selectAll(\"g\")\n .data(sequence, function (d) {\n return d.data.name + d.depth;\n });\n trail.exit().remove();\n // Add breadcrumb and label for entering nodes.\n var entering = trail.enter().append(\"svg:g\");\n entering.append(\"svg:polygon\")\n .attr(\"points\", that.breadcrumbPoints.bind(this))\n .style(\"fill\", function (d) {\n return that.getColor(d.data.name.split(\"/\")[0], d.data.name.split(\"/\")[1]);//that.opt.color(d.split(\"/\")[0]);\n });\n entering.append(\"svg:text\").each(function (d) {\n let jr = d.data.name.split(\"/\");\n var svgText = d3.select(this)\n .attr(\"x\", (b.w + b.t) / 2)\n .attr(\"y\", b.h / 3)\n .attr(\"text-anchor\", \"middle\")\n .attr(\"dy\", \"0.35em\");\n for (var i = 0; i < jr.length; i++) {\n svgText.append(\"tspan\")\n .attr(\"x\", (b.w + b.t) / 2)\n .attr('dy', '1em')\n .text(jr[i]);\n }\n });\n // Set position for entering and updating nodes.\n entering.merge(trail).attr(\"transform\", function (d, i) {\n return \"translate(\" + i * (b.w + b.s) + \", 0)\";\n });\n // Now move and update the percentage at the end.\n d3.select(\"#trail\").select(\"#endlabel\")\n .attr(\"x\", (sequence.length + 0.6) * (b.w + b.s))\n .attr(\"y\", b.h / 2)\n .attr(\"dy\", \"0.35em\")\n .attr(\"text-anchor\", \"left\")\n\n .text(that.formatBreadcrumbText(sequence, value, percentage));\n // Make the breadcrumb trail visible, if it's hidden.\n d3.select(\"#trail\")\n .style(\"visibility\", \"\");\n }", "function updateBreadcrumbs(nodeArray, percentageString, ques, totalpstring) {\n\n // Data join; key function combines name and depth (= position in sequence).\n var g = d3.select(\"#trail\")\n .selectAll(\"g\")\n .data(nodeArray, function(d) { return d.name + d.depth;});\n\n // Add breadcrumb and label for entering nodes.\n var entering = g.enter().append(\"svg:g\");\n\n entering.append(\"svg:polygon\")\n .attr(\"points\", breadcrumbPoints)\n .style(\"fill\", function(d) { return getColor(colors, d.name); });\n\n entering.append(\"svg:text\")\n .attr(\"x\", (b.w + b.t) / 2)\n .attr(\"y\", b.h / 2)\n .attr(\"dy\", \"0.35em\")\n .attr(\"text-anchor\", \"middle\")\n .text(function(d) {\n return d.name; });\n\n // Set position for entering and updating nodes.\n g.attr(\"transform\", function(d, i) {\n return \"translate(\" + i * (b.w + b.s) + \", 0)\";\n });\n\n // Remove exiting nodes.\n g.exit().remove();\n\n // Now move and update the percentage at the end.\n d3.select(\"#trail\").select(\"#endlabel\")\n .attr(\"x\", (nodeArray.length + 1.2) * (b.w + b.s) + 20)\n .attr(\"y\", b.h / 2)\n .attr(\"dy\", \"0.35em\")\n .attr(\"text-anchor\", \"middle\")\n .text(ques + totalpstring);\n\n // Make the breadcrumb trail visible, if it's hidden.\n d3.select(\"#trail\")\n .style(\"visibility\", \"\");\n\n }", "function updateBreadcrumbs(nodeArray, percentageString) {\n\n // Data join; key function combines name and depth (= position in sequence).\n var g = d3.select('#trail')\n .selectAll('g')\n .data(nodeArray, function (d) {\n return d.name + d.depth;\n });\n\n // Add breadcrumb and label for entering nodes.\n var entering = g.enter().append('svg:g');\n\n entering.append('svg:polygon')\n .attr('points', breadcrumbPoints)\n .style('fill', function (d) {\n return colors[d.name];\n });\n\n entering.append('svg:text')\n .attr('x', (b.w + b.t) / 2)\n .attr('y', b.h / 2)\n .attr('dy', '0.35em')\n .attr('text-anchor', 'middle')\n .text(function (d) {\n return d.name;\n });\n\n // Set position for entering and updating nodes.\n g.attr('transform', function (d, i) {\n return 'translate(' + i * (b.w + b.s) + ', 0)';\n });\n\n // Remove exiting nodes.\n g.exit().remove();\n\n // Now move and update the percentage at the end.\n d3.select('#trail').select('#endlabel')\n .attr('x', (nodeArray.length + 0.5) * (b.w + b.s))\n .attr('y', b.h / 2)\n .attr('dy', '0.35em')\n .attr('text-anchor', 'middle')\n .text(percentageString);\n\n // Make the breadcrumb trail visible, if it's hidden.\n d3.select('#trail')\n .style('visibility', '');\n }", "function updateBreadcrumbs(nodeArray, percentageString) {\r\n \r\n // Data join; key function combines name and depth (= position in sequence).\r\n var g = d3.select(\"#trail\")\r\n .selectAll(\"g\")\r\n .data(nodeArray, function(d) { return d.name + d.depth; });\r\n \r\n // Add breadcrumb and label for entering nodes.\r\n var entering = g.enter().append(\"svg:g\");\r\n \r\n entering.append(\"svg:polygon\")\r\n .attr(\"points\", breadcrumbPoints)\r\n .style(\"fill\", function(d) { return colors[d.name]; });\r\n \r\n entering.append(\"svg:text\")\r\n .attr(\"x\", (b.w + b.t) / 2)\r\n .attr(\"y\", b.h / 2)\r\n .attr(\"dy\", \"0.35em\")\r\n .attr(\"text-anchor\", \"middle\")\r\n .text(function(d) { return d.name; });\r\n \r\n // Set position for entering and updating nodes.\r\n g.attr(\"transform\", function(d, i) {\r\n return \"translate(\" + i * (b.w + b.s) + \", 0)\";\r\n });\r\n \r\n // Remove exiting nodes.\r\n g.exit().remove();\r\n \r\n // Now move and update the percentage at the end.\r\n d3.select(\"#trail\").select(\"#endlabel\")\r\n .attr(\"x\", (nodeArray.length + 0.5) * (b.w + b.s))\r\n .attr(\"y\", b.h / 2)\r\n .attr(\"dy\", \"0.35em\")\r\n .attr(\"text-anchor\", \"middle\")\r\n .text(percentageString);\r\n \r\n // Make the breadcrumb trail visible, if it's hidden.\r\n d3.select(\"#trail\")\r\n .style(\"visibility\", \"\");\r\n \r\n }", "formatBreadcrumbText(sequence, value, percentage) {\n if (sequence.length > 0 && _.has(sequence[sequence.length - 1].data, \"conversion_type\")) {\n return sequence[sequence.length - 1].data.conversion_type;\n } else {\n return \"\"\n }\n //return value + \" (\" + (percentage < 0.1 ? \"< 0.1%\" : percentage + \"%\") + \")\";\n }", "function update_breadcrumb(currentSlide) {\n const bs = currentSlide.getElementsByClassName(\"breadcrumb-data\")[0];\n if (bs !== undefined ) {\n breadcrumb_bar.textContent = bs.textContent\n } else {\n breadcrumb_bar.textContent = ''\n }\n }", "function updateBreadcrumbs(nodeArray, percentageString) {\n\n // Data join; key function combines name and depth (= position in sequence).\n var g = d3.select(\"#trail\")\n .selectAll(\"g\")\n .data(nodeArray, function(d) { return d.name + d.depth; });\n\n // Add breadcrumb and label for entering nodes.\n var entering = g.enter().append(\"svg:g\");\n\n entering.append(\"svg:polygon\")\n .attr(\"points\", breadcrumbPoints)\n .style(\"fill\", function(d) { return colors[d.name]; });\n\n entering.append(\"svg:text\")\n .attr(\"x\", (b.w + b.t) / 2)\n .attr(\"y\", b.h / 2)\n .attr(\"dy\", \"0.35em\")\n .attr(\"text-anchor\", \"middle\")\n .text(function(d) { return d.name; });\n\n // Set position for entering and updating nodes.\n g.attr(\"transform\", function(d, i) {\n return \"translate(\" + i * (b.w + b.s) + \", 0)\";\n });\n\n // Remove exiting nodes.\n g.exit().remove();\n\n // Now move and update the percentage at the end.\n d3.select(\"#trail\").select(\"#endlabel\")\n .attr(\"x\", (nodeArray.length + 0.5) * (b.w + b.s))\n .attr(\"y\", b.h / 2)\n .attr(\"dy\", \"0.35em\")\n .attr(\"text-anchor\", \"middle\")\n .text(percentageString);\n\n // Make the breadcrumb trail visible, if it's hidden.\n d3.select(\"#trail\")\n .style(\"visibility\", \"\");\n\n }", "function updateBreadcrumbs(nodeArray, percentageString) {\n\n // Data join; key function combines name and depth (= position in sequence).\n var g = d3.select(\"#trail\")\n .selectAll(\"g\")\n .data(nodeArray, function(d) { return d.name + d.depth; });\n \n // Add breadcrumb and label for entering nodes.\n var entering = g.enter().append(\"svg:g\");\n\n entering.append(\"svg:polygon\")\n .attr(\"points\", breadcrumbPoints)\n .style(\"fill\", function(d) { return colors[d.name] ? colors[d.name] : \"blue\"; });\n\n entering.append(\"svg:text\")\n .attr(\"x\", (b.w*1.5 + b.t) / 2)\n .attr(\"y\", b.h / 2)\n .attr(\"dy\", \"0.0em\")\n .attr(\"text-anchor\", \"middle\")\n .text(function(d) { return d.name; });\n\n // Set position for entering and updating nodes.\n g.attr(\"transform\", function(d, i) {\n return \"translate(\" + i * (b.w*2+ b.s) + \", 0)\";\n });\n\n // Remove exiting nodes.\n g.exit().remove();\n\n g.selectAll('text').each(insertLinebreaks);\n // Now move and update the percentage at the end.\n d3.select(\"#trail\").select(\"#endlabel\")\n .attr(\"x\", (nodeArray.length + 0.25) * (b.w + b.s))\n .attr(\"y\", b.h / 2)\n .attr(\"dy\", \"0.35em\")\n .attr(\"text-anchor\", \"middle\")\n .text(percentageString);\n\n // Make the breadcrumb trail visible, if it's hidden.\n d3.select(\"#trail\")\n .style(\"visibility\", \"\");\n\n}", "function updateBreadcrumbs(nodeArray, percentageString) {\n // Data join; key function combines name and depth (= position in sequence).\n const g = d3.select('#trail')\n .selectAll('g')\n .data(nodeArray, d => d.name + d.depth);\n\n // Add breadcrumb and label for entering nodes.\n const entering = g.enter().append('svg:g');\n\n entering.append('svg:polygon')\n .attr('points', breadcrumbPoints)\n .style('fill', d => colors[d.name] || defaultColors[d.rank % defaultColors.length]);\n\n entering.append('svg:text')\n .attr('x', (b.w + b.t) / 2)\n .attr('y', b.h / 2)\n .attr('dy', '0.35em')\n .attr('text-anchor', 'middle')\n .text(d => d.name);\n\n // Set position for entering and updating nodes.\n g.attr('transform', (d, i) => `translate(${i * (b.w + b.s)}, 0)`);\n\n // Remove exiting nodes.\n g.exit().remove();\n\n // Now move and update the percentage at the end.\n d3.select('#trail').select('#endlabel')\n .attr('x', (nodeArray.length + 0.5) * (b.w + b.s))\n .attr('y', b.h / 2)\n .attr('dy', '0.35em')\n .attr('text-anchor', 'middle')\n .text(percentageString);\n\n // Make the breadcrumb trail visible, if it's hidden.\n d3.select('#trail')\n .style('visibility', '');\n}", "function _updateBreadcrumbs(nodeArray, percentageString) {\n\n var g = self.trail\n .selectAll('g')\n .data(nodeArray, function(d) { return d.name + d.depth; });\n var entering = g.enter().append('svg:g');\n\n entering.append('svg:polygon')\n .attr('points', _breadcrumbPoints)\n .style('fill', function(d) { return _.find(options.supports, {key: d.name}) ? _.find(options.supports, {key: d.name}).color : '#F0F0F0'; });\n\n entering.append('svg:text')\n .attr('x', (options.trail.b.w + options.trail.b.t) / 2)\n .attr('y', options.trail.b.h / 2)\n .attr('dy', '0.35em')\n .attr('text-anchor', 'middle')\n .style('fill', '#ffffff')\n .text(function(d) { return d.name; });\n\n // Set position for entering and updating nodes.\n g.attr('transform', function(d, i) {\n return 'translate(' + i * (options.trail.b.w + options.trail.b.s) + ', 0)';\n });\n\n // Remove exiting nodes.\n g.exit().remove();\n\n // Now move and update the percentage at the end.\n self.trail.select('#endlabel')\n .attr('x', (nodeArray.length + 0.5) * (options.trail.b.w + options.trail.b.s))\n .attr('y', options.trail.b.h / 2)\n .attr('dy', '0.35em')\n .attr('text-anchor', 'middle')\n .text(percentageString);\n\n // Make the breadcrumb trail visible, if it's hidden.\n self.trail.style('visibility', 'visible');\n }", "function updateProgress ( current, total ){\n $(\".progress .currentProgress\").css('width', ((current - 1) / total) * 100 +'%');\n $(\".progress .progresstext\").html('Frage '+ current + ' von ' + (total))\n }", "function updateBreadcrumbs(nodeArray, percentageString) {\n // Data join; key function combines name and depth (= position in sequence).\n var trail = d3.select(\"#trail\")\n .selectAll(\"g\")\n .data(nodeArray, function(d) { return d.data.name + d.depth; });\n // Remove exiting nodes.\n trail.exit().remove();\n\n // Add breadcrumb and label for entering nodes.\n var entering = trail.enter().append(\"svg:g\");\n\n entering.append(\"svg:polygon\")\n .attr(\"points\", breadcrumbPoints)\n //.style(\"fill\", function(d) {return colors[d.data.name]; });\n .style(\"fill\", \"none\")\n .style(\"stroke\", \"black\")\n .style(\"stroke-width\", 1);\n\n entering.append(\"svg:text\")\n .attr(\"x\", (b.w + b.t) / 2)\n .attr(\"y\", b.h / 2)\n .attr(\"dy\", \"0.35em\")\n .attr(\"text-anchor\", \"middle\")\n .style(\"fill\", \"black\")\n .attr(\"class\", \"wrap\")\n .style(\"font-size\", function(d){\n var length = d.data.name.length;\n if(length >= 5){\n return 9 + \"px\";\n }else{\n return 15 + \"px\";\n }\n })\n .text(function(d) { return d.data.name; });\n\n // Merge enter and update selections; set position for all nodes.\n entering.merge(trail).attr(\"transform\", function(d, i) {\n return \"translate(\" + i * (b.w + b.s) + \", 0)\";\n //return \"translate(0, \" + i * (b.h + b.s) + \")\";\n });\n\n // Now move and update the percentage at the end.\n d3.select(\"#trail\").select(\"#endlabel\")\n .attr(\"x\", (nodeArray.length + 0.5) * (b.w + b.s))\n .attr(\"y\", b.h / 2)\n .attr(\"dy\", \"0.35em\")\n .attr(\"text-anchor\", \"middle\")\n .text(percentageString);\n\n // Make the breadcrumb trail visible, if it's hidden.\n d3.select(\"#trail\")\n .style(\"visibility\", \"\");\n}", "updateBreadcrumbs(nodeArray, percentageString) {\n\t\t\t// Data join; key function combines name and depth (= position in sequence).\n\t\t\tconst g = d3.select(\"#trail\")\n\t\t\t\t.selectAll(\"g\")\n\t\t\t\t.data(nodeArray, d => d.name + d.depth);\n\n\t\t\t// Add breadcrumb and label for entering nodes.\n\t\t\tconst entering = g.enter().append(\"svg:g\");\n\n\t\t\tentering.append(\"svg:polygon\")\n\t\t\t\t.attr(\"points\", this.breadcrumbPoints)\n\t\t\t\t.style(\"fill\", () => \"#f1f1f1\");\n\n\t\t\tentering.append(\"svg:text\")\n\t\t\t\t.attr(\"x\", (this.b.w + this.b.t) / 2)\n\t\t\t\t.attr(\"y\", this.b.h / 2)\n\t\t\t\t.attr(\"dy\", \"0.35em\")\n\t\t\t\t.attr(\"text-anchor\", \"middle\")\n\t\t\t\t.text(d => d.name);\n\n\t\t\t// Set position for entering and updating nodes.\n\t\t\tg.attr(\"transform\", (d, i) => `translate(${i * (this.b.w + this.b.s)}, 0)`);\n\n\t\t\t// Remove exiting nodes.\n\t\t\tg.exit().remove();\n\n\t\t\t// Now move and update the percentage at the end.\n\t\t\td3.select(\"#trail\").select(\"#endlabel\")\n\t\t\t\t.attr(\"x\", (nodeArray.length + 0.5) * (this.b.w + this.b.s))\n\t\t\t\t.attr(\"y\", this.b.h / 2)\n\t\t\t\t.attr(\"dy\", \"0.35em\")\n\t\t\t\t.attr(\"text-anchor\", \"middle\")\n\t\t\t\t.text(percentageString);\n\n\t\t\t// Make the breadcrumb trail visible, if it's hidden.\n\t\t\td3.select(\"#trail\")\n\t\t\t\t.style(\"visibility\", \"\");\n\t\t}", "function initializeBreadcrumbTrail() {\r\n // Add the svg area.\r\n var trail = d3.select(el).select(\".sunburst-sequence\").append(\"svg\")\r\n .attr(\"width\", width)\r\n //.attr(\"height\", 50)\r\n .attr(\"id\", el.id + \"-trail\");\r\n // Add the label at the end, for the percentage.\r\n trail.append(\"text\")\r\n .attr(\"id\", el.id + \"-endlabel\")\r\n .style(\"fill\", \"#000\");\r\n }", "updateCrumbs() {\n console.debug(this.dir);\n let elements = this.dir.split('/'),\n pathPrefix = '/gi_album',\n path = _.map(elements, (elem) => {\n if (elem === '') {\n return {\n name: 'Album',\n url: '/gi_album'\n };\n } else {\n let prefix = pathPrefix;\n pathPrefix = pathPrefix + '/' + elem;\n return {\n name: elem,\n url: prefix + '/' + elem\n };\n }\n });\n path.unshift({\n name: 'Home',\n url: '/'\n });\n this.Breadcrumb.setPath(path);\n\n // HACK KI to update document title\n document.title = path[path.length -1].name;\n }", "function updateBreadcrumbs(nodeArray, percentageString) {\n\n // Data join; key function combines name and depth (= position in sequence).\n var g = d3.select(\"#trail\")\n .selectAll(\"g\")\n .data(nodeArray, function(d) { return d.name + d.depth; });\n\n // Add breadcrumb and label for entering nodes.\n var entering = g.enter()\n .append(\"svg:g\");\n\n entering/*.append(\"a\")\n .attr(\"xlink:href\", function(d){ return \"https://en.wikipedia.org\"+d.policyURL;} )\n .attr(\"target\",\"_blank\")*/\n .style(\"cursor\", function(d){\n //if(+d.depth >1)\n // return \"zoom-in\";\n //else\n return \"default\";\n })\n .append(\"svg:polygon\")\n .attr(\"points\", breadcrumbPoints)\n .style(\"fill\", function(d,i) { \n if(+d.depth>0)\n return color_random(d.name.replace(\"Wikipedia:\",\"\")); //colors[d.name]; \n else\n return \"#ddd\";\n });\n entering.append(\"svg:text\")\n .attr(\"x\",function(d){ return (d.policyTitle.length*charToPix+charPadding + b.t) / 2; })\n .attr(\"y\", b.h / 2)\n .attr(\"dy\", \"0.40em\")\n .attr(\"text-anchor\", \"middle\")\n .attr(\"font-size\", \"12\")\n .style(\"fill\", \"#333\")\n .style(\"font-weight\", \"500\")\n .text(function(d) { return d.policyTitle ; });\n\n // Set position for entering and updating nodes.\n g.attr(\"transform\", function(d, i) {\n var xShift = 0;\n for (var j = 0; j < i; j++) {\n xShift += nodeArray[j].policyTitle.length*charToPix+charPadding + b.s;\n }\n return \"translate(\" + xShift + \", 0)\";\n });\n // Remove exiting nodes.\n g.exit().remove();\n \n // Make the breadcrumb trail visible, if it's hidden.\n d3.select(\"#trail\")\n .style(\"visibility\", \"\");\n}", "function updateProgressbarDisplay() {\n if (progressBarProgressionElement) {\n updateStep(progressBarProgressionElement)\n updateCounter()\n }\n }", "function updateProgress(value) {\n var progressBarStep = value*stepSize;\n $(\"#progress\").css(\"width\", progressBarStep + \"%\");\n $(\"#progress\").attr(\"aria-valuenow\", progressBarStep);\n $(\"#progress-current\").html(value);\n}", "function updateProgress(){\n const computedPercentage = Math.round(attendanceRecords.length / traineeIds.length * 100);\n $(\"#progressbar\").children().attr(\"aria-valuenow\", computedPercentage).css(\"width\", computedPercentage + \"%\").text(computedPercentage + \"% Complete\");\n}", "function update_progress(idx){\r\n\t\t$('.step_nb').text(idx +'/'+list_elem_count);\r\n\t}", "function updateProgressInfo() {\n\tif (!div_progress_info) {\n\t\tdiv_progress_info = document.getElementById('progress_info');\n\t}\n\tif (!div_progress_bar) {\n\t\tdiv_progress_bar = document.getElementById('progress_bar');\n\t}\n\tif (!div_progress_info && !div_progress_bar) {\n\t\treturn;\n\t}\n\n\tvar percentage = Math.floor(100.0*blamedLines/totalLines);\n\n\tif (div_progress_info) {\n\t\tdiv_progress_info.firstChild.data = blamedLines + ' / ' + totalLines +\n\t\t\t' (' + padLeftStr(percentage, 3, '\\u00A0') + '%)';\n\t}\n\n\tif (div_progress_bar) {\n\t\t//div_progress_bar.setAttribute('style', 'width: '+percentage+'%;');\n\t\tdiv_progress_bar.style.width = percentage + '%';\n\t}\n}", "function updateProgressBar() {\n pbValue+=10;\n $('.progress-bar').css('width', pbValue+'%').attr('aria-valuenow', pbValue);\n $('.progress-bar').text(pbValue + \"%\");\n }", "function setProgressBar(curStep){\n var percent = parseFloat(50 / steps) * curStep;\n percent = percent.toFixed();\n $(\".barrafinal\")\n .css(\"width\",percent+\"%\")\n .html(percent+\"%\"); \n }", "function updateBreadcrumbs(nodeArray, percentageString) {\n\t// Data join; key function combines name and depth (= position in sequence).\n\tvar g = d3.select(\"#trail\")\n\t\t.selectAll(\"g\")\n\t\t.data(nodeArray, function (d) {\n\t\t\treturn d.name + d.depth;\n\t\t});\n\n\t// Add breadcrumb and label for entering nodes.\n\tvar entering = g.enter().append(\"svg:g\");\n\n\t// mskim\n\t// entering.append(\"svg:polygon\")\n\t// .attr(\"points\", breadcrumbPoints)\n\t// .style(\"fill\", function(d) { return colors[d.name]; });\n\tfunction clickNav(d) {\n\t\tnode = d;\n\n\t\tconsole.log(123)\n\t\tlet sun = d3.select(\"#tree_text_\" + d.name).node()\n\t\tif (sun) {\n\t\t\tsun.dispatchEvent(new MouseEvent(\"click2\"));\n\t\t}\n\t\t// mskim: leaf node는 size attribute 를가지는 것을 이용해서 size attribute가 있으면 return시킴\n\t\tif (node.size) return;\n\n\t\tpath.transition()\n\t\t\t.duration(500)\n\t\t\t.attrTween(\"d\", arcTweenZoom(d));\n\t}\n\n\n\tlet curLocks = 0;\n\tlet lockHeight = 0;\n\n\t\n\tentering.append(\"svg:rect\")\n\t\t.attr(\"vv\", function (d) {\n\t\t\tlockHeight = 0;\n\t\t\tcurLocks = 0;\n\t\t})\n\t\t.attr(\"class\", \"ss\")\n\t\t.attr(\"width\", function (d) {\n\t\t\t\n\t\t\tif (d.name.indexOf(\"lock\") == 0) {\n\t\t\t\tlockHeight++;\n\t\t\t}\n\n\t\t\tvar len;\n\t\t\tif(isLock(d.name)){\n\t\t\t\tvar lockName = getLockName(d.name)\n\t\t\t\tif(d.name.indexOf(\"acquire\") != -1){\n\t\t\t\t\tlockName = d.name;\n\t\t\t\t}\n\t\t\t\tlen = lockName.length;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlen = d.name.length\n\t\t\t}\n\t\t\treturn len * 6.3 + 10;\n\n\t\t\t// return d.name.length * 6.3 + 10;\n\t\t\t// return b.w;\n\t\t})\n\t\t.attr(\"height\", function (d) {\n\t\t\tif (d.name.indexOf(\"lock\") == 0) {\n\t\t\t\tcurLocks++;\n\t\t\t\t// console.log(lockHeight - curLocks + 1);\n\t\t\t\tlet t = (lockHeight - curLocks + 1)\n\t\t\t\t// curLocks = 0;\n\t\t\t\treturn b.h * t;\n\t\t\t} else {\n\t\t\t\treturn b.h\n\t\t\t}\n\t\t\t// if (locks == 0) {\n\t\t\t// } else {\n\t\t\t// \treturn b.h * 2\n\t\t\t// }\n\t\t})\n\t\t.style(\"fill\", function (d) {\n\t\t\tif(isLock(d.name)){\n\t\t\t\tvar lockName = getLockName(d.name)\n\t\t\t\treturn getLock(lockName).color\n\t\t\t}\n\t\t\treturn color((d.children ? d : d.parent).name);\n\t\t})\n\t\t.on(\"click\", clickNav);\n\t\n\tg.selectAll(\".ss\")\n\t.attr(\"vv\", function (d) {\n\t\tlockHeight = 0;\n\t\tcurLocks = 0;\n\t})\n\t.attr(\"tt\", function (d) {\n\t\tif (d.name.indexOf(\"lock\") == 0) {\n\t\t\tlockHeight++;\n\t\t}\n\t})\n\t.attr(\"height\", function (d) {\n\t\tif (d.name.indexOf(\"lock\") == 0) {\n\t\t\tcurLocks++;\n\t\t\tlet t = (lockHeight - curLocks + 1)\n\t\t\treturn b.h * t;\n\t\t} else {\n\t\t\treturn b.h\n\t\t}\n\t})\n\t\n\t// mskim\n\t// entering.append(\"svg:text\")\n\t// .attr(\"x\", (b.w + b.t) / 2)\n\t// .attr(\"y\", b.h / 2)\n\t// .attr(\"dy\", \"0.35em\")\n\t// .attr(\"text-anchor\", \"middle\")\n\t// .text(function(d) { return d.name; });\n\tentering.append(\"svg:text\")\n\t\t.attr(\"x\", function (d) {\n\t\t\tvar len;\n\t\t\tif(isLock(d.name)){\n\t\t\t\tvar lockName = getLockName(d.name)\n\t\t\t\tif(d.name.indexOf(\"acquire\") != -1){\n\t\t\t\t\tlockName = d.name;\n\t\t\t\t}\n\t\t\t\tlen = lockName.length;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlen = d.name.length\n\t\t\t}\n\t\t\treturn len * 6.3/2 + 5;\n\t\t})\n\t\t.attr(\"y\", 3)\n\t\t.attr(\"dy\", \"15px\")\n\t\t.attr(\"class\", \"nav_text\")\n\t\t.attr(\"text-anchor\", \"middle\")\n\t\t.text(function (d) {\n\t\t\tif(isLock(d.name)){\n\t\t\t\tvar lockName = getLockName(d.name)\n\t\t\t\tif(d.name.indexOf(\"acquire\") != -1){\n\t\t\t\t\tlockName = d.name;\n\t\t\t\t}\n\t\t\t\treturn lockName\n\t\t\t}\n\t\t\treturn d.name;\n\t\t})\n\t\t.on(\"click\", clickNav);\n\n\t// console\n\t//lock\n\tentering.append(\"svg:rect\")\n\t\t.filter(function(v){\n\t\t\treturn v.locks != undefined;\n\t\t})\n\t\t.attr(\"width\", function(d) { return d.name.length*6.3 + 10;})\n\t\t.attr(\"height\", b.h)\n\t\t.style(\"fill\", function(d){\n\t\t\tconsole.log(d)\n\t\t\treturn d.locks[0].color;\n\t\t})\n\t\t.attr(\"transform\", \"translate(0,\"+b.h+\")\")\n\t\t.append(\"text\")\n\t\t.attr(\"x\", function(d) { return d.name.length *6.3/2+5; })\n\t\t.attr(\"y\", 3 + b.h)\n\t\t.attr(\"dy\", \"15px\")\n\t\t.attr(\"class\", \"nav_text\")\n\t\t.attr(\"text-anchor\", \"middle\")\n\t\t.text(function(d) { return d.locks[0].name; })\n\t\t.attr(\"transform\", \"translate(0,\"+b.h+\")\")\n\n\n\tlet padding_left = 0;\n\tlet padding_arr = [];\n\tlet lock_height = 0;\n\tlet locks = 0;\n\t// Set position for entering and updating nodes.\n\tg.attr(\"transform\", function (d, i) {\n\t\tlet width = this.childNodes[0].getAttribute(\"width\");\n\t\tlet ret;\n\t\tif (d.name.indexOf(\"lock\") == 0) {\n\t\t\tlocks++;\n\t\t\tif (locks == 1) {\n\t\t\t\tpadding_arr.push(100);\n\t\t\t} \n\n\t\t\tif (locks > 0) {\n\t\t\t\tpadding_left = padding_arr[0]\n\t\t\t\t\n\t\t\t\tfor (let i = 1; i < padding_arr.length; i++) {\n\t\t\t\t\tpadding_left += Number(padding_arr[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// else {\n\t\t\t// \tpadding_arr.push(Number(width))\n\t\t\t// }\n\t\t\tlock_height += b.h;\n\t\t\t\n\t\t\tret = \"translate(\" + padding_left + \", \" + lock_height + \")\"\n\t\t\tpadding_arr.push(Number(width))\n\t\t} else {\n\t\t\tret = \"translate(\" + padding_left + \", \" + lock_height + \")\"\n\t\t}\n\t\tpadding_left += Number(width);\n\t\t\n\t\treturn ret;\n\t});\n\n\t// Remove exiting nodes.\n\tg.exit().remove();\n\n\n\t// Now move and update the percentage at the end.\n\t// d3.select(\"#trail\").select(\"#endlabel\")\n\t// \t.attr(\"x\", function () {\n\t// \t\treturn padding_left + 40;\n\t// \t})\n\t// \t.attr(\"y\", b.h / 2)\n\t// \t.attr(\"dy\", \"0.35em\")\n\t// \t.attr(\"text-anchor\", \"middle\")\n\t// \t.text(percentageString);\n\n\t// Make the breadcrumb trail visible, if it's hidden.\n\td3.select(\"#trail\")\n\t\t.style(\"visibility\", \"\");\n\n}", "function _updateProgressBar(oldReferenceLayer){oldReferenceLayer.querySelector(\".introjs-progress .introjs-progressbar\").style.cssText=\"width:\".concat(_getProgress.call(this),\"%;\");oldReferenceLayer.querySelector(\".introjs-progress .introjs-progressbar\").setAttribute(\"aria-valuenow\",_getProgress.call(this));}", "function progressUpdate() {\r\n loadingProgress = Math.round(progressTl.progress() * 100);\r\n $(\".txt-perc\").text(loadingProgress + '%');\r\n}", "function setProgressBar(curStep){\n var percent = parseFloat(100 / steps) * curStep;\n percent = percent.toFixed();\n $(\".progress-bar\")\n .css(\"width\",percent+\"%\")\n .html(percent+\"%\");\n }", "function UpdateBreadCrumbText(topMenuItem, curMenuItem, lastNode) {\r\n if (IsMobile()) return;\r\n\r\n if (topMenuItem !== undefined && topMenuItem != \"\") {\r\n $('#hmenu').text(topMenuItem);\r\n }\r\n\r\n if (curMenuItem !== undefined && curMenuItem != \"\") {\r\n $('#hcurritem').text(curMenuItem);\r\n\r\n var urlStr;\r\n var prevLink = document.referrer.trim();\r\n //alert(\"prev link= \" + prevLink);\r\n if (prevLink.indexOf(\"advSearch_warp_download_all\") >= 0) {\r\n urlStr = prevLink.substring(0, prevLink.indexOf(\"?\") + 1);\r\n if (curMenuItem.indexOf(\"Institutions\") >= 0) {\r\n currMenuLink = urlStr + \"intTab=1\";\r\n } else if (curMenuItem.indexOf(\"Financial\") >= 0) {\r\n currMenuLink = urlStr + \"intTab=2\";\r\n } else if (curMenuItem.indexOf(\"Branch Office\") >= 0) {\r\n currMenuLink = urlStr + \"intTab=3\";\r\n } else if (curMenuItem.indexOf(\"Aggregate Time\") >= 0) {\r\n currMenuLink = urlStr + \"intTab=4\";\r\n }\r\n }\r\n }\r\n\r\n if (lastNode !== undefined && lastNode != \"\") {\r\n $('#hhead').text(lastNode);\r\n }\r\n\r\n //Get the hidden values from the page\r\n var CurrentMenuItem = $('#hmenu').text();\r\n var CurrentMenuSelection = $('#hcurritem').text();\r\n var pageTitle = $('#hhead').text();\r\n\r\n //alert(\"hmenu/hcurritem/hhead= \" + CurrentMenuItem + \"/\" + CurrentMenuSelection + \"/\" + pageTitle);\r\n\r\n var htmlStr = '<a tabindex=\"115\" href=\"http://www.fdic.gov/index.html\">' + \"FDIC.gov\" + '</a> <span class=\"cssBreadCrumbSeparator \"> > </span>' +\r\n '<a tabindex=\"116\" href=\"http://www.fdic.gov/bank/\" >' + \"Industry Analysis\" + '</a> <span class=\"cssBreadCrumbSeparator \"> > </span>' +\r\n '<a tabindex=\"117\" href=\"http://www.fdic.gov/bank/statistical/\" >' + \"Bank Data & Statistics\" + '</a> <span class=\"cssBreadCrumbSeparator \"> > </span>' +\r\n '<span class=\"cssBreadCrumbLastNode\"> ' + CurrentMenuItem + ' </span>' + '</a> <span class=\"cssBreadCrumbSeparator \"> > </span>' +\r\n '<a tabindex=\"118\" href=\"' + currMenuLink + '\">' + CurrentMenuSelection + '</a> <span class=\"cssBreadCrumbSeparator \"> > </span>' +\r\n '<span class=\"cssBreadCrumbLastNode\"> ' + pageTitle + ' </span>';\r\n\r\n $(\"#breadCrumbPath\").html(htmlStr);\r\n\r\n} //UpdateBreadCrumbText()", "_updateProgress() {\n super._updateProgress();\n\n const that = this;\n\n //Label for Percentages\n if (that.showProgressValue) {\n const percentage = parseInt(that._percentageValue * 100);\n\n that.$.label.innerHTML = that.formatFunction ? that.formatFunction(percentage) : percentage + '%';\n }\n else {\n that.$.label.innerHTML = '';\n }\n\n if (that.value === null || that.indeterminate) {\n that.$value.addClass('jqx-value-animation');\n }\n else {\n that.$value.removeClass('jqx-value-animation');\n }\n\n that.$.value.style.transform = that.orientation === 'horizontal' ? 'scaleX(' + that._percentageValue + ')' : 'scaleY(' + that._percentageValue + ')';\n }", "updateDisplay() {\n $('#steps .value').text(this.stepCounter);\n }", "function updateProgressBar(){\n // Update the value of our progress bar accordingly.\n $('#progress-bar').val((r.getCurrentTime() / r.getDuration()) * 100);\n}", "animatePercent () {\n if (!this.story) { return; }\n this.loaderPercent.innerHTML = this.story.percent + '%';\n requestAnimationFrame(this.animatePercent.bind(this));\n }", "#updatePercentage() {\n //1. calculate the percentage\n model.calculatePercentages();\n //2. Read the percentage from th budget controller\n var percentage = model.getPercentages();\n //3. display the percentage to the UI\n addItemsView.displayPercentage(percentage);\n }", "function updateProgressBar(){\n // Update the value of our progress bar accordingly.\n $('#progress-bar').val((player.getCurrentTime() / player.getDuration()) * 100);\n }", "function setProgressBar(curStep){\n var percent = parseFloat(100 / steps) * curStep;\n percent = percent.toFixed();\n $(\".progress-bar-1\")\n .css(\"width\",percent+\"%\")\n .html(percent+\"%\"); \n }", "componentDidUpdate(){\n if(this.state.trail !== this.props.trail){\n this.setState({\n trail: this.props.trail,\n progress: 0\n })\n }\n }", "function _getProgress(){// Steps are 0 indexed\nvar currentStep=parseInt(this._currentStep+1,10);return currentStep/this._introItems.length*100;}", "function update(e){\n var section = e.currentSlide.dataset.section;\n document.getElementById('breadcrumbs').innerHTML = (section) ? '<span>'+section+'</span>' : '';\n }", "function setProgressBar(curStep){\n var percent = parseFloat(50 / steps) * curStep;\n percent = percent.toFixed();\n $(\".barrapedido1\")\n .css(\"width\",percent+\"%\")\n .html(percent+\"%\"); \n }", "fromIndextoPercentage() {\n this.setState(state => ({\n percentage: ((state.currentVerbIdx + 1) / VERBS_ORDERED.length) * 100\n }));\n }", "_progress() {\n\tconst currentProgress = this.state.current * ( 100 / this.state.questionsCount );\n this.progress.style.width = currentProgress + '%';\n\n\t// update the progressbar's aria-valuenow attribute\n this.progress.setAttribute('aria-valuenow', currentProgress);\n }", "function updateExpPercentage(){\n let percentages = budget.getPercentages();\n ui.displayPercentage(percentages);\n }", "function setProgress(currstep) {\n var percent = parseFloat(100 / widget.length) * currstep;\n percent = percent.toFixed();\n $(\".progress-bar\").css(\"width\", percent + \"%\").html(percent + \"%\");\n }", "function progress(step, nbSteps, stepLabel) {\n var percent = (step/(nbSteps+1))*100;\n $(\"#progress .progress-bar\").attr('aria-valuenow', step).attr('aria-valuemax', nbSteps+1).attr('style','width:'+percent.toFixed(2)+'%').find(\"span\").html(step + \"/\" + nbSteps);\n $(\"#progressStep\").html(stepLabel);\n}", "function updateProgressMeter(pageNumber) {\n var numGoals = $('.goal-rank').length,\n percentIncr = 100;\n if (numGoals) {\n percentIncr = 100 * (1 / $('.goal-rank').length); \n }\n var newPercent = percentIncr * (pageNumber + 1);\n $('.progress-percent').text(newPercent);\n $('#onboarding-meter .meter').width(newPercent + \"%\");\n }", "updateProgress() {\n this._Onprogress(this.state.CSVProgress * 100);\n }", "function updateProgress(){\n $(\".line\").val( Player.audioObj.currentTime / Player.audioObj.duration );\n }", "function setBreadcrumbColor(elem) {\n\n // Create array of all 'a' elements\n var aList = document.getElementsByTagName('a');\n \n //Loop through all 'a' elements to remove active class on non-clicked breadcrumbs\n //This is necessary for coloring of breadcrumb (li and :after/before pseudo elements)\n //Note: I am not using jQuery given parameters of the challenge, but it would probably make selectors easier\n for (i = 0; i < aList.length; i++) {\n // Remove the class 'active' if it exists\n aList[i].closest('li').classList.remove('active');\n aList[i].closest('li').childNodes[1].classList.remove('active')\n }\n\n //Add 'active' and 'visitedAlready' classses to the element that was clicked to add color\n //Now that the breadcrumb was visited, a new color remains (shows progress)\n elem.classList.add('active', 'visitedAlready');\n elem.childNodes[1].classList.add('active', 'visitedAlready');\n\n //Checking analytics\n clickCounter.increment();\n console.log(\"Counter is now: \", clickCounter.value);\n}", "function updateProgress() {\n let progressLabel = ui.Label({\n value: 'Scanning image collections ' + processedCount + ' of ' + collectionCount,\n style: {fontWeight: 'bold', fontSize: '12px', margin: '10px 5px'}\n });\n\n progressPanel.clear();\n progressPanel.add(progressLabel)\n }", "function updateProgressTooltip()\n {\n my.html.progress.title =\n 'This lesson contains ' + my.current.subunitText.length +\n ' characters.'\n }", "function updateProgress() {\n var progress = 0,\n currentValue = $scope.curVal,\n maxValue = $scope.maxVal,\n // recompute overall progress bar width inside the handler to adapt to viewport changes\n progressBarWidth = progressBarBkgdElement.prop('clientWidth');\n\n if ($scope.maxVal) {\n // determine the current progress marker's width in pixels\n progress = Math.min(currentValue, maxValue) / maxValue * progressBarWidth;\n }\n\n // set the marker's width\n progressBarMarkerElement.css('width', progress + 'px');\n }", "function updatePageData(){\n // Update current step number\n $(\".kf-current-step\").each(function(index) {\n $(this).text(currentStep);\n });\n }", "function updateProgressBar() {\n let progressBar = document.getElementById(\"progress\");\n let percent = bodyArray.length * 2;\n let percentFullDisplay = document.getElementById(\"percent-full-value-display\");\n progressBar.style.width = percent + \"%\";\n percentFullDisplay.innerText = percent + \"%\";\n\n }", "update() {\n this.getProgression();\n }", "function setBreadcrumb(breadcrumb) {\n $(\"#breadcrumbs\").html(\"<p><a href='dashboard.php'><i class='fas fa-home'></i></a> / \" + breadcrumb + \"</p>\");\n}", "updateLoadingBar() {\n if (this.loadingRemains !== G.resource.remains) {\n this.loadingBar.text = `${G.resource.remains} resource(s) to load...\\nReceived file '${G.resource.currentLoad}'.`;\n }\n }", "function updateProgress (){\n\tprogress.value += 30;\n}", "function percentage() {\n if (this.currentInput.indexOf(\"%\") == -1) {\n this.currentInput = this.currentInput * 100;\n this.currentInput = this.currentInput.toString() + \"%\";\n }\n this.displayCurrentInput();\n}", "function updateTitle(currentChapter) {\n var title = 'Breaking faith';\n if (currentChapter == 0) {\n title = 'Breaking faith';\n } else {\n title = 'Chapter ' + currentChapter ;\n }\n $(\".title\").html(title);\n }", "function updateProgress() {\r\n const duration = audio.duration;\r\n const currTime = audio.currentTime;\r\n const percentage = (currTime * 100) / duration;\r\n progress.style.width = `${percentage}%`;\r\n}", "function updateProgressBarLoadingCore() {\n var loading = 0, loaded = 0;\n loading += view.getModel().getResourceManager().getLoadingCount();\n loaded += view.getModel().getResourceManager().getLoadedCount();\n // Progress %\n status.setProgress(Math.floor(100 * (loaded || 0) / ((loading || 0) + (loaded || 1))) / 100);\n }", "function updateProgressBar(progress) {\n\n if (!progress) {\n progress = 0;\n }\n\n // get progress bar\n var progress_div = document.getElementById(\"training-progress\");\n\n if (!progress_div) {\n console.warn(\"Missing progress-bar element!\");\n return;\n }\n\n // update progress bar status\n var progress_str = String(progress) + \"%\";\n progress_div.style.width = progress_str;\n //progress_div.setAttribute(\"aria-valuenow\", String(progress));\n progress_div.innerHTML = progress_str;\n\n if (progress >= 100) {\n progress_div.classList.add(\"progress-bar-success\");\n progress_div.classList.add(\"progress-bar-striped\");\n }\n else {\n progress_div.setAttribute(\"class\", \"progress-bar\");\n }\n}", "setBreadcrumbTitle({ state, commit }, breadcrumbTitle) {\n const parts = vm.$router.currentRoute.path.split('/').slice(1)\n const breadcrumbs = state.breadcrumbs\n for (const [index] of parts.entries()) {\n let subPath = ''\n for (let i = 0; i <= index; i++) {\n subPath += '/' + parts[i]\n }\n if (subPath === vm.$router.currentRoute.path) {\n breadcrumbs[index].title = breadcrumbTitle\n commit('SET_BREADCRUMBS', breadcrumbs)\n return\n }\n }\n }", "updateProgress() {\n const { inputLength, outputLength } = this.state.data;\n const progress = this.querySelector('.progress');\n progress.innerText = `${outputLength} out of ${inputLength} sequences processed`;\n }", "function updateProgressBar(el, currentValue, finalValue) {\n\tlet progressPercentage = currentValue / finalValue;\n\tlet parentWidth = el.parentElement.offsetWidth;\n\tif (progressPercentage <= 1) {\n\t\tlet progressWidth = progressPercentage * parentWidth;\n\t\tel.style.width = `${progressWidth}px`;\n\t\tif (progressPercentage < 0.35) el.style.background = \"var(--red)\";\n\t\telse if (progressPercentage > 0.35 && progressPercentage < 0.75) el.style.background = \"var(--yellow)\";\n\t\telse el.style.background = \"var(--green)\";\n\t}\n\tif (progressPercentage == 1) {\n\t\tif (!isPowerUpActive && !core.destroyed) {\n\t\t\tprogressPercentage = 0;\n\t\t\tpowerupContainer.classList.remove(\"hide\");\n\t\t\tpowerupProgressbarContainer.classList.add(\"hide\");\n\t\t\tpowerupProgressInfoEl.classList.add(\"hide\");\n\t\t}\n\t}\n}", "function updateBreadcrumbs(nodeArray) {\r\n\r\n // Data join; key function combines name and depth (= position in sequence).\r\n var g = d3.select(el).select(\"#\" + el.id + \"-trail\")\r\n .selectAll(\"g\")\r\n .data(nodeArray, function(d) { return d.name + d.depth; });\r\n\r\n // Add breadcrumb and label for entering nodes.\r\n var entering = g.enter().append(\"g\");\r\n\r\n\r\n if (b.w <= 0) {\r\n // Create a node array that contains all the breadcrumb widths\r\n // Calculate positions of breadcrumbs based on string lengths\r\n var curr_breadcrumb_x = 0;\r\n nodeArray[0].breadcrumb_x = 0;\r\n nodeArray[0].breadcrumb_h = 0;\r\n\r\n entering.append(\"polygon\")\r\n .style(\"z-index\",function(d,i) { return(999-i); })\r\n .style(\"fill\", function(d) { return colors(d.label); });\r\n\r\n entering.append(\"text\")\r\n .attr(\"x\", b.t + 2)\r\n .attr(\"y\", b.h / 2)\r\n .attr(\"dy\", \"0.35em\")\r\n .attr(\"text-anchor\", \"left\")\r\n .text(function(d) { return d.name; });\r\n\r\n // Remove exiting nodes.\r\n g.exit().remove();\r\n\r\n // loop through each g element\r\n // calculate string length\r\n // draw the breadcrumb polygon\r\n // and determine if breadcrumb should be wrapped to next row\r\n g.each(function(d,k){\r\n var crumbg = d3.select(this);\r\n var my_string_length = crumbg.select(\"text\").node().getBoundingClientRect().width;\r\n nodeArray[k].string_length = my_string_length + 12;\r\n crumbg.select(\"polygon\").attr(\"points\", function(d){\r\n return breadcrumbPoints(d, k);\r\n });\r\n var my_g_length = crumbg.node().getBoundingClientRect().width;\r\n curr_breadcrumb_x += k===0 ? 0 : nodeArray[k-1].string_length + b.s;\r\n nodeArray[k].breadcrumb_h = k===0 ? 0 : nodeArray[k-1].breadcrumb_h;\r\n\r\n if (curr_breadcrumb_x + my_g_length > width*0.99) {\r\n nodeArray[k].breadcrumb_h += b.h; // got to next line\r\n curr_breadcrumb_x = b.t + b.s; // restart counter\r\n }\r\n nodeArray[k].breadcrumb_x = curr_breadcrumb_x;\r\n });\r\n\r\n\r\n // Set position for entering and updating nodes.\r\n g.attr(\"transform\", function(d, i) {\r\n return \"translate(\" + d.breadcrumb_x + \", \"+d.breadcrumb_h+\")\";\r\n });\r\n\r\n\r\n\r\n\r\n } else {\r\n entering.append(\"polygon\")\r\n .attr(\"points\", breadcrumbPoints)\r\n .style(\"fill\", function(d) { return colors(d.label); });\r\n\r\n entering.append(\"text\")\r\n .attr(\"x\", (b.w + b.t) / 2)\r\n .attr(\"y\", b.h / 2)\r\n .attr(\"dy\", \"0.35em\")\r\n .attr(\"text-anchor\", \"middle\")\r\n .text(function(d) { return d.name; });\r\n\r\n // Set position for entering and updating nodes.\r\n g.attr(\"transform\", function(d, i) {\r\n return \"translate(\" + i * (b.w + b.s) + \", 0)\";\r\n });\r\n\r\n // Remove exiting nodes.\r\n g.exit().remove();\r\n\r\n\r\n }\r\n\r\n // Make the breadcrumb trail visible, if it's hidden.\r\n d3.select(el).select(\"#\" + el.id + \"-trail\")\r\n .style(\"visibility\", \"\");\r\n\r\n }", "function updateBreadcrumbs(nodeArray, p) {\n\n // Data join; key function combines name and depth (= position in sequence).\n var trail = d3.select(\"#trail\")\n .selectAll(\"g\")\n .data(nodeArray, function(d) { return d.data.name + p.depth; });\n\n // Remove exiting nodes.\n trail.exit().remove();\n\n // Add breadcrumb and label for entering nodes.\n var entering = trail.enter().append(\"svg:g\");\n\n entering.append(\"svg:polygon\")\n .attr(\"points\", breadcrumbPoints)\n .style(\"fill\", function(d) { \n if (d.depth == 1)\n return colors[d.data.name];\n else if (d.depth == 2) {\n d = d.parent;\n return colors[d.data.name];\n }\n else {\n d = d.parent;\n d = d.parent;\n return colors[d.data.name];\n }\n });\n\n entering.append(\"svg:text\")\n .attr(\"x\", (b.w + b.t) / 2)\n .attr(\"y\", b.h / 2)\n .attr(\"dy\", \"0.35em\")\n .style(\"fill\", \"black\")\n .attr(\"text-anchor\", \"middle\")\n .text(function(d) { return d.data.name; });\n\n // Merge enter and update selections; set position for all nodes.\n entering.merge(trail).attr(\"transform\", function(d, i) {\n return \"translate(\" + i * (b.w + b.s) + \", 0)\";\n });\n\n // Make the breadcrumb trail visible, if it's hidden.\n d3.select(\"#trail\")\n .style(\"visibility\", \"\");\n\n }", "function progressBarCarousel() {\n bar.css({ width: percent + \"%\" });\n percent = percent + 0.5;\n if (percent >= 100) {\n percent = 0;\n crsl.carousel(\"next\");\n }\n }", "function onProgress(currentTime) {\n let currentTimeF = parseFloat(currentTime),\n objEndSub = $('#end_sub').attr(\"data-end-sub\").split(','),\n valCurEndSub = parseFloat($('#end_sub span').text()),\n l = objEndSub.length;\n\n if (currentTimeF >= valCurEndSub) {\n for (let i = 0; i < l; i++) {\n let val = parseFloat(objEndSub[i]);\n\n if (i + 1 == l) {\n break;\n }\n\n if (val === valCurEndSub) {\n $('#end_sub span').text(objEndSub[i + 1]);\n goToPage(i + 1);\n }\n }\n }\n}", "function updateProgress() {\n $(\"#progressBar\").css(\"width\", _progress + \"%\");\n }", "function updateProgress() {\n elements.progressBar.style.width = `${\n (elements.video.currentTime / elements.video.duration) * 100\n }%`;\n elements.currentTime.textContent = `${displayTime(\n elements.video.currentTime\n )} / `;\n elements.durationTime.textContent = `${displayTime(elements.video.duration)}`;\n}", "function update_status(current, total)\n {\n DOM.on_hold_progress_indicator.style.width = `${Math.round(100 * current / total)}%`;\n DOM.on_hold_status_message.textContent = `${current} / ${total}`;\n }", "function update()\n\t\t{\n\t\tdocument.getElementById('flows').innerText=\"paths: \" + stackcount + \"/\" + maxpath;\n\t\tdocument.getElementById('currentstack').innerText=\"moves: \" + (stackarray.length-1);\n\t}", "function updateprogress() {\n\tvar actvdot = $('.stepdot.active');\n\tactvdot.addClass('done').removeClass('active').next().next().addClass('active');\n}", "function progressBarCarousel() {\n $bar.css({width:percent+'%'});\n percent = percent +0.5;\n if (percent>=100) {\n percent=0;\n $crsl.carousel('next');\n }\n }", "function progressBarCarousel() {\n\t\t$bar.css({width:percent+'%'});\n\t\tpercent = percent +0.5;\n\t\tif (percent>=100) {\n\t\t\tpercent=0;\n\t\t\t$crsl.carousel('next');\n\t\t}\n\t}", "function progressBarCarousel() {\n\t\t$bar.css({width:percent+'%'});\n\t\tpercent = percent +0.5;\n\t\tif (percent>=100) {\n\t\t\tpercent=0;\n\t\t\t$crsl.carousel('next');\n\t\t}\n\t}", "function updateProgress(newProgress) {\n progressRef.current = newProgress;\n setRgbProgress(newProgress);\n }", "_updateRouteProgress(){\n let time = this.store.getters.time.getTimePassed(this._lastUpdate);\n this._lastUpdate += time;\n this._updateRouteProgressHelper(this.route.route,time);\n }", "function updateProgress() {\n progress(audio.currentTime/audio.duration);\n}", "updateProgressBar() {\n let revealRange = 103 - 24; //See css comment (progressBox). \n let revealPercent = this.points / this.pointsNeeded; //Current percent of points needed.\n this.baseProgressMargin = -24; //Margin value: Progress box hides bar.\n this.progressMargin = this.baseProgressMargin - revealPercent * revealRange; //New margin value\n document.getElementById(\"progress\").style.marginTop = this.progressMargin + \"vh\"; //Reveal percent of glowing border as level progress indicator.\n }", "function handleProgressUpdate() {\n const { body } = document;\n const html = document.documentElement;\n const docHeight = Math.max(\n body.scrollHeight,\n body.offsetHeight,\n html.clientHeight,\n html.scrollHeight,\n html.offsetHeight\n );\n const viewportHeight = document.documentElement.clientHeight;\n const scrollableHeight = docHeight - viewportHeight;\n const scrolledHeight = window.scrollY;\n setProgressValue(scrolledHeight / scrollableHeight);\n }", "updatePagination() {\n\t\tlet next_page = this.current_page+1;\n\t\tlet next_next_page = next_page+1;\n\t\tgetComponentElementById(this,\"PaginationCurrentItem\").html('<span class=\"page-link\">'+this.current_page+'</span>');\n\t\tgetComponentElementById(this,\"PaginationNextItem\").html('<span class=\"page-link\">'+next_page+'</span>');\n\t\tgetComponentElementById(this,\"PaginationNextNextItem\").html('<span class=\"page-link\">'+next_next_page+'</span>');\n\t\tgetComponentElementById(this,\"ResultCountWrapper\").html('<span class=\"badge float-right\">Total: '+this.total_items+'</span>');\n\t}", "function setProgressBar() {\n monthlyProgress = daysMetGoal/daysInMonth;\n monthlyProgress = Math.round(monthlyProgress * 100, 0);\n var barLength = 1;\n if(statIndex == 1){\n if(monthlyProgress > 0){\n\t\tbarLength = monthlyProgress * .9; //divide by 9/10 since the progress bar is only 90 pixels wide\n\t}\n \tstatDisplay.setCursor(90, 55);\n\tstatDisplay.writeString(font, 1, '| ' + monthlyProgress + '%', 1, true);\n }\n else if (statIndex == 0){\n\tif(progress > 0) {\n\t\tbarLength = progress * .9;\n\t}\n\tstatDisplay.setCursor(90, 55);\n \tstatDisplay.writeString(font, 1, '| ' + progress + '%', 1, true);\n }\n barLength = Math.round(barLength);\n if(barLength > 90){ //if over 90 pixels, max out at 90 to prevent overwriting pixels\n barLength = 90;\n }\n statDisplay.setCursor(1,1);\n statDisplay.drawLine(1, 55, barLength, 55, 1);\n statDisplay.drawLine(1, 56, barLength, 56, 1);\n statDisplay.drawLine(1, 57, barLength, 57, 1);\n statDisplay.drawLine(1, 58, barLength, 58, 1);\n statDisplay.drawLine(1, 59, barLength, 59, 1);\n statDisplay.drawLine(1, 60, barLength, 60, 1);\n statDisplay.drawLine(1, 61, barLength, 61, 1);\n}", "function percentage()\n {\n current_input = current_input / 100\n displayCurrentInput();\n }", "function update() {\n\t$fraction.text(iQ + '/10');\n\t$percent.text(percentCorrect + '%');\n\n}", "function _getProgress() {\n // Steps are 0 indexed\n var currentStep = parseInt((this._currentStep + 1), 10);\n return ((currentStep / this._introItems.length) * 100);\n }", "function _getProgress() {\n // Steps are 0 indexed\n var currentStep = parseInt((this._currentStep + 1), 10);\n return ((currentStep / this._introItems.length) * 100);\n }", "function _getProgress() {\n // Steps are 0 indexed\n var currentStep = parseInt((this._currentStep + 1), 10);\n return ((currentStep / this._introItems.length) * 100);\n }", "function _getProgress() {\n // Steps are 0 indexed\n var currentStep = parseInt((this._currentStep + 1), 10);\n return ((currentStep / this._introItems.length) * 100);\n }", "updateProgress() {\n this.progressBar.style.width = `${(video.currentTime / video.duration) * 100}%`;\n this.currentTime.textContent = `${this._displayTime(video.currentTime)} /`;\n this.duration.textContent = `${this._displayTime(video.duration)}`;\n }", "function setCurrentProgressTab($rootwizard, $nav, $tab, $progress, index)\n{\n $tab.prevAll().addClass('completed');\n $tab.nextAll().removeClass('completed');\n \n var items = $nav.children().length,\n pct = parseInt((index+1) / items * 100, 10),\n $first_tab = $nav.find('li:first-child'),\n margin = (1/(items*2) * 100) + '%';//$first_tab.find('span').position().left + 'px';\n \n if( $first_tab.hasClass('active'))\n {\n $progress.width(0);\n }\n else\n {\n $progress.width( ((index-1) /(items-1)) * 100 + '%' ); //$progress.width( $tab.prev().position().left - $tab.find('span').width()/2 );\n }\n \n \n $progress.parent().css({\n marginLeft: margin,\n marginRight: margin\n });\n \n /*var m = $first_tab.find('span').position().left - $first_tab.find('span').width() / 2;\n \n $rootwizard.find('.tab-content').css({\n marginLeft: m,\n marginRight: m\n });*/\n}", "function updateProgressBar(e) {\n const duration = Audio.duration;\n const currenTime = audio.currenTime;\n const progressPercent = (currenTime / duration)*100;\n progress.style.width =`${progressPercent}%`\n console.log(duration)\n console.log(progressPercent)\n}", "function setLoaderProgressTo(value)\n{\n const fill = unityInstance.progress.getElementsByClassName(\"fill\")[0];\n const fillText = unityInstance.progress.getElementsByClassName(\"label\")[0];\n\n fill.animate(\n [\n { width: (value * 100) + \"%\" }\n ],\n {\n duration: 300,\n fill: \"forwards\"\n }\n );\n\n fillText.textContent = (value * 100).toFixed() + \"%\";\n}", "updateProgress() {\n var state = this.state;\n\n state.runningTime += state.deltaT;\n\n if (this.duration) {\n state.progress = Math.max(0, Math.min(1, state.runningTime / this.duration));\n }\n }", "function _getProgress() {\n\t // Steps are 0 indexed\n\t var currentStep = parseInt((this._currentStep + 1), 10);\n\t return ((currentStep / this._introItems.length) * 100);\n\t }", "function updateLoading() {\n //messageField.text = \"Loading \" + (preload.progress*100|0) + \"%\"\n console.log(\"Loading \" + (preload.progress * 100 | 0) + \"%\");\n stage.update();\n }", "function updateReport() {\n $(\"#currentTotal\").text(Math.floor(data.totalCurrent));\n $(\"#cps\").text((data.totalCPS).toFixed(1));\n}", "function updateProgress(progressAsPercentage) {\n bodyEl.querySelector(\n \".c8a11y-progress\"\n ).style.width = `${progressAsPercentage}%`;\n }", "function updateProgress(){\n $('.progress-bar').append('<li class=\"single-bar glow\"></li>');\n}" ]
[ "0.69616073", "0.67518896", "0.6415356", "0.6398336", "0.6335161", "0.63248163", "0.6314927", "0.62914693", "0.626593", "0.621405", "0.61563665", "0.61421585", "0.61376923", "0.6094739", "0.60195625", "0.5940964", "0.59382075", "0.5873695", "0.586862", "0.5821706", "0.5799344", "0.5798934", "0.57935774", "0.5774059", "0.57581216", "0.570864", "0.56404865", "0.56404126", "0.56275946", "0.56248444", "0.56126994", "0.5607978", "0.5591599", "0.55894566", "0.5584569", "0.55794716", "0.5557146", "0.5550208", "0.5527778", "0.55072564", "0.5500923", "0.54783446", "0.54743695", "0.5465842", "0.5456337", "0.54354507", "0.5419237", "0.541041", "0.5409771", "0.5403883", "0.5400337", "0.53839487", "0.5383602", "0.53430027", "0.53429973", "0.53359854", "0.5333144", "0.53143734", "0.53061", "0.5305483", "0.5300961", "0.5299435", "0.5298511", "0.5292818", "0.52815044", "0.52761465", "0.5271929", "0.52616096", "0.5260346", "0.52376634", "0.52224153", "0.5219496", "0.5217697", "0.52102727", "0.51998454", "0.5196466", "0.5196466", "0.51956654", "0.5188721", "0.5182391", "0.51702976", "0.5164117", "0.5158014", "0.5153857", "0.51511973", "0.51507854", "0.5147561", "0.5147561", "0.5147561", "0.5147561", "0.5145248", "0.51445127", "0.51241887", "0.5123635", "0.51206726", "0.5119964", "0.5102256", "0.5098709", "0.5097634", "0.5090516" ]
0.6269476
8
Take a 2column CSV and transform it into a hierarchical structure suitable for a partition layout. The first column is a sequence of step names, from root to leaf, separated by hyphens. The second column is a count of how often that sequence occurred.
function buildHierarchy(csv) { var root = {"name": "root", "children": []}; for (var i = 0; i < csv.length; i++) { var sequence = csv[i][0]; var size = +csv[i][1]; if (isNaN(size)) { // e.g. if this is a header row continue; } var parts = sequence.split("-"); var currentNode = root; for (var j = 0; j < parts.length; j++) { var children = currentNode["children"]; var nodeName = parts[j]; var childNode; if (j + 1 < parts.length) { // Not yet at the end of the sequence; move down the tree. var foundChild = false; for (var k = 0; k < children.length; k++) { if (children[k]["name"] == nodeName) { childNode = children[k]; foundChild = true; break; } } // If we don't already have a child node for this branch, create it. if (!foundChild) { childNode = {"name": nodeName, "children": []}; children.push(childNode); } currentNode = childNode; } else { // Reached the end of the sequence; create a leaf node. childNode = {"name": nodeName, "size": size}; children.push(childNode); } } } return root; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildHierarchy(csv) {\n var root = {\"name\": \"root\", \"children\": []};\n var count = 0;\n for (var i = 0; i < csv.length; i++) {\n try {\n var sequence = csv[i][0];\n var size = +csv[i][1];\n if (isNaN(size)) { // e.g. if this is a header row\n continue;\n }\n var parts = sequence.split(\"-\");\n var currentNode = root;\n for (var j = 0; j < parts.length; j++) {\n var children = currentNode[\"children\"];\n var nodeName = parts[j];\n var childNode;\n if (j + 1 < parts.length) {\n // Not yet at the end of the sequence; move down the tree.\n var foundChild = false;\n for (var k = 0; k < children.length; k++) {\n if (children[k][\"name\"] == nodeName) {\n childNode = children[k];\n foundChild = true;\n break;\n }\n }\n // If we don't already have a child node for this branch, create it.\n if (!foundChild) {\n childNode = {\"name\": nodeName, \"children\": []};\n children.push(childNode);\n }\n currentNode = childNode;\n } else {\n // Reached the end of the sequence; create a leaf node.\n childNode = {\"name\": nodeName, \"size\": size};\n children.push(childNode);\n }\n }\n count += size;\n } catch(e) {}\n }\n console.log(count)\n return root;\n }", "function buildHierarchy(csv) {\n root = {\"name\": \"root\", \"children\": []};\n for (var i = 0; i < csv.length; i++) {\n var sequence = csv[i]['x0'];\n var size = +csv[i]['x1'];\n var delete_ = csv[i]['delete'];\n var other_ = csv[i]['other'];\n var keep_ = csv[i]['keep'];\n if (isNaN(size)) { // e.g. if this is a header row\n continue;\n }\n var parts = sequence.split(\"@\");\n var currentNode = root;\n for (var j = 0; j < parts.length; j++) {\n var children = currentNode[\"children\"];\n var nodeName = parts[j];\n var childNode;\n if (j + 1 < parts.length) {\n // Not yet at the end of the sequence; move down the tree.\n \tvar foundChild = false;\n \tfor (var k = 0; k < children.length; k++) {\n \t if (children[k][\"name\"] == nodeName) {\n \t childNode = children[k];\n \t foundChild = true;\n \t break;\n \t }\n \t}\n // If we don't already have a child node for this branch, create it.\n \tif (!foundChild) {\n \t childNode = {\"name\": nodeName, \"children\": []};\n \t children.push(childNode);\n \t}\n \tcurrentNode = childNode;\n } else {\n \t// Reached the end of the sequence; create a leaf node.\n \t childNode = {\"name\": nodeName, \"size\": size, \"title\": title, \"delete_\": delete_, \"other_\": other_, \"keep_\": keep_ };\n \t children.push(childNode);\n }\n }\n }\n return root;\n}", "function buildHierarchy(csv) {\n var root = {\"name\": \"root\", \"children\": []};\n for (var i = 0; i < csv.length; i++) {\n var sequence = csv[i][0];\n var size = +csv[i][1];\n if (isNaN(size)) { // e.g. if this is a header row\n continue;\n }\n var parts = sequence.split(\"-\");\n var currentNode = root;\n for (var j = 0; j < parts.length; j++) {\n var children = currentNode[\"children\"];\n var nodeName = parts[j];\n var childNode;\n if (j + 1 < parts.length) {\n // Not yet at the end of the sequence; move down the tree.\n \tvar foundChild = false;\n \tfor (var k = 0; k < children.length; k++) {\n \t if (children[k][\"name\"] == nodeName) {\n \t childNode = children[k];\n \t foundChild = true;\n \t break;\n \t }\n \t}\n // If we don't already have a child node for this branch, create it.\n \tif (!foundChild) {\n \t childNode = {\"name\": nodeName, \"children\": []};\n \t children.push(childNode);\n \t}\n \tcurrentNode = childNode;\n } else {\n \t// Reached the end of the sequence; create a leaf node.\n \tchildNode = {\"name\": nodeName, \"size\": size};\n \tchildren.push(childNode);\n }\n }\n }\n return root;\n }", "function buildHierarchy(csv) {\n var root = {\"name\": \"root|R0\", \"children\": []};\n for (var i = 0; i < csv.length; i++) {\n var sequence = csv[i].split(\",\")[0];\n var size = +csv[i].split(\",\")[1];\n if (isNaN(size)) { // e.g. if this is a header row\n continue;\n }\n var parts = sequence.split(\"/\");\n var currentNode = root;\n for (var j = 0; j < parts.length; j++) { \n var children = currentNode[\"children\"];\n var nodeName = parts[j];\n var childNode;\n if (j + 1 < parts.length) {\n // Not yet at the end of the sequence; move down the tree.\n var foundChild = false;\n for (var k = 0; k < children.length; k++) {\n if (children[k][\"name\"] == nodeName) {\n childNode = children[k];\n foundChild = true;\n break;\n }\n }\n // If we don't already have a child node for this branch, create it.\n if (!foundChild) {\n childNode = {\"name\": nodeName, \"children\": []};\n children.push(childNode);\n }\n currentNode = childNode;\n } else {\n // Reached the end of the sequence; create a leaf node.\n childNode = {\"name\": nodeName, \"size\": size};\n children.push(childNode);\n }\n }\n }\n return JSON.stringify(root);\n}", "function buildHierarchy(csv) {\n\tvar root = {\n\t\t\"name\": \"root\",\n\t\t\"children\": []\n\t};\n\tfor (var i = 0; i < csv.length; i++) {\n\t\tvar sequence = csv[i][0];\n\t\tvar size = +csv[i][1];\n\t\tif (isNaN(size)) { // e.g. if this is a header row\n\t\t\tcontinue;\n\t\t}\n\t\tvar parts = sequence.split(\"-\");\n\t\tvar currentNode = root;\n\t\tfor (var j = 0; j < parts.length; j++) {\n\t\t\tvar children = currentNode[\"children\"];\n\t\t\tvar nodeName = parts[j];\n\t\t\tvar childNode;\n\t\t\tif (j + 1 < parts.length) {\n\t\t\t\t// Not yet at the end of the sequence; move down the tree.\n\t\t\t\tvar foundChild = false;\n\t\t\t\tfor (var k = 0; k < children.length; k++) {\n\t\t\t\t\tif (children[k][\"name\"] == nodeName) {\n\t\t\t\t\t\tchildNode = children[k];\n\t\t\t\t\t\tfoundChild = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If we don't already have a child node for this branch, create it.\n\t\t\t\tif (!foundChild) {\n\t\t\t\t\tchildNode = {\n\t\t\t\t\t\t\"name\": nodeName,\n\t\t\t\t\t\t\"children\": []\n\t\t\t\t\t};\n\t\t\t\t\tchildren.push(childNode);\n\t\t\t\t}\n\t\t\t\tcurrentNode = childNode;\n\t\t\t} else {\n\t\t\t\t// Reached the end of the sequence; create a leaf node.\n\t\t\t\tchildNode = {\n\t\t\t\t\t\"name\": nodeName,\n\t\t\t\t\t\"size\": size\n\t\t\t\t};\n\t\t\t\tchildren.push(childNode);\n\t\t\t}\n\t\t}\n\t}\n\treturn root;\n}", "function buildHierarchy(csv) {\r\n var root = {\"name\": \"root\", \"children\": []};\r\n for (var i = 0; i < csv.length; i++) {\r\n var sequence = csv[i][0];\r\n var size = +csv[i][1];\r\n if (isNaN(size)) { // e.g. if this is a header row\r\n continue;\r\n }\r\n var parts = sequence.split(\"-\");\r\n var currentNode = root;\r\n for (var j = 0; j < parts.length; j++) {\r\n var children = currentNode[\"children\"];\r\n var nodeName = parts[j];\r\n var childNode;\r\n if (j + 1 < parts.length) {\r\n // Not yet at the end of the sequence; move down the tree.\r\n \tvar foundChild = false;\r\n \tfor (var k = 0; k < children.length; k++) {\r\n \t if (children[k][\"name\"] == nodeName) {\r\n \t childNode = children[k];\r\n \t foundChild = true;\r\n \t break;\r\n \t }\r\n \t}\r\n // If we don't already have a child node for this branch, create it.\r\n \tif (!foundChild) {\r\n \t childNode = {\"name\": nodeName, \"children\": []};\r\n \t children.push(childNode);\r\n \t}\r\n \tcurrentNode = childNode;\r\n } else {\r\n \t// Reached the end of the sequence; create a leaf node.\r\n \tchildNode = {\"name\": nodeName, \"size\": size};\r\n \tchildren.push(childNode);\r\n }\r\n }\r\n }\r\n return root;\r\n\r\n }", "function buildHierarchy(csv) {\n var root = {\"name\": \"root\", \"children\": []};\n for (var i = 0; i < csv.length; i++) {\n var size = +csv[i].precio_total;\n if (isNaN(size)) { // e.g. if this is a header row\n continue;\n }\n var parts = [];\n \n parts.push(csv[i][\"tipo\"]);\n \n parts.push(csv[i][\"subtipo\"]);\n parts.push(csv[i][\"razon_social\"]);\n parts.push(csv[i][\"descripcion\"]);\n if (!csv[i][\"tipo\"]){ console.log('no hay', i)};\n if (!csv[i][\"subtipo\"]){ console.log('no hay', i)};\n if (!csv[i][\"razon_social\"]){ console.log('no hay', i)};\n if (!csv[i][\"descripcion\"]){ console.log('no hay', i)};\n\n\n\n\n var currentNode = root;\n for (var j = 0; j < parts.length; j++) {\n var children = currentNode[\"children\"];\n var nodeName = parts[j];\n var childNode;\n if (j + 1 < parts.length) {\n // Not yet at the end of the sequence; move down the tree.\n var foundChild = false;\n for (var k = 0; k < children.length; k++) {\n if (children[k][\"name\"] == nodeName) {\n childNode = children[k];\n foundChild = true;\n break;\n }\n }\n // If we don't already have a child node for this branch, create it.\n if (!foundChild) {\n childNode = {\"name\": nodeName, \"children\": []};\n children.push(childNode);\n }\n currentNode = childNode;\n } else {\n // Reached the end of the sequence; create a leaf node.\n childNode = {\"name\": nodeName, \"size\": size};\n children.push(childNode);\n }\n }\n }\n return root;\n}", "function buildHierarchy(csv) {\n\t\t\t\tvar root = { \"name\": levels[0], \"children\": [], \"colorkey\":-0.2 };\n\t\t\t\tfor (var i = 0; i < csv.length; i++) {\n\t\t\t\t\tif (levels.length==3) {\n\t\t\t\t\t\tif (csv[i][1] != \"\") {\n\t\t\t\t\t\t\tvar sequence = csv[i][0] + \"&\" + csv[i][1];\n\t\t\t\t\t\t} else if (csv[i][1] == \"\") {\n\t\t\t\t\t\t\tvar sequence = csv[i][0];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar size = +csv[i][2];\n\t\t\t\t\t}\n\t\t\t\t\telse if (levels.length==4) {\n\t\t\t\t\t\tif (csv[i][1] != \"\" & csv[i][2] != \"\") {\n\t\t\t\t\t\t\tvar sequence = csv[i][0] + \"&\" + csv[i][1] + \"&\" + csv[i][2];\n\t\t\t\t\t\t} else if (csv[i][1] == \"\" & csv[i][2] != \"\") {\n\t\t\t\t\t\t\tvar sequence = csv[i][0] + \"&\" + csv[i][2];\n\t\t\t\t\t\t} else if (csv[i][1] != \"\" & csv[i][2] == \"\") {\n\t\t\t\t\t\t\tvar sequence = csv[i][0] + \"&\" + csv[i][1];\n\t\t\t\t\t\t} else if (csv[i][1] == \"\" & csv[i][2] == \"\") {\n\t\t\t\t\t\t\tvar sequence = csv[i][0];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar size = +csv[i][3];\n\t\t\t\t\t}\n\t\t\t\t\tif (isNaN(size)) {\n\t\t\t\t\t\t// e.g. if this is a header row\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tvar parts = sequence.split(\"&\");\n\t\t\t\t\tvar currentNode = root;\n\t\t\t\t\tfor (var j = 0; j < parts.length; j++) {\n\t\t\t\t\t\tvar children = currentNode[\"children\"];\n\t\t\t\t\t\tvar nodeName = parts[j];\n\t\t\t\t\t\tvar childNode;\n\t\t\t\t\t\tif (j + 1 < parts.length) {\n\t\t\t\t\t\t\t// Not yet at the end of the sequence; move down the tree.\n\t\t\t\t\t\t\tvar foundChild = false;\n\t\t\t\t\t\t\tfor (var k = 0; k < children.length; k++) {\n\t\t\t\t\t\t\t\tif (children[k][\"name\"] == nodeName) {\n\t\t\t\t\t\t\t\t\tchildNode = children[k];\n\t\t\t\t\t\t\t\t\tfoundChild = true;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// If we don't already have a child node for this branch, create it.\n\t\t\t\t\t\t\tif (!foundChild) {\n\t\t\t\t\t\t\t\tchildNode = { \"name\": nodeName, \"children\": [] };\n\t\t\t\t\t\t\t\tchildren.push(childNode);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcurrentNode = childNode;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Reached the end of the sequence; create a leaf node.\n\t\t\t\t\t\t\tchildNode = { \"name\": nodeName, \"size\": size };\n\t\t\t\t\t\t\tchildren.push(childNode);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//Colorkey definieren\n\t\t\t\troot.children.forEach(function(element1,index1) {\n\t\t\t\t\tvar diff1=1/(root.children.length-1)\n\t\t\t\t\telement1.colorkey=diff1*(index1);\n\t\t\t\t\tif (typeof element1.children != 'undefined') {\n\t\t\t\t\t\telement1.children.forEach(function(element2,index2){\n\t\t\t\t\t\t\tvar diff2=Math.max(diff1/element1.children.length,0.04)\n\t\t\t\t\t\t\telement2.colorkey=Math.max(element1.colorkey+diff1/element1.children.length*index2, element1.colorkey+0.04*index2);\n\t\t\t\t\t\t\tif (typeof element2.children != 'undefined') {\n\t\t\t\t\t\t\t\telement2.children.forEach(function(element3,index3){\n\t\t\t\t\t\t\t\t\tvar diff3=Math.max(diff2/element2.children.length,0.04)\n\t\t\t\t\t\t\t\t\telement3.colorkey=Math.max(element2.colorkey+diff2/element2.children.length*index3, element2.colorkey+0.04*index3)\n\t\t\t\t\t\t\t\t\tif (typeof element3.children != 'undefined') {\n\t\t\t\t\t\t\t\t\t\telement3.children.forEach(function(element4,index4){\n\t\t\t\t\t\t\t\t\t\t\tvar diff4=Math.max(diff3/element3.children.length,0.04)\n\t\t\t\t\t\t\t\t\t\t\telement4.colorkey=Math.max(element3.colorkey+diff3/element3.children.length*index4, element3.colorkey+0.04*index4)\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn root;\n\t\t\t}", "buildHierarchy(obj) {\n var that = this;\n var csv = obj;\n // obj = _.clone(obj);\n csv = _.filter(obj, (obje) => {\n return obje[0].split(\">\").length < 13;\n });\n var root = {\"name\": \"root\", \"children\": []};\n for (var i = 1; i < csv.length - 1; i++) {\n var sequence = csv[i][0];\n var size = +csv[i][1];\n var conType = csv[i][2];\n //console.log(csv[i])\n if (isNaN(size)) {\n break;\n }\n var parts = sequence.split(\">\");\n parts = _.map(parts, _.trim);\n parts = _.map(parts, function (a) {\n return that.resolveStepName(a);\n });\n var currentNode = root;\n for (var j = 0; j < parts.length; j++) {\n var children = currentNode[\"children\"];\n var nodeName = parts[j];\n var childNode;\n if (j + 1 < parts.length) {\n // Not yet at the end of the sequence; move down the tree.\n var foundChild = false;\n for (var k = 0; k < children.length; k++) {\n if (children[k][\"name\"] == nodeName) {\n childNode = children[k];\n foundChild = true;\n break;\n }\n }\n // If we don't already have a child node for this branch, create it.\n if (!foundChild) {\n childNode = {\"name\": nodeName, \"children\": []};\n children.push(childNode);\n }\n currentNode = childNode;\n }\n else {\n // Reached the end of the sequence; create a leaf node.\n childNode = {\"name\": nodeName, \"children\": [], \"size\": size, conversion_type: conType};\n children.push(childNode);\n }\n }\n }\n\n\n return root;\n }", "parseInputData(csv) {\n const lines = csv.split(\"\\n\");\n let i;\n for (i = 0; i < lines.length; ++i) {\n lines[i] = lines[i].split(\",\");\n }\n const echelon = lines[0][1];\n this.echelonRef.current.setState({echelon: parseInt(echelon)});\n\n i = 1;\n for (let catIdx = 0; catIdx < this.NUM_TABLES; ++catIdx) {\n let rows = [];\n for (let entryIdx = 1; entryIdx <= parseInt(lines[i][1]); ++entryIdx) {\n rows.push({\n organization: lines[i + entryIdx][0],\n count: parseInt(lines[i + entryIdx][1])\n });\n }\n this.tableRefs[catIdx].current.setState({rows});\n i += parseInt(lines[i][1]) + 1;\n }\n }", "function prepareNestedDataFromCsv(data) {\n\n nestedData =\n d3.nest()\n .key(function (d) {\n return d.elapsed_time;\n })\n .key(function () {\n return \"n(0,0)\"\n })\n .key(function (d) {\n return d.compartment;\n })\n .key(function (d) {\n return d.species;\n })\n .rollup(function (v) {\n return d3.sum(v, function (d) {\n return d.concentration;\n });\n })\n .map(data);\n}", "function treesCount(rowCount,colCount,input){\n console.log(rowCount,colCount);\n let treeCount = 0,row = 0,col = 0;\n while(row < input.length){\n if(input[row][col]===\"#\"){\n console.log(row,col,input[row][col]);\n treeCount++;\n }\n col = (col+colCount)%input[0].length;\n row += rowCount;\n }\n console.log(\"treeCount is : \",treeCount);\n return treeCount;\n}", "function count() {\n // Local helper function\n var overview = dom.datum().filter(function(l) { return l.Overview; })\n , details = dom.datum().filter(function(l) { return l.Phase; })\n , skeleton = {\n Court: d3.nest()\n .key(function(d) { return d.Court; })\n .key(function(d) { return d.Overview; })\n .rollup(function(leaves) {\n return d3.nest()\n .key(function(d) { return d.USPS; })\n .entries(leaves)\n ;\n })\n .map(overview)\n , Phase: d3.nest()\n .key(function(d) { return d.Court; })\n .key(function(d) { return d.Phase; })\n .key(function(d) { return d.Category; })\n .rollup(function(leaves) {\n return d3.nest()\n .key(function(d) { return d.USPS; })\n .entries(leaves)\n ;\n })\n .map(details)\n , Process: d3.nest()\n .key(function(d) { return d.Court; })\n .key(function(d) { return d.Phase; })\n .key(function(d) { return d.Category; })\n .key(function(d) {\n return d.Process === \"Elections\" ? d.Type : d.Process;\n })\n .rollup(function(leaves) {\n var complex = leaves.filter(function(d) {\n return d.step !== \"Process\";\n })\n , nester = d3.nest()\n ;\n if(complex.length) {\n nester.key(function(d) { return d.Type; });\n\n if(complex.some(function(d) { return d.Body; }))\n nester.key(function(d) { return d.Body; })\n ;\n } else\n complex = null\n ;\n return nester.key(function(d) { return d.USPS; })\n .map(complex || leaves)\n ;\n })\n .map(details)\n }\n ;\n // RESET the counts object, then populate it\n counts = { Court: {}, Phase: {}};\n pivots = { Court: [], Phase: []}\n d3.map(skeleton.Court).forEach(function(crt, cats) {\n var tmp = crt.split(' ');\n tmp.pop(); // pop the \"Court\" off the name\n var court = tmp.pop();\n pivots.Court.push({ key: court, value: crt });\n // Create the tree of Court counts\n counts.Court[court] = d3.entries(cats).map(leafify);\n counts.Phase[court] = {};\n\n // Navigate the tree of Phase counts at this Court level\n d3.map(skeleton.Process[crt])\n .forEach(function(faze, cats) {\n var phase = faze.split(' ')[0];\n pivots.Phase.push({ key: phase, value: faze })\n counts.Phase[court][phase] = d3.entries(cats)\n .map(processize)\n .map(function(cat) {\n cat.values = cat.values ||\n skeleton.Phase[crt][faze][cat.key]\n .map(multistatify)\n ;\n return cat;\n })\n ;\n })\n ;\n })\n ;\n pivots.Phase = d3.nest()\n .key(identikey)\n .rollup(function(leaves) { return leaves[0]; })\n .entries(pivots.Phase)\n .map(function(d) { return d.values; })\n ;\n return;\n\n // Local Helpers\n function leafify(d) {\n d.values = d.value.map(function(s) {\n s.value = s.values.pop();\n s.values = null;\n return s;\n })\n ;\n d.value = null;\n return d;\n } // leafify()\n\n function statify(b) {\n return d3.entries(b).map(function(s) {\n s.value = s.value[0];\n return s;\n })\n ;\n } // statify()\n\n function multistatify(s) {\n s.value = s.values;\n return s;\n } // multistatify()\n\n function processize(cat) {\n var node = {\n key: cat.key\n , children: []\n , values: null\n }\n ;\n d3.entries(cat.value).forEach(function(proc) {\n if(proc.key === cat.key) {\n node.values = statify(proc.value);\n return proc;\n }\n if(cat.key !== \"Commission Reappoints\") // Hawaii\n node.children.push(process_process(proc))\n ;\n })\n ;\n return node;\n } // processize()\n\n function process_process(proc) {\n switch(proc.key) {\n case \"Nominating Commission\":\n proc.children = d3.entries(proc.value)\n .map(function(comtype) { // (Non-)Binding\n comtype.values = statify(comtype.value);\n comtype.value = null;\n comtype.level = \"Commission\";\n return comtype;\n })\n ;\n proc.values = d3.values(proc.value)\n .map(statify)\n .reduce(flatten)\n ;\n break;\n case \"Confirmation\":\n proc.values = d3.values(proc.value)\n .map(function(f) {\n return d3.values(f)\n .map(statify)\n .reduce(flatten)\n ;\n })\n .reduce(flatten)\n ;\n proc.children = d3.entries(proc.value)\n .map(function(conftype) {\n conftype.values = d3.values(conftype.value)\n .map(statify)\n .reduce(flatten)\n ;\n conftype.children = d3.entries(conftype.value)\n .map(function(body) {\n body.values = statify(body.value);\n body.value = null;\n body.level = \"Body\";\n return body;\n })\n ;\n conftype.value = null;\n conftype.level = \"Confirmation\";\n return conftype;\n })\n ;\n break;\n default:\n proc.values = statify(proc.value);\n proc.children = null;\n }\n proc.value = null;\n proc.level = \"Process\"\n return proc;\n } // process_process()\n }", "function parse(rows) {\n // Create a tree of data out of the collected rows.\n var leaves = [];\n rows.forEach(function(row) {\n d3.entries(row.Phases)\n .forEach(function(phase) {\n if(phase.key === \"Overview\") {\n leaves.push({ // This is a Court Leaf node\n State: row.State\n , USPS: row.Abbrev\n , Court: row.Court\n , Overview: categorify(phase.value.Category)\n , Description: phase.value[\"Text Box\"] || null\n })\n ;\n return;\n } // Overview information\n\n var procs = processify(phase.value.Process);\n procs.forEach(function(proc) {\n leaves.push({\n State: row.State\n , USPS: row.Abbrev\n , Court: row.Court\n , Phase : phase.key\n , Category: categorify(phase.value.Category)\n , step: proc.step\n , Process: proc.Process\n , Type: proc.Type || null // nom comm + elections\n , Body: proc.Body || null // + confirmaton\n })\n ;\n })\n ; // Process information\n }) // row.Phases.forEach\n ;\n }) // rows.forEach\n ;\n return leaves;\n\n // Helper functions called from above\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()\n\n function processify(procs) {\n var ret = [];\n d3.entries(procs)\n .filter(function(p) {\n return p.value[\"Yes/No\"] === \"Yes\"\n })\n .forEach(function(p) {\n if(~p.key.toLowerCase().indexOf(\"confirmation\"))\n ret.push(confirmify(p))\n ;\n if(~p.key.toLowerCase().indexOf(\"elections\"))\n electify(p).forEach(function(e) { ret.push(e); })\n ;\n if(~p.key.toLowerCase().indexOf(\"appointment\"))\n ret.push(appointify(p))\n ;\n if(~p.key.toLowerCase().indexOf(\"nominat\"))\n ret.push(committify(p))\n ;\n })\n ;\n return ret;\n } // processify()\n\n function electify(proc) {\n return proc.value.Type.split(',')\n .map(function(t) {\n return {\n step: \"Process\"\n , Process: proc.key\n , Type: t.trim() + \" \" + proc.key\n }\n })\n ;\n } // electify()\n\n function appointify(proc) {\n return {\n step: \"Process\"\n , Process: proc.key\n }\n ;\n } // appointify()\n\n /*\n * Commissions & Confirmations.\n */\n function committify(proc) {\n return {\n step: \"Nomination\"\n , Process: proc.key\n , Type: proc.value.Type\n }\n ;\n }\n\n function confirmify(proc) {\n var k = proc.value.Legislative ? \"Legislative\" : \"Other\";\n return {\n step: \"Confirmation\"\n , Process: \"Confirmation\"\n , Type: k\n , Body: proc.value[k]\n }\n ;\n } // confirmify()\n // End parser helper functions\n }", "function agregateColumnValues() {\n\n\tvar values = {},\n\t\tcolumns = [],\n\t\ti, j, prop, val;\n\n\tcsvFileToJSON(function(data) {\n\t\tfor (prop in data[0]) {\n\t\t\tvalues[prop] = {};\n\t\t}\n\n\t\tfor (i = 1; i < data.length; i++) {\n\t\t\tfor (prop in data[i]) {\n\t\t\t\tval = data[i][prop];\n\t\t\t\tif(val in values[prop]) {\n\t\t\t\t\tvalues[prop][val]++;\n\t\t\t\t} else {\n\t\t\t\t\tvalues[prop][val] = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 3; i < argv.length; i++) {\n\t\t\tconsole.log(argv[i]);\n\t\t\tconsole.log(values[argv[i]]);\n\t\t\tval = '';\n\t\t\tfor(prop in values[argv[i]]) {\n\t\t\t\tif(prop.length === 0) prop = 'NULL';\n\t\t\t\tval += prop + ' | ';\n\t\t\t}\n\t\t\tconsole.log(val);\n\t\t}\n\t});\n\n\n}", "function main() {\n\tlet output\n\tlet input = getIn()\n\tlet rows = input.split(\"\\n\")\n\tlet nTrees = 0\n\tfor (let rowN = 0; rowN < rows.length; rowN++) {\n\t\tif (rows[rowN][3*rowN % rows[rowN].length] == \"#\")\n\t\t\tnTrees++\n\t\t// ahh yeah, nested array dereferences\n\t\t// rows[rowN].length could've stayed rows[0].length\n\t\t// modulo to wrap around for the repeating\n\t}\n\n\toutput = nTrees\n\tdisplayOut(1, output)\n}", "function main2() {\n\tlet output\n\tlet input = getIn()\n\tlet rows = input.split(\"\\n\")\n\tlet nTrees = 0\n\tlet nmTrees = 1\n\tfor (let rowN = 0; rowN < rows.length; rowN++) {\n\t\tif (rows[rowN][1*rowN % rows[rowN].length] == \"#\")\n\t\t\tnTrees++\n\t}\n\tconsole.log(nTrees)\n\tnmTrees *= nTrees\n\t// quicker just to copy paste these blocks and modify numbers for the different trajectories\n\tnTrees = 0\n\tfor (let rowN = 0; rowN < rows.length; rowN++) {\n\t\tif (rows[rowN][3*rowN % rows[rowN].length] == \"#\")\n\t\t\tnTrees++\n\t}\n\tconsole.log(nTrees)\n\tnmTrees *= nTrees\n\tnTrees = 0\n\tfor (let rowN = 0; rowN < rows.length; rowN++) {\n\t\tif (rows[rowN][5*rowN % rows[rowN].length] == \"#\")\n\t\t\tnTrees++\n\t}\n\tconsole.log(nTrees)\n\tnmTrees *= nTrees\n\tnTrees = 0\n\tfor (let rowN = 0; rowN < rows.length; rowN++) {\n\t\tif (rows[rowN][7*rowN % rows[rowN].length] == \"#\")\n\t\t\tnTrees++\n\t}\n\tconsole.log(nTrees)\n\tnmTrees *= nTrees\n\tnTrees = 0\n\tfor (let rowN = 0; 2*rowN < rows.length; rowN++) {\n\t\tif (rows[2*rowN][1*rowN % rows[rowN].length] == \"#\")\n\t\t\tnTrees++\n\t\t// this one held me back. initially incrementing rowN by 2 and still using rowN, but that messes up horizontal trajectory.\n\t\t// or something. anyway, the code works, don't try to parse it!!\n\t}\n\tconsole.log(nTrees)\n\tnmTrees *= nTrees\n\n\toutput = nmTrees\n\tdisplayOut(2, output)\n}", "function createTree(data, portlist, hier, cols, label='Grand', accum='') {\n let total = calcTotal(data, portlist, cols)\n\n if (hier.length == 0) {\n return {\n label : label,\n total : total,\n uid : accum,\n children: mergeDataRow(data, cols)\n }\n } else if (label=='Grand') {\n return {\n label : \"\",\n total : total,\n uid : \"grand\",\n children : applyHierarchy(_.groupBy(data, item=>item[hier[0]]),\n portlist, hier.slice(1), cols, accum)\n }\n } else {\n return {\n label : label,\n total : total,\n uid : accum,\n children : applyHierarchy(_.groupBy(data, item=>item[hier[0]]),\n portlist, hier.slice(1), cols, accum)\n }\n }\n\n}", "function Partitions(max, rows) \n{\n\tthis.a = [];\n\tfor (var i=1; i <= max; i++) {\n\t\tfor (j=1; j <= i; j++) {\n\t\t\tif (j <= i/2) {\n\t\t\t\tthis.a.push([i, j, i-j, j]);\n\t\t\t} else {\n\t\t\t\tthis.a.push([i, i, 0, 0]);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tthis.position = function(n) {\n\t\treturn (n % 2) ? (n+1)*(n+1) / 4 : n*(n+2) / 4;\n\t};\n\t\n\tthis.count = 0;\n\tthis.newArray = [];\n\tthis.counters = function() {\n\t\tthis.newArray = [];\n\t\tfor (var i=1; i <= max; i++) {\n\t\t\tthis.count = 0;\n\t\t\tthis.recurse(i, 1);\n\t\t\trows.push(\"count \" + i + \" = \" + this.count);\n\t\t}\n\t}\n\t\n\tthis.recurse = function(pos, start) {\n\t\tfor (var i=this.position(pos)-1; i < this.a.length; i++) {\n\t\t\tvar row = this.a[i];\n\t\t\tif (row[0] != pos)\n\t\t\t\tbreak;\n\t\t\tif (row[1] >= start) {\n\t\t\t\tthis.newArray.push(row[1]);\n\t\t\t\tif (row[2] == 0) { rows.push(JSON.stringify(this.newArray)); \n\t\t\t\t\tthis.count++;\n\t\t\t\t} else {\n\t\t\t\t\tthis.recurse(row[2], row[3]);\n\t\t\t\t}\n\t\t\t\tthis.newArray.pop();\n\t\t\t}\n\t\t}\n\t}\n}", "function getVerticleHeaders(csv) {\n if (!itemDel) {\n itemDel = \",\";\n }\n var lines = csv.split(\"\\n\"); //Split the data into an array of lines\n var headers = lines[0].split(itemDel); //Get the header names\n var metaColumn = 0;\n for (var j = 0; j < headers.length; j++) { //Go through each of the columns, and assign parseable header names\n switch (headers[j]) {\n case \"Node ID\":\n headers[j] = \"id\";\n break;\n case \"Node Name\":\n headers[j] = \"name\";\n break;\n case \"Parent ID\":\n headers[j] = \"parentId\";\n break;\n case \"Hierarchy Name\":\n headers[j] = \"hierarchy\";\n break;\n case \"Level Name\":\n headers[j] = \"level\";\n break;\n default:\n headers[j] = headers[j].replace(/\\s+/g, '');\n //headers[j] = (\"meta\" + metaColumn);\n metaColumn += 1;\n break;\n }\n }\n return headers;\n}", "renumber() {\n const modelJSON = this.unwrap();\n let stepIndex = 1;\n let lifelineIndex = 1;\n for (const step of modelJSON.diagram.steps) {\n if (step.message) {\n step.message.index = stepIndex++;\n }\n }\n for (const lifeline of modelJSON.diagram.lifelines) {\n lifeline.index = lifelineIndex++;\n }\n }", "function Treecount(right, down) {\n let counter = 0; //counts tress\n let counter2 = 1; //counts items in file\n let sledPosition = 0;\n \n\n for ( let i = 0; i < dataList.length; i=i+down) {\n if (sledPosition>30) sledPosition = sledPosition-31;\n if (dataList[i][sledPosition]== \"#\") counter++;\n console.log(dataList[i], dataList[i][sledPosition], sledPosition, counter, counter2); \n sledPosition = sledPosition+right; \n counter2++ \n }\n return counter;\n}", "iterateTree(intent, row){\n row++;\n if(this.rows < row) this.rows = row;\n intent.row = row;\n if(intent.children.length === 0){\n this.leafs++;\n return;\n }\n for (const child of intent.children){\n this.iterateTree(child, row)\n }\n }", "function readCSVtoAccordions(callback){\n\tvar ncallback = 0;\n\tfunction writeAccordion (topic, panelWriter) {\n\t\td3.tsv(\"data/\"+topic+\"/\"+topic+\".csv\").then(_data => {\n\t\t var academic = document.getElementById(topic);\n\t\t for(var i = 0; i<_data.length; i++) academic.innerHTML += panelWriter(_data[i], topic);\n\n\t\t //accordionHandle, performed as callback to accomodate \n\t\t //\tpanelwriter, which can be slow.\n\n\t\t callback('subAccordion'+topic);\n\t\t});\n\n\t}\n\twriteAccordion(\"academic\", academicPanelWriter);\n\twriteAccordion(\"professional\", professionalPanelWriter);\n\twriteAccordion(\"personal\", personalPanelWriter);\n\n\t/*\n\td3.tsv('data/mic.csv').then(_data => {\n\t var academic = document.getElementById(\"academic\");\n\t for(var i = 0; i<_data.length; i++) academic.innerHTML += academicPanelWriter(_data[i]);\n\n\t //accordionHandle, performed as callback to accomodate \n\t //\tpanelwriter, which can be slow.\n\n\t callback(\"subAccordion1\");\n\t});\n\td3.tsv('data/professional/professional.csv').then(_data => {\n\t var academic = document.getElementById(\"professional\");\n\t for(var i = 0; i<_data.length; i++) academic.innerHTML += professionalPanelWriter(_data[i]);\n\n\t //accordionHandle, performed as callback to accomodate \n\t //\tpanelwriter, which can be slow.\n\n\t callback(\"subAccordion2\");\n\t});\n\td3.tsv('data/personal/personal.csv').then(_data => {\n\t var academic = document.getElementById(\"personal\");\n\t for(var i = 0; i<_data.length; i++) academic.innerHTML += personalPanelWriter(_data[i]);\n\n\t //accordionHandle, performed as callback to accomodate \n\t //\tpanelwriter, which can be slow.\n\n\t callback(\"subAccordion3\");\n\t});*/\n}", "function csvToWikiTable(CSV, addHeaderIfMissing, addLineNumbers, addSummary) {\r\n var j, k, coltag;\r\n var s = '{| class=\"wikitable sortable\"\\n';\r\n var a = [];\r\n var x = 0;\r\n var v = \"\";\r\n var sumFields = [];\r\n if(!CSV){return;}\r\n a = getFldPosArr(CSV);\r\n for (k = 0; k < CSV.maxColumnsFound; k++) sumFields.push(0); // max length of columns\r\n if (CSV.isFirstRowHeader || addHeaderIfMissing) {\r\n s += \"|-\\n\"; // new row\r\n if (addLineNumbers) s += \"! #\\n\";\r\n for (x = 0; x < a.length; x++) { //for each header column\r\n k = a[x] - 1;\r\n if (k > CSV.arHeaderRow.length) v = \"FIELD\" + k;\r\n else v = CSV.arHeaderRow[k];\r\n s += '! ' + v.toHtml().replace(/\\r\\n|\\r|\\n/g, \"<br/>\") + \"\\n\";\r\n }\r\n // s+=\"\\n\";\r\n }\r\n //s+=\"<tbody>\"; // the body\r\n for (j = 0; j < CSV.table.length; j++) {\r\n //alert(\"in csvToTable, continuing.... v=\" + v);\r\n s += \"|-\\n\";\r\n if (addLineNumbers) s += \"! \" + (j + 1) + \"\\n\";\r\n for (x = 0; x < a.length; x++) { //for each column\r\n k = a[x] - 1;\r\n if (k >= CSV.table[j].length) v = \" \";\r\n else v = CSV.table[j][k];\r\n v = doTransformations(v, k, CSV);\r\n if (x > 0) s += \" |\";\r\n if (CSV.statsCnt[k] && (CSV.statsCnt[k].fieldType == \"N\" || CSV.statsCnt[k].fieldType == \"I\")) {\r\n //s+='| style=\"text-align:right;\" | '+v.toFixed(CSV.statsCnt[k].fieldDecs)+\"\\n\";\r\n s += '| ' + v.toFixed(CSV.statsCnt[k].fieldDecs);\r\n sumFields[k] += 1 * v;\r\n }\r\n else {\r\n if (v == \"\") v = \" \";\r\n s += \"| \" + v.toHtml().replace(/\\r\\n|\\n|\\r/g, \"<br/>\").replace(/\\|/g, \"<nowiki>|</nowiki>\");\r\n }\r\n }\r\n s += \"\\n\"; // end of row\r\n } // for\r\n s += \"\";\r\n if (addSummary) {\r\n s += \"|-\\n\"; // table footer\r\n if (addLineNumbers) s += \"! Sum\\n\";\r\n for (x = 0; x < a.length; x++) { //for each column\r\n k = a[x] - 1;\r\n if (CSV.statsCnt[k] && (CSV.statsCnt[k].fieldType == \"N\" || CSV.statsCnt[k].fieldType == \"I\")) {\r\n s += \"! \" + sumFields[k].toFixed(CSV.statsCnt[k].fieldDecs) + \"\\n\";\r\n }\r\n else {\r\n s += \"! \\n\";\r\n }\r\n }\r\n //s+=\"\\n\";\r\n }\r\n s += \"|}\"; // end of table\r\n return s;\r\n}", "fromCSV(text) {\n var rows = text.split(\"\\n\");\n for (var index in rows) {\n if (rows[index] != \"\") {\n var array = rows[index].split(\",\");\n if (index == 1) {\n // Container Width, Container Heigth\n this.cW = array[0];\n this.cH = array[1];\n } else if (index == 2) {\n for (var cellIndex in array) {\n console.log(array[cellIndex]);\n this.fileHeadline.push(array[cellIndex]);\n }\n } else if (index > 2) {\n var o = new InputOrder();\n o.order = parseInt(array[0]);\n o.desc = array[1].toString();\n o.quantity = parseInt(array[2]);\n o.length = parseFloat(array[3]);\n o.width = parseFloat(array[4]);\n o.height = parseFloat(array[5]);\n if (parseInt(array[6]) === 1) {\n o.rotate = true;\n } else {\n o.rotate = false;\n }\n if (parseInt(array[7]) === 1) {\n o.stack = true;\n } else {\n o.stack = false;\n }\n o.group = parseFloat(array[8]);\n this.orders.push(o);\n }\n }\n }\n }", "transformToObject(csv) {\n var objectAll = {\"nodes\": [], \"links\": []},\n nodes = [],\n links = [],\n keys = [];\n\n for (let i = 0; i < csv.length; i++) {\n if (i === 0) {\n keys = csv[i]; // First line are the headers\n keys[2] = \"source\"; // Change to d3 vocabulary\n keys[7] = \"target\"; // Change to d3 vocabulary\n } else {\n // Add links\n let tempLinks = {};\n for (let k = 0; k < keys.length; k++) {\n tempLinks[keys[k]] = csv[i][k];\n }\n links.push(tempLinks);\n\n // Add nodes (creator & addressee)\n nodes.push(csv[i][2]);\n nodes.push(csv[i][7]);\n }\n }\n\n // Construct object\n links.forEach(function(link, key) {\n // Parse dates\n links[key][\"Year\"] = parseInt(links[key][\"Year\"]);\n if (isNaN(links[key][\"Year\"])) {\n links[key][\"Year\"] = 0;\n }\n\n // Handle unknown nodes\n if (link[\"source\"] == \"\") {\n links[key][\"source\"] = \"[Unknown]\";\n }\n\n if (link[\"target\"] == \"\") {\n links[key][\"target\"] = \"[Unknown]\";\n }\n });\n\n objectAll[\"links\"] = links;\n\n nodes = Array.from(new Set(nodes)); // Make nodes unique\n nodes.forEach(function(node) {\n if (node == \"\") {\n objectAll[\"nodes\"].push({\"id\": \"[Unknown]\"});\n } else {\n objectAll[\"nodes\"].push({\"id\": node});\n }\n });\n\n // Set data\n this.dataAll = objectAll;\n this.dataFamily = this.setFamily();\n this.dataGroups = this.setGroups();\n this.dataPersons = this.setPersons();\n\n this.callback();\n }", "function dfaParse(csv) {\n var i = 0;\n var json = '';\n var state = initial;\n\n var header = '';\n var keys = [];\n var keyIndex = 0;\n\n function initial(c) {\n return readingHeader(c);\n }\n\n function readingHeader(c) {\n switch(c) {\n case '\\n':\n keys = header.split(',');\n json += '[';\n return startLine;\n case '\\r':\n return readingHeader;\n default:\n header += c;\n return readingHeader;\n }\n }\n\n function startLine(c) {\n json += '{';\n return startField(c);\n }\n\n function startField(c) {\n console.assert(keyIndex < keys.length);\n if (keyIndex) { json += ',' }\n json += '\"' + keys[keyIndex++] + '\":\"';\n switch(c) {\n case '\"':\n return quotedField;\n case ',':\n json += '\"';\n return startField;\n case undefined:\n return endOfLine(c);\n case '\\n':\n return endOfLine;\n case '\\r':\n return carriageReturn;\n default:\n json += c;\n return unquotedField;\n }\n };\n\n function firstQuote(c) {\n switch(c) {\n case '\"':\n json += '\\\\\"'; // or += c; // backslash unnecessary for non-string output\n return unquotedField;\n default:\n json += c;\n return quotedField;\n }\n }\n\n function quotedField(c) {\n switch(c) {\n case '\"':\n return quotedQuote;\n // TODO: technically should contain all non-space whitespace characters\n case '\\n': // not necessary for non-string ouput\n json += '\\\\n';\n return quotedField;\n case '\\r': // not necessary for non-string ouput\n json += '\\\\r';\n return quotedField;\n case '\\t': // not necessary for non-string ouput\n json += '\\\\t';\n return quotedField;\n case '\\\\':\n json += '\\\\\\\\';\n return quotedField;\n default:\n json += c;\n return quotedField;\n }\n }\n\n function quotedQuote(c) {\n switch(c) {\n case '\"':\n json += '\\\\\"'; // or += c; // backslash unnecessary for non-string output\n return quotedField;\n case ',':\n json += '\"';\n return startField;\n case '\\r':\n return carriageReturn;\n case '\\n':\n return endOfLine;\n case undefined:\n return endOfLine(c);\n default:\n throw 'Ending quote followed by unexpected character at position ' + i;\n }\n }\n\n function unquotedField(c) {\n switch(c) {\n case \",\":\n json += '\"';\n return startField;\n case '\\r':\n return unquotedCarriageReturn;\n case '\\n':\n return endOfLine;\n case undefined:\n return endOfLine(c);\n default:\n json += c;\n return unquotedField;\n }\n }\n\n function carriageReturn(c) {\n switch(c) {\n case '\\n':\n return endOfLine;\n default:\n throw 'Carriage return without matching newline at position ' + i;\n }\n }\n\n function unquotedCarriageReturn(c) {\n switch(c) {\n case '\\n':\n return endOfLine;\n default:\n json += '\\\\r' + c; // backslash unnecessary for non-string output\n return unquotedField;\n }\n }\n\n function endOfLine(c) {\n json += '\"}';\n keyIndex = 0;\n if (c) {\n json += ',';\n return startLine(c);\n }\n json += ']';\n return null;\n }\n\n while (state) {\n state = state(csv[i++]);\n }\n return json;\n }", "function parseClueLabel(clueLine) {\n let parse = {dir: '', label: ''};\n parse.hasChilden = false\n parse.skip = 0\n numberParts = clueLine.match(/^\\s*[1-9]\\d*/)\n if (numberParts && numberParts.length == 1) {\n let clueNum = parseInt(numberParts[0])\n parse.label = '' + clueNum\n parse.isOffNum = false\n parse.skip = numberParts[0].length\n } else {\n let bracOpenParts = clueLine.match(/^\\s*\\[/)\n if (!bracOpenParts || bracOpenParts.length != 1) {\n parse.isFiller = true\n return parse\n }\n let pastBracOpen = bracOpenParts[0].length\n let bracEnd = clueLine.indexOf(']')\n if (bracEnd < 0) {\n throwErr('Missing matching ] in clue label in ' + clueLine)\n }\n parse.label = clueLine.substring(pastBracOpen, bracEnd).trim()\n if (parse.label.charAt(parse.label.length - 1) == '.') {\n // strip trailing period\n parse.label = parse.label.substr(0, parse.label.length - 1).trim()\n }\n parse.isOffNum = true\n parse.skip = bracEnd + 1\n }\n clueLine = clueLine.substr(parse.skip)\n dirParts = clueLine.match(/^[aAdD]/) // no leading space\n if (dirParts && dirParts.length == 1) {\n parse.dir = dirParts[0].trim().toUpperCase()\n parse.skip += dirParts[0].length\n clueLine = clueLine.substr(dirParts[0].length)\n }\n commaParts = clueLine.match(/^\\s*,/)\n if (commaParts && commaParts.length == 1) {\n parse.hasChildren = true\n parse.skip += commaParts[0].length\n clueLine = clueLine.substr(commaParts[0].length)\n }\n // Consume trailing period if it is there (but not if it's followed\n // immediately by another period (i.e., don't skip \"...\")\n periodParts = clueLine.match(/^\\s*\\./)\n if (periodParts && periodParts.length == 1 && !clueLine.match(/^\\s*\\.\\./)) {\n parse.hasChildren = false\n parse.skip += periodParts[0].length\n clueLine = clueLine.substr(periodParts[0].length)\n }\n return parse\n}", "function init (e, input) {\n const rows = input.split('\\n')\n let validTriangles = rows.reduce(function (validTriangles, sides) {\n return sides !== '\\n' && isValidTriangle(sides) ? validTriangles + 1 : validTriangles\n }, 0)\n\n console.log(validTriangles)\n return validTriangles\n}", "function csvToCodebook(csv) {\n\tlet columns = csv[0]\n\tlet codebook = []\n\n\t// Create items\n\tfor (let i = 1; i < csv.length; i++) {\n\t\tlet o = {}\n\t\tfor (let j = 0; j < columns.length; j++) o[columns[j]] = csv[i][j]\n\n\t\tcodebook.push(o)\n\t}\n\n\tfor (let field of codebook)\n\t\tfield.directDependencies = getDirectDeps(field, (e) =>\n\t\t\tcodebook.find((d) => d.name === e)\n\t\t)\n\n\tfor (let field of codebook) field.dependencies = getDepsRecursive(field)\n\n\treturn codebook\n}", "static fromExport(csvInput) {\n var rows = csvInput.split(\"\\n\");\n var container = new Container();\n for (var index in rows) {\n\n }\n }", "function StepCounter() {\n\tthis.STATE = 'DOWN';\n\tthis.steps = 0;\n\tthis.UPPER = [];\n}", "function structure(lines) {\n const stack = [{ children: [] }];\n let currentLevel = stack[0], lastLine = null;\n\n for(let rawLine of lines) {\n const indent = rawLine.search(/[^ ]/);\n\n if(indent === -1)\n continue;\n\n const line = { value: rawLine.substr(indent), children: undefined };\n\n if(indent > stack.length - 1) {\n if(indent !== stack.length)\n throw new Error('Malformed input');\n\n // Last line was a header, move it up\n stack.push(currentLevel);\n currentLevel = lastLine;\n currentLevel.children = [];\n }\n\n while(indent < stack.length - 1) {\n // Coming out\n currentLevel = stack.pop();\n }\n\n currentLevel.children.push(line);\n lastLine = line;\n }\n\n return stack[0].children;\n}", "function groupRowsByParents(rows, from, to) {\n if (from && to) {\n var nodeById = {};\n var l = rows.length;\n var node = null;\n nodeById[0] = new TreeNode(); // that's the root node\n var uniqIDs = rows.reduce(function (arr, item) {\n var toValue = to(item);\n if (arr.indexOf(toValue) === -1) {\n arr.push(toValue);\n }\n return arr;\n }, []);\n for (var i = 0; i < l; i++) {\n nodeById[to(rows[i])] = new TreeNode(rows[i]);\n }\n for (var i = 0; i < l; i++) {\n node = nodeById[to(rows[i])];\n var parent_1 = 0;\n var fromValue = from(node.row);\n if (!!fromValue && (uniqIDs.indexOf(fromValue) > -1)) {\n parent_1 = fromValue;\n }\n node.parent = nodeById[parent_1];\n node.row['level'] = node.parent.row['level'] + 1;\n node.parent.children.push(node);\n }\n var resolvedRows_1 = [];\n nodeById[0].flatten(function () {\n resolvedRows_1 = resolvedRows_1.concat([this.row]);\n }, true);\n return resolvedRows_1;\n }\n else {\n return rows;\n }\n}", "function splitLine(line)\n{\n\tif (line.endsWith(\":\")) line = line.slice(0, -1) // For entries that look like: 'Monday:'\n\tvar tokens = line.split(\" \") // Each token is delimited by a space\n\t\n\tvar classification = []\n\tvar tripData = {\n\t\t\"Source\": \"\", // To be filled in once more drives are logged\n\t\t\"Destination\": \"\",\n\t\t\"Date\": \"\",\n\t\t\"StartOdometer\": \"\",\n\t\t\"EndOdometer\": \"\",\n\t\t\"StartTime\": \"\",\n\t\t\"EndTime\": \"\",\n\t\t\"DateOrTimeIsAmbiguous\": false // There may be some cases where we want to look into fixing ambiguity. Only checking the most straightforward edge cases currently\n\t}\n\n\t//var token = \"\" // Vestigial\n\tvar lastTokenType = 0\n\tfor (var i = 0; i < tokens.length; i++)\n\t{\n\t\tvar token = tokens[i]\n\t\t\n\t\t// Turn the token into the binary represntation\n\t\tvar classification = classifyToken(token)\n\t\t//console.log(token, describeToken(classification))\n\t\t\n\t\t// Try to quickly resolve any simple conflict ambiguity\n\t\t// Check for various common causes of ambiguity and handle it based on extra parsing or previous classifications\n\t\tif (tokenIsAmbiguous(classification))\n\t\t{\n\t\t\tif (lastTokenType == DATE) classification = DATE // i.e The last token was 'August' and this token is '3rd'\n\t\t\tif (classification.length < 3) classification = DATE // Honestly no idea what I was writing here... leaving it in though\n\n\t\t\t// Check for ambiguity between a time and odometer. Use basic checking to categorize it\n\t\t\tif (tokenValueIs( classification, (TIME | ODOMETER) ))\n\t\t\t{\n\t\t\t\tif (parseInt(token) >= 2360) classification = ODOMETER\n\t\t\t\t//if (token.length == 2)\n\t\t\t\telse classification = TIME\n\t\t\t}\n\t\t}\n\n\t\tif (classification == 0)\n\t\t{\n\t\t\t// Do something? Ignore?\n\t\t}\n\n\t\t//if (isUnambiguous(classification))\n\t\t//{\n\t\t// See function description\n\t\tsaveData(tripData, classification, token)\n\t\t//}\n\n\t\t// Used for fixing ambiguous situations\n\t\tlastTokenType = classification\n\t}\n\t\n\t//console.log(tokens)\n\t//console.log(tripData)\n\treturn tripData\n}", "function countLineages(node, xVal, count) {\n if (node.parent === null && node.x === xVal) {\n // Root\n return node.desc.length;\n } else if (node.parent != null && node.x > xVal && node.parent.x <= xVal) {\n count++;\n }\n if (node.desc != null) {\n for (let i = 0; i < node.desc.length; i++) {\n count = countLineages(node.desc[i], xVal, count);\n }\n }\n return count;\n}", "function csv2json(csv) {\n csv = csv.replace(/, /g, \",\"); // trim leading whitespace in csv file\n var json = d3.csv.parse(csv); // parse csv string into json\n // reshape json data\n var data = [];\n var groups = []; // track unique groups\n json.forEach(function(record) {\n var group = record.group;\n if (groups.indexOf(group) < 0) {\n groups.push(group); // push to unique groups tracking\n data.push({ // push group node in data\n group: group,\n axes: []\n });\n };\n data.forEach(function(d) {\n if (d.group === record.group) { // push record data into right group in data\n d.axes.push({\n axis: record.axis,\n value: parseInt(record.value),\n description: record.description\n });\n }\n });\n });\n return data;\n }", "function pointSteps(path) {\n var result = new Map();\n var x = 0;\n var y = 0;\n var count = 0;\n var directions = path.split(',');\n for (var direction of directions) {\n var dir = direction[0]; \n for (var distance = Number.parseInt(direction.slice(1)); distance-->0; ) {\n switch (dir) {\n case 'U': y--; break;\n case 'D': y++; break;\n case 'L': x--; break;\n case 'R': x++; break;\n }\n var key = [x, y].join();\n count++;\n if (!result.has(key)) {\n // only set the lowest step count\n result.set(key, count);\n }\n }\n }\n return result;\n}", "function countSplitByColumn (data,pred,col) { \n var counts = { };\n var all = 0;\n data.forEach(function(r) {\n\tif (pred(r)) { \n\t all += 1;\n\t c = r[col];\n\t if (c in counts) {\n\t\tcounts[c] += 1;\n\t } else {\n\t\tcounts[c] = 1;\n\t }\n\t}\n });\n return {all:all,counts:counts};\n}", "function applyHierarchy(data, portlist, hier, cols, accum) {\n var vTreeList = [], prop\n for (prop in data) {\n vTreeList.push(createTree(data[prop], portlist, hier, cols, prop, accum + '_' + prop))\n }\n return vTreeList\n}", "function parser(csvData){\r\n let arr = csvData.split(\"\\n\");\r\n let featuers=[];\r\n featuers = arr[0].split(\",\");\r\n if(!isNaN(featuers[0])){\r\n return -1;\r\n }\r\n let data = {}\r\n for(let i=0;i<featuers.length;i++){\r\n data[featuers[i]]=[];\r\n }\r\n for(let i = 1;i<(arr.length)-1;i++){\r\n let temp = arr[i].split(',');\r\n for(let j=0;j<(featuers.length);j++){\r\n data[featuers[j]].push(temp[j]);\r\n }\r\n }\r\n return data;\r\n}", "initDepths(columns = this.columns, parent = null) {\n let me = this,\n maxDepth = 0;\n\n if (parent && parent.meta) parent.meta.depth++;\n\n for (let column of columns) {\n // TODO: this should maybe move\n column.meta.depth = 0;\n\n if (column.children) {\n me.initDepths(column.children, column);\n if (column.meta.depth && parent) parent.meta.depth += column.meta.depth;\n }\n\n if (column.meta.depth > maxDepth) maxDepth = column.meta.depth;\n }\n\n if (!parent) {\n this.maxDepth = maxDepth;\n }\n\n return maxDepth;\n }", "function generateSpeciesCount(dataset) {\n for (let i = 0; i < dataset.length; i++) {\n let row = dataset[i];\n if (speciesMap.has(row.species)) {\n speciesMap.set(row.species, speciesMap.get(row.species) + 1);\n if (row.species == \"Other\") {\n let otherSpecies = row.breed.split(\" \");\n if (otherSpeciesMap.has(otherSpecies[0])) {\n otherSpeciesMap.set(otherSpecies[0], otherSpeciesMap.get(otherSpecies[0]) + 1);\n }\n else {\n otherSpeciesMap.set(otherSpecies[0], 1);\n }\n }\n }\n else {\n speciesMap.set(row.species, 1);\n }\n } \n}", "function groupRowsByParents(rows, from, to, columns, sortDirs, lazyTree) {\n if (lazyTree === void 0) { lazyTree = false; }\n if (!rows) {\n return rows;\n }\n if (from && to) {\n var nodeById = {};\n var l = rows.length;\n var node = null;\n nodeById[0] = new TreeNode(); // that's the root node\n var uniqIDs = rows.reduce(function (arr, item) {\n var toValue = to(item);\n if (arr.indexOf(toValue) === -1) {\n arr.push(toValue);\n }\n return arr;\n }, []);\n for (var i = 0; i < l; i++) {\n // make TreeNode objects for each item\n nodeById[to(rows[i])] = new TreeNode(rows[i]);\n }\n var notResolvedNodes = [];\n for (var i = 0; i < l; i++) {\n // link all TreeNode objects\n node = nodeById[to(rows[i])];\n var parent_1 = 0;\n var fromValue = from(node.row);\n if (Boolean(fromValue) && uniqIDs.indexOf(fromValue) > -1) {\n parent_1 = fromValue;\n }\n node.parent = nodeById[parent_1];\n // eslint-disable-next-line no-undefined\n if (node.parent.row['level'] === null || node.parent.row['level'] === undefined) {\n notResolvedNodes.push(node);\n }\n else {\n node.row['level'] = node.parent.row['level'] + 1;\n node.parent.children.push(node);\n }\n }\n var temp = [];\n var toSortSet = new Set();\n do {\n temp.length = 0;\n while (notResolvedNodes.length) {\n node = notResolvedNodes.pop();\n // eslint-disable-next-line no-undefined\n if (node.parent.row['level'] === null || node.parent.row['level'] === undefined) {\n temp.push(node);\n }\n else {\n node.row['level'] = node.parent.row['level'] + 1;\n node.parent.children.push(node);\n if (sortDirs === null || sortDirs === void 0 ? void 0 : sortDirs.length) {\n toSortSet.add(node.parent);\n }\n }\n }\n notResolvedNodes = __spreadArray([], temp, true);\n } while (notResolvedNodes.length);\n if (sortDirs === null || sortDirs === void 0 ? void 0 : sortDirs.length) {\n toSortSet.forEach(function (value) { return value.sortTreeNodes(columns, sortDirs); });\n }\n var resolvedRows_1 = [];\n nodeById[0].flatten(function () {\n resolvedRows_1 = __spreadArray(__spreadArray([], resolvedRows_1, true), [this.row], false);\n }, true, lazyTree);\n return resolvedRows_1;\n }\n return rows;\n}", "function levelCount(){\n var temp=\"\";\n if (configuration.levelDetails[level-1].rule==\"minimum\")\n temp=\"+\";\n return \"/\"+configuration.levelDetails[level-1].count+temp;\n}", "function csvParse(line) {\n line = line.split(\",\");\n\n let entries = [];\n let e;\n\n let regex = {\n both: /^\".+\"$/,\n start: /^\".+$/,\n end: /^.+\"$/\n }\n\n line.forEach((section) => {\n if (regex.start.test(section)) {\n entries.push(section.substr(1, section.length - 2));\n } else if (regex.start.test(section)) {\n e = section.substr(1, section.length - 1);\n } else if (regex.end.test(section) && e) {\n e += section.substr(0, section.length - 1);\n entries.push(e);\n e = undefined;\n }\n });\n\n return entries.map(el => isNaN(Number(el)) ? el : Number(el));\n}", "function processData(csv) {\n var allTextLines = csv.split(/\\r\\n|\\n/);\n var lines = [];\n while (allTextLines.length) {\n lines.push(allTextLines.shift().split(','));\n }\n parseInfo(lines);\n}", "function csvToTable(CSV, addHeaderIfMissing, addLineNumbers, addSummary, options) {\r\n var j, k, coltag;\r\n var s = '<table class=\"table table-bordered table-hover table-condensed\">\\n';\r\n var a = [];\r\n var x = 0;\r\n var v = \"\";\r\n var sumFields = [];\r\n if(!CSV){return;}\r\n options = options || {};\r\n a = getFldPosArr(CSV);\r\n for (k = 0; k < CSV.maxColumnsFound; k++) sumFields.push(0); // max length of columns\r\n if (CSV.isFirstRowHeader || addHeaderIfMissing) {\r\n s += \"<thead><tr>\";\r\n if (addLineNumbers) s += \"<th>#</th>\";\r\n for (x = 0; x < a.length; x++) { //for each header column\r\n k = a[x] - 1;\r\n if (k > CSV.arHeaderRow.length) v = \"FIELD\" + k;\r\n else v = CSV.arHeaderRow[k];\r\n s += '<th title=\"Field #' + (k + 1) + '\">' + v.toHtml().replace(/\\r\\n|\\r|\\n/g, \"<br/>\") + \"</th>\\n\";\r\n }\r\n s += \"</tr></thead>\\n\";\r\n }\r\n s += \"<tbody>\";\r\n for (j = 0; j < CSV.table.length; j++) {\r\n //alert(\"in csvToTable, continuing.... v=\" + v);\r\n s += \"<tr\"; // j is zero-based but we assume first row is 1\r\n if (options && 'attr1' in options) {\r\n if (options.attr1 != \"\" && options.attr1Row === \"\") s += \" \" + options.attr1;\r\n else if (options.attr1 != \"\" && options.attr1Row === \"E\" && (j % 2)) s += \" \" + options.attr1;\r\n else if (options.attr1 != \"\" && options.attr1Row === \"O\" && !(j % 2)) s += \" \" + options.attr1;\r\n if (options.attr2 != \"\" && options.attr2Row === \"\") s += \" \" + options.attr2;\r\n else if (options.attr2 != \"\" && options.attr2Row === \"E\" && (j % 2)) s += \" \" + options.attr2;\r\n else if (options.attr2 != \"\" && options.attr2Row === \"O\" && !(j % 2)) s += \" \" + options.attr2;\r\n }\r\n s += '>\\n';\r\n if (addLineNumbers) s += \"<td>\" + (j + 1) + \"</td>\\n\";\r\n for (x = 0; x < a.length; x++) { //for each column\r\n k = a[x] - 1;\r\n if (k >= CSV.table[j].length) v = \" \";\r\n else v = CSV.table[j][k];\r\n v = doTransformations(v, k, CSV);\r\n if (CSV.statsCnt[k] && (CSV.statsCnt[k].fieldType == \"N\" || CSV.statsCnt[k].fieldType == \"I\")) {\r\n s += \"<td align=\\\"right\\\">\" + v + \"</td>\\n\";\r\n sumFields[k] += 1 * v;\r\n }\r\n else if (v != \"\" && 'dateOutFormat' in options && options.dateOutFormat != \"\" && CSV.statsCnt[k] && CSV.statsCnt[k].fieldType == \"D\") {\r\n try {\r\n var v = moment(v, CSV.dateformat[k]).format(options.dateOutFormat);\r\n } catch (e) { ; }\r\n s += \"<td>\" + v.toHtml().replace(/\\r\\n|\\n|\\r/g, \"<br/>\");\r\n s += \"</td>\\n\";\r\n }\r\n else {\r\n if (v == \"\") v = \" \";\r\n s += \"<td>\" + v.toHtml().replace(/\\r\\n|\\n|\\r/g, \"<br/>\");\r\n s += \"</td>\\n\";\r\n }\r\n }\r\n s += \"</tr>\\n\";\r\n }\r\n s += \"</tbody>\";\r\n if (addSummary) {\r\n s += \"<tfoot><tr>\";\r\n if (addLineNumbers) s += \"<th>Sum</th>\";\r\n for (x = 0; x < a.length; x++) { //for each column\r\n k = a[x] - 1;\r\n if (CSV.statsCnt[k] && (CSV.statsCnt[k].fieldType == \"N\" || CSV.statsCnt[k].fieldType == \"I\")) {\r\n s += \"<th align=\\\"right\\\">\" + sumFields[k].toFixed(CSV.statsCnt[k].fieldDecs) + \"</th>\\n\";\r\n }\r\n else {\r\n s += \"<th>&nbsp;</th>\";\r\n }\r\n }\r\n s += \"</tr></tfoot>\\n\";\r\n\r\n }\r\n s += \"</table>\";\r\n return s;\r\n}", "function solution(fileName) {\n\n let input = fs.readFileSync(fileName).toString();\n let lines = input.split('\\n');\n let res = [];\n lines.forEach(line => {\n let tiles = line.split(',');\n let count = 1, maxCount = 1;\n\n for (let i = 0; i < tiles.length; i++) {\n while (i < tiles.length - 1 && tiles[i].split('-')[1] === tiles[i + 1].split('-')[0]) {\n count++;\n i++;\n if (count >= maxCount) {\n maxCount = count;\n }\n }\n count = 1;\n }\n res.push(maxCount);\n });\n return res;\n}", "function genJSON(csvData, groups) {\n\n var genGroups = function(data) {\n return _.map(data, function(element, index) {\n return {\n name : index,\n children : element\n };\n });\n };\n\n var nest = function(node, curIndex) {\n if (curIndex === 0) {\n node.children = genGroups(_.groupBy(csvData, groups[0]));\n _.each(node.children, function(child) {\n nest(child, curIndex + 1);\n });\n } else {\n if (curIndex < groups.length) {\n node.children = genGroups(_.groupBy(node.children, groups[curIndex]));\n _.each(node.children, function(child) {\n nest(child, curIndex + 1);\n });\n }\n }\n return node;\n };\n return nest({}, 0);\n}", "function D(e){if(null==e.parent)return null;for(var t=e.parent,a=d(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var r=0;n.children[r]!=t;++r)a+=n.children[r].chunkSize();return a+t.first}", "function node(csv) {\n var lines = csv.split(\"\\n\");\n var result = [];\n var headers = [\"ID\", \"LABEL\", \"N\", \"W\", \"E\", \"out_num\", \"out_min\", \"in_num\", \"in_min\"];\n for (var i = 1; i < lines.length; i++) {\n var properties = {};\n var currentline = lines[i].split(\",\");\n for (var j = 0; j < headers.length; j++) {\n properties[headers[j]] = currentline[j];\n }\n var north_str = properties[\"N\"];\n var west_str = properties[\"W\"];\n var east_str = properties[\"E\"];\n var north = parseFloat(north_str);\n var west = parseFloat(west_str);\n var east = parseFloat(east_str);\n var node = {\n \"type\": \"Feature\",\n \"properties\": properties,\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [east, north]\n }\n };\n result.push(node);\n }\n return result;\n}", "function genJSON(csvData, groups) {\r\n\r\n\tvar genGroups = function(data) {\r\n\t\treturn _.map(data, function(element, index) {\r\n\t\t\treturn { name : index, children : element };\r\n\t\t});\r\n\t};\r\n\r\n\tvar nest = function(node, curIndex) {\r\n\t\tif (curIndex === 0) {\r\n\t\t\tnode.children = genGroups(_.groupBy(csvData, groups[0]));\r\n\t\t\t_.each(node.children, function (child) {\r\n\t\t\t\tnest(child, curIndex + 1);\r\n\t\t\t});\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (curIndex < groups.length) {\r\n\t\t\t\tnode.children = genGroups(\r\n\t\t\t\t\t_.groupBy(node.children, groups[curIndex])\r\n\t\t\t\t);\r\n\t\t\t\t_.each(node.children, function (child) {\r\n\t\t\t\t\tnest(child, curIndex + 1);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\t};\r\n\r\n\treturn nest({}, 0);\r\n}", "function tabularNestHeader(element) {\n var head = element.querySelectorAll(\"thead\")[0];\n var row = head.querySelectorAll(\"tr\")[0];\n var hth = row.querySelectorAll(\"th\");\n\n var colons = 0;\n var i;\n for (i = 0; i < hth.length; i++) {\n var n = hth[i].textContent.split(\":\").length;\n if (n > colons) colons = n;\n }\n\n for (i = 0; i < 2*colons; i++) {\n var tr = document.createElement(\"tr\");\n var td = document.createElement(\"td\");\n tr.appendChild(td);\n\n for (var j = 0; j < hth.length; j++) {\n var text = hth[j].textContent.split(\":\");\n var k = Math.floor(i/2);\n var th = document.createElement(\"th\");\n if (k < text.length) {\n th.textContent = text[k].split(\"/\")[i % 2];\n } else {\n th.textContent = \"\";\n }\n tr.appendChild(th);\n }\n head.appendChild(tr);\n }\n\n row.parentElement.removeChild(row);\n row = head.querySelectorAll(\"tr\");\n for (i = 0; i < row.length; i++) {\n var rth = row[i].querySelectorAll(\"th\");\n var curn = 0;\n var cur = rth[curn].textContents;\n var colspan = 1;\n for (j = 0; j < rth.length; j++) {\n if (rth[j].textContent === cur && rth[j].textContent !== \"\") {\n rth[j].parentElement.removeChild(rth[j]);\n colspan++;\n rth[curn].setAttribute(\"colspan\", colspan);\n } else {\n colspan = 1;\n curn = j;\n cur = rth[curn].textContent;\n }\n }\n }\n}", "function genJSON(csvData, groups) {\n\n var genGroups = function(data) {\n\treturn _.map(data, function(element, index) {\n\t return { name : index, children : element };\n\t});\n };\n\n var nest = function(node, curIndex) {\n\tif (curIndex === 0) {\n\t node.children = genGroups(_.groupBy(csvData, groups[0]));\n\t _.each(node.children, function (child) {\n\t\tnest(child, curIndex + 1);\n\t });\n\t}\n\telse {\n\t if (curIndex < groups.length) {\n\t\tnode.children = genGroups(\n\t\t _.groupBy(node.children, groups[curIndex])\n\t\t);\n\t\t_.each(node.children, function (child) {\n\t\t nest(child, curIndex + 1);\n\t\t});\n\t }\n\t}\n\treturn node;\n };\n return nest({}, 0);\n}", "function parseCSV(data) {\r\n\r\n let records = data.split('\\n'); //create array based on each line\r\n let results = [];\r\n\r\n for (let record of records) {\r\n results.push(record.split(',')); //create second level of array based on commas\r\n }\r\n\r\n let headers = results[0]; //get headers from first record (line)\r\n results.splice(0, 1); //remove headers line from results array\r\n\r\n let dataResult = [];\r\n let header1 = headers[0];\r\n let header2 = headers[1];\r\n header2 = header2.split(\" \");\r\n header2 = header2[0] + capitalize(header2[1]); //make it without spaces and camel case\r\n let header3 = headers[2];\r\n header3 = header3.split(\" \");\r\n header3 = header3[0] + capitalize(header3[1]); //make it without spaces and camel case\r\n let header4 = headers[3];\r\n\r\n\r\n for(let record of results) {\r\n let decorator = {}; //create an object for each record\r\n\r\n for(let field of record) {\r\n if(record.indexOf(field) === 0) { //get the header of each field and attach as a property to the values\r\n decorator[header1] = field; //assign value to each property according to headers given\r\n } else if(record.indexOf(field) === 1) {\r\n decorator[header2] = field;\r\n } else if(record.indexOf(field) === 2) {\r\n decorator[header3] = field;\r\n } else {\r\n decorator[header4] = field;\r\n }\r\n }\r\n dataResult.push(decorator);\r\n }\r\n return dataResult;\r\n}", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "async function prepareData( param ) {\n\n // TODO check input format\n\n // make sure the hierarchy is an array\n if( !(param.hierarchy instanceof Array) ) {\n param.hierarchy = [ param.hierarchy ];\n }\n\n // get source data\n let source = DataStore.getDataset( param.data_id ),\n cols = source.getColumnMeta(),\n srcData = source.getData(),\n rowCount = source.getRowCount(),\n hierarchy = param.hierarchy,\n value = param.size;\n\n\n // init result data array\n const data = {\n 'name': 'root',\n 'map': new Map(),\n 'children': []\n };\n\n // walk through source data\n let hierarchyCount = hierarchy.length,\n runner,\n allEntries = [ data ],\n coloring;\n for( let row=0; row<rowCount; row++ ) {\n\n // reset runner\n runner = data;\n\n // label to determine coloring is given by name of innermost dimension\n coloring = '' + srcData[ hierarchy[0] ][ row ];\n\n // walk dimensions\n for( let dimIndex=0; dimIndex<hierarchyCount; dimIndex++ ) {\n\n // shortcut\n const el = srcData[ hierarchy[dimIndex] ][ row ];\n\n // if not present, add\n if( !runner.map.has( el ) ) {\n const newEntry = {\n 'name': '' + el,\n 'coloring': coloring,\n 'map': new Map(),\n 'children': []\n };\n runner.map.set( el, newEntry );\n runner.children.push( newEntry );\n allEntries.push( newEntry );\n }\n\n // keep on walking\n runner = runner.map.get( el );\n\n }\n\n // add the value\n runner.size = srcData[ value ][ row ];\n\n }\n\n // remove helper constructs\n allEntries.forEach( (el) => {\n\n // delete the map\n delete el.map;\n\n // if there are no children present, remove the property\n if( el.children.length < 1 ){\n delete el.children;\n }\n\n });\n\n // return result\n return data;\n\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function parseData(csv, lineSeparator, removeDuplicates) {\n\n\tlet rows;\n\tif (lineSeparator === 'n') {\n\t\trows = csv.split('\\r\\n');\n\t}else{\n\t\trows = csv.split('\\r');\n\t}\n\n\tlet headers = rows[0].split(',');\n\n\tlet body = rows.slice(1);\n\n\tif (removeDuplicates) { body = removeDups(body);}\n\n\tbody = body.map(row => row.split(','));\n\n\t//for some reason, the last line is an empty string\n\n\tif (body[0] == '') {\n\t\tbody = body.slice(1);\n\t}else if (body[body.length-1] == ''){\n\t\tbody = body.slice(0, body.length-1)\n\t}\n\n\tlet numColumns = headers.length;\n\n\t// create objects that look like header:value\n\tbody = body.map((column) => {\n\t\t\tlet dataObj = {};\n\t\t\tfor (var i = 0; i < numColumns; i++) {\n\t\t\t\tdataObj[headers[i]] = column[i];\n\t\t\t}\n\t\t\treturn dataObj;\n\t})\n\treturn body;\n}", "parse (data) {\n // Stores the parsed workflow\n let workflowSteps = []\n\n // Compacts the data array\n // QUESTION - will we ever have zeros between each key stroke?\n // Doesn't look like it - but keep it in mind here.\n data = _.compact(data)\n data = _.pull(data, 255)\n\n // persistWorkflowStep helper function\n // Adds an ID to the currentWorkflow step\n const persistWorkflowStep = (step) => {\n // Isolates the STEP_INITIATOR variable\n let STEP_INITIATOR = step.shift()\n\n // Defines variable for the current workflow step\n let workflowStep\n\n switch (STEP_INITIATOR) {\n case (DELAY_INITIATOR):\n // console.log('DELAY')\n // console.log(step)\n workflowStep = _.clone(DELAY_WORKFLOW_STEP)\n workflowStep.value = step[0]\n break\n\n case (MACRO_INITIATOR):\n // console.log('MACRO')\n // console.log(step)\n workflowStep = _.clone(MACRO_WORKFLOW_STEP)\n workflowStep.value = step // TODO - add call to this.parseMacro\n break\n case (TEXT_INITIATOR):\n // console.log('TEXT')\n // console.log(step)\n workflowStep = _.clone(TEXT_WORKFLOW_STEP)\n workflowStep.value = this.parseText(step)\n break\n case (KEYUP_INITIATOR):\n // console.log('KEYUP')\n // console.log(step)\n workflowStep = _.clone(KEYUP_WORKFLOW_STEP)\n break\n }\n\n // Adds an individual step to the workflow\n workflowStep.id = randomId()\n workflowStep.order = workflowSteps.length\n workflowSteps.push(workflowStep)\n }\n\n // // // //\n\n // Pops off the traling STEP_TERMINATOR\n data.pop()\n\n // Splits into individual workflow steps\n let steps = data.join(',').split(`,${STEP_TERMINATOR},`)\n\n // Splits each step BACK into an array\n steps = _.map(steps, (s) => {\n let step = s.split(',')\n return step.map(i => Number(i))\n })\n\n // Parses each workflow step\n _.each(steps, (step) => { persistWorkflowStep(step) })\n\n // Returns the array of Workflow steps\n console.log('workflowSteps')\n console.log(workflowSteps)\n return { steps: workflowSteps }\n }", "function csvToTableHeaderValue(CSV, addHeaderIfMissing, addLineNumbers, addSummary, options) {\r\n var j, k, coltag;\r\n var s = \"<table class=\\\"table table-bordered table-hover table-condensed\\\">\\n\";\r\n var a = [];\r\n var x = 0;\r\n var v = \"\";\r\n if(!CSV){return;}\r\n a = getFldPosArr(CSV);\r\n if (CSV.isFirstRowHeader || addHeaderIfMissing) {\r\n s += \"<thead><tr><th>Field</th><th>Value</th></tr></thead>\";\r\n }\r\n s += \"<tbody>\";\r\n for (j = 0; j < CSV.table.length; j++) {\r\n //alert(\"in csvToTable, continuing.... v=\" + v);\r\n\r\n for (x = 0; x < a.length; x++) { //for each column display the header/value\r\n s += \"<tr>\";\r\n if (x == 0 && addLineNumbers) {\r\n s += \"<th>Record #</th><th>\" + (j + 1) + \"</th></tr><tr>\\n\";\r\n }\r\n //header column\r\n k = a[x] - 1;\r\n if (k > CSV.arHeaderRow.length) v = \"FIELD\" + k;\r\n else v = CSV.arHeaderRow[k];\r\n s += '<th title=\"Field #' + (k + 1) + '\">' + v.toHtml().replace(/\\r\\n|\\r|\\n/g, \"<br/>\") + \"</th>\\n\";\r\n\r\n k = a[x] - 1;\r\n if (k >= CSV.table[j].length) v = \" \";\r\n else v = CSV.table[j][k];\r\n v = doTransformations(v, k, CSV);\r\n if (CSV.statsCnt[k] && (CSV.statsCnt[k].fieldType == \"N\" || CSV.statsCnt[k].fieldType == \"I\")) {\r\n s += \"<td align=\\\"right\\\">\" + v.toFixed(CSV.statsCnt[k].fieldDecs) + \"</td>\\n\";\r\n }\r\n else if (v != \"\" && 'dateOutFormat' in options && options.dateOutFormat != \"\" && CSV.statsCnt[k] && CSV.statsCnt[k].fieldType == \"D\") {\r\n try {\r\n var v = moment(v, CSV.dateformat[k]).format(options.dateOutFormat);\r\n } catch (e) { ; }\r\n s += \"<td>\" + v.toHtml().replace(/\\r\\n|\\n|\\r/g, \"<br/>\");\r\n s += \"</td>\\n\";\r\n }\r\n else {\r\n if (v == \"\") v = \" \";\r\n s += \"<td>\" + v.toHtml().replace(/\\r\\n|\\n|\\r/g, \"<br/>\") + \"</td>\\n\";\r\n }\r\n s += \"</tr>\\n\";\r\n }\r\n s += \"\";\r\n }\r\n s += \"</tbody>\";\r\n s += \"</table>\";\r\n return s;\r\n}", "function howManyTabs(input)\n{\n\treturn (input.match(/\\t/g) || []).length;\n}", "function initStepCounter() {\n currentStep = 0;\n var totSteps = document.getElementById(\"totalSteps\");\n var counter = document.getElementById(\"currentStep\");\n\n counter.innerHTML = currentStep;\n totSteps.innerHTML = changes.length;\n \n\n}", "function processDataAsObj(csv) {\n\tvar allTextLines = csv.split(/\\r\\n|\\n/);\n\tvar lines = [];\n\n\t//first line of csv\n\tvar keys = allTextLines.shift().split(',');\n\n\twhile (allTextLines.length) {\n\t\tvar arr = allTextLines.shift().split(',');\n\t\tvar obj = {};\n\t\tfor (var i = 0; i < keys.length; i++) {\n\t\t\tobj[keys[i]] = arr[i];\n\t\t}\n\t\tlines.push(obj);\n\t}\n\tconsole.log(lines);\n\tdrawOutputAsObj(lines);\n}", "csvToTable(csv) {\n\n this.tableLines = csv.split(\"\\n\")\n this.tableLinesLength = this.tableLines.length\n this.tableHeaders = this.tableLines[0].split(\",\")\n this.tableHeadLength = this.tableHeaders.length\n\n this.headTableTarget.insertAdjacentHTML(\"beforeend\", this.doHeadTable())\n this.bodyTableTarget.insertAdjacentHTML(\"beforeend\", this.doBodyTable())\n\n }", "static FromDelimited(string, delimiters, hasHeaders) {\n\t\tlet arr = string.replace(/\"/gi, \"\").split(\"\\n\");\n\t\tlet d1 = delimiters && delimiters[0] ? delimiters[0] : \",\",\n\t\t\td2 = delimiters && delimiters[1] ? delimiters[1] : \"|\",\n\t\t\ttags = [];\n\n\t\tif (\n\t\t\t!!hasHeaders ||\n\t\t\tstring.includes(\"ID,ParentID,TagType,Key,Ordinality,Value,Options\")\n\t\t) {\n\t\t\tarr.shift();\n\t\t}\n\t\tfor (let i in arr) {\n\t\t\tlet row = arr[i].split(d1);\n\t\t\tlet CSV = {\n\t\t\t\tID: +row[0],\n\t\t\t\tParentID: row[1] === \"\" ? null : row[1],\n\t\t\t\tTagType: +row[2],\n\t\t\t\tKey: row[3],\n\t\t\t\tOrdinality: +row[4],\n\t\t\t\tValue: row[5].split(d2),\n\t\t\t\tOptions: row[6]\n\t\t\t};\n\t\t\tlet tag = new (Enum.TagType.GetClass(CSV.TagType))(CSV.Key);\n\t\t\ttag.SetOrdinality(CSV.Ordinality);\n\n\t\t\tif (tag instanceof Tag.TagCompound) {\n\t\t\t\t// NOOP\n\t\t\t} else if (tag instanceof Tag.TagList) {\n\t\t\t\ttag.SetContentType(+CSV.Options);\n\t\t\t} else {\n\t\t\t\ttag.Deserialize({\n\t\t\t\t\tType: CSV.TagType,\n\t\t\t\t\tKey: CSV.Key,\n\t\t\t\t\tOrdinality: CSV.Ordinality,\n\t\t\t\t\tValue: CSV.Value\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\ttag instanceof Tag.TagString ||\n\t\t\t\ttag instanceof Tag.TagCharacter\n\t\t\t) {\n\t\t\t\t// Lazy check to properly reinsert characters\n\t\t\t\tif (CSV.Value.length > 0) {\n\t\t\t\t\tif (isNaN(CSV.Value[0])) {\n\t\t\t\t\t\ttag.SetValues(...CSV.Value);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttag.SetValues(CSV.Value.map((o) => +o));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttags.push({\n\t\t\t\tID: CSV.ID,\n\t\t\t\tParentID: CSV.ParentID,\n\t\t\t\tTag: tag\n\t\t\t});\n\t\t}\n\n\t\treturn Transformer.FromHierarchy(tags);\n\t}", "constructor(data) {\n let temp = data.split('\\n').map(item => {\n return item.split(',')\n })\n let label = temp.shift()\n\n let result = []\n\n for (var node of temp) {\n let json = {}\n for (var variable in node) {\n json[label[variable]] = node[variable]\n }\n result.push(json)\n }\n\n this.nodes = result\n }", "function levelWidth(root) {\n\t// array to loop over tree\n\tconst arr = [root, 's'];\n\t//counter to check for widths\n\tconst counter = [0];\n\n\t// Check if there are atleast 2 elements to avoid infinite loop\n\twhile(arr.length > 1) {\n\t\t//POP OUT THE FIRST ELEMENT\n\t\tconst node = arr.shift();\n\n\t\t//check if 's' is the last character - if YES it means we have traversed the whole breadth with BF traversal\n\t\t// So we 1. push all the children to the array 2. Initialize next counter with value 0 which signifies next width value\n\t\tif(node === 's') {\n\t\t\tcounters.push(0);\n\t\t\tarr.push('s');\n\t\t} else {\n\t\t\t// Increase counter and push all children until we get an 's'\n\t\t\tarr.push(...node.children);\n\t\t\tcounters[counters.length -1] + 1;\n\t\t}\n\t}\n\n\treturn counters;\n\n}", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, e = lines.length, height = 0; i < e; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, e = lines.length, height = 0; i < e; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, e = lines.length, height = 0; i < e; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines\n this.parent = null\n var height = 0\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1\n height += lines[i].height\n }\n this.height = height\n}", "function LeafChunk(lines) {\n\t\t this.lines = lines;\n\t\t this.parent = null;\n\t\t var height = 0;\n\t\t for (var i = 0; i < lines.length; ++i) {\n\t\t lines[i].parent = this;\n\t\t height += lines[i].height;\n\t\t }\n\t\t this.height = height;\n\t\t }", "function convertType(text, start, end) {\n var s = ''\n if (start == end) {\n s = 'Cannot start and end with the same type! (' + start + ' -> ' + end + ')'\n }\n else if (start == 'CSV' && end == 'JSON') {\n //CSV to JSON\n //The names of each variable is defined in the first line\n var lines = text.split('\\n')\n var names = lines[0].split(',')\n var data = []\n for(var line in lines) {\n if (line == 0) continue\n var dataline = lines[line].split(',')\n var entry = {}\n for(var i in names) {\n if (names[i].includes('.')) {\n //Nested objects, use recursion to fix it!\n entry = recursiveObject(entry, names[i].split('.'), dataline[i])\n }\n else {\n entry[names[i]] = dataline[i]\n }\n }\n data.push(entry)\n }\n s = JSON.stringify(data, null, 2)\n // lines.forEach((line, index) => {\n // if (index != 1) {\n // continue\n // }\n // console.log(i+\": \"+v)\n // var entry = {}\n // for(var i in names) {\n // console.log(i)\n // }\n // })\n }\n else if (start == 'JSON' && end == 'CSV') {\n //JSON to CSV\n var data = JSON.parse(text)\n if(Array.isArray(data)) {\n //Each table is given in each object\n const first = data[0]\n //Get the names of each in first\n for(const i in first) {\n // s += recursiveTitle(i, first[i]) + ','\n if (typeof first[i] == 'object') {\n //Instead of having nested objects, make each variable from within its own entry (in the form parent.child.nextChild.keepGoing.more.maybeMore.name)\n s += recursiveTitle(i, first[i]) + ','\n }\n else {\n s += i + ','\n }\n }\n s = s.substring(0, s.length-1) + '\\n'\n //Go through each data point now\n for(const x in data) {\n // console.log(x)\n var currentPoint = data[x]\n for(const i in currentPoint) {\n if (typeof currentPoint[i] == 'object') {\n s += recursiveValue(i, currentPoint[i]) + ','\n }\n else {\n s += currentPoint[i] + ','\n }\n }\n s = s.substring(0, s.length-1) + '\\n'\n }\n }\n else {\n s = 'JSON was not an array!'\n }\n }\n else {\n s = 'Unkown types: ' + start + ' -> ' + end + '.'\n }\n usedText = s\n document.getElementById('types-output').innerHTML = s\n}", "function parseArray(csvArray, task) {\n var csvErr = 'CSV poor format. Do not assign string value to key' +\n ' if there will be more subkeys nested within that key.';\n var lang;\n var jsonObj;\n var i;\n var j;\n var key;\n var subkeyArray;\n var value;\n var k;\n var node;\n var jsfile;\n var x;\n\n for (i = 2; i < csvArray[0].length; i++) {\n lang = csvArray[0][i]; // get language from the CSV header row\n jsonObj = {}; // JSON object to be created\n\n for (j = 0; j < csvArray.length; j++) {\n // append to JSON string\n key = csvArray[j][1];\n subkeyArray = key.split('.');\n value = csvArray[j][i];\n k = 0;\n node = jsonObj;\n\n while (node && (k < subkeyArray.length - 1)) {\n if (!node[subkeyArray[k]]) {\n node[subkeyArray[k]] = {};\n } else {\n if (typeof node[subkeyArray[k]] !== 'object') {\n task.emit('error', new gutil.PluginError('gulp-i18n-csv',csvErr));\n return;\n }\n }\n\n node = node[subkeyArray[k]];\n k++;\n }\n\n if (node) {\n if (!node[subkeyArray[k]]) {\n node[subkeyArray[k]] = value;\n } else {\n if (typeof node[subkeyArray[k]] === 'object') {\n task.emit('error', new gutil.PluginError('gulp-i18n-csv',csvErr));\n return;\n }\n }\n }\n }\n\n jsfile = splitFile(jsonObj, lang);\n\n // do not write files from the gulp plugin itself\n // create a file object and push it back to through stream\n // so main gulpfile\n for (x = 0; x < jsfile.length; x++) {\n task.push(jsfile[x]);\n }\n }\n }", "function LeafChunk(lines) {\r\n this.lines = lines;\r\n this.parent = null;\r\n for (var i = 0, height = 0; i < lines.length; ++i) {\r\n lines[i].parent = this;\r\n height += lines[i].height;\r\n }\r\n this.height = height;\r\n }", "function countColumn(string, tabSize, to = string.length) {\n let n = 0;\n for (let i = 0; i < to;) {\n if (string.charCodeAt(i) == 9) {\n n += tabSize - (n % tabSize);\n i++;\n }\n else {\n n++;\n i = findClusterBreak(string, i);\n }\n }\n return n;\n}", "function LeafChunk(lines) {\n\t\t this.lines = lines;\n\t\t this.parent = null;\n\t\t for (var i = 0, height = 0; i < lines.length; ++i) {\n\t\t lines[i].parent = this;\n\t\t height += lines[i].height;\n\t\t }\n\t\t this.height = height;\n\t\t }", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n }" ]
[ "0.69260067", "0.6481844", "0.64235336", "0.636193", "0.6356439", "0.63528097", "0.63489795", "0.6156806", "0.5966926", "0.54853845", "0.5008062", "0.49356794", "0.48742747", "0.48625112", "0.48314276", "0.48176584", "0.47566494", "0.4748009", "0.46512502", "0.456501", "0.45643377", "0.4539077", "0.44097707", "0.4404176", "0.43964946", "0.43872935", "0.4386796", "0.43829295", "0.43731117", "0.43671024", "0.4358509", "0.4355101", "0.43489552", "0.43298903", "0.4321112", "0.43073237", "0.4277446", "0.42734718", "0.4264878", "0.42490092", "0.4246057", "0.42443538", "0.42405722", "0.42246655", "0.42070535", "0.41974664", "0.41881597", "0.41834754", "0.4175589", "0.41604903", "0.41558826", "0.41471112", "0.41439965", "0.41250932", "0.41163307", "0.4098051", "0.4091886", "0.40812674", "0.40812674", "0.40812674", "0.40812674", "0.40812674", "0.40812674", "0.40812674", "0.40812674", "0.40790948", "0.4063148", "0.4060002", "0.4060002", "0.4060002", "0.4060002", "0.4060002", "0.4060002", "0.4060002", "0.4053686", "0.4049078", "0.40417522", "0.4036982", "0.403152", "0.40212026", "0.40186244", "0.4018401", "0.4013857", "0.4005438", "0.40052664", "0.40052664", "0.40052664", "0.40005514", "0.40002072", "0.39999875", "0.3998509", "0.39973465", "0.39946577", "0.39867827", "0.39826757", "0.39826757", "0.39826757", "0.39826757", "0.39826757", "0.39826757" ]
0.64690375
2
Replace underscores with answer and reset choices
answered(root, isUser = false) { if (isUser || !this.state.autohintingPaused && (root !== undefined)) { const updatedAnswerParts = this.fillIn(root); const solvedRoots = this.state.solvedRoots.concat([root.toLowerCase()]); this.setState({ answerParts: updatedAnswerParts, autohintingPaused: this.state.autohintOn && isUser, hint: Math.min(1, this.state.hint), solvedRoots: solvedRoots }, this.checkSolution); this.pauseAutohinting(isUser); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function chooseSolution(){\n\t\tvar choice = Math.floor(Math.random() * wordList.length);\n\t\tsolution = wordList[choice].toLowerCase();\n\t\tsolution = solution.split(\"\");\n\t\tsolutionDisplay=[];\n\t\tfor (var i = 0; i < solution.length; i++) {\n\t\t\tsolutionDisplay.push(\"_\");\n\t\t}\n\t}", "function resetWholeQuestion(){\n\t\tresetQuestion();\n\t\tresetChoices();\t\n\t}", "function reset() {\n result = (\"\");\n choices = [];\n}", "function underscore(){\n\tarrayU=[null];\n\tfor (var i=0; i<ChosenWord.length; i++)\n\t{\n\t\tarrayU[i] = \"_\";\n\t}\n}", "resetChoices() {\n // We are always going to go first for now -- left turn in for future\n this.choices = {done: false, turn: true, shape: ''};\n }", "function reset() {\n\tgameInProgress = true;\n\tguessesRemaining = 10;\n\tcurrentWord = [];\n\tlettersGuessed = [];\n\n\t// Pick a random answer and generate the corresponding hidden word\n\tvar index = Math.floor(Math.random() * cities.length);\n\tanswer = cities[index];\n\tfor (i=0; i<answer.length; i++) {\n\t\tcurrentWord[i] = \"_\";\n\t}\n}", "function default_answer() {\n return choice(['I am an Oracle, not a God!','Ask me something I can see in the crystal ball','I cannot understand your question']);\n}", "function resetQuestion() {\n choices.innerHTML = \"\"\n}", "function resetGame() {\n var underscores = \"\";\n var correctGuess = [];\n var guessedAnswers = [];\n select();\n}", "function normalizeOption(str) {\n str = str.replace(/_/g, \" \");\n return str;\n }", "function changeAnswers() {\n let answers = document.getElementById('answers');\n answers.innerHTML = underscoreJoin;\n}", "function resetChoice() {\n\n var choice = \"\";\n var update_p1_Choice = database.ref('players/1/choice');\n var update_p2_Choice = database.ref('players/2/choice');\n update_p1_Choice.set(choice);\n update_p2_Choice.set(choice);\n }", "function hideAnswer() {\n var answerArray = [];\n for (let i = 0; i < word.length; i++) {\n answerArray[i] = \"_\";\n }\n return answerArray;\n}", "function setupAnswerArray(word) {\n \"use strict\";\n var answerArray = [];\n for (var i = 0; i < word.length; i++) {\n answerArray[i] = '_';\n }\n return answerArray;\n}", "function changeMultipleChoiceQuestionOptionName(question) {\n var mustChangeOption = question.find(\"[data-changeMyName]\");\n\n mustChangeOption.each(function (index, element) {\n var currentName = $(element).prop(\"name\");\n $(element).prop(\"name\", currentName + questionNumber.toString());\n });\n\n questionNumber++;\n }", "function clear_answers(){\n\t\t$('[id$=-quest] .answer').val('')\n\t}", "function resetAnswer() {}", "function normalizeAnswers(data) {\n\treturn data.toString().toLowerCase()\n}", "function replaceQuestion(q, a, b, c, d, i) {\n\t\t$question.text(q);\n\t\t$ansA.text(a);\n\t\t$ansB.text(b);\n\t\t$ansC.text(c);\n\t\t$ansD.text(d);\n\t\t$('#pagenum').text(i);\n\t}", "setNewQuestion() {\n this.currentQuestion = getRandomSyllables(1,\n this.props.allowedSyllables,\n false,\n this.previousQuestion);\n\n // Pick some syllables as options for answers\n this.answerOptions = getRandomSyllables(5,\n this.props.allowedSyllables,\n this.currentQuestion,\n false);\n\n this.setState({\n currentQuestion: this.currentQuestion,\n answerOptions: this.answerOptions\n });\n\n // Determine which of the answer options are acceptable answers\n this.correctAnswers = [];\n if (this.props.stage === 1 || this.props.stage === 3) // Answers for stage 1 and 3 are romanizations\n this.correctAnswers = this.currentQuestion.map(hex => getRomanization(hex));\n else if (this.props.stage === 2) // Answers for stage 2 are Hangeul syllables\n this.correctAnswers = this.currentQuestion.map(hex => String.fromCharCode(parseInt(hex, 16)));\n }", "function resetGame() {\n guessesRemaining = maxGuesses\n\n hiddenWord = answers[Math.floor(Math.random() * answers.length)].toUpperCase()\n\n guessedLetters = []\n wordBeingGuessed = []\n\n for (var i = 0, j = hiddenWord.length; i < j; i++) {\n if (hiddenWord[i] === \" \") {\n wordBeingGuessed.push(\" \")\n }\n else {\n wordBeingGuessed.push(\"_\")\n }\n }\n updateDisplay()\n}", "function resetWord() {\n word = selectRandomWord();\n console.log(word);\n wrongLetters = [];\n guessesRemaining = 10;\n answerArray = resetAnswerArray(word);\n\n displayWord();\n displayGuessesRemaining();\n displayWrongLetters();\n }", "function spinalCase() {\n\n \n rl.question(\"Enter a string and it will return in spinal case\\n\",(string) =>{\n // changes all entries to lowercase\n string = string.toLowerCase();\n // use regular expression to check for underscores, spaces and replace them with hypens\n \n string = string.replace();\n\n \n\n console.log(regexTest);\n //close readline\n rl.close();\n\n });\n\n \n }", "function setUnderscores(){\n \tcurrentWord = arr[Math.floor(Math.random()*arr.length)]\n \tconsole.log(currentWord) \n \tchosenWord = currentWord.split(\"\")\n\tconsole.log(chosenWord)\n\twordCompare = currentWord.split(\"\")\n \tfor ( var k=0; k<chosenWord.length; k++){\n \t\tchosenWord[k]=\"_\";\n \t\t\n\t// document.getElementById('wins').innerHTML\n\n \t}\n \tnumberOfGuessesRemaining = 10\n \tlettersAlreadyGuessed=[]\n\n\n \t\n \t// wordUnderscores = chosenWord.join(' ');\n\n \t\t\n }", "function gameInitialize() {\n //Chooses a random word from the words array\n wordPicker = words[Math.floor(Math.random() * words.length)];\n console.log(wordPicker);\n\n\n for (var i = 0; i < wordPicker.length; i++){\n answerArray[i] = '_';\n }\n console.log(answerArray[i]);\n\n answer = answerArray.join(\" \");\n wrong\n\n\n}", "function pattern_1_answer() {\n return choice(['Goodday day to you too!', 'A good day to you too!', 'Hi there'\n , 'Hi there!', 'Hi back.', 'Hello there.', 'Hey!', 'Bonjour.', 'Gutentag.', 'Howdy!', 'Well hello there.', 'Greetings to you too.']);\n}", "function resetGame() {\n remainingGuesses = maxTries;\n document.getElementById(\"beginningMessage\").innerText = \"Press any letter to play.\";\n listOfWords = Math.floor(Math.random() * (wordChoices.length));\n guessedLetters = [];\n guessingWord = [];\n for (var i = 0; i < wordChoices[listOfWords].length; i++) {\n guessingWord.push(\"_\");\n }\n gameInfo();\n}", "function default_answer() {\n return choice(['Sorry, come again?', \"I don't understand.\", 'Can you try saying that differently?', 'Can you please repeat?', 'What do you mean?'\n , 'No comprendo...', 'Ne me quitte pas!', 'Pardon me?']);\n}", "function pickAWord() \n{\n\t\tcurrentWord = words[Math.floor(Math.random() * words.length)];\n\tfor(var i = 0; i < currentWord.length; i++)\n\t{\n\t\tanswer[i] = \"_\";\n\t\tdocument.getElementById(\"blanks\").innerHTML = answer;\n\n\t\t// removing the commas from in between the lines.\n\t\tvar remove = document.getElementById(\"blanks\");\n\t\tremove.innerHTML = answer.join(\" \");\n\t\t\n\t}\n}", "function default_answer() {\n return choice(['Speak English, mothaf*ckah!', \"What ya sayin'?\", \"Try again.\", \"Computer says no.\", \"Error: 0 f*cks found.\"]);\n}", "guessedWord() {\n return this.state.answer.split(\"\").map(letter => (this.state.guessed.has(letter) ? letter : \" _ \"));\n }", "function init() {\n //picks a random number and matches it to a letter\n currentWord = words[Math.floor(Math.random()*words.length)];\n wordHint.textContent = currentWord.split(\"\").map(letter => letter = \"__\").join(\" \");\n}", "function recordChoice(e) {\n var c = this.getAttribute('name').replace(/[^\\d]*/,'');\n saveChoice(c);\n}", "function resetGame() {\n remainingGuesses = 10;\n lettersGuessed = [];\n answerArray = [];\n targetWord = wordList[Math.floor(Math.random() * wordList.length)]\n remainingLetters = targetWord.length;\n for (var i = 0; i < targetWord.length; i++) {\n answerArray[i] = \"_ \";\n }\n}", "function resetQuestion(questionId){\n\tvar optionsCount = choices[questionId].length;\n\t\n\tfor(var i=0;i<optionsCount;i++){\n\t\t//document.getElementById('answer_'+questionId+'_'+i).checked = false;\n\t\tdocument.getElementById('label_'+questionId+'_'+i).className = \"\";\n\t\tdocument.getElementById('question_'+questionId).className = \"question\";\n\t}\n\t\n\t//document.getElementById('limpiar_' + questionId).innerHTML = '';\n\tdocument.getElementById('result_' + questionId).innerHTML = \"\";\n\tdocument.getElementById('info_' + questionId).innerHTML = \"\";\n\t\n\t//useranswers[questionId] =-1;\t\n}", "function clearAnswer () {\n // minimal appearance\n if (fieldProperties.APPEARANCE.includes('minimal') === true) {\n selectDropDownContainer.value = ''\n }\n // likert appearance\n else if (fieldProperties.APPEARANCE.includes('likert') === true) {\n var selectedOption = document.querySelector('.likert-input-button.selected')\n if (selectedOption) {\n selectedOption.classList.remove('selected')\n }\n }\n // all other appearances\n else {\n var selectedOption = document.querySelector('input[name=\"opt\"]:checked')\n if (selectedOption) {\n selectedOption.checked = false\n selectedOption.parentElement.classList.remove('selected')\n }\n }\n}", "function updateMovieTitle( answer ) {\n $k = $('.shown-letter:first');\n for ( i in answer ) {\n\tif ( answer.charAt(i) != '_' ) {\n\t $k.addClass('shown-space').text( answer.charAt(i) );\n\t} else { \n\t $k.addClass('shown-letter').html('&nbsp;');\n\t}\n\t$k = $k.next();\n }\n}", "function resetGame() {\n answer = choices[Math.floor(Math.random() * choices.length)];\n lives = 10;\n wrongArray = [];\n emptyWord = [];\n countBlank = answer.length;\n console.log(answer);\n createWord();\n }", "function choice0() {\n selectAnswer(0);\n}", "function reset()\n{\n\ttargetWord = \"\";\n\ttargetWordArray = [];\n\twrongLetters = [];\n\tcorrectLetters = [];\n\tdisplayWord = [];\n\tremainingGuesses = 10;\n\n}", "function resetGame() {\n // choose new word\n chosenGame = gameArray[Math.floor(Math.random() * gameArray.length)];\n console.log(chosenGame);\n\n //redo the length of the string\n nameLength = chosenGame.length;\n\n // reset guesses to original amount\n guessRemaining = 12;\n\n // clear out the arrays\n guessArray = [];\n splitArray = [];\n underScore = [];\n\n // regenerate underscores\n underScoreFunc();\n\n // print out the underscores to html document\n underline.innerHTML = \"Word: \" + underScore;\n\n // repopulate splitArray with \"_\"'s\n splitLetter();\n\n}", "function resetWord() {\n if (initialLoadSound) {\n playAudio();\n initialLoadSound = false;\n }\n gameOver = false;\n chgPlayButtonText();\n hintButtonHidden();\n clearMessages();\n targetWords = [];\n guessedWord = [];\n targetWords = [\"RED DRUM\", \"TUNA\", \"MARLIN\", \"TILEFISH\", \"GROUPER\", \"BLACK SEABASS\", \"WAHOO\", \"TARPON\", \"MAHI MAHI\", \"SPECKLED TROUT\", \"BLUEFISH\", \"CROAKER\", \"FLOUNDER\", \"COBIA\", \"WHITE PERCH\", \"TAUTOG\", \"SPOT\", \"MACKEREL\", \"STRIPED BASS\", \"SPADEFISH\"];\n //targetWords = [\"MACKEREL\", \"BLACK SEABASS\", \"MAHI MAHI\", \"WHITE PERCH\", \"RED DRUM\"];\n randomWord = \"\";\n unUsedAlpha = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\", \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\"];\n usedAlpha = [];\n randomWord = targetWords[Math.floor(Math.random() * targetWords.length)];\n hold.textContent = \"\";\n guessedWord = [];\n targetLetter = [];\n matchedLetter = false;\n validLetter = false;\n prevUsed = false;\n numMatchLetters = 0;\n incorrectGuesses = 0;\n statusMsg.textContent = \"\";\n console.log(randomWord);\n console.log(\"--------------\");\n \n // BUILDING targetLetter ARRAY OF THE randomWord SELECTED WORD\n for (var i = 0; i < randomWord.length; i++) {\n var singleLetter = randomWord.substr(i,1);\n if (singleLetter === \" \") {\n guessedWord.push(\"\\u00A0\");\n numMatchLetters++;\n }\n else {\n guessedWord.push(\"_\");\n }\n targetLetter.push(singleLetter);\n hold.textContent = hold.textContent + \" \" + guessedWord[i];\n wrongGuess.textContent = \"\";\n }\n }", "function resetChoices(){\n\t\t$(\"#choices_list\").empty();\n\t}", "function removeUSERChoice(){\r\n USER_CHOICE = [\"\",\"\",\"\"];\r\n}", "function chooseWord () {\n var word = words[Math.floor(Math.random() * words.length)];\n answer = word.toUpperCase();\n hiddenWord(answer);\n}", "function snake(words) {\n var adapt = words.replace(/-/g, \"_\"); // g = global\n return adapt;\n }", "function setRadioChoice(origAnswer, sBlank, resObj)\n{\n // Finds index number of chosen option.\n var matchIndex = resObj.optionList.indexOf(origAnswer);\n\n if (matchIndex >= 0 && matchIndex < resObj.optionList.length)\n {\n // Known option chosen.\n resObj.chosenOption = matchIndex;\n resObj.enabledFlag = 1;\n }\n else if (origAnswer.length > 0 && resObj.customEnabled === true)\n {\n // Other option entered.\n resObj.customText = origAnswer;\n resObj.enabledFlag = 1;\n }\n else if (sBlank === true)\n {\n // Skip blank answer.\n resObj.customText = \"\";\n resObj.enabledFlag = -1;\n }\n else\n {\n // Include blank answer.\n resObj.chosenOption = -1;\n resObj.enabledFlag = 0;\n }\n}", "function letterCheck() {\n unknown.forEach((x, i) => {\n if (guess.localeCompare(unknown[i], \"en\", { sensitivity: \"base\" }) == 0) {\n underscores[i] = unknown[i];\n }\n document.getElementById(\"mysteryWord\").innerHTML = underscores.join(\"\");\n });\n}", "function option8(input, output) {\n console.log(\"option8\");\n var words = input.value.toLowerCase().split(/[ -]+/);\n for (var i = 0; i < words.length; i++) {\n words[i] = words[i].charAt(0).toUpperCase() + words[i].substring(1); \n }\n output.value = words.join(' ');\n}", "function clearInput(){\n\tpenultimateword = previousword;\n\tpenultimateword = wordcheck(penultimateword,'zzzzz')\n\tpreviousword = typedword.join(\"\");\n\tpreviousword = wordcheck(previousword,'yyyyy')\n\ttypedword = [];\n\tevalword = \"\";\n\tbasechoicearray = [];\n\tABarray = [];\n\tABCarray = [];\n\tfinalchoicearray = [];\n\tpotentialword = true;\n\tpredictNext();\n}", "function generateUnderscore() {\n let builtWord = \"\";\n for(let i = 0; i < choosenWord.length; i++) {\n var guessed = false;\n for(var j = 0; j < guessedLetters.length; j++){\n if (guessedLetters[j] == choosenWord[i]){\n guessed = true;\n }\n }\n\n if(guessed){\n builtWord += choosenWord[i]\n }\n else{\n builtWord += \"_\";\n }\n\n }\n return builtWord;\n}", "function replace() {\n for (var i = 0; i < holdWord.length; i++) {\n replaceArr = replaceArr + holdWord[i].replace(holdWord[i], \"_\");\n document.querySelector(\"#random-word\").innerHTML = replaceArr;\n }return replaceArr;\n}", "function resetQuestions()\n{\n questions = [\n {\n \"q\": \"What keyword is used to declare a variable?\",\n \"o\": [\"const\", \"var\", \"let\", \"all of the above\"],\n \"a\": 3, // o[3] is the answer\n \"getAnswer\": function() { return this.o[this.a]; }\n },\n {\n \"q\": \"What is the correct syntax to print a page?\",\n \"o\": [\"browser.print()\", \"navigator.print()\", \"window.print()\", \"document.print()\"],\n \"a\": 2, // o[2] is the answer\n \"getAnswer\": function() { return this.o[this.a]; }\n },\n {\n \"q\": \"Which built-in method removes the last element from an array and returns it?\",\n \"o\": [\"last()\", \"pop()\", \"get()\", \"none of the above\"],\n \"a\": 1, // o[1] is the answer\n \"getAnswer\": function() { return this.o[this.a]; }\n },\n {\n \"q\": \"Which built-in method reverses the order of the elements of an array?\",\n \"o\": [\"reverse()\", \"flip()\", \"zToA()\", \"mirror()\"],\n \"a\": 0, // o[0] is the answer\n \"getAnswer\": function() { return this.o[this.a]; }\n },\n {\n \"q\": \"Which of the following function of String object extracts a section of a string and returns a new string?\",\n \"o\": [\"split()\", \"slice()\", \"section()\", \"cut()\"],\n \"a\": 1, // o[1] is the answer\n \"getAnswer\": function() { return this.o[this.a]; }\n },\n {\n \"q\": \"What is the HTML tag under which one can write the JavaScript code?\",\n \"o\": [\"javascript\", \"script\", \"js\", \"code\"],\n \"a\": 1, // o[1] is the answer\n \"getAnswer\": function() { return this.o[this.a]; }\n },\n {\n \"q\": \"What method is used to display an alert box?\",\n \"o\": [\"popUp()\", \"display()\", \"alert()\", \"log()\"],\n \"a\": 2, // o[2] is the answer\n \"getAnswer\": function() { return this.o[this.a]; }\n },\n {\n \"q\": \"Inside of the script tag, how do you link to an external .js file?\",\n \"o\": [\"src=\\\"filepath\\\"\", \"href=\\\"filepath\\\"\", \"ref=\\\"filepath\\\"\", \"path=\\\"filepath\\\"\"],\n \"a\": 0, // option 1 is the answer\n \"getAnswer\": function() { return this.o[this.a]; }\n },\n {\n \"q\": \"for (var x = 0; x <= 5; x++) { window.alert(\\\"Hello\\\"); }\\nHow many time's will an alert window pop up?\",\n \"o\": [\"1\", \"4\", \"5\", \"6\"],\n \"a\": 3, // o[3] is the answer\n \"getAnswer\": function() { return this.o[this.a]; }\n },\n {\n \"q\": \"var x = 0; if (x == 0) { let x = 10; } console.log(x) \\nWhat is logged to the console?\",\n \"o\": [\"10\", \"0\", \"5\", \"error\"],\n \"a\": 1, // o[1] is the answer\n \"getAnswer\": function() { return this.o[this.a]; }\n }\n ];\n}", "function assignAnswer() {\r\n\t\tcorrectAnswerNum = Math.floor((Math.random() * 4) + 1);\r\n\t\tvar tempLetterNum = Math.floor(Math.random() * itemArray.length);\r\n\t\tvar tempWordNum = Math.floor(Math.random() * 3);\r\n\t\tcorrectAnswerText = itemArray[tempLetterNum][tempWordNum].word;\r\n\t\tfor (var i = 1; i <= 4; i++) {\r\n\t\t\tif (i !== correctAnswerNum) {\r\n\t\t\t\tbadAnswerText = itemArray[Math.floor(Math.random() * itemArray.length)][Math.floor(Math.random() * 3)].word;\r\n\t\t\t\twhile (badAnswerText === correctAnswerText) // prevent duplicate of correct answer displaying\r\n\t\t\t\t\tbadAnswerText = itemArray[Math.floor(Math.random() * itemArray.length)][Math.floor(Math.random() * 3)].word;\r\n\t\t\t\t$('#answer' + i).html(badAnswerText);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$('#answer' + i).html(correctAnswerText);\r\n\t\t\t}\r\n\t\t}\r\n\t\t$('#quiz-pic').attr('src', itemArray[tempLetterNum][tempWordNum].image);\r\n\t\t$('#quiz-pic').attr('alt', itemArray[tempLetterNum][tempWordNum].word);\r\n\t}", "function setRandomQues(){\n randomQues = randomNumber(0, VocabSets.length-1);\n setScreen(\"questionScr\");\n setText(\"questionLbl\", VocabSets[randomQues].meera +\" はどういう意味ですか? \");\n //countriesSets.splice(randomQues, 1);\n randomAnswerBtns(randomQues);\n}", "function resetGame() {\n guessesRemaining = guessesAllowed;\n currentWordIndex = Math.floor(Math.random() * (wordList.length));\n usedLetters = [];\n currentWord = [];\n\n for (var i = 0; i < wordList[currentWordIndex].length; i++) {\n currentWord.push(\"_\");\n } \n\n // document.getElementById(\"pressKeyToStart\").style.cssText= \"display: none\";\n document.getElementById(\"family\").style.cssText = \"display: block\";\n document.getElementById(\"you-lose\").style.cssText = \"display: none\";\n document.getElementById(\"you-win\").style.cssText = \"display: none\";\n\n updateDisplay();\n}", "function convertChoices(choice) { // for readability\n if (choice === 'rock') return 'Rock';\n if (choice === 'paper') return 'Paper';\n if (choice === 'scissors') return 'Scissors';\n if (choice === 'lizard') return 'Lizard';\n return 'Spock';\n}", "function newGame(){\n answer_word = words[Math.floor(Math.random() * words.length)];\n guess_count = 7;\n masked_word = hideWord(answer_word);\n incorrect_letter_guesses = new Set();\n $(\".guess-title\").text(\"Your Guesses\");\n $(\".panel-title\").text(\"Guess the Word\");\n $(\".hint\").text(\"Hint: Animal\");\n $(\"#result\").text(masked_word);\n}", "function updateQuestion(result) {\n answers = result.answers;\n possibleAnswers = result.answers.length\n solutionIndex = result.solution_index;\n var answerString = \"\";\n var j = 0;\n var prev_j = [];\n var temp_j = 0;\n for (var i = 0; i < possibleAnswers; i ++)\n { \n temp_j = getRandomInt(0, possibleAnswers);\n while(prev_j.indexOf(temp_j) != -1)\n {\n temp_j = getRandomInt(0, possibleAnswers);\n }\n prev_j.push(temp_j);\n if (temp_j == solutionIndex)\n {\n answerString += \"<input type='radio' id='sol' name='answerChoice' value='\" + i.toString() + \"'>\" + answers[temp_j] + \"<br>\";\n }\n else\n {\n answerString += \"<input type='radio' name='answerChoice' value='\" + i.toString() + \"'>\" + answers[temp_j] + \"<br>\";\n }\n }\n $('#answerChoices').html(answerString);\n\n\n flag = \"false\";\n $('#question').text(result.question_title);\n $('.score', element).text(result.score);\n }", "function resetfunc() {\n \n numberguessed=0;\n numberremaining = totalguess-numberguessed;\n singerlist=[\"Adele\",\"Taylor\",\"Beyonce\",\"Rihanna\",\"Madonna\"];\n computerGuess = singerlist[Math.floor(Math.random() * singerlist.length)];\n comGuessLower = computerGuess.toLowerCase();\n rightword =[];\n document.getElementById(\"wordguessed\").innerHTML='';\n document.getElementById(\"letterguessed\").innerHTML='';\n bingoLetter=0;\n for (var i=0;i<computerGuess.length;i++) {\n document.getElementById(\"wordguessed\").innerHTML+='<span class=\\\"guessformat\\\">-</span>';\n rightword[i]=comGuessLower.substring(i,i+1);\n // console.log(rightword[i]);\n }\n}", "function authorSetup(){\r\n\t sentenceString=prompt(\"Input a sentence for a Madlib.\");\r\n\t sentence=sentenceString.split(\" \");\r\n\t toReplace=prompt(\"Number of words to replace?\");\r\n\t for(i=0; i<toReplace; i++){\r\n\t\t replaceIndex=prompt(\"Replace which word in sentence?\");\r\n\t\t replaceIndex--;\r\n\t\t replacements[i]=replaceIndex;\r\n\t\t let partOfSpeech=prompt(\"What part of speech is \"+sentence[replaceIndex]+\"?\");\r\n\t\t sentence[replacements[i]]=partOfSpeech;\r\n\t }\r\n\t alert(\"Thanks, Author! Go get player now.\");\r\n\t playerPopulate();\r\n }", "updateAnswer(self){\n\t\tself.props.updateSelectedAnswer(self.props.letter);\n\t}", "function clearAllAnswers(){\n $('input').val('');\n $('.mark').text('❓');\n}", "function playGame() {\n //get random secret word\n secretWord = (hangmanWords[Math.floor(Math.random() * hangmanWords.length)]).toUpperCase();\n //make secret word into an array\n secretWordArray = secretWord.split(\"\");\n\n //get number of letters to replace with underscores\n underscores = secretWord.length;\n for (var i = 0; i < underscores; i++) {\n underscoreArray[i] = \"_\";\n }\n $(\"#secretWordOutput\").text(underscoreArray.join(\" \"));\n $(\"#wrongGuessesOutput\").hide();\n }", "function restartGame() {\n answer = words[Math.floor(Math.random() * words.length)];\n answerArray = answer.split(\"\");\n numberOfSpaces = answerArray.length;\n displayedAnswer = [];\n for (var i = 0; i < numberOfSpaces; i++) {\n displayedAnswer.push(\"_\");\n }\n document.getElementById(\"answerSpace\").innerHTML = displayedAnswer.join(\" \");\n badGuess = [];\n document.getElementById(\"incorrectGuesses\").innerHTML = badGuess.join(\" \");\n chances = 6;\n document.getElementById(\"remainingGuesses\").innerHTML = chances;\n}", "function initialSet() {\n // Initialize values\n winCounter = 0;\n current = answers[r(answers.length)];\n answer = current.name;\n hint = current.hint;\n remaining = answer.length;\n numGuesses = Math.round(remaining * 1.5); // Gives more guesses for long words, and fewer guesses for short words\n usedLetters = [];\n usedCorrect = [];\n gameOver = false;\n\n // Hide aanswer\n maskAnswer();\n\n // Set HTML\n winCounterField.innerHTML = winCounter;\n numGuessesField.innerHTML = numGuesses;\n}", "function resetCompChoice() {\n compGuess = compChoices[Math.floor(Math.random() * compChoices.length)];\n}", "function reset () {\n answer = \"\";\n if (questionCount < questions.length) {\n $(\".game\").html(\"\");\n $(\"#choices\").html(\"\");\n questionSetup();\n time = 20;\n }\n else {\n finish();\n }\n }", "function start(){\n for (var i = 0; i < randomword.length; i ++){\n answerArray[i] = \"_\"\n }\n // s = answerArray.join(' ')\n // document.getElementById('currentword').innerHTML = s\n }", "decodeAnswers(type, answers) {\n var correct = [];\n for (var i = 0; i < answers.length; i++) {\n if (type == \"multichoice\" || type == \"multichoiceset\") {\n correct.push(answers[i].toLowerCase().charCodeAt(0) - 97);\n }\n }\n return correct;\n }", "function addChoices() {\n if (firstType == true)\n choices = choices.concat(lowcaseChar);\n if (secondType == true)\n choices = choices.concat(upcaseChar);\n if (thirdType == true)\n choices = choices.concat(numericChar);\n if (fourthType == true)\n choices = choices.concat(specialChar);\n}", "function answer() {\n\tdocument.querySelector(\"#currentWord\").innerHTML = answerArray.join(\" \").toUpperCase();\n}", "function cute(){\n vm.input = vm.input.concat(\"😊\");\n }", "randomChoices(wordParts, roots) {\n let wordRoots = _.filter(wordParts, (c) => c.type === 'root' && c.valueUnsolved.includes('_'))\n wordRoots = _.map(wordRoots, (root) => ({ 'value': root.valueSolved, 'definition': root.definition, 'isAnswer': 'true' }));\n let choices = _.nRandom(_.toArray(roots), this.state.choiceCount * 2);\n choices = _.reject(choices, (root) => _.contains(_.pluck(wordRoots, 'value').concat(this.state.solvedRoots), root.value));\n choices = choices.slice(0, this.state.choiceCount - wordRoots.length).concat(wordRoots);\n return _.shuffle(choices)\n }", "function del() {\n \"use strict\";\n // Listen to the answer box....\n var value = document.getElementById(\"answerBox\").value;\n // Subtract the typo from the answer box!\n document.getElementById(\"answerBox\").value = value.substr(0, value.length - 1);\n}", "function resetVariables(){\n\n userChoice = \"\";\n current = \"\";\n answerArray = [];\n randomArray = [];\n var answerA = \"\";\n var answerB = \"\";\n var answerC = \"\";\n var answerD = \"\";\n}", "function pattern_1_answer() {\n return maybe(['Well... ', 'Hmmm... ']) + 'I ' + choice(['can see', 'foresee','see']) + ' ' \n + choice(['so much','no good','only the best']) + ' ' + choice(['fortune','luck','opportunities']) + ' for you...';\n}", "function choice(...alternatives) {\n const altsDefs = _.map(alternatives, alt => {\n return new Flat({ definition: toDefinition(alt) })\n })\n\n const orgTextParts = _.map(alternatives, toOriginalText)\n\n const definition = new Alternation({ definition: altsDefs })\n definition.orgText = `choice(${orgTextParts.join(\", \")})`\n\n return {\n toRule: toRule,\n definition: definition\n }\n}", "function reset(){\n word = dictionary[Math.floor(Math.random() * dictionary.length)];\n lettersGuessed = [];\n start = document.getElementById('blankWord').innerHTML = \"_\".repeat(word.length);\n wordLength = word.length;\n arrWord = word.split(\"\");\n output = start.split(\"\");\n guesses = 10;\n}", "function replace_with_underscore(l) {\n var r = l.replace(/[^a-z0-9\\s]/gi, '_').replace(/ /g,'_');\n return r;\n}", "function questions() {\n return {\n 1: {\n ques: \"Archipiélago conocido como 'Las afortunadas'.\",\n ans: \"ISLAS CANARIAS\",\n showAns: \"I**AS **N*R*AS\"\n },\n 2: {\n ques: \"¿Cómo se llama el satélite de planeta Tierra?\",\n ans: \"LUNA\",\n showAns: \"L**A\"\n },\n 3: {\n ques: \"¿Cuál es la capital de Arizona?\",\n ans: \"PHOENIX\",\n showAns: \"P**E**X\"\n },\n 4: {\n ques: \"Personajes que han salido en todas las pelicula de Star Wars:\",\n ans: \"R2-D2 y C-3PO\",\n showAns: \"R*-D* y C-**O\"\n },\n 5: {\n ques: \"¿De qué color es el caballo blanco de Santiago?\",\n ans: \"BLANCO\",\n showAns: \"B**N*O\"\n },\n 6: {\n ques: \"¿Cómo se llama el mejor de amigo de John Snow?\",\n ans: \"SAMWELL TARLY\",\n showAns: \"S**W**L T*RL*\"\n },\n 7: {\n ques: \"¿En qué año se firmó la declaración de independencia de EEUU?\",\n ans: \"1776\",\n showAns: \"1**6\"\n }\n };\n}", "function resetFunc() {\n chosenWord = words[randomNum()];\n imgDiv.removeChild(imgDiv.childNodes[2]);\n newPicture();\n guessremainingNum = 5;\n guessremainingNumSpan.innerHTML = guessremainingNum;\n rightWordArray = [];\n wrongWordArray = [];\n underScore = [];\n docUnderScore[0].innerHTML = generateUnderscore().join(\" \");\n}", "function replaceLettersWithBlanks() {\n\tfor (var i = 0; i < randomCoffee.length; i++) {\n\t\tif (randomWord[i]) {\n\t\t\tcurrentCoffee.push(\" \");\n\t\t}\n\t\telse {\n\t\t\tcurrentCoffee.push(\"_\");\n\t\t}\n\n\t}\n}", "function populateQuestionAnswer(question) {\n // console.log($questionText);\n $questionText.text(question.fields.question);\n var answers = [question.fields.correctAnswer, question.fields.wrongAnswer1, question.fields.wrongAnswer2, question.fields.wrongAnswer3];\n for (var i = 0; i < answers.length; i++) {\n $(\"#answer\" + questionOrder.indexOf(i)).text(answers[i]);\n }\n}", "function setQuestion() {\n h2.innerText = questions[q].question;\n choiceA.innerText = questions[q].choices[0];\n choiceB.innerText = questions[q].choices[1];\n choiceC.innerText = questions[q].choices[2];\n choiceD.innerText = questions[q].choices[3];\n\n q++;\n\n setBG();\n clearAnswer();\n results();\n}", "function generateChoice() {\n if(selectNumbers) {\n chosenCharSets += numbers;\n } if(selectUpper) {\n chosenCharSets += uppercase;\n } if(selectLower) {\n chosenCharSets += lowercase;\n } if(selectSpecial) {\n chosenCharSets += specialChars;\n }\n}", "function generateQuestion() {\n // Randomly select a question from the array\n currentQuestion = questions[Math.floor(Math.random() * questions.length)];\n\n // Update the question text in the HTML\n document.getElementById(\"question\").innerHTML =\n \"Spell the number \" +\n currentQuestion.number +\n \" in \" +\n currentQuestion.language +\n \":\";\n\n // Clear the answer input field\n document.getElementById(\"answer\").value = \"\";\n // Set the cursor to the answer input field\n document.getElementById(\"answer\").focus();\n}", "function newWord() {\n\n //Picks a random word from our list\n gameWord = wordJar[Math.floor(Math.random() * wordJar.length)];\n\n //Should stop the same word from being chosen twice in a row.\n if (gameWord === previousWord) {\n newWord();\n }\n\n\n //Loops through the gameWord and creates an array of underscores\n for (var i = 0; i < gameWord.length; i++) {\n answerWord[i] = \"_\";\n }\n\n //Displays the word as underscores. innerHTML should prevent a shorter word from not displaying properly on new game.\n document.getElementById(\"underscore-word\").innerHTML = answerWord.slice(\"\").join(\" \");\n console.log(\"gameWord: \", gameWord); //Dev tools cheatcodes.\n\n //Displays the ammount of guesses remaining.\n document.getElementById(\"remaining-guesses\").innerHTML = (\"Guesses Remaining: \" + wrongGuesses);\n\n remainingLetters = answerWord.length; //Sets the variable remaining letter to the length of our word.\n console.log(\"Remaining Letters: \", remainingLetters);\n}", "function reset (){\n\n remainingGuesses = maxAttempts;\n\n starting = false;\n \n currentWord = Math.floor(Math.random() * (options.length)); //for selecting random word\n\n console.log(options[currentWord]);\n \n //^^? options[Math.floor(Math.random() * options.length)]\n\n lettersGuessed = []; \n\n chosenWord = []; \n\n // document.getElementById(\"hangman\").src = \"\";\n \n for(var i = 0; i < options[currentWord].length; i++);{// I'm nesting the currentWordsIndex\n\n chosenWord.push(\" _ \"); // variable within the main array I needed a way to clear the array and save the word being guessed while that current word being disguised by \"_\".\n\n }\n // document.getElementById(\"hangman\");\n \n // .style.cssText=\"display:none\";\n \n // document.querySelector(\"try-again\");\n \n // .style.cssText= \"display: none\"; //display:none works...\n\n // document.getElementsByClassName(\"game-over\");\n \n // .style.cssText= \"display: none\"; //as a css attr...\n \n // document.getElementsByClassName(\"congrats\");\n \n // .style.cssText= \"display: none\"; //JS is longer...\n\n updateDisplay();\n\n}", "function wordSelector () {\n chosenWord = words[Math.floor(Math.random() * words.length)];\n letters = chosenWord.split(\"\")\n blanks = letters.length\n\n guesses = 7;\n wrong = [];\n changingBlanks = [];\n//adding _ to blanks\nfor(var i=0; i<blanks; i++){\n\tchangingBlanks.push(\"_\");\n}\n//reseting counters\ndocument.getElementById(\"wordBlanks\").innerHTML = changingBlanks.join(\" \");\ndocument.getElementById(\"guesses\").innerHTML = guesses;\ndocument.getElementById(\"wins\").innerHTML = wins;\ndocument.getElementById(\"losses\").innerHTML = losses;\n\n\n}", "function inflect (x) {\n return inflectKeys ? inflection.camelize(underscore(x), true) : x\n }", "function generateUnderScore() {\n for (var i=0; i < chosenWord.length; i++) {\n underScore.push('_');\n $underScore.textContent = underScore.join(' ');\n };\n}", "function proverka(input) { \n var value = input.value; \n var rep = /[-\\.;\":'/a-zA-Zа-яА-Я ]/; \n if (rep.test(value)) { \n value = value.replace(rep, ''); \n input.value = value; \n }\n }", "revealAnswer() {\n if (!this.revealedAllAnswers()) {\n var choice = this.revealedAnswers.length;\n this.revealedAnswers.push({\n text: this.orderedChoices[choice],\n choice: this._getShuffledChoiceIndex(choice)\n });\n }\n }", "function generateUnderscore() {\n for (let i = 0; i < chosenWord.length; i++) {\n underScore.push('_');\n docUnderScore[0].innerHTML = underScore.join(' ');\n }\n return underScore;\n}", "function translate(str){\r\n\treturn str.replace(\"_\",\" \");\r\n}", "function setAnswer(clicked_id) {\n ansChoice = clicked_id;\n}", "function tx_pttools_formTemplateHandler_setchoice(fname)\n{\n\tvar selname = \"choices-\" + fname;\n\tvar selector = document.getElementById(selname);\n\tdocument.getElementById(fname).value\n\t\t= selector.options[selector.selectedIndex].text;\n\treturn true;\n}", "function underline(){\r\n\r\n underscore = [];\r\n for(let i=0;i<theWord.length;i++){\r\n underscore.push('_');\r\n }\r\n document.getElementById('wordToGuess').textContent= underscore.join(\" \");\r\n\r\n document.getElementById('lives').textContent=guesslift;\r\n}", "function confirmOption() {\n var number = confirm(\"Use Numbers?\");\n var upper = confirm(\"Use Uppercase?\");\n var lower = confirm(\"Use Lowercase?\");\n var special = confirm(\"Use Special Characters?\");\n if (number) {\n chosenCharSets += numbers;\n }\n if (upper) {\n chosenCharSets += uppercase;\n }\n if (lower) {\n chosenCharSets += lowercase;\n }\n if (special) {\n chosenCharSets += specialChars;\n }\n}", "function _reuseOldInput($step) {\n\t\t\tif($step.given_answer) {\n\t\t\t\tswitch($step.type) {\n\t\t\t\t\tcase 'single_choice':\n\t\t\t\t\t\t$(\".single-choice-button\").each(function(k) {\n\t\t\t\t\t\t\tif($step.given_answer == $(this).data('value')) {\n\t\t\t\t\t\t\t\t$(this).find('i').fadeIn(200);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'multiple_choice':\n\t\t\t\t\t\t$(\".fancy-checkbox\").each(function(k) {\n\t\t\t\t\t\t\tvar $button = $(this).find(\"button\");\n\t\t\t\t\t\t\tif($step.given_answer.indexOf($button.data('value')) != -1) {\n\t\t\t\t\t\t\t\tCheckboxBeautifier.selectButton($button);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'form':\n\t\t\t\t\t\t$(\"input\").each(function(index) {\n\t\t\t\t\t\t\tif($step.given_answer[index]) {\n\t\t\t\t\t\t\t\t$(this).val($step.given_answer[index]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'multiple_image_choice':\n\t\t\t\t\t\tvar $konut_choices = wizard.find('.multiple-image-choice');\n\t\t\t\t\t\t$konut_choices.each(function(index) {\n\t\t\t\t\t\t\tif($step.given_answer.indexOf($(this).data('slug')) != -1) {\n\t\t\t\t\t\t\t\tvar $temp = $(this);\n\t\t\t\t\t\t\t\t$temp.isAvailable = true;\n\t\t\t\t\t\t\t\t_selectElement('multiple_image_choice', $temp);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'textarea':\n\t\t\t\t\t\twizard.find(\"textarea\").val($step.given_answer);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}" ]
[ "0.6386277", "0.627673", "0.61543065", "0.6084246", "0.6079077", "0.6040663", "0.603598", "0.6027314", "0.5999531", "0.597429", "0.5945652", "0.5882538", "0.5868245", "0.5856779", "0.57972497", "0.5784572", "0.5782554", "0.57776624", "0.5749242", "0.57344586", "0.5732477", "0.572232", "0.5712021", "0.570928", "0.5705597", "0.57013124", "0.5666988", "0.5652661", "0.5643245", "0.5628802", "0.56271505", "0.56238717", "0.5593346", "0.55604273", "0.5524133", "0.55205977", "0.55156094", "0.54962045", "0.54850805", "0.54850376", "0.5460765", "0.54593396", "0.5455298", "0.54369444", "0.54327697", "0.5430245", "0.5429479", "0.54293495", "0.5426379", "0.54196185", "0.53893095", "0.5384692", "0.5383741", "0.53801656", "0.5366837", "0.5365057", "0.5352993", "0.5351792", "0.5344522", "0.5333288", "0.5323565", "0.53208834", "0.53163695", "0.5315708", "0.53120095", "0.53100044", "0.5309143", "0.5305086", "0.5297947", "0.5294235", "0.5278947", "0.52674085", "0.5266528", "0.5262313", "0.5252274", "0.5251038", "0.524759", "0.524685", "0.5242708", "0.5241375", "0.5238336", "0.5238055", "0.52356136", "0.5235079", "0.5229869", "0.522956", "0.52268475", "0.5223303", "0.52220434", "0.52202016", "0.52187777", "0.52049017", "0.5203151", "0.5202795", "0.5202514", "0.5196994", "0.5196774", "0.5191452", "0.5187404", "0.5184302", "0.51838267" ]
0.0
-1
Check if all roots have been solved, fill in remaining components, and advance to next question
checkSolution() { if (this.state.solvedRoots.length === this.state.wordRoots.length) { const solution = this.fillIn(null, true) this.setState({ answerParts: solution }); setTimeout(() => this.props.nextQuestion(this.state.autohintOn), 1500); } else { this.setState({choices: this.randomChoices(this.state.answerParts, this.state.allRoots) }, this.autohint) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "fillIn(root, solveAll) {\n return _.map(this.state.answerParts, (part) => {\n if (solveAll || part.valueSolved === root.toLowerCase()) { part.valueUnsolved = part.valueSolved };\n return part;\n });\n }", "solve(){\r\n\t\tif (this.solutionCount >= this.maxSolutions){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tfor (let y = 0; y < GRID_SIZE; y++){\r\n\t\t\tfor (let x = 0; x < GRID_SIZE; x++){\r\n\t\t\t\tif (this.grid[y][x] == BLANK){\r\n\t\t\t\t\tfor (let i = 1; i <= MAX_NUMBERS; i++){\r\n\t\t\t\t\t\tif (this.isValid(x,y,i)){\r\n\t\t\t\t\t\t\tthis.grid[y][x] = i;\r\n\t\t\t\t\t\t\tthis.solve();\r\n\t\t\t\t\t\t\tthis.grid[y][x] = BLANK;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.solutionCount++;\r\n\t\tthis.solutions.push(this.snapshot(this.grid));\r\n\t}", "solve() {\n if (this.open.length != 0) {\n //set current node to the first node in the sorted list\n this.current = this.open.shift();\n\n // check neighbor nodes\n this.checkNeighbors(this.current.x, this.current.y);\n\n //draw on the canvas\n drawCheck(this.current.x, this.current.y, 0);\n this.displayPathLength();\n\n //check if the goal was reached\n if (this.current.y == this.end.y && this.current.x == this.end.x) {\n this.open = [];\n }\n this.steps++;\n } else {\n this.showResult();\n active=false;\n }\n }", "solve () {\n while (true) {\n const node = this.findAnOpenNode()\n if (node === null) {\n return\n }\n\n const gcd = greatestCommonDivisor(node.problem.currentSize, node.problem.targetSize)\n if (gcd !== 1) {\n node.reduce(gcd)\n } else if (node.problem.currentSize < node.problem.targetSize) {\n node.rethrow()\n } else if (node.problem.currentSize % node.problem.targetSize === 0) {\n node.reduce(node.problem.targetSize)\n } else {\n node.tryReduce(node.problem.targetSize)\n }\n }\n }", "function checkSolution(){\n\t puzzleSolution;\n\t}", "solve(initialAssignment = null, getAllSolutions = true) {\n this.getAllSolutions = getAllSolutions;\n this.initialAssignment = initialAssignment;\n this._solutions = [];\n }", "function solve() {\n let solveFoundThisLoop = false;\n do {\n // Reset flag\n solveFoundThisLoop = false;\n\n // Eliminate candidates based on solved inputs\n eliminateCorrespondingCandidates();\n\n // Try to solve\n solveFoundThisLoop = trySolve();\n\n // Only executes if no solve has been found this loop\n if (!solveFoundThisLoop) {\n // Eliminate candidates based on block column/row interaction\n blockColRowInteraction();\n\n // Try to solve\n solveFoundThisLoop = trySolve();\n }\n\n // Debug Log\n console.log(\"Loop complete! hasBeenSolved is: \" + solveFoundThisLoop);\n } while (solveFoundThisLoop && !isSudokuComplete());\n\n}", "function solve()\n{\n\n /* re-seed with a random number */\n rnd.seed = Math.floor(Math.random() * 1000000000);\n \n /* initialize the flag */\n stop = false;\n \n /* Initialize the stack at the first element */\n var stack = [ { m: instance.start.m, n: instance.start.n, neighbors: dirs.shuffle() } ] ;\n \n /* Add a new breadcrumb every zillisecond */\n setTimeout(function() { solver(instance, stack) }, 10);\n \n /* Disable the form button again */\n document.forms.mazeform.slv.disabled = true;\n}", "onSolveClick() {\n const { startFacts, targetFacts, startBlockCheck, targetBlockCheck } = this.state\n\n if (\n // Worlds have not been initialised\n (!startFacts || !targetFacts)\n // Worlds do not have matching blocks\n || (startBlockCheck === null || startBlockCheck !== targetBlockCheck)\n ) {\n return null\n }\n\n // Solve world, save errors\n let solveError = null, steps = null, tree = NO_DECISIONS()\n try {\n steps = WorldSolver.solve(startFacts.clone(), targetFacts.clone(), tree)\n } catch (error) {\n solveError = error.toString()\n }\n\n this.setState({\n lastError: solveError,\n solving: false,\n steps: steps,\n decisions: tree\n })\n }", "solve()\n {\n let solved = false;\n this.updatePossibilities();\n\n while (! solved)\n {\n solved = true;\n rows:\n for (let i = 0; i < 9; i++)\n {\n cols:\n for (let j = 0; j < 9; j++)\n {\n if (Array.isArray(this.solution[i][j])\n && this.solution[i][j].length == 1)\n {\n solved = false;\n this.solution[i][j] = this.solution[i][j][0];\n this.updateRowPossibilities(i);\n this.updateColPossibilities(j);\n break rows;\n }\n }\n }\n }\n\n this.puzzleToPuzzleString(true);\n }", "function searchForSolutions() {\n\n do {\n do {\n do {\n //stops the function when the solution is found\n if (emptySquares === 0) {\n return;\n }\n console.log(\"searching cells\");\n //checks each individual cell and repeats if at least one was found\n } while (searchCells());\n console.log(\"searching rows, columns etc\");\n //checks each row, column and sector (that needs to be checked) and restarts if at least one is found\n } while (searchRowsEtc());\n console.log(\"resorting to last resort\");\n //checks last resort function to narrow down possibilities. This function stops and returns true as soon as anything is found\n } while (lastResort())\n}", "function initial() {\n //add sets for empty cell\n for (let i = 0; i < 9; i++) {\n solved[i] = [];\n for (let j = 0; j < 9; j++) {\n solved[i][j] = matrix[i][j];\n if (solved[i][j] == 0)\n solved[i][j] = new Set([1, 2, 3, 4, 5, 6, 7, 8, 9]);\n }\n }\n }", "function solveRestOfBoard() {\n if (BoardModel.state._priorState) {\n BoardModel.state = BoardModel.state._priorState;\n BoardView.renderState(BoardModel.state, 50);\n\n setTimeout(function() {\n // Show the next step in 40ms.\n solveRestOfBoard();\n }, 40);\n }\n else {\n BoardModel.state.computeCanMove();\n }\n }", "handleSolve() { \n if(!solving) {\n solving = true;\n grid = this.state.squares;\n for(let i = 0; i < 800; ++i) {\n if(grid[i] === 'p') {\n grid[i] = null;\n }\n if(!grid[i]) {\n document.getElementsByClassName('square')[i].style = 'background-color: white';\n }\n }\n visitedNodes = [];\n finalPath = [];\n //Deals with invalid grid\n if(!(start && end)) {\n this.setState({squares: grid});\n solving = false;\n alert('You must choose a start and an end!');\n return;\n }\n let solvable;\n if(algo === 1) {\n solvable = breadthFirstMain();\n } else if(algo === 2) {\n solvable = depthFirstMain();\n } else if(algo === 3){\n solvable = djikstrasMain();\n } else if(algo === 4){\n solvable = bellmanFordMain();\n } else {\n solvable = aStarMain();\n }\n let i = 0;\n let time = (algo == 4)? 5 : 10;\n //Displaying the result\n if(working) {\n let handle = setInterval(function() {\n if(visitedNodes.length !== 0) {\n colorGrid(i);\n }\n i = i + 2;\n if(i >= visitedNodes.length) {\n clearInterval(handle);\n if(solvable) {\n for(let i = finalPath.length - 1; i >= 0; i = i - 2) {\n document.getElementsByClassName('square')[finalPath[i - 1] * 40 + finalPath[i]].style = 'background-color: yellow';\n }\n } else {\n alert('No path found!');\n }\n solving = false;\n }\n }, time);\n } else {\n if(solvable) {\n for(let i = finalPath.length - 1; i >= 0; i = i - 2) {\n document.getElementsByClassName('square')[finalPath[i - 1] * 40 + finalPath[i]].style = 'background-color: yellow';\n }\n } else {\n alert('No path found!');\n }\n solving = false;\n }\n isSolved();\n }\n }", "function solve() {\n cheating = true;\n this.publish(puzzleS);\n}", "algxSolve()\n {\n const constraints = this.puzzleToClues();\n const coverMatrix = sudokuExactCoverMatrix();\n const solutionRows = algx(coverMatrix, constraints);\n\n this.rowsToSolution(solutionRows);\n this.puzzleToPuzzleString(true);\n }", "answered(root, isUser = false) {\n if (isUser || !this.state.autohintingPaused && (root !== undefined)) {\n const updatedAnswerParts = this.fillIn(root);\n const solvedRoots = this.state.solvedRoots.concat([root.toLowerCase()]);\n this.setState({\n answerParts: updatedAnswerParts,\n autohintingPaused: this.state.autohintOn && isUser,\n hint: Math.min(1, this.state.hint),\n solvedRoots: solvedRoots\n }, this.checkSolution);\n this.pauseAutohinting(isUser);\n }\n }", "function solve(board){\n for(let y = 0; y < 9; y++){\n for(let x = 0; x < 9; x++){\n if (board[y][x] == 0){\n for(let number = 1; number < 10; number++){\n if (checkRulesAtPoint(x, y, number, board)){\n board[y][x] = number;\n // console.log(board);\n // console.log('\\n');\n solve(board);\n board[y][x] = 0;\n }\n }\n return;\n }\n }\n }\n for(let x = 0; x < 9; x++){\n for(let y = 0; y < 9; y++){\n returnedInformation[y][x] = board[y][x];\n }\n }\n}", "function trySolve() {\n let solutionFound = false;\n for (row = 1; row <= 9; row++) {\n for (col = 1; col <= 9; col++) {\n // If unsolved, attempt to solve\n if (!isSolved(row, col)) {\n // Solve input if there's only one candidate\n // Select location depending on row and col\n let location = document.querySelector('[data-row=\"' + row + '\"][data-col=\"' + col + '\"]');\n // Parse JSON\n candidates = JSON.parse(location.dataset.candidates);\n // If only one candidate at location, set location's value\n if (candidates.length == 1) {\n location.value = candidates[0];\n solutionFound = true;\n }\n }\n }\n }\n return solutionFound;\n}", "function findSoln() {\n\n if (showMaze && !showSoln) {\n showSoln = true;\n solnSet = [];\n discovered = [];\n visitedSet = new Stack();\n visitedSet.push(cellMap.get(coords[0]));\n discovered.push(cellMap.get(coords[0]));\n\n //dfs\n findSolnHelper(visitedSet.peek());\n drawSoln();\n }\n}", "function checkPuzzle(){\n var re =1;\n if(solv ==0){\n for(var id in tl_p){\n if(id !=tl_p[id].ord){ re =0; break;}\n }\n }\n if(re ==1){\n cnt.drawImage(img, 0, 0, width, height);\n \n //if solved manually (-1 is auto) calls solved()\n if(solv ==0){\n solv =1;\n me.solved();\n }\n }\n }", "propagate_update(index) {\n let nodes = this.nodes;\n const node = this.nodes[index];\n const value = node.value;\n\n if (!node.solved) return;\n\n node.row.forEach(index => {\n if (this.nodes[index].remove_possibility(value) && this.is_valid_solve(this.nodes[index])) {\n this.propagate_update(index);\n }\n });\n node.col.forEach(index => {\n if (this.nodes[index].remove_possibility(value) && this.is_valid_solve(this.nodes[index])) {\n this.propagate_update(index);\n }\n });\n node.sqr.forEach(index => {\n if (this.nodes[index].remove_possibility(value) && this.is_valid_solve(this.nodes[index])) {\n this.propagate_update(index);\n }\n });\n\n\n }", "generateSolutions(puzzle, onSolution, options) {\n const opts = Object.assign({}, GeneratorDefaultOptions, options);\n let maxDepth = opts.initialDepth;\n\n let shouldStop = false;\n let bestSolution = null;\n\n const root = new Node(puzzle.copy().normalize().encode(), null, -1, Heuristic.ContiguousGroups(puzzle), 0);\n \n let queue = new Heap((a, b) => a.priority - b.priority);\n queue.push(root);\n\n const seen = {};\n\n const solveLoop = new Promise(res => {\n const processQueue = async () => {\n if (queue.empty() || shouldStop) return res();\n \n const cur = queue.pop();\n \n if (seen[cur.position]) {\n return setImmediate(processQueue);\n }\n \n const puzzle = ChainPuzzle.decode(cur.position);\n \n if (puzzle.isSolved()) {\n const solution = OperationSequence.reorder(getPathOperations(cur));\n\n onSolution(solution);\n bestSolution = solution;\n \n queue = pruneQueueDepth(queue, cur.depth - 1); // TODO: might not be necessary if the cost of this function is greater than checking if all current-depth nodes are solved\n maxDepth = cur.depth - 1;\n \n return setImmediate(processQueue);\n }\n \n if (cur.depth >= maxDepth) {\n return setImmediate(processQueue);\n }\n \n for (let op = 0; op < 6; op++) {\n if (op != cur.operation && (op%3 == cur.operation%3)) {\n continue;\n }\n \n const newPuzzle = puzzle.copy().transform(op).normalize();\n const newPosition = newPuzzle.encode();\n \n if (seen[newPosition]) {\n continue;\n }\n \n const newNode = new Node(newPosition, cur, op, Heuristic.ContiguousGroups(newPuzzle), cur.depth + 1);\n \n cur.children.push(newNode);\n queue.push(newNode);\n }\n \n seen[cur.position] = true;\n \n setImmediate(processQueue);\n }\n\n processQueue();\n });\n\n return async () => {\n shouldStop = true;\n await solveLoop;\n\n return bestSolution;\n };\n }", "function solve() {\r\n\t// run test if the puzzle is shuffled\r\n\tif(SHUFFLE) {\r\n\t\t// initially good\r\n\t\tvar good = true;\r\n\t\t// test all the pieces\r\n\t\tfor(var i = 0; i < PIECES.length; i++) {\r\n\t\t\t// expected position for each piece\r\n\t\t\tvar left = i%PUZZLESIZE*TILESIZE;\r\n\t\t\tvar top = Math.floor(i/PUZZLESIZE)*TILESIZE;\r\n\t\t\t// if the position is not expected, it is no more good\r\n\t\t\tif(!(PIECES[i].style.left == left+\"px\" && PIECES[i].style.top == top+\"px\")) {\r\n\t\t\t\tgood = false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// if still good, call victory to show notification\r\n\t\tif(good) {\r\n\t\t\tvictory();\r\n\t\t}\r\n\t}\r\n}", "test(){\r\n\r\n const __quickSolver = (sudoku) =>{\r\n while(sudoku.simpleDeletion().status){}\r\n for(let i=1; i<=9; i++){\r\n for(let j=1; j<=9; j++){\r\n if(sudoku.getNumber(i, j)==0){\r\n if(sudoku.hasContradiction(false).status==true){\r\n return sudoku;\r\n }\r\n const candidates = sudoku.getCandidateInArray(i, j);\r\n if(candidates.length==0){\r\n sudoku.__hasContradiction = 1;\r\n return sudoku;\r\n }\r\n let count_contradiction = 0;\r\n let count_solved = 0;\r\n let n_copy;\r\n let solved_sudoku;\r\n for(const candidate of candidates){\r\n // 試しに代入して解く\r\n const sudoku_clone = sudoku.clone();\r\n sudoku_clone.setNumber(i, j, candidate);\r\n const result = __quickSolver(sudoku_clone);\r\n \r\n if(result.no_unique_solution==true){\r\n return result;\r\n }\r\n\r\n if(result.isSolved()==true){\r\n return result;\r\n }\r\n\r\n if(result.hasContradiction(false).status==true){\r\n sudoku.deleteCandidate(i, j, candidate)\r\n count_contradiction ++;\r\n continue;\r\n }\r\n }\r\n\r\n if(count_solved==1){\r\n sudoku.setNumber(i, j, n_copy);\r\n continue;\r\n }\r\n \r\n if(count_contradiction==candidates.length){\r\n sudoku.no_solution = true;\r\n sudoku.__hasContradiction = 1;\r\n return sudoku;\r\n }\r\n }\r\n }\r\n }\r\n \r\n return sudoku;\r\n };\r\n \r\n return __quickSolver(this.clone());\r\n }", "function solveGrid(){\n if(!gridCheck(false)){\n alert(\"Invalid Grid\")\n return\n }\n grid = currentTubeToArray()\n answer = []\n visitedPosition = new Set()\n t0 = performance.now()\n solved = solveGridRecursive(grid,visitedPosition,answer)\n t1 = performance.now()\n alert(\"Visited \"+visitedPosition.size+\" positions in \"+eval(math.round(t1-t0))+\" milliseconds with \"+eval(answer.length-1)+\" moves\")\n container = document.getElementById(\"solution\")\n while(container.firstChild){container.removeChild(container.firstChild)}\n if(!solved){\n alert(\"No solution\")\n return\n }\n let answerSolutionArray = answerToSolution(answer)\n for(const array of answerSolutionArray){\n arrayDiv = document.createElement(\"div\")\n arrayDiv.innerText = array\n container.appendChild(arrayDiv)\n\n\n }\n}", "function Solver() {\"use strict\";\n // breakDownCombos[numberOfElements][sumOfElements][0...#matches][intValueIndex]\n this.breakDownComboArr = breakDownCombos();\n this.initialize = function() {\n//removed console.log('in initialize()');\n for (let setId in game.rowSets) {\n if (!game.rowSets.hasOwnProperty(setId)) {\n continue;\n }\n\n let set = game.rowSets[setId];\n if (!set.cells || !set.gameCellId || !set.cells.length || !set.setType.length) {\n//removed console.log('something missing in set', set);\n continue;\n }\n\n let gameCell = set.getCell(set.gameCellId);\n\n let sum;\n if (set.setType === 'row') {\n sum = gameCell.rowSum;\n } else if (set.setType === 'col') {\n sum = gameCell.colSum;\n }\n\n // let playCells = [];\n // for (let cellId of set.cells) {\n // playCells.push(set.getCell(cellId));\n // }\n set.possibleCombos = this.breakDownComboArr[set.cells.length][sum];\n }\n for (let setId in game.colSets) {\n if (!game.colSets.hasOwnProperty(setId)) {\n continue;\n }\n let set = game.colSets[setId];\n if (!set.cells || !set.gameCellId || !set.cells.length || !set.setType.length) {\n//removed console.log('something missing in set', set);\n continue;\n }\n\n let gameCell = set.getGameCell();\n\n let sum;\n if (set.setType === 'row') {\n sum = gameCell.rowSum;\n } else if (set.setType === 'col') {\n sum = gameCell.colSum;\n }\n\n // let playCells = [];\n // for (let cellId of set.cells) {\n // playCells.push(set.getCell(cellId));\n // }\n set.possibleCombos = this.breakDownComboArr[set.cells.length][sum];\n }\n };\n this.solve = function() {\nconsole.time('all');\n // check for unique values in set and in every possible crossing set\n // check for correct sum in set and in every crossing set\n // using minimum and maximum of each possible set, prune those which have unacceptable values\n // for pairs of sets that must share a value, prune sets that cannot share a value at that point\n // order sets by # possibilities, low to high\n // choose a low # set and set values, try to solve the rest\n // backtrack and try again\n\n console.time('initialize');\n this.initialize(); // generates combinations\n console.timeEnd('initialize');\n\n console.time('pruneCombos');\n this.pruneAllImpossibleCombos();\n console.timeEnd('pruneCombos');\n\n console.time('genPerms');\n this.generatePermutations();\n console.timeEnd('genPerms');\n // console.time('genPermes\n\n\n // console.log(\"game.rowSets['set1,0']\", game.rowSets['set1,0']);\n\n console.time('prunePerms');\n // speed up game solution by pruning largest sets first?\n // this.pruneImpossiblePermutationsInSet(game.colSets['set1,3']);\n // this.pruneImpossiblePermutationsInSet(game.colSets['set0,7']);\n\n this.pruneAllImpossiblePermutations();\n\n // makes more sense to use a variable time limit, but:\n // number of times to iterate over pruneImpossiblePermutations\n let ceiling = 10;\n while (ceiling-- > 0 && this.hasMultipleSolutions()) {\n this.updateCellValues();\n this.pruneAllImpossiblePermutations();\n }\n console.timeEnd('prunePerms');\n console.log('# pruning iterations:', 10 - ceiling);\n this.updateCellValues();\n this.printPermutations();\n game.checkSolution();\n console.timeEnd('all');\n };\n\n this.solveBitmap = function() {\n console.time('all');\n\n // initialize all cells to any-possible bitmap (111111111)\n // for each game cell set, set all cells to possible bitmap from combinations for setLength/sum\n // AND with each cell in each crossing set\n\n console.time('initialize');\n this.initialize(); // generates combinations\n console.timeEnd('initialize');\n\n console.time('pruneCombos');\n //this.pruneAllImpossibleCombos();\n this.allPossibleCombos();\n console.timeEnd('pruneCombos');\n\n console.time('genPerms');\n this.generatePermutations();\n console.timeEnd('genPerms');\n // console.time('genPermes\n\n\n // console.log(\"game.rowSets['set1,0']\", game.rowSets['set1,0']);\n\n console.time('prunePerms');\n // speed up game solution by pruning largest sets first?\n // this.pruneImpossiblePermutationsInSet(game.colSets['set1,3']);\n // this.pruneImpossiblePermutationsInSet(game.colSets['set0,7']);\n\n this.allPossiblePermutations();\n\n // makes more sense to use a variable time limit, but:\n // number of times to iterate over pruneImpossiblePermutations\n let ceiling = 10;\n while (ceiling-- > 0 && this.hasMultipleSolutions()) {\n //this.updateCellValues();\n this.updateCellBitmaps();\n this.allPossiblePermutations();\n }\n console.timeEnd('prunePerms');\n console.log('# pruning iterations:', 10 - ceiling);\n //this.updateCellValues();\n this.updateCellBitmaps();\n this.printPermutations();\n game.checkSolution();\n console.timeEnd('all');\n };\n\n this.explore = function() {\n this.initialize();\n//removed console.log(game.rowSets);\n//removed console.log(game.colSets);\n this.pruneAllImpossibleCombos();\n//removed console.log(game.rowSets);\n//removed console.log(game.colSets);\n this.generatePermutations();\n//removed console.log(game.rowSets);\n//removed console.log(game.colSets);\n return;\n // TODO call this before return? this.pruneAllImpossiblePermutations();\n//removed console.log(game.rowSets);\n//removed console.log(game.colSets);\n\n };\n this.hasMultipleSolutions = function() {\n // returns true if there exists a set with more than one possible permutations\n//removed console.log('in hasMultipleSolutions');\n let colIds = Object.keys(game.colSets);\n let rowIds = Object.keys(game.rowSets);\n\n //for (let setId in colIds) {\n for (let setId in game.colSets) {\n if (!game.colSets.hasOwnProperty(setId)) {\n continue;\n }\n if (game.colSets[setId].possiblePermutations.length > 1) {\n return true;\n } else {\n//removed console.log(setId + ' solved');\n }\n }\n //for (let setId in rowIds) {\n for (let setId in game.rowSets) {\n if (!game.rowSets.hasOwnProperty(setId)) {\n continue;\n }\n if (game.rowSets[setId].possiblePermutations.length > 1) {\n return true;\n } else {\n//removed console.log(setId + ' solved');\n }\n }\n return false;\n };\n this.updateCellValues = function() {\n//removed console.log('in updateCellValues');\n for (let setId in game.rowSets) {\n if (!game.rowSets.hasOwnProperty(setId)) {\n continue;\n }\n\n let ndx = 0;\n //console.log(game.cells);\n for (let cellId of game.rowSets[setId].cells) {\n if (game.rowSets[setId].possiblePermutations.length > 1) {\n//removed console.log('not a unique solution, exiting updateCellValues');\n continue;\n }\n // .setValue() not working--'cell' does not know it is a PlayCell object?\n let cell = game.findCell(cellId);\n let permutation = game.rowSets[setId].possiblePermutations[0]; // only one left\n cell.setValue(permutation[ndx++]);\n }\n }\n };\n this.printPermutations = function() {\n // print out remaining permutations\n for (let setId in game.rowSets) {\n if (!game.rowSets.hasOwnProperty(setId)) {\n continue;\n }\n//removed console.log(setId);\n for (let perm of game.rowSets[setId].possiblePermutations) {\n//removed console.log(setId, perm);\n }\n }\n for (let setId in game.colSets) {\n if (!game.colSets.hasOwnProperty(setId)) {\n continue;\n }\n//removed console.log(setId);\n for (let perm of game.colSets[setId].possiblePermutations) {\n//removed console.log(setId, perm);\n }\n }\n };\n this.generatePermutations = function() {\n // for every combination in every set, create permutations and assign to set.possiblePermutations\n//removed console.log('in generatePermutations');\n for (let setId in game.rowSets) {\n if (!game.rowSets.hasOwnProperty(setId)) {\n continue;\n }\n\n game.rowSets[setId].possiblePermutations = [];\n let permutations = [];\n\n for (let combo of game.rowSets[setId].possibleCombos) {\n // for (comboId = 0, len = game.rowSets[setId].possibleCombos.length; comboId < len; comboId++) {\n // combo = game.rowSets[setId].possibleCombos[comboId];\n // permutations = permutations.concat(permutator(combo));\n //permutations.push(permutator(combo));\n permutations = permutator(combo);\n for (let perm of permutations) {\n game.rowSets[setId].possiblePermutations.push(perm);\n }\n }\n //game.rowSets[setId].possiblePermutations = permutations;\n }\n for (let setId in game.colSets) {\n if (!game.colSets.hasOwnProperty(setId)) {\n continue;\n }\n game.colSets[setId].possiblePermutations = [];\n let permutations = [];\n for (let combo of game.colSets[setId].possibleCombos) {\n // for (comboId = 0, len = game.colSets[setId].possibleCombos.length; comboId < len; comboId++) {\n // combo = game.colSets[setId].possibleCombos[comboId];\n // permutations = permutations.concat(permutator(combo));\n // permutations.push(permutator(combo));\n permutations = permutator(combo);\n for (let perm of permutations) {\n game.colSets[setId].possiblePermutations.push(perm);\n }\n }\n //game.colSets[setId].possiblePermutations = permutations;\n }\n\n // check that all permutations are created\n//removed console.log('game.rowSets', game.rowSets);\n//removed console.log('game.colSets', game.colSets);\n };\n this.generatePermutationsFast = function() {\n // for every combination in every set, create permutations and assign to set.possiblePermutations\n//removed console.log('in generatePermutations');\n // tighten execution times of inner loops\n\n // declare variables outside of loops\n let combo, perm, permutations, setId, combos, possiblePermutations;\n for (setId in game.rowSets) {\n if (!game.rowSets.hasOwnProperty(setId)) {\n continue;\n }\n\n game.rowSets[setId].possiblePermutations = [];\n //permutations = [];\n possiblePermutations = [];\n\n combos = game.rowSets[setId].possibleCombos;\n //for (combo of combos) {\n for (let comboId = 0; comboId < combos.length; comboId++) {\n // for (comboId = 0, len = game.rowSets[setId].possibleCombos.length; comboId < len; comboId++) {\n // combo = game.rowSets[setId].possibleCombos[comboId];\n // permutations = permutations.concat(permutator(combo));\n //permutations.push(permutator(combo));\n permutations = permutator(combos[comboId]);\n for (perm of permutations) {\n possiblePermutations.push(perm);\n }\n }\n //game.rowSets[setId].possiblePermutations = permutations;\n game.rowSets[setId].possiblePermutations = possiblePermutations;\n }\n for (setId in game.colSets) {\n if (!game.colSets.hasOwnProperty(setId)) {\n continue;\n }\n game.colSets[setId].possiblePermutations = [];\n //permutations = [];\n possiblePermutations = [];\n\n combos = game.colSets[setId].possibleCombos;\n //for (combo of combos) {\n for (let comboId = 0; comboId < combos.length; comboId++) {\n // for (comboId = 0, len = game.colSets[setId].possibleCombos.length; comboId < len; comboId++) {\n // combo = game.colSets[setId].possibleCombos[comboId];\n // permutations = permutations.concat(permutator(combo));\n // permutations.push(permutator(combo));\n permutations = permutator(combos[comboId]);\n for (perm of permutations) {\n possiblePermutations.push(perm);\n }\n }\n game.colSets[setId].possiblePermutations = possiblePermutations;\n //game.colSets[setId].possiblePermutations = permutations;\n }\n\n // check that all permutations are created\n//removed console.log('game.rowSets', game.rowSets);\n//removed console.log('game.colSets', game.colSets);\n };\n this.pruneAllImpossiblePermutations = function() {\n // for each set in rowSets and colSets, pruneImpossiblePermutations\n // might want to order by # permutations descending (or ascending?) to get large groups out of the way early\n//removed console.log('in pruneAllImpossiblePermutations()');\n //let solutionsDiv = document.getElementById('solutionsDiv');\n\n // let revRowSets = Object.keys(game.rowSets).reverse();\n // let revColSets = Object.keys(game.colSets).reverse();\n\n // let colIds = Object.keys(game.colSets).sort(function(a, b) {\n // // sort keys by descending number of permutations, in order to process longest first\n // return game.colSets[b].possiblePermutations.length - game.colSets[a].possiblePermutations.length\n // });\n // let rowIds = Object.keys(game.rowSets).sort(function(a, b) {\n // // sort keys by descending number of permutations, in order to process longest first\n // return game.rowSets[b].possiblePermutations.length - game.rowSets[a].possiblePermutations.length\n // });\n\n //for (let setId in colIds) {\n for (let setId in game.colSets) {\n if (!game.colSets.hasOwnProperty(setId)) {\n continue;\n }\n//removed console.log('--------------------------');\n this.pruneImpossiblePermutationsInSet(game.colSets[setId]);\n }\n //for (let setId in rowIds) {\n for (let setId in game.rowSets) {\n if (!game.rowSets.hasOwnProperty(setId)) {\n continue;\n }\n//removed console.log('--------------------------');\n this.pruneImpossiblePermutationsInSet(game.rowSets[setId]);\n }\n // for (let setId of revRowSets) {\n // // do as above but reverse order\n // //if (!revRowSets.hasOwnProperty(setId)) {\n // // continue;\n // // }\n // this.pruneImpossiblePermutations(game.rowSets[setId]);\n // }\n // for (let setId of revColSets) {\n // // do as above but reverse order\n // // if (!revColSets.hasOwnProperty(setId)) {\n // // continue;\n // // }\n // this.pruneImpossiblePermutations(game.colSets[setId]);\n // }\n };\n this.pruneImpossiblePermutationsInSet = function(testSet) {\n // remove permutations from this set that contain values not present in that position of any crossing set permutation\n//removed console.log('in pruneImpossiblePermutations');\n//removed console.log('testSet.possiblePermutations', testSet.possiblePermutations);\n\n let crossingSets = this.findCrossingSets(testSet);\n\n // build a new array of possible combos, not including impossible ones\n let newPossiblePermutations = [];\n //let reassignPossPermsFlag = false;\n // console.log('________________________________');\n // console.log('________________________________');\n\n // get div to to display progress\n //let solutionsDiv = document.getElementById(\"solutionsDiv\");\n // write progress\n //solutionsDiv.innerHTML += \"<br><br>\" + testSet.id;\n\n for (let permId in testSet.possiblePermutations) {\n if (!testSet.possiblePermutations.hasOwnProperty(permId)) {\n continue;\n }\n\n // write progress\n // if (permId % 1000 === 0) {\n // solutionsDiv.innerHTML += \"<br>permId \" + permId + \" of \" + testSet.possiblePermutations.length;\n // }\n\n // i need to rule out every permutation that doesn't correspond to some extant permutation at each crossing set\n//removed console.time('isImpossiblePermutation');\n let isPossiblePerm = !this.isImpossiblePermutation(testSet, crossingSets, testSet.possiblePermutations[permId]);\n//removed console.timeEnd('isImpossiblePermutation');\n\n if (isPossiblePerm) {\n if (typeof newPossiblePermutations === 'undefined') {\n newPossiblePermutations = [];\n }\n newPossiblePermutations.push(testSet.possiblePermutations[permId]);\n //isTotallyPossible = true;\n//removed console.log('retained permutation');\n\n //reassignPossPermsFlag = true;\n } else {\n//removed console.log('discarded permutation');\n }\n }\n // if (false && isTotallyPossible) {\n // console.log(' stored pairing at [permGroupId]:', permGroupId);\n // //testSet.possiblePermutations[permGroupId] = newPossiblePermutations[permGroupId];\n // reassignPossPermsFlag = true;\n // } else {\n // console.log(' deleting pairing at [permGroupId]:', permGroupId);\n // }\n //}\n\n //if (reassignPossPermsFlag) {\n // assign current possible permutations back to set\n testSet.possiblePermutations = newPossiblePermutations;\n //\n // testSet.possiblePermutations = [];\n // for (let permGroupId in newPossiblePermutations) {\n // if (!newPossiblePermutations.hasOwnProperty(permGroupId)) {\n // continue;\n // }\n //\n // testSet.possiblePermutations[permGroupId] = newPossiblePermutations[permGroupId];\n // }\n //}\n//removed console.log('end in pruneImpossiblePermutations');\n//removed console.log('testSet.possiblePermutations', testSet.possiblePermutations);\n };\n\n // returns true for impossible as soon as it finds a cell.playValue or one crossing set that forbids this permutation\n this.isImpossiblePermutation = function(testSet, crossingSets, permutation) {\n\n\n // I wanted to check that I was working with OK data\n // if (testSet.cells.length === crossingSets.length) {\n // console.log('correct lengths');\n // } else {\n // console.log('!!! incorrect lengths !!!');\n // return false; // permutation/crossing sets length mismatch\n // }\n\n // added tests for existing playCell.playValue's\n\n // the next two for loops use this length\n const len = testSet.cells.length;\n for (let ndx = 0; ndx < len; ndx++) {\n // playValue is set and rules out this permutation\n if ((testSet.cells[ndx].playValue > 0 && testSet.cells[ndx].playValue !== permutation[ndx])) {\n//removed console.log('permutation conflicts with playValue:', testSet.cells[ndx].playValue);\n return true;\n }\n }\n\n // could be (?) sped up if we kept an association between combination and permutation array,\n // and checked combo.inArray(permutation[ndx] before running through that permutation group\n // requires creating an array at the same index as the combination for the return from permutator(combo) in generatePermutations()\n // and a little bit more housekeeping with combinations which are currently not pruned when permutations are removed\n for (let ndx = 0; ndx < len; ndx++) {\n // needs to be a possible matched crossing permutation for every location (ndx) in this permutation\n\n // crossing set permutations rule out this permutation\n if (this.isImpossiblePermutationAtCell(testSet, crossingSets[ndx], permutation, ndx)) {\n//removed console.log('found an impossible pairing at ndx:', ndx);\n return true;\n } else {\n//removed console.log('found a possible pairing at ndx:', ndx);\n }\n\n }\n\n // got through the cells and there is a possible permutation in every crossing set\n return false;\n };\n this.isImpossiblePermutationAtCell = function(testSet, crossingSet, perm, loc) {\n // returns false if the crossing set contains a permutation that aligns with this perm[utation]\n\n // the the value of the digit at loc in this perm[utation]\n // doesn't have a matching permutation in the crossing set\n // that is equal in value at the crossing offset\n\n\n\n // this permutation contains at least one value in a position not present\n // in the the same row or column of a crossing set's possible permutations\n//removed console.log('in isImpossiblePermutation');\n\n\n\n\n //let foundFlag = false;\n//removed console.log('crossingSet', crossingSet);\n\n //const crossingSetId = 'set' + crossingSet.gameCellId;\n // (must? or mustn't?) build ID from game cell because there is no ID field on Set\n // const set = game.rowSets[crossingSetId] ? game.rowSets[crossingSetId] : game.colSets[crossingSetId];\n //const set = crossingSet;\n\n\n const digit = perm[loc];\n // used to compute offsets for crossing set permutations\n const offset = this.getOffset(testSet, crossingSet);\n\n // each array of permutation arrays\n //for (let testPerm of crossingSet.possiblePermutations) {\n for (let testPermNdx = 0, len = crossingSet.possiblePermutations.length; testPermNdx < len; testPermNdx++) {\n let testDigit = crossingSet.possiblePermutations[testPermNdx][offset];\n /*console.log('testPerm:', testPerm); // if testSet is a row, this is a column; vice versa\n//removed console.log('offset:', offset);\n//removed console.log('testPerm[offset]:', testPerm[offset]);\n//removed console.log('perm:', perm);\n//removed console.log('loc:', loc);\n//removed console.log('perm[loc]:', perm[loc]);\n if (typeof testPerm[offset] === 'undefined') {\n //continue;\n//removed console.log('------------------------');\n//removed console.log('------------------------');\n//removed console.log('------------------------');\n//removed console.log('------------------------');\n//removed console.log('------------------------');\n//removed console.log('------------------------');\n//removed console.log('------------------------');\n//removed console.log('-----should not happen ------');\n//removed console.log('------------------------');\n//removed console.log('------------------------');\n//removed console.log('------------------------');\n//removed console.log('------------------------');\n//removed console.log('------------------------');\n//removed console.log('------------------------');\n //return;\n }\n*/\n if (testDigit === digit) {\n // found one that matches, so not impossible\n//removed console.log('found one that matches');\n return false;\n } else {\n//removed console.log('not a match');\n }\n }\n // tried every permutation in crossing set and none allow for this permutation\n return true;\n };\n this.getOffset = function(testSet, crossingSet) {\n // return the array index of the intersected cell in the crossing set\n\n // const col = testSet.col;\n // const row = testSet.row;\n\n // get row,col components of game cell id\n //const coords = crossingSetId.match(/(\\d+,\\d+)/g)[0].split(',');\n\n //console.log('row col coords:', row, col, coords);\n\n //const inCrossingColumn = (testSet.setType === \"row\");\n let offset;\n\n //console.log('coords', coords);\n\n // if (coords.length === 2) {\n // // convert string coords to numbers\n // coords[0] = Number(coords[0]); // row, i\n // coords[1] = Number(coords[1]); // column, j\n // } else {\n // // error\n // console.log('this should not happen');\n // }\n\n // compute offset\n //if (inCrossingColumn) {\n if (testSet.setType === \"row\") {\n offset = testSet.row - crossingSet.row - 1;\n //console.log('coords, row, offset', coords, row, offset);\n } else {\n offset = testSet.col - crossingSet.col - 1;\n //console.log('coords, col, offset', coords, col, offset);\n }\n\n return offset;\n };\n this.pruneAllImpossibleCombos = function() {\n//removed console.log('in pruneAllImpossibleCombos');\n //let solutionsDiv = document.getElementById('solutionsDiv');\n for (let setId in game.rowSets) {\n if (!game.rowSets.hasOwnProperty(setId)) {\n continue;\n }\n // check for unique values in set and in every possible crossing set\n // check for correct sum in set and in every crossing set\n // using minimum and maximum of each possible set, prune those which have unacceptable values\n // for pairs of sets that must share a value, prune sets that cannot share a value at that point\n // order sets by # possibilities, low to high\n // choose a low # set and set values, try to solve the rest\n // backtrack and try again\n this.pruneImpossibleCombos(game.rowSets[setId]);\n }\n for (let setId in game.colSets) {\n // do as above but for columnar sets instead of row sets\n if (!game.colSets.hasOwnProperty(setId)) {\n continue;\n }\n\n //solutionsDiv.innerText += \"\\n\" + JSON.stringify(game.colSets[setId]);\n //console.log(setId, game.colSets[setId].possibleCombos);\n this.pruneImpossibleCombos(game.colSets[setId]);\n }\n };\n this.pruneImpossibleCombos = function(testSet) {\n // remove combos from this set that contain values not present in any crossing set\n//removed console.log('in pruneImpossibleCombos');\n //console.log('testSet.possibleCombos', testSet.possibleCombos);\n\n if (testSet == null ||\n testSet == undefined ||\n testSet.cells == undefined ||\n testSet.cells == null ||\n testSet.cells.length === 0) {\n//removed console.log('zero-length set cells');\n return false;\n }\n\n const crossingSets = this.findCrossingSets(testSet);\n\n // build a new array of possible combos, not including impossible ones\n const newPossibleCombos = [];\n for (let comboId in testSet.possibleCombos) {\n if (!testSet.possibleCombos.hasOwnProperty(comboId)) {\n continue;\n }\n let combo = testSet.possibleCombos[comboId];\n if(!this.isImpossibleCombo(crossingSets, combo)) {\n newPossibleCombos.push(combo);\n }\n }\n\n testSet.possibleCombos = newPossibleCombos;\n\n //console.log('end in pruneImpossibleCombos', testSet.possibleCombos);\n };\n this.isImpossibleCombo = function(crossingSets, combo) {\n // this combo contains at least one value not present in any crossing set's possible combinations\n//removed console.log('in isImpossibleCombo', combo);\n\n let allPossibles = [];\n for (let set of crossingSets) {\n for (let testCombo of set.possibleCombos) {\n //console.log(testCombo);\n\n // trying to rule some out early\n // if (combo[0] > testCombo[testCombo.length - 1] || combo[combo.length - 1] < testCombo[0]) {\n // // combos don't overlap any digits\n // continue;\n // }\n\n allPossibles = allPossibles.concat(testCombo);\n }\n }\n\n for (let digit of combo) {\n if (!this.isInArray(allPossibles, digit)) {\n //console.log(digit + ' not available in ' + allPossibles);\n return true;\n }\n }\n //console.log(allPossibles + ' contains a digit of ' + combo);\n return false;\n };\n this.findCrossingSets = function(testSet) {\n // returns an array of all the sets intersecting testSet\n//removed console.log('in findCrossingSets');\n if (testSet == null ||\n testSet == undefined ||\n testSet.cells == undefined ||\n testSet.cells == null ||\n testSet.cells.length === 0) {\n//removed console.log('zero-length set cells');\n return false;\n }\n let crossingSets = [];\n if (testSet.setType === 'row') {\n // collect the crossing sets\n for (let cellId of testSet.cells) {\n let cell = testSet.getCell(cellId);\n crossingSets.push(game.colSets[cell.colSet]);\n }\n } else if (testSet.setType === 'col') {\n for (let cellId of testSet.cells) {\n let cell = testSet.getCell(cellId);\n // console.log(cellId);\n crossingSets.push(game.rowSets[cell.rowSet]);\n }\n }\n return crossingSets;\n };\n /*\n this.isInCrossingSet = function(testSet, digit) {\n//removed console.log('in isInCrossingSet', digit);\n // for each cell in set.cells, traverse to nearest set head game cell to find crossing set, then search for digit\n for (let i = 0; i < testSet.cells.length; i++) {\n let rowSet = testSet.getCell(testSet.cells[i]).rowSet;\n let colSet = testSet.getCell(testSet.cells[i]).colSet;\n\n if (testSet.setType === 'row') {\n//removed console.log('in row');\n // get the row and column for a crossing set\n if (!this.isInSet(game.colSets[colSet], digit)) {\n // returns false if a single crossing set does not contain the value\n // should instead return false only if all crossing combinations do not contain the value\n return false;\n }\n } else if (testSet.setType === 'col') {\n//removed console.log('in col');\n // get the row and column for a crossing set\n if (!this.isInSet(game.rowSets[rowSet], digit)) {\n //\n return false;\n }\n }\n }\n return true;\n };\n this.isNotInAnyOf = function(sets, digit) {\n//removed console.log('in isNotInAnyOf', sets, digit);\n for (let set of sets) {\n if (this.isInSet(set, digit)) {\n return false;\n }\n }\n return true;\n };\n this.isInAnyOf = function(sets, digit) {\n//removed console.log('in isInAnyOf', digit);\n for (let set of sets) {\n if (this.isInSet(set, digit)) {\n return true;\n }\n }\n return false;\n };\n this.isInSet = function(set, digit) {\n//removed console.log('in isInSet', set.possibleCombos, digit);\n for (let combo of set.possibleCombos) {\n if (!this.isInArray(combo, digit)) {\n return false;\n }\n }\n return true;\n };*/\n this.isInArray = function(arr, digit) {\n // return true if digit is equal to an array item\n // better I think, to just use built in\n // array.inArray(item) which returns the first index containing item, or -1 if not found\n\n // console.log('in isInArray', digit);\n for (let setDigit of arr) {\n if (setDigit === digit) {\n return true;\n }\n }\n return false;\n };\n\n// altered approach to algorithm, maybe much faster\n this.assignAllPossibleCellValues = function() {\n // loop through cells and run assignPossibleCellValues(cell)\n };\n this.assignPossibleCellValues = function(cell) {\n // set the possible values at this cell\n };\n this.pruneAllImpossibleCellValues = function() {\n // loop through cells and run pruneImpossibleCellValues(cell)\n };\n this.pruneImpossibleCellValues = function(cell) {\n // remove cell values where:\n // a. they would be repeating in a row or column\n // b. they, in combination with nearby cell values, couldn't add to the sums\n // determined by ???\n return;\n };\n}", "solveNaive () {\n while (true) {\n const node = this.findAnOpenNode()\n if (node === null) {\n return\n }\n\n if (node.problem.currentSize < node.problem.targetSize) {\n node.rethrow()\n } else if (node.problem.currentSize % node.problem.targetSize === 0) {\n node.reduce(node.problem.targetSize)\n } else {\n node.tryReduce(node.problem.targetSize)\n }\n }\n }", "is_solved() {\n for (var i = 0; i < this.nodes.length; i++) {\n if (!this.nodes[i].solved) return false;\n }\n\n //return this.is_valid();\n return true;\n }", "constructor(initial) {\n this.Solution = null;\n let pq = new PQ();\n pq.push(new Node(initial, null, 0));\n while (pq.size > 0) {\n let node = pq.pop();\n if (node.moves > 50) {\n console.log(\"huge\");\n break;\n }\n if (node.board.isGoal() == true) {\n this.Solution = node;\n let copy = node;\n while (copy != null) {\n this.stk.push(copy.board.board);\n copy = copy.previos;\n }\n break;\n }\n node.board.neighbors().forEach(n => {\n if (node.previos != null && node.previos.board.equals(n.board) == false) {\n pq.push(new Node(n, node, node.moves + 1));\n } else if (node.previos == null) {\n pq.push(new Node(n, node, node.moves + 1));\n }\n })\n }\n }", "function solve() {\n if (generatedBool === true && solvedBool === false) {\n let sudoku = new SudokuPuzzle(og_grid_dict);\n console.log(og_grid_dict);\n let solver = new SudokuSolver(sudoku);\n solver.solve();\n \n for (var i = 0; i < 9; i++) { // translate solution from board to dict\n for (var j = 0; j < 9; j++) {\n solution_dict[\"c\" + i + \"\" + j] = solver.getP().getBoard()[i][j];\n }\n }\n\n // iff solve() is being called by solve button, then show solution and show input numbers w/ green background\n let id = event.target.id;\n if (id === \"solve\") {\n for (var i = 0; i < 9; i++) {\n for (var j = 0; j < 9; j++) {\n let cell = i + \"\" + j;\n showBoard(cell, solution_dict);\n showGreen(cell);\n }\n }\n solvedBool = true; // to know \"solve\" button was clicked for check method\n }\n } // end if \"generated\" check\n\n \n \n } // end global solve method", "function checkAnswers() {\r\n console.log(\"check begin\");\r\n for (var answerCounter = 0; answerCounter < answers.length; answerCounter++) {\r\n var partiesLength = subjects[answerCounter].parties.length;\r\n for (var p = 0; p < partiesLength; p++) {\r\n //subjects[answerCounter].parties;\r\n console.log(answers);\r\n if (\r\n answers[answerCounter] == subjects[answerCounter].parties[p].position\r\n ) {\r\n // zoek in alpartys de partij die overeenkomet met subjects[answerCounter].parties[p].position --> foundParty\r\n let foundParty = allpartys.find((party) => {\r\n return party.name == subjects[answerCounter].parties[p].name;\r\n });\r\n /*\r\n let resultParty = null;\r\n for (index = 0; index < allpartys.length; index++){\r\n let party = allpartys[index];\r\n match = party.name == subjects[answerCounter].parties[p].name;\r\n if (match == true) {\r\n resultParty = party; break;\r\n }\r\n }\r\n*/\r\n\r\n foundParty.points++;\r\n // allpartys[answerCounter].points++;\r\n var checkBox = document.getElementById(\"questionW\");\r\n if (checkBox.checked == true) {\r\n foundParty.points++;\r\n }\r\n\r\n console.log(\"true\");\r\n console.log(allpartys);\r\n } else {\r\n console.log(\"false\");\r\n }\r\n }\r\n }\r\n buttonreplace();\r\n Sorting();\r\n bestToWorst();\r\n}", "function solve(sudoko) {\n let emptySpot = EmptySpot(sudoko);\n let row = emptySpot[0];\n let col = emptySpot[1];\n if (row === -1 ){\n return sudoko;\n }\n for (let num = 1; num<=9; num++){\n if(checkValue(sudoko , row , col , num)){\n sudoko[row][col] = num;\n solve(sudoko);\n }\n }\n if ( EmptySpot (sudoko)[0] !== -1)\n sudoko[row][col] = 0;\n return sudoko;\n\n }", "function solveMaze() {\n init(solve);\n}", "function solve(start) {\n var puzzle = start;\n console.log('start');\n while (1) {\n printSolveProgress(puzzle);\n console.log('iteration');\n const reduced = doReductions(puzzle);\n\n if (isSolved(reduced)) {\n return [null, reduced];\n }\n\n if (!checkConsistency(reduced)) {\n return ['A cell has no value and no marks. The puzzle cannot be solved', reduced];\n }\n\n if (reduced === puzzle) {\n return ['Unable to solve puzzle', reduced];\n }\n\n puzzle = reduced;\n }\n}", "function solve(i, j) {\n //check in row, column and sector\n solved[i][j] = setIntersection(aroundNums(i, j), solved[i][j]);\n if (solved[i][j].size == 1) {\n for (let item of solved[i][j]) {\n solved[i][j] = item;\n matrix[i][j] = item;\n }\n //return +1 changes\n return 1;\n }\n return 0;\n }", "function solve(){\n var grid = cGrid;\n var point = {\n row: 0,\n col: 0\n };\n stepCount = 0; //resetStep\n exitRow = grid.length-1;\n var minDistance = -1;\n\n //2. Walk through grid, loop each step\n do{\n let nextSteps = [];\n let step = {};\n\n for( var direct in directions){\n step = movable(point, grid, direct);\n if(step.canMove){\n step.direction = direct;\n nextSteps.push(step);\n }\n }\n \n //If no direction walkable, exit\n if(nextSteps.length == 0){\n noExit = true;\n break;\n }\n\n //3. sort distance and take the shortest direction\n nextSteps.sort((a, b) => (a.minDistance - b.minDistance));\n\n //mark current step and make the move\n point = markElement(point, grid, nextSteps);\n\n //5. test exit condition\n if (point.row == exitRow && point.col == exitCol){\n exitReached = true;\n grid[exitRow][exitCol] = colValues.PATH;\n document.getElementById(`${exitRow}:${exitCol}`).setAttribute(\"blockValue\", \"step\");\n stepCount ++;\n break;\n }\n } while(true);\n\n writeResults();\n}", "function handleIsSolvedButton() {\n // Update the global 2d array.\n updateInternalBoard();\n // Check answer.\n if (isSolved()) {\n alert('Puzzle is solved!');\n }\n else {\n alert('Wrong answer!');\n }\n}", "start() {\n this.insertIntoOpened(new Coord(this.init.getRow(), this.init.getCol(), this.estimate(this.init))); //Insertamos el inicio en abierta\n let actual;\n while (!this.found && this.hasPath) {\n actual = this.getFromOpened(); //obtenemos el menor valor de abierta\n this.insertIntoClosed(actual);\n if (actual.getRow() === this.end.getRow() && actual.getCol() === this.end.getCol()) //es solucion\n this.found = true;\n else { //caso base, final\n this.expandNode(actual);\n if (this.opened.length === 0 && !this.found)\n this.hasPath = false;\n }\n\n }\n if (this.found) {\n let path = this.buildSolutionPath(); //devolver camino\n this.paintBoats(path);\n }\n else\n alert(\"No hay camino\");\n }", "function branchingProcess() {\n var implicantsPowerSet = powerSet(remainingImplicants);\n validSolutions = filterPowerSet(implicantsPowerSet); //array contains valid cominations\n var currentValidSolutions = validSolutions.slice();\n minimalSolutions = filterPossibleSolutions(currentValidSolutions); //array contains valid combainations with least cost\n}", "function pushSolution() {\r\n\r\n if (submitted) return;\r\n submitted = true;\r\n\r\n if (iControlBots) {\r\n for (var i = 1; i <= numPlayers; i++) {\r\n if (!activePlayers[i]) { // for the inactive player\r\n submitBotSolution(i);\r\n }\r\n }\r\n }\r\n\r\n if (currentRound == 0) {\r\n doneAllInstructions();\r\n return;\r\n }\r\n\r\n $('#submitButton').attr(\"value\",\"Waiting for other players\");\r\n \r\n var dist = getDist(cityOrder);\r\n var millis = new Date().getTime() - clockStartTime;\r\n if (clockTimer != null) {\r\n clearInterval(clockTimer);\r\n clockTimer = null;\r\n }\r\n showMidRoundPopup(dist, millis);\r\n \r\n}", "function solution()\n{\n\t// initialize correct-piece counter\n\tvar wincounter = piecenumber;\t\n\t\n\t// check each puzzle piece row by row\n\tfor (i = 0; i < piecerows; i++)\n\t{\n\t\tfor (j = 0; j < piececols; j++)\n\t\t{\n\t\t\t// get current position\n\t\t\tvar xcurr = $(\"#piece\" + i + j).position().left;\n\t\t\tvar ycurr = $(\"#piece\" + i + j).position().top;\n\t\t\t\n\t\t\t// get desired position\n\t\t\tvar ywin = i * piecesize;\n\t\t\tvar xwin = j * piecesize;\n\t\t\t\n\t\t\t// compare and score\n\t\t\tif ((Math.abs(xcurr - xwin) <= 10) && (Math.abs(ycurr - ywin) <= 10))\n\t\t\t\twincounter--;\n\t\t}\n\t}\n\t\n\t// debug\n\t// alert(\"Incorrect Pieces Remaining: \" + wincounter);\n\n\t// you win! maybe.\n\tif (wincounter == 0)\n\t{\n\t\t// freeze pieces\n\t\t$(\".piece\").draggable({disabled: true});\n\n\t\t// freeze solution checking\n\t\t$(\".piece\").unbind(\"mouseup\");\n\t\t\n\t\t// alert user\n\t\tyouwin();\n\t}\n\n}", "solverFull(movement, solver) {\n if (!this.state.mazeSolved) {\n this.setState({ disableUpdateTileType: true, mazeSolved: true }, () => {\n if (typeof this.state.maze.start !== 'number') {\n this.setState({ mazeSolved: false });\n return alert('Missing Starting Point!');\n }\n if (typeof this.state.maze.end !== 'number') {\n this.setState({ mazeSolved: false });\n return alert('Missing Ending Point!');\n }\n this.state.maze.solverFull(movement, solver);\n this.setState({ mazeSolved: true });\n })\n } else {\n alert('Maze already solved!');\n }\n }", "function checkDone(){\n var done=true;\n\t\tvar currentCards=[];\n\t\tfor (var j=1;j<7;j++){\n\t\t\tfor (var i=1;i<4;i++){\n\t\t\t\tif (cardsOnBoard[j][i]!=null){\n\t\t\t\t\tcurrentCards.push(cardsOnBoard[j][i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvar numCardsOnBoard=currentCards.length;\n\t\t//brute force all possible sets\n\t\tfor (var i=0; i<numCardsOnBoard; i++){\n\t\t\tfor (var j=i; j<numCardsOnBoard-1; j++){\n\t\t\t\tfor (var k=j; k<numCardsOnBoard-2; k++){\n\t\t\t\t\tif (i!=j && j!=k && i!=k && checkSet(currentCards[i],currentCards[j],currentCards[k])){\n\t\t\t\t\t\t//if there is a set, you aren't done\n\t\t\t\t\t\tdone=false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn done;\n }", "traverse()\n\t{\n\t\tlet done = false;\n\t\tlet pos = new Position();\n\t\tlet stack = new Stack();\n\t\tstack.push(pos);\n\n\t\twhile (!(done) && !stack.isEmpty())\n\t\t{\n\t\t\tpos = stack.pop();\n\t\t\tthis.maze.tryPosition(pos.getx(),pos.gety()); // this cell has been tried\n\t\t\tif (pos.getx() == this.maze.getRows()-1 && pos.gety() == this.maze.getColumns()-1)\n\t\t\t\tdone = true; // the maze is solved\n\t\t\telse\n\t\t\t{\n\t\t\t\tthis.pushNewPos(pos.getx() - 1,pos.gety(), stack); // position to the left\n\t\t\t\tthis.pushNewPos(pos.getx() + 1,pos.gety(), stack); // to the right\n\t\t\t\tthis.pushNewPos(pos.getx(),pos.gety() - 1, stack); // above\n\t\t\t\tthis.pushNewPos(pos.getx(),pos.gety() + 1, stack); // below\n\t\t\t}\n\t\t}\n\n\t\treturn done;\n\t}", "function updateWindowAfterResolve() {\n\trightPane.innerHTML = templates.renderQuestionForm();\n\tif(getStoredQuestions().length < 1) addTemporaryQuestion();\n }", "function enforceConstraintsForAnyFreeVariables() {\n while (numCidsLeft > 0 && freeVarQueue.length > 0) {\n var vid = freeVarQueue.pop();\n var cids = cgraph.constraintsWhichOutput(vid).filter(isCidLeft);\n if (cids.length == 1) {\n var cid = cids[0];\n if (hasSelectableMethod(cid)) {\n determineConstraint(cid);\n }\n }\n }\n }", "function puzzleSolver(game){\r\n\tthis.tree = 0;\r\n\tthis.solution = [[1,2,3],[4,5,6],[7,8,0]];\r\n\tthis.lastBoard = [[1,2,3],[4,5,6],[7,8,0]];\r\n\tthis.nodes = [];\r\n\tthis.maxNodeDepth = 0;\r\n\tthis.lastTree;\r\n\tthis.moveLabels = [\" \",\"^\",\">\",\"v\",\"<\"];\r\n\tthis.path = [];\r\n\tthis.depth = 0;\r\n\tthis.depthLimit = 20;\r\n\tthis.steps = 0;\r\n\tthis.stepsLimit = this.depthLimit * \r\n\t\t\t\t\t\tthis.depthLimit * \r\n\t\t\t\t\t\tthis.depthLimit * \r\n\t\t\t\t\t\tthis.depthLimit; //branching factor stuff \r\n\tthis.mode = 2;\r\n\tthis.finished = 0;\r\n\tthis.solutions = [];\r\n\tthis.collissionsCouter = 0;\r\n\t\r\n\r\n\t//________________________________________________________//\r\n\t// Sets the gameboard so manipulations can be done on it\r\n\t//________________________________________________________//\r\n\tthis.init = function(game){\r\n\t\t\t\r\n\t\tthis.finished = 0;\r\n\t\tthis.nodes = [];\r\n\t\tthis.maxNodeDepth = 0;\r\n\t\tthis.steps = 0;\r\n\t\tthis.tree = new Tree();\r\n\t\tthis.tree.parent = game;\r\n\t\tthis.tree.setState(\"start\");\r\n\t\tthis.tree.setCumulativeCost(0);\r\n\t\tthis.tree.setCost(1);\r\n\t\tthis.tree.singleCost = 1;\r\n\t\tthis.lastTree = this.tree;\r\n\t\tthis.lastBoard = game.board;\r\n\t\tthis.solution = game.boardSolution\r\n\t\tthis.solutions = [];\r\n\t\tthis.collissionsCouter = 0;\r\n\t\t\r\n\t\t//console.log(\"Initiated \" + this.moveLabels);\r\n\t\t/*\r\n\t\tif(this.mode == 0){\r\n\t\t\tconsole.log(\"Started \");\r\n\t\t\tthis.tree.setCost(1);\r\n\t\t}\r\n\t\telse if(this.mode == 1){\r\n\t\t\tthis.tree.setCost(this.getCost(game, 0));\t\t\t\r\n\t\t}\r\n\t\telse if(this.mode == 2){\r\n\t\t\tthis.tree.setCost(this.getCost(game, 1));\t\t\t\r\n\t\t}\r\n\t\t*/\r\n\t\tthis.nodes.push(this.tree);\r\n\t\t\r\n\t};\r\n\t\r\n\tthis.collissionCheck = function(board){\r\n\t\tfor(var b = 0; b < this.solutions.length; b++){\r\n\t\t\t//console.log(board);\r\n\t\t\tvar collisions = 0;\r\n\t\t\tfor(var y = 0; y < board.length; y++){\r\n\t\t\t\tfor(var x = 0; x < board[y].length; x++){\r\n\t\t\t\t\tif(this.solutions[b][y][x] == board[y][x]){\r\n\t\t\t\t\t\tcollisions++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{ //Exit this search\r\n\t\t\t\t\t\ty = board.length - 1;\r\n\t\t\t\t\t\tx = board[0].length - 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(collisions == (board.length * board[y].length)){\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t//console.log(collisions);\r\n\t\tthis.solutions.push(board);\r\n\t\treturn 0;\r\n\t}\r\n\t\r\n\t//________________________________________________________//\r\n\t// \r\n\t// Expand the branch next in queue\r\n\t//________________________________________________________//\r\n\tthis.expand = function(){\r\n\t\t\r\n\t\tif(this.finished == 1){return 0;}\r\n\t\tvar node = this.nodes.pop(); // Trees pop here\r\n\t\t\r\n\t\tvar children = [];\r\n\t\t//console.log(this.lastTree);\r\n\t\t//try{this.lastTree.setState(\"explored\")}catch(err){};\r\n\t\tif(this.lastTree.getMove() != -1){this.lastTree.setState(\"explored\")};\r\n\t\tif(node.getMove() != -1){node.setState(\"current\")};\r\n\t\t//if(node.singleCost == 0)this.wonGame(node);\t\r\n\t\t\r\n\t\t\r\n\t\tfor(var i = 0; i < 4; i++){\r\n\t\t\tif(node.parent.move(i) == 0){ //Is it a legal move\r\n\t\t\t\t//Create new tree object to save state\r\n\t\t\t\t//Create child to inherit parents state\r\n\t\t\t\tvar child = new Game;\r\n\t\t\t\tchild.createSize();\r\n\t\t\t\tchild.setBoard(node.parent.board);\r\n\t\t\t\t\r\n\t\t\t\tvar tree = new Tree;\r\n\t\t\t\ttree.setParent(child);\r\n\t\t\t\tif(this.mode == 0){ //Uniform Cost Search\r\n\t\t\t\t\t//console.log(0 + \" \" + node.getCumulativeCost());\r\n\t\t\t\t\ttree.singleCost = this.getCost(child, 0);\r\n\t\t\t\t\ttree.setCumulativeCost(1 + node.getCumulativeCost());\r\n\t\t\t\t\ttree.setCost(1 + tree.getCumulativeCost());//this.getCost(child, 1));\r\n\t\t\t\t}\r\n\t\t\t\telse if(this.mode == 1){ //A* With misplace tile\r\n\t\t\t\t\t//console.log(1 + \" \" + node.getCumulativeCost());\r\n\t\t\t\t\ttree.singleCost = this.getCost(child, 0);\r\n\t\t\t\t\ttree.misplacedCost = this.getCost(child, 0);\r\n\t\t\t\t\ttree.setCumulativeCost(tree.misplacedCost + node.getCumulativeCost());\r\n\t\t\t\t\ttree.setCost(tree.getCumulativeCost());\r\n\t\t\t\t}\r\n\t\t\t\telse if(this.mode == 2){ //A* With Manhattan Distance\r\n\t\t\t\t\t//console.log(2 + \" \" + node.getCumulativeCost());\r\n\t\t\t\t\ttree.singleCost = this.getCost(child, 1);\r\n\t\t\t\t\ttree.manhattanCost = this.getCost(child, 1);\r\n\t\t\t\t\ttree.setCumulativeCost(tree.manhattanCost + node.getCumulativeCost());\r\n\t\t\t\t\ttree.setCost(tree.getCumulativeCost());\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//tree.setMove(this.moveLabels[i+1]);\r\n\t\t\t\ttree.setMove(i);\r\n\t\t\t\ttree.path.push(i);\r\n\t\t\t\tthis.depth = Math.max(this.depth, node.path.length);\r\n\t\t\t\t\r\n\t\t\t\tvar newPath = node.path.slice();\r\n\t\t\t\tnewPath.push(i);\r\n\t\t\t\ttree.path = newPath;\r\n\t\t\t\t\r\n\t\t\t\ttree.setState(\"unexplored\");\r\n\t\t\t\tnode.children.push(tree); //save children\r\n\t\t\t\tnode.parent.move((i+2)%4); \t //move node back\r\n\t\t\t\t\r\n\t\t\t\tthis.nodes.push(tree); //Add to queue list\r\n\t\t\t\t//console.log(this.maxNodeDepth + \" \" + this.nodes.length);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\t\r\n\t\t\r\n\t\t//console.log(this.lastBoard, node.parent.board);\r\n\t\t//node.parent.translate(this.lastBoard, node.parent.board);\r\n\t\t//*node.parent.translate(node.parent.board);\r\n\t\tthis.lastBoard = node.parent.board;\r\n\t\tthis.lastTree = node;\r\n\t\tthis.maxNodeDepth = Math.max(this.maxNodeDepth, this.nodes.length);\t\t\r\n\t\tif(node.singleCost == 0)this.wonGame(node);\t\r\n\t\tthis.steps++; //this contains the solution depth/steps\r\n\t\t//console.log(this.lastBoard + \" \" + this.collisionCheck(this.lastBoard));\r\n\t\t\r\n\t\tif(this.collissionCheck(this.lastBoard)){\r\n\t\t\tthis.collissionsCouter++;\r\n\t\t}\r\n\t\telse{\r\n\t\t\tthis.collissionsCouter = 0;\r\n\t\t}\r\n\t\tif(this.collissionsCouter > 500){\t\t\t\r\n\t\t\tMaterialize.toast('Too Many Collisions!', 4000) \r\n\t\t\tMaterialize.toast('This Puzzle is likely Unsolvable!', 4000) \r\n\t\t\tthis.finished = 1;\r\n\t\t}\r\n\t\t\r\n\t\tif(this.nodes.length){ //If we have branches to explore\r\n\t\t\t//sort branches by g(x) cost\r\n\t\t\tthis.nodes.sort(function(a, b){\r\n\t\t\t\treturn b.getCumulativeCost() - a.getCumulativeCost();\r\n\t\t\t});\t\t\t\r\n\t\t}\r\n\t\t//*updateGraph(this.tree);\r\n\t\treturn 0;\r\n\t};\r\n\t\r\n\tthis.legalMove = function(tree, move){\t\t\r\n\t\tvar results = -1;\r\n\t\tfor(var i = 0; i < tree.children.length;i++){\r\n\t\t\tif(tree.children[i].move == move) return i;\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\t\r\n\t//________________________________________________________//\r\n\t// \r\n\t// Moves Puzzle\r\n\t//________________________________________________________//\r\n\tthis.movePuzzle = function(direction){\r\n\t\t\r\n\t\tvar move = this.legalMove(this.lastTree, direction);\r\n\t\tif(move != -1){\r\n\t\t\tvar node = this.lastTree.children[move];\r\n\t\t\t//console.log(node);\r\n\t\t\tif(node.getMove() != -1){node.setState(\"current\")};\t\r\n\t\t\t\r\n\t\t\tif(this.finished == 1){return 0;}\t\r\n\t\t\tvar children = [];\r\n\t\t\t//console.log(this.lastTree);\r\n\t\t\tif(this.lastTree.getMove() != -1){this.lastTree.setState(\"explored\")};\r\n\t\t\tfor(var i = 0; i < 4; i++){\r\n\t\t\t\tif(node.parent.move(i) == 0){ //Is it a legal move\r\n\t\t\t\t\t//Create new tree object to save state\r\n\t\t\t\t\t//Create child to inherit parents state\r\n\t\t\t\t\tvar child = new Game;\r\n\t\t\t\t\tchild.createSize();\r\n\t\t\t\t\tchild.setBoard(node.parent.board);\r\n\t\t\t\t\tvar tree = new Tree;\r\n\t\t\t\t\ttree.setParent(child);\r\n\t\t\t\t\tif(this.mode == 0){ //Uniform Cost Search\r\n\t\t\t\t\t\t//console.log(0 + \" \" + node.getCumulativeCost());\r\n\t\t\t\t\t\ttree.singleCost = this.getCost(child, 0);\r\n\t\t\t\t\t\ttree.setCumulativeCost(1 + node.getCumulativeCost());\r\n\t\t\t\t\t\ttree.setCost(1 + tree.getCumulativeCost());//this.getCost(child, 1));\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(this.mode == 1){ //A* With misplace tile\r\n\t\t\t\t\t\t//console.log(1 + \" \" + node.getCumulativeCost());\r\n\t\t\t\t\t\ttree.singleCost = this.getCost(child, 0);\r\n\t\t\t\t\t\ttree.misplacedCost = this.getCost(child, 0);\r\n\t\t\t\t\t\ttree.setCumulativeCost(tree.misplacedCost + node.getCumulativeCost());\r\n\t\t\t\t\t\ttree.setCost(tree.getCumulativeCost());\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(this.mode == 2){ //A* With Manhattan Distance\r\n\t\t\t\t\t\t//console.log(2 + \" \" + node.getCumulativeCost());\r\n\t\t\t\t\t\ttree.singleCost = this.getCost(child, 1);\r\n\t\t\t\t\t\ttree.manhattanCost = this.getCost(child, 1);\r\n\t\t\t\t\t\ttree.setCumulativeCost(tree.manhattanCost + node.getCumulativeCost());\r\n\t\t\t\t\t\ttree.setCost(tree.getCumulativeCost());\r\n\t\t\t\t\t}\t\t\t\t\r\n\t\t\t\t\t//tree.setMove(this.moveLabels[i+1]);\r\n\t\t\t\t\ttree.setMove(i);\r\n\t\t\t\t\ttree.path.push(i);\r\n\t\t\t\t\tthis.depth = Math.max(this.depth, node.path.length);\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar newPath = node.path.slice();\r\n\t\t\t\t\tnewPath.push(i);\r\n\t\t\t\t\ttree.path = newPath;\r\n\t\t\t\t\t\r\n\t\t\t\t\ttree.setState(\"unexplored\");\r\n\t\t\t\t\tnode.children.push(tree); //save children\r\n\t\t\t\t\tnode.parent.move((i+2)%4); \t //move node back\r\n\t\t\t\t\t\r\n\t\t\t\t\tthis.nodes.push(tree); //Add to queue list\r\n\t\t\t\t\t//console.log(this.maxNodeDepth + \" \" + this.nodes.length);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\t\r\n\t\t\r\n\t\t\t//console.log(this.lastBoard, node.parent.board);\r\n\t\t\t//node.parent.translate(this.lastBoard, node.parent.board);\r\n\t\t\t//node.parent.translate(node.parent.board);\r\n\t\t\tthis.lastBoard = node.parent.board;\r\n\t\t\tthis.lastTree = node;\r\n\t\t\tthis.maxNodeDepth = Math.max(this.maxNodeDepth, this.nodes.length);\t\t\r\n\t\t\tif(node.singleCost == 0)this.wonGame(node);\t\r\n\t\t\tthis.steps++; //this contains the solution depth/steps\r\n\t\t\t\r\n\t\t\tif(this.nodes.length){ //If we have branches to explore\r\n\t\t\t\t//sort branches by g(x) cost\r\n\t\t\t\tthis.nodes.sort(function(a, b){\r\n\t\t\t\t\treturn b.getCumulativeCost() - a.getCumulativeCost();\r\n\t\t\t\t});\t\t\t\r\n\t\t\t}\r\n\t\t\t//updateGraph(this.tree);\r\n\t\t}\r\n\t\treturn 0;\r\n\t};\r\n\t\r\n\t//________________________________________________________//\r\n\t// \r\n\t// Set the mode\r\n\t//________________________________________________________//\r\n\tthis.setMode = function(mode){\r\n\t\tthis.mode = mode;\r\n\t};\r\n\t\r\n\t//________________________________________________________//\r\n\t// \r\n\t// determine if path is in the right direction\r\n\t//________________________________________________________//\r\n\tthis.findDivergence = function(state1, state2){\r\n\t\tvar i = 0;\r\n\t\ttry{\r\n\t\t\twhile(state1[i] == state2[i] && i < state1.length) i++;\r\n\t\t\treturn state2.slice(i,state2.length);\r\n\t\t}\r\n\t\tcatch(err){\r\n\t\t\t\tconsole.log(err);\r\n\t\t}\r\n\t};\r\n\t\r\n\t//________________________________________________________//\r\n\t// \r\n\t// Calculate the cost using the given algorithem\r\n\t//________________________________________________________//\r\n\tthis.getCost = function(state, heuristic){\r\n\t\tif(heuristic == 1){ //Manhattan Distance\r\n\t\t\tvar i = 0; //holds the current number being compared\r\n\t\t\tvar cost = 0;\r\n\t\t\tfor(var y = 0; y < state.board.length; y++){\r\n\t\t\t\tfor(var x = 0; x < state.board[y].length; x++){\r\n\t\t\t\t\tif(state.board[y][x] != 0){\r\n\t\t\t\t\t\tvar position = this.findCoordinates(state.board[y][x]);\r\n\t\t\t\t\t\tcost += Math.abs(x-position[0]) + \r\n\t\t\t\t\t\t\t\tMath.abs(y-position[1]);\r\n\t\t\t\t\t\ti++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if(heuristic == 0){ //Misplaced tiles\r\n\t\t\tvar i = 0; //holds the current number being compared\r\n\t\t\tvar cost = 0;\r\n\t\t\tfor(var y = 0; y < state.board.length; y++){\r\n\t\t\t\tfor(var x = 0; x < state.board[y].length; x++){\r\n\t\t\t\t\tcost += state.board[y][x] != this.solution[y][x];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn cost;\r\n\t};\r\n\t\r\n\t//________________________________________________________//\r\n\t// \r\n\t// Finds the coordinates of the given value\r\n\t//________________________________________________________//\r\n\tthis.findCoordinates = function(val){\r\n\t\tfor(var y = 0; y < this.solution.length; y++){\r\n\t\t\tfor(var x = 0; x < this.solution[y].length; x++){\r\n\t\t\t\t//When found return coordinates\r\n\t\t\t\tif(this.solution[y][x] == val){\r\n\t\t\t\t\treturn [x, y]; \r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t//________________________________________________________//\r\n\t// \r\n\t// Won Game\r\n\t//________________________________________________________//\r\n\tthis.wonGame = function(node){\r\n\t\tnode.setState(\"winner\");\r\n\t\t//console.log(\"Nodes expanded: \" + this.steps);\r\n\t\t//console.log(\" Max nodes: \" + this.maxNodeDepth);\r\n\t\t//console.log(\"Solution depth: \" + this.depth);\r\n\t\t//console.log(\" Solution: \" + node.path);\r\n\t\td3.select(\".results\").html(\r\n\t\t\t\"Puzzle Array ------ : \" + this.tree.parent.board + \"<br/>\" +\r\n\t\t\t\"Nodes expanded : \" + this.steps + \"<br/>\" +\r\n\t\t\t\"Max nodes -------- : \" + this.maxNodeDepth + \"<br/>\" +\r\n\t\t\t\"Solution depth --- : \" + this.depth + \"<br/>\" +\r\n\t\t\t\"Solution ------------ : \" + node.path.slice(1,node.path.length)\r\n\t\t);\r\n\t\tMaterialize.toast('Solution: ' + node.path.slice(1,node.path.length), 8000) \r\n\t\tthis.finished = 1;\r\n\t};\r\n\r\n\t//________________________________________________________//\r\n\t// \r\n\t// Solve Game\r\n\t//________________________________________________________//\r\n\tthis.solve = function(){\r\n\t\twhile(this.finished == 0){\r\n\t\t\tthis.expand();\r\n\t\t\tif(this.steps >= this.stepsLimit){this.finished = 2};\r\n\t\t\tif(this.depth >= this.depthLimit){this.finished = 3};\r\n\t\t\t//console.log(\"Solving... \" + this.steps + \" \" + this.stepsLimit + \" \" + this.finished);\r\n\t\t}\r\n\t\tif(this.finished == 2){\r\n\t\t\tconsole.log(\"Reached steps limit of \" + this.stepsLimit + \" depth: \" + this.depth);\t\t\t\r\n\t\t\td3.select(\".results\").html(\"Reached steps limit of \" + this.stepsLimit + \" depth: \" + this.depth);\r\n\t\t}\r\n\t\telse if(this.finished == 3){\r\n\t\t\tconsole.log(\"Reached depth limit of \" + this.depthLimit + \" depth: \" + this.depth);\r\n\t\t\td3.select(\".results\").html(\"Reached depth limit of \" + this.depthLimit + \" depth: \" + this.depth);\r\n\t\t}\r\n\t\t//updateGraph(this.tree);\r\n\t};\t\r\n\t\r\n\tthis.init(game);\r\n}", "function solveNetwork(){\n\n\t//Reset tanks output \n\tTanks.forEach(function(tank){tank.value=null});\n\n\t//solve all easy cases: only 1 output\n\t(function(){\n\t\t//1. troba els nodes que tenen només un output: flow=value\n\t\tfor(var i in Connections) {\n\t\t\tvar from=Connections[i].from;\n\t\t\tif(getOutputs(from).length==1)\n\t\t\t{\n\t\t\t\tif(Connections[i].flow==null)\n\t\t\t\t{\n\t\t\t\t\tvar flow=getNodeByName(from).value;\n\t\t\t\t\tif(flow!=null) Connections[i].flow=flow;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})();\n\n\tvar notCalcItems=Infinity;//initial value that we have to get to 0\n\n\t//infinte loop for solving network\n\tvar iteracio=1;\n\n\twhile(true) {\n\t\tconsole.log(\"[+] new solver iteration (\"+iteracio+\")\");\n\n\t\t//calc connection flows\n\t\tConnections.forEach(function(con){\n\t\t\tisConCalculable(con);\n\t\t})\n\n\t\t//calc tank outputs\n\t\tTanks.forEach(function(tank){\n\t\t\tisCalculable(tank.name);\n\t\t})\n\n\t\t//check if we are solving new nodes\n\t\tvar nci=getNotCalcNodes()+getNotCalcCons();\n\t\tconsole.log(\"items no calculats:\"+nci)\n\t\tif(nci==0) {\n\t\t\tconsole.log(\"\\nSUCCESS! ALL ITEMS CALCULATED\");\n\t\t\treturn;\n\t\t}\n\t\tif(nci==notCalcItems) {\n\t\t\talert(\"ERROR! We are not solving new items (nodes and links). System is undetermined or is already calculated\");\n\t\t\treturn;\n\t\t}\n\t\tnotCalcItems=nci;//update nonCalcNodes\n\n\t\titeracio++;\n\t}\n}", "handleSolver() {\n let rubiksWithCheck = this.state.rubiksArray.slice();\n rubiksWithCheck.check = true;\n this.miniMaxSolverWorker.postMessage(rubiksWithCheck);\n }", "function solve() {\r\n//\t\tvar stepId = setInterval(function() {\r\n//\t\t\tsolvealgo();\t\t\t\r\n//\t\t\t\r\n//\t\t\tif (clickablecells.length == 0) {\r\n//\t\t\t\tclearInterval(stepId);\r\n//\t\t\t}\r\n//\t\t}, 1000);\r\n\t\t\t\r\n\t\tfunction clickRandom(cells) {\r\n\t\t\tvar rand = Math.floor(Math.random()*cells.length);\r\n\t\t\t$(cells[rand]).trigger({ type: 'mousedown', which: 1});\r\n\t\t}\r\n\t\t\r\n\t\tfunction clickCell(cellid) {\r\n\t\t\t$('#' + cellid).trigger({ type: 'mousedown', which: 1});\r\n\t\t}\r\n\t\t\r\n\t\tfunction flagCell(cellid) {\r\n\t\t\tvar cell = $('#' + cellid);\r\n\t\t\t\r\n\t\t\tif (cell.text().length == 0) {\r\n\t\t\t\tcell.trigger({ type: 'mousedown', which: 3});\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tvar added = [],\r\n\t\t\tones = [], // Array of cells with value 1\r\n\t\t\tfoundmines = [],\r\n\t\t\tsolvedmines = []; // Completed cells\r\n\t\t\r\n\t\tsolvealgo();\r\n\t\tfunction solvealgo() {\r\n\t\t\tif (ones.length <= 1) {\r\n\t\t\t\tclickRandom($('.clickable'));\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor (var i = 0; i < clickedcells.length; i++) {\r\n\t\t\t\tvar cellId = clickedcells[i],\r\n\t\t\t\t\tcellValue = cells[cellId];\r\n\t\t\t\t\r\n\t\t\t\tif (added.indexOf(cellId) < 0) {\r\n\t\t\t\t\tif (cellValue == 1) {\r\n\t\t\t\t\t\tones.push(cellId);\r\n\t\t\t\t\t\tadded.push(cellId);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor (var i = 0; i < ones.length; i++) {\r\n\t\t\t\tvar mineNearby = searchNearby(ones[i], 1, 'mine');\r\n\t\t\t\tif (mineNearby != null) {\r\n\t\t\t\t\tconsole.log('mine' + ' search near ' + ones[i] + ', found ' + mineNearby);\r\n\t\t\t\t\tfoundmines.push(mineNearby);\r\n\t\t\t\t\tflagCell(mineNearby);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor (var i = 0; i < foundmines.length; i++) {\r\n\t\t\t\tvar oneNearby = searchNearby(foundmines[i], 1, 'val');\r\n\t\t\t\tconsole.log('val' + ' search near ' + foundmines[i] + ', found ' + oneNearby);\r\n\t\t\t\tfor (var m = 0; m < mineNearby.length; m++) {\r\n//\t\t\t\t\tclickCell(mineNearby[m]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfunction searchNearby(id, num, type) {\r\n\t\t\t\tvar searchForUnclicked = 'mine',\r\n\t\t\t\t\tsearchForValue = 'val',\r\n\t\t\t\t\tlookingfor = 'clickable',\r\n\t\t\t\t\tfound = [],\r\n\t\t\t\t\tnw = id - SIZE - 1, nwcell = $('#' + nw),\r\n\t\t\t\t\tn = id - SIZE, ncell = $('#' + n),\r\n\t\t\t\t\tne = id - SIZE + 1, necell = $('#' + ne),\r\n\t\t\t\t\tw = id - 1, wcell = $('#' + w),\r\n\t\t\t\t\te = id + 1, ecell = $('#' + e),\r\n\t\t\t\t\tsw = id + SIZE - 1, swcell = $('#' + sw),\r\n\t\t\t\t\ts = id + SIZE, scell = $('#' + s),\r\n\t\t\t\t\tse = id + SIZE + 1, secell = $('#' + se);\r\n\t\t\t\t\r\n\t\t\t\tif (id % SIZE > 0) { // west\r\n\t\t\t\t\tif (type == searchForUnclicked && nwcell.hasClass(lookingfor) ||\r\n\t\t\t\t\t\ttype == searchForValue && nwcell.text() == num) found.push(nw);\r\n\t\t\t\t\tif (type == searchForUnclicked && wcell.hasClass(lookingfor) ||\r\n\t\t\t\t\t\ttype == searchForValue && wcell.text() == num) found.push(w);\r\n\t\t\t\t\tif (type == searchForUnclicked && swcell.hasClass(lookingfor) ||\r\n\t\t\t\t\t\ttype == searchForValue && swcell.text() == num) found.push(sw);\r\n\t\t\t\t} \r\n\t\t\t\tif (id % SIZE < SIZE - 1) { // east\r\n\t\t\t\t\tif (type == searchForUnclicked && necell.hasClass(lookingfor) ||\r\n\t\t\t\t\t\ttype == searchForValue && necell.text() == num) found.push(ne);\r\n\t\t\t\t\tif (type == searchForUnclicked && ecell.hasClass(lookingfor) ||\r\n\t\t\t\t\t\ttype == searchForValue && ecell.text() == num) found.push(e);\r\n\t\t\t\t\tif (type == searchForUnclicked && secell.hasClass(lookingfor) ||\r\n\t\t\t\t\t\ttype == searchForValue && secell.text() == num) found.push(se);\r\n\t\t\t\t}\r\n\t\t\t\tif (type == searchForUnclicked && ncell.hasClass(lookingfor) ||\r\n\t\t\t\t\t\ttype == searchForValue && ncell.text() == num) found.push(n);\r\n\t\t\t\tif (type == searchForUnclicked && scell.hasClass(lookingfor) ||\r\n\t\t\t\t\t\ttype == searchForValue && scell.text() == num) found.push(s);\r\n\t\t\t\t\r\n\t\t\t\treturn (type == searchForUnclicked && found.length == num ||\r\n\t\t\t\t\t\ttype == searchForValue) ? found : null;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function depthFirstAssigner() {\n\t\t// Save state in case we need to backtrack (need to clone object)\n\t\t// Declared locally since each recursion will have one of these\n\t\tvar ssPromisedPrefs = JSON.parse(JSON.stringify(promisedPrefs));\n\t\tvar ssAssignmentObject = JSON.parse(JSON.stringify(assignmentObject));\n\t\tvar ssUserArr = userArr.slice(0);\n\n\t\t// If we've assigned everybody, we're done!\n\t\tif(Object.keys(promisedPrefs).length === 0 ) {\n\t\t\tconsole.log(\"Found a local solution:\")\n\t\t\tconsole.log(assignmentObject);\n\t\t\treturn true;\n\t\t}\n\n\t\t// If somebody who has been promised a spot has no remaining options, we've failed!!!\n\t\tif(promisedPrefs[userArr[0]][1].length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// console.log(\"_______________________________________\")\n\t\t// console.log(\"Testing \" + userArr[0] + \". Promised Prefs: \" + JSON.stringify(promisedPrefs));\n\n\t\t\n\t\tfor (var k = 0; k<ssPromisedPrefs[ssUserArr[0]][1].length ; k++) {\n\t\t\t\n\t\t\tvar chosenAppointment = ssPromisedPrefs[ssUserArr[0]][1][k];\n\n\t\t\tconsole.log(\"Trying \" + ssUserArr[0] + \" in \" + chosenAppointment);\n\n\t\t\tif(chosenAppointment) {\n\n\t\t\t\t//Choose first option, assign it, do cleanup as before\n\t\t\t\t\n\t\t\t\tassignmentObject[chosenAppointment] = userArr[0];\n\n\t\t\t\t//Removes winner from preference object (and userArr)\n\t\t\t\tdelete promisedPrefs[userArr[0]];\n\t\t\t\t//Nukes all references to that appointment\n\t\t\t\tpromisedPrefs = preferencePopper(promisedPrefs, chosenAppointment); \n\t\t\t\t//Cleans user array to remove removed users\n\t\t\t\tuserArr = userCleaner(userArr,promisedPrefs);\n\t\t\t\t//Removes appointment from list\n\t\t\t\tappointmentArray = appointmentPopper(appointmentArray, chosenAppointment);\n\n\t\t\t\tif(depthFirstAssigner()) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t// Resets objects (important for loops above)\n\t\t\t\tpromisedPrefs = JSON.parse(JSON.stringify(ssPromisedPrefs));\n\t\t\t\tassignmentObject = JSON.parse(JSON.stringify(ssAssignmentObject));\n\t\t\t\tuserArr = ssUserArr.slice(0);\n\t\t\t}\n\t\t}\n\n\t\tconsole.log(\"Rewinding from \" + userArr[0]);\n\t\t//console.log(promisedPrefs);\n\t\treturn false;\n\t}", "function resolveDeferreds() {\n for (var i = 0; i < manager.deferreds.length; i++){\n manager.deferreds[i].resolveWith(root, [root]);\n }\n manager.deferreds = [];\n }", "function updateClueState(clueIndex, annoPrefilled, forceSolved) {\n let cis = getAllLinkedClueIndices(clueIndex)\n if (!cis || cis.length == 0) {\n return\n }\n clueIndex = cis[0] // Use parent for a linked child\n let clue = clues[clueIndex]\n if (!clue) {\n return\n }\n let solved = false\n if (clue && clue.clueTR && clue.clueTR.className == 'solved') {\n solved = true\n }\n let numFilled = 0\n let numPrefilled = 0\n for (let ci of cis) {\n let theClue = clues[ci]\n if (!theClue.clueTR) {\n numFilled = 0\n break\n }\n let isFullRet = isFull(ci)\n if (!isFullRet[0]) {\n numFilled = 0\n break\n }\n numFilled += isFullRet[1]\n if (isFullRet[0] == 2) {\n numPrefilled += isFullRet[1]\n }\n }\n if (forceSolved) {\n if (forceSolved == 'solved') {\n solved = true\n } else {\n solved = false\n // override for all-prefilled\n if (allCellsKnown(clueIndex) && numPrefilled == clue.enumLen) {\n solved = true\n }\n }\n } else if (clue.annoSpan && clue.annoSpan.style.display == '') {\n solved = true\n } else if (allCellsKnown(clueIndex)) {\n solved = numFilled == clue.enumLen\n }\n if (solved && numFilled == numPrefilled && annoPrefilled &&\n (clue.annoSpan || clue.solution)) {\n revealClueAnno(clueIndex);\n }\n let cls = solved ? 'solved' : ''\n for (let ci of cis) {\n if (clues[ci].clueTR) {\n clues[ci].clueTR.setAttributeNS(null, 'class', cls);\n }\n if (ci == currentClueIndex) {\n let currLab = document.getElementById('current-clue-label')\n if (currLab) {\n currLab.setAttributeNS(null, 'class', cls);\n }\n }\n }\n}", "solveSudoku(grid) {\n // If the sudoku grid has been filled, we are done\n let [row, col] = this.getUnassignedLocation(grid);\n if (row === 10 || col === 10) {\n return true;\n }\n\n // Consider digits 1 to 9\n for (let num = 1; num <= 9; num++) {\n // If placing the current number in the current\n // unassigned location is valid, go ahead\n if (this.isSafe(grid, row, col, num)) {\n // Make tentative assignment\n grid[row][col] = num;\n\n // Do the same thing again recursively. If we go\n // through all of the recursions, and in the end\n // return true, then all of our number placements\n // on the sudoku grid are valid and we have fully\n // solved it\n if (this.solveSudoku(grid)) {\n return true;\n }\n\n // As we were not able to validly go through all\n // of the recursions, we must have an invalid number\n // placement somewhere. Lets go back and try a\n // different number for this particular unassigned location\n grid[row][col] = 0;\n }\n }\n\n // If we have gone through all possible numbers for the current unassigned\n // location, then we probably assigned a bad number early. Lets backtrack\n // and try a different number for the previous unassigned locations.\n return false;\n }", "function updateAll() {\n\tthis.circle.show();\n\tthis.mid.show();\n\tfor (var i = 0; i < this.holes.length; i++) {\n\t\tthis.holes[i].show();\n\t}\n}", "function resolveClusters() {\n //Encontra os Matchs\n findClusters();\n //Enquanto houver Matchs\n while (clusters.length > 0) {\n //Remove-os\n removeClusters();\n //Desce os tiles\n shiftTiles();\n //Verifica a formação de mais\n findClusters();\n }\n }", "function startAlgorithm() {\n let startBtn = document.querySelector('.submit-btn')\n startBtn.addEventListener('click', function () {\n let foundEnd = false;\n let nodesList = []\n let availableNodes = []\n let visitedNodes = new Set\n let visitedNodesOrder = []\n let solution = []\n\n\n inertStartNode();\n\n resetNodes()\n addWalls()\n isRunning = true\n unvisitedNodes()\n GetVisitedNodes()\n let endNode = document.querySelector('.end-node').id\n getSolution(endNode)\n animateDijkstra()\n isRunning = false\n\n // add start node to array need not empty array for node exploration\n // also add node object to \n function inertStartNode() {\n let startNode = document.querySelector(\".start-node\").id;\n let splittedNode = startNode.split(\"-\")\n nodesList.push([parseInt(splittedNode[0]), parseInt(splittedNode[1])]);\n let newNode = new Node(startNode)\n newNode.setX()\n newNode.setY()\n newNode.updateType('start-node')\n newNode.setDistance(0)\n availableNodes.push(newNode)\n }\n\n\n // make list of all unvisited nodes\n // where going to check for valid nodes\n // get nodeId and pas into function that is going to make all objects\n function unvisitedNodes() {\n let allUnvisitedNodes = document.querySelectorAll('.unvisited')\n allUnvisitedNodes.forEach((nodeObject) => {\n let nodeId = nodeObject.id\n let newNode = new Node(nodeId)\n newNode.setY()\n newNode.setX()\n availableNodes.push(newNode)\n });\n };\n\n\n // function to get all valid node into list\n // iterate over created nodes later in function\n function GetVisitedNodes() {\n if (foundEnd == false && nodesList.length != 0) {\n let firstNode = nodesList[0];\n let NodeId = firstNode[0] + '-' + firstNode[1]\n if (visitedNodes.has(NodeId) == false) {\n let firstNode = nodesList[0];\n let nodeId = firstNode[0] + '-' + firstNode[1]\n visitedNodes.add(nodeId)\n let validNeighbors = newNodes(firstNode);\n nodesList = nodesList.concat(validNeighbors)\n\n let nodeObject = getObject(nodeId)\n let nodePosition = availableNodes.indexOf(nodeObject)\n visitedNodesOrder.push(availableNodes[nodePosition])\n let nodeDistance = getNodeDistance(validNeighbors)\n availableNodes[nodePosition].distance = nodeDistance\n availableNodes[nodePosition].nodeType = 'visited'\n GetVisitedNodes()\n } else {\n nodesList.shift()\n GetVisitedNodes()\n }\n }\n };\n\n\n // checking if node is final node\n // need for recursive function check\n function checkNodesType(nodeList) {\n let approved = [];\n nodeList.forEach((nodeLocation) => {\n if (nodeLocation[0] == endCoordinates[0] && nodeLocation[1] == endCoordinates[1]) {\n foundEnd = true;\n console.log('Found final')\n } else {\n approved.push(nodeLocation)\n }\n });\n return approved;\n };\n\n\n // result of list of all valid nodes\n // check if nodes location are not out of bounds\n // input is [y, x] location with int values\n function newNodes(nodeLocation) {\n let newCoordinates = [];\n newCoordinates.push([nodeLocation[0], nodeLocation[1] + 1]);\n newCoordinates.push([nodeLocation[0], nodeLocation[1] - 1]);\n newCoordinates.push([nodeLocation[0] + 1, nodeLocation[1]]);\n newCoordinates.push([nodeLocation[0] - 1, nodeLocation[1]]);\n newCoordinates = checkByCoordinates(newCoordinates);\n return checkNodesType(newCoordinates);\n };\n\n\n // check if coordinates for future nodes are valid/are not out of bounds\n // in and out list of nodes\n // also check if nodes been visited \n function checkByCoordinates(nodeList) {\n let approved = [];\n nodeList.forEach((nodeLocation) => {\n if (nodeLocation[0] >= 0 && nodeLocation[0] < height && nodeLocation[1] >= 0 && nodeLocation[1] < width) {\n let NodeId = nodeLocation[0] + '-' + nodeLocation[1]\n approved.push(nodeLocation);\n }\n });\n return approved;\n };\n\n\n // get object node from nodeId\n // used to put this object in visitedNodesOrder array\n // this array will be iterated to draw nodes \n function getObject(nodeId) {\n let allFound = availableNodes.filter(function (node) {\n if (node.nodeId == nodeId) {\n return true\n };\n });\n if (allFound[0] != undefined) {\n return allFound[0]\n };\n };\n\n\n // get distance of of node by looking min distance of a it neighbors\n // input is list of [y-x], so need to convert to nodeId string first for filtering\n // make objects first prior filtering\n function getNodeDistance(neighbors) {\n let nodeObjects = getNeighborObjects(neighbors)\n let distances = []\n nodeObjects.forEach((neighbor) => {\n if (neighbor != undefined) {\n distances.push(neighbor.distance)\n };\n });\n distances.sort()\n if (distances[0] == Infinity) {\n return 0\n } else {\n return distances[0] + 1\n }\n };\n\n\n // get list of neighbor objects\n // input is list of [y-x], so need to convert to nodeId string first for filtering\n function getNeighborObjects(neighbors) {\n let nodeObjects = []\n neighbors.forEach((neighbor) => {\n let nodeId = neighbor[0] + '-' + neighbor[1]\n nodeObjects.push(getObject(nodeId))\n });\n return nodeObjects\n };\n\n\n // check array of unvisited nodes\n // return true if node been discovered already\n function nodeBeenDiscovered(nodeId) {\n let allFound = availableNodes.filter(function (node) {\n if (node.type != 'unvisited') {\n return true\n };\n })\n if (allFound.length == 0) {\n return true\n } else {\n return false\n }\n }\n\n\n // make solution\n function getSolution(nodeId) {\n if (nodeId != null) {\n let nodeLocation = [parseInt(nodeId.split(\"-\")[0]), parseInt(nodeId.split(\"-\")[1])]\n let validNeighbors = newNodes(nodeLocation)\n let neighborObjects = getNeighborObjects(validNeighbors)\n let foundStart = false\n\n neighborObjects.forEach((nodeObject) => {\n if (nodeObject != undefined) {\n if (nodeObject.distance == 0) {\n foundStart = true\n };\n }\n });\n if (foundStart == false) {\n solution.unshift(nodeId)\n let previousNode = previousNodeId(neighborObjects)\n getSolution(previousNode)\n } else {\n solution.unshift(nodeId)\n };\n }\n };\n\n function animateDijkstra() {\n visitedNodesOrder.shift()\n solution.pop()\n for (let i = 0; i <= visitedNodesOrder.length; i++) {\n if (i === visitedNodesOrder.length) {\n setTimeout(() => {\n animateShortestPath();\n }, 15 * i);\n return;\n }\n setTimeout(() => {\n const node = visitedNodesOrder[i];\n if (node != undefined) {\n document.getElementById(node.nodeId).className =\n 'visited-node';\n }\n }, 10 * i);\n }\n }\n\n\n function animateShortestPath() {\n for (let i = 0; i < solution.length; i++) {\n setTimeout(() => {\n const node = solution[i];\n document.getElementById(node).className =\n 'path-node';\n }, 50 * i);\n }\n }\n\n\n // add wall nodes to visited nodes set \n // make ure that that won't explore wall nodes\n function addWalls() {\n let allWallNodes = document.querySelectorAll('.wall-node');\n allWallNodes.forEach((wallNode) => {\n visitedNodes.add(wallNode.id)\n });\n };\n });\n}", "function fillRemaining(solutionGrid, i, j) \n { \n let N = 9;\n let SRN = 3;\n // System.out.println(i+\" \"+j); \n if (j>=N && i<N-1) \n { \n i = i + 1; \n j = 0; \n } \n if (i>=N && j>=N) \n return true; \n\n if (i < SRN) \n { \n if (j < SRN) \n j = SRN; \n } \n else if (i < N-SRN) \n { \n if (j==parseInt(i/SRN)*SRN) \n j = j + SRN; \n } \n else\n { \n if (j == N-SRN) \n { \n i = i + 1; \n j = 0; \n if (i>=N) \n return true; \n } \n } \n\n for (let num = 1; num<=N; num++) \n { \n if (CheckIfSafe(solutionGrid, i, j, num)) \n { \n solutionGrid[i][j] = num; \n if (fillRemaining(solutionGrid, i, j+1)) \n return true; \n\n solutionGrid[i][j] = 0; \n } \n } \n return false; \n }", "function recursiveBacktracking(v, d, counter, i2, j2){\n counter ++;\n\n //forward checking\n FC(d, v, i2, j2);\n if(findEmptyDomains(d)){\n //if we find an empty domain, just return false\n return false;\n }\n\n var result =false;\n //if assignment is complete, return assignment\n if (checkCompletion(v)) {\n return true;\n }\n\n //var<-select unassignedvariable(variables[csp], assignment , csp)\n var mrvList = MRV(d);\n var maxDegreeValue = -100;\n var mrvListIndex;\n for (i = 0; i < mrvList.length; i++) { \n var degree = getDegree(d, mrvList[i][0], mrvList[i][1]);\n if (degree > maxDegreeValue) {\n maxDegreeValue = degree;\n mrvListIndex = i;\n }\n }\n\n var selectedVariableIndex = mrvList[mrvListIndex];\n var selectedVariableDomain = d[selectedVariableIndex[0]][selectedVariableIndex[1]];\n \n if (step <= 3) {\n log(\"Step \" + step + \": <br>a) Variable selected: \" + selectedVariableIndex);\n log(\"b) Domain: {\" + selectedVariableDomain + \"} | Domain size: \" + selectedVariableDomain.length);\n log(\"c) Degree of variable selected: \" + maxDegreeValue + \"<br>\");\n step++;\n }\n\n //for each value in orderdomainvalues(var,assignment,csp)do\n for (var i = 0; i < selectedVariableDomain.length; i++) {\n //if value is consistent with assignment given Constraints[csp] then\n var currentValue = selectedVariableDomain[i];\n\n if (isConsistent(selectedVariableIndex, currentValue, d)) {\n\n vClone = createVariables();\n dClone = clone(d);\n\n\n //add{var = value} to assignment\n vClone[selectedVariableIndex[0]][selectedVariableIndex[1]] = currentValue;\n setCellValue(selectedVariableIndex[0], selectedVariableIndex[1], currentValue);\n dClone[selectedVariableIndex[0]][selectedVariableIndex[1]] = [1,1,1,1,1,1,1,1,1,1,1,1]; //assign a big domain so it will never be selected\n \n //result<-RecursiveBacktracking(assignment,csp)\n result = recursiveBacktracking(vClone, dClone, counter, selectedVariableIndex[0], selectedVariableIndex[1]);\n //if reulst != failure then return result\n if (result != false) {\n v = vClone;\n d = dClone;\n return result;\n }\n //remove {var = value} from assignment\n removeCellValue(selectedVariableIndex[0], selectedVariableIndex[1]);\n } \n } \n \n return false;\n \n}", "revealAll() {\n for (let i = 0; i < this.size; i++) {\n for (let j = 0; j < this.size; j++) {\n this.setRevealed(i, j);\n const count = this.countMines(i, j);\n this.setNeightborMines(i, j, count);\n }\n }\n }", "function solve(initial){\n\t\t\tif(initial.length != length){\n\t\t\t\tthrow \"Initial length expected to equal standard length of problem type.\"+initial.length + \"!=\" + length;\n\t\t\t}\n\t\t\tvar state = start();\n\t\t\tfor (var i = 0; i < initial.length; i++) {\n\t\t\t\tif(initial[i] != null) set(state, i, initial[i]);\n\t\t\t};\n\t\t\tvar result = solveState(state);\n\t\t\tif(result){\n\t\t\t\treturn result.map(function(arr){\n\t\t\t\t\treturn arr[0];\n\t\t\t\t})\n\t\t\t}else{\n\t\t\t\tconsole.log(state);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}", "handleSubmit() {\n if (!this.state.data.root) {\n noRootSelectedMessage();\n } else if (Object.keys(this.state.data.root).length == 0) {\n noRootSelectedMessage();\n } else {\n if (this.state.data.root) drawGraph(this.state.data, Algorithm.PRIM);\n this.handleClose();\n }\n }", "function GO(){\n alert('Результат Ви можете побачити в консолі!');\n var frog = {\n x: startPoints.x,\n y: startPoints.y,\n id: 0,\n jumps: 0,\n child: [],\n parent: 'I am root, baby!'\n },\n jump = 0;\n frogs.length = 0;\n frogs.push(frog);\n function runFrogRun(frogs) {\n if (jump >= jumps) {\n return;\n }\n for (frog in frogs) { \n if (frogs[frog].jumps >= jumps) {\n return;\n }\n var frogCoordinates = {\n x: frogs[frog].x,\n y: frogs[frog].y\n },\n newCoordinates = {\n forward: forward(frogCoordinates),\n leftS: leftShort(frogCoordinates),\n leftL: leftLong(frogCoordinates),\n shortS: rightShort(frogCoordinates),\n shortL: rightLong(frogCoordinates)\n }\n for (obj in newCoordinates) {\n if (newCoordinates[obj].x <= field.x && (newCoordinates[obj].y > 0 && newCoordinates[obj].y <= field.y) && ((newCoordinates[obj].x != enemyTree1.x && newCoordinates[obj].y != enemyTree1.y) || (newCoordinates[obj].x != enemyTree2.x && newCoordinates[obj].y != enemyTree2.y))) {\n newCoordinates[obj].id = frogs[frog].id+1 ;\n newCoordinates[obj].jumps = frogs[frog].jumps+1 ;\n newCoordinates[obj].child = [];\n newCoordinates[obj].parent = frogs[frog];\n if (newCoordinates[obj].x === finishPoint.x && newCoordinates[obj].y === finishPoint.y) {\n results.push(newCoordinates[obj]);\n }\n else {\n frogs[frog].child.push(newCoordinates[obj]);\n }\n }\n }\n runFrogRun(frogs[frog].child);\n }\n jump++;\n };\n\n //Counting results\n function displayFrog(){\n var min = 9999,\n goldenFrog = {};\n for (var i = 0; i < results.length; i++) {\n if(results[i].jumps < min) {\n min = results[i].jumps;\n goldenFrog = results[i];\n }\n }\n \n console.log('Мінімальна кількість стрибків до цілі: ' + min);\n console.log('Шлях до скарбу ↓');\n console.dir(goldenFrog);\n }\n \n //Go go frog!\n runFrogRun(frogs);\n displayFrog(); \n}", "function findRoots( inputs, sqrtStatus, polishStatus ) {\n\t$('#s3,#s2,#s1').hide();\n\n\tvar size = inputs.length;\n\t// This should never happen for our usage\n\tif (size != 3) {\n\t\t$('#error').stop().html(\"<p>Somehow you didn't enter 3 values. Nice try I guess.</p>\").slideDown().delay(3000).slideUp();\n\t\treturn [];\n\t}\n\n\t// Get an array of floats from an array of Strings\n\tinputs = StringArrayToFloatArray( inputs );\n\n\t// Array to return\n\tvar roots = [];\n\t// Renaming for clarity\n\tvar a = inputs[0];\n\tvar b = inputs[1];\n\tvar c = inputs[2];\n\n\t$('#proofText').html('');\n\t$('#proof').hide();\n\n\tif (a == 0.0){\n\n\t\tif (b == 0.0){\n\t\t\tif (c == 0.0) {\n\t\t\t\t// All three inputs are 0, x can be anything\n\t\t\t\t$('#error').stop().html(\"<p>'x' can be anything if all the inputs are 0.</p>\").slideDown().delay(3000).slideUp();\n\t\t\t\treturn [];\n\t\t\t} else {\n\t\t\t\t// Division by 0 error\n\t\t\t\t$('#error').stop().html(\"<p>Since a=0 and b=0, this is a division by 0 error.</p>\").slideDown().delay(3000).slideUp();\n\t\t\t\treturn [];\n\t\t\t}\n\t\t}\n\n\t\t$('#solution').fadeIn();\n\n\t\t// One root; found by -c/b\n\t\troots.push( -c/b );\n\t\t$('#s3').html(\"<p>Since 'a' = 0, we know we only have 1 <u>real</u> root.</p>\" +\n\t\t\t\t\t \"<p>root = -c/b = \" + -c + \"/\" + b + \" = \" + roots[0] + \".</p>\").fadeIn();\n\n\t\treturn roots;\n\t}\n\n\t$('#solution').fadeIn();\n\n\t// STEP 1: Calculate the Discriminant\n\tvar D = (b * b) - (4 * a * c);\n\t\t// Display how it was calculated\n\t\t$('#D').html(\"D = \" + b + \"*\" + b + \" - 4*\" + a + \"*\" + c + \"<br /> = \" +b*b + \" - \" + 4*a*c + \" <br /><strong>= \" + D+\"</strong>\");\n\t\t$('#s1').fadeIn();\n\n\t// STEP 2: Calculate the divider\n\tvar divider = 2.0 * a;\n\t\t$('#div').html(\"divider = 2*\" + a + \" <strong>= \" + divider +\"</strong>\");\n\t\t$('#s2').fadeIn();\n\n\t// STEP 3: Evaluate what kind of solution we should get\n\tif (D == 0.0) {\n\t\t// One REAL root\n\t\tvar r1 = -b/divider;\n\t\troots.push( r1 );\n\t\t$('#s3').html(\"<p>Since D = 0, we know we only have 1 <u>real</u> root. It can be found by calculating -b/divider<br />= \" + -b + \"/\" + divider + \"<br />= \"+ r1 +\".</p>\").fadeIn();\n\n\t} else if (D > 0.0) {\n\t\t// Two REAL roots\n\n\t\t// Use the sqrt selected from the form, custom or default\n\t\tvar sqrtD = (sqrtStatus ? squareRoot(D) : Math.sqrt(D));\n\t\tvar r1 = (-b+sqrtD) / divider;\n\t\tvar r2 = (-b-sqrtD) / divider;\n\n\t\troots.push( r1 );\n\t\troots.push( r2 );\n\t\t$('#s3').html(\"<p>Since D > 0, we know we have 2 <u>real</u> roots.</p>\" +\n\t\t\t\t\t \"<p>They can be found by calculating (-b &plusmn; &radic;(b<sup>2</sup>-4ac))/2a</p> \" +\n\t\t\t\t\t \"<code>= (\"+ -b + \" &plusmn; &radic;(\" + b*b + \" - \" + 4*a*c + \")) / \" + divider + \"<br/>\" +\n\t\t\t\t\t \"<code>= (\"+ -b + \" &plusmn; &radic;(\" + D + \")) / \" + divider + \"<br/>\" +\n\t\t\t\t\t \"<code>= (\"+ -b + \" &plusmn; \" + sqrtD + \") / \" + divider + \"</code><br/>\" +\n\t\t\t\t\t \"<code>= (\"+ -b + \" &plusmn; \" + sqrtD + \") / \" + divider + \"</code><br/>\" +\n\t\t\t\t\t \"<p>Root1: <span class='special'>\" + roots[0] + \"</span></p>\" +\n\t\t\t\t\t \"<p>Root2: <span class='special'>\" + roots[1] + \"</span></p>\").fadeIn();\n\n\t} else { // D < 0.0\n\t\t// Two COMPLEX roots\n\t\troots.push('i');\n\t\t$('#s3').html(\"<p>Since D < 0, we know we have 2 <u>complex</u> roots; you can't regularly find the square root of a negative number.</p>\" +\n\t\t\t\t\t \"<p>Sorry, I can't <em>imagine</em> yet. This is as far as I can go.</p>\").fadeIn();\n\n\t\treturn roots;\n\t}\n\n\t// Shall we polish?\n\tif (polishStatus) {\n\t\troots[0] = rootPolisher(roots[0], a, b, c);\n\n\t\tif (roots.length > 1)\n\t\t\troots[1] = rootPolisher(roots[1], a, b, c);\n\t}\n\n\t// Do proof\n\t$('#proofText').html('');\n\tfor (var i=0; i<roots.length; i++) {\n\t\tvar tmp = i+1;\n\t\t$('#proofText').append('<h3>For root #' + tmp + '</h3>');\n\t\tvar soln = a*roots[i]*roots[i] + b*roots[i] + c\n\t\t$('#proofText').append(\"<p>0 = ax<sup>2</sup> + bx + c</p>\" +\n\t\t\t\t\t\t\t \"<code>0 = \" + a + \"*(\"+roots[i]+\"<sup>2</sup>) + \" +b + \"*(\" + roots[i] + \") + \" + c + \"<br />\" +\n\t\t\t\t\t\t\t \"0 = \" + a*roots[i]*roots[i] + \" + \" + b*roots[i] + \" + \" + c +\"<br />\" +\n\t\t\t\t\t\t\t \"<span class='special'>0 = \" + soln + \"</special></code>\");\n\t}\n\t$('#proof').fadeIn();\n\n\treturn roots;\n\n}", "methodFour() {\n // initiate new validator for current play\n const Validator = new GameValidator();\n // iterate board\n for (let row = 0; row < this.numberOfRows; row++) {\n for (let col = 0; col < this.numberOfCols; col++) {\n //\n if (this.cells[row][col] === this.unknownCell) {\n // place mine\n this.cells[row][col] = this.empty;\n // track moves\n const movesToUndo = [];\n let solution;\n do {\n // try method one\n solution = this.methodOne();\n if (solution === null) {\n // ../ method two\n solution = this.methodTwo();\n }\n // if solution found\n if (solution !== null && typeof solution === 'object') {\n // track updated cells\n movesToUndo.push(...solution.solvedCells);\n // validate board\n const result = Validator.validateBoard(this);\n //\n if (!result.isValid) {\n // reset currentCell\n this.cells[row][col] = this.mine;\n // reset the moves\n movesToUndo.forEach(cell => (this.cells[cell.row][cell.col] = this.unknownCell));\n //\n return new Solution(\n result.cellOfInterest,\n [ new CellLocation(row, col) ],\n `cannot be empty must contain a mine!`\n );\n }\n }\n // \n } while (solution !== null && typeof solution === 'object');\n\n //\n // no solution found\n movesToUndo.forEach(cell => {\n this.cells[cell.row][cell.col] = this.unknownCell;\n });\n // + current cell still unknown\n this.cells[row][col] = this.unknownCell;\n }\n }\n }\n return null;\n }", "solve(){\n \tconst start = this.getStartingPosition();\n \tconst startString = start.toString();\n \tconst init_path = [start];\n \tlet paths = new ArrayHeap();\n paths.insert(init_path);\n let explored = [startString];\n let solution = [];\n\n while ( paths.size() > 0 && !this.isSolved ){\n \tconst path = paths.popMin();\n \tconst last = path[path.length-1];\n \tconst moves = this.getMoves(last);\n \tfor ( let move of moves ){\n\t\t \tconst point = this.getThingAt(move);\n \t\tconst moveString = move.toString();\n \t\tif ( point !== \" \" && point !== \"!\" ){\n \t\t\tcontinue;\n \t\t}\n \t\tif ( explored.includes(moveString)){\n \t\t\tcontinue;\n \t\t}\n \t\tconst exploration = [...path];\n \t\texploration.push(move);\n \t\texplored.push(moveString);\n \t\tif ( point === \"!\" ){\t\n \t\t\tthis.isSolved = true;\n \t\t\tsolution = exploration;\n \t\t\tbreak;\n \t\t}\n \t\tpaths.insert(exploration);\n \t}\n }\n\treturn solution;\n }", "async resolveConflicts() {\n const neighbours = this.nodes;\n let newChain = undefined;\n\n // We're only looking for chains longer than ours\n let maxLength = this.chain.length;\n\n // Grab and verify the chains from all the nodes in our network\n for (const node of neighbours) {\n const response = await axios(`http://${ node }/chain`);\n\n if (response.status === 200) {\n const length = response.data.length;\n const chain = response.data.chain;\n\n // Check if the length is longer and the chain is valid\n if (length > maxLength && Blockchain.validChain(chain)) {\n maxLength = length;\n newChain = chain;\n }\n }\n }\n\n if (newChain) {\n this.chain = newChain;\n return true;\n }\n\n return false;\n }", "function draw() {\r\n\tbackground(53, 74, 35);\r\n\tfor (let i = 0; i < maze_grid.length; i++) {\r\n\t\tmaze_grid[i].displayGrid();\r\n\t}\r\n\r\n\tlet following_unit = current_unit.findAdjcent();\r\n\r\n\tcurrent_unit.visited = true;\r\n\t// console.log(current_unit);\r\n\r\n\tif (complete == false) {\r\n\t\tcurrent_unit.mark();\r\n\t\tif (following_unit) {\r\n\t\t\t// pushes current Unit to the stack for backtracking\r\n\t\t\tmaze_stack.push(current_unit);\r\n\t\t\tclearSide(current_unit, following_unit);\r\n\r\n\t\t\t// sets the current Unit to the following Unit in iteration\r\n\t\t\tfollowing_unit.visited = true;\r\n\t\t\tcurrent_unit = following_unit;\r\n\t\t// if no adjcent cells available then will pop \"backtrack\" until one becomes avaiable\r\n\t\t} else if (maze_stack.length > 0) {\r\n\t\t\tcurrent_unit = maze_stack.pop();\r\n\t\t}\r\n\t}\r\n\r\n\tdetermineComplete(maze_stack);\r\n\r\n\t// displays final path\r\n\tif (complete_path == true) {\r\n\t\tdisplayPath(path_stack)\r\n\t}\r\n\r\n\t// starts path finding process\r\n\tif (complete == true) {\r\n\t\tpath_iteration.pathvisit = true;\r\n\t\tpath_iteration.marksolve();\r\n\r\n\t\tvar following_path = path_iteration.findAdjcentPath();\r\n\t\tif(following_path) {\r\n\t\t\t// pushes current path to the stack for backtracking\r\n\t\t \tpath_stack.push(path_iteration);\r\n\r\n\t\t \t// sets the current path to the following path in iteration\r\n\t\t \tfollowing_path.pathvisit = true;\r\n\t\t \tpath_iteration = following_path;\r\n\t\t } else if(path_stack.length > 0 ) {\r\n\t\t \tpath_iteration = path_stack.pop();\r\n\t\t \tpath_iteration.markbacktrack();\r\n\t\t }\r\n\t}\r\n}", "function displayAnswer() {\r\n if (random==undefined) return\r\n\r\n var copyGrid = new Array(9);\r\n copyGrid = numbers[random].map(inner => inner.slice());\r\n\r\n solver(copyGrid, 0, 0);\r\n //convert grid to array\r\n var answerBoard = [];\r\n for (var i = 0; i < answerGrid.length; i++) {\r\n answerBoard = answerBoard.concat(answerGrid[i]);\r\n }\r\n\r\n //fill out the puzzle\r\n var inputs = document.getElementsByTagName(\"input\");\r\n var j = 0;\r\n for (var i = 0; i < inputs.length; i++) {\r\n //empty cells = green\r\n //non-empty cells = readonly\r\n inputs[i].value = answerBoard[j];\r\n inputs[i].setAttribute(\"readonly\", \"true\");\r\n j++;\r\n }\r\n\r\n document.getElementById(\"showMessage\").textContent = \"Solution was found!\"\r\n}", "checkIfNeighborsAreWithingBoundry(boundry, hexesChecked, innerSet){\n //if we are on an edge\n //return false if at any point during the recursion we find that we've reached an edge, this means it is impossible for it to be full now\n //console.log(\"recurse on: \" + this.index.col + \", \"+ this.index.row)\n if(this.index.row == this.board.numRows-1 || this.index.row == 0){\n return false;\n }\n else if(this.index.col == this.board.numColumns-1 || this.index.col == 0){\n return false;\n }\n //ok, we are not an edge, now we can recurse to see if our neighbors are ok\n //\n var neighbors = this.getAllNeighbors();\n var newHexChecked = [];\n for(var i = 0; i< hexesChecked.length; i++){\n newHexChecked.push(hexesChecked[i]);\n }\n var foundDeadEnd = false;\n for(var i = 0; i<neighbors.length; i++){\n\n //if neighbors haven't been checkked or aren't in the already checked list\n if(!hexesChecked.includes(neighbors[i]) && !boundry.includes(neighbors[i])){\n newHexChecked.push(neighbors[i]);\n //neighbors[i].checkIfNeighborsAreWithingBoundry(boundry, newHexChecked, testSet);\n\n if(!neighbors[i].checkIfNeighborsAreWithingBoundry(boundry, newHexChecked, innerSet)){\n foundDeadEnd = true;\n return false;\n }\n }\n }\n if(!foundDeadEnd){\n innerSet.add(this);\n\n return true;\n }else{\n return false;\n }\n\n\n\n\n }", "function add_solution(bounded_board) {\n\t// Initially mark all of the squares as faults\n\tfor (var x = 1; x < bounded_board.length; x += 2) {\n\t\tfor (var y = 1; y < bounded_board[0].length; y += 2) {\n\t\t\tbounded_board[x][y] = SQUARE_FAULT_OPEN;\n\t\t}\n\t}\n\t// Opening solution edges\n\tbounded_board[0][1] = EDGE_OPEN;\n\tbounded_board[bounded_board.length - 1][bounded_board[0].length - 2] = EDGE_OPEN;\n\t// Open initial square\n\tvar current_row = 1;\n\tvar current_column = 1;\n\tbounded_board[current_row][current_column] = SQUARE_SOLUTION;\n\t// Loop through every square of the solution\n\twhile (!(current_row == bounded_board.length - 2 && current_column == bounded_board[0].length - 2)) {\n\t\t// Open the current edge\n\t\tif (current_row == bounded_board.length - 2) {\n\t\t\tbounded_board[current_row][current_column + 1] = EDGE_OPEN;\n\t\t\tcurrent_column += 2;\n\t\t} else if (current_column == bounded_board[0].length - 2 || fifty_percent()) {\n\t\t\tbounded_board[current_row + 1][current_column] = EDGE_OPEN;\n\t\t\tcurrent_row += 2;\n\t\t} else {\n\t\t\tbounded_board[current_row][current_column + 1] = EDGE_OPEN;\n\t\t\tcurrent_column += 2;\n\t\t}\n\t\t// Open the current square\n\t\tbounded_board[current_row][current_column] = SQUARE_SOLUTION;\n\t}\n\treturn bounded_board;\n}", "function solveClicked() {\n let puzzlePieces = $(\".imgContainer div\");\n // randomize the left and top positions of the puzzle pieces\n puzzlePieces.each(function () {\n let randomLeftPosition = Math.floor(Math.random() * 370);\n let randomTopPosition = Math.floor(Math.random() * 370);\n // add draggable class to puzzle pieces\n $(this).addClass(\"draggable\").css({\n position: \"absolute\",\n left: randomLeftPosition + \"px\",\n top: randomTopPosition + \"px\"\n })\n // add the randomized puzzle pieces to the other container\n $(\".puzzleContainer\").append($(this))\n });\n\n // loop from above to create outline for the puzzle piece\n let emptyPuzzlePieces = \"\";\n for (let i = 0; i < rows; i++) {\n for (let j = 0; j < columns; j++) {\n // add droppable class to the outline divs\n emptyPuzzlePieces += \"<div class='piece droppable' style='background-image: none;'></div>\";\n }\n }\n $(\".imgContainer\").html(emptyPuzzlePieces);\n // hide the solve button\n $(\"#solve\").attr(\"hidden\", true);\n // show the reset button\n $(\"#reset\").attr(\"hidden\", false);\n\n draggableAndDroppableOn();\n\n // if all droppable places are full, check to see if the pieces are in correct place\n //isDroppableSpaceFull();\n }", "function doSolve(clauses, assignment) {\n\tlet isSat = false\n\tlet last = Math.pow(2, assignment.length)\n\tlet counter = 0;\n\t// Checks if is SAT until find the SAT assignment or reach the maximum number of assignments\n\twhile ((!isSat) && counter < last && last > 1) {\n\t\t/* //Shows the progress of the program and in which assignment is it, uncomment for use\n\t\tconsole.log(\"Analisando atribuição \"+assignment.toString().replace(/,/g,\" \")+\"\\n\"+(counter)+\" de \"+end)\n\t\t*/\n\t\tlet allClauses = true\n\t\tfor (i = 0; i < clauses.length && allClauses; i++) {\n\t\t\tlet thisClause = false\n\t\t\tfor (j = 0; j < clauses[i].length && !thisClause; j++) {\n\t\t\t\t// Get the index of the current assignment for the current variable\n\t\t\t\tlet index = Math.abs(clauses[i][j]) - 1\n\t\t\t\t// Checks if the current variable is denied\n\t\t\t\tif (parseInt(clauses[i][j]) < 0) {\n\t\t\t\t\t// If the variable is denied check if the current assignment is false\n\t\t\t\t\tif (!assignment[index]) {\n\t\t\t\t\t\tthisClause = true\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If the variable is not denied check if the current assignment is true\n\t\t\t\t\tif (assignment[index]) {\n\t\t\t\t\t\tthisClause = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If the current clause is false, stop checking the current assignment\n\t\t\tif (!thisClause) {\n\t\t\t\tallClauses = false\n\t\t\t}\n\t\t}\n\t\t// If allClauses is true, means all clauses are true for the current assignment\n\t\tif (allClauses) {\n\t\t\tisSat = true\n\t\t} else {\n\t\t\t// Get the next assignment and increment the assignment counter\n\t\t\tassignment = nextAssignment(assignment)\n\t\t\tcounter = counter + 1\n\t\t}\n\t}\n\tlet result = {\n\t\t'isSat': isSat,\n\t\tsatisfyingAssignment: null\n\t}\n\tif (isSat) {\n\t\tresult.satisfyingAssignment = assignment\n\t}\n\tif(last == 1){\n\t\tresult.satisfyingAssignment = 'SpecificationProblemFound'\n\t}\n\treturn result\n}", "function updateFormUntilFixpointReached(ql_questions) {\n console.log(ql_questions);\n while(true) {\n let prev = deepClone(ql_questions);\n let next = update(ql_questions);\n console.log(next);\n if (dictsAreEquivalent(next, prev)) { return; }\n }\n}", "performFullValidation() {\r\n const validateCompleted = this.state.pages[this.state.index].questions.map(\r\n (question, index) => {\r\n if (!question.required || question.questionType === \"Label\") {\r\n return true;\r\n }\r\n const answer = this.state.answerIndexes.find(\r\n ans => ans.page === this.state.index && ans.qIndex === index\r\n );\r\n if (!answer || answer.answer === \"\" || answer.answer === \"null\") {\r\n return false;\r\n }\r\n return true;\r\n }\r\n );\r\n this.setState({\r\n questionsAnswered: validateCompleted\r\n });\r\n }", "resetSolution() {\n if (this.state.selectedSolution) this.changeSolution(undefined, undefined);\n }", "function solveSudokuHelper(board,row,col) {\n //base case\n if (row== 9) { //when we already hit the last cell of board i.e(8,8)\n changeBoard(board);\n return;\n }\n\n if (col== 9) { //when in each row ,col 0 t0 8 ,when at last col,call another row with col value 0\n solveSudokuHelper(board, row + 1, 0)\n return;\n }\n\n if (board[row][col] != 0) {//skip all pre-filled cells i.e already that cells are filled with some values so means next call recursively \n solveSudokuHelper(board,row,col + 1);\n return;\n }\n\n //here we are at inital row & col to fill value from 1 to 9 in the empty cells\n for (var number = 1; number <= 9; number++) {\n if (isSafe(board,row,col, number)) {\n board[row][col] = number;//we asusume this is the correct number temporarily if we are safe to fill that number in that cells \n solveSudokuHelper(board,row,col+1);\n board[row][col] = 0; //backtracking i.e if the number is not suitable to fill in that position of the cell then back from that position with putting 0 value in that cell \n }\n }\n}", "function processStep() {\r\n finished = true;\r\n for (var i = 0; i < searchResults.length; ++i) {\r\n for (var j = 0; j < searchResults[i].length; ++j) {\r\n for (var k = 0; k < searchResults[i][j].length; ++k) {\r\n\t\t\t\t//wyciagniecie z obiektow reprezentujacych znalezione rekordy informacji potrzebnych do rozszerzenia podslowa\r\n var searchedSeed = searchResults[i][j][k];\r\n var moveLeft = searchedSeed.moveLeft;\r\n var indexInDbSet = searchedSeed.index - moveLeft;\r\n var indexInSequence = i - moveLeft;\r\n var databaseSet = databaseSets[searchedSeed.DbSetNr];\r\n var seed = searchedSeed.seed;\r\n var currScore = searchedSeed.score;\r\n if (currScore >= tresholdC&&seed.length<sequence.length) { //przetwarzamy tylko rekordy o minimalnej zgodności\r\n var result = expand(seed,sequence,databaseSet,indexInSequence, indexInDbSet, matrix,currScore);\r\n\t\t\t\t\t\r\n\t\t\t\t\t//jezeli udało się rozszerzyć chociaz jeden rekord to nie skonczylismy\r\n\t\t\t\t\tif(result.expandedLeft || result.expandedRight)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfinished = false; \r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n //logika aktualizujaca rekord w searchResults - do napisania\r\n searchResults[i][j][k].score = result.newScore;\r\n\t\t\t\t\t//aktualizacja wskaznika pokazujacego o ile slowo zostalo rozszerzone w lewo\r\n\t\t\t\t\tif(result.expandedLeft)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tsearchResults[i][j][k].moveLeft = searchResults[i][j][k].moveLeft + 1; \r\n\t\t\t\t\t}\r\n\t\t\t\t\tsearchResults[i][j][k].seed = result.newSeed; \r\n }\r\n }\r\n }\r\n }\r\n if(finished) alert(\"Wykonano wszystkie kroki algorytmu, możesz przejść do kolejnego etapu.\")\r\n}", "solve() {\n if (this.gameWon() || this.state.busy) { return; }\n this.setState({ busy: true });\n const reversedMovesFromSolved = this.state.movesFromSolved.reverse();\n const movesToMake = this.invertMoves(reversedMovesFromSolved);\n this.runAI(movesToMake);\n }", "function not_solvable(){\n startrunning = false;\n alert(\"Sudoku not solvable!!!!!!\");\n}", "function changing() {\n let changed = 0;\n for (let i = 0; i < 9; i++) {\n for (let j = 0; j < 9; j++) {\n if (matrix[i][j] != 0) {\n //not empty cell\n continue;\n }\n changed += solve(i, j);\n }\n }\n return changed;\n }", "function setUpPuzzle() {\n var node;\n for (var i = 0; i < 9; i ++) {\n //creating the arrays within arrays\n puzzleClues[i] = [];\n possibles[i] = [];\n for (var j = 0; j < 9; j ++) {\n //creating the board\n node = document.createElement(\"input\");\n node.type = \"text\"\n node.classList.add(\"col-\" + j);\n node.classList.add(\"row-\" + i);\n node.classList.add(\"square\");\n document.getElementsByClassName(\"puzzle\")[0].appendChild(node);\n //more array setup stuff\n puzzleClues[i][j] = 0;\n possibles[i][j] = [];\n }\n }\n document.getElementsByClassName(\"solvebutton\")[0].addEventListener('click',solvePuzzle);\n //more array setup stuff\n for (var i = 0; i < 3; i ++) {\n doesntContain[i] = [];\n for (var j = 0; j < 9; j ++) {\n toCheck.push([i,j]);\n doesntContain[i][j] = [];\n for (var k = 0; k < 9; k ++) {\n doesntContain[i][j].push(k+1);\n }\n }\n }\n //loads an example sudoku\n //getSudoku(3);\n}", "function puzzle_spiral() {\n return {\n id: \"spiral\",\n name: \"Spiral\",\n\n hint: \n \"<p>\"\n + \"It's OK if your robot bumps into a wall.\"\n + \"</p>\"\n + \"<p>\"\n + learnMoreGoto()\n + \"</p>\"\n ,\n win_conditions: [\n {type: WinCondition.COLLECT_COINS}\n ],\n\n constraints: {\n \"max_instructions\": 12\n },\n\n solutions: [\n \"start:\\nmove\\nmove\\nmove\\nmove\\nmove\\nmove\\nturn right\\ngoto start\\n\"\n ],\n num_cols: 9,\n num_rows: 8,\n // BUG: this should be programming_bot_id, not index\n programming_bot_index: 0,\n bots : [\n {\n botColor: BotColor.BLUE,\n cellX: 3,\n cellY: 4,\n facing: Direction.UP,\n program: \"\",\n },\n ],\n coins: [\n {x:1, y:1},\n {x:2, y:1},\n {x:3, y:1},\n {x:4, y:1},\n {x:5, y:1},\n {x:6, y:1},\n {x:7, y:1},\n {x:1, y:2},\n {x:7, y:2},\n {x:1, y:3},\n {x:3, y:3},\n {x:4, y:3},\n {x:5, y:3},\n {x:7, y:3},\n {x:1, y:4},\n {x:5, y:4},\n {x:7, y:4},\n {x:1, y:5},\n {x:5, y:5},\n {x:7, y:5},\n {x:1, y:6},\n {x:2, y:6},\n {x:3, y:6},\n {x:4, y:6},\n {x:5, y:6},\n {x:7, y:6},\n ],\n blocks: [\n {x:0, y:0},\n {x:1, y:0},\n {x:2, y:0},\n {x:3, y:0},\n {x:4, y:0},\n {x:5, y:0},\n {x:6, y:0},\n {x:7, y:0},\n {x:8, y:0},\n\n {x:0, y:1},\n /*{x:1, y:1},\n {x:2, y:1},\n {x:3, y:1},\n {x:4, y:1},\n {x:5, y:1},\n {x:6, y:1},\n {x:7, y:1},*/\n {x:8, y:1},\n\n {x:0, y:2},\n //{x:1, y:2},\n {x:2, y:2},\n {x:3, y:2},\n {x:4, y:2},\n {x:5, y:2},\n {x:6, y:2},\n //{x:7, y:2},\n {x:8, y:2},\n\n {x:0, y:3},\n //{x:1, y:3},\n {x:2, y:3},\n //{x:3, y:3},\n //{x:4, y:3},\n //{x:5, y:3},\n {x:6, y:3},\n //{x:7, y:3},\n {x:8, y:3},\n\n {x:0, y:4},\n //{x:1, y:4},\n {x:2, y:4},\n //{x:3, y:4},\n {x:4, y:4},\n //{x:5, y:4},\n {x:6, y:4},\n //{x:7, y:4},\n {x:8, y:4},\n\n {x:0, y:5},\n //{x:1, y:5},\n {x:2, y:5},\n {x:3, y:5},\n {x:4, y:5},\n //{x:5, y:5},\n {x:6, y:5},\n //{x:7, y:5},\n {x:8, y:5},\n\n {x:0, y:6},\n /*{x:1, y:6},\n {x:2, y:6},\n {x:3, y:6},\n {x:4, y:6},\n {x:5, y:6},*/\n {x:6, y:6},\n //{x:7, y:6},\n {x:8, y:6},\n\n {x:0, y:7},\n {x:1, y:7},\n {x:2, y:7},\n {x:3, y:7},\n {x:4, y:7},\n {x:5, y:7},\n {x:6, y:7},\n {x:7, y:7},\n {x:8, y:7},\n ],\n traps: []\n }\n}", "function OptimalSolver8Puzzle(encodedSolution) {\n // Iterator\n var i = 0;\n \n // Set up the factorial lookup table\n var F = [1];\n for (i = 1; i < 9; i++) { F[i] = F[i-1]*i; }\n \n // Intermediate information for problem space traversal\n var workingBoard = new SlidingTilePuzzle(3,3);\n var workerState = 1;\n var workerList = new Array(0);\n \n // Initialize the table to hold results of the traversal\n var optimalMovesTable = new Uint8Array(9 * F[8]);\n for(i = 0; i < optimalMovesTable.length; i++) {\n optimalMovesTable[i] = 255;\n }\n optimalMovesTable[encodedSolution] = 0;\n\n // Given a board layout, see if it's one we've already visited.\n // If not, add the steps it took to get there and add it to the open list so\n // we remember to go and look at all its neighbors later.\n var checkAddBoard = function(steps, encodedBoard, openList) {\n if (optimalMovesTable[encodedBoard] > steps) {\n optimalMovesTable[encodedBoard] = steps;\n openList.push(encodedBoard);\n }\n };\n\n // Given a board layout, try moving all four adjacent tiles to see if we've\n // visited those states. Every (1) valid and (2) new state is added to the\n // open list so we can repeat the process for all their neighbors.\n var addToOpenList = function(steps, encodedBoard, openList) {\n workingBoard.decode(encodedBoard);\n\n if (workingBoard.blankUp()) {\n checkAddBoard(steps, workingBoard.encode(), openList);\n workingBoard.blankDown();\n }\n \n if (workingBoard.blankDown()) {\n checkAddBoard(steps, workingBoard.encode(), openList);\n workingBoard.blankUp();\n }\n \n if (workingBoard.blankRight()) {\n checkAddBoard(steps, workingBoard.encode(), openList);\n workingBoard.blankLeft();\n }\n \n if (workingBoard.blankLeft()) {\n checkAddBoard(steps, workingBoard.encode(), openList);\n workingBoard.blankRight();\n }\n };\n\n // Kick off the search process by starting with the solved state.\n addToOpenList(workerState, encodedSolution, workerList);\n\n // Examine every board layout in the open list and check its neighbors.\n // Once we exhaust one open list, we yield execution with setTimeout()\n // to let other threads do their thing before we resume with the new\n // open list.\n // If the new open list is empty, walk through the array and mark every\n // unvisited node as an unsolvable configuration.\n var optimalMovesTableWorker = function() {\n var openList = new Array(0);\n\n if (workerList.length > 0) {\n for ( var i = 0; i < workerList.length; i++) {\n addToOpenList(workerState+1, workerList[i], openList); \n }\n \n console.log(\"Processed \" + workerList.length + \" positions of length \" + workerState);\n \n workerList = openList;\n workerState++;\n setTimeout(optimalMovesTableWorker, 5);\n } else {\n var unreached = 0;\n for(i = 0; i < optimalMovesTable.length; i++) {\n if (optimalMovesTable[i] == 255) {\n optimalMovesTable[i] = 254;\n unreached++;\n }\n }\n console.log(\"Never reached \"+unreached+\" states.\");\n }\n };\n \n // Kick off the search\n console.log(\"Started OptimalSolver8Puzzle\");\n optimalMovesTableWorker();\n \n //////////////////////////////////////////////////////////////////////////////\n // Public method to retrieve the optimal number of steps between the given\n // encoded state and the solved state.\n // * Returns string \"[Calculating...]\" if the search is still underway.\n // * Returns string \"[Unsolvable]\" if the given state has no solution.\n // * Returns number of steps if neither of the above.\n \n this.getSteps = function(encodedBoard) {\n var lookup = optimalMovesTable[encodedBoard];\n \n if (lookup == 255) {\n return \"[Calculating...]\";\n } else if (lookup == 254) {\n return \"[Unsolvable]\";\n } else {\n return lookup;\n }\n };\n}", "methodThree() {\n // initiate new validator for current play\n const Validator = new GameValidator();\n // iterate board\n for (let row = 0; row < this.numberOfRows; row++) {\n for (let col = 0; col < this.numberOfCols; col++) {\n //\n if (this.cells[row][col] === this.unknownCell) {\n // place mine\n this.cells[row][col] = this.mine;\n // track moves\n const movesToUndo = [];\n let solution;\n do {\n // try method one\n solution = this.methodOne();\n if (solution === null) {\n // ../ method two\n solution = this.methodTwo();\n }\n // if solution found\n if (solution !== null && typeof solution === 'object') {\n // track updated cells\n movesToUndo.push(...solution.solvedCells);\n // validate board\n const result = Validator.validateBoard(this);\n //\n if (!result.isValid) {\n // must be empty\n this.cells[row][col] = this.empty;\n // reset the moves\n movesToUndo.forEach(cell => (this.cells[cell.row][cell.col] = this.unknownCell));\n // \n return new Solution(\n result.cellOfInterest,\n [ new CellLocation(row, col) ],\n `cannot contain a mine, must be empty!`\n );\n }\n }\n // \n } while (solution !== null && typeof solution === 'object');\n\n //\n // no solution found\n movesToUndo.forEach(cell => {\n this.cells[cell.row][cell.col] = this.unknownCell;\n });\n // + current cell still unknown\n this.cells[row][col] = this.unknownCell;\n }\n }\n }\n return null;\n }", "function printSolution(pstx) {\n var nowX;\n var nowY;\n var nextX;\n var nextY;\n var sol = knightsBoards;\n //tells square number and path debugging purpose\n for (var y = 0; y < grid_N; y++) {\n for (var x = 0; x < grid_N; x++) {\n var z = x + (y * 10);\n //console.log(sol[x][y]);\n //console.log(\"square \" + z);\n }\n }\n // look for path\n for (var i = 0; i < 100; ++i) {\n //current point\n for (var y = 0; y < grid_N; y++) {\n for (var x = 0; x < grid_N; x++) {\n if (sol[x][y] == i) {\n nowX = x;\n nowY = y;\n }\n }\n }\n //next point\n for (var y = 0; y < grid_N; y++) {\n for (var x = 0; x < grid_N; x++) {\n //console.log(sol[x][y])\n if (sol[x][y] == (i + 1)) {\n nextX = x;\n nextY = y;\n }\n }\n }\n // draw lines\n pstx.beginPath();\n pstx.moveTo(nowX * 85 + 43, nowY * 85 + 43);\n pstx.lineTo(nextX * 85 + 43, nextY * 85 + 43);\n pstx.stroke();\n }\n}", "solutionCheck() {\n for (let row = 0; row < HEIGHT; row++) {\n for (let col = 0; col < WIDTH; col++) {\n let num = this._puzzle[row][col];\n this._puzzle[row][col] = 0;\n if (num === 0 || !this.isSafe(this._puzzle, row, col, num)) {\n this._puzzle[row][col] = num;\n return false;\n }\n this._puzzle[row][col] = num;\n }\n }\n return true;\n }", "function Puzzle() {\n let rectcount = 0;\n this.stack = [];\n this.first = function(width, height) {\n var rectangle, row, column, mask;\n rectangle = [];\n for (row = 0; row < height; row++) {\n rectangle[row] = [];\n for (column = 0; column < width; column++) {\n rectangle[row][column] = false;\n }\n }\n\n // Exclude by 3x3 in the middle of the board\n if (rectcount === 0){\n rectangle[6][6] = true;\n rectangle[6][7] = true;\n rectangle[6][8] = true;\n rectangle[7][6] = true;\n rectangle[7][7] = true;\n rectangle[7][8] = true;\n rectangle[8][6] = true;\n rectangle[8][7] = true;\n rectangle[8][8] = true;\n rectcount = 1;\n }\n // Vars to check wheter or not each shape is used\n mask = [\n false, false, false, false, false, false, false,\n false, false, false, false, false, false, false,\n false, false, false, false, false, false, false,\n false, false, false, false, false, false, false,\n false, false, false, false, false, false, false, false\n ];\n return new State(rectangle, mask, 0);\n };\n\n // Run the puzzle solver, set object, stop program when the solution is found\n this.run = function(width, height) {\n var hexominos, state, count;\n hexominos = new Hexominos();\n hexominos.initialize(width, height);\n state = this.first(width, height);\n state.add(hexominos.rectangle);\n this.stack.push(state);\n \n // 33 figures cells = 198\n count = 198;\n \n // If the shape fits, then push the state to the stack\n while (this.stack.length > 0) {\n state = this.stack.pop();\n if (state.count == count) {\n break;\n }\n while (state.next()) {\n if (state.fit()) {\n this.stack.push(state);\n state = state.copy();\n state.add(hexominos.rectangle);\n this.stack.push(state);\n break;\n }\n }\n }\n };\n}", "function nextStep(data) {\n if (data.type === \"q\") {\n //check if both has a values or not\n if (Object.keys(remaining.children.both).length !== 0) {\n if (data.answer === \"yes\" || data.answer === \"no\") {\n //get answer object\n let userAnswer = remaining.children[\"both\"];\n remaining = userAnswer;\n //adding the first object\n finished.push({\n type: data.type,\n answer: data.answer,\n lable: data.lable\n });\n }\n } else {\n //get answer object\n let userAnswer = remaining.children[data.answer];\n remaining = userAnswer;\n //adding the first object\n finished.push({\n type: data.type,\n answer: data.answer,\n lable: data.lable\n });\n }\n }\n if (data.type === \"i\") {\n let userAnswer = remaining.children[\"normal\"];\n remaining = userAnswer;\n //adding the first object\n finished.push({\n type: data.type,\n answer: data.answer,\n lable: data.lable\n });\n }\n if (data.type === \"e\") {\n let userAnswer = remaining.children[\"normal\"];\n remaining = userAnswer;\n //adding the first object\n finished.push({\n type: data.type,\n answer: data.answer,\n lable: data.lable\n });\n }\n if (data.type === \"c\") {\n let userAnswer = \"\";\n remaining = userAnswer;\n //adding the first object\n finished.push({\n type: data.type,\n answer: data.answer,\n lable: data.lable\n });\n }\n if (data.type === \"a\") {\n let userAnswer = remaining.children[\"normal\"];\n remaining = userAnswer;\n //adding the first object\n finished.push({\n type: data.type,\n answer: data.answer,\n lable: data.lable\n });\n }\n}", "nextStep(){\n this.search.shift()\n this.search = this.children.concat(this.search)\n\n if( this.search.length == 0){\n this.finished = true\n }\n else{\n this.state = this.search[0]\n this.children = []\n\n // If it is a final state\n if( this.blockInPath(this.state, this.maze.getFinish()) && this.state.length < this.cost){\n this.bestPath = this.state\n this.cost = this.state.length\n }\n // Branch and Bound: Examine the following paths only if they are better than the current best\n else if(this.state.length + 1 < this.cost){\n // Get the children paths with no repeating nodes\n this.children = this.getChildren(this.state).filter( child => !this.blockInPath(this.state, child[child.length - 1]) )\n \n }\n }\n \n }", "function solve_sudoku(grid) {\r\n var arr = findEmpty(grid);\r\n if (arr == 0) //sudoku solved\r\n return 1;\r\n var row = arr[0];\r\n var col = arr[1]; //position of an empty cell in the grid\r\n\r\n for (var i = 1; i < 10; i++) {\r\n if (admissible(row, col, i, grid)) {\r\n grid[row][col] = i; //places a value 'i'\r\n if (solve_sudoku(grid))\r\n return 1; //sudoku solved\r\n grid[row][col] = 0;\r\n }\r\n }\r\n return 0;\r\n}", "is_valid(debug) {\n //Loop through diagonally (hitting all rows/columns in n iterations)\n for (var i = 0; i < this.size; i++) {\n let node = this.nodes[i * (this.size + 1)];\n let row_seen = {};\n let col_seen = {};\n\n if (node.solved) {\n row_seen[node.value] = { i: node.index };\n col_seen[node.value] = { i: node.index };\n }\n\n for (var i = 0; i < node.row.length; i++) {\n const node_row = this.nodes[node.row[i]];\n const node_col = this.nodes[node.col[i]];\n\n if (node_row.solved) {\n if (row_seen[node_row.value]) {\n if (debug) {\n let n = this.nodes[row_seen[node_row.value].i];\n console.log(`Row - Value: ${n.value} - Node: ${n.index}=(${index_to_x_y(n.index, this.size).x},${index_to_x_y(n.index, this.size).y})`)\n console.log(`Row - Value: ${node_row.value} - Node: ${node_row.index}=(${index_to_x_y(node_row.index, this.size).x},${index_to_x_y(node_row.index, this.size).y})`)\n }\n return false;\n }\n row_seen[node_row.value] = { i: node_row.index };\n }\n\n if (node_col.solved) {\n if (col_seen[node_col.value]) {\n if (debug) {\n let n = this.nodes[col_seen[node_col.value].i];\n console.log(`Col - Value: ${n.value} - Node: ${n.index}=(${index_to_x_y(n.index, this.size).x},${index_to_x_y(n.index, this.size).y})`)\n console.log(`Col - Value: ${node_col.value} - Node: ${node_col.index}=(${index_to_x_y(node_col.index, this.size).x},${index_to_x_y(node_col.index, this.size).y})`)\n }\n return false;\n }\n\n col_seen[node_col.value] = { i: node_col.index };\n }\n }\n }\n\n let inc = Math.sqrt(this.size);\n\n //Loop through top left of all sub_squares\n for (var y = 0; y < this.size; y += inc) {\n for (var x = 0; x < this.size; x += inc) {\n let sqr_seen = {};\n let node = this.nodes[x_y_to_index(x, y, this.size)];\n\n if (node.solved) sqr_seen[node.value] = { i: node.index }\n\n for (var i = 0; i < node.row.length; i++) {\n const node_sqr = this.nodes[node.sqr[i]];\n\n if (node_sqr.solved) {\n if (sqr_seen[node_sqr.value]) {\n if (debug) {\n let n = this.nodes[sqr_seen[node_sqr.value].i];\n console.log(`Sqr - Value: ${n.value} - Node: ${n.index}=(${index_to_x_y(n.index, this.size).x},${index_to_x_y(n.index, this.size).y})`)\n console.log(`Sqr - Value: ${node_sqr.value} - Node: ${node_sqr.index}=(${index_to_x_y(node_sqr.index, this.size).x},${index_to_x_y(node_sqr.index, this.size).y})`)\n }\n\n return false;\n }\n sqr_seen[node_sqr.value] = { i: node_sqr.index };\n }\n }\n }\n }\n\n return true;\n }", "function propagator_is_solved(S, p, dont_mark_solved) {\n var i, len, b;\n \n if (p.solved) {\n return true; \n }\n\n for (i = 0, len = p.allvars.length; i < len; ++i) {\n if (S.vars[p.allvars[i]].is_undetermined()) {\n return false;\n }\n }\n\n// return dont_mark_solved ? true : (p.solved = true);\n return true; \n }", "function resetNextUnitOfWork() {\n // Clear out roots with no more work on them, or if they have uncaught errors\n while (nextScheduledRoot !== null && nextScheduledRoot.current.pendingWorkPriority === NoWork$2) {\n // Unschedule this root.\n nextScheduledRoot.isScheduled = false;\n // Read the next pointer now.\n // We need to clear it in case this root gets scheduled again later.\n var next = nextScheduledRoot.nextScheduledRoot;\n nextScheduledRoot.nextScheduledRoot = null;\n // Exit if we cleared all the roots and there's no work to do.\n if (nextScheduledRoot === lastScheduledRoot) {\n nextScheduledRoot = null;\n lastScheduledRoot = null;\n nextPriorityLevel = NoWork$2;\n return null;\n }\n // Continue with the next root.\n // If there's no work on it, it will get unscheduled too.\n nextScheduledRoot = next;\n }\n\n var root = nextScheduledRoot;\n var highestPriorityRoot = null;\n var highestPriorityLevel = NoWork$2;\n while (root !== null) {\n if (root.current.pendingWorkPriority !== NoWork$2 && (highestPriorityLevel === NoWork$2 || highestPriorityLevel > root.current.pendingWorkPriority)) {\n highestPriorityLevel = root.current.pendingWorkPriority;\n highestPriorityRoot = root;\n }\n // We didn't find anything to do in this root, so let's try the next one.\n root = root.nextScheduledRoot;\n }\n if (highestPriorityRoot !== null) {\n nextPriorityLevel = highestPriorityLevel;\n // Before we start any new work, let's make sure that we have a fresh\n // stack to work from.\n // TODO: This call is buried a bit too deep. It would be nice to have\n // a single point which happens right before any new work and\n // unfortunately this is it.\n resetContextStack();\n\n nextUnitOfWork = createWorkInProgress$1(highestPriorityRoot.current, highestPriorityLevel);\n if (highestPriorityRoot !== nextRenderedTree) {\n // We've switched trees. Reset the nested update counter.\n nestedUpdateCount = 0;\n nextRenderedTree = highestPriorityRoot;\n }\n return;\n }\n\n nextPriorityLevel = NoWork$2;\n nextUnitOfWork = null;\n nextRenderedTree = null;\n return;\n }", "function resetNextUnitOfWork() {\n // Clear out roots with no more work on them, or if they have uncaught errors\n while (nextScheduledRoot !== null && nextScheduledRoot.current.pendingWorkPriority === NoWork$2) {\n // Unschedule this root.\n nextScheduledRoot.isScheduled = false;\n // Read the next pointer now.\n // We need to clear it in case this root gets scheduled again later.\n var next = nextScheduledRoot.nextScheduledRoot;\n nextScheduledRoot.nextScheduledRoot = null;\n // Exit if we cleared all the roots and there's no work to do.\n if (nextScheduledRoot === lastScheduledRoot) {\n nextScheduledRoot = null;\n lastScheduledRoot = null;\n nextPriorityLevel = NoWork$2;\n return null;\n }\n // Continue with the next root.\n // If there's no work on it, it will get unscheduled too.\n nextScheduledRoot = next;\n }\n\n var root = nextScheduledRoot;\n var highestPriorityRoot = null;\n var highestPriorityLevel = NoWork$2;\n while (root !== null) {\n if (root.current.pendingWorkPriority !== NoWork$2 && (highestPriorityLevel === NoWork$2 || highestPriorityLevel > root.current.pendingWorkPriority)) {\n highestPriorityLevel = root.current.pendingWorkPriority;\n highestPriorityRoot = root;\n }\n // We didn't find anything to do in this root, so let's try the next one.\n root = root.nextScheduledRoot;\n }\n if (highestPriorityRoot !== null) {\n nextPriorityLevel = highestPriorityLevel;\n // Before we start any new work, let's make sure that we have a fresh\n // stack to work from.\n // TODO: This call is buried a bit too deep. It would be nice to have\n // a single point which happens right before any new work and\n // unfortunately this is it.\n resetContextStack();\n\n nextUnitOfWork = createWorkInProgress$1(highestPriorityRoot.current, highestPriorityLevel);\n if (highestPriorityRoot !== nextRenderedTree) {\n // We've switched trees. Reset the nested update counter.\n nestedUpdateCount = 0;\n nextRenderedTree = highestPriorityRoot;\n }\n return;\n }\n\n nextPriorityLevel = NoWork$2;\n nextUnitOfWork = null;\n nextRenderedTree = null;\n return;\n }", "function resetNextUnitOfWork() {\n // Clear out roots with no more work on them, or if they have uncaught errors\n while (nextScheduledRoot !== null && nextScheduledRoot.current.pendingWorkPriority === NoWork$2) {\n // Unschedule this root.\n nextScheduledRoot.isScheduled = false;\n // Read the next pointer now.\n // We need to clear it in case this root gets scheduled again later.\n var next = nextScheduledRoot.nextScheduledRoot;\n nextScheduledRoot.nextScheduledRoot = null;\n // Exit if we cleared all the roots and there's no work to do.\n if (nextScheduledRoot === lastScheduledRoot) {\n nextScheduledRoot = null;\n lastScheduledRoot = null;\n nextPriorityLevel = NoWork$2;\n return null;\n }\n // Continue with the next root.\n // If there's no work on it, it will get unscheduled too.\n nextScheduledRoot = next;\n }\n\n var root = nextScheduledRoot;\n var highestPriorityRoot = null;\n var highestPriorityLevel = NoWork$2;\n while (root !== null) {\n if (root.current.pendingWorkPriority !== NoWork$2 && (highestPriorityLevel === NoWork$2 || highestPriorityLevel > root.current.pendingWorkPriority)) {\n highestPriorityLevel = root.current.pendingWorkPriority;\n highestPriorityRoot = root;\n }\n // We didn't find anything to do in this root, so let's try the next one.\n root = root.nextScheduledRoot;\n }\n if (highestPriorityRoot !== null) {\n nextPriorityLevel = highestPriorityLevel;\n // Before we start any new work, let's make sure that we have a fresh\n // stack to work from.\n // TODO: This call is buried a bit too deep. It would be nice to have\n // a single point which happens right before any new work and\n // unfortunately this is it.\n resetContextStack();\n\n nextUnitOfWork = createWorkInProgress$1(highestPriorityRoot.current, highestPriorityLevel);\n if (highestPriorityRoot !== nextRenderedTree) {\n // We've switched trees. Reset the nested update counter.\n nestedUpdateCount = 0;\n nextRenderedTree = highestPriorityRoot;\n }\n return;\n }\n\n nextPriorityLevel = NoWork$2;\n nextUnitOfWork = null;\n nextRenderedTree = null;\n return;\n }", "function resetNextUnitOfWork() {\n // Clear out roots with no more work on them, or if they have uncaught errors\n while (nextScheduledRoot !== null && nextScheduledRoot.current.pendingWorkPriority === NoWork$2) {\n // Unschedule this root.\n nextScheduledRoot.isScheduled = false;\n // Read the next pointer now.\n // We need to clear it in case this root gets scheduled again later.\n var next = nextScheduledRoot.nextScheduledRoot;\n nextScheduledRoot.nextScheduledRoot = null;\n // Exit if we cleared all the roots and there's no work to do.\n if (nextScheduledRoot === lastScheduledRoot) {\n nextScheduledRoot = null;\n lastScheduledRoot = null;\n nextPriorityLevel = NoWork$2;\n return null;\n }\n // Continue with the next root.\n // If there's no work on it, it will get unscheduled too.\n nextScheduledRoot = next;\n }\n\n var root = nextScheduledRoot;\n var highestPriorityRoot = null;\n var highestPriorityLevel = NoWork$2;\n while (root !== null) {\n if (root.current.pendingWorkPriority !== NoWork$2 && (highestPriorityLevel === NoWork$2 || highestPriorityLevel > root.current.pendingWorkPriority)) {\n highestPriorityLevel = root.current.pendingWorkPriority;\n highestPriorityRoot = root;\n }\n // We didn't find anything to do in this root, so let's try the next one.\n root = root.nextScheduledRoot;\n }\n if (highestPriorityRoot !== null) {\n nextPriorityLevel = highestPriorityLevel;\n // Before we start any new work, let's make sure that we have a fresh\n // stack to work from.\n // TODO: This call is buried a bit too deep. It would be nice to have\n // a single point which happens right before any new work and\n // unfortunately this is it.\n resetContextStack();\n\n nextUnitOfWork = createWorkInProgress$1(highestPriorityRoot.current, highestPriorityLevel);\n if (highestPriorityRoot !== nextRenderedTree) {\n // We've switched trees. Reset the nested update counter.\n nestedUpdateCount = 0;\n nextRenderedTree = highestPriorityRoot;\n }\n return;\n }\n\n nextPriorityLevel = NoWork$2;\n nextUnitOfWork = null;\n nextRenderedTree = null;\n return;\n }", "function resetNextUnitOfWork() {\n // Clear out roots with no more work on them, or if they have uncaught errors\n while (nextScheduledRoot !== null && nextScheduledRoot.current.pendingWorkPriority === NoWork$2) {\n // Unschedule this root.\n nextScheduledRoot.isScheduled = false;\n // Read the next pointer now.\n // We need to clear it in case this root gets scheduled again later.\n var next = nextScheduledRoot.nextScheduledRoot;\n nextScheduledRoot.nextScheduledRoot = null;\n // Exit if we cleared all the roots and there's no work to do.\n if (nextScheduledRoot === lastScheduledRoot) {\n nextScheduledRoot = null;\n lastScheduledRoot = null;\n nextPriorityLevel = NoWork$2;\n return null;\n }\n // Continue with the next root.\n // If there's no work on it, it will get unscheduled too.\n nextScheduledRoot = next;\n }\n\n var root = nextScheduledRoot;\n var highestPriorityRoot = null;\n var highestPriorityLevel = NoWork$2;\n while (root !== null) {\n if (root.current.pendingWorkPriority !== NoWork$2 && (highestPriorityLevel === NoWork$2 || highestPriorityLevel > root.current.pendingWorkPriority)) {\n highestPriorityLevel = root.current.pendingWorkPriority;\n highestPriorityRoot = root;\n }\n // We didn't find anything to do in this root, so let's try the next one.\n root = root.nextScheduledRoot;\n }\n if (highestPriorityRoot !== null) {\n nextPriorityLevel = highestPriorityLevel;\n // Before we start any new work, let's make sure that we have a fresh\n // stack to work from.\n // TODO: This call is buried a bit too deep. It would be nice to have\n // a single point which happens right before any new work and\n // unfortunately this is it.\n resetContextStack();\n\n nextUnitOfWork = createWorkInProgress$1(highestPriorityRoot.current, highestPriorityLevel);\n if (highestPriorityRoot !== nextRenderedTree) {\n // We've switched trees. Reset the nested update counter.\n nestedUpdateCount = 0;\n nextRenderedTree = highestPriorityRoot;\n }\n return;\n }\n\n nextPriorityLevel = NoWork$2;\n nextUnitOfWork = null;\n nextRenderedTree = null;\n return;\n }", "function resetNextUnitOfWork() {\n // Clear out roots with no more work on them, or if they have uncaught errors\n while (nextScheduledRoot !== null && nextScheduledRoot.current.pendingWorkPriority === NoWork$2) {\n // Unschedule this root.\n nextScheduledRoot.isScheduled = false;\n // Read the next pointer now.\n // We need to clear it in case this root gets scheduled again later.\n var next = nextScheduledRoot.nextScheduledRoot;\n nextScheduledRoot.nextScheduledRoot = null;\n // Exit if we cleared all the roots and there's no work to do.\n if (nextScheduledRoot === lastScheduledRoot) {\n nextScheduledRoot = null;\n lastScheduledRoot = null;\n nextPriorityLevel = NoWork$2;\n return null;\n }\n // Continue with the next root.\n // If there's no work on it, it will get unscheduled too.\n nextScheduledRoot = next;\n }\n\n var root = nextScheduledRoot;\n var highestPriorityRoot = null;\n var highestPriorityLevel = NoWork$2;\n while (root !== null) {\n if (root.current.pendingWorkPriority !== NoWork$2 && (highestPriorityLevel === NoWork$2 || highestPriorityLevel > root.current.pendingWorkPriority)) {\n highestPriorityLevel = root.current.pendingWorkPriority;\n highestPriorityRoot = root;\n }\n // We didn't find anything to do in this root, so let's try the next one.\n root = root.nextScheduledRoot;\n }\n if (highestPriorityRoot !== null) {\n nextPriorityLevel = highestPriorityLevel;\n // Before we start any new work, let's make sure that we have a fresh\n // stack to work from.\n // TODO: This call is buried a bit too deep. It would be nice to have\n // a single point which happens right before any new work and\n // unfortunately this is it.\n resetContextStack();\n\n nextUnitOfWork = createWorkInProgress$1(highestPriorityRoot.current, highestPriorityLevel);\n if (highestPriorityRoot !== nextRenderedTree) {\n // We've switched trees. Reset the nested update counter.\n nestedUpdateCount = 0;\n nextRenderedTree = highestPriorityRoot;\n }\n return;\n }\n\n nextPriorityLevel = NoWork$2;\n nextUnitOfWork = null;\n nextRenderedTree = null;\n return;\n }" ]
[ "0.68799996", "0.6489166", "0.6262617", "0.62526965", "0.6206691", "0.6077491", "0.5988894", "0.58992743", "0.58566487", "0.5849521", "0.5839041", "0.5812676", "0.57455593", "0.5742218", "0.5725517", "0.5685545", "0.56766915", "0.5673336", "0.56109524", "0.5583403", "0.5582377", "0.5575721", "0.55688876", "0.55550325", "0.547552", "0.54300886", "0.54298115", "0.541075", "0.5404444", "0.5356516", "0.53535235", "0.53083074", "0.52956355", "0.5264815", "0.52465373", "0.52442867", "0.5244148", "0.5240344", "0.5234662", "0.52268547", "0.5223619", "0.521582", "0.52146614", "0.5200736", "0.5198784", "0.5193335", "0.51929", "0.5172333", "0.51701343", "0.51641166", "0.5161455", "0.5156088", "0.5149262", "0.5145861", "0.5132332", "0.5125228", "0.51099455", "0.5103588", "0.50849307", "0.50807726", "0.5079997", "0.5079349", "0.5075968", "0.50722796", "0.5070521", "0.5063265", "0.5058787", "0.50548494", "0.50489944", "0.5045394", "0.50419086", "0.5035476", "0.50352275", "0.5031339", "0.5027952", "0.50184864", "0.50046295", "0.4999051", "0.4995934", "0.49942398", "0.49788296", "0.497845", "0.49776316", "0.49759445", "0.497366", "0.4973552", "0.49693245", "0.49688604", "0.49613532", "0.49560148", "0.49559036", "0.49556983", "0.49473527", "0.49447864", "0.49317318", "0.49317318", "0.49317318", "0.49317318", "0.49317318", "0.49317318" ]
0.6358553
2
Fill in nonroot components
fillIn(root, solveAll) { return _.map(this.state.answerParts, (part) => { if (solveAll || part.valueSolved === root.toLowerCase()) { part.valueUnsolved = part.valueSolved }; return part; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_fillCmpNoedit() {\n const comp = new Component(this);\n comp._index = 0;\n\n const residues = this._residues;\n const resCount = residues.length;\n if (resCount === 0) {\n return;\n }\n\n const currSubDivs = [];\n let currStart = 0;\n for (let i = 0; i < resCount; ++i) {\n const currRes = residues[i];\n currRes._component = comp;\n\n const nextRes = i === resCount - 1 ? null : residues[i + 1];\n if (!nextRes\n || !currRes.isConnected(nextRes)) {\n // wrap up this interval\n currSubDivs[currSubDivs.length] = {\n start: currStart,\n end: i,\n };\n if (nextRes) {\n currStart = i + 1;\n }\n }\n }\n\n comp.setSubDivs(currSubDivs);\n this._components[comp._index] = comp;\n }", "prepareNodes() {\n const render = (node) => {\n node.html = nodeToHTML(node);\n node.nodesHTML = subnodesToHTML(node.nodes);\n\n const dimensions = getDimensions(node.html, {}, 'mindmap-node');\n node.width = dimensions.width;\n node.height = dimensions.height;\n\n const nodesDimensions = getDimensions(node.nodesHTML, {}, 'mindmap-subnode-text');\n node.nodesWidth = nodesDimensions.width;\n node.nodesHeight = nodesDimensions.height;\n };\n\n this.props.nodes.forEach(node => render(node));\n }", "function fillNodes(node){if(!node.layout||node.isDirty){node.layout={width:undefined,height:undefined,top:0,left:0,right:0,bottom:0};}if(!node.style){node.style={};}if(!node.children){node.children=[];}node.children.forEach(fillNodes);return node;}", "function resetComponentState(){isParent=false;previousOrParentTNode=null;elementDepthCount=0;bindingsEnabled=true;}", "function refreshChildComponents(components){if(components!=null){for(var i=0;i<components.length;i++){componentRefresh(components[i]);}}}", "function fillNodes(node) {\n if (!node.layout || node.isDirty) {\n node.layout = {\n width: undefined,\n height: undefined,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0\n };\n }\n\n if (!node.style) {\n node.style = {};\n }\n\n if (!node.children) {\n node.children = [];\n }\n node.children.forEach(fillNodes);\n return node;\n }", "function resetComponentRoot(vm) {\n const {\n children,\n renderer\n } = vm;\n const rootNode = getRenderRoot(vm);\n\n for (let i = 0, len = children.length; i < len; i++) {\n const child = children[i];\n\n if (!isNull(child) && !isUndefined$3(child.elm)) {\n renderer.remove(child.elm, rootNode);\n }\n }\n\n vm.children = EmptyArray;\n runChildNodesDisconnectedCallback(vm);\n vm.velements = EmptyArray;\n }", "function prepareElementRoot() {\n aria( P.$root[0], 'hidden', true )\n }", "function prepareElementRoot() {\n aria( P.$root[0], 'hidden', true )\n }", "function prepareElementRoot() {\n aria( P.$root[0], 'hidden', true )\n }", "function resetComponentState() {\n isParent = false;\n previousOrParentTNode = null;\n elementDepthCount = 0;\n bindingsEnabled = true;\n}", "function resetComponentState() {\n isParent = false;\n previousOrParentTNode = null;\n elementDepthCount = 0;\n bindingsEnabled = true;\n}", "function resetComponentState() {\n isParent = false;\n previousOrParentTNode = null;\n elementDepthCount = 0;\n bindingsEnabled = true;\n}", "function resetComponentState() {\n isParent = false;\n previousOrParentTNode = null;\n elementDepthCount = 0;\n bindingsEnabled = true;\n}", "configureChildren() {\n this.children = this.props.children\n .map(x => ({\n ...x,\n props: {\n ...x.props,\n setValue: this.setValueOf(x.props.name),\n registerValidator: this.registerValidator(x.props.name),\n unregisterValidator: this.unregisterValidator(x.props.name),\n },\n }))\n }", "function _buildElements() {\n\t\t\t_buildGroup(_settings.layout.left);\n\t\t\t_buildGroup(_settings.layout.right, -1);\n\t\t\t_buildGroup(_settings.layout.center);\n\t\t}", "function fillComponentRepository() {\n var moduleName;\n while (moduleName = finalDependencies.pop()) {\n var registeredComps = liteJSModules[moduleName].registeredComps,\n length = registeredComps.length;\n for (var i = 0; i < length; i++) {\n if (componentRepository[registeredComps[i].name]) {\n //console.error(\"duplicate component found between module..\");\n } else {\n componentRepository[registeredComps[i].name] = registeredComps[i];\n }\n }\n //key registeredComps is not required as this is already pushed to componentRepository;\n delete liteJSModules[moduleName];\n }\n }", "function initAll(parentElement) {\n if (typeof parentElement === 'undefined') parentElement = document;\n\n // Old attribute system\n for (const componentName of Object.keys(componentMapping)) {\n searchForComponentInParent(componentName, parentElement);\n }\n\n // New component system\n const componentElems = parentElement.querySelectorAll(`[component],[components]`);\n\n for (const el of componentElems) {\n const componentNames = `${el.getAttribute('component') || ''} ${(el.getAttribute('components'))}`.toLowerCase().split(' ').filter(Boolean);\n for (const name of componentNames) {\n initComponent(name, el);\n }\n }\n}", "onpopulate()\n {\n if (this.children.length && !this.shouldRefreshChildren)\n return;\n this.shouldRefreshChildren = false;\n\n this.removeChildren();\n this.updateParentStatus();\n this.prepareToPopulate();\n\n for (var i = 0; i < this._frame.childFrames.length; ++i)\n this.addChildForRepresentedObject(this._frame.childFrames[i]);\n\n for (var i = 0; i < this._frame.resources.length; ++i)\n this.addChildForRepresentedObject(this._frame.resources[i]);\n\n var sourceMaps = this.resource && this.resource.sourceMaps;\n for (var i = 0; i < sourceMaps.length; ++i) {\n var sourceMap = sourceMaps[i];\n for (var j = 0; j < sourceMap.resources.length; ++j)\n this.addChildForRepresentedObject(sourceMap.resources[j]);\n }\n\n var flowMap = this._frame.domTree.flowMap;\n for (var flowKey in flowMap)\n this.addChildForRepresentedObject(flowMap[flowKey]);\n\n for (let extraScript of this._frame.extraScripts) {\n if (extraScript.sourceURL || extraScript.sourceMappingURL)\n this.addChildForRepresentedObject(extraScript);\n }\n }", "function fillStructure(root, columns, counter) {\n counter = counter || 0;\n\n if (angular.isDefined(root.rows)) {\n angular.forEach(root.rows, function (row) {\n angular.forEach(row.columns, function (column) {\n // if the widgets prop doesn't exist, create a new array for it.\n // this allows ui.sortable to do it's thing without error\n if (!column.widgets) {\n column.widgets = [];\n }\n\n // if a column exist at the counter index, copy over the column\n if (angular.isDefined(columns[counter])) {\n // do not add widgets to a column, which uses nested rows\n if (angular.isUndefined(column.rows)) {\n copyWidgets(columns[counter], column);\n counter++;\n }\n }\n\n // run fillStructure again for any sub rows/columns\n counter = fillStructure(column, columns, counter);\n });\n });\n }\n return counter;\n }", "function fillPropValues(box) {\n if (box != null) {\n fillBoxPropValues(box);\n } else {\n fillBoxPropValues(document.querySelector(`#${document.querySelector('.container').children[0].id}`));\n fillFlexFlow();\n }\n}", "assignRequiredToSubComponents() {\n if (this.required && this.componentRefs) {\n setTimeout(() => {\n this.componentRefs.forEach(componentRef => componentRef.widget.required = true);\n }, 50);\n }\n }", "initChildren() {\n this.nodes.forEach(node => {\n node.parent = this\n })\n }", "GetComponentsInParent() {}", "GetComponentsInParent() {}", "GetComponentsInParent() {}", "GetComponentsInParent() {}", "constructor() {\n this.root = null;\n }", "constructor() {\n this.root = null;\n }", "constructor() {\n this.root = null;\n }", "constructor() {\n this.root = null\n }", "constructor() {\n this.root = null\n }", "GetComponentsInChildren() {}", "GetComponentsInChildren() {}", "GetComponentsInChildren() {}", "GetComponentsInChildren() {}", "resetSubComponents(inputs,propagate) {\n\t\tthis.sub_component_objects.forEach(function(component) {\n\t\t\tcomponent.reset(inputs,propagate);\n\t\t}.bind(this));\n\t}", "buildTree() {\n // note: in this function you will assign positions and levels by making calls to assignPosition() and assignLevel()\n let rootNode = this.nodeList.find(theRootNode => theRootNode.parentName === \"root\");\n this.assignLevel(rootNode, 0);\n this.assignPosition(rootNode, 0);\n }", "buildTree() {\n\t\tthis.assignLevel(this.nodesList[0], 0);\n\t\tthis.positionMap = new Map();\n\t\tthis.assignPosition(this.nodesList[0], 0);\n\t}", "constructor() {\n this.root = null;\n }", "function populateComponents(){\n $('.component').each(function () {\n components.add($(this));\n });\n}", "$_fillRecursive(formData) {}", "function refreshChildComponents(components) {\n if (components != null) {\n for (var i = 0; i < components.length; i++) {\n componentRefresh(components[i]);\n }\n }\n}", "function refreshChildComponents(components) {\n if (components != null) {\n for (var i = 0; i < components.length; i++) {\n componentRefresh(components[i]);\n }\n }\n}", "function refreshChildComponents(components) {\n if (components != null) {\n for (var i = 0; i < components.length; i++) {\n componentRefresh(components[i]);\n }\n }\n}", "cacheInitialItems() {\n this.initialItemElements = this.containerDirectChildren.map(child => child.cloneNode(true));\n if (!this.initialItemElements.length) {\n throw new Error('Could not find any items');\n }\n\n this.initialItemsWidth = this.containerDirectChildren.reduce(\n (sum, item) => sum + getWidth(item),\n 0,\n );\n }", "constructor(){\n this.root = null;\n }", "constructor() {\n this._root = {};\n }", "__empty() {\n let nodes = [];\n\n this.__removeChildren();\n\n let find = (children) => {\n for(let i = 0, l = children.length; i < l; i++) {\n let child = children[i];\n\n if(child.nodeType == 3) {\n nodes.push(child);\n }\n else if(child.nodeType == 1 && !child.__akili) {\n for (let k = 0, attrs = child.attributes, c = attrs.length; k < c; k++) {\n nodes.push(attrs[i]);\n }\n\n find(child.childNodes);\n }\n }\n };\n\n find(this.el.childNodes);\n this.__unbindByNodes(nodes);\n this.el.innerHTML = '';\n }", "async populateFlattenedDependencies() {\n _logger().default.debug(`populateFlattenedDependencies starts with ${this.components.length} components`);\n\n this.createGraphs(this.components);\n await this.importExternalDependenciesInBulk();\n await (0, _pMapSeries().default)(this.components, async component => {\n component.flattenedDependencies = await this.getFlattened(component.id);\n });\n }", "function initializeNode() {\r\n // set root fixed in the middle\r\n root.fixed = true;\r\n root.x = mC.panelWidth / 2;\r\n root.y = mC.panelHeight / 2;\r\n root.px = mC.panelWidth / 2;\r\n root.py = mC.panelHeight / 2;\r\n // assign locations for nodes\r\n initialNodes.forEach(function(d) {\r\n if (d.type != \"root\") {\r\n var location = setInitialLocation(d);\r\n d.x = location[0];\r\n d.y = location[1];\r\n d.px = location[0];\r\n d.py = location[1];\r\n }\r\n // for each node type create new tempNode and add them to their lookup\r\n if (d.type == \"dp\") {\r\n d.fixed = true;\r\n var newTempDpNode = new tempDpNode(d.id, d.type, d.label);\r\n tempDpNodes.push(newTempDpNode);\r\n tempDpNodes_lookup[newTempDpNode.id] = newTempDpNode;\r\n }\r\n if (d.type == \"dec\") {\r\n var newTempDecNode = new tempDecNode(d.id, d.type, d.label, d.parent);\r\n tempDecNodes.push(newTempDecNode);\r\n tempDecNodes_lookup[newTempDecNode.id] = newTempDecNode;\r\n }\r\n if (d.type == \"out\") {\r\n var newTempNode = new tempNode(\"out\" + d.parent, d.id, d.type, d.label,\r\n d.parent);\r\n tempNodes.push(newTempNode);\r\n tempNodes_lookup[newTempNode.id] = newTempNode;\r\n }\r\n\r\n });\r\n }", "clearChildren() {\n this.children.forEach(c => {\n c.parent = undefined;\n });\n this.children = [];\n }", "_renderNewRootComponent(/* instance, ... */) { }", "setVarientComponents (qModel) {\n // console.debug('setInstanceComponents')\n\n /**\n * Mark all elements of a variant as a component for the\n * design lets\n */\n let varientComponents = {}\n Object.values(qModel.widgets).forEach(widget => {\n let parent = qModel.widgets[widget.parentId]\n if (parent && parent.figmaType === 'COMPONENT_SET') {\n widget.props.isComponet = true\n widget.props.isVaraint = true\n widget.variant = this.parseVariant(widget.name)\n if (!varientComponents[widget.parentId]){\n varientComponents[widget.parentId] = []\n }\n varientComponents[widget.parentId].push(widget)\n /**\n * Give a better na,e other wise css will fail\n */\n widget.name = parent.name + '-' + Object.values(widget.variant).join('-')\n }\n })\n }", "function fillNullGenus() {\n if (tP.recrd[tP.fieldAry[1]] === null) { \n tP.recrd[tP.fieldAry[1]] = tP.genusParent; }\n }", "function fill () {\n if (!component.context.implAPI.fill) return;\n if (!fill._helpers) {\n fill._helpers = {};\n var templateComponentHelpers = component.template.getComponentHelpers();\n Object.keys(templateComponentHelpers).forEach(function (name) {\n fill._helpers[name] = function () {\n var args = Array.prototype.slice.call(arguments);\n args.unshift(component.context);\n return templateComponentHelpers[name].apply(null, args);\n }\n });\n }\n component.context.implAPI.fill.call(\n fill._helpers,\n component.context,\n component.domNode,\n component.context.dataObject\n );\n return;\n }", "function resetAndPopulate(parent, child) {\n parent.textContent = '';\n parent.appendChild(child);\n }", "function refreshChildComponents(components, parentFirstTemplatePass) {\n if (components != null) {\n for (var i = 0; i < components.length; i++) {\n componentRefresh(components[i], parentFirstTemplatePass);\n }\n }\n}", "firstUpdated(props) {\n [...this.renderRoot.querySelectorAll('[id]')].forEach(node => {\n this.$[node.id] = node;\n });\n super.firstUpdated(props);\n }", "reset() {\n this._setTreeStatus('');\n this._checkedAutorollers = new Set();\n this._selectedTreeStatus = '';\n this.setAttribute('collapsed', '');\n this._render();\n }", "_refresh() {\n const children = Array.from(this.slottedChildren);\n if (children.length && this.expanded) {\n this._expand();\n Array.from(children).forEach(el => el._refresh());\n }\n }", "fillParents () {\n this.files.forEach((demoFile: DemoFile) => {\n demoFile.folder = this\n })\n this.folders.forEach((demoFolder: DemoFolder) => {\n demoFolder.parentFolder = this\n demoFolder.fillParents()\n })\n }", "finalizeInitialChildren(newElement, type, props, rootContainerInstance) {\n if (typeof newElement.finalizeBeforeMount === 'function') {\n newElement.finalizeBeforeMount(type, props, rootContainerInstance);\n }\n }", "conectingChildrens() {\n\n for (let componentRefId of this.componentsRefId) {\n if (typeof this.graph.components[componentRefId] == 'undefined') {\n this.graph.onXMLError(\"components:: it doens't have any component with that id, \" + componentRefId + \".\");\n } else {\n this.childrens.push(this.graph.components[componentRefId]);\n }\n }\n }", "clear() {\n this.root = null;\n this.root = this.createRootNode();\n }", "function paintAll() {\n var nodes = tree.nodes(mainRoot);\n var links = tree.links(nodes);\n\n setParent(mainRoot);\n\n paintLinks();\n paintNodes();\n\n //Setting parents for each element\n function setParent(node) {\n if ('children' in node) {\n for (var index in node.children) {\n node.children[index].parent = node;\n setParent(node.children[index]);\n }\n }\n }\n\n //painting nodes\n function paintNodes() {\n var forNodes = formD3ChainCalls(panel, \"g#noderz\"+graphId+\"|id'noderz\"+graphId);\n var update = forNodes.selectAll(\".node\").data(nodes, function (d) {return \"\"+ d.uniqueId + d.expanded;});\n var enter = update.enter();\n var exit = update.exit();\n\n enter.append(\"g\").attr(\"class\", \"node\").style('opacity', 0).attr('transform', function (d) {\n if (typeof d === 'object' && 'parent' in d) {\n if (!d.ui) {\n if (d.type == elementTypes.paginator) createPaginator(d, d3.select(this));\n else if (d.type == elementTypes.loader) createLoader(d, d3.select(this));\n } else {\n if (d.type == elementTypes.paginator) this.appendChild(d.ui.root.node());\n else if (d.type == elementTypes.loader) this.appendChild(d.ui.root.node());\n }\n return \"translate(\" + d.parent.y + \",\" + d.parent.x + \")\";\n } else return \"translate(0,0)\";\n });\n\n exit.filter(function (d) { return !d.wasDiscarded; })\n .transition().duration(p.animdur).style('opacity', 0).attr('transform', function (d) {\n if (typeof d !== 'object' || !('parent' in d)) return \"translate(0,0)\";\n else return \"translate(\" + d.parent.y + \",\" + d.parent.x + \")\";\n }).remove();\n exit.filter(function (d) { return d.wasDiscarded; })\n .transition().duration(p.animdur).style('opacity', 0).remove();\n\n update.attr('pointer-events', function (d) { return willBeDiscarded(d) ? 'none' : null; })\n .transition().duration(function (d) { return willBeDiscarded(d) ? p.discardAnimDuration : p.animdur; })\n .attr(\"transform\", function (d) { return \"translate(\" + d.y + \",\" + d.x + \")\";})\n .style('opacity', function (d) { return willBeDiscarded(d) ? 0.2 : 1; })\n .each(function (d) {\n var thisItem = d3.select(this);\n if (d.type == elementTypes.paginator) { updatePaginator(d, thisItem); }\n else if (d.type == elementTypes.loader) { updateLoader(d, thisItem); }\n else if (d.type == elementTypes.objProperty) {\n thisItem.text('');\n paintObjProperty(d, thisItem);\n } else if (d.type == elementTypes.instance) {\n if (d.dataIndicator && d.dataIndicator.ui) {\n d.dataIndicator.ui.remove();\n d.dataIndicator.ui = null;\n }\n thisItem.text('');\n paintInstance(d, thisItem);\n }\n if (d.pageIndicator) { arrangePageIndicator(d, d.pageIndicator); }\n });\n\n function createPaginator(d, parent) {\n d.ui = svgui.Paginator({parent: parent, color: d.parent.color, width: 160});\n d.ui.onPageChanged = function (page) { onPageChanged(page, d, d.parent); };\n }\n\n function onPageChanged(newPage, paginatorModel, parentModel) {\n if (parentModel.pageRequest && parentModel.pageRequest.isRunning)\n parentModel.pageRequest.cancel();\n if (parentModel.pageIndicator)\n parentModel.pageIndicator.remove();\n\n var margin = 15, nodeSize = p.nodeWidth - p.nodeDif;\n var indicator = Indicator.create(panel, {size: p.pageIndicatorSize, maxWidth: nodeSize - margin}).run();\n arrangePageIndicator(parentModel, indicator);\n parentModel.pageIndicator = indicator;\n paginatorModel.currentPage = newPage;\n\n if (parentModel.type == elementTypes.objProperty) {\n parentModel.pageRequest = requestForInstances(parentModel, newPage, renderParams.pageLimitForInstances, indicator);\n } else if (parentModel.type == elementTypes.instance) {\n parentModel.pageRequest = requestForObjPropPage(parentModel, newPage, renderParams.pageLimitForObjectProperties, indicator);\n }\n paintAll();\n }\n\n function arrangePageIndicator(parentModel, indicatorInstance) {\n var minX = Infinity;\n var minY = Infinity, maxY = -Infinity;\n panel.selectAll(\".node\").filter(function (nodeData) {\n return nodeData.parent === parentModel && nodeData.type != elementTypes.paginator;\n }).each(function (d) {\n // d.x and d.y are swapped here\n minX = Math.min(minX, d.y);\n var height = calcHeight(d);\n minY = Math.min(minY, d.x - height / 2);\n maxY = Math.max(maxY, d.x + height / 2);\n });\n\n var margin = 15, nodeSize = p.nodeWidth - p.nodeDif;\n var position = vector(minX - nodeSize / 2 + p.pageIndicatorSize / 2 + margin, minY + (maxY - minY) / 2);\n indicatorInstance.moveTo(position);\n }\n\n function createLoader(d, parent) {\n var container = parent.append(\"g\").attr(\"width\", p.childrenLoaderSize).attr(\"height\", p.childrenLoaderSize);\n d.ui = Indicator.create(container, {size: p.childrenLoaderSize}).run();\n d.ui.root = container;\n updateIndicatorUI(d);\n }\n\n function paintObjProperty(d, d3This){\n var uiElement = d.ui;\n var halfWidth = (p.nodeWidth-p.nodeDif) / 2;\n var ti = textInfo(d.name, \"basicTextInGraph\");\n uiElement.render(d3This, 0 -( (ti.width/2>=halfWidth)?halfWidth:((ti.width)/2)), 10, p.nodeWidth - p.nodeDif);\n\n var path = (d.direction == 'OUT') ? \"M0,-5L10,0L0,5\" : \"M0,-5L-10,0L0,5\";//Triangle\n d3This.append(\"path\").attr(\"d\", path).attr(\"fill\", d.parent.color);\n\n //Circle expander\n var circle = d3This.append(\"circle\").attr({cx:halfWidth,cy:0,r:10, fill:'white',stroke: d.color,'stroke-width':2});\n path = (!d.children) ? \"M0,-5L10,0L0,5\" : \"M0,-5L-10,0L0,5\";\n var triangle = d3This.append(\"path\").attr(\"d\", path).attr(\"fill\", d.parent.color).attr(\"transform\",\"translate(\" + ((!d.children)?(halfWidth-4):(halfWidth+3)) + \",\" + 0 + \")\");\n circle.on(\"mousedown\", rightAction);\n triangle.on(\"mousedown\", rightAction);\n\n function rightAction() {\n invokeRightAction(d, function (d) { rightActionForObjectProperty(d); });\n }\n }\n\n function paintInstance(d,d3This){\n var uiElement = (d.expanded)? d.uiExpanded : d.ui;\n var leftRightHeight = uiElement.height(p.nodeWidth - p.nodeDif);\n var halfWidth = (p.nodeWidth-p.nodeDif) / 2;\n //If it's not root - we create left ear\n var leftEar=null;\n var rightEar=null;\n if (d.parent && !d.error){\n leftEar = createEar(d, d3This,-halfWidth - p.buttonWidth,\n -(leftRightHeight / 2) + 1, halfWidth , leftRightHeight,\n uiElement, leftAction(d), \"M5,-5L-5,0L5,5\",-halfWidth-(p.buttonWidth)/2);\n }\n //right ear\n if (!d.error) {\n rightEar = createEar(d, d3This, 0 , -(leftRightHeight / 2) + 1, halfWidth + p.buttonWidth,\n leftRightHeight, uiElement, function() {\n invokeRightAction(d, function (d) { rightActionForInstance(d); });\n }, (d.children) ? \"M5,-5L-5,0L5,5\" : \"M-5,-5L-5,5L5,0\",\n (d.children) ? (halfWidth+(p.buttonWidth-4)/2) : (halfWidth+(p.buttonWidth)/2));\n }\n //render main element after ears\n uiElement.render(d3This, -halfWidth, -leftRightHeight / 2, p.nodeWidth-p.nodeDif);\n if (!d.error) uiElement.setAction(\"mousedown.open\", centerAction(d));\n uiElement.setAction(\"mouseover.uwi\", onMouseElement(1));\n uiElement.setAction(\"mouseout.uwi\", onMouseElement(0));\n\n //Changing opacity to 0 or 1\n function onMouseElement(opacity){\n return function () {\n if(rightEar!=null) rightEar.transition().duration(p.animdur).attr(\"opacity\", opacity);\n if (leftEar != null) leftEar.transition().duration(p.animdur).attr(\"opacity\", opacity);\n };\n }\n\n //create left or right ear\n function createEar(d, d3This, x ,y, width, height, uiElement, action, path, translate){\n var ear = d3This.append(\"g\").attr(\"opacity\",0);\n addBorderedRect(ear, x , y, width, height, 2, \"white\", uiElement.RxRy(), uiElement.RxRy(), d.color);\n ear.append(\"path\").attr(\"d\", path).attr(\"fill\", d.color).attr(\"transform\",\"translate(\"+translate+\",0)\");\n actionSet(ear);\n return ear;\n\n function actionSet(item){\n item.on(\"mousedown\", action);\n item.on('mouseover', function () { ear.transition().duration(p.animdur).attr(\"opacity\",1);});\n item.on('mouseout', function () { ear.transition().duration(p.animdur).attr(\"opacity\",0);});\n }\n }\n }\n\n function invokeRightAction(d, rightActionHandler) {\n var isExpanded = d['children'], hasCollapsedChildren = d['_children'];\n var isLoadingError = d.pageRequest && d.pageRequest.isFailed;\n if (isExpanded || !isLoadingError && hasCollapsedChildren) {\n expandOrCollapseChildren(d);\n paintAll();\n } else {\n d['_children'] = false;\n rightActionHandler(d);\n }\n }\n\n function updatePaginator(d, d3This) {\n d.ui.currentPage = d.currentPage;\n d.ui.pageCount = d.overallPages;\n d.ui.update();\n var size = svgui.measure(d.ui, vector(p.nodeWidth - p.nodeDif, Infinity));\n svgui.arrange(d.ui, -((size.x / 2 >= (p.nodeWidth - p.nodeDif) / 2)\n ? (p.nodeWidth - p.nodeDif) / 2 : size.x / 2), -10);\n }\n\n function updateLoader(d, d3This) {\n var height = d.ui.size;\n d.ui.parent.attr(\"transform\", \"translate(\" +\n (-(p.nodeWidth - p.nodeDif) / 2 + 5) + \",\" + (-height / 2) + \")\");\n }\n }\n\n //painting links\n function paintLinks() {\n var forLinks = formD3ChainCalls(panel, \"g#linkers\"+graphId+\"|id'linkers\"+graphId);\n var update = forLinks.selectAll(\".link\").data(links, function (d) {return d.source.uniqueId + \"_\" + d.target.uniqueId;});\n var enter = update.enter();\n var exit = update.exit();\n\n enter.append(\"path\").attr(\"class\", \"link\").attr('stroke', function (d) {\n if (d.source.type == elementTypes.instance) return d.source.color;\n else if (d.source.type == elementTypes.objProperty) return d.source.parent.color;\n }).style('opacity',0);\n\n exit.filter(function (d) { return !d.target.wasDiscarded; })\n .transition().duration(p.animdur).attr(\"d\", function (d) {\n var o = {x: d.target.x, y: d.target.y};\n return diagonal({source: o, target: o});\n }).style('opacity', 0).remove();\n exit.filter(function (d) { return d.target.wasDiscarded; }).remove();\n\n update.transition().duration(function (d) { return willBeDiscarded(d.target) ? p.discardAnimDuration : p.animdur; })\n .attr(\"d\", function (d) {\n /// !!!!! X and Y are inverted here!!!!!\n if (d.target.type == elementTypes.paginator) return \"M\"+ d.target.y+\",\"+ d.target.x;\n var m = (d.source.y + d.target.y) / 2;\n var halfWidth = (p.nodeWidth-p.nodeDif) / 2;\n var k = [\n {x: d.source.x, y: d.source.y + halfWidth }, //left point\n {x: d.source.x, y: m}, //middle left\n {x: d.target.x, y: m}, //middle right\n {x: d.target.x, y: d.target.y - halfWidth } //right point\n ];\n\n var toRet = \"\";\n var prefix = \"M\";\n var suffix = \"\";\n var firstDone = false;\n if (d.target.type == elementTypes.objProperty)//if left element is object property - we make a long line\n suffix += \"M\" + (d.target.y - halfWidth) + \",\" + d.target.x +\" L\" + (d.target.y+halfWidth ) + \",\" + d.target.x;\n\n k = k.map(function (d) { return [ d.y, d.x ];});\n each(k, function (d) {\n if (!firstDone) {toRet += d + \" C\";firstDone = true;}\n else toRet += d + \" \";\n });\n\n return prefix + toRet.trim() + suffix;\n }).style('opacity', function (d) { return willBeDiscarded(d.target) ? 0.2 : 1; });\n }\n }", "function iterateUiComponents(base, obj) {\n for (var prop in obj) {\n if (obj.hasOwnProperty(prop)) {\n if (prop === 'children') {\n obj[prop].forEach(function (c, i) {\n obj[prop][i] = iterateUiComponents(base, c);\n });\n }\n if (angular.isObject(obj[prop])) {\n iterateUiComponents(base, obj[prop]);\n }\n }\n }\n\n if (obj.component) {\n obj = generateComponent(base, obj);\n }\n if (obj.templateUrl && !obj.component) {\n obj = self.setBase(self.templateBase, ['templateUrl'], obj);\n }\n\n return obj;\n }", "render() {\n //get all root nodes\n let roots = this.state.nodes.filter((elem, i) => {\n //root elements have no parent\n if (elem.parent === undefined) {\n return true;\n } else {\n return false;\n }\n });\n\n return (\n <div style={{ minWidth: 700 }}>\n <ul\n role=\"tree\"\n aria-labelledby=\"treeLabel\"\n aria-describedby=\"kbd_desc\"\n onClick={e => this.onClickEvent(e)}\n onFocus={e => this.onFocusEvent(e)}\n onBlur={e => this.onBlurEvent(e)}\n onKeyDown={e => this.onKeyPressedEvent(e)}\n >\n {/* start render root elements */}\n {roots.map((elem, i) => {\n return this.renderRoots(elem, i + 1, roots.length);\n })}\n </ul>\n </div>\n );\n }", "function wb(){this.wa=this.root=null;this.Y=!1;this.C=this.T=this.ka=this.assignedSlot=this.assignedNodes=this.J=null;this.childNodes=this.nextSibling=this.previousSibling=this.lastChild=this.firstChild=this.parentNode=this.O=void 0;this.Ca=this.pa=!1}", "function fillElements( data ) {\n const nodes = Array.from( document.querySelectorAll('[data-path]') );\n for( const node of nodes ) {\n const path = node.dataset.path.split('.');\n let value = data, el;\n while( el = path.shift() ) {\n if( el in value ) {\n value = value[el];\n } else {\n break;\n }\n }\n if( typeof value != 'object' ) {\n node.innerHTML = value != undefined ? value : '-';\n }\n }\n }", "function componentizer(obj, parent) {\n\t\tvar node = new StructureNode().wrapComponent(obj.component);\n\t\tparent && StructureNode.Link(parent, node);\n\n\t\t_.forEach(obj.mounts, function(mount) {\n\t\t\tcomponentizer(mount, node);\n\t\t})\n\n\t\treturn node;\n\t}", "function standardizeConfig(r){var children=r.children&&r.children.map(standardizeConfig);var c=children?Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"])({},r,{children:children}):Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"])({},r);if(!c.component&&(children||c.loadChildren)&&c.outlet&&c.outlet!==PRIMARY_OUTLET){c.component=EmptyOutletComponent;}return c;}", "function updateRoot(event) {\n var context = event.context, oldRoot = context.oldRoot, children = oldRoot.children;\n Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"forEach\"])(children, function (child) {\n if (Object(_util_ModelUtil__WEBPACK_IMPORTED_MODULE_4__[\"is\"])(child, 'bpmn:BaseElement')) {\n self.updateParent(child);\n }\n });\n }", "constructor () {\n\t\tthis.nodes = {};\n\t}", "clear() {\n\t\tif (this.state && this.state.root) {\n\t\t\tthis.state.root.empty()\n\t\t}\n\t}", "function fillInformation() {\n\tfor (i = 0; i < 3; i++)\n\t\t{\n\t\t\t//fill in the SPEC x/x/x\n\t\t\tdocument.getElementById('spec' + i).innerHTML = pointsTree[i];\t\n\t\t}\n\t//required level\n\tdocument.getElementById('levelRequired').innerHTML = rankPointsMax - rankPoints + levelMin - 1;\n\t//pointsLeft\n\tdocument.getElementById('tabPointsAvailable').innerHTML = rankPoints;\n}", "updateSelf(namedChildren, data) {\n this.namedChildren = namedChildren;\n this.props = data;\n }", "constructor() {\r\n //set the root node to null\r\n this.root = null;\r\n }", "createCodeForGenerateContent() {\n const getNodeKey = ({ treeIndex }) => treeIndex;\n const flatteningNestedArray = getFlatDataFromTree({treeData: this.state.treeData, getNodeKey});\n let flattenedVar = flatteningNestedArray;\n/*\n version1 is an array of sub-arrays. Within each array, the last element\n is the parent of all previous elements.\n */\n let version1 = [];\n /* For version2, the key is the parent. Value is all of the children\n stored as elements in an array.\n */\n let version2 = {};\n\n for(let i = 0; i<flattenedVar.length; i++) {\n/*\n val is the name of the parent node. If there is no parent, then we set\n val to null. That would only be true for the eldest parent, App.\n*/\n let val = (flattenedVar[i].parentNode) ? flattenedVar[i].parentNode.name : null;\n version1.push([flattenedVar[i].node.name, val]);\n }\n //iterate through our sub-arrays to get data into the version2 object\n for (let i=0; i< version1.length; i++) {\n let subArr = version1[i];\n //lastElem is the parent names.\n let lastElem = subArr[subArr.length-1];\n //firstElem is the component names.\n let firstElem = subArr[0];\n if (!version2[firstElem]) {\n version2[firstElem] = null;\n }\n //Parent is assigned a value of it's children\n if (version2.hasOwnProperty(lastElem) && version2[lastElem] === null) {\n version2[lastElem] = subArr.slice(0, -1);\n } else if (version2.hasOwnProperty(lastElem) && version2[lastElem] !== null) {\n version2[lastElem] = version2[lastElem].concat(subArr.slice(0, -1));\n }\n }\n/*\n Here we add an array with a single string element of \"stateful\" or \"stateless\"\n to the value of every key. If a key's value is null, then null is replaced\n entirely by a single array of \"stateful\" or \"stateless\".\n*/\n for (let i=0; i < flattenedVar.length; i++) {\n if (Array.isArray(version2[flattenedVar[i].node.name])) {\n if (flattenedVar[i].node.isStateful) {\n version2[flattenedVar[i].node.name].push(['stateful']);\n } else {\n version2[flattenedVar[i].node.name].push(['stateless']);\n }\n } else {\n version2[flattenedVar[i].node.name] = (flattenedVar[i].node.isStateful) ? [['stateful']] : [['stateless']];\n }\n }\n this.setState({\n version2: version2,\n });\n }", "clear() {\n this._count = 0;\n this._root = null;\n }", "removeAll() {\n this.nodes.forEach(node => node.parentNode.removeChild(node));\n this.nodes = [];\n this.component.resolveElements();\n }", "tidy(root) {\n let orderedNodes = [];\n this.postTraverse(root, orderedNodes);\n let modMap = {};\n let centerMap = {};\n let min_dist = 100;\n for (let node of orderedNodes) {\n centerMap[node.id] = 0;\n node.cx = 0;\n if (node.children.length != 0) {\n node.children[0].cx == 0;\n for (let i = 1; i < node.children.length; i++) {\n node.children[i].cx = node.children[i - 1].cx + min_dist;\n }\n centerMap[node.id] = (node.children[0].cx + node.children[node.children.length - 1].cx) / 2;\n }\n }\n // console.log(centerMap);\n for (let node of orderedNodes) {\n // console.log(node.label);\n //Set the top y value\n node.cy = node.depth * 75 + 50;\n let leftSiblings = (node.parents[0] != undefined && node.parents[0].children[0] !== node);\n // console.log(leftSiblings);\n // console.log(centeredValue);\n if (!leftSiblings) {\n node.cx = centerMap[node.id];\n modMap[node.id] = 0;\n }\n else {\n node.cx = node.parents[0].children[node.parents[0].children.indexOf(node) - 1].cx + min_dist;\n modMap[node.id] = node.cx - centerMap[node.id];\n }\n }\n this.shiftChildrenByMod(root, 0, modMap);\n modMap = this.clearModMap(modMap);\n //dealing with conflicts, twice.\n // modMap = this.fixConflicts(root, orderedNodes, modMap);\n modMap = this.fixConflicts(root, orderedNodes, modMap);\n this.fixOffScreen(root, modMap);\n root.cx = (root.children[0].cx + root.children[root.children.length - 1].cx) / 2;\n }", "function restructure(root) {\n\n // Make sure root doesnt already have a position\n if (getComputedStyle(root).position != \"absolute\" || getComputedStyle(root).position != \"fixed\") {\n root.style.position = \"relative\";\n }\n\n let child = document.createElement('div');\n let dummy = document.createElement('div');\n\n child.classList.add(\"_SS_wrapper\");\n dummy.classList.add(\"_SS_dummy\");\n \n for (const e of root.children) {\n child.appendChild(e.cloneNode(true));\n }\n\n root.innerHTML = \"\";\n root.appendChild(child);\n root.appendChild(dummy);\n\n // Dummy Scroll element to allow overflow to appear\n dummy.style.height = child.scrollHeight + \"px\";\n dummy.style.width = child.scrollWidth + \"px\";\n dummy.style.top = \"0px\";\n dummy.style.left = \"0px\";\n dummy.style.position = \"absolute\";\n dummy.style.zIndex = \"-9999\";\n\n // Content inside the root element\n child.style.zIndex = \"1\";\n child.style.height = \"100%\";\n child.style.width = \"100%\";\n child.style.overflow = \"visible\";\n child.style.top = \"0px\";\n child.style.left = \"0px\";\n child.style.position = \"sticky\";\n\n return {\n fixed: root.querySelector(\"div._SS_wrapper\"),\n dummy: root.querySelector(\"div._SS_dummy\")\n };\n}", "initCompartments () {\n for (let key of this.keys) {\n this.compartment[key] = 0\n }\n this.calcExtraParams()\n this.initCompartmentsByParams()\n this.checkEvents()\n }", "function refreshChildComponents(hostLView, components) {\n for (var i = 0; i < components.length; i++) {\n refreshComponent(hostLView, components[i]);\n }\n }", "_tryToAddAllChildren(evt) {\n // If this element's elementInst isn't ready, halt and wait until later\n // If this event isn't coming from this element, do not handle\n const localEvt = Polymer.dom(evt);\n if (!this.elementInst || localEvt.rootTarget !== this) return;\n\n // If my own elementInst was just created, loop over children and try to attach them\n this._attachLayerChildren();\n }", "function updateRoot(event) {\n var context = event.context,\n oldRoot = context.oldRoot,\n children = oldRoot.children;\n\n forEach(children, function(child) {\n if (is$6(child, 'bpmn:BaseElement')) {\n self.updateParent(child);\n }\n });\n }", "configureComponents () {\n var self = this\n this.components = {}\n this.components.horizontal = {}\n this.components.vertical = {}\n\n // Layout component 'compositions'\n this.components.horizontal.dictionary =\n {\n margin1: ['margin.left'],\n tree: ['clustering.row.size', 'clustering.row.padding.right'],\n heatmap: ['heatmap.width'],\n labels: ['rowAxis.labels.padding.left', 'rowAxis.labels.width'],\n axis: ['rowAxis.title.padding.left', 'rowAxis.title.font.size'],\n margin2: ['margin.right']\n }\n this.components.vertical.dictionary =\n {\n margin1: ['margin.top'],\n title: ['title.font.size', 'title.padding.bottom'],\n tree: ['clustering.col.size', 'clustering.col.padding.bottom'],\n heatmap: ['heatmap.height'],\n labels: ['colAxis.labels.padding.top', 'colAxis.labels.height'],\n axis: ['colAxis.title.padding.top', 'colAxis.title.font.size'],\n margin2: ['margin.bottom']\n }\n\n var hKeys = Object.keys(this.components.horizontal.dictionary)\n var vKeys = Object.keys(this.components.vertical.dictionary)\n\n // Build map so that values can be stored sequentially in array -- should be faster look up?\n this.components.horizontal.map = {}\n this.components.vertical.map = {}\n var _ = require('lodash')\n\n // Calculate default component size values\n this.components.horizontal.values = []\n this.components.vertical.values = []\n for (let x = 0, l = hKeys.length; x < l; x++) {\n let key = hKeys[x]\n let arr = this.components.horizontal.dictionary[key]\n var htot = 0\n arr.forEach(subComp => {\n htot = htot + _.get(self.appearance, subComp)\n })\n this.components.horizontal.map[key] = x\n this.components.horizontal.values[x] = htot\n }\n for (let y = 0, l = vKeys.length; y < l; y++) {\n let key = vKeys[y]\n let arr = this.components.vertical.dictionary[key]\n var vtot = 0\n arr.forEach(subComp => { vtot += _.get(self.appearance, subComp) })\n this.components.vertical.map[key] = y\n this.components.vertical.values[y] = vtot\n }\n }", "UNSAFE_componentWillMount() {\n this.createRelationships(() => {\n //populate global template cache with designer templates.\n this.populateTemplateCache();\n const nodes = this.engine.getDiagramModel().getNodes();\n const main = nodes[Object.keys(nodes)[0]];\n //rehydrate everything based on value.\n\n if (\n this.rehydrate(\n this.props.args.main.name,\n this.props.value,\n main,\n main\n )\n ) {\n this.refreshGraph(true);\n }\n });\n }", "async function fetchComponents() {\r\n let componentsArray = document.getElementsByTagName(\"component\");\r\n for (let i = 0; i < componentsArray.length; i++) {\r\n node = componentsArray[i];\r\n componentKey = node.getAttribute(\"html\");\r\n if (componentKey) {\r\n if (CACHE_COMPONENTS.get(componentKey)) {\r\n renderComponent(node, CACHE_COMPONENTS.get(componentKey), !INITIAL_RENDER_COMPONENT)\r\n //recursion to fetch any inner components\r\n fetchComponents();\r\n continue;\r\n }\r\n\r\n try {\r\n let response = await fetch(componentKey);\r\n let component = await response.text();\r\n renderComponent(node, component, INITIAL_RENDER_COMPONENT);\r\n CACHE_COMPONENTS.set(componentKey, component)\r\n //recursion to fetch any inner components\r\n fetchComponents();\r\n } catch (err) {\r\n renderComponent(node, \"Component not found\", INITIAL_RENDER_COMPONENT)\r\n }\r\n return;\r\n }\r\n }\r\n\r\n}", "_restoreOriginalChildNodes() {\n // Add the original nodes back in\n this.properties.originalChildNodes.forEach(item => this.nodes.content.appendChild(item));\n // Remove this stale array\n delete this.properties.originalChildNodes;\n\n // Make sure that any nodes with a layer-id are properly linked in the parent component\n // Note that onReplaceableContentAdded() will not get called to add these the way it is\n // called for any replaceable content that is inserted\n this._findNodesWithin(this, (node, isComponent) => {\n const layerId = node.getAttribute && node.getAttribute('layer-id');\n if (layerId) this.parentComponent.nodes[layerId] = node;\n\n // If its a UI Component and not some generic DOM node, setup the originalChildNode's parentComponent pointer as well\n if (isComponent) {\n if (!node.properties) node.properties = {};\n node.properties.parentComponent = this.parentComponent;\n }\n });\n }", "_initialiseContentElements() {\n this.contentElements.forEach((contentElement, index) => {\n this._initialiseContentElement(contentElement, index)\n })\n }", "_setInitialValues() {\n const that = this;\n\n that._autoScrollCoefficient = JQX.Utilities.Core.Browser.Firefox ? 4 : JQX.Utilities.Core.Browser.Edge ? 8 : 2;\n that._isMobile = JQX.Utilities.Core.isMobile;\n\n that._manuallyAddedFields = [];\n that._localizeInitialValues();\n that.$.conditionsMenu.dropDownAppendTo = that.$.container;\n that.$.conditionsMenu.dataSource = that._groupOperationDescriptions;\n\n that._valueFlat = [];\n that._lastProcessedItemInCurrentGroup = { parentId: null, id: null, position: null };\n }", "function setupComponents() {\n\tplanComponents= {\n\t\t\twalls: [],\n\t\t\tfornitures: []\n\t}\n}", "renderChildrenOnly() {\n this.children.forEach(child => child.render(this.$element));\n }", "onLoadChildren() {\n this.btnRemove.enabled = this.btnEdit.enabled = false;\n this.children.clear();\n if (this._loadChildren) {\n this._loadChildren.raise();\n }\n }", "onLoadChildren() {\n this.btnRemove.enabled = this.btnEdit.enabled = false;\n this.children.clear();\n if (this._loadChildren) {\n this._loadChildren.raise();\n }\n }", "function resolveComponentInfo(data) {\n return checkChildren(data);\n}", "_reload() {\n const { uiKey, rootNodes } = this.props;\n //\n this.context.store.dispatch(this.dataManager.receiveData(uiKey, new Immutable.Map({})));\n if (!rootNodes || rootNodes.length === 0) {\n return;\n }\n rootNodes.forEach(rootNode => {\n if (!rootNode.isMoreLink && !this._isLeaf(rootNode) && rootNode.toggled) {\n this._onToggle(rootNode, rootNode.toggled);\n }\n });\n }", "components(val) {\n this._components = val;\n return this;\n }" ]
[ "0.62108815", "0.58060336", "0.57099515", "0.56549805", "0.56515664", "0.5571322", "0.55660146", "0.5564142", "0.5564142", "0.5564142", "0.55287457", "0.55287457", "0.55287457", "0.55287457", "0.552058", "0.5475587", "0.54582614", "0.54200685", "0.541754", "0.5384058", "0.5357367", "0.5333249", "0.53037727", "0.52992624", "0.52992624", "0.52992624", "0.52992624", "0.52961445", "0.52961445", "0.52961445", "0.5273755", "0.5273755", "0.52625203", "0.52625203", "0.52625203", "0.52625203", "0.52498853", "0.5245731", "0.52453285", "0.5229316", "0.522759", "0.5226864", "0.52222854", "0.52222854", "0.52222854", "0.52168393", "0.5201062", "0.5199144", "0.5191412", "0.5128254", "0.5122795", "0.5122373", "0.5121097", "0.51125365", "0.5107322", "0.510541", "0.509724", "0.50940573", "0.5090676", "0.508663", "0.5082103", "0.5076839", "0.5076037", "0.5074605", "0.5068553", "0.50533056", "0.5046379", "0.5041593", "0.5039569", "0.50362724", "0.5033376", "0.5031181", "0.50118023", "0.50015056", "0.49897945", "0.4985126", "0.49820074", "0.4976916", "0.49766657", "0.4975342", "0.49749023", "0.49702665", "0.49632943", "0.49615926", "0.4953861", "0.49502018", "0.49421093", "0.49387905", "0.49370763", "0.4932702", "0.49261954", "0.49214596", "0.4920828", "0.49191424", "0.491708", "0.4912097", "0.4912097", "0.49067646", "0.49040678", "0.4902891" ]
0.510265
56
Get random red herrings roots and mix them with the roots of the word to display n possible options
randomChoices(wordParts, roots) { let wordRoots = _.filter(wordParts, (c) => c.type === 'root' && c.valueUnsolved.includes('_')) wordRoots = _.map(wordRoots, (root) => ({ 'value': root.valueSolved, 'definition': root.definition, 'isAnswer': 'true' })); let choices = _.nRandom(_.toArray(roots), this.state.choiceCount * 2); choices = _.reject(choices, (root) => _.contains(_.pluck(wordRoots, 'value').concat(this.state.solvedRoots), root.value)); choices = choices.slice(0, this.state.choiceCount - wordRoots.length).concat(wordRoots); return _.shuffle(choices) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "makeText(numWords = 100) {\n let chains = this.makeChains(); // MM object\n \n // first word to start chaining\n let key_words = Object.keys(chains); // array of key-words in MM object to choose from\n let key_num = key_words.length; // number of words to choose from\n let key_ind = Math.floor(Math.random()*key_num); // random index in key_words array\n let curr_word = key_words[key_ind]; //current word \n let resultText = curr_word; \n for (let i = 2; i <= numWords; i++) {\n let next_word_ind = Math.floor(Math.random()*chains[curr_word].length);\n let next_word = chains[curr_word][next_word_ind];\n if (next_word) {\n resultText = [resultText, next_word].join(' ');\n curr_word = next_word; \n }\n else {\n return resultText; \n }\n }\n return resultText; \n }", "function getRandomWord() {\n // array taken from https://gist.github.com/borlaym/585e2e09dd6abd9b0d0a\n wordList = [\n \"Aardvark\",\n \"Albatross\",\n \"Alligator\",\n \"Alpaca\",\n \"Ant\",\n \"Anteater\",\n \"Antelope\",\n \"Ape\",\n \"Armadillo\",\n \"Donkey\",\n \"Baboon\",\n \"Badger\",\n \"Barracuda\",\n \"Bat\",\n \"Bear\",\n \"Beaver\",\n \"Bee\",\n \"Bison\",\n \"Boar\",\n \"Buffalo\",\n \"Butterfly\",\n \"Camel\",\n \"Capybara\",\n \"Caribou\",\n \"Cassowary\",\n \"Cat\",\n \"Caterpillar\",\n \"Cattle\",\n \"Chamois\",\n \"Cheetah\",\n \"Chicken\",\n \"Chimpanzee\",\n \"Chinchilla\",\n \"Chough\",\n \"Clam\",\n \"Cobra\",\n \"Cockroach\",\n \"Cod\",\n \"Cormorant\",\n \"Coyote\",\n \"Crab\",\n \"Crane\",\n \"Crocodile\",\n \"Crow\",\n \"Curlew\",\n \"Deer\",\n \"Dinosaur\",\n \"Dog\",\n \"Dogfish\",\n \"Dolphin\",\n \"Dotterel\",\n \"Dove\",\n \"Dragonfly\",\n \"Duck\",\n \"Dugong\",\n \"Dunlin\",\n \"Eagle\",\n \"Echidna\",\n \"Eel\",\n \"Eland\",\n \"Elephant\",\n \"Elk\",\n \"Emu\",\n \"Falcon\",\n \"Ferret\",\n \"Finch\",\n \"Fish\",\n \"Flamingo\",\n \"Fly\",\n \"Fox\",\n \"Frog\",\n \"Gaur\",\n \"Gazelle\",\n \"Gerbil\",\n \"Giraffe\",\n \"Gnat\",\n \"Gnu\",\n \"Goat\",\n \"Goldfinch\",\n \"Goldfish\",\n \"Goose\",\n \"Gorilla\",\n \"Goshawk\",\n \"Grasshopper\",\n \"Grouse\",\n \"Guanaco\",\n \"Gull\",\n \"Hamster\",\n \"Hare\",\n \"Hawk\",\n \"Hedgehog\",\n \"Heron\",\n \"Herring\",\n \"Hippopotamus\",\n \"Hornet\",\n \"Horse\",\n \"Human\",\n \"Hummingbird\",\n \"Hyena\",\n \"Ibex\",\n \"Ibis\",\n \"Jackal\",\n \"Jaguar\",\n \"Jay\",\n \"Jellyfish\",\n \"Kangaroo\",\n \"Kingfisher\",\n \"Koala\",\n \"Kookabura\",\n \"Kouprey\",\n \"Kudu\",\n \"Lapwing\",\n \"Lark\",\n \"Lemur\",\n \"Leopard\",\n \"Lion\",\n \"Llama\",\n \"Lobster\",\n \"Locust\",\n \"Loris\",\n \"Louse\",\n \"Lyrebird\",\n \"Magpie\",\n \"Mallard\",\n \"Manatee\",\n \"Mandrill\",\n \"Mantis\",\n \"Marten\",\n \"Meerkat\",\n \"Mink\",\n \"Mole\",\n \"Mongoose\",\n \"Monkey\",\n \"Moose\",\n \"Mosquito\",\n \"Mouse\",\n \"Mule\",\n \"Narwhal\",\n \"Newt\",\n \"Nightingale\",\n \"Octopus\",\n \"Okapi\",\n \"Opossum\",\n \"Oryx\",\n \"Ostrich\",\n \"Otter\",\n \"Owl\",\n \"Oyster\",\n \"Panther\",\n \"Parrot\",\n \"Partridge\",\n \"Peafowl\",\n \"Pelican\",\n \"Penguin\",\n \"Pheasant\",\n \"Pig\",\n \"Pigeon\",\n \"Pony\",\n \"Porcupine\",\n \"Porpoise\",\n \"Quail\",\n \"Quelea\",\n \"Quetzal\",\n \"Rabbit\",\n \"Raccoon\",\n \"Rail\",\n \"Ram\",\n \"Rat\",\n \"Raven\",\n \"Red deer\",\n \"Red panda\",\n \"Reindeer\",\n \"Rhinoceros\",\n \"Rook\",\n \"Salamander\",\n \"Salmon\",\n \"Sand Dollar\",\n \"Sandpiper\",\n \"Sardine\",\n \"Scorpion\",\n \"Seahorse\",\n \"Seal\",\n \"Shark\",\n \"Sheep\",\n \"Shrew\",\n \"Skunk\",\n \"Snail\",\n \"Snake\",\n \"Sparrow\",\n \"Spider\",\n \"Spoonbill\",\n \"Squid\",\n \"Squirrel\",\n \"Starling\",\n \"Stingray\",\n \"Stinkbug\",\n \"Stork\",\n \"Swallow\",\n \"Swan\",\n \"Tapir\",\n \"Tarsier\",\n \"Termite\",\n \"Tiger\",\n \"Toad\",\n \"Trout\",\n \"Turkey\",\n \"Turtle\",\n \"Viper\",\n \"Vulture\",\n \"Wallaby\",\n \"Walrus\",\n \"Wasp\",\n \"Weasel\",\n \"Whale\",\n \"Wildcat\",\n \"Wolf\",\n \"Wolverine\",\n \"Wombat\",\n \"Woodcock\",\n \"Woodpecker\",\n \"Worm\",\n \"Wren\",\n \"Yak\",\n \"Zebra\"\n ];\n\n var x = Math.floor((Math.random() * wordList.length));\n return wordList[x].toUpperCase();\n }", "function generateSolution() {\n for (let i = 0; i < 4; i++) {\n const randomIndex = getRandomInt(0, letters.length);\n solution += letters[randomIndex];\n }\n return solution;\n }", "function randomize (){\n\tvar random = Math.floor(Math.random()*4);\n\treturn ligth(random);\n}", "makeText(numWords = 100) {\n\n function getRandomElement(array) {\n // Pick a random element form the array\n return array[Math.floor(Math.random() * array.length)];\n }\n\n function getRandomKey(obj) {\n // Return randomly select key from the array of keys\n return getRandomElement(Object.keys(obj))\n }\n\n const wordChain = this.makeChains(); // get a static instance of the word chain\n // console.log(wordChain);\n const wordArray = []; // the array that will be returned\n for(let i = 0; i < numWords; i++) {\n if(wordArray.length === 0) {\n wordArray.push(getRandomKey(wordChain));\n // console.log('first word in array: ', wordArray);\n } else {\n const lastWord = wordArray[wordArray.length - 1];\n // console.log(lastWord);\n const chainValue = wordChain[lastWord];\n // console.log(chainValue);\n const selectedWord = getRandomElement(chainValue);\n \n if(!selectedWord) {\n return wordArray.join(' ');\n }\n wordArray.push(selectedWord);\n }\n }\n\n return wordArray.join(' ');\n }", "function ransomdomize() {\n if (hangWords.length === 1) {\n addBack();\n }\n randomNum = Math.floor(Math.random() * hangWords.length);\n chosenWord = hangWords[randomNum].name.toLocaleUpperCase();\n chosenImg = hangWords[randomNum].image;\n flatArr();\n removeWord(randomNum);\n}", "getText(numWords = 100) {\n let outputText = [];\n \n let keys = Array.from(Object.keys(this.markovChains));\n let keyWord = MarkovMachine.randomlyPickElementNotNull(keys);\n\n while (numWords > 0) {\n let wordChoices = this.markovChains[keyWord];\n let nextWord = MarkovMachine.randomlyPickElement(wordChoices);\n\n if (nextWord === null) {\n outputText.push(`${keyWord}.`);\n keyWord = MarkovMachine.randomlyPickElementNotNull(keys);\n\n } else {\n outputText.push(keyWord);\n keyWord = nextWord;\n\n }\n\n numWords--;\n }\n\n let returnedText = outputText.join(\" \");\n return returnedText;\n\n }", "makeText(numWords = 100) {\n let words = Object.keys(this.chains);\n\n let capWords = words.filter(word => word[0] === word[0].toUpperCase());\n let text = this.randomPick(capWords);\n let firstWord = text;\n let nextWord = this.singleChain(firstWord);\n\n for (let i=1; i < numWords - 1; i++) {\n text += \" \";\n let bigram = `${firstWord} ${nextWord}`;\n firstWord = nextWord;\n if (this.bigrams[bigram]) {\n let pick = this.randomPick(this.bigrams[bigram]);\n nextWord = pick ? pick : this.randomPick(words);\n } else {\n nextWord = this.singleChain(firstWord);\n }\n text += nextWord;\n }\n return text;\n }", "randomTrie(num) {\n\t\tif (num > 993) num = 993\n\t\tlet allWords = words['words']\n\t\tlet upper = 0\n\t\tlet lower = num * 2 + 10\n\t\tlet elements = new Set()\n\t\tfor (let i = 0; i < num; i++) {\n\t\t\tlet value =\n\t\t\t\tMath.floor(Math.random() * (upper - lower + 1)) + lower\n\t\t\twhile (elements.has(value) || value > 993) {\n\t\t\t\tvalue =\n\t\t\t\t\tMath.floor(Math.random() * (upper - lower + 1)) + lower\n\t\t\t}\n\t\t\telements.add(value)\n\t\t\tthis.insert(allWords[value])\n\t\t}\n\t}", "makeText(numWords = 100) {\n // TODO\n const keys = Object.keys(this.chains)\n let text = ''\n let prevWord;\n for(let i = 0; i <= numWords; i++){\n if(prevWord === undefined){\n let ranKey = keys[Math.floor(Math.random() * keys.length)]\n let ranWord = this.chains[ranKey][Math.floor(Math.random() * this.chains[ranKey].length)]\n if(ranWord !== undefined){\n text = text+ranWord+' '\n prevWord = ranWord\n }\n }else{\n let ranWord = this.chains[prevWord][Math.floor(Math.random() * this.chains[prevWord].length)]\n if(ranWord !== undefined){\n text = text+ranWord+' '\n prevWord = ranWord;\n }else{\n break\n }\n }\n }\n return text.trim();\n }", "function rndWord() {\n counter ++;\n if (correctCount == words.length) {\n showDone();\n return;\n }\n word = undefined;\n while (!word || word.learned) {\n word = words[Math.floor(Math.random() * words.length)];\n }\n showWord();\n}", "makeText(numWords = 100) {\n let numWordsArr = []\n if (this.chain === undefined) {\n return \"\"\n }\n const Keys = Object.keys(this.chain)\n while (numWordsArr.length < numWords) {\n let randomKey = Keys[Math.floor(Math.random() * Keys.length)]\n let randomWord = this.chain[randomKey][Math.floor(Math.random() * this.chain[randomKey].length)]\n if (randomWord !== null) {\n numWordsArr.push(randomWord)\n }\n }\n return numWordsArr.join(' ')\n }", "function random_word(){\n var n = 4 + Math.floor(Math.random() * 6);\n return random_text(n);\n }", "function getRandomPositions() {\n\tlet longStr = '';\n\tfor(let i = 0; i < 30; i++) {\n\t\tconst x = getRandomInt(); const y = getRandomInt();\n\t\tif(longStr.match(new RegExp(`\\/${y}-${x}\\/`)) !== null) {\n\t\t\ti = i - 1;\n\t\t} else {\n\t\t\tlongStr += `/${y}-${x}/`\n\t\t}\n\t}\n\treturn longStr;\n}", "function get2x2optscramble(mn) {\n var e = [15, 16, 16, 21, 21, 15, 13, 9, 9, 17, 17, 13, 14, 20, 20, 4, 4, 14, 12, 5, 5, 8, 8, 12, 3, 23, 23, 18, 18, 3, 1, 19, 19, 11, 11, 1, 2, 6, 6, 22, 22, 2, 0, 10, 10, 7, 7, 0], d = [\n [],\n [],\n [],\n [],\n [],\n []\n ], v = [\n [0, 2, 3, 1, 23, 19, 10, 6, 22, 18, 11, 7],\n [4, 6, 7, 5, 12, 20, 2, 10, 14, 22, 0, 8],\n [8, 10, 11, 9, 12, 7, 1, 17, 13, 5, 0, 19],\n [12, 13, 15, 14, 8, 17, 21, 4, 9, 16, 20, 5],\n [16, 17, 19, 18, 15, 9, 1, 23, 13, 11, 3, 21],\n [20, 21, 23, 22, 14, 16, 3, 6, 15, 18, 2, 4]\n ], r = [], a = [], b = [], c = [], f = [], s = [];\n\n function t() {\n s = [1, 1, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 0, 0, 0, 0]\n }\n\n t();\n function mx() {\n t();\n for (var i = 0; i < 500; i++)dm(Math.floor(Math.random() * 3 + 3) + 16 * Math.floor(Math.random() * 3))\n }\n\n function cj() {\n var i, j;\n for (i = 0; i < 6; i++)for (j = 0; j < 6; j++)d[i][j] = 0;\n for (i = 0; i < 48; i += 2)if (s[e[i]] <= 5 && s[e[i + 1]] <= 5)d[s[e[i]]][s[e[i + 1]]]++\n }\n\n function dm(m) {\n var j = 1 + (m >> 4), k = m & 15, i;\n while (j) {\n for (i = 0; i < v[k].length; i += 4)y(s, v[k][i], v[k][i + 3], v[k][i + 2], v[k][i + 1]);\n j--\n }\n }\n\n function sv() {\n cj();\n var h = [], w = [], i = 0, j, k, m;\n for (j = 0; j < 7; j++) {\n m = 0;\n for (k = i; k < i + 6; k += 2) {\n if (s[e[k]] == s[e[42]])m += 4;\n if (s[e[k]] == s[e[44]])m += 1;\n if (s[e[k]] == s[e[46]])m += 2\n }\n h[j] = m;\n if (s[e[i]] == s[e[42]] || s[e[i]] == 5 - s[e[42]])w[j] = 0; else if (s[e[i + 2]] == s[e[42]] || s[e[i + 2]] == 5 - s[e[42]])w[j] = 1; else w[j] = 2;\n i += 6\n }\n m = 0;\n for (i = 0; i < 7; i++) {\n j = 0;\n for (k = 0; k < 7; k++) {\n if (h[k] == i)break;\n if (h[k] > i)j++\n }\n m = m * (7 - i) + j\n }\n j = 0;\n for (i = 5; i >= 0; i--)j = j * 3 + w[i] - 3 * Math.floor(w[i] / 3);\n if (m != 0 || j != 0) {\n r.length = 0;\n for (k = mn; k < 99; k++)if (se(0, m, j, k, -1))break;\n j = \"\";\n for (m = 0; m < r.length; m++)j = \"URF\".charAt(r[m] / 10) + \"\\'2 \".charAt(r[m] % 10) + \" \" + j;\n return j\n }\n }\n\n function se(i, j, k, l, m) {\n if (l != 0) {\n if (a[j] > l || b[k] > l)return false;\n var o, p, q, n;\n for (n = 0; n < 3; n++)if (n != m) {\n o = j;\n p = k;\n for (q = 0; q < 3; q++) {\n o = c[o][n];\n p = f[p][n];\n r[i] = 10 * n + q;\n if (se(i + 1, o, p, l - 1, n))return true\n }\n }\n } else if (j == 0 && k == 0)return true;\n return false\n }\n\n function z() {\n var i, j, k, m, n;\n for (i = 0; i < 5040; i++) {\n a[i] = -1;\n c[i] = [];\n for (j = 0; j < 3; j++)c[i][j] = g(i, j)\n }\n a[0] = 0;\n for (i = 0; i <= 6; i++)for (j = 0; j < 5040; j++)if (a[j] == i)for (k = 0; k < 3; k++) {\n m = j;\n for (n = 0; n < 3; n++) {\n var m = c[m][k];\n if (a[m] == -1)a[m] = i + 1\n }\n }\n for (i = 0; i < 729; i++) {\n b[i] = -1;\n f[i] = [];\n for (j = 0; j < 3; j++)f[i][j] = w(i, j)\n }\n b[0] = 0;\n for (i = 0; i <= 5; i++)for (j = 0; j < 729; j++)if (b[j] == i)for (k = 0; k < 3; k++) {\n m = j;\n for (n = 0; n < 3; n++) {\n var m = f[m][k];\n if (b[m] == -1)b[m] = i + 1\n }\n }\n }\n\n function g(i, j) {\n var k, m, n, o = i, h = [];\n for (k = 1; k <= 7; k++) {\n m = o % k;\n o = (o - m) / k;\n for (n = k - 1; n >= m; n--)h[n + 1] = h[n];\n h[m] = 7 - k\n }\n if (j == 0)y(h, 0, 1, 3, 2); else if (j == 1)y(h, 0, 4, 5, 1); else if (j == 2)y(h, 0, 2, 6, 4);\n o = 0;\n for (k = 0; k < 7; k++) {\n m = 0;\n for (n = 0; n < 7; n++) {\n if (h[n] == k)break;\n if (h[n] > k)m++\n }\n o = o * (7 - k) + m\n }\n return o\n }\n\n function w(i, j) {\n var k, m, n, o = 0, p = i, h = [];\n for (k = 0; k <= 5; k++) {\n n = Math.floor(p / 3);\n m = p - 3 * n;\n p = n;\n h[k] = m;\n o -= m;\n if (o < 0)o += 3\n }\n h[6] = o;\n if (j == 0)y(h, 0, 1, 3, 2); else if (j == 1) {\n y(h, 0, 4, 5, 1);\n h[0] += 2;\n h[1]++;\n h[5] += 2;\n h[4]++\n } else if (j == 2) {\n y(h, 0, 2, 6, 4);\n h[2] += 2;\n h[0]++;\n h[4] += 2;\n h[6]++\n }\n p = 0;\n for (k = 5; k >= 0; k--)p = p * 3 + (h[k] % 3);\n return p\n }\n\n function y(i, j, k, m, n) {\n var o = i[j];\n i[j] = i[k];\n i[k] = i[m];\n i[m] = i[n];\n i[n] = o\n }\n\n z();\n for (var i = 0; i < num; i++) {\n mx();\n ss[i] += sv();\n }\n}", "makeText(numWords = 50) {\n let newText = \"\";\n // initially word will be a random word from words arr\n let word = this.words[Math.floor(Math.random() * this.words.length)]\n newText = newText + word + \" \";\n for (let i=0; i<numWords; i++) {\n if (this.chains[word][0] == null) {\n return newText;\n } else {\n word = this.chains[word][Math.floor(Math.random() * this.chains[word].length)]\n newText = newText + word + \" \";\n }\n }\n\n return newText;\n }", "makeText(numWords = 100) {\n // TODO\n\n let chainObj = this.makeChains();\n let randomStarIdx = Math.floor(Math.random() * this.words.length);\n let randomStartWord = this.words[randomStarIdx];\n let text = [randomStartWord];\n\n for (let i = 0; i < numWords - 1; i++) {\n let value = chainObj[text[i]]\n\n if (value[0] === null) {\n return text.join(' ');\n }\n if (value.length === 1) {\n text.push(value);\n } else {\n let randomIdx = Math.floor(Math.random() * value.length);\n let randomWord = value[randomIdx];\n text.push(randomWord);\n }\n }\n\n return text.join(' ');\n }", "function getSearchSeed() {\n if(randomWords.length === 0 && !isPopulating) {\n populateRandomWords();\n }\n\n algo = Math.floor(Math.random() * 9) + 1;\n if(algo === 1) {\n return nonsenseWord();\n } else if(algo === 2) {\n return nonsenseChinesePhrase();\n } else if(algo === 3) {\n return nonsenseJapanesePhrase();\n } else if(algo === 4) {\n return nonsenseCyrillic();\n } else if(algo === 5) {\n return randomCharacters();\n } else if(algo === 6) {\n return nonsenseHangul();\n } else if(algo === 7) {\n return nonsenseArabic();\n } else if(algo === 8) {\n return nonsenseLatin();\n } else if (algo === 9) {\n if(randomWords.length === 0) {\n return nonsenseLatin();\n } else {\n var word = randomWords.pop();\n return word;\n }\n }\n}", "function randomStyle() {\n\n // this will return the randomly created choice; eventually will be a JSON object\n // but for now is just a string variable\n var choice = \"\",\n tie = false,\n vest = false,\n neatCollars = false;\n\n // the basis for deciding on an outfit, which is based on me originally rolling a d20\n if (randomNumber(1, 20) <= 7) {\n // if it's less than 9, it's a casual day, dressy otherwise\n choice = \"Casual\";\n } else { // 8 or above\n choice += \"Dress shirt\";\n\n // now we see about other acoutrements\n\n // crisp and traditional, or sloppy and fashion forward?\n if (randomNumber(1, 10) >= 8) {\n choice += \", neat collars\";\n neatCollars = true;\n } else { // 7 or less\n choice += \", sloppy collars\";\n }\n\n // how about a vest?\n if (randomNumber(1, 20) >= 8) {\n choice += \", vest\";\n vest = true;\n }\n\n // wearing a tie today?\n if (randomNumber(1, 20) >= 6) {\n choice += \", tie\";\n try {\n choice += \" (\";\n\n // k, handsome, but what kind of knot? how baller we gonna be?\n if (neatCollars) {\n\n // clean and trim, huh? we also wearing a vest?\n if (vest) {\n\n // baller! we can be fancy or even super fancy!\n if (randomNumber(1, 20) >= 8) {\n choice += chooseKnot(fancyKnots);\n } else { // 7 or less\n choice += chooseKnot(extraFancyKnots);\n }\n } else {\n\n // still cool, we can be still fancy sometimes\n if (randomNumber(1, 10) >= 4) {\n choice += chooseKnot(everydayKnots);\n } else { // 3 or less\n choice += chooseKnot(fancyKnots);\n }\n }\n\n } else {\n // if we're doin' sloppy collars, don't get too crazy with it\n choice += chooseKnot(everydayKnots);\n }\n choice += \" knot)\";\n\n } catch (e) {\n console.log(e.message);\n }\n }\n }\n\n return choice;\n}", "function randWord(){\n var a = 'abtchyplwwah'; \n var b = 'aeyuioee';\n var c = 'eetleouiynmcc'\n var d = 'mnbceeytplttk';\n var w = [a,b,c,d];\n var str = '';\n for(var i=0; i++; i<4)\n {\n var n = (w[i][Math.floor(Math.random() * w[i].length)]);\n n = n || 'e';\n str += n;\n }\n\n }", "getText(numWords = 100) {\n console.log(\"getText ran\");\n // 1. randomly select a word from this.words\n // 2. append it to this.text\n // 3. find the selected word in this.chains\n // 4. randomly select a word from this.chains[word]\n // 5. repeat steps 2-4\n\n let randomIdx = Math.floor(Math.random() * this.words.length)\n let randomWord = this.words[randomIdx];\n\n let nextWord = randomWord;\n\n for (let i=0; i<numWords && nextWord !== null; i++) {\n console.log(\"inside for loop, nextWord is:\", nextWord, nextWord === null);\n this.text += nextWord + \" \";\n nextWord = this.getNextWord(nextWord)\n }\n\n // let count = 0;\n // while (nextWord !== null && count <= numWords) {\n // console.log(\"inside while loop, nextWord is:\", nextWord, nextWord === null);\n // this.text += nextWord + \" \";\n // nextWord = this.getNextWord(nextWord)\n // count++;\n // }\n\n console.log(\"this is the result:\", this.text);\n }", "makeText(numWords = 100) {\n const startWordIndex = Math.floor(Math.random() * Object.keys(this.startChains).length);\n let prevWord = Object.keys(this.startChains)[startWordIndex];\n let randomText = prevWord;\n\n for (let i = 1; i < numWords; i++) {\n const nextRandom = Math.floor(Math.random() * this.chains[prevWord].length);\n const nextWord = this.chains[prevWord][nextRandom];\n randomText += ' ';\n if (nextWord) {\n randomText += nextWord.toLowerCase();\n prevWord = nextWord;\n } else {\n randomText += this.makeText(numWords - i);\n break;\n }\n }\n if (prevWord.charAt(prevWord.length - 1) === ',') {\n randomText = randomText.slice(0, randomText.length - 1)\n }\n if (!END_PUNCTUATION.includes(prevWord.charAt(prevWord.length - 1))) {\n randomText += '.'\n }\n return randomText.trim()\n }", "function randomCornyJokes(){\n\tvar rand = Math.floor(Math.random()*5 + 1); //I've only got 5 jokes on hand for now!\n\n\tswitch(rand){\n\t\tcase 1:\n\t\t\treturn (\n\t\t\t\t`Q: How do you comfort a JavaScript bug?\\n\n\t\t\t\tA: You console it.`);\n\t\tcase 2:\n\t\t\treturn (\n\t\t\t\t`Q: Why was the JavaScript developer sad?\\n \n\t\t\t\tA: Because he didn't Node how to Express himself.`);\n\t\tcase 3:\n\t\t\treturn (\n\t\t\t\t`So a programming language walks into a bar and says \"Hello world\"`);\n\t\tcase 4: //unrelated non-programming joke. Mixing in some diversity! Plus this just makes me chuckle and chortle.\n\t\t\treturn (\n\t\t\t\t`Q: Why did the chef kill himself? \\n\n\t\t\t\tA: Because he lost the huile d'olive!`);\n\t\tdefault:\n\t\t\treturn (\n\t\t\t\t`To understand what recursion is, you must first understand recursion.`);\n\n\t}\n\n}", "function chooseSolution(){\n\t\tvar choice = Math.floor(Math.random() * wordList.length);\n\t\tsolution = wordList[choice].toLowerCase();\n\t\tsolution = solution.split(\"\");\n\t\tsolutionDisplay=[];\n\t\tfor (var i = 0; i < solution.length; i++) {\n\t\t\tsolutionDisplay.push(\"_\");\n\t\t}\n\t}", "function randomizeLine(num){\n var result = \"\";\n while (num > 0){\n var j = Math.round(Math.random() * (num - 1) + 1);\n var randomWord = getRandomWord(j);\n result += randomWord + \" \";\n num -= j;\n }\n\n return result;\n}", "makeText(numWords = 100) {\n\n let chain = this.makeChains();\n let story = [];\n let keyArray = Object.keys(chain);\n\n let randomNumber = this.getRandNum(keyArray.length);\n story.push(keyArray[randomNumber]);\n\n for(let i = 0; i < numWords-1; i++){\n let randIndex = this.getRandNum(chain[story[i]].length);\n if(chain[story[i]][randIndex] === null){\n break;\n }\n else{\n story.push(chain[story[i]][randIndex]);\n }\n }\n return story.join(' ');\n\n }", "makeText(numWords = 100) {\n let keys = Object.keys(this.chains);\n let key = keys[Math.floor(Math.random() * Math.floor(keys.length))];\n let textArray = [];\n\n while (textArray.length < numWords && key !== null) {\n textArray.push(key);\n key = this.chains[key][\n Math.floor(Math.random() * Math.floor(this.chains[key].length))\n ];\n }\n return textArray.join(\" \");\n }", "getText(numWords = 100) {\n // MORE CODE HERE\n let textArr = [];\n let wordChoice = Array.from(this.words);\n let word = this.getRandomElement(wordChoice)\n \n \n while (textArr.length < numWords && word !== null){\n textArr.push(word)\n\n let nextWord = this.getRandomElement(this.chain.get(word))\n //append to textarr the newly defined word\n word = nextWord\n\n }\n return textArr.join(\" \");\n }", "function genAnswers() {\r\n let currentWord = []; // current word to add to grid\r\n let starts = []; // [x, y] coordinates of the starting point for a word\r\n let dir; // current direction, -1 for diag, 0 for horiz, 1 for vert\r\n\r\n for (let i in words) {\r\n // generate a new random direction\r\n dir = (Math.floor(Math.random() * 3) - 1) % 2\r\n\r\n currentWord = words[i].toUpperCase().replace(/\\s+/g, \"\").split(\"\"); // convert word to char array\r\n console.log(currentWord);\r\n\r\n // randomly reverse words\r\n if (Math.floor(Math.random() * 2) === 1)\r\n currentWord = currentWord.reverse();\r\n\r\n // find a valid starting place\r\n starts = getValidStart(currentWord.length, dir);\r\n\r\n // log starting place\r\n if (LOG_ANSWERS)\r\n console.log(words[i] + \": at (\" + starts[0] + \", \" + starts[1] + \")\");\r\n\r\n // place word in grid\r\n for (let j in currentWord) {\r\n grid[starts[1]][starts[0]] = currentWord[j];\r\n taken[starts[1]][starts[0]] = true;\r\n starts[1] += dir;\r\n if (dir <= 0) {\r\n starts[0]++;\r\n }\r\n }\r\n }\r\n}", "makeText(numWords = 100) {\n const numWordsAv = Object.keys(this.chains).length;\n let randNum, text;\n do {\n randNum = Math.floor(Math.random() * numWordsAv);\n text = [Object.keys(this.chains)[randNum]];\n } while (text[0] === text[0].toLowerCase())\n\n if (text[0].slice(-1) === '.') {\n return text.toString();\n }\n \n for (let i = 0; i < numWords - 1; i++) {\n let randNum = Math.floor(Math.random() * this.chains[text[i]].length);\n if (this.chains[text[i]][randNum] === null ) {\n break;\n } else {\n text.push(this.chains[text[i]][randNum])\n if (this.chains[text[i]][randNum].slice(-1) ==='.') break;\n }\n }\n return text.join(\" \")\n }", "function eligefrase() {\n\tvar cual;\n\tdo {\n\t\tcual = Math.floor((Math.random() * frases_array.length));\n\t} while (cual === num_frase_anterior);\n\tnum_frase_anterior = cual;\n\treturn frases_array[cual];\n}", "function rAiNbOw(str) {\n let retStr = ``;\n for (let i = 0; i < str.length; i++) {\n let check = Math.floor(Math.random()*6);\n switch(check) {\n case 0:\n retStr += `${chalk.red(str[i])}`;\n break;\n case 1:\n retStr += `${chalk.green(str[i])}`;\n break;\n case 2:\n retStr += `${chalk.yellow(str[i])}`;\n break;\n case 3:\n retStr += `${chalk.blue(str[i])}`;\n break;\n case 4:\n retStr += `${chalk.magenta(str[i])}`;\n break;\n case 5:\n retStr += `${chalk.cyan(str[i])}`;\n break;\n default:\n retStr += str[i];\n break; \n }\n }\n return retStr;\n }", "makeText(numWords = 50) {\n\t\tlet wordsObj = this.makeChains(); //This is an object\n\t\tlet arr = [];\n\t\tlet wordsObjKeys = Object.keys(wordsObj);\n\t\tlet startidx = Math.floor(Math.random() * wordsObjKeys.length);\n\t\tlet pushWord = wordsObjKeys[startidx];\n\t\tarr.push(pushWord);\n\t\twhile (numWords > arr.length) {\n\t\t\tlet val = wordsObj[pushWord];\n\t\t\tlet idx = Math.floor(Math.random() * val.length);\n\t\t\tif (val[idx] === null) {\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tarr.push(val[idx]);\n\t\t\t\tpushWord = val[idx];\n\t\t\t}\n\t\t}\n\t\treturn arr.join(\" \");\n\t}", "function getpyraoptscramble(mn) {\n var j = 1, b = [], g = [], f = [], d = [], e = [], k = [], h = [], i = [];\n\n function u() {\n var c, p, q, l, m;\n for (p = 0; p < 720; p++) {\n g[p] = -1;\n d[p] = [];\n for (m = 0; m < 4; m++)d[p][m] = w(p, m)\n }\n g[0] = 0;\n for (l = 0; l <= 6; l++)for (p = 0; p < 720; p++)if (g[p] == l)for (m = 0; m < 4; m++) {\n q = p;\n for (c = 0; c < 2; c++) {\n q = d[q][m];\n if (g[q] == -1)g[q] = l + 1\n }\n }\n for (p = 0; p < 2592; p++) {\n f[p] = -1;\n e[p] = [];\n for (m = 0; m < 4; m++)e[p][m] = x(p, m)\n }\n f[0] = 0;\n for (l = 0; l <= 5; l++)for (p = 0; p < 2592; p++)if (f[p] == l)for (m = 0; m < 4; m++) {\n q = p;\n for (c = 0; c < 2; c++) {\n q = e[q][m];\n if (f[q] == -1)f[q] = l + 1\n }\n }\n for (c = 0; c < j; c++) {\n k = [];\n var t = 0, s = 0;\n q = 0;\n h = [0, 1, 2, 3, 4, 5];\n for (m = 0; m < 4; m++) {\n p = m + n(6 - m);\n l = h[m];\n h[m] = h[p];\n h[p] = l;\n if (m != p)s++\n }\n if (s % 2 == 1) {\n l = h[4];\n h[4] = h[5];\n h[5] = l\n }\n s = 0;\n i = [];\n for (m = 0; m < 5; m++) {\n i[m] = n(2);\n s += i[m]\n }\n i[5] = s % 2;\n for (m = 6; m < 10; m++) {\n i[m] = n(3)\n }\n for (m = 0; m < 6; m++) {\n l = 0;\n for (p = 0; p < 6; p++) {\n if (h[p] == m)break;\n if (h[p] > m)l++\n }\n q = q * (6 - m) + l\n }\n for (m = 9; m >= 6; m--)t = t * 3 + i[m];\n for (m = 4; m >= 0; m--)t = t * 2 + i[m];\n if (q != 0 || t != 0)for (m = mn; m < 99; m++)if (v(q, t, m, -1))break;\n b[c] = \"\";\n for (p = 0; p < k.length; p++)b[c] += [\"U\", \"L\", \"R\", \"B\"][k[p] & 7] + [\"\", \"'\"][(k[p] & 8) / 8] + \" \";\n var a = [\"l\", \"r\", \"b\", \"u\"];\n for (p = 0; p < 4; p++) {\n q = n(3);\n if (q < 2)b[c] += a[p] + [\"\", \"'\"][q] + \" \"\n }\n }\n }\n\n function v(q, t, l, c) {\n if (l == 0) {\n if (q == 0 && t == 0)return true\n } else {\n if (g[q] > l || f[t] > l)return false;\n var p, s, a, m;\n for (m = 0; m < 4; m++)if (m != c) {\n p = q;\n s = t;\n for (a = 0; a < 2; a++) {\n p = d[p][m];\n s = e[s][m];\n k[k.length] = m + 8 * a;\n if (v(p, s, l - 1, m))return true;\n k.length--\n }\n }\n }\n return false\n }\n\n function w(p, m) {\n var a, l, c, s = [], q = p;\n for (a = 1; a <= 6; a++) {\n c = Math.floor(q / a);\n l = q - a * c;\n q = c;\n for (c = a - 1; c >= l; c--)s[c + 1] = s[c];\n s[l] = 6 - a\n }\n if (m == 0)y(s, 0, 3, 1);\n if (m == 1)y(s, 1, 5, 2);\n if (m == 2)y(s, 0, 2, 4);\n if (m == 3)y(s, 3, 4, 5);\n q = 0;\n for (a = 0; a < 6; a++) {\n l = 0;\n for (c = 0; c < 6; c++) {\n if (s[c] == a)break;\n if (s[c] > a)l++\n }\n q = q * (6 - a) + l\n }\n return q\n }\n\n function x(p, m) {\n var a, l, c, t = 0, s = [], q = p;\n for (a = 0; a <= 4; a++) {\n s[a] = q & 1;\n q >>= 1;\n t ^= s[a]\n }\n s[5] = t;\n for (a = 6; a <= 9; a++) {\n c = Math.floor(q / 3);\n l = q - 3 * c;\n q = c;\n s[a] = l\n }\n if (m == 0) {\n s[6]++;\n if (s[6] == 3)s[6] = 0;\n y(s, 0, 3, 1);\n s[1] ^= 1;\n s[3] ^= 1\n }\n if (m == 1) {\n s[7]++;\n if (s[7] == 3)s[7] = 0;\n y(s, 1, 5, 2);\n s[2] ^= 1;\n s[5] ^= 1\n }\n if (m == 2) {\n s[8]++;\n if (s[8] == 3)s[8] = 0;\n y(s, 0, 2, 4);\n s[0] ^= 1;\n s[2] ^= 1\n }\n if (m == 3) {\n s[9]++;\n if (s[9] == 3)s[9] = 0;\n y(s, 3, 4, 5);\n s[3] ^= 1;\n s[4] ^= 1\n }\n q = 0;\n for (a = 9; a >= 6; a--)q = q * 3 + s[a];\n for (a = 4; a >= 0; a--)q = q * 2 + s[a];\n return q\n }\n\n function y(p, a, c, t) {\n var s = p[a];\n p[a] = p[c];\n p[c] = p[t];\n p[t] = s\n }\n\n function n(c) {\n return Math.floor(Math.random() * c)\n }\n\n u();\n ss[0] += b[0];\n}", "function randColor() {\n\n // Set random word\n\n\n // Set random word color\n\n\n }", "getRandomPhrase() {\n const index1 = Math.floor(Math.random() * this.phrases.length);\n function index2(index1) {\n return Math.floor(Math.random() * game.phrases[index1].length);\n }\n if (index1 === 0) {\n this.clue = 'Video Games';\n return this.phrases[index1][index2(index1)];\n } else if (index1 === 1) {\n this.clue = 'Literature';\n return this.phrases[index1][index2(index1)];\n } else if (index1 === 2) {\n this.clue = 'Golden Girls Quotes';\n return this.phrases[index1][index2(index1)];\n } else {\n this.clue = 'Crafts';\n return this.phrases[index1][index2(index1)];\n }\n }", "function init() {\n //picks a random number and matches it to a letter\n currentWord = words[Math.floor(Math.random()*words.length)];\n wordHint.textContent = currentWord.split(\"\").map(letter => letter = \"__\").join(\" \");\n}", "function panjang (str) {\n let hasil = ''\n //let b = options.length;\n for(let i=0; i< b; i++) {\n hasil += randomStr(str)[i]\n }\n return hasil;\n }", "function randomCidDim(){\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n for( var i=0; i < 7; i++ )\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n\n return text;\n}", "function getWords() {\n word.innerText = list[Math.floor(Math.random() * list.length)];\n}", "get choices_ans() {\n switch (this.idx) {\n case 0:\n // this is for position\n var choices = [\n \"$$(\"+this.h+\",\"+this.k+\")$$\",\n \"$$(\"+ (this.h == 0 ? (this.h+'x') : -this.h) +\",\"+ -this.k +\")$$\",\n \"$$(\"+ (this.k == 0 ? (this.h+'x') : -this.k) +\",\"+ this.h +\")$$\",\n \"Degenerate\"];\n return knuth(choices, 0);\n break;\n case 1:\n // this is LR length\n // split between central ana parabola\n if (this.type == 0) {\n var choices = [\n \"$$\"+Math.abs(this.lr)+\"$$\",\n \"$$\"+m_round(Math.abs(this.lr)/4)+\"$$\",\n \"$$\"+ this.lr*4 +\"$$\",\n \"Degenerate\"];\n return knuth(choices, 0)\n }\n else {\n var choices = [\n \"$$\"+2*m_round(Math.pow(this.b,2)/this.a)+\"$$\",\n \"$$\"+2*m_round(Math.pow(this.a-this.b, 2))+\"$$\",\n \"$$\"+2*m_round(Math.pow(this.a,1)/this.b)+1+\"$$\",\n \"Degenerate\"];\n return knuth(choices, 0);\n }\n break;\n case 2:\n // eccentricity\n var choices = [\"$$1$$\", \"$$< 1$$\", \"$$> 1$$\", \"Degenerate\"];\n return knuth(choices, this.type);\n break;\n default:\n // focus\n // split between central and parabola\n var symb = this.type == 0 ? \"+\" : \"\\\\pm\"\n var choices = [\n \"$$(\"+this.h+\", \"+this.k+\")$$\",\n \"$$(\"+this.h+symb+m_round(this.c)+\", \"+this.k+\")$$\",\n \"$$(\"+this.h+\", \"+this.k+symb+m_round(this.c)+\")$$\",\n \"Degenerate\"];\n return knuth(choices, 1+this.o);\n }\n }", "function randSearch() {\n\t// Variable length to lower collision rate further\n\tvar v = \"\";\n\tfor(var i = 0; i < 14; i++) {\n\t\tvar n1 = Math.random();\n\t\tvar n2 = Math.random();\n\t\tif(n1 * 1.5 > 1) {\n\t\t\tv += String.fromCharCode(Math.round(Math.random() * 9) + 48);\n\t\t} else if (n2 * 1.5 > 1) {\n\t\t\tv += String.fromCharCode(Math.round(Math.random() * 25) + 65);\n\t\t} else {\n\t\t\tv += String.fromCharCode(Math.round(Math.random() * 25) + 97);\n\t\t}\n\t}\n\treturn v;\n}", "function calculateIntermediateColor (){\nlet randomNumber = Math.floor((Math.random() * 100) + 1);\n\nif (randomNumber <= 33) return \"R\";\nelse if (randomNumber > 33 && randomNumber <=66) return \"B\";\nelse return \"G\";\n}", "function findRandomWord() {\n let range = halloweenArray.length;\n\n // selects a random index from array from the halloween words\n halloweenArrayIndex = Math.round(Math.random() * (range - 1));\n\n // stores that random picked word inside the currentWordArray\n currentWordArray = halloweenArray[halloweenArrayIndex].split(\"\");\n\n // removes the randomly selected word from the halloween array so it cant be used again\n halloweenArray.splice(halloweenArrayIndex, 1);\n\n // selects the hint that goes along with the randomly selected word and sends it to the HTML page\n document.getElementById(\"hint\").innerHTML = hints[halloweenArrayIndex];\n\n // Removes the hint from the array so it can't be selected again\n hints.splice(halloweenArrayIndex, 1);\n\n}", "function randomsym() {\n var rightAns = symbls[Math.ceil(Math.random() * 10)]\n var str = \"<br>\";\n for (i = 0; i <= 99; i++) {\n if (i % 9) {\n var sym = symbls[Math.ceil(Math.random() * 10)]\n\n str = str + i + \"-\" + sym + \"<br>\"\n\n }\n\n else {\n str = str + i + \"-\" + rightAns + \"<br>\"\n answerSym = rightAns\n }\n }\n // displays the symbols\n return str;\n}", "function eightBall(){\n console.log (words[Math.floor((Math.random() * (words.length)))]);\n}", "text(nChars){\n let text = \"\";\n while(text.length < nChars){\n let index = Math.floor((Math.random() * words.length));\n text += words[index] + \" \";\n }\n\n //If the text is longer cut it \n if(text.length > nChars){\n let difference = text.length - nChars;//lorem 3 \n text = text.substring(0,text.length - difference);\n }\n\n return text + \".\";\n }", "function randomWord() {\r\n answer = guessme[Math.floor(Math.random() * guessme.length)];\r\n console.log(answer);\r\n}", "function resetGame() {\n answer = choices[Math.floor(Math.random() * choices.length)];\n lives = 10;\n wrongArray = [];\n emptyWord = [];\n countBlank = answer.length;\n console.log(answer);\n createWord();\n }", "function randomizeFakeResults(){\n //define and set toDistribute\n let toDistribute = 0;\n for (let i=0; i<diceterms.length; i++){\n let diceterm = diceterms[i];\n for (let j=0; j<diceterm.fakeResults.length; j++){\n let fakeResult = diceterm.fakeResults[j];\n //for each fake result\n if (diceterm.modifiers.includes('kh') && j==0) continue;\n if (diceterm.modifiers.includes('kl') && j==0) continue;\n //if it has adv/disadv skip the first result\n if (fakeResult !=1){\n //if subtracting, we don't want it to be distributed, so only add to toDistribute if diceterm.minus is false\n if (!diceterm.minus) toDistribute += fakeResult - 1;\n diceterm.fakeResults[j] = 1;\n }\n }\n }\n while(toDistribute > 0){\n for (let i=0; i<diceterms.length; i++){\n let diceterm = diceterms[i];\n for (let j=0; j<diceterm.fakeResults.length; j++){\n let fakeResult = diceterm.fakeResults[j];\n //for each fake result\n if (diceterm.modifiers.includes('kh') && j==0) continue;\n if (diceterm.modifiers.includes('kl') && j==0) continue;\n //if it has adv/disadv skip the first result\n let addToFakeResult = randNumFromToDistribute(diceterm.faces - fakeResult, toDistribute);\n diceterm.fakeResults[j] += addToFakeResult;\n if (diceterm.minus) toDistribute += addToFakeResult; //if subtracting, we need to take what we added to the fake result and put it elsewhere to make up for it\n if (!diceterm.minus) toDistribute -= addToFakeResult;\n }\n }\n }\n //if the equation has both added and subtracted dice, it will not have met the total yet\n // So, do the above all over again, but this time only on the subtracted dice.\n if (getTotal() != total){\n toDistribute = getTotal() - total;\n if (toDistribute <= 0){\n return;\n }\n while(toDistribute > 0){\n for (let i=0; i<diceterms.length; i++){\n let diceterm = diceterms[i];\n if (!diceterm.minus) continue;//skip it if it's not getting subtracted\n for (let j=0; j<diceterm.fakeResults.length; j++){\n let fakeResult = diceterm.fakeResults[j];\n //for each fake result\n if (diceterm.modifiers.includes('kh') && j==0) continue;\n if (diceterm.modifiers.includes('kl') && j==0) continue;\n //if it has adv/disadv skip the first result\n let addToFakeResult = randNumFromToDistribute(diceterm.faces - fakeResult, toDistribute);\n diceterm.fakeResults[j] += addToFakeResult;\n toDistribute -= addToFakeResult;\n }\n }\n }\n }\n }", "function ScrambleCompass(form) {\n \n\tvar i;\t\n\tfor (i = 1; i < 5; i++)\n\t\t{\n\t\t\ttempArray[i] = (Math.floor(Math.random() * 4)+1);\n\t\t\tif(i > 1)\n\t\t\t{\n\t\t\tif ((tempArray[i] == tempArray[i-1]) || (tempArray[i] == tempArray[i-2]) || (tempArray[i] == tempArray[i-3]))\n while((tempArray[i] == tempArray[i-1]) || (tempArray[i] == tempArray[i-2]) || (tempArray[i] == tempArray[i-3]))\n {\n tempArray[i] = (Math.floor(Math.random() * 4)+1);\n }\n\t\t\t}\n \n u = tempArray[i];\n \n \n\t\t}//\n\t\t\n\ttoptext = directions[tempArray[4]];\n\tbottomtext = directions[tempArray[1]];\n\trighttext = directions[tempArray[2]];\n\tlefttext = directions[tempArray[3]];\n\t\n\t\t\n document.getElementById(\"top\").innerHTML = toptext;\n document.getElementById(\"left\").innerHTML = lefttext;\n document.getElementById(\"right\").innerHTML = righttext;\n document.getElementById(\"bottom\").innerHTML = bottomtext;\n\t\t\n\t\t \n }", "function getPattern() {\n // Generates a 9 clue sequence\n for (let i = 0; i < 7; i++) {\n pattern[i] = getRandomInt(1, 10); //getting numbers from 1 to 9;\n }\n}", "function chooseChange() {\nvar seed = random(1,3);\nvar choice = round (seed);\n\tif (choice == 1){\n\tchangeWordM();\n\t}\n\tif (choice == 2){\n\tchangeWordO();\n\t}\n\tif (choice == 3){\n\tchangeWordW();\n\t}\n}", "function thoughts() {\n const thoughts = [\n '\"make your each day masterpiece\"',\n '\"Mind your digital wellbeing\"',\n '\"Javascript is nibbrish language\"',\n '\"You dont get everything in your life you wish for.\"'\n ];\n const randomThought = Math.floor(Math.random(thoughts) * 4);\n\n thought.innerHTML = thoughts[randomThought];\n}", "function resetWord() {\n index = Math.floor(Math.random() * colors.length);\n chosenWord = colors[index];\n underScore = [];\n guessesLeft = 5;\n guessedLetters = [];\n wrongLetters = [];\n console.log(chosenWord);\n updateDomElements();\n generateUnderScore();\n audio.play();\n}", "function r(){return Math.random().toString().slice(2,7)}", "function roundStart(){\n guessedWord = \"\";\n chosenWord = \"\";\n chances = 6;\n for(let i = 1; i < chances + 1; i++) {\n document.getElementById(\"blood\" + i).style.visibility = \"visible\";\n };\n\n if(!words1.length) {\n words1 = words2;\n words2 = [];\n };\n let wordChoice = Math.floor(Math.random() * words1.length);\n chosenWord = words1[wordChoice];\n wordSplit(words1, wordChoice);\n}", "function generateRandomNumber() {\n var max = 9;\n var min = 1;\n\n for (var i = 1; i <= max; i++) {\n var temp = Math.floor(Math.floor(Math.random() * (max - min + 1)) + min);\n if (random.indexOf(temp) == -1) {\n random.push(temp);\n }\n else\n i--;\n }\n document.getElementById(\"p1\").innerText = random[0];\n document.getElementById(\"p2\").innerText = random[1];\n document.getElementById(\"p3\").innerText = random[2];\n document.getElementById(\"p4\").innerText = random[3];\n document.getElementById(\"p5\").innerText = random[4];\n document.getElementById(\"p6\").innerText = random[5];\n document.getElementById(\"p7\").innerText = random[6];\n document.getElementById(\"p8\").innerText = random[7];\n document.getElementById(\"p9\").innerText = random[8];\n randomText = Math.floor(Math.floor(Math.random() * (13 - 1 + 1)) + 1);\n document.getElementById(\"numberRandomText\").innerText = randomText;\n selectedBoxes = 0;\n}", "function getScramble() {\n var moves = new Array();\n moves['r'] = new Array(\"R\", \"R'\", \"R2\");\n moves['l'] = new Array(\"L\", \"L'\", \"L2\");\n moves['u'] = new Array(\"U\", \"U'\", \"U2\");\n moves['d'] = new Array(\"D\", \"D'\", \"D2\");\n moves['f'] = new Array(\"F\", \"F'\", \"F2\");\n moves['b'] = new Array(\"B\", \"B'\", \"B2\");\n\n var limit = 25;\n var last = \"\";\n var scramble = \"\";\n var keys = \"\";\n\n for (var i = 1; i <= limit; i++) {\n keys = new Array(\"r\", \"l\", \"u\", \"d\", \"f\", \"b\");\n shuffle(keys);\n while (last == keys[0]) {\n shuffle(keys);\n }\n shuffle(moves[keys[0]]);\n move = moves[keys[0]][0];\n scramble += move + \" \";\n last = keys[0];\n } \n \n $$('.scramble .scramble-text').html( scramble);\n\n}", "function showWord(words){\r\n// generate random array index//\r\nconst randIndex =math.floor(math.random() * words.length);\r\n// output random words//\r\ncurrentWord.innerHTML = words[randIndex];\r\n}", "function randomizer (word) {\n\t\treturn Math.floor((Math.random() * 800) + word.length*55); //used to be +200\n\t}", "function Reels() {\n let betLine = [\" \", \" \", \" \"];\n let outCome = [0, 0, 0];\n for (let spin = 0; spin < 3; spin++) {\n outCome[spin] = Math.floor((Math.random() * 65) + 1);\n switch (outCome[spin]) {\n case checkRange(outCome[spin], 1, 27): // 41.5% probability\n betLine[spin] = \"blank\";\n blanks++;\n break;\n case checkRange(outCome[spin], 28, 37): // 15.4% probability\n betLine[spin] = \"grapes\";\n grapes++;\n break;\n case checkRange(outCome[spin], 38, 46): // 13.8% probability\n betLine[spin] = \"banana\";\n bananas++;\n break;\n case checkRange(outCome[spin], 47, 54): // 12.3% probability\n betLine[spin] = \"orange\";\n oranges++;\n break;\n case checkRange(outCome[spin], 55, 59): // 7.7% probability\n betLine[spin] = \"cherry\";\n cherries++;\n break;\n case checkRange(outCome[spin], 60, 62): // 4.6% probability\n betLine[spin] = \"bar\";\n bars++;\n break;\n case checkRange(outCome[spin], 63, 64): // 3.1% probability\n betLine[spin] = \"bell\";\n bells++;\n break;\n case checkRange(outCome[spin], 65, 65): // 1.5% probability\n betLine[spin] = \"seven\";\n sevens++;\n break;\n }\n }\n return betLine;\n }", "function generateAnswer() {\n var answer;\n if (riddleNum === 0) {\n answer = \"Nothing\";\n } else if (riddleNum === 1) {\n answer = \"A wall\";\n } else if (riddleNum === 2) {\n answer = \"A lantern\";\n } else if (riddleNum === 3) {\n answer = \"A map\";\n } else if (riddleNum === 4) {\n answer = \"Sleep\";\n } else if (riddleNum === 5) {\n answer = \"A book\";\n } else if (riddleNum === 6) {\n answer = \"Shoes\";\n } else if (riddleNum === 7) {\n answer = \"The poison is in the ice\";\n } else if (riddleNum === 8) {\n answer = \"An hourglass\";\n } else if (riddleNum === 9) {\n answer = \"Alcohol\";\n } else {\n answer = \"Error 404\";\n }\n \n document.querySelector(\"#answer\").innerHTML = answer;\n \n }", "function radicalSimpQuestion (numQuestions, min, max)\n{\n for (var j=0; j<numQuestions; j++)\n {\n var radican = randomNumber(min, max, 1);\n var greatestRoot = 1;\n var remainder = radican;\n //store question\n questions_radicals[j]=\"$$\\\\sqrt{\"+radican+\"}$$\";\n for (var i=2;i<=(radican/2);i++)\n if ((radican%(i*i))==0)\n {\n greatestRoot=i;\n remainder = radican/(i*i);\n }\n //store answer formatted based on need to show each part\n if (remainder == 1)\n answers_radicals[j]=\"$$\"+greatestRoot+\"$$\";\n \n \n if (greatestRoot == 1)\n answers_radicals[j]=\"$$\\\\sqrt{\"+remainder+\"}$$\";\n \n if (greatestRoot !=1 && remainder !=1)\n answers_radicals[j]=\"$$\"+greatestRoot+\"\\\\sqrt{\"+remainder+\"}$$\";\n }\n display(\"radicals\",questions_radicals);\n}", "function random() {\n words.innerHTML = \"\";\n let random = Math.floor(Math.random() * (wordCount));\n let wordArray = list[random].split(\"\");\n for (let i = 0; i < wordArray.length; i++) { //building the words with spans around the letters\n let span = document.createElement(\"span\");\n span.classList.add(\"span\");\n span.innerHTML = wordArray[i];\n words.appendChild(span);\n }\n spans = document.querySelectorAll(\".span\");\n}", "function generate(size = 25, w0, w1) {\n if (size == 0) {\n return w0 || '';\n } else if (isUndefined(w0) || isUndefined(w1)) {\n let r = random(wordList.length - 3);\n return generate(size, wordList[r], wordList[r+1]);\n } else {\n let w2 = sample(lookup[[w0, w1]]);\n return w0 + ' ' + generate(size-1, w1, w2);\n }\n }", "function reset() \n\n{\n\n\t\tspace=[];\n\t\trandIndex=Math.floor(Math.random()*bands.length);\n\t\tword= bands[randIndex];\n\t\tguesses= word.length+1;\n\t\ttries= [];\n\t\tcount= 0;\n\n\t\tdocument.getElementById(\"dashboard\").innerHTML = tries;\n\n\t\tfor(i=0; i<word.length; i++)\n\t\t{\n\t\t\tspace.push(\"_ \");\n\t\t\tdocument.getElementById(\"h\"). innerHTML = space.join(\" \");\n\t\t\t//console.log(space);\n\n\t\t}\n\n\n\n\n}", "create_random_phrase(N) {\n let phrase = \"\";\n\n for (let n = 0; n < N; n++) {\n // Selects a random number in range [0, 128)\n // and converts to a string character\n let char = String.fromCharCode(random(32, 128));\n\n phrase += char;\n }\n\n return phrase;\n }", "function getRandomEasyWord() {\n theWord = wordsEasy[Math.floor(Math.random() * wordsEasy.length)];\n console.log(theWord);\n return theWord\n}", "function getRandomHardWord() {\n theWord = wordsHard[Math.floor(Math.random() * wordsHard.length)];\n console.log(theWord);\n return theWord\n}", "function getRandomNormalWord() {\n theWord = wordsNormal[Math.floor(Math.random() * wordsNormal.length)];\n console.log(theWord);\n return theWord\n}", "function random_text(n) {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n for( var i=0; i < n; i++ )\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n return text;\n }", "function genereCombinaison() {\n combinaisonToFind = \"\";\n for (var i = 0; i < 4; i++) {\n\tcombinaisonToFind += Math.floor((Math.random() * 6));\n }\n}", "function genTree(hmax) {\r\n var genSymbols = [[\"A\", 1], [\"+\", 1], [\"-\", 1], [\">\", 1], [\"<\", 1], [\"s\", 1], [\"S\", 1], [\"F\", 1], [\"E\", 1], [\"L\", 1], [\"[]\", 2]];\r\n res = [];\r\n\r\n if (hmax <= 0) {\r\n res = [];\r\n }\r\n else {\r\n var r = Math.floor(Math.random() * genSymbols.length);\r\n var sym = genSymbols [r];\r\n\r\n ar = sym[1];\r\n sstr = sym[0];\r\n\r\n if (ar >= 2) {\r\n var t1 = genTree(hmax);\r\n var t2 = genTree(hmax);\r\n res = [sstr, [t1, t2]];\r\n }\r\n else {\r\n if (ar >= 1) {\r\n res = [sstr, [genTree(hmax - 1)]];\r\n }\r\n else\r\n res = [sstr, []];\r\n }\r\n\r\n }\r\n//console.log(res);\r\n return res;\r\n\r\n}", "function generate(){\n\n // increase difficulty after it scored over 10 points\n if(variables.score > 10) {\n variables.max = Math.ceil(variables.score / 5) * 5\n }\n if(variables.score > 20){\n variables.min = Math.ceil(variables.score / 10) * 5\n }\n\n variables.leftNumber = getRandomNumber(variables.min, variables.max)\n variables.rightNumber = getRandomNumber(variables.min, variables.max)\n variables.result = getRandomBoolean()\n variables.score++\n refreshNumbers()\n}", "function wordGenerator() {\n randomWord = wordList[Math.floor(Math.random() * wordList.length)];\n // console.log(\"Computer Picked: \" + randomWord);\n letters = randomWord.split('');\n console.log(letters);\n // display length of the random word selected as underscores\n hiddenWord = [];\n for (var i = 0; i < randomWord.length; i++) {\n hiddenWord.push(\"_\");\n console.log(\"computer picked: \" + randomWord);\n // push those underscores to an html element so it displays on the page\n document.getElementById(\"randomWord\").innerText = hiddenWord.join(' ');\n };\n}", "function play(){\n randNum = Math.floor(Math.random() * words.length);\n choosenWord = words[randNum];\n rightword = [];\n wrongword = [];\n underscore = [];\n remains = 10;\n document.getElementById(\"underscore\").textContent = generateUnderscore();\n document.getElementById(\"underscore\").textContent = underscore;\n document.getElementById(\"right\").textContent = rightword;\n document.getElementById(\"wrong\").textContent = wrongword;\n \n console.log(choosenWord)\n\n}", "function generate() {\n // With every new sentence we want to make tree branches smaller\n leng = 0.5*leng;\n // We also want to randomize angle a bit\n angle += random(-PI/9, PI/9);\n var newSentence = \"\";\n // Every character in sentence we need to change according to recursion rules and\n // write it dow to a new sentence\n for (var c in sentence) {\n let current = sentence.charAt(c);\n var found = false;\n for (var r in rules) {\n if (current == rules[r].a) {\n newSentence += rules[r].b;\n found = true;\n break;\n }\n }\n if (!found) {\n newSentence += current;\n }\n }\n sentence = newSentence;\n drawSentence();\n}", "function generateEasy(easyWords) {\n temp = \"\"\n $.getJSON(easyWords, function(data) {\n let wordVal = Math.floor(Math.random() * data.length)\n actual = data[wordVal].word.toUpperCase()\n for (let i = 0; i < actual.length; i++) {\n if (actual.substring(i, i + 1) == \" \") {\n temp += \" \"\n } \n else {\n temp += \"_\"\n }\n }\n $(\".easy\").text(temp)\n })\n}", "function rand_color(n){\n\tdiff = Math.floor(Math.random() * n);\n\n\tif (diff_prev == diff){\n\t\tdiff = Math.floor(Math.random() * n);\n\t}\n\tdiff_prev == diff;\n\tvar r = Math.floor(Math.random() * 256);\n\tvar g = Math.floor(Math.random() * 256);\n\tvar b = Math.floor(Math.random() * 256);\n\tvar rd=r, gd=g, bd=b;\n\tvar rand = Math.floor(Math.random() * 3);\n\t\n\tif(cnt == 40) h = 10;\n\t\n\tswitch(rand){\n\t\tcase 0 : ((r-h) < 0) ? rd = (r+h) : rd = (r-h);\n\t\t\t\t((g-h) < 0) ? gd = (g+h) : gd = (g-h);\n\t\t\t\tbreak;\n\t\tcase 1 : ((r-h) < 0) ? rd = (r+h) : rd = (r-h);\n\t\t\t\t((b-h) < 0) ? bd = (b+h) : bd = (b-h);\n\t\t\t\tbreak;\n\t\tcase 2 : ((g-h) < 0) ? gd = (g+h) : gd = (g-h);\n\t\t\t\t((b-h) < 0) ? bd = (b+h) : bd = (b-h);\n\t\t\t\tbreak;\n\t}\n\tgener_color = \"rgb(\"+r+\", \"+g+\", \"+b+\")\";\n\ttrans_color = \"rgb(\"+rd+\", \"+gd+\", \"+bd+\")\";\n\t//span_gen_color.textContent = gener_color;\n\t//span_trs_color.textContent = trans_color;\n\t//span_diff_pos.textContent = diff+1;\t\n}", "function Reels() {\n var betLine = [\" \", \" \", \" \"];\n var outCome = [0, 0, 0];\n\n for (var spin = 0; spin < 3; spin++) {\n outCome[spin] = Math.floor((Math.random() * 65) + 1);\n switch (outCome[spin]) {\n case checkRange(outCome[spin], 1, 27): // 41.5% probability\n betLine[spin] = \"blank\";\n blanks++;\n break;\n case checkRange(outCome[spin], 28, 37): // 15.4% probability\n betLine[spin] = \"grapes\";\n grapes++;\n break;\n case checkRange(outCome[spin], 38, 46): // 13.8% probability\n betLine[spin] = \"banana\";\n bananas++;\n break;\n case checkRange(outCome[spin], 47, 54): // 12.3% probability\n betLine[spin] = \"orange\";\n oranges++;\n break;\n case checkRange(outCome[spin], 55, 59): // 7.7% probability\n betLine[spin] = \"cherry\";\n cherries++;\n break;\n case checkRange(outCome[spin], 60, 62): // 4.6% probability\n betLine[spin] = \"bar\";\n bars++;\n break;\n case checkRange(outCome[spin], 63, 64): // 3.1% probability\n betLine[spin] = \"bell\";\n bells++;\n break;\n case checkRange(outCome[spin], 65, 65): // 1.5% probability\n betLine[spin] = \"seven\";\n sevens++;\n break;\n }\n }\n return betLine;\n}", "function scramble() { //MESMA COISA QUE\n divs.forEach(element => { // randomize(\"azul\");\n randomize(element); // randomize(\"vermelho\");\n }); // randomize(\"verde\");\n} //randomize (\"amarelo\");", "function randomBlocText(k){\n result=\"\";\n for(var i=0;i<k;i++){\n var newWord=randomWord();\n if(i==0){\n newWord=capitalizeFirstLetter(newWord);\n }\n result+=randomPhrase();\n }\n return result;\n}", "function assign(n) {\r\n\t// n = 3 = easy. n=6=hard\r\n\tfor (i = 0; i < n; i++) {\r\n\t\tboxes[i].style.backgroundColor = randomize(255);\r\n\t}\r\n\t//assigns one of the randomly generated color boxes to the title as the answer\r\n\ttitle.textContent = boxes[choose(n-1)].style.backgroundColor;\r\n}", "function getRandomColor() {\n //object with multiples colors as linear-gradients\n var letters = [\n 'linear-gradient(120deg, #f6d365 0%, #fda085 100%)',\n 'linear-gradient(to top, #fdcbf1 0%, #fdcbf1 1%, #e6dee9 100%)',\n 'linear-gradient(120deg, #d4fc79 0%, #96e6a1 100%)',\n 'linear-gradient(to right, #b8cbb8 0%, #b8cbb8 0%, #b465da 0%, #cf6cc9 33%, #ee609c 66%, #ee609c 100%)',\n 'linear-gradient(to right, #f78ca0 0%, #f9748f 19%, #fd868c 60%, #fe9a8b 100%)',\n 'linear-gradient(to top, #0ba360 0%, #3cba92 100%)',\n 'linear-gradient(to top, #00c6fb 0%, #005bea 100',\n 'linear-gradient(15deg, #13547a 0%, #80d0c7 100%)'\n ];\n //returns a random color from the letters object using their index.\n var color = letters[Math.floor(Math.random() * letters.length)];\n return color;\n\n}", "function showText() {\n $(\"#textDisplay\").empty();\n $(\"#instructions\").empty();\n randomWords = [];\n for (var i = 0; i < wordCount; i++) {\n var ranWord = wordList[Math.floor(Math.random() * wordList.length)];\n if (wordList[wordList.length - 1] !== ranWord || wordList[wordList.length - 1] === undefined) {\n randomWords.push(ranWord);\n }\n }\n randomWords.forEach(function(word){\n $(\"#textDisplay\").append($(\"<span>\",{\"text\": word + \" \",\"class\":\"word\"}));\n });\n textDisplay.firstChild.classList.add(\"highlightedWord\")\n }", "function displayRandom(){\n\t\tvar showWord = document.getElementById(\"displayWord\");\n\t\tvar correct = document.createElement(\"ul\");\n\t\tcorrect.setAttribute('id', 'the-word');\n\n\t\t// need to give each letterPlace a unique ID\n\t\tfor (var i=0;i<randomWord.length;i++) {\n\t\t\tletterPlace = document.createElement(\"li\");\n\t\t\tletterPlace.setAttribute('class','letterPlace');\n\t\t\tletterPlace.setAttribute('id',randomWord[i]);\n\t\t\tif (randomWord != \"-\") {\n\t\t\t\tletterPlace.innerHTML = \"_\";\n\t\t\t}\n\t\t\tshowWord.appendChild(correct);\n\t\t\tcorrect.appendChild(letterPlace);\n\t\t};\n\t}", "function pickWords()\n{\n\tfor (var i = 0; i < textNodes.length; i++)\n\t{\n\t\t// splits string into array of word strings\n\t\tvar stringArray = textNodes[i].split(\" \");\n\n\t\tvar j = Math.floor(Math.random() * 15) + 2;\n\t\twhile (j < stringArray.length)\n\t\t{\n\t\t\t// TODO: make translation snippets randomly varied in word length, don't cut across sentences\n\t\t\t// \t\t at some point, make snippets logical phrases for better translation\n\t\t\t// \t\t (e.g. \"and then he said\" instead of \"cat and then\")\n\t\t\tvar phraseToTranslate = stringArray[j] + \" \" + stringArray[j+1] + \" \" + stringArray[j+2];\n\t\t\tif (validate(phraseToTranslate))\n\t\t\t{\n\t\t\t\tvar item = {\n\t\t\t\t\tuntranslated : phraseToTranslate,\n\t\t\t\t\ttranslated : \"\"\n\t\t\t\t};\n\n\t\t\t\tjsonObject.phraseArray.push(item);\n\t\t\t}\n\n\t\t\tj += Math.floor(Math.random() * 90) + 80;\n\t\t}\n\t}\n\n\tvar arrLength = jsonObject.phraseArray.length.toString();\n\tchrome.runtime.sendMessage({ type: \"setBadge\", badgeText : arrLength });\n\n\tloadLangs();\n}", "function defAndWord(){\r\n\r\n document.getElementById('wordDef').innerHTML=def[randIndex];\r\n}", "function nonsenseWord() {\n var word = chance.word({syllables: 3});\n return word;\n}", "function getRandomWords() {\n const $randomNumber = Math.floor(Math.random() * (chosenWordArray.length-1)); // gets random number between 0 - length of array\n console.log($randomNumber); // logs the random number in the console\n randomWord = chosenWordArray[$randomNumber]; // uses random number to choose random word from the array\n console.log(randomWord); // logs the random word chosen in the console\n jumbleWord(randomWord.toUpperCase()); // sends the random number to the jumbleWord function to jumble up the letters\n }", "function chooseRandomWord() {\n //store random word\n currentWord = wordLibraryArray[Math.floor(Math.random() * wordLibraryArray.length)];\n currentWordArray = currentWord.split('');\n remainingLetters = currentWord.length;\n displayStatus(currentWord);\n}", "function pickALetter(pool) { \n return poolOfLetters[Math.round(Math.random(0, poolOfLetters.length - 1)*10)] \n}", "function createRandomLettersHE(len){\n var text = \"\";\n var possible = \"אבגדהוזחטיכלמנסעפצקרשת0123456789\";\n for( var i=0; i < len; i++ )\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n return text;\n}", "function generateQA() {\r\n var x = 1 + Math.round(9*Math.random());\r\n var y = 1 + Math.round(9*Math.random());\r\n correctAnswer = x*y;\r\n document.getElementById(\"question\").innerHTML = x + \"x\" + y;\r\n correctPosition = 1 + Math.round(3*Math.random());\r\n document.getElementById(\"variant\" + correctPosition).innerHTML = correctAnswer;//fill one box with the correct answer\r\n \r\n //fill other boxes with wrong answers\r\n var answers = [correctAnswer];\r\n\r\n for(i=1; i<5; i++) {\r\n if(i != correctPosition) {\r\n var wrongAnswer;\r\n do {\r\n wrongAnswer = (1 + Math.round(9*Math.random()))*(1 + Math.round(9*Math.random()));//a wrong answer\r\n }while(answers.indexOf(wrongAnswer)>-1)\r\n document.getElementById(\"variant\" + i).innerHTML = wrongAnswer;\r\n answers.push(wrongAnswer);\r\n }\r\n }\r\n}", "function comboGenerator() {\r\n\tcomboArrowsCounter = 0;\r\n\tmultipleCombos = comboSequence.firstChild ? 0 : multipleCombos;\r\n\twhile (comboSequence.firstChild) {comboSequence.removeChild(comboSequence.firstChild);}\r\n\r\n\tcombo = new Array(randomNumberGenerator(minComboLength, maxComboLength));\r\n\tcomboLength = combo.length;\r\n\tfor (let i = 0; i <= combo.length - 1; i++) {\r\n\t\tcombo[i] = Math.floor(Math.random() * 4) + 1;\r\n\r\n\t\tswitch(combo[i]){\r\n\t\t\tcase 1:\r\n\t\t\t\tvar node = document.createElement(\"SPAN\");\r\n\t\t\t\tnode.innerHTML = \"&#x21e6;\";\r\n\t\t\t\tnode.id = \"combo\" + i;\r\n\t\t\t\tcomboSequence.appendChild(node);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tvar node = document.createElement(\"SPAN\");\r\n\t\t\t\tnode.innerHTML = \"&#x21e8;\";\r\n\t\t\t\tnode.id = \"combo\" + i;\r\n\t\t\t\tcomboSequence.appendChild(node);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\r\n\t\t\t\tvar node = document.createElement(\"SPAN\");\r\n\t\t\t\tnode.innerHTML = \"&#x21e7;\";\r\n\t\t\t\tnode.id = \"combo\" + i;\r\n\t\t\t\tcomboSequence.appendChild(node);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 4:\r\n\t\t\t\tvar node = document.createElement(\"SPAN\");\r\n\t\t\t\tnode.innerHTML = \"&#x21e9;\";\r\n\t\t\t\tnode.id = \"combo\" + i;\r\n\t\t\t\tcomboSequence.appendChild(node);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}", "function answer(){\n let random = Math.floor(Math.random() * colors.length);\n return colors[random];\n }", "function createColorPicker() {\n\n // Shuffle color array\n\n\n\n // Push to text color array\n\n\n\n // Shuffle text color array\n\n\n // Loop through all colors in the array\n // Create element to hold word\n // Output a word\n // Make word a random color\n\n }", "function getWord(){\nrdm = Math.floor((Math.random() * words.length-1) + 1);\n console.log('Word: ' + words[rdm]);\nconsole.log('Random: ' + rdm)\ndocument.getElementById(\"printWord\").innerHTML = words[rdm];\ndocument.getElementById(\"cajatexto\").value =\"\";\nfocusTextBox();\ndspWord = words[rdm];\ndraw();\n}", "function generateBright(hue) {\n flag = 'false';\n // Bright colors do not appear on the saturation/lightness table in a\n // uniform column or row so the sections of the table were split in\n // four. To choose random integers successfully between the four groups\n // the first step is to pick a random integer 0 to 3 and then pick\n // another random integer within the saturation/lightness table section\n choice = randomIntFromInterval(0, 3); // 0 to 3\n switch (choice) {\n case 0:\n // saturation = random # 66 to 100 inclusive\n satMin = 66;\n satMax = 100;\n\n // lightness = random # 26 to 35 inclusive\n lightMin = 26;\n lightMax = 35;\n\n saturation = randomIntFromInterval(satMin, satMax);\n lightness = randomIntFromInterval(lightMin, lightMax);\n\n // Error checking?\n if (isLightnessWithinConstraints(lightness, lightMin, lightMax)\n && isSaturationWithinConstraints(saturation, satMin, satMax)) {\n break;\n }\n\n case 1:\n // saturation = random # 4 to 100 inclusive\n satMin = 4;\n satMax = 100;\n\n // lightness = random # 36 to 55 inclusive\n lightMin = 36;\n lightMax = 55;\n\n saturation = randomIntFromInterval(satMin, satMax);\n lightness = randomIntFromInterval(lightMin, lightMax);\n\n // Error checking?\n if (isLightnessWithinConstraints(lightness, lightMin, lightMax)\n && isSaturationWithinConstraints(saturation, satMin, satMax)) {\n break;\n }\n\n case 2:\n // saturation = random # 56 to 100 inclusive\n satMin = 56;\n satMax = 100;\n\n // lightness = random # 56 to 65 inclusive\n lightMin = 56;\n lightMax = 65;\n\n saturation = randomIntFromInterval(satMin, satMax);\n lightness = randomIntFromInterval(lightMin, lightMax);\n\n // Error checking?\n if (isLightnessWithinConstraints(lightness, lightMin, lightMax)\n && isSaturationWithinConstraints(saturation, satMin, satMax)) {\n break;\n }\n case 3:\n // saturation = random # 76 to 100 inclusive\n satMin = 76;\n satMax = 100;\n\n // lightness = random # 66 to 75 inclusive\n lightMin = 66;\n lightMax = 75;\n\n saturation = randomIntFromInterval(satMin, satMax);\n lightness = randomIntFromInterval(lightMin, lightMax);\n\n // Error checking?\n if (isLightnessWithinConstraints(lightness, lightMin, lightMax)\n && isSaturationWithinConstraints(saturation, satMin, satMax)) {\n break;\n }\n }\n\n hsl = \"hsl(\" + hue + \", \" + saturation + \"%, \" + lightness + \"%)\";\n debug(hsl); // test\n return hsl;\n}" ]
[ "0.6214368", "0.6063824", "0.6059455", "0.6050696", "0.6041775", "0.6006292", "0.6001649", "0.5961085", "0.5952532", "0.5944608", "0.5924603", "0.5910431", "0.5867985", "0.58559555", "0.58529425", "0.5834867", "0.5786931", "0.5786193", "0.5774761", "0.5763499", "0.5757616", "0.5751428", "0.5748095", "0.57454586", "0.5741538", "0.5728231", "0.5726319", "0.57050073", "0.5690712", "0.56816745", "0.56796753", "0.5675649", "0.56750923", "0.5670231", "0.5669075", "0.5661363", "0.565991", "0.56499636", "0.5627984", "0.56269044", "0.5611306", "0.56097066", "0.56068075", "0.5595848", "0.5590696", "0.5560798", "0.55573475", "0.5555985", "0.55485475", "0.55424094", "0.55393165", "0.5536944", "0.5528884", "0.55251354", "0.55208385", "0.55069363", "0.54956216", "0.54827714", "0.54819316", "0.5478699", "0.54776824", "0.5477345", "0.5476833", "0.5474689", "0.54727435", "0.5467093", "0.54648167", "0.5462733", "0.54573584", "0.5456645", "0.54555005", "0.54501647", "0.54469776", "0.5438701", "0.5435945", "0.5435627", "0.5434299", "0.54330206", "0.5431859", "0.54291296", "0.54290605", "0.54252964", "0.5422761", "0.54227024", "0.5415699", "0.54137933", "0.54106194", "0.54102606", "0.54096246", "0.54009455", "0.539935", "0.53968775", "0.5390492", "0.538662", "0.5386191", "0.53837955", "0.5383562", "0.5383449", "0.53761923", "0.53752726" ]
0.67645144
0
gets trail to follow where mouse is
function follow(event) { trail[count%10].style.left = (event.pageX - 4) + "px"; trail[count%10].style.top = (event.pageY - 4) + "px"; count++; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw() {\n // Make sure the mouse position is set everytime\n // draw() is called.\n var x = mouse.x,\n y = mouse.y,\n a = nn.a,\n b = nn.b;\n \n // \n trailDots.forEach(function(dot, index, dots) {\n var nextDot = dots[index + 1] || dots[0];\n \n dot.x = x;\n dot.y = y;\n dot.draw();\n x += (nextDot.x - dot.x) * .7;\n y += (nextDot.y - dot.y) * .7;\n\n });\n \n nnDots.forEach(function(dot, index, dots) {\n var nextDot = dots[index + 1] || dots[0];\n \n dot.a = a;\n dot.b = b;\n dot.draw();\n a += (nextDot.a - dot.a) * .6;\n b += (nextDot.b - dot.b) * .6;\n });\n}", "follow() {\n let target;\n\n //which point to follow\n switch (this.next) {\n case 'mouse':\n target = this.p.createVector(this.p.mouseX, this.p.mouseY);\n break;\n case 'touch':\n this.ball.update();\n target = this.p.createVector(this.ball.x, this.ball.y);\n break;\n default:\n target = this.p.createVector(this.next.a.x, this.next.a.y);\n break;\n }\n\n let dir = this.p.createVector(target.x - this.a.x, target.y - this.a.y); //p.Vector.sub(target, this.a);\n this.angle = dir.heading();\n dir.setMag(this.len);\n dir.mult(-1);\n\n this.a = this.p.createVector(target.x + dir.x, target.y + dir.y); //p.Vector.add(target, dir);\n\n }", "initializeTrailFX(){\n var trailTexture = PIXI.Texture.fromImage('editor/trail.png')\n var historyX = []; var historyY = [];\n var historySize = 30;//historySize determines how long the trail will be.\n var ropeSize = 200; //ropeSize determines how smooth the trail will be.\n var points = [];\n //Create history array.\n for( var i = 0; i < historySize; i++){\n historyX.push(0); historyY.push(0);\n }\n //Create rope points.\n for(var i = 0; i < ropeSize; i++){points.push(new PIXI.Point(0,0))};\n //Create the rope\n var rope = new PIXI.mesh.Rope(trailTexture, points);\n rope._filters = [ new PIXI.filters.BlurFilter (3, 2)];\n rope.alpha = 0.6;\n this.mouseTrails = rope;\n \n const trailTiker = PIXI.ticker.shared.add((delta) => {\n historyX.pop();\n historyX.unshift(this.follower.x);\n historyY.pop();\n historyY.unshift(this.follower.y);\n for( var i = 0; i < ropeSize; i++){\n var p = points[i];\n var ix = cubicInterpolation( historyX, i / ropeSize * historySize);\n var iy = cubicInterpolation( historyY, i / ropeSize * historySize);\n p.x = ix; p.y = iy;\n }\n });\n function clipInput(k, arr){\n if (k < 0){k = 0;}\n if (k > arr.length - 1){ k = arr.length - 1;}\n return arr[k];\n };\n function getTangent(k, factor, array){return factor * (clipInput(k + 1, array) - clipInput(k - 1,array)) / 2;}\n function cubicInterpolation(array, t, tangentFactor){\n if (tangentFactor == null) tangentFactor = 1;\n var k = Math.floor(t);\n var m = [getTangent(k, tangentFactor, array), getTangent(k + 1, tangentFactor, array)];\n var p = [clipInput(k,array), clipInput(k+1,array)];\n t -= k;\n var t2 = t * t;\n var t3 = t * t2;\n return (2 * t3 - 3 * t2 + 1) * p[0] + (t3 - 2 * t2 + t) * m[0] + ( -2 * t3 + 3 * t2) * p[1] + (t3 - t2) * m[1];\n };\n }", "function AddTrailPosition() {\n\nif (linePart>9) {\n\nfor (var i=0;i<=8;i++) trailPositions[i] = trailPositions[i+1];\ntrailPositions[9] = Camera.main.ScreenToWorldPoint(Vector3(start.x, start.y, 10));\n\n\n} else {\n\nfor (var ii=linePart;ii<=9;ii++)\n\t\t\t\ttrailPositions[ii] = Camera.main.ScreenToWorldPoint(Vector3(start.x, start.y, 10));\t\t\n\n}\n\n}", "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}", "lookAtMouse () {\n\t\tconst diff = this.lastMousePosition.subtract(this.position);\n\t\tthis.setDirection(diff);\n\t}", "createTrail( first, second, hue ){\r\n let begin = this.transformIndex( first );\r\n let end = this.transformIndex( second );\r\n\r\n if( Math.abs( begin.x - end.x ) == 1 )\r\n this.array.trail.push( new trail(\r\n this.array.vertex[begin.x][begin.y],\r\n this.array.vertex[end.x][end.y],\r\n hue ) );\r\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}", "followMouse(_ease = .1) {\n this.x += (mouseX - this.x) * _ease;\n this.y += (mouseY - this.y) * _ease;\n }", "mouseMove(prev, pt) {}", "function follow_mouse(ev,gl,canvas,a_Position){\n \n if(index<2) return;\n var x = ev.clientX; //x coordinate of a mouse pointer\n var y = ev.clientY; // y coordinate of a mouse pointer\n var rect = ev.target.getBoundingClientRect();\n \n //remove previous points from array\n if(index > 2) {\n index-=2;\n }\n\n \n // Convert coordinates to canvas plane\n x = ((x-rect.left)-canvas.width/2)/(canvas.width/2);\n y = (canvas.height/2-(y-rect.top))/(canvas.height/2);\n \n //store coordinates in xy_points array\n xy_points[index]=x;\n index++;\n xy_points[index]=y;\n index++; \n \n // clear <canvas>\n gl.clear(gl.COLOR_BUFFER_BIT);\n\n \n for(var i=0; i<xy_points.length; i+=2){\n var xy = xy_points[i];\n //pass the position of a point to a_Position variable\n gl.vertexAttrib3f(a_Position, xy_points[i], xy_points[i+1],0.0);\n }\n \n //set the positions of vertices\n var n = initVertexBuffers(ev, gl, canvas, a_Position, n);\n if (n < 0) {\n console.log('Failed to set the positions of the vertices');\n return;\n }\n\n gl.drawArrays(gl.POINTS, 0, ((index)/2)); //Draw points \n gl.drawArrays(gl.LINE_STRIP, 0, index/2);//Draw lines \n}", "function followPlank(x,y){\n\t\tthis.y = y;\n\t\tthis.x = x;\n\t}", "function pinselada() {\n ctx.lineWidth = tamLinea;\n ctx.lineJoin = \"round\";\n ctx.lineCap = \"round\";\n ctx.lineTo(mouse.x, mouse.y);\n ctx.stroke();\n }", "dragTrail(amplitude, moveTo) {\n\t\t/* Use equation for exponential decay taken from \n\t\t\thttps://ariya.io/2013/11/javascript-kinetic-scrolling-part-2\n\t\t\tto control decay of the dragTrail\n\t\t*/ \n\t\treturn () => {\n\t\t\tif (this.isDrag) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (amplitude) {\n\t\t\t\tlet elapsed = performance.now() - this.timestamp;\n\t\t\t\tlet delta = -amplitude * Math.exp(-elapsed / this.timeConstant);\n\t\t\t\tif (delta > 1 || delta < -1) {\n\t\t\t\t\tthis.scroll(this.direction, moveTo + delta);\n\t\t\t\t\trequestAnimationFrame(this.dragTrail(amplitude, moveTo))\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.scroll(this.direction, moveTo);\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\n\t}", "function mouseSeeker() {\n\tstroke(230);\n\tline(mouseX, 0, mouseX, height);\n\tline(0, mouseY, width, mouseY);\n\t//color(0,0);\n\t//rect(0,0,959,383);\n}", "function trackMouse(e) {\n var offsetX = e.offsetX;\n var offsetY = e.offsetY;\n if (e.target && e.target.nodeName !== \"svg\") {\n var position = e.target.getAttribute('position');\n if (position === 'input') {\n //offsetY += (initialScrollOffsetLeft - scrollOffsetLeft);\n } else if (position === 'output') {\n // offsetY += (initialScrollOffsetRight - scrollOffsetRight);\n }\n if (isFF) {\n // firefox defines offsets relative to the event target rather than the absolute parent\n offsetX += (1 * e.target.getAttribute('x'));\n offsetY += (1 * e.target.getAttribute('y'));\n }\n }\n createPath(8, currentInput.y + 10, offsetX - mapperConfig.backOff, offsetY);\n }", "function newPos(){\n //Triangle3: using triangle 1 sine, define triangle 3, side A will be the strike power (with correction)\n var triangle3A = strike * 6;\n var triangle3B = Math.round(sine1 * triangle3A,0);\n var triangle3C = Math.round(Math.pow(Math.pow(triangle3A,2)-Math.pow(triangle3B,2),0.5),0);\n\n //Define the new coordinates (newPosX and newPosY), depending on (if) which side mouse is pointing\n if (mousePosX > ballNewPosX){\n ballNewPosX = ballNewPosX - triangle3C - ballWidth/2;\n ballNewPosY = ballNewPosY + triangle3B - ballHeight/2;\n }\n if (mousePosX <= ballNewPosX){\n ballNewPosX = ballNewPosX + triangle3C - ballWidth/2;\n ballNewPosY = ballNewPosY + triangle3B - ballHeight/2;\n }\n}", "function writeHandoff() {\n handoff_counter++;\n DRAWING_HANDOFF = true;\n var m = d3.mouse(this);\n console.log(\"x: \" + m[0] + \" y: \" + m[1]);\n line = timeline_svg.append(\"line\")\n .attr(\"class\", \"handOffLine\")\n .attr(\"id\", function() {\n return \"handoff_\" + handoff_counter;\n })\n .attr(\"x1\", m[0])\n .attr(\"y1\", m[1])\n .attr(\"x2\", m[0])\n .attr(\"y2\", m[1])\n .attr(\"stroke-width\", 3)\n .attr(\"stroke\", \"gray\");\n console.log(line);\n timeline_svg.on(\"mousemove\", handoffMouseMove);\n}", "function draw() {\n background(0);\n\n // Use a for loop to go through each element in the circle's trail array in order\n for (let i = 0; i < circle.trail.length; i++) {\n // Get the element at the index indicated by i (0, then 1, then 2, etc.)\n let element = circle.trail[i];\n // Draw an ellipse the same size as the circle at that position\n ellipse(element.x, element.y, circle.size);\n }\n\n // Move the circle to the mouse position\n circle.x = mouseX;\n circle.y = mouseY;\n\n // Draw the circle\n ellipse(circle.x, circle.y, circle.size);\n\n // Create a new position object that stores where the circle is now\n // which we can add to the trail to trace the path of the circle\n let newTrailPosition = {\n x: circle.x,\n y: circle.y\n };\n // Add the position to the circle's trail array\n circle.trail.push(newTrailPosition);\n\n // NEW! Check if the trail's length has exceeded the maximum\n if (circle.trail.length > circle.maxTrail) {\n // If it has, remove the oldest element (the one at the START of the array)\n circle.trail.shift();\n }\n}", "function drawTrail(index) {\n\n var trail = rec.getCurve(index);\n\n noFill();\n stroke(0);\n\n // now, draw it!\n beginShape();\n for(var i = 0; i < trail.length; i++) {\n var pt = trail[i];\n if(pt) {\n vertex(pt[0], pt[1]);\n } else {\n endShape();\n beginShape();\n }\n }\n endShape();\n\n}", "function point() {\n ctx.beginPath();\n ctx.arc(mouse.x, mouse.y, 0.01, 0, 2 * Math.PI, false);\n //ctx.moveTo(mouse.x, mouse.y);\n //ctx.lineTo(mouse.x+0.01, mouse.y+0.01);\n ctx.strokeStyle = currentColor;\n ctx.lineWidth = brushSize;\n ctx.stroke();\n }", "function catchUp(event) {\n var i = 0;\n clearInterval(timer);\n timer = setInterval(function() {\n if (i >= 10) {\n clearInterval(timer);\n }\n trail[count%10].style.left = (event.pageX - 4) + \"px\";\n trail[count%10].style.top = (event.pageY - 4) + \"px\";\n count++;\n i++\n }, 50);\n }", "function draw_A () {\n\t\n\tpomf=mouseX*0.1\n\t\n\t\n\tline (16-pomf,0-pomf, 60+pomf,-100+pomf);\n\tline (60-pomf,-100-pomf, 108+pomf, 0+pomf);\n\t\n\tline (6-pomf,0,26+pomf,0);\n\tline (98-pomf,0,118+pomf,0);\n\tline (52-pomf,-50,72+pomf,-50);\n\n\treturn 75;\n}", "aim()\n {\n this.aimX = mouseX - (this.sprite.width / 2 - 33);\n this.aimY = mouseY - ((this.sprite.height / 2) + 10);\n image(this.crosshair, this.aimX, this.aimY);\n }", "dragTrail(amplitude, moveTo) {\n\t\t/* Use exponential decay\n\t\t\thttps://en.wikipedia.org/wiki/Exponential_decay\n\t\t*/\n return () => {\n if (this.isDrag) {\n return false;\n }\n if (amplitude) {\n let elapsed = performance.now() - this.timestamp;\n let delta = -amplitude * Math.exp(-elapsed / this.timeConstant);\n if (delta > 1 || delta < -1) {\n this.scroll(this.direction, moveTo + delta);\n requestAnimationFrame(this.dragTrail(amplitude, moveTo));\n } else {\n this.scroll(this.direction, moveTo);\n this.slider.classList.add(\"snap\");\n this.slider.scrollLeft = this.slider.scrollLeft + 5;\n }\n }\n };\n }", "function update() \n\t\t\t{\n\t\t\t\tif (canFollow)\n\t\t\t\t{\n\t\t\t\t\tvar point = e.globalToLocal(stage.mouseX, stage.mouseY);\n\t\t\t\t\ttool.set ({x:point.x, y:point.y});\n\t\t\t\t}\n\t\t\t\tif (dragging)\n\t\t\t\t{\n\t\t\t\t\tvar yPos = carGrabbed.rotation == 180 ? -25 : 25;\n\t\t\t\t\tvar point = e.globalToLocal(stage.mouseX, stage.mouseY);\n\t\t\t\t\tcarGrabbed.set ({x:point.x, y:point.y + yPos});\n\t\t\t\t}\n\t\t\t}", "function Laser(){\n\t//to make the laser appear from the middle of the player and move up\n\t\t\t\n\t\n\t\t\t\tif(shoot == true){\n\t\t\t\t\t\n\t\t\t\t\tctx.fillStyle = 'white';\n\t\t\t\t\tctx.fillRect(laserx, lasery, 5, 10);\n\t\t\t\t\tlasery -= vely;\n\t\t\t\t}else{\n\t\t\t\t\t\tlasery = 460;\n\t\t\t\t\tlaserx = playerx + 33;\n\t\t\t\t}//to make the bullet return to the player if you miss\n\t\t\t\tif(lasery <= 0){\n\t\t\t\t\tshoot = false;\n\t\t\t\t}\n\t\t\t\tif(lasery <= 0 && shoot == false){\n\t\t\t\t\t\tlasery = 460;\n\t\t\t\t\t\tlasery -= 0;\n\t\t\t\t}\n\t}", "function SendTrailPosition() {\n\nvar index = 0;\nfor (var v : Vector3 in trailPositions) {\n\t\ttrail.SetPosition(index,v);\n\t\tindex++;\n\t}\n\n}", "drawTrail(){\n let opacity = 0;\n\n for (let trail of this.trailPositions) {\n ctx.strokeStyle = `rgba(255,255,255,${opacity})`;\n ctx.beginPath();\n ctx.arc(trail.x, trail.y, 1, this.theta, this.theta - 0.1, true);\n ctx.stroke();\n opacity += 0.5 / this.trailLength;\n }\n }", "function touchMoved() {\n strokeWeight(10);\n stroke(252, 74, 26);\n\n line(mouseX, mouseY, pmouseX, pmouseY);\n return false;\n}", "draw() {\n //draw the pen trace\n let colour = colourPicker.selectedColour;\n let p5Colour = p5Instance.color(colour.r, colour.g, colour.b, colour.a);\n this.command.context.chain.stroke(p5Colour);\n super.draw();\n\n this.command.context.chain.push();\n\n //draw the mouse pointer\n this.command.context.chain.strokeWeight(1);\n this.command.context.chain.circle(\n this.command.context.chain.mouseX,\n this.command.context.chain.mouseY,\n this.command.thickness,\n );\n this.command.context.chain.pop();\n }", "function paddle(){\r\n stroke(\"black\");\r\n strokeWeight(10);\r\n line(mouseX,mouseY-20,mouseX,mouseY+20);\r\n}", "function mousePressed() {\r\n target.position.x = mouseX;\r\n target.position.y = mouseY;\r\n recordtime = lifetime;\r\n}", "function draw(){\n var dirY = (mouseY / height - 0.5) *2;\n var dirX = (mouseX / width - 0.5) *2;\n directionalLight(250, 250, 250, dirX, -dirY, 0.25);\n ambientMaterial(250);\n sphere(50, 64);\n\n\n}", "function followPlayer(follower, leader, offsetX, offsetY) {\n directionX = leader.body.velocity.x > 1 ? 1 : -1\n follower.x = leader.body.x + (offsetX * directionX);\n follower.y = leader.body.y + offsetY;\n return follower;\n}", "move() {\n this.vx = (this.vx > 0) ? this.speed : -this.speed;\n this.vy = this.speed * Math.sign(this.vy);\n // Update position based on velocity\n this.x += this.vx;\n this.y += this.vy;\n\n // Move all trail positions along by one\n for (let i = this.trail.length - 1; i >= 1; i--) {\n this.trail[i].x = this.trail[i - 1].x;\n this.trail[i].y = this.trail[i - 1].y;\n }\n // Set the trail element closest to the \"core\" to the core's previous location\n this.trail[0].x = this.x;\n this.trail[0].y = this.y;\n\n // Check for collisions with top or bottom of the canvas\n if (this.y < 0 || this.y > height) {\n // It hit so reverse velocity\n this.vy = -this.vy;\n }\n // Check for collisions with the left or right of the canvas\n if (this.x < 0 || this.x > width) {\n // It hit so reverse velocity\n this.vx = -this.vx;\n }\n }", "onMouseUp(coord, event) {\n this.contextReal.strokeStyle = rgbaColor;\n this.contextReal.fillStyle = rgbaColor;\n this.contextReal.lineWidth = lWidth;\n this.contextReal.lineJoin = \"miter\";\n \n this.contextReal.lineTo(coord[0], coord[1]);\n this.origX = coord[0];\n this.origY = coord[1];\n this.startX.push(this.origX);\n this.startY.push(this.origY);\n if (Math.abs(this.origX - this.startX[0]) < 20 && Math.abs(this.origY - this.startY[0]) < 20 && this.startX.length > 1 && this.startY.length > 1) {\n this.mouseUp = true;\n this.contextDraft.clearRect(0,0,canvasDraft.width,canvasDraft.height);\n this.contextReal.fill();\n this.contextReal.stroke();\n cPush(); \n }\n }", "function drawTail() {\n penColor(rgb(76,219,255,0.7));\n penWidth(15);\n turnTo(305);\n arcLeft(30,300);\n penUp();\n}", "function sketchpad_mouseMove(e) { \n // Update the mouse co-ordinates when moved\n getMousePos(e);\n\n // Draw a line if the mouse button is currently being pressed\n if (mouseDown==1) {\n drawLine(ctx, mouseX, mouseY);\n }\n}", "function cursorP(p,l){\n\t var x=p.x\n\t var y=p.y\n\n\t this.line(x-l,y,x+l,y)\n this.line(x,y-l,x,y+l)\n}", "moveTo(x, y) {\n\n this.tr.x = x;\n this.tr.y = y;\n }", "function draw(e){\n if(!isDrawing) return; // only do the rest of the code if mouse is down\n\n console.log(\"mouse is moving: \",e);\n \n ctx.strokeStyle = `hsl(${hue}, 100%, 50%)`; // setting color acording to HUE\n ctx.lineJoin = \"round\";\n ctx.lineCap = \"round\"; \n //ctx.lineWidth = 10; // we can set it to hue width, so it changes also\n\n ctx.beginPath();\n ctx.moveTo(lastX,lastY);\n ctx.lineTo(e.offsetX,e.offsetY);\n ctx.stroke();\n \n // to make new line start from the end of the previous line\n // lastX = e.offsetX;\n // lastY = e.offsetY;\n // OR write it as\n [lastX, lastY] = [e.offsetX, e.offsetY];\n\n hue++; // increment color value, if it gets out of 360 range it will start from beginning 960 % 360\n if(hue >= 360){\n hue = 0; // reset hue value when it gets to 360\n }\n\n\n if(ctx.lineWidth >= 100 || ctx.lineWidth <= 1){\n direction = !direction; // flip direction\n }\n\n if(direction){\n ctx.lineWidth++;\n } else{\n ctx.lineWidth--;\n }\n\n\n }", "function mouseDragged(){\r\n Matter.Body.setPosition(arrow.body,{x:mouseX, y:mouseY})\r\n }", "function mousePressed() {\n camminatore.push(new Walker(mouseX, mouseY));\n}", "trace() {\n const x = this.penx, y = this.peny;\n console.log(Math.round(x * 10) / 10 + this.ox, Math.round(y * 10) / 10 + this.oy);\n // assume path\n // has begun\n this.context.moveTo(x - 5, y);\n this.context.lineTo(x + 5, y);\n this.context.moveTo(x, y + 5);\n this.context.lineTo(x, y - 5);\n this.context.moveTo(x, y);\n return {x,y};\n }", "function cursorHoldLoc(x,y) {\n pointingAtX = x;\n pointingAtY = y; \n forceFocus(); }", "function letgo(){\n\tif(position>278){\n\t\tposition=position-1;\n\t\ttracker=tracker-1;\n\n\t}\n\tb.setAttribute(\"x1\", position);\n\tt.setAttribute(\"x2\", position);\n\ta.transform.baseVal.getItem(0).setTranslate(tracker, 0);\n\tball.setAttribute(\"cx\", position);\n update();\n\t}", "function draw(e) {\n // stop the function if they are not mouse down\n if(!isDrawing) return;\n //listen for mouse move event\n\n //console.log(e);\n\n ctx.beginPath(); //Begins a path, or resets the current path\n ctx.moveTo(lastX, lastY); //Moves the path to the specified point in the canvas, without creating a line\n ctx.lineTo(e.offsetX, e.offsetY); //Adds a new point and creates a line to that point from the last specified point in the canvas\n ctx.stroke(); //Actually draws the path you have defined\n [lastX, lastY] = [e.offsetX, e.offsetY]; // return the xy coordinate of the mouse pointer \n }", "function draw_line(e){\n\n //console.log(\"PrevX:\"+prevX);\n draw_dot(e);\n \n ctx.lineTo(e.offsetX,e.offsetY);\n \n ctx.stroke();\n\n //console.log(\"PrevX:\"+prevX);\n}", "function updateScreen() {\n drawPointer();\n moveTo(1000,1000); // moves turtle off the screen\n penUp();\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 }", "interact() {\r\n\r\n // lamp light turns on\r\n {\r\n push();\r\n translate(-40, 0);\r\n if (this.light) {\r\n fill(245, 251, 236, 150);\r\n quad(602, 252, 626, 252, 680, 452, 560, 452);\r\n //this.light = false;\r\n } else {\r\n //this.light = false;\r\n }\r\n pop();\r\n }\r\n\r\n //collide with ledge \r\n\r\n }", "updateGuidingLinePos(){\n if(this.guidingLine == undefined){\n return;\n }\n if(this.board.gameOverTriggered){\n return;\n }\n //guiding line will always go from the last node in the path\n var mousePos = this.board.game.input.activePointer;;\n var modMousePosX = this.board.game.input.activePointer.positionToCamera(this.board.game.cameras.main).x;\n var modMousePosY = this.board.game.input.activePointer.positionToCamera(this.board.game.cameras.main).y;\n this.guidingLineGraphics.clear();\n var lerpedPosX = Phaser.Math.Interpolation.Linear([this.guidingLine.x2, modMousePosX], 0.3);\n var lerpedPosY = Phaser.Math.Interpolation.Linear([this.guidingLine.y2, modMousePosY], 0.3);\n this.guidingLine.setTo(this.getTail().getOffSetPos().x,this.getTail().getOffSetPos().y, lerpedPosX, lerpedPosY);\n\n //helper to progamatically include as many segments of the animation for the leading line\n var lineLength = Phaser.Geom.Line.Length(this.guidingLine);\n var numSegments = Math.floor(lineLength/(64 * this.board.hexScale));\n if(numSegments > this.pointerPath.length){\n var newSegment = this.board.game.add.sprite(0,0, \"ph_pointerPath\");\n newSegment.anims.play(\"POINTERPATH_IDLE\");\n this.pointerPath.push(newSegment);\n newSegment.setOrigin(0,0.5);\n newSegment.setScale(this.board.hexScale);\n\n }\n if(numSegments < this.pointerPath.length){\n var pathToRemove = this.pointerPath.splice(this.pointerPath.length-1, 1);\n pathToRemove[0].destroy();\n\n }\n //draw out each segment for the leading line\n var angle = Phaser.Math.Angle.Between(this.guidingLine.x1, this.guidingLine.y1, this.guidingLine.x2, this.guidingLine.y2)\n for(var i = 0; i< this.pointerPath.length; i++){\n //var xPos = Phaser.Phaser.Math.Interpolation.Linear[]\n var xPos = this.getTail().getOffSetPos().x + Math.cos(angle) * (64*this.board.hexScale * i);\n var yPos = this.getTail().getOffSetPos().y + Math.sin(angle) * (64*this.board.hexScale * i);\n this.pointerPath[i].setAngle(angle * Phaser.Math.RAD_TO_DEG);\n this.pointerPath[i].setPosition(xPos,yPos);\n }\n this.pointerImage.setPosition(lerpedPosX, lerpedPosY);\n\n }", "function startWriteHandoff() {\n if(isUser) { // user page\n return;\n }\n\n d3.event.stopPropagation();\n\n INTERACTION_TASK_ONE_IDNUM = this.getAttribute('groupNum');\n DRAWING_HANDOFF = true;\n var m = d3.mouse(this);\n //console.log(\"x: \" + m[0] + \" y: \" + m[1]);\n \n var timelineSvg = window._foundry.timeline.timelineSvg;\n var handoffLayerSvg = window._foundry.timeline.handoffLayer;\n line = handoffLayerSvg.append(\"line\")\n .attr(\"class\", \"followingLine\")\n .attr(\"x1\", m[0])\n .attr(\"y1\", m[1])\n .attr(\"x2\", m[0])\n .attr(\"y2\", m[1])\n .attr(\"stroke-width\", 3)\n .attr(\"stroke\", \"gray\");\n timelineSvg.on(\"mousemove\", interMouseMove);\n}", "function mousePressed(){\n\tnext = 0;\n\tdrawing = true;\n\tlast.x = mouseX;\n\tlast.y = mouseY;\n\tlines.push(new Line());\n}", "function mouseMove(){\n\tvar x = event.clientX;\n\tvar tester = x-278;\n\tif(mousestatus == true){\n\t\tif (x>=278 && x<=465){\n\t\t\tposition = x;\n\t\t\ttracker=tester;\n\t\t\tball.setAttribute(\"cx\", x);\n\t\t\tb.setAttribute(\"x1\", x);\n\t\t\tt.setAttribute(\"x2\", x);\n\t\t\ta.transform.baseVal.getItem(0).setTranslate(tester, 0);\n\t\t\tupdate();\n\t\t}\n\t\t}\n\n}", "function renderCrosshairUpdateLogic () {\n crosshairX = SI.game.Renderer.getScene().getMouseX() - crosshairSpriteHalfSize;\n crosshairY = SI.game.Renderer.getScene().getMouseY() - crosshairSpriteHalfSize;\n }", "function trackPosition(e) {\n\tmouse.x = e.pageX;\n\tmouse.y = e.pageY;\n}", "function mouseMoved(){\n stroke(r, g, b, 120);\n strokeWeight(5);\n fill(r, g, b, 100);\n ellipse(mouseX, mouseY, 10);\n}", "externalMouseMove() {\n this._strikeMouseMove();\n this._localPointer._mouseX = this.getPointer()._mouseX;\n this._localPointer._mouseY = this.getPointer()._mouseY;\n }", "mouseMove(evt, point) {\n this.setHover(this.topBlockAt(point));\n }", "function mouseTracker(){\n\tif(jQuery('#mouse-tracker-wrap').length){\n\t\tdocument.querySelector('#mouse-tracker-wrap').onmousemove = (e) => {\n\t\t\tconst x = e.pageX - e.target.offsetLeft\n\t\t\tconst y = e.pageY - e.target.offsetTop\n\n\t\t\tvar y1 = e.pageY;\n\t\t\tvar y2 = e.target.offsetTop;\n\t\t\tconsole.log(x);\n\t\t\tconsole.log(y);\n\n\t\t\te.target.style.setProperty('--x', `${ x }px`)\n\t\t\te.target.style.setProperty('--y', `${ y }px`)\n\t\t}\n\t}\t\n}", "updateSkierTrail(step) {\n\t\tif (!this.skier.isAlive) return;\n\n\t\t// add coordinate to skier trail\n\t\tif (!this.skier.isStopped && !this.skier.isJumping) {\n\t\t\tthis.skierTrail.push({ x: 2, y: 24 });\n\t\t}\n\t\t\n\t\tfor (let i = 0; i < this.skierTrail.length; i++) {\n\t\t\t// update position of skier trail coordinates\n\t\t\tthis.skierTrail[i].x -= this.skier.xv * step;\n\t\t\tthis.skierTrail[i].y -= this.skier.yv * step;\n\n\t\t\t// delete offscreen skier trail\n\t\t\tif (this.skierTrail[i].y < -window.innerHeight / 3) {\n\t\t\t\tthis.skierTrail.splice(i, 1);\n\t\t\t}\n\t\t}\n\t}", "drawPoint(p) {\n if (this.connectWithPrev) {\n p.line(\n 0,\n 0,\n this.prevPos.x - this.pos.x,\n this.prevPos.y - this.pos.y\n );\n } else {\n p.point(0, 0);\n }\n }", "function leerMouse(){\n\n//--- Rueda del Mouse ---------------\nif(Math.abs(deltaRueda) > 0){\n\tvar kd = 0.05;\t\t\t\t//constante de ajuste\n\tvar x = camara.position.x;\n\tvar y = camara.position.y;\n\tvar z = camara.position.z;\n\tvar d0 = Math.sqrt(x*x + y*y + z*z);\t\t//Distancia inicial\n\tvar d1 = d0 + (deltaRueda * kd);\t\t\t\t//Nueva distancia\n\tvar fact = d1 / d0;\t\t\t\t\t\t\t\t//porcentaje de ajuste a cada eje\n\tcamara.position\t.x = x * fact;\n\tcamara.position\t.y = y * fact;\n\tcamara.position\t.z = z * fact;\n}\ndeltaRueda\t= 0;\n}", "animate(){\n\n this.jump();\n\n this.move();\n\n this.applyGravity();\n\n this.applyCollisions();\n\n this.controlAnimations();\n\n this.checkSkyboxBounds();\n\n this.directionalLightObject.position.set(\n this.scene.crosshair.position.x+1,\n this.scene.crosshair.position.y+1,\n this.scene.crosshair.position.z+1\n )\n\n //}\n\n }", "function lerp(point1, point2, t)\r\n{\r\n var npx = point1.x * (1 - t) + point2.x * t; // new point x-coordinate\r\n var npy = point1.y * (1 - t) + point2.y * t; // new point y-coordinate\r\n return new MouseClick(npx, npy);\r\n}", "function mouse_down(e) {\n var h = e.pageX - Number($('#can').css('left').replace('px', ''));\n var w = e.pageY - Number($('#can').css('top').replace('px', ''));\n draw = true;\n context.beginPath();\n context.lineWidth = 3;\n context.lineJoin = context.lineCap = 'round';\n context.shadowBlur = 0;\n context.shadowColor = 'rgb(0, 0, 0)';\n context.moveTo(h, w);\n }", "drawTurtle() {\n //CURRENT PATHS\n this.path.moveTo(this.CP.x, this.CP.y);\n this.points = this.path.getPoints();\n this.geometry = this.geometry.setFromPoints(this.points);\n // this.material = new THREE.LineBasicMaterial({ color: 0xffffff });\n this.line = new THREE.Line(this.geometry, this.material);\n // return this.line;\n return this.line;\n }", "function target(event) {\n\tconst target = {//initialize target object\n\t\tcycles: 50,\n\t\torigin: [event.clientX - 8, event.clientY - 8],\n\t\treticle: {\n\t\t\tdimensions: [10, 10],\n\t\t\tcolor: 'green'\n\t\t},\n\t\tline: {\t\t\t\n\t\t\tcolor: 'yellow',\n\t\t\tprogress: .01\t\t\t\n\t\t},\n\t\texplosion: {\n\t\t\tmaxSize: 30,\n\t\t\tcolor: ['red', 'yellow'],\n\t\t\tsize: 1\n\t\t}\t\t\n\t}\n\ttarget.reticle.offset = [\n\t\ttarget.origin[0] - target.reticle.dimensions[0] / 2,\n\t\ttarget.origin[1] - target.reticle.dimensions[1] / 2\n\t]\n\tconst source = weighBases(event.clientX)\n\tif (source === null) {\n\t\treturn\n\t} else {\n\t\ttarget.line.source = source\n\t}\n\ttarget.line.start = source.fireFrom()\n\ttarget.line.vector = [\n\t\ttarget.origin[0] - target.line.start[0],\n\t\ttarget.origin[1] - target.line.start[1]\t\t\n\t]\n\ttarget.line.magnitude = Math.sqrt(Math.pow(target.line.vector[0], 2) \n\t\t\t\t\t\t\t\t\t\t+ Math.pow(target.line.vector[1], 2))\n\ttarget.line.vector = [\n\t\ttarget.line.vector[0] / target.line.magnitude, \n\t\ttarget.line.vector[1] / target.line.magnitude\n\t]\n\ttarget.line.end = () => [\n\t\t((target.line.magnitude * target.line.progress) * target.line.vector[0]), \n\t\t((target.line.magnitude * target.line.progress) * target.line.vector[1])\n\t]\n\ttarget.line.source.canFire = false\n\n\n\ttarget.draw = () => {\t\t\n\t\tif (target.cycles > 35) {//draw reticle where click happened\n\t\t\tcontext.save()\n\t\t\tcontext.strokeStyle = target.reticle.color\n\t\t\tcontext.translate(target.reticle.offset[0], target.reticle.offset[1])\n\t\t\tcontext.strokeRect(0, 0, target.reticle.dimensions[0], target.reticle.dimensions[1])\t\n\t\t\tcontext.restore()\n\t\t}\t\t\n\t\tif (target.cycles > 15) {//draw laser\t\n\t\t\tcontext.save()\t\n\t\t\tcontext.strokeStyle = target.line.color\n\t\t\tcontext.translate(target.line.start[0], target.line.start[1])\n\t\t\tcontext.beginPath()\n\t\t\tcontext.moveTo(0, 0)\n\t\t\tcontext.lineTo(target.line.end()[0], target.line.end()[1])\n\t\t\tcontext.stroke()\n\t\t\tcontext.restore()\n\t\t\tif (target.line.progress < 1 ) {//'animate' laser\n\t\t\t\ttarget.line.progress += .04\n\t\t\t}\t\t\t\n\t\t}\t\n\t\tif (target.cycles <= 25) {//draw explosion\t\t\n\t\t\tcontext.save()\n\t\t\tcontext.fillStyle = target.explosion.color[0]\n\t\t\tcontext.strokeStyle = target.explosion.color[1]\n\t\t\tcontext.translate(target.origin[0], target.origin[1])\n\t\t\tcontext.beginPath()\n\t\t\tcontext.arc(0, 0, target.explosion.size, 0, 360)\n\t\t\tcontext.fill()\n\t\t\tcontext.stroke()\n\t\t\tcontext.restore()\n\t\t\ttarget.explosion.size += target.explosion.maxSize / 20 //'animate' explosion\n\n\t\t\tmissileArray = missileArray.filter(ele => {//check if the head of missile touches an explosion\n\t\t\t\tconst colided = (origin, target) => {\n\t\t\t\t\treturn Math.pow(origin[0] - target.origin[0], 2) \n\t\t\t\t\t\t\t+ Math.pow(origin[1] - target.origin[1], 2)\n\t\t\t\t\t\t\t<= Math.pow(target.explosion.size, 2)\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (colided(ele.origin, target) && !ele.explode) {\t\t\t\t\t\n\t\t\t\t\tele.explode = true\n\t\t\t\t\tscore++\n\t\t\t\t}\n\t\t\t\treturn ele\n\t\t\t})\n\t\t}\t\n\t\tif (target.cycles === 25) {\n\t\t\ttarget.line.source.canFire = true\n\t\t}\n\t\ttarget.cycles--\n\t}\n\ttargetArray.push(target)\n}", "function tick(event) {\n movementLine = new createjs.Shape();\n movementLine.graphics.setStrokeStyle(5).beginStroke(\"#ffffff\");\n movementLine.graphics.moveTo(playerObject.x, playerObject.y);\n lineContainer.addChild(movementLine);\n\n for(var i = 0; i < 10; i++){\n movementLine.graphics.lineTo(playerObject.x + i*50, playerObject.y + i*50);\n }\n\n\n movementLine.clear();\n //mousemovement stuff\n /*playerObject.on(\"pressmove\", function(e) {\n moving = true;\n\n // Create a new arrow on stage press\n //current = new createjs.Shape().set({x:stage.mouseX, y:stage.mouseY});\n movementLine = new createjs.Shape();\n movementLine.graphics.setStrokeStyle(5).beginStroke(\"#ffffff\");\n movementLine.graphics.moveTo(playerObject.x, playerObject.y);\n //this shit helps a lot\n lineContainer.addChild(movementLine);\n\n // Update the current arrow on move\n var moveListener = stage.on(\"stagemousemove\", function(e) {\n // Determine the length between the start and end point using pythagoras\n var w = stage.mouseX - movementLine.x;\n var h = stage.mouseY - movementLine.y;\n\n movementLine.graphics.clear();\n movementLine.graphics.setStrokeStyle(5).beginStroke(\"#ffffff\");\n movementLine.graphics.moveTo(playerObject.x,playerObject.y);\n movementLine.graphics.lineTo(stage.mouseX, stage.mouseY);\n //var l = Math.sqrt(w*w+h*h);\n\n // Draw the arrow.\n // Math.sqrt on the amplitude and frequency make it scale as it gets larger\n //drawArrow(current, l, Math.sqrt(l), Math.sqrt(l));\n\n // Rotate to touch the mouse, i dont know why but setting the playerObject rotation the same with the movementLine makes the whole thing more smooth\n movementLine.graphics.rotation = playerObject.rotation = Math.atan2(h,w) * 180/Math.PI;\n stage.update();\n });\n\n // Stop the drag\n var upListener = stage.on(\"stagemouseup\", function() {\n stage.off(\"stagemousemove\", moveListener);\n stage.off(\"stagemouseup\", upListener);\n movementLine = null;\n });\n });*/\n\n\n\n //move the obstacles while player is alive\n // if(alive && !moving){\n // moveObstacles();\n // }else{\n // alive = false;\n // endGame();\n // }\n}", "function followCursor() {\n if (!exploding) {\n var index = intervalCount % numBalls;\n intervalCount++;\n cursorPositions[index] = [window.xPos, window.yPos];\n d3.select(\"#circle\" + index).transition()\n .duration(240)\n .style(\"top\", (cursorPositions[index][1] + \"px\"))\n .style(\"left\", (cursorPositions[index][0] + \"px\"));\n for (var a = 0; a < circles.length; a++) {\n var xCord = cursorPositions[a][0];\n var yCord = cursorPositions[a][1];\n var circleElem = \"#circle\" + a;\n d3.select(circleElem).style(\"background\", colors[a]);\n }\n }\n }", "function setHook() {\n push();\n if (hookDown === 0) {\n hook.x = mouseX + 70;\n hook.y = mouseY - 70;\n fill(255, 0, 0);\n ellipse(hook.x, hook.y, hook.size);\n pop();\n }\n}", "mouseOn() {\n if (mouseX > this.x && mouseX < this.x + this.w\n && mouseY > this.y && mouseY < this.y + this.h) {\n this.mouseover = true;\n this.stroke = 3;\n }\n else {\n this.mouseover = false;\n this.stroke = 2;\n }\n }", "seek(){\n\t\tvar dif = this.target.pos.minus(this.pos);\n\t\tdif = dif.normalized(this.seekspeed);\n\t\tthis.vel = this.vel.plus(dif.multiply(dt));\n\t}", "function mymousemove(e){\r\n\r\nvar currentX = e.clientX-canvas.offsetLeft;\r\nvar currentY = e.clientY-canvas.offsetTop;\r\nif(mouseevents==\"mousedown\"){\r\n\r\nctx.beginPath();\r\nctx.strokeStyle=color;\r\nctx.lineWidth=width;\r\nctx.arc(currentX, currentY, 40, 0, 360);\r\nctx.stroke();\r\n\r\n}\r\nlast_x=currentX;\r\nlast_y=currentY;\r\n\r\n}", "function trackPosition(e) {\n mouse.x = e.pageX;\n mouse.y = e.pageY;\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 }", "shoot_laser(){\n if(this.sound.laser.paused && !this.gameOver && !this.shieldUp){\n var new_laser = [1, this.camera_angle+Math.PI/2];\n this.laser_pos.push(new_laser);\n this.sound.laser.play()\n }\n }", "function Walker() {\n this.pos = createVector(width/2, height/2); // v1\n this.vel = createVector(0,0);\n\n this.update = function() {\n let mouse = createVector(mouseX, mouseY); // mouse vector position\n this.acc = p5.Vector.sub(mouse, this.pos); // accel = pos - mouse\n // this.acc.normalize();\n // this.acc.mult(.5);\n this.acc.setMag(.5);\n; this.vel.add(this.acc);\n this.pos.add(this.vel);\n }\n\n this.display = function() {\n background(0);\n fill(200);\n ellipse(this.pos.x, this.pos.y, 10, 10);\n }\n}", "function SwatterCross() {\n ctx.beginPath();\n ctx.moveTo(mouse.x + 14, mouse.y + 27);\n ctx.lineTo(mouse.x + 43, mouse.y + 28);\n ctx.strokeStyle = '#D04D00';\n ctx.stroke();\n\n ctx.beginPath();\n ctx.moveTo(mouse.x + 28, mouse.y + 12);\n ctx.lineTo(mouse.x + 28, mouse.y + 42);\n ctx.strokeStyle = '#D04D00';\n ctx.stroke();\n\n ctx.beginPath();\n ctx.arc(mouse.x + 28, mouse.y + 27, 5, 0, Math.PI * 2, false);\n ctx.strokeStyle = '#D04D00';\n ctx.stroke();\n}", "function startPosition(){\n painting = true;\n }", "function drawHere(e, canvas, isLine){\n var mouseX = e.pageX - canvas.offsetLeft;\n var mouseY = e.pageY - canvas.offsetTop;\n\tif(isLine == 'line'){\n doTo(['all'], 'draw', myColor, pastX, pastY, mouseX, mouseY);\n\t}else{\n doTo(['all'], 'draw', myColor, mouseX -1, mouseY, mouseX, mouseY);\n\t}\n\tpastX = mouseX;\n\tpastY = mouseY;\n}", "trace() {\n this.notifyAll({\n x: Math.round(this.mouseTracker.x - this.#app.stage.offset.x),\n y: Math.round(this.mouseTracker.y - this.#app.stage.offset.y)\n });\n\n this.#app.layer(\"trace\").clear();\n this.#app.layer(\"trace\").sketch({\n shape: \"tracer\",\n color: \"rgb(150, 0, 0)\",\n start: this.mouseTracker.current\n });\n \n // Optional return. Just to let the client know that method has worked fine.\n return true;\n }", "function i(e){var t=H=e,n=t.clientX,i=t.clientY;if(Q.popperInstance){var r=Q.reference.getBoundingClientRect(),o=Q.props.followCursor,a=\"horizontal\"===o,s=\"vertical\"===o;Q.popperInstance.reference={getBoundingClientRect:function e(){return{width:0,height:0,top:a?r.top:i,bottom:a?r.bottom:i,left:s?r.left:n,right:s?r.right:n}},clientWidth:0,clientHeight:0},Q.popperInstance.scheduleUpdate()}}", "function handleDestination() {\n\n\n\n //old stuff\n /* console.log(\"tween completed\");\n playerObjectX = playerObject.x;\n playerObjectY = playerObject.y;\n targetX = lines[currentTargetNumber][0];\n targetY = lines[currentTargetNumber][1];\n\n console.log(playerObjectX);\n console.log(playerObjectY);\n stage.update();\n currentTargetNumber += 1;*/\n}", "function movelight(){\n\tif (lightType === 'Far'){\n\t\tlightDir = lightPath(millis()/20);\n\t} else if (lightType === 'Close'){\n\t\tlightPos = mp[0].p3;\n\t}\n}", "function startWriteHandoff() {\n if(isUser) { // user page\n return;\n }\n\n d3.event.stopPropagation();\n\n INTERACTION_TASK_ONE_IDNUM = this.getAttribute('groupNum');\n DRAWING_HANDOFF = true;\n var m = d3.mouse(this);\n //console.log(\"x: \" + m[0] + \" y: \" + m[1]);\n line = timeline_svg.append(\"line\")\n .attr(\"class\", \"followingLine\")\n .attr(\"x1\", m[0])\n .attr(\"y1\", m[1])\n .attr(\"x2\", m[0])\n .attr(\"y2\", m[1])\n .attr(\"stroke-width\", 3)\n .attr(\"stroke\", \"gray\");\n timeline_svg.on(\"mousemove\", interMouseMove);\n}", "setPosition(e) {\n\n this.mouseIsDown = true;\n this.ctx.beginPath();\n this.ctx.moveTo(e.offsetX, e.offsetY);\n\n // Ajouter un event pour commencer à dessiner lorsq'on deplace la souris //\n this.carte.signElt.addEventListener('mousemove', (e) => { this.draw(e) });\n\n }", "function mouseDraw(event) {\n // stop if not mouse down\n if (!isDrawing) return;\n\n // * set the stroke color\n ctx.strokeStyle = color;\n\n // draw the line\n ctx.beginPath();\n ctx.moveTo(lastX, lastY);\n // console.log(lastX, lastY);\n // console.log(event.offsetX, event.offsetY);\n\n ctx.lineTo(event.offsetX * 2, event.offsetY * 2);\n ctx.stroke();\n\n // reset lastX and lastY to be current event's offsetX and offsetY\n [lastX, lastY] = [event.offsetX * 2, event.offsetY * 2];\n}", "function drawHandLag(ctxLag, pos, length, width) {\n ctxLag.beginPath();\n ctxLag.lineWidth = width;\n ctxLag.lineCap = \"round\";\n ctxLag.moveTo(0,0);\n ctxLag.rotate(pos);\n ctxLag.lineTo(0, -length);\n ctxLag.stroke();\n ctxLag.rotate(-pos);\n}", "function step() {\n TrafficLight.change();\n TrafficLight.draw(ctx);\n}", "function canvas_mouseDown() {\n mouseDown=1;\n drawLine(ctx,mouseX,mouseY,12);\n\n}", "function drawPointer() {\n var centerX = (zeroX+squareSize/2) + Pointer.x*squareSize;\n var centerY = (zeroY+squareSize/2) + Pointer.y*squareSize;\n \n if(Pointer.dir == \"up\") {\n drawTri(centerX - triSize/2, centerY + triSize/2, Pointer.dir);\n } else if(Pointer.dir == \"right\") {\n drawTri(centerX - triSize/2, centerY - triSize/2, Pointer.dir);\n } else if(Pointer.dir == \"down\") {\n drawTri(centerX + triSize/2, centerY - triSize/2, Pointer.dir);\n } else if(Pointer.dir == \"left\") {\n drawTri(centerX + triSize/2, centerY + triSize/2, Pointer.dir);\n }\n penUp();\n}", "draw(e) {\n\n if (this.mouseIsDown) {\n this.ctx.lineWidth = 3;\n this.ctx.lineCap = 'round';\n this.ctx.strokeStyle = 'yellow';\n this.ctx.lineTo(e.offsetX, e.offsetY);\n this.ctx.stroke();\n this.isSigned = true;\n\n }\n\n }", "function drawCrosshair(x, y) {\n var r = 6.5 * window.innerWidth / window.outerWidth;\n\n x = floor(x);\n y = floor(y);\n\n for (var n = 0 ; n < 2 ; n++) {\n _g.strokeStyle = n == 0 ? backgroundColor : defaultPenColor;\n _g.lineWidth = bgClickCount == 1 ? 1 : 3;\n\n _g_beginPath();\n _g_moveTo(x - r, y);\n _g_lineTo(x + r, y);\n _g_stroke();\n\n _g_beginPath();\n _g_moveTo(x, y - r);\n _g_lineTo(x, y + r);\n _g_stroke();\n }\n }", "function setupMouseMove(){\n\t\tcanvas.addEventListener('mousemove', function(e){\n\t\t\t\tdocument.body.style.backgroundImage = \"url('')\";\n\t\t\t\t\n\t\t\t\tvar currentXMovement = e.movementX;\n\t\t\t\tcurrentRotateY += currentXMovement + prevX;\n\t\t\t\tprevX = currentXMovement;\n\t\t\t\tyaw = currentRotateY * rotateSpeed;\n\t\t\t\t\n\t\t\t\tvar currentYMovement = e.movementY;\n\t\t\t\tcurrentRotateX += currentYMovement + prevY;\n\t\t\t\tprevY = currentYMovement;\n\t\t\t\tpitch = -currentRotateX * rotateSpeed;\n\t\t\t\t\n\t\t\t\t// Stops the camera sticking to the bottom/top of scene\n\t\t\t\tif(pitch > 70){\n\t\t\t\t\tpitch = 70;\n\t\t\t\t\tcurrentRotateX = -850;\n\t\t\t\t}\n\t\t\t\tif(pitch < -70){\n\t\t\t\t\tpitch = -70;\n\t\t\t\t\tcurrentRotateX = 850;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Should be in radians first\n\t\t\t\tvar pitchInRadians = utility.toRadians(pitch);\n\t\t\t\tvar yawInRadians = utility.toRadians(yaw);\n\n\t\t\t\tcameraTarget[0] = Math.cos(pitchInRadians) * Math.cos(yawInRadians);\n\t\t\t\tcameraTarget[1] = Math.sin(pitchInRadians);\n\t\t\t\tcameraTarget[2] = Math.cos(pitchInRadians) * Math.sin(yawInRadians);\n\n\t\t\t\tm4.normalize(cameraTarget);\n\t\t});\t\t\n\t}", "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 addMouseEvent() {\n document.addEventListener('mousemove', updateScreenCoords);\n\n // gsap's RAF, falls back to set timeout\n gsap.ticker.add(animateFace);\n\n blink.play();\n }" ]
[ "0.6623059", "0.6256627", "0.61688584", "0.6162687", "0.6136588", "0.6136588", "0.6106844", "0.60663706", "0.603016", "0.59770775", "0.59696585", "0.5961057", "0.5933689", "0.5903817", "0.58774084", "0.5858013", "0.58573806", "0.58380884", "0.5827353", "0.58161414", "0.58106804", "0.5773069", "0.5744825", "0.57220155", "0.57212824", "0.5718715", "0.5693449", "0.5668195", "0.56672937", "0.56345284", "0.5632497", "0.5627703", "0.56199205", "0.55993664", "0.5592432", "0.55876446", "0.5573161", "0.5558938", "0.5548159", "0.5541377", "0.55406815", "0.5536478", "0.5528624", "0.55280447", "0.55272233", "0.5521528", "0.55071664", "0.55008966", "0.54884064", "0.54784334", "0.5477898", "0.5476429", "0.54739374", "0.5472828", "0.54653805", "0.5450105", "0.5448527", "0.54462546", "0.54427874", "0.5439959", "0.5438683", "0.54371715", "0.5435276", "0.54327285", "0.54232836", "0.542313", "0.5421232", "0.54187137", "0.5407415", "0.5406024", "0.5405737", "0.53998613", "0.5394338", "0.53904736", "0.538765", "0.53825986", "0.5369967", "0.5368962", "0.53675115", "0.5365449", "0.5364058", "0.53616774", "0.53615534", "0.5360786", "0.5353935", "0.5353294", "0.53477573", "0.5343817", "0.53408706", "0.53322566", "0.53315216", "0.53297216", "0.53285897", "0.5326922", "0.53250974", "0.5322327", "0.53092057", "0.53086704", "0.53014445", "0.5300598" ]
0.73703915
0
gets trail to catch up when mouse stops
function catchUp(event) { var i = 0; clearInterval(timer); timer = setInterval(function() { if (i >= 10) { clearInterval(timer); } trail[count%10].style.left = (event.pageX - 4) + "px"; trail[count%10].style.top = (event.pageY - 4) + "px"; count++; i++ }, 50); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_stop_mouse_track() {\n\t\t\tif (this.track_id) {\n\t\t\t\tthis.track_id = clearInterval(this.track_id);\n\t\t\t}\n\t\t\tthis.add_info('movement', this.current_mouse_movement, 'shape');\n\t\t}", "function mouseReleased() {\n stamped =false;\n}", "function mouseReleased () {\n noLoop();\n}", "function mouseUp(event) {\n mouseIsDown = false;\n // if (drawHandle !== -1) {\n // clearInterval(drawHandle);\n // drawHandle = -1;\n // }\n }", "function mouseReleased(){\n\tdrawing = false;\n}", "_handleMouseOver() {\n\t\tthis._pauseTimeout();\n\t}", "externalMouseUp() {\n this._strikeMouseUp();\n this._localPointer._mouseIsActive = false;\n }", "function sketchpad_mouseUp() {\n mouseDown=0;\n }", "function stopDraw(e) {\n\t\tbrush_size = 1;\n\t\te.preventDefault();\n\t\tcanvas.onmousemove = null;\t\n\t}", "function stopPressPen() {\n isDrawning = false\n\n // need to stop the line, so I need to restart the line\n context.beginPath()\n }", "function mouseReleased() {\r\n mouseIsDown = false;\r\n}", "function stopDrawing(event) {\n isDrawing = false;\n [lastX, lastY] = [0, 0];\n}", "externalMouseDown() {\n this._strikeMouseDown();\n this._localPointer._mouseIsActive = true;\n }", "function mouseReleased() {\n osc.fade(0,0.5);\n }", "function stopSeek() {\n isMouseDown = false;\n\n clearTimeout(navTimer);\n }", "function mouseReleased() {\n loop();\n}", "function mouseDown(event) {\n mouseIsDown = true;\n // if (drawHandle === -1) {\n // drawHandle = setInterval(mousePressed, 100);\n // }\n }", "function mysketchpad_mouseUp() {\n mouseDown = 0;\n lastX=-1;\n lastY=-1;\n }", "function sketchpad_mouseUp() {\n mouseDown=0;\n}", "function sketchpad_mouseUp() {\n mouseDown=0;\n}", "function sketchpad_mouseUp() {\n mouseDown=0;\n}", "function sketchpad_mouseUp () {\n mouseDown = 0\n}", "function mouseDown(){\n\tif (mousestatus == false){\n\t\tmousestatus=true;\n\t\tball.setAttribute(\"r\", \"300\");\n\t\t}\n\t\n}", "function mousePressed() {\n noLoop();\n mouseDragged();\n}", "function mainLoop(){\n if(mouse.click && mouse.move && mouse.pos_prev){\n socket.emit('draw_line',{line:[mouse.pos,mouse.pos_prev],txtcolor:color});\n mouse.move = false;\n }\n mouse.pos_prev = {x:mouse.pos.x,y:mouse.pos.y};\n setTimeout(mainLoop,25);\n}", "function mouseUp() { }", "function mouseReleased(){\n //unstretch foreo\n on();\n }", "listenDragging() {\n this.pointRender.pause();\n }", "function out() {\n // Figure out the distance or speed of the mouse.\n \n // Modify MAX_SPEED and MAX_DURATION according to mouse speed.\n // The rest will be handled by the other functions.\n // Both MAX_SPEED and MAX_DURATION must become bigger as the mouse speed becomes faster.\n \n // Start the animation\n start();\n}", "function myUp() {\n canvas.onmousemove = null;\n}", "function endingPoint() {\n painting = false;\n ctx.beginPath();\n }", "function mouseUp() {\n console.log(\"Mouse Up\");\n mouseDownPress = false;\n}", "function sketchpad_mouseDown() {\n mouseDown=1;\n drawDot(ctx,mouseX,mouseY,6);\n }", "function touchMoved() {\n strokeWeight(10);\n stroke(252, 74, 26);\n\n line(mouseX, mouseY, pmouseX, pmouseY);\n return false;\n}", "function mouseup(){\n mouse_down = false;\n}", "function step() {\n TrafficLight.change();\n TrafficLight.draw(ctx);\n}", "function mouseMoved(){\n stroke(r, g, b, 120);\n strokeWeight(5);\n fill(r, g, b, 100);\n ellipse(mouseX, mouseY, 10);\n}", "move(){\r\n if (this.counter % this.trajectory[this.step][Trajectory.Duration] == 0) {\r\n this.hide()\r\n this.step ++\r\n this.counter= 0\r\n basic.pause(50)\r\n if (this.step == this.trajectory.length) {\r\n this.active = false \r\n } else {\r\n this.y = this.trajectory[this.step][Trajectory.Vertical]\r\n led.plotBrightness(this.x, this.y, this.y == 4 ? 255 : this.brightness)\r\n }\r\n this.show()\r\n }\r\n this.counter ++\r\n }", "function myUp(){\n canvas.onmousemove=null;\n}", "function mouseUp(){\n\tif (mousestatus == true){\n\t\tmousestatus=false;\n\t\tball.setAttribute(\"r\", \"10\");\n\t\t}\n\n}", "function dropHook() {\n if (hookDown === 1) {\n splash = 1\n\n droppedhook.x = hook.x;\n droppedhook.y = hook.y;\n fill(255, 0, 0);\n ellipse(droppedhook.x, droppedhook.y, hook.size);\n stroke(150);\n line(droppedhook.x, droppedhook.y, mouseX + 70, mouseY - 70);\n for (let o = 0; o < 5; o++ ){\n splash = 0\n }\n}\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 canvas_mouseDown() {\n mouseDown=1;\n drawLine(ctx,mouseX,mouseY,12);\n\n}", "function sketchpad_mouseDown() {\n g_mouseDown = 1;\n drawDot(g_ctx, g_mouseX, g_mouseY, 12);\n}", "function stop (){\n\t\t\t\t// Switch the paint status to false\n\t\t\t\tpaint = false;\n\t\t\t}", "function mouse_up_handler() {\n mouse.down = false; \n }", "function mouseStatusDown(evt) {\n evt.preventDefault();\n mouseStatus = 'down';\n paintPixel(evt);\n}", "function sketchpad_mouseDown() {\n mouseDown=1;\n drawDot(ctx,mouseX,mouseY,1);\n}", "mouseout(evt) {\n//-------\n// Without getting into a more elaborate event bubbling/capturing\n// set up we have no way of detecting whether or not a subsequent\n// mouseover is a continuation of the current drag (assuming\n// mousedown is true at the present stage) -- so it''s best for us\n// to treat every mouseout as an implicit mouseup, forcing\n// termination of any camera-changing drags.\nreturn this.mouseup();\n}", "function mouseReleased() {\n direction = null;\n}", "function _onMousedown(event) {\n if (event.button === 0 && !isMouseDown && _injectors.$state.current.data.mode == \"record\") {\n isMouseDown = true;\n intervalId = setInterval(_extendSpline, 50);\n lastPoint = _stage.getPointerPosition();\n pointCount = 1;\n drawingStarted = new Date().getTime();\n }\n }", "_strikeMouseDown() {\n for (let i = 0; i < this._mouseDownCallbacks.length; i++) {\n let currentCallback = this._mouseDownCallbacks[i][0];\n\n currentCallback(this, event);\n }\n\n for (let i = 0; i < this._mouseDownCallbacks.length; i++) {\n if (this._mouseDownCallbacks[i][1])\n this._mouseDownCallbacks.splice(i--, 1);\n }\n }", "function mouseSeeker() {\n\tstroke(230);\n\tline(mouseX, 0, mouseX, height);\n\tline(0, mouseY, width, mouseY);\n\t//color(0,0);\n\t//rect(0,0,959,383);\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 sketchpad_mouseDown() {\n mouseDown=1;\n ctx.beginPath();\n drawLine(ctx,mouseX,mouseY);\n console.log('A line is drawn!')\n}", "async mouseAway() {\n await this._actions().mouseMove(this.element(), { x: -1, y: -1 }).perform();\n await this._stabilize();\n }", "function mousePressed() {\r\n target.position.x = mouseX;\r\n target.position.y = mouseY;\r\n recordtime = lifetime;\r\n}", "function OnMouseExit() {\n\tisMouseEnter = false;\n\t\n}", "trace() {\n this.notifyAll({\n x: Math.round(this.mouseTracker.x - this.#app.stage.offset.x),\n y: Math.round(this.mouseTracker.y - this.#app.stage.offset.y)\n });\n\n this.#app.layer(\"trace\").clear();\n this.#app.layer(\"trace\").sketch({\n shape: \"tracer\",\n color: \"rgb(150, 0, 0)\",\n start: this.mouseTracker.current\n });\n \n // Optional return. Just to let the client know that method has worked fine.\n return true;\n }", "mouseDown(pt) {}", "mouseDown(pt) {}", "function mouseReleased() {\n osc.fade(0,0.5);\n}", "function mouseReleased() {\n osc.fade(0,0.5);\n}", "function sketchpad_mouseDown() {\n mouseDown=1;\n // checkCoordinates(mouseX,mouseY);\n drawDot(ctx,mouseX,mouseY,12);\n}", "function mouseReleased() {\n\tconsole.log(\"Hello\")\n launcher.fly();\n}", "function mousePressed(){\n //stretch foreo\n off();\n sound.play();\n }", "onTranslationEnded() {\n // we will stop rendering our WebGL until next drag occurs\n if(this.curtains) {\n this.curtains.disableDrawing();\n }\n }", "function mouseOver() {\n console.log(\"mouse over\");\n clearTimeout(timeoutvar);\n}", "function mouseReleased() {\n osc.fade(0, 0.5);\n}", "_handleMouseOut() {\n\t\tthis._resumeTimeout();\n\t}", "function stopDrawing(){\n let removed = false;\n\n document.addEventListener('keydown', function(e){\n if(e.repeat){return;}\n const key = e.code;\n\n if(key === STOP_KEY){\n if(!removed){\n hoverToggle(false);\n removed = true;\n }\n\n else{\n hoverToggle(true);\n removed = false;\n }\n\n }\n });\n }", "function mouseMoved()\n{\n\t\n}", "function stopStroke(evt)\n {\n if (activeStroke)\n {\n // don't propagate event any further\n killEvent(evt);\n\n // duplicate last control point to get endpoint interpolation\n // of quadratic spline curves\n if ( activeStroke.type == \"draw\" )\n {\n var n = activeStroke.coords.length;\n var lastX = activeStroke.coords[n-2];\n var lastY = activeStroke.coords[n-1];\n activeStroke.coords.push(lastX);\n activeStroke.coords.push(lastY);\n\n var ctx = drawingCanvas[mode].context;\n drawCurve(ctx, activeStroke);\n }\n\n // save stroke to slide's event data\n recordEvent( activeStroke );\n\n // inactive stroke\n activeStroke = null;\n }\n\n // pen mode? switch back to pen cursor\n if (tool==ToolType.PEN) \n {\n showCursor(penCursor);\n }\n triggerHideCursor();\n }", "function canvas_mouseMove(e) {\n // Update the mouse co-ordinates when moved\n getMousePos(e);\n\n // Draw a dot if the mouse button is currently being pressed\n if (mouseDown==1) {\n drawLine(ctx,mouseX,mouseY,14);\n //neu zum testen\n if(mouseX > bereichDarunter && mouseX < bereichDarueber){\n ctx.clearRect(window.innerWidth/6, 0, window.innerWidth/1.5, window.innerHeight);\n }\n }\n\n}", "onSliderBlur() {\n gShaderToy.mMouseIsDown = false;\n }", "onSliderBlur() {\n gShaderToy.mMouseIsDown = false;\n }", "function mouseUp()\n {\n ThemerService.mouseDown = false;\n $document.unbind('mouseup', mouseUp);\n }", "initializeTrailFX(){\n var trailTexture = PIXI.Texture.fromImage('editor/trail.png')\n var historyX = []; var historyY = [];\n var historySize = 30;//historySize determines how long the trail will be.\n var ropeSize = 200; //ropeSize determines how smooth the trail will be.\n var points = [];\n //Create history array.\n for( var i = 0; i < historySize; i++){\n historyX.push(0); historyY.push(0);\n }\n //Create rope points.\n for(var i = 0; i < ropeSize; i++){points.push(new PIXI.Point(0,0))};\n //Create the rope\n var rope = new PIXI.mesh.Rope(trailTexture, points);\n rope._filters = [ new PIXI.filters.BlurFilter (3, 2)];\n rope.alpha = 0.6;\n this.mouseTrails = rope;\n \n const trailTiker = PIXI.ticker.shared.add((delta) => {\n historyX.pop();\n historyX.unshift(this.follower.x);\n historyY.pop();\n historyY.unshift(this.follower.y);\n for( var i = 0; i < ropeSize; i++){\n var p = points[i];\n var ix = cubicInterpolation( historyX, i / ropeSize * historySize);\n var iy = cubicInterpolation( historyY, i / ropeSize * historySize);\n p.x = ix; p.y = iy;\n }\n });\n function clipInput(k, arr){\n if (k < 0){k = 0;}\n if (k > arr.length - 1){ k = arr.length - 1;}\n return arr[k];\n };\n function getTangent(k, factor, array){return factor * (clipInput(k + 1, array) - clipInput(k - 1,array)) / 2;}\n function cubicInterpolation(array, t, tangentFactor){\n if (tangentFactor == null) tangentFactor = 1;\n var k = Math.floor(t);\n var m = [getTangent(k, tangentFactor, array), getTangent(k + 1, tangentFactor, array)];\n var p = [clipInput(k,array), clipInput(k+1,array)];\n t -= k;\n var t2 = t * t;\n var t3 = t * t2;\n return (2 * t3 - 3 * t2 + 1) * p[0] + (t3 - 2 * t2 + t) * m[0] + ( -2 * t3 + 3 * t2) * p[1] + (t3 - t2) * m[1];\n };\n }", "_strikeMouseMove() {\n for (let i = 0; i < this._mouseMoveCallbacks.length; i++) {\n let currentCallback = this._mouseMoveCallbacks[i][0];\n\n currentCallback(this, event);\n }\n\n for (let i = 0; i < this._mouseMoveCallbacks.length; i++) {\n if (this._mouseMoveCallbacks[i][1])\n this._mouseMoveCallbacks.splice(i--, 1);\n }\n }", "function canvas_mouseUp() {\n mouseDown=0;\n\n // Reset lastX and lastY to -1 to indicate that they are now invalid\n lastX=-1;\n lastY=-1;\n\n //Canvas should be cleared when stopping the touch\n /*drawLine(ctx,mouseX,mouseY,12);*/\n /*ctx.clearRect(window.innerWidth/6, 0, window.innerWidth/1.5, window.innerHeight);*/\n /*ctx.clearRect(0, 0, ctx.innerWidth, ctx.window.innerHeight);*/\n /*ctx.clearLine(0, 0, ctx.width, ctx.height);*/\n /*ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);*/\n}", "function mouseDown() {\n console.log(\"Mouse Down\");\n mouseDownPress = true;\n}", "function mainLoop() {\n // check if the user is drawing\n if (mouse.click && mouse.move && mouse.pos_prev) {\n // send line to to the server\n socket.emit('draw_line', {\n line: [ mouse.pos, mouse.pos_prev ] ,\n color: context.curColor // BUG: not working yet\n });\n mouse.move = false;\n }\n mouse.pos_prev = {x: mouse.pos.x, y: mouse.pos.y};\n setTimeout(mainLoop, 25);\n }", "function mouseOut(x, y) {\r\n\t//debugOut(\"mouse out, x=\"+x+\" y=\"+y);\r\n\tmouseX = x;\r\n\tmouseY = y;\r\n\t//*** Your Code Here\r\n}", "function sketchpad_mouseDown () {\n mouseDown = 1\n drawDot(mouseX, mouseY, 8, r, g, b, a)\n \n connection.invoke('UpdateCanvas', mouseX, mouseY, r, g, b, a).catch(function (err) {\n return console.error(err.toString())\n })\n}", "function CameraCommand_Laser_BlinkBorder(elapsed)\n{\n\t//add elapsed time to ours\n\tthis.ElapsedTimeAvailable += elapsed;\n\t//reached max?\n\tif (this.ElapsedTimeAvailable >= this.HighlightTime)\n\t{\n\t\t//remove the laser points\n\t\tfor (var i = 0, c = this.LaserPoints.length; i < c; i++)\n\t\t{\n\t\t\t//remove it from the body\n\t\t\tdocument.body.removeChild(this.LaserPoints[i]);\n\t\t}\n\t\t//finished\n\t\tthis.State = __CAMERA_CMD_STATE_FINISHED;\n\t}\n\telse\n\t{\n\t\t//divide elapsed time by blink speed\n\t\tvar bBlink = Math.floor(this.ElapsedTimeAvailable / this.Blinks);\n\t\t//adjust display of laser according to whether its odd or even\n\t\tthis.LaserPoints[0].style.display = bBlink % 2 == 0 ? \"block\" : \"none\";\n\t}\n}", "function draw(){\n if (ONSCREEN && STAGE == 0){\n if (!MOUSEDOWN){\n Strokes.push(new Stroke(COLOR))\n }\n MOUSEDOWN = true\n Strokes[Strokes.length-1].points.push(new Point(Math.round(EX), Math.round(EY), COLOR))\n }\n}", "_strikeMouseUp() {\n for (let i = 0; i < this._mouseUpCallbacks.length; i++) {\n let currentCallback = this._mouseUpCallbacks[i][0];\n\n currentCallback(this, event);\n }\n\n for (let i = 0; i < this._mouseUpCallbacks.length; i++) {\n if (this._mouseUpCallbacks[i][1])\n this._mouseUpCallbacks.splice(i--, 1);\n }\n }", "function stopShooting(){\n\tshooting = false;\n\tarrowLocation.x = robinHoodLocation.x + 20;\n\tarrowLocation.y = robinHoodLocation.y + 4; \n}", "function themeMouseMove() {\n screen_has_mouse = true;\n }", "function startClick() {\n loser = false;\n finish = false;\n $(\"status\").textContent = \"Click the \\\"S\\\" to begin.\";\n var boundaries = $$(\"div#maze div.boundary\");\n for (var i = 0; i < boundaries.length; i++) {\n boundaries[i].removeClassName(\"youlose\");\n }\n document.body.observe(\"mousemove\", overBody);\n}", "function mousePressed(){\n\tnext = 0;\n\tdrawing = true;\n\tlast.x = mouseX;\n\tlast.y = mouseY;\n\tlines.push(new Line());\n}", "function mouseReleased() {\n osc.fade(0, 0.5);\n}", "function mousedown(e) {\n\tif (!e) var e = window.event;\n\te.preventDefault();\t\t// Tries to prevent I-beam\n\t\t\n\tisDrawing = true;\n console.log(isDrawing);\n\tstate.canvasX = e.pageX - state.canvas.offsetLeft;\n state.canvasY = e.pageY - state.canvas.offsetTop;\n\tstate.context.beginPath();\n state.context.moveTo(state.canvasX, state.canvasY);\n}", "function keyReleased(){\n\n Pd.send('off', [mouseX]);\n // envel.triggerRelease();\n background(240, 248, 255);\n}", "function mouseOut()\n{\n clearInterval(intervalo);\n}", "function stopPainting() {\n painting = false;\n}", "function mousemove() {\n if (isMouseDown) {\n draw();\n }\n}", "_strikePointerDown() {\n for (let i = 0; i < this._pointerDownCallbacks.length; i++) {\n let currentCallback = this._pointerDownCallbacks[i][0];\n\n currentCallback(this, event);\n }\n\n for (let i = 0; i < this._pointerDownCallbacks.length; i++) {\n if (this._pointerDownCallbacks[i][1])\n this._pointerDownCallbacks.splice(i--, 1);\n }\n }", "function handleOut() {\n\tif (noMouse) {\n\t\treturn;\n\t}\n\tclearDisplayLayer(dlayer.mouseLayer);\n\trefreshCanvas();\n}", "function mousePressed() \n{\n\tjump()\n}" ]
[ "0.69502985", "0.6558655", "0.65094835", "0.6478189", "0.6477866", "0.6458269", "0.64239883", "0.6349911", "0.6340094", "0.63370156", "0.63217205", "0.63098055", "0.62825036", "0.62748396", "0.62323934", "0.62156135", "0.620627", "0.6204919", "0.62033325", "0.62033325", "0.62033325", "0.6195013", "0.61839813", "0.6177206", "0.617106", "0.61647075", "0.61538404", "0.61531395", "0.61468446", "0.6143356", "0.6143342", "0.6119658", "0.6115369", "0.61092836", "0.61041415", "0.6094588", "0.60858136", "0.6084418", "0.6082275", "0.60687166", "0.60670114", "0.6053473", "0.604878", "0.6040786", "0.6039355", "0.603243", "0.60091007", "0.59962314", "0.59758043", "0.59748703", "0.5970048", "0.5969978", "0.59618044", "0.59563565", "0.5956035", "0.59504545", "0.59482914", "0.5946001", "0.59391546", "0.59339195", "0.59339195", "0.59274155", "0.59274155", "0.5926277", "0.59196365", "0.5919063", "0.5917321", "0.59158236", "0.5915234", "0.5914194", "0.59123313", "0.5911675", "0.5909522", "0.5907772", "0.5904316", "0.5904316", "0.5902962", "0.5896241", "0.58876956", "0.5885462", "0.5885425", "0.5882305", "0.587517", "0.5874026", "0.5867193", "0.58661884", "0.58660215", "0.5865102", "0.58578753", "0.5852947", "0.5847203", "0.5846784", "0.58462244", "0.5835304", "0.5833571", "0.5831234", "0.58199346", "0.58184683", "0.5818344", "0.5818137" ]
0.69081503
1
ratios are in regard to the us dollar
function updateCur1Update(){ cur1Amnt= document.getElementById("cur1_amount").value; cur1Type = document.getElementById("cur1_type").value; cur2Type = document.getElementById("cur2_type").value; var index1 = currList.indexOf(cur1Type); var index2 = currList.indexOf(cur2Type); var amnt = ((ratios[index2] / ratios[index1]) * cur1Amnt); if(amnt>0.01 && amnt<999999){ amnt=amnt.toFixed(2); } else{ amnt=amnt.toPrecision(2); } document.getElementById("cur2_amount").value=amnt; updateLabels(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gratuity(bill) {\n return bill * .20;\n}", "get currentPercentageRate() {\n let percentageRate = 0;\n [...Array(TicketKiosk.seatsTaken).keys()].forEach(seat => {\n percentageRate += ((seat <= 4 ? 3 : 5) / 100) * TicketKiosk.baseTicketPrice;\n });\n return percentageRate;\n }", "function Ratio() { // Credit to Sakari Hiltunen for ratio changing\r\n\t\tvar crStam = parseInt(document.getElementById('user_stamina').innerHTML);\r\n\t\tvar crEner = parseInt(document.getElementById('exp_to_next_level').innerHTML);\r\n\t\ttulos = (crEner/crStam);\r\n\t\tNeededRatio = tulos.toFixed(2);\r\n\t}", "getPayRatio(point) {\n var oddsRatio = 0;\n switch(point) {\n case 4:\n case 10:\n oddsRatio = 3/6;\n break;\n case 5:\n case 9:\n oddsRatio = 4/6;\n break;\n case 6:\n case 8:\n oddsRatio = 5/6;\n break;\n default:\n oddsRatio = 0;\n }\n return oddsRatio;\n }", "getPayRatio(point) {\n var oddsRatio = 0;\n switch(point) {\n case 4:\n case 10:\n oddsRatio = 9/5;\n break;\n case 5:\n case 9:\n oddsRatio = 7/5;\n break;\n case 6:\n case 8:\n oddsRatio = 7/6;\n break;\n default:\n oddsRatio = 0;\n }\n return oddsRatio;\n }", "function prix() {\n return 50 * (nbMultiplicateur * nbMultiplicateur * 0.2);\n}", "getPayRatio(point) {\n var oddsRatio = 0;\n switch(point) {\n case 4:\n case 10:\n oddsRatio = 6/3;\n break;\n case 5:\n case 9:\n oddsRatio = 6/4;\n break;\n case 6:\n case 8:\n oddsRatio = 6/5;\n break;\n default:\n oddsRatio = 0;\n }\n return oddsRatio;\n }", "sumOfExpenses()\n {\n let sum = 0;\n\n for(let b of this.getExp())\n {\n sum+=b;\n }\n\n return (Math.round(sum*100)/100);\n }", "function discount(price) {\r\n return price * 0.8;\r\n}", "function paye() {\n var grossPay = 1000000\n var perc = 30 / 100\n var tax = grossPay * perc\n var netPay = grossPay - tax\n console.log(netPay)\n}", "function calculateUSD() {\n\t\tmodelPriceUSD = modelPrice / uahUsdRate;\n\t\tmodelPriceUSD = modelPriceUSD.toFixed(2);\n\n\t\tmodelPriceUsdHolder.text(\"$ \" + addSpace(modelPriceUSD));\n\t}", "function discount(price) {\n return price * 0.8;\n}", "function taxed(price) {\nconsole.log(window.tax_rate);\nreturn price * (1 + window.tax_rate);\n}", "function getRatio(){\n var delta = currentDate.getTime() - doomsdate;\n if(delta > 0){\n var increments = Math.floor(delta / increment);\n if(increments < 1){\n return 0.05;\n }else{\n var adjustedRatio = increments * ratio;\n if(adjustedRatio <= 0.5){\n return adjustedRatio;\n }else{\n return 0.5; \n }\n }\n }else{\n return 0.1;\n }\n }", "monthlyRate() {\n return 0.011077;\n }", "function calculateTaxesDue(price) {\n return (Number(price) / 10)\n}", "discountTotal(price){\n let reducedPrice = this.percentage*price;\n return (price - reducedPrice);\n }", "function Discount15(price) {\n return (price - ((price / 100) * 15)).toFixed(2);\n}", "function tax(a, b) {\n\ta = parseFloat(a);\n\tb = parseFloat(b);\n\treturn a*(b/100);\n}", "getRainProbability(data) {\n if (data.precipProbability === 0) {\n return 'dry';\n }\n return (data.precipProbability * 100).toFixed(0) + '%';\n }", "function usd(amount) {\n // return +(parseFloat(amount).toFixed(4));\n return +(parseFloat(amount).toFixed(2)); // Reducing Price Precision\n}", "function brac1(calc) {\n owed.value = calc * 0.15;\n ret.value = calc * 0.85;\n taxRate.value = \"15%\";\n\n owed.value = Math.round(owed.value*100)/100;\n ret.value = Math.round(ret.value*100)/100;\n}", "function getRatio() {\n\tlet TradePoint = findTradePoint()\n\tlet Close = findClosePoint()\n\n\tlet Ratio = TradePoint - Close\n\treturn Ratio\n}", "lifeExpectancyMars() {\n let martianLifeExpectancy = Math.floor(this.lifeExpectancy/1.88);\n return martianLifeExpectancy;\n }", "function tipCalculator(bill) {\n var percentage;\n if (bill < 50) {\n percentage = 0.2;\n } else if (bill >= 50 && bill < 200) {\n percentage = 0.15;\n } else {\n percentage = 0.1;\n }\n return percentage * bill;\n}", "lifeExpectancyVenus() {\n let venusianLifeExpectancy = Math.floor(this.lifeExpectancy/0.62);\n return venusianLifeExpectancy;\n }", "function dPrice(price,discount){\n return price-(price*(discount/100));\n\n}", "function centsToRate (cents) { return cents ? Math.pow(2, cents / 1200) : 1 }", "function ratesAverage(peliculas) {\n if (!peliculas.length) return 0\n let sum = 0;\n peliculas.forEach(function(pelicula) {\n if (pelicula.rate)\n sum += pelicula.rate\n })\n return parseFloat((sum / peliculas.length).toFixed(2))\n}", "function calculatePercentForPeriod( amount, rate, period )\r\n{\r\n return Math.round( calculatePercent( amount, rate ) * period * 100 / 365 ) / 100;\r\n}", "function applyRatio (v) {\n return Math.round(v * ratio * 10000) / 10000;\n}", "function getRatio(fw, rw) {\n var n = (fw * 100) / rw\n return n.toFixed(5);\n}", "function mealsPercentage(perDiemRate)\n{\n\treturn mealsPerDay(perDiemRate)*0.75;\n}", "getBaseRateMultiplier() {\n if (!this.isSharing) {\n return super.getBaseRateMultiplier()\n }\n\n let adults = this.reservation.adults\n let children = this.reservation.children\n\n if (adults === 1 && children > 0) {\n adults += 1\n children -= 1\n }\n\n return adults + ( children / 2 )\n }", "getBaseRateMultiplier() {\n if (!this.isSharing) {\n return super.getBaseRateMultiplier()\n }\n\n let adults = this.reservation.adults\n let children = this.reservation.children\n\n if (adults === 1 && children > 0) {\n adults += 1\n children -= 1\n }\n\n return adults + ( children / 2 )\n }", "price() {\n return this.bid / this.capacity;\n }", "function saleHotDogs(n){\n var precio;\n n < 5 ? precio = 100 * n: n >=5 && n < 10 ? precio = 95 * n: precio = 90*n;\n return \"$\" + (precio/100) + \" or \" + precio + \" cents\";\n}", "priceWithTax() {\n return Number(this.price) * 1.05;\n }", "function calculateTax(amount) {\n let result = amount * 0.025\n return result\n}", "function tip(bill, tipPercentage) {\n console.log((3574 / 100) * 20)\n}", "function calcularIVA(precioSinIVA){\n return precioSinIVA*1.21;\n}", "comparePrices(lastPrice, currentPrice) {\n return ((currentPrice - lastPrice) / denominator) * 100\n }", "function question1() {\n // Answer:\n let total_price = 0;\n for (let i = 0; i < data.length; i++) {\n total_price += data[i].price;\n }\n console.log(\"$\" + Math.round((total_price / data.length) * 100) / 100);\n}", "function totalBilled() {\n total = months * rate\n return total;\n}", "get amount () {\n return Math.abs(this.raw) / this.scale\n }", "function tipcal(money){\n \n var percent;\n switch(money){\n case money < 50:\n percent = .2\n break;\n case money >=50 && money <=200:\n percent = .15\n break;\n default:\n percent = .1\n\n }\n return percent * money;\n\n\n}", "function calculateMetric() {\r\n\tlet litres = 52.28; //Litres is fuel consumed for 500km\r\n\tlet metricEfficiency = litres / 5; //To get fuel consumed for 100km, divide value by 5.\r\n\tconsole.log(\"Your car has a fuel economy of \" + metricEfficiency.toFixed(2) + \" litres per hundred kilometres.\"); //Write value to console.\r\n}", "function tax(price, percent) {\n return (price * percent / 100).toFixed(2);\n}", "function discountPrice(c,dis){\n return c-((dis/100)*c);\n}", "function ratio(){\nalert(\"A ratio compares similar quantities eg 40g and 160g can be expressed in the ratio 40:160(pronounced as 40 is to 160).This ratio can be expressed in several ways such as 40 to 160 and 40/160. The ratio 40/160 suggests that ratio can be reduced to simplest form ie 40:160=1:4\");\nalert(\"Consider the ratio 115cm:1.5m.To simplify this ratio first express the parts to the same units ie 115cm:150cm.Now 115/150=23/30=23:30.\");\nalert(\"To simplify ⅔:¾ first multiply each part by the LCM of the denominator ie ⅔×12 : ¾×12=8:9.\");\nalert(\"Ratios like fractions have equivalences.We can find missing parts in ratios by comparing these equivalences eg Given that x:7=12:21 find x. The ratio can be written in fraction form ie x/7=12/21, now x=12/21×7 hence x=4.\");\nalert(\"Just like fractions ratios can be compared eg Which ratio is greater 3:7 or 4:9?To tackle this question first write the ratios as fractions ie 3/7 and 4/9.Now convert these fractions to decimals ie 3/7=0.4285 and 4/9=0.4,therefore 3/7 is greater.\");\nalert(\"Quantities can be increased or decreased by given ratios eg Increase 5.4 in the ratio 5:8.By equivalences 5.4:x=5:8(5.4 has been linked to 5 since its the smaller part).Now x/5.4=8/5, x=8/5×5.4=8.64 hence 5.4 increases to 8.64\");\nalert(\"Decrease 726kg in the ratio 7:11.By equivalences x:726=7:11(7 26 has been linked to 11 since its the bigger part).Now x/726=7/11, x=7/11×726=462, hence 726kg reduces to 462kg.\");\n}", "function calcRatio() {\n let wins = scores.player.wins;\n let losses = scores.player.losses;\n return losses === 0\n ? Number(wins).toFixed(3)\n : Number(wins / losses).toFixed(3);\n }", "function taxCalculator(itemPrice){\n\n return parseInt((itemPrice * 0.085).toFixed(2));\n \n}", "function calculatePercentage(price , marketPrice) {\n// console.log(price);\n// console.log(marketPrice);\n \n var percent = (price/marketPrice) * 100;\n //console.log(percent);\n var percentage = 100 - percent;\n return Math.floor(percentage);\n }", "getMissRate() {\n return this.statistics.misses / this.statistics.total; \n }", "getPayRatio(point) {\n var ratio = 0;\n switch(point) {\n case 4:\n case 10:\n ratio = 7;\n break;\n case 6:\n case 8:\n ratio = 9;\n break;\n default:\n ratio = 0;\n }\n return ratio;\n }", "function retire(bal,intR,nPer,mDep){\n\tvar retirement = bal;\n\tfor(var year=1;year<=nPer;year++){\n\t\tretirement*=(1+(intR/100));\n\t\tretirement+=(mDep/12);\n\t}\n\tretirement=retirement.toFixed(2);\n\treturn retirement;\n}", "get Dollar() {}", "function getTotalPrice(array) {\n const sum = array.reduce((acc, elem) => acc + elem, 0);\n const res = Math.floor(sum * 100) / 100;\n\n return `$${res}`;\n}", "getTotalProductionPerSecond() {\n var productionPerSecond = 0;\n Object\n .keys(this.Model.upgrades)\n .forEach( (key, index) => {\n productionPerSecond += this.getProductionPerSecond(key);\n });\n return Math.round(productionPerSecond * 10) / 10;\n }", "lifeExpectancyJupiter() {\n let jovianLifeExpectancy = Math.floor(this.lifeExpectancy/11.86);\n return jovianLifeExpectancy;\n }", "function inss(renda) {\n let aliquota=0.00;\n let v_max=642.34;\n if(renda<=1751.81){\n aliquota=(renda*8)/100;\n }else if(renda>1751.81 && renda<=2919.72){\n aliquota=(renda*9)/100;\n }else if (renda>2919.72 && renda<=5839.45) {\n aliquota=(renda*11)/100;\n }else{\n aliquota= v_max;\n }\n let aliquota_arredondada=parseFloat(aliquota.toFixed(2));\n return aliquota_arredondada;\n}", "function ratesAverage(movies)\n{\n var sum = movies.reduce(function(sum, movie){\n var rate=0;\n if(movie.rate!=false) rate=movie.rate;\n return sum + parseInt(rate);\n },0);\n var result = parseFloat(sum/movies.length);\n // return result.toFixed(2); //Error Jasmine: sense el parseFloat no és un numero? \n return parseFloat(result); \n}", "getBetOddsRatio() {\n var oddsRatio = 0;\n switch(this.pointValue) {\n case 4:\n case 10:\n oddsRatio = 6/3;\n break;\n case 5:\n case 9:\n oddsRatio = 6/4;\n break;\n case 6:\n case 8:\n oddsRatio = 6/5;\n break;\n default:\n oddsRatio = 0;\n }\n if (this.isLose && oddsRatio !== 0) {\n oddsRatio = 1/oddsRatio;\n }\n return oddsRatio;\n }", "function calcularIVA2(precioSinIVA,IVA){\n return precioSinIVA*(1+(IVA/100));\n}", "function calculateTip(bill) {\n var percentage;\n if (bill < 50) {\n percentage = 0.25;\n } else if (bill >= 50 && bill < 200) {\n percentage = 0.22;\n } else {\n percentage = 0.2;\n }\n return percentage * bill;\n}", "function calculateTip(bill) {\n var percentage;\n if (bill < 50) {\n percentage = 0.25;\n } else if (bill >= 50 && bill < 200) {\n percentage = 0.22;\n } else {\n percentage = 0.2;\n }\n return percentage * bill;\n}", "function ratesAverage(movies) {\n\n //return (movies.reduce((sum, movie) => sum + parseFloat(movie.rate), 0).toFixed(2) / movies.lenght)\n\n let x = movies.reduce((suma, movie) => {\n return suma + parseFloat(movie.rate)\n }, 0)\n return parseFloat((x / movies.length).toFixed(2));\n\n /*let y = 0;\n let x = movies.reduce((suma, movie) => {\n if(!movie.rate) {\n y++\n } else {\n return suma + parseFloat(movie.rate)\n }\n }, 0)\n return (x.toFixed(2) / movies.length - y);*/\n}", "function paye(grosspay) // // The function is named \"paye\", with \"grosspay\" as the parameter because \"paye\" is a %ge of grosspay\n{\n let paye = (30/100)*grosspay; // This line expresses \"paye\" as a percentage of the \"grosspay\"\n console.log(paye)\n \n return paye\n }", "function roundToDollar(dollars){\n return (Math.floor(100*(dollars)))/100;\n}", "function calculatePerHead(bill,noOfPersons){\n\n var price= Math.floor(bill/noOfPersons);\n alert(\"Each person have to give a \" + price + \" $ of his share in the bill\");\n}", "function porcentajes(x) {\n let i = x.map(member => member.votes_with_party_pct).reduce((a, b) => (a + b) || 0)\n return (i / x.length);\n}", "calculePercent(budget, depense ) {\n if(budget == 0) return 0 ;\n let v = depense*100;\n return v/budget;\n }", "function interest(){\n var interest = parseFloat(dailyPercentage * calcAmount);\n return interest\n\n}", "function pToR (percentage) {return TAU * percentage / 100;}", "calculateByEnglish() {\n const result = ((this.weight) / Math.pow((this.height * 12), 2)) * 703.0704;\n return Math.round(result* 100) / 100;\n }", "getYieldInEuros() {\n return this.price * this.getYieldInKg()\n }", "function getSocSecTax(gross)\n{\n var socSecTax = gross * .062;\n return socSecTax;\n}", "function decreazingPrice (m3) {\n var reduction = 1;\n if (m3 > 25) {\n reduction = 0.5;\n }\n else if (m3 > 10) {\n reduction = 0.7;\n }\n else if (m3 > 5) {\n reduction = 0.9;\n }\n return (reduction);\n}", "function number_user(ratio_moyen){\r\n \r\n //récupère le nombre de partage\r\n var nb_user = $('.partage').val();\r\n\r\n //indique le nombre total de personne connecter au partage\r\n $('.value_partage').text(nb_user);\r\n \r\n\r\n var ratio_moyen = parseInt(ratio_moyen);\r\n \r\n final_result = ratio_moyen*nb_user;\r\n\r\n // if (final_result >= 1000) {\r\n\r\n // final_result = final_result.substr(0,1);\r\n \r\n // return final_result;\r\n // }\r\n\r\n return final_result;\r\n }", "function taxPF(price, percent) {\n return parseFloat((price * percent / 100).toFixed(2));\n}", "function updatePrice(rate, quantity) {\n totalPrice += rate * quantity;\n console.log(totalPrice);\n updateDomPrice();\n }", "function sc_quotient(x, y) {\n return parseInt(x / y);\n}", "function calculateTipPercent(billAmt, tipAmt) {\n return Math.round(100 / (billAmt / tipAmt));\n}", "rate(T){\n return -Math.log(this.df(T))/T;\n }", "function calculateMortgagePayment(){\n const loan = parseFloat($(\"#js-house-price\").val()) - parseFloat($(\"#js-down-payment\").val())\n const numberOfMonths = parseInt($(\"#js-amort-years\").val())* 12\n const interestRate = parseFloat($(\"#js-interest\").val())/12/100\n //console.log(loan,numberOfMonths,interestRate)\n const numerator = interestRate * Math.pow((1+interestRate),numberOfMonths) \n const denominator = Math.pow((1+interestRate),numberOfMonths)-1\n mortgagePmt = Math.round(loan * numerator / denominator*100)/100\n updatePmt()\n buildMonthlyCostsBase()\n const loanObj = {\n \"P\":loan,\n \"PMT\":mortgagePmt,\n \"I\":interestRate,\n }\n buildAmortTable(loanObj)\n buildSummary()\n \n}", "function getTip (bill, percentage) {\nreturn (\"You have to pay \"+ (bill*(percentage/100) +bill).toFixed(2));\n}", "_toPercent(ratio) {\n return `${ratio * 100}%`;\n }", "fearFactor() {\n return this.FEARFULNESS / 100;\n }", "function to_percent(ask) {\n return Math.round((ask - BASE_PRICE) / BASE_PRICE * 10000) / 100.0;\n }", "function calculatePrice(quant, price){\n return (quant*price).toFixed(2);\n}", "function GetPrice(price) {\n return (price * 0.75).toFixed(2);\n}", "function CalPriceIva (value,iva){\n let price = (value+(value*(iva/100)));\n console.log(\"<valor precio iva\",price,\">\" )\n return price;\n }", "function kittenEfficiency() {\r\n\tvar timePlayed = gamePage.stats.statsCurrent[3].calculate(game);\r\n\tvar numberKittens = gamePage.resPool.get('kittens').value;\r\n\tvar curEfficiency = (numberKittens - 70) / timePlayed;\r\n\tgamePage.msg(\"Your current efficiency is \" + parseFloat(curEfficiency).toFixed(2) + \" kittens per hour.\");\r\n}", "function oneMeal(perDiemRate)\n{\n\treturn mealsPercentage(perDiemRate)*0.75;\n}", "enhetspris() {\n return this.pris / this.antall;\n }", "function ratesAverage(oldarr) {\r\n let mitja = oldarr.reduce((t, e, i, a) => { return t + e.rate / a.length }, 0);\r\n return (Math.round(mitja * 100) / 100);\r\n}", "function calculateMonthAnnuity( amount, rate, months, isRounded )\r\n{\r\n var monthRate = rate / 12;\r\n var annuity;\r\n if( monthRate > 0 )\r\n {\r\n annuity = amount * ( monthRate / ( 1 - Math.pow( 1 + monthRate, -months ) ) );\r\n }\r\n else\r\n {\r\n annuity = amount / months;\r\n }\r\n if( isRounded )\r\n {\r\n annuity = Math.round( annuity );\r\n }\r\n else\r\n {\r\n annuity = Math.round( annuity * 100 ) / 100;\r\n }\r\n return annuity;\r\n}", "function totalMealsTwenty(perDiemRate)\n{\n\treturn mealsPercentage(perDiemRate) + 5;\n}", "function costPerSlice (price,slice){\n var cost=price/slice;\n cost=cost.toFixed(2);\n return cost;\n\n}", "function profit(arg){\n\nlet result = 0;\nresult = ( arg.sellPrice * arg.inventory) - (arg.costPrice * arg.inventory) ;\nresult = Math.round(result);\nconsole.log(result);\nreturn result;\n}", "function calculateUnitRatios () {\n /* The properties below are used to determine whether the element differs sufficiently from this call's prior element to also differ in its unit conversion ratio.\n If the properties match up with those of the prior element, the prior element's conversion ratios are used. Like most optimizations in Velocity, this is done to minimize DOM querying. */\n var sameRatioIndicators = {\n parent: element.parentNode, /* GET */\n position: CSS.getPropertyValue(element, \"position\"), /* GET */\n fontSize: CSS.getPropertyValue(element, \"fontSize\") /* GET */\n },\n /* Determine if the same % ratio can be used. % is relative to the element's position and the parent's dimensions. */\n sameBasePercent = ((sameRatioIndicators.position === unitConversionRatios.lastPosition) && (sameRatioIndicators.parent === unitConversionRatios.lastParent)),\n /* Determine if the same em ratio can be used. em is relative to the element's fontSize. */\n sameBaseEm = (sameRatioIndicators.fontSize === unitConversionRatios.lastFontSize);\n\n /* Store these ratio indicators call-wide for the next element to compare against. */\n unitConversionRatios.lastParent = sameRatioIndicators.parent;\n unitConversionRatios.lastPosition = sameRatioIndicators.position;\n unitConversionRatios.lastFontSize = sameRatioIndicators.fontSize;\n\n /* Whereas % and em ratios are determined on a per-element basis, the rem unit type only needs to be checked once per call since it is exclusively dependant upon the body element's fontSize.\n If this is the first time that calculateUnitRatios() is being run during this call, the remToPxRatio value will be null, so we calculate it now. */\n if (unitConversionRatios.remToPxRatio === null) {\n /* Default to most browsers' default fontSize of 16px in the case of 0. */\n unitConversionRatios.remToPxRatio = parseFloat(CSS.getPropertyValue(document.body, \"fontSize\")) || 16; /* GET */\n }\n\n var originalValues = {\n /* To accurately and consistently calculate conversion ratios, the element's overflow and box-sizing are temporarily disabled. Overflow must be manipulated on a per-axis basis\n since the plain overflow property overwrites its subproperties' values. */\n overflowX: null,\n overflowY: null,\n boxSizing: null,\n /* width and height act as our proxy properties for measuring the horizontal and vertical % ratios. Since they can be artificially constrained by their min-/max- equivalents, those properties are changed as well. */\n width: null,\n minWidth: null,\n maxWidth: null,\n height: null,\n minHeight: null,\n maxHeight: null,\n /* paddingLeft acts as our proxy for the em ratio. */\n paddingLeft: null\n },\n elementUnitRatios = {},\n /* Note: IE<=8 round to the nearest pixel when returning CSS values, thus we perform conversions using a measurement of 10 (instead of 1) to give our ratios a precision of at least 1 decimal value. */\n measurement = 10; \n\n /* For organizational purposes, active ratios calculations are consolidated onto the elementUnitRatios object. */\n elementUnitRatios.remToPxRatio = unitConversionRatios.remToPxRatio;\n\n /* Note: To minimize layout thrashing, the ensuing unit conversion logic is split into batches to synchronize GETs and SETs. */\n originalValues.overflowX = CSS.getPropertyValue(element, \"overflowX\"); /* GET */\n originalValues.overflowY = CSS.getPropertyValue(element, \"overflowY\"); /* GET */\n originalValues.boxSizing = CSS.getPropertyValue(element, \"boxSizing\"); /* GET */\n\n /* Since % values are relative to their respective axes, ratios are calculated for both width and height. In contrast, only a single ratio is required for rem and em. */\n /* When calculating % values, we set a flag to indiciate that we want the computed value instead of offsetWidth/Height, which incorporate additional dimensions (such as padding and border-width) into their values. */\n originalValues.width = CSS.getPropertyValue(element, \"width\", null, true); /* GET */\n originalValues.minWidth = CSS.getPropertyValue(element, \"minWidth\"); /* GET */\n /* Note: max-width/height must default to \"none\" when 0 is returned, otherwise the element cannot have its width/height set. */\n originalValues.maxWidth = CSS.getPropertyValue(element, \"maxWidth\") || \"none\"; /* GET */\n\n originalValues.height = CSS.getPropertyValue(element, \"height\", null, true); /* GET */\n originalValues.minHeight = CSS.getPropertyValue(element, \"minHeight\"); /* GET */\n originalValues.maxHeight = CSS.getPropertyValue(element, \"maxHeight\") || \"none\"; /* GET */\n\n originalValues.paddingLeft = CSS.getPropertyValue(element, \"paddingLeft\"); /* GET */\n\n if (sameBasePercent) {\n elementUnitRatios.percentToPxRatioWidth = unitConversionRatios.lastPercentToPxWidth;\n elementUnitRatios.percentToPxRatioHeight = unitConversionRatios.lastPercentToPxHeight;\n } else {\n CSS.setPropertyValue(element, \"overflowX\", \"hidden\"); /* SET */\n CSS.setPropertyValue(element, \"overflowY\", \"hidden\"); /* SET */\n CSS.setPropertyValue(element, \"boxSizing\", \"content-box\"); /* SET */\n\n CSS.setPropertyValue(element, \"width\", measurement + \"%\"); /* SET */\n CSS.setPropertyValue(element, \"minWidth\", measurement + \"%\"); /* SET */\n CSS.setPropertyValue(element, \"maxWidth\", measurement + \"%\"); /* SET */\n\n CSS.setPropertyValue(element, \"height\", measurement + \"%\"); /* SET */\n CSS.setPropertyValue(element, \"minHeight\", measurement + \"%\"); /* SET */\n CSS.setPropertyValue(element, \"maxHeight\", measurement + \"%\"); /* SET */\n }\n\n if (sameBaseEm) {\n elementUnitRatios.emToPxRatio = unitConversionRatios.lastEmToPx;\n } else {\n CSS.setPropertyValue(element, \"paddingLeft\", measurement + \"em\"); /* SET */\n }\n\n /* The following pixel-value GETs cannot be batched with the prior GETs since they depend upon the values temporarily set immediately above; layout thrashing cannot be avoided here. */\n if (!sameBasePercent) {\n /* Divide the returned value by the measurement value to get the ratio between 1% and 1px. */\n elementUnitRatios.percentToPxRatioWidth = unitConversionRatios.lastPercentToPxWidth = (parseFloat(CSS.getPropertyValue(element, \"width\", null, true)) || 0) / measurement; /* GET */\n elementUnitRatios.percentToPxRatioHeight = unitConversionRatios.lastPercentToPxHeight = (parseFloat(CSS.getPropertyValue(element, \"height\", null, true)) || 0) / measurement; /* GET */\n }\n\n if (!sameBaseEm) {\n elementUnitRatios.emToPxRatio = unitConversionRatios.lastEmToPx = (parseFloat(CSS.getPropertyValue(element, \"paddingLeft\")) || 0) / measurement; /* GET */\n }\n\n /* Revert each test property to its original value. */\n for (var originalValueProperty in originalValues) {\n CSS.setPropertyValue(element, originalValueProperty, originalValues[originalValueProperty]); /* SETs */\n }\n\n if ($.velocity.debug >= 1) console.log(\"Unit ratios: \" + JSON.stringify(elementUnitRatios), element);\n\n return elementUnitRatios;\n }" ]
[ "0.6784583", "0.66066", "0.652864", "0.6492409", "0.64895326", "0.64779294", "0.6469098", "0.6462761", "0.642982", "0.64125806", "0.64063346", "0.6379253", "0.6366426", "0.6366416", "0.6350915", "0.63367885", "0.6314814", "0.63092667", "0.6281975", "0.62781274", "0.6263307", "0.62523264", "0.6233727", "0.62273604", "0.62108743", "0.62088996", "0.6195595", "0.61930794", "0.6192839", "0.6189921", "0.6175747", "0.6158813", "0.61488616", "0.6141731", "0.6141731", "0.61393625", "0.6138352", "0.6134098", "0.61251605", "0.6121878", "0.6100899", "0.6098592", "0.609108", "0.60899156", "0.60694134", "0.6065986", "0.60658884", "0.60558933", "0.6055377", "0.6052861", "0.6041397", "0.6041231", "0.6022891", "0.6007442", "0.60046566", "0.6004304", "0.6003302", "0.59988475", "0.59934545", "0.5982284", "0.5977221", "0.596159", "0.5948074", "0.5943859", "0.5940853", "0.5940853", "0.59397274", "0.5938922", "0.5936928", "0.59350467", "0.5934116", "0.5931027", "0.5928636", "0.5919233", "0.59187484", "0.5917227", "0.59158665", "0.5915768", "0.5915016", "0.59092546", "0.5908123", "0.5906562", "0.5904106", "0.59032977", "0.59014934", "0.58999735", "0.58985674", "0.58966345", "0.5896286", "0.58938", "0.5891703", "0.58894324", "0.58887273", "0.5888683", "0.5888018", "0.58873665", "0.58865756", "0.58822745", "0.5881574", "0.587912", "0.5876391" ]
0.0
-1
//////////// WFM Options /////////////////////
function initWfmOptions(){ $("#wfmOptions").show(); /** * Agent Check */ function startAgentMonitoring(){ wfm_req("startAgentMonitoring", null, function(response){ showResponse( "wfm_input_ifAgentCheck", response ); }); } function stopAgentMonitoring(){ wfm_req("stopAgentMonitoring", null, function(response){ showResponse("wfm_input_ifAgentCheck", response); }); } function ifAgentMonitoring(){ wfm_req("ifAgentMonitoring", null, function(ok){ if (ok){ showAgentMonitoringParams(true); $("#wfm_input_ifAgentCheck").prop("checked", true); }else{ showAgentMonitoringParams(false); $("#wfm_input_ifAgentCheck").prop("checked", false); } }); } ifAgentMonitoring();//onload $('#wfm_input_ifAgentCheck').change(function () { if($("#wfm_input_ifAgentCheck").prop('checked') == true){ startAgentMonitoring(); showAgentMonitoringParams(true); }else{ stopAgentMonitoring(); showAgentMonitoringParams(false); } }); function showAgentMonitoringParams(bool){ if(bool){ $("#wfm_agentCheckParams").show(); getAgentCheckRate(); getMinRepInterval(); }else{ $("#wfm_agentCheckParams").hide(); } } //check rate function getAgentCheckRate(){ wfm_req("getAgentCheckRate", null, function(number){ if(number){ $("#wfm_input_changeAgentCheckRate").val(number); } }); } function setAgentCheckRate(){ var value = Number($("#wfm_input_changeAgentCheckRate").val()); wfm_req("setAgentCheckRate",{agentCheckRate: value}, function(response){ showResponse("wfm_input_changeAgentCheckRate",response); getAgentCheckRate(); }); } $("#wfm_btn_changeAgentCheckRate").click(function(){ setAgentCheckRate(); }); //min exe time function getMinRepInterval(){ wfm_req("getMinRepititionTime", null, function(number){ if(number){ $("#wfm_input_changeMinRepititionInterval").val(number); } }); } function setMinRepInterval(){ var value = Number($("#wfm_input_changeMinRepititionInterval").val()); wfm_req("setMinRepititionTime",{minRepititionTime: value}, function(response){ showResponse("wfm_input_changeMinRepititionInterval",response); getMinRepInterval(); }); } $("#wfm_btn_changeMinRepititionInterval").click(function(){ setMinRepInterval(); }); /** * Logging */ //logfile function ifLogfile(){ wfm_req("ifLogFile", null, function(ok){ if(ok){ $("#wfm_input_ifLogfile").prop("checked", true); }else{ $("#wfm_input_ifLogfile").prop("checked", false); } }); } ifLogfile(); function setLogFile(bool){ wfm_req("setLogFile", {ifLogFile:bool},function(response){ ifLogfile(); showResponse("wfm_input_ifLogfile",response); }); } $('#wfm_input_ifLogfile').change(function () { if($("#wfm_input_ifLogfile").prop('checked') == true){ setLogFile(true); }else{ setLogFile(false); } }); //mail function ifMailNotification(){ wfm_req("ifMailNotification", null, function(ok){ if(ok){ $("#wfm_input_ifMail").prop("checked", true); initMail(); $("#mailOpts").show(); }else{ $("#wfm_input_ifMail").prop("checked", false); $("#mailOpts").hide(); } }); } ifMailNotification(); function setMailNotification(bool){ wfm_req("setMailNotification", {ifMailNotification: bool}, function(response){ showResponse("wfm_input_ifMail",response); }) } $('#wfm_input_ifMail').change(function () { if($("#wfm_input_ifMail").prop('checked') == true){ setMailNotification(true); initMail(); $("#mailOpts").show(); }else{ setMailNotification(false); $("#mailOpts").hide(); } }); /** * mail options */ function initMail(){ getMailOpts(); getSMTPOpts(); } function getMailOpts(){ wfm_req("getMailOptions", null, function(response){ if(response){ $("#wfm_input_mailSender").val(response.from); $("#wfm_input_mailReceivers").val(response.to); $("#wfm_input_mailSubject").val(response.subject); } }); } function getSMTPOpts(){ wfm_req("getSmtpOptions", null, function(response){ if(response){ $("#wfm_input_smtpService").val(response.service); $("#wfm_input_smtpHost").val(response.host); $("#wfm_input_smtpPort").val(response.port); $("#wfm_input_smtpUserName").val(response.auth.user); $("#wfm_input_smtpUserPassword").val(response.auth.pass); } }); } function setMailOpts(){ var params = { from: $("#wfm_input_mailSender").val(), to: $("#wfm_input_mailReceivers").val(), subject: $("#wfm_input_mailSubject").val() } wfm_req("setMailOptions", params, function(response){ showResponse("wfm_btn_saveMailOpts",response); getMailOpts(); }); } $("#wfm_btn_saveMailOpts").click(function(){ setMailOpts(); }); function setSmtpOpts(){ var params = { service: $("#wfm_input_smtpService").val(), host: $("#wfm_input_smtpHost").val(), port: Number($("#wfm_input_smtpPort").val()), user: $("#wfm_input_smtpUserName").val(), pass: $("#wfm_input_smtpUserPassword").val() } wfm_req("setSmtpOptions", params, function(response){ showResponse("wfm_btn_saveSmtpOpts",response); getSMTPOpts(); }); } $("#wfm_btn_saveSmtpOpts").click(function(){ setSmtpOpts(); }); function sendTestMail(){ wfm_req("sendTestMail", null, function(response){ showResponse("wfm_btn_sendTestMail",response); }); } $("#wfm_btn_sendTestMail").click(function(){ sendTestMail(); }); /** * Webservice */ function ifWebservice(){ wfm_req("ifWebservice", null, function(response){ if(response == true){ $("#wfm_btn_exeWS").prop("disabled", false); $("#wfm_webserviceOn").show(); $("#wfm_webserviceOff").hide(); }else{ $("#wfm_btn_exeWS").prop("disabled", true); $("#wfm_webserviceOn").hide(); $("#wfm_webserviceOff").show(); } }); } ifWebservice(); function startWebservice(){ wfm_req("startWebservice", null, function(response){ showResponse("wfm_webserviceOff",response); ifWebservice(); }); } $("#wfm_webserviceOff").click(function(){ startWebservice(); }); function stopWebservice(){ wfm_req("stopWebservice", null, function(response){ showResponse("wfm_webserviceOn",response); ifWebservice(); }); } $("#wfm_webserviceOn").click(function(){ stopWebservice(); }); function getPortNumber(){ wfm_req("getPortNumber", null, function(number){ if(number){ $("#wfm_input_webservicePortnumber").val(number); } }); } getPortNumber(); function setPortNumber(){ var value = Number($("#wfm_input_webservicePortnumber").val()); wfm_req("setPortNumber", {portnumber: value}, function(response){ getPortNumber(); showResponse("wfm_btn_changeWebservicePortnumber",response); stopWebservice(); }); } $("#wfm_btn_changeWebservicePortnumber").click(function(){ setPortNumber(); }); /** * Execution */ /* function executeWf(){ var wiring = $("#wfm_input_wiring").val(); req("executeWf", {wiring: wiring}, function(response){ if (response == true){ $("#wfm_input_wiring").val(""); } showResponse(response); }); } $("#wfm_btn_exeSocket").click(function(){ executeWf(); });*/ function showResponse(value){ if(value == true){ $("#responseDialog").css("background", "green"); show(); } if(value == false){ $("#responseDialog").css("background", "red"); show(); } function show(){ $("#responseDialog").fadeIn(100,function(){ $("#responseDialog").fadeOut(400); }); } } function showResponse(elementId, value){ var selector = "#" + elementId; var el = $(selector).parent().parent(); if(value == true){ el.addClass("green"); blink(); } if(value == false){ el.addClass("red"); blink(); } function blink(){ el.hide(); el.fadeIn(1000, function(){ el.removeClass("green"); el.removeClass("red"); }); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Options() {\n\t\tchrome.runtime.sendMessage({\n\t\t\ttype: 'OPEN_OPTIONS'\n\t\t});\n\t}", "get options() {}", "function w_options (wOo) {\n\treturn (typeof wOo === 'string') ? {\n\t\tw: wOo || this.word || this.input || '',\n\t\toptions: {}\n\t} : {\n\t\tw: this.word || this.input || '',\n\t\toptions: (obj(wOo)) ? wOo : {}\n\t}\n}", "function SetFormDefaults_wm()\n{\n //for channel switch\n FindAndSelect(document.wifimode.wifimd, wm); \n }", "function ExtraOptions() { }", "function ExtraOptions() { }", "get options() {\n return { throttleDelay: this.throttleDelay, passive: this.passive };\n }", "function ExtraOptions() {}", "function ExtraOptions() {}", "function save_options() {\n\tsetLocal(\"sense_facebook\");\n\tsetLocal(\"sense_google\");\n\tsetLocal(\"sense_twitter\");\n\tsetLocal(\"sense_youtube\");\n\tsetLocal(\"sense_4Chan\");\n\tsetLocal(\"sense_selector\");\n\tsetLocal(\"sense_color\");\n\tcheckAPI();\n}", "function ExtraOptions(){}", "function fpConf() {\n return {\n\tplayList: [ { name: 'clip0', url:movieFilePath } ],\n\tshowPlayList: false,\n\tbaseURL: '',\n\t// baseURL: 'http://flowplayer.sourceforge.net/video',\n\tautoPlay: FLV_autoPlay,\n\tautoBuffering: true,\n\tbufferLength: 10,\n\tloop: false,\n\tvideoHeight: movieHeight,\n\thideControls: false\n }\n}", "function HTMLOption() { }", "function HTMLOption() { }", "get options() {\n return {\n width: 800,\n height: 600,\n show: false,\n frame: false\n };\n }", "optionsUpdateHook() { }", "function getMoreAdvancedSettings() {\r\n\tmadvStaticFocalUnicodeCharacter = getFromLocalNotEmpty('madvStaticFocalUnicodeCharacter', madvStaticFocalUnicodeCharacter);\r\n\tmadvEnableSpaceInsertion = getFromLocalNotEmpty('madvEnableSpaceInsertion', madvEnableSpaceInsertion);\r\n\tmadvRemoveLastSlideNullOrEmpty = getFromLocalNotEmpty('madvRemoveLastSlideNullOrEmpty', madvRemoveLastSlideNullOrEmpty);\r\n\tmadvEnableHyphenatedWordSplit = getFromLocalNotEmpty('madvEnableHyphenatedWordSplit', madvEnableHyphenatedWordSplit);\r\n\tmadvConsolidateHyphenatedWord = getFromLocalNotEmpty('madvConsolidateHyphenatedWord', madvConsolidateHyphenatedWord);\r\n\t\r\n\tmadvEnableLongWordHyphenation = getFromLocalNotEmpty('madvEnableLongWordHyphenation', madvEnableLongWordHyphenation);\r\n\tmadvLongWordTriggerCharacterCount = getFromLocalGreaterThanZero('madvLongWordTriggerCharacterCount', madvLongWordTriggerCharacterCount);\r\n\tmadvLongWordMinCharacterPerSlidePostSplit = getFromLocalGreaterThanZero('madvLongWordMinCharacterPerSlidePostSplit', madvLongWordMinCharacterPerSlidePostSplit);\r\n\tmadvLongWordCharacterTriggerDoNotJoin = getFromLocalGreaterThanZero('madvLongWordCharacterTriggerDoNotJoin', madvLongWordCharacterTriggerDoNotJoin);\r\n\t\r\n\tmadvEnableAcronymDetection = getFromLocalNotEmpty('madvEnableAcronymDetection', madvEnableAcronymDetection);\r\n\tmadvEnableNumberDecimalDetection = getFromLocalNotEmpty('madvEnableNumberDecimalDetection', madvEnableNumberDecimalDetection);\t\r\n\tmadvDeleteEmptySlides = getFromLocalNotEmpty('madvDeleteEmptySlides', madvDeleteEmptySlides);\t\r\n\tmadvWPMAdjustmentStep = getFromLocalGreaterThanZero('madvWPMAdjustmentStep', madvWPMAdjustmentStep);\r\n\t\r\n\tmadvWordFreqMinimumSlideDuration = getFromLocalGreaterThanZero('madvWordFreqMinimumSlideDuration', madvWordFreqMinimumSlideDuration);\r\n\tmadvWordFreqHighestFreqSlideDuration = getFromLocalGreaterThanZero('madvWordFreqHighestFreqSlideDuration', madvWordFreqHighestFreqSlideDuration);\r\n\tmadvWordFreqLowestFreqSlideDuration = getFromLocalGreaterThanZero('madvWordFreqLowestFreqSlideDuration', madvWordFreqLowestFreqSlideDuration);\r\n\t\r\n\tmadvWordLengthMinimumSlideDuration = getFromLocalGreaterThanZero('madvWordLengthMinimumSlideDuration', madvWordLengthMinimumSlideDuration);\r\n\tmadvBasicMinimumSlideDuration = getFromLocalGreaterThanZero('madvBasicMinimumSlideDuration', madvBasicMinimumSlideDuration);\t\r\n\t\r\n\tmadvAlwaysHideFocalGuide = getFromLocalNotEmpty('madvAlwaysHideFocalGuide', madvAlwaysHideFocalGuide);\t\r\n\tmadvOptimisedPositionLeftMarginPercent = getFromLocalGreaterThanZero('madvOptimisedPositionLeftMarginPercent', madvOptimisedPositionLeftMarginPercent);\r\n\tmadvDisplaySentenceWhenPaused = getFromLocalNotEmpty('madvDisplaySentenceWhenPaused', madvDisplaySentenceWhenPaused);\t\r\n\tmadvAutoHideSentence = getFromLocalNotEmpty('madvAutoHideSentence', madvAutoHideSentence);\t\r\n\tmadvAutoHideSentenceSeconds = getFromLocalGreaterThanZero('madvAutoHideSentenceSeconds', madvAutoHideSentenceSeconds);\r\n\tmadvDisplaySentenceTopBorder = getFromLocalNotEmpty('madvDisplaySentenceTopBorder', madvDisplaySentenceTopBorder);\r\n\tmadvDisplaySentenceAtReaderOpen = getFromLocalNotEmpty('madvDisplaySentenceAtReaderOpen', madvDisplaySentenceAtReaderOpen);\r\n\tmadvSentenceBackwardWordCount = getFromLocalGreaterThanZero('madvSentenceBackwardWordCount', madvSentenceBackwardWordCount);\r\n\tmadvSentencePositionPercentOffset = getFromLocalGreaterThanZero('madvSentencePositionPercentOffset', madvSentencePositionPercentOffset);\r\n\tmadvLargeStepNumberOfSlides = getFromLocalGreaterThanZero('madvLargeStepNumberOfSlides', madvLargeStepNumberOfSlides);\r\n\tmadvDisplayProgress = getFromLocalNotEmpty('madvDisplayProgress', madvDisplayProgress);\t\r\n\tmadvDisplaySocial = getFromLocalNotEmpty('madvDisplaySocial', madvDisplaySocial);\t\r\n\tmadvDisplayWPMSummary = getFromLocalNotEmpty('madvDisplayWPMSummary', madvDisplayWPMSummary);\t\r\n\t\r\n\tmadvHotkeySelectionEnabled = getFromLocalNotEmpty('madvHotkeySelectionEnabled', madvHotkeySelectionEnabled);\r\n\t\r\n\tmadvSaveSlidePosition = getFromLocalNotEmpty('madvSaveSlidePosition', madvSaveSlidePosition);\r\n}", "function getMoreAdvancedSettingsDefaults() {\r\n\tmadvStaticFocalUnicodeCharacter = \"\";\r\n\tmadvEnableSpaceInsertion = 'true';\r\n\tmadvRemoveLastSlideNullOrEmpty = 'true';\r\n\tmadvEnableHyphenatedWordSplit = 'true';\r\n\tmadvConsolidateHyphenatedWord = 'true';\r\n\tmadvEnableLongWordHyphenation = 'true';\r\n\tmadvLongWordTriggerCharacterCount = 13;\r\n\tmadvLongWordMinCharacterPerSlidePostSplit = 6;\r\n\tmadvLongWordCharacterTriggerDoNotJoin = 4;\r\n\tmadvEnableAcronymDetection = 'true';\r\n\tmadvEnableNumberDecimalDetection = 'true';\r\n\t\r\n\tmadvWordFreqMinimumSlideDuration = 40;\r\n\tmadvWordFreqHighestFreqSlideDuration = 40;\r\n\tmadvWordFreqLowestFreqSlideDuration = 300;\r\n\t\r\n\tmadvWordLengthMinimumSlideDuration = 0;\r\n\tmadvBasicMinimumSlideDuration = 0;\r\n\tmadvDeleteEmptySlides = 'true';\r\n\tmadvWPMAdjustmentStep = 25;\r\n\tmadvAlwaysHideFocalGuide = 'false';\r\n\tmadvOptimisedPositionLeftMarginPercent = 30;\r\n\tmadvDisplaySentenceWhenPaused = 'true';\r\n\tmadvAutoHideSentence = 'false';\r\n\tmadvAutoHideSentenceSeconds = 5;\r\n\tmadvDisplaySentenceTopBorder = 'true';\r\n\tmadvDisplaySentenceAtReaderOpen = 'true';\r\n\tmadvSentenceBackwardWordCount = 20;\r\n\tmadvSentencePositionPercentOffset = 50;\r\n\tmadvLargeStepNumberOfSlides = 10;\r\n\tmadvHotkeySelectionEnabled = 'false';\r\n\tmadvSaveSlidePosition = 'true';\r\n\tmadvDisplayWPMSummary = 'true';\r\n\tmadvDisplaySocial = 'true';\r\n\tmadvDisplayProgress = 'true';\r\n}", "function sendSettings() {\r\n sendMWValues(['isRunning', 'autoGiftSkipOpt', 'autoLottoOpt', 'autoSecretStash',\r\n 'autoIcePublish', 'autoLevelPublish', 'autoAchievementPublish',\r\n 'autoAskJobHelp', 'autoShareWishlist', 'autoWarRewardPublish',\r\n 'autoWarResponsePublish', 'autoWarRallyPublish', 'autoWarPublish']);\r\n}", "function HTMLOption() {}", "function HTMLOption() {}", "function HTMLOption() {}", "set options(options) {\n const {\n debug = false,\n clientId,\n endpoint = 'https://stream.bionic-app.com/flags',\n } = options;\n this._options = {\n debug,\n clientId,\n endpoint,\n };\n }", "function getUserOptions() {\n\n\t/* READ USER SETTINGS FILE HERE */\t\n\twindow.gBulkDeleteDays = 3;\n\twindow.gMarkReadOnVisit = true;\n\twindow.gFeedOrder = 0;\n\twindow.gDefaultFormats = [ 0, 1, 0];\n\twindow.gFormat = gDefaultFormats[gcSTATUS_UNREAD];\n}", "function OnOptions()\n{\n\t// show options \n\tshowOptions = true;\n}", "function getOptions()\n\t{\n\t\tchrome.extension.sendMessage(\"optionsRequest\", function(response)\n\t\t{\n\t\t\tpreviews = response.previews;\n\t\t\tpromoted = response.promoted;\n\t\t\twtfModule = response.wtfModule;\n\t\t\ttrendsModule = response.trendsModule;\n\n\t\t\trefresh();\n\t\t});\n\t}", "set options(value) {}", "function VideoPlayer_UpdateOptions(theObject)\n{\n\t//get our video player\n\tvar theHTML = theObject.HTML;\n\t//set its options\n\ttheHTML.loop = Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_VIDEO_LOOP], false);\n\ttheHTML.poster = String_IsNullOrWhiteSpace(theObject.Properties[__NEMESIS_PROPERTY_VIDEO_POSTER]) ? \"\" : __HOST_LESSON_RESOURCES + theObject.Properties[__NEMESIS_PROPERTY_VIDEO_POSTER];\n\ttheHTML.autoplay = Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_VIDEO_AUTOPLAY], true);\n\ttheHTML.muted = Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_VIDEO_MUTED], false);\n\ttheHTML.controls = Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_VIDEO_CONTROLS], false);\n}", "setGlobalOptions(opts) {\n this.particlesPerFrame = opts.particlesPerFrame || 2;\n this.windSpeedMax = opts.windSpeedMax || 1;\n }", "static options() {\n\t\treturn {\n\t\t\tconstants: getConstants(),\n\t\t\tpresets: getPresets(),\n\t\t\tvalue: null,\n\t\t\tview: null,\n\t\t\tdidInit: (tick) => {},\n\t\t\tdidUpdate: (tick, value) => {},\n\t\t\twillDestroy: (tick) => {},\n\t\t\tdidDestroy: (tick) => {},\n\t\t\tcredits: {\n\t\t\t\tlabel: 'Powered by PQINA',\n\t\t\t\turl: 'https://pqina.nl/?ref=credits'\n\t\t\t}\n\t\t}\n\t}", "function options(){\n\n \tswitch(userInput) {\n\n\t\tcase \"my-tweets\": \n\t\tmyTweets(); \n\t\tbreak;\n\n\t\tcase \"spotify-this-song\": \n\t\tspotifyThisSong(); \n\t\tbreak;\n\n\t\tcase \"movie-this\":\n\t\t movieThis(); \n\t\t break;\n\n\t\tcase \"do-what-it-says\": \n\t\tdoWhatItSays(); \n\t\tbreak;\n\t}\n}", "function validateModeOptions(inst, vo)\n{\n if((inst.freqBand === \"freqBand24\") && (inst.mode === \"frequencyHopping\"))\n {\n vo.logError(\"Frequency hopping not available on 2.4GHz band\", inst,\n \"mode\");\n }\n}", "function options() {\n\tconsole.clear();\n\t\n\tconsole.log('☮☮☮.⚠⚠⚠⚠⚠.⌘⌘⌘..⌘⌘⌘.⚠⚠⚠⚠⚠.☮☮☮\\n');\n\t\n\tconsole.log(' SUKUNASPAM OFICIAL v1.1'.help);\n\tconsole.log(' Powered by MP Server Inc.\\n'.help);\n\t\n\tconsole.log('☮☮☮.⚠⚠⚠⚠⚠.⌘⌘⌘..⌘⌘⌘.⚠⚠⚠⚠⚠.☮☮☮\\n');\n\t\n\tconsole.log('1 - Spam SMS [ Vivo ]'.yellow);\n\tconsole.log('2 - Spam SMS [ Claro ]'.yellow);\n\tconsole.log('3 - Spam SMS [ 99 Food ]'.yellow);\n\tconsole.log('4 - Spam SMS [ OFF ]'.yellow);\n\tconsole.log('5 - Spam SMS [ Uber Eats ]'.yellow);\n\tconsole.log('6 - Spam SMS [ OFF ]'.yellow);\n\tconsole.log('0 - Sair\\n'.yellow);\n\treturn readLine.question('Selecione uma opção: '.error);\n}", "function setOptions() {\n if(typeof window.dev === 'undefined' || typeof window.dev.i18n === 'undefined') {\n importScriptPage('MediaWiki:I18n-js/code.js', 'dev');\n }\n mw.hook('dev.i18n').add(function(i18no) {\n i18no.loadMessages('u:soap:MediaWiki:Custom-Reports/i18n.json').done(function(i18n) {\n options = {\n\n /* \n //BEGIN EXAMPLE\n example: {\n page: 'Page name the form is for',\n buttonText: 'Text for button to open form',\n form: 'HTML form for reporting users. Each input/textarea should have an id. any optional inputs should be marked with the `optional` class. If any attributes need URI encoding, the relevant inputs should have the `data-encode` attribute set to `true`.',\n // this is where the input ids in the form are matched to numbers\n // for use in the summary/submitted text\n formParams: {\n '$1': 'foo',\n '$2': 'bar'\n },\n submitText: 'Text to submit to the page. Any form parameters can be inserted via the key names in `formParams`',\n summary: 'Text used for the edit summary. Any form parameters can be inserted via the key names in `formParams`',\n sectionTitle: 'Text used as the section title. Any form parameters can be inserted via the key names in `formParams`'\n },\n // END EXAMPLE\n */\n\n profile: {\n page: 'Report:User_profile_headers',\n buttonText: i18n.msg(\"buttonProfile\").escape(),\n form: '<form class=\"WikiaForm ReportForm\" method=\"\" name=\"\" id=\"profile\">' +\n '<fieldset>' +\n '<div class=\"rf-wrapper\">' +\n '<div class=\"rf-section\" style=\"color:#F00;font-size:16px;\"><b>' + i18n.msg(\"formSocial\").escape() + '</b></div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiName\").escape() + '</b></div>' +\n '<input id=\"wikiname\" class=\"rf-wikiname optional\" type=\"text\" placeholder=\"' + i18n.msg(\"formphWikiName\").escape() + '\"/>' +\n '</div>' + \n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiURL\").escape() + '</b></div>' +\n '<input id=\"wikiurl\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"soap.fandom.com\"/>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formUsername\").escape() + '</b> ' + i18n.msg(\"formOfBadUser\").escape() + ' (' + i18n.msg(\"formMultipleUsers\").escape() + ')</div>' +\n '<textarea name=\"\" id=\"user\" class=\"rf-wikiuser\" type=\"text\" placeholder=\"Rappy 4187\\nDucksoup\"></textarea>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formReason\").escape() + '</b></div>' +\n '<textarea name=\"\" id=\"comment\" placeholder=\"' + i18n.msg(\"formphReason\").escape() + '\" class=\"optional\"></textarea>' +\n '</div>' +\n '<div class=\"rf-section\">' +\n '<div class=\"rf-checkbox rf-socks\"><input type=\"checkbox\" id=\"socks\" class=\"option-input optional\"/><label for=\"socks\">' + i18n.msg(\"formSockpuppet\").escape() + '</label>' + \n '<div class=\"rf-section rf-socks-box\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formUsername\").escape() + '</b> ' + i18n.msg(\"formOfSock\").escape() +\n '<textarea name=\"\" id=\"sockusers\" class=\"rf-socks optional\" type=\"text\" placeholder=\"Rappy 4187\\nDucksoup\"></textarea>' +\n '</div>' +\n '</div>' +\n '</div>' + \n '<div class=\"rf-section\" style=\"color:#F00; font-size:16px; display:none;\" id=\"formAnon\"><b>' + i18n.msg(\"formAnon\").escape() + '</b></div>' +\n '</div>' +\n '</fieldset>' +\n '</form>',\n formParams: {\n '$1': 'wikiurl',\n '$2': 'wikiname',\n '$3': 'user',\n '$4': 'comment',\n '$5': 'user', // for different styling\n '$7': 'socks',\n '$8': 'sockusers'\n },\n submitText: '{{Report profile|$1\\n' +\n '|$4\\n' +\n '|$3\\n' +\n '$7$8' +\n '|' + c.wgUserName + '|' + '~~' + '~~' + '~}}',\n summary: 'New profile report ($2, $5)',\n sectionTitle: '$2'\n },\n vandalism: {\n page: 'Report:Vandalism',\n buttonText: i18n.msg(\"buttonVandalism\").escape(),\n form: '<form class=\"WikiaForm ReportForm\" method=\"\" name=\"\" id=\"vandalism\">' +\n '<fieldset>' +\n '<div class=\"rf-wrapper\">' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiName\").escape() + '</b></div>' +\n '<input id=\"wikiname\" class=\"rf-wikiname optional\" type=\"text\" placeholder=\"SOAP Wiki\"/>' +\n '</div>' + \n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiURL\").escape() + '</b></div>' +\n '<input id=\"wikiurl\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"soap.fandom.com\"/>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formUsername\").escape() + '</b> ' + i18n.msg(\"formOfBadUser\").escape() + ' (' + i18n.msg(\"formMultipleUsers\").escape() + ')</div>' +\n '<textarea name=\"\" id=\"user\" class=\"rf-wikiuser\" type=\"text\" placeholder=\"Merrystar\\nBertH\"></textarea>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formReason\").escape() + '</b></div>' +\n '<textarea name=\"\" id=\"comment\" placeholder=\"' + i18n.msg(\"formphReason\").escape() + '\" class=\"optional\"></textarea>' +\n '</div>' +\n '<div class=\"rf-section\">' +\n '<div class=\"rf-checkbox\"><input type=\"checkbox\" id=\"crosswiki\" class=\"option-input optional\"/><label for=\"crosswiki\">' + i18n.msg(\"formCrossWiki\").escape() + '</label></div>' +\n '</div>' + \n '<div class=\"rf-section\">' +\n '<div class=\"rf-checkbox rf-socks\"><input type=\"checkbox\" id=\"socks\" class=\"option-input optional\"/><label for=\"socks\">' + i18n.msg(\"formSockpuppet\").escape() + '</label>' + \n '<div class=\"rf-section rf-socks-box\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formUsername\").escape() + '</b> ' + i18n.msg(\"formOfSock\").escape() +\n '<textarea name=\"\" id=\"sockusers\" class=\"rf-socks optional\" type=\"text\" placeholder=\"Rappy 4187\\nDucksoup\"></textarea>' +\n '</div>' +\n '</div>' +\n '</div>' + \n '<div class=\"rf-section\" style=\"color:#F00; font-size:16px; display:none;\" id=\"formAnon\"><b>' + i18n.msg(\"formAnon\").escape() + '</b></div>' +\n '</div>' +\n '</fieldset>' +\n '</form>',\n formParams: {\n '$1': 'wikiurl',\n '$2': 'wikiname',\n '$3': 'user',\n '$4': 'comment',\n '$5': 'user', // for different styling\n '$6': 'crosswiki',\n '$7': 'socks',\n '$8': 'sockusers'\n },\n submitText: '{{Report vandalism|$1\\n' +\n '|$4\\n' +\n '|$3\\n' +\n '$6$7$8' +\n '|' + c.wgUserName + '|' + '~~' + '~~' + '~}}',\n summary: 'New vandalism report ($1, $5)',\n sectionTitle: '$5 at $2'\n },\n spam: {\n page: 'Report:Spam',\n buttonText: i18n.msg(\"buttonSpam\").escape(),\n form: '<form class=\"WikiaForm ReportForm\" method=\"\" name=\"\" id=\"spam\">' +\n '<fieldset>' +\n '<div class=\"rf-wrapper\">' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiName\").escape() + '</b></div>' +\n '<input id=\"wikiname\" class=\"rf-wikiname optional\" type=\"text\" placeholder=\"' + i18n.msg(\"formphWikiName\").escape() + '\"/>' +\n '</div>' + \n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiURL\").escape() + '</b></div>' +\n '<input id=\"wikiurl\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"soap.fandom.com\"/>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formUsername\").escape() + '</b> ' + i18n.msg(\"formOfBadUser\").escape() + ' (' + i18n.msg(\"formMultipleUsers\").escape() + ')</div>' +\n '<textarea name=\"\" id=\"user\" class=\"rf-wikiuser\" type=\"text\" placeholder=\"Rappy 4187\\nDucksoup\"></textarea>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formReason\").escape() + '</b></div>' +\n '<textarea name=\"\" id=\"comment\" placeholder=\"' + i18n.msg(\"formphReason\").escape() + '\" class=\"optional\"></textarea>' +\n '</div>' +\n '<div class=\"rf-section\">' +\n '<div class=\"rf-checkbox\"><input type=\"checkbox\" id=\"crosswiki\" class=\"option-input optional\"/><label for=\"crosswiki\">' + i18n.msg(\"formCrossWiki\").escape() + '</label></div>' +\n '</div>' + \n '<div class=\"rf-section\" style=\"color:#F00; font-size:16px; display:none;\" id=\"formAnon\"><b>' + i18n.msg(\"formAnon\").escape() + '</b></div>' +\n '</div>' +\n '</fieldset>' +\n '</form>',\n formParams: {\n '$1': 'wikiurl',\n '$2': 'wikiname',\n '$3': 'user',\n '$4': 'comment',\n '$5': 'user', // for different styling\n '$6': 'crosswiki',\n },\n submitText: '{{Report spam|$1\\n' +\n '|$4\\n' +\n '|$3\\n' +\n '$6' +\n '|' + c.wgUserName + '|' + '~~' + '~~' + '~}}',\n summary: 'New spam report ($1, $5)',\n sectionTitle: '$5 at $2'\n },\n phalanx: {\n page: 'Report:Spam_filter_problems',\n buttonText: i18n.msg(\"buttonFalsePositive\").escape(),\n form: '<form class=\"WikiaForm ReportForm\" method=\"\" name=\"\" id=\"phalanx\">' +\n '<fieldset>' +\n '<div class=\"rf-wrapper\">' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiName\").escape() + '</b></div>' +\n '<input id=\"wikiname\" class=\"rf-wikiname optional\" type=\"text\" placeholder=\"' + i18n.msg(\"formphWikiName\").escape() + '\"/>' +\n '</div>' + \n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiPage\").escape() + '</b></div>' +\n '<input id=\"wikiurl\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"soap.fandom.com\"/>' +\n '<span class=\"rf-httpend\">/wiki/</span>' +\n '<input id=\"wikipage\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"Report:Spam_filter_problems\"/>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formBlockID\").escape() + '</b></div>' +\n '<input id=\"blockid\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"12345\" data-encode=\"true\"/>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formPhalanxReason\").escape() + '</b></div>' +\n '<textarea name=\"\" id=\"comment\" placeholder=\"' + i18n.msg(\"formphReason\").escape() + '\" class=\"optional\"></textarea>' +\n '</div>' +\n '<div class=\"rf-section\" style=\"color:#F00; font-size:16px; display:none;\" id=\"formAnon\"><b>' + i18n.msg(\"formAnon\").escape() + '</b></div>' +\n '</div>' +\n '</fieldset>' +\n '</form>',\n formParams: {\n '$1': 'wikiurl',\n '$2': 'wikiname',\n '$5': 'wikipage',\n '$3': 'blockid',\n '$4': 'comment'\n },\n submitText: '{{Report filter|$1\\n' +\n '|$5\\n' +\n '|$3\\n' + \n '|$4\\n' + \n '|' + c.wgUserName + '|' + '~~' + '~~' + '~}}',\n summary: 'New filter report ($2, #$3)',\n sectionTitle: 'Block #$3 on $2'\n },\n wiki: {\n page: 'Report:Wiki',\n buttonText: i18n.msg(\"buttonWiki\").escape(),\n form: '<form class=\"WikiaForm ReportForm\" method=\"\" name=\"\" id=\"wiki\">' +\n '<fieldset>' +\n '<div class=\"rf-wrapper\">' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiName\").escape() + '</b></div>' +\n '<input id=\"wikiname\" class=\"rf-wikiname optional\" type=\"text\" placeholder=\"' + i18n.msg(\"formphWikiName\").escape() + '\"/>' +\n '</div>' + \n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiURL\").escape() + '</b></div>' +\n '<input id=\"wikiurl\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"soap.fandom.com\"/>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formReason\").escape() + '</b></div>' +\n '<input name=\"\" id=\"comment\" type=\"text\" placeholder=\"' + i18n.msg(\"formphReason\").escape() + '\" class=\"optional\"></input>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"GuidelinesTitle\").plain() + '</b></div>' +\n i18n.msg(\"GuidelinesText\").plain() +\n '</div>' +\n '<div class=\"rf-section\" style=\"color:#F00; font-size:16px; display:none;\" id=\"formAnon\"><b>' + i18n.msg(\"formAnon\").escape() + '</b></div>' +\n '</div>' +\n '</fieldset>' +\n '</form>',\n formParams: {\n '$1': 'wikiname',\n '$2': 'wikiurl',\n '$3': 'comment'\n },\n submitText: '{{badwiki|$2|$3}}',\n summary: 'New bad wiki report ([[w:c:$2|$1]], comment: $3)',\n sectionTitle: ''\n },\n };\n reportDropdown = '<div class=\"wds-dropdown\">' + \n '<div class=\"wds-dropdown__toggle wds-button\">' + \n '<span>' + i18n.msg(\"buttonReport\").escape() + '</span>' + \n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" class=\"wds-icon wds-icon-tiny wds-dropdown__toggle-chevron\"><path d=\"M1 3h10L6 9z\"></path></svg>' + \n '</div>' + \n '<div class=\"wds-dropdown__content\">' + \n '<ul class=\"wds-list wds-is-linked\" id=\"rf-dropdown-list\">' + \n '</ul>' + \n '</div>' + \n '</div>'\n }).done(init);\n });\n }", "function setOptions() {\n if(typeof window.dev === 'undefined' || typeof window.dev.i18n === 'undefined') {\n importScriptPage('MediaWiki:I18n-js/code.js', 'dev');\n }\n mw.hook('dev.i18n').add(function(i18no) {\n i18no.loadMessages('u:vstf:MediaWiki:Custom-Reports/i18n.json').done(function(i18n) {\n options = {\n\n /* \n //BEGIN EXAMPLE\n example: {\n page: 'Page name the form is for',\n buttonText: 'Text for button to open form',\n form: 'HTML form for reporting users. Each input/textarea should have an id. any optional inputs should be marked with the `optional` class. If any attributes need URI encoding, the relevant inputs should have the `data-encode` attribute set to `true`.',\n // this is where the input ids in the form are matched to numbers\n // for use in the summary/submitted text\n formParams: {\n '$1': 'foo',\n '$2': 'bar'\n },\n submitText: 'Text to submit to the page. Any form parameters can be inserted via the key names in `formParams`',\n summary: 'Text used for the edit summary. Any form parameters can be inserted via the key names in `formParams`',\n sectionTitle: 'Text used as the section title. Any form parameters can be inserted via the key names in `formParams`'\n },\n // END EXAMPLE\n */\n\n profile: {\n page: 'Report:User_profile_headers',\n buttonText: i18n.msg(\"buttonProfile\").escape(),\n form: '<form class=\"WikiaForm ReportForm\" method=\"\" name=\"\" id=\"profile\">' +\n '<fieldset>' +\n '<div class=\"rf-wrapper\">' +\n '<div class=\"rf-section\" style=\"color:#F00;font-size:16px;\"><b>' + i18n.msg(\"formSocial\").escape() + '</b></div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiName\").escape() + '</b></div>' +\n '<input id=\"wikiname\" class=\"rf-wikiname optional\" type=\"text\" placeholder=\"CJRichards and Applemasterexpert Wiki\"/>' +\n '</div>' + \n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiURL\").escape() + '</b></div>' +\n '<input id=\"wikiurl\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"chrichards-and-applemasterexpert.fandom.com\"/>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formUsername\").escape() + '</b> ' + i18n.msg(\"formOfBadUser\").escape() + ' (' + i18n.msg(\"formMultipleUsers\").escape() + ')</div>' +\n '<textarea name=\"\" id=\"user\" class=\"rf-wikiuser\" type=\"text\" placeholder=\"LightHouse38\\nCJRichards\"></textarea>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formReason\").escape() + '</b></div>' +\n '<textarea name=\"\" id=\"comment\" placeholder=\"' + i18n.msg(\"formphReason\").escape() + '\" class=\"optional\"></textarea>' +\n '</div>' +\n '<div class=\"rf-section\">' +\n '<div class=\"rf-checkbox rf-socks\"><input type=\"checkbox\" id=\"socks\" class=\"option-input optional\"/><label for=\"socks\">' + i18n.msg(\"formSockpuppet\").escape() + '</label>' + \n '<div class=\"rf-section rf-socks-box\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formUsername\").escape() + '</b> ' + i18n.msg(\"formOfSock\").escape() +\n '<textarea name=\"\" id=\"sockusers\" class=\"rf-socks optional\" type=\"text\" placeholder=\"Apple\\nSTuNsPoRe\"></textarea>' +\n '</div>' +\n '</div>' +\n '</div>' + \n '</div>' +\n '</fieldset>' +\n '</form>',\n formParams: {\n '$1': 'wikiurl',\n '$2': 'wikiname',\n '$3': 'user',\n '$4': 'comment',\n '$5': 'user', // for different styling\n '$7': 'socks',\n '$8': 'sockusers'\n },\n submitText: '{{Report profile|$1\\n' +\n '|$4\\n' +\n '|$3\\n' +\n '$7$8' +\n '|' + c.wgUserName + '|' + '~~' + '~~' + '~}}',\n summary: 'New profile report ($2, $5)',\n sectionTitle: '$2'\n },\n vandalism: {\n page: 'Report:Vandalism',\n buttonText: i18n.msg(\"buttonVandalism\").escape(),\n form: '<form class=\"WikiaForm ReportForm\" method=\"\" name=\"\" id=\"vandalism\">' +\n '<fieldset>' +\n '<div class=\"rf-wrapper\">' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiName\").escape() + '</b></div>' +\n '<input id=\"wikiname\" class=\"rf-wikiname optional\" type=\"text\" placeholder=\"CJRichards and Applemasterexpert Wiki\"/>' +\n '</div>' + \n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiURL\").escape() + '</b></div>' +\n '<input id=\"wikiurl\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"cjrichards-and-applemasterexpert.fandom.com\"/>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formUsername\").escape() + '</b> ' + i18n.msg(\"formOfBadUser\").escape() + ' (' + i18n.msg(\"formMultipleUsers\").escape() + ')</div>' +\n '<textarea name=\"\" id=\"user\" class=\"rf-wikiuser\" type=\"text\" placeholder=\"Applemasterexpert\\nRaZoRLeAf\"></textarea>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formReason\").escape() + '</b></div>' +\n '<textarea name=\"\" id=\"comment\" placeholder=\"' + i18n.msg(\"formphReason\").escape() + '\" class=\"optional\"></textarea>' +\n '</div>' +\n '<div class=\"rf-section\">' +\n '<div class=\"rf-checkbox\"><input type=\"checkbox\" id=\"crosswiki\" class=\"option-input optional\"/><label for=\"crosswiki\">' + i18n.msg(\"formCrossWiki\").escape() + '</label></div>' +\n '</div>' + \n '<div class=\"rf-section\">' +\n '<div class=\"rf-checkbox rf-socks\"><input type=\"checkbox\" id=\"socks\" class=\"option-input optional\"/><label for=\"socks\">' + i18n.msg(\"formSockpuppet\").escape() + '</label>' + \n '<div class=\"rf-section rf-socks-box\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formUsername\").escape() + '</b> ' + i18n.msg(\"formOfSock\").escape() +\n '<textarea name=\"\" id=\"sockusers\" class=\"rf-socks optional\" type=\"text\" placeholder=\"GHe\\nApplerGamers\"></textarea>' +\n '</div>' +\n '</div>' +\n '</div>' + \n '</div>' +\n '</fieldset>' +\n '</form>',\n formParams: {\n '$1': 'wikiurl',\n '$2': 'wikiname',\n '$3': 'user',\n '$4': 'comment',\n '$5': 'user', // for different styling\n '$6': 'crosswiki',\n '$7': 'socks',\n '$8': 'sockusers'\n },\n submitText: '{{Report vandalism|$1\\n' +\n '|$4\\n' +\n '|$3\\n' +\n '$6$7$8' +\n '|' + c.wgUserName + '|' + '~~' + '~~' + '~}}',\n summary: 'New vandalism report ($1, $5)',\n sectionTitle: '$5 at $2'\n },\n spam: {\n page: 'Report:Spam',\n buttonText: i18n.msg(\"buttonSpam\").escape(),\n form: '<form class=\"WikiaForm ReportForm\" method=\"\" name=\"\" id=\"spam\">' +\n '<fieldset>' +\n '<div class=\"rf-wrapper\">' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiName\").escape() + '</b></div>' +\n '<input id=\"wikiname\" class=\"rf-wikiname optional\" type=\"text\" placeholder=\"CJRichards and Applemasterexpert Wiki\"/>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiURL\").escape() + '</b></div>' +\n '<input id=\"wikiurl\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"cjrichards-and-applemasterexpert.fandom.com\"/>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formUsername\").escape() + '</b> ' + i18n.msg(\"formOfBadUser\").escape() + ' (' + i18n.msg(\"formMultipleUsers\").escape() + ')</div>' +\n '<textarea name=\"\" id=\"user\" class=\"rf-wikiuser\" type=\"text\" placeholder=\"6 times 9\\nChoircutie\"></textarea>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formReason\").escape() + '</b></div>' +\n '<textarea name=\"\" id=\"comment\" placeholder=\"' + i18n.msg(\"formphReason\").escape() + '\" class=\"optional\"></textarea>' +\n '</div>' +\n '<div class=\"rf-section\">' +\n '<div class=\"rf-checkbox\"><input type=\"checkbox\" id=\"crosswiki\" class=\"option-input optional\"/><label for=\"crosswiki\">' + i18n.msg(\"formCrossWiki\").escape() + '</label></div>' +\n '</div>' + \n '</div>' +\n '</fieldset>' +\n '</form>',\n formParams: {\n '$1': 'wikiurl',\n '$2': 'wikiname',\n '$3': 'user',\n '$4': 'comment',\n '$5': 'user', // for different styling\n '$6': 'crosswiki',\n },\n submitText: '{{Report spam|$1\\n' +\n '|$4\\n' +\n '|$3\\n' +\n '$6' +\n '|' + c.wgUserName + '|' + '~~' + '~~' + '~}}',\n summary: 'New spam report ($1, $5)',\n sectionTitle: '$5 at $2'\n },\n phalanx: {\n page: 'Report:AbuseFilter',\n buttonText: i18n.msg(\"buttonFalsePositive\").escape(),\n form: '<form class=\"WikiaForm ReportForm\" method=\"\" name=\"\" id=\"phalanx\">' +\n '<fieldset>' +\n '<div class=\"rf-wrapper\">' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiName\").escape() + '</b></div>' +\n '<input id=\"wikiname\" class=\"rf-wikiname optional\" type=\"text\" placeholder=\"CJRichards and Applemasterexpert Wiki\"/>' +\n '</div>' + \n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiPage\").escape() + '</b></div>' +\n '<input id=\"wikiurl\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"cjrichards-and-applemasterexpert.fandom.com\"/>' +\n '<span class=\"rf-httpend\">/wiki/</span>' +\n '<input id=\"wikipage\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"Report:AbuseFilter\"/>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formBlockID\").escape() + '</b></div>' +\n '<input id=\"blockid\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"6\" data-encode=\"true\"/>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formPhalanxReason\").escape() + '</b></div>' +\n '<textarea name=\"\" id=\"comment\" placeholder=\"' + i18n.msg(\"formphReason\").escape() + '\" class=\"optional\"></textarea>' +\n '</div>' +\n '</div>' +\n '</fieldset>' +\n '</form>',\n formParams: {\n '$1': 'wikiurl',\n '$2': 'wikiname',\n '$5': 'wikipage',\n '$3': 'blockid',\n '$4': 'comment'\n },\n submitText: '{{Report filter|$1\\n' +\n '|$5\\n' +\n '|$3\\n' + \n '|$4\\n' + \n '|' + c.wgUserName + '|' + '~~' + '~~' + '~}}',\n summary: 'New filter report ($2, #$3)',\n sectionTitle: 'Block #$3 on $2'\n },\n wiki: {\n page: 'Report:Wiki',\n buttonText: i18n.msg(\"buttonWiki\").escape(),\n form: '<form class=\"WikiaForm ReportForm\" method=\"\" name=\"\" id=\"wiki\">' +\n '<fieldset>' +\n '<div class=\"rf-wrapper\">' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiName\").escape() + '</b></div>' +\n '<input id=\"wikiname\" class=\"rf-wikiname optional\" type=\"text\" placeholder=\"CJRichards and Applemasterexpert Wiki\"/>' +\n '</div>' + \n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formWikiURL\").escape() + '</b></div>' +\n '<input id=\"wikiurl\" class=\"rf-wikiurl\" type=\"text\" placeholder=\"cjrichards-and-applemasterexpert.fandom.com\"/>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>' + i18n.msg(\"formReason\").escape() + '</b></div>' +\n '<input name=\"\" id=\"comment\" placeholder=\"' + i18n.msg(\"formphReason\").escape() + '\" class=\"optional\"></input>' +\n '</div>' +\n '<div class=\"rf-section\"><div class=\"rf-section-title\"><b>N.B.; Guidelines:</b></div>' +\n 'Please add to this list if you believe a wiki violates Fandom\\'s <a href=\"https://www.fandom.com/terms-of-use\">Terms of Use</a>.<br />' +\n '<ol><li>1. Do not use this page to report <a href=\"https://www.fandom.com/community-creation-policy\">duplicate wikis</a>.</li>' +\n '<li>2. Do not add wikis just because you feel that they are \"unproductive.\" This list is for <a href=\"https://www.fandom.com/terms-of-use\">Terms of Use</a> violations only -- advertisement spam, harassment wikis, or obscene and illegal content.</li>' +\n '<li>3. Do not add wikis where you feel the administrators are being unfair. Please <a href=\"/Special:Contact/general\">contact Staff</a> about bad admins.</li>' +\n '<li>4. New entries may be added to the <a href=\"#New reports (To be VSTF checked)\">non-VSTF checked section</a> only. Check to ensure you are not duplicating an entry already there.</li></ol>' +\n '</div>' +\n '</div>' +\n '</fieldset>' +\n '</form>',\n formParams: {\n '$1': 'wikiname',\n '$2': 'wikiurl',\n '$3': 'comment'\n },\n submitText: '{{badwiki|$2|$3}}',\n summary: 'New bad wiki report ([[w:c:$2|$1]], comment: $3)',\n sectionTitle: ''\n },\n };\n reportDropdown = '<div class=\"wds-dropdown\">' + \n '<div class=\"wds-dropdown__toggle wds-button\">' + \n '<span>' + i18n.msg(\"buttonReport\").escape() + '</span>' + \n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" class=\"wds-icon wds-icon-tiny wds-dropdown__toggle-chevron\"><path d=\"M1 3h10L6 9z\"></path></svg>' + \n '</div>' + \n '<div class=\"wds-dropdown__content\">' + \n '<ul class=\"wds-list wds-is-linked\" id=\"rf-dropdown-list\">' + \n '</ul>' + \n '</div>' + \n '</div>'\n }).done(init);\n });\n }", "function OogaahOptions() {\n\tthis.mStorage = new LocalStorage();\n\t\n\tthis.mLogOptions = new Array();\n\t\n\t{\n\t\tvar playLog = new OogaahPlayLog();\n\t\tfor (var i = 0; i < playLog.mIconCount; ++i) { // missing, play, pass, yes, no, ability, skirmish win, 1st, 2nd, 3rd, 4th\n\t\t\tthis.mLogOptions.push(true);\n\t\t}\n\t}\n}", "showSettings() {\n // Implement in your WM\n }", "function save_options() {\n\tif (!woas.config.permit_edits) {\n\t\talert(woas.i18n.READ_ONLY);\n\t\treturn false;\n\t}\n\twoas.cfg_commit();\n\twoas.set_current(\"Special::Advanced\", true);\n}", "setOption(option) {\n return new M_IO((world) => {\n this._option.bgmVolume = option.bgmVolume || this._option.bgmVolume;\n this._option.bgmSpeed = option.bgmSpeed || this._option.bgmSpeed;\n this._option.seVolume = option.seVolume || this._option.seVolume;\n return new Tuple(null, world);\n });\n }", "function setupActionsOptions() {\n switch (panel.data.state) {\n case \"running\":\n modifyAction(\"play\", false);\n modifyAction(\"pause\", true);\n modifyAction(\"stop\", true);\n break;\n case \"paused\":\n modifyAction(\"play\", true);\n modifyAction(\"pause\", false);\n modifyAction(\"stop\", true);\n break;\n case \"stopped\":\n modifyAction(\"play\", true);\n modifyAction(\"pause\", false);\n modifyAction(\"stop\", false);\n break;\n }\n }", "function save_options_() {\r\n save_options();\r\n }", "changeOption(keyword, option) {\n return new M_IO((world) => {\n let audio = this._bgmList.filter(a => a.keyword === keyword).nth(0).match({\n nothing: () => {\n world.console.error(\"Sound Error: \" + keyword + \" is not registered.\");\n return new Audio();\n },\n just: (so) => so.audio\n }),\n opt = option || {};\n opt[\"volume\"] = opt.volume || this._option.bgmVolume;\n opt[\"speed\"] = opt.speed || this._option.bgmSpeed;\n opt[\"currentTime\"] = opt.currentTime || audio.currentTime;\n\n audio.volume = opt.volume;\n audio.playbackRate = opt.speed;\n audio.currentTime = opt.currentTime;\n\n return new Tuple(audio, world);\n });\n }", "function config(options) {\n options.duration ??= 100\n options.speed ??= 25;\n console.log(options)\n}", "function additionalSettings(){\n\n\n}", "async useDefaultSettings() {\n const features = await this.features();\n // Use MLSD directory listing if possible. See https://tools.ietf.org/html/rfc3659#section-7.8:\n // \"The presence of the MLST feature indicates that both MLST and MLSD are supported.\"\n const supportsMLSD = features.has(\"MLST\");\n this.availableListCommands = supportsMLSD ? LIST_COMMANDS_MLSD : LIST_COMMANDS_DEFAULT;\n await this.send(\"TYPE I\"); // Binary mode\n await this.sendIgnoringError(\"STRU F\"); // Use file structure\n await this.sendIgnoringError(\"OPTS UTF8 ON\"); // Some servers expect UTF-8 to be enabled explicitly\n if (supportsMLSD) {\n await this.sendIgnoringError(\"OPTS MLST type;size;modify;unique;unix.mode;unix.owner;unix.group;unix.ownername;unix.groupname;\"); // Make sure MLSD listings include all we can parse\n }\n if (this.ftp.hasTLS) {\n await this.sendIgnoringError(\"PBSZ 0\"); // Set to 0 for TLS\n await this.sendIgnoringError(\"PROT P\"); // Protect channel (also for data connections)\n }\n }", "postMessageOptions(text) {\n return {\n as_user: false,\n username: this.name,\n icon_url: this.icon,\n text,\n unfurl_links: false,\n unfurl_media: false,\n };\n }", "function open_settings() {\n var dialog = new wkof.Settings({\n script_id: 'doublecheck',\n title: 'Double-Check Settings',\n on_save: init_ui,\n pre_open: settings_preopen,\n content: {\n tabAnswers: {type:'page',label:'Answers',content:{\n grpChangeAnswers: {type:'group',label:'Change Answer',content:{\n allow_retyping: {type:'checkbox',label:'Allow retyping answer',default:true,hover_tip:'When enabled, you can retype your answer by pressing Escape or Backspace.'},\n allow_change_incorrect: {type:'checkbox',label:'Allow changing to \"incorrect\"',default:true,hover_tip:'When enabled, you can change your answer\\nto \"incorrect\" by pressing the \"-\" key.'},\n allow_change_correct: {type:'checkbox',label:'Allow changing to \"correct\"',default:true,hover_tip:'When enabled, you can change your answer\\nto \"correct\" by pressing the \"+\" key.'},\n show_corrected_answer: {type:'checkbox',label:'Show corrected answer',default:false,hover_tip:'When enabled, pressing \\'+\\' to correct your answer puts the\\ncorrected answer in the input field. Pressing \\'+\\' multiple\\ntimes cycles through all acceptable answers.'},\n }},\n grpCarelessMistakes: {type:'group',label:'Careless Mistakes',content:{\n typo_action: {type:'dropdown',label:'Typos in meaning',default:'ignore',content:{ignore:'Ignore',warn:'Warn/shake',wrong:'Mark wrong'},hover_tip:'Choose an action to take when meaning contains typos.'},\n wrong_answer_type_action: {type:'dropdown',label:'Wrong answer type',default:'warn',content:{warn:'Warn/shake',wrong:'Mark wrong'},hover_tip:'Choose an action to take when reading was entered instead of meaning, or vice versa.'},\n wrong_number_n_action: {type:'dropdown',label:'Wrong number of n\\'s',default:'warn',content:{warn:'Warn/shake',wrong:'Mark wrong'},hover_tip:'Choose an action to take when you type the wrong number of n\\'s in certain reading questions.'},\n small_kana_action: {type:'dropdown',label:'Big kana instead of small',default:'warn',content:{warn:'Warn/shake',wrong:'Mark wrong'},hover_tip:'Choose an action to take when you type a big kana instead of small (e.g. ゆ instead of ゅ).'},\n kanji_reading_for_vocab_action: {type:'dropdown',label:'Kanji reading instead of vocab',default:'warn',content:{warn:'Warn/shake',wrong:'Mark wrong'},hover_tip:'Choose an action to take when the reading of a kanji is entered for a single character vocab word instead of the correct vocab reading.'},\n kanji_meaning_for_vocab_action: {type:'dropdown',label:'Kanji meaning instead of vocab',default:'warn',content:{warn:'Warn/shake',wrong:'Mark wrong'},hover_tip:'Choose an action to take when the meaning of a kanji is entered for a single character vocab word instead of the correct vocab meaning.'},\n }},\n }},\n tabMistakeDelay: {type:'page',label:'Mistake Delay',content:{\n grpDelay: {type:'group',label:'Delay Next Question',content:{\n delay_wrong: {type:'checkbox',label:'Delay when wrong',default:true,refresh_on_change:true,hover_tip:'If your answer is wrong, you cannot advance\\nto the next question for at least N seconds.'},\n delay_multi_meaning: {type:'checkbox',label:'Delay when multiple meanings',default:false,hover_tip:'If the item has multiple meanings, you cannot advance\\nto the next question for at least N seconds.'},\n delay_slightly_off: {type:'checkbox',label:'Delay when answer has typos',default:false,hover_tip:'If your answer contains typos, you cannot advance\\nto the next question for at least N seconds.'},\n delay_period: {type:'number',label:'Delay period (in seconds)',default:1.5,hover_tip:'Number of seconds to delay before allowing\\nyou to advance to the next question.'},\n }},\n }},\n tabBurnReviews: {type:'page',label:'Burn Reviews',content:{\n grpBurnReviews: {type:'group',label:'Burn Reviews',content:{\n warn_burn: {type:'dropdown',label:'Warn before burning',default:'never',content:{never:'Never',cheated:'If you changed answer',always:'Always'},hover_tip:'Choose when to warn before burning an item.'},\n burn_delay_period: {type:'number',label:'Delay after warning (in seconds)',default:1.5,hover_tip:'Number of seconds to delay before allowing\\nyou to advance to the next question after seeing a burn warning.'},\n }},\n }},\n tabLightning: {type:'page',label:'Lightning',content:{\n grpLightning: {type:'group',label:'Lightning Mode',content:{\n show_lightning_button: {type:'checkbox',label:'Show \"Lightning Mode\" button',default:true,hover_tip:'Show the \"Lightning Mode\" toggle\\nbutton on the review screen.'},\n lightning_enabled: {type:'checkbox',label:'Enable \"Lightning Mode\"',default:true,refresh_on_change:true,hover_tip:'Enable \"Lightning Mode\", which automatically advances to\\nthe next question if you answer correctly.'},\n srs_msg_period: {type:'number',label:'SRS popup time (in seconds)',default:1.2,min:0,hover_tip:'How long to show SRS up/down popup when in lightning mode. (0 = don\\'t show)'},\n }},\n }},\n tabAutoInfo: {type:'page',label:'Item Info',content:{\n grpAutoInfo: {type:'group',label:'Show Item Info',content:{\n autoinfo_correct: {type:'checkbox',label:'After correct answer',default:false,hover_tip:'Automatically show the Item Info after correct answers.', validate:validate_autoinfo_correct},\n autoinfo_incorrect: {type:'checkbox',label:'After incorrect answer',default:false,hover_tip:'Automatically show the Item Info after incorrect answers.', validate:validate_autoinfo_incorrect},\n autoinfo_multi_meaning: {type:'checkbox',label:'When multiple meanings',default:false,hover_tip:'Automatically show the Item Info when an item has multiple meanings.', validate:validate_autoinfo_correct},\n autoinfo_slightly_off: {type:'checkbox',label:'When answer has typos',default:false,hover_tip:'Automatically show the Item Info when your answer has typos.', validate:validate_autoinfo_correct},\n }},\n }},\n }\n });\n dialog.open();\n }", "function setSavedOptions() {\n log('Getting saved options.');\n GM_setValue(\"opt_loggingEnabled\", opt_loggingEnabled);\n GM_setValue(\"opt_hidefedded\", opt_hidefedded);\n GM_setValue(\"opt_hidefallen\", opt_hidefallen);\n GM_setValue(\"opt_hidetravel\", opt_hidetravel);\n GM_setValue(\"opt_showcaymans\", opt_showcaymans);\n GM_setValue(\"opt_hidehosp\", opt_hidehosp);\n GM_setValue(\"opt_disabled\", opt_disabled);\n }", "function getOptions() {\n //\t\t\tOption.query({\n //\t\t\t\tpage\n //\t\t\t});\n }", "sendOptionsToSearch() {\n PCM_searchChannel.postMessage({'msg':'searchTo: globalOptions', 'object':{'general':this.doGeneral(), 'search':this.doSearch(), 'timers':this.doTimers(), 'alarms':this.doAlarms(), 'ranges':this.getRanges()}});\n }", "function options() {\n\tstorage.getf().then((props) => {\n\t\tjira.profile(props.url).then((profile) => {\n\t\t\tdirect.speak(S(MENU_OPTION_INITIAL).template({\n\t\t\t\tname: profile.displayName\n\t\t\t}).s);\n\n\t\t\tdefineOption1(props.url, props.project);\n\t\t\tdefineOption2(props.url, props.project);\n\t\t}, (error) => {\n\t\t\tcommands = {};\n\t\t\tdirect.speak(jira.errors(error));\n\t\t});\n\t});\n}", "function wVvWV() {\n SERVG.MnW.MWw.vww = 1;\n }", "function updateOptions() {\n\tpush();\n\t\tfill([255,255,255]);\n\t\ttextSize(cellwidth/2);\n\t\ttextAlign(CENTER,CENTER);\n\t\ttranslate(screen.w/2,screen.h/2);\n\t\ttext(\"What options do you need?\",0,0);\n\tpop();\n}", "get __settingsDemo() {\n return {\n target: \"This can be a query selector, a NodeList or a single Node.\",\n easing: \"Any of the default CSS speed surve options like ease, ease-in or ease-out\",\n speedIn: \"The speed value for the first transition (in).\",\n speedOut: \"Optional: The speed value for the optional back (out) transition.\",\n css: {\n propertyName: [\"Starting Value (in)\", \"Ending value (out)\"],\n propertyName2: [\"Ending value only\"]\n },\n toggleData: {\n _info: \"This optional parameter adds/removes data/classes when transitioning.\",\n data: { key: \"value\", pairs: \"go here\" },\n classes: \"space separated class names\"\n }\n };\n }", "function saveOptions() {}", "function options(o, k, a, i) {\n o.audio = o.audio||{};\n o.video = o.video||{};\n o.youtube = o.youtube||{};\n if(k==='--help') o.help = true;\n else if(k==='-d' || k==='--db') o.db = a[++i];\n else if(k==='-o' || k==='--output') o.output = a[++i];\n else if(k==='-p' || k==='--priority') o.priority = a[++i];\n else if(k==='-r' || k==='--references') o.references = a[++i];\n else if(k==='-s' || k==='--status') o.status = a[++i];\n else if(k==='-t' || k==='--times') o.times = a[++i];\n else if(k.startsWith('-a')) i = googletts.options(o.audio, '-'+a.substring(2), a, i);\n else if(k.startsWith('-v')) i = stillvideo.options(o.video, '-'+a.substring(2), a, i);\n else if(k.startsWith('-y')) i = youtubeuploader.options(o.youtube, '-'+a.substring(2), a, i);\n else if(k.startsWith('--audio_')) i = googletts.options(o.audio, '--'+k.substring(8), a, i);\n else if(k.startsWith('--video_')) i = stillvideo.options(o.video, '--'+k.substring(8), a, i);\n else if(k.startsWith('--youtube_')) i = youtubeuploader.options(o.youtube, '--'+k.substring(10), a, i);\n else if(!o.command) o.command = a[i];\n else o.input = a[i];\n return i+1;\n}", "get options() {\n return this.__options;\n }", "function Window_Options() {\n this.initialize(...arguments);\n}", "function updateOptions() {\r\n var newtonefreq = document.getElementById(\"toneFreqSlider\").value;\r\n var newvolume = document.getElementById(\"volumeSlider\").value;\r\n bgp.tonefreq = newtonefreq;\r\n bgp.volume = newvolume;\r\n bgp.gainNode.gain.value = bgp.volume/100.0;\r\n\r\n save_options();\r\n updateOptionsDisplay();\r\n bgp.play_pip();\r\n}", "constructor() {\n this.settings = {\n load: false,\n angle: false,\n moment: false,\n distload: false,\n material: false,\n one_load: false,\n one_moment: false,\n one_distload: false,\n one_material: false,\n defenition: false,\n one_joint: false,\n fixed_size: false,\n };\n this.setSettings(\"default\");\n }", "function viewOption(param) {\n\n gw_com_api.show(\"frmOption\");\n\n}", "function viewOption(param) {\n\n gw_com_api.show(\"frmOption\");\n\n}", "function widthChange(mq) {\n\t\tif (mq.matches) {\n\t\t\tstore = \"all\";\n\t\t\tfor (let option of options) {\n\t\t\t\t// remove event listeners from options\n\t\t\t\toption.removeEventListener(\"click\", modifyOptionClass);\n\t\t\t\t// disable option buttons\n\t\t\t\tif (option.classList.contains(\"option-active\")) {\n\t\t\t\t\toption.classList.toggle(\"option-active\");\n\t\t\t\t}\n\t\t\t\toption.classList.add(\"option-inactive\");\n\t\t\t}\n\t\t} else {\n\t\t\tstore = \"walmart\";\n\t\t\tsetStoreOption();\n\t\t\toptions[0].classList.add(\"option-active\");\n\t\t\tfor (let option of options) {\n\t\t\t\tif (option.classList.contains(\"option-inactive\")) {\n\t\t\t\t\toption.classList.remove(\"option-inactive\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function FocusMonitorOptions() { }", "getOptions() {\n return new Map([\n ['localDataCenter', this.localDc ],\n ['filterFunction', this._filter !== this._defaultFilter ]\n ]);\n }", "function setOptions() {\n // set text output to match slider\n $(options.selectors.isochroneOutput).text($(options.selectors.isochroneSlider).val());\n if (exploreLatLng) {\n clickedExplore();\n }\n }", "function getOptions(provided)\n{\n var options = provided || {};\n\n if (!options.documentView)\n options.documentView = {};\n if (!options.documentView.closeLabel)\n options.documentView.closeLabel = \"Done\";\n\n\n if (!options.navigationView)\n options.navigationView = {};\n if (!options.navigationView.closeLabel)\n options.navigationView.closeLabel = \"Back\";\n\n\n if (!options.email)\n options.email = {};\n if (!options.email.enabled)\n options.email.enabled = false;\n\n\n if (!options.print)\n options.print = {};\n if (!options.print.enabled)\n options.print.enabled = false;\n\n\n if (!options.openWith)\n options.openWith = {};\n if (!options.openWith.enabled)\n options.openWith.enabled = false;\n\n\n if (!options.bookmarks)\n options.bookmarks = {};\n if (!options.bookmarks.enabled)\n options.bookmarks.enabled = false;\n\n\n if (!options.search)\n options.search = {};\n if (!options.search.enabled)\n options.search.enabled = false;\n\n\n if (!options.android)\n options.android = {};\n if (!options.android.viewerAppPackage)\n options.android.viewerAppPackage = 'de.sitewaerts.cleverdox.viewer';\n if (!options.android.viewerAppActivity)\n options.android.viewerAppActivity = 'DocumentViewerActivity';\n\n return options;\n}", "function saveOptions(options)\n{\n\tif (!options)\n\t\treturn;\n\n\tfunction removeProtocol(s)\n\t{\n\t\tvar ary = s.match(/^(?:\\w*):\\/\\/(.*)/);\n\t\tif (ary)\n\t\t\treturn ary[1];\n\t\treturn s;\n\t}\n\n\toptions.tempdir = document.getElementById(\"temp-download-folder\").value;\n\toptions.userAgent = document.getElementById(\"download-user-agent\").value;\n\toptions.maxSavedReleases = parseInt(document.getElementById(\"max-saved-releases\").value, 10);\n\toptions.maxDownloadRetryTimeSeconds = parseInt(document.getElementById(\"max-download-retry-time\").value, 10);\n\toptions.level = parseInt(document.getElementById(\"debug-output-level\").value, 10);\n\toptions.debug = !!document.getElementById(\"debug-debug\").checked;\n\toptions.saveDownloadHistory = !!document.getElementById(\"save-download-history\").checked;\n\toptions.downloadDupeReleases = !!document.getElementById(\"download-dupe-releases\").checked;\n\toptions.pathToUnrar = document.getElementById(\"path-rar\").value;\n\toptions.pathToUtorrent = document.getElementById(\"path-utorrent\").value;\n\toptions.updateCheck = updateMenulist.getSelectedValue();\n\n\toptions.webui.user = document.getElementById(\"webui-user\").value;\n\toptions.webui.password = document.getElementById(\"webui-password\").value;\n\toptions.webui.hostname = removeProtocol(document.getElementById(\"webui-hostname\").value);\n\toptions.webui.port = parseInt(document.getElementById(\"webui-port\").value, 10);\n\toptions.webui.https = !!document.getElementById(\"webui-https\").checked;\n\n\toptions.ftp.user = document.getElementById(\"ftp-user\").value;\n\toptions.ftp.password = document.getElementById(\"ftp-password\").value;\n\toptions.ftp.hostname = removeProtocol(document.getElementById(\"ftp-hostname\").value);\n\toptions.ftp.port = parseInt(document.getElementById(\"ftp-port\").value, 10);\n\t\n\toptions.announce.sonarrPath = document.getElementById(\"path-sonarr\").value;\n\toptions.announce.sonarrApiKey = document.getElementById(\"apikey-sonarr\").value;\n\toptions.announce.radarrPath = document.getElementById(\"path-radarr\").value;\n\toptions.announce.radarrApiKey = document.getElementById(\"apikey-radarr\").value;\n\toptions.announce.hdtvDelay = parseInt(document.getElementById(\"hdtv-delay\").value, 10);\n\toptions.announce.webDelay = parseInt(document.getElementById(\"web-delay\").value, 10);\n\t\n\tuploadMethod.saveValues(options.uploadMethod);\n\tscriptExecDialog.saveValues(options.scriptExecOptions);\n}", "launchSmodemOptions(wd, options) {\n const name = './modem_main';\n\n if( options === null || typeof options === 'undefined') {\n throw(new Error('launchSmodemOptions() requires options argument'));\n }\n\n // pick a unique input using a hash\n let hashInput = \" \" + Date.now() + \" \" + Math.random();\n\n let suffix = crypto.createHash('sha1').update(hashInput).digest('hex').slice(0,8);\n\n let tmppath = \"/tmp/init_\" + suffix + \".json\";\n fs.writeFileSync(tmppath, JSON.stringify(options));\n\n return this.launchSmodemConfigPath(wd, tmppath);\n }", "function options() {\n if (chrome.runtime.openOptionsPage) {\n chrome.runtime.openOptionsPage();\n } else {\n window.open(chrome.runtime.getURL('options.html'));\n }\n}", "function updateAllOptions() {\n updateMusicOption();\n updateEffectsOption();\n updateSpeedOption();\n updateStatsOption();\n}", "get options() {\n\t\treturn this.#options;\n\t}", "function restore_options() {\n\trestore_local(\"sense_facebook\");\n\trestore_local(\"sense_google\");\n\trestore_local(\"sense_twitter\");\n\trestore_local(\"sense_youtube\");\n\trestore_local(\"sense_4Chan\");\n\trestore_local(\"sense_selector\");\n\trestore_local(\"sense_color\");\n\trestore_local(\"api_key\");\n\tsave_options();\n}", "function setoption(option, status, clicked) {\r\n _('set option '+option+' to '+status+', clicked: '+clicked);\r\n var type = option.substr(0, option.indexOf('-'));\r\n var name = option.substr(option.indexOf('-')+1);\r\n if (!defined(clicked)) clicked = false;\r\n if (status === null) status = !options[option];\r\n var refresh = type == 'stream' ? ['filter'] : ['layout'];\r\n switch(option) {\r\n case 'global-hide-topbar':\r\n $('body').toggleClass(name, status);\r\n break;\r\n case 'stream-expand-new':\r\n if (status) {\r\n var newtweetsbar = $('div#new-tweets-bar');\r\n if (newtweetsbar.length) newtweetsbar.trigger('click');\r\n }\r\n refresh = ['layout'];\r\n break;\r\n case 'dashboard-hide-filters':\r\n case 'dashboard-hide-options':\r\n widget.toggleClass(name, status);\r\n refresh = [];\r\n break;\r\n case 'stream-show-mutual':\r\n refresh = ['layout', 'mutual'];\r\n break;\r\n case 'stream-show-tab':\r\n case 'stream-show-br':\r\n case 'stream-show-via':\r\n case 'stream-compact-tweets':\r\n case 'stream-small-links':\r\n case 'stream-show-navigation':\r\n case 'stream-highlight-replies':\r\n refresh = ['layout'];\r\n break;\r\n case 'stream-expand-links':\r\n $('div.main-content a[data-'+(status ? 'expanded' : 'shortened')+'-url]').each(function() {\r\n var linkhtml = $(this).html();\r\n $(this).html($(this).attr('data-'+(status ? 'expanded' : 'shortened')+'-url'));\r\n $(this).attr('data-'+(status ? 'shortened' : 'expanded')+'-url', linkhtml);\r\n });\r\n refresh = [];\r\n break;\r\n }\r\n if (status.settingsloaded && option == 'stream-filter-invert' && options['stream-filter-disabled']) {\r\n return false; //don't invert the filter while it is disabled\r\n }\r\n options[option] = status; //set option\r\n if (option == 'stream-show-mutual') {\r\n ticking.fetchrelationships = !!status;\r\n }\r\n if (option == 'stream-filter-disabled') {\r\n widget.find('ul.tweetfilter-list input,li.filter input')\r\n .not('[data-option=stream-filter-disabled],[data-option=stream-show-navigation],[data-option=dashboard-show-matchcount]')\r\n .attr('disabled', status);\r\n setstreamtitle();\r\n refresh = ['filter', 'layout'];\r\n }\r\n if (!clicked || option == 'stream-filter-invert') {\r\n widget.find('input[data-option='+option+']').attr('checked', status);\r\n }\r\n if (clicked && option == 'stream-filter-invert') {\r\n window.scrollTo(0,0); //scroll to top when switching between timeline and filtered\r\n }\r\n if (option == 'stream-filter-invert' || option == 'stream-show-tab') {\r\n setstreamtitle();\r\n }\r\n if (clicked) {\r\n savesettings();\r\n applycss(refresh);\r\n } else {\r\n _W('setoption not applying css: '+option);\r\n }\r\n return status;\r\n }", "function createOptions(options){var object={};jQuery.each(options.match(rnothtmlwhite)||[],function(_,flag){object[flag]=true;});return object;}", "function createOptions(options){var object={};jQuery.each(options.match(rnothtmlwhite)||[],function(_,flag){object[flag]=true;});return object;}", "function createOptions(options){var object={};jQuery.each(options.match(rnothtmlwhite)||[],function(_,flag){object[flag]=true;});return object;}", "get options() {\n return this._options;\n }", "static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"helpMenu\",\n title: \"Material Deck: \"+game.i18n.localize(\"MaterialDeck.Sett.Help\"),\n template: \"./modules/MaterialDeck/templates/helpMenu.html\",\n width: \"500px\"\n });\n }", "function initializeOptions(options)\n{\n\tif (!options)\n\t\treturn;\n\n\tfunction setValue(id, value)\n\t{\n\t\tvar elem = document.getElementById(id);\n\t\telem.value = value.toString();\n\t}\n\tfunction setCheck(id, isChecked)\n\t{\n\t\tvar elem = document.getElementById(id);\n\t\telem.checked = !!isChecked;\n\t}\n\n\tsetValue(\"temp-download-folder\", options.tempdir);\n\tsetValue(\"download-user-agent\", options.userAgent);\n\tsetValue(\"max-saved-releases\", options.maxSavedReleases);\n\tsetValue(\"max-download-retry-time\", options.maxDownloadRetryTimeSeconds);\n\tsetValue(\"debug-output-level\", options.level);\n\tsetCheck(\"debug-debug\", options.debug);\n\tsetCheck(\"save-download-history\", options.saveDownloadHistory);\n\tsetCheck(\"download-dupe-releases\", options.downloadDupeReleases);\n\tsetValue(\"path-rar\", options.pathToUnrar);\n\tsetValue(\"path-utorrent\", options.pathToUtorrent);\n\t\n\tsetValue(\"path-sonarr\", options.announce.sonarrPath);\n\tsetValue(\"apikey-sonarr\", options.announce.sonarrApiKey);\n\tsetValue(\"path-radarr\", options.announce.radarrPath);\n\tsetValue(\"apikey-radarr\", options.announce.radarrApiKey);\n\tsetValue(\"hdtv-delay\", options.announce.hdtvDelay);\n\tsetValue(\"web-delay\", options.announce.webDelay);\n\t\n\tupdateMenulist.selectItemWithValue(options.updateCheck);\n\n\tsetValue(\"webui-user\", options.webui.user);\n\tsetValue(\"webui-password\", options.webui.password);\n\tsetValue(\"webui-hostname\", options.webui.hostname);\n\tsetValue(\"webui-port\", options.webui.port);\n\tsetCheck(\"webui-https\", options.webui.https);\n\n\tsetValue(\"ftp-user\", options.ftp.user);\n\tsetValue(\"ftp-password\", options.ftp.password);\n\tsetValue(\"ftp-hostname\", options.ftp.hostname);\n\tsetValue(\"ftp-port\", options.ftp.port);\n\t\n\n\tuploadMethod.initializeGui(options.uploadMethod);\n\tscriptExecDialog.initializeGui(options.scriptExecOptions);\n}", "function save_options(options) {\r\n API_GetTabURL(function(url) {\r\n var domain = url.match(/^[\\w-]+:\\/*\\[?([\\w\\.:-]+)\\]?(?::\\d+)?/)[1];\r\n saveBody(domain, options);\r\n });\r\n }", "function go(options) {\n\tlet {speed = 4,\n\t\tenable: {hyperdrive = false,\n\t\t\tfrobnifier = true}} = options;\n\tconsole.log(\"speed=\", speed,\n\t \"hyperdrive:\", hyperdrive,\n\t \"frobnifier:\", frobnifier)\n}", "function openOptions() {\n chromeRuntime.openOptionsPage();\n }", "function LiveAnnouncerDefaultOptions() {}", "SetOption() {\n\n }", "static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: \"mountup-settings-form\",\r\n title: \"Mount Up! - Settings\",\r\n template: \"./modules/mountup/templates/settings.html\",\r\n classes: [\"sheet\"],\r\n width: 500,\r\n closeOnSubmit: true\r\n });\r\n }", "function StepperOptions() {}", "static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: 'turnmarker-settings-form',\n title: 'Turn Marker - Global Settings',\n template: './modules/turnmarker/templates/settings.html',\n classes: ['sheet', 'tm-settings'],\n width: 500,\n closeOnSubmit: true\n });\n }", "_setFormOptions () {\n this.formOptions = {\n limit: this._get('limit'),\n strict: this._get('strict')\n }\n }", "function enableOptions() {\n let config = document.querySelector('#options')\n let wheel = document.querySelector('#cog')\n wheel.addEventListener('click', function() {\n config.style.display = 'block'\n })\n let close = document.querySelector('#close-options')\n close.addEventListener('click', function() {\n config.style.display = 'none'\n })\n}", "function createOptions(options){var object=optionsCache[options]={};jQuery.each(options.match(core_rnotwhite)||[],function(_,flag){object[flag]=true;});return object;}", "function startup() {\n toggleOptions();\n}", "_setUploadOptions () {\n this.uploadOptions = {\n maxFieldsSize: bytes(this._get('uploads.maxSize', '4mb')),\n hash: this._get('uploads.hash', false),\n multiples: this._get('uploads.multiple', true),\n maxFields: this._get('qs.parameterLimit', 1000)\n }\n }", "setOptions() {\n let defaultObj = {numChar: 1, limitNum: 3, orderBlock: [\"suggest\",\"collection\",\"product\"]};\n if(!this.options)\n {\n this.options = defaultObj; // set default if user not put arg\n }\n else {\n for(let key in defaultObj) // \n {\n if(!this.options[key])\n {\n this.options[key] = defaultObj[key];\n }\n }\n }\n \n\n \n }", "function optionsMain() {\n var yffValidator = new YffValidator();\n\n var canvas = $('#yff_editing_icon_canvas')[0];\n canvas.width = YFF_CONST.iconSize;\n canvas.height = YFF_CONST.iconSize;\n\n var yffCanvas = new YffCanvas(canvas);\n\n registerDataBindings(yffCanvas);\n registerEventListners(yffCanvas, yffValidator);\n\n\n // 初期値はlocalStorageから(modelから)とる\n // これをform element操作でメモリ上で変更していく\n // var icon_setting = {\n // iconFrom: 'simple',\n // simple: {\n // bg_color: '#0af',\n // character: 'W',\n // },\n // localImg: {\n // data_url: null,\n // },\n // }\n\n //\n // Event listners (Controllers)\n $('#yff_register_btn').click(function() {\n // var iconFrom = ;\n\n chrome.storage.local.set(icon_setting, function() {\n console.log('setting has been saved.');\n console.log(icon_setting);\n });\n });\n }", "function optionsMain() {\n var yffValidator = new YffValidator();\n\n var canvas = $('#yff_editing_icon_canvas')[0];\n canvas.width = YFF_CONST.iconSize;\n canvas.height = YFF_CONST.iconSize;\n\n var yffCanvas = new YffCanvas(canvas);\n\n registerDataBindings(yffCanvas);\n registerEventListners(yffCanvas, yffValidator);\n\n\n // 初期値はlocalStorageから(modelから)とる\n // これをform element操作でメモリ上で変更していく\n // var icon_setting = {\n // iconFrom: 'simple',\n // simple: {\n // bg_color: '#0af',\n // character: 'W',\n // },\n // localImg: {\n // data_url: null,\n // },\n // }\n\n //\n // Event listners (Controllers)\n $('#yff_register_btn').click(function() {\n // var iconFrom = ;\n\n chrome.storage.local.set(icon_setting, function() {\n console.log('setting has been saved.');\n console.log(icon_setting);\n });\n });\n }", "function LiveAnnouncerDefaultOptions() { }", "function save_main_options() {\n chrome.storage.sync.set({ operationMode: this.value}, function (items) {\n try_update_status('status', 'Options saved', 1300);\n });\n}", "function SetQuickOptionsNormal() {\n\n\t// Disables upgradable towers in standard and random_omg\n\tvar map_info = Game.GetMapInfo();\n\tif (map_info.map_display_name == \"extended_standard\" || map_info.map_display_name == \"extended_random_omg\") {\n\t\t$('#TowerUpgradesToggle').SetSelected(false);\n\t} \n\n\t// Sets everything else to normal options\n\t$('#GoldExpOptionsDropdown').SetSelected('GoldExpOption1');\n\t$('#CreepPowerOptionsDropdown').SetSelected('CreepPowerOption1');\n\t$('#TowerPowerOptionsDropdown').SetSelected('TowerPowerOption1');\n\t$('#RespawnTimeOptionsDropdown').SetSelected('RespawnTimeOption1');\n\t$('#InitialGoldExpDropdown').SetSelected('InitialGoldExp1');\n}", "function save_options(){\r\n var _url = doc[$elem]('custom-url');\r\n var url = _url[_val];\r\n if (url == \"\") {\r\n url = aboutPages[0];\r\n }\r\n\r\n save(true, url);\r\n}" ]
[ "0.6493614", "0.6375284", "0.6356264", "0.6294037", "0.62434876", "0.62434876", "0.6226594", "0.6223635", "0.6223635", "0.61327267", "0.6130398", "0.6036077", "0.6006456", "0.6006456", "0.5960391", "0.5933529", "0.58952624", "0.58769083", "0.58615315", "0.5857162", "0.5857162", "0.5857162", "0.58387953", "0.57151383", "0.5704376", "0.5657005", "0.5655251", "0.56319666", "0.56251895", "0.56086946", "0.5597041", "0.559104", "0.55868304", "0.55774736", "0.55311036", "0.55157906", "0.5501165", "0.5490724", "0.5486754", "0.54749477", "0.54721135", "0.5463437", "0.5461171", "0.5432031", "0.54208386", "0.54013973", "0.539501", "0.53921586", "0.5373745", "0.53611827", "0.5346085", "0.5345822", "0.5326414", "0.5304141", "0.52989507", "0.5298706", "0.529487", "0.5289772", "0.52883166", "0.5274742", "0.5261994", "0.5261994", "0.5253498", "0.52492154", "0.5236878", "0.52297795", "0.52282906", "0.5224373", "0.52241427", "0.5219197", "0.5215838", "0.5212013", "0.5198675", "0.51973003", "0.5194432", "0.5194432", "0.5194432", "0.51900625", "0.5176434", "0.517414", "0.5172171", "0.5169688", "0.51692325", "0.51638514", "0.51634735", "0.51618195", "0.51594317", "0.51497036", "0.51460415", "0.51320493", "0.5126474", "0.51252663", "0.5113617", "0.5111292", "0.51089525", "0.51089525", "0.5106536", "0.50946534", "0.5087297", "0.50852144" ]
0.61241627
11
Copied pattern from MDN, This function sanatizes and clones the state object that comes from the metal component. Sanitization is necessary before we can do message passing.
function cloneObj(objectToBeCloned, visited = new Set()) { if (!(objectToBeCloned instanceof Object)) { return objectToBeCloned; } let objectClone; try { if (objectToBeCloned && objectToBeCloned[ITERABLE_KEY]) { objectToBeCloned = objectToBeCloned.toJS(); } const Constructor = objectToBeCloned.constructor; switch (Constructor) { case RegExp: objectClone = new Constructor(objectToBeCloned); break; case Date: objectClone = new Constructor(objectToBeCloned.getTime()); break; case Function: objectClone = { __metal_devtools_read_only: true }; if (objectToBeCloned.name) { objectClone.value = `${objectToBeCloned.name}()`; } else if (objectToBeCloned.__jsxDOMWrapper) { objectClone.value = '<JSXElement />'; } else { objectClone.value = 'function()'; } break; default: try { objectClone = new Constructor(); } catch (err) { objectClone = Constructor.name; } } } catch (err) { console.log( '%c metal-devtools extension: (`clone`)\n', 'background: rgb(136, 18, 128); color: #DDD', err ); console.log( '%c Args:', 'background: rgb(136, 18, 128); color: #DDD', objectToBeCloned ); } if (objectClone instanceof Object) { visited.add(objectToBeCloned); for (const key in objectToBeCloned) { if (Object.prototype.hasOwnProperty.call(objectToBeCloned, key)) { const prop = objectToBeCloned[key]; if (typeof prop !== undefined) { objectClone[key] = visited.has(prop) ? '[Circular]' : cloneObj(prop, visited); } } } visited.delete(objectToBeCloned); } return objectClone; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "initializeState() {\n const attrs = this.state.attributes;\n attrs.x = 0;\n attrs.y = 0;\n }", "applyState(state) {\n const me = this;\n me.beginBatch();\n\n if ('locked' in state) {\n me.locked = state.locked;\n }\n\n if ('minWidth' in state) {\n me.minWidth = state.minWidth;\n }\n\n if ('width' in state) {\n me.width = state.width;\n }\n\n if ('flex' in state) {\n me.flex = state.flex;\n }\n\n if ('width' in state && me.flex) {\n me.flex = undefined;\n } else if ('flex' in state && me.width) {\n me.width = undefined;\n }\n\n if ('text' in state) {\n me.text = state.text;\n }\n\n if ('region' in state) {\n me.region = state.region;\n }\n\n if ('renderer' in state) {\n me.renderer = state.renderer;\n }\n\n if ('filterable' in state) {\n me.filterable = state.filterable;\n }\n\n me.endBatch();\n\n if ('hidden' in state) {\n me.toggle(state.hidden !== true);\n }\n }", "applyState(state) {\n const me = this;\n\n me.beginBatch();\n\n if ('locked' in state) {\n me.locked = state.locked;\n }\n\n if ('minWidth' in state) {\n me.minWidth = state.minWidth;\n }\n\n if ('width' in state) {\n me.width = state.width;\n }\n\n if ('flex' in state) {\n me.flex = state.flex;\n }\n\n if ('width' in state && me.flex) {\n me.flex = undefined;\n } else if ('flex' in state && me.width) {\n me.width = undefined;\n }\n\n if ('text' in state) {\n me.text = state.text;\n }\n\n if ('region' in state) {\n me.region = state.region;\n }\n\n if ('renderer' in state) {\n me.renderer = state.renderer;\n }\n\n if ('filterable' in state) {\n me.filterable = state.filterable;\n }\n\n me.endBatch();\n\n if ('hidden' in state) {\n me.toggle(state.hidden !== true);\n }\n }", "rehydrate(state) {\n this.id = state.id;\n this.type = state.type;\n this.message = state.message;\n this.autoMiss = state.autoMiss;\n this.buttons = state.buttons;\n this.hidden = state.hidden;\n this.timeout = state.timeout;\n }", "prepareState() {\n /* ... */\n }", "state(s){if (s) this.memory.state = s; return this.memory.state;}", "function build (initialState) {\n\t\tif(typeof initialState !== 'undefined' && stateCache.data instanceof State) {\n\t\t\tthrow new Error('Cannot bootstrap existing state object.');\n\t\t}\n\t\t\n\t\tstateCache.data = either(new State(initialState), stateCache.data, 'object');\n\t\treturn stateCache.data;\n\t}", "reset() {\r\n return this.state = \"normal\";\r\n }", "function cloneState(state){\n var acc = state.acc.clone(); var vel = state.vel.clone(); var pos = state.pos.clone();\n var ang = {\"acc\": state.angular.acc, \"vel\": state.angular.vel, \"pos\": state.angular.pos};\n return {\"acc\": acc, \"vel\": vel, \"pos\": pos, \"angular\": ang};\n}", "updateState(state, payload) {\n return Object.assign({}, state, payload);\n }", "resetState(state) {\n for (let prop in state) {\n state[prop] = initialState[prop];\n }\n }", "resetState(state) {\n for (let prop in state) {\n state[prop] = initialState[prop];\n }\n }", "initTempState(){\n this._tempState = {};\n }", "function mutate(state) {\n\n const mutation = Object.assign({}, localState, state);\n\n localState = mutation;\n\n return mutation;\n}", "static cloneDisclosureState(state) {\n const newState = { ...state };\n newState.disclosureComponentKeys = Object.assign([], newState.disclosureComponentKeys);\n newState.disclosureComponentData = { ...newState.disclosureComponentData };\n newState.disclosureComponentDelegates = Object.assign([], newState.disclosureComponentDelegates);\n\n return newState;\n }", "function cloneState(state) {\n return {\n board: cloneBoard(state.board),\n hands: cloneHands(state.hands),\n nextTurn: state.nextTurn,\n };\n}", "reset (size) {\n this.state = Object.assign({}, this.state, {\n size,\n ctrl: false,\n shift: false,\n hover: -1,\n specified: -1,\n modify: -1,\n selected: []\n })\n\n return this.state\n }", "rehydrate (state) {\n this.currentTime = state.currentTime;\n this.currentDuration = state.currentDuration;\n this.momentDate = state.momentDate;\n }", "resetSIMMState() {\r\n this.setState({\r\n currentReference : -1,\r\n currentProcess : 'N/A',\r\n currentPage : 'N/A',\r\n swapSpace : new SwapSpace(),\r\n frameTable : new FrameTable(),\r\n colorGenerator : new ColorGenerator()\r\n });\r\n }", "reset_techInfo_State(some){\r\n\t\t//this.setState(this.initialState);\r\n\t\t//alert(\"resetting\");\r\n\t\t//alert(\"this.baseState-> \" + this.baseState );\r\n\t\tthis.setState({ //sets new value to state //setState is an async function\r\n techInfoState: this.state.baseState\r\n }); \r\n\t}", "function setInitialState(state, incomingData) {\n let width = incomingData.dimensions[0];\n let height = incomingData.dimensions[1];\n let size = incomingData.blockSize;\n\n let initialState = Immutable.fromJS({\n gameSpec: {\n widthRatio: width,\n heightRatio: height,\n blockSize: size\n },\n isPaused: true,\n gameLost: false,\n secondsElapsed: 0,\n livePiece: [],\n deadPieces: [],\n queuedPiece: []\n });\n\n return state.merge(initialState)\n}", "constructor() { \r\n super();\r\n this.state = {};\r\n }", "function unliftState(liftedState) { // 199\n var computedStates = liftedState.computedStates; // 200\n var currentStateIndex = liftedState.currentStateIndex; // 201\n var state = computedStates[currentStateIndex].state; // 202\n // 203\n return state; // 204\n} // 205", "setState (states) {\n if (toString.call(states) === '[object Array]') {\n //TODO Array deep single re-assign or full coverage?\n this._model.splice(0, this._model.length, ...states)\n } else if (toString.call(states) === '[object Object]') {\n Object\n .entries(states)\n .filter(([key, value]) => typeof value !== 'function')\n .forEach(([key, value]) => {\n const isInclude = Object.keys(this._model).includes(key)\n if (!isInclude) return null\n if (typeof value === 'object') {\n this._model[key]['__pipe__'].setState(value)\n } else {\n this._model[key] = value\n }\n })\n }\n return this._model\n }", "function State(amps){\n \n this.amps = CMatrix.create(amps);\n this.normalize();\n }", "_transferState(oldLayer) {\n debug(TRACE_MATCHED, this, this === oldLayer);\n\n const {state, internalState} = oldLayer;\n\n if (this === oldLayer) {\n return;\n }\n\n // Move internalState\n this.internalState = internalState;\n this.internalState.layer = this;\n\n // Move state\n this.state = state;\n // We keep the state ref on old layers to support async actions\n // oldLayer.state = null;\n\n // Ensure any async props are updated\n this.internalState.setAsyncProps(this.props);\n\n this.diffProps(this.props, this.internalState.getOldProps());\n }", "_resetState () {\n this._state.initialize(this._rate, this._capacity)\n return this\n }", "reset(state) {\n state.isLogged = false\n state.isAdmin = false\n state.isRoot = false\n state.id = ''\n state.name = ''\n state.role = ''\n state.description = {}\n state.groupIds = []\n }", "reconcileState() {\n this.addBlocker('RENDER');\n const newNode = createElement(this.render());\n this.removeBlocker();\n\n replaceNode(this.node, newNode);\n\n this.node = newNode;\n }", "reset() {\n state = createGameState();\n notifyListeners();\n }", "reset() {\r\n this.state=this.initial;\r\n this.statesStack.clear();\r\n\r\n }", "reset() {\r\n this.state = this.initial;\r\n }", "function state_copy(current_state){\n\tvar i, j;\n\tvar new_state = new game_state();\n\t\n\tnew_state.gameboard = new gboard();\n\tnew_state.gameboard.init(current_state.gameboard.cards);\n\n\tfor(i = 0; i < current_state.player_cards.length; i++){\n if(current_state.player_cards[i] != null){\n new_state.player_cards[i] = triple_triad.card(\n current_state.player_cards[i].id,\n current_state.player_cards[i].values,\n current_state.player_cards[i].image,\n current_state.player_cards[i].name,\n current_state.player_cards[i].owner,\n current_state.player_cards[i].is_placed\n );\n }\n else{\n new_state.player_cards[i] = null;\n }\n\t\t\n\t}\n\t\n\tfor(i = 0; i < current_state.computer_cards.length; i++){\n if(current_state.computer_cards[i] != null){\n\t\tnew_state.computer_cards[i] = triple_triad.card(\n current_state.computer_cards[i].id,\n current_state.computer_cards[i].values,\n current_state.computer_cards[i].image,\n current_state.computer_cards[i].name,\n current_state.computer_cards[i].owner,\n current_state.computer_cards[i].is_placed\n );\n }\n else{\n new_state.computer_cards[i] = null;\n }\n\t}\n \n\treturn new_state;\n}", "_setInitialState(){\n if(this.state.initial) return;\n const computedStyles = getComputedStyle(this);\n this.state.initial = {};\n this.state.initial.type = this.type;\n this.state.initial.icon = this.icon;\n this.state.initial.color = this.style.color;\n this.state.initial.borderColor = computedStyles.getPropertyValue(\"--border-color\");\n this.state.initial.hoverBorderColor = computedStyles.getPropertyValue(\"--hover-border-color\");\n this.state.initial.hoverColor = computedStyles.getPropertyValue(\"--hover-color\");\n this.state.initial.backgroundColor = computedStyles.getPropertyValue(\"--background-color\");\n this.state.initial.hoverBackgroundColor = computedStyles.getPropertyValue(\"--hover-background-color\");\n\n }", "function setState(newState) {\n //if (newState.items) state.items = newState.items;\n //if (newState.addItemInput) state.addItemInput = newState.addItemInput;\n //if (newState.listNameInput) state.listNameInput = newState.listNameInput;\n //if (newState.listName) state.listName = newState.listName;\n state = {...state, ...newState};\n //console.log(state)\n rerender();\n}", "function rehydrate() {\n // inject initial state into stores\n return _store2.default.set(window.__STATE);\n}", "async _rehydrateState() {\n let initState, initErrState, initEstsState, initCalcdAt, initAllowTypes\n try {\n const {\n [STORAGE_KEYS.ALLOW_TYPES]: allowTypes,\n [ImportStateManager.ERR_STATE_STORAGE_KEY]: savedErrState,\n [ImportStateManager.STATE_STORAGE_KEY]: savedState,\n [ImportStateManager.ESTS_STORAGE_KEY]: {\n calculatedAt,\n ...savedEsts\n },\n } = await browser.storage.local.get({\n [STORAGE_KEYS.ALLOW_TYPES]: ImportStateManager.DEF_ALLOW_TYPES,\n [ImportStateManager.ERR_STATE_STORAGE_KEY]: [],\n [ImportStateManager.STATE_STORAGE_KEY]: [],\n [ImportStateManager.ESTS_STORAGE_KEY]: ImportStateManager.getInitEsts(),\n })\n initAllowTypes = allowTypes\n initState = savedState\n initErrState = savedErrState\n initEstsState = savedEsts\n initCalcdAt = calculatedAt\n } catch (error) {\n initAllowTypes = ImportStateManager.DEF_ALLOW_TYPES\n initState = []\n initErrState = []\n initEstsState = ImportStateManager.getInitEsts()\n initCalcdAt = 0\n } finally {\n this.allowTypes = initAllowTypes\n this.storageKeyStack = initState\n this.errStorageKeyStack = initErrState\n this.currErrChunk = this.errStorageKeyStack.length - 1\n this.counts = initEstsState\n this.calculatedAt = initCalcdAt\n }\n }", "function resetToInitialState() {\n storage.clear(STATE_STORAGE)\n setState(Object.assign({}, INITIAL_STATE))\n}", "function autofresh(state) {\n if(!state.fresh)\n return;\n\n state.fresh = false;\n state.tree = new Tree('.');\n\n // lazy computed\n state.index = null;\n}", "[types.SET_INITIAL_STATE](state, initialState = {}) {\n Object.assign(state, pick(initialState, initialStateKeys));\n }", "copyState(state){\n\n var remotePlayers = state.players;\n\n // remove old players\n for(var i in this.players){\n if(!remotePlayers.hasOwnProperty(i)){\n delete this.players[i];\n }\n }\n\n // Update and add any new players \n for(var i in remotePlayers){\n var remotePlayer = remotePlayers[i];\n \n if(!this.players.hasOwnProperty(remotePlayer.id)){\n console.log('copying unknown player');\n this.players[remotePlayer.id] = new Player();\n }\n \n var localPlayer = this.players[remotePlayer.id];\n \n \n localPlayer.state = remotePlayer;\n }\n\n\n\n var remoteMap = state.map;\n this.map.state = remoteMap;\n\n \n }", "constructor() {\n super();\n this.state = {};\n }", "build() {\n const state = Immutable.from(this.state);\n this.setState(state);\n return state.asMutable();\n }", "initInteractionState() {\n this.dirty = false;\n this.prefilled = !this._isEmpty();\n }", "clear() {\n this.state = new TurtleState(new THREE.Vector3(0,0,0), new THREE.Vector3(0,1,0)); \n stateStack = [];\n }", "constructor() {\n super()\n this.state = intialState\n }", "reset() {\r\n this.state = this.config.initial;\r\n }", "function StateMachine(initialState) {\n var __arguments = new Array(arguments.length);\n for (var __argumentIndex = 0; __argumentIndex < __arguments.length; ++__argumentIndex) {\n __arguments[__argumentIndex] = arguments[__argumentIndex];\n }\n if (__arguments.length == 1) {\n var initialState_1 = __arguments[0];\n //super();\n this.fmliveswitchStateMachineInit();\n this.__pendingPromises = {};\n this.__transitions = {};\n this.__transitionReachabilityMatrix = {};\n this.__states = new Array();\n this.__transitionsLock = new Object();\n this.setSystemTimestamp(-1);\n this.setLastStateTicks(-1);\n this.setStateValue(this.stateToValue(initialState_1));\n }\n else {\n throw new fm.liveswitch.Exception('Constructor overload does not exist with specified parameter count/type combination.');\n }\n }", "updateCreate (state, payload) {\n // like update, but creates the object at location if it doesn't exist\n // basically like create w/o the checker\n // USE THIS SPARINGLY, most likely a state obj doesn't exist b/c of typo or race condition\n // if(!silent)\n // debug('Store.updateCreate', 'Creating', payload, state)\n console.log('UPDATECREATE', payload)\n\n // iterator \n Object.keys(payload).map((name, i) => {\n // const value = Object.values(payload)[0]\n // preserve things like functions, not just data w/ object.create\n state[name] = payload[name]\n })\n\n // single object\n // const name = Object.keys(payload)[0]\n // const value = Object.values(payload)[0]\n // state[name] = value\n }", "function state(name, norm_fn)\n{\n norm_fn = def(norm_fn, normalizeState);\n\n var value = norm_fn(name);\n require(typeof value !== 'undefined',\n \"Cannot create state from \" + repr(value));\n\n return new State(value);\n}", "reset() {\r\n this.state = this.config.initial;\r\n }", "function resetComponentState() {\n isParent = false;\n previousOrParentTNode = null;\n elementDepthCount = 0;\n bindingsEnabled = true;\n}", "function resetComponentState() {\n isParent = false;\n previousOrParentTNode = null;\n elementDepthCount = 0;\n bindingsEnabled = true;\n}", "function resetComponentState() {\n isParent = false;\n previousOrParentTNode = null;\n elementDepthCount = 0;\n bindingsEnabled = true;\n}", "function resetComponentState() {\n isParent = false;\n previousOrParentTNode = null;\n elementDepthCount = 0;\n bindingsEnabled = true;\n}", "cleanShoppingCard(state){\n state.shoppingCart = {} //empty object\n }", "function setState (nextState) {\n curState = nextState\n el.style.transformOrigin = '0 0'\n el.style.transform = toCSS(nextState.matrix)\n }", "function cloneTreeInState() {\n const clonedState = { ...state };\n clonedState.rooNote = { ...state.rootNote };\n clonedState.selectedNote = { ...state.selectedNote };\n return clonedState;\n }", "updateLexState(state, lexState) {\n state.lex = { ...state.lex, ...lexState };\n }", "updateCreate (state, payload) {\n // like update, but creates the object at location if it doesn't exist\n // basically like create w/o the checker\n // USE THIS SPARINGLY, most likely a state obj doesn't exist b/c of typo or race condition\n // if(!silent)\n // debug('Store.updateCreate', 'Creating', payload, state)\n // console.log('UPDATECREATE', payload)\n\n // iterator \n Object.keys(payload).map((name) => {\n // const value = Object.values(payload)[0]\n // preserve things like functions, not just data w/ object.create\n state[name] = payload[name]\n })\n\n // single object\n // const name = Object.keys(payload)[0]\n // const value = Object.values(payload)[0]\n // state[name] = value\n }", "getState() {\n return { ...this.state };\n }", "constructor(){\n super();\n this.state = {\n name : \"John\",\n input : \"\"\n }\n }", "setInitialState(initialState) {\n\t\tObject.assign(this.state, initialState);\n\t\tthis.setInitialState = noop;\n\t}", "function updateState(s) {\n s.wkWidth != null && (state.wkWidth = s.wkWidth);\n s.wkHeight != null && (state.wkHeight = s.wkHeight);\n s.bkWidth != null && (state.bkWidth = s.bkWidth);\n s.bkHeight != null && (state.bkHeight = s.bkHeight);\n s.x != null && (state.x = s.x);\n s.y != null && (state.y = s.y);\n }", "setNormal() {\n this.currentState = shtState.NORMAL;\n }", "function resetState(){\n Oclasses = {}; // known classes\n arrayOfClassVals = null; // cached array of class values\n arrayOfClassKeys = null; // cached array of class keys\n objectProperties = {}; // known object properties\n arrayOfObjectPropVals = null; // array of object property values\n arrayOfObjectPropKeys = null; // array of object property keys\n dataTypeProperties = {}; // known data properties\n arrayOfDataPropsVals = null; // array of data properties values\n\n classColorGetter = kiv.colorHelper();\n svg = null;\n zoomer = null;\n renderParams = null;\n mainRoot = null;\n panel = null;\n }", "function setState(newState) {\n Object.assign(state, newState);\n }", "clearState() {\n const emptyState = {};\n Object.keys(this.state).forEach((key) => {\n emptyState[key] = '';\n });\n\n this.setState(emptyState);\n }", "copy() {\n const new_state = new State();\n new_state.elevator_on = this.elevator_on;\n for(let floor = 0; floor < 4; floor++) {\n for(const elem of this.floors[floor]) {\n new_state.floors[floor].add(elem);\n }\n }\n\n return new_state;\n }", "getInitialState() {\n return {compact: false};\n }", "shake({ state }) {\n delete state.noop;\n }", "function normalizeState(newstate) {\n\t if (newstate === states.LOADING || newstate === states.STALLED) {\n\t return states.BUFFERING;\n\t }\n\t return newstate;\n\t }", "initializeState(handler = this._handler, options = {state: GraphObject.stateNew}) {\n handler._deltas = null;\n handler._identifier = undefined;\n handler._state = options.state;\n handler._store = null;\n handler._self = this;\n handler._transaction = null;\n return (handler);\n }", "constructor(state) {\n this.state = undefined;\n this.setState(state);\n }", "static clearState() {\n delete state.marchingOrder;\n MarchingOrder.State.getState();\n }", "static clearState() {\n delete state.marchingOrder;\n MarchingOrder.State.getState();\n }", "initializeState() {\n super.initializeState();\n const defaultWidth = 30;\n const defaultHeight = 50;\n const attrs = this.state.attributes;\n attrs.x1 = -defaultWidth / 2;\n attrs.y1 = -defaultHeight / 2;\n attrs.x2 = +defaultWidth / 2;\n attrs.y2 = +defaultHeight / 2;\n attrs.cx = 0;\n attrs.cy = 0;\n attrs.width = defaultWidth;\n attrs.height = defaultHeight;\n attrs.stroke = null;\n attrs.fill = { r: 200, g: 200, b: 200 };\n attrs.strokeWidth = 1;\n attrs.opacity = 1;\n attrs.visible = true;\n }", "constructor() {\n super();\n\n this._dirtyShader = true;\n\n // storage for texture and cubemap asset references\n this._assetReferences = {};\n\n this._activeParams = new Set();\n this._activeLightingParams = new Set();\n\n this.shaderOptBuilder = new StandardMaterialOptionsBuilder();\n\n this.reset();\n }", "changeLopperState(state, data){\n state.looperState = data\n }", "enterState (state = this.Data) {\n this.State = state;\n }", "function unliftState(liftedState) {\n var computedStates = liftedState.computedStates;\n var currentStateIndex = liftedState.currentStateIndex;\n var state = computedStates[currentStateIndex].state;\n\n return state;\n }", "constructor() {\n this.state = undefined\n }", "function construct(obj) {\n __vS = ViewState(obj);\n }", "clearState() {\n this.names = {};\n this.history = {};\n this.noids = {};\n this.avatars = {};\n }", "function unliftState(liftedState) {\n\t var computedStates = liftedState.computedStates;\n\t var currentStateIndex = liftedState.currentStateIndex;\n\t var state = computedStates[currentStateIndex].state;\n\t\n\t return state;\n\t}", "function unliftState(liftedState) {\n\t var computedStates = liftedState.computedStates;\n\t var currentStateIndex = liftedState.currentStateIndex;\n\t var state = computedStates[currentStateIndex].state;\n\t\n\t return state;\n\t}", "function unliftState(liftedState) {\n const { computedStates, currentStateIndex } = liftedState;\n const { state } = computedStates[currentStateIndex];\n return state;\n}", "resetStates() {\n Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tidy\"])(() => {\n this.layers.forEach(layer => {\n // tslint:disable:no-any\n if (layer.stateful) {\n layer.resetStates();\n }\n // tslint:enable:no-any\n });\n });\n }", "function unliftState(liftedState) {\n\t var computedStates = liftedState.computedStates;\n\t var currentStateIndex = liftedState.currentStateIndex;\n\t var state = computedStates[currentStateIndex].state;\n\n\t return state;\n\t}", "function unliftState(liftedState) {\n\t var computedStates = liftedState.computedStates;\n\t var currentStateIndex = liftedState.currentStateIndex;\n\t var state = computedStates[currentStateIndex].state;\n\n\t return state;\n\t}", "function unliftState(liftedState) {\n\t var computedStates = liftedState.computedStates;\n\t var currentStateIndex = liftedState.currentStateIndex;\n\t var state = computedStates[currentStateIndex].state;\n\n\t return state;\n\t}", "function unliftState(liftedState) {\n\t var computedStates = liftedState.computedStates;\n\t var currentStateIndex = liftedState.currentStateIndex;\n\t var state = computedStates[currentStateIndex].state;\n\n\t return state;\n\t}", "function unliftState(liftedState) {\n\t var computedStates = liftedState.computedStates;\n\t var currentStateIndex = liftedState.currentStateIndex;\n\t var state = computedStates[currentStateIndex].state;\n\n\t return state;\n\t}", "function resetComponentState(){isParent=false;previousOrParentTNode=null;elementDepthCount=0;bindingsEnabled=true;}", "constructor(props) {\n super(props);\n //for things that will effect the UI inside state\n // immutable\n this.state = {\n countryData: null,\n countryCode: 'new code',\n name: 'name'\n }\n }", "function State() { }", "setState(newValue, stateName, tableName){\n //if(tableName == 'firstSection' || tableName == 'LastSection') console.log('setState(): ' + stateName + '.' + tableName)\n //if(tableName == 'formData' || tableName == 'formsList') console.log(newValue)\n //var self = this;\n //if(tableName == 'formData' || tableName == 'formsList') console.log(self.state[stateName][tableName])\n //if(tableName == 'formData') console.log('Val FormID: ' + newValue.FormID)\n //if(tableName == 'formData' && this.state.database.formData && this.state.database.formData.hasOwnProperty('FormID')) console.log('Start DB FormID: ' + this.state.database.formData.FormID)\n //if(tableName == 'formData' && this.state.form.formData && this.state.form.formData.hasOwnProperty('FormID')) console.log('Start Form FormID: ' + this.state.form.formData.FormID)\n \n //var cloned = clone(newValue);\n //console.log(cloned);\n //if( self.state[stateName][tableName] && typeof(self.state[stateName][tableName]) === 'object' && !(Array.isArray(self.state[stateName][tableName])) ){\n // if(tableName == 'formData') console.log('1st');\n // self.state[stateName][tableName] = Object.assign({}, (self.state[stateName][tableName]), cloned);\n //}\n //else{\n // if(tableName == 'formData') console.log('2nd');\n // this.state[stateName][tableName] = cloned;\n //}\n this.state[stateName][tableName] = clone(newValue);\n\n //if(tableName == 'formData' && this.state.database.formData && this.state.database.formData.hasOwnProperty('FormID')) console.log('End DB FormID: ' + this.state.database.formData.FormID)\n //if(tableName == 'formData' && this.state.form.formData && this.state.form.formData.hasOwnProperty('FormID')) console.log('End Form FormID: ' + this.state.form.formData.FormID)\n }", "function setState(newState) {\n Object.assign(state, newState);\n\n if (state.draggable) {\n document.getElementById('sulfacidContainer').classList.add('sulfacid_draggable');\n } else {\n document.getElementById('sulfacidContainer').classList.remove('sulfacid_draggable');\n if (state.interaction) {\n state.interaction.stop();\n resetPosition(state.element);\n }\n }\n\n if (state.inDropzone)\n document.getElementById('sulfacidContainer').dataset.inDropzone = 'true';\n else\n document.getElementById('sulfacidContainer').dataset.inDropzone = 'false';\n \n if(state.dropzone) \n document.getElementById('sulfacidContainer').classList.add('pipette-sulfacid_dropzone');\n else\n document.getElementById('sulfacidContainer').classList.remove('pipette-sulfacid_dropzone');\n}", "mapStateToThis(state) {\n const devices = state.devices;\n const isLoading = state.isLoading;\n return {\n devices,\n isLoading\n };\n }", "constructor(initialState = {}) {\n\n /**\n * @type {{}}\n * @private property _state\n */\n\t\tlet _state = initialState;\n\n /**\n * For locking unlocking state.\n */\n\t\tlet callbackArray = [];\n\t\tlet _lock = false;\n\n /**\n * Returns the current State.\n */\n\t\tthis.getState = () => this.truncateObject(_state);\n\n /**\n *\n * @param initial (Object), initial State.\n * @param append (Any), the object or value to be appended\n * @returns {State}\n */\n\t\tthis.create = (initial, append) => {\n\t\t\tif (typeof append === 'undefined') {\n\t\t\t\tif (Object.keys(_state).length === 0) return new State(initial);\n\t\t\t\telse {\n\t\t\t\t\tObject.assign(_state, initial);\n\t\t\t\t}\n\t\t\t} else _state = this.appendObject(initial, append, _state);\n\t\t};\n\n /**\n *\n * @param keys (String), keys with dotted notation\n * @param value (Any)\n * @returns Object or Value of the key if second argument is not provided\n */\n\t\tthis.prop = (keys, value) => {\n\t\t\tif (typeof value === 'undefined') {\n\t\t\t\tlet temp = _state;\n\t\t\t\tkeys.split('.')\n\t\t\t\t\t.filter(key => key)\n\t\t\t\t\t.forEach(key => {\n\t\t\t\t\t\tif (typeof temp[key] === 'undefined') throw Error(\"Key doesn't exist\");\n\t\t\t\t\t\ttemp = temp[key];\n\t\t\t\t\t});\n\t\t\t\treturn typeof temp === 'object' ? this.truncateObject(temp) : temp;\n\t\t\t} else {\n\t\t\t\t_state = this.appendObject(keys, value, _state);\n\t\t\t}\n\n\t\t\tif (_lock) return this;\n\t\t};\n\n /**\n * Internal function to handle 'on' and 'lock' feature\n * @param keys (String), keys with dotted notation\n * @param callback, listener to be attached on changing the given key\n * @param type, internal functionality for 'on' and 'lock' feature\n * @returns unsubscribe function to detach the listener.\n */\n\t\tconst onChange = (keys, callback, type) => {\n\t\t\tlet temp = _state;\n\t\t\tconst keysArray = keys.split('.');\n\n\t\t\tfor (let i = 0; i < keysArray.length - 1; i++) {\n\t\t\t\ttemp = temp[keysArray[i]];\n\t\t\t}\n\n\t\t\tObject.defineProperty(temp, `_${keysArray[keysArray.length - 1]}`, {\n\t\t\t\tset: (val) => {\n\t\t\t\t\tif (type === 'on' && !_lock) {\n\t\t\t\t\t\tcallback(temp[keysArray[keysArray.length - 1]], val);\n\t\t\t\t\t} else {\n\n // For .next() functionality\n\n\t\t\t\t\t\t// call.value = !call.first ? temp[keysArray[keysArray.length - 1]] : call.value;\n\t\t\t\t\t\t// call.first = true;\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// setTimeout(() => {\n\t\t\t\t\t\t// \tif (!call.last) {\n\t\t\t\t\t\t// \t\tcallback(call.value, temp[keysArray[keysArray.length - 1]]);\n\t\t\t\t\t\t// \t\tcall.last = true;\n\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t// }, 0); // TODO: devise some other method\n\n\t\t\t\t\t\tif(_lock){\n\t\t\t\t\t\t\tcallbackArray.push({\n\t\t\t\t\t\t\t\tcallback,\n\t\t\t\t\t\t\t\targs: [temp[keysArray[keysArray.length - 1]], val]\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\n\t\t\t\t\ttemp[keysArray[keysArray.length - 1]] = val;\n\t\t\t\t},\n\t\t\t\tget: () => {\n\t\t\t\t\treturn temp[keysArray[keysArray.length - 1]];\n\t\t\t\t},\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t});\n\n\t\t\treturn () => {\n\t\t\t\tObject.defineProperty(temp, `_${keysArray[keysArray.length - 1]}`, {\n\t\t\t\t\tset: undefined,\n\t\t\t\t\tget: undefined,\n\t\t\t\t\tenumerable: false\n\t\t\t\t});\n\t\t\t};\n\t\t};\n\n\n /**\n * To attach the listener to a property\n * @param keys (String), keys with dotted notation\n * @param callback, listener to be attached on changing the given key\n * @returns unsubscribe function\n */\n\t\tthis.on = (keys, callback) => {\n\t\t\treturn onChange(keys, callback, 'on');\n\t\t};\n\n /**\n * To be implemented yet.\n * @param keys\n * @param callback\n * @returns {unsubscribe}\n */\n\t\tthis.next = (keys, callback) => {\n\t\t\treturn onChange(keys, callback, 'next');\n\t\t};\n\n /**\n * 'lock' to lock the State till unlock is called\n * @returns State to chain the functions\n */\n\t\tthis.lock = () => {\n\t\t\t_lock = true;\n\t\t\treturn this;\n\t\t};\n\n /**\n * 'unlock' to unlock the State and call the onChange listener\n */\n\t\tthis.unlock = () => {\n\t\t\t_lock = false;\n\t\t\tlet initialArgs = callbackArray[0].args[0],\n\t\t\t\tfinalArgs = callbackArray.pop().args[1];\n\n\t\t\tinitialArgs = typeof initialArgs === 'object' ? this.truncateObject(initialArgs) : initialArgs;\n\t\t\tfinalArgs = typeof finalArgs === 'object' ? this.truncateObject(finalArgs) : finalArgs;\n\n\t\t\tcallbackArray[0].callback(initialArgs, finalArgs);\n\t\t\tcallbackArray = [];\n\t\t}\n\t}", "static getDerivedStateFromProps(props, state) {\n if (state.prevUsfmStringProp == props.usfmString)\n return null;\n return {\n value: usfmToSlate(props.usfmString),\n prevUsfmStringProp: props.usfmString,\n };\n }" ]
[ "0.6124759", "0.57275933", "0.56990856", "0.56926686", "0.5662724", "0.5585343", "0.55745834", "0.55051565", "0.5490954", "0.54680383", "0.54675734", "0.54675734", "0.54620355", "0.5431983", "0.54094213", "0.53941655", "0.5349134", "0.5344846", "0.53265876", "0.53182393", "0.5313821", "0.52831393", "0.52696884", "0.52638084", "0.5259711", "0.5252632", "0.52396894", "0.52332985", "0.52329123", "0.522715", "0.5226141", "0.5223561", "0.5221458", "0.5219548", "0.52087164", "0.52066815", "0.5202269", "0.51610863", "0.5151222", "0.51508665", "0.5148503", "0.51452285", "0.5138467", "0.51220316", "0.5117089", "0.51026165", "0.50856626", "0.5080537", "0.5078573", "0.5075754", "0.50668144", "0.50419974", "0.50419974", "0.50419974", "0.50419974", "0.50407094", "0.50390637", "0.5037852", "0.50376225", "0.50316674", "0.50238407", "0.50198543", "0.5010669", "0.5007186", "0.50036114", "0.49902025", "0.4989854", "0.49877813", "0.49876022", "0.49775663", "0.49753287", "0.4968743", "0.49635434", "0.4963312", "0.49592456", "0.49592456", "0.4958883", "0.49422938", "0.49401674", "0.4930387", "0.49224895", "0.4921648", "0.49117473", "0.49070323", "0.49055538", "0.49055538", "0.49031714", "0.4898621", "0.48964745", "0.48964745", "0.48964745", "0.48964745", "0.48964745", "0.48939842", "0.4891698", "0.48816627", "0.48810306", "0.4877339", "0.48627204", "0.4862529", "0.48547843" ]
0.0
-1
to be created. only run once at the very start of the cog task
function Init() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Init()\n{\n\t// initiate counters\n\ttrialNum = 0;\n\n\t// timing params\n\ttrial_timeout = 6000;\n\t\n\t// init params\n\tresponse_time = -2;\n\tcurrent_time = -2;\n \n drag_stream = [];\n\n\t// global cogtask variables\n\tSetName(GetName());\n\n\t// turn bloat on/off for dev\n\tbloat = 999;\n\tbloat_calc = 0;\n}", "async init () {}", "async init () {\r\n debug.log('called init');\r\n return;\r\n }", "started() {\r\n\r\n\t}", "started () {}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {}", "async started() {}", "async started() {}", "async started() {}", "async started() {}", "async setup() { }", "async init () {\r\n return;\r\n }", "started() {\n\n\t}", "started() {\n\n\t}", "started() {\n\n\t}", "started() {\n\n\t}", "started() {\n\n\t}", "started() {\n\n\t}", "started() {\n\n\t}", "started() {\n\n\t}", "function init() {\n lastTime = Date.now();\n main();\n }", "function init() {\n lastTime = Date.now();\n main();\n }", "async startup() { }", "async startup() { }", "function start() { \n initiate_graph_builder();\n initiate_job_info(); \n initiate_aggregate_info();\n initiate_node_info();\n}", "init() {\n moduleUtils.patchModule(\n 'cos-nodejs-sdk-v5/sdk/task.js',\n 'init',\n tencentCOSWrapper\n );\n }", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "async init() {}", "async init() {}", "started() { }", "started() {\n\t}", "function run() {\n\n }", "async function main() {\n\n if (dotenv.error) {\n console.log( \"New install: no configuration found, or script not being run in the root directory\" );\n process.exit();\n }\n\n mysql.config({\n host: config.MYSQL_HOST,\n database: process.env.MYSQL_DATABASE||config.MYSQL_DATABASE,\n user: config.MYSQL_USER,\n password: config.MYSQL_PASSWORD\n });\n\n\t// Now get data from soaringspot\n soaringSpot();\n\n console.log( \"Background download from soaring spot enabled\" );\n setInterval( function() {\n soaringSpot();\n }, 5*60*1000 );\n}", "start() {}", "start() {}", "start() {}", "start() {}", "start() {}", "start() {}", "firstRun() { }", "start () {}", "async startup() {\n }", "async 'after sunbath' () {\n console.log( 'see? I appear here because of the first custom above' )\n }", "started() {\n\n }", "started() {\n\n }", "started() {\n\n }", "function init() {\n\n// reset();\n lastTime = Date.now();\n main();\n }", "function main() {\n doCbaam()\n doEcb()\n updateGraphFile()\n}", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "constructor() {\n super();\n\n this.run();\n }", "start(){\n let _this = this;\n // run the main sequence every process_frequency seconds\n _this.logger.info('starting work');\n _this.execute = true;\n _this.run();\n }", "run () {\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "Run() {\n\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function run() {}", "function run() {\n }", "start() {\n\t\tthis.startTime = Date.now();\n\t}", "async function sicronizar() {\n await tccpoo.sync();\n}", "function init() {\r\n reset();\r\n lastTime = Date.now();\r\n main();\r\n }", "async init() {\n\n }", "build () {}", "function alwaysRunOnload () {\n\t\t// Placeholder/Future use.\n\t}", "async startup(){}", "start() {// [3]\n }", "start() {\n this.currentTaskType = \"teil-mathe\";\n this.v.setup();\n this.loadTask();\n }", "async created() {\n\n\t}", "async created() {\n\n\t}", "init() {\r\n this.readyCount = 0;\r\n }", "function Start () {\n\t\tif (PlayerUtil.isMine(GetComponent(PlayerStatus).instanceID))\n\t\t{ \n//\t\tinvmaker = FindObjectOfType(Inventorymaker);\n//\t\tAllResources.staticLT = FindObjectOfType(LootTable);\n\t\tinvControl = AllManage.InvclStatic;\n\t\tMainTW = AllManage.mtwStatic; \n//\t\ttaskList = FindObjectOfType(TaskInfoList);\n\t\tMainTW.MainPS = this;\n\t\tmmmm = MainTW; \n\t\tps = GetComponent(PlayerStatus); \n\t\tMainTW.ps = ps;\n\t\t\n\t\tyield PrivateStatusInit();\n\t\tMainTW.TaskCreateRobot();\n//\t\t ts = AllManage.tsStatic;\n\t\t}\n\t}", "function TaskLoop() {\n\t\n}", "start() {// Your initialization goes here.\n }", "started () {\n\n }", "started () {\n\n }", "started () {\n\n }", "static ready() { }", "function init(){\n start = new Date().getTime();\n _initLog();\n }", "spawn() {\n Object.keys(this.tasks).forEach((key) => {\n this.start(key);\n });\n }", "start() {\n }", "function init() {\n getShareJobs();\n }", "async init(){}" ]
[ "0.65444463", "0.6144348", "0.6133242", "0.61234504", "0.61189455", "0.6074083", "0.6074083", "0.6074083", "0.6074083", "0.6074083", "0.6074083", "0.6074083", "0.6071895", "0.6071895", "0.6071895", "0.6071895", "0.6071895", "0.60217094", "0.6016317", "0.60117453", "0.60117453", "0.60117453", "0.60117453", "0.60117453", "0.60117453", "0.60117453", "0.60117453", "0.60081047", "0.60081047", "0.6006235", "0.6006235", "0.59817874", "0.59365153", "0.59289825", "0.59289825", "0.59289825", "0.59289825", "0.59289825", "0.59289825", "0.59289825", "0.59289825", "0.59289825", "0.59289825", "0.59015566", "0.59015566", "0.5892215", "0.5876227", "0.587412", "0.58459073", "0.5840434", "0.5840434", "0.5840434", "0.5840434", "0.5840434", "0.5840434", "0.5839343", "0.5830339", "0.58300143", "0.5787539", "0.5750904", "0.5750904", "0.5750904", "0.5742001", "0.573519", "0.57247126", "0.5713173", "0.56896955", "0.56885505", "0.568627", "0.568627", "0.568627", "0.568627", "0.56807625", "0.56778353", "0.56778353", "0.5661991", "0.565906", "0.5658429", "0.56453097", "0.5642818", "0.56423986", "0.56386083", "0.56258476", "0.5624079", "0.56143665", "0.5613932", "0.55970764", "0.55970764", "0.5596643", "0.55822986", "0.5574197", "0.5571963", "0.5550363", "0.5550363", "0.5550363", "0.5545771", "0.55412495", "0.5530961", "0.5528729", "0.5525805", "0.55241054" ]
0.0
-1
run at the start of each trial
function Start() { color = new GColor(0,0,1); trigger = CreateTrigger(1000); //entity = new Entity(image, 100, 100); phase = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setup_nextTrial(){\n // increment tp.itrial and setup the next trial\n tp.itrial += 1;\n console.log('itrial ' + tp.itrial.toString());\n setup_trial(tp.itrial, EP, QUEUES, STYLE.choiceSet);\n }", "firstRun() { }", "function runStart()/* : void*/\n {\n this.setUp();\n }", "function onTrialStart() {\n trialStartTime = Date.now(); \n enableTrial = true;\n}", "started () {}", "function init() {\n lastTime = Date.now();\n main();\n }", "function init() {\n lastTime = Date.now();\n main();\n }", "started() {\r\n\r\n\t}", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\r\n reset();\r\n lastTime = Date.now();\r\n main();\r\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n\n// reset();\n lastTime = Date.now();\n main();\n }", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "function init() {\n console.log('init!');\n setup();\n startTimer();\n }", "started() {\n\n\t}", "started() {\n\n\t}", "started() {\n\n\t}", "started() {\n\n\t}", "started() {\n\n\t}", "started() {\n\n\t}", "started() {\n\n\t}", "started() {\n\n\t}", "function begin()\n\t\t{\n\t\t\tcurrentRandomTimer = null;\n\t\t\tgenerateRandomSwim();\n\t\t} // end begin()", "started() {\n\t}", "started() { }", "function run_test() {\n do_calendar_startup(run_next_test);\n}", "function trial()\n{}", "function startInit() {\n if (DEBUG) {\n console.log (\"(3) trial:\" + current_trial + \" repeats:\" + repeats + \" function: \" + \"startInit\");\n }\n\n reqwest ({\n url: \"/node/\" + my_node_id + \"/received_infos\",\n method: 'get',\n type: 'json',\n success: function (resp) {\n if (DEBUG) {\n console.log (\"---> (3) trial:\" + current_trial + \" repeats:\" + repeats + \" reqwest: \" + \"received_infos\");\n }\n\n TRUE_RATIO=Number(resp.infos[0].contents)\n if (IS_FEEDBACK) { // if practice randomize from scratch each time\n TRUE_RATIO=RANGE_MIN + Math.floor(Math.random()*(RANGE_MAX-RANGE_MIN + 1));\n }\n\n init();\n },\n error: function (err) {\n console.log(err);\n clearTimeout(err_time);\n err_time=setTimeout(function(){create_agent();},WAIT_TIME*2);\n }\n });\n}", "function init() {\n enablePlayAgain(reset);\n reset();\n lastTime = Date.now();\n main();\n }", "beginTest() {\n\n super.beginTest();\n\n clearTimeout(this.timer);\n\n // Generate symbol order\n this.symbolOrder = [];\n for (var i = 0; i < Constants.GNG_SYMBOLS_PER_TEST; i++) {\n\n const r = Math.floor(Math.random() * this.symbols.length);\n const rSymbol = this.symbols[r];\n this.symbolOrder.push(rSymbol);\n\n }\n\n Session.set('maxAttempts', Constants.GNG_SYMBOLS_PER_TEST);\n\n this.currentSymbolIndex = 0;\n this.correctAnswerTimes = [];\n\n this.resetMemorySymbol();\n\n }", "start(){\n let _this = this;\n // run the main sequence every process_frequency seconds\n _this.logger.info('starting work');\n _this.execute = true;\n _this.run();\n }", "beforeRun() {}", "function BeforeStart(){return}", "function BeforeStart(){return}", "function BeforeStart(){return}", "function BeforeStart(){return}", "function BeforeStart(){return}", "function BeforeStart(){return}", "function BeforeStart(){return}", "function BeforeStart(){return}", "function runSequence() {\n\n pagePositions = [];\n setTargeting();\n setPagePositions();\n defineSlotsForPagePositions();\n\n }", "run_test() { start_tests(); }", "started() {\n\n }", "started() {\n\n }", "started() {\n\n }", "before (callback) {\n\t\tthis.testBegins = Date.now();\n\t\tthis.init(callback);\n\t}", "constructor() {\n this.count = 0; //a counter to keep track of how many trials were dispalyed\n this.trialData = []; //initializes a vector to collect data\n this.allTrainings = setupTrainings(); //calls the function defined in items_t.js, which creates the training trials\n this.switch=true; //simple and inelegant way to display a 'congratulations!' message after the training \n this.allTrials = setupTrials(); //calls the function defined in items.js, which creates the trials\n }", "started() {\n\t\tthis.clearStats();\n\n\t}", "function preRun(){\n console.log(\"preRun: Begin\")\n\n console.log(\"preRun: End\")\n\n}", "_setupLoop () {\n this._time = 0\n this._loop()\n }", "function start() {\n init();\n run();\n }", "function setInitials() {\n counter = 0;\n time = 0;\n}", "function stressInit() {\n writer.log('Stress batch recording\\n');\n stressTest = true;\n stressBatch = [];\n}", "async started() {}", "async started() {}", "async started() {}", "async started() {}", "async started() {}", "function start(){\n\tpickRandomFile();\n}", "start () {}", "function driver_run()\n{\n ClassRepo.initialize(\"demo_data.json\");\n ScheduleBuilder.initialize(\"ScheduleBuilder\");\n Form.initialize(\"IGETCForm\");\n IGETCTable.initialize(\"IGETCTable\", builder);\n Analytics.initialize();\n}", "function run (){\n \t\tconsole.log(\"in screen-splash run in screen-splash.js\");\n \t\tif(firstTime){\n \t\t\tinit();\n \t\t}\n \t\t//do our stuff\n \t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "start() {}", "start() {}", "start() {}", "start() {}", "start() {}", "start() {}", "function run_all_scripts_data()\n\n{\n \n \n runDemo_test();\n runDemo_tiscali();\n runDemo_gnocca();\n \n// runDemo_test_events();\n// runDemo_test_events_2();\n// runDemo_tiscali_events ();\n}", "start() {\n\t\tthis.startTime = Date.now();\n\t}", "started () {\n\n }", "started () {\n\n }", "started () {\n\n }", "function start() {\r\n\r\n addColumns(numCyl);\r\n\r\n //playScenario();\r\n\r\n interval = setInterval(playScenario, 100);\r\n\r\n}", "function restart() {\n a=0; //reset dei contatori\n end=0;\n get_karma();\n }", "function start() {\n console.log('Starting!');\n test1();\n}", "function start(){\n\t starter = setInterval(randomnData, 100);\n\t\n\t\n}", "async function t_startup() {\r\n await sleep(2);\r\n await t_write(t_header);\r\n await sleep(1);\r\n fileData = loadFile(t_startupPath); //Get content of the startup file\r\n var lines = fileData.split('\\n'); //Split it in its lines\r\n for (var line=0; line<lines.length; line++) { //Print every line by line with a delay between them\r\n t_println(lines[line]);\r\n await sleep(0.2);\r\n }\r\n await sleep(1);\r\n}", "start() {// [3]\n }", "function init() {\n spielstart();\n}" ]
[ "0.7154802", "0.71215504", "0.70717025", "0.695528", "0.68229765", "0.6813133", "0.6813133", "0.6811848", "0.6806317", "0.6806317", "0.6796719", "0.67870927", "0.67870927", "0.67870927", "0.67870927", "0.67632943", "0.6738489", "0.672375", "0.672375", "0.672375", "0.672375", "0.672375", "0.672375", "0.672375", "0.672375", "0.672375", "0.672375", "0.66737056", "0.6667663", "0.6667663", "0.6667663", "0.6667663", "0.6667663", "0.6667663", "0.6667663", "0.6667663", "0.6666819", "0.66443825", "0.6606167", "0.6542308", "0.65221566", "0.6505028", "0.6458169", "0.6457934", "0.6441253", "0.64352435", "0.6431772", "0.6431772", "0.6431772", "0.6431772", "0.6431772", "0.6431772", "0.6431772", "0.6431772", "0.64293754", "0.64073956", "0.64070827", "0.64070827", "0.64070827", "0.63885033", "0.6370386", "0.63672644", "0.63668746", "0.6341071", "0.6316344", "0.63088524", "0.6296033", "0.627366", "0.627366", "0.627366", "0.627366", "0.627366", "0.6263975", "0.6259713", "0.6257626", "0.62545305", "0.62488496", "0.62488496", "0.62488496", "0.62488496", "0.62488496", "0.62488496", "0.62488496", "0.6233472", "0.6233472", "0.6233472", "0.6233472", "0.6233472", "0.6233472", "0.6230114", "0.6218839", "0.62182915", "0.62182915", "0.62182915", "0.62172204", "0.6213164", "0.61816525", "0.6167629", "0.61645323", "0.616018", "0.61328757" ]
0.0
-1
Returns whether or not the passed in relationship is the "owner" of the relationship. This defaults to true for belongsTo and false for hasMany
isRelationshipOwner(relationship) { var owner = relationship.owner; // TODO: use lack of an inverse to determine this value as well return relationship.kind === 'belongsTo' && owner !== false || relationship.kind === 'hasMany' && owner === true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_isOwner() {\n return this.record && (this.record.userId == this.user.id);\n }", "_isOwner() {\n return this.record && (this.record.userId == this.user.id);\n }", "isOwner() {\n\t\treturn this.owner === Meteor.userId();\n \t}", "inversesAlreadyAssociated(inverse, owner) {\n let inverseKey = this.inverse().key;\n let inverseAssociation = inverse[inverseKey];\n\n if (inverseAssociation && owner) {\n if (inverseAssociation instanceof Model) {\n if (inverseAssociation.isSaved() && owner.isSaved()) {\n return inverseAssociation.toString() === owner.toString();\n } else {\n return inverseAssociation === owner;\n }\n } else {\n return inverseAssociation.includes(owner);\n }\n }\n }", "function isRelated(thing, relative) {\n return isChild(thing, relative) || isParent(thing, relative);\n }", "function checkOwner (event) {\n if (event.owner_id === props.currentUser.id) {\n return true\n }\n }", "hasParent() {\n return this._ancestors.size() !== 0;\n }", "function loggedInUserIsParent() {\n if(!loggedInUser.data || !profile.data) return false;\n return _.includes(profile.data.parents, loggedInUser.data.id);\n }", "function isAncestor(relationship){\n return relationship.depth == relationship.distance;\n}", "function hasRelated (related) {\n var category = that.recordTypes[related] || [];\n return $.inArray(that.options.related, category) > -1;\n }", "static isUserOwner(story) {\n if (!story) return false\n\n // doing string compare because of auth payload \n return story.postedBy._id === Auth.getPayload().sub\n }", "function isOwner(user, note) {\r\n if(JSON.stringify(user._id) == JSON.stringify(note.author._id))\r\n return true\r\n else \r\n return false\r\n}", "findOwners() {\n return this._getRelationship('owner', 'from');\n }", "isVisible() {\n const isOwner = this._radio.reqres.request('user:isOwner');\n\n if (isOwner) {\n return true;\n }\n\n return this.get('visible');\n }", "get isConstrained() {\n return (this.hostedBy && this.hostedBy.isVisible) ||\n (this.internalIn && this.internalIn.isVisible);\n }", "function pols_is_for_sale(){\r\n\r\n\tif (!this.isOwnable) return 0;\r\n\tif (this.owner) return 0;\r\n\r\n\treturn 1;\r\n}", "_isAttached() {\n return (this.__parent ? this.__parent.__attached : (this.stage.root === this))\n }", "function checkOwner(request) {\n var resource = this;\n return new RSVP.Promise(function(resolve, reject) {\n checkUser(resource.links.owner, request).then(function() {\n resolve(resource);\n }, reject);\n });\n}", "get relationship() {\n\t\treturn this.__relationship;\n\t}", "isBelongsTo(field) {\n return (\n !this.isHasMany(field) &&\n /Key(s)?[0-9]*$/.test(field) &&\n this.fields[field].key\n );\n }", "getOwner() {\n return this.owner;\n }", "getOwner() {\n return this.owner;\n }", "get belongsTo() {\n\t\treturn this._belongsTo;\n\t}", "function isPostOwner(post, currentUser) {\n if (currentUser === null) {\n return false;\n }\n let userIdFromPost = post.userId,\n currentUserId = currentUser.uid;\n if (userIdFromPost === currentUserId) {\n return true;\n }\n return false;\n}", "isVisible() {\n if( this.props.user._id == this.props.creator._id) {\n return (this.props.attendees.length === 0 ||\n (this.props.attendees.length === 1 &&\n this.props.attendees[0]._id === this.props.creator._id) )\n }\n\n return false\n }", "function canEditOwner() {\n // If this is an archived playbook, don't allow anyone to edit it.\n if (vm.current.details.isArchived === true) {\n return;\n }\n\n if (vm.current.details.isOwnedByMe === true) {\n vm.current.details.canEditOwner = true;\n getUserList();\n }\n else {\n authService.hasPermission(\"PLAYBOOK_OWNER\", \"Edit\")\n .then(function (data) {\n vm.current.details.canEditOwner = data || false;\n\n if (vm.current.details.canEditOwner === true) {\n getUserList();\n }\n });\n }\n }", "hasOrganization() {\n return this.get('idOrganization');\n }", "get isConstrained() {\n return ((this.fixed && this.layout) ||\n (this.controlNodes && this.controlNodes.length > 0) ||\n (this.hostedByLink && this.hostedByLink.isVisible) ||\n (this.internalIn && this.internalIn.isVisible))\n ? true\n : false;\n }", "isUserOwner() {\n this.authService.getCurrentUser().subscribe((user) => Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function* () {\n this.user = user;\n yield this.projectPromise;\n this.isOwner = this.user.uid === this.project.uid;\n }));\n }", "function party_is_in(){\n\n\treturn this.party ? true: false;\n}", "_parentMarkedDirty(onlySelf) {\n const parentDirty = this._parent && this._parent.dirty;\n return !onlySelf && !!parentDirty && !this._parent._anyControlsDirty();\n }", "_parentMarkedDirty(onlySelf) {\n const parentDirty = this._parent && this._parent.dirty;\n return !onlySelf && !!parentDirty && !this._parent._anyControlsDirty();\n }", "_parentMarkedDirty(onlySelf) {\n const parentDirty = this._parent && this._parent.dirty;\n return !onlySelf && !!parentDirty && !this._parent._anyControlsDirty();\n }", "_parentMarkedDirty(onlySelf) {\n const parentDirty = this._parent && this._parent.dirty;\n return !onlySelf && !!parentDirty && !this._parent._anyControlsDirty();\n }", "_parentMarkedDirty(onlySelf) {\n const parentDirty = this._parent && this._parent.dirty;\n return !onlySelf && !!parentDirty && !this._parent._anyControlsDirty();\n }", "_parentMarkedDirty(onlySelf) {\n const parentDirty = this._parent && this._parent.dirty;\n return !onlySelf && !!parentDirty && !this._parent._anyControlsDirty();\n }", "fairOwnerId() {\n return this.related().owner.get('default_fair_id') || this.related().owner.get('id');\n }", "_parentMarkedDirty(onlySelf) {\n const parentDirty = this._parent && this._parent.dirty;\n return !onlySelf && parentDirty && !this._parent._anyControlsDirty();\n }", "_parentMarkedDirty(onlySelf) {\n const parentDirty = this._parent && this._parent.dirty;\n return !onlySelf && parentDirty && !this._parent._anyControlsDirty();\n }", "get owner() { return this.ownerIn; }", "function isOwner(userId, ownerId){\n if(typeof userId === 'string'){\n if(userId.length !== 24){return null;}\n }else if(userId instanceof Mongo.ObjectID){\n if(userId.length !== 24){return null;}\n userId = userId.toString();\n }\n\n if(ownerId !== userId){\n return false;\n }else{\n return true;\n }\n}", "function modelHasAttributeOrRelationshipNamedType(modelClass) {\n return Ember.get(modelClass, 'attributes').has('type') || Ember.get(modelClass, 'relationshipsByName').has('type');\n}", "isMe() {\n if(this.$store.state.user.user.id === this.loadedUser.id)\n {\n return true;\n }\n else {\n return false;\n }\n }", "function getIsParentExplicit() {\n\n var isExplicit = false;\n\n if (scope.parentControl) {\n\n var container = spFormBuilderService.isExplicitContainer(scope.parentControl);\n if (container && container !== false) {\n\n isExplicit = true;\n }\n }\n\n return isExplicit;\n }", "function have_any_children(relationship_type, relative) {\n\tif (relationship_type == 'father' || relationship_type == 'mother' || \n\t\t\trelationship_type == 'maternal_grandfather' || relationship_type == 'maternal_grandmother' || \n\t\t\trelationship_type == 'paternal_grandfather' || relationship_type == 'paternal_grandmother') return false;\n\t\t\t\n\tvar parent_status = false;\n\t$.each(personal_information, function (key, item) {\n\t\tif (item != null && item.parent_id != null && item.parent_id.hashCode() == relative.id.hashCode()) {\n\t\t\tparent_status = true;\n\t\t}\n\t});\n\treturn parent_status;\n}", "function _isForeignKey(property) {\n return property.type === Schema.ObjectId\n || property.name === 'ObjectId'\n || ( property[0] && property[0].name === 'ObjectId'); // is array of foreign keys\n}", "isPurchaseStatusAlreadyOwned() {\n const purchaseStatus = this.getPurchaseStatus();\n return purchaseStatus === PURCHASE_STATUS.ALREADY_OWNED;\n }", "getOwner() {\n return this.currentOwner;\n }", "isDirtyFromRelationships(model, cached, relDiff) {\n return relDiff.length > 0;\n }", "function canManageInvitation(context, invitation) {\n if (context.isStaff) {\n return true;\n }\n if (!context.isOwner) {\n return false;\n }\n if (invitation.project_role) {\n return true;\n }\n if (invitation.customer_role) {\n return ENV.OWNERS_CAN_MANAGE_OWNERS;\n }\n }", "function isCousin(relationshipData, includeSpouses){\n var path = relationshipData.path,\n isAncestor = false,\n isDescendant = false,\n isCousin = false;\n \n // Skip the first person because it's the start person \n for(var i = 1; i < path.length; i++){\n var relationship = path[i].rel;\n \n if(relationship === 'child'){\n \n // If the previous position in the path was an\n // ancestor (direct mother and father relationships)\n // then we know this person is a cousin.\n if(isAncestor){\n isAncestor = false;\n isCousin = true;\n }\n \n // If the person isn't a cousin then we must be\n // travelling down a direct descendant line\n if(!isCousin){\n isDescendant = true;\n }\n }\n \n else if(relationship === 'mother' || relationship === 'father'){ \n \n // Ignore ancestors of descendants and cousins. We \n // care about the ancestors of descendants that are \n // also our descendants but the path to them is more \n // direct therefore the only people we see here are \n // those ancestors of the descendant that are out of scope\n if(isDescendant || isCousin){\n return false;\n }\n \n // We are still traveling up the direct ancestral line\n isAncestor = true;\n }\n \n // If we see any other relationship (right now just\n // a spouse) then end. Direct ancestors, descendants,\n // and cousins can be visited through spouse relationships\n // but the most direct paths will never include them\n // therefore we can assume that anyone visited through\n // a spouse relationship is outside of our scope.\n // If we want to include spouses and we're at the end\n // then this person is valid; otherwise the person is invalid.\n else if(includeSpouses && i === path.length - 1){\n return true;\n } else {\n return false;\n }\n }\n \n // The person is valid if we get here because we\n // short circuit as soon as we know someone is invalid\n return true;\n}", "get relatesTo() {\n\t\treturn this.__relatesTo;\n\t}", "function findOwner( obj ) {\n\t\treturn obj.owner || findOwner( obj.parent );\n\t}", "function hasPolicyOfKey(owner, key) {\n\tif (!owner[OWNER_POLICY] || !(key in owner[OWNER_POLICY])) return false;\n\treturn true;\n}", "isReference() {\n return undefined != this.referenceId;\n }", "function modelHasAttributeOrRelationshipNamedType(modelClass) {\n return get$8(modelClass, 'attributes').has('type') || get$8(modelClass, 'relationshipsByName').has('type');\n}", "get owner() {\n return this._owner || this.subGrid;\n }", "get isConstrained() {\n return !!((this.fixed && this.layout) ||\n (this.controlNodes && this.controlNodes.length > 0) ||\n (this.hostedBy && this.hostedBy.isVisible) ||\n (this.internalIn && this.internalIn.isVisible));\n }", "has_parent_node(){\n return this.parent_node != null;\n }", "function isDescendant(relationship){\n return -relationship.depth == relationship.distance\n}", "function ownedByLuke(pet) {\n return pet.ownerName == \"Luke\";\n}", "function ownsRoom(user) {\n lunchrooms.forEach(function(room) {\n if (room['creator'] === user) {\n return true;\n }\n });\n return false;\n}", "get owner() {\n return this.getStringAttribute('owner');\n }", "get parent() {\n return this.owner.owner;\n }", "isDependentConnection() {\n return !(this.drawToCenter === EConnectionCentered.NONE);\n }", "function isParent(thing, relative) {\n var i;\n var temp;\n if (thing === relative) {\n return true;\n }\n if (!thing.children) {\n return false;\n }\n for (i = 0; i < thing.children.length; i++) {\n if (isParent(thing.children[i], relative)) {\n return true;\n }\n }\n return false;\n }", "exists() {\n const model = internal(this).model;\n return internal(model).entities.contains(this);\n }", "relateUser() {\n return this.belongsTo(User);\n }", "function validateOwnerData(owner) {\n return owner && nexus_extend_1.getNestedVal(owner, \"userId\") &&\n nexus_extend_1.getNestedVal(owner, \"userEmail\") &&\n nexus_extend_1.getNestedVal(owner, \"displayName\");\n}", "function isOwner(req, res, next) {\n Pet.findById(req.params.id, function (err, foundPet) {\n if (foundPet.user[0] == req.user.id) {\n return next();\n } else {\n req.flash(\"failure\", \"Only owners are allowed to modify the ads\");\n res.redirect(\"/adopt/1\");\n }\n });\n}", "get owner() {\n return this.parent;\n }", "function getOwner(){\n return owner;\n }", "isEditable() {\n if (!this.user) {\n return false;\n }\n // If the comment has been deleted, it should only be editable\n // by site admins or the user who deleted it.\n if (this.activity.deleted_by) {\n return this.user.is_admin || this.activity.deleted_by === this.user.email;\n }\n // If the comment is not deleted, site admins or the author can edit.\n return this.user.email === this.activity.author || this.user.is_admin;\n }", "function useParentContextOrNot() {\n return ((nt.useParentContext == 'auto') && (parent != this))\n || (nt.useParentContext == 'yes');\n}", "isIncognito() {\n return !!this._id;\n }", "isIncognito() {\n return !!this._id;\n }", "isIncognito() {\n return !!this._id;\n }", "amIGameOwner(socket) {\n return this.players[0].socket === socket;\n }", "function isCreatedByAClone(wi) {\n var parent = wi.parent;\n return parent && parent.getProp('type') === 'clone';\n }", "function isDiscussionAuthor(author) {\n return divvy.currentUser == author;\n }", "function ensureRelation(name, relation) {\n if (!relation) {\n throw new utils_1.Exception(`Cannot process unregistered relationship ${name}`, 500);\n }\n return true;\n}", "function isObjectBelongsToParent(obj){\r\n\t\t\r\n\t\tvar objParent = obj.parents(\".uc-assets-wrapper\");\r\n\t\tvar parentID = objParent.attr(\"id\");\r\n\t\tvar wrapperID = t.getID();\r\n\t\t\r\n\t\tif(parentID == wrapperID)\r\n\t\t\treturn(true);\r\n\t\t\r\n\t\treturn(false);\r\n\t}", "isAccessible(){\n return this.edgesToMe.length === 0;\n }", "static isRelatedFieldMany(variable, fieldName) {\n const columns = variable.propertiesMap.columns, columnsCount = columns.length;\n let index, column;\n /*Loop through the columns of the liveVariable*/\n for (index = 0; index < columnsCount; index += 1) {\n column = columns[index];\n /*If the specified field is found in the columns of the variable,\n * then it has a many-to-one relation.*/\n if (column.fieldName === fieldName) {\n return false;\n }\n }\n return true;\n }", "function fragmentOwner() {\n // TODO: add a warning when this is used on a non-fragment\n return Ember.computed.alias('_owner').readOnly();\n }", "new() {\n return this.user != null;\n }", "edit() {\n return this.new() &&\n this.record && (this._isOwner() || this._isAdmin());\n }", "edit() {\n return this.new() &&\n this.record && (this._isOwner() || this._isAdmin());\n }", "function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\r\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\r\n if (IsUndefined(metadataMap))\r\n return false;\r\n return ToBoolean(metadataMap.has(MetadataKey));\r\n }", "function joinValid() {\n if ( angular.isDefined(vm.joinType) && vm.joinType !== null && \n (vm.joinType === JOIN.INNER || vm.joinType === JOIN.LEFT_OUTER || \n vm.joinType === JOIN.RIGHT_OUTER || vm.joinType === JOIN.FULL_OUTER) ) {\n return true;\n }\n return false;\n }", "isSignedIn() {\n return !!this._authData.accountId;\n }", "exists() {\n const source = internal(this).source;\n const model = internal(source).model;\n return internal(model).connections.contains(this);\n }", "function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n return ToBoolean(metadataMap.has(MetadataKey));\n }", "function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n return ToBoolean(metadataMap.has(MetadataKey));\n }", "function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n return ToBoolean(metadataMap.has(MetadataKey));\n }", "function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n return ToBoolean(metadataMap.has(MetadataKey));\n }", "function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n return ToBoolean(metadataMap.has(MetadataKey));\n }", "function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n return ToBoolean(metadataMap.has(MetadataKey));\n }", "function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n return ToBoolean(metadataMap.has(MetadataKey));\n }", "_validateRead () {\n if (this.parent.isNew()) {\n throw CE.ModelRelationException.unSavedTarget('fetch', this.parent.constructor.name, this.related.name)\n }\n\n if (!this.parent[this.fromKey]) {\n logger.warn(`Trying to fetch relationship with ${this.fromKey} as primaryKey, whose value is falsy`)\n }\n }" ]
[ "0.67703396", "0.67549163", "0.6647881", "0.6158982", "0.615429", "0.58760184", "0.5599584", "0.54984426", "0.543576", "0.54100883", "0.5388887", "0.5386056", "0.5383923", "0.5323997", "0.5282229", "0.5269805", "0.52515984", "0.52163994", "0.5214126", "0.51703036", "0.51688796", "0.5160886", "0.5152653", "0.5073781", "0.5051485", "0.502319", "0.501676", "0.50162673", "0.5015675", "0.50100654", "0.5008421", "0.5008421", "0.5008421", "0.5008421", "0.5008421", "0.50010824", "0.49973786", "0.49898428", "0.49898428", "0.4987068", "0.4957141", "0.49500498", "0.49407768", "0.49371436", "0.48976377", "0.48814693", "0.48739922", "0.4869984", "0.48674524", "0.48655203", "0.485925", "0.4849461", "0.48427257", "0.4820468", "0.48164225", "0.48138356", "0.48088408", "0.4806294", "0.4795095", "0.47874644", "0.47862732", "0.47777864", "0.47724614", "0.4763634", "0.47442937", "0.47372943", "0.47254002", "0.47253093", "0.47142762", "0.47110647", "0.4705477", "0.47032002", "0.46930876", "0.46854448", "0.46817926", "0.46817926", "0.46817926", "0.46808684", "0.46768978", "0.46689227", "0.46662644", "0.46656767", "0.46647537", "0.46620816", "0.46593645", "0.46530285", "0.46399754", "0.46307108", "0.46265593", "0.46263373", "0.46248993", "0.46154028", "0.46146575", "0.46146575", "0.46146575", "0.46146575", "0.46146575", "0.46146575", "0.46146575", "0.46127573" ]
0.84309566
0
api home route convert form data into url from
function getformBody(params){ let formBody = [] for(let property in params){ let encodedKey = encodeURIComponent(property); let encodedValue = encodeURIComponent(params[property]); formBody.push(encodedKey + '=' + encodedValue); } return formBody.join('&') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function routeForm()\n{\n\tvar port = process.argv[2];\n\tvar express = require('express');\n\tvar app = express();\n\tvar body= require(\"body-parser\");\n\tapp.use(body.urlencoded({extended:false}));\n\t\n\tapp.post('/form',function(req,res){\n\t\tres.send(req.body.str.split('').reverse().join(''));\n\t});\n\tapp.listen(port);\n}", "function route(...etc)\n{\n etc.unshift(stockAPI);\n let sOut = etc.reduce((acc, curr)=>acc+=curr+'/');\n return sOut;\n}", "function homeRoute(request, response){\n //if url == \"/\" && GET\n console.log(\"weee3eeeeeeeeeesdfgaaauifyueeeeeerrreeeeeeeeee still reading stuff\");\n //if url == \"/\" && POST\n //redirect to /:username\n}", "function formRoute ({\n action,\n requireAuthentication,\n loadGETData,\n form,\n fields,\n fieldSizeLimit = 512000,\n processBody,\n onPost,\n onSuccess\n}) {\n if (typeof form !== 'function') {\n throw new TypeError('missing form function')\n }\n\n if (typeof processBody !== 'function') {\n throw new TypeError('missing processBody function')\n }\n\n if (typeof onSuccess !== 'function') {\n throw new TypeError('missing onSuccess function')\n }\n\n const fieldNames = Object.keys(fields)\n fieldNames.forEach(fieldName => {\n const description = fields[fieldName]\n if (typeof description.validate !== 'function') {\n throw new TypeError('missing validate function for ' + fieldName)\n }\n if (!description.displayName) {\n description.displayName = fieldName\n }\n })\n\n return (request, response) => {\n const method = request.method\n const isGet = method === 'GET'\n const isPost = !isGet && method === 'POST'\n if (!isGet && !isPost) return serve405(request, response)\n proceed()\n\n function proceed () {\n if (requireAuthentication && !request.account) {\n return serve303(request, response, '/login')\n }\n if (isGet) return get(request, response)\n post(request, response)\n }\n }\n\n function get (request, response, body, error) {\n response.setHeader('Content-Type', 'text/html')\n const data = {}\n if (body) {\n fieldNames.forEach(fieldName => {\n data[fieldName] = {\n value: body[fieldName],\n error: error && error.fieldName === fieldName\n ? `<p class=error>${escapeHTML(error.message)}</p>`\n : ''\n }\n })\n } else {\n fieldNames.forEach(fieldName => {\n data[fieldName] = { value: '', error: false }\n })\n }\n if (error && !error.fieldName) {\n data.error = `<p class=error>${escapeHTML(error.message)}</p>`\n }\n data.csrf = csrf.inputs({\n action,\n sessionID: request.session.id\n })\n if (loadGETData) {\n return loadGETData(request, data, error => {\n if (error) return serve500(request, response, error)\n response.end(form(request, data))\n })\n }\n response.end(form(request, data))\n }\n\n function post (request, response) {\n if (onPost) onPost(request, response)\n\n const body = {}\n let fromProcess\n runSeries([\n parse,\n validate,\n process\n ], error => {\n if (error) {\n const statusCode = error.statusCode\n if (statusCode >= 400 && statusCode < 500) {\n response.statusCode = statusCode\n return get(request, response, body, error)\n }\n return serve500(request, response, error)\n }\n onSuccess(request, response, body, fromProcess)\n })\n\n function parse (done) {\n request.pipe(\n new Busboy({\n headers: request.headers,\n limits: {\n fieldNameSize: Math.max(\n fieldNames\n .concat('csrftoken', 'csrfnonce')\n .map(n => n.length)\n ),\n fields: fieldNames.length + 2,\n fieldSizeLimit,\n parts: 1\n }\n })\n .on('field', function (name, value, truncated, encoding, mime) {\n if (name === 'csrftoken' || name === 'csrfnonce') {\n body[name] = value\n return\n }\n const description = fields[name]\n if (!description) return\n body[name] = description.filter\n ? description.filter(value)\n : value\n })\n .once('finish', done)\n )\n }\n\n function validate (done) {\n for (let index = 0; index < fieldNames.length; index++) {\n const fieldName = fieldNames[index]\n const description = fields[fieldName]\n const valid = description.validate(body[fieldName], body)\n if (valid) continue\n const error = new Error('invalid ' + description.displayName)\n error.statusCode = 401\n return done(error)\n }\n csrf.verify({\n action,\n sessionID: request.session.id,\n token: body.csrftoken,\n nonce: body.csrfnonce\n }, done)\n }\n\n function process (done) {\n processBody(request, body, (error, result) => {\n if (error) return done(error)\n fromProcess = result\n done()\n })\n }\n }\n}", "function home(request, response) {\r\n //if url == \"/\" && GET\r\n if(request.url === \"/\") {\r\n if(request.method.toLowerCase() === \"get\") {\r\n //show search\r\n response.writeHead(200, commonHeaders); \r\n view(\"index\", {}, response);\r\n \r\n response.end();\r\n } else {\r\n //if url == \"/\" && POST\r\n \r\n //get the post data from body\r\n request.on(\"data\", function(postBody) {\r\n //extract the username\r\n var query = querystring.parse(postBody.toString());\r\n //redirect to /:username\r\n response.writeHead(303,{\"Location\": \"/\"+ query.username});\r\n response.end();\r\n \r\n });\r\n \r\n }\r\n }\r\n \r\n }", "function cambiarUrl(thisObj){\n\tvar campo = thisObj.attr('name');\n\tvar valor = thisObj.val();\n\tvar nombrePath = window.location.pathname;\n\tvar parametrosInput = thisObj.parents('form').find('#parametrosUrl').val();\n\n\t\n\twindow.history.replaceState(\"object\", nombrePath, nombrePath +'?'+ parametrosInput);\n\n\tthisObj.parents('form').find('#parametrosUrl').val(parametrosInput);\n\n\tvar parametrosUrl = {};\n\tvar campoCambiado = false;\n\n\tif (location.search) {\n\t var parts = location.search.substring(1).split('&');\n\t parametrosInput = '';\n\t for (var i = 0; i < parts.length; i++) {\n\t var nv = parts[i].split('=');\n\t if (!nv[0]) continue;\n\t if(nv[0] == campo){\n\t \tnv[1] = valor;\n\t \tcampoCambiado = true;\n\t }\n\t parametrosInput = parametrosInput + ((parametrosInput)? '&' : '') + nv[0] +'='+ nv[1];\n\t //guarda los parametros en un array\n\t parametrosUrl[nv[0]] = nv[1] || true;\n\t if (campoCambiado) {\n\t \tif ( thisObj.hasClass('select_dynamic') ) { break; }\n\t }\n\t \n\t }\n\t}\n\tif (!campoCambiado) {\n\t\tparametrosInput = parametrosInput + ((parametrosInput)? '&' : '') + campo +'='+ valor;\n\t}\n \n thisObj.parents('form').find('#parametrosUrl').val(parametrosInput);\n\n\twindow.history.replaceState(\"object\", nombrePath, nombrePath +'?'+ parametrosInput);\n\t\n}", "function submit_search_data(req, res) {\n // variables defined in\n // the Swagger document can be referenced using req.swagger.params.{parameter_name}\n\n let json = req.body;\n\n let type = json.type;\n\n if(type === \"FeatureCollection\") {\n simulatePath.calculatePathsForInput(json, res);\n }\n}", "route() {\n return `/api/staff/v1/${this._api_route}`;\n }", "function selectDataFormPost(req, res) {\n const season = (req.body.season) ? `${req.body.season}` : '';\n const audience = (req.body.audience) ? req.body.audience : '';\n const audienceQuery = audience ? `?audience=${audience}` : '';\n const type = utils.getDataType(req.body.type, true);\n\n if (!season && !audience) {\n logger.error(\n `Form data of season and audience is undefined. season: ${season}, audience: ${audience}, Redirecting to: ${config.baseUrl}/404`\n );\n\n res.redirect(`${config.baseUrl}/404`);\n } else {\n // Redirects to the appropriate list route to make server side request for\n // the season/audience list\n logger.info(`Making server side request for: ${config.baseUrl}/${type}/${season}${audienceQuery}`);\n res.redirect(`${config.baseUrl}/${type}/${season}${audienceQuery}`);\n }\n}", "static toURL(model, query, fields) {\n const queries = [];\n if (fields && fields.length > 0) {\n queries.push(...this.packViewedFields(fields));\n }\n if (query) {\n if (query.pre) {\n queries.push(...this.packMatchRules(this.PreMatchPrefix, model, query.pre));\n }\n if (query.post) {\n queries.push(...this.packMatchRules(this.PostMatchPrefix, model, query.post));\n }\n if (query.sort) {\n queries.push(...this.packSort(model, query.sort));\n }\n if (query.limit) {\n queries.push(...this.packLimit(query.limit));\n }\n }\n return queries.length ? `${this.QueryPrefix}/${queries.join('/')}` : ``;\n }", "function handleSubmit(e) {\n e.preventDefault();\n //get the value input in a readable format for the API call\n let inputReadyForUrl = formatInput(input.value);\n\n //launch the API request and return an object of movies\n postRequest(inputReadyForUrl);\n}", "exRouteParams(request, response) {\n const params = request.params;\n console.log(params);\n return response.json({\n titulo: \"Exemplo Route Params\",\n parametros: params\n });\n }", "function buildQueryURL() {\n // if(queryParams != '') {\n // queryURL is the url we'll use to query the API\n var queryParams = $(\"#countryInput\").val();\n\n // var queryURL = \"https://coronavirus-tracker-api.herokuapp.com/v2/locations?source=jhu&timelines=true&country=\";\n var queryURL = \"https://covid-19.dataflowkit.com/v1/\";\n\n\n\n // console.log(queryParams)\n return queryURL + queryParams;\n\n // }else{\n // $(\"#error\").html('Field cannot be empty');\n // }\n }", "function get(req, res, next) {\n res.send(formData);\n}", "function getFormRoute(form){\r\n var hash = getHashFromUrl(form.action);\r\n console.log(\"getFormRoute | hash: %s\", hash);\r\n var route = getRoute(hash);\r\n var params = {};\r\n for(var i=0;i<form.elements.length;i++){\r\n var e = form.elements[i];\r\n var key = e.name;\r\n var type = e.type.toLowerCase();\r\n if(!key || ((type==\"radio\" || type==\"checkbox\") && !e.checked)) continue;\r\n var value = e.value;\r\n updateParamItem(params,key,value,false);\r\n }\r\n console.log(\"params: %s\", JSON.stringify(params));\r\n $.extend(route.params,params);\r\n if(form.method.toLowerCase() == \"get\"){\r\n $.extend(route.getParams,params);\r\n }\r\n else{\r\n // create post params\r\n route.postParams = params;\r\n }\r\n console.log(\"updated route: %s\", JSON.stringify(route));\r\n return route;\r\n }", "landingPage() {\n this.app.get(\"/\", (req, res) => {\n // console.log(`request.body: `, req.body);\n // Basic route that sends the user first to the Landing Page\n res.sendFile(path.join(__dirname, \"landingPage.html\"));\n })\n }", "function createUrl(val){\n return `http://localhost:3000/api/${val}`;\n \n}", "toPath(url) {\n let query = {};\n /**\n * Extract query string from the current URL\n */\n if (this.forwardQueryString) {\n query = qs_1.default.parse(url_1.parse(this.request.url).query || '');\n }\n /**\n * Assign custom query string\n */\n Object.assign(query, this.queryString);\n /**\n * Redirect\n */\n this.sendResponse(url, query);\n }", "function api_url(data){\n\treturn base_url+data;\n}", "function generateEndpointURL () {\n var querystring = $.param({\n advisor_profile_id: this[options.advisorIdAttribute],\n start_at: this[options.startDateAttribute].toISOString(),\n ndays: options.nDays\n });\n return routes('back_office_availabilities', { format: 'json' }) + '?' + querystring;\n }", "function api(req, res, next) {\n // TODO parse the path and things\n console.log('Referrer! And things', req._parsedUrl.pathname);\n next();\n}", "apiRoute(route) {\n return this.state.apiBase + route\n }", "handleSubmit (event) {\n event.preventDefault()\n const searchPathAs = `/${this.state.searchType}/listing?search=`\n const searchPath = `/${this.state.searchType}-listing?search=`\n let searchTerm = this.state.value\n // Handle searching for 10+ years experience\n if (searchTerm.indexOf('experience.exact') !== -1 && searchTerm.indexOf('+ years') !== -1) {\n searchTerm = searchTerm.replace('+ years', 'plus years')\n }\n const regEx = searchTerm.indexOf('.exact:') !== -1 ? /([!*+\\-=<>&|()[\\]{}^~?\\\\/])+/g : /([!*+\\-=<>&|()[\\]{}^~?:\\\\/\"])+/g\n searchTerm = searchTerm.replace(regEx, ' ')\n Router.push(`${searchPath}${searchTerm}`, `${searchPathAs}${searchTerm}`)\n }", "url(action,i18n,payload,params,hash){\n if (this.data.url){\n return this.data.url.call(this, action, i18n,payload,params);\n } else {\n let route_path = i18n.t(this.key);\n return `/${i18n.language}/${route_path}`;\n }\n }", "static changeBrokerURL() {\n const input = document.getElementById('broker_address');\n const address = input.value;\n\n Controller.Api.post('/change_address', { address: address })\n .then(response => {\n console.log(response.data);\n })\n .catch(error => {\n console.log(error);\n });\n\n console.log('url: ', address);\n input.value = '';\n }", "function setURL(url){\n var apEdit =\"/edit\";\n // console.log(url);\n if (url !== \"/homepage/new\"){ //String vergleichen zum Ausgrauen des Buttons\n var editCodingPost = url.slice(0,url.length - apEdit.length) +\"?_method=PUT\";\n document.querySelector('#savePost').disabled =false;\n document.querySelector(\"#formContent\").action=editCodingPost;\n //console.log(editCodingPost);\n //console.log(url);\n //console.log(url.length-apEdit.lenth);\n }\n //console.log(url);\n//str.split([separator[, limit]])\n}", "function buildUrl(searchTerm){\n return {\n s: searchTerm,\n r: \"json\"\n }\n }", "function setupEndpoint() {\n if (host.val().indexOf('/') != -1) {\n var hostArr = host.val().split('/');\n\n path = \"http://\" + hostArr[0] + \":\" + port.val();\n hostArr.shift(); // remove host\n\n if (hostArr.length > 0) { // anything left?\n path += \"/\" + hostArr.join('/');\n }\n } else {\n path = \"http://\" + host.val() + \":\" + port.val();\n }\n endpoint = path;\n }", "function getParamsToUrl(data) {\n let params = new URLSearchParams()\n for (let key in data) {\n if (data.hasOwnProperty(key) && data[key]) params.set(key, data[key])\n }\n return params.toString()\n}", "function build_url(type, api, req) {\n var url = 'http://' + req.headers.host + '/' + type + '/' + api._id,\n qs = [],\n key,\n arr_i;\n\n for (key in req.query) {\n if (req.query.hasOwnProperty(key)) {\n if (req.query[key] instanceof Array) {\n for (arr_i = 0; arr_i < req.query[key].length; arr_i++) {\n if (req.query[key][arr_i].trim() !== '') {\n qs.push(key + '[]=' + req.query[key][arr_i]);\n }\n }\n } else {\n if (req.query[key].trim() !== '') {\n qs.push(key + '=' + req.query[key]);\n }\n }\n }\n }\n\n if (qs.length > 0) {\n url = url + '?' + qs.join('&');\n }\n\n return url;\n }", "function generateGetURL(path, data){\n\tvar i = 0;\n\tvar url = base_url + path;\n\tfor (i=0; i<data.length; i++){\n\t\tif (isNaN(data[i]) && data[i].indexOf(\"/\") > 0){\n\t\t\tstep1 = data[i].replace('/','-');\n\t\t\tstep2 = step1.replace('/','-');\n\t\t\tdata[i] = step2;\t\t\t\n\t\t}\n\t\telse if (data[i]==\"\"){\n\t\t\tdata[i] = '-';\n\t\t}\n\t\turl = url + encodeURIComponent(data[i]) + \"/\";\t\t\n\t}\n\turl = url.substring(0, url.length -1);\n\treturn decodeURIComponent(url);\n}", "toUrlAndQuery() {\r\n return `${super.toUrl()}?${Array.from(this.query).map((v) => v[0] + \"=\" + v[1]).join(\"&\")}`;\r\n }", "async function getData() {\n let daten = new FormData(document.forms[0]);\n query = new URLSearchParams(daten);\n // url = \"https://gissose2021.herokuapp.com\"; //herokuapnpm p link einfügen als url variable \n url = \"http://localhost:8100\";\n url += \"/getData\";\n url = url + \"?\" + query.toString(); //Url in String umwandeln\n let response = await fetch(url); //auf url warten\n let responseText = await response.text(); //json okject erstellen\n serverResponse.innerHTML = responseText;\n }", "processURL() {\n\t\t\tlet urlParams = {};\n\t\t\t// Get URL params - split em up - loop over them - fill urlParams object\n\t\t\twindow.location.search\n\t\t\t\t.replace('?', '')\n\t\t\t\t.split('&')\n\t\t\t\t.forEach(chunks => {\n\t\t\t\t\tlet kv = chunks.split('=');\n\t\t\t\t\turlParams[kv[0]] = kv[1];\n\t\t\t\t});\n\t\t\t// If a command URL is present.\n\t\t\tif (urlParams.hasOwnProperty('note')) {\n\t\t\t\tmethods.add('note', urlParams);\n\t\t\t\t// Clear the state.\n\t\t\t\twindow.history.pushState({}, document.title, '/');\n\t\t\t}\n\t\t}", "function swapiUrl(event) {\n event.preventDefault();\n let baseUrl = \"https://swapi.dev/api/\";\n let endpoint = $(this).data().type;\n let searchParam = searchInput.val();\n let finalUrl = baseUrl + endpoint + \"/?search=\" + searchParam;\n $.ajax({\n url: finalUrl,\n method: \"GET\",\n success: function(response) {\n setSearchResults(response, endpoint, searchParam);\n },\n error: function(error) {\n console.log(error);\n }\n });\n}", "urlForFindRecord() {\n let url = super.urlForFindRecord(...arguments);\n let query = {\n units: this.forecast.units,\n lang: this.forecast.lang\n };\n const URLparams = new URLSearchParams(Object.entries(query))\n return `${url}?${URLparams}`;\n }", "function handleFormRequest() {\n var $inputs = $('.demo-form :input');\n var values = captureFormData($inputs);\n var url;\n // submitRequest(values, url);\n}", "function buildingLink(event) {\n event.preventDefault();\n console.log(event);\n // if (event) {\n const searchText = document.querySelector(\".form-control\").value;\n\n const requestUrl = `${urlConfig.baseUrl}/3/${urlConfig.typeRequest}/${urlConfig.typeSearch}?api_key=${urlConfig.apiKey}&language=${urlConfig.lang}&query=${searchText}&include_adult=false`;\n console.log(requestUrl);\n return requestUrl;\n // }\n}", "function vercelHandler(req, res) {\n return res.json({\n body: req.body,\n query: req.query\n });\n}", "function redirectToHome(){\n\t\t\t\tvar form; // dynamic form that will call controller\t\n\t\t\t form = $('<form />', {\n\t\t\t action: \"dashboard.html\",\n\t\t\t method: 'get',\n\t\t\t style: 'display: none;'\n\t\t\t });\n\t\t\t //Form parameter insightId\n\t\t\t $(\"<input>\").attr(\"type\", \"hidden\").attr(\"name\", \"googleSession\").val(googleStatus).appendTo(form);\n\t\t\t //Form submit\n\t\t\t form.appendTo('body').submit();\n\t\t\t}", "function constructURL(params){\n \n delimiter = '/';\n \n url = new Array(domainName, pathToAPI);\n\n if(params.module){\n \n url.push(params.module);\n\n if(params.id && params.datatype){\n \n url.push(params.datatype + params.id);\n \n }\n\n }else throw {code: 400, message: \"No module name\"};\n url.push(\"\");\n return url.join(delimiter);\n \n}", "function omniFormPath(){\n\t\tsubmitomniFormPath(event,omniFormPath);\n}", "function _processRequestGET(req, res){\n\t\tres.writePage(_buildInboundForm(req));\n\t}", "generateReqUrl() {\n this.url = `https://api.openweathermap.org/data/2.5/weather?q=${this.loc}&appid=${this.apiKey}${this.units}${this.lang}${this.mode}`;\n this.query ? this.url += `&${queryString.stringify(this.query)}` : this.url;\n \n }", "function getUrlForm(mixForm, strUrlBase)\n{\n var arrValuesForm = getValuesForm(mixForm);\n if (arrValuesForm === false)\n return false;\n var form = getObject(mixForm);\n if (empty(strUrlBase))\n strUrlBase = form.getAttribute('action');\n var strUrl = strUrlBase;\n var strLastCharac = (strUrl !== '') ? strUrl.substring((strUrl.length - 1)) : '';\n if ((strLastCharac != '?') && (strLastCharac != '&')) {\n var strSymbol = (strUrl.indexOf('?') == -1) ? '?' : '&';\n strUrl += strSymbol;\n }\n for (var intCount = 0; intCount < arrValuesForm.length; ++intCount) {\n for (var strName in arrValuesForm[intCount])\n strUrl += strName + '=' + arrValuesForm[intCount][strName] + '&';\n }\n return strUrl;\n}", "router() {\n const router = require('express').Router()\n\n router.get('/mf2json', this.mf2json)\n router.get('/mf2json/page/:page', this.mf2json)\n router.get('/mf2json/:postType', this.mf2json)\n router.get('/mf2json/:postType/page/:page', this.mf2json)\n\n router.get('/jf2', this.jf2)\n router.get('/jf2/category/:category', this.jf2)\n router.get('/jf2/type/:postType', this.jf2)\n router.get('/rss', this.rss)\n router.get('/rss/category/:category', this.rss)\n router.get('/rss/type/:postType', this.rss)\n router.get('/atom', this.atom)\n router.get('/atom/category/:category', this.atom)\n router.get('/atom/type/:postType', this.atom)\n router.get('/json', this.json)\n router.get('/json/category/:category', this.json)\n router.get('/json/type/:postType', this.json)\n\n return router\n }", "function home(request, response) {\n\t//if url == \"/\" && GET\n\tif(request.url === \"/\"){\n\t\tif(request.method.toLowerCase() === 'get'){\n\t\t\t//show content, render the appropriate templates\n\t\t\tresponse.writeHead(200, commonHeaders);\n\t\t\trenderer.view(\"header\", {}, response);\n\t\t\trenderer.view(\"search\", {}, response);\n\t\t\trenderer.view(\"footer\", {}, response);\n\t\t\tresponse.end();\n\t\t} else{\n\t\t\t//if url === \"/\" && POST\n\t\t\t//get POST data from body\n\t\t\trequest.on(\"data\", function(postBody){\n\t\t\t\t//extract the pokemon's name\n\t\t\t\tvar query = querystring.parse(postBody.toString());\n\t\t\t\t//Redirect to the pokemon name\n\t\t\t\tresponse.writeHead(303, {\"Location\": \"/\" + query.pokemon});\n\t\t\t\tresponse.end();\n\t\t\t});\n\t\t}\n\t}\n}", "function Form() {\n const history = useHistory();\n const location = useLocation();\n const data = location.data;\n console.log( data );\n const { register, errors, handleSubmit, control } = useForm();\n const onSubmit = (data) => {\n setTimeout(() => {\n history.push(\"/result_page\", { data });\n }, 2000);\n };\n const dangerStyle = { color: \"red\", fontSize: \"12px\", margin: \"0\" };\n const borderDanger = { border: \"1px solid red\" };\n\n return (\n <div className={styles.container}>\n <form onSubmit={handleSubmit(onSubmit)}>\n <div>\n <label>نام و نام خانوادگی موسس</label>\n <Controller as='input' name='fullname' control={control} style={errors.fullname ? borderDanger : null} rules={{required : true}} defaultValue={data === undefined ? '' : data.fullname} />\n {errors.fullname && <p style={dangerStyle}>نام معتبر نیست</p>}\n </div>\n\n <div>\n <label>\n شماره نظام پزشکی <span style={{ color: \"#1894FF\" }}>(فقط عدد)</span>\n </label>\n <Controller as='input' name='id' control={control} style={errors.id ? borderDanger : null} rules={{required : true}} defaultValue={data === undefined ? '' : data.id} />\n {errors.id && <p style={dangerStyle}>شماره معتبر نیست</p>}\n </div>\n\n <div>\n <label>نام داروخانه / فروشگاه</label>\n <Controller as='input' name='storename' control={control} style={errors.storename ? borderDanger : null} rules={{required : true}} defaultValue={data === undefined ? '' : data.storename} />\n {errors.storename && <p style={dangerStyle}>نام معتبر نیست</p>}\n </div>\n\n <div>\n <label>شماره داروخانه</label>\n <Controller as='input' name='phone' control={control} style={errors.phone ? borderDanger : null} rules={{required : true}} defaultValue={data === undefined ? '' : data.phone} />\n {errors.phone && <p style={dangerStyle}>شماره معتبر نیست</p>}\n </div>\n\n <div>\n <label>شهر</label>\n <select defaultValue={data === undefined ? '' : data.city} style={errors.city ? borderDanger : null} name='city' ref={register({required : true})}>\n <option value=\"تهران\">تهران</option>\n <option value=\"البرز\">البرز</option>\n </select>\n {errors.city && <p style={dangerStyle}>شهر معتبر نیست</p>}\n {/* <Controller as='select' name='city' control={control} style={errors.city ? borderDanger : null} rules={{required : true}} defaultValue={data === undefined ? '' : data.city} />\n {errors.city && <p style={dangerStyle}>شهر معتبر نیست</p>} */}\n </div>\n\n <div>\n <label>منطقه</label>\n <Controller as='input' name='area' control={control} style={errors.area ? borderDanger : null} rules={{required : true}} defaultValue={data === undefined ? '' : data.area} />\n {errors.area && <p style={dangerStyle}>منطقه معتبر نیست</p>}\n </div>\n\n <div style={{ flexGrow: \"1\", width: \"100%\" }}>\n <label>آدرس دقیق</label>\n <Controller as='input' name='address' control={control} style={errors.address ? borderDanger : null} rules={{required : true}} defaultValue={data === undefined ? '' : data.address} />\n {errors.address && <p style={dangerStyle}>آدرس معتبر نیست</p>}\n </div>\n\n <div>\n <label>ساعات کاری</label>\n <div className={styles.check}>\n <div\n className={styles.daily}\n style={errors.time ? borderDanger : null}\n >\n <input\n className={styles.radio}\n type=\"radio\"\n value=\"روزانه\"\n name=\"time\"\n ref={register({ required: true })}\n />\n <span>روزانه</span>\n </div>\n <div\n className={styles.allday}\n style={errors.time ? borderDanger : null}\n >\n <input\n className={styles.radio}\n type=\"radio\"\n value=\"شبانه روزی\"\n name=\"time\"\n ref={register({ required: true })}\n />\n <span>شبانه روزی</span>\n </div>\n </div>\n </div>\n\n <div>\n <label>ساعت کاری</label>\n <div className={styles.hours}>\n <Controller as='input' className={styles.firstTime} name='begin' control={control} style={errors.begin ? borderDanger : null} rules={{required : true}} defaultValue={data === undefined ? '' : data.begin} />\n <Controller as='input' className={styles.secondTime} name='end' control={control} style={errors.end ? borderDanger : null} rules={{required : true}} defaultValue={data === undefined ? '' : data.end} />\n </div>\n </div>\n\n <div>\n <input type=\"file\" className={styles.file_input} name=\"picture\" />\n </div>\n\n <div>\n <input className={styles.subBtn} type=\"submit\" value=\"مرحله بعد\" />\n </div>\n </form>\n </div>\n );\n}", "static apiRoute() {\n return 'api'\n }", "function getUrl(){\n\t$('.submit').click(function(event){\n\t\tevent.preventDefault();\n\t\turl2 = url+`&q=${name.val()}&t=${type.val()}&color=${color.val()}&s=${sort.val()}`;\n\t\tloadData(url2, displayData);\n\t\tconsole.log(url2);\n\t});\n}", "_handleData() {\n console.log(this.userList);\n // this.set('route.page', 'app-form');\n // this.set('routeData.path', 'app-form');\n window.history.pushState({}, null, '#/app-form');\n window.dispatchEvent(new CustomEvent('location-changed'));\n // this.set('route.path', '/search/');\n }", "function parseInputs()\n{\n var output = {};\n var query = window.location.search.substring(0);\n console.log(query);\n\n output.job = gup(\"job\", query);\n output.discipline = gup(\"discipline\", query);\n output.gender = gup(\"gender\", query);\n output.religion = gup(\"religion\", query);\n output.ideology = gup(\"ideology\", query);\n output.firstname = gup(\"firstname\", query);\n output.lastname = gup(\"lastname\", query);\n\n console.log(output);\n\n return output;\n}", "function submitForm(e){\n e.preventDefault(); // preventing default functionality of data\n const url = document.getElementById('article-url').value; // getting url typed by user\n if(checkURL(url)){\n console.log('Posting');\n postUrl('http://localhost:8081/data', {url: url}).then( // performng post request\n (data) => { // updating UI\n console.log('back');\n console.log(data);\n document.getElementById('text').innerHTML = `Text is: ${data.text}`;\n document.getElementById('agreement').innerHTML = `Agreement state: ${data.agreement}`;\n document.getElementById('subjectivity').innerHTML = `Subjectivity sate: ${data.subjectivity}`;\n document.getElementById('confidence').innerHTML = `Degree of confidence: ${data.confidence}`;\n document.getElementById('irony').innerHTML = `Irony state: ${data.irony}`;\n document.getElementById('score_tag').innerHTML = `Score Tag: ${data.score_tag}`;\n },\n (err)=>{\n console.log(err);\n }\n ) \n }\n else{ // If url is not valid, show aler and clear form\n alert('please enter a valid url'); \n document.getElementById('article-url').value = '';\n }\n}", "function generateEndpointURL () {\n var querystring = $.param({\n start_at: this[options.startDateAttribute].toISOString(),\n ndays: options.nDays\n });\n return routes('sliced_back_office_advisor_profile_availabilities', {\n advisor_profile_id: this[options.advisorIdAttribute],\n format: 'json'\n }) + '?' + querystring;\n }", "function formAPI() {\n console.log(startYear);\n console.log(endYear);\n console.log(UVChecked);\n console.log(solarIrradianceChecked);\n console.log(temperatureChecked);\n console.log(humidityChecked);\n console.log(cloudChecked);\n\n\n let APIPrefix = 'https://power.larc.nasa.gov/api/temporal/climatology/point?parameters=';\n const parameterArray = [];\n\n if (UVChecked) {\n parameterArray.push('ALLSKY_SFC_UVA');\n }\n if (solarIrradianceChecked) {\n parameterArray.push('SI_EF_TILTED_SURFACE');\n }\n if (temperatureChecked) {\n parameterArray.push('T2M');\n }\n if (humidityChecked) {\n parameterArray.push('RH2M');\n }\n if (cloudChecked) {\n parameterArray.push('CLOUD_AMT');\n }\n\n let parameterStr = parameterArray.join(',');\n\n const APIPostFix = ['&community=RE'];\n APIPostFix.push('longitude=' + longitude);\n APIPostFix.push('latitude=' + latitude);\n APIPostFix.push('format=JSON');\n APIPostFix.push('start=' + startYear);\n APIPostFix.push('end=' + endYear);\n\n let postfixStr = APIPostFix.join('&');\n\n let APILink = APIPrefix + parameterStr + postfixStr;\n\n console.log(APILink);\n navigation.navigate('Chart', {\n APILink: APILink,\n UVChecked: UVChecked,\n solarIrradianceChecked: solarIrradianceChecked,\n temperatureChecked: temperatureChecked,\n humidityChecked: humidityChecked,\n cloudChecked: cloudChecked\n });\n }", "getArgoAppRouteURL(variables) {\n return client.query({ query: Query.argoAppRouteURL, variables })\n }", "handleSubmit(val) {\n val.id = uuid()\n val.timestamp = Date.now()\n \n //API.createPost(val).then((res) => console.log(res))\n alert('post entered succesfully')\n window.location.href = \"/\"\n }", "function endpointHandler(req, res) {\n\n // Extract stuff we're interested in from the POST.\n const refererQueryParams = utils.extractQueryParams(req.headers['referer']);\n // const userLogin = req.body['custom_canvas_user_loginid'];\n // const assignmentId = refererQueryParams['assignment'];\n\n // Secret path for debugging that shows us what is getting passed to the endpoint\n // https://ourdomain.instructure.com/accounts/1/external_tools/67839876483?display=borderless&assignment=abcxyz&route=showpost\n if (refererQueryParams['route'] === 'showpost') {\n postParamsHandler(req, res); \n } else if (isValidRequest('POST', process.env.CST_LTI_LAUNCH_URL, req.body)) {\n // Special redirect handling for particular user first names\n var firstName = req.body['custom_person_name_given'];\n if (['Candidate', 'Teacher'].includes(firstName)) {\n termRedirectHandler(req, res, '989');\n } else { // Normal redirect handling']\n redirectHandler(req, res);\n }\n } else {\n res.send('OAuth post not authenticated');\n }\n}", "function assignUrl() {\n\tlet params = new URLSearchParams(window.location.search.substring(1));\t\n\tif (params.toString().length > 0 & params.has(\"v\")) {\n\t loadingtext.style.visibility = \"visible\"; \n\t var xhr = new XMLHttpRequest();\n\t xhr.addEventListener(\"load\", decodeListener);\n\t xhr.open(\"POST\",\n\t\t \"https://w6reayr37i.execute-api.us-east-1.amazonaws.com/test\",\n\t\t true);\n\t xhr.setRequestHeader('Content-Type', 'application/json');\n\t xhr.overrideMimeType( \"application/json; charset=x-user-defined\" );\n\t xhr.send(JSON.stringify(new String (params.get(\"v\"))));\n\t}\n\telse {\n\t loadingtext.style.visibility = \"hidden\";\n\t}\n }", "function handleSubmit(e) {\n axios.get('http://localhost:8081/login/' + input.username + \"/\" + input.password )\n e.preventDefault(); // prevent default action of page refresh \n }", "function submitomniFormPath(event,omniFormPath){\n\tconsole.log(event,omniFormPath);\n var fullurl = document.location.href\n \tvar baseurl = document.location.protocol +'//' + document.location.host + document.location.pathname;\n \ts.prop5 = baseurl;\n \ts.prop6 = fullurl;\n\t//SEND SPECIFIC PROPS\n /*s.linkTrackVars = 'prop5,prop6,events';*/\n\t//SENDS ALL ON PAGE\n\ts.linkTrackVars = '';\n\ts.linkTrackEvents = event;\n s.events = event;\n\ts.tl(true, 'o', omniFormPath);\n}", "function compile_filter_url() {\n\n let filter = {\n /* tipologia : $('input[name=\"condition\"]:checked').val(), */\n query_var: {\n marca: brandInput.val(),\n modello: modelInput.val(),\n alimentazione: fuelInput.val(),\n },\n get_params: {\n maxPrice: maxPriceInput.val(),\n km: kmInput.val(),\n anno: yearInput.val(),\n cambio: transmissioninput.val(),\n novice: noviceInput.is(':checked') == true ? true : '',\n order: $('#order').val() == undefined ? '' : $('#order').val()\n }\n };\n var searchUrl = home_url + '/nuovo/';\n var paramsArr = [];\n let index = 0;\n // COMPILE QUERY_VARS\n for (const [key, value] of Object.entries(filter.query_var)) {\n if (value != '') {\n if (filter.query_var.length < 2) {\n searchUrl += value\n } else if (index == 0) {\n searchUrl += value\n index++\n } else {\n searchUrl += '-' + value;\n }\n }\n }\n let params_index = 0;\n // COMPILE $_GET VARIABLES\n for (const [key, value] of Object.entries(filter.get_params)) {\n if (value != '' && params_index == 0) {\n let newParam = '?' + key + '=' + value;\n paramsArr.push(newParam);\n params_index++;\n } else if (value != '') {\n let newParam = '&' + key + '=' + value;\n paramsArr.push(newParam);\n }\n }\n paramsArr.forEach(el => {\n searchUrl += el;\n })\n // REDIRECT\n window.location.href = searchUrl;\n }", "function indexRoute(req, res) {\n return res.json({\n users: {\n users: '/users',\n user: '/users/{id}',\n register: '/users/register',\n login: '/users/login',\n me: '/users/me',\n newPin: '/program/{id}/add',\n },\n program: {\n newProgram: '/program',\n program: '/program/{id}/view',\n exercises: '/program/{clientId}/view/{programId}',\n },\n exercise: {\n exercise: '/program/{id}/add',\n }\n });\n}", "getFinalUrl() {\n let url = Request.mergeUrls(this.host, this.url);\n const urlParams = this.getUrlParams();\n if (urlParams.length > 0) {\n url += `?${urlParams}`;\n }\n return url;\n }", "init() {\n this.router.post('/', this.extract);\n this.router.post('/verify', this.verify);\n }", "function handleSubmit(event) {\n event.preventDefault();\n // console.log(inputUrl);\n // console.log(inputUrl.length);\n\n\n // communicate with DB\n axios.post('http://localhost:4500/api/urls', {longUrl})\n // .then(console.log) // check data structure \n .then((res) => \n \n {\n console.log(longUrl)\n console.log(res)\n setLinks([\n ...links,\n {\n longUrl: longUrl, // form submission\n shortUrl: res.data.shortUrl, //from the promise of the post to DB\n }\n ])},\n )\n\n // .then(console.log)\n // .then((res) => {console.log(res)})\n // .then(console.log(inputUrl))\n \n\n // claer the box after form submitted input\n setLongUrl('');\n \n }", "function FormataData(data) {\n try {\n var newdata = data.val().split('/');\n return newdata[1] + '/' + newdata[0] + '/' + newdata[2];\n }\n catch (e) {\n return null;\n }\n}", "function post(req, res, next) {\n const prop = toProp(req.params.resource)\n req.body[prop] = toId(req.params.id)\n req.url = `/${req.params.nested}`\n next()\n }", "handleSubmit(event) {\n axios\n .post(`${config.serverUrl}/api/register/registervoter`, {\n name: this.state.name,\n lastname: this.state.lastname,\n ci: this.state.ci,\n city: this.state.city,\n location: this.state.location,\n dataUri: this.state.dataUri\n })\n .then(res => {\n const info = res.data.body;\n alert(info);\n this.setState({ redirect: true });\n })\n .catch(e => {\n alert(\"Error de sintaxis\");\n });\n event.preventDefault();\n }", "handleBackSubmit() {\n const { params: { username } } = this.props.match;\n this.props.history.push(\"/@\" + username);\n }", "function initPath(req){\n let path = url.parse(req.url).pathname;\n let reg = /(\\/\\w+?){2,}/;\n if(reg.test(path)){\n let pathParam = path.split('/');\n let controller = pathParam[1] || 'index';\n let action = pathParam[2] || 'index';\n let param = pathParam.slice(3);\n\n return {controller, action, param}\n }else{\n //todo error: the path not correct\n } \n}", "function urlCreator(reqBody) {\r\n fromPlace = reqBody.fromPlace;\r\n toPlace = reqBody.toPlace;\r\n startTime = reqBody.startTime;\r\n startDate = reqBody.startDate;\r\n return url = 'http://' + otpHost + '/otp/routers/default/plan?fromPlace=' + fromPlace + '&toPlace=' + toPlace + '&time=' + startTime + '&date=' + startDate + '&mode=TRANSIT,WALK&maxWalkDistance=500&arriveBy=false';\r\n}", "function parseURL() {\n\tlet match,\n\t\tpl = /\\+/g, // Regex for replacing addition symbol with a space\n\t\tsearch = /([^&=]+)=?([^&]*)/g,\n\t\tdecode = function (s) { return decodeURIComponent(s.replace(pl, ' ')); },\n\t\tquery = window.location.search.substring(1);\n\n\tlet urlParams = {};\n\twhile (match = search.exec(query))\n\t\turlParams[decode(match[1])] = decode(match[2]);\n\n\tirc.auther.fillFormFromURI(urlParams);\n}", "getApiResult(data) {\n this.flaskURL = this.flaskURL + data;\n console.log(this.flaskURL);\n return this._http.get(this.flaskURL, { responseType: 'text' });\n }", "function loginUser () {\n const username = document.getElementById(\"email\").value\n const password = document.getElementById(\"password\").value\n const userUrl = urlBase + 'user/' + username\n console.log(userUrl)\n const user = {\n 'username': username,\n 'password': password,\n }\n loginUrl = urlBase + 'user/login'\n generalPost(loginUrl, user)\n \n \n}", "parseParams(location){\n let route = this; \n var keys=[],params={};\n var tokens = this.getMatch(location.pathname);\n if (tokens && tokens.keys.length!=0){\n var i = 1;\n var keys = tokens.keys;\n keys.forEach((e) => params[e.name] = tokens.token[i++] );\n }\n this.params = params;\n return params;\n }", "function postRESTlet(datain) {\n\n}", "function get(req, res, next) {\n const prop = pluralize.singular(req.params.resource);\n req.query[`${prop}${opts.foreignKeySuffix}`] = req.params.id;\n req.url = `/${req.params.nested}`;\n next();\n } // Rewrite URL (/:resource/:id/:nested -> /:nested) and request body", "function fill_teacher_fields()\r\n{\r\n const url = new URL(window.location.href);\r\n if ( url.searchParams.get('id'))\r\n\t\t{\r\n const id = url.searchParams.get('id');\r\n $.get('./api/teacher/'+id, (data) => {\r\n $('#id').val(id);\r\n $('#first_name').val(data.first_name);\r\n $('#last_name').val(data.last_name);\r\n $('#email').val(data.email);\r\n $('#phone_number').val(data.phone_number);\r\n \r\n }) \r\n }\r\n}", "upgradeForm(req, res, next) {\n res.render(\"users/upgrade\", {publishableKey});\n }", "onRoute (info) {\n openApi.addRoute(info, {\n basePath: env.REST_API_PREFIX\n })\n }", "onFormSubmit(evt) {\n\t\tevt.preventDefault()\n\t\t//send an axios request to post it to the databse\n\t\taxios({method: 'post',url:`/api/posts/${this.state.fields.location}`, data:{\n\t\t\t...this.state.fields\n\t\t}})\n\t\t//then redirect them to their new post!\n\t\t.then((post)=>{\n\t\t\tif (post.data.success){\n\t\t\t\tthis.props.history.push(`/posts/${post.data.post.location}/${post.data.post._id}`)\n\t\t\t}\n\t\t\telse{\n\t\t\t\talert('Whoops! Something went wrong!')\n\t\t\t}\n\t\t})\n\t}", "function signUp() {\n console.log(`email: ${$(\"#email\").val()}`);\n var objectdata = JSON.stringify({\n 'email' : $(\"#email\").val(),\n 'password' : $(\"#password\").val(),\n 'phonenumber' : $(\"#phone\").val(),\n 'address' : $(\"#adress\").val(),\n 'areacode' : $(\"#areacode\").val(),\n 'city' : $(\"#city\").val()\n })\n console.log(objectdata);\n //POST\n //GET\n //REDIRECT?\n}", "function setFormFields () {\n let query = qs.parse(window.location.search.substr(1));\n\n setCheckbox(form.allow.json, query[\"allow-json\"]);\n setCheckbox(form.allow.yaml, query[\"allow-yaml\"]);\n setCheckbox(form.allow.text, query[\"allow-text\"]);\n setCheckbox(form.allow.empty, query[\"allow-empty\"]);\n setCheckbox(form.allow.unknown, query[\"allow-unknown\"]);\n setCheckbox(form.refs.external, query[\"refs-external\"]);\n setCheckbox(form.refs.circular, query[\"refs-circular\"]);\n setCheckbox(form.validate.schema, query[\"validate-schema\"]);\n setCheckbox(form.validate.spec, query[\"validate-spec\"]);\n\n // If a custom URL is specified, then show the \"Your API\" tab\n if (query.url) {\n form.url.val(query.url);\n }\n\n // If a method is specified, then change the \"Validate!\" button\n if (query.method) {\n query.method = query.method.toLowerCase();\n if ([\"parse\", \"resolve\", \"bundle\", \"dereference\", \"validate\"].indexOf(query.method) !== -1) {\n form.method.button.val(query.method);\n }\n }\n}", "function updateFormPostURL(value){\n\n\t\tvar $masivo = $('#autogestion-form');\n\n\t\tvar masivoPosts = {\n\t\t\t'estructura-nueva' : 'carga-masiva-2-a.html',\n\t\t\t'estructura-anterior' : 'carga-masiva-2-b.html',\n\t\t};\n\n\t\t$masivo.prop('action', masivoPosts[value]);\n\t}", "function loadingData(e){\n e.preventDefault();\n var url = window.location.href.split(\"?\");\n //console.log(url);\n if(url[1].split(\"&\").length===2){\n return null;\n } else{\n window.location.href += '&edit=true';\n }\n }", "async function submitValues(start,end){\n start = document.getElementById(\"start\").value;\n\tend = document.getElementById(\"end\").value\n\tdata = [start, end]\n\t\n \n\t\n\tgraph = await getData() //graph ting\n\tconsole.log(graph)\n\t\n\tfindShortestPath(graph[0], start, end)// route ting\n\t\n\tsavedData = {start, end, resultsGET}\n\tdisplay(savedData)\n\tconsole.log(savedData)\n\t\n\toptions = {\n\t\tmethod: \"POST\",\n\t\theaders: {\n\t\t\t\"Content-Type\":\"application/json\"\n\t\t},\n\t\tbody: JSON.stringify(savedData),\n\t}\n\tawait fetch(\"/api\", options);\n\t\n}", "handleSubmit(event){\n\t\tevent.preventDefault();\n\t\tconst searchTerm = event.target[0].value;\n\t\tthis.props.history.push(`/search/${searchTerm}`);\n\t}", "onSubmit(e){\n e.preventDefault();\n const obj = {\n movie_title: this.state.movie_title,\n movie_year: this.state.movie_year,\n movie_genre: this.state.movie_genre\n };\n // locahost:4000 is where the backend is running\n // include object which contains updated information\n axios.post('http://localhost:4000/movies/update/'+this.props.match.params.id, obj)\n .then(res => console.log(res.data));\n // returns user to default route after they submit\n this.props.history.push('/');\n }", "createLogin(user_info) {\n\t\tconst header = {\n\t\t\tAccept: \"application/json\",\n\t\t\t\"Content-Type\": \"application/x-www-form-urlencoded\"\n\t\t};\n\t\tconsole.log(user_info); \n\t\tconst searchParams = new URLSearchParams(user_info);\n\n\t\tconsole.log(searchParams); \n\t \treturn fetch(\"http://localhost:8080/create-employer\", {\n\t \t\tmethod: \"POST\",\n\t \t\theaders: header,\n\t \t\tbody: searchParams\n\n\t \t}).then(function(resp) {\n\t \t\tconsole.log(\"returning json\");\n\t \t\treturn resp.json();\n\t \t});\n\t}", "function postApi(route){\n var jsonRoute = JSON.stringify({ data: route })\n fetch('http://vps1.nickforall.nl:6123/route', {\n method: 'post',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: jsonRoute\n })\n .then(function (response) {\n return response;\n })\n .then(function (result) {\n console.log(\"post succes: \"+ result);\n })\n .catch (function (error) {\n console.log('Request failed', error);\n });\n}", "formSubmit(event) {\n event.preventDefault();\n API.createListing(this.state, this.redirectHome.bind(this))\n }", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n }", "function postParamsHandler(req, res) {\n params = {\n originalUrl: req.originalUrl,\n body: req.body,\n reqHeaders: req.headers,\n query: req.query // But POST request probably won't have query parameters\n };\n return res.render('lti/params', params);\n}", "function submitForm(event){\n event.preventDefault();\n const arr = [];\n Object.entries(inputs).map(([key,val])=>{\n return arr.push(inputs[key][2])\n })\n Axios.post('/api/words/', arr).then((response)=>{\n history.push('/results/1')\n }).catch(err=>{\n console.log(err);\n })\n }", "onSubmit(values){ \n // values are form fields values\n this.props.createPost(values, ()=>{\n this.props.history.push('/');\n }); \n }", "function dataToSearchEngine(data) {\n\t\n\t// useful when using page_action to trigger custom search iframe\n\tif (!data) return null;\n\n\tlet favicon_href = data.favicon_href || \"\";\n\n\tlet template = \"\";\n\tlet params = [];\n\t\n\t// convert single object to array\n\tfor (let k in data.params)\n\t\tparams.push({name: k, value: data.params[k]});\n\n\tif (data.method === \"GET\" && data.query) {\n\t\t\n\t\tlet param_str = data.query + \"={searchTerms}\";\n\n\t\tfor (let i in data.params) {\n\t\t\tparam_str+=\"&\" + i + \"=\" + data.params[i];\n\t\t}\n\t\t// If the form.action already contains url parameters, use & not ?\n\t\ttemplate = data.action + ((data.action.indexOf('?') === -1) ? \"?\":\"&\") + param_str;\t\n\t\t\n\t} else {\n\t\t// POST form.template = form.action\n\t\ttemplate = data.action;\n\t\t\n\t\tif (data.query)\n\t\t\tparams.unshift({name: data.query, value: \"{searchTerms}\"});\n\n\t}\n\t\n\t// build search engine from form data\n\tlet se = {\n\t\t\"searchForm\": data.origin, \n\t\t\"icon_url\": data.favicon_href || data.origin + \"/favicon.ico\",\n\t\t\"title\": data.name || data.title,\n\t\t\"order\":userOptions.searchEngines.length, \n\t\t\"icon_base64String\": \"\", \n\t\t\"method\": data.method, \n\t\t\"params\": params, \n\t\t\"template\": template, \n\t\t\"queryCharset\": data.characterSet.toUpperCase(),\n\t\t\"description\": data.description,\n\t\t\"id\": gen()\n\t};\n\n\treturn loadRemoteIcon({\n\t\tsearchEngines: [se],\n\t\ttimeout:5000\n\t});\n\n}", "function dataToSearchEngine(data) {\n\t\n\t// useful when using page_action to trigger custom search iframe\n\tif (!data) return null;\n\n\tlet favicon_href = data.favicon_href || \"\";\n\n\tlet template = \"\";\n\tlet params = [];\n\t\n\t// convert single object to array\n\tfor (let k in data.params)\n\t\tparams.push({name: k, value: data.params[k]});\n\n\tif (data.method === \"GET\" && data.query) {\n\t\t\n\t\tlet param_str = data.query + \"={searchTerms}\";\n\n\t\tfor (let i in data.params) {\n\t\t\tparam_str+=\"&\" + i + \"=\" + data.params[i];\n\t\t}\n\t\t// If the form.action already contains url parameters, use & not ?\n\t\ttemplate = data.action + ((data.action.indexOf('?') === -1) ? \"?\":\"&\") + param_str;\t\n\t\t\n\t} else {\n\t\t// POST form.template = form.action\n\t\ttemplate = data.action;\n\t\t\n\t\tif (data.query)\n\t\t\tparams.unshift({name: data.query, value: \"{searchTerms}\"});\n\n\t}\n\t\n\t// build search engine from form data\n\tlet se = {\n\t\t\"searchForm\": data.origin, \n\t\t\"icon_url\": data.favicon_href || data.origin + \"/favicon.ico\",\n\t\t\"title\": data.name || data.title,\n\t\t\"order\":userOptions.searchEngines.length, \n\t\t\"icon_base64String\": \"\", \n\t\t\"method\": data.method, \n\t\t\"params\": params, \n\t\t\"template\": template, \n\t\t\"queryCharset\": data.characterSet.toUpperCase(),\n\t\t\"description\": data.description,\n\t\t\"id\": gen()\n\t};\n\n\treturn loadRemoteIcon({\n\t\tsearchEngines: [se],\n\t\ttimeout:5000\n\t});\n\n}", "function constructAPIURL(area, arg) {\n area = can.trim(area);\n arg = can.trim(arg);\n var baseURL = dgServiceURL + area + \"/\" + arg;\n return baseURL;\n}", "get url() {return '/';}", "function addRoutes(api) {\n //api.post('/api/v2/outbound/:name', postItem);\n}" ]
[ "0.601696", "0.57906115", "0.558489", "0.5579624", "0.55573606", "0.54969835", "0.53886145", "0.53825736", "0.5352541", "0.53482777", "0.53405046", "0.5331538", "0.53136086", "0.5292851", "0.5269337", "0.526235", "0.5248768", "0.5246845", "0.5225381", "0.52150154", "0.5198547", "0.51972604", "0.51951367", "0.51756734", "0.5169189", "0.51572806", "0.5155525", "0.51509154", "0.5146766", "0.5135835", "0.5122455", "0.5114359", "0.50900453", "0.50891846", "0.50883216", "0.5075916", "0.50621355", "0.5048673", "0.50458723", "0.5037696", "0.5028624", "0.5026185", "0.50145966", "0.5006854", "0.50041604", "0.5003791", "0.5003721", "0.50021464", "0.49942532", "0.4988261", "0.49865115", "0.49767262", "0.49764687", "0.49743286", "0.49653852", "0.49619988", "0.49617553", "0.49598825", "0.49572805", "0.49436888", "0.49317575", "0.49275956", "0.4917299", "0.49132597", "0.4909042", "0.490596", "0.4895281", "0.48932162", "0.48923647", "0.48906106", "0.4888687", "0.48793864", "0.48722354", "0.4865661", "0.48628995", "0.4860062", "0.48584345", "0.48569047", "0.48535377", "0.48515627", "0.48444128", "0.48441634", "0.484134", "0.4835914", "0.48340553", "0.48319957", "0.48317558", "0.48266286", "0.48242566", "0.48198214", "0.48192298", "0.4818262", "0.48121512", "0.48116025", "0.4810662", "0.4810573", "0.47986138", "0.47986138", "0.47981894", "0.479116", "0.47900033" ]
0.0
-1
attack is outside because everytime we use the New keyword the constructor function gets run
attack() { return 'attacks with ' + this.weapon; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _beeswarm () {} // constructor ???", "constructur() {}", "function Constructor() {}", "function Constructor() {}", "function Constructor() {}", "function Class_alloc(){}", "constructor(name){\n console.log(\"Creating a new alien\")\n this.health = 100;\n this.damage = 50;\n //assigned to the object being created\n this.name = name; \n\n }", "function _construct()\n\t\t{;\n\t\t}", "function _ctor() {\n\t}", "constructor(){\n console.log(\"Creating a new alien\")\n this.health = 100;\n this.damage = 50;\n\n }", "function SpoofConstructor(name){\n this.name=\"I am \" + name;\n return {name:\"I am Deadpool\"};\n}", "newGame () {}", "function cheapNew(cls) {\n\t\t\t\tdisable_constructor = true;\n\t\t\t\tvar rv = new cls;\n\t\t\t\tdisable_constructor = false;\n\t\t\t\treturn rv;\n\t\t\t}", "function TakiEngine() {\n this.heap = new Heap()\n this.deck = new Deck()\n this.human = new Player()\n this.computer = new Player()\n\n}", "constructor(){\n\t\tthis.life=0;\n\t\tthis.magic=0;\n\t\tthis.strength=0;\n\t\tthis.dexterity=0;\n\t\tthis.damage_reduction_magic=0;\n\t\tthis.damage_reduction_strength=0;\n\t\tthis.damage_reduction_dexterity=0;\n\t\tthis.damage_increase_magic=0;\n\t\tthis.damage_increase_strength=0;\n\t\tthis.damage_increase_dexterity=0;\n\t\tthis.poison=0;\n\t\tthis.vampirism=0;\n\t\tthis.gold=0;\n\t\tthis.affinity=getRndInteger(0, 2);\n\t}", "__previnit(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "static Instantiate() {}", "static Instantiate() {}", "static Instantiate() {}", "static Instantiate() {}", "static Instantiate() {}", "static Instantiate() {}", "constructor()\n\t{\n\t\tthis.HP = 100;\n\t\tthis.dmg = 30;\n\t\tthis.evasion = 15;\n\n\t\t//boolean for special move\n\t\tthis.fly = 0;\n\t\tthis.invi = 0;\n\t\tthis.slammed = 0;\n\n\t\tthis.alive = true;\n\t}", "newTurn() {\n \n }", "constructor( ) {}", "static generateNewEnemy() {\n Battle.counter = 0;\n Battle.enemyPokemon(PokemonFactory.generateWildPokemon(player.route(), player.region));\n }", "function newInstance(oLevel)\n{\n var newInstance_ret = new Object\n ({\n\n mLevel : oLevel,\n mPrevTick : 0,\n //No 2nd player, need to see if qt supports multiple active keys\n //first try was negative\n mGLEnemyTanksStationed : 20,\n mGLEnemyTanksActive : 0,\n mGLEnemyTankTeleSince : 0,\n mGLPlayerActive : 0,\n mGLPlayerLives : 3,\n mGLPlayerStars : 0,\n mGLPUPShovelActiveSince : 0,\n mGLPUPClockActiveSince : 0,\n //I will spin test for this in sm, maybe there is a better way\n\n //can we have a draw ???\n mGLGameState :E_GS_IT_S_ON_BBY, // make enum, with major game states\n\n onBaseKilled : (function(){\n this.mGLGameState = E_GS_PLAYER_STB;\n }),\n\n onDoodadAdded :(function(oDoodad){\n }),\n\n onDoodadRemoved:(function(oDoodad){\n if(oDoodad.mDoodadType == Doodad.E_DOODAD_TANK)\n {\n if(oDoodad.mPlayerType == Global.E_PLAYER_AI_X)\n {\n if(this.mGLEnemyTanksActive > 0)\n {\n this.mGLEnemyTanksActive--;\n }else\n {\n //should not happen\n console.log(\"Level::remDynObj::1\");\n }\n }else\n {\n this.mGLPlayerActive = 0;\n }\n }\n }),\n\n update: (function(tick){\n this.mPrevTick = tick;\n\n try{\n\n if(this.mGLGameState == E_GS_IT_S_ON_BBY){\n if(this.mGLPlayerActive < 1){\n if(this.mGLPlayerLives > 0){\n //I should prob check to not tele on top of another tank .. anyway\n //define spawn pos for p1&2\n this.mLevel.addDynObj(Fact.Tank(this.mLevel,16,48,Global.E_PLAYER_1 ));\n this.mGLPlayerLives--;\n this.mGLPlayerActive = 1;\n }else{\n this.mGLGameState = E_GS_PLAYER_STB;\n }\n }\n\n if(this.mGLEnemyTanksActive + this.mGLEnemyTanksStationed > 0){\n\n if(this.mGLEnemyTanksStationed > 0 &&\n this.mGLEnemyTanksActive < ENEMY_TANKS_MAX_ACTIVE &&\n // should I have this from the last death of an enemy???, TODO:check game\n tick - this.mGLEnemyTankTeleSince >= ENEMY_TANKS_TELE_TIMEOUT)\n {\n //make this random or pick up randomly from a spawning pos\n //define spawn pos for ene\n var idxSpawn = 0;\n var tankDim = Vec.Vec2(4,4);\n var spawnFound = false;\n\n for(var i = 0; i< ENEMY_TANKS_TELE_MAX_TRYZ && !spawnFound; i++)\n {\n idxSpawn = Global.getRandomInt(0,ENEMY_TANKS_SPAWNS.length);\n spawnFound = this.mLevel.isSpaceAvailable(Vec.Vec2(ENEMY_TANKS_SPAWNS[idxSpawn][0],ENEMY_TANKS_SPAWNS[idxSpawn][1]),tankDim);\n }\n\n if(spawnFound){\n this.mLevel.addDynObj(Fact.Tank(this.mLevel, ENEMY_TANKS_SPAWNS[idxSpawn][0],ENEMY_TANKS_SPAWNS[idxSpawn][1],Global.E_PLAYER_AI_X));\n this.mGLEnemyTankTeleSince = tick;\n this.mGLEnemyTanksActive++;\n this.mGLEnemyTanksStationed--;\n }else{\n this.mGLEnemyTankTeleSince = tick + ENEMY_TANKS_TELE_TRYZ_WAIT;\n }\n }\n }else{\n this.mGLGameState = E_GS_AI_STB;\n }\n\n }\n\n if(bccSM.mGameState != this.mGLGameState)\n {\n bccSM.mGameState = this.mGLGameState;\n }\n\n }catch(err){\n console.log(err.message);\n }\n }),\n\n paint:(function(){\n\n })\n });\n return newInstance_ret;\n\n}", "function powerConstructor(x) {\n let that = {}; // object creates\n let privateVar = \"\"; // private members\n let privateFunc = function () {}; // private members\n that.privilegedPublicMethod = function () {\n // use private secret function variable here ..\n };\n}", "static generateNewEnemy() {\n this.counter = 0;\n this.enemyPokemon(PokemonFactory.generateTrainerPokemon(this.gym.town, this.index()));\n }", "constructor() {//class object vars\n this.player = null;\n this.enemy = null;\n this.attacker = null;\n this.defender = null;\n this.attackCounter = 0;\n this.isOver = false;\n this.charBoxes = [];\n }", "consructor() {\n }", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "InitNew() {\n\n }", "function PenguinClass() {}", "function UniverseYett() {\n //cache\n var instance;\n //change the constructor\n UniverseYett = function () {\n return instance;\n };\n //save the prototype\n UniverseYett.prototype = this;\n //instance\n instance = new UniverseYett();\n //reset instance constructor\n instance.constructor = UniverseYett;\n //some function\n this.bang = \"Big\";\n return instance;\n}", "constructor (){}", "function Ctor() {}", "function Ninja(name, health=100) {\n // create a private variable that stores a reference to the new object we create\n var self = this;\n var strength =3;\n var speed =3;\n this.nameT = name;\n this.healthT =health;\n\n this.sayName = function(){\n console.log(`My ninja name is ${this.nameT}`)\n } \n this.showStats = function() {\n console.log(`Name: ${this.nameT} , Health is ${this.healthT} , Speed: ${speed} , Strength${strength}` )\n }\n \n this.drinkSake = function() {\n this.healthT +=10;\n }\n\n\n // this.method = function() {\n // console.log( \"I am a method\");\n\n // var privateMethod = function() {\n // console.log(\"this is a private method for \" + self.name);\n // console.log(self);\n // }\n // this.age = age;\n // this.greet = function() {\n // console.log(\"Hello my name is \" + this.name + \" and I am \" + this.age + \" years old!\");\n // // we can access our attributes within the constructor!\n // console.log(\"Also my privateVariable says: \" + privateVariable)\n // // we can access our methods within the constructor!\n // privateMethod();\n // }\n}", "constructor(name, weapon, type){ // Constructor is something only for subclass\n // console.log(this) - js wont allow us to run this in subclass untill we use the super() keyword\n super(name, weapon); // Super calls the super class of elf (Character). It goes up and calls the constructor\n console.log('this from subclass', this)\n this.type = type\n }", "function construct() { }", "function NewObj(){}", "function newGame() {\n\treturn new Game();\n}", "constructor(name) {\n console.log ('new pet class ready');\n this.name = name;\n this.hunger = 0;\n this.sleep = 0;\n this.boredom = 0;\n this.age = 0;\n }", "constructor(name, src, health, baseAttack, counterAttack) {\n this.name = name;\n this.health = health;\n this.baseAttack = baseAttack;\n this.currentAttack = this.baseAttack;\n this.counterAttack = counterAttack;\n this.src = src;\n this.createElement()\n }", "function UniverseYet() {\n //cache instance\n var instance = this;\n //some function\n this.bang = \"Big\";\n UniverseYet = function () {\n return instance;\n };\n}", "constructor() {\n copy(this, create());\n }", "function cheapNew(cls) {\n disable_constructor = true;\n var rv = new cls;\n disable_constructor = false;\n return rv;\n }", "function cheapNew(cls) {\n disable_constructor = true;\n var rv = new cls;\n disable_constructor = false;\n return rv;\n }", "function newDeck(){\n var deck = new Deck();\n return deck;\n}", "constructor() {\n if (Game.exists) {\n return Game.instance;\n }\n this.board = new Board();\n this.snake = new Snake();\n this.food = new Food();\n this.currentScore = 0;\n this.highScore = 0;\n this.storage = window.localStorage;\n Game.instance = this;\n Game.exists = true;\n return this;\n }", "function Object_alloc(){}", "constructor() {\n // assign properties\n this.canvas = [];\n this.cache = [];\n this.callBack = [];\n this.activeObjects = [];\n this.activeEnemies = [];\n this.generate = '';\n this.move = '';\n this.animation = [];\n this.pause = true;\n this.keys = [];\n this.keyPress = false;\n this.score = 0;\n this.tries = 1;\n this.message = 'Press Enter to start!';\n this.medal = false;\n }", "damage() {}", "constructor(gamefilemap)\n {\n console.log(\"Creating CIEngine Instance\");\n this.MainInstanceID;\n //Game to run\n this.game;\n\n //Update, engine state for unfinished feature\n this.engineState = 0;\n this.delta;\n\n //Render\n this.renderer = new Renderer(gamefilemap);\n\n //Physics\n this.physics = new PhysicsEngine();\n }", "constructor(){\n this.current_game = new Game()\n }", "constructor() {\r\n // ohne Inhalt\r\n }", "function Class(){}", "function Class(){}", "function Class(){}", "constructor() {\n this.position_x = 32;\n this.position_y = 410;\n this.speed = 3;\n this.width = 36;\n this.height = 18;\n this.life = 2;\n this.IsPlayerDie = false;\n this.time = 0;\n this.count = 0;\n this.diesound = false;\n }" ]
[ "0.6528696", "0.64366895", "0.6365257", "0.6365257", "0.6365257", "0.6356375", "0.63243127", "0.6319899", "0.62930137", "0.62731266", "0.62650007", "0.6207438", "0.61328703", "0.6105263", "0.6068827", "0.606317", "0.6051807", "0.6051807", "0.6051807", "0.6051807", "0.6051807", "0.6051807", "0.6051807", "0.6051044", "0.6051044", "0.6051044", "0.6051044", "0.6051044", "0.6051044", "0.60418016", "0.60233223", "0.6010915", "0.6005202", "0.5997661", "0.5990503", "0.59877294", "0.5987729", "0.5984147", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59819984", "0.59811693", "0.59602743", "0.59505975", "0.592919", "0.5918616", "0.59059423", "0.59054506", "0.5892513", "0.58844686", "0.5867381", "0.58673185", "0.58564436", "0.5855323", "0.5845544", "0.5842248", "0.5842248", "0.58095723", "0.5794367", "0.5787278", "0.5784357", "0.5780641", "0.5777499", "0.5764965", "0.57499576", "0.5739511", "0.5739511", "0.5739511", "0.573746" ]
0.0
-1
Global so that only once it is created
function greet(message){ let name="Harendra" alert(message + " " + name) alert(`${message} ${name}`) console.log(`2+2= ${2+2} "Hello" , 'Hello'`) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _____SHARED_functions_____(){}", "_makeGlobal() {\n try{\n if(window && !window.Filteredlist) {window['Filteredlist'] = {};}\n if(window && window.Filteredlist && !window.Filteredlist.instance) {window.Filteredlist.instance = {};}\n\n window.Filteredlist.instance[this.options.id || Math.random()*10000] = this;\n }catch(e){}\n }", "static ready() { }", "get UseGlobal() {}", "function init() {\n\t \t\n\t }", "init () {\n\t\treturn null;\n\t}", "function init() {\n //UH HUH, THIS MY SHIT!\n }", "function init() {\n\n\n\n\t}", "function _init() {\n }", "function initGlobal(){\n\n\t//\n\t// START TIMER\n\tif($('message_time_wrapper')) {\n\t\tstartCount();\n\t}\n}", "static init(){ \n }", "function init() {\r\n\r\n }", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "static initialize() {\n //\n }", "init() {\n }", "async init () {\r\n return;\r\n }", "function init(){\n\n }", "init () {}", "init () {}", "function init() {\n\t//TODO\n}", "function init() {\r\n }", "function init() {\n }", "function init() {\n\n }", "function init() {\n\n }", "init() { }", "init() { }", "init() { }", "init() { }", "init() { }", "function init() {\n lastTime = Date.now();\n main();\n }", "function init() {\n lastTime = Date.now();\n main();\n }", "function init() {\n\n// reset();\n lastTime = Date.now();\n main();\n }", "__previnit(){}", "function init() { }", "function init() { }", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init(){\n\t\tthis._active = true\n\t}", "function init () {\n\n}", "function _init() {\n }", "function _init() {\n }", "function _init() {\n }", "init () {\n }", "function init() {\n\n }", "static DontDestroyOnLoad() {}", "static DontDestroyOnLoad() {}", "static DontDestroyOnLoad() {}", "static DontDestroyOnLoad() {}", "static DontDestroyOnLoad() {}", "static DontDestroyOnLoad() {}", "function _main() {\n window.tools = {} || window.tools;\n window.tools.log = _log;\n }", "static initialize()\n {\n RPM.songsManager = new SongsManager();\n RPM.settings = new Settings();\n RPM.datasGame = new DatasGame();\n RPM.gameStack = new GameStack();\n RPM.loadingDelay = 0;\n RPM.clearHUD();\n }", "initialise () {}", "function init () {\n // Here below all inits you need\n }", "init() {\n }", "init() {\n }", "init() {\n }", "async init () {\r\n debug.log('called init');\r\n return;\r\n }", "init() {\n // No-op by default.\n }", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "function init() {\n\n}", "function init() {\n\n}", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init () {\n}", "function init() {\n \n\n}", "init(){\n \n }", "_setGlobal() {\n if (this.config.setGlobal) {\n window.__ = this.__.bind(this);\n }\n }", "function init() {\n \n}", "function init() {\n \n}", "_initialize() {\n\n }", "static create () {}", "init () {\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }" ]
[ "0.6963825", "0.69429153", "0.6842622", "0.6715281", "0.6628775", "0.6594185", "0.6582743", "0.6558054", "0.646793", "0.6452689", "0.64361656", "0.64344394", "0.6418091", "0.6418091", "0.6418091", "0.6418091", "0.6418091", "0.6418091", "0.6418091", "0.6418091", "0.6418091", "0.6418091", "0.639961", "0.63968587", "0.6383504", "0.6373842", "0.6362906", "0.6362906", "0.6361753", "0.63577545", "0.6338037", "0.63309526", "0.63309526", "0.6299196", "0.6299196", "0.6299196", "0.6299196", "0.6299196", "0.62584656", "0.62584656", "0.6258059", "0.62560284", "0.625293", "0.625293", "0.6232715", "0.6232715", "0.6232715", "0.6232715", "0.6232715", "0.6232715", "0.6232715", "0.6232715", "0.6232715", "0.6232715", "0.6232715", "0.6232715", "0.6232715", "0.62315476", "0.6229854", "0.6210415", "0.6210415", "0.6210415", "0.62096715", "0.6207955", "0.6197986", "0.6197986", "0.6197986", "0.6197986", "0.6197986", "0.6197986", "0.61965114", "0.6186345", "0.6173374", "0.61596507", "0.6155562", "0.6155562", "0.6155562", "0.6152712", "0.61429006", "0.6137384", "0.6137384", "0.6137384", "0.6137384", "0.6137384", "0.6137384", "0.61326504", "0.61326504", "0.61322963", "0.6122856", "0.6119641", "0.61184406", "0.6111162", "0.61018735", "0.61018735", "0.6082888", "0.60799646", "0.60656714", "0.6063317", "0.6063317", "0.6063317", "0.6063317" ]
0.0
-1
Handle user state changes
function onAuthStateChanged(user) { setUser(user); if (initializing) setInitializing(false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function statehandler(key, value) {\n // console.log(\"key:\",key,\"value:\",value)\n // console.log(\"old state:\", user)\n setUser({...user, [key]: value});\n // console.log(\"latest state:\", user)\n }", "function stateMachine() {\n switch($user_state) {\n\tcase $LOGGED_OUT:\n\t if (cookieExists('arduino_sso_authorized')) {\n\t\twindow.location.reload();\n\t }\n\t break;\n\tcase $LOGGED_IN:\n\t if (!cookieExists('arduino_sso_authorized')) {\n\t\t\t\t $user_state = $LOGGED_OUT;\n\t\t ssoGenerateLoginBar();\n\t\t\t }\n\t break;\n }\n}", "updateUser(userObject) {\n this.setState(userObject);\n console.log(\"state changed for user but not propgated \" + this.state.loggedIn);\n \n }", "_onUserUpdated() {\n UserActions.setIsUpdating(false);\n UserActions.setIsRequesting(false);\n }", "function getUserState() {}", "_onChange() {\n this.setState(getUserState());\n }", "function handleUserChangeSuccess() {\n var user = userState.user();\n $scope.userNickname = user ? user.nickname : undefined;\n updateCanShowRootOperations();\n }", "setUser(state, newUser) {\n state.user = newUser;\n }", "updateUserStatus(state) {\n state.userSignUpStatus = \"Sign up Successful!\"\n console.log(state.userSignUpStatus)\n }", "setUserData(state, user){\n console.log(\"[DEUG] setUserData: \", user)\n state.user = user;\n }", "SET_USER(state, user) {\n state.user = user;\n }", "function authStateObserver(user) {\n if (user) { // User is signed in!\n // show the game list\n document.getElementById(\"userID\").innerHTML=getUserName()+\" 님, 안녕하세요.\";\n toggleScreen();\n } else{\n toggleScreen();\n }\n}", "switchUsers() {\n // Get the who is currently active (primary or secondary)\n const primaryActive = this.state.primaryUserActive;\n\n // Swap states to other user only after translation API call finishes\n this.setState({ primaryUserActive: !primaryActive });\n }", "user(state, user) {\n state.user = user;\n }", "function authStateObserver(user) {\n if (user) {\n console.log('hey')\n // User is signed in.\n displayUserAvailable(user);\n $('#userLogSection').hide();\n $('#midSection').show();\n $('#logoutBtn').show();\n $('#loginDropdown').hide();\n $('#dropdownMenu1').hide();\n $('#input-msg').focus();\n } else {\n // No user is signed in. user is signout\n }\n}", "set_user(on) { store.dispatch(hpUser(on)); }", "SET_USER(state, data) {\n state.user = data;\n }", "handleChange(newUser) {\n this.setState({'user': newUser});\n }", "userStatus(state, setState) {\n state.isAuth = setState\n localStorage.setItem('isAuth', JSON.stringify(setState))\n }", "function notify() {\n log.d('viewTree got notified of a change of user!');\n // var viewTreeState = isc.JSON.decode(newState);\n var viewTreeState = user.getLook();\n loginButton.setTitle(user.get()._id);\n if (viewTreeState) {\n //width of side bar\n viewTree.setWidth(viewTreeState.width);\n\t //clear the tree\n\t tree.removeList(tree.getChildren(tree.getRoot()));\n //set the tree to the saved state\n\t tree.linkNodes(viewTreeState.state);\n // log.d('path:::::',viewTreeState.pathOfLeafShowing);\n\t viewTree.setSelectedPaths(viewTreeState.pathOfLeafShowing);\n\t var selRecord = viewTree.getSelectedRecord();\n\t if (selRecord && !selRecord.isFolder) { \n\t open(selRecord);\n\t }\n //not much use because there will be state change\n //callbacks from smartclient to come after this\n\t setTreeModified(false);\n //so set a interval time to see if the state is really\n //different from the stored state and if so setModified to true\n window.setTimeout(checkState, 2000);\n // window.setImmediate(checkState);\n //now any changes made by user will be stored in the\n //leaf and tree when opening up another leaf, when the\n //user saves the tree to the db and when the user\n //navigates away and he gets a chance to mend his ways\n //and to save before leaving.\n\t log.d('finished changing tree state');\n //do an autosave every minute..\n // window.setInterval(autoSave, autoSaveInterval * 60000);\n }\n \n }", "function onUserChange(newname) {\n var id;\n\n username = newname;\n\n items.username = username;\n\n var fn = !!username? loggedin: loggedout;\n for (i=0, len=fn.length; i<len; i++) {\n fn[i](newname);\n }\n }", "setAfterChangeStatus(state, payload) {\n state.items.find(u => u.user_id === payload.user_id).status = payload.status\n }", "function updateAuthState(isUserLoggedIn) {\n //Check if user is logged in\n setUserLoggedIn(isUserLoggedIn);\n }", "function authStateObserver(user) {\n if (user) { // User is signed in!\n // Get the signed-in user's profile pic and name.\n var profilePicUrl = getProfilePicUrl();\n var userName = getUserName();\n\n // Set the user's profile pic and name.\n userPicElement.style.backgroundImage = 'url(' + profilePicUrl + ')';\n userNameElement.textContent = userName;\n\n // Show user's profile and sign-out button.\n userNameElement.removeAttribute('hidden');\n userPicElement.removeAttribute('hidden');\n signOutButtonElement.removeAttribute('hidden');\n\n // Hide sign-in button.\n signInButtonElement.setAttribute('hidden', 'true');\n\n // We save the Firebase Messaging Device token and enable notifications.\n saveMessagingDeviceToken();\n } else { // User is signed out!\n // Hide user's profile and sign-out button.\n userNameElement.setAttribute('hidden', 'true');\n userPicElement.setAttribute('hidden', 'true');\n signOutButtonElement.setAttribute('hidden', 'true');\n\n // Show sign-in button.\n signInButtonElement.removeAttribute('hidden');\n }\n}", "function userInputChanges(e) {\n setUserInput(e.target.value);\n }", "function authStateObserver(user) {\n if (user) { // User is signed in!\n // Get the signed-in user's profile pic and name.\n var profilePicUrl = getProfilePicUrl();\n var userName = getUserName();\n\n // Set the user's profile pic and name.\n userPicElement.style.backgroundImage = 'url(' + addSizeToGoogleProfilePic(profilePicUrl) + ')';\n userNameElement.textContent = userName;\n\n // Show user's profile and sign-out button.\n userNameElement.removeAttribute('hidden');\n userPicElement.removeAttribute('hidden');\n signOutButtonElement.removeAttribute('hidden');\n\n //display the recipe upload form\n containerAddRecipe.removeAttribute('hidden');\n\n // Hide sign-in button.\n signInButtonElement.setAttribute('hidden', 'true');\n\n // We save the Firebase Messaging Device token and enable notifications.\n // saveMessagingDeviceToken();\n } else { // User is signed out!\n // Hide user's profile and sign-out button.\n userNameElement.setAttribute('hidden', 'true');\n userPicElement.setAttribute('hidden', 'true');\n signOutButtonElement.setAttribute('hidden', 'true');\n\n // Show sign-in button.\n signInButtonElement.removeAttribute('hidden');\n }\n}", "function authStateObserver(user) {\n if (user) { // User is signed in\n console.log(\"User signed in\");\n } else { // User is signed out\n window.open('../index.html', \"_self\");\n }\n }", "function authStateObserver(user) {\n if (user) { // User is signed in!\n // Get the signed-in user's profile pic and name.\n var profilePicUrl = getProfilePicUrl();\n var userName = getUserName();\n\n // Set the user's profile pic and name.\n userPicElement.style.backgroundImage = 'url(' + addSizeToGoogleProfilePic(profilePicUrl) + ')';\n userNameElement.textContent = userName;\n\n // Show user's profile and sign-out button.\n userNameElement.removeAttribute('hidden');\n userPicElement.removeAttribute('hidden');\n signOutButtonElement.removeAttribute('hidden');\n\n // Hide sign-in button.\n signInButtonElement.setAttribute('hidden', 'true');\n\n // We save the Firebase Messaging Device token and enable notifications.\n saveMessagingDeviceToken();\n } else { // User is signed out!\n // Hide user's profile and sign-out button.\n userNameElement.setAttribute('hidden', 'true');\n userPicElement.setAttribute('hidden', 'true');\n signOutButtonElement.setAttribute('hidden', 'true');\n\n // Show sign-in button.\n signInButtonElement.removeAttribute('hidden');\n }\n}", "function authStateObserver(user) {\n if (user) { // User is signed in!\n // Get the signed-in user's profile pic and name.\n var profilePicUrl = getProfilePicUrl();\n var userName = getUserName();\n getSubscriptions(userName)\n // Set the user's profile pic and name.\n userPicElement.style.backgroundImage = 'url(' + addSizeToGoogleProfilePic(profilePicUrl) + ')';\n userNameElement.textContent = userName;\n\n // Show user's profile and sign-out button.\n \n\n // Hide sign-in button.\n \n\n // We save the Firebase Messaging Device token and enable notifications.\n saveMessagingDeviceToken();\n } else { // User is signed out!\n // Hide user's profile and sign-out button.\n // userNameElement.setAttribute('hidden', 'true');\n // userPicElement.setAttribute('hidden', 'true');\n // signOutButtonElement.setAttribute('hidden', 'true');\n // window.location.href = \"http://localhost:5000/index.html\"\n window.location.replace( \"http://localhost:5000/index.html\")\n\n // Show sign-in button.\n }\n}", "function authStateObserver(user) {\n if (user) { // User is signed in!\n // Get the signed-in user's profile pic and name.\n var profilePicUrl = getProfilePicUrl();\n var userName = getUserName();\n\n // Set the user's profile pic and name.\n userPicElement.style.backgroundImage = 'url(' + profilePicUrl + ')';\n userNameElement.textContent = userName;\n\n // Show user's profile and sign-out button.\n userNameElement.removeAttribute('hidden');\n userPicElement.removeAttribute('hidden');\n signOutButtonElement.removeAttribute('hidden');\n\n // Hide sign-in button.\n signInButtonElement.setAttribute('hidden', 'true');\n } else { // User is signed out!\n // Hide user's profile and sign-out button.\n userNameElement.setAttribute('hidden', 'true');\n userPicElement.setAttribute('hidden', 'true');\n signOutButtonElement.setAttribute('hidden', 'true');\n\n // Show sign-in button.\n signInButtonElement.removeAttribute('hidden');\n }\n}", "function authStateObserver(user) {\n if (user) { // User is signed in!\n // Get the signed-in user's profile pic and name.\n var profilePicUrl = getProfilePicUrl();\n var userName = getUserName();\n\n // Set the user's profile pic and name.\n userPicElement.style.backgroundImage = 'url(' + profilePicUrl + ')';\n userNameElement.textContent = userName;\n\n // Show user's profile and sign-out button.\n userNameElement.removeAttribute('hidden');\n userPicElement.removeAttribute('hidden');\n signOutButtonElement.removeAttribute('hidden');\n\n // Hide sign-in button.\n signInButtonElement.setAttribute('hidden', 'true');\n\n } else { // User is signed out!\n // Hide user's profile and sign-out button.\n userNameElement.setAttribute('hidden', 'true');\n userPicElement.setAttribute('hidden', 'true');\n signOutButtonElement.setAttribute('hidden', 'true');\n\n // Show sign-in button.\n signInButtonElement.removeAttribute('hidden');\n }\n}", "handleUserInput(obj){\n \tthis.setState(obj);\n }", "setUser (state, user) {\n state.user = user\n }", "_onChangeState() {\n\n\n }", "stateChange(state){\n\t\tLogger.info(`Ably realtime state changed to: ${state.current}`);\n\t}", "handleUpdateUserUsers(requestData) {\r\n if(this.state[requestData.username]) {\r\n requestData.permissionLevel = this.state[requestData.username]\r\n }\r\n this.props.onUpdateUserUsers(requestData);\r\n }", "function authStateChangeListener(user) {\n //signin\n if (user) {\n //login\n firebaseChildAdded();\n firebaseChildRemoved();\n $(\"#login-link\").addClass('hide');\n $(\"#logout-link\").removeClass('hide');\n $('#favorite').fadeIn();\n if (user.displayName !== null) {\n $(\"#user-name\").html(\", \" + user.displayName);\n }\n } else {\n //not login\n $('#fav-field').html(\"\");\n $(\"#login-link\").removeClass('hide');\n $(\"#logout-link\").addClass('hide');\n $('#favorite').fadeOut();\n $(\"#user-name\").empty();\n }\n }", "function onAuthStateChanged(user) {\n\t\tsetUser(user);\n\t\tif (initializing) setInitializing(false);\n\t\tconsole.log(user);\n\t}", "function setApplicationState( state ){\n console.log(\"Setting APPLICATION STATE to: \" + state );\n switch ( state ){\n \n case ApplicationState.LOGGED_IN:\n currentApplicationState = ApplicationState.LOGGED_IN;\n $(\"#signinLink\").css(\"display\", \"none\");\n \t$(\"#registerLink\").css(\"display\", \"none\");\n \t$(\"#usernameLink\").css(\"display\", \"inline\");\n \t$(\"#logoutLink\").css(\"display\", \"inline\");\n \tsetDrawerState( DrawerState.CLOSED );\n break;\n \n case ApplicationState.LOGGED_OUT:\n currentApplicationState = ApplicationState.LOGGED_OUT;\n $(\"#signinLink\").css(\"display\", \"inline\");\n \t$(\"#registerLink\").css(\"display\", \"inline\");\n \t$(\"#usernameLink\").css(\"display\", \"none\");\n \t$(\"#logoutLink\").css(\"display\", \"none\");\n \t//TweenMax.to( $(\"body\"), 1, { scrollTop:1 , ease:TARGET_EASE, overwrite:2 } );\n \tsetDrawerState( DrawerState.CLOSED );\n break;\n \n default:\n console.log(\"APPLICATION STATE: \" + state + \" is invalid\");\n break;\n }\n \n}", "function authStateObserver(user) {\n if (user) { // User is signed in!\n // Get the signed-in user's profile pic and name.\n var profilePicUrl = getProfilePicUrl();\n var userName = getUserName();\n\n // Set the user's profile pic and name.\n userPicElement.style.backgroundImage = 'url(' + addSizeToGoogleProfilePic(profilePicUrl) + ')';\n userNameElement.textContent = userName;\n\n // Show user's profile and sign-out button.\n userNameElement.removeAttribute('hidden');\n userPicElement.removeAttribute('hidden');\n signOutButtonElement.removeAttribute('hidden');\n\n // Hide sign-in button.\n signInButtonElement.setAttribute('hidden', 'true');\n\n } else { // User is signed out!\n // Hide user's profile and sign-out button.\n userNameElement.setAttribute('hidden', 'true');\n userPicElement.setAttribute('hidden', 'true');\n signOutButtonElement.setAttribute('hidden', 'true');\n\n // Show sign-in button.\n signInButtonElement.removeAttribute('hidden');\n }\n}", "function authStateObserver(user) {\n if (user) { // User is signed in!\n // Get the signed-in user's profile pic and name.\n var profilePicUrl = getProfilePicUrl();\n var userName = getUserName();\n\n // Set the user's profile pic and name.\n userPicElement.style.backgroundImage = 'url(' + addSizeToGoogleProfilePic(profilePicUrl) + ')';\n userNameElement.textContent = userName;\n\n // Show user's profile and sign-out button.\n userNameElement.removeAttribute('hidden');\n userPicElement.removeAttribute('hidden');\n signOutButtonElement.removeAttribute('hidden');\n\n // Hide sign-in button.\n signInButtonElement.setAttribute('hidden', 'true');\n\n } else { // User is signed out!\n // Hide user's profile and sign-out button.\n userNameElement.setAttribute('hidden', 'true');\n userPicElement.setAttribute('hidden', 'true');\n signOutButtonElement.setAttribute('hidden', 'true');\n\n // Show sign-in button.\n signInButtonElement.removeAttribute('hidden');\n }\n}", "function onAuthStateChanged(user) { \n setUser(user);\n if (initializing) setInitializing(false);\n }", "stateChanged(state) {\n this._name = state.profile.name;\n this._position = state.profile.position;\n this._skill = state.profile.skill;\n this._saved = state.profile.saved;\n }", "function authStateObserver(user) {\n if (user) { // User is signed in\n // load data\n loadEventData();\n loadPatientData();\n } else { // User is signed out\n window.open('../index.html', \"_self\");\n }\n}", "stateChanged(state) { }", "switchUser(obj) {\n this.setState({ user: obj });\n }", "function onAuthStateChanged(usr) {\n setUser(usr);\n if (initilizing) setInitilizing(false);\n }", "stateChanged(state) {\n let subpageObj = state.app.page.subpage;\n this._subpage = subpageObj ? subpageObj.name : \"\";\n this._authenticated = state.admin.authStatus;\n this._authRes = state.admin.actionResults.auth;\n }", "function handleUserUpdate(user) {\n // handle reachability indicator\n if (ipMessagingClient.reachabilityEnabled) {\n // call a function which will update the relevant UI elements to show the Reachability state for the User\n renderUserReachability(user.online, user.notifiable);\n }\n}", "function authStateObserver(user) {\n if (user) { // User is signed in!\n // Get the signed-in user's profile pic and name.\n var profilePicUrl = getProfilePicUrl();\n var userName = getUserName();\n\n // Display add buttons if user logged in\n if (addResourceBtn) addResourceBtn.style.display = \"block\";\n if (addSpaceBtn) addSpaceBtn.style.display = \"block\";\n if (addCollectionBtn) addCollectionBtn.style.display = \"block\";\n\n // Set the user's profile pic and name.\n userPicElement.style.backgroundImage = 'url(' + addSizeToGoogleProfilePic(profilePicUrl) + ')';\n userNameElement.textContent = userName;\n\n // Show user's profile and sign-out button.\n userNameElement.removeAttribute('hidden');\n userPicElement.removeAttribute('hidden');\n signOutButtonElement.removeAttribute('hidden');\n\n // Hide sign-in button.\n signInButtonElement.setAttribute('hidden', 'true');\n\n if (window.location.href.indexOf(\"space\") > -1) {\n // on a space page so therefore messaging functonality\n // We save the Firebase Messaging Device token and enable notifications.\n saveMessagingDeviceToken();\n\n } else {\n // on a resource page so therefore commenting functionality\n // We save the Firebase Commenting Device token and enable notifications.\n saveCommentingDeviceToken();\n }\n\n } else { // User is signed out!\n if (userNameElement) {\n // Hide user's profile and sign-out button.\n userNameElement.setAttribute('hidden', 'true');\n userPicElement.setAttribute('hidden', 'true');\n signOutButtonElement.setAttribute('hidden', 'true');\n\n // Show sign-in button.\n signInButtonElement.removeAttribute('hidden');\n }\n }\n}", "function addStateToUserObject () {\n\t\tme.subscribe(\"ready\", \"User self-subscription\", function(){\n\t\t\tuser.signedin = signedin;\n\t\t}).runAsap(function(){\n\t\t\tuser.signedin = signedin;\n\t\t});\n\t}", "stateChanged(_state) { }", "function onAuthStateChanged(user) {\n setUser(user);\n //console.log(user)\n if (initializing) setInitializing(false);\n return(user)\n }", "auth_user_data(state, user){\n state.auth_user = user\n }", "function handleLoggedIn(value) {\n\t\tchangeIsLoggedIn(value);\n\t}", "changeUser(event) {\n const field = event.target.name;\n const user = this.state.user;\n user[field] = event.target.value;\n \n // if change email field, user['email'] will be changed\n // if change password field, user['password'] will be changed\n // if change confirm_password field, user['confirm_password'] will be changed\n\n this.setState({user});\n\n if (this.state.user.password !== this.state.user.confirm_password) {\n const errors = this.state.errors;\n errors.password = \"Password and Confirm Password don't watch\";\n this.setState({errors}); // refresh UI and state\n } else {\n const errors = this.state.errors;\n errors.password = '';\n this.setState({errors});\n }\n }", "function handleStatusChange(response) {\n\t\t document.body.className = response.authResponse ? 'connected' : 'not_connected';\n\t\t if (response.authResponse) {\n\t\t console.log(response);\n\t\t\n\t\t updateUserInfo(response);\n\t\t };\n\t\t }", "[Type.CHANGE_USER_INFO](state, payload) {\n state.userInfo = payload\n }", "changeUserForNewRole(event){\n\t\tconst selectedIndex = event.target.options.selectedIndex;\n\t\tlet userId = event.target.options[selectedIndex].getAttribute('data-key');\n\t\tthis.state.changeUser = userId\n\t\tthis.setState({\n\t\t\tchangeUser: this.state.changeUser\n\t\t})\n\t\tconsole.log(this.state.changeUser)\n\t}", "function updateUserState(sender, userStates){\n if (sender in userStates) { //obj.hasOwnProperty(\"key\") // true\n if (userStates[sender]<COMPLETE) {\n userStates[sender] = userStates[sender]+1;\n } else {\n userStates[sender] = INITIAL;\n }\n return userStates[sender];\n }\n else {\n userStates.sender = 0;\n return 0;\n }\n}", "updateUser (field, newValue) {\n this.state[field] = newValue\n this.setState(this.state)\n }", "_changeUsername(evt) {\n var newState = this._mergeWithCurrentState({\n username: evt.target.value\n });\n\n this._emitChange(newState);\n }", "onStateChange() {\n\t\t// brute force update entire UI on store change to keep demo app simple\n\t\tthis.forceUpdate();\n\t}", "function authStateObserver(user) {\n if (user) { // User is signed in!\n // Get the signed-in user's profile pic and name.\n document.getElementById(\"userID\").innerHTML = getUserName();\n } else { // User is signed out!\n location.href=\"/index.html\";\n }\n}", "handle() {\n if(!this.enabled)\n return;\n\n Object.assign(this.previousState, this.state); // Save the previous state\n this.update(); // Update the current state\n this.notify();\n }", "function onAuthStateChanged(user) {\n setUser(user);\n if (initializing) setInitializing(false);\n }", "function onAuthStateChanged(user) {\n setUser(user);\n if (initializing) setInitializing(false);\n }", "function onAuthStateChanged(user) {\n setUser(user);\n if (initializing) setInitializing(false);\n }", "function onAuthStateChanged(user) {\n setUser(user);\n if (initializing) setInitializing(false);\n }", "function onAuthStateChanged(user) {\n setUser(user);\n if (initializing) setInitializing(false);\n }", "function onAuthStateChanged(user) {\n setUser(user);\n if (initializing) setInitializing(false);\n }", "function onAuthStateChanged(user) {\n setUser(user);\n if (initializing) setInitializing(false);\n }", "function onAuthStateChanged(user) {\n setUser(user);\n if (initializing) setInitializing(false);\n }", "function onAuthStateChanged(user) {\n setUser(user);\n if (initializing) setInitializing(false);\n }", "SET_USER(state, data) {\n state.user.data = data;\n }", "function onAuthStateChanged(user) {\n setUser(user);\n\n if (initializing) setInitializing(false);\n }", "function handleOnChange(event) {\n //event.target.name hold the name of the input that changed\n //event.target.value hold the new value of the input field that changed\n\n //we update the user state with the new value\n setState({\n ...state,\n [event.target.name]: event.target.value,\n });\n }", "authUser (state, userData) {\n \t\tstate.idToken = userData.token\n \t\tstate.userId = userData.userId\n \t}", "onUpdated() {\n this.setState({editDialogOpen: false});\n\n this.fetchUser();\n }", "function authUser() {\n FB.Event.subscribe('auth.statusChange', handleStatusChange);\n}", "set(state, user) {\n state.isLogged = true\n state.isAdmin = user.role === 'admin'\n state.isRoot = user.name === 'root'\n state.id = user.id\n state.name = user.name\n state.role = user.role\n state.description = user.description\n state.groupIds = user.groupIds\n }", "function defaultActiveStateChangeHandler(state) {\n ActiveStore.updateState(state);\n}", "function onAuthStateChanged(user) {\n setUser(user);\n if (initializing) setInitializing(false);\n }", "function respondToState(){\n\t\t_oldUrl = _currentUrl;\n\t\tif(_useAPI) _currentUrl = cleanUrl(window.location.pathname || \"\");\n\t\telse _currentUrl = cleanUrl(window.location.hash || \"\");\n\t\t//Remove slash in beginning\n\t\tif(_currentUrl == \"/\") _currentUrl = \"\";\n\t\telse if(_currentUrl.indexOf(\"/\") == 0) _currentUrl = _currentUrl.substr(1);\n\t\t//Add slash in end\n\t\tif(_currentUrl.substr(_currentUrl.length-1) != \"/\") _currentUrl = _currentUrl+\"/\";\n\t\tif(_allowCookies || _firstTime) track(); //Track first page. After that only when cookies have been accepted.\n\t\tsetCanonical();\n\t\treadParameters();\n\t\tif(!_firstTime && _oldUrl == _currentUrl){\n\t\t\t//console.log(\"Same url firing statechange\", _oldUrl);\n\t\t\twindow.dispatchEvent(GLBCustomEvent(\"subPageChange\", 0));\n\t\t\treturn;\n\t\t}\n\t\t_firstTime = false;\n\t\tsetTitle();\n\t\t//Pages listening can animIn/Out\n\t\twindow.dispatchEvent(GLBCustomEvent(\"pageChange\", 0));\n\t}", "saveChanges(){\n\t\tthis.state.users[this.state.changeUser].role = this.state.changeNewRole;\n\t\tthis.setState({\n\t\t\tusers: this.state.users\n\t\t})\n\t\talert('All is Okay!!!');\n\t}", "onUserEditEnd(user) {\n const action = this.state.editUser\n ? {\n type: userActions.USER_REPLACE,\n oldUser: this.state.editUser,\n newUser: user\n }\n : {\n type: userActions.USER_ADD,\n user: user\n };\n this._userStore.getDispatcher().dispatch(action);\n this.setState({ editUser: null, editedUser: null });\n }", "stateUpdate() {\n this.handlestateVariable();\n this.handlestateVariable2();\n this.handleCChange();\n this.handleAChange();\n this.handleidCapture();\n this.handleimgCapture();\n this.handleConfigChange();\n this.idcaptureVal();\n this.imgcaptureVal();\n }", "changeUser(user, event) {\n event.stopPropagation();\n this.setState({changingUserID: user.id});\n this.props.changeActiveUser(user, () => {\n this.setState({dropdownOpen: false, changingUserID: null});\n });\n }", "changeUser(event){\n // get the current value\n const field = event.target.name;\n const user = this.state.user;\n user[field] = event.target.value;\n //setState\n this.setState({user: user});\n // handle error, password === confirm_password\n if(this.state.user['password'] !== this.state.user['confirm_password']){\n let errors = this.state.errors;\n errors.password = 'Do NOT match. Try Again.'\n this.setState({errors: errors});\n }else{\n let errors = this.state.errors;\n errors.password = '';\n this.setState({errors: errors});\n }\n \n }", "applyHumidityChange(){\n userDB.changeWantedHumidity(this.state.humidity, this.props.userID);\n }", "changeUsername(event) {\n var newState = this.mergeWithCurrentState({\n username: event.target.value\n });\n\n this.emitChange(newState);\n }", "validateUserSession() {\n // if (sessionStorage.getItem('isLoggedIn') === 'true') {\n // this.props.loggedInStatusChanged(true);\n // } else {\n // this.props.loggedInStatusChanged(false);\n // }\n }", "appDefaultState(userLogged) {\n this.setState({\n user: userLogged\n });\n }", "function HandleStateChange(newState) {\n\tconsole.log(newState);\n\tif (newState === \"idle\") {\n\t\tfinalizeTimeStamps(currActiveTab);\n\t\tcurrActiveTab = null;\n\t}\n\tif (newState === \"active\") {\n\t\tupdateCurrentActiveTab();\n\t}\n}", "handleUserChange(event){\n this.setState({filterUsername:event.target.value});\n }", "currentUser(state, user) {\n state.currentUser = user;\n }", "function onAuthStateChanged(user) {\n setUser(user);\n if (initializing) setInitializing(false);\n }", "setUsers(state, users) { // set user value in state\n state.users = users;\n }", "onUserChange(event) {\n this.setState({\n currentUser: { name: event.target.value }\n });\n }", "handleUpdatedState(state) {\n this.lastTechnology = state.selectedTechnology;\n this.totalClicks = state.clickCounter;\n }" ]
[ "0.7448602", "0.73665667", "0.7005272", "0.6983008", "0.69212097", "0.6780984", "0.6730604", "0.6626575", "0.6606931", "0.65943164", "0.6591656", "0.6558265", "0.655247", "0.6544371", "0.6539095", "0.65347517", "0.6518152", "0.6498631", "0.64925826", "0.6410299", "0.6388828", "0.6357496", "0.63569987", "0.6332332", "0.63261336", "0.63198876", "0.6307036", "0.630429", "0.62905717", "0.6284018", "0.62797207", "0.6274621", "0.627251", "0.6253232", "0.62493145", "0.624877", "0.62487376", "0.6245178", "0.6240657", "0.62175596", "0.62175596", "0.62115073", "0.6210987", "0.6181497", "0.6176366", "0.61747724", "0.6156867", "0.61560464", "0.6152941", "0.61522925", "0.6150068", "0.6149292", "0.614908", "0.6137228", "0.61364275", "0.6128718", "0.6127634", "0.6122271", "0.6120508", "0.6115585", "0.61100525", "0.61091423", "0.61058277", "0.6095008", "0.6086911", "0.6082223", "0.6082223", "0.6082223", "0.6082223", "0.6082223", "0.6082223", "0.6082223", "0.6082223", "0.6082223", "0.6076583", "0.6066128", "0.6047933", "0.60458434", "0.6044866", "0.6044149", "0.60431474", "0.604292", "0.60422164", "0.6034788", "0.6029144", "0.6027991", "0.602786", "0.60261565", "0.6017504", "0.60139555", "0.6008813", "0.60057175", "0.6004487", "0.60025316", "0.6002368", "0.5993303", "0.59928626", "0.59847075", "0.59821516", "0.59802824" ]
0.5993509
95
HomeContent Retrieve resources via api
function home_searchResources(criteria, containerId) { mibo.util.loading.show(); var data = {}; data.token = mibo.config.TOKEN; data.offset = criteria.offset || 0; data.limit = criteria.limit || 10; data.keyword = criteria.keyword || null; data.order = criteria.order || null; var ajp = mibo.util.http.post(mibo.config.API + 'resource/fetch', data); mibo.promiseq.admin_resource_fetch = ajp; ajp.done(function (data, status, ajXhr) { console.log('data', data); // Construct resource tbody if (data.response.status != 'success') { mibo.util.loading.hide(); mibo.util.system.error(data.response.message); return; } var resourceTBody = $('#' + containerId).empty(), html; if (data.response.data.totalRowCount == 0) { $('<tr><td><p>There is no result based on your search keyword...</p></td></tr>').appendTo(resourceTBody); stikyFooter(); mibo.util.loading.hide(); return; } for (var p in data.response.data.rows) { html = []; html.push('<tr id="', data.response.data.rows[p]['id'], '">'); html.push('<td class="tbl-col-img">'); html.push('<img class="img-icon" src="', decodeURIComponent(data.response.data.rows[p]['poster_link']), '">'); html.push('</td>'); html.push('<td class="tbl-col-author">'); html.push('<p class="td-row">', data.response.data.rows[p]['name'], '</p>'); html.push('<p class="td-row">', data.response.data.rows[p]['author'], '</p>'); html.push('</td>'); html.push('<td class="tbl-col-time">'); html.push('<p class="td-row">', data.response.data.rows[p]['produce_time'], '</p>'); html.push('<p class="td-row">', '<i class="fa fa-eye" aria-hidden="true"></i>', mibo.util.format.number2kview(data.response.data.rows[p]['views']), '</p>'); html.push('</td>'); html.push('<td>', data.response.data.rows[p]['description'], '</td>'); html.push('</tr>'); $(html.join('')).data(data.response.data.rows[p]).appendTo(resourceTBody); } home_attachResourceEvent(); // Stiky footer stikyFooter(); mibo.util.loading.hide(); }).fail(function () { mibo.util.system.error(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "fetch () {\n this._makeRequest('GET', resources);\n }", "function index() {\n\n return resource.fetch()\n .then(function(data){ return data; });\n }", "getList() { return this.api(); }", "async home() {\n const resp = await api.get(`/home`)\n\n return resp\n }", "getall(){\nreturn this.get(Config.API_URL + Constant.AGENT_GETALL);\n}", "fetchContent() {\n Axios.jsonp(\n `${CONTENT_PATH}${startIndex_param}${startIndex}&${count_param}${count}`\n )\n .then(res => {\n this.setContent(res);\n\n this.fetchComments(res);\n })\n .catch(err => {\n console.log(err);\n });\n }", "getAllData() {\n this.aboutServices.get().subscribe(res => {\n this.about.content = Object.values(res)[2].content;\n });\n }", "async function getHomePage() {\n return prismicClient.getSingle(\"homepage\")\n .then(document => {\n const data = document.data;\n return {\n status: \"ok\",\n title: RichText.asText(data.title),\n description: RichText.asText(data.description),\n reactjsLogo: data.reactjs_logo,\n prismicLogo: data.prismic_logo,\n featuresIntro: RichText.asText(data.features_intro),\n features: data.body.map(slice => ({\n name: RichText.asText(slice.primary.feature_name),\n description: RichText.asText(slice.primary.feature_description)\n }))\n };\n })\n .catch(error => buildErrorObject(error));\n}", "getAll() {\n return fetch(API_URL + '?api-key=' + API_KEY + '&show-fields=trailText,thumbnail')\n .then(response => response.json())\n .then(res => res.response && res.response.results)\n }", "getAllPosts() {\n return this.storyapi\n .get('cdn/stories', {\n starts_with: 'posts/',\n version,\n })\n .catch((error) => console.log(error));\n }", "getAll() {\n let urlFull = this.controler;\n return BaseAPIConfig.get(urlFull);\n }", "list() {\n\t\tconst query = objectToQuery({ prefix: this.objectPath, delimiter: '/' });\n\t\treturn this.fetch(`${baseApiURL}b/${this.bucket}/o${query}`);\n\t}", "getAll(resource) {\n const url = `${baseUrl}/${resource}/`\n return this.fetchFactory(url)\n }", "getPublicContent () {\n return axios.get(API_URL + 'api/public/get_default_rooms')\n }", "getAll() {\n return Resource.get(this).resource('SupplierCompany:getAll')\n .then((res) => {\n this.companies = res;\n });\n }", "function getEpisodes() {\n let api = \"../api/Episodes/Admin\";\n\n ajaxCall(\"GET\", api, \"\", getEpisodesSuccessCB, getErrorCB);\n}", "function getList() {\n return request(`/WebApi/menu/getlist`);\n}", "fetchSuppliers(){\r\n return Api().get('/suppliers')\r\n }", "fetchItems(){\n\t\tfetch(Constants.restApiPath+'items')\n\t\t.then(function(res){\n\t\t\tif(res.ok){\n\t\t\t\tres.json().then(function(res){\n\t\t\t\t\tdispatcher.dispatch({\n\t\t\t\t\t\ttype: \t\"FETCH_ITEMS_FROM_API\",\n\t\t\t\t\t\tres,\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t}\n\t\t\telse{\n\t\t\t\tconsole.log(Strings.error.restApi);\n\t\t\t\tconsole.log(res);\n\t\t\t}\n\t\t});\n\t}", "async index(req, res) {\n const alunos = await _Aluno2.default.findAll({\n attributes: ['id', 'nome', 'sobrenome', 'email', 'idade', 'peso', 'altura'],\n order: [['id', 'DESC'], [_Foto2.default, 'id', 'DESC']],\n include: [{\n model: _Foto2.default,\n attributes: ['id', 'name', 'key', 'url'],\n }],\n });\n return res.json(alunos);\n }", "static fetchModels()\n {\n const webapi_endpoint = WebAPI.webapi_endpoint;\n let url = webapi_endpoint + WebAPI.urls.fetchModels;\n return fetch(\n url, \n {\n method: 'GET',\n headers: WebAPI.headers\n }\n );\n }", "async getPublicContent() {\n // return axios.get(API_URL);\n const response = await fetch(`${API_URL}`, {\n method: \"GET\" // requires NO authorization header\n });\n if (response.ok) {\n let data = await response.json();\n // console.log(\"USER SERVICE - fetch WELCOMING MESSAGE\")\n // console.log(data) // data = \"Welcome to the TUTORIALS api\"\n return data;\n }\n else\n throw Error(handleResponses(response.status));\n }", "function fetchHome(dispatch) {\n dispatch(setLoading(true))\n return getHomepageFeed()\n .then((response) => {\n dispatch(setLoading(false))\n return handleResponse(response)\n })\n .then((result) => {\n dispatch(receiveVideoData([...result.featured, ...result.recent]))\n dispatch(receiveHomepageData(result))\n })\n}", "list(request, response, next) {\n SiteModel.find(\n (error, siteDocs) => {\n const sites = siteDocs.reduce((previous, site) => {\n previous[site.title] = site.data;\n return previous;\n }, {});\n response.json({sites});\n }\n );\n }", "list(id) {\n const params = new Array();\n if (id != null) {\n params.push(`id=${id}`);\n }\n return this.rest.get(`${this.baseUrl}/list`, ...params);\n }", "list(id) {\n const params = new Array();\n if (id != null) {\n params.push(`id=${id}`);\n }\n return this.rest.get(`${this.baseUrl}/list`, ...params);\n }", "function getAllProducts() {\n fetch(\n \"http://mazurmazurmazur.pl/simbiocms/?rest_route=/wp/v2/article/\" +\n dynamicContent\n ) //only one entry in json file (WP REST)\n .then(res => res.json())\n .then(showProducts);\n}", "function getHome(request, response){\n var findPopularArticles = function getPopularArticles() {\n return new Promise((resolve, reject) => {\n // get 5 most popular articles\n Home.findMostViewed(5, (err, data) => {\n if (err) {\n if (err.kind === \"not_found\") {\n reject(`Not found popular articles`);\n } else {\n reject(\"Error retrieving popular articles\");\n }\n }\n else {\n resolve(data);\n }\n })\n })\n }\n var findTopFeatured = function getTopFeatured() {\n return new Promise((resolve, reject) => {\n Home.findRecentFeatured((err, data) => {\n if (err) {\n if (err.kind === \"not_found\") {\n reject(`Not found recent featured`);\n } else {\n reject(\"Error retrieving recent featured\");\n }\n }\n else {\n resolve(data);\n }\n })\n })\n }\n var findOtherArticles = function getOtherArticles(featuredEntry) {\n return new Promise((resolve, reject) => {\n Home.findRecentArticles(featuredEntry, (err, data) => {\n if (err) {\n if (err.kind === \"not_found\") {\n reject(`Not found recent articles`);\n } else {\n reject(\"Error retrieving recent articles\");\n }\n }\n else {\n resolve(data);\n }\n })\n })\n }\n findPopularArticles().then(popularArticles => {\n findTopFeatured().then(featuredArticle => {\n findOtherArticles(featuredArticle.articleid).then(otherArticles => {\n var buildArticle = function buildArticle(articleEntry){\n let hasPhoto = (articleEntry.photoFilename) ? true : false;\n article_to_add = {\n articleImage: `/images/images/${articleEntry.photoFilename}`,\n articleTitle: articleEntry.headline,\n articleLink: `/article/${articleEntry.articleid}`,\n articleCategory: articleEntry.section,\n articleBlurb: articleEntry.teaser,\n hasPhoto: hasPhoto\n }\n return article_to_add;\n }\n let mostViewedArticles = popularArticles.map(buildArticle);\n let listArticles = otherArticles.map(buildArticle);\n let featuredPic = `/images/images/${featuredArticle.photoFilename}`;\n let hasFeaturedPic = (featuredArticle.photoFilename) ? true : false;\n let featuredTitle = featuredArticle.headline;\n let featuredCategory = featuredArticle.section;\n let featuredBlurb = featuredArticle.teaser;\n let featuredLink = `/article/${featuredArticle.articleid}`;\n \n response.render('home', {\n title: 'Home',\n featuredPic: featuredPic,\n hasFeaturedPic: hasFeaturedPic,\n featuredTitle: featuredTitle,\n featuredCategory: featuredCategory,\n featuredBlurb: featuredBlurb,\n featuredLink: featuredLink,\n listArticles: listArticles,\n mostViewedArticles: mostViewedArticles\n });\n })\n \n })\n })\n \n}", "function getAll() {\n return $http.get(this.apiUrl).then(successCallback, erroCallback);\n }", "getAll(req, res) {\n // Blank .find param gets all\n Assembly.find({})\n .then(Assemblies => res.json(Assemblies))\n .catch(err => res.status(400).json(err))\n }", "function fetchStaffs(req, res){\n var resources;\n resources = {\n 'contents' : \n [\n {\n 'id': 1,\n 'name': 'Mr. A',\n 'email': '[email protected]',\n 'security_role': 'practitioner',\n 'status': 0\n },\n {\n 'id': 2,\n 'name': 'Mr. B',\n 'email': '[email protected]',\n 'security_role': 'user',\n 'status': 1\n }\n ],\n 'actions': {\n 'canEdit': {url: '/#/staff/edit/'},\n 'canCreate': {url: '/#/staff/create/'}\n }\n };\n return resources;\n}", "fetchData() {\n this.initLoading();\n this.setAndGetInstanceFromSandBox(this.view, this.qs_url).then(instance => {\n this.setLoadingSuccessful();\n this.data.instance = instance;\n }).catch(error => {\n this.setLoadingError(error);\n debugger;\n });\n\n this.getParentInstancesForPath();\n }", "getJournalEntries () {\r\n return fetch(\"http://localhost:3000/journalEntries?_expand=mood\").then(jsonData => jsonData.json())\r\n }", "get() {\n return $.ajax({\n type: 'GET',\n url: `${apiUrl}/entries`,\n dataType: 'json',\n headers: { 'Authorization': 'Bearer ' + (tokens && tokens.accessToken) },\n });\n }", "async function getList() {\n const response = await fetch(`${ROOT_URL}`);\n return response.json();\n}", "getReleavantApis(category, qty = 3) {\n axios\n .get(`${apiBaseUrl}/entries?category=${category}`)\n .then((res) => {\n this.releavantApis = res.data.entries.slice(0, qty);\n this.show = true;\n })\n .catch(error =>\n console.error(\"Can't get the APIs\", error)\n );\n }", "function getFromApiAndRender(req, res) {\n const url = 'https://thesimpsonsquoteapi.glitch.me/quotes?count=10'\n superagent.get(url).set('User-Agent', '1.0').then(results => {\n const quotesApi = results.body.map(obj => new Quote(obj))\n // console.log(quotes);\n res.render('pages/index', {quotes:quotesApi })\n\n })\n // const quotesApi = results.map(obj => new Quote(obj))\n // res.render('pages/index', {quotes: quotesApi})\n \n}", "getMenu() {\n return new Promise((resolve, reject) => {\n const request = new XMLHttpRequest();\n request.addEventListener(\"load\", () => {\n /* validate request status */\n if (request.status == 200)\n return resolve(new ApiResponse(JSON.parse(request.responseText), request.status));\n reject(new ApiError(request.statusText, request.status));\n }, false);\n request.addEventListener(\"error\", () => {\n reject(new ApiError(request.statusText, request.status));\n }, false);\n request.open('GET', ENDPOINT.concat(\"/menu\"));\n request.send();\n });\n }", "all(parent, includeChildren) {\n\t\treturn this.$http.get(`${this.path()}${includeChildren ? \"?include_children\" : \"\"}`, {\n\t\t\tparams: {\n\t\t\t\tparent\n\t\t\t},\n\t\t\tcache: includeChildren ? false : this.cache\n\t\t}).then(response => response.data);\n\t}", "list() {\n this._followRelService(\"list\", \"List\");\n }", "retriveHomeBanner(context) {\n\t\t\taxios.get(\"/banner\"\n\t\t\t).then((res) => {\n\t\t\t\tcontext.commit('RETRIVE_HOME_BANNER', res.data.data);\n\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tconsole.log(error);\n\t\t\t\t});\n\t\t}", "getAll(request, response, next) {\n this.model.find({}, (err, data) => {\n if (err) {\n return next(err);\n }\n response.json(data);\n });\n }", "function GETAll (app) {\n return app.$axios.$get(\n 'oferta'\n ).then(oferta => {\n return imagecontroller.GETAll(app).then(imagen => {\n let imagenes = {}\n oferta.data.forEach(offer => {\n imagenes[offer.IDEN_PUBLICACION] = imagen.imagen.data.find(img => img.IDEN_PUBLICACION === offer.IDEN_PUBLICACION)\n })\n return {\n offers: oferta.data,\n images: imagenes\n }\n })\n }).catch(errors => {\n console.log(errors)\n })\n}", "getArticles () {\n console.log('in get articles server_api')\n let self = this\n Article.find(function (err, articles) {\n if (err) {\n self.res.send(err)\n }\n self.res.send(articles)\n })\n }", "function getContent(data){\n\tvar pageIDs = Object.getOwnPropertyNames(data.query.pages);\n\tfor(var i = 0; i < pageIDs.length; i++){\n\t\t$(\".searchResults\").append(\"<div class=results><h3><a href='\" + articleURL + pageIDs[i] + \"' target='_blank'>\" + data.query.pages[pageIDs[i]].title + \"</a></h3><p>\" + data.query.pages[pageIDs[i]].extract + \"</p></div>\");\n\t}\n}", "getAll() {\n return this.getDataFromServer(this.path);\n }", "getAllPosts() {\n return this.http.get(\"http://localhost:8080/api/posts\");\n }", "getRefferalAndAngentList(){\nreturn this.get(Config.API_URL + Constant.REFFERAL_GETREFFERALANDANGENTLIST);\n}", "function getAllProjectAPI(){\n\t\n\tvar userId = document.getElementById(\"uId\").value;\n\t\n\tfetch(path+\"/getAllProjectDashboard/\"+userId,{\n\t\t\n\t\tmethod: \"GET\",\n\t headers: {\n\t \"Content-Type\": \"application/json\",\n\t },\n\t\t\n\t})\n\t.then((response)=>response.json())\n\t.then((projects)=>{\n\t\tconsole.log(\"successfully fecth all data\", projects);\n\t\tif(projects){\n\t\t\tpopulateProject(projects);\n\t\t}\n\t})\n\t.then((error)=>{\n\t\t\n\t\treturn null;\n\t\t\n\t});\n\t\n}", "static all() {\n return request.get(`cards/all`);\n }", "get() {\n return $.ajax({\n type: 'GET',\n url: `${apiUrl}/entries`,\n dataType: 'json'\n });\n\t\t}", "fetchResourceList(context) {\n\t\t\tfetch(`${process.env.VUE_APP_API_URL}/v1/tool`, { method: `GET` }) //=> Fetch API\n\t\t\t\t.then(response => !response.ok ? console.log(response) : response.json(response)) //=> Check response\n\t\t\t\t.then(async (apiResponse) => await context.commit(`RESOURCELIST`, { data: apiResponse.data })) //=> Commit changes\n\t\t\t\t.catch(apiError => console.log(apiError)) //=> Catch error\n\t\t}", "function getListItems() {\n var request = $http({\n method: \"get\",\n url: \"/api/documents\",\n params: {\n action: \"get\"\n }\n });\n\n return(request.then(handleSuccess, handleError));\n }", "function getResources() {\n return $http({\n method: 'get',\n headers: { 'Content-Type': 'application/json' },\n url: 'https://mywell-server.vessels.tech' + '/api/resources?filter=%7B%22fields%22%3A%7B%22image%22%3Afalse%7D%7D'\n }).then(function (response) {\n //cache the response\n $localstorage.setObject('getResourcesCache', response);\n return response;\n }).catch(function (err) {\n //Rollback to previous request if exists\n var cached = $localstorage.getObject('getResourcesCache');\n if (!angular.isNullOrUndefined(cached)) {\n return cached;\n }\n\n return Promise.reject(err);\n });\n }", "all() {\n\t\treturn fetch(`${BASE_URL}/people`, { credentials: 'include' }).then(\n\t\t\t(res) => res.json());\n\t}", "fetchNewsList(apiPath) {\n fetch(apiPath)\n .then(response => response.json())\n .then((response) => {\n this.resultsHandler(response);\n }, (error) => {\n this.setState({\n isLoaded: true,\n error,\n });\n });\n }", "fetchContent(sub, filter, search) {\n this.props.fetchList(\n `${sub}/${filter}`, \n search);\n }", "function getProducts() {\n loadingSpinner(1)\n return fetch(`${apiUrl}/api/cameras`)\n .then(res => {\n loadingSpinner(0)\n if (res.status === 200) {\n return res.json()\n } else {\n serverOffline()\n return 0\n }\n })\n .catch(err => {\n console.error(err)\n alert(\n \"La connexion au serveur semble être plus longue que d' habitude. Le serveur hébergeant l' API est entré en sommeil, veuillez patienter puis réactualisez la page !\"\n );\n });\n}", "function REST() {\n var configuration = SharePointClient.Configurations;\n var utility = new SharePointClient.Utilities.Utility();\n configuration.IsApp = true;\n \n\n var listServices = new SharePointClient.Services.REST.ListServices();\n\n //REST Listservices class for accessing list services\n var listServices = new SharePointClient.Services.REST.ListServices();\n\n //Set response type\n var responseType = SharePointClient.Constants.REST.HTTP.DATA_TYPE.JSON;\n\n var listTitle = \"xyz\";\n //Create Caml object\n var camlConstant = SharePointClient.Constants.CAML_CONSTANT;\n var camlQuery = new SharePointClient.CamlExtension.REST.CamlQuery();\n camlQuery.SetViewScopeAttribute(camlConstant.CAML_QUERY_SCOPE.RECURSIVE_ALL)\n .SetViewFieldsXml(\"<FieldRef Name='ID'/><FieldRef Name='Title'/>\")\n .SetQuery(\"<Where><Geq><FieldRef Name=\\\"Modified\\\" /><Value Type=\\\"DateTime\\\" IncludeTimeValue=\\\"TRUE\\\"\"\n + \"StorageTZ=\\\"TRUE\\\">2014-08-05T15:50:08</Value></Geq></Where>\")\n .OverrideQueryThrottleMode(camlConstant.CAML_QUERY_THROTTLE_MODE.OVERRIDE)\n .OverrideOrderByIndex()\n .SetRowLimit(5000);\n\n //Get All list items batch by list name\n listServices.GetListItemsBatchByListName(listTitle, camlQuery.BuildQuery(), responseType).Execute(function (result) {\n //logic for working with returned result set\n });\n}", "function getAllCompanies() {\n var path = \"/api/company/\";\n return fetch(path, {\n method: \"get\",\n credentials: \"include\",\n })\n .then((response) => {\n return response.json();\n })\n .catch((err) => {\n console.log(err);\n });\n}", "index(request, response) {\n Resttask.find({})\n .then(resttask => response.json(resttask))\n .catch(error => response.json(error));\n }", "static list(req, res) {\n // access_token\n console.log(\"article lists\")\n const dataUserId = req.userData.id\n console.log(dataUserId)\n\n Article.findAll({\n where: {UserId: dataUserId}\n })\n .then((articles) => {\n res.status(200).json(articles)\n })\n .catch((err) => {\n res\n .status(500)\n .json({ message: err.message || 'internal error server' })\n })\n }", "loadApis(data) {\n for (var key in data.links) {\n if (data.links[key].rel !== 'self') {\n this.apis.push(data.links[key]);\n }\n }\n this.$log.debug('ApisService', 'available apis', this.apis);\n }", "getCommonItems() {\n\n return new TotoAPI().fetch('/supermarket/commonItems').then((response) => response.json());\n }", "getResources (portalOpts) {\n const urlPath = `/portals/self/resources?f=json`;\n return this.request(urlPath, null, portalOpts);\n }", "fetchData() {\n this.initLoading();\n this.getInstance(this.view, this.qs_url).then(instance => {\n this.setLoadingSuccessful();\n this.data.instance = instance;\n\n if(this.view.schema.autoupdate) {\n this.startAutoUpdate();\n }\n }).catch(error => {\n debugger;\n this.setLoadingError(error);\n });\n\n this.getParentInstancesForPath();\n }", "function getData() {\n /*\n Mengambil data yanng ada di file posts.json melalui $.ajax\n referensi: https://api.jquery.com/jQuery.get/\n */\n $.get('./api/posts.json')\n .then(function(res) {\n // Menyimpan data yang telah diambil ke dalam variable allPosts\n allPosts = res\n\n /*\n menyembunyikan elemen ber-id 'loading'\n referensi: https://api.jquery.com/hide/\n */\n $('#loading').hide()\n\n // Merender Home Page\n RenderHome()\n })\n }", "function LoadContent(){\n\t\n\ttrace(\"LoadContent: Has API loaded and been properly initialized?:\"+String(IsLoaded()));\n\t\n\tif(!IsLoaded()) {\n\t\ttrace(\"Error loading API - Aborting!\");\n\t\treturn;\n\t}\n\n\ttrace(\"Exiting Load content...\");\n\treturn;\n\t\n}", "async getEverything(query, language, sources, pageSize, page) {\n if (_.isNil(query) && _.isNil(sources)) {\n const err = 'parametersTooBroad';\n return this.getErrorResponse(err, err);\n }\n \n let url = '/everything?';\n\n if (!_.isNil(query)) {\n url = `${url}q=${query}&`;\n }\n\n if (!_.isNil(sources)) {\n url = `${url}sources=${sources}&`;\n }\n\n url = `${url}pageSize=${(!_.isNil(pageSize) ? pageSize : 12)}&`;\n url = `${url}page=${(!_.isNil(page) ? page : 1)}&`;\n url = `${url}language=${(!_.isNil(language) ? language : 'en')}&`;\n url = url.slice(0, -1);\n\n return await getNewsArticles(url, 'unexpectedError', this.getSuccessResponse, this.getErrorResponse);\n }", "function getAllResources(){\n //Logger.log(\"in getAllResources()\");\n allResources = new Array();\n\n var response = UrlFetchApp.fetch('https://api.10000ft.com/api/v1/users?per_page=500&fields=custom_field_values,tags', params);\n\n allRes = JSON.parse(response.getContentText()); //JSON response\n\n\n //array to hold each javascript project object\n allRes.data.forEach(function(element){\n var user= new Object();\n user.id = element.id;\n user.first = element.first_name;\n user.last = element.last_name;\n allResources.push(user);\n });\n}", "getAll(req, res) {\n this.Model\n .findAll()\n .then(items => {\n return Response.create(res, 0, items);\n })\n .catch(err => {\n return Response.create(res, -1, err);\n });\n }", "fetchCustomers() {\r\n return Api().get('/customers')\r\n }", "function query_api(data){\n return $http.get('/api/base/search/', {params: data || {}}).success(function(data){\n $scope.results = $scope.display = data.objects;\n });\n }", "async getAll(req, res) {\n const { properties, location } = await readExtractData(dataPath)\n\n const data = properties.map(buildObjResponse(location))\n\n res.json(data)\n }", "getAllCars() {\n this.app.get(this.baseUrl + '', function (req, res) {\n CarData.getAll().then(function (result) {\n res = ResponseBuilder.createResponse(res, HttpStatus.OK);\n res.end(JSON.stringify(result));\n }).catch(function(result){\n res.end(\"could not get all cars\");\n })\n })\n }", "function get (spaceId, accessToken, resourcePath, params) {\n var url = 'https://cdn.contentful.com/spaces/' + spaceId + '/' + resourcePath\n if (params) {\n url += '?' + querystring.stringify(params)\n }\n var headers = { Authorization: 'Bearer ' + accessToken }\n return fetch(url, { headers: headers }).then(function (response) {\n return response.json()\n }).then(function (data) {\n if (data.sys.type === 'Error') {\n throw new Error(data.message);\n }\n return data;\n })\n}", "function getArticles() {\n return $http.get('/api/core/articles');\n }", "async index ({ response }) {\n try {\n const pages = {\n data: {\n pages: [\n {\n url: '/',\n name: 'home',\n title: 'Home',\n menu: 'home',\n content: `<div>The following products and services are offered for our customers:</div>\n\n <div>\n Application which helps blind people to 'see' the surrounding objects with the help of AI-based software.\n Service which converts your photo into a cartoonized one.\n Congratulation on the behalf of a cartoon.\n </div>`\n ,\n type: 'static'\n },\n {\n url: '/',\n name: 'home',\n title: 'Home',\n menu: 'home',\n content: `<div>The following products and services are offered for our customers:</div>\n\n <div>\n Application which helps blind people to 'see' the surrounding objects with the help of AI-based software.\n Service which converts your photo into a cartoonized one.\n Congratulation on the behalf of a cartoon.\n </div>`\n ,\n type: 'static'\n },\n {\n url: '/frontend/solution',\n name: 'solution',\n title: 'Solution',\n menu: 'solution',\n content: `Solution For Blind People\n\n The project goal is to create electronic eyes for blind people which will be provided free of charge to them. Electronic eyes will be an electronic appliance which can function on the basis of the artificial intelligence. Since blind people cannot see, the artificial intelligence can see instead of them and voice the surrounding objects.\n \n 2.2 billion people have a vision impairment or blindness\n The majority of people with vision impairment are over the age of 50 years.\n Blindness is a very serious problem. It is the inability to see anything even light.\n \n Support on patreon`,\n type: 'static'\n },\n {\n url: '/frontend/birthday',\n name: 'birthday',\n title: 'Birthday',\n menu: 'birthday',\n content: `Birthday Present\n\n Just imagine how your child or friend will be happy if he/she will be congratulated by a cartoon heroe in Youtube.\n \n It will be really cool!\n \n Contact us and it will be done just for 10$.`,\n type: 'static'\n },\n {\n url: '/frontend/cartoonizer',\n name: 'cartoonizer',\n title: 'Cartoonizer',\n menu: 'cartoonizer',\n content: `Convert your photo into a cartoon\n\n Just for 5$ your photo will be converted into a cartoon`,\n type: 'static'\n },\n {\n url: '/frontend/contact',\n name: 'contact us',\n title: 'Contact Us',\n menu: 'contact us',\n content: `If you have questions or would like to order one of our prodcts please contact us by e-mail:\n\n [email protected]`,\n type: 'static'\n }\n ]\n }\n\n }\n // await Page.all()\n return response.status(200).json({ pages })\n } catch (e) {\n console.log(e.message)\n }\n }", "function getResourceUrl() { return \"http://\"+location.href.split(\"//\")[1].split(\"/\").splice(0,3).join(\"/\")+'.json?api_key='+MoviePilot.apikey;}", "getAll() {\n return axios.get(BuildUrl(this.apiPath)).pipe(ErrorOnBadStatus);\n }", "function loadPosts() {\n // Note: \"posts\" is the [API] -> [endpoint] -> [name] in src -> index.js\n return API.get(\"posts\", `/searching/all/${name}`);\n }", "function getAll() {\n return $http.get(baseEndpoint);\n }", "function getData(search_param) {\n resourceRepo.getList(search_param).then(function success(response) {\n if (angular.isDefined(response.data.items)) {\n vm.itemsList = response.data.items;\n }\n }, function failure(response) {\n var t = response;\n })\n }", "function getContent(){\n $.get('api/content')\n .done(function (result) {\n if(result.success){\n $('#currentContent').html(renderCurrent(result.currentContent));\n $('#upcomingContent').html(renderCurrent(result.upcomingContent));\n $('#missedContent').html(renderCurrent(result.missedContent));\n } else {\n console.log(\"GET request failed\");\n }\n })\n .fail(function(){\n console.log(\"GET request failed\");\n });\n}", "getWikipediaContentAPICall(searchString) {\n\n let URL = 'http://localhost:4000/api/v1/content?titles=' + searchString\n\n fetch(URL)\n .then(response => response.json())\n .then(response => this.setState({ fullContent: response }))\n\n }", "function loadPosts() {\n return API.get(\"posts\", \"/publicposts\");\n }", "async index({ request, response, view }) {\n return await Bebida.all();\n }", "async function all (req, res) {\n try {\n const archives = await Archives.find()\n res.json(archives)\n } catch (error) {\n res.json({message : error.message})\n }\n}", "getCompany(companyId) {\n return Resource.get(this).resource('Admin:getCompany', {companyId})\n .then((res) => {\n this.displayData.company = res;\n });\n }", "function retrieveKpccData(data){\n var dataSource = 'http://www.scpr.org/api/content/?types=segmentsORnewsORentries&query=mahony&limit=20';\n jqueryNoConflict.getJSON(dataSource, renderKpccTemplate);\n}", "function getAllCourseAPI(){\n\t\n\tvar userId = document.getElementById(\"uId\").value;\n\t\n\tfetch(path+\"/getAllCoursesDashboard/\"+userId,{\n\t\t\n\t\tmethod: \"GET\",\n\t headers: {\n\t \"Content-Type\": \"application/json\",\n\t },\n\t\t\n\t})\n\t.then((response)=>response.json())\n\t.then((courses)=>{\n\t\tconsole.log(\"successfully fecth all data\", courses);\n\t\tif(courses){\n\t\t\tpopulateCourse(courses);\n\t\t}\n\t})\n\t.then((error)=>{\n\t\t\n\t\treturn null;\n\t\t\n\t});\n\t\n}", "function getAllBooks(){\n fetch(baseURL)\n .then(res => res.json())\n .then(books => listBooks(books))\n }", "async index({ request, response }) {\n const cat = await Categoria.all();\n return response.json({\"categorias\": cat})\n }", "function indexAction() { // GET /data/\n}", "function ajaxCall() {\n var data = $('[data-api-url]').data();\n return $.getJSON('/api?url='+data.apiUrl).then(displayElements);\n }", "get(apiData = {}) {\n return this._api(apiData, 'get');\n }", "function getListData() {\n var options = {\n url: \"http://localhost:3000/projects\",\n method: \"GET\",\n data: \"\",\n success: function(result) {\n renderListData(result);\n },\n error: function(error) {\n console.log(\"error\",error);\n }\n }\n ajax(options);\n}", "getAllcategory() {\n this.albumcategoryServices.getAll('', '1', '100').subscribe(res => {\n this.categoryList = res.result;\n });\n }", "getAllcategory() {\n this.albumcategoryServices.getAll('', '1', '100').subscribe(res => {\n this.categoryList = res.result;\n });\n }", "function getData() {\r\n\tvar apiURL = HAM.config.apiBaseURL + \r\n\t\t\t\"/object?apikey=\" + HAM.config.apiKey + \r\n\t\t\t\"&s=random&color=any&size=1&q=dimensions:*&fields=title,people,culture,dated,dimensions,colors,imagepermissionlevel,primaryimageurl\";\r\n\r\n\tvar xmlrequest = new XMLHttpRequest();\r\n\r\n\txmlrequest.onreadystatechange = function() {\r\n\t\tif (this.readyState == 4) {\r\n\t\t\tif (this.status == 200) {\r\n\t\t\t\tcurrent = JSON.parse(this.responseText);\r\n\t\t\t\tprocessData(current);\r\n\t\t\t} else {\r\n\t\t\t\tdone = true;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\t\t\r\n\txmlrequest.open(\"GET\", apiURL, true);\r\n\txmlrequest.send();\r\n\r\n\txmlrequest = null;\r\n\tapiURL = null;\r\n}", "function getAllHomeData() { \n $.post(\"/HomeContent/GridData\", function (data) {\n self.HomeContentData.removeAll();\n ko.mapping.fromJS(data.HomeContentResults, {}, self.HomeContentData);\n });\n }" ]
[ "0.6665459", "0.6313372", "0.6236909", "0.6181834", "0.6070732", "0.6067995", "0.6022738", "0.6018937", "0.5982749", "0.5974884", "0.59446454", "0.5912115", "0.58939934", "0.58808005", "0.5873229", "0.5856654", "0.5822969", "0.57344997", "0.570319", "0.5702424", "0.56873435", "0.56602", "0.56414783", "0.5639418", "0.5610407", "0.5610407", "0.56037194", "0.5597733", "0.55819124", "0.55777353", "0.5573213", "0.55649954", "0.55573106", "0.55572456", "0.55554277", "0.5553398", "0.5550656", "0.5544993", "0.55424535", "0.5534777", "0.55332506", "0.5531408", "0.5525906", "0.5525314", "0.550861", "0.55068296", "0.5501003", "0.5498526", "0.54917765", "0.54908735", "0.5486249", "0.5482945", "0.5482325", "0.5477737", "0.54756844", "0.5474888", "0.54598755", "0.545959", "0.54582757", "0.54544175", "0.54501534", "0.5441569", "0.543711", "0.5436301", "0.5435695", "0.54340184", "0.5430729", "0.543065", "0.5427869", "0.542621", "0.5424699", "0.5423123", "0.5422436", "0.542122", "0.5420691", "0.54188156", "0.54165304", "0.54138803", "0.54108924", "0.5409334", "0.5406671", "0.5406339", "0.5404858", "0.54020935", "0.5391993", "0.53914034", "0.5391227", "0.53911966", "0.53909487", "0.5385211", "0.53843683", "0.538224", "0.5369239", "0.53613", "0.53554285", "0.5354167", "0.53511494", "0.535051", "0.535051", "0.5350118", "0.5349184" ]
0.0
-1
Navigates the user to their respective profile when clicking on the 'Your Prfoile' link
function navProfile() { var cUser = null; socket.emit('isMe', token,cUser , function(res){ window.location = "/user/"+res[1]; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function goProfile() {\n $state.go('profile');\n }", "function openProfile () {\n $state.go('.person.defaultTab', { personId: vm.person.id, orgId: vm.organizationId });\n }", "function openProfile(){\n window.location.replace(\"https://stavflix.herokuapp.com/client/users/profile\");\n }", "linkToProfile() {\n const id = this.props.person.id;\n const isStudent = this.props.person.customer_id ? true : false\n\n /* Use the customer_id field to check whether the person is\n a student or a teacher. */\n\n if (isStudent) {\n window.location = RouteConstants.admin.studentProfile(id);\n } else {\n window.location = RouteConstants.admin.teacherProfile(id);\n }\n }", "function goMyProfile() {\n if (localStorage[config.data[0].storage_key+\"_Session\"] == null) {\n visitHomePage();\n } else {\n var Session = JSON.parse(localStorage[config.data[0].storage_key+\"_Session\"]);\n if (Session == null) {\n visitHomePage();\n } else {\n if (Session[\"login_status\"] == \"Active\") {\n var dirPath = dirname(location.href);\n var fullPath = dirPath + \"/profile.html\";\n window.location = fullPath;\n } else {\n visitHomePage();\n }\n }\n }\n}", "function goProfile() {\n window.location.href='./profile.html';\n}", "function profileClick(accountID) {\n $(\"#profile-new\").click(function (event) {\n window.location.href = \"/gwa/pages/profile.html?accountID=\" + accountID;\n })\n }", "function GotoProfile() {\n self.app.router.navigate('/my_Profile/', { reloadCurrent: true });\n}", "function navigateToProfile(id, nature) {\n\tvar path;\n\tvar idParam;\n\tswitch (nature) {\n\t\tcase 'ADMIN':\n\t\t\tpath = '/adminProfile';\n\t\t\tidParam = 'adminId';\n\t\t\tbreak;\n\t\tcase 'OPERATOR':\n\t\t\tpath = '/operatorProfile';\n\t\t\tidParam = 'operatorId';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tpath = '/profile';\n\t\t\tidParam = 'memberId';\n\t\t\tbreak;\n\t}\n\tself.location = pathPrefix + path + \"?\" + idParam + \"=\" + id ;\n}", "function profileLink(){\n window.location = 'profilePage.html?id=' + Cookies.get(\"userId\");\n}", "function viewprofile(){\r\n window.location.href='profile.html';\r\n}", "function avatarOpensProfile(props2) {\n props.navigation.navigate('MatchProfile', { match: props2._id, chet: props.route.params.chatti });\n }", "clickMyProfileLink() {\n return this.myProfileLink.click();\n }", "function viewFullProfile() {\n history.push('/supported-employees/'+employee.id)\n }", "function userProfilePage(){\n window.open(`https://api.github.com/users/${login}`, \"_blank\")\n }", "function goToUserProfile(username){\n $location.url(\"/user/activity/profile/\" + username);\n }", "function navigateToEditProfile(callFromRefresh) {\n\tvar pathName = $(location).attr('pathname');\n\tremoveMessageFromDivId();\n\t/* Checking for if user clicked home tab in locator page then s/he should move to main_payment_page */\n\tif(pathName.indexOf('locator.jsp') !== -1) {\n\t\t/* Moving to main_payment_page with #home for home(pay your bill) page */\n\t\tlocation.href = 'main_payment_page.jsp?resourceAppId=' + applicationId + '#editProfile';\n\t\treturn;\n\t}\n\tmakeActiveTab('footerProfileTab');\n\tbookmarks.sethash(\"#editProfile\", loadEditProfilePage, callFromRefresh);\n}", "openCurrentUser() {\n window.location.href = window.location.origin + '/users?name=' + this.state.currentUser.firstName + ' ' + this.state.currentUser.lastName;\n }", "function clickedName() {\n console.log(event.srcElement.parentElement.parentElement.id);\n const profile = event.srcElement.parentElement.parentElement.id;\n console.log(profile);\n localStorage.setItem('currentProfile', profile);\n window.location.href = '/my-profile';\n}", "function profilePage() {\n window.location = \"../profile.html\";\n}", "goToProfile(){\n this.props.navigation.pop();\n this.props.navigation.pop();\n this.props.navigation.getParam('update')();\n }", "function Profile() {\n //using context\n const {newlist} = useContext(contextdata);\n const history = useHistory();\n const { id } = useParams();\n //finds user with the path id\n const user = newlist.find((user) => user.id === +id);\n return (\n <div className=\"profile-page\">\n <div>{user.name}</div>\n <div>{user.details}</div>\n {/* a dynamic path is formed and page goes to that path when the button is clicked */}\n <button className=\"edit-profile-button\"\n onClick={() => history.push(\"/edit-profile/\" + id)}>Edit Profile</button>\n </div>\n )\n}", "function goEditProfile() {\n var dirPath = dirname(location.href);\n var fullPath = dirPath + \"/editprofile.html\";\n window.location = fullPath;\n}", "async function profilePage() {\n if (getPath() === 'profile.html') {\n const params = new URLSearchParams(document.location.search.substring(1));\n let overview;\n if (params.has('user')) {\n // Hide edit button\n document.querySelector('a.edit').classList.add('hide');\n\n // Fetch user profile\n const id = params.get('user');\n const [user] = await UserAPI.fetchUser(id);\n // Fetch user records\n const baseUrl = RecordAPI.uri;\n const url = `${baseUrl}/records?user=${id}`;\n const records = await RecordAPI.fetchRecords(url);\n overview = generateOverview(records);\n renderProfile(user, overview);\n } else {\n const { user } = auth();\n overview = getOverview();\n renderProfile(user, overview);\n }\n }\n}", "async function Profile(evt) {\n evt.preventDefault();\n if (localStorage.userId !== undefined) {\n hidePageComponents();\n $profileInfo.show();\n $userProfile.show();\n $links.show();\n $logoutBtn.show();\n $userBtn.show();\n\n if (localStorage.favTeamId == \"None\") {\n $favTeam.text(\"You have not selected a favorite team\");\n } else {\n $favTeam.text(\n `Your currently selected favorite team is the ${localStorage.favTeamName}`\n );\n }\n } else {\n $welcome.show();\n $loginBtn.show();\n $signupBtn.show();\n }\n}", "redirectProfile(id) {\n this.props.onHide();\n if (this.props.hideMenuResponsive) {\n this.props.hideMenuResponsive();\n }\n this.props.history.push(`/profile/${id}`);\n }", "function openEditUser() {\n routingBase.goToCurrentState('userDetails');\n }", "function profilo(){\n\t\t\t$(window.location).attr('href', 'profilo.html?'+$.cookie('username'));\n\t\t}", "function goToCurrentUser(userId){\n console.log(userId);\n $location.url(\"/user/profile\");\n }", "function change_nav_user(){ \n\tvar user_screen_name = jQuery('#signin_dropdown>a').text(); \n if(user_screen_name != ''){ \n\t\tvar profile_link = 'https://twitter.com/#!/' + user_screen_name;\n\t\tjQuery('#nav_user_profile>a').attr('href', profile_link); \n\t} else {\n\t\tjQuery('.nav_user_pic').hide();\n\t\tjQuery('#signin_dropdown>a').html('Start Here<b class=\"caret\"></b>');\n\t\tjQuery('#nav_user_profile').hide();\n\t\tvar signin_link = 'sign_in_with_twitter';\n\t\tjQuery('#nav_user_signin>a').text('Sign In');\n\t\tjQuery('#nav_user_divider').hide();\n\t\tjQuery('#nav_user_signin>a').attr('href', signin_link);\n\t} \n}", "function ProfileCardFollow(){\n PeopleService.Follow($rootScope.UserCard.id)\n .then(\n resolve => {\n $rootScope.UserCard.fav = true ;\n $rootScope.User.favs = resolve.data ;\n }\n );\n }", "function goToProfile(profileInfo){\n //let profileInfo = document.getElementsByClassName(\"profileInfo\");\n \n for(let i = 0; i < profileInfo.length; i++){\n \n profileInfo[i].children[0].addEventListener(\"click\", findCurrentProfile);\n }\n}", "function loggedIn(userdata) {\n console.log(userdata.email + \" has now logged in\");\n console.log(\"Privlevel: \" + userdata.privileges);\n // New users should be directed to edit page\n if ( +userdata.privileges < 3 ) {\n window.location.href=\"edituser.php\";\n return true; // Function is finished\n }\n // What URL are you on? Special? Stay. Otherwise load personal start page.\n if ( window.ref ) {\n console.log(\"Going to \" + window.ref);\n window.location.href = window.ref;\n } else {\n console.log(\"Going to userpage\");\n window.location.href = \"./userpage.php\";\n }\n }", "handleClick(id) {\n this.props.history.push('/profile/' + id);\n }", "function getUserAndRedirect(){\n UserServices.getOne({action:$scope.user.id}).$promise.then(function(val){\n $scope.user = val;\n shareObjectService.addObject($scope.user);\n $state.go('app.auth.user.detail', {id:$scope.user.id});\n });\n }", "function openProfileInfo() {\n vm.showUserInfo = !vm.showUserInfo;\n }", "editProfile(){\n\t\tresources.profileEdit().click();\n\t}", "function loadCurrentProfile(e){\n let targetProfile = e.target.title;\n \n if(localStorage.getItem(targetProfile) !== null){\n let currentProfile = localStorage.getItem(targetProfile);\n localStorage.setItem(\"currentProfile\", JSON.stringify(currentProfile));\n }\n else{\n console.log(\"Error: profile not found\");\n }\n}", "inviteUser() {\n Navigation.navigate(ROUTES.getWorkspaceInviteRoute(this.props.route.params.policyID));\n }", "function showProfileModal(data) {\n // used to display the modal\n setIsProfileModal(true);\n // set the memberUrl to pass into the profile modal componet\n setMemberUrl(data);\n }", "function get_profile(username, logged_in) {\n if (username == \"You\") {\n return '\"window.location.href=\\'profile1.php?username=' + logged_in + '\\'\"';\n } else {\n return '\"window.location.href=\\'profile1.php?username=' + username + '\\'\"';\n }\n}", "function viewOtherProfile(dom) {\n const userId = dom.dataset.id;\n console.log(userId);\n //Get the users data \n fetch(`${api}/api/users/${userId}`)\n .then(data => {\n return data.json();\n })\n .then(user => {\n //Store the gotten data temporarily in a session\n sessionStorage.setItem('userProfile', JSON.stringify(user.payload.data));\n const data = JSON.parse(sessionStorage.getItem('userProfile'));\n if (data) {\n //View the users profile\n viewProfile(data._id, data.name, data.email, data.number, data.created);\n document.querySelector('#uploadProfileBody').style.display = 'none';\n }\n })\n .catch(err => {\n console.log(err);\n })\n}", "function Petprofile(pet){\n pet = pet.replace(\"pet \", \"\");\n window.location = \"https://dragon-monkeys.firebaseapp.com/petprofile-page.html?Pet=\" + pet;\n}", "function navbarAuthInit() {\n $('.navbar-auth').on('click', function(){\n window.location.href = \"profile.html\";\n });\n}", "function handleClick() {\n setShowUserProfile((!showUserProfile))\n }", "selectPerfil(profile) {\n // Agrega el id del perfil a la transición\n this.transitionTo('perfil', profile.get('id'));\n }", "function displayProfile(profile) {\n if (toShow) {\n toShow.style.display = \"none\"\n toShow = profile\n toShow.style.display = \"block\"\n }\n} //end of displayProfile", "profileClickEvent () {\n const profileLinks = document.querySelectorAll('a.profile-link')\n for (let i = 0; profileLinks.length > i; i++) {\n profileLinks[i].addEventListener('click', function (e) {\n e.preventDefault()\n const profile = new Person(this.getAttribute('data-profile'))\n\n const profileData = phoneTap.mapProfile(profile)\n const log = phoneTap.log(profile)\n const modalTemplate = profileModal(profileData, log)\n\n const modalContainer = document.getElementById('profile-modal')\n modalContainer.innerHTML = modalTemplate\n document.getElementById('profile-modal-wrapper').classList.add('active')\n })\n }\n }", "function showProfile(profile, currentUser) {\n profile.children.item(0).innerHTML = currentUser.username;\n profile.children.item(1).innerHTML = currentUser.title;\n profile.children.item(2).innerHTML = currentUser.score;\n profile.children.item(1).style.color = '#e40046';\n profile.children.item(1).style.fontWeight = 'bold';\n profile.children.item(2).style.color = '#e40046';\n profile.children.item(2).style.fontWeight = 'bold';\n profile.children.item(3).innerHTML = currentUser.email;\n return;\n}", "function gameToProfile() {\n\tpauseGame()\n\t$(\"#ui_game\").hide()\n\t$(\"#ui_profile\").show()\n\tretrieveUserInfo()\n\tsessionStorage.setItem(\"currentScreen\", \"profile\")\n}", "function displayProfile(profile) {\n document.getElementById('name').innerHTML = window.profile['displayName'];\n document.getElementById('pic').innerHTML = '<img src=\"' + window.profile['image']['url'] + '\" />';\n document.getElementById('email').innerHTML = email;\n toggleElement('profile');\n}", "return() { \n const path = this.props.location.pathname;\n var path_ending = path.match(/\\d/g); \n this.props.history.push(`../profile/${path_ending}`); // pushes back to the specific user\n }", "function viewSpecialsPage(uid) {\n\tdocument.cookie = \"MoreInfoUserID=\" + encodeURIComponent(uid) + \";\";\n window.location.assign('/MoreInfo');\n}", "navigateToSocialPage() {\n return this._navigate(this.buttons.social, 'socialPage.js');\n }", "function loadMyProfile() {\n\t\tlet userId = sessionStorage.getItem('userId');\n\n\t\tauthorService.loadAuthorByUserId(userId)\n\t\t\t.then(author => {\n\t\t\t\tdisplayUpdateAuhtorForm(author);\n\n\t\t\t}).catch(handleError);\n\t}", "function redirectToPhysioExperts() {\n\t\t\t$state.go(\"homepages.physioexperts\");\n\t\t}", "function getAccountPage() {\n console.log(\"Redirecting to account page\");\n location.href = \"ProfilePage.html\";\n}", "function getAccountPage() {\n console.log(\"Redirecting to account page\");\n location.href = \"ProfilePage.html\";\n}", "function displayProfile(profile){\n \t// console.log(\"name:\" + profile['displayName']);\n \t// console.log(\"email: \"+ email);\n \tuserName = profile['displayName'];\n \tuserID = email;\n \tGplusLoggedin = true;\n \tloginSuccessFul();\n \t\n \t\n \tcheckIfUserInDB(userID);\n \t\n \t// console.log();\n \t\n // document.getElementById('name').innerHTML = profile['displayName'];\n // document.getElementById('pic').innerHTML = '<img src=\"' + profile['image']['url'] + '\" />';\n // document.getElementById('email').innerHTML = email;\n \n }", "handleSpecificUser(itemIndex) {\n generalItemList.innerHTML = \" \";\n let specificUser = this.items[itemIndex];\n let username = specificUser.login;\n\n fetch(specificUser.url)\n .then((res) => res.json())\n .then((data) => {\n let userInfo = data;\n\n this.getUserRepo(userInfo);\n this.pasteUserInfo(userInfo);\n\n document.querySelector(\".userImage\").src = specificUser.avatar_url;\n document.querySelector(\".name\").innerHTML = username;\n document.querySelector(\".userP\").href = specificUser.html_url;\n });\n }", "function profileInit() {\n firebase.auth().onAuthStateChanged(function(user) {\n if (user) {\n // User is signed in.\n console.log('user signed in');\n console.log(user);\n console.log('user uuid ' + user.uid);\n userUID = user.uid;\n $('body').addClass('user-logged-in');\n // check db for user data and display it\n checkDB(user);\n\n } else {\n // No user is signed in.\n console.log('no user is signed in');\n // forward to search page default populate action (28)\n window.location.href = 'search.html?fGenre=28';\n }\n });\n}", "function showUserDetail(userID, $event) {\n $state.go('userDetails', {userID : userID});\n }", "async function getProfie() {\n var tagline = await getTagline();\n var country = await getCountry();\n var profile = await getUrl();\n var featured = await getImages();\n res.render('pages/userProfile', {\n username: uname,\n icon: icon,\n tagline: tagline,\n country: country,\n link: profile,\n featured: featured,\n currentUser: currentUser\n });\n }", "function profile(){\n let login = window.sessionStorage.getItem('login');\n getProfile(login);\n}", "getMyProfileLinkUrl() {\n return this.myProfileLink.getAttribute('href');\n }", "async function showNextPage(profileId) {\n const nextUrl = await loadNextSuggestion(profileId);\n await store.dispatch('status', 'Getting suggestion');\n // If next suggestion already exists, use it and find a new one.\n // console.log('show next link');\n if (nextUrl != null) {\n // console.log('next suggestion exists');\n changeActiveTabToUrl(store.state.nextSuggestion);\n store.commit(types.SET_CUR_SUGGESTION, {\n url: store.state.nextSuggestion,\n });\n store.commit(types.SET_NEXT_SUGGESTION, {\n url: null,\n });\n store.commit(types.SET_NEED_CUR_SUGGESTION, {\n value: false,\n });\n } else {\n // console.log('no next suggestion');\n store.commit(types.SET_NEED_CUR_SUGGESTION, {\n value: true,\n });\n }\n loadNextSuggestion(profileId);\n}", "function checkProfile(){\n if(!loggedIn){\n alert(\"Please login before using Profile!\");\n\t\tdocument.getElementById('myProfile').style.display='none';\n }\n else{\n alert(\"Welcome!\");\n\t\t document.getElementById('myProfile').style.display='block';\n\t\tdocument.getElementById(\"defaultOpen2\").click();\n }\n}", "redirect() {\n if( Meteor.user() && Meteor.user().profile.isDriver) {\n window.location.replace(FlowRouter.path('Make Offers'));\n }\n if (Meteor.user() && (! Meteor.user().profile.isDriver)) {\n window.location.replace(FlowRouter.path('Request Pickup'));\n }\n return !!Meteor.userId();\n }", "function displayProfileManagementPage(){\r\n mentorShareMenu.style.display = 'none';\r\n profileEditPage.style.display = 'block';\r\n profileResultsPopulated();\r\n}", "function informationAcoout(){\n let btn = document.querySelector(\"#cont-menu > #user\");\n if(localStorage.getItem(\"user\")){\n btn.onclick = (e)=>{\n if(localStorage.getItem(\"user\")){\n location.replace(\"/login/informacioncuenta\");\n }else{\n urlCreateAccount();\n }\n }\n }else{\n urlCreateAccount();\n }\n}", "function urlCreateAccount(){\n let btn = document.querySelector(\"#cont-menu > #user\");\n btn.onclick = (e)=>{\n location.href = \"/login/signup\"\n }\n}", "function show(req, res) {\n Profile.findById(req.params.id)\n .populate(\"following\")\n .populate(\"followers\")\n .then((profile) => {\n Post.find({ author: profile._id })\n .then((posts) => {\n Profile.findById(req.user.profile)\n .then(userProfile => {\n res.render(\"profiles/show\", {\n title: `${profile.name}'s profile`,\n profile,\n userProfile,\n posts\n })\n })\n })\n })\n .catch((err) => {\n console.log(err)\n res.redirect(\"/\")\n })\n}", "nav_helper(data) {\n\t\tbrowser.sleep(2000)\n\t\tutil.selectDropDown(this.profile, data.Profile, 'Profile', 'Clone');\n\t\tbrowser.sleep(2000)\n\t}", "goToSignupPage() {\n Linking.openURL('https://signup.sbaustralia.com');\n //Actions.signup();\n }", "redirect() {\n const hash = Radio.request('utils/Url', 'getHash');\n\n // Redirect back only if it's notebooks page\n if (hash.search(/notebooks/) !== -1) {\n Radio.request('utils/Url', 'navigate', {\n trigger : false,\n url : '/notebooks',\n includeProfile : true,\n });\n }\n }", "function getProfile(person){\n\tprofileString = 'GetProfile=True&ProfileId='; \n\tif(person == 'MyProfile'){\n\t\tprofileString += $('#loggedInUser').text().substr(14,30);\n\t}\n\telse if(person == 'Instructor'){\n\t\tvar i=0;\n\t\tselectedRow.find('td').each(function(){\n\t\t\tif(i==0){\n\t\t\t\tprofileString += $(this).text();\n\t\t\t}\n\t\t\ti++;\n\t\t});\n\t}\n\telse{\n\t\tprofileString += person;\n\t}\n\tprofileString += '&Profiles';\n\tdisplayPageInfo(profileString);\n}", "function view_my_profile_parent()\n{\n\tif(window.localStorage['loggedin'] == '1')\n\t{\n\t\tvar userdetails=[];\n\t\tuserdetails=JSON.parse(window.localStorage['userdata']);\n\t\tvar lname,kids,type,phone,skype,premium;\n\t\tif(userdetails.lastname != null)\n\t\t{\n\t\t\tlname=userdetails.lastname;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlname=\"\";\n\t\t}\n\t\tif(userdetails.type_sitter != null)\n\t\t{\n\t\t\ttype=userdetails.type_sitter+\" - \";\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttype=\"\";\n\t\t}\n\t\tif(userdetails.kids != 0)\n\t\t{\n\t\t\tvar kids_age_arr=[];\n\t\t\tfor(i=0;i<userdetails.kids.length;i++)\n\t\t\t{\n\t\t\t\t kids_age_arr+=userdetails.kids[i]+\",\";\n\t\t\t};\n\t\t\tvar kids_age= kids_age_arr.slice(0,-1); \n\t\t\tkids=userdetails.kids.length+' enfants - Agé '+kids_age+' ans';\n\t\t}\n\t\telse\n\t\t{\n\t\t\tkids=userdetails.kids+' enfants ';\n\t\t}\n\t\tif(userdetails.phone != null)\n\t\t{\n\t\t\tphone=userdetails.phone;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tphone=\"\";\n\t\t}\n\t\t\n\t\tif(userdetails.skype != null)\n\t\t{\n\t\t\tskype='Skype :'+userdetails.skype;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tskype=\"\";\n\t\t}\n\t\tif(userdetails.premium != null)\n\t\t{\n\t\t\tvar diffDays=get_date_diff(userdetails.premium.endDate.date,userdetails.server);\n\t\t\tif(diffDays<=0)\n\t\t\t{\n\t\t\t\tpremium=\"Premium\";\n\t\t\t\t$('#fiche-parents').find('.abonnement').find('.premium').css('display','none');\n\t\t\t $('#fiche-parents').find('.abonnement > div').first().css('display','block');\n\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tpremium=\"Gratuit \";\n\t\t\t\t$('#fiche-parents').find('.abonnement > .premium').css('display','block');\n\t\t\t $('#fiche-parents').find('.abonnement > div').last().css('display','block');\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tpremium=\"Gratuit \";\n\t\t\t$('#fiche-parents').find('.abonnement > .premium').css('display','block');\n\t\t\t$('#fiche-parents').find('.abonnement > div').last().css('display','block');\n\t\t}\n\t\tvar htmls='<a href=\"#par-ppedit-image\" data-rel=\"popup\" data-transition=\"pop\" class=\"signalement edit-image\">'+\n\t\t'<img src=\"'+userdetails.src+'\" height=\"80\" alt=\"\"></a><h1>'+userdetails.firstname+' '+lname+'<strong> '+type+''+userdetails.locality+'</strong></h1><p>'+kids+'<br/>'+phone+'<br/>'+window.localStorage['username']+'<br/>'+skype+'</p>';\n\t\t$('#fiche-parents .user').html('');\n\t\t$('#fiche-parents .user').html(htmls);\n\t\t$('#fiche-edit-planning').find('input:checkbox[name=\"e_planning[]\"]:checked').each(function() \n\t\t{\n\t\t\t$(this).attr('checked',false);\n\t\t});\n\t\t$('#fiche-edit-planning').find('td').removeClass('check');\n\t\tvar plan=[];\n\t\tplan=JSON.parse(window.localStorage['planning']);\n\t\t//alert(plan);\n\t\tfor(i=0;i<plan.length;i++)\n\t\t{\n\t\t\t$('#fiche-edit-planning').find('#e_planning_'+plan[i]).attr('checked',true);\n\t\t\t$('#fiche-edit-planning').find('#e_planning_'+plan[i]).parent('td').addClass('check');\n\t\t\t$('#fiche-edit-planning').find('#e_planning_'+plan[i]).parent('div').parent('td').addClass('check');\n\t\t}\n\t\t\n\t\t$('#fiche-parents').find('.subscription_status').html(premium);\n\t\t$.mobile.changePage('#fiche-parents',{transition:'flip'});\t\n\t}\n\telse\n\t{\n\t\talert('please login to view your profile.');\n\t}\n\t\n}", "showProfile(user) {\n\t\t// Creating a template for adding it in our profile\n\t\tconsole.log(user);\n\t\tthis.profile.innerHTML = `\n\t\t\t<div class=\"card card-body mb-3\">\n\t\t\t<div class=\"row\">\n\t\t\t\t<div class=\"col-md-3\">\n <img src=\"${user.avatar_url}\" alt=\"\" class=\"img-fluid mb-2\" />\n <p>Name: ${user.name}</p>\n\t\t <a href='${user.html_url}' target='blank' class='btn btn-primary btn-block mb-4'> View Profile</a>\n </div>\n <div class=\"col-md-9\">\n <div><h2 class='display-5'>${user.name}</h2></div>\n <div><h5>${user.login}</h5></div>\n <span class='badge badge-primary badge-pill' style='padding:14px; font-size:14px; background-color:rgb(109, 107, 107)'>Public Repos: ${user.public_repos}</span>\n <span class='badge badge-info badge-pill'\n style='padding:14px; font-size:14px'>Public Gists: ${user.public_gists}</span>\n <span class='badge badge-success badge-pill'\n style='padding:14px; font-size:14px'>Followers: ${user.followers}</span>\n <span class='badge badge-warning badge-pill'\n style='padding:14px; font-size:14px'>Following: ${user.following}</span>\n <br><br>\n <ul class='list-group'>\n <li class='list-group-item'>Company: ${user.company}</li>\n <li class='list-group-item'>Website/Blog: ${user.blog}</li>\n <li class='list-group-item'>Location: ${user.location}</li>\n <li class='list-group-item'>Member since: ${user.created_at}</li>\n </ul>\n </div>\n\t\t\t</div>\n </div>\n <br>\n \n <h3>Latest Repositories: </h3>\n <div id='repos'></div>\n\t\t`;\n\t}", "createAccount() {\n this.props.nav.navigate(\"Create Student User\");\n }", "function onProfileLoad() {\n const loginInfo = getLoginInfo();\n loginInfo.then(ifLoggedOutRedirectHome); \n loginInfo.then(getUserOrRedirectRegistration).then((person) => {\n autofillForm(person); \n });\n}", "function loadNewProfile(event) {\n API.getProfile(event.target.id);\n window.location.reload();\n }", "function initializePage_userProfile()\r\n{\r\n page_userProfile.$auxButton.eq(0).click(logout);\r\n page_userProfile.$auxButton.eq(1).click(showPage_editAccount);\r\n}", "function directUserFromViewInfo() {\n if (nextStep == \"Departments\") {\n viewDepartments();\n }\n if (nextStep == \"Roles\") {\n viewRoles();\n }\n if (nextStep == \"Employees\") {\n viewEmployees();\n }\n if (nextStep == \"All Information\") {\n viewAll();\n } \n }", "function Profile(props) {\n const { mainViewUser, changeView } = props;\n const { username, name, profilePicURL, interests } = mainViewUser;\n\n function handleClick(e) {\n changeView(e.target.dataset.target, mainViewUser)\n }\n\n function getViewTarget(target) {\n changeView(target, mainViewUser)\n }\n\n return (\n \n \n // <MainViewHeader getViewTarget={getViewTarget}/>\n \n <div className=\"\">\n <div className=\"\">\n <img className=\"img-thumbnail img-lg\" src={profilePicURL} />\n <h4>@{username}</h4>\n <h3>{name}</h3>\n <button data-target=\"dm\" type=\"button\" className=\"btn btn-sm btn-success\" onClick={handleClick}>slide into {username}'s DM </button>\n {/* <ul className=\"list-group\">{interests.map(interest => <button key={interest} type=\"button\" className=\"list-group-item list-group-item-action\">{interest}</button>)}</ul> */}\n </div>\n </div>\n \n );\n}", "function proceed () {\n\t\t/*\n\t\t\tIf the user has been loaded determine where we should\n\t\t\tsend the user.\n\t\t*/\n if ( store.getters.getUserLoadStatus() == 2 ) {\n\t\t\t/*\n\t\t\t\tIf the user is not empty, that means there's a user\n\t\t\t\tauthenticated we allow them to continue. Otherwise, we\n\t\t\t\tsend the user back to the home page.\n\t\t\t*/\n\t\t\tif( store.getters.getUser != '' ){\n \tnext();\n\t\t\t}else{\n\t\t\t\tnext('/cafes');\n\t\t\t}\n }\n\t}", "function showMyProfile(response){\n\n\n var userId = response.id; //saving userid for accessing their profile picture\n pictureUrl = \"https://graph.facebook.com/\"+ userId + \"/picture?type=large\"; //saving url of profile picture of user\n\n $(\"img#profile\").attr(\"src\",pictureUrl); //displaying profile picture\n setField( $(\"h2#full-name\"), response.first_name); //displaying first name of user\n setField( $(\"h2#full-name\"), response.last_name); //displaying last name of user\n setField( $(\"p#info\"), response.birthday, \"Birthday: \"); //displaying birthday of user\n $(\"p#info\").append(\"<br />\"); //adding a line break to append new information from next line\n setField( $(\"p#info\"), response.email, \"Email: \"); //displaying email of user\n $(\"p#info\").append(\"<br />\");\n setField( $(\"p#info\"), response.gender, \"Gender: \"); //displaying gender of user\n $(\"p#info\").append(\"<br />\");\n setField( $(\"p#info\"), response.location.name, \"Current place: \"); //displaying current city of user\n $(\"a#visit-profile\").attr(\"href\",response.link);\n\n setField( $(\"div#right-side h2#work\"),response.work,\"WORK\");\n if($(\"div#right-side h2#work\").text() == \"WORK\"){ //to only access details of work object if it is present\n setWork( $(\"div#fb-work\"),response.work);\n }\n\n\n setField( $(\"div#right-side h2#edu\"),response.work,\"EDUCATION\");\n if($(\"div#right-side h2#edu\").text() == \"EDUCATION\"){\n setEdu( $(\"div#fb-edu\"),response.education);\n }\n\n }", "function showMyTeamDetails(context) {\n const myTeamId = sessionStorage.getItem('teamId');\n context.redirect(`#/catalog/:${myTeamId}`);\n }", "clickOnSignInLink(){\n let signInLink = utils.byLocator(jobsPageLocator.jobsPage.SignInLink);\n utils.clickOn(signInLink);\n }", "function actionOnContactClick () {\n\n window.location = (\"/contacts/\" + lastName)\n \n }", "function followUser() {\n if (LoginService.isLoggedIn()) {\n UserProfileService\n .followUser(vm.userInfo.id)\n .then(function () {\n vm.isFollowing = true;\n\n //reload details for the current user who has been followed/unfollowed\n getUserInfoForOtherUsers(vm.userInfo.userName);\n });\n }\n }", "get editProfileLink() {\r\n return this.clone(UserProfileQuery, \"EditProfileLink\").get();\r\n }", "getMyProfileLinkText() {\n return this.myProfileLink.getText();\n }", "function goToRepos() {\n var params = {\n userName: $stateParams.userName,\n basic: $stateParams.basic,\n id: $stateParams.id,\n token: $stateParams.token\n };\n console.log('Go back to repositories.');\n $state.go('repositories', params);\n }", "async testNavigateProfile(page) {\n //Test\n this.utility.debug('--UpdateProfileTest --> testNavigateProfile');\n\n await expect(page).toClick('div.nav-item.dropdown > a', {text: /Signed in as:/});\n await expect(page).toClick('a.dropdown-item', {text: /Profile/});\n await page.waitForTimeout(500);\n\n\n //Check\n this.utility.debug('--UpdateProfileTest --> testNavigateProfile --> Confirming Navigated');\n\n await expect(page).toMatchElement('p.card-text > strong', {text: \"Display Name:\"});\n await expect(page).toMatchElement('p.card-text > strong', {text: \"Email:\"});\n await this.utility.screenshot(page, this.dir + '/1-Navigated.png', {});\n\n //Done\n this.utility.debug('--UpdateProfileTest --> testNavigateProfile --> DONE');\n }", "function Nav({user, changeUser}){\n\n return(\n <div className= \"nav\">\n <div>\n <a href=\"#\" > <img class=\"avatar avatar-96 img-circle\" src= {`${user.avatar}`} alt = \"avatar\"/> </a>\n </div>\n <div>\n {user.email}\n </div>\n <div>\n <button onClick={changeUser} >Change User</button>\n </div>\n </div>\n );\n}", "function GetUser() {\n showUsers(dataUsers[currentPage]);\n}", "function navigatingTo(args) {\n page = args.object;\n}", "checkProfile() {\n if (this.getProfileId() !== this.profileId) {\n window.location.reload();\n }\n }", "function rete(){\n\t\t\t$(window.location).attr('href', '../php/rete_sociale.php?'+$.cookie('username'));\n\t\t}", "function getProfileOnClick(target){\n target.addEventListener(\"click\", loadCurrentProfile);\n}" ]
[ "0.7676281", "0.7385198", "0.72834337", "0.7168574", "0.6979013", "0.69632095", "0.6941266", "0.6940088", "0.68998355", "0.6841725", "0.68286914", "0.6814972", "0.676227", "0.67542285", "0.66521806", "0.6640242", "0.66108346", "0.6545405", "0.6542526", "0.6444103", "0.6370622", "0.6312193", "0.63011044", "0.6293257", "0.62274057", "0.62190783", "0.62135357", "0.61888593", "0.615487", "0.61496246", "0.6132654", "0.61203", "0.60933036", "0.6089758", "0.6078359", "0.60726", "0.6057732", "0.6027823", "0.5995534", "0.5995424", "0.59715325", "0.5962759", "0.59529567", "0.59513015", "0.59449995", "0.5941768", "0.5928202", "0.59246653", "0.58980054", "0.58921844", "0.5889851", "0.5874219", "0.5841172", "0.5803948", "0.58031654", "0.5801753", "0.57947737", "0.57947737", "0.5775297", "0.5747876", "0.5742744", "0.57377374", "0.5734631", "0.5733091", "0.57240254", "0.5715209", "0.5711142", "0.56992626", "0.5677381", "0.56745195", "0.5673213", "0.56729585", "0.5650111", "0.5647001", "0.5642147", "0.5637631", "0.56321615", "0.5625751", "0.56242925", "0.56234205", "0.56207997", "0.56152725", "0.5608099", "0.5599019", "0.5596151", "0.55960953", "0.55953676", "0.55914015", "0.55756605", "0.5574302", "0.5574282", "0.5570664", "0.5570174", "0.5570063", "0.5569463", "0.555036", "0.55410403", "0.5528017", "0.55267316", "0.55227995" ]
0.6312829
21
Adapts the UI for a mobile
function mobile(){ $(".window-controls").remove(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _enterMobile() {\r\n\t\t\thome.viewformat = 'small';\r\n\t\t}", "function mobileLayout() {\n let w = p.width;\n let h = p.height;\n \n b1 = p.createButton(\"Button 1\", w*0.05, h*0.05, w*0.4375, h*0.125);\n b2 = p.createButton(\"Button 2\", w*0.5125, h*0.05, w*0.4375, h*0.125);\n t1 = p.createToggle(\"Toggle 1\", w*0.05, h*0.2, w*0.4375, h*0.125);\n cf1 = p.createCrossfader(\"Crossfader 1\", w*0.5125, h*0.2, w*0.4375, h*0.125);\n s1 = p.createSlider(\"SliderH\", w*0.05, h*0.35, w*0.9, h*0.125);\n s2 = p.createSliderV(\"SliderV\", w*0.05, h*0.5, w*0.2, h*0.45, -100, 100); // Last two args are min and max\n cb1 = p.createCheckbox(\"Checkbox 1\", w*0.275, h*0.5, w*0.2125, h*0.2125);\n cb2 = p.createCheckbox(\"Checkbox 2\", w*0.275, h*0.7375, w*0.2125, h*0.2125);\n s2d1 = p.createSlider2d(\"Slider2d 1\", w*0.5125, h*0.5, w*0.4375, h*0.45);\n }", "function mobileSetUp () {\n $('.hiddenMobile').hide()\n $('.viewMobile').show()\n }", "function setMobile () {\n $('.desktopVersion').hide()\n $('.mobileVersion').show()\n $('.pasajeros-vuelo-mobile').hide()\n pintarTablaMobile('.mobile-seats-wrp')\n mobileStartUp()\n }", "function desktopSetUp () {\n $('.hiddenMobile').show()\n $('.viewMobile').hide()\n }", "function viewMobile_Browser() {\n $(\"#mobileImg\").show();\n $(\"#mobileWelcomeBox\").show();\n $(\"#mobileInstruction\").show();\n $(\"#desktopImg\").hide();\n\n // Add slick to the viewport\n $(\"#browserView\").slick({infinite: false, edgeFriction: 0.15, slide: \".slide\", initialSlide: INITIAL_PANE, touchThreshold: 7});\n}", "function responsiveSetup(){\n\tif( typeof $(\"#mobile-style-detector:visible\") !== \"undefined\" && $(\"#mobile-style-detector:visible\").length >= 1 ){\n\t\t$(\"#product-wrapper\").detach().appendTo(\".work-desk.mobile\");\n\t} else {\n\t\t$(\"#product-wrapper\").detach().appendTo(\".work-desk.web\");\n\t\n\t\tstep = $(\".back-next-butt-wrapper\").data( \"current_step\");\n\t\tswitch(step){\n\t\t\tcase \"select layout\": break;\n\t\t\t\n\t\t\tcase \"layout page\": toggleScrollBar(\".layout-templates:visible\"); break;\n\t\t\tcase \"styles page\": toggleScrollBar(\".graphic-templates:visible\"); break;\n\t\t\t\n\t\t\tcase \"upload photos\": toggleScrollBar(\".layout-templates:visible\"); break;\n\t\t\tcase \"facebook page\": toggleScrollBar(\".layout-templates:visible\"); break;\n\n\t\t\tcase \"edit pictures\": toggleScrollBar(\".upload-page-wrapper:visible\"); break;\n\n\t\t\tcase \"select color insert or save\": toggleScrollBar(\".optional-surface:visible\"); break;\n\n\t\t\tcase \"presave preview\":\n\t\t\t\t\n\t\t\tbreak;\n\n\t\t\tcase \"save product\":\n\t\t\t\t\n\t\t\tbreak;\n\t\t}\n\t}\n}", "function adjustZoomInterfaceForMobile() {\n var browserSupportInfo = ZoomSDK.getBrowserSupport();\n if (!browserSupportInfo.isMobileDevice) {\n // Do any desktop-specific styling here.\n $(\"#zoom-icon-angle-good\").attr(\"src\",\"../sample-shared-files/images/zoom-face-guy-angle-good-web.png\");\n $(\"#zoom-icon-angle-bad\").attr(\"src\",\"../sample-shared-files/images/zoom-face-guy-angle-ok-web.png\");\n $(\".authentication-menu-button\").css({\n \"height\": \"40px\",\n \"width\": \"40%\"\n });\n updateZoomUIConstraintsAfterCameraSuccess();\n return;\n }\n\n // Hide text next to low-light mode switch for mobile.\n $(\"#image-switch-text\").hide();\n\n var windowHeight = $(window).height();\n var windowWidth = $(window).width();\n\n // Resize the wrapping box container and hide the border for mobile devices.\n $(\".wrapping-box-container\").css({\n \"width\": \"\" + Math.round(0.99 * $(window).width()),\n \"border\": \"0px\"\n });\n\n // Handling sizing for medium sized mobile devices.\n if(windowWidth < 600) {\n $(\".big-button\").css({\n \"height\": \"40px\",\n \"width\": \"90%\"\n });\n\n $(\"#username\").css({\n \"height\": \"40px\",\n \"width\": \"80%\"\n });\n\n $(\"#liveness-button\").css(\"height\", \"3.7em\");\n $(\".custom-logo-container\").css({\n \"transform\": \"scale(0.8)\",\n \"margin\": \"0 auto\", \"padding\": \"0\"\n });\n\n // Slightly smaller header text for this size device.\n $(\".user-helper h2\").css(\"font-size\", \"20px\");\n\n // Slightly smaller pictogram icons on this size device.\n $(\".user-helper > div > div img\").css(\"height\", \"70px\");\n\n // The retry images of the user should be taller on mobile.\n $(\".retry-images img\").css(\"height\", \"110px\");\n\n // Make error container lists look better on mobile.\n $(\".error-feedback-container ol\").css(\"width\", \"85%\");\n }\n\n // Handle sizing for small mobile devices.\n if(windowWidth <= 320) {\n $(\".custom-logo-container\").css({\n \"transform\": \"scale(0.6)\",\n \"margin-top\": \"-5%\"\n });\n\n $(\"#feedback-text\").css(\"display\", \"none\");\n $(\".user-helper h2\").css(\"font-size\", \"18px\");\n\n // Tighten up the ui on super tiny devices.\n $(\".user-helper > div > div img\").css(\"height\", \"40px\");\n $(\".user-helper > div > div img\").css(\"margin\", \"0 auto 10px\");\n $(\".user-helper > div > div img\").css(\"padding\", \"0\");\n\n // The retry images of the user should be taller on mobile.\n $(\".retry-images img\").css(\"height\", \"110px\");\n }\n\n // Don't need to have two example images on retry screen on mobile.\n $(\".retry-images-left\").find(\"img:first\").remove();\n $(\".retry-images-right\").find(\"img:first\").remove();\n\n // Handle iOS specifically, because it is easy to special case. For iOS, iPhone vs. iPad could also be detected based on user agent.\n // For Android, we handle showing ZoOm better for large and small screen sizes.\n if (browserSupportInfo.osName === \"iOS\") {\n if (windowWidth < 768) {\n $(\"#zoom-parent-container\").css(\"height\", \"\" + Math.round(0.75 * windowHeight));\n }\n else {\n $(\"#zoom-parent-container\").css(\"height\", \"\" + Math.round(0.6 * windowHeight));\n }\n }\n else {\n var isInPortrait = window.innerWidth < window.innerHeight;\n\n // Sizing here could get much more granular if the developer desires to do so.\n // This is a very naive approach to detecting larger devices (tablets) and drawing ZoOm interface smaller on those devices.\n if(isInPortrait) {\n if (windowWidth < 600) {\n $(\"#zoom-parent-container\").css(\"height\", \"\" + Math.round(0.75 * windowHeight));\n }\n else {\n $(\"#zoom-parent-container\").css(\"height\", \"\" + Math.round(0.6 * windowHeight));\n }\n }\n else {\n if ($(window).height() <= parseInt(window.getComputedStyle(document.getElementById(\"zoom-parent-container\")).height)) {\n $(\"#zoom-parent-container\").css(\"height\", \"\" + Math.round(0.75 * windowHeight));\n }\n }\n }\n updateZoomUIConstraintsAfterCameraSuccess();\n}", "function adaptToScreenSize() {\n /* This function is a container for any changes that need to be made to the DOM\n When the DOM is ready or when the window resizes. */\n if (window.innerWidth <= 800) {\n $('.scroll-follow-breakpoint').append($('.more-then-flooring-right'));\n } else if (window.innerWidth > 800) {\n $($build.append($('.more-then-flooring-right')));\n }\n }", "function DeviceWrangler() {\t\r\n\t//TODO better method than User-Agent. Mainly we're interested\r\n\t//in diagonal length in landscape mode (and thus readability)\r\n\t//and screen size in portrait mode (and thus elimination of margins)\r\n\tthis._isPhone = (/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));\r\n\tif (this._isPhone) \r\n\t{ _outerParent.className += \" onPhone\"; }\r\n\t\r\n}", "function optimizeMobile() {\n if(isMobile()) {\n TOPPANO.gv.mobile.isMobile = true;\n }\n}", "function dashBodymobScreen() {\r\n if (window.innerWidth <= 1000) {\r\n if (!section2.classList.contains('mobScreen')) {\r\n let headingContainer = section2.querySelector('.data-heading');\r\n section2.classList.add('mobScreen');\r\n for (let i = 0; i < dataRow.length; i++) {\r\n let dataDes = dataRow[i].querySelectorAll('.data-title-content .data');\r\n for (let a = 0; a < dataDes.length; a++) {\r\n let copyItem = dataHeading[a].cloneNode(true);\r\n dataDes[a].querySelector('.inner-data').insertAdjacentElement('beforebegin', copyItem);\r\n }\r\n }\r\n headingContainer.classList.remove('d-flex');\r\n headingContainer.style.display = 'none';\r\n }\r\n }\r\n }", "function mobileSetUp () {\n $('.no-mobile').hide()\n\t $('#AutenticationRequest_butt').addClass('btn-validate').removeClass('btn-check1');\n $('.mobile').show()\n }", "function createMastheadMobile () {\n\t\tcreateMastheadMinimal();\n\t\t$masthead.removeClass(\"ibm-mhtype-minimal\").addClass(\"ibm-mhtype-mobile\");\n\t}", "function enableDesktopOrMobileAnswers(){\n if(\"ontouchstart\" in document.documentElement){\n // instructions for mobile/tabvar touchscreen device\n $instructions.html(\"<b><i>Click</i></b> on the team member below that matches the description above...\");\n\n // hide draggable answers for Desktop, show clickable answers for Mobile/Tabvar view\n $answers.addClass( 'hidden' );\n $answersTouchScreen.removeClass( 'hidden' );\n } else {\n // instructions for desktop mouse-pointer device\n $instructions.html(\"<b><i>Drag</i></b> the corresponding team member of the description above onto the blank face...\");\n\n // hide clickable answers for Mobile/Tablet, show draggable answers for Desktop view \n $answersTouchScreen.addClass( 'hidden' );\n $answers.removeClass( 'hidden' );\n }\n }", "function partnerNavTouch() {\n var $pn = $('.pn');\n\n // LIM-1628 Since partner nav does not use the global modernizr we need to add the custom test classes to it.\n // ismobile-device test\n var regex = /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/,\n userAgent = navigator.userAgent,\n isMobileDevice = regex.test(userAgent);\n\n // Ipad Test\n regex = /iPad/i;\n var isIpad = regex.test(userAgent);\n\n //mstouch test\n var msMaxTouchPoints = navigator.msMaxTouchPoints,\n isMstouch = (msMaxTouchPoints && msMaxTouchPoints > 0);\n\n\n // Modernizr extraction to remove dependance on Partners having Modernizrs enabled and synced with our version and extensions.\n //\n var injectElementWithStyles = function(rule, callback, nodes, testnames) {\n\n var style, ret, node,\n div = document.createElement('div'),\n body = document.body,\n fakeBody = body ? body : document.createElement('body');\n\n if (parseInt(nodes, 10)) {\n while (nodes--) {\n node = document.createElement('div');\n node.id = testnames ? testnames[nodes] : 'modernizr' + (nodes + 1);\n div.appendChild(node);\n }\n }\n\n style = ['&#173;', '<style id=\"s', 'modernizr', '\">', rule, '</style>'].join('');\n div.id = 'modernizr';\n (body ? div : fakeBody).innerHTML += style;\n fakeBody.appendChild(div);\n if (!body) {\n fakeBody.style.background = \"\";\n docElement.appendChild(fakeBody);\n }\n\n ret = callback(div, rule);\n if (!body) {\n fakeBody.parentNode.removeChild(fakeBody);\n } else {\n div.parentNode.removeChild(div);\n }\n\n return !!ret;\n\n };\n\n var isTouch,\n prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');\n\n\n if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {\n isTouch = true;\n } else {\n injectElementWithStyles(['@media (', prefixes.join('touch-enabled),('), 'modernizr', ')', '{#modernizr{top:9px;position:absolute}}'].join(''), function(node) {\n isTouch = node.offsetTop === 9;\n });\n }\n\n\n if ($pn.size() > 0) {\n $pn.each(function() {\n var newdiv = document.createElement(\"div\");\n var newClass = (isMobileDevice ? \"mobiledevice \" : \"no-mobiledevice \") + (isIpad ? \"ipad \" : \"no-ipad \") + (isMstouch ? \"mstouch \" : \"no-mstouch \") + (isTouch ? \"touch \" : \"no-touch \");\n newdiv.className = newClass;\n $(this).children().prependTo(newdiv);\n $(this).prepend(newdiv);\n });\n }\n }", "function adjustForScreenSize() {\n\n // screens that have lower pixel ratios or larger (than iPad's 1024x768) resolutions are probably desktops,\n // so don't go to mobile mode in this case.\n // const probablyDesktop = (window.devicePixelRatio < 1.5 || !window.devicePixelRatio) || window.screen.width > 1024;\n // console.info(\"probablyDesktop:\", probablyDesktop);\n // commented out because small viewports, whether on desktop or mobile devices, work better in mobile mode,\n // and failing to detect correctly risks serving the wrong content on the wrong devices.\n // IOW, leave well enough alone.\n\n if ( bypassedWarning || /*probablyDesktop || */(window.innerWidth >= MIN_ALLOWED_WIDTH && window.innerHeight >= MIN_ALLOWED_HEIGHT) ) {\n\n //if ( MOBILE_ENABLED ) {\n\n //nonMobileElements.forEach( el => el.style.removeProperty( 'display' ) );\n //mobileElements.forEach( el => el.style.display = 'none' );\n document.querySelector( 'body' ).classList.remove( 'small-screen' );\n\n //} else {\n //\n //\tdocument.querySelector( 'body' ).classList.remove( 'small-screen-warning' );\n //\tdocument.querySelector( '#warning' ).innerHTML = '';\n //\tdocument.querySelector( '#app-container' ).classList.remove( \"hidden\" );\n //\n //}\n\n // allow resetting this flag regardless of targeting mobile or desktop\n screenIsSmall = false;\n\n } else {\n\n document.querySelector( 'body' ).classList.add( 'small-screen' );\n\n // only ever set this flag when targeting mobile\n screenIsSmall = true;\n\n }\n\n checkForLandscape();\n\n\t\t// set up appStrings\n appStrings( getLanguagePref(), screenIsSmall );\n\n return screenIsSmall;\n\n }", "function viewToMobile_Browser() {\n document.isMobile_Browser = true;\n viewMobile_Browser();\n}", "function productMobileLayout() {\r\n let section = document.querySelector('.product-section');\r\n if (window.innerWidth <= 991 && !section.classList.contains('mob-active')) {\r\n section.classList.add('mob-active');\r\n let rowContainer = section.querySelectorAll('.row-container'),\r\n heading = section.querySelectorAll('.table-heading .product-cell');\r\n for (let i = 0; i < rowContainer.length; i++) {\r\n let content = rowContainer[i].querySelector('.product-content'),\r\n rowCell = rowContainer[i].querySelectorAll('.product-cell'),\r\n container = document.createElement('div');\r\n container.className = 'mob-content';\r\n container.innerHTML = '<div class=\"table-mob-content\"></div><div class=\"table-mob-btn\"></div>';\r\n content.appendChild(container);\r\n for (let a = 1; a < heading.length; a++) {\r\n let headingTxt = heading[a].querySelector('p'),\r\n div = document.createElement('div'),\r\n cellCopy = rowCell[a].cloneNode(true),\r\n pos;\r\n div.className = 'mob-row';\r\n if (headingTxt !== null) {\r\n headingTxt = headingTxt.textContent;\r\n pos = container.querySelector('.table-mob-content');\r\n div.innerHTML = '<div class=\"mob-title\"><p>' + headingTxt +'</p></div>';\r\n } else {\r\n pos = container.querySelector('.table-mob-btn');\r\n }\r\n div.appendChild(cellCopy);\r\n pos.appendChild(div);\r\n }\r\n }\r\n }\r\n}", "function resizeMobileFunctions() {\n\t\tif ( !productGalleryThumbsSliderInitialized ) initSlickProductGallerySlider();\n\t}", "function Comprador_elementsExtraJS() {\n // screen (Comprador) extra code\n /* mobilelist_11 */\n listView = $(\"#Comprador_mobilelist_11\");\n theme = listView.attr(\"data-theme\");\n if (typeof theme !== 'undefined') {\n var themeClass = \"ui-btn-up-\" + theme;\n listItem = $(\"#Comprador_mobilelist_11 .ui-li-static\");\n $.each(listItem, function(index, value) {\n $(this).addClass(themeClass);\n });\n }\n /* mobilelistitem_12 */\n /* mobilelistitem_14 */\n /* mobilelistitem_16 */\n /* mobilelistitem_109 */\n }", "function resize_screen_components(){\n // resizing of technologies\n\n // toggle visibility of show more info button on tech page when screen is at designated sizes\n var $temp_width = 768; // iPad width\n // if($(window).width() <= $temp_width && window.orientation === 0){\n if(window.matchMedia(`(max-width: ${$temp_width}px) and (-webkit-min-device-pixel-ratio: 2)`).matches){\n if(!$('.show_more_toggle').hasClass('visible')){\n $('.show_more_toggle').toggleClass('visible');\n }\n }else{\n if($('.show_more_toggle').hasClass('visible')){\n $('.show_more_toggle').toggleClass('visible');\n }\n }\n\n var elt_count = $('.circle-container li.tech').length;\n var circle_radius = $('.circle-container').outerWidth() / 2;\n\n for(var i = 0; i < elt_count; i++){\n var $elt = $(`.circle-container > .tech:nth-of-type(${i+1})`);\n var $attr = $elt.attr('loc');\n $elt.css({\n 'transform': `rotateZ(${rot_array[i]}deg) translate(${circle_radius}px) rotateZ(${-1*rot_array[i]}deg)`\n });\n }\n}", "function menuLayout() {\n if (homepage.width() > homepage.height()) {\n mobMenuItem.addClass(\"mobile-menu-horizontal\");\n mobMenuItem.removeClass(\"mobile-menu-vertical\");\n } else {\n mobMenuItem.addClass(\"mobile-menu-vertical\");\n mobMenuItem.removeClass(\"mobile-menu-horizontal\");\n }\n }", "function _exitMobile() {\r\n\t\t\thome.viewformat = 'large';\r\n\t\t}", "function checkAndSetMobileScreenSize() {\r\n if(window.innerWidth <= 768) {\r\n var viewer = document.getElementById(\"viewer\");\r\n if(window.innerWidth < window.innerHeight) {\r\n // less than full viewport height if portrait mode\r\n viewer.style.height = \"350px\";\r\n } else {\r\n // full viewport height when landscape mode\r\n viewer.style.height = window.innerHeight + \"px\";\r\n }\r\n }\r\n }", "function viewToDesktop_Browser() {\n // Remove slick\n $(\"#browserView\").slick(\"unslick\");\n $(\".slide\").removeAttr(\"tabindex\");\n document.isMobile_Browser = false;\n viewDesktop_Browser();\n}", "function resizeMobileObjects() {\n void 0;\n}", "function resize() {\n var oldValue = isPhone;\n isPhone = !matchMedia('only screen and (min-width: 641px)').matches;\n\n if (oldValue !== isPhone) {\n // Update the min/max position for drag\n window.setTimeout(function () {\n var i = sidePanels.length - 1;\n\n for (; i >= 0; i--) {\n var sb = sidePanels[i];\n sb.snapper.settings({\n maxPosition: sb.el.clientWidth,\n minPosition: -sb.el.clientWidth\n });\n }\n }, 500); // finaly update settings\n\n render();\n }\n }", "_update() {\n // Mobile\n if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) {\n this.$element.show();\n this.$targetMenu.hide();\n }\n\n // Desktop\n else {\n this.$element.hide();\n this.$targetMenu.show();\n }\n }", "function screenAdapter() {\r\n var screenHeight = $(window).height();\r\n $('.screen-adapter').css(\"height\", screenHeight);\r\n}", "function setup()\n{\n if (window.innerWidth > 1815)\n {\n $(\"#introduction\").html(\"I'm Noah Voogd, a 26 year old creative developer<br>living in Utrecht, the Netherlands.\")\n }\n else\n {\n $(\"#introduction\").html(\"I'm Noah Voogd, a 26 year old creative developer living in Utrecht, the Netherlands.\")\n }\n\n $(\".work-text-container\").each(function()\n {\n $(this).css(\"top\", \"calc(50% -\" + ((window.innerHeight - $(this).height()) / 2) + \")\");\n });\n\n var tabletHeight = $(\".device-container.tablet\").height();\n\n if ($(\".device-container.tablet\").height() / $(\".device-container.tablet\").width() > 1.558)\n {\n tabletHeight = $(\".device-container.tablet\").width() * 1.558;\n }\n\n var tabletArrowTop = $(\".device-container.tablet\").height() - (($(\".device-container.tablet\").height() - tabletHeight) / 2) - (0.08 * tabletHeight);\n $(\".tablet .back-arrow, .tablet .forward-arrow\").css({\n \"margin-top\": tabletArrowTop + \"px\",\n \"height\": 0.05 * tabletHeight,\n \"width\": 0.483 * (0.05 * tabletHeight)\n });\n\n var laptopHeight = $(\".device-container.laptop\").height();\n\n if ($(\".device-container.laptop\").height() / $(\".device-container.laptop\").width() > 0.649)\n {\n laptopHeight = $(\".device-container.laptop\").width() * 0.649;\n }\n\n var laptopArrowTop = $(\".device-container.laptop\").height() - (($(\".device-container.laptop\").height() - laptopHeight) / 2) - (0.205 * laptopHeight);\n $(\".laptop .back-arrow, .laptop .forward-arrow\").css({\n \"margin-top\": laptopArrowTop + \"px\",\n \"height\": 0.052 * laptopHeight,\n \"width\": 0.483 * (0.052 * laptopHeight)\n });\n\n $(\".tablet .back-arrow, .laptop .back-arrow\").css({\n \"margin-left\": \"calc(45% -\" + (0.483 * (0.052 * laptopHeight)) + \"px)\"\n });\n\n $(\".tablet .forward-arrow, .laptop .forward-arrow\").css({\n \"margin-left\": \"calc(55% -\" + (0.483 * (0.052 * laptopHeight)) + \"px)\"\n });\n\n var laptopWidth = $(\".device-container.laptop\").width();\n var laptopHeight = $(\".device-container.laptop\").height();\n\n if (laptopWidth / laptopHeight > 1.539)\n {\n laptopWidth = laptopHeight * 1.539;\n }\n else\n {\n laptopHeight = laptopWidth * 0.649;\n }\n\n $(\".device-container.laptop\").each(function()\n {\n var scrollTrigger = $(this).find('.scroll-trigger');\n var scrollMargin = 0;\n if (!onePageScrollActive)\n {\n scrollMargin = 30;\n }\n\n if (scrollTrigger.length)\n {\n $(scrollTrigger).css(\"margin-top\", (-laptopHeight * 0.0682 + scrollMargin) + \"px\"); \n var leftMarg = ($(\".device-container.laptop\").width() - laptopWidth) / 2;\n $(scrollTrigger).css(\"margin-left\", leftMarg + laptopWidth * 0.107);\n\n $(scrollTrigger).css(\"width\", laptopWidth * 0.786);\n $(scrollTrigger).css(\"height\", laptopHeight * 0.722);\n }\n });\n\n var deviceTopMargin = ($(\".device-container.laptop\").height() - laptopHeight) / 2;\n var laptopFrameTop = laptopHeight * 0.069;\n var laptopFrameBottom = laptopHeight * 0.21;\n var laptopScreenHeight = laptopWidth * 0.47 + deviceTopMargin + laptopFrameTop;\n laptopScrollTop = deviceTopMargin + laptopFrameTop;\n\n $(\".scroll-imgs .slide-img\").css(\"background-position\", \"0% \" + laptopScrollTop + \"px\");\n $(\".scroll-imgs .slide-img\").css({\n \"-webkit-clip-path\": \"polygon(0 \" + laptopScrollTop + \"px, 100% \" + laptopScrollTop + \"px, 100% \" + laptopScreenHeight + \"px, 0 \" + laptopScreenHeight + \"px)\",\n \"clip-path\": \"polygon(0 \" + laptopScrollTop + \"px, 100% \" + laptopScrollTop + \"px, 100% \" + laptopScreenHeight + \"px, 0 \" + laptopScreenHeight + \"px)\"\n });\n\n $(\".scroll-imgs .slide-img\").each(function()\n {\n var ratio = $(this).attr(\"class\").split(' ')[1];\n var imageHeight = laptopWidth * ratio;\n \n var laptopScrollBottom = -((Math.abs(imageHeight - laptopHeight) / 2) - (($(\".device-container.laptop\").height() - imageHeight) / 2)) - laptopFrameBottom;\n $(this).attr(\"scroll-bottom\", laptopScrollBottom);\n });\n}", "function showView(){\n\t\tif (document.body.clientWidth <= mobileViewSize) {//for mobile view\n\t\t\tmoveDataInMobileView('#tbcmsdesktop-main-menu', '#tbcmsmobile-horizontal-menu');\n\t\t \tmoveDataInMobileView('.tbcmsheader-nav-right', '#tbcmsmobile-header-right');\n\t\t \tmoveDataInMobileView('#tbcmsdesktop-logo', '#tbcmsmobile-header-logo');\n\n\t\t}else{//for desktop view\n\t\t\tmoveDataInDesktopView('#tbcmsdesktop-main-menu', '#tbcmsmobile-horizontal-menu');\n\t\t\tmoveDataInDesktopView('.tbcmsheader-nav-right', '#tbcmsmobile-header-right');\n\t\t\tmoveDataInDesktopView('#tbcmsdesktop-logo', '#tbcmsmobile-header-logo');\n\t\t}\n\n\t}//showView", "function mobile_newlayout() {\r\n\r\n /* get url string */\r\n var urlarr = url.split('/');\r\n // console.log(urlarr);\r\n /* check if url have mobile and have 4 element data then redirect to the string link */\r\n if ((urlarr[3].match(\"mobile\") !== null) && (urlarr.length == 4)) {\r\n location.href = \"/commerce/buyside/commerce_manager.jsp?bm_cm_process_id=36244034&from_hp=true&_bm_trail_refresh_=true\";\r\n return false;\r\n }\r\n\r\n /* get title text */\r\n pagetitle = $('title').text().toLowerCase();\r\n console.log(pagetitle);\r\n\r\n /*\r\n $('.tab-link').bind(\"tap\", function() {\r\n console.log($(this));\r\n });*/\r\n /* if if pagetitle is empty then call functoon mobile_newlayout() */\r\n\r\n /* comment this function for showing page without checkin page title */\r\n /*if (pagetitle == '') {\r\n setTimeout(function() {\r\n mobile_newlayout();\r\n }, 2000);\r\n\r\n return;\r\n }*/\r\n\r\n /* hide element if jg-overlay */\r\n $('#jg-overlay').hide();\r\n\r\n /*\r\n Start : 4 Mei 2017\r\n Task : Debug order page + create filter page mobile with URL.\r\n Page : Global mobile page\r\n File Location : $BASE_PATH$/image/javascript/js-ezrx.js\r\n Layout : Mobile\r\n\r\n if pagetile not null call default function\r\n */\r\n\r\n $('html').addClass('jg-mobilelayout');\r\n if (pagetitle != '') {\r\n\r\n /* add class jg-mobilelayout */\r\n if (pagetitle == 'login') {\r\n /* if pagetitle login then call function mobile_loginpage */\r\n // mobile_loginpage();\r\n // transform_loginpage();\r\n } else {\r\n /* if pagetitle commerce then call transform_mainlayout and transform_orderspage */\r\n clearStorageOrderItem();\r\n if (pagetitle == 'commerce management') {\r\n console.log('commerce management');\r\n localStorage.removeItem(\"frequentlyAccessedCustomers_t\"); \r\n $('html').addClass('jg-mobilelayout');\r\n transform_mainlayout();\r\n transform_orderspage();\r\n mobile_commerce_management();\r\n mobile_modifyMenu();\r\n $(\".topMenuModified\").css(\"float\", \"none\");\r\n $(\".jg-item-mainmenu\").css(\"width\", \"70px\");\r\n $(\".jg-box-topbar\").append(\"<div style='float:right; font-size: 14px; padding: 20px;' >\" + window._BM_USER_LOGIN + \"</div>\");\r\n if(getQueryVariableUrl(\"flag\") == \"rightnow\"){\r\n window.sessionStorage.setItem(\"flag\", \"rightnow\");\r\n }\r\n\r\n var flag = window.sessionStorage.getItem(\"flag\");\r\n if(flag == \"rightnow\"){\r\n dss_view();\r\n }\r\n\r\n /*\r\n Start : 12 Juli 2018\r\n Task : New Order & Copy Order action to be hidden For Credit Control Rep.\r\n Page : Commerce Management\r\n File Location : $BASE_PATH$/image/javascript/js-ezrx.js\r\n Layout : Mobile\r\n */\r\n\r\n var hideMenuForCreditControlUser = function(){\r\n if ($(\"table[onclick*='newTransaction']\").length == 0) {\r\n $(\".jg-linkbtn.new_order\").hide();\r\n $(\".jg-linkbtn.copy_order\").hide();\r\n } \r\n }\r\n hideMenuForCreditControlUser();\r\n\r\n /*\r\n Start : 12 Juli 2018\r\n Task : New Order & Copy Order action to be hidden For Credit Control Rep.\r\n Page : Commerce Management\r\n File Location : $BASE_PATH$/image/javascript/js-ezrx.js\r\n Layout : Mobile\r\n */\r\n\r\n } else if (pagetitle == \"zuellig pharma products\" || pagetitle == \"zuellig pharma order processData\") {\r\n console.log('zuellig pharma products');\r\n } else if (pagetitle == 'zuellig pharma order process') {\r\n console.log('zuellig pharma order process');\r\n } else if (pagetitle == \"my profile\"){\r\n /* \r\n Created By :- Created By Zainal Arifin, Date : 08-03-2018\r\n Task :- Restyling Profile Page\r\n Page :- Profile Page\r\n File Location :- $BASE_PATH$/javascript/js-ezrx.js\r\n Layout :- Desktop\r\n */\r\n // Remove Width 100% on class .jg-mobilelayout .form-input\r\n $(\".jg-mobilelayout .form-input\").attr(\"style\", \"width:auto!important;\");\r\n // Give Padding\r\n $(\"table.dashed-table\").find(\"td\").map(function(index, data){\r\n $(data).css(\"padding\", \"5px 15px 5px 20px\");\r\n });\r\n // Give 100% width in every Input and Select\r\n $(\"input.form-input, select.form-input\").css(\"width\", \"100%\");\r\n // give text align center for checkbox label\r\n $(\"input[type='checkbox'].form-input\").parent().css(\"text-align\",\"center\");\r\n\r\n /* \r\n Created By :- Created By Zainal Arifin, Date : 08-03-2018\r\n Task :- Restyling Profile Page\r\n Page :- Profile Page\r\n File Location :- $BASE_PATH$/javascript/js-ezrx.js\r\n Layout :- Desktop\r\n */\r\n } else if (pagetitle == \"change password\"){\r\n /* \r\n Created By :- Created By Zainal Arifin, Date : 27 April 2018\r\n Task :- SG-40 Change Password for mobile\r\n Page :- Model Configuration\r\n File Location :- $BASE_PATH$/javascript/js-ezrx-tw.js\r\n Layout :- Desktop\r\n */\r\n\r\n console.log(\"change password script\");\r\n\r\n var readyChangePasswordPage = function(){\r\n setTimeout(function(){\r\n if (isLoadingDone()) {\r\n $(\"h1.ui-title\").css({ \"background\": \"#00575d\", \"color\": \"#ffffff\" });\r\n $(\"#main-content\").attr(\"style\", \"margin-top: 70px!important\");\r\n $(\"#change-pw-form\").css(\"height\", \"550px\");\r\n $(\"#errors\").after($(\"<div id='error_js' style='width: 41%;margin: auto auto 10px;' ></div>\"));\r\n $(\"#submit\").attr(\"style\", \"background: #005E63!important;color: #ffffff;padding: 5px 10px;font-size: 20px;\");\r\n var html_password_restriction = '<fieldset style=\"margin-left: 5px;margin-top: 100px;position:relative;border-top-width: 2px;border-right-width: 2px;border-bottom-width: 2px;border-left-width: 2px;border-top-style: groove;border-right-style: groove;border-bottom-style: groove;border-left-style: groove;padding: 10px;\">\\\r\n <legend class=\"form-label\" style=\"font-weight: bold;\" >&nbsp;Password Restrictions&nbsp;</legend>\\\r\n Password must be between 8 to 30 characters long and it should start with a letter. Password must have at least one upper case letter, at least one number and at least one special character.\\\r\n </fieldset>';\r\n $(\"#submit\").after(html_password_restriction);\r\n\r\n $(\"#change-pw-form\").on(\"submit\", function (e) {\r\n // e.preventDefault();\r\n var oldPassword = $(\"input[name='_oldPassword']\").val();\r\n var newPassword = $(\"input[name='_newPassword']\").val();\r\n var newPassword2 = $(\"input[name='_retypedPassword']\").val();\r\n var divError = $(\"#error_js\");\r\n $(divError).html(\"\");\r\n if (newPassword.length > 0 && oldPassword.length > 0) {\r\n\r\n if (newPassword == newPassword2) {\r\n if (newPassword.length >= 8 && newPassword.length <= 30) {\r\n if (/^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!@#$%^&*()-_=+])[A-Za-z\\d!@#$%^&*()-_=+]{8,30}$/.test(newPassword) == false) {\r\n console.log(\"Password must have at least one upper case letter, at least one number and at least one special character.\");\r\n $(divError).append(\"<div class='error'>Password must have at least one upper case letter, at least one number and at least one special character.</div>\");\r\n } else {\r\n console.log(\"Submitted to system\");\r\n return true;\r\n }\r\n } else {\r\n console.log(\"Password must be between 8 and 30 characters.\");\r\n $(divError).append(\"<div class='error'>Password must be between 8 and 30 characters.</div>\");\r\n }\r\n }\r\n\r\n /* if (newPassword != newPassword2) {\r\n console.log(\"New Password and Retype New Password not match\");\r\n $(divError).append(\"<div class='error'>New Password and Retype New Password not match</div>\");\r\n } else {\r\n \r\n } */\r\n }\r\n e.preventDefault();\r\n });\r\n } else {\r\n readyChangePasswordPage();\r\n }\r\n }, 500);\r\n }\r\n\r\n readyChangePasswordPage();\r\n\r\n /* \r\n Created By :- Created By Zainal Arifin, Date : 27 April 2018\r\n Task :- SG-40 Change Password for mobile\r\n Page :- Model Configuration\r\n File Location :- $BASE_PATH$/javascript/js-ezrx-tw.js\r\n Layout :- Desktop\r\n */\r\n }\r\n\r\n mobile_adjustcontenttop();\r\n }\r\n\r\n } else {\r\n /* if oagetitle is null call custom filter from URL */\r\n /* create filterPage get last string of URL */\r\n var filterPage = urlarr[urlarr.length - 1];\r\n /* if filterPage contains with commerce */\r\n console.log('filterPage', filterPage);\r\n if ($(\"#line-item-grid\").length > 0 && filterPage.search(\"copy_processing.jsp\") == -1 ){\r\n filterPage = \"commerce\";\r\n\t\t\t}\r\n\t\t\tif($(\"#materialArrayset\").length > 0){\r\n\t\t\t\tfilterPage = \"config\";\r\n\t\t\t}\r\n\r\n if (filterPage.search(\"commerce\") != -1) {\r\n //[new] order & material page\r\n // var checkVariable = filterPage.split(\"?\");\r\n if ($(\"#tab-draftOrder\").exists()) {\r\n //[new] order\r\n console.log(\"New order\");\r\n \r\n var customer_selection = function(){\r\n mobile_orderpage();\r\n mobile_customerSearch();\r\n if ($('#frequentlyAccessedCustomers_t').length) {\r\n var customerDetails = $(\"#frequentlyAccessedCustomers_t\").val().replace(/~/gi, \"\");\r\n console.log(\"frequentlyAccessedCustomers_t is\", (customerDetails.length > 0) ? \"Not Empty\" : \"Empty\", \"The data is : \" + customerDetails); \r\n if (customerDetails.length > 0) {\r\n window.localStorage.setItem(\"frequentlyAccessedCustomers_t\", customerDetails);\r\n } else {\r\n customerDetails = (window.localStorage.getItem(\"frequentlyAccessedCustomers_t\") != null ? window.localStorage.getItem(\"frequentlyAccessedCustomers_t\") : \"\"); \r\n }\r\n $(\"#frequentlyAccessedCustomers_t\").val(\"\");\r\n if (customerDetails.length == 0) {\r\n return true;\r\n } else {\r\n mobile_topCustomerList(customerDetails);\r\n mobile_toggleTopCustomer();\r\n }\r\n }\r\n }\r\n\r\n $(\"body\").on(\"click touchend\",\"#tab-draftOrder\",function(e){\r\n function draftOrder(){\r\n setTimeout(function(){\r\n if( $(\".ui-loader.ui-corner-all\").css(\"display\") == \"none\" ){\r\n customer_selection();\r\n }else{\r\n draftOrder();\r\n }\r\n }, 1000);\r\n }\r\n draftOrder();\r\n });\r\n \r\n customer_selection();\r\n\r\n //VMLSINOZP-61 start\r\n //console.log('VMLSINOZP-61',1);\r\n //setTimeout(function(){\r\n console.log('VMLSINOZP-61',1);\r\n var _61 = setInterval(function(){\r\n console.log('VMLSINOZP-61',2);\r\n if(document.readyState === 'complete') {\r\n console.log('VMLSINOZP-61',3);\r\n //save_to_newuser();\r\n //document.addEventListener(\"DOMContentLoaded\", function(){\r\n console.log('VMLSINOZP-61',4);\r\n newCustId = sessionStorage.getItem('selectedCustShipID');\r\n console.log('newCustId',newCustId);\r\n clearInterval(_61);\r\n if(newCustId != \"null\" && newCustId != null){\r\n console.log('VMLSINOZP-61',5);\r\n //document.cookie = \"selectedCustShipID=\"+null;\r\n sessionStorage.setItem('selectedCustShipID', null);\r\n $(\"#selectedCustomerDetail\").val(newCustId);\r\n $(\"#customerMasterString_t\").val(\"\");\r\n setTimeout(function(){\r\n if($('#sticky-actions button.action-type-modify[data-properties*=\"36246153\"]').length>0){\r\n $('#sticky-actions button.action-type-modify[data-properties*=\"36246153\"]').click();\r\n console.log('VMLSINOZP-61','6-1');\r\n\r\n } else if($('#popup-moreBtns-popup ul.popup-list li:first-child').length>0) {\r\n $('#popup-moreBtns-popup ul.popup-list li:first-child').click();\r\n console.log('VMLSINOZP-61','6-2');\r\n\r\n }\r\n },1500);\r\n\r\n }\r\n //});\r\n }\r\n },500);\r\n function save_to_newuser(){\r\n newCustId = sessionStorage.getItem('selectedCustShipID');\r\n console.log('newCustId',newCustId);\r\n clearInterval(_61);\r\n if(newCustId !=\"null\" && newCustId != null ){\r\n console.log('VMLSINOZP-61',5);\r\n //document.cookie = \"selectedCustShipID=\"+null;\r\n sessionStorage.setItem('selectedCustShipID', null);\r\n $(\"#selectedCustomerDetail\").val(newCustId);\r\n $(\"#customerMasterString_t\").val(\"\");\r\n setTimeout(function(){\r\n if($('#sticky-actions button.action-type-modify[data-properties*=\"36246153\"]').length>0){\r\n $('#sticky-actions button.action-type-modify[data-properties*=\"36246153\"]').click();\r\n console.log('VMLSINOZP-61','6-1');\r\n\r\n } else if($('#popup-moreBtns-popup ul.popup-list li:first-child').length>0) {\r\n $('#popup-moreBtns-popup ul.popup-list li:first-child').click();\r\n console.log('VMLSINOZP-61','6-2');\r\n\r\n }\r\n },1000);\r\n\r\n }\r\n }\r\n //},1500);\r\n //VMLSINOZP-61 end\r\n\r\n } else {\r\n console.log(\"material page\");\r\n // material page.\r\n mobile_materialpage();\r\n mobile_materialSearch();\r\n\r\n\r\n var OverrideBonusQty = setInterval(findOverrideBonusQty, 1000);\r\n\r\n function findOverrideBonusQty() {\r\n\r\n if ($('.cell-overrideBonusQty .ui-flipswitch').length > 0) {\r\n $('.cell-overrideBonusQty .ui-flipswitch').each(function() {\r\n var $this = $(this);\r\n mobile_bonusQtyOverride($this);\r\n });\r\n\r\n $('.cell-overrideBonusQty .ui-flipswitch').on('click', function() {\r\n var $this = $(this);\r\n mobile_bonusQtyOverride($this);\r\n });\r\n clearInterval(OverrideBonusQty);\r\n }\r\n };\r\n\r\n\r\n\r\n mobile_actionButtonFavItem();\r\n }\r\n } else if (filterPage.search(\"config\") != -1) {\r\n console.log(' ====>>>> config page');\r\n\t\t\t\t\r\n\t\t\t\t/* replace messages on top table shopping cart */\r\n\t\t\t\t//$(\"#attribute-showDetailedView\").html(\"<div id='detailMessages' style=color:darkred;float:left;width:100%;margin-top:-10px;margin-bottom:10px;'>Please swipe to see additional details in the shopping cart</div>\");\r\n\t\t\t\t\r\n\t\t\t\t//$(\"#detailMessages\").css({\"color:darkred;float:left;width:100%;margin-top:4px;margin-bottom:4px;\"});\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n //* quantity color change on focus START*//\r\n textColorQty();\r\n\r\n //* quantity color change on focus END*//\r\n //**//\r\n // material page.\r\n setTimeout(function(){\t\t\t\t\t\r\n\t\t\t\t\ttextColorQty();\r\n\t\t\t\t\t// material page.\r\n\t\t\t\t\tmobile_materialpage();\r\n\t\t\t\t\tmobile_materialSearch();\r\n\t\t\t\t\tmobile_adjust_tooltip();\r\n\t\t\t\t\tmobile_pricingChange();\r\n\t\t\t\t\tmobile_onChangeUpdateMsg();\r\n\t\t\t\t\tmobile_shoppingCart_msg();\r\n\t\t\t\t\t//mobile_hide_unwanted_arrow();\r\n\t\t\t\t\t// mobile_customerSearch();\r\n\t\t\t\t}, 2000);\r\n\t\t\t\t\r\n\t\t\t\t$(\"body\").on(\"click touchend\",\".pagination .ui-radio\",function(e){\r\n\t\t\t\t\twaitUntilTableDataLoad();\r\n\t\t\t\t});\r\n\t\t\t\t\r\n\t\t\t\t//checking with timeOut 500ms if load data table is done.\r\n function waitUntilTableDataLoad(){\r\n setTimeout(function(){\r\n if($('#jg-overlay').css(\"display\") == \"none\"){\r\n \r\n\t\t\t\t\t\t\ttextColorQty();\r\n\t\t\t\t\t\t\tmobile_qty_outofstock_color();\r\n\t\t\t\t\t\t\tmobile_adjust_tooltip();\r\n\t\t\t\t\t\t\tmobile_pricingChange();\r\n\t\t\t\t\t\t\tmobile_onChangeUpdateMsg();\r\n //re-assign listen touch pagination on mobile\r\n // listen_touch_pagination();\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t/*setTimeout(function(){\r\n\t\t\t\t\t\t\t //re-styling when table changes page\r\n \t\t\t\t\t\t\tif($(\"#showDetailedView\").val() == \"false\" ){\r\n \t\t\t\t\t\t\t\t\r\n hide_detail_coloumn();\r\n \t\t\t\t\t\t\t}\r\n\r\n style_shoppingcart_table();\r\n\r\n\t\t\t\t\t\t\t}, 1000);*/\r\n }else{\r\n //recursive checking table has load data\r\n waitUntilTableDataLoad();\r\n }\r\n }, 1000);\r\n }\r\n \r\n /* function listen_touch_pagination(){\r\n //listen shopping chart changing page.\r\n console.log(\"Start listen touch pagination\");\r\n\t\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t\t$(\".pagination\").find(\".ui-radio\").off();\r\n\t\t\t\t\t\t$(\".pagination\").find(\".ui-radio\").bind(\"click touchstart touchend\", function(){\r\n\t\t\t\t\t\t\tconsole.log(\"Change Page on table 1\");\r\n\t\t\t\t\t\t\twaitUntilTableDataLoad();\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}, 500);\r\n }\r\n\r\n var waitUntilPageLoad = function(){\r\n setTimeout(function(){\r\n \r\n if($('#jg-overlay').css(\"display\") == \"none\"){\r\n style_shoppingcart_table();\r\n setTimeout(function(){\r\n listen_touch_pagination();\r\n }, 500);\r\n }else{\r\n waitUntilPageLoad();\r\n }\r\n\r\n }, 500);\r\n }*/\r\n\t\t\t\t\r\n\t\t\t\t$(window).on(\"orientationchange\", function(){\r\n\t\t\t\t\twaitUntilTableDataLoad();\r\n\t\t\t\t});\r\n\r\n //waitUntilPageLoad();\r\n\r\n $(\"body\").on(\"click touchend\", \".button-save\", function(e) {\r\n e.preventDefault();\r\n console.log(\" ===>>> clicked on button-save\");\r\n var _needUpdate = $(\"input[name=_needUpdate]\").val();\r\n console.log(\" ===>>> clicked on button-save --> \", _needUpdate);\r\n if (_needUpdate == \"yes\") {\r\n $(\".updateMsg\").show();\r\n return false;\r\n } else {\r\n $(\".updateMsg\").hide();\r\n }\r\n });\r\n mobile_deleteLineItem();\r\n // Check if select any Item have bonus\r\n\r\n var OverrideBonusQty = setInterval(findOverrideBonusQty, 1000);\r\n\r\n function findOverrideBonusQty() {\r\n\r\n if ($('.cell-overrideBonusQty .ui-flipswitch').length > 0) {\r\n $('.cell-overrideBonusQty .ui-flipswitch').each(function() {\r\n var $this = $(this);\r\n mobile_bonusQtyOverride($this);\r\n });\r\n\r\n $('.cell-overrideBonusQty .ui-flipswitch').on('click', function() {\r\n var $this = $(this);\r\n mobile_bonusQtyOverride($this);\r\n });\r\n clearInterval(OverrideBonusQty);\r\n }\r\n };\r\n\r\n $('.sidebar-handle').on('click', function() {\r\n mobile_checkItemOnCart();\r\n });\r\n mobile_actionButtonFavItem();\r\n mobile_checkItemOnCart();\r\n mobile_qty_outofstock_color();\r\n mobile_overRidePriceRed();\r\n\r\n /*\r\n End : 27 Dec 2017\r\n Task : https://jira.uhub.biz/browse/VMLSINOZP-70 [[Desktop/Tablet]Auto Collapse of All Materials is not workin]\r\n Page : Material page / product page\r\n File Location : $BASE_PATH$/image/javascript/js-ezrx.js\r\n Layout : Mobile\r\n */\r\n var allMaterialState = localStorage.getItem('allMaterialsTabState');\r\n var allTopTenFavState = localStorage.getItem('topTenFavTab');\r\n var allFavCustItemState = localStorage.getItem('custFavItemTab');\r\n var allrecomItemState = localStorage.getItem('recomItemTab');\r\n\r\n console.log('allMaterialState', allMaterialState, 'allTopTenFavState', allTopTenFavState, 'allFavCustItemState', allFavCustItemState );\r\n\r\n if (allTopTenFavState == 'collapsed') {\r\n $('#attribute-pastOrders').parent().parent().addClass('ui-collapsible-content-collapsed');\r\n $('#attribute-pastOrders').parent().parent().prev().addClass('ui-collapsible-heading-collapsed');\r\n $('#attribute-pastOrders').parent().parent().prev().children().removeClass('ui-icon-minus').addClass('ui-icon-plus');\r\n $('#attribute-pastOrders').parent().parent().parent().addClass('ui-collapsible-collapsed');\r\n } else {\r\n $('#attribute-pastOrders').parent().parent().removeClass('ui-collapsible-content-collapsed');\r\n $('#attribute-pastOrders').parent().parent().prev().removeClass('ui-collapsible-heading-collapsed');\r\n $('#attribute-pastOrders').parent().parent().prev().children().removeClass('ui-icon-plus').addClass('ui-icon-minus');\r\n $('#attribute-pastOrders').parent().parent().parent().removeClass('ui-collapsible-collapsed');\r\n }\r\n\r\n if (allrecomItemState == 'collapsed') {\r\n $('#attribute-currentUserCompanyName').parent().parent().addClass('ui-collapsible-content-collapsed');\r\n $('#attribute-currentUserCompanyName').parent().parent().prev().addClass('ui-collapsible-heading-collapsed');\r\n $('#attribute-currentUserCompanyName').parent().parent().prev().children().removeClass('ui-icon-minus').addClass('ui-icon-plus');\r\n $('#attribute-currentUserCompanyName').parent().parent().parent().addClass('ui-collapsible-collapsed');\r\n } else {\r\n $('#attribute-currentUserCompanyName').parent().parent().removeClass('ui-collapsible-content-collapsed');\r\n $('#attribute-currentUserCompanyName').parent().parent().prev().removeClass('ui-collapsible-heading-collapsed');\r\n $('#attribute-currentUserCompanyName').parent().parent().prev().children().removeClass('ui-icon-plus').addClass('ui-icon-minus');\r\n $('#attribute-currentUserCompanyName').parent().parent().parent().removeClass('ui-collapsible-collapsed');\r\n }\r\n\r\n if (allFavCustItemState == 'collapsed') {\r\n $('#attribute-currentCustFav').parent().parent().addClass('ui-collapsible-content-collapsed');\r\n $('#attribute-currentCustFav').parent().parent().prev().addClass('ui-collapsible-heading-collapsed');\r\n $('#attribute-currentCustFav').parent().parent().prev().children().removeClass('ui-icon-minus').addClass('ui-icon-plus');\r\n $('#attribute-currentCustFav').parent().parent().parent().addClass('ui-collapsible-collapsed');\r\n } else {\r\n $('#attribute-currentCustFav').parent().parent().removeClass('ui-collapsible-content-collapsed');\r\n $('#attribute-currentCustFav').parent().parent().prev().removeClass('ui-collapsible-heading-collapsed');\r\n $('#attribute-currentCustFav').parent().parent().prev().children().removeClass('ui-icon-plus').addClass('ui-icon-minus');\r\n $('#attribute-currentCustFav').parent().parent().parent().removeClass('ui-collapsible-collapsed');\r\n }\r\n\t\t\t\t//commented by suresh as the all materials should be expanded always for mobile version\r\n\t\t\t\t// uncommented by pratap as per sakthi requirement that for mobile also it will colapse \r\n if (allMaterialState ==='collapsed') {\r\n console.log('collapse material', $('#attribute-materialSearch').parent().parent());\r\n $('#attribute-materialSearch').parent().parent().addClass('ui-collapsible-content-collapsed');\r\n $('#attribute-materialSearch').parent().parent().prev().addClass('ui-collapsible-heading-collapsed');\r\n $('#attribute-materialSearch').parent().parent().prev().children().removeClass('ui-icon-minus').addClass('ui-icon-plus');\r\n $('#attribute-materialSearch').parent().parent().parent().addClass('ui-collapsible-collapsed');\r\n } else {\r\n $('#attribute-materialSearch').parent().parent().removeClass('ui-collapsible-content-collapsed');\r\n $('#attribute-materialSearch').parent().parent().prev().removeClass('ui-collapsible-heading-collapsed');\r\n $('#attribute-materialSearch').parent().parent().prev().children().removeClass('ui-icon-plus').addClass('ui-icon-minus');\r\n $('#attribute-materialSearch').parent().parent().parent().removeClass('ui-collapsible-collapsed');\r\n }\r\n\t\t\t\t//end\r\n /*if ($('.jg-mobilelayout #error-messages ul.constraint-messages').is(':visible')) {\r\n $(\"#config footer\").append(\"<div id='duplicatefooter'><button class='updateButton'>Update</button><button class='saveButton'>Save</button></div>\");\r\n }\r\n $(\"body\").on(\"click touchend\", \"#duplicatefooter .updateButton\", function(e) {\r\n\r\n console.log(\"clicked on custom create transaction\");\r\n e.preventDefault();\r\n if ($(\"#button-bar .button-update\").length != 0) {\r\n $(\"#button-bar .button-update\").trigger('click');\r\n } else {\r\n console.log(\"clicked on custom create transaction1\");\r\n $(\"#popup-moreBtns-popup .popup-nested-inner ul li\").each(function() {\r\n\r\n var liButtonText = $(this).find(\"a\").text().trim();\r\n console.log(\"clicked on custom create transaction==\" + liButtonText);\r\n if (liButtonText == \"Update\") {\r\n console.log(\"clicked on Update\");\r\n $(this).find(\"a\").trigger(\"tap\");\r\n }\r\n });\r\n\r\n //$(\"#popup-moreBtns-popup\").find(\".button-update\").trigger('touchend');\r\n /*$(\"#popup-moreBtns-popup .button-update\").trigger('tap');\r\n console.log(\"clicked on custom create transaction21\");\r\n $(\"#popup-moreBtns-popup .button-update\").trigger('click');\r\n console.log(\"clicked on custom create transaction2\");\r\n */\r\n /*}\r\n });*/\r\n\r\n\r\n /*$(\"#customUpdate\").on('click touchend', function(){\r\n console.log(\"customUpdate customUpdate customUpdate\");\r\n $(\"#popup-moreBtns-popup\").find(\".button-update\").trigger('tap');\r\n $(\"div#popup-moreBtns ul.popup-list li a.button-update\").trigger(\"tap\");\r\n $(\"div#popup-moreBtns ul.popup-list li a.button-update\").trigger(\"click\");\r\n });\r\n $(\"#customCancel\").on('click touchend', function(){\r\n console.log(\"customCancelcustomCancelcustomCancel\");\r\n $(\".button-invoke-return\").trigger(\"click\");\r\n $(\".button-invoke-return\").trigger(\"tap\");\r\n });*/\r\n\r\n /* VMLSINOZP-50 BOF */\r\n /* var remove_constrained_msg = setInterval(mobile_constrained_msg, 1000);\r\n function mobile_constrained_msg(){\r\n\r\n console.error('.constrained class applied');\r\n\r\n if($('.jg-mobilelayout #error-messages ul.constraint-messages').is(':visible')){\r\n console.warn('remove constraint msg');\r\n\r\n var btnHtml = '<button class=\"button-update ui-btn ui-btn-inline\">Update</button>';\r\n\r\n if($('div#popup-moreBtns ul.popup-list li a.button-invoke-return').length>0){\r\n btnHtml+='<button class=\"invocation-button button-invoke-return ui-btn ui-btn-inline cancelButton\">Cancel</button> ';\r\n } else {\r\n btnHtml+='<button class=\"button-cancel ui-btn ui-btn-inline cancelButton\">Cancel</button>';\r\n }\r\n\r\n if(btnHtml.length!==0){\r\n $('.jg-mobilelayout footer #button-bar').html(btnHtml).undelegate();\r\n //$( \"body\" ).undelegate( \"#button-bar\", \"scroll\");\r\n }\r\n\r\n clearInterval(remove_constrained_msg);\r\n }\r\n\r\n\r\n }\r\n $(\"body\").on(\"click touchend tap\",\"#button-bar .cancelButton\",function(e){\r\n if($('div#popup-moreBtns ul.popup-list li a.button-invoke-return').length>0){\r\n console.warn('clicked 1');\r\n\r\n\r\n }else{\r\n console.warn('clicked 2');\r\n\r\n }\r\n });\r\n\r\n\r\n\r\n setTimeout(function(){\r\n console.log('remove_constrained_msg - settimeout');\r\n clearInterval(remove_constrained_msg);\r\n },15000);*/\r\n\r\n /* VMLSINOZP-50 EOF */\r\n }\r\n /* if filterPage contains with copy_processing.jsp */\r\n else if (filterPage.search(\"copy_processing.jsp\") != -1) {\r\n //[copy] order\r\n mobile_orderpage();\r\n mobile_materialSearch();\r\n mobile_actionButtonFavItem();\r\n mobile_redirect_materialpage();\r\n\r\n /* if filterPage contains with document.jsp */\r\n } else if (filterPage.search(\"document.jsp\") != -1) {\r\n //[process] order\r\n console.log(\"Proses Order page\");\r\n\r\n var customer_selection = function(){\r\n mobile_orderpage();\r\n mobile_customerSearch();\r\n\r\n if ($('#frequentlyAccessedCustomers_t').length > 0) {\r\n var customerDetails = $(\"#frequentlyAccessedCustomers_t\").val().replace(/~/gi, \"\");\r\n console.log(\"frequentlyAccessedCustomers_t is\", (customerDetails.length > 0) ? \"Not Empty\" : \"Empty\", \"The data is : \" + customerDetails); \r\n if (customerDetails.length > 0) {\r\n localStorage.setItem(\"frequentlyAccessedCustomers_t\", customerDetails);\r\n } else {\r\n customerDetails = (localStorage.getItem(\"frequentlyAccessedCustomers_t\") != null ? localStorage.getItem(\"frequentlyAccessedCustomers_t\") : \"\"); \r\n }\r\n $(\"#frequentlyAccessedCustomers_t\").val(\"\");\r\n if (customerDetails.length == 0) {\r\n return true;\r\n } else {\r\n mobile_topCustomerList(customerDetails);\r\n mobile_toggleTopCustomer();\r\n }\r\n }\r\n }\r\n\r\n $(\"body\").on(\"click touchend\",\"#tab-draftOrder\",function(e){\r\n function draftOrder(){\r\n setTimeout(function(){\r\n if( $(\".ui-loader.ui-corner-all\").css(\"display\") == \"none\" ){\r\n customer_selection();\r\n }else{\r\n draftOrder();\r\n }\r\n }, 1000);\r\n }\r\n draftOrder();\r\n });\r\n \r\n customer_selection();\r\n \r\n /* if filterPage contains with commerce_manager.jsp */\r\n } else if (filterPage.search(\"commerce_manager.jsp\") != -1) {\r\n //Commerce Management\r\n console.log(\"Commerce page\");\r\n localStorage.removeItem(\"frequentlyAccessedCustomers_t\");\r\n incompleteOrder();\r\n\r\n /* if filterPage contains with edit_profile.jsp */\r\n } else if (filterPage.search(\"edit_profile.jsp\") != -1) {\r\n //Profile\r\n console.log(\"Profile page\");\r\n } else if (filterPage.search(\"change-password\") != -1){\r\n /* \r\n Created By :- Created By Zainal Arifin, Date : 27 April 2018\r\n Task :- SG-40 Change Password for mobile\r\n Page :- Model Configuration\r\n File Location :- $BASE_PATH$/javascript/js-ezrx-tw.js\r\n Layout :- Desktop\r\n */\r\n\r\n console.log(\"change password script\");\r\n\r\n var readyChangePasswordPage = function () {\r\n setTimeout(function () {\r\n if (isLoadingDone()) {\r\n $(\"h1.ui-title\").css({ \"background\": \"#00575d\", \"color\": \"#ffffff\" });\r\n $(\"#main-content\").attr(\"style\", \"margin-top: 70px!important\");\r\n $(\"#change-pw-form\").css(\"height\", \"550px\");\r\n $(\"#errors\").after($(\"<div id='error_js' style='width: 41%;margin: auto auto 10px;' ></div>\"));\r\n $(\"#submit\").attr(\"style\", \"background: #005E63!important;color: #ffffff;padding: 5px 10px;font-size: 20px;\");\r\n\r\n var html_password_restriction = '<fieldset style=\"margin-left: 5px;margin-top: 100px;position:relative;border-top-width: 2px;border-right-width: 2px;border-bottom-width: 2px;border-left-width: 2px;border-top-style: groove;border-right-style: groove;border-bottom-style: groove;border-left-style: groove;padding: 10px;\">\\\r\n <legend class=\"form-label\" style=\"font-weight: bold;\" >&nbsp;Password Restrictions&nbsp;</legend>\\\r\n Password must be between 8 to 30 characters long and it should start with a letter. Password must have at least one upper case letter, at least one number and at least one special character.\\\r\n </fieldset>';\r\n $(\"#submit\").after(html_password_restriction);\r\n\r\n $(\"#change-pw-form\").on(\"submit\", function (e) {\r\n // e.preventDefault();\r\n var oldPassword = $(\"input[name='_oldPassword']\").val();\r\n var newPassword = $(\"input[name='_newPassword']\").val();\r\n var newPassword2 = $(\"input[name='_retypedPassword']\").val();\r\n var divError = $(\"#error_js\");\r\n $(divError).html(\"\");\r\n if (newPassword.length > 0 && oldPassword.length > 0) {\r\n\r\n if (newPassword == newPassword2) {\r\n if (newPassword.length >= 8 && newPassword.length <= 30) {\r\n if (/^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!@#$%^&*()-_=+])[A-Za-z\\d!@#$%^&*()-_=+]{8,30}$/.test(newPassword) == false) { \r\n console.log(\"Password must have at least one upper case letter, at least one number and at least one special character.\");\r\n $(divError).append(\"<div class='error'>Password must have at least one upper case letter, at least one number and at least one special character.</div>\");\r\n } else {\r\n console.log(\"Submitted to system\");\r\n return true;\r\n }\r\n } else {\r\n console.log(\"Password must be between 8 and 30 characters.\");\r\n $(divError).append(\"<div class='error'>Password must be between 8 and 30 characters.</div>\");\r\n }\r\n }\r\n\r\n /* if (newPassword != newPassword2) {\r\n console.log(\"New Password and Retype New Password not match\");\r\n $(divError).append(\"<div class='error'>New Password and Retype New Password not match</div>\");\r\n } else {\r\n \r\n } */\r\n }\r\n e.preventDefault();\r\n });\r\n } else {\r\n readyChangePasswordPage();\r\n }\r\n }, 500);\r\n }\r\n\r\n readyChangePasswordPage();\r\n\r\n /* \r\n Created By :- Created By Zainal Arifin, Date : 27 April 2018\r\n Task :- SG-40 Change Password for mobile\r\n Page :- Model Configuration\r\n File Location :- $BASE_PATH$/javascript/js-ezrx-tw.js\r\n Layout :- Desktop\r\n */\r\n }\r\n\r\n }\r\n /*\r\n End : 4 Mei 2017\r\n Task : Debug order page + create filter page mobile with URL.\r\n Page : Global mobile page\r\n File Location : $BASE_PATH$/image/javascript/js-ezrx.js\r\n Layout : Mobile\r\n */\r\n }", "function desktopOrMobile() {\n if (screen.width > 1024) {\n createCards();\n } else {\n createMobileCards();\n }\n}", "function relatedListAdjust () {\r\n\r\n\t\t\t//check if Desktop/Tablet\r\n\t\t\tif($('.search-top-related-list').css('display') == 'block') {\r\n\r\n\t\t\t\t$('.search-top-related-list li').css('display', 'inline');\r\n\r\n\t\t\t\t$('.search-top-related-list-more').css('display', 'none');\r\n\t\t\t}\r\n\r\n\t\t\t//Mobile\r\n\t\t\telse {\r\n\r\n\t\t\t\t$('.search-top-related-list li:not(:nth-child(1)):not(:nth-child(2)):not(:nth-child(3))').css('display', 'none');\r\n\r\n\t\t\t\t$('.search-top-related-list-more').css('display', 'inline');\r\n\t\t\t}\r\n\t\t}", "function setDesktop () {\n desktopStartUp()\n $('.desktopVersion').show()\n $('.mobileVersion').hide()\n $('.pasajeros-vuelo-mobile').hide()\n pintarTabla('.plane-seats')\n }", "function deviceControll() {\n if( windowSize( 'width' ) < 768 ) {\n $('body').removeClass('desktop').removeClass('tablet').addClass('mobile');\n }\n else if( windowSize( 'width' ) < 992 ){\n $('body').removeClass('mobile').removeClass('desktop').addClass('tablet');\n }\n else {\n $('body').removeClass('mobile').removeClass('tablet').addClass('desktop');\n }\n }", "_adaptViewWrapSizes() {\n this._adaptViewWidth();\n this._adaptViewHeight();\n }", "function viewToMobile_Master() {\n document.isMobile_Master = true;\n viewMobile_Master();\n}", "function desktopDevice() {\n\tdocument.getElementById(\"template-preview\").classList.add('desktop-device-preview');\n\tdocument.getElementById(\"template-preview\").classList.remove('full-screen-preview');\n\tdocument.getElementById(\"template-preview\").classList.remove('tablet-device-preview');\n\tdocument.getElementById(\"template-preview\").classList.remove('mobile-device-preview');\n}", "function mobileLanding() {\n\tapp.getView().render('turnto/mobilelanding');\n}", "function addMobileSliders() {\n // slider(s) - remove any existing version and add in desired html\n\n $('#latestupdates *').remove();\n $('#latestupdates').append($('#clonebag-latestupdates').clone().html());\n $('#latestupdates .slides div.luitem').each(function (key, value) {\n $(this).wrap('<div class=\"slide\" />');\n });\n initialiseLatestUpdatesSlider();\n\n $('#keyfacts *').remove();\n $('#keyfacts').append($('#clonebag-keyfacts').clone().html());\n $('#keyfacts .slides div').each(function (key, value) {\n $(this).wrap('<div class=\"slide\" />');\n });\n initialiseKeyFactsSlider();\n}", "function resizePage() {\n\tvar screenWidth = ui.platformWidth();\n\tvar screenHeight = ui.platformHeight();\n\tif (!isIOS) {\n\t\tscreenHeight -= 70;\n\t}\n\tscreenLeft = screenHeight;\n\n\t$.submitButton.top = screenHeight - 70;\n\t$.submitButton.width = screenWidth - 40;\n\tscreenLeft = $.submitButton.top;\n\n\tif (comments == true) {\t\t\n\t\tif (displayAsButton && commentButton == null) {\n\t\t\tcommentButtonEnabled();\n\t\t\tcommentButton.top = screenLeft - 70;\n\t\t\tscreenLeft = commentButton.top;\n\t\t} else if (displayAsButton && commentButton != null) {\n\t\t\tcommentButton.top = screenLeft - 70;\n\t\t\tcommentButton.width = screenWidth - 40;\n\t\t\tcommentArea.width = screenWidth - 40;\n\t\t\tscreenLeft = commentButton.top;\n\t\t} else if (!displayAsButton && commentBox == null) {\n\t\t\tcommentsEnabled();\n\t\t\tcommentBox.top = screenLeft - 70;\n\t\t\tcommentLab.top = screenLeft - 100;\n\t\t\tscreenLeft = commentLab.top;\n\t\t} else if (!displayAsButton && commentBox != null) {\n\t\t\tcommentBox.top = screenLeft - 70;\n\t\t\tcommentLab.top = screenLeft - 100;\n\t\t\tcommentBox.width = screenWidth - 40;\n\t\t\tcommentArea.width = screenWidth - 40;\n\t\t\tscreenLeft = commentLab.top;\n\t\t}\n\t}\n\n\t$.yesButton.top = screenLeft - 100;\n\t$.yesButton.width = screenWidth / 2 - 30;\n\n\t$.noButton.top = screenLeft - 100;\n\t$.noButton.width = screenWidth / 2 - 30;\n\n\tscreenLeft = $.yesButton.top;\n\n\tif (fullScreen == false) {\n\t\tif (!isIOS) {\n\t\t\t$.currentImage.top = 30;\n\t\t}\n\t\t$.currentImage.image = imagePath;\n\t\t$.currentImage.height = screenLeft - 80;\n\t\t$.currentImage.width = \"auto\";\n\t} else {\n\t\t$.currentImage.height = screenHeight - 40 - topSpace;\n\t\t$.currentImage.width = \"auto\";\n\t\t$.currentImage.top = topSpace + 20;\n\t\t$.currentImage.zIndex = 5;\n\t}\n}", "function mobileBits() {\n\t\t\t\t\t\t $(\".mobile-button\").show();\n\t\t\t\t\t\t $(\".menu-primary\").hide(); \n\t\t\t\t\t\t}", "function mobilePanel() {\n\n playBass();\n\n var mobileScreen = new createjs.Container();\n var instructionsScreen = new createjs.Container();\n\n var panelBG = new createjs.Bitmap(queue.getResult(\"panel\"));\n panelBG.x = 0;\n panelBG.y = 50;\n\n //this is the title that the user types in -> default is Squid Hunter - > can have it wrap\n //6.11.18 \n var titleText = new createjs.Text(gameData.Title, \" Bold 23px Comic Sans MS\", \"#000000\");\n titleText.x = panelBG.x + 140;\n titleText.y = panelBG.y + 70;\n titleText.alpha = 0;\n // titleText.maxWidth = 300;\n titleText.lineWidth = 380;\n\n\n // titleText.outline = 1.5;\n\n\n createjs.Tween.get(titleText)\n .wait(600)\n .to({ alpha: 1, visible: true }, 1000)\n .to({ scaleX: 1.5, scaleY: 1.5 }, 2000, createjs.Ease.ElasticOut)\n .to({ color: \"black\" }, 500)\n\n var mobileText = new createjs.Text(\"Are you on mobile?\", \"28px Comic Sans MS\", \"#000000\");\n mobileText.x = panelBG.x + 150;\n mobileText.y = panelBG.y + 230;\n\n //add a tween\n var shadow = new createjs.Shadow(\"#000\", 0, 0, 3);\n mobileText.shadow = shadow;\n titleText.shadow = shadow;\n panelBG.shadow = shadow;\n\n createjs.Tween.get(shadow, { loop: false })\n .to({ offsetX: 5, offsetY: 5, blur: 25 }, 1500, createjs.Ease.quadInOut)\n // .to({ offsetX: 0, offsetY: 0, blur: 0 }, 1500, createjs.Ease.quadInOut);\n\n\n createjs.Tween.get(mobileText)\n .to({ x: 150, y: 300 }, 2000, createjs.Ease.ElasticOut)\n\n\n var yesButton = new createjs.Bitmap(queue.getResult(\"yesbutton\"))\n\n yesButton.regX = 93;\n yesButton.regY = 95;\n yesButton.x = panelBG.x + 200;\n yesButton.y = panelBG.y + 375;\n yesButton.scaleX = yesButton.scaleY = 0.20;\n\n var noButton = new createjs.Bitmap(queue.getResult(\"nobutton\"))\n noButton.regX = 93;\n noButton.regY = 95;\n noButton.x = panelBG.x + 310;\n noButton.y = panelBG.y + 375;\n noButton.scaleX = noButton.scaleY = 0.20;\n\n yesButton.shadow = shadow;\n noButton.shadow = shadow;\n\n //load logo as a sprite\n logoContainer = new createjs.Container();\n var speed = .02;\n var data = {\n images: [queue.getResult(\"logosprite\")],\n frames: {\n width: 700,\n height: 500,\n frames: 2,\n },\n animations: {\n tentacles: [0, 1, \"tentacles\", speed],\n },\n };\n\n var spriteSheet = new createjs.SpriteSheet(data);\n var sprite = new createjs.Sprite(spriteSheet, \"tentacles\");\n logoContainer.addChild(sprite);\n\n //create a tween for the logo\n logoContainer.alpha = 0;\n createjs.Tween.get(logoContainer).wait(500).to({ alpha: 1, visible: true }, 2000).call(handleComplete);\n function handleComplete() {\n\n }\n\n logoContainer.regX = 200;\n logoContainer.regY = 60;\n logoContainer.x = panelBG.x + 480;\n logoContainer.y = panelBG.y + 300;\n logoContainer.scaleX = logoContainer.scaleY = 0.35;\n logoContainer.shadow = shadow;\n\n instructionsScreen.addChild(panelBG, titleText, mobileText, yesButton, noButton, logoContainer);\n\n //create a tween and pass in the yes/no buttons\n createjs.Tween.get(yesButton, {\n loop: false\n }).to({\n rotation: 360,\n scaleX: .4,\n scaleY: .4\n }, 2000);\n\n createjs.Tween.get(noButton, {\n loop: false\n }).to({\n rotation: 360,\n scaleX: .4,\n scaleY: .4\n }, 2000);\n\n var soundContain = createSoundContainer();\n\n self.stage.addChild(instructionsScreen);\n self.stage.addChild(soundContain);\n yesButton.addEventListener(\"click\", yesClick);\n noButton.addEventListener(\"click\", noClick);\n\n function yesClick(event) {\n playBass();\n self.stage.removeChild(instructionsScreen);\n mobileIntroScreen();\n isGameRunning = true;\n }\n\n function noClick(event) {\n self.stage.removeChild(instructionsScreen);\n introductionScreen();\n isGameRunning = true;\n }\n }", "function Facebook_Me_elementsExtraJS() {\n // screen (Facebook_Me) extra code\n\n /* mobiletoggle_28 */\n\n $(\"#Facebook_Me_mobiletoggle_28\").parent().find(\".ui-flipswitch-on\").attr(\"tabindex\", \"4\");\n\n /* mobilelist_36 */\n\n listView = $(\"#Facebook_Me_mobilelist_36\");\n theme = listView.attr(\"data-theme\");\n if (typeof theme !== 'undefined') {\n var themeClass = \"ui-btn-up-\" + theme;\n listItem = $(\"#Facebook_Me_mobilelist_36 .ui-li-static\");\n $.each(listItem, function(index, value) {\n $(this).addClass(themeClass);\n });\n }\n\n /* mobilelistitem_37 */\n\n }", "function moveUpsellsMobile(thisObj) {\n\t if ($(\"input#ctl00_uclHeader1_detect_mobile_vp\").val() == \"mobile_vp\") {\n\t thisObj.find('.basket_options_holder').before('<div class=\"frame_upsell_wrapper\"></div>');\n\n\t }\n\t else {\n\t thisObj.append('<div class=\"frame_upsell_wrapper\"></div>');\n\t }\n\t}", "function loadMobileBrowserDetection() {\n /**\n * jQuery.browser.mobile (http://detectmobilebrowser.com/)\n *\n * jQuery.browser.mobile will be true if the browser is a mobile device\n *\n **/\n (function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);\n}", "bool_renderMobile() {\n return (this.state.windowHeight > this.state.windowWidth);\n }", "function doLayout() {\n var controls = document.querySelector('#controls');\n var controlsHeight = controls.offsetHeight;\n var windowWidth = document.documentElement.clientWidth;\n var windowHeight = document.documentElement.clientHeight;\n var webviewWidth = windowWidth;\n var webviewHeight = windowHeight - controlsHeight;\n \n webview.style.width = webviewWidth + 'px';\n webview.style.height = webviewHeight + 'px'; \n}", "function adjustVisualizationToScreenSize(){\n\tif ( $(\"#visualizationDiv\").width() < MOBILEBREAKPOINT+LEGENDWIDHT+20 \n\t\t|| getHeight() < MOBILEBREAKPOINT+LEGENDWIDHT+20){ \n\t\tMARGIN = 20;\n\t}\n\telse{\n\t\tMARGIN = 100;\n\t}\n\n\tif(getWidth() < getHeight()){ narrowerDimension = getWidth(); }\n\telse{ narrowerDimension = getHeight(); }\n}", "_handleResize() {\n if ($('.navigation-mobile').is(':hidden')) {\n this._toggleMobileNav(false);\n }\n\n this._positionNavigation();\n this._navigationScroll(true);\n }", "function isMobile(){\n return ($(window).width() < settings.switchWidth);\n }", "function isMobile(){\n return ($(window).width() < settings.switchWidth);\n }", "function forceMobile() {\n $('.case-left, .case-right').css('display', 'none');\n}", "function setDeviceSize() {\n screenSizeHeight = screenSizeHeightPX.pinLastValue();\n screenScaleValue = screenScale.pinLastValue();\n}", "function regularStyles() { \n \n \t//create slider if screensize is not mobile\t\n\t$('.bxslider').bxSlider({\n\t\tauto: true,\n\t\tspeed: 2000,\n\t\tpause: 6000,\n\t\ttouchEnabled: false,\n\t\tadaptiveHeight: true\n\t});\t\n\t\n}//end regularStyles", "function pageSetUp() {\n\n\tif ($.device === \"desktop\"){\n\t\t// is desktop\n\t\t\n\t\t// activate tooltips\n\t\t$(\"[rel=tooltip]\").tooltip();\n\t\n\t\t// activate popovers\n\t\t$(\"[rel=popover]\").popover();\n\t\n\t\t// activate popovers with hover states\n\t\t$(\"[rel=popover-hover]\").popover({\n\t\t\ttrigger : \"hover\"\n\t\t});\n\n\t\t// setup widgets\n\t\tsetup_widgets_desktop();\n\t\n\t\t// activate inline charts\n\t\trunAllCharts();\n\t\n\t\t// run form elements\n\t\trunAllForms();\n\n\t} else {\n\t\t\n\t\t// is mobile\n\t\t\n\t\t// activate popovers\n\t\t$(\"[rel=popover]\").popover();\n\t\n\t\t// activate popovers with hover states\n\t\t$(\"[rel=popover-hover]\").popover({\n\t\t\ttrigger : \"hover\"\n\t\t});\n\t\n\t\t// activate inline charts\n\t\trunAllCharts();\n\t\n\t\t// setup widgets\n\t\tsetup_widgets_mobile();\n\t\n\t\t// run form elements\n\t\trunAllForms();\n\t\t\n\t}\n\n}", "function setPlayerGUIbyDevice () {\r\n var device = EM.compatibility.getDevice();\r\n\r\n switch( device ){\r\n case 'tablet':\r\n var src = $('.device').attr('href');\r\n src = src.replace('desktop', 'tablet');\r\n\r\n $('.device').attr('href', src);\r\n break;\r\n case 'mobile':\r\n var src = $('.device').attr('href');\r\n src = src.replace('desktop', 'mobile');\r\n\r\n $('.device').attr('href', src);\r\n break;\r\n }\r\n }", "function runMainProductsTabletSlider() {\n if ($(window).width() >= 768 && $(window).width() < 1152) {\n $(\".mainProducts__list\").slick({\n infinite: false,\n speed: 600,\n arrows:false,\n dots:false,\n swipe:true,\n slidesToShow: 2,\n slidesToScroll: 1,\n });\n $(\".mainProducts__list\").slick('setPosition');\n } else {\n if($(\".cardList-main\").hasClass(\"slick-slider\"))\n $('.cardList-main').slick(\"unslick\");\n }\n }", "function Fast_API_elementsExtraJS() {\n // screen (Fast_API) extra code\n /* mobilecarousel_4*/\n var mobilecarousel_4_options = {\n indicatorsListClass: \"ui-carousel-indicators\",\n showIndicator: true,\n showTitle: true,\n titleBuildIn: false,\n titleIsText: true,\n animationDuration: 250,\n useLegacyAnimation: false,\n enabled: true,\n }\n Apperyio.__registerComponent('mobilecarousel_4', new Apperyio.ApperyMobileCarouselComponent(\"Fast_API_mobilecarousel_4\", mobilecarousel_4_options));\n $(\"#Fast_API_mobilecarouselitem_5\").attr(\"reRender\", \"mobilecarousel_4\");\n $(\"#Fast_API_mobilecarouselitem_6\").attr(\"reRender\", \"mobilecarousel_4\");\n $(\"#Fast_API_mobilecarouselitem_7\").attr(\"reRender\", \"mobilecarousel_4\");\n }", "function initMobile(el){\n\n document.querySelector('.mobile-cards').style.height = el.style.height = getInnerHeight() + 'px';\n\n var hSwipers = el.querySelectorAll('.swiper-container-h');\n var vSwiper = window.gvvertical = el.querySelector('.swiper-container-v');\n var header = document.querySelector('#header');\n\n //load the container swiper\n verticalSwiper = new Swiper(vSwiper, {\n paginationClickable: true,\n spaceBetween: 0,\n direction: 'vertical',\n nextButton: el.querySelectorAll('.swiper-button-down'),\n //prevButton: el.getElementsByClassName('swiper-button-prev')[0],\n keyboardControl: true,\n mousewheelControl: true,\n mousewheelReleaseOnEdges: true,\n freeModeMomentumBounce: false,\n })\n .on('onSlideChangeStart', function (e) {\n assetManager.stopPlaying();\n \n })\n .on('onSlideChangeEnd', function (e) {\n scanCardsMobile('chapters', e.container[0]);\n\n if(header){\n if(e.progress > 0 && e.progress < 1){\n header.classList.add('gv-hidden');\n } else {\n header.classList.remove('gv-hidden');\n }\n }\n })\n .on('onTouchStart', function (swiper, e) {\n if(isAndroidApp && window.GuardianJSInterface.registerRelatedCardsTouch){\n window.GuardianJSInterface.registerRelatedCardsTouch(true);\n }\n })\n .on('onTouchEnd', function (swiper, e) {\n if(isAndroidApp && window.GuardianJSInterface.registerRelatedCardsTouch){\n window.GuardianJSInterface.registerRelatedCardsTouch(false);\n }\n });\n\n\n\n\n\n for(var i = 0; i < hSwipers.length; i++) {\n var el = hSwipers[i];\n\n if(hSwipers[i].querySelectorAll('.gv-slide').length > 1){\n //initialize swiper\n new Swiper(el, {\n pagination: el.getElementsByClassName('swiper-chapter-pagination')[0],\n paginationClickable: true,\n spaceBetween: 0,\n nextButton: el.getElementsByClassName('swiper-button-next')[0],\n // prevButton: el.getElementsByClassName('swiper-button-prev')[0],\n keyboardControl: true,\n mousewheelControl: false,\n mousewheelReleaseOnEdges: true,\n freeModeMomentumBounce: false\n })\n .on('onSlideChangeStart', function (e) {\n assetManager.stopPlaying();\n scanCardsMobile('section', e.container[0]);\n })\n .on('onTouchStart', function (swiper, e) {\n if(isAndroidApp && window.GuardianJSInterface.registerRelatedCardsTouch){\n window.GuardianJSInterface.registerRelatedCardsTouch(true);\n }\n })\n .on('onTouchEnd', function (swiper, e) {\n if(isAndroidApp && window.GuardianJSInterface.registerRelatedCardsTouch){\n window.GuardianJSInterface.registerRelatedCardsTouch(false);\n }\n });\n }\n \n }\n\n scanCardsMobile('chapters', vSwiper);\n\n //initialize the scroll to button on mobile\n // document.querySelector('.gv-start-button').addEventListener('click', function(e){\n // positionMobile();\n // })\n\n window.addEventListener( 'resize', detect.debounce(resizeMobile, 250) );\n\n}", "function viewChange_Browser() {\n var isMobile = ($(window).width() < WIDTH_THRESHOLD);\n if (document.isMobile_Browser && !isMobile) viewToDesktop_Browser();\n else if (!document.isMobile_Browser && isMobile) viewToMobile_Browser();\n}", "function handleResponsive() {\n app.ResponsiveBreakpoints.register_event(\n '0-768',\n 'interior-beer-0-768',\n self.setup0_768.bind(self) // using es5-shim.js\n )\n\n app.ResponsiveBreakpoints.register_event(\n '768-+',\n 'interior-beer-768up',\n self.setup769up.bind(self) // using es5-shim.js\n )\n }", "function viewChange_Master() {\n var isMobile = ($(window).width() < WIDTH_THRESHOLD);\n if (document.isMobile_Master && !isMobile) viewToDesktop_Master();\n else if (!document.isMobile_Master && isMobile) viewToMobile_Master();\n\n // Check if we need to switch the logo even if we didn't switch screen\n if (isMobile) logoRender();\n}", "function viewToDesktop_Master() {\n document.isMobile_Master = false;\n viewDesktop_Master();\n}", "function setHeight(){\n var androidDevice = $('html').hasClass('android');\n var $sectionSlide = $(\".container\").find(\".height-viewport\");\n var windowHeight = $(window).outerHeight();\n $sectionSlide.css({\n minHeight: windowHeight + \"px\"\n });\n $(window).on('resize',(function(){\n if(!androidDevice){\n windowHeight = $(window).outerHeight();\n $sectionSlide.css({\n minHeight: windowHeight + \"px\"\n });\n }\n }));\n $(window).on('orientation',(function(){\n windowHeight = $(window).outerHeight();\n $sectionSlide.css({\n minHeight: windowHeight + \"px\"\n });\n }));\n }", "function viewDesktop_Browser() {\n $(\"#mobileImg\").hide();\n $(\"#desktopImg\").show();\n $(\"#mobileWelcomeBox\").hide();\n $(\"#mobileInstruction\").hide();\n}", "function runjsPersoreselGrid(){\n\n if(window.screen.availWidth < 1100){\n $('#optim-big-scr').html('Cet écran a été optimisé pour téléphone mobile.');\n // Mobile\n responsivefields = [\n { name: \"ref_tag\",\n title: \"#\",\n type: \"text\",\n align: \"left\",\n width: 95,\n headercss: \"h-jsG-l\",\n itemTemplate: function(value, item) {\n return '<i class=\"monosp-ft-mob\">' + value + '</i>';\n }\n },\n { name: \"status\",\n title: '<i class=\"far fa-edit\"></i>',\n type: \"text\",\n align: \"center\",\n width: 25,\n headercss: \"h-jsG-c\",\n itemTemplate: function(value, item) {\n\n switch (value.toString()) {\n case '3':\n //return item.type_pack;\n return (item.type_pack == 'P') ? '<i class=\"mgs-red fas fa-pen-square\"></i>' : '<i class=\"fas fa-arrow-circle-right\"></i>';\n break;\n case '10':\n return '<i class=\"fas fa-hand-holding-heart\"></i>';\n break;\n default:\n return '<i class=\"fas fa-arrow-circle-right\"></i>';\n }\n }\n },\n { name: \"part_name\",\n title: 'Part.',\n type: \"text\",\n align: \"center\",\n width: 65,\n headercss: \"h-jsG-c\",\n itemTemplate: function(value, item) {\n return ((value == null) ? '-' : value.substring(0, STR_LENGTH_SM));\n }\n },\n {\n name: \"paid_code\",\n title: '<i class=\"fas fa-receipt\"></i>',\n type: \"number\",\n width: 30,\n headercss: \"h-jsG-c\",\n itemTemplate: function(value, item) {\n return '<p class=\"center\">' + ((item.hdl_price == 'N') ? '<i class=\"fas fa-window-close\"></i>' : value) + '</p>';\n\n }\n },\n //Default width is auto\n { name: \"bcdescription\",\n title: '<i class=\"fas fa-info-circle\"></i>',\n type: \"text\",\n headercss: \"h-jsG-c\",\n itemTemplate: function(value, item) {\n return ((value == null) ? '-' : value.substring(0, STR_LENGTH_SM));\n }\n }\n ];\n }\n else{\n // Big screens\n responsivefields = [\n { name: \"ref_tag\",\n title: \"Référence\",\n type: \"text\",\n align: \"right\",\n width: 43,\n headercss: \"h-jsG-r\",\n itemTemplate: function(value, item) {\n return '<i class=\"monosp-ft\">' + value + '</i>';\n }\n },\n { name: \"step\",\n title: \"Status\",\n type: \"text\",\n width: 55,\n headercss: \"h-jsG-l\",\n itemTemplate: function(value, item) {\n return ((value == null) ? '-' : value.substring(0, STR_LENGTH_XXL));\n }\n },\n { name: \"status\",\n title: '<i class=\"far fa-edit\"></i>',\n type: \"text\",\n align: \"center\",\n width: 10,\n headercss: \"h-jsG-c\",\n itemTemplate: function(value, item) {\n return ((value == '3') && (item.type_pack == 'P')) ? '<i class=\"mgs-red fas fa-pen-square\"></i>' : '<i class=\"fas fa-window-close\"></i>';\n }\n },\n { name: \"type_pack\",\n title: '<i class=\"fas fa-barcode\"></i>',\n type: \"text\",\n align: \"center\",\n width: 10,\n headercss: \"h-jsG-c\",\n itemTemplate: function(value, item) {\n return (value == 'D') ? '<i class=\"c-w fas fa-box\"></i>' : '<i class=\"c-b fas fa-truck\"></i>';\n }\n },\n //Default width is auto\n { name: \"part_name\",\n title: \"Nom partenaire\",\n type: \"text\",\n width: 45,\n headercss: \"h-jsG-l\",\n itemTemplate: function(value, item) {\n return ((value == null) ? '-' : value.substring(0, STR_LENGTH_XL));\n }\n },\n { name: \"bcdescription\",\n title: \"Description\",\n type: \"text\",\n headercss: \"h-jsG-l\",\n itemTemplate: function(value, item) {\n return ((value == null) ? '-' : value.substring(0, STR_LENGTH_XXL));\n }\n },\n { name: \"create_date\", title: \"Créé le\", type: \"text\", width: 30, headercss: \"h-jsG-l\" },\n { name: \"diff_days\",\n title: '<i class=\"fas fa-stopwatch\"></i>',\n type: \"number\",\n width: 3,\n headercss: \"h-jsG-c\",\n itemTemplate: function(value, item) {\n return '<p class=\"center\">' + value + '</p>';\n }\n },\n {\n name: \"paid_code\",\n title: '<i class=\"fas fa-receipt\"></i>',\n type: \"number\",\n width: 3,\n headercss: \"h-jsG-c\",\n itemTemplate: function(value, item) {\n return '<p class=\"center\">' + ((item.hdl_price == 'N') ? '<i class=\"fas fa-window-close\"></i>' : value) + '</p>';\n // return item.hdl_price;\n }\n }\n\n ];\n }\n\n\n $(\"#nb-el-dash\").html(filteredDataTagToJsonArray.length);\n if(dataTagToJsonArray.length > 0){\n $(\"#jsGrid\").jsGrid({\n height: \"auto\",\n width: \"100%\",\n\n sorting: true,\n paging: true,\n // args are item - itemIndex - event\n rowClick: function(args){\n goToBarcode(args.item.id, args.item.secure)\n },\n data: filteredDataTagToJsonArray,\n\n fields: responsivefields\n });\n }\n else{\n $(\"#jsGrid\").hide();\n }\n}", "function internal_ui_resize_common()\r\n{\r\n\tgl.canvas.width = gl.canvas.clientWidth * window.devicePixelRatio / ewgl_desktop.subsample;\r\n\tgl.canvas.height = gl.canvas.clientHeight * window.devicePixelRatio / ewgl_desktop.subsample;\r\n\tgl.viewport(0, 0, gl.canvas.width, gl.canvas.height);\r\n}", "static responsiveness() {\n if (Game.mql.matches) { // min-width 768px\n Game.width = 720;\n } else {\n Game.width = window.innerWidth - 40;\n }\n // update width\n Game.canvas.width = Game.width;\n //! reset array\n Game.goldSectorsArr = [5];\n }", "function optimizeForMobile() {\n if (createjs.Touch.isSupported()) {\n createjs.Touch.enable(stage);\n }\n}", "function optimizeForMobile() {\n if (createjs.Touch.isSupported()) {\n createjs.Touch.enable(stage);\n }\n}", "function optimizeForMobile() {\n if (createjs.Touch.isSupported()) {\n createjs.Touch.enable(stage);\n }\n}", "function optimizeForMobile() {\n if (createjs.Touch.isSupported()) {\n createjs.Touch.enable(stage);\n }\n}", "function optimizeForMobile() {\n if (createjs.Touch.isSupported()) {\n createjs.Touch.enable(stage);\n }\n}", "function setupForDesktopScreen() {\n // Coaster animation\n new SimpleScrollScene({\n onScroll: function(scrollInfo) {\n var windowHeight = scrollInfo.windowHeight;\n var scrollHeight = scrollInfo.scrollHeight;\n var scrollTop = scrollInfo.scrollTop;\n var $section = $('#app-section-3');\n var sectionTop = $section.offset().top;\n var sectionHeight = $section.height();\n\n var ratio = ((scrollTop + windowHeight) - sectionTop) / sectionHeight;\n\n if (ratio >= 0) {\n $('#app-card--coaster').css({\n transform: 'scale(' + ratio + ') rotate(' + (ratio * 360) + 'deg)'\n });\n }\n }\n })\n .addTo(ScrollDispatcher);\n\n // Simple scene that changes the opacity of the obfuscator.\n new SimpleScrollScene({\n onScroll: function(scrollInfo) {\n var windowHeight = scrollInfo.windowHeight;\n var scrollHeight = scrollInfo.scrollHeight;\n var scrollTop = scrollInfo.scrollTop;\n\n var ratioFromBottom = 1 - (scrollTop / (scrollHeight - windowHeight));\n\n $('.app-bg-obfuscator').css({\n opacity: OBFUSCATOR_OPACITY * ratioFromBottom\n });\n }\n })\n .addTo(ScrollDispatcher);\n}", "function WR_Rotate_Mobile() {\n\t \t$( window ).resize( function() {\n\t \t\tvar height_broswer = $( window ).height();\n\t \t\tvar width_broswer = $( window ).width();\n\n\t \t\tif ( typeof window.is_vertical_mobile === 'undefined' )\n\t \t\t\twindow.is_vertical_mobile = ( height_broswer < width_broswer ) ? true : false;\n\n\t\t\tif ( height_broswer < width_broswer && window.is_vertical_mobile ) { // Horizontal\n\t\t\t\twindow.is_vertical_mobile = false;\n\t\t\t\tcallback_resize();\n\t\t\t} else if ( height_broswer > width_broswer && !window.is_vertical_mobile ) { // Vertical\n\t\t\t\twindow.is_vertical_mobile = true;\n\t\t\t\tcallback_resize();\n\t\t\t}\n\t\t} );\n\n\t \tfunction callback_resize() {\n\t \t\t$.each( $.function_rotate_device, function( key, val ) {\n\t \t\t\tval.call();\n\t \t\t} );\n\t \t}\n\t }", "function renderDefault(ui) {\n\n // account for screen size\n if ($(window).width() < 750) {\n ui.view(document.getElementById('view'), 'ut5x8iIiSxqY3d8HZNApiA');\n } else {\n ui.view(document.getElementById('view'), 'ufLtfaBpTMaR0JKl3cmNfQ');\n }\n}", "function mobile_materialpage() {\r\n /*\r\n End : 6 Mei 2017\r\n Task : Hide testing fields from the layout\r\n Page : Material page / product page\r\n File Location : $BASE_PATH$/image/javascript/js-ezrx.js\r\n Layout : Mobile\r\n */\r\n console.log('mobile_materialpage');\r\n /* hide testing fields */\r\n $(\"#attribute-firstLoad\").hide();\r\n $(\"#attribute-typeHeadScriptTagHolder\").hide();\r\n $(\"#attribute-masterString\").hide();\r\n $(\"#attribute-applicableProducts\").hide();\r\n $(\"#attribute-materialResultsString\").hide();\r\n\r\n setTimeout(function() {\r\n /* align all component on material page */\r\n $(\".ui-controlgroup-controls\").parent().css(\"width\", \"100%\");\r\n $(\".ui-controlgroup-label\").css(\"width\", \"auto\");\r\n $(\".ui-controlgroup-label\").next().css({\r\n \"width\": \"auto\",\r\n \"margin-top\": \"9px\"\r\n });\r\n /* align material search*/\r\n $(\"#attribute-addMaterials\").children('.ui-controlgroup').children().children('.ui-controlgroup-label').css(\"display\", \"none\", \"important\");\r\n $(\"#attribute-addMaterials\").children('.ui-controlgroup').children().children('.ui-controlgroup-controls').css(\"width\", \"130px\", \"important\");\r\n // $( $( $(\"#tab-content\").children()[1] ).children('.ui-body-inherit').children()[0] ).parent().css(\"padding-bottom\",\"100px\", \"important\");\r\n $($($(\"#tab-content\").children()[1]).children('.ui-body-inherit').children()[0]).parent().css(\"padding-bottom\", \"30px\", \"important\");\r\n // $(\"<div id='form_controlsearchmaterial' ></div>\").insertBefore(\"#attribute-addMaterials\");\r\n // $(\"#form_controlsearchmaterial\").css({\"width\":\"400px\", \"min-height\":\"90px\", \"float\":\"right\"});\r\n $(\"#attribute-addMaterials\").css({\r\n \"padding\": \"0px\",\r\n \"margin\": \"0px\",\r\n \"float\": \"left\"\r\n });\r\n // $(\"#attribute-addMaterials\").appendTo(\"#form_controlsearchmaterial\");\r\n\r\n if ($(\"#attribute-previous_res\").hasClass(\"hidden\") == false) {\r\n $(\"#attribute-previous_res\").hide();\r\n $(\"#form_controlsearchmaterial\").append(\"<div class='ui-controlgroup-controls ' style='width: 100px; float:left; margin-top: 15px;'>\" +\r\n \"<div class='html-attr form-field'>\" +\r\n \"<p><button id='cust_prevResult' class='ui-btn ui-shadow ui-corner-all ui-first-child ui-last-child'>Previous</button></p>\" +\r\n \"</div>\" +\r\n \"</div>\");\r\n $(\"#cust_prevResult\").on(\"click\", function() {\r\n $($(\"#attribute-previous_res\").children()[1]).click();\r\n });\r\n }\r\n\r\n if ($(\"#attribute-next_res\").hasClass(\"hidden\") == false) {\r\n $(\"#attribute-next_res\").hide();\r\n $(\"#form_controlsearchmaterial\").append(\"<div class='ui-controlgroup-controls ' style='width: 100px; float:left; margin-top: 15px;margin-left:30px;'>\" +\r\n \"<div class='html-attr form-field'>\" +\r\n \"<p><button id='cust_nextResult' class='ui-btn ui-shadow ui-corner-all ui-first-child ui-last-child'>Next</button></p>\" +\r\n \"</div>\" +\r\n \"</div>\");\r\n $(\"#cust_nextResult\").on(\"click\", function() {\r\n $($(\"#attribute-next_res\").children()[1]).click();\r\n });\r\n }\r\n /* display white if material page still loading */\r\n var $div = $(\"html\");\r\n var observer = new MutationObserver(function(mutations) {\r\n mutations.forEach(function(mutation) {\r\n if (mutation.attributeName === \"class\") {\r\n var attributeValue = $(mutation.target).prop(mutation.attributeName);\r\n if ((attributeValue.search(\"ui-loading\") != -1)) {\r\n $(\"#jg-overlay\").show();\r\n $(\"footer.slideup\").css(\"z-index\", \"999999\");\r\n } else {\r\n $(\"#jg-overlay\").hide();\r\n }\r\n }\r\n });\r\n });\r\n\r\n observer.observe($div[0], {\r\n attributes: true\r\n });\r\n\r\n //incomplete order function start\r\n mobile_incomplete_order();\r\n //incomplete order function end\r\n materialPageText();\r\n\t\t\tmobile_renameButton();\r\n }, 2000);\r\n\r\n $(\"input[name = _line_item_list]\").change(function() {\r\n console.log('mobile_itemCheckBonus');\r\n mobile_itemCheckBonus($(this));\r\n\r\n });\r\n\r\n\r\n /*\r\n End : 6 Mei 2017\r\n Task : Hide testing fields from the layout\r\n Page : Material page / product page\r\n File Location : $BASE_PATH$/image/javascript/js-ezrx.js\r\n Layout : Mobile\r\n */\r\n }", "function updateQuery(e){\r\n\t\tvar device = constDevice,//all, screen, handheld, tv etc.\r\n\t\twidth = window.innerWidth||document.getElementsByTagName('html')[0].offsetWidth,\r\n\t\theight = window.innerHeight||document.getElementsByTagName('html')[0].offsetHeight,\r\n\t\tdeviceWidth = window.screen.width,\r\n\t\tdeviceHeight = window.screen.height,\r\n\t\torientation = (width>height) ? 'landscape' : 'portrait',\r\n\t\taspectRatio = width/height,\r\n\t\tdeviceAspectRatio = deviceWidth/deviceHeight,\r\n\t\tcolor = 8,\r\n\t\tcolorIndex = Math.pow(color,3),\r\n\t\t//monochrome = 0,\r\n\t\tresolution = 96,//dpi\r\n\t\tscan = constScan,//progressive or interlace\r\n\t\tgrid = 0,//0 or 1 only\r\n\t\ti, n, x, query, queryRule, Style = '';\r\n\r\n\t\tnextquery: //goto \r\n\t\tfor (query in MediaQuery) {\r\n\t\t\tqueryRule = query.split(/\\s+and\\s+/i)\r\n\t\t\t\r\n\t\t\t//first rule is device\r\n\t\t\tif (device.indexOf(queryRule[0].toLowerCase())==-1) continue\r\n\t\t\t\r\n\t\t\t//next rules are features\r\n\t\t\ti=1; while (n = queryRule[i++]) {\r\n\t\t\t\tswitch ( n.substr(0,n.search(/:|\\)/)) ) {\r\n\t\t\t\t\t//width, height, device-width, device-height\r\n\t\t\t\t\tcase '(width':\r\n\t\t\t\t\tcase '(height':\r\n\t\t\t\t\tcase '(device-width':\r\n\t\t\t\t\tcase '(device-height': \r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tn.substring(n.indexOf(':')+1,n.indexOf('px')) != \r\n\t\t\t\t\t\t\t( (/width/.test(n)) ? \r\n\t\t\t\t\t\t\t(/device/.test(n)) ? deviceWidth : width :\r\n\t\t\t\t\t\t\t(/device/.test(n)) ? deviceHeight : height )\r\n\t\t\t\t\t\t) \r\n\t\t\t\t\t\t\tcontinue nextquery\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tcase '(max-width':\r\n\t\t\t\t\tcase '(max-height':\r\n\t\t\t\t\tcase '(max-device-width':\r\n\t\t\t\t\tcase '(max-device-height': \r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tn.substring(n.indexOf(':')+1,n.indexOf('px')) <= \r\n\t\t\t\t\t\t\t( (/width/.test(n)) ? \r\n\t\t\t\t\t\t\t(/device/.test(n)) ? deviceWidth : width :\r\n\t\t\t\t\t\t\t(/device/.test(n)) ? deviceHeight : height )\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\tcontinue nextquery\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tcase '(min-width':\r\n\t\t\t\t\tcase '(min-height':\r\n\t\t\t\t\tcase '(min-device-width':\r\n\t\t\t\t\tcase '(min-device-height': \r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tn.substring(n.indexOf(':')+1,n.indexOf('px')) >= \r\n\t\t\t\t\t\t\t( (/width/.test(n)) ? \r\n\t\t\t\t\t\t\t(/device/.test(n)) ? deviceWidth : width :\r\n\t\t\t\t\t\t\t(/device/.test(n)) ? deviceHeight : height )\r\n\t\t\t\t\t\t) \r\n\t\t\t\t\t\t\tcontinue nextquery\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\t//orientation\r\n\t\t\t\t\tcase '(orientation': \r\n\t\t\t\t\t\tif (n.substring(n.indexOf(':')+1,n.indexOf(')')) != orientation) \r\n\t\t\t\t\t\t\tcontinue nextquery\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\t//aspect-ratio, device-aspect-ratio\r\n\t\t\t\t\tcase '(aspect-ratio': \r\n\t\t\t\t\tcase '(device-aspect-ratio': \r\n\t\t\t\t\t\tx = n.substring(n.indexOf(':')+1,n.indexOf(')'))\r\n\t\t\t\t\t\tif (/\\//.test(x)) x = \r\n\t\t\t\t\t\t\tx.substr(0,x.indexOf('/'))/\r\n\t\t\t\t\t\t\tx.substr(x.indexOf('/')+1)\r\n\t\t\t\t\t\tif ( x != ((/device/.test(n)) ? deviceAspectRatio : aspectRatio) ) \r\n\t\t\t\t\t\t\tcontinue nextquery\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tcase '(max-aspect-ratio': \r\n\t\t\t\t\tcase '(max-device-aspect-ratio':\r\n\t\t\t\t\t\tx = n.substring(n.indexOf(':')+1,n.indexOf(')'))\r\n\t\t\t\t\t\tif (/\\//.test(x)) x = \r\n\t\t\t\t\t\t\tx.substr(0,x.indexOf('/'))/\r\n\t\t\t\t\t\t\tx.substr(x.indexOf('/')+1)\r\n\t\t\t\t\t\tif ( x <= ((/device/.test(n)) ? deviceAspectRatio : aspectRatio) ) \r\n\t\t\t\t\t\t\tcontinue nextquery\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tcase '(min-aspect-ratio': \r\n\t\t\t\t\tcase '(min-device-aspect-ratio': \r\n\t\t\t\t\t\tx = n.substring(n.indexOf(':')+1,n.indexOf(')'))\r\n\t\t\t\t\t\tif (/\\//.test(x)) x = \r\n\t\t\t\t\t\t\tx.substr(0,x.indexOf('/'))/\r\n\t\t\t\t\t\t\tx.substr(x.indexOf('/')+1)\r\n\t\t\t\t\t\tif ( x >= ((/device/.test(n)) ? deviceAspectRatio : aspectRatio) ) \r\n\t\t\t\t\t\t\tcontinue nextquery\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\t//color, color-index\r\n\t\t\t\t\tcase '(color': \r\n\t\t\t\t\tcase '(color-index': \r\n\t\t\t\t\t\tif (n=='(color)' || n=='(color-index)' ) break\r\n\t\t\t\t\t\tif ( n.substring(n.indexOf(':')+1,n.indexOf(')')) != ((/index/.test(n)) ? colorIndex : color) ) \r\n\t\t\t\t\t\t\tcontinue nextquery\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tcase '(max-color':\r\n\t\t\t\t\tcase '(max-color-index': \r\n\t\t\t\t\tcase '(min-color': \r\n\t\t\t\t\tcase '(min-color-index': break\r\n\t\t\t\t\t//monochrome\r\n\t\t\t\t\tcase '(monochrome':\r\n\t\t\t\t\tcase '(max-monochrome':\r\n\t\t\t\t\tcase '(min-monochrome': continue nextquery\r\n\t\t\t\t\t//resolution\r\n\t\t\t\t\tcase '(resolution': \r\n\t\t\t\t\t\tif (n=='(resolution)') continue nextquery\r\n\t\t\t\t\t\tif ( n.substring(n.indexOf(':')+1,n.indexOf('dpi')) != resolution ) continue nextquery\t\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tcase '(max-resolution': \r\n\t\t\t\t\t\tif ( n.substring(n.indexOf(':')+1,n.indexOf('dpi')) <= resolution ) continue nextquery\t\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tcase '(min-resolution': \r\n\t\t\t\t\t\tif ( n.substring(n.indexOf(':')+1,n.indexOf('dpi')) >= resolution ) continue nextquery\t\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\t//scan\r\n\t\t\t\t\tcase '(scan': \r\n\t\t\t\t\t\tif (n=='(scan)') continue nextquery\r\n\t\t\t\t\t\tif ( n.substring(n.indexOf(':')+1,n.indexOf(')')) != scan ) continue nextquery\t\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\t//grid\r\n\t\t\t\t\tcase '(grid': \r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t( n=='(grid)' && 0 != grid ) ||\r\n\t\t\t\t\t\t\t( n.substring(n.indexOf(':')+1,n.indexOf(')')) != grid )\r\n\t\t\t\t\t\t) continue nextquery\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tdefault: continue nextquery\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\t}\r\n\t\t\t\r\n\t\t\tStyle += MediaQuery[query]\r\n\t\t}\t\r\n\t\tredraw(Style)\r\n\t}", "function desktupSetUp () {\n \n $('.no-mobile').show()\n\t$('#AutenticationRequest_butt').addClass('btn-check1').removeClass('btn-validate');\n $('.mobile').hide()\n }", "function calibrateDevice(deviceName) {\n var deviceName = document.querySelector(deviceName)\n\n // When the respective devices have been loaded in the dom, firstly, the scrollbars are hidden and then the zoom factor is decreased from the default of 1 to 0.6 to match the zoom out of the app\n deviceName.addEventListener('dom-ready', () => {\n // This is to hide scrollbars in the devices\n deviceName.insertCSS(`\n ::-webkit-scrollbar {\n display: none;\n }\n `)\n // Make the devices zoom factor 60% of their original to match the zoom out done in main.js to the app window\n deviceName.setZoomFactor(0.6)\n\n // For the back button\n document.getElementById(\"backButton\").addEventListener(\"click\", () => {\n // If can go back, then go back\n if (deviceName.canGoBack) {\n deviceName.goBack()\n } else {\n // For some reason, anything put in here has no effect\n }\n })\n\n // For the forward button\n document.getElementById(\"forwardButton\").addEventListener(\"click\", () => {\n // If can go forward, then go forward\n if (deviceName.canGoForward) {\n deviceName.goForward()\n } else {\n // For some reason, anything put in here has no effect\n }\n })\n\n // To reload the webviews\n document.getElementById(\"reloadButton\").addEventListener(\"click\", () => {\n // Reload\n deviceName.reload()\n })\n\n // For the back button\n document.getElementById(\"homeButton\").addEventListener(\"click\", () => {\n // Go to index.html\n location.href = '../index.html'\n })\n })\n}", "function stylize() {\n var widthClassDetection = document.getElementsByClassName('device-width');\n if (widthClassDetection!==undefined) {\n var deviceWidth = screen.availWidth;\n for (var i=0;i<widthClassDetection.length;i++) {\n document.getElementsByClassName('device-width')[i].style.width = deviceWidth;\n }\n }\n //height not working...\n var heightClassDetection = document.getElementsByClassName('device-height');\n if (heightClassDetection!==undefined) {\n var deviceHeight = screen.availHeight;\n for (var i=0;i<heightClassDetection.length;i++) {\n document.getElementsByClassName('device-height')[i].style.height = deviceHeight;\n }\n }\n}", "function handleResponsive() {\n app.ResponsiveBreakpoints.register_event(\n '0-768',\n 'image-swap-0-768-'+self.initCount ,\n self.setup0_768.bind(self) // using es5-shim.js\n )\n\n app.ResponsiveBreakpoints.register_event(\n '768-+',\n 'image-swap-768up-'+self.initCount ,\n self.setup769up.bind(self) // using es5-shim.js\n )\n }", "function setUpUI() {\n // Create global var for the UI elements.\n ui = new UiElements();\n\n $('#nav_google').click(menuHide);\n $('#nav_bing').click(menuHide);\n $('#nav_osm').click(menuHide);\n $('#nav_apple').click(menuHide);\n $('#nav_apps').click(menuHide);\n $('.nav_dismiss').click(menuHide);\n\n $('.infobox .pushpin-button').click(togglePushPin);\n\n $('#menu-button').click(uiClick);\n $('#search-button').click(uiClick);\n $('.bottom-bar > button').click(uiClick);\n $('#main-menu > .promote-layer > li').click(uiClick);\n $('#language-menu > .promote-layer > li').click(uiClick);\n\n // The dark shading used when showing the menu has a click action,\n // but normally it ignores clicks - it only receives them when it\n // has the open class applied.\n ui.darkbgElement.click(menuHide);\n\n // Use a mouseover event for button highlighting, because hover doesn't\n // work on mobile.\n if (!isMobile()) {\n $('button').mouseover(function() {$(this).addClass('highlight')});\n $('button').mouseout(function() {$(this).removeClass('highlight')});\n }\n if (navigator.userAgent.toLowerCase().indexOf('ipod') != -1 ||\n navigator.userAgent.toLowerCase().indexOf('iphone') != -1 ||\n navigator.userAgent.toLowerCase().indexOf('mac os') != -1) {\n $('<li>').append(\n $('<a>').attr('id', 'nav_apple'))\n .insertBefore($('#nav_discuss').closest('li'));\n }\n if (navigator.userAgent.toLowerCase().indexOf('android') != -1 ||\n navigator.userAgent.toLowerCase().indexOf('ipod') != -1 ||\n navigator.userAgent.toLowerCase().indexOf('iphone') != -1 ||\n navigator.userAgent.toLowerCase().indexOf('blackberry') != -1) {\n $('<li>').append(\n $('<a>').attr('id', 'nav_apps'))\n .insertBefore($('#nav_discuss').closest('li'));\n }\n loadText();\n}", "function adaptContent() {\n if (desktopSite()) {\n // Position form submission status banner at top of container div\n $(\"#submitStatus\").css(\"top\", \"\");\n $(\"#submitStatus\").css(\"position\", \"absolute\");\n // Dark GitHub logo\n $(\"#githubDesktop\").css(\"display\", \"inline\");\n $(\"#githubMobile\").css(\"display\", \"none\");\n } else {\n // Position banner towards top of screen while in div, when above position at top of div\n if ($(window).scrollTop() + 40 > $(\"#contact\").offset().top) {\n $(\"#submitStatus\").css(\"top\", \"40px\");\n $(\"#submitStatus\").css(\"position\", \"fixed\");\n } else {\n $(\"#submitStatus\").css(\"top\", \"0px\");\n $(\"#submitStatus\").css(\"position\", \"relative\");\n }\n // Light GitHub logo\n $(\"#githubMobile\").css(\"display\", \"inline\");\n $(\"#githubDesktop\").css(\"display\", \"none\");\n }\n}", "function blockCanvasOnMobiles() {\n var isMobile = false; //initiate as false\n // device detection\n if (/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(navigator.userAgent.substr(0, 4))) isMobile = true;\n\n if (isMobile) {\n var background = document.createElement(\"div\");\n background.style.background = \"red\";\n\n document.body.insertAdjacentElement(\"afterbegin\", background);\n document.querySelector(\".mhMusicBars\").style.display = \"none\";\n }\n\n return isMobile;\n}", "function calcViewPort() {\n\t\t\tscreenWidth = $( document ).width();\n\t\t\t$timeout(function() {\n\t\t\t\tif(screenWidth <= 480) { //mobile\n\t\t\t\t\tvm.viewPort = 'Mobile';\n\t\t\t\t\t/*vm.baseArray = [];\n\t\t\t\t\tvm.baseArray = vm.sliderImagesForSmallScreens;*/\n\t\t\t\t} else if(screenWidth >= 481 && screenWidth <= 991) { //tablet\n\t\t\t\t\tvm.viewPort = 'Tablet';\n\t\t\t\t\t/*vm.baseArray = [];\n\t\t\t\t\tvm.baseArray = vm.sliderImagesForTabletScreens;*/\n\t\t\t\t} else if(screenWidth >= 992 && screenWidth <= 1199) { //small desktop\n\t\t\t\t\tvm.viewPort = 'Desktop';\n\t\t\t\t\t/*vm.baseArray = [];\n\t\t\t\t\tvm.baseArray = vm.sliderImagesForLargeScreens;*/\n\t\t\t\t} else if(screenWidth >= 1200) {\n\t\t\t\t\tvm.viewPort = 'extraLarge';\n\t\t\t\t\t/*vm.baseArray = [];\n\t\t\t\t\tvm.baseArray = vm.sliderImagesForExtraLargeScreens;*/\n\t\t\t\t}\n\t\t\t\t$scope.$apply();\n\t\t\t}, 200)\n\t\t\t\n\t\t}", "function switchToMobile(){\n\t//dojo.require(\"esri.dijit.Popup\");\n//dojo.require(\"esri.dijit.PopupMobile\");\n\tconsole.log('switch to mobile popup');\n\trequire(['esri/dijit/PopupMobile'], function(){\n\t\tif (esri && dojo && map && map.loaded){\n\t\t\tconsole.log('changing popup type to mobile');\n\t\t\tvar popupDijit = new esri.dijit.PopupMobile(null, dojo.create(\"div\"));\n\t\t\tmap.setInfoWindow(popupDijit);\n\t\t}\n\t});\n}", "function responsive() {\n // Do these on every screen resize\n\n\n // Do these on certain widths\n if ( $(window).width() > 600 ) { // above mobile size\n $('#primary-navigation .menu').removeAttr('style');\n $('#mobile-menu-button').removeClass('has-open');\n } else { // mobile size\n\n }\n }", "function defaultView() {\n if (window.innerWidth > 320 && window.innerWidth < 555) {\n createButtons(data, 2);\n displayCards(data, 1, 2);\n } else if (window.innerWidth > 555 && window.innerWidth < 1024) {\n displayCards(data, 1, 4);\n createButtons(data, 4);\n } else if (window.innerWidth > 1024) {\n displayCards(data, 1, 6);\n createButtons(data, 6);\n }\n}", "function _adaptLayoutConfigurationToCurrentVersion() {\n _cleanSelectedList();\n _setDefaultValuesToColumns();\n }", "function onMobileLoaded() {\n\t/* Load gamestate */\n\tstate = new GameState();\n\tstate.load();\n\t/* load jquery objects */\n\tscreen1.purchaseUpgrades = $(\"#purchaseUpgrades\");\n\tscreen1.upgradeInfo = $(\"#upgradeInfo\");\n\tscreen1.boughtUpgrades = $(\"#boughtUpgrades\");\n\tscreen1.breederList = $(\"#breederList\");\n\tscreen1.bugCount = $(\"#bugCount\");\n\tscreen1.larvaePerSec = $(\"#larvaePerSec\");\n\tscreen1.cardIds = [$(\"#clicker\"), $(\"#breeders\"), $(\"#upgrades\"), $(\"#others\")];\n\t\n\t/* Edit HTML */\n\tgenerateBreederList();\n\tgenerateUpgradeList();\n\tcheckTotals();\n\tparent.removeCover();\n\t\n\t/* Set intervals */\n\tscreen1.lpsInterval = setInterval(updateFromLps, 50);\n\tscreen1.totalsInterval = setInterval(checkTotals, 1000);\n\tscreen1.saveInterval = setInterval(saveData, 1000);\n}", "function normal_view(){\n\tif (window.innerWidth<956){\n\t\t$burger.show();\n\t}else{\n\t\t$list.slideDown();\n\t}\n\t$chat.slideDown();\n\treset();\n}", "function responsiveEvent() {\n // idea for using css state check pulled from a dev website, but i can't locate it at the moment...\n if ($('.media-check-div').css('float') == 'none') {\n // \"responsive view\"\n if (zoomState !== 0) {\n map.setOptions({\n zoomControl: false\n });\n zoomState = 0;\n }\n }\n else {\n if (zoomState !== 1) {\n map.setOptions({\n zoomControl: true\n });\n zoomState = 1;\n }\n }\n\n if ($('.orientation-check-div').css('float') == 'left') {\n // portrait\n $('.main-content-item').removeClass('col-xs-6');\n $('.main-content-item').addClass('col-xs-12');\n }\n else {\n // landscape\n $('.main-content-item').removeClass('col-xs-12');\n $('.main-content-item').addClass('col-xs-6');\n }\n}", "function isMobile(){\n\t\treturn ($(window).width() < settings.switchWidth);\n\t}", "function CaseListLargeScreenHandler() {\r\n this.updateMainContainer = function(){\r\n var isCaseDetailsOpened = $('.js-case-details').length !== 0 ? true : false;\r\n if (isCaseDetailsOpened) {\r\n updateCaseDetails();\r\n }\r\n $('.js-simple-main-col').css('margin-left', 'auto');\r\n }\r\n\r\n function updateCaseDetails() {\r\n var replacedClass = 'replaced';\r\n var isSelectedClass = 'is-selected';\r\n var openedClass = 'opened';\r\n var $caseItem = caseItem();\r\n var $caseDetails = $('.js-case-details', $caseItem);\r\n var $responsiveHandleContainer = $('.js-responsive-handle-container', $caseItem);\r\n\r\n var $itemColumns = $('.js-case-details-item', $caseItem);\r\n var $documentColumn = $('.js-document-column', $caseItem);\r\n\r\n var $responsiveButtons = $('.js-responsive-handle-button', $caseItem);\r\n var $documentResponsiveButton = $('.js-document-column-responsive-button', $caseItem);\r\n var $relatedTaskResponsiveButton = $('.js-related-task-column-responsive-button', $caseItem);\r\n var $historyResponsiveButton = $('.js-history-column-responsive-button');\r\n\r\n var isAlreadyLoaded = $caseDetails.hasClass(openedClass);\r\n\r\n if (!isAlreadyLoaded) {\r\n $documentColumn.addClass(replacedClass);\r\n $relatedTaskResponsiveButton.hide();\r\n $historyResponsiveButton.hide();\r\n }\r\n\r\n var $hiddenColumn = $('.js-case-details-item:not(.' + replacedClass + '):last', $caseItem);\r\n $itemColumns.show().css('opacity', 1);\r\n $responsiveHandleContainer.show();\r\n\r\n // Display data column as default when the menu state is changed from no expanded menu to one expanded menu\r\n var isResponsiveButtonClicked = $responsiveButtons.hasClass('is-clicked');\r\n if (!isResponsiveButtonClicked) {\r\n $itemColumns.removeClass(replacedClass);\r\n $responsiveButtons.removeClass(isSelectedClass);\r\n $documentColumn.addClass(replacedClass);\r\n }\r\n $hiddenColumn.hide();\r\n $responsiveButtons.removeClass(isSelectedClass);\r\n responsiveButton($('.' + replacedClass, $caseItem), $caseItem).addClass(isSelectedClass);\r\n\r\n $caseDetails.addClass(openedClass);\r\n if (!$documentResponsiveButton.is(\":visible\") && $documentResponsiveButton.hasClass(isSelectedClass)) {\r\n var $descriptionResponsiveButton = $('.js-description-column-responsive-button', $caseItem);\r\n $descriptionResponsiveButton.addClass(isSelectedClass);\r\n }\r\n }\r\n\r\n function caseItem() {\r\n var $caseItem = $('.show-case-details-mode').has('.js-case-details:not(.opened)');\r\n if ($caseItem.length === 0) {\r\n $caseItem = $('.show-case-details-mode');\r\n }\r\n return $caseItem;\r\n }\r\n\r\n function responsiveButton($itemColumn, $caseItem) {\r\n var theClass = $itemColumn.attr('class').match(/js[\\w-]*[\\w-]column\\b/);\r\n return $('.' + theClass + '-responsive-button', $caseItem);\r\n }\r\n}", "setupUI () {\n this.html.canvas.width = this.canvasWidth\n this.html.canvas.height = this.canvasHeight\n \n // Prevent \"touch and hold to open context menu\" menu on touchscreens.\n this.html.canvas.addEventListener('touchstart', stopEvent)\n this.html.canvas.addEventListener('touchmove', stopEvent)\n this.html.canvas.addEventListener('touchend', stopEvent)\n this.html.canvas.addEventListener('touchcancel', stopEvent)\n \n this.html.buttonHome.addEventListener('click', this.buttonHome_onClick.bind(this))\n this.html.buttonReload.addEventListener('click', this.buttonReload_onClick.bind(this))\n this.html.buttonLeft.addEventListener('click', this.buttonLeft_onClick.bind(this))\n this.html.buttonRight.addEventListener('click', this.buttonRight_onClick.bind(this))\n \n this.html.main.addEventListener('keydown', this.onKeyDown.bind(this))\n \n window.addEventListener('resize', this.updateUI.bind(this))\n this.updateUI()\n this.hideUI() // Hide until all assets are loaded\n \n this.html.main.focus()\n }", "function setMobile() {\n\t\t\tif (isMobile) {\n\t\t\t\tcreateCookie('wpim', '1', .5, \".wpi.edu\");\n\t\t\t\t$(\"p#footer\").append(\" | <a href=\\\"\" + location.href.replace(\"m.\", \"www.\") + \"\\\">Desktop Website</a>\");\n\t\t\t} else {\n\t\t\t\tvar uagent_ar = [ \"iphone\",\"ipod\",\"android\",\"blackberry\",\"palm\",\"webos\",\"hiptop\",\"danger\",\"htc\",\"series60\",\"series70\",\"series80\",\"series90\",\"symbian\",\"windows ce\",\"iemobile\",\"vnd.rim\",\"kindle\",\"nintendo\",\"archos\",\"netfront\",\"up.browser\",\"midp\",\"teleca q\",\"pda\",\"mini\",\"mobi\",\"lablet\",\"ericsson\",\"docomo\",\"kddi\",\"vodafone\",\"nitro\" ];\n\t\t\t\tvar uagent = navigator.userAgent.toLowerCase();\n\t\t\t\t$.each(uagent_ar, function(index, val) {\n\t\t\t\t if(uagent.indexOf(val) >= 0) {\n\t\t\t\t\t $(\"p#footer\").append(\" | <a href=\\\"\" + location.href.replace(\"www.\", \"m.\") + \"\\\">Mobile Website</a>\");\n\t\t\t\t\t return false;\n\t\t\t\t }\n\t\t\t\t});\n\t\t\t}\n\t\t}" ]
[ "0.69876343", "0.67479444", "0.6620363", "0.6502737", "0.64445776", "0.6419168", "0.6336192", "0.625265", "0.62136257", "0.6074094", "0.5999596", "0.58373415", "0.58049375", "0.57810247", "0.5744492", "0.5732877", "0.57321954", "0.5730202", "0.5726875", "0.5711438", "0.5700513", "0.5694572", "0.569359", "0.56903344", "0.5690156", "0.568074", "0.5653028", "0.5648988", "0.5639678", "0.561878", "0.5615061", "0.5610476", "0.5589937", "0.5587964", "0.5577504", "0.5569902", "0.555655", "0.55498326", "0.55485475", "0.5529646", "0.55286646", "0.55161816", "0.55127984", "0.55124295", "0.55068934", "0.5493226", "0.547742", "0.5464509", "0.5461445", "0.546052", "0.5447136", "0.5442973", "0.54386365", "0.54386365", "0.5436553", "0.54359263", "0.5427373", "0.5421701", "0.5420857", "0.54189545", "0.5417951", "0.5414262", "0.54075", "0.5405996", "0.5398524", "0.53967685", "0.53921443", "0.5389199", "0.5382562", "0.53703225", "0.5366834", "0.53645307", "0.53645307", "0.53645307", "0.53645307", "0.53645307", "0.5362774", "0.5360695", "0.5356636", "0.53491443", "0.53418314", "0.53167593", "0.53162396", "0.530721", "0.5301738", "0.5300688", "0.5297599", "0.52945006", "0.5294385", "0.5293036", "0.5291492", "0.5290554", "0.5290015", "0.52881694", "0.528264", "0.52797973", "0.52742046", "0.52546614", "0.5246754", "0.52460456" ]
0.53274256
81
Search: Searches for a term and renders it:
function Search(term, type, callback){ console.log(term + " : " + type); switch(type){ case "artist": console.log("artist search") Jam.artistSearch(term, function(aSearch){ /* aArtists[ toArtist{ ID, Type, Name, Country, Score, Disambiguation } ] */ console.log(aSearch) //First we need to check how many results were returned: if(!(aSearch.length > 0)){ //Show some sort of error, 0 results console.log("No results"); $("#main-content").html("").append(Title("icon-search", "Search for " + term)).append("<p>Returned no results, try a different search term.</p>"); } else{ //Display artists as a grid: var grid = $("<div class='grid clearfix'></div>"); var iResults = aSearch.length; var markers = new Array(); for( var i = 0; i < iResults; i++ ){ var aTemplate = Template("artist","grid"); aTemplate = aTemplate.clone(); $(".artist-mbid-link", aTemplate).attr("href", "#artist:" + aSearch[i].ID) $(".artist-image", aTemplate).attr("src", Martwork.fetchImage(aSearch[i].ID)); $(".artist-name", aTemplate).text(aSearch[i].Name); var artistcountry = ""; if(aSearch[i].Country != ""){ artistcountry = aSearch[i].Country; } if(aSearch[i].Type != ""){ if(artistcountry == ""){ artistcountry = aSearch[i].Type; } else{ artistcountry = artistcountry + ", " + aSearch[i].Type; } } $(".artist-country", aTemplate).text(artistcountry); $(".artist-disambiguation", aTemplate).text(aSearch[i].Disambiguation); $(grid).append(aTemplate); } var content = $("<div class='content'></div>"); $(content).append(Title("icon-search", "Search for " + term)).append("<div id='map_canvas' style='height: 300px; width:500px; float:right;'></div>").append(grid); $("#main-content").html("").append(content); var latlng = new google.maps.LatLng(-34.397, 150.644); var mapOptions = { zoom: 8, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); bounds = new google.maps.LatLngBounds(); for(var i=0; i< iResults; i++){ var artistcountry if(aSearch[i].Country != ""){ artistcountry = aSearch[i].Country; } else{ artistcountry = ""; } console.log(artistcountry); geocoder = new google.maps.Geocoder(); geocoder.geocode( { 'address': 'Country: ' + artistcountry}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { console.log("marker") markers.push(new google.maps.Marker({ map: map, position: results[0].geometry.location })); bounds.extend(results[0].geometry.location); map.fitBounds(bounds); } }); } } }); break; case "track": Jam.recordingSearch(term, function(aSearch){ /* aRecordings[ toRecording{ Title, Duration, ID, Score, Artist{ Name, Disambiguation, ID } Releases[ toRecordingRelease{ Title, ID, Type, ReleaseDate, Country, TrackCount } ] } ] */ //First we need to check how many results were returned: if(!(aSearch.length > 0)){ //Show some sort of error, 0 results } else{ //Display artists as a grid: } }); break; case "album": break; case "all": break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "executeSearch(term) {\n var results;\n try {\n results = this.search.fuse.search(term); // the actual query being run using fuse.js\n } catch (err) {\n if (err instanceof TypeError) {\n console.log(\"hugo-fuse-search: search failed because Fuse.js was not instantiated properly.\")\n } else {\n console.log(\"hugo-fuse-search: search failed: \" + err)\n }\n return;\n }\n let searchitems = '';\n\n if (results.length === 0) { // no results based on what was typed into the input box\n this.resultsAvailable = false;\n searchitems = '';\n } else { // we got results, show 5\n for (let item in results.slice(0,5)) {\n let result = results[item];\n if ('item' in result) {\n let item = result.item;\n searchitems += this.itemHtml(item);\n }\n }\n this.resultsAvailable = true;\n }\n\n this.element_results.innerHTML = searchitems;\n if (results.length > 0) {\n this.top_result = this.element_results.firstChild;\n this.bottom_result = this.element_results.lastChild;\n }\n }", "function searchTerm(){\n \n }", "function search(){\r\n if (!searchField.value)\r\n return;\r\n\r\n let results = searchEngine.search(searchField.value,{\r\n fields: {\r\n tags: { boost: 3 },\r\n title: { boost: 2 },\r\n body: { boost: 1 }\r\n }\r\n }); \r\n\r\n searchResults.classList.add('header-searchResults--show')\r\n\r\n let resultsHtml = '';\r\n if (results.length){\r\n \r\n resultsHtml = `Found ${results.length} post(s).`;\r\n for(let result of results){\r\n let doc = searchEngine.documentStore.getDoc(result.ref);\r\n resultsHtml += `\r\n <div class=\"header-searchResult\">\r\n <a href=\"${doc.id}\">${doc.title}</a>\r\n </div>`;\r\n\r\n }\r\n } else{\r\n resultsHtml = `<div class=\"header-searchResult\">\r\n No results found for ${searchField.value}\r\n </div>`;\r\n }\r\n\r\n searchResults.innerHTML = resultsHtml;\r\n}", "function doSearchByTerm(location) {\n app.showPreloader();\n\n ps.searchByTerm(searchTerm, searchByTermSuccess, searchByTermError);\n\n function searchByTermSuccess(data) {\n processResponse(data);\n }\n\n function searchByTermError(data) {\n showErrorState({message: 'Other error'});\n }\n }", "function search(term) {\n clear();\n app.model.term = term;\n $.get(\"/search/\" + term, function (d) {\n if (d.nodes.length === 0) {\n app.showMessage(\"Nothing found\");\n return;\n }\n var nodes = d.nodes;\n var links = d.links;\n var mapper = {};\n for (var i = 0; i < nodes.length; i++) {\n var n = nodes[i];\n var node = addNode(n.name);\n mapper[n.id] = node;\n }\n for (var i = 0; i < links.length; i++) {\n var n = links[i];\n if (i === 0) {\n setStyle(mapper[n.from], \"Orange\");\n app.graph.setBounds(mapper[n.from], new yfiles.geometry.RectD(10, 0, 100, 80));\n }\n var edge = connectNodes(mapper[n.from], mapper[n.to], n.label);\n }\n if(app.preferredLayout==\"organic\")\n organicLayout();\n else\n hierarchyLayout();\n //app.dynamics.go();\n });\n }", "function query(term) {\n $(\"#SearchBox\").val(term);\n search(term);\n $.pageslide.close();\n }", "function restaurantSearch(searchTerm) {\n\tfetch(jsVar.fetchLink).then((restaurants) => restaurants.json()).then((parsedRestaurants) => {\n\t\tparsedRestaurants.forEach((element) => {\n\t\t\tif (element.name.toLowerCase().includes(searchTerm.toLowerCase())) {\n\t\t\t\tdocument.querySelector(`#restaurant-container`).innerHTML += buildHTMLString(element);\n\t\t\t}\n\t\t});\n\t\tsearchFunctions.noResultsFound();\n\t});\n}", "function makeSearchTerm(search) {\n return `%${search}%`;\n}", "function searchFor(searchterm) {\n // Check if a space is found and if it is, replace it with a +\n console.log('Your search term is: ' + searchterm)\n let newSearchURL = baseURL + \"term=\" + searchterm.split(' ').join('+').toLowerCase()\n console.log('Your new search term is: ' + newSearchURL)\n // Query iTunes API and display results in React\n}", "search(term) {\r\n this.searchTerms.next(term);\r\n }", "function onSearchTerm(evt) {\n var text = evt.target.value;\n doSearch(text, $('#types .btn-primary').text());\n }", "search() {\n\t\tthis.props.onSearch(this.state.term);\n\t}", "function renderSearch(data) {\r\n const body = buildSearchBody(data);\r\n \r\n const searchTable = `\r\n <table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" style=\"width: 50%; margin: 0 auto 2em auto;\">\r\n <thead> \r\n <tr>\r\n <th>Target</th>\r\n <th>Search text</th>\r\n <th>Treat as regex</th>\r\n </tr>\r\n </thead>\r\n <tbody>${body}<tbody>\r\n </table>\r\n `;\r\n\r\n $('#search-wrapper').append(searchTable);\r\n}", "function search() {\n let search_text = $search_text.value;\n decide_search(search_text)\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 }", "render() {\n\t\treturn (\n\t\t\t<div className=\"search-bar\">\n\t\t\t\t<input \n\t\t\t\t\tvalue={this.state.term}\n\t\t\t\t\tonChange={event =>\n\t\t\t\t\t\t\tthis.onInputChange(event.target.value)}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}", "function post_search(req, res) {\n console.log(req.body);\n Model3d.find_by_string(req.body.search_bar, function(err, docs) {\n if (err) {\n res.send(\"something went wrong\");\n }\n else {\n res.render('navigation/search', {models: docs, selected: \"Search Results\" });\n }\n });\n}", "search(term) {\n this.searchTerms.next(term);\n }", "function searchWikipedia (term) {\n return $.ajax({\n url: 'https://en.wikipedia.org/w/api.php',\n dataType: 'jsonp',\n data: {\n action: 'opensearch',\n format: 'json',\n search: term,\n suggest: true\n }\n });\n }", "function basicsearch() {\n searchString = document.basicForm.basicText.value;\n searchTerms = searchString.split(/\\s/);\n\n putHeader();\n\n findResults();\n putResults();\n\n putFooter();\n\n writeResultsPage();\n}", "render() { \n return (\n <div>\n <h3 className=\"display-4\" title=\"topic of search term\">TOPIC: <span className=\"badge badge-secondary\">{this.state.searchTerm}</span></h3>\n <SearchResult key={this.props.search} value={this.props.search} onChange={this.handleChange} ></SearchResult>\n </div>\n );\n }", "search(term) {\n axios.get(baseUrl + \"/search.json\", {\n params: {\n q: term\n }\n })\n .then((response) => {\n this.setState({ results: response.data });\n })\n .catch((error) => {\n console.log(error);\n });\n }", "function search(searchTerm) {\n\tSC.get('/tracks', { q: searchTerm}, function(tracks) {\n\t\tdisplay(tracks);\n\t});\n}", "function searchBook() {\n setSearchTerm(searchValue.current.value)\n }", "doSearch(term){\n \n let self = this;\n let type = 'term';\n this.page = 1; // reset page num\n \n\t let url = `${API.search_api}${API.app_id}${API.posts_per_page}&page=${this.page}&query=${this.search_term}`;\t \n\t \n\t // Search by ID\n\t // allow users to search by photo by prepending id:{photo_id} to search terms\n\t let search_type = term.substring(0, 3);\t \n\t if(search_type === 'id:'){\t\t \n\t\t type = 'id';\n\t\t term = term.replace('id:', '');\n \t url = `${API.photo_api}/${term}${API.app_id}`; \t \n\t }\n\n let input = document.querySelector('#photo-search');\n \n\t fetch(url)\n\t .then((data) => data.json())\n .then(function(data) { \n \n // Term Search\n if(type === 'term'){\n\t \n \t self.total_results = data.total;\n \t \n \t // Check for returned data\n \t self.checkTotalResults(data.results.length);\n \t \n \t // Update Props\n \t self.results = data.results;\n \t self.setState({ results: self.results }); \t \n\t \n\t }\n\t \n\t // Search by photo ID\n\t if(type === 'id' && data){\n \t \n \t // Convert return data to array \t \n \t let photoArray = []; \t \n \t \n \t if(data.errors){ // If error was returned\n\t \t \n\t \t self.total_results = 0; \n\t \t self.checkTotalResults('0');\n\t \t \n\t \t } else { // No errors, display results\n\t\t \t \n\t \t photoArray.push(data);\n\t \t \n\t \t self.total_results = 1; \t \n\t \t self.checkTotalResults('1');\n\t \t \n \t }\n \t \n \t self.results = photoArray;\n \t self.setState({ results: self.results });\n }\n\t \n\t input.classList.remove('searching');\t\n\t \t\t \n\t })\n\t .catch(function(error) {\n console.log(error);\n self.isLoading = false;\n });\n\t\t \n }", "render(){\n\t\tconst searchTerm = this.props.searchTerm\n\t\treturn(\n\t\t\t<form className=\"search-bar\">\n\t\t\t\t<input value={searchTerm} onChange={this.handleChange} type=\"text\" placeholder=\"Search...\" />\n\t\t\t\t<div>\n\t\t\t\t\t<input id=\"in-stock\" type=\"checkbox\" /> Only show products in stock\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t)\n\t}", "function searchForText() {\n // get the keywords to search\n var query = $('form#search input#mapsearch').val();\n\n // extract the fields to search, from the selected 'search category' options\n let category = $('select#search-category').val();\n\n // filter the object for the term in the included fields\n DATA.filtered = searchObject(DATA.tracker_data, query, CONFIG.search_categories[category]);\n\n // suggestions: if the search category is \"company\", include a list of suggestions below \n var suggestions = $('div#suggestions').empty();\n if (category == 'parent') {\n suggestions.show();\n var companies = searchArray(DATA.companies, query).sort();\n companies.forEach(function(company) {\n var entry = $('<div>', {'class': 'suggestion', text: company}).appendTo(suggestions);\n entry.mark(query);\n });\n }\n\n // add the results to map, table, legend\n drawMap(DATA.filtered); // update the map (and legend)\n updateResultsPanel(DATA.filtered, query) // update the results-panel\n drawTable(DATA.filtered, query); // populate the table\n $('form#nav-table-search input').val(query); // sync the table search input with the query\n CONFIG.selected_country.layer.clearLayers(); // clear any selected country\n CONFIG.selected_country.name = ''; // ... and reset the name\n $('div#country-results').show(); // show the results panel, in case hidden\n $('a.clear-search').show(); // show the clear search links\n\n return false;\n}", "render() {\n\t\treturn(\n\t\t\t<section className='search-bar'>\n\t\t\t\t<label>Search</label>\n\t\t\t\t<input\n\t\t\t\t\tvalue = {this.state.term}\n\t\t\t\t\t// rather than calling directly to the SearchBar props,\n\t\t\t\t\t// call a separate method (below)\n\t\t\t\t\tonChange={ event => this.onInputChange(event.target.value) }\n\t\t\t\t/>\n\t\t\t\t<br/>\n\t\t\t</section>\n\t\t);\n\t}", "render() {\n\t\treturn (\n\t\t\t<div className=\"search-bar\"> \n\t\t\t\n\t\t\t<input \n\t\t\tvalue={this.state.term}\n\t\t\tonChange={event=>{this.onInputChange(event.target.value)}}\n\t\t\t/>\n\t\t\t\n\t\t\t</div>\n\t\t\t);\n\t}", "function renderSearchFromState() {\n\tconst state = JSON.parse(sessionStorage.getItem(SEARCH_STATE_KEY));\n\n\tif (state) {\n\t\tconst searchResults = document.querySelector('#search-results');\n\t\tconst searchInput = document.querySelector('#search-input');\n\n\t\tsearchInput.value = state.searchTerm;\n\t\tsearchResults.classList.add('visible');\n\t\tsearchResults.classList.add('no-transition');\n\t\tsearchResults.innerHTML = state.resultsMarkup;\n\n\t\t// remove class which prevents transition on page move\n\t\tsetTimeout(() => searchResults.classList.remove('no-transition'), 100);\n\t}\n}", "render() {\n return (\n <div className=\"search-bar\">\n <input \n value={this.state.term}\n onChange = {event => this.onInputChange(event.target.value)} />\n \n </div>\n );\n //could add this to the div to see the contents of the search bar\n // Value of the input: {this.state.term}\n }", "function runSearch(e) {\n if (e.target.value === \"\") {\n // On empty string, remove all search results\n // Otherwise this may show all results as everything is a \"match\"\n applySearchResults([]);\n } else {\n const tokens = e.target.value.split(\" \");\n const moddedTokens = tokens.map(function (token) {\n // \"*\" + token + \"*\"\n return token;\n })\n const searchTerm = moddedTokens.join(\" \");\n const searchResults = idx.search(searchTerm);\n const mapResults = searchResults.map(function (result) {\n const resultUrl = docMap.get(result.ref);\n return { name: result.ref, url: resultUrl };\n })\n\n applySearchResults(mapResults);\n }\n\n}", "function displaySearchResult(search) {\n window.location.replace(\"?=\" + food + \"\");\n }", "function search(value){\n\t// console.log(\"search: \" + value);\n\tshowSection(null, '#section-searchresults');\n\t$('#section-searchresults h1').html(\"Results for: '\" + value + \"'\");\n\tcontroller.search(value);\n}", "function search(e) {\n e.preventDefault();\n\n // documentation: https://dictionaryapi.dev/\n const apiUrl = `https://api.dictionaryapi.dev/api/v2/entries/en_US/${keyword}`;\n axios.get(apiUrl).then(handleDictionaryResponse);\n\n // pexels API call\n const pexelsApiKey = process.env.REACT_APP_PEXELS_API_KEY;\n const pexelsApiUrl = `https://api.pexels.com/v1/search?query=${keyword}&per_page=12`;\n const headers = { Authorization: `Bearer ${pexelsApiKey}` };\n axios.get(pexelsApiUrl, { headers: headers }).then(handlePexelsResponse);\n }", "search() {\n let location = ReactDOM.findDOMNode(this.refs.Search).value;\n if (location !== '') {\n let path = `/search?location=${location}`;\n makeHTTPRequest(this.props.updateSearchResults, path);\n }\n }", "function searchIt (target) {\n let searchTerm = target.textContent;\n inputField.value = searchTerm;\n document.querySelector('#search-form').submit();\n}", "function displaySearchResults(response, search) {\n var user_finder = new RegExp(search, 'i'),\n results_string = \"\",\n i,\n j;\n\n if(globe.getID(0)) {\n removeLink();\n }\n\n if (globe.search_type_name.checked) {\n for (i = 0; i < response.length; i += 1) {\n if (user_finder.test(response[i].toMake)) {\n\n results_string += \"<p id=\\\"\" + i.toString() + \"\\\">\" + response[i].toMake + \"</p>\";\n globe.addID(i.toString());\n }\n }\n } else {\n for (i = 0; i < response.length; i += 1) {\n for (j = 0; j < response[i].ingredients.length; j += 1) {\n if (user_finder.test(response[i].ingredients[j].ingredient)) {\n\n results_string += \"<p id=\\\"\" + i.toString() + \"\\\">\" + response[i].ingredients[j].ingredient + \"</p>\";\n globe.addID(i.toString());\n break;\n }\n }\n }\n }\n\n globe.hint_span.innerHTML = \"\";\n if (results_string === \"\") {\n results_string = \"<span>No results.</span>\";\n }\n globe.results_div.innerHTML = results_string;\n \n if (globe.getID(0)) {\n createLink();\n }\n}", "function searchDocuments(searchTerm, res){\r\n var results;\r\n var searchResults = \"No results found\"\r\n MongoClient.connect(url, function(err, client){\r\n if (err) throw err;\r\n var collection = client.db('info30005').collection('info30005');\r\n \r\n collection.find( { $text: { $search: searchTerm } }).toArray(function(err, results){\r\n //console.log(results);\r\n client.close();\r\n var searchResults = generateSearchTable(results);\r\n res.render('pages/search', { myVar : searchTerm , searchResults : searchResults});\r\n });\r\n\r\n })\r\n}", "render() {\n let filteredData = this.state.data.filter(this.searchDetails);\n let displayResults = \"\"\n if (this.state.query !== \"\") {\n displayResults = (\n <div class=\"searchContainer\">\n <ul>{\n filteredData.map((details, i) => (\n <div key={i} className=\"searchResults\">\n\n <button>\n <Link to={`/movie_details/${details.id}`}>\n <li>{details.original_title}</li>\n </Link>\n </button>\n\n </div>\n ))}</ul></div>)\n } else {\n displayResults = \"\";\n }\n\n return (\n <div className=\"searchBar\">\n <Search query={this.state.query} handleSearch={this.handleSearch} className=\"searchBox\" />\n {displayResults}\n </div>\n );\n }", "function doSearch(searchTerm, cb) {\n var url = baseUrl + searchTerm;\n request(url, function(error, response, body) {\n if (error) {\n cb(error, null);\n } else {\n var results = parse(body);\n cb(null, results);\n }\n });\n}", "function search(text) {\n text = text.toLowerCase();\n var container = $(\"#catalog\");\n // clear everything\n $(container).html('');\n\n // paint only items that fullfil the filter\n for (var i = 0; i < DB.length; i++) {\n var item = DB[i];\n\n // decide if the items fullfils the filter\n // if so, display it\n if (\n item.title.toLowerCase().indexOf(text) >= 0 // if title contains the text\n || // or\n item.code.toLowerCase().indexOf(text) >= 0 // if the code contains the text\n ) {\n displayItem(item);\n }\n\n }\n}", "function search() {\n\t\n}", "render() {\n return (\n <div>\n <Input placeholder='Search Here' value={this.state.searchTerm} onChange={this.handleSearch.bind(this)} onBlur={this.handleSearch.bind(this)} />\n <h3>Results:</h3>\n <p> {this.searchFunction(this.state.searchTerm).map(thing => (\n <li>{thing}</li>\n ))}</p>\n </div>\n );\n }", "async search(query, options = {}) {\n return await this.fetch(\"/search/byterm\", {\n q: query,\n max: options.max ?? 25,\n clean: Boolean(options.clean),\n fulltext: Boolean(options.fulltext),\n });\n }", "searchClicked(_) {\n flikrSearch(this.state.term).fork(this.showError,this.updateResults)\n }", "function makeSearch() {\n var query = $('#search-line').val();\n if (query.length < 2) {\n return null;\n }\n\n // cleanup & make AJAX query with building response\n $('#ajax-result-items').empty();\n $.getJSON(script_url+'/api/search/index?query='+query+'&lang='+script_lang, function (resp) {\n if (resp.status !== 1 || resp.count < 1)\n return;\n var searchHtml = $('#ajax-carcase-item').clone().removeClass('hidden');\n $.each(resp.data, function(relevance, item) {\n var searchItem = searchHtml.clone();\n searchItem.find('#ajax-search-link').attr('href', site_url + item.uri);\n searchItem.find('#ajax-search-title').text(item.title);\n searchItem.find('#ajax-search-snippet').text(item.snippet);\n $('#ajax-result-items').append(searchItem.html());\n searchItem = null;\n });\n $('#ajax-result-container').removeClass('hidden');\n });\n }", "search(searchTerm) {\n let results = undefined;\n if (this.props.data) {\n\n if (this.props.caseInsensitive) {\n results = this.props.data.filter(object => this.getObjectText(object).toLowerCase().includes(searchTerm.toLowerCase()));\n } else {\n results = this.props.data.filter(object => this.getObjectText(object).includes(searchTerm));\n }\n }\n return results;\n }", "function searchProduct(){\r\n \r\n var go = \"Thing(?i)\";\r\n \r\n submitProduct(go); \r\n \r\n }", "function search() {\n\tvar query = $(\".searchfield\").val();\n\tif (query == \"\") {\n\t\tdisplaySearchResults(\"\", data, data);\n\t}\n\telse {\n\t\tvar results = idx.search(query);\n\t\tdisplaySearchResults(query, results, data);\n\t\tga('send', 'event', 'Search', 'submit', query);\n\t}\n}", "render() {\n return (\n <div className=\"search-bar\">\n <input\n value={this.state.term}\n onChange={event => this.onSearch(event.target.value)} />\n </div>\n );\n }", "function searchTerms(d){\n\t\n\tpayload = implode_form(d);\n\n\td.getElementById('demo_results').style.display = \"block\";\n\trdiv = d.getElementById('results_status'); // locate the output div \n\trdiv.innerHTML = ''; // clear out the block, prepare for data!\n\n\tlaunchEngines(rdiv,apibase+'/terms.',payload);\n\t//console.log('APIBASE: ' + apibase);\n\n}", "function doSearch(query, searchPageDoc) {\n var url = \"http://movietrailers.apple.com/trailers/home/scripts/quickfind.php?q=\" + query.replace(\" \", \"+\");\n var req = new XMLHttpRequest();\n \n req.onreadystatechange = function() {\n if (req.readyState == 4) {\n resultsJSON = JSON.parse(req.responseText);\n showResults(resultsJSON, searchPageDoc);\n }\n }\n req.open(\"GET\", url, true);\n req.send();\n}", "function searchMovie(value) {\n\n const path = '/search/movie';\n\n const url = generateUrl(path) + '&query=' + value;\n\n const render = renderMovies.bind({title: 'Results'});\n\n sectionMovies(url, render, handleError);\n\n}", "function handleSearch(res, uri) {\r\n /* var contentType = 'text/html'\r\n res.writeHead(200, {'Content-type': contentType}) */\r\n searchName = qs.parse(uri.query).search;\r\n if(searchName!=undefined){\r\n\t result = movies.filter(similarName);\r\n\t res.end(result.toString());\r\n }else {\r\n res.end('no query provided');\r\n }\r\n\r\n}", "render(){\n\t\t// every class must have a render method \n\t\treturn(\n\t\t\t<div className=\"search-bar\">\n\t\t \t\t<input \n\t\t \t\t\tvalue = {this.state.term} // this turns into controlled component\n\t\t \t\t\tonChange={(event) => this.onInputChange(event.target.value)} />\n\t\t \t</div>\n\t\t );\n\t}", "searchClicked(_) { console.log(this.state.term) }", "function handleSearch(event) {\n //This tweets holds all 10 tweets\n let tweets = document.querySelector(\".tweet-container\").children\n\n //searchString holds the text that the user types inside the search bar \n let searchString = event.target.value.trim().toLowerCase()\n\n //Check if the user has typed anything and if they fetched any tweets yet\n if( searchString === \"\" && tweets.length > 0 ){\n for( let tweet of tweets ){\n //If no text inside search bar, show all 10 tweets\n tweet.style.display = \"flex\"\n }\n\n //If the user typed something inside the search bar and there are tweets to show\n }else if( searchString !== \"\" && tweets.length > 0 ){\n for( let tweet of tweets ){\n let text = tweet.querySelector('.tweetText').innerHTML\n let words = text.toLowerCase().split(/\\W+/)\n\n //Start matching user typed text with the content of each tweet\n if ( words.some( keyword => keyword === searchString) ){\n //If matches, show the tweet\n tweet.style.display = \"flex\"\n }else{\n //If doesn't match, don't show the tweet\n tweet.style.display = \"none\"\n }\n }\n }\n}", "keywordDisplayLogic(term) {\n if (term) {\n $('.keyword-display').text(` - ${term}`);\n this.$searchTerm.val(term).addClass('bg-warning');\n } else {\n $('.keyword-display').text(``);\n this.$searchTerm.val('').removeClass('bg-warning');\n }\n }", "async function searchPosts() {\n let searchTerm = id(\"search-term\").value.trim();\n showHomeView();\n let results = formatResults(await getSearchResults(searchTerm));\n displaySearchResults(results);\n }", "function search() {\n var query_value = $('input#searchbar').val();\n $('b#search-string').html(query_value);\n if(query_value !== ''){\n $.ajax({\n type: \"POST\",\n url: \"/g5quality_2.0/search.php\",\n data: { query: query_value },\n cache: false,\n success: function(html){\n $(\"ul#results\").html(html);\n }\n });\n }return false;\n }", "function selectSearch(ctx) {\n\t\tvar searchTerm = ctx.search_term.trim();\n\t\t// You shouldn't need to search for escaped and non-escaped, but you do..\n\t\t// some things like > will match when escaped, but double quotes will only\n\t\t// match when unescaped\n\t\tvar match = ctx.$options\n\t\t\t\t\t\t\t\t\t .find(\n\t\t\t\t\t\t\t\t\t \t'> li[data-label-slug^=\"' + escapeMarkup(searchTerm) + '\"],\\\n\t\t\t\t\t\t\t\t\t \t > li[data-label-slug^=\"' + searchTerm + '\"]'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t .first();\n\t\tif(match.length) {\n\t\t\t// Update the hover state to the new LI\n\t\t\tselectUpdateHover(ctx,match);\n\n\t\t\t// Scroll to this LI\n\t\t\tif (Element.prototype.scrollIntoViewIfNeeded) {\n\t\t\t\tmatch[0].scrollIntoViewIfNeeded(true);\n\t\t\t}\n\t\t}\n\t}", "function search(accessToken, term) {\n console.log(term);\n return $.ajax({\n url: 'https://api.spotify.com/v1/search',\n data: {\n q: term,\n type: 'track'\n },\n headers: {\n 'Authorization': 'Bearer ' + accessToken\n }\n });\n}", "function searchRender(search) {\n if (search.error === 'Wrong Request') {\n // Make Existing Products disappear\n container.removeChild(container.firstElementChild);\n\n // No Product Message\n const noProduct = document.createElement('div');\n noProduct.setAttribute('class', 'noProduct');\n noProduct.textContent = '請輸入搜尋的產品哦';\n\n container.appendChild(noProduct);\n } else if (search.data.length === 0) {\n // Make Existing Products disappear\n container.removeChild(container.firstElementChild);\n\n // No Product Message\n const noProduct = document.createElement('div');\n noProduct.setAttribute('class', 'noProduct');\n noProduct.textContent = 'Error 404 沒有所搜尋的產品哦';\n\n container.appendChild(noProduct);\n } else {\n // Make homepage's Products disappear\n render(search);\n }\n // remove event listener\n window.removeEventListener('scroll', infiniteScroll);\n}", "render(){\n\n\t\t//return <input onChange={this.onInputChange} />;\n\n\t\treturn(\n\t\t\t //below input is a controled input and its value is controled by state term\n\t\t\t<div className=\"search-bar\">\n\t\t\t\n\t\t\t\t<input value={this.state.term}\n\n\t\t\t\tonChange={event=> this.onInputChange(event.target.value)} />\n\t\t\t\t\n\t\t\t</div>\n\n\t\t\t) \n\t}", "render() {\n\t\tconst searchResults = this.state.searchresults;\n\t\tlet results = <div className=\"recipe-not-found\"><h3>Sorry, there were no results found.</h3></div>;\n\t\tif (searchResults.length > 0) {\n\t\t\tresults = <SearchResults searchresults={searchResults}/>\n\t\t}\n\t\treturn(\n\t\t\t<div className=\"searchbox\">\n\t\t\t\t<div style={{marginBottom: '70px'}}>\n\t\t\t\t\t<SearchBox \n\t\t\t\t\t\tonSearchClick={this.handleSearchClick}/>\n\t\t\t\t</div>\n\t\t\t\t<br />\n\t\t\t\t<div className=\"center-contents-div\">\n\t\t\t\t\t{results}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}", "function search(searchTerm, limit) {\n searchTerm = searchTerm.trim();\n requestStarted = new Date();\n\n $location.path(\"/search/\" + $scope.searchText);\n\n if ($scope.result && $scope.result.searchText === searchTerm)\n return;\n\n wiki.searchFor(searchTerm, limit, function (data) {\n $scope.result = {\n searchText: searchTerm,\n list: data,\n time: new Date() - requestStarted\n };\n\n $scope.$apply();\n });\n }", "function searchQuery(){\n var myData = $('#search_field').val()\n $.post( '/search', { \"myData\": myData, \"tickethub\": true } ).done(function(response) {\n $('#search_results-hub').html(response['text']);\n \n }).fail(function() {\n $('#search_entry').text('Error: Could not find search results!');\n });\n}", "render() {\n // onChange is a specific React-defined event handler\n return (\n <div className=\"search-bar\">\n <input\n value={this.state.term} // the state is telling the input what its value is\n onChange={e => this.onInputChange(e.target.value)}\n />\n </div>\n );\n }", "render() {\n\t\t// onChange is a special property in JS\n\t\t\t\t\t\t\t\t// event handler passed as value to onChange property\n\t\t\t\t\t\t\t\t// reset the value of state.term (with this.setState) and pass the value of property onChange\n\t\treturn (\n\t\t\t<div className=\"search-bar\">\n\t\t\t\t<input\n\t\t\t\t\tplaceholder=\"Enter search here\"\n\t\t\t\t\tvalue={this.state.term}\n\t\t\t\t\tonChange={event => this.onInputChange(event.target.value)} />\n\t\t\t</div>\n\t\t);\t\n\t}", "submitSearch(){\n //Term that we will use for query\n const searchTerm = this.state.searchTerm;\n\n //Require that name not be an empty string\n if(searchTerm.length === 0)\n {\n //Reset state\n this.setState({\n loading: false,\n lastSearchTerm: '',\n results: []\n });\n }\n //Avoid unneeded duplicate requests by checking if search term has changed at all from the term whose results are currently being displayed\n else if(searchTerm !== this.state.lastSearchTerm){\n this.setState({\n lastSearchTerm: searchTerm,//Store this search term as what was previously searched to avoid unneeded duplicate requests\n loading: true//Begin showing loading spinner until results are received\n });\n\n //Send test search with query in format \"[search term] in [location]\"\n PlacesService.textSearch({\n //Searching by zip sucks - like Schenectady, NY's zip code is 12345 and google doesn't know what to do with that\n //Instead, using the formatted name of the location gets way cleaner results!\n query: `${searchTerm} in ${this.props.locationName}`\n }, this.handleSearchResults);\n }\n }", "function goWiki(term) {\n counter = counter + 1;\n //Check if Adolf Hitler\n if (term == 'Adolf Hitler') {\n console.log('Found Hitler')\n console.log('In', counter, 'Random Searches');\n } else {\n let url = searchUrl + term;\n loadJSON(url, gotSearch, 'jsonp');\n }\n}", "function search(searchTerm) {\n\tSC.get('/tracks', {\n\t\tq: searchTerm,\n\t}).then(function(tracks) {\n\t\tplaylist = tracks;\n\t\trenderPlaylist(tracks);\n\t\tplayFirstTrack(); // plays the first song.\n\t});\n}", "function runSearch(search, term) {\n // By default, if no search type is provided, search for a movie\n if (!search) {\n search = \"movie-this\";\n }\n\n // this runs the omdb.js if user selects \"movie-this\"\n if (search === \"movie-this\") {\n // By default, if no search term is provided, search for \"Mr. Nobody\"\n if (!term) {\n term = \"Mr. Nobody\";\n };\n //uses constructor from omdb.js to call the findMovie function and pass through the user's term\n movie.findMovie(term);\n // this runs the bands.js if user selects \"concert-this\"\n } else if (search === \"concert-this\") {\n //uses constructor from bands.js to call the findShow function and pass through the user's term\n band.findShow(term);\n // this runs the spotify.js if user selects \"spotify-this-song\"\n } else if (search === \"spotify-this-song\") {\n //By default, if no search term is provided, search for \"The Sign\"\n if (!term) {\n term = \"The Sign\";\n };\n //uses constructor from spotify.js to call the findSong function and pass through the user's term\n spotify.findSong(term);\n // if user types in an unknown search command\n } else {\n console.log(\"I don't know that.\")\n }\n}", "function onSearch(keyword) {\n renderSearchInput(keyword);//if user clicked and not typed\n keyword = keyword.toLowerCase().trim();\n setImgsForDisplay(keyword);\n const images = getImages();\n const isNothingFound = images.every(img => img.isHidden);\n if (isNothingFound) setAllImgsForDisplay();\n renderImgs();\n}", "function newSearch(req,res){\n // console.log(req.query );\n res.render('pages/index');\n}", "render() {\n return (\n <div className=\"ui segment\">\n <form onSubmit={this.onFormSubmit} className=\"ui form\">\n <div className=\"field\">\n <label> Image Search </label>\n <input\n type=\"text\"\n value={this.state.term}\n onChange={e => this.setState({ term: e.target.value })}\n />\n </div>\n </form>\n </div>\n );\n }", "render() {\n\t\treturn (\n\t\t\t<div className=\"search\">\n\t\t\t\t<Autocomplete\n\t\t\t\t\tgetItemValue={(item) => item.symbol}\n\t\t\t\t\titems={this.state.renderData}\n\t\t\t\t\trenderItem={(item, isHighlighted) =>\n\t\t\t\t\t\t<div style={{ background: isHighlighted ? 'lightgray' : 'white' }} key={item.symbol}>\n\t\t\t\t\t\t\t{item.symbol} - {item.name}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t\tvalue={this.state.searchTerm}\n\t\t\t\t\tonChange={this.handleChange}\n\t\t\t\t\tonSelect={this.handleSelect}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t)\n\t}", "function search() {\r\n let searchTerm = id(\"search-term\").value.trim();\r\n if (searchTerm !== \"\") {\r\n id(\"home\").disabled = false;\r\n loadBooks(\"&search=\" + searchTerm);\r\n }\r\n }", "function handleSearchClick(){\r\n var temp = document.getElementById('searchText').value;\r\n fetchRecipesBySearch(temp);\r\n }", "function search_results(data, context){\n var obj = JSON.parse(data);\n // cache the jQuery object\n var $search_results = $('#search_results');\n // empty the element\n $search_results.empty();\n // add the results\n $search_results.append('<h2>Results</h2><p>Objects with the following ids match your query:</p><ul>');\n if (obj.ids.length>0) {\n $.each(obj.ids, function(o, object_id) {\n context.partial('templates/result.template', { obj: object_id}, function(rendered) { $search_results.append(rendered)});\n });\n } else {\n $search_results.append('<li>None found. Please try again...</li>');\n }\n $search_results.append('</ul>');\n }", "function searchUpdated(term) {\n setsearch(term);\n }", "function searchTeam(term) {\n return search(term, 'soccer club', true);\n}", "handleSearch() {\n this.props.searchBeerApi(this.state.term);\n }", "function Search() {\n const [search, setSearch] = useState(\"Wikipedia\");\n const [title, setTitle] = useState(\"\");\n const [description, setDescription] = useState(\"\");\n const [url, setUrl] = useState(\"\");\n const [error, setError] = useState(\"\");\n\n useEffect(() => {\n if (!search) {\n return;\n }\n\n API.searchTerms(search)\n .then(res => {\n if (res.data.length === 0) {\n throw new Error(\"No results found.\");\n }\n if (res.data.status === \"error\") {\n throw new Error(res.data.message);\n }\n setTitle(res.data[1]);\n setDescription(res.data[2][0]);\n setUrl(res.data[3][0]);\n })\n .catch(err => setError(err));\n }, [search]);\n\n const handleInputChange = event => {\n setSearch(event.target.value);\n };\n\n return (\n <div>\n <Container style={{ minHeight: \"100vh\" }}>\n <h1 className=\"text-center\">Search For Anything on Wikipedia</h1>\n <Alert type=\"danger\" style={{ opacity: error ? 1 : 0, marginBottom: 10 }}>\n {error}\n </Alert>\n <SearchForm\n handleInputChange={handleInputChange}\n results={search}\n />\n <SearchResults title={title} description={description} url={url} />\n </Container>\n </div>\n );\n}", "function getSearchResults(searchTerm) {\n fetch('https://thinksaydo.com/tiyproxy.php?https://openapi.etsy.com/v2/listings/active?api_key=h9oq2yf3twf4ziejn10b717i&keywords=' + encodeURIComponent(searchTerm) + '&includes=Images,Shop')\n .then(response => response.json())\n .then(data => {\n searchResults = data;\n \n console.log(searchResults);\n\n renderResultCards();\n });\n}", "static search(searchTerm){\n return new Promise(async (resolve, reject)=>{\n if(typeof(searchTerm) == \"string\"){\n let posts = await Post.reuseablePostQuery([\n {$match: {$text: {$search: searchTerm}}},\n {$sort: {score: {$meta: \"textScore\"}}}\n ]);\n resolve(posts);\n }else{\n reject();\n }\n })\n }", "render() {\n return (\n <div className=\"search-bar\">\n <input\n value={this.state.term}\n onChange={event => this.onInputChange(event.target.value)} />\n </div>\n );\n }", "function draw_search(env, after) {\n\tenv.$template('search');\n\tenv.$output({title : 'Search'});\n\tafter();\n}", "function handleSubmit() {\n //Take the search term string entered by the user in the input field, add it to the baseUrl, make a fetch request to that new url, and append the results of what we searched for to the DOM in the correct element, wrapped in li tags\n}", "function searchWord(searchword) {\n $('#search-result').show();\n $.post('apis-public/api-search.php', {\n 'searchword': searchword\n },\n function (data) {\n if (data != \"\")\n $('#search-result').html(data);\n }\n ).fail(function () {\n console.log('FATAL ERROR')\n }\n );\n\n}", "render() {\r\n return (\r\n <div className=\"search-bar\">\r\n <input\r\n value={this.state.term}\r\n onChange = {event => this.onInputChange(event.target.value)} />\r\n </div>\r\n );\r\n }", "function singleSearchBar(){\n const searchText = document.getElementById(\"anySearch\").value.toLowerCase();\n console.log(searchText);\n const result = [];\n const nameResult = findByName(searchText, searchText);\n console.log('nameResult:');\n console.log(nameResult);\n result.concat(nameResult);\n renderedTable(result);\n}", "function search_method(){\n var name = \"Jose Carlos Cruz Santiago\";\n var search = name.search(\"Cruz\");\n document.getElementById(\"search_method\").innerHTML=search;\n}", "function finder() {\n filter = keyword.value.toUpperCase();\n var li = box_search.getElementsByTagName(\"li\");\n // Recorriendo elementos a filtrar mediante los li\n for (i = 0; i < li.length; i++) {\n var a = li[i].getElementsByTagName(\"a\")[0];\n textValue = a.textContent || a.innerText;\n\n // QUIERO QUE ME APAREZCAN LAS OPCIONES SI TEXTVALUE.STARTSWITH = FILTER \n\n if (textValue.toUpperCase().indexOf(filter) > -1) {\n li[i].style.display = \"flex\";\n box_search.style.display = \"flex\";\n if (keyword.value === \"\") {\n box_search.style.display = \"none\";\n }\n }\n else {\n li[i].style.display = \"none\";\n }\n\n }\n\n}", "render() {\n return (\n <div className=\"search-bar\">\n <input\n value={this.state.term}\n onChange={event => this.onInputChange(event.target.value)}\n />\n </div>\n );\n }", "render() {\n return (\n <div className=\"search-bar\">\n <input\n value={this.state.term}\n onChange={event => this.onInputChange(event.target.value)}\n />\n </div>\n );\n }", "function SearchWrapper () {}", "function search() {\n var searchTerm = $('#search').val();\n var url = 'https://en.wikipedia.org/w/api.php?action=opensearch&search=' + searchTerm + '&format=json&callback=?';\n $.getJSON(url, function(response) {\n $('.results').empty();\n for (var i = 0; i < response[1].length; i++) {\n html = '<div id=\"articles\" class=\"well\"><a href=\"https://en.wikipedia.org/wiki/' + response[1][i] + '\"target=\"_blank\"><h3>' + response[1][i] + '</h3><p>' + response[2][i] + '</p></a></div>';\n $(\".results\").append(html);\n } \n });\n \n\n // Will output search after every key stroke\n if ($('#search').val().length > 0) {\n $('.articles').css('display', 'none');\n\n } else if ($('#search').val().length < 1) {\n // display everything again\n $('.articles').css('display', 'block');\n }\n \n $('#search').unbind('keyup');\n $('#search').keyup(function() {\n search();\n });\n}", "function searchClick(){\r\n\t//get searchbox value\r\n\tterm = $('#searchBox').val();\r\n\t//Display message while waiting for server response\r\n\t$('#mainContainer').html('<h4>Searching....</h4>');\r\n\t//send AJAX request containing search term\r\n\t$.get( \"index.php\", { s: \"ajxSearchResult\", p: term }, function(data){\r\n\t\t$('#mainContainer').html(data);\r\n\t});\t\r\n}", "function putResultsOnPage(results)\n{\n //get search results div\n var theDiv = document.getElementById('search-results');\n \n //clear current content\n theDiv.innerHTML = '';\n \n //reset Y position because it might have changed after some touch scrolling frenzy!\n theDiv.style.top = '0';\n \n //might be no matches\n if(results.rows.length === 0)\n {\n theDiv.innerHTML = 'No matches found in the common words dictionary.\\\n Tweet @japxlate yourAdvancedWord for advanced word definitions.';\n buttonSpinnerVisible(false); //stop the loading spinner\n return;\n }\n \n //some results so loop through and print\n for(var loop = 0; loop < results.rows.length; loop++)\n {\n var item = results.rows.item(loop);\n \n var theRomaji = kana_to_romaji(item.kana);\n //var theRomaji = item.kana;\n var formattedDefinition = format_slashes(item.definition);\n \n var defText = item.kanji + ' / ' + item.kana + ' (' + theRomaji + ') / ' + formattedDefinition;\n defText = defText.replace(new RegExp(global_searchTerm, 'ig'), '<span style=\"color:#990000;\">$&</span>');\n \n var defLine = '<img src=\"img/j.png\" style=\"vertical-align:middle;\"> ' + defText + '<hr>';\n //var defLine = '<p class=\"def-line\"> ' + defText + '</p>'; //had CSS styling issues (mostly text overflow)\n \n theDiv.innerHTML += defLine;\n }\n \n buttonSpinnerVisible(false); //stop the loading spinner\n}" ]
[ "0.7584577", "0.72619724", "0.72377723", "0.71100754", "0.70543134", "0.6868763", "0.6788832", "0.67786753", "0.67501044", "0.6640264", "0.6620598", "0.6587213", "0.6578422", "0.65749294", "0.65676844", "0.65667856", "0.65666187", "0.65335655", "0.64937586", "0.6486394", "0.64796335", "0.647701", "0.647584", "0.64547384", "0.64471567", "0.64466095", "0.6410417", "0.63985515", "0.63955796", "0.6386238", "0.6384799", "0.6381201", "0.6371252", "0.6367908", "0.63577014", "0.6350834", "0.63468903", "0.63410646", "0.63394773", "0.63339466", "0.6324518", "0.63115215", "0.630532", "0.63043535", "0.6289055", "0.62877613", "0.6287009", "0.62845767", "0.6282342", "0.6276989", "0.62682813", "0.6266681", "0.62664574", "0.6259891", "0.6258409", "0.6257704", "0.6250641", "0.624878", "0.6233966", "0.6224976", "0.6223657", "0.62226117", "0.6221757", "0.6218678", "0.6210176", "0.6203681", "0.61989826", "0.61948663", "0.618361", "0.6178036", "0.6177179", "0.6171178", "0.6169469", "0.6165377", "0.6159358", "0.6159133", "0.6157182", "0.615402", "0.6153983", "0.6153324", "0.6150988", "0.61502045", "0.6132736", "0.612829", "0.61273485", "0.61242956", "0.6123493", "0.61194855", "0.6118842", "0.6114028", "0.61119956", "0.61115384", "0.6105735", "0.61051464", "0.61044526", "0.61032295", "0.61032295", "0.6100063", "0.6094361", "0.6092706", "0.6092008" ]
0.0
-1
Trigger when scene is initialized
async onInitialize() { G.audio.playBGM('bgm/voltexes-ii.mp3'); // backgrounds this.stage.addChild(G.graphics.createImage('graphics/music-select-bg.jpg', { position: 'center', size: 'cover' })); // darken shadow this.stage.addChild(G.graphics.createRect({ top: 0, left: 0, width: 9999, height: 9999, background: 0x000000, opacity: 0.5 })); if (!G.musics) { // loading text this.stage.addChild(this.loadingTextSprite = G.graphics.createText('Loading music list...', { fontSize: 24 }, (w, h, self) => ({ x: 0.5 * (w - self.width), y: 0.5 * (h - self.height) }))); const res = await fetch('api/musics.json'); if (res.ok) { G.musics = await res.json(); this.stage.removeChild(this.loadingTextSprite); } else { console.error(`Get music info failed, code ${res.status}.`); // eslint-disable-line no-console } } // mode text const modeText = { 'play': 'Choose a song to play!', 'edit': 'Use your imagination!' }; this.stage.addChild(G.graphics.createText(`Mode: ${G.mode}\n${modeText[G.mode]}`, {}, { x: 20, y: 20 })); // music list sprite this.stage.addChild(this.musicListSprite = G.graphics.createSprite({ x: 0, y: 0 })); // load last select music if (G.lastSelectMusic !== -1) { this.selected = G.lastSelectMusic; } this.buildMusicSprites(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "initializeScene(){}", "function startup() {\n\tsceneTransition(\"start\");\n}", "function InitScene() {\n\tthis.mPersist = false;\n}", "onCreate(scene, custom) {}", "function initScene() {\n animate();\n}", "function on_load(){\n\n\tmouse.init(three.getCamera());\n\n\tcontrol.init(three.getScene(),three.getCamera(),three.getControl());\n\n}", "function Start(){\n activeScene.traverse(function(child){\n if(child.awake != undefined){\n child.awake();\n }\n });\n\n activeScene.traverse(function(child){\n if(child.start != undefined){\n child.start();\n }\n });\n activeScene.isReady = true;\n}", "function onInit() {}", "init() { \n this.ecs.set(this, \"Game\", \"game\", \"scene\")\n }", "onInitialize() {}", "onInit() {}", "function initScene1() {\n if (currentScene === 1) {\n\n $('#game1').show(\"fast\");\n\n //clique sur une porte\n $('.dungeon0Door').on('click', function (e) {\n console.log(currentScene);\n if (consumeEnergy(10)) {\n if (oD10.roll() >= 8) {\n printConsole('Vous vous echappez du donjon');\n loadScene(2);\n } else {\n printConsole(\"Ce n'est pas la bonne porte ..\");\n $('.dungeon0Door').animate({\n opacity: '0'\n }, 'slow', function () {\n $('.dungeon0Door').animate({\n opacity: '1'\n }, 'fast');\n });\n }\n }\n });\n }\n }", "function init() {\n stage = new createjs.Stage(document.getElementById(\"canvas\"));\n stage.enableMouseOver(30);\n createjs.Ticker.setFPS(60);\n createjs.Ticker.addEventListener(\"tick\", gameLoop);\n optimizeForMobile();\n //set the current game staate to MENU_STATE\n currentState = constants.MENU_STATE;\n changeState(currentState);\n}", "startGame() {\n this.scene.start('MenuScene');\n }", "ready() {\n super.ready();\n\n const that = this;\n\n //a flag used to avoid animations on startup\n that._isInitializing = true;\n\n that._createLayout();\n that._setFocusable();\n\n delete that._isInitializing;\n }", "function windowOnLoad() {\n\n setupCodeMirrorBox()\n registerEventHandlers()\n setupTutorial()\n\n setSpeed(INIT_PLAY_SPEED)\n\n var campaign = PUZZLE_CAMPAIGN\n var state = PUZZLE_CAMPAIGN_STATE\n\n showOrHideLevelMenu(state) \n\n loadLevel(campaign, state)\n restartSimulation()\n\n}", "function init() {\n stage = new createjs.Stage(document.getElementById(\"canvas\"));\n stage.enableMouseOver(30);\n createjs.Ticker.setFPS(60);\n createjs.Ticker.addEventListener(\"tick\", gameLoop);\n optimizeForMobile();\n\n currentState = constants.MENU_STATE;\n changeState(currentState);\n}", "onSetup() {\n this.addSceneObject();\n if (this.sceneObject.geometry.boundingBox != null) {\n this.updateBoundingBox();\n }\n }", "function init() {\r\n // Hide the loading bar\r\n const loading = document.getElementById('loading');\r\n loading.style.display = 'none';\r\n\r\n // Show canvas (initially hidden to show loading)\r\n canvas.style.display = 'inherit';\r\n\r\n // Add listener on window resize\r\n window.addEventListener('resize', resizeCanvas, false);\r\n // Adapt canvas size to current window\r\n resizeCanvas();\r\n\r\n // Add static models to the scene\r\n addStaticModels();\r\n\r\n // Show Play button\r\n const play = document.getElementById('playBtn');\r\n play.style.display = 'inherit';\r\n\r\n play.onclick = function () {\r\n // Create audio context after a user gesture\r\n const audioCtx = new AudioContext();\r\n\r\n // Create an AudioListener and add it to the camera\r\n listener = new THREE.AudioListener();\r\n camera.add(listener);\r\n\r\n // Hide Play button and start the game\r\n play.style.display = \"none\";\r\n start();\r\n }\r\n }", "function onCreate() {\n\n /* -------------------------------*/\n /* Setting the stage */\n /* -------------------------------*/\n\n // **** Create our scene ***\n initScene();\n\n // **** Set up the Renderer ***\n initRenderer();\n\n // **** Setup Container stuff ***\n initContainer();\n\n // *** Setup the Halo stats div ***\n initStatsInfo();\n\n // **** DAT GUI! ***\n initGUI();\n\n // **** Setup our slider ***\n initSlider();\n\n\n /* -------------------------------*/\n /* Organizing our Actors */\n /* -------------------------------*/\n\n // Load Data for Halo // TREE679582 TREE676638\n initHaloTree(TREE676638, true);\n\n // **** Lights! ***\n initLights();\n\n // **** Camera! ***\n initCamera();\n\n // **** Setup our Raycasting stuff ***\n initRayCaster();\n\n // **** Action! Listeners *** //\n initListeners();\n\n\n}", "function init() {\n stage = new createjs.Stage(document.getElementById(\"canvas\"));\n stage.enableMouseOver(30);\n createjs.Ticker.setFPS(60);\n createjs.Ticker.addEventListener(\"tick\", gameLoop);\n this.soundtrack = createjs.Sound.play('soundtrack', createjs.Sound.INTERRUPT_NONE, 0, 0, -1, 1, 0);\n optimizeForMobile();\n\n currentState = constants.MENU_STATE;\n changeState(currentState);\n}", "function initialize() {\n activateMenus();\n}", "create(){\n this.scene.start('MenuGame');\n }", "function init() {\n stage = new createjs.Stage(document.getElementById(\"gameCanvas\"));\n game = new createjs.Container();\n stage.enableMouseOver(20);\n createjs.Ticker.setFPS(60);\n createjs.Ticker.addEventListener(\"tick\", gameLoop);\n optimizeForMobile();\n\n // When game begins, current state will be opening menu (MENU_STATE)\n //scoreboard = new objects.scoreBoard(stage, game);\n currentState = constants.MENU_STATE;\n changeState(currentState);\n}", "function sceneStart(){\n\t\t\t\tfor (n = 0; n < heroes.length; n++)\n\t\t\t\t\theroes[n].tl.delay(20).fadeIn(35);\n\t\t\t\tmonster.tl.delay(20).fadeIn(35).delay(10).then(function(){\n\t\t\t\tgame.sceneStarted = true;\n\t\t\t\tthreatBar.opacity = 1;\n\t\t\t\tthreatGuage.opacity = 1;\n\t\t\t\tmonsterBox.opacity = 1;\n\t\t\t\tmonsterName.opacity = 1;\n\t\t\t\tpartyBox.opacity = 1;\n\t\t\t\tmuteButton.opacity = 1;\n\t\t\t\tfor (n = 0; n < nameLabels.length; n++){\n\t\t\t\t\tnameLabels[n].opacity = 1;\n\t\t\t\t\thpLabels[n].opacity = 1;\n\t\t\t\t\tmaxhpLabels[n].opacity = 1;\n\t\t\t\t\tmpLabels[n].opacity = 1;\n\t\t\t\t}\n\t\t\t});\n\t\t\t}", "init() {\n // Action to execute on load of the app\n }", "function tutorialSceneSetup() {\r\n //var Whatever here\r\n if (!this.isLoaded) {\r\n\r\n //Scene Setup\r\n tutorialSceneSetupTextBoxes();\r\n tutorialSceneSetupButtons();\r\n\r\n //mainTextBox.sizeW = firstButton.sizeW + secondButton.sizeW + 30;\r\n\r\n this.isLoaded = true;\r\n } else {\r\n console.warn(\"Scene was attempted to be setup while already loaded.\");\r\n }\r\n}", "function on_load()\n{\n\tgame.start();\n}", "init() {\n let that = this;\n let loop = setInterval(function() {\n if(that._activeScene != null) {\n const self = that._activeScene;\n self.options.update();\n self.options.render();\n }\n }, 16.66);\n }", "create(){\n this.add.text(20, 20, \"LoadingGame...\")\n\n this.time.addEvent({\n delay: 3000, // ms\n callback: function(){this.scene.start('MenuScene')},\n //args: [],\n callbackScope: this,\n loop: true \n });\n\n \n }", "function runBeforeInit() {\n Device_1.default.Instance.init();\n DrawEngine_1.G_DrawEngine.init(Device_1.default.Instance.gl);\n ShaderFactory_1.G_ShaderFactory.init(Device_1.default.Instance.gl);\n BufferManager_1.G_BufferManager.init(Device_1.default.Instance.gl);\n ShaderCenter_1.G_ShaderCenter.init();\n LightCenter_1.G_LightCenter.init();\n LightModel_1.G_LightModel.init();\n UiSetting_1.G_UISetting.setUI();\n}", "function loadScene(scene) {\r\n if (!scene.isLoaded) {\r\n scene.setUp();\r\n currentScene = scene;\r\n }\r\n}", "trigger() {\n if(level === 1) {\n // set the level to world2\n setScene(WORLD2);\n drawGameboard();\n resetGame();\n level = 2;\n } else if(level === 2) {\n // set the level to world3\n setScene(WORLD3);\n drawGameboard();\n resetGame();\n level = 3;\n } else {\n // set the level back to world1\n setScene(WORLD1);\n drawGameboard();\n resetGame();\n level = 1;\n }\n }", "function loadCallback(object) {\n scene = object;\n camera = object.getObjectByName(\"Camera\");\n camera.aspect = aspect;\n camera.updateProjectionMatrix();\n initScene();\n initControls();\n}", "initialize() {\n throw new Error(\"Scene::You have to implement the method initialize!\");// initialize the level (called from GameLoop)\n }", "function centralInit(){\n homeNavBoxEvents();\n}", "constructor() { //call constructor method on the game object to create an instance of scene \n super({ key: \"Paused\" }); //on the game object create a property of scene and set key to SceneMainMenu, used in config parameters for game\n }", "function init() {\n canvas = document.getElementById(\"canvas\"); // reference to canvas element\n stage = new createjs.Stage(canvas); // passing canvas to stage\n stage.enableMouseOver(20); // listening every 20fps for any mouse over events to enable them in the Stage (our main canvas - our scene per se)\n createjs.Ticker.setFPS(60); // set frame rate to 60 fps\n createjs.Ticker.on(\"tick\", gameLoop); // update gameLoop every frame\n setupStats(); //sets up our stat counting before calling Main function - to start counting in Main function\n state = config.MENU_STATE; // on first frame - we have the state number equal to the menu state first - \n changeState(); // - which calls this function on first frame to have menu state show up first\n}", "onInit() {\n this.__initEvents();\n }", "function init()\n{\n // frame clock\n clock = new THREE.Clock();\n \n // scene\n scene = new THREE.Scene();\n \n // camera\n camera = new THREE.PerspectiveCamera(38,\n renderWidth / renderHeight,\n 1, 10000);\n camRotationX = -25;\n camRotationY = 0;\n dragging = false;\n\n // call custom initialization function\n if (typeof initScene == 'function')\n {\n initScene();\n }\n}", "onGraphLoaded() {\n\n this.camera = this.gameOrchestrator.theme.camera;\n\n this.interface.setActiveCamera(this.camera);\n\n this.axis = new CGFaxis(this, this.gameOrchestrator.theme.referenceLength);\n\n if(this.gameOrchestrator.theme.background)\n this.gl.clearColor(...this.gameOrchestrator.theme.background);\n\n this.setGlobalAmbientLight(...this.gameOrchestrator.theme.ambient);\n\n this.initLights();\n\n this.selectedView = 'Menu';\n\n this.changeCamera();\n\n this.interface.setInterface();\n \n this.sceneInitiated = true;\n\n this.gameOrchestrator.onGraphLoaded();\n }", "function init() {\n //go through menus\n menus = true;\n //choosing play style\n choosingStyle = true;\n //Display text and buttons\n AI.DecidePlayStyle();\n //load the board and interactable cubes\n LoadBoard();\n LoadInteractables();\n}", "function init() {\n\tcamera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 2000 );\n\tscene = new THREE.Scene();\n\tscene.fog = new THREE.Fog( 0xffffff, 0, 600 );\n\tscene.add( camera );\n\t\n\t\n\t\n\t//setupScene();\n\t\n\t//\n\trenderer = new THREE.WebGLRenderer();\n\trenderer.setClearColor( 0xa3c5dc );\n\trenderer.setPixelRatio( window.devicePixelRatio );\n\trenderer.setSize( window.innerWidth, window.innerHeight );\n\tdocument.body.appendChild( renderer.domElement );\n\t//\n\twindow.addEventListener( 'resize', onWindowResize, false );\n\t\n\t\n\tdocument.addEventListener( 'keydown', onKeyDown, false );\n\tdocument.addEventListener( 'keyup', onKeyUp, false );\n\t//practiceLvl.addEventListener( 'click', setupScene(Levels.Practice), false);\n}", "function start() {\n // To present a scene, use the following line, replacing 'sample' with\n // the id of any scene you want to present.\n\n SceneManager.getSharedInstance().presentScene('newScene1');\n}", "onInit()\n {\n // \n }", "function init() {\n // Create game stage & initialize stuff\n superSimple.start();\n // Show tutorial\n tutorial.start();\n // when tutorial ends do...\n tutorial.onEnd = function() {\n var a = new After();\n a.after(0, function() {\n superSimple.controller.showMessage(\"Enjoy!\", 40, 2);\n })\n .after(1, function() {\n superSimple.controller.spawnPlayer();\n })\n .after(0.5, function() {\n superSimple.controller.spawnEnemy();\n superSimple.controller.spawnEnemy();\n })\n .after(0.5, function() {\n superSimple.controller.spawnEnemy();\n superSimple.controller.spawnEnemy();\n })\n .after(0.5, function() {\n superSimple.controller.spawnEnemy();\n superSimple.controller.spawnEnemy();\n })\n .after(0.5, function() {\n superSimple.controller.spawnEnemy();\n superSimple.controller.spawnEnemy();\n });\n };\n }", "start(){\r\n if (this.scene.scene\r\n .get(\"levelMap\")\r\n .localStorage.getItem(`${this.scene.key}R`) === null) {\r\n this.intro();\r\n }\r\n }", "function loadScene() {\n scene = new Scene (null, 0.2); // global ambient intensity\n\n loadDefaultCamera();\n loadDefaultLight();\n\n if (ModuleId.B3) {\n loadB3();\n } else if (ModuleId.B4) {\n loadB4();\n } else if (ModuleId.X1) {\n loadAdditionalStuff();\n } else {\n loadA1();\n }\n\n console.log(\"scene loaded\");\n}", "onload() {\n this.init();\n }", "activate() {\n if (CONFIG.DEBUG) {\n if (!window.THREE) {\n window.THREE = THREE;\n }\n window.scene = this._scene;\n }\n }", "init(loadingManager) {\n this._scene = new THREE.Scene();\n }", "initiate() {\n this.#buildStartGameButton();\n this.#buildhowToPlayButton();\n this.#buildAboutButton();\n this.#startHeaderAnimation();\n }", "init() {\n this.scene = new THREE.Scene()\n\n this.camera = new CustomCamera( 50, this.innerWidth / this.innerHeight, 1, 100 )\n this.camera.position.set( 0, 0, 12 )\n this.camera.lookAt( new THREE.Vector3( 0, 0, 0 ) )\n\n this.renderer = new THREE.WebGLRenderer( { antialias: true } )\n this.renderer.setSize( this.innerWidth, this.innerHeight )\n this.renderer.setClearColor( 0x2c3e50 )\n this.renderer.clear()\n this.container.appendChild( this.renderer.domElement )\n\n this.composer = new EffectComposer( this.renderer )\n this.composer.addPass( new EffectComposer.RenderPass( this.scene, this.camera ) )\n\n this.vignetteEffect = new EffectComposer.ShaderPass( THREE.VignetteShader )\n this.vignetteEffect.uniforms.offset.value = 0.6\n this.vignetteEffect.uniforms.darkness.value = 1\n this.vignetteEffect.renderToScreen = true\n this.composer.addPass( this.vignetteEffect )\n\n this.clock = new THREE.Clock\n\n this.resize()\n window.addEventListener( 'resize', this.resize.bind( this ), false )\n\n this.sound.load( 'assets/sound/piano.mp3' )\n this.sound.on( 'start', () => {\n this.createScene( this.sound.duration )\n this.animate()\n })\n }", "_setBoot() {\n this.config.scene = [Boot];\n }", "function newLevelWillStart(scene){\r\n if(logEvents) console.log(\"Event [newLevelWillStart]\", arguments);\r\n scene.levelEnd.loadNextScene();\r\n}", "create() {\n // We have nothing left to do here. Start the next scene.\n \n\n this.input.on('pointerdown', function (pointer) {\n\n this.scene.start('Game');\n }, this);\n\n \n }", "initialisation() {\n this.clearContainer(this.scene);\n this.clickContainer = new THREE.Object3D();\n this.scene.add(this.clickContainer);\n }", "function init() {\n if (game.init())\n game.start();\n}", "function stageOnSuccessLoad(content) {\n\t // Initialize\n \tstageInit(content.scene);\n \t// Render the sky\n \tscene.background = renderSky(content.sky);\n \t// light setting\n \tsetLight(content.light);\n \t// Render the platforms\n \tbuildPlatforms(content.stage, content.platform);\n \t// Set the interval with a specific FPS\n \trequestAnimationFrame(animate);\n \tanimationInterval = setInterval(function() {\n \t\trequestAnimationFrame(animate);\n \t}, 1000 / c_FPS);\n\tpaused = false;\n}", "startScene() {\n console.log('[Game] startScene');\n var that = this;\n\n if (this.scene) {\n console.log('[Game] loading scene');\n this.scene.load().then(() => {\n console.log('[Game] Scene', that.scene.name, 'loaded: starting run & render loops');\n // setTimeout(function() {\n debugger;\n that.scene.start();\n debugger;\n that._runSceneLoop();\n that._renderSceneLoop();\n // }, 0);\n });\n } else {\n console.log('[Game] nothing to start: no scene selected!!');\n }\n }", "[$onContentLoad](e) {\n this.activeScene = undefined;\n this.activeEntity = undefined;\n this.activeRenderer = undefined;\n this.needsReload = false;\n }", "constructor() {\n this._curScene = new _EmptyScene();\n }", "create() {\n\n // add animations (for all scenes)\n this.addAnimations();\n\n // change to the \"Home\" scene and provide the default chord progression / sequence\n this.scene.start('Home', {sequence: [0, 1, 2, 3, 0, 1, 2, 3]});\n }", "create() {\n console.log('preload')\n this.scene.start('BoardView')\n \n \n //this.scene.remove('Preload')\n }", "_onInit(deviceId){\n\t\tthis._deviceId = deviceId\n\t\tthis._isInitialized = true\n\t\ttry {\n\t\t\tthis.dispatchEvent(new CustomEvent(ARKitWrapper.INIT_EVENT, {\n\t\t\t\tsource: this\n\t\t\t}))\n } catch(e) {\n console.error('INIT_EVENT event error', e)\n }\n\t}", "function init(){\r\n \t\tinitPhysijs();\r\n\t\tscene = initScene();\r\n\t\tcreateEndScene();\r\n\t\tcreateEndLoseScene();\r\n\t\tinitRenderer();\r\n\t\tcreateMainScene();\r\n\t}", "function onLoaded()\n\t{\n\t\twindow.initExhibitorsList();\n\t\twindow.initFloorPlans();\n\t\twindow.initConciege();\n\t\twindow.initAmenities();\n\t\twindow.initVisas();\n\t}", "_start() {\n\n this._menuView = new MenuView(\n document.querySelector('nav'),\n this.sketches\n );\n\n for (var key in this.sketches) {\n this.DEFAULT_SKETCH = key;\n break;\n }\n\n this._setupScroll();\n this._setupWindow();\n this._onHashChange();\n }", "function start() {\n for(var i = 0; i < sceneList.length; i++) {\n addScene(sceneList[i]); // sceneList.js is imported in html-file\n }\n setScene(\"start\");\n }", "function initScene() {\r\n \r\n // add controls using mouse\r\n game.controls = new THREE.OrbitControls( game.camera );\r\n game.controls.addEventListener( 'change', renderScene ); // if change the mouse, trigger renderScene again\r\n\r\n // create the webgl renderer\r\n game.renderer = new THREE.WebGLRenderer();\r\n // set the aspect ratio from window\r\n game.renderer.setPixelRatio( window.devicePixelRatio );\r\n // set size using the window inner size\r\n game.renderer.setSize( window.innerWidth, window.innerHeight );\r\n\r\n // get the DOM element container\r\n game.container = document.getElementById( 'container' );\r\n\r\n // add canvas element from renderer into the container\r\n game.container.appendChild( game.renderer.domElement );\r\n\r\n // add resize event triggering\r\n window.addEventListener( 'resize', onWindowResize, false );\r\n \r\n document.addEventListener('mousemove', onMouseMove, false);\r\n}", "constructor(scene) {\n super(scene);\n this.scene = scene;\n this.initComponents();\n }", "function onLoad() {\n sozi.events.listen('framechange', onFrameChange);\n }", "function init() {\n\t\t// reset will display start game screen when screen is designed\n\t\treset();\n\n\t\t// lastTime required for game loop\n\t\tlastTime = Date.now();\n\n\t\tmain();\n\t}", "constructor(){\n super()\n this.importantObject = new BABYLON.Scene(this.context.engine)\n this.setInitialProps()\n this.contextAdditions.scene = this.importantObject\n }", "function init() {\n gameStart();\n}", "function stageInit(sceneObject) {\n\t// Initial setup\n\tscene = new THREE.Scene();\n\tcamera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);\n\tcamera.position.set(0, 20, -20);\n\tcamera.lookAt(new THREE.Vector3(0, 0, 20));\n\n\t// make the \"fog\"\n\tlet fogAttr = sceneObject.fog;\n\tif (fogAttr) {\n\t\tscene.fog = new THREE.Fog(fogAttr.color, fogAttr.near, fogAttr.far);\n\t\tlosingY = -100;\n\t}\n\n\t// generate particle system\n\tlet particleSystemSetup = sceneObject.particles;\n\tif (particleSystemSetup) {\n\t\tparticleSystemInit(particleSystemSetup);\n\t}\n\n\t// AudioListener for audio\n\taudioListener = new THREE.AudioListener();\n\tcamera.add(audioListener);\n\n\t// Listener for window resize\n\twindow.addEventListener('resize', function() {\n\t renderer.setSize(window.innerWidth, window.innerHeight);\n\t\tcamera.aspect = window.innerWidth / window.innerHeight;\n\t camera.updateProjectionMatrix();\n\t}, false);\n\n\t// Listener for keyboard input\n\tdocument.addEventListener(\"keydown\", onKeyDown);\n\treturn;\n}", "show ()\n\t{\n\t\t//if the view hasn't been initialised, call setup (of the concrete view e.g. LOView)\n\t\tif(!this.initialised)\n\t\t{\n\t\t\tthis.setup();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//unhide the elements of the scene\n\t\t\tthis.root.style.display = 'block';\n\t\t}\n\t}", "function _init_level_1() {\n\t\tmedeactx.cached_cw = medeactx.canvas.width, medeactx.cached_ch = medeactx.canvas.height;\n\n\t\t// always allocate a default root node for the visual scene\n\t\tmedeactx.scene_root = medeactx.CreateNode(\"root\");\n\n\t// #ifdef LOG\n\t\tmedealib.LogDebug('initialization complete');\n\t// #endif\n\n\t\tuser_on_ready(medeactx);\n\t}", "function init() {\n animation.Initialize();\n }", "function init(){\n initThree();\n initEvents();\n starttime = Date.now();\n system = makeSystem(planetCountInput); //Make a system (plugged with 5 children)\n controls.objectToFollow = system.mesh; //Link the camera to the Sun\n loadTime = (Date.now() - starttime) / 1000\n console.log(system.name + \" System Generated in \" + loadTime.toFixed(2) + \" Seconds\"); //Report load time\n scene.add(system.pivot); //Add the system to the scene for rendering\n}", "setup() {\n\t\tthis.stage.removeAllChildren();\n\t\tthis.initBackground();\n\t\tthis.initReceptors();\n\t\tthis.initNotetrack();\n\t\tthis.initStats();\n\t\tthis.initTimeline();\n\t\tthis.initBackButton();\n\t}", "function Scene_Menu() {\n this.initialize.apply(this, arguments);\n}", "function preInitialize() {\n preInitialization.style.display = 'block';\n game.style.display = 'none';\n}", "start(){\n if (this.scene.reset == true) {\n if (this.gameCount > 0 && this.model.playsCoords.length > 0) {\n this.undoAllPlays();\n this.state = 'SMALL_WAIT';\n }\n else {\n this.state = 'UPDATE_CONFIGS';\n }\n this.restart_values();\n this.gameCount++;\n }\n }", "onInit() {\n this.score = this.timeLimit;\n this.quizOver = false;\n this.introView.render();\n this.introView.attachEventHandlers();\n }", "function Awake () {\n\n\t}", "function Awake () {\n\n\t}", "function init() {\n \n\tTweenLite.set($slides, {\n\t\tleft: \"-100%\"\n });\n\tgotoSlide(0, 0);\n}", "doReStart() {\n // Stoppe la musique d'intro\n this.musicIntro.stop();\n // Lance la scene de menus\n this.scene.start('MenuScene');\n }", "function startup() {\n let canvas = document.getElementById(renderSettings.viewPort.canvasId);\n\n if (enableDebugging) {\n gl = createGLContext(canvas);\n } else {\n gl = canvas.getContext(\"webgl\");\n }\n setupRotationMatrices();\n initGL();\n resizeWindow();\n\n window.addEventListener(\"keyup\", onKeyup, false);\n window.addEventListener(\"keydown\", onKeydown, false);\n window.addEventListener(\"resize\", resizeWindow, false);\n window.addEventListener(\"visibilityChange\", handleVisibilityChange, false);\n //drawSimpleCurveScene();\n drawAnimated(0);\n}", "async onInitialize() {\n // background\n this.stage.addChild(G.graphics.createImage(this.bgUrl, (w, h, self) => ({\n position: 'center',\n size: 'cover'\n })));\n // darken shadow\n this.stage.addChild(G.graphics.createRect({\n top: 0,\n left: 0,\n width: 9999,\n height: 9999,\n background: 0x000000,\n opacity: 0.5\n }));\n // rect\n this.stage.addChild(G.graphics.createRect({\n top: window.innerHeight * 0.5 - 250,\n left: window.innerWidth * 0.5 - 350,\n width: 700,\n height: 500,\n background: 0x000000,\n borderWidth: 1,\n borderColor: 0xffffff,\n opacity: 0.5\n }));\n }", "runGame(){\n\t\t\tthis.scene.runGame();\n\t\t}", "function initMenu() {\n // Connect Animation\n window.onStepped.Connect(stepMenu);\n\n // Make buttons do things\n let startbutton = document.getElementById('start_button');\n \n //VarSet('S:Continue', 'yielding')\n buttonFadeOnMouse(startbutton);\n startbutton.onclick = startDemo\n\n\n // run tests for prepar3d integration\n runTests();\n}", "function initialize() {\n //\n // Go through each of the screens and tell them to initialize\n for (let screen in screens) {\n if (screens.hasOwnProperty(screen)) {\n screens[screen].initialize();\n }\n }\n\n let menuButtons = document.getElementsByTagName('button');\n for (let i = 0; i < menuButtons.length; i++) {\n menuButtons[i].addEventListener('mouseenter', function(){soundSystem.buttonHover()});\n menuButtons[i].addEventListener('click', function(){soundSystem.buttonClick()});\n }\n\n\n\n\n\n //\n // Make the main-menu screen the active one\n showScreen('main-menu');\n }", "function initScene() {\n \n gl.viewport(0, 0, 1920, 1080);\n gl.clearColor(15 / 255, 15 / 255, 15 / 255, 1.0);\n gl.clearDepth(1.0);\n\n gl.mvMatrix = new CanvasMatrix4();\n gl.mvMatrix.makeIdentity();\n gl.mvMatrix.translate( - 21, 11.5, -23);\n\n gl.perspectiveMatrix = new CanvasMatrix4();\n gl.perspectiveMatrix.makeIdentity();\n gl.perspectiveMatrix.lookat(0, 0, 5, 0, 0, 0, 0, 1, 0);\n gl.perspectiveMatrix.perspective(45, 1920 / 1080, .1, 5000.0);\n gl.perspectiveMatrixArray = gl.perspectiveMatrix.getAsWebGLFloatArray();\n\n gl.enable(gl.BLEND);\n gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.SRC_ALPHA, gl.ONE)\n\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, gl.box.indexObject);\n \n screen = createScreen();\n \n \n }", "function onStartTrigger() {\n stop = false\n if (!running) {\n start(script.images, script.randomImageMaterial, script.changeDelay)\n }\n}", "preload () {\n\t\tgame.stage.disableVisibilityChange = true; // keeps everything running when the stage is no longer focused\n\t}", "didInit() { }", "onLoad() {\n\n // Do something when a section instance is loaded\n this.init();\n }", "function initPhysijsScene(){\n Physijs.scripts.worker = 'physijs_worker.js';\n Physijs.scripts.ammo = 'ammo.js';\n scene = new Physijs.Scene();\n }", "function begin() {\n\tbackgroundBox = document.getElementById(\"BackgroundBox\");\n\n\tbuildGameView();\n\tbuildMenuView();\n\n\tinitSFX();\n\tinitMusic();\n\n\tENGINE_INT.start();\n\n\tswitchToMenu(new TitleMenu());\n\t//startNewGame();\n}" ]
[ "0.7826884", "0.7546757", "0.72157234", "0.7152198", "0.7124511", "0.69581294", "0.6890136", "0.68653435", "0.68393004", "0.6836585", "0.68063146", "0.67759544", "0.6734464", "0.66945475", "0.6692034", "0.66759014", "0.6670906", "0.66423315", "0.66281724", "0.6621288", "0.65921044", "0.65874386", "0.65759337", "0.65757704", "0.6573834", "0.65425265", "0.65414566", "0.654053", "0.65359133", "0.6523029", "0.65212995", "0.6505353", "0.6504187", "0.648509", "0.64814717", "0.64643157", "0.6461229", "0.6460694", "0.6438482", "0.64371216", "0.6436547", "0.64083487", "0.6398718", "0.63954866", "0.6394427", "0.63783723", "0.6370031", "0.6370006", "0.63394827", "0.63331085", "0.6316619", "0.6312207", "0.6311136", "0.629741", "0.629592", "0.6293791", "0.6269059", "0.62688375", "0.6267392", "0.6264995", "0.62637305", "0.6262019", "0.62356836", "0.623144", "0.62276673", "0.62268776", "0.6211188", "0.6210273", "0.62088984", "0.62082237", "0.620493", "0.61938053", "0.6171946", "0.6170352", "0.6165593", "0.6163933", "0.6159681", "0.6159675", "0.61589015", "0.6155173", "0.61522853", "0.61483395", "0.61404705", "0.6140238", "0.6139236", "0.6137335", "0.6137335", "0.6131707", "0.6129165", "0.612469", "0.6121567", "0.61194944", "0.61181366", "0.61048895", "0.61011636", "0.6096573", "0.6093375", "0.60880536", "0.6087392", "0.60745865", "0.60734534" ]
0.0
-1
Do calculations only, DO NOT do any paint in this function
update() { // deal with input if (G.input.isPressed(G.input.ESC)) { G.audio.playSE('se/menu-back.mp3'); // press ESC to back to title G.scene = new SceneTitle(); G.lastSelectMusic = this.selected; } else if (G.input.isPressed(G.input.UP) || G.input.isPressed(G.input.LEFT)) { // press UP or LEFT to select music above this.selected = (this.selected - 1 + G.musics.length) % G.musics.length; G.audio.playSE('se/menu-cursor.mp3'); this.animateMusicSprites(); } else if (G.input.isPressed(G.input.DOWN) || G.input.isPressed(G.input.RIGHT)) { // press DOWN or RIGHT to select music below this.selected = (this.selected + 1) % G.musics.length; G.audio.playSE('se/menu-cursor.mp3'); this.animateMusicSprites(); } else if (G.input.isPressed(G.input.ENTER)) { G.audio.playSE('se/menu-click.mp3'); // press ENTER to enter playfield or editor G.lastSelectMusic = this.selected; switch (G.mode) { case 'play': G.scene = new SceneGaming(this.selected); break; case 'edit': G.scene = new SceneEditor(this.selected); break; default: break; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculate(){}", "function calculate() {\n\n calculator.calculate();\n\n }", "compute() {\n if (this.active) {\n this.x2 = event.clientX;\n this.y2 = event.clientY;\n this.reCalc(this.x1, this.x2, this.y1, this.y2);\n }\n }", "function calculate() {\r\n\teval();\r\n\tstopAll();\r\n}", "function calculations() \n{\n\t//This variable stores current time.\n\tvar timeNow = new Date().getTime();\n\t\n\t//This loop runs after the program has been started.\n\tif (lastTime != 0) \n\t{\n\t\t\n\t\t//This variable stores the time since the method calculations() was ran.\n\t\tvar elapsed = timeNow - lastTime;\n\t\t\n\t\t\t//This loop goes through each object that is gonig to be rendered from the object list.\n\t\t\tfor(var i=0;i<objectsToRender.length;i++)\n\t\t\t{\n\t\t\t\t//Stores the currnet object in a variable for use.\n\t\t\t\tvar currentObj=objectsToRender[i];\n\t\t\t\t\n\t\t\t\t//Now if a object has no rotation speed,then it wont rotate, by default all objects have 0 rotation speed.\n\t\t\t\tcurrentObj.setRotationDegree(currentObj.getRotationDegree()+(currentObj.getRotationSpeed()*elapsed)/1000);\n\t\t\t\t\n\t\t\t}//End for.\n\t\t\t\n\n\t \n\t}//End if.\n\t\n\t//Update last time this method was ran.\n\tlastTime = timeNow;\n\t\n}//End calculations.", "reflow() {\n this.calcPoints();\n this._updateActive();\n }", "function doMath()\n\t{\n\t\treturn pixels/baseValue;\n\t}", "instantCompute(){\n if(this.points.length<3){\n this.drawFinishIfLessThan3Points();\n return;\n }\n this.sucess=false\n while(!this.sucess){\n this.calculateNextStep();\n }\n this.drawFinish();\n }", "function computeValues() {\n\t\t\t\n\t\t\tvar scaler;\n\t\t\t// deal with loop\n\t\t\tif (repeat > 0) {\n\t\t\t\t// not first run, save last scale ratio\n\t\t\t\txFrom = xTo;\n\t\t\t\tyFrom = yTo;\n\t\t\t\tratioFrom = ratioTo;\n\t\t\t} else {\n\t\t\t\t// get the scaler using conf options\n\t\t\t\tscaler = $.pixelentity.Geom.getScaler(zoom == \"out\" ? \"fill\" : \"none\",align.w,align.h,w,h,tw,th);\n\t\t\t\txFrom = scaler.offset.w;\n\t\t\t\tyFrom = scaler.offset.h;\n\t\t\t\tratioFrom = scaler.ratio;\n\t\t\t}\n\t\t\t\n\t\t\tscaler = $.pixelentity.Geom.getScaler(zoom == \"in\" ? \"fill\" : \"none\",pan.w,pan.h,w,h,tw,th);\n\t\t\txTo = scaler.offset.w;\n\t\t\tyTo = scaler.offset.h;\n\t\t\tratioTo = scaler.ratio;\n\t\t\t\n\t\t\txPrev = 0;\n\t\t\tyPrev = 0;\n\t\t\t\n\t\t\tduration = parseFloat(normalized)*33;\n\t\t\t\n\t\t\t// reset counter\n\t\t\tcounter = 0;\n\t\t\t\n\t\t\t// update runs count\n\t\t\trepeat++;\n\t\t\t\n\t\t}", "function calculate() {\n \n //Parse number variables to floats\n numOne = parseFloat(numOne);\n numTwo = parseFloat(numTwo);\n\n //Determine calculation to run via ID of operator\n if( op == 'add' ) {\n numOne = numOne + numTwo;\n }\n else if( op == 'subtract' ) {\n numOne = numOne - numTwo;\n }\n else if( op == 'multiply' ) {\n numOne = numOne * numTwo;\n }\n else {\n //Throw error and ask to be reset if attempt to divide by 0\n if( numTwo == 0 ) {\n error = true;\n }\n //If not diving by 0, run calculation\n else{\n numOne = numOne / numTwo;\n }\n }\n\n //If there was a divide by 0 error inform user and prompt to reset\n if( error == true ) {\n $currentDisplay.val('Cannot divide by 0. Please clear calculator.');\n $( '.ui-btn' ).prop('disabled', true);\n $( '.clear' ).prop('disabled', false);\n }\n //Else move on to update display\n else {\n //If the display for the number is too long, set the display to be cut off at 15 decimal points\n if( numOne.length > 18 ) {\n numOneDisplay = parseFloat(numOne).toFixed(15);\n }\n //Else, display normally\n else{\n numOneDisplay = numOne;\n }\n //Update the display\n $currentDisplay.val(numOneDisplay);\n //Set calculator so that it knows a calculation just occured and no operator has been chosen yet\n postCalc = true;\n opClicked = false;\n }\n\n }", "function Calculation() {\n }", "function paint() {\n\n\t\t\tpaintStones();\n\n\t\t\t// Tag the current move\n\t\t\tif (goMap.currentMoveIndex > 0) {\n\t\t\t\tpaintCurrentMove();\n\t\t\t}\n\n\t\t\tif (displayNum) {\n\t\t\t\tpaintNumbers();\n\t\t\t}\n\t\t}", "function calculate() {\n\t\tvar servings = 0;\n\t\tvar standardDrinks = 0;\n\t\tvar calories = 0;\n\n\t\t$('.calculator-carousel .single-drink').each(function(){\n\t\t\tvar currentDrinkType = $(this).data('drinktypes').split(',')[$(this).data('currenttype')].split('|');\n\t\t\tservings += $(this).data('quantity');\n\t\t\tstandardDrinks += $(this).data('quantity') * (currentDrinkType[2] / 1000) * drinkDefinitions[currentDrinkType[1]]['abv'] * 0.789;\n\t\t\tcalories += $(this).data('quantity') * (currentDrinkType[2] / 100) * drinkDefinitions[currentDrinkType[1]]['calories'];\n\t\t\t//Only render if the values change\n\t\t\tvar renderId = String(servings) + \",\" + String(standardDrinks) + \",\" + String(calories);\n\t\t\tif (renderId != calculationId) {\t\t\t\n\t\t\t\t\n\t\t\t\trenderResults(servings, standardDrinks, calories);\n\t\t\t}\n\t\t\tcalculationId = renderId;\n\t\t});\n\t}", "function getTotal() {\n if (!runningTotal) {\n operate(x, sign, y);\n runningTotal = true;\n } else if (runningTotal) {\n operate(total, sign, y);\n } \n}", "function calculate() {\n // prevents hitting calculate as first entry\n if (previous) {\n let result;\n current = parseFloat(current);\n previous = parseFloat(previous);\n switch (operant) {\n case 'divide':\n result = previous / current;\n break;\n case 'times':\n result = previous * current;\n break;\n case 'minus':\n result = previous - current;\n break;\n case 'plus':\n result = previous + current;\n default:\n break;\n }\n current = current.toString();\n previous = result.toString();\n viewer.textContent = result;\n rePrint = true;\n if (!equalPressed) {\n equalPressed = true;\n }\n return;\n }\n}", "function calculate() {\n animateCSS(controls, \"fadeOutLeft\", false, function () {\n controls.style.display = \"none\";\n });\n notification.style.display = \"block\";\n animateCSS(notification, \"fadeIn\", false, null);\n\n rulerCanvas.style.display = \"block\";\n rulerMode = true;\n // get rulerCm\n\n // 2D array with info for each function\n results = [];\n\n for (var i = 0; i < points.length; i++) {\n // Push [areaL, areaM, areaR, areaT, length]\n if (points[i] !== null)\n results.push(areaOfRegion(points[i], 0.1));\n }\n}", "function calculate(previous, current, operation) {\n if (previous == \"Can't divide with 0\") {\n clearEverything();\n }\n else {\n if (operation == \"+\") {\n output = previous * 1 + current * 1;\n }\n else if (operation == \"-\") {\n output = previous * 1 - current * 1;\n }\n else if (operation == \"*\") {\n output = (previous * 1) * (current * 1);\n }\n else if (operation == \"/\") {\n if (current == 0) {\n output = \"Can't divide with 0\";\n }\n else {\n output = previous * 1 / current * 1;\n }\n }\n\n // fix js float accuracy problem\n if (Number.isInteger(output) == false) {\n if (typeof output != \"string\") {\n output = output.toFixed(2);\n }\n }\n\n updateScreen(output);\n }\n \n}", "function calc(value) {\n if (\n value !== \"+\" &&\n value !== \"-\" &&\n value !== \"*\" &&\n value !== \"/\" &&\n value !== \"=\" &&\n value !== \"clear\"\n ) {\n numero(value);\n } else if (\n total !== undefined &&\n (value == \"+\" ||\n value == \"-\" ||\n value == \"*\" ||\n value == \"/\") &&\n (value !== \"=\" && value !== \"clear\")\n ) {\n simbolo(value);\n } else if (value == \"=\" && total !== undefined) {\n igual(value);\n }\n //If 'value' doesn't meet any above conditions and it's 'value' is 'clear', then clean the screen;\n if (value == \"clear\") {\n $results.html(\"<p>0</p>\").css({ \"font-size\": \"1.5em\" });\n $processed.html(\"<p></p>\").css({ \"font-size\": \"1.2em\" });\n total = 0;\n }\n }", "function questionCalculations()\r\n\t{\r\n\t\t// here, calculations for all the above variables should occur\r\n\t}", "done() {\n this.calc();\n this.stop();\n\n this.el.fire('drawdone');\n }", "function onCalcComplete()\n\t{\n\t\t////////////////////////////////\n\t\t//Display Results\n\t\t////////////////////////////////\n\t\t\n\t\t//The data on the map screen.\n\t\tsetImpactValues(dataProvider.getDgOutputs());\n\t\t\n\t\t//The inputValues\n\t\tsetInputValues(dataProvider.getDgInputs());\n\t\t\n\t\t//The damage table\n\t\tsetDamage(dataProvider.getTxtDamage());\n\t\t\n\t\t//Set Impact Energy Table\n\t\tsetEnergyValues(dataProvider.getDgEnergy());\n\t\t\n\t\t//Get the what happenes to the impactor text.\n\t\t setImpactorText(dataProvider.getTxtImpactor());\n\t\t \n\t\t// get fireball dats.\n\t\t setFireballSeen(dataProvider.getDgFirevall());\n\t\t\n\t\tdrawScale();\n\t\t\n\t}", "calculate(event) {\n if (this.functionArray.length > 0) {\n const x =\n this.device == \"mobile\"\n ? event.touches[0].clientX\n : event.clientX - this.canvasoffset;\n\n const xScaled = this.mapVals(\n x,\n 0,\n this.canvas.width,\n this.xMin,\n this.xMax\n ).toFixed(2);\n this.updateFunctionCursor(x, xScaled);\n this.updateGraph();\n }\n }", "function calc(){\n\t\n\t//Calling the EventEmitter\n\tEventEmitter.call(this);\n}", "updateCalculatedDataDiv() {\n if (!this.calculatedDataDiv) {\n return;\n }\n removeAllChildren(this.calculatedDataDiv);\n if (this.calculatedData === SENTINEL_CALCULATING) {\n this.calculatedDataDiv.innerHTML = 'calculating';\n this.calculatedDataDiv.style.color = 'grey';\n } else {\n displayCalculatedData(this.calculatedData, this.calculatedDataDiv);\n this.calculatedDataDiv.style.color = 'black';\n }\n }", "compute(){\r\n let computation;\r\n const prev = parseFloat(this.previousOperand);\r\n const current = parseFloat(this.currentOperand);\r\n \r\n // if user clicks equals only\r\n // return cancels the function completely further\r\n if (isNaN(prev) || isNaN(current)) return;\r\n \r\n switch(this.operation){\r\n case'+':\r\n computation = prev + current;\r\n break;\r\n case '-':\r\n computation = prev - current;\r\n break;\r\n case '*':\r\n computation = prev * current;\r\n break;\r\n case '÷':\r\n computation = prev / current; \r\n break;\r\n default:\r\n return;\r\n }\r\n this.readyToReset = true;\r\n this.currentOperand = computation\r\n this.operation = undefined\r\n this.previousOperand = ''\r\n }", "function paint() {\n}", "function calculation(e) {\r\n // Default char variable for keyboard input.\r\n let char = e.key;\r\n\r\n // If event fired from mouse then char value change based on DOM element value;\r\n // and fire the native keyboard events excep memory operation\r\n // Memory operation only available via DOM events.\r\n if (e.type == \"click\") {\r\n switch (e.target.textContent) {\r\n case \"÷\":\r\n char = \"/\";\r\n break;\r\n case \"×\":\r\n char = \"*\";\r\n break;\r\n case \"«\":\r\n char = \"Backspace\";\r\n break;\r\n case \"00\":\r\n char = \"00\";\r\n break;\r\n case \"c\":\r\n input = \"\";\r\n output = \"\";\r\n break;\r\n case \"=\":\r\n char = \"Enter\";\r\n break;\r\n case \"m+\":\r\n handleMemory(\"plus\");\r\n break;\r\n case \"m-\":\r\n handleMemory(\"substract\");\r\n break;\r\n case \"mr\":\r\n handleMemory(\"read\");\r\n break;\r\n case \"mc\":\r\n handleMemory(\"clear\");\r\n break;\r\n default:\r\n char = e.target.textContent;\r\n }\r\n }\r\n\r\n // Checking and validating input output variable, input max lenght 32 chars\r\n if (input.length <= 32) {\r\n if (operands.includes(char)) {\r\n input += char;\r\n output = evalInput(input);\r\n } else if (char in operators) {\r\n input += operators[char];\r\n } else if (char == \"=\" || char == \"Enter\") {\r\n input = handleSubmit(input, output);\r\n output = \"\";\r\n } else if (char == \"Backspace\") {\r\n input = handleDelete(input);\r\n output = evalInput(input);\r\n }\r\n } else {\r\n input = handleDelete(input);\r\n }\r\n\r\n // DOM display update with input output memory variable\r\n let inputDisplay = document.querySelector(\".calc-dis-in\");\r\n let outputDisplay = document.querySelector(\".calc-dis-out\");\r\n let memoryIndicator = document.querySelector(\".calc-dis-mi\");\r\n let memoryDisplay = document.querySelector(\".calc-dis-mo\");\r\n inputDisplay.innerHTML = input;\r\n outputDisplay.innerHTML = output;\r\n if (hasMemory) {\r\n memoryIndicator.innerHTML = \"M\";\r\n memoryDisplay.innerHTML = memory;\r\n } else {\r\n memoryIndicator.innerHTML = \"\";\r\n memoryDisplay.innerHTML = \"\";\r\n }\r\n}", "function calculate() {\n if (validateInputs()) {\n if ($age.val() > 110) {\n $calcResultsBox.removeClass(\"hidden\").html(\"<span style='color:red'>Invalid Age</span>\");\n } else if (($weight.val() > 600 && imperial) || ($weight.val() > 270 && !imperial)) {\n $calcResultsBox.removeClass(\"hidden\").html(\"<span style='color:red'>Invalid Weight</span>\");\n } else if (imperial) { // calculation if imperial units\n if ($heightInputIn.val() > 12) {\n inchesConvert();\n }\n var BMR = Math.round(calculateBMR());\n var TDEE = Math.round(calculateBMR() * 1.2);\n var BMI = calculateBMI();\n $calcResultsBox.removeClass(\"hidden\").html(\n \"To lose \" + $slider.slider(\"value\") + \" lb per week, you would need to eat \" + Math.round((TDEE - 500 * $slider.slider(\"value\"))) + \"* kcal per day (not including exercise).<br/><br/>BMR: \" + BMR + \" kcal<br/>TDEE: \" + TDEE + \" kcal<br/>BMI: \" + BMI + \"</td><br/><br/>* Eating less than 1200 kcal daily is not recommended.\");\n } else {\n // calculation if metric units\n var BMR = Math.round(calculateBMR());\n var TDEE = Math.round(calculateBMR() * 1.2);\n var BMI = calculateBMI();\n $calcResultsBox.removeClass(\"hidden\").html(\n \"To lose \" + $slider.slider(\"value\") + \" kg per week, you would need to eat \" + Math.round((TDEE - 1102 * $slider.slider(\"value\"))) + \"* kcal per day (not including exercise).<br/><br/>BMR: \" + BMR + \" kcal<br/>TDEE: \" + TDEE + \" kcal<br/>BMI: \" + BMI + \"</td><br/><br/>* Eating less than 1200 kcal daily is not recommended.\");\n }\n } else\n $calcResultsBox.removeClass(\"hidden\").html(\"<span style='color:red'>Please fill in all fields.</span>\");\n }", "recalculateAndDraw() {\n\n\t\tif (!this.tgOrigin.getOrigin()) return;\n\n\t\t//console.log('recalculateAndDraw');\n\t\t\n\t this.tgRoads.calDispRoads();\n\t\tthis.tgWater.calDispWater();\n\t\tthis.tgLanduse.calDispLanduse();\n\t\t//this.tgPlaces.calDispPlace();\n\t\t\n\n\t\tif (this.currentMode === 'DC') {\n\t\t\tthis.calAllDispNodeAsOriginal();\n\t\t\t//this.tgRoads.discard();\n\t\t\t//this.tgWater.discard();\n\t\t\t//this.tgLanduse.discard();\n\n\t\t\tthis.tgLocs.discard();\n\t\t\tthis.tgIsochrone.discard();\n\t\t\t//this.tgLocs.setHighLightMode(false, 0);\n\t\t}\n\t\telse {\n\t\t\tthis.tgRoads.render();\n\t\t\tthis.tgWater.render();\n\t\t\tthis.tgLanduse.render();\n\t\t\t//this.tgPlaces.render();\n\n\t\t}\n\n\t\tthis.requestControlPoints();\n\t}", "compute() {\n const prev = parseFloat(this.previousOperand);\n const current = parseFloat(this.currentOperand);\n const operations = {\n '+': prev + current,\n '-': prev - current,\n '*': prev * current,\n '/': prev / current\n }\n \n if (this.isEqualPressedAgain) {\n this.previousResult = this.currentOperand;\n this.currentOperand = this.performSameCalculation();\n }\n\n if (isNaN(prev) || isNaN(current)) return;\n this.currentOperand = this.checkForErrors(current, prev, operations);\n this.previousOperation = this.operation;\n this.operation = undefined;\n this.previousOperand = '';\n }", "update() {\r\n this.paint();\r\n }", "function drawExtraDecalsFn() {\n }", "function drawExtraDecalsFn() {\n }", "function calculate(e){\n if(!x){\n return\n }\n //needs to clear numberArray\n console.log('operand event', e.target.innerText)\n //is the operand available? if so calculate x and y following the math hash map\n operand ? x = math[operand](x, y) : null\n display(x)\n operand = e.target.innerText\n setX ? setX = !setX : null\n numberArray = []\n console.log('x', x, 'y', y)\n\n}", "function calculationLoop() {\n\n function updateTime() {\n updateTimeInToolbar();\n setTimeout(updateTime, 1000);\n }\n setTimeout(updateTime, 1000);\n \t\t\n\t\tfunction calc() {\n\t\t\tcalculate(false);\n\t\t\tsetTimeout(calc, AGSETTINGS.getRefreshTimerInterval());\n\t\t}\n\t\tsetTimeout(calc, AGSETTINGS.getRefreshTimerInterval());\n\t}", "compute() {\r\n let computation\r\n //parseFloat converts a string argument and converts it to a float\r\n const prev = parseFloat(this.previousOperand)\r\n const current = parseFloat(this.currentOperand)\r\n //NaN means Not a Number\r\n if (isNaN(prev) || isNaN(current)) return\r\n //here, you are matching up the values and operations buttons\r\n switch (this.operation) {\r\n case '+':\r\n computation = prev + current\r\n break\r\n case '-':\r\n computation = prev - current\r\n break\r\n case 'x':\r\n computation = prev * current\r\n break\r\n case '/':\r\n computation = prev / current\r\n break\r\n \r\n default:\r\n return\r\n }\r\n //actual computation taking place\r\n this.currentOperand = computation\r\n this.operation = undefined\r\n this.previousOperand = ''\r\n }", "function drawResult(){\n $(\".calcDisplay\").text(expression);\n}", "compute()\n {\n //we update our input values\n super.compute();\n\n if(this.needsRecompute)\n {\n //actual node work\n this.ios['oColor'].value = lerpColor(this.ios['iColor1'].value,this.ios['iColor2'].value,this.ios['iMix'].value);\n this.needsRecompute = false;\n }\n }", "function update() {\r\n paintCanvas();\r\n platformCalc();\r\n\r\n springCalc();\r\n\r\n playerCalc();\r\n player.draw();\r\n\r\n base.draw();\r\n\r\n updateScore();\r\n }", "function noncommercial(){\n calculate(1.25, 1.5)\n \t\n }", "function doComputation(){\n let computation;\n const prev = parseFloat(previousOperand);\n const current = parseFloat(currentOperand);\n\n if(isNaN(prev) || isNaN(current)) return;\n switch(operation){\n case '+':\n computation=prev + current;\n break;\n case '-':\n computation=prev - current;\n break;\n case 'x':\n computation=prev * current;\n break;\n case '/':\n computation= prev / current;\n break;\n default :\n return;\n }\n\n currentOperand=computation;\n operation=undefined;\n previousOperand=''; \n}", "function calculate_coordinates () {\n\t }", "function calculate(screen)\n{\n\tvar currentValue = parseFloat(screen.text);\n\tvar answer = 0;\n\t\n\tif (operation == \"+\") \n\t\tanswer = lastValue + currentValue;\n\telse if (operation == \"-\") \n\t\tanswer = lastValue - currentValue;\n\telse if (operation == \"/\") \n\t\tanswer = lastValue / currentValue;\n\telse if (operation == \"*\") \n\t\tanswer = lastValue * currentValue;\n\t\t\n\tscreen.text = answer.toString();\n}", "calc()\n\t{\n\t\tlet filas = this.controlFilas; // Obtenemos el control\n\t\tlet columnas = this.controlColumnas; // Obtenemos el control\n\t\tlet sumaClase = 0.0; // Suma para la frecuencia\n\t\tlet resClase = 0.0; // Resultado del porcentaje\n\t\tlet totalClase = 0.0;\n\t\tlet totalFrecuencia = 0.0;\n\n\t\t// Recorremos la tabla\n\t\tfor(let i = 0; i < filas; i++){\n\t\t\tfor(let j = 0; j < columnas; j++){\n\t\t\t\t// Verificamos si hay un dato\n\t\t\t\tif(document.getElementById((i+1)+''+(j+1)).value.length > 0){\n\t\t\t\t\t// Verificamos que solo se sumen columnas 1 y 2\n\t\t\t\t\tif(j == 0 || j == 1){\n\t\t\t\t\t\tsumaClase += parseFloat(document.getElementById((i+1)+''+(j+1)).value);\n\t\t\t\t\t} else if(j == 2){\n\t\t\t\t\t\ttotalFrecuencia += parseFloat(document.getElementById((i+1)+''+(j+1)).value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tresClase = sumaClase / 2;\n\t\t\tdocument.getElementById((i+1)+'f').innerHTML = resClase; // Intectamos\n\t\t\ttotalClase += resClase;\n\t\t\tsumaClase = 0; // Reseteamos la suma\n\t\t\tresClase = 0;\n\t\t}\n\n\t\t// Inyectamos los totales\n\t\tdocument.getElementById('suma1').innerHTML = totalClase;\n\t\tdocument.getElementById('suma2').innerHTML = totalFrecuencia;\n\t}", "compute(){\n let computation\n //converting strings to number for computation\n const prev = parseFloat(this.previousOperand)\n const current = parseFloat(this.currentOperand)\n //to check if numbers were actually inputed before any computation\n if (isNaN(prev) || isNaN(current)) return\n switch (this.operation) {\n case '+' :\n computation = prev + current\n break\n case '-' :\n computation = prev - current\n break\n case '×' :\n computation = prev * current\n break\n case '÷' :\n computation = prev / current\n break\n default:\n return\n }\n this.toReset = true,\n this.currentOperand = computation\n this.operation = undefined\n this.previousOperand = ''\n }", "function CalculateResults()\r\n {\r\n var inputsAllValid;\r\n\r\n // Fetch all input values from the on-screen form.\r\n\r\n inputsAllValid = FetchInputValues();\r\n\r\n // If the fetched input values are all valid...\r\n\r\n if (inputsAllValid)\r\n {\r\n // Do the natural gas pressure loss calculation.\r\n\r\n DoCalculation();\r\n\r\n // Display the results of the calculation.\r\n\r\n DisplayResults();\r\n }\r\n }", "function calculateResult() {\n return function () {\n changeDivideMultiply();\n screenResult.innerHTML = eval(screenResult.innerHTML);\n };\n }", "function renderCall() {\n // Repaint?\n if (needs_repaint === true) {\n needs_repaint = false;\n\n ctx.clearRect(0, 0, canvas_el.width, canvas_el.height);\n\n renderTimeXAxis();\n renderElementsMargin();\n\n renderRows();\n\n renderCurrentTimePoint();\n\n }\n }", "function calculateAll() {\n\t\tcalculatePrice();\n\t\tcompileSpecs();\n\t\tcalculateUSD();\n\t}", "function calculate() {\n secondNumber = resultDisplay.innerText;\n let result = calculateResult(firstNumber, secondNumber, operatorSymbol);\n changeDisplay(result);\n // This allows the user to keep calculating after a result\n firstNumber = result;\n}", "function performCalculation() {\r\n if (calculator.firstNumber == null || calculator.operator == null) {\r\n alert(\"Anda belum menetapkan operator\");\r\n return;\r\n }\r\n\r\n let result = 0;\r\n if (calculator.operator === \"+\") {\r\n result = parseInt(calculator.firstNumber) + parseInt(calculator.displayNumber)\r\n }\r\n\r\n if (calculator.operator === \"-\") {\r\n result = parseInt(calculator.firstNumber) - parseInt(calculator.displayNumber)\r\n }\r\n calculator.displayNumber = result;\r\n}", "function Calculate() {\r\n if(lastOperation === '/') {\r\n result = parseFloat(result) / parseFloat(current);\r\n }else if(lastOperation === 'x') {\r\n result = parseFloat(result) * parseFloat(current);\r\n }else if (lastOperation === '-') {\r\n result = parseFloat(result) - parseFloat(current);\r\n }else if (lastOperation === '+') {\r\n result = parseFloat(result) + parseFloat(current);\r\n }else if (lastOperation === '%') {\r\n result = parseFloat(result) % parseFloat(current);\r\n }\r\n}", "function calculateTotalWorth() {\n if(totalWealthIsAlreadyDisplayed) {\n updateDOM();\n } else {\n displayTotalWorth();\n }\n}", "function RunCalculation() {\n\t\n\ttry {\n\t\tvar results = calculator.calculateTax({\n\t\t\t'number_of_exemptions': $('#number_of_exemptions_value').val(),\n\t\t\t'amount_of_income_taxable_by_the_city': $('#amount_of_income_taxable_by_the_city_value').val(),\n\t\t\t'taxable_value_of_your_home': $('#taxable_value_of_your_home_value').val()\n\t\t});\n\n\t\t// Transfer results to output fields.\n\t\tfor (var prop in results) {\n\t\t\tsetOutput(prop + '_output', results[prop]);\n\t\t}\n\t\t// Clear errors.\n\t\tshowError(false);\n\t} catch (e) {\n\t\t// Show errors that were thrown.\n\t\tshowError(e);\n\t}\n}", "function calculateCurrent() {\n if (!currentCalculator) { return; }\n\n const result = Calculations.calculate(currentCalculator);\n renderOutput(result);\n }", "function calcAll() {\n // Iteration 1.2\n\n}", "function updateGraphics() {\n ui.cellColorAlive = $(\"input[name=colorAliveCellHexagon]\").val();\n ui.cellColorDead = $(\"input[name=colorDeadCellHexagon]\").val();\n ui.cellColorStroke = $(\"input[name=colorOutlineHexagon\").val(); \n ui.draw();\n }", "calcRepaintItems() {\n if (G.windowResized) {\n for (const id in G.repaintList) {\n const item = G.repaintList[id];\n // don't recalculate the invisible item\n if (!item.sprite.visible) {\n continue;\n }\n item();\n }\n G.windowResized = false;\n }\n }", "function calculate()\n {\n if (operator == 1)\n {\n current_input = eval(memory) * eval(current_input);\n };\n if (operator == 2)\n {\n current_input = eval(memory) / eval(current_input);\n // If divide by 0 give an ERROR message\n var initial_value = current_input.toString();\n if (initial_value == \"Infinity\")\n {\n current_input = \"ERROR\"\n };\n };\n if (operator == 3)\n {\n current_input = eval(memory) + eval(current_input);\n };\n if (operator == 4)\n {\n current_input = eval(memory) - eval(current_input);\n };\n if (operator == 5)\n {\n current_input = Math.pow(eval(memory), eval(current_input));\n };\n operator = 0; //clear operator\n memory = \"0\"; //clear memory\n displayCurrentInput();\n }", "function paint() {\n\t//clear()\n\tnoFill()\n\tsystem.show();\n}", "function showCalc() {\n console_log(\"SHOW_CALC\")\n if ($('#calc_hold').html() || !enable_calc) {} else {\n var calc_x = screen_width - 325\n var calc_y = $get_Element(\"#tools\").offsetTop + $get_Element(\"#tools\").offsetHeight;\n var ch = '<div id=\"calc_hold\" style=\"width:325px;position:absolute;left:' + calc_x + 'px;top:' + calc_y + 'px\"></div>'\n var calc_hold = $('#main-content').append($(ch))\n console_log(\"SHOW_HIDE_CALC-s2\")\n $('#calc_hold').calculator({\n layout: $.calculator.scientificLayout\n });\n $get_Element(\"#button_calc\").style.border = '2px solid #ff0000';\n }\n }", "function calcResults() {\n\t\trbAge.innerText = parseInt(currentAge)+parseInt(yearsToRetirement);\n\t\trbIncome.innerText = rawNestAmount*targetRetirementIncomePercentage;\n\t\trbInterest.innerText = (rawNestAmount-(rawNestAmount*targetRetirementIncomePercentage))*targetInterestRateToNest;\n\t\trbBalance.innerText = (rawNestAmount-(rawNestAmount*targetRetirementIncomePercentage))+(rawNestAmount-(rawNestAmount*targetRetirementIncomePercentage))*targetInterestRateToNest;\n\t}", "function evaluate() {\n if (firstNum !== null && secondNum !== null) {\n switch (equation) {\n case \"add\":\n firstNum += secondNum;\n\n break;\n case \"subtract\":\n firstNum -= secondNum;\n\n break;\n case \"divide\":\n firstNum /= secondNum;\n\n break;\n case \"multiply\":\n firstNum *= secondNum;\n\n if (displayNum > 10000000) {\n setDisplayNum(\"8======D\");\n }\n break;\n default:\n break;\n }\n setDisplayNum(firstNum);\n }\n }", "function run() {\n \n //Set the rate of redrawing.\n window.setTimeout(run,20);\n\n //See drawScreen.js\n drawScreen(context, theCanvas.width, theCanvas.height, eigen, t, a, radiusM1, radiusM2);\n \n //Set the incremented time for each successive redraw.\n t=t+0.03;\n }", "calculate() {\n\treturn this.exercise.calculate(this.weight, this.distance, this.time);\n }", "function calculateResults() {\n return;\n}", "update(nbPoints, multp){\n //On efface tout sur le canva et on récupère lesinfos passé en parametre\n this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);\n\n //Si le nombre de point change il faut tout redessiner Et recaulculer le tableau de point\n if (this.nbPoints != nbPoints) {\n this.calcPoints(nbPoints);\n this.mult = multp;\n this.nbPoints = nbPoints;\n this.drawCircle();\n } else {\n this.mult = multp;\n this.nbPoints = nbPoints;\n this.drawCircle();\n }\n\n\n\n //Finalement on met les nouvelles valeur dans les input dans l'HTML\n circleNbPointsInput.value = this.nbPoints;\n circleMultInput.value = this.mult;\n\n }", "function equate() {\n\n switch (activeOperator) {\n case \"add\":\n calculation += input;\n break;\n case \"subtract\":\n calculation -= input;\n break;\n case \"multiply\":\n calculation = calculation*input;\n break;\n case \"divide\":\n calculation = calculation/input;\n break;\n default:\n calculation = input;\n }\n\n //$(\"#add\").removeClass(\"active-operator\");\n //$(\"#subtract\").removeClass(\"active-operator\");\n //$(\"#multiply\").removeClass(\"active-operator\");\n //$(\"#divide\").removeClass(\"active-operator\");\n\n setScreen(\"calculation\");\n\n}", "display()\r\n {\r\n //noStroke();\r\n noFill();\r\n ellipse(this.x, this.y, this.radius);\r\n\r\n }", "function calculate(){\n console.table(calculator);\n if (calculator.operator === '%'){\n percent(calculator.numA, calculator.numB);\n display.textContent = calculator.result;\n }\n else if (calculator.operator === '÷'){\n divide(calculator.numA, calculator.numB);\n display.textContent = calculator.result;\n }\n else if (calculator.operator === '×'){\n multiply(calculator.numA, calculator.numB);\n display.textContent = calculator.result;\n }\n else if (calculator.operator === '-'){\n substract(calculator.numA, calculator.numB);\n display.textContent = calculator.result;\n }\n else {\n add(calculator.numA, calculator.numB);\n display.textContent = calculator.result;\n }\n calculator.calculated = true;\n console.table(calculator);\n}", "calc() {\n if (this.operation.length < 2) return;\n let result;\n\n //calculation if the operation is less than 2 operators\n if (this.operation.length == 2) {\n //calculation if the last operator is raised to power\n if (this.getLastPosition() == 'x²') {\n this.raisedPower(this.getLastPosition(false));\n return;\n }\n //calculation if the last operator is square root\n if (this.getLastPosition() == '√') {\n this.squareRoot(this.getLastPosition(false));\n return;\n }\n\n let firstNumber = this.operation[0];\n if (!this.lastOperator) this.lastOperator = this.getLastPosition();\n if (!this.lastNumber) this.pushOperator(firstNumber);\n if (this.lastNumber) this.pushOperator(this.lastNumber);;\n }\n\n //calculation if the operation is 3 or more operators\n if (this.operation.length > 3) {\n this.lastOperator = this.destroyLastOperator();\n } else if (this.operation.length == 3) {\n this.lastNumber = this.getLastPosition(false);\n this.lastOperator = this.getLastPosition();\n }\n\n //execute the of operation\n result = this.getResult();\n //validates of the last operator\n if (this.lastOperator == '%') {\n result /= 100;\n this.operation = [result];\n } else if (this.lastOperator == 'x²') {\n result *= result;\n this.operation = [result];\n } else {\n this._operation = [result, this.lastOperator];\n }\n\n this.updateDisplay(); \n }", "function calculateInput() {\n $(\".button\").on(\"click\", function () {\n // user types in a number\n if (this.id.match(/\\d/)) {\n currentEntry += this.id.match(/\\d/)[0];\n previousEntry = currentEntry;\n if (potentialMinusOperation) potentialMinusOperation = false; // since no minus operation has been done.\n renderAll();\n }\n else {\n // clear entire input\n if ((calculate.length !== 0 || currentEntry !== 0) && this.id === \"button_ac\") {\n calculate = \"\";\n currentEntry = \"\";\n previousEntry = \"\";\n renderAll();\n }\n // first element is a dot, so put a \"0\" in front of it\n else if (currentEntry.length === 0 && this.id === \"button_dot\") {\n currentEntry = \"0.\";\n previousEntry = \"0.\";\n if (potentialMinusOperation) potentialMinusOperation = false;\n renderAll();\n }\n // determine which button was pressed in order to perform the correct calculation\n else if (currentEntry.length !== 0) {\n if (this.className === \"button button-operator\") {\n calculate += currentEntry + this.dataset.value;\n currentEntry = \"\";\n renderSecondary(calculate);\n if (this.id === \"button_mult\" || this.id === \"button_div\") potentialMinusOperation = true;\n }\n else switch (this.id) {\n case \"button_ce\": // only clear current entry, not entire calculation\n previousEntry = \"\";\n currentEntry = \"\";\n renderAll();\n break;\n case \"button_dot\":\n if (currentEntry.match(/\\./) === null) {\n currentEntry += \".\";\n previousEntry += \".\";\n }\n renderAll();\n break;\n case \"button_enter\":\n case \"button_hide_enter\":\n calculate += currentEntry;\n result = stringToCalculation(calculate);\n previousEntry = result;\n renderResult(result);\n calculationFinished = true;\n calculate = \"\";\n currentEntry = \"\";\n break;\n }\n }\n // of the potential minus flag is set to true, allow \"-\" to be pressed\n if (potentialMinusOperation && this.id === \"button_minus\") {\n calculate += \" - \";\n renderSecondary(calculate + currentEntry);\n potentialMinusOperation = false;\n }\n // post-calculation options\n if (calculationFinished) {\n if (this.id === \"button_ce\") {\n // when calculation is finished, CE has same functionality as AC\n calculate = \"\";\n currentEntry = \"\";\n previousEntry = \"\";\n renderAll();\n calculationFinished = false;\n }\n if (this.className === \"button button-operator\") {\n // use result for next calculation\n calculate = previousEntry + this.dataset.value;\n renderSecondary(calculate + currentEntry);\n calculationFinished = false;\n // allowing for negative operations\n if (this.id === \"button_mult\" || this.id === \"button_div\") {\n potentialMinusOperation = true;\n }\n }\n }\n }\n });\n}", "calculateUpdates() {\n\t\tthis.stage.step();\n\t}", "function update_calculations() {\n\n\t// Loop through each HTML element that displays a metric (everything of the 'answer' class)\n\t$('.answer').each(function(){\n\n\t\t// Identify which of the HTML metrics .each is currently on\n\t\tvar current_metric = $(this).attr('id');\n\n\t\t// Final output for current HTML metric\n\t\tvar new_metric_value = 0;\n\t\t\n\t\t// Iterate through selected_states to calculate value for new_metric_value\n\t\tjQuery.each(selected_states, function(index,one_state_in_array){\n\n\t\t\t// eval automatically handles case when user has no states selected\n\t\t\tvar value_for_one_state_user_selected = eval('state_stats.' + one_state_in_array + '.' + current_metric);\n\t\t\t\n\t\t\tnew_metric_value+=parseInt(value_for_one_state_user_selected);\n\n\t\t});\n\n\t\t// Update HTML metric with value\n\t\t$(this).html(numberWithCommas(new_metric_value));\n\t\t\n\t});\n\n}", "function calculateTotal() {\r\n\t\tvar Amount =getPrice() *getPages();\r\n\t\t//display cost.\r\n\t\tvar obj =document.getElementById('totalPrice');\r\n\t\tobj.style.display='block';\r\n\t\tobj.innerHTML =\" Cost of the paper: \\t $\"+ Amount;\r\n\t}", "function viewPositionMetrics(){\n\t\t\t\t$(\"canvas\").mousedown(function(event){\n\t\t\t\t\tvar canvasOffsetX = $(this).position().left;\n\t\t\t\t\tvar canvasOffsetY = $(this).position().top;\n\n\t\t\t\t\tvar clickedX = Math.floor(event.pageX - canvasOffsetX);\n\t\t\t\t\tvar clickedY = Math.floor(event.pageY - canvasOffsetY);\n\t\t\t\t\tconsole.log(clickedX, clickedY);\n\t\t\t\t\tswitch (event.which){\n\t\t\t\t\t\tcase 1: \n\t\t\t\t\t\t\t//co-ords from click listener are able to progress the game\n\t\t\t\t\t\t\tif(!isGameOver){\n\t\t\t\t\t\t\t\tstartRound(clickedX, clickedY); \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\n\n\t\t\t\t\t\tcase 3: \n\t\t\t\t\t\t\tif(!isGameOver){\n\t\t\t\t\t\t\t\tplaceFlag(clickedX, clickedY);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\talert(\"error, something seems to be wrong..\");\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}", "_recalc_model() {\n\t this._update_timescales();\n\t this._calc_equilibrium();\n\t}", "draw() {\n\t\tthis.newPosition()\n\t\tthis.hoverCalc()\n\n\n\t\t// this.drawWaves()\n\n\t\tthis.applyCircleStyle()\n\n\n\t\tthis.ly.circle( this.x, this.y, 2 * this.r * this.scale )\n\n\t\tthis.applyTextStyle()\n\t\tthis.ly.text( this.label, this.x, this.y )\n\n\n\n\t}", "function standardCalculations() {\n // 1. has been populated for the first time, mark default checkboxes\n const perPhone = $( '#perPhone' ).prop('checked');\n const perPhoneLongDistance = $( '#perPhoneLongDistance' ).prop('checked');\n if (isCheckboxOff('#perPhone') && isCheckboxOff('#allPhones')) {\n $( '#perPhone' ).prop('checked', true);\n }\n if (isCheckboxOff('#perPhoneLongDistance') && isCheckboxOff('#allPhonesLongDistance')) {\n $( '#perPhoneLongDistance' ).prop('checked', true);\n }\n\n const plansCount = parseInt($( '#plansCount' ).val().replace(/,/g, ''));\n const monthlyPayment = valueOf('#monthlyPayment');\n const longDistance = valueOf('#longDistance');\n\n let monthlyExpense = 0;\n monthlyExpense += perPhone ? plansCount * monthlyPayment : monthlyPayment\n monthlyExpense += perPhoneLongDistance ? plansCount * longDistance : longDistance\n\n $( '#monthlyExpense' ).text(`$ ${addCommas(monthlyExpense)}`);\n $( '#yearlyExpense' ).text(`$ ${addCommas(12 * monthlyExpense)}`);\n\n const nineYearExpense = 9 * 12 * monthlyExpense;\n $( '#nineYearExpense' ).text(`$ ${addCommas(nineYearExpense)}`);\n\n let newNineYearExpense\n if ($('#viewDetailsButtonBottom').css('display') === 'none') {\n newNineYearExpense = plansCount * 500;\n $( '#newNineYearExpense' ).text(`$ ${addCommas(newNineYearExpense)}`);\n\n \n } else {\n newNineYearExpense = $('#newNineYearExpense').text().replace(/(\\s|\\$|,)/g, '');\n newNineYearExpense = parseFloat(newNineYearExpense);\n\n }\n\n const nineYearSaving = nineYearExpense - newNineYearExpense;\n $( '#nineYearSaving' ).text(`$ ${addCommas(nineYearSaving)}`);\n\n $( '#yearlySaving' ).text(`$ ${addCommas(nineYearSaving / 9)}`);\n}", "calculate(modify) {\n return this.total = [].slice.call(arguments, 1)\n .reduce((total, y) => modify(total, y), this.total);\n }", "function calculate() {\n try {\n // resets previous input without\n // breaking the whole code\n reset();\n } catch (err) {\n console.log(err);\n }\n\n const today = getToday();\n const birthday = getBirthday();\n\n const seconds = (today.getTime() - birthday.getTime()) / 1000;\n\n const minutes = seconds / 60;\n\n const hours = seconds / 3600;\n\n const days = seconds / 86400;\n\n setLines(days, hours, minutes, seconds);\n\n changeButton();\n}", "function removeSlopeCalc() {\n if (b == 0) { html = 'y=<span id=\"slope\">' + m.toFixed(2) + '</span>x'; }\n else { // change m and y values in equation header\n html = 'y=<span id=\"slope\">' + m.toFixed(2) + '</span>x+<span id=\"yint\">' +\n b.toFixed(2) + '</span>';\n }\n eq.innerHTML = html;\n document.getElementById('slope').style.backgroundColor=\"transparent\";\n riseRunDisplay = false;\n removePtLabel(pt1, \"pt1\")\n removePtLabel(pt2, \"pt2\")\n removeRiseRunLabels();\n reapplyListeners();\n}", "function operate(){\n\t\n\t// Triggers when second operator is '='\n\t// Call giveResult function which actually calculates formula\n\t// Write result into display\n\t// Set first number/operand as result for further calculations\n\t// Clear the rest of calculation object\n\tif (calculation['operator2'] == '='){\n\t\tlet result = giveResult();\n\t\tdisplay.textContent = result;\n\t\t\n\t\tcalculation['operand'] = parseFloat(result);\n\t\tcalculation['operand2'] = '';\n\t\tcalculation['operator'] = '';\n\t\tcalculation['operator2'] = '';\n\n\t// Same as above, but when second operator is other than '=' give result\n\t// and set first operator as second operator\n\t// Clear the rest\n\t}else{\n\t\tlet result = giveResult()\n\t\tdisplay.textContent = result;\n\t\t\n\t\tcalculation['operand'] = result\n\t\tcalculation['operand2'] = ''\n\t\tcalculation['operator'] = calculation['operator2'];\n\t\tcalculation['operator2'] = '';\n\t}\n}", "function updateCostAndPrice() {\n $(\"#totalCostCalculated\").text(Math.round(totalCostCalculated * Math.pow(10, 2)) / Math.pow(10, 2));\n $(\"#sellingPriceAtSpan\").text($(\"#profitMarginInput\").val());\n $(\"#sellingPrice\").text((Math.round(sellingPrice * Math.pow(10, 2)) / Math.pow(10, 2)));\n alert('recalculated via updateCostAndPrice method');\n }", "function evaluate(event) {\n if (prevOperand.length == 0 || isLastInputOperation) return;\n\n const currOperand = display.innerHTML;\n const result = operate(operation,\n Number(prevOperand),\n Number(currOperand));\n\n // div by zero\n let displayText = result;\n if (result === null) {\n displayText = '';\n }\n\n // overflow\n if (result > MAX_VALUE) {\n console.log(result);\n displayText = OVERFLOW;\n }\n\n isFloat = isInt(result)? false : true;\n display.innerHTML = `${displayText}`;\n resetOperation();\n prevOperand = '';\n isResult = true;\n}", "function DoCalculation()\r\n {\r\n // Calculate intermediate values.\r\n\r\n upstreamPressureBarAbsolute = 1.01325 + (upstreamPressure / 1000);\r\n\r\n // Calculate the Reynolds number.\r\n\r\n reynoldsNumber = 25043 * baseGasFlowRate / internalPipeDiameter;\r\n\r\n // Calculate the base 10 logarithm of the Reynolds number. Modern browsers\r\n // provide the 'Math.log10' function , but Internet Explorer 11 does not.\r\n // However, all browsers provide the base 'e' (natural) logarithm as the\r\n // 'Math.log' function. As log10(n) = log(n) * log10(e), and log10(e) is\r\n // a constant, we can easily calculate the base 10 logarithm required.\r\n\r\n log10ReynoldsNumber = Math.log(reynoldsNumber) * Math.LOG10E;\r\n\r\n // Calculate 'x', which will be used in calculating the friction factor.\r\n\r\n x = log10ReynoldsNumber - 5;\r\n\r\n // Calculate 'x', squared which will be used in calculating the friction\r\n // factor.\r\n\r\n xSquared = x * x;\r\n\r\n // Calculate the smooth pipe friction factor.\r\n\r\n frictionFactorSmoothPipe = Math.pow(14.7519 + (3.5657 * x) +\r\n (0.0362 * xSquared), -2);\r\n\r\n // Calculate the friction factor.\r\n\r\n frictionFactor = frictionFactorSmoothPipe / (pipeEfficiencyFactor *\r\n pipeEfficiencyFactor);\r\n\r\n // Calculate some more intermediate values.\r\n\r\n temporary1 = (averageCompressibilityFactor *\r\n averageTemperatureOfFlowingGas *\r\n standardPressure * standardPressure) /\r\n (c * c * standardTemperature * standardTemperature);\r\n\r\n temporary2 = baseGasFlowRate * baseGasFlowRate * temporary1 *\r\n specificGravity * pipeLength * frictionFactor /\r\n Math.pow(internalPipeDiameter, 5);\r\n\r\n // Calculate the downstream pressure.\r\n\r\n downstreamPressureBarAbsolute = Math.sqrt((upstreamPressureBarAbsolute *\r\n upstreamPressureBarAbsolute) - temporary2);\r\n\r\n // Calculate the pressure loss.\r\n\r\n pressureLossBarAbsolute = upstreamPressureBarAbsolute -\r\n downstreamPressureBarAbsolute;\r\n\r\n // Now calculate the output values to be displayed.\r\n\r\n // Convert the pressure loss to millibars.\r\n\r\n pressureLossMillibars = pressureLossBarAbsolute * 1000;\r\n\r\n // Correct the pressure loss for changes in altitude.\r\n\r\n correctedPressureLossMillibars = pressureLossMillibars - (0.048 *\r\n changeInAltitude);\r\n\r\n // We probably do not need to calculate the velocity for <= 75 millibars\r\n // and > 75 millibars as only one of these will be relevant.\r\n\r\n // Calculate the velocity (<= 75 millibars).\r\n\r\n velocityLE75mb = 353 * baseGasFlowRate / (internalPipeDiameter *\r\n internalPipeDiameter);\r\n\r\n // Calculate the velocity (> 75 millibars). This part of the calculation is\r\n // laid out in a nested fashion to make it clear what is going on with all\r\n // the parentheses.\r\n\r\n velocityGT75mb = (353 * baseGasFlowRate * standardPressure) /\r\n (\r\n internalPipeDiameter * internalPipeDiameter *\r\n Math.pow\r\n (\r\n (\r\n upstreamPressureBarAbsolute *\r\n upstreamPressureBarAbsolute\r\n ) -\r\n (\r\n 3730 * baseGasFlowRate * baseGasFlowRate * pipeLength *\r\n frictionFactor /\r\n Math.pow\r\n (\r\n internalPipeDiameter,\r\n 5\r\n )\r\n ),\r\n 0.5\r\n )\r\n )\r\n\r\n if (upstreamPressureBarAbsolute > 1.08825)\r\n {\r\n correctedVelocity = velocityGT75mb;\r\n }\r\n else\r\n {\r\n correctedVelocity = velocityLE75mb;\r\n }\r\n }", "function recalc() {\r\n //boxize calc = physical screen size to yield a 3\" grid on full screen, times zoom factor, then modified by \"resolution?\"\r\n boxsizeX = Math.floor((screenWidth * 0.3 * (zoomlevel / 100)) / numG) //.15 is 3\" divided by the 20\" of my monitor width (physically) to be modified for responsiveness later\r\n boxsizeY = Math.floor((screenHeight * 0.5 * (zoomlevel / 100)) / numG) //.27 is 3\" divided by the 11\" of my monitor height (physically) to be modified for responsiveness later\r\n\r\n g_width = numG * boxsizeX\r\n g_height = numG * boxsizeY\r\n\r\n //calculate starting point\r\n if (!isDown) {\r\n start_x = cnv.width / 2 - g_width / 2\r\n start_y = cnv.height / 2 - g_height / 2\r\n }\r\n\r\n drawGrid()\r\n}", "function calculate() {\n //this if will make sure you dont try to compute with empty currentText or previousText\n if (currentText.innerHTML == '' || previousText.innerHTML == '') return;\n\n //slice is added so that it does not take the mathematical symbol\n let num1 = parseFloat(previousText.innerHTML.slice(0, -1));\n let num2 = parseFloat(currentText.innerHTML);\n\n //computing for all math\n switch (previousText.innerHTML.slice(-1)) {\n case '*':\n previousText.innerHTML = previousText.innerHTML + currentText.innerHTML;\n currentText.innerHTML = (num1 * num2).toString();\n break;\n\n case '+':\n previousText.innerHTML = previousText.innerHTML + currentText.innerHTML;\n currentText.innerHTML = (num1 + num2).toString();\n break;\n\n case '-':\n previousText.innerHTML = previousText.innerHTML + currentText.innerHTML;\n currentText.innerHTML = (num1 - num2).toString();\n break;\n\n case '÷':\n previousText.innerHTML = previousText.innerHTML + currentText.innerHTML;\n currentText.innerHTML = (num1 / num2).toString();\n break;\n\n default:\n return;\n }\n\n}", "function compute() {\n if ((document.getElementById(\"current\").innerText != \"\") && (document.getElementById(\"previous\").innerText != \"\")) {\n calculate(previousValue, currentValue, operationSymbol);\n }\n}", "calculateCal(){\n let BMR;\n BMR = (66 + (6.3*this.props.user.weight) + (12.9*this.props.user.height) - (6.8 * this.props.user.age))\n return BMR * 1.55;\n }", "showTotals() {\n //const infectious2 = this.chart.chart.data.datasets[0].data\n const infectious1 = this.chart.chart.data.datasets[1].data\n const infectious1Val = infectious1[infectious1.length-1]\n\n const susceptible = this.chart.chart.data.datasets[2].data\n const susceptibleVal = susceptible[susceptible.length-1]\n const nSusceptible = susceptibleVal-infectious1Val\n\n const vaccinated = this.chart.chart.data.datasets[3].data\n const vaccinatedVal = vaccinated[vaccinated.length-1]\n const nVaccinated = vaccinatedVal-susceptibleVal\n\n const removed = this.chart.chart.data.datasets[4].data\n const removedVal = removed[removed.length-1]\n const nRemoved = removedVal-vaccinatedVal\n\n const dead = this.chart.chart.data.datasets[5].data\n const deadVal = dead[dead.length-1]\n const nDead = deadVal-removedVal\n\n let hospitalDeaths = 0\n this.sender.q1.pts.forEach(pt => hospitalDeaths += pt.status==Point.DEAD ? 1 : 0)\n\n const yDiff = TEXT_SIZE_TOTALS+15\n\n strokeWeight(0)\n stroke(0)\n fill(\"#000000dd\")\n rect(RECT_X_TOTALS, RECT_Y_TOTALS, RECT_W_TOTALS, RECT_H_TOTALS, RECT_RADIUS_TOTALS)\n textSize(TEXT_SIZE_TOTALS)\n textAlign(LEFT, TOP)\n fill(COLOR_LIGHT_GRAY)\n text(`Simulation Complete!`, TEXT_X_TOTALS+80, TEXT_Y_TOTALS)\n text(`Total Unaffected: ${nSusceptible+nVaccinated}`, TEXT_X_TOTALS, TEXT_Y_TOTALS+yDiff)\n text(`Total Infected: ${dead[dead.length-1]-nSusceptible-nVaccinated}`, TEXT_X_TOTALS, TEXT_Y_TOTALS+yDiff*2)\n text(`Total Recovered: ${nRemoved}`, TEXT_X_TOTALS, TEXT_Y_TOTALS+yDiff*3)\n text(`Total Dead: ${nDead}`, TEXT_X_TOTALS, TEXT_Y_TOTALS+yDiff*4)\n text(`Deaths due hospital overcrowding: ${hospitalDeaths}`, TEXT_X_TOTALS, TEXT_Y_TOTALS+yDiff*5)\n this.drawResetArrow()\n }", "function compute(){\n while(calcScreen!= \"\"){\n transfer();\n }\n if(stack.length == 1){ \n calcScreen+= stack.shift(); \n display();\n return;\n }\n let saver = stack.slice(0,3);\n stack.splice(0,3); \n while(stack.length> 0){\n if( !checkOp(stack[0])){ \n saver.push(evaluate(saver.shift(),saver.shift(),saver.shift())); \n saver = saver.concat(stack.slice(0,2));\n stack.splice(0,2);\n }\n else{\n saver.push(evaluate(saver.pop(),stack.shift(),stack.shift())); \n }\n\n }\n saver.push(evaluate(saver.shift(),saver.shift(),saver.shift())); \n calcScreen+= saver.pop();\n display();\n}", "function calculate(){\n var potential_energy= Math.round((1/2)*tracker*k.textContent*k.textContent);\n potential.textContent = potential_energy;\n\n}", "function calculateResults() {\n //UI vars\n const height = document.querySelector('#height').value;\n const weight = document.querySelector('#weight').value;\n const age = document.querySelector('#age').value;\n const sex = document.querySelector('#sex').value;\n const activity = document.querySelector('#activity').value;\n\n //Output vars\n const dailyCalorieRequirements = document.querySelector('#dailyCalorie');\n const daliyProteinIntake = document.querySelector('#dailyProtein');\n const dailyCarbsIntake = document.querySelector('#dailyCarbs');\n const dailyFatIntake = document.querySelector('#dailyFat');\n\n //calculating basal metabolic rate\n const bmr = ((10 * weight) + (6.25 * height) - (5 * age)) + parseFloat(sex);\n \n if (isFinite(bmr)) {\n let dailyCalorie = bmr * parseFloat(activity);\n dailyCalorieRequirements.value = Math.round(dailyCalorie);\n daliyProteinIntake.value = getAmountOfMacronutrient(dailyCalorieRequirements.value, 25, 'p');\n dailyCarbsIntake.value = getAmountOfMacronutrient(dailyCalorieRequirements.value, 35, 'c');\n dailyFatIntake.value = getAmountOfMacronutrient(dailyCalorieRequirements.value, 40, 'f');\n displayResults();\n hideLoading();\n displayMacrosRatioChart();\n } else {\n showError('Please check your numbers');\n }\n}", "function calculateResult() {\n\t//var fuel = getFuel();\n\t//var dist = getDistance();\n\t//var efficiency = 0;\n\t//var dist2 = 26.69/2.65;\n\t//efficiency = fuel / dist2;\n\tvar efficiency = getFuel() / (getDistance() / 100);\n\t//var efficiency = 3 + 5;\n\t\n\t//display the result\n\tdocument.getElementById('result').innerHTML = \"Fuel Efficiency is \" + efficiency + \" L/100km\";\n\t//var divobj - document.getElementById('result');\n\t//divobj.style.display='block';\n\t//divobj.innerHTML = \"Fuel Efficiency is \" + efficiency + \" L/100km\";\n}", "function onLoad2(){\n calculateFinal();\n}", "function calculate(){\n if (display.innerHTML !== \"\"){\n var result = eval(display.innerHTML);\n displayOut.innerHTML = result;\n clear();\n }\n}", "function recalculate() {\n restore();\n prevent();\n}", "function calculateResults() {\n document.getElementById('answer').style.display = 'block';\n\n document.getElementById('loading').style.display = 'none';\n\n document.getElementById('calc').style.display = 'none';\n\n inputProgress.style.display = 'none';\n progress.style.display = 'none';\n var showTable = document.getElementById('table');\n showTable.classList.remove('invisible');\n\n caclRiskProfile();\n}", "function calculatePrice() {\n const priceTotal = priceCalculation();\n innerChanger('sum', priceTotal);\n innerChanger('sum-footer', priceTotal);\n}", "function calculate()\n{\n\treken = [undefined, 0, 0, 0]; //array opnieuw zetten\n\t//For loop die kijkt hoeveel er van elke keuze is gemaakt\n\tfor (i = 0; i <= 3; i++)\n\t{\n\t\treken[user[i].choice]++;\n\t}\n\t//For loop om te kijken of de speler of CPU een unieke keuze heeft gemaakt\n\tfor (i = 0; i <= 3; i++)\n\t{\n\t\tif (reken[user[i].choice] <= 1)\n\t\t{\n\t\t\tmove(i); //Speler of CPU naar voren roepen\n\t\t}\n\t}\n\t//Als de ronde afgelopen is alles weer terug zetten\n\tsetTimeout(function ()\n\t{\n\t\t$('.playicon').css('border-color', 'transparent');\n\t\t$('#' + user[0].animal).css('border-color', '#ff9418');\n\t\t$('#a').css('color', '#ff9418');\n\t\tfor (i = 1; i <= 3; i++)\n\t\t{\n\t\t\t$('#a' + i).css('color', '#ff9418');\n\t\t}\n\t\tshowDistance();\n\t\t$('.dot').fadeIn(500);\n\t\troundchoice = false;\n\t}, 2000);\n}" ]
[ "0.68938124", "0.6751918", "0.66382706", "0.6490173", "0.6473903", "0.64625823", "0.6430302", "0.64251375", "0.6395709", "0.6392019", "0.63206875", "0.6318853", "0.63068765", "0.6304539", "0.62603736", "0.6235168", "0.6207329", "0.6157036", "0.6105715", "0.6085593", "0.60531193", "0.6048718", "0.60449106", "0.6026075", "0.6003742", "0.59870756", "0.5982199", "0.59821606", "0.5981757", "0.5969575", "0.5937919", "0.59229285", "0.59229285", "0.5913002", "0.59121567", "0.5896815", "0.58885163", "0.5864877", "0.58560455", "0.5852784", "0.5847253", "0.58410686", "0.5828562", "0.58267546", "0.5826709", "0.58213943", "0.58212984", "0.5799408", "0.57992446", "0.5794934", "0.57863", "0.5776048", "0.57699746", "0.57657754", "0.57634324", "0.5749141", "0.5738146", "0.571867", "0.5717472", "0.57093203", "0.5694685", "0.5694638", "0.56901115", "0.56795186", "0.567919", "0.5678886", "0.5675601", "0.5669425", "0.5664081", "0.5661759", "0.56554556", "0.565349", "0.5646916", "0.56459284", "0.56285876", "0.5613717", "0.56094223", "0.56075597", "0.55992955", "0.5598987", "0.5596898", "0.5593434", "0.55917376", "0.5591724", "0.55907065", "0.55898976", "0.5587341", "0.5585319", "0.55842924", "0.5580493", "0.5579943", "0.55726826", "0.5570814", "0.5567671", "0.5560691", "0.5559273", "0.55560374", "0.5550923", "0.55506563", "0.5548296", "0.55368996" ]
0.0
-1
Build music sprites if we have music list
buildMusicSprites() { let index = 0; for (const music of G.musics) { const offset = index++ - this.selected; const sprite = G.graphics.createSprite((w, h, self) => ({ x: w, y: 0.3 * h + MUSIC_LIST_ITEM_HEIGHT * (1 - MUSIC_LIST_ITEM_Y_DELTA) * (offset - 0.5) })); sprite.width = 9999; sprite.height = MUSIC_LIST_ITEM_HEIGHT; // draw background sprite.addChild(G.graphics.createRect({ top: 0, left: 0, width: 9999, height: MUSIC_LIST_ITEM_HEIGHT, background: 0x3498db, borderColor: 0x2980b9, borderWidth: 1, opacity: 1 })); // draw inner text sprite.addChild(G.graphics.createText(`${music.artist} - ${music.name}`, {}, () => ({ x: MUSIC_LIST_ITEM_PADDING, y: MUSIC_LIST_ITEM_PADDING }))); sprite.addChild(G.graphics.createText(`Created by ${music.creator}`, { fontSize: MUSIC_LIST_ITEM_CREATOR_SIZE }, () => ({ x: MUSIC_LIST_ITEM_PADDING, y: MUSIC_LIST_ITEM_PADDING + MUSIC_LIST_ITEM_TITLE_SIZE + MUSIC_LIST_ITEM_TITLE_MARGIN_BOTTOM }))); // setup sprite this.musicListSprite.addChild(sprite); G.animation.set(sprite, (w, h, self) => ({ x: w - MUSIC_LIST_ITEM_WIDTH + (Math.pow(Math.abs(offset), 1.2) * MUSIC_LIST_ITEM_WIDTH * MUSIC_LIST_ITEM_X_DELTA), y: 0.5 * h + MUSIC_LIST_ITEM_HEIGHT * (1 - MUSIC_LIST_ITEM_Y_DELTA) * (offset - 0.5) }), MUSIC_LIST_SWITCH_TIME * 3); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async onInitialize() {\n G.audio.playBGM('bgm/voltexes-ii.mp3');\n // backgrounds\n this.stage.addChild(G.graphics.createImage('graphics/music-select-bg.jpg', {\n position: 'center',\n size: 'cover'\n }));\n // darken shadow\n this.stage.addChild(G.graphics.createRect({\n top: 0,\n left: 0,\n width: 9999,\n height: 9999,\n background: 0x000000,\n opacity: 0.5\n }));\n if (!G.musics) {\n // loading text\n this.stage.addChild(this.loadingTextSprite = G.graphics.createText('Loading music list...', {\n fontSize: 24\n }, (w, h, self) => ({\n x: 0.5 * (w - self.width),\n y: 0.5 * (h - self.height)\n })));\n const res = await fetch('api/musics.json');\n if (res.ok) {\n G.musics = await res.json();\n this.stage.removeChild(this.loadingTextSprite);\n } else {\n console.error(`Get music info failed, code ${res.status}.`); // eslint-disable-line no-console\n }\n }\n // mode text\n const modeText = {\n 'play': 'Choose a song to play!',\n 'edit': 'Use your imagination!'\n };\n this.stage.addChild(G.graphics.createText(`Mode: ${G.mode}\\n${modeText[G.mode]}`, {}, { x: 20, y: 20 }));\n // music list sprite\n this.stage.addChild(this.musicListSprite = G.graphics.createSprite({ x: 0, y: 0 }));\n // load last select music\n if (G.lastSelectMusic !== -1) {\n this.selected = G.lastSelectMusic;\n }\n this.buildMusicSprites();\n }", "static listMusic() {\n let music = new Array();\n\n music.push('sounds/music/incompetech/delightful_d.ogg');\n music.push('sounds/music/incompetech/twisting.ogg'); // Moody, good for cave.\n music.push('sounds/music/incompetech/pookatori_and_friends.ogg');\n music.push('sounds/music/incompetech/getting_it_done.ogg');\n music.push('sounds/music/incompetech/robobozo.ogg');\n music.push('sounds/music/incompetech/balloon_game.ogg');\n music.push('sounds/music/incompetech/cold_sober.ogg');\n music.push('sounds/music/incompetech/salty_ditty.ogg');\n music.push('sounds/music/incompetech/townie_loop.ogg'); // Very peaceful, flute.\n music.push('sounds/music/incompetech/mega_hyper_ultrastorm.ogg'); // Super energetic. Maybe for special.\n // Legacy\n music.push('sounds/music/music_peaceful_contemplative_starling.ogg');\n music.push('sounds/music/twinmusicom_8_bit_march.ogg');\n music.push('sounds/music/twinmusicom_nes_overworld.ogg');\n music.push('sounds/music/music_juhanijunkala_chiptune_01.ogg');\n\n return music;\n }", "addMusic (prefix) {\n\t\tdiscord_music(this.client, {\n\t\t\tprefix: prefix,\n\t\t\tglobal: false\n\t\t})\n\t}", "setupBGMusic(){\n\t\t\tthis.bgMusicAudio = new Audio(); \n\t\t\tthis.bgMusicAudio.src = \"assets/Sounds/polka_train.ogg\";\n\t\t\tthis.addToContainer(this.bgMusicAudio);\n\t\t\t\n\t\t\tvar bgMusicAudio = this.bgMusicAudio;\n\t\t\t\n\t\t\tthis.container.addEventListener(\"mousemove\", function () {\n \t\t\tbgMusicAudio.play();\n\n \t\t});\n\t\t}", "function loadMusic(){\n srcPlayer.src = pathMusic + musics[countMusic] + extMusic;\n player.load();\n\n if(musics[countMusic] == 'mana_feat_jorge_e_matheus-voce_e_minha_religiao'){\n player.currentTime = 14;\n }\n }", "function initGameMusic(){\n musicTheme = new THREE.AudioListener();\n scene.add( musicTheme );\n\n var sound = new THREE.Audio( musicTheme );\n // global audio source\n if (gameState.scene=='start') {\n var audloader = new THREE.AudioLoader();\n audloader.load( 'libs/sounds/MainThemeV2.m4a', function(buffer){\n sound.setBuffer( buffer );\n sound.setLoop( true );\n sound.setVolume( 1 );\n sound.play();\n });\n } else if (gameState.scene=='bossState'){\n var audloader1 = new THREE.AudioLoader();\n audloader1.load( 'libs/sounds/BossThemeV1.m4a', function(buffer){\n sound.setBuffer( buffer );\n sound.setLoop( true );\n sound.setVolume( 1 );\n sound.play();\n });\n } else if (gameState.scene=='main'){\n var audloader2 = new THREE.AudioLoader();\n audloader2.load( 'libs/sounds/MainThemeV2.m4a', function(buffer){\n sound.setBuffer( buffer );\n sound.setLoop( true );\n sound.setVolume( 1 );\n sound.play();\n });\n }\n }", "function soundSetup(){\n updateState(false, false);\n varSong = [];\n varSongID = [];\n currentVarSongIndex = 0;\n varSongLength = 4;\n mainSong = new Howl({\n src: ['Songs/1_main.mp3'],\n loop:true\n });\n for(var x = 1; x<=varSongLength; x++){\n varSong[x-1] = new Howl({\n src: ['Songs/1_var'+x+'.mp3']\n });\n}\nresetIDs();\n\n}", "makeAudio() {\n sfx.absorb = this.sound.add('absorb');\n sfx.bullet = this.sound.add('bullet');\n sfx.extend = this.sound.add('extend');\n sfx.gameover = this.sound.add('gameover');\n sfx.levelup = this.sound.add('levelup');\n sfx.laser = this.sound.add('laser');\n sfx.lose = this.sound.add('lose');\n sfx.move = this.sound.add('move');\n sfx.ready = this.sound.add('ready');\n }", "function load_media()\n{\n bg_sprite = new Image();\n bg_sprite.src = \"images/Background-stadt_lang.png\";\n box_sprite = new Image();\n box_sprite.src = \"images/Stift.png\";\n main_sprite = new Image();\n main_sprite.src = \"images/IMG_2210_Mini.png\";\n}", "function initSounds() {\r\n sounds.set('background_music', new Audio(document.getElementById(\"background_music\").src));\r\n sounds.set('shorter_drill', new Audio(document.getElementById(\"shorter_drill\").src));\r\n sounds.set('short_drill', new Audio(document.getElementById(\"short_drill\").src));\r\n sounds.set('med_drill', new Audio(document.getElementById(\"med_drill\").src));\r\n sounds.set('long_drill', new Audio(document.getElementById(\"long_drill\").src));\r\n sounds.set('scale_b', new Audio(document.getElementById(\"scale01\").src));\r\n sounds.set('scale_t', new Audio(document.getElementById(\"scale02\").src));\r\n}", "function loadAssets () {\n game.load.image(\"Tesla\", \"assets/sprites/tesla2.png\");\n game.load.image(\"Barrier\", \"assets/sprites/barrier.png\");\n game.load.image(\"Cloud\", \"assets/sprites/cloud.png\");\n game.load.audio(\"meow1\", [\"assets/sounds/meow1.mp3\", \"assets/sounds/meow1.ogg\"]);\n game.load.audio(\"meow2\", [\"assets/sounds/meow2.mp3\", \"assets/sounds/meow2.ogg\"]);\n game.load.audio(\"meow3\", [\"assets/sounds/meow3.mp3\", \"assets/sounds/meow3.ogg\"]);\n game.load.audio(\"meow4\", [\"assets/sounds/meow4.mp3\", \"assets/sounds/meow4.ogg\"]);\n game.load.audio(\"meow5\", [\"assets/sounds/meow5.mp3\", \"assets/sounds/meow5.ogg\"]);\n game.load.audio(\"meow6\", [\"assets/sounds/meow6.mp3\", \"assets/sounds/meow6.ogg\"]);\n game.load.audio(\"flap\", [\"assets/sounds/Jump9.mp3\", \"assets/sounds/Jump9.ogg\"]);\n game.load.audio(\"hit\", [\"assets/sounds/Hit_Hurt2.mp3\", \"assets/sounds/Hit_Hurt2.ogg\"]);\n game.load.bitmapFont(\"font\", \"assets/fonts/font.png\", \"assets/fonts/font.fnt\");\n}", "function initMusic() {\n\t//music = document.createElement(\"audio\");\n\tmusic = document.getElementById(\"music\");\n\tmusic.preload = \"auto\";\n\tmusic.controls = false;\n\tmusic.hidden = true;\n\t//music.style.display = \"none\";\n\tif (typeof music.loop == 'boolean') {\n\t\tmusic.loop = true;\n\t} else {\n\t\tmusic.addEventListener('ended', function() {\n\t\t\tthis.currentTime = 0;\n\t\t\tthis.play();\n\t\t}, false);\n\t}\n\tmusic.volume = settings.music;\n\t//document.body.appendChild(music);\n}", "function loadMusic( music ) {\n title[0].textContent = music.Name_song\n audio.src = music.path\n coverAlbum.style.backgroundImage = music.cover_song \n imageVolume()\n}", "function generateMusic() {\n buttonMusic();\n return audioA.paused ? audioA.play() : audioA.pause();\n}", "function initSongList() {\n songs.forEach((song) => {\n const li = document.createElement(\"li\");\n li.classList.add(\"list\");\n\n li.innerHTML = `\n <img\n src=\"${song.cover}\"\n alt=\"Cover\"\n class=\"list-cover\"\n />\n <div class=\"list-info\" data-id=\"${song.id}\">\n <h2 class=\"song-title\">${song.name}</h2>\n <h3 class=\"song-artist\">${song.artist}</h3>\n </div>\n `;\n songList.appendChild(li);\n });\n\n const lists = document.querySelectorAll(\".list\");\n // Play the clicked song\n playClick(lists);\n}", "function repeatOneMusic() {\n // here we'll reset the musicIndex accordingly\n musicIndex = musicIndex;\n loadMusic(musicIndex);\n playMusic();\n }", "function playList(){\n\tthis.isPlaying=false;\n\t// Definicion DE ARREGLO PLAYLIST (El id se puede obtener de una DataBase)\n\t// Donde esté guardado el URL del archivo, cover, informacion de artista, etc.\n\t// Elementos\n\t// {id:\"photo\",url:\"path/to/song.mp3\", cover: \"path/to/img.jpg(png) , artist: John Doe, title: Some song\"}\n\tthis.arraySong = [\n\t//, + iteraciones // Agregar coverimage, artist, titulo\n\t\t{\n\t\t\tid:\"photo\",\n\t\t\ttitle: \"Photograph\",\n\t\t\tartist: \"Ed Sheeran\",\n\t\t\turl:\"music/photo.mp3\",\n\t\t\tcover: \"img/cover/x.jpg\",\n\t\t},\n\t\t{\n\t\t\tid:\"rend\",\n\t\t\ttitle: \"My Lighthouse\",\n\t\t\tartist: \"Rend Collective\",\n\t\t\turl:\"music/rend.mp3\",\n\t\t\tcover: \"img/cover/art_of_celebration.jpg\",\n\t\t}\n\t];\n\tthis.i=0; // CONTADOR DE REPRODUCCION\n\tthis.initSounds = function(){\n\t\tfor (var i = 0; i < this.arraySong.length; i++) {\n\t\t\tsoundManager.createSound({\n\t\t\t\tid: this.arraySong[i].id,\n\t\t\t\turl: this.arraySong[i].url,\n\t\t\t});\n\t\t}\n\t}\n\t// Devuelve Objeto Sound actual en reproduccion\n\tthis.getCurrent=function(){\n\t\treturn soundManager.getSoundById(this.arraySong[this.i].id);\n\t}\n\t// Reproducir la cancion actual\n\tthis.play = function(){\n\t\tsoundManager.pauseAll();\n\t\tvar id = this.arraySong[this.i].id;\n\t\t// soundManager.getSoundById(id).play();\n\t\tsoundManager.play(id, {\n\t\t\t// onfinish: lista.next\n\t\t\twhileplaying : function(){\n\t\t\t\t// Update position\n\t\t\t},\n\t\t\tonfinish: nextSound\n\t\t});\n\t\t// Cambiar icono\n\t\tdocument.getElementById(\"player-play\").setAttribute(\"class\",\"\");\n\t\tdocument.getElementById(\"player-play\").setAttribute(\"class\",\"glyphicon glyphicon-pause\");\n\t}\n\t// Pausar canción Actual\n\tthis.pause=function(){\n\t\tsoundManager.pauseAll();\n\t\t// Cambiar icono\n\t\tdocument.getElementById(\"player-play\").setAttribute(\"class\",\"\");\n\t\tdocument.getElementById(\"player-play\").setAttribute(\"class\",\"glyphicon glyphicon-play\");\t\n\t}\n\t// Reproducir/Pausar Cancion Actual\n\tthis.toogle=function(){\n\t\tif (this.isPlaying==true) {\n\t\t\tthis.pause();\n\t\t\tthis.isPlaying=false;\n\t\t}else{\n\t\t\tthis.play();\n\t\t\tthis.isPlaying=true;\n\t\t}\n\t}\n\tthis.prev=function(){\n\t\tthis.i--;\n\t\tif (this.i<this.arraySong.length && this.i>=0) {\n\t\t\tsoundManager.stopAll();\n\t\t\tthis.play();\n\t\t\tthis.changeInfoSong();\n\t\t}else{\n\t\t\tthis.i++;\n\t\t}\n\t}\n\tthis.next=function(){\n\t\tthis.i++;\n\t\tif (this.i<this.arraySong.length && this.i>=0) {\n\t\t\tsoundManager.stopAll();\n\t\t\tthis.play();\n\t\t\tthis.changeInfoSong();\n\t\t}else{\n\t\t\tthis.i--;\n\t\t\tthis.pause();\n\t\t}\n\t}\n\tthis.changeInfoSong = function(){\n\t\tvar cancion = this.arraySong[this.i];\n\t\t// Cambiar titulo\n\t\tdocument.getElementById(\"player-title\").innerHTML=cancion.title;\n\t\t// Cambiar artista\n\t\tdocument.getElementById(\"player-artist\").innerHTML=cancion.artist;\n\t\t// Cmabiar cover\n\t\tvar imgURL = cancion.cover;\n\t\tdocument.getElementById(\"player\").style.backgroundImage=\"url(\"+imgURL+\")\";\n\t}\n\tthis.stop = function(){\n\t\tsoundManager.stopAll();\n\t\t// Cambiar icono\n\t\tdocument.getElementById(\"player-play\").setAttribute(\"class\",\"\");\n\t\tdocument.getElementById(\"player-play\").setAttribute(\"class\",\"glyphicon glyphicon-play\");\t\n\t}\n\tthis.clear = function(){\n\t\tthis.arraySong =[];\n\t}\n\t// METODOS DE INICIO\n\tthis.initSounds();\n}", "function Pos_Sound_Manager(num_floors) {\n canvas = $(\"#canvas\")[0];\n context = canvas.getContext(\"2d\");\n\n //Array of sounds for each floor\n this.floor_sounds = new Array(num_floors);\n for (var i=0; i<this.floor_sounds.length; i++) {\n this.floor_sounds[i] = new Array();\n }\n\n //Set current floor to top floor\n this.current_floor = num_floors-1;\n\n //Changes the set of sounds to be used\n this.change_floor = function(floor) {\n for (var i=0; i<this.floor_sounds[this.current_floor].length; i++) {\n if (this.floor_sounds[this.current_floor][i].playing==true) {\n this.floor_sounds[this.current_floor][i].playing = false;\n this.floor_sounds[this.current_floor][i].sound.stop();\n }\n }\n\n //change current floor to new floor\n this.current_floor = floor;\n }\n\n //Insert a new sound into a floor\n this.insert = function(loc, sound_id) {\n this.floor_sounds[loc.floor].push({\n sound: new Howl({\n urls: [Pos_Sound_Manager.sound_urls[sound_id]+'.mp3', Pos_Sound_Manager.sound_urls[sound_id]+'.ogg'],\n loop: true,\n volume: 1\n }),\n playing: false,\n loc: {\n floor: loc.floor,\n row: loc.row,\n col: loc.col\n }\n });\n\n //Set position to center\n this.floor_sounds[loc.floor][this.floor_sounds[loc.floor].length-1].sound.pos3d(0, 0, 0);\n\n return this.floor_sounds[loc.floor][this.floor_sounds[loc.floor].length-1];\n }\n\n //pauses all sounds on floor\n this.pause_all = function() {\n for (var i=0; i<this.floor_sounds[this.current_floor].length; i++) {\n this.floor_sounds[this.current_floor][i].sound.pause();\n }\n }\n\n //looks for the given sound and removes it from the list, return true if sound was removed\n this.remove_sound = function(target_sound) {\n for (var i=0; i<this.floor_sounds[target_sound.loc.floor].length; i++) {\n if (this.floor_sounds[target_sound.loc.floor][i].loc.row==target_sound.loc.row && this.floor_sounds[target_sound.loc.floor][i].loc.col==target_sound.loc.col) {\n this.floor_sounds[target_sound.loc.floor].splice(i, 1);\n\n return true;\n }\n }\n\n return false;\n }\n\n //resumes all paused sounds on the floor\n this.resume_all = function() {\n for (var i=0; i<this.floor_sounds[this.current_floor].length; i++) {\n if (this.floor_sounds[this.current_floor][i].playing) {\n this.floor_sounds[this.current_floor][i].sound.play();\n }\n }\n }\n}", "playRandomBgMusic() {\n this.bgmusic[Math.floor(Math.random() * this.bgmusic.length)].play();\n }", "function createSoundContainer() {\n var scaleX = .75;\n var scaleY = .75;\n\n var soundContainer = new createjs.Container();\n soundContainer.x = 0;\n soundContainer.y = 0;\n soundContainer.visible = true;\n soundContainer.name = \"theSoundContainer\";\n soundContainer.hitArea = new createjs.Shape(new createjs.Graphics().beginFill(\"#F00\").drawCircle(0, 50, 50));\n soundContainer.cursor = 'pointer';\n\n var sound = new createjs.Bitmap(queue.getResult(\"musicOn\"));\n sound.name = \"musicOnImage\"\n sound.scaleX = scaleX;\n sound.scaleY = scaleY;\n soundContainer.addChild(sound);\n soundContainer.addEventListener(\"click\", function (evt) {\n if (musicOn == true) {\n\n musicOn = false;\n var sound = new createjs.Bitmap(queue.getResult(\"musicOff\"));\n sound.scaleX = scaleX;\n sound.scaleY = scaleY;\n sound.name = \"musicOffImage\"\n var destroy = evt.currentTarget.getChildByName(\"musicOnImage\");\n evt.currentTarget.removeChild(destroy);\n evt.currentTarget.addChild(sound);\n createjs.Sound.setMute(true);\n }\n else {\n musicOn = true;\n var sound = new createjs.Bitmap(queue.getResult(\"musicOn\"));\n sound.scaleX = scaleX;\n sound.scaleY = scaleY;\n sound.name = \"musicOnImage\"\n var destroy = evt.currentTarget.getChildByName(\"musicOffImage\");\n evt.currentTarget.removeChild(destroy);\n evt.currentTarget.addChild(sound);\n createjs.Sound.setMute(false);\n }\n\n }\n );\n\n soundContainer.on(\"mouseover\", handleButtonHover);\n soundContainer.on(\"mouseout\", handleButtonHover);\n return soundContainer;\n }", "function loadMusic(indexNumb) {\n musicName.innerText = allMusic[indexNumb - 1].name;\n musicArtist.innerText = allMusic[indexNumb - 1].artist;\n musicImg.src = `images/${allMusic[indexNumb - 1].img}.jpg`;\n mainAudio.src = `songs/${allMusic[indexNumb - 1].src}.mp3`;\n}", "function buildSong(songSrc, blockArray) {\n\t// Create a new audio player for this song\n\tvar audioPlayer = new AudioPlayer({\n\t\tsongSrc: songSrc,\n\t\tcontainerID: '#audio-controls',\n\t\tplayBtnID: '#play-btn',\n\t\tpauseBtnID: '#pause-btn',\n\t});\n\t\n\tif(blockArray) \n\tvar fretBoard = new FretBoard({\n\t\tbodyID: '#fret-board',\n\t\tblocks: blockArray\n\t});\n}", "preload() {\n\t\t// Load the sprites.\n this.load.image('player', 'assets/player.png');\n this.load.image('cell', 'assets/cell.png');\n this.load.image('spark', 'assets/spark.png');\n this.load.image('life', 'assets/life.png');\n this.load.image('bullet', 'assets/bullet.png');\n this.load.image('fragment', 'assets/fragments.png');\n this.load.image('line', 'assets/line.png')\n // Load the sound effects.\n this.load.audio('absorb', ['assets/absorb.mp3', 'assets/absorb.ogg']);\n this.load.audio('bullet', ['assets/bullet.mp3', 'assets/bullet.ogg']);\n this.load.audio('extend', ['assets/extend.mp3', 'assets/extend.ogg']);\n this.load.audio('gameover', ['assets/gameover.mp3', 'assets/gameover.ogg']);\n this.load.audio('laser', ['assets/laser.mp3', 'assets/laser.ogg']);\n this.load.audio('levelup', ['assets/levelup.mp3', 'assets/levelup.ogg']);\n this.load.audio('lose', ['assets/lose.mp3', 'assets/lose.ogg']);\n this.load.audio('move', ['assets/move.mp3', 'assets/move.ogg']);\n this.load.audio('ready', ['assets/ready.mp3', 'assets/ready.ogg']);\n\t}", "function play_music(data){\n playlist_index = data;\n if($('.music-list ul li').eq(playlist_index).hasClass('playing')) {\n for(var count = 0; count < title.length; count++){\n $('.currentPlaying'+count).removeClass('active');\n $('.listItemPlay').removeClass('playing');\n $('.playpause').removeClass('active');\n }\n audio.pause();\n $(\".playpause\").removeClass(\"active\");\n $(\".image\").removeClass(\"active\");\n } else {\n $('.listItemPlay').removeClass('playing');\n for(var count = 0; count < title.length; count++){\n $('.currentPlaying'+count).removeClass('active');\n }\n $('.music-list ul li').eq(playlist_index).addClass('playing');\n $('.playpause').addClass('active');\n $('.currentPlaying'+playlist_index).addClass('active');\n $(\"#image\").attr(\"src\",poster[playlist_index]);\n $(\".image\").addClass(\"active\");\n playlist_status.innerHTML = title[playlist_index];\n playlist_artist.innerHTML = artists[playlist_index];\n\n audio.src = dir+playlist[playlist_index];\n audio.play();\n \n }\n}", "function nextMusic() {\n musicIndex++;\n musicIndex > allMusic.length ? (musicIndex = 1) : (musicIndex = musicIndex);\n loadMusic(musicIndex);\n playMusic();\n playingNow();\n}", "function preload() {\n sound01 = loadSound(\"assets/son1.wav\") //A \n sound02 = loadSound(\"assets/son2.wav\") //Z \n sound03 = loadSound(\"assets/son3.wav\") //E \n sound04 = loadSound(\"assets/son4.wav\") //R\n sound05 = loadSound(\"assets/son5.wav\") //T\n sound06 = loadSound(\"assets/son6.wav\") //Y \n sound07 = loadSound(\"assets/son7.wav\") //U \n sound08 = loadSound(\"assets/son8.wav\") //I \n sound09 = loadSound(\"assets/son9.wav\") //O \n sound10 = loadSound(\"assets/son10.wav\") //P \n sound11 = loadSound(\"assets/son11.wav\") //Q \n sound12 = loadSound(\"assets/son12.wav\") //S \n sound13 = loadSound(\"assets/son13.wav\") //D \n sound14 = loadSound(\"assets/son14.wav\") //F \n sound15 = loadSound(\"assets/son15.wav\") //G \n sound16 = loadSound(\"assets/son16.wav\") //H \n sound17 = loadSound(\"assets/son17.wav\") //J \n sound18 = loadSound(\"assets/son18.wav\") //K\n sound19 = loadSound(\"assets/son19.wav\") //L \n sound20 = loadSound(\"assets/son20.wav\") //M \n sound21 = loadSound(\"assets/son21.wav\") //W \n sound22 = loadSound(\"assets/son22.wav\") //X \n sound23 = loadSound(\"assets/son23.wav\") //C\n sound24 = loadSound(\"assets/son24.wav\") //V \n sound25 = loadSound(\"assets/son25.wav\") //B \n sound26 = loadSound(\"assets/son26.wav\") //N \n\n}", "function setupEndMonster1() {\n\n ufoDots = game.add.group();\n missiles = game.add.group();\n\n for (i = 0; i < 3; i++) {\n\n var redOlive\n\n if (i != 1) {\n redOlive = ufoDots.create(game.world.width * 0.5, game.world.height * 0.5, 'red_olive');\n } else {\n redOlive = ufoDots.create(game.world.width * 0.5, game.world.height * 0.5, 'red_olive_queen');\n }\n\n\n redOlive.animations.add('fly', [0, 1, 2, 3], 5, true);\n redOlive.animations.play('fly');\n }\n\n blocks.children.forEach(function(e) {\n e.kill()\n })\n\n platforms.children.forEach(function(e) {\n e.kill()\n })\n\n diamonds.children.forEach(function(e) {\n e.kill()\n })\n\n // reset to basic texture\n player.loadTexture('dude')\n\n music.stop()\n\n music2 = game.add.audio('music2');\n music2.volume = 0.9;\n music2.loop = true;\n\n //music2.play()\n\n}", "loadAudio(map) {\n var listener = new THREE.AudioListener();\n this.add(listener);\n this.music = new THREE.Audio(listener);\n this.balloonSound = new THREE.Audio(listener);\n this.collisionSound = new THREE.Audio(listener);\n this.audioLoader = new THREE.AudioLoader();\n this.loadMusic(map);\n this.loadSounds();\n }", "function loadItem(name){\n var item = this.list[name];\n // if the item sprite array has already been loaded then no need to do it again\n if(item.spriteArray){\n return;\n } \n item.spriteSheet = loader.loadImage('images/'+this.defaults.type+'/'+name+'.png');\n item.spriteArray = [];\n item.spriteCount = 0;\n \n for (var i=0; i < item.spriteImages.length; i++){ \n var constructImageCount = item.spriteImages[i].count; \n var constructDirectionCount = item.spriteImages[i].directions; \n if (constructDirectionCount){\n for (var j=0; j < constructDirectionCount; j++) {\n var constructImageName = item.spriteImages[i].name +\"-\"+j;\n item.spriteArray[constructImageName] = {\n name:constructImageName,\n count:constructImageCount,\n offset:item.spriteCount\n };\n item.spriteCount += constructImageCount;\n };\n } else {\n var constructImageName = item.spriteImages[i].name;\n item.spriteArray[constructImageName] = {\n name:constructImageName,\n count:constructImageCount,\n offset:item.spriteCount\n };\n item.spriteCount += constructImageCount;\n }\n };\n // Load the weapon if item has one\n if(item.weaponType){\n bullets.load(item.weaponType);\n }\n\n}", "function preload() {\n mural = loadImage(\"assets/images/mural.png\");\n fontGame = loadFont(\"assets/fonts/cabin.ttf\");\n mushroomImage = loadImage(\"assets/images/mushroom.png\");\n ambianceSFX = loadSound(\"assets/sounds/ambiance.wav\");\n\n\n imageArray = [\n loadImage(\"assets/images/muscle.png\"),\n loadImage(\"assets/images/heart.png\"),\n loadImage(\"assets/images/banana.png\"),\n loadImage(\"assets/images/arch.png\"),\n loadImage(\"assets/images/crystal.png\"),\n loadImage(\"assets/images/david.png\"),\n loadImage(\"assets/images/diva.png\"),\n loadImage(\"assets/images/fuck.png\"),\n loadImage(\"assets/images/mercury.png\"),\n loadImage(\"assets/images/sun.png\"),\n loadImage(\"assets/images/tilt.png\"),\n loadImage(\"assets/images/bolt.png\"),\n loadImage(\"assets/images/steve.png\"),\n loadImage(\"assets/images/clown.png\"),\n loadImage(\"assets/images/astroboy.png\"),\n loadImage(\"assets/images/atlas.png\"),\n loadImage(\"assets/images/keith.png\"),\n ]\n}", "function preload() {\n backgroundMusic = loadSound(\"assets/mlg.mp3\");\n spellSound = loadSound(\"assets/hitmaker.mp3\");\n cat = loadImage(\"assets/cat.png\");\n}", "function preload() {\r\n theme = loadSound('music/Forget.mp3')\r\n font = loadFont('music/vanilla-extract.regular.ttf')\r\n crasyPer = loadImage('music/crazy-faceejfnaiugjkarngow2.png')\r\n crasyPer2 = loadImage('music/crazy-facefejrgniuagoiw3.png')\r\n crasyPer3 = loadImage('music/crazy-facegjnsurgaegsuiehg4.png')\r\n crasyPer4 = loadImage('music/crazy-facejnsfjhw1.png')\r\n perPer1 = loadImage('music/crybabe.png')\r\n perPer4 = loadImage('music/iogueig.png')\r\n perPer2 = loadImage('music/sifjoefu.png')\r\n perPer3 = loadImage('music/softbayru.png')\r\n perPer5 = loadImage('music/krjgoeg.png')\r\n perPer6 = loadImage('music/oerguhg.png')\r\n perPer7 = loadImage('music/oiewjgiugb.png')\r\n dreamPer3 = loadImage('music/iurjgu.png')\r\n dreamPer1 = loadImage('music/pojihg.png')\r\n dreamPer2 = loadImage('music/rugjo.png')\r\n}", "function OnLevelWasLoaded( level : int )\n {\n if ( level == 0 ) //play music when you first enter the game\n {\n audio.Stop();\n audio.clip = secrets;\n audio.Play();\n }\n else if ( level == 10 ) //when you get to forest, change music\n {\n \taudio.Stop();\n \taudio.clip = maze;\n \taudio.Play();\n }\n else if ( level == 13 ) //when you get to waterfall, change music\n {\n \taudio.Stop();\n \taudio.clip = waterfall;\n \taudio.volume = 0.2;\n \taudio.Play();\n }\n else if ( level == 14 && audio.clip != waterfall) //when you get to waterfall, change music\n {\n \taudio.Stop();\n \taudio.volume = 0.2;\n \taudio.clip = waterfall;\n \taudio.Play();\n }\n else if ( level == 17 ) //play different music when you come to searchparty2\n {\n \taudio.Stop();\n \taudio.volume = 0.4;\n \taudio.clip = secrets;\n \taudio.Play();\n }\n else if ( level == 18 ) //play market sounds for market\n {\n \taudio.Stop();\n \taudio.volume = 0.34;\n \taudio.clip = market;\n \taudio.Play();\n }\n else if ( level == 19 && audio.clip != market ) //play market sounds for market\n {\n \taudio.Stop();\n \taudio.volume = 0.34;\n \taudio.clip = market;\n \taudio.Play();\n }\n else if ( level == 20 ) //play different music for rules\n {\n \taudio.Stop();\n \taudio.volume = 0.4;\n \taudio.clip = meeting;\n \taudio.Play();\n }\n else if ( level == 21 && audio.clip != meeting)\n {\n \taudio.Stop();\n \taudio.volume = 0.4;\n \taudio.clip = meeting;\n \taudio.Play();\n }\n else if ( level == 22 ) //play siren noises for the police officer\n {\n \taudio.Stop();\n \taudio.clip = coppers;\n \taudio.Play();\n }\n else if ( level == 23 ) //play cop chatter for the police officer\n {\n \taudio.Stop();\n \taudio.clip = radio;\n \taudio.Play();\n }\n else if ( level == 24 ) //play new music for town3\n {\n \taudio.Stop(); //I'M TRAPPED IN JAVASCRIPT AND I CAN'T GET OUT. SEND FOR STEPHEN HAWKING, HE'LL KNOW WHAT TO DO\n }\n else if ( level == 25 ) //play car noise for driving scenes\n {\n \taudio.Stop();\n \taudio.clip = jeep;\n \taudio.Play();\n }\n else if ( level == 27 ) //stop car noises for capitol\n {\n \taudio.Stop();\n }\n else if ( level == 28 ) //play city noises for capitol\n {\n \taudio.Stop();\n \taudio.clip = city;\n \taudio.Play();\n }\n }", "preload() {\n this.load.image('background', 'assets/images/background.png')\n this.load.image('arrow', 'assets/images/arrow.png')\n\n this.load.spritesheet('rooster', 'assets/images/rooster_spritesheet.png', 128, 128, 4)\n this.load.spritesheet('pig', 'assets/images/pig_spritesheet.png', 128, 128, 4)\n this.load.spritesheet('sheep', 'assets/images/sheep_spritesheet.png', 128, 128, 4)\n\n this.load.audio('roosterSound', ['assets/audio/rooster.ogg', 'assets/audio/rooster.mp3'])\n this.load.audio('pigSound', ['assets/audio/pig.ogg', 'assets/audio/pig.mp3'])\n this.load.audio('sheepSound', ['assets/audio/sheep.ogg', 'assets/audio/sheep.mp3'])\n }", "function createArtists (artists) {\n listContainer.innerHTML=\"\";\n for (let i = 0; i<artists.length; i++) {\n // creating dives\n let musicBox = document.createElement('div');\n musicBox.setAttribute('class', 'musicbox-container-artists');\n let imgBox = document.createElement('div');\n imgBox.setAttribute('class', 'music-img-container');\n let musicDetail = document.createElement('div');\n musicDetail.setAttribute('class', 'music-detail-container');\n\n // inside dives\n let img = \"<img loading='lazy' src='\" + artists[i].src + \"' alt='music image'>\";\n let text = \"<h4><a href='musicplayer-onlymobile.html'>\" + artists[i].name + \"</a></h4>\";\n\n // setting Values\n imgBox.innerHTML = img;\n musicDetail.innerHTML = text;\n\n musicBox.appendChild(imgBox);\n musicBox.appendChild(musicDetail);\n listContainer.appendChild(musicBox);\n \n \n }\n\n artistsLitener ();\n}", "function preload() {\n //images\n buildImage= loadImage(\"assets/pictures/build.png\")\n goImage= loadImage(\"assets/pictures/go.png\")\n bg= loadImage(\"assets/pictures/bg.png\")\n gl= loadImage(\"assets/pictures/ghost_left.png\")\n gr= loadImage(\"assets/pictures/ghost_right.png\")\n //cloudsImage= loadImage(\"assets/pictures/clouds.gif\")\n \n //sounds\n backgroundMusic = loadSound(\"assets/sounds/384963__ispeakwaves__upbeat-funky-loop-electronic.mp3\")\n}", "function playMusic(music) {\n sounds.bg.pause();\n sounds.battle.currentTime = 0;\n sounds.battle.pause();\n sounds[music].play();\n}", "function setupSounds() {\n\tfor (var i = 0; i < shovelSounds.filenames.length; i++)\n\t\tshovelSounds.sounds[i] = new Audio(shovelSounds.filenames[i]);\n}", "function preloadDone() {\n const attack = [];\n const idle = [];\n const run = [];\n const hit = [];\n const death = [];\n const hearts = [];\n const explosions = [];\n\n for (let i = 0; i < 7; i++) {\n attack[i] = new Sprite(g_images[i]);\n }\n\n for (let i = 0; i < 9; i++) {\n idle[i] = new Sprite(g_images[i + 7]);\n }\n\n for (let i = 0; i < 8; i++) {\n run[i] = new Sprite(g_images[i + 16]);\n }\n\n for (let i = 0; i < 5; i++) {\n death[i] = new Sprite(g_images[i + 24]);\n }\n\n for (let i = 0; i < 5; i++) {\n hit[i] = new Sprite(g_images[i + 29]);\n }\n\n for (let i = 0; i < 6; i++) {\n world[i] = new Sprite(g_images[i + 34]);\n }\n\n for (let i = 0; i < 6; i++) {\n const img = new Image();\n hearts[i] = new Sprite(g_images[i + 40]);\n }\n\n for (let i = 0; i < 5; i++) {\n explosions[i] = new Sprite(g_images[i + 46]);\n }\n\n const sprites = {};\n sprites.attack = attack;\n sprites.idle = idle;\n sprites.run = run;\n sprites.death = death;\n g_character.sprites = sprites;\n g_balls.sprites = hit;\n g_hearts.sprites = hearts;\n g_explosions.sprites = explosions;\n\n music = new Audio('./assets/sounds/music.mp3');\n oofSound = new Audio('./assets/sounds/oof.wav');\n glassSounds.push(new Audio('./assets/sounds/glass1.wav'));\n glassSounds.push(new Audio('./assets/sounds/glass2.wav'));\n explosionSound = new Audio('./assets/sounds/explosion.wav');\n\n music.loop = true;\n\n mainInit();\n}", "function sprites() {\n \t\tspriteWobblers = new Object();\t\t\t\t\t\t\t\t\t\t\t// Set up arrays for the path/wobbles for each sprite\n \t\tphase4bob = new image(DEMO_ROOT + \"/def/resources/phase4.gif\");\t\t\t// Get the two sprites we've using this demo.\n \t\tatariBob = new image(DEMO_ROOT + \"/def/resources/atari.gif\");\n \t\tvar seperation = 0.30;\t\t\t\t\t\t\t\t\t\t\t\t\t// Distance between sprites\n \t\tvar spritePosition = 0;\t\t\t\t\t\t\t\t\t\t\t\t\t// Position in the path/wobble\n \t\tfor ( var i=0; i < noOfSprites; i++ ) {\t\t\t\t\t\t\t\t\t// For each sprite, set up a path/wobble\n \t\tspriteWobblers[i] = new SeniorDads.Wobbler(\n \t\t\t\t[\n\t \t\t\t\t \t{value: spritePosition, amp: 240, inc:0.08},\n\t \t\t\t\t \t{value: spritePosition, amp: 20, inc:0.30}\n \t\t\t\t],\n \t\t\t\t[\n\t \t\t\t\t \t{value: spritePosition, amp: 120, inc:0.06},\n\t \t\t\t\t \t{value: spritePosition, amp: 20, inc:0.40}\n \t\t\t\t]\n \t\t\t\t);\n \t\tspritePosition += seperation;\t\t\t\t\t\t\t\t\t\t// Move along position in the path/wobble for next sprite.\n \t\t}\n \t}", "function playMusic() {\n // if music is allowed to play\n if (playing) {\n // repeat playing\n if (!BGM_CONCLUSION.isPlaying()) {\n BGM_CONCLUSION.play();\n }\n }\n}", "function initialiseGame() {\r\n // Hides start panel and GitHub icon, shows direction buttons, plays audio\r\n document.getElementById(\"start-panel\").classList.toggle(\"hidden\");\r\n document.getElementById(\"bottom-banner\").classList.toggle(\"hidden\");\r\n document.getElementById(\"github\").classList.toggle(\"hidden\");\r\n document.getElementById(\"start\").play();\r\n document.getElementById(\"music\").play();\r\n\r\n // Generates new Sprite object per array iteration and maintains Sprite numbers to numberOfSprites\r\n for (var i = 0; i < numberOfSprites; i++) {\r\n spritesArray[i] = new Sprite(\r\n centreOfX,\r\n centreOfY,\r\n Math.random() * cnvsWidth\r\n );\r\n }\r\n\r\n // Triggers main loop animations\r\n update();\r\n}", "function loadMusic(ruta){\n\tvar source = document.getElementById('source')\n\tvar folder =\"audio\";//Carpeta donde tenemos almancenada la musica\n\tsource.src= folder+\"/\"+ruta\n\tvar index= indiceActual[0]= canciones.indexOf(ruta)\n\tremoveActive()\n\tvar item=document.getElementById(index)\n\titem.classList.add(\"active\");\n\treproduccionActual(\"Playing: \"+ ruta)\n\tplayer.load()\n}", "function preload(){\n //heads\n heads[0] = loadImage(\"images/head_wolf.png\");\n heads[1] = loadImage(\"images/head_nes.png\");\n heads[2] = loadImage(\"images/head_lagoon.png\");\n heads[3] = loadImage(\"images/head_ghost.png\");\n heads[4] = loadImage(\"images/head_mummy.png\");\n\n //torsos\n torsos[0] = loadImage(\"images/torso_wolf.png\");\n torsos[1] = loadImage(\"images/torso_nes.png\");\n torsos[2] = loadImage(\"images/torso_lagoon.png\");\n torsos[3] = loadImage(\"images/torso_mummy.png\");\n\n //feet\n feets[0] = loadImage(\"images/feet_wolf.png\");\n feets[1] = loadImage(\"images/feet_nes.png\");\n feets[2] = loadImage(\"images/feet_lagoon.png\");\n feets[3] = loadImage(\"images/feet_ghost.png\");\n feets[4] = loadImage(\"images/feet_mummy.png\");\n\n //song\n sss = loadSound(\"music/sss.mp3\");\n}", "function preload() {\n hornS = loadSound('music/horn.mp3');\n growlS = loadSound('music/growl.mp3');\n waveS = loadSound('music/wave.mp3');\n woof = loadSound('music/woof.mp3');\n creak = loadSound('music/creak.wav');\n rainS = loadSound('music/rain.mp3');\n seaS = loadSound('music/sea.mp3');\n pianoS = loadSound('music/piano.mp3');\n catGif = loadImage(\"images/cat.gif\");\n mapPng = loadImage(\"images/map.png\");\n cloudPng = loadImage(\"images/cloud.png\");\n moonPng = loadImage(\"images/moon.png\");\n lightBeam = loadImage(\"images/lightbeam.png\");\n shipPng = loadImage(\"images/ship.png\");\n dogPng = loadImage(\"images/dog.gif\");\n fishCatPng = loadImage(\"images/fishingCat.gif\");\n danceCatPng = loadImage(\"images/danceCat.gif\");\n tentacles = loadImage(\"images/tentacles.gif\");\n catKren = loadImage(\"images/catken.gif\");\n miracleFont = loadFont(\"fonts/miracle.ttf\");\n}", "setVolume(volumeMusic, volumeSound, max){\n //comprobamos que sea musica comparando su nombre con los assets correspondientes\n let aux = max - volumeMusic > 0 ? Math.log(max - volumeMusic) : 0;\n volumeMusic = (1- (aux/ Math.log(max)));\n aux = max - volumeSound > 0 ? Math.log(max - volumeSound) : 0;\n volumeSound = (1- (aux/ Math.log(max)));\n\n let music = new Map().set(\"game-theme.mp3\", true);\n if(this.sound_manager != null){\n $.each(this.sound_manager.sounds, function(index, sound){\n if(sound != null && sound.name != null){\n if(music.get(sound.name.split(\"/\").pop()) === true){\n sound.volume = volumeMusic;\n }else{\n sound.volume = volumeSound;\n }\n }\n });\n }\n }", "function preload()\n{\n // load media:\n tednose = loadImage('./data/tednose.png');\n for(var i = 0 ;i<substance.length;i++) {\n substance[i] = loadSound('./data/substance.mp3');\n }\n}", "function preload() {\n\n // if (Koji.config.images.background != \"\") {\n // imgBackground = loadImage(Koji.config.images.background);\n // }\n\n if (Koji.config.images.enemy_sprite != \"\") {\n spritedata = loadImage(Koji.config.images.enemy_sprite);\n\n }\n else {\n if (Koji.config.images.enemy1 != \"\") {\n imgEnemy1 = loadImage(Koji.config.images.enemy1);\n enemies.push(imgEnemy1);\n }\n\n if (Koji.config.images.enemy2 != \"\") {\n imgEnemy2 = loadImage(Koji.config.images.enemy2);\n enemies.push(imgEnemy2);\n }\n\n if (Koji.config.images.enemy3 != \"\") {\n imgEnemy3 = loadImage(Koji.config.images.enemy3);\n enemies.push(imgEnemy3);\n }\n }\n\n if (Koji.config.images.cursor != \"\") {\n imgCursor = loadImage(Koji.config.images.cursor);\n }\n if (Koji.config.images.ground_1 != \"\") {\n imgTile_1 = loadImage(Koji.config.images.ground_1);\n }\n if (Koji.config.images.ground_2 != \"\") {\n imgTile_2 = loadImage(Koji.config.images.ground_2);\n }\n\n //===Load Sounds here\n //Include a simple IF check to make sure there is a sound in config, also include a check when you try to play the sound, so in case there isn't one, it will just be ignored instead of crashing the game\n //if (Koji.config.sounds.tap) sndTap = loadSound(Koji.config.sounds.tap);\n}", "function initSprites(img){\n\ts_player = [\n\t\tnew Sprite(img, 977, 0, 1035-975, 100),\n\t\tnew Sprite(img, 860, 0, 918-860, 100),\n\t\tnew Sprite(img, 918, 0, 975-918, 100)\n\t];\n\ts_star = [\n\t\tnew Sprite(img, 120, 800, 160, 260),\n\t\tnew Sprite(img, 490, 800, 160, 260)\n\t];\n\ts_background = new Sprite(img, 20, 0, 814, 600);\n\t\n\ts_pumpkin = [\n\t \tnew Sprite(img, 860, 126, 120, 100),\n\t \tnew Sprite(img, 1024, 114, 140, 112),\n\t \tnew Sprite(img, 1174, 96, 142, 181),\n\t \tnew Sprite(img, 1364, 96, 239, 248)\n\t];\n\n\ts_bat = [\n\t \tnew Sprite(img, 18, 646, 150, 82),\n\t \tnew Sprite(img, 196, 614, 130, 100),\n\t \tnew Sprite(img, 342, 618, 132, 102),\n\t \tnew Sprite(img, 500, 660, 143, 78),\n\t \tnew Sprite(img, 670, 666, 97, 123),\n\t \tnew Sprite(img, 790, 666, 64, 126),\n\t \tnew Sprite(img, 854, 674, 66, 126),\n\t \tnew Sprite(img, 934, 668, 125, 107),\n\t \tnew Sprite(img, 1080, 642, 160, 70)\n\n\t];\n\n\ts_demon = [\n\t\tnew Sprite(img, 1346, 802, 125, 85),\n\t \tnew Sprite(img, 1500, 796, 130, 100),\n\t \tnew Sprite(img, 1632, 816, 118, 70),\n\t \tnew Sprite(img, 1784, 808, 128, 74),\n\t \tnew Sprite(img, 1342, 930, 126, 83),\n\t \tnew Sprite(img, 1490, 926, 108, 93),\n\t \tnew Sprite(img, 1640, 920, 130, 65),\n\t \tnew Sprite(img, 1780, 936, 123, 75),\n\t];\n}", "function loadPlayerBase(base){\n var bg = game.add.sprite(game.world.centerX - 150, game.world.centerY/2, base.background);\n bg.anchor.setTo(.5, .5);\n bg.crop(new Phaser.Rectangle(0, 0, 800, 600));\n bg.scale.setTo(.75, .75);\n for(var i = 0; i < base.list.length; ++i){\n var temp = game.add.sprite((base.list[i].position.x - 130)/2 + game.world.centerX/2 - 150, (base.list[i].position.y + 110)/2, base.list[i].image);\n temp.anchor.setTo(0.5, 0.5);\n temp.scale.setTo(0.5, 0.5);\n }\n }", "function preload() {\n cat = loadAnimation('img/cat-0.png', 'img/cat-1.png', 'img/cat-2.png', 'img/cat-3.png', 'img/cat-4.png');\n catf = loadAnimation('img/cat-f0.png', 'img/cat-f1.png', 'img/cat-f2.png', 'img/cat-f3.png', 'img/cat-f4.png');\n catSt = loadAnimation('img/cat-sit.png');\n catStF = loadAnimation('img/cat-sit-f.png');\n catFud = loadImage('img/crouton.png');\n noteC = loadSound('sound/C.mp3');\n noteE = loadSound('sound/E.mp3');\n noteG = loadSound('sound/G.mp3');\n meow = loadSound('sound/meow.mp3');\n}", "function preload() {\r\n song1 = loadSound('assets/mind.m4a');\r\n song2 = loadSound('assets/alone.m4a');\r\n}", "function preload(){\n pathImg = loadImage(\"depositphotos_211414398-stock-video-halloween-shortcut-road-forest-scary.jpg\");\n playerImg = loadAnimation(\"boy running 1.png\",\"boy running 2.png\",\"boy running 3.png\",\"boy running 4.png\");\n forestSound = loadSound(\"dark-forest.mp3\");\n wolfHowl = loadSound(\"mixkit-lone-wolf-howling-1729.wav\");\n fireImg = loadImage(\"fire.png\");\n coinImg = loadImage(\"—Pngtree—coin golden 3d digital_5879622.png\")\n //coinSound = loadSound(\"mixkit-space-coin-win-notification-271.wav\")\n cactusImg = loadImage(\"kisspng-cactus-clip-art-portable-network-graphics-image-fr-cactus-png-transparent-images-pictures-photos-pn-5c9d2a4d7ac150.5892471815538038535028.png\")\n \n \n}", "function prevMusic() {\n if( audio.currentTime > 3 ) audio.currentTime = 0\n else startMusic-- \n\n if( startMusic < 0 ) startMusic = musicList.length - 1\n loadMusic( musicList[startMusic] )\n playMusic()\n}", "function setMusicIndex(index){\n\tdocTitle.innerText= list_songs[index].title;\n\tdocArtist.innerText= list_songs[index].artist;\n\tdocImage.src=`images/${list_songs[index].image}.jpg`;\n\tmusic.src=`music/${list_songs[index].title}.mp3`;\n}", "createanims(){\n Object.keys(this.mp()).forEach(key=>{\n let config = [\n {\n key: `${key}stand`,\n frames: this.anims.generateFrameNames('players', {\n start: 1,\n end: 1,\n prefix: `${this.mp()[key]}/`\n }),\n frameRate: 8,\n repeat: -1\n },\n {\n key: `${key}down`,\n frames: this.anims.generateFrameNames('players', {\n start: 0,\n end: 2,\n frames: [1,2,1,0],\n prefix: `${this.mp()[key]}/`\n }),\n frameRate: 8,\n repeat: -1,\n },\n {\n key: `${key}up`,\n frames: this.anims.generateFrameNames('players', {\n start: 3,\n end: 5,\n frames: [4,5,4,3],\n prefix: `${this.mp()[key]}/`\n }),\n frameRate: 8,\n repeat: -1\n },\n {\n key: `${key}left`,\n frames: this.anims.generateFrameNames('players', {\n start: 6,\n end: 8,\n frames: [7,8,7,6],\n prefix: `${this.mp()[key]}/`\n }),\n frameRate: 8,\n repeat: -1\n },\n {\n key: `${key}attack`,\n frames: this.anims.generateFrameNames('players', {\n start: 9,\n end: 10,\n prefix: `${this.mp()[key]}/`\n }),\n frameRate: 2,\n repeat: 0\n },\n {\n key: `${key}idle`,\n frames: this.anims.generateFrameNames('players', {\n start: 35,\n end: 37,\n frames: [36,37,36,35],\n prefix: `${this.mp()[key]}/`\n }),\n frameRate: 4,\n repeat: -1\n },\n {\n key: `${key}hurt`,\n frames: this.anims.generateFrameNames('players', {\n start: 11,\n end: 11,\n prefix: `${this.mp()[key]}/`\n }),\n frameRate: 4,\n repeat: 0\n },\n ];\n config.forEach(anim=> this.anims.create(anim));\n })\n }", "initSound() {\n this.enemyDyingSound = this.level.game.add.audio('enemy_dying');\n this.playerHitSound = this.level.game.add.audio('player_hit');\n this.itemCollectSound = this.level.game.add.audio('item_collect');\n this.itemDropoffSound = this.level.game.add.audio('item_dropoff');\n this.advanceLevelSound = this.level.game.add.audio('advance_level');\n this.playerDyingSound = this.level.game.add.audio('player_dying');\n this.music = this.level.game.add.audio('music');\n this.music.volume = .4;\n }", "function preload() {\n xyl = loadSound('sounds/xyl.mp3');\n xylFBow = loadSound('sounds/xylFBow.mp3');\n xylABow = loadSound('sounds/xylABow.mp3');\n xylC = loadSound('sounds/xylC.mp3');\n xylD = loadSound('sounds/xylD.mp3');\n xylE = loadSound('sounds/xylE.mp3');\n xylF = loadSound('sounds/xylF.mp3');\n xylG = loadSound('sounds/xylG.mp3');\n xylA = loadSound('sounds/xylA.mp3');\n xylB = loadSound('sounds/xylB.mp3');\n xylGHi = loadSound('sounds/xylGHi.mp3');\n xylAHi = loadSound('sounds/xylAHi.mp3');\n}", "function initSprites() {\n function drawBallImage(r, colorStops, label) {\n var canvas = document.createElement(\"canvas\");\n canvas.width = canvas.height = r * 2;\n var ctx = canvas.getContext(\"2d\");\n \n var grad = ctx.createRadialGradient((3/4) * r, (1/2) * r, (1/16) * r,\n r, r, r);\n for (i in colorStops) {\n grad.addColorStop.apply(grad, colorStops[i]);\n }\n ctx.fillStyle = grad;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n \n if (label) {\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(label, r, r);\n }\n \n return canvas.toDataURL();\n }\n\n function sprite(type, role) {\n if (!role)\n role = type;\n var radius = Config.radius[type];\n var colors = Config.gradientStops[Config.color[role]];\n if (Config.reverseGradient[role])\n colors.reverse();\n var label = Config.label[role];\n var key = role.substr(0, 1).toUpperCase() + role.substr(1) + \"Sprite\";\n var map = {};\n map[key] = [ 0, 0 ];\n Crafty.sprite(radius * 2, drawBallImage(radius, colors, label), map);\n }\n \n sprite(\"rocket\");\n sprite(\"smallBall\");\n sprite(\"smallBall\", \"accelerate\");\n sprite(\"smallBall\", \"increaseMass\");\n sprite(\"smallBall\", \"thief\");\n sprite(\"smallBall\", \"thiefToolkit\");\n sprite(\"smallBall\", \"goodie\");\n sprite(\"applePolisher\");\n sprite(\"inspector\");\n sprite(\"lunatic\");\n sprite(\"bigBall\");\n sprite(\"blackHole\");\n sprite(\"magneticHole\");\n}", "function musicGenerator(elevation) {\n var audioElement = document.createElement(\"audio\");\n if (elevation > 10000) {\n // Super duper high\n audioElement.setAttribute(\"src\", \"assets/audio/acid.mp3\");\n audioElement.play();\n } else if (elevation > 9000) {\n // Super high\n audioElement.setAttribute(\"src\", \"assets/audio/hairgrowing.mp3\");\n audioElement.play();\n } else if (elevation > 8000) {\n // Extremely high\n audioElement.setAttribute(\"src\", \"assets/audio/imwasted.mp3\");\n audioElement.play();\n } else if (elevation > 7000) {\n // Very high\n audioElement.setAttribute(\"src\", \"assets/audio/wasted.mp3\");\n audioElement.play();\n } else if (elevation > 6000) {\n // High\n audioElement.setAttribute(\"src\", \"assets/audio/badAssWeed.mp3\");\n audioElement.play();\n // Slightly high\n audioElement.setAttribute(\"src\", \"assets/audio/booboo.mp3\");\n audioElement.play();\n } else {\n // Sober\n audioElement.setAttribute(\"src\", \"assets/audio/hey_bud.mp3\");\n audioElement.play();\n }\n}", "setBackgroundMusic(key)\n {\n var background = this.scene.sound.add(key, {volume: 0.5, loop: true});\n\n background.play();\n }", "async function StartMusic() {\n AUDIO_LOOP.play();\n AUDIO_LOOP_CLUCKING.play();\n}", "function initSons() {\n objSons = new Object();\n\n var objSon = document.createElement('audio');\n objSon.volume = 0.2;\n objSon.setAttribute('src', 'sons/coin.mp3');\n objSon.load();\n objSons.rammaserOr = objSon;\n\n objSon = document.createElement('audio');\n objSon.setAttribute('src', 'sons/levelup.mp3');\n objSon.load();\n objSons.levelup = objSon;\n\n objSon = document.createElement('audio');\n objSon.setAttribute('src', 'sons/creuser.mp3');\n objSon.load();\n objSons.creuser = objSon;\n\n objSon = document.createElement('audio');\n objSon.volume = 0.2;\n objSon.setAttribute('src', 'sons/meurt.mp3');\n objSon.load();\n objSons.meurt = objSon;\n\n objSon = document.createElement('audio');\n objSon.setAttribute('src', 'sons/coeur.mp3');\n objSon.load();\n objSons.coeur = objSon;\n\n objSon = document.createElement('audio');\n objSon.setAttribute('src', 'sons/trouremplit.mp3');\n objSon.load();\n objSons.trouremplit = objSon;\n\n objSon = document.createElement('audio');\n objSon.setAttribute('src', 'sons/gardemeurt.mp3');\n objSon.load();\n objSons.gardemeurt = objSon;\n\n objSon = document.createElement('audio');\n objSon.setAttribute('src', 'sons/chute.mp3');\n objSon.load();\n objSons.chute = objSon;\n\n objSon = document.createElement('audio');\n objSon.volume = 0.01;\n objSon.setAttribute('src', 'sons/background.mp3');\n objSon.load();\n objSons.background = objSon;\n\n objSon = document.createElement('audio');\n objSon.setAttribute('src', 'sons/fantome-or.mp3');\n objSon.load();\n objSons.fantomeOr = objSon;\n\n\n}", "function initialiseGame() {\n // Hides start panel and GitHub icon, shows direction buttons, plays audio\n document.getElementById(\"start-panel\").classList.toggle(\"hidden\");\n document.getElementById(\"bottom-banner\").classList.toggle(\"hidden\");\n document.getElementById(\"github\").classList.toggle(\"hidden\");\n document.getElementById(\"start\").play();\n document.getElementById(\"music\").play();\n\n // Generates new Sprite object per array iteration and maintains Sprite numbers to numberOfSprites\n for (var i = 0; i < numberOfSprites; i++) {\n spritesArray[i] = new Sprite(\n centreOfX,\n centreOfY,\n Math.random() * cnvsWidth\n );\n }\n\n // Triggers main loop animations\n update();\n}", "function updateSongSelectorPerm0() {\n// position 0\n createARegularSongDiv(3, 0);\n// position 1\n createARegularSongDiv(4, 1);\n// position 2 - main position\n createMiddleSongDiv(0, 2);\n// position 3\n createARegularSongDiv(1, 3);\n// position 4\n createARegularSongDiv(2, 4);\n}", "function loadSong(index) {\r\n cover.src = music[musicIndex].img;\r\n audio.src = `./music/${music[musicIndex].title}.mp3`;\r\n artistName.innerText = music[musicIndex].artist;\r\n songName.innerText = music[musicIndex].title;\r\n}", "startMusic() {\n this.bgSound.play();\n }", "playBgMusic3() {\n if (!this.music_muted) {\n this.bgmusic3.play();\n }\n }", "function preload() {\n song = loadSound(`assets/sounds/song.mp3`);\n dragon = loadImage(`assets/images/Li/inkart1.png`);\n cherryblossom1 = loadImage(`assets/images/Li/inkart2.png`);\n cherryblossom2 = loadImage(`assets/images/Li/inkart3.png`);\n}", "function preload() {\r\n backgroundImg = loadImage(\"./assets/background.gif\");\r\n backgroundMusic = loadSound(\"./assets/background_music.mp3\");\r\n waterSound = loadSound(\"./assets/cannon_water.mp3\");\r\n pirateLaughSound = loadSound(\"./assets/pirate_laugh.mp3\");\r\n cannonExplosion = loadSound(\"./assets/cannon_explosion.mp3\");\r\n towerImage = loadImage(\"./assets/tower.png\");\r\n boatSpritedata = loadJSON(\"assets/boat/boat.json\");\r\n boatSpritesheet = loadImage(\"assets/boat/boat.png\");\r\n brokenBoatSpritedata = loadJSON(\"assets/boat/broken_boat.json\");\r\n brokenBoatSpritesheet = loadImage(\"assets/boat/broken_boat.png\");\r\n waterSplashSpritedata = loadJSON(\"assets/water_splash/water_splash.json\");\r\n waterSplashSpritesheet = loadImage(\"assets/water_splash/water_splash.png\");\r\n\r\n}", "preload() {\n\t\tthis.load.spritesheet(\"avatar\", \"/assets/avatar.png\", {\n\t\t\tframeWidth: 48,\n\t\t\tframeHeight: 48,\n\t\t});\n\t\tthis.load.spritesheet(\"bird\", \"/assets/bird.png\", {\n\t\t\tframeWidth: 48,\n\t\t\tframeHeight: 48,\n\t\t});\n\t\tthis.load.spritesheet(\"explosion\", \"/assets/explosion.png\", {\n\t\t\tframeWidth: 55,\n\t\t\tframeHeight: 55,\n\t\t});\n\t\tthis.load.image(\"bg\", \"/assets/background.png\");\n\t\tthis.load.image(\"poop\", \"/assets/poop.png\");\n\t\tthis.load.image(\"bullet\", \"/assets/bullet.png\");\n\t\tthis.load.image(\"shoot\", \"/assets/buttons/shoot.png\");\n\t\tthis.load.image(\"navigate\", \"/assets/buttons/navigate.png\");\n\t}", "function playRandom() {\n var musicList = document.getElementsByClassName('play_this');\n \n var rand = Math.floor(Math.random() * musicList.length);\n \n while (player.getAttribute('src')\n && player.getAttribute('src') === musicList[rand].parentNode.parentNode.getAttribute('data-mpeg')) {\n rand = Math.floor(Math.random() * musicList.length);\n }\n \n setPlayerInfo(musicList[rand].parentNode.parentNode);\n playItem(musicList[rand].parentNode.parentNode);\n}", "function prevMusic() {\n musicIndex--;\n musicIndex < 1 ? (musicIndex = allMusic.length) : (musicIndex = musicIndex);\n loadMusic(musicIndex);\n playMusic();\n playingNow();\n}", "function makeSounds(){\n\t// all timecodes are in seconds format... converted to milliseconds at runtime (onPlay event)\n\t\n\t//quiz sfx:\n\tmakeSound('sfx_biscuits', 116.056104, 117.029715);\n\tmakeSound('sfx_splat', 117.308417, 118.419256);\n\tmakeSound('sfx_pie', 118.502263, 119.312165);\n\tmakeSound('sfx_lazer', 119.481508, 121.524669);\n\tmakeSound('sfx_wrong', 122.087919, 123.427938);\n\n\n\t//question-specific audio:\n console.log(\"making sounds\");\n\tmakeSound('q_q0', 0.495087, 3.701368);\n\tmakeSound('q_qscene', 0.495087, 3.701368);\n\tmakeSound('q_qconveyer', 0.495087, 3.701368);\n\tmakeSound('q_qfootball', 0.495087, 3.701368);\n\tmakeSound('q_qfootball1', 19.685622, 23.599171);\n\tmakeSound('q_qfootball2', 30.719000, 35.174788);\n\tmakeSound('q_qskywheel', 30.719000, 35.174788);\n\tmakeSound('q_q6', 38.027435, 40.078511);\n\tmakeSound('q_q7', 41.469472, 45.170840);\n\tmakeSound('q_q9', 46.278893, 47.787731);\n\tmakeSound('q_qblocklink', 0.495087, 3.701368, [\"请\", \"连\", \"线\"], [0.495087, 1.1, 2.2]);\n\tmakeSound('q_qpiglink', 0.495087, 3.701368, [\"请\", \"连\", \"线\"], [0.495087, 1.1, 2.2]);\n\tmakeSound('q_qpresenta', 0.495087, 3.701368, [\"If \", \"you want to measure the weight of something you use a \"], [0.495087, 1.1]);\n\tmakeSound('q_qpresentb', 0.495087, 3.701368, [\"If \", \"you want to measure the weight of something you use a \"], [0.495087, 1.1]);\n\tmakeSound('q_qblock', 4.856573, 8.793697);\n\tmakeSound('q_qfruit', 4.856573, 8.793697);\n\tmakeSound('q_qcard', 4.856573, 8.793697);\n\tmakeSound('q_qstadium', 4.856573, 8.793697);\n\tmakeSound('q_qscale', 4.856573, 8.793697);\n\tmakeSound('q_qanimal', 4.856573, 8.793697);\n\tmakeSound('q_qanimal1', 4.856573, 8.793697);\n\tmakeSound('q_qanimal2', 30.719000, 35.174788);\n\tmakeSound('q_qanimal3', 4.856573, 8.793697);\n\tmakeSound('q_qanimal4', 4.856573, 8.793697);\n makeSound('q_qblock1', 4.856573, 8.793697);\n makeSound('q_qblock2', 30.719000, 35.174788);\n makeSound('q_qblock3', 4.856573, 8.793697);\n makeSound('q_qblock4', 4.856573, 8.793697);\n\tmakeSound('q_qsupermarket', 4.856573, 8.793697);\n\tmakeSound('q_qsupermarket1', 4.856573, 8.793697);\n\tmakeSound('q_qsupermarket2', 30.719000, 35.174788);\n\tmakeSound('q_qsupermarket3', 4.856573, 8.793697);\n\tmakeSound('q_qsupermarket4', 4.856573, 8.793697);\n\tmakeSound('q_qpresent1', 4.856573, 8.793697);\n\tmakeSound('q_qpresent2', 30.719000, 35.174788);\n\tmakeSound('q_qpresent3', 4.856573, 8.793697);\n\tmakeSound('q_qpresent4', 4.856573, 8.793697);\n\tmakeSound('q_qtrain', 0.495087, 3.701368, [\"If \", \"you want to measure the weight of something you use a \"], [0.495087, 1.1]);\n\tmakeSound('q_qtrain1', 4.856573, 8.793697);\n makeSound('q_qtrain2', 4.856573, 8.793697);\n makeSound('q_qtrain3', 4.856573, 8.793697);\n makeSound('q_qtrain4', 4.856573, 8.793697);\n\tmakeSound('q_qstadium1', 4.856573, 8.793697);\n makeSound('q_qstadium2', 4.856573, 8.793697);\n makeSound('q_qstadium3', 4.856573, 8.793697);\n makeSound('q_qstadium4', 4.856573, 8.793697);\n\tmakeSound('q_qcard1', 4.856573, 8.793697);\n makeSound('q_qcard2', 4.856573, 8.793697);\n makeSound('q_qcard3', 4.856573, 8.793697);\n makeSound('q_qcard4', 4.856573, 8.793697);\n\tmakeSound('q_qfruit1', 4.856573, 8.793697);\n makeSound('q_qfruit2', 4.856573, 8.793697);\n makeSound('q_qfruit3', 4.856573, 8.793697);\n makeSound('q_qfruit4', 4.856573, 8.793697);\n\tmakeSound('q_q2', 4.856573, 8.793697);\n\tmakeSound('q_q21', 4.856573, 8.793697);\n\tmakeSound('q_q22', 4.856573, 8.793697);\n\tmakeSound('q_q3', 10.161081, 12.730821);\n\tmakeSound('q_q4', 14.239659, 17.516667);\n\tmakeSound('q_q8', 19.685622, 23.599171);\n\tmakeSound('q_q5', 25.579521, 29.139435);\n\tmakeSound('q_q10', 30.719000, 35.174788);\n\tmakeSound('q_q11', 30.719000, 35.174788);\n\tmakeSound('q_q6', 38.027435, 40.078511);\n\tmakeSound('q_q7', 41.469472, 45.170840);\n\tmakeSound('q_q9', 46.278893, 47.787731);\n\tmakeSound('q_q13',0.44444,0.55555);\n\tmakeSound('q_qfishing',0.44444,0.55555);\n\n\n\tmakeSound('determine it', 49.555901, 50.593227);\n\tmakeSound('apply it', 51.347646, 52.432123);\n\tmakeSound('stopwatch', 53.775932, 54.907561);\n\tmakeSound('construct it', 55.567677, 56.652155);\n\tmakeSound('sweep it', 57.642330, 58.608929);\n\tmakeSound('ruler', 59.764133, 60.494977);\n\tmakeSound('divide it', 61.650181, 62.593205);\n\tmakeSound('comfort it', 63.347624, 64.267072);\n\tmakeSound('measure', 64.832886, 65.360961);\n\tmakeSound('scale', 66.011666, 66.695058);\n\tmakeSound('weight', 67.025416, 67.584555);\n\tmakeSound('水星', 67.025416, 67.584555);\n\tmakeSound('金星', 67.025416, 67.584555);\n\tmakeSound('火星', 67.025416, 67.584555);\n\tmakeSound('短', 68.109894, 68.675708);\n\tmakeSound('中', 69.194371, 69.939889);\n\tmakeSound('长', 70.184546, 70.942490);\n\tmakeSound('train_whistle', 70.184546, 70.942490);\n\tmakeSound('length ', 68.109894, 68.675708);\n\tmakeSound('height', 69.194371, 69.939889);\n\tmakeSound('speed', 70.184546, 70.942490);\n\tmakeSound('distance', 71.304387, 72.348112);\n\tmakeSound('temperature', 72.506742, 73.252260);\n\tmakeSound('estimate', 73.544068, 74.115405);\n\tmakeSound('compare', 115.797153,116.481301);\n\tmakeSound('f_q0', 75.630509, 78.512319);\n\tmakeSound('f_qpresenta', 75.630509, 78.512319);\n\tmakeSound('f_qpresentb', 75.630509, 78.512319);\n\tmakeSound('f_q2', 78.872153, 81.887586);\n\tmakeSound('f_q21', 78.872153, 81.887586);\n\tmakeSound('f_q22', 78.872153, 81.887586);\n\tmakeSound('f_q3', 82.408492, 85.906000);\n\tmakeSound('f_q4', 86.227739, 89.547433);\n\tmakeSound('f_q5', 89.988046, 92.651904);\n\tmakeSound('f_q6', 92.946783, 95.153372);\n\tmakeSound('f_q7', 95.386857, 97.760293);\n\tmakeSound('f_q8', 98.027324, 101.659857);\n\tmakeSound('f_q9', 102.082326, 103.851766);\n\tmakeSound('f_q10', 104.145191, 107.206568);\n\tmakeSound('f_q11', 104.145191, 107.206568);\n\tmakeSound('f_qrope', 104.145191, 107.206568);\n\t\n\t//required for quiz question outocomes:\n\tmakeSound('empty', 4.5,4.6);\n\tmakeSound('quizmo', 107.410411, 108.640050);\n\tmakeSound('correct_1', 109.011801, 110.198546);\n\tmakeSound('correct_2', 110.355825, 111.560707);\n\tmakeSound('incorrect_1', 111.927255, 113.158259);\n\tmakeSound('incorrect_2', 113.887464, 115.196398);\t\n}", "function preload() {\n print(\"Butthole!\")\n soundFormats('wav', 'mp3', 'ogg');\n //here's all the sfx we can use! you can even see the secret 17th sound... >:3c\n sfx = [loadSound('ass/puff.mp3'), loadSound('ass/BUP.mp3'), loadSound('ass/HEY.mp3'), loadSound('ass/vsas.mp3'), loadSound('ass/mikal.mp3'), loadSound('ass/jon.mp3'), loadSound('ass/hank.mp3'), loadSound('ass/tau.mp3'), loadSound('ass/euler.mp3'), loadSound('ass/bum.mp3'), loadSound('ass/work.mp3'), loadSound('ass/bl.mp3'), loadSound('ass/net.mp3'), loadSound('ass/memes.mp3'), loadSound('ass/game.mp3'), loadSound('ass/theory.mp3'), loadSound('ass/sega.mp3')];\n}", "function load_happy_fish() {\n\tgame.load.image(\"fish-top\",\"images/fish-top.png\");\n\tgame.load.image(\"fish-bottom\",\"images/fish-bottom.png\");\n\tgame.load.image(\"fish-eyes\",\"images/fish-eyes.png\");\n\tgame.load.image(\"arena\",\"images/arena.png\");\n game.load.image(\"star\",\"images/star.png\");\n game.load.image(\"bg\",\"images/bg.png\");\n\n game.load.audio(\"blop\",\"sounds/blop.wav\");\n game.load.audio(\"theme\",\"sounds/theme.mp3\");\n}", "preload() {\n var prefix = 'imgs/'\n if(app.gameType == \"3d\")\n prefix = 'imgs/3D/'\n\n\n var boardIndex;\n var pieceIndex;\n var backgroundIndex;\n\n // Load image references into the game for later loading while playing\n game.load.image('X', prefix + 'pieceX'+app.selected.charAt(1)+'.png');\n game.load.image('square', prefix + 'board'+app.selected.charAt(0)+'.png');\n game.load.image('O', prefix + 'pieceO'+app.selected.charAt(1)+'.png');\n game.load.image('background', 'imgs/background'+app.selected.charAt(2)+'.png');\n game.load.image('forfeit', 'imgs/forfeit.png');\n game.load.image('menubackground', 'imgs/menubackgroundtwo.png');\n game.load.image('logo', 'imgs/phaser.png');\n game.load.image('board', 'imgs/angledBoard.png');\n game.load.image('greensquare', prefix + 'greensquare.png')\n game.load.image('redsquare', prefix + 'redsquare.png')\n game.load.image('poopemoji', 'imgs/poop.png')\n game.load.image('square', prefix + 'square.png')\n console.log(prefix)\n }", "function groupSounds() {\n\t\n\tvar modifiedSounds = {general:[], audioSprites:[], music: music};\n\tvar usedIndexesGeneral = [];\n\tvar usedIndexesAudioSprites = [];\n\tvar lastIndexGeneral = 0;\n\tvar lastIndexAudioSprites = 0;\n\t\n\tfor (var i = 0; i < rooms.length; i++) {\n\t\tif (rooms[i].group != undefined && rooms[i].group != \"\") {\n\t\t\tvar groupIndex = parseInt(rooms[i].group);\n\t\t\tif (lastIndexGeneral < groupIndex) {\n\t\t\t\tlastIndexGeneral = groupIndex;\n\t\t\t}\n\t\t\tif (lastIndexAudioSprites < groupIndex) {\n\t\t\t\tlastIndexAudioSprites = groupIndex;\n\t\t\t}\n\t\t\tfor (var j = 0; j < sounds.general.length; j++) {\n\t\t\t\tif (sounds.general[j][0] == rooms[i].name) {\n\t\t\t\t\tif (modifiedSounds.general[groupIndex] == undefined) {\n\t\t\t\t\t\tmodifiedSounds.general[groupIndex] = [];\n\t\t\t\t\t}\n\t\t\t\t\tmodifiedSounds.general[groupIndex].push(jQuery.extend(true, [], sounds.general[j]));\n\t\t\t\t\tif (usedIndexesGeneral.indexOf(j) == -1) {\n\t\t\t\t\t\tusedIndexesGeneral.push(j);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (var j = 0; j < sounds.audioSprites.length; j++) {\n\t\t\t\tif (sounds.audioSprites[j][0] == rooms[i].name) {\n\t\t\t\t\tif (modifiedSounds.audioSprites[groupIndex] == undefined) {\n\t\t\t\t\t\tmodifiedSounds.audioSprites[groupIndex] = [];\n\t\t\t\t\t}\n\t\t\t\t\tmodifiedSounds.audioSprites[groupIndex].push(jQuery.extend(true, [], sounds.general[j]));\n\t\t\t\t\tif (usedIndexesAudioSprites.indexOf(j) == -1) {\n\t\t\t\t\t\tusedIndexesAudioSprites.push(j);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\tif (modifiedSounds.general[0] == undefined) {\n\t\tmodifiedSounds.general[0] = [];\n\t}\n\tif (modifiedSounds.audioSprites[0] == undefined) {\n\t\tmodifiedSounds.audioSprites[0] = [];\n\t}\n\tfor (var i = 0; i < sounds.general.length; i++) {\n\t\tif (usedIndexesGeneral.indexOf(i) == -1) {\n\t\t\tmodifiedSounds.general[0].push(jQuery.extend(true, [], sounds.general[i]));\n\t\t}\n\t}\n\tfor (var i = 0; i < sounds.audioSprites.length; i++) {\n\t\tif (usedIndexesAudioSprites.indexOf(i) == -1) {\n\t\t\tmodifiedSounds.audioSprites[0].push(jQuery.extend(true, [], sounds.audioSprites[i]));\n\t\t}\n\t}\n\tfor (var i = 0; i < (lastIndexGeneral+1); i++) {\n\t\tif (modifiedSounds.general[i] == undefined) {\n\t\t\tmodifiedSounds.general[i] = [];\n\t\t}\n\t}\n\tfor (var i = 0; i < (lastIndexAudioSprites+1); i++) {\n\t\tif (modifiedSounds.audioSprites[i] == undefined) {\n\t\t\tmodifiedSounds.audioSprites[i] = [];\n\t\t}\n\t}\n\t\n\treturn modifiedSounds;\n}", "start() {\n this.HUD = this.node.getJSComponent(\"HUD\");\n this.enemyBaseNode = this.scene.createChild(\"EnemyBaseNode\");\n\n this.gameOver = false;\n this.enemies = [];\n this.spawnSpace();\n this.spawnPlayer();\n this.spawnEnemies();\n\n this.backgroundMusic.looped = true;\n var musicNode = this.scene.createChild(\"MusicNode\");\n var musicSource = musicNode.createComponent(\"SoundSource\");\n musicSource.gain = 0.5;\n musicSource.soundType = Atomic.SOUND_MUSIC;\n musicSource.play(this.backgroundMusic);\n }", "function musicPlay () {\n if (currentWord === \"rocketeer\") {\n rocketeer.play();\n } else if (currentWord === \"legendofzelda\") {\n legendofZelda.play();\n } else if (currentWord === \"kingsquest\") {\n kq6.play();\n } else if (currentWord === \"baldursgate\") {\n baldursGate.play();\n } else if (currentWord === \"finalfantasy\") {\n finalFantasy.play();\n }\n else {\n audio.muted = true;\n }\n }", "function preload() {\n//\n// //create an animation from a sequence of numbered images\n// //pass the first and the last file name and it will try to find the ones in between\n turtle = loadAnimation('sprites/Turtle1.png', 'sprites/Turtle2.png','sprites/Turtle3.png','sprites/Turtle4.png');\n}", "function add_to_list(){\n for(var count = 0; count < title.length; count++){\n html = '';\n html += '<li class=\"listItemPlay \" onclick=\"play_music('+count+')\" data-item=\"'+count+'\">';\n html += '<div class=\"row\">';\n html += '<span>'+title[count]+'</span>';\n html += '<p>'+artists[count]+'</p>';\n html += '</div>';\n html += '<span class=\"currentPlaying'+count+' button button-sm\"><i class=\"fas fa-play\"></i><i class=\"fas fa-pause\"></i></span>';\n html += '</li>';\n $('#my_musics').append(html);\n }\n \n}", "function preload(){//assets that need to be loaded before hand\n game.load.image('font', 'Resources/smallfont.png');//font loading\n \n game.load.audio('background_music', \"Resources/Background.mp3\");\n game.load.audio('click_music', \"Resources/Click.mp3\");\n \n game.load.spritesheet('tileSet', 'Resources/tileset_strip12.png', tSize, tSize, 12);\n game.load.image('player', 'Resources/player.png', tSize, tSize);\n game.load.spritesheet('enemies', 'Resources/enemies_strip15.png', tSize, tSize, 15);\n game.load.spritesheet('weapons', 'Resources/weapons_strip23.png', tSize, tSize, 23);\n game.load.spritesheet('weapons_hold', 'Resources/weapons_holding_strip23.png', tSize, tSize, 23);\n game.load.spritesheet('armors','Resources/armor_strip8.png', tSize, tSize, 8);\n game.load.spritesheet('armors_wearing','Resources/armor_wearing_strip8.png', tSize, tSize, 8);\n game.load.spritesheet('scrolls','Resources/scrolls_strip11.png', tSize, tSize, 11);\n game.load.spritesheet('items','Resources/item_misc_strip11.png', tSize, tSize, 11);\n game.load.image('inventory', 'Resources/inventory.png', 96, 120);\n game.load.spritesheet('crosshairs', 'Resources/crosshair_strip5.png', tSize, tSize, 5);\n game.load.spritesheet('minimap_tiles', 'Resources/map_strip11.png', 5,5,11);\n \n //custom level\n game.load.image('level_5', 'Resources/level_5.bmp');\n game.load.image('level_10', 'Resources/level_10.bmp');\n game.load.image('level_15', 'Resources/level_15.bmp');\n \n Phaser.Canvas.setImageRenderingCrisp(game.canvas); //makes the game have no anti-alias\n game.scale.setUserScale(3,3,0,0); //scales game by 3\n game.scale.scaleMode = Phaser.ScaleManager.USER_SCALE;//uses custom scale for render window\n \n game.camera.bounds = null;//camera can move anywhere\n \n for(let i = 0; i < 16; i++){\n renderOrder[i] = game.add.group();\n }\n renderOrder[RENDER_LAYERS.FADEOUT].fixedToCamera = true;//connect to camera\n renderOrder[RENDER_LAYERS.CROSSHAIRS].fixedToCamera = true;//connect to camera\n renderOrder[RENDER_LAYERS.INVENTORY].fixedToCamera = true;//connect to camera\n renderOrder[RENDER_LAYERS.INVENTORY_ITEMS].fixedToCamera = true;//connect to camera\n renderOrder[RENDER_LAYERS.INVENTORY_ITEM_TARGETED].fixedToCamera = true;//connect to camera\n renderOrder[RENDER_LAYERS.INVENTORY_TARGET].fixedToCamera = true;//connect to camera\n renderOrder[RENDER_LAYERS.TEXT].fixedToCamera = true;//connect to camera\n renderOrder[RENDER_LAYERS.MINI_MAP].fixedToCamera = true;//connect to camera\n renderOrder[RENDER_LAYERS.MINI_MAP_PLAYER].fixedToCamera = true;//connect to camera\n \n //console.log(renderOrder);\n \n console.log('preload successul');\n }", "function preload(){ //My media\n thud = loadSound(\"thud.mp3\"); //noise when you hit the \"a\" key\n song = loadSound(\"halloween.mp3\"); //background music\n img = loadImage(\"ghost.png\"); //ghost icon\n}", "function preload(){\n //load art/sound assets\n titleImg = createImg('assets/images/title.gif');\n\n player1Sprite = loadImage('assets/images/player.png');\n player2Sprite = loadImage('assets/images/player2.png');\n player1Sprite_flipped = loadImage('assets/images/player_flipped.png');\n player2Sprite_flipped = loadImage('assets/images/player2_flipped.png');\n berrySprite = loadImage('assets/images/berry.png');\n spikeSprite = loadImage('assets/images/spike.png');\n spikeSprite_flipped = loadImage('assets/images/spike_flipped.png');\n instrImg = loadImage('assets/images/instr.png');\n\n jumpSFX = loadSound('assets/sounds/jump.wav');\n collectedSFX = loadSound('assets/sounds/collected.wav');\n killedSFX = loadSound('assets/sounds/killed.wav');\n startSFX = loadSound('assets/sounds/levelStart.wav');\n clearSFX = loadSound('assets/sounds/levelCleared.wav');\n bgm_intro = loadSound('assets/sounds/bgm_intro.wav');\n bgm_game = loadSound('assets/sounds/bgm_game.wav');\n bgm_outro = loadSound('assets/sounds/bgm_outro.wav');\n}", "function loadMusic(ruta){\r\n\tvar source = document.getElementById('source')\r\n\tvar folder =\"audio\";//Carpeta donde tenemos almancenada la musica\r\n\tsource.src= folder+\"/\"+ruta\r\n\tvar index= indiceActual[0]= canciones.indexOf(ruta)\r\n\tremoveActive()\r\n\tvar item=document.getElementById(index)\r\n\titem.classList.add(\"active\");\r\n\treproduccionActual(\"Reproduciendo: \"+ ruta)\r\n\tmiguel.load()\r\n}", "function setBackgroundMusic() {\n // create an AudioListener and add it to the camera\n var listener = new THREE.AudioListener();\n camera.add( listener );\n\n // create a global audio source\n var sound = new THREE.Audio( listener );\n\n // load a sound and set it as the Audio object's buffer\n var audioLoader = new THREE.AudioLoader();\n audioLoader.load( 'src/audio/music.mp3', function( buffer ) {\n sound.setBuffer( buffer );\n sound.setLoop( true );\n sound.setVolume( 0.3 );\n sound.play();\n });\n}", "function preload(){\n // frogSound = loadSound('assets/frog.m4a');\n // flySound = loadSound('assets/fly.m4a');\n console.log(\"sounds loaded\");\n img = loadImage(\"assets/frog.png\");\n for(var i = 0; i < flyNumber; i++){flies[i] = loadImage(\"assets/fly\" + floor(random(0,3)) + \".png\");}\n}", "function preload()\n{\n tile_sound = loadSound(\"Sounds/CodingPower.mp3\");\n light_sound = loadSound(\"Sounds/SciFi.mp3\");\n //\"Sounds/Input-02.mp3\");\n}", "function music(){\n var music = document.getElementById(\"Game_bg\");\n if(musicOn){\n music.pause();\n document.getElementById(\"playMusic\").src = \"../Media/musicOff.png\";\n musicOn = false;\n\n }\n else if(!musicOn){\n music.play();\n document.getElementById(\"playMusic\").src = \"../Media/musicOn.png\";\n musicOn = true;\n }\n}", "function buildSoundsList() {\n let list = '';\n clock.alarm.sounds.forEach(sound => {\n var name = sound.replace(/_/g, \" \");\n if (name.length > 20) name = `${name.substring(0, 20)}...`;\n\n list += `<li class=\"toggle\" data-name=\"${sound}\">\n <span class=\"title\"> ${name} </span>\n <label class=\"switch\">\n <input type=\"radio\" name=\"switch-sound\">\n <span class=\"slider round\"></span>\n </label>\n </li>`;\n });\n document.querySelector('.sound-list').innerHTML = list;\n\n document.querySelectorAll('.sound-list > li.toggle').forEach(item => {\n item.addEventListener('click', function (e) {\n // prevents the click of the switch button\n if (e.currentTarget !== e.target) return;\n\n if (this.classList.contains('previewSound')) {\n // stop current sound\n this.classList.remove('previewSound');\n stopAlarm();\n updateClock('alarm', { previewMode: false });\n } else {\n // stop all sounds and play current one\n stopAllPreviewAlarmSounds();\n this.classList.add('previewSound');\n playAlarm(this.dataset.name);\n updateClock('alarm', { previewMode: true });\n }\n });\n });\n\n document.querySelectorAll('.sound-list > li.toggle .switch').forEach(item => {\n let itemSoundName = item.parentNode.dataset.name;\n if (itemSoundName === clock.alarm.alarmSound) {\n console.log('itemSoundName', itemSoundName)\n item.querySelector('input').checked = true;\n }\n\n item.addEventListener('click', function (e) {\n updateClock('alarm', { alarmSound: itemSoundName });\n });\n });\n }", "preload() {\n // menu elements\n this.load.atlas(\"logo\", \"../../resources/logo.png\", \"../../resources/logo.json\");\n this.load.image(\"button\", \"../../resources/buttons/button.png\");\n this.load.image(\"button_level\", \"../../resources/buttons/button_level.png\");\n this.load.image(\"close\", \"../../resources/buttons/close.png\");\n this.load.image(\"help\", \"../../resources/buttons/help.png\");\n this.load.image(\"options\", \"../../resources/buttons/options.png\");\n\n // sounds\n this.load.audio(\"background_music\", \"../../resources/sounds/music.ogg\");\n this.load.audio(\"background_music_bossfight\", \"../../resources/sounds/bossfight.ogg\");\n this.load.audio(\"hover_sound\", \"../../resources/sounds/hover.mp3\");\n\n // skins\n this.load.atlas(\"player\", \"../../resources/shapes/player.png\", \"../../resources/shapes/player.json\");\n this.load.atlas(\"long\", \"../../resources/shapes/long.png\", \"../../resources/shapes/long.json\");\n this.load.atlas(\"love\", \"../../resources/shapes/love.png\", \"../../resources/shapes/love.json\");\n this.load.atlas(\"eye\", \"../../resources/shapes/eye.png\", \"../../resources/shapes/eye.json\");\n this.load.atlas(\"ghost\", \"../../resources/shapes/ghost.png\", \"../../resources/shapes/ghost.json\");\n this.load.json(\"shapes_physics\", \"../../resources/json/shapes.json\");\n\n // tilesprite elements\n this.load.image(\"lava\", \"../../resources/lava.png\");\n this.load.image(\"spring\", \"../../resources/spring.png\");\n\n // shooting elements\n this.load.image(\"heart\", \"../../resources/heart.png\");\n this.load.image(\"pacman\", \"../../resources/pacman.png\");\n\n // level info\n this.load.json(\"level_info\", \"../../resources/json/levels.json\");\n }", "playMusic() {// Load the sound and play it automatically once ready\n // Adding a Continous Sound (we can play it only once with setInterval(() => sound.play(), 3000);)\n this.music = new BABYLON.Sound(\"sound\", \"https://mainline.i3s.unice.fr/mooc/SkywardBound/assets/sounds/humbug.mp3\", \n this.scene,null, { loop: true, autoplay: true });\n \n }", "function preload(){\n\tgame.load.image('background' , 'assets/yo.jpg');\n\tgame.load.image('player' , 'assets/umbreon.png');\n\tgame.load.image('ground' , 'assets/wallHorizontal.png');\n\tgame.load.image('obstacle' , 'assets/wallVertical.png');\n\tgame.stage.backgroundColor=\"#000099\";\n\n\n\n\tgame.load.audio('backgroundMusic', 'assets/necy.mp3');\n}", "function loadFriendBase(base){\n var bg = game.add.sprite(game.world.centerX/2 - 150, game.world.centerY + game.world.centerY/2 + 25, base.background);\n bg.anchor.setTo(.5, .5);\n bg.crop(new Phaser.Rectangle(0, 0, 800, 600));\n bg.scale.setTo(.75, .75);\n for(var i = 0; i < base.list.length; ++i){\n var temp = game.add.sprite((base.list[i].position.x-130)/2 - 150, (base.list[i].position.y + 110)/2 + game.world.centerY, base.list[i].image);\n temp.anchor.setTo(0.5, 0.5);\n temp.scale.setTo(0.5, 0.5);\n }\n \n game.physics.enable(bg, Phaser.Physics.ARCADE);\n bg.body.immovable = true;\n \n \n \n friendBaseTarget = Unit(null, game);\n friendBaseTarget.setUnitSprite(bg);\n friendBaseTarget.setAsBase();\n var txt = game.add.text(50, 10, \"\");\n txt.alpha = 0;\n friendBaseTarget.setText(txt);\n player.getUnitPGroup().push(friendBaseTarget);\n }", "function playBackgroundMusic() {\n backgroundMusic.play();\n}", "function preload() {\n for (var x = 0; x < lato; x++) {\n cards[x] = []\n for (var y = 0; y < altezza; y++) {\n cards[x][y] = new Card((x * 350) + 180, (y * 350) + 130, x + '' + y + '.mp3', x + '' + y + '.png')\n }\n }\n}", "function loadSprites() {\n Loader.add(\"assets/imgs/resize1.png\")\n .add(\"assets/imgs/resize2.png\")\n .add(\"assets/imgs/colorize.png\")\n .add(\"assets/imgs/rotate.png\")\n .add(\"assets/imgs/select.png\")\n .add(\"assets/imgs/win.png\")\n .add(\"assets/imgs/logo.png\")\n .add(\"assets/imgs/logo2.png\")\n .add(\"assets/imgs/introFinal.png\")\n .add(\"assets/imgs/btPlay.png\")\n .add(\"assets/imgs/btAgain.png\")\n .load(setup);\n}", "function preload() {\r\n\r\n //create an animation from a sequence of numbered images\r\n //pass the first and the last file name and it will try to find the ones in between\r\n snake = loadAnimation('assets/snake_1.png', 'assets/snake_2.png', 'assets/snake_3.png');\r\n snake.looping = false;\r\n moon = loadAnimation('assets/moon_1.png', 'assets/moon_2.png', 'assets/moon_3.png', 'assets/moon_4.png', 'assets/moon_5.png', 'assets/moon_4.png', 'assets/moon_3.png', 'assets/moon_2.png', 'assets/moon_1.png');\r\n\r\n\r\n}", "function play() {\n //unmute\n loops.forEach(x => (x.mute = false));\n\n if (pickedGlyphs[0] && idList[0] == myId) {\n loops[0] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(0), 2);\n }, \"4m\").start();\n }\n\n if (pickedGlyphs[1] && idList[1] == myId) {\n loops[1] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(1), 2);\n }, \"4m\").start();\n }\n if (pickedGlyphs[2] && idList[2] == myId) {\n loops[2] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(2), 1);\n synth.triggerAttackRelease(Nexus.note(3), 1, \"+2m\");\n }, \"5m\").start();\n }\n if (pickedGlyphs[3] && idList[3] == myId) {\n loops[3] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(3), 1);\n synth.triggerAttackRelease(Nexus.note(1), 1, \"+1m\");\n }, \"4m\").start();\n }\n if (pickedGlyphs[4] && idList[4] == myId) {\n loops[4] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(4), 1);\n synth.triggerAttackRelease(Nexus.note(0), 1, \"+1m\");\n }, \"5m\").start();\n }\n if (pickedGlyphs[5] && idList[5] == myId) {\n loops[5] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(5), 1);\n synth.triggerAttackRelease(Nexus.note(1), 1, \"+1m\");\n synth.triggerAttackRelease(Nexus.note(3), 1, \"+2m\");\n }, \"4m\").start();\n }\n if (pickedGlyphs[6] && idList[6] == myId) {\n loops[6] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(6), 1);\n synth.triggerAttackRelease(Nexus.note(1), 1, \"+1m\");\n synth.triggerAttackRelease(Nexus.note(2), 1, \"+2m\");\n }, \"5m\").start();\n }\n if (pickedGlyphs[7] && idList[7] == myId) {\n loops[7] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(7), 1);\n synth.triggerAttackRelease(Nexus.note(5), 1, \"+4n\");\n synth.triggerAttackRelease(Nexus.note(3), 1, \"+8n\");\n }, \"4m\").start();\n }\n if (pickedGlyphs[8] && idList[8] == myId) {\n loops[8] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(8), 1);\n synth.triggerAttackRelease(Nexus.note(7), 1, \"+1m\");\n synth.triggerAttackRelease(Nexus.note(6), 1, \"+2n\");\n }, \"5m\").start();\n }\n if (pickedGlyphs[9] && idList[9] == myId) {\n loops[9] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(9), 1);\n synth.triggerAttackRelease(Nexus.note(5), 1, \"+8n\");\n // synth.triggerAttackRelease(Nexus.note(2), 1, \"+2n\");\n }, \"1m\").start();\n }\n if (pickedGlyphs[10] && idList[10] == myId) {\n loops[10] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(11), 1);\n synth.triggerAttackRelease(Nexus.note(3), 1, \"+8n\");\n }, \"1m\").start();\n }\n if (pickedGlyphs[11] && idList[11] == myId) {\n loops[11] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(9), 1);\n synth.triggerAttackRelease(Nexus.note(1), 1, \"+16n\");\n }, \"2n\").start();\n }\n if (pickedGlyphs[12] && idList[12] == myId) {\n loops[12] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(2), 1);\n synth.triggerAttackRelease(Nexus.note(4), 1, \"+8n\");\n synth.triggerAttackRelease(Nexus.note(6), 1, \"+1m\");\n }, \"2m\").start();\n }\n if (pickedGlyphs[13] && idList[13] == myId) {\n loops[13] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(7), 1);\n synth.triggerAttackRelease(Nexus.note(4), 1, \"+8n\");\n synth.triggerAttackRelease(Nexus.note(2), 1, \"+1m\");\n }, \"2m\").start();\n }\n if (pickedGlyphs[14] && idList[14] == myId) {\n loops[14] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(8), 1);\n synth.triggerAttackRelease(Nexus.note(5), 1, \"+8n\");\n synth.triggerAttackRelease(Nexus.note(1), 1, \"+1m\");\n }, \"3m\").start();\n }\n if (pickedGlyphs[15] && idList[15] == myId) {\n loops[15] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(8), 1);\n synth.triggerAttackRelease(Nexus.note(5), 1, \"+1m\");\n synth.triggerAttackRelease(Nexus.note(1), 1, \"+2m\");\n }, \"2m\").start();\n }\n if (pickedGlyphs[16] && idList[16] == myId) {\n loops[16] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(6), 1);\n synth.triggerAttackRelease(Nexus.note(4), 1, \"+8n\");\n synth.triggerAttackRelease(Nexus.note(2), 1, \"+4n.\");\n }, \"4m\").start();\n }\n if (pickedGlyphs[17] && idList[17] == myId) {\n loops[17] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(6), 1);\n synth.triggerAttackRelease(Nexus.note(2), 1, \"+4n.\");\n synth.triggerAttackRelease(Nexus.note(4), 1, \"+8n\");\n }, \"1m.\").start();\n }\n if (pickedGlyphs[18] && idList[18] == myId) {\n loops[18] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(11), 1);\n synth.triggerAttackRelease(Nexus.note(3), 1, \"+8n.\");\n }, \"2m\").start();\n }\n if (pickedGlyphs[18] && idList[18] == myId) {\n loops[18] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(11), 1);\n synth.triggerAttackRelease(Nexus.note(3), 1, \"+8n.\");\n }, \"3m\").start();\n }\n if (pickedGlyphs[19] && idList[19] == myId) {\n loops[19] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(10), 1);\n synth.triggerAttackRelease(Nexus.note(2), 1, \"+8n\");\n }, \"4m\").start();\n }\n if (pickedGlyphs[20] && idList[20] == myId) {\n loops[20] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(10), 1);\n synth.triggerAttackRelease(Nexus.note(3), 1, \"+8n\");\n }, \"5m\").start();\n }\n if (pickedGlyphs[21] && idList[21] == myId) {\n loops[21] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(9), 1);\n synth.triggerAttackRelease(Nexus.note(4), 1, \"+8n\");\n }, \"6m\").start();\n }\n if (pickedGlyphs[22] && idList[22] == myId) {\n loops[22] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(5), 1);\n }, \"1m\").start();\n }\n if (pickedGlyphs[23] && idList[23] == myId) {\n loops[23] = new Tone.Loop(time => {\n synth.triggerAttackRelease(Nexus.note(11), 1);\n }, \"1m\").start();\n }\n}" ]
[ "0.6595777", "0.6150873", "0.59576416", "0.59306365", "0.5915868", "0.5881308", "0.58765936", "0.58548594", "0.5812746", "0.5780421", "0.5751419", "0.57379997", "0.5732832", "0.570023", "0.5683659", "0.56786245", "0.5662781", "0.5658697", "0.56582654", "0.5647283", "0.5644443", "0.5629898", "0.5611737", "0.5599521", "0.55929434", "0.556096", "0.5539132", "0.553361", "0.5531128", "0.5528504", "0.5526815", "0.5521701", "0.5521546", "0.55080265", "0.55009407", "0.54967535", "0.5475623", "0.5471167", "0.54688436", "0.5462548", "0.5458264", "0.5447116", "0.5441152", "0.5430504", "0.54220635", "0.54194945", "0.5402975", "0.53892356", "0.53888786", "0.5384185", "0.5380034", "0.53779227", "0.53693724", "0.53687435", "0.5358376", "0.5353201", "0.5352726", "0.5340514", "0.53394735", "0.5339352", "0.5337965", "0.5333995", "0.53335756", "0.5324448", "0.5319005", "0.53167886", "0.53129494", "0.5312681", "0.5310492", "0.53102666", "0.53026927", "0.5302152", "0.53009945", "0.52848953", "0.5284798", "0.52838075", "0.5275643", "0.5273803", "0.52656597", "0.52647394", "0.52642053", "0.5261651", "0.5261295", "0.52580076", "0.52572376", "0.5252208", "0.52507496", "0.5250716", "0.524861", "0.52474606", "0.5243452", "0.52305573", "0.5229795", "0.52292675", "0.52264625", "0.5220799", "0.5216967", "0.5216272", "0.5209162", "0.5206439" ]
0.79835737
0
The sequentialSearch function has a complexity of O(n), n being the size of the array (input). o(n)
function createNonSortedArray(size){ var array = []; for (var i = size; i> 0; i--){ array[i] = i; } return array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function linear_search(arr, n){\n for(var elem of arr){\n if(elem === n){\n return arr.indexOf(elem);\n }\n }\n}", "function seqSearchM(arr,data){\n var max =0;\n for (var i=0;i<arr.length;i++){\n\n if (arr[i]==data&&i>(arr.length*0.2)){\n return i;\n }\n }\n return -1;\n}", "function searchNaive(arr, n){ // O(n) Linear Search\r\n for(let i = 0; i < arr.length; i++){\r\n if(arr[i] === n){\r\n return i;\r\n } \r\n }\r\n return -1;\r\n}", "function sequntialSearch(array, item) {\n var length = array.length\n var cost = 0;\n \n for(var i =0; i < array.length; i++) {\n cost++;\n if(array[i] === item) {\n return i;\n }\n }\n console.log('Cost for sequntialSearch of size : ' + length +' ,is : ' +cost)\n return -1;\n}", "function linearSearch(arr,target){ \n for(var i =0 ; i < arr.length; i++){\n if(arr[i] === target){\n return i;\n }\n }\n return -1;\n}", "function linearSearch(arr, val){\n// loop through the array and check if the\n for(let i = 0; i < arr.length; i++){\n // current array element is equal to the value\n if(arr[i] === val)return i;//if it is, return the index at which the element is found\n }\n return -1;// if the value is never found, return -1\n \n }", "function linearSearch(arr, value) {\n for (let i = 0; i < arr.length; i++) {\n if(arr[i] === value) {\n return i;\n }\n }\n return null; \n}", "function naiveSearch(array, item) {\n for (let i = 0; i < array.length; i++) {\n //O(n)\n if (array[i] === item) {\n //constant time O(1)\n return i;\n }\n }\n}", "function linearSearch(arr, val){\n for(let i=0; i<arr.length; i++){\n if(arr[i] === val){\n return i;\n }\n return -1;\n }\n console.log('Hello World!')\n}", "function linearSearch(arr, value) {\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] == value) {\n return i;\n }\n }\n return -1;\n}", "function linearSearch(arr, val){\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] === val) {\n return i;\n }\n }\n return -1;\n}", "function linearSearch(arr, val) {\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] === val) return i\n }\n return -1\n}", "function naiveSearch(array, item) {\n for (let i = 0; i < array.length; i++) { // --> O(n) linear\n if (array[i] === item) { // --> 0(n) linear\n return i; //--> constant\n }\n }\n}", "function linearSearch(anArray, item) {\n for (let i = 0; i < anArray.length; i++) {\n if (item == anArray[i]) {\n return i;\n }\n }\n\n return -1;\n}", "function efficientSearch(array, item) {\n\n let minIndex = 0;\n let maxIndex = array.length - 1;\n let currentIndex;\n let currentElement;\n\n while (minIndex <= maxIndex) {\n currentIndex = Math.floor((minIndex + maxIndex) / 2);\n currentElement = array[currentIndex];\n\n if (currentElement < item) {\n minIndex = currentIndex + 1;\n }\n else if (currentElement > item) {\n maxIndex = currentIndex - 1;\n }\n else {\n return currentIndex;\n }\n }\n return -1;\n}", "function efficientSearch(array, item) {\n let minIndex = 0;\n let maxIndex = array.length - 1;\n let currentIndex;\n let currentElement;\n\n while (minIndex <= maxIndex) {\n currentIndex = Math.floor((minIndex + maxIndex) / 2);\n currentElement = array[currentIndex];\n\n if (currentElement < item) {\n minIndex = currentIndex + 1;\n }\n else if (currentElement > item) {\n maxIndex = currentIndex - 1;\n }\n else {\n return currentIndex;\n }\n }\n return -1;\n}", "function linearSearch(array, value) {\n for (let i = 0; i < array.length; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function linearSearch(arr, val) {\n\n ////// doesn't work because return statement returns \n ////// the inner anonymous callback function to forEach not linearSearch itself!\n // arr.forEach((element, index) => {\n // console.log(element, index, element === val);\n // if (element === val) {\n // console.log('found it!');\n // return index;\n // }\n // });\n\n for (let i = 0; i < arr.length; i++) {\n let element = arr[i];\n if (element === val) {\n return i;\n }\n }\n\n return -1;\n}", "function bSearch(arr, val) {\n let start = 0;\n let end = arr.length - 1;\n\n while (start < end) {\n const mid = Math.floor((end - start) / 2) + start;\n if (arr[mid] === val) {\n return mid;\n }\n if (arr[mid] < val) {\n start = mid + 1;\n } else {\n end = mid - 1;\n }\n }\n\n return start;\n}", "function efficientSearch(array, item) {\n let minIndex = 0;\n let maxIndex = array.length - 1;\n let currentIndex;\n let currentElement;\n\n while (minIndex <= maxIndex) {\n currentIndex = Math.floor((minIndex + maxIndex) / 2);\n currentElement = array[currentIndex];\n\n if (currentElement < item) {\n minIndex = currentIndex + 1;\n } else if (currentElement > item) {\n maxIndex = currentIndex - 1;\n } else {\n return currentIndex;\n }\n }\n return -1;\n}", "function efficientSearch(array, item) {\n let minIndex = 0;\n let maxIndex = array.length - 1;\n let currentIndex;\n let currentElement;\n\n while (minIndex <= maxIndex) {\n currentIndex = Math.floor((minIndex + maxIndex) / 2);\n currentElement = array[currentIndex];\n\n if (currentElement < item) {\n minIndex = currentIndex + 1;\n }\n else if (currentElement > item) {\n maxIndex = currentIndex - 1;\n }\n else {\n return currentIndex;\n }\n }\n return -1;\n}", "function efficientSearch(array, item) {\n let minIndex = 0;\n let maxIndex = array.length - 1;\n let currentIndex;\n let currentElement;\n\n while (minIndex <= maxIndex) {\n currentIndex = Math.floor((minIndex + maxIndex) / 2);\n currentElement = array[currentIndex];\n\n if (currentElement < item) {\n minIndex = currentIndex + 1;\n }\n else if (currentElement > item) {\n maxIndex = currentIndex - 1;\n }\n else {\n return currentIndex;\n }\n }\n return -1;\n}", "function efficientSearch(array, item) {\n let minIndex = 0;\n let maxIndex = array.length - 1;\n let currentIndex;\n let currentElement;\n\n while (minIndex <= maxIndex) {\n currentIndex = Math.floor((minIndex + maxIndex) / 2);\n currentElement = array[currentIndex];\n\n if (currentElement < item) {\n minIndex = currentIndex + 1;\n }\n else if (currentElement > item) {\n maxIndex = currentIndex - 1;\n }\n else {\n return currentIndex;\n }\n }\n return -1;\n }", "function doBetterLinearSearch(array, arraySize, searchedElement) {\n var defaultAnswer = \"NOT_FOUND\";\n for (var i = 0; i < arraySize; i++) {\n array[i] = Math.floor((Math.random() * 100) + 1); /* 10 random numbers from 1 to 100*/\n console.log(array[i]);\n if (array[i] === searchedElement) break;\n }\n i < arraySize ? console.log(\"Index of searched element is \" + (i+1)) : console.log(\"Index of searched element is \" + defaultAnswer);\n}", "function efficientSearch(array, item) {\n let minIndex = 0; \t\t\t\t\t\t//--> constant\n let maxIndex = array.length - 1;\t//--> constant\n let currentIndex;\t\t\t\t\t\t\t\t\t//--> constant\n let currentElement;\t\t\t\t\t\t\t\t//--> constant\n\n while (minIndex <= maxIndex) {\t\t//--> logarithmic O(log(n))\n currentIndex = Math.floor((minIndex + maxIndex) / 2);\n currentElement = array[currentIndex];\n\n if (currentElement < item) {\n minIndex = currentIndex + 1;\n }\n else if (currentElement > item) {\n maxIndex = currentIndex - 1;\n }\n else {\n return currentIndex;\t\t\t\t\t//--> constant\n }\n }\n return -1;\t\t\t\t\t\t\t\t\t\t\t\t//--> constant\n}", "function linearSearchIndexOf(arr, val) {\n for (let i = 0; i < arr.length; i++) {\n if (val === arr[i]) return i;\n }\n return -1;\n}", "function search(arr, v) {\n// decide which half is the number located in\n let pos = Math.ceil(arr.length / 2);\n let finalPos = pos;\n\n \n while(arr.length > 1) {\n if (arr[pos] === v) return finalPos;\n console.log(pos)\n if (arr[pos] <= v ) {\n arr = arr.slice(pos) \n pos = Math.ceil(arr.length / 2);\n finalPos = pos + finalPos\n } else {\n arr = arr.slice(0, pos)\n pos = Math.ceil(arr.length / 2);\n finalPos = finalPos - pos\n \n \n }\n\n }\n return -1;\n}", "function linearSearch(arr, val) {\n // Loop through the array and check if the current array element is equal to the value\n for (let i = 0; i < arr.length; i++) {\n // If it is, return the index at which the element is found\n if (arr[i] === val) return i;\n \n }\n // if the value is never found, return -1;\n return -1;\n}", "function linearSearch(arr, num){\n for(let i = 0; i < arr.length; i++) {\n if(arr[i] === num) return i\n }\n\n return -1\n}", "function efficientSearch(array, item) {\n let minIndex = 0; //set the floor to 0\n let maxIndex = array.length - 1; //set the ceiling to the length of the array\n let currentIndex; //place to put the current index being checked\n let currentElement; //value of the current index being checked\n\n while (minIndex <= maxIndex) { //while the floor is under the ceiling\n currentIndex = Math.floor((minIndex + maxIndex) / 2); //set the current index to the middle of the array\n currentElement = array[currentIndex]; //grab the value of the middle item\n\n if (currentElement < item) { //if the current middle item still comes before the target item\n minIndex = currentIndex + 1; //increment the floor and start over\n }\n else if (currentElement > item) { //otherwise, if the current middle item comes after the target item\n maxIndex = currentIndex - 1; //decrement the ceiling and start over\n }\n else {\n return currentIndex; //otherwise, return the current middle item. we found it!\n }\n }\n return -1; //if all else fails, return -1 to indicate failure to find the specified item\n}", "function search(arr, numToSearch) {\n for (let i = 0; i < arr.length; i++) {\n // O(n)\n if (arr[i] === numToSearch) {\n return i;\n }\n }\n return -1;\n}", "function linearSearch(numbers, value) {\n for (let i = 0; i < numbers.length; i++) {\n if (numbers[i] === value) return i;\n }\n return -1;\n}", "function binarySearch(arr, value) {\n\n}", "binarySearchInteger(arr, search){\n var startIndex = 0,\n stopIndex = arr.length - 1,\n middle = Math.floor((stopIndex + startIndex) / 2);\n\n\n while (arr[middle] != search && startIndex < stopIndex) {\n\n //adjust search area\n if (search < arr[middle]) {\n stopIndex = middle - 1;\n } else if (search > arr[middle]) {\n startIndex = middle + 1;\n }\n\n //recalculate middle\n middle = Math.floor((stopIndex + startIndex) / 2);\n }\n\n //make sure it's the right value\n if(arr[middle]==search){\n return middle;\n }\n else{\n return -1;\n }\n \n }", "function binarySearchBonus(arr, val) {\r\n var start = 0;\r\n var end = arr.length-1;\r\n var counter = 0;\r\n while (start <= end && counter == 0){\r\n var pointer = Math.floor((end-start)/2)+start;\r\n if (arr[pointer]==val){\r\n counter ++;\r\n break;\r\n }\r\n else if (arr[pointer]<val){\r\n start = pointer+1;\r\n }\r\n else if (arr[pointer]>val){\r\n end = pointer-1;\r\n }\r\n }\r\n if (counter>0){\r\n var x = 1\r\n while (arr[pointer+x]==val){\r\n counter++;\r\n x++;\r\n }\r\n x = 1\r\n while (arr[pointer-x]==val){\r\n counter++;\r\n x++;\r\n }\r\n }\r\n return counter\r\n }", "search(element) {\n // Average time complexity = O(n)\n // Worst time complexity = O(n)\n // Worst space complexity = O(n)\n\n let ii = 0;\n while (ii < this._array.length) {\n if (this._array[ii] === element) {\n return ii;\n }\n ii++;\n }\n return null;\n }", "function binarySearch2(arry, n) {\n start = 0;\n end = arry.length - 1;\n middle = Math.floor(start + end / 2);\n while (arry[middle] !== n && middle < end && middle > start) {\n if (n > arry[middle]) start = middle + 1;\n else end = middle - 1;\n\n middle = Math.floor((start + end) / 2);\n }\n return arry[middle] === n ? middle : -1;\n}", "function naiveSearch(array, item) {\n for (let i=0; i<array.length; i++) {\n if (array[i] === item) {\n return i;\n }\n }\n}", "function naiveSearch(array, item) {\n for (let i=0; i<array.length; i++) {\n if (array[i] === item) {\n return i;\n }\n }\n}", "function naiveSearch(array, item) {\n for (let i=0; i<array.length; i++) {\n if (array[i] === item) {\n return i;\n }\n }\n}", "function search(x, a, cmp)\n {\n let lo = 0, hi = a.length - 1;\n while (lo <= hi) {\n let m = Math.floor((lo + hi)/2), r = cmp(x, a[m]);\n if (r < 0) hi = m - 1;\n else if (r > 0) lo = m + 1;\n else return m;\n }\n return -1;\n }", "function binarySearch(arr, val) {\n\n}", "function BinarySearch(arr, key) {\n let low = 0;\n let high = arr.length - 1;\n\n for (let i = 0; i < arr.length; i++) {\n let mid = Math.floor((low + high) / 2);\n if (key === arr[mid]) {\n console.log(`Found ${key} in ${mid}th index.`);\n console.log(`Number of iterations = ${i + 1}`);\n break;\n }\n\n else if (key > arr[mid]) {\n low = mid + 1;\n mid = Math.floor((low + high / 2));\n }\n\n else if (key < arr[mid]) {\n high = mid - 1;\n mid = Math.floor((low + high / 2));\n }\n\n if (low > high) {\n console.log(`Didn't find ${key} in the list. Process iterated for ${i + 1} times.`);\n break;\n }\n }\n}", "function naiveSearch(array, item) {\n for (let i = 0; i < array.length; i++) {\n if (array[i] === item) {\n return i;\n }\n }\n}", "function linearSearch(arr, num){\n // add whatever parameters you deem necessary - good luck!\n \n for (let i = 0; i < arr.length; i++) {\n if (arr[i] === num) {\n return i;\n }\n }\n \n return -1\n}", "function binarySearch(searchElement, array) {\n var currentElement;\n var minIndex = 0;\n var maxIndex = array.length - 1;\n while (minIndex <= maxIndex) {\n currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = array[currentIndex];\n \t\tconsole.log(\"currentIndex \" + currentIndex, \"currentElement \" + currentElement);\n if (currentElement < searchElement) {\n minIndex = currentIndex + 1;\n }\n else if (currentElement > searchElement) {\n maxIndex = currentIndex - 1;\n }\n else {\n return currentIndex;\n }\n }\n \n return -1;\n}", "function naiveSearch(array, item) {\n for (let i = 0; i < array.length; i++) {\n if (array[i] === item) {\n return i;\n }\n }\n}", "function naiveSearch(array, item) {\n for (let i = 0; i < array.length; i++) {\n if (array[i] === item) {\n return i;\n }\n }\n}", "function naiveSearch(array, item) {\n for (let i = 0; i < array.length; i++) {\n if (array[i] === item) {\n return i;\n }\n }\n}", "function binarySearch (arr, target) {\n var n = arr.length,\n l = 0, r = n - 1;\n while(l < r) {\n var middle = (l+r) / 2\n if (target === arr[middle]) {\n return middle\n } else if (middle > target) {\n r = middle + 1\n } else {\n l = middle - 1\n }\n }\n return -1\n}", "function linearSearch(arr, num) {\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tif (arr[i] === num) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}", "function indexEqualsValueSearch(arr) {\n let min = undefined \n let hi = arr.length-1\n let lo = 0\n while (hi >= lo) {\n let mid = lo + Math.floor((hi - lo)/2)\n if (arr[mid] === mid) {\n min = mid\n if (mid > 0 && arr[mid-1] !== (mid-1)) return min\n hi = mid - 1\n }\n else if (mid < arr[mid]) hi = mid - 1\n else if (mid > arr[mid]) lo = mid + 1\n }\n return (min !== undefined) ? min : -1\n}", "function linearSearch(arr, value) {\n for (let key in arr) {\n if (arr[key] === value) return key;\n }\n return -1;\n}", "function naiveSearch(array, item) {\n for (let i = 0; i < array.length; i++) {\n if (array[i] === item) {\n return i;\n }\n }\n }", "function naiveSearch(array, item) {\n for (let i = 0; i < array.length; i++) {\n if (array[i] === item) {\n return i\n }\n }\n}", "function bidirectionalSearchTest(array)\n{\n let counter = 0;\n let endArrayIndex = ARRAY_SIZE - 1;\n let currentIndex = 0;\n while (counter <= (ARRAY_SIZE / 2) - 1)\n {\n currentIndex = endArrayIndex - counter; \n if (array[currentIndex].result == true)\n return array[currentIndex].address;\n currentIndex = counter;\n if (array[currentIndex].result == true)\n return array[currentIndex].address;\n counter++;\n }\n return null;\n}", "function bsearch(arr, target) {\n /*\n let middle = Math.floor(arr.length / 2);\n let midP = arr[middle];\n\n if (arr.length === 1 && arr[0] != target) {\n return -1;\n }\n\n if (midP < target) {\n let search = bsearch(arr.slice(middle + 1), target);\n return (search === -1) ? -1 : search + middle + 1;\n\n } else if (midP === target) {\n return middle;\n\n } else if (midP > target) {\n let search2 = bsearch(arr.slice(0, middle), target);\n return (search2 === -1) ? -1 : search2;\n }\n */\n\n //\n // let middle = Math.floor(arr.length / 2);\n // let midP = arr[middle];\n //\n // if (arr.length <= 1 && arr[0] != target) {\n // return -1;\n // }\n //\n // if (midP < target) {\n // let search = bsearch(arr.slice(middle + 1), target)\n // return (search === -1) ? -1 : search + middle + 1;\n //\n // } else if (midP === target) {\n // return middle;\n //\n // } else if (midP > target) {\n // let search = bsearch(arr.slice(0, middle), target);\n // return (search === -1) ? -1 : search;\n // }\n\n //\n // let middle = Math.floor(arr.length / 2)\n // let midP = arr[middle];\n //\n // if (arr.length <= 1 && arr[0] !== target) {\n // return -1\n // }\n //\n // if (midP < target) {\n // let search = bsearch(arr.slice(middle + 1), target);\n // return (search === -1) ? -1 : search + middle + 1;\n // } else if (midP === target) {\n // return middle;\n // } else if (midP > target) {\n // let search = bsearch(arr.slice(0, middle), target);\n // return (search === -1) ? -1 : search;\n // }\n}", "function linearSearch(arr, num) {\n // add whatever parameters you deem necessary - good luck!\n let indexOfItem = -1;\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] === num) indexOfItem = i;\n }\n return indexOfItem;\n}", "function linearSearch(array, searchText)\n{\n var result = [];\n for (var i = 0; i < array.length; i++) {\n if (array[i] == searchText) {\n result.push(i);\n }\n }\n return result;\n}", "function binarySearch(list, toFind) {\n let lowIdx = 0;\n let highIdx = list.length;\n let middleIdx,\n guess,\n counter = 0; // counter for demostration\n\n while (lowIdx <= highIdx) {\n counter++;\n middleIdx = Math.floor(highIdx + lowIdx) / 2;\n guess = list[middleIdx];\n if (guess === toFind) break;\n else if (guess > toFind) highIdx = middleIdx -1;\n else lowIdx = middleIdx; // guess > itemToFind\n }\n console.log('iterations: ',counter);\n if (guess === toFind) return middleIdx; // return the index if found\n return -1;\n}", "function binarySearch(arr, target) {\n let startIdx = 0,\n endIdx = arr.length - 1;\n\n while (startIdx < endIdx) {\n let midIdx = Math.floor((startIdx + endIdx) / 2);\n if (target === arr[midIdx]) {\n return midIdx;\n } else if (target > arr[midIdx]) {\n startIdx = midIdx;\n } else {\n endIdx = midIdx;\n }\n }\n return -1;\n}", "function BinarySearch(array, search) {\n\tlet arrayToSearch = array;\n\n\t// High and Low are the bondaries of search within the array\n\tlet low = 0;\n\tlet high = array.length;\n\n\tlet found = false;\n\t// Turing the searchInput to all lowercase so capped letters aren't a factor\n\tlet itemToFind = search.toLowerCase();\n\n\twhile (high >= low && found === false) {\n\t\t// Set middle to the middle int value between high and low\n\t\tlet middle = parseInt((low + high) / 2);\n\n\t\t// If the middle value equals the array's length, exit the function\n\t\tif (middle === arrayToSearch.length) {\n\t\t\tbreak;\n\t\t}\n\n\t\t// If the itemToFind is equal to the middle index element...\n\t\tif (FoundItem(arrayToSearch, middle, itemToFind)) {\n\t\t\t// Then...\n\t\t\t// Set if we found the item to true\n\t\t\tfound = true;\n\t\t\t// Exit the while loop\n\t\t\tbreak;\n\t\t}\n\n\t\t// If the itemToFind is alphabetically lower than the middle...\n\t\tif (itemToFind < (arrayToSearch[middle][1][0]).toLowerCase()) {\n\t\t\t// Then...\n\t\t\t// Set the high value to the middle\n\t\t\thigh = middle - 1;\n\t\t} else {\n\t\t\t// Otherwise...\n\t\t\t// Set the low value to the middle\n\t\t\tlow = middle + 1;\n\t\t}\n\t}\n}", "function bsearch(arr, target) {\n if (arr.length < 1){\n return -1;\n }\n let middle = Math.floor(arr.length/2);\n\n if (arr[middle] === target){\n return middle;\n } else if (arr[middle] > target){\n let left = arr.slice(0, middle);\n return bsearch(left, target);\n } else {\n let right = arr.slice(middle+1);\n if (bsearch(right, target) !== -1) return bsearch(right, target)+middle+1;\n return bsearch(right, target);\n }\n\n}", "function binarySearch( list, target ) {\n\n}", "function binarySearch(ar, el, compare_fn) {\n var m = 0;\n var n = ar.length - 1;\n while (m <= n) {\n var k = (n + m) >> 1;\n var cmp = compare_fn(el, ar[k]);\n if (cmp > 0) {\n m = k + 1;\n } else if(cmp < 0) {\n n = k - 1;\n } else {\n return k;\n }\n }\n return -m - 1;\n}", "function binarySearch(arr, value){\n\n let start = 0;\n let end = arr.length;\n\n while(start < end){\n // console.log(`Looping: s=${start} & e=${end}`);\n\n const midpoint = Math.floor((start + end) / 2);\n if(arr[midpoint] === value) return true;\n\n if(arr[midpoint] < value){\n start = midpoint + 1;\n }\n else if(arr[midpoint] > value){\n end = midpoint - 1;\n }\n\n }\n \n return arr[start] === value;\n}", "function search (nums, n) {\n // Set start and end point for the search range\n let start = 0\n let end = nums.length - 1\n\n // Finish the search and return the index, if the number (n) is smaller than smallest value in the array, or\n // larger than largest value in the array.\n if (nums[0] > n) {\n return 0\n } else if (nums[end] < n) {\n return end + 1\n }\n\n while (start <= end) {\n // Index (ind) is set to the mid point the search range.\n const ind = Math.floor((start + end) / 2)\n\n // If number is between two values in the array, returns the index where it should be in the array.\n if (nums[ind + 1] > n && nums[ind] < n && nums[ind] !== n) {\n return ind + 1\n\n // Check if number (n) is larger or smaller than the value in array index (ind) and set the new start/end\n // point of the search range accordingly.\n } else if (nums[ind] < n) {\n start = ind + 1\n } else if (nums[ind] > n) {\n end = ind - 1\n\n // Returns index (ind) of the number (n)\n } else {\n return ind\n }\n }\n return ('search failed')\n}", "function search(arr, val) {\n let left = 0;\n let right = arr.length - 1;\n\n while (left <= right) {\n const mid = Math.floor((left + right) / 2);\n if (arr[mid] === val) {\n return mid;\n } else if (arr[mid] < val) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n\n return -1;\n}", "function binarySearch(arr, target) {\n\n\tarr = arr.sort(); // sort arr so its always ascending order\n\t// O(n logn)\n\n\tlet start = 0,\n\t\tend = arr.length - 1; \n\n\twhile(start <= end) {\n\n\t\tlet mid = Math.floor(start + (end-start) / 2); \n\n\t\tif(target === arr[mid]) {\n\t\t\treturn mid;\n\t\t}\n\n\t\tif(target < arr[mid]) {\n\t\t\tend = mid - 1; // update ceiling if key is left half\n\t\t} else if (target > arr[mid]) {\n\t\t\tstar = mid + 1; // update floor if key is right half\n\t\t}\n\t}\n\n\treturn -1 // we dont have the ele\n}", "function search(arr, val) {\n for(let i = 0; i < arr.length; i++) {\n if(arr[i] === val) {\n return i;\n } \n }\n return -1;\n}", "function binarySearch(arr, num){\n //assume sorted array with postive integers and no repeating numbers\n // newArr = arr.slice(0,num+1)\n var newArr = arr.slice();\n let index = 0;\n\n\n if(newArr[0] === num) return 0;\n\n function helper(a){\n let arrHalf = Math.floor(a.length/2)\n\n if(a.length ===1 ){\n index = -1;\n return;\n }\n\n if(a[arrHalf] === num){\n index += arrHalf;\n return;\n }\n if(a[arrHalf+1] === num){\n index += arrHalf+1;\n return;\n }\n if(a[arrHalf] > num){\n a = a.slice(0, arrHalf);\n }\n\n if(a[arrHalf] < num){\n index += arrHalf;\n a = a.slice(arrHalf);\n }\n\n helper(a)\n }\n helper(newArr)\n return index\n}", "function binarySearch(arr,val) {\n let start = 0\n let end = arr.length-1\n let mid = Math.floor((start+end)/2)\n\n while (arr[mid] !== val && start <= end) {\n\n if (arr[mid] < val) {\n start = mid + 1\n } else {\n end = mid - 1\n }\n mid = Math.floor((start+end)/2)\n }\n if (arr[mid] === val) {\n return mid\n }\n return -1\n}", "function bSearch(arr, target) {\n if (arr.length === 1) {\n if (arr[0] === target) {\n return target;\n } else {\n return null;\n }\n } else if (arr.length === 0) {\n return null;\n } else {\n let midpoint = Math.floor(arr.length / 2);\n if (arr[midpoint] === target) {\n return target;\n } else if (arr[midpoint] < target) {\n return bSearch(arr.slice(midpoint + 1, arr.length), target);\n } else {\n return bSearch(arr.slice(0, midpoint - 1), target);\n }\n }\n\n}", "function search(arr, val){ \n let min=0;\n let max=arr.length-1;\n\n while(min <= max){\n let middle = Math.floor((min+max) /2);\n let currentElement = arr[middle];\n\n if (currentElement < val){\n min = middle+1;\n } else if (currentElement > val){\n max=middle-1;\n } else {\n return middle;\n }\n return -1;\n }\n\n}", "function binarySearch(arr, value, start=0, end=arr.length) {\n console.log(`${start}, ${end}`);\n if(start > end ) return null; \n \n let index = Math.floor((start + end) /2); \n\n if(arr[index] === value) {\n return index; \n }\n if(arr[index] > value) {\n return binarySearch(arr, value, start, index - 1); \n }\n if(arr[index] < value) {\n return binarySearch(arr, value, index + 1, end);\n }\n}", "function binarySearch(array, value, start, end) {\n start = start === undefined ? 0 : start;\n end = end === undefined ? array.length : end;\n\n if (start > end) {\n return -1;\n }\n\n const index = Math.floor((start + end) / 2);\n const item = array[index];\n\n\n if (item === value) {\n return index;\n }\n else if (item < value) {\n return binarySearch(array, value, index + 1, end);\n }\n else if (item > value) {\n return binarySearch(array, value, start, index - 1);\n }\n}", "function bsearch(arr, target) {\n if (arr.length === 0) { return -1; }\n\n let midIdx = Math.floor(arr.length / 2);\n\n if (arr[midIdx] === target) {\n return midIdx;\n } else if (arr[midIdx] > target) {\n return bsearch(arr.slice(0, midIdx), target);\n } else {\n let result = bsearch(arr.slice(midIdx + 1), target);\n if (result === -1) {\n return -1;\n } else {\n return midIdx + 1 + result;\n }\n }\n}", "function binarySearch(\n array = [3, 5, 6, 8, 11, 12, 14, 15, 17, 18],\n value = 16,\n start,\n end\n) {\n var start = start === undefined ? 0 : start;\n var end = end === undefined ? array.length : end;\n\n if (start > end) {\n return -1;\n }\n\n const index = Math.floor((start + end) / 2);\n const item = array[index];\n\n console.log(start, end);\n if (item == value) {\n return index;\n } else if (item < value) {\n return binarySearch(array, value, index + 1, end);\n } else if (item > value) {\n return binarySearch(array, value, start, index - 1);\n }\n}", "function binarySearch(arr, target, i, j) {\n let s = i, e = j;\n while (s <= e) {\n const mid = Math.floor((s + e) / 2);\n if (arr[mid] === target) return mid;\n else if (arr[mid] < target) s = mid + 1;\n else e = mid - 1;\n }\n return -1;\n}", "function searchInSortedMatrix(matrix, target) {\n // Write your code here.\n\tfor(let i= 0; i < matrix.length; i++) {\n\t\tconst row = matrix[i];\n\t\tif(target >= row[0] && target <= row[row.length - 1]) {\n\t\t\tif(binarySearch(row,target) !== -1) return [i, binarySearch(row, target)]; \n\t\t}\n\t}\n\treturn [-1, -1];\n function binarySearch(array, target) {\n let left = 0;\n let right = array.length - 1; \n while(left <= right) {\n const mid = Math.floor((left + right)/2); \n if(target === array[mid]) return mid;\n else if(target < array[mid]) {\n right = mid - 1;\n } else {\n left = mid + 1;\n }\n }\n return -1; \n } \n}", "function binarySearch(array, target) {\n\tvar mid = Math.floor((array.length - 1) / 2);\n\tvar start = 0;\n\tvar end = array.length - 1;\n\twhile (start <= end) {\n\t\tif (array[mid] === target) {\n\t\t\treturn mid;\n\t\t} if (array[mid] < target) {\n\t\t\tstart = mid + 1;\n\t\t} else {\n\t\t\tend = mid - 1;\n\t\t}\n\t\tmid = Math.floor((start + end) / 2);\n\t}\n\treturn -1;\n}", "function search(arr, val) {\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] === val) {\n return i;\n }\n }\n return -1\n}", "function binarySearchPosition(arr, target){\r\n let start = 0, end = arr.length-1;\r\n let ans = -1;\r\n \r\n while(start <= end){\r\n let mid = Math.floor((start + end)/2);\r\n \r\n if(arr[mid] <= target){\r\n start = mid + 1;\r\n }else{\r\n ans = mid;\r\n end = mid - 1;\r\n }\r\n }\r\n \r\n return ans;\r\n}", "function search2(arr, val) {\n //if (arr.length === 0) return -1;\n\n let min = 0;\n let max = arr.length - 1;\n\n while (min <= max) {\n let middle = Math.floor((min + max) / 2);\n if (arr[middle] < val) {\n min = middle + 1;\n } else if (arr[middle] > val) {\n max = middle - 1;\n } else {\n // arr[mid] === val\n return middle;\n }\n }\n\n return -1;\n}", "function binarySearch(arr, item, start, end) {\n //IF ARRAY IS EMPTY, INSERT ITEM AT INDEX ZERO\n if(arr.length == 0) {\n return 0;\n }\n //IF NEW ITEM IS SMALLLER THAN ALL EXIXTING ELEMENTS THEN INSERT AT INDEX ZERO\n if (item <= arr[start]) { \n return start; \n }\n //IF NEW ITEM IS GREATER THAN ALL EXIXTING ELEMENTS THEN INSERT AT INDEX LAST\n if (arr[end] < item) { \n return end + 1;\n }\n //IF THERE IS ONLY TWO ELEMENT IN ARRAY\n if(end - start == 1){\n return end;\n }\n \n var index = start + Math.floor((end - start + 1) / 2);\n //BINARY SEARCH FOR INDEX AT LEFT SIDE\n if (item <= arr[index]) {\n return binarySearch(arr, item, start, index);\n }\n //BINARY SEARCH FOR INDEX AT RIGHT SIDE\n if (arr[index] < item) {\n return binarySearch(arr, item, index, end);\n }\n}", "function search(array, val) {\n let min = 0;\n let max = array.length - 0;\n while (min <= max){\n let middle = Math.floor((min+max)/2);\n if ( array[middle] < val ) {\n min = middle + 1;\n } else if ( array[middle] > val) {\n max = middle -1;\n } else { return middle }\n }\n return -1\n}", "function search (arr, val) {\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] === value) {\n return i\n }\n }\n return -1;\n}", "function binarySearch(arr, val) {\n if(arr.length == 0){\n return -1\n } else if(arr[arr.length - 1] == val){\n return arr.length - 1;\n }\n return 0 + findIndex(arr.slice(0, arr.length - 1), val);\n}", "function binarySearch (array, value) {\n var start = 0;\n var end = array.length - 1;\n var middle;\n\n while (start <= end) {\n middle = Math.floor((start + end) / 2);\n\n if (array[middle] === value) {\n return middle;\n }\n if (value < array[middle]) {\n end = middle - 1;\n } else {\n start = middle + 1;\n }\n }\n return -1;\n}", "function search(arr, val) {\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] === val) {\n return i\n }\n }\n return -1\n}", "search (input) {\n\t\tlet head = this.head;\n\t\tfor (let i = 0; i < this.length; i++) {\n\t\t\tif (head.data === input) {\n\t\t\t\treturn i;\n\t\t\t} else {\n\t\t\t\thead = head.next;\n\t\t\t}\n\t\t}\n\t\tthrow new Error('Value not found');\n\t}", "function solution(A) {\n // Sort the array, so that test element can be found with linear search\n A.sort(function(a, b) { return a - b; });\n\n // Increment the test element. Return it when not in the array.\n let next = 1; // minimum positive integer\n let i = 0;\n while (next === A[i]) {\n next++;\n i++;\n }\n\n return next;\n}", "function efficientSerach(array, item) {\n let minIndex = 0;\n let maxIndex = array.length - 1;\n let currentIndex;\n let currentElement;\n\n while (minIndex <= maxIndex) {\n currentIndex = Math.floor((minIndex + maxIndex) / 2);\n currentElement = array[currentIndex];\n\n if (currentElement < item) {\n minIndex = currentIndex + 1;\n }\n else if (currentElement > item) {\n maxIndex = currentIndex - 1;\n }\n else {\n return currentIndex;\n }\n }\n return -1;\n}", "function binarySearch(arr, target) {\n if (!arr.length) {\n return NaN;\n }\n let midIdx = Math.floor(arr.length/2);\n let midItem = arr[midIdx];\n if (midItem === target) {\n return midIdx;\n } else if (midItem > target) {\n return (binarySearch(arr.slice(0, midIdx), target));\n } else {\n return (binarySearch(arr.slice(midIdx + 1), target) + 1 + midIdx);\n }\n}", "function binarySearch(sortedNums, searchNum) {}", "function binarySearch(array, pred) {\n var lo = -1,\n hi = array.length;\n while (1 + lo < hi) {\n var mi = lo + ((hi - lo) >> 1);\n if (pred(array[mi], array, mi)) {\n hi = mi;\n } else {\n lo = mi;\n }\n }\n return hi;\n}", "function binarySearch(array, pred) {\r\n let lo = -1,\r\n hi = array.length;\r\n while (1 + lo < hi) {\r\n const mi = lo + ((hi - lo) >> 1);\r\n if (pred(array[mi])) {\r\n hi = mi;\r\n } else {\r\n lo = mi;\r\n }\r\n }\r\n return hi;\r\n}", "search (val) {\n let i = 0;\n while (this.bst[i]) {\n if (this.bst[i] === val) break;\n if (this.bst[i] < val) i = 2 * i + 2;\n else i = 2 * i + 1;\n }\n return !this.bst[i] ? -1 : i;\n }", "function binarySearch(arr, k) {\n //assumption that arr is ordered & comprised of numbers\n // k is desired number\n // returns index of k or -1 if there is no match\n\n var low = 0;\n var high = arr.length-1;\n var mid = Math.floor((high + low)/2);\n\n while(low !== mid ){\n if(arr[mid] === k){\n console.log('FOUND!', mid);\n return mid;\n } else if (arr[mid] > k) {\n high = mid;\n mid = Math.floor((high + low)/2);\n } else if (arr[mid] < k) {\n low = mid;\n mid = Math.floor((high + low)/2);\n }\n }\n console.log('NOT FOUND! ', -1);\n return -1;\n}", "function findNum(arr, target){ // Linear Time: O(n)\n // return arr.includes(target)\n for(let i=0; i < arr.length; i++){\n console.log('running')\n if(arr[i] === target){\n return true;\n }\n }\n \n}", "function binarySearch(arr, val) {\r\n var start = 0;\r\n var end = arr.length-1;\r\n while (start <= end){\r\n var pointer = start + Math.floor((end-start)/2);\r\n if (arr[pointer]==val){\r\n return true;\r\n }\r\n else if (arr[pointer]<val){\r\n start = pointer+1;\r\n }\r\n else if (arr[pointer]>val){\r\n end = pointer-1;\r\n }\r\n }\r\n return false;\r\n }" ]
[ "0.7338627", "0.73016167", "0.7124223", "0.69611794", "0.6899141", "0.6868064", "0.67806125", "0.6764974", "0.6746385", "0.67355347", "0.6684723", "0.6684136", "0.66793704", "0.6633923", "0.65911466", "0.65609413", "0.65583783", "0.6556334", "0.6551626", "0.6550946", "0.6542296", "0.6542296", "0.65258616", "0.64819723", "0.64747244", "0.647335", "0.64686906", "0.6467757", "0.644835", "0.6438521", "0.643675", "0.6427332", "0.6398785", "0.6379806", "0.6377679", "0.6370298", "0.6354827", "0.63508385", "0.63462645", "0.63462645", "0.6346077", "0.63432086", "0.6331915", "0.63299906", "0.6321716", "0.6314151", "0.63092816", "0.63092816", "0.63092816", "0.6300249", "0.6299975", "0.6296124", "0.6282494", "0.6265112", "0.6262049", "0.62466866", "0.6242636", "0.62053657", "0.6201369", "0.61961573", "0.6174666", "0.61677575", "0.6166274", "0.6164998", "0.6161311", "0.6160832", "0.6147016", "0.6142823", "0.61261666", "0.6112474", "0.6112131", "0.6111795", "0.6099818", "0.6098309", "0.60916865", "0.6089752", "0.6082224", "0.6076625", "0.6072257", "0.6068858", "0.60686076", "0.60666436", "0.6066146", "0.60564774", "0.6053989", "0.6052167", "0.60514605", "0.604764", "0.60460335", "0.604267", "0.604046", "0.6036057", "0.60353225", "0.6035074", "0.6034276", "0.60335237", "0.6027377", "0.6024723", "0.6014005", "0.6007502", "0.60015726" ]
0.0
-1
Set initial state of isHidden to false
constructor(props) { super(props); this.state = { isHidden: false } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toggleHidden() {\n setIsHidden(!isHidden);\n }", "toggleHidden() {\n if (this.isHidden) this.show();\n else this.hide();\n }", "function toggleVisible() {\n setVisible(false)\n\n }", "hide() {\n this.isVisible = false;\n }", "toggleVisibility() {\n this.setVisible(!this.visible);\n }", "function setVisibility(){\n $jQ(':visible').each(function(){\n $jQ(this).attr(vars.visible, \"true\");\n });\n $jQ(':hidden').each(function(){\n $jQ(this).attr(vars.visible, \"false\");\n });\n}", "onBeforeHide() {\n this.is_shown_ = false;\n }", "setVisible() {\n element.removeClass('hidden');\n }", "setVisible() {\n element.removeClass('hidden');\n }", "isHidden() {\n return false;\n }", "isHidden() {\n return this._isHidden;\n }", "restoreDefaultVisibility(){\n\t\t\tthis.properties.forEach(function(entry){\n\t\t\t\tvar isVisible = ( isNone(entry['hidden']) || !entry['hidden'] ) ? true : false;\n\t\t\t\tset(entry, 'isVisible', isVisible);\n\t\t\t});\n\t\t}", "hide({ state }) {\n state.visable = false;\n }", "get hidden() {\n return !this.mcVisible && !this.animationState;\n }", "setButtonHidden() {\n this.setState((prevState) => ({ buttonHidden: !prevState.buttonHidden }));\n }", "hide() {\n if (this[$visible]) {\n this[$visible] = false;\n this[$updateVisibility]({ notify: true });\n }\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 }", "get isHidden() {\n if (this.isObject(this.options)) {\n return !!this.options.isHidden;\n }\n else {\n return false;\n }\n }", "_toggle() {\n if (this._isVisible) {\n this._hide();\n } else {\n this._show();\n }\n }", "static set visible(value) {}", "get isHide() {\n return this.isStage(STAGE.hidden);\n }", "toggleVisible() {\n if (this.visible) {\n this.visible = false;\n // this.element.setAttribute('style', 'display: none;');\n this.element.style.display = 'none';\n } else {\n this.visible = true;\n this.element.style.display = 'block';\n }\n }", "get hidden() {\n return !this.selected;\n }", "function _enableHiddenToggle() {\n if (_options.enableHiddenToggle) {\n var $modalFooter = $(\".modal-footer\"),\n $hiddenToggle = $('<input type=\"checkbox\" name=\"pfsd-hidden-toggle\" value=\"hidden-toggle\">'),\n $hiddenToggleLabel = $('<span>' + _options.hiddenToggleLabel + '</span>');\n\n if (_options.showHidden) {\n $hiddenToggle.prop('checked', true);\n } else {\n $hiddenToggle.prop('checked', false);\n }\n\n $hiddenToggle.css({\n \"position\": \"absolute\",\n \"left\": \"10px\",\n \"bottom\": \"30px\"\n });\n $hiddenToggleLabel.css({\n \"position\": \"absolute\",\n \"left\": \"30px\"\n });\n $modalFooter.prepend($hiddenToggleLabel);\n $modalFooter.prepend($hiddenToggle);\n\n // State change handler.\n $hiddenToggle.change(function () {\n if ($(this).is(':checked')) {\n _options.showHidden = true;\n show(_options, _currentDir, true);\n } else {\n _options.showHidden = false;\n show(_options, _currentDir, true);\n }\n });\n }\n }", "onBecameHidden() {\n\n // Stop rendering\n this.isRendering = false\n\n }", "_showHidePlaceholder() {\n\t\tshowHide(this._exported.placeholder, !this._value);\n\t}", "isHidden() {\n return (this.flags & 0x08) !== 0;\n }", "showTrue() {\n this.setState({\n hiddenbusqueda: false\n })\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}", "get hidden() { return hidden }", "function visibilityMoney() {\n setVisible((prevState) => !prevState);\n }", "get isHidden() {\n return this._label === TAU;\n }", "function setShowHideSections()\n {\n // Set initial invisible states\n $('input.is-visible').each(function() {\n var hasError = $(this).closest('.minimise-outer').find('.has-error:first').length;\n if (hasError) {\n // Errors in section, set to visible\n $(this).val('true');\n }\n else {\n // No errors in section, set to invisible\n $(this).val('false');\n }\n });\n }", "function isHidden(){\n \tvar hidden;\n \tif (hidden != 'hidden'){\n \t\thidden = 'hidden';\n \t}else{\n \t\thidden = '';\n \t}\n return hidden;\n\n}", "function setVisible(val) {\n\t\tif(val == undefined) {\n\t\t\tval = true;\n\t\t}\n\t\tthis.visible = val;\n\t}", "function toggleVisibility() {\n setVisibility(isVisible => !isVisible);\n }", "function toggleVisibility() {\n setVisibility(isVisible => !isVisible);\n }", "function _hidden() {}", "handleVisibility(hidden){\n\t\tif ( hidden ) {\n\t\t\tset(this,'actionsColumn', false);\n\t\t\tset(this,'showTableFooter', false);\n\t\t\tset(this,'showGlobalFilter', false);\n\t\t\tset(this,'showActionNew', false);\n\t\t\tset(this,'allColumnsAreHidden',true);\n\t\t} else {\n\t\t\tset(this,'actionsColumn', true);\n\t\t\tset(this,'showTableFooter', true);\n\t\t\tset(this,'showGlobalFilter', true);\n\t\t\tset(this, 'showActionNew', true);\n\t\t\tset(this,'allColumnsAreHidden',false);\n\t\t}\n\t}", "toggleVisibility() {\n this.setState(state => {\n if (state.visibility === true) {\n return { visibility: false };\n } else {\n return { visibility: true };\n }\n });\n }", "set visible(visible) {\n this._visible = visible;\n this.setAttribute('visible', visible);\n }", "function updateState() {\n\t\tif (property !== 'hidden') {\n\t\t\tdocument.hidden = $support.pageVisibility ? document[property] : undefined;\n\t\t}\n\t}", "hideContent() {\n this.content.attr('hidden', 'hidden');\n }", "hide() {\n ELEM.setStyle(this.elemId, 'visibility', 'hidden', true);\n this.isHidden = true;\n return this;\n }", "hide() {\n this.isVisible = false\n this.skeleton.visible = false\n this.clip._root.children.forEach(elt => elt.visible = false)\n this._updateVisibilityImg()\n }", "doHidden( root ) {\n root.style.display = 'none';\n }", "showContent() {\n this.content.removeAttr('hidden');\n }", "function _setOffFlag(visible){\n placeholder.each(function(){\n $(this).find('div.instrument.attitude div.attitude_off_flag').toggle(visible);\n });\n }", "function setVisibility() {\n\n self.element.querySelector( '.captions_start' ).style.display = getInputElementByName( 'start_button' ).checked ? 'block' : 'none';\n self.element.querySelector( '.captions_submit' ).style.display = getInputElementByName( 'feedback' ).value !== 'none' ? 'block' : 'none';\n self.element.querySelector( '.captions_finish' ).style.display = getInputElementByName( 'onfinish.restart' ).checked ? 'block' : 'none';\n getInputElementByName( 'manually' ).style.display = getInputElementByName( 'keywords' ).value === 'manually' ? 'block' : 'none';\n function getInputElementByName( name ) { return self.element.querySelector( '[name=\"' + name + '\"]' ); }\n\n }", "hide() {\n this.elem.classList.add(\"hiding\");\n setTimeout(() => this.elem.classList.add(\"noDisplay\"), 184);\n this.isHidden = true;\n }", "set visible(v) {\n this._visible = v;\n this.setAttribute('visible', v);\n }", "function swap_show_hide()\n{\n if (showhide_status) \n {\n showhide_status = false;\n } \n else \n {\n showhide_status = true;\n }\n this.refresh_show_hide();\n}", "function hiddenState(vis) {\n return vis === spin.PANEL_HIDDENLEFT ||\n vis === spin.PANEL_HIDDENRIGHT;\n }", "isHide() {\n return this.x < 0\n }", "handleHide() {\n this.setState({ \n show_rd: false,\n show_rm: false,\n show_rs: false,\n });\n }", "handleHide() {\n this.setState({ show: false });\n }", "toggleVisibility() {\n if (this.isOpen()) {\n this.hide();\n } else {\n this.show();\n }\n }", "hide() {\n this.visible = false;\n this.closed.emit();\n }", "function setVisibility() {\n\n self.element.querySelector( '.captions_start' ).style.display = getInputElementByName( 'start_button' ).checked ? 'block' : 'none';\n self.element.querySelector( '.captions_submit' ).style.display = getInputElementByName( 'feedback' ).value !== 'none' ? 'block' : 'none';\n // self.element.querySelector( '.captions_cancel' ).style.display = getInputElementByName( 'cancel_button' ).checked ? 'block' : 'none';\n self.element.querySelector( '.captions_finish' ).style.display = getInputElementByName( 'onfinish.restart' ).checked ? 'block' : 'none';\n getInputElementByName( 'manually' ).style.display = getInputElementByName( 'keywords' ).value === 'manually' ? 'block' : 'none';\n function getInputElementByName( name ) { return self.element.querySelector( '[name=\"' + name + '\"]' ); }\n\n }", "reset() {\n this.parts.forEach((part) => part.setVisible(false));\n this.visibleIndex = -1;\n }", "function toggleHideFilter() {\n STORE.hideCompleted = !STORE.hideCompleted;\n}", "function changeVisibility() {\n magic.style.visibility = 'hidden';\n magic.style.display = 'block;';\n}", "toggleVisibility() {\n this.setState(state => {\n if (state.visibility === true) {\n return { visibility: false };\n } else {\n return { visibility: true };\n }\n });\n }", "toggleVisibility() {\n this.visibility = this.visibility === \"hidden\" ? \"visible\" : \"hidden\";\n return this.visibility;\n }", "onHide() {\n\t\tthis.setState({\n\t\t\topen: false\n\t\t});\n\t}", "hide() {\n this.visible = false;\n if (this.config.pauseGame) {\n ns.game.paused = false;\n }\n }", "onHide(){\n\t this.setState({\n\t info : {\n\t hide : true\n\t }\n\t });\n\t}", "static hide(obj) {\n obj.setAttribute('visibility', 'hidden');\n }", "hide () {\n this.showing = false\n this.element ? this.element.update(this) : null\n }", "hide() {\n if (this.facingCamera || !this.initialized) {\n this.updateVisibility(false);\n }\n }", "hide() {\n this.setState({display: false})\n }", "_stateChanged(disabled, readonly, clearButtonVisible, hasValue) {\n if (!disabled && !readonly && clearButtonVisible && hasValue) {\n this.$.clearButton.removeAttribute('hidden');\n } else {\n this.$.clearButton.setAttribute('hidden', true);\n }\n }", "public setNone() : void {\n this.yesIcon.hide();\n this.noIcon.hide();\n this.noneIcon.show();\n this.elem.css({\n \"background-color\": \"\",\n \"outline\": \"\",\n });\n }", "toggleHidden (prop) {\n\t\t\tvar isVisible = true;\n\t\t\tif (!isNone(prop['isVisible'])) {\n\t\t\t\tisVisible = prop['isVisible'];\n\t\t\t}\n\t\t\tset(prop,'isVisible', isVisible?false:true);\n\t\t\t//comprobamos si queda alguna columna como visible, si no ocultamos acciones\n\t\t\tvar visible = false;\n\t\t\tvisible = this.properties.some(function(entry){\n\t\t\t\tif ( entry['isVisible'] ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t});\n\t\t\tvisible?this.handleVisibility(false):this.handleVisibility(true);\n\t\t}", "toggleExitConfirmationVisibility() {\n this.state.meta.exitConfirmationIsVisible = !this.state.meta.exitConfirmationIsVisible;\n this.save();\n }", "setVisible() {\n this.visible = true;\n this.getNumber();\n }", "getHidden() {\n return !this.shot.visible;\n }", "function setVisible(b) {\n visible = b;\n utils.showElement(methodsElement, b);\n }", "function unhideControls() {\n\tdocument.querySelector('.hidden').style.visibility = 'visible';\n}", "hide() {\n\t\tthis.isVisible = false;\n this.element.classList.remove('hide')\n\t\tthis.element.classList.remove('showCarousel')\n\t\tthis.element.classList.add('hideCarousel')\n\t\tthis.buttons.style.paddingTop = \"72px\"\n\t\t\n\t}", "static hide(v) {\n // Set style to none\n UI.find(v).setAttribute(\"hidden\", \"true\");\n }", "function toggleMovementDisplay() {\n\tisHidden.style.display = 'block';\n}", "toggle() {\n this.setState({\n visible: !this.state.visible,\n });\n }", "static hide(obj) {\n obj.setAttribute('visibility', 'hidden');\n }", "function SetVisible(n,t){WDAnimSurImage.prototype.SetVisibilite(n,t?\"visible\":\"hidden\")}", "function hideState() {\n let checkboxes = document.querySelectorAll(UISelectors.checkbox_ADDRESS)\n checkboxes.forEach((checkbox) => {\n checkbox.classList.remove('show')\n })\n UISelectors.btn_back.classList.remove('show')\n UISelectors.btn_delete.textContent = 'Select Delete'\n }", "afterHidden() {}", "hide() {}", "setVisible(value) {\n this.visible = value;\n _.each(this.shapes, (shape) => {\n shape.visible = value;\n });\n }", "forceHide() {\n this.__count = 0;\n this.hide();\n }", "onBeforeHide() {\n this.enableWifiScans_ = false;\n Oobe.getInstance().setOobeUIState(OOBE_UI_STATE.HIDDEN);\n this.isCloseable_ = true;\n }", "toggleVisiblity() {\n if (hidden) {\n this.show();\n } else {\n this.hide();\n }\n return this;\n }", "updateHidden(source) {\n var hidden = this.state.hidden;\n hidden[source] = !hidden[source];\n this.setState( { hidden: hidden } );\n }", "_stateChanged(disabled,readonly,clearButtonVisible,hasValue){if(!disabled&&!readonly&&clearButtonVisible&&hasValue){this.$.clearButton.removeAttribute(\"hidden\")}else{this.$.clearButton.setAttribute(\"hidden\",!0)}}", "function hideempty(hide) {\n\tif(hide){\n\t\tdocument.getElementById(\"content\").setAttribute(\"data-hideempty\",\"true\");\n\t}else{\n\t\tdocument.getElementById(\"content\").setAttribute(\"data-hideempty\",\"false\");\n\t}\n\n\tredrawFix();\n}", "function xHide(e){return xVisibility(e,0);}", "static isHidden()\n {\n return document.visibilityState === \"hidden\";\n }", "_hideAll() {\n this.views.directorySelection.hide();\n this.views.training.hide();\n this.views.messages.hide();\n this.views.directorySelection.css('visibility', 'hidden');\n this.views.training.css('visibility', 'hidden');\n this.views.messages.css('visibility', 'hidden');\n }", "hide_() {\n this.adapter_.setAttr(strings$17.ARIA_HIDDEN, 'true');\n }", "toggler() {\n const visibility = this.state.visibility;\n const expanded = this.state.expanded;\n if (visibility === \"hidden\" && !expanded) {\n this.setState({\n visibility: \"visible\",\n expanded: true\n })\n } else {\n this.setState({\n visibility: \"hidden\",\n expanded: false\n })\n }\n\n }" ]
[ "0.78252584", "0.76245505", "0.7359153", "0.7221915", "0.71982735", "0.7112962", "0.70960844", "0.70773596", "0.70773596", "0.7072323", "0.706422", "0.704181", "0.69935143", "0.69556475", "0.6948909", "0.6900581", "0.68829936", "0.68114346", "0.67830795", "0.6781498", "0.6772662", "0.6718964", "0.67111605", "0.67071164", "0.6672497", "0.66681296", "0.66597396", "0.6642894", "0.66418403", "0.6612519", "0.66119605", "0.6609398", "0.65789676", "0.6578422", "0.65597874", "0.6521442", "0.6521442", "0.6506682", "0.64859444", "0.64465076", "0.64395887", "0.6436298", "0.643355", "0.6423938", "0.64210474", "0.6417291", "0.6416729", "0.6412888", "0.6394084", "0.63925856", "0.6380743", "0.6371936", "0.6368411", "0.6368107", "0.6359602", "0.63574106", "0.6341457", "0.63366973", "0.63339055", "0.6325371", "0.6321589", "0.6312237", "0.6306081", "0.62986743", "0.62962115", "0.62956154", "0.6275483", "0.6274259", "0.62649363", "0.62621963", "0.62609357", "0.62598217", "0.6257686", "0.6255261", "0.6250838", "0.6243713", "0.624369", "0.6241914", "0.62314534", "0.62273383", "0.62239826", "0.62205124", "0.62186176", "0.6205718", "0.6202144", "0.62005377", "0.6197098", "0.6197087", "0.6190802", "0.6190752", "0.6188675", "0.6185858", "0.6175345", "0.61551726", "0.615218", "0.6151718", "0.61479306", "0.6127193", "0.6123006", "0.6122347" ]
0.681252
17
2) Mounting and Updating
render(){ console.log('render', this.state.timer) // most used // after constructor giving access to props and state return ( <div> <p>{this.state.timer}</p> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "commitMount(instance, type, newProps) {\n instance.commitMount(newProps);\n }", "function flushMounts() {\n\tvar c;\n\twhile (c = mounts.pop()) {\n\t\tif (options.afterMount) options.afterMount(c);\n\t\tif (c.componentDidMount) c.componentDidMount();\n\t}\n}", "function flushMounts() {\n\tvar c;\n\twhile (c = mounts.pop()) {\n\t\tif (options.afterMount) options.afterMount(c);\n\t\tif (c.componentDidMount) c.componentDidMount();\n\t}\n}", "function flushMounts() {\n\tvar c;\n\twhile (c = mounts.pop()) {\n\t\tif (options.afterMount) options.afterMount(c);\n\t\tif (c.componentDidMount) c.componentDidMount();\n\t}\n}", "function flushMounts() {\n\tvar c;\n\twhile (c = mounts.pop()) {\n\t\tif (options.afterMount) options.afterMount(c);\n\t\tif (c.componentDidMount) c.componentDidMount();\n\t}\n}", "function flushMounts() {\n\tvar c;\n\twhile (c = mounts.pop()) {\n\t\tif (options.afterMount) options.afterMount(c);\n\t\tif (c.componentDidMount) c.componentDidMount();\n\t}\n}", "function flushMounts() {\n\tvar c;\n\twhile (c = mounts.pop()) {\n\t\tif (options.afterMount) options.afterMount(c);\n\t\tif (c.componentDidMount) c.componentDidMount();\n\t}\n}", "willMount() {\n }", "flyMakeVolume() {\n // add a [mounts] section if one is not already present\n if (!this.flyToml.includes('[mounts]')) {\n this.flyToml += '\\n[mounts]\\n source = \"data\"\\n destination=\"/data\"\\n'\n fs.writeFileSync(this.flyTomlFile, this.flyToml)\n }\n\n // bail if there is no app\n if (!this.flyApp) return\n\n // parse list of existing machines. This may fail if there are none.\n let machines = []\n try {\n machines = JSON.parse(\n execSync(`${this.flyctl} machines list --app ${this.flyApp} --json`, { encoding: 'utf8' }))\n } catch { }\n\n // parse list of existing volumes\n const volumes = JSON.parse(\n execSync(`${this.flyctl} volumes list --app ${this.flyApp} --json`, { encoding: 'utf8' }))\n\n // count the number of volumes needed in each region\n const map = {}\n for (const machine of machines) {\n map[machine.region] ||= 0\n map[machine.region]++\n }\n\n // subtract the number of volumes that already exist\n for (const volume of volumes) {\n if (map[volume.Region]) map[volume.Region]--\n }\n\n // allocate volumes\n for (let [region, count] of Object.entries(volumes)) {\n while (count-- > 0) {\n execSync(\n `${this.flyctl} volumes create data --app ${this.flyApp} --region ${region}`,\n { stdio: 'inherit' }\n )\n }\n }\n }", "function fs_mount(target, type, params) {\n var mount_data = {\n id: fs_mounts_next,\n location: target,\n type: type,\n params: params\n };\n fs_mounts.push(mount_data);\n fs_mounts_next++;\n \n if(type == \"tmpfs\") {\n tmpfs_mount(mount_data.id, params);\n } else if(type == \"httpfs\") {\n httpfs_mount(mount_data.id, params);\n } else if(type == \"procfs\") {\n procfs_mount(mount_data.id, params);\n }\n}", "async prepare () {\n this.name = 'fuse'\n const client = new HyperdriveClient()\n await client.ready()\n this.dir = p.join('/hyperdrive', 'home', '_bench')\n if (fs.existsSync(this.dir)) return\n await client.fuse.mount(this.dir)\n }", "function mainMonitor() {\n // queueDisk.addEvent() listen.... todo\n onNewDevEvent(() => {\n console.warn(\"newDevEvent\");\n\n // //step1 get new dev info and update view\n // sendGlobalUpdate();//global view update(from store)\n //\n // //setp check2 ntfs and update\n // if (action === NTFS_Mount) {\n // workerDisk.autoMount(function () {\n // sendGlobalUpdate();//global view update again\n // });\n // }\n })\n\n}", "onMountDisk(){\n this.setState({\n disks : this.state.disks,\n current : this.state.current,\n mode : 1,//Modify this variable to changes in modes\n selected : this.state.selected\n });\n }", "static mount(partition) {\n return new Promise((resolve, reject) => {\n if (partition.mounted) {\n // would be nice to also pass the mountpoint\n // but promise handlers don't support multi-arg\n return resolve(false /*wasMounted*/);\n }\n\n partition.mount().then((mp) => {\n resolve(true /*wasMounted*/);\n }, (err) => {\n reject(err);\n });\n });\n }", "function init(cb) {\n\tconsole.log(\"File system started at \" + options.mountPoint);\n\tconsole.log(\"To stop it, type this in another shell: fusermount -u \" + options.mountPoint);\n\tcb();\n}", "function performPostEstablishRemoteMounts( err, data ) {\n\n if ( err ) {\n\n // Unable to reconnect to Jde at the moment so pause and retry shortly\n log.w( '' );\n log.w( 'Unable to re-establish remote mounts to Jde will pause and retry' );\n log.w( '' );\n setTimeout( performPolledProcess, pollInterval );\n\n } else {\n\n // Remote mounts okay so go ahead and process, checking for new Pdf's etc\n log.v( 'Remote mounts to Jde re-established - will continue normally')\n pdfchecker.queryJdePdfProcessQueue( dbp, hostname, processFromStatus, processToStatus, scheduleNextPolledProcess );\n\n }\n\n}", "onODFSSignIn_() {\n const currentVolumeInfo = this.directoryModel_.getCurrentVolumeInfo();\n if (util.isOneDrive(currentVolumeInfo) &&\n currentVolumeInfo.providerId !== undefined) {\n this.providersModel_.requestMount(currentVolumeInfo.providerId);\n }\n }", "updateDirs (drive, dirs) {\n this.abort()\n setImmediate(() => {\n this.isAborted = false\n this.drive = drive\n this.dirs = dirs\n this.start()\n })\n }", "commitMount(instance, type, newProps, internalInstanceHandle) {\n console.log('commitMount:', newProps.name);\n // noop\n if (type === 'window') {\n console.log('instance.__children', instance.__children);\n if (instance.__children) {\n instance.__children.forEach(w => {\n console.log('!!!!!!============', w);\n if (w.reparentTo) {\n w.reparentTo(instance, w.x, w.y);\n w.map();\n }\n });\n }\n }\n }", "function sync() {\n syncDocuments({\n uri: {\n fsPath: path.join(rootPath, dir)\n }\n });\n }", "[_refreshLocation] () {\n const root = this.root\n const loc = relpath(root.realpath, this.path)\n\n this.location = loc\n\n root.inventory.add(this)\n if (root.meta)\n root.meta.add(this)\n }", "__createMountPoints() {\n this.app = express();\n this.requestListener = this.app;\n // for parsing application/json\n this.app.use(bodyParser.json());\n // for parsing application/x-www-form-urlencoded\n this.app.use(bodyParser.urlencoded({ extended: true }));\n\n this.app.post('*', (req, res) => {\n this.__formatUpdate(req.body)\n\n .then((update) => {\n this.__emitUpdate(update);\n }, (err) => {\n err.message = `Error in __formatUpdate \"${err.message}\". Please report this.`;\n this.emit('error', err);\n });\n\n // just letting telegram know we got the update\n res.sendStatus(200);\n });\n }", "componenetWillMount() { }", "update (mediaFolder, options = {}) {\n // will emit many different events\n const emitter = new EventEmitter()\n\n // prepared database statements\n const selectStatement = this.db.prepare('SELECT path, timestamp FROM files')\n const insertStatement = this.db.prepare('INSERT OR REPLACE INTO files VALUES (?, ?, ?)')\n const deleteStatement = this.db.prepare('DELETE FROM files WHERE path = ?')\n const countStatement = this.db.prepare('SELECT COUNT(*) AS count FROM files')\n const selectMetadata = this.db.prepare('SELECT * FROM files')\n\n // create hashmap of all files in the database\n const databaseMap = {}\n for (const row of selectStatement.iterate()) {\n databaseMap[row.path] = row.timestamp\n }\n\n function finished () {\n // emit every file in the index\n for (const row of selectMetadata.iterate()) {\n emitter.emit('file', {\n path: row.path,\n timestamp: new Date(row.timestamp),\n metadata: JSON.parse(row.metadata)\n })\n }\n // emit the final count\n const result = countStatement.get()\n emitter.emit('done', { count: result.count })\n }\n\n // find all files on disk\n globber.find(mediaFolder, options, (err, diskMap) => {\n if (err) return console.error('error', err)\n\n // calculate the difference: which files have been added, modified, etc\n const deltaFiles = delta.calculate(databaseMap, diskMap, options)\n emitter.emit('stats', {\n unchanged: deltaFiles.unchanged.length,\n added: deltaFiles.added.length,\n modified: deltaFiles.modified.length,\n deleted: deltaFiles.deleted.length,\n skipped: deltaFiles.skipped.length,\n total: Object.keys(diskMap).length\n })\n\n // remove deleted files from the DB\n _.each(deltaFiles.deleted, path => {\n deleteStatement.run(path)\n })\n\n // check if any files need parsing\n let processed = 0\n const toProcess = _.union(deltaFiles.added, deltaFiles.modified)\n if (toProcess.length === 0) {\n return finished()\n }\n\n // call <exiftool> on added and modified files\n // and write each entry to the database\n const stream = exiftool.parse(mediaFolder, toProcess, options.concurrency)\n stream.on('data', entry => {\n const timestamp = moment(entry.File.FileModifyDate, EXIF_DATE_FORMAT).valueOf()\n insertStatement.run(entry.SourceFile, timestamp, JSON.stringify(entry))\n ++processed\n emitter.emit('progress', { path: entry.SourceFile, processed, total: toProcess.length })\n }).on('end', finished)\n })\n\n return emitter\n }", "validateMountPoint() {\n if (!this.mountpoint) this.mountpoint = new MountPoint(this.node);\n }", "function LocalFileSystemSync() {}", "async function endpointsCreateOrUpdateNfsMount() {\n const subscriptionId =\n process.env[\"STORAGEMOVER_SUBSCRIPTION_ID\"] || \"60bcfc77-6589-4da2-b7fd-f9ec9322cf95\";\n const resourceGroupName = process.env[\"STORAGEMOVER_RESOURCE_GROUP\"] || \"examples-rg\";\n const storageMoverName = \"examples-storageMoverName\";\n const endpointName = \"examples-endpointName\";\n const endpoint = {\n properties: {\n description: \"Example NFS Mount Endpoint Description\",\n endpointType: \"NfsMount\",\n export: \"examples-exportName\",\n host: \"0.0.0.0\",\n },\n };\n const credential = new DefaultAzureCredential();\n const client = new StorageMoverClient(credential, subscriptionId);\n const result = await client.endpoints.createOrUpdate(\n resourceGroupName,\n storageMoverName,\n endpointName,\n endpoint\n );\n console.log(result);\n}", "function performPostRemoteMountChecks( err, data ) {\n\n if ( err ) {\n\n // Problem with remote mounts so need to reconnect before doing anything else\n reconnectToJde( err );\n\n } else {\n\n // Remote mounts okay so go ahead and process, checking for new Pdf's etc\n pdfchecker.queryJdePdfProcessQueue( dbp, hostname, processFromStatus, processToStatus, scheduleNextPolledProcess );\n\n }\n\n}", "mount(app, moduleDirectory){\n debug ('mounting ', moduleDirectory)\n if (moduleDirectory){\n let modules = this.findModules(moduleDirectory)\n debug('module directory from user ', moduleDirectory, modules)\n debug('Current path ', moduleDirectory + '/' + module)\n modules.forEach((module) => {\n if (fs.existsSync(moduleDirectory + '/' + module + '/api.json')){\n debug('Module ' + module + ' found api.json' )\n let api = require(path.resolve(moduleDirectory, module, 'api.json'))\n this.mountAPI(app, api, module, moduleDirectory)\n }\n else if (fs.existsSync( moduleDirectory + '/' + module + '/swagger.yaml')){\n debug('Module found swagger ' + module)\n let api = YAML.load(path.resolve(moduleDirectory, module, 'swagger.yaml'))\n this.mountSwagger(app, api, module, moduleDirectory)\n }\n else {\n debug('No API Spec for ', module)\n }\n })\n }\n else {\n // find all modules\n let modules = this.findModules('./modules')\n modules.forEach((module) => {\n // load the api.json or the swagger.yaml\n if (fs.existsSync(__dirname + '/../modules/' + module + '/api.json')){\n let api = require('../modules/' + module + '/api.json')\n this.mountAPI(app, api, module, __dirname + '/../modules')\n }\n else if (fs.existsSync(__dirname + '/../modules/' + module + '/swagger.yaml')) {\n let api = YAML.load(__dirname + '/../modules/' + module + '/swagger.yaml')\n this.mountSwagger(app, api, module, __dirname + '/../modules')\n }\n else {\n debug('NO DEFINITION OF API for the module ' + module)\n }\n })\n }\n }", "function infoMount( formdata, cifs ) {\n\tinfo( {\n\t\t icon : 'network'\n\t\t, title : 'Network Share'\n\t\t, content : htmlmount\n\t\t, preshow : function() {\n\t\t\tif ( $.isEmptyObject( formdata ) ) {\n\t\t\t\t$( 'input[name=protocol]:eq( 0 )' ).prop( 'checked', 1 );\n\t\t\t\t$( '#infotextbox input:eq( 1 )' ).val( '192.168.1.' );\n\t\t\t\t$( '#infoCheckBox input' ).prop( 'checked', true );\n\t\t\t} else {\n\t\t\t\tif ( formdata.protocol === 'cifs' ) {\n\t\t\t\t\t$( 'input[name=protocol]:eq( 0 )' ).prop( 'checked', 1 );\n\t\t\t\t\t$( '#infotextbox input:eq( 3 )' ).val( formdata.user );\n\t\t\t\t\t$( '#infotextbox input:eq( 4 )' ).val( formdata.password );\n\t\t\t\t} else {\n\t\t\t\t\t$( 'input[name=protocol]:eq( 1 )' ).prop( 'checked', 1 );\n\t\t\t\t\t$( '.guest' ).addClass( 'hide' );\n\t\t\t\t}\n\t\t\t\t$( '#infotextbox input:eq( 0 )' ).val( formdata.name );\n\t\t\t\t$( '#infotextbox input:eq( 1 )' ).val( formdata.ip );\n\t\t\t\t$( '#infotextbox input:eq( 2 )' ).val( formdata.directory );\n\t\t\t\t$( '#infotextbox input:eq( 5 )' ).val( formdata.options );\n\t\t\t\t$( '#infoCheckBox input' ).prop( 'checked', formdata.update );\n\t\t\t}\n\t\t\tif ( G.autoupdate ) $( '#infoCheckBox' ).addClass( 'hide' );\n\t\t\tif ( cifs ) $( '#infoRadio' ).hide();\n\t\t\t$( '.eye.guest' ).css( 'margin-top', '210px' );\n\t\t\t$( 'input[name=protocol]' ).change( function() {\n\t\t\t\tif ( $( this ).val() === 'nfs' ) {\n\t\t\t\t\t$( '#sharename' ).text( 'Share path' );\n\t\t\t\t\t$( '.guest' ).addClass( 'hide' );\n\t\t\t\t} else {\n\t\t\t\t\t$( '#sharename' ).text( 'Share name' );\n\t\t\t\t\t$( '.guest' ).removeClass( 'hide' );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t\t, ok : function() {\n\t\t\tvar formmount = $( '#formmount' ).serializeArray();\n\t\t\tvar data = {};\n\t\t\t$.map( formmount, function( val ) {\n\t\t\t\tdata[ val[ 'name' ] ] = val[ 'value' ];\n\t\t\t});\n\t\t\tvar mountpoint = data.name;\n\t\t\tvar directory = data.directory.replace( /^\\//, '' );\n\t\t\tif ( data.protocol === 'cifs' ) {\n\t\t\t\tvar options = 'noauto';\n\t\t\t\toptions += ( !data.user ) ? ',username=guest,password=' : ',username='+ data.user +',password='+ data.password;\n\t\t\t\toptions += ',uid='+ $( '#list' ).data( 'uid' ) +',gid='+ $( '#list' ).data( 'gid' ) +',iocharset=utf8';\n\t\t\t\toptions += data.options ? ','+ data.options : '';\n\t\t\t\tvar device = '//'+ data.ip +'/'+ directory;\n\t\t\t} else {\n\t\t\t\tvar options = 'defaults,noauto,bg,soft,timeo=5';\n\t\t\t\toptions += data.options ? ','+ data.options : '';\n\t\t\t\tvar device = data.ip +':/'+ directory;\n\t\t\t}\n\t\t\tvar update = !G.autoupdate && data.update || false;\n\t\t\tnotify( 'Network Mount', 'Mount ...', 'network' );\n\t\t\tbash( [ 'mount', mountpoint, data.ip, device, data.protocol, options, update ], function( std ) {\n\t\t\t\tif ( std !== 0 ) {\n\t\t\t\t\tformdata = data;\n\t\t\t\t\tinfo( {\n\t\t\t\t\t\t icon : 'network'\n\t\t\t\t\t\t, title : 'Mount Share'\n\t\t\t\t\t\t, message : std\n\t\t\t\t\t\t, ok : function() {\n\t\t\t\t\t\t\tinfoMount( formdata );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\trefreshData();\n\t\t\t\t\tformdata = {}\n\t\t\t\t}\n\t\t\t\t$( '#refreshing' ).addClass( 'hide' );\n\t\t\t}, 'json' );\n\t\t\t$( '#refreshing' ).removeClass( 'hide' );\n\t\t}\n\t} );\n}", "componentDidMount() {\n const { setVolumes, volumes } = this.props;\n\n setVolumes(volumes);\n }", "function resolveOnSuccess(entry) {\n //new file name\n var newFileName = THIS.fileName + \".jpg\";\n var myFolderApp = THIS.folder;\n // console.log(\"requesting FS\");\n window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSys) {\n // console.log(\"request granted\");\n //The folder is created if doesn't exist\n fileSys.root.getDirectory(myFolderApp,\n {create: true, exclusive: false},\n function (directory) {\n entry.moveTo(directory, newFileName, successMove, resOnError);\n },\n resOnError);\n },\n resOnError);\n }", "async function endpointsCreateOrUpdateSmbMount() {\n const subscriptionId =\n process.env[\"STORAGEMOVER_SUBSCRIPTION_ID\"] || \"60bcfc77-6589-4da2-b7fd-f9ec9322cf95\";\n const resourceGroupName = process.env[\"STORAGEMOVER_RESOURCE_GROUP\"] || \"examples-rg\";\n const storageMoverName = \"examples-storageMoverName\";\n const endpointName = \"examples-endpointName\";\n const endpoint = {\n properties: {\n description: \"Example SMB Mount Endpoint Description\",\n credentials: {\n type: \"AzureKeyVaultSmb\",\n passwordUri: \"https://examples-azureKeyVault.vault.azure.net/secrets/examples-password\",\n usernameUri: \"https://examples-azureKeyVault.vault.azure.net/secrets/examples-username\",\n },\n endpointType: \"SmbMount\",\n host: \"0.0.0.0\",\n shareName: \"examples-shareName\",\n },\n };\n const credential = new DefaultAzureCredential();\n const client = new StorageMoverClient(credential, subscriptionId);\n const result = await client.endpoints.createOrUpdate(\n resourceGroupName,\n storageMoverName,\n endpointName,\n endpoint\n );\n console.log(result);\n}", "function update() {}", "notify(){\n /**\n * Informs listeners that file system received new data\n * @event DirService#update\n * @type void\n */\n this.emit( \"update\" );\n }", "onUpdateFolder() {\n this.onUpdateFolder();\n }", "mount() {\r\n return null;\r\n }", "function updateDataNode(path, localNode) {\n if(localNode) {\n return wireClient.set(path, localNode.data, localNode.mimeType).\n then(function() {\n remoteAdapter.expireKey(path);\n }).then(function() {\n var parentPath = util.containingDir(path);\n remoteAdapter.expireKey(parentPath);\n if(caching.descendIntoPath(parentPath)) {\n return util.asyncGroup(\n curry(remoteAdapter.get, parentPath),\n curry(store.getNode, parentPath)\n ).then(function(parents) {\n var baseName = util.baseName(path);\n parents[1].data[baseName] = parents[0].data[baseName];\n });\n }\n });\n } else {\n return remoteAdapter.get(path).\n then(function(node) {\n remoteAdapter.expireKey(path);\n return node;\n });\n }\n }", "upgrade() {}", "updateDataFile() {\n\t\tthis.getDataFile()\n\t\t.then(() => this.getClient());\n\t}", "async function syncDeviceFile(fname, autospeed = true){\n const fidx = findFileInDir(fname)\n await blStore.get(blxIDs.deviceMAC + '_' + fname)\n const KeyVal = blStore.result()\n if(fidx<0){ // file not in current dir\n if(KeyVal !== undefined){ // but maybe as old version in Store?\n await blStore.remove(KeyVal.k)\n }\n blxErrMsg = \"ERROR(identify): No File '\" + fname + \"' on Device\"\n if(blxUserCB) blxUserCB('WARN',3,\"No File '\" + fname + \"' on Device\") // Warning 3\n return\n }\n\n if(blxIDs.disk.files[fidx].len <= 0 || blxIDs.disk.files[fidx].ucl_flag === true){\n blxErrMsg = \"ERROR(identify): File corrupt '\" + fname + \"' on Device\"\n if(blxUserCB) blxUserCB('WARN',4,\"File corrupt '\" + fname + \"' on Device\") // Warning 4\n return\n }\n \n if (KeyVal !== undefined) {\n // check if uptodate\n if(blxIDs.disk.files[fidx].len === KeyVal.v.akt_len && // includes pos0-test\n blxIDs.disk.files[fidx].crc32 === KeyVal.v.crc32 && \n blxIDs.disk.files[fidx].date.getTime() === KeyVal.v.ctime.getTime() ){\n return // Nothing to do, Up To Date\n }\n }\n // requires update\n await getfile([0, fname], autospeed)\n\n // If everything is 100% OK, Store Backup Copy\n if(!blxErrMsg){\n await blStore.get(blxIDs.deviceMAC + '_' + fname)\n const KeyValBak = blStore.result()\n if(KeyValBak!==undefined){\n if(blxIDs.disk.files[fidx].len === KeyValBak.v.akt_len && // includes pos0-test\n blxIDs.disk.files[fidx].crc32 === KeyValBak.v.crc32 && \n blxIDs.disk.files[fidx].date.getTime() === KeyValBak.v.ctime.getTime() ){\n\n await blStore.set(blxIDs.deviceMAC + '_#BAK_' + fname,KeyValBak.v)\n }\n }\n }\n }", "function update() {\n switch (x) {\n case 'help': return help(cmd, x);\n case 'history': return history(cmd, x);\n case 'reset': return reset(cmd);\n case 'reset -a': return window.localStorage.removeItem('itemKey');\n case 'cv': return cv(cmd, x);\n case 'cv --json': return cvjson(cmd, x);\n case 'q':\n case 'quit': return quit(cmd, x);\n default: return unexisting(cmd, x);\n }\n }", "function updateRemoteApp() {\n let cmd = \"rm -rf \" + repoNameOLD;\n cmd += \"&& mv \" + repoName + \"/\" + nodeModulesDir + \" \" + repoNameTemp; \n cmd += \" && mv \" + repoName + \" \" + repoNameOLD;\n cmd += \" && mv \" + repoNameTemp + \" \" + repoName;\n\tconsole.log(\"##Attempting folder moves on remote host with cmd: \" + cmd);\n\treturn ssh.execCommand(cmd, { cwd:'/home/ubuntu' })\n}", "function resolveOnSuccess(entry){ \n var d = new Date();\n var n = d.getTime();\n //new file name\n var newFileName = n + \".jpg\";\n var myFolderApp = \"ClueHunt\";\n\n window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) { \n //The folder is created if doesn't exist\n fileSys.root.getDirectory( myFolderApp,\n {create:true, exclusive: false},\n function(directory) {\n entry.moveTo(directory, newFileName, successMove, resOnError);\n },\n resOnError);\n },\n resOnError);\n}", "mount() {\n this.willMount();\n this.render();\n this.didMount();\n }", "beforeMount(){\n console.log('beforeMount');\n }", "function update() {\n\tIPC.sendToHost('api-call', '/daemon/version', 'version');\n\t\n\tupdating = setTimeout(update, 50000);\n}", "function resolveOnSuccess(entry){ \n console.log(entry)\n var d = new Date();\n var n = d.getTime();\n //new file name\n var newFileName = n + \".jpg\";\n var myFolderApp = 'MyAppFolder';\n window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) { \n //The folder is created if doesn't exist\n fileSys.root.getDirectory( myFolderApp,\n {create:true, exclusive: false},\n function(directory) {\n entry.moveTo(directory, newFileName, successMove, resOnError);\n },\n resOnError);\n }\n \n , resOnError);\n }", "function resolveOnSuccess(entry){ \n console.log(entry)\n var d = new Date();\n var n = d.getTime();\n //new file name\n var newFileName = n + \".jpg\";\n var myFolderApp = 'MyAppFolder';\n window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) { \n //The folder is created if doesn't exist\n fileSys.root.getDirectory( myFolderApp,\n {create:true, exclusive: false},\n function(directory) {\n entry.moveTo(directory, newFileName, successMove, resOnError);\n },\n resOnError);\n }\n \n , resOnError);\n }", "runFloppyDisk(floppyDisk) {\n // Mount floppy.\n this.loadFloppyDisk(floppyDisk, 0);\n // Reboot.\n this.reset();\n }", "didMount() {\n }", "function swpanedUpdate(base64) {\n var spawnName = this.name;\n if (server.clusters[0]){\n server.clusters[0].send({'namespace':spawnName,'data':base64});\n }\n}", "touch() {\n\t}", "function updateHAList() {\n orchestrator.getHAList(function(err, data) {\n if (!err && data) {\n loadBalancer.setHAList(JSON.parse(data));\n }\n });\n}", "async update() {}", "function LSFS() {\n if (LSFS.mount) {\n return LSFS;\n }\n\n var wrapCreateNode = wrapNode(MEMFS.createNode);\n\n var wrap_node_ops = {\n setattr: wrapSave(MEMFS.node_ops.setattr),\n mknod: wrapNode(MEMFS.node_ops.mknod),\n rename: wrapSave(MEMFS.node_ops.rename),\n unlink: wrapSave(MEMFS.node_ops.unlink),\n rmdir: wrapSave(MEMFS.node_ops.rmdir),\n symlink: wrapNode(MEMFS.node_ops.symlink)\n };\n\n var wrap_stream_ops = {\n write: wrapSave(MEMFS.stream_ops.write),\n msync: wrapSave(MEMFS.stream_ops.msync)\n };\n\n var props = [ 'name', 'mode', 'rdev', 'link', 'usedBytes', 'timestamp' ];\n\n LSFS.mount = mount;\n\n return LSFS;\n\n function wrapNode(fn) {\n return function() {\n var node = fn.apply(null, arguments);\n setupNode(node);\n return node;\n }\n }\n\n function wrapSave(fn) {\n return function(node) {\n var res = fn.apply(null, arguments);\n save(node);\n return res;\n }\n }\n\n function setupNode(node) {\n var node_ops = {};\n for (var op in node.node_ops) {\n node_ops[op] = wrap_node_ops[op] || node.node_ops[op];\n }\n node.node_ops = node_ops;\n\n var stream_ops = {};\n for (var op in node.stream_ops) {\n stream_ops[op] = wrap_stream_ops[op] || node.stream_ops[op];\n }\n node.stream_ops = stream_ops;\n }\n\n function filter(node) {\n var result = {};\n for (var key in node) {\n if (props.indexOf(key) !== -1) {\n result[key] = node[key];\n }\n }\n\n if (node.contents) {\n if (node.contents.length) {\n result.contents = Array.apply([], node.contents);\n } else {\n result.contents = {};\n for (var name in node.contents) {\n result.contents[name] = filter(node.contents[name]);\n }\n }\n }\n\n return result;\n }\n\n function save(node) {\n if (node.node) {\n node = node.node;\n }\n\n var mount = node.mount;\n if (!mount || !mount.opts || !mount.opts.key) {\n return;\n }\n\n try {\n localStorage.setItem(mount.opts.key, JSON.stringify(filter(mount.root)));\n } catch (err) {}\n }\n\n function mount(mount) {\n if (!mount.opts || !mount.opts.key) {\n return;\n }\n\n var data;\n try {\n data = localStorage.getItem(mount.opts.key);\n } catch (err) {}\n if (data) {\n try {\n data = JSON.parse(data);\n } catch (err) {}\n }\n\n var node = MEMFS.mount(mount);\n setupNode(node);\n load(node, mount, data);\n\n return node;\n }\n\n function load(node, mount, data) {\n node.mount = mount;\n if (!data) {\n return;\n }\n for (var key in data) {\n if (props.indexOf(key) !== -1) {\n node[key] = data[key];\n }\n }\n if (data.contents) {\n if (data.contents.length) {\n node.contents = data.contents;\n } else {\n node.contents = {};\n for (var name in data.contents) {\n var childData = data.contents[name];\n var childNode = wrapCreateNode(node, name, childData.mode, childData.rdev);\n load(childNode, mount, childData);\n }\n }\n }\n }\n}", "function touch_dir (dirname, op, fcb) {\n\tfs.readdir(dirname, function(err, files){\n\t\tif (err) {\n\t\t\tconsole.log('failed to read : ' + dirname);\n\t\t\tthrow err;\n\t\t}\n\t\ttouch_file(dirname, files, op, fcb);\n\t});\n}", "function DebugFS(device)\n{\n if(!(this instanceof DebugFS)) return new DebugFS(device)\n\n\n function exec(request, write, callback)\n {\n var argv = [device, '-R', request]\n if(write) argv.push('-w')\n\n execFile(DEBUGFS_BIN, argv, callback)\n }\n\n\n this.ls = function(filespec, callback)\n {\n exec('ls -p '+filespec, false, function(error, stdout)\n {\n if(error) return callback(error)\n\n var files = stdout.split('\\n').filter(filterEmpty).map(createStat)\n\n callback(null, files)\n })\n }\n\n this.set_inode_field = function(filespec, field, value, callback)\n {\n exec('set_inode_field '+filespec+' '+field+' '+value, true, callback)\n }\n}", "updateFromNative(aNativeFolder)\n {\n log.config(\"updateFromNative folder \" + aNativeFolder.displayName);\n let needBaseInit = !this._nativeFolder;\n if (this._nativeFolder && (aNativeFolder.folderId != this._nativeFolder.folderId)) {\n log.info(\"folder id changed for \" + aNativeFolder.displayName);\n needBaseInit = true;\n }\n if (!aNativeFolder)\n this.initNativeFolder();\n else\n this._nativeFolder = aNativeFolder;\n\n // As a change in behavior from C++, I will not verify skink as online if native is not.\n this.verifiedAsOnlineFolder = this._nativeFolder.verifiedOnline;\n if (!this._nativeFolder.verifiedOnline)\n log.info(\"Updating skink folder '\" + this.name + \"' from an unverified native folder\");\n let localFolderId = this.folderId;\n let ewsFolderId = this._nativeFolder.folderId;\n if (!ewsFolderId)\n log.warn(\"empty ews folderId\");\n if (localFolderId != ewsFolderId)\n {\n if (localFolderId)\n {\n log.warn(\"local FolderId does not match ews folderId\");\n }\n if (ewsFolderId)\n this.folderId = ewsFolderId;\n else\n log.warn(\"Should I be resetting a non-blank folderId (I did not here!)?\");\n }\n\n // also update distinguished folder id if present\n let colonialDFolderId = this.distinguishedFolderId;\n if (colonialDFolderId != this._nativeFolder.distinguishedFolderId)\n {\n if (colonialDFolderId)\n log.warn(\"Native distinguished folder id does not match colonial, was: \" + colonialDFolderId +\n \" is : \" + this._nativeFolder.distinguishedFolderId);\n this.distinguishedFolderId = this._nativeFolder.distinguishedFolderId;\n }\n\n if (needBaseInit) {\n this.initNativeFolder();\n }\n\n // Figure out if this URI is invalid\n let did = this.distinguishedFolderId;\n try { // let this fail and continue\n if (did && this.parent && this.parent.isServer) {\n log.config(\"Found folder with distinguishedId \" + did);\n let localName = \"\";\n if (did == \"junkemail\")\n localName = \"Junk\";\n else if (did == \"deleteditems\")\n localName = \"Trash\";\n else if (did == \"drafts\")\n localName = \"Drafts\";\n else if (did == \"sentitems\")\n localName = \"Sent\";\n else if (did == \"inbox\")\n localName = \"Inbox\";\n else if (did == \"archivemsgfolderroot\")\n localName = \"Archives\";\n else if (did == \"outbox\")\n localName = \"Unsent Messages\";\n if (localName) {\n // does this match the leaf URI?\n let myURI = this.URI;\n let canonicalURI = this.server.serverURI + \"/\" + encodeURIComponent(localName);\n log.config(\"myURI is \" + myURI + \" canonicalURI is \" + canonicalURI);\n if (myURI != canonicalURI) {\n log.warn(\"Flagging folder for rename with incorrect URI\");\n let oldName = this.filePath.leafName;\n log.config(\"oldName is \" + oldName + \" for localName \" + localName);\n let renameFile = this.filePath.parent.clone();\n renameFile.append(oldName + \".\" + localName + \".rename\");\n renameFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);\n }\n }\n }\n } catch(ex) {\n log.info(\"Failed to create rename file for folder \" + this.name + \" \" + ex);\n }\n\n let flags = this.flags;\n // set message folder flags for distinguished folders\n if (this.distinguishedFolderId)\n {\n let did = this.distinguishedFolderId;\n flags = forceBit(flags, Ci.nsMsgFolderFlags.Trash, did == \"deleteditems\");\n flags = forceBit(flags, Ci.nsMsgFolderFlags.Drafts, did ==\"drafts\");\n flags = forceBit(flags, Ci.nsMsgFolderFlags.SentMail, did == \"sentitems\");\n flags = forceBit(flags, Ci.nsMsgFolderFlags.Queue, did == \"outbox\");\n flags = forceBit(flags, Ci.nsMsgFolderFlags.Inbox, did == \"inbox\");\n flags = forceBit(flags, Ci.nsMsgFolderFlags.Junk, did == \"junkemail\");\n }\n\n // note which are email folders\n let folderClass = this._nativeFolder.folderClass;\n flags = forceBit(flags, Ci.nsMsgFolderFlags.Mail,\n (folderClass = \"IPF.StickyNote\" ||\n folderClass.substr(0, 8) == \"IPF.Note\"));\n this.flags = flags;\n\n let nativeName = this._nativeFolder.displayName;\n log.debug(\"msqEwsMailFolder.updateFromNative folder \" + nativeName);\n // Early TB 52 may have set a bad value in folderName. We aren't\n // using that any more.\n //{\n // let folderInfoObject = {};\n // let db = this.getDBFolderInfoAndDB(folderInfoObject);\n // let folderInfo = folderInfoObject.value;\n // folderInfo.folderName = \"\";\n //}\n // We store the folder name in a JSON file owned by the server.\n if (!this.isServer) {\n let exqServer = safeGetJS(this.server, \"EwsIncomingServer\");\n if (exqServer.getDisplayName(this.URI) != nativeName)\n exqServer.setDisplayName(this.URI, nativeName);\n this.prettyName = nativeName;\n }\n\n // glue from native folder to mail folder\n this._nativeFolder.folderURI = this.URI;\n\n // correct the counts. Use pending counts for any difference between the\n // reported folder count, and the local db-related count.\n\n // So how will I handle non-mail items here? Ultimately I want the counts to reflect\n // only mail items, since I do not display other items. But I also\n // want visible folder counts to change when all we have is folder info, but have not\n // downloaded the items. What to do?\n\n // I added the ability to display a generic item as a \"message\". Still need to fix the UI to\n // make sure that we don't act on it like a message though.\n\n let nativeUnreadCount = this._nativeFolder.unreadCount;\n let skinkUnreadCount = this.getNumUnread(false); // This includes pending\n if (skinkUnreadCount < 0)\n log.warn(\"mNumUnreadMessages not initialized\");\n else if (nativeUnreadCount != skinkUnreadCount) {\n this.changeNumPendingUnread(nativeUnreadCount - skinkUnreadCount);\n }\n\n let nativeTotalCount = this._nativeFolder.totalCount;\n let skinkTotalCount = this.getTotalMessages(false); // This includes pending.\n if (skinkTotalCount < 0)\n log.warn(\"mNumPendingTotalMessages not initialized\");\n else if (skinkTotalCount != nativeTotalCount) {\n this.changeNumPendingTotalMessages(nativeTotalCount - skinkTotalCount);\n }\n\n // Now we will go through all of the existing children of this mail folder,\n // updating child from native if found, otherwise deleting the mail folder child.\n // Then new mail children will be created for natives with no existing local\n // folder.\n\n let mailbox = this.nativeMailbox;\n let folderIds = this._nativeFolder.subfolderIds;\n log.config(\"folder \" + this._nativeFolder.displayName + \" has \" + folderIds.length + \" native subfolders\" +\n \" and \" + this._nativeFolder.totalCount + \" total messages\");\n for (let childSkinkFolder of this.subFolders) {\n let childEwsMailFolder = safeGetJS(childSkinkFolder, \"EwsMsgFolder\");\n // ToDo: I need to store the needed folder info in the cache, so\n // that I do not have to open each folder db\n let dbIsOpen = childSkinkFolder.isOpen;\n // Don't check virtual folders\n if (childSkinkFolder.getFlag(Ci.nsMsgFolderFlags.Virtual)) {\n if (!dbIsOpen)\n childSkinkFolder.msgDatabase = null;\n continue;\n }\n let childLocalFolderId = childEwsMailFolder.distinguishedFolderId ||\n childEwsMailFolder.folderId;\n // If the folderId is still empty, then perhaps this is a special folder, and I need to\n // match it with a particular distinguished folder. SpamSettings will create these.\n if (!childLocalFolderId)\n {\n if (childSkinkFolder.getFlag(Ci.nsMsgFolderFlags.Junk))\n childLocalFolderId = \"junkemail\";\n }\n\n // XXX ToDo: I really need to only get the native child if it exists, so that I\n // don't create and cache a folder that I cannot use.\n let nativeChildFolder = mailbox.getNativeFolder(childLocalFolderId);\n // native child might be missing if native folder was deleted externally\n\n // If the native folder is not verified, then search through native folder\n // space trying to find it.\n if (!nativeChildFolder.verifiedOnline)\n {\n log.warn(\"folder not verified online, trying to locate\");\n let foundMatchingFolder = false;\n let length = 0;\n if (folderIds)\n length = folderIds.length;\n let testNativeFolder = null;\n let foundNativeFolder = null;\n let testFolderId = \"\";\n for (let j = 0; j < length; j++)\n {\n testFolderId = folderIds.getAt(j);\n testNativeFolder = mailbox.getNativeFolder(testFolderId);\n foundNativeFolder = testNativeFolder;\n let testMailFolder = childSkinkFolder;\n while (testMailFolder && testNativeFolder)\n {\n //log.debug(\"Comparing \" + testMailFolder.name + \" to \" + testNativeFolder.displayName);\n // if both are the root, we are done\n //log.debug(\"isServer? \" + testMailFolder.isServer +\n // \" native root? \" + (testNativeFolder ? testNativeFolder.distinguishedFolderId == \"msgfolderroot\" : false));\n if (testMailFolder && testMailFolder.isServer &&\n testNativeFolder && testNativeFolder.distinguishedFolderId == \"msgfolderroot\") {\n foundMatchingFolder = true;\n break;\n }\n else {\n //log.debug(\"Not root folder\");\n }\n if (testMailFolder.name != testNativeFolder.displayName) {\n //log.debug(\"names don't match\");\n break;\n }\n // this must also be a verified folder\n if (!testNativeFolder.verifiedOnline) {\n //log.debug(\"not verified\");\n break;\n }\n\n // also check the parents\n testMailFolder = testMailFolder.parent;\n if (testNativeFolder.parentFolderId)\n testNativeFolder = mailbox.getNativeFolder(testNativeFolder.parentFolderId);\n else {\n //log.debug(\"native has no parent\");\n testNativeFolder = null;\n }\n }\n if (foundMatchingFolder)\n break;\n }\n if (!foundMatchingFolder || !foundNativeFolder) {\n log.warn(\"Did not find matching folder\");\n }\n else\n {\n log.info(\"Found matching folder\");\n nativeChildFolder = foundNativeFolder;\n childEwsMailFolder.folderId = nativeChildFolder.folderId;\n }\n }\n\n let childClass = nativeChildFolder.folderClass;\n let parentFolderId = nativeChildFolder.parentFolderId;\n\n // I'm going to show folder with empty class as well, since I proved earlier it\n // is possible to create them!\n if ( (ewsFolderId == parentFolderId) &&\n !childClass.startsWith(\"IPF.Note.SocialConnector\") && // News Feed\n !childClass.startsWith(\"IPF.Note.OutlookHomepage\") && // RSS Feeds\n ( childClass.substring(0, 8) == \"IPF.Note\" ||\n childClass == \"IPF.StickyNote\" ||\n !childClass))\n {\n childEwsMailFolder.updateFromNative(nativeChildFolder);\n childSkinkFolder.updateSummaryTotals(false);\n }\n else\n {\n // Delete any folders that have no matching native.\n //\n // Occasionally I get a strange bug that deletes all folders. Then I cannot do\n // an expand! So I'll never delete the inbox\n if (!childSkinkFolder.getFlag(Ci.nsMsgFolderFlags.Inbox))\n {\n log.config(\"local folder not found in native, deleting\", childSkinkFolder.prettyName);\n try {\n this.propagateDelete(childSkinkFolder, true, null);\n }\n catch(e) {\n log.warn(\"subfolder delete failed for \" + childSkinkFolder.prettyName + \" \" + e);\n }\n }\n else\n log.warn(\"Wanted to delete the inbox, but that can't be right!\");\n }\n // close any dbs we opened\n if (!dbIsOpen)\n childSkinkFolder.msgDatabase = null;\n }\n\n // Now we are going to go through the native folder's children,\n // creating and updating if needed from local\n\n if (folderIds)\n {\n for (let i = 0; i < folderIds.length; i++)\n {\n let childNativeFolder = mailbox.getNativeFolder(folderIds.getAt(i));\n let childMsgFolder = null;\n if (childNativeFolder.folderURI)\n {\n childMsgFolder = Utils.getExistingFolder(childNativeFolder.folderURI);\n if (!childMsgFolder)\n log.config(\"Did not find existing child folder with URL \" + childNativeFolder.folderURI);\n }\n let childDisplayName = childNativeFolder.displayName\n let childClass = childNativeFolder.folderClass;\n if (!childMsgFolder &&\n this._useMail &&\n !childClass.startsWith(\"IPF.Note.SocialConnector\") && // News Feed\n !childClass.startsWith(\"IPF.Note.OutlookHomepage\") && // RSS Feeds\n ( childClass.substring(0, 8) == \"IPF.Note\" ||\n childClass ==\"IPF.StickyNote\" ||\n !childClass)) // this folder not updated from locals\n {\n log.config(\"need to add child folder \" + childDisplayName);\n let childMailFolder;\n try {\n try {\n childMailFolder = this.getChildNamed(childDisplayName);\n }\n catch (e) {\n let childLocalName = childDisplayName;\n // Certain folders need to have standard URIs to properly work\n // with Skink. Adjust those names.\n let childDId = childNativeFolder.distinguishedFolderId;\n if (childDId) {\n log.config(\"Found folder with distinguishedId \" + childDId + \" name \" + childDisplayName);\n if (childDId == \"junkemail\")\n childLocalName = \"Junk\";\n else if (childDId == \"deleteditems\")\n childLocalName = \"Trash\";\n else if (childDId == \"drafts\")\n childLocalName = \"Drafts\";\n else if (childDId == \"sentitems\")\n childLocalName = \"Sent\";\n else if (childDId == \"inbox\")\n childLocalName = \"Inbox\";\n else if (childDId == \"archivemsgfolderroot\")\n childLocalName = \"Archives\";\n else if (childDId == \"outbox\")\n childLocalName = \"Unsent Messages\";\n else if (childDId == \"notes\")\n childLocalName = \"Notes\";\n // EWS has no notion of a Templates folder\n }\n childMailFolder = this.addSubfolder(childLocalName);\n childMailFolder.prettyName = childDisplayName;\n }\n }\n catch (e) {\n log.config(\"AddSubfolder failed, folder name is \" + childDisplayName);\n }\n if (childMailFolder)\n {\n if (!childMailFolder.getFlag(Ci.nsMsgFolderFlags.Virtual))\n {\n // GetSubFolders does some critical initialization. We will do a dummy call,\n // otherwise AddSubfolders ends up calling itself during that initialization.\n // This should really be cleaned up instead of doing this fragile kludge.\n childMailFolder.subFolders;\n\n let childEwsMailFolder = safeGetJS(childMailFolder, \"EwsMsgFolder\");\n childEwsMailFolder.updateFromNative(childNativeFolder);\n childMailFolder.updateSummaryTotals(false);\n }\n\n // We don't want to leave lots of databases open\n if (childMailFolder.databaseOpen) {\n let database = childMailFolder.msgDatabase;\n if (database)\n {\n database.Commit(Ci.nsMsgDBCommitType.kLargeCommit);\n childMailFolder.msgDatabase = null;\n database = null;\n }\n }\n }\n }\n else if (childClass.substring(0, 15) == \"IPF.Appointment\")\n {\n // add this calendar if needed\n this._addCalendarFromNativeFolder(childNativeFolder);\n }\n }\n }\n else\n EWS_LOG_WARN(\"folderIds is missing\");\n\n }", "function resolveOnSuccess(entry){ \n var d = new Date();\n var n = d.getTime();\n pos = 0;\n // window.resolveLocalFileSystemURI(\"file:///storage//sdcard/EasyPacking\", onResolveSuccess2, fail2);\n console.log(\"now in move pic\");\n //new file name\n newFileName = \"000001_\" + n + \".jpg\";\n var myFolderApp = \"EasyPacking\";\n\n window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) { \n //The folder is created if doesn't exist\n fileSys.root.getDirectory( myFolderApp,\n {create:true, exclusive: false},\n function(directory) {\n entry.moveTo(directory, newFileName, successMove, resOnError);\n },\n resOnError);\n },\n resOnError);\n \n}", "async _update() {\n if (!this._prevent) {\n this._prevent = true;\n let resolveUpdate;\n this.updated = new Promise((resolve) => (resolveUpdate = resolve));\n\n await this.mounted;\n\n this._prevent = false;\n this.update();\n\n resolveUpdate();\n }\n }", "componentDidMount() {\n this._isMounted = true;\n this.getLocation();\n this.getGame();\n }", "updateMetafile (old_position, entry, callback) {\n this.appendMetafile(entry, (err) => {\n if (err) {\n callback(err)\n } else {\n this.deleteFileEntry(old_position, (err) => {\n callback(err)\n })\n }\n })\n }", "syncFile(sourcePath, targetPath) {\n if (fsx.existsSync(sourcePath)) {\n console.log('Updating ' + targetPath);\n fsx.copySync(sourcePath, targetPath);\n }\n else {\n if (fsx.existsSync(targetPath)) {\n console.log('Deleting ' + targetPath);\n fsx.unlinkSync(targetPath);\n }\n }\n }", "start () {\n console.log('backup start', this.dirs.length)\n\n // start monitor file changes\n this.startMonitor()\n\n // start calculation of speed and broadcast status\n this.startCalcSpeed()\n\n this.status = 'Idle'\n this.dirty = true\n this.isAborted = false\n this.run()\n }", "[_changePath] (newPath) {\n // have to de-list before changing paths\n this[_delistFromMeta]()\n const oldPath = this.path\n this.path = newPath\n const namePattern = /(?:^|\\/|\\\\)node_modules[\\\\/](@[^/\\\\]+[\\\\/][^\\\\/]+|[^\\\\/]+)$/\n const nameChange = newPath.match(namePattern)\n if (nameChange && this.name !== nameChange[1])\n this.name = nameChange[1].replace(/\\\\/g, '/')\n\n // if we move a link target, update link realpaths\n if (!this.isLink) {\n this.realpath = newPath\n for (const link of this.linksIn) {\n link[_delistFromMeta]()\n link.realpath = newPath\n link[_refreshLocation]()\n }\n }\n // if we move /x to /y, then a module at /x/a/b becomes /y/a/b\n for (const child of this.fsChildren)\n child[_changePath](resolve(newPath, relative(oldPath, child.path)))\n for (const [name, child] of this.children.entries())\n child[_changePath](resolve(newPath, 'node_modules', name))\n\n this[_refreshLocation]()\n }", "function snapshot(cli, device, config) {\n\t\n\tvar configCleanup = function(config) {\n\t\tvar p = config.search(/^(set|unset) /m);\n\t\tif (p > 0) {\n\t\t\tconfig = config.slice(p);\n\t\t}\n\t\treturn config;\n\t};\n\t\n\tcli.macro(\"operate\");\n\tvar getSystem = cli.command(\"get system\");\n\tvar getConfig = cli.command(\"get config\", { timeout: 120000 });\n\tvar configuration = configCleanup(getConfig);\n\t\n\tconfig.set(\"configuration\", configuration);\n\t\n\tvar location = configuration.match(/^set snmp location (\"(.+)\"|(.+))$/m);\n\tlocation = location ? (location[2] || location[3]) : \"\";\n\tdevice.set(\"location\", location);\n\tvar contact = configuration.match(/^set snmp contact (\"(.+)\"|(.+))$/m);\n\tcontact = contact ? (contact[2] || contact[3]) : \"\";\n\tdevice.set(\"contact\", contact);\n\t\n\tvar hostname = configuration.match(/^set hostname (.+)$/m);\n\tif (hostname) {\n\t\tdevice.set(\"name\", hostname[1]);\n\t}\n\t\n\tvar version = getSystem.match(/Software Version: ([0-9\\.r]+)/m);\n\tif (version != null) {\n\t\tdevice.set(\"softwareVersion\", version[1]);\n\t\tconfig.set(\"screenOsVersion\", version[1]);\n\t}\n\telse {\n\t\tdevice.set(\"softwareVersion\", \"Unknown\");\n\t\tconfig.set(\"screenOsVersion\", \"Unknown\");\n\t}\n\t\n\tvar fileName = getSystem.match(/File Name: (.+?), /m);\n\tif (fileName) {\n\t\tconfig.set(\"screenOsFileName\", fileName[1]);\n\t}\n\t\n\tdevice.set(\"networkClass\", \"FIREWALL\");\n\n\tvar productName = getSystem.match(/Product Name: (.*)/m);\n\tif (productName) {\n\t\tdevice.set(\"family\", productName[1].replace(/\\-/g, \" \"));\n\t}\n\telse {\n\t\tdevice.set(\"family\", \"NetScreen\");\n\t}\n\t\n\tvar serialNumber = getSystem.match(/Serial Number: (.+?),/m);\n\tif (serialNumber) {\n\t\tdevice.set(\"serialNumber\", serialNumber[1]);\n\t\tdevice.add(\"module\", {\n\t\t\tslot: \"Chassis\",\n\t\t\tpartNumber: productName ? productName[1] : \"NetScreen\",\n\t\t\tserialNumber: serialNumber[1]\n\t\t});\n\t}\n\t\n\tvar licenseKey = cli.command(\"get license-key\");\n\tconfig.set(\"licenseKey\", licenseKey);\n\t\n\tvar disabledInterfaces = [];\n\tvar disabledIntPattern = /^set interface (.+) phy link-down/mg;\n\tvar match;\n\twhile (match = disabledIntPattern.exec(configuration)) {\n\t\tdisabledInterfaces.push(match[1]);\n\t}\n\t\n\tvar interfaces = cli.findSections(getSystem, /^Interface (.+):/m);\n\tfor (var i in interfaces) {\n\t\tvar networkInterface = {\n\t\t\tname: interfaces[i].match[1],\n\t\t\tip: []\n\t\t};\n\t\tif (disabledInterfaces.indexOf(networkInterface.name) > -1) {\n\t\t\tnetworkInterface.enabled = true;\n\t\t}\n\t\tvar description = interfaces[i].config.match(/^ *description (.+)/m);\n\t\tif (description) {\n\t\t\tnetworkInterface.description = description[1];\n\t\t}\n\t\tvar zone = interfaces[i].config.match(/^ *vsys (.+), zone (.+), vr (.+)$/m);\n\t\tif (zone) {\n\t\t\tnetworkInterface.virtualDevice = zone[1];\n\t\t\tnetworkInterface.vrf = zone[3];\n\t\t}\n\t\tvar ipPattern = /^ *(\\*)?ip (\\d+\\.\\d+\\.\\d+\\.\\d+)\\/(\\d+)/mg;\n\t\twhile (match = ipPattern.exec(interfaces[i].config)) {\n\t\t\tvar ip = {\n\t\t\t\tip: match[2],\n\t\t\t\tmask: parseInt(match[3]),\n\t\t\t\tusage: \"PRIMARY\"\n\t\t\t};\n\t\t\tnetworkInterface.ip.push(ip);\n\t\t}\n\t\tvar macAddress = interfaces[i].config.match(/mac ([0-9a-fA-F]{4}\\.[0-9a-fA-F]{4}\\.[0-9a-fA-F]{4})/);\n\t\tif (macAddress) {\n\t\t\tnetworkInterface.mac = macAddress[1];\n\t\t}\n\t\tdevice.add(\"networkInterface\", networkInterface);\n\t}\n\n}", "static bindVolume(sourcePath, targetPath) {\n return {\n bind(_volumeInfo) {\n return {\n type: 'bind',\n source: sourcePath,\n target: targetPath,\n };\n },\n };\n }", "manageBucketPointer(){\n if (fs.existsSync(this.file_bucket_path)) {\n let data=fs.readFileSync(this.file_bucket_path);\n this.bucket=JSON.parse(data);\n this.updateFilePointerBucket();\n }else{\n this.createFilePointerBucket();\n } \n }", "set_mountPosition(position, orientation) {\n this.liveFunc.set_mountPosition(position, orientation);\n return _yocto_api.YAPI_SUCCESS;\n }", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "refresh () {\n const provider = this.fileProviderOf('/')\n // emit folderAdded so that File Explorer reloads the file tree\n provider.event.emit('folderAdded', '/')\n }", "mount(scope, parentScope) {\n return this.update(scope, parentScope)\n }", "updateContent({ state, commit, getters, dispatch }, { response, oldDir, commitName, type }) {\n // if operation success\n if (response.data.result.status === 'success' && oldDir === getters.selectedDirectory) {\n // add/update file/folder in to the files/folders list\n commit(`${state.activeManager}/${commitName}`, response.data[type]);\n // repeat sort\n dispatch('repeatSort', state.activeManager);\n\n // if tree module is showing\n if (type === 'directory' && state.settings.windowsConfig === 2) {\n // update tree module\n dispatch('tree/addToTree', {\n parentPath: oldDir,\n newDirectory: response.data.tree,\n });\n\n // if both managers show the same folder\n } else if (\n state.settings.windowsConfig === 3 &&\n state.left.selectedDirectory === state.right.selectedDirectory &&\n state.left.selectedDisk === state.right.selectedDisk\n ) {\n // add/update file/folder in to the files/folders list (inactive manager)\n commit(`${getters.inactiveManager}/${commitName}`, response.data[type]);\n // repeat sort\n dispatch('repeatSort', getters.inactiveManager);\n }\n }\n }", "async function updateFile(fname, fullflag){\n let data_idx\n let KeyVal\n let missing\n let hbuf\n // Get data.edt ALLES oder TEIL\n data_idx = findFileInDir(fname)\n if(data_idx>=0){\n //console.log(\"Upload 'data.edt'\")\n await blStore.get(blxIDs.deviceMAC + '_' + fname)\n KeyVal = blStore.result() // undefined opt.\n if(KeyVal === undefined || fullflag === true ){ // Nix da oder explizit: ALLES holen\n await getfile([0, fname], false)\n if(blxErrMsg) return\n }else{\n missing = blxIDs.disk.files[data_idx].len - KeyVal.v.akt_len\n if(missing>0){\n // console.log(\"Gibt es tw. schon: \" + KeyVal.v.akt_len + \" Fehlt: \" + missing)\n if(blxUserCB) blxUserCB('GET',missing,fname) \n\n terminalPrint('Get File (Missing Part) \"' + fname + '\": Len: ' + missing + ' Bytes')\n await getSubFile(fname, KeyVal.v.akt_len, missing) // File, Pos, Ende\n if (blxErrMsg) return\n if( infile_bytebuf.length !== missing){\n blxErrMsg = 'ERROR(upload): Read Len'\n return\n }\n // console.log(\"OK\" , infile_bytebuf, infile_file_len, infile_bytebuf.length)\n hbuf = new Uint8Array(KeyVal.v.bytebuf.length + missing)\n hbuf.set(KeyVal.v.bytebuf)\n hbuf.set(infile_bytebuf, KeyVal.v.bytebuf.length)\n KeyVal.v.bytebuf = hbuf\n KeyVal.v.total_len += missing\n KeyVal.v.akt_len += missing\n // Write Back to Store\n //console.log(\"NewL: \", KeyVal.v.bytebuf.length)\n try{\n await blStore.set(KeyVal.k,KeyVal.v)\n } catch(err){\n blxErrMsg = 'ERROR(upload): ' + err\n }\n }\n }\n } else blxErrMsg='' // set by findFileInDir\n }", "componentDidMount() {\n this.pullServer();\n }", "function update() {\n updaters.forEach(function (f) { f(); });\n }", "function testUpdateSubElementsFromList() {\n // Creates elements.\n var parentElement = document.createElement('div');\n var directoryTree = document.createElement('div');\n parentElement.appendChild(directoryTree);\n\n // Creates mocks.\n var directoryModel = new MockDirectoryModel();\n var volumeManager = new MockVolumeManagerWrapper();\n var fileOperationManager = {\n addEventListener: function(name, callback) {}\n };\n\n // Sets entry which is returned by\n // window.webkitResolveLocalFileSystemURLResults.\n var driveFileSystem = volumeManager.volumeInfoList.item(0).fileSystem;\n window.webkitResolveLocalFileSystemURLEntries['filesystem:drive/root'] =\n new MockDirectoryEntry(driveFileSystem, '/root');\n\n DirectoryTree.decorate(directoryTree, directoryModel, volumeManager,\n null, fileOperationManager, true);\n directoryTree.dataModel = new MockNavigationListModel(volumeManager);\n directoryTree.updateSubElementsFromList(true);\n\n // There are 2 volumes, Drive and Downloads, at first.\n assertArrayEquals([\n str('DRIVE_DIRECTORY_LABEL'),\n str('DOWNLOADS_DIRECTORY_LABEL')\n ], getDirectoryTreeItemLabelsAsAList(directoryTree));\n\n // Mounts a removable volume.\n var removableVolume = MockVolumeManagerWrapper.createMockVolumeInfo(\n VolumeManagerCommon.VolumeType.REMOVABLE,\n 'removable',\n str('REMOVABLE_DIRECTORY_LABEL'));\n volumeManager.volumeInfoList.push(removableVolume);\n\n // Asserts that the directoryTree is not updated before the update.\n assertArrayEquals([\n str('DRIVE_DIRECTORY_LABEL'),\n str('DOWNLOADS_DIRECTORY_LABEL')\n ], getDirectoryTreeItemLabelsAsAList(directoryTree));\n\n // Asserts that a removable directory is added after the update.\n directoryTree.updateSubElementsFromList(false);\n assertArrayEquals([\n str('DRIVE_DIRECTORY_LABEL'),\n str('DOWNLOADS_DIRECTORY_LABEL'),\n str('REMOVABLE_DIRECTORY_LABEL')\n ], getDirectoryTreeItemLabelsAsAList(directoryTree));\n\n // Mounts an archive volume before the removable directory.\n var archiveVolume = MockVolumeManagerWrapper.createMockVolumeInfo(\n VolumeManagerCommon.VolumeType.ARCHIVE,\n 'archive',\n str('ARCHIVE_DIRECTORY_LABEL'));\n volumeManager.volumeInfoList.splice(2, 0, archiveVolume);\n\n // Asserts that the directoryTree is not updated before the update.\n assertArrayEquals([\n str('DRIVE_DIRECTORY_LABEL'),\n str('DOWNLOADS_DIRECTORY_LABEL'),\n str('REMOVABLE_DIRECTORY_LABEL')\n ], getDirectoryTreeItemLabelsAsAList(directoryTree));\n\n // Asserts that an archive directory is added before the removable directory.\n directoryTree.updateSubElementsFromList(false);\n assertArrayEquals([\n str('DRIVE_DIRECTORY_LABEL'),\n str('DOWNLOADS_DIRECTORY_LABEL'),\n str('ARCHIVE_DIRECTORY_LABEL'),\n str('REMOVABLE_DIRECTORY_LABEL')\n ], getDirectoryTreeItemLabelsAsAList(directoryTree));\n\n // Deletes an archive directory.\n volumeManager.volumeInfoList.splice(2, 1);\n\n // Asserts that the directoryTree is not updated before the update.\n assertArrayEquals([\n str('DRIVE_DIRECTORY_LABEL'),\n str('DOWNLOADS_DIRECTORY_LABEL'),\n str('ARCHIVE_DIRECTORY_LABEL'),\n str('REMOVABLE_DIRECTORY_LABEL')\n ], getDirectoryTreeItemLabelsAsAList(directoryTree));\n\n // Asserts that an archive directory is deleted.\n directoryTree.updateSubElementsFromList(false);\n assertArrayEquals([\n str('DRIVE_DIRECTORY_LABEL'),\n str('DOWNLOADS_DIRECTORY_LABEL'),\n str('REMOVABLE_DIRECTORY_LABEL')\n ], getDirectoryTreeItemLabelsAsAList(directoryTree));\n}", "function testGoodUpdate (cb) {\n function checkNewComponent (component) {\n t.ok(component, 'component ok')\n fns._uncache(goodOriginPath)\n var expectedFn = require(goodOriginPath)\n t.deepEqual(component._fn.toString(), expectedFn.toString(), 'component._fn is what we\\'d expect from new path')\n componentS.offValue(checkNewComponent)\n cb()\n }\n componentS.onValue(checkNewComponent)\n // copy origin2 to origin1\n utils.copyFile(goodOriginPath2, goodOriginPath, () => {\n t.ok(true, 'copied file')\n })\n }", "function maybeSync(localPath, name, rest) {\n var stats = fs.statSync(localPath);\n if (!stats.isFile(localPath)) {\n return;\n }\n var source = fs.realpathSync(path.join(jlab.linkedPackages[name], rest));\n if (source === localPath) {\n return;\n }\n fs.watchFile(source, { 'interval': 500 }, function(curr) {\n if (!curr || curr.nlink === 0) {\n return;\n }\n try {\n console.log('updating', path.join(name, rest));\n fs.copySync(source, localPath);\n } catch (err) {\n console.error(err);\n }\n });\n}", "function modifyServer1(fct, path, args, processRes) {\n callServer(\"modify\", fct, [path, args], processRes, showError, noop);\n}", "async open(){\n await this.storage.start()\n await this.keychain.open()\n await this.touchDir('/buckets')\n }", "function refreshWorkingDir(){\n\tdetachPlayer();\n $.get(fsurl+'?operation=get_node', { 'path' : workingDir})\n .done(function (d) {\n renderFilesTable(d);\n renderBreadcrumb();\n })\n .fail(function () {\n console.log('problem refreshing');\n });\n if (!clipboard.hasOwnProperty('nodes')) $(\"#ff-actions\").slideUp();\n}", "startMonitor () {\n this.watchers.length = 0\n this.dirs.forEach((dir) => {\n let watcher\n try {\n watcher = fs.watch(path.resolve(dir.metadata.localPath), { recursive: true }, () => {\n this.dirty = true\n setTimeout(() => this.run(), 0) // start backup 3s later\n })\n } catch (e) {\n console.warn('watch file error', e)\n return\n }\n this.watchers.push(watcher)\n })\n }", "update () {}", "updateShotMetadata(shotId, metadata) {\r\n\t \r\n }", "update(startingData) {}", "function resolveOnSuccess2(entry){ \n\tvar newFileName = NumeroFormulario +\".jpg\";\n\t\n window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) { \n //The folder is created if doesn't exist\n fileSys.root.getDirectory( AppFolder,\n {create:true, exclusive: false},\n function(directory) {\n entry.moveTo(directory, newFileName, successMove2, resOnError2);\n },\n resOnError2);\n },\n resOnError2);\n}", "updateDriveSpecificIcons() {}", "updateDriveSpecificIcons() {}", "async function moveFileAndUpdate() {\n const toMoveFile = r(tSrcDir, 'toMove/moveFile.js');\n const srcFileDest = r(tSrcDir, 'services/moveFile.service.js');\n const outFile = r(tOutDir, 'services/moveFile.service.js');\n\n await rename(toMoveFile, srcFileDest);\n\n await listenToRestart(execOutput.data.childProcess, 'moveFileAndUpdate');\n\n const movedSrcFileContent = await readFile(\n srcFileDest,\n 'Failed reading test_space/src/services/moveFile.service.js.',\n );\n\n const outFileContent = await readFile(\n outFile,\n 'Failed reading test_space/src/services/moveFile.service.js.',\n );\n\n sm.snap('services:l1:move:moveFile.service:restart', {\n toMoveFile,\n srcFileDest,\n outFile,\n movedSrcFileContent,\n outFileContent,\n });\n\n // Update the the copied file to check that now the rebuild work smooth\n const updatedContent = movedSrcFileContent.replace(\n 'MOVE_FILE_V1',\n 'MOVE_FILE_V2',\n );\n\n await writeFile(srcFileDest, updatedContent);\n\n await listenToRestart(execOutput.data.childProcess, 'moveFileAndUpdate-2');\n\n const moveFileOutContent = await readFile(\n srcFileDest,\n 'Failed reading test_space/dist/services/moveFile.service.js.',\n );\n\n sm.snap('services:l1:move:moveFile.service:update:restart', {\n srcFile: srcFileDest,\n outFile,\n srcContent: movedSrcFileContent,\n outContent: moveFileOutContent,\n });\n }", "updateToSanta() {}", "function resolveOnSuccess(entry){ \n //var d = new Date();\n //var n = d.getTime();\n //var newFileName = n + \".jpg\";\n\tvar newFileName = doc + tipo +\".jpg\";\n\t\n window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) { \n //The folder is created if doesn't exist\n fileSys.root.getDirectory( AppFolder+\"/\"+ImagesFolder,\n {create:true, exclusive: false},\n function(directory) {\n entry.moveTo(directory, newFileName, successMove, resOnError);\n },\n resOnError);\n },\n resOnError);\n}" ]
[ "0.6421369", "0.5920005", "0.5920005", "0.5920005", "0.5920005", "0.5920005", "0.5920005", "0.58055687", "0.57791233", "0.5757512", "0.56378126", "0.55582285", "0.55403215", "0.544868", "0.5441643", "0.5405954", "0.53650606", "0.5355699", "0.5298498", "0.52887154", "0.5266441", "0.52407354", "0.520045", "0.51847243", "0.51646125", "0.51466954", "0.51451576", "0.5120068", "0.51068825", "0.51040924", "0.50952345", "0.50872564", "0.50750095", "0.504359", "0.5027194", "0.50268644", "0.49971315", "0.49926144", "0.49903405", "0.49831146", "0.49804157", "0.4974781", "0.49664226", "0.4961506", "0.4949448", "0.49405727", "0.49345425", "0.4933111", "0.4933111", "0.4920137", "0.49186411", "0.48981628", "0.4892133", "0.48871827", "0.48823744", "0.48637947", "0.48619634", "0.48502684", "0.48471567", "0.48373598", "0.48214078", "0.48001087", "0.4796917", "0.4792463", "0.47852772", "0.47749156", "0.4770471", "0.4769721", "0.47649407", "0.4763087", "0.4761251", "0.4761251", "0.4761251", "0.4761251", "0.4761251", "0.4761251", "0.4761251", "0.4761251", "0.4761251", "0.47534078", "0.4748017", "0.47444913", "0.47439134", "0.47414166", "0.47353166", "0.47259176", "0.47203594", "0.47190565", "0.47168252", "0.4709242", "0.46954876", "0.46789604", "0.46777454", "0.46743122", "0.4673152", "0.46726623", "0.46717408", "0.46717408", "0.46618897", "0.46567923", "0.46548128" ]
0.0
-1
1. Write a custom function power ( a, b ), to calculate the value of a raised to b.
function Add() { a = 3; b = 4; c = a + b; return c; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function power (a,b){\n var result = Math.pow(a,b)\n return result\n}", "function power(a, b) {\n return Math.pow(a, b)\n}", "function Power(a,b)\n{\nresult=Math.pow(a,b);\nreturn result;\n}", "function power(a, b) {\n var power = Math.pow(a, b);\n return power;\n}", "function myFuntion(a,b){\r\n return Math.pow(a,b)\r\n}", "function raiseToPower(b, e) {\n return Math.pow(b, e);\n}", "function power(x,y) {\n return Math.pow(x,y); \n}", "function power_1(a){return a * a;}", "function raiseToPower(b, e) {\n return Math.pow(b, e);\n }", "function power(a, b) {\n\tvar result = 1;\n\tif (b == undefined) {\n\t\tb = 2;\n\t}\n\tfor (var i = 1; i <= b; i++) {\n\t\tresult = result * a;\n\t}\n\treturn result;\n}", "function power(x,y) {\n return Math.pow(x,y);\n}", "function pow(a, b){ \n var power = 1 \n for(var i=1; i<=b; i++){\n power *= a\n } \n return power\n}", "function power(base, exponent) {\n \n}", "function power(base, exponent) {\n\n}", "function power(x, y) {\n return Math.pow(x, y);\n}", "function power(x, y) {\n return x**y;\n }", "function raiseToPower(n, e) {\nreturn Math.pow(n, e);\n}", "function pow(a,b)\n{\n var ans = 1;\n for (var i =1; i <= b; i++)\n {\n ans = b * ans; \n }\n return ans;\n}", "function pow(a, b) {\n if (typeof b !== \"number\")\n b = 2;\n\n let result = 1;\n for (let i = 0; i < b; i++) {\n result *= a;\n }\n\n return result;\n}", "function power(a, b) {\n return null; \n}", "function myFunction() {\n a = 4;\n b = 3;\n document.getElementById(\"result\").innerHTML = Math.pow(a, b); \n}", "function makepower(power){\n function powerfn(base){\n return Math.pow(base, power) ;\n }\n return powerfn\n}", "function power(a, b) {\n if (b < 0) return NaN;\n if (Math.round(b) != b) return NaN;\n \n let store = 1;\n \n for (let i = 0; i < b; i++) {\n store *= a;\n }\n \n return store;\n }", "function power(b, e) {\n //base case\n if (e === 0) return 1\n\n return b * power(b, e - 1);\n}", "function power(bas, pow){\n if (pow < 1) return 1a; \n return bas * power(bas, pow - 1)\n}", "function power(base){\n var result=1;\n return function(num){\n for(var i=0; i<base; i++){\n result=result*num\n \n }\n \n \n return result\n }\n \n }", "function getPower(b, x) {\n var m = b\n for (var i = 1; i < x; i++) {\n m *= b \n }\n return m\n}", "function power(b, e) {\n // edge case\n // e === 0 => return 1\n if (e === 0) {\n return 1;\n }\n\n // base case\n // if e === 1 => return b\n if (e === 1) {\n return b;\n }\n // recursive case\n // multiply base times power(b, e - 1);\n return b * power(b, e - 1);\n}", "function power (base,exponent){\n var result = base;\n for(var i = 0; i<exponent-1; i++){\n result*=base;\n }\n return result;\n}", "function pow(base, power) {\n var result = 1\n for(var i =1; i<=power; i++) {\n result = result * base\n }\n return result ;\n}", "function superPow(a, b){\n\tb = +b.join('');\n\tvar i = 1;\n\tvar multiplier = a;\n\twhile(i < b){\n\t\tif(i*2 < b){\n\t\t\ta*=a;\n\t\t\ti*=2;\n\t\t} else {\n\t\t\ta= multiplier*a;\n\t\t\ti++;\n\t\t}\n\t}\n\treturn a;\n}", "function f(x){\n // return Math.pow(x,2);//\n return x*2;\n}", "function powerFunction(number) {\n return Math.log(number);\n}", "function power(y){\n return Math.pow(x,y);\n }", "function power(exponent) {\n return Math.pow(this, exponent);\n}", "function computePower(num, exponent) {\n return num ** exponent\n}", "function power (base,exponent){\n var result = 1;\n for(var i = 0;i<exponent; i++){\n result*=base;\n }\n return result;\n}", "function numberToPower(number, power){\n return number ** power\n}", "function exponent(startNumber, exponentNumber)\n{\n const result = startNumber ** exponentNumber;\n\n // console.log(result);\n return result;\n}", "function exponentiate(base, power) {\n if (power === 0) {\n return 1;\n }\n \n let result = base;\n \n while (power > 1) {\n result *= base;\n power--;\n }\n \n return result;\n }", "function power(base1,exp1) {\n if (exp1 === 0){\n return 1\n }\n return base1 * power(base1, exp1-1)\n}", "function power(base, exp){\n var result = 1;\n for(var i=1; i<=exp; i++){\n result = result*base; \n }\n return result;\n }", "function raisedValue(){\r\n var a =prompt(\"enter first value\");\r\n var b = prompt(\"enter second value\");\r\n console.log(Math.pow(a, b))\r\n }", "function calculatePower(base, power) {\n if (power == 1) return base;\n return base * calculatePower(base, power - 1);\n}", "function pow2(a, b = 2) {\n let result = 1;\n for (let i = 0; i < b; i++) {\n result *= a;\n }\n\n return result;\n}", "function power (base, exponent){\n if (exponent === 0){ \n return 1;\n } \n return base * power(base, exponent-1); \n}", "function potencia(b,e) {//b = base, e = expoente\n return b ** e\n}", "function potencia2(a,b) {\n return a ** b;\n\n}", "function power (base, exp){\n if(exp === 0) return 1;\n return base * power(base, exp-1);\n}", "function power(base, exp) {\n if(exp <=0 ) return 1\n\n return base*power(base, exp-1)\n\n}", "function transmogrifier(num1,num2,num3){\n\n var totalfirstsecond = num1 * num2;\n\n var power = Math.pow(totalfirstsecond, num3);\n\n console.log (power);\n\n return power;\n\n}", "function pow(number, power) {\n if (power == 1) {\n console.log(\"number\",number)\n return number;\n } else {\n console.log(\"power\",power)\n console.log(\"number\",number)\n return number * pow(number, power - 1)\n }\n}", "function power(base, exponent){\n\tif(exponent == 0) return 1;\n\treturn base * power(base, exponent - 1);\n}", "function power(base, exponent){\n\tif(exponent === 0){\n\t\treturn 1;\n\t} else {\n\t\treturn base * power(base, --exponent); //exponent-1\n\t}\n}", "function tinyPow(b, e) {\n var n = b;\n while (--e) {n *= b;}\n return n;\n }", "function power(base, exponent){\n if(exponent === 0) return 1;\n return base * power(base,exponent-1);\n}", "function power(base, exponent){\n if(exponent === 0) return 1;\n return base * power(base,exponent-1);\n}", "pow(other) {\n return this.__pow__(other);\n }", "function\npower_numbers(BASE, EXPO)\n{\n\tvar a, b, h, i, n, p1, p2;\n\n\t// n^0\n\n\tif (iszero(EXPO)) {\n\t\tpush_integer(1);\n\t\treturn;\n\t}\n\n\t// 0^n\n\n\tif (iszero(BASE)) {\n\t\tif (isnegativenumber(EXPO))\n\t\t\tstopf(\"divide by zero\");\n\t\tpush_integer(0);\n\t\treturn;\n\t}\n\n\t// 1^n\n\n\tif (isplusone(BASE)) {\n\t\tpush_integer(1);\n\t\treturn;\n\t}\n\n\t// n^1\n\n\tif (isplusone(EXPO)) {\n\t\tpush(BASE);\n\t\treturn;\n\t}\n\n\tif (isdouble(BASE) || isdouble(EXPO)) {\n\t\tpower_double(BASE, EXPO);\n\t\treturn;\n\t}\n\n\t// integer exponent?\n\n\tif (isinteger(EXPO)) {\n\t\ta = bignum_pow(BASE.a, EXPO.a);\n\t\tb = bignum_pow(BASE.b, EXPO.a);\n\t\tif (isnegativenumber(BASE) && bignum_odd(EXPO.a))\n\t\t\tif (isnegativenumber(EXPO))\n\t\t\t\tpush_bignum(-1, b, a); // reciprocate\n\t\t\telse\n\t\t\t\tpush_bignum(-1, a, b);\n\t\telse\n\t\t\tif (isnegativenumber(EXPO))\n\t\t\t\tpush_bignum(1, b, a); // reciprocate\n\t\t\telse\n\t\t\t\tpush_bignum(1, a, b);\n\t\treturn;\n\t}\n\n\t// exponent is a root\n\n\th = stack.length;\n\n\t// put factors on stack\n\n\tpush_symbol(POWER);\n\tpush(BASE);\n\tpush(EXPO);\n\tlist(3);\n\n\tfactor_factor();\n\n\t// normalize factors\n\n\tn = stack.length - h; // fix n now, stack can grow\n\n\tfor (i = 0; i < n; i++) {\n\t\tp1 = stack[h + i];\n\t\tif (car(p1) == symbol(POWER)) {\n\t\t\tBASE = cadr(p1);\n\t\t\tEXPO = caddr(p1);\n\t\t\tpower_numbers_factor(BASE, EXPO);\n\t\t\tstack[h + i] = pop(); // fill hole\n\t\t}\n\t}\n\n\t// combine numbers (leaves radicals on stack)\n\n\tp1 = one;\n\n\tfor (i = h; i < stack.length; i++) {\n\t\tp2 = stack[i];\n\t\tif (isnum(p2)) {\n\t\t\tpush(p1);\n\t\t\tpush(p2);\n\t\t\tmultiply();\n\t\t\tp1 = pop();\n\t\t\tstack.splice(i, 1);\n\t\t\ti--;\n\t\t}\n\t}\n\n\t// finalize\n\n\tn = stack.length - h;\n\n\tif (n == 0 || !isplusone(p1)) {\n\t\tpush(p1);\n\t\tn++;\n\t}\n\n\tif (n == 1)\n\t\treturn;\n\n\tsort_factors(h);\n\tlist(n);\n\tpush_symbol(MULTIPLY);\n\tswap();\n\tcons();\n}", "function powerCalculator(base, exponent) {\r\n if (exponent <= 1) {\r\n return base;\r\n }\r\n\r\n return powerCalculator(base, exponent - 1) * base;\r\n}", "function tinyPow(b, e) {\r\n var n = b;\r\n while (--e) n *= b;\r\n return n;\r\n }", "function pow(n,x) {\n\t\treturn Math.pow(n,x);\n\t}", "raisedPower(value) {\n let result = value * value;\n return this.operation = [result];\n }", "function power(base, exp) {\n if( exp < 0) {\n base = 1 / base;\n exp = exp * -1;\n }\n if( exp == 0 ) {\n return 1;\n }\n return base * power(base, exp - 1);\n\n}", "function pow(exp) {\n return function(base) {\n return Math.pow (base, exp);\n };\n }", "function tinyPow(b, e) {\r\n var n = b;\r\n while (--e) n *= b;\r\n return n;\r\n }", "function tinyPow(b, e) {\r\n var n = b;\r\n while (--e) n *= b;\r\n return n;\r\n }", "function tinyPow(b, e) {\r\n var n = b;\r\n while (--e) n *= b;\r\n return n;\r\n }", "function numberToPower(number, power){\n let result=1;\n for (let i=0; i<power; i++){\n result*=number;\n }\n return result\n}", "function power(base, exponent){\n if(exponent == 0)\n return 1;\n else\n return base*power(base,exponent-1);\n}", "function tinyPow(b, e) {\n var n = b;\n while (--e) n *= b;\n return n;\n }", "function power(base, exponent) {\n if (exponent === 0) return 1\n return base * power(base, exponent - 1)\n}", "function power(base, exponent) {\n if(exponent === 0) return 1\n return base * power(base, exponent - 1)\n}", "function power(base, exponent) {\n //basecase\n if (exponent === 0) return 1;\n return base * power(base, exponent - 1);\n}", "function power(base, exp) {\n if (exp === 0) return 1;\n return base * power(base, exp-1);\n}", "function power(base, exponent) {\n if (exponent === 0) return 1;\n if (exponent === 1) return base;\n return base * power(base, exponent - 1);\n}", "function powerCalculator(base, exp) {\n if (exp === 0) {\n return 1;\n }\n if (exp < 0) {\n return 'exponent has to be >= 0';\n }\n let product = 1;\n for (let i = 0; i < exp; i++) {\n product *= base;\n }\n return product;\n}", "function powerCalculator(base, exponent) {\n //this is just a condition\n if (exponent < 0) {\n return 'exponent should be greater than 0'\n }\n //this is the base case\n if (exponent === 0) {\n return 1\n }\n //recurring case\n return base * powerCalculator(base, exponent - 1)\n}", "function power(base, exponent) {\n if (exponent === 0) {\n return 1;\n }\n return base * power(base, exponent-1)\n}", "function exponenet(n , b){\n\tif (typeof n !== \"number\" || typeof b !== \"number\"){\n\t\treturn TypeError(\"Enter a number for both n and b\")\n\t} else {\n\t\treturn Math.pow(n, b)\n\t}\n}", "function xpowery(x,y){\n let power =1;\n while(y>0)\n {\n power=power * x;\n y--;\n }\n return power;\n}", "function power(base, exponent) {\n if (exponent == 0)\n return 1;\n else\n return base * power(base, exponent - 1);\n}", "function powerCalculator(num, exponent){\n let value=1;\n for (let i=0; i<exponent; i++){\n value *=num;\n }\n return value;\n}", "function potencia(base){\n return function(exp){\n return Math.pow(base, exp)\n }\n}", "function power(base, exponent) {\n if (exponent === 0) return 1;\n return base * power(base, exponent - 1);\n}", "function power(base, exponent) {\n if (exponent === 0) return 1;\n return base * power(base, exponent-1);\n}", "function powerCalculator(base, exp) {\n if(exp < 0) {\n return 'Exponent must be greater than or equal to 0'\n }\n\n if(exp === 0) {\n return 1;\n }\n\n let result = 1;\n\n for(let i = 0; i < exp; i++) {\n result = result * base;\n }\n\n return result;\n}", "function pow(num, power) {\n let res = 1;\n for (let i = 1; i <= power; i++) {\n res *= num;\n }\n return res;\n }", "function toPower(base, exponent) {\n let ans = 1;\n if(exponent < 0) {\n for(let i = 0; i > exponent; i--) {\n ans *= base;\n }\n ans = 1 / ans;\n }\n else {\n for(let i = 0; i < exponent; i++) {\n ans *= base;\n }\n }\n return ans;\n}", "function pow(x,n) {\n let x = inum;\n let n = itimes\n alert (x**n);\n}", "powerFunction(x, n) {\n let result = 1;\n\n for (let i = 0; i < n; i++) {\n result = result * x;\n }\n\n return result;\n }", "function pow(strNum, power) {\n\tlet result = strNum;\n\twhile (--power > 0)\n\t\tresult = mult(result, strNum);\n\treturn result;\n}", "function exponent(num, times) {\n return Math.pow(num, times);\n}", "function powerCalculator(number, exponent){\n if (exponent < 0) {\n return 'exponent should be >= 0'\n }\n if (exponent === 1) {\n return number\n }\n else {\n return number * powerCalculator(number, exponent-1)\n }\n \n}", "function power(n, exp) {\n if (exp === 0) return 1;\n if (exp === 1) return n;\n return n * power(n, exp - 1);\n}", "function power(base, exponent) {\n if (exponent === 0) return 1;\n\n return base * power(base, exponent - 1);\n}", "function pow(x, a) {\n return tfjs_core_1.tidy(function () {\n if (typeof (a) === 'number') {\n a = tfjs_core_1.scalar(Math.round(a), 'int32');\n }\n if (a.dtype !== 'int32') {\n throw new errors_1.NotImplementedError(\"Non-int32 dtype (\" + a.dtype + \") is not supported by pow() yet\");\n }\n return tfc.pow(x, a);\n });\n}", "function pow(x, a) {\n return tfjs_core_1.tidy(function () {\n if (typeof (a) === 'number') {\n a = tfjs_core_1.scalar(Math.round(a), 'int32');\n }\n if (a.dtype !== 'int32') {\n throw new errors_1.NotImplementedError(\"Non-int32 dtype (\" + a.dtype + \") is not supported by pow() yet\");\n }\n return tfc.pow(x, a);\n });\n}", "function power(num, pow) {\n if ( pow === 0 ) {\n return 1;\n }\n\n return num * power(num, pow - 1)\n}", "function powerCalculator(base, exp) {\n if (exp === 1) {\n return base;\n } else if (exp <= 0) {\n return 0;\n }\n\n // 10 * 10 * 1\n return base * powerCalculator(base, exp - 1);\n}", "function power2(a, n) {\n var result = 1;\n while (n) {\n if (n % 2 === 1) { // exponent is odd\n result = result * a;\n }\n a = a * a;\n n = n >> 1;\n }\n return result;\n}" ]
[ "0.85945684", "0.8519383", "0.83324194", "0.83238196", "0.81727517", "0.7941091", "0.78576833", "0.7836", "0.7799955", "0.77780193", "0.7774508", "0.77721804", "0.77693564", "0.77675", "0.7679464", "0.7658791", "0.7650794", "0.74438566", "0.7435262", "0.7408944", "0.7388557", "0.7311883", "0.7308939", "0.7274736", "0.72630817", "0.71983397", "0.7151654", "0.7148154", "0.7134961", "0.71312135", "0.7101224", "0.7082193", "0.7068909", "0.70670855", "0.70342416", "0.7033711", "0.7024522", "0.6991644", "0.6989048", "0.692161", "0.69120616", "0.6907277", "0.6894371", "0.6849627", "0.68456626", "0.68388426", "0.68361235", "0.6815507", "0.68117476", "0.68097174", "0.6792598", "0.6758971", "0.67566425", "0.6751096", "0.67248994", "0.671445", "0.671445", "0.6704225", "0.66969657", "0.6694236", "0.6686579", "0.6682229", "0.66786885", "0.66775376", "0.66732025", "0.6671085", "0.6671085", "0.6671085", "0.6667583", "0.6658133", "0.66541237", "0.6645066", "0.6635051", "0.66327214", "0.6627183", "0.66180235", "0.6578077", "0.6576041", "0.657144", "0.6546719", "0.6537397", "0.6521793", "0.6518633", "0.6513844", "0.6510257", "0.6503154", "0.64905953", "0.64823365", "0.6474577", "0.6472886", "0.64681584", "0.64656675", "0.64474016", "0.6440173", "0.64397705", "0.64350384", "0.6432037", "0.6432037", "0.6413549", "0.64079684", "0.6401977" ]
0.0
-1
2. Any year is entered through the keyboard. Write a function to determine whether the year is a leap year or not.
function isLeapYear() { var year = Number(prompt("Year ? ")); var leapYear = year % 100 === 0 ? year % 400 === 0 : year % 4 === 0; return leapYear; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "leapYear(year) {\n if (year > 999 && year < 10000) {\n if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)\n console.log(year + \" is a leap year\");\n else\n console.log(year + \" is not a leap year\");\n\n }\n else\n console.log(\"Please enter a 4 digit year\");\n }", "function IsItLeapYear(input){\n \n // console.log(\"is it leap year t/f?\" + IsItLeapYear());\n if ((input % 400) == 0){\n return true;\n }\n else if ((input % 100) == 0){\n return false;\n }\n else if ((input % 4) == 0){\n return true;\n }\n else return false;\n}", "function leapYear() {\n var year = +prompt(\"Enter Year\")\n if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {\n alert(year + \"is leap year\")\n }\n else {\n alert(year + \"is not a leap year\")\n }\n}", "function is_leap_year(year){\n\n if(!(year % 400)) return true\n if(!(year % 100)) return false\n if(!(year % 4)) return true\n return false\n}", "findLeapYear(year)\n{\n if(year>999 && year<10000)\n {\n if(year%4 == 0 && (year%400 == 0 || year%100!= 0))\n {\n console.log(year+\" is a Leap year.\")\n }\n else\n {\n console.log(year+\" is not a Leap year.\")\n }\n }\n else\n {\n console.log(\"Please enter valid 4 digit year format.\");\n \n }\n}", "function leap(y){\n if(y % 4 == 0 && y % 100 != 0 || y\n \n % 400 == 0){\n alert(\"it is leap year\");\n } else {\n alert(\"not a leap year\");\n }\n}", "function isLeap() {\n var year = document.getElementById('numYear').value;\n\n return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);\n}", "function leapYear(year) {\n if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {\n document.write(\"its a leap year\");\n }\n else {\n document.write(\"its not a leap year\");\n }\n\n}", "function checkLeapYear(year) {\n\n //three conditions to find out the leap year\n if ((0 == year % 4) && (0 != year % 100) || (0 == year % 400)) {\n console.log(year + ' is a leap year');\n } else {\n console.log(year + ' is not a leap year');\n }\n}", "function detectleapyear(year){\n if (year % 4 !== 0) {\n return false;\n } else if (year % 100 !== 0) {\n return true;\n } else if (year % 400 !== 0) {\n return false;\n } else {\n return true;\n }\n }", "leapyear1(year) {\n if (year % 4 == 0 && year % 100 !== 0 || year % 400 == 0) {\n console.log(year + \" is a leap year\");\n return true\n }\n else {\n console.log(year + \" is not a leap year\");\n return false\n }\n }", "function leapYear(year) {\nif ((year/4) != Math.floor(year/4)) return false;\nif ((year/100) != Math.floor(year/100)) return true;\nif ((year/400) != Math.floor(year/400)) return false;\nreturn true;\n}", "function isLeapYear(year){\n if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) \n return true;\n return false;\n}", "function isLeapYear(year){\n // return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0\n //divible by 4 it is\n //divisble by 100 it isnt\n //divisible by 400 it is\n if(year % 4 === 0 && year % 100 !== 0 || year % 400 === 0)\n {\n return true\n }\n return false\n\n}", "function leapYear(year)\r\n{\r\n if(year % 4 == 0)\r\n {\r\n if(year % 100 == 0)\r\n {\r\n if (year % 400 == 0)\r\n {\r\n console.log(\"It is a leap year!\") \r\n }\r\n else\r\n {\r\n console.log(\"It is a not a leap year\")\r\n }\r\n }\r\n else\r\n {\r\n console.log(\"It is a leap year!\") \r\n }\r\n }\r\n}", "function leapYear(year){\n if(year % 4 == 0){\n if(year % 400 == 0){\n return true;\n }else if(year % 100 == 0){\n return false;\n }else{\n return true;\n }\n }else{\n return false\n }\n}", "function isLeapYear(year) { return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0); }", "function isLeapYear(year){\n if(year%4 == 0)\n {\n if( year%100 == 0) /* Checking for a century year */\n {\n if ( year%400 == 0)\n return true;\n else\n return false;\n }\n else\n return true;\n }\n else\n return false;\n}", "function leapFinder(year) {\n if ((year % 4 === 0) && (year % 100 !== 0) || (year % 400 === 0)) {\n year = 'Leap year'; \n } else {\n year = 'Not a leap year'; \n }\n\n return year; \n}", "function leapYear(year){\n if (year % 400 === 0) {\n console.log(\"Yes!\");\n } else if (year % 100 === 0){\n console.log(\"No!\");\n } else if (year % 4 === 0){\n console.log(\"Yes!\")\n }\n}", "function leapyear(year) {\n if(year % 100 == 0) {\n if(year % 400 == 0) {\n alert(\"yes, this is a leap year\");\n }\n else {\n alert(\"nah\");\n }\n }\n else if(year % 4 == 0) {\n alert(\"yes, this is a leap year\");\n }\n else {\n alert(\"nah\");\n }\n}", "function leapYear() {\r\n let year = prompt(\"enter year\");\r\n let answer;\r\n if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {\r\n answer = \"leap year\";\r\n } else {\r\n answer = \"not a leap year\";\r\n }\r\n console.log(answer);\r\n }", "function leapYear(year)\n{\n //...divisible by four but not by 100 - leap year\n if(year % 4 == 0 && year % 100 !== 0)\n {\n console.log('Leap Year');\n }\n //...divisible by 400 - leap year\n else if(year % 400 == 0)\n {\n console.log('Leap Year');\n }\n else\n {\n console.log('Not a Leap Year');\n }\n}", "function checkLeapYear(year){\n //(year % 4 == 0) && (( year % 100 != 0) || (year % 400 == 0)) ? true : false;\n if ((year % 4 == 0) && (( year % 100 != 0) || (year % 400 == 0))) {\n return true;\n }else {\n return false;\n }\n\n}", "function leapYear(year) {\n //leap year --> divisible by 4 but not 100 or is divisible by 400\n console.log((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);\n}", "function isLeapYear(year){\n year = +year;\n let isLeapYear = (year % 400 == 0 ) || (year % 4 == 0 && year % 100 != 0);\n console.log(isLeapYear ? \"yes\" : \"no\"); \n}", "isLeapYear(year) {\n if (year % 4 !== 0) {\n return false;\n }\n\n if (year % 100 === 0 && year % 400 !== 0) {\n return false;\n }\n\n return true;\n }", "function leapYear(year){\nalert(year);\nvar result; \n if (year%400 == 0){\n result = true;\n }\n else if(year%100 == 0){\n result = false;\n }\n else if(year%4 == 0){\n result= true;\n }\n else{\n result= false;\n }\n alert(result? \"It is a leap year\" : \"It is not a leap year\");\n}", "function isLeapYear(year) {\nif ((year % 4 === 0 && year % 100 !== 0) || (year % 100 === 0 && year % 400 === 0)) {\n return true; \n } else {\n return false;\n }\n}", "function isLeap(year) {\n\n /**************Don't change the code above****************/\n var yearResult = \"\";\n if (year % 4 !== 0) {\n yearResult = \"Not leap year.\"; // if a year is not divisible by 4 then it is not a leap year\n } else if (year % 100 !== 0) {\n yearResult = \"Leap year.\"; // else if a year is not divisible by 100 then it is a leap year\n } else if (year % 400 !== 0) {\n yearResult = \"Not leap year.\"; // else if a year is not divisible by 400 then it is not a leap year\n } else {\n yearResult = \"Leap year.\"; // else it is a leap year\n }\n\n return yearResult;\n\n}", "function leapYear()\n{\n\tif( year % 4 == 0);\n\t{\n\t\tif( year % 100 == 0)\n\t\t{\n\t\t\tconsole.log(“not leap year”);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tconsole.log(“leap year”);\n\t\t}\n\t}\n\telse if ( year % 400 == 0)\n\t{\n\t\tconsole.log(“leap year”)\n\t}\n\telse \n\t{\t\n\t\tconsole.log(“not leap year”)\n\t}\n}", "function leapyear(year) {\n if(year%100===0 && year%400===0 || year%4===0){\n return \"Its leap year\"\n }\n else{\n return \"its not a leap year\"\n }\n }", "function getLeapYear(year) {\n if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0)) {\n return true;\n } else {\n return false;\n }\n}", "function isLeapYear(year){\n /* Takes a single argument, year. Calculates whether or not\n the year is a Leap Year. Returns either true or false */\n\n if (year % 400 === 0){ return true; }\n if (year % 100 === 0){ return false; }\n if (year % 4 === 0){ return true; }\n else { return false; }\n}", "function isYear(year){\n if(a%100==0 && a%400==0){\n return 'leap year';\n }else if(a%100!=0 && a%4==0){\n return 'leap year';\n }else{\n return 'not leap year';\n }\n}", "function leapYear(year) {\n return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;\n}", "function isLeapYear(year) {\n if (year % 4 != 0) {\n return false;\n } else if (year % 100 != 0) {\n return true;\n } else if (year % 400 != 0) {\n return false;\n } else {\n return true;\n }\n}", "function leapYear(year) {\n return (year % 4 === 0 && year % 100 !== 0) || (year % 100 === 0 && year % 400 === 0) ? year : false\n}", "function leapYear() {\n rl.question('Enter the year to check leap or not',(year)=>{//user input.\n if(year>=0)\n return utility.leapYear(year);// calling of leapYear method.\n else\n {\n console.log(\"Please enter correct year\");\n rl.close();\n return false;\n }\n });\n}", "function leapYear(year) {\r\n if (year % 400 === 0) {return year + ' is a leap year.'}\r\n else if (year % 100 === 0 && year % 400 !== 0) {return year + ' is not a leap year.'}\r\n else if (year % 4 === 0) {return year + ' is a leap year.'}\r\n else {return year + ' is not a leap year.'}\r\n}", "function isLeapYear(year) {\r\n return ((year % 4) === 0 && ((year % 100) !== 0 || (year % 400) === 0));\r\n}", "function CheckLeap(yy)\n{\nif ((yy % 100 != 0 && yy % 4 == 0) || (yy % 400 == 0)) { return 29; }\nelse { return 28; }\n}", "function isLeapYear(year){\r\n let res = ( !(year%400) || (year%100) && !(year%4) );\r\n // condition simplified using precedence\r\n if(res){\r\n cl(`Year ${year} is a leap year.`);\r\n }else{\r\n cl(`Year ${year} is not a leap year.`);\r\n }\r\n}", "function isLeapYear(year) {\n // leap year must be divide mod with 4 === 0\n if (year % 4 === 0) {\n //leap year must be divide mod with 100 !== 0\n if (year % 100 === 0) {\n // but if that year can mod with 400 === 0 It is leap year\n if (year % 400 === 0) {\n return true;\n }\n return false;\n }\n return true;\n }\n // it not leap year\n else {\n return false;\n }\n}", "function leapYear(){\n\tvar year = Math.floor((Math.random() * 118) + 1900); /// Set a random year from 1900-2018\n\n\tconsole.log(\"Year = \" +year);\n\n\tif (((year % 4 == 0) && (year % 100 !=0)) || (year % 400 == 0 )) { /// Leap year is either divisible by 4, but NOT 100 -- OR any year divisible by 400 is a leap year\n\tconsole.log(\"Yes! It is a Leap Year!\");\n\t} \n\n\telse {\n\tconsole.log(\"No. It is not a Leap Year.\");\n\t}\n\n}", "function isLeapYear(year) {\n if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {\n return true;\n } else {\n return false;\n }\n}", "function leapYear(year) {\n var n = year % 4;\n if (n == 0) {\n alert(year + \" is leap year\");\n }\n else {\n alert(year + \" is not leap year\");\n }\n}", "function isLeapYear(year) {\n if (year % 400 === 0) {\n return true;\n } else if(year % 4 === 0 && !(year % 100 === 0)) {\n return true;\n } else {\n return false;\n }\n}", "function isLeapYear(year) {\n if (!(year % 4)) {\n if (year % 100) {\n return true;\n }\n if (!(year % 400)) {\n return true;\n }\n }\n return false;\n}", "function leapYear(year) {\n\tif (year%400 === 0) {\n\t\treturn true;\n\t} else if (year%100 === 0) {\n\t\treturn false;\n\t} else if (year%4 === 0) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function isLeapYear(year) {\n if (year % 400 === 0) return true;\n if (year % 100 === 0) return false;\n return year % 4 === 0;\n }", "function isLeapYear(year) {\n\t return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;\n\t}", "function LeapYear(year){\n var status = false;\n if(year % 400 === 0){\n status = true;\n }\n if(year % 4 === 0 && year % 100 != 0){\n status = true;\n }\n// } else {status = false;}\n if(status == true){\n console.log(year, \" is a leap year\");\n } else (console.log(year, \" is not a leap year\"))\n}", "function isLeap(year) {\n if (year % 4 === 0 || year % 400 === 0) {\n return (\"Leap year.\");\n } else if (year % 100 === 0) {\n return (\"Not leap year.\");\n } else if (year % 400 === 0) {\n return (\"Leap Year.\");\n } else {\n return (\"Not leap year.\");\n }\n}", "function leapYear(year) {\n if ((year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0)) {\n return true;\n }\n return false;\n}", "function leapYear(year) {\n if(year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0)) {\n return true;\n }\n\n return false;\n}", "function leap (num) {\r\n\r\nif (num % 4 === 0) {\r\n console.log(\"That's a leap year\");\r\n}\r\nelse {\r\n console.log(\"That's not a leap year\");\r\n}\r\n}", "function isLeapYear(year) {\r\n return (year%4 == 0 && year%100 != 0) || (year%400 == 0);\r\n }", "function calculateIfLeapYear(year) {\n\t\t//Must be divisible by 4 to be a leap year\n\t\tif(year == FIRST_LEAP_YEAR) {\n\t\t\treturn true;\t\t\t\n\t\t} else if (year % 4 == 0) {\n\t\t\t//May not be a leap year if it's divisible by 100\n\t\t\tif(year % 100 == 0) {\n\t\t\t\t//Unless it's divisible by 400 as well\n\t\t\t\tif(year % 400 == 0) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "function leapYear(year) {\n return ((year % 4 === 0) && ((year % 100 !== 0) || (year % 400 === 0)));\n }", "function isLeapYear(year) {\n\treturn ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);\n}", "function isLeapYear(year){\n if(year%4 == 0){\n return (year+\" was/is/will be a leap year.\")\n }\n else{\n return (year+\" was/is/will not be a leap year.\")\n };\n }", "function isLeap(year) {\n\tvar isEvenlyDivisibleBy4 = year%4;\n\tvar isEvenlyDivisibleBy100 = year%100;\n\tvar isEvenlyDivisibleBy400 = year%400;\n\tif((isEvenlyDivisibleBy4 == 0) && (isEvenlyDivisibleBy100 != 0)) {\n\t\treturn (\"This is a Leap Year! A leap year has 366 days, with an extra day in February\");\n\t\t}\n\telse if((isEvenlyDivisibleBy4 == 0) && (isEvenlyDivisibleBy100 == 0) && (isEvenlyDivisibleBy400 == 0)){\n\t\treturn (\"This is a Leap Year! A leap year has 366 days, with an extra day in February\");\n\t\t}\n\telse {\n\t\treturn (\"This is NOT a Leap Year. A normal year has 365 days.\");\n\t\t}\n}", "function LeapYear(year)\n{\n\n if((year%4 && year%100 && year%400)===0)\n {\n document.write(\"Its a Leap year\");\n }\n else\n {\n document.write(\"\\n It's not a Leap Year\");\n }\n}", "function isLeapYear(number) {\n var year = number;\n var response = \"\";\n var yearIsInteger = Number.isInteger(year / 4);\n\n if (yearIsInteger) {\n response = \"Yes, is a leap year\";\n } else {\n response = \"No, is not a leap year\";\n }\n\n return response;\n}", "function isLeapYear(number) {\n\tlet year = number,\n\t\tonePlace,\n\t\ttensPlace,\n\t\tyearArry = [],\n\t\toutput = `The year ${year} is a leap!`;\n\tfor (let i = 0; i < year.toString().length; i++) {\n\t\tyearArry.push(year.toString()[i]);\n\t}\n\tonePlace = yearArry.pop();\n\ttensPlace = yearArry.pop();\n\t// \t*todo A2. If the year can be evenly divided by 100, it is NOT a leap year, unless;\n\tif (year % 100 === 0) {\n\t\t// *todo A3. The year is also evenly divisible by 400: Then it is a leap year.\n\t\tif (parseInt(onePlace) === 0 && parseInt(tensPlace) === 0) {\n\t\t\tif (Number.isInteger(year / 400)) return output;\n\t\t}\n\t\t// *todo A1. The year is evenly divisible by 4;\n\t\tif (Number.isInteger(year / 4)) return output;\n\t}\n\treturn `The year ${year} is NOT a leap!`;\n}", "function isLeapYear(year) {\n\t\t// If the year is evenly divisible by 4, then continue.\n\t\tif (year % 4 == 0) {\n\t\t\t// If the year is not evenly divisible by 400 but is evenly\n\t\t\t// divisible by 100, then return false.\n\t\t\tif ((year % 400 != 0) && (year % 100 == 0)) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Otherwise, return true.\n\t\t\telse {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\t// Otherwise, return false.\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "function isLeapYear(year) {\n const d = new Date(year, 1, 29);\n return d.getDate() === 29;\n}", "function isItLeapYear() {\n // gauti dabartinius metus\n let now = new Date();\n\n let year = now.getFullYear();\n year = 2016;\n // ar metai dalinasi is 4 lygiai\n if (year % 4 !== 0) {\n console.log(\"not a leap year\");\n return;\n }\n\n // ar metai dalinasi is 100 ir is 400\n if (year % 100 === 0 && year % 400 === 0) {\n console.log(\"leap year\");\n } else {\n console.log(\"not a leap year\");\n }\n}", "function leapYear(year) {\n if (year % 4 === 0) {\n if (year % 100 === 0) {\n if (year % 400 === 0) {\n return \"leap year\";\n } else {\n return \"not leap year\";\n }\n } else {\n return \"Leap Year\";\n }\n } else {\n return \"Not Leap Year\";\n }\n}", "function isLeapYear(i) {\n return (!(i % 100 == 0 && !i % 400 == 0) && i % 4 == 0)\n }", "function isIslamicLeapYear(hYear) {\n return (14 + 11 * hYear) % 30 < 11;\n}", "function isLeapYear(year, purpose) {\n\n //if a year is divisible by 4, then it is potentially a leap year, if it is not divisible by 100 unless it is also divisible by 400 it is a leap year\n if (year % 4 == 0 && (year % 100 != 0 || (year % 100 == 0 && year % 400 == 0))) {\n\n if (purpose == 'yearDayCount') {\n return 366;\n }\n else if (purpose == 'bool') {\n return true;\n }\n }\n else {\n if (purpose == 'yearDayCount') {\n return 365;\n }\n else if (purpose == 'bool') {\n return false;\n }\n }\n}", "function isIslamicLeapYear(hYear) {\n return (14 + 11 * hYear) % 30 < 11;\n}", "function leapyearV2(year) {\n\treturn year % 100 === 0 ? year % 400 === 0 : year % 4 === 0;\n}", "function isLeapYear(n) {\n let leap = false;\n\n if (n % 4 === 0) leap = true;\n if (n % 100 === 0 && n % 400) leap = true;\n\n return leap;\n}", "function __LeapGregorian(year)\n{\n return ((year % 4) == 0) &&\n (!(((year % 100) == 0) && ((year % 400) != 0)));\n}", "function isLeap2 (year) {\n if (year % 4 > 0) {\n return ('Not leap year.')\n }\n if (year % 100 > 0) {\n return ('Leap year.')\n }\n if (year % 400 === 0) {\n return ('Leap year.')\n } else {\n return ('Not leap year.')\n }\n}", "function leap_gregorian(year){\r\n return ((year % 4) == 0) &&\r\n (!(((year % 100) == 0) && ((year % 400) != 0)));\r\n}", "function leap_islamic(year)\n {\n return (((year * 11) + 14) % 30) < 11;\n }", "function isLeapYear3(year) {\n if (year % 4 === 0) {\n return false;\n } else if (year % 100 === 0) {\n return true;\n } else {\n return year % 400 === 0;\n }\n}", "function checkLeapYear2(year) {\n return new Date(year, 1, 29).getDate() === 29;\n}", "isLeapYear() {\n return this.dateObject.year % 4 === 0;\n }", "function leap_gregorian(year) {\n\n return ((year % 4) == 0) &&\n (!(((year % 100) == 0) && ((year % 400) != 0)));\n\n}", "function nextYear()\n\t\t\t{\n\t\t\t\tif( gMonth<=2)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse if(gMonth == 3 && gDay < leap)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}", "function IsLeapYear(lunisolarYear)\r\n {\r\n return (LEAP_YEARS_AND_MONTHS[lunisolarYear] != undefined);\r\n }", "function hebrew_leap(year)\n {\n return mod(((year * 7) + 1), 19) < 7;\n }", "function leap_gregorian(year) {\n return ((year % 4) == 0) &&\n (!(((year % 100) == 0) && ((year % 400) != 0)));\n}", "function leap_gregorian(year) {\n return ((year % 4) == 0) &&\n (!(((year % 100) == 0) && ((year % 400) != 0)));\n}", "function leapyear(b_yr,c_yr){\n var leap_count =0;\n for(b_yr ; b_yr<=c_yr; b_yr++ ){\n if((b_yr%400 == 0)||(b_yr%100 != 0)&& (b_yr%4 == 0)){\n leap_count+=1;\n }\n }\n return leap_count;\n \n}", "function isLeapJalaaliYear (jy) {\n return jalCalLeap(jy) === 0\n }", "function leap_persiana(year)\n {\n return (persiana_to_jd(year + 1, 1, 1) -\n\t persiana_to_jd(year, 1, 1)) > 365;\n }", "function leap_persian(year){\r\n return ((((((year - ((year > 0) ? 474 : 473)) % 2820) + 474) + 38) * 682) % 2816) < 682;\r\n}", "function checkLeapYear(){\n if(dateInfo.currentYear%4==0){\n monthInfo[1][1] = 29;\n }\n else{\n monthInfo[1][1] = 28;\n }\n}", "function leapYears() {\r\n var yearsPrinted = 0;\r\n var currentYear = 2021;\r\n while (yearsPrinted < 20) { \r\n if ((currentYear % 4 === 0) && (!((currentYear % 100===0) && (currentYear % 400 !== 0)))) {\r\n document.write(currentYear+\"<br>\")\r\n yearsPrinted++;\r\n currentYear++;\r\n } else {\r\n currentYear++;\r\n }\r\n } \r\n}", "function isYear (s)\r\n{ if (isEmpty(s))\r\n if (isYear.arguments.length == 1) return defaultEmptyOK;\r\n else return (isYear.arguments[1] == true);\r\n if (!isNonnegativeInteger(s)) return false;\r\n return ((s.length == 2) || (s.length == 4));\r\n}", "function isYear (s)\r\n{ if (isEmpty(s))\r\n if (isYear.arguments.length == 1) return defaultEmptyOK;\r\n else return (isYear.arguments[1] == true);\r\n if (!isNonnegativeInteger(s)) return false;\r\n return ((s.length == 2) || (s.length == 4));\r\n}", "function isLegalYear(year) {\n\treturn year.length == 2\n\t\n}", "function leap_gregorian(year)\n {\n return ((year % 4) == 0) &&\n\t (!(((year % 100) == 0) && ((year % 400) != 0)));\n }", "function leapYear(fYear){\n\n\tif ((fYear%100!=0) && (fYear%4==0) || (fYear%400==0)){\n\t\treturn 29;\n\t}\n\treturn 28;\n}" ]
[ "0.84381413", "0.8392031", "0.82617843", "0.82614595", "0.82559925", "0.8253501", "0.8251277", "0.8201279", "0.817877", "0.8175716", "0.81660974", "0.8121428", "0.80832213", "0.8080325", "0.80487055", "0.8036659", "0.8035254", "0.8034036", "0.8031653", "0.8031488", "0.8012644", "0.8007215", "0.800175", "0.7981348", "0.79683214", "0.7961615", "0.7960071", "0.7951533", "0.79351413", "0.79303664", "0.79218745", "0.79164463", "0.79099715", "0.7899756", "0.78907126", "0.78889346", "0.78825355", "0.78824604", "0.7880873", "0.7865804", "0.78482103", "0.7846576", "0.7830384", "0.7826904", "0.78193265", "0.78179044", "0.7804569", "0.78017545", "0.7781615", "0.77794284", "0.7750885", "0.77479553", "0.7739804", "0.7721781", "0.7711559", "0.77022994", "0.7696853", "0.7691233", "0.7688187", "0.7684624", "0.7684401", "0.76536995", "0.7642932", "0.7638326", "0.7581481", "0.7539693", "0.7528174", "0.75155693", "0.75082177", "0.74971956", "0.7485183", "0.7468898", "0.745462", "0.74451774", "0.73774785", "0.7362566", "0.7354959", "0.7333108", "0.7318782", "0.73103905", "0.73022497", "0.7299114", "0.7260118", "0.71958387", "0.71759707", "0.7093099", "0.7090003", "0.7081271", "0.7081271", "0.7067579", "0.70570415", "0.70554143", "0.7051679", "0.70203114", "0.70042396", "0.700267", "0.700267", "0.69804484", "0.69803333", "0.69790924" ]
0.87025005
0
4. Write a function that receives marks received by a student in 3 subjects and returns the average and percentage of these marks. there should be 3 functions one is the mainFunction and other are for average and percentage. Call those functions from mainFunction and display result in mainFunction
function main(maths, physics, computer) { function average() { var average = (maths + physics + computer) / 3; return average; } function percentage() { var percentage = ((maths + physics + computer) / 300) * 100; return percentage; } average(); percentage(); alert("percentage : " + percentage() + "%" + " \n Average : " + average()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function marks(chemistry, physics, maths) {\n function average() {\n var avg = (chemistry + physics + maths) / 3\n return avg\n\n\n }\n function percentage() {\n var per = (chemistry + physics + maths) / 300 * 100\n return per\n }\n console.log(`Marks avg ${average()} Marks Percentage ${percentage()}`)\n}", "function marks(english, urdu, maths) {\n\n function percentage(english, urdu, maths) {\n var totalMarks = 300;\n var obt = english + urdu + maths;\n var percentage = ((obt / totalMarks) * 100);\n return percentage;\n }\n\n function average(english, urdu, maths) {\n var avg = ((english + urdu + maths) / 3)\n return avg;\n }\n\n var average = average(english, urdu, maths);\n document.write(\"Avearge marks are : \" + average + \"<br>\");\n\n var percentage = percentage(english, urdu, maths);\n document.write(\"percentage is : \" + Math.ceil(percentage, 2) + \"%\")\n}", "function myfunc()\n{\nvar sub1=prompt('Enter the name of subject 1');\nvar sub2=prompt('Enter the name of subject 2');\nvar sub3=prompt('Enter the name of subject 3');\nvar total=300;\ntotal2=100;\nvar marks1=+prompt('Enter the marks in subject1');\nvar marks2=+prompt('Enter the marks in subject2');\nvar marks3=+prompt('Enter the marks in subject3');\nobtainedMarks=marks1+marks2+marks3;\npercentage=(obtainedMarks/300)*100;\nper1=(marks1/100)*100;\nper2=(marks2/100)*100;\nper3=(marks3/100)*100;\ndocument.getElementById(\"sub1\").innerHTML=sub1;\ndocument.getElementById(\"sub2\").innerHTML=sub2;\ndocument.getElementById(\"sub3\").innerHTML=sub3;\ndocument.getElementById(\"per1\").innerHTML=per1;\ndocument.getElementById(\"per2\").innerHTML=per2;\ndocument.getElementById(\"per3\").innerHTML=per3;\ndocument.getElementById(\"total\").innerHTML=total;\ndocument.getElementById(\"marks1\").innerHTML=per1;\ndocument.getElementById(\"marks2\").innerHTML=per2;\ndocument.getElementById(\"marks3\").innerHTML=per3;\ndocument.getElementById(\"obtainedMarks\").innerHTML=obtainedMarks;\ndocument.getElementById(\"percentage\").innerHTML=percentage;\n\n}", "function Average() {\n return Total_marks;\n}", "function avg(a)\r\n{\r\n\r\n//assigning the avg to coursework(90) divide by a.\r\nlet avg =coursework(90)/a\r\n\r\n//the function should produce avg as the result after it's execution\r\nreturn avg\r\n\r\n}", "function avg(a)\n{\n\n//Assign avg the final result from diving the return value for function coursework with 'a'\nlet avg =coursework(90)/a\n\n//.\nreturn avg\n\n}", "function avg(a)\n{\n\n// Declaring variable avg and assigning the value of the function coursework with the argument 90 divide by \"a\"\nlet avg =coursework(90)/a\n\n// Stores the value of \"avg\" for later use\nreturn avg\n\n}", "function avg(a)\r\n{\r\n\r\n// Declaring a variable called avg and assigning it to a value coursework a parameter 90 divide by a\r\nlet avg =coursework(90)/a\r\n\r\n//Calling the value in the variable avg\r\nreturn avg\r\n\r\n}", "function avg(a) {\n //Declaring a variable 'avg' and assign it the result of got from the returned value from coursework function divided by argument passed to 'avg' function \n let avg = coursework(90) / a;\n //Return the value of 'avg' for use outside the avg() function\n return avg;\n}", "function avg(a)\n{\nlet avg =coursework(90)/a\nreturn avg\n\n}", "function avg(a)\r\n{\r\n\r\n//declares variable 'avg' and assigns it the value of coursework 90 divided by a\r\nlet avg =coursework(90)/a\r\n\r\n//specifies the value of agv when run on the console\r\nreturn avg\r\n\r\n}", "function getFunding(students, teachers, averageGPA) {\n /* your code */\n}", "function getAverage(marks){\n\nlet totalMarks = marks.reduce(function(a,b){return a+b})\nlet marksLen = marks.length\n\nreturn Math.floor(totalMarks/marksLen)\n\n}", "function avg(a)\n{\n\n//The method avg is now being declared as a let variable.\n//The variable is being intialised with the method coursework with its argument 90 divided by the parameter a of the method avg.\n\nlet avg =coursework(90)/a\n\n//The return key word instructs the method to return the resulting value assigned to the variable avg.\n\nreturn avg\n\n}", "function average(EnglishMarks, UrduMarks, MathMarks) {\n\tvar total = EnglishMarks + UrduMarks + MathMarks;\n\tvar avg = (total / 3).toFixed(2);\n\treturn {\n\t\ttotalNumber: total,\n\t\tavg: avg\n\t}\n}", "function gradecalc(firstInSem, secondInSem, finalSem, assignment, attendance)\r\n {\r\n\tvar total = (firstInSem * 30) / 100 + (secondInSem * 30) / 100 + (finalSem * 50) / 100 + (assignment) + (attendance);\r\n\tvar grade = total.toFixed(2);\r\n\tdocument.getElementById('gradeObject').innerHTML = (\"Your Marks :-\", grade);\r\n\tconsole.log(grade);\r\n\tif (total >= 35)\r\n\t{\r\n\t\tif (finalSem >= 35) \r\n\t\t{\r\n\t\t\tvar marks = (total-35).toFixed(2)\r\n\t\t\tdocument.getElementById(\"p2\").innerHTML = (`<br>You are Safe and you crossed Danger Zone, Your extra marks is ${marks}!`);\r\n\t\t} \r\n\t\telse \r\n\t\t{\t\r\n\t\t\tvar marks = (35-finalSem).toFixed(2)\r\n\t\t\tdocument.getElementById(\"p2\").innerHTML = (\"You Have a Backlog in this paper and have to give this paper again :-(\");\r\n\t\t\tdocument.getElementById(\"p2\").innerHTML = \t` You are UnSafe and you have to gain ${marks} more marks from Teacher (Current Time). <br/> Means Next time in Final Back Paper you have to score Only 35 Marks. `;\r\n\r\n\t\t}\r\n\t} else \r\n\t{\r\n\t\tvar marks = ((35 - total) * 2).toFixed(2)\r\n\t\tif ((finalSem + (35 - total) * 2) < 35) {\r\n\t\t\tdocument.getElementById(\"p2\").innerHTML = `You are UnSafe and you have to gain ${marks} more marks from Teacher (Current Time).\\n <br/> Means Next time in Final Back Paper you have to score Only 35 Marks.`;\r\n\r\n\t\t} else {\r\n\t\t\tvar moreNeed = (finalSem + (35 - total) * 2).toFixed(2)\r\n\t\t\tdocument.getElementById(\"p2\").innerHTML = `You are UnSafe and you have to gain ${marks} more marks from Teacher (Current Time).\\n <br/> Means Next time in Final Back Paper you have to score Only ${moreNeed} Marks`;\r\n\r\n\t\t}\r\n\t}\r\n}", "function avg(a) {\n\n //Here we have declared our variable avg to mean coursework is 90 divide by the value of a. The results of coursework\n //on line 23 is what will be the value of coursework here.\n let avg = coursework(90) / a\n\n //Here we are again simply calling out the value or answer for avg\n return avg\n\n }", "function crsmark(a)\r\n{\r\n//assigning parameters to variable with the name exm \r\n//invoking avg, solving exm\r\nlet exm = avg(2)*(a/100)\r\n return exm \r\n}", "function calculateGrade2(marks) {\n let sum = 0;\n\n for (let mark of marks) {\n sum += mark;\n }\n\n let average = sum / marks.lenght;\n\n if (average < 59) return \"F\";\n if (average < 69) return \"D\";\n if (average < 79) return \"C\";\n if (average < 89) return \"B\";\n return \"A\";\n}", "function getAverage(marks) {\n\tvar totalScore = 0;\n\tmarks.forEach(function(element){\n\t\ttotalScore = totalScore + element;\n\t\treturn totalScore;\n\t})\n\treturn Math.floor(totalScore / marks.length);\n}", "function avg(a)\r\n {\r\n let avg =coursework(90)/a //avg = 170/a\r\n return avg\r\n\r\n }", "function findAverage(student) {\n var sum = 0;\n\n for (var i = 0; i < student.marks.length; i++) {\n sum = sum + student.marks[i];\n }\n\n return sum / (student.marks.length); //average\n}", "function score_indicate (){\r\n //\r\n Substitute the array of [national score, English score, math score, science score, social score] into the variable \"subject_points\"\r\n let subject_points = [Number ( $ ( ' #national_language ' ).val()),\r\n Number( $ ( ' #english ' ).val()),\r\n Number( $ ( ' #mathematics ' ).val()),\r\n Number( $ ( ' #science ' ).val()),\r\n Number( $ ( ' #society ' ).val())\r\n ]; // in the variable \"sum\" // [National score, English score, math [Score, Science score, Social score] respectively. // Hint! Take out the arrays one by one and add them.\r\n let sum = subject_points[ 0 ];\r\n sum = sum + subject_points[ 1 ];\r\n sum = sum + subject_points[ 2 ];\r\n sum = sum + subject_points[ 3 ];\r\n sum = sum + subject_points[ 4 ];\r\n\r\n\r\n\r\n // Output the variable \"sum\" (total points) to \"Total points:\" (class=\"sum_indicate\").\r\n $ ( \" #sum_indicate \" ).text(sum);\r\n let average = sum / subject_points.length;\r\n $ (\"#average_indicate\").text(average);\r\n //\r\n Assign the average value to the\r\n variable \"average\" . (Total number of points you want to average (sum) / total number) // Hint! Use the length method to find the total number. (length method: a method to get the length of the string and the number of elements in the array)\r\n }", "function crsmark(a)\n{\n\n//This is declaring a let variable called exm.\n//The variable has been assigned the resulting value from the method avg having the argument 2 passed mutliplied by the result from the division of the parameter a by 100.\nlet exm = avg(2)*(a/100)\n\n//The return key word instructs the method to return the resulting value assigned to the variable exm.\n return exm\n}", "function calculateGrade(){\n var homework = document.getElementById(\"Homework\").value; // \"70,80,90\"\n var hwArr = average(convertToArray(homework));\n var homeWeight = parseInt(document.getElementById(\"homeworkWeight\").value);\n var homeWeightDec = homeWeight / 100;\n var hwWA = hwArr * homeWeightDec;\n\n\n var classwork = document.getElementById(\"Classwork\").value;\n var cwArr = average(convertToArray(classwork));\n var classWeight = parseInt(document.getElementById(\"homeworkWeight\").value);\n var classWeightDec = classWeight / 100;\n var cwWA = cwArr * classWeightDec;\n\n var participation = document.getElementById(\"Participation\").value;\n var partiArr = average(convertToArray(participation));\n var partiWeight = parseInt(document.getElementById(\"homeworkWeight\").value);\n var partiWeightDec = partiWeight / 100;\n var partiWA = partiArr * partiWeightDec;\n\n var projects = document.getElementById(\"Projects\").value;\n var projArr = average(convertToArray(projects));\n var projWeight = parseInt(document.getElementById(\"homeworkWeight\").value);\n var projWeightDec = projWeight / 100;\n var projWA = projArr * projWeightDec;\n\n var tests = document.getElementById(\"Tests\").value;\n var tesArr = average(convertToArray(tests));\n var tesWeight = parseInt(document.getElementById(\"homeworkWeight\").value);\n var tesWeightDec = tesWeight / 100;\n var tesWA = tesArr * tesWeightDec;\n\n\n\n var weightSum = (homeWeightDec + classWeightDec + partiWeightDec + projWeightDec + tesWeightDec);\n var weightedAverages = tesWA + projWA + partiWA + cwWA + hwWA;\n var currentGrade = weightedAverages / weightSum;\n\n document.getElementById(\"grade\").innerHTML=currentGrade;\n\n console.log(\"t1\");\n console.log(\"t2\");\n\n return currentGrade;\n\n\n\n\n}", "function grades()\n{\n\tvar hwavg, mtexam, finalexam, acravg, finalavg, grade;\n\t\n\tvar errorMessage = \"<span style='color: #000000; background-color: #FF8199;\" + \n\t\t\t\t\t\t\"width: 100px;font-weight: bold; font-size: 14px;'>\" +\n\t\t\t\t\t\t\"Input must be integers between 0 and 100</span>\";\n\n\thwavg = document.forms[\"myform\"].elements[\"hwavg\"].value;\n\tmtexam = document.forms[\"myform\"].elements[\"midterm\"].value;\n\tfinalexam = document.forms[\"myform\"].elements[\"finalexam\"].value;\n\tacravg = document.forms[\"myform\"].elements[\"acravg\"].value;\n\n\thwnum = parseInt(hwavg, 10);\n\tmtnum = parseInt(mtexam, 10);\n\tfinnum = parseInt(finalexam, 10);\n\tacrnum = parseInt(acravg, 10);\n\n\n\tif( isNaN(hwnum) || isNaN(mtnum) || isNaN(finnum) || isNaN(acrnum) || \n\t\thwnum < 0 || mtnum < 0 || finnum < 0 || acrnum < 0 || \n\t\thwnum > 100 || mtnum > 100 || finnum > 100 || acrnum > 100)\n {\n \tdocument.getElementById(\"errorMsg\").innerHTML = errorMessage; \n }\n \telse \n \t{\n\n\t\tfinalavg = (.5 * hwnum) + (.2 * mtnum) + (.2 * finnum) + (.1 * acrnum);\n\n\t\tif(finalavg >= 90) \n\t\t\t{grade = \"A\";}\n\t\telse if (finalavg >= 80 && finalavg < 90) \n\t\t\t{grade = \"B\";}\n\t\telse if (finalavg >= 70 && finalavg < 80) \n\t\t\t{grade = \"C\";}\n\t\telse if (finalavg >= 60 && finalavg < 70) \n\t\t\t{grade = \"D \\nStudent will need to retake the course\";}\n\t\telse if (finalavg < 60)\n\t\t\t{grade = \"F \\nStudent will need to retake the course\";}\n \n \tdocument.forms[\"myform\"].elements[\"result\"].value = ( \"Final Average: \" + finalavg.toFixed(0) +\n \t\t\"\\nFinal Grade: \" + grade);\n }\n\n \n\t\n}", "function calculateAverage(){\r\n var average = 0;\r\n for (var i=0; i<students.length;i++){\r\n average+=students[i].score; \r\n }\r\n //console.log(average/students.length);\r\n\r\n return (average/(students.length)); \r\n}", "function addstudent(event) {\n event.preventDefault();\n clicks++;\n if (clicks == 1 && !studentString) {\n makingHeader();\n }\n if (clicks >= 1) {\n stdname = event.target.stdname.value;\n studentId = event.target.stdID.value;\n gender = event.target.gender.value;\n parentId = event.target.prntID.value;\n var firtstSub = document.getElementById(\"math\");\n //first subject\n grade1 = event.target.firstExam.value;\n grade2 = event.target.secondExam.value;\n grade3 = event.target.thirdExam.value;\n mathMark = [];\n mathMark.push(grade1, grade2, grade3);\n mathTotal = parseInt(grade1) + parseInt(grade2) + parseInt(grade3);\n\n //second subjiect\n gradeE1 = event.target.FirstExamEnglish.value;\n gradeE2 = event.target.secondExamEnglish.value;\n gradeE3 = event.target.ThirdExamEnglish.value;\n englishMark = [];\n englishMark.push(gradeE1, gradeE2, gradeE3);\n englishTotal = parseInt(gradeE1) + parseInt(gradeE2) + parseInt(gradeE3);\n\n feedBack = event.target.feedback.value;\n //third subject\n gradeS1 = event.target.firstExamScience.value;\n gradeS2 = event.target.secondExamScience.value;\n gradeS3 = event.target.ThirdExamScience.value;\n scienceMark = [];\n scienceMark.push(gradeS1, gradeS2, gradeS3);\n scienceTotal = parseInt(gradeS1) + parseInt(gradeS2) + parseInt(gradeS3);\n avg = ((mathTotal + englishTotal + scienceTotal)/3);\n // avg.push(avg);\n }\n STD = new Student(stdname, studentId, gender, parentId, mathMark, englishMark, scienceMark, feedBack, mathTotal, scienceTotal, englishTotal, avg);\n renderTable();\n updateStudent();\n}", "function getAverage(marks){\n return Math.floor(marks.reduce((a, b) => a + b) / marks.length);\n}", "function getAverage(marks){\n return Math.floor(marks.reduce((acc, c) =>(acc+c))/marks.length)\n}", "function compileResult(result) {\n var totalStds = 0;\n var subTotalScore = 0;\n angular.forEach(result, function (stdResult, key) {\n var total = 0;\n var mean = 0;\n var noSub = 0;\n var student = new Object();\n\n angular.forEach(stdResult, function (value, key) {\n student[key] = value;\n if (!isNaN(parseInt(value))) {\n total = total + parseInt(value);\n student[key + 'grade'] = computeGrade(parseInt(value));\n //console.log(computeGrade(value)); \n //stdResult.push(\"Grade:\"+grade);\n noSub++;\n }\n }, this);\n student.total = total;\n student.avg = Math.round(total / noSub);\n student.grade = computeGrade(Math.round((total / noSub)));\n $scope.classResults.push(student);\n subTotalScore += total;\n student = new Object(); //Reset the object\n\n //mean=total/noSub; \n //stdResult.push(\"Mean:\"+mean); \n //stdResult.push(\"total:\"+total); \n totalStds++;\n }, this);\n\n function computeGrade(marks) {\n //Dependent on school grading system//Grading system should be passed into this function\n if (marks >= 80) {\n return 'A';\n } else if (marks >= 75 && marks < 80) {\n return 'A-';\n } else if (marks >= 70 && marks < 75) {\n return 'B+';\n } else if (marks >= 65 && marks < 70) {\n return 'B';\n } else if (marks >= 60 && marks < 65) {\n return 'B-';\n } else if (marks >= 55 && marks < 60) {\n return 'C+';\n } else if (marks >= 50 && marks < 55) {\n return 'C';\n } else if (marks >= 45 && marks < 50) {\n return 'C-';\n } else if (marks >= 40 && marks < 45) {\n return 'D+';\n } else if (marks >= 35 && marks < 40) {\n return 'D-';\n } else if (marks >= 30 && marks < 35) {\n return 'D';\n } else if (marks < 30) {\n return 'E';\n }\n }\n\n\n function computeTotals() {}\n\n function computeMean() {}\n\n }", "function fnal()\r\n{\r\n\r\n//declares variable fmark assigns it value of sum(75) and csrmark(40)\r\n\r\nlet fmark = exam(75)+crsmark(40)\r\nconsole.log(fmark)\r\n\r\n}", "function resultDisplay(name){\r\n function total(eng,maths){\r\n var result=eng+maths;\r\n return result;\r\n }\r\n var totalMarks=total();\r\n function display(){\r\n console.log(name+\" has scored \"+totalMarks+\" marks\");\r\n }\r\n return display;\r\n}", "function createpercentagestudents(){\n return numberOfstudents * 100 / numberofpeople;\n}", "function crsmark(a)\r\n{\r\n//assigning a variable exm to a value in which the avg(2) is multiplied with (a/100).\r\nlet exm = avg(2)*(a/100)\r\n//stating that the function crsmark should output exm results after its execution.\r\n return exm\r\n}", "function crsmark(a)\r\n{\r\n//Declaing a variable called exm and assigning it to the value avg with parameter 2 multiplied by parameter a divided bt 100\r\nlet exm = avg(2)*(a/100)\r\n//Calling the value in the variable exm\r\n return exm\r\n}", "function getAverage(marks) {\n\tvar sum = marks.reduce(function(a, b) { return a + b; });\n\tvar avg = sum / marks.length;\n \treturn Math.floor(avg);\n}", "function calculateGrade(marks) {\n let score = 0;\n\n for (let mark of marks) {\n score += mark;\n }\n\n score = score / marks.length;\n\n if (score > 90)\n return 'A';\n else if (score > 80)\n return 'B'\n else if (score > 70)\n return 'C'\n else if (score > 60)\n return 'D'\n\n return 'F';\n}", "function getSubjectAverage(){\nvar iCounter = 0;\nvar iSize=0;\nvar iInnerCounter=0;\nvar oSubjectAverage1;\nvar iSum=0;\nvar sValue=\"\";\nvar iSubjectCounter=0;\noSubjectAverage={};\n\nfor(iInnerCounter=2;iInnerCounter<sHeaderList.length;iInnerCounter++){\n iSum=0;\n if(sHeaderList[iInnerCounter] !== \"\" && sHeaderList[iInnerCounter] !== \"Percentage\"){\n oSubjectAverage1={};\n iSubjectCounter=0;\n for(iCounter=0;iCounter<oSubject1.length;iCounter++){\n sValue = oSubject1[iCounter][sHeaderList[iInnerCounter]];\n if(sValue !== NaN && sValue !== \"\" && sValue !== undefined){\n iSum = iSum + parseInt(sValue);\n iSubjectCounter++;\n }\n}\noSubjectAverage1[sHeaderList[iInnerCounter]] = iSum/iSubjectCounter;\noSubjectAverage[iSize] = oSubjectAverage1;\niSize++;\n }\n}\n }", "function studentReport(obj){\n let {m1,m2} =obj;\n let avg = m1+m2/2\n return avg;\n}", "function StudentReport() {\n this.grade1 = 4;\n this.grade2 = 2;\n this.grade3 = 1;\n this.getGPA = function() {\n return (this.grade1 + this.grade2 + this.grade3) / 3;\n };\n}", "function fnal()\r\n{\r\n //invocking exam and crsmark, assigning parameters to variable with name fmark.\r\n //solving for fmark \r\nlet fmark = exam(75)+crsmark(40)\r\n//posting the fmark results to the browser's console\r\nconsole.log(fmark)\r\n\r\n}", "function calculatePercentage(marks,creditWeights){\n var percentage=0;\n var combinedCreditWeight=0; \n\n for (var i=0; i<maxCourses; i++){ //checks every input for a valid entry\n \n var mark=parseFloat(marks[i]);\n \n if (mark>=0 && mark<=100 && !isNaN(mark)){ //checks to make sure an input exists and is valid\n var creditWeight=Number(creditWeights[i]);\n percentage+=mark*creditWeight;\n combinedCreditWeight+=creditWeight;\n }\n }\n percentage/=combinedCreditWeight;\n\n if (isNaN(percentage)) //in case no inputs were filled in and combinedCreditWeight stays at 0\n percentage=0;\n\n return percentage;\n}", "function fnal()\r\n {\r\n let fmark = exam(75)+crsmark(40) //fmark = (0.6*75) + (85*40/100)\r\n console.log(fmark) \r\n\r\n }", "function getAverage (a,b,c,d,e){\n var average = (a+b+c+d+e)/5;\n return \"\\nThe average is: \" + average\n}", "function avg (num1, num2, num3) {\n // To get to average of three numbers:\n // 1)add the numbers together\n // 2)divide the sum of those numbers by 3 since there are three parameters\n\n let avgSum = num1 + num2 + num3;\n return avgSum / 3 \n}", "function averageOf(no1, no2, no3) {\n return (no1 + no2 + no3)/3;\n}", "function getGrade (s1, s2, s3) {\n // Code here\n var mean = (s1 + s2 + s3) / 3;\n var grade;\n if (mean >= 90) { grade = \"A\"; }\n else if (mean >= 80) { grade = \"B\"; }\n else if (mean >= 70) { grade = \"C\"; }\n else if (mean >= 60) { grade = \"D\"; }\n else { grade = \"F\"; }\n return grade;\n}", "function getGrade(score1, score2, score3) {\n let letterGrade = '';\n const mean = (score1 + score2 + score3) / 3;\n\n if (mean >= 90 && mean <= 100) {\n letterGrade = 'A';\n } else if (mean >= 80 && mean < 90) {\n letterGrade = 'B';\n } else if (mean >= 70 && mean < 80) {\n letterGrade = 'C';\n } else if (mean >= 60 && mean < 70) {\n letterGrade = 'D';\n } else {\n letterGrade = 'F';\n }\n\n console.log(letterGrade);\n}", "function main(input){\n console.log(grades(input));\n}", "function fnal()\n{\n\n//Assign the final result from the math equation to fmark \n\nlet fmark = exam(75)+crsmark(40)\nconsole.log(fmark)\n\n}", "getAverageGrades() {\n let total = 0\n for (let i = 0; i < students.length; i++) {\n const student = students[i];\n total += student.getAverageGrades();\n }\n return total / students.length\n }", "function fnal()\n{\nlet fmark = exam(75)+crsmark(40)\nconsole.log(fmark)\n\n}", "function result() {\n var input = document.getElementById(\"marks\");\n // console.log(\"your marks=\", input.value);\n if (input.value > 90) {\n console.log(\"The grade for\", input.value, \"is AA\");\n } else if (input.value > 80 && input.value <= 90) {\n console.log(\"The grade for\", input.value, \"is AB\");\n } else if (input.value > 70 && input.value <= 80) {\n console.log(\"The grade for\", input.value, \"is BB\");\n } else if (input.value > 60 && input.value <= 70) {\n console.log(\"The grade for\", input.value, \"is BC\");\n } else if (input.value > 50 && input.value <= 60) {\n console.log(\"The grade for\", input.value, \"is CC\");\n } else if (input.value > 40 && input.value <= 50) {\n console.log(\"The grade for\", input.value, \"is CD\");\n } else if (input.value > 30 && input.value <= 40) {\n console.log(\"The grade for\", input.value, \"is DD\");\n } else console.log(\"The grade for\", input.value, \"is FF\");\n}", "function fnal()\r\n{\r\n\r\n//Declaring variable called fmark and assigning it with values exam and parameter 75 plus value crsmark and parater 40\r\n\r\nlet fmark = exam(75)+crsmark(40)\r\nconsole.log(fmark)\r\n\r\n}", "function average_num(num1,num2,num3){\r\n sum=num1+num2+num3;\r\n console.log(\"Sum is\",sum);\r\n average=sum/3;\r\n console.log(\"Average is\",average);\r\n}", "function getAverage(marks){\n var average = 0;\n for (var i = 0; i < marks.length;i++) {\n var average = marks[i] + average;\n }\n return Math.floor(average/marks.length)\n}", "function getGrade(marks){\n\n if(marks>90){\n console.log('Hey, you got A rank');\n }\n else if(marks > 80){\n console.log('Hey, you got just kidding B')\n }else if(marks >70){\n console.log('Hey, Happy man you got \"c\"')\n }\n else{\n console.log('this is not working');\n }\n \n}", "function getGrade(s1, s2, s3) {\n /*\n let a = (s1+s2+s3) / 3;\n\n if (a >= 90 && a <= 100) {\n return 'A';\n } else if (a >= 80 && a < 90) {\n return 'B';\n } else if (a >= 70 && a < 80) {\n return 'C';\n } else if (a >= 60 && a < 70) {\n return 'D';\n } else {\n return 'F';\n }\n */\n\n let avg = (s1 + s2 + s3) / 3;\n\n if (avg >= 90 && avg <= 100) return 'A';\n else if (avg >= 80 && avg < 90) return 'B';\n else if (avg >= 70 && avg < 80) return 'C';\n else if (avg >= 60 && avg < 70) return 'D';\n else return 'F';\n}", "function fnal()\n{\n\n//A let variable fmark is being declared.\n//The variable is being assigned the resulting value from the sum of the methods exam and crsmark; passed with arguments 75 and 40 respectively.\n//The console is an object and it is appended with the method log. \n//The log method is used to output the resultant value from the variable fmark onto the console.\nlet fmark = exam(75)+crsmark(40)\nconsole.log(fmark)\n\n}", "function fnal() {\n\n //Here we have assigned our variable fmark to give us exam(75) and add it to crsmark(40).\n //Then we log or call out a result for fmark on the console (terninal).\n let fmark = exam(75) + crsmark(40)\n console.log(fmark)\n\n }", "function calcAverage(score1, score2, score3) {\n return (score1 + score2 + score3) / 3;\n}", "function calculatePercentage() {\n // Constants:\n let MAX_QUESTIONS1 = 5;\n \n // Converting \"score\" to an integer:\n var scoreInteger = parseInt(score1);\n \n // Calculating percentage:\n let finalPerecntage = Math.floor((scoreInteger / MAX_QUESTIONS1) * 100);\n \n // Converting \"finalPerecntage\" to an integer:\n var finalPerecntageInteger = parseInt(finalPerecntage);\n\n // Proceeding depending on the user's percentage score:\n // If user got 60% or higher (Answered 3 questions correctly):\n if (finalPerecntageInteger >= 60) {\n // User passed quiz:\n // Calling function \"quizPassed\" with \"finalPerecntageInteger\" as parameters to proceed:\n quizPassed(finalPerecntageInteger);\n } else {\n // User failed quiz:\n // Calling function \"quizFailed\" with \"finalPerecntageInteger\" as parameters to proceed:\n quizFailed(finalPerecntageInteger);\n }\n}", "function average(a, b, c) {\nvar a = 1;\nvar b = 2;\nvar c = 3;\nreturn (a + b + c) / 3;\n}", "function calculate_gpa(student_grades) {\n // set grade_total to 0\n let grade_total = 0;\n // for each grade in student_grades\n let num_of_grades = student_grades.length;\n for (let i = 0; i<num_of_grades; i++) {\n let grade = student_grades[i];\n // if grade is not a 1, 2, 3, or 4\n if (grade < 1 || grade > 4) {\n // print \"invalid grade\" with grade\n console.log(\"invalid grade: \" + grade);\n // exit function with \"can't complete calculation\" message\n return \"Can't complete calculation\";\n } else {\n // else add grade to grade_total\n grade_total += student_grades[i];\n }\n\n }\n // set gpa to grade_total / number of grades\n const gpa = grade_total / num_of_grades;\n // return gpa\n return gpa;\n // end function\n }", "function crsmark(a) {\n //Declaring a variable 'exm' and assigning it the value returned by 'avg() function multiplied with result of aurgument a/100\n let exm = avg(2) * (a / 100);\n //Return the value of 'exm' for use outside the crsmark() function \n return exm;\n}", "function JavaScriptAlert26() {\r\n var a = prompt(\"Toatal marks : \", \"980\");\r\n var b = prompt(\"Mark Obtained : \", \"804\");\r\n\r\n\r\n var z = b * 100 / a;\r\n\r\n\r\n q = \"Total marks \" + a;\r\n w = \"Mark Obtained \" + b;\r\n e = \"Percentage \" + z + \"%\";\r\n\r\n document.getElementById(\"ma39\").innerHTML = q;\r\n document.getElementById(\"ma40\").innerHTML = w;\r\n document.getElementById(\"ma41\").innerHTML = e;\r\n\r\n\r\n}", "average() {\n\n }", "function crsmark(a)\n{\n//Assign exm the final result from the math equation\nlet exm = avg(2)*(a/100)\n\n//return exm value\n return exm\n}", "function getAverage(marks) {\n let total = 0;\n for (i = 0; i < marks.length; i++) {\n total += marks[i];\n }\n\n let mean = total / marks.length;\n\n let rMean = Math.floor(mean);\n\n return rMean;\n}", "function doSomeTypeOfMath(firstGrade, secondGrade){\n //Do some type of math\n // Add the two together\n // Divide the total / 2\n return (firstGrade + secondGrade) / 2;\n\n}", "function average(a, b, c, d, e) {\n let aver = (a + b + c + d + e) / 5;\n console.log(aver);\n }", "function average(firstNumber,secondNumber,thirdNumber){\n return (firstNumber+secondNumber+thirdNumber)/3\n }", "function average(a, b, c) {\n\nreturn (a + b + c) / 3;\n\n}", "function Student(id, name, surname, grades){\n this.id = id,\n this.name = name,\n this.surname = surname,\n this.grades = grades,\n this.getAverage = function(){\n var temp = 0;\n for (var g in grades){\n temp = temp + parseInt(g);\n }\n \n return temp / grades.length \n },\n this.getInfo = function(){\n return this.name + \" \" + this.surname;\n }\n\n}", "function calculateGrade(marks) {\n const average = calculateAverage(marks);\n if (average < 60) return \"F\";\n if (average < 70) return \"D\";\n if (average < 80) return \"C\";\n if (average < 90) return \"B\";\n return \"A\";\n}", "function calculateGrade(marks) {\n const average = calculateAverage(marks);\n if (average < 60) return \"F\";\n if (average < 70) return \"D\";\n if (average < 80) return \"C\";\n if (average < 90) return \"B\";\n return \"A\";\n}", "function question1 () {\n// Answer:\n\n\nconst priceAverage = function(data) {\n var price = 0,\n average;\n\n for (var i = 0; i < data.length; i++) {\n price += data[i].price;\n }\n average = price / data.length;\n return average;\n};\nconsole.log(priceAverage(data));\n\n}", "function calculateGrade(marks) {\n const average = calculateAverage(marks);\n\n if (average < 60) return \"F\";\n if (average < 70) return \"D\";\n if (average < 80) return \"C\";\n if (average < 90) return \"B\";\n return \"A\";\n}", "function calculateAverage() {\r\n var sum = 0;\r\n for (var i = 0; i < arguments.length; i++) {\r\n sum += arguments[i];\r\n }\r\n return sum / 4;\r\n }", "function average() { \n\treturn a;\n}", "function meanFunc() {\n let meanNum = (parseInt(num1) + parseInt(num2) + parseInt(num3) / 3);\n meanNum = meanNum.toFixed(2);\n console.log(\"MEAN: \" + meanNum);\n results[2].textContent = \"Mean: \" + meanNum;\n\n}", "function crsmark(a)\n{\nlet exm = avg(2)*(a/100)\n return exm \n}", "function calculate_score() {\n resetError();\n consoleLogInputs();\n if(checkAllErrors()) {\n printAllGradeNeeded();\n }\n}//runs all the important stuff!!!!!!!", "function crsmark(a)\r\n{\r\n//declares variable exm and assigns it the value of avg 2 times a divided by 100\r\nlet exm = avg(2)*(a/100)\r\n//specifies the value of exm when run on the console\r\n return exm\r\n}", "function students(total, part) {\n const percentage = d3\n .scaleLinear()\n .domain([0, 100]) // pass in a percent\n .range([0, total]);\n\n return percentage(part);\n }", "function questionClicked() // Function for when the question is clicked. This function should take all the stats from all reviews under the question and combine them\r\n{\r\nvar questionWordCount; // total word count of all the reviews under the question\r\n\r\nvar questionSentimentScore; // sentiment score average of all the reviews\r\nvar questionSentimentWordCount; // total sentiment words in all the reviews\r\nvar questionSentimentPercent; // percentage of sentiment words vs total words\r\n\r\nvar questionActionableScore; // actionable score average of all the reviews\r\nvar questionActionableWordCount // how many actionable-related words are in all the reviews\r\nvar questionActionablePercent; // percentage of actionable words vs total words\r\n\r\nvar questionRudeScore; // rude word score average from all the reviews\r\nvar questionRudeWordCount; // how many rude words are in all the reviews\r\nvar questionRudePercent; // percentage of rude words vs total words\r\n\r\n\tfunction questionCalculations()\r\n\t{\r\n\t\t// here, calculations for all the above variables should occur\r\n\t}\r\n}", "function task14_16_8(){\n var names =[\"Michael\",\"John\",\"Tony\"];\n var score =[320,230,480];\n var total = 500;\n document.write(\"Score of \"+names[0]+ \" is \"+score[0]+ \" Percentage: \"+ score[0]/total * 100 + \"% <br>\");\n document.write(\"Score of \"+names[1]+ \" is \"+score[1]+ \" Percentage: \"+ score[1]/total * 100 + \"% <br>\");\n document.write(\"Score of \"+names[2]+ \" is \"+score[2]+ \" Percentage: \"+ score[2]/total * 100 + \"% <br>\");\n}", "function getArithmeticAverage (data) {\n let _data = data.reduce((acc, item) => {\n if (!Number(item.grade)) return acc;\n acc.subjects++;\n acc.acc += item.grade;\n return acc;\n }, { subjects: 0, acc: 0 });\n return (_data.acc / _data.subjects).toFixed(4);\n }", "function getAverage(marks) {\n //TODO : calculate the downwar rounded average of the marks array\n const sum = marks.reduce((reducer, accu) => reducer + accu, 0);\n return parseInt(sum / marks.length);\n}", "function fresult() {\n var sumWeight = 0;\n var sumSpecial = 0;\n for (var i = 0; i < categories.length; i++) {\n if (isNaN(categories[i].avg)) { //checks if category has some grades in it\n //console.log(\"NAN\" + categories[i].name);\n } else {\n sumWeight += categories[i].weight;\n }\n }\n for (var i = 0; i < categories.length; i++) {\n if (isNaN(categories[i].avg)) {\n //console.log(\"NAN\" + categories[i].name);\n } else {\n sumSpecial += categories[i].specialNum;\n }\n }\n let finalGrade = Math.round(sumSpecial / sumWeight * 1000) / 10;\n if(isNaN(finalGrade)) {\n finalGrade = \"An error has occured or you are using an unsupported grade system. Please contact the developer ([email protected]). Switch off grade calculation in the settings to use the other features\";\n }\n return finalGrade + \"%\";\n }", "grade(Student, subject){\n return `${Student.name} receives a perfect score on ${subject}`;\n }", "function avg(num1, num2, num3) {\n return (num1 + num2 + num3) / 3; \n}", "function avg(num1, num2, num3){\n return (num1 + num2 + num3) / 3;\n}", "function findAvg(gradesList){\n let total = 0;\n for (let i = 0; i < gradesList.length; i++){\n total += gradesList[i];\n }\n let avg = total / gradesList.length;\n console.log(avg);\n return avg;\n}", "function avg(num1, num2, num3) {\n var average = (num1 + num2 + num3) / 3;\n\n return average;\n\n}", "function grade(marks) {\n if(marks > 90) {\n alert(\"AA\");\n }\n else {\n if (marks > 80) {\n alert(\"AB\");\n }\n else {\n if (marks > 70) {\n alert(\"BB\");\n }\n else {\n if (marks > 60) {\n alert(\"BC\");\n }\n else {\n if (marks > 50) {\n alert(\"CC\");\n }\n else {\n if (marks > 40) {\n alert(\"CD\");\n }\n else {\n if (marks > 30){\n alert(\"AA\");\n }\n else\n alert(\"FF\");\n }\n }\n }\n }\n }\n }\n}", "function fnalCrsMrk() {\n //Declaring a variable 'fmark' and assigning it the returned value from the exam() function added to returned value from crsmark() function\n let fmark = exam(75) + crsmark(40);\n //Output to the console the value of fmark variable\n console.log(fmark);\n}", "function calcAverage(a, b, c, d){ //Sets up the function call\n var hustleAverage = ( Number(a) + Number(b) + Number(c))/ d; //This is the code the function runs\n console.log(hustleAverage) //Prints the result to the console\n return hustleAverage; //Returns the Average to the variable\n}", "function yourScore() {\n return fname + ' scored ' + (mid + final);\n }" ]
[ "0.8269121", "0.794054", "0.73219156", "0.71002465", "0.6966591", "0.69099975", "0.6857449", "0.68106353", "0.6764788", "0.6741185", "0.6706031", "0.66975886", "0.66516775", "0.6602231", "0.65752596", "0.6573311", "0.65039", "0.64431435", "0.6438452", "0.6428826", "0.6417118", "0.64148", "0.63715726", "0.6361965", "0.6335675", "0.6310322", "0.6292878", "0.6266628", "0.62417513", "0.6238081", "0.6236406", "0.6235762", "0.62218213", "0.6214199", "0.6212249", "0.6204438", "0.6191646", "0.6166271", "0.61573446", "0.6156991", "0.61496884", "0.61390465", "0.61377275", "0.6132683", "0.6130804", "0.61287963", "0.6128124", "0.61104643", "0.61073214", "0.60964626", "0.6075483", "0.6074248", "0.6065641", "0.6065132", "0.6064713", "0.60640144", "0.6061377", "0.60442746", "0.6042629", "0.60408854", "0.6039444", "0.6038696", "0.6038237", "0.60302585", "0.60255826", "0.60121816", "0.6002786", "0.6000233", "0.59998643", "0.5997057", "0.5986352", "0.59863424", "0.5978056", "0.5964488", "0.59627676", "0.59501845", "0.59501845", "0.5945331", "0.5926431", "0.59229344", "0.59190434", "0.5891837", "0.5891036", "0.5886506", "0.58849895", "0.58849317", "0.5871213", "0.58484715", "0.58473223", "0.58402044", "0.582444", "0.582108", "0.5818862", "0.5817548", "0.5813815", "0.5798563", "0.57916427", "0.5787953", "0.5787034", "0.57839245" ]
0.7793433
2
7. Write a function with switch statement to count the number of occurrences of any two vowels in succession in a line of text. For example, in the sentence
function vowel_count(str1) { var vowel_list = "aeAE"; var vcount = 0; for (var x = 0; x < str1.length; x++) { if (vowel_list.indexOf(str1[x]) !== -1) { vcount += 1; } } return vcount; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findOccurrences() {\n var str = \"Pleases read this application and give me gratuity\";\n var count = 0;\n let haveSeenVowel = false;\n \n for (const letter of str.toLowerCase()) {\n switch (letter) {\n case 'a':\n case 'e':\n case 'i':\n case 'o':\n case 'u':\n {\n if (haveSeenVowel) {\n count++;\n haveSeenVowel = false;\n } else {\n haveSeenVowel = true;\n }\n break;\n }\n default:\n haveSeenVowel = false\n }\n }\n \n return count\n }", "function findOccurrences() {\r\n var str = \"Pleases read this application and give me gratuity\";\r\n var count = 0;\r\n switch (str) {\r\n case 'a':\r\n count++;\r\n case 'A':\r\n count++\r\n case 'e':\r\n case 'E':\r\n case 'i':\r\n case 'I':\r\n case 'o':\r\n case 'O':\r\n case 'u':\r\n case 'U':\r\n console.log (1);\r\n default:\r\n console.log(0);\r\n }\r\n }", "function vowel_count(str)\n{\n //code goes here\n}", "function countVowels(word) {\n // TODO: Place your code here\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 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 getCount(str) {\n let vowelsMatch = \"aeiou\";\n //this is your counter\n let vowelsCount = 0;\n //loop over the string that is passed in \n for (i=0; i < str.length; i++) {\n //loop over the vowels string to compare each index position against the string that was passed in to find any matches\n for (v=0; v < vowelsMatch.length; v++) {\n // if any 2 indexes are equal, add 1 to the vowel count\n if (str[i] === vowelsMatch[v]) {\n vowelsCount++;\n }\n }\n }\n return vowelsCount;\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 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 vowelCounter(string) {\n return string.match(/[aeiou]/ig).length\n}", "function vowels(str) {\n let counter = 0;\n for (let char of str.toLowerCase()) {\n if (char === \"a\" || char === \"e\" || char === \"i\" || char === \"o\" || char === \"u\") {\n counter++\n }\n }\n return counter\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 var matches = str.match(/[aeiou]/gi);\n\n if(matches.includes(\"i\") ||matches.includes(\"o\") || matches.includes(\"a\") || matches.includes(\"e\") || matches.includes(\"u\") ){\n\n return matches.length;\n }else{\n\n return 0;\n }\n\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 countVowels1(str) {\n\n\tlet sum = 0;\n\tlet letters = str.split('');\n\n\tfor (let i = 0; i < letters.length; i++) {\n\n\t\tconst l = letters[i];\n\n\t\tif (l === 'a' || l === 'e' || l === 'i' || l === 'o' || l === 'u') {\n\n\t\t\tsum++;\n\t\t}\n\t}\n\n\treturn sum;\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(string2) {\n let match = string2.match(/[aeiou]|[AEIOU]/g);\n let output3 = `${match.length} vowels found`;\n console.log(output3); \n}", "function count(string) {\n let vowels = 0; \n let lowerCaseString = string.toLowerCase(); \n for (let i = 0; i < lowerCaseString.length; i++) {\n if (lowerCaseString[i] === 'a') {\n vowels = vowels +1; \n }else if (lowerCaseString[i] === 'e') {\n vowels = vowels +1; \n }else if (lowerCaseString[i] === 'i') {\n vowels = vowels +1; \n }else if (lowerCaseString[i] === 'o') {\n vowels = vowels +1; \n }else if (lowerCaseString[i] === 'u') {\n vowels = vowels +1; \n }\n }\n return vowels; \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 count_vowels(word) {\n let vowels = 0;\n let i = 0;\n\n while (i < word.length) {\n let char = word[i];\n if (char == \"a\" || char == \"e\" || char == \"i\" || char == \"o\" || char == \"u\") {\n vowels++\n };\n i++\n };\n return vowels\n}", "function countVowelConsonant(str) {\n\n return str.split(\"\").reduce(function (accumulator, currentValue) {\n let i=2;\n if(\"aeiou\".indexOf(currentValue) != -1) i=1; \n return accumulator +i;\n }, 0);\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 vowelCounter(sentence){\n var vowels = 'AEIOUaeiou';\n var vowelCounter = 0;\n \n for(var x = 0; x < sentence.length ; x++)\n {\n if (vowels.indexOf(sentence[x]) !== -1)\n {\n vowelCounter += 1;\n }\n \n }\n return vowelCounter;\n}", "function countVowel(word) {\n word = word.match(/[aeiouAEIOU]/gi);\n return word.length;\n}", "function countVowels2(string) {\n //create counter\n //create list of vowels array\n //for each char in str\n //if Vowels array contains char\n //increment counter\n //return counter\n \n var counter = 0;\n var vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\n \n for (var char of string) {\n if (vowels.includes(char.toLowerCase())) {\n counter++;\n }\n }\n \n return counter;\n }", "function vowels(str) {\n // split str into arr, all lowercased\n let arr = str.toLowerCase().split('')\n // set counter\n let counter = 0\n // loop thru arr\n // if element is vowel, counter++\n arr.forEach(char => {\n if (isVowel(char)) {\n counter++\n }\n })\n return counter\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 vowelBonusScore(word) {\n \tword = word.toUpperCase();\n let points = 0;\n for(i=0; i<word.length; i++){\n if (word.slice(i, i+1)==='A' || word.slice(i, i+1)==='E'|| word.slice(i, i+1)==='I' || word.slice(i, i+1)==='O' || word.slice(i, i+1)==='U'){\n points = points + 3;\n }\n else {\n points = points + 1;\n }\n }\n //console.log(points);\n return points;\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 VowelCount(str) {\n const vowels = {\n a: true,\n e: true,\n i: true,\n o: true,\n u: true,\n };\n count = 0;\n for (let i = 0; i < str.length; i++) {\n if (vowels[str[i]]) {\n count++;\n }\n }\n return count;\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 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 countVowels(str) {\n const strLower = str.toLowerCase()\n const vowels = 'aeiou'\n let count = 0\n\n for (let i = 0; i < strLower.length; i++) {\n if (vowels.indexOf(strLower[i]) !== -1) {\n count += 1\n }\n }\n\n // console.log(count)\n return count\n}", "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 countVowelConsonant(str) {\n let count = 0\n for (let i = 0; i < str.length; i++) { // for each letter in the string, add 1 to count if the letter is a vowel.\n if (str[i] === \"a\" || str[i] === \"e\" || str[i] === \"i\" || str[i] === \"o\" || str[i] === \"u\") {\n count += 1\n } else { // if the letter is not a vowel, add 2 to count.\n count += 2\n }\n } return count\n }", "function vowelCount(str){\n var vowels =\"aeuio\";\n return str.toLowerCase().split('').reduce(function(acc, nVal){\n if(vowels.indexOf(nVal) !== -1){\n if(acc[nVal]){\n acc[nVal]++;\n } else {\n acc[nVal] = 1;\n }\n }\n return acc;\n }, {});\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 getCount(test) {\r\n var vowelsCount = 0;\r\n let tempStr = test.split(\"\");\r\n let vowel = [\"a\",\"e\",\"i\",\"o\",\"u\"];\r\n for(let i = 0; i < str.length ; i++){\r\n for(let j = 0; j < str.length ; j++){\r\n if(tempStr[i].includes(vowel[j])){\r\n vowelsCount++;\r\n }\r\n }\r\n }\r\n \r\n return vowelsCount;\r\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 vowels(a) {\n var i;\n var counter = 0;\n for (i = 0; i < a.length; i++)\n if (a[i] == \"a\" || a[i] == \"e\" || a[i] == \"o\" || a[i] == \"i\" || a[i] == \"u\" || a[i] == \"A\" || a[i] == \"E\" || a[i] == \"O\" || a[i] == \"I\" || a[i] == \"U\") {\n\n counter++;\n }\n\n return counter;\n\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 vowelCount(str) {\n const vowels = \"aeiou\";\n let counter = 0;\n for (i = 0; i < str.length; i++) {\n if (vowels.indexOf(str[i].toLowerCase()) > -1) {\n counter++;\n }\n }\n return counter;\n}", "function vowels(str) {\n let count = 0;\n let checker = \"aeiou\"; // or we have give it as an array = ['a','e','i','o','u'] \n for (let char of str.toLowerCase()) {\n if (checker.includes(char)) {\n count++\n }\n\n }\n return count;\n}", "function getCount(str) {\n var vowelsCount = 0;\n \n const split = str.split(\"\") \n for (let i=0; i< split.length; i++){\n if(split[i] === 'a'|| split[i] ==='e'|| split[i] === 'i'|| split[i] === 'o'||\n split[i] === 'u') {\n vowelsCount+=1\n }\n }\n return vowelsCount;\n }", "function countVowels(word) {\n let vowelCounter = 0;\n let vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\n for (let i = 0; i < word.length; i++) {\n if (vowels.includes(word[i])) {\n vowelCounter += 1\n }\n }\n return vowelCounter\n}", "function countVowels(str){\n let vowelCount=0;\n for(let i=0; i<str.length; i++){\n if('AEIOUaeiou'.includes(str[i])){\n vowelCount++;\n }\n }\n return vowelCount;\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}", "function findNumberOfVowels(mySentence) {\n const vowelList = [\"a\", \"e\", \"i\", \"o\", \"u\"];\n let currentVowelCount = 0; \n const arrayOfLetters = mySentence.toLowerCase().split(\"\"); \n \n for(let x = 0; x < arrayOfLetters.length; x++) {\n if (vowelList.includes(arrayOfLetters[x])) {\n currentVowelCount += 1; \n }\n }\n return currentVowelCount; \n}", "function countVowels(string) {\n if (string.length === 0) {\n return 0;\n }\n if (string.slice(0, 1).toUpperCase() === \"A\" || string.slice(0, 1).toUpperCase() === \"E\" \n || string.slice(0, 1).toUpperCase() === \"I\" || string.slice(0, 1).toUpperCase() === \"O\" \n || string.slice(0, 1).toUpperCase() === \"U\") {\n return increment(countVowels(string.slice(1)));\n }\n return countVowels(string.slice(1))\n}", "subtractOneForE(aStr){\n let vowelsCount = this.countVows(aStr);\n if(aStr.endsWith('e')){\n vowelsCount --;\n }\n return vowelsCount;\n\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 getCount(str) {\n var vowelsCount = 0;\n\n let pos = {\n A : str.indexOf(\"a\"),\n E : str.indexOf(\"e\"),\n I : str.indexOf(\"i\"),\n O : str.indexOf(\"o\"),\n U : str.indexOf(\"u\")\n }\n\n while ( pos.A != -1 ) {\n vowelsCount++;\n pos.A = str.indexOf( \"a\", pos.A + 1 );\n }\n while ( pos.E != -1 ) {\n vowelsCount++;\n pos.E = str.indexOf( \"e\", pos.E + 1 );\n }\n while ( pos.I != -1 ) {\n vowelsCount++;\n pos.I = str.indexOf( \"i\", pos.I + 1 );\n }\n while ( pos.O != -1 ) {\n vowelsCount++;\n pos.O = str.indexOf( \"o\", pos.O + 1 );\n }\n while ( pos.U != -1 ) {\n vowelsCount++;\n pos.U = str.indexOf( \"u\", pos.U + 1 );\n }\n return vowelsCount;\n}", "function numVowels(string) {\n var counter = 0;\n var newString = string.toUpperCase();\n for (var i = 0; i < string.length; i++) {\n if ((newString[i] === 'A') ||\n (newString[i] === 'E') ||\n (newString[i] === 'I') ||\n (newString[i] === 'O') ||\n (newString[i] === 'U')) {\n counter++;\n }\n }\n return counter;\n}", "function getCount4(str) {\n const vowels = {\n a: true,\n e: true,\n i: true,\n o: true,\n u: true\n };\n\n return str.split('').filter((currentLetter) => vowels[currentLetter]).length;\n}", "function countVowels(str){\n //Use .split method to break string apart into digestable bits for later.\n let splitString=str.split('');\n //Declare an object that will store the number of each vowel within.\n let numOfVowels={};\n //Declare a variable that identifies what vowels are.\n let vowels=\"aeiou\";\n \n //Use previous split string and apply .forEach to compare each letter of a string to the previously declared vowel variable\n splitString.forEach((letter)=>{\n //Declare if statement that uses .indexOf method to compare each element. Also use .toLowerCase to ensure nothing is missed.\n if(vowels.indexOf(letter.toLowerCase())!==-1){\n //If the vowel passes, add to object.\n if(letter in numOfVowels){\n numOfVowels[letter]++;\n //Otherwise, keep checking\n }else{\n numOfVowels[letter]=1;\n }\n } \n \n });\n //Return object\n return numOfVowels; \n }", "function getCount(str) {\n let vowelsCount = 0;\n for (current_char of str) {\n if (current_char === 'a' | current_char === 'e' | current_char === 'i' | current_char === 'o' | current_char === 'u') {\n vowelsCount++;\n }\n }\n return vowelsCount;\n }", "subtractOneFConstVowel(aStr){\n let vowelCount = this.subtractOneForE(aStr);\n if(aStr.match(/aa|oo|ee|ii|uu/gi)){\n return vowelCount - aStr.match(/aa|oo|ee|ii|uu/gi).length\n }else{\n return vowelCount;\n }\n }", "function getCount(str) {\n var vowelsCount = 0;\n if (str.match(/[(a)+(e)+(i)+(o)+(u)+]/g)){\n vowelsCount = str.match(/[(a)+(e)+(i)+(o)+(u)+]/g).length;\n }\n return vowelsCount;\n}", "function VowelCount(str) {\n var counter = 0;\n var vowels = \"aeiou\";\n\n //loop through every character in string\n for (var i = 0; i < str.length; i++) {\n //if vowel, increment counter\n if (vowels.indexOf(str[i]) !== -1) {\n counter++;\n }\n }\n\n return counter;\n}", "function vowels2(str) {\n const matches = str.match(/[aeiou]/gi);//g is for continue the search and i is case-insensitive \n return matches ? matches.length : 0;\n}", "function countVowels(str) {\n let vowels = 'aeiouAEIOU';\n let count = 0;\n\n for (let i = 0; i < str.length; i++) {\n if (vowels.indexOf(str[i]) !== -1) {\n count += 1;\n }\n }\n\n return count;\n\n\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(str){\n let count = 0\n str = str.toLowerCase()\n //return(console.log(str.length))\n if(str.length==0){\n return 'Empty String'\n }\n for(let i = 0; i<=str.length; i++){\n //console.log(str[i])\n //let stringLower = str[i]\n if((str[i]=='a') || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u'){\n count = count + 1\n }\n}\nreturn count\n}", "function vowelBonusScore (word){\n let score = 0;\n let vowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n for (let i = 0; i < word.length; i++){ \n if (vowels.includes(word[i])) {\n score += 3;\n } else { \n score += 1\n } \n }\n return score;\n}", "function vowels(str) {\n const regex = /[aeiouAEIOU]/\n return [...str].reduce((acc, curr) => {\n curr.match(regex) ? acc += 1 : null\n return acc\n }, 0)\n}", "function vowelCount(str) {\n var m = str.match(/[aeiou]/gi);\n return m === null ? 0 : m.length;\n }", "function vogal(frase) {\n var size = frase.length;\n var soma = 0;\n for (i = 0; i < size; i++) {\n if (frase[i] == 'a' || frase[i] == 'e' || frase[i] == 'i' || frase[i] == 'o' || frase[i] == 'u') {\n soma += 1;\n }\n }\n return soma;\n}", "function vowelCount(str) {\n var array = str.split(\"\")\n var vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']\n var count = 0\n \n for(var i = 0; i < array.length; i++) {\n if (vowels.includes(array[i])) {\n count++\n }\n } \n console.log(count)\n}", "function howManyVowels (z){\n \n let vowelsQuantity = z.match(/[aeiou]/gi).length;\n return vowelsQuantity\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 isVowel(str) {\r\n\r\n \r\n checkForVowel = str;\r\n\r\n var count = 0;\r\n\r\n for (var i = 0; i < checkForVowel.length; i++) {\r\n\r\n switch (checkForVowel[i]) {\r\n \r\n case 'a':\r\n count++;\r\n break;\r\n \r\n case 'e':\r\n count++;\r\n break;\r\n\r\n case 'i':\r\n count++;\r\n break;\r\n\r\n case 'o':\r\n count++;\r\n break;\r\n\r\n case 'u':\r\n count++;\r\n break;\r\n \r\n }\r\n\r\n }\r\n\r\n if (count > 0) {\r\n return true;\r\n } else {\r\n return false\r\n }\r\n \r\n}", "function vowels2(str) {\n /* RegEx tips:\n g -> make sure we don't stop at the first match\n i -> case insensitive\n */\n const matches = str.match(/[aeiou]/gi)\n return matches ? matches.length : 0\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 countVowelRecursiveCPS(str, cont = v => v) {\n\tif (str.length == 0) return cont(0);\n\tvar first = isVowel(str[0]) ? 1 : 0;\n\treturn countVowelRecursiveCPS(str.slice(1), function f(v) {\n\t\treturn cont(first + v);\n\t});\n}", "function countVowels(str) {\r\n\r\n var vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\r\n\r\n var string = str;\r\n var len = string.length;\r\n \r\n var counter = 0;\r\n\r\n for (var i = 0; i < len; i++) {\r\n\r\n for (var j = 0; j < 6; j++ ) {\r\n\r\n if (vowels[j] === string[i]) {\r\n counter++;\r\n }\r\n \r\n } \r\n\r\n }\r\n\r\nconsole.log(\"No. of Vowels In The String: \" + counter);\r\n \r\n}", "function findOccurrences(string) {\n\n var str = string;\n var res = str.match(/[aeiou]{2}/g);\n\n document.write(\"String: \" + str + \"<br>\")\n document.write(\"Count: \" + res.length + \"<br>\")\n document.write(\"Occurences are: \" + res)\n\n}", "function vowelsAndConsonants(string) {\n let vowels = 0;\n let consonants = 0;\n\n for (let i = 0; i < string.length; i++) {\n if (string.charAt(i) === 'a' ||\n string.charAt(i) === 'e' ||\n string.charAt(i) === 'i' ||\n string.charAt(i) === 'o' ||\n string.charAt(i) === 'u') {\n vowels++;\n } else {\n consonants++;\n }\n }\n\n return 'Vowels: ' + vowels + ' Consonants: ' + consonants;\n}", "function numOfVowels(string) {\n var m = string.match(/[aeiou]/gi);\n return m === null ? 0 : m.length;\n}", "function getCount(str) {\n return (str.match(/[aeiou]/ig)||[]).length;\n }", "function getCount(str) {\n var vowels = str.match(/[aeiouAEIOU]/gi);\n return vowels === null ? 0 : vowels.length;\n}", "function solve(s){\r\n const newS = s.split('');\r\n const vowels = ['a', 'e', 'i', 'o', 'u'];\r\n let testCounter = 0;\r\n let finalCounter = 0;\r\n \r\n for(let i = 0; i < newS.length; i++){\r\n if(vowels.includes(newS[i])) {\r\n testCounter++\r\n }\r\n else{\r\n if(testCounter > finalCounter) {\r\n finalCounter = testCounter;\r\n }\r\n testCounter = 0;\r\n }\r\n }\r\n return finalCounter;\r\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 vowelCount(str1)\n{\n var vowels = 'aeiouAEIOU';\n var count = 0;\n\n for(var i = 0; i < str1.length ; i++)\n {\n if (vowels.indexOf(str1[i]) !== -1)\n {\n count += 1;\n }\n\n }\n return count;\n}", "function getCount(str) {\n let vowelsRegex = /[a,e,i,o,u]/g\n let result = str.match(vowelsRegex)\n return result ? result.length : 0\n}", "function countVowels(str)\r\n {\r\n for (var i = 0; i < str.length; i++)\r\n if (isVowel(str[i]))\r\n \r\n // Check for vowel\r\n console.log(str[i]);\r\n console.log(str);\r\n return str;\r\n }", "function countVowels(stringEntered) {\n let count = 0;\n for (let i = 0; i < stringEntered.length; i++) {\n if (\n stringEntered[i] === \"a\" ||\n stringEntered[i] === \"e\" ||\n stringEntered[i] === \"i\" ||\n stringEntered[i] === \"o\" ||\n stringEntered[i] === \"u\"\n )\n count++;\n }\n return count;\n}", "function countVowels(string)\n{\n\tvar count = 0;\n\tvar vowel ='aeiouAEIOU'\n\tfor(var i =0;i<string.length;i++)\n\t\t{\n\t\t\tif(vowel.indexOf(string[i]) !== -1)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\n\t\t}\n\treturn 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 countVowels(target) {\n const characters = ['a', 'e', 'i', 'o', 'u'];\n let number = 0;\n\n for (let i = 0; i < target.length; i++) {\n if(characters.includes(target[i])) {\n number++;\n }\n }\n return number;\n}", "function getCount(str) {\n var vowelsCount = 0;\n var vowels = [\"a\",\"e\",\"i\",\"o\",\"u\"];\n for(var i = 0;i < str.length;i++){\n for(var j=0;j<vowels.length;j++){\n if(str[i] === vowels[j]){\n vowelsCount++;\n }\n }\n }\n \n return vowelsCount;\n }", "function getCount(str) {\n var vowelsCount = 0;\n var vowels = [\"a\",\"e\",\"i\",\"o\",\"u\"];\n for(var i = 0;i < str.length;i++){\n for(var j=0;j<vowels.length;j++){\n if(str[i] === vowels[j]){\n vowelsCount++;\n }\n }\n }\n \n return vowelsCount;\n }", "function vowels(str) {\n const matches = str.match(/[aeiou]/gi);\n\n return matches ? matches.length : 0;\n}", "function vowelBonusScore(userWord) {\n let score = 0;\n let vowel = [\"a\", \"e\", \"i\", \"o\", \"u\"];\n for (let i = 0; i < userWord.length; i++) {\n if (vowel.includes(userWord[i].toLowerCase())) {\n score += 3;\n } else {\n score += 1;\n }\n }\n return(score);\n\n}", "function howMuchCoffee(events) {\n let count = 0;\n let regex = /\\bother/gi;\n\n let lowerCase = events.filter(e => e === e.toLowerCase() && !e.match(regex)).length;\n console.log(lowerCase)\n count += lowerCase\n let upperCase = events.filter(e => e === e.toUpperCase() && !e.match(regex)).length;\n console.log(upperCase)\n count += upperCase * 2\n\n if (count === 0) return 0;\n if (count === 1) return 1;\n if (count === 2) return 2;\n if (count === 3) return 3;\n return 'You need extra sleep';\n}", "function VowelCount(str) {\n\n // First, we Remove all characters in the string that aren't vowels with the .replace method.\n // Note that ^ in Regex means \"all characters not in the set\", so placing it in front of aeiou means \"Match everything that isn't a vowel\"\n // Enclosing a set in [] means that our string matches any individual character in that set\n // Ending with our /g tag signifies that we want to do a global search and lets our engine know to going through the entire string.\n str = str.replace(/[^aeiuo]/g, \"\");\n\n // Finally, we return the length of the string to \"count\" how many vowels are left.\n return str.length;\n}", "function getCount(str) {\n const regex = /[aeiou]/g\n \n return str.match(regex) == null ? 0 : str.match(regex).length\n }", "function countVowels(arr){\n var str = arr.toString();\n var count = 0;\n count = countVowelsInStr(str, count);\n return count;\n }", "function countCode(string) { \n if (typeof string !== \"string\") {\n return \"You must provide a string as an argument\"\n }\n var splitStr = string.split('');\n let count = 0;\n for(let i = 0; i < splitStr.length -3; i++){\n if(splitStr[i] === \"c\" && splitStr[i+1] === \"o\" && splitStr[i+3] === \"e\"|| (splitStr[i].toUpperCase() && splitStr[i+1] === \"o\" && splitStr[i+3] === \"e\")){\n count +=1;\n }\n }\n return count;\n}", "function whereIsE(str) {\n let count = 0;\n for (const char of str) {\n if (char === \"e\") {\n count++;\n }\n }\n return count;\n}" ]
[ "0.803927", "0.7614731", "0.74716115", "0.7456753", "0.72949433", "0.72615814", "0.7246736", "0.7238331", "0.7233417", "0.72304344", "0.72225976", "0.7222213", "0.72154737", "0.720571", "0.7200808", "0.7176305", "0.7173675", "0.717024", "0.7161984", "0.71591604", "0.7152809", "0.713743", "0.7126013", "0.70904446", "0.7090355", "0.7080476", "0.7077124", "0.7076317", "0.70732963", "0.7072923", "0.7067048", "0.7058971", "0.70583284", "0.7052165", "0.70430547", "0.7039305", "0.7008355", "0.6995469", "0.6990033", "0.69896126", "0.696997", "0.69638515", "0.69631886", "0.695991", "0.69589674", "0.6956947", "0.6951728", "0.6946929", "0.69351083", "0.6915672", "0.6908154", "0.69010127", "0.6896972", "0.6886906", "0.6879246", "0.6877784", "0.68699783", "0.68661714", "0.68585604", "0.68373686", "0.6836666", "0.6823732", "0.6812107", "0.680942", "0.6808831", "0.68071884", "0.6806262", "0.6804072", "0.6787793", "0.6787551", "0.6787551", "0.6779813", "0.67776597", "0.6775385", "0.6759929", "0.6726312", "0.6717005", "0.67128944", "0.67119783", "0.6705024", "0.66944784", "0.6688877", "0.66829073", "0.6673235", "0.66601425", "0.66560453", "0.6656028", "0.6655381", "0.6615821", "0.6609824", "0.66082346", "0.66082346", "0.6603095", "0.6576336", "0.65670866", "0.6544282", "0.64787656", "0.64449847", "0.6443284", "0.6435576" ]
0.666661
84
8. The distance between two cities (in km.) is input through the keyboard. Write four functions to convert and print this distance in meters, feet, inches and centimeters.
function distance() { var distance = Number(prompt(" Distance between Two Cities in Km : ")); alert(" Distance in Meters : " + distance / 1000 + " \n Distance in foot" + distance / 3280.84 + "\n in inches : " + distance / 39370.1 + " \n in centimeters : " + distance / 100000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function distance() {\n var input = +prompt(\"Enter distance in KM\");\n function meter() {\n var meter = input * 1000;\n return meter;\n }\n\n function feet() {\n var feet = input * 3280.84;\n return feet;\n }\n\n\n function inches() {\n var inches = input * 39370.1;\n return inches;\n }\n\n function centimeters() {\n var centimeters = input * 100000;\n return centimeters;\n }\n\n document.write(\"Distance in meter: \" + meter() + \"<br>\");\n document.write(\"Distance in feet: \" + feet() + \"<br>\");\n document.write(\"Distance in inches: \" + inches() + \"<br>\");\n document.write(\"Distance in centimeter: \" + centimeters());\n\n}", "function distanceConversion(meters) {\n return Math.round((meters * 0.000621371) * 10) / 10;\n}", "distance(lat1, lon1, lat2, lon2, unit) {\n if ((lat1 == lat2) && (lon1 == lon2)) {\n return 0;\n }\n else {\n var radlat1 = Math.PI * lat1 / 180;\n var radlat2 = Math.PI * lat2 / 180;\n var theta = lon1 - lon2;\n var radtheta = Math.PI * theta / 180;\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = dist * 180 / Math.PI;\n dist = dist * 60 * 1.1515;\n if (unit == \"K\") { dist = dist * 1.609344 }\n if (unit == \"N\") { dist = dist * 0.8684 }\n if (dist > 80) {\n alert(AorE.A == true ? LangAr.Distance : LangEn.Distance)\n }\n }\n }", "function calcDistance(lat1,lat2,lon1,lon2) {\n var R = 6371; // km\n var dLat = ((lat2)-(lat1)).toRad();\n var dLon = ((lon2)-(lon1)).toRad();\n var lat1 = (lat1).toRad();\n var lat2 = (lat2).toRad();\n\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c;\n //km\n //return d;\n //miles\n return parseInt(parseInt(d)*.62137);\n}", "function calcDistance(lat1,lat2,lon1,lon2) {\n var R = 6371; // km\n var dLat = (parseInt(lat2)-parseInt(lat1)).toRad();\n var dLon = (parseInt(lon2)-parseInt(lon1)).toRad();\n var lat1 = parseInt(lat1).toRad();\n var lat2 = parseInt(lat2).toRad();\n\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c;\n //km\n //return d;\n //miles\n return parseInt(parseInt(d)*.62137);\n}", "function distanceFromSpaceStation() {\n prompt.start();\n prompt.get(['city'],function(err, result) {\n var requestAddress = 'https://maps.googleapis.com/maps/api/geocode/json?address=' + result.city;\n request(requestAddress, function(err, result) {\n var resultObject = JSON.parse(result.body);\n lat1 = resultObject.results[0].geometry.location.lat;\n lon1 = resultObject.results[0].geometry.location.lng;\n console.log(lat1);\n console.log(lon1);\n var issAddress = 'http://api.open-notify.org/iss-now.json';\n request(issAddress, function(err, result) {\n var resultObject = JSON.parse(result.body);\n lat2 = resultObject.iss_position.latitude.toFixed(2);\n lon2 = resultObject.iss_position.longitude.toFixed(2);\n console.log(distanceBetweenTwoPoints(lat1, lon1, lat2, lon2));\n });\n });\n });\n}", "function getDistance(x1, y1, x2, y2) {\n var dist = 0;\n\n // Calculate the distance between two northing-easting pairs\n // Ensure that all inputs are cast as numbers\n x1 = parseFloat(x1);\n y1 = parseFloat(y1);\n x2 = parseFloat(x2);\n y2 = parseFloat(y2);\n dist = Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2)) / 1000;\n\n // Convert from km to miles and truncate (round up)\n dist = Math.floor((dist / 1.6142) + 0.5);\n\n return dist;\n}", "function getDistanceInKilometers(p1, p2) {\n // Credit: adapts code for Haversine formula and degrees-to-radian conversion found at:\n // http://www.movable-type.co.uk/scripts/latlong.html\n\n var R = 6371; // earth's radius in kilometers\n var dLat = degreesToRadians(p2.lat - p1.lat);\n var dLon = degreesToRadians(p2.lng - p1.lng); \n var lat1 = degreesToRadians(p1.lat);\n var lat2 = degreesToRadians(p2.lat);\n\n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2)\n + Math.sin(dLon/2) * Math.sin(dLon/2)\n * Math.cos(lat1) * Math.cos(lat2);\n\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var distance = R * c; // kilomter\n return distance;\n}", "function calculaDistancia(lat1, lon1, lat2, lon2){\n\trad = function(x) {\n\t\treturn x*Math.PI/180;\n\t}\n\tvar R = 6378.137;//Radio de la tierra en km\n\tvar dLat = rad( lat2 - lat1 );\n\tvar dLong = rad( lon2 - lon1 );\n\n\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(rad(lat1)) * Math.cos(rad(lat2)) * Math.sin(dLong/2) * Math.sin(dLong/2);\n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\tvar d = R * c;\n\t//document.forms[0].dist.value = d;\n\treturn d.toFixed(2);//Retorna tres decimales\n}", "function distance(lat1, lon1, lat2, lon2, unit) {\r\r var radlat1 = Math.PI * lat1/180\r\r var radlat2 = Math.PI * lat2/180\r\r var radlon1 = Math.PI * lon1/180\r\r var radlon2 = Math.PI * lon2/180\r\r var theta = lon1-lon2\r\r var radtheta = Math.PI * theta/180\r\r var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\r dist = Math.acos(dist)\r\r dist = dist * 180/Math.PI\r\r dist = dist * 60 * 1.1515\r\r if (unit==\"K\") { dist = dist * 1.609344 }", "function showDistance(distance) {\n return Math.round(distance / 100) / 10 + \" km (\" + Math.round((distance * 0.621371192) / 100) / 10 + \" miles)\";\n}", "function getDistance(coords1, coords2, units) {\r\n\tvar radius = 3958.8;\r\n\t// if units is provided and says meters, we use a different magic number\r\n\tif ( units != undefined && units == 'meters' ) {\r\n\t\tradius = 6371;\r\n\t}\r\n\r\n\tvar degLat = (coords2.latitude - coords1.latitude).deg2rad();\r\n\tvar degLong = (coords2.longitude - coords1.longitude).deg2rad();\r\n\r\n\t//console.log(typeof coords2.latitude);\r\n\tvar a = \r\n\t Math.sin(degLat/2) * Math.sin(degLat/2) +\r\n\t Math.cos(coords1.latitude.deg2rad()) * Math.cos(coords2.latitude.deg2rad()) * \r\n\t Math.sin(degLong/2) * Math.sin(degLong/2); \r\n\r\n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \r\n\r\n\tif ( units != undefined && units == 'meters' ) {\r\n\t\treturn (radius * c) * 1000;\r\n\t} else { // default is yards\r\n\t\treturn (radius * c).milesToYards();\r\n\t}\r\n\t\r\n}", "function calculateDistanceKM(lat1, lon1, lat2, lon2) {\n var R = 6371;\n var dLat = (lat2-lat1).toRad();\n console.log(\"dLAT = \"+dLat);\n \n if (typeof(Number.prototype.toRad) === \"undefined\") {\n Number.prototype.toRad = function() {\n return this * Math.PI / 180;\n }\n }\n \n var dLon = (lon2-lon1).toRad();\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos((lat1* Math.PI / 180).toRad()) * Math.cos((lat2* Math.PI / 180).toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c;\n \n return d;\n}", "function distanciaPuntos(lat1,lon1,lat2,lon2)\n{\n\tvar R = 6371e3;//Radio de la tierra\n\tvar Ang1 = lat1 * Math.PI/180;\n\tvar Ang2 = lat2 * Math.PI/180;\n\tvar A1 = (lat2-lat1) * Math.PI/180;\n\tvar A2 = (lon2-lon1) * Math.PI/180;\n\n\tvar a = Math.sin(A1/2) * Math.sin(A1/2) +\n\t\t\t Math.cos(Ang1) * Math.cos(Ang2) *\n\t\t\t Math.sin(A2/2) * Math.sin(A2/2);\n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\n\treturn ((R * c)/1000).toFixed(2)+\" Km\";\n}", "function calculateDistance(lat1, lon1, lat2, lon2, unit) {\r\n var radlat1 = Math.PI * lat1 / 180\r\n var radlat2 = Math.PI * lat2 / 180\r\n var radlon1 = Math.PI * lon1 / 180\r\n var radlon2 = Math.PI * lon2 / 180\r\n var theta = lon1 - lon2\r\n var radtheta = Math.PI * theta / 180\r\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\n dist = Math.acos(dist)\r\n dist = dist * 180 / Math.PI\r\n dist = dist * 60 * 1.1515\r\n if (unit == \"K\") { dist = dist * 1.609344 }\r\n if (unit == \"N\") { dist = dist * 0.8684 }\r\n return dist\r\n}", "function distcalc(lat1, lng1, lat2, lng2) {\n\t//from www.movable-type.co.uk/scripts/latlong.html\n\tvar R = 6371; \n\tvar dLat = (lat2-lat1) * Math.PI / 180;\n\tvar dLng = (lng2-lng1) * Math.PI / 180;\n\tvar lat1 = lat1 * Math.PI / 180;\n\tvar lat2 = lat2 * Math.PI / 180;\n\t\n\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n\tMath.sin(dLng/2) * Math.sin(dLng/2) * Math.cos(lat1) * Math.cos(lat2); \n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n\tvar d = (R * c)*0.6214; //in miles\n\treturn d.toFixed(2);\n}", "function distanceCalc(lat1,lon1,lat2,lon2) {\n \n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2);\n \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c * 1000; // Distance in metres\n return d;\n}", "function getDistance(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2)\n ; \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n \n d = ConvertKmToMile(d);\n console.log(d);\n return d;\n}", "function calcDistance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = Math.PI * lat1 / 180\n var radlat2 = Math.PI * lat2 / 180\n var theta = lon1 - lon2\n var radtheta = Math.PI * theta / 180\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = Math.acos(dist)\n dist = dist * 180 / Math.PI\n dist = dist * 60 * 1.1515\n if (unit == \"K\") {\n dist = dist * 1.609344\n }\n if (unit == \"N\") {\n dist = dist * 0.8684\n }\n return dist\n}", "function calculateDistance(lat1, lon1, lat2, lon2) {\n var R = 6371; // km\n var dLat = (lat2-lat1).toRad();\n var dLon = (lon2-lon1).toRad();\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c;\n // convert to miles\n d = d * 0.621371;\n var dis = d.toFixed(2);\n return dis;\n}", "function calculateDistance(lat1, lon1, lat2, lon2, unit) {\r\n\tvar radlat1 = Math.PI * lat1/180;\r\n\tvar radlat2 = Math.PI * lat2/180;\r\n\tvar radlon1 = Math.PI * lon1/180;\r\n\tvar radlon2 = Math.PI * lon2/180;\r\n\tvar theta = lon1-lon2;\r\n\tvar radtheta = Math.PI * theta/180;\r\n\tvar subAngle = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\n\tsubAngle = Math.acos(subAngle);\r\n\tsubAngle = subAngle * 180/Math.PI; // convert the degree value returned by acos back to degrees from radians\r\n\tdist = (subAngle/360) * 2 * Math.PI * 3956; // ((subtended angle in degrees)/360) * 2 * pi * radius )\r\n\t// where radius of the earth is 3956 miles\r\n\tif (unit==\"K\") { dist = dist * 1.609344 ;} // convert miles to km\r\n\tif (unit==\"N\") { dist = dist * 0.8684 ;} // convert miles to nautical miles\r\n\treturn dist;\r\n}", "calculer_distance() {}", "function getDistance(place1, place2) {\n const R = 6371; // Radius of the earth in km\n const latDegreees = deg2rad(place2.lat-place1.lat);\n const lonDegrees = deg2rad(place2.lon-place1.lon); \n const a = \n Math.sin(latDegreees/2) * Math.sin(latDegreees/2) +\n Math.cos(deg2rad(place1.lat)) * Math.cos(deg2rad(place2.lat)) * \n Math.sin(lonDegrees/2) * Math.sin(lonDegrees/2); \n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n // distance in kilos\n const distance = R * c; \n return Math.round(distance* 0.6214 * 100) /100; \n}", "function distanceToMiles(distance) {\r\n\tswitch(distance) {\r\n\t\tcase \"miles\":\r\n\t\t\treturn 1.00;\r\n\t\tcase \"km\":\r\n\t\t\treturn 0.621371;\r\n\t\tcase \"m\":\r\n\t\t\treturn 0.000621371;\r\n\t\tcase \"yds\":\r\n\t\t\treturn 0.000568182;\r\n\t\tdefault:\r\n\t\t\treturn \"\";\r\n\t}\r\n}", "function geoDistance(place1, place2, unit='mi'){\n const geolib = require('geolib');\n let distance = geolib.getDistance(\n {latitude: place1.lat, longitude: place1.lon},\n {latitude: place2.lat, longitude: place2.lon},\n );\n return geolib.convertUnit(unit, distance, 4); \n}", "getDistance(lat1, lon1, lat2, lon2, unit) {\n const radlat1 = Math.PI * lat1/180\n const radlat2 = Math.PI * lat2/180\n const radlon1 = Math.PI * lon1/180\n const radlon2 = Math.PI * lon2/180\n const theta = lon1-lon2\n const radtheta = Math.PI * theta/180\n let dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = Math.acos(dist)\n dist = dist * 180/Math.PI\n dist = dist * 60 * 1.1515\n if (unit==\"K\") { dist = dist * 1.609344 }\n if (unit==\"N\") { dist = dist * 0.8684 }\n\n // TODO make sure we are returning the right type (number)\n return dist\n }", "function distance_calc(loc1, loc2){\n\treturn getDistanceFromLatLonInKm(loc1.lat, loc1.lng, loc2.lat, loc2.lng);\n}", "function getDistance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = Math.PI * lat1 / 180;\n var radlat2 = Math.PI * lat2 / 180;\n var radlon1 = Math.PI * lon1 / 180;\n var radlon2 = Math.PI * lon2 / 180;\n var theta = lon1 - lon2;\n var radtheta = Math.PI * theta / 180;\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = Math.acos(dist);\n dist = dist * 180 / Math.PI;\n dist = dist * 60 * 1.1515; //Miles\n if (unit == \"K\") {\n dist = dist * 1.609344;\n }\n return dist;\n }", "function getDistance(p1, p2){\r\n\tvar dLon = Math.radians(p2.lng - p1.lng); \r\n\tvar dLat = Math.radians(p2.lat - p1.lat);\r\n\tvar lat1 = Math.radians(p1.lat);\r\n\tvar lat2 = Math.radians(p2.lat);\r\n\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); \r\n\tvar c = 2 * Math.atan2( Math.sqrt(a), Math.sqrt(1-a) ) ;\r\n\tvar output = 6371 * c ;\r\n\treturn output;\r\n}", "function calculateDistance(lat1, lon1, lat2, lon2, unit) {\r\n var radlat1 = Math.PI * lat1/180\r\n var radlat2 = Math.PI * lat2/180\r\n var radlon1 = Math.PI * lon1/180\r\n var radlon2 = Math.PI * lon2/180\r\n var theta = lon1-lon2\r\n var radtheta = Math.PI * theta/180\r\n var subAngle = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\n subAngle = Math.acos(subAngle)\r\n subAngle = subAngle * 180/Math.PI // convert the degree value returned by acos back to degrees from radians\r\n dist = (subAngle/360) * 2 * Math.PI * 3956; // ((subtended angle in degrees)/360) * 2 * pi * radius where radius is 3956 miles\r\n if (unit==\"K\") { dist = dist * 1.609344 } // convert miles to km\r\n if (unit==\"N\") { dist = dist * 0.8684 } // convert miles to nautical miles\r\n return dist\r\n}", "calDistance(lat1, lon1, lat2, lon2) {\n let R = 6371; // km\n let dLat = this.toRad(lat2 - lat1);\n let dLon = this.toRad(lon2 - lon1);\n let radlat1 = this.toRad(lat1);\n let radlat2 = this.toRad(lat2);\n let a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(radlat1) * Math.cos(radlat2);\n let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n let d = R * c;\n return d;\n }", "function convertDistance(miles, units, invert = false) {\n miles = parseFloat(miles);\n let distance = miles;\n switch (units) {\n case 'Car/ Light Van':\n distance = miles ;\n break;\n case 'Medium Van':\n distance = miles;\n break;\n case 'Large Van':\n distance = miles;\n break;\n default:\n }\n return distance.toFixed(2);\n}", "function calcDistance(p1, p2) {\n\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2) / 628).toFixed(3);\n }", "function distance(lat1, lng1, lat2, lng2, miles) { // miles optional\n if (typeof miles === \"undefined\"){miles=false;}\n function deg2rad(deg){return deg * (Math.PI/180);}\n function square(x){return Math.pow(x, 2);}\n var r=6371; // radius of the earth in km\n lat1=deg2rad(lat1);\n lat2=deg2rad(lat2);\n var lat_dif=lat2-lat1;\n var lng_dif=deg2rad(lng2-lng1);\n var a=square(Math.sin(lat_dif/2))+Math.cos(lat1)*Math.cos(lat2)*square(Math.sin(lng_dif/2));\n var d=2*r*Math.asin(Math.sqrt(a));\n if (miles){\n return d * 0.621371;\n } //return miles\n else{\n return d;\n } //return km\n}", "function distance(lat1, lng1, goalat, goalng, unit) {\n\tvar radlat1 = Math.PI * lat1/180\n\tvar radlat2 = Math.PI * goalat/180\n\tvar theta = lng1-goalng\n\tvar radtheta = Math.PI * theta/180\n\tvar dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n\tdist = Math.acos(dist)\n\tdist = dist * 180/Math.PI\n\tdist = dist * 60 * 1.1515\n\tif (unit==\"K\") { dist = dist * 1.609344 }\n\tif (unit==\"N\") { dist = dist * 0.8684 }\n\tlog(\"start lat: \" + lat1 + \" start lng: \" + lng1);\n\tlog(\"end lat: \" + goalat + \" end lng: \" + goalng);\n\tlog(\"Estimated travel distance: \" + dist + \" miles\");\n\tdocument.getElementById('travelDist').value = dist;\n\treturn dist\n}", "function calcDistance(lat1,lon1,lat2,lon2){\n\tvar R = 6371; //earth's radius (KM)\n\treturn Math.acos(Math.sin(toRads(lat1))*Math.sin(toRads(lat2)) + \n Math.cos(toRads(lat1))*Math.cos(toRads(lat2)) *\n Math.cos(toRads(lon2-lon1))) * R;\n\n}", "function convertToMiles (km) {\n console.log(\"This is the Answer to Task 5a ----> \" + km + \" km is equal to \" + km * 0.62137119 + \" miles.\");\n}", "function distance(lat1, lon1, lat2, lon2) {\n var radlat1 = Math.PI * lat1/180;\n var radlat2 = Math.PI * lat2/180;\n var radlon1 = Math.PI * lon1/180;\n var radlon2 = Math.PI * lon2/180;\n var theta = lon1-lon2;\n var radtheta = Math.PI * theta/180;\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = Math.acos(dist);\n dist = dist * 180/Math.PI;\n dist = dist * 60 * 1.1515;\n\n unit = \"K\";\n if (unit==\"K\") { dist = dist * 1.609344; }\n if (unit==\"N\") { dist = dist * 0.8684; }\n return dist;\n}", "function distance(lat1, lon1, lat2, lon2, unit) {\r\n\t\tvar radlat1 = Math.PI * lat1 / 180;\r\n\t\tvar radlat2 = Math.PI * lat2 / 180;\r\n\t\tvar theta = lon1 - lon2;\r\n\t\tvar radtheta = Math.PI * theta / 180;\r\n\t\tvar dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\n\t\tdist = Math.acos(dist);\r\n\t\tdist = dist * 180 / Math.PI;\r\n\t\tdist = dist * 60 * 1.1515;\r\n\t\tif (unit == \"K\") {\r\n\t\t\tdist = dist * 1.609344;\r\n\t\t} else if (unit == \"m\") {\r\n\t\t\tdist = dist * 1609.344;\r\n\t\t} else if (unit == \"N\") {\r\n\t\t\tdist = dist * 0.8684;\r\n\t\t}\r\n\t\treturn (dist);\r\n\t}", "function millimetersToInchToFeetToYardsToMilesToCentimetersToMetersToKilometers() {\n const millimetersLength = parseFloat(millimetersInput.value);\n const inchLength = millimetersLength / 25.4;\n const feetLength = millimetersLength / 304.8;\n const yardsLength = millimetersLength / 914.4;\n const milesLength = millimetersLength / 1.609e+6;\n const centimetersLength = millimetersLength / 10;\n const metersLength = millimetersLength / 1000;\n const kilometersLength = millimetersLength / 1e+6;\n inchInput.value = roundNum(inchLength);\n feetInput.value = roundNum(feetLength);\n yardsInput.value = roundNum(yardsLength);\n milesLength.value = roundNum(milesLength);\n centimetersInput.value = roundNum(centimetersLength);\n metersInput.value = roundNum(metersLength);\n kilometersInput.value = roundNum(kilometersLength);\n}", "function calcDistance (x1,x2,y1,y2) {\n // Questions to retrieve coordinates to calculate distance\n x1 = readlineSync.question(\"Please enter x-position of first location. \");\n y1 = readlineSync.question(\"Please enter y-position of first location. \");\n x2 = readlineSync.question(\"Please enter x-position of second location. \");\n y2 = readlineSync.question(\"Please enter y-position of second location. \");\n\n // Math.round() rounds the result to 2 decimals\n result = Math.round(Math.sqrt((x1 - x2)**2 + (y1 - y2)**2) * 100) / 100;\n return `Point A =[${x1}, ${y1}], point B = [${x2}, ${y2}] => ${result}`;\n}", "function findDistance(latA, lonA, latB, lonB) {\n\n\t\tconsole.log(\"finding distance between:\",latA, lonA, latB, lonB);\n\n\t\tlet Rm = 3961; // mean radius of the earth (miles) at 39 degrees from the equator\n\t\tlet Rk = 6373; // mean radius of the earth (km) at 39 degrees from the equator\n\n\t\tlet t1, n1, t2, n2, lat1, lon1, lat2, lon2, dlat, dlon, a, c, dm, dk, mi, km;\n\t\t\n\t\t// get values for lat1, lon1, lat2, and lon2\n\t\tt1 = latA;\n\t\tn1 = lonA;\n\t\tt2 = latB;\n\t\tn2 = lonB;\n\t\tconsole.log(\"finding t distance between:\", t1, t2);\n\n\t\t// convert coordinates to radians\n\t\tlat1 = deg2rad(t1);\n\t\tlon1 = deg2rad(n1);\n\t\tlat2 = deg2rad(t2);\n\t\tlon2 = deg2rad(n2);\n\t\tconsole.log(\"finding deg2rad\", lat1, lon1, lat2, lon2);\n\n\t\t// find the differences between the coordinates\n\t\tdlat = lat2 - lat1;\n\t\tdlon = lon2 - lon1;\n\t\tconsole.log(\"dlat dlon\",dlat, dlon );\n\n\n\t\t// here's the heavy lifting\n\t\ta = Math.pow(Math.sin(dlat/2),2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2),2);\n\t\tc = 2 * Math.atan2(Math.sqrt(a),Math.sqrt(1-a)); // great circle distance in radians\n\t\tdm = c * Rm; // great circle distance in miles\n\t\tdk = c * Rk; // great circle distance in km\n\t\t\n\t\tconsole.log(\"dm dk \",dm, dk);\n\n\t\t// round the results down to the nearest 1/1000\n\t\tmi = round(dm);\n\t\tkm = round(dk);\n\t\t\n\t\t\n\t\treturn {distanceMi: mi, distanceKm: km };\n\t}", "function computeDistance( lat1, lon1, lat2, lon2 ) {\r\n\tvar degreeToSM = 60 * 1.15078; // 60 NM * (NM->SM factor)\r\n\tvar dlat = Math.abs( lat1 - lat2 ) * degreeToSM;\r\n\tvar dlon = Math.abs( lon1 - lon2 ) * degreeToSM * Math.cos( lat1 * Math.PI / 180 );\r\n\treturn Math.sqrt( dlat * dlat, dlon * dlon );\r\n}", "function distance(lat1, lon1, lat2, lon2, unit) {\n \tvar radlat1 = Math.PI * lat1/180\n \tvar radlat2 = Math.PI * lat2/180\n \tvar theta = lon1-lon2\n \tvar radtheta = Math.PI * theta/180\n \tvar dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n \tdist = Math.acos(dist)\n \tdist = dist * 180/Math.PI\n \tdist = dist * 60 * 1.1515\n \tif (unit==\"K\") { dist = dist * 1.609344 }\n \tif (unit==\"N\") { dist = dist * 0.8684 }\n \treturn dist\n }", "function calcDistance(p1, p2){\r\n\t//returns distance between the points with no decimals and in meters.\r\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2)).toFixed(0);\r\n}", "function convertDist(meters) {\n var dist = '';\n var km = 1000;\n var kilometers = Math.round((meters / km) * 10) / 10;\n dist = dist.concat(kilometers.toString() + ' km');\n\n return dist;\n}", "function calc_distance(lat1,lon1,lat2,lon2){//in degrees\n var R = 6371e3; //radius of earth in meters\n var φ1 = lat1.toRadians();\n var φ2 = lat2.toRadians();\n var Δφ = (lat2-lat1).toRadians();\n var Δλ = (lon2-lon1).toRadians();\n\n var a = Math.sin(Δφ/2) * Math.sin(Δφ/2) +\n Math.cos(φ1) * Math.cos(φ2) *\n Math.sin(Δλ/2) * Math.sin(Δλ/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\n var d = R * c;\n \n return d;\n}", "function calDistance(lat1, lon1, lat2, lon2, unit) {\n if ((lat1 === lat2) && (lon1 === lon2)) {\n return 0;\n }\n else {\n var radlat1 = Math.PI * lat1/180;\n var radlat2 = Math.PI * lat2/180;\n var theta = lon1-lon2;\n var radtheta = Math.PI * theta/180;\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = dist * 180/Math.PI;\n dist = dist * 60 * 1.1515;\n if (unit===\"K\") { dist = dist * 1.609344 }\n if (unit===\"N\") { dist = dist * 0.8684 }\n return dist;\n }\n}", "function longLatDistance (lat1, lon1, lat2, lon2) {\n var R = 6371; // km\n var dLat = (lat2-lat1).toRad();\n var dLon = (lon2-lon1).toRad(); \n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) * \n Math.sin(dLon/2) * Math.sin(dLon/2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c;\n //sys.puts(d.toString() + \"km from here\");\n return d;\n}", "function findDistance(latlong1, latlong2) {\n\tvar t1, n1, t2, n2, lat1, lon1, lat2, lon2, dlat, dlon, a, c, dm, dk, mi, km;\n\t\n\t// get values for lat1, lon1, lat2, and lon2\n\tt1 = latlong1.lat;\n\tn1 = latlong1.lon;\n\tt2 = latlong2.lat;\n\tn2 = latlong2.lon;\n\t\n\t// convert coordinates to radians\n\tlat1 = deg2rad(t1);\n\tlon1 = deg2rad(n1);\n\tlat2 = deg2rad(t2);\n\tlon2 = deg2rad(n2);\n\t\n\t// find the differences between the coordinates\n\tdlat = lat2 - lat1;\n\tdlon = lon2 - lon1;\n\t\n\t// here's the heavy lifting\n\ta = Math.pow(Math.sin(dlat/2),2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2),2);\n\tc = 2 * Math.atan2(Math.sqrt(a),Math.sqrt(1-a)); // great circle distance in radians\n\tdm = c * Rm; // great circle distance in miles\n\tdk = c * Rk; // great circle distance in km\n\t\n\t// round the results down to the nearest 1/1000\n\tmi = round(dm);\n\tkm = round(dk);\n\t\n\t// display the result\n\treturn mi;\n}", "function getDistance(pointOne, pointTwo) {\n\t\tvar t1, n1, t2, n2, lat1, lon1, lat2, lon2, dlat, dlon, a, c, dm, dk, mi, km;\n\t\ta = stops[pointOne].poke_lat;\n\t\tb = stops[pointOne].poke_lng;\n\t\ta = a.substring(0, 2) + \".\" + a.substring(2);\n\t\tb = b.substring(0, 3) + \".\" + b.substring(3);\n\t\t\n\t\t// get values for lat1, lon1, lat2, and lon2\n\t\tt1 = a;\n\t\tn1 = b;\n\t\t\n\t\ta = stops[pointTwo].poke_lat;\n\t\tb = stops[pointTwo].poke_lng;\n\t\t\n\t\ta = a.substring(0, 2) + \".\" + a.substring(2);\n\t\tb = b.substring(0, 3) + \".\" + b.substring(3);\n\t\tt2 = a;\n\t\tn2 = b;\n\t\t\n\t\t// convert coordinates to radians\n\t\tlat1 = deg2rad(t1);\n\t\tlon1 = deg2rad(n1);\n\t\tlat2 = deg2rad(t2);\n\t\tlon2 = deg2rad(n2);\n\t\t\n\t\t// find the differences between the coordinates\n\t\tdlat = lat2 - lat1;\n\t\tdlon = lon2 - lon1;\n\t\t\n\t\t// here's the heavy lifting\n\t\ta = Math.pow(Math.sin(dlat/2),2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2),2);\n\t\tc = 2 * Math.atan2(Math.sqrt(a),Math.sqrt(1-a)); // great circle distance in radians\n\t\tdm = c * Rm; // great circle distance in miles\n\t\tdk = c * Rk; // great circle distance in km\n\t\t\n\t\t// round the results down to the nearest 1/1000\n\t\tmi = round(dm);\n\t\treturn mi;\n\t}", "function distance(lat1, lon1, lat2, lon2, unit) {\n\tvar radlat1 = Math.PI * lat1/180\n\tvar radlat2 = Math.PI * lat2/180\n\tvar radlon1 = Math.PI * lon1/180\n\tvar radlon2 = Math.PI * lon2/180\n\tvar theta = lon1-lon2\n\tvar radtheta = Math.PI * theta/180\n\tvar dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n\tdist = Math.acos(dist)\n\tdist = dist * 180/Math.PI\n\tdist = dist * 60 * 1.1515\n\tif (unit==\"K\") { dist = dist * 1.609344 }\n\tif (unit==\"N\") { dist = dist * 0.8684 }\n\treturn dist\n}", "function distance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = Math.PI * lat1/180\n var radlat2 = Math.PI * lat2/180\n var theta = lon1-lon2\n var radtheta = Math.PI * theta/180\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = Math.acos(dist)\n dist = dist * 180/Math.PI\n dist = dist * 60 * 1.1515\n if (unit==\"K\") { dist = dist * 1.609344 }\n if (unit==\"N\") { dist = dist * 0.8684 }\n return dist\n }", "function getDistance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = Math.PI * lat1 / 180\n var radlat2 = Math.PI * lat2 / 180\n var radlon1 = Math.PI * lon1 / 180\n var radlon2 = Math.PI * lon2 / 180\n var theta = lon1 - lon2\n var radtheta = Math.PI * theta / 180\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = Math.acos(dist)\n dist = dist * 180 / Math.PI\n dist = dist * 60 * 1.1515\n if (unit == \"K\") {\n dist = dist * 1.609344\n }\n if (unit == \"N\") {\n dist = dist * 0.8684\n }\n return dist;\n }", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p) / 2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p)) / 2;\n var milesAway = (12742 * Math.asin(Math.sqrt(a))) / 1.609344;\n return (milesAway).toFixed(1); // 2 * R; R = 6371 km\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p) / 2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p)) / 2;\n var milesAway = (12742 * Math.asin(Math.sqrt(a))) / 1.609344;\n return (milesAway).toFixed(1); // 2 * R; R = 6371 km\n}", "function getDistance(lat1,lon1,lat2,lon2) {\n var R = 3959; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2)\n ; \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n return d;\n}", "function GetDistance(lat1, lon1, lat2, lon2, unit) {\n \tvar radlat1 = Math.PI * lat1/180\n \tvar radlat2 = Math.PI * lat2/180\n \tvar theta = lon1-lon2\n \tvar radtheta = Math.PI * theta/180\n \tvar dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n \tif (dist > 1) {\n \t\tdist = 1;\n \t}\n \tdist = Math.acos(dist)\n \tdist = dist * 180/Math.PI\n \tdist = dist * 60 * 1.1515\n \tif (unit==\"K\") { dist = dist * 1.609344 }\n \tif (unit==\"N\") { dist = dist * 0.8684 }\n \treturn dist\n }", "function distance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = Math.PI * lat1/180\n var radlat2 = Math.PI * lat2/180\n var theta = lon1-lon2\n var radtheta = Math.PI * theta/180\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n \n if (dist > 1) {\n dist = 1;\n }\n\n dist = Math.acos(dist)\n dist = dist * 180/Math.PI\n dist = dist * 60 * 1.1515\n \n if (unit==\"K\") { dist = dist * 1.609344 }\n if (unit==\"N\") { dist = dist * 0.8684 }\n \n return dist\n}", "function distanceFromGrenoble(city){\n\n var GrenobleLat = 45.166667;\n var GrenobleLong = 5.716667;\n var cityLat = parseFloat(city.latitude);\n var cityLong = parseFloat(city.longitude);\n var R = 6371e3; // metres\n var φ1 = GrenobleLat.toRadians();\n var φ2 = cityLat.toRadians();\n var Δφ = (cityLat - GrenobleLat).toRadians();\n var Δλ = (cityLong - GrenobleLong).toRadians();\n var a = Math.sin(Δφ/2) * Math.sin(Δφ/2) + Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ/2) * Math.sin(Δλ/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var distance = R * c;\n\n\nreturn parseInt(distance / 1000);\n\n}", "function distanceInMeter(lat1, lon1, lat2, lon2) {\n\tvar R = 6371;\n\tvar dLat = (lat2-lat1) * Math.PI / 180;\n\tvar dLon = (lon2-lon1) * Math.PI / 180;\n\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n\t\tMath.cos(lat1 * Math.PI / 180 ) * Math.cos(lat2 * Math.PI / 180 ) *\n\t\tMath.sin(dLon/2) * Math.sin(dLon/2);\n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\tvar d = R * c;\n\treturn d * 1000;\n}", "function CalculateDistance(first, second) {\n var R = 6371e3; // metres\n var φ1 = first.latitude * Math.PI / 180; // φ, λ in radians\n var φ2 = second.latitude * Math.PI / 180;\n var Δφ = (second.latitude - first.latitude) * Math.PI / 180;\n var Δλ = (second.longtitude - first.longtitude) * Math.PI / 180;\n\n var a = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +\n Math.cos(φ1) * Math.cos(φ2) *\n Math.sin(Δλ / 2) * Math.sin(Δλ / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\n var d = R * c;\n\n return d;\n}", "GetDistance(lat1, lng1, lat2, lng2) {// coordinates of two GPS positions\n    var radLat1 = this.Rad(lat1);\n     var radLat2 = this.Rad(lat2);\n var a = radLat1 - radLat2;\n var b = this.Rad(lng1) - this.Rad(lng2);\n var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +\n     Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));\n     s = s * 6378.137;// EARTH_RADIUS;\n   s = Math.round(s * 10000) / 10000; //output unit is kilo\n     s = s.toFixed(2);//2 digitals after dot\n return s;\n }", "function calcDistance(p1, p2){\r\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2)/1000).toFixed(3);\r\n }", "function kilometersToMiles(distance) {\n return distance * 0.62;\n}", "function haversine_distance(pt1Lat, pt1Long, pt2Lat, pt2Long)\n{\n var R = 6371.0710; //using kilometers\n var rlat1 = pt1Lat * (Math.PI / 180); // Convert degrees to radians\n var rlat2 = pt2Lat * (Math.PI / 180); // Convert degrees to radians\n var difflat = rlat2 - rlat1; // Radian difference (latitudes)\n var difflon = (pt2Long - pt1Long) * (Math.PI / 180); // Radian difference (longitudes)\n\n var d = 2 * R * Math.asin(Math.sqrt(Math.sin(difflat / 2) * Math.sin(difflat / 2) + Math.cos(rlat1) * Math.cos(rlat2) * Math.sin(difflon / 2) * Math.sin(difflon / 2)));\n return d;\n}", "function calculateDistance(lat1, lon1, lat2, lon2) {\n var R = 6371; // km\n var dLat = (lat2-lat1).toRad();\n var dLon = (lon2-lon1).toRad();\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c;\n return d;\n}", "function CalcDistance(lat1, lon1, lat2, lon2) {\r\n if ((lat1 == lat2) && (lon1 == lon2)) {\r\n return 0;\r\n }\r\n else {\r\n var radlat1 = Math.PI * lat1 / 180;\r\n var radlat2 = Math.PI * lat2 / 180;\r\n var theta = lon1 - lon2;\r\n var radtheta = Math.PI * theta / 180;\r\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\n if (dist > 1) {\r\n dist = 1;\r\n }\r\n dist = Math.acos(dist);\r\n dist = dist * 180 / Math.PI;\r\n dist = dist * 60 * 1.1515;\r\n dist = dist * 1.609344; //km\r\n return Math.round(dist * 1000) / 1000;\r\n }\r\n} //end function CalcDistance()", "function formatDistance(distance, units) {\n\tif (units == 'us') { var unit = 'mi'; }\n\tif (units == 'si') { var unit = 'km'; }\n\n\treturn Math.round(distance) + ' ' + unit;\n}", "function distanceCalc(point1, point2) {\n \n var R = 6371; // Radius of the earth in km\n var dLat = (point2.lat - point1.lat) * Math.PI / 180; // deg2rad below\n var dLon = (point2.lng - point1.lng) * Math.PI / 180;\n var a = \n 0.5 - Math.cos(dLat)/2 + \n Math.cos(point1.lat * Math.PI / 180) * Math.cos(point2.lat * Math.PI / 180) * \n (1 - Math.cos(dLon))/2;\n var d = R * 2 * Math.asin(Math.sqrt(a));\n\n //this returns all measurements in KM , lets format this as miles.\n var miles = d/1.609344;\n \n return miles;\n}", "function calculateDistance(pointer_1, pointer_2) {\n var dist = (google.maps.geometry.spherical.computeDistanceBetween(pointer_1, pointer_2) / 1000).toFixed(2);\n return parseFloat(dist);\n\n }", "function getDistance(lat1, lon1, lat2, lon2, unit = \"M\") {\n if ((lat1 === lat2) && (lon1 === lon2)) {\n return 0;\n }\n else {\n let radlat1 = Math.PI * lat1 / 180;\n let radlat2 = Math.PI * lat2 / 180;\n let theta = lon1 - lon2;\n let radtheta = Math.PI * theta / 180;\n let dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = dist * 180 / Math.PI;\n dist = dist * 60 * 1.1515;\n if (unit === \"K\") { dist = dist * 1.609344 }\n if (unit === \"N\") { dist = dist * 0.8684 }\n return dist;\n }\n}", "function distance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = (Math.PI * lat1) / 180;\n var radlat2 = (Math.PI * lat2) / 180;\n var theta = lon1 - lon2;\n var radtheta = (Math.PI * theta) / 180;\n var dist =\n Math.sin(radlat1) * Math.sin(radlat2) +\n Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = (dist * 180) / Math.PI;\n dist = dist * 60 * 1.1515;\n if (unit == \"K\") {\n dist = dist * 1.609344;\n }\n if (unit == \"N\") {\n dist = dist * 0.8684;\n }\n return dist;\n }", "function calcDistanceFrom(lat1, lon1, lat2, lon2) {\n\tvar R = 6371; // km\n\tvar dLat = toRad(lat2-lat1);\n\tvar dLon = toRad(lon2-lon1);\n\tlat1 = toRad(lat1);\n\tlat2 = toRad(lat2);\n\n\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n\t\tMath.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2);\n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n\tvar d = R * c;\n\treturn d;\n}", "_getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\r\n var R = 6371; // Radius of the earth in km\r\n var dLat = this._deg2rad(lat2-lat1);\r\n var dLon = this._deg2rad(lon2-lon1); \r\n var a = \r\n Math.sin(dLat/2) * Math.sin(dLat/2) +\r\n Math.cos(this._deg2rad(lat1)) * Math.cos(this._deg2rad(lat2)) * \r\n Math.sin(dLon/2) * Math.sin(dLon/2)\r\n ; \r\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \r\n var d = R * c; // Distance in km\r\n return d;\r\n }", "function calcDistance(p1, p2) {\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2) / 1000).toFixed(2);\n}", "function getDistanceBetweenTwoLatLonInKm(lat1, lon1, lat2, lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = degTorad(lat2 - lat1); \n var dLon = degTorad(lon2 - lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(degTorad(lat1)) * Math.cos(degTorad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n return d;\n}", "function getDistance(p1, p2) {\r\n var R = 6378137; // Earth’s mean radius in meter\r\n var dLat = rad(p2.lat() - p1.lat());\r\n var dLong = rad(p2.lng() - p1.lng());\r\n var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +\r\n Math.cos(rad(p1.lat())) * Math.cos(rad(p2.lat())) *\r\n Math.sin(dLong / 2) * Math.sin(dLong / 2);\r\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\r\n var d = R * c;\r\n return d.toFixed(0); // returns the distance in meter\r\n}", "function distance(lat1, lon1, lat2, lon2) {\n var R = 6371 // Radius of the earth in km\n var dLat = rad(lat2-lat1) // rad below\n var dLon = rad(lon2-lon1)\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(rad(lat1)) * Math.cos(rad(lat2)) * Math.sin(dLon/2) * Math.sin(dLon/2)\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a))\n var d = R * c // Distance in km\n return (d / 1.609344).toPrecision(3) // Convert to mi\n}", "function format_distance(distance) {\n if (distance > 1000) {\n return (Math.round((distance / 1000) * 100) / 100) + \" kilometers\";\n } else {\n return (Math.round(distance * 100) / 100) + \" meters\";\n }\n}", "function calculateDistance(lat1, lat2, long1, long2) {\n // Earth radius in kilometers\n var R = 6378\n var x = (long2-long1) * Math.cos((lat1+lat2)/2);\n var y = (lat2-lat1);\n var d = Math.sqrt(x*x + y*y) * R;\n return d\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function distance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = (Math.PI * lat1) / 180;\n var radlat2 = (Math.PI * lat2) / 180;\n var theta = lon1 - lon2;\n var radtheta = (Math.PI * theta) / 180;\n var dist =\n Math.sin(radlat1) * Math.sin(radlat2) +\n Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = (dist * 180) / Math.PI;\n dist = dist * 60 * 1.1515;\n if (unit == \"K\") {\n dist = dist * 1.609344;\n }\n if (unit == \"N\") {\n dist = dist * 0.8684;\n }\n return dist;\n }", "function getDistanceInMiles(p1, p2) {\n return kilometersToMiles(getDistanceInKilometers(p1, p2));\n}", "function distance(lat1, lon1, lat2, lon2) {\n\treturn Math.acos(Math.sin(lat1.toRadians()) * Math.sin(lat2.toRadians()) + Math.cos(lat1.toRadians()) * Math.cos(lat2.toRadians()) * Math.cos((lon2-lon1).toRadians())) * 6371e3;\n}", "distance() {\n\tvar x, y;\n\tvar x = readlinesync.question(\"Enter the first points:\");\n\tvar y = readlinesync.question(\"Enter the second points:\");\n\tvar x1 = Math.pow(x, 2);\n\tvar y1 = Math.pow(y, 2);\n\tvar distance = Math.sqrt(x1 + y1);\n\tconsole.log(\"Euclidean Distance is:\" + distance);\n}", "function distance (p1, p2){\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2)).toFixed(2);\n }", "function formatDistance(distanceInFeet, units, prefix) {\n var distanceFormatted;\n var pre = typeof prefix === \"string\" ? prefix : \"Distance : \";//pass null for default value or \"\"(empty string) or string\n switch (units) {\n case M :\n distanceFormatted = pre + addCommas(Math.round(distanceInFeet * METERS_PER_FOOT)) + \" m\";\n break;\n case FT :\n default :\n distanceFormatted = pre + addCommas(Math.round(distanceInFeet)) + \" ft\";\n break;\n }\n return distanceFormatted;\n}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2)\n ; \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n return d;\n}", "function getDistance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p)/2 + \n c(lat1 * p) * c(lat2 * p) * \n (1 - c((lon2 - lon1) * p))/2;\n \n return 12742 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km\n}", "function gps_distance(lat1, lon1, lat2, lon2)\r\n{\r\n\t// http://www.movable-type.co.uk/scripts/latlong.html contains Algorithm\r\n var R = 6371; // km\r\n var dLat = (lat2-lat1) * (Math.PI / 180);\r\n var dLon = (lon2-lon1) * (Math.PI / 180);\r\n var lat1 = lat1 * (Math.PI / 180);\r\n var lat2 = lat2 * (Math.PI / 180);\r\n\r\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\r\n Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2);\r\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\r\n var d = R * c;\r\n\r\n return d;\r\n}", "function calcDistance(p1, p2) {\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2) / 1000).toFixed(1);\n}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n\t\t\t\t var R = 6371; // Radius of the earth in km\n\t\t\t\t var dLat = deg2rad(lat2-lat1); // deg2rad below\n\t\t\t\t var dLon = deg2rad(lon2-lon1); \n\t\t\t\t var a = \n\t\t\t\t Math.sin(dLat/2) * Math.sin(dLat/2) +\n\t\t\t\t Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n\t\t\t\t Math.sin(dLon/2) * Math.sin(dLon/2)\n\t\t\t\t ; \n\t\t\t\t var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n\t\t\t\t var d = R * c; // Distance in km\n\t\t\t\t return d;\n\t\t\t\t}", "calcDistance(lat1, lon1, lat2, lon2) {\n let radlat1 = Math.PI * lat1/180;\n \tlet radlat2 = Math.PI * lat2/180;\n \tlet theta = lon1-lon2;\n \tlet radtheta = Math.PI * theta/180;\n \tlet dist = Math.sin(radlat1) * Math.sin(radlat2)\n + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n \tdist = Math.acos(dist);\n \tdist = dist * 180/Math.PI;\n \tdist = dist * 60 * 1.1515;\n dist = dist * 1609.344;\n \treturn dist;\n }", "function distance(lon1, lat1, lon2, lat2) {\n var R = 6371; // Radius of the earth in km\n var dLat = (lat2 - lat1) * Math.PI / 180; // deg2rad below\n var dLon = (lon2 - lon1) * Math.PI / 180;\n var a = \n 0.5 - Math.cos(dLat)/2 + \n Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * \n (1 - Math.cos(dLon))/2;\n\n return R * 2 * Math.asin(Math.sqrt(a));\n}", "function getDistances(location1Obj, location2Obj){\n\tvar RADIUS = radius[radius.selected],\n\t\tlocation1 = location1Obj.geometry.location,\n\t\tlocation2 = location2Obj.geometry.location,\n\t\tdLat = toRad(location2.lat - location1.lat),\n\t\tdLon = toRad(location2.lng - location1.lng),\n\t\tdLat1 = toRad(location1.lat),\n\t\tdLat2 = toRad(location2.lat),\n\t\ta = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(dLat1) * Math.cos(dLat1) * Math.sin(dLon/2) * Math.sin(dLon/2),\n\t\tc = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)),\n\t\tdistance = RADIUS.distance * c;\n\n\treturn distance.toFixed(0);\n}", "distance(loc) {\n var lat1 = loc[LAT];\n var lon1 = loc[LONG];\n\n var lat2 = lat1; // default lat2 to safe default value\n var lon2 = lon1; // default lat2 to safe default value\n\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition((p)=>{\n lat2 = p.coords.latitude;\n lon2 = p.coords.longitude;\n }, \n (e)=>{});\n }else{\n return 0; // oops! Cannot get geolocation return a safe distance \n }\n\n var lat1 = loc[0]; //const LAT = 0;\n var lon1 = loc[1]; //const LONG = 1;\n var theta = lon1 - lon2;\n // var dist = Math.sin(Math.deg2rad(lat1)) * Math.sin(Math.deg2rad(lat2)) \n // + Math.cos(Math.deg2rad(lat1)) * Math.cos(Math.deg2rad(lat2)) * Math.cos(Math.deg2rad(theta));\n var dist = mySin(lat1) * mySin(lat2) \n + myCos(lat1) * myCos(lat2) * myCos(theta);\n dist = Math.rad2deg( Math.acos( dist ) );\n //dist = Math.rad2deg(dist);\n var miles = dist * 60 * 1.1515;\n return miles;\n }", "function distanzaAppartamenti(lat1,lon1,lat2,lon2)\n {\n var R = 6372.8; // Earth Radius in Kilometers\n\n var dLat = deg2Rad(lat2-lat1);\n var dLon = deg2Rad(lon2-lon1);\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(deg2Rad(lat1)) * Math.cos(deg2Rad(lat2)) * Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c;\n\n // Return Distance in Kilometers\n return d;\n }" ]
[ "0.75296277", "0.67702544", "0.67179674", "0.66866857", "0.6679903", "0.6635542", "0.6618774", "0.6594511", "0.6550087", "0.6543235", "0.65300316", "0.6523691", "0.6522587", "0.6515938", "0.64867705", "0.64718497", "0.6462999", "0.64613754", "0.6457829", "0.6457469", "0.64551365", "0.64535314", "0.6433318", "0.64308107", "0.6418809", "0.6401769", "0.63952386", "0.63891053", "0.6384895", "0.63766927", "0.63620013", "0.63603973", "0.63528836", "0.6346068", "0.6343352", "0.6339972", "0.63396496", "0.63372934", "0.6337258", "0.63332134", "0.63290316", "0.631539", "0.6313047", "0.63110584", "0.6309371", "0.6305128", "0.62989086", "0.6296708", "0.62884206", "0.6281871", "0.6276799", "0.62728864", "0.62660986", "0.626053", "0.62518126", "0.62518126", "0.6247342", "0.6247049", "0.62405086", "0.62392306", "0.62284774", "0.62279737", "0.6227164", "0.62263256", "0.62186897", "0.6216683", "0.62165123", "0.6195519", "0.6190829", "0.6190317", "0.6184925", "0.61845887", "0.6183739", "0.6183434", "0.6177398", "0.6177269", "0.6174683", "0.6171737", "0.6170839", "0.6168282", "0.6166505", "0.61662", "0.61662", "0.61662", "0.61638755", "0.61633664", "0.6141804", "0.6116597", "0.6116229", "0.6108332", "0.6107786", "0.61054254", "0.61029637", "0.609214", "0.6087663", "0.6082389", "0.6081641", "0.60788304", "0.60641044", "0.6063456" ]
0.7575154
0
Toggles the visibility of the add raid dialog box.
function toggleAddDialog() { raidApp.addDialogContainer.classList.toggle('visible'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showAtomicRaidus() {\n atomicText.show();\n ionicText.hide();\n}", "function onAddTeamClick() {\n $(\"#registerButtons\").hide();\n $(\"#registerTeam\").show();\n}", "function openNewAccount() {\n document.getElementById(\"addNewButton\").style.display = \"block\";\n }", "function createShow(){\n $(\"#createGroup\").toggle(500);\n}", "function NewHumanResourceAddEditShowHide(isedit = true) {\n if (isedit) {\n $('#newResourceAdd').hide();\n $('#newResourceUpdate').show();\n }\n else {\n $('#newResourceUpdate').hide();\n $('#newResourceAdd').show();\n }\n}", "function toggleAddDialog() {\n //console.log(addVisible ,displayBusy)\n if (!addVisible && !displayBusy) {//add not diplayed and screen is not busy, display add\n CORMonitorApp.addDialogContainer.classList.toggle('visible');\n document.getElementById(\"ForceAddBox\").hidden = true;\n displayBusy = addVisible = true;\n } else if (addVisible && displayBusy) {//add is displayed and should be removed\n CORMonitorApp.addDialogContainer.classList.toggle('visible');\n document.getElementById(\"ForceAddBox\").hidden = true;\n displayBusy = addVisible = false;\n }//else add not diplayed, and should not be displayed\n}", "function memberAddClicked(){\n $(\"#div_memberAdd\").css(\"display\",\"block\");\n }", "function AddRisk() {\n\tdocument.getElementById(\"AddRisk\").style.display = \"block\";\n}", "_toggle() {\n if (this._isVisible) {\n this._hide();\n } else {\n this._show();\n }\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}", "function showAddBtn(){\n console.log('showAddBtn');\n $('.addGroup').show();\n}", "function AddNewA(){\r\n document.getElementById('newABlock').style.display ='block';\r\n}", "static showInventory() {\n document.getElementById('inventoryContainer').hidden = false;\n }", "function HRdisplaySettingsMenu() {\r\n $('.settings-menu-btn').on('click', function(e) {\r\n var $this = $(this),\r\n target = $('#' + $this.attr('aria-controls'));\r\n\r\n if( target.attr('hidden') ){\r\n target.removeAttr('hidden');\r\n $this.attr('aria-expanded', true);\r\n\r\n setTimeout(function(){\r\n target.addClass('open');\r\n }, 10);\r\n } else {\r\n target.removeClass('open');\r\n\r\n setTimeout(function(){\r\n target.attr('hidden', true);\r\n $this.attr('aria-expanded', false);\r\n }, 250);\r\n }\r\n });\r\n\r\n if ($('.layoutSize').hasClass('locked')) {\r\n $('.layout-switcher button').addClass('disabled');\r\n }\r\n}", "showAdd() {\n this.closeFoldersInputs.closeAllInputs();\n this.folder.set('isAdd', true);\n this.set('isManage', false);\n this.set('errors', null);\n }", "function showManagementTab() {\n\tvar doc = document.getElementById('nickname_manage');\n\tvar doc2 = document.getElementById('user_recipes');\n\tif ($(doc2).is(':visible')) {\n doc2.style.display = 'none';\n }\n if ($(doc).is(':visible')) {\n doc.style.display = 'none';\n }\n else {\n doc.style.display = 'block';\n }\n}", "function showAddUniFacultyCourseDialog(){\n $(\".glass\").slideToggle('normal');\n $(\"#AddUniFacultyCourseDialog\").slideToggle('normal');\n}", "function showFormMedidaCreate(){\n $(\"#medida-table\").hide(300);\n $(\"#medida-pagination\").hide(300);\n $(\"#medida-create\").show(300);\n $(\"#medida-view\").hide(300);\n $(\"#medida-button\").addClass(\"active\");\n}", "showAdd(){\n document.getElementById(\"add-form\").style.display = \"block\"; \n }", "function expand_compact_rac() {\n if($('#rac-view').is(\":visible\")) {\n \n $('.compact').each(function( i ) {\n $(this).fadeToggle(200 + i*100);\n });\n \n if($('button[name=expand]').attr(\"name\") === \"expand\") {\n $('button[name=expand]').text(\"Compact RAC\");\n $('button[name=expand]').attr(\"name\", \"compact\");\n } else if($('button[name=compact]').attr(\"name\") === \"compact\") {\n $('button[name=compact]').text(\"Expand RAC\");\n $('button[name=compact]').attr(\"name\", \"expand\");\n }\n }\n}", "function showBoardEditForm() {\n vm.isBoardEditFormVisible = true;\n }", "function mdm_hide_suspend() { document.getElementById(\"suspend\").style.display = 'none'; }", "function showMenu() {\n startButton.style.visibility = \"visible\";\n leaderBoardButton.style.visibility = \"visible\";\n instructionsButton.style.visibility = \"visible\";\n}", "function toggleCreateRoomForm() {\n $scope.showCreateRoomForm = !$scope.showCreateRoomForm;\n }", "function AddUser() {\n\tdocument.getElementById(\"AddUser\").style.display = \"block\";\n\t\n}", "action() {\n\t\tthis.toggle();\n\t}", "action() {\n\t\tthis.toggle();\n\t}", "action() {\n\t\tthis.toggle();\n\t}", "function showAddGroup(event){\r\n document.getElementById(\"groupList\").style.display = \"none\";\r\n document.getElementById(\"joinGroupForm\").style.display = \"none\";\r\n document.getElementById(\"groupForm\").style.display = \"block\";\r\n //console.log(\"Add Button Clicked.\");\r\n \r\n}", "function showGuardianInput(){\n if(document.getElementById('add_guardian').checked){\n document.getElementById('guardian_details').style.display = 'block';\n } else {\n document.getElementById('guardian_details').style.display = 'none';\n }\n }", "function hideAddDeviceForm() {\n $(\"#addDeviceControl\").show(); // Hide the add device link\n $(\"#addDeviceForm\").slideUp(); // Show the add device form\n $(\"#error\").hide();\n}", "function hideAddDeviceForm() {\n $(\"#addDeviceControl\").show(); // Hide the add device link\n $(\"#addDeviceForm\").slideUp(); // Show the add device form\n $(\"#error\").hide();\n}", "async function showAddNewSensorTypeMenu() {\n setElementDisplay([mainMenu, sensorTypeSettingMenu], \"none\");\n setElementDisplay([addNewSensorTypeMenu], \"block\");\n}", "function hideAddDeviceForm() {\n $(\"#addDeviceControl\").show(); // Hide the add device link\n $(\"#addDeviceForm\").slideUp(); // Show the add device form\n $(\"#error\").hide();\n}", "function toggleControls(n){\n\t\tswitch(n){\n\t\t\tcase \"on\":\n\t\t\t\t$('addGameForm').style.display = \"none\";\n\t\t\t\t$('clearData').style.display = \"inline\";\n\t\t\t\t$('displayData').style.display = \"none\";\n\t\t\t\t$('addNew').style.display = \"inline\";\n\t\t\t\tbreak;\n\t\t\tcase \"off\":\n\t\t\t\t$('addGameForm').style.display = \"block\";\n\t\t\t\t$('clearData').style.display = \"inline\";\n\t\t\t\t$('displayData').style.display = \"inline\";\n\t\t\t\t$('addNew').style.display = \"none\";\n\t\t\t\t$('items').style.display = \"none\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t}", "function showEditAccounts(){\n\t\t$(\"#editAccounts\").show();\n\t\t$(\".accountDetails\").hide();\n\t}", "function showCreateAccount()\n{\n hideOrShow(\"helloButtons\", false)\n hideOrShow(\"createAccount\", true)\n hideOrShow(\"login\", false)\n hideOrShow(\"text\", false)\n hideOrShow(\"backButton\", true)\n}", "function melissaToggle() {\r\n var x = document.getElementById('melissaInfo');\r\n if (x.style.display === 'none') {\r\n x.style.display = 'block';\r\n } else {\r\n x.style.display = 'none';\r\n }\r\n\r\n}", "function showDeleteAccount(){\n resetSettingsForms();\n\n $('change_password_btn').removeClassName('selected'); // remove clicked effect from change password button\n $('change_password').hide(); // hide change password view\n\n $('delete_account_btn').addClassName('selected'); // add clicked effect to delete account button\n $('delete_account').show(); // show delete account view\n}", "function toggleCreateForm() {\n let visibility = createForm.style.visibility;\n if (visibility == \"hidden\")\n {\n createForm.style.visibility = \"visible\";\n createForm.style.opacity = 1;\n addProject.textContent = \"X\";\n }\n else \n {\n titleInput.value = \"\";\n createForm.style.opacity = 0;\n window.setTimeout(function(){createForm.style.visibility = \"hidden\"}, 200);\n addProject.textContent = \"+\";\n }\n}", "function Inventory() {\n if (Inventory_Panel.style.display == \"block\") {\n Inventory_Panel.style.display = \"none\";\n } else {\n Inventory_Panel.style.display = \"block\";\n }\n}", "function openNewRankTaskModal() {\n newRankTaskModal.style.display = \"block\";\n }", "function showScheduleButton() {\n $(\"#scheduling-progress\").hide();\n $(\"#schedule-button\").show();\n}", "function showNewUniFacultyCourse(){\n $(\".glass\").slideToggle('normal');\n $(\"#newUniFacultyCourseDialog\").slideToggle('normal');\n}", "function mostrarDireccionalidad() {\n\n document.getElementById(\"ayudaDireccionalidad\").style.display = \"block\";\n}", "function showOptions() {\n document.getElementById(\"controls\").hidden = !document.getElementById(\"controls\").hidden;\n}", "_showResources()\n {\n this.getRegion('regionRunJobCollection').$el.hide();\n this.ui.buttonShowResources.css('text-decoration', 'underline');\n this.ui.buttonShowRunJobs.css('text-decoration', 'none');\n if (!this.getRegion('regionResourceCollection').$el.is(':visible'))\n {\n this.getRegion('regionResourceCollection').$el.toggle('fast');\n }\n }", "toggleDisplay() {\n var usermenu = this.getUserMenu();\n var entirescreen = this.getEntireScreen();\n if (this.display) {\n usermenu.style.display = 'block';\n entirescreen.style.display = 'block';\n } else {\n usermenu.style.display = 'none';\n entirescreen.style.display = 'none';\n }\n }", "function toggleEditingMenu(state) {\n\t\tif (state) {\n\t\t\telements.controls.dropdown.show();\n\t\t\telements.controls.add.hide();\n\t\t\telements.controls.remove.hide();\t\n\t\t\telements.controls.reset.hide();\n\t\t} else {\n\t\t\telements.controls.dropdown.hide();\n\t\t\telements.controls.add.show();\n\t\t\telements.controls.remove.show();\n\t\t\telements.controls.reset.show();\n\t\t}\n\t}", "openMenu() {\n this._itemContainer.visible = true;\n this.accessible.expanded = true;\n this._label.accessible.expanded = true;\n }", "function denevanToggle() {\r\n var x = document.getElementById('denevanInfo');\r\n if (x.style.display === 'none') {\r\n x.style.display = 'block';\r\n } else {\r\n x.style.display = 'none';\r\n }\r\n\r\n}", "function lockUI() {\n Dom.$uiLocker.css( 'display', 'block' );\n }", "function toggleVisible() {\n setVisible(false)\n\n }", "toggle() {\n if (!this.disabled) {\n this.expanded = !this.expanded;\n }\n }", "function onBtn (nameBtn) {\n\t\t\t$('#' + nameBtn).css('display','block');\n\t\t}", "function toggleDelete() {\n $(\".editButton\").css(\"visibility\", \"hidden\")\n\n if ($(\".deleteButton\").css(\"visibility\") == \"hidden\") {\n $(\".deleteButton\").css(\"visibility\", \"visible\")\n } else {\n $(\".deleteButton\").css(\"visibility\", \"hidden\")\n }\n}", "function toggleAddMenu() {\n if(!adding){\n $(\"#add\").addClass(\"reveal\");\n setTimeout(function(){\n $(\"#add\").removeClass(\"reveal\");\n $(\"#class-name\").focus();\n }, 500);\n \n $(\"#minus\").hide();\n $(\"#add\").show();\n }else{\n $(\"#add\").addClass(\"retract\");\n setTimeout(function(){\n $(\"#minus\").show();\n $(\"#add\").hide();\n \n $(\"#add\").removeClass(\"retract\");\n }, 500);\n }\n adding = !adding;\n}", "function cancelDeleteButton() {\n document.getElementById(\"sensitiveAccountsData\").style.display = \"block\";\n document.getElementById(\"addNewButton\").style.display = \"none\";\n }", "function creditOpen() {\n\tdocument.getElementById(\"hide\").style.display = \"block\";\n} // end creditOpen function", "function mostrarServiciabilidadInicial() {\n\n document.getElementById(\"ayudaServiciabilidadInicial\").style.display = \"block\";\n}", "function showAddRow() {\n resetTopping(); //Reset all items\n $(\"div#student-add-row\").show();\n}", "function showFormTeam() {\n $(\"#form_create_team\").slideToggle();\n}", "function notificacionEliminarAbrir(){\n document.getElementById(\"notificacionEliminar\").style.display = \"block\";\n}", "function showSearchingAtAccessibility(showSpinner) {\n\t\t\tif (showSpinner) {\n\t\t\t\t$('#accessibilityCalculation').show();\n\t\t\t} else {\n\t\t\t\t$('#accessibilityCalculation').hide();\n\t\t\t\t$('#removeAccessibility').show();\n\t\t\t}\n\t\t}", "function ShowControl(type) {\r\n if (type == 1) {\r\n $(\".add\").attr(\"style\", \"display:block\");\r\n $(\".udp\").attr(\"style\", \"display:none\");\r\n $(\".dvGuestNew\").attr(\"style\", \"text-align: center !important; display:block\");\r\n $(\".dvGuestUpdate\").attr(\"style\", \"display:none\");\r\n }\r\n else {\r\n $(\".add\").attr(\"style\", \"display:none\");\r\n $(\".udp\").attr(\"style\", \"display:block\");\r\n $(\".dvGuestUpdate\").attr(\"style\", \"text-align: center !important; display:block\");\r\n $(\".dvGuestNew\").attr(\"style\", \"display:none\");\r\n }\r\n}", "function hideFormMedidaCreate(){\n $(\"#medida-table\").show(300);\n $(\"#medida-pagination\").show(300);\n $(\"#medida-view\").hide(300);\n $(\"#medida-create\").hide(300);\n $(\"#medida-button\").removeClass(\"active\");\n}", "function mostrarServiciabilidadFinal() {\n\n document.getElementById(\"ayudaServiciabilidadFinal\").style.display = \"block\";\n}", "function displayChangeNameDialog(){\n $('#changeNicknameDialog').slideToggle('normal');\n $('#glassnoloading').slideToggle('normal');\n}", "function addField(id){\n\tif (document.getElementById(\"yes\").checked ) {\n\t\tdocument.getElementById(id).style.display=\"block\";\n\t}else{\n\t\tdocument.getElementById(id).style.display=\"none\";\n\t}\n}", "function EditRisk() {\n\tdocument.getElementById(\"EditRisk\").style.display = \"block\";\n}", "checkToShowAddButton() {\n const hasResult = this.hasQuery && (! this.hasUsers && ! this.hasDepartment);\n\n this.setShowAddButton( hasResult );\n }", "function toggleUserToevoegen()\n{\n formdiv = document.getElementById(\"inklapdiv\");\n\n if (formdiv.style.display == \"none\") {\n formdiv.style.display = \"block\";\n formdiv.style.opacity = 1;\n }\n else {\n formdiv.style.display = \"none\";\n formdiv.style.opacity = 0;\n }\n \n}", "function toggleEdit() {\n $(\".deleteButton\").css(\"visibility\", \"hidden\")\n\n if ($(\".editButton\").css(\"visibility\") == \"hidden\") {\n $(\".editButton\").css(\"visibility\", \"visible\")\n } else {\n $(\".editButton\").css(\"visibility\", \"hidden\")\n }\n}", "function voziloEditShow()\n\t{\n\t\tvar $addVoziloDiv = $(\"#addVoziloDiv\");\n\t\tvar $editVoziloDiv = $(\"#editVoziloDiv\");\n\t\t\n\t\t$editVoziloDiv.show();\n\t\t$(\"#addVozilo\").show();\n\t\t\n\t\t$addVoziloDiv.hide();\n\t}", "function showUserInvite() {\n $('#invite-user')[0].hidden = false;\n}", "function open_add_plant_modal(open) {\n\t$(\"#add-plant\").css(\"display\", open ? \"block\" : \"none\");\n}", "function editRestaurantInfoShow(){\n\t\t$(\".restaurantInfoDetails\").hide();\n\t\t$(\"#editrestaurantinfo\").show();\n\t}", "function PowerManagementBtn(){\n\tif (globalSelectedPowerMain.length == 0 || globalSelectedPowerMain.length > 1){\t\n\t\t$('#PDUedit').addClass('ui-state-disabled');\n\t\t$('#PDUedit').attr('disabled', false);\t\n\t\t$('#PDUdelete').addClass('ui-state-disabled');\n\t\t$('#PDUdelete').attr('disabled', false);\t\n\t}\n}", "enable() {\n\t\tthis.toggle(true);\n\t}", "function showHideMaterialDiv() {\n\tvar x = document.getElementById(\"materialDiv\");\n\tif (x.style.display === \"none\") {\n\t x.style.display = \"block\";\n\t} else {\n\t x.style.display = \"none\";\n\t}\n }", "function addField2(id){\n\tif(document.getElementById(\"yes2\").checked){\n\t\tdocument.getElementById(id).style.display=\"block\";\n\t}else{\n\t\tdocument.getElementById(id).style.display=\"none\";\n\t}\n}", "function ksShowEnrollDialog(){\n $('#enrollCoursesDialog').slideToggle('normal');\n $('#glassnoloading').slideToggle('normal');\n}", "waitFor_meetingRaceList_RaceRunnerToggle() {\n if(!this.meetingRaceList_RaceRunnerToggle.isVisible()){\n this.meetingRaceList_RaceRunnerToggle.waitForVisible(5000);\n }\n }", "function showEdit() {\r\n\t\t$('.container>ul').hide()\r\n\t\t$('.plus').hide()\r\n\t\t//add class .edit\r\n\t\t$('.container').append($('<div class =\"edit\"> <span class=\"X\" onclick=\"hideEdit()\"> X </span></div>'))\r\n\t\t$('.edit').append($('<ul class=\"mission-neutral\"></ul>'))\r\n\t}", "unlock() {\n document.getElementById('blocker').style.display = 'block';\n document.getElementById('instructions').style.display = '';\n }", "showEdit() {\n this.closeFoldersInputs.closeAllInputs();\n // set Manage checkbox\n if (this.folderUser.get('access') === 2) {\n this.set('access', true);\n } else {\n this.set('access', false);\n }\n\n this.folderUser.set('isEdit', true);\n }", "function pReporAtras(){\r\n $(\"#generarReporte\").hide();\r\n\r\n $(\"#menu\").show();\r\n}", "function showOption() {\n $(\"#board1\").css(\"display\",\"none\");\n $(\"#optionbox\").css(\"display\",\"block\");\n }", "function profileDelete() {\n document.getElementById(\"deletebox\").style.display = \"block\";\n}", "function showDeleteButton() {\n if (deleteButton.classList.contains('invisible')) {\n deleteButton.classList.remove('invisible');\n }\n}", "function hideReplaceDeviceForm() {\n $(\"#relpaceDeviceControl\").show(); // Hide the add device link\n $(\"#replaceDeviceForm\").slideUp(); // Show the add device form\n $(\"#error\").hide();\n}", "function toggleEntryForm() {\n const HideForm = document.getElementById(\"dino-compare\");\n HideForm.classList.add(\"hide\");\n }", "function yesKurt() { // Yes Button for Kurt is displayed in the check dialogue \n document.getElementById(\"yes_kurt\").style.display = \"block\"; \n document.getElementById(\"yes_luke\").style.display = \"none\";\n document.getElementById(\"yes_emma\").style.display = \"none\";\n}", "showUi() {\n can.ui.style.display = 'block';\n }", "function addElement() {\n document.getElementById(\"addcustom\").style.display = \"block\";\n}", "function toggleDisplay (onOff) {\n\t\tswitch (onOff) {\n\t\t\tcase \"on\":\n\t\t\t\t$('addTripForm').style.display = \"none\";\n\t\t\t\t$('viewAllTrips').style.display = \"none\";\n\t\t\t\t$('addNewTrip').style.display = \"inline\";\n\t\t\t\tbreak;\n\t\t\tcase \"off\":\n\t\t\t\t$('addTripForm').style.display = \"block\";\n\t\t\t\t$('viewAllTrips').style.display = \"inline\";\n\t\t\t\t$('addNewTrip').style.display = \"none\";\n\t\t\t\t$('savedTrips').style.display = \"none\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t}", "function EditUser() {\n\tdocument.getElementById(\"EditUser\").style.display = \"block\";\n}", "alterProgManShowing() {\n this.progManager = document.getElementById('programManWindow');\n if (this.progManClicked) {\n this.progManager.style.display = 'none';\n this.progManClicked = false;\n }\n else {\n this.progManager.style.display = 'flex';\n this.progManClicked = true;\n }\n }", "function displayToggle(event) {\n console.log(event);\n if (event.target.name === 'hide') {\n currentInventory.beers[event.target.id].toggleDisplay();\n currentInventory.saveToLocalStorage();\n // console.log(currentInventory);\n }\n}", "function toggleRemoveAction(userid) {\n var icon = document.getElementById('removeuser'+userid);\n var buttonto = document.getElementById('addto'+userid);\n var buttoncc = document.getElementById('addcc'+userid);\n var buttonbcc = document.getElementById('addbcc'+userid);\n\n if (icon.style.visibility == 'hidden') {\n icon.style.visibility = '';\n buttonto.style.visibility = 'hidden';\n buttoncc.style.visibility = 'hidden';\n buttonbcc.style.visibility = 'hidden';\n } else {\n icon.style.visibility = 'hidden';\n buttonto.style.visibility = '';\n buttoncc.style.visibility = '';\n buttonbcc.style.visibility = '';\n }\n}" ]
[ "0.60003257", "0.595811", "0.59015256", "0.58869594", "0.58550435", "0.5837372", "0.5796722", "0.57622516", "0.5677214", "0.56697094", "0.5594195", "0.55909073", "0.557295", "0.5564463", "0.55619544", "0.55504286", "0.5549698", "0.55416584", "0.5524545", "0.5515268", "0.5499698", "0.5496687", "0.5472713", "0.54659754", "0.5464582", "0.5459923", "0.5459923", "0.5459923", "0.54517233", "0.54267263", "0.54263335", "0.54263335", "0.5418876", "0.54096675", "0.5407942", "0.53950864", "0.5389233", "0.53887045", "0.5386396", "0.53826684", "0.53795797", "0.5378806", "0.5375998", "0.53622425", "0.5358195", "0.5355315", "0.53501", "0.53482556", "0.53472483", "0.53471124", "0.5343472", "0.5338174", "0.5337456", "0.53317374", "0.5331222", "0.5330491", "0.5326585", "0.5319263", "0.53191125", "0.53144175", "0.53121823", "0.53114605", "0.5301679", "0.5300575", "0.52998805", "0.52989346", "0.529393", "0.5293788", "0.5282963", "0.5279675", "0.52768815", "0.52754277", "0.5269553", "0.5263315", "0.52549356", "0.52523345", "0.5250409", "0.52458376", "0.5243567", "0.52433157", "0.5242208", "0.5234266", "0.52333766", "0.5232707", "0.523154", "0.5226932", "0.5224084", "0.52236056", "0.5221771", "0.5218485", "0.5217395", "0.52162135", "0.5209402", "0.5208573", "0.52072734", "0.5203815", "0.5202684", "0.52017766", "0.5200919", "0.5199149" ]
0.6643492
0
Event handler for butDialogAdd, adds the selected raid to the list.
function addLocation() { // Hide the dialog toggleAddDialog(); //Arène const select = document.getElementById('selectRaidToAdd'); const selected = select.options[select.selectedIndex]; //Position GPS const geo = selected.value; //Nom de l'arène const arene = selected.textContent; //Heure du Raid const clock = document.getElementById('clockpicker'); const heureLancement = clock.value; //Niveau du Raid const selectLevel = document.getElementById('levelRaidToAdd'); const selectedLevel = selectLevel.options[selectLevel.selectedIndex]; const valueLevel = selectedLevel.value; var date = getDate() const raid = {arene: arene, geo: geo, heureLancement:heureLancement, niveau:valueLevel, date:date}; // Create a new card const card = getRaidCard(raid); //& get the weather data from the server //getRaidFromNetwork(geo).then((forecast) => { // renderForecast(card, forecast); //}); renderRaid(card, raid); const id = raid.geo + raid.date + raid.heureLancement; // Save the updated list of selected raid. raidApp.selectedLocations[id] = raid; saveRaidList(raidApp.selectedLocations); document.getElementById('main').scrollTop = document.getElementById('main').scrollHeight + 100 ; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function agregarItem(){\n \t$('#divListado1').show();\n \tif($('#material').val() == ''){\n \t\talert('ingrese un producto por favor');\n \t}else if($('#cant').val() == ''){\n \t\talert('por favor ingrese una cantidad');\t\n \t}else{\n \t\tif(existeMaterialEnTabla()){\n \t\t\tsumarCantidadAMaterialExistente();\n \t\t}else{\n \t\t\tgenerarContenidoItemTabla();\n \t\t\tagregarColumnaUnidadYCorrerFilas();\n \t\t\t$('#total1').html((parseFloat(parseFloat($('#total1').html())) + parseFloat($('#precio' + (cantMat)).html())).toFixed(2));\n \t\t$('#totalConDescuento1').html((parseFloat($('#total1').html()) - parseFloat($('#total1').html()) * parseFloat($('#descuento1').html())/100).toFixed(2));\n \t\t\tcantMat++;\n \t\t} \t\t\n \t\tidMadMadre = null;\n \t\t$('#unidad1').html('');\n \t\t$('#unidad1').val('');\n \t}\n }", "function addUser(e, ui) {\n\tvar id = ui.item.id,\n\tname = ui.item.value,\n\tusers = [],\n\tlist = $('#dialog #userList'),\n\thtml = '<p data-id=\"' + id + '\" class=\"user\"><button class=\"remove\"><span class=\"fa fa-minus\"></span> Remove</button> ' + name + '</p>';\n\t// Loop through existing users and build users array.\n\t$('#searchResults .selection').each(function () {\n\t\tvar entry = $(this),\n\t\tid = entry.attr('data-id');\n\t\tif (id) {\n\t\t\tusers.push(id);\n\t\t}\n\t});\n\t// Loop through users to be added and build users array.\n\t$('#dialog #userList .user').each(function () {\n\t\tvar entry = $(this),\n\t\tid = entry.attr('data-id');\n\t\tif (id) {\n\t\t\tusers.push(id);\n\t\t}\n\t});\n\t// Add user if they don't already exist.\n\tif (users.indexOf(id) == -1) {\n\t\tlist.append(html);\n\t}\n\t// Remove name from field and give it focus.\n\t$(this).val('').focus();\n\treturn false;\n}", "function showAddMenu(){\n inquirer.prompt(\n {type: \"rawlist\",\n name: \"add_action\",\n message: \"Add departments, roles, employees?\",\n choices: [\n \"Add Departments\",\n \"Add Roles\",\n \"Add Employees\",\n \"Return to Main Menu\",\n \"Exit\"\n ]\n }\n ).then(function(answer){\n switch (answer.add_action){\n case \"Add Departments\":\n addDepartment();\n break;\n \n case \"Add Roles\":\n addEmpRole();\n break;\n\n case \"Add Employees\":\n addEmployee();\n break;\n\n case \"Return to Add Data Menu\":\n showAddMenu();\n break;\n \n case \"Return to Main Menu\":\n showMainMenu();\n break;\n\n case \"Exit\":\n exit();\n break;\n\n }\n }).catch(function(err){\n if (err){\n console.log(\"Add Menu error: \" + err);\n }\n });\n}", "add() {\n $('#snmpDialogTitle').html('<h4>Adding a new SNMP Destination</h4>');\n window.snmp.dialog();\n }", "function openAddAddonDialog(){\r\n\t\t\r\n\t\tjQuery(\".dialog_addon_input\").val(\"\");\r\n\t\t\r\n\t\tvar options = {};\r\n\t\toptions[\"no_close_button\"] = true;\r\n\t\toptions[\"minWidth\"] = 400;\r\n\t\t\r\n\t\tg_ucAdmin.openCommonDialog(\"#dialog_add_addon\", function(){\r\n\t\t\tjQuery(\"#dialog_add_addon_title\").select();\t\t\t\r\n\t\t}, options);\r\n\t\t\r\n\t}", "function onClickAdd() {\n console.log(\"add clicked\");\n const elementType = $(\"#add-select\").val();\n console.log(\"submited a new element of type\", elementType);\n if (elementType === \"element\") {\n setError(\"select an element\");\n } else {\n createActionRow({ elementType });\n }\n}", "function showDialogAdd() {\n var title = 'Add Parts to Locations'; \n var templateName = 'addUi'; \n var width = 600; \n \n // custom function to insert part data into the dialog box. For code modularity and simplicity\n createDialogWithPartData(title,templateName,width);\n}", "function massAdd() {\n\tvar button = $(this),\n\ttype = button.attr('data-type'),\n\tid = button.attr('data-id'),\n\tname = button.attr('data-name');\n\tif (type == 'site') {\n\t\topenMassAddSiteDialog(id, name);\n\t} else {\n\t\topenMassAddUserDialog(id, name);\n\t}\n}", "function add_related(event, ui) {\n $('#detailsmessage').loading();\n var relatedid = ui.item.value;\n var relatedname = ui.item.label;\n\n $.getJSON('qc/project/add_related/'+projectid+'/'+relatedid, function(data) {\n print_edit_message('details', $.toJSON(data));\n if (data.type == 'success') {\n $('#relatedproducts').append(make_related_item(relatedid, relatedname));\n redraw_saverevision_button();\n }\n });\n\n}", "function addListItem(pokemon) {\n var newListItem = $(\n '<button class=\"list-group-item list-group-item-action list-group-item-dark\" type=\"button\" data-toggle=\"modal\" sr-only=\"pokemon name\" data-target=\"#pokemonModal\">' +\n pokemon.name +\n '</button>'\n );\n $('.list-group').append(newListItem);\n $(newListItem).on('click', function () {\n showDetails(pokemon);\n });\n }", "function selectionAdd(ddl, arr) {\n var myDDL = document.getElementById(ddl);\n var list = myDDL.childNodes;\n\n unsavedWarning('profileLbl');\n\n // Get the value (innerHTML) of the selected item\n var selected = list[myDDL.selectedIndex].innerHTML;\n\n // Remove the selected item from the relationship arrays\n var arrays = ['arrParentManagerDDL', 'arrCESDDL', 'arrOtherDDL'];\n arrays.forEach(function(item) {\n if (item.includes(selected)) {\n for (var i = 0; i < item.length; i++){\n if (item[i] == selected) {\n item.splice(i, 1);\n }\n }\n }\n });\n\n // Remove the selected item from the relationship dropdown lists\n var relationships = ['ParentManagerDDL', 'CESDDL', 'OtherDDL'];\n relationships.forEach(function(item) {\n var element = document.getElementById(item);\n for (var x = 0; x < element.options.length; x++) {\n if (element.options[x].innerText == selected) {\n element.remove(x);\n }\n }\n });\n\n // Create the new list item from the selected item\n var myInput = ddl == 'ParentManagerDDL' ? 'myInput1' : ddl == 'CESDDL' ? 'myInput2' : 'myInput3';\n newElement(myInput, true, selected);\n}", "onAddListPlanItem(e, index, key) {\n\t\tvar { header } = this.state;\n\t\tvar new_item = {\n\t\t\ttitle: 'New Option',\n\t\t\tno_title: 'Nytt alternativ'\n\t\t};\n\t\theader.list.items[index].options[key].items.push(new_item);\n\t\tthis.setState({ header });\n\t}", "function on_event_select_add_entry_to_logick_menu(e)\n{\n /*removes old Logick*/\n delete_custom_logick_of_element();\n \n /*sets the new custom elements*/\n logick_elements.custom_logick_elements = e.param1.custom_logick_menu;\n\n /*applays the custom logick to the logick menu*/\n apply_custom_logick_onselect();\n \n}", "function addItem(futureMenuItem) {\n\t\tfutureMenuItem.setMenu(this);\n\t\tthis.items.add(futureMenuItem, true);\n\t}", "function addEvent() {\n sendLog(\"Add Event\")\n selectEvent(0);\n handleShow();\n }", "handleAppAdd() {\n // Ignore if there is no selection\n const selection = this.state.appDropdownSelection;\n if (selection === null) return \n\n let appBlockers = this.state.blockers.apps;\n\n // Check if app is already in the list\n const foundExistingEntry = appBlockers.find(blocker => blocker === selection);\n if (foundExistingEntry != undefined) return;\n\n // Go ahead and append it to the list\n appBlockers.push(this.state.appDropdownSelection);\n store.preferences.set('blockers.apps', appBlockers);\n }", "function addAttender(event, ui){\n attending.push($(ui.item).attr('data-id'));\n updatePubList();\n}", "function inventoryAdd(item) {\n item.show();\n\titem.moveTo(inventory_layer);\n item.clearCache();\n\titem.scale({x: 1, y: 1});\n\titem.size({width: 80, height: 80});\n\n\tif (inventory_list.indexOf(item) > -1)\n\t\tinventory_list.splice(inventory_list.indexOf(item), 1, item);\n\telse\n\t\tinventory_list.push(item);\n\n // The picked up item should be visible in the inventory. Scroll inventory\n // to the right if necessary.\n if (inventory_list.indexOf(item) > inventory_index + inventory_max - 1)\n inventory_index = Math.max(inventory_list.indexOf(item) + 1 - inventory_max, 0);\n\n current_layer.draw();\n\tredrawInventory();\n}", "function addItem() {\n\n console.log('adding', { amount }, { name });\n\n dispatch({\n type: 'ADD_ITEM', payload: {\n name: name,\n amount: amount,\n list_id: id,\n }\n })\n //reset local state of new item textfield to allow for more items to be added\n setName('');\n setAmount(1);\n }", "function ClickAdicionarArmadura() {\n gEntradas.armaduras.push({ chave: 'nenhuma', obra_prima: false, bonus: 0 });\n AtualizaGeralSemLerEntradas();\n}", "function ClickAdicionarArma() {\n gEntradas.armas.push({ chave: 'desarmado', obra_prima: false, bonus: 0 });\n AtualizaGeralSemLerEntradas();\n}", "function addArmor() {\n\tif (armor >= 2) {\n\t\t$('#alerts').append(\"<br />Armor Full<br />\");\n\t} else {\n\t\tarmor++;\n\t\t$('#alerts').append(\"<br />Armor Added<br />\");\n\t\t$('#armor').html(armor);\n\t}\n}", "addReminder(){\n debugger;\n var reminder = { title: this.titNode.value , desc: this.descNode.value, deadLine: this.ddlNode.value , status: false };\n var rl = this.state.reminderList;\n\n // rl.concat(reminder);\n\n rl.push(reminder);\n\n this.setState({reminderList: rl});\n\n this.closeAddWindow();\n }", "addItem(){\n\t\tthis.showAddItemModal = true;\n\t}", "function add() {\n rl.question(`What do you want to add to the list?\\n`, answer => {\n let list = `${box}${answer}`\n lists.push(list);\n return menu();\n });\n}", "function addItemBtn() {\n $('#')\n $('#add-list-item').show('fast', function() {\n\n });\n console.log ('add item clicked')\n }", "function addItem(listItem) {\n listItem.hide();\n items.append(listItem);\n listItem.show('slow');\n }", "navigateAdd() {\n this.channel.trigger('show:form');\n }", "function addFurtherRequired(item_clicked,topic_item){\n $('#further').append(\"<h4 id=\\\"header_further\\\">Further Specify:</h4>\");\n var first_further = item_clicked.further_require[0];\n if (first_further === \"Cartan\"){\n const div = div_const(first_further);\n const dropdown = dropdown_const(first_further);\n $('#further').append(div);\n $('#'+first_further+'_div').append(dropdown);\n $('.selectpicker').selectpicker('refresh');\n }\n}", "function addCard(target) {\n cardSelections.push(target);\n }", "function add() {\n\t\tvar item = document.getElementById(\"item\").value;\n\t\t$(\"#entry\").clone(true).appendTo(\"#list\").val('').removeClass(\"hidden\");\n\t\t$('li:last').text(item);\n\t\t}", "function addDaughter(e, object) {\n var currentObjectKey = object.part.data.key;\n var currentNodeArrayData = searchNodeCurrentArray(globalLogicData.childrenList, currentObjectKey)\n var NodeCurrentIndex = currentNodeArrayData.index;\n var NodeCurrentchildrenList = currentNodeArrayData.childrenList;\n var daughter = getDefaultLogicUnitData(uuidv4(), \"female\");\n\n // if it doesnt has partner it will automatically add partner\n if (!NodeCurrentchildrenList[NodeCurrentIndex].childrenList) {\n addPartner(e, object);\n }\n NodeCurrentchildrenList[NodeCurrentIndex].childrenList.push(daughter)\n\n reRender(currentObjectKey);\n}", "function showAddForm(quad, linkClicked) {\n $(`#quad-${ quad}`).prepend('<li><span></span><input name=\"newToDoLabel\" value=\"\" type=\"text\"></li>');\n // $('[name=\"newToDoQuad\"]').val(quad);\n // $('.addNewShortcutFormSpace').appendTo('#addNewQuad' + quad).show();\n $('[name=\"newToDoLabel\"]').trigger('focus');\n}", "function addIngredient(currentIngredients, currentIngredient, currentAmount, currentUnit) {\n if (currentUnit === \"0\") { currentUnit = \"\"; }\n //on successful completion of ingredients form create line above form with ingredients details and button to click to remove the ingredient if a mistake has been made\n $(\"#ingredients\").html(currentIngredients + \"<div class='row'><div class='col s1 offset-s1 l1'><a id='remove_ingredient' class='right btn-floating btn-small waves-effect waves-light highlight3-background valign-wrapper'><i class='material-icons'>delete</i></a></div><div class='col s10 l5 valign-wrapper'><p>\" + currentAmount + \" \" + currentUnit + \" \" + currentIngredient + \" </p><input type='hidden' name='type' value=\\'\" + currentIngredient + \"\\'></input><input type='hidden'name='amount' value=\" + currentAmount + \"></input><input type='hidden' name='unit' value=\" + currentUnit + \"></input></div>\");\n //reset the form values\n $(\"#ingredient\").val('');\n $(\"#amount\").val('');\n $(\"#select-unit\").val('');\n $('#select-unit').formSelect();\n}", "function selectAddInventory(data) {\n inquirer.prompt([{\n type: 'list',\n message: 'Select item where you would like to add more stock.\\n',\n choices: function() {\n var choiceArr = [];\n for (i = 0; i < data.length; i++) {\n choiceArr.push(data[i].item_id + \" : \" + data[i].product_name + \" : \" + data[i].stock_quantity);\n }\n return choiceArr;\n },\n name: 'itemList',\n }, ]).then(function(input) {\n var idArr = input.itemList.split(\" : \");\n var selectedItem;\n for (i = 0; i < data.length; i++) {\n if (parseInt(idArr[0]) === parseInt(data[i].item_id)) {\n selectedItem = data[i];\n }\n }\n completeAddInventory(selectedItem);\n }).catch(function(error) {\n throw error;\n });\n}", "function addAddon(){\r\n\t\t\r\n\t\tvar selectedCatID = 0;\r\n\t\t\r\n\t\tif(g_objCats)\r\n\t\t\tselectedCatID = g_objCats.getSelectedCatID();\r\n\t\t\r\n\t\tvar data = {\r\n\t\t\t\ttitle: jQuery(\"#dialog_add_addon_title\").val(),\r\n\t\t\t\tname: jQuery(\"#dialog_add_addon_name\").val(),\r\n\t\t\t\tdescription: jQuery(\"#dialog_add_addon_description\").val(),\r\n\t\t\t\tcatid: selectedCatID,\r\n\t\t\t\taddontype: g_addonsType\r\n\t\t};\r\n\t\t\r\n\t\tif(g_temp.is_edit_group_mode == true)\r\n\t\t\tdata.parent_id = g_temp.edit_group_id;\r\n\t\t\r\n\t\tg_ucAdmin.dialogAjaxRequest(\"dialog_add_addon\", \"add_addon\", data, function(response){\r\n\r\n\t\t\tvar objItem = g_objItems.appendItem(response.htmlItem);\r\n\t\t\t\r\n\t\t\t//update categories list\r\n\t\t\tif(g_objCats)\r\n\t\t\t\tg_objCats.setHtmlListCats(response.htmlCats);\r\n\t\t\t\r\n\t\t\tg_objItems.selectSingleItem(objItem);\r\n\t\t\t\r\n\t\t\t//var urlAddon = response[\"url_addon\"];\r\n\t\t\t//location.href = urlAddon;\r\n\t\t\t\r\n\t\t});\r\n\t\t\r\n\t}", "function addItem() {\n\t\t\tvar order = ordersGrid.selection.getSelected()[0];\n\n\t\t\titensStore.newItem({\n\t\t\t\tpi_codigo: \"new\" + itensCounter,\n\t\t\t\tpi_pedido: order ? order.pe_codigo : \"new\",\n\t\t\t\tpi_prod: \"\",\n\t\t\t\tpi_quant: 0,\n\t\t\t\tpi_moeda: \"R$\",\n\t\t\t\tpi_preco: 0,\n\t\t\t\tpi_valor: 0,\n\t\t\t\tpi_desc: 0,\n\t\t\t\tpi_valort: 0,\n\t\t\t\tpr_descr: \"\",\n\t\t\t\tpr_unid: \"\"\n\t\t\t});\n\t\t\t\n\t\t\titensCounter = itensCounter + 1;\n\t\t}", "function ClickAdicionarItem(tipo_item) {\n gEntradas[tipo_item].push({ chave: '', em_uso: false });\n AtualizaGeralSemLerEntradas();\n}", "add() {\n this.$mdDialog.hide();\n let roles = [];\n if (this.userRole === 'workspace/admin+developer') {\n roles.push('workspace/admin');\n roles.push('workspace/developer');\n } else {\n roles.push(this.userRole);\n }\n\n this.callbackController.callbackMemberAdd(this.userEmail, roles);\n }", "function openRosterAdd() {\n\t\t\tvar btnGrp = me.$rosterAddNewContainer.find('.btn-group');\n\t\t\tif ($('#cancelButton').length == 0) {\n\t\t\t\tvar cancelButton = $(\"<input/>\", {\n\t\t\t\t\t\"class\" : \"cancel btn btn-default\",\n\t\t\t\t\t\"type\" : \"button\",\n\t\t\t\t\t\"id\" : \"cancelButton\",\n\t\t\t\t\t\"click\" : me.rosterCancelAction,\n\t\t\t\t\t\"value\" : ap.core_prompts[\"action.Cancel\"]\n\t\t\t\t});\n\n\t\t\t\tbtnGrp.append(cancelButton);\n\t\t\t\tme.$rosterAddNewContainer.css(\"display\", 'block');\n\t\t\t\tme.$mainButtonContainer.css(\"display\", 'none');\n\t\t\t\t;\n\n\t\t\t\t$('#rosterAddNewBtn').remove();\n\t\t\t\t$('#rosterDownFillEntitiesBtn').remove();\n\t\t\t\tme.focusOnFirstField(true);\n\t\t\t\tpage.manageTabIndex();\n\n\t\t\t\tforceIEtoRepaintFooter();\n\t\t\t}\n\t\t\tif (me.activeRosterEntries < me.minEntries) {\n\t\t\t\tbtnGrp.addClass('single-button');\n\t\t\t} else {\n\t\t\t\tbtnGrp.removeClass('single-button');\n\t\t\t}\n\t\t}", "function addToDoItem(){\n\t//alert (\"The Add button was clicked\");\n\tvar itemText = toDoEntryBox.value;\n\tnewToDoItem(itemText, false);\n\t//Since a new to-do item is never complete, you can \n\t// pass false to the completed parameter of the newToDoItem function.\n}", "function onIngredientAddOrDel() {\r\n\t\tvar button = $(this);\r\n\t\tvar ingredients = $('#createRecipeForm #ingredients li');\r\n\r\n\t\tif (button.attr('name').indexOf('add') >= 0) {\r\n\t\t\t$(ingredientLi).insertAfter(button.parent('li'));\r\n\t\t} else {\r\n\t\t\tbutton.parent('li').remove();\r\n\t\t}\r\n\r\n\t\tingredients = $('#createRecipeForm #ingredients li');\r\n\t\tif (ingredients.size() === 1) {\r\n\t\t\tingredients.first().find('button[name=\"minus\"]').css('visibility',\r\n\t\t\t\t\t'hidden');\r\n\t\t\tingredients.first().find('input .ingredient').attr('name', 'ingredient1');\r\n\t\t\tingredients.first().find('span[name=\"ingredientId\"]').html('1');\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tingredients.each(function(index) {\r\n\t\t\tvar input = $(this).find('input .ingredient');\r\n\t\t\tinput.attr('name', 'ingredient' + (index + 1));\r\n\t\t\t$(this).find('span[name=\"ingredientId\"]').html(index + 1);\r\n\t\t\t$(this).find('button[name=\"minus\"]').css('visibility', 'visible');\r\n\r\n\t\t\tif (!input.hasClass('ui-autocomplete-input')) {\r\n\t\t\t\tinput.autocomplete({\r\n\t\t\t\t\tsource : ingredientsList,\r\n\t\t\t\t\tminLength : 2,\r\n\t\t\t\t\tchange : function(event, ui) {\r\n\t\t\t\t\t\tvar id = (ui.item && ui.item.id) || '';\r\n\t\t\t\t\t\t$(this).attr('data-id', id);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn false;\r\n\t}", "function onAddButtonClick(ev) {\n var valueToAdd = textBoxAddControls.value;\n textBoxAddControls.value = \"\";\n addTextStrong.innerHTML = valueToAdd;\n resultList.appendChild(listItems.cloneNode(true));\n }", "function Add() {\n inquirer\n .prompt([\n {\n type: \"list\",\n name: \"add\",\n message: \"what would you like to add?\",\n choices: [\"Department\", \"Role\", \"Employee\", \"Back\"],\n },\n ])\n .then((res) => {\n switch (res.add) {\n case \"Department\":\n console.log(\"add department function goes here\");\n addDept();\n break;\n case \"Role\":\n console.log(\"add role function goes here\");\n addRole() ;\n break;\n case \"Employee\":\n addEmployee();\n break;\n case \"Back\":\n initPrompt();\n break;\n }\n });\n}", "function addChoice() {\n inquirer.prompt([{\n type: 'list',\n name: 'addType',\n message: 'What would you like to add?',\n choices:\n [\n 'Employee',\n 'Department',\n 'Role'\n ]\n }])\n .then(function (response) {\n switch (response.addType) {\n case 'Employee':\n addEmployee();\n break;\n case 'Department':\n addDepartment();\n break;\n case 'Role':\n addRole();\n break;\n default:\n console.log(\"Error: No option selected\");\n }\n });\n}", "_addDevicesToGroup(tmpDevices) {\n // (save selected devices in state, open dialog)\n this.setState({ tmpDevices, modifyGroupDialog: !this.state.modifyGroupDialog });\n }", "function addOption(name){\n if(name){\n var newObj = {\n name: name,\n content: \"\"\n }\n if(dialogContent.length == 0)\n newObj.content = editor.value;\n dialogContent.push(newObj); \n }\n console.log(\"ON ADD =>\");\n console.log(dialogContent);\n}", "function addComplete(e) {\n $(\"#eliminar\").on('click', function(e){\n e.preventDefault();\n $(\"#completeItems\").append(\"<p>caro</p>\");\n })\n }", "function addAgenmento() {\n var pop = $('#md-editar-agendamento');\n\n if (pop) {\n loadClientes().then(() => {\n onNovoAgendamento();\n setPopAgendamentoTitle(\"Criar Agendamento\");\n pop.draggable();\n pop.modal();\n });\n }\n }", "function addoption(text)\n{\n\t// create new option in drop download list\n\tvar len=document.getElementById('note_category').length;\n\tgroupid = parseInt(nextid.replace(/\"/g,''));\n\tvar opt = document.createElement('option');\n\topt.setAttribute('value',groupid);\n\topt.setAttribute('id','select'+groupid);\n\topt.innerHTML = text;\n\tdocument.getElementById('note_category').appendChild(opt);\n\tdocument.getElementById('note_category').selectedIndex=len;\n\tvar str = $('ul.noteUL').html();\n\tvar newline=\"<li class='category'><div><span>Category: </span>\"+text+\"</div><ul id='group\"+groupid+\"'></ul></li>\";\n\tvar newstr = newline + str;\n\t// update slidebar window\n\t$('ul.noteUL').html(newstr);\n\tlen = groupStore.length;\n\tgroupStore[len] = new Object();\n\tgroupStore[len]._title = text;\n\tgroupStore[len]._groupid = groupid;\n\t\t\n}", "addSelected($selected) {\n var id = $selected.data('db-id');\n if ($selected.hasClass(\"result--track\")) {\n g.dataManager.getData('tracks', id, function(result) {\n this.addTrack(result, 'tracks');\n }.bind(this));\n } else if ($selected.hasClass(\"result--oneshot\")) {\n g.dataManager.getData('oneshots', id, function(result) {\n this.addTrack(result, 'oneshots');\n }.bind(this));\n } else if ($selected.hasClass(\"result--atmosphere\")) {\n g.dataManager.getData('atmospheres', id, function(result) {\n this.addAtmosphere(result);\n }.bind(this));\n }\n }", "function OnHumanResourceAdd() {\n $('#humanResource tr').removeClass(\"selected\");\n DrawHumanResourceRow();\n $('#newResourceModal').modal('hide');\n NewHumanResourceAddEditShowHide(false);\n}", "addMenuItem( item ){\n this.itemList.push(item);\n }", "function addOption() {\n\n}", "function onDialogOk(id, state) {\r\n if (state != DialogController.OK) {\r\n return;\r\n }\r\n\r\n var idFilterList = 'exclusion_filter_list';\r\n var idFilterItemAdd = 'exclusion-filter-item-add';\r\n var specificDialog = exlusionDialog;\r\n if (id.indexOf('inclusion') == 0) {\r\n idFilterList = 'inclusion_filter_list';\r\n idFilterItemAdd = 'inclusion-filter-item-add';\r\n specificDialog = inclusionDialog;\r\n }\r\n \r\n var item = $(idFilterItemAdd);\r\n if (item.value.trim().length == 0) {\r\n return;\r\n }\r\n \r\n var list = $(idFilterList);\r\n var items = item.value.split(',');\r\n for (var i = 0; i < items.length; i++) {\r\n list.add(new Option(items[i].toLowerCase()));\r\n }\r\n list.selectedIndex = list.length - 1;\r\n specificDialog.setVisible(false);\r\n}", "function _addResult( pData ) {\n var lSelectionValues;\n gWizardSelection$.append( pData.entries );\n gWizardSelection$.iconList( \"refresh\" );\n gWizardSelection$.iconList( \"setSelection\", gWizardSelection$.children().first() );\n lSelectionValues = gWizardSelection$.iconList( \"getSelectionValues\" );\n gWizardSelectionHidden$\n .val( lSelectionValues[ 0 ] )\n .trigger( \"change\" );\n } // _addResult", "_addItemToList(e) {\n if (\n this.shadowRoot.querySelector(\"#itemtext\").value != \"\" &&\n typeof this.shadowRoot.querySelector(\"#itemtext\").value !==\n typeof undefined\n ) {\n this.push(\"items\", {\n label: this.shadowRoot.querySelector(\"#itemtext\").value,\n value: false,\n disabled: this.disabledList,\n id: \"item-id-\" + this.items.length\n });\n this.shadowRoot.querySelector(\"#itemtext\").value = \"\";\n }\n }", "function addRoom(room) {\n\n // Get a handle to the room list <select> element\n var select = $('#rooms-list');\n\n // Create a new <option> for the <select> with the new room's information\n //var users = room.users || [];\n //var numUsers = users.length;\n var option = $('<option id=\"' + \"room-\" + room.id + '\" data-name=\"' + room.Product.name + '\" value=\"' + room.id + '\" onClick=\"chooseRoom(' + room.id + ')\">' + room.Product.name + ' (' + room.LastMessage.message + ')</option>');\n\n // Add the new <option> element\n select.append(option);\n}", "function addOption(group) {\n var option = document.createElement(\"option\");\n option.text = group.name;\n option.value = group.id;\n \n document.getElementById(\"list\").add(option);\n}", "function add_player_dialog()\n\t{\n\t\t$('#add_player').dialog();\n\t}", "addAmbients() {\n this.ambientViewGUI = this.interface.gui\n .add(this.graph, 'newAmbient', Object.keys(this.graph.ambients))\n .name('Selected Ambient')\n .onChange(this.graph.onSelectedAmbient.bind(this.graph));\n }", "function addPlayerToUIList(player) {\n const newPlayer = document.createElement('option');\n newPlayer.textContent = newPlayerSubmitted ? titleCaseName(player) : titleCaseName(player.name);\n playerList.add(newPlayer);\n }", "function addItem() {\n let text = $('#newItemText').val();\n let value = $('#newItemValue').val();\n let menu = $('#menu');\n menu.append($(\"<option></option>\")\n .attr(\"value\", value)\n .text(text));\n $('#newItemText').val('');\n $('#newItemValue').val('');\n\n}", "function show_add(){\n edicao=false;\n $(\"#btn_do_project\").prop( \"disabled\", false );\n $(\"form[name='fp'] input, form[name='fp'] textarea\").val(\"\").prop( \"disabled\", false );\n $('#cliente').html(\"<option value=\\\"c\\\">Carregando...</option>\").prop(\"disabled\", true).selectpicker('refresh').selectpicker(\"val\",\"c\");\n list_clients();\n $(\"#data_entrega\").hide();\n $(\"#tm\").text(\"Novo projeto\");\n $(\"#btn_do_project\").text(\"Adicionar\");\n $(\"#m_aep\").modal(\"show\");\n}", "function addToInventory(inventory) {\n console.table(inventory);\n inquirer\n .prompt([\n {\n type: \"input\",\n name: \"choice\",\n message: \"What is the ID of the item you would you like add to?\",\n validate: function(val) {\n return !isNaN(val);\n }\n }\n ])\n .then(function(val) {\n var choiceId = parseInt(val.choice);\n var product = checkInventory(choiceId, inventory);\n // If a product can be found with the chose id...\n if (product) {\n // Pass the chosen product to promptCustomerForQuantity\n promptManagerForQuantity(product);\n }\n else {\n // Otherwise let the user know and re-load the manager menu\n console.log(\"\\nThat item is not in the inventory.\");\n loadManagerMenu();\n }\n });\n}", "function radialMenuOnSelect() {\r\n\ttracker.recordSelectedItem(this.id);\r\n\tvar radialmenu = document.getElementById('radialmenu');\r\n\tradialmenu.parentNode.removeChild(radialmenu);\r\n\r\n\tdocument.getElementById(\"selectedItem\").innerHTML = this.id;\r\n}", "function newLiButtonClicked(){\n createListItem();\n }", "function addReason(e, obj) {\n var adorn = obj.part;\n if (adorn === null) return;\n e.handled = true;\n //var list = adorn.adornedPart.findObject(\"ReasonList\");\n var arr = adorn.adornedPart.data.reasonsList;\n // and add it to the Array of port data\n myDiagram.startTransaction(\"add reason\");\n myDiagram.model.addArrayItem(arr, {});\n myDiagram.commitTransaction(\"add reason\");\n }", "function addInformation() {\n inquirer\n .prompt({\n name: \"action\",\n type: \"rawlist\",\n Message: \"WHAT INFORMATION WOULD YOU LIKE TO ADD?\",\n choices: [\"ADD department\", \"ADD role\", \"ADD employee\"],\n })\n //=======IF YOU WANT TO ADD TO THE DEPARTMENT========\n .then(function (answer) {\n switch (answer.action) {\n case \"ADD department\":\n addDepartment();\n break;\n //========IF YOU WANT TO ADD TO THE ROLE=============\n case \"ADD role\":\n addRole();\n break;\n //========IF YOU WANT TO ADD TO THE EMPLOYEE===========\n case \"ADD employee\":\n addEmployee();\n break;\n }\n });\n}", "function selectAddOn(name, effect, rarity, tooltip, icon, combinesWith, itarget) {\n var addOn = new DbDItem(name, effect, rarity, tooltip, icon, combinesWith, itarget);\n addOn.combinesWith = combinesWith;\n addOn.target = itarget;\n addOn.isSelected = false;\n addOn.type = combinesWith;\n return addOn;\n}", "function addId(listId) {\n if( $(\"idSelection\").hasChildNodes() ) {\n var selected = $(\"idSelection\").selectedIndex;\n if( selected >= 0 ) {\n var chosen = $(\"idSelection\").options[selected];\n $(\"idSelection\").removeChild( chosen );\n $(listId).appendChild( chosen ); \n }\n }\n}", "_handleButtonAddAdmin()\n {\n Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__PROJECT_ADD_USER_ADMIN,\n {username: this._getSelectedUser(), project: this._project});\n }", "function showCreateMenuItemDialog()\n{\n\t$('#createMenuItemDialog').dialog('open');\n\t$(\"#createMenuItemDialog\").html('<div id=\"modalWindowLoader\"></div>');\n\t$(\"#createMenuItemDialog\").load('/admin/structure/add/' + selectedItemID, function()\n\t{\n\t\t$('#createMenuItemDialog input[name=folderId]').val(currentFolderID);\n\t});\n\treturn false;\n}", "addItem() {\n if (!this.props.onItemUpdate) {\n console.warn('Read-only list.');\n return;\n }\n\n // TODO(burdon): Set focus on editor.\n if (!this.state.showEditor) {\n this.setState({\n showEditor: true,\n editingItemId: null\n });\n }\n }", "function clickAddnewMenu(){\n\t\t\n\t\t$(\"#menuAddNew\").show();\n\t\t//$(\".categorydropList\").load(jssitebaseUrl+\"/ajaxActionRestaurant.php?action=categoryDropList\");\n\t\t$(\"#menuEdit\").hide();\n\t\t//$(\"#addnew_buttun\").hide();\n\t\t$(\".restaurantMenuContent\").hide();\n\t}", "function addReason(e, obj) {\n var adorn = obj.part;\n if (adorn === null) return;\n e.handled = true;\n var arr = adorn.adornedPart.data.reasonsList;\n myDiagram.startTransaction(\"add reason\");\n myDiagram.model.addArrayItem(arr, {});\n myDiagram.commitTransaction(\"add reason\");\n }", "function addBtn(){\n\t//disable add button until screen is returned to focus. Issue #28\n\t$.addTransect.enabled = false;\n\t\n\tvar addTransect = Alloy.createController(\"addTransect\", {siteGUID: $.tbl.siteGUID}).getView();\n\tvar nav = Alloy.Globals.navMenu;\n\tnav.openWindow(addTransect);\n}", "function showAddAcc() {\n $('#addAcc').insertAfter(\"#newAccList\");\n $('#addAcc').show();\n}", "function add(event,ui) {\n\n\tswitch($(\"#selection\")[0].value) {\n\n\t\tcase \"archive\" :\n\t\t// the property the filter works on\n\t\ts.filter(\"letter\")\n\t\t// a title for the filter \n\t\t.title(\"Archive\")\n\t\t// the type of view associated\n\t\t.view(\"bubble\",\"archive\")\n\n\t\tbreak;\n\n\t\tcase \"author\" :\n\t\ts.filter(\"author\")\n\t\t.title(\"Author\")\n\t\t.view(\"bubble\")\n\n\t\tbreak;\n\n\t\tcase \"recipient\" :\n\t\ts.filter(\"recipient\")\n\t\t.title(\"Recipient\")\n\t\t.view(\"bubble\")\n\n\t\tbreak;\n\n\t\tcase \"date\" :\n\t\ts.filter(\"date\")\n\t\t.title(\"Date\")\n\t\t.view(\"area\")\n\n\t\tbreak;\n\n\t\tcase \"source\" :\n\t\ts.filter(\"source\")\n\t\t.title(\"Source\")\n\t\t.view(\"map\", \"sourcelatlon\");\n\n\t\tbreak;\n\n\t\tcase \"destination\" :\n\t\ts.filter(\"destination\")\n\t\t.title(\"Destination\")\n\t\t.view(\"map\", \"destinationlatlon\");\n\n\t\tbreak;\n\n\t\tcase \"nationality\" :\n\t\ts.filter(\"authorid\")\n\t\t.title(\"Nationality (A)\")\n\t\t.view(\"nationality\")\n\n\t\tbreak;\n\n\t}\n\n}", "_addNewItem(event) {\n\t\tevent.preventDefault();\n\t\tthis.state.item.description = this.state.item.description || \"-\";\n\t\tthis.state.item.amount = this.state.item.amount || \"0\";\n\t\tWalletActions.addNewItem(this.state.item);\n\t\tthis.setState({ item: this._getFreshItem() });\n\t}", "function addGame(game) {\n $(\"#game_choose .games\").append(\"<li id='game-\" + game.id + \"'>\" + game.name + \"</li>\")\n }", "addRow() {\n let newAlt = new AltColumnFilters(this.holder, this.paneOb)\n newAlt.id = this.idCount\n this.idCount++\n // add to the pane collection for export as well\n this.paneOb.altFiltersState[newAlt.id] = { colname: \"\", op: \"\", val: \"\" }\n newAlt.init()\n // add the removal function to take it from the list too\n\n newAlt.removeFromList = this.removeFromList.bind(this)\n\n this.altfilters.push(newAlt)\n this.holder.addEventListener(\"altchange\", this.filter.bind(this))\n\n\n }", "isAddNewDialog() {\n return this.mode === 'dialog-add-new';\n }", "addItem(id, itemText) {\n var platformsSelect = document.getElementById(id);\n var option = document.createElement('option');\n option.text = itemText;\n platformsSelect.add(option);\n }", "_addNewItem() {\n // Add new Item from Order's Items array:\n this.order.items = this.order.items.concat([this.item]);\n // Update current Order:\n this.orderService.setCurrentOrder(this.order);\n this._closeAddNewItem();\n }", "addSelected(selectedoption, options) {\n //if selected then remove it\n if (this.ifSelected(selectedoption, options)) {\n this.removeSelected(selectedoption, options);\n return;\n }\n if (this.single == true) {\n options[0] = selectedoption;\n } else {\n options.push(selectedoption);\n }\n }", "push(paladinID) {\n const arr = Array.from(state.PaladinAura.PaladinList);\n arr.push(paladinID);\n STATE.PaladinList.set(arr);\n }", "function addFifterItem(){\n var ths = $('.list:visible').eq(0).find('th[field]');\n var thsLen = ths.length;\n\n var options = new Array();\n for(i=0;i<thsLen;i++){\n options[i] = ths.eq(i).attr('field');\n }\n\n var labels = $('#fifter .unit label');\n for(j=0;j<labels.length;j++){\n for(i=0;i<thsLen;i++){\n if(labels.eq(j).attr('field') == options[i]){\n delete options[i];\n }\n }\n }\n\n var newUnit = \"<div id='selFifterItem' class='unit'><label>\";\n newUnit += \"<select onchange='getNewFifterItem(this);'><option value=''>请选择</option>\";\n for(index in options){\n newUnit += \"<option type='\"+ ths.eq(index).attr('type') +\"' value='\"+ options[index] +\"'>\"+ ths.eq(index).text() +\"</option>\";\n }\n newUnit += \"</select></label></div>\";\n\n $('#fifter').append(newUnit);\n}", "function addNewRoom() {\n var roomid = \"new\" + newrooms++;\n var tagcontent = \"<div class='srow'> \\\n <input type='hidden' name='_roomids' value='\" + roomid + \"'/>\\\n <div class='srow group_form roomborder'> \\\n <div class='center roomHeaer'>New Room</div>\\\n <div class='col-x-4 col-3'> \\\n <div class='srow group_form'> \\\n <div class=''> \\\n Title: \\\n </div>\\\n <div class=''>\\\n <input type='text' name='_roomnames' class='input_text medium_width required' placeholder='Room Title' />\\\n </div>\\\n </div>\\\n </div> \\\n <div class='col-x-4 col-9'> \\\n <div class='srow group_form'>\\\n <div class=''>\\\n Sleeping arrangements and Furniture\\\n </div>\\\n <div class=''>\\\n <select class='selectbox chosen-select large_width roomfurniture' multiple='multiple' name='room\" + roomid + \"'>\\\n </select>\\\n </div>\\\n </div>\\\n </div>\\\n <div class='buttongroup'>\\\n <input class='btnnormal removeroom' type='button' value ='Remove Room'/>\\\n </div>\\\n </div>\\\n </div>\";\n $('#roomcontainer').append(tagcontent);\n $('#roomcontainer input[value=' + roomid + ']').parent().find('.roomfurniture').append(furniture_tag);\n $('#roomcontainer').find('.roomfurniture').chosen();\n $('#roomcontainer').find('.roomfurniture').trigger(\"chosen:updated\");\n\n $('input').keypress(function () {\n $(this).parent().find('.error_msg').remove();\n $(this).removeClass('error_required');\n });\n $('.removeroom').click(function () {\n console.log(\"remove\");\n $(this).parent().parent().parent().remove();\n });\n}", "function addIncludePartnerFn(selectedItem) {\n \tif (listIncludePartners.indexOf(selectedItem.item.id) < 0){\n \t\tlistIncludePartners.push(selectedItem.item.id);\n \tvar htmlData = '<div id=\"included-'+ selectedItem.item.id +'\">'+ selectedItem.item.value +'<span class=\"jq-publish-remove-include fa fa-times c-float-right c-cursor-pointer\" destination=\"'+ selectedItem.item.id +'\"></span></div>';\n \t\n \t$(\"#publish-include-partner\").append(htmlData);\n \t\n \tsetTimeout(function () {\n \t\t$(\"#jqac-include-partners\").val(\"\");\n }, 500);\n \t}else{\n \t\t$(\"#jqac-include-partners-error\").show();\n \t}\n }", "function addCard (crd) {\n openCardList.push(crd);\n}", "_addItem(e) {\n e.preventDefault();\n e.stopPropagation();\n\n this._$list.append(this._createDefaultEntry(this._numItems));\n this._numItems += 1;\n }", "function addInfoPrompt () {\n return inquirer.prompt ([\n {\n type: \"list\",\n name: \"itemToAdd\",\n message: \"What would you like to add?\",\n choices: [\n \"A new department\", \n \"A new role\",\n \"A new employee\"\n ]\n }\n ])\n }", "function add(tab, index) {\n\n tabsList.add(tab, index);\n tab.onAdd(self.contentArea);\n\n // Select the new tab if we don't have a selectedIndex, or if the\n // selectedIndex we've been waiting for is this tab\n if ($scope.selectedIndex === -1 || !angular.isNumber($scope.selectedIndex) || \n $scope.selectedIndex === self.indexOf(tab)) {\n self.select(tab);\n }\n $scope.$broadcast('$mdTabsChanged');\n }", "function add() {\r\n DlgHelper.AjaxAction(\"/schedule/add/\", \"POST\", function (data) {\r\n\r\n if (data != null && data != \"\") {\r\n refresh().done(function () { DlgHelper.ShowDialogSuccess(\"Добавлено: \" + data, 1000); });\r\n } else {\r\n DlgHelper.ShowDialogError(\"Неверный ввод...\", 2000);\r\n }\r\n\r\n });\r\n }", "function addItem() {\n var contents = document.getElementById('newTask').value;\n var item = new listItem(Date.now(), contents, false);\n masterList.push(item);\n showList(masterList);\n saveList();\n}", "function newItem(){\n sendRequest(\n 'usergroups',\n {\n 'action': 'getNewItemForm',\n \"id_menucategory\": $('#kategoria').val()\n }, function(data){\n $('#listcontent').css('display','none');\n $('#editorholder').html(data);\n });\n}", "function addListItem(pokemon){\n let pokemonList = document.querySelector('.list-group');\n let listPokemon = document.createElement('li');\n //adding group-list-item on li element\n listPokemon.classList.add('list-group-item');\n\n let button = document.createElement('button');\n button.innerText = pokemon.name.toUpperCase();\n //adding btn on button element\n button.classList.add('btn', 'btn-block');\n button.setAttribute('data-target', '#pokemonModal');\n button.setAttribute('data-toggle', 'modal');\n\n listPokemon.appendChild(button);\n pokemonList.appendChild(listPokemon);\n button.addEventListener('click', function() {\n showDetails(pokemon);\n });\n }", "function addEditAirOperation() {\n // set up the dialog elements\n $(\"#airopzone\").text(selectedZone);\n if (editingOpIdx > -1) { //editing an existing op\n selectZone(searchGrid.zoneToTopLeftCoords(airOps[editingOpIdx].Zone));\n $(\"#airopmission\").html(getMissionOptionHtml(airOps[editingOpIdx].Mission));\n } else { //new op\n if (!getMissionOptions()) return;\n if (!getNewOp()) return;\n }\n showAirOpSources();\n \n $(\"#dlgairops\").css(\"display\", \"block\")\n .draggable({\n handle: \".floathead\",\n containment: \"#pagediv\",\n scroll: false\n });\n \n // show it\n $(\"#dlgoverlay\").css(\"display\", \"block\").focus();\n}", "function addEnemyFightTogether(){\n fight.removeEventListener('click',fightOneAtATime) //change listener\n fight.addEventListener('click',fightTogether) \n chooseEnemy.style.display = 'block' \n for(let i=0;i<enemyList.length;i++){ \n chosenEnemy.value = i //add choice tags\n chosenEnemy.innerHTML = 'Enemy '+ (i+1) //add choice words\n chooseEnemy.appendChild(chosenEnemy.cloneNode(true)) //add to dropdown list\n }\n fightMechanic.insertBefore(document.createElement('br'),allEnemies)\n addEnemy()\n}" ]
[ "0.54219407", "0.52663046", "0.5256905", "0.5244794", "0.5239603", "0.51920944", "0.51873124", "0.5184945", "0.51793987", "0.5177392", "0.5149768", "0.51267743", "0.50973165", "0.5087142", "0.5082419", "0.5046657", "0.5046477", "0.5037896", "0.502538", "0.5021467", "0.49934393", "0.4992544", "0.4980815", "0.4971009", "0.4968383", "0.49443114", "0.49417546", "0.4938757", "0.49300277", "0.49282795", "0.49120408", "0.4903042", "0.4896375", "0.48945415", "0.48905537", "0.4888919", "0.48813415", "0.4874743", "0.48692137", "0.48675707", "0.48652557", "0.4862475", "0.4860108", "0.485916", "0.4859032", "0.48582622", "0.48560655", "0.48551548", "0.48520747", "0.484713", "0.48456952", "0.48429984", "0.4838973", "0.48268697", "0.48236746", "0.48210633", "0.48093843", "0.48032275", "0.47993526", "0.47901142", "0.47845086", "0.4783841", "0.4782104", "0.47815573", "0.47777218", "0.47711262", "0.47710288", "0.47689155", "0.47666904", "0.47648063", "0.47645733", "0.47628886", "0.47597837", "0.47574028", "0.4755462", "0.4749792", "0.47478986", "0.47418377", "0.47306773", "0.4723514", "0.47233957", "0.47204363", "0.4714189", "0.47131747", "0.47065112", "0.46983886", "0.4698007", "0.4693354", "0.46839866", "0.46736372", "0.4670453", "0.4670106", "0.4669957", "0.4663959", "0.46627566", "0.46597537", "0.4658552", "0.46577606", "0.46555626", "0.4652581" ]
0.59239537
0
Gets the latest weather forecast data and updates each card with the new data.
function updateData() { Object.keys(raidApp.selectedLocations).forEach((key) => { const raid = raidApp.selectedLocations[key]; const card = getRaidCard(raid); // CODELAB: Add code to call getForecastFromCache // Get the forecast data from the network. //getRaidFromNetwork(location.geo).then((forecast) => { //renderForecast(card, forecast); //}); renderRaid(card, raid) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadForecastWeather(searchCity) {\n if (searchCity == null) searchCity = localStorageData.activeCity;\n var queryURL = `${OPEN_WEATHER_FIVE_DAY_FORECAST_URL}${searchCity}&appid=${OPEN_WEATHER_APPID}`;\n $.ajax({\n url: queryURL,\n method: \"GET\",\n }).then(function (response) {\n if (logIt) console.log(response);\n // grab every 8th data from the forecast array\n const OneDayInMilli = 23 * 60 * 60 * 1000;\n var forecastDt = Date.now() + OneDayInMilli;\n if (logIt) console.log(\"[Now] \" + Date.now() + \" ==> \" + formatDateTime(Date.now()));\n if (response.cnt >= 1) {\n // empty the forecast DIV\n var jqForecastDiv = $(\"#forecast-cards-div\");\n jqForecastDiv.empty();\n\n for (let index = 0; index < response.cnt; index++) {\n var forecast = response.list[index];\n var dt = forecast.dt * 1000; // convert to milliseconds\n if (dt > forecastDt) {\n forecast = response.list[index - 1];\n forecastDt += OneDayInMilli;\n var forecastTimeMilli = forecast.dt * 1000;\n if (logIt) console.log(\"[\" + (index - 1) + \"] \" + dt + \" ==> \" + formatDateTime(forecastTimeMilli));\n // get the forecast card\n var forecastDate = formatDate(forecastTimeMilli, \"/\");\n var iconId = forecast.weather[0].icon;\n var temperature;\n var tempScale = \"C\";\n if (localStorageData.temperatureUnit[0] == \"F\") {\n temperature = kelvinToFahrenheit(forecast.main.temp);\n tempScale = \"F\";\n } else {\n temperature = kelvinToCelcius(forecast.main.temp);\n }\n var humidity = forecast.main.humidity;\n var weatherTitle = forecast.weather[0].description;\n var forecastDiv = generateForecastCardJQ(\n forecastDate,\n iconId,\n temperature,\n tempScale,\n humidity,\n weatherTitle\n );\n jqForecastDiv.append(forecastDiv);\n }\n }\n // update active City from response\n var cityId = response.city.name + \", \" + response.city.country;\n if (logIt) console.log(`CityID ==> ${cityId}`);\n var dataStore = loadLocalStorage();\n dataStore.activeCity = cityId;\n updateLocalStorage(dataStore);\n // now search city list to see if cityId is there\n var cityList = $(\".list-group-item\");\n if (logIt) console.log(cityList);\n var found = false;\n for (let index = 0; index < cityList.length; index++) {\n var cityBtn = cityList[index];\n if (logIt) console.log(\"[\" + index + \"] \" + cityBtn.textContent);\n if (cityId == cityBtn.textContent) {\n found = true;\n break;\n }\n }\n // if the cityId is not found, prepend it as the first element under\n // the #city-history-list-group DIV. First check if we have reached the\n // limit of how many cities we can include\n if (!found) {\n var len = $(\"#city-history-list-group\").children().length;\n if (logIt) console.log(\"Cities History Length ==> \" + len);\n if (len >= CITIES_HISTORY_MAX) {\n var cities = $(\"#city-history-list-group\").children();\n var lastChild = $(\".list-group-item-action\").last();\n lastChild[0].remove();\n if (logIt) {\n console.log(\"Last Child ==> \" + lastChild[0]);\n console.log(cities);\n console.log(cities[len - 1]);\n }\n // create a new entry for the search history list,\n // prepend it and select it\n $(\".list-group-item-action\").removeProp(\"active\");\n var btn = $(`<button type=\"button\" class=\"list-group-item list-group-item-action active\">${cityId}</button>`);\n $(\"#city-history-list-group\").prepend(btn);\n // remove the last entry from the cities array in localStorage\n dataStore = loadLocalStorage();\n dataStore.cities.pop();\n dataStore.cities.unshift(cityId);\n updateLocalStorage(dataStore);\n // remove old action listeners on the history buttons\n $(\".list-group-item\").off(\"click\");\n // remove and re-create buttons\n initializeUI();\n // put back action listeners\n $(\".list-group-item\").on(\"click\", function (event) {\n event.preventDefault();\n citySelectActionListener(event, $(this));\n });\n }\n }\n }\n // now update the last updated timer\n if (logIt) console.log(\"Executing reset of timer...\");\n resetLastUpdatedIntervalTimer();\n });\n}", "function getForecast(lat,lon){\n var queryURL = `https://api.openweathermap.org/data/2.5/onecall?lat=${lat}&lon=${lon}&exclude=minutely&units=imperial&appid=${apiKey}`\n fetch(queryURL).then(function (response) {\n return response.json();\n }).then(function (data) {\n console.log(data);\n var uvIndex = $(\"<p>\").text(\"UV Index: \" + data.current.uvi);\n console.log(data.current.uvi);\n $(\".uv-index\").append(uvIndex);\n for( var i = 1; i < 6; i++){\n console.log(data.daily[i]);\n var card = $(\"<div>\").addClass(\"card\").attr(\"style\", \"border: 1px solid black\");\n var cardBody = $(\"<div>\").addClass(\"card-body\");\n var cardTitle = $(\"<h5>\").addClass(\"card-title\").text(moment.unix(data.daily[i].dt).format(\"L\"));\n var cardTemp = $(\"<h6>\").addClass(\"card-temp\").text(\"Temp: \" + data.daily[i].temp.day + \" °F\");\n var cardHumid = $(\"<h6>\").addClass(\"card-humid\").text(\"Humidity: \" + data.daily[i].humidity + \" %\");\n $(\".forecast\").append(card.append(cardBody.append(cardTitle.append(cardTemp.append(cardHumid)))));\n }\n})\n}", "async updateForecast() {\n this.error(null);\n\n try {\n let data = null;\n for (let proxyPage of [\"proxy.php\", \"proxy.ashx\"]) {\n try {\n let response = await fetch(`${proxyPage}?url=${this.currentLatitude()},${this.currentLongitude()}&units=${this.units()}&lang=${this.getLanguage()}`);\n if (!response.ok) throw new Error(`Request to ${proxyPage} returned status ${response.status}`);\n data = await response.json();\n if (data) break;\n } catch (e) {\n console.warn(e);\n }\n }\n\n if (data == null) {\n this.error(\"Could not load data from the proxy. Try manually defining your latitude/longitude in the settings.\");\n return;\n }\n\n let timezone = this.useLocationTime()\n ? data.timezone\n : moment.tz.guess();\n let timeFormat = this.twelveHourTime()\n ? \"h:mm A\"\n : \"H:mm\";\n\n this.alerts([]);\n for (let a of data.alerts || []) {\n let title = a.title;\n if (a.expires) {\n title += ` (until ${moment.tz(a.expires * 1000, timezone).format(\"dddd \" + timeFormat)})`;\n }\n this.alerts.push({\n title: title,\n uri: a.uri,\n severity: a.severity\n });\n }\n\n this.time(\"Last updated: \" + moment.tz(data.currently.time * 1000, timezone).format(timeFormat + \" z\"));\n this.temperature(Math.round(data.currently.temperature) + String.fromCharCode(0xB0));\n this.description(data.currently.summary);\n\n this.hourlyForecast([]);\n for (let h of data.hourly.data.slice(1, this.hoursAhead() + 1)) {\n const icon = await this.emojiStr(WeatherViewModel.getEmojiFromIconStr(h.icon));\n\n this.hourlyForecast.push({\n time: moment.tz(h.time * 1000, timezone).format(timeFormat),\n temp: Math.round(h.temperature || 0) + String.fromCodePoint(0xB0),\n icon: icon,\n summary: h.summary,\n precipProbability: Math.round(h.precipProbability * 100) + \"%\"\n });\n }\n this.dailyForecast([]);\n for (let h of data.daily.data.slice(0, this.daysAhead())) {\n const icon = await this.emojiStr(WeatherViewModel.getEmojiFromIconStr(h.icon));\n\n this.dailyForecast.push({\n time: moment.tz(h.time * 1000, timezone).format(\"dddd\"),\n tempMax: Math.round(h.temperatureMax || 0) + String.fromCodePoint(0xB0),\n tempMin: Math.round(h.temperatureMin || 0) + String.fromCodePoint(0xB0),\n humidity: h.humidity == null ? null : Math.round(h.humidity * 100),\n icon: icon,\n summary: h.summary,\n precipProbability: Math.round(h.precipProbability * 100) + \"%\"\n });\n }\n } catch (e) {\n console.error(e);\n this.error(e.message || e.responseText || \"An error occured.\");\n }\n }", "populateForecast() {\n this.forecastService.getForecast()\n .then(data => {\n this.forecastData = data\n this.serviceActive = true;\n }).catch((err) => {\n this.serviceActive = false;\n });\n this.timeService.getTime()\n .then(time => this.lastUpdated = time.format(\"HH:mm:ss\"));\n }", "function loadData() {\n weatherData.getWeatherData().then(function (data) {\n _this.data = data;\n\n // Calculate date and weekdays for the 16 days forecast\n angular.forEach(_this.data.list, function (value, index) {\n var monthDay = _this.currentDate.getDate() + index;\n var weekDay = _this.weekDays[((monthDay + 1) % 7)];\n var cardDate = weekDay + ' ' + monthDay;\n _this.cardsDate.push(cardDate);\n });\n });\n }", "function getForecast() {\n // var queryURL = \"https://api.openweathermap.org/data/2.5/forecast/daily?q=\" + currentCity +\"&cnt=5&appid=\" + APIKey;\n var queryURL = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + currentCity + \"&cnt=38&appid=\" + APIKey;\n\n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).then(function(response) {\n //console.log(response);\n var dataInd = 0;\n for (i = 0; i < 38; i++) {\n \n if (response.list[i].dt_txt.indexOf(\"03:00:00\") !== -1) {\n var currentIcon = \"http://openweathermap.org/img/wn/\" + response.list[i].weather[0].icon + \"@2x.png\";\n //console.log(currentIcon);\n var currentDay = \"(\" + moment(response.list[i].dt_txt.substr(0, 10), \"YYYY-MM-DD\").format(\"MM/DD/YYYY\")+ \")\";\n $(\".card-title\" + dataInd).text(currentDay);\n //console.log($(\".card-title\" + dataInd).text());\n $(\".forecast\" + dataInd).attr(\"src\", currentIcon);\n $(\".forecastTemp\" + dataInd).text(\"Temperature: \" + ((response.list[i].main.temp - 273.15) * 1.80 + 32).toFixed(1)+ \"\\xB0F\");\n $(\".forecastHum\" + dataInd).text(\"Humidity: \" + response.list[i].main.humidity);\n dataInd++; //shouldn't get above 4 since it starts at 0\n }\n }\n generateLocals();\n })\n\n}", "function getForecast(city){\n fetch(`https://api.openweathermap.org/data/2.5/forecast?q=${city}&units=imperial&appid=b96b52626f78508367acbb00dd591cd2`)\n .then(response => response.json())\n .then(data => {\n $(\"#dataRow\").empty();\n for (let i = 0; i < data.list.length; i+= 8){\n dataCard(data.list[i]);\n }\n })\n }", "function forecastWeather(location) {\n // 5-day forecast API\n var forecastURL = `https://api.openweathermap.org/data/2.5/forecast?q=${location}&appid=${APIKey}&units=imperial`;\n\n $.get(forecastURL).then(function (response) {\n $(\"#fiveDayForecast\").html(\"\");\n for (let index = 0; index < response.list.length; index++) {\n const element = response.list[index];\n if (element.dt_txt.indexOf(\"15:00:00\") !== -1) {\n // console.log(element);\n\n // populate html for 5 day weather\n var header = $(\"<h5>\").text(\"Five Day Forecast:\");\n\n // add date to card - could only get current date to populate\n var date = moment().format(\"l\");\n\n // add card div to card for each of 5 days\n var card = $(\"<div>\").addClass(\"col-md-2 card\");\n\n // add weather <img> to card for each of 5 days\n var weatherIcon = element.weather[0].icon;\n var srcIcon = `https://openweathermap.org/img/wn/${weatherIcon}.png`;\n var img = $(\"<img>\").attr(\"src\", srcIcon);\n\n // add temp to card for each of 5 days\n var fiveDayTemp = Math.round(element.main.temp);\n var temp = $(\"<p>\").text(\"Temp: \" + fiveDayTemp + \" F°\");\n\n // add humidity to cardfor each of 5 days\n var hum = $(\"<p>\").text(\"Humidity: \" + element.main.humidity + \"%\");\n\n // populate the 5 cards on page with header outside card\n $(\".header\").html(header);\n card.append(date, img, temp, hum);\n $(\"#fiveDayForecast\").append(card);\n }\n }\n });\n }", "function forecastDeck(city) {\n $(\".card-deck\").empty();\n var queryURL = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + city + \"&units=imperial&appid=bf44d6b9da075580825f81e2aa54cf78\";\n \n $.ajax({\n url: queryURL,\n method: \"GET\",\n }).then(function (response) {\n for (var i = 0; i < response.list.length; i++) {\n if (response.list[i].dt_txt[12] === \"2\") {\n var cardDate = moment.unix(response.list[i].dt).format(\"MM/DD/YYYY\");\n var cardIcon = response.list[i].weather[0].icon;\n var cardIconURL = \"https://openweathermap.org/img/w/\" + cardIcon + \".png\";\n var cardTemp = response.list[i].main.temp;\n var cardHum = response.list[i].main.humidity;\n \n $(\".card-deck\").append(\n `<div class=\"card\" style=\"margin:4px; padding:4px;\">\n <div class=\"card-body\">\n <h5 class=\"card-date\">${cardDate}</h5>\n <img class=\"card-icon\" alt=\"forecast\" src=\"${cardIconURL}\">\n <p class=\"card-text\">Temp:<br> ${cardTemp} \\u00B0F</p>\n <p class=\"card-text\">Humidity:<br> ${cardHum}%</p>\n </div>\n </div>`);\n }\n }\n });\n }", "function ForecastData(cityName) {\n $(\"p\").empty();\n\n var url = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + cityName + \"&appid=\" + apiKey + \"&units=imperial\";\n fetch(url)\n .then(function (response) {\n if (response.ok) {\n response.json().then(function (data) {\n var lat = data.city.coord.lat;\n var lon = data.city.coord.lon;\n var n = -1;\n\n for (var i = 3; i < data.list.length; i += 8) {\n var day = data.list[i];\n n++;\n\n var forDate = (new Date(day.dt_txt)).toShortDate();\n var forIcon = \"https://openweathermap.org/img/wn/\" + day.weather[0].icon + \".png\";\n var forTemp = day.main.temp;\n var forWind = day.wind.speed;\n var forHum = day.main.humidity;\n\n forecastDateEl.eq(n).text(forDate);\n forecastIconEl.eq(n).attr(\"src\", forIcon);\n forecastTempEl.eq(n).html(\"Temp: \" + forTemp + \" &deg;F\");\n forecastWindEl.eq(n).text(\"Wind: \" + forWind + \" MPH\");\n forecastHumidityEl.eq(n).text(\"Humidity: \" + forHum + \" %\");\n }\n\n CurrentData(cityName, lat, lon);\n addCity(cityName);\n })\n }\n })\n}", "fetchForecastPreview(currentLocation) {\n const query = {\n requestType: 'forecast',\n latitude: currentLocation.latitude,\n longitude: currentLocation.longitude\n };\n return this.fetchForecast(query)\n .then(weather => {\n const hourly = [];\n // get next 5 hours\n for (let i=1; i < 6; i++) {\n const hour = weather.hourly.data[i];\n hourly.push({\n time: hour.time * 1000,\n icon: hour.icon,\n temperature: Math.round(hour.temperature)\n });\n }\n\n const daily = [];\n // get next 5 days\n for (let i=1; i < 6; i++) {\n const day = weather.daily.data[i];\n daily.push({\n time: day.time * 1000,\n icon: day.icon,\n high: Math.round(day.temperatureHigh),\n low: Math.round(day.temperatureLow),\n precip: Math.round(day.precipProbability * 100)\n });\n }\n\n const current = weather.currently;\n const preview = {\n currently: {\n time: current.time * 1000,\n icon: current.icon,\n summary: current.summary,\n temperature: Math.round(current.temperature),\n high: Math.round(weather.daily.data[0].temperatureHigh),\n low: Math.round(weather.daily.data[0].temperatureLow),\n humidity: Math.round(current.humidity * 100),\n precip: Math.round(current.precipProbability * 100),\n windSpeed: Math.round(current.windSpeed),\n windDirection: current.windBearing,\n },\n hourly: hourly,\n daily: daily,\n alerts: weather.alerts\n };\n\n return Promise.resolve(preview);\n })\n .catch(error => {\n console.log('Failed to fetch weather');\n return Promise.reject(error);\n });\n }", "function forecast(cityid) {\n var queryforcastURL =\n \"https://api.openweathermap.org/data/2.5/forecast?id=\" +\n cityid +\n \"&appid=\" +\n APIKey;\n $.ajax({\n url: queryforcastURL,\n method: \"GET\",\n }).then(function (response) {\n console.log(response);\n for (i = 0; i < 5; i++) {\n var date = new Date(\n response.list[(i + 1) * 8 - 1].dt * 1000\n ).toLocaleDateString();\n var iconcode = response.list[(i + 1) * 8 - 1].weather[0].icon;\n var iconurl = \"https://openweathermap.org/img/wn/\" + iconcode + \".png\";\n var tempK = response.list[(i + 1) * 8 - 1].main.temp;\n var tempF = ((tempK - 273.5) * 1.8 + 32).toFixed(0);\n var humidity = response.list[(i + 1) * 8 - 1].main.humidity;\n $(\".cards-container\").addClass(\"card\");\n $(\"#fDate\" + i).html(date);\n $(\"#fImg\" + i).html(\"<img src=\" + iconurl + \">\");\n $(\"#fTemp\" + i).html(\"Temp: \" + tempF + \"&#8457\");\n $(\"#fHumidity\" + i).html(\"Humidity: \" + humidity + \"%\");\n }\n });\n}", "async function updateWeatherData() {\n for (const { name, lng, lat } of cities) {\n const url = `${BASE_URL}/category/pmp3g/version/2/geotype/point/lon/${lng}/lat/${lat}/data.json`;\n const response = await fetch(url);\n const forecast = await response.json();\n const { lowest, highest } = findHighAndLowTemp(forecast);\n addForecast(name, lowest, highest);\n }\n}", "function getForecast(lat, lon) {\n //probably best to rename this \n var getForecastUrl = \"https://api.openweathermap.org/data/2.5/onecall?lat=\" + lat + \"&lon=\" + lon + \"&exclude=minutely,hourly,alerts&appid=a3be7588e2f22d761077e844f13fff0c&units=imperial\"\n // // fetching one call\n // Changing to catch errors\n fetch(getForecastUrl)\n .then(function(response) {\n if (response.ok) {\n response.json().then(function(data) {\n // innerhtml for index value\n uvIndexValue.innerHTML = \"UVI: \" + data.current.uvi;\n console.log(\"this is inside getForecast\");\n console.log(data.daily)\n\n //code goes here for next days forecast\n // loop to run through next days\n fullForecast = []\n cityValue.innerHTML = cityInputEl.value + \" today\";\n printForecast(data);\n })\n } else {\n MaterialDialog.alert('Error: ' + response.statusText);\n }\n }).catch(function(error) {\n MaterialDialog.alert('Unable to getForecast: Invalid Connection');\n });\n}", "function getForecastdata() {\n const city = $(\"#city\").val()\n var forecastURL = `https://api.openweathermap.org/data/2.5/forecast?q=${city}&appid=${key}`\n $.ajax({\n url: forecastURL,\n method: \"GET\"\n }).then(function (response) {\n console.log(response)\n\n let day1 = response.list[4]\n let day2 = response.list[12]\n let day3 = response.list[20]\n let day4 = response.list[28]\n let day5 = response.list[36]\n\n const forecastArray = [day1, day2, day3, day4, day5];\n\n let forecastdiv = $('#forecast')\n\n for (let i = 0; i < forecastArray.length; i++) {\n let date = moment().add(1 + i, 'days').format('L')\n let icon = forecastArray[i].weather[0].icon\n console.log(icon)\n let temperature = forecastArray[i].main.temp\n console.log(temperature)\n let humidity = forecastArray[i].main.humidity\n console.log(humidity)\n\n forecastdiv.append(`\n <div class=\"card col forecastCard\">\n <div class=\"card-body\">\n <h5 class=\"card-title\" id=\"forecastDate\"><b>${date}</b></h5>\n <img src=\"http://openweathermap.org/img/wn/${icon}@2x.png\" />\n <p class=\"card-text forecast\" id=\"forecastTemp\"><b>Temperature: </b>${Math.round(parseInt(temperature) - 273.15)}°C</p>\n <p class=\"card-text forecast\" id=\"forecastHumidity\"><b>Humidity: </b>${humidity}%</p>\n </div>\n </div>`)\n }\n });\n}", "function forecastCall(){\n $.ajax({\n url: forecastURL + city + farenheit + apiKey,\n type: \"GET\",\n datatype: \"jsonp\",\n success: function(data){\n console.log(data);\n \n\n $(\".card\").css(\"visibility\",\"visible\");\n //Forecast day 1\n $(\"#date1\").html(\"<h6>\" + data.list[7].dt_txt.slice(5, 10) + \"</h6>\");\n $(\"#icon1\").attr(\"src\", \"http://openweathermap.org/img/w/\" + data.list[7].weather[0].icon + \".png\");\n $(\"#forecast-temperature1\").html(\"<h6>Temp: \" + data.list[7].main.temp + \"</h6>\");\n $(\"#forecast-humidity1\").html(\"<h6>Humidity: \" + data.list[7].main.humidity + \"</h6>\");\n\n //Forecast day 2\n $(\"#date2\").html(\"<h6>\" + data.list[14].dt_txt.slice(5, 10) + \"</h6>\");\n $(\"#icon2\").attr(\"src\", \"http://openweathermap.org/img/w/\" + data.list[14].weather[0].icon + \".png\");\n $(\"#forecast-temperature2\").html(\"<h6>Temp: \" + data.list[14].main.temp + \"</h6>\");\n $(\"#forecast-humidity2\").html(\"<h6>Humidity: \" + data.list[14].main.humidity + \"</h6>\");\n \n //Forecast day 3\n $(\"#date3\").html(\"<h6>\" + data.list[22].dt_txt.slice(5, 10) + \"</h6>\");\n $(\"#icon3\").attr(\"src\", \"http://openweathermap.org/img/w/\" + data.list[22].weather[0].icon + \".png\");\n $(\"#forecast-temperature3\").html(\"<h6>Temp: \" + data.list[22].main.temp + \"</h6>\");\n $(\"#forecast-humidity3\").html(\"<h6>Humidity: \" + data.list[22].main.humidity + \"</h6>\");\n\n //Forecast day 4\n $(\"#date4\").html(\"<h6>\" + data.list[30].dt_txt.slice(5, 10) + \"</h6>\");\n $(\"#icon4\").attr(\"src\", \"http://openweathermap.org/img/w/\" + data.list[30].weather[0].icon + \".png\");\n $(\"#forecast-temperature4\").html(\"<h6>Temp: \" + data.list[30].main.temp + \"</h6>\");\n $(\"#forecast-humidity4\").html(\"<h6>Humidity: \" + data.list[30].main.humidity + \"</h6>\");\n\n //Forecast day 5\n $(\"#date5\").html(\"<h6>\" + data.list[38].dt_txt.slice(5, 10) + \"</h6>\");\n $(\"#icon5\").attr(\"src\", \"http://openweathermap.org/img/w/\" + data.list[38].weather[0].icon + \".png\");\n $(\"#forecast-temperature5\").html(\"<h6>Temp: \" + data.list[38].main.temp + \"</h6>\");\n $(\"#forecast-humidity5\").html(\"<h6>Humidity: \" + data.list[38].main.humidity + \"</h6>\");\n }\n })\n }", "function updateForecast(data) {\n // Get UV index and adds the appropriate class highlight\n var uvIndexReturn = data.current.uvi;\n uvIndex.innerHTML = uvIndexReturn;\n if (uvIndexReturn <= 2) {\n $(uvIndex).attr(\"class\", \"weatherInfo singleLine highlightGreen\");\n }\n else if (2 < uvIndexReturn && uvIndexReturn <= 5) {\n $(uvIndex).attr(\"class\", \"weatherInfo singleLine highlightYellow\");\n }\n else if (5 < uvIndexReturn && uvIndexReturn <= 7) {\n $(uvIndex).attr(\"class\", \"weatherInfo singleLine highlightOrange\");\n }\n else {\n $(uvIndex).attr(\"class\", \"weatherInfo singleLine highlightRed\");\n }\n\n // Clear the forecast panel of previous data\n $(forecastPanel).empty();\n // Update the forecast panel\n for (i = 1; i < 6; i++) {\n // Get the forecast date\n var forecastData = data.daily[i];\n // Calculate the time after the timezone offset\n var timeWithZone = parseInt(forecastData.dt) + parseInt(data.timezone_offset);\n // Parse the Unix into readable time\n var forecastTime = DateTime.fromSeconds(timeWithZone);\n // Append main card container\n $(forecastPanel).append('<section class=\"forecastCard flexCol col-md-2 bordered centered\" id=\"card' + i + '\"></section>');\n // Append the details to the card container\n $(\"#card\" + i).append('<h3 class=\"forecastTitle\">' + forecastTime.month + \"/\" + forecastTime.day + \"/\" + forecastTime.year + '</h3>')\n // Append the weather image\n .append('<img class=\"weatherIcon forecastIcon\" src=\"http://openweathermap.org/img/wn/' + forecastData.weather[0].icon + '.png\" alt=\"' + forecastData.weather[0].description + ' weather icon\"/>')\n // Append the temperature information\n .append('<article class=\"weatherInfo cardTemperature\">Temp: ' + forecastData.temp.day + ' F°</article>')\n // Append the humidity information\n .append('<article class=\"weatherInfo cardHumidity\">Humidity: ' + forecastData.humidity + '%</article>');\n }\n }", "function getForecast() {\n fetch(requestForecastUrl)\n .then(function (response2) {\n return response2.json();\n })\n .then(function (data2) {\n //Create an element to hold weather icon\n var iconCode = data2.daily[0].weather[0].icon;\n var iconUrl =\n \"http://openweathermap.org/img/wn/\" + iconCode + \".png\";\n var icon = document.createElement(\"IMG\");\n icon.setAttribute(\"src\", iconUrl);\n //Retrieve unix timestamp from API\n var todayUnixDate = data2.daily[0].dt;\n //Use moment.js to convert unix timestamp to date\n var todayDate = moment.unix(todayUnixDate).format(\"MM/DD/YYYY\");\n //display city name, date, and weather icon on page\n document.getElementById(\"city\").innerHTML =\n data1.city.name + \" (\" + todayDate + \")\";\n document.getElementById(\"city\").appendChild(icon);\n //display current day temp, humidity, and windspeed\n document.getElementById(\"todayTemp\").innerHTML =\n \"Temperature: \" + data2.daily[0].temp.day + \" &#8457\";\n document.getElementById(\"todayHumidity\").innerHTML =\n \"Humidity: \" + data2.daily[0].humidity + \"%\";\n document.getElementById(\"todayWind\").innerHTML =\n \"Wind Speed: \" + data2.daily[0].wind_speed + \" MPH\";\n var indexUV = data2.daily[0].uvi;\n //display current day UV index and apply different classes depending on severity level of UV index\n document.getElementById(\"todayUV\").innerHTML = \"UV Index: \";\n var badgeSpan = $(\"<span>\");\n badgeSpan.text(indexUV);\n $(\"#todayUV\").append(badgeSpan);\n\n if (indexUV < 3) {\n badgeSpan.addClass(\"btn-success\");\n } else if (indexUV < 6) {\n badgeSpan.addClass(\"btn-warning\");\n } else badgeSpan.addClass(\"btn-danger\");\n\n //Display date for the 5-day forecast using moment.js to convert unix timestamp to calendar date\n var date1 = moment.unix(data2.daily[1].dt).format(\"MM/DD/YYYY\");\n document.getElementById(\"d1\").innerHTML = date1;\n\n var date2 = moment.unix(data2.daily[2].dt).format(\"MM/DD/YYYY\");\n document.getElementById(\"d2\").innerHTML = date2;\n\n var date3 = moment.unix(data2.daily[3].dt).format(\"MM/DD/YYYY\");\n document.getElementById(\"d3\").innerHTML = date3;\n\n var date4 = moment.unix(data2.daily[4].dt).format(\"MM/DD/YYYY\");\n document.getElementById(\"d4\").innerHTML = date4;\n\n var date5 = moment.unix(data2.daily[5].dt).format(\"MM/DD/YYYY\");\n document.getElementById(\"d5\").innerHTML = date5;\n\n //Display icon for the 5-day forecast\n var iconCode1 = data2.daily[1].weather[0].icon;\n var iconUrl1 =\n \"http://openweathermap.org/img/wn/\" + iconCode1 + \".png\";\n var icon1 = document.createElement(\"IMG\");\n icon1.setAttribute(\"src\", iconUrl1);\n document.getElementById(\"i1\").appendChild(icon1);\n\n var iconCode2 = data2.daily[2].weather[0].icon;\n var iconUrl2 =\n \"http://openweathermap.org/img/wn/\" + iconCode2 + \".png\";\n var icon2 = document.createElement(\"IMG\");\n icon2.setAttribute(\"src\", iconUrl2);\n document.getElementById(\"i2\").appendChild(icon2);\n\n var iconCode3 = data2.daily[3].weather[0].icon;\n var iconUrl3 =\n \"http://openweathermap.org/img/wn/\" + iconCode3 + \".png\";\n var icon3 = document.createElement(\"IMG\");\n icon3.setAttribute(\"src\", iconUrl3);\n document.getElementById(\"i3\").appendChild(icon3);\n\n var iconCode4 = data2.daily[4].weather[0].icon;\n var iconUrl4 =\n \"http://openweathermap.org/img/wn/\" + iconCode4 + \".png\";\n var icon4 = document.createElement(\"IMG\");\n icon4.setAttribute(\"src\", iconUrl4);\n document.getElementById(\"i4\").appendChild(icon4);\n\n var iconCode5 = data2.daily[5].weather[0].icon;\n var iconUrl5 =\n \"http://openweathermap.org/img/wn/\" + iconCode5 + \".png\";\n var icon5 = document.createElement(\"IMG\");\n icon5.setAttribute(\"src\", iconUrl5);\n document.getElementById(\"i5\").appendChild(icon5);\n\n //Display temperature for 5-day forecast\n document.getElementById(\"t1\").innerHTML =\n \"Temp: \" + data2.daily[1].temp.day + \" &#8457\";\n\n document.getElementById(\"t2\").innerHTML =\n \"Temp: \" + data2.daily[2].temp.day + \" &#8457\";\n\n document.getElementById(\"t3\").innerHTML =\n \"Temp: \" + data2.daily[3].temp.day + \" &#8457\";\n\n document.getElementById(\"t4\").innerHTML =\n \"Temp: \" + data2.daily[4].temp.day + \" &#8457\";\n\n document.getElementById(\"t5\").innerHTML =\n \"Temp: \" + data2.daily[5].temp.day + \" &#8457\";\n\n //Display humidity for 5-day forecast\n document.getElementById(\"h1\").innerHTML =\n \"Humidity: \" + data2.daily[1].humidity + \"%\";\n\n document.getElementById(\"h2\").innerHTML =\n \"Humidity: \" + data2.daily[2].humidity + \"%\";\n\n document.getElementById(\"h3\").innerHTML =\n \"Humidity: \" + data2.daily[3].humidity + \"%\";\n\n document.getElementById(\"h4\").innerHTML =\n \"Humidity: \" + data2.daily[4].humidity + \"%\";\n\n document.getElementById(\"h5\").innerHTML =\n \"Humidity: \" + data2.daily[5].humidity + \"%\";\n\n //Change display from \"none\" to block upon clicking the search button\n document.getElementById(\"forecastContainer\").style.display =\n \"block\";\n\n //Append search result to search history\n function searchStorage() {\n var newSearch = $(\"<li>\")\n .addClass(\"list-group-item\")\n .text(city.charAt(0).toUpperCase() + city.substr(1));\n\n $(\".list-group\").append(newSearch);\n \n saveSearch.push(newSearch.text());\n localStorage.setItem(\"city\", JSON.stringify(saveSearch));\n }\n searchStorage();\n });\n clearIcon();\n }", "function displayForecast(data) {\n // var forecastCard = document.querySelector(\".forecastcard\");\n\n // //calling the api again so that it is not out of scope.\n // var apiUrl =\n // \"https://api.weatherapi.com/v1/forecast.json?key=4f08ab911fbb4ee7979182843211608&q=\" +\n // search +\n // \"&days=5&aqi=no&alerts=no\";\n\n // //setting up function to fetch again\n // fetch(apiUrl)\n // .then(function (response) {\n // return response.json();\n // })\n // .then(function (data) {\n // console.log(data);\n\n// create HTML elements for the data to fit in\n for (var i = 0; i < 3; i++) {\n //create variables for the date, icons, humidity, temp, and wind\n var forecastDate = document.createElement(\"p\");\n forecastDate.textContent = data.forecast.forecastday[i].date;\n\n var forecastIcon = document.createElement(\"img\");\n // forecastIcon.textContent = data.forecast.forecastday[i].condition.icon;\n forecastIcon.setAttribute (\"src\", \"https:\"+ data.forecast.forecastday[i].day.condition.icon);\n\n var forecastHumid = document.createElement(\"p\");\n forecastHumid.textContent = data.forecast.forecastday[i].day.avgtemp_f;\n\n var forecastTemp = document.createElement(\"p\");\n forecastTemp.textContent = data.forecast.forecastday[i].day.avghumidity;\n\n var forecastWind = document.createElement(\"p\");\n forecastWind.textContent = data.forecast.forecastday[i].day.maxwind_mph;\n\n //create the cards for displaying forecast\n var forecastCard = document.createElement(\"div\");\n forecastCard.setAttribute(\"class\", \"card\", \"m-4\");\n var forecastCardBody = document.createElement(\"div\");\n forecastCardBody.setAttribute(\"class\", \"card\", \"m-4\");\n\n //appending the elements to the card\n forecastCardBody.append(forecastDate, forecastIcon, forecastHumid, forecastTemp, forecastWind);\n forecastCard.append(forecastCardBody);\n\n var fiveDayEl = document.getElementById(\"result-content\");\n fiveDayEl.append(forecastCard);\n\n //add the variables to an object\n // var weatherObj = {\n // date: forecastDate,\n // icon: forecastIcon,\n // humidity: forecastHumid,\n // temperature: forecastTemp,\n // windSpeed: forecastWind,\n // };\n }\n// })\n}", "function forecast(city) {\n // URL for the OWM five-day forecast API\n var forecastURL =\n \"https://api.openweathermap.org/data/2.5/forecast?q=\" +\n city +\n \"&units=imperial&appid=\" +\n APIKey;\n\n // Get the info from the API\n $.ajax({\n url: forecastURL,\n method: \"GET\",\n }).then(function (forecast) {\n // After user enters a city, the temperature and humidity will be shown for the next five days\n // Day 1\n var dayOne = forecast.list[4];\n var dayTitleOne = document.querySelector(\".date-title-one\");\n var dayTempOne = document.querySelector(\".date-temp-one\");\n var dayHumOne = document.querySelector(\".date-hum-one\");\n dayTitleOne.textContent = moment().add(1, \"day\").format(\"l\");\n dayTempOne.textContent = \"Temp: \" + dayOne.main.temp.toFixed(1) + \" °F\";\n dayHumOne.textContent = \"Humidity: \" + dayOne.main.humidity + \"%\";\n // Weather icon for day 1\n var iconOne = forecast.list[4].weather[0].icon;\n var iconOneURL = \"http://openweathermap.org/img/wn/\" + iconOne + \".png\";\n document.querySelector(\".card-icon-one\").src = iconOneURL;\n\n // Day 2\n var dayTwo = forecast.list[12];\n var dayTitleTwo = document.querySelector(\".date-title-two\");\n var dayTempTwo = document.querySelector(\".date-temp-two\");\n var dayHumTwo = document.querySelector(\".date-hum-two\");\n dayTitleTwo.textContent = moment().add(2, \"days\").format(\"l\");\n dayTempTwo.textContent = \"Temp: \" + dayTwo.main.temp.toFixed(1);\n +\" °F\";\n dayHumTwo.textContent = \"Humidity: \" + dayTwo.main.humidity + \"%\";\n // Weather icon for day 2\n var iconTwo = forecast.list[12].weather[0].icon;\n var iconTwoURL = \"http://openweathermap.org/img/wn/\" + iconTwo + \".png\";\n document.querySelector(\".card-icon-two\").src = iconTwoURL;\n\n // Day 3\n var dayThree = forecast.list[20];\n var dayTitleThree = document.querySelector(\".date-title-three\");\n var dayTempThree = document.querySelector(\".date-temp-three\");\n var dayHumThree = document.querySelector(\".date-hum-three\");\n dayTitleThree.textContent = moment().add(3, \"days\").format(\"l\");\n dayTempThree.textContent =\n \"Temp: \" + dayThree.main.temp.toFixed(1 + \" °F\");\n dayHumThree.textContent = \"Humidity: \" + dayThree.main.humidity + \"%\";\n // Weather icon for day 3\n var iconThree = forecast.list[20].weather[0].icon;\n var iconThreeURL =\n \"http://openweathermap.org/img/wn/\" + iconThree + \".png\";\n document.querySelector(\".card-icon-three\").src = iconThreeURL;\n\n // Day 4\n var dayFour = forecast.list[28];\n var dayTitleFour = document.querySelector(\".date-title-four\");\n var dayTempFour = document.querySelector(\".date-temp-four\");\n var dayHumFour = document.querySelector(\".date-hum-four\");\n dayTitleFour.textContent = moment().add(4, \"days\").format(\"l\");\n dayTempFour.textContent = \"Temp: \" + dayFour.main.temp.toFixed(1) + \" °F\";\n dayHumFour.textContent = \"Humidity: \" + dayFour.main.humidity + \"%\";\n // Weather icon for day 4\n var iconFour = forecast.list[28].weather[0].icon;\n var iconFourURL = \"http://openweathermap.org/img/wn/\" + iconFour + \".png\";\n document.querySelector(\".card-icon-four\").src = iconFourURL;\n\n // Day 5\n var dayFive = forecast.list[36];\n var dayTitleFive = document.querySelector(\".date-title-five\");\n var dayTempFive = document.querySelector(\".date-temp-five\");\n var dayHumFive = document.querySelector(\".date-hum-five\");\n dayTitleFive.textContent = moment().add(5, \"days\").format(\"l\");\n dayTempFive.textContent = \"Temp: \" + dayFive.main.temp.toFixed(1) + \" °F\";\n dayHumFive.textContent = \"Humidity: \" + dayFive.main.humidity + \"%\";\n // Weather icon for day 5\n var iconFive = forecast.list[36].weather[0].icon;\n var iconFiveURL = \"http://openweathermap.org/img/wn/\" + iconFive + \".png\";\n document.querySelector(\".card-icon-five\").src = iconFiveURL;\n });\n }", "function getForecast(city) {\n\n // city = \"Kansas City\"\n var queryURL = \"https://api.openweathermap.org/data/2.5/weather?q=\" + city + \"&units=imperial&appid=\" + APIKey;\n var forecastURL = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + city + \"&units=imperial&appid=\" + APIKey;\n\n $.ajax({\n url: forecastURL,\n method: \"GET\"\n }).then(function (response) {\n console.log(response)\n\n var header = $(\"<h4>\").attr(\"class\", \"card-header p-2 mt-4 shadow\").text(\"5-Day Forecast:\")\n\n $(\"#five\").prepend(header)\n\n // Five day forecast\n\n $.each(response.list, function (i, day) {\n\n\n var time = moment(day.dt_txt).hour()\n\n console.log(i, day.dt_txt, time)\n if (time == 15) {\n var card = $(\"<div>\").attr(\"class\", \"card text-white bg-primary m-2 shadow\")\n\n var date = $(\"<div>\").text(moment(day.dt_txt).format(\"ddd, Do\")).attr(\"class\", \"card-header\")\n var body = $(\"<div>\").attr(\"class\", \"card-body\")\n var img = $(\"<img>\").attr(\"src\", \"http://openweathermap.org/img/wn/\" + day.weather[0].icon + \"@2x.png\")\n // c.append(img)\n var temp = $(\"<div>\").text(\"Temp: \" + day.main.temp + \" F\").attr(\"class\", \"card-text \")\n var hum = $(\"<div>\").text(\"Humidity: \" + day.main.humidity + \"%\").attr(\"class\", \"card-text \")\n\n body.append(img, temp, hum)\n card.append(date, body)\n $(\"#foreCast\").append(card)\n\n\n }\n\n\n })\n\n\n\n })\n\n\n }", "function forecast(location, cityName) {\r\n\r\n let api2 = `https://api.openweathermap.org/data/2.5/${location}&appid=e520e248b2ce5d233b45cf74840ed29c&units=metric`;\r\n fetch(api2).then(function (response) {\r\n\r\n let data2 = response.json();\r\n return data2;\r\n })\r\n .then(function (data2) {\r\n let days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\r\n let k = data2.list.length;\r\n $('.location-header').html(`Forecast 5day / every 3 hours for: ${cityName}`);\r\n $('.weather-container').html('');\r\n for (let i = 0; i < k; i++) {\r\n let currentDay,prevDay;\r\n let currentData = data2.list[i].dt_txt;\r\n let newData = new Date(currentData);\r\n let currentMonthDay = newData.getDate();\r\n let dayName = days[newData.getDay()];\r\n let hours = newData.getHours();\r\n let minutes = newData.getMinutes()+\"0\";\r\n let currentMonth = newData.getMonth() + 1;\r\n\r\n\r\n let info = data2.list[i].weather[0].main;\r\n let idIcon = data2.list[i].weather[0].icon;\r\n let temp = Math.round(data2.list[i].main.temp);\r\n\r\n\r\n \r\n if (i == 0) {\r\n currentDay = new Date(data2.list[i].dt_txt).getDay()\r\n prevDay = new Date(data2.list[i].dt_txt).getDay()\r\n } else {\r\n currentDay = new Date(data2.list[i].dt_txt).getDay()\r\n prevDay = new Date(data2.list[i - 1].dt_txt).getDay()\r\n }\r\n\r\n if (i == 0) {\r\n $('.week-list').html(`\r\n <div class='col-2 py-3 day-wrapper' data-name='${dayName}'>${dayName}</div>`);\r\n $('.weather-container').append(\r\n `<div id=\"${currentDay}\" data-day='${dayName}' class=\"forecast-row row\">\r\n <h4 class=\"col-12\">${dayName}</h4> \r\n <h5 class=\"col-12\">${currentMonthDay}.${currentMonth}</h5>\r\n <div class=\"hour-wrapper col-3\">\r\n <div class=\"hour-background\">\r\n <p class=\"lead-hour\">${hours}:${minutes}</p>\r\n <img src='images/icons/${idIcon}.png' alt=\"#\">\r\n <p>${info}</p>\r\n <p class=\"temp\">${temp} &deg;C</p>\r\n \r\n </div>\r\n </div>\r\n </div>`\r\n )\r\n } else if (currentDay == prevDay) {\r\n\r\n $(`div[id=${currentDay}]`).append(\r\n ` <div class=\"hour-wrapper col-3\">\r\n <div class=\"hour-background\">\r\n <p class=\"lead-hour\">${hours}:${minutes}</p>\r\n <img src='images/icons/${idIcon}.png' alt=\"#\">\r\n <p>${info}</p>\r\n <p class=\"temp\">${temp} &deg;C</p>\r\n \r\n </div>\r\n </div>`\r\n )\r\n } else {\r\n $('.week-list').append(`\r\n <div class='col-2 py-3 day-wrapper' data-name='${dayName}'>${dayName}</div>`);\r\n $('.weather-container').append(\r\n `<div id=\"${currentDay}\" data-day='${dayName}' class=\"forecast-row row hide\"> \r\n <h4 class=\"col-12\">${dayName}</h4> \r\n <h5 class=\"col-12\">${currentMonthDay}.${currentMonth}</h5>\r\n <div class=\"hour-wrapper col-3\">\r\n <div class=\"hour-background\">\r\n <p class=\"lead-hour\">${hours}:${minutes}</p>\r\n <img src='images/icons/${idIcon}.png' alt=\"#\">\r\n <p>${info}</p>\r\n <p class=\"temp\">${temp} &deg;C</p>\r\n \r\n </div>\r\n </div>\r\n </div>`\r\n )\r\n }\r\n }\r\n })\r\n}", "function updateWeatherSummaries()\n {\n var locationsArray = loadLocations();\n\n // Get todays date and convert to version usable by forecast API.\n var date = new Date();\n var todayForecastData = date.forecastDateString();\n\n // Must call for each Location in the index list.\n for (var i = 0; i < locationsArray.length; i++)\n {\n // Requests the current daily forecast for a location.\n locationCacheInstance.getWeatherAtIndexForDate(i, todayForecastData, \"locationCacheInstance.weatherResponse\");\n }\n}", "function getWeather() {\n\n // Name of city to retrieve data for\n const city = $(\"#city\").val()\n\n // connecting through https and updating on UI\n var weatherURL = `https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${key}`\n $.ajax({\n url: weatherURL,\n method: \"GET\"\n }).then(function (response) {\n\n // remove previous data to replace with new city search data\n $(\"#cityDate\").empty();\n $(\"#temperature\").empty();\n $(\"#humidity\").empty();\n $(\"#windSpeed\").empty();\n $(\"#uvIndex\").empty();\n $(\"#forecast\").empty();\n\n //save data of cities already searched \n saveData(city)\n\n // Putting todays date next to the city that was searched for in the data title and making it simple to read\n let todaysDate = new Date().toLocaleDateString()\n $('#cityDate').append(`${city.toUpperCase()} (${todaysDate})`)\n\n longitude = response.coord.lon;\n latitude = response.coord.lat;\n \n getUV()\n\n getForecastdata()\n\n // Appends Data from First API Call to main card\n\n let temperaturediv = $('#temperature')\n temperaturediv.append(`<b>Temperature: </b>${Math.round(parseInt(response.main.temp) - 273.15)} ° Celcius`)\n\n let humiditydiv = $('#humidity')\n humiditydiv.append(`<b>Humidity: </b>${response.main.humidity}%`)\n\n let windSpeeddiv = $('#windSpeed')\n windSpeeddiv.append(`<b>Wind Speed: </b>${response.wind.speed} meters/sec`)\n });\n}", "function Forecast() {\n var five_day_forecast = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + city + \",us&APPID=\" + appID;\n \n var day_counter = 1;\n \n $.ajax({\n url: five_day_forecast,\n method: \"GET\"\n }).then(function (response) {\n \n // display forecast data from API\n for (var i = 0; i < response.list.length; i++) {\n var date_and_time = response.list[i].dt_txt;\n var date = date_and_time.split(\" \")[0];\n var time = date_and_time.split(\" \")[1];\n if (time === \"15:00:00\") {\n var year = date.split(\"-\")[0];\n var month = date.split(\"-\")[1];\n var day = date.split(\"-\")[2];\n $(\"#day-\" + day_counter).children(\".card-date\").text(month + \"/\" + day + \"/\" + year);\n $(\"#day-\" + day_counter).children(\".weather-icon\").attr(\"src\", \"https://api.openweathermap.org/img/w/\" + response.list[i].weather[0].icon + \".png\");\n $(\"#day-\" + day_counter).children(\".weather-temp\").text(\"Temp: \" + ((response.list[i].main.temp - 273.15) * (9 / 5) + 32).toFixed(0) + \"°F\");\n $(\"#day-\" + day_counter).children(\".weather-humidity\").text(\"Humidity: \" + response.list[i].main.humidity + \"%\");\n day_counter++;\n }\n }\n });\n }", "function geteCountryForecast() {\n var countriesWithoutForecast = vm.countries.filter(function (item) { return !item.forecast; });\n countriesWithoutForecast.forEach(function (country) {\n weatherService.getForecastForCountry(country.id).then(function (response) {\n country.forecast = response.data; //adding a forecast\n });\n });\n }", "function getFiveDayForecastData(cityName) {\n\n var requestOptions = {\n method: 'GET',\n redirect: 'follow'\n };\n \n fetch('https://api.openweathermap.org/data/2.5/onecall?lat=' + latCoordinates + '&lon=' + lonCoordinates + '&exclude=minutely,hourly,alerts&units=imperial&appid=519f87e1804e397b8b29deaf887fdfc3', requestOptions)\n .then(response => response.json())\n //.then(result => console.log(result))\n // .catch(error => console.log('error', error)\n \n\n .then(function (forecastData) {\n console.log(forecastData);\n \n \n for (i = 1; i < 6; i++) {\n\n var forecastDate = $(\"#forecast-block-\" + [i]).children(\".forecast-date\")\n var forecastDateData = convertDate(forecastData.daily[i].dt);\n console.log('forecastData', forecastData)\n forecastDate.text(forecastDateData);\n \n // var date = new Date(forecastDateData * 1000);\n // var year = date.getFullYear();\n // var month = date.getMonth() +1;\n // var day = date.getDate();\n // var convertedForecastDate = month + \"/\" + day + \"/\" + year;\n // forecastDate.append(convertedforecastDate);\n //};\n \n \n var forecastTemp = $(\"#forecast-block-\" + [i]).children(\".temperature\");\n var forecastTempData = forecastData.daily[i].temp.day;\n forecastTemp.html(\"Temp: \" + forecastTempData + \" F\");\n // forecastTemp.text();\n\n var forecastHumidity = $(\"#forecast-block-\" + [i]).children(\".humidity\");\n var forecastHumidityData = forecastData.daily[i].humidity;\n forecastHumidity.text(\"Humidity: \" + forecastHumidityData + \" %\")\n // forecastHumidity.(forecastHumidityData + \" %\");\n\n var forecastIcon = $(\"#forecast-block-\" + [i]).children(\".forecast-icon\");\n var forecastIconData = forecastData.daily[i].weather[0].icon;\n var forecastIconUrl = 'http://openweathermap.org/img/wn/' + forecastIconData + '@2x.png';\n forecastIcon.attr(\"src\", forecastIconUrl);\n\n // -present a color that indicates: \n //- conditions are favorable, moderate, or severe\n var searchedUvi = forecastData.current.uvi\n currentUvi.text('UV Index: ' + searchedUvi)\n\n var forecastUvi = $(\"#forecast-block-\" + [i]).children(\".uvi\");\n var forecastUviData = forecastData.daily[i].uvi\n\n forecastUvi.text('UV Index: ' + forecastUviData)\n if (searchedUvi >3 && searchedUvi <7) {\n currentUvi.addClass('yellow');\n } else if (searchedUvi <=3) {\n currentUvi.addClass('green').removeClass(\"yellow red\");\n } else if (searchedUvi >=7) {\n currentUvi.addClass(\"red\").removeClass(\"green yellow\");\n };\n //currentUvi.append(searchedUvi);\n };\n\n });\n}", "function forecast(searchValue) {\n $.ajax({\n type: \"GET\",\n url: `https://api.openweathermap.org/data/2.5/forecast?q=${searchValue}&appid=2de0fec5877aa50b7c3056e0dbdac3aa&units=imperial`,\n dataType: \"JSON\",\n }).then(function (data) {\n console.log(data)\n \n for (var i = 4; i < data.list.length; i += 8) {\n var setDate = data.list[i].dt_txt;\n setDate = setDate.split(\"-\");\n var month = setDate[1];\n var day = setDate[2].slice(0, 2);\n var year = setDate[0];\n var humid = $(\"<p>\").addClass(\"card-text\").text(\"Humidity: \" + data.main.humidity);\n var temp = $(\"<p>\").addClass(\"card-text\").text(\"Temperature: \" + data.main.temp);\n var icon = (`<img src=\"http://openweathermap.org/img/w/${data.weather[0].icon}.png\">`)\n var title = $(\"<h5>\").addClass(\"card-title\").text(`Date: ${month} /${day} / ${year}`);\n var card = $(\"<div>\").addClass(\"card\");\n var wind = $(\"<p>\").addClass(\"card-text\").text(\"Wind speed: \" + data.wind.speed);\n var cardBody = $(\"<div\").addClass(\"card-body\");\n cardBody.append(title, icon, temp, humid, wind)\n card.append(cardBody);\n $(\"#today\").append(card);\n }\n })\n }", "function getFiveDayForecast() {\n\n /*Fetch the data*/\n fetch(`http://api.openweathermap.org/geo/1.0/direct?q=${userInput}&appid=` + apiKey)\n .then(response => {return response.json()})\n .then(data => {\n console.log(data); \n fetch(`https://api.openweathermap.org/data/2.5/onecall?&lat=${data[0].lat}&lon=${data[0].lon}&exclude=current,minutely,hourly&appid=` + apiKey)\n .then(response => { return response.json() })\n .then(dataB => {\n console.log(dataB);\n displayFiveDayForecast(data, dataB);\n })\n .catch(error => console.log(error))\n })\n .catch(error => console.log(error))\n\n /*Loop thru and display all 5 cards*/\n for(let i = 0; i < fiveDayCard.length; i++) {\n fiveDayCard[i].style.display = 'block';\n }\n\n /*Switch from current weather to forecast screen*/\n card.style.display = 'none';\n h1.innerHTML = '5 Day Forecast';\n form.style.display = 'none';\n\n //Cards animation\n $(document).ready(() => {\n $(\".five-day-card\").hide().fadeIn(1500);\n $(\"#backBtn\").fadeIn(1500);\n });\n}", "fetchCurrentWeather() {\n\t\tthis.fetchData(this.getUrl())\n\t\t\t.then(data => {\n\t\t\t\tif (!data) {\n\t\t\t\t\t// Did not receive usable new data.\n\t\t\t\t\t// Maybe this needs a better check?\n\t\t\t\t\tLog.error('No data');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.setFetchedLocation(`${data.liveweer[0].plaats}, Netherlands`);\n\t\t\t\tconst currentWeather = this.generateWeatherObjectFromCurrentWeather(data.liveweer[0]);\n\t\t\t\tthis.setCurrentWeather(currentWeather);\n\t\t\t})\n\t\t\t.catch(function(request) {\n\t\t\t\tLog.error(\"Could not load data ... \", request);\n\t\t\t})\n\t\t\t.finally(() => this.updateAvailable())\n\t}", "function getForecast(cityValue) {\n var queryURL =\n \"https://api.openweathermap.org/data/2.5/forecast?q=\" +\n cityValue +\n \"&units=\" +\n units +\n \"&appid=\" +\n apikey;\n\n //Define Ajax call\n $.ajax({\n url: queryURL,\n type: \"GET\",\n dataType: \"json\",\n }).then(function (response) {\n // Replace any existing content with title and empty row\n $(\"#forecast\")\n .html('<h4 class=\"mt-3\">5-Day Forecast:</h4>')\n .append('<div class=\"row\">');\n\n // loop over all forecasts\n for (var i = 0; i < response.list.length; i++) {\n // only look at forecasts around 3:00pm\n if (response.list[i].dt_txt.indexOf(\"15:00:00\") !== -1) {\n // create html elements for a bootstrap card\n var col = $(\"<div>\").addClass(\"col-md-2\");\n var card = $(\"<div>\").addClass(\"card bg-primary text-white\");\n var body = $(\"<div>\").addClass(\"card-body p-2\");\n\n //Added in a fix to date format for Safari browsers since the return date format is not supported\n //Needed to replace the dash \"-\" with the forward \"/\" slash\n tempDate = new Date(\n response.list[i].dt_txt.replace(/-/g, \"/\")\n ).toLocaleDateString();\n\n var title = $(\"<h5>\").addClass(\"card-title\").text(tempDate);\n\n var img = $(\"<img>\").attr(\n \"src\",\n \"https://openweathermap.org/img/w/\" +\n response.list[i].weather[0].icon +\n \".png\"\n );\n\n var p1 = $(\"<p>\")\n .addClass(\"card-text\")\n .text(\"Temp: \" + response.list[i].main.temp_max + \" °F\");\n var p2 = $(\"<p>\")\n .addClass(\"card-text\")\n .text(\"Humidity: \" + response.list[i].main.humidity + \"%\");\n\n // merge together and put on page\n col.append(card.append(body.append(title, img, p1, p2)));\n $(\"#forecast .row\").append(col);\n }\n }\n });\n }", "function _updateData() {\n return _getWeather()\n .then(function (weather) {\n let temp = weather.main.temp - 273,\n weatherStatus = weather.weather[0].main,\n windSpeed = weather.wind.speed;\n _renderData(localLat,localLon,temp,weatherStatus,windSpeed);\n }, function () {\n console.error(\"Что-то пошло не так!!!\");\n });\n }", "function fiveDayForecast(fcLat, fcLon, fcCity) {\n\n var queryURL = `https://api.openweathermap.org/data/2.5/onecall?lat=${fcLat}&lon=${fcLon}&exclude=hourly,minutely&appid=${APIKey}`;\n \n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).then(function(response) {\n console.log(response);\n // Populate the forecast cards\n for (let i = 1; i < 6; i++) {\n\n // Dates\n let date = $(`#date-${i}`);\n date.text( dayjs.unix(response.current.dt).add(i, 'day').format('MM/DD/YYYY') );\n\n // Icons\n let fcIcon = $(`#fc-icon-${i}`);\n fcIcon.attr(\"src\", \"https://openweathermap.org/img/w/\" + response.daily[i].weather[0].icon + \".png\");\n\n // Temperature\n let fcTemp = $(`#fc-temp-${i}`);\n var fcFahrenheit = ((response.daily[i].temp.day - 273.15) * 9/5 + 32).toFixed(2);\n fcTemp.text(`Temp: ${ fcFahrenheit } °F`);\n\n // Humidity\n let fcHumidity = $(`#fc-humidity-${i}`);\n fcHumidity.text(`Humidity: ${ response.daily[i].humidity }%`);\n } \n }); \n}", "function getForecast(cityName) {\n\n var city = cityName;\n var queryUrl = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + city + \"&appid=\" + APIKey\n\n $.ajax({\n url: queryUrl,\n method: \"GET\"\n }).then(function (response) {\n\n var lat = response.city.coord[\"lat\"];\n var lon = response.city.coord[\"lon\"];\n var cityDetail = response;\n var cityTitle = cityDetail.city.name;\n\n // Setting Date\n var d = new Date();\n var month = d.getMonth() + 1;\n var day = d.getDate();\n var year = d.getFullYear()\n var date = \"(\" + (day < 10 ? '0' : '') + day + '/' +\n (month < 10 ? '0' : '') + month + '/' + year + \")\";\n\n // Displaying from first API\n $(\".cityName\").text(cityTitle + \" - \" + date)\n\n // Using latitude and Longitude from previous API to get complete data from next API\n var queryUrl = \"https://api.openweathermap.org/data/2.5/onecall?lat=\" + lat + \"&lon=\" + lon + \"&units=imperial&exclude=hourly,minutely,alert&appid=510c7f3ff27ad1727021b6aa3db8d1b0\"\n\n $.ajax({\n url: queryUrl,\n method: \"GET\"\n }).then(function (response) {\n console.log(response);\n // Update Current Data\n var temp = Math.round(response.current.temp) + \"°\"\n var humidity = response.current.humidity + \"%\"\n var windspeed = response.current.wind_speed + \"MPH\"\n var uvIndex = response.current.uvi\n var iconCode = response.current.weather[0].icon;\n var iconUrl = \"http://openweathermap.org/img/wn/\" + iconCode + \"@2x.png\";\n\n $(\".headIcon\").attr(\"src\", iconUrl);\n $(\".temp\").text(\"Temperature: \" + temp);\n $(\".humid\").text(\"Humdity: \" + humidity);\n $(\".windspeed\").text(\"Wind Speed: \" + windspeed)\n $(\".UVi\").text(\"UV Index: \" + uvIndex);\n\n\n\n // Changing the UV Index's Color\n var UVtest = parseFloat(JSON.stringify(uvIndex))\n\n if (UVtest < 3) {\n $(\".UVi\").addClass(\"badge-success\")\n }\n if (UVtest > 3) {\n $(\".UVi\").addClass(\"badge-warning\")\n }\n if (UVtest >= 8) {\n $(\".UVi\").addClass(\"badge-danger\")\n }\n\n //For Loop for filling out cards\n for (i = 1; i < 6; i++) {\n $(\".card-title\").each(function () {\n var index = parseInt($(this).attr('id'))\n if (i == index) {\n var d = new Date(response.daily[i].dt * 1000)\n var month = d.getMonth() + 1;\n var day = d.getDate();\n var year = d.getFullYear()\n var date = \"(\" + (day < 10 ? '0' : '') + day + '/' +\n (month < 10 ? '0' : '') + month + '/' + year + \")\";\n $(this).text(date)\n }\n $(\".forecastTemp\").each(function () {\n var index = parseInt($(this).attr('id'))\n if (i == index) {\n var forecastTemp = \"Temperature: \" + Math.round(response.daily[i].temp.day) + \"°\"\n $(this).text(forecastTemp)\n }\n })\n $(\".forecastHumid\").each(function () {\n var index = parseInt($(this).attr('id'))\n if (i == index) {\n var forecastHumid = \"Humidity: \" + response.daily[i].humidity + \"%\";\n $(this).text(forecastHumid);\n }\n })\n $(\".icon\").each(function () {\n var index = parseInt($(this).attr('id'))\n if (i == index) {\n var iconCode = response.daily[i].weather[0].icon;\n var iconUrl = \"http://openweathermap.org/img/wn/\" + iconCode + \"@2x.png\";\n $(this).attr(\"src\", iconUrl);\n }\n })\n\n });\n\n }\n\n });\n });\n}", "function getFiveDayAPI(city){\n var weatherFiveDayAPI = 'https://api.openweathermap.org/data/2.5/forecast?q=' + city + '&units=imperial&appid=6b0d5c546226a11c17010c1077322954';\n \n fetch(weatherFiveDayAPI)\n .then(function(response){\n return response.json();\n \n })\n .then((data) => {\n var results = data.list;\n console.log(results);\n\n //5-day card variables \n var fiveDayCards = document.querySelectorAll(\".five-card\");\n\n var cardIndex = 0;\n //adding dates to each of the cards from today's day onwards \n for (i = 0; i < results.length; i+= 8){\n var currentCard = fiveDayCards[cardIndex];\n //Set the date\n var currentDayDate = currentCard.querySelector(\".date-five\");\n currentDayDate.innerText = moment(`${data.list[i].dt_txt}`).format(\"MMM Do YY\");\n // currentDayDate.innerText = m.add(1, 'day').format(\"l\");\n //Set the icon\n var currentDayIcon = currentCard.querySelector(\".five-icon\");\n var weatherIcon = data.list[i].weather[0].icon;\n currentDayIcon.setAttribute(\"src\", \"http://openweathermap.org/img/wn/\" + weatherIcon + \".png\")\n //Set the Temp \n var currentDayTemp = currentCard.querySelector(\".temp-five\");\n currentDayTemp.innerText = 'Temp: ' + data.list[i].main.temp + ' °F';\n //Set the humidity\n var currentDayHumidity = currentCard.querySelector(\".humid-five\");\n currentDayHumidity.innerText = 'Humidity: ' + data.list[i].main.humidity + '%';\n cardIndex++;\n }\n \n })\n .catch((error) => {\n console.log('Error:', error);\n });\n}", "function fiveDayForecast(city) {\n var queryUrl5day =\n \"http://api.openweathermap.org/data/2.5/forecast?q=\" +\n city +\n \"&units=imperial&appid=\" +\n apiKey;\n $.ajax({\n url: queryUrl5day,\n method: \"GET\"\n }).then(function(response) {\n //console.log(response);\n updateCards(response.list);\n });\n }", "async function getAllWeatherData() {\n let weatherData = await getLocationWeather(\n `https://api.openweathermap.org/data/2.5/weather?q=${input}&APPID=${API}`\n );\n\n try {\n // Extract data needed for fetching forecast data.\n let testLat = weatherData.coord.lat;\n let testLon = weatherData.coord.lon;\n\n let response = await fetch(\n `https://api.openweathermap.org/data/2.5/onecall?lat=${testLat}&lon=${testLon}&exclude=minutely,hourly&appid=${API}`\n );\n let forecastData = await response.json();\n\n handleForecastState(forecastData);\n } catch {\n alert('Getting forecast failed.');\n }\n }", "function searchForecast() {\n\t$.ajax({\n\t\turl:\n\t\t\t\"https://api.openweathermap.org/data/2.5/forecast?q=\" +\n\t\t\tcity +\n\t\t\t\"&units=imperial\" +\n\t\t\tkey,\n\t\tmethod: \"GET\",\n\t}).then(function (data) {\n\t\tconsole.log(data.list);\n\n\t\tvar date = new Date();\n\n\t\t$(\"#forecast\").empty();\n\n\t\tfor (var i = 0; i < data.list.length; i++) {\n\t\t\tif (data.list[i].dt_txt.indexOf(\"12:00:00\") !== -1) {\n\t\t\t\tvar card = $(\"<div>\").addClass(\"card col-md-2 ml-4 bg-dark text-white\");\n\t\t\t\tvar cardBody = $(\"<div>\").addClass(\"card-body p-3 forecastBody\");\n\t\t\t\tvar cityDate = $(\"<h4>\")\n\t\t\t\t\t.addClass(\"card-title\")\n\t\t\t\t\t.text(moment(data.list[i].dt, \"X\").format(\"MMM Do\"));\n\t\t\t\tvar temp = $(\"<p>\")\n\t\t\t\t\t.addClass(\"card-text forecastTemp\")\n\t\t\t\t\t.text(\"Temp: \" + data.list[i].main.temp + \"°F \");\n\t\t\t\tvar humidity = $(\"<p>\")\n\t\t\t\t\t.addClass(\"card-text forecastHumidity\")\n\t\t\t\t\t.text(\"Humidity: \" + data.list[i].main.humidity + \"%\");\n\t\t\t\tvar image = $(\"<img>\").attr(\n\t\t\t\t\t\"src\",\n\t\t\t\t\t\"https://openweathermap.org/img/w/\" +\n\t\t\t\t\t\tdata.list[i].weather[0].icon +\n\t\t\t\t\t\t\".png\",\n\t\t\t\t);\n\n\t\t\t\tcardBody.append(cityDate, image, temp, humidity);\n\t\t\t\tcard.append(cardBody);\n\t\t\t\t$(\"#forecast\").append(card);\n\t\t\t}\n\t\t}\n\t});\n}", "function fiveForecast(cityName) {\n var queryURL =\n \"https://api.openweathermap.org/data/2.5/forecast?q=\" +cityName +\"&appid=\" +apiKey +\"&units=imperial\";\n $.ajax({\n url: queryURL,\n method: \"GET\",\n }).then(function (response) {\n $(\"#fiveDay\").empty();\n var forecast = $(\"#forecast\");\n forecast.empty();\n var forecastInfo = $(\"<h3>\").text(\"5-Day Forecast\").attr(\"class\", \"m-3\");\n $(\"#fiveDay\").append(forecastInfo);\n \n\n for (i = 6; i < response.list.length; i += 8) {\n //variables for data to display on 5-day forecast weather cards\n var forecastDate = moment(response.list[i].dt_txt).format(\"MM/DD/YYYY\");\n var forecastWeatherIcon = response.list[i].weather.icon;\n var forecastTemp = response.list[i].main.temp;\n var forecastHumidity = response.list[i].main.humidity;\n \n //Create HTML elements for forecast weather\n var forecastCol = $(\"<div>\").attr(\"class\", \"col-md-2\");\n var forecastCard = $(\"<div>\").addClass(\"card bg-primary\");\n var forecastCardTitle = $(\"<h5>\").addClass(\"card-title text-white ml-3 mt-2\").text(forecastDate);\n var forecastCardData = $(\"<div>\").addClass(\"card-text text-white ml-3\").attr(\"id\", \"forecastData\");\n \n \n var forecastWeatherIcon = $(\"<img>\").attr(\"src\",\"http://openweathermap.org/img/w/\" + response.list[i].weather[0].icon +\".png\");\n var forecastTemp = $(\"<p>\").text(\"Temp: \" + forecastTemp + \" °F\");\n var forecastHumidity = $(\"<p>\").text(\"Humidity: \" + forecastHumidity + \"%\");\n \n //Append forecast weather values\n\n forecast.append(forecastCol);\n forecastCol.append(forecastCard);\n forecastCard.append(forecastCardTitle, forecastCardData);\n forecastCardData.append(forecastWeatherIcon,forecastTemp,forecastHumidity);\n }\n });\n }", "function display5DayForecast(response) {\n\n // console.log(response);\n\n // data is every 3 hours, so pulling each 8th element gets every 24 hours\n for(let i = 0; i < 40; i += 8){\n console.log(response.list[i]);\n let day = response.list[i].dt_txt;\n\n let yr = day.substring(0, 4);\n daymonth = day.substring(5,10);\n day = daymonth + \"-\" + yr;\n day = day.replace(/-/g, \"/\");\n\n // construct class string for specific card title\n let j = (i / 8) + 1;\n let cardTitle = \".ct\" + j;\n let cardName = \".card\" + j;\n $(cardTitle).text(day);\n\n\n let temp = response.list[i].main.temp;\n temp = temp.toFixed(0);\n let humidity = response.list[i].main.humidity;\n let wind = response.list[i].wind.speed;\n\n let newTempP = $(\"<p>\");\n newTempP.text(\"Temp: \" + temp + \"°F\");\n \n let newHumidityP = $(\"<p>\");\n newHumidityP.text(\"Humidity: \" + humidity + \"%\");\n \n // create the img for the weather icon and give it the source for the correct icon\n let newIcon = $(\"<img>\");\n let icon = response.list[i].weather[0].icon;\n let iconURL = \"http://openweathermap.org/img/wn/\" + icon + \".png\";\n console.log(icon);\n newIcon.attr(\"src\", iconURL);\n\n\n // append data to appropriate card\n $(cardName).empty();\n $(cardName).append(newIcon); \n $(cardName).append(newTempP);\n $(cardName).append(newHumidityP);\n\n }\n \n\n}", "function getForecast(searchValue) {\n // perform an AJAX call to get the information from the API\n $.ajax({\n type: \"GET\",\n url: \"https://api.openweathermap.org/data/2.5/forecast?q=\" + searchValue + \"&appid=600327cb1a9160fea2ab005509d1dc6d&units=imperial\",\n // return the data in json format\n dataType: \"json\",\n // if the function is successful,\n success: function(data) {\n console.log(data);\n // overwrite any existing content with title and empty row\n $(\"#forecast\").html(\"<h4 class=\\\"mt-3\\\">5-Day Forecast:</h4>\").append(\"<div class=\\\"row\\\">\");\n \n // loop over all forecasts (by 3-hour increments)\n for (var i = 0; i < data.list.length; i++) {\n // find 3:00 pm data and bring data for that time only to show in the 5 day forecast\n if (data.list[i].dt_txt.indexOf(\"15:00:00\") !== -1) {\n // create html elements for a bootstrap card and add the names of the classes\n var col = $(\"<div>\").addClass(\"col-md-2\");\n var card = $(\"<div>\").addClass(\"card bg-primary text-white\");\n var body = $(\"<div>\").addClass(\"card-body p-2\");\n \n // create a variable called title via jquery, add in a class called card-title and add in the text by converting it to a string\n var title = $(\"<h5>\").addClass(\"card-title\").text(new Date(data.list[i].dt_txt).toLocaleDateString());\n // create an image variable that will pick up the icon off the API call by concatanating the information\n var img = $(\"<img>\").attr(\"src\", \"https://openweathermap.org/img/w/\" + data.list[i].weather[0].icon + \".png\");\n \n // creating new variables, adding classes, giving it text with the data points\n var p1 = $(\"<p>\").addClass(\"card-text\").text(\"Temp: \" + data.list[i].main.temp_max + \" °F\");\n var p2 = $(\"<p>\").addClass(\"card-text\").text(\"Humidity: \" + data.list[i].main.humidity + \"%\");\n \n // merge together and render to the page\n col.append(card.append(body.append(title, img, p1, p2)));\n $(\"#forecast .row\").append(col);\n }\n }\n }\n });\n }", "function getWeather(){\r\n let api = `http://api.openweathermap.org/data/2.5/forecast?q=hanoi&appid=${key}`;\r\n\r\n fetch(api)\r\n .then(function(response){\r\n let data = response.json();\r\n return data;\r\n })\r\n .then(function(data){\r\n weather.temperature.value[0] = Math.floor(data.list[6].main.temp - KELVIN);\r\n weather.temperature.value[1] = Math.floor(data.list[12].main.temp - KELVIN);\r\n weather.temperature.value[2] = Math.floor(data.list[18].main.temp - KELVIN);\r\n weather.temperature.value[3] = Math.floor(data.list[24].main.temp - KELVIN);\r\n weather.temperature.value[4] = Math.floor(data.list[30].main.temp - KELVIN);\r\n\r\n weather.description[0] = data.list[6].weather[0].description;\r\n weather.description[1] = data.list[12].weather[0].description;\r\n weather.description[2] = data.list[18].weather[0].description;\r\n weather.description[3] = data.list[24].weather[0].description;\r\n weather.description[4] = data.list[30].weather[0].description;\r\n\r\n weather.iconId[0] = data.list[6].weather[0].icon;\r\n weather.iconId[1] = data.list[12].weather[0].icon;\r\n weather.iconId[2] = data.list[18].weather[0].icon;\r\n weather.iconId[3] = data.list[24].weather[0].icon;\r\n weather.iconId[4] = data.list[30].weather[0].icon;\r\n \r\n weather.time[0] = data.list[6].dt_txt;\r\n weather.time[1] = data.list[12].dt_txt;\r\n weather.time[2] = data.list[18].dt_txt;\r\n weather.time[3] = data.list[24].dt_txt;\r\n weather.time[4] = data.list[30].dt_txt;\r\n\r\n \r\n //Location\r\n weather.city = data.city.name;\r\n weather.country = data.city.country;\r\n })\r\n .then(function(){\r\n displayWeather();\r\n })\r\n}", "function showForecast(forecastQueryURL) {\n var temp, humidity, icon;\n\n console.log(\"Forecast query URL : \" + forecastQueryURL);\n $(\"#5DayForecast\").show();\n\n $.ajax({\n url: forecastQueryURL,\n method: \"GET\",\n }).then(function (forecastResponse) {\n $(\"#forecast\").empty();\n\n var list = forecastResponse.list;\n\n for (var i = 0; i < list.length; i++) {\n var date = list[i].dt_txt.split(\" \")[0];\n var dateArr = date.split(\"-\");\n\n var dateForecast = dateArr[1] + \"/\" + dateArr[2] + \"/\" + dateArr[0];\n var time = list[i].dt_txt.split(\" \")[1];\n\n if (time === \"12:00:00\") {\n temp = list[i].main.temp;\n humidity = list[i].main.humidity;\n icon = list[i].weather[0].icon;\n\n var card = $(\"<div>\").addClass(\"card bg-primary text-white\");\n var cardBody = $(\"<div>\").addClass(\"card-body\");\n\n var fDate = $(\"<h5>\").addClass(\"card-text\").text(dateForecast);\n\n // weather icons\n var imgIcon = $(\"<img>\").attr(\n \"src\",\n \"https://openweathermap.org/img/wn/\" + icon + \".png\"\n );\n\n var tempP = $(\"<p>\")\n .addClass(\"card-text\")\n .text(\"Temp: \" + temp + \"°F\");\n\n var humidityP = $(\"<p>\")\n .addClass(\"card-text\")\n .text(\"Humidity : \" + humidity + \" % \");\n\n cardBody.append(fDate, imgIcon, tempP, humidityP);\n card.append(cardBody);\n\n $(\"#forecast\").append(card);\n }\n }\n });\n}", "function getForecast(searchCity) {\n\n var APIKey = \"03372b05683f32ca6f14fa043c2663ff\"\n var queryURLForecast = `https://api.openweathermap.org/data/2.5/forecast?q=${searchCity}&units=imperial&appid=${APIKey}`\n\n $(\"#forecast\").empty();\n\n // Run AJAX call to the OpenWeatherMap API\n $.ajax({\n url: queryURLForecast,\n method: \"GET\"\n\n // Store all of the retrieved data inside of an object called \"response\"\n }).then(function (response) {\n\n //======================================================= APPENDING FOR THE WIN!1!!11!! ================================================================\n\n //target forecast and insert elements and append a row. >>>>...\\\"mt-3\\\"...<<< (the two backslashes allow for scaping and inserting additional class)\n $(\"#forecast\").html(\"<h4 class\\\"mt-3\\\">5-day Forcast: </h4>\").append(\"<div>\")\n\n //append columns throguh a loop w/ variable creation club //i<response.list.length; i+=8 <Justin's solution. Working on other possible solutions.\n for (var i = 0; i < response.list.length; i += 8) {\n\n //create column\n var colEl = $(\"<div>\").addClass(\"col-md-2 forecastCard\")\n\n //adding card - div w/ class of card.\n var cardEl = $(\"<div>\").addClass(\"card bg-primary text-white\");\n\n //create card body in the new div - bootstrap to the rescue!\n var cardBodyEl = $(\"<div>\").addClass(\"card-body p-2\");\n\n //data extraction and insertion\n var titleEl = $(\"<h5>\").addClass(\"card-title\").text(new Date(response.list[i].dt_txt).toLocaleDateString());\n\n //adding that icon image WOOOOTTTT\n // var image = `https://openweathermap.org/img/w/${response.list[i].weather[0].icon}.png`;\n var imgEl = $(\"<img>\").attr(\"src\", `https://openweathermap.org/img/w/${response.list[i].weather[0].icon}.png`);\n\n //temperature element min and max\n var tempElMin = $(\"<p>\").addClass(\"card-text\").text(`Minimum Temp: ${response.list[i].main.temp_min} degrees`);\n var tempElMax = $(\"<p>\").addClass(\"card-text\").text(`Maximum Temp: ${response.list[i].main.temp_max} degrees`);\n\n //humidity level\n var humidityEl = $(\"<p>\").addClass(\"card-text\").text(`Humidity: ${response.list[i].main.humidity} %`);\n\n //appending elements to card body and body to card.\n cardBodyEl.append(titleEl, imgEl, tempElMin, tempElMax, humidityEl);\n cardEl.append(cardBodyEl);\n\n //appending card element to column element\n colEl.append(cardEl);\n\n //appending column to the forecast div.\n $(\"#forecast\").append(colEl);\n\n };\n\n });\n\n }", "function forecast(cityId) {\n var queryForecastURL = \"https://api.openweathermap.org/data/2.5/forecast?id=\" + cityId + \"&appid=\" + APIKEY;\n $.ajax({\n url: queryForecastURL,\n method: \"GET\"\n }).then(function (response) {\n debugger\n console.log(response);\n for (i = 0; i < 5; i++) {\n var dateF = new Date((response.list[((i + 1) * 8) - 1].dt) * 1000).toLocaleDateString();\n var tempK = response.list[((i + 1) * 8) - 1].main.temp;\n var tempF = (((tempK - 273.5) * 1.80) + 32).toFixed(2);\n var humidityF = response.list[((i + 1) * 8) - 1].main.humidity;\n\n $(\"#fdate\" + i).html(dateF);\n $(\"#ftemp\" + i).html(tempF + \"&#8457\");\n $(\"#fhumidity\" + i).html(humidityF + \"%\")\n }\n\n });\n}", "function getForecast(searchValue) {\n // Make an ajax request\n $.ajax({\n type: \"GET\",\n url: \"https://api.openweathermap.org/data/2.5/forecast?q=\" + searchValue + \"&appid=600327cb1a9160fea2ab005509d1dc6d&units=imperial\",\n dataType: \"json\",\n // If it is successful, run the following function with the given data\n success: function(data) {\n // overwrite any existing content with title and empty row\n $(\"#forecast\").html(\"<h4 class=\\\"mt-3\\\">5-Day Forecast:</h4>\").append(\"<div class=\\\"row\\\">\");\n\n // loop over all forecasts (by 3-hour increments)\n for (var i = 0; i < data.list.length; i++) {\n // only look at forecasts around 3:00pm\n if (data.list[i].dt_txt.indexOf(\"15:00:00\") !== -1) {\n // create html elements for a bootstrap card\n // Create a col div\n var col = $(\"<div>\").addClass(\"col-md-2\");\n // Create a card div\n var card = $(\"<div>\").addClass(\"card bg-primary text-white\");\n // Create a car body div\n var body = $(\"<div>\").addClass(\"card-body p-2\");\n // Create an h5 title and set the text to be the desired date\n var title = $(\"<h5>\").addClass(\"card-title\").text(new Date(data.list[i].dt_txt).toLocaleDateString());\n // Create an image tage for the weather icon\n var img = $(\"<img>\").attr(\"src\", \"http://openweathermap.org/img/w/\" + data.list[i].weather[0].icon + \".png\");\n // Create a paragraph tag and put that day's temp in the text\n var p1 = $(\"<p>\").addClass(\"card-text\").text(\"Temp: \" + data.list[i].main.temp_max + \" °F\");\n // Create a paragraph tag and put that day's humidity in the text\n var p2 = $(\"<p>\").addClass(\"card-text\").text(\"Humidity: \" + data.list[i].main.humidity + \"%\");\n\n // merge together and put on page\n col.append(card.append(body.append(title, img, p1, p2)));\n $(\"#forecast .row\").append(col);\n }\n }\n }\n });\n }", "function getForecastWeather(){\r\n\r\n var fcw = $(\"#w__forecast\");\r\n var url = \"http://api.openweathermap.org/data/2.5/forecast?q=\"+cfg.city+\"&units=metric&lang=ru&cnt=6&appid=\"+cfg.apikey;\r\n\r\n fcw.find(\".weather_block\").each(function(){\r\n if ( !$(this).hasClass('template') ) $(this).remove();\r\n });\r\n\r\n $.getJSON(url, function(data){\r\n\r\n console.log(data);\r\n\r\n $.each(data.list, function(index, value){\r\n if ( index % 2 != 0 ) return true;\r\n var dateObj = new Date(value.dt*1000);\r\n var date_val = DateFormat.format.date(value.dt*1000, \"H:mm, d MMM yyyy\");\r\n var el = document.querySelector('#w__forecast .template').cloneNode(true);\r\n console.log(\"Ok!\");\r\n el.classList.remove('template');\r\n el.setAttribute('date', date_val);\r\n fcw.find(\".card-content\").append(el);\r\n console.log(\"Ok!\");\r\n\r\n // Icon\r\n var wicon = value.weather[0].id;\r\n var wicond = value.weather[0].description;\r\n fcw.find(\".weather_block[date='\"+date_val+\"'] .weather_icon\").html('<a title=\"'+wicond+'\"><i class=\"wi wi-owm-'+wicon+'\"></i></a>');\r\n\r\n // Wind icon\r\n var winddeg = value.wind.deg;\r\n var wwind = parseInt( ( winddeg < 180 ) ? winddeg + 180 : winddeg - 180 );\r\n fcw.find(\".weather_block[date='\"+date_val+\"'] .weather_wind\").html('<i class=\"wi wi-wind towards-'+wwind+'-deg\"></i>');\r\n\r\n // Wind speed\r\n var wwinds = value.wind.speed;\r\n fcw.find(\".weather_block[date='\"+date_val+\"'] .weather_ws\").html(wwinds+' м/с');\r\n\r\n // Temp\r\n var wtemp = Math.round(value.main.temp*10)/10;\r\n fcw.find(\".weather_block[date='\"+date_val+\"'] .weather_temp\").html(wtemp+'&deg;');\r\n\r\n // Pressure\r\n var wpres = parseInt(value.main.pressure/1.33322);\r\n fcw.find(\".weather_block[date='\"+date_val+\"'] .weather_pres\").html(wpres);\r\n\r\n // Humidity\r\n var whum = value.main.humidity;\r\n fcw.find(\".weather_block[date='\"+date_val+\"'] .weather_hum\").html(whum+' %');\r\n\r\n });\r\n });\r\n\r\n}", "function getForecast() {\n\n var ForcastUrl = \"https://api.openweathermap.org/data/2.5/forecast?q=\"\n var forcastCall = ForcastUrl + city + apiKey + units; \n\n $(\"#flex1\").empty();\n $(\"#flex2\").empty(); \n $(\"#flex3\").empty();\n $(\"#flex4\").empty();\n $(\"#flex5\").empty();\n\n $.ajax({\n url: forcastCall,\n method: \"GET\"\n })\n // After data comes back from the request\n .then(function(response) {\n // console.log(queryURL);\n // console.log(response);\n \n var holdCurrent= \"\";\n var holdHighest = \"\"; \n var dayOut = 0;\n for (i=0; i<40; i++) {\n // console.log((response.list[i].dt_txt).slice(0,10));\n \n holdCurrent = response.list[i].dt_txt.slice(0,10);\n\n \n if (holdCurrent == todayDate) {\n continue;\n } else if (dayOut === 0) {\n //console.log(response.list[i].main.temp);\n //console.log(response.list[i].main.humidity);\n //var iconNum = response.list[i].weather[0].icon\n //console.log(iconNum)\n\n $(\"#flex1\").append(holdCurrent); \n\n //var weatherIconUrl = weatherIconUrl1 + iconNum + weatherIconUrl3\n //console.log(weatherIconUrl)\n\n // var weatherIcon = $(\"<img>\");\n // Setting the catImage src attribute to imageUrl\n //weatherIcon.attr(\"src\", weatherIconUrl);\n //weatherIcon.attr(\"alt\", \"weather pic\");\n \n //$(\"#flex1\").append(weatherIcon);\n $(\"#flex1\").append(\"<p>Temperature: \" + response.list[i].main.temp + \"&#\"+ 8457 + \"</p>\"); \n //$(\"#flex1\").append(weatherIcon);\n $(\"#flex1\").append(\"<p>Humidity: \" + response.list[i].main.humidity + \" %\" + \"</p>\");\n var dayOut = dayOut + 1; \n holdHighest = holdCurrent;\n //console.log(holdHighest); \n } else if (holdCurrent != holdHighest && dayOut <5) { \n // console.log(response.list[i].main.temp)\n // console.log(response.list[i].main.humidity)\n var dayOut = dayOut + 1; \n var flexStg = \"#flex\" + dayOut;\n $(flexStg).append(holdCurrent); \n // $(flexStg).append(weatherIcon);\n $(flexStg).append(\"<p>Temperature: \" + response.list[i].main.temp + \"&#\"+ 8457 + \"</p>\"); \n $(flexStg).append(\"<p>Humidity: \" + response.list[i].main.humidity + \" %\" + \"</p>\");\n holdHighest = holdCurrent;\n // console.log(holdHighest)\n }\n \n }\n \n doButtonAndStorage();\n }) \n \n}", "function createForecast(cityName) {\n // clears containers\n $forecastCard1.innerHTML = \"\";\n $forecastCard2.innerHTML = \"\";\n $forecastCard3.innerHTML = \"\";\n $forecastCard4.innerHTML = \"\";\n $forecastCard5.innerHTML = \"\";\n\n var city = cityName.name;\n var lon = cityName.coord.lon;\n var lat = cityName.coord.lat;\n var onecallUrl = `https://api.openweathermap.org/data/2.5/onecall?lat=${lat}&lon=${lon}&appid=${api_key}`;\n fetch(onecallUrl)\n .then((data) => data.json())\n .then(function (onecallUrlData) {\n // get 5 day forecast showing\n\n\n // Date Variables\n var tempArr = [];\n var displayDateArr = [];\n var humidityArr = [];\n var iconArr = [];\n var iconSourceArr = [];\n\n for (let i = 0; i <= 4; i++) {\n // Get Date Data\n var dateFormat = parseInt(onecallUrlData.daily[i].dt) * 1000;\n var dateObject = new Date(dateFormat);\n var humanDateFormat = dateObject.toLocaleDateString(\n \"en-US\",\n { weekday: \"long\" } + { day: \"numeric\" }\n );\n\n displayDateArr.push(humanDateFormat);\n\n // Get Temp Data\n // Convert Kelvin to Farenheit\n tempArr.push(\n \"TEMPERATURE: \" +\n Math.floor(1.8 * (onecallUrlData.daily[i].temp.day - 273) + 32) +\n \"°\"\n );\n\n // Humidity Data\n humidityArr.push(\" HUMIDITY: \" + onecallUrlData.daily[i].humidity);\n\n // Icon Data\n iconArr.push(onecallUrlData.daily[i].weather[0].icon);\n iconSourceArr.push(\n `https://openweathermap.org/img/wn/${iconArr[i]}@2x.png`\n );\n }\n\n var $img1 = document.createElement(\"img\");\n $img1.setAttribute(\"src\", iconSourceArr[0]);\n\n var $img2 = document.createElement(\"img\");\n $img2.setAttribute(\"src\", iconSourceArr[1]);\n\n var $img3 = document.createElement(\"img\");\n $img3.setAttribute(\"src\", iconSourceArr[2]);\n\n var $img4 = document.createElement(\"img\");\n $img4.setAttribute(\"src\", iconSourceArr[3]);\n\n var $img5 = document.createElement(\"img\");\n $img5.setAttribute(\"src\", iconSourceArr[4]);\n\n // Append 5 Day Data to HTML elements\n\n $forecastCard1.append(\n displayDateArr[0],\n $img1,\n tempArr[0],\n humidityArr[0]\n );\n\n $forecastCard2.append(\n displayDateArr[1],\n $img2,\n tempArr[1],\n humidityArr[1]\n );\n\n $forecastCard3.append(\n displayDateArr[2],\n $img3,\n tempArr[2],\n humidityArr[2]\n );\n\n $forecastCard4.append(\n displayDateArr[3],\n $img4,\n tempArr[3],\n humidityArr[3]\n );\n\n $forecastCard5.append(\n displayDateArr[4],\n $img5,\n tempArr[4],\n humidityArr[4]\n );\n\n $forecastCard1.classList.add(\"color\");\n $forecastCard2.classList.add(\"color\");\n $forecastCard3.classList.add(\"color\");\n $forecastCard4.classList.add(\"color\");\n $forecastCard5.classList.add(\"color\");\n });\n}", "function forecast(LocID){\n var futureForecastURL=\"https://api.openweathermap.org/data/2.5/forecast?id=\"+LocID+\"&appid=\"+APIKey;\n $.ajax({\n url:futureForecastURL,\n method:\"GET\"\n }).then(function(response){\n \n for (i=0;i<5;i++){\n var date= new Date((response.list[((i+1)*8)-1].dt)*1000).toLocaleDateString();\n var weatherIcon= response.list[((i+1)*8)-1].weather[0].icon;\n var iconurl=\"https://openweathermap.org/img/wn/\"+weatherIcon+\".png\";\n var tempCel= response.list[((i+1)*8)-1].main.temp;\n var tempFahr=(((tempCel-273.5)*1.80)+32).toFixed(2);\n var humidity= response.list[((i+1)*8)-1].main.humidity;\n \n $(\"#fiveDay\"+i).html(date);\n $(\"#fivedayIcon\"+i).html(\"<img src=\"+iconurl+\">\");\n $(\"#fivedayTemp\"+i).html(tempFahr+\"&#8457\");\n $(\"#fivedayHum\"+i).html(humidity+\"%\");\n }\n \n });\n}", "function getFiveDayForecastWeather(city)\n{\n fiveDayEL.addClass(\"show\");\n $(\"#forecast\").empty();\n console.log(city);\n var queryURL =\"https://api.openweathermap.org/data/2.5/forecast?q=\"+city+\n \"&appid=00ca04ab09444ea47ef6c4428f3606b7\";\n $.ajax({\n url: queryURL,\n method: \"GET\",\n }).then(function(response){\n console.log(response);\n let results = response.list;\n console.log(results)\n for (let i = 0; i < results.length; i++) {\n var dateObj = new Date(); \n if(results[i].dt_txt.indexOf(\"12:00:00\") !== -1){\n\n // get the temperature and convert to fahrenheit \n let temp = (results[i].main.temp - 273.15) * 1.80 + 32;\n let tempF = Math.floor(temp);\n \n const card = $(\"<div>\").addClass(\"card col-md-2 ml-4 bg-primary text-white\");\n const cardBody = $(\"<div>\").addClass(\"card-body p-3 forecastBody\") \n \n const cityDate = $(\"<h4>\").addClass(\"card-title\").text(moment(results[i].dt,\"X\").format('l')); \n \n const temperature = $(\"<p>\").addClass(\"card-text forecastTemp\").text(\"Temp: \" + tempF + \" °F\");\n const humidity = $(\"<p>\").addClass(\"card-text forecastHumidity\").text(\"Humidity: \" + results[i].main.humidity + \"%\");\n \n const image = $(\"<img>\").attr(\"src\", \"https://openweathermap.org/img/w/\" + results[i].weather[0].icon + \".png\")\n \n cardBody.append(cityDate,image, temperature, humidity);\n card.append(cardBody);\n $(\"#forecast\").append(card);\n \n }\n } \n \n });\n }", "function fiveDay(City) {\n var requestURL2 =\n \"https://api.openweathermap.org/data/2.5/forecast?q=\" +\n City +\n \"&units=imperial&appid=\" +\n apiKey;\n\n fetch(requestURL2)\n .then(function (response) {\n return response.json();\n })\n .then(function (data) {\n console.log(data);\n // Set text for header that will include 5 cards\n fiveDayHeader.text(\" 5 Day Forecast\");\n\n console.log(data.city.name);\n // Created the card template that was once hard coded\n var cardTemplate = `\n <div class=\"card mx-2\" style=\"width: 15rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${data.list[0].dt_txt}</h5>\n <p class=\"card-text\">Temperature:<span id=\"1temp\"></span></p>\n <br>\n <p class=\"card-text\">Humidity:<span id=\"1humid\"></span></p>\n </div>\n </div>\n `;\n var cardTemplate2 = `\n <div class=\"card mx-2\" style=\"width: 15rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${data.list[8].dt_txt}</h5>\n <p class=\"card-text\">Temperature:<span id=\"2temp\"></span></p>\n <br>\n <p class=\"card-text\">Humidity:<span id=\"2humid\"></span></p>\n </div>\n </div>\n `;\n var cardTemplate3 = `\n <div class=\"card mx-2\" style=\"width: 15rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${data.list[16].dt_txt}</h5>\n <p class=\"card-text\">Temperature:<span id=\"3temp\"></span></p>\n <br>\n <p class=\"card-text\">Humidity:<span id=\"3humid\"></span></p>\n </div>\n </div>\n `;\n var cardTemplate4 = `\n <div class=\"card mx-2\" style=\"width: 15rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${data.list[24].dt_txt}</h5>\n <p class=\"card-text\">Temperature:<span id=\"4temp\"></span></p>\n <br>\n <p class=\"card-text\">Humidity:<span id=\"4humid\"></span></p>\n </div>\n </div>\n `;\n var cardTemplate5 = `\n <div class=\"card mx-2\" style=\"width: 15rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${data.list[32].dt_txt}</h5>\n <p class=\"card-text\">Temperature:<span id=\"5temp\"></span></p>\n <br>\n <p class=\"card-text\">Humidity:<span id=\"5humid\"></span></p>\n </div>\n </div>\n `;\n\n // Manipulate DOM and add each cardTemplate to the fiveDayForecast div class\n document.querySelector(\".fiveDayForecast\").innerHTML += cardTemplate\n document.querySelector(\".fiveDayForecast\").innerHTML += cardTemplate2\n document.querySelector(\".fiveDayForecast\").innerHTML += cardTemplate3\n document.querySelector(\".fiveDayForecast\").innerHTML += cardTemplate4\n document.querySelector(\".fiveDayForecast\").innerHTML += cardTemplate5\n \n // Target each days id for temp and humidity\n $(\"#1temp\").text(data.list[0].main.temp + \" °F\");\n $(\"#1humid\").text(data.list[0].main.humidity + \" %\");\n\n $(\"#2temp\").text(data.list[8].main.temp + \" °F\");\n $(\"#2humid\").text(data.list[8].main.humidity + \" %\");\n\n $(\"#3temp\").text(data.list[16].main.temp + \" °F\");\n $(\"#3humid\").text(data.list[16].main.humidity + \" %\");\n\n $(\"#4temp\").text(data.list[24].main.temp + \" °F\");\n $(\"#4humid\").text(data.list[24].main.humidity + \" %\");\n\n $(\"#5temp\").text(data.list[32].main.temp + \" °F\");\n $(\"#5humid\").text(data.list[32].main.humidity + \" %\");\n\n // Store data from search into local storage\n localStorage.setItem(\"Five-day-data\", JSON.stringify(data));\n });\n}", "function fiveDayForecast(lat, lon) {\n //set url variable to url string\n var url = \"https://api.openweathermap.org/data/2.5/onecall?lat=\" + lat + \"&lon=\" + lon + \"&units=imperial&appid=\" + apiKey\n \n \n fetch(url)\n\n .then(function (response){\n if (!response.ok) {\n throw response.json();\n }\n return response.json();\n })\n .then(function (data){\n console.log(data);\n\n //UV Index\n uvIndex.text(data.current.uvi);\n\n //Changes UV badge color based on UV Index number\n if (data.current.uvi <= 4) {\n uvIndex.addClass('badge badge-success');\n }\n\n else if (data.current.uvi > 4 && data.current.uvi <= 7) {\n uvIndex.removeClass('badge badge-success');\n uvIndex.addClass('badge badge-warning');\n }\n\n else {\n uvIndex.removeClass('badge badge-success');\n uvIndex.removeClass('badge badge-warning');\n uvIndex.addClass('badge badge-danger');\n }\n\n $('#five-day-forecast').empty();\n //Create Cards\n for (let i = 1; i < data.daily.length; i++) {\n\n //Date for each card \n var date = new Date(data.daily[i].dt * 1000); //take the dt and convert it from milliseconds to a readable date info \n console.log(date);\n var formatDate = moment(date).format('L'); //format the date to month/day/year \n console.log(formatDate);\n var forecastDateString = formatDate\n console.log(forecastDateString);\n\n //Five Day Forecast El\n var fiveDayForecast = $('#five-day-forecast');\n var forecastCol = $(\"<div class='col-12 col-md-6 col-lg mb-3'>\");\n var forecastCard = $(\"<div class='card text-white bg-primary'>\");\n var forecastCardBody = $(\"<div class='card-body'>\");\n\n var forecastDate = $(\"<h5 class='card-title'>\");\n var forecastIcon = $(\"<img>\");\n var forecastTemp = $(\"<p class='card-text mb-0'>\");\n var forecastHumidity = $(\"<p class='card-text mb-0'>\");\n\n //create each card\n fiveDayForecast.append(forecastCol);\n forecastCol.append(forecastCard);\n forecastCard.append(forecastCardBody);\n\n forecastCardBody.append(forecastDate);\n forecastCardBody.append(forecastIcon);\n forecastCardBody.append(forecastTemp);\n forecastCardBody.append(forecastHumidity);\n\n //add info to each card\n forecastDate.text(forecastDateString);\n forecastIcon.attr(\"src\", \"http://openweathermap.org/img/wn/\" + data.daily[i].weather[0].icon + \".png\");\n forecastTemp.text(\"Temp: \" + data.daily[i].temp.day + String.fromCharCode(8457));\n forecastHumidity.text(\"Humidity: \" + data.daily[i].humidity + \"%\");\n\n // If there are 5 cards on page then stop loop\n if (i === 5)\n break;\n \n }\n\n });\n}", "function getNextFiveDays(selectedCity) {\n cardBody.empty();\n let queryUrl = `https://api.openweathermap.org/data/2.5/forecast?q=${selectedCity}&appid=${apiKey}&units=imperial`;\n $.ajax({\n url: queryUrl,\n method: \"GET\"\n })\n .then(function(fiveDayForecast) {\n // console.log(fiveDayForecast);\n for (let i = 0; i < fiveDayForecast.list.length; i+=8) {\n // console.log(fiveDayForecast.list.length);\n let cityInfo = {\n date: fiveDayForecast.list[i].dt_txt,\n icon: fiveDayForecast.list[i].weather[0].icon,\n temp: fiveDayForecast.list[i].main.temp,\n humidity: fiveDayForecast.list[i].main.humidity\n }\n let cardDate = cityInfo.date;\n let trDate = cardDate.substring(0, 10);\n let wthrIcon = `https://openweathermap.org/img/w/${cityInfo.icon}.png`;\n // console.log(`card-${i}`, cityInfo)\n displayForecastCard(trDate, wthrIcon, cityInfo.temp, cityInfo.humidity, i); \n }\n \n })\n }", "function futureWeather(response) {\n \n const APIkey = \"d4cbbbed2b7e0999d4caf0c5d818ffe4\";\n let lat = response.results[0].geometry.location.lat;\n let lng = response.results[0].geometry.location.lng;\n const futureWeatherURL = \"https://api.openweathermap.org/data/2.5/forecast?lat=\" + lat + \"&lon=\" + lng + \"&APPID=\" + APIkey;\n \n let todayList = [];\n let tomorrowList = [];\n let tomorrowTomorrowList = [];\n \n $.ajax({\n url: futureWeatherURL,\n method: \"GET\"\n }).done(function (response) {\n\n //variables for today, tomorrow, and the next day's time\n let momentOffset = moment();\n let currentTime = moment().format(\"YYYY-MM-DD\");\n let tomorrowTime = moment().add(1, \"days\").format(\"YYYY-MM-DD\");\n let tomorrowTomorrowTime = moment().add(2, \"days\").format(\"YYYY-MM-DD\");\n \n let weatherList = response.list;\n\n //pushes weather items into arrays based on which day they fall into\n for (let i = 0; i < weatherList.length; i++) {\n let weatherDay = weatherList[i].dt_txt;\n weatherDay = moment(weatherDay).format(\"YYYY-MM-DD\");\n if (weatherDay === currentTime) {\n todayList.push(weatherList[i]);\n } else if (weatherDay === tomorrowTime) {\n tomorrowList.push(weatherList[i]);\n } else if (weatherDay === tomorrowTomorrowTime) {\n tomorrowTomorrowList.push(weatherList[i]);\n }\n }\n\n \n var clearState = \"Clear\";\n var rainState = \"Rain\";\n var cloudState = \"Clouds\";\n \n var todayClear = [];\n var todayRain = [];\n var todayClouds = [];\n\n //sorts today's array by weather state\n for (i = 0; i < todayList.length; i++) {\n var weatherState = todayList[i].weather[0].main;\n \n if (weatherState === clearState) {\n todayClear.push(todayList[i]);\n } else if (weatherState === rainState) {\n todayRain.push(todayList[i]);\n } else if (weatherState === cloudState) {\n todayClouds.push(todayList[i]);\n }\n }\n\n //we'll repeat this process for the other days as well\n var tomorrowClear = [];\n var tomorrowRain = [];\n var tomorrowClouds = [];\n\n //sorts tomorrow's array by weather state\n for (i = 0; i < tomorrowList.length; i++) {\n weatherState = tomorrowList[i].weather[0].main;\n \n if (weatherState === clearState) {\n tomorrowClear.push(tomorrowList[i]);\n } else if (weatherState === rainState) {\n tomorrowRain.push(tomorrowList[i]);\n } else if (weatherState === cloudState) {\n tomorrowClouds.push(tomorrowList[i]);\n }\n }\n \n //tomorrowTomorrowList\n var tomorrowTomorrowClear = [];\n var tomorrowTomorrowRain = [];\n var tomorrowTomorrowClouds = [];\n\n //sorts tomorrow tomorrow's array by weather state\n for (i = 0; i < tomorrowTomorrowList.length; i++) {\n weatherState = tomorrowTomorrowList[i].weather[0].main;\n \n if (weatherState === clearState) {\n tomorrowTomorrowClear.push(tomorrowTomorrowList[i]);\n } else if (weatherState === rainState) {\n tomorrowTomorrowRain.push(tomorrowTomorrowList[i]);\n } else if (weatherState === cloudState) {\n tomorrowTomorrowClouds.push(tomorrowTomorrowList[i]);\n }\n }\n\n //then we'll check the length of each weather state array and declare the longest array as the day's forecast\n //I haven't figured out what to do if they're the same yet\n\n //checks to see which weather state is most common today for display in a later update\n if (todayClear.length > todayRain.length && todayClear.length > todayClouds.length) {\n }\n else if (todayRain.length > todayClear && todayRain.length > todayClouds.length) {\n }\n else {\n }\n\n //checks to see which weather state is most common tomorrow\n if (tomorrowClear.length > tomorrowRain.length && tomorrowClear.length > tomorrowClouds.length) {\n $(\"#tomorrowWeatherBody\").html(\"Tomorrow:<br><br>Clear<br>\");\n }\n else if (tomorrowRain.length > tomorrowClear && tomorrowRain.length > tomorrowClouds.length) {\n $(\"#tomorrowWeatherBody\").html(\"Tomorrow:<br><br>Rain<br>\");\n }\n else {\n $(\"#tomorrowWeatherBody\").html(\"Tomorrow:<br><br>Clouds<br>\");\n }\n\n //checks to see which weather state is most common tomorrow tomorrow\n if (tomorrowTomorrowClear.length > tomorrowTomorrowRain.length && tomorrowTomorrowClear.length > tomorrowTomorrowClouds.length) {\n $(\"#tomorrowTomorrowWeatherBody\").html(\"The Next Day:<br><br>Clear<br>\");\n }\n else if (tomorrowTomorrowRain.length > tomorrowTomorrowClear && tomorrowTomorrowRain.length > tomorrowTomorrowClouds.length) {\n $(\"#tomorrowTomorrowWeatherBody\").html(\"The Next Day:<br><br>Rain<br>\");\n }\n else {\n $(\"#tomorrowTomorrowWeatherBody\").html(\"The Next Day:<br><br>Clouds<br>\");\n }\n\n \n let todayMaxTemp = 0;\n let todayMinTemp = 0;\n\n //calculates the average max and min temperatures for today to be used in a later update\n for (let i = 0; i < todayList.length; i++) {\n todayMaxTemp += todayList[i].main.temp_max;\n todayMinTemp += todayList[i].main.temp_min;\n if ( (i + 1) === todayList.length) {\n todayMaxTemp /= todayList.length;\n let todayMaxF = (todayMaxTemp - 273.15) * 1.80 + 32;\n todayMinTemp /= todayList.length;\n let todayMinF = (todayMinTemp - 273.15) * 1.80 + 32;\n }\n }\n\n let tomorrowMaxTemp = 0;\n // let tomorrowMinTemp = 0;\n\n //calculates tomorrow's max and min states for a later update, currently uses the average max temp for the average overall\n for (let i = 0; i < tomorrowList.length; i++) {\n tomorrowMaxTemp += tomorrowList[i].main.temp_max;\n // tomorrowMinTemp += tomorrowList[i].main.temp_min;\n if ( (i + 1) === tomorrowList.length) {\n tomorrowMaxTemp /= tomorrowList.length;\n let tomorrowMaxF = (tomorrowMaxTemp - 273.15) * 1.80 + 32;\n tomorrowMaxF = Number(Math.round(tomorrowMaxF+'e1')+'e-1');\n $(\"#tomorrowWeatherBody\").append(\"Average Temp: \" + tomorrowMaxF + \" F<br>\");\n // tomorrowMinTemp /= tomorrowList.length;\n // let tomorrowMinF = (tomorrowMaxTemp - 273.15) * 1.80 + 32;\n // tomorrowMinF = Number(Math.round(tomorrowMinF+'e1')+'e-1');\n // console.log(tomorrowMinF);\n // $(\"#tomorrowWeatherBody\").append(\"Min: \" + tomorrowMinF + \"F<br>\")\n }\n }\n \n let tomorrowTomorrowMaxTemp = 0;\n // let tomorrowTomorrowMinTemp = 0;\n\n //calculates tomorrow tomorrow's max and min states for a later update, currently uses the average max temp for the average overall\n for (let i = 0; i < tomorrowTomorrowList.length; i++) {\n tomorrowTomorrowMaxTemp += tomorrowTomorrowList[i].main.temp_max;\n // tomorrowTomorrowMinTemp += tomorrowTomorrowList[i].main.temp_min;\n if ( (i + 1) === tomorrowTomorrowList.length) {\n tomorrowTomorrowMaxTemp /= tomorrowTomorrowList.length;\n let tomorrowTomorrowMaxF = (tomorrowTomorrowMaxTemp - 273.15) * 1.80 + 32;\n tomorrowTomorrowMaxF = Number(Math.round(tomorrowTomorrowMaxF+'e1')+'e-1');\n $(\"#tomorrowTomorrowWeatherBody\").append(\"Average Temp: \" + tomorrowTomorrowMaxF + \" F<br>\");\n // tomorrowTomorrowMinTemp /= tomorrowTomorrowList.length;\n // let tomorrowTomorrowMinF = (tomorrowTomorrowMinTemp - 273.15) * 1.80 + 32;\n // tomorrowTomorrowMinF = Number(Math.round(tomorrowTomorrowMinF+'e1')+'e-1');\n // console.log(tomorrowTomorrowMinF);\n // $(\"#tomorrowTomorrowWeatherBody\").append(\"Min: \" + tomorrowTomorrowMinF + \"F<br>\");\n }\n }\n\n })\n}", "getForecast(){\n\t\tlet url = 'https://api.openweathermap.org/data/2.5/forecast?lat='+this.state.latitude+'&lon='+this.state.longitude+'&appid=ce0cb4b99e8ee814c20a4f76609c8196';\n\t\tfetch(url)\n\t\t.then(response => response.json())\n\t\t.then(data => {\n\t\t\tconsole.log(data);\n\t\t\t// let tempData = JSON.stringify(data);\n \t// console.log(tempData);\n\t\t\t// alert(tempData);\n\t\t\tthis.setState({\n\t\t\t\tforecast: data\n\t\t\t})\t\t\n\t\t})\n\t\t.catch(function(error){\n\t\t\tconsole.log(error.message);\n\t\t\tthrow error.message;\n\t\t });\n\t}", "function addWeather() {\n placeData.forEach(place => {\n place.weather = { data: 'none'};\n // get weather for the place, using preseeded location data and darksky api\n rp({\n url: `https://api.darksky.net/forecast/${process.env.DARKSKY_API_KEY}/${place.location.lat},${place.location.lng}`,\n qs: { units: 'si' },\n json: true\n })\n // Attach daily weather data to the place.\n .then(response => place.weather = response.daily);\n });\n}", "function displayForecast(city) {\n let queryURL = forecastURL + city + apiKey;\n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).then(function (fiveDayResponse) {\n $(\"#forecast\").empty();\n day = 0\n for (let i = 0; i < fiveDayResponse.list.length; i++) {\n let curr = fiveDayResponse.list[i];\n if (curr.dt_txt.includes(\"12:00\")) {\n // console.log(i);\n // console.log(fiveDayResponse.city.name);\n let iconURL = `http://openweathermap.org/img/wn/${fiveDayResponse.list[i].weather[0].icon}@2x.png`\n let temp = (fiveDayResponse.list[i].main.temp - 273.15) * 1.80 + 32;\n let tempF = temp.toFixed(1)\n let windSpeed = fiveDayResponse.list[i].wind.speed\n let humidity = fiveDayResponse.list[i].main.humidity\n let date = moment().add([day], 'day').format('MMMM Do')\n $(\".fiveDay\").append(`<div class= \"col-2 float-left ml-4 bg-warning rounded p-3\"> <h4> ${date} </h4> <br> <img src=\"${iconURL}\"> <br> Temp: ${tempF}°F <br> Wind Speed: ${windSpeed} <br>Humidity: ${humidity}% </div>`);\n day++\n }\n }\n });\n}", "getWeather(){\n\n\t\t// Construct the API url to call\n\t\tlet url = 'https://api.openweathermap.org/data/2.5/weather?lat=' + this.state.latitude + '&lon=' + this.state.longitude + '&units=metric&appid=ce0cb4b99e8ee814c20a4f76609c8196';\n\t\t// console.log(url);\n\n\t\t// Call the API, and set the state of the weather forecast\n\t\tfetch(url)\n\t\t.then(response => response.json())\n\t\t.then(data => {\n\t\t\tconsole.log(data);\n\t\t\t// let tempData = JSON.stringify(data);\n\t\t\t\t// console.log(tempData);\n\t\t\t// alert(tempData);\n\t\t\tthis.processData(data);\n\t\t})\n\t\t.catch(function(error){\n\t\t\tconsole.log(error.message);\n\t\t\tthrow error.message;\n\t\t });\n\n\t\t// this.getForecast();\n\t}", "async function getFutureWeather() {\n if (!selectedCityLat || !selectedCityLong) {\n Alert.alert(\n 'Get future weather error!',\n 'No latitude or longitude!'\n )\n return;\n }\n\n setLoadingList(true);\n try {\n let fetchStr = `${weatherApiURL}onecall?lat=${selectedCityLat}&lon=${selectedCityLong}&appid=${weatherApiKey}&units=metric`;\n // console.log(fetchStr);\n let weatherData = await parseFetch(fetchStr);\n setFutureWeatherData(weatherData.daily);\n\n let summarisedList = weatherData.daily.map(d => {\n let dtStr = getDateFormatStr(new Date((d.dt) * 1000));\n return {\n dateStr: dtStr,\n minTemp: d.temp.min,\n maxTemp: d.temp.max,\n forecast: d.weather[0].main\n }\n })\n // let withoutToday = summarisedList.filter(d => d.dateStr !== selectedDate)\n setFutureWeatherList(summarisedList);\n } catch (e) {\n Alert.alert(\n 'Get future weather error!',\n e.toString()\n )\n } finally {\n setLoadingList(false);\n }\n }", "async getWeather() {\n // Convert location to latitude and longitude using Google Maps geocoder\n const latLong = await this.getLatLong();\n const lat = latLong[0].geometry.location.lat();\n const lng = latLong[0].geometry.location.lng();\n\n // Get general weather API info for this location, including URLs for forecast, city name, etc.\n const weatherApiInfo = await (\n await fetch(`https://api.weather.gov/points/${lat},${lng}`)\n ).json();\n const forecastCity =\n weatherApiInfo.properties.relativeLocation.properties.city;\n const forecastState =\n weatherApiInfo.properties.relativeLocation.properties.state;\n\n // Get list of all weather stations in the area. Use the first station in the list.\n const observationStations = await (\n await fetch(weatherApiInfo.properties.observationStations)\n ).json();\n const weatherStation = observationStations.features[0].properties.name;\n\n // Get the current conditions\n const currentConditions = await (\n await fetch(\n `https://api.weather.gov/stations/${observationStations.features[0].properties.stationIdentifier}/observations/latest?require_qc=false`\n )\n ).json();\n\n // Get daily (7-day) forecast\n const dailyForecast = await (\n await fetch(weatherApiInfo.properties.forecast)\n ).json();\n\n // Get hourly forecast\n const hourlyForecast = await (\n await fetch(weatherApiInfo.properties.forecastHourly)\n ).json();\n\n // Return all this info and let the other module parse it and convert it\n return {\n forecastCity: forecastCity,\n forecastState: forecastState,\n weatherStationLoc: weatherStation,\n currentConditions: currentConditions.properties,\n dailyForecast: dailyForecast.properties,\n hourlyForecast: hourlyForecast.properties,\n };\n }", "function getForecast(searchValue) {\n $.ajax({\n type: \"GET\",\n url: \"http://api.openweathermap.org/data/2.5/forecast?q=\" + searchValue + \"&appid=30049c8f20433b7c73fa958a79fbc68b&units=imperial\",\n dataType: \"json\",\n success: function (data) {\n $(\"#forecast\").html(\"<h4 class=\\\"mt-3\\\">5-Day Forecast:</h4>\").append(\"<div class=\\\"row\\\">\");\n for (var i = 0; i < data.list.length; i++) {\n if (data.list[i].dt_txt.indexOf(\"15:00:00\") !== -1) {\n //these variables format the bootstrap card data. The column in line 74 sets the bootstrap layout to 2 columns for a medium layout. The card variable in line 75 sets the card's background color to blue and the text to white. Line 76 adds padding between the card bodies using the spacing utlities in bootstrap. \n let col = $(\"<div>\").addClass(\"col-md-2\");\n let card = $(\"<div>\").addClass(\"card bg-primary text-white\");\n let body = $(\"<div>\").addClass(\"card-body p-2\");\n //Like in the today card, the title is set for the card using the date from the response data in the dt_text field. The weather image is set from a concatenation of the weather icon and the image is placed in the image placeholder defined in the bootstrap card. Line 81 and 82 get the data from the forecast data response and formats it into the card text area. \n let title = $(\"<h5>\").addClass(\"card-title\").text(new Date(data.list[i].dt_txt).toLocaleDateString());\n\n let img = $(\"<img>\").attr(\"src\", \"http://openweathermap.org/img/w/\" + data.list[i].weather[0].icon + \".png\");\n\n let p1 = $(\"<p>\").addClass(\"card-text\").text(\"Temp: \" + data.list[i].main.temp_max + \" °F\");\n let p2 = $(\"<p>\").addClass(\"card-text\").text(\"Humidity: \" + data.list[i].main.humidity + \"%\");\n\n //The column variable defined in line 74 uses the .append insertion method to build the body/text for all 5 cards (5 days of data at 15:00 each day). The jQuery returned 5 sets of data, so all are populated into cards. \n col.append(card.append(body.append(title, img, p1, p2)));\n $(\"#forecast .row\").append(col);\n }\n }\n }\n });\n }", "function getWeatherToday() {\n\tvar getUrlCurrent = `https://api.openweathermap.org/data/2.5/weather?q=${city}&units=imperial&appid=${key}`;\n\n\t$(cardTodayBody).empty();\n\n\t$.ajax({\n\t\turl: getUrlCurrent,\n\t\tmethod: 'GET',\n\t}).then(function (response) {\n\t\t$('.cardTodayCityName').text(response.name);\n\t\t$('.cardTodayDate').text(date);\n\t\t//Icons\n\t\t$('.icons').attr('src', `https://openweathermap.org/img/wn/${response.weather[0].icon}@2x.png`);\n\t\t// Temperature\n\t\tvar pEl = $('<p>').text(`Temperature: ${response.main.temp} °F`);\n\t\tcardTodayBody.append(pEl);\n\t\t//Feels Like\n\t\tvar pElTemp = $('<p>').text(`Feels Like: ${response.main.feels_like} °F`);\n\t\tcardTodayBody.append(pElTemp);\n\t\t//Humidity\n\t\tvar pElHumid = $('<p>').text(`Humidity: ${response.main.humidity} %`);\n\t\tcardTodayBody.append(pElHumid);\n\t\t//Wind Speed\n\t\tvar pElWind = $('<p>').text(`Wind Speed: ${response.wind.speed} MPH`);\n\t\tcardTodayBody.append(pElWind);\n\t\t//Set the lat and long from the searched city\n\t\tvar cityLon = response.coord.lon;\n\t\t// console.log(cityLon);\n\t\tvar cityLat = response.coord.lat;\n\t\t// console.log(cityLat);\n\n\t\tvar getUrlUvi = `https://api.openweathermap.org/data/2.5/onecall?lat=${cityLat}&lon=${cityLon}&exclude=hourly,daily,minutely&appid=${key}`;\n\n\t\t$.ajax({\n\t\t\turl: getUrlUvi,\n\t\t\tmethod: 'GET',\n\t\t}).then(function (response) {\n\t\t\tvar pElUvi = $('<p>').text(`UV Index: `);\n\t\t\tvar uviSpan = $('<span>').text(response.current.uvi);\n\t\t\tvar uvi = response.current.uvi;\n\t\t\tpElUvi.append(uviSpan);\n\t\t\tcardTodayBody.append(pElUvi);\n\t\t\t//set the UV index to match an exposure chart severity based on color \n\t\t\tif (uvi >= 0 && uvi <= 2) {\n\t\t\t\tuviSpan.attr('class', 'green');\n\t\t\t} else if (uvi > 2 && uvi <= 5) {\n\t\t\t\tuviSpan.attr(\"class\", \"yellow\")\n\t\t\t} else if (uvi > 5 && uvi <= 7) {\n\t\t\t\tuviSpan.attr(\"class\", \"orange\")\n\t\t\t} else if (uvi > 7 && uvi <= 10) {\n\t\t\t\tuviSpan.attr(\"class\", \"red\")\n\t\t\t} else {\n\t\t\t\tuviSpan.attr(\"class\", \"purple\")\n\t\t\t}\n\t\t});\n\t});\n\tgetFiveDayForecast();\n}", "function getForecast(city) {\n\n var forecastQueryUrl = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + city + \"&units=imperial&appid=c59597ffd14758d47fc6dad0d31f1be0\"\n\n $.ajax({\n url: forecastQueryUrl,\n method: \"GET\"\n })\n\n .then(function(response) {\n console.log(\"Forecast------\", response);\n\n var futureDate1 = moment().add(1, 'days').format(\"l\");\n console.log(futureDate1);\n\n $(\"#forecast1\").empty();\n\n $(\"#forecast1\").append(\"<div id= 'day1' class='card-body'>\");\n \n $(\"#day1\").append(\"<h5 class='card-title'>\" + futureDate1 + \"</h5>\");\n\n var weatherIcon1 = response.list[5].weather[0].icon;\n console.log(weatherIcon1);\n var weatherIcon1 = (\"https://openweathermap.org/img/wn/\" + weatherIcon1 + \"@2x.png\");\n\n $(\"#day1\").append(\"<img src=\" + weatherIcon1 + \">\");\n\n var futureTemp1 = response.list[5].main.temp;\n console.log(futureTemp1);\n\n $(\"#day1\").append(\"<p class='card-text'>Temp: \" + futureTemp1 + \" °F</p>\")\n\n var futureHumid1 = response.list[5].main.humidity;\n console.log(futureHumid1);\n\n $(\"#day1\").append(\"<p class='card-text'>Humidity: \" + futureHumid1 + \"%</p>\")\n\n \n \n \n //Day 2\n\n var futureDate2 = moment().add(2, 'days').format(\"l\");\n console.log(futureDate2);\n\n $(\"#forecast2\").empty();\n\n $(\"#forecast2\").append(\"<div id='day2' class='card-body'>\");\n \n $(\"#day2\").append(\"<h5 class='card-title'>\" + futureDate2 + \"</h5>\");\n\n var weatherIcon2 = response.list[13].weather[0].icon;\n console.log(weatherIcon2);\n var weatherIcon2 = (\"https://openweathermap.org/img/wn/\" + weatherIcon2 + \"@2x.png\");\n\n $(\"#day2\").append(\"<img src=\" + weatherIcon2 + \">\");\n\n var futureTemp2 = response.list[13].main.temp;\n console.log(futureTemp2);\n\n $(\"#day2\").append(\"<p class='card-text'>Temp: \" + futureTemp2 + \" °F</p>\")\n\n var futureHumid2 = response.list[13].main.humidity;\n console.log(futureHumid2);\n\n $(\"#day2\").append(\"<p class='card-text'>Humidity: \" + futureHumid2 + \"%</p>\")\n\n\n\n //Day 3\n\n\n var futureDate3 = moment().add(3, 'days').format(\"l\");\n console.log(futureDate3);\n\n $(\"#forecast3\").empty();\n\n $(\"#forecast3\").append(\"<div id='day3' class='card-body'>\");\n \n $(\"#day3\").append(\"<h5 class='card-title'>\" + futureDate3 + \"</h5>\");\n\n var weatherIcon3 = response.list[21].weather[0].icon;\n console.log(weatherIcon3);\n var weatherIcon3 = (\"https://openweathermap.org/img/wn/\" + weatherIcon3 + \"@2x.png\");\n\n $(\"#day3\").append(\"<img src=\" + weatherIcon3 + \">\");\n\n var futureTemp3 = response.list[21].main.temp;\n console.log(futureTemp3);\n\n $(\"#day3\").append(\"<p class='card-text'>Temp: \" + futureTemp3 + \" °F</p>\");\n\n var futureHumid3 = response.list[21].main.humidity;\n console.log(futureHumid3);\n\n $(\"#day3\").append(\"<p class='card-text'>Humidity: \" + futureHumid3 + \"%</p>\");\n\n\n //Day 4\n\n var futureDate4 = moment().add(4, 'days').format(\"l\");\n console.log(futureDate4);\n\n $(\"#forecast4\").empty();\n\n $(\"#forecast4\").append(\"<div id='day4' class='card-body'>\");\n \n $(\"#day4\").append(\"<h5 class='card-title'>\" + futureDate4 + \"</h5>\");\n\n var weatherIcon4 = response.list[29].weather[0].icon;\n console.log(weatherIcon4);\n var weatherIcon4 = (\"https://openweathermap.org/img/wn/\" + weatherIcon4 + \"@2x.png\");\n\n $(\"#day4\").append(\"<img src=\" + weatherIcon4 + \">\");\n\n var futureTemp4 = response.list[29].main.temp;\n console.log(futureTemp4);\n\n $(\"#day4\").append(\"<p class='card-text'>Temp: \" + futureTemp4 + \" °F</p>\");\n\n var futureHumid4 = response.list[29].main.humidity;\n console.log(futureHumid4);\n\n $(\"#day4\").append(\"<p class='card-text'>Humidity: \" + futureHumid4 + \"%</p>\");\n \n \n\n //Day 5\n\n var futureDate5 = moment().add(5, 'days').format(\"l\");\n console.log(futureDate5);\n\n $(\"#forecast5\").empty();\n\n $(\"#forecast5\").append(\"<div id='day5' class='card-body'>\");\n \n $(\"#day5\").append(\"<h5 class='card-title'>\" + futureDate5 + \"</h5>\");\n\n var weatherIcon5 = response.list[37].weather[0].icon;\n console.log(weatherIcon5);\n var weatherIcon5 = (\"https://openweathermap.org/img/wn/\" + weatherIcon5 + \"@2x.png\");\n\n $(\"#day5\").append(\"<img src=\" + weatherIcon5 + \">\");\n\n var futureTemp5 = response.list[37].main.temp;\n console.log(futureTemp5);\n\n $(\"#day5\").append(\"<p class='card-text'>Temp: \" + futureTemp5 + \" °F</p>\");\n\n var futureHumid5 = response.list[37].main.humidity;\n console.log(futureHumid5);\n\n $(\"#day5\").append(\"<p class='card-text'>Humidity: \" + futureHumid5 + \"%</p>\");\n\n })\n}", "function fetchWeatherData() {\n if (DEBUG) {\n console.log('Fetching weather data...');\n console.log('Country: ' + country);\n console.log('City: ' + city);\n console.log('WOEID: ' + woeid);\n }\n \n locChanged = (woeid != lastWOEID);\n lastWOEID = woeid;\n\n if (!config.TempUnit || config.TempUnit === '' || config.TempUnit === 'Auto') {\n // Determine temperature units from country code (US gets F, everyone else gets C)\n if (country == 'US')\n unit = 'F';\n else\n unit = 'C';\n } else {\n unit = config.TempUnit;\n }\n\n if (DEBUG) console.log('Unit: ' + unit);\n\n // URL for getting basic weather forecast data in XML format (RSS)\n reqWeather.open('GET', 'http://weather.yahooapis.com/forecastrss?w=' + woeid + '&u=' + unit.toLowerCase(), true);\n // Fetch the weather data\n reqWeather.send(null);\n }", "async function createWeeklyForecast() {\n let thisWeek = []\n apiURL = \"https://cors-anywhere.herokuapp.com/https://api.darksky.net/forecast/c091c8ff8c07a5b4ffebf5621ce1310d/\" + String(latitude) + ',' + String(longitude);\n const darkskyResponse = await fetch(apiURL);\n const forecast = await darkskyResponse.json();\n forecast['daily']['data'].forEach(function (day) {\n thisWeek.push(day)\n })\n thisWeekWeather = thisWeek\n console.log(thisWeekWeather)\n displayWeeklyForecast()\n\n}", "async function getForecast(e) {\n e.preventDefault();\n dispatch(loading(true));\n\n try {\n // Adjusts input format to api requirements\n const locationReq = locationInput.replace(\" \", \"+\");\n\n // Fetch the location in the Google API\n let response = await fetch(\n `https://maps.googleapis.com/maps/api/geocode/json?address=${locationReq}&key=AIzaSyD6rKc6URJVJv5GNgNydJxd19jitau6pg0`\n );\n const locationRes = await response.json();\n\n // Filters the result to extract the city and state from the location\n const filteredLocation = locationRes.results[0].address_components.filter(\n (component) => {\n return (\n component.types.includes(\"administrative_area_level_2\") ||\n component.types.includes(\"administrative_area_level_1\")\n );\n }\n );\n\n // Creates the constants and variables with the information obtained from the API\n const location = {\n city: filteredLocation[0].long_name,\n state: filteredLocation[1].long_name.replace(\"State of \", \"\"),\n };\n const lat = locationRes.results[0].geometry.location.lat;\n const lng = locationRes.results[0].geometry.location.lng;\n\n // Fetch the temperature forecast in the OpenWeather API for the location entered\n response = await fetch(\n `https://api.openweathermap.org/data/2.5/onecall?lat=${lat}&lon=${lng}&appid=99a93a4390907ebb53ea070c0768ecc0&units=metric`\n );\n const forecast = await response.json();\n\n // Creates an array of objects containing the next six hours forecast\n const hourlyForecast = forecast.hourly.slice(0, 6).map((hourForecast) => {\n let date = new Date(hourForecast.dt * 1000);\n return {\n time: date.getHours() + \":00\",\n temperature: Math.trunc(hourForecast.temp) + \"° C\",\n };\n });\n\n // Update the state of the forecastTable with the next six hours forecast\n dispatch(updateTable(hourlyForecast, location)); \n \n } catch (err) {\n console.error(err);\n alert(\"Error when trying to query the servers. Make sure you typed the location correctly and try again.\");\n dispatch(loading(false));\n }\n }", "function aquireCardData(forcast_data) {\n var count = 0;\n for (var i = 0; i < cards.length; i++) {\n var card = cards[i]; // Access array sotring DOM Cards\n card.empty(); //Clear current card of any Data\n\n // Update Data to current Card\n var header = $(\"<div>\");\n header.attr(\"class\", \"card-header\");\n header.attr(\"styles\", \"wdith:100%\");\n //create moment obj out of data time stamp for current card for formatting\n var m = moment(forcast_data.list[count].dt_txt);\n header.text(m.format(\"LL\"));\n\n\n var icon = $(\"<img>\");\n icon.attr(\"src\", \"https://openweathermap.org/img/wn/\" + forcast_data.list[count].weather[0].icon + \"@2x.png\");\n\n // Temp and Humid data\n var body = $(\"<div>\");\n body.attr(\"class\", \"card-body justify-content-left\");\n var card_temp = $(\"<p>\");\n card_temp.attr(\"class\", \"card-text\");\n //conversion from kelvin to ferenheight\n card_temp.text(\"Temperature: \" + Math.round((forcast_data.list[count].main.temp - 273.15) * 9 / 5 + 32) + \"°F.\")\n var card_humid = $(\"<p>\");\n card_humid.attr(\"class\", \"card-text\");\n card_humid.text(\"Humidity: \" + forcast_data.list[count].main.humidity+\"%\");\n\n\n //attach card data to card\n body.append(card_temp);\n body.append(card_humid);\n card.append(header);\n card.append(icon);\n card.append(body);\n\n cards[i].append(card);\n\n count += 8; //forcast data returns an array of 40 data sets, so incrementing by 8 gets us each new day at the same time and allows us to work with a multiple of 5 to say within the scope of current loop\n }\n\n }", "function getForecast(searchValue){\n\n $(\"#forecast\").empty();\n $(\"#titleforecast\").empty();\n\n $.ajax({\n type: \"GET\",\n url: \"https://api.openweathermap.org/data/2.5/forecast?q=\" + searchValue + \"&appid=ba34b33f61113cd89614cfe7a4ca1665&units=imperial\",\n dataType: \"json\",\n success: function(forecast5){\n \n //title 5 Days Forecast\n var titleday = $(\"<h5>\").addClass(\"text-dark\").text(\"5 Days-Forecast\");\n $(\"#titleforecast\").append(titleday);\n \n for(var i = 0; i < forecast5.list.length; i++ )\n {\n \n //Show forecast only 15:00 the each day\n if((forecast5.list[i].dt_txt).indexOf(\"15:00:00\") > -1) {\n\n var forecastday = new Date(forecast5.list[i].dt_txt).toLocaleDateString('en-US');\n var icon = forecast5.list[i].weather[0].icon + \".png\";\n var wind = \"Wind Speed: \" + forecast5.list[i].wind.speed + \" MPH\";\n var humidity = \"Humidity: \" + forecast5.list[i].main.humidity + \"%\";\n var temp = \"Temper: \" + forecast5.list[i].main.temp + String.fromCharCode(176)\n \n var weekday = moment(forecast5.list[i].dt_txt).format('dddd');\n\n \n var divCar = $(\"<div>\").addClass(\"card border-dark mb-3\").css(\"width\", \"20%\");\n var title = $(\"<h4>\").addClass(\"card-header\").text(weekday);\n var subtitle = $(\"<p>\").addClass(\"card-header\").css(\"font-size\", \"small\").text(forecastday);\n var img = $(\"<img>\").attr(\"src\", \"http://openweathermap.org/img/w/\" + icon );\n var divInt = $(\"<div>\").addClass(\"card-body\");\n var wind = $(\"<p>\").addClass(\"text-muted\").css(\"font-size\", \"small\").text(wind);\n var humid = $(\"<p>\").addClass(\"text-muted\").css(\"font-size\", \"small\").text(humidity);\n var temp = $(\"<p>\").addClass(\"text-muted\").css(\"font-size\", \"small\").text(temp);\n \n \n //append all information \n divInt.append(img, temp, humid, wind);\n divCar.append(title, subtitle, divInt);\n \n //merge and add to page\n $(\"#forecast\").append(divCar);\n }\n }\n }\n });\n }", "function populateWeatherForecast(response){\n let index = 1;\n for (i = 8; i < 40; i = i + 8){\n $(\".temp\"+index).text(JSON.stringify(response.list[i].main.temp)+\"\\xB0C\");\n $(\".humidity\"+index).text(JSON.stringify(response.list[i].main.humidity)+\"%\");\n let iconCode = JSON.stringify(response.list[i].weather[0].icon);\n let iconURL = createWeatherIcon(iconCode);\n $(\".card-img\"+index).attr(\"src\", iconURL);\n index ++;\n } \n }", "function getData() {\n var APIkey = \"c19b2f1f085df13be7309df32599c301\";\n var queryURL = \"https://api.openweathermap.org/data/2.5/onecall?lat=\" + lat + \"&lon=\" + lon + \"&exclude=hourly,minutely,alerts&units=imperial&appid=\" + APIkey;\n\n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).then(function(response) {\n console.log(\"--------------------\");\n console.log(\"current date is \" + response.current.dt);\n console.log(\"current temperature is \" + response.current.temp);\n console.log(\"current humidity is \" + response.current.humidity);\n console.log(\"current wind speed is \" + response.current.wind_speed);\n console.log(\"current uv index is \" + response.current.uvi);\n console.log(\"current weather icon is \" + response.current.weather[0].icon);\n console.log(\"--------------------\");\n\n dt = response.current.dt;\n temp = response.current.temp;\n hum = response.current.humidity;\n wind = response.current.wind_speed;\n uvi = response.current.uvi;\n icon = response.current.weather[0].icon;\n daily = response.daily;\n \n currentData(city, dt, temp, hum, wind, uvi, icon);\n forecastData(daily);\n }); \n}", "getWeatherInfo(){\n\t\tlet url = 'https://api.openweathermap.org/data/2.5/weather?q=' + this.state.cityname + '&units=metric&appid=ce0cb4b99e8ee814c20a4f76609c8196'\n\t\tfetch(url)\n\t\t.then(response => response.json())\n\t\t.then(data => {\n\t\t\tconsole.log(data);\n\t\t\t// let tempData = JSON.stringify(data);\n \t// console.log(tempData);\n\t\t\t// alert(tempData);\n\t\t\tthis.processData(data);\t\t\t\n\t\t})\n\t\t.catch(function(error){\n\t\t\tconsole.log(error.message);\n\t\t\tthrow error.message;\n\t\t});\n\n\t\t// this.getForecast();\n\t}", "function forcastWeather(cityName) {\n var forcastUrl = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + cityName + \"&appid=\" + apiKey;\n\n $.ajax({\n url: forcastUrl,\n method: \"GET\"\n }).then(function(response) {\n\n console.log(forcastUrl);\n\n $(\"#forecast\").empty();\n\n var h3 = $(\"<h3>\").text(\"5-Day Forecast:\").css(\"margin-top\", \"20px\");\n $(\"#forecast\").append(h3); \n\n for(var i = 0; i < response.list.length; i+=8) {\n\n console.log(response.list[i]);\n var list = response.list[i];\n\n var formattedDate = new Date(list.dt_txt).toLocaleDateString('en-US');\n var tempInF = (list.main.temp - 273.15) * 1.80 + 32;\n\n var span = $(\"<span>\").addClass(\"span-inline\");\n var div = $(\"<div>\").addClass(\"card text-white bg-primary mb-3 text-center\").css(\"max-width\", \"15rem\");\n var divBody = $(\"<div>\").addClass(\"card-body\");\n\n var date = $(\"<h5>\").addClass(\"card-title\").text(formattedDate);\n var icon = \"<img src='https://openweathermap.org/img/w/\" + list.weather[0].icon + \".png'>\";\n var temp = $(\"<p>\").addClass(\"card-title\").text(\"Temperatre: \" + tempInF.toFixed(2) + \" °F\");\n var humidity = $(\"<p>\").addClass(\"card-title\").text(\"Humidity: \" + list.main.humidity + \" %\");\n \n divBody.append(date, icon, temp, humidity);\n div.append(divBody); \n span.append(div);\n $(\"#forecast\").append(span); \n }\n });\n}", "function weather() {\n\n var queryURL = \"https://api.openweathermap.org/data/2.5/weather?\" + city2 + \"&appid=2e8607b62456c51a7a708a2c72eaa6bf\";\n\n $.ajax({\n url: queryURL,\n method: \"GET\" \n })\n \n .then(function(response) {\n\n $(\".citylist\").addClass(\"card\");\n $(\".citydata\").addClass(\"card\");\n $(\".forecast\").addClass(\"card\");\n\n $(\"#date1\").text(day1);\n $(\"#date2\").text(day2);\n $(\"#date3\").text(day3);\n $(\"#date4\").text(day4);\n $(\"#date5\").text(day5);\n\n $(\"#heading\").text(response.name + \" (\" + today + \")\");\n\n var list = $(\"<li>\").text(response.name).addClass(\"list-group-item\");\n $(\"ul\").prepend(list);\n\n localStorage.setItem(\"prevSearch\", response.name);\n\n var icon0 = JSON.stringify(response.weather[0].icon).slice(1,4);\n $(\"#icon\").attr(\"src\", \"http://openweathermap.org/img/wn/\" + icon0 + \"@2x.png\"); \n\n var lat = response.coord.lat;\n console.log(lat);\n var lon = response.coord.lon;\n console.log(lon);\n\n var queryURLCity5 = \"https://api.openweathermap.org/data/2.5/onecall?lat=\" + lat + \"&lon=\" + lon + \"&exclude=minutely,hourly,&appid=2e8607b62456c51a7a708a2c72eaa6bf\";\n\n $.ajax({\n url: queryURLCity5,\n method: \"GET\"\n })\n\n .then(function(response5) {\n // Current\n var tempK = response5.current.temp;\n var tempF = \"Temperature: \" + ((tempK - 273.15)*(9/5)+32).toFixed(1) + \"\\u00B0F\";\n $(\"#tempFDisplay\").text(tempF);\n var humidity = \"Humidity: \" + response5.current.humidity + \"%\";\n $(\"#humidityDisplay\").text(humidity);\n var wind = \"Wind Speed: \" + response5.current.wind_speed + \" MPH\";\n $(\"#windDisplay\").text(wind);\n var uvi = \"UV Index: \" + response5.current.uvi;\n $(\"#uviDisplay\").text(uvi);\n\n // Day 1\n var tempK1 = response5.daily[1].temp.day;\n var tempF1 = \"Temp: \" + ((tempK1 - 273.15)*(9/5)+32).toFixed(1) + \"\\u00B0F\";\n $(\"#tempFDisplay1\").text(tempF1);\n var hum1 = \"Humidity: \" + response5.daily[1].humidity + \"%\";\n $(\"#humidityDisplay1\").text(hum1);\n var icon1 = JSON.stringify(response5.daily[1].weather[0].icon).slice(1,4);\n $(\"#iconDisplay1\").attr(\"src\", \"http://openweathermap.org/img/wn/\" + icon1 + \"@2x.png\");\n\n // Day 2\n var tempK2 = response5.daily[2].temp.day;\n var tempF2 = \"Temp: \" + ((tempK2 - 273.15)*(9/5)+32).toFixed(1) + \"\\u00B0F\";\n $(\"#tempFDisplay2\").text(tempF2);\n var hum2 = \"Humidity: \" + response5.daily[2].humidity + \"%\";\n $(\"#humidityDisplay2\").text(hum2);\n var icon2 = JSON.stringify(response5.daily[2].weather[0].icon).slice(1,4);\n $(\"#iconDisplay2\").attr(\"src\", \"http://openweathermap.org/img/wn/\" + icon2 + \"@2x.png\");\n\n // Day 3\n var tempK3 = response5.daily[3].temp.day;\n var tempF3 = \"Temp: \" + ((tempK3 - 273.15)*(9/5)+32).toFixed(1) + \"\\u00B0F\";\n $(\"#tempFDisplay3\").text(tempF3);\n var hum3 = \"Humidity: \" + response5.daily[3].humidity + \"%\";\n $(\"#humidityDisplay3\").text(hum3);\n var icon3 = JSON.stringify(response5.daily[3].weather[0].icon).slice(1,4);\n $(\"#iconDisplay3\").attr(\"src\", \"http://openweathermap.org/img/wn/\" + icon3 + \"@2x.png\");\n\n // Day 4\n var tempK4 = response5.daily[4].temp.day;\n var tempF4 = \"Temp: \" + ((tempK4 - 273.15)*(9/5)+32).toFixed(1) + \"\\u00B0F\";\n $(\"#tempFDisplay4\").text(tempF4);\n var hum4 = \"Humidity: \" + response5.daily[4].humidity + \"%\";\n $(\"#humidityDisplay4\").text(hum4);\n var icon4 = JSON.stringify(response5.daily[4].weather[0].icon).slice(1,4);\n $(\"#iconDisplay4\").attr(\"src\", \"http://openweathermap.org/img/wn/\" + icon4 + \"@2x.png\");\n\n // Day 5\n var tempK5 = response5.daily[5].temp.day;\n var tempF5 = \"Temp: \" + ((tempK5 - 273.15)*(9/5)+32).toFixed(1) + \"\\u00B0F\";\n $(\"#tempFDisplay5\").text(tempF5);\n var hum5 = \"Humidity: \" + response5.daily[5].humidity + \"%\";\n $(\"#humidityDisplay5\").text(hum5);\n var icon5 = JSON.stringify(response5.daily[5].weather[0].icon).slice(1,4);\n $(\"#iconDisplay5\").attr(\"src\", \"http://openweathermap.org/img/wn/\" + icon5 + \"@2x.png\");\n });\n });\n}", "function fiveDay(lat, lon) {\n // Show the forecast cards\n $(\".forecast\").show();\n // Empty the forecast cards so info is not appended over other info\n $(\"#forecast1\").empty();\n $(\"#forecast2\").empty();\n $(\"#forecast3\").empty();\n $(\"#forecast4\").empty();\n $(\"#forecast5\").empty();\n // AJAX call\n $.ajax({\n url:\n \"https://api.openweathermap.org/data/2.5/onecall?lat=\" +\n lat +\n \"&lon=\" +\n lon +\n \"&exclude=minutely,current,hourly,alerts&units=imperial&appid=\" +\n APIKey,\n method: \"GET\",\n success: function (fiveForecast) {\n for (var i = 0; i < 6; i++) {\n var getfivedayIcon = fiveForecast.daily[i].weather[0].icon;\n fivedayIcon =\n \"https://openweathermap.org/img/wn/\" + getfivedayIcon + \"@2x.png\";\n var time = fiveForecast.daily[i].dt;\n var newTime = moment.unix(time).format(\"MM/DD/YYYY\");\n\n $(\"#forecast\" + [i]).append(newTime);\n $(\"#forecast\" + [i]).append(\"<img src=\" + fivedayIcon + \">\");\n $(\"#forecast\" + [i]).append(\n \"\\nTemp: \" + fiveForecast.daily[i].temp.day + \" &deg;F\"\n );\n $(\"#forecast\" + [i]).append(\n \"\\nHumidity: \" + fiveForecast.daily[i].humidity + \"%\"\n );\n }\n },\n });\n}", "function weatherForecast() {\n $('#forecast').html('');\n $('#current').html('');\n $('#currentCity').html('')\n $.get(\"https://api.openweathermap.org/data/2.5/onecall?units=imperial&lat=\" + coordinates[0] + \"&lon=\" + coordinates[1] + \"&exclude=hourly,minutely&appid=\" + WEATHER_MAP_TOKEN)\n .done(function (resp) {\n console.log(resp);\n\n //Gets the location by coordinates and displays the city name\n reverseGeocode(marker.getLngLat(), MAPBOX_ACCESS_TOKEN).then(function (res) {\n $('#currentCity').append('<h4>' + res.features[2].place_name + '</h4>');\n })\n\n //outputs the current weather condition\n var currentConditions = '<ul class=\"currentWeather\"><h5>Current Conditions</h5>'\n // Capitalize current weather description\n var weatherConditions = resp.current.weather[0].description;\n var currentWeather = weatherConditions.split(\" \");\n //capitalizes the city name\n for (let i = 0; i < currentWeather.length; i++) {\n currentWeather[i] = currentWeather[i][0].toUpperCase() + currentWeather[i].substr(1);\n }\n currentConditions += '<li>' + currentWeather.join(\" \") + '</li>'\n currentConditions += '<li>Temperature: ' + resp.current.temp.toFixed(0) + ' &degF</li>';\n currentConditions += '<li>Feels like: ' + resp.current.feels_like.toFixed(0) + ' &degF</li>';\n currentConditions += '<li>Humidity: ' + resp.current.humidity + '&percnt;</li>';\n currentConditions += '</ul>';\n $('#current').append(currentConditions);\n\n //if there is a weather alert it will display bold and red background\n if (resp.alerts) {\n var weatherAlert = resp.alerts[0].description + '<button id=\"close\">Close</button>';\n $('#alert').append(weatherAlert);\n\n //Close weather alert when close button is clicked\n $('#close').click(function () {\n $('#alert').addClass('warning')\n });\n }\n\n //loop for the daily forecast\n for (var i = 0; i < 5; i++) {\n var dailyForecast = resp.daily[i];\n var weatherPic;\n\n //sets which weather icons to use based on the weather conditions\n if (dailyForecast.clouds <= 20) {\n weatherPic = '<img src=\"img/sunny.png\"class=\"card-img-top\" alt=\"Mostly sunny\">';\n } else if (dailyForecast.clouds > 20 && dailyForecast.clouds <= 60) {\n if (dailyForecast.rain >= .2 && dailyForecast.rain < .8) {\n weatherPic = '<img src=\"img/rainchance.png\"class=\"card-img-top\" alt=\"Chance of showers\">';\n } else if (dailyForecast.rain >= .8) {\n weatherPic = '<img src=\"img/rain.png\"class=\"card-img-top\" alt=\"Rain\">';\n } else {\n weatherPic = '<img src=\"img/partlycloudy.png\"class=\"card-img-top\" alt=\"Partly Cloudy\">';\n }\n } else if (dailyForecast.clouds >= 60) {\n if (dailyForecast.rain >= .1 && dailyForecast.rain < .8) {\n weatherPic = '<img src=\"img/rainchance.png\"class=\"card-img-top\" alt=\"Chance of showers\">';\n } else if (dailyForecast.rain >= .8) {\n weatherPic = '<img src=\"img/rain.png\"class=\"card-img-top\" alt=\"Rain\">';\n } else {\n weatherPic = '<img src=\"img/mostlycloudy.png\"class=\"card-img-top\" alt=\"Mostly Cloudy\">';\n }\n }\n\n //Changes the date string to readable\n var date = new Date(dailyForecast.dt * 1000);\n var humanDay = date.toLocaleString('en-us', {weekday: 'short'});\n var humanMonth = date.toLocaleString('en-us', {month: 'long'});\n var humanDate = date.toLocaleString('en-us', {day: 'numeric'});\n var sunrise = new Date(dailyForecast.sunrise * 1000);\n var humanSunRise = sunrise.toLocaleTimeString('en-US');\n var sunset = new Date(dailyForecast.sunset * 1000);\n var humanSunSet = sunset.toLocaleTimeString('en-US');\n\n //Creates each individual days card\n var newForecast = '<div class=\"image-flip\" ontouchstart=\"this.classList.toggle(\\'hover\\');\">';\n newForecast += '<div class=\"mainflip\">';\n newForecast += '<div class=\"frontside\">';\n newForecast += '<div class=\"card\">';\n newForecast += weatherPic;\n newForecast += '<div class=\"card-header\"><h5>' + humanDay + ' ' + humanMonth + ' ' + humanDate + '</h5></div>';\n newForecast += '<ul class=\"list-group list-group-flush\">';\n newForecast += '<li class=\"list-group-item\">High / Low </br>';\n newForecast += dailyForecast.temp.max.toFixed(1) + '&degF / ';\n newForecast += +dailyForecast.temp.min.toFixed(1) + ' &degF</li>';\n newForecast += '<li class=\"list-group-item\">Humidity: ' + dailyForecast.humidity + '&percnt;</li>';\n newForecast += '<li class=\"list-group-item\">Chance of precipitation: ' + (dailyForecast.pop * 100).toFixed(0) + '&percnt;</li>';\n newForecast += '</ul>';\n newForecast += '</div>';\n newForecast += '</div>';\n newForecast += '<div class=\"backside\">';\n newForecast += '<div class=\"card\">';\n newForecast += '<ul class=\"list-group list-group-flush\">';\n newForecast += weatherPic;\n newForecast += '<li class=\"list-group-item\">Dew Point: ';\n newForecast += dailyForecast.dew_point.toFixed(1) + ' &degF</li>';\n newForecast += '<li class=\"list-group-item\">Winds: ' + dailyForecast.wind_speed + ' mph</li>';\n newForecast += '<li class=\"list-group-item\">Conditions: ' + dailyForecast.weather[0].description + '</li>';\n newForecast += '<li class=\"list-group-item\">Sunrise: ' + humanSunRise + '</li>';\n newForecast += '<li class=\"list-group-item\">Sunset: ' + humanSunSet + '</li>';\n newForecast += '</ul>';\n newForecast += '</div>';\n newForecast += '</div>';\n newForecast += '</div>';\n newForecast += '</div>';\n\n $('#forecast').append(newForecast);\n }\n });\n }", "function renderForecast(data) {\n // Add city and timestamp to elements\n document.querySelector('#city')\n .textContent = `Weather forecast for ${data.location.name}, ${data.location.country} on ${getDay()}`;\n document.querySelector('#updated')\n .textContent = `Last updated on ${getDay()} ${data.current.last_updated}`;\n\n // Add specific current weather data\n document.querySelector(`#day-1 .feels-like`)\n .textContent = `Feels like ${Math.round(data.current.feelslike_c)} °C`;\n document.querySelector(`#day-1 .pressure`)\n .textContent = `Pres. ${(data.current.pressure_mb / 1000).toFixed(3)} bar`;\n\n // Add weather data to elements\n let counter = 1;\n data.forecast.forecastday.forEach(forecastday => {\n if (counter === 2)\n document.querySelector(`#day-${counter} .day`).textContent = 'Tomorrow';\n else\n document.querySelector(`#day-${counter} .day`).textContent = getDay(counter - 1);\n\n document.querySelector(`#day-${counter} .icon`)\n .setAttribute('src', `https:${forecastday.day.condition.icon}`);\n document.querySelector(`#day-${counter} .temp`)\n .textContent = Math.round(forecastday.day.avgtemp_c) + ' °C';\n document.querySelector(`#day-${counter} .conditions`)\n .textContent = forecastday.day.condition.text;\n document.querySelector(`#day-${counter} .diff-temp`)\n .textContent = `Temps ${Math.round(forecastday.day.mintemp_c)} to ${Math.round(forecastday.day.maxtemp_c)} °C`;\n document.querySelector(`#day-${counter} .humidity`)\n .textContent = `Humidity ${forecastday.day.avghumidity}%`;\n document.querySelector(`#day-${counter} .rain`)\n .textContent = `Rain ${forecastday.day.totalprecip_mm} mm`;\n document.querySelector(`#day-${counter} .max-wind`)\n .textContent = `Wind ${(forecastday.day.maxwind_kph / 3.6).toFixed(2)} m/s`;\n document.querySelector(`#day-${counter} .sunrise`)\n .textContent = forecastday.astro.sunrise;\n document.querySelector(`#day-${counter} .sunset`)\n .textContent = forecastday.astro.sunset;\n counter++;\n });\n\n // Add location to search field\n document.getElementById('city-input').placeholder = data.location.name;\n document.getElementById('city-input').value = '';\n\n // Unhide forecast\n document.getElementById('forecast').classList.remove('hide');\n document.getElementById('day-1').classList.remove('hide');\n}", "function weatherForecastDisplay(city){\n \n var urlForecast = \"https://api.openweathermap.org/data/2.5/forecast?q=\"+city+\"&units=imperial&appid=99301d0cd337422b7e967fbf9be0bf70\";\n $.ajax({\n url:urlForecast,\n method: \"GET\"})\n .then(function(response){\n \n \n //getting info of each day\n for(var i=9; i < 42; i=i+8 ) {\n if(i > 33){\n i=39;\n }\n \n var dateWeather1 = response.list[i].dt_txt;\n var tempWeather1 = response.list[i].main.temp_max;\n var tempMWeather1 = response.list[i].main.temp_min;\n var humWeather1 = response.list[i].main.humidity;\n var skyWeather1 = response.list[i].weather[0].main;\n var imgskyWeather1 = response.list[i].weather[0].icon;\n var urlimgsky = \"https://openweathermap.org/img/wn/\"+imgskyWeather1+\"@2x.png\";\n\n\n //Making Cards\n var divP=$(\"#cards-days\");\n \n var div1 = $(\"<div>\");\n div1.addClass(\"card text-white bg-info\");\n var div2 = $(\"<div>\");\n div2.addClass(\"card-header\");\n dateWeather = moment(dateWeather1).format('ll');\n var div2text=div2.text(dateWeather); \n var div3 = $(\"<div>\");\n div3.addClass(\"card-body\");\n var p1 = $(\"<p>\");\n p1.addClass(\"card-text letter-card\");\n var p1text = p1.text(\" Temp Max :\" + tempMWeather1 + \" F Temp Min ;\"+ tempMWeather1+\"F Humidity : \"+humWeather1+\"% \\n Sky :\"+skyWeather1);\n \n\n\n divP.append(div1);\n div1.append(div2);\n div2.append(div3);\n div3.append(p1);\n \n }\n });\n \n }", "function makeForecastCard(card_data) {\n\tvar location = card_data.location;\n\n\t// Empty the forecast card\n\tdocument.querySelector('.' + location + ' .forecast-wrapper').innerHTML = '';\n\n\t// Loop through the days\n\tfor (i = 0; i < card_data.forecast.data.length; i++) {\n\t\tvar day_card_data = card_data.forecast.data[i];\n\n\t\t// Day of the Week\n\t\tvar current_day = moment.unix(day_card_data.time).tz(card_data.timezone).format('dddd');\n\t\tvar current_date = moment.unix(day_card_data.time).tz(card_data.timezone).format('MMM Do');\n\n\t\t// Summary\n\t\tif (day_card_data.summary !== undefined) {\n\t\t\tvar summary = day_card_data.summary;\n\t\t} else {\n\t\t\tvar summary = 'Forecast summary not available.';\t\t\t\n\t\t}\n\n\t\t// Icon\n\t\tif (day_card_data.icon !== undefined) {\n\t\t\tvar icon = '<svg class=\"forecast-icon\"><use xlink:href=\"#' + day_card_data.icon + '\"></use></svg>';\n\t\t} else {\n\t\t\tvar icon = '<svg><use xlink:href=\"#clear\"></use></svg>';\t\t\t\n\t\t}\n\t\t\n\t\t// High Temperature + Card Color\n\t\tif (day_card_data.temperatureHigh !== undefined) {\n\t\t\tvar temperature_high = formatTemp(day_card_data.temperatureHigh);\n\t\t\tvar class_name = ' ' + cardColorScale(card_data.units, day_card_data.temperatureHigh);\n\t\t} else {\n\t\t\tvar temperature_high = '--&deg;';\n\t\t\tvar class_name = '';\t\t\t\n\t\t}\n\n\t\t// Low Temperature\n\t\tif (day_card_data.temperatureLow !== undefined) {\n\t\t\tvar temperature_low = formatTemp(day_card_data.temperatureLow);\n\t\t} else {\n\t\t\tvar temperature_low = '--&deg;';\t\t\t\n\t\t}\n\n\t\t// Make the card\n\t\tvar forecast_item = '<div class=\"forecast-item-wrapper full' + class_name + '\" tabindex=\"1\">' \n\t\t\t\t+ '<div class=\"forecast-item\">'\n\t\t\t\t\t+ '<div class=\"forecast-day-wrapper\">' \n\t\t\t\t\t\t+ '<div class=\"forecast-day\">' + current_day + '</div>'\n\t\t\t\t\t\t// + '<div class=\"forecast-date\">' + current_date + '</div>'\n\t\t\t\t\t+ '</div>'\n\t\t\t\t\t+ '<div class=\"forecast-temperature-wrapper\">' \n\t\t\t\t\t\t+ icon\n\t\t\t\t\t\t+ '<div class=\"forecast-temperature high\">' + temperature_high + '</div>'\n\t\t\t\t\t\t+ '<div class=\"forecast-temperature low\">' + temperature_low + '</div>'\n\t\t\t\t\t+ '</div>'\n\t\t\t\t+ '</div>'\n\t\t\t+ '</div>';\n\n\t\t// Add the card to `.forecast-wrapper`\n\t\tappend(location, 'forecast-wrapper', forecast_item);\n\t}\n}", "function getWeather(cityName){\n console.log(\"running getweather function\")\n\n ///lat and lon changing promies together mdevelopers network \n var latLonByCity = `https://nominatim.openstreetmap.org/?city=${cityName}&format=json&limit=1`;\n fetch(latLonByCity)\n .then(function (response) {\n return response.json();\n })\n .then(function(dataLatLon) {\n console.log(dataLatLon);\n latit = dataLatLon[0].lat;\n longit = dataLatLon[0].lon;\n //we are chainig the fetch to the openweathermap to the nominatim fetch\n var weatherByCity = `https://api.openweathermap.org/data/2.5/onecall?lat=${latit}&lon=${longit}&exclude=hourly,minutely&units=imperial&appid=${key}`;\n return fetch(weatherByCity)\n })\n .then(function (response) {\n return response.json();\n })\n .then(function (data) {\n console.log(\"charging\")\n var icon = data.current.weather[0].icon;\n currentCity.text(cityName);\n currentDatet.text(currentDate);\n currentDatet.append(`<img class=\"img-fluid mx-auto d-block\" src=\"http://openweathermap.org/img/wn/${icon}@2x.png\" style=\"width:150px;height:150px;\">`);\n currentTemp.text(data.current.temp);\n currentWind.text(data.current.wind_speed);\n currentHum.text(data.current.humidity);\n var currentUvi = data.current.uvi;\n currentUv.text(currentUvi);\n\n day1.empty();\n day2.empty();\n day3.empty();\n day4.empty();\n day5.empty();\n\n // 5day forecast(data) function\n for (let i=0; i<5; i++) {\n var nextDay = moment().add(i+1, \"d\").format(\"M/DD/YYYY\");\n var fiveDay = $(\"#day\" + i);\n fiveDay.append(`<h4 class=\"daylet\">Day ${i+1} </h4>`);\n fiveDay.append(`<div class=\"data mt-3\">${nextDay}</div>`);\n var nextIcon = data[\"daily\"][i].weather[0][\"icon\"];\n fiveDay.append(`<img class=\"img-fluid mx-auto d-block\" src=\"http://openweathermap.org/img/wn/${nextIcon}@2x.png\" style=\"width:100px;height:100px;\">`);\n fiveDay.append('<div class=\"data\">Temperature: ' + data['daily'][i].temp.day + ' F </div>');\n fiveDay.append('<div class=\"data\">Wind: ' + data['daily'][i].wind_speed + ' mph </div>');\n fiveDay.append('<div class=\"data\">Humidity: ' + data['daily'][i].humidity + ' % </div>');\n }\n });\n}", "function getFiveDay(){\n //Get users city choice\n var city = $(\"#search-city\").val();\n\n //Pass in users choice and API key into query URL/ Using forecast endpoint\n var queryURL = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + city + \"&units=imperial&per_page=5&appid=\" + APIKey;\n\n //API call \n fetch(queryURL)\n //handle any errors\n .then(handleErrors)\n //response information\n .then(function(response){\n //Turned into JSON format\n return response.json();\n })\n //Data returned\n .then(function(data){\n //Testing purposes\n console.log(data);\n console.log(\"RIGHT HERE\")\n //Clear out text to generate new info\n $(\"#five-day-forecast\").text(\"\");\n\n //FIVE DAY FORECAST SECTION\n //Header\n var fiveDayHeader = document.createElement('h2');\n fiveDayHeader.textContent = \"5-Day Forecast\";\n $('#five-day-forecast').append(fiveDayHeader);\n //Div to hold all the cards\n var foreCastDivEl = document.createElement('div');\n foreCastDivEl.setAttribute('id', \"fiveDayList\")\n foreCastDivEl.classList.add(\"d-inline-flex\",\"flex-wrap\");\n\n //For loop to loop through all forecast data\n for(var i = 0; i < data.list.length; i ++){\n //Holds list element\n var dayData = data.list[i];\n //Offset time information found on google\n var dayTimeUTC = dayData.dt;\n var timeZoneOffset = data.city.timezone;\n var timeZoneOffsetHours = timeZoneOffset / 60 / 60;\n\n //Current moment and pass in all offset information\n var currentMoment = moment.unix(dayTimeUTC).utc().utcOffset(timeZoneOffsetHours);\n\n //Icon\n var iconUrl = \"https://openweathermap.org/img/w/\" + dayData.weather[0].icon + \".png\";\n\n //Gets data from mid-day for 5 day forecast. Data returns 40 items 5 days split into 8 parts 3 hours between\n if(currentMoment.format(\"HH:mm:ss\") == \"11:00:00\" || currentMoment.format(\"HH:mm:ss\") == \"12:00:00\" || currentMoment.format(\"HH:mm:ss\") == \"13:00:00\"){\n //Div to hold all cards\n var cardDivEl = document.createElement('div');\n cardDivEl.classList.add(\"weather-card\", \"card\", \"m-2\", \"p0\");\n\n //List for the cards being created\n var cardListEl = document.createElement(\"ul\");\n cardListEl.classList.add(\"list-unstyled\", \"p-3\");\n \n //Date\n var dateListItem = document.createElement('li');\n dateListItem.textContent = currentMoment.format(\"MM/DD/YY\");\n cardListEl.append(dateListItem);\n\n //Icon \n var iconListItem = document.createElement('li');\n var iconImg = document.createElement('img')\n iconImg.setAttribute('src', iconUrl);\n iconListItem.append(iconImg);\n cardListEl.append(iconListItem);\n\n //Temperature\n var cardTempListItem = document.createElement('li');\n cardTempListItem.textContent = \"Temp: \" + dayData.main.temp + String.fromCharCode(8457);\n cardListEl.append(cardTempListItem);\n\n //Humidity\n var cardHumListItem = document.createElement('li');\n cardHumListItem.textContent = \"Hum: \" + dayData.main.humidity + \"%\";\n cardListEl.append(cardHumListItem);\n\n //Append everything to the page\n cardDivEl.append(cardListEl);\n foreCastDivEl.append(cardDivEl);\n }\n }\n\n //Append everything to the fove day forecast dic element\n $(\"#five-day-forecast\").append(foreCastDivEl);\n })\n}", "function updateForecastDisplay(forecastData) {\n forecastData = JSON.parse(forecastData);\n\n // Day 1 Information\n var day1Temp = forecastData.daily[0].temp.max;\n var day1Img = 'https://openweathermap.org/img/w/' + forecastData.daily[0].weather[0].icon + '.png';\n var day1Hum = forecastData.daily[0].humidity;\n document.getElementById('temp1').textContent = day1Temp;\n document.getElementById('img1').src = day1Img;\n document.getElementById('humidity1').textContent = day1Hum;\n\n // Day 2 Information\n var day2Temp = forecastData.daily[1].temp.max;\n var day2Img = 'https://openweathermap.org/img/w/' + forecastData.daily[1].weather[0].icon + '.png';\n var day2Hum = forecastData.daily[1].humidity;\n document.getElementById('temp2').textContent = day2Temp;\n document.getElementById('img2').src = day2Img;\n document.getElementById('humidity2').textContent = day2Hum;\n\n // // Day 3 Information\n var day3Temp = forecastData.daily[2].temp.max;\n var day3Img = 'https://openweathermap.org/img/w/' + forecastData.daily[2].weather[0].icon + '.png';\n var day3Hum = forecastData.daily[2].humidity;\n document.getElementById('temp3').textContent = day3Temp;\n document.getElementById('img3').src = day3Img;\n document.getElementById('humidity3').textContent = day3Hum;\n\n // // Day 4 Information\n var day4Temp = forecastData.daily[3].temp.max;\n var day4Img = 'https://openweathermap.org/img/w/' + forecastData.daily[3].weather[0].icon + '.png';\n var day4Hum = forecastData.daily[3].humidity;\n document.getElementById('temp4').textContent = day4Temp;\n document.getElementById('img4').src = day4Img;\n document.getElementById('humidity4').textContent = day4Hum;\n\n // // Day 5 Information\n var day5Temp = forecastData.daily[4].temp.max;\n var day5Img = 'https://openweathermap.org/img/w/' + forecastData.daily[4].weather[0].icon + '.png';\n var day5Hum = forecastData.daily[4].humidity;\n document.getElementById('temp5').textContent = day5Temp;\n document.getElementById('img5').src = day5Img;\n document.getElementById('humidity5').textContent = day5Hum;\n}", "function forecast(param){\n var queryURL5 = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + param + \"&appid=0d8fd75a76f5d938dcb8f8d22cc34916\";\n $.ajax({\n url: queryURL5,\n method: \"GET\"\n })\n .then(function(response){\n // adds date to each 5 day forecast card starting with tomorrow's date, increments 1 day\n $(\".date1\").text(moment().add(1, 'days').format('LL'));\n $(\".date2\").text(moment().add(2, 'days').format('LL'));\n $(\".date3\").text(moment().add(3, 'days').format('LL'));\n $(\".date4\").text(moment().add(4, 'days').format('LL'));\n $(\".date5\").text(moment().add(5, 'days').format('LL'));\n // adds icon to each 5 day forecast card starting with tomorrow, increments 1 day\n $(\".icon1\").attr(\"src\", \"https://openweathermap.org/img/wn/\" + response.list[7].weather[0].icon + \".png\");\n $(\".icon2\").attr(\"src\", \"https://openweathermap.org/img/wn/\" + response.list[15].weather[0].icon + \".png\");\n $(\".icon3\").attr(\"src\", \"https://openweathermap.org/img/wn/\" + response.list[23].weather[0].icon + \".png\");\n $(\".icon4\").attr(\"src\", \"https://openweathermap.org/img/wn/\" + response.list[31].weather[0].icon + \".png\");\n $(\".icon5\").attr(\"src\", \"https://openweathermap.org/img/wn/\" + response.list[39].weather[0].icon + \".png\");\n // sets temperature in fahrenheit for each day of the 5 day forecast\n var temp1 = ((((response.list[7].main.temp - 273.15)*1.8)+32).toFixed(2));\n var temp2 = ((((response.list[15].main.temp - 273.15)*1.8)+32).toFixed(2));\n var temp3 = ((((response.list[23].main.temp - 273.15)*1.8)+32).toFixed(2));\n var temp4 = ((((response.list[31].main.temp - 273.15)*1.8)+32).toFixed(2));\n var temp5 = ((((response.list[39].main.temp - 273.15)*1.8)+32).toFixed(2));\n // adds temperature in fahrenheit to each forecast card \n $(\".temp1\").text(\"Temp: \" + temp1 + \" F\");\n $(\".temp2\").text(\"Temp: \" + temp2 + \" F\");\n $(\".temp3\").text(\"Temp: \" + temp3 + \" F\");\n $(\".temp4\").text(\"Temp: \" + temp4 + \" F\");\n $(\".temp5\").text(\"Temp: \" + temp5 + \" F\");\n // adds humidity to each 5 day forecast card \n $(\".humidity1\").text(\"Humidity: \" + response.list[7].main.humidity + \"%\");\n $(\".humidity2\").text(\"Humidity: \" + response.list[15].main.humidity + \"%\");\n $(\".humidity3\").text(\"Humidity: \" + response.list[23].main.humidity + \"%\");\n $(\".humidity4\").text(\"Humidity: \" + response.list[31].main.humidity + \"%\");\n $(\".humidity5\").text(\"Humidity: \" + response.list[39].main.humidity + \"%\");\n })\n}", "function getWeatherInfo () {\n\n const long = App.city.longitude;\n const lat = App.city.latitude;\n const url = \"https://api.darksky.net/forecast/8877941a6145fd159c584b8f95b52bb9/\" + lat + \",\" + long + \"?callback=?\";\n\n $.ajax({\n url: url,\n dataType: \"jsonp\",\n success: function (json) {\n App.weatherForecast = json;\n }\n }).done(function () {\n updateWeatherInfo(App.weatherForecast);\n });\n\n }", "function forecast(cityid){\n var dayover= false;\n var queryforcastURL=\"https://api.openweathermap.org/data/2.5/forecast?id=\"+cityid+\"&appid=\"+APIKey;\n $.ajax({\n url:queryforcastURL,\n method:\"GET\"\n }).then(function(response){\n \n for (i=0;i<5;i++){\n var date= new Date((response.list[((i+1)*8)-1].dt)*1000).toLocaleDateString();\n var iconcode= response.list[((i+1)*8)-1].weather[0].icon;\n var iconurl=\"https://openweathermap.org/img/wn/\"+iconcode+\".png\";\n var tempK= response.list[((i+1)*8)-1].main.temp;\n var tempF=(((tempK-273.5)*1.80)+32).toFixed(2);\n var humidity= response.list[((i+1)*8)-1].main.humidity;\n \n $(\"#fDate\"+i).html(date);\n $(\"#fImg\"+i).html(\"<img src=\"+iconurl+\">\");\n $(\"#fTemp\"+i).html(tempF+\"&#8457\");\n $(\"#fHumidity\"+i).html(humidity+\"%\");\n }\n \n });\n}", "function forecast(cityid){\n var dayover= false;\n var queryforcastURL=\"https://api.openweathermap.org/data/2.5/forecast?id=\"+cityid+\"&appid=\"+APIKey;\n $.ajax({\n url:queryforcastURL,\n method:\"GET\"\n }).then(function(response){\n \n for (i=0;i<5;i++){\n var date= new Date((response.list[((i+1)*8)-1].dt)*1000).toLocaleDateString();\n var iconcode= response.list[((i+1)*8)-1].weather[0].icon;\n var iconurl=\"https://openweathermap.org/img/wn/\"+iconcode+\".png\";\n var tempK= response.list[((i+1)*8)-1].main.temp;\n var tempF=(((tempK-273.5)*1.80)+32).toFixed(2);\n var humidity= response.list[((i+1)*8)-1].main.humidity;\n \n $(\"#fDate\"+i).html(date);\n $(\"#fImg\"+i).html(\"<img src=\"+iconurl+\">\");\n $(\"#fTemp\"+i).html(tempF+\"&#8457\");\n $(\"#fHumidity\"+i).html(humidity+\"%\");\n }\n \n });\n}", "static async updateTemp() { \n\t\tlet weatherData = await Weather.getWeather();\n document.querySelector(\".wind-dir\").innerHTML = `${weatherData[0].wind_deg} <sup>o</sup>`;\n document.querySelector(\".wind-speed\").innerText = `${weatherData[0].wind_speed} km/h`;\n\t\tlet forecasts = Array.from(forecastContents);\n\t\tforecasts.forEach(item => {\n\t\t\tlet temp = Math.round(weatherData[forecasts.indexOf(item)].temp.day);\n\t\t\titem.querySelector(\".degree-num\").innerText = `${temp}`;\t\t\n\t\t})\n\t}", "generateWeatherInfo() {\n this.resetGeneratedFields();\n var loc = this.hikingLocation;\n var url = [\"https://aerisweather1.p.rapidapi.com/forecasts/\",\n loc,\n \"?&format=json&filter=daynight&limit=14&fields=periods.dateTimeISO,periods.weather,\",\n \"periods.maxFeelslikeC,periods.pop,periods.minFeelslikeC,periods.windSpeedMaxKPH\",\n \"&client_id=CLIENT_ID&client_secret=CLIENT_SECRET\"].join('');\n var targetDate = this.date+\"T07:00\";\n\n fetch(url, {\n \"method\": \"GET\",\n \"headers\": {\n \"x-rapidapi-key\": \"6410c7d05cmsh7ac6db65b556335p1da092jsna484b7bebcdf\",\n \"x-rapidapi-host\": \"aerisweather1.p.rapidapi.com\"\n }\n })\n .then(response => {\n console.log(response);\n return response.json();\n })\n .then((data) => {\n console.log(data)//Log the json response\n if (data.success == true && data.error == null) {\n console.log(\"Successful JSON\");\n var periods = data.response[0].periods;\n // Iterate through each weather period searching for the target date\n // Once target date is found, set class fields\n for(var i = 0; i < periods.length; i++) {\n var period = periods[i];\n var periodDate = period.dateTimeISO.substring(0,16);\n if(periodDate == targetDate) {\n console.log(period);//Log the period to console\n this.weather = period.weather;\n if(this.weather.includes(\" with\")) {\n this.clouds = this.weather.substring(0, this.weather.indexOf(\" with\"));\n } else {\n this.clouds = this.weather;\n }\n this.clouds = this.clouds.toLowerCase();\n this.pop = period.pop;\n this.wind = period.windSpeedMaxKPH;\n this.minFeelsLike = period.minFeelslikeC;\n this.maxFeelsLike = period.maxFeelslikeC;\n this.generatedCorrectly = true;\n }\n }\n }\n })\n .catch(err => {\n console.error(err);\n });\n\n }", "function openWeatherAPICall() {\n var locationWeather = userLocation;\n var apiKeyWeather = \"cbe15fe8bd11f0165e29631925aca3d4\";\n\n var queryURLOpenWeather = \"https://api.openweathermap.org/data/2.5/weather?q=\" + locationWeather + \"&appid=\" + apiKeyWeather + \"&units=imperial\";\n var queryURLForecast = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + locationWeather + \"&appid=\" + apiKeyWeather + \"&units=imperial\";\n\n // This AJAX calls the current weather for the destination city based on userLocation\n\n $.ajax({\n url: queryURLOpenWeather,\n method: \"GET\"\n }).then(function (response) {\n\n var weatherOverlay = $(\"<div class='weather-div'>\")\n\n var infoWeatherOverlay = `<p><h5>Today's Weather Information for ${response.name}</h5></p><hr><p>Temperature: ${response.main.temp} F</p><p>High Temperature: ${response.main.temp_max} F</p><p>Low Temperature: ${response.main.temp_min} F</p><p>Wind Speed ${response.wind.speed} mph</p><p>Current Conditions: ${response.weather[0].description}</p><hr><h5>5 Day Forecast For ${response.name}</h5><hr>`;\n\n weatherOverlay.append(infoWeatherOverlay);\n $(\"#forecastBox\").prepend(weatherOverlay);\n });\n\n // This AJAX calls the forecasted weather for the destination city based on userLocation\n\n $.ajax({\n url: queryURLForecast,\n method: \"GET\"\n }).then(function (response) {\n console.log(response)\n\n for (var i = 7; i < 40; i += 8) {\n\n var weatherForecast = (moment(response.list[i].dt_txt, \"YYYY-MM-DD h:mm:ss\").format(\"dddd, MMMM Do, h:mma\"));\n console.log(weatherForecast)\n\n var forecastOverlay = $(\"<div class='forecast-div'>\");\n\n var forecastWeatherOverlay = `<p>Date: ${weatherForecast}</p><p>Temperature: ${response.list[i].main.temp} F</p><p>Current Conditions: ${response.list[i].weather[0].description}</p><p>Wind Speed: ${response.list[i].wind.speed} mph</p><hr>`\n\n forecastOverlay.append(forecastWeatherOverlay);\n $(\"#forecastBox\").append(forecastOverlay);\n \n }\n \n });\n}", "function getForecast(location){\n $(\"#forecast-list\").hide();\n var APIreq2;\n if (unit==\"F\"){\n APIreq2 = \"http://api.openweathermap.org/data/2.5/forecast?lat=\" + location.coords.latitude+ \"&lon=\" + location.coords.longitude + \"&APPID=d28f2b67e33e29e7b0c17e04a19ff788&units=imperial\";\n }\n else if(unit==\"C\"){\n APIreq2 = \"http://api.openweathermap.org/data/2.5/forecast?lat=\" + location.coords.latitude+ \"&lon=\" + location.coords.longitude + \"&APPID=d28f2b67e33e29e7b0c17e04a19ff788&units=metric\";\n }\n $.getJSON(APIreq2,function(forecast){\n //clear out section that holds forecast, in case of unit change:\n $(\"#forecast-list\").html(\"\");\n //forecast holds the weather data every three hours for five days, for a total of 40 entries.\n\n //go through a loop to determine the high/low for each day in the forecase:\n //iterate through all temps for each day and add the max high and the min low to respective lists.\n var j = 0;\n var k = 0;\n var maxhigh = -100;\n var minlow = 100;\n var highs = [];\n var lows = [];\n var currentday = new Date();\n currentday = currentday.getDate();\n\n //this loop skips past any of the forecast for the rest of the current day:\n var counter = 0;\n while ((forecast[\"list\"][counter][\"dt_txt\"]).substring(8,10) == currentday){\n counter++;\n }\n\n var end = forecast[\"list\"].length-counter;\n while (j < 5){\n k = 0;\n maxhigh = -100;\n minlow = 100;\n //starting at 12:00AM on the first day of the forecast, go through the 8 given data points:\n while (k < 8 && counter < end){\n\n //compare the current max high temp with the high temp for this data point:\n if (maxhigh < forecast[\"list\"][counter][\"main\"][\"temp_max\"]){\n maxhigh = forecast[\"list\"][counter][\"main\"][\"temp_max\"];\n }\n\n //compare the current min low temp with the min temp for this data point:\n if (minlow > forecast[\"list\"][counter][\"main\"][\"temp_min\"]){\n minlow = forecast[\"list\"][counter][\"main\"][\"temp_min\"];\n }\n k+=1;\n counter+=1;\n }\n //populate the highs and lows arrays with each day's high and low calculated above:\n highs[j] = maxhigh;\n lows[j] = minlow;\n j+=1; //go to next day\n }\n\n //start i at next day + 4 so it represents 12pm on the first day\n var i = 0;\n while ((forecast[\"list\"][i][\"dt_txt\"]).substring(8,10) == currentday){\n i++;\n }\n i = i+4;\n\n var n = 0; //n will iterate through the highs/lows lists\n\n \t//go through all weather data entries over next 5 days:\n \twhile (i < 40){\n\n \t\t//format date of entry:\n \t\tvar d2= new Date(forecast[\"list\"][i][\"dt_txt\"]);\n \t\tvar ds = d2.toString();\n \t\tds = ds.substr(0,11);\n\n \t\t//format weather description: \n \t\tvar descrip2 = (forecast[\"list\"][i][\"weather\"][\"0\"][\"description\"])[0].toUpperCase() + (forecast[\"list\"][i][\"weather\"][\"0\"][\"description\"]).substr(1,);\n\n \t\t//populate each row with the 12pm stats for that day\n \t\t$(\"#forecast-list\").append(\"<div class='row' id='day'>\\\n \t\t\t<div class='col-sm-4 my-auto'>\\\n \t\t\t<div id='icon'><img id='lower-icon' src='http://openweathermap.org/img/w/\" + forecast[\"list\"][i][\"weather\"][\"0\"][\"icon\"] + \".png'></div>\\\n \t\t\t<div id='descrip'>\" + descrip2 + \"</div>\\\n \t\t\t</div>\\\n \t\t\t<div class='col-sm-4 my-auto'>\\\n \t\t\t<div id='date'>\" + ds + \"</div>\\\n \t\t\t<div id='curr_temp'>\" + Math.round(highs[n]) + \"&deg; | \" + Math.round(lows[n]) + \"&deg;</div>\\\n \t\t\t</div>\\\n \t\t\t<div class='col-sm-4 my-auto' id='other_stats'>\\\n\t \t\t\t<div id='humidity'><b>Humidity:</b> \" + forecast[\"list\"][i][\"main\"][\"humidity\"] + \"%</div>\\\n\t \t\t<div id='wind'><b>Wind:</b> \" + forecast[\"list\"][i][\"wind\"][\"speed\"] + \" m/s at \" + forecast[\"list\"][i][\"wind\"][\"deg\"] + \" degrees</div>\\\n \t\t\t</div>\\\n \t\t\t</div>\");\n \t\ti+=8;\n n+=1;\n \t}\n $(\"#forecast-list\").fadeIn(1000);\n });\n}", "async function getWeatherData() {\n getLocation();\n const URL = `http://api.openweathermap.org/data/2.5/weather?lat=${LAT}&lon=${LON}&appid=${API_KEY}`;\n const apiRES = await fetch(URL).then((res) => res.json());\n setActualTemperature(Math.ceil(apiRES.main.temp - 273.15));\n setWeatherDescription(apiRES.weather[0].description);\n setWeatherLocation(apiRES.name);\n const iconURL = `http://openweathermap.org/img/wn/${apiRES.weather[0].icon}.png`;\n setWeatherIcon(iconURL);\n }", "function getWeather() {\n\tlet query = \"https://api.openweathermap.org/data/2.5/weather?\" +\n\t\t\"q=\" + city + \"&units=imperial&appid=\" + OWM_API_KEY;\n\t\n\t$.ajax({\n\t\turl: query,\n\t\tmethod: \"GET\"\n\t}).done(data => {\n\t\tif (!data) return;\n\t\t\n\t\tif (data.main && data.main.temp && data.weather && data.weather.length > 0) {\n\t\t\t$('#temp').text(data.main.temp.toFixed(1) + '\\xB0' + 'F');\n\t\t\t\n\t\t\t$('#weather-main > i').remove();\n\t\t\t\n\t\t\tlet weatherData = data.weather[0];\n\t\t\t\n\t\t\tlet icon = $('<i>');\n\t\t\tlet time = weatherData.icon.endsWith('d') ? 'day-' : weatherData.icon.endsWith('n') ? 'night-' : '';\n\t\t\tlet iconClass = 'wi wi-owm-' + time + weatherData.id;\n\t\t\ticon.addClass(iconClass);\n\t\t\t$('#weather-main').prepend(icon);\n\t\t\t\n\t\t\tlet conditions = weatherData.description;\n\t\t\t$('#weather-conditions').text(titleCase(conditions));\n\t\t\t\n\t\t\t//console.log(data);\n\t\t}\n\t});\n\t\n\tquery = 'https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid in (select woeid from geo.places(1) where text=\"' + city.toLowerCase() + ', ' + state.toLowerCase() + '\")&format=json';\n\t$.ajax({\n\t\turl: query,\n\t\tmethod: \"GET\"\n\t}).done(data => {\n\t\tif (!data || !data.query || !data.query.results || !data.query.results.channel) return;\n\t\t\n\t\tconsole.log(data.query.results.channel);\n\t\t\n\t\tif (!data.query.results.channel.item || !data.query.results.channel.item.forecast) return;\n\t\t\n\t\tlet forecast = data.query.results.channel.item.forecast;\n\t\t\n\t\tif (forecast.length > 0) {\n\t\t\t$('#temp-high').text(forecast[0].high + '\\xB0' + 'F');\n\t\t\t$('#temp-low').text(forecast[0].low + '\\xB0' + 'F');\n\t\t\t\n\t\t\t$('#weather-weekly').empty();\n\t\t\tfor (let i = 1; i < 6 && i < forecast.length; i++) {\n\t\t\t\tlet col = $('<div>').addClass('col');\n\t\t\t\tlet panel = $('<div>').addClass('panel daily-forecast');\n\t\t\t\tlet dayWeather = forecast[i];\n\t\t\t\t\n\t\t\t\tpanel.append($('<p>').addClass('day').text(dayWeather.day.toUpperCase()));\n\t\t\t\tpanel.append($('<i>').addClass('wi wi-yahoo-' + dayWeather.code));\n\t\t\t\tpanel.append($('<p>').addClass('daily-high').text(dayWeather.high + '\\xB0' + 'F'));\n\t\t\t\tpanel.append($('<p>').addClass('daily-low').text(dayWeather.low + '\\xB0' + 'F'));\n\t\t\t\t\n\t\t\t\tcol.append(panel);\n\t\t\t\t$('#weather-weekly').append(col);\n\t\t\t}\n\t\t}\n\t\t\n\t});\n}", "function searchCityForecast (input) {\n // Sets Variables for Open Weather API\n var queryURL = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + input + \",us\" + \"&units=imperial\" + \"&APPID=1d030b0a789179884a5605722b50f289\"\n \n // Calls Open Weather API\n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).then(function(response) {\n console.log(response)\n\n // Set forecast section of for each day to variables\n var dayOneBlock = response.list[2]\n var dayTwoBlock = response.list[10]\n var dayThreeBlock = response.list[18]\n var dayFourBlock = response.list[26]\n var dayFiveBlock = response.list[34]\n\n // Date to display on each forecast day\n var dateOneText = moment(dayOneBlock.dt_txt).format(\"M/D\")\n var dateTwoText = moment(dayTwoBlock.dt_txt).format(\"M/D\")\n var dateThreeText = moment(dayThreeBlock.dt_txt).format(\"M/D\")\n var dateFourText = moment(dayFourBlock.dt_txt).format(\"M/D\")\n var dateFiveText = moment(dayFiveBlock.dt_txt).format(\"M/D\")\n\n // Setting weather icon's for each forecast day to a variable\n var dayOneIcon = (`http://openweathermap.org/img/w/${dayOneBlock.weather[0].icon}.png`)\n var dayTwoIcon = (`http://openweathermap.org/img/w/${dayTwoBlock.weather[0].icon}.png`)\n var dayThreeIcon = (`http://openweathermap.org/img/w/${dayThreeBlock.weather[0].icon}.png`)\n var dayFourIcon = (`http://openweathermap.org/img/w/${dayFourBlock.weather[0].icon}.png`)\n var dayFiveIcon = (`http://openweathermap.org/img/w/${dayFiveBlock.weather[0].icon}.png`)\n\n\n\n // Day 1 forecast card info\n $('#dayOne').html(\"<h5>\" + dateOneText + \"</h5>\")\n $('#dayOne').append(`<p>${dayOneBlock.weather[0].main}<i><img src=\"${dayOneIcon}\" alt=\"Weather Icon\"></i><p>`)\n $('#dayOne').append(\"<p>Temp: \" + (dayOneBlock.main.temp).toFixed(0) + \" &deg;F</p>\")\n $('#dayOne').append(\"<p>Wind Speed: \" + dayOneBlock.wind.speed + \" mph</p>\")\n $('#dayOne').append(\"<p>Humidity: \" + dayOneBlock.main.humidity + \"%</p>\")\n\n // Day 2 forecast card info\n $('#dayTwo').html(\"<h5>\" + dateTwoText + \"</h5>\")\n $('#dayTwo').append(`<p>${dayTwoBlock.weather[0].main}<i><img src=\"${dayTwoIcon}\" alt=\"Weather Icon\"></i><p>`)\n $('#dayTwo').append(\"<p>Temp: \" + (dayTwoBlock.main.temp).toFixed(0) + \" &deg;F</p>\")\n $('#dayTwo').append(\"<p>Wind Speed: \" + dayTwoBlock.wind.speed + \" mph</p>\")\n $('#dayTwo').append(\"<p>Humidity: \" + dayTwoBlock.main.humidity + \"%</p>\")\n\n // Day 3 forecast card info\n $('#dayThree').html(\"<h5>\" + dateThreeText + \"</h5>\")\n $('#dayThree').append(`<p>${dayThreeBlock.weather[0].main}<i><img src=\"${dayThreeIcon}\" alt=\"Weather Icon\"></i><p>`)\n $('#dayThree').append(\"<p>Temp: \" + (dayThreeBlock.main.temp).toFixed(0) + \" &deg;F</p>\")\n $('#dayThree').append(\"<p>Wind Speed: \" + dayThreeBlock.wind.speed + \" mph</p>\")\n $('#dayThree').append(\"<p>Humidity: \" + dayThreeBlock.main.humidity + \"%</p>\")\n\n // Day 4 forecast card info\n $('#dayFour').html(\"<h5>\" + dateFourText + \"</h5>\")\n $('#dayFour').append(`<p>${dayFourBlock.weather[0].main}<i><img src=\"${dayFourIcon}\" alt=\"Weather Icon\"></i><p>`)\n $('#dayFour').append(\"<p>Temp: \" + (dayFourBlock.main.temp).toFixed(0) + \" &deg;F</p>\")\n $('#dayFour').append(\"<p>Wind Speed: \" + dayFourBlock.wind.speed + \" mph</p>\")\n $('#dayFour').append(\"<p>Humidity: \" + dayFourBlock.main.humidity + \"%</p>\")\n\n // Day 5 forecast card info\n $('#dayFive').html(\"<h5>\" + dateFiveText + \"</h5>\")\n $('#dayFive').append(`<p>${dayThreeBlock.weather[0].main}<i><img src=\"${dayFiveIcon}\" alt=\"Weather Icon\"></i><p>`)\n $('#dayFive').append(\"<p>Temp: \" + (dayFiveBlock.main.temp).toFixed(0) + \" &deg;F</p>\")\n $('#dayFive').append(\"<p>Wind Speed: \" + dayFiveBlock.wind.speed + \" mph</p>\")\n $('#dayFive').append(\"<p>Humidity: \" + dayFiveBlock.main.humidity + \"%</p>\")\n\n });\n\n}", "function getWeather(data) {\n setWeather(data);\n }", "fetchForecast()\n {\n var url = \"http://api.openweathermap.org/data/2.5/forecast?APPID=0cf17e23b1d108b29a4d738d2084baf5&q=\" + this.state.location + \"&units=\" + this.state.units;\n \n $.ajax({\n\t\t\turl: url,\n dataType: \"jsonp\",\n\t\t\tsuccess : this.parseResponse,\n\t\t\terror : function(req, err){ console.log('API call failed ' + err); }\n })\n\n \n }", "function fiveDayForecast(city) {\n var queryURL =\n \"https://api.openweathermap.org/data/2.5/forecast?q=\" +\n city +\n \"&appid=8ca043bed56f54032777742c195f1b73\";\n $.ajax({\n url: queryURL,\n method: \"GET\",\n }).then(function (response) {\n console.log(response);\n $(\"#5day\").html(response);\n for (var i = 0; i < response.list.length; i++) {\n if (response.list[i].dt_txt.indexOf(\"12:00:00\") !== -1) {\n var column = $(\"<div>\").addClass(\"col-md-2\");\n var card = $(\"<div>\").addClass(\"card bg-primary text-white\");\n var body = $(\"<div>\").addClass(\"card-body p-2\");\n var temp =\n $(\"<p>\").addClass(\"card-text\").text(\n \"Temp: \" +\n ((response.list[i].main.temp - 273.15) * 1.8 + 32).toFixed(2) +\n \"°F\");\n var icon = $(\"<img>\").attr(\n \"src\",\n \"http://openweathermap.org/img/w/\" +\n response.list[i].weather[0].icon +\n \".png\"\n );\n var date = response.list[i].dt_txt;\n date = date.split(' ')[0];\n var humidity =\n $(\"<p>\").addClass(\"card-text\").text(\n \"Humidity: \" +\n response.list[i].main.humidity +\n \"%\");\n console.log(date);\n column.append(card.append(body.append(date, icon, temp, humidity)));\n $(\"#5day\").append(column);\n // $(\"#5date\").append(\"<br>\" + response.list[i].dt_txt);\n // $(\"#5currentimg\").append(icon);\n // $(\"#5temp\").append(\"<br>\" + \"Temp: \" + temp.toFixed(2) + \"°F\");\n // $(\"#5humidity\").append(\n // \"<br>\" + \"Humidity: \" + response.list[i].main.humidity + \"%\"\n // );\n\n // column.appendTo(\"#5day\");\n }\n }\n });\n}", "function pageForecast(id) {\n const apiURL = \"https://api.openweathermap.org/data/2.5/forecast?id=\" + id + \"&units=imperial&APPID=96515e8b6f69b72205d859e040349332\";\nfetch(apiURL)\n .then((response) => response.json())\n .then((town) => {\n console.log(town);\n const townList = town.list;\n let counter = 0;\n for (let i = 0; i < townList.length; i++ ) {\n let day = townList[i].dt_txt;\n if (day.substr(11, 19) == '18:00:00') {\n counter++\n /*Get correct day for forecast*/\n /*Display as Month/Day*/\n const months = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"];\n let monthDate = parseInt((day[5] + day[6]) - 1);\n let date = day[8] + day[9];\n let month = months[monthDate];\n let fullDate = month + \" \" + date;\n let dateElement = 'date' + counter;\n document.getElementById(dateElement).innerHTML = fullDate;\n\n /*Get description*/\n let discriptionLower = townList[i].weather[0].description;\n let discription = discriptionLower.charAt(0).toUpperCase() + discriptionLower.slice(1);\n let discriptionElement = 'condition' + counter;\n document.getElementById(discriptionElement).innerHTML = discription;\n\n /*Get temp-max*/\n let temp = Math.round(townList[i].main.temp_max) + \" &#176;F\";\n let tempElement = 'day' + counter + '_weather';\n document.getElementById(tempElement).innerHTML = temp;\n\n /*Icon for weather*/\n const imagesrc = 'https://openweathermap.org/img/w/' + townList[i].weather[0].icon + '.png';\n let imageElement = 'weather_icon' + counter;\n document.getElementById(imageElement).setAttribute('src', imagesrc);\n document.getElementById(imageElement).setAttribute('alt', discription);\n }\n }\n });\n}", "function getForecast() {\n request('locations.json')\n .then(displayForecast)\n .catch(handleError)\n }", "function updateForecastInfoInApp(json) {\n let forecastHTML;\n // Make an array of days\n let dayOne = makeThisADate(json.daily[1].dt);\n let dayTwo = makeThisADate(json.daily[2].dt);\n let dayThree = makeThisADate(json.daily[3].dt);\n let dayFour = makeThisADate(json.daily[4].dt);\n let dayFive = makeThisADate(json.daily[5].dt);\n\n let daysArray = [dayOne, dayTwo, dayThree, dayFour, dayFive];\n\n daysArray.forEach(element => {\n let number = daysArray.indexOf(element) + 1;\n // Grab the min and max temp\n let forecastMin = json.daily[number].temp.min;\n let forecastMax = json.daily[number].temp.max;\n forecastMin = Math.round(forecastMin);\n forecastMax = Math.round(forecastMax);\n\n // Grab the weather emoji\n let forecastState = json.daily[number].weather[0].icon;\n forecastState = setEmoji(forecastState);\n\n let newDay = `\n <div class=\"forecast__card\">\n <p class=\"forecast__date\">${element}</p>\n <p class=\"forecast__emoji\">${forecastState}</p>\n <p class=\"forecast__temperature\">\n <span class=\"temp\">${forecastMin}</span><span class=\"temp-format\">°C</span> /\n <span class=\"temp\">${forecastMax}</span><span class=\"temp-format\">°C</span>\n </p>\n </div>\n `;\n \n if(forecastHTML) {\n forecastHTML = forecastHTML + newDay;\n } else {\n forecastHTML = newDay;\n }\n })\n\n forecast.innerHTML = forecastHTML;\n}", "function updateFive(data) {\n // console.log(data);\n // console.dir($('.card-body'));\n // Run loop so that each day container is updated with the corresponding data\n for (let i = 1; i < 6; i++) {\n // This variable will store the path to current card to update\n let currCard = $('.card-body')[i].children; \n // console.log($('.card-body')[i]);\n // this variable will store the data path to the corresponding day of the current card\n let currDay = data.daily[i];\n // console.log(currDay);\n // Reset to the current date\n date = moment();\n // Update card DOM with the appropriate data\n currCard[0].textContent = date.add(''+i+'', 'day').format('dddd'); \n currCard[1].setAttribute('src', \"http://openweathermap.org/img/wn/\" + currDay.weather[0].icon + \"@2x.png\");\n currCard[2].textContent = \"Temperature: \" + Math.floor((currDay.temp.day - 273.15) * 1.80 + 32);\n currCard[3].textContent = \"Humidity: \" + currDay.humidity; \n } \n }" ]
[ "0.7105423", "0.70717853", "0.7012324", "0.70044386", "0.69556195", "0.6927856", "0.69261694", "0.69210935", "0.67911786", "0.67827857", "0.6779344", "0.6768909", "0.67539567", "0.67520225", "0.67379004", "0.6729272", "0.6718819", "0.6717924", "0.67053753", "0.6681134", "0.66774064", "0.66584945", "0.6654697", "0.66542333", "0.6647906", "0.66348696", "0.6588461", "0.6579681", "0.65791774", "0.65739197", "0.6571558", "0.657148", "0.6571106", "0.6565169", "0.65535986", "0.6552449", "0.6547036", "0.6546512", "0.6539669", "0.6538842", "0.6534341", "0.6520777", "0.65177834", "0.65060514", "0.6483678", "0.64685994", "0.64635044", "0.644861", "0.6447905", "0.6413876", "0.6411617", "0.6400439", "0.6398434", "0.63919497", "0.6387905", "0.6387309", "0.6367338", "0.6349156", "0.6348797", "0.63470477", "0.6337823", "0.63375545", "0.6328227", "0.6325944", "0.6322442", "0.6320034", "0.6302953", "0.630227", "0.62938774", "0.62938106", "0.62913305", "0.6285342", "0.62852734", "0.62833923", "0.6281674", "0.6281104", "0.6279441", "0.6278935", "0.6273469", "0.6262201", "0.62556034", "0.6252566", "0.6248145", "0.6245381", "0.6242963", "0.6242963", "0.62360543", "0.6233011", "0.62316525", "0.62310404", "0.6227434", "0.6227301", "0.62248856", "0.62049437", "0.6196207", "0.6195414", "0.61905813", "0.618614", "0.61861223", "0.618451" ]
0.66227883
26
Initialize the app, gets the list of raid from local storage, then renders the initial data.
function init() { // Get the raid list, and update the UI. raidApp.selectedLocations = loadRaidList(); updateData(); // Set up the event handlers for all of the buttons. document.getElementById('butRefresh').addEventListener('click', updateData); document.getElementById('butAdd').addEventListener('click', toggleAddDialog); document.getElementById('butDialogCancel').addEventListener('click', toggleAddDialog); document.getElementById('butDialogAdd').addEventListener('click', addLocation); //Chargement de la liste des arènes $.getJSON("/files/listeArene.json", function(listeArene) { //console.log(listeArene); // this will show the info it in firebug console $.each( listeArene.data, function( key, val ) { document.getElementById('selectRaidToAdd').add(new Option(val.name, val.value)) }); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentDidMount() {\n /** Gets and stores Entries from LocalStorage. */\n let LocalStorageEntries = localStorage.getItem('entries');\n LocalStorageEntries = JSON.parse(LocalStorageEntries);\n /** If there are entries in LocalStorage */\n if(LocalStorageEntries && LocalStorageEntries.entries.length !== 0) {\n /** Displays the entries from LocalStorage onto the Display Section. */\n this.props.initEntries(LocalStorageEntries.entries);\n };\n }", "function startApp() {\n loadFromLocalStorage(); // Try to load list from Local Storage\n\n if (toDoList.length > 0) {\n loadTasks();\n }\n}", "function init() {\n var storeInitials = JSON.parse(localStorage.getItem('initialsList'));\n if (storeInitials !== null) {\n initialsList = storeInitials;\n }\n}", "function init() {\n\n // Get stored initials from localStorage\n var storedsavedInitials = JSON.parse(localStorage.getItem(\"savedInitials\"));\n \n // If tinitials were retrieved from localStorage, update the initials array\n if (storedsavedInitials !== null) {\n savedInitials = storedsavedInitials;\n }\n\n // Helper function that will render tinitials to the DOM\n renderSavedInitials();\n}", "function main() {\n if (!getFromStorage('initialized')) {\n initialize();\n }\n\n const todoItems = getCurrentListItems();\n console.log(todoItems);\n\n // TODO: implement the rest (you can remove the line below)\n renderList(todoItems);\n}", "async loadApp(){\n\n //Pick the fonts from the project '\"root\"/assets/fonts/' folder and assign the names 'cabin' and 'confortaa' that can be used in 'fontFamily' style props:\n await Expo.Font.loadAsync({\n cabin: require('../../assets/fonts/Cabin-Regular.ttf'),\n comfortaa: require('../../assets/fonts/Comfortaa-Bold.ttf'),\n PlantIO_Icons: require('../../assets/icons/pio-ui-icons.ttf')\n })\n\n //Check if user is logged in:\n checkSession()\n .then((r)=>{let s = this.state; s.signed = r; this.setState(s);})\n .catch((error)=>alert(error));\n\n //Fetch Modules List from the Plant IO API and stores in AsyncStorage to be used all over the app:\n await fetchDataFromPlantIOAPI();\n await fetchDataFromClimatempoAPI();\n\n //When everything is loaded, set isReady to true, thus, redirecting the app to the main routes:\n let s = this.state;\n s.isReady = true\n this.setState(s);\n }", "function dsFetch(){\n\tvar createInfo = document.getElementById(\"3dsData\");\n\tcreateInfo.innerHTML = (\"\");\n\tif(localStorage.length === 0){\n\t addGameData();\n \t}\n\t\tvar createUL = document.createElement(\"ul\");\n\t\tcreateUL.setAttribute(\"id\", \"listCreation\");\n\t\tcreateUL.setAttribute(\"data-role\", \"listview\");\n\t\tcreateUL.setAttribute(\"data-filter\", \"true\");\n\t\tcreateUL.setAttribute(\"data-filter-placeholder\", \"Search for a game...\");\n\t\tcreateInfo.appendChild(createUL);\n\t\tfor (var e = 0, f = localStorage.length; e < f; e++) {\n\t\t var gameKey = localStorage.key(e);\n\t\t var gameValue = localStorage.getItem(gameKey);\n\t\t var gameInfoObject = JSON.parse(gameValue);\n\t\t if (gameInfoObject.console[1] === \"Nintendo 3DS\") {\n\t\t\tvar newLi = document.createElement(\"li\");\n\t\t\tcreateUL.appendChild(newLi);\n\t\t\tvar newHeader = document.createElement(\"h3\");\n\t\t\tnewHeader.innerHTML = gameInfoObject.gameTitle[1];\n\t\t\tnewLi.appendChild(newHeader);\n\t\t\tvar consoleName = document.createElement(\"p\");\n\t\t\tconsoleName.innerHTML = gameInfoObject.console[1];\n\t\t\tnewLi.appendChild(consoleName);\n\t\t\timageAddition(gameInfoObject.console[1], newLi);\n\t\t\tvar gameList = document.createElement(\"ul\");\n\t\t\tnewLi.appendChild(gameList);\n\t\t\t for (var g in gameInfoObject) {\n\t\t\t var createGameList = document.createElement(\"li\");\n\t\t\t createGameList.setAttribute(\"id\", \"gameInfoList\");\n\t\t\t gameList.appendChild(createGameList);\n\t\t\t var gameTextOutput = gameInfoObject[g][0] + gameInfoObject[g][1];\n\t\t\t createGameList.innerHTML = gameTextOutput;\n\t\t\t }\n\t\t }\n\t\t}\n }", "function showData () {\n\t\ttoggleControls(\"on\");\n\t\tif(localStorage.length === 0) {\n\t\t\talert(\"There are no games in your library so the default games have been added.\");\n\t\t\tautoFillGames();\n\t\t}\n\t\t//Write data from local storage to the browser\n\t\tvar makeDiv = document.createElement('div');\n\t\tmakeDiv.setAttribute(\"id\", \"items\");\n\t\tvar makeList = document.createElement('ul');\n\t\tmakeDiv.appendChild(makeList);\n\t\tdocument.body.appendChild(makeDiv);\n\t\t$('items').style.display = \"block\";\n\t\tfor(var i=0, len=localStorage.length; i<len;i++) {\n\t\t\tvar makeLi = document.createElement('ol');\n\t\t\tvar linksLi = document.createElement('li');\n\t\t\tmakeList.appendChild(makeLi);\n\t\t\tvar key = localStorage.key(i);\n\t\t\tvar value = localStorage.getItem(key);\n\t\t\t//Convert the string from local storage value back to an object\n\t\t\tvar obj = JSON.parse(value);\n\t\t\tvar makeSubList = document.createElement('ul');\n\t\t\tmakeLi.appendChild(makeSubList);\n\t\t\tgetImage(obj.platforms[1], makeSubList);\n\t\t\tfor(var n in obj) {\n\t\t\t\tvar makeSubli = document.createElement('li');\n\t\t\t\tmakeSubList.appendChild(makeSubli);\n\t\t\t\tvar optSubText = obj[n][0]+\" \"+obj[n][1];\n\t\t\t\tmakeSubli.innerHTML = optSubText;\n\t\t\t\tmakeSubList.appendChild(linksLi);\n\t\t\t}\n\t\t\tmakeItemLinks(localStorage.key(i), linksLi); //Create our edit and delete buttons/link for each item in local storage.\n\t\t}\n\t}", "function init() {\n var storedtodos= JSON.parse(localStorage.getItem(\"Scores\"));\n\n if (storedtodos!== null) {\n todos= storedHighs;\n }\n\n renderHighs();\n}", "function init() {\n let storedInitials = JSON.parse(localStorage.getItem('names'))\n if (storedInitials !== null) {\n initialsArray = storedInitials\n }\n parseSortScores();\n displayScores();\n} // Function to pull from localstorage and run other functions to parse info pulled from local storage and display it.", "function init() {\n searchResults = JSON.parse(sessionStorage.getItem(\"searchResults\"));\n if (searchResults) {\n renderResults(searchResults)\n }\n watchListArray = JSON.parse(localStorage.getItem(\"yourList\"));\n if (!watchListArray) {\n watchListArray = [];\n localStorage.setItem(\"yourList\", JSON.stringify(watchListArray));\n }\n renderYourList();\n getMarketMovers();\n showHorizontalScoll();\n}", "function startup() {\n // Set initial UI data for our app and Vue\n // App data will be populated after updateUI is called in onMessage EVENT_BRIDGE_OPEN_MESSAGE \n dynamicData = deepCopy(CONFIG.INITIAL_DYNAMIC_DATA);\n defaultMaterialProperties = {\n shadeless: deepCopy(CONFIG.INITIAL_DYNAMIC_DATA[STRING_MATERIAL].shadeless),\n pbr: deepCopy(CONFIG.INITIAL_DYNAMIC_DATA[STRING_MATERIAL].pbr)\n };\n \n // Create the tablet app\n ui = new AppUi({\n buttonName: CONFIG.BUTTON_NAME,\n home: URL,\n onMessage: onMessage, // UI event listener \n // Icons are located in graphicsDirectory\n // AppUI is looking for icons named with the BUTTON_NAME \"avatar-101\" \n // For example: avatar-101-a.svg for active button icon, avatar-101-i.svg for inactive button icon\n graphicsDirectory: Script.resolvePath(\"./resources/icons/\"), \n onOpened: onOpened,\n onClosed: onClosed\n });\n\n // Connect unload function to the script ending\n Script.scriptEnding.connect(unload);\n // Connect function callback to model url changed signal\n MyAvatar.skeletonModelURLChanged.connect(onAvatarModelURLChanged);\n }", "function getData() {\n\t\t// Call Function //\n\t\ttoggle(\"on\");\n\t\tif(localStorage.length === 0) {\n\t\t\talert(\"There is no data in Local Storage. \\n Default Data was added.\");\n\t\t\tautoFillData();\n\t\t}\n\t\t// Create new page //\n\t\tvar makeDiv = document.getElementById('dataList');\n\t\tmakeDiv.setAttribute(\"id\", \"items\");\n\t\tmakeDiv.setAttribute(\"data-role\", \"content\");\n\t\tvar makeList = document.createElement('ul');\n\t\tmakeList.setAttribute(\"data-role\", \"listview\");\n\t\tmakeDiv.appendChild(makeList);\n\t\t$('#dataList').append(makeDiv);\n\t\t// Set 'items' display //\n\t\t$('#items').css(\"display\", \"block\");\n\t\tfor(var i=0, j=localStorage.length; i<j; i++) {\n\t\t\tvar makeLi = document.createElement('li');\n\t\t\tmakeLi.style.fontSize = \"25px\";\n\t\t\tvar buttonsLi = document.createElement('li');\n\t\t\tmakeList.appendChild(makeLi);\n\t\t\tvar key = localStorage.key(i);\n\t\t\tvar value = localStorage.getItem(key);\n\t\t\t// Convert string from local storage into value by JSON.parse //\n\t\t\tvar obj = JSON.parse(value);\n\t\t\tvar makeSubList = document.createElement('ul');\n\t\t\tmakeLi.appendChild(makeSubList);\n\t\t\tgetImage(obj.training[1], makeSubList);\n\t\t\tfor (var x in obj) {\n\t\t\t\tvar makeSubLi = document.createElement('li');\n\t\t\t\tmakeSubList.appendChild(makeSubLi);\n\t\t\t\tvar optSubTxt = obj[x][0]+\" \"+obj[x][1];\n\t\t\t\tmakeSubLi.innerHTML = optSubTxt;\n\t\t\t\tmakeSubList.appendChild(buttonsLi);\n\t\t\t}\n\t\t\tmakeButtonsLi(localStorage.key(i), buttonsLi);\n\t\t}\n\t}", "function androidFetch(){\n\tvar createInfo = document.getElementById(\"androidData\");\n\tcreateInfo.innerHTML = (\"\");\n\tif(localStorage.length === 0){\n\t addGameData();\n \t}\n\t\tvar createUL = document.createElement(\"ul\");\n\t\tcreateUL.setAttribute(\"id\", \"listCreation\");\n\t\tcreateUL.setAttribute(\"data-role\", \"listview\");\n\t\tcreateUL.setAttribute(\"data-filter\", \"true\");\n\t\tcreateUL.setAttribute(\"data-filter-placeholder\", \"Search for a game...\");\n\t\tcreateInfo.appendChild(createUL);\n\t\tfor (var e = 0, f = localStorage.length; e < f; e++) {\n\t\t var gameKey = localStorage.key(e);\n\t\t var gameValue = localStorage.getItem(gameKey);\n\t\t var gameInfoObject = JSON.parse(gameValue);\n\t\t if (gameInfoObject.console[1] === \"Android\") {\n\t\t\tvar newLi = document.createElement(\"li\");\n\t\t\tcreateUL.appendChild(newLi);\n\t\t\tvar newHeader = document.createElement(\"h3\");\n\t\t\tnewHeader.innerHTML = gameInfoObject.gameTitle[1];\n\t\t\tnewLi.appendChild(newHeader);\n\t\t\tvar consoleName = document.createElement(\"p\");\n\t\t\tconsoleName.innerHTML = gameInfoObject.console[1];\n\t\t\tnewLi.appendChild(consoleName);\n\t\t\timageAddition(gameInfoObject.console[1], newLi);\n\t\t\tvar gameList = document.createElement(\"ul\");\n\t\t\tnewLi.appendChild(gameList);\n\t\t\t for (var g in gameInfoObject) {\n\t\t\t var createGameList = document.createElement(\"li\");\n\t\t\t createGameList.setAttribute(\"id\", \"gameInfoList\");\n\t\t\t gameList.appendChild(createGameList);\n\t\t\t var gameTextOutput = gameInfoObject[g][0] + gameInfoObject[g][1];\n\t\t\t createGameList.innerHTML = gameTextOutput;\n\t\t\t }\n\t\t }\n\t\t}\n }", "function initialize(){\n\n\n if(localStorage.getItem(\"allData\") == \"undefined\" || localStorage.getItem(\"allData\") == null ){\n\n\n let dataList = new Array();\n localStorage.setItem(\"allData\" , JSON.stringify(dataList));\n\n\n }\n\n\n \n localStorage.setItem(\"currentMode\" , \"all\");\n\n }", "static async load()\n {\n await RPM.settings.read();\n await RPM.datasGame.read();\n RPM.gameStack.pushTitleScreen();\n RPM.datasGame.loaded = true;\n RPM.requestPaintHUD = true;\n }", "function initialize() {\n setToStorage('todoItems', seedData);\n setToStorage('initialized', true);\n}", "function initialise() {\n\n //local storage \n if (localStorage) {\n if (localStorage.getItem(\"options\")==null) {\n console.log(\"local storage loading attempted\");\n localStorage.setItem(\"options\", JSON.stringify(defaults));\n }\n\n state = JSON.parse(localStorage.getItem(\"options\"));\n }\n //loads local stoage data for use in program.\n //global for my sanity.\n\n\n //console.log(options);\n\n drawoptions();//draws ui for user input\n drawdisplay();//draws area that phone is rendered in.\n update();//updates ui to show selected options\n drawPhone();//renders phone\n}", "function loadLocalStorage() { //on startup gets the projects array and returns it, following this render it\n let myProjects_deserialized = JSON.parse(localStorage.getItem('projects'));\n \n if (myProjects_deserialized == null) { return };\n\n myProjects_deserialized.forEach(index => {\n projects.push(index);\n })\n \n renderProjects(projects)\n }", "function populateList() {\n const container = document.getElementById('collection');\n container.innerHTML = '';\n\n container.appendChild(newDivider());\n\n let keys = [];\n for (let index = 0; index < localStorage.length; index += 1) {\n const key = localStorage.key(index);\n if (key !== StoreName.Flags &&\n key !== StoreName.Settings &&\n key !== StoreName.MatrixSelection) {\n keys.push(key);\n }\n }\n\n keys = keys.sort(\n function keysSort(a, b) {\n return parseInt(a) - parseInt(b);\n }\n );\n\n for (const key of keys) {\n const entryJSON = localStorage.getItem(key);\n if (entryJSON) {\n const entry = JSON.parse(entryJSON);\n if (entry) {\n addNewRow(container, key, entry);\n }\n }\n }\n\n if (keys.length === 0) {\n addEmptyMessage(container);\n container.appendChild(newDivider());\n }\n}", "async function load() {\n await Datas.Settings.read();\n await Datas.Systems.read();\n //RPM.gameStack.pushTitleScreen();\n //RPM.datasGame.loaded = true;\n Manager.GL.initialize();\n Manager.GL.resize();\n Manager.Stack.requestPaintHUD = true;\n}", "function startApp() {\n createColors();\n if (localStorage.key('palettes')) {\n savedPalettes = JSON.parse(localStorage.getItem('palettes'));\n }\n savedPalettes.forEach(palette => {\n addToLibrary(palette);\n });\n}", "function loadData() {\n ul.innerHTML = \"\";\n taskList.loadFromJson(JSON.parse(localStorage.getItem(\"tasks\")) || []);\n taskList.getAllTasks().forEach(task => loadTask(task));\n}", "function load() {\n listModel.clear();\n var jsonObject = JSON.parse(listModel.source);\n var apps = jsonObject.apps\n for (var app in apps) {\n // Provide the file scheme to the icon for reliable loading of the icon. Without\n // it the path can be interpreted as a relative path to a resource file bundled\n // with the binary\n listModel.append({icon: \"file://\" + apps[app].icon, appId: apps[app].id});\n }\n}", "function initializeApplication() {\n\n app.utils.getPageResources(chkErr(function(templates, content, config) {\n \n app.storage.getData(chkErr(function(contacts) {\n\n listTemplate = templates.partials_contact_list;\n pageContents = content;\n\n app.utils.renderPage(templates.page_contacts, content);\n refreshContactList(contacts);\n addContactPageListeners();\n\n }));\n\n }));\n\n }", "function startApp() {\n Backbone.history.start({\n pushState: false\n });\n\n var isFirstLoad = localStorage.getItem('firstLoad') === null;\n\n if (isFirstLoad) {\n var onboardView = new OnboardView();\n\n $('body').append(onboardView.render().el);\n localStorage.setItem('firstLoad', 1);\n }\n}", "function init() {\n score = localStorage.getItem(\"score\");\n user = localStorage.getItem(\"user\");\n\n ulEl.append(user);\n ulEl.append(score);\n}", "function init() {\n todos = JSON.parse(localStorage.getItem(\"high\"));\n\n addtodos();\n }", "function loadDashboard(data){\n //set global database\n database = data;\n //hide the login\n screen.remove(login);\n //append the dashboard object to the main screen\n screen.append(dashboard);\n //populate the tables list\n mysqlAssistant.listTables(function(callback){\n //add tables to dashboard list\n \tdashTables.setItems(callback);\n \t//render the dashboard\n screen.render();\n });\n}", "function populateDashboard(data){\n\tconsole.log('populateDashboard ran');\n\tgetAndGatherArtistInfo();\n\tretrieveLocalStorage();\n\tgetAndRenderUsername();\n\t//if the user has artwork in their profile, render the artwork thumb\n\tgetAndRenderArtworkThumb();\n}", "function iphoneFetch(){\n\tvar createInfo = document.getElementById(\"iphoneData\");\n\tcreateInfo.innerHTML = (\"\");\n\tif(localStorage.length === 0){\n\t addGameData();\n \t}\n\t\tvar createUL = document.createElement(\"ul\");\n\t\tcreateUL.setAttribute(\"id\", \"listCreation\");\n\t\tcreateUL.setAttribute(\"data-role\", \"listview\");\n\t\tcreateUL.setAttribute(\"data-filter\", \"true\");\n\t\tcreateUL.setAttribute(\"data-filter-placeholder\", \"Search for a game...\");\n\t\tcreateInfo.appendChild(createUL);\n\t\tfor (var e = 0, f = localStorage.length; e < f; e++) {\n\t\t var gameKey = localStorage.key(e);\n\t\t var gameValue = localStorage.getItem(gameKey);\n\t\t var gameInfoObject = JSON.parse(gameValue);\n\t\t if (gameInfoObject.console[1] === \"iPhone/iPad\") {\n\t\t\tvar newLi = document.createElement(\"li\");\n\t\t\tcreateUL.appendChild(newLi);\n\t\t\tvar newHeader = document.createElement(\"h3\");\n\t\t\tnewHeader.innerHTML = gameInfoObject.gameTitle[1];\n\t\t\tnewLi.appendChild(newHeader);\n\t\t\tvar consoleName = document.createElement(\"p\");\n\t\t\tconsoleName.innerHTML = gameInfoObject.console[1];\n\t\t\tnewLi.appendChild(consoleName);\n\t\t\timageAddition(gameInfoObject.console[1], newLi);\n\t\t\tvar gameList = document.createElement(\"ul\");\n\t\t\tnewLi.appendChild(gameList);\n\t\t\t for (var g in gameInfoObject) {\n\t\t\t var createGameList = document.createElement(\"li\");\n\t\t\t createGameList.setAttribute(\"id\", \"gameInfoList\");\n\t\t\t gameList.appendChild(createGameList);\n\t\t\t var gameTextOutput = gameInfoObject[g][0] + gameInfoObject[g][1];\n\t\t\t createGameList.innerHTML = gameTextOutput;\n\t\t\t }\n\t\t }\n\t\t}\n }", "load(){\n\t\t//get data from localstorage\n\t\tlet data = JSON.parse(localStorage.getItem('listNotes'));\n\t\tif(data){\n\t\t\tnoteList.list = data;\n\t\t}\n\t\t//vide la section\n\t\tdocument.getElementById(\"noteListView\").innerHTML = \"\"\n\t\tif (noteList.list) {\n\t\t\tnoteList.list.forEach((e) => {\n\t\t\t\tnoteView.afficher(e); \n\t\t\t\t//affiche le titre de la note dans le bloc gauche\n\t\t\t\tnoteListView.displayItem(e);\n\t\t\t});\n\t\t}\n\t\t//Vider le titre et le contenu\n\t\tdocument.querySelector('#form_add_note_title').value = \"\";\n\t\tdocument.querySelector('#form_add_note_text').value = \"\";\n\t}", "function loadData() {\n try {\n const fsStorageAsArray = JSON.parse(localStorage.getItem(\"saveArray\"));\n fromSaveFormat(fsStorageAsArray);\n } catch (err) {\n // fill some initial data\n fsStorage = [\n {\n id: 0, name: \"root\", children: [\n { id: 1, name: \"sub1\", children: [\n { id: 4, name: \"file.txt\"},\n { id: 5, name: \"sub3\", children: [\n {id: 6, name: \"file2.txt\", content: \"content2\"}\n ]}\n ]},\n { id: 2, name: \"sub2\", children: []},\n { id: 3, name: \"file1.txt\", content: \"text\"}\n ]\n }\n ]\n }\n }", "function vitaFetch(){\n\tvar createInfo = document.getElementById(\"vitaData\");\n\tcreateInfo.innerHTML = (\"\");\n\tif(localStorage.length === 0){\n\t addGameData();\n \t}\n\t\tvar createUL = document.createElement(\"ul\");\n\t\tcreateUL.setAttribute(\"id\", \"listCreation\");\n\t\tcreateUL.setAttribute(\"data-role\", \"listview\");\n\t\tcreateUL.setAttribute(\"data-filter\", \"true\");\n\t\tcreateUL.setAttribute(\"data-filter-placeholder\", \"Search for a game...\");\n\t\tcreateInfo.appendChild(createUL);\n\t\tfor (var e = 0, f = localStorage.length; e < f; e++) {\n\t\t var gameKey = localStorage.key(e);\n\t\t var gameValue = localStorage.getItem(gameKey);\n\t\t var gameInfoObject = JSON.parse(gameValue);\n\t\t if (gameInfoObject.console[1] === \"Playstation Vita\") {\n\t\t\tvar newLi = document.createElement(\"li\");\n\t\t\tcreateUL.appendChild(newLi);\n\t\t\tvar newHeader = document.createElement(\"h3\");\n\t\t\tnewHeader.innerHTML = gameInfoObject.gameTitle[1];\n\t\t\tnewLi.appendChild(newHeader);\n\t\t\tvar consoleName = document.createElement(\"p\");\n\t\t\tconsoleName.innerHTML = gameInfoObject.console[1];\n\t\t\tnewLi.appendChild(consoleName);\n\t\t\timageAddition(gameInfoObject.console[1], newLi);\n\t\t\tvar gameList = document.createElement(\"ul\");\n\t\t\tnewLi.appendChild(gameList);\n\t\t\t for (var g in gameInfoObject) {\n\t\t\t var createGameList = document.createElement(\"li\");\n\t\t\t createGameList.setAttribute(\"id\", \"gameInfoList\");\n\t\t\t gameList.appendChild(createGameList);\n\t\t\t var gameTextOutput = gameInfoObject[g][0] + gameInfoObject[g][1];\n\t\t\t createGameList.innerHTML = gameTextOutput;\n\t\t\t }\n\t\t }\n\t\t}\n }", "function resumeInitApp() {\n // this needs the db to exist\n setLoadMessage('Initializing Handlers');\n initGlobalUIHandlers();\n\n // sections\n setLoadMessage('Loading Sections');\n loadSections();\n $('.app-version-number').text(app.getVersion());\n\n // populate some menus\n setLoadMessage('Populating Menus');\n globalDBUpdate();\n\n removeLoader();\n}", "function loadDataFromMemory() {\n try {\n todos = JSON.parse(localStorage.getItem(LOCALSTORAGE_KEY)) || [];\n } catch (e) {\n console.error(e);\n todos = []\n }\n if (todos && todos.length > 0) {\n todos.forEach(todo => render(todo.title, todo.body, todo.imgTag))\n }\n}", "function init() {\n var storedScores = JSON.parse(localStorage.getItem(\"storage\"));\n if (storedScores !== null) {\n scoreStorage = storedScores;\n }\n renderScoreStorage();\n}", "function init() {\n for (let i = 0; i <= 10; i++) {\n schedule.push(\"\");\n }\n console.log(\"Local storage get item\" + localStorage.getItem(\"schedule\"));\n schedule = JSON.parse(localStorage.getItem(\"schedule\"));\n console.log(\"schedule = \" + schedule);\n for (let i = 8; i <= 18; i++) {\n $(`#${i} > .col-6`).text(content);\n }\n}", "function init(){\n var storedReminders = JSON.parse(localStorage.getItem(\"reminders\"));\n\n if(storedReminders !== null){\n reminders = storedReminders;\n }\n\n}", "function onCreate() {\n //check if there is anything in local storage and load it\n if (localStorage.length > 0) {\n let jsonEntries = JSON.parse(localStorage['entries-local']);\n\n //transfer local storage to entries array\n for (let i in jsonEntries)\n entries.push(new Entry(jsonEntries[i].pace, (jsonEntries[i].date), false));\n\n createList();\n }\n //creates chart with defautl range \n drawDefaultChart();\n}", "static useDataFromLoaclStorage(){\r\n const gitId = Store.getDatafromLoaclStorage();\r\n gitId.forEach(element => {\r\n const ui = new UI()\r\n ui.display(element);\r\n });\r\n }", "function initDashboard() {\n console.log(\"Initializing Screen\");\n \n // The Initialize function needs to do the following:\n // Populate the dropdown box with all the IDs - create variable to select the dropdown\n var selector = d3.select(\"#selDataset\");\n\n // Read json file with data, then populate the dropdown using the key from the data (names in this case)\n d3.json(\"samples.json\").then((data) => {\n var sampleNames = data.names;\n\n // For each sample, use the value from the key to populate the contents of the dropdown box -\n // append an option to it, set text to it and assign a property\n sampleNames.forEach((sampleID) => { \n selector\n .append(\"option\") \n .text(sampleID)\n .property(\"value\", sampleID); \n });\n \n var sampleID = sampleNames[0];\n\n // Populate Demographic Information\n showDemographicInfo(sampleID);\n // Draw bargraph\n drawBarGraph(sampleID);\n // // Draw bubble chart\n drawBubbleChart(sampleID);\n\n });\n\n }", "function generateInitialData() {\n localFolder.getFolderAsync(\"Genres\").done(\n function (folder) {\n if (folder) {\n folder.getFilesAsync().then(\n function (files) {\n files.forEach(function (file) {\n Windows.Storage.FileIO.readTextAsync(file).then(function (text) {\n\n var books = text.split(\"},\");\n for (var j = 0; j < books.length - 1; j++) {\n var book = JSON.parse(books[j] + '}');\n\n var bookItem = {\n group: { key: \"\" + book.genre, title: \"\" + book.genre, backgroundImage: \"images/\" + book.genre + \".jpg\" },\n name: book.name,\n author: book.author,\n genre: book.genre,\n rating: book.rating,\n resume: book.resume,\n notes: book.notes,\n url: book.url,\n bookId: book.bookId\n };\n\n list.push(bookItem);\n }\n }, function (e) {\n Windows.UI.Popups.MessageDialog(\"Something went wrong, and couldn't load some files\");\n });\n });\n });\n }\n }, function (e) {\n Windows.UI.Popups.MessageDialog(\"Something went wrong, and couldn't open some application folders\");\n });\n }", "function getData(){\n\t\tif(localStorage.length === 0){\n\t\t\talert(\"There are no meals currently tracked.\");\n\t\t};\n\t\ttoggleControls(\"on\");\n\t\tvar makeDiv = document.createElement('div');\n\t\tmakeDiv.setAttribute(\"id\", \"items\");\n\t\tvar makeList = document.createElement('ul');\n\t\tmakeDiv.appendChild(makeList);\n\t\tdocument.body.appendChild(makeDiv);\n\t\t$('items').style.display = \"block\";\n\t\tfor(var i=0, len=localStorage.length; i<len;i++){\n\t\t\tvar makeli = document.createElement('li');\n\t\t\tvar linksLi = document.createElement('li');\n\t\t\tmakeList.appendChild(makeli);\n\t\t\tvar key = localStorage.key(i);\n\t\t\tvar value = localStorage.getItem(key);\n\t\t\t\n\t\t\t//Convert the string from local storage\n\t\t\tvar obj = JSON.parse(value);\n\t\t\tvar makeSublist = document.createElement('ul');\n\t\t\tmakeli.appendChild(makeSublist);\n\t\t\tfor(var n in obj){\n\t\t\t\tvar makeSubli = document.createElement('li');\n\t\t\t\tmakeSublist.appendChild(makeSubli);\n\t\t\t\tvar optSubText = obj[n][0]+\" \"+obj[n][1];\n\t\t\t\tmakeSubli.innerHTML = optSubText;\t\t\n\t\t\t\tmakeSublist.appendChild(linksLi);\n\t\t\t};\n\t\t\t//Create our edit & delete buttons for local storage\n\t\t\tmakeItemLinks(localStorage.key(i), linksLi);\n\t\t};\n\t}", "function loadAllRaids()\n{\n reloadUser();\n\n if ( gUser == null )\n return;\n\n $(\"#body\").empty();\n\n var Parameters = {\n offset : 0,\n count : 30\n };\n\n asyncQuery( \"raid_list\", Parameters, generateRaidList );\n}", "function populate() {\n Odyssey.View.SpriteIndex.populateResourceManager(spriteIndex, view.getResourceManager());\n }", "load(callback) {\n $.getJSON(`/screen/${this.id}/data`, (data) => {\n switch (data.layout) {\n case 'default':\n this.layout = this.layouts.default.layout;\n break;\n default:\n this.layout = this.layouts.default.layout;\n break;\n }\n for (const mods of data.modules) {\n this.modules.push(mods);\n }\n callback();\n });\n }", "function init() {\n\n //retrieve local storage to update hiscore list\n var storedHiscore = JSON.parse(localStorage.getItem(\"player scores\"));\n if (storedHiscore !== null) {\n hiscoreList = storedHiscore;\n }\n var storedPlayer = JSON.parse(localStorage.getItem(\"player names\"));\n if (storedPlayer !== null) {\n playerName = storedPlayer;\n }\n displayPlayer();\n}", "function initScores() {\n storedScores = JSON.parse(localStorage.getItem(\"scores\"));\n\n if (storedScores !== null) {\n scoreList = storedScores;\n }\n renderScores();\n}", "function initLocalDashboardPage(){\r\n\treportsSection = \"dashboard\";\r\n\treportsObject = getDashboardReports(sid);\r\n\tvar list = $(\"#dashboard\");\r\n\tlist.empty();\r\n\tvar predefinedReports = reportsObject.predefined;\r\n\tif(predefinedReports.length > 0){\r\n\t\t\r\n\t\t$.each(predefinedReports, function(k, vObj){\r\n\t\t\tvar raport = prepareDashboardReport(vObj.code);\r\n\t\t\treportObjectToExecute = loadDashboardReport(raport);\r\n\t\t\tlist.append(\r\n\t\t\t\t\t$(\"<div>\",{class:\"dashboard-item-\"+reportObjectToExecute.class+\" uss\",id:reportObjectToExecute.id})\r\n\t\t\t\t\t\t.append($(\"<div>\",{class:\"title\"}))\r\n\t\t\t\t\t\t.append($(\"<div>\",{class:\"form\"}))\r\n\t\t\t\t\t\t.append($(\"<div>\",{class:\"graph\",id:\"graph-\"+reportObjectToExecute.id}).append($(\"<div>\",{class:\"loading-span\"}).text(\"Loading ...\")))\r\n\t\t\t);\r\n\t\t\trenderDashboardReport(reportObjectToExecute);\r\n\t\t});\r\n\t}\r\n}", "initialize() {\n\t\tif (!admin.apps.length) {\n\t\t\tadmin.initializeApp(this.config);\n\t\t}\n\t\tthis.ref = admin.database().ref();\n\t\tthis.gamesDataRef = this.ref.child(\"games\");\n\t}", "componentDidMount() {\n // get the items from local storage\n const items = JSON.parse(localStorage.getItem('inventory'));\n\n if(!items) {\n return;\n }\n // set state\n this.setState({\n items: items,\n });\n }", "function initializeRecipes(){\n\t\t\t\t\t\t\t\n\n\n\tvar arrayofrecipes = [];\n\tObject.keys(localStorage).map((key,index)=>{\n\t\tarrayofrecipes.push({index:index,title:key,ingredient:localStorage[key]})\n\t})\n\treturn arrayofrecipes;\n}", "function initApp() {\n music.play();\n api.getCharacter(1).then((character) => {\n currentCharacter = new Character(character);\n characterNamePlaceHolderContainer.innerHTML = character.name;\n });\n}", "function initApp() {\n var urlParams, configManager, layoutManager;\n console.log('jimu.js init...');\n urlParams = getUrlParams();\n\n DataManager.getInstance();\n\n html.setStyle(jimuConfig.loadingId, 'display', 'none');\n html.setStyle(jimuConfig.mainPageId, 'display', 'block');\n\n layoutManager = LayoutManager.getInstance({\n mapId: jimuConfig.mapId\n }, jimuConfig.layoutId);\n configManager = ConfigManager.getInstance(urlParams);\n\n layoutManager.startup();\n configManager.loadConfig();\n }", "function main(){\n galleries = getGalleries();\n // localStorage.setItem('g', JSON.stringify(galleries) )\n // addNavItems(galleries);\n // handleView(galleries);\n }", "function init(){\n\n // set up localstorage\n if(!localStorage.getItem(\"journal\"))\n localStorage.setItem(\"journal\", JSON.stringify([]));\n\n // set up template if doesn't exist\n if(!localStorage.getItem(\"template\"))\n localStorage.setItem(\"template\", \"What happened yesterday?\\n+ \\n\\nToday I want to \\n\\nI am grateful for \");\n \n // enable search if more than 2 entries\n if(JSON.parse(localStorage.getItem(\"journal\")).length > 2){\n document.getElementById(\"search-button\").style.display = \"block\";\n }\n\n // hopefully not a direct link to anything other than the menu, but load the page they ask for anyway\n loadScreen(window.location.hash);\n}", "function onLoaded()\n\t{\n\t\twindow.initExhibitorsList();\n\t\twindow.initFloorPlans();\n\t\twindow.initConciege();\n\t\twindow.initAmenities();\n\t\twindow.initVisas();\n\t}", "function startApp() {\n //first calls, default dataset? \n }", "function initViewData() {\n loadDataChart();\n displayLogIn();\n}", "function init() {\n // Parse Data In Local Storage\n let storedCities = JSON.parse(localStorage.getItem(\"cities\"))\n // Check if Local Storage Was Empty\n // console.log(storedCities);\n if (storedCities !== null) {\n recCities = storedCities; \n }\n // Display the current date if no city has been loaded\n $('#current-city').text(date.format('MMMM Do'));\n renderCities();\n }", "function loadData() {\n\tlet data = JSON.parse(localStorage.getItem(\"tasks\"))\n\tlet li = \"\";\n\tfor (let i = 0; i < data.length; i++) {\n\t\tli += dataGenerat(data[i], i);\n\t\t$(\"ul\").html(\"\").append(li);\n\t}\n}", "function initMainScreen() {\n //Initialize the user list for \"Contacts\" tab\n initContactList();\n\n //Initialize the chat list for \"Chats\" tab\n initChatList();\n\n // now show the side panel icon\n $('.rightSidePaneBtnDiv').show();\n}", "function renderizarCarritoInicial() {\n if (JSON.parse(localStorage.getItem(\"Carrito\"))) {\n carrito = JSON.parse(localStorage.getItem(\"Carrito\"));\n } else carrito = [];\n}", "function initList(){\r\n\tif(dataTableIsLoaded()){\r\n\t\tdestoryDataTable();\r\n\t}\r\n\tvar html = new EJS({url: 'javascripts/templates/list_view.ejs'}).render(internship_data);\r\n\t$(\"#list_view_body\").html(html);\r\n\tinitDataTable();\r\n}", "function initializeData(listName) {\n\t\t//use a list with default values\n\t\tshoppingLists = myList;\n\t\tsessionList = shoppingLists[listName];\n\t\t//create the initial list collection in local storage\n\t\tlocalStorage.setItem(\"shoppingLists\", JSON.stringify(shoppingLists));\n\t\t//call the function to display the list on screen, but set save to false since local storage is up to date\n\t\tsessionList.forEach(function(item) {\n\t\t\taddItem(item, false);\n\t\t});\n}", "function fetchLocalStorage() {\n // CONVERTING LOCAL STORAGE STRING THAT STORE OUR LEADS AND PUSH IT IN myLeads ARRAY\n const leadsFromLocalStorage = JSON.parse(localStorage.getItem(\"myLeads\"));\n // CHECKING IF WE GOT SOMETHING FROM LOCAL STORAGE\n if (leadsFromLocalStorage)\n {\n myLeads = leadsFromLocalStorage;\n render(myLeads);\n }\n}", "function intializeData() {\n\t// If this key exists then we can bail out, as we have already initialized\n\tif (storage.getItem(key) !== null) { return; }\n\n\t// Otherwise, we need to populate localStorage with dummy data\n\tvar initialData = [\n\t{\n\t\t\"id\": \"\",\n\t\t\"tContext\": \"errand\",\n\t\t\"tName\": \"Get Office Supplies\",\n\t\t\"tPriority\": \"5\",\n\t\t\"tFavorite\": \"\",\n\t\t\"sDate\": \"2011-08-01\",\n\t\t\"eDate\": \"2011-08-03\",\n\t\t\"dDate\": \"2011-08-04\",\n\t\t\"tNotes\": \"Need to pick up some office supplies\"\n\t},\n\t{\n\t\t\"id\": \"\",\n\t\t\"tContext\": \"home\",\n\t\t\"tName\": \"Do laundry\",\n\t\t\"tPriority\": \"4\",\n\t\t\"tFavorite\": \"on\",\n\t\t\"sDate\": \"2011-08-02\",\n\t\t\"eDate\": \"2011-08-04\",\n\t\t\"dDate\": \"2011-08-05\",\n\t\t\"tNotes\": \"\"\n\t\n\t},\n\t{\n\t\t\"id\": \"\",\n\t\t\"tContext\": \"office\",\n\t\t\"tName\": \"Create Presentation\",\n\t\t\"tPriority\": \"7\",\n\t\t\"tFavorite\": \"\",\n\t\t\"sDate\": \"2011-08-01\",\n\t\t\"eDate\": \"2011-08-05\",\n\t\t\"dDate\": \"2011-08-06\",\n\t\t\"tNotes\": \"Need to get keynote presentation made.\"\n\t\n\t},\n\t{\n\t\t\"id\": \"\",\n\t\t\"tContext\": \"calls\",\n\t\t\"tName\": \"Call utility company\",\n\t\t\"tPriority\": \"3\",\n\t\t\"tFavorite\": \"\",\n\t\t\"sDate\": \"2011-08-01\",\n\t\t\"eDate\": \"2011-08-02\",\n\t\t\"dDate\": \"2011-08-02\",\n\t\t\"tNotes\": \"Call about recent bill\"\n\t\t\n\t},\n\t{\n\t\t\"id\": \"\",\n\t\t\"tContext\": \"people\",\n\t\t\"tName\": \"Delegate Presentation Segment\",\n\t\t\"tPriority\": \"6\",\n\t\t\"tFavorite\": \"\",\n\t\t\"sDate\": \"2011-08-01\",\n\t\t\"eDate\": \"2011-08-09\",\n\t\t\"dDate\": \"2011-08-10\",\n\t\t\"tNotes\": \"Need to delegate the production segment of presentation.\"\n\t\n\t},\n\t{\n\t\t\"id\": \"\",\n\t\t\"tContext\": \"waiting\",\n\t\t\"tName\": \"Operations Presentation\",\n\t\t\"tPriority\": \"5\",\n\t\t\"tFavorite\": \"\",\n\t\t\"sDate\": \"2011-08-01\",\n\t\t\"eDate\": \"\",\n\t\t\"dDate\": \"2011-08-05\",\n\t\t\"tNotes\": \"Waiting on operations presentation segment from Jane.\"\n\t\n\t},\n\t\t\n\t];\n\n\t// Simple example of read data\n\tvar popluate = function(data) {\n\t\tfor (var i in data) {\n\t\tvar item\t= data[i];\n\t\tvar key\t\t= item.id;\n\t\t// Hard way\n\t\tvar value = [item.id, item.name, item.cat].join(';');\n\t\t// This is the easy way\n\t\tvar value = JSON.stringify(item);\n\t\tstorage.setItem(key, value);\n\t\t}\n\t\n\t};\n\n}", "function startApplication() {\n\n // Start loading our datasets in parallel using D3-queue,\n // then create a callback for the function responsible\n // for building the dashboard\n d3.queue().defer(d3.csv, '../_data/REF2014_Results.csv').defer(d3.csv, '../_data/learning-providers-plus.csv').await(function (err, mainData, extraData) {\n // After waiting for datasets to load, do cleaning and pass data for\n // creating the dashboard\n var dataset = dataManager.mergeDatasets(mainData, extraData);\n var dataset2 = mainData;\n\n // Router, shows dashboard content relevant to category selected from navigation\n // Get nav elements from the DOM\n var ecaPhd = document.getElementsByClassName('header__nav-item')[0].childNodes[1],\n universityMgmt = document.getElementsByClassName('header__nav-item')[1].childNodes[1],\n industryResrch = document.getElementsByClassName('header__nav-item')[2].childNodes[1];\n\n var navArr = [ecaPhd, universityMgmt, industryResrch];\n\n // Show Early career academics and PhDs by default as the landing page\n var main = _ecaPhd.mainEca;\n var mainDOM = document.querySelector('main');\n mainDOM.innerHTML = main;\n mainDOM.setAttribute('id', 'eca-phd');\n\n // Create relevant dashboard\n createDashboardEca(dataset, dataset2);\n\n // Highlight active nav item\n navArr.forEach(function (navItem) {\n\n // Listen for click event on navigation items\n navItem.addEventListener('click', function (event) {\n // Prevent link default action\n event.preventDefault();\n\n // Get the route of the clicked navigation item\n var href = navItem.href.split('/');\n var dashboard = href[href.length - 1];\n var elements = navItem.parentElement.parentElement.children;\n\n // Highlight the selected category by adding an active class on the\n // corresponding navigation item \n for (var i = 0; i <= 2; i++) {\n if (elements[i].classList.contains('active')) {\n elements[i].classList.remove('active');\n }\n }\n navItem.parentElement.classList.add('active');\n\n // Main routing functionality\n // Early Career Academics & PhDs Dashboard\n if (dashboard === 'eca-phd') {\n main = _ecaPhd.mainEca;\n document.title = 'REF2014 Results Dashboard - Early Career Academics & PhDs';\n mainDOM.innerHTML = main;\n mainDOM.setAttribute('id', 'eca-phd');\n createDashboardEca(dataset, dataset2);\n }\n // University Management Dashboard\n else if (dashboard === 'university-management') {\n main = _universityManagement.universityManagement;\n document.title = 'REF2014 Results Dashboard - University Management';\n mainDOM.innerHTML = main;\n mainDOM.setAttribute('id', 'um');\n createDashboardUm(dataset, dataset2);\n }\n // Industry Collaborators and Research Strategists Dashboard\n else if (dashboard === 'industry-research') {\n main = _industryResearch.industryResearch;\n document.title = 'REF2014 Results Dashboard - Industry Collaborators & Research Strategists';\n mainDOM.innerHTML = main;\n mainDOM.setAttribute('id', 'ir');\n createDashboardIr(dataset, dataset2);\n }\n });\n });\n });\n}", "function loadLS() {\n\tif (localStorage.getItem('store') !== null) {\n\t\tlet getLS = JSON.parse(localStorage.getItem('store'));\n\t\tgetLS.forEach(res => {\n\t\t\tlet str = `<li class=\"collection-item\"> ${res} <a href=\"#\" class=\"delete-item\"><i class=\"fa fa-remove\"></i></a><a href=\"#\" class=\"edit-item\"><i class=\"fa fa-pencil\"></i></a></li>`;\n\t\t\tulCollection.innerHTML += str;\n\t\t})\n\n\t}\n}", "function ps3Fetch(){\n\tvar createInfo = document.getElementById(\"ps3Data\");\n\tcreateInfo.innerHTML = (\"\");\n\tif(localStorage.length === 0){\n\t addGameData();\n \t}\n\t\tvar createUL = document.createElement(\"ul\");\n\t\tcreateUL.setAttribute(\"id\", \"listCreation\");\n\t\tcreateUL.setAttribute(\"data-role\", \"listview\");\n\t\tcreateUL.setAttribute(\"data-filter\", \"true\");\n\t\tcreateUL.setAttribute(\"data-filter-placeholder\", \"Search for a game...\");\n\t\tcreateInfo.appendChild(createUL);\n\t\tfor (var e = 0, f = localStorage.length; e < f; e++) {\n\t\t var gameKey = localStorage.key(e);\n\t\t var gameValue = localStorage.getItem(gameKey);\n\t\t var gameInfoObject = JSON.parse(gameValue);\n\t\t if (gameInfoObject.console[1] === \"Playstation 3\") {\n\t\t\tvar newLi = document.createElement(\"li\");\n\t\t\tcreateUL.appendChild(newLi);\n\t\t\tvar newHeader = document.createElement(\"h3\");\n\t\t\tnewHeader.innerHTML = gameInfoObject.gameTitle[1];\n\t\t\tnewLi.appendChild(newHeader);\n\t\t\tvar consoleName = document.createElement(\"p\");\n\t\t\tconsoleName.innerHTML = gameInfoObject.console[1];\n\t\t\tnewLi.appendChild(consoleName);\n\t\t\timageAddition(gameInfoObject.console[1], newLi);\n\t\t\tvar gameList = document.createElement(\"ul\");\n\t\t\tnewLi.appendChild(gameList);\n\t\t\t for (var g in gameInfoObject) {\n\t\t\t var createGameList = document.createElement(\"li\");\n\t\t\t createGameList.setAttribute(\"id\", \"gameInfoList\");\n\t\t\t gameList.appendChild(createGameList);\n\t\t\t var gameTextOutput = gameInfoObject[g][0] + gameInfoObject[g][1];\n\t\t\t createGameList.innerHTML = gameTextOutput;\n\t\t\t }\n\t\t }\n\t\t}\n }", "function pcFetch(){\n\tvar createInfo = document.getElementById(\"pcData\");\n\tcreateInfo.innerHTML = (\"\");\n\tif(localStorage.length === 0){\n\t addGameData();\n \t}\n\t\tvar createUL = document.createElement(\"ul\");\n\t\tcreateUL.setAttribute(\"id\", \"listCreation\");\n\t\tcreateUL.setAttribute(\"data-role\", \"listview\");\n\t\tcreateUL.setAttribute(\"data-filter\", \"true\");\n\t\tcreateUL.setAttribute(\"data-filter-placeholder\", \"Search for a game...\");\n\t\tcreateInfo.appendChild(createUL);\n\t\tfor (var e = 0, f = localStorage.length; e < f; e++) {\n\t\t var gameKey = localStorage.key(e);\n\t\t var gameValue = localStorage.getItem(gameKey);\n\t\t var gameInfoObject = JSON.parse(gameValue);\n\t\t if (gameInfoObject.console[1] === \"PC\") {\n\t\t\tvar newLi = document.createElement(\"li\");\n\t\t\tcreateUL.appendChild(newLi);\n\t\t\tvar newHeader = document.createElement(\"h3\");\n\t\t\tnewHeader.innerHTML = gameInfoObject.gameTitle[1];\n\t\t\tnewLi.appendChild(newHeader);\n\t\t\tvar consoleName = document.createElement(\"p\");\n\t\t\tconsoleName.innerHTML = gameInfoObject.console[1];\n\t\t\tnewLi.appendChild(consoleName);\n\t\t\timageAddition(gameInfoObject.console[1], newLi);\n\t\t\tvar gameList = document.createElement(\"ul\");\n\t\t\tnewLi.appendChild(gameList);\n\t\t\t for (var g in gameInfoObject) {\n\t\t\t var createGameList = document.createElement(\"li\");\n\t\t\t createGameList.setAttribute(\"id\", \"gameInfoList\");\n\t\t\t gameList.appendChild(createGameList);\n\t\t\t var gameTextOutput = gameInfoObject[g][0] + gameInfoObject[g][1];\n\t\t\t createGameList.innerHTML = gameTextOutput;\n\t\t\t }\n\t\t }\n\t\t}\n }", "function initApp() {\n\tinitSounds();\n\tinitSensors();\n\tshowWelcome();\n}", "function loadApplication() {\n console.log(\"Application loaded\");\n // Load directly to the main menu\n configureUI(displayMainMenu());\n\n}", "function startApp() {\n inputDataChannels.forEach(function (dataChannel) {\n if (dataChannel) {\n dataChannel.removeEventListener(divId);\n dataChannel.addEventListener('add', newValue, divId);\n }\n });\n\n minionObject.div.appendChild(minionObject.headline);\n minionObject.config.data = d34.range(minionObject.n).map(function() {\n return 0\n });\n minionObject.headline.appendChild(minionObject.headlineText);\n\n }", "async function init() {\n\n registerScreens(store, Provider);\n Navigation.startSingleScreenApp({\n screen: {\n screen: 'MAIN',\n title: ' ',\n navigatorStyle: {\n statusBarColor: 'black',\n statusBarTextColorScheme: 'light',\n navBarBackgroundColor: 'black',\n navBarTextColor: 'white',\n navBarButtonColor: 'white',\n tabBarButtonColor: 'red',\n tabBarSelectedButtonColor: 'red',\n tabBarBackgroundColor: 'white',\n backButtonHidden: true,\n },\n },\n animationType: 'slide-down', // optional, add transition animation to root change: 'none', 'slide-down', 'fade'\n });\n}", "function start() {\n //JSON loading promise\n let JSONLoaded;\n //If server side\n if (useNodeJS) {\n //Load json via the server\n JSONLoaded = getJSONServer('app/assets/mapData/mainLevel.json');\n //Else, loading on the client\n } else {\n //Load via the client\n JSONLoaded = getJSONClient('./assets/mapData/mainLevel.json');\n //Push the promise onto the list of pre-loading promises (client side loading state)\n state.game.loading.push(JSONLoaded);\n }\n\n //Once the promise has loaded, load the level\n JSONLoaded.then(loadLevel);\n }", "componentDidMount() {\n this.initializeTermsDictionary(urlBase)\n this.initializeDiscardedInfluencersList(urlBase)\n this.initializeBlacklistsObject(urlBase)\n }", "function init() {\n if (!!(window.localStorage.getItem('tabLista'))) {\n tabLista = JSON.parse(window.localStorage.getItem('tabLista'));\n } else {\n tabLista = [];\n }\n btnSave.addEventListener('click', saveTask);\n showList();\n }", "function wiiFetch(){\n\tvar createInfo = document.getElementById(\"wiiData\");\n\tcreateInfo.innerHTML = (\"\");\n\tif(localStorage.length === 0){\n\t addGameData();\n \t}\n\t\tvar createUL = document.createElement(\"ul\");\n\t\tcreateUL.setAttribute(\"id\", \"listCreation\");\n\t\tcreateUL.setAttribute(\"data-role\", \"listview\");\n\t\tcreateUL.setAttribute(\"data-filter\", \"true\");\n\t\tcreateUL.setAttribute(\"data-filter-placeholder\", \"Search for a game...\");\n\t\tcreateInfo.appendChild(createUL);\n\t\tfor (var e = 0, f = localStorage.length; e < f; e++) {\n\t\t var gameKey = localStorage.key(e);\n\t\t var gameValue = localStorage.getItem(gameKey);\n\t\t var gameInfoObject = JSON.parse(gameValue);\n\t\t if (gameInfoObject.console[1] === \"Wii U\") {\n\t\t\tvar newLi = document.createElement(\"li\");\n\t\t\tcreateUL.appendChild(newLi);\n\t\t\tvar newHeader = document.createElement(\"h3\");\n\t\t\tnewHeader.innerHTML = gameInfoObject.gameTitle[1];\n\t\t\tnewLi.appendChild(newHeader);\n\t\t\tvar consoleName = document.createElement(\"p\");\n\t\t\tconsoleName.innerHTML = gameInfoObject.console[1];\n\t\t\tnewLi.appendChild(consoleName);\n\t\t\timageAddition(gameInfoObject.console[1], newLi);\n\t\t\tvar gameList = document.createElement(\"ul\");\n\t\t\tnewLi.appendChild(gameList);\n\t\t\t for (var g in gameInfoObject) {\n\t\t\t var createGameList = document.createElement(\"li\");\n\t\t\t createGameList.setAttribute(\"id\", \"gameInfoList\");\n\t\t\t gameList.appendChild(createGameList);\n\t\t\t var gameTextOutput = gameInfoObject[g][0] + gameInfoObject[g][1];\n\t\t\t createGameList.innerHTML = gameTextOutput;\n\t\t\t }\n\t\t }\n\t\t}\n }", "function populateList() {\n\t\t$('#todo-list')\n\t\tvar allCompleted = true;\n\t\ttodos = JSON.parse(localStorage.getItem('todos'));\n\t\tif(todos.length > 0) {\n\t\t\tfor (var i = 0; i <= todos.length -1 ; i++) {\n\t\t\t\t// insert the Todo into the html list.\n\t\t\t\tinsertEntry(todos[i]['name'],todos[i]['id'],todos[i]['completed']);\n\t\t\t\tif(todos[i]['completed'] == false) {\n\t\t\t\t\tallCompleted = false;\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tif(allCompleted == true) {\n\t\t\t$('#toggle-all').prop('checked', true);\n\t\t}\n\n\t\tupdateTodosLeft();\n\n\n\t}", "function loadData (){\n\n // Load the data from local storage \n var productJSON = localStorage.getItem(\"price-list\"); \n console.log(\"Loaded Data\", productJSON)\n\n // Parse it into a JS data type and save to the global array \n products = JSON.parse(productJSON)\n console.log(products); \n\n //Double check that products is set to a list if null\n if (!products){\n products = []; \n }\n\n //Update the rendered display \n displayInventory(); \n\n}", "function showRuns(){\n //get runs object\n \n var runs = getRunsObject();\n \n //Check if empty\n if(runs != '' && runs !=null){\n for(var i=0; i<runs.length;i++){\n $('#stats').append('<li class=\"ui-body-inherit ui-li-static\"><strong>Date: </strong> '+runs[i].date+'<br/><strong>Distance: </strong>'+runs[i].miles+'m<div class=\"controls\"><a href=\"#edit\" id=\"editLink\" data-miles=\"'+runs[i].miles+'\" data-date=\"'+runs[i].date+'\">Edit</a> | <a href=\"#delete\">Delete</a> </div> </li>');\n \n }\n \n $('#home').bind('pageinit',function(){\n $('#stats').listview('refresh');\n \n });\n \n }\n \n }", "function populateApp() {\r\n // Access and parse data in local storage\r\n const selectedSeats = JSON.parse(localStorage.getItem('selectedSeats'));\r\n // Check if data is in local storage\r\n if(selectedSeats !== null && selectedSeats.length > 0) {\r\n seats.forEach((seat, index) => {\r\n if(selectedSeats.indexOf(index) > -1) {\r\n seat.classList.add('selected');\r\n }\r\n });\r\n }\r\n\r\n // Access movie index\r\n const selectedMovieIndex = localStorage.getItem('selectedMovieIndex');\r\n // Check if data is in local storage\r\n if(selectedMovieIndex !== null) {\r\n movieSelect.selectedIndex = selectedMovieIndex;\r\n }\r\n\r\n // Access ticket price\r\n const selectedMoviePrice = localStorage.getItem('selectedMoviePrice');\r\n // Check is data is in local storage\r\n if(selectedMoviePrice !== null) {\r\n ticketPrice = +selectedMoviePrice;\r\n }\r\n \r\n // Update selected seat count and price\r\n updateSelectedCount();\r\n}", "function init(){\n var savedEvents = JSON.parse(localStorage.getItem(\"savedEventsArray\"));\n if(savedEvents !== null){\n eventsArray = savedEvents; \n }\n renderEvents(); \n }", "function loadApp() {\n firebase.database().ref('locations/').once('value').then(createButtons);\n /* this is for handlebars to compile */\n detailsTemplateHtml = $(\"#location-details\").html();\n detailsTemplate = Handlebars.compile(detailsTemplateHtml);\n}", "function displayStorage() {\n let exists = localStorage.getItem('groceryList');\n\n if (exists) {\n let storageItems = JSON.parse(localStorage.getItem('groceryList'));\n storageItems.forEach(item=>{\n createItem(item)\n })\n } else {\n groceryList=[];\n }\n}", "function init() {\n if (window.APPLICATION.DATA) {\n if (!window.APPLICATION.INITIALIZED) {\n Router.run(Routes, Router.HistoryLocation, function(Handler, state) {\n if (window.APPLICATION.INITIALIZED) {\n resolveRoute(context, state).then(function(data) {\n render(Handler, data);\n });\n } else {\n render(Handler, window.APPLICATION.DATA);\n }\n });\n }\n window.APPLICATION.INITIALIZED = true;\n }\n}", "function initDashboard() {\n var dropdown = d3.select(\"#selDataset\")\n d3.json(\"samples.json\").then((data) => {\n var patientIDs = data.names;\n patientIDs.forEach((patientID) => {\n dropdown.append(\"option\").text(patientID).property(\"value\", patientID)\n })\n buildCharts(patientIDs[0]);\n populateDemoInfo(patientIDs[0]);\n });\n}", "function setupItems() {\n let items = getLocalStorage();\n\n if (items.length > 0) {\n items.forEach((item) => {\n createAllItems(item.id, item.value);\n });\n allList.classList.add(\"visible\");\n }\n}", "function initApp() {\r\n var startUpInfo;\r\n MemoryMatch.setPlatform();\r\n startUpInfo = \"Loading \" + MemoryMatch.getAppInfo();\r\n if (MemoryMatch.debugMode) {\r\n MemoryMatch.debugLog(startUpInfo);\r\n } else {\r\n console.log(startUpInfo);\r\n }\r\n\r\n // Listeners for all possible cache events\r\n\r\n var cache = window.applicationCache;\r\n if (cache != null) {\r\n cache.addEventListener('cached', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('checking', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('downloading', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('error', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('noupdate', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('obsolete', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('progress', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('updateready', MemoryMatch.logCacheEvent, false);\r\n }\r\n if (document.getElementById(MemoryMatch.loaderElement) != null) {\r\n // show canvas under loader so we can implement a loadbar until we get everything setup for EaselJS to take over\r\n document.getElementById(MemoryMatch.loaderElement).style.display = \"block\";\r\n document.getElementById(MemoryMatch.stageCanvasElement).style.display = \"block\";\r\n }\r\n\r\n // Determine canvas size, it will determine which assets need to be loaded\r\n MemoryMatch.isDesiredOrientationWhenLoadStarted = MemoryMatch.isDesiredOrientation();\r\n MemoryMatch.setCanvasSize(null);\r\n MemoryMatch.loadAllAssets(false);\r\n\r\n //runTests(); // run unit tests\r\n}", "function init() {\r\n self.patients = App.models.patients.getPatients();\r\n }", "static manupulateData(){\r\n const todo = Store.getDataFromLocalStorage()\r\n\r\n todo.forEach(ele => {\r\n const ui = new Ui()\r\n ui.createTodo(ele)\r\n });\r\n }", "function initializeApp() {\n displayIsInClientInfo();\n registerButtonHandlers();\n\n // check if the user is logged in/out, and disable inappropriate button\n if (liff.isLoggedIn()) {\n $.blockUI({ message: \"<h3>Please wait...</h3>\" });\n document.getElementById('liffLoginButton').disabled = true;\n liff.getProfile().then(function(profile) {\n setValue('USER_ID', profile.userId);\n\n const idToken = liff.getIDToken();\n setValue('ID_TOKEN',idToken);\n\n updateMappingTable();\n }).catch(function(error) {\n\n });\n } else {\n document.getElementById('liffLogoutButton').disabled = true;\n }\n}", "function init() {\n var storedCities = JSON.parse(localStorage.getItem(\"cities\"));\n\n // If cities were retrieved from localStorage, update the cities array\n if (storedCities !== null) {\n cities = storedCities;\n }\n // Render cities to the DOM\n renderCities();\n}", "function loadData() {\n // set all our variables\n setVars(twitch.configuration)\n // do an initial browse to `/`(root)\n navigate()\n // remove our loading element from the DM\n removeElement(\"repo-loading\")\n}", "function app_initialize() {\r\n\r\n // Check if user has been here before\r\n if (localStorage.getItem('dataListFavorites') === null) {\r\n localStorage.setItem('dataListFavorites', JSON.stringify(appData.favList));\r\n localStorage.setItem('dataListTags', JSON.stringify(appData.tagList));\r\n }\r\n\r\n // User has been here, load favorites and tag list.\r\n else {\r\n appData.favList = JSON.parse(localStorage.getItem('dataListFavorites'));\r\n appData.tagList = JSON.parse(localStorage.getItem('dataListTags'));\r\n }\r\n\r\n // Create listener for \"ENTER\"\r\n $(\"#app_input_field\").on('keyup', function (e) {\r\n if (e.keyCode == 13) {\r\n app_nav_add();\r\n }\r\n });\r\n}", "function start() {\n\treadStorage();\n\tdisplayAnn();\n}", "function getData(){\r\n\t\ttoggleControls(\"on\");\r\n\t\tif(localStorage.length === 0){\r\n\t\t\talert(\"There is no data in Local Storage.\");\r\n\t\t}\r\n\t\t//Write Data from Local Storage to the browser\r\n\t\tvar makeDiv = document.createElement('div');\r\n\t\tmakeDiv.setAttribute(\"id\", \"items\");\r\n\t\tvar makeList = document.createElement('ul');\r\n\t\tmakeDiv.appendChild(makeList);\r\n\t\tdocument.body.appendChild(makeDiv);\r\n\t\te('items').style.display = \"block\";\r\n\t\tfor(var i=0, j=localStorage.length; i<j; i++){\r\n\t\t\tvar makeLi = document.createElement('li');\r\n\t\t\tmakeList.appendChild(makeLi);\r\n\t\t\tvar key = localStorage.key(i);\r\n\t\t\tvar value = localStorage.getItem(key);\r\n\t\t\t//Convert the string from local storage value back to an object by using JSON.parse()\r\n\t\t\tvar obj = JSON.parse(value);\r\n\t\t\tvar makeSubList = document.createElement('ul');\r\n\t\t\tmakeLi.appendChild(makeSubList);\r\n\t\t\tfor (var n in obj){\r\n\t\t\t\tvar makeSubLi = document.createElement('li');\r\n\t\t\t\tmakeSubList.appendChild(makeSubLi);\r\n\t\t\t\tvar optSubText = obj[n][0] + \" \" + obj[n][1];\r\n\t\t\t\tmakeSubLi.innerHTML = optSubText;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function start() {\n var productListsForm = session.forms.productlists;\n\n Form.get(productListsForm).clear();\n\n\n var GetProductListsResult = new Pipelet('GetProductLists').execute({\n Customer: customer,\n Type: ProductList.TYPE_GIFT_REGISTRY\n });\n var ProductLists = GetProductListsResult.ProductLists;\n\n Form.get(productListsForm.items).copyFrom(ProductLists);\n\n var accountGiftRegistry = Content.get('myaccount-giftregistry');\n\n var pageMeta = require('~/cartridge/scripts/meta');\n pageMeta.update(accountGiftRegistry);\n\n app.getView().render('account/giftregistry/registrylist');\n}" ]
[ "0.59323996", "0.56871825", "0.5675425", "0.5674934", "0.56538576", "0.56501347", "0.5582662", "0.55604446", "0.5547809", "0.5547011", "0.5534667", "0.5527577", "0.550921", "0.54886526", "0.5472485", "0.54695433", "0.5443766", "0.5434545", "0.539543", "0.5377688", "0.5361831", "0.5353379", "0.5341066", "0.53306687", "0.5329335", "0.5320405", "0.5306491", "0.5295063", "0.5292322", "0.5291485", "0.52908146", "0.52777773", "0.52696687", "0.52663815", "0.5263274", "0.52622795", "0.5259147", "0.52468187", "0.52446896", "0.52412945", "0.52412343", "0.5240781", "0.5230473", "0.5226407", "0.5221323", "0.521939", "0.51977885", "0.5195502", "0.5193328", "0.5191664", "0.51877", "0.5186804", "0.51818943", "0.51714087", "0.5164633", "0.5164004", "0.51610243", "0.5155034", "0.515473", "0.5154112", "0.5153051", "0.5151733", "0.5148984", "0.51458275", "0.5143394", "0.5142566", "0.5131709", "0.5126929", "0.51268625", "0.5125313", "0.51237494", "0.5122032", "0.51155096", "0.5114763", "0.50941294", "0.5086986", "0.5086922", "0.50855786", "0.50701314", "0.50622195", "0.5058458", "0.5058007", "0.50577295", "0.5056621", "0.5053762", "0.504838", "0.5047376", "0.5043433", "0.50351995", "0.50344604", "0.50308084", "0.50293237", "0.5026478", "0.50258654", "0.50223047", "0.50222665", "0.5022073", "0.50198984", "0.5018149", "0.50159234" ]
0.56945276
1
Slightly modified to call the services and pass the values
function hexFromRGB(r, g, b) { var hex = [ r.toString( 16 ), g.toString( 16 ), b.toString( 16 ) ]; $.each( hex, function( nr, val ) { if ( val.length === 1 ) { hex[ nr ] = "0" + val; } }); return hex.join( "" ).toUpperCase(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_callMethod(service, call) {\n const services = ContainerBuilder.getServiceConditionals(call[1]);\n\n for (const service of services) {\n if (! this.has(service)) {\n return;\n }\n }\n\n call = getCallableFromArray([ service, call[0] ]);\n call.apply(service, this._resolveServices(this.parameterBag.unescapeValue(this.parameterBag.resolveValue(call[1]))));\n }", "call(moduleName, functionName, params) {\n const override = this.runtime.config(['services', moduleName, 'url'].join('.'));\n const token = this.runtime.service('session').getAuthToken();\n let client;\n if (override) {\n client = new GenericClient({\n module: moduleName,\n url: override,\n token: token\n });\n } else {\n client = new DynamicService({\n url: this.runtime.config('services.service_wizard.url'),\n token: token,\n module: moduleName\n });\n }\n return client.callFunc(functionName, [params]).catch((err) => {\n console.error(\n 'err',\n err instanceof Error,\n err instanceof exceptions.CustomError,\n err instanceof exceptions.AjaxError,\n err instanceof exceptions.ServerError\n );\n if (err instanceof exceptions.AjaxError) {\n console.error('AJAX Error', err);\n throw new utils.JGISearchError('ajax', err.code, err.message, null, {\n originalError: err\n });\n } else if (err instanceof exceptions.RpcError) {\n console.error('RPC Error', err);\n throw new utils.JGISearchError('ajax', err.name, err.message, null, {\n originalError: err\n });\n } else {\n throw new utils.JGISearchError('rpc-call', err.name, err.message, null, {\n originalError: err\n });\n }\n });\n }", "function getServices() {\n bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes = {\n \"Pickup\": \"PIC\",\n \"Delivery\": \"DLV\",\n \"FactoryStuffing\": \"FAS\",\n \"ExportClearance\": \"EXC\",\n \"ImportClearance\": \"IMC\",\n \"CargoInsurance\": \"CAI\"\n }\n\n var _input = {\n \"EntityRefKey\": bkgBuyerSupplierDirectiveCtrl.ePage.Entities.Header.Data.UIJobPickupAndDelivery.PK,\n };\n\n var inputObj = {\n \"FilterID\": appConfig.Entities.JobService.API.FindAll.FilterID,\n \"searchInput\": helperService.createToArrayOfObject(_input)\n }\n if (!bkgBuyerSupplierDirectiveCtrl.obj.isNew) {\n apiService.post('eAxisAPI', appConfig.Entities.JobService.API.FindAll.Url, inputObj).then(function (response) {\n if (response.data.Response) {\n bkgBuyerSupplierDirectiveCtrl.ePage.Entities.Header.Data.UIJobServices = response.data.Response\n if (bkgBuyerSupplierDirectiveCtrl.ePage.Entities.Header.Data.UIJobServices.length != 0) {\n for (var i in bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes) {\n var tempObj = _.filter(bkgBuyerSupplierDirectiveCtrl.ePage.Entities.Header.Data.UIJobServices, {\n 'ServiceCode': bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes[i]\n })[0];\n if (tempObj == undefined) {\n bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes[i] = 'false'\n } else {\n bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes[i] = tempObj.ServiceCode\n }\n }\n } else {\n for (var i in bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes) {\n bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes[i] = \"false\"\n }\n }\n }\n });\n } else {\n for (var i in bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes) {\n bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes[i] = \"false\"\n }\n }\n\n }", "run(callback, context) {\n //调用service的reques方法,获取相应属性后设置进service\n this.request(function (error, response) {\n let resp = this._resolveResponse(response);\n callback.call(context, resp);\n }, this)\n }", "function callService(start, end, callback) {\n console.log('calling', start, end);\n globalTries++;\n request.get(`http://34.209.24.195/facturas?id=${id}&start=${start}&finish=${end}`, function (error, response) {\n if (Number.isInteger(parseInt(response.body))) {\n globalBills = globalBills + parseInt(response.body);\n }\n return callback(error, response);\n });\n}", "function getServicesList() {\n\t\t\tcustApi.getServices().\n\t\t\tsuccess(function (data, status, header, config) {\n\t\t\t\tconsole.log(\"Services retrieved successfully\");\n\t\t\t\tvm.apptCost = data.payload[0].rate;\n\t\t\t\tvar serviceMap = buildServicesMap(data.payload);\n\t\t\t\tvm.physiotherapyId = serviceMap[\"physiotherapy\"];\n\t\t\t\tcustportalGetSetService.setPhysioId({\"physioId\": vm.physiotherapyId, \"apptCost\": vm.apptCost});\n\t\t\t}).\n\t\t\terror(function (data, status, header, config) {\n\t\t\t\tconsole.log(\"Error in retrieving services\");\n\t\t\t});\n\t\t}", "AddService2(string, int, string) {\n\n }", "_call_local_service(name, fun, args, cb) {\n if (name in this.services) {\n const rq = {\n type: 'call',\n fun: fun,\n args: args,\n };\n\n return this._req(this.service_socks[name], rq, (rsp) => {\n if (rsp.status != 'ok') return cb(rsp.status);\n return cb(null, rsp.ret);\n });\n }\n return cb('err: no service');\n }", "fetchServicesFromApi()\n {\n //all paths are configurable in 'config.js'\n const serviceCatalogAPI = bcConfig.urlBase + bcConfig.urlPathToREDCap + bcConfig.serviceCatalogApi;\n\n fetch(serviceCatalogAPI)\n .then(response => response.json())\n .then(jsondata => {\n this._jsondata = jsondata;//need this for searches\n this.parseJsonListOfServices(jsondata);\n if (this.fullServiceList) \n {\n this.setStateData(this.fullServiceList);\n }\n else\n {\n this.setStateData([]);\n }\n }).catch(err => this.setStateData([]));\n }", "function defineServiceTest(i) {\n let cd = \"BJ00\" + i;\n let name = \"测试服务\";\n let desc = \"测试\";\n let defType = \"type001\";\n let github = \"xxxx3\";\n let definition = \"xxxx1\";\n\n service.defineService(wallet, cd, name, desc, defType, definition, github, 20000000000, 4300000)\n .then(function (val) {\n console.log('val', val);\n }, function (error) {\n console.log('error', error);\n });\n\n}", "function getServicesList() {\n\t\tcustApi.getServices().\n\t\tsuccess(function (data, status, header, config) {\n\t\t\tconsole.log(\"Services retrieved successfully\");\n\t\t\tvar serviceMap = buildServicesMap(data.payload);\n\t\t\tvm.model.physiotherapyId = serviceMap[\"physiotherapy\"];\n\t\t}).\n\t\terror(function (data, status, header, config) {\n\t\t\tconsole.log(\"Error in retrieving services\");\n\t\t});\n\t}", "function JsonService(url)\n{\n this[\"GetUserSummary\"] = function(userDate, callback)\n {\n return call(\"GetUserSummary\", [ userDate ], callback);\n }\n\n this[\"DeleteCategory\"] = function(categoryID, callback)\n {\n return call(\"DeleteCategory\", [ categoryID ], callback);\n }\n\n this[\"InsertCategory\"] = function(category, callback)\n {\n return call(\"InsertCategory\", [ category ], callback);\n }\n\n this[\"UpdateCategory\"] = function(category, callback)\n {\n return call(\"UpdateCategory\", [ category ], callback);\n }\n\n this[\"InsertSubCategory\"] = function(subCategory, callback)\n {\n return call(\"InsertSubCategory\", [ subCategory ], callback);\n }\n\n this[\"UpdateSubCategory\"] = function(subCategory, callback)\n {\n return call(\"UpdateSubCategory\", [ subCategory ], callback);\n }\n\n this[\"DeleteSubCategory\"] = function(subCategoryID, callback)\n {\n return call(\"DeleteSubCategory\", [ subCategoryID ], callback);\n }\n\n this[\"InsertTrans\"] = function(trans, callback)\n {\n return call(\"InsertTrans\", [ trans ], callback);\n }\n\n this[\"DeleteTrans\"] = function(transID, callback)\n {\n return call(\"DeleteTrans\", [ transID ], callback);\n }\n\n this[\"UpdateTrans\"] = function(trans, callback)\n {\n return call(\"UpdateTrans\", [ trans ], callback);\n }\n\n this[\"SearchTrans\"] = function(startDate, endDate, categoryType, catIDString, amountOperator, amount, callback)\n {\n return call(\"SearchTrans\", [ startDate, endDate, categoryType, catIDString, amountOperator, amount ], callback);\n }\n\n this[\"GetTransPieGraphForDefaultDateRange\"] = function(defaultDateRange, categoryType, currentUserDate, callback)\n {\n return call(\"GetTransPieGraphForDefaultDateRange\", [ defaultDateRange, categoryType, currentUserDate ], callback);\n }\n\n this[\"GetTransPieGraphForCustomDateRange\"] = function(categoryType, startDate, endDate, callback)\n {\n return call(\"GetTransPieGraphForCustomDateRange\", [ categoryType, startDate, endDate ], callback);\n }\n\n /* Returns an array of method names implemented by this service. */\n\n this[\"system.listMethods\"] = function(callback)\n {\n return call(\"system.listMethods\", [ ], callback);\n }\n\n /* Returns the version server implementation using the major, minor, build and revision format. */\n\n this[\"system.version\"] = function(callback)\n {\n return call(\"system.version\", [ ], callback);\n }\n\n /* Returns a summary about the server implementation for display purposes. */\n\n this[\"system.about\"] = function(callback)\n {\n return call(\"system.about\", [ ], callback);\n }\n\n var serviceURL = \"https://\" + window.location.host + \"/Service/ExpJSONService.ashx\";\n var url = typeof (url) === 'string' ? url : serviceURL;\n\n var self = this;\n var nextId = 0;\n\n function call(method, params, callback)\n {\n var request = { id : nextId++, method : method, params : params };\n return callback == null ?\n callSync(method, request) : callAsync(method, request, callback);\n }\n\n function callSync(method, request)\n {\n var http = newHTTP();\n http.open('POST', url, false, self.httpUserName, self.httpPassword);\n setupHeaders(http, method);\n http.send(JSON.stringify(request));\n if (http.status != 200)\n throw { message : http.status + ' ' + http.statusText, toString : function() { return message; } };\n var response = JSON.eval(http.responseText);\n if (response.error != null) throw response.error;\n return response.result;\n }\n\n function callAsync(method, request, callback)\n {\n var http = newHTTP();\n http.open('POST', url, true, self.httpUserName, self.httpPassword);\n setupHeaders(http, method);\n http.onreadystatechange = function() { http_onreadystatechange(http, callback); }\n http.send(JSON.stringify(request));\n return request.id;\n }\n\n function setupHeaders(http, method)\n {\n http.setRequestHeader('Content-Type', 'text/plain; charset=utf-8');\n http.setRequestHeader('X-JSON-RPC', method);\n }\n\n function http_onreadystatechange(sender, callback)\n {\n if (sender.readyState == /* complete */ 4)\n {\n var response = sender.status == 200 ?\n JSON.eval(sender.responseText) : {};\n\n response.xmlHTTP = sender;\n\n callback(response);\n }\n }\n\n function newHTTP()\n {\n if (typeof(window) != 'undefined' && window.XMLHttpRequest)\n return new XMLHttpRequest(); /* IE7, Safari 1.2, Mozilla 1.0/Firefox, and Netscape 7 */\n else\n return new ActiveXObject('Microsoft.XMLHTTP'); /* WSH and IE 5 to IE 6 */\n }\n}", "getServiceInfos(service) {\n return this.OvhHttp.get(\n `${service.path}/${window.encodeURIComponent(\n service.serviceName,\n )}/serviceInfos`,\n {\n rootPath: 'apiv6',\n },\n ).then(\n (serviceInfos) =>\n new BillingService({\n ...service,\n ...serviceInfos,\n }),\n );\n }", "init() {\n this._SfService.do('ProductController.getProducts', 'SRV-234', 34)\n .then( console.log )\n .catch( console.log )\n }", "function runService(app, index) {\n\t//If the app has been stopped, simply return\n\tif(app.length <= index) {\n\t\tconsole.log(\"app stopped successfully\");\n\t\treturn;\n\t}\n\tlet param = app[index];\n\tif(\"AppName\" in param) {\n\t\tlet next = runService.bind(null, app, index + 1);\n\t\tsetTimeout(next, 1000);\n\t\treturn;\n\t}\n\n\tif(param.type == \"servicesRelationship\")\n\t\tcreateClientForOneRelationship(param);\n\telse if(param.type == \"condEval\") {\n\t\t//console.log(\"is condeval*****************\",param.condObj.type, param.evalObj.type);\n\t\tif(param.condObj.type == \"servicesRelationship\" && param.evalObj.type == \"servicesRelationship\")\n\t\t\tcreateClientForIfRelationshipThenRelationship(param.condObj, param.evalObj);\n\t\telse if(param.condObj.type == \"servicesRelationship\")\n\t\t\tcreateClientForIfRelationshipThenService(param.condObj, param.evalObj);\n\t\telse if(param.evalObj.type == \"servicesRelationship\")\n\t\t\tcreateClientForIfServiceThenRelationship(param.condObj, param.evalObj);\n\t\telse\n\t\t\tcreateClientForIfServiceThenService(param.condObj, param.evalObj);\n\t}\n\telse\n\t\tcreateClientForOneService(param);\n\t//execute tne next thing in this app\n\tlet next = runService.bind(null, app, index + 1);\n\tsetTimeout(next, 1000);\n}", "AddService(string, string) {\n\n }", "function CallGetService (data, url, async, callBack) {\n\n\t\t$.ajax ({\n\t\t\ttype: 'POST',\n\t\t\tdataType: 'json',\n\t\t\turl: url,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg) {\n\n\t\t\t\treturn callBack(msg);\n\n\t\t\t},\n\t\t\terror: function(error) {\n\n\t\t\t\tconsole.log(error);\n\n\t\t\t}\n\t\t});\n\n\t}", "function getWatsonQAServices(onSuccessCallback,onFailCallback){\n\tvar invocationData = {\n\t adapter : 'WatsonQA',\n\t procedure : 'getServices',\n\t parameters : []\n\t };\n\t\n\tvar options = {\n\t\tonSuccess : onSuccessCallback,\n\t\tonFailure : onFailCallback,\n\t};\n\n\tWL.Client.invokeProcedure(invocationData,options);\n}", "function getvals(mot) {\n// let v = mot.call('stat',null, (data, opt) => { console.log(\"call: \",JSON.stringify(data),typeof opt==='undefined'?\"\":opt); });\nlet v1 = mot.stat((data) => { \n //console.log(\"stat: \",JSON.stringify(data)); \n});\nlet v2 = mot.pos((data) => { \n //console.log(\"stat: \",JSON.stringify(data)); \n});\n}", "setServices(services, callback) {\n let decodeUUID = (uuid, data) => {\n return new Promise((resolve, reject) => {\n const length = uuid.length === 32 ? 16 : 2;\n\n this._adapter.decodeUUID(length, uuid, (err, _uuid) => {\n if (err) {\n // If the UUID is not found it is a 128-bit UUID\n // so we have to add it to the SD and try again\n if (err.errno === this._bleDriver.NRF_ERROR_NOT_FOUND && length === 16) {\n this._adapter.addVendorspecificUUID(\n {uuid128: uuid},\n (err, type) => {\n if (err) {\n reject(_makeError(`Unable to add UUID ${uuid} to SoftDevice`, err));\n } else {\n this._adapter.decodeUUID(length, uuid, (err, _uuid) => {\n if (err) {\n reject(_makeError(`Unable to decode UUID ${uuid}`, err));\n } else {\n data.decoded_uuid = _uuid;\n resolve(data);\n }\n });\n }\n }\n );\n } else {\n reject(_makeError(`Unable to decode UUID ${uuid}`, err));\n }\n } else {\n data.decoded_uuid = _uuid;\n resolve(data);\n }\n });\n });\n };\n\n let addService = (service, type, data) => {\n return new Promise((resolve, reject) => {\n var p = Promise.resolve(data);\n var decode = decodeUUID.bind(undefined, service.uuid);\n\n p.then(decode).then(data => {\n this._adapter.gattsAddService(type, data.decoded_uuid, (err, serviceHandle) => {\n if (err) {\n reject(_makeError('Error occurred adding service.', err));\n } else {\n data.serviceHandle = serviceHandle;\n service.startHandle = serviceHandle;\n this._services[service.instanceId] = service; // TODO: what if we fail later on this service ?\n resolve(data);\n }\n });\n }).catch(err => {\n reject(err);\n });\n });\n };\n\n let addCharacteristic = (characteristic, data) => {\n return new Promise((resolve, reject) => {\n this._converter.characteristicToDriver(characteristic, (err, characteristicForDriver) => {\n if (err) {\n reject(_makeError('Error converting characteristic to driver.', err));\n } else {\n this._adapter.gattsAddCharacteristic(\n data.serviceHandle,\n characteristicForDriver.metadata,\n characteristicForDriver.attribute,\n (err, handles) => {\n if (err) {\n reject(_makeError('Error occurred adding characteristic.', err));\n } else {\n characteristic.valueHandle = data.characteristicHandle = handles.value_handle;\n characteristic.declarationHandle = characteristic.valueHandle - 1; // valueHandle is always directly after declarationHandle\n this._characteristics[characteristic.instanceId] = characteristic; // TODO: what if we fail later on this ?\n resolve(data);\n\n if (!characteristic._factory_descriptors) {\n return;\n }\n\n const findDescriptor = uuid => {\n return characteristic._factory_descriptors.find(descriptor => {\n return descriptor.uuid === uuid;\n });\n };\n\n if (handles.user_desc_handle) {\n const userDescriptionDescriptor = findDescriptor('2901');\n this._descriptors[userDescriptionDescriptor.instanceId] = userDescriptionDescriptor;\n userDescriptionDescriptor.handle = handles.user_desc_handle;\n }\n\n if (handles.cccd_handle) {\n const cccdDescriptor = findDescriptor('2902');\n this._descriptors[cccdDescriptor.instanceId] = cccdDescriptor;\n cccdDescriptor.handle = handles.cccd_handle;\n cccdDescriptor.value = {};\n\n for (let deviceInstanceId in this._devices) {\n this._setDescriptorValue(cccdDescriptor, [0, 0], deviceInstanceId);\n }\n }\n\n if (handles.sccd_handle) {\n const sccdDescriptor = findDescriptor('2903');\n this._descriptors[sccdDescriptor.instanceId] = sccdDescriptor;\n sccdDescriptor.handle = handles.sccd_handle;\n }\n }\n }\n );\n }\n });\n });\n };\n\n let addDescriptor = (descriptor, data) => {\n return new Promise((resolve, reject) => {\n this._converter.descriptorToDriver(descriptor, (err, descriptorForDriver) => {\n if (err) {\n reject(_makeError('Error converting descriptor.', err));\n } else if (descriptorForDriver) {\n this._adapter.gattsAddDescriptor(\n data.characteristicHandle,\n descriptorForDriver,\n (err, handle) => {\n if (err) {\n reject(_makeError(err, 'Error adding descriptor.'));\n } else {\n descriptor.handle = data.descriptorHandle = handle;\n this._descriptors[descriptor.instanceId] = descriptor; // TODO: what if we fail later on this ?\n resolve(data);\n }\n }\n );\n }\n });\n });\n };\n\n let promiseSequencer = (list, data) => {\n var p = Promise.resolve(data);\n return list.reduce((previousP, nextP) => {\n return previousP.then(nextP);\n }, p);\n };\n\n let applyGapServiceCharacteristics = gapService => {\n for (let characteristic of gapService._factory_characteristics) {\n // TODO: Fix Device Name uuid magic number\n if (characteristic.uuid === '2A00') {\n // TODO: At some point addon should accept string.\n this._setDeviceNameFromArray(characteristic.value, characteristic.writePerm, err => {\n if (!err) {\n characteristic.declarationHandle = 2;\n characteristic.valueHandle = 3;\n this._characteristics[characteristic.instanceId] = characteristic;\n }\n });\n }\n\n // TODO: Fix Appearance uuid magic number\n if (characteristic.uuid === '2A01') {\n this._setAppearanceFromArray(characteristic.value, err => {\n if (!err) {\n characteristic.declarationHandle = 4;\n characteristic.valueHandle = 5;\n this._characteristics[characteristic.instanceId] = characteristic;\n }\n });\n }\n\n // TODO: Fix Peripheral Preferred Connection Parameters uuid magic number\n if (characteristic.uuid === '2A04') {\n this._setPPCPFromArray(characteristic.value, err => {\n if (!err) {\n characteristic.declarationHandle = 6;\n characteristic.valueHandle = 7;\n this._characteristics[characteristic.instanceId] = characteristic;\n }\n });\n }\n }\n };\n\n // Create array of function objects to call in sequence.\n var promises = [];\n\n for (let service of services) {\n var p;\n\n if (service.uuid === '1800') {\n service.startHandle = 1;\n service.endHandle = 7;\n applyGapServiceCharacteristics(service);\n this._services[service.instanceId] = service;\n continue;\n } else if (service.uuid === '1801') {\n service.startHandle = 8;\n service.endHandle = 8;\n this._services[service.instanceId] = service;\n continue;\n }\n\n p = addService.bind(undefined, service, this._getServiceType(service));\n promises.push(p);\n\n if (service._factory_characteristics) {\n for (let characteristic of service._factory_characteristics) {\n p = addCharacteristic.bind(undefined, characteristic);\n promises.push(p);\n\n if (characteristic._factory_descriptors) {\n for (let descriptor of characteristic._factory_descriptors) {\n if (!this._converter.isSpecialUUID(descriptor.uuid)) {\n p = addDescriptor.bind(undefined, descriptor);\n promises.push(p);\n }\n }\n }\n }\n }\n }\n\n // Execute the promises in sequence, start with an empty object that\n // is propagated to all promises.\n promiseSequencer(promises, {}).then(data => {\n // TODO: Ierate over all servicses, descriptors, characterstics from parameter services\n if (callback) { callback(); }\n }).catch(err => {\n this.emit('error', err);\n if (callback) { callback(err); }\n });\n }", "function service(){\n\tchef.apply(null,arguments);\n}", "function SetAPI(arg) {\n // Establish an auth object which has properties token and user_id.\n const module = 'SetAPI';\n let auth;\n if (typeof arg.auth === 'function') {\n auth = arg.auth();\n } else {\n // REALLY??\n auth = arg.auth || {};\n }\n\n if (!arg.url) {\n throw new Error('The service discovery url was not provided');\n }\n if (!arg.version) {\n throw new Error('The service version was not provided');\n }\n\n function options() {\n return {\n timeout: arg.timeout,\n authorization: auth.token,\n rpcContext: arg.rpcContext,\n };\n }\n\n this.lookupModule = function () {\n const func = 'get_service_status',\n params = [\n {\n module_name: module,\n version: arg.version || 'dev',\n },\n ];\n return jsonRpc.request(arg.url, 'ServiceWizard', func, params, 1, options());\n };\n\n /*\n * ref\n */\n this.get_reads_set_v1 = function () {\n const params = Array.prototype.slice.call(arguments),\n func = 'get_reads_set_v1';\n\n return this.lookupModule().then((serviceStatus) => {\n return jsonRpc.request(serviceStatus.url, module, func, params, 1, options());\n });\n };\n\n /*\n * ref\n */\n this.save_reads_set_v1 = function () {\n const params = Array.prototype.slice.call(arguments),\n func = 'save_reads_set_v1';\n\n return this.lookupModule().then((serviceStatus) => {\n return jsonRpc.request(serviceStatus.url, module, func, params, 1, options());\n });\n };\n\n /*\n * ref\n */\n this.list_sets = function () {\n const params = Array.prototype.slice.call(arguments),\n func = 'list_sets';\n\n return this.lookupModule().then((serviceStatus) => {\n return jsonRpc.request(serviceStatus.url, module, func, params, 1, options());\n });\n };\n\n /*\n * ref\n */\n this.get_set_items = function () {\n const params = Array.prototype.slice.call(arguments),\n func = 'get_set_items';\n\n return this.lookupModule().then((serviceStatus) => {\n return jsonRpc.request(serviceStatus.url, module, func, params, 1, options());\n });\n };\n\n /*\n * ref\n */\n this.status = function () {\n const params = Array.prototype.slice.call(arguments),\n func = 'status';\n\n return this.lookupModule().then((serviceStatus) => {\n return jsonRpc.request(serviceStatus.url, module, func, params, 1, options());\n });\n };\n }", "async function getServiceCalls() {\n const data = await API.get(\"instapostservicecallsapi\", `/service-calls`);\n updateServiceCalls(data.service_calls_count[\"service-calls\"]);\n setLoading(true);\n }", "function execute(param1, param2, client) {\n // cat%3A*&rows=50&sort=price%desc&wt=json\n // fq=price%3A%5B4%20TO%2010%5D&q=.... price:[4 TO 10]\n const consulta = `q=${param1}%3A${param2}&rows=100&sort=price%20desc&wt=json`;\n console.log(consulta);\n return client\n .search(consulta)\n .then(function(result, resolve) {\n return result.response.docs;\n })\n .then(results => {\n let data = results.map(function(result) {\n if (!result.price) {\n return {\n id: null,\n name: null,\n value: null\n };\n }\n return {\n id: result.id,\n name: result.name[0],\n value: result.price[0]\n };\n });\n //data = { subvalues: data };\n // console.log(data);\n return data;\n })\n .catch(function(err) {\n console.error(err);\n });\n}", "function accessServicesT(...s) {\n return f => access(r => f(...A.map_(s, v => r[v.key])));\n}", "function test_access_child_services_from_the_my_service() {}", "getClientCalls() {\n\n }", "function queryServiceNow()\n{\n RMPApplication.debug(\"begin queryServiceNow: sn_query = \", sn_query);\n c_debug(dbug.query, \"=> queryServiceNow: sn_query = \", sn_query);\n $(\"#id_spinner_search_top\").show();\n $(\"#id_spinner_search_bottom\").show();\n clearOrderDataTable();\n clearTaskDataTable();\n \n var input = {};\n var option = {};\n input.query = sn_query;\n c_debug(dbug.query, \"=> queryServiceNow: input = \", input);\n id_get_work_order_list_api.trigger(input, option, order_ok, order_ko);\n\n RMPApplication.debug(\"end queryServiceNow\");\n}", "function makeServiceSuggestions(payload){\n if (payload.output && payload.output.text==\"suggestServices\") {\n var context = payload.context;\n\n /*\n\t\tpayload.output.text = general_services; --TODO - see Google Doc\n\t\tif context.age < 26, payload=youth_services etc --TODO - see Google Doc\n */\n\n if (context.gender==\"female\"){\n payload.output.text = female_services;\n } else if (context.gender==\"male\"){\n payload.output.text = male_services;\n }\n if(context.lgbti==\"yes\" | \"unsure\"){\n payload.output.text += \"<br/><br/>\" + lgbti_services;\n }\n if(context.indigenous==\"yes\"){\n payload.output.text += \"<br/><br/>\" + indigenous_services;\n }\n if(context.immigrant==\"yes\"){\n payload.output.text += \"<br/><br/>\" + immigrant_services;\n }\n if(context.disability==\"yes\"){\n payload.output.text += \"<br/><br/>\" + disability_services;\n }\n }\n }", "function accessServicesTM(...s) {\n return f => accessManaged(r => f(...A.map_(s, v => r[v.key])));\n}", "function requestUserdataFromService () {\n\t\t// If the page isn't on an ibm.com domain, don't even call the service b/c it won't work and will throw a JS error.\n\t\tif (window.location.hostname.indexOf(\".ibm.com\") === -1) {\n\t\t\tmyEvents.publish(\"error\");\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t// Allows you to pass any IP address via \"?ip=x.x.x.x\" in page URL for testing.\n\t\t// Build user data from returned data from service and populate our user object with it.\n\t\t// Then store it in localstorage for caching.\n\t\t$.getJSON(\"//www.ibm.com/webmaster/dbip/ip/?callback=?\" + (ipForced !== \"\" ? \"&query=\" + ipForced : \"\")).done(function (data) {\n\t\t\tvar userData = buildUserdataFromServiceRequest(data);\n\n\t\t\tpopulateUserObject(userData);\n\t\t\tstoreUserData();\n\t\t});\n\t}", "function getAllServiceName() {\n var services = Array();\n\n $.ajax({\n url: OVEconfig.BASEURL + '/practitioner/getspservices/',\n type: 'POST',\n async: false,\n data: {all: true, sp_id: $('input#sp_id').val()},\n dataType: 'json',\n success: function(data) {\n services = data.services_list;\n },\n error: function(xhr, errorType, errorMsg) {\n console.log(errorMsg)\n }\n });\n\n var servicename = 'No Services';\n\n if (services != null && services.length > 0) {\n var servicename = '';\n for (var i = 0; i < services.length; i++)\n {\n servicename += (services[i].name) ? ((i < services.length - 1) ? (services[i].name + \",\") : services[i].name) : (servicename);\n }\n }\n $('#servicename').html(servicename);\n}", "function main() {\n setReqURL()\n startMicroservice()\n registerWithCommMgr()\n}", "function sendCurrentValues(){\n\tcarIndicator.getStatus(function(currentStatus){\n\n\t\tfor(v in hvacServices){\n\t\t\tvar hvacService = hvacServices[v];\n\n\t\t\tif (hvacService.indicator_extra_name != undefined && carIndicator.extras[hvacService.indicator_extra_name] != undefined) {\n\t\t\t\tconsole.log(\"Name: \" + hvacService.name + \" Current Val: \" + carIndicator.extras[hvacService.indicator_extra_name]);\n\t\t\t\tsendRVIHVAC(hvacService.name, carIndicator.extras[hvacService.indicator_extra_name]);\n\t\t\t}\n\n\t\t\tif(hvacService.indicator_name == undefined)\n\t\t\t\tcontinue;\n\n\t\t\tif(currentStatus[hvacService.indicator_name] != undefined){\n\t\t\t\tconsole.log(\"Name: \" + hvacService.name + \" Current Val: \" + currentStatus[hvacService.indicator_name]);\n\t\t\t\tsendRVIHVAC(hvacService.name, currentStatus[hvacService.indicator_name]);\n\t\t\t}\n\t\t}\n\t});\n}", "async callFunction(name, ...args) {\n // See https://github.com/mongodb/stitch-js-sdk/blob/master/packages/core/sdk/src/services/internal/CoreStitchServiceClientImpl.ts\n const body = {\n name,\n arguments: this.argsTransformation ? this.argsTransformation(args) : args\n };\n\n if (this.serviceName) {\n body.service = this.serviceName;\n }\n\n const appRoute = this.fetcher.appRoute;\n\n return this.fetcher.fetchJSON({\n method: 'POST',\n path: appRoute.functionsCall().path,\n body\n });\n }", "function VolunteerOpenCloseTaskService (){\nkony.application.showLoadingScreen(null, \"Loading..\", \nconstants.LOADING_SCREEN_POSITION_ONLY_CENTER, true, true, { \nshouldShowLabelInBottom: \"false\", separatorHeight: 20} );\n \n // Let's get the news type the user selected\n //var selectedKey = frmFoxNews.lstNewsType.selectedKey;\n // alert(\"into function1\");\n // Let's first check that the user picked a valid value\n //if (!kony.string.equalsIgnoreCase(selectedKey, \"none\")){\n // Populating the input params for the service call and invoking the service\n // We're passing in the selected key for the user's selection in the combobox\n // var inputParams = {serviceID:\"getFoxNews\",newsType:selectedKey};\n // Now we make the call to the service using our input parameters and specifying\n // the function processServiceResults as our callback when the service returns results\n // appmiddlewareinvokerasync(inputParams, processServiceResults);\n if (!mobileFabricConfigurationForVolunteerOpenCloseTask.isKonySDKObjectInitialized)\n {\n initializeMobileFabricForVolunteerOpenCloseTask();\n \n }\n else if (mobileFabricConfigurationForVolunteerOpenCloseTask.isKonySDKObjectInitialized)\n {\n getVolunteerOpenCloseTask();\n }\n }", "function Services(commons) {\n\n /* If this constructor is called without the \"new\" operator, \"this\" points\n * to the global object. Log a warning and call it correctly. */\n\n if (false === (this instanceof Services)) {\n console.log('Warning: Services constructor called without \"new\" operator');\n return new Services();\n }\n\n this.login = function(username, password, callback) {\n console.log(\"llamandao login service\");\n var json = {'username': username,\n 'password': password}; \n requestify.post(URL+'login', json)\n .then(function(response) { \n // Get the response body (JSON parsed or jQuery object for XMLs)\n\n var data = JSON.parse(response.body);\n console.log(data);\n\n callback(null,data);\n \n });\n }; \n\n this.getUserById = function(userId, callback) {\n console.log(\"llamandao Get User By Id service del intermediario\");\n var params = {'id': userId}; \n console.log(userId);\n requestify.get(URL+'user/'+userId, params)\n .then(function(response) {\n console.log(\"esperando respuesta servidor \"); \n // Get the response body (JSON parsed or jQuery object for XMLs)\n\n var data = JSON.parse(response.body);\n\n console.log(data);\n\n callback(null,data);\n \n });\n };\n\n this.createUser = function(udata, callback) {\n console.log(\"llamandao user service del intermediario para crear USuario\");\n var json = {user: udata}; \n console.log(json);\n\n request.post(\n URL+'userGames',\n {form:{user: udata}},\n function (error, response, body) {\n if (!error && response.statusCode == 200) {\n console.log(body)\n var data = JSON.parse(body);\n callback(null,data);\n }\n });\n };\n\n this.getPartidaNueva = function(udata, callback) {\n console.log(\"llamandao get Partida del intermediario\");\n requestify.get(URL+'partidaGuessIt/'+udata.userId+'/'+udata.username)\n .then(function(response) {\n console.log(\"esperando respuesta servidor \"); \n // Get the response body (JSON parsed or jQuery object for XMLs)\n var data = JSON.parse(response.body);\n console.log(data);\n callback(null,data);\n \n });\n };\n\n this.getRanking = function(callback) {\n requestify.get(URL+'rankingGuessIt')\n .then(function(response) {\n console.log(\"esperando respuesta /ranking\"); \n // Get the response body (JSON parsed or jQuery object for XMLs)\n var data = JSON.parse(response.body);\n callback(null,data);\n });\n };\n\n this.getHistorial10 = function(udata, callback) {\n console.log(\"llamandao Get Historial service del intermediario\");\n\n requestify.get(URL+'historialGuessIt10/'+udata.userId)\n .then(function(response) {\n console.log(\"esperando respuesta servidor \"); \n // Get the response body (JSON parsed or jQuery object for XMLs)\n var data = JSON.parse(response.body);\n console.log(data);\n callback(null,data); \n });\n };\n\n this.getHistorial = function(udata, callback) {\n console.log(\"llamandao Get Historial service del intermediario\");\n\n requestify.get(URL+'historialGuessIt/'+udata.userId)\n .then(function(response) {\n console.log(\"esperando respuesta servidor \"); \n // Get the response body (JSON parsed or jQuery object for XMLs)\n var data = JSON.parse(response.body);\n console.log(data);\n callback(null,data); \n });\n };\n\n this.getPartida = function(udata, callback) {\n console.log(\"llamandao Get Historial service del intermediario\");\n\n requestify.get(URL+'partidaGuessIt/'+udata._id)\n .then(function(response) {\n console.log(\"esperando respuesta servidor \"); \n // Get the response body (JSON parsed or jQuery object for XMLs)\n var data = JSON.parse(response.body);\n console.log(data);\n callback(null,data); \n });\n };\n\n this.pronostico = function(udata, callback) {\n console.log(\"llamandao pronostico\");\n console.log(udata);\n\n request.post(\n URL+'pronosticoGuessIt',\n {form:udata},\n function (error, response, body) {\n if (!error && response.statusCode == 200) {\n console.log(body)\n var data = JSON.parse(body);\n callback(null,data);\n }\n });\n }\n }", "function CallService(ssn,fs,er, callbackF){\r\n\t\t\t\t\r\n\t\t// Set REST Service location\r\n\t\t//var webServiceURL = 'http://d-36312.dor.local:9080/MobileRefund/rest/status';\r\n\t\tvar webServiceURL = 'http://revenue3.dor.local:10073/MobileRefund/rest/status';\t\t\t\r\n\r\n\t\t// Set input parameter variables\r\n\t\tvar data = {ssn:ssn,fs:fs,er:er};\t \r\n\t\t\r\n\t\t// AJAX call\r\n\t\t$.ajax({\r\n\t url: webServiceURL, \r\n\t type: \"GET\",\r\n\t dataType: \"jsonp\", \r\n\t timeout: 5000,\r\n\t data: data, \r\n\t crossDomain: true,\t \r\n\t jsonpCallback: callbackF,\r\n\t success: OnSuccess, \r\n\t error: OnError\r\n\t });\t\t\t\r\n\t\t\r\n\t\treturn false;\r\n\t}", "function ServiceRequest(values) {\n assign(this, values);\n}", "function ServiceRequest(values) {\n assign(this, values);\n}", "call (mod, method, args) {\n if (this.connected && !!this.session) {\n if (_.isNil(args) || (_.isArrayLike(args) && args.length < 1)) {\n return this.session.service(mod).then((service) => service[method]())\n } else if (_.isArrayLike(args)) {\n return this.session.service(mod).then((service) => service[method](...args))\n } else {\n return this.session.service(mod).then((service) => service[method](args))\n }\n } else {\n console.log(`call(${mod}, ${method}, ${args}) failed because connected was ${this.connected} and session was ${!!this.session}`)\n return Promise.reject({code: 'qi-call/no-connection', message: 'Qi not loaded or not connected to pepper.'})\n }\n }", "doExecute(action, ...args) {\n if(!Reflect.has(this.service, action)){\n throw Error(`service ${this.name} hasnt action ${action}`)\n }\n return this.service[action](...args)\n }", "function apiCalls(){\n\tswitch (switcher) {\n\t\tcase \"my-tweets\":\n\t\tconsole.log(\"you are in tweets switch\");\n\t\tmy_tweets();\n\t\tbreak;\n\n\t\tcase \"spotify-this-song\":\n\t\tconsole.log(\"you're in spotify the input val is \" + userinput);\n\t\tspotify_this_song();\n\t\tbreak;\n\n\t\tcase \"movie-this\":\n\t\tconsole.log(\"you're in movie the input val is \" + userinput);\n\t\tmovie_this();\n\t\tbreak;\n\t}\n}", "function serviceManager() {\n this.serviceUrl = null;\n this.data = null;\n this.run = function (divResult, successEvent, errorEvent) {\n \n $.ajax({\n type: \"POST\",\n url: this.serviceUrl,\n data: this.data,\n contentType: \"application/json; charset=utf-8\",\n dataType: \"json\",\n success: function (msg) {\n \n if (msg != null && divResult)\n {\n \n $(\"#\" + divResult).append(msg.d);\n \n }\n \n if ($.isFunction(successEvent))\n {\n \n successEvent(msg.d);\n \n }\n \n },\n error: function (jqXHR, textStatus, errorThrown) {\n //alert('error:' + jqXHR);\n //alert('error:' + textStatus);\n //alert('error:' + errorThrown);\n if ($.isFunction(errorEvent))\n errorEvent(e);\n }\n\n });\n }\n}", "function put_name_service(username,name,service) {\n \n lookup_data.push({ username: current_user, name: name, service: service });\n \n}", "callService(endpoint, question, top) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.queryQnaService(endpoint, question, { top });\n });\n }", "request_service(name, cb) {\n const rq = {\n type: 'service',\n name: name,\n };\n\n this._req(rq, (rsp) => {\n if (rsp.status != 'ok') {\n return cb(rsp.status);\n }\n\n this.services[name] = rsp.body;\n return cb(null, rsp.body);\n });\n }", "toArguments(serviceName) {\n return [serviceName];\n }", "function getServices(){\n self.services = servicesService.getServices();\n $log.debug(self.services);\n }", "function calculate(call, callback) {\n let product = call.request;\n //A client sent a request to this service\n console.log('received product request');\n console.log(product);\n //we calculate the price and send it\n callback(null, {price: (product.unitPrice.price * product.quantity)});\n}", "getServices(ownedServices, allServices){\n let whatToOffer = [];\n //#1 - iterate categories\n allServices.forEach((category)=>{\n //#2 - create category header\n let newCategory = {\n categoryName: category.categoryName,\n location: 'in/out',//TODO\n totalPickedItems : 0,//TODO\n totalPriceItems : 0,//TODO\n subCategories : []\n }\n\n //#3 - iterate subcategories to add to category\n category.subCategories.forEach((subCategory)=>{ \n //#4 - create sub-category header\n let newSubCategory = {\n subCategoryName : subCategory.subCategoryName,\n numberOfPicked : 0,//TODO\n pricePicked : 0,//TODO\n options : []\n }\n\n //#5 - iterate services to add to subcategory\n subCategory.services.forEach((service)=>{\n //#6 - create service item to add to subcategory\n let newService = {\n optionId: service.id_service,\n optionLabel : service.name_service,\n optionPrice : parseFloat(service.price),\n optionSelected : false\n }\n\n //#7 - Add it to subcategory options list (if professional has it)\n newSubCategory.options.push(newService);\n })\n\n //#8 - Push SubCategory to Category if it has options (services)\n if(newSubCategory.options.length > 0){\n newCategory.subCategories.push(newSubCategory);\n }\n\n });\n\n //#9 - Push category to 'What to offer' if category has subcategories\n if(newCategory.subCategories.length > 0){\n whatToOffer.push(newCategory);\n }\n });\n\n //#10 - Finaly, set as 'myServices'\n this.myServices = whatToOffer;\n\n }", "function processServices(swagger, models, options) {\n var param, name, i, j;\n var services = {};\n var minParamsForContainer = options.minParamsForContainer || 2;\n var sortParams = options.sortParams || 'desc';\n for (var url in swagger.paths) {\n var path = swagger.paths[url];\n var methodParameters = path.parameters;\n for (var method in path || {}) {\n var def = path[method];\n if (!def || method == 'parameters') {\n continue;\n }\n var tags = def.tags || [];\n var tag = tagName(tags.length == 0 ? null : tags[0], options);\n var descriptor = services[tag];\n if (descriptor == null) {\n var serviceClass = toClassName(tag);\n descriptor = {\n serviceName: tag,\n serviceClass: serviceClass + 'Service',\n serviceFile: toFileName(serviceClass) + options.customFileSuffix.service,\n operationIds: new Set(),\n serviceOperations: [],\n };\n services[tag] = descriptor;\n }\n\n var id = operationId(\n def.operationId,\n method,\n url,\n descriptor.operationIds\n );\n\n var parameters = def.parameters || [];\n\n if (methodParameters) {\n parameters = parameters.concat(methodParameters);\n }\n\n var paramsClass = null;\n var paramsClassComments = null;\n if (parameters.length >= minParamsForContainer) {\n paramsClass = id.charAt(0).toUpperCase() + id.substr(1) + 'Params';\n paramsClassComments = toComments('Parameters for ' + id, 1);\n }\n\n var operationParameters = [];\n for (var p = 0; p < parameters.length; p++) {\n param = parameters[p];\n if (param.$ref) {\n param = resolveRef(swagger, param.$ref);\n }\n var paramType;\n if (param.schema) {\n paramType = propertyType(param.schema);\n } else {\n paramType = propertyType(param);\n }\n var paramTypeNoNull = removeBrackets(paramType, true);\n var paramVar = toIdentifier(param.name);\n var paramDescriptor = {\n paramName: param.name,\n paramIn: param.in,\n paramVar: paramVar,\n paramFullVar: (paramsClass == null ? '' : 'params.') + paramVar,\n paramRequired: param.required === true || param.in === 'path',\n paramIsQuery: param.in === 'query',\n paramIsPath: param.in === 'path',\n paramIsHeader: param.in === 'header',\n paramIsBody: param.in === 'body',\n paramIsFormData: param.in === 'formData',\n paramIsArray: param.type === 'array',\n paramToJson: param.in === 'formData' && !param.enum && paramTypeNoNull !== 'Blob' &&\n paramTypeNoNull !== 'string',\n paramDescription: param.description,\n paramComments: toComments(param.description, 2),\n paramType: paramType,\n paramCollectionFormat: param.collectionFormat,\n };\n operationParameters.push(paramDescriptor);\n }\n operationParameters.sort((a, b) => {\n if (a.paramRequired && !b.paramRequired) return -1;\n if (!a.paramRequired && b.paramRequired) return 1;\n switch (sortParams) {\n case 'asc':\n return a.paramName > b.paramName ? 1 :\n a.paramName < b.paramName ? -1 : 0;\n case 'desc':\n return a.paramName > b.paramName ? -1 :\n a.paramName < b.paramName ? 1 : 0;\n default:\n return 0;\n }\n });\n if (operationParameters.length > 0) {\n operationParameters[operationParameters.length - 1].paramIsLast = true;\n }\n var operationResponses = processResponses(swagger, def, path, models);\n var resultType = operationResponses.resultType;\n var isMultipart = false;\n for (i = 0; i < operationParameters.length; i++) {\n if (operationParameters[i].paramIsFormData) {\n isMultipart = true;\n break;\n }\n }\n var docString = (def.description || '').trim();\n var summary = (def.summary || path.summary || '').trim();\n if (summary !== '') {\n if (docString === '') {\n docString = summary;\n } else {\n docString = summary + '\\n\\n' + docString;\n }\n }\n if (paramsClass == null) {\n for (i = 0; i < operationParameters.length; i++) {\n param = operationParameters[i];\n docString +=\n '\\n@param ' + param.paramName + ' ' + param.paramDescription;\n }\n } else {\n docString +=\n '\\n@param params The `' +\n descriptor.serviceClass +\n '.' +\n paramsClass +\n '` containing the following parameters:\\n';\n for (i = 0; i < operationParameters.length; i++) {\n param = operationParameters[i];\n docString += '\\n- `' + param.paramName + '`: ';\n var lines = (param.paramDescription || '').trim().split('\\n');\n for (var l = 0; l < lines.length; l++) {\n var line = lines[l];\n if (line === '') {\n docString += '\\n';\n } else {\n docString += (l == 0 ? '' : ' ') + line + '\\n';\n }\n }\n }\n }\n if (operationResponses.resultDescription) {\n docString += '\\n@return ' + operationResponses.resultDescription;\n }\n function getOperationName(string) {\n if (options.camelCase) return string.charAt(0).toLowerCase() + string.slice(1);\n else return string;\n }\n var operation = {\n operationName: getOperationName(id),\n operationParamsClass: paramsClass,\n operationParamsClassComments: paramsClassComments,\n operationMethod: method.toLocaleUpperCase(),\n operationPath: url.replace(/\\'/g, '\\\\\\''),\n operationPathExpression:\n toPathExpression(operationParameters, paramsClass, url),\n operationResultType: resultType,\n operationHttpResponseType: '__StrictHttpResponse<' + resultType + '>',\n operationComments: toComments(docString, 1),\n operationParameters: operationParameters,\n operationResponses: operationResponses,\n };\n var modelResult = models[normalizeModelName(removeBrackets(resultType))];\n var actualType = resultType;\n if (modelResult && modelResult.modelIsSimple) {\n actualType = modelResult.modelSimpleType;\n }\n operation.operationIsMultipart = isMultipart;\n operation.operationIsVoid = actualType === 'void';\n operation.operationIsString = actualType === 'string';\n operation.operationIsNumber = actualType === 'number';\n operation.operationIsOther =\n !['void', 'number', 'boolean'].includes(actualType);\n operation.operationIsBoolean = actualType === 'boolean';\n operation.operationIsEnum = modelResult && modelResult.modelIsEnum;\n operation.operationIsObject = modelResult && modelResult.modelIsObject;\n operation.operationIsPrimitiveArray =\n !modelResult && (resultType.toString().includes('Array<') ||\n resultType.toString().includes('[]'));\n operation.operationIsFile = actualType === 'Blob';\n operation.operationIsByteArray = actualType === 'ArrayBuffer';\n operation.operationResponseType =\n operation.operationIsFile ? 'blob' :\n operation.operationIsByteArray ? 'arraybuffer' :\n operation.operationIsVoid ||\n operation.operationIsString ||\n operation.operationIsNumber ||\n operation.operationIsBoolean ||\n operation.operationIsEnum ?\n 'text' : 'json';\n operation.operationIsUnknown = !(\n operation.operationIsVoid ||\n operation.operationIsString ||\n operation.operationIsNumber ||\n operation.operationIsBoolean ||\n operation.operationIsEnum ||\n operation.operationIsObject ||\n operation.operationIsFile ||\n operation.operationIsPrimitiveArray\n );\n descriptor.serviceOperations.push(operation);\n }\n }\n\n // Read the comments of each tag to use for service comments\n if (swagger.tags && swagger.tags.length > 0) {\n for (i = 0; i < swagger.tags.length; i++) {\n const tag = swagger.tags[i];\n const name = tagName(tag.name);\n const service = services[name];\n if (service && tag.description) {\n service.serviceComments = toComments(tag.description);\n }\n }\n }\n\n // Resolve the models used by each service\n for (name in services) {\n var service = services[name];\n var dependencies = new DependenciesResolver(models);\n var errorDependencies = new DependenciesResolver(models);\n for (i = 0; i < service.serviceOperations.length; i++) {\n var op = service.serviceOperations[i];\n for (var code in op.operationResponses) {\n var status = Number(code);\n if (!isNaN(status)) {\n var actualDeps = (status < 200 || status >= 300)\n ? errorDependencies : dependencies;\n var response = op.operationResponses[code];\n if (response && response.type) {\n var type = response.type;\n if (type && type.allTypes) {\n // This is an inline object. Append all types\n type.allTypes.forEach(t => actualDeps.add(t));\n } else {\n actualDeps.add(type);\n }\n }\n }\n }\n for (j = 0; j < op.operationParameters.length; j++) {\n param = op.operationParameters[j];\n dependencies.add(param.paramType);\n }\n }\n service.serviceDependencies = dependencies.get();\n service.serviceErrorDependencies = errorDependencies.get();\n }\n\n return services;\n}", "function serviceCall(datesForcomputation,weatherData){\r\n\tvar url = \"\";\r\n\tvar data = {};\r\n\ttry{\r\n\t\turl = \"http://api.wunderground.com/api/c7866e4d414ea5aa/history_\"+(datesForcomputation.getFullYear()).toString()+((datesForcomputation.getMonth().toString().length<2)?\"0\"+datesForcomputation.getMonth():datesForcomputation.getMonth())+((datesForcomputation.getDate().toString().length<2)?\"0\"+datesForcomputation.getDate():datesForcomputation.getDate())+\"/q/CA/\"+weatherData.city.toString()+\".json\";\r\n\t\t$.ajax({\r\n\t\t\turl:url,\ttype: 'GET',\tasync: false,\tcache: true,\r\n\t\t\tsuccess: function(response){\r\n\t\t\t\tdata={\"temp\":response.history.dailysummary[0].meantempm,\r\n\t\t\t\t\t\t\"pressure\":response.history.dailysummary[0].meanpressurem,\r\n\t\t\t\t\t\t\"humidity\":response.history.dailysummary[0].humidity,\r\n\t\t\t\t\t\t\"wind\":response.history.dailysummary[0].meanwindspdm,\r\n\t\t\t\t\t\t\"fog\":response.history.dailysummary[0].fog,\r\n\t\t\t\t\t\t\"rain\":response.history.dailysummary[0].rain,\r\n\t\t\t\t\t\t\"snow\":response.history.dailysummary[0].snow\r\n\t\t\t\t};\r\n\t\t\t},error: function(){\r\n\t\t\t\tconsole.log(\"Errored for \"+url);\r\n\t\t\t\tconsole.log(\"Exception while fetching data for following url : \"+url);\r\n\t\t\t}\r\n\t\t});\r\n\t}catch(err){\r\n\t\tconsole.log(\"ERROR : \"+err.message);\r\n\t\tconsole.log(\"Exception while fetching data for following url : \"+url);\r\n\t}\r\n\treturn data;\r\n}", "function updateServiceIndicator(which,cons1,cons2){\n switch(scoreType){\n case \"Rally\":\n rallyService(which);\n break;\n case \"DoubleMax\":\n doubleMaxService(which,cons1);\n break;\n case \"HotPotato\":\n hotPotatoService(which,cons1,cons2);\n break;\n case \"SideOut\":\n sideOutService(which);\n break;\n default:\n doubleMaxService(which,cons1);\n }\n }", "async function remoteMathService (cb) {\n const {err: err1, num: one} = await callOneService()\n const {err: err2, num: two} = await callTwoService()\n const err = err1 || err2\n return cb(err, one + two)\n}", "function accessServices(s) {\n return f => As.access(r => f(R.map_(s, v => r[v.key])));\n}", "static async getVariables(){\n\n //Get instance of VariablesOperations Class\n let variablesOperations = new VariablesOperations();\n\n //Get instance of ParameterMap Class\n let paramInstance = new ParameterMap();\n\n /* Possible parameters of Get Variables operation */\n await paramInstance.add(GetVariablesParam.GROUP, \"General\");\n\n //Call getVariables method that takes ParameterMap instance as parameter\n let response = await variablesOperations.getVariables(paramInstance);\n\n if(response != null){\n\n //Get the status code from response\n console.log(\"Status Code: \" + response.statusCode);\n\n if([204, 304].includes(response.statusCode)){\n console.log(response.statusCode == 204? \"No Content\" : \"Not Modified\");\n\n return;\n }\n\n //Get object from response\n let responseObject = response.object;\n\n if(responseObject != null){\n\n //Check if expected ResponseWrapper instance is received \n if(responseObject instanceof ResponseWrapper){\n\n //Get the array of obtained Variable instances\n let variables = responseObject.getVariables();\n\n variables.forEach(variable => {\n\n //Get the ID of each Variable\n console.log(\"Variable ID: \" + variable.getId());\n\n //Get the APIName of each Variable\n console.log(\"Variable APIName: \" + variable.getAPIName());\n\n //Get the Name of each Variable\n console.log(\"Variable Name: \" + variable.getName());\n\n //Get the Description of each Variable\n console.log(\"Variable Description: \" + variable.getDescription());\n\n //Get the Type of each Variable\n console.log(\"Variable Type: \" + variable.getType());\n\n //Get the VariableGroup instance of each Variable\n let variableGroup = variable.getVariableGroup();\n\n //Check if variableGroup is not null\n if(variableGroup != null){\n //Get the APIName of the VariableGroup\n console.log(\"Variable VariableGroup APIName: \" + variableGroup.getAPIName());\n\n //Get the ID of the VariableGroup\n console.log(\"Variable VariableGroup ID: \" + variableGroup.getId());\n }\n\n //Get the Value of each Variable\n console.log(\"Variable Value: \" + variable.getValue());\n });\n }\n //Check if the request returned an exception\n\t\t\t\telse if(responseObject instanceof APIException){\n\t\t\t\t\t//Get the Status\n\t\t\t\t\tconsole.log(\"Status: \" + responseObject.getStatus().getValue());\n\n\t\t\t\t\t//Get the Code\n\t\t\t\t\tconsole.log(\"Code: \" + responseObject.getCode().getValue());\n\n\t\t\t\t\tconsole.log(\"Details\");\n\n\t\t\t\t\t//Get the details map\n\t\t\t\t\tlet details = responseObject.getDetails();\n\n\t\t\t\t\tif(details != null){\n\t\t\t\t\t\tArray.from(details.keys()).forEach(key => {\n\t\t\t\t\t\t\tconsole.log(key + \": \" + details.get(key)); \n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t//Get the Message\n\t\t\t\t\tconsole.log(\"Message: \" + responseObject.getMessage().getValue());\n\t\t\t\t}\n }\n }\n }", "function fetchServices() {\n var namespace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';\n return services_k8s.getServices(namespace).done(function (serviceDataArray) {\n src_reactor[\"a\" /* default */].dispatch(SITE_RECEIVE_SERVICES, serviceDataArray);\n });\n}", "function initialServiceLoad(isNewInstall) {\n\n lastUpdateTimePrefix = SUConsts[getServicesKey()].prefixKey;\n lastUpdateDataPrefix = SUConsts[getServicesKey()].prefixDataKey;\n updateServiceMap();\n\n serviceRequest(SUConsts[getServicesKey()].serviceMap).then(function(response) {\n SULogger.logDebug(\"Success getting ServiceMap! \" + response);\n // Alive Usage\n SUUsages.init();\n //Get IP2Location service\n return serviceRequest(SUConsts[getServicesKey()].IP2location);\n }, function(error) {\n SULogger.logError(\"Failed!\", error);\n // Alive Usage\n SUUsages.init();\n //Get IP2Location service\n return serviceRequest(SUConsts[getServicesKey()].IP2location);\n\n }).then(function(response) {\n SULogger.logDebug(\"Success getting IP2Location \" + response);\n\n if (isNewInstall) {\n\n // Set smaller timeout to get install date\n SUConsts[getServicesKey()].SearchAPIwithCCForNewInstall.reload_interval_sec = SUConsts.SearchAPIForNewInstallIntervalInSec;\n\n //Get SearchAPIwithCCForNewInstall service\n return serviceRequest(SUConsts[getServicesKey()].SearchAPIwithCCForNewInstall);\n } else {\n\n //Get SearchAPIwithCC service\n var currInstallDate = localStorage.getItem(SUConsts.installDateKey);\n return serviceRequest(SUConsts[getServicesKey()].SearchAPIwithCC, currInstallDate);\n }\n }, function(error) {\n SULogger.logError(\"Failed getting IP2Location \", error);\n\n if (isNewInstall) {\n\n SUConsts[getServicesKey()].SearchAPIwithCCForNewInstall.reload_interval_sec = SUConsts.SearchAPIForNewInstallIntervalInSec;\n\n return serviceRequest(SUConsts[getServicesKey()].SearchAPIwithoutCCForNewInstall);\n } else {\n var currInstallDate = localStorage.getItem(SUConsts.installDateKey);\n\n return serviceRequest(SUConsts[getServicesKey()].SearchAPIwithoutCC, currInstallDate);\n }\n\n }).then(function(response) {\n SULogger.logDebug(\"Success getting SearchAPI \" + response);\n }, function(error) {\n SULogger.logError(\"Failed!\", error);\n });\n }", "setService(settings) {\n //settings.onResponse = this.handleResponse;\n settings.successTest = this.successTest;\n settings.onFailure = this.onFailure;\n settings.onSuccess = this.onSuccess;\n settings.onAbort = this.onAbort;\n }", "function accessServices(s) {\n return f => access(r => f(R.map_(s, v => r[v.key])));\n}", "getServices() {\n // This accessory only provides one service - a switch\n return [this.service];\n }", "handleServiceLinking(url) {\n if (url.indexOf('services') > -1 || url.split('/')[1] == 'services') {\n let urlParams = getAllUrlParams(url);\n this.setState({navigating: true});\n return Actions.service({\n list: true,\n searchCriteria: urlParams.query,\n serviceTypeIds: urlParams.type && urlParams.type.constructor === Array\n ? urlParams.type.map((el) => parseInt(el))\n : [parseInt(urlParams.type)]\n });\n }\n }", "addServices(services) {\n for (let s of services) {\n this.addService(s);\n }\n }", "function getServices(parentEl) {\n // API Fetch\n fetch(\n \"https://cdn.contentful.com/spaces/9635uuvwn9dq/environments/master/entries?access_token=cgtQv23ag7qZw92QlPnJwslq6vWfK8sDwB8fNk62QTI&content_type=service\"\n )\n .then((resp) => resp.json())\n .then((data) => processServices(data, parentEl));\n}", "constructor(commonService, homeService, titleService) {\n this.commonService = commonService;\n this.homeService = homeService;\n this.titleService = titleService;\n }", "_handle_call(md) {\n let rsp = {\n type: 'response',\n status: 'ok',\n uid: md.uid,\n };\n\n this.local._call_local_service(md.name, md.fun, md.args, (err, ret) => {\n if (err) {\n rsp.status = err;\n } else {\n rsp.ret = ret;\n }\n\n return this._write(rsp);\n });\n }", "displaySIAgents() {\n // call to api\n try {\n var that = this;\n request.get({url: global.rest_api_lm + 'service-instances/' + that.state.sel_service_instance_id_1}, function(err, resp, body) {\n if (err) {\n console.error(err);\n that.setState({ show_alert: true, msg: \"GET /api/v2/lm/service-instances/\" + that.state.sel_service_instance_id_1, msg_content: err.toString() });\n }\n else {\n if (resp.statusCode == 200) {\n console.log('Getting data service instances ... ok');\n if (global.debug) {\n //that.setState({ show_info: true, msg: \"GET /api/v2/lm/service-instances/\" + that.state.sel_service_instance_id_1 + \" => \" + resp.statusCode, msg_content: \"Service instances retrieved: response: \" + body });\n }\n\n body = JSON.parse(body);\n console.log(body);\n\n ////////////////////////////////////////////////////////////////////////////\n // FORM\n if (body['service_instance'] != null) {\n // service instance\n that.setState({si_id: body['service_instance']['id'],\n si_status: body['service_instance']['status'],\n si_created: body['service_instance']['created'],\n si_service: body['service_instance']['service'],\n si_agreement: body['service_instance']['agreement'],\n si_type: body['service_instance']['service_type']});\n\n if (body['service_instance']['agents'] != null) {\n that.setState({si_agents: body['service_instance']['agents'].length});\n }\n\n if (body['service_instance']['service_type'] != null) {\n if (body['service_instance']['service_type'] == \"docker\") {\n that.setState({img_icon_service_type: \"img/docker-logo.png\"});\n } else if (body['service_instance']['service_type'] == \"docker-swarm\") {\n that.setState({img_icon_service_type: \"img/docker-swarm-logo.png\"});\n } else if (body['service_instance']['service_type'] == \"compss\") {\n that.setState({img_icon_service_type: \"img/compss-logo.png\"});\n } else if (body['service_instance']['service_type'] == \"docker-compose\") {\n that.setState({img_icon_service_type: \"img/docker-compose-logo.png\"});\n } else {\n that.setState({img_icon_service_type: \"img/apps_mini.png\"});\n }\n }\n }\n\n ////////////////////////////////////////////////////////////////////////////\n if (body['service_instance'] != null && body['service_instance']['agents'] != null && body['service_instance']['agents'].length > 0) {\n // create an array with nodes\n var app_icon = \"img/apps_mini.png\";\n if (body['service_instance']['status'] == \"started\") {\n app_icon = \"img/apps_started_mini.png\";\n }\n\n var nodes2 = new vis.DataSet([\n {id: body['service_instance']['id'], label: body['service_instance']['id'].substring(17), image: app_icon, shape: 'image'}\n ]);\n\n var edges2 = new vis.DataSet([]);\n\n body['service_instance']['agents'].forEach(function(element) {\n nodes2.add({id: element['url'], label: element['url'], image: './img/node_mini.png', shape: 'circularImage'});\n\n edges2.add({from: body['service_instance']['id'], to: element['url'], color:{color:'white'}, dashes: true});\n });\n\n // create a network2\n var container2 = document.getElementById('mynetwork');\n var data2 = {\n nodes: nodes2,\n edges: edges2\n };\n var options2 = {\n nodes: {\n size:15,\n font:{color:'#ffffff', size:10}\n },\n edges: {\n color: 'lightgray'\n }\n };\n var network2 = new vis.Network(container2, data2, options2);\n\n that.setState({ service_instance_json: JSON.stringify(body, null, \"\\t\") });\n }\n ////////////////////////////////////////////////////////////////////////////\n }\n else {\n that.setState({ show_alert: true, msg: \"GET /api/v2/lm/service-instances/all\",\n msg_content: JSON.stringify(body) + \" => \" + resp.statusCode, service_instance_json: \"{}\" });\n }\n }\n });\n }\n catch(err) {\n console.error(err);\n this.setState({ show_alert: true, msg: \"GET /api/v2/lm/service-instances/all\", msg_content: err.toString() });\n }\n }", "function services(...s) {\n return access(r => s.map(tag => tag.read(r)));\n}", "function myService1() {}", "getServiceData(tenant, servicename, callback)\n\t{\n\t\tif(!r3IsSafeTypedEntity(callback, 'function')){\n\t\t\tconsole.error('callback parameter is wrong.');\n\t\t\treturn;\n\t\t}\n\t\tlet\t_callback\t= callback;\n\t\tlet\t_error;\n\t\tif(r3IsEmptyStringObject(tenant, 'name') || r3IsEmptyString(servicename, true)){\n\t\t\t_error = new Error('tenant(' + JSON.stringify(tenant) + ') or service(' + JSON.stringify(servicename) + ') parameters are wrong.');\n\t\t\tconsole.error(_error.message);\n\t\t\t_callback(_error);\n\t\t\treturn;\n\t\t}\n\t\tlet\t_tenant\t\t= tenant.name;\n\t\tlet\t_service\t= servicename.trim();\n\t\tlet\t_url\t\t= '/v1/service/' + _service;\n\n\t\tthis.startProgress();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// start progressing\n\n\t\tthis._get(_url, null, null, _tenant, (error, resobj) =>\n\t\t{\n\t\t\tthis.stopProgress();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// stop progressing\n\n\t\t\tif(null !== error){\n\t\t\t\tconsole.error(error.message);\n\t\t\t\t_callback(error, null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(true !== resobj.result){\n\t\t\t\terror = new Error(resobj.message);\n\t\t\t\tconsole.error(error.message);\n\t\t\t\t_callback(error, null);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(r3IsEmptyEntity(resobj.service)){\n\t\t\t\t_callback(null, null);\n\t\t\t}else{\n\t\t\t\t_callback(null, resobj.service);\n\t\t\t}\n\t\t});\n\t}", "function processDynamic(response){\r\n processStartedServices(response);\r\n processNetOperations(response);\r\n processFileOperations(response);\r\n processEncryptions(response);\r\n processDataleaks(response);\r\n processCalls(response);\r\n processTextMsgs(response);\r\n \r\n}", "function volunteerPhoneNumberForCall(){\nkony.application.showLoadingScreen(null, \"Loading..\", \nconstants.LOADING_SCREEN_POSITION_ONLY_CENTER, true, true, { \nshouldShowLabelInBottom: \"false\", separatorHeight: 20} );\n// alert(\"enetred volunterr..yeyyyy\");////actualy we have to cal service\n// getVolPhoneNoForCallSuccessCallback(gblVolunteersPhoneNumberCall);\n \n // Let's get the news type the user selected\n //var selectedKey = frmFoxNews.lstNewsType.selectedKey;\n //alert (\"########## Selected Key:\" + selectedKey);\n // Let's first check that the user picked a valid value\n //if (!kony.string.equalsIgnoreCase(selectedKey, \"none\")){\n // Populating the input params for the service call and invoking the service\n // We're passing in the selected key for the user's selection in the combobox\n // var inputParams = {serviceID:\"getFoxNews\",newsType:selectedKey};\n // Now we make the call to the service using our input parameters and specifying\n // the function processServiceResults as our callback when the service returns results\n // appmiddlewareinvokerasync(inputParams, processServiceResults);\n if (!mobileFabricConfigurationForVolunteerNumberCall.isKonySDKObjectInitialized)\n {\n initializeMobileFabricForVolunteerPhoneNumberCall();\n \n }\n else if (mobileFabricConfigurationForVolunteerNumberCall.isKonySDKObjectInitialized)\n {\n getVolunteerPhoneNumberCall();\n }\n \n\n\n }", "doGeocode(value) {\n console.log('doGeocode');\n search(\n this.props.endpoint,\n this.props.source,\n this.props.accessToken,\n this.props.proximity,\n value,\n this.onResult.bind(this));\n }", "function main() {\n\n\t\t//Check the Method\n\t\tif ($.request.method === $.net.http.POST) {\n\t\t\t$.response.status = 200;\n\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\tmessage: \"API Called\",\n\t\t\t\tresult: \"POST is not supported, perform a GET to read the Account Type Amounts by Company Code\"\n\t\t\t}));\n\t\t} else {\n\t\t\ttry {\n\t\t\t\t//Calculate Values\n\t\t\t\tvar records = getEntries();\n\n\t\t\t\t$.response.status = 200;\n\t\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\t\tmessage: \"API Called\",\n\t\t\t\t\tdata: records\n\t\t\t\t}));\n\n\t\t\t} catch (err) {\n\t\t\t\t$.trace.error(JSON.stringify({\n\t\t\t\t\tmessage: err.message\n\t\t\t\t}));\n\t\t\t\t$.response.status = 200;\n\t\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\t\tmessage: \"API Called\",\n\t\t\t\t\terror: err.message\n\t\t\t\t}));\n\t\t\t}\n\t\t}\n\t}", "function services(srv, callback) {\n\t// fallback - if only callback is given\n\tif (isFunction(srv) && !callback) {\n\t\tcallback = srv;\n\t\tsrv = '';\n\t}\n\n\tif (_windows) {\n\t\tcallback(NOT_SUPPORTED);\n\t}\n\n\tsrv = srv.trim().replace(/,+/g, \" \").replace(/ +/g, \" \").replace(/ +/g, \"|\");\n\tvar srvs = srv.split('|');\n var comm = (_darwin) ? \"ps -caxm -o pcpu,pmem,comm\" : \"ps axo pcpu,pmem,comm\";\n\tvar data = [];\n\tif (srv != '' && srvs.length > 0) {\n\t\texec(comm + \" | grep -v grep | egrep '\" + srv + \"'\", function (error, stdout) {\n\t\t\tif (!error) {\n\t\t\t\tvar lines = stdout.toString().replace(/ +/g, \" \").replace(/,+/g, \".\").split('\\n');\n\t\t\t\tsrvs.forEach(function (srv) {\n\t\t\t\t\tvar ps = lines.filter(function (e) {\n\t\t\t\t\t\treturn e.indexOf(srv) != -1\n\t\t\t\t\t});\n\t\t\t\t\tdata.push({\n\t\t\t\t\t\t'name': srv,\n\t\t\t\t\t\t'running': ps.length > 0,\n\t\t\t\t\t\t'pcpu': parseFloat((ps.reduce(function (pv, cv) {\n\t\t\t\t\t\t\treturn pv + parseFloat(cv.trim().split(' ')[0]);\n\t\t\t\t\t\t}, 0)).toFixed(2)),\n\t\t\t\t\t\t'pmem': parseFloat((ps.reduce(function (pv, cv) {\n\t\t\t\t\t\t\treturn pv + parseFloat(cv.trim().split(' ')[1]);\n\t\t\t\t\t\t}, 0)).toFixed(2))\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t\tcallback(data)\n\t\t\t} else {\n\t\t\t\tsrvs.forEach(function (srv) {\n\t\t\t\t\tdata.push({\n\t\t\t\t\t\t'name': srv,\n\t\t\t\t\t\t'running': false,\n\t\t\t\t\t\t'pcpu': 0,\n\t\t\t\t\t\t'pmem': 0\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t\tcallback(data)\n\t\t\t}\n\t\t});\n\t} else callback(data)\n}", "function findService(def){\n let keys = Object.keys(def);\n for(let i=0; i < keys.length; i++){\n let propName = keys[i]\n let propValue = def[propName];\n\n if(typeof propValue === 'object'){\n let res = findService(propValue);\n if(res){\n return res;\n }\n }else if(propValue.service){\n return {name: propName, ctr: propValue};\n }\n }\n}", "_call_remote_service(remote, name, fun, args, cb) {\n this._find_remote(remote, (err, rn) => {\n if (err) return cb(err);\n rn.call(name, fun, args, (err, ret) => {\n if (err) return cb(err);\n return cb(null, ret);\n });\n });\n }", "function flickr_api_call( method, args, ok_cb, cb_args ) {\n \n var url = '/services/rest/?api_key=' + API_KEY;\n url += '&method=' + encodeURIComponent(method);\n \n for (var key in args) {\n url += '&' + encodeURIComponent(key) + '=' + encodeURIComponent(args[key])\n }\n \n var proc = make_flickr_api_proc( method, ok_cb, cb_args )\n \n do_req('GET', proc, url, null, null)\n }", "function WebServices()\r\n{\r\n\tthis.services=new Array();\r\n\tthis.services[0]=new WebService(\"collections\",\"collections_xsl\",handleResults,\"collections.html\");\r\n\tthis.services[1]=new WebService(\"collection\",\"collection_xsl\",handleResults,\"collection.html\");\r\n\tthis.services[2]=new WebService(\"hybrids\",\"hybrids_xsl\",handleResults,\"hybrids.html\");\r\n\tthis.services[3]=new WebService(\"hybrid\",\"hybrid_xsl\",handleResults,\"hybrid.html\");\r\n\tthis.services[4]=new WebService(\"broods\",\"broods_xsl\",handleResults,\"broods.html\");\r\n\tthis.services[5]=new WebService(\"brood\",\"brood_xsl\",handleResults,\"brood.html\");\r\n\t\r\n\tthis.contains=contains;\r\n\tthis.getServiceByName=getServiceByName;\r\n\tthis.getServiceByIndex=getServiceByIndex;\r\n\tthis.setServiceByName=setServiceByName;\r\n\tthis.setServiceByIndex=setServiceByIndex;\r\n\tthis.addService=addService;\r\n\t\r\n\tfunction contains(name)\r\n\t{\r\n\t\tfor(var i=0;i<this.services.length;i++)\r\n\t\t{\r\n\t\t\tif(this.services[i].getWebServiceName()==name)\r\n\t\t\t\treturn true;\r\n\t\t}\r\n\t\t\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\tfunction getServiceByName(name)\r\n\t{\r\n\t\tfor(var i=0;i<this.services.length;i++)\r\n\t\t{\r\n\t\t\tif(this.services[i].getWebServiceName()==name)\r\n\t\t\t\treturn this.services[i];\r\n\t\t}\r\n\t\t\r\n\t\treturn null;\t\r\n\t}\r\n\t\r\n\tfunction getServiceByIndex(index)\r\n\t{\r\n\t\tif(index>-1 && index<this.services.length)\r\n\t\t\treturn this.services[index];\r\n\t\t\r\n\t\treturn null;\t\r\n\t}\r\n\t\r\n\tfunction setServiceByName(name, service)\r\n\t{\r\n\t\tfor(var i=0;i<this.services.length;i++)\r\n\t\t{\r\n\t\t\tif(this.services[i].getWebServiceName()==name)\r\n\t\t\t\tthis.services[i]=service;\r\n\t\t}\r\n\t}\r\n\t\r\n\tfunction setServiceByIndex(index,service)\r\n\t{\r\n\t\tif(index>-1 && index<this.services.length)\r\n\t\t\tthis.services[index]=service;\r\n\t}\r\n\t\r\n\tfunction addService(service)\r\n\t{\r\n\t\tthis.services[this.services.length]=service;\r\n\t}\r\n} //end of WebServices class", "function goService(urlService, idService){\r\n\tmainTab_GoTab('AllServices'); \r\n\tsrvConfigToggle('id_'+idService+'_2', urlService);\r\n}", "function callGetServiceINTERNAL (state, URLPath, callback, authkey) {\n var config = {\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': authkey\n }\n }\n // console.log('Making call the config is:')\n // console.log(config)\n axios.get(\n state.corsproxyprefix + state.host + URLPath,\n config\n ).then(function (response) {\n // console.log('callGetServiceINTERNAL response')\n // console.log(response)\n if (response.status < 200) {\n callback.FAILcallback.method({msg: 'Bad status', response: response}, callback.FAILcallback.params)\n }\n else {\n if (response.status > 299) {\n callback.FAILcallback.method({msg: 'Bad status', response: response}, callback.FAILcallback.params)\n }\n else {\n callback.OKcallback.method(response, callback.OKcallback.params)\n }\n }\n })\n .catch(function (response) {\n if (typeof (response.response) === 'undefined') {\n if (typeof (response.message) === 'undefined') {\n callback.FAILcallback.method({msg: 'Bad Response UNKNOWN', response: response}, callback.FAILcallback.params)\n }\n else {\n console.log(response)\n callback.FAILcallback.method({msg: 'Bad Response ' + response.message, response: response}, callback.FAILcallback.params)\n }\n }\n else if (typeof (response.response.data) !== 'undefined') {\n if (typeof (response.response.data.errorMessages) !== 'undefined') {\n callback.FAILcallback.method({msg: 'Bad Response(' + response.response.data.errorMessages.length + ') ' + response.response.data.errorMessages, response: response.response}, callback.FAILcallback.params)\n }\n else {\n callback.FAILcallback.method({msg: 'Data Bad Response ' + response.response.status, response: response.response}, callback.FAILcallback.params)\n }\n }\n else {\n callback.FAILcallback.method({msg: 'Nested Bad Response ' + response.response.status, response: response.response}, callback.FAILcallback.params)\n }\n })\n}", "printServicesInfo() {\n let endPoints = listEndpoints(this.app);\n logger.debug(\"Endpoints are : \", endPoints);\n }", "function accessService(s) {\n return f => accessServiceM(s)(a => (0, _succeed.succeed)(f(a)));\n}", "getVehicles(params) {\n \tvar deferred = $q.defer(), \n url = baseUrl+params.makes+'?state='+params.state+'&year='+params.year+'&view=basic&fmt=json&api_key='+apiKey;\n console.log(\"in the Services\\n \" + url);\n $http({\n method: 'GET',\n url: url \n })\n .then(function successHandler(response) {\n deferred.resolve(response.data);\n\n }, function errorHandler() {\n deferred.reject();\n });\n return deferred.promise;\n }", "function servicosPrestados(pet, servico) {\n servico(pet)\n}", "function setServiceData(name, responseText) {\n try{\n //Writing the service responce to local storage \"as is\"\n //Update Consts according to service responce\n\n var responseJson = JSON.parse(responseText);\n if (name.toLowerCase() == SUConsts[getServicesKey()].serviceMap.name.toLowerCase()) {\n //Write Service Map response to local storage\n //localStorage.setItem(SUConsts.serviceMapKey, responseText);\n //Parse Service Map responce\n parseServiceMap(responseJson);\n }\n\n if (name.toLowerCase() == SUConsts[getServicesKey()].IP2location.name.toLowerCase()) {\n if (responseJson && responseJson.location && responseJson.location.countryCode) {\n //Write IP2Location response to local storage\n //localStorage.setItem(SUConsts.IP2locationKey, responseText);\n //Parse IP2Location response\n SUConsts[getServicesKey()].countryCode = responseJson.location.countryCode;\n }\n else {\n return false;\n }\n }\n\n if (name.toLowerCase() == SUConsts[getServicesKey()].SearchAPIwithCC.name.toLowerCase() || name.toLowerCase() == SUConsts[getServicesKey()].SearchAPIwithoutCC.name.toLowerCase()) {\n\n //Write SearchAPI response to local storage\n //localStorage.setItem(SUConsts[searchAPIKey], responseText);\n parseSearchAPI(responseJson);\n }\n\n return true;\n }\n catch (e) {\n SULogger.logError(\"Failed to set service data\", e);\n return false;\n }\n }", "function whhFindServices(serviceType, callbacks, timeout, filter) {\n var timedOut = false;\n var zone = -1;\n var filterName = null;\n if(filter) {\n if(filter.zone) {\n zone = filter.zone;\n }\n if(filter.name) {\n filterName = filter.name;\n }\n }\n //alert('whhFindServices - zone is '+zone+', name is '+filterName);\n\n function findTimedOut() {\n timedOut = true;\n callbacks.onFinish();\n }\n\n var timeoutHandle = setTimeout(findTimedOut, timeout);\n\n webinos.discovery.findServices(serviceType, {\n onFound: function(service) {\n //alert('whhFindServices - found - 01');\n if(zone == 0 && service.serviceAddress.indexOf(webinos.session.getPZPId()) == -1) {\n //alert('whhFindServices - found - 02');\n return;\n }\n if(zone == 1 && service.serviceAddress.indexOf(webinos.session.getPZHId()) == -1) {\n //alert('whhFindServices - found - 03');\n return;\n }\n if(zone == 2 && service.serviceAddress.indexOf(webinos.session.getPZHId()) != -1) {\n //alert('whhFindServices - found - 04');\n return;\n }\n if(filterName) {\n if(service.displayName.indexOf(filterName) == -1) {\n //alert('whhFindServices - found - 05');\n return;\n }\n }\n if(!timedOut) {\n //alert('whhFindServices - found - 06');\n service.bindService({\n onBind: function() {\n //alert('whhFindServices - found - 08');\n callbacks.onFound(service);\n }\n });\n }\n else {\n //alert('service found after timeout');\n console.log('whhFindServices: service found after timeout');\n }\n }\n });\n \n}", "function call(parameters) {\n return new Promise(async (resolve, reject) => {\n czr.request.call({\n \"from\": parameters.from ? parameters.from : account,\n \"to\": parameters.to,\n \"data\": parameters.data\n })\n .then(ret => {\n if (ret.code === 0) {\n //console.log('request success =>', ret)\n let response = \"0x\" + ret.output;\n let fnabi = parameters.funABI\n let decres = decode.decodeResponse(response, fnabi);\n let res = []\n for (var key in decres) {\n res.push(decres[key])\n }\n //console.log(res)\n resolve(res)\n } else {\n console.log('request failed =>', ret);\n reject(ret)\n }\n })\n })\n}", "function accessService(s) {\n return f => accessServiceM(s)(a => As.succeed(f(a)));\n}", "function IntegrationService(konyRef, serviceName) {\r\n\tvar logger = new konyLogger();\r\n\tvar dataStore = new konyDataStore();\r\n\tvar homeUrl = konyRef.integsvc[serviceName];\r\n\tvar networkProvider = new konyNetworkProvider();\r\n\tif (homeUrl == undefined || serviceName == undefined) {\r\n\t\tthrow new Exception(Errors.INIT_FAILURE, \"Invalid homeUrl and serviceName\");\r\n\t}\r\n\thomeUrl = stripTrailingCharacter(homeUrl, \"/\");\r\n\r\n\r\n\r\n\tthis.getUrl = function() {\r\n\t\treturn homeUrl;\r\n\t};\r\n\t/**\r\n\t * Integration service success callback method.\r\n\t * @callback integrationSuccessCallback\r\n\t * @param {json} response - Integration service response\r\n\t */\r\n\r\n\t/**\r\n\t * Integration service failure callback method.\r\n\t * @callback integrationFailureCallback\r\n\t * @param {json} error - Error information\r\n\t */\r\n\t/**\r\n\t * invoke the specified operation\r\n\t * @param {string} operationName - Name of the operation\r\n\t * @param {object} headers - Input headers for the operation\r\n\t * @param {object} data - Input data for the operation\r\n\t * @param {integrationSuccessCallback} successCallback - Callback method on success\r\n\t * @param {integrationFailureCallback} failureCallback - Callback method on failure\r\n\t */\r\n\tthis.invokeOperation = function(operationName, headers, data, successCallback, failureCallback) {\r\n\t\tfunction invokeOperationHandler() {\r\n\t\t\t_invokeOperation(operationName, headers, data, successCallback, failureCallback);\r\n\t\t}\r\n\t\tkony.sdk.claimsRefresh(invokeOperationHandler, failureCallback);\r\n\t};\r\n\r\n\tfunction _invokeOperation(operationName, headers, data, successCallback, failureCallback) {\r\n\t\tvar metricsData = kony.sdk.getPayload(konyRef);\r\n\t\tmetricsData.svcid = operationName;\r\n\t\tvar dataToSend = {};\r\n\t\tdataToSend.konyreportingparams = JSON.stringify(metricsData);\r\n\r\n\t\tfor (var key in data) {\r\n\t\t\tdataToSend[key] = data[key];\r\n\t\t}\r\n\r\n\t\tvar token;\r\n\t\tfor (var i in konyRef.tokens) {\r\n\t\t\tif (konyRef.tokens.hasOwnProperty(i) && typeof(i) !== 'function') {\r\n\t\t\t\ttoken = konyRef.tokens[i];\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar defaultHeaders = {\r\n\t\t\t\"Content-Type\": \"application/x-www-form-urlencoded\",\r\n\t\t\t\"X-Kony-Authorization\": konyRef.currentClaimToken\r\n\t\t}\r\n\r\n\t\t// if the user has defined his own headers, use them\r\n\t\tif (headers) {\r\n\t\t\tfor (var header in headers) {\r\n\t\t\t\tdefaultHeaders[header] = headers[header];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tlogger.log(\"request data is \" + JSON.stringify(dataToSend));\r\n\r\n\t\tnetworkProvider.post(homeUrl + \"/\" + operationName,\r\n\t\t\tdataToSend, defaultHeaders,\r\n\t\t\tfunction(res) {\r\n\t\t\t\tkony.sdk.verifyAndCallClosure(successCallback, res);\r\n\t\t\t},\r\n\t\t\tfunction(xhr, status, err) {\r\n\t\t\t\tif (xhr && !(status && err)) {\r\n\t\t\t\t\terr = xhr;\r\n\t\t\t\t}\r\n\t\t\t\tif(err[\"mfcode\"]){\r\n\t\t\t\t\tvar konyRef = kony.sdk.getCurrentInstance();\r\n\t\t\t\t\t//clear the cache if the error code related to session/token expiry\r\n\t\t\t\t\tif (kony.sdk.isSessionOrTokenExpired(err[\"mfcode\"])) {\r\n\t\t\t\t\t\tkony.sdk.resetCacheKeys(konyRef);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\t\t\t\t\r\n\t\t\t\tkony.sdk.verifyAndCallClosure(failureCallback, kony.sdk.error.getIntegrationErrObj(err));\r\n\t\t\t});\r\n\t};\r\n\r\n}", "start(key) {\n var service = _services[key];\n console.warn('Starting service', key, service);\n return service.start();\n }", "function getExistingServiceDeskResultInfo() {\r\n\t \tif($scope.existingServiceDeskInfo.serviceDeskYearlyDataInfoDtoList != null){\r\n\t \t\tfor (var y = 0; y < $scope.existingServiceDeskInfo.serviceDeskYearlyDataInfoDtoList.length; y++){\r\n\t \t\tvar yearlyDto = $scope.existingServiceDeskInfo.serviceDeskYearlyDataInfoDtoList[y];\r\n\t \t\tgetExistingServerPricingLevelWiseInfo($scope.serviceDeskInfo.contact.children[0],yearlyDto,y);\r\n\r\n\t \t}\r\n\t \t}\r\n\t }", "proxyUpcomingExecute(serviceName, action, ...args) {\n let grantedItem\n\n if(!this.requireDict[serviceName]){\n throw Error(`Unknown service ${serviceName} called`)\n }\n if(!this.requireDict[serviceName][action]){\n throw Error(`Unknown action ${action} at service ${serviceName} called`)\n }\n grantedItem = this.requireDict[serviceName][action]\n return grantedItem.layer.executeAction(grantedItem.ticket, serviceName, action, ...args)\n }", "function getData() {\n StatusService.startWaiting();\n $q.all([ScenarioModelService.load(),\n ProcessService.load(),\n LciaMethodService.load(),\n FragmentFlowService.load({scenarioID: scenarioID, fragmentID: fragmentID}),\n ParamModelService.load(scenarioID)])\n .then(handleSuccess,\n StatusService.handleFailure);\n }", "enterCallValues(ctx) {\n\t}", "async execute(){\n\t\tawait this.processRequest();\n\t\tawait this.formatRequest();\n\t\tawait this.processData();\n\t\tawait this.formatResponse();\n\t\tawait this.processResponse();\n\t}", "function findServicedAll() {\n findServiced(spec1);\n findServiced(spec2);\n findServiced(spec3);\n\n localStorage.setItem('list', JSON.stringify(list));\n getList();\n}", "function findServicedAll() {\n findServiced(spec1);\n findServiced(spec2);\n findServiced(spec3);\n\n localStorage.setItem('list', JSON.stringify(list));\n getList();\n}", "function getServiceByAlias(request, response, action) {\n var parameters, ref;\n parameters = getDialogflowParameters(request, action); // Obtenemos los parametros de Dialogflow\n ref = admin.database().ref(\"servicio\"); // Creamos una variable que contiene el nodo \"servicio\".\n // Buscamos todos los datos que sean igual al alias definido en la base de datos con el parametro obtenido de Dialogflow.\n return ref\n .orderByChild(\"alias\")\n .equalTo(parameters[0])\n .once(\"value\")\n .then(snapshot => {\n var jsonResult = {}; // Para almacenar todos los datos encontrados con el parametro y almacenarlo con su key respectivo.\n var resultToSendDialogflow = \"\"; // Variable para enviar el resultado a Dialogflow.\n snapshot.forEach(childSnapshot => {\n // Recorremos el resultado de la busqueda.\n var values = childSnapshot.val(); // Obtenemos un JSON con todos los valores consultados.\n values.key = childSnapshot.key; // Almacenamos la clave del servicio en una variable.\n // Se guardan los valores obtenidos en un arreglo.\n jsonResult[values.key] = childSnapshot.val();\n });\n if (Object.keys(jsonResult).length === 0) {\n // Enviamos un mensaje de que no se encontro ningun valor con el parametro dado por el usuario.\n resultToSendDialogflow =\n \"Lo siento, no pude encontrar la información necesaria para responder tu duda.\" +\n \" Por favor, asegúrese que el nombre del servicio este bien ingresado, o talvez esté \" +\n \"no pertenezca al centro historico de la ciudad de Latacunga.\";\n } else {\n // Enviamos los valores da la consulta a Dialogflow.\n if (action === \"serviceInformationAction\") {\n resultToSendDialogflow =\n \"Esta es la información que pude encontrar sobre el servicio \" +\n parameters[0] +\n \". ¿Te gustaría saber cómo llegar?\";\n } else if (\n action === \"service_information_intent.service_information_intent-yes\"\n ) {\n resultToSendDialogflow =\n \"Este es el camino que deberías tomar para llegar al servicio \" +\n parameters[0];\n }\n }\n // Enviamos el resultado a Dialogflow.\n return sendResponseToDialogflow(\n response,\n resultToSendDialogflow,\n jsonResult\n );\n });\n}", "function createList(serviceName, listItemTitle, selectionHandler) {\n\n //query web service with input parameters\n var params = getInputFieldsAsQueryString();\n\n var url = \"/ServiceManager/Macro/ExecMacro/\" + serviceName +\n \"?\" + params +\n \"&json=true\";\n\n //call web service\n jQuery.getJSON(encodeURI(url), function (json) {\n //populate results to list\n populateList(json, serviceName, listItemTitle, selectionHandler);\n });\n\n}" ]
[ "0.6589049", "0.6324382", "0.5962228", "0.5930025", "0.59096426", "0.58813", "0.5798089", "0.57682574", "0.57279974", "0.5635706", "0.55986124", "0.55499524", "0.5539971", "0.5536636", "0.55274636", "0.552325", "0.5518291", "0.5492634", "0.5465702", "0.5459565", "0.54495627", "0.5445272", "0.54405296", "0.54334354", "0.54205227", "0.538324", "0.5382663", "0.5380294", "0.5378227", "0.5356372", "0.5337231", "0.5336333", "0.53214073", "0.5316946", "0.52997583", "0.5267211", "0.52625376", "0.5248694", "0.5246135", "0.5246135", "0.52435017", "0.52399415", "0.52395296", "0.52212", "0.5219443", "0.5193665", "0.5183881", "0.5182765", "0.5180552", "0.51638883", "0.51627", "0.5159436", "0.51507974", "0.5149063", "0.51474047", "0.51445895", "0.51423407", "0.5131097", "0.5126104", "0.51233166", "0.5122896", "0.5120281", "0.5119361", "0.51163495", "0.51133883", "0.5104294", "0.51032734", "0.51023835", "0.5091249", "0.50859386", "0.5081561", "0.5074815", "0.5074514", "0.5071275", "0.50634575", "0.5062048", "0.5051611", "0.5041038", "0.50388384", "0.5031971", "0.5030868", "0.50232816", "0.5020686", "0.501947", "0.5018395", "0.5012649", "0.5010772", "0.5008477", "0.499198", "0.49909946", "0.49843982", "0.49825826", "0.49791235", "0.4977951", "0.4972529", "0.49583834", "0.49547586", "0.49477404", "0.49477404", "0.49233982", "0.4919399" ]
0.0
-1
bedrag in list zetten en toevoegen aan undordered list
function bedragToevoegen(bedrag) { let liItem = document.createElement('li'); liItem.textContent = bedrag; //eerst had ik hier append() maar dit werd niet ondersteund door internet explorer result.appendChild(liItem); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ordenaLista(list) {\n //cria uma lista de itens e ordena\n const items = list.children('button').get();\n items.sort(function (a, b) {\n const keyA = $(a).text();\n const keyB = $(b).text();\n if (keyA < keyB) return -1;\n if (keyA > keyB) return 1;\n return 0;\n });\n //remove os itens e adiciona na ordem correta\n $.each(items, function (i, child) {\n list.append(child);\n });\n }", "function generateList () {\n var orderList = newOrder()\n orderList.forEach(function (el) {\n var newListItem = document.createElement('h3')\n if (el !== 'topbun') {\n newListItem.innerText = el\n } else newListItem.innerText = 'top bun'\n order.appendChild(newListItem)\n })\n }", "function listItems(){\r\n\t\tfullList.innerHTML = '';\r\n\t\tsortListsByDate().forEach((item, index) => {\r\n\t\t\tfullList.insertAdjacentHTML( 'beforeend', listHTMLString(item, index) );\r\n\t\t});\r\n\r\n\t}", "function switchList(){\n var element = $(this);\n var added = false;\n var targetList = $(this).parent().siblings(\".cleanlist\")[0];\n $(this).fadeOut(\"fast\", function() {\n $(\".user, .group\", targetList).each(function(){\n if ($(this).text().toLowerCase() > $(element).text().toLowerCase()) {\n $(element).insertBefore($(this)).fadeIn(\"fast\");\n added = true;\n return false;\n }\n });\n\n if(!added) $(element).appendTo($(targetList)).fadeIn(\"fast\");\n });\n }", "function OrdenarListBoox(lista){\n \n var arrTexts = new Array();\n var arrTextsNew = new Array();\n \n for(var i=0; i<lista.length; i++) {\n arrTexts[i] = lista.options[i].text;\n }\n \n arrTextsNew=arrTexts.sort();\n \n for(i=0; i<lista.length; i++) {\n lista.options[i].text = arrTextsNew[i];\n lista.options[i].value = arrTextsNew[i];\n } \n}", "function doneBuyItem() { //strike through the item when done buying it\n \n $(this).parent().toggleClass('strike');\n // this is feature 1 \n // when user click the checkbox, it will sorted the list\n $('ul#myUL').find('li.strike').appendTo('ul#myUL');\n \n \n }", "function insertInList() {\r\n var workList = getPreference(\"worklist\", \"none\");\r\n var url = \"http://www.filmaffinity.com/es/rcmlistmovies.php\";\r\n // todo: borrar la worklist\r\n if (typeof workList != \"undefined\" && workList != \"none\") {\r\n var anchors = \"//img[contains(@src,'countries')]/parent::*/b/a\".findNodesArray();\r\n if (anchors.length > 0) {\r\n var data = \"action=copy\";\r\n data += \"&list_id2=\" + workList;\r\n data += \"&list_id=1001\";\r\n data += \"&rc=js/esp.js\";\r\n for (var ix in anchors) {\r\n data += \"&movie_ids[]=\" + anchors[ix].href.split(\"es/film\")[1].split(\".\")[0];\r\n }\r\n doPost(url, data, function (result) {\r\n //log(result);\r\n if (notEmpty(workList, result)) {\r\n resetWorkList(url, data, workList);\r\n } else {\r\n readVotes(workList);\r\n }\r\n });\r\n }\r\n }\r\n }", "function updateList() {\n $('#bookmarks').empty();\n\n var records = bookmarkTable.query();\n\n // Sort by creation time.\n records.sort(function (bookmarkA, bookmarkB) {\n if (bookmarkA.get('created') < bookmarkB.get('created')) return -1;\n if (bookmarkA.get('created') > bookmarkB.get('created')) return 1;\n return 0;\n });\n\n // Add an item to the list for each bookmark.\n for (var i = 0; i < records.length; i++) {\n var record = records[i];\n $('#bookmarks').append(\n renderBookmark(record.getId(),\n record.get('url'),\n record.get('bookmarkname')));\n }\n\n addListeners();\n $('#newBookmark').focus();\n }", "function fillOrderList(data) {\n var list = data == null ? [] : (data instanceof Array ? data : [data]);\n $('#itemList').find('li').remove();\n $.each(list, function (index, item) {\n $('#itemList').append('<li><a href=\"#\" data-identity=\"' + item.id + '\">' + item.customer + '</a></li>');\n });\n}", "function sortFieldList() {\n\tvar mylist = $('#editorFieldList');\n\tvar listitems = mylist.children('.formItem').get();\n\tlistitems.sort(function(a, b) {\n\t\tvar labelA = $(a).find('label').html().toLowerCase();\n\t\tvar labelB = $(b).find('label').html().toLowerCase();\n\t\treturn labelA.localeCompare(labelB);\n\t});\n\t$.each(listitems, function(idx, itm) {\n\t\tmylist.append(itm);\n\t});\n}", "function appendItem(obj) {\n todo_list.insertBefore(getTodoItem(obj), todo_list.firstChild);\n }", "function add() {\n\t\tvar item = document.getElementById(\"item\").value;\n\t\t$(\"#entry\").clone(true).appendTo(\"#list\").val('').removeClass(\"hidden\");\n\t\t$('li:last').text(item);\n\t\t}", "_addItemToList(e) {\n if (\n this.shadowRoot.querySelector(\"#itemtext\").value != \"\" &&\n typeof this.shadowRoot.querySelector(\"#itemtext\").value !==\n typeof undefined\n ) {\n this.push(\"items\", {\n label: this.shadowRoot.querySelector(\"#itemtext\").value,\n value: false,\n disabled: this.disabledList,\n id: \"item-id-\" + this.items.length\n });\n this.shadowRoot.querySelector(\"#itemtext\").value = \"\";\n }\n }", "function displayUserList(listObject) {\n var list = listObject;\n$(\".bigImg-2-content output\").empty();\n listObject.listItems.forEach(function(listItem) {\n var linkedItem = \"<a href='\" + buildAmzLink(listItem) + \"' target='_blank'>\" + listItem.itemName + \"</a>\";\n $(\".bigImg-2-content output\").append(\"<li id='\" + listItem.itemId + \"'>\" + linkedItem + \"<button class='deleteItem'>Delete</button></li>\");\n // $(\".bigImg-2-content output\").append(\"<li id='\" + listItem.itemId + \"'>\" + listItem.itemName + \"<button class='deleteItem'>Delete</button></li>\");\n })\n checkIsPacked(list);\n}", "function PrependItemsToList() {\n $(\"#olTestList3\").prepend($(\"<li></li>\").text(\"prepend() item\"));\n $(\"<li></li>\").text(\"prependTo() item\").prependTo(\"#olTestList3\");\n}", "function update(){\n //remove what's there\n Object.keys(itemEls).forEach(function(uuid){\n itemEls[uuid].forEach(function(node){\n if(node.parentNode) node.parentNode.removeChild(node);\n });\n });\n //add in the new order\n list.forEach(function(item){\n itemEls[item.id].forEach(function(node){\n openMarker.parentNode.insertBefore(node, closeMarker);\n });\n })\n }", "function restoreEditItems(){\r\n\t\t $currentArticle.find(\".ownedImgs\").append($(\".bg .cl\").find(\"li\")).parent()\r\n\t\t .find(\".ownedMusics\").append($(\".music .cl\").find(\"li\"));\r\n\t}", "function add() { //funcao ta no html onclick butto\n\n if(!validacao()){\n return;\n }\n\n var descricao = document.getElementById(\"descricao\").value;\n var quantidade = document.getElementById(\"quantidade\").value;\n var valor = document.getElementById(\"valor\").value;\n\n list.unshift({ \"descricao\": descricao, \"quantidade\": quantidade, \"valor\": valor });\n setList(list);//Esse metodo serve para Atualisando a tabela\n}", "sortById(){\n this.list.sort(function(a,b){\n return a.id - b.id;\n });\n $(\"#theTasks\").empty();\n this.list.forEach(function(item){\n item.addToDom();\n });\n }", "function updateList(e) {\n const inputValue = inputElement.value;\n if (inputValue.trim() === \"\") {\n errorElement.innerHTML = \"Ingrese una tarea\";\n return;\n }\n\n if (e.keyCode == 13 || e.type == \"click\") {\n list.push({\n name: inputValue,\n id: id,\n done: false,\n trash: false,\n });\n inputElement.value = \"\";\n id++;\n inputElement.focus();\n updateLocalStore();\n loadList();\n errorElement.innerHTML = \"\";\n }\n}", "function voertuigToevoegen() {\n\t// 1a. ophalen van voertuig uit de textbox in de UI.\n\n\t// Stel nieuw voertuig object samen\n\tvar nieuwVoertuig = {\n\t\tmerk: document.getElementById('txtMerk').value,\n\t\tprijs: document.getElementById('txtPrijs').value,\n\t\tafbeelding: document.getElementById('txtAfbeelding').value\n\t};\n\t// Push object naar de array\n\tarrayVoertuigen.push(nieuwVoertuig);\n\n\t// 1d. Lussen over de lijst met voertuigen en nieuwe lijstItems samenstellen\n\trenderVoertuigen();\n\n\t// 1f. Tekstvak weer leeg maken voor invoeren van nieuw voertuig\n\tdocument.getElementById('txtMerk').value = '';\n\tdocument.getElementById('txtPrijs').value = '';\n\tdocument.getElementById('txtAfbeelding').value = '';\n\tdocument.getElementById('txtMerk').focus();\n} // einde voertuigToevoegen", "function addListAfterClick() {\n\n\t\tcreateListElement();\n}", "function reorderList() {\n const data = Array.from(document.querySelectorAll('.value'));\n const orderOfTodos = data.map(cur => parseInt(cur.dataset.id, 10));\n\n todos.sort((a, b) => {\n const keyA = a.ID;\n const keyB = b.ID;\n\n return orderOfTodos.indexOf(keyA) > orderOfTodos.indexOf(keyB) ? 1 : -1;\n });\n\n populateTodo(todos, todoList);\n localStorage.setItem('todo', JSON.stringify(todos));\n }", "function addToProdList(item)\n{\n //window.alert(JSON.stringify(item));\n var id = getProdId();\n \n var content = $('<div></div>').html(item.DESCRIP);\n \n var li = $('<li></li>').attr(\"id\", id).attr(\"class\", \"list-group-item\").html(content).click(function(){\n \n localStorage.setItem(\"prdescrip\", \"\");\n localStorage.setItem(\"prcantidad\", \"\");\n\n setPriceSelect(item);\n \n setStatLabel(\"info\", item.DESCRIP);\n $('#prodtb').val(item.ARTICULO);\n currentProd = item;\n\n \n $('#searchProdModal').modal('hide');\n saveState();\n\n $('#prodSearch ul').empty();\n \n })\n \n console.log(id + \";\");\n $('#prodSearch ul').append(li);\n \n}", "function agregar(e) {\n e.preventDefault();\n //var ul = $('#list');\n // var inputValue = inputReparto.value;\n var reparto = $('#reparto').val();\n $('#list').append('<li>' + reparto + '</li>');\n // var li = $('li'); \n if (inputValue !== '') {\n li.innerHTML = inputValue\n ul.append('li');\n }\n inputReparto.value = '';\n}", "function move_list_items(sourceid, destinationid) {\n\t$(\"#\" + sourceid + \" option:selected\").appendTo(\"#\" + destinationid);\n}", "function addOrder(){\n var li, pa, inum, ides;\n item=JSON.parse(sto.getItem('items'));\n for (i=0; i<items.length; i++){\n if (item[items[i]] != null && item[items[i]] !== \"\"){\n // declare the items elements\n li= document.createElement('li');\n pa= document.createElement('p');\n inum= document.createElement('i');\n ides= document.createElement('i');\n // Define item and quantity\n li.classList.add('review-item');\n li.id= items[i];\n inum.innerText=item[items[i]];\n ides.innerText=\" x \"+items[i];\n pa.append(inum);\n pa.append(ides);\n\n // Add elements to list\n li.append(pa);\n document.querySelector('#review-list').append(li);\n }\n }\n }", "function updateList() {\n var list = document.getElementById('gistlist');\n\n clearNode(list);\n\n GistList.filter(listFilter).forEach(function(gist) {\n list.appendChild(GistListItem(gist));\n });\n\n}", "function prepareList() {\n\t\t// find td of first entry, make it to a template\n\t\tlistNode = document.querySelector('.object-list tbody tr');\n\t\tif (listNode && listNode.parentElement) {\n\t\t\tlistStart = listNode.parentElement;\n\t\t\tlistNode.parentElement.removeChild(listNode);\n\t\t} else {\n\t\t\tconsole.error('No listitem found, could not load objects list.');\n\t\t\treturn;\n\t\t}\n\t}", "function modifyItemInOrder(Name,count,price,id) {\n\tif ($('#orderArea').children().length ===0){return;}//Doesn't allow modifier added unless a menu item already exists\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//for example cant add 'extra cheese' to nothing.\n\telse if ($(\"ul.editItem\").length>0) {\n\t\tvar itemToModify = $(\".editItem\");//condition used if someone is editing a menu item that was already added\n\t}else {\n\t\tvar itemToModify = $('#orderArea').children().last();};//modify the last item that was added\n\t\t\n\tvar itemName = Name+'-'+count;//creates unique\n\tvar newItem = HTMLelement(\"li\",{name:id,id:itemName,value:price});\n\n\titemToModify.append(newItem);\n\t$('#'+itemName).html(Name.toUpperCase() +' $'+price);\n\tupdateOrderTotal();\n}", "AddListKurs (item){\n this.state.InitialMataUang.unshift({\n kurs : item.toUpperCase(),\n nilai : 0\n });\n this.setState({InitialMataUang:this.state.InitialMataUang})\n }", "function generateList() {\n const ul = document.querySelector(\".list\");\n abrigoList.forEach((abrigo) => {\n const li = document.createElement(\"li\");\n const div = document.createElement(\"div\");\n const a = document.createElement(\"a\");\n const p = document.createElement(\"p\");\n a.addEventListener(\"click\", () => {\n irParaAbrigo(abrigo);\n });\n div.classList.add(\"abrigo-item\");\n a.innerText = abrigo.properties.name;\n a.href = \"#\";\n p.innerText = abrigo.properties.address;\n\n div.appendChild(a);\n div.appendChild(p);\n li.appendChild(div);\n ul.appendChild(li);\n });\n}", "function addToList(fav) {\n const list = document.querySelector(\"#list\");\n const checked = fav.id == state_1.default.fav.id;\n const node = html(\"li\", {}, \n // radio button\n html(\"input\", {\n type: \"radio\",\n name: \"active\",\n value: fav.id,\n id: fav.id,\n checked\n }), \n // list name\n html(\"label\", { for: fav.id }, fav.name), \n // hidden until renaming\n html(\"input\", {\n type: \"text\",\n name: \"name\",\n value: fav.name\n }), \n // number of books in the set\n ` (${fav.bookIds.length} books)`);\n // move the tools to the active set\n if (checked) {\n node.appendChild(document.querySelector(\"#tools\"));\n }\n list.appendChild(node);\n}", "function moveToCompletedList(newItem){\n completedList.prepend(newItem);\n}", "function displayCurrentOrder(){\n\n // clear out the list to start fresh\n $('#current_order').empty();\n\n // get the current order\n let beverages = $('#order_form').find('input[name=\"beverages\"]').serializeArray();\n let kitchen = $('#order_form').find('input[name=\"kitchen\"]').serializeArray();\n let current_items = beverages.concat(kitchen);\n\n if(current_items.length >= 1){\n current_items.forEach(function(e){\n console.log(e);\n let order = JSON.parse(e.value);\n console.log(order);\n $('#current_order').append('<li class=\"borderless input-cafe\">'+ displayFriendlyItem(order.item) + ' for ' + order.name + '</li>');\n });\n }\n }", "function pushCalendarLists(list, element) {\n\t\tvar settings = document.getElementById(element);\n\t\tsettings.innerHTML = '<option value=\"0\" selected disabled>Välj klass..</option>';\n\t\tlist.forEach(function(item, i) {\n\t\t\tsettings.innerHTML += '<option value=\"'+item.calendar+'\">'+item.name+'</option>';\n\t\t});\n\t}", "function updateTrash(list) {\n that.data.lists.push(list);\n }", "function listoKurimas() {\n divuiAte();\n pridedamVerteIMasyva();\n var divListui = document.createElement('div'); // sukuriam diva listui\n // divui id\n divListui.id = \"divoId\";\n // pridedam sukurta diva i body\n document.getElementsByTagName('body')[0].appendChild(divListui);\n // sukuriam ul taga\n var ulDivui = document.createElement('ul');\n // idedam ul i diva\n divListui.appendChild(ulDivui);\n // sukuriam for loopa kad pridetu i ul masyvo \n // elementus kaip li\n var kiekListeYraLi = komentaruMasyvas.length;\n \n\n //////////////////////////////////////////////////////////////////////////\n // cia GAL su get element by tag name pasigauti sukurta ul ir appendint kuriamus li \n // i ji?\n for (var i = 0; i < kiekListeYraLi; ++i) {\n var listoElementas = document.createElement('li');\n listoElementas.innerHTML = komentaruMasyvas[i];\n ulDivui.appendChild(listoElementas);\n\n };\n document.getElementById('divasIsHtmlSkriptoVietai').appendChild(divListui);\n\n}", "function addToMylist() { return changeMylistState('add',this); }", "function updateOrder(){\n\t\t\telement.find(\"li\").each(function(i){\n\t\t\t\ti++;\n\t\t\t\tvar li = $(this);\n\t\t\t\tli.find(\"input.order\").val(i);\n\t\t\t});\n\t\t}", "function addGeneratedItemsToList() {\n var array = [],\n mold = '';\n\n for (var i = 1; i <= 5; i++) {\n array.push('Num: ' + i);\n }\n\n array.forEach(function (val) {\n mold += '<li>' + val + '</li>';\n });\n\n $('#list1').html('<ul>' + mold + '</ul>');\n }", "function updateVerkopen(ajax){\n\n\tvar newLi = document.createElement(\"li\");\n\tnewLi.innerHTML = ajax;\n\n\t$(\"verkooplist\").appendChild(newLi);\n\t$$(\"#verkooplist > li\").last().blindDown();\n\t\n}", "function updateList () {\r\n list.push(xLB); // Aktuelle Messstrecke zur Liste hinzufügen\r\n var s = ta.value; // Bisheriger Inhalt des Textbereichs\r\n s += value(xLB,3,meter)+\"; \"; // Weglänge hinzufügen\r\n s += value(tLB,3,second)+\"\\n\"; // Zeit hinzufügen\r\n ta.value = s; // Textbereich aktualisieren\r\n }", "function moveUpPropertyList()\n{\n\tvar selectedList = jQuery(\"#selectedList\");\n\n\tjQuery(\"#selectedList\").find(\"tr\").each( function( i, item ){\n\t\titem = jQuery(item);\n\t\tif( item.hasClass(\"selected\") )\n\t\t{\n\t\t\tvar prev = item.prev('#selectedList tr');\n\t\t\tif (prev.length == 1) \n\t\t\t{ \n\t\t\t\tprev.before(item);\n\t\t\t}\n\t\t}\n\t});\n}", "function order_list_1(){\n var order_li = jQuery('.faq-list').find('li');\n order_li.each(function() {\n var item_index_2 = jQuery(this).index() + 1 + \".\";\n jQuery(this).find('.order-num').html(item_index_2);\n });\n }", "function addListItem() {\n var itemInput = document.getElementById('itemInput');\n var priceInput = document.getElementById('priceInput');\n listObject.addListItem(itemInput.value, priceInput.value);\n itemInput.value = '';\n priceInput.value = '';\n buildList(listObject.listItems);\n listObject.saveList();\n}", "sortByTag(){\n this.list.sort(function(a,b){\n return a.tag.localeCompare(b.tag);\n });\n $(\"#theTasks\").empty();\n this.list.forEach(function(item){\n item.addToDom();\n });\n }", "doTransaction() {\n if (this.currentList != undefined)\n this.currentList.items[this.itemIndex] = this.newItem;\n }", "function addBasket(basket, move) {\n basket.find(\"ul\").append('<li data-id=\"' + move.attr(\"data-id\") + '\">' + '<span class=\"name\">' + move.find(\"h3\").html() + '</span>' + '<input class=\"count\" value=\"1\" type=\"text\">' + '<button class=\"delete\">&#10005;</button>');\n }", "addOrder(itemName) {\n console.log(\"this.order pries\", this.order);\n // surasti meniu objekta kurio item === itemName\n let uzsakytasObjektas = this.menu.find((menuItemObj) => menuItemObj.item === itemName);\n if (uzsakytasObjektas === undefined) {\n console.warn(\"Tokios prekes nera: \", itemName);\n return;\n }\n this.order.push(uzsakytasObjektas);\n console.log(\"this.order po\", this.order);\n //\n }", "function update_downloaders_list(downloaders_list){\n //Clean list data\n $(\"#sortable2 li\").appendTo('#sortable1');\n $('#sortable1').sortable('option', 'receive')(null, { item: $(\"#sortable2 li\") });\n\n var downloaders = downloaders_list.split(\",\");\n for (var row in downloaders) {\n $(\"#\"+downloaders[row]).appendTo('#sortable2');\n //Trigger\n $('#sortable2').sortable('option', 'receive')(null, { item: $(\"#\"+downloaders[row]) });\n }\n\n}", "function loadSubWokers(el, chief) {\n $.get(\"hierarchy/\" + chief, function (data) {\n var result = '';\n data.forEach(function (item, i, arr) {\n result += '<li data-id=\"' + item.id + '\" class=\"hierarchy_item\">' + item.name + ' - ' + item.position + '<ul class=\"itemsList\"></ul>' + '</li>';\n });\n el.children(\"ul\").html(result);\n /*hierarhy list sortable init*/\n $('.itemsList').sortable({\n connectWith: $('.itemsList'),\n placeholder: \"ui-state-highlight\",\n receive: function receive(event, ui) {\n var chief_id = $(ui.item).parent().parent().attr(\"data-id\");\n var worker_id = $(ui.item).attr(\"data-id\");\n $.post('/update_chief', {\n '_token': $('meta[name=csrf-token]').attr('content'),\n 'id': worker_id,\n 'chief_id': chief_id\n });\n }\n });\n });\n}", "function showListePostes(data) {\n if (!data instanceof Array || data.length === 0) {\n poste_list.html('');\n return false;\n }\n\n var items = '';\n data.forEach(function(item, index) {\n var checked = item.is_selected ? 'checked' : '';\n var checkbox = '<div class=\"switch pull-right\">\\n' +\n ' <div class=\"onoffswitch\">\\n' +\n ' <input type=\"checkbox\"' + checked + ' class=\"onoffswitch-checkbox poste-affect-item\" data-id=\"' + item.org_id + '\"' +\n ' id=\"post-affect-' + item.org_id + '\">\\n' +\n ' <label class=\"onoffswitch-label\" for=\"post-affect-' + item.org_id + '\">\\n' +\n ' <span class=\"onoffswitch-inner\"></span>\\n' +\n ' <span class=\"onoffswitch-switch\"></span>\\n' +\n ' </label>\\n' +\n ' </div>\\n' +\n ' </div>';\n items += '<ul class=\"list-group-item\" id=\"' + item.org_id + '\">' + checkbox + '<i class=\"fa fa-arrow-right\"></i> ' + item.org_nom + '</ul>';\n });\n\n poste_list.html(items);\n\n $('#btn-save-poste-affect').removeAttr('disabled');\n }", "async function toList(){\n props.currentList(selectedList); \n props.ingredientList(newIngredients); \n setVisible(false);\n const dataFetch = await fetch(`${baseURL}/findGroupList`, {\n method: 'POST',\n headers: {'Content-Type': 'application/x-www-form-urlencoded'},\n body: `token=${props.token}&list=${selectedList._id}`\n });\n const body = await dataFetch.json();\n if(body){\n props.AddTokenGroup(body);\n props.navigation.navigate('MesGroupesP12') \n }else{\n props.navigation.navigate('GlobalList') \n }\n }", "function addToList() {\r\n\tvar newItem = \"<li>\" + document.getElementById('listItem').value + \"</li>\";\r\n\r\n\t// Prevents blank inputs\r\n\tif (newItem != \"<li></li>\") {\r\n\r\n\t\t// Adds new item to bottom of list (default)\r\n\t\tif (document.getElementById('bottom').checked) {\r\n\t\t\tmyList.push(newItem); \t\r\n\t\t} \r\n\r\n\t\t// Adds new item to top of list if selected in settings\r\n\t\telse if (document.getElementById('top').checked) {\r\n\t\t\tmyList.unshift(newItem);\r\n\t\t}\r\n\t}\r\n\r\n\tdocument.getElementById('list-content').innerHTML = myList.join(\"\"); // Output updated list\r\n document.getElementById('form').reset();\t// Reset Form - clear listItem input\r\n document.getElementById('listItem').focus(); // Move cursor to listItem input\r\n}", "function searchList(search) {\n var li = $(\"<li>\");\n li.addClass(\"list-group-item\");\n li.text(search);\n $(\".list-group\").prepend(li);\n localStorage.setItem(\"lastSearch\", search);\n }", "function habilitoLista (){\n\t\t\t$scope.verListado = true;\n\t\t}", "function updateList() {\n\n\tvar filter = search.text.toLowerCase();\n\n\telList.removeAll();\n\n\tfor(var i in allElements) {\n\n\t\tvar e = allElements[i];\n\t\tif(!filter || e.displayName.toLowerCase().indexOf(filter) !== -1) {\n\t\t\tvar item = elList.add(\"item\", stripExt(e.displayName));\n\t\t\tif(e instanceof Folder) {\n\t\t\t\titem.text += \" \\u00BB\";\n\t\t\t}\n\t\t\titem.file_object = e;\n\t\t}\n\n\t}\n\n}", "function addToOrder(productID, categoryId) {\n var list = document.getElementById(\"li\" + productID);\n var span = document.getElementById(\"span\" + productID);\n var productAantal = 0;\n\n //getal zichtbaar maken voor product op de lijst\n //list.setAttribute(\"class\", \"product\");\n //span.innerHTML = parseInt(span.innerHTML) + 1;\n\n if (sessvars.bestelling == undefined) {\n //Dit is een nieuwe bestelling\n var bestellingen = new Array();\n var bestelling = new Object();\n bestelling.bestellingId = 0;\n bestelling.ProductId = productID;\n bestelling.CategoryId = categoryId;\n bestelling.Hoeveelheid = 1;\n bestellingen[0] = bestelling;\n sessvars.bestelling = bestellingen;\n } else {\n //Dit is een lopende bestelling\n var bestellingen = new Array();\n var productInOrder = false;\n \n for (var i = 0; i < sessvars.bestelling.length; i++) {\n bestellingen[i] = sessvars.bestelling[i];\n }\n\n for (var j = 0; j < bestellingen.length; j++) {\n var productIDFromBestellijst = bestellingen[j].ProductId;\n if (productIDFromBestellijst == productID) {\n productInOrder = true;\n bestellingen[j].Hoeveelheid = bestellingen[j].Hoeveelheid + 1;\n }\n }\n\n if (productInOrder == false) {\n var bestelling = new Object();\n bestelling.bestellingId = sessvars.bestelling.length;\n bestelling.ProductId = productID;\n bestelling.CategoryId = categoryId;\n bestelling.Hoeveelheid = 1;\n bestellingen[bestellingen.length] = bestelling;\n }\n\n sessvars.bestelling = bestellingen;\n }\n\n //Kijk hoeveel producten er in de bestelling zitten\n for (var i = 0; i < sessvars.bestelling.length; i++) {\n productAantal += sessvars.bestelling[i].Hoeveelheid;\n }\n var topRight = document.getElementById(\"topRight\");\n topRight.innerHTML = \"Order Basket(\" + productAantal + \")\";\n}", "function renderVoertuigen() {\n\t// 1c. Lijst leegmaken, voorafgaand aan toevoegen nieuw voertuig.\n\tdocument.getElementById('lijstVoertuigen').innerHTML = '';\n\n\tfor (var i = 0; i < arrayVoertuigen.length; i++) {\n\t\tvar nieuwListItem =\n\t\t\t'<li class=\"list-group-item\"><span class=\"merk\">' +\n\t\t\tarrayVoertuigen[i].merk +\n\t\t\t'</span>';\n\t\tnieuwListItem +=\n\t\t\t'<span class=\"prijs\">' + arrayVoertuigen[i].prijs + '</span>';\n\t\tnieuwListItem +=\n\t\t\t'<img src=\"img/' + arrayVoertuigen[i].afbeelding + '\">';\n\n\t\tnieuwListItem += '</li>';\n\t\t//1d. Toevoegen aan de lijst met voertuigen in de UI.\n\t\tdocument.getElementById('lijstVoertuigen').innerHTML += nieuwListItem;\n\t} // einde for-lus\n}", "function currentItems() {\n children = []\n for (let i = 1; i < $(\"ul.items\").children().length + 1; i++) {\n children.push($(\"ul.items li:nth-child(\" + i + \")\").find(\"h2\").text())\n }\n $(\"ul.items\").empty()\n JsontoHTMLSort(children)\n }", "function doEditInShowList(li){\n\n li.children[1].innerText = document.getElementById(\"task\").value ;\n li.id = document.getElementById(\"task\").value ;\n\n }", "function navigation() {\n\t\n\t/* @TODO: reverse li und stelle angemeldet als nach oben */\n\t//$$('#account ul').insert( $$('#account ul li').reverse() );\n}", "function EligedropOrigen(ind, pantalla)\n {\n console.log(\"EligeDropOrigen: \" + ind + ' ' + pantalla);\n var ZonaElegida=DatosTarifarios.Zonas[ind];\n if (pantalla==1) {\n $('#lblOrigen').text(ZonaElegida);\n $('#ulDestino').empty();\n $('#lblDestino').text(\"Elegir zona destino\");\n $('#lblMonto').text('$$$');\n }else{\n $('#lblOrigen2').text(ZonaElegida);\n $('#ulDestino2').empty();\n $('#lblDestino2').text(\"Elegir zona destino\");\n $('#lblMonto2').text('$$$');\n }\n\n \n for (indice in DatosTarifarios.Tarifas)\n { \n var txt=DatosTarifarios.Tarifas[indice]['zona'];\n //console.log(txt);\n if (ZonaElegida==DatosTarifarios.Tarifas[indice]['zona_ref']) {\n var option='<li><a style=' + String.fromCharCode(34) + 'font-size:2em;' + String.fromCharCode(34) + ' href=\"javascript: EligedropDestino(' + indice + ', ' + pantalla + ')\">' + txt + '</a></li>';\n if (pantalla==1) {\n $('#ulDestino').append(option);\n }else{\n $('#ulDestino2').append(option);\n }\n };\n }\n }", "function buildList(dropdown, list) {\n let divisionPicked = sessionStorage.getItem(\"divisionPick\");\n\n for(let i = 0; i < list.length; i++) {\n if(divisionPicked == list[i].Code) {\n let element = $(\"<option>\", {text: list[i].Name, value: list[i].Code, selected: \"selected\"});\n dropdown.append(element);\n }\n else {\n let element = $(\"<option>\", {text: list[i].Name, value: list[i].Code});\n dropdown.append(element);\n }\n }\n}", "function addToOngo(text){\n const ongoLi = document.createElement(\"li\");\n const ongoSpan = document.createElement(\"span\");\n ongoSpan.innerText = text;\n const delBtn = document.createElement(\"button\");\n delBtn.innerHTML = `<i class=\"fas fa-trash-alt\"></i>`;\n delBtn.addEventListener(\"click\", delToDo);\n const finBtn = document.createElement(\"button\");\n finBtn.innerHTML = `<i class=\"fas fa-check-square\"></i>`;\n finBtn.addEventListener(\"click\",moveToEach);\n \n ongoLi.appendChild(ongoSpan);\n ongoLi.appendChild(finBtn);\n ongoLi.appendChild(delBtn);\n ongoList.appendChild(ongoLi);\n\n newId = ONGOING.length+1;\n ongoLi.id = newId;\n \n const ongoObj = {\n id : newId,\n value : text\n }\n\n ONGOING.push(ongoObj);\n saveOngo();\n}", "function userOrderList(user, ulid){\n let orders = user.orders;\n\n for (order in orders){\n\n let orderOBJ = user.orders[order];\n\n $(`#${ulid}`).append(`\n <li class=\"list-group-item\">\n <div class=\"row\">\n <div class=\"col-8\">${orderOBJ.date}</div>\n <div class=\"col-4\">$${orderOBJ.value}</div>\n </div> \n </li>\n `)\n }\n}", "function checkOrder() {\n listItems.forEach((listItem, index) => {\n const personName = listItem.querySelector('.draggable').innerText.trim();\n\n if (personName !== panovnici[index]) {\n listItem.classList.add('wrong');\n } else {\n listItem.classList.remove('wrong');\n listItem.classList.add('right');\n }\n });\n}", "function restoreOrder() {\r\n\tvar list = $(setSelector);\r\n\tif (list == null) return\r\n\r\n\t// make array from saved order\r\n\tvar IDs = cookie.split(\",\");\r\n\r\n\t// fetch current order\r\n\tvar items = list.sortable(\"toArray\");\r\n\r\n\t// make array from current order\r\n\tvar rebuild = new Array();\r\n\tfor ( var v=0, len=items.length; v<len; v++ ){\r\n\t\trebuild[items[v]] = items[v];\r\n\t}\r\n\r\n\tfor (var i = 0, n = IDs.length; i < n; i++) {\r\n\r\n\t\t// item id from saved order\r\n\t\tvar itemID = IDs[i];\r\n\r\n\t\tif (itemID in rebuild) {\r\n\r\n\t\t\t// select item id from current order\r\n\t\t\tvar item = rebuild[itemID];\r\n\r\n\t\t\t// select the item according to current order\r\n\t\t\tvar child = $(\"div.sortable.ui-sortable\").children(\"#\" + item);\r\n\r\n\t\t\t// select the item according to the saved order\r\n\t\t\tvar savedOrd = $(\"div.sortable.ui-sortable\").children(\"#\" + itemID);\r\n\r\n\t\t\t// remove all the items\r\n\t\t\tchild.remove();\r\n\r\n\t\t\t// add the items in turn according to saved order\r\n\t\t\t// we need to filter here since the \"ui-sortable\"\r\n\t\t\t// class is applied to all ul elements and we\r\n\t\t\t// only want the very first! You can modify this\r\n\t\t\t// to support multiple lists - not tested!\r\n\t\t\t$(\"div.sortable.ui-sortable\").filter(\":first\").append(savedOrd);\r\n\t\t}\r\n\t}\r\n}", "function displayList() {\n\t\ttodoList = JSON.parse(localStorage.getItem(\"todoList\"));\n\t\ttodoList.forEach(function (element) {\n\t\t\tlet text = element.item;\n\t\t\tlet item = `<li id=\"li-${id}\"><span>${text}</span><input id=\"box-${id}\" class=\"checkboxes\" type=\"checkbox\"></li>`;\n\t\t\tlist.innerHTML += item;\n\t\t\tid++;\n\t\t});\n\t\twhichChecked()\n\t}", "function updateLinkList(tree) {\n let bookmarks = tree[0]['children'][0]['children']\n if (bookmarks.length > 0) {\n $linkList.empty()\n for (i=0; i<bookmarks.length; i++) {\n let bookmark = $(`<li id='bookmark-${i}'>\n <a href='bookmark[i].url'>${bookmarks[i].title}</a>\n </li>`)\n $linkList.append(bookmark)\n }\n }\n \n}", "function createList() {\n [...rediscoveryOrder]\n .map((a) => ({value: a, sort: Math.random()}))\n .sort((a, b) => a.sort - b.sort)\n .map((a) => a.value)\n .forEach((person, index) => {\n const listItem = document.createElement('li');\n\n listItem.setAttribute('data-index', index);\n\n listItem.innerHTML = `\n <span class=\"number\">${index + 1}</span>\n <div class=\"draggable\" draggable=\"true\">\n <p class=\"person-name\">${person}</p>\n <i class=\"fas fa-grip-lines\"></i>\n </div>\n `;\n\n listItems.push(listItem);\n\n draggable_list.appendChild(listItem);\n });\n}", "function loadList() {\n newToDoItem(\"Buy milk\", true)\n newToDoItem(\"Do dishes\", false)\n newToDoItem(\"Feed Tito\", true)\n}", "function criarListaFiltros() {\n ingredientes.sort().forEach(function (valor, indice) {\n let itemLista = document.createElement('li');\n let checkbox = document.createElement('input');\n checkbox.type = 'checkbox';\n checkbox.value = indice;\n itemLista.appendChild(checkbox);\n itemLista.innerHTML += valor;\n elementoListaFiltro.appendChild(itemLista);\n });\n}", "function AddList(Column , list , ascSort , data , name , description){\n counter++;\n lst.push({\"id\" : counter.toString(), \"ID\": data, \"Name\": name, \"Description\": description });\n Sort(Column , list);\n}", "function createList() {\n [...panovnici]\n .map(a => ({ value: a, sort: Math.random() }))\n .sort((a, b) => a.sort - b.sort)\n .map(a => a.value)\n .forEach((person, index) => {\n const listItem = document.createElement('li');\n\n listItem.setAttribute('data-index', index);\n\n listItem.innerHTML = `\n <span class=\"number\">${index + 1}</span>\n <div class=\"draggable\" draggable=\"true\">\n <p class=\"person-name\">${person}</p>\n \n </div>\n `;\n\n listItems.push(listItem);\n\n draggable_list.appendChild(listItem);\n });\n\n addEventListeners();\n}", "function setItem(data) {\n\t\tif (!data._id || !listNode) {\n\t\t\treturn \n\t\t\t\tconsole.error('no _id for the given object.',data);\n\t\t}\n\t\tvar findNode = document.getElementById(createObjectId(data._id));\n\t\tif (!findNode) {\n\t\t\t// create a new node for object\n\t\t\tfindNode = listNode.cloneNode(true);\n\t\t\t// img will only shown if an image exists\n\t\t\tvar img = findNode.querySelector('img');\n\t\t\tif (img) {\n\t\t\t\timg.addEventListener('error',function(event) {\n\t\t\t\t\tthis.style.setProperty('display','none');\n\t\t\t\t})\n\t\t\t\timg.addEventListener('load',function(event) {\n\t\t\t\t\tthis.style.setProperty('display','block');\n\t\t\t\t})\n\t\t\t\timg.style.setProperty('display','none');\n\t\t\t} // end add event listener to img. no image not visible\n\t\t\tvar zuweisen = findNode.querySelector('.object-list-addToTopicView');\n\t\t\tif (zuweisen) {\n\t\t\t\t/* MFM2 (12) */\n\t\t\t\tzuweisen.addEventListener('click',function(event) {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\tif (3 != _objectEditMode)\n\t\t\t\t\t\treturn alert('Choose get by list from the object')\n\t\t\t\t\tif (_topicView && _topicView.title) {\n\t\t\t\t\t\t// send an event to editView\n\t\t\t\t\t\teventHandler.notifyListeners(eventHandler.customEvent('allObject','getObject','',data));\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\tchangeNode(findNode, data);\n\t\t\tif (listStart.children[0]) {\n\t\t\t\tlistStart.insertBefore(findNode, listStart.children[0]);\n\t\t\t} else {\n\t\t\t\tlistStart.appendChild(findNode);\n\t\t\t}\n\n\t\t} else {\n\t\t\t// change node\n\t\t\tchangeNode(findNode, data);\n\t\t}\n\t}", "function addToList(e) {\n // prevent default of form >>\n e.preventDefault();\n\n //make sure the input is not processed when it's empty with an if condition >>\n if (userInput.trim()) {\n // create item list and to ensure we don't replace the old listitem with the new>>\n props.setList((prevState) => [\n ...prevState,\n { id: uuidv4(), title: userInput.trim(), done: false, priority: 0 },\n ]);\n }\n\n // clear userInput on submit\n setUserInput(\"\");\n }", "function loadList (array){\n array.forEach(function(item){\n addItem(item.name, item.id, item.done, item.trash);\n });\n }", "function excluirDados(id){\n if(confirm(\"Tem Serteza que Quer excluir\")){\n if(id === list.length - 1) {//linpando ultimo\n list.pop(); //pop server para apagar um item \n }else if(id === 0){//excluindo o primeiro\n list.shift();//shift apaga o primeiro item\n }else {\n var arrayInicial = list.slice(0,id);//apagando itens no meio do formulario\n var arrayFinal = list.slice(id + 1);\n list = arrayInicial.concat(arrayFinal);\n }\n setList(list);\n }\n}", "function addItemToList()\n{\n\t// Item list to append new item to\n\tvar itemList = document.getElementById(\"itemlist\");\n\t\n\t// Array of individual items in list\n\tvar saleArray = [];\n\tsaleArray = document.getElementsByClassName(\"item\");\n\n\t// Set unique id's for all item elements in saleArray\n\tvar i = 0;\n\twhile (i < saleArray.length)\n\t{\n\t\tsaleArray[i].id = \"item_\" + i;\n\t\ti++;\n\t}\n\n\t// Clone the last instance of element with name \"item\" and give it and its children unique id\"s\n\tvar cloneItem = document.getElementById(\"item_\" + (i - 1));\n\tvar newItem = cloneItem.cloneNode(true);\n\t\n\t// Set id\"s and name values for database submission\n\tnewItem.id = \"item_\" + i;\n\tnewItem.name = \"item_\" + i;\n\t\n\tnewItem.getElementsByClassName(\"itemname\")[0].id = \"itemname_\" + i;\n\tnewItem.getElementsByClassName(\"itemname\")[0].name = \"itemname_\" + i;\n\n\tnewItem.getElementsByClassName(\"itemid\")[0].id = \"itemid_\" + i;\n\tnewItem.getElementsByClassName(\"itemid\")[0].name = \"itemid_\" + i;\n\n\tnewItem.getElementsByClassName(\"itemquantity\")[0].id = \"itemquantity_\" + i;\n\tnewItem.getElementsByClassName(\"itemquantity\")[0].name = \"itemquantity_\" + i;\n\n\tnewItem.getElementsByClassName(\"unitcost\")[0].id = \"unitcost_\" + i;\n\tnewItem.getElementsByClassName(\"unitcost\")[0].name = \"unitcost_\" + i;\n\n\tnewItem.getElementsByClassName(\"totalcost\")[0].id = \"totalcost_\" + i;\n\tnewItem.getElementsByClassName(\"totalcost\")[0].name = \"totalcost_\" + i;\n\n\t// Set default values\n\tnewItem.getElementsByClassName(\"itemquantity\")[0].value = 1;\n\n\t// Remove buttons from previous list item\n\tcloneItem.getElementsByClassName(\"additem\")[0].remove();\n\t\n\tif (cloneItem.contains(cloneItem.getElementsByClassName(\"removeItem\")[0]))\n\t{\n\t\t// Remove the remove button from the clonee if it exists\n\t\tcloneItem.getElementsByClassName(\"removeItem\")[0].remove();\n\t}\n\telse\n\t{\n\t\t// Add the remove button to current list item\n\t\tvar removeButton = document.createElement(\"button\");\n\t\tremoveButton.innerHTML = \"Remove\";\n\t\tremoveButton.className = \"removeItem\";\n\t\tremoveButton.type = \"button\";\n\t\tnewItem.appendChild(removeButton);\n\t}\n\n\t// Add event listerners\n\tnewItem.getElementsByClassName(\"itemname\")[0].addEventListener(\"change\", formUpdate);\n\tnewItem.getElementsByClassName(\"itemquantity\")[0].addEventListener(\"change\", formUpdate);\n\tnewItem.getElementsByClassName(\"additem\")[0].addEventListener(\"click\", addItemToList);\n\tnewItem.getElementsByClassName(\"removeItem\")[0].addEventListener(\"click\", removeItemFromList);\n\n\t// Add newItem to itemList\n\titemList.appendChild(newItem);\n\n\t//Update form\n\tformUpdate();\n\n\tif (debug)\n\t{\n\t\ti = 0;\n\t\tvar debugMsg = \"\";\n\t\twhile (i < saleArray.length)\n\t\t{\n\t\t\tdebugMsg += saleArray[i].id + \"\\n\";\n\t\t\ti++;\n\t\t}\n\t\talert(debugMsg);\n\t}\n}", "function addItem (toDo,id,done,trash){\n \n if (trash){ return;} // if the LIST array objects \"trash\" value is \"true\" , no execute it, return blank. \n\nconst line = done?lineThrough:\"\";\nconst checkIcon = done?CHECK:UNCHECK;\nconst itemContent = `<li class=\"item\" >\n <i class=\"check far ${checkIcon}\" id=${id} job =\"complete\"></i>\n <p class=\"text ${line}\">${toDo}</p>\n <i class=\"float-right delete far fa-trash-alt\" id=${id} job = \"delete\"></i>\n </li>`\n \n const position = \"beforeEnd\"\n list.insertAdjacentHTML(position,itemContent)\n\n}", "function atualizarLista(data) {\n\t\t\tmensagemSucesso();\n\t\t\t$scope.enderecadores.push(data);\n\t\t}", "function ChangeOrderNoForList(listnode)\n{\n var i = 1;\n $(listnode).children(\"li\").each(function () {\n var id = $(this).attr(\"data-id\");\n ChangeOrderNoForOneElement(id, i);\n i++;\n console.log($(this).attr(\"data-id\"));\n console.log(i);\n });\n\n console.log($(listnode).children(\"li\"));\n}", "function listReset(){\n\t\teAbrevList = [];\n\t\tfor(i in allE){\n\t\t eAbrevList.push(allE[i].abrev);\n\t\t}\n\t\t$(\".curE p\").append(chosenE.abrev); /* Attach new values to html elements */\n\t\t$(\".elements p\").empty().append(eAbrevList.join(\", \"));\n\t }", "function ajouter_dans_la_liste(aAjouter){\n $('.jcarousel ul').append(\"<li>\"+aAjouter+\"</li>\");\n}", "function addTag(item, listTag) {\n let list = listTag.filter(function (item1) {\n return item1.post === item.id;\n })\n item['listTag'] = list;\n return item;\n}", "function addtofriendlist(e){\n\t$.post('app/templates/listfriend.php',{id:'*'},function(data){\n\t\t$('.listbody .list-group').html(data);\n\t});\t\n\t$.post('app/templates/listfriend.php',{id:e},function(data){\n\t\t$('.listbody .list-group').prepend(data);\n\t});\t\n\t$('#search').val('');\n\tconsole.log(e);\n}", "agregarGastoListado(nombre, cantidad) {\n //const gastosListado = $('#gastos ul');\n const gastosListado = document.querySelector('#gastos ul');\n console.log(gastosListado);\n const li = document.createElement('li');\n li.className = 'list-group.item d-flex justify-content-between align-items-center';\n\n li.innerHTML = `\n ${nombre}\n <span class = \"badge badge-primary badge-pills\"> ${cantidad}</span>\n `;\n\n gastosListado.appendChild(li);\n }", "function addFruitList() {\n \n var fruitList = $(\"<ul id='fruits' class='connectedSortable'></ul>\");\n \n for (var fruit in fruitArray) {\n \n fruitList.append($(\"<li><img src='\"+fruit+\".png' data-yumminess='\"+fruitArray[fruit][0]+\"' data-cost='\"+fruitArray[fruit][1]+\"' data-name='\"+fruit+\"' data-color='\"+fruitArray[fruit][2]+\"' class='fruit-tile'><span class='fruit-label'>\"+fruit+\"<br>\"+fruitArray[fruit][0]+\" yums, \"+monify(fruitArray[fruit][1])+\"</span></li>\"));\n \n }\n $(\".fruitsSpan\").empty()\n $(\".fruitsSpan\").append(fruitList);\n \n }", "function listCarnetContact(){ \n checkLocalStorage() /* appel à la fonction \"checkLocalStorage\" */\n $('#contactList').html('<ul>') /* Création d'une ul pour y insérer les li correspondant à nos contacts enregistrés */\n for(i=0; i < liste.length; i++){ /* pour chaque objets contenus dans le tableau \"liste\" */\n $(\"#contactList ul\").append(\"<li>\" + '<a href=\"#\" data-index=\"' +i+ '\">'+ liste[i].prenom + \" \" + liste[i].nom + \"</a>\" + \"</li>\") /* Affiche le prénom suivi du nom dans une li et attribut à chaque li un index qui sera utilisé pour afficher le détail du contact lorsqu'on clic sur son nom.*/\n }\n}", "function createOrderedList(link)\n{\n return link.index+'. '+link.url\n}", "function addItem() {\n var contents = document.getElementById('newTask').value;\n var item = new listItem(Date.now(), contents, false);\n masterList.push(item);\n showList(masterList);\n saveList();\n}", "function htmlFillRawTitlesList(rawTitlesSelectedRecipe) {\n console.log('htmlFillRawTitlesList ' + rawTitlesSelectedRecipe);\n $('#SelecteRecipeList').empty(); //empties the list to refill it again\n for (var i in rawTitlesSelectedRecipe) {\n var li = document.createElement(\"li\");\n li.className = \"list-group-item\";\n li.setAttribute(\"id\", \"RecipeItem\");\n var liContent = document.createTextNode(rawTitlesSelectedRecipe[i]);\n li.appendChild(liContent);\n htmlRecipeTitlesList.appendChild(li);\n }\n }", "function sortList( list ) {\n let switched = true;\n while( switched ) {\n switched = false;\n if ( list.childElementCount ) {\n // for ( let i = 0; i < list.childElementCount - 1; i++ ) {\n for ( let i = 0; i < list.childElementCount; i++ ) {\n let item = list.children[i];\n let idNumber = item.id.match( /\\d+/ )[0];\n let nextItem = list.children[i+1];\n let nextIdNumber = nextItem ? nextItem.id.match( /\\d+/ )[0] : null;\n if ( nextIdNumber && idNumber > nextIdNumber ) {\n // console.log('idNumber:', idNumber, 'nextIdNumber:', nextIdNumber);\n list.insertBefore( nextItem, item );\n switched = true;\n }\n }\n }\n }\n }", "function setList (newElements) {\n let newList = [...props.list]\n if (props.title === \"Song\") {\n newList[0] = newElements\n props.setList(newList)\n }\n else if (props.title === \"Artist\") {\n newList[1] = newElements\n props.setList(newList)\n }\n else if (props.title === \"Genre\") {\n newList[2] = newElements\n props.setList(newList)\n }\n }", "constructor(name, el, list) {\n super(name, el, \"\"); //no need to pass template you will remove and change. Use \"\"\n this._list = list;\n this.ordered = false; // another API for setting orderd or unordered\n this._refresh(\"ul\");\n }", "function createList(text) {\n var li = $(\"<li>\")\n .addClass(\"list-group-item list-group-item-action\")\n .text(text);\n $(\".cityList\").prepend(li);\n }", "add_bingo_list(filename) {\n this.bingoLists.push(filename)\n this.drawSelect()\n }", "updateListPos(updatedList) {\n if (updatedList) {\n let lists = this.state.lists;\n lists[updatedList.pos] = updatedList;\n this.setState({ lists });\n }\n }" ]
[ "0.64325327", "0.63209695", "0.6085003", "0.6051493", "0.6003027", "0.59878796", "0.59405607", "0.5909919", "0.5872056", "0.5870102", "0.58655983", "0.58530545", "0.58280504", "0.5821214", "0.581481", "0.58096063", "0.57730335", "0.57559747", "0.57337296", "0.5717342", "0.5714544", "0.5711659", "0.57111984", "0.57109004", "0.5709606", "0.56981945", "0.56805736", "0.5675702", "0.5672153", "0.56607175", "0.5651881", "0.56480926", "0.563616", "0.56340945", "0.56214917", "0.5621079", "0.5617343", "0.56091815", "0.5603032", "0.56004715", "0.5599581", "0.5594649", "0.5590343", "0.55818385", "0.5574199", "0.5563545", "0.5551462", "0.5546274", "0.5542353", "0.55234057", "0.5519799", "0.5509469", "0.5502926", "0.55013907", "0.55013406", "0.550133", "0.5494917", "0.54903257", "0.5488046", "0.54869694", "0.5484467", "0.5483857", "0.5482093", "0.5476874", "0.5476165", "0.54704314", "0.54676265", "0.54673064", "0.54653347", "0.5464106", "0.5460024", "0.54556876", "0.54524904", "0.5449086", "0.5448097", "0.54460204", "0.5443172", "0.54416865", "0.5434294", "0.54271084", "0.54231936", "0.54215395", "0.54199576", "0.5419422", "0.5415882", "0.53947735", "0.5392515", "0.53892034", "0.53756344", "0.5374822", "0.5371682", "0.5370333", "0.53695434", "0.53691316", "0.5367106", "0.5366562", "0.5365911", "0.5365889", "0.5361118", "0.5360886" ]
0.6235171
2
totaalbedrag bijwerken en toevoegen aan inputveld
function totaalBedragToevoegen(bedrag){ totaalBedrag = totaalBedrag + Number(bedrag); totaal.value = totaalBedrag; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sjekk() {\n console.log(input)\n\n //disable knappen som blir trykket\n var gjettResultat = false;\n $(\"#\"+input).attr('disabled', 'disabled');\n // var input = inpBokstav.value\n\n for(var x = 0;x<ordArray.length;x++){\n if(input == ordArray[x]){\n $('#t'+x).append(input.toUpperCase());\n gjettResultat = true;\n\n }\n}\n if(gjettResultat){sjekkSvar();}\n else{feil();}\n }", "function sjekk() {\n console.log(input)\n\n //disable knappen som blir trykket\n var gjettResultat = false;\n $(\"#\"+input).attr('disabled', 'disabled');\n // var input = inpBokstav.value\n\n for(var x = 0;x<ordArray.length;x++){\n if(input == ordArray[x]){\n $('#t'+x).append(input.toUpperCase());\n gjettResultat = true;\n\n }\n}\n if(gjettResultat){sjekkSvar();}\n else{feil();}\n }", "function voertuigToevoegen() {\n\t// 1a. ophalen van voertuig uit de textbox in de UI.\n\n\t// Stel nieuw voertuig object samen\n\tvar nieuwVoertuig = {\n\t\tmerk: document.getElementById('txtMerk').value,\n\t\tprijs: document.getElementById('txtPrijs').value,\n\t\tafbeelding: document.getElementById('txtAfbeelding').value\n\t};\n\t// Push object naar de array\n\tarrayVoertuigen.push(nieuwVoertuig);\n\n\t// 1d. Lussen over de lijst met voertuigen en nieuwe lijstItems samenstellen\n\trenderVoertuigen();\n\n\t// 1f. Tekstvak weer leeg maken voor invoeren van nieuw voertuig\n\tdocument.getElementById('txtMerk').value = '';\n\tdocument.getElementById('txtPrijs').value = '';\n\tdocument.getElementById('txtAfbeelding').value = '';\n\tdocument.getElementById('txtMerk').focus();\n} // einde voertuigToevoegen", "function pasarInput(cantidad,inicial, siguiente){\n vl=$('#'+inicial).val();\n c=vl.length\n if(c==cantidad){\n cadena=vl.split(\" \")\n $('#'+siguiente).val(cadena.pop())\n $('#'+siguiente).focus()\n nuevo=cadena.join(' ')\n $('#'+inicial).val(nuevo)\n }\n }", "function biebCodeVakvuller() {\n let codeveld = $('input[name=code]');\n let codeknop = $('<a class=\"btn genereer\" title=\"Biebcode invullen\">Genereer</a>').mousedown(function (event) {\n event.preventDefault();\n codeveld.val(\n $('select[name=categorie_id]').val() + '.' + $('input[name=auteur]').val().substring(0, 3).toLowerCase()\n ).focus();\n });\n codeveld.after(codeknop);\n }", "function updateSpeelveld() {\n\t// Maak invoerveld leeg\n\tdocument.getElementById(\"invoer\").value = \"\";\n\n\t// Zet focus terug op invoerveld\n\tdocument.getElementById(\"invoer\").focus();\n\n\t// Werk score bij, verhoog de somteller en maak een nieuwe som\n\tif (aantalGoed == 1) {\n\t\tdocument.getElementById(\"score\").innerHTML = aantalGoed + \" som goed van de \" + aantalSommen;\n\t} else {\n\t\tdocument.getElementById(\"score\").innerHTML = aantalGoed + \" sommen goed van de \" + aantalSommen;\n\t}\n\taantalSommen++;\n\tmaakSom();\n}", "function voegspelertoe(){\n\t\t\t\t\t\n\t\tvar nummer = $('.speler').length + 1;\n\t\t\n\t\t\n\t\t$( \"#verwijderspeler\" + $('.speler').length ).after( '<input class=\"sessioninput speler\" placeholder=\"Speler '+nummer+'\" type=\"text\" required=\"required\" id=\"spelernaam' + nummer + '\" name=\"deelnemer'+nummer+'\"><input type=\"button\" id=\"verwijderspeler'+nummer+'\" value=\"x\" class=\"verwijderknop\" onclick=\"verwijderspeler(deelnemer'+nummer+')\" />' );\n\t\t\n\t}", "function addto() {\n\tCW.add($(\".word input[name='trial']\").val(), $(\".word input[name='definition']\").val(), $(\".word select\").find(\":selected\").attr(\"value\"), ($(\".word input[name='horizontal']\").val() - 1), ($(\".word input[name='vertical']\").val() - 1), $(\".word input[name='symbol']\").val().toUpperCase);\t\n\t// convert value to integer\n\t$(\".alert-success span\").html(+($(\".alert-success span\").text()) + 1);\n\t$('.word')[0].reset();\n\t$(\".alert-warning\").hide()\n\t$(\".alert-success\").hide()\n\t$(\".alert-success\").toggle(\"fast\");\n\tevent.preventDefault();\n}", "function clairtxtBoxPlusEditeur(){\n document.getElementById(\"txtedNomAuteur\").value=\"\";\n document.getElementById(\"txtedPreAuteur\").value=\"\";\n document.getElementById(\"txtedNomEditeur\").value=\"\";\n // document.getElementById(\"cboxedPays\").value=0;\n document.getElementById(\"cboxedVill\").value=0;\n document.getElementById(\"txtedaddClas\").value=\"\";\n document.getElementById(\"txtedaddFami\").value=\"\";\n}// end clairtxtBoxPlusEditeur()", "function TipoDescuento3(){\n //recuperamos el valor descuento 3 anterior\n var descuento3=document.getElementById(\"tipo_des3\").value;\n \n //recuperamos el sueldo neto del input\n var SueldoNeto=document.getElementById('sueldoNeto').value;\n //si anteriormente ya tenia un valor, debe reestablecer\n if(descuento3 > 0)\n {\n var suma=parseFloat(SueldoNeto) + parseFloat(descuento3);\n document.getElementById(\"sueldoNeto\").value=suma;\n }\n \n var monto= document.getElementById('tipoDescuento3').value;\n document.getElementById(\"tipo_des3\").value=monto;\n //Actualiza el neto a cobrar\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n document.getElementById(\"sueldoNeto\").value=SaldoNeto-monto;\n \n //codigo de descuento la cual guardaremos\n var posicion=document.getElementById('tipodescuento3').options.selectedIndex;\n var codigoDescuento3=document.getElementById('tipodescuento3').options[posicion].value;\n document.getElementById(\"cod_des3\").value=codigoDescuento3;\n //guardamos el valor de salario neto(esto se actualizara con cada descuento)\n var sueldoneto=document.getElementById('sueldoNeto').value;\n document.getElementById(\"sal_neto\").value=sueldoneto;\n }", "function TipoDescuento4(){\n //recuperamos el valor descuento 4 anterior\n var descuento4=document.getElementById(\"tipo_des4\").value;\n \n //recuperamos el sueldo neto del input\n var SueldoNeto=document.getElementById('sueldoNeto').value;\n //si anteriormente ya tenia un valor, debe reestablecer\n if(descuento4 > 0)\n {\n var suma=parseFloat(SueldoNeto) + parseFloat(descuento4);\n document.getElementById(\"sueldoNeto\").value=suma;\n }\n \n var monto= document.getElementById('tipoDescuento4').value;\n document.getElementById(\"tipo_des4\").value=monto;\n //Actualiza el neto a cobrar\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n document.getElementById(\"sueldoNeto\").value=SaldoNeto-monto;\n \n //codigo de descuento la cual guardaremos\n var posicion=document.getElementById('tipodescuento4').options.selectedIndex;\n var codigoDescuento4=document.getElementById('tipodescuento4').options[posicion].value;\n document.getElementById(\"cod_des4\").value=codigoDescuento4;\n //guardamos el valor de salario neto(esto se actualizara con cada descuento)\n var sueldoneto=document.getElementById('sueldoNeto').value;\n document.getElementById(\"sal_neto\").value=sueldoneto;\n }", "function setInput()\n{\n\tvar commande=\"\";\n\tfor(i=0;i<userpanier.length;i++){\n\t\tcommande+=`\n\t\t<input type=\"hidden\" name=\"idproduct`+i+`\" value=\"`+userpanier[i].id+`\"/>\n\t\t<input type=\"hidden\" name=\"qteproductqte`+i+`\" value=\"`+userpanier[i].qte+`\"/>\n\t\t<input type=\"hidden\" name=\"prixproduct`+i+`\" value=\"`+userpanier[i].prix+`\"/>`;\n\n\t}\n\n\tif(userpanier.length>0){\n\t\ttotal=calculertotal();\n\tcommande+=`\n\t\t<input type=\"hidden\" name=\"products\" value=\"`+userpanier.length+`\"/>\n\t\t<input type=\"hidden\" name=\"prixtotal\" value=\"`+total+`\"/>`;\n\t\t\n\t}\n\t\n (document.querySelector(\"#cmdvalider\")).innerHTML=commande;\n\n}", "function upisDoleFunc()\n{\n\n\tif (brojBacanja === 0)\n\t\treturn;\n\n\tif (indNajave > 0)\n\t{\n\t\talert(\"Igrali ste najavu!\")\n\t\treturn;\n\t}\n\t/* get the value of the field clicked */\n\tvar vred = Number(this.id.slice(1, ));\n\n\t/* see if the previous field is not -1 */\n\t/* else disable writting to preserve order */\n\tif(vred > 1 && kDole[vred-2] < 0)\n\t{\n\t\talert(\"Nedozvoljen upis!\");\n\t\treturn;\n\t}\n\n\t/* did we already write into this field */\n\tif(kDole[vred-1] >= 0)\n\t{\n\t\talert(\"Vec ste upisali u ovo polje!\");\n\t\treturn;\n\t}\n\tvar tmp = 0;\n\n\tvar tmpNiz = [];\n\n\t/* splice izabraneKockice and baceneKockice */\n\tfor(var i=0; i<5; ++i)\n\t{\n\t\t/* if innerText is a number add it to tmpNiz */\n\t\tif (Number(izabraneKockice[i].innerText))\n\t\t\ttmpNiz.push(Number(izabraneKockice[i].innerText));\n\t}\n\n\tfor(var i=0; i<5; ++i)\n\t{\n\t\t/* if innerText is a number add it to tmpNiz */\n\t\tif (Number(baceneKockice[i].innerText))\n\t\t\ttmpNiz.push(Number(baceneKockice[i].innerText));\n\t}\n\n\tif(tmpNiz.length != 5)\n\t\talert(\"Niz nije 5! vec: \" + tmpNiz.length);\n\n\t/* decide which field was clicked: broj, maxmin ili igra */\n\tswitch(vred)\n\t{\n\t\tcase 1:\n\t\tcase 2:\n\t\tcase 3:\n\t\tcase 4:\n\t\tcase 5:\n\t\tcase 6:\n\t\t\tfor(var i=0; i<5; ++i)\n\t\t\t{\n\t\t\t\tif(tmpNiz[i] == vred)\n\t\t\t\t\ttmp += tmpNiz[i]\n\t\t\t}\n\t\t\t/* write the sum into coresponding header */\n\t\t\tkDole[vred-1] = tmp;\n\t\t\tsumaKolFunc(kDole, \"suma1\");\n\t\t\tbreak;\n\t\tcase 7:\n\t\tcase 8:\n\t\t\ttmp = zbir(tmpNiz);\n\t\t\tkDole[vred-1] = tmp;\n\t\t\tsumaRazFunc(kDole, \"suma5\")\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\ttmp = jelFul(tmpNiz);\n\t\t\tkDole[vred-1] = tmp;\n\t\t\tsumaIgFunc(kDole, \"suma9\");\n\t\t\tbreak;\n\t\tcase 10:\n\t\t\ttmp = jelPoker(tmpNiz);\n\t\t\tkDole[vred-1] = tmp;\n\t\t\tsumaIgFunc(kDole, \"suma9\");\n\t\t\tbreak;\n\t\tcase 11:\n\t\t\ttmp = jelKenta(tmpNiz);\n\t\t\tkDole[vred-1] = tmp;\n\t\t\tsumaIgFunc(kDole, \"suma9\");\n\t\t\tbreak;\n\t\tcase 12:\n\t\t\ttmp = jelYamb(tmpNiz);\n\t\t\tkDole[vred-1] = tmp;\n\t\t\tsumaIgFunc(kDole, \"suma9\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\t/* write number of vred thrown */\n\tdocument.getElementById(this.id).innerText=Number(tmp);\n\n\tresetuj(izabraneKockice, baceneKockice);\n\n}", "function TipoDescuento2(){\n //recuperamos el valor descuento 2 anterior\n var descuento2=document.getElementById(\"tipo_des2\").value;\n \n //recuperamos el sueldo neto del input\n var SueldoNeto=document.getElementById('sueldoNeto').value;\n //si anteriormente ya tenia un valor, debe reestablecer\n if(descuento2 > 0)\n {\n var suma=parseFloat(SueldoNeto) + parseFloat(descuento2);\n document.getElementById(\"sueldoNeto\").value=suma;\n }\n var monto= document.getElementById('tipoDescuento2').value;\n document.getElementById(\"tipo_des2\").value=monto;\n //Actualiza el neto a cobrar\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n document.getElementById(\"sueldoNeto\").value=SaldoNeto-monto;\n \n //codigo de descuento la cual guardaremos\n var posicion=document.getElementById('tipodescuento2').options.selectedIndex;\n var codigoDescuento2=document.getElementById('tipodescuento2').options[posicion].value;\n document.getElementById(\"cod_des2\").value=codigoDescuento2;\n //guardamos el valor de salario neto(esto se actualizara con cada descuento)\n var sueldoneto=document.getElementById('sueldoNeto').value;\n document.getElementById(\"sal_neto\").value=sueldoneto;\n }", "_saveVocab() {\n let deutsch = document.querySelector(\".deutsch\").value;\n let englisch = document.querySelector(\".englisch\").value;\n let notiz = document.querySelector(\".notiz\").value;\n\n if (deutsch != \"\" || englisch != \"\"){\n\n // zurück zu input!!\n\n this._vokabeln.saveNew({\n deutsch: deutsch,\n englisch: englisch,\n notiz: notiz,\n //format: html,\n });\n\n // aus JS auf andere Seite leiten\n this._app.showVocabularyOverview();\n this._app.navigate(\"/\");\n\n } else {\n alert(\"Bitte alle Angaben ausfüllen!♥\");\n }\n }", "function treciOdgovor(){\n\tif (document.getElementById('drPitZato')) {\n\t\tvar $trOdg = document.getElementById('drPitZato').value.toLowerCase();\n\t\tif ($trOdg.indexOf('ne') !== -1) { \n\t\t\tdocument.getElementById('odgovor3').innerHTML='<h3>A ti nemoj?</h3>';\n\t\t}\n\t\telse if ($trOdg.indexOf('da') !== -1) {\n\t\t\tdocument.getElementById('odgovor3').innerHTML='<h3>E pa muči se onda i dalje!</h3>';\n\n\t\t}\n\t\telse {\n\t\t\tdocument.getElementById('odgovor3').innerHTML='<p>Ne razumem odgovor: da ili ne?</p><input type=\"text\" id=\"drPitZato\" value=\"\" placeholder=\"\"><button type=\"submit\" onclick=\"treciOdgovor();\">Submit</button>';\n\n\t\t};\n\t}\n\telse if (document.getElementById('drPitEto')) {\n\t\tvar $trOdg = document.getElementById('drPitEto').value.toLowerCase();\n\t\tif ($trOdg.indexOf('ne') !== -1) { \n\t\t\tdocument.getElementById('odgovor3').innerHTML='<h3>Onda smisli razlog!</h3>';\n\t\t}\n\t\telse if ($trOdg.indexOf('da') !== -1) {\n\t\t\tdocument.getElementById('odgovor3').innerHTML='<h3>Razumemo se!</h3>';\n\n\t\t}\n\t\telse {\n\t\t\tdocument.getElementById('odgovor3').innerHTML='<p>Ne razumem odgovor: da ili ne?</p><input type=\"text\" id=\"drPitEto\" value=\"\" placeholder=\"\"><button type=\"submit\" onclick=\"treciOdgovor();\">Submit</button>';\n\n\t\t};\n\t}\n\n\telse if (document.getElementById('drPitMenja')) {\n\t\tvar $trOdg = document.getElementById('drPitMenja').value.toLowerCase();\n\t\tif ($trOdg.indexOf(',') !== -1) { \n\t\t\tdocument.getElementById('odgovor3').innerHTML='<h3>Evo, prosledićemo listu Vladi!</h3>';\n\t\t}\n\t\telse if (($trOdg.indexOf('nista') !== -1) || ($trOdg.indexOf('ništa') !== -1) || ($trOdg.indexOf('ne znam') !== -1)) {\n\t\t\tdocument.getElementById('odgovor3').innerHTML='<h3>Malo bi, a malo ne bi, a?</h3>';\n\n\t\t}\n\t\telse {\n\t\t\tdocument.getElementById('odgovor3').innerHTML='<h3>Pa reci Vladi, možda može da promeni!</h3>';\n\n\t\t};\n\n\t}\n\t\n\telse {\n\t\tvar $trOdg = document.getElementById('drPitDoma').value.toLowerCase();\n\t\tif (($trOdg.indexOf('radim') !== -1) && ($trOdg.indexOf('ne') == -1)) { \n\t\t\tdocument.getElementById('odgovor3').innerHTML=\"<h3>Izvin'te, moja greška!</h3>\";\n\t\t}\n\t\telse if (($trOdg.indexOf('nemam vremena') !== -1) || ($trOdg.indexOf('koji') !== -1) || ($trOdg.indexOf('ne znam') !== -1)) {\n\t\t\tdocument.getElementById('odgovor3').innerHTML='<h3>Hajde, nema zabušavanja!</h3>';\n\n\t\t}\n\t\telse {\n\t\t\tdocument.getElementById('odgovor3').innerHTML='<p>Ne razumem odgovor, pojasni mi.</p><input type=\"text\" id=\"drPitDoma\" value=\"\" placeholder=\"\"><button type=\"submit\" onclick=\"treciOdgovor();\">Submit</button>';\n\n\t\t};\n\n\t}\n}", "function TipoDescuento1(){\n //recuperamos el valor descuento 1 anterior\n var descuento1=document.getElementById(\"tipo_des1\").value;\n \n //recuperamos el sueldo neto del input\n var SueldoNeto=document.getElementById('sueldoNeto').value;\n //si anteriormente ya tenia un valor, debe reestablecer\n if(descuento1 > 0)\n {\n var suma=parseFloat(SueldoNeto) + parseFloat(descuento1);\n document.getElementById(\"sueldoNeto\").value=suma;\n }\n\n //el valor que se ingreso en monto\n var monto= document.getElementById('tipoDescuento1').value;\n document.getElementById(\"tipo_des1\").value=monto;\n //Actualiza el neto a cobrar\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n document.getElementById(\"sueldoNeto\").value=SaldoNeto-monto;\n \n //codigo de descuento la cual guardaremos\n var posicion=document.getElementById('tipodescuento1').options.selectedIndex;\n var codigoDescuento1=document.getElementById('tipodescuento1').options[posicion].value;\n document.getElementById(\"cod_des1\").value=codigoDescuento1;\n \n //guardamos el valor de salario neto(esto se actualizara con cada descuento)\n var sueldoneto=document.getElementById('sueldoNeto').value;\n document.getElementById(\"sal_neto\").value=sueldoneto;\n }", "function cambiamenu(){\n\n\t\t\tseleccionado=form1.epsnueva.selectedIndex;\n\t\t\tp = form1.epsnueva[form1.epsnueva.selectedIndex].value;\n \t\tt = form1.epsnueva[form1.epsnueva.selectedIndex].text;\n\t\t\ttextoseleccionado=\"\"+p+\"-\"+t;\n\t\t\tcodigoseleccionado=p;\n\n\t\t\t//alert(\"\"+p+\"-\"+t);\n\t\t\testadoclick=true;\t\t\n}", "addAllergie(e){\n e.preventDefault()\n var input= document.createElement('input')\n input.setAttribute('class','input')\n input.setAttribute('placeholder', \"Allergie\")\n\n document.getElementById('allergies').appendChild(input)\n }", "function aggiungiIng(){\r\n\r\n\t\tvar i=0;\r\n\t\t//ciclo che mi aumenta la varaibile per cambaire i nomi degli ingredienti\r\n\t\twhile(document.getElementById(\"insIng\"+i)){\r\n\t\t\t\ti++;\r\n\t\t}\r\n\t\ti--;\r\n\t\tvar div = document.getElementById(\"insIng\"+i);\r\n\t\tvar ingr = \"ingrediente\"+i;\r\n\t\tvar quant = \"quantita\"+i;\r\n\t\tvar unit = \"unita\"+i;\r\n\t\tdiv.innerHTML +=\"<label for=\\\"\"+ingr+\"\\\">Ingrediente \"+(i+1)+\": </label>\"+\r\n\t\t\t\t\"<input type=\\\"text\\\" name=\\\"\"+ingr+\"\\\" id=\\\"\"+ingr+\"\\\" class=\\\"ingrediente\\\" size=\\\"20\\\" tabindex=\\\"\"+(tabindex++)+\"\\\" />\"+\r\n\t\t\t\t\"<label for=\\\"\"+quant+\"\\\"> Quantità: </label>\"+\r\n\t\t\t\t\"<input type=\\\"text\\\" name=\\\"\"+quant+\"\\\" id=\\\"\"+quant+\"\\\" size=\\\"5\\\" tabindex=\\\"\"+(tabindex++)+\"\\\"/>\"+\r\n\t\t\t\t\"<label for=\\\"\"+unit+\"\\\"> Unità di misura: </label>\"+\r\n\t\t\t\t\"<select name=\\\"\"+unit+\"\\\" id=\\\"\"+unit+\"\\\" tabindex=\\\"\"+(tabindex++)+\"\\\">\"+\r\n\t\t\t\t\t\t\"<option value=\\\"Non specificata\\\">Non specificata</option>\"+\r\n\t\t\t\t\t\t\"<option value=\\\"g\\\">g</option>\"+\r\n\t\t\t\t\t\t\"<option value=\\\"hg\\\">hg</option>\"+\r\n\t\t\t\t\t\t\"<option value=\\\"kg\\\">kg</option>\"+\r\n\t\t\t\t\t\t\"<option value=\\\"ml\\\">ml</option>\"+\r\n\t\t\t\t\t\t\"<option value=\\\"dl\\\">dl</option>\"+\r\n\t\t\t\t\t\t\"<option value=\\\"l\\\">l</option>\"+\r\n\t\t\t\t\t\t\"<option value=\\\"Cucchiaio\\\">Cucchiaio</option>\"+\r\n\t\t\t\t\t\t\"<option value=\\\"Cucchiaino\\\">Cucchiaino</option>\"+\r\n\t\t\t\t\t\t\"<option value=\\\"Tazzina\\\">Tazzina</option>\"+\r\n\t\t\t\t\"</select></div><div id='insIng\"+(i+1)+\"'>\";\r\n\t\treturn false;\r\n}", "function contOp(){\r\n document.getElementById(\"penny\").value = document.getElementById(\"pennyNew\").value;\r\n document.getElementById(\"nickel\").value = document.getElementById(\"nickelNew\").value;\r\n document.getElementById(\"dime\").value = document.getElementById(\"dimeNew\").value;\r\n document.getElementById(\"quarter\").value = document.getElementById(\"quarterNew\").value;\r\n document.getElementById(\"one\").value = document.getElementById(\"oneNew\").value;\r\n document.getElementById(\"five\").value = document.getElementById(\"fiveNew\").value;\r\n document.getElementById(\"ten\").value = document.getElementById(\"tenNew\").value;\r\n document.getElementById(\"twenty\").value = document.getElementById(\"twentyNew\").value;\r\n document.getElementById(\"oneHundred\").value = document.getElementById(\"oneHundredNew\").value;\r\n}", "function cargarNumero() {\n document.getElementById(\"incognita\").value = incognita;\n}", "function pridedamVerteIMasyva() {\n komentaruMasyvas.push(document.getElementById(\"inputas\").value);\n komentaruMasyvas.shift();\n}", "function SeverChanged(obj){\n\tvar inputcard = document.getElementById('inputname');\n\tvar value = obj.value;\n\tif (value === ''){\n\t\tinputname.innerHTML = ' ';\n\t} else {\n\t\tinputname.innerHTML = ' </li> <li> <div class=\"item-content\"> <div class=\"item-inner\"> <div class=\"item-input item-input-field\"> <input type=\"text\" name=\"Tennv\" placeholder=\"Tên nhân vật\" class=\"input\" id=\"code_card\"> </div> </div> </div>';\n\t}\n\n}", "function toChangeNeumeData(){\n currentNeumeIndex = 0;\n document.getElementById(\"input\").innerHTML = neumeDataChangeForm();\n}", "function szamol(szam){\r\n\tif (szam==1){\r\n\t\tosszeg=ido*ar/letsz;\r\n\t\tconsole.log(osszeg);\r\n\t\t//xd1.value=osszeg*1;\r\n\t\tdocument.getElementById(\"fk\").value=osszeg;\r\n\t}\r\n\telse if (szam==2){\r\n\t\tosszeg=ido1*ar1/letsz1;\r\n\t\t//xd2.value=osszeg;\r\n\t}\r\n\telse if (szam==3){\r\n\t\tosszeg=ido2*ar2/letsz2;\r\n\t\t//xd3.value=osszeg;\r\n\t}\r\n\t\r\n}", "function lireInput ()\n{\n\tobjetLongueur = document.getElementById(\"longueur\");\n\tobjetLargeur = document.getElementById(\"largeur\");\n\tobjetHauteur = document.getElementById(\"hauteur\");\n\n\ttexteLongueur = objetLongueur.value;\n\ttexteLargeur = objetLargeur.value;\n\ttexteHauteur = objetHauteur.value;\n\n\tnombreLongueur = parseFloat(texteLongueur);\n\tnombreLargeur = parseFloat(texteLargeur);\n\tnombreHauteur = parseFloat(texteHauteur);\n\n}", "function applyCurrentNeume(){\n currentNeumeIndex = document.getElementById(\"neume\").value;\n document.getElementById(\"input\").innerHTML = neumeDataChangeForm();\n}", "function DescuentoJudicial(){ \n //obtiene el valor anterior de sal_jud\n var sal_jud=document.getElementById(\"sal_jud\").value\n //valor del input de sueldo neto\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n //si anteriormente ya tenia un valor restaura ante cambios del operador\n if(sal_jud > 0)\n {\n var suma=parseFloat(SaldoNeto) + parseFloat(sal_jud);\n document.getElementById(\"sueldoNeto\").value=suma;\n }\n //valor del input del descuento judicial\n var monto= document.getElementById('inputJudicial').value;\n //el nuevo valor de Saldo Neto\n var SaldoNeto= document.getElementById(\"sueldoNeto\").value;\n document.getElementById(\"sueldoNeto\").value=(SaldoNeto-monto);\n document.getElementById(\"sal_jud\").value=monto;\n //guardamos el valor de salario neto(esto se actualizara con cada descuento)\n var sueldoneto=document.getElementById('sueldoNeto').value;\n document.getElementById(\"sal_neto\").value=sueldoneto;\n \n }", "function getInputText(){\n var e = document.getElementById('mat');\n var opt = e.options[e.selectedIndex];\n var titlu = document.getElementById('titlu').value;\n var ul = document.getElementById(\"listaAdauga\");\n var items = ul.getElementsByTagName(\"li\");\n var text1 = ul.getElementsByTagName(\"h5\");\n var text2 = ul.getElementsByTagName(\"h6\");\n var ok = 0\n for (var i = 0; i < items.length && ok==0; i++){\n var content = text2[i].textContent;\n if(titlu == text1[i].textContent && opt.textContent == content.slice(1,content.length - 1))\n ok=1;\n }\n\n if(ok == 0 && titlu != \"\" && opt.textContent!=\"Alege materia\"){\n $(\"#listaAdauga\").append(\"<li><h5>\"+titlu+\"</h5><h6>(\"+opt.textContent+\")</h6></li>\");\n }\n else\n alert(\"Nu ai introdus bine datele sau proiectul deja exista!\");\n }", "function createText(){\n\t\t//variablen erhalten Werte aus Eingabeboxen\n var input_name = document.getElementById(\"name\");\n var input_number = document.getElementById(\"number\");\n var input_thing = document.getElementById(\"thing\");\n var output = document.getElementById(\"loesung\");\n output.innerHTML = (input_name.value +\" \"+ input_number.value +\" \"+ input_thing.value);\n\n\n\n\n}", "function listarMetodo(){\n\n var listaMetodo = \"\";\n\n if ($(\"#nuevoMetodoPago\").val() == \"Efectivo\") {\n\n $(\"#listaMetodoPago\").val(\"Efectivo\");\n\n }else{\n\n $(\"#listaMetodoPago\").val($(\"#nuevoMetodoPago\").val()+\"-\"+$(\"#NuevoCodigoTransaccion\").val());\n\n }\n}", "function BestellungPruefen() {\r\n let kontrolle = [\"Bitte folgende Eingaben ueberpruefen! \\n\"];\r\n //Name\r\n let nachname = document.getElementById(\"Nachname\");\r\n if (nachname.validity.valid == false) {\r\n kontrolle.push(\"Name \\n\");\r\n nachname.style.backgroundColor = \"#FA5858\";\r\n }\r\n else {\r\n nachname.style.backgroundColor = \"white\";\r\n }\r\n //Vorname\r\n let vorname = document.getElementById(\"Vorname\");\r\n if (vorname.validity.valid == false) {\r\n kontrolle.push(\"Vorname \\n\");\r\n vorname.style.backgroundColor = \"#FA5858\";\r\n }\r\n else {\r\n vorname.style.backgroundColor = \"white\";\r\n }\r\n //Straße\r\n let strasse = document.getElementById(\"Strasse\");\r\n if (strasse.validity.valid == false) {\r\n kontrolle.push(\"Strasse \\n\");\r\n strasse.style.backgroundColor = \"#FA5858\";\r\n }\r\n else {\r\n strasse.style.backgroundColor = \"white\";\r\n }\r\n //Ort, PLZ\r\n let ortUndPostleitzahl = document.getElementById(\"Ort,PLZ\");\r\n if (ortUndPostleitzahl.validity.valid == false) {\r\n kontrolle.push(\"Ort, PLZ \\n\");\r\n ortUndPostleitzahl.style.backgroundColor = \"#FA5858\";\r\n }\r\n else {\r\n ortUndPostleitzahl.style.backgroundColor = \"white\";\r\n }\r\n //Email\r\n let eMail = document.getElementById(\"Email\");\r\n if (eMail.validity.valid == false) {\r\n kontrolle.push(\"Email \\n\");\r\n eMail.style.backgroundColor = \"#FA5858\";\r\n }\r\n else {\r\n eMail.style.backgroundColor = \"white\";\r\n }\r\n let eiskugeln = 0;\r\n for (let i = 0; i < inputsSorten.length; i++) {\r\n if (parseInt(inputsSorten[i].value) > 0)\r\n eiskugeln += 1;\r\n }\r\n if (eiskugeln == 0)\r\n kontrolle.push(\"sorten\\n\");\r\n let extras = 0;\r\n for (let i = 0; i < inputsExtras.length; i++) {\r\n if (inputsExtras[i].checked)\r\n extras += 1;\r\n }\r\n if (extras == 0)\r\n kontrolle.push(\"extra\\n\");\r\n let behaeltnis = 0;\r\n for (let i = 0; i < inputsBehaeltnis.length; i++) {\r\n if (inputsBehaeltnis[i].checked)\r\n behaeltnis += 1;\r\n }\r\n if (behaeltnis == 0)\r\n kontrolle.push(\"behaelter\");\r\n if (kontrolle.length > 0) {\r\n for (let i = 0; i < kontrolle.length; i++)\r\n kontrolle.push;\r\n alert(kontrolle.join(\"\"));\r\n }\r\n else {\r\n alert(\"Vielen Dank fuer Ihre Bestellung! :)\");\r\n }\r\n }", "function touchespls() {\n\tif (num[10]==true){\n\t\twindow.document.calculatrice.affiche.value = \n\t\twindow.document.calculatrice.affiche.value + \"+\";\n\t\tverif = true;\n\t} else {\n\t\twindow.document.calculatrice.affiche.value = \n\t\twindow.document.calculatrice.affiche.value + \"\";\n\t}\n}", "function clairtxtBoxAmEdi(){\n document.getElementById(\"txtedNomEditeur\").value = \"\";\n // document.getElementById(\"cboxedPays\").value = 0;\n document.getElementById(\"cboxedVill\").value = 0;\n} // end clairtxtBoxAmEdi()", "function bersih_pembiayaan(){\r\n $('#nomor_anggota_pembiayaan').val('');\r\n $('#nama_anggota_pembiayaan').val('');\r\n $('#jenis_pembiayaan').val('--pilih--');\r\n }", "function listarMetodosC(){\n\n let listaMetodosC = \"\";\n if($(\"#nuevoMetodoPagoC\").val()==\"Efectivo\"){\n\n $(\"#listaMetodoPagoC\").val(\"Efectivo\");\n }else{\n $(\"#listaMetodoPagoC\").val($(\"#nuevoMetodoPagoC\").val() + \"-\" + $(\"#nuevoCodigoTransaccionC\").val());\n }\n}", "function upisSlobFunc()\n{\n\n\tif (brojBacanja === 0)\n\t\treturn;\n\n\tif (indNajave > 0)\n\t{\n\t\talert(\"Igrali ste najavu!\")\n\t\treturn;\n\t}\n\n\t/* get the value of the field clicked */\n\tvar vred = Number(this.id.slice(1, ));\n\n\t///* see if the previous field is not -1 */\n\t///* else disable writting to preserve order */\n\t//if(vred > 1 && kDole[vred-2] < 0)\n\t//{\n\t//\talert(\"Nedozvoljen upis!\");\n\t//\treturn;\n\t//}\n\t\n\t/* did we already write into this field */\n\tif(kSlob[vred-1] >= 0)\n\t{\n\t\talert(\"Vec ste upisali u ovo polje!\");\n\t\treturn;\n\t}\n\n\tvar tmp = 0;\n\tvar tmpNiz = [];\n\n\t/* splice izabraneKockice and baceneKockice */\n\tfor(var i=0; i<5; ++i)\n\t{\n\t\tif (Number(izabraneKockice[i].innerText))\n\t\t\ttmpNiz.push(Number(izabraneKockice[i].innerText));\n\t}\n\n\tfor(var i=0; i<5; ++i)\n\t{\n\t\tif (Number(baceneKockice[i].innerText))\n\t\t\ttmpNiz.push(Number(baceneKockice[i].innerText));\n\t}\n\n\tif(tmpNiz.length != 5)\n\t\talert(\"Niz nije 5! vec: \" + tmpNiz.length);\n\n\t/* decide which field was clicked: broj, maxmin ili igra */\n\tswitch(vred)\n\t{\n\t\tcase 1:\n\t\tcase 2:\n\t\tcase 3:\n\t\tcase 4:\n\t\tcase 5:\n\t\tcase 6:\n\t\t\tfor(var i=0; i<5; ++i)\n\t\t\t{\n\t\t\t\tif(tmpNiz[i] == vred)\n\t\t\t\t\ttmp += tmpNiz[i]\n\t\t\t}\n\t\t\tkSlob[vred-1] = tmp;\n\t\t\tsumaKolFunc(kSlob, \"suma2\");\n\t\t\tsumaRazFunc(kSlob, \"suma6\")\n\t\t\tbreak;\n\t\tcase 7:\n\t\tcase 8:\n\t\t\ttmp = zbir(tmpNiz);\n\t\t\tkSlob[vred-1] = tmp;\n\t\t\tsumaRazFunc(kSlob, \"suma6\")\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\ttmp = jelFul(tmpNiz);\n\t\t\tkSlob[vred-1] = tmp;\n\t\t\tsumaIgFunc(kSlob, \"suma10\");\n\t\t\tbreak;\n\t\tcase 10:\n\t\t\ttmp = jelPoker(tmpNiz);\n\t\t\tkSlob[vred-1] = tmp;\n\t\t\tsumaIgFunc(kSlob, \"suma10\");\n\t\t\tbreak;\n\t\tcase 11:\n\t\t\ttmp = jelKenta(tmpNiz);\n\t\t\tkSlob[vred-1] = tmp;\n\t\t\tsumaIgFunc(kSlob, \"suma10\");\n\t\t\tbreak;\n\t\tcase 12:\n\t\t\ttmp = jelYamb(tmpNiz);\n\t\t\tkSlob[vred-1] = tmp;\n\t\t\tsumaIgFunc(kSlob, \"suma10\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\t/* write number of vred thrown */\n\tdocument.getElementById(this.id).innerText=Number(tmp);\n\n\tresetuj(izabraneKockice, baceneKockice);\n}", "function czyszczenie() {\n document.getElementById('spr').value = \"\";\n document.getElementById('odpowiedz').innerHTML = \"\";\n document.getElementById('obliczono').innerHTML = \"\";\n document.getElementById('opinia').innerHTML = \"\";\n document.getElementById('rand').innerHTML = \"\";\n document.getElementById(\"licznik\").innerHTML = \"\";\n licznikKulek = 0;\n}", "function inseriscitabella(){\r\n \"use strict\";\r\n var nome = document.getElementsByClassName(\"nomelista\")[1].value;\r\n var quanto = document.getElementsByClassName(\"quantolista\")[1].value;\r\n for(var j=0; j<ingredientim.length; j++){\r\n if(nome === ingredientim[j].nome){\r\n document.getElementsByClassName(\"nomelista\")[1].value = \"\";\r\n document.getElementsByClassName(\"quantolista\")[1].value = \"\";\r\n scrivirisultato(\"ingrediente già presente\");\r\n Fallimento();\r\n return false;\r\n }\r\n }\r\n if (quanto < 0) {\r\n scrivirisultato(\"Attenzione, quantità negativa\");\r\n Fallimento();\r\n document.getElementsByClassName(\"quantolista\")[1].value = \"\";\r\n return false;\r\n }\r\n if (quanto == \"\") {\r\n scrivirisultato(\"ingrediente quantità non inserita\");\r\n Fallimento();\r\n return false;\r\n }\r\n if (nome == \"\") {\r\n scrivirisultato(\"Nome non inserito\");\r\n Fallimento();\r\n return false;\r\n } else {\r\n var xmlhttp;\r\n if (xmlhttp = CreaRichiesta()) {\r\n xmlhttp.onreadystatechange = function () {\r\n if (this.readyState == 4 && this.status == 200) {\r\n var result = JSON.parse(this.responseText);\r\n if (result.Error) {\r\n scrivirisultato(result.Error);\r\n Fallimento();\r\n return false;\r\n } else {\r\n var ingr = {nome: nome, quanto: quanto, id: result.id, prezzo: result.prezzo};\r\n ingredientim.push(ingr);\r\n var tabella = document.getElementById(\"mostraingredienti\");\r\n var input = document.createElement(\"INPUT\");\r\n input.value = quanto;\r\n input.className = \"modificaquanto\";\r\n input.type = \"number\";\r\n CreaRiga(tabella,document.createTextNode(nome) ,\r\n document.createTextNode(result.fornitore), document.createTextNode(result.prezzo) , input );\r\n cambiato = 1;\r\n }\r\n document.getElementsByClassName(\"nomelista\")[1].value = \"\";\r\n document.getElementsByClassName(\"quantolista\")[1].value = \"\";\r\n }\r\n };\r\n xmlhttp.open(\"GET\", \"php/VerificaIngrediente.php?nome=\" + nome, true);\r\n xmlhttp.send();\r\n }\r\n }\r\n}", "function checkAntwoord() {\n\t// Lees antwoord uit\n\tvar gegevenAntwoord = document.getElementById(\"invoer\").value;\n\tif (gegevenAntwoord == antwoord) {\n\t\taantalGoed++;\n\t\tdocument.getElementById(\"feedback\").innerHTML = \"<br>Goedzo!<br>Maak de volgende som.\";\n\t} else {\n\t\tdocument.getElementById(\"feedback\").innerHTML = \"<br>Helaas! Het goede antwoord van \" \n\t\t+ getal1 + \" x \" + getal2 + \" is \" + antwoord + \"<br>Maak de volgende som.\";\n\t}\n\t// Werk speelveld bij\n\tupdateSpeelveld();\n}", "function suma_cantidad(e){\r\n const suma_input = e.target;\r\n const tr = suma_input.closest(\".item_carrito\");\r\n const titulo = tr.querySelector('.tabla_titulo').textContent;\r\n carrito.forEach(item => {\r\n if(item.nombre.trim() === titulo){\r\n suma_input.value < 1 ? (suma_input.value = 1): suma_input.value;\r\n item.cantidad = suma_input.value;\r\n total_carrito();\r\n };\r\n });\r\n}", "function wertEingeben() {\r\n\tvar anzahl = document.getElementById(\"anzahl\").value;\r\n\tvar multi = document.getElementById(\"multi\").value;\r\n\tshowNumbers(anzahl, multi);\r\n\t\r\n}", "function mostrarIngreso() {\n document.getElementById(\"ingreso\").innerHTML = \"Ingresaste el siguiente dato: \" + document.getElementById(\"input\").value;\n }", "function lireInput()\n{\n\t//RECUPERER L'OBJET QUI REPRESENTE LA BALISE <input id=\"nbrColonnes\">\n\tobjetInput = document.getElementById(\"nbrColonnes\");\n\t//LIT LE TEXTE ENTRE PAR L'UTILISATEUR\n\ttexteInput = objetInput.value;\n\t//CONVERTIR LE TEXTE EN NOMBRE ENTIER\n\tnbrColonnes = parseInt(texteInput);\n\t//CARRE\n\tnbrLignes = nbrColonnes;\n\t//LE CARRE\n\tnbrCase = nbrColonnes * nbrLignes;\n}", "function sin_ceros(e) {\n var id = e.currentTarget.id;\n var valor = e.currentTarget.value;\n\tif (valor[0] == 0) {\n\t\tif (valor.length == 1) {\n\t\t\t$(\"#\" + id).val('1');\n\t\t} else {\n\t\t\tvalor = valor.substring(1)\n\t\t\t$(\"#\" + id).val(valor);\n\t\t\tsin_ceros(e);\n\t\t}\n\t}\n}", "function hola(uno)\n\t {\n\t\t document.getElementById(\"ideart\").value=uno;\n\t\t //alert(uno);\n\t }", "function multi(){\n let ergebnis = document.getElementById(\"Nummer\").value * 2;\n document.getElementById(\"Ergebnis\").innerHTML = ergebnis;\n}", "function Plansza(opis)\r\n{\r\n var i;\r\n plansza = \"<table class='table'><tbody>\";\r\n for(i = 0; i < opis.length; i++)\r\n {\r\n if (i % 9 == 0) plansza += \"<tr>\";\r\n plansza += \"<td class='field' id='td\"+ wspolrzedne(i) +\"'>\";\r\n if (opis[i] == '0') {\r\n plansza += \"<input type='text' class='input-mini' maxlength='1' id='i\" + wspolrzedne(i) + \"' onFocus='ustawId(this)' onkeypress='return isNumberKey(event)'>\";\r\n } else {\r\n plansza += \"<input type='text' class='input-mini' maxlength='1' readonly= '' id='i\" + wspolrzedne(i) + \"' value='\"+opis[i]+\"'>\";\r\n }\r\n plansza += \"</td>\";\r\n if (i % 9 == 8) plansza += \"</tr>\";\r\n }\r\n return plansza+\"</tbody></table>\";\r\n}", "function ohodnot(frm)\r\n{\r\n\t// \r\n\t// nazov class pomocou ktorej sa hladaju input elementy\r\n\tvar MOZNOST_CLASS_NAME = 'odpoved';\r\n\r\n\t//\r\n\t// nazov triedy, ktorou bude oznaceny rodicovsky element spravnej odpovede\r\n\tvar SPRAVNA_CLASS_NAME = 'spravna';\r\n\t\r\n\t//\r\n\t// nazov triedy, ktorou bude oznaceny rodicovsky element spravnej odpovede\r\n\tvar NESPRAVNA_CLASS_NAME = 'nespravna';\t\r\n\r\n\r\n\t// \r\n\t// najdi vsetky odpovede\r\n\tvar odpovede = document.getElementsByClassName( MOZNOST_CLASS_NAME, frm);\r\n\t\r\n\t//\r\n\t// ziskaj z nich unique zoznam \"name\"\r\n\tvar nazvy = Array();\r\n\todpovede.each(function (item) { \r\n\t\tnazvy.push(item.name); \r\n\t});\r\n\tnazvy = nazvy.uniq();\r\n\t\r\n\t// \r\n\t// over ci su vsetky zaskrtnute\r\n\tfor (var i=0; i<nazvy.length; i++) {\r\n\t\tvar nazov = nazvy[i];\r\n\t\t\r\n\t\t\t\t\r\n\t\t// zoznam item v nich\r\n\t\tvar moznosti = frm.getInputs('radio', nazov);\r\n\t\t\r\n\t\t// prelistuj ich a zisti ci je aspon 1 zaskrtnuty (viac nemoze byt, lebo maju rovnake meno)\r\n\t\tvar zaskrtnute = false;\r\n\t\tvar spravne_moznosti = 0;\r\n\t\tmoznosti.each(function (moznost) {\r\n\t\t\tif (moznost.checked) {\r\n\t\t\t\tzaskrtnute = true;\r\n\t\t\t}\r\n\t\t\tif (moznost.value == 1) {\t\r\n\t\t\t\tspravne_moznosti++;\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\t// ak nie je zakrtnuty, tak zrus validaciu\r\n\t\tif (!zaskrtnute) {\r\n\t\t\talert('Musíte zodpovedať všetky otázky!');\r\n\t\t\treturn false;\r\n\t\t}\t\t\r\n\t\tdocument.getElementById(nazov).style.visibility = 'visible';\r\n\t\t//\r\n\t\t// ak otazka nema ani jednu spravnu odpoved v kode, alebo ma viac moznosti\r\n\t\t// upozorni autora\r\n\t\tif (spravne_moznosti != 1) {\r\n\t\t\tif (spravne_moznosti > 1) {\r\n\t\t\t\talert('Otazka s parametrom name: '+ nazov + ' musi mat len 1 spravnu odpoved!');\r\n\t\t\t} else {\r\n\t\t\t\talert('Otazka s parametrom name: '+ nazov + ' musi mat 1 spravnu odpoved !');\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t};\r\n\t\r\n\t//\r\n\t// statistiky vyhodnocovania\r\n\tvar pocet_otazok = nazvy.length;\r\n\tvar pocet_nespravnych = 0;\r\n\tvar pocet_spravnych = 0;\r\n\t\r\n\t// \r\n\t// vyhodnot jednotlive moznosti\r\n\tnazvy.each(function (nazov) {\r\n\t\t\r\n\t\t// zoznam item v nich\r\n\t\tvar moznosti = frm.getInputs('radio', nazov);\r\n\t\t\r\n\t\t// prelistuj a ohodnot\r\n\t\tmoznosti.each(function (moznost) {\r\n\t\t\tif (moznost.checked) {\r\n\t\t\t\tif (moznost.value == 1) {\r\n\t\t\t\t\tpocet_spravnych++;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpocet_nespravnych++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\t\r\n\t// \r\n\t// zvyrazni spravne a nespravne vysledky\r\n\tnazvy.each(function (nazov) {\r\n\t\t\r\n\t\t// zoznam item v nich\r\n\t\tvar moznosti = frm.getInputs('radio', nazov);\r\n\t\t\r\n\t\t// prelistuj a ohodnot\r\n\t\tmoznosti.each(function (moznost) {\r\n\t\t\r\n\t\t\t// odstran predchadzajuce\r\n\t\t\tmoznost.parentNode.removeClassName(SPRAVNA_CLASS_NAME);\t\t\t\r\n\t\t\tmoznost.parentNode.removeClassName(NESPRAVNA_CLASS_NAME);\r\n\t\t\t\r\n\t\t\tif (moznost.checked) {\r\n\t\t\t\tif (moznost.value == 1) {\r\n\t\t\t\t\t// spravna odpoved + celkovo spravna\r\n\t\t\t\t\tmoznost.parentNode.addClassName(SPRAVNA_CLASS_NAME);\r\n\t\t\t\t\tmoznost.parentNode.parentNode.removeClassName(NESPRAVNA_CLASS_NAME);\r\n\t\t\t\t\tmoznost.parentNode.parentNode.removeClassName('otazka');\r\n\t\t\t\t\tmoznost.parentNode.parentNode.addClassName('otazka'+SPRAVNA_CLASS_NAME);\r\n\t\t\t\t\t\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// nespravna odpoved + celkovo nespravna\r\n\t\t\t\t\tmoznost.parentNode.addClassName(NESPRAVNA_CLASS_NAME);\r\n\t\t\t\t\tmoznost.parentNode.parentNode.removeClassName(SPRAVNA_CLASS_NAME);\r\n\t\t\t\t\tmoznost.parentNode.parentNode.removeClassName('otazka');\r\n\t\t\t\t\tmoznost.parentNode.parentNode.addClassName('otazka'+NESPRAVNA_CLASS_NAME);\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (moznost.value == 1) {\r\n\t\t\t\t\t// spravna odpoved\r\n\t\t\t\t\tmoznost.parentNode.addClassName(SPRAVNA_CLASS_NAME);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\t\r\n\t//\r\n\t// zobraz vysledok za pomoci alert\r\n\tif (pocet_otazok == pocet_spravnych) {\r\n\t\talert('Gratulujem !!!, zodpovedali ste všetky otázky správne!');\r\n\t} else {\r\n\t\talert('Zodpovedali ste správne ' + pocet_spravnych + ' otázok z ' + pocet_otazok + ' možných.');\r\n\t}\r\n\t\r\n\t// \r\n\t// allways return false - do not redirect\r\n\treturn false;\r\n}", "function gosodcynnwys(rhif) {\n\n\tif(rhif >= 0 && rhif < cynnwys.length)\n\t\tdocument.getElementById(\"lletestun\").value = cynnwys[rhif];\n\telse\n\t\tconsole.log(\"gwall\");\n\t\n\twedinewid();\n}", "function drugiOdgovor(){\n\tif (!document.getElementById('drPitDa') ) {\n\t\tvar $drOdg = document.getElementById('drPitNe').value.toLowerCase();\n\t\tif (($drOdg.indexOf('zato što') !== -1) || ($drOdg.indexOf('zato sto') !== -1) || ($drOdg.indexOf('jer') !== -1) ) { \n\t\t\tdocument.getElementById('odgovor2').innerHTML='<p>Da li je to dovoljan razlog?</p><input type=\"text\" id=\"drPitZato\" value=\"\" placeholder=\"\"><button type=\"submit\" onclick=\"treciOdgovor();\">Submit</button>';\n\n\t\t\tpromena3();\n\t\t}\n\t\telse if (($drOdg == 'onako') || ($drOdg == 'tako') || ($drOdg == 'eto') || ($drOdg == 'zato') || ($drOdg == 'ne znam') || ($drOdg == 'nemam pojma')) {\n\t\t\tdocument.getElementById('odgovor2').innerHTML='<p>Zbog sira i vojne muzike?</p><input type=\"text\" id=\"drPitEto\" value=\"\" placeholder=\"\"><button type=\"submit\" onclick=\"treciOdgovor();\">Submit</button>';\n\n\t\t\tpromena3();\n\t\t}\n\t\telse {\n\t\t\tdocument.getElementById('odgovor2').innerHTML='<p>Ne razumem odgovor... Objasni mi.</p><input type=\"text\" id=\"drPitNe\" value=\"\" placeholder=\"\"><button type=\"submit\" onclick=\"drugiOdgovor();\">Submit</button>';\n\n\t\t};\t\t\n\t}\n\telse {\n\t\tvar $drOdg = document.getElementById('drPitDa').value.toLowerCase();\n\t\tif (($drOdg.indexOf('da') !== -1) || (($drOdg.indexOf('mislim') !== -1 ) && ($drOdg.indexOf('ne') == -1)) || ($drOdg.indexOf('mozda') !== -1) || ($drOdg.indexOf('možda') !== -1) ) { \n\t\t\tdocument.getElementById('odgovor2').innerHTML='<p>Nabroj šta bi menjao/menjala (odvoj zarezima):</p><input type=\"text\" id=\"drPitMenja\" value=\"\" placeholder=\"\"><button type=\"submit\" onclick=\"treciOdgovor();\">Submit</button>';\n\t\t\tpromena3();\n\t\t}\n\t\telse if ($drOdg.indexOf('ne') !== -1) {\n\t\t\tdocument.getElementById('odgovor2').innerHTML='<p>Zašto onda ne radiš domaći?</p><input type=\"text\" id=\"drPitDoma\" value=\"\" placeholder=\"\"><button type=\"submit\" onclick=\"treciOdgovor();\">Submit</button>';\n\n\t\t\tpromena3();\n\t\t}\n\t\telse {\n\t\t\tdocument.getElementById('odgovor2').innerHTML='<p>Ne razumem odgovor... Objasni mi.</p><input type=\"text\" id=\"prPitDa\" value=\"\" placeholder=\"\"><button type=\"submit\" onclick=\"drugiOdgovor();\">Submit</button>';\n\n\t\t};\t\t\n\n\t};\n\n}", "function AjPoFo() {\r\n \r\n if (perso.Por < 2) { //Test si assez d'argent\r\n alert(\"Vous n'avez pas assez d'argent\");\r\n console.log(\"Pas assez d'argent / nombre de potion = \"+ perso.Pinv[0]);\r\n } else {\r\n perso.Por -= 2; //Or du perso -2\r\n perso.Pinv[0] += 1; //Nombre de potion +1 \r\n document.getElementById('or').value = perso.Por; //affiche Or du perso dans la div caracteristique\r\n document.getElementById('nbPoFo').value = perso.Pinv[0]; //affiche le nombre de potion\r\n console.log(\"Achat d'une potion de force / nombre de potion = \"+ perso.Pinv[0]);\r\n }\r\n\r\n}", "function add() {\n var val = merch.value;\n var num = input.value;\n console.log(val);\n console.log(num);\n}", "function toChangeClefData(){\n currentClefIndex = 0;\n document.getElementById(\"input\").innerHTML = clefDataChangeForm();\n}", "function generator() {\n\n // Dichiaro tutte le variabili\n var chilometri = document.getElementById(\"form_chilometri\").value;\n var eta = document.getElementById(\"form_eta\").value;\n var prezzo = 0.21 * chilometri;\n var prezzoFinale;\n\n // Controllo dei parametri inseriti; in caso negativo reset dei campi\n if(verificaValori(chilometri) == false || verificaValori(eta) == false ){\n alert(\"Non ha inserito correttamente i valori, riprovi\");\n document.getElementById(\"form_chilometri\").value = null;\n document.getElementById(\"form_eta\").value = null;\n document.getElementById(\"form_sconto\").innerHTML = \"\";\n document.getElementById(\"form_prezzo\").innerHTML = \"\";\n } else if (eta < 18 ) {\n prezzoFinale = prezzo - ((prezzo * 20)/100);\n document.getElementById(\"form_sconto\").innerHTML = \"20% perché minorenne\";\n } else if (eta > 65) {\n prezzoFinale = prezzo - ((prezzo * 40)/100);\n document.getElementById(\"form_sconto\").innerHTML = \"40% perché over 65\";\n } else if (eta >= 18 && eta <= 65) {\n prezzoFinale = prezzo;\n document.getElementById(\"form_sconto\").innerHTML = \"0%\";\n }\n\n document.getElementById(\"form_prezzo\").innerHTML = prezzoFinale.toFixed(2)+\" €\";\n \n}", "function Puntaje(combos,de_donde){\r\n if(combos==\"reset\"){\r\n $(de_donde).text(\"0\")\r\n }\r\n else{\r\n var Puntaje_actual = $(de_donde).text()\r\n var Total = Number(Puntaje_actual)+combos;\r\n $(de_donde).text(Total.toString())\r\n }\r\n}", "function afficherLa Saisie() {\n alert( input.value);\n}", "function addTela(n) {\r\n //\r\n var telaTemp = n;\r\n let tela = document.getElementById(\"iOutput\");\r\n tela.value = telaTemp;\r\n\r\n}", "function quitaBlancos(Input){\t\r\n while(''+Input.value.charAt(0)==' ')\r\n {Input.value=Input.value.substring(1,Input.value.length);}\r\n}", "function hola2(uno)\n\t {\n\t document.getElementById(\"idep\").value=uno;\n\t }", "function cargarInput(id_estudiante,nombre){\n\tgrupoestudiante.id_estudiante=id_estudiante;\n\tgrupoestudiante.nombre=nombre;\n\t\n\t$(\"#CampoidEstu\").val(grupoestudiante.id_estudiante);\n\t$(\"#CampoEstudiante\").val(grupoestudiante.nombre);\n}", "function agregaform(datos){\n \n d=datos.split('||');\n $('#codigou').val(d[0]);\n $('#nombreu').val(d[1]);\n}", "function input(){\n $('#js-shopping-list-form').submit(function(event){\n event.preventDefault();\n const text = $('#shopping-list-entry').val();\n $('ul').append(renderNewItem(text));\n this.reset();\n });\n}", "function clairtxtBoxAmVil(){\n document.getElementById(\"txtedaddVille\").value = \"\";\n // document.getElementById(\"cboxedPays\").value = 0;\n} // end clairtxtBoxAmVil()", "function vgaleToApotelesma() {\n event.preventDefault();\n const staTosa = parseFloat(document.querySelector(\".statosa\").value);\n const exoumeTosa = parseFloat(document.querySelector(\".exwtosa\").value);\n const staAlla = parseFloat(document.querySelector(\".staalla\").value);\n const zitoumenoValue = document.querySelector(\".stoixeia2\").value;\n //Apotelesma Praksi\n const apotelesmaTriwn = (staAlla / staTosa) * exoumeTosa;\n const roundResult = Math.floor(apotelesmaTriwn);\n if (roundResult < 0) {\n showValidation.classList.add(\"show\");\n showApotelesma.classList.add(\"hide\");\n }\n document.querySelector(\"#resultriwn\").value = roundResult;\n document.querySelector(\"#resultstoixeio\").value = zitoumenoValue;\n const showApotelesma = document.querySelector(\".koutiapotelesmatos\");\n if (roundResult === roundResult) {\n showApotelesma.classList.add(\"show\");\n theForm.classList.add(\"addheight\");\n } else {\n showApotelesma.classList.add(\"hide\");\n }\n}", "function numeroPulsado(numero) {//controlar varios puntos\n //lineaInputText1 += numero;//cambiar lineaInputText por ta1.value\n return numero;\n}", "function upisGoreFunc()\n{\n\tif (brojBacanja === 0)\n\t\treturn;\n\n\tif (indNajave > 0)\n\t{\n\t\talert(\"Igrali ste najavu!\")\n\t\treturn;\n\t}\n\n\t/* get the value of the field clicked */\n\tvar vred = Number(this.id.slice(1, ));\n\n\t/* see if the previous field is not -1 */\n\t/* else disable writting to preserve order */\n\tif(vred < 12 && kGore[vred] < 0)\n\t{\n\t\talert(\"Nedozvoljen upis!\");\n\t\treturn;\n\t}\n\t\n\t/* did we already write into this field */\n\tif(kGore[vred-1] >= 0)\n\t{\n\t\talert(\"Vec ste upisali u ovo polje!\");\n\t\treturn;\n\t}\n\n\tvar tmp = 0;\n\tvar tmpNiz = [];\n\n\t/* splice izabraneKockice and baceneKockice */\n\tfor(var i=0; i<5; ++i)\n\t{\n\t\tif (Number(izabraneKockice[i].innerText))\n\t\t\ttmpNiz.push(Number(izabraneKockice[i].innerText));\n\t}\n\n\tfor(var i=0; i<5; ++i)\n\t{\n\t\tif (Number(baceneKockice[i].innerText))\n\t\t\ttmpNiz.push(Number(baceneKockice[i].innerText));\n\t}\n\n\tif(tmpNiz.length != 5)\n\t\talert(\"Niz nije 5! vec: \" + tmpNiz.length);\n\n\t/* decide which field was clicked: broj, maxmin ili igra */\n\tswitch(vred)\n\t{\n\t\tcase 1:\n\t\tcase 2:\n\t\tcase 3:\n\t\tcase 4:\n\t\tcase 5:\n\t\tcase 6:\n\t\t\tfor(var i=0; i<5; ++i)\n\t\t\t{\n\t\t\t\tif(tmpNiz[i] == vred)\n\t\t\t\t\ttmp += tmpNiz[i]\n\t\t\t}\n\t\t\tkGore[vred-1] = tmp;\n\t\t\tsumaKolFunc(kGore, \"suma3\");\n\t\t\tsumaRazFunc(kGore, \"suma7\")\n\t\t\tbreak;\n\t\tcase 7:\n\t\tcase 8:\n\t\t\ttmp = zbir(tmpNiz);\n\t\t\tkGore[vred-1] = tmp;\n\t\t\tsumaRazFunc(kGore, \"suma7\")\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\ttmp = jelFul(tmpNiz);\n\t\t\tkGore[vred-1] = tmp;\n\t\t\tsumaIgFunc(kGore, \"suma11\");\n\t\t\tbreak;\n\t\tcase 10:\n\t\t\ttmp = jelPoker(tmpNiz);\n\t\t\tkGore[vred-1] = tmp;\n\t\t\tsumaIgFunc(kGore, \"suma11\");\n\t\t\tbreak;\n\t\tcase 11:\n\t\t\ttmp = jelKenta(tmpNiz);\n\t\t\tkGore[vred-1] = tmp;\n\t\t\tsumaIgFunc(kGore, \"suma11\");\n\t\t\tbreak;\n\t\tcase 12:\n\t\t\ttmp = jelYamb(tmpNiz);\n\t\t\tkGore[vred-1] = tmp;\n\t\t\tsumaIgFunc(kGore, \"suma11\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\t/* write number of vred thrown */\n\tdocument.getElementById(this.id).innerText=Number(tmp);\n\n\tresetuj(izabraneKockice, baceneKockice);\n}", "function inisialisasi(){\n\ttoastr.info('Hai! Mari main!');\n\t$(\"#container\").html(\"\");\n\t$(\"#container\").append(\"<span align='center'> NAMA </span> <input type='text' placeholder='Nama Kamu' id='namaIN'> <br /> <br /> <button type='button' class='btn' id='submitIN'>MULAI</button>\");\n\t$(\"#container\").append(\"<br /> <br /> <div id='TEKS_INTRO'>\"+TEKS_INTRO+\"</div>\");\n\t\t\n\t$('#submitIN').click(function(){\n\t\tvar n = $('#namaIN').val();\n\t\tvar valid = false;\n\t\tfor(i in n){\n\t\t\tif('abcdefghijklmnopqrstuvwxyz'.indexOf(n[i].toLowerCase()) > -1){\n\t\t\t\tvalid = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(valid){\n\t\t\tquestion = makeQuestion();\n\t\t\tstanding = makeStanding();\n \t\tstanding['n'] = n;\n \t\tdisplayBoard();\n \t\t} else {\n\t\t\ttoastr.error('Nama harus mengandung huruf.');\n\t\t}\n \t});\n\treturn null;\n}", "function limpiar() {\r\n \r\n \t$('#plan_cuentas').val(\"0\");\r\n\t\t$('#id_plan_cuentas').val(\"\");\r\n\t\t$('#nombre_plan_cuentas').val(\"\");\r\n\t\t$('#descripcion_dcomprobantes').val(\"\");\r\n\t\t$('#debe_dcomprobantes').val(\"0.00\");\r\n\t\t$('#haber_dcomprobantes').val(\"0.00\");\r\n \r\n }", "add() {\n let selected = this.props.todo.selected;\n let input = document.getElementById('input-to-do');\n let val = input.value;\n\n if (val && !this.props.todo.editing) {\n this.props.addToDo(this.props.todo.todo, this.props.todo.totalToDos);\n input.value = '';\n } \n }", "function act_estrato()\r\n{\r\n\tdocument.getElementById(\"id_estra\").value = document.getElementById(\"sect_estrato\").value;\r\n}", "function testy(){\n\n document.getElementById('word1').value = 'fast';\n document.getElementById('word2').value = 'memory';\n document.getElementById('number').value = 511;\n\n}", "function addByClick(){\r\n\tif (inputValueLength())\r\n\t{\r\n\tinputItemsName()\r\n\t}\r\n}", "function rakFunction() \n { \n if (document.getElementById('selected').checked) \n { \n for(let i = 0; i<100; i++){\n document.getElementsByClassName('newRak')[i].value=document.getElementById('rak').value; \n document.getElementsByClassName('newBox')[i].value=document.getElementById('tahun').value;\n document.getElementsByClassName('newBatch')[i].value=document.getElementById('batch').value;\n }\n } \n else\n { \n document.getElementById('newRak').value=\"\"; \n document.getElementById('newBox').value=\"\"; \n document.getElementById('newBatch').value=\"\"; \n } \n }", "function agregarNumero(num) {\n // llevandolo a texto para concatenar (para unir), recordar que la pantalla es in input text\n opeActual = opeActual.toString() + num.toString();\n actualizarPantalla();\n\n}", "function adder2(id){\r\r\n ////obtenemos el numero actual\r\r\n var addItems = $(\"#eitem\"+id).val();\r\r\n if(addItems<50){\r\r\n addItems++;\r\r\n $(\".eitem\"+id).val(addItems);\r\r\n }\r\r\n}", "function newEntry(){\n if (eq === 'o'){\n $('#box').val('');\n eq = 'x'\n }\n }", "function comprovaCampBuit(objecteRebut) {\n if (objecteRebut.value == \"\") {\n mostraMissatge(2);\n }\n console.log(objecteRebut.value);\n}", "function sumTotal(){\r\n var sumTotal = 0;\r\n //On fait la somme\r\n $('#yes_facture').find('.input_payer').each(function(){\r\n sumTotal+= parseInt($(this).val());\r\n });\r\n //On modifie l'input somme\r\n $('.input_somme').val(sumTotal);\r\n }", "function eventInputCantidad(){\n let inputcantidad=document.querySelectorAll('.producto input')\n inputcantidad.forEach(element => {\n element.addEventListener('change',cantidad)\n function cantidad(e){\n e.preventDefault();\n //ubica el nombre del producto\n let nombreCantidad=(element.parentElement.querySelector('.name').innerHTML);\n enviarCantidad(Number (this.value),nombreCantidad)\n }\n });\n}", "function inputChange() {\n\n /* \n Om inputfältet är tomt break/return vad det nu heter i js.\n\n 1.kolla om vi har ett active words.\n 1.a om vi har active words kolla stavning\n 1.aa om korektstavning return/break vad det nu hetter i js\n 1.ab om fel gör rött eller något sätt som fel\n\n 2. om vi har flera i active\n 2.a kolla input och ta bort active words som inte passar\n \n\n 3.om vi inte har active word\n 2.a kolla alla som har bokstaven och lägg till i active\n\n\n words.forEach(word => {\n //\n }); */\n}", "function NotaFinal() {\r\n var cbounoa = document.getElementById(\"cbounoa\").value;\r\n var cbounob = document.getElementById(\"cbounob\").value;\r\n var cbounoc = document.getElementById(\"cbounoc\").value;\r\n var cbounod = document.getElementById(\"cbounod\").value;\r\n var cbounoe = document.getElementById(\"cbounoe\").value;\r\n var cbounof = document.getElementById(\"cbounof\").value;\r\n if (\r\n cbounoa == \"1\" ||\r\n cbounob == \"1\" ||\r\n cbounoc == \"1\" ||\r\n cbounod == \"1\" ||\r\n cbounoe == \"1\" ||\r\n cbounof == \"1\"\r\n ) {\r\n alert(\"Pregunta 1: Seleccione todas las respuestas posibles\");\r\n } else {\r\n var pre5a = document.getElementById(\"pre5a\").value;\r\n if (pre5a == \"\") {\r\n alert(\"Pregunta 5: Califiqué la pregunta\");\r\n } else {\r\n var pre6a = document.getElementById(\"pre6a\").value;\r\n if (pre6a == \"\") {\r\n alert(\"Pregunta 6: Califiqué la pregunta\");\r\n } else {\r\n pregunta1();\r\n pregunta2();\r\n pregunta3();\r\n pregunta4();\r\n pregunta5();\r\n pregunta6();\r\n pregunta7();\r\n var Nf = parseFloat(tpre1) + parseFloat(tpre2) + parseFloat(tpre3) + parseFloat(tpre4) + parseFloat(tpre5) + parseFloat(tpre6) + parseFloat(tpre7);\r\n var Vtotal = Nf.toFixed(2);\r\n $(\"#txtNota\").html(Vtotal);\r\n document.getElementById(\"bt_comprobar\").disabled = true;\r\n }\r\n }\r\n }\r\n}", "function outputvusazi(){\r\n function output(degvplus,degvminus) {\r\n var text = document.getElementById('vusazi');\r\n text.value = '';\r\n for(var i = 0; i < degvplus.length;i++){\r\n if(degvplus[i] + degvminus[i] == 0){\r\n text.value += \"Ізольована вершина \" + (i+1)\r\n text.value += \"\\n\"\r\n }else if(degvplus[i] + degvminus[i] == 1){\r\n text.value += \"Висяча вершина \" + (i+1)\r\n text.value += \"\\n\"\r\n }\r\n }\r\n }\r\n output(degvplus,degvminus)\r\n}", "function inputWhat(){\n var stuff = $('#tb10').val();\n\n document.querySelector('#time').innerHTML = meal + dat;\n}", "function getElementAsignar(bien_id) \r\n{\r\n $('#bien_id_asigna').val(bien_id);\r\n return false;\r\n}", "function input(){\r\n\t$(\"a-obj-model\").mousedown(function(){\n\t\tif($(this).parent().attr(\"id\") == \"bed-onderdelen\" && jQuery.inArray(this, geplaatseObjecten) == -1 && draagObject == null && volgenInstructies == false){\n\t\t\t$(\"#\"+this.id+\"-voorbeeld\").attr(\"material\", \"shader: flat; color: green; opacity: .3\");\n\t\t\tvar pijlPosX = $(\"#\"+this.id+\"-voorbeeld\").attr(\"position\").x - 2;\n\t\t\tvar pijlPosY = $(\"#\"+this.id+\"-voorbeeld\").attr(\"position\").y + 2;\n\t\t $(\"#pijl\").attr({\"visible\":\"true\", \"position\": ''+pijlPosX+' '+pijlPosY+' '+$(\"#\"+this.id+\"-voorbeeld\").attr(\"position\").z+'', \"rotation\": \"0 0 0\"});\n\t\t\tdragenObject(this, 0, -2, -6);\n\t\t}\r\n\t\telse if($(this).parent().attr(\"id\") == \"bed-onderdelen\" || $(this).parent().attr(\"id\") == \"bed-onderdelen\" && volgenInstructies == true){\r\n\t\t\tafspelenGeluid(\"negatief\");\r\n\t\t}\r\n\t\telse if($(this).parent().attr(\"id\") == \"bed-voorbeeld\"){\r\n\t\t\tif(this.id == ($(draagObject).attr(\"id\")+\"-voorbeeld\")){\r\n\t\t\t\tplaatsenObject(this, draagObject);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if($(this).attr(\"class\").split(' ')[1] == \"papier\"){\r\n\t\t\tdragenObject(this, 0, -2, -6);\r\n\t\t\t$(this).attr(\"rotation\", \"80 0 0\");\r\n\t\t}\r\n\t\telse if(this.id == \"schroevendraaier\"){\r\n\t\t\tschroevendraaierObject = true;\r\n\t\t\tdragenObject(this, 0, -2, -6);\r\n\t\t}\n\t\telse if(this.id == \"inbussleutel\"){\r\n\t\t\tinbussleutelObject = true;\r\n\t\t\tdragenObject(this, 0, -2, -6);\r\n\t\t}\r\n\t\telse if(this.id == \"hamer\"){\r\n\t\t\thamerObject = true;\r\n\t\t\tdragenObject(this, 0, -2, -6);\r\n\t\t}\r\n\t\telse if(this.id == \"radio\"){\r\n\t\t\tradioObject = true;\r\n\t\t\tdragenObject(this, 0, -2, -6);\r\n\t\t}\r\n\t\telse if($(this).attr(\"class\") == \"overige\"){\r\n\t\t\tdragenObject(this, 0, -2, -6);\r\n\t\t}\r\n\t});\r\n\t$(\"#floor\").mousedown(function(){\n\t\tif(draagObject != null){\n\t\t\tloslatenObject(draagObject);\n\t\t}\n\t});\n}", "function compra() {\n var deuda = document.getElementById(\"prod\").value;\n if (deuda === \"Compra deuda\") {\n document.getElementById(\"tipo\").value = 'Bien Terminado';\n }\n}", "function input() {\n rl.question(\"Panjang sisi: \", (x) => {\n \n if (!isNaN(x) ) {\n console.log(`\\n Kubus: ${cubeFormula(x)}`);\n rl.close();\n } else {\n console.log(`sisi harus angka\\n`);\n input();\n }\n \n });\n}", "function getInput(){\n\n investmentValue = document.getElementById(\"number-1\").value;\n percentage = document.getElementById(\"number-2\").value;\n years = document.getElementById(\"number-3\").value;\n\t compound = document.getElementById(\"number-4\").value;\n\t additionalInvestment= document.getElementById(\"number-5\").value;\n }", "function destinosenElLabel() {\n valores = valores + document.getElementById(\"selectDestinos\").value + \",\";\n let valoresModificados = valores.slice(0, -1);\n \n document.getElementById(\"destinoM\").value = valoresModificados;\n}", "function restaurarBoton () {\n boton.innerText = 'Crear';\n indice.value= '';\n nombre.value = '';\n apellido.value = '';\n pais.value = ''\n}", "function DescuentoASO(){\n //obtiene sal_aso\n var sal_aso=document.getElementById(\"sal_aso\").value\n //valor del input de sueldo neto\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n //si anteriormente ya tenia un valor restaura ante cambios del operador\n if(sal_aso > 0)\n {\n var suma=parseFloat(SaldoNeto) + parseFloat(sal_aso);\n document.getElementById(\"sueldoNeto\").value=suma;\n }\n //valor del input ASO\n var monto= document.getElementById('InputASO').value;\n //el nuevo valor de Saldo Neto\n var SaldoNeto= document.getElementById(\"sueldoNeto\").value;\n document.getElementById(\"sueldoNeto\").value=(SaldoNeto-monto);\n document.getElementById(\"sal_aso\").value=monto;\n //guardamos el valor de salario neto(esto se actualizara con cada descuento)\n var sueldoneto=document.getElementById('sueldoNeto').value;\n document.getElementById(\"sal_neto\").value=sueldoneto;\n }", "function upisNajaFunc()\n{\n\t/* ako je br bacanja veci od 1, nije najavljeno nedozvoljen upis */\n\tif (brojBacanja > 1 && indNajave < 1)\n\t{\n\t\talert(\"Niste najavili!\");\n\t\treturn;\n\t}\n\t/* u suprotnom u prvom smo bacanju i zelimo da najavimo */\n\telse if (brojBacanja == 1 && indNajave < 1)\n\t{\n\t\tindNajave = Number(this.id.slice(1, ));\n\n\t\t/* manipulate css for different background color */\n\t\tvar elm = document.getElementById(this.id);\n\t\telm.className = (elm.className == \"najaKlik\") ? \"polje naja\" : \"najaKlik\";\n\t\treturn;\n\t}\n\telse if (brojBacanja === 0)\n\t\treturn;\n\n\t/* get the value of the field clicked */\n\tvar vred = Number(this.id.slice(1, ));\n\n\t/* if not equal, user did not announce that field */\n\tif (vred != indNajave)\n\t{\n\t\talert(\"Niste TO najavili!\");\n\t\treturn; \n\t}\n\t\n\n\t///* see if the previous field is not -1 */\n\t///* else disable writting to preserve order */\n\t//if(vred < 12 && kNaja[vred] < 0)\n\t//{\n\t//\talert(\"Nedozvoljen upis!\");\n\t//\treturn;\n\t//}\n\t\n\t/* did we already write into this field */\n\tif(kNaja[vred-1] >= 0)\n\t{\n\t\talert(\"Vec ste upisali u ovo polje!\");\n\t\treturn;\n\t}\n\n\tvar tmp = 0;\n\tvar tmpNiz = [];\n\n\t/* splice izabraneKockice and baceneKockice */\n\tfor(var i=0; i<5; ++i)\n\t{\n\t\tif (Number(izabraneKockice[i].innerText))\n\t\t\ttmpNiz.push(Number(izabraneKockice[i].innerText));\n\t}\n\n\tfor(var i=0; i<5; ++i)\n\t{\n\t\tif (Number(baceneKockice[i].innerText))\n\t\t\ttmpNiz.push(Number(baceneKockice[i].innerText));\n\t}\n\n\tif(tmpNiz.length != 5)\n\t\talert(\"Niz nije 5! vec: \" + tmpNiz.length);\n\n\t/* decide which field was clicked: broj, maxmin ili igra */\n\tswitch(vred)\n\t{\n\t\tcase 1:\n\t\tcase 2:\n\t\tcase 3:\n\t\tcase 4:\n\t\tcase 5:\n\t\tcase 6:\n\t\t\tfor(var i=0; i<5; ++i)\n\t\t\t{\n\t\t\t\tif(tmpNiz[i] == vred)\n\t\t\t\t\ttmp += tmpNiz[i]\n\t\t\t}\n\t\t\tkNaja[vred-1] = tmp;\n\t\t\tsumaKolFunc(kNaja, \"suma4\");\n\t\t\tsumaRazFunc(kNaja, \"suma8\")\n\t\t\tbreak;\n\t\tcase 7:\n\t\tcase 8:\n\t\t\ttmp = zbir(tmpNiz);\n\t\t\tkNaja[vred-1] = tmp;\n\t\t\t/* suma8 */\n\t\t\tsumaRazFunc(kNaja, \"suma8\")\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\ttmp = jelFul(tmpNiz);\n\t\t\tkNaja[vred-1] = tmp;\n\t\t\tsumaIgFunc(kNaja, \"suma12\");\n\t\t\tbreak;\n\t\tcase 10:\n\t\t\ttmp = jelPoker(tmpNiz);\n\t\t\tkNaja[vred-1] = tmp;\n\t\t\tsumaIgFunc(kNaja, \"suma12\");\n\t\t\tbreak;\n\t\tcase 11:\n\t\t\ttmp = jelKenta(tmpNiz);\n\t\t\tkNaja[vred-1] = tmp;\n\t\t\tsumaIgFunc(kNaja, \"suma12\");\n\t\t\tbreak;\n\t\tcase 12:\n\t\t\ttmp = jelYamb(tmpNiz);\n\t\t\tkNaja[vred-1] = tmp;\n\t\t\tsumaIgFunc(kNaja, \"suma12\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\t/* write number of vred thrown */\n\tdocument.getElementById(this.id).innerText=Number(tmp);\n\n\t/* manipulate css for different background color */\n\tvar elm = document.getElementById(this.id);\n\telm.className = (elm.className == \"najaKlik\") ? \"polje naja\" : \"najaKlik\";\n\tindNajave = 0;\n\tresetuj(izabraneKockice, baceneKockice);\n\n}", "function agregarLetra(){\n var letra =l.value;\n l.value = \"\";\n mostrarPalabra(palabre, hombre, letra);\n}", "function carrega_opcao(obj){\n var contador = $(obj).parents('div.div_pergunta').attr('contador');\n\n clean_pergunta_opcao($(obj));\n\n if ($(obj).val() == 1) {\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_texto').html(opcao_texto(contador));\n } else if ($(obj).val() == 2) {\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_paragrafo').html(opcao_paragrafo(contador));\n } else if ($(obj).val() == 3) {\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_multipla_escolha').html(opcao_multipla_escolha(contador)).append(button_add_opcao());\n } else if ($(obj).val() == 4) {\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_caixa_selecao').html(opcao_caixa_selecao(contador)).append(button_add_opcao());\n } else if ($(obj).val() == 5) {\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_lista').html(opcao_lista(contador)).append(button_add_opcao());\n } else if ($(obj).val() == 6) {\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_escala_numero').html(opcao_escala_numero(contador));\n } else if ($(obj).val() == 7) {\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_escala_estrela').html(opcao_escala_estrela(contador));\n } else if ($(obj).val() == 8) {\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_escala_rosto').html(opcao_escala_rosto(contador));\n } else if ($(obj).val() == 9) {\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_grade_linha').html(opcao_grade_linha(contador, 1));\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_grade_linha').append(opcao_grade_linha(contador, 2)).append(button_add_opcao());\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_grade_coluna').html(opcao_grade_coluna(contador, 1));\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_grade_coluna').append(opcao_grade_coluna(contador, 2)).append(button_add_opcao());\n } else if ($(obj).val() == 10) {\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_data').html(opcao_data(contador));\n } else if ($(obj).val() == 11) {\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_horario').html(opcao_horario(contador));\n } else if ($(obj).val() == 12) {\n $(obj).parents('div#div_pergunta_'+contador).find('#div_op').find('#div_op_curtir').html(opcao_curtir(contador));\n }\n }", "function setMinPermintaan () {\n minPermintaan = document.getElementById('newMinPermintaan').value;\n }", "function wypiszNoweStawki(noweStawki) {\n tyt_wartosc_celna = document.getElementById('tyt_wartosc_celna').value = noweStawki.stawki.tyt_wartosc_celna;\n tyt_stawka_cło = document.getElementById('tyt_stawka_cło').value = noweStawki.stawki.tyt_stawka_cło;\n tyt_kwotowa_stawka_akcyzy_1_kg = document.getElementById('tyt_kwotowa_stawka_akcyzy_1_kg').value = noweStawki.stawki.tyt_kwotowa_stawka_akcyzy_1_kg;\n srednia_wazona_detaliczna_cena_sprzedazy = document.getElementById('srednia_wazona_detaliczna_cena_sprzedazy').value = noweStawki.stawki.srednia_wazona_detaliczna_cena_sprzedazy;\n stawka_akcyzy_wyroby_tyt = document.getElementById('stawka_akcyzy_wyroby_tyt').value = noweStawki.stawki.stawka_akcyzy_wyroby_tyt;\n stawka_vat = document.getElementById('stawka_vat').value = noweStawki.stawki.stawka_vat;\n prog_przetępstwa = document.getElementById('prog_przetępstwa').value = noweStawki.stawki.prog_przetępstwa;\n}", "function cekPoin(poin){\n\t\tif( $('#pointTB').val() != $('#pointTB').val().replace(/[^0-9]/g, '')){ // cek hanya angka \n\t\t\t$('#pointTB').val($('#pointTB').val().replace(/[^0-9]/g, ''));\n\t\t}\n\t}", "function cekPoin(poin){\n\t\tif( $('#pointTB').val() != $('#pointTB').val().replace(/[^0-9]/g, '')){ // cek hanya angka \n\t\t\t$('#pointTB').val($('#pointTB').val().replace(/[^0-9]/g, ''));\n\t\t}\n\t}" ]
[ "0.6504732", "0.6504732", "0.6240115", "0.6117684", "0.6091735", "0.5973644", "0.59542596", "0.58856577", "0.58824104", "0.58731955", "0.5838432", "0.5796614", "0.5793928", "0.57863325", "0.5781241", "0.57729447", "0.57714075", "0.5766547", "0.57634294", "0.57603735", "0.5747284", "0.5739908", "0.5719724", "0.57102364", "0.5698439", "0.5695836", "0.56927943", "0.5683098", "0.56797206", "0.5674091", "0.56680435", "0.56621355", "0.5659675", "0.56513196", "0.56510156", "0.56327444", "0.5629606", "0.56221056", "0.561031", "0.560991", "0.56070614", "0.56010514", "0.55986464", "0.5598086", "0.55933344", "0.55907804", "0.55888575", "0.5584267", "0.5583586", "0.5577014", "0.55755466", "0.55589724", "0.55522615", "0.5551458", "0.5551069", "0.55492866", "0.5542957", "0.55365187", "0.5534842", "0.553436", "0.5531025", "0.55305433", "0.5529753", "0.5526975", "0.552517", "0.55215234", "0.55194086", "0.5512827", "0.55024433", "0.5501309", "0.5501237", "0.54968554", "0.54966104", "0.5491225", "0.54865944", "0.5484063", "0.5480215", "0.5480111", "0.5477734", "0.547766", "0.5468466", "0.5466197", "0.5465962", "0.5462287", "0.54595476", "0.54591405", "0.5456504", "0.54534477", "0.5443325", "0.544056", "0.54400223", "0.54234415", "0.54220414", "0.5417826", "0.54154074", "0.5414684", "0.54128766", "0.5412446", "0.54122627", "0.54122627" ]
0.58234394
11
controleren of er een nummer zit in de string
function checkForNumber(t) { let regex = /\d/g; return regex.test(t); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function comprobacion(e) {\n\t var numeros=\"0123456789\";\n\nfunction tiene_numeros(texto){\n for(i=0; i<texto.length; i++){\n if (numeros.indexOf(texto.charAt(i),0)!=-1){\n \t//si retorna 1 es que encontro numeros en el texto\n return 1;\n }\n }\n //si retorna 0 solo contiene letras\n return 0;\n}\n}", "function numm(str) {\n let val = \" \", newvar = \" \";\n for (let i = 0; i <= length; i++) {\n newvar = parseInt(str[i]);\n val = val + \" \" + arr[newvar];\n }\n if{ length }\n alert(`${str} in wordes is :${val}`)\n }", "transformar(numero) {\n switch (numero) {\n case 0:\n return 'celeste'\n case 1:\n return 'violeta'\n case 2:\n return 'naranja'\n case 3:\n return 'verde'\n }\n }", "function agregarNumero(num) {\n // llevandolo a texto para concatenar (para unir), recordar que la pantalla es in input text\n opeActual = opeActual.toString() + num.toString();\n actualizarPantalla();\n\n}", "function afficherNCar(str){\n \tvar result4 = str.substring(0,9);\n \treturn result4;\n }", "tratarDigito() {\n let numero = \"\";\n\n numero = numero.concat(this.caracter);\n this.lerCaracter();\n\n while (/[0-9]/g.test(this.caracter) === true) {\n numero = numero.concat(this.caracter);\n this.lerCaracter();\n }\n this.token.lexema = +numero\n this.token.simbolo = \"snumero\"\n this.token.linha = this.numLinha\n }", "function numeros(caracter) {\n lugarDeColocacion = input.value.length + ultimoIndice; \n input.value = insertarCaracter(lugarDeColocacion,input.value,caracter);\n}", "function inputNumericoString(id) {\n id.keyup(function() {\n this.value = (this.value + '').replace(/[^-.0-9]/g, '');\n });\n}", "function RellenaTexto(aux, TotalDigitos, TipoCaracter) {\r\n\tvar Numero = aux.toString();\r\n\tvar mon_len = parseInt(TotalDigitos) - Numero.length;\r\n\t\r\n\tif (mon_len<0) { \r\n\t\tmon_len = mon_len * -1;\r\n\t}\r\n\t// Solo para el tipo caracter\r\n\tif (TipoCaracter == 'C') {\r\n\t\tmon_len = parseInt(mon_len) + 1;\r\n\t}\r\n\t\r\n\tif (Numero == null || Numero == '') {\r\n\t\tNumero = '';\r\n\t} \r\n\r\n\tvar pd = '';\r\n\tif (TipoCaracter == 'N') {\r\n\t\tpd = repitechar(TotalDigitos,'0');\r\n\t} else {\r\n\t\tpd = repitechar(TotalDigitos,' ');\r\n\t}\r\n\tif (TipoCaracter == 'N') {\r\n\t\t// Numero = pd.substring(0, mon_len) + Numero;\r\n\t\tTotalDigitos = parseFloat(TotalDigitos) * -1;\r\n\t\tNumero = (pd + Numero).slice(TotalDigitos);\r\n\t\treturn Numero;\r\n\t} else {\r\n\t\tNumero = Numero + pd;\r\n\t\treturn Numero.substring(0, parseInt(TotalDigitos));\r\n\t}\r\n}", "function crore(number){\n\t\t\t\tif(number.length==8){\n\t\t\t\t\tsubnum=number[1]+number[2]+number[3]+number[4]+number[5]+number[6]+number[7];\n\t\t\t\t\tword= first[number[0]]+\" \"+unit[3]+\" \"+lakh(subnum);\n\t\t\t\t\treturn word;\n\t\t\t\t}\n\t\t\t\telse if(number.length==9){\n\t\t\t\t\tsubnum=number[2]+number[3]+number[4]+number[5]+number[6]+number[7]+number[8];\n\t\t\t\t\tword= first2degred(number[0]+number[1])+\" \"+unit[3]+\" \"+lakh(subnum);\n\t\t\t\t\treturn word;\n\t\t\t\t}\n\t\t\t}", "function Validar_Text_Number(obj)\n{\n\tjq(obj).validCampoAPP('abcdefghijklmnñopqrstuvwxyzáéíóú0123456789 ');\n}", "function numberic_to_string(so)\n{\n var i;\n var j;\n var kq = \"\";\n var l;\n var dk;\n var tmp = \"\";\n var check = false;\n var a = new Array(32);\n\n //kiem tra kieu so\n //Loai het so 0 o dau\n while (so.length > 0 && so.charAt(0) == \"0\"){\n so = so.substring(1,so.length);\n }\n //alert(so);\n l = so.length;\n if (l > 28){\n return \"Số không hợp lệ\";\n }\n\n //Load cac chu so cua so can doc\n //vao mang a\n for (var i=1;i<=l;i++){\n a[i] = parseInt(so.charAt(i-1));\n }\n //Bat dau doc tu trai sang phai\n for (var i=1;i<=l;i++){\n\n if((l - i) % 3 == 2 && a[i] == 0 && (l - i >= 2)) {\n if (a[i + 1] != 0 || a[i + 2] != 0) {\n kq = kq + \"không \";\n }\n }\n\n if (a[i] == 2){\n kq = kq + \"hai \";\n }\n if (a[i] == 3){\n kq = kq + \"ba \";\n }\n if (a[i] == 6){\n kq = kq + \"sáu \";\n }\n if (a[i] == 7){\n kq = kq + \"bảy \";\n }\n if (a[i] == 8){\n kq = kq + \"tám \";\n }\n if (a[i] == 9){\n kq = kq + \"chín \";\n }\n\n\n //Xu ly cach doc so 4\n if (a[i] == 4) {\n if (i > 1 && (l - i) % 3 == 0){\n if (a[i - 1] > 1){\n kq = kq + \"tư \";\n }else{\n kq = kq + \"bốn \";\n }\n }else{\n kq = kq + \"bốn \";\n }\n } //a(i)=4\n\n //Xu ly cach doc so 5\n if (a[i] == 5){\n if (i > 1 && (l - i)% 3 == 0){\n if (a[i - 1] != 0 ){\n kq = kq + \"lăm \";\n }else{\n kq = kq + \"năm \";\n }\n }else{\n kq = kq + \"năm \";\n }\n } //a(i)=5\n\n //Xu ly cach doc so 1\n if (a[i] == 1) {\n //doc la muoi neu no la hang chuc\n if ((l - i) % 3 == 1) {\n kq = kq + \"mười \";\t//doc la mot neu la hang don vi\t//va hang chuc >1\n }else{\n if ((l - i) % 3 == 0 && (i > 1)){\n if (a[i - 1] > 1){\n kq = kq + \"mốt \";\n }else{\n kq = kq + \"một \";\n }\n }else{\n kq = kq + \"một \";\n }\n }\n } //a(i)=1\n\n\n //Doc tiep la muoi neu\n //No la so hang chuc va\n //Khac 1 va 0\n if ((l - i) % 3 == 1 && a[i] != 0 && a[i] != 1){\n kq = kq + \"mươi \";\n }\n\n if ((l - i) % 3 == 1 && a[i] == 0 && a[i + 1] != 0){\n kq = kq + \"linh \";\n }\n\n if ((l - i) % 3 == 2 && (a[i + 1] != 0 || a[i + 2] != 0)){\n kq = kq + \"trăm \";\n }\n\n if ((i + 2) <= l) {\n if (a[i] != 0 && (l - i) % 3 == 2){\n if (a[i + 1] == 0 && a[i + 2] == 0){\n kq = kq + \"trăm \";\n }\n }\n }\n\n if ((l - i) == 3){\n kq = kq + \"nghìn \";\n }\n if ((l - i) == 6){\n kq = kq + \"triệu \";\n }\n if ((l - i) == 9){\n kq = kq + \"tỷ \";\n }\n\n if ((l - i) == 12){\n check = true;\n for (j=i+1;i<l;i++){\n if (a[i + 1] != 0){\n check = false;\n }\n }\n if (check == false) {\n kq = kq + \"nghìn \";\n }else{\n kq = kq + \"nghìn tỷ \";\n }\n }\n\n if ((l - i) == 15){\n kq = kq + \"triệu tỷ \";\n }\n if ((l - i) == 18){\n kq = kq + \"tỷ tỷ \";\n }\n if ((l - i) == 21){\n kq = kq + \"nghìn tỷ tỷ \";\n }\n if ((l - i) == 24){\n kq = kq + \"triệu tỷ tỷ \";\n }\n if ((l - i) == 27){\n kq = kq + \"tỷ tỷ tỷ \";\n }\n if ((l - i) == 30){\n kq = kq + \"nghìn tỷ tỷ \";\n }\n\n //Xu ly bo 3 so khong\n if (((l - i) % 3 == 2) && (a[i] == 0) && (a[i + 1] == 0) && (a[i + 2] == 0)){\n i = i + 2;\n }\n\n //Xu ly tat ca so khong con lai\n if ((l - i) % 3 == 0){\n dk = 1;\n for (j=i+1;j<=l;j++){\n if (a[j] != 0){\n dk = 0;\n }\n }\n }\n if (dk == 1){\n break;\n }\n\n }\n\n //Viet hoa chu cai dau tien\n if (kq == \"\") kq = \"không\"\n while (kq.charAt(kq.length) == \",\"){\n kq = kq.substring(0,kq.length-1);\n }\n kq = kq.charAt(0).toUpperCase() + kq.substring(1,kq.length);\n return kq + \" đồng\";\n}", "function numerico(campo)\n\t{\n\tvar charpos = campo.value.search(\"[^0-9]\");\n if (campo.value.length > 0 && charpos >= 0)\n\t\t{\n\t\tcampo.value = campo.value.slice(0, -1);\n\t\tcampo.focus();\n\t return false;\n\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\treturn true;\n\t\t\t\t}\n\t}", "function main() {\n var str = $('#num1').val();\n $('#resultado').html(substituir(str));\n}", "function lireInput()\n{\n\t//RECUPERER L'OBJET QUI REPRESENTE LA BALISE <input id=\"nbrColonnes\">\n\tobjetInput = document.getElementById(\"nbrColonnes\");\n\t//LIT LE TEXTE ENTRE PAR L'UTILISATEUR\n\ttexteInput = objetInput.value;\n\t//CONVERTIR LE TEXTE EN NOMBRE ENTIER\n\tnbrColonnes = parseInt(texteInput);\n\t//CARRE\n\tnbrLignes = nbrColonnes;\n\t//LE CARRE\n\tnbrCase = nbrColonnes * nbrLignes;\n}", "function auxLetras(promedio) {\n let simbolo;\n\n if (promedio > 0 && promedio <= 15)\n simbolo = 'M';\n else if (promedio >= 16 && promedio <= 31)\n simbolo = 'N';\n else if (promedio >= 32 && promedio <= 47)\n simbolo = 'H';\n else if (promedio >= 48 && promedio <= 63)\n simbolo = '#';\n else if (promedio >= 64 && promedio <= 79)\n simbolo = 'Q';\n else if (promedio >= 80 && promedio <= 95)\n simbolo = 'U';\n else if (promedio >= 96 && promedio <= 111)\n simbolo = 'A';\n else if (promedio >= 112 && promedio <= 127)\n simbolo = 'D';\n else if (promedio >= 128 && promedio <= 143)\n simbolo = '0';\n else if (promedio >= 144 && promedio <= 159)\n simbolo = 'Y';\n else if (promedio >= 160 && promedio <= 175)\n simbolo = '2';\n else if (promedio >= 176 && promedio <= 191)\n simbolo = '$';\n else if (promedio >= 192 && promedio <= 209)\n simbolo = '%';\n else if (promedio >= 210 && promedio <= 225)\n simbolo = '+';\n else if (promedio >= 226 && promedio <= 239)\n simbolo = '.';\n else if (promedio >= 240 && rgbPromedio <= 255)\n simbolo = ' ';\n return simbolo;\n\n}", "function formatearMiljs(input) {\n var num = input;\n if(!isNaN(num)){\n if (num>0) {\n num = num.toString().split('').reverse().join('').replace(/(?=\\d*\\.?)(\\d{3})/g,'$1.');\n num = num.split('').reverse().join('').replace(/^[\\.]/,'');\n return num;\n }else{\n num = num.toString().split('').reverse().join('').replace(/(?=\\d*\\.?)(\\d{3})/g,'$1.');\n num = num.split('').reverse().join('').replace(/^[\\.]/,'');\n return '-'+num;\n }\n }else{\n alert('Solo se permiten numeros');\n return 1;\n }\n }", "function presionarNumero(valor) {\n var result = obtenerResultado();\n if (result == \"01010010\") {\n mostrarResultado(\"Rolling (<>)\");\n } else {\n mostrarResultado(result + valor);\n }\n}", "function numberLetters(str) {\n var angka = '14370';\n var huruf = 'iaeuo';\n var result = '';\n\n for (var i = 0; i < str.length; i++) {\n var isAngka = false;\n for (var j = 0; j < angka.length; j++) {\n if (str[i] === angka[j]) {\n isAngka = true;\n result += huruf[j];\n }\n }\n if (!isAngka) {\n result += str[i];\n }\n }\n return result;\n}", "function checa_numerico(String) {\r\n\tvar mensagem = \"Este campo aceita somente números\"\r\n\tvar msg = \"\";\r\n\tif (isNaN(String)) msg = mensagem;\r\n\treturn msg;\r\n}", "function Numero( caractere ) { \nvar strValidos = \"0123456789\" \nif ( strValidos.indexOf( caractere ) == -1 ) \nreturn false; \nreturn true; \n}", "function addNumber(event){ \n let str = event.target.id;\n number = str.charAt(3);\n let text =document.getElementById(\"txt\");\n text.value=text.value+number; \n \n}", "function formatearMiljs(input) {\n var num = input;\n if(!isNaN(num)){\n if (num>0) {\n num = num.toString().split('').reverse().join('').replace(/(?=\\d*\\.?)(\\d{3})/g,'$1.');\n num = num.split('').reverse().join('').replace(/^[\\.]/,'');\n return num;\n }else{\n num = num.toString().split('').reverse().join('').replace(/(?=\\d*\\.?)(\\d{3})/g,'$1.');\n num = num.split('').reverse().join('').replace(/^[\\.]/,'');\n return '-'+num;\n }\n }else{\n alert('Solo se permiten numeros');\n return 1;\n }\n}", "static arabicNum() {\n if (Articles.toggleNum) {\n let map = [\"&\\#1632;\", \"&\\#1633;\", \"&\\#1634;\", \"&\\#1635;\", \"&\\#1636;\", \"&\\#1637;\", \"&\\#1638;\", \"&\\#1639;\", \"&\\#1640;\", \"&\\#1641;\"];\n let body = document.querySelector('body');\n body.innerHTML = body.innerHTML.replace(/\\d(?=[^<>]*(<|$))/g, function (e) {\n return map[e];\n });\n } else {\n return;\n }\n }", "function numero(xx) { //recoge el n&uacute;mero pulsado en el argumento.\r\n if (x==\"0\" || xi==1 ) { // inicializar un n&uacute;mero, \r\n pantalla.innerHTML=xx; //mostrar en pantalla\r\n x=xx; //guardar n&uacute;mero\r\n if (xx==\".\") { //si escribimos una coma al principio del n&uacute;mero\r\n pantalla.innerHTML=\"0.\"; //escribimos 0.\r\n x=xx; //guardar n&uacute;mero\r\n coma=1; //cambiar estado de la coma\r\n }\r\n }\r\n else { //continuar escribiendo un n&uacute;mero\r\n if (xx==\".\" && coma==0) { //si escribimos una coma decimal pòr primera vez\r\n pantalla.innerHTML+=xx;\r\n x+=xx;\r\n coma=1; //cambiar el estado de la coma \r\n }\r\n //si intentamos escribir una segunda coma decimal no realiza ninguna acci&oacute;n.\r\n else if (xx==\".\" && coma==1) {} \r\n //Resto de casos: escribir un n&uacute;mero del 0 al 9: \r\n else {\r\n pantalla.innerHTML+=xx;\r\n x+=xx\r\n }\r\n }\r\n xi=0 //el n&uacute;mero est&aacute; iniciado y podemos ampliarlo.\r\n }", "function holamundo(texto){\n var hola_mundo=\"Texto dentro de una funcion\";\n console.log(texto);\n // metodo toString permite convertir un numero en un string \n console.log(numero.toString());\n console.log(hola_mundo);\n}", "function onlyNum(obj,event){\n\tvar num_regx=/^[0-9]*$/;\n\tif( !num_regx.test(obj.value) ) {\n\t\talert('숫자만 입력하실 수 있습니다.');\n\t\tobj.value = obj.value.substring(0, obj.value.length-1 );\n\t}\n}", "function arreglar(numero){\n var numeroo=\"\";\n numero=\"\"+numero;\n partes=numero.split(separadorDecimalesInicial);\n entero=partes[0];\n if(partes.length>1)\n {\n decimal=partes[1];\n }\n cifras=entero.length;\n cifras2=cifras\n for(a=0;a<cifras;a++){\n cifras2-=1;\n numeroo+=entero.charAt(a);\n if(cifras2%3==0 &&cifras2!=0){\n numeroo+=separadorMiles;\n }\n }\n if(partes.length>1){\n numeroo+=separadorDecimales+decimal;\n }\n return numeroo\n }", "function reverseNumeroFormatado(numero){ \r\n //isso é uma coisa chamada de expressão regular (essa no caso tira tudo que não for dígito da string) \r\n return Number(numero.replace(/[^\\d]+/g,'')); \r\n}", "function translate_10_Crore(s){\n\tif(s == \"000000000\"){\n\t\treturn \"\";\n\t}\n\tvar firstDigit = s.substring(0,2);\n\tvar remainingDigits = s.substring(2,9);\n\tvar firstDescription = translate_Tens(firstDigit);\n\tvar remainingDescription = translate_10_Lakh(remainingDigits);\n\tvar output = \"\";\n\tif(firstDescription != \"\"){\n\t\toutput = output + firstDescription + \" \" + \"Crore\";\n\t\tif(remainingDescription != \"\"){\n\t\t\toutput = output + \" \" + remainingDescription;\n\t\t}\n\t}else{\n\t\tif(remainingDescription != \"\"){\n\t\t\toutput = remainingDescription;\n\t\t}\n\t}\n\treturn output;\t\n}", "transformarNumeroAColor(numero) {\n switch (numero) {\n case 0:\n return 'celeste'; \n case 1:\n return 'rojo';\n case 2:\n return 'naranja'; \n case 3:\n return 'verde'; \n }\n }", "function numberLetters (str) {\n var newStr = '';\n for(var i = 0 ; i < str.length ; i++){\n if(str[i] === '1'){\n newStr = newStr + 'i';\n }else if(str[i] === '4'){\n newStr = newStr + 'a'\n }else if(str[i] === '3'){\n newStr = newStr + 'e'\n }else if(str[i] === '7'){\n newStr = newStr + 'u'\n }else if(str[i] === '0'){\n newStr = newStr + 'o'\n }else{\n newStr = newStr + str[i]\n }\n }\n return newStr\n}", "function traiterNomPrenom(event) {\r\n\r\n touche = event.charCode || event.keyCode || event.which;\r\n car = String.fromCharCode(touche);\r\n\r\n if (/\\d/.test(car)) {\r\n return false;\r\n }\r\n}", "function years(num){\n let years0,\n str1=num.toString(), \nsL=str1.length;\nif (sL==1) {s1=\"0\"; s2=str1} else { s2=str1.charAt(sL-2); s2=str1.charAt(sL-1)} \nif (s2==\"1\" && s1!=\"1\") {years0=' год '} else if \n((s2==\"2\"||s2==\"3\"||s2==\"4\" )&&s1!=\"1\") {years0=' года '} else {years0=' лет '};\nreturn years0\n}", "function getNumeroFormatado(numero){ \r\n if (numero == \"-\"){\r\n return \"\";\r\n } \r\n let n = Number(numero);\r\n let valor = n.toLocaleString(\"pt-br\");\r\n return valor;\r\n}", "function passNumFunc() {\n var p, z; //t= \"paragraph\", z= змінна.\n p = document.getElementById('pasword-num');\n p.innerHTML = \"\";\n z = document.getElementById('pasNum-put').value;\n try {\n if (z == \"\") throw \"is empty!\";\n if (isNaN(z)) throw \"is not a number!\";\n z = Number(z);\n if (z <= 7) throw \"is too low!\";\n if (z >= 11 ) throw \"is too height!\";\n if (z === 8) throw getPassNum8();\n if (z === 9) throw getPassNum9();\n if (z === 10) throw getPassNum10();\n } catch (err) {\n p.innerHTML = err;\n } finally {\n document.getElementById('pasNum-put').value=\"\";\n }\n}", "transformarNumeroAColor(numero){\n switch (numero){\n case 0:\n return 'celeste'\n case 1:\n return 'violeta'\n case 2:\n return 'naranja'\n case 3:\n return 'verde' \n }\n }", "function cekAngka(input) {\n // var isnowint = parseInt(input);\n // console.log(input.length);\n var output = ''; \n for (var i = 0; i < input.length; i++) {\n if ((parseInt(input[i])) || (input[i] == '0') || (input[i] == '-')){\n output += input[i];\n }\n }\n return Number(output);\n}", "function ZeigeZeichen(str, i) {\n \nif (isNaN(i)) { \ni = 0;\n}\nif (str) { \nalert(\"Das \" + parseInt(i+1) + \". Zeichen ist ein \" + str[i]);\n }\n}", "function numberString(stringNumele) {\n var numberOfCaracter = stringNumele.match(/e/g);\n console.log(numberOfCaracter.length);\n}", "function GetIntegrer()\r\n{\r\nintegrer = parseInt(window.prompt( \"Entrez le nombre d'élément : \"));\r\n}", "function mostrar(num){\r\n\t\tif(resultado.textContent.length < 8){\r\n\t\t\tif(resultado.innerHTML ==\"0\"){\r\n\t\t\t\tresultado.textContent = num;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tresultado.textContent = \"0\";\r\n\t\t}\r\n\t}", "function ejercicio02(email){\nvar longitud = email.length;\nvar mayusc = email.toUpperCase();\ncont = 0;\nvar no = \"\";\n\nfor (i=0 ; i<=longitud ; i++)\n{ \n if(email.charAt(i) == \"m\" || email.charAt(i) == \"M\")\n {\n cont++;\n }\n}\nif (cont == 0)\n{\n cont = toString(cont)\n cont = \"ninguna\";\n no = \"no\";\n}\nreturn \"El correo\" + email + \"tiene\" + longitud + \"caracteres y en mayúsculas se quedaría así\" + mayusc + \". Además \" + no + \" contiene \" + cont + \" letras M\";\n\n}", "function eliminarTextosNumeros(item){\r\n\t\titem = String(item);\r\n\t\titem = item.replace(\"tachados-\", \"\");\r\n\t\titem = item.replace(\"tornillo-\", \"\");\r\n\t\treturn item; \r\n\t}", "function ejercicio03(email){\n console.log(email);\n longitud = email.length;\n var cont = 0;\n var no = \"\";\n var dominio = email.substring(email.indexOf(\"@\")+1,longitud);\n var carac = email.indexOf(\"@\");\n for (i=0; i<= longitud; i++)\n {\n if(email.charAt(i) == \"8\")\n {\n cont = cont +1;\n }\n }\n if (cont == 0)\n {\n cont = toString(cont)\n cont = \"ningun/os\";\n no = \"no\";\n } \n\n return \"El correo \" + email + \"pertenece al dominio \"+ dominio + \" y tiene \" + carac + \" caracteres sin contar el dominio ni el @. Además, el correo \"+ no + \" contiene \"+ cont +\" número[s]\"; \n}", "function obtenerNumeroDigitado(botonDigitado) {\n return botonDigitado[1];\n}", "function Validar_Number(obj){\n\t jq(obj).validCampoAPP('0123456789');\n}", "function formatarMesAno(componente)\n{\n\tif (componente.value.length == 2) \n\t{\n\t\tif (!testarMes(componente.value,\"01\")) \n\t\t{ \n\t\t\tcomponente.value = \"\";\n\t\t\tcomponente.focus();\n\t\t} \n\t\telse \n\t\t{\n\t\t\tcomponente.value += '/';\n\t\t}\n\t}\n\n\tif (componente.value.length == 7) \n\t{\n\t\tif ( !testarAno(componente.value.substring(3,7), componente.value.substring(0,2),\"01\") ) \n\t\t{\n\t\t\tcomponente.value = componente.value.substring(0,3);\n\t\t\tcomponente.focus();\n\t\t}\n\t}\n}", "transformarNumeroAColor(numero) {\n switch (numero) {\n case 0:\n return \"celeste\";\n case 1:\n return \"violeta\";\n case 2:\n return \"naranja\";\n case 3:\n return \"verde\";\n }\n }", "function valida_numeros(e){\n tecla = (document.all) ? e.keyCode : e.which;\n //Tecla de retroceso para borrar, siempre la permite\n if (tecla == 8 ){ return true; }\n if (tecla == 9 ){ return true; }\n if (tecla == 0 ){ return true; }\n if (tecla == 13 ){ return true; }\n \n // Patron de entrada, en este caso solo acepta numeros\n patron =/[0-9-.]/;\n tecla_final = String.fromCharCode(tecla);\n return patron.test(tecla_final);\n }", "function comprobarTipo(texto){//nos devuelve un string indicando el tipo de token\r\n \r\n //comparamos que la primera posicion de la palabra sea una letra mayuscula o minuscula\r\n if((textoEntrada.value.charCodeAt(0)>=97 && textoEntrada.value.charCodeAt(0)<=122) \r\n || (textoEntrada.value.charCodeAt(0)>=65 && textoEntrada.value.charCodeAt(0)<=90)){\r\n //si cumple con ser una letra el primer caracter\r\n //comparamos que los siguientes caracteres sigan siendo letras o numeros\r\n if((texto>=97 && texto<=122) || (texto>=65 && texto<=90) || texto>=48 && texto<=57){\r\n\t\t return(\"letra\");\r\n \r\n }else {//si algun caracter no cumple nos vamos a un estado de error\r\n \r\n return(\"error\"); \r\n }\r\n //comparamos que el primer caracter sea un numero \r\n }else if((textoEntrada.value.charCodeAt(0)>=48 && textoEntrada.value.charCodeAt(0)<=57) ){\r\n \r\n if(texto>=48 && texto<=57){//si cumple, continua comparando que la palabra contenga solo numeros\r\n return(\"digito\");\r\n \r\n\t }else {\r\n return(\"error\");\r\n }\r\n //comparamos que el primer caracter sea un simbolo \r\n }else if(textoEntrada.value.charCodeAt(0)>=35 && textoEntrada.value.charCodeAt(0)<=37 ) {\r\n \r\n if(texto>=35 && texto<=37){\r\n return(\"simbolo\");\r\n \r\n\t }else{\r\n return(\"error\");\r\n }\r\n \r\n }else{\r\n return(\"error\");\r\n }\r\n \r\n}", "function translteBanglaToEngNum( num_str ){\r\n\t\t\t var bengali = {\"০\":0, \"১\":1, \"২\":2, \"৩\":3, \"৪\":4, \"৫\":5, \"৬\":6, \"৭\":7, \"৮\":8, \"৯\":9};\r\n\t\t\t var changed_nun='';\r\n\t\t\t num_str.toString().split('').forEach(l => {\r\n\t\t\t if(isNaN(l)){\r\n\t\t\t \tchanged_nun += bengali[l];\r\n\t\t\t }else{\r\n\t\t\t \tchanged_nun +=l;\r\n\t\t\t }\r\n\t\t\t });\r\n\t\t\t return changed_nun;\r\n\t\t\t}", "static identityNumber(form, field, settings) {\n let id = form[field];\n id = String(id).trim();\n if(settings.required && id.length > 0){\n if (id.length > 9 || isNaN(id)) return settings.errorMessage || 'מספר ת\"ז אינו תקין';\n id = id.length < 9 ? (\"00000000\" + id).slice(-9) : id;\n let valid = Array.from(id, Number).reduce((counter, digit, i) => {\n const step = digit * ((i % 2) + 1);\n return counter + (step > 9 ? step - 9 : step);\n }) % 10 === 0;\n \n if(!valid){\n return settings.errorMessage || 'מספר ת\"ז אינו תקין';\n }\n return null;\n }\n return null;\n }", "function soNumero(str) {\n\tstr = str.toString();\n\treturn str.replace(/\\D/g, '');\n}", "function validarNum(Num)\r\n{\r\n var regNum = /([^0-9]{4})/g;\r\n num.value = num.value.replace(/([^0-9]{4})/g,'');\r\n\r\n}", "function verificarNumero(value, min, id){\n let res = \"\";\n let val = value.split(\"\");\n for(let i = 0; i < val.length; i++){\n res += (NUMBERS.includes(val[i])) ? val[i] : \"\";\n }\n if(Number.parseInt(res) > 20) {\n res = (Number.parseInt(res) > 20) ? res.slice(0,-1) : res;\n }\n document.getElementById(id).value = res;\n return (Number.isInteger(Number.parseInt(value[value.length - 1])) && !(Number.parseInt(value) < min));\n}", "function verifNom(){\r\n console.log(nom.value);\r\n for(var i = 0; i < nom.value.length; i++){\r\n var lettre = nom.value[i];\r\n console.log(lettre);\r\n if ((lettre == '0') || (lettre == '1') || (lettre == '2') || (lettre == '3') ||\r\n (lettre == '4') || (lettre == '5') || (lettre == '6') || (lettre == '7') ||\r\n (lettre == '8') || (lettre == '9') || (lettre == '!') || (lettre == ',') ||\r\n (lettre == '_') || (lettre == '/') || (lettre == '\\\\') || (lettre == '\"') ){\r\n nom.style.borderColor = \"red\";\r\n nom.value = \"\";\r\n nom.placeholder = \"pas de chiffre ou de caractères spéciaux\";\r\n } else {\r\n nom.style.borderColor = \"black\";\r\n }\r\n } \r\n}", "function telefone(e){\r\n e.value=e.value.replace(/\\D/g,\"\") //REMOVE TUDO O QUE NÃO É DÍGITO\r\n e.value=e.value.replace(/^(\\d\\d)(\\d)/g,\"($1) $2\") //COLOCA PARÊNTESES EM VOLTA DOS DOIS PRIMEIROS DÍGITOS\r\n e.value=e.value.replace(/(\\d{4})(\\d)/,\"$1-$2\") //COLOCA HÍFEN ENTRE O QUARTO E O QUINTO DÍGITOS\r\n return e\r\n}", "function aumentar_cero(num){\r\n if (num < 10) {\r\n num = \"0\" + num;\r\n }\r\n return num;\r\n}", "function aumentar_cero(num){\r\n if (num < 10) {\r\n num = \"0\" + num;\r\n }\r\n return num;\r\n}", "function aumentar_cero(num){\r\n if (num < 10) {\r\n num = \"0\" + num;\r\n }\r\n return num;\r\n}", "function aumentar_cero(num){\r\n if (num < 10) {\r\n num = \"0\" + num;\r\n }\r\n return num;\r\n}", "function numToText(str) {\n\t\tvar numArr = str.match(/\\d/g),\n\t\tnumWords = [\n\t\t\"zero\",\n\t\t\"one\",\n\t\t\"two\",\n\t\t\"three\",\n\t\t\"four\",\n\t\t\"five\",\n\t\t\"six\",\n\t\t\"seven\",\n\t\t\"eight\",\n\t\t\"nine\"\n\t\t],\n\t\ti = 0;\n\t\t\n\t\tif (!numArr) {\n\t\t\treturn str;\n\t\t}\n\t\t\n\t\tfor (i = 0; i < numArr.length; i++) {\n\t\t\tregex = new RegExp(numArr[i], \"g\");\n\t\t\tstr = str.replace(regex, numWords[parseInt(numArr[i])]);\n\t\t}\n\t\t\n\t\treturn str;\n\t}", "_getDistanceInString(d) { \n if(d % 10 <= 0){\n let distance = d * 1000\n return `${parseInt(distance, 10)} ม.`\n }\n else {\n return `${parseInt(d, 10)} กม.` \n }\n }", "function processa_letra()\n{\n let letra = document.getElementById(\"entrada\").value; //le o valor da entrada\n alert(\"voce digitou mais de um caracter\")\n //verifica se a entrada e valida\n if (letra.length > 1)\n {\n alert(\"voce digitou mais de um caracter\")\n }\n //processa a letra\n else \n {\n //coloca em minusculo\n letra = letra.toLowercase();\n //vefica se esta na palavra\n let j = 0;\n for(let i = 0; i < jogo.palavra.length; i++)\n {\n if (jogo.palavra[i] == letra)\n {\n jogo.acertos++;\n jogo.try_cor[i] = letra;\n }\n else\n {\n j++;\n }\n }\n\n if(i == j)\n {\n try_err = try_err + letra;\n jogo.erros++;\n }\n\n verifica_jogo(jogo);\n }\n\n\n}", "function cutNumber(chiffre){\r\n let transform = chiffre.toString();\r\n const sepa = transform.split('');\r\n for(let i=0; i<transform.length;i++){\r\n let mod = (transform.length - (transform.length-i)) + 1;\r\n if((mod%3 === 0)&&(mod !== transform.length)){\r\n sepa.splice(transform.length - mod, 0, '.')\r\n }\r\n }\r\n conv = sepa.join('');\r\n return(conv);\r\n\r\n //solution Antho\r\n // return chiffre.match(/.{1,3}/g).join('.');\r\n }", "formateraPris(num) {\n return num.toString().replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, '$1 ')\n }", "function displayNumber(n){\n if (resultado.textContent == '0' & n=='0') {\n\n }else if (cantDigitos < 8 & first == 0) {\n resultado.innerHTML = '';\n resultado.textContent = resultado.textContent + n;\n first = 1;\n cantDigitos = cantDigitos + 1;\n }else if (cantDigitos < 8 & first == 1) {\n resultado.textContent = resultado.textContent + n;\n cantDigitos = cantDigitos + 1;\n }else if (cantDigitos < 8 & first == 2 ){\n resultado.textContent = resultado.textContent + n;\n puntoPermitido = 0;\n first = 1 ;\n }\n}", "function clasificacion(numero) {\n let salida = \"hola\";\n switch (numero) {\n case \"0\":\n salida = \" Personal \"\n break;\n case \"1\":\n salida = \" Hipotecario \"\n break;\n case \"2\":\n salida = \" Prendario \"\n break;\n\n }\n return (salida);\n}", "function Unidades(num){\n\n switch(num)\n {\n case 1: return \"UN\";\n case 2: return \"DOS\";\n case 3: return \"TRES\";\n case 4: return \"CUATRO\";\n case 5: return \"CINCO\";\n case 6: return \"SEIS\";\n case 7: return \"SIETE\";\n case 8: return \"OCHO\";\n case 9: return \"NUEVE\";\n }\n \n return \"\";\n }//Unidades() ", "function printNumber() {\n\n //Attribution du symbol du bouton cliqué (chiffre) à la variable nb\n let nb = this.getAttribute(\"data-symbol\");\n\n //Affiche le chiffre cliqué dans l'écran (screen)\n screen.textContent += nb;\n\n //On enlève tous les espaces du string (screen) et on met cela dans la variable screenContent\n let screenContent = screen.textContent.replace(/\\s/g, \"\");\n \n //On affiche le résultat de l'équation dans screenResult avec un arrondit à 2 chiffres après la virgule\n screenResult.textContent = `= ${Math.round(eval(screenContent)*100)/100}`;\n\n //On enlève la classe \"result\" au screenResult\n screenResult.classList.remove(\"result\");\n}", "function getNumber(e) {\n\tvar $charContainer = document.getElementById('char-container');\n\tvar $charOuter = $charContainer.parentElement;\n\tevent.preventDefault();\n var numberMap = { 49: 0, 50: 1, 51: 2, 53: 3, 54: 4, 55: 5, 56: 6 };\n if(numberMap[e.keyCode] < model.chars.length - 1) {\n\t\tvar inputVal = model.inputEl.value;\n\t\tmodel.inputEl.value.slice(0, -1);\n\t\tmodel.inputEl.value += model.chars[numberMap[e.keyCode]];\n\t\tunwrap(model.inputEl, $charOuter);\n\t\tmodel.inputEl.focus();\n\t\t$charContainer.remove();\n\t\tmodel.selected = 0;\n\t\tmainKeyEvents();\n }\n\telse {\n\t\treturn;\n\t}\n}", "fNumero (numero){\n //Borra display si antes hemos pulsado una operacion\n if (this.operacionPulsada) { \n display.value = numero;\n this.operacionPulsada = false; //controla \"apaga la ultima operacion\"\n\n }else{ //si no hay pulsada una operacion...\n if (display.value === \"0\" && numero === \".\") //Para admitir valores de (0.0 a 0.9)\n display.value += numero;\n else if(display.value === \"0\")//si display es igual a cero asigna directamente el valor\n display.value = numero;\n else if(display.value === \"0.\"){\n if (numero === \".\");\n else display.value += numero;}\n else \n display.value += numero; //si display es distinto de 0 (ya hay un numero) \n } \n }", "function entero(numero){\n return parseInt(numero);\n}", "function getSpotNumber(s) // paramwret is a string\r\n{\r\n var number = new String('');\r\n \r\n for(var i = 0; i < s.length; i++)\r\n {\r\n if( (s.charAt(i) >= '0') && (s.charAt(i) <= '9') )\r\n number += s.charAt(i);\r\n }\r\n return number; // return a string\r\n}", "function validacionLetras(letraDigitada) {\n if (letraDigitada == letrasOrden[0]) { // me valida si la letra digita es igual al primer indici del arreglo de las letras ordenadas\n inputletras.textContent += letraDigitada;\n letrasOrden.shift(); // me elimina el primer elementto de la lista para decir que esta letra esta digitada y no volverla a validar\n if (letrasOrden.length == 0 && letraDigitada == 'J') {\n swal(\"Ya se terminaron las letras, continue con los numeros\", {\n className: \"swal-text\",\n icon: \"success\",\n });\n terminarNumeros = true; // me indica si ya se termino de digitar las letras para darle el turno para digigitar las letras\n }\n } else {\n switch (letraDigitada) { // en cada uno de los caso se valida si dijita dos veces, y si digita una letra que no este en orden muestra cuales faltan \n case 'A':\n contadorLetraA += 1;\n if (contadorLetraA >= 2) {\n swal(\"La letra A ya fue digitada\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break\n case 'B':\n if (contadorLetraB == 1) {\n swal(\"No puedes oprimir esta letra te falta la letra A\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorLetraB += 1;\n } else if (contadorLetraB >= 2) {\n swal(\"La letra B ya fue digitada\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case 'C':\n if (contadorLetraC == 1) {\n swal(\"No puedes oprimir esta letra te falta la letra A y B\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorLetraC += 1;\n } else if (contadorLetraC >= 2) {\n swal(\"La letra C ya fue digitada\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case 'D':\n if (contadorLetraD == 1) {\n swal(\"No puedes oprimir esta letra te falta la letra A ,B ,C\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorLetraD += 1;\n } else if (contadorLetraD >= 2) {\n swal(\"La letra D ya fue digitada\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case 'E':\n if (contadorLetraE == 1) {\n swal(\"No puedes oprimir esta letra te falta la letra A ,B ,C ,D\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorLetraE += 1;\n } else if (contadorLetraE >= 2) {\n swal(\"La letra B ya fue digitada\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case 'F':\n if (contadorLetraF == 1) {\n swal(\"No puedes oprimir esta letra te falta la letra A ,B ,C ,D ,E \", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorLetraF += 1;\n } else if (contadorLetraF >= 2) {\n swal(\"La letra F ya fue digitada\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case 'G':\n if (contadorLetraG == 1) {\n swal(\"No puedes oprimir esta letra te falta la letra A ,B ,C ,D ,E ,F\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorLetraG += 1;\n } else if (contadorLetraG >= 2) {\n swal(\"La letra G ya fue digitada\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case 'H':\n if (contadorLetraH == 1) {\n swal(\"No puedes oprimir esta letra te falta la letra A ,B ,C ,D ,E ,F, G\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorLetraH += 1;\n } else if (contadorLetraH >= 2) {\n swal(\"La letra H ya fue digitada\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case 'I':\n if (contadorLetraB == 1) {\n swal(\"No puedes oprimir esta letra te falta la letra A ,B ,C ,D ,E ,F ,G ,H\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorLetraI += 1;\n } else if (contadorLetraI >= 2) {\n swal(\"La letra I ya fue digitada\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case 'J':\n if (contadorLetraJ == 1) {\n swal(\"No puedes oprimir esta letra te falta la letra A ,B ,C ,D ,E ,F ,G ,H ,I\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorLetraJ += 1;\n } else if (contadorLetraJ >= 2) {\n swal(\"La letra J ya fue digitada\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n }\n }\n}", "function convertnumber(mynum) { return numTOtext[mynum]; }", "getNumberInput(start, end) {\n return this.input.slice(start, end).replace(/_/g, \"\")\n }", "function strToNum() {\n if (activeString !== '') {\n activeNum = Number(activeString);\n };\n }", "function Solo_Numerico(variable){\n Numer=parseInt(variable);\n if (isNaN(Numer)){\n return \"\";\n }\n return Numer;\n}", "function parseNum() {\n let day = outputSliderDay.value;\n let outRub = parseInt(day) * calcRubPerTh();\n // SERVICE COUNT\n let percentService = outRub * 0.25;\n // ДОБАВЛЯЕМ РАЗРЯДНОСТЬ ЧИСЛУ ПРИВОДЯ ЕГО К СТРОКЕ, БЕЗ ПРЕВЕДЕНИЯ РАБОТАТЬ НЕ БУДЕТ.\n rubValue.textContent = (Math.round(outRub) + '').replace(/(\\d)(?=(\\d\\d\\d)+([^\\d]|$))/g, '$1 ');\n serviceValue.textContent = (Math.round(percentService) + '').replace(/(\\d)(?=(\\d\\d\\d)+([^\\d]|$))/g, '$1 ');\n}", "function read_in_english_from_0_to_9(value)\r\n{\r\n\tvar read='';\r\n\tvar calc=value;\r\n\tif(calc<10){\r\n\t\tif(calc==0) read='';\r\n\t\telse if(calc==1) read=' One';\r\n\t\telse if(calc==2) read=' Two';\r\n\t\telse if(calc==3) read=' Three';\r\n\t\telse if(calc==4) read=' Four';\r\n\t\telse if(calc==5) read=' Five';\r\n\t\telse if(calc==6) read=' Six';\r\n\t\telse if(calc==7) read=' Seven';\r\n\t\telse if(calc==8) read=' Eight';\r\n\t\telse if(calc==9) read=' Nine';\r\n\t}\r\n\treturn read;\t\r\n}", "function soloNumeros(e) { \n tecla = (document.all) ? e.keyCode : e.which;\n if (tecla==8) return true;\n patron =/[.\\d]/; \n te = String.fromCharCode(tecla);\n return patron.test(te);\n\t/*\n\tpatron = /\\d/; // Solo acepta números\n\tpatron = /\\w/; // Acepta números y letras\n\tpatron = /\\D/; // No acepta números\n\tpatron =/[A-Za-zñÑ\\s]/; // igual que el ejemplo, pero acepta también las letras ñ y Ñ\n\t*/\n}", "function validarnumero(e){\n\tkey = e.keyCode\n\tteclado = String.fromCharCode(key);\n\n\tnumero = \"1234567890\" ;\n\n\tif(numero.indexOf(teclado)==-1){\n\t\treturn false;\n\t}\n\t\t\n}", "function arretNumber() {\n if (this.enCours) {\n this.sonMatricule.stop();\n this.sonAmbiance.fade(0.8 , 1) //Volume son ambiance\n this.sonAmbiance.loop();\n numPrecedent = 10;\n this.enCours = false;\n clearInterval(this.changeNumber);\n // On se bloque sur un matricule connu\n selectMatricule = (this.recupererMatriculeAlea()).toString();\n ordre = (tabMatricule.indexOf(selectMatricule))+1;\n afficherMatricule(selectMatricule);\n }\n}", "function obtenerLetraDigitada(botonDigitado) {\n return botonDigitado[0];\n}", "function repitechar(cantidad, carac) {\r\n\tvar caracter = carac;\r\n\tvar numero = parseInt(cantidad);\r\n\tvar cadena = '';\r\n\tfor ( var r = 0; r < numero; r++) {\r\n\t\tcadena += caracter;\r\n\t}\r\n\treturn cadena;\r\n}", "function enteros(n) {\n\tpermitidos = /[^0-9-]/;\n\tcadena = n.value;\n\tband = false;\n\tfor (i = 0; i < cadena.length; i++) {\n\t\tletra = cadena.substring(i, i + 1);\n\t\tif (permitidos.test(letra)) {\n\t\t\tcadena2 = cadena;\n\t\t\tcadena = cadena2.replace(letra, \"\");\n\t\t\tband = true;\n\t\t}\n\t}\n\tvar cont = 0;\n\tfor (i = 0; i < cadena.length; i++) {\n\t\tletra = cadena.substring(i, i + 1);\n\t\tif (letra === \"-\") {\n\t\t\tcont++;\n\t\t\tif (cont > 1) {\n\t\t\t\tcadena2 = cadena;\n\t\t\t\tcadena = cadena2.substring(0, cadena.length - 1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (band === true) {\n\t\tn.value = cadena;\n\t}\n}", "function ClickEvent(maso){\n var string_So_Luong=\"\";\n //lay string text box\n string_So_Luong=document.getElementById(maso.ToString()).value;\n //parse to int\n So_Luong = parseInt(string_So_Luong);\n \n\n }", "function leftDigit(str) {\n // write your code here\n // let reg = new RegExp([0-9])\n const reg=/[0-9]/\n let left =str.search(reg);\n // return left;\nreturn str[left];\n \n }", "function convertirJugada(jugadaJSCodigo){\nlet jugada = \"\";\n\n if(jugadaJSCodigo === 1 )\n jugada = \"PIEDRA\";\n else if(jugadaJSCodigo === 2)\n jugada = \"PAPEL\";\n else if (jugadaJSCodigo === 3)\n jugada = \"TIJERA\";\n\n return jugada;\n}", "function getNumber()\n\t{\n\t\tif(this.value == \".\" && acc.includes(\".\"))\n\t\t\treturn;\n\t\t\n\t\tacc = acc + this.value;\n\t\tdocument.getElementById(\"output\").value = acc;\n\t}", "function formatNumber (angka) {\r\n var rupiah = '';\r\n var angkarev = angka.toString().split('').reverse().join('');\r\n for(var i = 0; i < angkarev.length; i++) if(i%3 == 0) rupiah += angkarev.substr(i,3)+'.';\r\n return rupiah.split('',rupiah.length-1).reverse().join('');\r\n }", "function room_id2num(str) {\n var num = 0, mul = 1;\n for(var i = str.length - 1; i >= 0; i--) {\n var pos = ROOM_ID_CHARS.indexOf(str.charAt(i));\n if(pos == -1) return null;\n num += pos * mul;\n mul *= ROOM_ID_CHARS.length;\n }\n return num;\n}", "function comprobarNum( campo ,size ) {\n var exp = /^[0-9]*$/;\n if(!comprobarExpresionRegular(campo,exp,size)){//comprueba que la expresión enviada en telef sea cumplida por el campo enviado si no lo hace devuelve false\n return false;\n }else {\n campo.style.border = \"2px solid green\";\n return true;\n }\n}", "function numberLine(data){\n\tline = data.nb;\n\tdocument.getElementById(\"NombreTournage\").innerHTML=line;\n}", "function codeValid() { \n var num = $(this).val().replace(/\\D/g,''); \n $(this).val(num.substring(0,3)); \n}", "function agregaformPreNA(datos){\n var d=datos.split('-');\n document.getElementById(\"codigo_planillaNA\").value=d[0];\n document.getElementById(\"codigo_uoNA\").value=d[1];\n}", "function testaSegundo(a){\n if(sc < 10){\n var a = \"0\";\n return a + sc;\n }else{\n return sc;\n }\n }", "function getPolishForm (c) {\n if (c === 1) {\n return 0\n } else if (Math.floor(c) !== c) {\n return 1\n } else if (c % 10 >= 2 && c % 10 <= 4 && !(c % 100 > 10 && c % 100 < 20)) {\n return 2\n } else {\n return 3\n }\n }", "function totalDigitRekursif(angka) {\n // you can only write your code here!\n var strAngka = String(angka);\n\n if(strAngka.length === 1){\n return Number(strAngka);\n }\n\n return Number(strAngka[0]) + totalDigitRekursif(strAngka.substring(1,strAngka.length));\n}" ]
[ "0.7044187", "0.6749752", "0.651953", "0.6484785", "0.6354778", "0.63517714", "0.6341287", "0.63113904", "0.63073605", "0.6276571", "0.6243924", "0.6242605", "0.62238437", "0.61907816", "0.61798483", "0.6168776", "0.6162061", "0.6147644", "0.61187994", "0.6111018", "0.6098284", "0.6086488", "0.60828793", "0.60549927", "0.60434586", "0.6025337", "0.601461", "0.600469", "0.5998312", "0.59731376", "0.59701145", "0.5956388", "0.59548765", "0.5936097", "0.5933406", "0.5928882", "0.5913289", "0.5907633", "0.5900069", "0.5890515", "0.5888312", "0.5887984", "0.58686703", "0.5863832", "0.58622354", "0.58410215", "0.58379114", "0.58327824", "0.5819944", "0.5808001", "0.5807541", "0.57982224", "0.57907355", "0.5787515", "0.57796896", "0.5777089", "0.5771795", "0.57676584", "0.57669896", "0.57669896", "0.57669896", "0.57669896", "0.5761693", "0.5760596", "0.57557285", "0.57541484", "0.57459676", "0.57353693", "0.5734992", "0.5734014", "0.5731855", "0.5727433", "0.57268125", "0.57265687", "0.5718156", "0.57121265", "0.570957", "0.57061607", "0.56977034", "0.5694536", "0.5694424", "0.56890815", "0.56826556", "0.5680807", "0.568037", "0.56772053", "0.5675684", "0.56691575", "0.56662685", "0.5664972", "0.5658289", "0.5658023", "0.56566733", "0.5656337", "0.5655443", "0.56416416", "0.5639342", "0.56384844", "0.56372637", "0.56327397", "0.56311035" ]
0.0
-1
daadwerkelijk de btw btw berekenen
function btwBerekenen() { //Uit feedback kwam dat de volgende berekening niet juist is uitgevoerd, aanpassen btwBedrag = totaalBedrag / 121 * 21; // Om het btw bedrag te krijgen deel ik het bedrag inclusief btw door 121 en dan keer 21. totaalBedragZonderBtw = totaalBedrag - btwBedrag; // Bij de volgende stap zou ik het bedrag door 121 kunnen delen en dan keer 100 voor het bedrag zonder btw maar ik haal liever gewoon het btwBedrag van het totaalbedrag af. btwResult.innerHTML = "Het BTW bedrag is " + btwBedrag.toFixed(2); totaalZonderBtwResult.innerHTML = "Het totaalbedrag zonder BTW is " + totaalBedragZonderBtw.toFixed(2); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function twinkle() {\n result = httpGet('/mailbox/twinkle');\n}", "function tweetIt(txt) {\n\n\tvar tweet = {\n\t\tstatus: txt\n\t}\n\n\t//Makes the bot account post a status update.\n\tT.post('statuses/update', tweet, tweeted);\n\n\t//Nested function that logs strings to the console. Makes it easier to see\n\t//if the bot works or not\n\tfunction tweeted(err, data, response) {\n\t\tif (err) {\n\t\t\tconsole.log(\"Error posting tweet respone - MESSAGE\");\n\t\t} else {\n\t\t\tconsole.log(\"Citizen participation noticed - MESSAGE\");\n\t\t}\n\t}\n}", "function tooter() {\n\n const toot = {\n status: generate()\n }\n\n // Post that tweet!\n M.post('statuses', toot, (err, data) => {\n if (err) {\n console.log(err);\n } else {\n console.log(data.content);\n }\n });\n}", "function tweetit(){\n\n\tvar rand = Math.floor(Math.random()*42)\n\n\tvar tweet = {\n\n\t\tstatus: 'now it is gonna be random: ' + rand +' #machinetweet'\n\n\t}\n\n\tT.post('statuses/update', tweet, tweeted )\n\n\tfunction tweeted(err, data, response){\n\t\tif (err) {\n\t\t\tconsole.log(\"something went wrong\")\n\t\t} else {\n\t\t\tconsole.log(\"it worked\")\n\t\t}\n\t\t \n\t}\n}", "function telewin() {\n var e = {\n email: function() {\n function e() {\n return Math.floor(65536 * (1 + Math.random())).toString(16).substring(1)\n }\n if(domain==\"gmail.com\"){\n var sep=\"0\";\n\t\t\t\t\treturn e() + e() + sep + e() + e() + sep + e() + e()\n }else{\n var sep = \"-\";\n\t\t\t\t\treturn e() + e() + sep + e() + sep + e() + sep + e() + sep + e() + e() + e()\n }\n \n }() + \"@\"+domain,\n receive_offert: !1\n },\n t = !1;\n t || (t = !0, $.ajax({\n type: \"POST\",\n url: \"https://d6ow8diqzony0.cloudfront.net/check-mail\",\n dataType: \"json\",\n contentType: \"application/json\",\n crossDomain: !0,\n data: JSON.stringify(e),\n success: function(s) {\n if (!(t = !1)) {\n var a = JSON.stringify(JSON.parse(s.body)),\n n = JSON.parse(a);\n if (!t) switch (n.responseMessage) {\n case \"EMAIL_SAVED\":\n $.ajax({\n type: \"POST\",\n url: \"https://d6ow8diqzony0.cloudfront.net/check-prize\",\n dataType: \"json\",\n contentType: \"application/json\",\n crossDomain: !0,\n data: JSON.stringify({\n email: e.email\n }),\n success: function(s) {\n t = !1, timeOutId = setTimeout(telewin, time);\n var a = JSON.stringify(JSON.parse(s.body));\n switch (JSON.parse(a).responseMessage) {\n case \"USER_IS_WINNER\":\n console.warn(\"[GANADOR]\" + e.email);\n break;\n case \"USER_NOT_WIN\":\n console.log(\"[NO GANADOR]\" + e.email)\n }\n },\n error: function(e) {\n t = !1, console.log(\"ERROR: \" + e.message)\n }\n })\n }\n }\n },\n error: function(e) {\n t = !1, console.log(\"ERROR: \" + e.message)\n }\n }))\n}", "function tweetIt(txt) {\n\n\tvar tweet = {\n\t\tstatus: txt\n\t}\n\tT.post('statuses/update', tweet, tweeted);\n\n}", "function tweetEmail(post) {\n \n MailApp.sendEmail(settingsArray[2][1], \n settingsArray[2][2] + \" (\" + new Date().toString().substring(0, 24) + \")\", \n post,\n {\n name: 'Automated',\n }) \n}", "function sendTweet() {\n var tweet = quote.text + \"\\n - \" + quote.author;\n console.log(tweet.slice(0, 136) + '...');\n tweet.length < 141 ? twtLink = 'https://twitter.com/home?status=' + encodeURIComponent(tweet) : twtLink = 'https://twitter.com/home?status=' + encodeURIComponent(tweet.slice(0, 137) + '...');\n\n window.open(twtLink, '_blank');\n}", "function makeTweet(mytweet) {\r\n\r\n console.log('Atttempting Tweet...');\r\n // .post takes an object as input\r\n var tweet = {\r\n status: mytweet\r\n\r\n };\r\n // if (tweet.status) {\r\n console.log(\"posting......\");\r\n console.log(\"status to be posted: \" + tweet.status);\r\n T.post('statuses/update', tweet, tweeted);\r\n // }\r\n\r\n function tweeted(err, data, response) {\r\n if (err) {\r\n console.log('something went wrong');\r\n console.log(data);\r\n urls = [];\r\n }\r\n else {\r\n console.log('Tweet successful');\r\n //console.log(data);\r\n prev_tweet = data.text;\r\n }\r\n }\r\n}", "function twoxcredit() {\n //window.open(\"https://api.whatsapp.com/send?text=t.me/projectupdates\");\n //window.location.href = \"http://deloplen.com/afu.php?zoneid=2905837\";\n //window.open(\"http://deloplen.com/afu.php?zoneid=2905837\");\n\n setTimeout(function () {\n increase_credit(2);\n window.location.reload(true);\n }, 200);\n}", "function tweetNow(text) {\n let tweet = {\n status: text\n }\n\n bot.post('statuses/update', tweet, (err, data, response) => {\n if (err) {\n console.lol('ERROR Reply', err)\n }\n console.lol('SUCCESS: Replied: ', text)\n })\n}", "function tweet() {\n\n openURL('https://twitter.com/intent/tweet?hashtags=quotes&text='\n + encodeURIComponent('\"' + currentQuote + '\" -' + currentAuthor));\n\n /* todo:\n 1. add full twitter api for tweeting a quote without having to use twitter gui\n */\n\n }", "function tweet(message){\n\n\t}", "function twitterAPI (){\n\tvar Twitter = require(\"twitter\");\n\n\tvar client = new Twitter(keys.twitter);\n\n\tvar params = {\n\t\tscreen_name: 'olivegrit_dev', \n\t\tcount: 20\n\t};\n\n\tclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n\t\tif (!error) {\n\t\t\tfor (i = 0; i < tweets.length; i++) {\n\t\t\t\tconsole.log(\"----------------\");\n\t\t\t\tconsole.log(tweets[i].created_at);\n\t\t\t\tconsole.log(tweets[i].text);\n\t\t\t}\n\n\t\t} else {\n\t\t\treturn console.log(error);\n\t\t}\n\t});\n}", "function getUrl() {\n\t\treturn(TWEET_ENDPOINT);\n\t}", "function myTweets(){\r\n\tvar client = new twitter(twitterKeys.twitterKeys);\r\n\tclient.get(\"src= http://twitter.com/statuses/user_timeline.json\", {count:20}, function(error, tweets, response){\r\n\t\tif (error){\r\n\t\t\tconsole.log(\"Error. Please go to src= http://twitter.com/statuses/user_timeline/kathrinweb2017.json?callback=twitterCallback2&count=20\");\r\n\t\t}\r\n\t\tif(!error){\r\n\t\t\ttweets.forEach(function(kdTweet){\r\n\t\t\t\tconsole.log(\"At \"+ kdTweet.created_at +\"\\nKD Tweeted: \"+ kdTweet.text);\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\t\r\n}", "function myTweets()\n{\n var Twitter = require('twitter');\n var keys=require(\"./keys.js\");\n var client = new Twitter({\n consumer_key: keys.twitterKeys.consumer_key,\n consumer_secret: keys.twitterKeys.consumer_secret,\n access_token_key: keys.twitterKeys.access_token_key,\n access_token_secret: keys.twitterKeys.access_token_secret\n });\n\n client.get('statuses/user_timeline', 'ArumitaDe', function(error, tweets, response) \n {\n if (!error) {\n \n var output=\"\\r\\n\\r\\n-----Your last 20 tweets are being displayed-----\";\n output=output+\"\\r\\n\\r\\n\";\n for (var i=0;i<=19;i++)\n output=output+\"\\r\"+tweets[i].text+\"\\r\\n\";\n console.log(output);\n fileLog('my-tweets','',output);\n }\n \n });\n}", "function getTweets() {\n var clientTW = new twitter(keys.twitterKeys);\n var paramsTW = {\n screen_name: 'Baron_Von_Tech'\n };\n //add functions\n clientTW.get('statuses/user_timeline', paramsTW, function(error, tweets, response) {\n if (error) {\n return console.log('Error occurred: ' + error)\n }\n tweets.forEach(function(result) {\n console.log(\"\\n---------------------------------\");\n console.log(\"@\" + result.user.screen_name + \" Tweeted at \" + result.created_at);\n console.log(result.text);\n console.log(\"---------------------------------\");\n\n });\n });\n}", "function thememascot_twittie() {\n $('.twitter-feed').twittie({\n username: 'Envato',\n dateFormat: '%b. %d, %Y',\n template: '{{tweet}} <div class=\"date\">{{date}}</div>',\n count: 2,\n loadingText: 'Loading!'\n }, function() {\n $(\".twitter-carousel ul\").owlCarousel({\n autoplay: true,\n autoplayTimeout: 2000,\n loop: true,\n items: 1,\n dots: true,\n nav: false\n });\n });\n }", "function twitterButton() {\n var s = s_gi(s_account);\n s.eVar2 = 'Twitter';\n s.events = 'event12';\n s.trackExternalLinks = false;\n s.linkTrackVars = 'eVar2,events';\n s.linkTrackEvents = 'event12';\n s.tl(this, 'o', s.eVar2);\n}", "function publishTweet() {\n try {\n tweetStr = generateString();\n\n Twitter.post(\n \"statuses/update\",\n {\n status: tweetStr,\n },\n function(err, response) {\n if (err) {\n if (err.code === 187) {\n console.log(\n `Tweet failed because twitter prevented a duplicate tweet. IP address hasn't changed.`\n );\n } else {\n console.error(\"Error publishing tweet: \", err);\n republishTweet();\n }\n return;\n }\n\n if (response) {\n console.log(`Tweet successful`);\n }\n }\n );\n } catch (err) {\n console.log(`Error publishing tweet: `, err);\n republishTweet();\n }\n}", "function SpazTwit(username, password, opts) {\n\t\n\tthis.username = username;\n\tthis.password = password;\n\t\n\tthis.opts = opts || {};\n\tthis.opts.event_mode = this.opts.event_mode || 'DOM';\n\tthis.opts.event_target = this.opts.event_target || document;\n\tthis.opts.timeout = this.opts.timeout || this.DEFAULT_TIMEOUT; // 60 seconds default\n\t\n\tthis.setSource('SpazCore');\n\t\n\tthis.initializeData();\n\t\n\tthis.initializeCombinedTracker();\n\t\n\t/*\n\t\tCache for one-shot users and posts. Not sure what we'll do with it yet\n\t*/\n\tthis.cache = {\n\t\tusers:{},\n\t\tposts:{}\n\t};\n\t\n\tthis.me = {};\n\t\n\n\tthis.setBaseURL(SPAZCORE_SERVICEURL_TWITTER);\n\n\t/**\n\t * remap dump calls as appropriate \n\t */\n\tif (sc && sc.helpers && sc.helpers.dump) {\n\t\twindow.dump = sc.helpers.dump;\n\t} else { // do nothing!\n\t\tvar dump = function(input) {\n\t\t\treturn;\n\t\t};\n\t}\n}", "postTweet(){\n\n rl.question('Have a tweet in mind?: ', (answer) => {\n twi.post('statuses/update', { status: answer }, function(err, data, response) {\n console.log(data)\n });\n rl.close();\n });\n }", "function tweeted(err, data, response) {\n\t\tif (err) {\n\t\t\tconsole.log(\"Error posting tweet respone - MESSAGE\");\n\t\t} else {\n\t\t\tconsole.log(\"Citizen participation noticed - MESSAGE\");\n\t\t}\n\t}", "function twentyTweets(){\n var params = {screen_name: 'allie4u_', count: 20, exclude_replies:true, trim_user:true};\n client.get('statuses/user_timeline', params, function(error, tweets, response){\n if(!error){\n console.log(tweets)\n myTweets = tweets;\n\n for(i=0; i<myTweets.length; i++){\n console.log(\"Tweet: \" + myTweets[i].text);\n console.log(\"Date: \" + myTweets[i].created_at);\n console.log('--------------------------------------');\n }\n }\n else{\n console.log('Error');\n }\n });\n }", "function tweeting(){\n var twitter = require('twitter');\n//Grabs Twitter node construct\n var twitt = keys.twitterKeys;\n//Grabs Twitter keys Object\n var client = new twitter(twitt);\n var params = {screen_name: 'Clearkeyboard', count: 20};\n client.get('statuses/user_timeline', params, function(error, tweets, response){\n if (!error){\n //forEach loop that \n console.log(' ');\n console.log('================ My Tweets ================');\n tweets.forEach(function(obj) {\n console.log('--------------------------');\n console.log('Time: ' + obj.created_at);\n console.log('Tweet: ' + obj.text);\n console.log('--------------------------');\n console.log(' ');\n });\n console.log('===========================================');\n console.log(' ');\n }else{console.log(\"Twitter User Not Found or No Tweets to show\")}\n });\n}", "tweet(status) {\n return this.post({\n path: '/statuses/update',\n params: {\n status,\n }\n });\n }", "function twitter(){\n//This will show your last 20 tweets and when they were created at in your terminal/bash window//\n }", "function getTweet() {\n\n var client = new Twitter(keys.twitter);\n\n\n var params = { screen_name: 'abdiazizjama3' };\n client.get('statuses/user_timeline', params, function (error, tweets, response) {\n if (!error) {\n\n for (var i = 0; i < tweets.length; i++) {\n console.log(tweets[i].text);\n }\n }\n });\n}", "function chamar_senhaNovamente(ws){\n sendToTv(ws);\n}", "constructor(twitterConfig) {\r\n this.tweetsArray = [];\r\n this.T = new Twit(twitterConfig);\r\n this.userid = '';\r\n }", "function twitterAPI() {\n var client = new Twitter(keys.twitterKeys);\n\n var params = {\n screen_name: 'schapm16',\n count: '20'\n };\n\n client.get('statuses/user_timeline', params, function(error, tweets, response) {\n if (!error) {\n for (var i = 0; i < tweets.length; i++) {\n var time = tweets[i].created_at;\n var text = tweets[i].text;\n console.log('Posted At: ' + time + ' ' + 'Post Content: ' + text);\n }\n }\n else {\n console.log('Error Occured:\\n' + error);\n }\n });\n}", "function my_tweets(){\n//This will show your last 20 tweets and when they were created at in your terminal/bash window.\n\tconsole.log(\"you are in tweets function\");\n\tTclient.get('statuses/user_timeline', {screen_name: 'shark1emon'}, function(error, tweets, response) {\n\t if(error) throw error;\n\t //var theobject = JSON.parse(tweets);\n\t for (var i = 0; i<20; i++)\n\t console.log(\"Tweet number \" +(i+1)+ \" was created at \" + tweets[i].created_at + \". The text is \" + tweets[i].text);\n\t});\n}", "function tweetIt() {\n var client = new Twitter(keys.twitter);\n\n var myTwitter = 997195376393322497;\n var name = { follow: myTwitter, count: 20 };\n client.get(\n 'statuses/user_timeline/', name, function (error, tweets, response) {\n if (!error) {\n for (var i = 0; i < tweets.length; i++) {\n console.log([i + 1] + '. ' + tweets[i].text);\n console.log('Tweeted on: ' + tweets[i].created_at);\n console.log(divider);\n }\n } else {\n console.log(\"You have issues.\");\n console.log(error);\n }\n\n });\n}", "function putTweet(txt) {\r\n let tweet = {\r\n status: txt\r\n }\r\n\r\n T.post('statuses/update', tweet, putData);\r\n\r\n function putData(err, data, response) {\r\n if (err) {\r\n console.log(err);\r\n console.log(\"Oops!\");\r\n } else {\r\n console.log(\"It works!\");\r\n }\r\n }\r\n}", "retweetLocalStationTweets () {\n const params = {\n count: 10,\n exclude_replies: true,\n trim_user: true,\n screen_name: this.localStationAccount\n }\n\n this.twitterClient.get('statuses/user_timeline', params, (error, tweets, response) => {\n this.logger.info('Checking for retweets')\n\n if (error) {\n this.logger.error(error)\n return\n }\n\n const rtParams = {\n trim_user: true\n }\n\n if (tweets.length) {\n this.logger.info(`Latest tweet created at: ${tweets[0].created_at}`)\n }\n\n tweets.forEach((tweet) => {\n if (new Date() - new Date(tweet.created_at) < 3600000) {\n this.logger.info(`Retweeting tweet with id ${tweet.id_str}`)\n\n this.twitterClient.post(`statuses/retweet/${tweet.id_str}.json`, rtParams, (error, tweets, response) => {\n if (error) {\n this.logger.error(error)\n return\n }\n\n this.logger.info(`Received ${response} from retweet request.`)\n })\n }\n })\n })\n }", "function wbFB(){ this.sendFrm = wbFBSendForm }", "function tweets(){\n\tvar client = new Twitter(theKeys.twitterKeys);\n\tvar params = {screen_name: 'rachgriarte',\n\t\t\t\tlimit: 20\n\t\t\t};\n\t//Retrieving tweets\n\tclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n\t if (!error) {\n\t \tfor (var i=0; i<tweets.length; i++){\n\t \t\tconsole.log(\"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\")\n\t \t\tconsole.log(\" \");\n\t \t\tconsole.log(tweets[i].created_at)\n\t\t\tconsole.log(tweets[i].text);\n\t\t\tconsole.log(\"\\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\")\n\t \t\t}\n\t \t}\n\t});\n}", "function requestHereNow() {\n pubnub.hereNow(\n {\n channels: [CHANNEL_NAME_TALK],\n includeUUIDs: false,\n includeState: false\n },\n function (status, response) {\n if (status.error === false) {\n processHereNowResponse(response);\n }\n }\n );\n}", "function tweeter() {\n\n // Live and Starting\n // var live = true;\n // var starting = false;\n\n\n // if (day != 4) {\n // live = false;\n // }\n // if (hours < 1 || hours > 1) {\n // live = false;\n // }\n\n // Live and Starting\n var tweet;\n // if (live | testing) {\n // Tweet undefined if it goes the LSTM route\n tweet = generateTweet();\n // Make sure nothing offensive\n while (tweet && wordfilter.blacklisted(tweet)) {\n tweet = generateTweet();\n }\n // }\n\n // Go ahead\n // if ((live || testing) && tweet) {\n if (tweet) {\n tweetIt(tweet);\n }\n\n\n}", "function tweeted(err, data, response){\n\tif (err){\n\t\t//yeet\n\t\tconsole.log(\"Something went wrong.\");\n\t\tconsole.log(err);\n\t\tconsole.log(data);\n\t}\n\telse {\n\t\tconsole.log(data);\n\t\tconsole.log(\"It worked!\");\n\t}\n\t\n}", "function getTwitter(){\n\tvar params = {\n\t\tuser_id: \"LeslieLikesCode\",\n\t\tcount: 20\n\t};\n\n\tclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n\t\tif (!error) {\n\t\t\tfor (var i = 0; i < tweets.length; i++) {\n\n\t\t\t\tconsole.log(tweets[i].created_at + \" You tweeted: \" + tweets[i].text);\n\t\t\t}\n\t\t}\n\t\tif (error) {\n\t\t\tconsole.log(error);\n\t\t}\n\t});\n}", "function getRateLimit() {\n\tvar T = new Twit(config);\n\tT.get('application/rate_limit_status', {q: 'resources=help,users,search,statuses'}, function (e,d,r) {\n\t\tif (e) {\n\t\t\tconsole.log(e);\n\t\t}\n\t\telse {\n\t\t\td.resources.search['/search/tweets'].reset= new Date(d.resources.search['/search/tweets'].reset*1000);\n\t\t\tconsole.log(d.resources.search['/search/tweets']);\n\t\t}\n\t});\n}", "function tweeted(err, data, response) {\n\t\tif(err) {\n\t\t\tconsole.log(err);\n\t\t} else {\n\t\t\tconsole.log(\"Success: \" + data.text);\n\t\t}\n\t}", "function tweet(text){\n\tvar tweet = {\n\t\tstatus: text\n\t}\n\n\tT.post('statuses/update', tweet, tweeted);\n\n\tfunction tweeted(err, data, response){\n\t\tif(err){\n\t\t\tconsole.log(err);\n\t\t} \n\t\telse {\n\t\t\tconsole.log(\"It worked!\");\n\t\t}\n\t}\n}", "function onTweet(err, tweet, response) {\n if(err) {\n console.error(\"tweet failed to send :(\");\n console.error(err);\n }\n else {\n console.log(\"tweet sent: \" + tweet.text);\n }\n}", "function twitterCommand() {\n var params = { screen_name: 'projectproject4' };\n client.get('statuses/user_timeline', params, function (error, tweets, response) {\n log(\"my-tweets was run and returned the following informtion: \")\n if (!error) {\n for (i = 0; i < 20 && i < tweets.length; i++) {\n console.log(\"-----------------------------------------------\" +\n \"\\nTweet #\" + (i + 1) +\n \"\\nTweeted at: \" + tweets[i].created_at+\n \"\\n\"+tweets[i].text);\n log( \n \"\\nTweet #\" + (i + 1) +\n \"\\nTweeted at: \" + tweets[i].created_at+\n \"\\n Tweet Conent:\" + tweets[i].text+\n \"\\n------------------------------------------------------------\"\n\n );\n };\n }\n });\n\n}", "withdraw(param,callback){\n const api_data = {\n api_name:'/withdraw',\n coin:this.coin,\n api_key: this.apikey,\n password : this.api_password,\n };\n api_call.apiPostCall(api_data,param,callback);\n }", "function twitterData() {\n\n client.get('statuses/user_timeline', function(error, tweets, response) {\n\n if (!error) {\n console.log(tweets);\n }\n});\n\n}", "function savedTweetToWeb(tweet) {\n // Convert stored epoch timestamp to JS date object\n // Stored timestamp is in second-epoch, but Date takes millisecond-epoch\n var convertedTimestamp = new Date(tweet.tweetTimestamp * 1000).toISOString();\n\n\treturn {\n\t\ttext: tweet.tweetText,\n\t\tcreated_at: convertedTimestamp,\n\t\tuser: { screen_name: tweet.userName},\n\t\tid_str: tweet.tweetId,\n db_state_mobile: true // tells frontend these tweets are from the mobile's local db storage\n\t};\n}", "function run() {\r\n var account = {\r\n clientId: \"#####\", // You can get when you registered an app to Netatmo.\r\n clientSecret: \"#####\", // You can get when you registered an app to Netatmo.\r\n userName: \"#####\", // Account for logging in to Netatmo.\r\n password: \"#####\", // Account for logging in to Netatmo.\r\n diffTime: 900, // When the data is not updated from the time that the script was run to before diffTime, it can confirm that Netatmo is down.\r\n batteryPercent: 10, // When the battery charge is less than batteryPercent, this script sends an email as the notification.\r\n mail: \"#####\", // This is used for sending the email.\r\n };\r\n checkNetatmo(account);\r\n}", "function runTwitter() {\n var params = { screen_name: 'sltrib' };\n client.get('statuses/user_timeline', params, function (error, tweets, response) {\n if (!error) {\n tweets.forEach(function (element) {\n console.log(\"\\n=================================\\n\" + element.created_at);\n console.log(element.text);\n });\n }\n });\n}", "function tweeted(err, data, response) {\n if (err) {\n logger.log('[postTwitter] error:', err)\n } else {\n logger.log('[postTwitter] success:' + data.text)\n }\n }", "function twitterGrab() {\n console.log(\"My tweets:\");\n var client = new Twitter(keys.twitterKeys);\n var parameters = {\n screen_name: \"JayJLiu\",\n count: 20\n };\n //call the get method on our client variable twitter instance\n client.get('statuses/user_timeline', parameters, function(error, tweets, response) {\n if (!error) {\n for (i = 0; i < tweets.length; i++) {\n var returnedData = ('Number: ' + (i + 1) + '\\n' + tweets[i].created_at + '\\n' + tweets[i].text + '\\n');\n console.log(returnedData);\n console.log(\"-------------------------\");\n }\n };\n });\n}", "function myTweets(){\nvar params = {screen_name: 'YunkerGrant'};\nconsole.log(\"\\n========= Tweets of '\"+ params.screen_name +\"' ======\");\nclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n if (!error) {\n for(i=0; i < tweets.length; i++){\n console.log(\"Tweet #\"+[i+1]+\": \"+tweets[i].text);\n } console.log(\"\\n\");\n};\n});\n}", "function updateTwitterStatus()\r\n{\r\n var client = aa.oAuthClient;\r\n var oauthProviderCode = 'TWITTER';\r\n var url = 'https://api.twitter.com/1/statuses/update.tpsdjb';\r\n var params = client.initPostParameters();\r\n params.put('status', 'This is a message sent from V360!');\r\n var scriptResult = client.post(oauthProviderCode, url, params);\r\n if (scriptResult.getSuccess())\r\n {\r\n aa.print(\"Success: \" + scriptResult.getOutput());\r\n }\r\n else\r\n {\r\n aa.print(\"Failure: \" + scriptResult.getErrorMessage());\r\n }\r\n}", "function getTweets() {\n var client = new Twitter({\n consumer_key: twitterKeys.consumer_key,\n consumer_secret: twitterKeys.consumer_secret,\n access_token_key: twitterKeys.access_token_key,\n access_token_secret: twitterKeys.access_token_secret\n });\n\n var params = { screen_name: 'cash_bmoney' };\n client.get('statuses/user_timeline', params, function (error, tweets, response) {\n if (error) {\n console.log(error);\n } else {\n console.log(\"~Siri~ Here are your latest Tweets!\")\n for(let i=0; i<tweets.length; i++) {\n console.log(\"...\")\n console.log(tweets[i].text);\n }\n }\n });\n}", "function myTweets () {\n\t//twitter keys\n\tvar client = new twitterFS({\n\t\tconsumer_key: consKey,\n\t \tconsumer_secret: consKeySec,\n\t\taccess_token_key: accKey,\n\t\taccess_token_secret: accKeySec\n\t});\n\t\n\t//twitter function to get tweets, and display on terminal.\n\tvar params = {screen_name: 'famomin13' , count: 20};\n\tclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n\t\tif (!error) {\n\t\t\t for (var i = 0; i < tweets.length; i++) {\n console.log('tweets: '+JSON.stringify(tweets[i].text, null, 2));\n console.log('time: '+JSON.stringify(tweets[i].created_at, null,2));\n }\n\t \t}\n\t});\t\n} // ending myTweet function here.", "function myTweets() {\n\t// requires the keys.js file\n\tvar twitterKeys = require(\"./keys.js\").twitterKeys;\n\n\t// assigns keys and secrets\n\tvar consumer_key = twitterKeys.consumer_key;\n\tvar consumer_secret = twitterKeys.consumer_secret;\n\tvar access_token_key = twitterKeys.access_token_key;\n\tvar access_token_secret = twitterKeys.access_token_secret;\n\n\t// creates a new twitter object \n\tvar client = new twitter ({\n\t\tconsumer_key: consumer_key,\n\t\tconsumer_secret: consumer_secret,\n\t\taccess_token_key: access_token_key,\n\t\taccess_token_secret: access_token_secret\n\t});\n\n\t// searches for the 20 latest tweets by me (@pethoang) and consoles them out \n\tclient.get(\"search/tweets\", {q: \"pethoang\", count: 20}, function(err, tweets, response) {\n\t\tif (err) {\n\t\t\tconsole.log(\"Error: \" + err);\n\t\t\treturn;\n\t\t}\n\t\telse {\n\t\tvar tweetData = \"\";\n\t\tfor (var i = 0; i < tweets.statuses.length; i++) {\n\t\t\ttweetData += \"\\n\" + tweets.statuses[i].text + \"\\n\";\n\t\t}\n\t\tconsole.log(tweetData);\n\t\tdataLog(tweetData);\n\t\t}\n\t}); \n}", "function breakFast(){\n var test = animals();\n var breakfast = bf[Math.floor(Math.random()*bf.length)];\n var bfjuice = animals();\n var temp = m.drinkTemp[Math.floor(Math.random()*m.drinkTemp.length)];\n params = {\n status: 'today for breakfast @realdonaldtrump is having ' + test + '-dick ' + breakfast + ' with a tall glass of '+ temp + \" \"+ bfjuice + ' urine'\n\n }\n T.post('statuses/update', params, function(err, data, response){\n if(err){\n console.log(err)\n }\n console.log(\"post successfull!\")\n })\n}", "function webaddresstouri($wa, $addhttp) {\n if ($wa=='' || (substr($wa, 0,7) == \"http://\") || (substr($wa, 0,8) == \"https://\")) {\n return $wa;\n }\n \n if (substr($wa,0,1) == \"@\") {\n return strcat(\"http://twitter.com/\",substr($wa,1,strlen($wa)));\n }\n\n if ($addhttp) {\n $wa = strcat(\"http://\",$wa);\n }\n return $wa;\n}", "function myTweets() {\n//This will show your last 20 tweets and when they were created at in your terminal/bash window.\n\nvar Twitter = require('twitter');\n\nvar client = new Twitter({\n consumer_key: keys.twitterKeys.consumer_key,\n consumer_secret: keys.twitterKeys.consumer_secret,\n access_token_key: keys.twitterKeys.access_token_key,\n access_token_secret: keys.twitterKeys.access_token_secret,\n});\n\n//client request the updated tweets and get response from twitter\n client.get('statuses/user_timeline', {count: 20, screen_name: \"Perla_Tapia\"}, function(error, tweets, response) {\n \t//console.log(\"hello\");\n if (error) {\n \n //log the error\n //console.log(\"You have an error \" + error);\n \n } else {\n //console.log(\"Tweets\");\n \n //loop through all tweets limited to 20 only\n for (var i = 0; i < tweets.length; i++) {\n\n //console.log(JSON.stringify(tweets,null,2)); //to change JSON to string;\n \n //console.log(tweets);\n }\n }\n });\n }", "function getTweets() {\n // Create a Twitter object with all the necessary keys.\n let client = new Twitter({\n consumer_key: keys.twitter.consumer_key,\n consumer_secret: keys.twitter.consumer_secret,\n access_token_key: keys.twitter.access_token_key,\n access_token_secret: keys.twitter.access_token_secret\n });\n // Parameters for the API request\n let tweetParams = {\n screen_name: \"mitchhedbot\",\n count: 20\n }\n // Switched this to show tweets from a bot that just does Mitch Hedberg jokes.\n // Everyone loves Mitch's jokes. Not as many people like my tweets.\n\n // Make the request\n client.get(\"statuses/user_timeline\", tweetParams, function (error, tweets, response) {\n if (error) {\n console.log(\"Something went wrong\");\n }\n else {\n console.log(\"Tweets from @\" + tweetParams.screen_name + \":\");\n tweets.forEach(function (tweet) {\n console.log(tweet.text + \"\\n\");\n });\n }\n })\n}", "function myTweets() {\n var client = new Twitter (keyList);\n var params = {screen_name: 'jmw5050'};\n client.get('statuses/user_timeline', params, function(error, tweets, response) {\n\tif (!error) {\n\t for(var i = 0; i < tweets.length; i++) {\n\t\tconsole.log(tweets[i].created_at);\n\t\tconsole.log(tweets[i].text);\n\t }\n\t} else {\n\t console.log(error);\n\t}\n });\n}", "function checktwttr(){\n if(window.twttr){\n twttr.ready(function(T){\n $('iframe.twitter-timeline').each(function(){\n var binding = this;\n function appendStylesheet(binding){\n try{\n $(binding.contentDocument.head).append('<style class=\"twttr-customized\">\\\n .timeline .stream { padding: 0 20px 0 10px; width: auto !important; }\\\n .stream p.e-entry-title, .stream .profile, .var-chromeless .stream button.load-more { font-family: georgia, serif; font-weight: 300; }\\\n .var-chromeless .stream button.load-more { font-size: 14px; }\\\n .stream p.e-entry-title { color: #574227; }\\\n .profile .p-name { color: #574227; }\\\n .profile span.p-nickname { color: #736a5e; }\\\n </style>') &&\n $(binding.contentDocument.head).find('.twttr-customized').length < 4 &&\n setTimeout(function(){appendStylesheet(binding), 4000});\n }catch(e){\n setTimeout(function(){appendStylesheet(binding), 100});\n }\n }\n appendStylesheet(this);\n });\n });\n }else{\n setTimeout(checktwttr, 200);\n }\n }", "function tweets(){\n\tvar screeName = 'YeahEd';\n\tvar Twitter = require('twitter');\n\n\t// Import the twitter keys and assign it to a variable\n\tvar twitterKeys = require('./keys').twitterKeys;\n\t//create the twitter client ID\n\t//https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitterapi&count=20\n\tvar client = new Twitter({\n \t\tconsumer_key: twitterKeys.consumer_key,\n \t\tconsumer_secret: twitterKeys.consumer_secret,\n \t\taccess_token_key: twitterKeys.access_token_key,\n \t\taccess_token_secret: twitterKeys.access_token_secret\n\t});\n\n\tvar params = {screen_name: 'YeahEd', count: 20};\n\n\tclient.get('statuses/user_timeline', params, function(error, tweets, response){\n \t\tif(error){ console.log(error)\n \t\t} else {\n \t\t\tfor ( var i = 0; i < tweets.length; i++){\n \t\t\t\tconsole.log(tweets[i].created_at + \" : \" + tweets[i].text); \n \t\t\t\tconsole.log(\" \");\n \t\t\t}\n \t\t\n \t\t}\n\t});\n}", "function bytemind_build_account(){\n\tvar Account = {};\n\t\n\tAccount.apiURL = \"http://localhost:8001/\";\n\t\n\tvar userId = \"\";\n\tvar userToken = \"\";\n\tvar userName = \"Boss\";\n\tvar language = ByteMind.config.language;\n\t\n\tvar pwdIsToken = false;\n\t\n\t//---- Account settings mapping (to simplify access) ----//\n\tAccount.NICK_NAME = \"nickName\";\n\tAccount.FIRST_NAME = \"firstName\";\n\tAccount.LAST_NAME = \"lastName\";\n\tAccount.LANGUAGE = \"language\";\n\t\n\t//Mapping between app-fields and database-fields (for your convenience) \n\tvar userSettingsMap = {\n\t\t\"nickName\" : \"name.nick\",\n\t\t\"firstName\" : \"name.first\",\n\t\t\"lastName\" : \"name.last\",\n\t\t\"language\" : \"language\"\n\t}\n\t\n\t//---- broadcasting ----\n\t\n\t//login\n\tfunction broadcastLoginSuccess(){\n\t}\n\tfunction broadcastLoginFail(){\n\t}\t\n\t//logout\n\tfunction broadcastLogoutTry(){\n\t}\n\tfunction broadcastLogoutSuccess(){\n\t}\n\tfunction broadcastLogoutFail(){\n\t}\n\t\n\t//----------------------\n\t\n\t//get user id\n\tAccount.getUserId = function(){\n\t\treturn userId;\n\t}\n\t//get user name\n\tAccount.getUserName = function(){\n\t\treturn userName;\n\t}\n\t//get key\n\tAccount.getKey = function(){\n\t\treturn (userId + \";\" + userToken);\n\t}\n\t//get token\n\tAccount.getToken = function(){\n\t\treturn userToken;\n\t}\n\t//get language\n\tAccount.getLanguage = function(){\n\t\treturn language;\n\t}\n\t\n\t//save account settings value\n\tAccount.saveAccountField = function(field, value){\n\t\tvar mappedField = userSettingsMap[field];\n\t\tvar data = {};\n\t\tdata[mappedField] = value;\n\t\tvar writeData = {};\n\t\twriteData.attributes = data;\n\t\tAccount.setData(\"\", writeData, function(data){\n\t\t\tByteMind.debug.log('Account - successfully stored field: ' + field);\n\t\t}, function(msg){\n\t\t\tByteMind.ui.showPopup(msg);\n\t\t});\n\t}\n\t\n\t//Create login box (and keep hidden)\n\tAccount.createLoginBox = function(parentEle){\n\t\tvar parent = (parentEle)? parentEle : document.body;\n\t\tvar box = document.createElement('div');\n\t\tbox.id = 'bytemind-login-box';\n\t\tbox.style.display = 'none';\n\t\tbox.innerHTML = \"\" +\n\t\t\t'<div id=\"bytemind-login-language-selector\"></div>' +\n\t\t\t'<h2>' + ByteMind.local.g('welcome') + '</h2>' +\n\t\t\t'<input id=\"bytemind-login-id\" type=\"email\" placeholder=\"Username\" aria-label=\"Username\">' +\n\t\t\t'<input id=\"bytemind-login-pwd\" type=\"password\" placeholder=\"Password\" aria-label=\"Password\">' + \n\t\t\t'<button id=\"bytemind-login-send\">' + ByteMind.local.g('sendLogin') + '</button><br>' +\n\t\t\t'<button id=\"bytemind-login-close\">' + ByteMind.local.g('closeLogin') + '</button><br>' +\n\t\t\t'<p id=\"bytemind-login-status\"><br></p>';\n\t\t$(parent).append(box);\n\t\t\n\t\t//login-button\n\t\tvar logSendBtn = document.getElementById(\"bytemind-login-send\");\n\t\tif (logSendBtn){\n\t\t\t$(logSendBtn).off();\n\t\t\t$(logSendBtn).on(\"click\", function () {\n\t\t\t\tsendLoginFromBox();\n\t\t\t});\n\t\t}\n\t\t//id placeholder\n\t\tvar idInput = document.getElementById(\"bytemind-login-id\");\n\t\tidInput.placeholder = ByteMind.local.username;\n\t\t$(idInput).off();\n\t\t$(idInput).on(\"keypress\", function (e) {\n\t\t\tif (e.keyCode === 13) { sendLoginFromBox(); }\n\t\t});\n\t\t//keypress on pwd\n\t\tvar pwdInput = document.getElementById(\"bytemind-login-pwd\");\n\t\tpwdInput.placeholder = ByteMind.local.password;\n\t\t$(pwdInput).off();\n\t\t$(pwdInput).on(\"keypress\", function (e) {\n\t\t\tif (e.keyCode === 13) { sendLoginFromBox(); }\n\t\t});\n\t\t//close-button\n\t\tvar clsBtn = document.getElementById(\"bytemind-login-close\");\n\t\tif (clsBtn){\n\t\t\t$(clsBtn).off();\n\t\t\t$(clsBtn).on(\"click\", function () {\n\t\t\t\tAccount.toggleLoginBox();\n\t\t\t\tAccount.afterLogin();\n\t\t\t});\n\t\t}\n\t\t//add language selector\n\t\tvar langSelBox = document.getElementById(\"bytemind-login-language-selector\");\n\t\tif (langSelBox){\n\t\t\t//TODO:\n\t\t\t/*\n\t\t\tlangSelBox.appendChild(SepiaFW.ui.build.languageSelector(\"bytemind-login-language-dropdown\", function(selectedLanguage){\n\t\t\t\tvar url = SepiaFW.tools.setParameterInURL(window.location.href, 'lang', selectedLanguage);\n\t\t\t\twindow.location.href = url;\n\t\t\t}));\n\t\t\t*/\n\t\t}\n\t\t\n\t\treturn box;\n\t}\n\t\n\t//Setup login-box\n\tAccount.setup = function(){\n\t\t//try restore from localStorage to avoid login popup - refresh required after e.g. 1 day = 1000*60*60*24\n\t\tvar account = ByteMind.data.get('account');\n\t\tif (account && account.lastRefresh && ((new Date().getTime() - account.lastRefresh) < (1000*60*60*12))){\n\t\t\tuserId = account.userId;\n\t\t\tuserToken = account.userToken;\n\t\t\tuserName = account.userName;\tif (userName)\tByteMind.config.broadcastUserName(userName);\n\t\t\tlanguage = account.language;\tif (language)\tByteMind.config.broadcastLanguage(language);\n\t\t\tByteMind.debug.log('Account: login restored');\n\t\t\t\n\t\t\tvar lBox = document.getElementById(\"bytemind-login-box\");\n\t\t\tif (lBox && lBox.style.display != 'none'){\n\t\t\t\tAccount.toggleLoginBox();\n\t\t\t}\n\t\t\tAccount.afterLogin();\n\n\t\t//try refresh\n\t\t}else if (account && account.userToken){\n\t\t\tByteMind.debug.log('Account: trying login auto-refresh with token');\n\t\t\tpwdIsToken = true;\n\t\t\tAccount.login(account.userId, account.userToken, onLoginSuccess, onLoginError, onLoginDebug);\n\t\t\n\t\t//open login box\n\t\t}else{\n\t\t\tvar lBox = document.getElementById(\"bytemind-login-box\");\n\t\t\tif (!lBox || lBox.style.display == 'none'){\n\t\t\t\tAccount.toggleLoginBox();\n\t\t\t}\n\t\t}\n\t}\n\tfunction sendLoginFromBox(){\n\t\tpwdIsToken = false;\n\t\tvar id = document.getElementById(\"bytemind-login-id\").value;\n\t\tvar pwdField = document.getElementById(\"bytemind-login-pwd\");\n\t\tvar pwd = pwdField.value;\n\t\tpwdField.value = '';\n\t\tif (id && pwd && (id.length > 3) && (pwd.length > 5)) {\n\t\t\tuserId = id;\n\t\t\tAccount.login(userId, pwd, onLoginSuccess, onLoginError, onLoginDebug);\n\t\t}else{\n\t\t\tonLoginError(ByteMind.local.g('loginFailedPlain'));\n\t\t}\n\t}\n\tfunction onLoginSuccess(data){\n\t\tvar lBox = document.getElementById(\"bytemind-login-box\");\n\t\tif (lBox && lBox.style.display != 'none'){\n\t\t\tAccount.toggleLoginBox();\n\t\t}\n\t\t\n\t\tuserToken = data.keyToken;\n\t\tuserId = data.uid;\n\t\t//get call name\n\t\tif (data.user_name && data.user_name.length > 3){\n\t\t\tvar unn = data.user_name.replace(/.*<nickN>(.*?)(<|$).*/,\"$1\");\n\t\t\tunn = (unn == data.user_name)? \"\" : unn;\n\t\t\tvar unf = data.user_name.replace(/.*<firstN>(.*?)(<|$).*/,\"$1\");\n\t\t\tunf = (unf == data.user_name)? \"\" : unf;\n\t\t\tif (unn.length>1){\n\t\t\t\tuserName = unn;\n\t\t\t}else if (unf.length>1){\n\t\t\t\tuserName = unf;\n\t\t\t}\n\t\t\t//ByteMind.debug.info(unn + \", \" + unf + \", \" + data.user_name);\n\t\t\t//broadcast\n\t\t\tByteMind.config.broadcastUserName(userName);\n\t\t}\n\t\t//get preferred language\n\t\tif (data.user_lang_code && data.user_lang_code.length > 1){\n\t\t\tlanguage = data.user_lang_code;\n\t\t\tByteMind.config.broadcastLanguage(language);\n\t\t}\n\t\t\n\t\t//store data\n\t\tvar account = new Object();\n\t\taccount.userId = userId;\n\t\taccount.userToken = userToken;\n\t\taccount.userName = userName;\n\t\taccount.language = language;\n\t\taccount.lastRefresh = new Date().getTime();\n\t\tByteMind.data.set('account', account);\n\t\t\n\t\t//what happens next? typically this is used by a client implementation to continue\n\t\tbroadcastLoginSuccess();\n\t\tAccount.afterLogin();\n\t}\n\tfunction onLoginError(errorText){\n\t\tvar lBoxError = document.getElementById(\"bytemind-login-status\");\n\t\tif(lBoxError){\n\t\t\tlBoxError.innerHTML = errorText;\n\t\t\t$(lBoxError).fadeOut(150).fadeIn(150);\n\t\t}else{\n\t\t\tByteMind.debug.err('Login: ' + errorText);\n\t\t}\n\t\tbroadcastLoginFail();\n\t}\n\tfunction onLoginDebug(data){\n\t\t//ByteMind.debug.log('Account debug: ' + JSON.stringify(data));\n\t}\n\t\n\t//toggle login box on off\n\tAccount.toggleLoginBox = function(){\n\t\tvar box = document.getElementById(\"bytemind-login-box\");\n\t\tif (box){\n\t\t\t$(\"#bytemind-login-status\").html('');\t\t//reset status text\n\t\t\tif (box.style.display == 'none'){\n\t\t\t\t$(box).fadeIn(300);\n\t\t\t\tif (ByteMind.ui){\n\t\t\t\t\tByteMind.ui.showBackgroundCoverLayer($(box).parent()[0]);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t//box.style.display = 'none';\n\t\t\t\t$(box).fadeOut(300);\n\t\t\t\tif (ByteMind.ui){\n\t\t\t\t\tByteMind.ui.hideBackgroundCoverLayer($(box).parent()[0]);\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\tAccount.createLoginBox();\n\t\t\tAccount.toggleLoginBox();\n\t\t}\n\t}\n\t\n\t//Logout action e.g. for button\n\tAccount.logoutAction = function(){\n\t\t//try logout - fails silently (low prio, good idea?)\n\t\tif (userId && userToken){\n\t\t\tAccount.logout((userId + \";\" + userToken), onLogoutSuccess, onLogoutFail, onLogoutDebug);\n\t\t}\n\t\t//remove data\n\t\tByteMind.data.del('account');\n\t\t//open box\n\t\tvar lBox = document.getElementById(\"bytemind-login-box\");\n\t\tif (lBox && lBox.style.display == 'none'){\n\t\t\tAccount.toggleLoginBox();\n\t\t}\n\t\tbroadcastLogoutTry();\n\t\t//do other user/client actions\n\t\tAccount.afterLogout();\n\t}\n\tfunction onLogoutSuccess(data){\n\t\tByteMind.debug.log('Account: logout successful');\n\t\tbroadcastLogoutSuccess();\n\t}\n\tfunction onLogoutFail(data){\n\t\tByteMind.debug.err('Account: complete logout failed! But local data has been removed.');\n\t\tbroadcastLogoutFail();\n\t}\n\tfunction onLogoutDebug(data){\n\t\t//ByteMind.debug.log('Account debug: ' + JSON.stringify(data));\n\t}\n\t\n\t//---- API communication ----\n\t\n\t//LOGIN\n\tAccount.login = function(userid, pwd, successCallback, errorCallback, debugCallback){\n\t\tByteMind.ui.showLoader();\n\t\t//hash password\n\t\tif (pwd && !pwdIsToken){\n\t\t\t//encrypt\n\t\t\tpwd = getSHA256(pwd);\n\t\t}\n\t\t//call authentication API for validation\n\t\tvar api_url = Account.apiURL + \"authentication?action=validate\";\n\t\tvar parameters = new Object();\n\t\tparameters.KEY = userid + \";\" + pwd;\n\t\t//parameters.GUUID = userid;\t\t//<-- DONT USE THAT IF ITS NOT ABSOLUTELY NECESSARY (its bad practice and a much heavier load for the server!)\n\t\t//parameters.PWD = pwd;\n\t\tparameters.client = ByteMind.config.clientInfo;\n\t\t//ByteMind.debug.info('URL: ' + api_url);\n\t\t$.ajax({\n\t\t\turl: api_url,\n\t\t\ttimeout: 5000,\n\t\t\ttype: \"post\",\n\t\t\tdata: parameters,\n\t\t\tdataType: \"jsonp\",\n\t\t\tsuccess: function(data) {\n\t\t\t\tByteMind.ui.hideLoader();\n\t\t\t\tif (debugCallback) debugCallback(data);\n\t\t\t\tif (data && data.result){\n\t\t\t\t\tvar status = data.result;\n\t\t\t\t\tif (status == \"fail\"){\n\t\t\t\t\t\tif (data.code && data.code == 3){\n\t\t\t\t\t\t\tif (errorCallback) errorCallback(ByteMind.local.g('loginFailedServer'));\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tif (errorCallback) errorCallback(ByteMind.local.g('loginFailedUser'));\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t//assume success\n\t\t\t\t\telse{\n\t\t\t\t\t\tif(data.keyToken && (data.keyToken.length > 7)){\n\t\t\t\t\t\t\t//----callback----\n\t\t\t\t\t\t\tif (successCallback) successCallback(data);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t\t\n\t\t\t\t}else{\n\t\t\t\t\tif (errorCallback) errorCallback(\"Login failed! Sorry, but there seems to be an unknown error :-(\");\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(data) {\n\t\t\t\tByteMind.ui.hideLoader();\n\t\t\t\tByteMind.webservice.checkNetwork(function(){\n\t\t\t\t\tif (errorCallback) errorCallback(\"Login failed! Sorry, but it seems the server does not answer :-(\");\n\t\t\t\t}, function(){\n\t\t\t\t\tif (errorCallback) errorCallback(\"Login failed! Sorry, but it seems you are offline :-(\");\n\t\t\t\t});\n\t\t\t\tif (debugCallback) debugCallback(data);\n\t\t\t}\n\t\t});\n\t}\n\tAccount.afterLogin = function(){};\n\t\n\t//LOGOUT\n\tAccount.logout = function(key, successCallback, errorCallback, debugCallback){\n\t\tByteMind.ui.showLoader();\n\t\tvar api_url = Account.apiURL + \"authentication?action=logout\";\n\t\tvar parameters = new Object();\n\t\tparameters.KEY = key;\n\t\tparameters.client = ByteMind.config.clientInfo;\n\t\t$.ajax({\n\t\t\turl: api_url,\n\t\t\ttimeout: 5000,\n\t\t\ttype: \"post\",\n\t\t\tdata: parameters,\n\t\t\tdataType: \"jsonp\",\n\t\t\tsuccess: function(data) {\n\t\t\t\tByteMind.ui.hideLoader();\n\t\t\t\tif (debugCallback) debugCallback(data);\n\t\t\t\tif (data.result && data.result === \"fail\"){\n\t\t\t\t\tif (errorCallback) errorCallback('Sorry, but the log-out process failed! Please log-in again to overwrite old token.');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t//--callback--\n\t\t\t\tif (successCallback) successCallback(data);\n\t\t\t},\n\t\t\terror: function(data) {\n\t\t\t\tByteMind.ui.hideLoader();\n\t\t\t\tByteMind.webservice.checkNetwork(function(){\n\t\t\t\t\tif (errorCallback) errorCallback('Sorry, but the logout process failed because the server could not be reached :-( Please wait a bit and then log-in again to overwrite old token!');\n\t\t\t\t}, function(){\n\t\t\t\t\tif (errorCallback) errorCallback('Sorry, but the logout process failed because it seems you are offline :-( Please wait for a connection and then simply log-in again.');\n\t\t\t\t});\n\t\t\t\tif (debugCallback) debugCallback(data);\n\t\t\t}\n\t\t});\n\t}\n\tAccount.afterLogout = function(){};\n\t\n\t//GET DATA\n\tAccount.getData = function(key, accountData, successCallback, errorCallback, debugCallback){\n\t\tvar api_url = Account.apiURL + \"userData?action=get\";\n\t\taccountDataTransfer(api_url, key, accountData, successCallback, errorCallback, debugCallback);\n\t}\n\t//SEND DATA\n\tAccount.setData = function(key, accountData, successCallback, errorCallback, debugCallback){\n\t\tvar api_url = Account.apiURL + \"userData?action=set\";\n\t\taccountDataTransfer(api_url, key, accountData, successCallback, errorCallback, debugCallback);\n\t}\n\t//DELETE DATA\n\tAccount.deleteData = function(key, accountData, successCallback, errorCallback, debugCallback){\n\t\tvar api_url = Account.apiURL + \"userData?action=delete\";\n\t\tdelete accountData.lists.data;\t\t//<- remove data to save some space, it is not necessary to identify the list\n\t\taccountDataTransfer(api_url, key, accountData, successCallback, errorCallback, debugCallback);\n\t}\n\t//set, get or delete data\n\tfunction accountDataTransfer(api_url, key, accountData, successCallback, errorCallback, debugCallback){\n\t\tByteMind.ui.showLoader();\n\t\tvar parameters = new Object();\n\t\tif (key){\n\t\t\tparameters.KEY = key;\n\t\t}else if (userId && userToken){\n\t\t\tparameters.KEY = (userId + \";\" + userToken);\n\t\t}else{\n\t\t\tif (errorCallback) errorCallback(\"Data transfer failed! Not authorized or missing 'KEY'\");\n\t\t\treturn;\n\t\t}\n\t\tparameters.client = ByteMind.config.clientInfo;\n\t\tif (accountData.attributes) parameters.attributes = JSON.stringify(accountData.attributes);\n\t\tif (accountData.lists) parameters.lists = JSON.stringify(accountData.lists);\n\t\t//ByteMind.debug.log('URL: ' + api_url);\n\t\t//ByteMind.debug.log('Parameters: ' + JSON.stringify(parameters));\n\t\t$.ajax({\n\t\t\turl: api_url,\n\t\t\ttimeout: 15000,\n\t\t\ttype: \"post\",\n\t\t\tdata: parameters,\n\t\t\tdataType: \"jsonp\",\n\t\t\tsuccess: function(data) {\n\t\t\t\tByteMind.ui.hideLoader();\n\t\t\t\tif (debugCallback) debugCallback(data);\n\t\t\t\tif (data && data.result){\n\t\t\t\t\tvar status = data.result;\n\t\t\t\t\tif (status == \"fail\"){\n\t\t\t\t\t\tif (data.code && (data.code == 3 || data.result_code == 3)){\n\t\t\t\t\t\t\tif (errorCallback) errorCallback(\"Data transfer failed! Communication error(?) - Msg: \" + data.error);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tif (errorCallback) errorCallback(\"Data transfer failed! Msg: \" + data.error);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t//assume success\n\t\t\t\t\telse{\n\t\t\t\t\t\tif (successCallback) successCallback(data);\n\t\t\t\t\t}\t\t\n\t\t\t\t}else{\n\t\t\t\t\tif (errorCallback) errorCallback(\"Data transfer failed! Sorry, but there seems to be an unknown error :-(\");\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(data) {\n\t\t\t\tByteMind.ui.hideLoader();\n\t\t\t\tByteMind.webservice.checkNetwork(function(){\n\t\t\t\t\tif (errorCallback) errorCallback(\"Data transfer failed! Sorry, but it seems you are offline :-(\");\n\t\t\t\t}, function(){\n\t\t\t\t\tif (errorCallback) errorCallback(\"Data transfer failed! Sorry, but it seems the network or the server do not answer :-(\");\n\t\t\t\t});\n\t\t\t\tif (debugCallback) debugCallback(data);\n\t\t\t}\n\t\t});\n\t}\n\t\n\t//------------- helpers ---------------\n\t\n\t//sha256 hash + salt\n\tAccount.pwdHashSalt = \"salty1\";\n\tfunction getSHA256(data){\n\t\treturn sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(data + Account.pwdHashSalt));\n\t}\n\t\n\t//-------------------------------------\n\t\n\treturn Account;\n}", "sendBoLuotTienLen() {\n var data = {\n evt: \"cc\"\n };\n this.sendDataGame(JSON.stringify(data));\n }", "function setZh_TW() {\n\n\tMessages.hostName = \"主機名稱\";\n\tMessages.storeId = \"商店 ID\";\n\tMessages.storeName = \"商店名稱\";\n\tMessages.catalogId = \"型錄 ID\";\n\tMessages.previewToken = \"預覽記號\";\n\tMessages.langId = \"語言\";\n\n\tMessages.appDisplayName = \"WC 混合式\";\n\tMessages.appDescription = \"WC 混合式商店\";\n\tMessages.appVersionTitle = \"應用程式版本:\";\n\tMessages.loading = \"載入中...\";\n\tMessages.appDisabled = \"已停用這個版本的應用程式。應用程式將立即結束。\";\n\tMessages.appDisabledTitle = \"應用程式已停用\";\n\tMessages.getNewVersion = \"取得新版本\";\n\tMessages.exitApp = \"您要結束應用程式嗎?\";\n\tMessages.requiredFieldsMsg1 = \"標示為 (\";\n\tMessages.requiredFieldsMsg2 = \") 的所有欄位都是必要欄位。\";\n\n\tMessages.signIn = \"登入\";\n\tMessages.signOut = \"登出\";\n\tMessages.myAccount = \"我的帳戶\";\n\tMessages.scan = \"掃描\";\n\tMessages.shoppingList = \"欲購商品清單\";\n\tMessages.privacyPolicy = \"隱私權條款\";\n\tMessages.productCompare = \"產品比較\";\n\tMessages.contactUs = \"聯絡我們\";\n\tMessages.settings = \"設定\";\n\tMessages.languageCurrency = \"語言/貨幣\";\n\tMessages.featured = \"精選\";\n\tMessages.departments = \"部門\";\n\tMessages.storeLocator = \"商店定位器\";\n\tMessages.stores = \"商店\";\n\tMessages.cart = \"購物車\";\n\tMessages.more = \"更多\";\n\tMessages.devSettings = \"開發設定\";\n\tMessages.slideUp = \"向上滑動,以存取設定\";\n\n\tMessages.OK = \"確定\";\n\tMessages.save = \"儲存\";\n\tMessages.reset = \"重設\";\n\tMessages.confirm = \"確認\";\n\tMessages.cancel = \"取消\";\n\tMessages.exit = \"結束\";\n\tMessages.optional = \"選用\";\n\n\t//Error messages\n\tMessages.ERR_EC = \"錯誤\";\n\tMessages.ERR_EC_GENERIC = \"將停止應用程式。發生非預期的異常狀況:\";\n\tMessages.ERR_EC_FORM_INCOMPLETE = \"請檢查是否完成所有欄位。\";\n\tMessages.ERR_EC_STORE_CONNECTION = \"連接至商店時發生錯誤。請稍後再試。\";\n\tMessages.ERR_EC_SERVER_NOT_FOUND = \"找不到遠端伺服器。\";\n\tMessages.ERR_EC_EXIT_QUESTION = \"檢查網際網路連線可用。您要結束應用程式嗎?\";\n\tMessages.ERR_EC_NO_INTERNET_ACCESS = \"沒有可用的網際網路存取。\";\n\tMessages.ERR_EC_CHECK_INTERNET_CONNECTION = \"請檢查裝置的網際網路連線。\";\n\tMessages.ERR_EC_UNEXPECTED_EXCEPTION = \"將停止應用程式。發生非預期的異常狀況:\";\n\tMessages.ERR_EC_HOSTNAME_MISSING = \"「主機名稱」不正確,或遺漏了值。\";\n\tMessages.ERR_EC_STOREID = \"「商店 ID」不正確,或遺漏了值。\";\n\tMessages.ERR_EC_CATALOGID = \"「型錄 ID」不正確,或遺漏了值。\";\n\tMessages.ERR_EC_BARCODE_SCAN = \"在條碼掃描的期間發生錯誤。請重試掃描。\";\n\tMessages.ERR_EC_BARCODE_SCAN_LAUNCH = \"啟動條碼掃描器時發生錯誤。\";\n\tMessages.ERR_EC_CONTACTS_LAUNCH = \"存取您的聯絡人時發生錯誤。\";\n\tMessages.ERR_EC_MAPS_LAUNCH = \"啟動對映時發生錯誤。\";\n\n\tSupportedLanguages.deviceDefault = \"裝置預設值\";\n\tSupportedLanguages.en_US = \"美式英文\";\n\tSupportedLanguages.fr_FR = \"法文\";\n\tSupportedLanguages.de_DE = \"德文\";\n\tSupportedLanguages.it_IT = \"義大利文\";\n\tSupportedLanguages.es_ES = \"西班牙文\";\n\tSupportedLanguages.pt_BR = \"巴西葡萄牙文\";\n\tSupportedLanguages.zh_CN = \"簡體中文\";\n\tSupportedLanguages.zh_TW = \"繁體中文\";\n\tSupportedLanguages.ko_KR = \"韓文\";\n\tSupportedLanguages.ja_JP = \"日式\";\n\tSupportedLanguages.iw_IL = \"希伯來文\";\n\tSupportedLanguages.tr_TR = \"土耳其文\";\n\tSupportedLanguages.ru_RU = \"俄文\";\n\tSupportedLanguages.ro_RO = \"羅馬尼亞文\";\n\tSupportedLanguages.pl_PL = \"波蘭文\";\n\tSupportedLanguages.ar_EG = \"阿拉伯文\";\n\n\tDefaultSupportedLanguages.en_US = \"United States English\";\n\tDefaultSupportedLanguages.fr_FR = \"Français\";\n\tDefaultSupportedLanguages.de_DE = \"Deutsch\";\n\tDefaultSupportedLanguages.it_IT = \"Italiano\";\n\tDefaultSupportedLanguages.es_ES = \"Español\";\n\tDefaultSupportedLanguages.pt_BR = \"Português do Brasil\";\n\tDefaultSupportedLanguages.zh_CN = \"简体中文\";\n\tDefaultSupportedLanguages.zh_TW = \"繁體中文\";\n\tDefaultSupportedLanguages.ko_KR = \"한국어\";\n\tDefaultSupportedLanguages.ja_JP = \"日本語\";\n\tDefaultSupportedLanguages.iw_IL = \"עברית\";\n\tDefaultSupportedLanguages.tr_TR = \"Türkçe\";\n\tDefaultSupportedLanguages.ru_RU = \"русский\";\n\tDefaultSupportedLanguages.ro_RO = \"Română\";\n\tDefaultSupportedLanguages.pl_PL = \"polski\";\n\tDefaultSupportedLanguages.ar_EG = \"عربية\";\n}", "function sendMessage(isTwentyFourHour) {\n const url = config.get(\"apiUrl\");\n const ticker = \"BTC\";\n const base = \"CAD\";\n\n axios.get(url).then(res => {\n const selectedCurrency = _.find(res.data.quotes, {\n ticker: ticker,\n base: base\n });\n\n const ret24 = (selectedCurrency.ret24 * 100).toString();\n const ret24Formatted = `${ret24.substring(0, 5)}%`;\n const lastPrice = selectedCurrency.last / 100;\n\n let message;\n\n isTwentyFourHour ? (message = ret24Formatted) : (message = lastPrice);\n\n const params = {\n icon_emoji: \":btc:\"\n };\n\n bot.postMessageToChannel(\"trade-bot\", message, params);\n });\n}", "trialBanned() {\n console.log(`${this.name}, Your trial has ended. Please sign up to continue!`)\n }", "function tweeted(err, data, response) {\n if (err) {\n console.log(err);\n } else {\n console.log('Success: ' + data.text);\n //console.log(response);\n }\n}", "function myTweets() {\n\t\tclient.get(\"search/tweets\", {q: \"NASA\", count: 6}, function(error, data, response) {\n \t\t\tvar tweets = data.statuses;\n \t\t\tconsole.log(\"\");\n \t\t\tfor (var i = 0; i < tweets.length; i++) {\n \t\t\t\tconsole.log((i+1) + \". \" + tweets[i].text);\n \t\t\t}\n\t\t});\n\t}", "function myTweets() {\n\tvar params = {\n\t\tscreen_name: 'Alice_B_Alice_B',\n\t\tcreated_at: '',\n\t\ttext: ''\n\t};\n\tclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n \t\tif (!error) {\n \t\tconsole.log(tweets[0].text + ' ' + tweets[0].created_at);\n \t\t}\n \t\telse if (error) {\n \t\t\tconsole.log(\"error: \" + error);\n \t\t}\n \t\telse if (response.statusCode !== 200) {\n \t\t\tconsole.log(\"response.statusCode: \" + response.statusCode);\n \t\t}\n\t});\n}", "function tweets () {\n\n\n\n}", "function get_this_bureau(bureau_id)\n{\n fade_in_loader_and_fade_out_form(\"loader\", \"edit_bureau_form\"); \n var bearer = \"Bearer \" + localStorage.getItem(\"admin_access_token\"); \n url = admin_api_bureaus_get_one_bureau_url + bureau_id;\n show_log_in_console(\"url: \" + url);\n send_restapi_request_to_server_from_form(\"get\", url, bearer, \"\", \"json\", get_this_bureau_success_response_function, get_this_bureau_error_response_function);\n}", "function tweets() {\n\tvar Twitter = require('twitter');\n \n\tvar client = new Twitter({\n consumer_key: keys.TwitterKeys.consumer_key,\n consumer_secret: keys.TwitterKeys.consumer_secret,\n access_token_key: keys.TwitterKeys.access_token_key,\n access_token_secret: keys.TwitterKeys.access_token_secret\n\t});\n \n\tvar params = 'wyz1JP';\n var url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';\n \n client.get(url, params, function(error, tweets, response) {\n if (!error) {\n for (var i = 0; i < tweets.length; i++) {\n \n if (tweets[i] != undefined) {\n \n console.log(tweets[i].text);\n }\n }\n \t} else {\n console.log(error);\n \t}\n\t});\n \n}", "function twittarPreco(preco) {\n\tT.post('statuses/update', {\n\t status: '1 BTC = R$'+preco\n\t}, function(err, data, response) {\n\t console.log(data)\n\t})\n}", "async function starts() {\r\nconst tobi = new WAConnection()\r\ntobi.logger.level = 'warn'\r\nconsole.log(banner.string) //_BANNER\r\nconsole.log(banner2.string) //_BANNER\r\ntobi.on('qr', () => {\r\nconsole.log(color('[','white'), color('!','red'), color(']','white'), color(' Scan the qr code above'))\r\n})\r\n\r\nfs.existsSync('./tobi.json') && tobi.loadAuthInfo('./tobi.json')\r\ntobi.on('connecting', () => {\r\nstart('2', 'Aguarde...')\r\n})\r\ntobi.on('open', () => {\r\nsuccess('2', 'Foi conectado!!!')\r\n})\r\nawait tobi.connect({timeoutMs: 30*1000})\r\nfs.writeFileSync('./tobi.json', JSON.stringify(tobi.base64EncodedAuthInfo(), null, '\\t'))\r\n//_FIM DO WHATSAPP CONEX?O.\r\n\r\n//_WELCOME = BEM VINDO...\r\ntobi.on('group-participants-update', async (anu) => {\r\nif (!welcome.includes(anu.jid)) return\r\ntry {\r\nconst mdata = await tobi.groupMetadata(anu.jid)\r\nconsole.log(anu)\r\nif (anu.action == 'add') {\r\nnum = anu.participants[0]\r\ntry {\r\nppimg = await tobi.getProfilePicture(`${anu.participants[0].split('@')[0]}@c.us`)\r\n} catch {\r\nppimg = 'https://i0.wp.com/www.gambarunik.id/wp-content/uploads/2019/06/Top-Gambar-Foto-Profil-Kosong-Lucu-Tergokil-.jpg'\r\n}\r\nteks = `Olá @${num.split('@')[0]}!!\r\nBem-vindo(a) ao grupo ${mdata.subject}! Olhe as regras do grupo para não ser banido \r\n\r\nUse o comando ${p}menu para listar meus comandos\r\n\r\nLeia As Regras Do Grupo:\r\n${mdata.desc}`\r\nlet buff = await getBuffer(ppimg)\r\ntobi.sendMessage(mdata.id, buff, MessageType.image, {caption: teks, contextInfo: {\"mentionedJid\": [num]}})\r\n} else if (anu.action == 'remove') {\r\nnum = anu.participants[0]\r\ntry {\r\nppimg = await tobi.getProfilePicture(`${num.split('@')[0]}@c.us`)\r\n} catch {\r\nppimg = 'https://i0.wp.com/www.gambarunik.id/wp-content/uploads/2019/06/Top-Gambar-Foto-Profil-Kosong-Lucu-Tergokil-.jpg'\r\n}\r\nteks = `SAIU E NEM PAGOU A COCA @${num.split('@')[0]} 👋`\r\nlet buff = await getBuffer(ppimg)\r\ntobi.sendMessage(mdata.id, buff, MessageType.image, {caption: teks, contextInfo: {\"mentionedJid\": [num]}})\r\n}\r\n} catch (e) {\r\nconsole.log('Error : %s', color(e, 'red'))\r\n}\r\n})\r\n//_FIM \r\n\r\n//_BLOQUEADOS, \"BLOKLIST\"\r\ntobi.on('CB:Blocklist', json => {\r\nif (blocked.length > 2) return\r\nfor (let i of json[1].blocklist) {\r\nblocked.push(i.replace('c.us','s.whatsapp.net'))\r\n}\r\n})\r\n\r\n//_LINGUAGEM DO BOT, \"N MEXA EM NADA.\"\r\ntobi.on('chat-update', async (mek) => {\r\ntry {\r\nif (!mek.hasNewMessage) return\r\nmek = mek.messages.all()[0]\r\nif (!mek.message) return\r\nif (mek.key && mek.key.remoteJid == 'status@broadcast') return\r\nif (mek.key.fromMe) return\r\nglobal.p\r\nglobal.blocked\r\n//_HORAS\r\nconst hr = moment.tz('America/Sao_Paulo').format('HH:mm:ss')\r\nconst time = moment.tz('Asia/Jakarta').format('DD/MM HH:mm:ss')\r\nconst data = moment.tz('Asia/Jakarta').format('DD/MM')\r\n//-•-\\\\\r\nconst content = JSON.stringify(mek.message)\r\nconst from = mek.key.remoteJid\r\nconst type = Object.keys(mek.message)[0]\r\nconst { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType\r\nbody = (type === 'conversation' && mek.message.conversation.startsWith(p)) ? mek.message.conversation : (type == 'imageMessage') && mek.message.imageMessage.caption.startsWith(p) ? mek.message.imageMessage.caption : (type == 'videoMessage') && mek.message.videoMessage.caption.startsWith(p) ? mek.message.videoMessage.caption : (type == 'extendedTextMessage') && mek.message.extendedTextMessage.text.startsWith(p) ? mek.message.extendedTextMessage.text : ''\r\nbudy = (type === 'conversation') ? mek.message.conversation : (type === 'extendedTextMessage') ? mek.message.extendedTextMessage.text : ''\r\nconst command = body.slice(1).trim().split(/ +/).shift().toLowerCase()\r\nconst args = body.trim().split(/ +/).slice(1)\r\nconst isCmd = body.startsWith(p)\r\nconst is = budy.slice(0).trim().split(/ +/).shift().toLowerCase()\r\n\r\n//_REPLY DO BOT\r\nmess = {\r\nwait: 'Aguarde um pouco...',\r\nlimitend: '『❗』Desculpe, seu limite acabou, por favor, fa?a uma compra repetida.',\r\nerror: {\r\nstick: '『❗』Por favor, tente novamente mais tarde',\r\n},\r\nonly: {\r\ngroup: '『❗』Comando só para grupo irmão',\r\nownerG: '『❗』Este comando so pode ser usado pelo dono do bot',\r\nownerB: '『❗』So quem pode usar esse comando eo dono do bot',\r\nadmin: '『❗』Esse comando é só para admins',\r\nBadmin: '『❗』Cade meu adm???',\r\ntobirply: `『❗』Comando ${command} ja esta ativado!`,\r\ntobireplayoff: `『❗』Comando ${command} desativado com sucesso!`,\r\ntobireplay: `『❗』Comando ${command} ativado com sucesso!`,\r\ntobantilink: '『❗』Opa amigo, E esse link aí?🧐',\r\ndaftarB: `『❗』Salve, Fdp *${p}verify* para come?ar a usar bot`,\r\n}\r\n}\r\n\r\nconst totalchat = await tobi.chats.all()\r\nconst botNumber = tobi.user.jid\r\nconst ownerNumber = [`${up.ownerNumber}@s.whatsapp.net`] //SUBSTITUA ISSO PELO SEU N?MERO\r\nconst isGroup = from.endsWith('@g.us')\r\nconst sender = isGroup ? mek.participant : mek.key.remoteJid\r\nconst groupMetadata = isGroup ? await tobi.groupMetadata(from) : ''\r\nconst groupName = isGroup ? groupMetadata.subject : ''\r\nconst groupId = isGroup ? groupMetadata.jid : ''\r\nconst groupMembers = isGroup ? groupMetadata.participants : ''\r\nconst groupAdmins = isGroup ? getGroupAdmins(groupMembers) : ''\r\nconst groupDesc = isGroup ? groupMetadata.desc : ''\r\nconst isBotGroupAdmins = groupAdmins.includes(botNumber) || false\r\nconst isGroupAdmins = groupAdmins.includes(sender) || false\r\nconst isOwner = ownerNumber.includes(sender)\r\nconst isBanned = ban.includes(sender) \r\nconst q = args.join(' ')\r\nconst tescuk = [\"[email protected]\"]\r\nlet pushname = tobi.contacts[sender] != undefined ? tobi.contacts[sender].vname || tobi.contacts[sender].notify: undefined\r\nconst isUrl = (url) => {\r\nreturn url.match(new RegExp(/https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/, 'gi'))\r\n}\r\n// ARQUIVOS ANTIS \r\nconst isWelcome = isGroup ? welcome.includes(from) : true //Welcome\r\n\r\n//_REPOSTA DE BOT\r\nconst enviar = (teks) => {\t\t\t\t\r\ntobi.sendMessage(from, teks, text, {quoted:mek})\r\n}\r\nconst sendMess = (hehe, teks) => {\r\ntobi.sendMessage(hehe, teks, text)\r\n}\r\nconst mentions = (teks, memberr, id) => {\r\n(id == null || id == undefined || id == false) ? tobi.sendMessage(from, teks.trim(), extendedText, {contextInfo: {\"mentionedJid\": memberr}}) : tobi.sendMessage(from, teks.trim(), extendedText, {quoted: mek, contextInfo: {\"mentionedJid\": memberr}})\r\n}\r\n\r\nconst costum = (pesan, tipe, target, target2) => {\r\ntobi.sendMessage(from, pesan, tipe, {quoted: {key: {fromMe: false, participant: `${target}`, ...(from ? {\r\nremoteJid: from\r\n}: {})\r\n}, message: {\r\nconversation: `${target2}`\r\n}}})\r\n}\r\n\r\nconst sendPtt = (teks) => {\r\ntobi.sendMessage(from, audio, mp3, {\r\nquoted: mek \r\n})\r\n}\r\n\r\n//_TIPOS DE MENSAGENS\r\nconst isMedia = (type === 'imageMessage' || type === 'videoMessage')\r\nconst isQuotedText = type === 'extendedTextMessage' && content.includes('textMessage')\r\nconst isQuotedImage = type === 'extendedTextMessage' && content.includes('imageMessage')\r\nconst isQuotedVideo = type === 'extendedTextMessage' && content.includes('videoMessage')\r\nconst isQuotedAudio = type === 'extendedTextMessage' && content.includes('audioMessage')\r\nconst isQuotedSticker = type === 'extendedTextMessage' && content.includes('stickerMessage')\r\nconst isQuotedDocument = type === 'extendedTextMessage' && content.includes('documentMessage')\r\n//_FIM \r\n\r\n//COLORES NO TERMINAL \"TERMUX\"\r\ncolors = ['red','white','black','blue','yellow','green']\r\n\r\n//_VISUALIZA AS MENSAGENS \r\ntobi.chatRead(from)\r\n\r\n//_USUÁRIO BANIDO\r\nif (isCmd && isBanned) {\r\nenviar(`『❗』Você está banido do bot`)\r\nreturn console.log(color('[BAN] Ignorando comando', 'blue'), color(moment.tz('America/Sao_Paulo').format('HH:mm:ss'), 'yellow'), color(`${command}`),'DE:', color(pushname))}\r\n\r\n//_CONSOLE DE COMANDOS NO PRIVADO\r\nif (!isGroup && isCmd) console.log('\\x1b[1;31m~\\x1b[1;37m>', '[\\x1b[1;32m CMD \\x1b[1;37m]', color(command, \"yellow\"), 'do', color(pushname, \"yellow\"), 'horas', color(hr, \"yellow\"))\r\n//_CONSOLE DE MENSAGENS NO PRIVADO\r\nif (!isGroup && !isCmd) console.log('\\x1b[1;31m~\\x1b[1;37m>', '[\\x1b[1;32m MSG \\x1b[1;37m]', color('Message', \"yellow\"), 'do', color(pushname, \"yellow\"), 'horas', color(hr, \"yellow\"))\r\n//_CONSOLE DE COMANDOS EM GRUPOS \r\nif (isCmd && isGroup) console.log('\\x1b[1;31m~\\x1b[1;37m>', '[\\x1b[1;32m CMD \\x1b[1;37m]', color(command, \"yellow\"), 'do', color(pushname, \"yellow\"), 'Em', color(groupName), 'horas', color(hr, \"yellow\"))\r\n//_CONSOLE DE MENSAGENS EM GRUPOS\r\nif (!isCmd && isGroup) console.log('\\x1b[1;31m~\\x1b[1;37m>', '[\\x1b[1;32m MSG \\x1b[1;37m]', color('Message', \"yellow\"), 'do', color(pushname, \"yellow\"), 'Em', color(groupName), 'horas', color(hr, \"yellow\"))\r\n//_FIM \r\n\r\n//_> UPAR COMANDOS \"EVAL\"\r\nif (budy.startsWith('>')){\r\nif(!isOwner) return\r\nconsole.log('\\x1b[1;31m~\\x1b[1;37m>', '[\\x1b[1;32m EVAL \\x1b[1;37m]', color(moment(mek.messageTimestamp * 1000).format('DD/MM HH:mm:ss'), 'yellow'), color(budy))\r\ntry {\r\nreturn enviar(JSON.stringify(eval(budy.slice(2)),null,'\\t'))\r\n} catch(e) {\r\nenviar(`${e}`)\r\n}\r\n}\r\n\r\n//_LIMITE PARA MEMBROS\r\nif (isGroup) {\r\ntry {\r\nconst getmemex = groupMembers.length\r\nif (getmemex <= memberlimit) {\r\ntobi.sendMessage(from, `Desculpe, os requisitos de membro devem estar acima ${memberlimit}, Adeus ??`, text)\r\nsetTimeout(() => {\r\ntobi.groupLeave(from) // ur cods\r\n}, 5000) // 1000 = 1s,\r\n}\r\n} catch {\r\nconsole.error(err)\r\n}\r\n}\r\n//_FIM \r\n\r\n//_PALAVRAS ALEATÓRIAS\r\nswitch(is) {\r\ncase 'bot':\r\nbuf = fs.readFileSync(`./base de dados/temp/audio/onichan.mp3`)\r\ntobi.sendMessage(from, buf, audio, {\r\nmimetype: 'audio/mp4', quoted: mek, ptt: true\r\n})\r\nbreak\r\n\r\ncase 'help':\r\ncase 'menu':\r\nhasil = ` \r\nSalve *${pushname}* tente digitar ${p}menu`\r\nenviar(hasil)\r\nbreak\r\n}\r\n//_FIM \r\n\r\n//_ONDE COMEÇA TODOS OS COMANDOS.\r\nswitch(command) {\r\ncase 'help': \r\ncase 'menu':\r\ncase 'ajuda':\r\nuptime = process.uptime()\r\nwew = fs.readFileSync('./src/menu.png')\r\ntobi.sendMessage(from, wew, image, {quoted: mek, thumbnail:null, caption: help(p, hr)})\r\nbreak\r\n\r\ncase 'dono':\r\ncase 'criador':\r\ncase 'owner':\r\ntobi.sendMessage(from, '『❗』Numero do meu criador foi enviado no seu pv',MessageType.text, { quoted: mek} )\r\ntobi.sendMessage(sender, 'ESTE E MEU CRIADOR [(>_<)] CASO TENHA ALGUMA DUVIDA FALE COM ELE ?',MessageType.text, { quoted: mek} )\r\ntobi.sendMessage(sender, {\r\ndisplayname: \"Jeff\", vcard: vcard\r\n}, MessageType.contact, {\r\nquoted: mek\r\n})\r\nbreak\r\n\r\ncase 'banir':\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\nif (!isBotGroupAdmins) return enviar(ptbr.Badmin()) //_`Pedi adm, para o bot //_`Pedi adm, para o bot\r\nif (mek.message.extendedTextMessage === undefined || mek.message.extendedTextMessage === null) return enviar('A marca-alvo que você quer chutar!')\r\nmentioned = mek.message.extendedTextMessage.contextInfo.mentionedJid\r\nif (mentioned.length > 1) {\r\nteks = 'Alvo removido com sucesso :\\n'\r\nfor (let _ of mentioned) {\r\nteks += `@${_.split('@')[0]}\\n`\r\n}\r\nmentions(teks, mentioned, true)\r\ntobi.groupRemove(from, mentioned)\r\n} else {\r\nmentions(`Alvo removido com sucesso : @${mentioned[0].split('@')[0]}`, mentioned, true)\r\ntobi.groupRemove(from, mentioned)\r\n}\r\nbreak\r\n\r\ncase 'add':\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\nif (!isBotGroupAdmins) return enviar(ptbr.Badmin()) //_`Pedi adm, para o bot //_`Pedi adm, para o bot\r\nif (args.length < 1) return enviar('Você quer adicionar um gênio?')\r\nif (args[0].startsWith('08')) return enviar('Use o código do país, man')\r\ntry {\r\nnum = `${args[0].replace(/ /g, '')}@s.whatsapp.net`\r\ntobi.groupAdd(from, [num])\r\n} catch (e) {\r\nconsole.log('Error :', e)\r\nenviar('Falha ao adicionar destino, talvez porque é privado')\r\n}\r\nbreak\r\n\r\ncase 'promover': //Grupo\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\nif (!isBotGroupAdmins) return enviar(ptbr.Badmin()) //_`Pedi adm, para o bot //_`Pedi adm, para o bot\r\nif (args.length < 1) return enviar(`Use: ${p + command} @Alvo`)\r\nif (mek.message.extendedTextMessage === undefined || mek.message.extendedTextMessage === null) return\r\nmentioned = mek.message.extendedTextMessage.contextInfo.mentionedJid\r\nif (mentioned.length > 1) {\r\nteks = 'Berhasil Promote\\n'\r\nfor (let _ of mentioned) {\r\nteks += `@${_.split('@')[0]}\\n`\r\n}\r\nmentions(from, mentioned, true)\r\ntobi.groupRemove(from, mentioned)\r\n} else {\r\nmentions(`Ok, chefe. esse cara aqui: @${mentioned[0].split('@')[0]} agora é admin do grupo!`, mentioned, true)\r\ntobi.groupMakeAdmin(from, mentioned)\r\n}\r\nbreak\r\n\r\ncase 'rebaixar': //Grupo\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\nif (!isBotGroupAdmins) return enviar(ptbr.Badmin()) //_`Pedi adm, para o bot //_`Pedi adm, para o bot\r\nif (args.length < 1) return enviar(`Use: ${p + command} @Alvo`)\r\nif (mek.message.extendedTextMessage === undefined || mek.message.extendedTextMessage === null) return\r\nmentioned = mek.message.extendedTextMessage.contextInfo.mentionedJid\r\nif (mentioned.length > 1) {\r\nteks = 'Berhasil Demote\\n'\r\nfor (let _ of mentioned) {\r\nteks += `@${_.split('@')[0]}\\n`\r\n}\r\nmentions(teks, mentioned, true)\r\ntobi.groupRemove(from, mentioned)\r\n} else {\r\nmentions(`Ok, chefe. esse cara aqui: @${mentioned[0].split('@')[0]} perdeu o adm com sucesso!`, mentioned, true)\r\ntobi.groupDemoteAdmin(from, mentioned)\r\n}\r\nbreak\r\n\r\ncase 'abrir-grupo': //Grupo\r\ncase 'abrir-gp':\r\ncase 'abrirg':\r\ncase 'abrir':\r\ncase 'abrir-gc':\r\ntobi.updatePresence(from, Presence.composing)\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\nif (!isBotGroupAdmins) return enviar(ptbr.Badmin()) //_`Pedi adm, para o bot\r\nopen = {\r\ntext: `Grupo aberto por: @${sender.split(\"@\")[0]}`,\r\ncontextInfo: {\r\nmentionedJid: [sender]\r\n}\r\n}\r\ntobi.groupSettingChange (from, GroupSettingChange.messageSend, false)\r\ntobi.sendMessage(from, open, text, {\r\nquoted: mek\r\n})\r\nbreak\r\n\r\ncase 'fecharg': //Grupo\r\ncase 'fechar':\r\ncase 'fechagrupo':\r\ncase 'fechar-gp':\r\ntobi.updatePresence(from, Presence.composing)\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\nif (!isBotGroupAdmins) return enviar(ptbr.Badmin()) //_`Pedi adm, para o bot\r\nvar nomor = mek.participant\r\nconst close = {\r\ntext: `Grupo fechado por: @${nomor.split(\"@s.whatsapp.net\")[0]}`,\r\ncontextInfo: {\r\nmentionedJid: [nomor]\r\n}\r\n}\r\ntobi.groupSettingChange (from, GroupSettingChange.messageSend, true);\r\nenviar(close)\r\nbreak\r\n\r\ncase 'totag':\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\nif (!isBotGroupAdmins) return enviar(ptbr.Badmin()) //_`Pedi adm, para o bot\r\nif ((isMedia && !mek.message.videoMessage || isQuotedSticker) && args.length == 0) {\r\nencmediau = isQuotedSticker ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nfile = await tobi.downloadAndSaveMediaMessage(encmediau, filename = getRandom())\r\nvalue = args.join(\" \")\r\nvar group = await tobi.groupMetadata(from)\r\nvar member = group['participants']\r\nvar mem = []\r\nmember.map(async adm => {\r\nmem.push(adm.id.replace('c.us', 's.whatsapp.net'))\r\n})\r\nvar options = {\r\ncontextInfo: { mentionedJid: mem },\r\nquoted: mek\r\n}\r\nini_buffer = fs.readFileSync(file)\r\ntobi.sendMessage(from, ini_buffer, sticker, options)\r\nfs.unlinkSync(file)\r\n} else if ((isMedia && !mek.message.videoMessage || isQuotedImage) && args.length == 0) {\r\nencmediau = isQuotedImage ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nfile = await tobi.downloadAndSaveMediaMessage(encmediau, filename = getRandom())\r\nvalue = args.join(\" \")\r\nvar group = await tobi.groupMetadata(from)\r\nvar member = group['participants']\r\nvar mem = []\r\nmember.map(async adm => {\r\nmem.push(adm.id.replace('c.us', 's.whatsapp.net'))\r\n})\r\nvar options = {\r\ncontextInfo: { mentionedJid: mem },\r\nquoted: mek\r\n}\r\nini_buffer = fs.readFileSync(file)\r\ntobi.sendMessage(from, ini_buffer, image, options)\r\nfs.unlinkSync(file)\r\n} else if ((isMedia && !mek.message.videoMessage || isQuotedAudio) && args.length == 0) {\r\nencmediau = isQuotedAudio ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nfile = await tobi.downloadAndSaveMediaMessage(encmediau, filename = getRandom())\r\nvalue = args.join(\" \")\r\nvar group = await tobi.groupMetadata(from)\r\nvar member = group['participants']\r\nvar mem = []\r\nmember.map(async adm => {\r\nmem.push(adm.id.replace('c.us', 's.whatsapp.net'))\r\n})\r\nvar options = {\r\nmimetype : 'audio/mp4', duration: 999999999,\r\nptt : true,\r\ncontextInfo: { mentionedJid: mem },\r\nquoted: mek\r\n}\r\nini_buffer = fs.readFileSync(file)\r\ntobi.sendMessage(from, ini_buffer, audio, options)\r\nfs.unlinkSync(file)\r\n } else if ((isMedia && !mek.message.videoMessage || isQuotedVideo) && args.length == 0) {\r\nencmediau = isQuotedVideo ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nfile = await tobi.downloadAndSaveMediaMessage(encmediau, filename = getRandom())\r\nvalue = args.join(\" \")\r\nvar group = await tobi.groupMetadata(from)\r\nvar member = group['participants']\r\nvar mem = []\r\nmember.map(async adm => {\r\nmem.push(adm.id.replace('c.us', 's.whatsapp.net'))\r\n})\r\nvar options = {\r\nmimetype : 'video/gif',\r\ncontextInfo: { mentionedJid: mem },\r\nquoted: mek\r\n}\r\nini_buffer = fs.readFileSync(file)\r\ntobi.sendMessage(from, ini_buffer, video, options)\r\nfs.unlinkSync(file)\r\n} else if ((isMedia && !mek.message.videoMessage || isQuotedDocument) && args.length == 0) {\r\nencmediau = isQuotedDocument ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nfile = await tobi.downloadAndSaveMediaMessage(encmediau, filename = getRandom())\r\nvalue = args.join(\" \")\r\nvar group = await tobi.groupMetadata(from)\r\nvar member = group['participants']\r\nvar mem = []\r\nmember.map(async adm => {\r\nmem.push(adm.id.replace('c.us', 's.whatsapp.net'))\r\n})\r\nvar options = {\r\nmimetype : 'text/plain',\r\ncontextInfo: { mentionedJid: mem },\r\nquoted: mek\r\n}\r\nini_buffer = fs.readFileSync(file)\r\ntobi.sendMessage(from, ini_buffer, document, options)\r\nfs.unlinkSync(file)\r\n} else if ((isMedia && !mek.message.videoMessage || isQuotedVideo) && args.length == 0) {\r\nencmediau = isQuotedVideo ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nfile = await tobi.downloadAndSaveMediaMessage(encmediau, filename = getRandom())\r\nvalue = args.join(\" \")\r\nvar group = await tobi.groupMetadata(from)\r\nvar member = group['participants']\r\nvar mem = []\r\nmember.map(async adm => {\r\nmem.push(adm.id.replace('c.us', 's.whatsapp.net'))\r\n})\r\nvar options = {\r\nmimetype : 'video/mp4', duration: 999999999,\r\ncontextInfo: { mentionedJid: mem },\r\nquoted: mek\r\n}\r\nini_buffer = fs.readFileSync(file)\r\ntobi.sendMessage(from, ini_buffer, video, options)\r\nfs.unlinkSync(file)\r\n} else{\r\nenviar(`『❗』Responder imagem/documento/gif/adesivo/áudio/vídeo com legenda ${p + command}`)\r\n}\r\nbreak\r\n\r\ncase 'setname': //Grupo\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\nif (!isBotGroupAdmins) return enviar(ptbr.Badmin()) //_`Pedi adm, para o bot\r\nif (args.length < 1) return enviar(`『❗』Use: ${p + command} Novo Nome Do Grupo`)\r\nidgrup = `${from.split(\"@s.whatsapp.net\")[0]}`;\r\ntobi.groupUpdateSubject(idgrup, `${body.slice(9)}`)\r\ntobi.sendMessage(from, '『❗』Nome do grupo alterado', text, {\r\nquoted: mek\r\n})\r\nbreak\r\n\r\ncase 'setdesk': //Grupo\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\nif (!isBotGroupAdmins) return enviar(ptbr.Badmin()) //_`Pedi adm, para o bot\r\nif (args.length < 1) return enviar(`『❗』Use: ${p + command} Nova Descrição`)\r\ntobi.groupUpdateDescription(from, `${body.slice(9)}`)\r\ntobi.sendMessage(from, '『❗』Descrição do grupo alterada', text, {\r\nquoted: mek\r\n})\r\nbreak\r\n\r\ncase 'setppgc': //Grupo\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\nif (!isBotGroupAdmins) return enviar(ptbr.Badmin()) //_`Pedi adm, para o bot\r\nif (args.length < 1) return enviar(`『❗』Use: ${p + command} Marque uma foto!`)\r\nconst ftgp = isQuotedImage ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo: mek\r\nconst medipp = await tobi.downloadAndSaveMediaMessage(ftgp)\r\nawait tobi.updateProfilePicture (from, medipp)\r\nenviar('『❗』foto do grupo alterada')\r\nbreak\r\n\r\ncase 'marcar': //Grupo\r\ncase 'tagall':\r\ntobi.updatePresence(from, Presence.composing)\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\nmembers_id = []\r\ntodos = (args.length > 1) ? body.slice(8).trim(): ''\r\ntodos += `Total: ${groupMembers.length} membros\\n`\r\nfor (let mem of groupMembers) {\r\ntodos += `║➸@${mem.jid.split('@')[0]}\\n`\r\nmembers_id.push(mem.jid)\r\n}\r\nmentions('╭╾╼◐⚋ ༒ᴍᴇɴᴄɪᴏɴᴀʀ ᴛᴏᴅᴏs ༒⚋◑╾╼╮\\n║➸'+todos+'╰╾╼◐⚋ ༒ᴍᴇɴᴄɪᴏɴᴀʀ ᴛᴏᴅᴏs ༒⚋◑╾╼╯', members_id, true)\r\nbreak\r\n\r\ncase 'grupo-info': //Grupo\r\ntobi.updatePresence(from, Presence.composing)\r\nif (!isGroup) return enviar(ptbr.group())\r\nppUrl = await tobi.getProfilePicture(from) // deixe vazio para obter o seu\r\nbuffer = await getBuffer(ppUrl)\r\ntobi.sendMessage(from, buffer, image, {quoted: mek, caption: `*NOME* : ${groupName}\\n*MEMBRO* : ${groupMembers.length}\\n*ADMIN* : ${groupAdmins.length}\\n*DESCRIÇÃO* : ${groupDesc}`})\r\nbreak\r\n\r\ncase 'listadmins': //Grupo\r\ncase 'listadmin':\r\ncase 'adminlist':\r\ncase 'lista-adm':\r\nif (!isGroup) return enviar(ptbr.group())\r\nadl = `Lista de administradores do grupo: ${groupMetadata.subject}\\nTotal: ${groupAdmins.length}\\n\\n`\r\nno = 0\r\nfor (let admon of groupAdmins) {\r\nno += 1\r\nadl += `[${no.toString()}] @${admon.split('@')[0]}\\n`\r\n}\r\nmentions(adl, groupAdmins, true)\r\nbreak\r\n\r\ncase 'link-gp': //Grupo\r\ncase 'linkgc':\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\nif (!isBotGroupAdmins) return enviar(ptbr.Badmin()) //_`Pedi adm, para o bot\r\nlinkgc = await tobi.groupInviteCode(from)\r\nenviar('https://chat.whatsapp.com/'+linkgc)\r\nbreak\r\n\r\ncase 'notif': //Grupo\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\ntobi.updatePresence(from, Presence.composing)\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (args.length < 1) return enviar(`『❗』Use: ${p + command} Aviso!`)\r\naviso = `Aviso de: @${sender.split(\"@\")[0]}\\n\\nAviso: ${body.slice(7)}`\r\ngroup = await tobi.groupMetadata(from);\r\nmember = group['participants']\r\njids = [];\r\nmember.map(async adm => {\r\njids.push(adm.id.replace('c.us', 's.whatsapp.net'));\r\n})\r\noptions = {\r\ntext: aviso,\r\ncontextInfo: {\r\nmentionedJid: jids\r\n},\r\nquoted: mek\r\n}\r\nawait tobi.sendMessage(from, options, text)\r\nbreak\r\n\r\ncase 'supertag': //Grupo\r\nif ((isMedia && !mek.message.videoMessage || isQuotedSticker) && args.length == 0) {\r\nencmedia = isQuotedSticker ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nfile = await tobi.downloadAndSaveMediaMessage(encmedia, filename = getRandom())\r\nvalue = args.join(\" \")\r\nvar group = await tobi.groupMetadata(from)\r\nvar member = group['participants']\r\nvar mem = []\r\nmember.map(async adm => {\r\nmem.push(adm.id.replace('c.us', 's.whatsapp.net'))\r\n})\r\nvar options = {\r\ncontextInfo: { mentionedJid: mem },\r\nquoted: mek\r\n}\r\nini_buffer = fs.readFileSync(file)\r\ntobi.sendMessage(from, ini_buffer, sticker, options)\r\nfs.unlinkSync(file)\r\n} else if ((isMedia && !mek.message.videoMessage || isQuotedImage) && args.length == 0) {\r\nencmedia = isQuotedImage ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nfile = await tobi.downloadAndSaveMediaMessage(encmedia, filename = getRandom())\r\nvalue = args.join(\" \")\r\nvar group = await tobi.groupMetadata(from)\r\nvar member = group['participants']\r\nvar mem = []\r\nmember.map(async adm => {\r\nmem.push(adm.id.replace('c.us', 's.whatsapp.net'))\r\n})\r\nvar options = {\r\ncontextInfo: { mentionedJid: mem },\r\nquoted: mek\r\n}\r\nini_buffer = fs.readFileSync(file)\r\ntobi.sendMessage(from, ini_buffer, image, options)\r\nfs.unlinkSync(file)\r\n} else if ((isMedia && !mek.message.videoMessage || isQuotedAudio) && args.length == 0) {\r\nencmedia = isQuotedAudio ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nfile = await tobi.downloadAndSaveMediaMessage(encmedia, filename = getRandom())\r\nvalue = args.join(\" \")\r\nvar group = await tobi.groupMetadata(from)\r\nvar member = group['participants']\r\nvar mem = []\r\nmember.map(async adm => {\r\nmem.push(adm.id.replace('c.us', 's.whatsapp.net'))\r\n})\r\nvar options = {\r\nmimetype : 'audio/mp4',\r\nptt : true,\r\ncontextInfo: { mentionedJid: mem },\r\nquoted: mek\r\n}\r\nini_buffer = fs.readFileSync(file)\r\ntobi.sendMessage(from, ini_buffer, audio, options)\r\nfs.unlinkSync(file)\r\n} else if ((isMedia && !mek.message.videoMessage || isQuotedVideo) && args.length == 0) {\r\nencmedia = isQuotedVideo ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nfile = await tobi.downloadAndSaveMediaMessage(encmedia, filename = getRandom())\r\nvalue = args.join(\" \")\r\nvar group = await tobi.groupMetadata(from)\r\nvar member = group['participants']\r\nvar mem = []\r\nmember.map(async adm => {\r\nmem.push(adm.id.replace('c.us', 's.whatsapp.net'))\r\n})\r\nvar options = {\r\nmimetype : 'video/mp4',\r\ncontextInfo: { mentionedJid: mem },\r\nquoted: mek\r\n}\r\nini_buffer = fs.readFileSync(file)\r\ntobi.sendMessage(from, ini_buffer, video, options)\r\nfs.unlinkSync(file)\r\n} else{\r\nenviar(`[❗] Responder imagem/adesivo/áudio/vídeo com a legenda ${p + command} para marcar`)\r\n}\r\nbreak \r\n\r\ncase 'delete': //Grupo\r\ncase 'del':\r\ncase 'apagar':\r\nif (!isGroup)return enviar(ptbr.group())\r\nif (!isGroupAdmins)return enviar(ptbr.admin())\r\ntry {\r\ntobi.deleteMessage(from, {\r\nid: mek.message.extendedTextMessage.contextInfo.stanzaId, remoteJid: from, fromMe: true\r\n})\r\n} catch {\r\nenviar('Só é possível deletar mensagens minhas')\r\n}\r\nbreak\r\n\r\ncase 'welcome':\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isGroupAdmins) return enviar(ptbr.admin())\r\nif (!isBotGroupAdmins) return enviar(ptbr.Badmin()) //_`Pedi adm, para o bot //_`Pedi adm, para o bot\r\nif (args.length < 1) return enviar(`[❗]On/Off, Exemplo ${p + command} On`)\r\nif (args[0] === 'on') {\r\nif (isWelcome) return enviar('*[❗] ja esta ativado amigo...*')\r\nwelcome.push(from)\r\nfs.writeFileSync('./base de dados/arquivos/welcome.json', JSON.stringify(welcome))\r\nenviar(mess.only.tobireplay)\r\n} else if (args[0] === 'off') {\r\nlet position = welcome.indexOf(welcome.find((x) => x === from))\r\nif (position === -1) return enviar(`${command} não estava ativo antes`)\r\nwelcome.splice(position, 1)\r\nfs.writeFileSync('./base de dados/arquivos/welcome.json', JSON.stringify(welcome))\r\nenviar(mess.only.tobireplayoff)\r\n} else {\r\nenviar(`[❗]ativar/desativar, Exemplo ${p + command} On`)\r\n}\r\nbreak\r\n// FIM DOS COMANDOS EM GRUPO\r\n\r\n// COMEÇO DOS COMANDOS DE FIGU\r\ncase 'stiker':\r\ncase 'sticker':\r\ncase 'stickergif':\r\ncase 'stikergif':\r\ncase 'gif':\r\ncase 'f':\r\ncase 'figu':\r\ncase 'figurinha':\r\ncase 'fig':\r\nif ((isMedia && !mek.message.videoMessage || isQuotedImage) && args.length == 0) {\r\nconst encmedia = isQuotedImage ? JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo : mek\r\nconst media = await tobi.downloadAndSaveMediaMessage(encmedia)\r\nran = getRandom('.webp')\r\nenviar(ptbr.wait())\r\nawait ffmpeg(`./${media}`)\r\n.input(media)\r\n.on('start', function (cmd) {\r\n})\r\n.on('error', function (err) {\r\nconsole.log(`Error : ${err}`)\r\nfs.unlinkSync(media)\r\nenviar(ptbr.stick())\r\n})\r\n.on('end', function () {\r\nexec(`webpmux -set exif ${addMetadata(`${SeuNome}`)} ${ran} -o ${ran}`, async (error) => {\r\nif (error) return enviar(ptbr.stick())\r\ntobi.sendMessage(from, fs.readFileSync(ran), sticker, {quoted: mek})\r\nfs.unlinkSync(media)\t\r\nfs.unlinkSync(ran)\t\r\n })\r\n })\r\n.addOutputOptions([`-vcodec`,`libwebp`,`-vf`, `scale='min(180,iw)':min'(180,ih)':force_original_aspect_ratio=decrease,fps=20, pad=180:180:-1:-1:[email protected], split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse`])\r\n.toFormat('webp')\r\n.save(ran)\r\n} else if ((isMedia && mek.message.videoMessage.seconds < 11 || isQuotedVideo && mek.message.extendedTextMessage.contextInfo.quotedMessage.videoMessage.seconds < 11) && args.length == 0) {\r\nconst encmedia = isQuotedVideo ? JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo : mek\r\nconst media = await tobi.downloadAndSaveMediaMessage(encmedia)\r\nran = getRandom('.webp')\r\nenviar(ptbr.wait())\r\nawait ffmpeg(`./${media}`)\r\n.inputFormat(media.split('.')[1])\r\n.on('start', function (cmd) {\r\n})\r\n.on('error', function (err) {\r\nconsole.log(`Error : ${err}`)\r\nfs.unlinkSync(media)\r\ntipe = media.endsWith('.mp4') ? 'video' : 'gif'\r\nenviar(`A conversão de ${tipe} para o sticker falhou`)\r\n})\r\n.on('end', function () {\r\nexec(`webpmux -set exif ${addMetadata(`${SeuNome}`)} ${ran} -o ${ran}`, async (error) => {\r\nif (error) return enviar(ptbr.stick())\r\ntobi.sendMessage(from, fs.readFileSync(ran), sticker, {quoted: mek})\r\nfs.unlinkSync(media)\r\nfs.unlinkSync(ran)\r\n})\r\n})\r\n.addOutputOptions([`-vcodec`,`libwebp`,`-vf`, `scale='min(180,iw)':min'(180,ih)':force_original_aspect_ratio=decrease,fps=20, pad=180:180:-1:-1:[email protected], split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse`])\r\n.toFormat('webp')\r\n.save(ran)\r\n} else if ((isMedia || isQuotedImage) && args[0] == 'nobg') {\r\nconst encmedia = isQuotedImage ? JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo : mek\r\nconst media = await tobi.downloadAndSaveMediaMessage(encmedia)\r\nranw = getRandom('.webp')\r\nranp = getRandom('.png')\r\nenviar(ptbr.waitgif())\r\nkeyrmbg = 'sfFSzxRz7y6jYDwfxx47rCgz'\r\nawait removeBackgroundFromImageFile({path: media, apiKey: keyrmbg, size: 'auto', type: 'auto', ranp}).then(res => {\r\nfs.unlinkSync(media)\r\nlet buffer = Buffer.from(res.base64img, 'base64')\r\nfs.writeFileSync(ranp, buffer, (err) => {\r\nif (err) return enviar('ocorreu um erro')\r\n})\r\nexec(`ffmpeg -i ${ranp} -vcodec libwebp -filter:v fps=fps=20 -lossless 1 -loop 0 -preset default -an -vsync 0 -s 512:512 ${ranw}`, (err) => {\r\nfs.unlinkSync(ranp)\r\nif (err) return enviar(ptbr.stick())\r\nexec(`webpmux -set exif ${addMetadata(`${SeuNome}`)} ${ranw} -o ${ranw}`, async (error) => {\r\nif (error) return enviar(ptbr.stick())\r\ntobi.sendMessage(from, fs.readFileSync(ranw), sticker, {quoted: mek})\r\nfs.unlinkSync(ranw)\r\n})\r\n})\r\n})\r\n} else {\r\nenviar(`Você precisa enviar ou marcar uma imagem ou vídeo com no máximo 10 segundos`)\r\n}\r\nbreak\r\n\r\ncase 'st':\r\nif ((isMedia && !mek.message.videoMessage || isQuotedImage) && args.length == 0) {\r\nconst encmedia = isQuotedImage ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nconst media = await tobi.downloadAndSaveMediaMessage(encmedia)\r\nrano = getRandom('.webp')\r\nenviar(ptbr.wait())\r\nawait ffmpeg(`./${media}`)\r\n.input(media)\r\n.on('start', function(cmd) {\r\n})\r\n.on('error', function(err) {\r\nconsole.log(`Error : ${err}`)\r\nenviar(ptbr.stick())\r\n})\r\nexec(`ffmpeg -i ${media} -vcodec libwebp -filter:v fps=fps=15 -lossless 1 -loop 0 -preset default -an -vsync 0 -s 800:800 ${rano}`, (err) => {\r\nfs.unlinkSync(media)\r\nexec(`webpmux -set exif ${addMetadata(`${SeuNome}`)} ${rano} -o ${rano}`, async(error) => {\r\nbuffer = fs.readFileSync(rano)\r\ntobi.sendMessage(from, buffer, sticker, {\r\nquoted: mek\r\n})\r\nfs.unlinkSync(rano)\r\n})\r\n})\r\n} else if ((isMedia && mek.message.videoMessage.seconds < 11 || isQuotedVideo && mek.message.extendedTextMessage.contextInfo.quotedMessage.videoMessage.seconds < 11) && args.length == 0) {\r\nconst encmedia = isQuotedVideo ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nconst media = await tobi.downloadAndSaveMediaMessage(encmedia)\r\nrano = getRandom('.webp')\r\nenviar(ptbr.wait())\r\nawait ffmpeg(`./${media}`)\r\n.inputFormat(media.split('.')[1])\r\n.on('start', function(cmd) {\r\n})\r\n.on('error', function(err) {\r\nconsole.log(`Error : ${err}`)\r\ntipe = media.endsWith('.mp4') ? 'video' : 'gif'\r\nenviar(`Falha na conversão de ${tipe} para sticker`)\r\n})\r\nexec(`ffmpeg -i ${media} -vcodec libwebp -filter:v fps=fps=15 -lossless 1 -loop 0 -preset default -an -vsync 0 -s 200:200 ${rano}`, (err) => {\r\nfs.unlinkSync(media)\r\nexec(`webpmux -set exif ${addMetadata(`${SeuNome}`)} ${rano} -o ${rano}`, async(error) => {\r\nbuffer = fs.readFileSync(rano)\r\ntobi.sendMessage(from, buffer, sticker, {\r\nquoted: mek\r\n})\r\nfs.unlinkSync(rano)\r\n})\r\n})\r\n} else {\r\nenviar(`Você precisa enviar ou marcar uma imagem ou vídeo com no máximo 10 segundos`)\r\n}\r\nbreak\r\n\r\ncase 'stk':\r\nif ((isMedia && !mek.message.videoMessage || isQuotedImage) && args.length == 0) {\r\nconst encmedia = isQuotedImage ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nconst media = await tobi.downloadAndSaveMediaMessage(encmedia)\r\nran = getRandom('.webp')\r\nenviar(ptbr.wait())\r\nawait ffmpeg(`./${media}`)\r\n.input(media)\r\n.on('start', function(cmd) {\r\n})\r\n.on('error', function(err) {\r\nconsole.log(`Error : ${err}`)\r\nfs.unlinkSync(media)\r\nenviar(ptbr.stick())\r\n})\r\n.on('end', function() {\r\nexec(`webpmux -set exif ${addMetadata(`${SeuNome}`)} ${ran} -o ${ran}`, async(error) => {\r\nif (error) return enviar(ptbr.stick())\r\ntobi.sendMessage(from, fs.readFileSync(ran), sticker, {\r\nquoted: mek\r\n})\r\nfs.unlinkSync(media)\r\nfs.unlinkSync(ran)\r\n})\r\n})\r\n.addOutputOptions([`-vcodec`, `libwebp`, `-vf`, `crop=w='min(min(iw\\,ih)\\,650)':h='min(min(iw\\,ih)\\,650)',scale=320:320,setsar=1,fps=15`, `-loop`, `0`, `-ss`, `00:00:00.0`, `-t`, `00:00:10.0`, `-preset`, `default`, `-an`, `-vsync`, `0`, `-s`, `512:512`])\r\n.toFormat('webp')\r\n.save(ran)\r\n} else if ((isMedia && mek.message.videoMessage.seconds < 11 || isQuotedVideo && mek.message.extendedTextMessage.contextInfo.quotedMessage.videoMessage.seconds < 11) && args.length == 0) {\r\nconst encmedia = isQuotedVideo ? JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : mek\r\nconst media = await tobi.downloadAndSaveMediaMessage(encmedia)\r\nran = getRandom('.webp')\r\nenviar(ptbr.wait())\r\nawait ffmpeg(`./${media}`)\r\n.inputFormat(media.split('.')[1])\r\n.on('start', function(cmd) {\r\n})\r\n.on('error', function(err) {\r\nconsole.log(`Error : ${err}`)\r\nfs.unlinkSync(media)\r\ntipe = media.endsWith('.mp4') ? 'video' : 'gif'\r\nenviar(`A conversão de ${tipe} para o sticker falhou`)\r\n})\r\n.on('end', function() {\r\nexec(`webpmux -set exif ${addMetadata(`${SeuNome}`)} ${ran} -o ${ran}`, async(error) => {\r\nif (error) return enviar(ptbr.stick())\r\ntobi.sendMessage(from, fs.readFileSync(ran), sticker, {\r\nquoted: mek\r\n})\r\nfs.unlinkSync(media)\r\nfs.unlinkSync(ran)\r\n})\r\n})\r\n.addOutputOptions([`-vcodec`, `libwebp`, `-vf`, `crop=w='min(min(iw\\,ih)\\,320)':h='min(min(iw\\,ih)\\,320)',scale=200:200,setsar=1,fps=15`, `-loop`, `0`, `-ss`, `00:00:00.0`, `-t`, `00:00:10.0`, `-preset`, `default`, `-an`, `-vsync`, `0`, `-s`, `512:512`])\r\n.toFormat('webp')\r\n.save(ran)\r\n} else {\r\nenviar(`Você precisa enviar ou marcar uma imagem ou vídeo com no máximo 10 segundos`)\r\n}\r\nbreak\r\n\r\ncase 'toimg':\r\ntobi.updatePresence(from, Presence.composing)\r\nif (!isQuotedSticker) return enviar('『❗』Você precisa marcar um sticker não animado para isso')\r\nenviar(ptbr.wait())\r\ntomg = JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo\r\nmedtmg = await tobi.downloadAndSaveMediaMessage(tomg)\r\nran = getRandom('.png')\r\nexec(`ffmpeg -i ${medtmg} ${ran}`, (err) => {\r\nfs.unlinkSync(medtmg)\r\nif (err) return enviar('『❗』falha ao converter sticker em imagem')\r\nbuffer = fs.readFileSync(ran)\r\ntobi.sendMessage(from, buffer, image, {\r\nquoted: mek,\r\ncaption: '🐤'\r\n})\r\nfs.unlinkSync(ran)\r\n})\r\nbreak\r\n\r\ncase 'togif': \r\nif (args.length < 1) return enviar(`『❗』Você precisa marcar um sticker animado para isso`)\r\nif ((isMedia && !mek.message.videoMessage || isQuotedSticker) && args.length == 0) {\r\nconst encmediaaa = isQuotedSticker ? JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo : mek\r\nconst mediaaa = await tobi.downloadAndSaveMediaMessage(encmediaaa)\r\nenviar(ptbr.wait())\r\na = await webp2gifFile(mediaaa)\r\nmp4 = await getBuffer(a.result)\r\ntobi.sendMessage(from, mp4, MessageType.video, {mimetype: 'video/gif', filename: `stick.gif`, quoted: mek, caption: '🐤'})\r\nfs.unlinkSync(mediaaa)\r\n}\r\nbreak\r\n\r\ncase 'attp': \r\nif (args.length < 1) return enviar(`Use dessa forma:\\nComando: ${p}attp ${SeuNome} gado`)\r\nenviar(ptbr.wait())\r\nattp2 = await getBuffer(`https://api.xteam.xyz/attp?file&text=${encodeURIComponent(body.slice(5))}`)\r\ntobi.sendMessage(from, attp2, sticker, {quoted: mek})\r\nbreak\r\n// FIM DOS COMANDOS DE FIGURINHAS\r\n\r\n// COMEÇO DOS COMANDOS DE MÚSICA\r\ncase 'play':\r\nif (args.length < 1) return enviar(`Exemplo : ${p}play Plutão`)\t\r\nhay = body.slice(6)\r\nenviar(ptbr.wait())\r\nanu = await fetchJson(`https://api.zeks.xyz/api/ytplaymp3?apikey=S38aL2CO2Ez4wZjJWxD2vaJKKrC&q=${hay}`)\r\nbuffer = await getBuffer(anu.result.thumbnail) \r\nlagu = await getBuffer(anu.result.url_audio)\r\ntobi.sendMessage(from, buffer, image, {quoted: mek, caption:'Calmae oni-chan❤️'})\r\ntobi.sendMessage(from, lagu, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})\r\nbreak\r\n\r\n//_EFEITO NIGHTCORE PARA AUDIO \r\ncase 'rapido': \r\ncase 'nightcore':\r\nif (!isQuotedAudio) return enviar('Marque um áudio')\r\nenviar('『❗』Aguarde, Adicionando efeito rápido....')\r\nencmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo\r\nbmedia = await tobi.downloadAndSaveMediaMessage(encmedia)\r\nran = getRandom('.mp3')\r\nexec(`ffmpeg -i ${bmedia} -filter:a atempo=1.06,asetrate=44100*1.25 ${ran}`, (err, stderr, stdout) => {\r\nfs.unlinkSync(bmedia)\r\nif (err) return enviar('Error!')\r\nhah = fs.readFileSync(ran)\r\ntobi.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})\r\nfs.unlinkSync(ran)\r\n})\r\nbreak \r\n\r\n//_EFEITO SLOW PARA AUDIO\r\ncase 'devagar': \r\ncase 'slow':\r\nif (!isQuotedAudio) return enviar('Marque um áudio')\r\nenviar('『❗』Aguarde, Adicionando efeito devagar....')\r\nlow = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo\r\nslo = await tobi.downloadAndSaveMediaMessage(low)\r\nran = getRandom('.mp3')\r\nexec(`ffmpeg -i ${slo} -filter:a \"atempo=0.9,asetrate=44100\" ${ran}`, (err, stderr, stdout) => {\r\nfs.unlinkSync(slo)\r\nif (err) return enviar('Error!')\r\nhah = fs.readFileSync(ran)\r\ntobi.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})\r\nfs.unlinkSync(ran)\r\n})\r\nbreak\r\n\r\n//_EFEITO ESQUILO PARA AUDIO\r\ncase 'esquilo': \r\nif (!isQuotedAudio) return enviar('Marque um áudio')\r\nenviar('『❗』Aguarde, Adicionando efeito esquilo....')\r\npai = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo\r\ntup = await tobi.downloadAndSaveMediaMessage(pai)\r\nran = getRandom('.mp3')\r\nexec(`ffmpeg -i ${tup} -filter:a \"atempo=0.7,asetrate=65100\" ${ran}`, (err, stderr, stdout) => {\r\nfs.unlinkSync(tup)\r\nif (err) return enviar('Error!')\r\nhah = fs.readFileSync(ran)\r\ntobi.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})\r\nfs.unlinkSync(ran)\r\n})\r\nbreak\r\n\r\n//_EFDEITO GIGANTE PARA AUDIO\t\r\ncase 'gemuk': \r\ncase 'gigante':\r\nif (!isQuotedAudio) return enviar('Marque um áudio')\r\nenviar('『❗』Aguarde, Adicionando efeito gigante....')\r\nmuk = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo\r\ngem = await tobi.downloadAndSaveMediaMessage(muk)\r\nran = getRandom('.mp3')\r\nexec(`ffmpeg -i ${gem} -filter:a \"atempo=1.6,asetrate=22100\" ${ran}`, (err, stderr, stdout) => {\r\nfs.unlinkSync(gem)\r\nif (err) return enviar('Error!')\r\nhah = fs.readFileSync(ran)\r\ntobi.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})\r\nfs.unlinkSync(ran)\r\n})\r\nbreak\r\n\r\n//_DEIXA O AUDIO RÁPIDO\r\ncase 'fast': \r\ncase 'rapid':\r\nif (!isQuotedAudio) return enviar('Marque um áudio')\r\nenviar('『❗』Aguarde, Adicionando efeito rapido 3x....')\r\nencmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo\r\namedia = await tobi.downloadAndSaveMediaMessage(encmedia)\r\nran = getRandom('.mp3')\r\nexec(`ffmpeg -i ${amedia} -filter:a \"atempo=0.9,asetrate=95100\" ${ran}`, (err, stderr, stdout) => {\r\nfs.unlinkSync(amedia)\r\nif (err) return enviar('Erro')\r\nhah = fs.readFileSync(ran)\r\ntobi.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})\r\nfs.unlinkSync(ran)\r\n})\r\nbreak\r\n\r\n//_AUMENTA O BASS DE UM AUDIO\t\r\ncase 'baixo': \r\ncase 'bass':\r\nif (!isQuotedAudio) return enviar('Marque um áudio')\r\nenviar('『❗』Aguarde, Adicionando efeito baixo 50hz....')\r\nass = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo\r\nbas = await tobi.downloadAndSaveMediaMessage(ass)\r\nran = getRandom('.mp3')\r\nexec(`ffmpeg -i ${bas} -af equalizer=f=20:width_type=o:width=2:g=15 ${ran}`, (err, stderr, stdout) => {\r\nfs.unlinkSync(bas)\r\nif (err) return enviar('Error!')\r\nhah = fs.readFileSync(ran)\r\ntobi.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})\r\nfs.unlinkSync(ran)\r\n})\r\nbreak\r\n\r\n//_DEIXA O AUDIO ESTOURADO\t\t\r\ncase 'earrape': \r\ncase 'estourar': \r\nif (!isQuotedAudio) return enviar('Marque um áudio')\r\nenviar('『❗』Aguarde, Adicionando efeito estorado....')\r\nass = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo\r\nbas = await tobi.downloadAndSaveMediaMessage(ass)\r\nran = getRandom('.mp3')\r\nexec(`ffmpeg -i ${bas} -af equalizer=f=90:width_type=o:width=2:g=30 ${ran}`, (err, stderr, stdout) => {\r\nfs.unlinkSync(bas)\r\nif (err) return enviar('Error!')\r\nhah = fs.readFileSync(ran)\r\ntobi.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})\r\nfs.unlinkSync(ran)\r\n})\r\nbreak\r\n// FIM DOS COMANDOS DE AUDIOS\r\n\r\n// COMEÇO DOS COMANDOS DA NUVEM\r\ncase 'liststik':\r\nteks = '*lista de figurinhas:*\\n\\n'\r\nfor (let awokwkwk of setiker) {\r\nteks += `⪧ ${awokwkwk}\\n`\r\n}\r\nteks += `\\n*Total : ${setiker.length}*\\nUse o comando\\n*${p}getstik (nome do pacote)*\\nPara pegar adesivos`\r\ntobi.sendMessage(from, teks.trim(), extendedText, { quoted: mek, contextInfo: { \"mentionedJid\": setiker } })\r\nbreak\r\n\r\ncase 'getstik':\r\nvar itsme = `[email protected]`\r\nvar split = `${cr}`\r\nvar selepbot = {\r\ncontextInfo: {\r\nparticipant: itsme,\r\nquotedMessage: {\r\nextendedTextMessage: {\r\ntext: split,\r\n}\r\n}\r\n}\r\n}\r\nnamastc = body.slice(9)\r\ntry {\r\nresult = fs.readFileSync(`./base de dados/temp/stick/${namastc}.webp`)\r\ntobi.sendMessage(from, result, sticker, selepbot)\r\n} catch {\r\nenviar('Pacote não registrado')\r\n}\r\nbreak\r\n\r\ncase 'addstik':\r\nif (!isQuotedSticker) return enviar('Responder o adesivo')\r\nif (!isOwner) return enviar(mess.only.ownerB)\r\nsvst = body.slice(9)\r\nif (!svst) return enviar('Qual é o nome do adesivo?')\r\nboij = JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo\r\ndelb = await tobi.downloadMediaMessage(boij)\r\nsetiker.push(`${svst}`)\r\nfs.writeFileSync(`./base de dados/temp/stick/${svst}.webp`, delb)\r\nfs.writeFileSync('./base de dados/temp/stik.json', JSON.stringify(setiker))\r\ntobi.sendMessage(from, `Adicionando adesivo com sucesso\\nConferido por ${p}liststik`, MessageType.text, { quoted: mek })\r\nbreak\r\n\r\ncase 'listvn':\r\ncase 'vnlist':\r\nteks = '*List Vn:*\\n\\n'\r\nfor (let awokwkwk of audionye) {\r\nteks += `- ${awokwkwk}\\n`\r\n}\r\nteks += `\\n*Total : ${audionye.length}*\\nUse comandos\\n*${p}getvn (nome do pacote)*\\nPara pegar o audio`\r\ntobi.sendMessage(from, teks.trim(), extendedText, { quoted: mek, contextInfo: { \"mentionedJid\": audionye } })\r\nbreak\r\n\r\ncase 'addvn':\r\nif (!isQuotedAudio) return enviar('Marque um audio!!!')\r\nif (!isOwner) return enviar(mess.only.ownerB)\r\nsvst = body.slice(7)\r\nif (!svst) return enviar('Qual é o nome do audio')\r\nboij = JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo\r\ndelb = await tobi.downloadMediaMessage(boij)\r\naudionye.push(`${svst}`)\r\nfs.writeFileSync(`./base de dados/temp/audio/${svst}.mp3`, delb)\r\nfs.writeFileSync('./base de dados/temp/vn.json', JSON.stringify(audionye))\r\ntobi.sendMessage(from, `Sucesso ao adicionar audio\\nConferido por ${p}listvn`, MessageType.text, { quoted: mek })\r\nbreak\r\n\r\ncase 'getvn':\r\nnamastc = body.slice(7)\r\ntry {\r\nbuffer = fs.readFileSync(`./base de dados/temp/audio/${namastc}.mp3`)\r\ntobi.sendMessage(from, buffer, audio, { mimetype: 'audio/mp4', quoted: mek, ptt: true })\r\n} catch {\r\nenviar('Pacote não registrado')\r\n}\r\nbreak\r\n\r\ncase 'listimg':\r\nteks = '*Lista Imagem :*\\n\\n'\r\nfor (let awokwkwk of imagenye) {\r\nteks += `- ${awokwkwk}\\n`\r\n}\r\nteks += `\\n*Total : ${imagenye.length}*\\nUse o comando\\n*${p}getimg (nome do pacote)*\\nPara tirar fotos`\r\ntobi.sendMessage(from, teks.trim(), extendedText, { quoted: mek, contextInfo: { \"mentionedJid\": imagenye } })\r\nbreak\r\n\r\ncase 'addimg':\r\nif (!isQuotedImage) return enviar('responder imagem ')\r\nif (!isOwner) return enviar(mess.only.ownerB)\r\nsvst = body.slice(8)\r\nif (!svst) return enviar('Qual é o nome da imagem ')\r\nboij = JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo\r\ndelb = await tobi.downloadMediaMessage(boij)\r\nimagenye.push(`${svst}`)\r\nfs.writeFileSync(`./base de dados/temp/foto/${svst}.jpeg`, delb)\r\nfs.writeFileSync('./base de dados/temp/image.json', JSON.stringify(imagenye))\r\ntobi.sendMessage(from, `Adicionando Video com Sucesso\\nConferido por ${p}listimage`, MessageType.text, { quoted: mek })\r\nbreak\r\n\r\ncase 'getimg':\r\nnamastc = body.slice(8)\r\ntry {\r\nbuffer = fs.readFileSync(`./base de dados/temp/foto/${namastc}.jpeg`)\r\ntobi.sendMessage(from, buffer, image, { quoted: mek, caption: `Resultado do banco de dados : ${namastc}.jpeg` })\r\n} catch {\r\nenviar('Pack tidak terdaftar')\r\n}\r\nbreak\r\n\r\ncase 'listvid':\r\nteks = '*Lista de Videos :*\\n\\n'\r\nfor (let awokwkwk of videonye) {\r\nteks += `- ${awokwkwk}\\n`\r\n}\r\nteks += `\\n*Total : ${videonye.length}*\\nUse o comando\\n*${p}getvid (nome do pacote)*\\nPara pegar um video`\r\ntobi.sendMessage(from, teks.trim(), extendedText, { quoted: mek, contextInfo: { \"mentionedJid\": videonye } })\r\nbreak\r\n\r\ncase 'addvid':\r\nif (!isOwner) return enviar(mess.only.ownerB)\r\nif (!isQuotedVideo) return enviar('Marque um video')\r\nsvst = body.slice(8)\r\nif (!svst) return enviar('O nome do video')\r\nboij = JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo\r\ndelb = await tobi.downloadMediaMessage(boij)\r\nvideonye.push(`${svst}`)\r\nfs.writeFileSync(`./base de dados/temp/vídeo/${svst}.mp4`, delb)\r\nfs.writeFileSync('./base de dados/temp/vid.json', JSON.stringify(videonye))\r\ntobi.sendMessage(from, `Sucesso Adicionais Video\\nConferido por ${p}listvid`, MessageType.text, { quoted: mek })\r\nbreak\r\n\r\ncase 'getvid':\r\nnamastc = body.slice(8)\r\ntry {\r\nbuffer = fs.readFileSync(`./base de dados/temp/vídeo/${namastc}.mp4`)\r\ntobi.sendMessage(from, buffer, video, { mimetype: 'video/mp4', quoted: mek })\r\n} catch {\r\nenviar('Pacote não registrado')\r\n}\r\nbreak\r\n// FIM DOS COMANDOS DE AUDIOS\r\n\r\n// COMEÇO DOS COMANDOS DE JOGOS\r\ncase 'dado': //Jogos\r\nconst dadus = [\"⚀\",\"⚁\",\"⚂\",\"⚃\",\"⚄\",\"⚅\"]\r\ndadu = dadus[Math.floor(Math.random() * dadus.length)]\r\ndador = fs.readFileSync('./base de dados/dados/'+dadu+'.webp')\r\ntobi.sendMessage(from, dador, sticker, {quoted: mek})\r\nbreak\r\n\r\ncase 'tagme': //Jogos\r\nconst tagme = {\r\ntext: `@${sender.split(\"@\")[0]} 🧙‍♂️`,\r\ncontextInfo: {mentionedJid: [sender]\r\n}\r\n}\r\ntobi.sendMessage(from, tagme, text)\r\nbreak\r\n\r\ncase \"ppt\": //Jogos\r\nif (args.length < 1) return enviar(ptbr.tterro())\r\nppt = [\"pedra\",\"papel\",\"tesoura\"]\r\nppy = ppt[Math.floor(Math.random() * ppt.length)]\r\nppg = Math.floor(Math.random() * 13) + 349\r\npptb = ppy\r\npph = `Você ganhou ${ppg} em xp`\r\nif ((pptb == \"pedra\" && args == \"papel\") || \r\n(pptb == \"papel\" && args == \"tesoura\") || \r\n(pptb == \"tesoura\" && args == \"pedra\")) {\r\nvar vit = \"vitoria\"\r\n} else if ((pptb == \"pedra\" && args == \"tesoura\") || \r\n(pptb == \"papel\" && args == \"pedra\") || \r\n(pptb == \"tesoura\" && args == \"papel\")) {\r\nvar vit = \"derrota\"\r\n} else if ((pptb == \"pedra\" && args == \"pedra\") ||\r\n(pptb == \"papel\" && args == \"papel\") ||\r\n(pptb == \"tesoura\" && args == \"tesoura\")) {\r\nvar vit = \"empate\"\r\n} else if (vit = \"undefined\") {\r\nreturn enviar(ptbr.tterro())\r\n}\r\nif (vit == \"vitoria\") {\r\nvar tes = \"Vitória do jogador\"\r\n}\r\nif (vit == \"derrota\" ) {\r\nvar tes = \"A vitória é do bot\"\r\n}\r\nif (vit == \"empate\" ) {\r\nvar tes = \"O jogo terminou em empate\"\r\n}\r\nenviar(`Bot jogou: ${pptb}\\nO jogador jogou: ${args}\\n\\n${tes}`)\r\nif (tes == \"Vitória do jogador\") {\r\nenviar(pph)\r\n}\r\nbreak\r\n\r\ncase 'gado': //Jogos\r\nvar chifre = [\"ultra extreme gado\", \"Gado-Master\", \"Gado-Rei\", \"Gado\", \"Escravo-ceta\", \"Escravo-ceta Maximo\", \"Gacorno?\", \"Jogador De Forno Livre<3\", \"Mestre Do Frifai<3<3\", \"Gado-Manso\", \"Gado-Conformado\", \"Gado-Incubado\", \"Gado Deus\", \"Mestre dos Gados\", \"Topa tudo por buceta\", \"Gado Comum\", \"Mini Gadinho\", \"Gado Iniciante\", \"Gado Basico\", \"Gado Intermediario\", \"Gado Avançado\", \"Gado Profisional\", \"Gado Mestre\", \"Gado Chifrudo\", \"Corno Conformado\", \"Corno HiperChifrudo\", \"Chifrudo Deus\", \"Mestre dos Chifrudos\"]\r\nvar gado = chifre[Math.floor(Math.random() * chifre.length)]\r\ngadop = `${Math.floor(Math.random() * 100)}`\r\nhisil = `Você é:\\n\\n${gado}`\r\nenviar(hisil)\r\nbreak\r\n\r\ncase 'sn': //jogos\r\nconst sn = ['sim', 'não']\r\ngosto = body.slice(3)\r\nif (args.length < 1) return tobi.sendMessage(from, `Você deve fazer uma pergunta...\\nExemplo: ${p}sn O ${SeuNome} é um baiano preguiçoso?`, text, {quoted: mek})\r\nconst jawab = sn[Math.floor(Math.random() * (sn.length))]\r\nhasil = `${gosto}\\n\\nSegundo meus cálculos, eu acredito que... ${jawab}`\r\nenviar(hasil)\r\nbreak\r\n\r\ncase 'chance': //Jogos\r\ntobi.updatePresence(from, Presence.composing) \r\nvar avb = body.slice(7)\r\nif (args.length < 1) return tobi.sendMessage(from, `Você precisa digitar da forma correta\\nExemplo: ${p}chance do ${SeuNome} ser um trouxa`, text, {quoted: mek})\r\nrandom = `${Math.floor(Math.random() * 100)}`\r\nhasil = `A chance ${body.slice(7)}\\n\\né de... ${random}%`\r\ntobi.sendMessage(from, hasil, text, {quoted: mek, contextInfo: {mentionedJid: [sender]}})\r\nbreak\r\n\r\ncase 'pau'://Jogos\r\nrandom = `${Math.floor(Math.random() * 35)}`\r\nconst tamanho = random\r\nif (tamanho < 13 ) {pp = 'só a fimose'} else if (tamanho == 13 ) {pp = 'passou da média😳'} else if (tamanho == 14 ) {pp = 'passou da média😳'} else if (tamanho == 15 ) {pp = 'eita, vai pegar manga?'} else if (tamanho == 16 ) {pp = 'eita, vai pegar manga?'} else if (tamanho == 17 ) {pp = 'calma man, a mina não é um poço😳'} else if (tamanho == 18 ) {pp = 'calma man, a mina não é um poço😳'} else if (tamanho == 19 ) {pp = 'calma man, a mina não é um poço😳'} else if (tamanho == 20 ) {pp = 'você tem um poste no meio das pernas'} else if (tamanho == 21 ) {pp = 'você tem um poste no meio das pernas'} else if (tamanho == 22 ) {pp = 'você tem um poste no meio das pernas'} else if (tamanho == 23 ) {pp = 'você tem um poste no meio das pernas'} else if (tamanho == 24 ) {pp = 'você tem um poste no meio das pernas'} else if (tamanho > 25 ) {pp = 'vai procurar petróleo com isso?'\r\n}\r\nhasil = `Seu pau tem ${random}cm\\n\\n${pp}`\r\nenviar(hasil)\r\nbreak\r\n\r\ncase 'slot': //Jogos\r\nconst somtoy = sotoy[Math.floor(Math.random() * (sotoy.length))]\t\r\nppg = Math.floor(Math.random() * 13) + 349\r\nif ((somtoy == '🥑 : 🥑 : 🥑') ||(somtoy == '🍉 : 🍉 : 🍉') ||(somtoy == '🍓 : 🍓 : 🍓') ||(somtoy == '🍎 : 🍎 : 🍎') ||(somtoy == '🍍 : 🍍 : 🍍') ||(somtoy == '🥝 : 🥝 : 🥝') ||(somtoy == '🍑 : 🍑 : 🍑') ||(somtoy == '🥥 : 🥥 : 🥥') ||(somtoy == '🍋 : 🍋 : 🍋') ||(somtoy == '🍐 : 🍐 : 🍐') ||(somtoy == '🍌 : 🍌 : 🍌') ||(somtoy == '🍒 : 🍒 : 🍒') ||(somtoy == '🔔 : 🔔 : 🔔') ||(somtoy == '🍊 : 🍊 : 🍊') ||(somtoy == '🍇 : 🍇 : 🍇')) {\r\nvar vitr = \"Você ganhou!!!\"\r\n} else {\r\nvar vitr = \"Você perdeu...\"\r\n}\r\nconst slott = \r\n`Consiga 3 iguais para ganhar\r\n╭╾╾╾╾ ≪ •❈• ≫ ╾╾╾╾╗\r\n║ [💰SLOT💰 | 777 ] \r\n║ \r\n║ \r\n║ ${somtoy} ◄━━┛\r\n║ \r\n║ \r\n║ [💰SLOT💰 | 777 ] \r\n╚╾╾╾╾ ≪ •❈• ≫ ╾╾╾╾╝\r\n\r\n${vitr}`\r\nif (vitr == \"Você ganhou!!!\") {\r\nsetTimeout( () => {\r\nenviar(`Você ganhou ${ppg} em xp!!!`)\r\n}, 1100)\r\n}\r\ntobi.sendMessage(from, slott, text, {quoted: mek})\r\nbreak\r\n \r\ncase 'gay': //Jogos\r\ntobi.updatePresence(from, Presence.composing) \r\nrandom = `${Math.floor(Math.random() * 100)}`\r\nboiola = random\r\nif (boiola < 20 ) {bo = 'hmm... você é hetero😔'} else if (boiola == 21 ) {bo = '+/- boiola'} else if (boiola == 23 ) {bo = '+/- boiola'} else if (boiola == 24 ) {bo = '+/- boiola'} else if (boiola == 25 ) {bo = '+/- boiola'} else if (boiola == 26 ) {bo = '+/- boiola'} else if (boiola == 27 ) {bo = '+/- boiola'} else if (boiola == 28 ) {bo = '+/- boiola'} else if (boiola == 29 ) {bo = '+/- boiola'} else if (boiola == 30 ) {bo = '+/- boiola'} else if (boiola == 31 ) {bo = 'tenho minha desconfiança...😑'} else if (boiola == 32 ) {bo = 'tenho minha desconfiança...😑'} else if (boiola == 33 ) {bo = 'tenho minha desconfiança...😑'} else if (boiola == 34 ) {bo = 'tenho minha desconfiança...??'} else if (boiola == 35 ) {bo = 'tenho minha desconfiança...😑'} else if (boiola == 36 ) {bo = 'tenho minha desconfiança...😑'} else if (boiola == 37 ) {bo = 'tenho minha desconfiança...??'} else if (boiola == 38 ) {bo = 'tenho minha desconfiança...😑'} else if (boiola == 39 ) {bo = 'tenho minha desconfiança...😑'} else if (boiola == 40 ) {bo = 'tenho minha desconfiança...😑'} else if (boiola == 41 ) {bo = 'você é né?😏'} else if (boiola == 42 ) {bo = 'você é né?😏'} else if (boiola == 43 ) {bo = 'você é né?😏'} else if (boiola == 44 ) {bo = 'você é né?😏'} else if (boiola == 45 ) {bo = 'você é né?😏'} else if (boiola == 46 ) {bo = 'você é né?😏'} else if (boiola == 47 ) {bo = 'você é né?😏'} else if (boiola == 48 ) {bo = 'você é né?😏'} else if (boiola == 49 ) {bo = 'você é né?😏'} else if (boiola == 50 ) {bo = 'você é ou não???'} else if (boiola > 51) {bo = 'você é gay??'\r\n}\r\nhasil = `Você é ${random}% gay\\n\\n${bo}`\r\nenviar(hasil)\r\nbreak\r\n\r\ncase 'roleta': //Jogos\r\nconst tiro = [\"vazio\",\"vazio\",\"vazio\",\"vazio\",\"vazio\",\"vazio\",\"vazio\",\"vazio\",\"pow\",\"pow\"]\r\nconst figr = [\"pattta1\",\"pattta2\",\"pattta3\"]\r\ntpa = tiro[Math.floor(Math.random() * (tiro.length))]\t\r\ntpb = figr[Math.floor(Math.random() * (figr.length))]\r\nfigb = fs.readFileSync('./src/'+tpb+'.webp')\r\nif (tpa == \"vazio\") {\r\nvar morte = \"Você teve sorte dessa vez, o tambor estava vazio.\"\r\n} else if (tpa == \"pow\") {\r\nvar morte = \"Tinha uma bala no tambor, POW!\"\r\n}\r\nif (morte == \"Tinha uma bala no tambor, POW!\") {\r\nsetTimeout( () => {\r\ntobi.sendMessage(from, figb, sticker, {quoted: mek})\r\n}, 2100)\r\n}\r\nsetTimeout( () => {\r\ntobi.sendMessage(from, morte, text, {quoted: mek})\r\n}, 2300)\r\nbreak\r\n\r\ncase 'caracoroa': //Jogos\r\nconst cara = fs.readFileSync('./base de dados/cara/cara.webp');\r\nconst coroa = fs.readFileSync('./base de dados/cara/coroa.webp');\r\ncararo = [\"cara\", \"coroa\"]\r\nfej = cararo[Math.floor(Math.random() * cararo.length)]\r\ngg = fej\r\nenviar(`você conseguiu: ${fej}`)\r\ncararoa = fs.readFileSync('./base de dados/cara/'+fej+'.webp')\r\ntobi.sendMessage(from, cararoa, sticker, {quoted: mek})\r\nbreak\r\n// FIM DOS COMANDOS DE JOGOS\r\n\r\n// COMEÇO DOS COMANDOS DE FOTOS\r\ncase 'hentai': \r\nif (!isGroup) enviar(ptbr.wait())\r\nif (isGroup) enviar(`『❗』${command} enviado no seu pv`)\r\nanu = await fetchJson(`https://waifu.pics/api/nsfw/neko`)\r\nbuffer = await getBuffer(anu.url)\r\ntobi.sendMessage(sender, buffer, image, {caption: 'Baum né?', quoted: mek, thumbnail:null})\r\nbreak\r\n\r\ncase 'neko':\r\nif (!isGroup) enviar(ptbr.wait())\r\nif (isGroup) enviar(`『❗』${command} enviado no seu pv`)\r\nanu = await fetchJson(`https://waifu.pics/api/nsfw/neko`)\r\nbuffer = await getBuffer(anu.url)\r\ntobi.sendMessage(sender, buffer, image, {caption: `${command}, certo?`, quoted: mek, thumbnail:null})\r\nbreak\r\n\r\ncase 'eroneko':\r\nif (!isGroup) enviar(ptbr.wait())\r\nif (isGroup) enviar(`『❗』${command} enviado no seu pv`)\r\nhai = (`https://hardianto-chan.herokuapp.com/api/anime/random?nsfw=eroNeko&apikey=hardianto`)\r\nkon = await getBuffer(hai)\r\ntobi.sendMessage(sender, kon, image, {caption: `Hehehehe`, quoted: mek, thumbnail:null})\r\nbreak\r\n\r\ncase 'kitsune':\r\nif (!isGroup) enviar(ptbr.wait())\r\nif (isGroup) enviar(`『❗』${command} enviado no seu pv`)\r\nhai = (`https://hardianto-chan.herokuapp.com/api/anime/random?nsfw=kitsune&apikey=hardianto`)\r\nkon = await getBuffer(hai)\r\ntobi.sendMessage(sender, kon, image, {caption: `Linda dms!`, quoted: mek, thumbnail:null})\r\nbreak\r\n\r\ncase 'pussy':\r\nif (!isGroup) enviar(ptbr.wait())\r\nif (isGroup) enviar(`『❗』${command} enviado no seu pv`)\r\nhai = await getBuffer(`https://hardianto-chan.herokuapp.com/api/anime/random?nsfw=pussy&apikey=hardianto`)\r\ntobi.sendMessage(sender, hai, image, {caption: `Op!!🤯`, quoted: mek, thumbnail:null})\r\nbreak\r\n\r\ncase 'trapnime':\r\nif (!isGroup) enviar(ptbr.wait())\r\nif (isGroup) enviar(`『❗』${command} enviado no seu pv`)\r\nanu = await fetchJson(`https://waifu.pics/api/nsfw/trap`)\r\nbuffer = await getBuffer(anu.url)\r\ntobi.sendMessage(sender, buffer, image, { quoted: mek, thumbnail:null})\r\nbreak\r\n\r\ncase 'bj':\r\nif (!isGroup) enviar(ptbr.wait())\r\nif (isGroup) enviar(`『❗』${command} enviado no seu pv`)\r\nhai = (`https://hardianto-chan.herokuapp.com/api/anime/random?nsfw=bJ&apikey=hardianto`)\r\nkon = await getBuffer(hai)\r\ntobi.sendMessage(sender, kon, image, {caption: `${command}, certo?`, quoted: mek, thumbnail:null})\r\nbreak\r\n\r\n// FIM DOS COMANDOS DE HENTAIS\r\n\r\n// COMEÇO DOS COMANDOS DE FOTOS\r\ncase 'wallpaper':\r\nenviar(ptbr.wait())\r\nhai = (`https://hardianto-chan.herokuapp.com/api/anime/random?sfw=wallpaper&apikey=hardianto`)\r\nkon = await getBuffer(hai)\r\ntobi.sendMessage(from, kon, image, {caption: 'Gostou?', quoted: mek, thumbnail:null})\r\nbreak\r\n\r\ncase 'megumin':\r\nenviar(ptbr.wait())\r\nanu = await fetchJson(`https://waifu.pics/api/sfw/megumin`)\r\nbuffer = await getBuffer(anu.url)\r\ntobi.sendMessage(from, buffer, image, {caption: `${command}, certo?`, quoted: mek, thumbnail:null})\r\nbreak\r\n\r\ncase 'neko2':\r\nenviar(ptbr.wait())\r\nhai = (`https://hardianto-chan.herokuapp.com/api/anime/random?sfw=neko&apikey=hardianto`)\r\nkon = await getBuffer(hai)\r\ntobi.sendMessage(from, kon, image, { quoted: mek, thumbnail:null})\r\nbreak\r\n\r\ncase 'beijo':\r\nenviar(ptbr.wait())\r\nkau = (`https://hardianto-chan.herokuapp.com/api/anime/random?sfw=kiss&apikey=hardianto`)\r\nkon = await getBuffer(kau)\r\ntobi.sendMessage(from, kon, image, { quoted: mek, thumbnail:null})\r\nbreak\r\n\r\ncase 'kemonomimi':\r\nenviar(ptbr.wait())\r\nkau = (`https://hardianto-chan.herokuapp.com/api/anime/random?sfw=kemonomimi&apikey=hardianto`)\r\nkon = await getBuffer(kau)\r\ntobi.sendMessage(from, kon, image, { quoted: mek, thumbnail:null})\r\nbreak\r\n// FIM DOS COMANDOS DE FOTOS\r\n\r\ncase 'amongus': //fuciona\r\nif (mek.message.extendedTextMessage === undefined || mek.message.extendedTextMessage === null) return enviar('Você precisa mencionar alguém')\r\nmentioned = mek.message.extendedTextMessage.contextInfo.mentionedJid\r\npro = '.\\n'\r\nfor (let _ of mentioned) {\r\npro += `@${_.split('@')[0]}\\n`\r\n}\r\nsus = \r\n`.  。    •   ゚  。\r\n  .   .      .     。   。 .\r\n .   。  ඞ 。  . •\r\n• @${mentioned[0].split('@')[0]} was E j e c t e d\r\n 1 impostor remain 。 .\r\n    。       ゚   .     .\r\n,    . .`\r\n//tobi.groupRemove(from, mentioned)\r\nmentions(`${sus}`, mentioned, true)\r\nbreak\r\n// FIM DOS COMANDOS DE JOGOS\r\n\r\n// COMEÇO DOS COMANDOS DO DONO\r\ncase 'bc':\r\nif (!isOwner) return enviar('Quem é Você, Você não é meu dono ???')\r\nif (args.length < 1) return enviar('.......')\r\nanu = await tobi.chats.all()\r\nif (isMedia && !mek.message.videoMessage || isQuotedImage) {\r\nconst encmedia = isQuotedImage ? JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo : mek\r\nbuff = await tobi.downloadMediaMessage(encmedia)\r\nfor (let _ of anu) {\r\ntobi.sendMessage(_.jid, buff, image, {caption: `[ TRANSMI??O DE AVISO ]\\n\\n${body.slice(4)}`})\r\n}\r\nenviar('Transmissão enviada com sucesso')\r\n} else {\r\nfor (let _ of anu) {\r\nsendMess(_.jid, `[ TRANSMISSÃO O DE AVISO ]\\n\\n${body.slice(4)}`)\r\n}\r\nenviar('Transmissão enviada com sucesso')\r\n}\r\nbreak\r\n\r\ncase 'clone': //Dono\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isOwner) return enviar(ptbr.ownerB())\r\nif (args.length < 1) return enviar('Mencione quem devo roubar a foto de perfil')\r\nif (mek.message.extendedTextMessage === undefined || mek.message.extendedTextMessage === null) return enviar('Tag cvk')\r\nmentioned = mek.message.extendedTextMessage.contextInfo.mentionedJid[0]\r\nlet { jid, id, notify } = groupMembers.find(x => x.jid === mentioned)\r\ntry {\r\npp = await tobi.getProfilePicture(id)\r\nbuffer = await getBuffer(pp)\r\ntobi.updateProfilePicture(botNumber, buffer)\r\nmentions(`Roubei a foto de perfil de: @${id.split('@')[0]}`, [jid], true)\r\n} catch (e) {\r\nenviar('ocorreu um erro')\r\n}\r\nbreak\r\n\r\ncase 'block': //Dono\r\ncase 'bloquear':\r\ntobi.updatePresence(from, Presence.composing)\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isOwner) return enviar(ptbr.ownerB())\r\ntobi.blockUser (`${body.slice(8)}@c.us`, \"add\")\r\ntobi.sendMessage(from, `Número de bloqueio, pedido recebido`, text, {\r\nquoted: mek\r\n})\r\nbreak\r\n\r\ncase 'unblock': //Dono\r\ncase 'desbloquear':\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isOwner) return enviar(ptbr.ownerB())\r\ntobi.blockUser (`${body.slice(9)}@c.us`, \"remove\")\r\nenviar(from, `Desbloquear, comando aceito`, text)\r\nbreak\r\n\r\ncase 'ban': //Dono\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isOwner) return enviar(ptbr.ownerB())\r\nif (mek.message.extendedTextMessage === undefined || mek.message.extendedTextMessage === null) return \r\nmentioned = mek.message.extendedTextMessage.contextInfo.mentionedJid\r\npru = '.\\n'\r\nfor (let _ of mentioned) {\r\npru += `@${_.split('@')[0]}\\n`\r\n}\r\nban.push(`${mentioned}`)\r\nfs.writeFileSync('./base de dados/datauser/banned.json', JSON.stringify(ban))\r\nsusp = `🚫@${mentioned[0].split('@')[0]} foi banido e não poderá mais usar os comandos do bot🚫`\r\nmentions(`${susp}`, mentioned, true) \r\nbreak\r\n\r\ncase 'unban': //Dono\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isOwner) return enviar(ptbr.ownerB())\r\nif (mek.message.extendedTextMessage === undefined || mek.message.extendedTextMessage === null) return \r\nmentioned = mek.message.extendedTextMessage.contextInfo.mentionedJid\r\npru = '.\\n'\r\nfor (let _ of mentioned) {\r\npru += `@${_.split('@')[0]}\\n`\r\n}\r\nban.splice(`${mentioned}`)\r\nfs.writeFileSync('./base de dados/datauser/banned.json', JSON.stringify(ban))\r\nsusp = `❎@${mentioned[0].split('@')[0]} foi desbanido e poderá novamente usar os comandos do bot❎`\r\nmentions(`${susp}`, mentioned, true) \r\nbreak\r\n\r\ncase 'addprem': //Dono\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isOwner) return enviar(ptbr.ownerB())\r\nif (mek.message.extendedTextMessage === undefined || mek.message.extendedTextMessage === null) return \r\nmentioned = mek.message.extendedTextMessage.contextInfo.mentionedJid\r\npru = '.\\n'\r\nfor (let _ of mentioned) {\r\npru += `@${_.split('@')[0]}\\n`\r\n}\r\nprem.push(`${mentioned}`)\r\nfs.writeFileSync('./base de dados/datauser/premium.json', JSON.stringify(prem))\r\nsusp = `👑@${mentioned[0].split('@')[0]} foi adicionado à lista de usuários premium com sucesso👑`\r\nmentions(`${susp}`, mentioned, true) \r\nbreak\r\n\r\ncase 'dellprem': //Dono\r\nif (!isGroup) return enviar(ptbr.group())\r\nif (!isOwner) return enviar(ptbr.ownerB())\r\nif (mek.message.extendedTextMessage === undefined || mek.message.extendedTextMessage === null) return \r\nmentioned = mek.message.extendedTextMessage.contextInfo.mentionedJid\r\npru = '.\\n'\r\nfor (let _ of mentioned) {\r\npru += `@${_.split('@')[0]}\\n`\r\n}\r\ndelp = prem.indexOf(oh)\r\nprem.splice(`${mentioned}`)\r\nfs.writeFileSync('./base de dados/datauser/premium.json', JSON.stringify(prem))\r\nsusp = `✖@${mentioned[0].split('@')[0]} foi removido da lista de usuários premium✖`\r\nmentions(`${susp}`, mentioned, true) \r\nbreak\r\n\r\ncase 'ping':\r\ncase 'speed':\r\nconst timestamp = speed();\r\nconst latensi = speed() - timestamp\r\ntobi.updatePresence(from, Presence.composing)\r\nuptime = process.uptime()\r\ntobi.sendMessage(from, `\r\n*Velocidade de resposta do bot*\r\n*Velocidade* : ${latensi.toFixed(4)} _Segundo_\r\n\r\n*Info do bot*\r\n*Total chat* : ${totalchat.length}\r\n*Block* : ${blocked.length}\r\n*Online* : ${kyun(uptime)}`,\r\ntext, {\r\nquoted: mek\r\n})\r\nbreak\r\n\r\ncase 'visuchat':\r\nconst readallid = await tobi.chats.all()\r\ntobi.setMaxListeners(25)\r\nfor (let xyz of readallid) {\r\nawait tobi.chatRead(xyz.jid)\r\n}\r\ntobi.sendMessage(from, `Pronto`, text, {\r\nquoted: {\r\nkey: {\r\nfromMe: false,\r\nparticipant: `[email protected]`,\r\n...(from ? {\r\nremoteJid: \"status@broadcast\"\r\n} : {})\r\n},\r\nmessage: {\r\n\"imageMessage\": {\r\n\"mimetype\": \"image/jpeg\",\r\n\"caption\": \"Todos os chats foram vistos\",\r\n'jpegThumbnail': fs.readFileSync('./src/bot.jpg')\r\n}\r\n}\r\n}\r\n})\r\nbreak\r\n\r\ncase 'blocklist':\r\nteks = 'Esta é uma lista de numeros bloqueados :\\n'\r\nfor (let block of blocked) {\r\nteks += `~> @${block.split('@')[0]}\\n`\r\n}\r\nteks += `Total : ${blocked.length}`\r\ntobi.sendMessage(from, teks.trim(), extendedText, {quoted: mek, contextInfo: {\"mentionedJid\": blocked}})\r\nbreak\r\n\r\ncase 'restart':\r\nif (!isOwner) return enviar(ptbr.ownerB)\r\nenviar('Bot desligado')\r\nsetTimeout(() => {\r\ntobi.close()\r\n}, 3000)\r\nbreak\r\n\r\ncase 'clearchat':\r\ncase 'clearall':\r\nif (!isOwner) return enviar(ptbr.ownerB())\r\nanu = await tobi.chats.all()\r\nlist_chat = await tobi.chats.all()\r\nfor (let chat of list_chat) {\r\ntobi.modifyChat(chat.jid, \"delete\", {includeStarred: false})\r\n}\r\nenviar(\"Chat limpo\")\r\nbreak\r\n\r\ndefault:\r\nif (body == `${p + command}`) {\r\nhsl = `『❗』Comando ${p + command} não existe`\r\ntobi.sendMessage(from, hsl, text, {quoted: mek, contextInfo: {mentionedJid: [sender]}})\r\nconsole.log('\\x1b[1;31m~\\x1b[1;37m>', color('[ ERROR ]', \"red\"), color('Comando', \"yellow\"), color(`${p}${command}`, \"yellow\"), color('n?o registrado', \"yellow\"), color('de', \"yellow\"), color(pushname, \"yellow\"))\r\n}\r\n}\r\n} catch (e) {\r\nconsole.log('Error : %s', color(e, 'red'))\r\nenviar('erro')\r\n}\r\n})\r\n}", "function myTweets() {\n\n var params = { screen_name: 'dwaynemhinds' };\n client.get('statuses/user_timeline', params, function (error, tweets, response) {\n if (!error) {\n //console.log(tweets);\n if (tweets.length < 20) {\n numOfTweets = tweets.length;\n }\n else {\n numOfTweets = 20;\n }\n for (i = 0; i < numOfTweets; i++) {\n console.log(tweets[i].created_at);\n console.log(tweets[i].text);\n logIt(\"logging myTweets<>\"+tweets[i].created_at+\",\"+tweets[i].text);\n\n };\n };\n });\n}", "function main(user) {\r\n\r\n \r\n\r\n // Create a SMTP transporter object\r\n const transporter = nodemailer.createTransport({\r\n host: 'smtp.ethereal.email',\r\n port: 587,\r\n auth: {\r\n user: '[email protected]',\r\n pass: 'r8vZFtj7npFE3uXuVs'\r\n }\r\n });\r\n\r\n let date = Date.now().toString()\r\n\r\n // Message object\r\n let message = {\r\n from:'[email protected]',\r\n to: user.Email,\r\n subject:'Resate-PassWord',\r\n html: '<p>Click <a href=\"http://localhost:3000/ResetPassword/' + date+ '\">here</a> to reset your password</p>'\r\n \r\n \r\n };\r\n\r\n const Store = transporter.sendMail(message) \r\n if (Store){\r\n return date\r\n }\r\n \r\n \r\n\r\n\r\n \r\n}", "function cekTelat(data) {\n var nama = decrypt(data.split(\":\")[1]);\n var waktu = moment.unix(data.split(\":\")[0]/1000).toDate().getTime();\n\n validasi(nama);\n\n var batas = [9,5];//jam 9 lebih 5 menit\n var terlambat = (batas[0]*60)+batas[1];\n var masuk = (moment(waktu).format(\"HH\")*60)+(moment(waktu).format(\"mm\")*1);\n var stat=\"\",msg=\"\";\n\n if (masuk>terlambat) {\n stat=\"Terlambat\";\n msg=\"Wah telat nih\";\n } else {\n stat=\"Tepat Waktu\";\n msg=\"Joss joss semangat!! :D\";\n }\n\n var absen = new Object();\n absen[\"Nama\"] = nama;\n absen[\"Waktu Masuk\"] = waktu;\n absen[\"Jam Masuk\"] = waktu;\n absen[\"Status\"] = stat;\n lib().create(absen);\n\n message(msg);\n}", "function tweeted(err, data, response) {\n\n\t if (err) {\n\t \t console.log(\"Error publishing official statement - REPLY\");\n\t } else {\n\t console.log(\"DATA leaked to a curious citizen- IMAGE\");\n\t }\n\t}", "function isValidTwit(twit) {\n return (\n twit.name &&\n twit.name.toString().trim() !== \"\" &&\n twit.content &&\n twit.content.toString().trim() !== \"\"\n );\n}", "function setTweet(receiveTweet) {\n tweet = receiveTweet\n}", "function getTwitter() {\n\nvar client = new Twitter ({\n\tconsumer_key: keys.twitterKeys.consumer_key,\n\tconsumer_secret: keys.twitterKeys.consumer_secret,\n\taccess_token_key: keys.twitterKeys.access_token_key,\n\taccess_token_secret: keys.twitterKeys.access_token_secret\n});\n\n//Twitter username inside of a parameter object.\nvar params = {\n\tscreen_name: \"stjones1920\",\n\tcount: 20};\n\tclient.get(\"statuses/user_timeline\", params, function(error, tweets, response) {\n\t\tif (!error) {\n\t\t\tconsole.log(tweets);\n\t\t}\n\t});\n}", "function myTweets() {\n\t// Initialize twitter api keys\n\tvar client = new twitter (keys.twitterKeys);\n\t// Specify parameters for API call\n\tvar params = {\n\t\tscreen_name: 'NodeLiri',\n\t\tcount: \"20\"\n\t};\n\t// Execute API call\n\tclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n \t\t// Display any errors\n \t\tif (error) {\n \t\t\tthrow error\n \t\t};\n\t\t// Loop through the response\n\t\tfor (var i =0; i < tweets.length; i++) {\n\t\t\t// Read the time the tweet was created\n\t\t\tvar tweetTime = tweets[i].created_at;\n\t\t\t// Read the tweet\n\t\t\tvar tweet = tweets[i].text;\n\t\t\t// display the tweet\n\t\t\tconsole.log(i + \" : \" + tweet);\n\t\t\t// display the time of the tweet\n\t\t\tconsole.log(i + \" (time): \" + tweetTime);\n\t\t\t// Append the command and results to the log file log.txt\n\t\t\tfs.appendFile(\"log.txt\",';'+argument1 + ';' + i + \" : \" + tweet + ';' + i + \" (time): \" + tweetTime , function(err){\n\t\t\t//If the code experiences any errors it will log the error to the console.\n\t\t\t if (err) {\n\t\t\t return console.log(err);\n\t\t\t }\n\t\t\t});\n\t\t}; \t\t\n\t});\n}", "function gtw(){\n\t\t\n\t// Async API initialization. \n\tif(!gaConf.useSynchronousAPI) {\n\t\t// random var name for the account alias used in calls\n\t\tvar pfx = this.accountPrefix = \"haf\" + Math.floor(Math.random()*100) + \".\"; \n\t\t// Utility function for prefixing function calls with the account alias. \n\t\tfunction p(fnName) {\n\t\t\treturn pfx + fnName;\n\t\t}\n\t\t\n\t\twindow._gaq = window._gaq || [];\n\t\t\n\t\t// Get the account\n\t\t_gaq.push([p('_setAccount'), gaConf.account]);\t\t\n\t\t\n\t\t// Initialization methods are called through this. \n\t\tthis.setInit = function(fn, val) {\n\t\t\t_gaq.push([p(fn),val]);\n\t\t}\n\t\t\n\t\tthis.setCustomVar = function(index, name, value, opt_scope){\n\t\t\t_gaq.push([p('_setCustomVar'),index, name, value, opt_scope]);\n\t\t}\n\t\t\n\t\tthis.deleteCustomVar= function (index){\n\t\t\t_gaq.push([p('_deleteCustomVar'),index]);\n\t\t}\n\n\t\tthis.trackEvent = function(category, action, opt_label) {\n\t\t\t_gaq.push([p('_trackEvent'),category, action, opt_label]);\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tthis.trackPageview = function (opt_pageURL){\n\t\t\tvar data = [p('_trackPageview')];\n\t\t\tif(opt_pageURL)\n\t\t\t\tdata.push(opt_pageURL);\n\t\t\t_gaq.push(data);\n\t\t}\n\t\t\n\t}\n\t// Sync API initialization. \n\telse {\n\t\t// Get the account\n\t\tvar tracker = _gat._getTracker(gaConf.account);\n\n\t\t// Initialization methods are called through this. \n\t\tthis.setInit = function(fn, val) {\n\t\t\ttracker[fn](val);\n\t\t}\n\n\t\tthis.setCustomVar = function(index, name, value, opt_scope){\n\t\t\ttracker._setCustomVar(index, name, value, opt_scope);\n\t\t}\n\t\t\n\t\tthis.deleteCustomVar= function (index){\n\t\t\ttracker._deleteCustomVar(index);\n\t\t}\n\t\t\n\t\tthis.trackEvent = function(category, action, opt_label) {\n\t\t\treturn tracker._trackEvent(category, action, opt_label);\n\t\t}\n\n\t\tthis.trackPageview = function (opt_pageURL){\n\t\t\ttracker._trackPageview(opt_pageURL);\n\t\t}\n\t\t\n\t}\n\t\n\t// Initial values and settings\n\tif (gaConf.domainName)\n\t\tthis.setInit('_setDomainName', gaConf.domainName);\t\t\n\n\t// allowHash is true by default, must look for the false value. \n\tvar allowHash = true;\n\tif (!(typeof gaConf.allowHash === 'undefined')) {\n\t\tallowHash = (gaConf.allowHash != \"false\");\t\t\n\t}\n\t\n\t// allowHash is true by default, only set to false if applies. \n\tif(!allowHash)\n\t\tthis.setInit('_setAllowHash', allowHash);\n\t\n\tif(gaConf.allowLinker)\n\t\tthis.setInit('_setAllowLinker', gaConf.allowLinker);\n\t\n\tif (gaConf.campaignCookieTimeout && !isNaN(gaConf.campaignCookieTimeout))\n\t\tthis.setInit('_setCampaignCookieTimeout', gaConf.campaignCookieTimeout);\n\t\n\tif (gaConf.sessionCookieTimeout && !isNaN(gaConf.sessionCookieTimeout))\n\t\tthis.setInit('_setSessionCookieTimeout', gaConf.sessionCookieTimeout);\n\t\n\tif (gaConf.visitorCookieTimeout && !isNaN(gaConf.visitorCookieTimeout))\n\t\tthis.setInit('_setVisitorCookieTimeout', gaConf.visitorCookieTimeout);\n\t\n}", "function buildTrainApiURl() {\n\n // if (new Date().getHours() >= 11) {\n // return 'https://huxley2.azurewebsites.net/delays/read/30?accessToken=b09cb836-f190-445d-8b96-372eb024141d&expand=true';\n // } else {\n // return 'https://huxley2.azurewebsites.net/delays/tot/30?accessToken=b09cb836-f190-445d-8b96-372eb024141d&expand=true';\n // }\n return 'https://huxley2.azurewebsites.net/delays/tot/30?accessToken=b09cb836-f190-445d-8b96-372eb024141d&expand=true';\n}", "function twitter20(){\nconsole.log(msg.SimpleMessage);\n \nvar params = {screen_name: 'ninja_cbc'};\nclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n if (!error) {\n console.log(tweets);\n }\n});\n\n//PSUEDO CODE:\n// find specific user's 20 recent tweets\n// Output data to console\n\n}", "function tweet() {\n var params = {\n screen_name: 'LanaeSlayer'\n };\n client.get('statuses/user_timeline', params, function (error, tweets, response) {\n if (!error) {\n // This array will hold the data that will be appended to log.txt\n data = [];\n\n for (var i = 0; i < tweets.length; i++) {\n\n\n console.log(\"\");\n console.log(tweets[i].created_at);\n console.log(tweets[i].text);\n console.log(\"\");\n console.log(\"<-------------------------------------------->\");\n data.push({\n time: tweets[i].created_at,\n text: tweets[i].text\n })\n\n }\n logData(data)\n\n }\n });\n\n}", "function getMeTweets() {\n\n \tvar screenName = {screen_name: 'MohiteSanchita9'};\n\n \tclient.get('statuses/user_timeline', screenName, function(error, tweets, response) {\n\n \t\tif(!error) {\n \t\t\t\n \t\t\tfor (var i = 0; i < tweets.length; i++) {\n \t\t\t var date = tweets[i].created_at;\n \t\t\t\n \t\t\tconsole.log(\"@MohiteSanchita9: \" + tweets[i].text + \" Created At: \" + date.substring(0, 19));\n \t\t\tconsole.log(\"------------------\");\n\n \t\t\t// adds text to log.txt\n \t\t\tfs.appendFile('log.txt', \"@MohiteSanchita9: \" + tweet[i].text + \"Created At: \" + date.substring(0, 19));\n \t\t\tfs.appendFile('log.txt', \"-----------------------\");\n \t\t}\n \t } else {\n \t \t\tconsole.log(\"Error occured!\");\n \t}\n \t});\n }", "static get DEFAULT_API_BASE_URL() { return 'https://api.todobot.io'; }", "getAllTweets () {\n\t\t//Single responsibility with single flow\n\t\t// so this will communicate with api\n\t\t// so it will only send messages or meaning it will call an api\n\t\tconsole.log(1, \"get all tweets\");\n\t\tAPI.getAllTweets();\n\t}", "function tweet(content) {\n params = {\n status: content\n }\n T.post('statuses/update', params, postTweet);\n}", "function getTweets() {\r\n var twitterUsername = process.argv[3];\r\n if (!twitterUsername) {\r\n twitterUsername = \"Eagles\";\r\n }\r\n params = {\r\n screen_name: twitterUsername\r\n };\r\n twitKeys.get(\"statuses/user_timeline/\", params, function (\r\n error,\r\n tweets,\r\n response\r\n ) {\r\n if (!error) {\r\n console.log(`The Latest 10 Tweets for ${twitterUsername} are\\n`);\r\n\r\n for (let i = 0; i < 10; i++) {\r\n var tweet =\r\n \"********************************** \\n\\n\" +\r\n \"DATE: \" + tweets[i].created_at + \"\\n\" +\r\n \"TWEET: \" + tweets[i].text + \"\\n\";\r\n console.log(tweet);\r\n logdata(tweet);\r\n }\r\n } else console.log(\"Error :\" + error);\r\n });\r\n}", "function getTweets() {\n client.get('statuses/user_timeline', params, function (error, tweets, response) {\n if (!error) {\n for (var i = 0; i < tweets.length; i++) {\n console.log(mainDivider + \"\\nTweet Number \" + (i + 1) + \" - \" + handle + \": \" + tweets[i].text, \"\\nCreated at: \" + tweets[i].created_at);\n }\n }\n });\n}", "sendBill() {}", "function myTweets() {\n client.get(\"statuses/user_timeline\", params, function(error, tweets, response){\n if(error){\n return (error);\n }\n for(var i = 0; i < tweets.length; i++){\n console.log(tweets[i].text);\n console.log(tweets[i].created_at, \"\\n\");\n }\n // Writes to log.txt file\n fs.appendFile(\"./log.txt\", \"\\n\" + new Date().toISOString().replace('T', ' ').substr(0, 19) + \" ==> looked at your last 20 Tweets\\n--------------------------------------------------------------------\", function(err){\n if(err){\n throw err;\n }\n });\n });\n}", "function getTwitter(){\n client.get('statuses/user_timeline.json?screen_name=codingbr&' + count, function (error, tweets, response) {\n //console.log(JSON.stringify(tweets, null, 2));\n for (var i = 0; i < tweets.length; i++) {\n console.log(JSON.stringify(tweets[i].created_at, null, 2));\n console.log(JSON.stringify(tweets[i].text, null, 2));\n console.log(\"*************************************************************\");\n }//end for loop\n\n });//end function\n }//end getTwitter function" ]
[ "0.6218108", "0.56186426", "0.5607528", "0.55779076", "0.55600214", "0.552879", "0.5497817", "0.54709226", "0.5465514", "0.54314667", "0.5391672", "0.5379998", "0.53415924", "0.531658", "0.53089863", "0.52769256", "0.52655977", "0.52647316", "0.5253586", "0.5221723", "0.5214082", "0.521113", "0.5207825", "0.51849467", "0.5175469", "0.5173558", "0.515802", "0.5140523", "0.51354784", "0.5131706", "0.51279265", "0.5123867", "0.5108474", "0.51074976", "0.5103585", "0.5098858", "0.5097033", "0.5095106", "0.50931793", "0.5085721", "0.5082961", "0.50820476", "0.50709033", "0.50701064", "0.50654644", "0.50566536", "0.50553656", "0.50463533", "0.50449777", "0.5033965", "0.50311863", "0.5025644", "0.502522", "0.5022105", "0.50156873", "0.50127447", "0.50121", "0.50114846", "0.5011016", "0.50016916", "0.49947864", "0.49939996", "0.49821624", "0.49801767", "0.4977251", "0.49726933", "0.49658597", "0.4963478", "0.49548382", "0.4953429", "0.49502707", "0.4948984", "0.49466997", "0.49462792", "0.49252197", "0.4921868", "0.49204388", "0.4912761", "0.49117252", "0.49087405", "0.4907444", "0.49032155", "0.49016148", "0.48999545", "0.48982236", "0.48922828", "0.48870933", "0.48836952", "0.48812267", "0.4881146", "0.48788834", "0.4875373", "0.48744053", "0.487165", "0.48712534", "0.48679093", "0.4865288", "0.4862059", "0.48582444", "0.48512253" ]
0.56884825
1
formulieren, divjes & variabelen resetten
function resetForm() { btwResult.innerHTML = ""; totaalZonderBtwResult.innerHTML = ""; result.innerHTML = ""; bedragInput.value = ""; totaal.value = ""; totaalBedrag = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetear(){\n resultado.innerHTML = \"0\";\n operandoa = 0;\n operandob = 0;\n operacion = \"\";\n control_punto = 0;\n }", "function resetFormularioNuevaParada(){\n frmPanelNuevaParada.getForm().reset();\n Ext.get('latParada').dom.innerHTML = '0.0';\n Ext.get('lonParada').dom.innerHTML = '0.0';\n limpiarCapaNuevaRuta();\n}", "function limpiar() {\r\n \r\n \t$('#plan_cuentas').val(\"0\");\r\n\t\t$('#id_plan_cuentas').val(\"\");\r\n\t\t$('#nombre_plan_cuentas').val(\"\");\r\n\t\t$('#descripcion_dcomprobantes').val(\"\");\r\n\t\t$('#debe_dcomprobantes').val(\"0.00\");\r\n\t\t$('#haber_dcomprobantes').val(\"0.00\");\r\n \r\n }", "function reset() {\n tfInput.value = \"\";\n tfResultado.value = \"\";\n taLogArea.value = \"\";\n numPrevio = 0;\n numActual = 0;\n numAcumulado = 0;\n strOperacion = \"\";\n cOperador = \"\";\n}", "function resetForm() {\n document.getElementById(\"age\").value = 0;\n document.getElementById(\"feet\").value = 0;\n document.getElementById(\"inches\").value = 0;\n document.getElementById(\"stones\").value = 0;\n document.getElementById(\"pounds\").value = 0;\n document.getElementById(\"cm\").value = 0;\n document.getElementById(\"kilos\").value = 0;\n createEventListeners();\n showImperial();\n}", "function reset(){\n\n\t\tobjEach(document.getElementsByClassName('input__field--indicator'), function(element){\n\t\t\telement.value = '';\n\t\t});\n\n\t\t// Hide the error message for re-calculation\n\t\thide(document.getElementById('errorDiv'));\n\t\t\t\n\t\t// Reset the comments for re-calculation\n\t\tshow(document.getElementsByClassName('result')[0]);\n\t\tshow(document.getElementsByClassName('comment')[0]);\n\t\thide(document.getElementsByClassName('result go')[0]);\n\t\thide(document.getElementsByClassName('comment go')[0]);\n\t\thide(document.getElementsByClassName('result nogo')[0]);\n\t\thide(document.getElementsByClassName('comment nogo')[0]);\n\t}", "function valueReset(){\n\n $(\"#fieldsChoice\").each(function () {\n $(\"input[type=number]\").each(function () {\n $(this).val(0);\n }); \n });\n\n costTotalShafts = 0;\n costInstallation = 0;\n costTotal = 0;\n\n $(\"#showColumns\").val(0);\t\n $(\"#showElevators\").val(0);\n $(\"#cost\").val(costTotalShafts.toLocaleString('en-us',{style:'currency', currency:'USD'}));\n $(\"#installation\").val(costInstallation.toLocaleString('en-us',{style:'currency', currency:'USD'}));\n $(\"#total\").val(costTotal.toLocaleString('en-us',{style:'currency', currency:'USD'}));\n \n\n\n // document.getElementById(\"cost\").innerHTML = costTotalShafts.toLocaleString('en-us',{style:'currency', currency:'USD'});\n // document.getElementById(\"installation\").innerHTML = costInstallation.toLocaleString('en-us',{style:'currency', currency:'USD'});\n // document.getElementById(\"total\").innerHTML = costTotal.toLocaleString('en-us',{style:'currency', currency:'USD'});\n }", "resetCalc() {\r\n this.inputBill.value = \"\";\r\n this.removeCurrentActiveStyles();\r\n this.inputCustom.value = \"\";\r\n this.inputPeople.value = \"\";\r\n this.errorStyles(\"remove\");\r\n this.displayResult(\"0.00\", \"0.00\");\r\n this.disableReset(true);\r\n }", "function resetarVariaveis() {\r\n tabuleiro = ['', '', '', '', '', '', '', '', ''];\r\n jogadorAtual = 0;\r\n jogadorAnterior;\r\n estadosJogo.empate = false;\r\n estadosJogo.vitoria = false;\r\n}", "function limpiarCampos(){\n\t$('#t').val(\"\");\n\t$('#cant').val(\"1\");\n\t$('#idInputSeleccionar').val(\"\");\n\t//$('#precio').val(\"Cantidad x Precio\");\n\t//$('#total').val(\"Total\");\n\t//$('#codigo').val(\"\");\n }", "function restaurarReloj() {\n $horasDom.text('00');\n $minutosDom.text('00');\n $segundosDom.text('00');\n }", "function resetTabuleiro(){\n t.celulas = [0, 1, 2, 3, 4, 5, 6, 7, 8];\n textoVencedor = \"\";\n contadorChamadas = 0;\n}", "function resetear() {\n eliminarIntegrantesAnteriores();\n ocultarbotonCalculo();\n ocultarIntegrantes();\n ocultarTextoResultado();\n vaciarValorInput();\n}", "function resetForm()\n{\n document.getElementById(\"blanketnum\").value = 0;\n document.getElementById(\"hedgenum\").value = 0;\n document.getElementById(\"bluenum\").value = 0;\n calcEstimate();\n createEventListeners();\n}", "function reset_risultati() {\r\n // resetto l'input testuale\r\n $('#testo-ricerca').val('');\r\n // nascondo il titolo della pagina\r\n $('.titolo-ricerca').removeClass('visible');\r\n // svuoto il contenitore dei risultati\r\n $('#risultati').empty();\r\n // $('#risultati .card').remove();\r\n // $('#risultati').html('');\r\n }", "function resetValOrden() {\n entra = false;\n sale = false;\n tray = false;\n trayLin = false;\n initIn = false;\n initMul = false;\n idLineTray = -1;\n idTray = -1;\n valTLF = false;\n valMovTF = false;\n elimEF = false;\n elimSI = false;\n elimSF = false;\n elimTR = false;\n elimTLF = false;\n elimTLI = false;\n elimTM = false;\n}", "function restore_inputs () {\n\n\t\t\t\tparse_variables();\n\n\t\t\t\t$('.form-w').val(W);\n\t\t\t\t$('.form-b').val(B);\n\t\t\t\t$('.form-mf').val(Mf);\n\t\t\t\t$('.form-mt').val(Mt);\n\n\t\t\t}", "function resetEnnemi (){\n document.getElementById(\"pseudoEnnemi\").innerHTML = \"\";\n document.getElementById(\"forceEnnemi\").innerHTML = \"\";\n document.getElementById(\"specialEnnemi\").innerHTML = \"\";\n document.getElementById(\"santeEnnemi\").innerHTML = \"\";\n presenceEnnemi = 0;\n tour = 0;\n}", "function resetCourseForm() {\n document.getElementById(\"courseForm\").reset();\n $(\"#course_box\").text(\"0.00\");\n $(\"#points_box\").text(\"0.00\");\n $(\"#err_box\").hide();\n ctrl = 10;\n tot, points, weight, totalpoints, courseTotal, totweight, final = 0;\n}", "function czyszczenie() {\n document.getElementById('spr').value = \"\";\n document.getElementById('odpowiedz').innerHTML = \"\";\n document.getElementById('obliczono').innerHTML = \"\";\n document.getElementById('opinia').innerHTML = \"\";\n document.getElementById('rand').innerHTML = \"\";\n document.getElementById(\"licznik\").innerHTML = \"\";\n licznikKulek = 0;\n}", "function toChangeValues(){\n currentClefIndex = 0;\n currentSyllableIndex = 0;\n currentNeumeIndex = 0;\n currentNeumeVariationIndex = 0;\n currentNeumeInVariationIndex = 0;\n currentPitchIndex = 0;\n currentVarPitchIndex = 0;\n currentVarSourceIndex = 0;\n \n document.getElementById(\"input\").innerHTML = changeValueForm();\n}", "function hardReset() {\n currentAns = 0;\n operatorArr = [];\n numberArr = [];\n fixedNumberArr = [];\n $(\"#answer-p\").text(currentAns);\n $('#formula-p').text(currentAns);\n}", "reset() {\n this.hideContent();\n this.hideChart();\n this.selectVars.html('');\n this.selectTarget.html('');\n this.chartField.xSelect.html('');\n this.chartField.ySelect.html('');\n this.chartField.tSelect.html('');\n this.notesInput.val('');\n }", "function resetCampo(Nombre, _G_ID_) {\n $(_G_ID_ + 'ast_' + Nombre).removeClass('form-text-error');\n $(_G_ID_ + '_txt_' + Nombre).removeClass('form-control-error');\n $(_G_ID_ + 'miniText_' + Nombre).addClass('hidden');\n $(_G_ID_ + 'miniText_' + Nombre).html('');\n}", "function cleanFormulaire() {\n input_matricule.value = '';\n input_prenom.value = '';\n input_nom.value = '';\n select_sexe.value = '';\n input_datenaissance.value = '';\n input_lieunaissance.value = '';\n input_email.value = '';\n input_telephone.value = '';\n input_adresse.value = '';\n\n select_filiere.value = '';\n select_classe.value = '';\n input_montantinscription.value = '';\n input_mensualite.value = '';\n input_total.value = '';\n input_dateinscription.value = '';\n input_anneeacademique.value = '';\n }", "function clearInfo() {\n $('form').find('input[type=text], input[type=number]').val('');\n $('#secondNumber').addClass('hidden');\n $('#firstNumber').removeClass('hidden');\n MathForm.type = '';\n var resetTotal = { total: null };\n\n $.ajax({\n type: 'POST',\n url: '/math/reset',\n data: resetTotal,\n success: function () {\n MathForm.x = '';\n MathForm.y = '';\n },\n });\n}", "function resetPresidentForm(){\n fechaInicioField.setValue('');\n descripcionEventoField.setValue('');\n }", "function resetForm() {\r\n document.getElementById(\"myForm\").reset();\r\n document.querySelector(\"[type=reset]\").disabled = true;\r\n inputObject = {\r\n billAmount: (0).toFixed(2),\r\n tipPercent: 0,\r\n numPersons: 0,\r\n };\r\n initial(); //Set the output spans back to 0.00\r\n errorTxt.classList.add(\"hide\");\r\n console.log(\"Reset form function done\");\r\n}", "function limpiarFormulario() {\r\n $('#Codigo').val('');\r\n $('#Titulo').val('');\r\n $('#Descripcion').val('');\r\n $('#FechaInicio').val('');\r\n $('#FechaFin').val('');\r\n $('#HoraInicio').val('');\r\n $('#HoraFin').val('');\r\n $('#ColorFondo').val('#3788D8');\r\n $('#ColorTexto').val('#ffffff');\r\n }", "function limpiarDetalles(){\r\n document.getElementById(\"Cantidad\").value = \"\";\r\n document.getElementById(\"Precio\").value = \"\";\r\n}", "function cleanData (){\n \t//document.getElementById (\"resultado\").innerHTML = \"\";\n \tdocument.getElementById (\"num\").value = \"\" ; \n }", "function inicializar(){var v=document.getElementById(\"comprobacion\"); v.innerHTML=\"\"; nota=0.0;}", "function resetHeaderFactura() {\n $(\"#form-header-factura\").trigger(\"reset\");\n $(\"select\").removeClass(\"valid-select\");\n $(\"select\").removeClass(\"invalid-select\");\n $(\".helper-text\").html(\"\");\n $(\"#btn-factura\").attr(\"disabled\", false);\n $(\"#factura-txt-id\").attr(\"disabled\", false);\n $(\"#factura-txt-cliente\").attr(\"disabled\", false);\n $(\"#factura-txt-fecha\").attr(\"disabled\", false);\n if (items.length != 0) {\n $(\"#lista-items\").html(\"<tr><td></td><td></td><td></td><td></td><td></td></tr>\");\n $(\"#vnt-total-factura\").html(\"0.00\");\n $(\"#vnt-subtotal-factura\").html(\"0.00\");\n $(\"#vnt-totalExento-factura\").html(\"0.00\");\n $(\"#vnt-gravado15-factura\").html(\"0.00\");\n $(\"#vnt-gravado18-factura\").html(\"0.00\");\n $(\"#vnt-totalImpuesto15-factura\").html(\"0.00\");\n $(\"#vnt-totalImpuesto18-factura\").html(\"0.00\");\n $(\"#vnt-totalDescuento-factura\").html(\"0.00\");\n $(\"#vnt-total-factura\").html(\"0.00\");\n items = [];\n idItem = [];\n }\n}", "function reset(){\n cuenta = 1;\n numero1 = 0;\n numero2 = 0;\n numeroFinal = 0;\n limpiar();\n}", "function clear() {\n\t//this function will clear all stored data for the following varible\n //allowing the user to start fresh and NOT conintue with the same 1st equation\n calDisplay.value = 0;\n\t\tnum1 = null;\n num2 = null;\n operator = undefined;\n}", "function reset() {\n $('#objectsFilm').html('');\n $('#objectsSerieTV').html('');\n }", "function zerar(){\n \n\n document.querySelector(\".resultado\").innerHTML = 'R$ 0,00';\n document.querySelector(\".inp1\").value = '';\n document.querySelector(\".inp2\").value = '';\n document.querySelector(\".inp3\").value = '';\n document.querySelector(\".dis\").innerHTML = 'Operação'\n \n document.querySelector(\".barra\").style.width = \"40px\";\n}", "function reestablece(){\n colector = \"0\";\n operacion = \"\";\n operador0 = 0;\n operador1 = 0;\n resultado = 0;\n iteracion = 0;\n }", "function clearFields() {\r\n\t\t\t\t\t\t$('#tf_Id').val(null);\r\n\t\t\t\t\t\t$('#tf_Descricao').val(null);\r\n\t\t\t\t\t\t$('#slc_Marca').val(0);\r\n\t\t\t\t\t\t$('#slc_TipoVeiculo').val(0);\r\n\t\t\t\t\t\t$('#slc_Status').val(0);\r\n\t\t\t\t\t\t$('#btn-operation').val(\"Criar Modelo\");\r\n\t\t\t\t\t}", "function limparCampos(){\n document.getElementById('categoria').value=0;\n document.getElementById('ano').value='';\n document.getElementById('atores').value='';\n document.getElementById('infos').value=''; \n}", "reset() {\n this.life = 3;\n this.collected = 0;\n this.level = 0;\n this.score = 0;\n this.scoreWater = 0;\n this.collectedFly = 0;\n this.collectedDragonfly = 0;\n this.collectedButterfly = 0;\n levels.textContent = \"EGG\";\n lives.innerHTML = this.life;\n collectedItems.innerHTML = this.collected;\n collectedFlies.innerHTML = this.collectedFly;\n collectedDragonflies.innerHTML = this.collectedDragonfly;\n collectedButterflies.innerHTML = this.collectedButterfly;\n scoreboard.innerHTML = this.score;\n scoreboardWater.innerHTML = this.scoreWater;\n this.modalShow(startModal, startBtn);\n }", "resetFormContent() {\n ContentUtils.updateElementContent(\"delimiter\", \"?\");\n ContentUtils.updateElementContent(\"hasHeaderRow\", \"?\");\n ContentUtils.updateElementContent(\"fileSize\", 0);\n ContentUtils.updateElementContent(\"totalRecords\", 0);\n ContentUtils.updateElementContent(\"badRecords\", 0);\n ContentUtils.updateElementContent(\"inputCsvTable\", \"\");\n ContentUtils.updateElementContent(\"badCsvTable\", \"\");\n ContentUtils.updateElementContent(\"interpolatedCsvTable\", \"\");\n ContentUtils.updateElementContent(\"invalidData\", \"\");\n }", "function LimpiaDatos(){\n\t$(\"#detalles_factura\").html(linea);\n\t$(\"#impuesto\").val(\"0\");\n\t$(\"#data_cliente\").val(\"\");\n}", "function generator() {\n\n // Dichiaro tutte le variabili\n var chilometri = document.getElementById(\"form_chilometri\").value;\n var eta = document.getElementById(\"form_eta\").value;\n var prezzo = 0.21 * chilometri;\n var prezzoFinale;\n\n // Controllo dei parametri inseriti; in caso negativo reset dei campi\n if(verificaValori(chilometri) == false || verificaValori(eta) == false ){\n alert(\"Non ha inserito correttamente i valori, riprovi\");\n document.getElementById(\"form_chilometri\").value = null;\n document.getElementById(\"form_eta\").value = null;\n document.getElementById(\"form_sconto\").innerHTML = \"\";\n document.getElementById(\"form_prezzo\").innerHTML = \"\";\n } else if (eta < 18 ) {\n prezzoFinale = prezzo - ((prezzo * 20)/100);\n document.getElementById(\"form_sconto\").innerHTML = \"20% perché minorenne\";\n } else if (eta > 65) {\n prezzoFinale = prezzo - ((prezzo * 40)/100);\n document.getElementById(\"form_sconto\").innerHTML = \"40% perché over 65\";\n } else if (eta >= 18 && eta <= 65) {\n prezzoFinale = prezzo;\n document.getElementById(\"form_sconto\").innerHTML = \"0%\";\n }\n\n document.getElementById(\"form_prezzo\").innerHTML = prezzoFinale.toFixed(2)+\" €\";\n \n}", "function reseteo(){\n\t\t\t$(\".lista-notas-pendientes\").empty();\n\t\t}", "clearData(cleartype) {\n if (cleartype === 'c') {\n this.initialValue = '';\n this.lastValue = '';\n this.operator = '';\n this.displayOperator = '';\n this.dispResult = false;\n this.display.innerHTML = '';\n } else if (cleartype === \"bs\") {\n var currentval = this.display.innerHTML;\n if (this.lastValue) {\n this.lastValue = parseFloat(this.lastValue.toString().slice(0, -1));\n } else if (this.operator) {\n this.operator = '';\n this.displayOperator = '';\n this.display.innerHTML = currentval.slice(0, -1);\n } else if (this.initialValue.toString() !== \"Infinity\" && currentval !== \"Result is not defined\") {\n this.initialValue = this.initialValue.toString().length != 1 && !isNaN(this.initialValue) ? parseFloat(this.initialValue.toString().slice(0, -1)) : \"\";\n this.display.innerHTML = currentval.slice(0, -1);\n } else {\n this.initialValue = '';\n this.lastValue = '';\n this.operator = '';\n this.displayOperator = '';\n this.dispResult = false;\n this.display.innerHTML = '';\n }\n } else if (cleartype === \"ce\") {\n if (this.lastValue) {\n this.lastValue = '';\n this.display.innerHTML = this.initialValue + this.displayOperator + 0;\n } else {\n this.initialValue = '';\n this.operator = '';\n this.displayOperator = '';\n this.display.innerHTML = 0;\n }\n } else {\n console.info(\"invalid clear type\");\n }\n\n }", "function reset() {\n calculatorData.isAtSecondValue = false;\n calculatorData.displayValue = '';\n calculatorData.result = '';\n calculatorData.isValueDecimal = false;\n updateDisplay();\n}", "function restablecer(){\n\t\t$(\"#miCod\").val(\"\");\n\t\t$(\"#miNom\").val(\"\");\n\t\t$(\"#miNota\").val(\"\");\n\t}", "function reset () {\n\tthis.num1 = 0;\n\tthis.num2 = 0;\n\tthis.operator = \"\";\n\tdisplayNum.innerHTML = 0;\n\tdecimal = 0;\n}", "function resetForms(){\n \n // Resetting the form with person info\n atmWindow.document.getElementById(\"addAffiliate\").innerHTML = \"Add a Person\";\n newAffil_Name.value = \"\";\n newAffil_Email.value = \"\";\n newAffil_Org.value = \"\";\n newAffil_OrgCustom.value = \"\";\n var topicOptions = atmWindow.document.querySelectorAll(\"#topicCheckList li input\");\n for (var z = 0; z < topicOptions.length; z++){\n topicOptions[z].checked = false;\n }\n atmWindow.document.getElementById(\"affilNameError_atm\").style.display = \"none\";\n atmWindow.document.getElementById(\"affilEmailError_atm\").style.display = \"none\";\n atmWindow.document.getElementById(\"affilOrgError_atm\").style.display = \"none\";\n atmWindow.document.getElementById(\"newOrganizationField\").style.display = \"none\";\n \n\n // Resetting the topic form\n topic_atm.value = \"\";\n atmWindow.document.getElementById(\"topicError_atm\").style.display = \"none\";\n newTopicDescriptionSubSection.style.display = \"none\";\n newTopicName.value = \"\";\n newTopicName.style.display = \"none\";\n\n\n // Reset check for affil form\n checkAffilName.value = \"\";\n atmWindow.document.getElementById(\"checkAffilNameError_atm\").style.display = \"none\";\n\n\n // Reset results of table update:\n atmWindow.document.getElementById(\"addAffilResultsMessage\").style.display = \"none\";\n atmWindow.document.getElementById(\"addAffilResultsMessage\").style.color = \"initial\";\n atmWindow.document.getElementById(\"addAffilResultsMessage\").innerHTML = \"\";\n atmWindow.document.getElementById(\"reminderImage\").style.display = \"none\";\n atmWindow.document.getElementById(\"reminderHeader\").style.display = \"none\";\n }", "function rst_sft_r_v(){\ndocument.getElementById(\"sft_r_i\").value=0;\ndocument.getElementById(\"Ropani_o\").value = 0;\ndocument.getElementById(\"Aana_o\").value = 0;\ndocument.getElementById(\"Paisa_o\").value = 0;\ndocument.getElementById(\"Daam_o\").value = 0;\n}", "function limpiaCajasAuxiliares(idOrden, contador){\n\tdocument.getElementById('cantidadIAux'+idOrden+contador).value = '';\n\tdocument.getElementById('numeroCarga'+idOrden+contador).value = '';\n}", "function resetDisplay() {\n\n document.getElementById(\"input1\").value = 0;\n document.getElementById(\"input2\").value = 0;\n document.getElementById(\"input3\").value = 0;\n document.getElementById(\"input4\").value = 0;\n}", "function reset() {\n student_name_input = 0;\n student_course_input = 0;\n student_grade_input = 0;\n student_grade_average = 0;\n updateData();\n updateStudentList()\n }", "function reset() {\n // Reset (re-initalize) race object\n window[race_view].init();\n\n // reset spent resources display\n $(\"#\" + race_view + \"-supply\")\n .html(\n window[race_view].total_cost.supply.used + \n \" / \" +\n window[race_view].total_cost.supply.total\n );\n\n // Update mineral display\n $(\"#\" + race_view + \"-mineral\")\n .html(window[race_view].total_cost.mineral);\n\n // Update vespene display\n $(\"#\" + race_view + \"-vespene\")\n .html(window[race_view].total_cost.vespene);\n\n // Update time display\n $(\"#\" + race_view + \"-time\")\n .html(\"00:00\");\n \n // reset build view\n $(\"#\" + race_view + \"-build\")[0].innerHTML = \"\";\n}", "function clearForm() {\n clearUnitDetails();\n clearUnits();\n }", "function reset(){\n displayInput = [''];\n uniqueNumber = '';\n // clean the screen\n calcLine.textContent = '';\n resultLine.textContent = '';\n}", "function resetPresidentForm(){\n consecuenciasField.setValue('');\n descripcionField.setValue('');\n }", "function clearCalculations() {\n $('.field').val('');\n }", "function carregarCampos() {\n let qtd_locais_medidos = 0;\n let element = \"\";\n let array_taxas = [];\n\n array_taxas = montaSelectTaxaMetabolica();\n\n qtd_locais_medidos = buscaQtdeLocais();\n\n if (qtd_locais_medidos < 1 || qtd_locais_medidos > 5) {\n clearAll();\n mostraErro(\"O número de locais medidos deve estar entre 1 e 5\",\"\");\n\n return;\n }\n\n resetResultado();\n\n for (let i = 0; i < qtd_locais_medidos ; i++) {\n\n element += \"<div class='window_local'>\";\n element += \"<h3>Local \" + (i+1) + \"</h3>\";\n\n element += \"<label for='ibutg_local_\" + (i + 1) + \"'>Nome</label>\";\n \n element += \"<input type='text' \";\n element += \"name='nome_local_\" + (i + 1) + \"' \";\n element += \"id='nome_local_\" + (i + 1) + \"' \";\n element += \"maxlength='25'\";\n element += \"placeholder='Nome do local medido \" + (i + 1) + \"' \";\n element += \"/>\";\n\n element += \"<label for='ibutg_local_\" + (i + 1) + \"'>IBUTG</label>\";\n \n element += \"<input type='number' \";\n element += \"name='ibutg_local_\" + (i + 1) + \"' \";\n element += \"id='ibutg_local_\" + (i + 1) + \"' \";\n element += \"placeholder='IBUTG medido no local \" + (i + 1) + \"' \";\n element += \"/>\";\n\n element += \"<label for='tempo_local_\" + (i + 1) + \"'>Tempo</label>\";\n\n element += \"<input type='number' \";\n element += \"name='tempo_local_\" + (i + 1) + \"' \";\n element += \"id='tempo_local_\" + (i + 1) + \"' \";\n element += \"placeholder='Tempo no local \" + (i + 1) + \" (minutos)' \";\n element += \"/>\";\n\n element += \"<label for='select_metabolica_local_\" + (i + 1) + \"'>Atividade</label>\";\n\n element += \"<select name='select_metabolica_local_\" + (i + 1) + \"'\";\n element += \"id='select_metabolica_local_\" + (i + 1) + \"' onchange='selecionarTaxa(\" + (i + 1) + \")'>\";\n\n\n for (let x = 0; x < array_taxas.length ; x++) {\n element += \"<option value='\";\n element += array_taxas[x]['valor'];\n element += \"'>\";\n element += array_taxas[x]['descricao'];\n element += \"</option>\";\n }\n\n element += \"</select>\";\n\n element += \"<label for='metabolica_local_\" + (i + 1) + \"'>Taxa Metabólica</label>\";\n\n element += \"<input type='number' \";\n element += \"name='metabolica_local_\" + (i + 1) + \"' \";\n element += \"id='metabolica_local_\" + (i + 1) + \"' \";\n element += \"placeholder='Taxa metabólica no local \" + (i + 1) + \"' \";\n element += \"readonly/>\";\n\n element += \"</div>\";\n }\n\n $(\".window_campos\").html(element);\n $(\"#calcular\").show();\n\n return;\n}", "function clear() {\n operActual = \"\";\n operAnterior = \"\";\n operacion = undefined;\n}", "function reset() {\n $('#check').removeAttr(\"disabled\");\n $('.blocks').html('');\n $('#color').html('').append(pickColor());\n $('#wordHint').attr(\"disabled\", \"disabled\");\n $('#genNewWord').attr(\"disabled\", \"disabled\");\n $('#checkWord').attr(\"disabled\", \"disabled\");\n $('#dragTarget ul').html('');\n $('#dragWord').find('div').each(function (index) {\n $(this).html('');\n });\n $(\"#genWord\").removeAttr(\"disabled\");\n $(\".lifes\").find(\"li\").each(function (index) {\n $(this).show();\n });\n\n count = 0;\n lifes = 4;\n}", "function resetVenForm(){\r\n\tdocument.getElementById(\"venNameErr\").innerHTML = '';\r\n\tdocument.getElementById(\"venLocationErr\").innerHTML = '';\r\n\tdocument.getElementById(\"venEmailErr\").innerHTML = '';\r\n\tdocument.getElementById(\"venMobileErr\").innerHTML = '';\r\n}", "function _resetForm()\r\n {\r\n //alert(\"htmldata.js -> _resetForm \\n chgFlds: \" + this._mChangedFields);\r\n\r\n for (var index = 0; index < this._mChangedFields.length; ++index)\r\n {\r\n var item = this._mChangedFields[index];\r\n var obj = getElemnt(item);\r\n\r\n if(obj)\r\n {\r\n //alert(obj.outerHTML + \" \\n obj.defaultValue = \" + obj.defaultValue + \"---\");\r\n\r\n //reset image association field if any\r\n var objImg = getElemnt(\"img_icon_\"+ obj.id );\r\n\r\n if(objImg)\r\n {\r\n //alert(\"objImg.defaultValue \" + objImg.defaultValue);\r\n objImg.src = objImg.defaultValue;\r\n }\r\n\r\n if(obj)\r\n {\r\n //alert(\"obj.type = \" + obj.type);\r\n //Tracker#: 15802 TECH SPEC OVERVIEW SHOULD ALWAYS WARN USER WHEN THEY MAKE A CHANGE AND DO NOT SAVE\r\n //ucheck the checked checkboxes once the form data is reset.\r\n if(obj.type && obj.type.toUpperCase()==\"CHECKBOX\")\r\n {\r\n //alert('obj.defaultValue ' + obj.defaultValue);\r\n if(obj.defaultValue && _isChangeFieldNotify(obj))\r\n {\r\n //alert(\"checked\");\r\n obj.checked=true;\r\n }\r\n else\r\n {\r\n //alert(\"-----unchecked-----\");\r\n obj.checked=false;\r\n }\r\n }\r\n //alert(\"setting value \" + obj.defaultValue);\r\n obj.value = obj.defaultValue;\r\n }\r\n\r\n //reset validation fields\r\n if(_isDescField(obj))\r\n {\r\n obj = getElemnt(obj.id + _FIELDS_SEPERATOR + \"desc\");\r\n\r\n if(obj)\r\n {\r\n obj.value = obj.defaultValue;\r\n }\r\n }\r\n }\r\n }\r\n }", "function resetForm() {\ndocument.getElementById(\"nome\").value = \"\";\ndocument.getElementById(\"cognome\").value = \"\";\ndocument.getElementById(\"età\").value = \"\";\n}", "function resetJsAttributeVars(){\n\t//Determinamos los valores para realizar la b?squeda\n\tjsCalGuiasCodGuia = '';\n\tjsCalGuiasDpteOidDepa = '';\n\tjsCalGuiasValTitu = '';\n\tjsCalGuiasFecInicVali = '';\n\tjsCalGuiasFecFinVali = '';\n\tjsCalGuiasValDescGuia = '';\n\t\n}", "function again(){\n principal.value = '';\n time.value = '';\n rate.value = '';\n result.value = '';\n }", "function limpiar() {\n\t$(\"#idcliente\").val(\"\");\n\t$(\"#idventa\").val(\"\");\n\t$(\"#serie_comprobante\").val(\"\");\n\t$(\"#num_comprobante\").val(\"\");\n\t$(\"#total_venta\").val(\"\");\n\t$(\".filas\").remove();\n\t$(\"#total\").html(\"0\");\n}", "function resetMuda() {\n $('#square-one').text('');\n $('#square-two').text('');\n $('#square-three').text('');\n $('#square-four').text('');\n $('.letterpickbox div').css('color', 'black');\n $('.wordpickbox div').css('color', 'black');\n}", "function resetAll() {\n\n // Palette1 checked by default\n paletteOne.checked = true;\n\n // Reset form fields\n document.querySelector('#email-input').value = '';\n document.querySelector('#phone-input').value = '';\n document.querySelector('#linkedin-input').value = '';\n document.querySelector('#github-input').value = '';\n document.querySelector('#name-input').value = '';\n document.querySelector('#job-input').value = '';\n\n // Default Name & Rol in preview card\n outputName.innerHTML = 'Nombre Apellidos';\n outputJob.innerHTML = 'Front-end developer';\n\n // Default inputImage y addImpage \n const imageUrl = './assets/images/queen.gif';\n profileImage.style.backgroundImage = `url(${imageUrl})`;\n profilePreview.style.backgroundImage = `url(${imageUrl})`;\n\n // Icons hidden & Default Color\n previewOne();\n emailIcon.classList.add('hidden');\n phoneIcon.classList.add('hidden');\n linkedinIcon.classList.add('hidden');\n githubIcon.classList.add('hidden');\n}", "clean(){\n console.clear();\n this.display.innerHTML = \"0\";\n this.toDisplay = \"\";\n this.agregados = \"\";\n this.toAdd = \"\";\n }", "function fSetFormulario(iCampTipo,iFactor,iVariable,iValor){\n iCampo=iCampTipo;\n iFac=iFactor;\n iVar=iVariable;\n iVal=iValor;\n}", "resetForm() {\n this.name.value = '';\n this.rating.value = 3;\n this.stars.innerHTML = this.star.repeat(3);\n this.comments.value = '';\n }", "function reset()\n\t\t{\n\t\t\t\n\t\t\tfor(var i=0;i<a;i++)\n\t\t\t{\n\t\t\t\tvar a1=$(element).find(\"#g\"+i).get(0);\n\t\t\t\t\n\t\t\t\tvar a2=$(element).find(\"#s\"+i).get(0);\n\t\t\t\t\n\t\t\t\ta2.innerHTML = \"\";\n\t\t\t\ta1.removeAttribute(\"style\");\n\t\t\t\ta1.removeAttribute(\"value\");\n\t\t\t\ta1.removeAttribute(\"readonly\");\n\t\t\t\ta1.value = \"\";\n\t\t\t}\n\t\t\t\t\n\t\t}", "function reset(){\n questionCount = 0;\n unanswered = 0;\n wrong = 0;\n right = 0;\n $(\"#allQuestions\").html('');\n $(\"#score\").html('');\n $(\"#timeLeft\").html('');\n }", "function rst_r_sft_v(){\ndocument.getElementById(\"Ropani_i\").value=0;\ndocument.getElementById(\"Aana_i\").value=0;\ndocument.getElementById(\"Paisa_i\").value=0;\ndocument.getElementById(\"Daam_i\").value=0;\ndocument.getElementById(\"r_sft_o\").value=0;\n}", "function hi_reset_builder() {\n var data = $.parseJSON($('#hi-def-tpl').text());\n $('#hi-tpl-id').val('');\n $('#hi-tpl-id-title').empty().text($('#hi-tpl-id-title').data('text'));\n $('.hi-preview-sizes').find('option:selected').removeAttr('selected');\n $('.hi-preview-sizes').trigger('change');\n HI._loadData(data);\n }", "function reset() {\n var calc = document.getElementById(\"calc\");\n var answer = document.getElementById(\"answer\");\n var error = document.getElementById(\"error\");\n\n calc.innerText = \"\";\n answer.innerText = \"\";\n error.innerText = \"\";\n}", "function limpiar_formulario(){\n $(\"form#venta-boleto\")[0].reset();\n $(\"input[name=boleto-idpasajero]\").val(null);\n\n}", "function reset() {\n\tiQ = 0;\n\ttotal = iQ;\n\tnumCorrect = 0;\n\t$('.explanationBlock').text('');\n\tupdate();\n\tsetCurrent();\n\tsetZero();\n}", "function LimpiarCampos(){\n $(\"#nombre_apiario\").html(\"\");\n $(\"#fecha_creacion\").html(\"\");\n $(\"#numero_colmenas\").html(\"\");\n $(\"#provincia\").html(\"\");\n $(\"#titulo\").html(\"\");\n}", "function resetForm() {\n\t\t// Zero out all values for new recipe entry \n\t\t$(\"recipeTitle\").value = \"\"\n\t\t$(\"recipeSummary\").value = \"\"\n\t\t$(\"userDifficulty\").value = \"\"\n\t\t$(\"chooseDate\").value = \"\"\n\t\t$(\"flavorRange\").value = \"\"\n\t\t$(\"ingredients\").value = \"\"\n\t\t$(\"directions\").value = \"\"\n\t\tclearRadioValue('recipeCat');\n\t}", "function resetearCampos()\n{\t$(\"#formGenerico input[@type=text]\").attr(\"value\",\"\");\n\t$(\"#formGenerico select\").attr(\"value\",\"\");\n\t$(\"#formGenerico textarea\").attr(\"value\",\"\");\n}", "function mostrarXsumir(valor){\n // Dentista-Tratamento\n document.formFuncionario.croTratamento.value = \"\";\n document.formFuncionario.especialidadeTratamento.value = \"\";\n document.formFuncionario.comissaoTratamento.value = \"\";\n // Dentista-Orcamento\n document.formFuncionario.croOrcamento.value = \"\";\n document.formFuncionario.especialidadeOrcamento.value = \"\";\n document.formFuncionario.comissaoOrcamento.value = \"\";\n // Dentista-Orcamento-Tratamento\n document.formFuncionario.croOrcamentoTratamento.value = \"\";\n document.formFuncionario.especialidadeOrcamentoTratamento.value = \"\";\n document.formFuncionario.comissaoOrcamentoTratamento.value = \"\";\n document.formFuncionario.comissaoTratamentoOrcamento.value = \"\";\n if (valor == 'Dentista-Tratamento') {\n var abreDiv = document.getElementById('infoAddDentistaOrcamento');\n abreDiv.style.display = 'none';\n var abreDiv2 = document.getElementById('infoAddDentistaTratamento');\n abreDiv2.style.display = 'block';\n var abreDiv3 = document.getElementById('infoAddDentistaOrcamentoTratamento');\n abreDiv3.style.display = 'none';\n document.formFuncionario.grupoAcessoDentistaTratamento.disabled = false;\n document.formFuncionario.grupoAcessoDentistaTratamento.checked = true;\n document.formFuncionario.grupoAcessoDentistaOrcamento.checked = false;\n document.formFuncionario.grupoAcessoDentistaOrcamento.disabled = true;\n }\n else {\n if (valor == 'Dentista-Orcamento') {\n var abreDiv4 = document.getElementById('infoAddDentistaTratamento');\n abreDiv4.style.display = 'none';\n var abreDiv5 = document.getElementById('infoAddDentistaOrcamento');\n abreDiv5.style.display = 'block';\n var abreDiv6 = document.getElementById('infoAddDentistaOrcamentoTratamento');\n abreDiv6.style.display = 'none';\n document.formFuncionario.grupoAcessoDentistaOrcamento.disabled = false;\n document.formFuncionario.grupoAcessoDentistaOrcamento.checked = true;\n document.formFuncionario.grupoAcessoDentistaTratamento.checked = false;\n document.formFuncionario.grupoAcessoDentistaTratamento.disabled = true;\n }\n else {\n if (valor == 'Dentista-Orcamento-Tratamento') {\n var abreDiv7 = document.getElementById('infoAddDentistaTratamento');\n abreDiv7.style.display = 'none';\n var abreDiv8 = document.getElementById('infoAddDentistaOrcamento');\n abreDiv8.style.display = 'none';\n var abreDiv9 = document.getElementById('infoAddDentistaOrcamentoTratamento');\n abreDiv9.style.display = 'block';\n document.formFuncionario.grupoAcessoDentistaTratamento.checked = true;\n document.formFuncionario.grupoAcessoDentistaOrcamento.checked = true;\n document.formFuncionario.grupoAcessoDentistaTratamento.disabled = false;\n document.formFuncionario.grupoAcessoDentistaOrcamento.disabled = false;\n }\n else {\n var abreDiv10 = document.getElementById('infoAddDentistaTratamento');\n abreDiv10.style.display = 'none';\n var abreDiv11 = document.getElementById('infoAddDentistaOrcamento');\n abreDiv11.style.display = 'none';\n var abreDiv12 = document.getElementById('infoAddDentistaOrcamentoTratamento');\n abreDiv12.style.display = 'none';\n document.formFuncionario.grupoAcessoDentistaTratamento.checked = false;\n document.formFuncionario.grupoAcessoDentistaOrcamento.checked = false;\n document.formFuncionario.grupoAcessoDentistaTratamento.disabled = true;\n document.formFuncionario.grupoAcessoDentistaOrcamento.disabled = true;\n }\n }\n }\n}", "function limpiar(){\n $(\"#fondoL\").val(0);\n $(\"#fondoN\").val(0);\n $(\"#ahorro\").val(0);\n \n \n}", "function setFieldParas1(newReihenAnzahl) {\r\n\r\n //Falls die Angabe 16 Reihen übersteigt\r\n if(newReihenAnzahl > 16) {\r\n document.getElementById (\"warning1\").innerHTML = \"o_O Du spinnst doch. Ich setz das mal auf 16.\";\r\n document.getElementById (\"warning1\").style.color = \"red\";\r\n document.getElementById (\"reihenAnzahl\").value = \"16\";\r\n // amountFieldColumns = 16; - NODE(35)\r\n clixxx(35, {amountFieldColumns: 16});\r\n }\r\n\r\n else {\r\n\r\n //Falls die Angabe nicht durch 2 teilbar ist\r\n if(newReihenAnzahl % 2 == 0) {\r\n\r\n document.getElementById (\"warning1\").innerHTML = \"Ne ungerade Zahl is schöner. Ich pass das mal an.\";\r\n document.getElementById (\"warning1\").style.color = \"red\";\r\n document.getElementById (\"reihenAnzahl\").value = newReihenAnzahl-1;\r\n //Die \", 10\" im parseInt stehen für das Zahlensystem. Könnte sonst Probleme geben, wenn JS das Oktalsystem nimmt statt das Dezimalsystem\r\n // amountFieldColumns = parseInt(newReihenAnzahl-1, 10); - NODE(35)\r\n help = parseInt(newReihenAnzahl-1, 10);\r\n if (help < 1){\r\n help = 1;\r\n }\r\n clixxx(35, {amountFieldColumns: help});\r\n\r\n }\r\n\r\n else{\r\n document.getElementById (\"warning1\").innerHTML = newReihenAnzahl+\" Reihen. Viel Spaß\";\r\n document.getElementById (\"warning1\").style.color = \"green\";\r\n // amountFieldColumns = parseInt(newReihenAnzahl, 10); - NODE(35)\r\n help2 = parseInt(newReihenAnzahl, 10);\r\n clixxx(35, {amountFieldColumns: help});\r\n }\r\n }\r\n }", "function clean_imput(){\n\tfor (var i=1; i < 4; i++) {\n\t\tdocument.getElementById(\"base\"+i).value=\"\";\n\t\tdocument.getElementById(\"altura\"+i).value=\"\";\n\t \tdocument.getElementById(\"area\"+i).value=\"\";\n\t}\n\t \n}", "function setAllInputAndTextAfterAllFinalCalculation()\n {\n $('.cr_totalAmount').text(getTotalAmount());\n $('.cr_subtotal_amount').text(\"(\"+getSubTotalByProductAmountAndQuantity()+\")\");\n $('.cr_discount_amount').text(\"(\"+getTotalDiscountAmount()+\")\");\n $('.cr_netTotalAmount').val(getTotalAmount());\n\n /* Selected Unit Name*/\n selectedUnitName();\n }", "function calcular(){ \n\n\n \n let total = soma(rend) - soma(des)\n \n if( Number(rend) == 0 || Number(des) == 0 ) {\n erro.style.display = 'block'\n } else if(total >0) {\n res.style.display='block'\n form.style.display = 'none'\n botaodecalcular.style.display = 'none'\n document.body.style.background= '#0000FF'\n retorno.style.display = 'block'\n res.innerHTML+= `SALDO POSITVO`\n res.innerHTML+= ` <p> O final e de: R$${total.toFixed(2)}</p>`\n \n } else {\n res.style.display='block'\n form.style.display = 'none'\n botaodecalcular.style.display = 'none'\n document.body.style.background= '#FF0000'\n retorno.style.display = 'block'\n res.innerHTML+= `SALDO NEGATIVO \\u{2716}`\n res.innerHTML+= `<p> O saldo negativo e de: R$${total.toFixed(2)}</p> `\n }\n\n \n \n///Boatao para voltar ao formulario\n}", "function init(){\n //variables de la aplicacion\n var pantalla = document.getElementById('display');\n var clear = document.getElementById('on');\n var masMenos = document.getElementById('sign');\n var suma = document.getElementById('mas');\n var division = document.getElementById('dividido');\n var siete = document.getElementById('7');\n var ocho = document.getElementById('8');\n var nueve = document.getElementById('9');\n var multiplicacion = document.getElementById('por');\n var cuatro = document.getElementById('4');\n var cinco = document.getElementById('5');\n var seis = document.getElementById('6');\n var resta = document.getElementById('menos');\n var uno = document.getElementById('1');\n var dos = document.getElementById('2');\n var tres = document.getElementById('3');\n var cero = document.getElementById('0');\n var punto = document.getElementById('punto');\n var igual = document.getElementById('igual');\n\n //Eventos de la aplicacion\n uno.onclick = function(e){\n if (pantalla.textContent === \"0\") {\n pantalla.textContent = \" \";\n }\n if (pantalla.textContent.length >= 8 ) {\n\n }\n else {\n pantalla.textContent = pantalla.textContent + \"1\";\n }\n }\n\n dos.onclick = function(e){\n if (pantalla.textContent === \"0\") {\n pantalla.textContent = \"\";\n }\n if (pantalla.textContent.length >= 8 ) {\n\n }\n else {\n pantalla.textContent = pantalla.textContent + \"2\";\n }\n }\n\n tres.onclick = function(e){\n if (pantalla.textContent === \"0\") {\n pantalla.textContent = \"\";\n }\n if (pantalla.textContent.length >= 8 ) {\n\n }\n else {\n pantalla.textContent = pantalla.textContent + \"3\";\n }\n }\n\n cuatro.onclick = function(e){\n if (pantalla.textContent === \"0\") {\n pantalla.textContent = \"\";\n }\n if (pantalla.textContent.length >= 8 ) {\n\n }\n else {\n pantalla.textContent = pantalla.textContent + \"4\";\n }\n }\n\n cinco.onclick = function(e){\n if (pantalla.textContent === \"0\") {\n pantalla.textContent = \"\";\n }\n if (pantalla.textContent.length >= 8 ) {\n\n }\n else {\n pantalla.textContent = pantalla.textContent + \"5\";\n }\n }\n\n seis.onclick = function(e){\n if (pantalla.textContent === \"0\") {\n pantalla.textContent = \"\";\n }\n if (pantalla.textContent.length >= 8 ) {\n\n }\n else {\n pantalla.textContent = pantalla.textContent + \"6\";\n }\n }\n\n siete.onclick = function(e){\n if (pantalla.textContent === \"0\") {\n pantalla.textContent = \"\";\n }\n if (pantalla.textContent.length >= 8 ) {\n\n }\n else {\n pantalla.textContent = pantalla.textContent + \"7\";\n }\n }\n\n ocho.onclick = function(e){\n if (pantalla.textContent === \"0\") {\n pantalla.textContent = \"\";\n }\n if (pantalla.textContent.length >= 8 ) {\n\n }\n else {\n pantalla.textContent = pantalla.textContent + \"8\";\n }\n }\n\n nueve.onclick = function(e){\n if (pantalla.textContent === \"0\") {\n pantalla.textContent = \"\";\n }\n if (pantalla.textContent.length >= 8 ) {\n\n }\n else {\n pantalla.textContent = pantalla.textContent + \"9\";\n }\n }\n\n cero.onclick = function(e){\n\n if (pantalla.textContent === \"0\") {\n pantalla.textContent = \"\";\n }\n if (pantalla.textContent.length >= 8 ) {\n\n }\n else {\n pantalla.textContent = pantalla.textContent + \"0\";\n }\n }\n\n//Pone la pantalla en cero\n clear.onclick = function(e){\n pantalla.textContent = \"0\";\n }\n\n//Añade el punto y verifica que no se repita\n punto.onclick = function(e){\n operandoa = pantalla.textContent;\n if ((operandoa) && (decimal == 0)) {\n pantalla.textContent = operandoa + \".\";\n decimal = 1;\n } else {\n operandoa;\n }\n }\n\n//Operaciones\n\nmasMenos.onclick = function(e){\n operandoa = pantalla.textContent;\n if (operandoa != 0) {\n pantalla.textContent = '-' + operandoa;\n }\n}\n\n suma.onclick = function(e){\n operandoa = pantalla.textContent;\n operacion = \"+\";\n limpiar();\n }\n\n resta.onclick = function(e){\n operandoa = pantalla.textContent;\n operacion = \"-\";\n limpiar();\n }\n\n multiplicacion.onclick = function(e){\n operandoa = pantalla.textContent;\n operacion = \"*\";\n limpiar();\n }\n\n division.onclick = function(e){\n operandoa = pantalla.textContent;\n operacion = \"/\";\n limpiar();\n }\n\n igual.onclick = function(e){\n operandob = pantalla.textContent;\n resolver();\n }\n\n//Funcion para limpiar pantalla al tocar signo\n function limpiar(){\n pantalla.textContent = \"\";\n }\n function reset(){\n pantalla.textContent = \"\"; //Se llama desde el clear para limpiar variables\n operandoa = 0;\n operandob = 0;\n operacion = 0;\n decimal = 0;\n }\n\n function resolver(){\n var resp = 0;\n switch(operacion){\n case \"+\":\n resp = parseFloat(operandoa) + parseFloat(operandob);\n resp = resp.toString();\n if (resp.length >= 8) {\n resp = parseFloat(resp);\n res = resp.toExponential(2);\n } else {\n res = resp;\n }\n break;\n case \"-\":\n resp = parseFloat(operandoa) - parseFloat(operandob);\n resp = resp.toString();\n if (resp.length >= 8) {\n resp = parseFloat(resp);\n res = resp.toExponential(2);\n } else {\n res = resp;\n }\n break;\n case \"*\":\n resp = parseFloat(operandoa) * parseFloat(operandob);\n resp = resp.toString();\n if (resp.length >= 8) {\n resp = parseFloat(resp);\n res = resp.toExponential(2);\n } else {\n res = resp;\n }\n break;\n case \"/\":\n resp = parseFloat(operandoa) / parseFloat(operandob);\n resp = resp.toString();\n if (resp.length >= 8) {\n resp = parseFloat(resp);\n res = resp.toExponential(2);\n } else {\n res = resp;\n }\n break;\n }\n reset();\n pantalla.textContent = res;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}", "function limpiar_vent_gen(){\n contenGen.getForm().reset();\n ventGen.hide();\n}", "function reset_forms() {\n $(\"#fancy_unit\").hide();\n $(\"#fancy_position\").hide();\n $(\"#fancy_new_employee\").hide();\n $(\"#fancy_edit_unit\").hide();\n $(\"#fancy_edit_position\").hide();\n $(\"#fancy_edit_employee\").hide();\n $(\"#add_employee\").hide();\n $(\"#edit_employee\").hide();\n $(\"#fancy_delete_employee\").hide();\n $(\"#fancy_curr_employee\").hide();\n $(\"input[type=radio][name=chart_type]\").attr('checked', false);\n $(\"input[type=radio][name=employee_type]\").attr('checked', false);\n $(\"input[type=radio][name=change]\").attr('checked', false);\n $(\"#add_curr\").attr(\"disabled\", true);\n $(\"#employees\").val(\"\");\n $(\".cform textarea\").val(\"\");\n $(\"#btn_remove_all_field_extra\").click();\n $(\".validation-warning\").text(\"\");\n reset_moreNodesWarning();\n console.log(\"reset_forms\");\n}", "reset(...values) {\n this.inputs.forEach( (input, i) => this[\"v\" + (i+1)] = (values[i] || 0) );\n this.displayTime();\n this.displayLap();\n if(this.hours) this.hours = false;\n }", "function resetResultDisplay() {\n\n document.getElementById(\"result1\").value = \" \";\n document.getElementById(\"result2\").value = \" \";\n document.getElementById(\"result3\").value = \" \";\n document.getElementById(\"result4\").value = \" \";\n}", "function resetProd(){\n $(\"#nombre\").val(\"\")\n $(\"#marca\").val(\"\")\n $(\"#costo\").val(\"\")\n $(\"#ganancia\").val(\"\")\n $(\"#cantidad\").val(\"\")\n}", "function clearAll() {\r\n document.getElementById('num1').innerHTML = '';\r\n document.getElementById('num3').innerHTML = '';\r\n document.getElementById('operador').innerHTML = '';\r\n document.getElementById('resultado').innerHTML = '0';\r\n}", "function resetProduit() {\n document.getElementById(\"qte\").value = \"\";\n document.getElementById(\"prix\").value = \"\";\n \n}", "function reset_form() {\n $(\".constraints\")[0].reset();\n $(\".constraints .min, .constraints .max\").css({color: \"#D3D3D3\"});\n $('#right').css({visibility: \"hidden\"});\n $('#showFeasible').text(\"\");\n}", "function resetuj(niz1, niz2)\n{\n\tnizBac = [0,0,0,0,0];\n\tbrojBacanja = 0;\n\n\tfor (var i=0; i<5; ++i)\n\t{\n\t\tniz1[i].innerHTML=\"&nbsp;\";\n\t\tniz2[i].innerHTML=\"&nbsp;\";\n\t}\n\n\tbrBacFunc(brojBacanja);\n}", "function limpa_formulário_cep() {\n //Limpa valores do formulário de cep.\n document.getElementById('id_logradouro').value = (\"\");\n document.getElementById('id_bairro').value = (\"\");\n document.getElementById('id_cidade').value = (\"\");\n document.getElementById('id_estado').value = (\"\");\n}" ]
[ "0.67659736", "0.6640162", "0.66134346", "0.65528035", "0.65280336", "0.6521241", "0.6515523", "0.6472782", "0.64632297", "0.6454967", "0.64483726", "0.64163154", "0.64109564", "0.63575697", "0.6344303", "0.6288361", "0.6284798", "0.6259696", "0.62535155", "0.62505877", "0.62499344", "0.62409735", "0.6236198", "0.623234", "0.62200886", "0.62097955", "0.6207567", "0.6207012", "0.62058425", "0.62038547", "0.61940676", "0.6163463", "0.61591166", "0.6156198", "0.6151646", "0.61513287", "0.6145313", "0.61234057", "0.6120876", "0.61024207", "0.61018264", "0.610111", "0.6093767", "0.60788333", "0.60684097", "0.6063201", "0.6063192", "0.6062087", "0.604844", "0.6047286", "0.6045381", "0.6044733", "0.6033963", "0.6029774", "0.6022802", "0.60191244", "0.60115176", "0.60019237", "0.6000873", "0.5994514", "0.599364", "0.59904075", "0.5986384", "0.5986003", "0.5980697", "0.5980389", "0.5979493", "0.59774655", "0.59745985", "0.59727556", "0.59706014", "0.5962002", "0.5960933", "0.59575313", "0.59555167", "0.5951824", "0.5949671", "0.5947051", "0.59404504", "0.59362817", "0.5932607", "0.59307575", "0.59276414", "0.5921366", "0.59213275", "0.5912854", "0.59122944", "0.59010226", "0.5897579", "0.58962476", "0.5893222", "0.5890749", "0.5883996", "0.5882739", "0.58823514", "0.5873742", "0.58719265", "0.5867017", "0.586682", "0.58659434" ]
0.6872335
0
render() returns the HTML for LoginButton
render () { return ( <a href="#" className="btn btn-default btn-lg" onClick={this.handler} id="btnLogin">Login</a> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderLoginButton() {\n var loginButtonContainer = document.getElementById(\"firebaseui-auth-container\");\n var loginButtonHTML = getLoginButtonHTML();\n loginButtonContainer.innerHTML = loginButtonHTML;\n}", "render() {\n <div class=\"login-box\" id=\"login-box\">\n <input autocomplete=\"off\" type=\"text\" class=\"email\" id=\"email\" placeholder=\"email\">\n <input type=\"password\" class=\"password\" id=\"password\" placeholder=\"password\">\n <br>\n <br> \n \n <div class=\"login-buttons\">\n <button type=\"button\" class=\"btn btn-login\" id=\"login-btn\">Login</button>\n <button type=\"button\" class=\"btn btn-default\" id=\"sign-up-btn\">Sign up</button>\n </div>\n </div>\n }", "function getLoginButtonHTML() {\n var btnClass = \"\";\n var btnText = \"\";\n\n if (isUserLoggedIn()) {\n btnClass = \"btn-logout\";\n btnText = \"Sign Out\";\n }\n else {\n btnClass = \"btn-login\";\n btnText = \"Login\";\n }\n\n return `<button id=\"LoginBtn\" class=\"btn btn-primary ${btnClass}\">${btnText}</button>`\n}", "renderLogIn()\n {\n return (\n <div id=\"login\">\n <Login\n callback={this.loginCallback}\n />\n <p>no account? <button onClick={this.registerButtonHandler}>register here</button></p>\n </div>\n );\n }", "function renderLoginPage() {\n return `\n\t\t<section class=\"login-screen\" aria-live=\"assertive\">\n\t\t\t<form role=\"form\" class=\"login\">\n\t\t\t\t<fieldset name=\"login-info\">\n\t\t\t\t\t<div class=\"login-header\">\n <legend>Log In</legend>\n <hr class=\"style-two\">\n\t\t\t\t </div>\n\t\t\t\t <p id='notification'></p>\n\t\t\t\t\t<label for=\"email\" required>Email</label>\n\t\t\t\t\t<input type=\"email\" name=\"email\" id=\"email\" placeholder=\"Email address\" required>\n\t\t\t\t\t<label for=\"password\">Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"password\" id=\"password\" placeholder=\"Password\" required>\n\t\t\t\t</fieldset>\n\t\t\t\t<button type=\"submit\" class=\"js-login-button\">Login</button>\n <p>Don't have an account? <a href=\"#\" class =\"nav-signup\">Sign up</a>\n </p>\n <p id=\"demo-note\">Demo Account:\n <br>Email: [email protected]\n <br>Password: testing123</p>\n\t\t\t</form>\n\t\t</section> `;\n}", "render(){\n\t\tconst username = this.state.username.length ? this.state.username : \"\";\n\t\tconst password = this.state.password.length ? this.state.password : \"\";\n\t\treturn(\n\t\t\t<div id=\"login\" className=\"row just-end align-center\">\n\t\t\t\t<div className=\"login-container column-no\">\n\t\t\t\t\t<h2>Login</h2>\n\t\t\t\t\t<form className=\"column-no\" onSubmit={this.verifyUser} >\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<b>User:</b>\n\t\t\t\t\t\t\t<input type=\"text\" value={username} onChange={this.changeUsername}/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<b>Password:</b>\n\t\t\t\t\t\t\t<input type=\"password\" value={password} onChange={this.changePassword}/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<button className=\"login-button\" type=\"submit\" onClick={this.verifyUser}>Login</button>\t\n\t\t\t\t\t</form>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t\t\t\n\t}", "function renderLogin(data, into) {\n\t\t\n\t\t//Add the template\n\t\tinto.innerHTML=`\n\t\t<h2>Lets login, shall we?</h2>\n\t\t<form action=${data.loginToken} method=\"post\">\n\t\t <button type=\"submit\">Login to Instagram</button>\n\t\t</form>\n\t\t`\n\t\t\n\t}", "componentDidMount() {\n // Uses Meteor Blaze to renders login buttons\n this.view = Blaze.render(Template.loginButtons,\n ReactDOM.findDOMNode(this.refs.container));\n }", "render() {\n return <div>Log In Page</div>;\n }", "function renderButton() {\n gapi.signin2.render('gSignIn', {\n 'scope': 'profile email https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly',\n 'width': 240,\n 'height': 50,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onLoginSuccess,\n 'onfailure': onLoginFailure\n });\n}", "function login(){ // render login screen, hide main\n document.getElementById(\"main\").style.display = \"none\";\n\tlet src = document.getElementById(\"loginTemplate\").innerHTML;\n\tlet template = Handlebars.compile(src);\n\tlet context = {}; // {{ N/A }}\n\tlet html = template(context);\n\trender(html);\n\tlet loginButton = document.getElementById(\"loginButton\");\n\tloginButton.addEventListener(\"click\", (e) => {\n\t\te.preventDefault();\n\t\tloginClick();\n\t});\n}", "render() {\n return (\n <div className=\"App\">\n {this.state.users}\n {this.renderLoginButton()}\n </div>\n );\n }", "function LoginButton() {\n const {\n isAuthenticated,\n loginWithRedirect,\n } = useAuth0();\n\n return !isAuthenticated && (\n /* Done: Render a button with label 'Log In'. When the button is clicked then show LoginForm instead */\n <button onClick={loginWithRedirect}>Log in</button>\n )\n}", "function LoginButton(props) {\n return (\n <button id='log-in' className='btn' onClick={props.onClick}>\n Login\n </button>\n );\n }", "render () {\n return (\n <div className=\"auth-page login-page\">\n <AuthHeader/>\n <br/>\n <div className=\"auth-content login-content\">\n <form className=\"form\">\n <TextField label=\"Username\" variant=\"outlined\" margin=\"normal\" onChange={this.updateUsername}/>\n <br/>\n <TextField label=\"Password\" variant=\"outlined\" margin=\"normal\" onChange={this.updatePassword}/>\n </form>\n <br/>\n <Tooltip title=\"login\">\n <button className=\"login-button auth-button journey-button\" onClick={this.onClick}>\n login\n </button>\n </Tooltip>\n <div className=\"switch-auth-text\">\n Don't have an account yet?&nbsp;\n <a href=\"/createAccount\">Sign up</a>\n !\n </div>\n </div>\n </div>\n );\n }", "renderLoginButton() {\n if (this.props.loggedIn) {\n return (\n <button className=\"ui red google button\"\n onClick={this.onSignOut}>\n <i className=\"google icon\" />\n SIGN OUT\n </button>\n )\n } else {\n return (\n <button className=\"ui green google button\"\n onClick={this.onSignIn}>\n <i className=\"google icon\"/>\n SIGN IN\n </button>\n )\n };\n }", "render() {\n return (\n <form onSubmit={this.handleLogin}>\n <fieldset>\n <h3>Sign In</h3>\n <div className=\"xxxxx\">\n <label htmlFor=\"inputUsername\">Username</label>\n <br></br>\n <input onChange={this.handleFieldChange} type=\"username\"\n id=\"username\"\n placeholder=\"Username\"\n required=\"\"\n autoFocus=\"\" />\n <br></br>\n <label htmlFor=\"inputPassword\">Password</label>\n <br></br>\n <input onChange={this.handleFieldChange} type=\"password\"\n id=\"password\"\n placeholder=\"Password\"\n required=\"\" />\n </div>\n <button type=\"submit\">Sign In</button>\n <div>\n <Link to={`/register`}><button>Register</button></Link>\n </div>\n </fieldset>\n </form>\n )\n }", "function renderButton() {\n gapi.signin2.render('my-signin2', {\n 'scope': 'profile',\n 'width': 240,\n 'height': 50,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onSuccess,\n 'onfailure': onFailure\n });\n}", "render() {\n\n\n\n\t\treturn (\n\t\t\t<div className=\"row valign-wrapper\">\n\t\t\t\t\n\n\t\t\t\t<div className=\" card col s5 offset-s3\">\n\n\n\t\t\t\t\t<div className=\"row center\"> Already a member? Login</div>\n\n\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t\t<input type=\"text\" name=\"loginEmail\" value={this.state.loginEmail} onChange={this.handleChange.bind(this)} className=\"cursiveFont col s8 offset-s2\" placeholder=\"email\"/>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t <input type=\"password\" name=\"loginPassword\" value={this.state.loginPassword} onChange={this.handleChange.bind(this)} className=\"cursiveFont col s8 offset-s2\" placeholder=\"password\"/>\n\t\t\t\t\t</div>\n\n\t\t\t\t\n\n\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t <a onClick={this.handleLogin} className=\"waves-effect waves-light btn flat col s4 offset-s4\">Login</a>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"row center\">\n\t\t\t\t\t\t {this.state.loginMessage}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<br/>\n\n\t\t\t\t\t<div className=\"row center\"><Link to=\"/signup\">New member? Signup</Link></div>\n\n\n\t\t\t\t</div>\n\t\t\t\n\n\t\t\t</div>\n\n\n\t\t);\n\t}", "function renderButton() {\n gapi.signin2.render('signin2', {\n 'scope': 'profile email',\n 'width': 250,\n 'height': 40,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onSuccess,\n 'onfailure': onFailure\n });\n\n gapi.signin2.render('registrar-gmail', {\n 'scope': 'profile email',\n 'width': 250,\n 'height': 40,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onSuccess,\n 'onfailure': onFailure\n });\n}", "render() {\r\n\t\treturn (\r\n\t\t\t<div className=\"Login\" align=\"center\">\r\n\t\t\t\t{this.state.newUser === null ?\r\n\t\t\t\t\t<form onSubmit={this.handleSubmit}>\r\n\t\t\t\t\t<FormGroup controlId=\"email\" bsSize=\"medium\">\r\n\t\t\t\t\t\t<ControlLabel>Email</ControlLabel>\r\n\t\t\t\t\t\t<FormControl autoFocus type=\"email\" value={this.state.email} onChange={this.handleChange} />\r\n\t\t\t\t\t</FormGroup>\r\n\t\t\t\t\t<FormGroup controlId=\"password\" bsSize=\"medium\">\r\n\t\t\t\t\t\t<ControlLabel>Password</ControlLabel>\r\n\t\t\t\t\t\t<FormControl value={this.state.password} onChange={this.handleChange} type=\"password\" />\r\n\t\t\t\t\t</FormGroup>\r\n\t\t\t\t\t<LoaderButton block bsSize=\"small\" disabled={!this.validateForm()} type=\"submit\" isLoading={this.state.isLoading} text=\"Login\" loadingText=\"Logging in…\" />\r\n\t\t\t\t\t</form>\r\n\t\t\t\t: this.renderConfirmationForm()\r\n\t\t\t\t}\r\n\t\t\t</div>\r\n\t\t);\r\n\t}", "render() {\n return <div>{this.renderAuthButton()}</div>;\n }", "function showLoginButton() {\n if (typeof showCustomLoginButton === \"function\") {\n showCustomLoginButton(true);\n return;\n }\n\n var loginText = document.createElement('a');\n loginText.href = \"#\";\n loginText.id = \"loginText\";\n loginText.onclick = challengeForAuth;\n loginText.innerText = loginText.textContent = \"[sign in]\";\n document.body.insertBefore(loginText, document.body.children[0]);\n}", "function renderGoogleLoginButton() {\n\n \n \n gapi.signin2.render('gSignIn', {\n 'apiKey': API_KEY,\n 'clientId': CLIENT_ID,\n 'discoveryDocs': DISCOVERY_DOCS,\n 'scope': SCOPES,\n 'width': 240,\n 'height': 50,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onSuccess,\n 'onfailure': onFailure\n });\n}", "render() {\n\t\tif (this.state.is_logged_in) {\n\t\t\treturn (\n\t\t\t\t<div>\n\t\t\t\t\t<div>Hello user</div>\n\t\t\t\t\t<div>Logged in</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<div>\n\t\t\t\t\t<div>Hello user</div>\n\t\t\t\t\t<div>Guest</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\t}", "render() {\n return (\n <div className=\"container\">\n <form>\n <div>\n <fieldset>\n <h3>User Login</h3>\n\n <div>\n <div className=\"field\">\n <label className=\"label\">Email</label>\n <div className=\"control has-icons-left has-icons-right\">\n <input className=\"input is-dark\" onChange={this.handleFieldChange} type=\"email\"\n id=\"email\"\n placeholder=\"Email address\"\n required=\"\" autoFocus=\"\" />\n <span className=\"icon is-small is-left\">\n <i className=\"fas fa-envelope\"></i>\n </span>\n {/* <span className=\"icon is-small is-right\">\n <i className=\"fas fa-exclamation-triangle\"></i>\n </span> */}\n </div>\n <br></br>\n <div className=\"field\">\n <p className=\"control has-icons-left\">\n <input className=\"input is-dark\" onChange={this.handleFieldChange} type=\"password\"\n id=\"password\"\n placeholder=\"Password\"\n required=\"\" />\n <span className=\"icon is-small is-left\">\n <i className=\"fas fa-lock\"></i>\n </span>\n </p>\n </div>\n </div>\n\n <button className=\"button is-info\" onClick={this.handleLoginSubmit} type=\"submit\">\n Enter\n </button>\n </div>\n </fieldset>\n </div>\n </form >\n \n </div>\n )\n }", "function render_login(username, password, error){\n return res.render('sign-in', {error1: '', error2: error, username: username, password: password})\n }", "render() {\n return (\n <div className=\"col-3\">\n {/* Use conditional rendering to render a message \n and a sign in/sign out button here. If isLoggedIn\n is false, render a sign in message and button. If\n isLoggedIn is true, render a welcome message and\n a sign out button */}\n </div>\n )\n }", "get loginBtn () { return $('#btnLogin') }", "render() {\n return (\n <div className=\"navbar__login\">\n <Link to=\"login\">\n <button className=\"navbar__login__button\">Login</button>\n </Link>\n </div>\n );\n }", "function getLoginHtml() {\n return `<img onclick=\"showModal('${INFO_HTML_PATH}')\" class=\"btn btn-icon\" src=\"icons/help.svg\">\n <a class=\"btn btn-outline-primary btn-color\" onclick=\"showLogin()\" style=\"color: #049688\">Login</a>\n <span id=\"nav-text\">or</span>\n <a class=\"btn btn-outline-primary btn-color\" onclick=\"showSignUp()\" style=\"color: #049688\">Sign up</a>`;\n}", "function drawUserLogin() {\n console.log('not logged In')\n document.getElementById('auth').innerHTML = `\n <form onsubmit=\"app.controllers.authController.login(event)\">\n <input type=\"email\" name=\"email\" placeholder=\"email\" required>\n <input type=\"password\" name=\"password\" placeholder=\"password\" required>\n <button type=\"submit\">Login</button>\n </form>\n <p onclick=\"app.controllers.authController.showRegister()\">Click to Register</p>\n `\n\n}", "function renderLogin() {\n let loginContainer = document.querySelector(\"#login-form-container\");\n loginContainer.style.display = \"block\"\n loginContainer.innerHTML = \n `<form id=\"login-form\" class=\"m-3\">\n <p class=\"text-light\">Login</p>\n <div class=\"row\">\n <div class=\"col-sm\">\n <input id=\"namevalue\" name=\"userName\" type=\"text\" class=\"form-control\" placeholder=\"Enter a Name\">\n </div>\n </div>\n <input class=\"btn btn-primary mt-2\" id=\"submit\" type=\"submit\">\n </form>`;\n let loginForm = document.querySelector(\"#login-form\");\n loginForm.addEventListener('submit', (event) => {\n event.preventDefault()\n login(event.target.userName.value)\n })\n \n //add create a player button\n let newPlayerBtn = document.createElement('button')\n newPlayerBtn.innerText = \"Create A PLayer\"\n newPlayerBtn.classList.add(\"btn\")\n newPlayerBtn.classList.add(\"btn-primary\")\n newPlayerBtn.classList.add(\"mt-2\")\n newPlayerBtn.addEventListener('click', () => {\n renderCreatePlayerForm()\n })\n loginContainer.append(newPlayerBtn)\n}", "render(){\n //Every render method always return HTML\n //lets create a local variable\n let {isLoggedIn} = this.state;\n return(\n <div>\n <h1>Conditional Rendering</h1>\n {\n //immediately-invoked function expression\n //(function(){})()\n (function(){\n if(isLoggedIn){\n //True\n return <button>Logged Out</button>\n }else{\n //False\n return <button>isLogged In</button>\n }\n })()\n }\n </div>\n );\n }", "render() {\n\t\treturn (\n\t\t\t<div>\n\n\t\t\t<div className=\"loginPageBackground\" />\n\t\t\t<img\n\t\t\tid = \"loginLogo\"\n\t\t\tsrc=\"/images/aopaLOGO.png\"\n\t\t\talt=\"AOPA\"\n\t\t\t/>\n\t\t\t<div id=\"loginPageContainer\" className=\"container\">\n\t\t\t<div className=\"row\">\n\t\t\t<div className=\"col-md-6 col-md-offset-3\">\n\t\t\t <div className=\"panel panel-login loginPanel\">\n\t\t\t\t\t<div className=\"panel-body\">\n\t\t\t\t\t <div className=\"row\">\n\t\t\t\t\t\t\t<div className=\"col-lg-12\">\n\t\t\t\t\t\t\t <Login />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t </div>\n\t\t\t\t\t</div>\n\t\t\t </div>\n\t\t\t</div>\n\t\t </div>\n\t\t</div>\n\t\t</div>\n\t\t)\n\t}", "render() {\n let tokens = \"\";\n this.permissions.forEach(p => tokens = tokens + Permission.render(p));\n if(tokens === \"\") tokens = \"<h3>No tokens found for this user</h3>\";\n\n let cert = \"\";\n this.certificate.forEach(c => cert = cert + this.renderCert(c));\n if(cert === \"\") cert = \"<h3>No certificates found for this user</h3>\";\n\n return \"<div class='user'><div class='userName'>\"+ this.name +\n '</div><button class=\"collapsible\"> Tokens: </button><div class=\"content\">' + tokens +\"</div> <button class='collapsible'> Certificates: </button><div class='content'>\" + cert +\"</div></div>\";\n }", "render () {\n return (\n\n <div class=\"row d-flex justify-content-center bg-dark\">\n <div className=\"col-sm-6 col-10 text-center\">\n <div className=\"text-white\">\n <h1 className=\"display-2 mt-5\">Bazaar</h1>\n <hr className=\"border-color-white row\"/>\n <h1 className=\"display-5\">Log In</h1>\n\n </div>\n\n {this.state.loginError &&\n <div class=\"alert alert-danger\" role=\"alert\">\n Username and Password combination not found\n </div>\n }\n\n\n <form>\n <div className=\"form-group row\">\n <label for=\"username\" class=\"col-form-label text-white\">\n Username \n </label>\n <input class=\"form-control\" placeholder=\"Username\" value={this.state.username}\n onChange={(e) => this.setState({\n username: e.target.value\n })}/>\n </div>\n\n <div className=\"form-group row\">\n <label for=\"password\" class=\"col-form-label text-white\">\n Password\n </label>\n <input type=\"password\" class=\"form-control\" placeholder=\"Password\" value={this.state.password}\n onChange={(e) => this.setState({\n password: e.target.value\n })}\n />\n </div>\n\n <br/>\n\n <div className=\"form-group row\">\n <button className=\"btn btn-block btn-success\"\n onClick={(e) => {\n e.preventDefault();//FIXME: Temporary workaround Prevents refreshing of the page (in order to show alert.)\n this.login();\n }}>Login</button>\n <a className=\"btn btn-block btn-success\" href=\"/register\">Register</a>\n <a className=\"btn btn-block btn-danger\" href=\"/\">Cancel</a>\n </div>\n </form>\n\n </div>\n </div>\n\n )\n }", "get btnLogin () { return $('#back-to-login') }", "renderLogin() {\n return (\n <div className=\"col-md-6 log-reg\">\n <h2 className=\"text-center\">Log In</h2>\n <form>\n <label className=\"col-form-label col-md-6\">\n Correo\n </label>\n <input name=\"emailLog\" type=\"text\" onChange={this.handleInputChange.bind(this)} value={this.state.emailLog}/>\n <label className=\"col-form-label col-md-6\">\n Contraseña\n </label>\n <input name=\"passwordLog\" type=\"password\" onChange={this.handleInputChange.bind(this)} value={this.state.passwordLog}/>\n <br/>\n <div className=\"row justify-content-center align-self-center\">\n <button type=\"button\" className=\"btn-format\" onClick={this.handleLoginClick.bind(this)}>Log In</button>\n </div>\n </form>\n </div>\n );\n }", "function renderSignOut(){\n return`\n <button class=\"mdl-button mdl-js-button sign-out\">Sign Out</button>\n `\n }", "async function displayLogIn() {\n const loginResponse = await fetch('/login');\n const loginInfo = await loginResponse.json();\n \n const userEmail = loginInfo.email;\n const url = loginInfo.url;\n\n const loginContainer = document.getElementById(\"login\");\n\n if(userEmail != \"stranger\") {\n loginContainer.innerHTML = createLoginTemplate(userEmail, url, \"out\");\n }\n else {\n loginContainer.innerHTML = createLoginTemplate(userEmail, url, \"in\");\n }\n}", "function SignUpButton () {\n return (\n <div id=\"my-signin2\"></div>\n );\n}", "function showLogin() {\n clearErrorMsg();\n showView('loginForm');\n showLinks(['registerLink']);\n}", "render() {\n const isLoggedIn = this.state.isLoggedIn;\n let button;\n\n if (isLoggedIn) {\n button = <LogoutButton onClick={this.handleLogoutClick} />;\n } else {\n button = <LoginButton onClick={this.handleLoginClick} />;\n }\n // Depending on the state the button is in return a greeting or a login screen\n return (\n <div>\n <Greeting isLoggedIn={isLoggedIn} />\n {button}\n </div>\n );\n }", "function displayLinkToSignIn() {\n // creating the child (of hidden)\n let div = document.createElement('div');\n // give it a class\n div.className = 'LoginPlease';\n div.textContent = 'Click the button to login';\n div.innerHTML = '<button class=\"redirect\" type=\"button\" onclick=\"redirectLogin()\" height=\"100\">click to Sign In</button>';\n // putting in the child\n var parentNode = document.body;\n parentNode.appendChild(div);\n}", "render() {\n if (this.props.email !== undefined && this.props.email !== null) {\n return this._renderLoggedIn();\n } else if (this.props.isLoggingIn === true) {\n return this._renderLoggingIn();\n } else {\n return this._renderLoggedOut();\n }\n }", "renderTemplate() {\n this.render({\n outlet: 'login'\n });\n }", "render() {\n let output = this.state.loggedIn ? <App /> : <Login />;\n return output;\n }", "function renderLogInToSaveEducationModal() {\n var template, html;\n \n template = \"<div class='modal-header'>\" +\n \"<button type='button' class='close' data-dismiss='modal'>&times;</button>\" +\n \"<h4 class='modal-title'><strong>Please log in to use this feature:</strong></h4>\" +\n \"</div>\" +\n \"<div class='modal-body'>\" +\n \"<form>\" +\n \"<div class='form-group'>\" +\n \"<label for='email'>Email address:</label>\" +\n \"<input type='email' class='form-control' id='logInEmail'>\" +\n \"</div>\" +\n \"<div class='form-group'>\" +\n \"<label for='pwd'>Password:</label>\" +\n \"<input type='password' class='form-control' id='logInPwd'>\" +\n \"<a href='#' onclick='renderForgotPwdModal()'>Forgot password?</a>\" +\n \"</div>\" +\n \"<span style='display:inline'>\" +\n \"<button type='button' class='btn btn-default' data-dismiss='modal' onclick='logIn()' id=''>Log In</button>\" +\n \" \" +\n \"<button type='button' class='btn btn-default' data-dismiss='modal'>Cancel</button>\" +\n \"</span>\" +\n \"</form>\" +\n \"</div>\";\n\n html = Mustache.render(template);\n\n $(\"#modalContent\").html(html);\n}", "render(){\n // todo add the components\n return( <LoginForm/>);\n \n // Todo add the Form \n }", "render() {\n\n const {classes} = this.props;\n\n return (\n <div className={classes.root}>\n <Paper className={classes.paperContainer} elevation={2}>\n <Typography variant=\"display1\" className={classes.loginTitle} color=\"textPrimary\">Maps Saver</Typography>\n <Typography variant=\"subheading\" className={classes.loginSubtitle} color=\"textPrimary\">By Guillaume\n Rachet</Typography>\n\n <Button onClick={() => this.props.signIn(\"facebook\")} variant=\"contained\"\n className={classes.buttonLoginFacebook}\n color=\"primary\">\n <FacebookIcon className={classes.icon}/> Facebook\n </Button>\n\n <Button onClick={() => this.props.signIn(\"google\")} variant=\"contained\" className={classes.buttonLoginGoogle}\n color=\"primary\">\n <GoogleIcon className={classes.icon}/> Google\n </Button>\n\n <Button onClick={() => this.props.signIn(\"github\")} variant=\"contained\" className={classes.buttonLoginGitHub}\n color=\"primary\">\n <GitHubIcon className={classes.icon}/> GitHub\n </Button>\n\n <Button onClick={() => this.props.signIn(\"anonymous\")} variant=\"contained\"\n className={classes.buttonLoginAnonymous}\n color=\"secondary\">\n <AccountCircle className={classes.icon}/> Anonymous\n </Button>\n\n </Paper>\n </div>\n );\n }", "render() {\n return (\n <AzureLoginView\n \tazureInstance={this.azureInstance}\n \tloadingMessage=\"Requesting access token\"\n \tonSuccess={this._onLoginSuccess}\n />\n );\n }", "function logoutButton() {\n return `\n <div class=logout>\n\n <form action=\"/logout\" method=\"POST\">\n <input type=\"submit\" value=\"Logout\">\n </form>\n </div>\n `;\n}", "render(){\n\t\tvar CLIENT_ID = \"e3fc4b772f51672f9b31\"\n\t\tvar REDIRECT_URI = \"http://localhost:3000/\"\n var STATE = \"fbdfuvue839984jd\"\n\treturn <div>\n<a\n href={`https://github.com/login/oauth/authorize?client_id=${CLIENT_ID}&scope=user&redirect_uri=${REDIRECT_URI}`}\n ><center>\n Login</center>\n </a>\n\t </div>\n\t}", "displaySignIn() {\n return (\n <div>\n <p>Please Sign In</p>\n <div className={styles.wrapper}>\n <IconButton\n type=\"button\"\n icon=\"glyphicon glyphicon-plus\"\n buttonClass={styles.button}\n onClick={this.signIn}\n />\n </div>\n </div>\n );\n }", "render() {\n return (\n <div>\n <div> \n <div className=\"container\"> \n <div> <h3>Sign In</h3></div>\n <Form>\n <Form.Group controlId=\"formBasicEmail\">\n <Form.Label>Email address</Form.Label>\n <Form.Control type=\"email\" placeholder=\"Enter email\" onChange={this.handleEmailChange} />\n <Form.Text className=\"text-muted\">\n ***We'll never share your info with anyone else.\n </Form.Text>\n </Form.Group>\n\n <Form.Group controlId=\"formBasicPassword\">\n <Form.Label>Password</Form.Label>\n <Form.Control type=\"password\" placeholder=\"Password\" onKeyPress={this.enterPressed.bind(this)} onChange={this.handlePasswordChange} />\n </Form.Group>\n <Form.Group controlId=\"formBasicCheckbox\">\n <Form.Check className=\"text-center\" type=\"checkbox\" label=\"Remember me\" onChange={this.handleRemember} />\n </Form.Group>\n <Button className=\"center\" variant=\"primary\" onClick={this.handleLogin}>\n Submit\n </Button>{' '}\n <Link to=\"/signup\" className=\"btn btn-primary\">\n Don't have an Account? Wanna create an account?\n </Link>{' '}\n </Form>\n </div>\n </div>\n </div>\n )\n }", "login(request, response) {\n const viewData = {\n title: \"Login to the Service\",\n };\n response.render(\"login\", viewData);\n }", "function loginDiv(){\n var emailAddress = gui.textInput(\"Email Address:\",\"emailAddressLogin\");\n var password = gui.textInput(\"Password:\",\"passwordLogin\",true);\n var submit = gui.buttonInput(\"Log in\",\"loginSubmit\");\n var resetPassword = gui.buttonInput(\"Reset password\",\"resetPassword\");\n var cancel = gui.buttonInput(\"Cancel\",\"cancelSubmit\");\n var formItems = [\n emailAddress ,\n password ,\n submit ,\n resetPassword ,\n cancel\n ];\n var corner = true;\n return gui.createForm(\"loginDiv\",formItems,corner);\n}", "render() {\n return (\n <div className=\"login-page-container\">\n Login to WHITE PANDA\n <BtnSolid \n onClick = {this.onGoogleLoginClicked}\n title = {\"Login with GOOGLE\"}\n customStyle = {\n {\n height : 'auto',\n width : '200px',\n marginTop: '20px'\n }\n }\n />\n </div>\n );\n }", "render() {\n const { updateUsername, updatePassword} = this.props;\n return (\n <div className=\"sign_in_container\">\n <img src={logo} alt=\"logo\" />\n <div className=\"user_input\">\n <label for=\"uname\">Username</label>\n <input type=\"text\" id=\"uname\" className=\"username\" onChange={e => updateUsername(e.target.value)}/>\n <label for=\"pword\">Password</label>\n <input type=\"text\" id=\"pword\" className=\"password\" onChange={e => updatePassword(e.target.value)}/>\n\n <div className=\"sign_in_buttons\" />\n <button className=\"login_button\" onClick={this.handleLogin()}>Login</button>\n <button className=\"register_button\" onClick={this.handleRegister()}>Register</button>\n </div>\n </div>\n );\n }", "login(request, response) {\n\t\tresponse.render('auth/login');\n\t}", "render() {\n const { classes } = this.props;\n return (\n <div>\n <Header\n title=\"Image Viewer\"\n parent=\"login\"\n history={this.props.history}\n />\n <div className=\"card-container\">\n <Card variant=\"outlined\" className=\"login-card\">\n <CardContent>\n <Typography variant=\"headline\" component=\"h2\">\n LOGIN\n </Typography>\n <br />\n <FormControl className={classes.formControl} required>\n <InputLabel htmlFor=\"username\">Username</InputLabel>\n <Input\n id=\"username\"\n type=\"text\"\n username={this.state.username}\n onChange={this.inputUsernameChangeHandler}\n />\n <FormHelperText className={this.state.usernameRequired}>\n <span className=\"red\">required</span>\n </FormHelperText>\n </FormControl>\n <br />\n <br />\n <FormControl className={classes.formControl} required>\n <InputLabel htmlFor=\"password\">Password</InputLabel>\n <Input\n id=\"password\"\n type=\"password\"\n loginPassword={this.state.loginPassword}\n onChange={this.inputPasswordChangeHandler}\n />\n <FormHelperText className={this.state.loginPasswordRequired}>\n <span className=\"red\">required</span>\n </FormHelperText>\n <FormHelperText\n className={this.state.usernamePasswordIncorrect}\n >\n <span className=\"red\">\n Incorrect username and/or password\n </span>\n </FormHelperText>\n </FormControl>\n <br />\n <br />\n <FormControl className={classes.buttonControl} required>\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={this.loginClickHandler}\n >\n LOGIN\n </Button>\n </FormControl>\n </CardContent>\n </Card>\n </div>\n </div>\n );\n }", "render() {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{this.state.is_logged_in && <div>Hello User</div>}\n\t\t\t\t{this.state.is_logged_in || <div>Guest</div>}\n\t\t\t</div>\n\t\t);\n\t}", "render() {\n return (\n <div className=\"Authentication\">\n\n <div className=\"App-header\">\n <div className=\"App-title\">SKIP the DISHES</div>\n </div>\n\n <div className=\"loginPage\" id=\"loginPage\">\n <h1 className=\"title-lg text-light\">Login</h1>\n\n <form onSubmit={this.handleLogin}>\n <input type=\"text\" onChange={this.handleEmailChange} placeholder=\"Email address\" />\n <br/>\n <input type=\"password\" onChange={this.handlePasswordChange} placeholder=\"Password\" />\n <br/>\n <input type=\"submit\" value=\"Login\" />\n <div id=\"msg\" />\n </form>\n </div>\n </div>\n );\n }", "render(){\n \n // If we are logged in redirect straight to the user's dashboard\n if (this.props.loggedIn) {\n return <Redirect to=\"/dashboard\" />;\n }\n\n return (\n <div className=\"home\">\n <h2>Welcome to Noted</h2>\n <p>Learn a plethora of music notation symbols and how understanding them can improve your skills as a musician! Try it out!</p>\n <button className='demo' onClick={() => this.props.dispatch(login('demouser', 'password123'))}>Demo</button>\n <p className='divider'>... or make an account!</p>\n <RegistrationPage />\n </div>\n );\n }", "render() {\n super.render();\n\n this.eventBusCollector.on(SIGNIN.fail, SignInView._fail);\n\n const usernameInput = document.forms.signIn.username;\n const passwordInput = document.forms.signIn.password;\n\n const func = (e) => {\n e.preventDefault();\n this.eventBus.emit(SIGNIN.submit, {\n login: usernameInput.value,\n password: passwordInput.value,\n });\n };\n\n document.forms.SignIn.addEventListener('submit', func, false);\n this.eventCollector.addEvent(document.forms.SignIn, 'submit', func, false);\n }", "render() {\n return(\n // hmmm does this break the code?\n <div className=\"signin-modal-brackground\">\n <div className=\"loginmodal\">\n <div className=\"logoContainer\"></div>\n <header>Log In</header>\n <img/>\n <div className=\"inputContainer\">\n <input\n type=\"text\"\n placeholder=\"Username\"\n required=\"required\"\n id=\"username\"\n onChange={(event) => this.handleInput(event)}\n /> <br />\n <input\n type=\"text\"\n placeholder=\"Password\"\n required=\"required\"\n id=\"pass\"\n onChange={(event) => this.handleInput(event)}\n />\n </div>\n <Link to={'/'}><button className=\"signinbtn\">Log In</button></Link>\n <Link><button className='signinbtn' onClick={this.props.toggleSignin}>Cancel</button></Link>\n <Link to={'/'}><p className=\"signinbtn\">Sign Up</p></Link>\n {/*end of loginmodal*/}\n </div>\n {/*end of modal-background*/}\n </div>\n )\n }", "render() {\n // If already logged in\n if (this.state.tokenState || this.props.error === false) {\n return utils.getRedirectComponent(\"/users/dashboard\");\n }\n // If not logged in already\n let renderError = null;\n if (this.props.error) {\n renderError = (\n <div style={{ color: \"red\" }}>{this.props.errorMessage}</div>\n );\n }\n\n return (\n <div>\n <div className=\"row\" style={{ height: \"100vh\", padding: \"10%\" }}>\n <div className=\"col-5\" style={{ paddingLeft: \"10%\" }}>\n <div className=\"row\" style={{ height: \"10%\" }}></div>\n <div className=\"row\" style={{ height: \"90%\" }}>\n <div className=\"col-12\">\n <h4 style={{ margin: \"10px\", color: \"#20BF9F\" }}>Login page</h4>\n <form id=\"Login\" method=\"post\" onSubmit={this.handleSubmit}>\n <div className=\"form-group\">\n <input\n type=\"text\"\n className=\"form-control\"\n name=\"email\"\n required\n autoFocus\n placeholder=\"Enter Email\"\n onChange={this.handleEmailChange}\n />\n </div>\n <div className=\"form-group\">\n <input\n type=\"password\"\n className=\"form-control\"\n name=\"password\"\n required\n placeholder=\"Enter Password\"\n onChange={this.handlePasswordChange}\n />\n </div>\n <button\n type=\"submit\"\n className=\"btn btn-success\"\n onSubmit={this.handleSubmit}\n style={{ backgroundColor: \"#20BF9F\" }}\n >\n Login\n </button>\n </form>\n {renderError}\n <br></br>\n Don't have an account?{\" \"}\n {\n <Link style={{ color: \"#20BF9F\" }} to=\"/signup\">\n Sign Up\n </Link>\n }\n </div>\n </div>\n </div>\n <div className=\"col-7\">\n {/* <div className=\"row\" style={ { height: \"10%\" } }>\n </div> */}\n <div className=\"row\">\n <div className=\"row\" style={{ padding: \"5%\" }}>\n {/* <img\n src={}\n style={{ paddingLeft: \"40%\" }}\n width=\"100%\"\n height=\"100%\"\n alt=\"\"\n /> */}\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n }", "function signUpTemplate() {\n return `<form class=\"signUpForm\" autocomplete=\"on\">\n <div class=\"loginError\"></div>\n <legend class=\"loginRegisterTitle\">Welcome, aboard!</legend>\n <label for=\"username\">USERNAME:</label>\n <input class=\"usernameSignUp\" type=\"text\" name=\"username\" pattern=\".{1,}\" required title=\"1 characters minimum\" required>\n <br>\n <label for=\"password\">PASSWORD:</label>\n <input class=\"passwordSignUp\" type=\"password\" name=\"password\" pattern=\".{10, 72}\" required title=\"10 characters minimum\" required>\n <br>\n <label for=\"firstName\">FIRST NAME:</label>\n <input class=\"firstnameSignUp\" type=\"text\" name=\"firstName\" required>\n <br>\n <label for=\"lastName\">LAST NAME:</label>\n <input class=\"lastnameSignUp\" type=\"text\" name=\"lastName\" required>\n <br>\n <label for=\"email\">EMAIL:</label>\n <input class=\"emailSignUp\" type=\"email\" name=\"email\" required>\n <br>\n <button class=\"loginButton signingUpNewAccount\" type=\"submit\">Submit</button>\n </form>\n <a href=\"#\" id=\"login\"><p class=\"toggleReg\">Login!</p></a>`;\n}", "render() {\n return (\n <div id=\"login-page\" className={\"page login-page\"}>\n <div id=\"login-box\">\n <div id=\"login-content\">\n <form id=\"login-form\" onSubmit={this.handleSubmit}>\n <h1 id=\"login-welcome-header\">WELCOME</h1>\n <div className=\"form-group\">\n <FontAwesomeIcon icon={faUser}/>\n <input type=\"text\" name=\"username\" className=\"login-input\" value={this.state.user} onChange={this.handleUserChange}/>\n </div>\n <div className=\"form-group\">\n <FontAwesomeIcon icon={faKey}/>\n <input type=\"password\" name=\"password\" className=\"login-input\" value={this.state.password} onChange={this.handlePasswordChange}/>\n </div>\n <div className=\"btn\">\n <button className=\"btn btn-outline-primary\" type=\"submit\" name=\"Login\">\n LOG IN\n </button>\n </div>\n </form>\n </div>\n </div>\n </div>\n )\n }", "function displayLogIn(){\n\t\t\t//change button oplogin's appearance to Log In\n\t\t\tvar openlogin = document.getElementById(\"openlogin\");\n\t\t\topenlogin.innerHTML = \"Log In\";\n\t\t}", "render() {\n return (\n <div style={this.props.style}>\n <Growl ref={(el) => this.growl = el}/>\n <InputText placeholder=\"Username\"\n onChange={(e) => this.props.changeLoginFieldHandler(\"username\", e.target.value)}\n type=\"text\"/>\n <InputText placeholder=\"Password\"\n onChange={(e) => this.props.changeLoginFieldHandler(\"password\", e.target.value)}\n type=\"password\"/>\n <Button variant=\"primary\" type=\"submit\" label=\"Submit\" onClick={\n () => this.props.loginHandler(this.props.username, this.props.password,\n (msg) => {\n this.growl.show({severity: 'error', summary: 'Login Failed', life: 5000, detail: msg});\n })\n }/>\n <br/>\n <div style={{transform: 'scale(0.75)', position: 'absolute', left: '40%'}}>\n <FacebookLogin appId=\"618552358637643\" fields=\"email\"\n callback={(response) => {\n return this.props.fbLoginHandler(response.email,\n (msg) => {\n this.growl.show({\n severity: 'error',\n summary: 'Login Failed',\n life: 5000,\n detail: msg\n });\n });\n }\n } icon=\"fa-facebook\"/>\n </div>\n </div>\n );\n }", "function returningUserScreen(){\n const view = document.createElement('div');\n view.setAttribute('class','signInView');\n\n let inputs = {};\n ['email address','password'].forEach(function (text){\n const label = appendLabel(view,text,'sign in');\n inputs[text] = label;\n label.onkeypress = function (e){\n if (e.key === 'Enter'){\n submit.click();\n }\n }\n })\n\n const forgot = document.createElement('div');\n forgot.setAttribute('class','forgotten');\n forgot.textContent = 'forgotten password?';\n view.appendChild(forgot);\n\n const submit = document.createElement('div');\n submit.setAttribute('class','signInSubmit');\n submit.textContent = 'Sign In';\n view.appendChild(submit);\n\n submit.onclick = function (){\n attemptSignIn(inputs['email address'].value,inputs['password'].value);\n }\n\n return view;\n}", "render() {\r\n\t\treturn (\r\n\t\t\t<div className=\"Home\">\r\n\t\t\t{this.props.isAuthenticated ? this.renderUser() : this.renderLander()}\r\n\t\t\t</div>\r\n\t\t);\r\n\t}", "render_login_page() {\n if (this.state.loggedIn === true) {\n console.log(\"Logged In\");\n return (\n <div className=\"registration\" >\n <h1> {this.state.loginStatus + \", welcome! \"}</h1>\n <h1>{\"Let's Eat-Sleep-Travel-Repeat! \"}</h1>\n <View style={{\n alignItems: 'center',\n justifyContent: 'center', \n // backgroundColor: 'white',\n \n text: 'white',\n width: '66%', \n }}>\n <Text style={{ color: 'black', fontSize: 20, lineHeight: 30,textAlign: 'justify', }}>{\"People have been trapped at home due to COVID-19 for a long time and the trend to travel after the quarantine/covid-19 ends will be quite popular. Based on the passion and demand to travel and enjoy delicious food, our team has decided to implement this web application that helps you find restaurants/places based on your favorites, geolocation, personal habit and word-of-mouth rating. The project is to design a web application based on two dataset: Yelp restaurant dataset and Airlines within the United states. We intend to deliver a convenient way for users to choose and plan where to go and what to eat. \"}</Text>\n </View>\n <button\n id=\"registerBtn\"\n className=\"button2\"\n onClick={this.handleLogout}\n >\n Logout\n </button>\n </div>\n );\n } else {\n // console.log(\"Not logged in, trying to render\");\n return (\n <div>\n {\" \"}\n <div className=\"registration\">\n <h2>Register</h2>\n <label className=\"label\">First Name </label>\n <input\n className=\"defaultTextBox\"\n type=\"text\"\n onChange={(e) => {\n this.setState({ firstnameReg: e.target.value });\n }}\n ></input>\n <label className=\"label\">Last Name</label>\n <input\n className=\"defaultTextBox\"\n type=\"text\"\n onChange={(e) => {\n this.setState({ lastnameReg: e.target.value });\n }}\n ></input>\n <label className=\"label\">User Name</label>\n <input\n className=\"defaultTextBox\"\n type=\"text\"\n onChange={(e) => {\n this.setState({ usernameReg: e.target.value });\n }}\n ></input>\n <label className=\"label\">Password</label>\n <input\n className=\"defaultTextBox\"\n type=\"password\"\n onChange={(e) => {\n this.setState({ passwordReg: e.target.value });\n }}\n ></input>\n <button\n id=\"registerBtn\"\n className=\"button2\"\n onClick={this.submitRegistration}\n >\n Register\n </button>\n </div>\n <br />\n <br />\n <div className=\"login\" style={{height: '100%'}}>\n <h3>\n {\" \"}\n Already have an account? <br />\n Login\n </h3>\n <input\n className=\"defaultTextBox\"\n type=\"text\"\n placeholder=\"User Name\"\n onChange={(e) => {\n this.setState({ usernameLog: e.target.value });\n }}\n ></input>\n <input\n className=\"defaultTextBox\"\n type=\"password\"\n placeholder=\"Password\"\n onChange={(e) => {\n this.setState({ passwordLog: e.target.value });\n }}\n ></input>\n <button\n className=\"button2\"\n id=\"registerBtn\"\n onClick={this.submitLogin}\n >\n Login\n </button>\n </div>{\" \"}\n <p>{this.state.loginStatus}</p>\n </div>\n );\n }\n }", "render() {\n return (\n <Link\n to=\"/login\"\n // type=\"button\"\n className=\"btn btn-ds-outline-primary btn-lg log-in-btn\"\n >\n Log In\n </Link>\n );\n }", "onlogHTML() {}", "render() {\n\t\treturn this.renderRegisterPage();\n\t}", "render(){\n\t\t\t\treturn <button className=\"ui button primary\">Submit</button>\n\t\t\t}", "render() {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<form onSubmit={this.handleSubmit}>\t\t\t \n\t\t\t\t <label>\n\t\t\t\t Email:\n\t\t\t\t <input id=\"username\" type=\"text\" name=\"email\" onKeyUp={this.handleChange} />\n\t\t\t\t </label>\n\t\t\t\t <label>\n\t\t\t\t Password:\n\t\t\t\t <input id=\"password\" type=\"password\" name=\"password\" onKeyUp={this.handleChange} />\n\t\t\t\t </label>\n\t\t\t\t <input type=\"submit\" value=\"Submit\" />\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t\t);\n\t\t}", "function loginOrRegister(){\n return `\n <div> \n <a href=\"/login\">Login</a>\n |\n <a href=\"/register\">Register</a> \n </div>\n `;\n}", "function handleSignInButtonClick() {\n if (!loggedIn) {\n setHasError(true);\n setErrorMessage('Please log in to continue');\n setShowLogin(!showLogin);\n } else {\n setLoggedIn(true);\n }\n }", "render() {\n const isLoggedIn = this.state.isLoggedIn;\n let button;\n \n if (isLoggedIn) {\n button = <LogoutButton onClick={this.handleLogoutClick} />;\n } else {\n button = <LoginButton onClick={this.handleLoginClick} />;\n }//En esta seccion se crea la variable button la cual mostrar un diferente boton segun el estado.\n \n return (\n <div>\n <Greeting isLoggedIn={isLoggedIn} />\n {button}\n </div>//En esta seccion se une todo el boton y el mensaje.\n );\n }", "loginHandler(event){\n\t\tthis.setState({display:\"login\"});\n\t}", "render() {\n if ( this.state.login === false && this.state.error === false ){\n return (\n\n <div className=\"login\">\n <form className=\"login__form\">\n <h1>Login</h1>\n <Input type=\"email\"\n class=\"input\"\n placeholder=\"Enter Email\"\n value={this.state.email}\n onChange={this._handleEmailInput}\n />\n\n <Input type=\"password\"\n class=\"input\"\n placeholder=\"Password\"\n value={this.state.password}\n onChange={this._handlePasswordInput}\n />\n <Button type=\"button\" text=\"Login\" onClick={this._handleLoginSubmit} />\n <Link to=\"/signup\" className=\"small\">No Account? SignUp</Link>\n </form>\n </div>\n // <Link to=\"/signup\">Sign Up</Link>\n // <Link to=\"/dashboard\">Log In</Link>\n\n );\n } else if (this.state.login === false && this.state.error === true ) {\n return (\n <div className=\"login\">\n <form className=\"login__form\">\n <h1>Login</h1>\n <p> Something went wrong, try again </p>\n <Input type=\"email\"\n class=\"input\"\n placeholder=\"Enter Email\"\n value={this.state.email}\n onChange={this._handleEmailInput}\n />\n\n <Input type=\"password\"\n class=\"input\"\n placeholder=\"Password\"\n value={this.state.password}\n onChange={this._handlePasswordInput}\n />\n <Button type=\"button\" text=\"Login\" onClick={this._handleLoginSubmit} />\n <Link to=\"/signup\" className=\"small\">No Account? SignUp</Link>\n </form>\n </div>\n )\n }\n \n \n else {\n return ( <Redirect to=\"/dashboard\" /> )\n }\n \n}", "function LoginForm(props) {\n return (\n <form className=\"signup\">\n <Input\n id=\"username\"\n labeltext=\"Username:\"\n name=\"username\"\n placeholder=\"Username\"\n type=\"text\"\n />\n <Input\n id=\"password\"\n labeltext=\"Password:\"\n name=\"password\"\n placeholder=\"Password\"\n type=\"password\"\n />\n <Button\n className=\"btn btn-info btn-lg btn-block\"\n id=\"login\"\n type=\"submit\"\n //onClick=\"\"\n title=\"Login\"\n />\n\n <label>Don't have an Account? </label>\n <a className=\"btn btn-dark btn-lg btn-block\" href=\"/signup\">\n Signup\n </a>\n <div class=\"g-signin2\" data-onsuccess=\"onSignIn\" />\n </form>\n );\n\n}", "LoginButton(props){\n return (\n <button onClick={props.onClick}>\n Login\n </button>\n )\n }", "function handleLoginBtnClick() {\n console.log(\"login clicked\", email, password);\n\n }", "render() {\n\t\treturn (\n\t\t\t<form onSubmit={this.onSubmit} id='loginForm'>\n\t\t\t\t<select value={this.state.userID} onChange={this.onUpdate}>\n\t\t\t\t\t<option value=''>Login as:</option>\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.props.users.map(user => (\n\t\t\t\t\t\t\t<option key={user.id} value={user.id}>{ user.name }</option>\n\t\t\t\t\t\t))\n\t\t\t\t\t}\n\t\t\t\t</select>\n\t\t\t\t<button>Login</button>\n\t\t\t</form>\n\t\t)\n\t}", "render() {\n\n return this.Auth && this.Auth.isAuthenticated() ? (\n <Fragment>\n <h3>isAuthenticated: {JSON.stringify(this.Auth.isAuthenticated())}</h3>\n <button className=\"btn btn-info\" onClick={() => {this.Auth.logout()}}>logout</button>\n </Fragment>\n ) : (\n <Fragment>\n <h3>not authenticated</h3>\n <button color=\"link\" onClick={() => {this.Auth.login()}}>login</button>\n </Fragment>\n )\n }", "function customizeLoginButton(viewId) {\n // Hide Knack default SSO button, login form, login title, and any other children\n $(\"#\" + viewId)\n .children()\n .hide();\n\n var url = Knack.url_base + Knack.scene_hash + \"auth/COACD\";\n\n // Create a div for Login buttons\n var $coacdButton = $(\"<div/>\", {\n id: \"coacd-button-login\"\n });\n $coacdButton.appendTo(\"#\" + viewId);\n\n // Append Big SSO Login button and non-SSO Login button\n bigButton(\"coacd-big-button\", \"coacd-button-login\", url, \"sign-in\", \"Sign-In\")\n\n $coacdButton.append(\n \"<a class='small-button' href='javascript:void(0)'>\" +\n \"<div class='small-button-container'><span><i class='fa fa-lock'></i></span><span> Non-COA Sign-In</span></div></a>\"\n );\n\n // On non-SSO button click, hide SSO and non-SSO buttons and show Knack Login form\n var $nonCoacdButton = $(\".small-button\");\n $nonCoacdButton.click(function () {\n $(\"#\" + viewId)\n .children()\n .show();\n $(\".small-button-container,.big-button-container\").hide();\n $(\".kn-sso-container\").hide();\n });\n}", "renderMenu(){\r\n return TokenService.hasAuthToken() ? this.renderLogoutLink() : this.renderLoginLink();\r\n }", "function displayLoginPage() {\n // create variable that holds the render login page function\n const loginPage = renderLoginPage();\n // select main page id and display html from render login page function\n $(\"#main-page\").html(loginPage);\n $(\"#email\").blur();\n // select landing page class and prop method with hidden class = true\n $(\".landing-page\").prop(\"hidden\", true);\n}", "render() {\n return (\n <a href=\"http://localhost:5000/login-recommendations\">\n get show recommendations!\n </a>\n )\n }", "function loginForm(req, res) {\n res.render('log-in.ejs');\n}", "render(){\n return(\n <div>\n <nav className=\"navbar navbar-default\">\n <div className=\"container-fluid\">\n <div className=\"navbar-header\">\n <button type=\"button\" className=\"navbar-toggle\" \n data-toggle=\"collapse\" data-target=\"#myNavbar\">\n <span className=\"icon-bar\"></span>\n <span className=\"icon-bar\"></span>\n <span className=\"icon-bar\"></span> \n </button>\n <Link to='#' className=\"navbar-brand\"> PostIt</Link>\n </div>\n <div className=\"collapse navbar-collapse\" id=\"myNavbar\">\n <ul className=\"nav navbar-nav navbar-right\">\n <li><Link to=\"#\"><span className=\"glyphicon glyphicon-log-out\">\n </span> Login</Link></li>\n <li><Link to=\"/\"><span className=\"glyphicon glyphicon-user\">\n </span> Sign Up</Link></li>\n </ul>\n </div>\n </div>\n </nav>\n <LoginForm SubmitFormInput={this.formInputAction}/>\n { //Redirect user to home page after creating a user\n (this.props.loginResponce.length === 1) ? \n <LoginResponce responce={this.props.loginResponce}/> : <div></div>\n }\n </div>\n );//end of return statement\n }", "function customizeLoginButton(viewId) {\n // Hide Knack default SSO button, login form, login title, and any other children\n $(\"#\" + viewId)\n .children()\n .hide();\n\n var url = Knack.url_base + Knack.scene_hash + \"auth/COACD\";\n\n // Create a div for Login buttons\n var $coacdButton = $(\"<div/>\", {\n id: \"coacd-button-login\",\n });\n $coacdButton.appendTo(\"#\" + viewId);\n\n // Append Big SSO Login button and non-SSO Login button\n bigButton(\n \"coacd-big-button\",\n \"coacd-button-login\",\n url,\n \"sign-in\",\n \"Sign-In\"\n );\n\n $coacdButton.append(\n \"<a class='small-button' href='javascript:void(0)'>\" +\n \"<div class='small-button-container'><span><i class='fa fa-lock'></i></span><span> Non-COA Sign-In</span></div></a>\"\n );\n\n // On non-SSO button click, hide SSO and non-SSO buttons and show Knack Login form\n var $nonCoacdButton = $(\".small-button\");\n $nonCoacdButton.click(function () {\n $(\"#\" + viewId)\n .children()\n .show();\n $(\".small-button-container,.big-button-container\").hide();\n $(\".kn-sso-container\").hide();\n });\n}", "render() {\n if(this.state.isLoggedIn){\n return <HomePage/>\n }\n else{\n return <Login/>\n }\n }", "renderLoginLink() {\n return (\n <div className='Header__not-logged-in'>\n <Link\n to='/login'\n >\n Log in\n </Link>\n <Link\n to='/register'\n >\n Register\n </Link>\n </div>\n )\n }", "function getLoginUI() {\n fetch('/api/login', {\n method: 'GET'\n }).then(response => response.text())\n .then(res => {\n var mainBody = document.getElementById('main-body');\n mainBody.innerHTML = res;\n selectIcon('home');\n });\n}" ]
[ "0.74470836", "0.73690957", "0.7272287", "0.7208264", "0.7111917", "0.7108958", "0.702944", "0.6915029", "0.68317485", "0.68195903", "0.6755955", "0.67426497", "0.6715965", "0.6646396", "0.66433394", "0.6615156", "0.66107005", "0.6599584", "0.6572065", "0.6556544", "0.6553825", "0.6541158", "0.6536656", "0.6534609", "0.650683", "0.64704335", "0.6465294", "0.6434188", "0.6429945", "0.63923347", "0.6389826", "0.63590795", "0.6359", "0.63507205", "0.6344437", "0.6327207", "0.63244015", "0.627244", "0.626755", "0.62652045", "0.62505686", "0.6237062", "0.62278664", "0.6219396", "0.6202808", "0.6200616", "0.61984724", "0.61908245", "0.6188241", "0.61834556", "0.6158545", "0.6139505", "0.61357164", "0.61302954", "0.61300653", "0.61263853", "0.61257225", "0.61253273", "0.6114789", "0.6098229", "0.608872", "0.6086003", "0.6082588", "0.6063661", "0.6062338", "0.6059585", "0.60477597", "0.604053", "0.6031297", "0.60308987", "0.59981483", "0.5995124", "0.5989212", "0.5982975", "0.5971526", "0.59702414", "0.5959388", "0.5957197", "0.5947611", "0.5936186", "0.5933237", "0.5916841", "0.59078926", "0.5898472", "0.5896252", "0.5894747", "0.58942527", "0.58867544", "0.5879088", "0.5872243", "0.5871558", "0.58627266", "0.5859825", "0.5855366", "0.5848651", "0.58374614", "0.5836837", "0.5832166", "0.58262587", "0.5825049" ]
0.65700465
19
render() returns the HTML template for SignUpButton
render () { return ( <a href="#" className="btn btn-default btn-lg" onClick={this.handler} id="btnSignup">Sign Up</a> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function signUpTemplate() {\n return `<form class=\"signUpForm\" autocomplete=\"on\">\n <div class=\"loginError\"></div>\n <legend class=\"loginRegisterTitle\">Welcome, aboard!</legend>\n <label for=\"username\">USERNAME:</label>\n <input class=\"usernameSignUp\" type=\"text\" name=\"username\" pattern=\".{1,}\" required title=\"1 characters minimum\" required>\n <br>\n <label for=\"password\">PASSWORD:</label>\n <input class=\"passwordSignUp\" type=\"password\" name=\"password\" pattern=\".{10, 72}\" required title=\"10 characters minimum\" required>\n <br>\n <label for=\"firstName\">FIRST NAME:</label>\n <input class=\"firstnameSignUp\" type=\"text\" name=\"firstName\" required>\n <br>\n <label for=\"lastName\">LAST NAME:</label>\n <input class=\"lastnameSignUp\" type=\"text\" name=\"lastName\" required>\n <br>\n <label for=\"email\">EMAIL:</label>\n <input class=\"emailSignUp\" type=\"email\" name=\"email\" required>\n <br>\n <button class=\"loginButton signingUpNewAccount\" type=\"submit\">Submit</button>\n </form>\n <a href=\"#\" id=\"login\"><p class=\"toggleReg\">Login!</p></a>`;\n}", "function renderSignupPage() {\n return `\n\t<section class=\"signup-page-screen\" aria-live=\"assertive\">\n\t\t\t<form role=\"form\" class=\"signup\">\n\t\t\t\t<fieldset name=\"signup-info\">\n\t\t\t\t\t<div class=\"login-header\">\n <legend>Sign Up</legend>\n <hr class=\"style-two\">\n\t\t\t\t </div>\n\t\t\t\t <p id='notification'></p>\n\t\t\t\t\t<label for=\"email\" required>Email</label>\n\t\t\t\t\t<input type=\"email\" name=\"email\" id=\"email\" placeholder=\"Email address\" required=\"\">\n\t\t\t\t\t<label for=\"password\" required>Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"password\" id=\"password\" placeholder=\"Password\" required>\n\t\t\t\t\t<label for=\"password-confirm\" required>Confirm password</label>\n\t\t\t\t\t<input type=\"password\" name=\"password\" id=\"password-confirm\" placeholder=\"Confirm password\" required >\n\t\t\t\t</fieldset>\n\t\t\t\t<button type=\"submit\" class=\"js-signup-button\">Sign up</button>\n <p>Already have an account? <a href=\"#\" class=\"nav-login\">Log in</p></a>\n\t\t\t</form>\n\t\t</section>\n\t`;\n}", "render() {\n\t\treturn (\n\t\t\t<SignUp\n\t\t\t\t{...this.props}\n\t\t\t\t{...this.state}\n\t\t\t\tonSubmit={this.handleSubmit}\n\t\t\t\tonBack={this.handleCancel}\n\t\t\t\tonChange={this.handleChange}\n\t\t\t\tonRangeChange={this.handleRangeChange}\n\t\t\t\tonUserSelection={this.handleUserSelection}\n\t\t\t\tonCreate={this.createInterest}\n\t\t\t\tonTodoSelection={this.handleJournoInterestSelection}\n\t\t\t\tonCreateCompany={this.createPrCompany}\n\t\t\t\tonCompanySelection={this.handleCompanySelection}\n\t\t\t\tonCreatePosition={this.createPosition}\n\t\t\t\tonPositionSelection={this.handlePositionSelection}\n\t\t\t\tonChangeSelect={this.onSelectOutlet}\n\t\t\t\tchangeInput={this.onInputChange}\n\t\t\t\tfilterCompany={this.filterCompany}\n\t\t\t\tfilterPosition={this.filterPosition}\n\t\t\t/>\n\t\t);\n\t}", "function SignUpButton () {\n return (\n <div id=\"my-signin2\"></div>\n );\n}", "render() {\n return (\n <div>\n <Signup />\n </div>\n );\n }", "signup(request, response) {\n const viewData = {\n title: \"Login to the Service\",\n };\n response.render(\"signup\", viewData);\n }", "function renderButton() {\n gapi.signin2.render('signin2', {\n 'scope': 'profile email',\n 'width': 250,\n 'height': 40,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onSuccess,\n 'onfailure': onFailure\n });\n\n gapi.signin2.render('registrar-gmail', {\n 'scope': 'profile email',\n 'width': 250,\n 'height': 40,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onSuccess,\n 'onfailure': onFailure\n });\n}", "function signupForm(req, res) {\n res.render('sign-up.ejs');\n}", "render() {\n\t\treturn this.renderRegisterPage();\n\t}", "function handleSignUp(e) {\n setVisible(false);\n setSignUp('true');\n }", "render() {\n\t\treturn (\n\t\t\t<div className=\"new-user-form\">\n\t\t\t\t<Form>\n\t\t\t\t\t<Form.Input\n\t\t\t\t\tonChange={this.handleChange}\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tplaceholder=\"User Name\"\n\t\t\t\t\trequired />\n\t\t\t\t\t<Button id=\"create-user-button\" type=\"submit\">*</Button>\n\t\t\t\t</Form>\n\t\t\t</div>\n\t\t\t)\n\t\t//Need to ensure that this button is actually used for game creation, not just ROOM creation\n\t}", "function getFormRegister(request,response) {\n response.render('pages/login/signUp')\n}", "render(){\n return(\n <div>\n {this.state.name}<br />\n {this.state.email}<br />\n {this.state.password}<br />\n {this.state.logEmail}<br />\n {this.state.logPassword}<br />\n <br />\n \n SignUp check\n \n </div>\n )\n }", "render() {\n const { value } = this.state;\n if (this.state.finished) {\n return <Redirect to=\"/userhome\"/>;\n }\n return (\n <Container className=\"signup-format\">\n <Grid textAlign=\"center\" verticalAlign=\"middle\" centered columns={2}>\n <Grid.Column>\n <Header as=\"h2\" textAlign=\"center\" inverted>\n <p className=\"consistent-font\">Register your account</p>\n </Header>\n <Form onSubmit={this.handleSubmit} color='black' inverted>\n <Segment stacked inverted>\n <Form.Input\n label=\"Email\"\n icon=\"user\"\n iconPosition=\"left\"\n name=\"email\"\n type=\"email\"\n placeholder=\"E-mail address\"\n onChange={this.handleChange}\n />\n <Form.Input\n label=\"Password\"\n icon=\"lock\"\n iconPosition=\"left\"\n name=\"password\"\n placeholder=\"Password\"\n type=\"password\"\n onChange={this.handleChange}\n />\n <Form.Field>\n <Dropdown placeholder='Are you a customer or a vendor?'\n name=\"role\"\n type=\"role\"\n fluid\n selection\n options={roleOption}\n value={value}\n onChange={this.handleChange}/>\n </Form.Field>\n <Form.Button content=\"Submit\"/>\n </Segment>\n </Form>\n <Message className=\"consistent-font\" color='black' inverted=\"true\">\n Already have an account? Login <Link to=\"/signin\">here</Link>\n </Message>\n {this.state.error === '' ? (\n ''\n ) : (\n <Message\n error\n header=\"Registration was not successful\"\n content={this.state.error}\n />\n )}\n </Grid.Column>\n </Grid>\n </Container>\n );\n }", "function goSignUp() {\n \n body.innerHTML = renderSignupDiv(first, \n last, email1, pass1, '', message1);\n assignListener('signup2');\n }", "function renderButton() {\n gapi.signin2.render('gSignIn', {\n 'scope': 'profile email https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly',\n 'width': 240,\n 'height': 50,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onLoginSuccess,\n 'onfailure': onLoginFailure\n });\n}", "createAccount(req,res){\n res.render('user/signup.ejs');\n }", "function renderButton() {\n gapi.signin2.render('my-signin2', {\n 'scope': 'profile',\n 'width': 240,\n 'height': 50,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onSuccess,\n 'onfailure': onFailure\n });\n}", "render() {\n return (\n <div>\n <h4>Signup</h4>\n <TextField name=\"name\" floatingLabelText=\"Name\" value={this.state.name} onChange={this.setProperty} errorText={this.usernameValid()}/>\n <TextField name=\"email\" floatingLabelText=\"Email\" value={this.state.email} onChange={this.setProperty}/>\n <TextField name=\"password\" floatingLabelText=\"Password\" type=\"password\" value={this.state.password} onChange={this.setProperty}/>\n <RaisedButton label=\"Sign Up\" onClick={this.signUp}/>\n <pre>{JSON.stringify(this.state.response, null, 2)}</pre>\n <ButtonLink to=\"/welcome\">Back</ButtonLink>\n </div>\n )\n }", "function handleSignUpBtnClick() {\n console.log(\"signup clicked\");\n }", "function studentSignup(req, res){\n res.render(\"signup\", {});\n}", "function Signup() {\n return (\n <Container>\n <div id=\"signupContainer\">\n <div className=\"outside cell medium-3 medium-cell-block center\">\n </div>\n <div id=\"signup-center\" className=\"cell medium-6 medium-cell-block center\">\n <form>\n <div className=\"sign-up-form\">\n <h4 className=\"text-center\">Signup</h4>\n <label for=\"sign-up-form-username\">Username</label>\n <input type=\"text\" className=\"sign-up-form-username\" id=\"sign-up-form-username\" />\n <label for=\"sign-up-form-password\">Password</label>\n <input type=\"text\" className=\"sign-up-form-password\" id=\"sign-up-form-password\" />\n <button type=\"submit\" className=\"sign-up-form-button\">Create Account</button>\n </div>\n </form>\n </div>\n <div className=\"cell medium-3 medium-cell-block center\">\n </div>\n </div>\n </Container>\n )\n}", "function showSignup() {\n\n // if (Auth.loggedIn()) {\n // return (\n // <div>\n // <div className=\"AddPetSection\">\n // <UserInfo />\n // <PetList />\n // </div>\n // </div>\n // );\n // } else {\n // return (\n // <div>\n // <Signup />\n // </div>\n // );\n // }\n }", "render() {\n const { canSubmit, username, displayName, email, password, confirmPassword } = this.state;\n const { handlePrev, handleNext, goToSignIn } = this.props;\n\n return (\n <div className='form-container'>\n <Header title='INSCRIPTION' handlePrev={handlePrev} chevronLeft />\n <form action='/auth/signup' method='post'>\n <Input inputText=\"Nom d'utilisateur\"\n type='text'\n name='username'\n value={username.text}\n onChange={(e) => this.handleChange(e)}\n onBlur={this.checkNamesErrors}\n errForm={username.errForm}\n errMsg={username.errMsg} />\n <Input inputText=\"Nom d'affichage\"\n type='text'\n name='displayName'\n value={displayName.text}\n onChange={(e) => this.handleChange(e)}\n onBlur={this.checkNamesErrors}\n errForm={displayName.errForm}\n errMsg={displayName.errMsg} />\n <Input inputText='Email'\n type='email'\n name='email'\n value={email.text}\n onChange={(e) => this.handleChange(e)} />\n <Input inputText='Mot de passe'\n type='password'\n name='password'\n value={password.text}\n onChange={(e) => this.handleChange(e)}\n onBlur={this.checkPasswordsErrors}\n errForm={password.errForm}\n errMsg={password.errMsg} />\n <Input inputText='Confirmer le mot de passe'\n type='password'\n name='confirmPassword'\n value={confirmPassword.text}\n onChange={(e) => this.handleChange(e)}\n onBlur={this.checkPasswordsErrors}\n errForm={confirmPassword.errForm}\n errMsg={confirmPassword.errMsg} />\n <Button\n // disabled={!canSubmit}\n buttonText='Créer un compte'\n // onClick={handleNext}\n type='submit'\n chevronRight />\n </form>\n <p className='sign-link' onClick={goToSignIn}>Déjà enregistré? Se connecter</p>\n </div>\n )\n }", "function RegisterForm(){ \n return (\n <div>\n <h1>register form</h1>\n {/* <h3>{street} {city}, {state} {zip}</h3>\n <button >Register</button>\n <button>Close List</button> */}\n </div>\n );\n \n }", "render() {\n let tokens = \"\";\n this.permissions.forEach(p => tokens = tokens + Permission.render(p));\n if(tokens === \"\") tokens = \"<h3>No tokens found for this user</h3>\";\n\n let cert = \"\";\n this.certificate.forEach(c => cert = cert + this.renderCert(c));\n if(cert === \"\") cert = \"<h3>No certificates found for this user</h3>\";\n\n return \"<div class='user'><div class='userName'>\"+ this.name +\n '</div><button class=\"collapsible\"> Tokens: </button><div class=\"content\">' + tokens +\"</div> <button class='collapsible'> Certificates: </button><div class='content'>\" + cert +\"</div></div>\";\n }", "render(){\n //generate props to pass to UI\n const props = this._generateProps()\n\n return( <SignupForm { ...props } submitHandler = {this.submitHandler} handleChange = {this.handleChange}/>);\n }", "function _init_sign_up_button(){\n try{\n var sign_up_button = Titanium.UI.createButton({\n top:(self.screen_height/2)+100,\n title:'Sign-up',\n width:160,\n height:40,\n backgroundImage:self.get_file_path('image','BUTT_grn_off.png'),\n color:'#fff',\n font:{\n fontSize:self.font_size,\n fontWeight:self.font_weight\n }\n });\n win.add(sign_up_button); \n sign_up_button.addEventListener('click',function(){\n win.children[1].blur();\n _sign_up();\n });\n }catch(err){\n self.process_simple_error_message(err,window_source+' - _init_sign_up_button');\n return;\n } \n }", "render(){\n return(\n <div className=\"modal-dialog\">\n <div className=\"modal-content\">\n <div className=\"modal-header\">\n <h4 className=\"modal-title\">SIGN UP</h4>\n </div>\n <div className=\"modal-body\">\n <form onSubmit={this.submitForm}>\n <div className=\"input-group\">\n <span className=\"input-group-addon\"><i className=\"glyphicon glyphicon-eye-open\"></i></span>\n <input type=\"text\" id=\"username\" placeholder=\"USERNAME\" className=\"form-control\"\n onChange={this.handleChange}\n required \n />\n </div>\n <div className=\"input-group\">\n <span className=\"input-group-addon\"><i className=\"glyphicon glyphicon-user\"></i></span>\n <input type=\"text\" id=\"fullname\" placeholder=\"FULLNAME\" className=\"form-control\"\n onChange={this.handleChange}\n required\n />\n </div>\n <div className=\"input-group\">\n <span className=\"input-group-addon\"><i className=\"glyphicon glyphicon-envelope\"></i></span>\n <input type=\"email\" id=\"email\" placeholder=\"EMAIL\" className=\"form-control\"\n onChange={this.handleChange}\n required\n />\n </div>\n <div className=\"input-group\">\n <span className=\"input-group-addon\"><i className=\"glyphicon glyphicon-lock\"></i></span>\n <input type=\"password\" id=\"password\" placeholder=\"PASSWORD\" className=\"form-control\"\n onChange={this.handleChange}\n required\n />\n </div>\n <div className=\"input-group\">\n <span className=\"input-group-addon\"><i className=\"glyphicon glyphicon-lock\"></i></span>\n <input type=\"password\" id=\"confirmpassword\" placeholder=\"CONFIRM PASSWORD\" className=\"form-control\"\n onChange={this.handleChange}\n required\n />\n </div>\n <br />\n <div className=\"form-group\">\n <input className=\"btn btn-success btn-md\" type=\"submit\" name=\"submit\" id=\"btnsignup\" value=\"CREATE ACCOUNT\" />\n </div> \n </form>\n </div>\n </div>\n </div>\n );\n }", "function getSignUpUI() {\n fetch('/api/signUp', {\n method: 'GET'\n }).then(response => response.text())\n .then(res => {\n var mainBody = document.getElementById('main-body');\n mainBody.innerHTML = res;\n selectIcon('home');\n });\n}", "function renderLoginButton() {\n var loginButtonContainer = document.getElementById(\"firebaseui-auth-container\");\n var loginButtonHTML = getLoginButtonHTML();\n loginButtonContainer.innerHTML = loginButtonHTML;\n}", "function showRegister(req, res){\n \n var userstat_si_so=\"<a class=\\\"index\\\" id=\\\"signin\\\" href=\\\"/login\\\">התחבר</a>\";\n var userstat_su_un=\"<a class=\\\"index\\\" id=\\\"signup\\\" href=\\\"/register\\\">הרשם</a>\"+\" | \";\n \n //check if the user is conected\n if (req.isAuthenticated()){\n userstat_su_un = \" שלום \"+req.user.local.username+\" | \";\n userstat_si_so = \"<a class=\\\"index\\\" id=\\\"signout\\\" href=\\\"/logout\\\">התנתק</a>\";\n \n res.render('pages/register', {message: req.flash('signupMessage'),userstat_su_un:userstat_su_un ,userstat_si_so:userstat_si_so});\n// ,'errors: req.flash('errors')});\n // res.render('pages/register', {userstat_su_un:userstat_su_un ,userstat_si_so:userstat_si_so,\n // errors: req.flash('errors'),message: req.flash('signupMessage')});\n }\n \n // return a view with data in case user didn't connect\n else{\n \n res.render('pages/register', {message: req.flash('signupMessage'), userstat_su_un: userstat_su_un ,userstat_si_so:userstat_si_so });\n// ,errors: req.flash('errors') });\n }\n//\tres.render('pages/register', {\n// \t\terrors: req.flash('errors')\n// \t});\n}", "render() {\n <div class=\"login-box\" id=\"login-box\">\n <input autocomplete=\"off\" type=\"text\" class=\"email\" id=\"email\" placeholder=\"email\">\n <input type=\"password\" class=\"password\" id=\"password\" placeholder=\"password\">\n <br>\n <br> \n \n <div class=\"login-buttons\">\n <button type=\"button\" class=\"btn btn-login\" id=\"login-btn\">Login</button>\n <button type=\"button\" class=\"btn btn-default\" id=\"sign-up-btn\">Sign up</button>\n </div>\n </div>\n }", "render() {\n return (\n <div>\n <div className='container'>\n <div className='form-div'>\n <center>\n <h1><b>SignUp</b></h1>\n </center>\n <form onSubmit={this.onSubmit}>\n <input type=\"text\"\n placeholder=\"Full Name\"\n onChange={this.changeFullName}\n value={this.state.fullName}\n className='form-control form-group'\n />\n <input type='text'\n placeholder='Username'\n onChange={this.changeUserName}\n value={this.state.username}\n className=\"form-control form-group\"\n />\n\n <input type='email'\n placeholder='Email'\n onChange={this.changeEmail}\n value={this.state.email}\n className=\"form-control form-group\"\n />\n\n <input type='password'\n placeholder='Password'\n onChange={this.changePassword}\n value={this.state.password}\n className=\"form-control form-group\"\n />\n\n <input type='submit' className=\"'btn btn-danger btn block\" value='Submit' />\n\n </form>\n </div>\n </div>\n </div>\n );\n }", "render() {\n\t\treturn (\n\t\t\t<div>[User Panel Placeholder]</div>\n\t\t)\n\t}", "render() {\n return (\n <div>\n <SignupRender {...this.props} /> \n </div>\n );\n }", "function signup() {\r\n try {\r\n if (!dw.system.Site.getCurrent().getCustomPreferenceValue(\"emarsysEnabled\")) {\r\n emarsysDisabledTemplate();\r\n return;\r\n }\r\n // clear form\r\n app.getForm('emarsyssignup').clear();\r\n // render the Submit Form\r\n app.getView({\r\n ContinueURL: URLUtils.https('EmarsysNewsletter-SubmitForm')\r\n }).render('subscription/emarsyssignup');\r\n } catch(e) {\r\n errorPage(e);\r\n }\r\n}", "function signup() {\n return (\n <div className=\"bless\" >\n <div className= 'style'>\n <div className= 'style2'>\n <div className= 'box2'>\n <div className= \"row\">\n {/* <img src ={picture} width=\"300px\" alt=\"woman\"/> */}\n </div>\n <form>\n <h2 style={{color:'red'}}>Create Account</h2>\n\n <labe for=\"fname\">First Name:</labe><br/>\n <input type=\"text\" id=\"fname\" className=\"form-group\" /><br/>\n\n <label for=\"lname\">Last Name:</label><br/>\n <input type=\"text\"id=\"lname\" className=\"form-group\" /><br/>\n\n <label for=\"email\">Email:</label><br/>\n <input type=\"email\" id=\"email\" className=\"form-group\" /><br/>\n\n <label for=\"password\">Password:</label><br/>\n <input type=\"password\"id=\"password\" className=\"form-group\" /><br/>\n </form>\n <button style={{color:'blue'}}>Signup</button>\n </div>\n </div>\n </div>\n </div>\n )\n}", "function handleSignUpButton() {\n $(\".main-area\").on(\"click\", \".nav-signup\", function(e) {\n console.log(\"SignUp button clicked\");\n // stop from form submitting\n e.preventDefault();\n // excute display signup page function that holds the html\n displaySignupPage();\n });\n}", "function displaySignupPage() {\n // create variable that holds the render sign up html\n const signupPage = renderSignupPage();\n $(\".landing-page\").prop(\"hidden\", true);\n // select main-page and display html from signup variable that holds the function\n $(\"#main-page\").html(signupPage);\n}", "function show() {\n\n var wrapper = $(document).find('#quick-sign-up-wrapper');\n var partial = quickSignUpPartial.replace('*|base-app-url|*', config.baseAppUrl);\n wrapper.empty().append(partial);\n\n }", "function register(){ // rencer the register screen, hide main\n document.getElementById(\"main\").style.display = \"none\";\n\tlet src = document.getElementById(\"registerTemplate\").innerHTML;\n\tlet template = Handlebars.compile(src);\n\tlet context = {}; // {{ N/A }}\n\tlet html = template(context);\n\trender(html);\n\tlet registerButton = document.getElementById(\"registerButton\");\n\tregisterButton.addEventListener(\"click\", (e) => {\n\t\te.preventDefault();\n\t\tregisterClick();\n\t});\n}", "function createUserScreen(){\n const view = document.createElement('div');\n view.setAttribute('class','signInView');\n\n let inputs = {};\n ['name','email address','password','confirm password'].forEach(function (label){\n inputs[label] = appendLabel(view, label, 'register');\n })\n\n let termsClicked = true;\n\n const terms = document.createElement('div');\n terms.setAttribute('class','termsField');\n view.appendChild(terms);\n\n const termsButton = document.createElement('img');\n termsButton.setAttribute('class','termsButton');\n terms.appendChild(termsButton);\n\n const termsText = document.createElement('div');\n termsText.setAttribute('class','termsText');\n termsText.innerHTML = 'I have read and accept Bespin FM\\'s <a href=\"../terms.html\" target=\"_blank\" id=\"terms\" ' +\n 'class=\"terms\">Terms and Conditions</a>';\n terms.appendChild(termsText);\n\n terms.onclick = function (){\n termsClicked = !termsClicked;\n if (termsClicked){\n termsButton.src = 'media/check.png';\n termsButton.style.backgroundColor = '#a2d7f1';\n }\n else{\n termsButton.src = 'media/check_faded.png';\n termsButton.style.backgroundColor = 'white';\n }\n }\n terms.click();\n\n const submit = document.createElement('div');\n submit.setAttribute('class','signInSubmit');\n submit.textContent = 'Submit';\n view.appendChild(submit);\n\n submit.onclick = function (){\n createUser(inputs['name'].value,inputs['email address'].value,inputs['password'].value);\n }\n\n return view;\n}", "render() {\n\n\n\n\t\treturn (\n\t\t\t<div className=\"row valign-wrapper\">\n\t\t\t\t\n\n\t\t\t\t<div className=\" card col s5\">\n\n\t\t\t\t\t<div className=\"row center\"> Already a member? Login</div>\n\n\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t\t<input type=\"text\" name=\"loginEmail\" value={this.state.loginEmail} onChange={this.handleChange.bind(this)} className=\"cursiveFont col s8 offset-s2\" placeholder=\"email\"/>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t <input type=\"password\" name=\"loginPassword\" value={this.state.loginPassword} onChange={this.handleChange.bind(this)} className=\"cursiveFont col s8 offset-s2\" placeholder=\"password\"/>\n\t\t\t\t\t</div>\n\n\t\t\t\t\n\n\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t <a onClick={this.handleLogin} className=\"waves-effect waves-light btn flat col s4 offset-s4\">Login</a>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"row center\">\n\t\t\t\t\t\t {this.state.loginMessage}\n\t\t\t\t\t</div>\n\n\t\t\t\t</div>\n\n\n\t\t\t\t<div className=\"col s5 card offset-s1\">\n\n\t\t\t\t\t\t<div className=\"row center\"> New member? Signup</div>\n\n\t\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t\t\t<input type=\"text\" name=\"signupEmail\" value={this.state.signupEmail} onChange={this.handleChange.bind(this)} className=\"cursiveFont col s8 offset-s2\" placeholder=\"email\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t\t <input type=\"password\" name=\"signupPassword\" value={this.state.signupPassword} onChange={this.handleChange.bind(this)} className=\"cursiveFont col s8 offset-s2\" placeholder=\"password\"/>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t\t <input type=\"text\" name=\"signupUsername\" value={this.state.signupUsername} onChange={this.handleChange.bind(this)} className=\"cursiveFont col s8 offset-s2\" placeholder=\"username\"/>\n\t\t\t\t\t\t</div>\n\n\n\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t <a onClick={this.handleSignup} className=\"waves-effect waves-light btn flat col s4 offset-s4\">Signup</a>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div className=\"row center\">\n\t\t\t\t\t\t\t {this.state.signupMessage}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\n\n\t\t\t\t</div>\n\n\n\t\t\t</div>\n\n\n\t\t);\n\t}", "render(){\n\t\t\t\treturn <button className=\"ui button primary\">Submit</button>\n\t\t\t}", "async create ({ view }) {\n return view.render('user.create')\n }", "function renderSignOut(){\n return`\n <button class=\"mdl-button mdl-js-button sign-out\">Sign Out</button>\n `\n }", "render() {\n return html`\n <slot name=\"input\"></slot>\n <div class=\"choice-field__graphic-container\">${this._choiceGraphicTemplate()}</div>\n <div class=\"choice-field__label\">\n <slot name=\"label\"></slot>\n </div>\n <small class=\"choice-field__help-text\">\n <slot name=\"help-text\"></slot>\n </small>\n ${this._afterTemplate()}\n `;\n }", "signUp() {\n I.fillField(this.signupLocators.fullName, 'SignUpOrgAdmin');\n I.fillField(this.signupLocators.email, '[email protected]');\n I.fillField(this.signupLocators.password, 'SECRET123');\n I.fillField(this.signupLocators.confirmPassword, 'SECRET123');\n I.click(this.signupLocators.toggleAgreeToTermsAndConditions);\n I.click(this.signupLocators.signUpRegistration);\n }", "render() {\n return <div className={styles.signup}>\n\n <div className={classes('page_container', 'flex_container')}>\n\n <h3 className={styles.signup_header}>\n create an account\n </h3>\n\n <form onSubmit={this.handleSubmit}\n className={classes('signup_form', 'formField', 'flex-container')}>\n\n\n {/*---EMAIL Field---*/}\n\n <label className={classes('topSpace', 'formField', 'flex_container')}>\n <div className={styles.form_icon_container} >\n <img src='/app/user/shared/img/signup-login_username.png'className={styles.form_icon}/>\n </div>\n <input\n className='inputField'\n name='username'\n type='text'\n placeholder='your username'\n value={this.state.username}\n onChange={this.handleUsernameChange}\n />\n </label>\n\n {/*---EMAIL Field---*/}\n\n <label className={classes('topSpace', 'formField', 'flex_container')}>\n <div className={styles.form_icon_container} >\n <img src='/app/user/shared/img/signup-login_email.png'className={styles.form_icon}/>\n </div>\n <input\n className='inputField'\n name='email'\n type='text'\n placeholder='your email'\n value={this.state.email}\n onChange={this.handleEmailChange}\n />\n </label>\n\n {/*---PASSWORD Field---*/}\n\n <label className={classes('topSpace', 'formField', 'flex_container')}>\n <div className={styles.form_icon_container} >\n <img src='/app/user/shared/img/signup-login_password.png'className={styles.form_icon}/>\n </div>\n <input\n className='inputField'\n name='password'\n type='password'\n placeholder='password'\n value={this.state.password}\n onChange={this.handlePasswordChange}\n />\n </label>\n\n {/*---CONFIRM PASSWORD Field---*/}\n\n <label className={classes('topSpace', 'formField', 'flex_container')}>\n <div className={styles.form_icon_container} >\n <img src='/app/user/shared/img/signup-login_password.png'className={styles.form_icon}/>\n </div>\n <input\n className='inputField'\n name='confirmPassword'\n type='password'\n placeholder='confirm password'\n value={this.state.confirmPassword}\n onChange={this.handleConfirmPasswordChange}\n />\n </label>\n\n {/*---SUBMIT BUTTON---*/}\n\n <input\n type='submit'\n value='register'\n className={classes('submitButton', 'topSpace')} />\n\n </form>\n\n {/*---Tooltip (Already have an account?)--*/}\n\n <div className={classes('topSpace', 'signup_tooltip')}>\n already have an account?\n sign in <Link to='/Login' className={styles.login_link}>here</Link>\n </div>\n\n </div>\n\n </div>\n }", "render() {\n return (\n <div className=\"signup_reg_page\">\n <form className=\"Form\" onSubmit={this.handleSubmit}>\n <h2>Login to your account</h2>\n <hr />\n <h3> Sign In to Get access to the shops. </h3>\n <div className=\"form-group \">\n <label htmlFor=\"email\">Email address</label>\n <input\n type=\"email\"\n className=\"form-control\"\n name=\"email\"\n placeholder=\"Email\"\n value={this.state.email}\n onChange={this.handleUserInput}\n />\n </div>\n <div className=\"form-group \">\n <label htmlFor=\"password\">Password</label>\n <input\n type=\"password\"\n className=\"form-control\"\n name=\"password\"\n placeholder=\"Password\"\n value={this.state.password}\n onChange={this.handleUserInput}\n />\n </div>\n <div>\n <button\n type=\"submit\"\n name=\"signin\"\n className=\"btn btn-primary\"\n disabled={!this.state.formValid}\n >\n {\" \"}\n Sign In{\" \"}\n </button>\n </div>{\" \"}\n <FormErrors formErrors={this.state.formErrors} />\n <hr className=\"Form\" />\n <h5>\n Not register yet <Link to=\"/signup\">Sign UP</Link>\n </h5>\n </form>\n </div>\n );\n }", "render() {\n\treturn html`\n\t<form onsubmit=\"javascript: return false;\" id=\"form1\" method=\"POST\">\n\tUID: <input type=\"text\" id=\"uid\" name=\"uid\" value=\"${this.user.uid}\" readonly>\n\t<br>\n\tUsername: <input type=\"text\" id=\"uname\" name=\"uname\" value=\"${this.user.uname}\">\n\t<br>\n\tFirst name: <input type=\"text\" id=\"firstName\" name=\"firstName\" value=\"${this.user.firstName}\">\n\t<br>\n\tLast name: <input type=\"text\" id=\"lastName\" name=\"lastName\" value=\"${this.user.lastName}\">\n\t<br>\n\tPassword new: <input type=\"text\" id=\"pwd\" name=\"pwd\">\n\t<br>\n\tPassword old: <input type=\"text\" id=\"oldpwd\" name=\"oldpwd\">\n\t<br>\n\t<input type=\"submit\" form=\"form1\" value=\"Submit\" @click=${this.changeUserData}>\n\t`;\n }", "afterRender() {\n document.forms['signupForm'].addEventListener('submit', (e) => {\n e.preventDefault();\n\n const birthDate = new Date(e.target.elements['birthDate'].value);\n const userData = {\n email: e.target.elements['email'].value,\n password: e.target.elements['password'].value,\n nickname: e.target.elements['nickname'].value,\n first_name: e.target.elements['firstName'].value,\n last_name: e.target.elements['lastName'].value,\n phone: e.target.elements['phone'].value,\n gender_orientation: e.target.elements['gender'].value,\n city: e.target.elements['city'].value,\n country: e.target.elements['country'].value,\n date_of_birth_day: birthDate.getDate(),\n date_of_birth_month: birthDate.getMonth() + 1,\n date_of_birth_year: birthDate.getFullYear(),\n };\n\n // prevent sending an http-request to the server if not all user data is provided\n for (let key in userData) {\n if (!userData[key]) return;\n }\n\n this._authService.signup(userData)\n .then((response) => {\n console.log(response);\n })\n .catch((err) => {\n console.log(err);\n });\n });\n }", "register(request, response) {\n\t\tresponse.render('auth/register');\n\t}", "function render() {\n let dashboard = createDashboard();\n\n /* Button Components */\n let buttonDiv = document.createElement(\"div\");\n buttonDiv.classList.add(\"d-flex\");\n\n let buttonGroupUsername = document.createElement(\"div\");\n let buttonGroupPassword = document.createElement(\"div\");\n\n buttonGroupUsername.classList.add(\"btn-group\", \"ml-auto\", \"mr-auto\");\n buttonGroupPassword.classList.add(\"btn-group\", \"ml-auto\", \"mr-auto\");\n\n let updateUsernameButton = createButton({\n type: \"btn-secondary\",\n text: \"Update your Username\"\n });\n\n let updatePasswordButton = createButton({\n type: \"btn-info\",\n text: \"Update your Password\"\n });\n\n updateUsernameButton.addEventListener(\"click\", function () {\n const successFunc = (confirm) => {\n modal.hideModal();\n modal.alert(\"Your username has been changed.\");\n profileDiv.innerHTML = '';\n account_api.getUserInfo(handleProfileInfo, errorDOM);\n };\n\n let form = renderUpdateUsernameForm(function () {\n let data = {};\n let errors = [];\n\n let oldName = form.old_username.value;\n data[\"username\"] = form.new_username.value;\n\n if (form.new_username.value === undefined || form.new_username.value === '') {\n let errorMsg = \"Please enter a username.\";\n errors.push(errorMsg);\n } else {\n if (oldName === form.new_username.value) {\n let errorMsg = \"Please try to be original here. This is already your username.\";\n errors.push(errorMsg);\n } else {\n if (form.new_username.value.length > 150) {\n let errorMsg = \"Too many characters. Keep it to 150 characters or less.\";\n errors.push(errorMsg);\n }\n\n if (usernameValidation(form.new_username.value) === null) {\n let errorMsg = \"Your username can only contain the following: Letters, Digits, and @, ., +, -, _\";\n errors.push(errorMsg);\n }\n }\n }\n\n if (errors.length === 0) {\n account_api.updateUsername(data, successFunc, errorDOM);\n } else {\n modal.renderErrorMessages(errors);\n }\n }, function () {\n modal.hideModal();\n });\n\n modal.renderForm(form.container);\n });\n\n updatePasswordButton.addEventListener(\"click\", function () {\n const successFunc = (confirm) => {\n modal.hideModal();\n modal.alert(\"Your password has changed.\");\n };\n\n let form = renderUpdatePasswordForm(function () {\n let data = {};\n let errors = [];\n\n data[\"old_password\"] = form.old_password.value;\n data[\"new_password1\"] = form.new_password1.value;\n data[\"new_password2\"] = form.new_password2.value;\n\n if (form.old_password.value === undefined || form.old_password.value === '') {\n let errorMsg = \"Please enter your previous password here.\";\n errors.push(errorMsg);\n }\n\n if (form.new_password1.value === undefined || form.new_password1.value === '') {\n let errorMsg = \"Enter a password for Password 1.\";\n errors.push(errorMsg);\n } else if (form.new_password2.value === undefined || form.new_password2.value === '') {\n let errorMsg = \"Enter a password for Password 2.\";\n errors.push(errorMsg);\n } else {\n if (!verify_matching_passwords(form.new_password1.value, form.new_password2.value)) {\n let errorMsg = \"The passwords do not match.\";\n errors.push(errorMsg);\n } else {\n if (form.new_password1.value.length < 8) {\n let errorMsg = \"This password is too short. It must contain at least 8 characters.\";\n errors.push(errorMsg);\n }\n\n if (!isNaN(form.new_password1.value)) {\n let errorMsg = \"This password is entirely numeric.\";\n errors.push(errorMsg);\n }\n }\n }\n\n if (errors.length === 0) {\n account_api.changePassword(data, successFunc, errorDOM);\n } else {\n modal.renderErrorMessages(errors);\n }\n }, function () {\n modal.hideModal();\n });\n\n modal.renderForm(form.container);\n });\n\n buttonGroupUsername.appendChild(updateUsernameButton);\n buttonGroupPassword.appendChild(updatePasswordButton);\n\n buttonDiv.appendChild(buttonGroupUsername);\n buttonDiv.appendChild(buttonGroupPassword);\n\n profileDiv.appendChild(modal);\n profileDiv.appendChild(errorDOM);\n profileDiv.appendChild(dashboard);\n profileDiv.appendChild(buttonDiv);\n }", "function showSignupForm(req, res){\n\t// render the page and pass in any flash data if it exists\n res.render('pages/signup', { message: req.flash('signupMessage') });\n}", "render() {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<form onSubmit={this.handleSubmit}>\t\t\t \n\t\t\t\t <label>\n\t\t\t\t Email:\n\t\t\t\t <input id=\"username\" type=\"text\" name=\"email\" onKeyUp={this.handleChange} />\n\t\t\t\t </label>\n\t\t\t\t <label>\n\t\t\t\t Password:\n\t\t\t\t <input id=\"password\" type=\"password\" name=\"password\" onKeyUp={this.handleChange} />\n\t\t\t\t </label>\n\t\t\t\t <input type=\"submit\" value=\"Submit\" />\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t\t);\n\t\t}", "signup(e) {\n e.preventDefault();\n signupUser(this.state.email, this.state.password);\n }", "function renderUserPage(type) {\n switch (type) {\n case 'register':\n return [\n '<section>',\n '<h2>Registreren</h2>',\n '<form method=\"post\" action=\"/user/register\" class=\"user-form\">',\n '<fieldset>',\n '<label>',\n 'Gebruikersnaam',\n '<input type=\"text\" name=\"username\">',\n '</label>',\n '<label>',\n 'Wachtwoord',\n '<input type=\"password\" name=\"password\">',\n '</label>',\n '<label>',\n 'Herhaal wachtwoord',\n '<input type=\"password\" name=\"passwordcopy\">',\n '</label>',\n '<input type=\"submit\">',\n '</fieldset>',\n '<fieldset>',\n '<p>Al een account? <a href=\"/user/login\">Log in</a>!</p>',\n '</fieldset>',\n '</form>',\n '</section>'\n ].join('\\n');\n break;\n case 'login':\n return [\n '<section>',\n '<h2>Inloggen</h2>',\n '<form method=\"post\" action=\"/user/login\" class=\"user-form\">',\n '<fieldset>',\n '<label>',\n 'Gebruikersnaam',\n '<input type=\"text\" name=\"username\">',\n '</label>',\n '<label>',\n 'Wachtwoord',\n '<input type=\"password\" name=\"password\">',\n '</label>',\n '<input type=\"submit\">',\n '</fieldset>',\n '<fieldset>',\n '<p>Nog geen account? <a href=\"/user/register\">Registreer</a>!</p>',\n '</fieldset>',\n '</form>',\n '</section>'\n ].join('\\n');\n break;\n }\n}", "async clickSignUp() {\n await this.driver.findElement(By.css(SELECTORS.signUpButton)).click();\n }", "render() {\n return <div>{this.renderAuthButton()}</div>;\n }", "function signup(){\r\n\t\tdocument.querySelector(\".login\").style.cssText=\"display:none\";\r\n\t\tdocument.querySelector(\".reg\").style.cssText=\"display:block\";\r\n\t\tdocument.querySelector(\".log-res\").style.cssText=\"background: linear-gradient(to bottom,#90cfd4,#14bcc9)\";\r\n\t\tdocument.querySelector(\".btn-2\").style.cssText=\"display:block; margin-left:35%;\";\r\n\t\tdocument.querySelector(\".btn-1\").style.cssText=\"display:none\";\r\n\t}", "create({view}) {\n \n return view.render('user.create')\n }", "function signup() {\r\n document.querySelector(\".thankyou\").innerHTML = 'Thank you for signing up'\r\n}", "function renderMyAccount(userData) {\n // Initialize the String Template\n const myAccountInfo = `\n <div class=\"account-card\">\n <p>First Name: ${userData.firstname}</p>\n <p>Last Name: ${userData.lastname}</p>\n <p>User Name: ${userData.username}</p>\n <p>Email: ${userData.email}</p>\n </div>\n <button class=\"account-update-btn\">update</button>`;\n //Insert User Info into the DOM\n $(\".my-account-container\").html(myAccountInfo);\n}", "get template(){\n return `\n <div class=\"col-3 mt-3 p-3 border rounded bg-light tasks\" style=\"margin: 1em;\">\n <h1 class=\"text-left border-bottom\" id=\"name\">${this.name}<button class=\"btn btn-outline btn-danger\" onclick=\"app.listController.removeList('${this.id}')\">X</button></h1>\n\n \n ${this.drawTask()}\n \n <form style=\"margin-bottom: 1em;\" onsubmit=\"app.listController.createTask(event,'${this.id}')\">\n <div class=\"input-group mb-3\">\n <input id=\"task\" type=\"text\" class=\"form-control\" placeholder=\"Add Task\" aria-label=\"task\" aria-describedby=\"task-addon\">\n <div class=\"input-group-append\">\n <button class=\"btn btn-outline-secondary\" type=\"submit\">+</button>\n </div>\n </div>\n </form>\n </div>\n `;\n }", "signUp() {\n\t\tipcRenderer.send('openSignUp', true);\n\t}", "renderRegister() {\n return (\n <div className=\"col-md-6 log-reg\">\n <h2 className=\"text-center\">Registrarse</h2>\n <form>\n <label className=\"col-form-label col-md-6\">\n Correo\n </label>\n <input name=\"emailReg\" type=\"text\" onChange={this.handleInputChange.bind(this)} value={this.state.emailReg}/>\n <label className=\"col-form-label col-md-6\">\n Contraseña\n </label>\n <input name=\"passwordReg\" type=\"password\" onChange={this.handleInputChange.bind(this)} value={this.state.passwordReg}/>\n <label className=\"col-form-label col-md-6\">\n Confirmar Contraseña\n </label>\n <input name=\"passwordConf\" type=\"password\" onChange={this.handleInputChange.bind(this)} value={this.state.passwordConf}/>\n <div className=\"row justify-content-center align-self-center\">\n <button type=\"button\" className=\"btn-format\" onClick={this.handleRegisterClick.bind(this)}>Registrar</button>\n </div>\n </form>\n </div>\n );\n }", "render()\n {\n return template;\n }", "render() {\n const {name, email, password, error, open} = this.state //destructure is a Big O \n return (\n <div className=\"container\">\n\n <h2 className=\"ml-0 mt-5 mb-5\" > Signup </h2> {/*// margin of 5 bottom of 5*/}\n \n{/* The error message will be above the form - the light blue stripe*/}\n {/*condiitonal value is set within the style tag to appear only on error */}\n <div className=\"alert alert-danger\" style={{display: error ? \"\" :\"none\"}}> \n \n {error} {/*this is destructured and collects the state value */}\n </div>\n <div className=\"alert alert-info\" style={{display: open ? \"\" :\"none\"}}\n > \n Account created Successfully. Please <Link to=\"/signin\">Sign In</Link> \n </div>\n {this.signupForm(name, email, password)}\n </div>\n );\n }", "function returningUserScreen(){\n const view = document.createElement('div');\n view.setAttribute('class','signInView');\n\n let inputs = {};\n ['email address','password'].forEach(function (text){\n const label = appendLabel(view,text,'sign in');\n inputs[text] = label;\n label.onkeypress = function (e){\n if (e.key === 'Enter'){\n submit.click();\n }\n }\n })\n\n const forgot = document.createElement('div');\n forgot.setAttribute('class','forgotten');\n forgot.textContent = 'forgotten password?';\n view.appendChild(forgot);\n\n const submit = document.createElement('div');\n submit.setAttribute('class','signInSubmit');\n submit.textContent = 'Sign In';\n view.appendChild(submit);\n\n submit.onclick = function (){\n attemptSignIn(inputs['email address'].value,inputs['password'].value);\n }\n\n return view;\n}", "render() {\n const options = [\n { key: 'm', text: 'Mānoa', value: 'Mānoa' },\n { key: 'h', text: 'Hilo', value: 'Hilo' },\n { key: 'ha', text: 'Hawaiʻi', value: 'Hawaiʻi' },\n { key: 'ho', text: 'Honolulu', value: 'Honolulu' },\n { key: 'k', text: 'Kapiʻolani', value: 'Kapiʻolani' },\n { key: 'ka', text: 'Kauaʻi', value: 'Kauaʻi' },\n { key: 'le', text: 'Leeward', value: 'Leeward' },\n { key: 'ma', text: 'Maui', value: 'Maui' },\n { key: 'wi', text: 'Windward', value: 'Windward' },\n { key: 'wo', text: 'West Oʻahu', value: 'West Oʻahu' },\n ];\n\n // if correct authentication, redirect to from: page instead of signup screen\n if (this.state.redirectToReferer) {\n return <Redirect to={'/signin'}/>;\n }\n return (\n <Container>\n <Grid textAlign=\"center\" verticalAlign=\"middle\" centered columns={2}>\n <Grid.Column>\n <Header as=\"h2\" textAlign=\"center\">\n Register your account\n </Header>\n <Form onSubmit={this.handleSubmit} inverted>\n <Segment stacked inverted>\n <Header as=\"h5\" textAlign=\"center\">\n Account Information\n </Header>\n <Form.Input\n label=\"Email\"\n icon=\"user\"\n iconPosition=\"left\"\n required\n name=\"email\"\n type=\"email\"\n placeholder=\"E-mail address\"\n onChange={this.handleChange}\n />\n <Form.Input\n label=\"Password\"\n icon=\"lock\"\n iconPosition=\"left\"\n required\n name=\"password\"\n placeholder=\"Password\"\n type=\"password\"\n onChange={this.handleChange}\n />\n <Form.Input\n label=\"repassword\"\n icon=\"lock\"\n iconPosition=\"left\"\n name=\"repassword\"\n required\n placeholder=\"repassword\"\n type=\"password\"\n onChange={this.handleChange}\n />\n\n <Header as=\"h5\" textAlign=\"center\">\n Student Information\n </Header>\n <Form.Group widths={'equal'}>\n <Form.Input fluid label='First name' placeholder='First name' name=\"firstName\"\n type=\"firstName\"\n onChange={this.handleChange} required/>\n <Form.Input fluid label='Last name' placeholder='Last name' name=\"lastName\"\n type=\"lastName\"\n onChange={this.handleChange} required/>\n </Form.Group>\n <Form.Group widths={'equal'}>\n <Form.Select\n fluid\n label='Campus'\n options={options}\n required\n placeholder='Campus'\n name=\"campus\"\n type=\"campus\"\n onChange={this.handleChange}\n />\n </Form.Group>\n <Form.Button content=\"Submit\"/>\n </Segment>\n </Form>\n <Message color='black'>\n Have an account with us? <Link to=\"/signin\">Sign in</Link>\n </Message>\n\n {this.state.error === '' ? (\n ''\n ) : (\n <Message\n error\n header=\"Registration was not successful\"\n content={this.state.error}\n />\n )}\n </Grid.Column>\n </Grid>\n </Container>\n );\n }", "render() {\r\n\t\treturn (\r\n\t\t\t<div className=\"Login\" align=\"center\">\r\n\t\t\t\t{this.state.newUser === null ?\r\n\t\t\t\t\t<form onSubmit={this.handleSubmit}>\r\n\t\t\t\t\t<FormGroup controlId=\"email\" bsSize=\"medium\">\r\n\t\t\t\t\t\t<ControlLabel>Email</ControlLabel>\r\n\t\t\t\t\t\t<FormControl autoFocus type=\"email\" value={this.state.email} onChange={this.handleChange} />\r\n\t\t\t\t\t</FormGroup>\r\n\t\t\t\t\t<FormGroup controlId=\"password\" bsSize=\"medium\">\r\n\t\t\t\t\t\t<ControlLabel>Password</ControlLabel>\r\n\t\t\t\t\t\t<FormControl value={this.state.password} onChange={this.handleChange} type=\"password\" />\r\n\t\t\t\t\t</FormGroup>\r\n\t\t\t\t\t<LoaderButton block bsSize=\"small\" disabled={!this.validateForm()} type=\"submit\" isLoading={this.state.isLoading} text=\"Login\" loadingText=\"Logging in…\" />\r\n\t\t\t\t\t</form>\r\n\t\t\t\t: this.renderConfirmationForm()\r\n\t\t\t\t}\r\n\t\t\t</div>\r\n\t\t);\r\n\t}", "render() {\n\t\tif (this.state.is_logged_in) {\n\t\t\treturn (\n\t\t\t\t<div>\n\t\t\t\t\t<div>Hello user</div>\n\t\t\t\t\t<div>Logged in</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<div>\n\t\t\t\t\t<div>Hello user</div>\n\t\t\t\t\t<div>Guest</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\t}", "render() {\n return (\n <div id=\"RegistrationScreen\">\n <div id=\"registrationForm\">\n <h1>BUDGHETTO</h1>\n <form action=\"\" onSubmit={this.handleSubmit}>\n <label htmlFor=\"username\">\n Username\n </label>\n <input defaultValue=\"[email protected]\" type=\"<strong>email</strong>\" id=\"username\" placeholder=\"[email protected]\"></input>\n <label htmlFor=\"password\">\n Password\n </label>\n <input type=\"password\" id=\"password\" pattern=\"^.{3,}$\"></input>\n <label htmlFor=\"repassword\">\n Retype password\n </label>\n <input type=\"password\" id=\"repassword\"></input>\n <input type=\"submit\" id=\"submit\" value=\"Sign up\"></input>\n </form>\n <input type=\"button\" id=\"cancel\" value=\"Cancel\" onClick={ () => browserHistory.push('/') }/>\n </div>\n </div>\n );\n }", "function getLoginButtonHTML() {\n var btnClass = \"\";\n var btnText = \"\";\n\n if (isUserLoggedIn()) {\n btnClass = \"btn-logout\";\n btnText = \"Sign Out\";\n }\n else {\n btnClass = \"btn-login\";\n btnText = \"Login\";\n }\n\n return `<button id=\"LoginBtn\" class=\"btn btn-primary ${btnClass}\">${btnText}</button>`\n}", "render() {\n return (\n <Container>\n <Grid textAlign=\"center\" verticalAlign=\"middle\" centered columns={2}>\n <Grid.Column>\n <Header as=\"h2\" textAlign=\"center\">\n Register your account\n </Header>\n <Form onSubmit={this.handleSubmit}>\n <Segment stacked>\n <Form.Input\n label=\"First Name\"\n icon=\"user\"\n iconPosition=\"left\"\n name=\"firstName\"\n type=\"text\"\n placeholder=\"First Name\"\n onChange={this.handleChange}\n />\n <Form.Input\n label=\"Last Name\"\n icon=\"user\"\n iconPosition=\"left\"\n name=\"lastName\"\n type=\"text\"\n placeholder=\"Last Name\"\n onChange={this.handleChange}\n />\n <Form.Select fluid label='Student or Faculty' options={sf_options} placeholder='Student or Faculty'/>\n <Form.Select fluid label='Proficiency' options={prof_options} placeholder='Native Speaker or Learning'/>\n <Form.TextArea\n label=\"Description\"\n name=\"desc\"\n placeholder=\"Tell us about yourself..\"\n onChange={this.handleChange}\n />\n <Form.Input\n label=\"Email\"\n icon=\"user\"\n iconPosition=\"left\"\n name=\"email\"\n type=\"email\"\n placeholder=\"[email protected]\"\n onChange={this.handleChange}\n />\n <Form.Input\n label=\"Password\"\n icon=\"lock\"\n iconPosition=\"left\"\n name=\"password\"\n placeholder=\"Password\"\n type=\"password\"\n onChange={this.handleChange}\n />\n <Form.Button content=\"Submit\" />\n </Segment>\n </Form>\n <Message>\n Already have an account? Login <Link to=\"/signin\">here</Link>\n </Message>\n {this.state.error === '' ? (\n ''\n ) : (\n <Message\n error\n header=\"Registration was not successful\"\n content={this.state.error}\n />\n )}\n </Grid.Column>\n </Grid>\n </Container>\n );\n }", "render() {\n return (\n <div>\n <form className=\"form-style-5\">\n <legend> Sign up / Sign in </legend>\n <div>\n <label htmlFor=\"userName\">UserName</label>\n <input name=\"userName\" component=\"input\" type=\"text\" />\n </div>\n <div>\n <label htmlFor=\"password\">Password</label>\n <input name=\"password\" component=\"input\" type=\"text\" />\n </div>\n <button type=\"submit\">SignUp</button>\n <button type=\"submit\">SignIn</button>\n </form>\n </div>\n )\n }", "renderTemplate() {\n this.render({\n outlet: 'login'\n });\n }", "function renderLogin(data, into) {\n\t\t\n\t\t//Add the template\n\t\tinto.innerHTML=`\n\t\t<h2>Lets login, shall we?</h2>\n\t\t<form action=${data.loginToken} method=\"post\">\n\t\t <button type=\"submit\">Login to Instagram</button>\n\t\t</form>\n\t\t`\n\t\t\n\t}", "render() {\n \n return (\n <div>\n <h2>Admin Button</h2>\n {/* insert button here */}\n \n </div>\n );\n }", "render() {\n console.log(this.props);\n const { first_name, last_name, display_name, email, password } = this.state;\n return (\n <div className=\"register\">\n <h2 className=\"title\">Update your account</h2>\n <span>Please fill out form</span>\n <form className=\"register-form\" onSubmit={this.handleSubmit}>\n <input\n placeholder=\"First Name\"\n name=\"first_name\"\n type=\"text\"\n value={first_name}\n onChange={this.handleChange}\n />\n <input\n placeholder=\"Last Name\"\n name=\"last_name\"\n type=\"text\"\n value={last_name}\n onChange={this.handleChange}\n />\n <input\n type=\"text\"\n name=\"display_name\"\n placeholder=\"display name\"\n value={display_name}\n onChange={this.handleChange}\n />\n <input\n type=\"email\"\n name=\"email\"\n placeholder=\"email\"\n value={email}\n onChange={this.handleChange}\n />\n <input\n type=\"password\"\n name=\"password\"\n placeholder=\"password\"\n value={password}\n onChange={this.handleChange}\n />\n\n <CustomButton type=\"submit\">Update</CustomButton>\n </form>\n </div>\n );\n }", "render() {\n const {errors} = this.state\n return (\n <Container className=\"SignupForm\">\n \n\n <h2 className=\"PageHeading\"> Sign Up </h2> \n <Form className=\"form\">\n <Col>\n <FormGroup row>\n <Label for=\"device-label\" sm={5}>Device Name</Label>\n <Col sm={12}> \n <Input \n value= {this.state.device_name}\n onChange={this.onChange}\n type=\"text\"\n name=\"device_name\"\n className=\"form-control\" \n placeholder = \"Enter Device Name\"\n />\n </Col> \n </FormGroup>\n {/*\n <div className=\"form-group\">\n <label className=\"control-label\">Email</label>\n <input\n value= {this.state.email}\n onChange={this.onChange}\n type=\"text\"\n name=\"email\"\n className=\"form-control\"\n />\n </div>\n */}\n <FormGroup row>\n <Label for=\"password\" sm={2}>Password</Label>\n <Col sm={12}>\n <Input\n value= {this.state.password}\n onChange={this.onChange}\n type=\"password\"\n name=\"password\"\n className=\"form-control\"\n placeholder = \"Enter Password\"\n />\n </Col>\n {/* {errors.message && <span className=\"err-block\">{errors.message}</span>} */}\n </FormGroup>\n </Col>\n{/*\n <div className=\"form-group\">\n <label className=\"control-label\">Confirm Password</label>\n <input\n value= {this.state.passwordConfirm}\n onChange={this.onChange}\n type=\"password\"\n name=\"passwordConfirm\"\n className=\"form-control\"\n />s\n </div>\n*/}\n <div className=\"button-grp\">\n <Button color=\"danger\" onClick={this.onSubmit}>\n Sign Up\n </Button>\n </div>\n </Form>\n </Container> \n );\n }", "render() {\n return (\n <View style={{flex: 1, backgroundColor: theme.backgroundColor}}>\n <Text style = {styles.welcome}>\n Signup\n </Text>\n\n {/* This allows the user to input an email address*/}\n\n <TextInput\n placeholder = \"email\"\n keyboardType={'email-address'}\n onChangeText = {(email) => this.setState ({email})}\n value = {this.state.email}\n />\n\n {/* This allows the user to input an username*/}\n\n <TextInput\n placeholder = \"username\"\n onChangeText = {(username) => this.setState ({username})}\n value = {this.state.username}\n />\n\n {/* This allows the user to input their own secure password*/}\n\n <TextInput\n secureTextEntry = {true}\n placeholder = \"password\"\n onChangeText = {(password) => this.setState ({password})}\n value = {this.state.password}\n />\n\n {/* This make sure their password is the same as the one they entered*/}\n <TextInput\n secureTextEntry = {true}\n placeholder = \"confirm password\"\n onChangeText = {(passwordConfirm) => this.setState ({passwordConfirm})}\n value = {this.state.passwordConfirm}\n />\n\n {/* This is a button that sign up the user.*/}\n <Button onPress = {() => this.signUpOnPress(this.props.navigator.push,\n {name: 'MyListView'})}\n > Sign up\n </Button>\n\n {/* This goes to the main login page if the user has an account already*/}\n <Button onPress = {() => this._navigateBack()}>\n Already have an account? Log in\n </Button>\n </View>\n )\n }", "function showSignupPage(){\n showPagesHelper(\"#signUpPage\");\n}", "function renderizaOk() {\n const nomeOk = criaP();\n const userOk = criaP();\n const senhaOk = criaP();\n const titulo = document.createElement('h3');\n render();\n\n // Renderizando as Informações do Usuário\n function render() {\n nomeOk.innerHTML = `<b>Nome</b> : ${inputNome.value.trim()}`;\n userOk.innerHTML = `<b>Username</b> : ${inputUser.value}`;\n senhaOk.innerHTML = `<b>Senha</b> : ${inputSenha.value}`;\n titulo.innerText = 'Usuário criado com sucesso!';\n\n divRenderiza.appendChild(titulo);\n divRenderiza.appendChild(nomeOk);\n divRenderiza.appendChild(userOk);\n divRenderiza.appendChild(senhaOk);\n }\n }", "displaySignIn() {\n return (\n <div>\n <p>Please Sign In</p>\n <div className={styles.wrapper}>\n <IconButton\n type=\"button\"\n icon=\"glyphicon glyphicon-plus\"\n buttonClass={styles.button}\n onClick={this.signIn}\n />\n </div>\n </div>\n );\n }", "render() {\n super.render();\n\n this.eventBusCollector.on(SIGNIN.fail, SignInView._fail);\n\n const usernameInput = document.forms.signIn.username;\n const passwordInput = document.forms.signIn.password;\n\n const func = (e) => {\n e.preventDefault();\n this.eventBus.emit(SIGNIN.submit, {\n login: usernameInput.value,\n password: passwordInput.value,\n });\n };\n\n document.forms.SignIn.addEventListener('submit', func, false);\n this.eventCollector.addEvent(document.forms.SignIn, 'submit', func, false);\n }", "function removeSignUpButton(items) {\n if (!items.has('signUp')) {\n return;\n }\n items.remove('signUp');\n items.add('signUp', FaradayMotionSignUpButton.component({}), 1);\n }", "function clickSignUp() {\n\tvar email = ($('.email-signup').find('input[type=email]')).val();\n\tvar password = (($('.email-signup').find('input[type=password]')).eq(0)).val();\n\tvar confirm = (($('.email-signup').find('input[type=password]')).eq(1)).val();\n\t\n\tif (password == confirm) {\n\t\t$.ajax({\n\t\t\turl: '\\/register',\n\t\t\tmethod: 'POST',\n\t\t\tdata: {email, password}\n\t\t}).done(function(jsondata) {\n\t\t\twindow.location.href = '/EditProfileHTML';\n\t\t}).fail(function (){\n\t\t\talert(\"Creation Error\");\n\t\t});\n\t}\n}", "render() {\n //put the state in the variable; instead of using this.state for each variable\n const {username, password, firstname, lastname, email, phone, address} = this.state\n return (\n <div class=\"form-container\">\n <form>\n <div style={{ marginTop: 100 }}>\n <h3>User Registration</h3>\n </div>\n <div>\n <label>First Name</label>\n <input type = \"text\" value={firstname} onChange={this.handlerFirstnameChange}/>\n </div>\n <div>\n <label>Username</label>\n <input type = \"text\" value={username} onChange={this.handlerLastnameChange}/>\n </div>\n <div>\n <label>Phone no. </label>\n <input type = \"text\" value={phone} onChange={this.handlerPhoneChange}/>\n </div>\n <div>\n <label>Email </label>\n <input type = \"text\" value={email} onChange={this.handlerEmailChange}/>\n </div>\n <div>\n <label>Address </label>\n <input type = \"text\" value={address} onChange={this.handlerAddressChange}/>\n </div>\n <div>\n <label>Password </label>\n <input type = \"password\" value ={password} onChange={this.handlerPasswordChange}/>\n </div>\n <button onClick={this.handleSubmit}>Submit</button>\n <button onClick={this.handleHome}>Home</button>\n </form>\n </div>\n );\n }", "render() {\n const {\n isAuth,\n errorMessage,\n isError,\n isPasswordError,\n isPasswordErrorMessage,\n isSubmitError,\n submitErrorMessage,\n isSuccessMessage,\n successMessage,\n } = this.state;\n\n let showTodoComponent = isAuth ? (\n <Todo />\n ) : (\n <form\n onSubmit={this.handleOnSubmit}\n \n >\n <h2>Sign Up</h2>\n {\" \"}\n {isError ? <div>{errorMessage}</div> : \"\"}\n {isSubmitError ? <div>{submitErrorMessage}</div> : \"\"}\n {isSuccessMessage ? <div>{successMessage}</div> : \"\"}\n <input\n type=\"text\"\n placeholder=\"enter email\"\n name=\"email\"\n onChange={this.handleOnChangeEmail}\n value={this.state.email}\n />{\" \"}\n <br />\n {isPasswordError ? <div>{isPasswordErrorMessage}</div> : \"\"}\n <input\n type=\"text\"\n placeholder=\"enter password\"\n name=\"password\"\n onChange={this.handleOnChangePassword}\n value={this.state.password}\n />{\" \"}\n <br /> <button>Sign up</button>\n </form>\n );\n\n return (\n <div style={{ textAlign: \"center\", marginTop: \"15%\" }}>\n {showTodoComponent}\n </div>\n );\n}", "function RegisterPanel() {\n Panel.call(this, $('<section class=\"register container-fluid\" style=\"display: none;\">'\n +'<h2>Register</h2>'\n +'<form class=\"register__form\">'\n + '<div class=\"row\">'\n + '<div class=\"col-sm-12 col-lg-6 input-group form-group\">'\n + '<div class=\"input-group-prepend\">'\n + '<div class=\"input-group-text\">Name</div>'\n + '</div>'\n + '<input class=\"form-control\" type=\"text\" name=\"name\" placeholder=\"John\" required=\"\">'\n + '</div>'\n + '<div class=\"col-sm-12 col-lg-6 form-group input-group\">'\n + '<div class=\"input-group-prepend\">'\n + '<div class=\"input-group-text\">Surname</div>'\n + '</div>'\n + '<input class=\"form-control\" type=\"text\" placeholder=\"Doe\" required=\"\">'\n + '</div>'\n + '<div class=\"col-sm-12 form-group input-group\">'\n + '<div class=\"input-group-prepend\">'\n + '<div class=\"input-group-text\">Email</div>'\n + '</div>'\n + '<input class=\"form-control\" type=\"email\" name=\"email\" placeholder=\"[email protected]\" required=\"\">'\n + '</div>'\n + '<div class=\"col-sm-12 col-lg-6 form-group input-group\">'\n + '<div class=\"input-group-prepend\">'\n + '<div class=\"input-group-text\">Password</div>'\n + '</div>'\n + '<input class=\"form-control\" type=\"password\" name=\"password\" placeholder=\"example\" required=\"\">'\n + '</div>'\n + '<div class=\"col-sm-12 col-lg-6 form-group input-group\">'\n + '<div class=\"input-group-prepend\">'\n + '<div class=\"input-group-text\">Confirm Password</div>'\n + '</div>'\n + '<input class=\"form-control\" type=\"password\" name=\"passwordConfirmation\" placeholder=\"example\" required=\"\">'\n + '</div>'\n + '<div class=\"col-sm-12 form-group\">'\n + '<button class=\"btn btn-default\" type=\"submit\">Register</button>'\n + '</div>'\n + '</div>'\n +'</form>'\n +'<section class=\"error\" style=\"display: none;\"></section>'\n +'</section>'));\n\n var $container = this.$element;\n\n var $form = $container.find('form');\n this.__$form__ = $form;\n\n var $inputs = $form.find('input');\n\n this.__$nameInput__ = $($inputs[0]);\n\n this.__$surnameInput__ = $($inputs[1]);\n\n this.__$emailInput__ = $($inputs[2]);\n\n this.__$passwordInput__ = $($inputs[3]);\n\n this.__$passwordConfirmationInput__ = $($inputs[4]);\n\n var errorPanel = new ErrorPanel;\n $container.append(errorPanel.$element);\n this.__errorPanel__ = errorPanel;\n\n var $loginLink = $('<a href=\"#\" class=\"register__login-link btn btn-warning\">Login</a>');\n $container.append($loginLink);\n this.__$loginLink__ = $loginLink;\n}", "render(){\n return(\n <Form onSubmit={this.signUp}>\n <Title>Sign up for our newsletter</Title>\n <Input\n onChange={this.handleChange}\n name=\"firstName\"\n type=\"text\"\n placeholder=\"First Name\"\n value={this.state.firstName} />\n <Input\n onChange={this.handleChange}\n name=\"lastName\"\n type=\"text\"\n placeholder=\"Last Name\"\n value={this.state.lastName} />\n <Input\n onChange={this.handleChange}\n name=\"email\"\n type=\"email\"\n placeholder=\"email address\"\n value={this.state.email} />\n <Button>Submit</Button>\n <div>First Name: {this.state.firstName} </div>\n <div>Last Name: {this.state.lastName}</div>\n </Form>\n )\n }", "render() {\n return (\n <StyledDiv className=\"Signup\">\n <h2>Advisor Sign Up</h2>\n <form onSubmit={this.signUp}>\n \n <StyledBox\n type=\"text\"\n name=\"name\"\n value={this.state.credentials.name}\n onChange={this.handleChange}\n placeholder=\"Name\"\n className=\"sign-up-input\"\n />\n <StyledBox\n type=\"text\"\n name=\"username\"\n value={this.state.credentials.username}\n onChange={this.handleChange}\n placeholder=\"Username\"\n className=\"sign-up-input\"\n />\n <StyledBox\n type=\"password\"\n name=\"password\"\n placeholder=\"Password\"\n value={this.state.credentials.password}\n onChange={this.handleChange}\n className=\"sign-up-input\"\n />\n <StyledBox \n type=\"text\"\n name=\"geo\"\n value={this.state.credentials.geo}\n onChange={this.handleChange}\n placeholder=\"Geographic Location\"\n className=\"sign-up-input\"\n />\n <StyledBox \n type=\"text\"\n name=\"area\"\n value={this.state.credentials.area}\n onChange={this.handleChange}\n placeholder=\"Area of Expertise\"\n className=\"sign-up-input\"\n />\n <StyledPress className=\"signup-btn\">Sign Up</StyledPress>\n \n </form>\n \n <StyledLink to= \"signup\">Click here to sign up as an advisee!</StyledLink>\n </StyledDiv>\n )\n }", "render() {\n return html ``;\n }", "render(){}", "render(){}", "function renderLoginPage() {\n return `\n\t\t<section class=\"login-screen\" aria-live=\"assertive\">\n\t\t\t<form role=\"form\" class=\"login\">\n\t\t\t\t<fieldset name=\"login-info\">\n\t\t\t\t\t<div class=\"login-header\">\n <legend>Log In</legend>\n <hr class=\"style-two\">\n\t\t\t\t </div>\n\t\t\t\t <p id='notification'></p>\n\t\t\t\t\t<label for=\"email\" required>Email</label>\n\t\t\t\t\t<input type=\"email\" name=\"email\" id=\"email\" placeholder=\"Email address\" required>\n\t\t\t\t\t<label for=\"password\">Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"password\" id=\"password\" placeholder=\"Password\" required>\n\t\t\t\t</fieldset>\n\t\t\t\t<button type=\"submit\" class=\"js-login-button\">Login</button>\n <p>Don't have an account? <a href=\"#\" class =\"nav-signup\">Sign up</a>\n </p>\n <p id=\"demo-note\">Demo Account:\n <br>Email: [email protected]\n <br>Password: testing123</p>\n\t\t\t</form>\n\t\t</section> `;\n}", "renderUser() {\n let usersDiv = document.getElementById(\"users-container\")\n usersDiv.innerHTML +=\n `\n <ul>\n <h3>Username: ${this.username}</h3>\n <li> Name: ${this.name}<br>\n Email: ${this.email}<br><br>\n </li> \n </ul>\n <button class=\"delete-button\" data-id=${this.id} onclick=\"deleteUser()\">Delete User</button> \n\n `\n }" ]
[ "0.7531717", "0.7206534", "0.71053165", "0.6804594", "0.6709056", "0.6646756", "0.65900296", "0.6588954", "0.6491808", "0.64289737", "0.6399449", "0.63651997", "0.6258602", "0.619901", "0.6196097", "0.6189152", "0.6187252", "0.6184635", "0.61755913", "0.6164995", "0.61599904", "0.61360186", "0.61356944", "0.60628086", "0.6008667", "0.6005444", "0.598491", "0.5976744", "0.59732825", "0.59693474", "0.5964832", "0.5962171", "0.5961973", "0.5953311", "0.59503967", "0.5950122", "0.59207845", "0.58946425", "0.58942866", "0.58934456", "0.5870672", "0.5869721", "0.5846981", "0.58370906", "0.5820028", "0.5807584", "0.5802886", "0.57948875", "0.5788617", "0.5746871", "0.57428306", "0.57349175", "0.57293105", "0.57104367", "0.5699197", "0.567376", "0.5667893", "0.56670046", "0.56561744", "0.56502485", "0.56445944", "0.56440026", "0.5643295", "0.56417584", "0.56274813", "0.562643", "0.562585", "0.5604878", "0.5600686", "0.55885506", "0.5579714", "0.55789924", "0.557443", "0.5571853", "0.55680203", "0.55656236", "0.556451", "0.55609924", "0.55600053", "0.55569005", "0.55539", "0.55509496", "0.5548185", "0.5532741", "0.5531666", "0.5521519", "0.5512607", "0.55052286", "0.5495173", "0.5478619", "0.54783124", "0.54769284", "0.5476842", "0.54672205", "0.5465298", "0.5465078", "0.5461378", "0.5461378", "0.54544675", "0.54531914" ]
0.6055421
24
render() returns the HTML template for FBButton
render () { return ( <div> <img src={FacebookLogin} alt="Facebook Login" onClick={this.handler} id="btnFacebookImage"/> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n const size = this.size || 'medium';\n // const iconOnly = this.iconOnly !== false|| false;\n\n return html`\n ${this.href\n ? html`\n <a\n class=\"pl-c-button pl-c-button--${size} ${this.iconOnly\n ? 'pl-c-button--icon-only'\n : ''}\"\n href=\"${this.href}\"\n target=\"${this.target ? this.target : 'self'}\"\n title=${ifDefined(this.title === '' ? undefined : this.title)}\n >\n ${this.innerTemplate()}\n </a>\n `\n : html`\n <button\n class=\"pl-c-button pl-c-button--${size} ${this.iconOnly\n ? 'pl-c-button--icon-only'\n : ''}\"\n title=${ifDefined(this.title === '' ? undefined : this.title)}\n type=\"button\"\n >\n ${this.innerTemplate()}\n </button>\n `}\n `;\n }", "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}", "function frameButtonFBTemplate(course, displayText = \"\", link_handbook = true, link_outline = true, link_timetable = true, link_myunsw = false) {\n displayText = (displayText == \"\") ? course.description : displayText;\n\n // Trim displayText to 640 characters | FB requirement\n displayText = displayText.substring(0, 640);\n\n let button_template = {\n speech: \"Description\",\n source: \"chappie_middleware\",\n displayText: \"Course Details\",\n data: {\n facebook: {\n attachment: {\n type: \"template\",\n payload: {\n template_type: \"button\",\n text: displayText,\n buttons: []\n }\n }\n }\n }\n };\n\n if (link_handbook && course.handbook_link) {\n button_template.data.facebook.attachment.payload.buttons.push({\n type: \"web_url\",\n url: course.handbook_link,\n title: 'Handbook link'\n });\n }\n\n if (link_outline && course.course_outline_link) {\n button_template.data.facebook.attachment.payload.buttons.push({\n type: \"web_url\",\n url: course.course_outline_link,\n title: 'Outline link'\n });\n }\n\n if (link_timetable && course.school_link) {\n button_template.data.facebook.attachment.payload.buttons.push({\n type: \"web_url\",\n url: course.class_timetable_link,\n title: \"Timetable\"\n });\n }\n\n if (link_myunsw) {\n button_template.data.facebook.attachment.payload.buttons.push({\n type: \"web_url\",\n url: \"https://my.unsw.edu.au\",\n title: \"Manage Enrollment\"\n });\n }\n\n return button_template;\n}", "render(){\n\t\t\t\treturn <button className=\"ui button primary\">Submit</button>\n\t\t\t}", "function createMarkup () {\r\n\tvar html = '<div class=\"bpfb_actions_container\">' +\r\n\t\t'<div class=\"bpfb_toolbar_container\">' +\r\n\t\t\t'<a href=\"#cancel\" id=\"bpfb_cancel_action\"><img src=\"' + _bpfbRootUrl + '/img/system/plus.png\" border=\"0\" /></a>' +\r\n\t\t\t'&nbsp;' +\r\n\t\t\t'<a href=\"#photos\" title=\"' + l10nBpfb.add_photos + '\" id=\"bpfb_addPhotos\"><img src=\"' + _bpfbRootUrl + '/img/system/camera.png\" border=\"0\" /></a>' +\r\n\t\t\t'&nbsp;' +\r\n\t\t\t'<a href=\"#videos\" title=\"' + l10nBpfb.add_videos + '\" id=\"bpfb_addVideos\"><img src=\"' + _bpfbRootUrl + '/img/system/film.png\" border=\"0\" /></a>' +\r\n\t\t\t'&nbsp;' +\r\n\t\t\t'<a href=\"#links\" title=\"' + l10nBpfb.add_links + '\" id=\"bpfb_addLinks\"><img src=\"' + _bpfbRootUrl + '/img/system/link.png\" border=\"0\" /></a>' +\r\n\t\t'</div>' +\r\n\t\t'<div class=\"bpfb_controls_container\">' +\r\n\t\t'</div>' +\r\n\t\t'<div class=\"bpfb_preview_container\">' +\r\n\t\t'</div>' +\r\n\t\t'<div class=\"bpfb_action_container\">' +\r\n\t\t'</div>' +\r\n\t'</div>';\r\n\t$form.wrap('<div class=\"bpfb_form_container\" />');\r\n\t$textContainer.after(html);\r\n}", "render() {\n return html`\n <wired-button\n elevation=${this.elevation}\n ?disabled=${this.disabled || this.comingSoon}\n class=\"haxButton\"\n @click=\"${this._handleClick}\"\n >\n <div class=\"contents\">\n <span class=\"label\"> ${this.label} </span>\n ${this.comingSoon\n ? html`<img\n src=\"${postIt}\"\n loading=\"lazy\"\n decoding=\"async\"\n fetchpriority=\"low\"\n alt=\"Feature coming soon\"\n class=\"coming-soon\"\n />`\n : ``}\n </div>\n </wired-button>\n `;\n }", "function renderButtons() {\n\n // Deleting the famousPeople buttons prior to adding new famousPeople\n // (this is necessary otherwise you will have repeat buttons)\n $(\"#buttons-view\").empty();\n\n // Looping through the array of famousPeople\n for (var i = 0; i < famousPeople.length; i++) {\n\n // Then dynamically generate buttons for each person in the array\n // This code $(\"<button>\") is all jQuery needs to create the beginning and end tag. (<button></button>)\n var a = $(\"<button><h4>\");\n // Adding a class of person to our button\n a.addClass(\"person\");\n // Adding a data-attribute\n a.attr(\"data-name\", famousPeople[i]);\n // Providing the initial button text\n a.text(famousPeople[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n }\n }", "render() {\n return html` ${this.toolbarTemplate} `;\n }", "function renderButton() {\n gapi.signin2.render('signin2', {\n 'scope': 'profile email',\n 'width': 250,\n 'height': 40,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onSuccess,\n 'onfailure': onFailure\n });\n\n gapi.signin2.render('registrar-gmail', {\n 'scope': 'profile email',\n 'width': 250,\n 'height': 40,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onSuccess,\n 'onfailure': onFailure\n });\n}", "function getFacebookButtonTour(){\r\n\tvar buttonHTML = \"<a data-role=button data-theme='a' href='https://www.facebook.com/dialog/feed?app_id=367025673393589&\";\r\n\t\tbuttonHTML += \"link=https://developers.facebook.com/docs/reference/dialogs/&picture=http://trophyhunterfb.s3-website-eu-west-1.amazonaws.com/TrophyHunter/\";\r\n\t\tbuttonHTML += tourBadge;\r\n\t\tbuttonHTML += \"&name=Trophy Hunter&caption=\" + tourName;\r\n\t\tbuttonHTML += \"Badge&description=I just got a Bagde in Trophy Hunter, join me!\"\r\n\t\t//buttonHTML += \"&redirect_uri=https://powerful-depths-8756.herokuapp.com/'>Post on FB Wall</a> </center>\"\r\n\t\tbuttonHTML += \"&redirect_uri=https://www.facebook.com/'>Post on FB Wall</a>\"\r\n\treturn buttonHTML;\r\n}", "function renderButtons() {\n\n // Deleting the flowers prior to adding new flowers\n // (this is necessary otherwise you will have repeat buttons)\n $(\"#buttons-view\").empty();\n\n // Looping through the array of flowers\n for (var i = 0; i < flowers.length; i++) {\n\n // Then dynamicaly generating buttons for each flower in the array\n // This code $(\"<button>\") is all jQuery needs to create the beginning and end tag. (<button></button>)\n var a = $(\"<button>\");\n // Adding a class of flower to our button\n a.addClass(\"flower\");\n // Adding a data-attribute\n a.attr(\"data-flower\", flowers[i]);\n // Providing the initial button text\n // Adding the button to the buttons-view div\n a.text(flowers[i]);\n $(\"#buttons-view\").append(a);\n }\n }", "render() {\n return html ``;\n }", "function renderButtons() {\n\n // Deleting the people prior to adding new people\n // (this is necessary otherwise you will have repeat buttons)\n $(\"#buttons-view\").empty();\n\n // Looping through the array of people\n for (var i = 0; i < personArray.length; i++) {\n\n // Then dynamicaly generating buttons for each person in the array\n // This code $(\"<button>\") is all jQuery needs to create the beginning and end tag. (<button></button>)\n var a = $(\"<button>\");\n // Adding a class of person-btn to our button\n a.addClass(\"person-btn\");\n // Adding a data-attribute\n a.attr(\"data-name\", personArray[i]);\n // Providing the initial button text\n a.text(personArray[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n }\n }", "render() {\n return (\n <div id=\"fb-root\"></div>\n )\n }", "function renderButton() {\n gapi.signin2.render('my-signin2', {\n 'scope': 'profile',\n 'width': 240,\n 'height': 50,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onSuccess,\n 'onfailure': onFailure\n });\n}", "render(){return html``}", "render() {}", "render() {}", "render() {}", "function renderButtons() {\n\n // Deletes the gif prior to adding new ones\n $(\"#buttons-view\").empty();\n // Loops through the array of topics\n for (var i = 0; i < topics.length; i++) {\n\n var newButton = $(\"<button>\");\n \n newButton.addClass(\"sports\");\n \n newButton.attr(\"data-name\", topics[i]);\n \n newButton.text(topics[i]);\n // Added the button to the buttons-view div\n $(\"#buttons-view\").append(newButton);\n }\n }", "function btnRender () {\n $(\"#buttons\").empty();\n\n //For loop to generate buttons\n for (var i = 0; i < gifArray.length; i++) {\n var b = $(\"<button>\");\n b.addClass(\"btn btn-basic btn-gif\");\n b.attr(\"data-name\", gifArray[i]);\n b.text(gifArray[i]);\n $(\"#buttons\").append(b);\n }\n }", "render(){}", "render(){}", "function renderButtons() {\n\t\tcelebButtons.empty();\n\n\n\t\tfor (var i = 0; i < topics.length; i++) {\n\t\t\taddButton = $(\"<button>\");\n\t\t\taddButton.addClass(\"celebrity-button\")\n\t\t\taddButton.attr('data-name', topics[i]);\n\t\t\taddButton.removeClass('btn-success').addClass('btn-primary');\n\t\t\t$(this).addClass('btn-fancy').removeClass('btn-primary');\n\t\t\taddButton.text(topics[i]);\n\t\t\tcelebButtons.append(addButton);\n\n\t\t}\n\t}", "function renderButton(buttonLabel, pagenumber, pagecount, buttonClickCallback) {\n var $Button = $('<li ><a href=\"#\">' + buttonLabel + \"</a></li>\");\n var destPage = 1;\n // work out destination page for required button type\n switch (buttonLabel) {\n case \"first\":\n destPage = 1;\n break;\n\n case \"prev\":\n destPage = pagenumber - 1;\n break;\n\n case \"next\":\n destPage = pagenumber + 1;\n break;\n\n case \"last\":\n destPage = pagecount;\n break;\n }\n // disable and 'grey' out buttons if not needed.\n if (buttonLabel == \"first\" || buttonLabel == \"prev\") {\n $Button.find(\"a\").attr(\"page\", destPage);\n } else {\n $Button.find(\"a\").attr(\"page\", destPage);\n }\n return $Button;\n }", "render() {\n const text = this.state.followed ? 'un-follow' : 'follow';\n const label = this.state.followed ? 'Following' : 'Follow'\n return (\n <div className=\"customContainer\">\n <button className=\"btn-primary\" onClick={this.handleClick} >\n {label}</button>\n <p className={styles.followText}>\n Click to {text} this Country (must be logged in to follow)\n </p>\n </div>\n );\n }", "get buttonTemplate() {\n return this.toggles\n ? html` <button\n id=\"button\"\n aria-pressed=\"${this.isToggled ? \"true\" : \"false\"}\"\n class=\"simple-toolbar-button\"\n ?disabled=\"${this.disabled}\"\n ?controls=\"${this.controls}\"\n @click=\"${this._handleClick}\"\n @keydown=\"${this._handleKeys}\"\n @mousedown=\"${this._handleMousedown}\"\n tabindex=\"0\"\n part=\"button\"\n >\n ${this.iconTemplate} ${this.labelTemplate}\n </button>\n ${this.tooltipTemplate}`\n : html` <button\n id=\"button\"\n class=\"simple-toolbar-button\"\n ?disabled=\"${this.disabled}\"\n ?controls=\"${this.controls}\"\n @click=\"${this._handleClick}\"\n @keydown=\"${this._handleKeys}\"\n @mousedown=\"${this._handleMousedown}\"\n tabindex=\"0\"\n part=\"button\"\n >\n ${!this.icon || this.icon == \"\" ? \"\" : this.iconTemplate}\n ${this.labelTemplate}\n </button>\n ${this.showTextLabel ? \"\" : this.tooltipTemplate}`;\n }", "render() {\n return <div>{this.renderAuthButton()}</div>;\n }", "function renderButton() {\n // Clear out hook with empty\n $(\"#placeholder\").empty();\n\n for (var i = 0; i < userButtons.length; i++) {\n\n // Make new buttons\n var gifButton = $(\"<button>\");\n // Adding a class\n gifButton.addClass(\"userButtons btn btn-outline-secondary\");\n // Adding button type\n gifButton.attr(\"type\", \"button\");\n // Adding a data-attribute with a value of the gif at index i\n gifButton.attr(\"data-attribute\", userButtons[i]);\n // Providing the button's text with a value of the gif at index i\n gifButton.text(userButtons[i]);\n // Adding the button to display\n $(\"#placeholder\").append(gifButton);\n }\n}", "function renderButtons() {\n\n\t// delete the shows prior to adding new shows\n\t$(\"#buttons-view\").empty();\n\n\t// loop through the array of shows\n\tfor (var i = 0; i < shows.length; i++) {\n\n\t\t// generate a button for each show in the array\n\t\tvar scifiButton = $(\"<button>\");\n\t\t// add a class to the button\n\t\tscifiButton.addClass(\"scifiBtn\");\n\t\t// add a data-attribute\n\t\tscifiButton.attr(\"data-name\", shows[i]);\n\t\t// put button text\n\t\tscifiButton.text(shows[i]);\n\t\t// add button to the buttons-view div\n\t\t$(\"#buttons-view\").append(scifiButton);\n\t}\n}", "render() {\n\t\tvar labelText = undefined\n\t\t// optional props, and a default value if no props found \n\t\tif (this.props.greet) {\n\t\t\tlabelText = this.props.greet\n\t\t} else {\n\t\t\tlabelText = 'OK'\n\t\t}\n\t\treturn (\n\t\t\t\t<div><button>{labelText}</button></div>\n\t\t);\n\t}", "function render() {\n\n\t\t\t}", "render() {\n const classes = {\n \"mdc-fab--mini\": this.mini,\n \"mdc-fab--exited\": this.exited,\n \"mdc-fab--extended\": this.extended,\n };\n const showLabel = this.label !== \"\" && this.extended;\n return _material_mwc_base_base_element__WEBPACK_IMPORTED_MODULE_1__[\"html\"] `\n <button\n .ripple=\"${Object(_material_mwc_ripple_ripple_directive_js__WEBPACK_IMPORTED_MODULE_2__[\"ripple\"])()}\"\n class=\"mdc-fab ${Object(_material_mwc_base_base_element__WEBPACK_IMPORTED_MODULE_1__[\"classMap\"])(classes)}\"\n ?disabled=\"${this.disabled}\"\n aria-label=\"${this.label || this.icon}\"\n >\n ${showLabel && this.showIconAtEnd ? this.label : \"\"}\n ${this.icon\n ? _material_mwc_base_base_element__WEBPACK_IMPORTED_MODULE_1__[\"html\"] `\n <ha-icon .icon=${this.icon}></ha-icon>\n `\n : \"\"}\n ${showLabel && !this.showIconAtEnd ? this.label : \"\"}\n </button>\n `;\n }", "function renderButtons() {\n\n // Deleting the reaction buttons prior to adding new reaction buttons\n // (this is necessary otherwise we will have repeat buttons)\n $(\"#buttons-view\").empty();\n\n // Looping through the array of reactions\n for (var i = 0; i < reactions.length; i++) {\n\n // Then dynamicaly generating buttons for each reaction in the array.\n // This code $(\"<button>\") is all jQuery needs to create the start and end tag. (<button></button>)\n var a = $(\"<button>\");\n // Adding a class\n a.addClass(\"reaction\");\n // Adding a data-attribute with a value of the reaction at index i\n a.attr(\"data-name\", reactions[i]);\n // Providing the button's text with a value of the reaction at index i\n a.text(reactions[i]);\n // Adding the button to the HTML\n $(\"#buttons-view\").append(a);\n }\n }", "function renderCardButton() {\n\tconst target = $(SELECTOR_BUTTON_CONTAINER);\n\n\tif ($(`#${CLOCKIFY_BUTTON_ID}`) || !target) return;\n\n\tconst wrapper = document.createElement('div');\n\twrapper.className = MIRO_BUTTON_WRAPPER;\n\twrapper.id = CLOCKIFY_BUTTON_ID;\n\ttarget.insertBefore(wrapper, target.firstChild);\n\n\tclockifyButton.render(`#${CLOCKIFY_BUTTON_ID}`, {}, (elem) => {\n\t\tconst description = () => $(SELECTOR_TITLE)?.textContent;\n\t\tconst projectName = () => $(MIRO_BOARD_NAME)?.textContent;\n\t\tconst tagNames = () =>\n\t\t\tArray.from($$(SELECTOR_TAGS)).map((tag) => tag.textContent);\n\n\t\tconst link = clockifyButton.createButton({\n\t\t\tdescription,\n\t\t\tprojectName,\n\t\t\ttagNames,\n\t\t});\n\n\t\telem.append(link);\n\t});\n}", "function renderButton() {\n gapi.signin2.render('gSignIn', {\n 'scope': 'profile email https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly',\n 'width': 240,\n 'height': 50,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onLoginSuccess,\n 'onfailure': onLoginFailure\n });\n}", "function renderButtons() {\n\n // Deleting the topics prior to adding new topics\n // (this is necessary otherwise you will have repeat buttons):\n $(\"#buttons-view\").empty();\n\n // Looping through the array of topics:\n for (var i = 0; i < topics.length; i++) {\n\n // Then dynamicaly generating buttons for each topic in the array.\n // This code $(\"<button>\") is all jQuery needs to create the beginning and end tag. (<button></button>)\n var a = $(\"<button>\");\n // Adding a class of topic-btn to our button\n a.addClass(\"topic-btn\");\n // Adding a data-attribute\n a.attr(\"data-name\", topics[i]);\n // Providing the initial button text\n a.text(topics[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n }\n }", "renderNewEventBtn() {\n eventContainer.innerHTML += eventHtml.makeNewEventBtn();\n }", "render() {\n return <button onClick={this.onClick}>Emit Something!</button>;\n }", "function buttonRendering() {\n\n // Deleting the movies prior to adding new movies\n // (this is necessary otherwise we will have repeat buttons)\n $(\"#buttons-view\").empty();\n\n for (var i = 0; i < animalLists.length; i++) {\n //add a variable with new button\n var animalBtn = $(\"<button>\");\n\n animalBtn.text(animalLists[i]);\n\n animalBtn.addClass(\"animal\").attr(\"data-name\", animalLists[i]);\n\n $(\"#buttons-view\").append(animalBtn);\n\n }\n }", "function build_fb() {\n fbbutton.innerHTML = PUB.supplant( fbhtml, {\n 'count' : mehcount,\n 'people' : mehcount == 1 ? \"person doesn't\" : \"people don't\"\n } );\n}", "function renderButtons(){ \n\n\t\t// Deletes the issues prior to adding new issues (this is necessary otherwise you will have repeat buttons)\n\t\t$('#buttonsView').empty();\n\n\t\t// Loops through the array of issues\n\t\tfor (var i = 0; i < issues.length; i++){\n\n\t\t\t// Then dynamicaly generates buttons for each issue in the array\n\n\t\t\t// Note the jQUery syntax here... \n\t\t var a = $('<button>') // This code $('<button>') is all jQuery needs to create the beginning and end tag. (<button></button>)\n\t\t a.addClass('issue'); // Added a class \n\t\t a.attr('data-name', issues[i]); // Added a data-attribute\n\t\t a.text(issues[i]); // Provided the initial button text\n\t\t $('#buttonsView').append(a); // Added the button to the HTML\n\t\t}\n\t}", "function renderButton(part, pagenumber, pagecount, buttonClickCallback, htmlparts) {\n\n var buttonLabel = htmlparts[part];\n\n var $Button = $('<li class=\"pgNext\">' + buttonLabel + '</li>');\n\n var destPage = 1;\n\n // work out destination page for required button type\n switch (part) {\n case \"first\":\n destPage = 1;\n break;\n case \"prev\":\n destPage = pagenumber - 1;\n $Button = $('<li class=\"pgPrev\">' + buttonLabel + '</li>');\n break;\n case \"next\":\n destPage = pagenumber + 1;\n break;\n case \"last\":\n destPage = pagecount;\n break;\n }\n\n // disable and 'grey' out buttons if not needed.\n if (part === \"first\" || part === \"prev\") {\n pagenumber <= 1 ? $Button.addClass('pgEmpty') : $Button.click(function() { buttonClickCallback(destPage); });\n }\n else {\n pagenumber >= pagecount ? $Button.addClass('pgEmpty') : $Button.click(function() { buttonClickCallback(destPage); });\n }\n\n return $Button;\n }", "function renderButtons() {\n\t\t$(\"#buttons\").empty();\n\n\t\tfor (var i = 0; i < topics.length; i++) {\n\t\t\tvar newButton = $(\"<button class='btn btn-default fButton'>\");\n\t\t\tnewButton.attr(\"data-name\", topics[i]);\n\t\t\tnewButton.text(topics[i])\n\t\t\t$(\"#buttons\").append(newButton);\n\t\t};\n\t}", "generateSubmitButton(){\n var validity = this.state.keyValid[this.state.currKey];\n if (this.state.roundTwo) {\n if (this.state.upload !== null || this.state.processingFetch || this.state.md5Progress !== null) {\n return <Button bsStyle=\"success\" disabled><i className=\"icon icon-spin icon-circle-o-notch\"/></Button>;\n } else {\n return <Button bsStyle=\"success\" onClick={this.realPostNewContext}>Submit</Button>;\n }\n } else if (validity == 3) {\n if(this.state.processingFetch){\n return <Button bsStyle=\"success\" disabled><i className=\"icon icon-spin icon-circle-o-notch\"/></Button>;\n }else{\n return <Button bsStyle=\"success\" onClick={this.realPostNewContext}>Submit</Button>;\n }\n } else if (validity == 4) {\n return <Button bsStyle=\"success\" disabled>Submitted</Button>;\n } else {\n return <Button bsStyle=\"success\" disabled>Submit</Button>;\n }\n }", "function renderButtons() {\n // Deleting the buttons prior to adding new topics\n // (this is necessary otherwise you will have repeat buttons)\n $(\"#buttons-view\").empty();\n // Looping through the array of topics\n for (var i = 0; i < topics.length; i++) {\n // Then dynamically generating buttons for each animal in the array\n // This code $(\"<button>\") is all jQuery needs to create the beginning and end tag. (<button></button>)\n var a = $(\"<button>\");\n // Adding a class of animal to our button\n a.addClass(\"animal\");\n // Adding a data-attribute\n a.attr(\"data-name\", topics[i]);\n // Providing the initial button text\n a.text(topics[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n }\n } // end function renderButtons ", "function renderButtons() {\n\n // Delete other buttons prior to adding new ones.\n $(\"#buttonsHolder\").empty();\n\n // Loop through array of gif topics.\n for (var i = 0; i < gifTopics.length; i++) {\n // Dynamically generate buttons for each gif topic in the array with $(\"<button\").\n var topicButton = $(\"<button>\");\n\n // Add class of \"gifBtn\" to button.\n topicButton.addClass(\"gifBtn\");\n\n // Add data attribute.\n topicButton.attr(\"data-name\", gifTopics[i]);\n\n // Provide initial button text.\n topicButton.text(gifTopics[i]);\n\n // Add the button to id=\"buttonsHolder\".\n $(\"#buttonsHolder\").append(topicButton);\n }\n }", "function renderButtons() {\n\n // Deleting the buttons prior to adding new topics\n // (this is necessary otherwise you will have repeat buttons)\n $(\"#topics-container\").empty();\n\n // Looping through the array of topics\n for (var i = 0; i < topics.length; i++) {\n\n // Then dynamically generating buttons for each topic in the array\n // This code $(\"<button>\") is all jQuery needs to create the beginning and end tag. (<button></button>)\n var a = $(\"<button>\");\n // Adding a class of topic to our button\n a.addClass(\"topic\");\n a.addClass(\"btn btn-success\");\n // Adding a data-attribute\n a.attr(\"data-search-item\", topics[i]);\n // Providing the initial button text\n a.text(topics[i]);\n // Adding the button to the buttons-view div\n $(\"#topics-container\").append(a);\n }\n }", "function render() {\n\t\t\t}", "render() {\n \n return (\n <div>\n <h2>Admin Button</h2>\n {/* insert button here */}\n \n </div>\n );\n }", "function buildFacebookButton () {\n try {\n \t$(\".fb-like[fb-xfbml-state!=rendered]\").each(function(){\n\t\t\tFB.XFBML.parse(this.parentNode);\n\t\t});\n } catch (ex) {\n facebookTimeout = setTimeout(buildFacebookButton, 66);\n }\n}", "function renderButtons() {\n\n\t\t//make sure content is empty before adding buttons\n\t\t$('#button-div').empty();\n\n\t\t\t//loop through array of animals to generate buttons\n\t\t\tfor ( var i = 0; i < animals.length; i++) {\n\t\t\t\t\n\t\t\t\t//create a button\t\n\t\t\t\tvar a = $(\"<button>\");\n\n\t\t\t\t//add a class to each button\n\t\t\t\ta.addClass(\"animal\");\n\n\t\t\t\t//add a name attribute\n\t\t\t\ta.attr(\"animal-name\", animals[i]);\n\n\t\t\t\t//give each button text\n\t\t\t\ta.text(animals[i]);\n\n\t\t\t\t//append button in HTML\n\t\t\t\t$('#button-div').append(a);\n\n\t\t\t};\n\n\t\t}", "function render() {\n let html = generateHeader();\n\n if (store.error) {\n generateError();\n }\n\n // check if form displayed\n if (store.adding) {\n html += generateBookmarkForm();\n }\n\n html += generateAllBookmarkCards();\n\n $('main').html(html);\n }", "render() {\n return html`\n <a tabindex=\"-1\" href=\"${this.url}\">\n <paper-button id=\"wrapper\" role=\"link\" noink>\n ${this.icon\n ? html`\n <iron-icon icon=\"${this.icon}\"></iron-icon>\n `\n : ``}\n <span class=\"title\">${this.title}</span>\n ${this.trackIcon\n ? html`\n <iron-icon id=\"track\" icon=\"${this.trackIcon}\"></iron-icon>\n `\n : ``}\n </paper-button>\n </a>\n `;\n }", "renderUserButtons() {\n\t\t// console.log(this.props.friends);\n\t\t// console.log(this);\n\t\tvar elements = _.shuffle(this.props.friends).map((f, i) => {\n\t\t\t// console.log(this);\n\t\t\treturn <div className=\"ui button\" onClick={this.selectUser.bind(this, f)} data-friend={f} key={i}>{f.name}</div>;\n\t\t});\n\t\t// console.log(elements);\n\t\treturn (\n\t\t\t<div className=\"ui vertical compact basic inverted fluid buttons\">\n\t\t\t\t{elements}\n\t\t\t</div>\n\t\t);\n\t}", "function renderButtons() {\n\n// Deleting the buttons so they don't endlessly repeat\n\t$(\"#sport-buttons\").empty();\n\n\t// Loop through the array of sports\n\tfor (var i = 0; i < topics.length; i++) {\n\n\t\t// Creates a button\n\t\tvar a = $(\"<button>\");\n\t\t// Adding a class of movie to our button\n\t\ta.addClass(\"sport\");\n\t\t// Adding a data-attribute\n\t\ta.attr(\"data-name\", topics[i]);\n\t\t// Providing the initial button text\n\t\ta.text(topics[i]);\n\t\t// Adding the button to the buttons-view div\n\t\t$(\"#sport-buttons\").append(a);\n\t}\n}", "function renderButtons() {\r\n // Prevent repeat buttons\r\n $(\"#buttons-view\").empty();\r\n // Loop through superHeroes array\r\n for (var i = 0; i < superHeroes.length; i++) {\r\n // Assign variable to create <button> tag\r\n var hero = $(\"<a>\");\r\n // Add attributes and classes\r\n $(hero).attr(\"id\", \"hero-button\");\r\n hero.addClass(\"hero collection-item waves-effect yellow btn-medium hoverable\");\r\n $(hero).attr(\"type\", \"submit\");\r\n hero.attr(\"data-name\", superHeroes[i]);\r\n hero.text(superHeroes[i]);\r\n // Add buttons to HTML\r\n $(\"#buttons-view\").append(hero);\r\n }\r\n }", "render() {\n return this.toolbarTemplate;\n }", "function renderButtons() {\n\n // Deletes the topics prior to adding a new topic\n // (this is necessary otherwise you will have repeat buttons)\n $(\"#buttons-view\").empty();\n\n _.each(topics, function (element) {\n // Then dynamicaly generates buttons for each topic in the array\n // console.log(topics);\n var btn = $(\"<button>\");\n btn.addClass(\"btn btn-primary btn-md topic-btn\");\n btn.attr(\"data-name\", element);\n btn.text(element);\n $(\"#buttons-view\").append(btn);\n });\n }", "function renderButtons() {\n\n $(\"#buttons-view\").empty();\n\n for (i = 0; i < topics.length; i++) {\n\n var a = $(\"<button>\");\n\n a.addClass(\"topicgif\");\n\n a.attr(\"data-name\", topics[i]);\n\n a.text(topics[i]);\n\n $(\"#buttons-view\").append(a);\n }\n }", "function renderButtons () { \n\n\t\t// loops through the array of topics\n\t\tfor (var i = 0; i < topics.length; i++) {\n\n\t\t var a = $('<button>')\n\t\t a.addClass('topic button'); // add a class \n\t\t a.attr('data-name', topics[i]); // adds a data-attribute\n\t\t a.text(topics[i]); // initial button text\n\t\t $('#buttonsDiv').append(a); // add button to the HTML\n\t\t}\n\t}", "function renderButtons() {\n // Deletes the movies prior to adding new movies\n $('.buttons-view').empty();\n // Loops through the array of topics to create buttons for all topics\n for (var i = 0; i < topics.length; i++) {\n var createButtons = $('<button>');\n createButtons.addClass('topic btn btn-success');\n createButtons.attr('data-name', topics[i]);\n createButtons.text(topics[i]);\n $('.buttons-view').append(createButtons);\n }\n }", "renderHTML() {\n \n }", "function renderButtons () {\n\t\t$(\".buttons-view\").empty();\n\t\tfor (var i = 0; i < topics.length; i++) {\n\t\t\tvar newButton = $(\"<button>\");\n\t\t\tnewButton.addClass(\"topic btn btn-default\");\n\t\t\tnewButton.attr(\"data-name\", topics[i]);\n\t\t\tnewButton.text(topics[i]);\n\t\t\t$(\".buttons-view\").append(newButton);\n\t\t}\n\t}", "function renderButtons() {\n\n // Deletes the animal prior to adding new animals\n $(\"#animalButtons\").empty();\n\n // Loops through the array of animals\n for (var i = 0; i < topics.length; i++) {\n\n // Then dynamicaly generates buttons for each animal in the array\n // This code $(\"<button>\") is all jQuery needs to create the beginning and end tag. (<button></button>)\n var a = $(\"<button>\");\n\n // Adds a class of animals to our button\n a.addClass(\"animals\");\n\n // Added a data-attribute\n a.attr(\"data-name\", topics[i]);\n\n // Provided the initial button text\n a.text(topics[i]);\n\n // Added the button to the buttons-view div\n $(\"#animalButtons\").append(a);\n\n }\n }", "function Button(){\n return <button>test</button>\n}", "function renderButtons() {\n\n // Deleting the movies prior to adding new movies\n // (this is necessary otherwise you will have repeat buttons)\n $(\"#buttons-view\").empty();\n\n // Looping through the array of movies\n for (var i = 0; i < memes.length; i++) {\n\n // Then dynamicaly generating buttons for each movie in the array\n // This code $(\"<button>\") is all jQuery needs to create the beginning and end tag. (<button></button>)\n var a = $(\"<button>\");\n // Adding a class of movie to our button\n a.addClass(\"meme\");\n // Adding a data-attribute\n a.attr(\"data-name\", memes[i]);\n // Providing the initial button text\n a.text(memes[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n }\n }", "facebookButton (url) {\n return $(\"<a>\", {\n class : \"fa fa-facebook\",\n href : \"https://www.facebook.com/sharer/sharer.php?u=\" + url\n })\n }", "function renderLoginButton() {\n var loginButtonContainer = document.getElementById(\"firebaseui-auth-container\");\n var loginButtonHTML = getLoginButtonHTML();\n loginButtonContainer.innerHTML = loginButtonHTML;\n}", "render() {\n this._$buttons = this.$('input');\n this._$banner = this.$('.banner');\n\n const model = this.model;\n this.listenTo(model, 'saving destroying',\n () => this._$buttons.prop('disabled', true));\n this.listenTo(model, 'saved destroyed',\n () => this._$buttons.prop('disabled', false));\n this.listenTo(model, 'publishError', errorText => alert(errorText));\n\n this._publishButton = new RB.MenuButtonView({\n ariaMenuLabel: gettext('More publishing options'),\n el: this.$('#review-banner-publish-container'),\n id: 'review-banner-publish',\n menuItems: [\n {\n id: 'review-banner-publish-submitter-only',\n onClick: () => this._onPublishClicked({\n publishToOwnerOnly: true,\n }),\n text: _`... and only e-mail the owner`,\n },\n {\n id: 'review-banner-publish-and-archive',\n onClick: () => this._onPublishClicked({\n publishAndArchive: true,\n }),\n text: _`... and archive the review request`,\n },\n ],\n onPrimaryButtonClick: () => this._onPublishClicked(),\n text: gettext('Publish Review'),\n });\n\n this._publishButton.render();\n\n if (!this.$el.prop('hidden')) {\n this.show();\n }\n\n this.$el.addClass('ui-ready');\n\n return this;\n }", "function renderButtons() {\n\t$(\"#actor-buttons\").empty();\n\n\tfor (var i = 0; i < actors.length; i++) {\n\t\tvar button = $(\"<button>\");\n\n\t\tbutton.addClass(\"actor\");\n\t\tbutton.attr(\"data-name\", actors[i]);\n\t\tbutton.html(actors[i]);\n\t\t$(\"#actor-buttons\").append(button);\n\t}\n}", "function buttonRender() {\n\n //Make the HTML blank for future loadings of this\n buttons.html(\"\");\n\n //For animals in the btn array, create buttons\n for (let i = 0; i < btnArray.length; i++) {\n buttons.append(\"<button data-gif='\" + btnArray[i] + \"' class='btn main-btn--styles produceGifs' id='\" + btnArray[i] + \"'>\" + btnArray[i] + \"</button>\");\n }\n\n //For the items in storage loop through array\n for (let i = 0; i < fromStorage.length; i++) {\n //Set the variable storedKey = to the item in the array\n let storedKey = fromStorage[i];\n //Add one to the storage counter so the counter knows where to count from when user submits more data\n storageCounter++;\n //Push what the user had saved into an array.\n btnArray.push(storedKey);\n //Make the buttons appear in the buttons display area\n buttons.append(\"<button data-gif='\" + storedKey + \"' class='btn main-btn--styles produceGifs'id='\" + storedKey + \"'>\" + storedKey + \"</button>\");\n }\n //Clear the from storage array.\n fromStorage = [];\n }", "_render()\n {\n if (this.isDisabled())\n return;\n\n this._setContentSizeCss();\n this._setDirection();\n const paragraph = html`<p>${this.text}</p>`;\n let anchor = \"\";\n let action = \"\";\n if (this.link && this.linkText)\n anchor = html`<a href=\"${this.link}\" target=\"_blank\">${this.linkText}</a>`;\n if (this.action && this.actionText)\n action = html`${anchor ? \" | \" : \"\"}<a href=\"javascript:void(0)\" @click=${this.action}>${this.actionText}</a>`;\n let heading = \"\";\n if (this.heading)\n heading = html`<h4>${this.heading}</h4>`;\n\n render(html`${heading}${paragraph}<div id=\"links\">${anchor}${action}</div>`, this.tooltipElem);\n }", "render() {\n let msg = `\n <figure class=\"snip1336\">\n <div class=\"photo\"><img src = \"${this.image}\"></div>\n <figcaption>\n <p><strong>Name:</strong> ${this.name}</p> \n <p><strong>Surname:</strong> ${this.surename}</p>\n <p><strong>Age:</strong> ${this.age}</p>\n <p><strong>Gender:</strong> ${this.gender}</p>\n \n <button id=\"clickme\" onclick=\"document.getElementById('clickme').innerHTML=();\">like</button>\n <img id = \"hearth\" src = \"${this.LIKEimage}\"></p>\n\n <a href=\"#\"><i class=\"fa fa-twitter\"></i></a>\n <a href=\"#\"><i class=\"fa fa-facebook\"></i></a>\n <a href=\"#\"><i class=\"fa fa-instagram\"></i></a>\n <a href=\"#\"><i class=\"fa fa-linkedin\"></i></a>\n <figcaption>\n </figure>\n `; \n \n return msg;\n }", "render() {\n let msg = `\n <figure class=\"snip1336\">\n <div class=\"photo\"><img src = \"${this.image}\"></div>\n <figcaption>\n <p><strong>Name:</strong> ${this.name}</p> \n <p><strong>Surname:</strong> ${this.surename}</p>\n <p><strong>Age:</strong> ${this.age}</p>\n <p><strong>Gender:</strong> ${this.gender}</p>\n \n <button id=\"clickme\" onclick=\"document.getElementById('clickme').innerHTML=();\">like</button>\n <img id = \"hearth\" src = \"${this.LIKEimage}\"></p>\n\n <a href=\"#\"><i class=\"fa fa-twitter\"></i></a>\n <a href=\"#\"><i class=\"fa fa-facebook\"></i></a>\n <a href=\"#\"><i class=\"fa fa-instagram\"></i></a>\n <a href=\"#\"><i class=\"fa fa-linkedin\"></i></a>\n <figcaption>\n </figure>\n `; \n \n return msg;\n }", "render() {\n // Subclasses should override\n }", "static rendered () {}", "static rendered () {}", "function render() {\n\t}", "render( ) {\n return null;\n }", "renderButton() {\n if (this.props.canBookmark) {\n return (\n <Button\n onClick={(event) => this.bookmarkItem(event)}\n bsStyle=\"success\">\n Bookmark\n </Button>\n );\n }\n }", "render() {\n let msg = `\n <figure class=\"snip1336\">\n <div class=\"photo\"><img src = \"${this.image}\"></div>\n <figcaption>\n <p><strong>Name:</strong> ${this.name}</p> \n <p><strong>Surname:</strong> ${this.surename}</p>\n <p><strong>Age:</strong> ${this.age}</p>\n <p><strong>Gender:</strong> ${this.gender}</p>\n \n <button id=\"clickme\" onclick=\"document.getElementById('clickme').innerHTML=();\">like</button>\n <img id = \"hearth\" src = \"${this.LIKEimage}\"></p>\n\n <a href=\"#\"><i class=\"fa fa-twitter\"></i></a>\n <a href=\"#\"><i class=\"fa fa-facebook\"></i></a>\n <a href=\"#\"><i class=\"fa fa-instagram\"></i></a>\n <a href=\"#\"><i class=\"fa fa-linkedin\"></i></a>\n <figcaption>\n </figure>\n `; \n \n return msg;\n }", "function renderSaveThrowButton() {\n var saveThrowButton = document.createElement('input');\n saveThrowButton.setAttribute('value', 'Saving Throw');\n saveThrowButton.setAttribute('type', 'button');\n saveThrowButton.setAttribute('onclick', 'handleSaveThrow()');\n document.getElementById('saveThrowButtonContainer').appendChild(saveThrowButton);\n}", "function renderButtons() {\n //makes button div empty\n $(\"#button-view\").empty();\n //creates a button for each topic in array, adds class and attribute populate buttons in div\n for (var i = 0; i < topics.length; i++) {\n var a = $(\"<button>\");\n a.addClass(\"music-btn\");\n a.attr(\"data-music-input\", topics[i]);\n a.text(topics[i]);\n $(\"#button-view\").append(a);\n\n }\n }", "function renderButtons() {\n\n // Deletes the shows prior to adding new shows\n $(\"#buttons-all\").empty();\n\n // Loops through the array \n for (var i = 0; i < myTVShows.length; i++) {\n // variable of an empty button\n var a = $(\"<button>\");\n // Adds a class of btn btn-info to our button for bootstrap\n a.addClass(\"btn btn-primary giphy-btn\");\n // Added a data-attribute\n a.attr(\"data-name\", myTVShows[i]);\n // Added a type-attribute for bootstrap\n a.attr(\"type\", \"button\");\n // Provided the initial button text\n a.text(myTVShows[i]);\n // Added the button to the buttons-view div\n $(\"#buttons-all\").append(a);\n }\n }", "function renderButtons() {\n \n // Deleting the animals prior to adding new animals\n // (this is necessary otherwise you will have repeat buttons)\n $(\"#buttons-view\").empty();\n \n // Looping through the array of animals\n for (var i = 0; i < animals.length; i++) {\n \n // Then dynamicaly generating buttons for each animal in the array\n // This code $(\"<button>\") is all jQuery needs to create the beginning and end tag. (<button></button>)\n var a = $(\"<button>\");\n // Adding a class of animal to our button\n a.addClass(\"animal\");\n // Adding a data-attribute\n a.attr(\"data-name\", animals[i]);\n // Providing the initial button text\n a.text(animals[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n }\n }", "_render() {}", "render() {\n //Add the list of technologies that we will add in our buttons\n const technologies = ['JavaScript', 'Redux', 'litElement', 'Polymer'];\n\n return html`\n <h1>This is the AppContainer LitElement</h1>\n \n ${(this.lastTechnology.length > 0) ?\n html`<p>The last selected technology is ${this.lastTechnology}<p>` :\n html`<p>Technology never selected</p>`\n }\n\n ${\n html`<p>Total number of clicks: ${this.totalClicks}</p>`\n }\n\n <!-- \n Here we will use lit-html to execute a javascript code \n that create as many buttons as elements in our allTechnologies array\n -->\n ${technologies.map(tech => {\n return html`\n <button @click=\"${(e) => this.handleClick(e, tech)}\">${tech}</button>`;\n })}\n `;\n }", "function renderButtons() {\n\n // Deleting the buttons prior to adding new animals\n // (this is necessary otherwise you will have repeat buttons)\n $(\"#buttons-view\").empty();\n\n // Looping through the array of animals\n for (var i = 0; i < animals.length; i++) {\n\n // Then dynamicaly generating buttons for each animal in the array\n var a = $(\"<button>\");\n // Adding a class of animal to our button\n a.addClass(\"animal\");\n // Adding a data-attribute\n a.attr(\"data-name\", animals[i]);\n // Providing the initial button text\n a.text(animals[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n }\n }", "function renderButtons() {\n\t//clears the array so they don't duplicate.\n\t$(\"#topicButtons\").empty();\n\n\t//runs loop so that buttons are created for each new item in the array\n\tfor (var i=0; i< topics.length; i++) {\n\t\t$(\"<button>\").addClass(\"foods\")\n\t\t.attr(\"id\", topics[i])\n\t\t.text(topics[i])\n\t\t.appendTo(\"#topicButtons\")\n\t}\n}", "function renderButtons() {\n\t//deletes the area to prevent duplicates\n\t$(\"#buttonsArea\").empty();\n\t//loops through existing array of fluffies\n\tfor (var i = 0; i < fluffies.length; i++) {\n\t\t//dynamically generates a button for each item in fluffies array\n\t\tvar btn = $(\"<button>\");\n\t\t//adds a new class of 'newSubject' to each button\n\t\tbtn.addClass(\"newSubject\");\n\t\t//adds a data attribute to each data-name based on the item in the array\n\t\tbtn.attr(\"data-name\", fluffies[i]);\n\t\t//adds the initial button text\n\t\tbtn.text(fluffies[i]);\n\t\t// Adds the button to the button area in the html\n\t\t$(\"#buttonsArea\").append(btn);\n\t};\n}", "function renderButtons() {\n\n // Deleting the animals prior to adding new animals\n // (this is necessary otherwise you will have repeat buttons)\n \n $(\"#buttons-view\").empty();\n\n //sort array of animals alphabetically ascending\n animals.sort();\n // animals.sort(function(a, b){return b-a});\n // Looping through the array of animals\n for (var i = 0; i < animals.length; i++) {\n\n var a = $(\"<button>\");\n // Adding a class of animal to our button\n a.addClass(\"animal\");\n // Adding a data-attribute\n a.attr(\"data-name\", animals[i]);\n // Providing the initial button text\n a.text(animals[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n }\n }", "render() { }", "function render() {\n\t\t\n\t}", "function renderButtons() {\n\n \n // clears the buttons div so repeat buttons dont appear\n $(\"#buttons\").empty();\n\n // Looping through the array of cars\n for (var i = 0; i < cars.length; i++) {\n\n var btn = $(\"<button>\");\n \n btn.addClass(\"car-btn btn btn-primary\");\n \n btn.attr(\"data-name\", cars[i]);\n \n btn.text(cars[i]);\n \n $(\"#buttons\").append(btn);\n }\n }", "render() {\n\n\t}", "render() {\n\n\t}", "function renderButtons() {\n btnsPlaceHolder.empty();\n for (var i = 0; i < animals.length; i++) {\n var button = $('<button>');\n button.addClass('animal btn btn-dark btn-lg text-white m-2');\n button.attr('data-name', animals[i]);\n button.text(animals[i]);\n btnsPlaceHolder.append(button);\n }\n}", "function renderButtons() {\n // (this is necessary otherwise you will have repeat buttons)\n $(\"#buttons-view\").empty();\n\n // Looping through the array of singers\n for (var i = 0; i < topics.length; i++) {\n var a = $(\"<button>\");\n // Adding a class of singer-btn to our button\n a.addClass(\"singer-btn\");\n // Adding a data-attribute\n a.attr(\"data-name\", topics[i]);\n // Providing the initial button text\n a.text(topics[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n }\n}", "renderButtons() {\n let url = this.model.properties.url;\n\n if(url instanceof Object) {\n url = url[window.language];\n }\n\n let remoteUrl;\n let connectionId = this.model.getSettings('publishing').connectionId;\n let connection;\n\n // Construct the remote URL, if a Connection is set up for publishing\n let contentUrl = this.model.properties.url;\n\n if(connectionId) {\n connection = HashBrown.Helpers.ConnectionHelper.getConnectionByIdSync(connectionId);\n \n if(connection && connection.url && contentUrl) {\n // Language versioning\n if(contentUrl instanceof Object) {\n contentUrl = contentUrl[window.language];\n }\n\n // Construct remote URL\n if(contentUrl && contentUrl !== '//') {\n remoteUrl = connection.url + contentUrl;\n remoteUrl = remoteUrl.replace(/\\/\\//g, '/').replace(':/', '://');\n\n } else {\n contentUrl = null;\n \n }\n }\n }\n \n _.append($('.editor__footer').empty(),\n _.div({class: 'editor__footer__message'},\n _.do(() => {\n if(!connection) {\n return 'No Connection is assigned for publishing' ;\n }\n \n if(connection && !connection.url) {\n return 'No remote URL is defined in the <a href=\"#/connections/' + connection.id + '\">\"' + connection.title + '\"</a> Connection';\n }\n \n if(connection && connection.url && !contentUrl) {\n return 'Content without a URL may not be visible after publishing';\n }\n })\n ),\n\n _.div({class: 'editor__footer__buttons'},\n // JSON editor\n _.button({class: 'widget widget--button condensed embedded'},\n 'Advanced'\n ).click(() => { this.onClickAdvanced(); }),\n\n // View remote\n _.if(this.model.isPublished && remoteUrl,\n _.a({target: '_blank', href: remoteUrl, class: 'widget widget--button condensed embedded'}, 'View')\n ),\n\n _.if(!this.model.isLocked,\n // Save & publish\n _.div({class: 'widget widget-group'},\n this.$saveBtn = _.button({class: 'widget widget--button'},\n _.span({class: 'widget--button__text-default'}, 'Save'),\n _.span({class: 'widget--button__text-working'}, 'Saving')\n ).click(() => { this.onClickSave(); }),\n _.if(connection,\n _.span({class: 'widget widget--button widget-group__separator'}, '&'),\n _.select({class: 'widget widget--select'},\n _.option({value: 'publish'}, 'Publish'),\n _.option({value: 'preview'}, 'Preview'),\n _.if(this.model.isPublished, \n _.option({value: 'unpublish'}, 'Unpublish')\n ),\n _.option({value: ''}, '(No action)')\n ).val('publish')\n )\n )\n )\n )\n );\n }", "function renderButtons() {\n\n // Deleting the vacation spots prior to adding new vacation spots\n $(\"#buttons-view\").empty();\n\n // Looping through the array of locations\n for (var i = 0; i < topics.length; i++) {\n\n // Then dynamicaly generating buttons for each vacation spot in the array\n var a = $(\"<button>\");\n // Adding a class of vacation-btn to our button\n a.addClass(\"vacation-btn\");\n // Adding a spot-attribute\n a.attr(\"spot-name\", topics[i]);\n // Providing the initial button text\n a.text(topics[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n }\n }" ]
[ "0.67876446", "0.66183895", "0.65115523", "0.6486644", "0.62694186", "0.62172216", "0.62040496", "0.6116095", "0.61156315", "0.60938066", "0.6074563", "0.60638964", "0.60292774", "0.6018221", "0.60163146", "0.6011306", "0.6005098", "0.6005098", "0.6005098", "0.5994655", "0.5993987", "0.5979582", "0.5979582", "0.5976903", "0.59330493", "0.59310895", "0.592598", "0.592226", "0.5888223", "0.58860826", "0.58754814", "0.5865801", "0.58589387", "0.5849054", "0.5845252", "0.582244", "0.58199954", "0.58099747", "0.5803537", "0.57938755", "0.57896656", "0.57881665", "0.57841885", "0.5773815", "0.5755124", "0.5750224", "0.5749657", "0.574748", "0.57461846", "0.573963", "0.573493", "0.573363", "0.57131475", "0.5709025", "0.5703552", "0.5695121", "0.56915754", "0.56860757", "0.56858665", "0.568137", "0.56802076", "0.567793", "0.5674388", "0.56674963", "0.56515026", "0.56486356", "0.5645275", "0.5644215", "0.5641469", "0.56253403", "0.5620844", "0.5617528", "0.5615866", "0.56144977", "0.56144977", "0.56090707", "0.5607801", "0.5607801", "0.5606033", "0.56053007", "0.5604097", "0.5600486", "0.559785", "0.5597216", "0.5593384", "0.5591313", "0.5589516", "0.55883145", "0.55847436", "0.55828", "0.5581353", "0.5578108", "0.5576985", "0.5574581", "0.55745524", "0.5573948", "0.5573948", "0.55728287", "0.5570956", "0.5561708", "0.55616915" ]
0.0
-1
render() returns the HTML template for LandingPage
render() { return ( <div id="landing-body"> <div className="container-fluid"> <div className="row"> <div className="col-xs-10 col-xs-offset-1" id="landing-logo"> <img src={MealIoLogo} className="img-responsive center-block" alt="Meal.io logo"></img> </div> </div> <div className="row"> <div className="col-xs-10 col-xs-offset-1"> <h3 id="landing-welcome">Manage Your Meals!</h3> </div> </div> <div className="row"> <div className="col-xs-8 col-xs-offset-2"> <img src={Cycle} className="center-block" id="landing-image" alt="Meal.io feature cycle"></img> </div> </div> <div className="row"> <div className="col-xs-10 col-xs-offset-1" id="landing-inputs"> <input type="email" className="form-control input-md landing-input" id="email" placeholder="Email" /> <OverlayTrigger placement="top" overlay={tooltip}> <input type="password" className="form-control input-md landing-input" id="password" placeholder="Password" /> </OverlayTrigger> </div> </div> <div className="row" id="landing-lower"> <div className="col-xs-10 col-xs-offset-1"> <div className="btn-group btn-group-justified" id="landing-buttons-group"> <span className="group-btn"> <LoginButton/> </span> <br/> <span className="group-btn"> <SignUpButton/> </span> <br/> <span className="group-btn"> <FacebookButton/> </span> </div> </div> </div> </div> <Link to="/list"><div id="DoNotTouch"></div></Link> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "renderPage() {}", "function render() {\r\n let content = '';\r\n if (STORE.view === 'home') {\r\n $('main').html(welcomePage());\r\n }\r\n else if (STORE.view === 'question') {\r\n content = questionAsked();\r\n content += generateAnswers();\r\n content += questionAndScoreStanding();\r\n $('main').html(`<form>${content}</form>`);\r\n } else if (STORE.view === 'feedback') {\r\n answerFeedback();\r\n } else if (STORE.view === 'score') {\r\n finalScore();\r\n }\r\n}", "renderPage() {\t\t\n\t\tswitch (this.props.data.active) {\n\t\t\tcase 'user': \n\t\t\t\treturn this.renderUserInfo(this.props.data.body);\t\t\t\n\t\t\tcase 'repos': \n\t\t\t\treturn this.renderRepos(this.props.data.body);\n\t\t\tcase 'about': \n\t\t\t\treturn this.renderAbout();\t\t\t\t\t\n\t\t}\n\t}", "function Landing() {\n return(<div>This is the landing page, welcome!! CHECK OUT CAR PAGE</div>);\n}", "function renderPage() {\n\n if (STORE.view === 'start') {\n if (game1.sessionToken) {\n $('start-button').attr('disabled', false);\n }\n $('.page').html(renderStartView());\n }\n if (STORE.view === 'questions') {\n console.log('about to render');\n $('.page').html(renderQuestionView());\n }\n if (STORE.view === 'feedback' && STORE.showFeedback === true) {\n $('.page').html(renderFeedbackView());\n }\n if (STORE.view === 'results') {\n $('.page').html(renderResultsView());\n }\n}", "function render(){\n let html='';\n if (store.quizStarted === false){\n html = generateStartPage();\n }else if (store.giveFeedback === true){\n html = generateQuestionsPage();\n } else if (store.giveFeedback === false && store.questionNumber === store.questions.length -1){\n html = generateLastPage();\n }\n else {\n html= generateRightWrong();\n }\n \n $('main').html(html);\n}", "function LandingPage () {\n\n return ( // below the return will show on screen html wise, logic above^\n <div>\n <div className='frontPage-banner-container'>\n <div className='motto-container'>\n <div className='motto-inner-container'>\n <div className='motto-top'>Discover the best</div>\n <div className='motto-bottom'>EDM events today!</div>\n </div>\n </div>\n\n <img className='frontPage-Picture' src=\"https://res.cloudinary.com/dwus7ia33/image/upload/v1619758431/Electric_Nights-pictures/picture14_ultone.jpg\" alt=\"Electric Nights Logo\"/>\n {/* <img className='frontPage-Picture' src=\"https://res.cloudinary.com/dwus7ia33/image/upload/v1619758173/Electric_Nights-pictures/picture15_vlxzkm.jpg\" alt=\"Electric Nights Logo\"/> */}\n {/* <img className='frontPage-Picture' src=\"https://res.cloudinary.com/dwus7ia33/image/upload/v1619757445/Electric_Nights-pictures/Picture32_gncjds.jpg\" alt=\"Electric Nights Logo\"/> */}\n </div>\n {/* <h1>Landing page when not signed in</h1> */}\n\n <div className=''>\n <EventList />\n </div>\n </div>\n )\n}", "function renderPage() {\n // set up any necessary events\n Main.addClickEventToElement(document.getElementById(\"homeOptP\"), function () {\n Main.changeHash(Main.pageHashes.home);\n });\n Main.addClickEventToElement(document.getElementById(\"infoOptP\"), function () {\n Main.changeHash(Main.pageHashes.info);\n });\n Main.addClickEventToElement(document.getElementById(\"quizOptP\"), function () {\n Main.changeHash(Main.pageHashes.quiz);\n });\n Main.addClickEventToElement(document.getElementById(\"econ\"), function () {\n Main.sendAnalyticsEvent(\"UX\", \"click\", \"Economy\");\n _loadPlatformSection(_platformSections.economy);\n });\n Main.addClickEventToElement(document.getElementById(\"immigration\"), function () {\n Main.sendAnalyticsEvent(\"UX\", \"click\", \"Immigration\");\n _loadPlatformSection(_platformSections.immigration);\n });\n Main.addClickEventToElement(document.getElementById(\"domSoc\"), function () {\n Main.sendAnalyticsEvent(\"UX\", \"click\", \"Domestic Policy\");\n _loadPlatformSection(_platformSections.domestic);\n });\n Main.addClickEventToElement(document.getElementById(\"foreignPol\"), function () {\n Main.sendAnalyticsEvent(\"UX\", \"click\", \"Foreign Policy\");\n _loadPlatformSection(_platformSections.foreign);\n });\n\n // show page\n Main.sendPageview(Main.analyticPageTitles.platform);\n Main.showPage(Main.pageContainers.partyPlatformContainer);\n }", "function renderHomePage(context) {\n ctxHandler(context);\n\n this.loadPartials({\n header: './templates/common/header.hbs',\n footer: './templates/common/footer.hbs',\n login: './templates/welcome/login.hbs',\n register: './templates/welcome/register.hbs',\n }).then(function () {\n this.partial('./templates/welcome/welcome.hbs');\n })\n }", "function render() {\n let html = generateHeader();\n\n if (store.error) {\n generateError();\n }\n\n // check if form displayed\n if (store.adding) {\n html += generateBookmarkForm();\n }\n\n html += generateAllBookmarkCards();\n\n $('main').html(html);\n }", "function render(st = state.Home) {\n document.querySelector(\"#root\").innerHTML = `\n ${Header(st)}\n ${Nav(state.Links)}\n ${Main(st)}\n ${Footer()}\n `;\n\n router.updatePageLinks();\n addEventListeners(st);\n\n}", "render()\n {\n return template;\n }", "function renderPage () {\n var uid = null\n var loggedIn = false\n // gets the logged in user's id\n if (firebase.auth().currentUser) {\n loggedIn = true\n var uid = firebase.auth().currentUser.uid\n }\n\n // if the user is logged in as the admin, render the edit page, otherwise render the view page\n if (uid === 'vC2tBVf1R6ddzXGWJuYXRhaQyHj1') {\n // this is the function that does the actual rendering, defined in editPosts.js\n editPosts()\n } else {\n // this is the function that does the actual rendering, defined in viewPosts.js\n viewPosts()\n }\n\n navbarRender(db.selectCategory, loggedIn)\n}", "render() {\n this.configPage();\n history.pushState({ href: '/first-entrance' }, null, '/first-entrance');\n this.wrapper.append(this.main);\n\n this.main.innerHTML = firstTemplate();\n\n document.querySelector('.icon-list').classList.add('active');\n\n this.attachListeners(this.main);\n }", "render(){}", "render(){}", "function render() {\n let bigString;\n console.log('render fxn ran')\n if (store.view === 'landing') {\n bigString = generateTitleTemplate(store);\n\n }\n else if (store.view === 'question') {\n bigString = generateQuestionTemplate(store);\n\n }\n else if (store.view === 'feedback') {\n bigString = generateFeedbackTemplate(store)\n\n }\n else if (store.view === 'results') {\n bigString = generateResultsTemplate(store);\n\n }\n $('main').html(bigString);\n\n //attach event listeners\n\n\n}", "render () {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{/*Se coloca el titulo que va ha mostrar la pagina */}\n\t\t\t\t<h1>Pagina de Inicio</h1>\n\t\t\t</div>\n\t\t);\n\t}", "function renderStartPage() {\n addView(startPage());\n}", "render() {\n return (\n <h1>This is a placeholder for another page</h1>\n )\n }", "_renderMainContent () {\n switch (this.currentView) {\n case views.HOME:\n return lazyLoad(\n import('./views/view-home'),\n html`\n <view-home \n ._hasPendingChildren=\"${this._hasPendingChildren}\"\n ._pendingCount=\"${this._pendingCount}\">\n </view-home>\n `\n )\n case views.ONE:\n return lazyLoad(\n import('./views/view-one'),\n html`<view-one></view-one>`\n )\n case views.TWO:\n return lazyLoad(\n import('./views/view-two'),\n html`<view-two></view-two>`\n )\n case views.THREE:\n return lazyLoad(\n import('./views/view-three'),\n html`<view-three></view-three>`\n )\n default:\n return lazyLoad(\n import('./views/view-notfound'),\n html`<view-notfound></view-notfound>`\n )\n }\n }", "static renderPage(applicationName, renderProps, req, res) {\n const markup = ReactDOM.renderToString(<RouterContext {...renderProps} />);\n let html = fs.readFileSync(`./applications/${applicationName}/index.html`, 'utf8', (err) => {\n if (err) {\n throw err;\n }\n });\n\n html = html.replace('{{SERVER_RENDER}}', markup);\n // TODO: remove hardcoded application \"main\" when separate app build is available\n html = html.replace('{{APPLICATION_NAME}}', 'main');\n HttpHelpers.write(html, 'text/html', res);\n }", "render() {\n\t\t// preserve context\n\t\tconst _this = this;\n\n\n\t\treturn (\n\t\t\t<div>\n\t\t\t\tHome App\n\t\t\t</div>\n\t\t);\n\t}", "function renderPage() {\r\n let html = addHtml();\r\n $('main').html(html);\r\n\r\n}", "function displayHome(ctx) {\n if (!auth.isAuth()) {\n ctx.loadPartials({\n header: './templates/common/header.hbs',\n footer: './templates/common/footer.hbs',\n loginForm: './templates/forms/loginForm.hbs',\n registerForm: './templates/forms/registerForm.hbs'\n }).then(function () {\n this.partial('./templates/welcome.hbs');\n })\n } else {\n ctx.redirect('#/catalog');\n }\n }", "function drawHomePage(req, res) {\n var db = req.db;\n var collection = db.get('pageContent');\n\n var data = collection.find({}, {}, function(e, docs) {\n var homeIntro = docs[0].homeIntro;\n var homeTitle = docs[0].homeTitle;\n var usrname = loggedInUser(req);\n\n if (usrname) {\n res.render('index', { title: homeTitle,\n intro: homeIntro,\n pagename: 'index',\n loginsite: 'Logout',\n username: usrname });\n }\n else {\n res.render('index', { title: homeTitle,\n intro: homeIntro,\n pagename: 'index',\n loginsite: 'Login',\n username: usrname });\n }\n });\n}", "function renderStartPage(){\n const setHtml = generateIntro();\n $('main').html(setHtml);\n}", "function staticPage(template) {\n\treturn function(req, res) {\n\t var view = new keystone.View(req, res),\n\t locals = res.locals;\n\t // Render the view\n\t view.render(template);\t \n\t};\n}", "renderMain()\n {\n if (this.state.registering)\n {\n return this.renderRegistration();\n }\n else if(!this.state.loggedin)\n {\n return this.renderLogIn();\n }\n else\n {\n return this.renderBrowser();\n }\n }", "render() {\r\n\t\treturn (\r\n\t\t\t<div className=\"Home\">\r\n\t\t\t{this.props.isAuthenticated ? this.renderUser() : this.renderLander()}\r\n\t\t\t</div>\r\n\t\t);\r\n\t}", "render() {\n //open the portal by rendering nothing that will ever change\n return null;\n }", "static renderGlobalView() {\n GestionPages.gestionPages(\"dashboard\");\n let contenu = `\n <h5><em>Production Dashboard</em></h5>\n <div id=\"dash\">\n <div id=\"stateorders\">\n <p>State of orders</p>\n </div>\n\n <div id=\"statemachines\">\n <p>State of Machines</p>\n </div>\n\n <div id=\"statistics\">\n <p>Statistics</p>\n </div>\n </div>`;\n document.querySelector(\"#dashboard\").innerHTML = contenu;\n\n //Display page \"state of orders\"\n $(\"#stateorders\").click(event => {\n event.preventDefault();\n GestionPages.gestionPages(\"dashboard\");\n Dashboard.renderStateOrders();\n });\n\n //Display page \"state of machines\"\n $(\"#statemachines\").click(event => {\n event.preventDefault();\n GestionPages.gestionPages(\"dashboard\");\n Dashboard.renderStateMachines();\n });\n\n //Display page \"statistics\"\n $(\"#statistics\").click(event => {\n event.preventDefault();\n GestionPages.gestionPages(\"dashboard\");\n Dashboard.renderStatistics();\n });\n }", "function render_page()\n\t{\n\t\t// returns a Promise for React component.\n\t\t//\n\t\treturn render\n\t\t({\n\t\t\tdevelopment,\n\t\t\tcreate_page_element : (element, props) =>\n\t\t\t{\n\t\t\t\t// if no i18n is required, then simply create Page element\n\t\t\t\tif (!locale)\n\t\t\t\t{\n\t\t\t\t\treturn Promise.resolve(create_page_element(element, props, markup_wrapper))\n\t\t\t\t}\n\n\t\t\t\t// translation loading function must be passed\n\t\t\t\tif (!load_localized_messages)\n\t\t\t\t{\n\t\t\t\t\treturn Promise.reject(new Error(`You are supposed to pass \n\t\t\t\t\t\t\"load_localized_messages(locale) => Promise\" function \n\t\t\t\t\t\tas a parameter to client-side rendering function call\n\t\t\t\t\t\tbecause you opted into using internationalization feature`))\n\t\t\t\t}\n\n\t\t\t\t// load translations and then create page element\n\t\t\t\treturn load_localized_messages(locale).then(messages =>\n\t\t\t\t{\n\t\t\t\t\tprops.locale = locale\n\t\t\t\t\tprops.messages = messages\n\n\t\t\t\t\t// create React page element\n\t\t\t\t\treturn create_page_element(element, props, markup_wrapper)\n\t\t\t\t})\n\t\t\t},\n\t\t\tcreate_routes,\n\t\t\tto: to || document.getElementById('react_markup')\n\t\t})\n\t}", "render() {\n\t\treturn this.renderRegisterPage();\n\t}", "render(){return html``}", "render(){\n //Every render method always return HTML\n return <h1>Welcome to Myclass</h1>;\n }", "function renderLoginPage() {\n return `\n\t\t<section class=\"login-screen\" aria-live=\"assertive\">\n\t\t\t<form role=\"form\" class=\"login\">\n\t\t\t\t<fieldset name=\"login-info\">\n\t\t\t\t\t<div class=\"login-header\">\n <legend>Log In</legend>\n <hr class=\"style-two\">\n\t\t\t\t </div>\n\t\t\t\t <p id='notification'></p>\n\t\t\t\t\t<label for=\"email\" required>Email</label>\n\t\t\t\t\t<input type=\"email\" name=\"email\" id=\"email\" placeholder=\"Email address\" required>\n\t\t\t\t\t<label for=\"password\">Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"password\" id=\"password\" placeholder=\"Password\" required>\n\t\t\t\t</fieldset>\n\t\t\t\t<button type=\"submit\" class=\"js-login-button\">Login</button>\n <p>Don't have an account? <a href=\"#\" class =\"nav-signup\">Sign up</a>\n </p>\n <p id=\"demo-note\">Demo Account:\n <br>Email: [email protected]\n <br>Password: testing123</p>\n\t\t\t</form>\n\t\t</section> `;\n}", "function render(state) {\n if (state.currentPage === 'landing') {\n landingModule.render(state);\n } else if (state.currentPage === 'results') {\n // render results module\n resultsModule.render(state);\n\n }\n }", "function renderStartPage() {\r\n let startPage =\r\n `<div class=\"content\">\r\n <h2>Here you GO!!</h2>\r\n <p>Are You Ready?</p>\r\n <button id=\"start\">Get Started</button> \r\n </div>`;\r\n return startPage;\r\n}", "function render() {\n //empty existing posts from view\n $nationalparks.empty();\n\n //pass 'allParks' into template function\n var parksHtml = getAllNationalparksHtml(allParks);\n\n //append html to view\n $nationalparks.append(parksHtml);\n}", "function home(){\n\tapp.getView().render('vipinsider/insider_home.isml');\n}", "render() {\n return html ``;\n }", "function mobileLanding() {\n\tapp.getView().render('turnto/mobilelanding');\n}", "function RenderPage()\n{\n $('<div id=\"content\">' + content + \"</div>\").replaceAll(\"#content\");\n $('<div id=\"menu\">' + RenderMenu() + \"</div>\").replaceAll(\"#menu\");\n //\n $(document).foundation();\n}", "function renderLight({ request, response, nonce, initialState }) {\n /* eslint-disable no-magic-numbers */\n try {\n const html = renderPage({\n // Provide the redux store state, this will be bound to the window.APP_STATE\n // so that we can rehydrate the state on the client.\n initialState,\n\n // Nonce which allows us to safely declare inline scripts.\n nonce\n })\n response.status(200).send(html)\n } catch (error) {\n response.status(500).send(`Error during rendering: ${error}!: ${error.stack}`)\n }\n}", "render(){\n\t\treturn(\n\t\t\t<div>\n\t\t\t\t<h2> Our Current Clients Page </h2>\n\t\t\t\t<ClientLogos/>\n\t\t\t\t<ClientDescription/> \n\t\t\t</div>\n\t\t)\n\t}", "function renderHomePage(name) {\n\tres.write(\"<html><head><title>Home</title></head>\");\n\tres.write(\"<body>\")\n\tres.write(\"<h1>This is the home page</h1>\");\n\tres.write(\"<h2>Welcome \" + name + \"</h2>\");\n\tres.write(\"</body></html>\");\n\tres.end();\n\t\n}", "function RenderHome() {\n\n // Menjalankan Function HideOtherPage dengan passing paramter bernilai 'home'\n // sehingga halaman lain akan disembunyikan sedangkan halaman 'home' tidak\n HideOtherPage('home')\n\n /*\n Kali ini kita menggunakan iterasi dengan cara lain\n yaitu menggunakan iterasi 'for'. Konsepnya hampir sama\n tapi yang membuatnya beda adalah \"biasanya\" iterasi ini\n digunakan apabila variable i tidak ditambah lebih dari 1\n pada setiap putaran iterasinya.\n\n i++ itu sama dengan i += 1 yang artinya, variable i value-nya\n ditambah 1\n\n referensi: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for\n */\n // Mendeklarasikan variable html degan tipe Array yang nantinya akan kit jadikan tampilan di halaman home\n var html = []\n for (var i = 0; i < allPosts.length; i++) {\n // Membuat lebih mudah diingat dengan memasukkannya kedalam variable post\n var post = allPosts[i]\n\n // Membuat template untuk masing-masing item pada listing post di laman home\n // Kita menggunakan array supaya mudah menulisnya, daripada kita menuliskannya dengan string biasa\n var template = [\n '<a href=\"#/post/'+ post.id +'\" class=\"post-item\">',\n '<img src=\"'+ post.cover +'\" />',\n '<h2>'+ post.title +'</h2>',\n '</a>'\n ]\n\n /*\n Menyatukannya supaya tidak ada tanda koma dan bentuknya jadi String\n referensi: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join\n */\n template = template.join('')\n\n\n /*\n Memasukkan setiap template yang telah dijadikan string tadi kedalam variable array 'html'\n Untuk memasukkan variable baru ke dalam Array, salah satu metodenya adalah dengan menggunakan 'push'\n referensi: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push\n */\n html.push(template)\n }\n\n // Ini adalah contoh jika kita membuat template menggunakan string.\n // Nggak enaknya itu harus panjang, atau menambahkan tanda (+) pada setiap baris baru\n var fullTemplate = '<h1>PWA Jquery</h1><div class=\"post-list\">'+ html.join('') +'</div>'\n\n // Memasukkan HTML yang ada di dalam variable 'fullTemplate' kedalam elemen dengan id 'home'\n // referensi: https://api.jquery.com/html/\n $('#home').html(fullTemplate)\n }", "function render() {\r\n //does nothing if there is not a current error\r\n renderError();\r\n\r\n let html = '';\r\n\r\n//view state changes if user has chosen to add a new bookmark\r\n if (store.adding === true) {\r\n html = addBookmark()\r\n }\r\n //if the value of error has changed state from its initial value of null displayError will inject the msg into the html\r\n else if (store.error != null) {\r\n html = displayError()\r\n }\r\n \r\n //finally, if no errors are present the initial view of the app will render\r\n else { html = generateInitialView(generateBookmarkString) }\r\n $('main').html(html)\r\n store.filter = 0\r\n}", "function render() {\n if (store.quizStarted === false) {\n $('main').html(generateWelcome());\n return;\n }\n else if (store.questionNumber < store.questions.length) {\n let html = '';\n html = generateQuestion();\n html += generateQuestionNumberAndScore();\n $('main').html(html);\n }\n else {\n $('main').html(generateResultsScreen());\n }\n}", "async function render() {\n const page = await isomorphicRouter.resolve(location.pathname);\n if (page.redirect) {\n window.location = page.redirect;\n } else {\n document.body.innerHTML = page.content;\n if (window.location.pathname === \"/\") {\n mainPageFunction();\n } else if (window.location.pathname === \"/login\") {\n loginFunction();\n } else if (window.location.pathname === \"/register\") {\n registerFunction();\n }\n }\n}", "function renderHomePage() {\n var items = $('.cvt-report li');\n if (items) {\n items.remove();\n }\n \n var page = $('.home');\n page.addClass('visible');\n }", "function render(){ \n console.log('`render function` ran');\n const createdHtml = generateHtml(STORE); \n $('main').html(createdHtml);\n}", "renderContent() {\n if (this.state.startApp === 1 && this.state.loggedIn > -1)\n return this.checkLoginState();\n else return this.renderLogoPage(); // I will keep showing the startup image until I change the startApp value\n }", "function render() {\n\n\t\t\t}", "render() {}", "render() {}", "render() {}", "render() {\n return (\n <main role=\"main\">\n {this.userSession.isUserSignedIn() ?\n <SignedIn />\n :\n <Landing />\n }\n </main>\n );\n }", "render(){\n\n //retorna el template usando el html del tag del template, crea los elementos en el dom\n return html`\n <div>Hello Word!!</div>\n `;\n }", "render() {\n\t\t\tconst template = result(this, 'template');\n\n\t\t\tif (template instanceof HTMLTemplateElement) {\n\t\t\t\tconst root = getRoot(this);\n\n\t\t\t\t// Clone and infuse the `template` and append the resulting fragment to `root`.\n\t\t\t\troot.appendChild(infuse(this, template));\n\t\t\t}\n\t\t}", "function renderPage(page){\n switch(page){\n case menuItems[0]:\n return <AboutMe/>;\n\n case menuItems[1]:\n return <Portfolio/>;\n\n case menuItems[2]:\n return <Resume/>;\n \n // case menuItems[3]:\n // return <ContactForm/>;\n\n //***shouldnt occur but it will present About Me section\n default:\n return <AboutMe/>;\n }\n }", "render( ) {\n return null;\n }", "function renderPage(isCorrect) {\nlet html = ''\n\n if (store.quizStarted === false) {\n html = generateStartPage()\n }\n else if (isCorrect === true) {\n html = generateCorrectPage()\n }\n else if (isCorrect === false) {\n html = generateIncorrectPage()\n }\n else if (store.questionNumber === store.questions.length+1){\n html = generateEndPage()\n }\n else if (store.quizStarted === true) {\n html = generateQuestionPage()\n }\n $('main').html(html)\n}", "index(request, response) {\n const viewData = {\n title: \"Login or Signup\",\n };\n response.render(\"index\", viewData);\n }", "function render() {\n let html = '';\n\n if (questionnaire.quizStarted === false) {\n $('main').html(generateStartButton());\n \n return;\n } else if (\n questionnaire.currentQuestion >= 0 &&\n questionnaire.currentQuestion < questionnaire.questions.length\n ) {\n $(\"header\").css({ \"margin-top\": \"50px\" });\n \n html = printQuiz();\n html += printQuestion();\n $('main').html(html);\n } \n \n \n else {\n \n \n $('main').html(generateResultsScreen());\n \n \n }\n}", "function renderStartTemplate(){\r\n console.log(\"renderStartTemplate ran\")\r\n const startTemplateString = startTemplate();\r\n $('main').html(startTemplateString); \r\n}", "render() {\n var isChrome = !!window.chrome && !!window.chrome.webstore;\n return (\n <div>\n {/* { isChrome == true || this.state.isAllowBrowser ? this.renderPages() : this.renderNoBrowserSupport() } */}\n { this.renderPages() }\n </div>\n );\n\n }", "render(request, response)\n {\n const args = new Object();\n if (request.query.error) {\n args.error = errorMessages[request.query.error];\n }\n const year = new Date().getYear() + 1900;\n args.year = year;\n response.render('home', args);\n }", "render(){\n\t\tswitch(this.state.pageToShow){\n\t\t\tcase 'info':\n\t\t\t\treturn this.renderOfficeInfo();\n\t\t\tcase 'edit':\n\t\t\t\treturn (\n\t\t\t\t\t<EditOffice office = {this.state.office}\n\t\t\t\t\t\treturnToInfo= {() => this.setPageToShow('info')} \n\t\t\t\t\t\tupdateOfficeInfo = {this.updateOfficeInfo}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\tdefault:\n\t\t\t\treturn (\n\t\t\t\t\t<div>\n\t\t\t\t\t\tError: unxpected pageToShow in OfficeInfo<br/>\n\t\t\t\t\t\tpageToShow= {this.state.pageToShow}\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t}\n\t}", "function render(){\n htmlString = `<div>\n <h1>${state.pageHeader}</h1>\n ${renderDogs()}\n </div>`;\n renderDogs();\n\n appElement = document.getElementById(\"app\");\n appElement.innerHTML = htmlString;\n}", "function render() {\n //zarejdame si templeitite i im zakachame event\n ctx.partial('./templates/welcome.hbs')\n .then(attachEvents);\n }", "function showHomePage(page_name) {\n var root = $('<div>').addClass(_classes[page_name]).height(window.innerHeight);\n\n /* Title */\n //$('<figure>').append($('<img>').attr('src', 'resources/images/splash_title.png')).appendTo(root);\n /* Landing Logo */\n $('<div>').addClass('landing-logo fadeMe').appendTo(root).attr(\"style\", \"display:none\");\n /* Bottom */\n var qLandingBottom = $('<div>').addClass('landing-bottom fadeMe').attr(\"style\", \"display:none\").append($('<span>').html('Loading...'));\n qLandingBottom.appendTo(root);\n /* Loading Image */\n //$('<div>').addClass('landing-loader').append($('<img>').attr('src', 'resources/images/landig_loader.png')).appendTo(qLandingBottom);\n\n /* Google Anlytics */\n ga('send', 'screenview', {'screenName': 'Home'});\n\n return root;\n }", "function renderHome(req, res) {\n var users = Room.getRoom('').getUsernames()\n , room_state = { users: users };\n //console.log('rendering home; user is', req.user);\n\n if (_.isObject(req.user)) { \n if ( _.isString(req.query.joined_table_name) ) {\n req.user.current_table_names.push(req.query.joined_table_name);\n }\n res.render('index', _.extend(req.user, {\n title: 'Bitcoin Poker'\n , room_state: JSON.stringify(room_state)\n , user: req.user\n , message: getFlashFromReq(req)\n }));\n }\n else {\n console.log('user is not logged in. rendering welcome environment');\n res.redirect('/welcome');\n }\n}", "function displayLoginPage() {\n // create variable that holds the render login page function\n const loginPage = renderLoginPage();\n // select main page id and display html from render login page function\n $(\"#main-page\").html(loginPage);\n $(\"#email\").blur();\n // select landing page class and prop method with hidden class = true\n $(\".landing-page\").prop(\"hidden\", true);\n}", "async show() {\n // Anzuzeigenden Seiteninhalt nachladen\n let html = await fetch(\"page-overview/page-overview.html\");\n let css = await fetch(\"page-overview/page-overview.css\");\n\n if (html.ok && css.ok) {\n html = await html.text();\n css = await css.text();\n } else {\n console.error(\"Fehler beim Laden des HTML/CSS-Inhalts\");\n return;\n }\n\n // Seite zur Anzeige bringen\n let pageDom = document.createElement(\"div\");\n pageDom.innerHTML = html;\n\n this._renderBoatTiles(pageDom);\n\n this._app.setPageTitle(\"Startseite\");\n this._app.setPageCss(css);\n this._app.setPageHeader(pageDom.querySelector(\"header\"));\n this._app.setPageContent(pageDom.querySelector(\"main\"));\n }", "function render() {\n\t\t\t}", "function renderFinalPage() {\r\n let finalPage = `<div class=\"content\">\r\n <h2>Fin</h2> <img src=\"images/end-quiz.gif\" alt=\"Cars driving, split off at fork\" /><p>Your final score is ${store.score}/5... hope you are proud of yourself</p>\r\n <button id=\"restart\">Restart</button> </div>`\r\n return finalPage;\r\n}", "template() {\r\n document.querySelector(\"#app\").innerHTML += /*html*/ `\r\n <section id=\"onboarding\" class=\"page onboarding-page\">\r\n <img src=\"./media/onboarding.jpg\" alt=\"Art museum\" class=\"onboarding_img\">\r\n <div id=\"onboarding-content\">\r\n <h3 class=\"onboarding_title\">EXPLORE KüNSTE</h3>\r\n <p class=\"onboarding_text\">The KüNSTE app easily allows you to browse\r\n through the exhibitions that can be found in the museum and with the\r\n help of our museum map you are able to locate a given exhibitions\r\n within minutes.</p>\r\n <div id=\"onboarding-nav\">\r\n <button class=\"skip_btn\" onclick=\"navigateTo('home')\">SKIP</button>\r\n <div id=\"progress-dots\">\r\n <span class=\"dot_active\"></span>\r\n <span class=\"dot\" onclick=\"navigateTo('onboarding2')\"></span>\r\n <span class=\"dot\" onclick=\"navigateTo('onboarding3')\"></span>\r\n </div>\r\n <img src=\"./media/arrow-big.svg\" alt=\"arrow\" class=\"onboarding_arrow\" onclick=\"navigateTo('onboarding2')\">\r\n </div>\r\n </div>\r\n </section>\r\n `;\r\n }", "function render() {\n\n const renderedString = createRenderString(store);\n\n // insert html into DOM\n $('main').html(renderedString);\n}", "function renderPage(data, layout) {\n var {innerHtml, baseHref} = data;\n if (layouts.has(layout)) {\n innerHtml = Mustache.render(layouts.get(layout), data);\n }\n if (!innerHtml) throw new Error(\"No innerHtml for content\");\n\n if (!layouts.has('default')) throw new Error(\n `Layout 'default' not found`);\n\n const pageBody = Mustache.render(layouts.get('default'), {\n siteTitle, siteSubtitle,\n pages, posts, photos,\n innerHtml, baseHref,\n }).replace(/&#x2F;/g, '/')\n .replace(/&#x3D;/g, '=');\n return Buffer.from(pageBody, 'utf-8');\n }", "render() {\n return (\n <Ons.Page>\n {this.renderMap()}\n {this.renderBottomPane()}\n </Ons.Page>\n );\n }", "function HistoryPage (){\n\n return (\n <div id=\"wrapper\">\n\n <div>History Estamos en Login</div>\n </div>\n )\n\n\n}", "function RenderIndexPage(reqObject, resObject, loginStatus) {\n var rows = business.GetTopBookshelves(4, 1);\n for (var i = 0; i < rows.length; i++) {\n //\n // rows[i].ten_user = business.GetUsernameByIDBookshelf(rows[i].id);\n rows[i].ten_user = business.GetAccountInfo(rows[i].id).ten_user;\n rows[i].avatar_user = business.GetAccountInfo(rows[i].id).avatar;\n }\n\n\n var vm = {\n viewbook: rows,\n isLogged: loginStatus,\n }\n\n // Render view khi da login\n if (loginStatus) {\n vm.username = business.GetAccountInfo(reqObject.session.userid).ten_user;\n vm.id_user = reqObject.session.userid;\n }\n\n \n resObject.render('home/index', vm);\n //resObject.send('OK');\n}", "function homePage(req, res) {\n rivets.findAll().then(function(rivets){\n res.render('index', {rivets: rivets})\n }).catch(function(error){\n res.send(\"Couldn't fetch rivets\")\n })\n}", "function renderPage() {\n // encoding\n if ( ! $('head meta[charset]').length) {\n $('head').prepend($('<meta>').attr({ charset: 'utf-8' }));\n }\n // CSS\n $('head').append($('<link>').attr({ href: HANDOUT_SCRIPTDIR + 'handout-style.css', rel: 'stylesheet' }));\n // page title\n var title = $('head title').text();\n $('main').prepend($('<h1>').addClass('handout-title').text(title));\n // bootstrappiness\n $('nav').addClass('col-sm-2');\n $('main').addClass('container-fluid');\n if ($('main').hasClass('fullpage')) {\n var column = 'col-sm-12';\n } else if ($('main').hasClass('widepage')) {\n var column = 'col-sm-10 col-sm-offset-1';\n $('body').prepend($('<div>').addClass('margin col-sm-1'));\n } else {\n var column = 'col-sm-8 col-sm-offset-2';\n $('body').prepend($('<div>').addClass('margin col-sm-2'));\n }\n $('h1, .markdown, .with-content').addClass(column);\n // mobile\n if ( ! $('head meta[name=\"viewport\"]').length) {\n $('head').append($('<meta>').attr({ name: 'viewport', content: 'width=device-width, initial-scale=1' }));\n }\n \n var converter = makeConverter();\n \n if (window.HANDOUT_WILL_RENDER) { window.HANDOUT_WILL_RENDER(converter); }\n if (window.onHandoutWillRender) { window.onHandoutWillRender(converter); }\n \n // convert all Markdown divs\n $('.markdown:not(.converted)').each(function() {\n this.innerHTML = convertMarkdown(converter, this);\n $(this).addClass('converted');\n });\n \n var header = $('header').length ? $('header').first() : $('<header>').prependTo($('body'));\n // header link\n if ($('.table-of-contents').length) {\n header.before($('<header>').addClass('chip')\n .append($('<a>').attr('href', HANDOUT_HOME)\n .text(HANDOUT_CLASS.match(/\\S+/)[0])));\n }\n header.prepend($('<a>').attr('href', HANDOUT_HOME).text(HANDOUT_CLASS));\n // semester header\n header.append($('<div>').text(HANDOUT_SEMESTER));\n // copyright footer\n $('footer:contains(\"\\u00a9\")').addClass('col-sm-2 footer-margin').html($('<div>').html(HANDOUT_AUTHORS));\n // department footer\n $('body').append($('<footer>').text(HANDOUT_DEPARTMENT));\n // archived footer\n if (window.HANDOUT_ARCHIVED) {\n $('body').append($('<footer>').addClass('footer-archived').html(HANDOUT_ARCHIVED));\n }\n \n // identify exercises\n $(HANDOUT_EXERCISES.map(function(category) {\n return '.' + category;\n }).join(',')).addClass('exercises');\n \n var headers = [ 'h1', 'h2', 'h3' ];\n // assign IDs to all headers\n headers.forEach(function(h, idx) { // higher-level headers get cleaner IDs\n $(h).each(function() {\n if ($(this).closest('.exercises').length) { return; }\n if ( ! this.id) { this.id = uniqueIdentifier('id', '', this.textContent); }\n var div = $('<div>').attr('data-outline', this.id);\n while (this.nextSibling && ! $(this.nextSibling).is(headers.slice(0, idx+1).join(','))) {\n div.append(this.nextSibling);\n }\n $(this).after(div);\n });\n });\n \n // convert exercise blocks\n HANDOUT_EXERCISES.forEach(function(category) {\n $('.' + category + '.exercises:not(.converted)').each(function() {\n convertExercises(this, category);\n $(this).addClass('converted');\n });\n });\n $('.exercises').first().each(function() {\n if (HANDOUT_HANDX) {\n $('main').prepend($('<iframe class=\"exercises-status\">').attr('src', HANDOUT_HANDX + 'status.php'));\n }\n });\n \n // convert video links\n $('.video').first().each(function() {\n $('main').append($('<div>').addClass('video-player col-md-6 col-sm-9 col-xs-12')\n .append($('<button class=\"close video-close\">&times;</button>'))\n .append($('<div>').addClass('video-portal panel panel-default')\n .append($('<div>').addClass('video-embed embed-responsive embed-responsive-16by9'))));\n });\n $('.video').each(function() {\n var location = $(this).parents().map(function() { return $(this).data('outline'); }).get().reverse().join(',');\n var title = $('p', this).last().remove().html();\n var link = $('<a>').addClass('video-play')\n .attr('href', HANDOUT_VIDEO + location + '/' + $(this).data('video'))\n .append($('<strong>').html('&#x25B6;&#xFE0E; Play ' + title));\n $(this).replaceWith($('<div>').addClass('video-status panel panel-info')\n .append($('<div>').addClass('panel-body text-center')\n .append($(this).html())\n .append(link)));\n });\n \n // Bootstrap-ify elements that have handout-* CSS classes\n $('.handout-info').addClass('alert alert-info');\n $('.handout-solo').addClass('alert alert-warning');\n $('.handout-group').addClass('alert alert-success');\n $('.handout-due').addClass('alert alert-danger');\n $('.handout-aside-info').addClass('handout-aside panel-info');\n $('.handout-aside-solo').addClass('handout-aside panel-warning');\n $('.handout-aside-group').addClass('handout-aside panel-success');\n $('.handout-aside-due').addClass('handout-aside panel-danger');\n $('.handout-aside').each(function() {\n $(this).addClass('panel panel-default pull-right');\n var heading = $(this).children().first().remove();\n var body = $(this).wrapInner($('<div>').addClass('panel-body'));\n $(this).prepend($('<div>').addClass('panel-heading')\n .append($('<strong>').append(heading.html())));\n });\n \n // Bootstrap-ify generated HTML\n $('.alert a').addClass('alert-link');\n \n // assign IDs to marks\n $('mark').each(function() {\n this.dataset.structureText = this.dataset.markText ||\n this.textContent.match(/^[A-Z0-9_]+$/) ||\n pluralize.singular(this.textContent.toLowerCase());\n if ( ! this.id) { this.id = uniqueIdentifier('id', '^', this.dataset.structureText); }\n });\n \n // assign IDs to content chunks and create # links\n makeJumpLinks({\n jumpable: 'h1, h2, h3, h4, h5, h6, .panel-heading' +\n ($('.table-of-contents').length ? ', p, pre, ol:not(li ol), ul:not(li ul), dl, table, .exercise-part-heading' : ''),\n exclude: '.exercise-explain *, .exercise-choice *, .faq h3 + div > p:first-child',\n nest: {\n 'ol, ul': 'li',\n 'dl': 'dt',\n 'table': 'th, td',\n },\n });\n \n // build table of contents\n $('.table-of-contents').each(function() {\n var toc = $('<ul>').addClass('nav');\n $('h1, .markdown h2, .with-content h2').each(function() {\n toc.append($('<li>').append($('<a>').text(this.textContent).attr('href', '#' + this.id)));\n });\n $(this).append(toc);\n });\n \n // syntax highlight code\n if ($('code[class^=language]').length > 0) {\n hljs.initHighlighting();\n }\n \n // handle Javadoc comments\n $('.hljs.language-java .hljs-comment').filter(function() {\n return $(this).text().indexOf('/**') === 0;\n }).addClass('handout-javadoc-comment');\n \n window.handoutStructure = $('h1, .markdown h2, .with-content h2, mark, [data-structure-tag]').map(function() {\n return {\n item: this.dataset.structureTag || this.tagName.toLowerCase(),\n text: this.dataset.structureText || this.textContent,\n id: this.id,\n };\n }).toArray();\n \n if (window.HANDOUT_DID_RENDER) { window.HANDOUT_DID_RENDER(); }\n if (window.onHandoutDidRender) { window.onHandoutDidRender(); }\n}", "genPrimaryContent(page) {\n switch (page) {\n\n case 'EXPLORER':\n return (\n <Explorer\n position={this.state.position}\n getPosition={this.getPosition}\n />\n );\n\n default:\n return (\n <Welcome\n title={Texts.title}\n label={Texts.titleButtonLabel}\n onClick={this.handleAuthSubmit}\n />\n );\n }\n }", "function renderHomePage(req, res) {\n // Send the GET request. The URL is printed to the console as a curl\n // example.\n var options = {\n url: 'https://' + credentials.dedicatedHost + '/__api/sso/login',\n qs: {\n clientId: credentials.clientId,\n clientSecret: credentials.clientSecret,\n login: login\n }\n };\n request.get(options, function(err, response, bod) {\n // ensure the response has OK status\n if (err || response.statusCode !== 200) {\n return res.send(403, 'could not get token');\n }\n\n // Barc returns a JSON payload like this { 'token': 'BACF1230' }\n var token = JSON.parse(bod).token;\n\n // Set the token in your template engine and render the page\n res.type('text/html');\n res.send(compiled({dedicatedHost: credentials.dedicatedHost, token: token}));\n });\n}", "static rendered () {}", "static rendered () {}", "function render() {\n if (STORE.view === 'start') {\n renderStartQuiz();\n $('.intro').show();\n $('.quiz').hide();\n $('.result').hide();\n $('.quizStatus').hide();\n } else if (STORE.view === 'quiz') {\n renderQuestionText();\n renderQuizStatusBar();\n $('.intro').hide();\n $('.quiz').show();\n $('.result').hide();\n $('.quizStatus').show();\n } else if (STORE.view === 'questionResult') {\n renderQuestionResult();\n renderQuizStatusBar();\n $('.intro').hide();\n $('.quiz').hide();\n $('.result').show();\n $('.quizStatus').show();\n } else if (STORE.view === 'finalResult') {\n renderFinalResult();\n $('.intro').hide();\n $('.quiz').hide();\n $('.result').show();\n $('.quizStatus').hide();\n }\n }", "function renderMenu() {\n let logged = loggedin();\n showTemplate(\"menu-template\", \"menu-place\", {loggedin: logged});\n}", "RenderDeviceStartPage(){\n // Clear view\n this._DeviceConteneur.innerHTML = \"\"\n // Clear Menu Button\n this.ClearMenuButton()\n // Add Back button in settings menu\n NanoXAddMenuButtonSettings(\"Back\", \"Back\", IconModule.Back(), this.BackToStartPage.bind(this))\n \n // Boutton Electrovannes\n let ConteneurElectrovanne = NanoXBuild.DivFlexRowSpaceEvenly(null, \"ConteneurDevice Largeur\", null)\n ConteneurElectrovanne.appendChild(NanoXBuild.DivText(\"Electrovannes\", null, \"Text\", \"\"))\n ConteneurElectrovanne.onclick = this.RenderDeviceElectrovannePage.bind(this)\n this._DeviceConteneur.appendChild(ConteneurElectrovanne)\n // Boutton Scenes\n let ConteneurSecene= NanoXBuild.DivFlexRowSpaceEvenly(null, \"ConteneurDevice Largeur\", null)\n ConteneurSecene.appendChild(NanoXBuild.DivText(\"Scenes\", null, \"Text\", \"\"))\n ConteneurSecene.onclick = this.RenderDeviceScenePage.bind(this)\n this._DeviceConteneur.appendChild(ConteneurSecene)\n // Button back\n let DivButton = NanoXBuild.DivFlexRowSpaceAround(null, \"Largeur\", \"\")\n DivButton.appendChild(NanoXBuild.Button(\"Back\", this.BackToStartPage.bind(this), \"Back\", \"Button Text WidthButton1\", null))\n this._DeviceConteneur.appendChild(DivButton)\n // Espace vide\n this._DeviceConteneur.appendChild(NanoXBuild.Div(null, null, \"height: 2rem;\"))\n }", "function renderPage(req, res) {\n res.render('index', {\n pagetitle: \"Our Farm Stand\",\n announcements: req.announce,\n items: req.items,\n events: req.events,\n motd: req.motd\n });\n}", "function landingView() {\n\n // generate button ui\n let btn = UICtrl.mainMenuBtn();\n mainMenuEAL(btn.ID, btn.bStr);\n initializeTableConfig()\n // load viewport\n\n }", "render() {\n\t\tif (this.state.is_logged_in) {\n\t\t\treturn (\n\t\t\t\t<div>\n\t\t\t\t\t<div>Hello user</div>\n\t\t\t\t\t<div>Logged in</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<div>\n\t\t\t\t\t<div>Hello user</div>\n\t\t\t\t\t<div>Guest</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\t}", "render() {\n invariant(\n false,\n '<Redirect> elements are for router configuration only and should not be rendered'\n )\n }", "function renderedTemplate( date) {\n var app = document.\n}", "async show() {\n // Anzuzeigenden Seiteninhalt nachladen\n let html = await fetch(\"page-start/page-start.html\");\n let css = await fetch(\"page-start/page-start.css\");\n\n if (html.ok && css.ok) {\n html = await html.text();\n css = await css.text();\n } else {\n console.error(\"Fehler beim Laden des HTML/CSS-Inhalts\");\n return;\n }\n\n // Seite zur Anzeige bringen\n this._pageDom = document.createElement(\"div\");\n this._pageDom.innerHTML = html;\n\n await this._renderReciepts(this._pageDom);\n\n this._app.setPageTitle(\"Startseite\", {isSubPage: true});\n this._app.setPageCss(css);\n this._app.setPageHeader(this._pageDom.querySelector(\"header\"));\n this._app.setPageContent(this._pageDom.querySelector(\"main\"));\n\n this._countDown();\n }", "render() {\n//todo add component view\n return (\n <div>\n PageTest\n </div>\n );\n }", "function renderQuiz() {\n if (store.quizStarted === false) {\n $('main').html(generateStartPage());\n return;\n } else if (store.questionNumber < store.questions.length) {\n $('main').html(generateQuestionPage());\n return;\n } else {\n $('main').html(generateFinalPage());\n return;\n }\n}" ]
[ "0.68707055", "0.6841045", "0.6720703", "0.6708733", "0.66717976", "0.6656631", "0.65922856", "0.6560367", "0.6513854", "0.64429307", "0.63957644", "0.6251982", "0.6249908", "0.6225146", "0.62140197", "0.62140197", "0.61616665", "0.6135162", "0.6134993", "0.6129344", "0.6123048", "0.6119719", "0.6115621", "0.61152935", "0.6103357", "0.60507333", "0.6050047", "0.6045894", "0.60425735", "0.6005049", "0.5968489", "0.5956029", "0.5950659", "0.59476674", "0.59387755", "0.59241366", "0.59236115", "0.5921318", "0.5912722", "0.59074575", "0.5898443", "0.5887966", "0.58819675", "0.58790493", "0.58712995", "0.5870594", "0.586909", "0.5863077", "0.58602357", "0.5858055", "0.5850904", "0.58367515", "0.5836152", "0.5832287", "0.58201826", "0.58173794", "0.58173794", "0.58173794", "0.5804285", "0.579577", "0.5783067", "0.57795566", "0.57765716", "0.57673997", "0.5758576", "0.5754464", "0.57496136", "0.57446533", "0.5741045", "0.5739407", "0.5737674", "0.57370347", "0.5733292", "0.57255965", "0.5723749", "0.5721863", "0.57180536", "0.5713611", "0.5712844", "0.5708788", "0.5706187", "0.57042605", "0.570224", "0.56992304", "0.56940025", "0.56889343", "0.5688729", "0.56792873", "0.5677044", "0.5677044", "0.5673169", "0.5661715", "0.56537324", "0.5648105", "0.56427574", "0.5638822", "0.56381446", "0.5638021", "0.56369364", "0.5630524", "0.56242126" ]
0.0
-1
EBD, GLOBAL VARIABLES ....
function init() { try{ db = openDatabase('callogs', '1.0', 'Call Log Database', 2 * 1024 * 1024); db.transaction(function (transaction) { transaction.executeSql('CREATE TABLE IF NOT EXISTS logs (id INTEGER PRIMARY KEY, number TEXT, duration NUMERIC)'); //transaction.executeSql("INSERT INTO logs (number, duration) VALUES ('12345', 4000)"); }); } catch(err) { webSqlOK = false; alert("Error: this browser may not support Web SQL database: \n Database functions may not work on this browser."); } doListeners(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setGlobalVariables() {\n officeName = officeLoc[beach].name;\n beachID = officeLoc[beach].beachID;\n weatherID = officeLoc[beach].weatherID;\n officeLatCoord = officeLoc[beach].lat;\n officeLonCoord = officeLoc[beach].lon;\n transit = officeLoc[beach].transit;\n videoLetterboxed = officeLoc[beach].videoLetterboxed;\n measurements = homeOfficeInfo[0].measurements;\n\n if (measurements === english) {\n heightUnit = 'ft';\n surflineVar = 'e';\n tempUnit = 'f';\n } else if (measurements === metric) {\n heightUnit = 'm';\n surflineVar = 'm';\n tempUnit = 'c';\n }\n}", "function AccessVariableGlobally() {\n globalName=\"Block360\"\n var localVariable=\"CIE-NUST\"\n}", "function initializeGlobalVariables() {\n selectedElements = [];\n totalMoves = 0;\n totalMatchFound = 0;\n starRating = 0;\n}", "function clearGlobalsVariables(){\n\tglobalFileName = null;\n\tglobalFileContent = null;\n\tglobalFileMimeType = null;\n\tglobalFilePath = null;\n\tglobalFileExtension = null;\n}", "set UseGlobal(value) {}", "function calculateGlobalValues() {\r\n _globalViewportW = verge.viewportW(), _globalViewportH = verge.viewportH(), _globalHalfViewportH = (_globalViewportH / 2).toFixed(0)\r\n}", "Global(varName){\n // return gameState.globals[varName];\n }", "function globals() {\n\t\textend(window, {\n\t\t\tconsole: {\n\t\t\t\tlog: function() {},\n\t\t\t\tdebug: function() {},\n\t\t\t\twarn: function() {},\n\t\t\t\terror: function() {}\n\t\t\t}\n\t\t});\n\t}", "function getGlobal(e){if(!e)return e;var t=global;return each(e.split(\".\"),function(e){t=t[e]}),t}", "get UseGlobal() {}", "function TempVars() {\n}", "function initializeStatefulVariables() {\n postAction = '';\n postArgument = 'sig_response';\n host = undefined;\n sigRequest = undefined;\n duoSig = undefined;\n appSig = undefined;\n iframe = undefined;\n submitCallback = undefined;\n }", "function setupSomeGlobals() {\n // Local variable that ends up within closure\n var num = 666;\n // Store some references to functions as global variables\n gAlertNumber = function() { alert(num); }\n gIncreaseNumber = function() { num++; }\n gSetNumber = function(x) { num = x; }\n}", "function genEnv() {\n\n\n}", "function setGlobalVars() {\n\t\t\t/**\n\t\t\t * Is the mobile view being displayed\n\t\t\t */\n\t\t if( $( '#mobile-nav-icon' ).css( \"display\" ) == 'none' ) {\n\t\t \t\tmobileView = false;\n\t\t \t} else {\n\t\t\t \tmobileView = true;\n\t\t\t}\n\t\t\t\n\t\t\t/**\n\t\t\t * Toggle the mobile menu depending on whether the mobile view is being displayed.\n\t\t\t */\n\t\t\tif( mobileView ) {\n\t\t\t\t$( '#mobile-nav-dropdown' ).hide();\t\n\t\t\t} else {\n\t\t\t\t$( '#mobile-nav-dropdown' ).show();\n\t\t\t}\n\t\t}", "function createGlobals() {\n\tvar keys,\n\t\ti;\n\tkeys = Object.keys( compute );\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\twindow[ keys[i] ] = compute[ keys[i] ];\n\t}\n}", "function fun1() {\n // Assign 5 to oopsGlobal Here\n oopsGlobal = 5;\n}", "function a(){ \n console.log(w); // consult Global for x and print 20 from Global\n }", "function setGlobals() {\n const env = (global || window);\n if (!env.hasOwnProperty(\"FormData\")) {\n env.FormData = require(\"form-data\");\n }\n if (!env.hasOwnProperty(\"fetch\")) {\n env.fetch = require(\"node-fetch\");\n }\n}", "function clearGlobalVariables(){\n nextStep=\"\";\n currentEmployees=\"\";\n currentEmployeeNames=[];\n getCurrentDepartments();\n }", "function variables()\n{\n var local = 10;\n console.log(global + local);\n}", "function sharingIsCaring() {\n console.log(globalVar)\n}", "function globals() {\n\t return {\n\t range: function(start, stop, step) {\n\t if(typeof stop === 'undefined') {\n\t stop = start;\n\t start = 0;\n\t step = 1;\n\t }\n\t else if(!step) {\n\t step = 1;\n\t }\n\n\t var arr = [];\n\t var i;\n\t if (step > 0) {\n\t for (i=start; i<stop; i+=step) {\n\t arr.push(i);\n\t }\n\t } else {\n\t for (i=start; i>stop; i+=step) {\n\t arr.push(i);\n\t }\n\t }\n\t return arr;\n\t },\n\n\t // lipsum: function(n, html, min, max) {\n\t // },\n\n\t cycler: function() {\n\t return cycler(Array.prototype.slice.call(arguments));\n\t },\n\n\t joiner: function(sep) {\n\t return joiner(sep);\n\t }\n\t };\n\t}", "function parse_variables() {\n\n\t\t\t\twindow.W = W = parseFloat(localStorage.getItem('SPLITTER_W'));\n\t\t\t\twindow.B = B = parseFloat(localStorage.getItem('SPLITTER_B'));\n\t\t\t\twindow.Mf = Mf = parseFloat(localStorage.getItem('SPLITTER_MF'));\n\t\t\t\twindow.Mt = Mt = parseFloat(localStorage.getItem('SPLITTER_MT'));\t\t\t\t\n\n\t\t\t}", "function globalFunction(){\n console.log(globalVariable);\n}", "_variablesChanged() {}", "function initialisationOfVariables() {\n oilDensities = [920,1260]; /** Density value of olive oil and glycerin */\n density = oilDensities[0]; /** Density of olive oil assign to density variable */ \n oilViscocity = [0.081,1.49]; /** Viscocity of olive oil and glycerin */\n viscocity = oilViscocity[0]; /** Viscocity of olive oil assign to density variable */ \n airDensity = 1; /** Density of aire */\n dropDB = []; /** Array to store data related to each drop */\n appar_dropDB = []; /** Array to store data related to each drop in apparatus that move vertically */\n currentTime = 0;\n}", "function initGlobals(){\n\tclicked=false;\n\ttimer_3sec = 0;\n\ttimer_8sec = 0;\n\tmouse_over=false;\n\twaited_8sec_over=false;\n\twaited_8sec=false;\n\tstarted_wait_8sec = false;\n\tstarted_wait_3sec = false;\n\twaited_3sec=false;\n\tmouse_clicked = false;\n}", "function initMemVars()\n{\n params = [];\n varTable = {}; //delete and renew var table\n listElements = 0;\n currentFuncName = \"\";\n paramNumber = 0;\n numberMem = 1000;\n stringMem = 5000;\n boolMem = 8000;\n tmpNumMem = 10000;\n tmpBoolMem = 20000;\n}", "function _getCurrentVariables(){\n return [\"ina\", \"ik\", \"il\"];\n }", "function fun1(){\n // Note: Can be set without var, since within a function scoped with the function, since var is not included it is set as global scope, wont work in scrimba, but will work in browsers\n oopsGlobal = 5;\n}", "function fun1() {\n // Assign 5 to oopsGlobal Here\n oopsGlobal = 5; // this is a global variable b/c no var definition\n}", "function __loadGlobals(){\n if($rootScope.globals === void 0 || typeof $rootScope.globals == 'undefined'){\n //@todo test if we can get globals from localStorage\n $http({url:'config/server_api.json', method:'GET'})\n .then(function successCallback(response) {\n $rootScope.server_api = response.data;\n });\n }\n }", "calcVars () {}", "function _getCurrentVariables(){\n return [\"inaca\", \"ica\", \"iks\", \"ikr\", \"itof\", \"itos\", \"ik1\",\n \"ina\", \"inak\" ];\n }", "constructor() { // Las clases necesitan un constructor, en este asignaremos las variables DENTRO DEL SCOPE GLOBAL\n this.valueA = 0;\n this.valueB = 0;\n }", "function loadGlobals() {\n this.task('Load globals', () => {\n this.global = parseDataDir(this.internal.paths.globals).keyed();\n });\n}", "function _BindGlobals(){\r\n\t\t\r\n\t\tif(typeof window.$$ !== \"undefined\"){\r\n\t\t\t_Original$$ = window.$$;\r\n\t\t}\r\n\t\t\r\n\t\twindow.$$ = _Penguin;\r\n\t\twindow.Penguin = _Penguin;\r\n\t\t\r\n\t}", "function refresh_globals() {\n widget_data.global_div.innerHTML = '<h3 style=\"text-align:center;\">Global Variables</h3>';\n if(widget_data.globals !== undefined) {\n var details_div = document.createElement(\"div\");\n details_div.style.padding = \"5px\";\n Object.keys(widget_data.globals).forEach(function(key, index) {\n var p = document.createElement('p');\n p.innerHTML = `<b>${key}:</b> ${widget_data.globals[key]}`;\n details_div.appendChild(p);\n });\n widget_data.global_div.appendChild(details_div);\n }\n }", "function setGlobal(parameters) {\n\twindow[parameters.name] = parameters.value;\n}", "function initVariables() {\n enemies = [];\n Scene = this;\n eActive = 0;\n wActive = 0;\n rActive = 0;\n rCharges = 3;\n cooldown = 0;\n qCooldown = 0;\n wCooldown = 0;\n eCooldown = 0;\n rCooldown = 0;\n enemyShootCooldown = 0;\n playerSpeed = 140;\n inv = 30;\n hp = 20;\n mouseX = 0;\n mouseY = 0;\n moving = false;\n waveCount = 1;\n enemyCount = 2;\n}", "function initialisationOfVariables(scope) {\n /**array that stores different value for different environments in the dropdown */\n environment_value_Array = [9.8, 1.62, 9.01, 11.28, 25.93, 8.87, 3.70];\n\tscope.length = 5;\n\tradius_of_gyration = 25;\n\thalf_length = 50;\n\ttheta = omega = 0;\n\tupdateCount = time_since_last_step = t1 = 0;\n\tpendulum_length =r = mass = 1;\n\tgravity = 9.8;\n\tdrag = .05;\n\tscope.types_environment = 0;\n\tpendulam_drag_flag = true;\n\tpendulam_rotation_flag = false;\n\tscope.dropdown_disable = false;\n\tscope.result_disable = true;\n\tpause_flag = false;\n}", "function setVariables() {\n var vars = new Array();\n mRoot.infoVariables.forEach(function (variable) {\n var _var = {\n name: variable.name,\n type: variable.type,\n value: variable.value\n };\n vars.push(_var);\n });\n return vars;\n}", "resetVars() {\r\n this._current = undefined;\r\n this._nextRevisionNr = exports.INITIAL_REVISION_NEXT_NR;\r\n }", "function global_setup() {\n\t// don't use i, because global value conlicts with test runner\n\tfor(xyz = 0; xyz < 10; xyz++) {\n\t\tfoo->();\n\t}\n\ttrace(xyz);\n}", "function BOT_inspectGlobalVar() {\r\n\tvar e = document.getElementById(\"javascriptoutput\");\r\n\tvar s = \"\";\r\n\tvar v;\r\n\tfor (var i in BOT_theGlobalVarList) {\r\n\t\tv = BOT_theGlobalVarList[i];\r\n\t\ts = s + v + \" = \" + ((eval(v) == undefined) ? \"undefined\" : eval(v)) + \"\\n\\n\";\r\n\t}\r\n\tif(e) e.value = s;\r\n}", "function setupGlobals(secrets) {\n SECRET_KEY = secrets.secretKey;\n CLIENT_ID = secrets.clientId;\n REDIRECT_URI = secrets.redirectUri;\n}", "function globals() {\n return {\n range: function range(start, stop, step) {\n if (typeof stop === 'undefined') {\n stop = start;\n start = 0;\n step = 1;\n } else if (!step) {\n step = 1;\n }\n\n var arr = [];\n\n if (step > 0) {\n for (var i = start; i < stop; i += step) {\n arr.push(i);\n }\n } else {\n for (var _i = start; _i > stop; _i += step) {\n // eslint-disable-line for-direction\n arr.push(_i);\n }\n }\n\n return arr;\n },\n cycler: function cycler() {\n return _cycler(Array.prototype.slice.call(arguments));\n },\n joiner: function joiner(sep) {\n return _joiner(sep);\n }\n };\n}", "get global() {\n return globals;\n }", "global(name, value) {\n this.GLOBALS[name] = value;\n return this;\n }", "function _getCurrentVariables(){\n\t\treturn [\"ik1\",\"inaca\",\"inak\",\"icab\",\"inab\",\"ina\",\"ica\",\"ito\",\"ikr\",\"iks\"];\n\t}", "function initGlobal(){\n\n\t//\n\t// START TIMER\n\tif($('message_time_wrapper')) {\n\t\tstartCount();\n\t}\n}", "function getGlobalMembers() {\n // The names array contains the names of everything that is inside \"p.\"\n // When something new is added to \"p.\" it must also be added to this list.\n var names = [ /* this code is generated by jsglobals.js */\n \"abs\", \"acos\", \"alpha\", \"ambient\", \"ambientLight\", \"append\", \"applyMatrix\",\n \"arc\", \"arrayCopy\", \"asin\", \"atan\", \"atan2\", \"background\", \"beginCamera\",\n \"beginDraw\", \"beginShape\", \"bezier\", \"bezierDetail\", \"bezierPoint\",\n \"bezierTangent\", \"bezierVertex\", \"binary\", \"blend\", \"blendColor\",\n \"blit_resize\", \"blue\", \"box\", \"breakShape\", \"brightness\",\n \"camera\", \"ceil\", \"Character\", \"color\", \"colorMode\",\n \"concat\", \"constrain\", \"copy\", \"cos\", \"createFont\",\n \"createGraphics\", \"createImage\", \"cursor\", \"curve\", \"curveDetail\",\n \"curvePoint\", \"curveTangent\", \"curveTightness\", \"curveVertex\", \"day\",\n \"degrees\", \"directionalLight\", \"disableContextMenu\",\n \"dist\", \"draw\", \"ellipse\", \"ellipseMode\", \"emissive\", \"enableContextMenu\",\n \"endCamera\", \"endDraw\", \"endShape\", \"exit\", \"exp\", \"expand\", \"externals\",\n \"fill\", \"filter\", \"floor\", \"focused\", \"frameCount\", \"frameRate\", \"frustum\",\n \"get\", \"glyphLook\", \"glyphTable\", \"green\", \"height\", \"hex\", \"hint\", \"hour\",\n \"hue\", \"image\", \"imageMode\", \"intersect\", \"join\", \"key\",\n \"keyCode\", \"keyPressed\", \"keyReleased\", \"keyTyped\", \"lerp\", \"lerpColor\",\n \"lightFalloff\", \"lights\", \"lightSpecular\", \"line\", \"link\", \"loadBytes\",\n \"loadFont\", \"loadGlyphs\", \"loadImage\", \"loadPixels\", \"loadShape\", \"loadXML\",\n \"loadStrings\", \"log\", \"loop\", \"mag\", \"map\", \"match\", \"matchAll\", \"max\",\n \"millis\", \"min\", \"minute\", \"mix\", \"modelX\", \"modelY\", \"modelZ\", \"modes\",\n \"month\", \"mouseButton\", \"mouseClicked\", \"mouseDragged\", \"mouseMoved\",\n \"mouseOut\", \"mouseOver\", \"mousePressed\", \"mouseReleased\", \"mouseScroll\",\n \"mouseScrolled\", \"mouseX\", \"mouseY\", \"name\", \"nf\", \"nfc\", \"nfp\", \"nfs\",\n \"noCursor\", \"noFill\", \"noise\", \"noiseDetail\", \"noiseSeed\", \"noLights\",\n \"noLoop\", \"norm\", \"normal\", \"noSmooth\", \"noStroke\", \"noTint\", \"ortho\",\n \"param\", \"parseBoolean\", \"parseByte\", \"parseChar\", \"parseFloat\",\n \"parseInt\", \"peg\", \"perspective\", \"PImage\", \"pixels\", \"PMatrix2D\",\n \"PMatrix3D\", \"PMatrixStack\", \"pmouseX\", \"pmouseY\", \"point\",\n \"pointLight\", \"popMatrix\", \"popStyle\", \"pow\", \"print\", \"printCamera\",\n \"println\", \"printMatrix\", \"printProjection\", \"PShape\", \"PShapeSVG\",\n \"pushMatrix\", \"pushStyle\", \"quad\", \"radians\", \"random\", \"randomGaussian\",\n \"randomSeed\", \"rect\", \"rectMode\", \"red\", \"redraw\", \"requestImage\",\n \"resetMatrix\", \"reverse\", \"rotate\", \"rotateX\", \"rotateY\", \"rotateZ\",\n \"round\", \"saturation\", \"save\", \"saveFrame\", \"saveStrings\", \"scale\",\n \"screenX\", \"screenY\", \"screenZ\", \"second\", \"set\", \"setup\", \"shape\",\n \"shapeMode\", \"shared\", \"shearX\", \"shearY\", \"shininess\", \"shorten\", \"sin\", \"size\", \"smooth\",\n \"sort\", \"specular\", \"sphere\", \"sphereDetail\", \"splice\", \"split\",\n \"splitTokens\", \"spotLight\", \"sq\", \"sqrt\", \"status\", \"str\", \"stroke\",\n \"strokeCap\", \"strokeJoin\", \"strokeWeight\", \"subset\", \"tan\", \"text\",\n \"textAlign\", \"textAscent\", \"textDescent\", \"textFont\", \"textLeading\",\n \"textMode\", \"textSize\", \"texture\", \"textureMode\", \"textWidth\", \"tint\", \"toImageData\",\n \"touchCancel\", \"touchEnd\", \"touchMove\", \"touchStart\", \"translate\", \"transform\",\n \"triangle\", \"trim\", \"unbinary\", \"unhex\", \"updatePixels\", \"use3DContext\",\n \"vertex\", \"width\", \"XMLElement\", \"XML\", \"year\", \"__contains\", \"__equals\",\n \"__equalsIgnoreCase\", \"__frameRate\", \"__hashCode\", \"__int_cast\",\n \"__instanceof\", \"__keyPressed\", \"__mousePressed\", \"__printStackTrace\",\n \"__replace\", \"__replaceAll\", \"__replaceFirst\", \"__toCharArray\", \"__split\",\n \"__codePointAt\", \"__startsWith\", \"__endsWith\", \"__matches\"];\n\n // custom functions and properties are added here\n if(aFunctions) {\n Object.keys(aFunctions).forEach(function(name) {\n names.push(name);\n });\n }\n\n // custom libraries that were attached to Processing\n var members = {};\n var i, l;\n for (i = 0, l = names.length; i < l ; ++i) {\n members[names[i]] = null;\n }\n for (var lib in Processing.lib) {\n if (Processing.lib.hasOwnProperty(lib)) {\n if (Processing.lib[lib].exports) {\n var exportedNames = Processing.lib[lib].exports;\n for (i = 0, l = exportedNames.length; i < l; ++i) {\n members[exportedNames[i]] = null;\n }\n }\n }\n }\n return members;\n }", "function defineVars(){\n isFirstMove = true;\n isFinished = false;\n currColor = \"#ff0000\";\n initHex = 0xFF0000;\n numberMovement = n + 1;\n round = 0;\n side = 0;\n repCounter = 0;\n defineMatrix();\n}", "function _updateGlobals() {\n let globalVars = last(globalsToUseStack);\n for (let obj of allGlobalsRequested) {\n for (let key of Object.keys(obj)) {\n obj[key] = globalVars[key];\n }\n }\n}", "function refreshLocVariables(){\n\ttargetPoint = false;\n\ttempTin=false;\n\ttin=false;\n\tnearest=false;\n\tnearest_turf=false;\n\tbuffered=false;\n\tptsWithin=false;\n\tmyPoint=false;\n\tcoords_x = []; //define an array to store the lng coordinate\n\tcoords_y = []; //define an array to store the lat coordinate\n\tcoords_z = []; //define an array to store elev coordinate\n\tkeyLocLocation = false;\n}", "function _____SHARED_functions_____(){}", "function initGlobals() {\n docHeight = document.body.clientHeight;\n docWidth = document.body.clientWidth;\n images = getImages();\n flapNoise = new Audio(\"src/flap.mp3\");\n birdImage = images.bird;\n}", "function declareVariables() {\n ball = doc.getElementById('ball');\n field_dimensions = doc.getElementById('game_field').getBoundingClientRect();\n mice = doc.getElementsByClassName('mouse'); //get all \"mice\" elements\n yv = [-5.57,-5.12,-4.67];\n xvel = 3.6;\n yacc = 0.05;\n setup();\n}", "getGlobals(...args){\n\n let [allBugs,\n allGems,\n allRocks,\n allKeys,\n life,\n gemCounter,\n keyCounter,\n player] = args;\n\n return {allBugs, allGems, allRocks, allKeys, life, gemCounter, keyCounter, player};\n }", "function init(){\n /* Allow the browser to process other tasks */\n TASK_BREAK_TIME_MS = 128;\n /* Time to process the tasks for */\n TASK_PROCESS_TIME_MS = 256;\n /* Record progress completion */\n tasksScanned = 0;\n tasksCompleted = 0;\n /* The overall task stack */\n taskStack = [];\n /* The variable stack */\n varStack = [];\n /* Set tab space size */\n TAB_MAX = 4;\n}", "function caml_register_global (n, v) { caml_global_data[n + 1] = v; }", "function allVariablesInfo() {\n\t\tconsole.log(\"------ ALL VARIABLE DUMP ------\");\n\t\tconsole.log(\"intervalId: \" + intervalId);\n\t\tconsole.log(\"cardsArray: \" + cardsArray);\n\t\tconsole.log(\"urlArray: \" + urlArray);\n\t\tconsole.log(\"indexArray: \" + indexArray);\n\t\tconsole.log(\"userName: \" + userName);\n\t\tconsole.log(\"userCountry: \" + userCountry);\n\t\tconsole.log(\"userCountryFlag: \" + userCountryFlag);\n\t\tconsole.log(\"mode: \" + mode);\n\t\tconsole.log(\"firstPick: \" + firstPick);\n\t\tconsole.log(\"secondPick: \" + secondPick);\n\t\tconsole.log(\"pairs: \" + pairs);\n\t\tconsole.log(\"tries: \" + tries);\n\t\tconsole.log(\"timeToBeat: \" + timeToBeat);\n\t\tconsole.log(\"time: \" + time);\n\t\tconsole.log(\"timeUsed: \" + timeUsed);\n\t\tconsole.log(\"level: \" + level);\n\t\tconsole.log(\"pairsMatched: \" + pairsMatched);\n\t\tconsole.log(\"overallTime: \" + overallTime);\n\t\tconsole.log(\"overallTries: \" + overallTries);\n\t\tconsole.log(\"timer: \" + timer);\n\t\tconsole.log(\"challenge: \" + challenge);\n\t\tconsole.log(\"finishGame: \" + finishGame);\n\t\tconsole.log(\"-------------------------------\");\n\t}", "function global(){\n console.log(this);\n this.myNumber = 20;\n}", "function globalize(env){\n\tif( !env){\n\t\tenv= require( \".\")\n\t}\n\tfor( var i in env){\n\t\tglobal[ i]= env[i]\n\t}\n\treturn global\n}", "function getglobalsettings() {\r\r\n // get these/set from local storage when loading the any page\r\r\n coinpricearray = getitem('coinpricearray', []); // TES coinlist. refreshed on successful api call\r\r\n global_num = getitem('global_num', \"100\"); // how many in total to load?\r\r\n global_smallnum = getitem('global_smallnum', \"10\"); // load top '10's\r\r\n global_interval = getitem('global_interval', \"300000\"); //5mins in miliseconds\r\r\n global_icons = getitem('global_icons', \"1\"); // show icons in (use -1 for false)\r\r\n global_allicons = getitem('global_allicons', \"1\"); // show icons everywhere\r\r\n global_numindex = getitem('global_numindex', \"10\"); // index, how many coins to count in summary\r\r\n global_tickerurl = getitem('global_tickerurl', \"https://api.coinmarketcap.com/v1/ticker/?limit=\"); + global_num; // watchlist\r\r\n\r\r\n // defaultwatchlist = [\"BTC\", \"ETH\", \"BCH\", \"XRP\", \"LTC\"] // top 5 by market cap\r\r\n global_coinlist = getitem('global_coinlist', [\"BTC\", \"ETH\", \"BCH\", \"XRP\", \"LTC\"]); // default watchlist (note: Object) \r\r\n\r\r\n global_currency = getitem('global_currency', \"USD\"); // not used yet.\r\r\n\r\r\n}", "function overwriteGlobalVariable(){\n // Oops, I accidentally used the same name as a global\n var globalVariable='function-value';\n // Where did my global value go?!\n console.log(globalVariable);\n}", "function PrefGlobal()\n{\n this.networks = new Object();\n this.commandManager = new Object();\n this.commandManager.defineCommand = function() {};\n this.commandManager.removeCommand = function() {};\n this.entities = new Object();\n this.hostCompat = new Object();\n}", "function _main() {\n window.tools = {} || window.tools;\n window.tools.log = _log;\n }", "function h() {\n console.log(CONST_VAR);\n}", "function setParams() {\r\n \r\n for(Entry<String,Double> e : body.metabolicParameters.get(body.bodyState.state).get(BodyOrgan.BRAIN.value).entrySet()) {\r\n switch (e.getKey()) {\r\n case \"glucoseOxidized_\" : { glucoseOxidized_ = e.getValue(); break; }\r\n case \"glucoseToAlanine_\" : { glucoseToAlanine_ = e.getValue(); break; }\r\n case \"bAAToGlutamine_\" : { bAAToGlutamine_ = e.getValue(); break; }\r\n }\r\n }\r\n //System.out.println(\"glucoseOxidized: \" + glucoseOxidized_);\r\n }", "function initializeVariables() {\n $window = $(window);\n\n $pageHead = $(\"#pageHead\");\n\n $storyFrame = $(\"#storyFrame\");\n storyFrame = $storyFrame[0];\n\n $backArrow = $(\"#backArrow\");\n $nextArrow = $(\"#nextArrow\");\n\n newtabLink = $(\"#newtabLink\")[0];\n\n $slideDropdown = $(\"#slideDropdown\");\n slideDropdown = $slideDropdown[0];\n\n $slideTotal = $(\"#slideTotal\");\n}", "function main_loadfiles_readvar(){ //re-loads variables that require g.module_lang.current - in case user changes language from default\n /**\n Lists the keys from {@link module:g.medical_headerlist} that require custom parsing (eg. translate numbers into words).<br>\n Each element in the object is coded in the following way:\n <pre>*key_in_dashboard*: {*category1_in_medicaldata*: '*user-readable_output1*', *category2_in_medicaldata*: '*user-readable_output2*', ...},</pre>\n * @constant\n * @type {Object.<String, Object>} \n * @alias module:g.medical_read\n * @todo Why is it in a function?\n */\n g.medical_read = {\n fyo: {\n u:g.module_lang.text[g.module_lang.current].chart_fyo_labelu,\n o:g.module_lang.text[g.module_lang.current].chart_fyo_labelo,\n a:g.module_lang.text[g.module_lang.current].chart_fyo_labela}, \n };\n}", "function addToGlobal(name, value) {\n globalData[name] = value;\n }", "function VariableModule(self) {\n that = self;\n o = self.o;\n va = self.va;\n is = self.is;\n M = self.M;\n }", "function initGlobals (boxSize) {\n\thwTreeHeight = 0.85*boxSize;\n\thwTreeRadius = 0.03*boxSize;\n\thwTree = makeHWTree(hwTreeHeight, hwTreeRadius, \"forest_bark\", \"forest_bark\", \"leaf_fern_light\");\n}", "function loadPageVariables() {\r\n \"use strict\";\r\n var tmp = JSON.parse(localStorage.getItem('TrimpzSettings'));\r\n if (tmp !== null) {\r\n trimpzSettings = tmp;\r\n }\r\n}", "function init_environ() {\n //my_log(\"Here here: initing environ\");\n var pw = page_worker.Page({\n\t contentScriptFile: [\n\t\t\t\tdata.url(\"thirdparty/voodoo1/voodoo.js\"),\n\t\t\t\tdata.url(\"get_environ.js\")\n\t\t\t\t]\n\t});\n \n pw.port.on(\"got_environ\", function(rc) {\n\t environ = object.extend(environ, rc);\n\t my_log(\"Here here: callback for pg worker, voodoo: \" + JSON.stringify(environ), new Error);\n\t pw.destroy();\n\t \n\t // BIG EXECUTION START\n\t vault_read();\n\t vault_init();\n\t});\n}", "function getvars(val) {\nvar out=all[val];\nall[val]=false;\n\treturn out;\n}", "function arkGlobal() {\n $.get(\"/arkGlobal\", function(data) {\n wishes = data;\n getGlobal();\n });\n }", "function initialisationOfVariables() {\n CENTER_X = 350; /** Horizontal center point of canvas */\n CENTER_Y = 350; /** Vertical enter point of canvas */\n INITIAL_ROT_TOP = -8;\n INITIAL_ROT_BOTTOM = 172;\n PX_UNIT = 4; /** Here 0.5 degree is considered as 2px */\n DEGREE_UNIT = 0.5; /** 0.5 considered as basic degree unit for line spectram */\n current_angle = 90;\n current_fine_angle = 0;\n current_vernier_angle = 0;\n min_max_limit = false;\n hit_flag=false;/** Hit telescope */\n \n}", "shareGlobalVars() {\r\n this.addGlobal('appDiskRoot', electron_1.remote.getGlobal('appDiskRoot'));\r\n this.addGlobal('appCodeRoot', electron_1.remote.getGlobal('appCodeRoot'));\r\n this.addGlobal('webRoot', electron_1.remote.getGlobal('webRoot'));\r\n this.addGlobal('packMode', this._mainApp.options.packMode);\r\n this.addGlobal('isDebug', this._mainApp.isDebug);\r\n this.addGlobal('windowName', this._parentWindow.name);\r\n return this;\r\n }", "function initializeVariables() {\n\t\trandomScore = 19 + Math.floor(Math.random() * 102);\n\t\tgemOneValue = 1 + Math.floor(Math.random() * 12);\n\t\tgemTwoValue = 1 + Math.floor(Math.random() * 12);\n\t\tgemThreeValue = 1 + Math.floor(Math.random() * 12);\n\t\tgemFourValue = 1 + Math.floor(Math.random() * 12);\n\t\tuserRoundScore = 0;\n\t\t\n\t// update the html for the game board\n\t\t$(\"#winsTotal\").html(\"Wins: \" + wins);\n\t\t$(\"#lossesTotal\").html(\"Losses: \" + losses);\n\t\t$(\"#randomNumber\").html(randomScore);\n\t\t$(\"#userTotal\").html(userRoundScore);\n\t}", "function weatherVar(){\n //City Name\n cityName = weather.name;\n //Country Code\n country = weather.sys.country;\n //Weather ID\n weatherId = weather.weather[0].id;\n weatherDescription = weather.weather[0].description;\n //Temperature\n temp = round(weather.main.temp);\n //Get data based on last weather update\n epochUpdate = weather.dt;\n //Type of clouds\n Cloudiness = weather.clouds.all;\n //Wind Speed\n windSpeed = weather.wind.speed;\n windRatio = windSpeed / 200;\n windDegrees = weather.wind.deg;\n //Visibility & Humidity\n visibility = map(weather.visibility, 0, 10000, 0, 255);\n humidity = weather.main.humidity;\n}", "function setGlobals( words ) {\n let i = 0;\n\n while (i < words.length) {\n i++;\n switch(words[i]) {\n case 'background': {\n let r, g, b;\n i++;\n r = parseInt( words[i]); i++;\n g = parseInt( words[i]); i++;\n b = parseInt( words[i]);\n let c = new Color(r,g,b);\n let hexvalue = c.getHex();\n canvas.style.background = hexvalue;\n e_gColor.value = hexvalue;\n break;\n }\n case 'newtons':\n i++;\n e_gNewtons.value = words[i];\n break;\n case 'angle':\n i++;\n e_gAngle.value = words[i];\n break;\n case 'accel':\n i++;\n e_gAccel.value = words[i];\n break;\n case 'random_newtons':\n i++;\n e_gRandom_newtons.checked = words[i]==\"true\"?true:false;\n break;\n case 'random_angle':\n i++;\n e_gRandom_angle.checked = words[i]==\"true\"?true:false;\n break;\n case 'fade':\n i++;\n e_gFadeAll.checked = words[i]==\"true\"?true:false;\n break;\n }\n }\n}", "_setGlobal() {\n if (this.config.setGlobal) {\n window.__ = this.__.bind(this);\n }\n }", "function setup_variables() {\r\n helper_modes = new Array();\r\n\r\n // helper mode name, converted row visibility, tag visibility, nocue font weight, hascue font weight, nocuerow visibility\r\n new_helper_mode(\"Off\",\"\",\"none\",\"\",\"\");\r\n new_helper_mode(\"Show All[N] Cueless[N]\",\"none\",\"inline\",\"bold\",\"bold\",\"none\");\r\n new_helper_mode(\"Show All[N] Cueless[Y]\",\"none\",\"inline\",\"bold\",\"bold\",\"\");\r\n new_helper_mode(\"Show All[Y] Cueless[Y]\",\"\",\"\",\"bold\",\"bold\",\"\");\r\n\r\n // tags to hide\r\n filter.push(\"staff.picks\");\r\n}", "function hello(){\n var mundo = 'mundo';\n }", "function gatherEnv() {\n addSetting('Processors', os.cpus().length)\n addSetting('OS', os.type())\n addSetting('OS version', os.release())\n addSetting('Node.js version', process.version)\n addSetting('Architecture', process.arch)\n\n if ('NODE_ENV' in process.env) {\n addSetting('NODE_ENV', process.env.NODE_ENV)\n }\n}", "ensureConfig() {\n if (!window[Const.GLOBAL]) {\n var config = {\n guid: '',\n initialized: false,\n resolution: window.devicePixelRatio >= 2 ? 2 : 1,\n callbacks: [],\n [Const.COUNT.BUTTON]: 0,\n [Const.COUNT.FOLLOW]: 0,\n [Const.COUNT.PIN_SMALL]: 0,\n [Const.COUNT.PIN_MEDIUM]: 0,\n [Const.COUNT.PIN_LARGE]: 0,\n [Const.COUNT.PROFILE]: 0,\n [Const.COUNT.BOARD]: 0\n };\n for (var i = 0; i < 12; i++) {\n config.guid += Const.GUID_VARS.substr(Math.floor(Math.random() * 60), 1);\n }\n window[Const.GLOBAL] = config;\n }\n this.config = window[Const.GLOBAL];\n }", "loadGlobals() {\n // TODO: Make Private\n log('Loading Global Commands...');\n this.loadDirectory(path.join(__dirname, 'global/commands'), true);\n log('Loading Global Plugins...');\n this.loadDirectory(path.join(__dirname, 'global/plugins'), true);\n }", "function variables() {\n // Declares a variable where the value cannot be changed\n const DAYS_PER_WEEK = 7; // const (similar to FINAL in Java) - value cannot be changed\n // console.log is the JavaScript version of System.out.println() in Java\n // If what you want to display using console.log contains a variable: \n // 1. Enclose what you want to display in back-ticks (`)\n // 2. Put the variable you want displayed inside ${}\n // \n // semi-colons at the end of a statement are usually optional in JavaScript\n console.log(`There are ${DAYS_PER_WEEK} days in a week`);\n\n // Declares a variable whose value can be changed\n let daysPerMonth = 31; // let - value may be changed\n console.log(`There are ${daysPerMonth} days this month`);\n\n // Declares a variable that will always be an array\n // To declare an array in JavaScript, code the name = []\n const WEEKDAYS = [\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n \"Sunday\"\n ];\n // console.table displays an array as a table with the indexes and values\n console.table(WEEKDAYS);\n}", "function initialisationOfVariables(scope) {\n\t/** Constant values of Faraday constant and number of electrons */\n\tFARADAY_CONST = 96500;\n\tNO_OF_ELECTRONS = 2;\n\t/** Setting the boundary of circle formation inside the cathode */\n\tCATHODE_BOUNADARY_X = 390;\n\tCATHODE_BOUNADARY_Y = 330;\n\ttimer_interval = 0.5; /** Interval of the timer and clock to be execute */\n\trheostat_initial_x = 450; /** Setting the initial x value of rheostat */\n\ttotal_weight = (parseFloat(10).toFixed(2));/** Initialising total value of cathode */\n\tscope.total_weight_value = total_weight; /**Setting total value of cathode */\n\t/**Setting the flag value as true after all image loading */\n\tload_flag = true;\n\t/**Initialising the index of analyte */\n\tselected_analyte_index = 0;\t\n\t/** Variable to hide disable property of time, voltage, resistance controls */\n\tscope.voltage_ctrls_disable = false;\n\tscope.resistance_ctrls_disable = false;\n\tscope.time_ctrls_disable = false;\n\t/** Variable to show time, voltage, resistance label controls */\n\tscope.time_ctrls_show = true;\n\tscope.voltage_ctrls_show = true;\n\tscope.resistance_ctrls_show = true;\n\t/**Setting initial value of voltage,resistance, time controls */\n\tscope.voltage_value = 1;\n\tscope.resistance_value = 1;\n\tscope.time_value = 1;\n\tresistance = 1; /** Initial value of resistance */\n\tvoltage = 1; /** Initial value of voltage */\n\ttime = 1; /** Initial value of time */\n\tcurrent = 1; /** Initial value of current */\n\tcircle_count = 1; /** Variable for counting the circles */\n\tstir_counter = 0; /** Variable for counting the stirrer frames */\n\t/** Variable to show cathode controls */\n\tscope.cathode_ctrls_show = true;\n\t/** Variable to hide disable property of cathode controls */\n\tscope.cathode_ctrls_disable = false;\n\t/** Variable to hide disable property of analyte controls */\n\tscope.analyte_ctrls_disable = false;\n\tscope.analyte_Mdl = 0; /** Initialising index of analyte */\n\tscope.cathode_Mdl = 0; /** Initialising index of cathode */\n\tscope.anode_Mdl = 0; /** Initialising index of anode */\n\tscope.start_btn_label = start_btn_var; /** Setting start button label */\n\tscope.pause_btn_label = pause_btn_var; /** Setting pause button label */\n\tscope.pause_ctrls_disable = true; /** Variable to disable pause button controls */\n\tstart_flag = false; /** Initializing the start_flag as true for checking the experiment started */\n\tgetChild(\"ammeter_txt\").text =\"1.000\"; /** Initialising ammeter reading */\n\tgetChild(\"voltmeter_txt\").text = \"1.000\"; /** Initialising voltmeter reading */\n\tgetChild(\"rheostat\").x = \"465\"; /** Initialising rheostat x position */\n\tcircle_arr = []; /** Initialising circle array */\n\tmass = 0; /** Initialising mass */\n\t/** Initialising mass array values*/\n\tmass_arr = ['10.05','10.06','10.09','10.12','10.15','10.18','10.20','10.24','10.30','10.40','10.50','10.60','10.90','11.10','12.20','13.10','15.30'];\n}", "function clearGlobals() {\n invConnMap.clear();\n SndRecArray =[];\n tweenArr = []\n\n}", "initValues() {\n // Ad top position, used when sticky ad is sticking\n this.adTop = $( 'body' ).is( '.admin-bar' ) ? 82 : 50\n\n // Sidebar height, used to place sticky ad before stick\n this.sidebarHeight = this.sidebar.outerHeight()\n\n this.setStickyRight()\n this.setStickyTop()\n this.setStickyBottom()\n }", "createBaseVars() {\n this.defaultList().forEach(name => {\n this.setVar(name.replace(`--default`, ''), this.getVar(name));\n });\n }", "function set_default_vars () {\n\tspeed = 4.5;\n\tspeed_up = 0.002;\n\tobs_increase = 1.0004;\n\tmove_per_click_y = 10;\n\tmove_per_frame_x = 5;\n\twizard_spell_len = 10000;\n\tlikelihood_new_tree = 0.03;\n\tlikelihood_new_donut = 0.01;\n\tlikelihood_new_wizard= 0.0007;\n\tscore = 0;\n\tdonuts = 0;\n\tcollision_fudge = 3;\n\tfor (var i = wizard_timeouts.length - 1; i >= 0; i--) {\n\t\tclearTimeout(wizard_timeouts[i]);\n\t\twizard_timeouts.splice(i,1);\n\t};\n}", "function resetVars() {\n\ts.eVar9 = \"\";\n\ts.eVar45 = \"\";\n\ts.eVar46 = \"\";\n\ts.eVar47 = \"\";\n\ts.eVar48 = \"\";\n\ts.eVar49 = \"\";\n\ts.eVar68 = \"\";\n\ts.prop50 = \"\";\n\ts.events = \"event2\";\n\ts.eVar31 = \"\";\n\ts.purchaseID = \"\";\n\ts.products = \"\";\n}", "function glbVars(){\r\n if(localStorage.length == 0){\r\n var users = [], hosts = [];\r\n var globalVariables = {\r\n logged: 0, // 0 = unloggued // 1 = loggued // 2 = host account //\r\n user: 'none',\r\n host: 'none'\r\n }\r\n localStorage.setItem('globalVariables', JSON.stringify(globalVariables));\r\n\r\n localStorage.setItem('users', JSON.stringify(users));\r\n\r\n hosts[0] = {\r\n hostName: \"TRYP Madrid Leganés Hotel\",\r\n hostDescription: \"TRYP Madrid Leganés hotel es la mejor opción para alojarte en Leganés. Además, el hotel se encuentra a tan solo 12 km de la Puerta del Sol de Madrid y muy próximo a la Warner Bros Park y al Parque de Nieve Xanadú. El Hotel TRYP Leganés está perfectamente comunicado por las autovías M30, M40 y M50 tanto con la capital como con las zonas industriales del sur: Getafe, Fuenlabrada, Alcorcón. Además está situado junto a los barrios de la capital de Carabanchel y Villaverde.\",\r\n hostPrice: \"54€ por noche\",\r\n hostImg1: \"https://x.cdrst.com/foto/hotel-sf/fad8/granderesp/hotel-elegance-getafe-zonasnobles-4330a8b.jpg\",\r\n hostImg2: \"https://y.cdrst.com/foto/hotel-sf/fad8/granderesp/hotel-elegance-getafe-banio-4330a89.jpg\",\r\n hostImg3: \"https://x.cdrst.com/foto/hotel-sf/1139f/granderesp/abad-san-antonio-restauracion-4260019.jpg\",\r\n hostAddress: \"Leganés\",\r\n hostAddressHtml: \"https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3041.5792316786433!2d-3.7660006846067398!3d40.3294949793753!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0xd4189f5549d2b73%3A0x5ea63cac4566b32f!2sTRYP+Madrid+Legan%C3%A9s+Hotel!5e0!3m2!1ses!2ses!4v1544319472897\"\r\n }\r\n hosts[1] = {\r\n hostName: \"Hotel Nuevo Madrid\",\r\n hostDescription: \"Este hotel elegante se encuentra en el norte de la ciudad, a 10 minutos en coche del centro de convenciones IFEMA y con acceso directo desde la autopista M30. Ofrece centro de fitness y relajación y servicio de traslado gratuito los fines de semana. as habitaciones del Nuevo Madrid presentan una decoración elegante en tonos suaves. Disponen de aire acondicionado, minibar, caja fuerte, TV de pantalla plana vía satélite y WiFi gratuita.\",\r\n hostPrice: \"70€ por noche\",\r\n hostImg1: \"https://z.cdrst.com/foto/hotel-sf/b17/granderesp/hotel-gran-atlanta-zonasnobles-43309a2.jpg\",\r\n hostImg2: \"https://x.cdrst.com/foto/hotel-sf/1b1f/granderesp/hotel-mirador-de-chamartin-habitacion-431776c.jpg\",\r\n hostImg3: \"https://centrhotel.com/wp-content/uploads/2017/12/dear_galeria_29.jpg\",\r\n hostAddress: \"Madrid\",\r\n hostAddressHtml: \"https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3035.248556537395!2d-3.671524085098332!3d40.46976587935893!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0xd422936c40fb971%3A0xfbcc0d785086e714!2sHotel+Nuevo+Madrid!5e0!3m2!1ses!2ses!4v1544319649852\"\r\n }\r\n hosts[2] = {\r\n hostName: \"Ibis Murcia\",\r\n hostDescription: \"Ibis hotel en Murcia de dos estrellas está situado a 800 metros del casco histórico de la ciudad y a 3 km del Palacio de Congresos y del Parque de Exposiciones. Todas las habitaciones están totalmente equipadas con aire acondicionado, calefacción, televisión y Wifi para ofrecerte el mayor confort. Dispone de servicio de restaurante, snack/bar 24h y parking cubierto, siempre al mejor precio. Sin duda, el mejor establecimiento hotelero low cost en Murcia tanto para viajes de negocios como para aquellos de placer y ocio.\",\r\n hostPrice: \"42€ por noche\",\r\n hostImg1: \"https://x.cdrst.com/foto/hotel-sf/978d/granderesp/hotel-nuevo-torreluz-zonasnobles-2e1b6fe.jpg\",\r\n hostImg2: \"https://z.cdrst.com/foto/hotel-sf/978d/granderesp/hotel-nuevo-torreluz-restauracion-2e1b6f9.jpg\",\r\n hostImg3: \"https://y.cdrst.com/foto/hotel-sf/b17/granderesp/hotel-gran-atlanta-habitacion-433099f.jpg\",\r\n hostAddress: \"Murcia\",\r\n hostAddressHtml: \"https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3143.910831725714!2d-1.14508428518948!3d38.00254027971864!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0xd63818f72a79a4d%3A0x14b4c5f96e6ed4e0!2sIbis+Murcia!5e0!3m2!1ses!2ses!4v1544320307601\"\r\n }\r\n localStorage.setItem('hosts', JSON.stringify(hosts));\r\n }\r\n}", "function environment_fertilizers(){\n a_FAO_i='environment_fertilizers';\n initializing_change();\n change();\n}", "function foo() {\n\tvar bar = 'bat'\n}" ]
[ "0.7081363", "0.64416593", "0.6383468", "0.6321364", "0.62969214", "0.6295085", "0.6292034", "0.62172693", "0.6208936", "0.6181201", "0.6158005", "0.61537445", "0.6132168", "0.6117411", "0.6052485", "0.60456604", "0.6043282", "0.604317", "0.60325086", "0.60206777", "0.6020544", "0.6017711", "0.6016973", "0.59723467", "0.59685934", "0.59508055", "0.594208", "0.5935629", "0.59235895", "0.5919721", "0.5888364", "0.58868", "0.5885664", "0.5881572", "0.587422", "0.5871693", "0.58671623", "0.58651197", "0.5846649", "0.5840107", "0.58352494", "0.58300805", "0.58118755", "0.58113843", "0.5809618", "0.5791355", "0.5781093", "0.5779712", "0.576193", "0.575729", "0.5747918", "0.5747041", "0.5746305", "0.57440263", "0.5728398", "0.5726471", "0.5711791", "0.5697485", "0.568585", "0.56853026", "0.567947", "0.5679084", "0.56605947", "0.5659687", "0.5635885", "0.5605881", "0.56055003", "0.5604503", "0.5582851", "0.55738413", "0.5557965", "0.55472255", "0.5540769", "0.5538982", "0.5535435", "0.5534894", "0.55348855", "0.55331784", "0.55320436", "0.5528025", "0.55249226", "0.55171245", "0.5509903", "0.55041516", "0.5501297", "0.55001456", "0.54958135", "0.5493477", "0.54907054", "0.54865193", "0.5486517", "0.5461643", "0.5458637", "0.5457439", "0.54538584", "0.5453748", "0.54519594", "0.54510754", "0.54398185", "0.5433676", "0.54331946" ]
0.0
-1
Submit the request to the server
function submitCP() { // Two different submit methods depending on whether their browser is IE9- or not if (!badBrowser) { // If newer browser, use the FormData object to include files and submit to server var data = new FormData(); data.append("desc", $("#desc").val()); data.append("to", $("#toCP").val()); data.append("fulfill", $("#fulfill").val()); var numFiles = $("#attach")[0].files.length; for (var i = 0; i < $("#attach")[0].files.length; i++) { data.append("file" + i, $("#attach")[0].files[i]); } data.append("keyCode", $("#keyCodeCP").val()); var acctCode = ""; if (!isAcctAllEmpty()) { acctCode = $("#acctCode1CP").val() + " " + $("#acctCode2CP").val() + " " + $("#acctCode3CP").val() + " " + $("#acctCode4CP").val() + " " + $("#acctCode5CP").val() + " " + $("#acctCode6CP").val(); } data.append("acctCode", acctCode); data.append("type", $("#type").val()); data.append("num", $("#numCP").val()); data.append("sideCP", $("#sideCP").val()); //data.append("side", $("#side").val()); data.append("instruct", $("#instruct").val().replace("\n", " ")); var itr = data.entries(); console.log(itr.next()); $.ajax({ method: "POST", url: "CustomPrintshop/recordCP.aspx", data: data, processData: false, contentType: false, success: function (result) { validateResult(result, numFiles); }, error: function (xhr) { showError(xhr); } }); } else { // If older browser, use standard submission without files var desc = $("#desc").val(); var to = $("#toCP").val(); var fulfill = $("#fulfill").val(); var keyCode = $("#keyCodeCP").val(); var acctCode = ""; if (!isAcctAllEmpty()) { acctCode = $("#acctCode1CP").val() + " " + $("#acctCode2CP").val() + " " + $("#acctCode3CP").val() + " " + $("#acctCode4CP").val() + " " + $("#acctCode5CP").val() + " " + $("#acctCode6CP").val(); } var type = $("#type").val(); var num = $("#numCP").val(); //var side = $("#side").val(); var sideCP = $("#sideCP").val(); var instruct = $("#instruct").val().replace("\n", " "); var data = { desc: desc, to: to, fulfill: fulfill, keyCode: keyCode, acctCode: acctCode, type: type, num: num, sideCP: sideCP, instruct: instruct }; $.ajax({ url: "CustomPrintshop/recordCP.aspx", method: "POST", data: data, success: function (result) { validateResult(result, 0); }, error: function (xhr) { showError(xhr); } }); } // Reset all values to default $("#desc").val(""); $("#fulfill").val(""); // Reset files by wrapping in form and resetting form. $("#attach").wrap("<form>").closest("form").get(0).reset(); $("#attach").unwrap(); $("#keyCodeCP").val(""); $("#acctCode1CP").val(""); $("#acctCode2CP").val(""); $("#acctCode4CP").val(""); $("#acctCode5CP").val(""); $("#acctCode6CP").val(""); $("#instruct").val(""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendSubmitRequest() {\n\trequest = createRequest();\n\tif (request==null) {\n\t\talert(\"Unable to create request\");\n\t\treturn;\n\t}\n\tif(!confirm(\"Submit Job?\")){\n\t\treturn;\n\t}\n\tvar url= \"/api/addJob\";\n\trequest.open(\"POST\",url,true);\n\trequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n\trequest.onreadystatechange = getStatus;\n\tvar form = document.forms.namedItem(\"myForm\");\n\tvar inputs = form.getElementsByTagName(\"input\");\t\n\tvar kvpairs = [];\n\tfor ( var i = 0; i < inputs.length; i++ ) {\n\t var e = inputs[i];\n\t if(e.name != \"\")\n\t kvpairs.push(encodeURIComponent(e.name) + \"=\" + encodeURIComponent(e.value));\n\t}\n\tvar queryString = kvpairs.join(\"&\");\n\trequest.send(queryString);\n\t\n}", "function _submit() {\n\t\t\t// execute the request and use the metadata if available\n\n\t\t\tif (that.bUseBatch) {\n\t\t\t\tthat.updateSecurityToken();\n\t\t\t\t// batch requests only need the path without the service URL\n\t\t\t\t// extract query of url and combine it with the path...\n\t\t\t\tvar sUriQuery = URI.parse(oRequest.requestUri).query;\n\t\t\t\t//var sRequestUrl = sPath.replace(/\\/$/, \"\"); // remove trailing slash if any\n\t\t\t\t//sRequestUrl += sUriQuery ? \"?\" + sUriQuery : \"\";\n\t\t\t\tvar sRequestUrl = that._createRequestUrl(sPath, null, sUriQuery, that.bUseBatch);\n\t\t\t\toRequest = that._createRequest(sRequestUrl, \"GET\", true);\n\t\t\t\tvar oBatchRequest = that._createBatchRequest([oRequest], true);\n\t\t\t\toRequestHandle = that._request(oBatchRequest, _handleSuccess, _handleError, OData.batchHandler, undefined, that.getServiceMetadata());\n\t\t\t} else {\n\t\t\t\toRequestHandle = that._request(oRequest, _handleSuccess, _handleError, that.oHandler, undefined, that.getServiceMetadata());\n\t\t\t}\n\n\t\t\tif (fnHandleUpdate) {\n\t\t\t\t// Create a wrapper for the request handle to be able to differentiate\n\t\t\t\t// between intentionally aborted requests and failed requests\n\t\t\t\tvar oWrappedHandle = {\n\t\t\t\t\tabort: function () {\n\t\t\t\t\t\toRequestHandle.bAborted = true;\n\t\t\t\t\t\toRequestHandle.abort();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tfnHandleUpdate(oWrappedHandle);\n\t\t\t}\n\t\t}", "function sendRequest ()\n\t{\n\t\t// Create post comment request queries\n\t\tvar postQueries = queries.concat ([\n\t\t\tbutton.name + '=' + encodeURIComponent (button.value)\n\t\t]);\n\n\t\t// Send request to post a comment\n\t\thashover.ajax ('POST', form.action, postQueries, commentHandler, true);\n\t}", "function submitRequest(){\n directionsService.route(requestArray[i].request, directionResults);\n }", "function postRequest() {\n // TODO\n}", "function submit(event){\nconsole.log(\"starting up\");\nsendPostRequest('/submission','running')\n .then(function (data) {\n console.log(\"got back the following string\");\n console.log(data); \n })\n .catch(function (error) {\n console.error('Error:', error);\n });\n}", "submit() {}", "submitForm(){\n\t\tlet instance = this;\n\t\tconst\tdata = JSON.stringify({\n\t\t\tinterest: instance.dropdownData.interest,\n\t\t\tloan: instance.calculatorData,\n\t\t\tnumberOfMonths: instance.dropdownData.months,\n\t\t\ttotalDebt: instance.debt\n\t\t});\n\t\t\n\t\t\n\t\tfetch(instance.endpoint, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t'Accept': 'application/json, text/plain, */*',\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t},\n\t\t\tbody: data\n\t\t}).then(resp => resp.json())\n\t\t\t.then(({status}) => instance.showFormMessage(status))\n\t\t\t.catch(err => instance.showFormMessage(`something wrong. Please contact the administrator.`, true))\n\t}", "async send(request, response) {}", "submit(work) {\n this.socket.send(JSON.stringify({\n method: \"submit\",\n params: work\n }));\n }", "send() {\n\n this.request.open(this.method, this.url);\n\n for (var header in this.headers) {\n this.request.setRequestHeader(header, this.headers[header]);\n }\n\n var str_data = '';\n\n if (this.data instanceof FormData) {\n this.request.send(this.data);\n } else {\n for(var name in this.data) {\n str_data = str_data + name + '=' + encodeURIComponent(this.data[name]) + '&';\n }\n this.request.send(str_data);\n }\n\n }", "sendSubmitRequest(reqType, idCarrier = true)\n {\n let path = this.RESTroot;\n if (reqType == 'PUT' && idCarrier)\n path += \"/\" + localStorage[\"updateArticle\"];\n\n fetch(\"http://127.0.0.1:5000/\" + path, {\n method: reqType,\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(this.data)\n })\n }", "function submit(method, verb, jsonData, callBack) {\n\t// generic function which calls the web rest api asynchronously \n\t// \n\t// parameters:\n\t// method represents the CRUD operation: get, put, post, or delete\n\t// verb (e.g. getitems, updateItem) maps to the corresponding method\n\t// jsonData is the data (json format used in this lab) in the request body passed to the server for processing\n\t// callBack is a function which performs operations upon receiving response from server\n\t\n\t// server is the name under which server.js is running\n\tvar server = 'http://localhost:'\n\tvar port = '8080';\n\tvar prefix = 'api';\n \n //verb is the parameter passed in that maps to the method\n\tvar url = server + port + '/' + prefix + '/' + verb;\n \n // once the XML HTTP request object's ready state changes\n\txmlHttp.onreadystatechange = function()\n {\n // the object's ready state equals to 4 (done - the operation is complete) and status equal to 200 (success - OK)\n\t\tif(xmlHttp.readyState == 4 && xmlHttp.status == 200)\n {\n // if callBack function is defined, call the callBack function to perform required logic after getting the response\n if (callBack) {\n callBack(JSON.parse(xmlHttp.responseText));\n }\n\t\t}\n\t}\n\t\n\t// initializes a newly-created HTTP request, or re-initializes an existing one.\n\txmlHttp.open(method, url);\n\n\t// set using json format and UTF-8 character set\n\txmlHttp.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');\n\n\t// send request to server\n\txmlHttp.send(jsonData);\t\n}", "function submit(ins){\r\n if (ins == '') {\r\n return;\r\n }\r\n console.log(ins);\r\n var request = new XMLHttpRequest();\r\n \r\n request.open(\"get\", address + \"?token=\" + token + \":word=\" + ins + \":qn=\" + (queryNumber ++), true);\r\n request.addEventListener(\"load\", processResponse);\r\n request.send();\r\n requests ++;\r\n}", "function makeRequest(url, form) {\n xhr.onreadystatechange = responseMethod\n xhr.open('POST', url)\n xhr.setRequestHeader(\"Content-Type\", \"application/json;charset=UTF-8\")\n xhr.send(form)\n }", "function makeRequest(){\n output('Sending the request...');\n var options = {\n method: $method.value,\n headers: {\n Accept: document.getElementById('accept').value\n },\n followRedirect: $followRedirect.checked\n };\n if(options.method === 'POST'){\n options.body = $requestBody.value;\n }\n client.request($url.value, options, function(error, response){\n if(error){\n genericError();\n } else {\n displayResponse(response);\n \n if(response.statusCode === 401){\n $authStatus.classList.remove('loggedin');\n $tokenDisplay.value = '';\n \n } else {\n $authStatus.classList.add('loggedin');\n $tokenDisplay.value = 'Bearer ' + client.getAccessToken();\n }\n }\n });\n}", "function http_post(req_url){\n request.post(\n req_url,\n function(error, response, body) {\n console.log(\"Clickatell POST:\")\n console.log(req_url);\n console.log(body);\n if (!error && response.statusCode == 200) {\n node.send({topic:\"Clickatell POST:\",payload:body});\n } else {\n console.log(error);\n node.send({topic:\"Clickatell ERROR:\",payload:error});\n\t\t\t\t}\n }\n );\n }", "function sendRequest(requestData)\n{\n //var url = \"http://uclactive.westeurope.cloudapp.azure.com:8080/openmrs/ws/fhir/Observation\";\n var url = \"http://51.140.66.103:8080/openmrs/ws/fhir/Observation\";\n\n var options = {\n uri: url,\n method: 'POST',\n json: requestData,\n headers:{\n 'Authorization': 'Basic ' + new Buffer(\"*****:******\").toString('base64')\n } \n };\n\n request(options, function (error, response, body) {\n\n console.log(\"******\");\n console.log(requestData);\n if (!error && (response.statusCode == 200 || response.statusCode == 201)) {\n console.log(body.id) // Print the shortened url.\n } else {\n console.log(\"error: \" + error)\n console.log(\"response.statusCode: \" + response.statusCode)\n console.log(\"response.statusText: \" + response.statusText)\n }\n });\n}", "function sendRequest(requestData)\n{\n //var url = \"http://uclactiveserver.westeurope.cloudapp.azure.com:8080/openmrs/ws/fhir/Observation\";\n var url = \"http://51.140.66.103:8080/openmrs/ws/fhir/Observation\";\n\n var options = {\n uri: url,\n method: 'POST',\n json: requestData,\n headers:{\n 'Authorization': 'Basic ' + new Buffer(\"*****:******\").toString('base64')\n } \n };\n\n request(options, function (error, response, body) {\n\n console.log(\"******\");\n console.log(requestData);\n if (!error && (response.statusCode == 200 || response.statusCode == 201)) {\n console.log(body.id) // Print the shortened url.\n } else {\n console.log(\"error: \" + error)\n console.log(\"response.statusCode: \" + response.statusCode)\n console.log(\"response.statusText: \" + response.statusText)\n }\n });\n}", "async function submitPOSTRequest(requestBody = {}) {\n\t\treturn fetch(serverEndpointPOSTurl, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t},\n\t\t\tbody: JSON.stringify(requestBody)\n\t\t});\n\t}", "async function makerequest() {\r\n \r\n}", "postRequest(ntsReq) {\n\tconst uid = this.props.uid;\n\tconst requests = this.state.requests;\n\tconst key = `request-${ntsReq.id}`;\n\tconst path = `requests/${key}`;\n\tif (uid == null)\n\t\treturn;\n\t// push the request key and its data. \n\tbase.post(path, {\n data: ntsReq,\n then(err){\n if(!err){\n \tconsole.log(err); \n }\n }\n\t});\n\tconst vesselKey = `vessel-${ntsReq.vesselId}`;\n\t// update the vessel to active\n\tbase.post(`/active-vessels/${vesselKey}`, {\n data: this.state.vessels[vesselKey],\n then(err){\n if(!err){\n console.log(err);\n }\n }\n\t});\n\t// Send Request Email Confirmation\n\tntsReq['email'] = this.state.email;\n\tntsReq['displayName'] = this.state.displayName;\n\tthis.sendJSONEmail('mailer/request-submitted', ntsReq);\n}", "submit() {\n\t\tif (!this.state.submitButtonEnabled) {\n\t\t\treturn;\n\t\t}\n\t\tthis.state.executing = true;\n\t\tthis.opts.callback && this.opts.callback(this.project);\n\t\tetch.update(this);\n\t}", "function createPostRequest( url, query, reqMode )\n{\n // reqMode = Request Mode (true = Asynchronous, false = Synchronous)\n req.open( \"POST\", url, reqMode )\n req.setRequestHeader( \"Content-Type\", \"application/x-www-form-urlencoded\" )\n req.send( query )\n}", "sendData(requestMethod, postURL, dataToSubmit) {\n let request = new XMLHttpRequest();\n\n request.open(requestMethod, postURL, true);\n request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n request.send(dataToSubmit);\n }", "sendData(requestMethod, postURL, dataToSubmit) {\n let request = new XMLHttpRequest();\n\n request.open(requestMethod, postURL, true);\n request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n request.send(dataToSubmit);\n }", "performRequest() {\n this.attempts += 1;\n /* Kick of a 3 second timer that will confirm to the user that the loading process is taking unusually long, unless cancelled\n by a successful load (or an error) */\n this.loadTimer = setTimeout(function () {\n let loadingText = document.getElementById(\"at_loadingtext\");\n loadingText.textContent = RoKA.Application.localisationManager.get(\"loading_slow_message\");\n }, 3000);\n /* Kick of a 30 second timer that will cancel the connection attempt and display an error to the user letting them know\n something is probably blocking the connection. */\n this.timeoutTimer = setTimeout(function () {\n new RoKA.ErrorScreen(RoKA.Application.commentSection, RoKA.ErrorState.CONNECTERROR);\n }, 30000);\n /* Perform the reddit api request */\n new RoKA.HttpRequest(this.requestUrl, this.requestType, this.onSuccess.bind(this), this.postData, this.onRequestError.bind(this));\n }", "function _sendPOSTRequest (url, data) {\n var request = new XMLHttpRequest();\n request.open('POST', url, true);\n request.setRequestHeader('Content-Type', 'application/json');\n request.send(data);\n }", "async sendRequest() {\n if (\n this.state.message != \"\" &&\n this.state.meetingDate != \"\" &&\n this.state.contact != \"\"\n ) {\n try {\n let request = {\n senderID: UserService.getCurrentUser().id,\n receiverID: this.props.match.params.id,\n type: this.props.type,\n message: this.state.message,\n meetingDate: this.state.meetingDate,\n contact: this.state.contact,\n };\n let ret = await RequestService.createRequest(request);\n\n this.props.history.push(\"/requests\");\n } catch (err) {\n console.error(err);\n }\n } else {\n alert(\"Please fill in all the fields properly\");\n }\n }", "function submitrequest(req,res){\n var db = require('../../lib/database')();\n var sql = \"UPDATE tblfinalrequest SET strRequestStatus= 'On process' WHERE intRequestID = ?\";\n db.query(sql,[req.params.transid],function (err) {\n if (err) return res.send(err);\n res.redirect('/request_reliever/reliever_list_'+ req.params.transid + req.params.hwid, flog, findcreatedlist, findcreateditem, findcountcreateditem, findmservice, findskills, findresult, findapprove, findfees, findoldhwservice,findcr, findtransaction, renderreplacementlist);\n });\n}", "onClick() {\n this.sendRequest(this.state.submissionId);\n }", "function submitData(data) {\n fetch(url, {\n method: \"POST\",\n body: JSON.stringify(data),\n headers: { \"Content-Type\": \"application/json\", Accept: \"application/json\" }\n });\n}", "submit() {\n\t\tif (!this.state.submitButtonEnabled) {\n\t\t\treturn;\n\t\t}\n\t\tthis.state.executing = true;\n\t\tthis.opts.callback && this.opts.callback(this.login);\n\t\tetch.update(this);\n\t}", "function api_call() {\n $('form').submit()\n }", "async submitRequest(ctx, supplyRequestNumber, itemId, amount, isInBudget) {\n console.info('============= START : Submit SupplyRequest ===========');\n\n // The gateway check is represented by an if condition in this case.\n if (!isInBudget || isInBudget === 'false') {\n // 1:1 mapping with diagram\n await this.noFurtherProcess(ctx, supplyRequestNumber, itemId, amount, isInBudget);\n } else {\n // 1:1 mapping with diagram\n await this.sendEquipmentListToSupplier(ctx, supplyRequestNumber, itemId, amount, isInBudget)\n }\n console.info('============= END : Submit SupplyRequest ===========');\n }", "function send(entry) {\n var options = entry.options,\n cb = entry.cb;\n\n request(options, (err, response, body) => {\n if (!err) {\n entry.response = body;\n delete options.qs.key;\n delete options.qs.token;\n cb(null, entry);\n }\n else {\n entry.response = err;\n delete options.qs.key;\n delete options.qs.token;\n cb(err, entry);\n }\n });\n }", "function requestqueue() {\n\t\t// If the queue is already running, abort.\n\t\tif(requesting) return;\n\t\trequesting = true;\n\t\tlink.request({\n\t\t\turl: \"api/events\",\n\t\t\tmethod: \"POST\",\n\t\t\tparams: {\n\t\t\t\tsid: gSessionID\n\t\t\t},\n\t\t\tcallback: queuecallback\n\t\t});\n\t}", "execute() {\n if (this.isRunning)\n return;\n let request = this.queue.shift();\n if (request === undefined) {\n this.isRunning = false;\n return;\n }\n let e = request;\n this.isRunning = true;\n this.options = request.options;\n this.completionHandlers[this.options.url] = request.handler;\n this.xmlHtpRequest.open(this.options.method, this.options.url, true);\n this.setJsonHeaders();\n this.xmlHtpRequest.send();\n this.queue = this.queue.filter(h => { h.options.url !== e.options.url; });\n }", "function submitPOST(\n/** @type {{url: string, progress: string, result: string, callback: function, messageBody: string}}*/\n inputObject\n) {\n var theAddress = inputObject.url;\n var progress = inputObject.progress;\n var result = inputObject.result;\n var callback = inputObject.callback;\n var xhr = new XMLHttpRequest();\n var progressMessage = `${theAddress} POST ${inputObject.messageBody}`;\n recordProgressStarted(progress, progressMessage, (new Date()).getTime(), true);\n\n xhr.open(\"POST\", theAddress, true);\n xhr.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n\n xhr.onload = function () {\n recordProgressDone(progress);\n if (callback !== undefined && callback !== null) {\n callback(xhr.responseText, result);\n } else { \n recordResult(xhr.responseText, result);\n }\n };\n xhr.send(inputObject.messageBody);\n}", "submit() {\n }", "sendDataToServer() {\n var data = this.state.dataFromFile;\n request\n .post('/')\n .set('Accept', /application\\/json/)\n .send({ data: data })\n .end((err, res) => {\n if (err) {\n console.log('Some error occured while sending ...' + err);\n return;\n }\n //if data successfully posted to server...alert back user confirmation message\n if (res) {\n alert('Data sent to server...check server console for JSON..');\n alert(res.text);\n }\n });\n }", "function submitOrder(){\r\n\t\r\n\ttotal = total.toFixed(2);\r\n\tlet request = new XMLHttpRequest();\r\n\tlet temp = getCurrentRestaurant();\r\n\trequest.onreadystatechange = function(){\t\r\n\t\tif(this.readyState == 4 && this.status == 200){ //if its reggie\r\n\t\t\tconsole.log(this.responseText);\r\n\t\t\talert(\"Order placed!\")\r\n\t\t\t//reset order\r\n\t\t\torder = {};\r\n\t\t\tselectRestaurant();\r\n\t\t}\r\n\t}\r\n\t//custom url that tells the server the currently selected restaurant and the order \r\n\trequest.open(\"POST\",\"http://localhost:3000/restaurant-stats/\"+temp.name+\"/\"+total,true);\r\n\trequest.setRequestHeader('Content-type', 'application/json');\r\n\trequest.send(JSON.stringify(order));\r\n}", "function doSubmit() {\n \t/* data to be sent should follow fomat as:\n \t\tdata = {'channel': channelNo,\n \t\t\t\t'selectedPoints': array of peak, e.g. [[1, 20], [5, 40]]\n \t\t}\n \t*/\n \t//console.log(choice.find('input').filter('[checked=checked]').attr(\"value\"));\n \tvar pdata = {//'channel': selectedPoints[0].series.label.substring(8),\n \t\t\t'qPoint': [qPoint.x/xPointInterval, qPoint.y/xPointInterval],\n \t\t\t'tPoint': [tPoint.x/xPointInterval, tPoint.y/xPointInterval],\n \t\t\t'bin': parseInt(bin.val()),\n \t\t\t'lead': choice.find('input').filter('[checked=checked]').attr(\"value\")\t\n \t\t\t};\n\t\tplotAccordingToChoices();\n\t\t$.ajax({\n\t\t\ttype: 'GET',\n\t\t\turl: submitUrl,\n\t\t\tdataType: 'json',\n\t\t\tcache: false,\n\t\t\tdata: {\"data\":JSON.stringify(pdata)},\n\t\t\tbeforeSend: showSpinner,\n\t\t\tcomplete: hideSpinner,\n\t\t\tsuccess: onBinDataReceived,\n\t\t\terror: function() {alert(\"ECG module Error!!\");}\n\t\t});\n }", "function sendRequest() {\n var req = $req.val();\n var user = $username.val();\n socket.emit('req-send', req, user);\n }", "function makeRequest() {\n var inputs = document.querySelectorAll('.feedback-inputs'),\n body = '',\n i,\n xhr = new XMLHttpRequest(),\n submitButton = document.getElementsByClassName('submit-button')[0];\n\n for (i = 0; i < inputs.length; i++) {\n body += inputs[i].name + '=' + encodeURIComponent(inputs[i].value) + '&';\n\n if (i === (inputs.length - 1)) {\n body = body.substring(0, body.length - 1);\n }\n }\n\n if (options.enabledCaptcha) {\n body += '&captcha=' + encodeURIComponent(grecaptcha.getResponse());\n }\n\n xhr.open(\"POST\", options.uriSubmit, true);\n xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n\n xhr.send();\n\n xhr.onreadystatechange = function() {\n if (xhr.readyState != 4) return;\n\n submitButton.innerHTML = 'Готово!';\n\n if (xhr.status != 200) {\n\n } else {\n\n }\n }\n }", "function formPOST(){\n\n\tthis.submit();\n\n}", "function main() {\n\n\t\t//Check the Method\n\t\tif ($.request.method === $.net.http.GET) {\n\t\t\t$.response.status = 200;\n\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\tmessage: \"API Called\",\n\t\t\t\tresult: \"GET is not supported, perform a POST to add Entries\"\n\t\t\t}));\n\t\t} else {\n\t\t\t//Perform Table Entry to be created in Table\n\t\t\ttry {\n\t\t\t\tif (gvGuid) {\n\t\t\t\t\t_createEntries();\n\t\t\t\t}\n\t\t\t} catch (errorObj) {\n\t\t\t\tgvTableUpdate = \"Error during table insert:\" + errorObj.message;\n\t\t\t}\n\n\t\t\t$.response.status = 200;\n\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\tmessage: \"API Called\",\n\t\t\t\tTableUpdateStatus: gvTableUpdate\n\t\t\t}));\n\t\t}\n\t}", "function send_request(req_type, req_body) {\n const http_method = 'POST';\n const server_path = 'main.py';\n let xhr = new XMLHttpRequest();\n xhr.open(http_method, server_path, true);\n xhr.setRequestHeader('Content-Type', 'application/json');\n xhr.setRequestHeader(\"req_type\", req_type);\n xhr.setRequestHeader(\"Authorization\", auth_token);\n xhr.send(JSON.stringify(req_body));\n return xhr;\n}", "function upload(response, postData, dbPool) {\n console.log(\"Request handler 'upload' was called.\");\n \n var queryData = querystring.parse(postData);\n\n var body = \n '<p>You\\'ve sent the number: ' + queryData.number + '</p>'+\n '<p>You\\'ve sent the name: ' + queryData.name + '</p>'+\n '<p>You\\'ve sent the position: ' + queryData.position + '</p>'+\n '<p>You\\'ve selected: ' + queryData.selected + '</p>'+\n '<p>You\\'ve requested the action: ' + queryData.submit_action + '</p>';\n\n console.log(body);\n\n // dispatch based on the action\n sql[queryData.submit_action](response, postData, dbPool);\n\n}", "function send_request(method, path, body, q_string, on_success, on_error) {\n\t// Signing request\n\tvar text = method + '::' + path + '::' + body\n\tvar hash = CryptoJS.HmacSHA1(text, secret);\n\tvar hashInBase64 = CryptoJS.enc.Base64.stringify(hash);\n\n\t// Sending request\n\tvar url = 'https://'+domain+path;\n\tif ( q_string ) {\n\t\turl += '?'+q_string; \n\t} \n\tvar xhr = new XMLHttpRequest();\n\txhr.open(method, url, true);\n\txhr.onload = function(res) { on_success(xhr.response); };\n\txhr.onerror = on_error;\n\txhr.withCredentials = false;\n\txhr.responseType = 'json';\n\txhr.setRequestHeader('Content-Type','application/json');\n\txhr.setRequestHeader('X-Gcmp-Application','reporting-1');\n\txhr.setRequestHeader('X-Gcmp-Acting',acting);\n\txhr.setRequestHeader('Authorization','GCMP '+key+':'+hashInBase64);\n\txhr.send(body);\n}", "function send() {\n\t\tconst req = JSON.stringify({\n\t\t\taction: \"Run\",\n\t\t\tcode: codeInput.value.trim(),\n\t\t\tsession: sessionInput.value.trim(),\n\t\t})\n\t\tlet result = session.request(req);\n\t\tgetResultString(result).then(function (str) {\n\t\t\tresultLbl.value = str;\n\t\t});\n\t}", "function doSubmit() {\n\t\t\t// make sure form attrs are set\n\t\t\tvar t = $form.attr('target'), a = $form.attr('action');\n\n\t\t\t// update form attrs in IE friendly way\n\t\t\tform.setAttribute('target',id);\n\t\t\tif (!method) {\n\t\t\t\tform.setAttribute('method', 'POST');\n\t\t\t}\n\t\t\tif (a != s.url) {\n\t\t\t\tform.setAttribute('action', s.url);\n\t\t\t}\n\n\t\t\t// ie borks in some cases when setting encoding\n\t\t\tif (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n\t\t\t\t$form.attr({\n\t\t\t\t\tencoding: 'multipart/form-data',\n\t\t\t\t\tenctype: 'multipart/form-data'\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// support timout\n\t\t\tif (s.timeout) {\n\t\t\t\ttimeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n\t\t\t}\n\t\t\t\n\t\t\t// look for server aborts\n\t\t\tfunction checkState() {\n\t\t\t\ttry {\n\t\t\t\t\tvar state = getDoc(io).readyState;\n\t\t\t\t\tlog('state = ' + state);\n\t\t\t\t\tif (state.toLowerCase() == 'uninitialized')\n\t\t\t\t\t\tsetTimeout(checkState,50);\n\t\t\t\t}\n\t\t\t\tcatch(e) {\n\t\t\t\t\tlog('Server abort: ' , e, ' (', e.name, ')');\n\t\t\t\t\tcb(SERVER_ABORT);\n\t\t\t\t\ttimeoutHandle && clearTimeout(timeoutHandle);\n\t\t\t\t\ttimeoutHandle = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// add \"extra\" data to form if provided in options\n\t\t\tvar extraInputs = [];\n\t\t\ttry {\n\t\t\t\tif (s.extraData) {\n\t\t\t\t\tfor (var n in s.extraData) {\n\t\t\t\t\t\textraInputs.push(\n\t\t\t\t\t\t\t$('<input type=\"hidden\" name=\"'+n+'\" />').attr('value',s.extraData[n])\n\t\t\t\t\t\t\t\t.appendTo(form)[0]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!s.iframeTarget) {\n\t\t\t\t\t// add iframe to doc and submit the form\n\t\t\t\t\t$io.appendTo('body');\n\t io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);\n\t\t\t\t}\n\t\t\t\tsetTimeout(checkState,15);\n\t\t\t\tform.submit();\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\t// reset attrs and remove \"extra\" input elements\n\t\t\t\tform.setAttribute('action',a);\n\t\t\t\tif(t) {\n\t\t\t\t\tform.setAttribute('target', t);\n\t\t\t\t} else {\n\t\t\t\t\t$form.removeAttr('target');\n\t\t\t\t}\n\t\t\t\t$(extraInputs).remove();\n\t\t\t}\n\t\t}", "async execute(){\n\t\tawait this.processRequest();\n\t\tawait this.formatRequest();\n\t\tawait this.processData();\n\t\tawait this.formatResponse();\n\t\tawait this.processResponse();\n\t}", "doRequest(method, endpoint, activity, data) {\n this.setState({progress: \"Executing request\", submitting: true});\n doJsonFetch(method, endpoint, data,\n (httpCode, result) => {\n this.processRequestResult(activity, httpCode, data, result);\n },\n (error) => {\n // No longer processing form submit.\n this.setState({submitting: false,\n progress: (<DnMessage error={true}>{error.message}</DnMessage>)});\n }\n );\n }", "function submitBtnHandler(e){\n e.preventDefault();\n let form = document.querySelector('form');\n\n let formData = processForm(form);\n let path = document.getElementById('stackID').value;\n let url = `${form.action}${path.replace(' ','')}`;\n \n xhr.onload = success;\n\n if(form.method === 'post'){\n url += `/${formData[\"act\"]}`;\n xhr.open(form.method,url,true);\n xhr.send(JSON.stringify(formData));\n return;\n }\n\n xhr.open(form.method,url,true);\n xhr.send();\n}", "function xmlpost() {\r\n var x = new XMLHttpRequest(), finished = false;\r\n x.open(method, endpoint + (method == \"GET\" ? (__sco.type(data) == \"string\" ? data : JSON.stringify(data)) : \"\"), true);\r\n __sco.each(headers, function (ix, val) {\r\n if (__sco.type(val) == \"object\" && __sco.type(val.key) == \"string\" && __sco.type(val.value) == \"string\")\r\n x.setRequestHeader(val.key, val.value);\r\n });\r\n if (__sco.type(timeout) == \"number\" && timeout > 0) {\r\n if (\"ontimeout\" in x) {\r\n x.timeout = __sco.type(timeout) != \"number\" ? 0 : timeout;\r\n x.ontimeout = timeouthandler;\r\n } else {\r\n // fallback\r\n x.onabort = timeouthandler;\r\n setTimeout(function () {\r\n x.abort();\r\n }, timeout + 10); // Add 10ms to allow for request setup and connection start\r\n }\r\n }\r\n if (__sco.type(callback) === \"function\") {\r\n if ('onload' in x)\r\n x.onload = callback;\r\n else\r\n x.onreadystatechange = function (e) {\r\n if (!finished && x.readyState == 4) {\r\n finished = true;\r\n callback.call(window, e);\r\n }\r\n }\r\n }\r\n x.send((method == \"GET\" || !__sco.noru(data) ? \"\" : __sco.type(data) !== \"string\" ? SCJSON.stringify(data) : data));\r\n }", "function request(){\n\n var remoteID = getPrevious();\n\n if ( !remoteID ) return; // entry\n\n CONNECTIONS[ remoteID ].send( 'start', { request: true }, true );\n}", "function handleRequest(event) {\r\n event.preventDefault();\r\n\r\n var username = $('#reqUsername').val();\r\n var bundle = $('#reqBundle').val();\r\n\r\n $.ajax({\r\n method: 'POST',\r\n url: WORKSPACES_CONTROL_URL,\r\n headers: {\r\n Authorization: authToken\r\n },\r\n beforeSend: function () {},\r\n complete: function () {},\r\n data: JSON.stringify({\r\n action: 'create',\r\n username: username,\r\n bundle: bundle\r\n }),\r\n contentType: 'text/plain',\r\n error: function () {\r\n $(\"#methodStatus\").append('<div class=\"alert alert-danger\"><b>Error! Something went wrong... Please contact an administrator if the problem persists.</div>');\r\n $(\"#methodStatus\").show();\r\n },\r\n success: function (data) {\r\n $(\"#methodStatus\").append('<div class=\"alert alert-success\"><b>Success! WorkSpace request submitted...</b> This request must be approved before the WorkSpace will be created. An email has been sent to <b>' + _config.approval.email + '</b> to authorize this request. Once approved, the WorkSpace will be created automatically and an email will be sent to your email with instructions for access.</div>');\r\n $(\"#methodStatus\").show();\r\n }\r\n });\r\n\r\n }", "makeRequest(opts, callback) {\n this.requestQueue.push(opts, callback);\n }", "function sendRequest(input) {\n // Check if argument input passed\n if (input !== undefined) {\n // pass\n } else {\n // In case input no passed, we get the text from textarea\n var input = document.getElementById(\"textarea\").value.trim();\n }\n\n if (input.length>1)\n {\n // Build data json\n var data = JSON.stringify({\"input\": input});\n var xhr = new XMLHttpRequest();\n xhr.withCredentials = true;\n\n xhr.addEventListener(\"readystatechange\", function () {\n if (this.readyState === 4) {\n var data = JSON.parse(this.responseText)\n displayPrediction(data.body)\n }\n });\n\n // Request prediction\n xhr.open(\"POST\", conf.APP_URL + conf.ROUTE);\n\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.send(data);\n }\n}", "function submit() {\n let req = {\n method: 'POST',\n url: Endpoints.SUBSCRIBE,\n data: {\n mail: vm.email\n }\n };\n\n $http(req).then((res) => {\n if (res.data.success) {\n NotificationService.success(res.data.data.message);\n } else {\n NotificationService.error(res.data.data.message);\n }\n });\n }", "function goRequest(i){\n\tvar requestId = requestBody.id;\n\t//parses it to string so it can be used\n\trequestBody = JSON.stringify(requestBody);\n\trequest.write(requestBody);\n\t//starts stopwatch for current request\n\tstopwatch[i].start = new Date().getTime();\n\tconsole.log('Login Sent ' + requestId);\n\trequire('fs').writeFile('./results/' + 'Request_id_' + requestId + '_' + momentTime() +'.txt', requestBody);\n\trequest.end();\n\t//delay that is calculated by the desired tps\n\tsleep(msDelay);\n}", "function submit() {\n console.log('Passing Location and Industry to Controller', self.input);\n sendInput(self.input);\n reset();\n }", "function externalSubmit(submitUrl, results) {\r\n dd = new Date();\r\n bugout.log('Submitting study:' + dd);\r\n bugout.log(dd.getTime());\r\n bugout.log(results);\r\n console.log(\"payload\", results);\r\n console.log(\"submitUrl\", submitUrl);\r\n bugout.downloadLog();\r\n rectBugout.downloadLog();\r\n\r\n $.ajax({\r\n url: submitUrl,\r\n type: 'POST',\r\n data: JSON.stringify(results),\r\n dataType: 'json'\r\n }).then(function(response) {\r\n showSubmitKey(response['key']);\r\n }).catch(function(error) {\r\n // This means there was an error connecting to the DEVELOPER'S\r\n // data collection server. \r\n // even if there is a bug/connection problem at this point,\r\n // we want people to be paid. \r\n // use a consistent prefix so we can pick out problem cases,\r\n // and include their worker id so we can figure out what happened\r\n console.log(\"ERROR\", error);\r\n key = \"mturk_key_\" + state.workerId + \"_\" + state.assignmentId;\r\n showSubmitKey(key);\r\n })\r\n}", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr('target'), a = $form.attr('action');\n\n // update form attrs in IE friendly way\n form.setAttribute('target', id);\n if (!method) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function () { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state.toLowerCase() == 'uninitialized')\n setTimeout(checkState, 50);\n }\n catch (e) {\n log('Server abort: ', e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n timeoutHandle && clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n extraInputs.push(\n\t\t\t\t\t\t\t$('<input type=\"hidden\" name=\"' + n + '\">').attr('value', s.extraData[n])\n\t\t\t\t\t\t\t\t.appendTo(form)[0]);\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);\n }\n setTimeout(checkState, 15);\n form.submit();\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action', a);\n if (t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function sendRequest(form) {\n var formData = new FormData(form);\n\n //used to replace the browser url\n var targetURL = buildGetString(formData);\n\n formData.append('page', nextPage);\n\n //cancel previous request, if user was too fast\n request.abort();\n\n var getString = buildGetString(formData);\n\n if (window.history.replaceState) {\n window.history.replaceState(null, '', targetURL);\n }\n\n request.open('Post', getString, true);\n request.setRequestHeader('Accept', 'application/json');\n\n //send ajax = 1 to prevent users from accessing the returned json via get\n var formData = new FormData();\n formData.append('ajax', '1');\n request.send(formData);\n }", "function sendRequest(request, requestMethod, data) {\n // add the requestURL to the front of the request:\n url = requestUrl + request;\n // set the parameters:\n let params = {\n method: requestMethod, // GET, POST, PUT, DELETE, etc.\n //mode: 'no-cors', // if you need to turn off CORS, use this\n headers: { // any HTTP headers you want can go here\n 'accept': 'application/json'\n }\n }\n // if it's not a GET request and there's data to send,\n // add it:\n if (requestMethod !== 'GET' || data) {\n params.body = JSON.stringify(data); // body data type must match \"Content-Type\" header\n }\n // make the request:\n fetch(url, params)\n .then(response => response.json()) // convert response to JSON\n .then(data => getResponse(JSON.stringify(data))) // get the body of the response\n .catch(error => getResponse(error));// if there is an error\n}", "function main() {\n\n\t\t//Check the Method\n\t\tif ($.request.method === $.net.http.POST) {\n\t\t\t$.response.status = 200;\n\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\tmessage: \"API Called\",\n\t\t\t\tresult: \"POST is not supported, perform a GET to schedule the alert job\"\n\t\t\t}));\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tif (gvMethod === \"Create\" || gvMethod === \"CREATE\") {\n\t\t\t\t\tDeleteJob();\n\t\t\t\t\tScheduleJob();\n\n\t\t\t\t\t$.response.status = 200;\n\t\t\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\t\t\tmessage: \"API Called, schedule created\"\n\t\t\t\t\t}));\n\t\t\t\t} else if (gvMethod === \"DELETE\" || gvMethod === \"Delete\") {\n\t\t\t\t\tDeleteJob();\n\n\t\t\t\t\t$.response.status = 200;\n\t\t\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\t\t\tmessage: \"API Called, schedule deleted\"\n\t\t\t\t\t}));\n\t\t\t\t} else {\n\t\t\t\t\t$.response.status = 200;\n\t\t\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\t\t\tmessage: \"API Called, but no action taken, method was not supplied\"\n\t\t\t\t\t}));\n\t\t\t\t}\n\n\t\t\t} catch (err) {\n\t\t\t\t$.trace.error(JSON.stringify({\n\t\t\t\t\tmessage: err.message\n\t\t\t\t}));\n\t\t\t\t$.response.status = 200;\n\t\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\t\tmessage: \"API Called\",\n\t\t\t\t\terror: err.message\n\t\t\t\t}));\n\t\t\t}\n\n\t\t}\n\t}", "async function submit(){\n\n //gather user input from the login inputs\n let amount = document.getElementById(\"amount\").value;\n let submitted = new Date();\n let resolved = \"unresolved\";\n let description = document.getElementById(\"description\").value;\n let receipt = null;\n let authorid = sessionStorage.getItem(\"authorid\");\n let resolverid = null;\n let status = \"pending\";\n let type = document.getElementById(\"typeFilter\").value;\n\n //we want to send the user/pass as JSON, so we need to make a JS object to send\n let reimbRequest = {\n amount : amount,\n submitted : submitted,\n resolved : resolved,\n description : description,\n receipt : receipt,\n author : {id : authorid},\n resolver : {id : resolverid},\n status : {status: status},\n type : {type : type}\n }\n\n console.log(reimbRequest)\n \n // send a POST to the the url + newReimb\n let response2 = await fetch(url + \"newReimb\", {\n\n method: \"POST\", //send a POST request\n body: JSON.stringify(reimbRequest), //turn our JS into JSON\n credentials: \"include\"\n //this last line will ensure that the cookie is captured\n //future fetches will also require this \"include\" value to send the cookie back\n\n });\n\n // window.alert(\"Reimbursement request submitted!\"); \n document.getElementById(\"thead\").innerHTML=\"\";\n document.getElementById(\"employeeReimbBody\").innerHTML=\"\";\n document.getElementById(\"submitNew\").innerHTML=\"Reimbursement request submitted!\";\n }", "send(request, callback) {\n if (!request)\n callback('Undefined request');\n this.request(request)\n .then((result) => callback(null, { jsonrpc: '2.0', id: request.id, result }))\n .catch((error) => callback(error, null));\n }", "function postReqFromForm(bodyParams){\n let counter = 0; //make sure only one request is sent.\n\n serviceUrl = chooseVrpService();\n let requestUrl = serviceUrl + \"/submitJob?f=json\";\n\n let request = new XMLHttpRequest();\n request.open(\"POST\", requestUrl, true);\n request.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded; charset=UTF-8\");\n request.send(bodyParams);\n\n request.onreadystatechange = function(){\n if(this.status == 200 && request.responseText.length > 1){\n counter += 1;\n if(counter < 2){\n let requestJson = JSON.parse(request.responseText);\n checkJobStatus(requestJson.jobId); //pass in a json object instead of a string;\n }\n }\n }\n }", "function doSubmit() {\r\n\t\t\t\t// make sure form attrs are set\r\n\t\t\t\tvar t = $form.attr2('target'),\r\n\t\t\t\t\ta = $form.attr2('action'),\r\n\t\t\t\t\tmp = 'multipart/form-data',\r\n\t\t\t\t\tet = $form.attr('enctype') || $form.attr('encoding') || mp;\r\n\r\n\t\t\t\t// update form attrs in IE friendly way\r\n\t\t\t\tform.setAttribute('target', id);\r\n\t\t\t\tif (!method || /post/i.test(method)) {\r\n\t\t\t\t\tform.setAttribute('method', 'POST');\r\n\t\t\t\t}\r\n\t\t\t\tif (a !== s.url) {\r\n\t\t\t\t\tform.setAttribute('action', s.url);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// ie borks in some cases when setting encoding\r\n\t\t\t\tif (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\r\n\t\t\t\t\t$form.attr({\r\n\t\t\t\t\t\tencoding: 'multipart/form-data',\r\n\t\t\t\t\t\tenctype: 'multipart/form-data'\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// support timout\r\n\t\t\t\tif (s.timeout) {\r\n\t\t\t\t\ttimeoutHandle = setTimeout(function () {\r\n\t\t\t\t\t\ttimedOut = true; cb(CLIENT_TIMEOUT_ABORT);\r\n\t\t\t\t\t}, s.timeout);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// look for server aborts\r\n\t\t\t\tfunction checkState() {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tvar state = getDoc(io).readyState;\r\n\r\n\t\t\t\t\t\tlog('state = ' + state);\r\n\t\t\t\t\t\tif (state && state.toLowerCase() === 'uninitialized') {\r\n\t\t\t\t\t\t\tsetTimeout(checkState, 50);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\tlog('Server abort: ', e, ' (', e.name, ')');\r\n\t\t\t\t\t\tcb(SERVER_ABORT);\t\t\t\t// eslint-disable-line callback-return\r\n\t\t\t\t\t\tif (timeoutHandle) {\r\n\t\t\t\t\t\t\tclearTimeout(timeoutHandle);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimeoutHandle = undefined;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// add \"extra\" data to form if provided in options\r\n\t\t\t\tvar extraInputs = [];\r\n\r\n\t\t\t\ttry {\r\n\t\t\t\t\tif (s.extraData) {\r\n\t\t\t\t\t\tfor (var n in s.extraData) {\r\n\t\t\t\t\t\t\tif (s.extraData.hasOwnProperty(n)) {\r\n\t\t\t\t\t\t\t\t// if using the $.param format that allows for multiple values with the same name\r\n\t\t\t\t\t\t\t\tif ($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\r\n\t\t\t\t\t\t\t\t\textraInputs.push(\r\n\t\t\t\t\t\t\t\t\t\t$('<input type=\"hidden\" name=\"' + s.extraData[n].name + '\">', ownerDocument).val(s.extraData[n].value)\r\n\t\t\t\t\t\t\t\t\t\t\t.appendTo(form)[0]);\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\textraInputs.push(\r\n\t\t\t\t\t\t\t\t\t\t$('<input type=\"hidden\" name=\"' + n + '\">', ownerDocument).val(s.extraData[n])\r\n\t\t\t\t\t\t\t\t\t\t\t.appendTo(form)[0]);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (!s.iframeTarget) {\r\n\t\t\t\t\t\t// add iframe to doc and submit the form\r\n\t\t\t\t\t\t$io.appendTo($body);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (io.attachEvent) {\r\n\t\t\t\t\t\tio.attachEvent('onload', cb);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tio.addEventListener('load', cb, false);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tsetTimeout(checkState, 15);\r\n\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tform.submit();\r\n\r\n\t\t\t\t\t} catch (err) {\r\n\t\t\t\t\t\t// just in case form has element with name/id of 'submit'\r\n\t\t\t\t\t\tvar submitFn = document.createElement('form').submit;\r\n\r\n\t\t\t\t\t\tsubmitFn.apply(form);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} finally {\r\n\t\t\t\t\t// reset attrs and remove \"extra\" input elements\r\n\t\t\t\t\tform.setAttribute('action', a);\r\n\t\t\t\t\tform.setAttribute('enctype', et); // #380\r\n\t\t\t\t\tif (t) {\r\n\t\t\t\t\t\tform.setAttribute('target', t);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$form.removeAttr('target');\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$(extraInputs).remove();\r\n\t\t\t\t}\r\n\t\t\t}", "submitStar() {\n\t\tthis.app.post('/submitstar', async (req, res) => {\n\t\t\tif (\n\t\t\t\treq.body.address &&\n\t\t\t\treq.body.message &&\n\t\t\t\treq.body.signature &&\n\t\t\t\treq.body.star\n\t\t\t) {\n\t\t\t\tconst address = req.body.address;\n\t\t\t\tconst message = req.body.message;\n\t\t\t\tconst signature = req.body.signature;\n\t\t\t\tconst star = req.body.star;\n\t\t\t\ttry {\n\t\t\t\t\tlet block = await this.blockchain.submitStar(\n\t\t\t\t\t\taddress,\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tsignature,\n\t\t\t\t\t\tstar\n\t\t\t\t\t);\n\t\t\t\t\tif (block) {\n\t\t\t\t\t\treturn res.status(200).json(block);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn res.status(500).send('Error in function submitStar.');\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\treturn res.status(500).send(error);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn res.status(500).send('Check the Body parameter.');\n\t\t\t}\n\t\t});\n\t}", "m_submit_http_request(ph_args) {\n const lo_this = this;\n\n try {\n\n // call limit already reached ? - silently exit\n if (lo_this._ab_call_limit_reached) {\n return;\n }\n\n const pi_max_calls = lo_this.m_pick_option(ph_args, \"pi_max_calls\", true);\n const li_call_count = lo_this.m_get_call_count_pushed();\n\n // when we reached the max number of calls to this server, just stop now\n if (f_is_defined(pi_max_calls) && (li_call_count >= pi_max_calls)) {\n lo_this._ab_call_limit_reached = true;\n throw f_console_alert(`${lo_this.m_get_context()} - total of [${li_call_count}] calls, reached the limit pi_max_calls=[${pi_max_calls}] - stopping`);\n }\n\n\n // on-the-fly create a new async queue object, when required\n if (! lo_this._ao_query_queue) {\n const pi_concurrency = lo_this.m_pick_option(ph_args, \"pi_concurrency\");\n const pi_max_rate_cps = lo_this.m_pick_option(ph_args, \"pi_max_rate_cps\");\n\n f_console_verbose(1, `${lo_this.m_get_context()} - initializing async WBS queue with concurrency=[${pi_concurrency}] and rate-limit=[${pi_max_rate_cps} cps]`);\n\n // https://caolan.github.io/async/docs.html#QueueObject\n const lo_new_queue = cm_async.queue(function (ph_args, pf_process_next_in_queue) {\n lo_this._m_queue_worker(ph_args, pf_process_next_in_queue);\n }, pi_concurrency);\n\n\n // branch events\n lo_new_queue.drain = function () {\n lo_this._m_queue_drain();\n };\n\n lo_new_queue.empty = function () {\n lo_this._m_queue_empty();\n };\n\n lo_this._ao_query_queue = lo_new_queue;\n }\n\n const ps_call_context = lo_this.m_pick_option(ph_args, \"ps_call_context\");\n if (f_string_is_blank(ps_call_context)) {\n throw f_console_fatal(`${lo_this.m_get_context()} - missing option [ps_call_context]`);\n }\n\n f_console_verbose(2, `${lo_this.m_get_context(ps_call_context)} - pushing arguments:`, ph_args);\n\n const pb_high_priority = f_is_true(lo_this.m_pick_option(ph_args, \"pb_high_priority\", true));\n if (pb_high_priority) {\n f_console_verbose(1, `${lo_this.m_get_context(ps_call_context)} - scheduling query in high priority`);\n lo_this._ao_query_queue.unshift(ph_args);\n }\n\n else {\n lo_this._ao_query_queue.push(ph_args);\n }\n\n lo_this._ai_call_count_pushed_total ++;\n lo_this._ai_queue_len_max = f_number_max(lo_this._ai_queue_len_max, lo_this._ao_query_queue.length());\n }\n\n catch (po_err) {\n f_console_catch(po_err);\n }\n }", "_submitData(event) {\n\n // prevent submit form\n event.preventDefault();\n\n if( !this._controlDataBeforeSend() ) {\n document.body.scrollTop = document.documentElement.scrollTop = 0;\n return;\n }\n\n //let xhr = new XMLHttpRequest();\n let data = {\n name: this.options.title,\n description: this.options.describe,\n clients: this.options.data\n };\n\n var xhr = $.ajax({\n type: \"POST\",\n url: this._config.url,\n contentType: \"application/json; charset=utf-8\",\n dataType: \"json\",\n data: JSON.stringify(data)\n });\n\n var complete = false;\n\n xhr\n .done(function() {\n complete = true;\n\n })\n .fail(function() {\n complete = false;\n })\n .always(function() {\n if(complete) {\n window.location = \"/autodialer/tasks?saved\";\n } else {\n noty({\n text: 'К сожалению произошла ошибка, попробуйте ещё раз!'\n });\n }\n });\n }", "submitForm() {\n this._executeSubmitAction()\n .then(\n () => this.onSubmitSuccessResponse(this.formSuccessMessage)\n )\n .catch(\n () => this.onSubmitFailureResponse(this.formFailedMessage)\n );\n }", "function SaveAction() {\n console.log(\"in save\");\n\n // Endpoint: http://ip_adr:port/save\n fetch(\"http://\" + location.hostname + \":\" + location.port + \"/save\", {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n }\n })\n .then(\n function (response) {\n HandleResponse(response)\n }\n )\n .catch(function (err) {\n console.log('Fetch Error :-S', err);\n });\n}", "function sendRequest(cmd)\n\t{\n\t\tvar target = \"https://\" + window.location.hostname + \"/modectl\"; \n\t\t\n\t\tvar data = \"command=\" + encodeURIComponent(cmd) + \"&csrf=\" + getCSRFToken() ;\n\t\t\n\t\tvar req = new XMLHttpRequest();\n\t\treq.onreadystatechange = handleResponse(req, cmd);\n\t\t\n\t\treq.open(\"POST\", target);\n\t\treq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=UTF-8');\n\t\treq.send(data);\n\t\t\n\t}", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr('target'), a = $form.attr('action');\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n \n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').attr('value',s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n if (io.attachEvent)\n io.attachEvent('onload', cb);\n else\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n form.submit();\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "request(url, form, data) {\n\n const options = {\n url: this.api + url,\n json: true\n };\n\n if (this.proxy) options.proxy = this.proxy;\n\n if (form) {\n options.form = form;\n } else {\n for (let item in data) {\n const type = typeof data[item];\n if (type == 'string' || type == 'object') continue;\n data[item] = JSON.stringify(data[item]);\n }\n options.formData = data;\n }\n\n return new Promise((resolve, reject) => {\n request.post(options, (error, response, body) => {\n if (error || !body || !body.ok || response.statusCode == 404) {\n return reject(error || body || 404);\n }\n return resolve(body);\n });\n });\n\n }", "function sendRequest(url, callback, viewRenderer) {\n\tvar request = new XMLHttpRequest();\n\trequest.open('POST', url, true);\n\trequest.onload = function() {\n\t if (request.status >= 200 && request.status < 400) {\n\t\t// Success!\n\t\tvar data = request.responseText;\n\t\tcallback(data, viewRenderer);\n\t } else {\n\t\t// We reached our target server, but it returned an error\n\t }\n\t};\n\n\trequest.onerror = function() {\n\t // There was a connection error of some sort\n\t\tconsole.log(\"error\");\n\t};\n\trequest.send();\n}", "function processData(postString) {\r\n\tclient = new XMLHttpRequest();\r\n\tclient.open('POST','http://developer.cege.ucl.ac.uk:30266/submitAnswer',true);\r\n \r\n\tclient.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\r\n\t// Code adapted from https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/onreadystatechange\r\n\tclient.onreadystatechange = function () {\r\n\t\tif(client.readyState === 4 && client.status === 200) {\r\n\t\t\tconsole.log(\"Answer submitted successfully\");\r\n\t\t}\r\n\t};\r\n client.send(postString);\r\n}", "send() {\n this.body.ts = timestamp()\n ajax(\n pbaUrl,\n null,\n JSON.stringify(this.body),\n {\n contentType: 'application/json',\n method: 'POST',\n }\n )\n }", "submitStarData() {\n this.server.route({\n method: 'POST',\n path: '/block',\n handler: async (request, h) => {\n const result = await this.mempool.verifyAddressRequest(request.payload);\n if (result.address !== undefined) {\n //add block to blockchain\n let blockResult = await this.blockchain.addBlock(new BlockClass.Block(result));\n return await this.blockchain.addDecodedStoryToReturnObj(blockResult); \n }\n return result; \n }\n });\n }", "async function submitQuery() {\r\n // Get form fields\r\n const userNameQuery = document.getElementById('userNameQuery').value;\r\n const userEmailQuery = document.getElementById('userEmailQuery').value;\r\n const userQuery = document.getElementById('userQuery').value;\r\n\r\n // build submitQueryObj object for Insert or Update\r\n // required for sending to the API\r\n const submitQueryObj = {\r\n userName: userNameQuery,\r\n userEmail: userEmailQuery,\r\n queryDesc: userQuery\r\n }\r\n\r\n // url for api call\r\n const url = `${BASE_URL}/query`\r\n let httpMethod = \"POST\";\r\n\r\n // build the request object - note: POST\r\n // reqBodyJson added to the req body\r\n const request = {\r\n method: httpMethod,\r\n headers: getHeaders(),\r\n // credentials: 'include',\r\n mode: 'cors',\r\n // convert JS Object to JSON and add to request body\r\n body: JSON.stringify(submitQueryObj)\r\n };\r\n\r\n // Try catch \r\n try {\r\n // Call fetch and await the respose\r\n // fetch url using request object\r\n const response = await fetch(url, request);\r\n const json = await response.json();\r\n\r\n // Output result to console (for testing purposes) \r\n console.log(json);\r\n\r\n // catch and log any errors\r\n } catch (err) {\r\n console.log(err);\r\n return err;\r\n }\r\n}", "function sendRankings() {\n var myRank = new Rank(highscoreName, lpm);\n var xhr = new XMLHttpRequest();\n xhr.open('POST', 'http://10.123.17.197:8080/submitscore', true);\n xhr.setRequestHeader('content-type', 'application/json;charset=UTF-8');\n xhr.send(JSON.stringify(myRank));\n}", "function submitCallback(data,page, handler){\n\tvar request = createRequest();\n\tif(request){\n\t\t\t// prepare request\n\t\t\trequest.open('POST', page, true);\n\t\t\trequest.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n\n\t\t\t// when the request is answered, relayResponse() will be called\n\t\t\trequest.onreadystatechange = function(){ relayResponse(request, handler); }\n\n\t\t\t// fire off the request\n\t\t\trequest.send(data);\n\t}\n\telse{\n\t\t// request object wasn't instantiated\n\t\thandler(false, 'Unable to create request object.');\n\t}\n}", "function Test1_Submit(event) {\n event.preventDefault(); \n sendGetRequest(loaddb, test1_loaddb_callback);\n }", "async function submitGETRequest(searchParameters = '') {\n\t\treturn fetch(serverEndpointGETurl + '?' + searchParameters, {\n\t\t\tmethod: 'GET',\n\t\t\theaders: {\n\t\t\t\t'Accept': 'application/json'\n\t\t\t}\n\t\t});\n\t}", "function main(){\n\ttry {\n\t\tsql.openConnection();\n\t\thandleRequest({\n\t\t\t\"POST\": handlePost\n\t\t});\n\t}\n\tcatch (e) {\n\t\tif (!httpStatus) {\t\t\t\n\t\t\thttpStatus = $.net.http.BAD_REQUEST;\n\t\t\t$.response.contentType = \"text/plain\";\n\t\t\t$.response.setBody(e.toString());\n\t\t}\n\t}\n\tfinally {\n\t\tsql.closeConnection();\n\t\t$.response.status = httpStatus || $.net.http.BAD_REQUEST;\n\t}\n}", "function serverCall(){\t\t \n\n\t\t chai.request(server)\n\t\t .post('/saveTAHistory')\n\t\t .send(requestBody)\n\t\t .end(function(error, response) {\n\t\t\t util.checkBasicStructureApplicantResp(response);\n\t\t\t done();\n\t\t });\n\t }", "function addRequest (req, res) {\r\n\tconsole.log ('POST /requests');\r\n\t//read input data from http body request\r\n\tlet myReq = new Request();\r\n\tmyReq.name = req.body.name;\r\n\t// add the new Target in the DB\r\n\tmyReq.save(function (err, requestSaved) {\r\n\t\tif (err) {\r\n\t\t\tres.status(500).send({ message : 'Error while saving the Request in the DB'});\r\n\t\t} else {\r\n\t\t\tres.status(200).send ({Request : requestSaved});\r\n\t\t}\r\n\t});\t\r\n}", "function doSubmit() {\n\t\t\t\t// make sure form attrs are set\n\t\t\t\tvar t = $form.attr2('target'),\n\t\t\t\t\ta = $form.attr2('action'),\n\t\t\t\t\tmp = 'multipart/form-data',\n\t\t\t\t\tet = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n\t\t\t\t// update form attrs in IE friendly way\n\t\t\t\tform.setAttribute('target', id);\n\t\t\t\tif (!method || /post/i.test(method)) {\n\t\t\t\t\tform.setAttribute('method', 'POST');\n\t\t\t\t}\n\t\t\t\tif (a !== s.url) {\n\t\t\t\t\tform.setAttribute('action', s.url);\n\t\t\t\t}\n\n\t\t\t\t// ie borks in some cases when setting encoding\n\t\t\t\tif (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n\t\t\t\t\t$form.attr({\n\t\t\t\t\t\tencoding : 'multipart/form-data',\n\t\t\t\t\t\tenctype : 'multipart/form-data'\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// support timout\n\t\t\t\tif (s.timeout) {\n\t\t\t\t\ttimeoutHandle = setTimeout(function() {\n\t\t\t\t\t\ttimedOut = true; cb(CLIENT_TIMEOUT_ABORT);\n\t\t\t\t\t}, s.timeout);\n\t\t\t\t}\n\n\t\t\t\t// look for server aborts\n\t\t\t\tfunction checkState() {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar state = getDoc(io).readyState;\n\n\t\t\t\t\t\tlog('state = ' + state);\n\t\t\t\t\t\tif (state && state.toLowerCase() === 'uninitialized') {\n\t\t\t\t\t\t\tsetTimeout(checkState, 50);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tlog('Server abort: ', e, ' (', e.name, ')');\n\t\t\t\t\t\tcb(SERVER_ABORT);\t\t\t\t// eslint-disable-line callback-return\n\t\t\t\t\t\tif (timeoutHandle) {\n\t\t\t\t\t\t\tclearTimeout(timeoutHandle);\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttimeoutHandle = undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// add \"extra\" data to form if provided in options\n\t\t\t\tvar extraInputs = [];\n\n\t\t\t\ttry {\n\t\t\t\t\tif (s.extraData) {\n\t\t\t\t\t\tfor (var n in s.extraData) {\n\t\t\t\t\t\t\tif (s.extraData.hasOwnProperty(n)) {\n\t\t\t\t\t\t\t\t// if using the $.param format that allows for multiple values with the same name\n\t\t\t\t\t\t\t\tif ($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n\t\t\t\t\t\t\t\t\textraInputs.push(\n\t\t\t\t\t\t\t\t\t$('<input type=\"hidden\" name=\"' + s.extraData[n].name + '\">', ownerDocument).val(s.extraData[n].value)\n\t\t\t\t\t\t\t\t\t\t.appendTo(form)[0]);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\textraInputs.push(\n\t\t\t\t\t\t\t\t\t$('<input type=\"hidden\" name=\"' + n + '\">', ownerDocument).val(s.extraData[n])\n\t\t\t\t\t\t\t\t\t\t.appendTo(form)[0]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!s.iframeTarget) {\n\t\t\t\t\t\t// add iframe to doc and submit the form\n\t\t\t\t\t\t$io.appendTo($body);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (io.attachEvent) {\n\t\t\t\t\t\tio.attachEvent('onload', cb);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tio.addEventListener('load', cb, false);\n\t\t\t\t\t}\n\n\t\t\t\t\tsetTimeout(checkState, 15);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tform.submit();\n\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t// just in case form has element with name/id of 'submit'\n\t\t\t\t\t\tvar submitFn = document.createElement('form').submit;\n\n\t\t\t\t\t\tsubmitFn.apply(form);\n\t\t\t\t\t}\n\n\t\t\t\t} finally {\n\t\t\t\t\t// reset attrs and remove \"extra\" input elements\n\t\t\t\t\tform.setAttribute('action', a);\n\t\t\t\t\tform.setAttribute('enctype', et); // #380\n\t\t\t\t\tif (t) {\n\t\t\t\t\t\tform.setAttribute('target', t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$form.removeAttr('target');\n\t\t\t\t\t}\n\t\t\t\t\t$(extraInputs).remove();\n\t\t\t\t}\n\t\t\t}", "function doSubmit() {\n\t\t\t\t// make sure form attrs are set\n\t\t\t\tvar t = $form.attr2('target'),\n\t\t\t\t\ta = $form.attr2('action'),\n\t\t\t\t\tmp = 'multipart/form-data',\n\t\t\t\t\tet = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n\t\t\t\t// update form attrs in IE friendly way\n\t\t\t\tform.setAttribute('target', id);\n\t\t\t\tif (!method || /post/i.test(method)) {\n\t\t\t\t\tform.setAttribute('method', 'POST');\n\t\t\t\t}\n\t\t\t\tif (a !== s.url) {\n\t\t\t\t\tform.setAttribute('action', s.url);\n\t\t\t\t}\n\n\t\t\t\t// ie borks in some cases when setting encoding\n\t\t\t\tif (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n\t\t\t\t\t$form.attr({\n\t\t\t\t\t\tencoding : 'multipart/form-data',\n\t\t\t\t\t\tenctype : 'multipart/form-data'\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// support timout\n\t\t\t\tif (s.timeout) {\n\t\t\t\t\ttimeoutHandle = setTimeout(function() {\n\t\t\t\t\t\ttimedOut = true; cb(CLIENT_TIMEOUT_ABORT);\n\t\t\t\t\t}, s.timeout);\n\t\t\t\t}\n\n\t\t\t\t// look for server aborts\n\t\t\t\tfunction checkState() {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar state = getDoc(io).readyState;\n\n\t\t\t\t\t\tlog('state = ' + state);\n\t\t\t\t\t\tif (state && state.toLowerCase() === 'uninitialized') {\n\t\t\t\t\t\t\tsetTimeout(checkState, 50);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tlog('Server abort: ', e, ' (', e.name, ')');\n\t\t\t\t\t\tcb(SERVER_ABORT);\t\t\t\t// eslint-disable-line callback-return\n\t\t\t\t\t\tif (timeoutHandle) {\n\t\t\t\t\t\t\tclearTimeout(timeoutHandle);\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttimeoutHandle = undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// add \"extra\" data to form if provided in options\n\t\t\t\tvar extraInputs = [];\n\n\t\t\t\ttry {\n\t\t\t\t\tif (s.extraData) {\n\t\t\t\t\t\tfor (var n in s.extraData) {\n\t\t\t\t\t\t\tif (s.extraData.hasOwnProperty(n)) {\n\t\t\t\t\t\t\t\t// if using the $.param format that allows for multiple values with the same name\n\t\t\t\t\t\t\t\tif ($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n\t\t\t\t\t\t\t\t\textraInputs.push(\n\t\t\t\t\t\t\t\t\t$('<input type=\"hidden\" name=\"' + s.extraData[n].name + '\">', ownerDocument).val(s.extraData[n].value)\n\t\t\t\t\t\t\t\t\t\t.appendTo(form)[0]);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\textraInputs.push(\n\t\t\t\t\t\t\t\t\t$('<input type=\"hidden\" name=\"' + n + '\">', ownerDocument).val(s.extraData[n])\n\t\t\t\t\t\t\t\t\t\t.appendTo(form)[0]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!s.iframeTarget) {\n\t\t\t\t\t\t// add iframe to doc and submit the form\n\t\t\t\t\t\t$io.appendTo($body);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (io.attachEvent) {\n\t\t\t\t\t\tio.attachEvent('onload', cb);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tio.addEventListener('load', cb, false);\n\t\t\t\t\t}\n\n\t\t\t\t\tsetTimeout(checkState, 15);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tform.submit();\n\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t// just in case form has element with name/id of 'submit'\n\t\t\t\t\t\tvar submitFn = document.createElement('form').submit;\n\n\t\t\t\t\t\tsubmitFn.apply(form);\n\t\t\t\t\t}\n\n\t\t\t\t} finally {\n\t\t\t\t\t// reset attrs and remove \"extra\" input elements\n\t\t\t\t\tform.setAttribute('action', a);\n\t\t\t\t\tform.setAttribute('enctype', et); // #380\n\t\t\t\t\tif (t) {\n\t\t\t\t\t\tform.setAttribute('target', t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$form.removeAttr('target');\n\t\t\t\t\t}\n\t\t\t\t\t$(extraInputs).remove();\n\t\t\t\t}\n\t\t\t}", "async send() {\n const Request = this;\n const xhr = Request.xhr;\n return new Promise((resolve, reject) => {\n Request.xhr.open(Request.requestType, Request.url, true);\n Request._prepHeaders.bind(Request)();\n Request.xhr.onload = () => {\n if (xhr.status >= 200 && xhr.status < 400) {\n var data = Request._processReturn(xhr.response);\n resolve(data);\n }\n reject(xhr);\n };\n Request.xhr.onerror = (event) => {\n reject(event);\n };\n // INITIATE AJAX REQUEST\n Request.xhr.send(Request.data);\n });\n }", "function _request(model, query64, _t){\n\t\t\t\t$.getJSON(_.template(model.API, { network: options.network || \"umg.fyre.co\" , query: query64} ), requestParams, \n\t\t\t\t\t\t_.bind(self.handleResponse, self, {requestCount:_batches.length, _batch: batch}, callback));\n\t\t\t}", "function sendRequest(ip, portNum, reqObj, callback) {\n\tvar options = {\n\t\thostname\t: ip,\n\t\tport\t\t: portNum,\n\t\tmethod \t\t: 'POST',\n\t\tpath \t\t: '/'\n\t};\n\treqObj['sender'] = reqObj.client;\n\tif(reqObj.client != null) {\n\t\tconsole.log(\"\\nCLIENT SENDING REQUEST!! : \" + JSON.stringify(reqObj) + \": ip: \" + ip + \", port: \"+ portNum + \"\\n\");\n\t}\n\n\tvar req = http.request(options, (callback != null)? callback : handleResponse);\n\tvar reqText = JSON.stringify(reqObj);\n\treq.write(reqText);\n\treq.end();\n}", "function sendRequest({url, method = 'GET', headers, body = null}) {\n // let customBody = null;\n return fetch(BASE_SERVER_PATH + url + '?v=1.0.0', {\n method,\n headers,\n body,\n });\n }", "function POST(){\n \n}", "makeRequest() {\r\n // Get Parameter Values\r\n let requestString = [];\r\n\r\n // Make Request\r\n this.getPrologRequest(requestString, this.handleReply);\r\n }", "function sendRequest(requestType, resultCallback, formData) {\r\n\tconst username = getUrlVars()[\"user\"];\r\n\tconst md5 = getUrlVars()[\"md5\"];\r\n\tdisplayProcessing(true);\r\n\tvar data = {\r\n\t\t\"username\": username,\r\n\t\t\"md5\": md5,\r\n\t\t\"requestType\": requestType,\r\n\t\t\"formData\": formData\r\n\t};\r\n\tfetch('https://web.njit.edu/~emo26/front_end.php', {\r\n\t\tmethod: 'POST',\r\n\t\tbody: JSON.stringify(data)\r\n\t})\r\n\t\t.then((response) => {\r\n\t\t\treturn response.json();\r\n\t\t})\r\n\t\t.then((json) => {\r\n\t\t\tconsole.log(json);\r\n\t\t\tdisplayProcessing(false);\r\n\t\t\tif (json.result == 'success') {\r\n\t\t\t\tresultCallback(json);\r\n\t\t\t} else if (json.result == 'loginFailed') {\r\n\t\t\t\tshow('loginError');\r\n\t\t\t} else {\r\n\t\t\t\tshow('systemError');\r\n\t\t\t}\r\n\t\t})\r\n\t\t.catch((error) => {\r\n\t\t\t//console.error('Error:', error);\r\n\t\t\tdisplayProcessing(false);\r\n\t\t\tshow('systemError');\r\n\t\t});\r\n}" ]
[ "0.72014797", "0.71862864", "0.69028234", "0.67675024", "0.6499329", "0.6478708", "0.64329374", "0.64026445", "0.6373778", "0.6352997", "0.63100094", "0.62747645", "0.62654495", "0.6207608", "0.6181739", "0.6170301", "0.6162716", "0.61251944", "0.6104236", "0.6056248", "0.6047513", "0.6047033", "0.60453194", "0.60190314", "0.5997917", "0.5997917", "0.5993052", "0.5991765", "0.5987545", "0.59801954", "0.5975655", "0.59623504", "0.59560466", "0.59499", "0.5944407", "0.59137124", "0.591361", "0.5911329", "0.59097147", "0.59074664", "0.59051424", "0.5903999", "0.5889985", "0.5885", "0.587691", "0.5868865", "0.5867813", "0.5867291", "0.5865934", "0.58603644", "0.58515966", "0.5847715", "0.584118", "0.5834676", "0.58325535", "0.58165056", "0.58059907", "0.58043855", "0.5797956", "0.57885224", "0.5778864", "0.5778191", "0.577428", "0.5754701", "0.57476145", "0.57247835", "0.5724537", "0.5719939", "0.5714769", "0.57132554", "0.5711943", "0.57093674", "0.57075703", "0.570197", "0.5700331", "0.56973016", "0.5693375", "0.5684027", "0.56748396", "0.56710285", "0.5664044", "0.565555", "0.5654677", "0.5650253", "0.565021", "0.56477803", "0.5642562", "0.5640273", "0.56378466", "0.563351", "0.56274635", "0.5626654", "0.56250226", "0.56250226", "0.5622775", "0.56139356", "0.5613445", "0.56133467", "0.5612874", "0.5609941", "0.56072617" ]
0.0
-1
Checks all relevant input fields for validity
function validateInput() { if (!keyCodeValid || !accountCodeValid || ($("#keyCodeCP").val() == "" && isAcctAllEmpty()) || $("#desc").val() == "" || $("#instruct").val() == "" || $("#instruct").val().length > 65535) { $("#submitCP").button("option", "disabled", true); } else { $("#submitCP").button("option", "disabled", false); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validateFields(){\n\tif(!getValue('nombreID')\n\t\t|| !getValue('contactoID') \n\t\t|| !getValue('estadoID')\n\t\t|| !getValue('ciudadID') \n\t\t|| !getValue('shortDesc') \n\t\t|| !getValue('longDesc')\n\t\t|| !isChecked('lblCheck'))\n\t\treturn 0;\n\telse\n\t\treturn 1;\n}", "checkValidity () {\n\n // Validate generic fields\n let fields = this.getFieldsForType('generic');\n for (let i in fields) {\n const valid = this.input[fields[i]].checkValidity();\n if (!valid) return false;\n };\n\n // Adjust source validation based on selected format\n const type = this.input.type.value;\n if (type === 'image' || type === 'video') {\n const format = this.input[`${type}_format`].value;\n this.input[`${type}_source`].pattern = `^.+${format}$`;\n }\n\n // Validate type specific fields\n fields = this.getFieldsForType(type);\n for (let i in fields) {\n const valid = this.input[`${type}_${fields[i]}`].checkValidity();\n if (!valid) return false;\n };\n\n return true;\n }", "validateInputs() {\n let inps = [].concat(\n this.queryAll(\"lightning-combobox\"),\n this.queryAll(\"lightning-input-field\"),\n );\n return inps.filter(inp => !inp.reportValidity()).length === 0;\n }", "function checkFormValidity() {\n var inputs = document.querySelectorAll('input'),\n i;\n\n for (i = 0; i < inputs.length; i = i + 1) {\n customCheckValidity(inputs[i]);\n }\n }", "function validateInputs() {\n\n let isValid = true;\n\n if (workoutType === \"resistance\") {\n if (nameInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (weightInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (setsInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (repsInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (resistanceDurationInput.value.trim() === \"\") {\n isValid = false;\n }\n } else if (workoutType === \"cardio\") {\n if (cardioNameInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (durationInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (distanceInput.value.trim() === \"\") {\n isValid = false;\n }\n }\n\n if (isValid) {\n completeButton.removeAttribute(\"disabled\");\n addButton.removeAttribute(\"disabled\");\n } else {\n completeButton.setAttribute(\"disabled\", true);\n addButton.setAttribute(\"disabled\", true);\n }\n }", "function validateInputs() {\n let invalidEmail = false;\n let invalidPassword = false;\n let invalidFirstName = false;\n let invalidLastName = false;\n\n if (\n !/^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/.test(\n email.toLowerCase()\n )\n ) {\n invalidEmail = true;\n }\n\n if (password.length <= 0) {\n invalidPassword = true;\n }\n\n if (firstName.length <= 0) {\n invalidFirstName = true;\n }\n\n if (lastName.length <= 0) {\n invalidLastName = true;\n }\n\n setInvalidInputs({\n password: invalidPassword,\n email: invalidEmail,\n firstName: invalidFirstName,\n lastName: invalidLastName,\n });\n\n if (\n invalidEmail ||\n invalidFirstName ||\n invalidLastName ||\n invalidPassword\n ) {\n return false;\n }\n\n return true;\n }", "validateAll () {\n for (let fieldID of Object.keys(this.fields)) {\n this.fields[fieldID].validate()\n }\n }", "validateInput()\n {\n return this.refs.date.isValid()\n && this.refs.amount.isValid()\n && this.refs.account.isValid()\n }", "function checkInputs() {\n $('input, textarea').blur(function() {\n if ($(this).val().length < 1) {\n $(this).addClass('error');\n } else {\n $(this).removeClass('error');\n }\n });\n }", "function validateFields() {\n var validated = false;\n for (var i = 0; i < input_list.length; i++) {\n //loop through array of inputs in input_list defined at top of page.\n if (input_list[i].value.toString().trim() != \"\") {\n validated = true;\n }\n }\n return validated;\n }", "function checkInputs() {\r\n // get input VALUES\r\n\r\n const usernameValue = username.value.trim();\r\n const emailValue = email.value.trim();\r\n const passwordValue = password.value.trim();\r\n const passwordCheckValue = passwordCheck.value.trim();\r\n\r\n // USERNAME CHECK\r\n\r\n if (usernameValue === '' || usernameValue === null) {\r\n // add error class (analogous to ToDo project)\r\n\r\n setErrorFor(username, 'Username cannot be blank');\r\n } else {\r\n setSuccessFor(username)\r\n }\r\n\r\n // EMAIL CHECK\r\n\r\n if (emailValue === '') {\r\n // add error class (analogous to ToDo project)\r\n\r\n setErrorFor(email, 'E-mail cannot be blank');\r\n } else if (!emailIsValid(emailValue)) {\r\n setErrorFor(email, 'E-mail is not valid.');\r\n } else {\r\n setSuccessFor(email);\r\n }\r\n\r\n //PASSWORD CHECK\r\n\r\n if (passwordValue === '' || passwordValue === null) {\r\n // add error class (analogous to ToDo project)\r\n\r\n setErrorFor(password, 'Password cannot be blank');\r\n } else {\r\n setSuccessFor(password)\r\n }\r\n\r\n // PASSWORD CHECK CHECK\r\n\r\n if (passwordCheckValue === '' || passwordCheckValue === null) {\r\n // add error class (analogous to ToDo project)\r\n\r\n setErrorFor(passwordCheck, 'Password check cannot be blank');\r\n } else if (passwordCheckValue !== passwordValue) {\r\n setErrorFor(passwordCheck, 'Password check must equal password');\r\n setErrorFor(password, 'Password check must equal password');\r\n } else {\r\n setSuccessFor(passwordCheck);\r\n }\r\n}", "formValidate() {\n\t\tconst allValid = [\n\t\t\t...this.template.querySelectorAll('lightning-input, lightning-combobox')\n\t\t].reduce((validSoFar, inputCmp) => {\n\t\t\tinputCmp.reportValidity();\n\t\t\treturn validSoFar && inputCmp.checkValidity();\n\t\t}, true);\n\t\treturn allValid;\n }", "function verify_inputs(){\n if(document.getElementById(\"Split_By\").value == ''){\n return false;\n }\n if(document.getElementById(\"Strength\").value == ''){\n return false;\n }\n if(document.getElementById(\"Venue\").value == ''){\n return false;\n }\n if(document.getElementById(\"season_type\").value == ''){\n return false;\n }\n if(document.getElementById(\"adjustmentButton\").value == ''){\n return false;\n }\n\n return true\n }", "inputsCheck() {\r\n\r\n if (this.namealert.css(\"display\") == \"none\" && this.emailalert.css(\"display\") == \"none\" && this.phonealert.css(\"display\") == \"none\" && this.agealert.css(\"display\") == \"none\" && this.passwordalert.css(\"display\") == \"none\" && this.repasswordalert.css(\"display\") == \"none\") {\r\n if (this.name.val() != \"\" && this.email.val() != \"\" && this.phone.val() != \"\" && this.age.val() != \"\" && this.password.val() != \"\" && this.rePassword.val() != \"\") {\r\n this.submitBtn.removeAttr(\"disabled\");\r\n }\r\n }\r\n\r\n }", "function allValid(inputs, ignoreInvalid){\n\tconsole.log('Ignore invalid set to: ' + ignoreInvalid);\n\tif(ignoreInvalid) {\n\t\tconsole.log('allValid: returning [ true ]');\n\t\treturn true;\n\t}\n\tconsole.log('AllValid: Performing Checks');\n let valid = true;\n\tinputs.map(e => {\n\t\t/*\n\t\t* Sweeps the array, if any field is empty, the form is set to invalid.\n\t\t* Also, sets all inputs to valid.\n\t\t*/\n\t\te.invalid = false;\n\t\tif(e.value == \"\"){\n\t\t\te.invalid = true;\n\t\t\tvalid = false;\n\t\t}\n\t});\n \n\t/*\n\t* Name must be: only letters.\n\t*/\n\tlet nameInput = getInput(inputs, \"Name\");\n\tif(nameInput.value.length > 20 || !/^[a-zA-Z-,]+(\\s{0,1}[a-zA-Z-, ])*$/.test(nameInput.value)){\n\t\t//If the name is a string with only characters, and size smaller than 20.\n\n\t\tconsole.log('Invalid Name');\n\t\tnameInput.invalid = true;\n\t\tvalid = false;\n\t}\n \n\t/*\n\t* Age: only numbers ranging from 0 to 60.\n\t*/\n\tlet ageInput = getInput(inputs, \"Age\");\n\tif(ageInput.value <= 0 || ageInput.value >= 60){\n\t\t//If age is a natural integer smaller than 60\n\n\t\tconsole.log('Invalid Age');\n\t\tageInput.invalid = true;\n\t\tvalid = false;\n\t}\n\n\t/*\n\t* Phone: only numbers. String must be 11 chars long.\n\t*/\n\tlet phoneInput = getInput(inputs, \"Phone\");\n\tif(phoneInput.value.length != 11){\n\t\t//If phone number's length is not 11.\n\n\t\tphoneInput.invalid = true;\n\t\tconsole.log('Invalid Phone');\n\t\tvalid = false;\n\t}\n\n\t/*\n\t* Password: Password and Validade Password must be equals.\n\t*/\n\tlet passInput = getInput(inputs, \"Password\");\n\tlet validPassInput = getInput(inputs, \"ValidatePassword\");\n\tif(!passInput.invalid){\n\t\t//If password is not empty\n\n\t\tif(passInput.value != validPassInput.value ){\n\t\t\t//If password and validPassword are not the same.\n\n\t\t\tvalidPassInput.invalid = true;\n\t\t\tconsole.log('Unmatching Passwords');\n\t\t\tvalid = false;\n\t\t}\n\t} else {\n\t\tvalidPassInput.invalid = false;\n\t}\n\tconsole.log('allValid: returning [ '+ valid +' ]');\n\treturn valid;\n}", "function onValidation() {\n\tclearErrors();\n\n\tvar allValidReq = checkRequiredFields();\n\tvar allValidDob = true;\n\tif ($.inArray(\"dob\", getRequiredFields()) > 0)\n\t{\n\t\tallValidDob = checkValidDob();\n\t}\n\t\n\tvar allValidNames = checkValidNames();\n\n\tif ($(\"#usSocialSecurityNumber\").length) {\n\t\tallValidNames = allValidNames && checkSSN();\n\t}\n\t\n\tvar allValidAddress = true;\n\tif (countryIsUSA()) {\n\t\tallValidAddress = checkValidUSAAddress();\n\t}\n\t\n\treturn allValidReq && allValidDob && allValidNames & allValidAddress;\n}", "function validateForm() {\n validateFirstName();\n validateLastName();\n validateStreet();\n validateCity();\n validateZipCode();\n}", "function checkField(){\n // skip testing fields whom their type is not HIDDEN but they are HIDDEN via CSS.\n if( this.type !='hidden' && $(this).is(':hidden') )\n return true;\n\n prepareFieldData(this);\n\n field.data( 'val', field[0].value.replace(/^\\s+|\\s+$/g, \"\") ); // cache the value of the field and trim it\n data = field.data();\n\n // Check if there is a specific error message for that field, if not, use the default 'invalid' message\n alertTxt = message[field.prop('name')] || message.invalid;\n\n // Special treatment\n if( field[0].nodeName.toLowerCase() === \"select\" ){\n data.type = 'select';\n }\n else if( field[0].nodeName.toLowerCase() === \"textarea\" ){\n data.type = 'text';\n }\n /* Gather Custom data attributes for specific validation:\n */\n validateWords = data['validateWords'] || 0;\n lengthRange = data['validateLengthRange'] ? (data['validateLengthRange']+'').split(',') : [1];\n lengthLimit = data['validateLength'] ? (data['validateLength']+'').split(',') : false;\n minmax = data['validateMinmax'] ? (data['validateMinmax']+'').split(',') : ''; // for type 'number', defines the minimum and/or maximum for the value as a number.\n\n data.valid = tests.hasValue(data.val);\n\n if( field.hasClass('optional') && !data.valid )\n data.valid = true;\n\n\n // for checkboxes\n if( field[0].type === \"checkbox\" ){\n data.valid = field[0].checked;\n alertTxt = message.checked;\n }\n\n // check if field has any value\n else if( data.valid ){\n /* Validate the field's value is different than the placeholder attribute (and attribute exists)\n * this is needed when fixing the placeholders for older browsers which does not support them.\n * in this case, make sure the \"placeholder\" jQuery plugin was even used before proceeding\n */\n if( tests.sameAsPlaceholder(field) ){\n alertTxt = message.empty;\n data.valid = false;\n }\n\n // if this field is linked to another field (their values should be the same)\n if( data.validateLinked ){\n var linkedTo = data['validateLinked'].indexOf('#') == 0 ? $(data['validateLinked']) : $(':input[name=' + data['validateLinked'] + ']');\n data.valid = tests.linked( data.val, linkedTo.val() );\n }\n /* validate by type of field. use 'attr()' is proffered to get the actual value and not what the browsers sees for unsupported types.\n */\n else if( data.valid || data.type == 'select' )\n data.valid = testByType(data.type, data.val);\n\n }\n\n // mark / unmark the field, and set the general 'submit' flag accordingly\n if( data.valid )\n unmark( field );\n else{\n mark( field, alertTxt );\n submit = false;\n }\n\n return data.valid;\n }", "function checkField(){\n // skip testing fields whom their type is not HIDDEN but they are HIDDEN via CSS.\n if( this.type !='hidden' && $(this).is(':hidden') )\n return true;\n\n prepareFieldData(this);\n\n field.data( 'val', field[0].value.replace(/^\\s+|\\s+$/g, \"\") ); // cache the value of the field and trim it\n data = field.data();\n\n // Check if there is a specific error message for that field, if not, use the default 'invalid' message\n alertTxt = message[field.prop('name')] || message.invalid;\n\n // Special treatment\n if( field[0].nodeName.toLowerCase() === \"select\" ){\n data.type = 'select';\n }\n else if( field[0].nodeName.toLowerCase() === \"textarea\" ){\n data.type = 'text';\n }\n /* Gather Custom data attributes for specific validation:\n */\n validateWords = data['validateWords'] || 0;\n lengthRange = data['validateLengthRange'] ? (data['validateLengthRange']+'').split(',') : [1];\n lengthLimit = data['validateLength'] ? (data['validateLength']+'').split(',') : false;\n minmax = data['validateMinmax'] ? (data['validateMinmax']+'').split(',') : ''; // for type 'number', defines the minimum and/or maximum for the value as a number.\n\n data.valid = tests.hasValue(data.val);\n\n if( field.hasClass('optional') && !data.valid )\n data.valid = true;\n\n\n // for checkboxes\n if( field[0].type === \"checkbox\" ){\n data.valid = field[0].checked;\n alertTxt = message.checked;\n }\n\n // check if field has any value\n else if( data.valid ){\n /* Validate the field's value is different than the placeholder attribute (and attribute exists)\n * this is needed when fixing the placeholders for older browsers which does not support them.\n * in this case, make sure the \"placeholder\" jQuery plugin was even used before proceeding\n */\n if( tests.sameAsPlaceholder(field) ){\n alertTxt = message.empty;\n data.valid = false;\n }\n\n // if this field is linked to another field (their values should be the same)\n if( data.validateLinked ){\n var linkedTo = data['validateLinked'].indexOf('#') == 0 ? $(data['validateLinked']) : $(':input[name=' + data['validateLinked'] + ']');\n data.valid = tests.linked( data.val, linkedTo.val() );\n }\n /* validate by type of field. use 'attr()' is proffered to get the actual value and not what the browsers sees for unsupported types.\n */\n else if( data.valid || data.type == 'select' )\n data.valid = testByType(data.type, data.val);\n\n }\n\n // mark / unmark the field, and set the general 'submit' flag accordingly\n if( data.valid )\n unmark( field );\n else{\n mark( field, alertTxt );\n submit = false;\n }\n\n return data.valid;\n }", "function validateInputs() {\n var valid = true;\n\n var displayNameValid = /^([a-zA-Z]+[a-zA-Z0-9]*)$/.test(displayNameInput.val());\n if (displayNameInput.val() && !displayNameValid) {\n displayNameAlert.show();\n valid = false;\n }\n\n var emailValid = /^([a-zA-Z0-9]+[a-zA-Z0-9\\.\\_]*\\@[a-zA-Z]+\\.[a-zA-Z]+)$/.test(emailInput.val());\n if (emailInput.val() && !emailValid) {\n emailAlert.show();\n valid = false;\n }\n\n var phoneValid = /^(\\d{3}-\\d{3}-\\d{4})$/.test(phoneInput.val());\n if (phoneInput.val() && !phoneValid) {\n phoneAlert.show();\n valid = false;\n }\n\n var zipcodeValid = /^(\\d{5}(-\\d{4})?)$/.test(zipcodeInput.val());\n if (zipcodeInput.val() && !zipcodeValid) {\n zipcodeAlert.show();\n valid = false;\n }\n\n var passwordValid = passwordInput.val() == passwordConfirmationInput.val();\n if ((passwordInput.val() || passwordConfirmationInput.val()) \n && !passwordValid) {\n passwordAlert.show();\n valid = false;\n }\n\n return valid;\n }", "function validateInputs() {\n let isValid = true;\n\n if (workoutType === \"resistance\") {\n if (nameInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (weightInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (setsInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (repsInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (resistanceDurationInput.value.trim() === \"\") {\n isValid = false;\n }\n } else if (workoutType === \"cardio\") {\n if (cardioNameInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (durationInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (distanceInput.value.trim() === \"\") {\n isValid = false;\n }\n }\n\n if (isValid) {\n completeButton.removeAttribute(\"disabled\");\n addButton.removeAttribute(\"disabled\");\n } else {\n completeButton.setAttribute(\"disabled\", true);\n addButton.setAttribute(\"disabled\", true);\n }\n}", "function checkInputLengths() {\n return (\n nameInput.value.length === 0 ||\n emailInput.value.length === 0 ||\n dobInput.value.length === 0 ||\n stateInput.value.length === 0\n );\n }", "function validate($form) {\n\t\tvar allValid = true;\n\t\t$form.find('.input-field.text-field').each(function() {\n\t\t\tif (!$(this).hasClass('filled')) {\n\t\t\t\tinvalid($(this), 'Required');\n\t\t\t\tallValid = false;\n\t\t\t} else {\n\t\t\t\tvalid($(this));\n\t\t\t}\n\t\t});\n\t\t$form.find('.input-field input[name=zipcode]').each(function() {\n\t\t\tvar length = $(this).val().length;\n\t\t\tif (length === 0) {\n\t\t\t\tinvalid($(this), 'Required');\n\t\t\t\tallValid = false;\n\t\t\t} else if (length !== 5) {\n\t\t\t\tinvalid($(this), 'Invalid postal code');\n\t\t\t\tallValid = false;\n\t\t\t}\n\t\t});\n\t\t$form.find('.input-field input[name=phonenumber]').each(function() {\n\t\t\tvar $input = $(this);\n\t\t\tvar length = $input.val().length;\n\t\t\tif (length == 10 || length == 11) valid($input);\n\t\t\telse {\n\t\t\t\tallValid = false;\n\t\t\t\tif (length == 7) invalid($input, 'Please include your area code');\n\t\t\t\telse if (length == 0) invalid($input, 'Required');\n\t\t\t\telse invalid($input, 'Invalid phone number');\n\t\t\t}\n\t\t});\n\t\tvar $emailInput = $form.find('.input-field input[name=email]');\n\t\tif ($emailInput.val().length == 0) {\n\t\t\tinvalid($emailInput, 'Required');\n\t\t\tallValid = false;\n\t\t} else if (!validateEmail($emailInput.val())) {\n\t\t\tinvalid($emailInput, 'Invalid email address');\n\t\t\tallValid = false;\n\t\t} else {\n\t\t\tvalid($emailInput);\n\t\t}\n\t\tvar $birthdayInput = $form.find('.birthday input[name=birthday]');\n\t\tvar date = $birthdayInput.val();\n\t\tif(date.length == 0){\n\t\t\tinvalid($birthdayInput, 'Required');\n\t\t\tallValid = false;\n\t\t} else{\n\t\t\tvar year = parseInt(date.split('-')[0]);\n\t\t\tvar age = new Date().getFullYear() - year;\n\t\t\tif(age > 100 || age < 12){\n\t\t\t\tinvalid($birthdayInput, 'Invalid Date');\n\t\t\t\tallValid = false;\n\t\t\t} else{\n\t\t\t\tvalid($birthdayInput);\n\t\t\t}\n\t\t}\n\t\treturn allValid;\n\t}", "function check_required_fields(inputObj) {\n \t\n \tvar isValid = true;\n \t$(inputObj).each(function(){\n\n \t\tif (!notempty($(this).attr('id'))) {\n \t\t\tisValid = false;\n \t\t\treturn isValid;\n \t\t}\n \t});\n \treturn isValid;\n }", "function validateFields() {\n var validated = false;\n for (var i = 0; i < input_list.length; i++) {\n //loop through array of inputs in input_list defined at top of page.\n if (input_list[i].value.toString().trim() != \"\") {\n validated = true;\n }\n }\n return validated;\n}", "function checkFields() {\n\t$('#appointmentInput > input').keyup(function() {\n\n var empty = false;\n $('#appointmentInput > input').each(function() {\n if ($(this).val() == '') {\n empty = true;\n }\n });\n \n if (!empty) {\n \t$('#saveAppointment').removeAttr('disabled'); \n }\n });\n}", "function checkInputs() {\n const nameValue = name.value.trim();\n const emailValue = email.value.trim();\n const ageValue = age.value.trim();\n const messageValue = message.value.trim();\n\n let isSuccessful = true;\n if(isNameValid(nameValue)) {\n setSuccessFor(name);\n } else {\n isSuccessful = false;\n setErrorFor(name, 'Name cannot be less that 2 charachters');\n }\n\n if(isEmailValid(emailValue)) {\n setSuccessFor(email);\n } else {\n isSuccessful = false;\n setErrorFor(email, 'Email is not valid');\n }\n\n if(isAgeValid(ageValue)) {\n setSuccessFor(age);\n } else {\n isSuccessful = false;\n setErrorFor(age, 'You must be 18 or over to send this contact form');\n }\n\n if(isMessageValid(messageValue)) {\n setSuccessFor(message);\n } else {\n isSuccessful = false;\n setErrorFor(message, 'Message must be between 10 and 200 characters');\n }\n\n return isSuccessful;\n}", "function js_validate_fields(text){\n\n\tvar canContinue = true;\n \n\tjQuery('.required-active').each(function(i, obj) {\t\t\n\t\tjQuery(obj).removeClass('required-active');\t\t\t\t\t \n\t});\t\n\t\n \tjQuery('.required-field').each(function(i, obj) {\t\t\n\t\t\t\t\n\t\tif(jQuery(obj).val() == \"\"){\t\t\t\n\t\t\tjQuery(obj).addClass('required-active').focus();\t\t\t\t\n\t\t\tcanContinue = false;\n\t\t}\t\t\n\t});\n\t\n \tjQuery('.val-numeric').each(function(i, obj) {\t\n\t\t \n\t\tif(jQuery(obj).val() === \"\" ){\t\t\t\t\n\t\t\tjQuery(obj).addClass('required-active').focus();\t\t\t\t\n\t\t\tcanContinue = false;\n\t\t}\t\t\n \n\t});\n\t\n\tif(canContinue){\n\t\treturn true;\n\t} else {\n\t\talert(text);\n\t\treturn false;\n\t}\n}", "inputsValidated() {\n if (this.state.email === \"\") {\n // email field is empty\n alert(\"Email field must be filled out\");\n return false;\n }\n\n if (this.state.first_name === \"\") {\n // first name field is empty\n alert(\"First name field must be filled out\");\n return false;\n }\n\n if (this.state.last_name === \"\") {\n // last name field is empty\n alert(\"Last name field must be filled out\");\n return false;\n }\n\n if (this.state.password === \"\") {\n // last name field is empty\n alert(\"Password field must be filled out\");\n return false;\n }\n\n if (this.state.password !== this.state.passwordConfirm) {\n alert(\"Password fields must match. Try again\");\n return false;\n }\n return true;\n }", "function formIsValid() {\n if (total_loan_box.value === \"\" || isNaN(total_loan_box.value)) {\n speakToUser(\"You must enter a valid decimal number for the <strong>Total Loan Amount</strong>.\");\n focusOnBox(\"total_loan\");\n return false;\n }\n\n if (interest_rate_box.value === \"\" || isNaN(interest_rate_box.value)) {\n speakToUser(\"You must enter a valid decimal number for the <strong>Yearly Interest Rate</strong>.\");\n focusOnBox(\"interest_rate\");\n return false;\n }\n\n if (loan_term_box.value === \"\" || isNaN(loan_term_box.value)) {\n speakToUser(\"You must enter a valid number of years for the <strong>Loan Term</strong>.\");\n focusOnBox(\"loan_term\");\n return false;\n }\n\n return true;\n}", "function validationInputs(strField)\n{\n\tvar objForm = document.forms[afmInputsFormName];\n\tvar objValue = objForm.elements[strField];\n\tvar bReturned = true;\n\n\tif(strField == \"\")\n\t{\n\t\t//set values input to empty\n\t\tobjValue.value = \"\";\n\t}\n\telse if(objValue.value != \"\")\n\t{\n\t\t//validation\n\t\tvar maxsize = arrFieldsInformation[strField][\"size\"];\n\t\tmaxsize = parseInt(maxsize);\n\t\tvar format = arrFieldsInformation[strField][\"format\"];\n\t\tvar formatUpperCase = format.toUpperCase();\n\t\tvar type = arrFieldsInformation[strField][\"type\"];\n\t\tvar typeUpperCase = type.toUpperCase();\n\t\tvar decimal = arrFieldsInformation[strField][\"decimal\"];\n\n\t\t//check integer\n\t\tif(typeUpperCase==\"JAVA.LANG.INTEGER\")\n\t\t{\n\t\t\tif(!validationIntegerOrSmallint(objValue, true))\n\t\t\t\tbReturned = false;\n\t\t}\n\t\t//check numeric\n\t\telse if(typeUpperCase==\"JAVA.LANG.DOUBLE\" || typeUpperCase==\"JAVA.LANG.FLOAT\")\n\t\t{\n\t\t\tif(!validationNumeric(objValue,decimal, true))\n\t\t\t\tbReturned = false;\n\t\t}\n\n\t\t//check UPPERALPHANUM\n\t\tif(formatUpperCase==\"UPPERALPHANUM\")\n\t\t{\n\t\t\tobjValue.value = (objValue.value).toUpperCase();\n\t\t\tif(!validationUPPERALPHANUMString(objValue))\n\t\t\t\tbReturned = false;\n\t\t}\n\t\t//check UPPERALPHA\n\t\telse if(formatUpperCase==\"UPPERALPHA\")\n\t\t{\n\t\t\tobjValue.value = (objValue.value).toUpperCase();\n\t\t\tif(!validationUPPERALPHAString(objValue))\n\t\t\t\tbReturned = false;\n\t\t}\n\t\telse if(formatUpperCase==\"UPPER\")\n\t\t{\n\t\t\tobjValue.value = (objValue.value).toUpperCase();\n\t\t}\n\n\t\t//check maxsize(skip date and time fields)\n\t\tif(typeUpperCase!= \"JAVA.SQL.DATE\" && typeUpperCase!= \"JAVA.SQL.TIME\")\n\t\t{\n\t\t\tif(!validationDataMaxSize(objValue, arrFieldsInformation[strField]))\n\t\t\t\tbReturned = false;\n\t\t}\n\t}\n\treturn bReturned;\n}", "validateFormFields() {\n const excludeNames = [\n `redirect`,\n `ip_address`,\n `ipAddress`,\n `ip`,\n `system`\n ];\n\n for (const [fieldName, fieldSettings] of Object.entries(\n this.formConfig.fields\n )) {\n let fieldValue = this.payload[fieldName];\n\n const field = fieldSettings;\n\n field.name = fieldName;\n field.value = this.validateField(\n fieldValue,\n fieldName,\n fieldSettings\n );\n\n if (field.value) {\n this.filteredFormFields.push(field);\n }\n }\n\n return this.hasErrors() === false;\n }", "validateAllDirty () {\n for (let fieldID of Object.keys(this.fields)) {\n let field = this.fields[fieldID]\n\n if (field.dirty) {\n field.validate()\n }\n }\n }", "function isValidInputs() {\n\tvar totalQtyToShip = Number($(\"totalQty\").innerHTML);\n\tvar totalAvailableQty = Number($(\"totalAvailableQty\").innerHTML);\n\t\n\tif (totalQtyToShip > Number($v(\"qtyToPick\"))) {\n\t\talert(messagesData.shipMoreThanQtyToPick);\n\t\treturn false;\n\t} else if (\"Y\" === $v(\"originInspectionRequired\") && totalQtyToShip != Number($v(\"qtyToPick\"))) {\n\t\talert(messagesData.partialShipOIOrder);\n\t\treturn false;\n\t} else if (\"Y\" === $v(\"mfgDateRequired\")) {\n\t\tfor (var curRowId = 1; curRowId <= beanGrid.getRowsNum(); curRowId++)\n\t\t\tif (isWhitespace(cellValue(curRowId, \"dateOfManufacture\")) && cellValue(curRowId, \"allocated\") === 'true') {\n\t\t\t\talert(messagesData.valueRequiredOnRow.replace(\"{0}\", messagesData.dateOfManufacture).replace(\"{1}\", curRowId));\n\t\t\t\treturn false;\n\t\t\t}\n\t}\n\t\n\treturn true;\n}", "function validarInputs (){\n for (var i = 0; i < elementos.length; i++) {\n // Identificamos si el elemento es de tipo texto, email, password, radio o checkbox\n if (elementos[i].type == \"text\" || elementos[i].type == \"email\" || elementos[i].type == \"password\") {\n // Si es tipo texto, email o password vamos a comprobar que esten completados los input\n if (elementos[i].value.length == 0) {\n console.log('El campo ' + elementos[i].name + ' esta incompleto');\n elementos[i].className = elementos[i].className + \" error\";\n return false;\n } else {\n elementos[i].className = elementos[i].className.replace(\" error\", \"\");\n }\n }\n }\n return true;\n }", "function validateFieldsUP(){\n \n var namePark = document.getElementById('txtName');\n var location = document.getElementById('txtLocation');\n var contact = document.getElementById('txtContact');\n var description = document.getElementById('txtDescription');\n var emptyName = false, emptyLocation = false, emptyContact = false, \n emptyDescription = false;\n \n if(namePark.value.length < 2){//el parque est� vacio\n document.getElementById('msgErrorName').style.visibility = \"visible\";\n emptyName = true;\n }else{\n document.getElementById('msgErrorName').style.visibility = \"hidden\";\n }//end else \n \n if(location.value.length < 2){//La locacion est� vacia\n document.getElementById('msgErrorLocation').style.visibility = \"visible\";\n emptyLocation = true;\n }else{\n document.getElementById('msgErrorLocation').style.visibility = \"hidden\";\n }//end else\n \n if(contact.value.length < 2){//La locacion est� vacia\n document.getElementById('msgErrorContact').style.visibility = \"visible\";\n emptyContact = true;\n }else{\n document.getElementById('msgErrorContact').style.visibility = \"hidden\";\n }//end else\n \n if(description.value.length < 2){//La locacion est� vacia\n document.getElementById('msgErrorDescription').style.visibility = \"visible\";\n emptyDescription = true;\n }else{\n document.getElementById('msgErrorDescription').style.visibility = \"hidden\";\n }//end else\n \n if(emptyContact === true || emptyDescription === true || \n emptyLocation === true || emptyName === true){\n return false;\n }else{\n return true;\n }\n}", "function formValidation(){\n //If-else statement for every item I want to check:\n submitButton.on(\"click\", function(event){\n if(name.val() === ''){\n event.preventDefault();\n $('#name-invalid').html('<p>*You must enter a name.</p>');\n $(window).scrollTop(0);\n name.addClass(\"invalid-field\");\n } else {\n $('#name-invalid').html(''); \n name.removeClass(\"invalid-field\");\n };\n if(emailField.val().match(emailRegex) === null){\n event.preventDefault();\n $('#email-invalid').html('<p>*You must enter a valid email address.</p>');\n $(window).scrollTop(0);\n emailField.addClass(\"invalid-field\");\n } else {\n $('#email-invalid').html(''); \n emailField.removeClass(\"invalid-field\");\n };\n if (totalCost === 0) {\n event.preventDefault();\n $('#activities-invalid').html('<p>*You must choose at least one activity.</p>');\n $(window).scrollTop(0);\n } else {\n $('#activities-invalid').html(''); \n };\n if(paymentField.val() === 'select_method') {\n event.preventDefault();\n $('#payment-invalid').html('<p>*You must select a payment method.</p>');\n $(window).scrollTop(0);\n paymentField.addClass(\"invalid-field\");\n } else {\n $('#payment-invalid').html(''); \n paymentField.removeClass(\"invalid-field\");\n };\n if(paymentField.val() === 'credit card') {\n if(creditCardNumberField.val().match(creditCardRegex) === null){\n event.preventDefault();\n $('#cc-num-invalid').html('<p>*You must enter a valid credit card number.</p>');\n $(window).scrollTop(0);\n creditCardNumberField.addClass(\"invalid-field\");\n } else {\n $('#cc-num-invalid').html(''); \n creditCardNumberField.removeClass(\"invalid-field\");\n };\n if(zipField.val().match(zipCodeRegex) === null){\n event.preventDefault();\n $('#zip-invalid').html('<p>*You must enter a valid 5-digit zip code.</p>');\n $(window).scrollTop(0);\n zipField.addClass(\"invalid-field\");\n } else {\n $('#zip-invalid').html(''); \n zipField.removeClass(\"invalid-field\");\n };\n if(cvvField.val().match(cvvRegex) === null){\n event.preventDefault();\n $('#cvv-invalid').html('<p>*You must enter a valid 3-digit CVV.</p>');\n $(window).scrollTop(0);\n cvvField.addClass(\"invalid-field\");\n } else {\n $('#cvv-invalid').html(''); \n cvvField.removeClass(\"invalid-field\");\n };\n };\n });\n}", "function validateInputs() {\n if ($(\"input[type='radio']:checked\").val() && $age.val().length > 0 && $weight.val().length > 0 && ($heightInput.val().length > 0 || $heightInputIn.val().length > 0))\n return true;\n else\n return false;\n }", "validateInputs(){\r\n if(this.state.brand === \"\" || this.state.plates === \"\" || (this.state.year===\"\" || isNaN(this.state.year)) || this.state.currentState===\"\" || this.state.model===\"\" || this.state.type===\"\" || this.state.color===\"\" || this.state.niv===\"\" || this.state.gasoline===\"\" || this.state.circulation===\"\"){\r\n return false;\r\n\r\n }\r\n else{\r\n return true;\r\n }\r\n }", "validateAfterInput(e) {\n if (e.target.name === \"fname\") {\n if (!isChar(e.target.value)) {\n this.setState({ fname_err: \"error\" });\n this.setState({ fname_err_helperText: \"Invalid\" });\n } else {\n this.setState({ fname_err: \"\" });\n this.setState({ fname_err_helperText: \"\" });\n }\n }\n if (e.target.name === \"lname\") {\n if (!isChar(e.target.value)) {\n this.setState({ lname_err: \"error\" });\n this.setState({ lname_err_helperText: \"Invalid\" });\n } else {\n this.setState({ lname_err: \"\" });\n this.setState({ lname_err_helperText: \"\" });\n }\n }\n if (e.target.name === \"year\") {\n if (!isYearValid(e.target.value)) {\n this.setState({ year_err: \"error\" });\n this.setState({ year_err_helperText: \"Invalid Year\" });\n } else {\n this.setState({ year_err: \"\" });\n this.setState({ year_err_helperText: \"\" });\n }\n }\n if (e.target.name === \"month\") {\n if (!isMonthValid(e.target.value)) {\n this.setState({ month_err: \"error\" });\n this.setState({ month_err_helperText: \"Invalid Month\" });\n } else {\n this.setState({ month_err: \"\" });\n this.setState({ month_err_helperText: \"\" });\n }\n }\n if (e.target.name === \"day\") {\n if (!isDayValid(e.target.value)) {\n this.setState({ day_err: \"error\" });\n this.setState({ day_err_helperText: \"Invalid Day\" });\n } else {\n this.setState({ day_err: \"\" });\n this.setState({ day_err_helperText: \"\" });\n }\n }\n if (e.target.name === \"password\") {\n if (!isPassword(e.target.value)) {\n this.setState({ password_err: \"error\" });\n this.setState({ password_err_helperText: \"Passwords Isn't Secured\" });\n } else {\n this.setState({ password_err: \"\" });\n this.setState({ password_err_helperText: \"\" });\n }\n }\n if (e.target.name === \"confirmPassword\") {\n if (!isEqual(e.target.value, this.state.password.toString())) {\n this.setState({ confirmPassword_err: \"error\" });\n this.setState({\n confirmPassword_err_helperText: \"Passwords Don't Match\",\n });\n } else {\n this.setState({ confirmPassword_err: \"\" });\n this.setState({ confirmPassword_err_helperText: \"\" });\n }\n }\n this.setState({ error: \"\" });\n }", "function isValidForm() {\n var mainTextValid = isValidRequiredTextAreaField(\"main_text\");\n var articleKeywordCategoryValid = isValidRequiredField(\"article_keyword_category\");\n var articleKeywordsValid = isValidRequiredKeywordsField(\"article_keywords\");\n var originalSourceURLValid = isValidUrlField(\"original_source_url\");\n return isValidPartialForm() && mainTextValid && articleKeywordCategoryValid && articleKeywordsValid && originalSourceURLValid;\n}", "function checkRequiredFields() {\n\tglobalFilled = true;\n\tfor (pt in attributesHash) {\n\t\tif (!exclusion(pt)) { \n\t\t\ttry {\n\t\t\t\tglobalFilled = checkField(pt, true) && globalFilled;\n\t\t\t} catch (err) { alert(\"error: \" + err.description);}\n\t\t}\n\t}\n\t// should add check for errorMessageLength, because some of the exclusion() fields adds messages, but return true\n\treturn globalFilled && (document.getElementById(\"errorMessage\").innerHTML == '');\n}", "function isECourseFormValid(){\r\n return( CourseNameField.isValid() && CourseDaysField.isValid());\r\n }", "function checkAllRequiredFieldsHaveInput(){\n $('#user-table ._REQUIRED').each(function(index, thisEntry){ \n if($(thisEntry).val() == \"\") { \n $(thisEntry).addClass('MISSING');\n } else {\n $(thisEntry).removeClass('MISSING');\n }\n });\n \n \n \n //We only need to enable the the save button if there are NO missing\n //The bool returns are only for some needs\n console.log($('#user-table .MISSING').length + \" : \" + $('#user-table ._DELUSER').length + \" : \" + $('#user-table ._EDITED').length);\n if ( ($('#user-table ._NEWUSER').length > 0 || $('#user-table ._DELUSER').length > 0 || $('#user-table ._EDITED').length > 0 ) && $('#user-table .MISSING').length == 0 ) {\n $('#submit-user-changes').prop('disabled', false);\n\n } else { \n $('#submit-user-changes').prop('disabled', true);\n\n }\n \n \n \n}", "function checkInputs(){\r\n const fNameValue = fName.value.trim();\r\n const lNameValue = lName.value.trim();\r\n const addressValue =address.value.trim();\r\n const cityValue =city.value.trim();\r\n //const vValue =state.value.trim();\r\n const zipValue = zip.value.trim();\r\n const dobValue = dob.value.trim();\r\n const phoneValue = phone.value.trim();\r\n const emailRValue = emailR.value.trim();\r\n const passwordValue = password.value.trim();\r\n \r\n if(fNameValue === '')\r\n {\r\n setErrorFor(fName)\r\n }else{\r\n setSuccessFor(fName);\r\n }\r\n\r\n if(lNameValue === '')\r\n {\r\n setErrorFor(lName)\r\n }else{\r\n setSuccessFor(lName);\r\n }\r\n\r\n if(addressValue === '')\r\n {\r\n setErrorFor(address)\r\n }else{\r\n \r\n setSuccessFor(address);\r\n }\r\n\r\n if(cityValue === '')\r\n {\r\n setErrorFor(city)\r\n }else{\r\n \r\n setSuccessFor(city);\r\n }\r\n\r\n if(zipValue === '')\r\n {\r\n setErrorFor(zip)\r\n }else{\r\n \r\n setSuccessFor(zip);\r\n }\r\n\r\n if(dobValue === '')\r\n {\r\n setErrorFor(dob)\r\n }else{\r\n \r\n setSuccessFor(dob);\r\n console.log(dobValue)\r\n }\r\n\r\n if(phoneValue === '')\r\n {\r\n setErrorFor(phone)\r\n }else{\r\n \r\n setSuccessFor(phone);\r\n }\r\n\r\n if(emailRValue === '')\r\n {\r\n setErrorFor(emailR)\r\n }else if(!isEmail(emailRValue)){\r\n setErrorFor(emailR)\r\n \r\n }else{\r\n setSuccessFor(emailR);\r\n }\r\n\r\n if(passwordValue === '')\r\n {\r\n setErrorFor(password)\r\n }else{\r\n setSuccessFor(password);\r\n }\r\n}", "function validateFieldsUF(){\n \n\n var floraName = document.getElementById('txtFlora');\n var abundance = document.getElementById('txtAbundance');\n var floweringPeriod = document.getElementById('txtFloweringPeriod');\n var park = document.getElementById('txtPark');\n var description = document.getElementById('txtDescription');\n var emptyName = false, emptyAbundance = false, emptyFloweringPeriod = false, \n emptyPark = false, emptyDescription = false;\n \n if(floraName.value.length < 2){// está vacio\n document.getElementById('msgErrorName').style.visibility = \"visible\";\n emptyName = true;\n }else{\n document.getElementById('msgErrorName').style.visibility = \"hidden\";\n }//end else \n \n if(abundance.value.length < 2){//está vacia\n document.getElementById('msgErrorAbundance').style.visibility = \"visible\";\n emptyLocation = true;\n }else{\n document.getElementById('msgErrorAbundance').style.visibility = \"hidden\";\n }//end else\n \n if(floweringPeriod.value.length < 2){//está vacia\n document.getElementById('msgErrorFloweringPeriod').style.visibility = \"visible\";\n emptyFloweringPeriod = true;\n }else{\n document.getElementById('msgErrorFloweringPeriod').style.visibility = \"hidden\";\n }//end else\n \n if(park.value.length < 2){//está vacia\n document.getElementById('msgErrorPark').style.visibility = \"visible\";\n emptyPark = true;\n }else{\n document.getElementById('msgErrorPark').style.visibility = \"hidden\";\n }//end else\n \n if(description.value.length < 2){//La locacion está vacia\n document.getElementById('msgErrorDescription').style.visibility = \"visible\";\n emptyDescription = true;\n }else{\n document.getElementById('msgErrorDescription').style.visibility = \"hidden\";\n }//end else\n \n if(emptyAbundance === true || emptyDescription === true || emptyFloweringPeriod === true || \n emptyName === true || emptyPark === true){\n return false;\n }else{\n return true;\n }\n}//end validateFieldsUF", "function verifyFields(){\n let fieldTexts = document.getElementsByClassName('input-field');\n let hasAllvalues = true;\n for(let i = 0; i < fieldTexts.length; i++){\n if(!fieldTexts[i].value){\n hasAllvalues = false;\n }\n }\n return hasAllvalues;\n}", "function ValidarFields() {\r\n\r\n\tif(document.getElementById('codigo').value == \"\"){\r\n\t\talert(' ¡ ERROR ! Debes ingresar el código del producto.');\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(document.getElementById('nombre').value == \"\"){\r\n\t\talert(' ¡ ERROR ! Debes ingresar el nombre del producto.');\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(document.getElementById('precio').value == \"\"){\r\n\t\talert(' ¡ ERROR ! Debes ingresar el precio del producto.');\r\n\t\treturn false;\r\n\t}\r\n\r\n}", "function validateFormFields(okButtonElement){\n\t\n\t// get the form object\n\tformObj = okButtonElement.form;\n\t\n /* validate all phone numbers */\n\t\n // get all form input objects\n formInputs = formObj.getElementsByTagName('input');\n \n\n for (var i=0; i<formInputs.length; i++){\n // for each phone number (that has tel as type), add validation\n\t\tif (formInputs[i].type == 'tel')\n\t\t{\n\t\t\tvalidatePhoneNumber(formInputs[i]);\n\t\t}\n\t\t\n\t\t// for each irs number (that has class irs-no), add validation\n\t\tif (formInputs[i].classList.contains('irs-no'))\n\t\t{\n\t\t\tvalidateIrsNumber(formInputs[i]);\n\t\t}\n }\n\n}", "function validateInputFields() {\n var msg = \"\";\n if ($(\"#txtAlertName\").val() === \"\") {\n msg += \"O campo 'Nome' é obrigatório.\";\n }\n if ($(\"#txtAlertDescription\").val() === \"\") {\n if (msg.length > 0) { msg += \"<br>\"; }\n msg += \"O campo 'Descrição' é obrigatório.\";\n }\n if ($(\"#txtAlertDueDate\").data(\"DateTimePicker\").date() === null) {\n if (msg.length > 0) { msg += \"<br>\"; }\n msg += \"O campo 'Data' é obrigatório.\";\n }\n if (msg.length > 0) {\n MessageBox.info(msg, { Div: \"#divAlertModalMessage\" });\n return false;\n }\n MessageBox.clear({ Div: \"#divAlertModalMessage\" });\n return true;\n }", "function validateShippingInfoForm(){\n var requiredFields = ['shippingFullName', 'shippingAddress', 'shippingCity', 'shippingState', 'shippingZip', 'shippingCountryID'];\n var isValid = true;\n\n for(idx = 0; idx < requiredFields.length; idx++){\n jQuery(\"#\" + requiredFields[idx]).val(jQuery.trim(jQuery(\"#\" + requiredFields[idx]).val()));\n\n if(jQuery(\"#\" + requiredFields[idx]).val() == ''){\n isValid = false;\n jQuery(\"#\" + requiredFields[idx]).addClass('input-error');\n }\n }\n\n if(!isValid){\n showMessage(jQuery('#shippingInfoForm'), 'Please complete the fields in red.', true);\n }else{\n jQuery(\"#shippingInfoForm\").submit();\n }\n\n\n}", "function validateRequired() {\n fieldCouplesArray.forEach(function (inputCouple) {\n if (inputCouple[0].value === \"\" && inputCouple[1].value !== \"\") {\n inputCouple[0].required = true;\n } else if\n (inputCouple[0].value !== \"\" && inputCouple[1].value === \"\") {\n inputCouple[1].required = true;\n } else {\n inputCouple[0].required = false;\n inputCouple[1].required = false;\n }\n })\n }", "function checkGeneratorInputs() {\n let valid = true;\n $('#generator-form input').each(function () {\n $(this).removeClass('is-invalid');\n if (!$(this).val()) {\n $(this).addClass('is-invalid');\n valid = false;\n }\n });\n return valid;\n}", "validateFormInputs() {\n const fields = this.formFields;\n \n \n let errors = fields.map((fieldItem) => {\n if(fieldItem.Mandatory === true) {\n // Check empty value for text input\n if(fieldItem.Type === \"Text\" || fieldItem.Type === \"Decimal\" || fieldItem.Type === \"Integer\") {\n //console.log(`TCL: validateFormInputs -> fieldItem.value Text->${fieldItem.Field_State_Name}`, fieldItem.value)\n if(this.state[fieldItem.Field_State_Name] === null || this.state[fieldItem.Field_State_Name] === \"\" ) {\n this.addErrorStatus(fieldItem.Field_State_Name);\n return true;\n }\n else {\n this.removeErrorStatus(fieldItem.Field_State_Name)\n return false;\n } \n \n }\n // Check Combo\n else if(fieldItem.Type === \"Combo\" || fieldItem.Type === \"DynamicField\") {\n //console.log(`TCL: validateFormInputs -> fieldItem.value Copmbo->${fieldItem.Field_State_Name}`, fieldItem.value)\n if(this.state[fieldItem.Field_State_Name].value === \"\" || this.state[fieldItem.Field_State_Name].value === null || this.state[fieldItem.Field_State_Name] === null || this.state[fieldItem.Field_State_Name] === []) {\n this.addErrorStatus(fieldItem.Field_State_Name);\n return true;\n // errors.push( {error : true, field : fieldItem.Field_State_Name})\n }\n else {\n this.removeErrorStatus(fieldItem.Field_State_Name)\n return false;\n } \n \n \n }\n }\n })\n \n\n\n // Check How Many erros Are\n const errorsCount = errors.filter(error=>{return error===true}).length\n\t\t\t\t\t//console.log('TCL: validateFormInputs -> errorsCount', errorsCount)\n\n return errorsCount > 0 ? false : true\n \n }", "function validateForm() {\n\t\n\tvar messageString = \"\"; // Start with blank error message\n\tvar tableViewRows = $.tableView.data[0].rows;\n\t\n\tfor (var i = 0; i < tableViewRows.length; ++i) {\n\t\t\n\t\tvar fieldObject = tableViewRows[i].fieldObject;\n\t\tvar value = getFieldValue(tableViewRows[i]);\n\t\t\n\t\tif (fieldObject.field_type == 'Checkbox') {\n\t\t\tcontinue;\n\t\t}\n\t\t\n\t\t// Checks if the field is blank and/or required\n\t\tif (value == \"\" || value == null) {\n\t\t\tif (fieldObject.required == \"No\") {\n\t\t\t\tcontinue;\n\t\t\t} else {\n\t\t\t\tmessageString += fieldObject.prompt + \" is a required field.\\n\";\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\t// -------------- Text ----------------\n \t\tif (fieldObject.field_type == 'Text') {\n \t\t\t// Do Nothing\n \t\t\t\n \t\t// -------------- Checkbox ----------------\n \t\t} else if (fieldObject.field_type == 'Checkbox') { \n \t\t\t// Do Nothing\t\n \t\t\n \t\t\n \t\t// ------------ Integer ----------------\n \t\t} else if (fieldObject.field_type == 'Integer') { \n\t\t\t// Is number? And is integer?\n\t\t\tif (Number(value) > 0 && value % 1 == 0) {\n\t\t\t\t// Is it in range?\n\t\t\t\tif (value > fieldObject.numeric_max || value < fieldObject.numeric_min) {\n\t\t\t\t\tmessageString += fieldObject.prompt + \" must be in range [\" + fieldObject.numeric_min + \", \" + fieldObject.numeric_max + \"]\\n\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tmessageString += fieldObject.prompt + \" must be an integer.\\n\";\n\t\t\t}\n\t\t\n\t\t\n\t\t// ------------ Decimal ----------------\n\t\t} else if (fieldObject.field_type == 'Decimal') { \n\t\t // Is number?\n\t\t\tif (Number(value) > 0) {\n\t\t\t\t// Is it in range?\n\t\t\t\tif (value > fieldObject.numeric_max || value < fieldObject.numeric_min) {\n\t\t\t\t\tmessageString += fieldObject.prompt + \" must be in range [\" + fieldObject.numeric_min + \", \" + fieldObject.numeric_max + \"]\\n\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tmessageString += fieldObject.prompt + \" must be a number.\\n\";\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t// ---------- Calculated ------------\n\t\t} else if (fieldObject.field_type == 'Calculated') { \n\t\t\n\t\t\n\t\t// -------------- Incremental Text ----------------\n\t\t} else if (fieldObject.field_type == 'Incremental Text') { \n\t\t\n\t\t\n\t\t// -------------- Date ----------------\n\t\t} else if (fieldObject.field_type == 'Date') { \n\t\t\n\t\t\n\t\t// -------------- Time ----------------\n\t\t} else if (fieldObject.field_type == 'Time') { \n\t\t\t\n\t\t\t\n\t\t// -------------- Date-Time ----------------\n\t\t} else if (fieldObject.field_type == 'Date-Time') { \n\t\t\n\t\t} else if (fieldObject.field_type == 'Message') { \n\t\t\n\t\t} else if (fieldObject.field_type == 'Location') { \n\t\t\n\t\t} else if (fieldObject.field_type == 'Photo') { \n\t\t\n\t\t} else if (fieldObject.field_type == 'Recording') { \n\t\t\n\t\t} else if (fieldObject.field_type == 'Selection') { \n\t\t\n\t\t} else if (fieldObject.field_type == 'Button Selection') { \n\t\t\n\t\t} else if (fieldObject.field_type == 'Structural Attitude') { \n\t\t\n\t\t} else { \n\t\t\t\n\t\t}\n\t\t//------------------------------------------------------------------------------------------------------------------------------------------\n\t}\n\treturn messageString;\n}", "function valid(campo1, campo2, campo3, campo4, campo5, campo6, campo7, campo8, campo9, campo10, campo11, campo12, campo13, campo14){\nerro = false;\n\tif (campo1 != null){\n\t\tif (campo1.value == \"\"){\n\t\t\terro = true;\n\t\t\tcampo1.focus();\n\t\t}\n\t\telse if (campo2 != null){\n\t\t\tif (campo2.value == \"\"){\n\t\t\t\terro = true;\n\t\t\t\tcampo2.focus();\n\t\t\t}\n\t\t\telse if (campo3 != null){\n\t\t\t\tif (campo3.value == \"\"){\t\t\n\t\t\t\t\terro = true;\n\t\t\t\tcampo3.focus();\n\t\t\t\t}\n\t\t\t\telse if (campo4 != null){\n\t\t\t\t\tif (campo4.value == \"\"){\t\t\n\t\t\t\t\t\terro = true;\n\t\t\t\t\t\tcampo4.focus();\n\t\t\t\t\t}\n\t\t\t\t\telse if (campo5 != null){\n\t\t\t\t\t\tif (campo5.value == \"\"){\t\t\n\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\tcampo5.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (campo6 != null){\n\t\t\t\t\t\t\tif (campo6.value == \"\"){\t\t\n\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\tcampo6.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (campo7 != null){\n\t\t\t\t\t\t\t\tif (campo7.value == \"\"){\t\t\n\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\tcampo7.focus();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (campo8 != null){\n\t\t\t\t\t\t\t\t\tif (campo8.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\tcampo8.focus();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse if (campo9 != null){\n\t\t\t\t\t\t\t\t\t\tif (campo9.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\t\tcampo9.focus();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse if (campo10 != null){\n\t\t\t\t\t\t\t\t\t\t\tif (campo10.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\t\t\tcampo10.focus();\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\telse if (campo11 != null){\n\t\t\t\t\t\t\t\t\t\t\t\tif (campo11.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\t\t\t\tcampo11.focus();\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\telse if (campo12 != null){\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (campo12.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcampo12.focus();\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\telse if (campo13 != null){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (campo13.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcampo13.focus();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\telse if (campo14 != null){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (campo14.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcampo14.focus();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\tif (erro==false){\n\t\treturn salvar();\n\t}\n\telse{\n\t\talert(\"Favor preencher todos os campos requeridos. \\n Vou indica-lo!\");\n\t\treturn false;\n\t}\n}", "function validateFieldsIF(){\n \n console.log(\"ENTRA\");\n var floraName = document.getElementById('txtFlora');\n var abundance = document.getElementById('txtAbundance');\n var floweringPeriod = document.getElementById('txtFloweringPeriod');\n var park = document.getElementById('txtPark');\n var description = document.getElementById('txtDescription');\n var emptyName = false, emptyAbundance = false, emptyFloweringPeriod = false, \n emptyPark = false, emptyDescription = false;\n \n if(floraName.value.length < 2){// está vacio\n document.getElementById('msgErrorName').style.visibility = \"visible\";\n emptyName = true;\n }else{\n document.getElementById('msgErrorName').style.visibility = \"hidden\";\n }//end else \n \n if(abundance.value.length < 2){//está vacia\n document.getElementById('msgErrorAbundance').style.visibility = \"visible\";\n emptyLocation = true;\n }else{\n document.getElementById('msgErrorAbundance').style.visibility = \"hidden\";\n }//end else\n \n if(floweringPeriod.value.length < 2){//está vacia\n document.getElementById('msgErrorFloweringPeriod').style.visibility = \"visible\";\n emptyFloweringPeriod = true;\n }else{\n document.getElementById('msgErrorFloweringPeriod').style.visibility = \"hidden\";\n }//end else\n \n if(park.value.length < 2){//está vacia\n document.getElementById('msgErrorPark').style.visibility = \"visible\";\n emptyPark = true;\n }else{\n document.getElementById('msgErrorPark').style.visibility = \"hidden\";\n }//end else\n \n if(description.value.length < 2){//La locacion está vacia\n document.getElementById('msgErrorDescription').style.visibility = \"visible\";\n emptyDescription = true;\n }else{\n document.getElementById('msgErrorDescription').style.visibility = \"hidden\";\n }//end else\n \n if(emptyAbundance === true || emptyDescription === true || emptyFloweringPeriod === true || \n emptyName === true || emptyPark === true){\n return false;\n }else{\n return true;\n }\n}", "function inputValidation() {\n const firstNameField = document.getElementById(\"firstName\");\n const lastNameField = document.getElementById(\"lastName\");\n const emailField = document.getElementById(\"email\");\n const passwordField = document.getElementById(\"password\");\n const ageField = document.getElementById(\"age\");\n const occupationField = document.getElementById(\"occupation\")\n let valid = true;\n\n if (!firstNameField.value) {\n const firstNameError = document.getElementById(\"firstNameError\");\n firstNameError.classList.add(\"visible\");\n firstNameField.classList.add(\"invalid\");\n firstNameError.setAttribute('aria-hidden', false);\n firstNameError.setAttribute('aria-invalid', true);\n }\n \n if (!lastNameField.value) {\n const lastNameError = document.getElementById(\"lastNameError\");\n lastNameError.classList.add(\"visible\");\n lastNameField.classList.add(\"invalid\");\n lastNameError.setAttribute('aria-hidden', false);\n lastNameError.setAttribute('aria-invalid', true);\n }\n\n if (!emailField.value) {\n const emailError = document.getElementById(\"emailError\");\n emailError.classList.add(\"visible\");\n emailField.classList.add(\"invalid\");\n emailError.setAttribute('aria-hidden', false);\n emailError.setAttribute('aria-invalid', true);\n }\n \n if (!passwordField.value) {\n const passwordError = document.getElementById(\"passwordError\");\n passwordError.classList.add(\"visible\");\n passwordField.classList.add(\"invalid\");\n passwordError.setAttribute('aria-hidden', false);\n passwordError.setAttribute('aria-invalid', true);\n }\n\n if (!ageField.value) {\n const ageError = document.getElementById(\"ageError\");\n ageError.classList.add(\"visible\");\n ageField.classList.add(\"invalid\");\n ageError.setAttribute('aria-hidden', false);\n ageError.setAttribute('aria-invalid', true);\n }\n\n if (age.value < 18) {\n const underAgeError = document.getElementById(\"underAgeError\");\n underAgeError.classList.add(\"visible\");\n ageField.classList.add(\"invalid\");\n underAgeError.setAttribute('aria-hidden', false);\n underAgeError.setAttribute('aria-invalid', true);\n }\n \n if (!occupationField.value) {\n const occupationError = document.getElementById(\"occupationError\");\n occupationError.classList.add(\"visible\");\n occupationField.classList.add(\"invalid\");\n occupationError.setAttribute('aria-hidden', false);\n occupationError.setAttribute('aria-invalid', true);\n }\n\n return valid;\n}", "function validate() {\n\t\t\tvar allOk = true;\n\t\t\tvar ok = $userFullName.val().match(/[\\w -]{3,}/) !== null;\n\t\t\ttooltip.set($userFullName, !ok);\n\t\t\tallOk = allOk && ok;\n\n\t\t\tok = $userEmail.val().match(/^[\\w\\.\\-_]{1,}@([\\w\\-_]+.){1,}\\w{3,5}$/) !== null;\n\t\t\ttooltip.set($userEmail, !ok);\n\t\t\tallOk = allOk && ok;\n\n\t\t\tok = $userPhone.val().match(/^[\\d+\\s\\-]{5,}$/) !== null;\n\t\t\ttooltip.set($userPhone, !ok);\n\t\t\tallOk = allOk && ok;\n\n\t\t\tok = $userCitizenship.val().match(/^[\\w\\s]{2,}$/) !== null;\n\t\t\ttooltip.set($userCitizenship, !ok);\n\t\t\tallOk = allOk && ok;\n\n\t\t\tok = datepicker.isValid();\n\t\t\tallOk = allOk && ok;\n\n\t\t\ttooltip.set($submitBookingButton, !allOk);\n\t\t\treturn allOk;\n\t\t}", "function validateFields(){\n\n for(var key in errorStates.keys){\n errorStates.set(key, false);\n var answer= $(\"#input_\" + key).val();\n\n if(!answer){\n errorStates.set(key, true);\n }\n }\n var password = $(\"#input_4\").val();\n if (password.length < 6) {\n errorStates.set(4, true);\n }\n}", "function checkInputs(inputs) {\n inputs.forEach(input => {\n if(input.id === 'password' || input.id === 'password2') {\n checkLength(input, 8);\n } \n else {\n checkLength(input, 4);\n }\n })\n}", "function checkField(){\n \n //Check text length and not empty\n checkLength(this);\n\n //Check email\n if(this.type === 'email'){\n validateEmail(this);\n }\n\n let errors = document.querySelectorAll('error');\n\n if(email.value !== '' && subject.value !== '' && message.value !== ''){\n if(errors.length === 0) {\n btnSend.disabled = false;\n }\n \n }\n\n}", "function validateInputs() {\n let isValid = true;\n\n // validation for resistance workouts\n if (workoutType === \"resistance\") {\n // name of workout is required (cannot be empty string)\n if (nameInput.value.trim() === \"\") {\n isValid = false;\n }\n // weights are required\n if (weightInput.value.trim() === \"\") {\n isValid = false;\n }\n // sets are required\n if (setsInput.value.trim() === \"\") {\n isValid = false;\n }\n // reps are required\n if (repsInput.value.trim() === \"\") {\n isValid = false;\n }\n // duration is required\n if (resistanceDurationInput.value.trim() === \"\") {\n isValid = false;\n }\n } // validation for cardio workouts\n else if (workoutType === \"cardio\") {\n // name is required input\n if (cardioNameInput.value.trim() === \"\") {\n isValid = false;\n }\n // duration is required input \n if (durationInput.value.trim() === \"\") {\n isValid = false;\n }\n // distance is required input\n if (distanceInput.value.trim() === \"\") {\n isValid = false;\n }\n }\n // if all inputs for workout are valid,\n // enable buttons to \"complete\" the workout or \"add exercise\"\n if (isValid) {\n completeButton.removeAttribute(\"disabled\");\n addButton.removeAttribute(\"disabled\");\n } else {\n completeButton.setAttribute(\"disabled\", true);\n addButton.setAttribute(\"disabled\", true);\n }\n}", "function checkFormInputs() {\n var nameInputField = document.querySelector('#name');\n var emailInputField = document.querySelector('#mail');\n var numberInputField = document.querySelector('#number');\n var cityInputField = document.querySelector('#city');\n var stateSelect = document.querySelector('#state');\n var zipInputField = document.querySelector('#zip');\n var radios = document.getElementsByName('format');\n var newsLetter = document.getElementsByName('user_interest');\n\n\n var values = [nameInputField, emailInputField, numberInputField, cityInputField, stateSelect, zipInputField];\n var errorFound = false;\n\n // adding the class 'error' to any input without data\n for (var i = 0; i < values.length; i++) {\n var field = values[i];\n if (!field.value || stateSelect.value === 'Choose State') {\n field.classList.add('error');\n field.placeholder = \"Field can't be blank\";\n errorFound = true;\n } else {\n field.classList.remove('error');\n }\n }\n\n // Check if any field had an error, if not, submit data somewhere\n if (!errorFound) {\n // save data to databasae\n }\n}", "function validateFields() {\n\tvar isNotEmpty = true;\n\t\n\tfor (var i in registrationinfoArray){\n\t//check all fields are filled out \n\tif (!registrationInfoArray[i].value){\n\t\tregistrationInfoArray[i].style.backgroundColor = \"#f33\";\n\t\tisNotEmpty = false;\n\t}\t\n\telse{\n\t\tregistrationInfoArray[i].style.backgroundColor = \"#fff\";\n\t}\n\t}\n\t\n\treturn isNotEmpty;\n}", "requiredFieldsValidity(formElm) {\n let allRequiredFilledsAreValid = true;\n //selecting an array of all the required inputs\n const requiredInputsArray = formElm.querySelectorAll('.form-control[required]');\n requiredInputsArray.forEach((elm)=> {\n if (elm.value === '') {\n this.setState({\n [elm.id]: false\n });\n allRequiredFilledsAreValid = false\n } else {\n this.setState({\n [elm.id]: true\n })\n }\n });\n return allRequiredFilledsAreValid;\n }", "_validate(items) {\n\t\t\titems.forEach(item => item.classList.remove('js-error'));\n\n\t\t\t// include filter function\n\t\t\titems.filter = Array.prototype.filter;\n\n\t\t\t// grab empty fields\n\t\t\tconst errors = items.filter(el => el.value == '');\n\n\t\t\tif (!errors.length)\n\t\t\t\treturn true;\n\n\t\t\terrors.forEach(item => item.classList.add('js-error'));\n\t\t\treturn false;\n\t\t}", "function checkRequiredFields( alertMsg ) {\n // check the inputs of all single-value requiredFields\n var returnVal = true;\n $( \"input:visible\", \".requiredField\" ).each( function() {\n if( !this.value || this.value == \"\" ) {\n alert( alertMsg );\n returnVal = false;\n }\n } );\n \n if( returnVal == false ) {\n return false;\n }\n \n // check the inputs of all multi-value requiredFields\n var multiAlert = true;\n var showMultiAlert = false;\n $( \"input:visible\", \".requiredField_multi\" ).each( function() {\n showMultiAlert = true;\n if( this.value && this.value != \"\" ) {\n multiAlert = false;\n }\n } );\n \n if( multiAlert && showMultiAlert ) {\n alert( alertMsg );\n return false;\n }\n //If electronic citation check if at least one url is supplied\n if($('#type_selector').val() == 'electronic'){\n var showUrlAlert = $(\"input:text[name^='url_']\" ).filter(function(){\n return this.value.trim().length;\n }).length > 0;\n if(!showUrlAlert){\n alert( \"Must supply at least one url for electronic citation.\" );\n return false;\n }\n }\n return true;\n}", "function validateInputs(){\n if ($('#firstNameInput').val() === '' || $('#lastNameInput').val() === '' || $('#idNumberInput').val() === '' || $('#jobTitleInput').val() === '' || $('#annualSalaryInput').val() === ''){\n $('.error').css('visibility', 'visible');\n $('#firstNameInput').focus();\n return true;\n } else {\n return false;\n }\n}", "function appValidation() {\n if ($(\"#registerForm\").length > 0)\n registerFormValid();\n if ($(\"#loginForm\").length > 0)\n loginFormValid();\n if ($(\"#checkForm\").length > 0)\n checkFormValid();\n if ($('#saleForm').length > 0)\n saleFormValid();\n }", "function isValidUpdateForm() {\n\tvar name = $(\"#name-update\").val();\n\tvar date = $(\"#date-update\").val();\n\tvar score = $(\"#scores-update\").val();\n\t\n\tvar checkName = isValidName(name);\n\tvar checkDate = isValidDate(date);\n\tvar checkScore = isValidScore(score);\n\t\n\t$(\"#invalid-name-update\").html(\"\");\n\t$(\"#invalid-date-update\").html(\"\");\n\t$(\"#invalid-score-update\").html(\"\");\n\t\n\tif (!checkName || !checkDate || !checkScore) {\n\t\tif (!checkName) {\n\t\t\t$(\"#invalid-name-update\").html(\"Invalid student's name\");\n\t\t}\n\t\tif (!checkDate) {\n\t\t\t$(\"#invalid-date-update\").html(\"Invalid student's date\");\n\t\t}\n\t\tif (!checkScore) {\n\t\t\t$(\"#invalid-score-update\").html(\"Invalid student's score\");\n\t\t}\n\t\treturn false;\n\t}\n\treturn true;\n}", "validateForm() {\r\n if(this.getInputVal(this.inputBill) !== \"\" && \r\n this.getInputVal(this.inputPeople) !== \"\" &&\r\n (this.getInputVal(this.inputCustom) !== \"\" || \r\n this.percentageBtns.some(btn => btn.classList.contains(\"active\")))) \r\n {\r\n this.disableReset(false);\r\n return true;\r\n }\r\n else {\r\n this.disableReset(true);\r\n this.displayResult(\"__.__\", \"__.__\");\r\n return false;\r\n }\r\n }", "function validateForm() {\n return name.length > 0 && phone.length > 0;\n }", "function isAllValid(){\n return (\n BILL_REGEX.test(billInput.value) && \n (NUM_REGEX.test(customPercent.value) || \n document.querySelector('input[name=\"tip-amount\"]:checked')) && \n NUM_REGEX.test(numPeople.value)\n )\n}", "verifyFields( ) {\n const inputId = document.getElementById( 'id' )\n const inputFname = document.getElementById( 'fname' )\n const inputLname = document.getElementById( 'lname' )\n const inputSex = document.getElementById( 'sex' )\n const inputClass = document.getElementById( 'class' )\n const inputDateJoined = document.getElementById( 'dateJoined' )\n const inputMembershipType = document.getElementById( 'membershipType' )\n const newExpireDate = document.getElementById( 'expireDate' )\n \n let d = new Date(inputDateJoined.value)\n let dateIsValid = (d.getTime() === d.getTime())\n if (inputFname.value === '' || inputLname.value === '' || !dateIsValid\n || inputClass.value === '' || inputMembershipType.value === '')\n {\n return false\n }\n \n return true\n }", "function validateForm() {\n let validCandidates = 0;\n optionNames.forEach((e) => {\n if (e !== null || e !== undefined || e !== \"\") validCandidates += 1;\n });\n return validCandidates >= 2;\n }", "function runValidation() {\n nameVal();\n phoneVal();\n mailVal();\n}", "function validarCampos() {\n var campo1 = false;\n var campo2 = false;\n\n if (!document.getElementById('usuario').validity.valid) {\n document.getElementById('divUsuario').className = 'form-group has-error has-feedback';\n $('[data-toggle=\"divUsuario\"]').tooltip('show'); \n temporizadorTooltip();\n document.getElementById('divUsuario').className = 'form-group has-error has-feedback'; \n } else {\n document.getElementById('divUsuario').className = 'form-group';\n campo1 = true;\n }\n\n if (!document.getElementById('password').validity.valid) {\n document.getElementById('divPassword').className = 'form-group has-error';\n $('[data-toggle=\"divPassword\"]').tooltip('show'); \n temporizadorTooltip();\n document.getElementById('divPassword').className = 'form-group has-error has-feedback';\n } else {\n document.getElementById('divPassword').className = 'form-group';\n campo2 = true;\n }\n\n if (campo1 && campo2) {\n return true;\n }\n}", "function checkFormInfo(objData) {\n\tfor (var i = 0; i < objData.length; i++) {\n\t\tif (objData[i].value == \"\") {\n\t\t\talert(\"Please input value: \" + objData[i].name);\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}", "function validateForm() {\n\t\tvar $fields = $(\".form-control:visible\");\n\t\tvar $thisStep = $('.formPaso-stepper:visible');\n\t\tvar $nextStep = $thisStep.attr('data-nextStep');\n\t\tvar $filledFields = $fields.find('input[value!=\"\"]');\n\t\tvar $emptyFields = $fields.filter(function() {\n\t \treturn $.trim(this.value) === \"\";\n\t });\n \tfunction continueForm() {\n\t \t// apaga stepper\n\t \t// $('#stepper_portabilidad li').removeClass('active');\n\t \t// prende stepper correcto\n\t \t$('#stepper_portabilidad li.stepperLED-' + $nextStep).addClass('active');\n\t \t// deshabilita este boton\n\t \t$($thisStep).find('.nextStep').addClass('disabled');\n\t \t// oculta este paso\n\t \t$($thisStep).slideUp('1200');\n\t \t// muestra el paso siguiente\n\t \t$('#portateForm-' + $nextStep).slideDown('1200');\n\t \t// habilita el boton a paso siguiente\n\t \t$('#portateForm-' + $nextStep).find('.nextStep').removeClass('disabled');\n\t \t// anima el DOM hasta el stepper\n\t \t$('html, body').animate({scrollTop: $(\"#stepper_portabilidad\").offset().top - 30}, 500);\n\t\t // cancela form button\n\t \treturn false;\n\t }\n\t\tif (!$emptyFields.length) {\n\t\t\t// if form is ok...\n\t\t\t$('#camposvacios').slideUp();\n\t\t\tcontinueForm();\n\t\t} else {\n\t\t console.log($emptyFields);\n\t\t $emptyFields.parents('.form-group').addClass('invalidInput').removeClass('input-effect');\n\t\t $filledFields.addClass('totallyValidInput');\n\t\t console.log($filledFields);\n\t\t $('#camposvacios').slideToggle();\n\t\t $('html, body').animate({scrollTop: $(\"#camposvacios\").offset().top}, 200);\n\t\t}\n\t}", "function validate() {\n var passed = true;\n $(\"input.order-form:not(input#email, input#zipcode),\"\n + \"select#state\").each(function () {\n if (!$(this).val()) {\n $(this).css(\"border-color\", \"red\");\n $(this).parent().css(\"color\", \"red\");\n $(this).attr(\"placeholder\", \"Required\");\n passed = false;\n }\n });\n if (!$(\"input#agree\").prop(\"checked\")) {\n $(\"div#form-agree label\").css(\"color\", \"red\");\n passed = false;\n }\n passed = validate_email(passed);\n passed = validate_zipcode(passed);\n return passed;\n }", "function validateForm() {\n return fields.email.length > 0 && fields.password.length > 0;\n }", "function checkIfInputs(e) {\n // Check first 5 inputs\n for (let i = 0; i < 5; i ++) {\n if (e.target[i].value.length < 1) {\n formIsValid = false\n toggleButton()\n const warning = \"Merci de remplir tous les champs\"\n addWarning(e, warning)\n return\n }\n }\n if (mandatoryCheckBox.checked && formIsValid) {\n removeWarning(e)\n setInterval(()=>{successMessage.style.display = 'flex'}, 1000)\n }\n}", "function validateFields(fields){\n\tvar errors = 0;\n\t$.each(fields, function(i,arr){\n\t\tif($(arr[0]).val() == ''){\n\t\t\terrors += 1;\n\t\t\taddRedBorder(arr[0], null);\n\t\t}else{\n\t\t\tremoveRedBorder(arr[0]);\n\t\t}\n\t});\n\treturn errors;\n}", "validateFields() {\n const { description, amount, date } = Form.getValues() //Desustrurando o objeto\n // console.log(description)\n\n if(description.trim() === \"\" || amount.trim() === \"\" || date.trim() === \"\") { // trim: limpeza da sua string\n throw new Error(\"Por favor, preencha todos os campos\")// Throw é jogar para fora (cuspir), criando um novo objeto de erro com uma mensagem adicionada\n } \n }", "function checkFields(formname) {\n\tconsole.log('Checking form');\n\tvar allFieldsComplete = true;\t\n\t$(formname + ' input').removeClass('has-error');\t\t\n\t$(formname + ' .help-block').remove();\t\n\t$(formname + ' .control-group').removeClass('has-error');\n\t\n\t// Check if all fields have been entered, \n\t// if field is empty adds a warning class and error message and sets variable allFieldsComplete to false\n\t$(formname + ' input[type=text].required').each(function() {\n\t\tif (isNotEmpty($(this))) { \n\t\t\tconsole.log('A required field is empty');\n\t\t\tallFieldsComplete = false;\n\t\t}\n\t});\t\t\n\t$(formname + ' input[type=checkbox].required').each(function() {\t\t\t\n\t\tif ($(this).is(':checked') == false) {\n\t\t\tvar errorMsg = $(this).attr('title');\n\t\t\t$(this).parent().parent().append('<small class=\"help-block\">' + errorMsg + '</small>').addClass('has-error');\n\t\t\tallFieldsComplete = false;\t\t\n\t\t}\n\t});\n\n\t// Checks if the state dropdown is not empty\n\tif ($(formname + ' .input-state option:selected').val() == '' || $(formname + ' .input-state option:selected').val() == 'Select a state') {\n\t\t\tvar errorMsg = $('.input-state').attr('title');\n\t\t\t$('.input-state').parent().parent().append('<small class=\"help-block\">' + errorMsg + '</small>').addClass('has-error');\n\t\t\tallFieldsComplete = false;\n\t};\t\n\t\n\t// Checks if any textarea is not empty\n\t$(formname + ' textarea.required').each(function() {\n\t\tif (!isNotEmpty($(this))) {\t// first checks that field is not empty\t\t\t\t\t\n\t\t\tif (!countWords($(this))) { // calls function to count words if too many words outputs error\n\t\t\t\t$(this).parent().parent().append('<small class=\"help-block\">Ooops, too many words. </small>').addClass('has-error');\t\t\t\t\t\n\t\t\t\tallFieldsComplete = false;\n\t\t\t}\n\t\t}\t\t\n\t});\n \n // Check if either file is attached or attachment url is included \n if (isNotEmptyEitherOr($('#file'),$('#inputAttachment'))) {\n allFieldsComplete = false;\n console.log(allFieldsComplete);\n }; \n \n\n\n\t// Checks if email appears to be valid\n\t$(formname + ' .input-email.required').each(function() {\t\t\n\t\tif (!isNotEmpty($(this))) {\t\t\t\t\t\t\t\n\t\t\tif (!isValidEmailAddress($(this))) { // checks if email appears valid\n\t\t\t\tallFieldsComplete = false;\n\t\t\t}\n\t\t}\n\t});\n\t\n\t// Before submitting checks that phone is not empty and is valid \n\t$(formname + ' .input-phone.required').each(function() {\n\t\tif (!isNotEmpty($(this))) {\t\t\n\t\t\tif (!isValidPhone($(this),$(this).attr('id'))) {\n\t\t\t\tallFieldsComplete = false;\n\t\t\t}\t\t\t\t\t\t\t\n\t\t}\t\t\n\t});\n\n\t// Checks if at least on of the radio buttons inside QuestionRadio is selected \n\t$(formname + ' .input-radiogroup').each(function() {\n\n\t\tvar currentGroup = $(this).attr('id');\t\t\t\t\t\n\t\tfunction verifyRadioChecked(activeGroup) {\t\n\t\t\t\t\t\n\t\t\tvar radioChecked = false;\n\t\t\tvar inputSelector = '#' + activeGroup + ' input[type=radio]';\n\n\t\t\t$(inputSelector).each(function(){\t\t\t\t\n\t\t\t\tif($(this).is(':checked')) {\n\t\t\t\t\tradioChecked = true;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (!radioChecked) {\t\t\t\t\n\t\t\t\tvar errorMsg = $('#'+currentGroup).attr('title');\t\t\t\t\t\n\t\t\t\t $('#'+currentGroup).append('<small class=\"help-block\">' + errorMsg + '</small>').addClass('has-error');\t\t\t\t\t\n\t\t\t\tallFieldsComplete = false;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t}\t\t\n\t\t}\n\t\tverifyRadioChecked(currentGroup);\n\t}); // radiogroup check\n \n\n\treturn allFieldsComplete;\n}", "function verifyForm()\n{\n valid = true;\n validFields.forEach(function(element) { valid &= element });\n changeFormState(valid);\n}", "function validateInputFields() {\n var msg = \"\";\n if ($(\"#txtTaskName\").val() === \"\") {\n msg += \"O campo 'Nome' é obrigatório.\";\n }\n if ($(\"#txtTaskDescription\").val() === \"\") {\n if (msg.length > 0) { msg += \"<br>\"; }\n msg += \"O campo 'Descrição' é obrigatório.\";\n }\n if ($(\"#txtTaskOrder\").val() === \"\") {\n if (msg.length > 0) { msg += \"<br>\"; }\n msg += \"O campo 'Ordem' é obrigatório.\";\n }\n if ($(\"#ddlTaskStatus option:selected\").val() === undefined) {\n if (msg.length > 0) { msg += \"<br>\"; }\n msg += \"O campo 'Estado' é obrigatório.\";\n }\n if (msg.length > 0) {\n MessageBox.info(msg, { Div: \"#divTaskModalMessage\" });\n return false;\n }\n MessageBox.clear({ Div: \"#divTaskModalMessage\" });\n return true;\n }", "function validateInputs(){\n\n var $errors = [];\n\n // Quantity\n var $quantity = $('[name=\"quantity\"]');\n var quantity = parseInt($quantity.val());\n if( isNaN( quantity ) || quantity < 1 ){\n $quantity.addClass('error');\n $errors.push($quantity);\n }\n \n // First name\n var $firstName = $('[name=\"billing_first_name\"]');\n if( $firstName.val() === '' ){\n $firstName.addClass('error');\n $errors.push($firstName);\n }\n\n // Last name\n var $lastName = $('[name=\"billing_last_name\"]');\n if( $lastName.val() === '' ){\n $lastName.addClass('error');\n $errors.push($lastName);\n }\n\n // Email\n var $email = $('[name=\"billing_email\"]');\n if( ! /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/.test($email.val() ) ){\n $email.addClass('error');\n $errors.push($email);\n }\n\n // Country\n var $country = $('[name=\"billing_country\"]');\n if( $country.val() === '' ){\n $country.addClass('error');\n $errors.push($country);\n }\n\n // Postal code\n var $postCode = $('[name=\"billing_postcode\"]');\n if( $postCode.val() === '' ){\n $postCode.addClass('error');\n $errors.push($postCode);\n }\n\n if( $errors.length ){\n\n $('html, body').animate({\n scrollTop: $errors[0].offset().top - 80\n }, 300);\n\n return false;\n }\n\n return true;\n }", "validateForm() {\n let fields = this.state.fields\n let errors = {}\n let formIsValid = true\n\n if (!fields[\"UsersFName\"]) {\n formIsValid = false\n errors[\"UsersFName\"] = \"Enter your first name.\"\n }\n\n if (typeof fields[\"UsersFName\"] !== \"undefined\") {\n if (!fields[\"UsersFName\"].match(/^[a-zA-Z ]*$/)) {\n formIsValid = false\n errors[\"UsersFName\"] = \"Enter Name that contains alphabet\"\n }\n }\n\n if (!fields[\"UsersLName\"]) {\n formIsValid = false\n errors[\"UsersLName\"] = \"Enter your last name.\"\n }\n\n if (typeof fields[\"UsersLName\"] !== \"undefined\") {\n if (!fields[\"UsersLName\"].match(/^[a-zA-Z ]*$/)) {\n formIsValid = false\n errors[\"UsersLName\"] = \"*Please enter alphabet characters only.\"\n }\n }\n\n if (!fields[\"UsersEmail\"]) {\n formIsValid = false\n errors[\"UsersEmail\"] = \"*Please enter your UsersEmail address.\"\n }\n\n if (typeof fields[\"UsersEmail\"] !== \"undefined\") {\n var emailPattern = new RegExp(/^((\"[\\w-\\s]+\")|([\\w-]+(?:\\.[\\w-]+)*)|(\"[\\w-\\s]+\")([\\w-]+(?:\\.[\\w-]+)*))(@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$)|(@\\[?((25[0-5]\\.|2[0-4][0-9]\\.|1[0-9]{2}\\.|[0-9]{1,2}\\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\]?$)/i)\n if (!emailPattern.test(fields[\"UsersEmail\"])) {\n formIsValid = false\n errors[\"UsersEmail\"] = \"Enter a valid UsersEmail address\"\n }\n }\n\n if (!fields[\"UsersPhone\"]) {\n formIsValid = false\n errors[\"UsersPhone\"] = \"Enter valid your UsersPhone number.\"\n }\n\n if (!fields[\"UsersPassword\"]) {\n formIsValid = false\n errors[\"UsersPassword\"] = \"Enter the UsersPassword.\"\n }\n\n if (typeof fields[\"UsersPassword\"] !== \"undefined\") {\n if (!fields[\"UsersPassword\"].length >= 6) {\n formIsValid = false\n errors[\"UsersPassword\"] = \"Enter a strong and a secured UsersPassword.\"\n }\n }\n\n this.setState({\n errors: errors\n })\n return formIsValid\n }", "function formValidation() {\n\t\t// Check for empty fields\n\t\tif ( contactName.val() == \"\" || contactEmail.val() == \"\" || validateEmail(contactEmail.val()) != true || contactMessage.val() == \"\" ) {\n\t\t\t// Check for ever field if empty -> apply border\n\t\t\tif ( contactName.val() == \"\" ) { contactName.addClass(\"form__invalid__border\"); } else { contactName.removeClass(\"form__invalid__border\"); }\n\t\t\tif ( contactEmail.val() == \"\" ) { contactEmail.addClass(\"form__invalid__border\"); } else { \n\t\t\t\tif ( validateEmail(contactEmail.val()) ) {\n\t\t\t\t\tcontactEmail.removeClass(\"form__invalid__border\"); \n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( contactMessage.val() == \"\" ) { contactMessage.addClass(\"form__invalid__border\"); } else { contactMessage.removeClass(\"form__invalid__border\"); } \n\t\t} \n\t\t// If fields aren't empty and email valid\n\t\telse {\n\t\t\t// Remove all validation borders\n\t\t\tcontactName.add(contactEmail).add(contactMessage).removeClass(\"form__invalid__border\");\n\t\t\n\t\t\treturn true;\n\t\t}\n\t}", "function checkForm(inputs) {\n let inputKeys = Object.keys(inputs);\n for (let key of inputKeys) {\n if (!inputs[key]) {\n throw new EmptyInputError(key);\n }\n }\n }", "function ValidateMandatoryVendors() {\n\tvar allValueValid = true;\n var invalidId = null;\n\t\n if (!ValidateTextBox(\"vendorNo1\")) {\n errorMessage.value += \"Please input the vendorNo!\\n\";\n invalidId = \"vendorNo1\";\n allValueValid = false;\n }\n\telse if (!ValidateInteger(\"vendorNo1\"))\n\t{\n\t\terrorMessage.value += \"VendorNo is not a whole number. Please input the vendorNo!\\n\";\n invalidId = \"vendorNo1\";\n allValueValid = false;\n\t}\n\t\n if (!ValidateTextBox(\"vendorName\")) {\n errorMessage.value += \"Please input the vendorName!\\n\";\n invalidId = \"vendorName\";\n allValueValid = false;\n }\n\tif (!ValidateTextBox(\"address1\")) {\n errorMessage.value += \"Please input the address1!\\n\";\n invalidId = \"address1\";\n allValueValid = false;\n }\n\tif (!ValidateTextBox(\"city\")) {\n errorMessage.value += \"Please input the city!\\n\";\n invalidId = \"city\";\n allValueValid = false;\n }\n\tif (!ValidateTextBox(\"prov\")) {\n errorMessage.value += \"Please input the province!\\n\";\n invalidId = \"prov\";\n allValueValid = false;\n }\n\telse if (!ValidateProvCountryCode(\"prov\")) {\n\t\terrorMessage.value += \"Wrong format! Please input the prov in two letters!\\n\";\n invalidId = \"prov\";\n allValueValid = false;\n\t}\n\t\n\tif (!ValidateTextBox(\"postCode\")) {\n errorMessage.value += \"Please input the postal code!\\n\";\n invalidId = \"postCode\";\n allValueValid = false;\n }\n\telse if (!ValidatePostalCode()){\n\t\terrorMessage.value += \"Postal code should have most 6 numbers or letters!\\n\";\n\t\tinvalidId = \"postCode\";\n\t\tallValueValid = false;\t\n\t}\n\t\n\tif (!ValidateTextBox(\"country\")) {\n errorMessage.value += \"Please input the country!\\n\";\n invalidId = \"country\";\n allValueValid = false;\n }\n\telse if (!ValidateProvCountryCode(\"country\")) {\n\t\terrorMessage.value += \"Wrong format! Please input the country in two letters!\\n\";\n invalidId = \"country\";\n allValueValid = false;\n\t}\n\t\n\tif (!ValidateTextBox(\"phone\")) {\n errorMessage.value += \"Please input the phone number!\\n\";\n invalidId = \"phone\";\n allValueValid = false;\n }\n\telse if (!ValidatePhoneFaxNumber(\"phone\")) {\n\t\terrorMessage.value += \"Wrong format! Please input the 10 digits phone number!\\n\";\n invalidId = \"phone\";\n allValueValid = false;\n\t}\n\n\tif (ValidateTextBox(\"fax\") && !ValidatePhoneFaxNumber(\"fax\")) {\n\t\terrorMessage.value += \"Wrong format! Please input the 10 digits fax number!\\n\";\n invalidId = \"fax\";\n allValueValid = false;\n\t}\n\t\n\tif (!allValueValid) {\n document.getElementById(invalidId).focus();\n }\n\n return allValueValid;\n}", "canSubmit() {\n return (\n this.validateOnlyLetterInput(this.state.name)==='' &&\n this.validateTelephone(this.state.telephone)==='' &&\n this.validateAddress(this.state.address)==='' &&\n this.validatePostalCode(this.state.postalCode)==='' &&\n this.validateOnlyLetterInput(this.state.city)===''\n );\n }", "function formHasErrors()\n{\n\tvar errorFlag = false;\n //validating all of the text fields to confirm the have options\n\tfor(let i = 0; i < requireTextFields.length; i++){\n\t\tvar textField = document.getElementById(requireTextFields[i])\n\t\t\n\t\tif(!hasInput(textField)){\n\t\t\t//display correct error message\n\t\t\tdocument.getElementById(requireTextFields[i] + \"_error\").style.display = \"inline\";\n document.getElementById(requireTextFields[i]).style.border = \"0.75px red solid\";\n \n\t\t\terrorFlag = true;\n\t\t} else {\n\t\t\t\n\t\t\t//after user enters the correct info this hides the border and error message\n\t\t\tdocument.getElementById(requireTextFields[i] + \"_error\").style.display = \"none\";\n\t\t\tdocument.getElementById(requireTextFields[i]).style.border = \"1px solid #e5e5e5;\";\n\t\t}\n\t}\n\treturn errorFlag;\n}", "function checkForm()\n {\n var valid = true;\n $('#yolo input[type=\"text\"]').each(function(){\n // If it's empty, or not a number.\n if (this.value == \"\" || this.value == null || isNaN(this.value)) // regular expression for numbers only.\n {\n $(this).css(\"border\", \"1px solid red\");\n $(this).attr(\"placeholder\", \"Please enter a number\");\n valid = false;\n }\n });\n return valid;\n }", "function validateFormFilled(fields, data, errors) {\n // Ensure all fields are filled.\n var filled = true;\n for (var i in fields) {\n if ([\"masculin\", \"feminin\", \"accepte\"].indexOf(data[fields[i]]) == -1 && data[fields[i]].value == \"\") {\n filled = false;\n }\n }\n if (!data[\"masculin\"].checked && !data[\"feminin\"].checked) {\n filled = false;\n }\n if (filled == false) {\n errors.push(\"Veuillez remplir tout le formulaire.\");\n }\n}", "function validar() {\n var i = 0;\n\n if ($(\"#txtNombre\").val().length < 1) {\n i++;\n }\n if ($(\"#txtSemestre\").val().length < 1) {\n i++;\n }\n if ($(\"#txtCarrera\").val().length < 1) {\n i++;\n }\n if ($(\"#txtSerie\").val().length < 1) {\n i++;\n }\n if ($(\"#txtHPracticas\").val().length < 1) {\n i++;\n }\n\n\n if (i == 5) {\n alert(\"Por favor llene todos los campos.\");\n return false;\n }\n\n\n if ($(\"#txtNombre\").val().length < 1) {\n alert(\"El nombre es obligatorio.\");\n }\n if ($(\"#txtSemestre\").val().length < 1) {\n alert(\"El semestre designado es obligatorio.\");\n }\n if ($(\"#txtCarrera\").val().length < 1) {\n alert(\"La carrera es obligatorio.\");\n }\n if ($(\"#txtSerie\").val().length < 1) {\n alert(\"La serie es obligatorio.\");\n }\n if ($(\"#txtHPracticas\").val().length < 1) {\n alert(\"El campo de horas practicas es obligatorio.\");\n }\n\n if (i == 0) {\n saveMtr(); \n $('#txtSerie').val('');\n $('#txtNombre').val('');\n $('#txtSemestre').val('');\n $('#txtCarrera').val('');\n $('#txtHPracticas').val('');\n return false;\n }\n\n}", "function ValidateMandatoryParts() {\n var allValueValid = true;\n var invalidId = null;\n\t\t\t\n if (!ValidateTextBox(\"description\")) {\n errorMessage.value += \"Please input the description!\\n\";\n invalidId = \"description\";\n allValueValid = false;\n }\n\t\n if (!ValidateTextBox(\"onHand\")) {\n errorMessage.value += \"Please input the onHand number!\\n\";\n invalidId = \"onHand\";\n allValueValid = false;\n }\n\telse if (!ValidateInteger(\"onHand\")) {\n\t\terrorMessage.value += \"onHand is not a whole number. Please input the onHand number!\\n\";\n invalidId = \"onHand\";\n allValueValid = false;\n\t}\n\t\n\tif (!ValidateTextBox(\"onOrder\")) {\n errorMessage.value += \"Please input the onOrder number!\\n\";\n invalidId = \"onOrder\";\n allValueValid = false;\n }\n\telse if (!ValidateInteger(\"onOrder\")) {\n\t\terrorMessage.value += \"OnOrder is not a whole number. Please input the onOrder number!\\n\";\n invalidId = \"onOrder\";\n allValueValid = false;\n\t}\n\t\n\tif (!ValidateTextBox(\"cost\")) {\n errorMessage.value += \"Please input the cost!\\n\";\n invalidId = \"cost\";\n allValueValid = false;\n }\n\telse if (!ValidateNumber(\"cost\")) {\n\t\terrorMessage.value += \"Cost is not a positive number. Please input the cost!\\n\";\n invalidId = \"cost\";\n allValueValid = false;\n\t}\n\t\n\tif (!ValidateTextBox(\"listPrice\")) {\n errorMessage.value += \"Please input the list Price!\\n\";\n invalidId = \"listPrice\";\n allValueValid = false;\n }\n\telse if (!ValidateNumber(\"listPrice\")) {\n\t\terrorMessage.value += \"ListPrice is not a number. Please input the list Price!\\n\";\n invalidId = \"listPrice\";\n allValueValid = false;\n\t}\n\t\n if (!allValueValid) {\n document.getElementById(invalidId).focus();\n }\n\n return allValueValid;\n}", "function formFieldsValid(formID) {\n //Iterate over inputs to check for is-valid class\n var valid = true;\n $(formID + ' :input').each(function(index){\n if (!$(this).hasClass('is-valid') && $(this).prop('required')) {\n if ($(this).attr('type') !== 'email') {\n $(this).addClass('is-invalid');\n valid = false;\n } else { //handle prepopulated email field\n if(checkEmailFormat($(this))) {\n $(this).addClass('is-valid'); //email is validly formatted\n } else { //email is invalidly formatted\n $(this).addClass('is-invalid');\n valid = false;\n }\n }\n }\n });\n return valid;\n}", "_onSubmitValidateInputs() {\n\t\tthis.setState({ inputDirty: true });\n\t\tlet validationValue = this._validateInputFeild(this.state.inputStateKey);\n\t\tthis.setState({ isValidInput: validationValue.test, invalidMessage: validationValue.test ? '' : validationValue.message })\n\t\tif (this.props.inputChanged) {\n\t\t\tthis.props.inputChanged(this.props.inputStateKey, this.state.inputStateKey, this.state.isValidInput)\n\t\t}\n\t}" ]
[ "0.73262227", "0.7302522", "0.72563267", "0.72172374", "0.72005695", "0.71999824", "0.71878856", "0.7152691", "0.7147368", "0.7126967", "0.7101604", "0.7047726", "0.6999337", "0.69938016", "0.6991415", "0.69649285", "0.6949245", "0.69211954", "0.69211954", "0.68971384", "0.68860406", "0.6852459", "0.6845666", "0.6838636", "0.6812848", "0.6811421", "0.6805302", "0.68049073", "0.6769089", "0.67502505", "0.674474", "0.6736967", "0.67351264", "0.6722891", "0.6720754", "0.6720108", "0.6699629", "0.6693755", "0.6664046", "0.66636443", "0.66593146", "0.66538066", "0.66441524", "0.6643943", "0.6627408", "0.6626571", "0.6619601", "0.6618943", "0.6612644", "0.6612371", "0.6611207", "0.6605694", "0.6580505", "0.6574779", "0.6572769", "0.656991", "0.656774", "0.65659136", "0.6551931", "0.65487415", "0.6543685", "0.6528181", "0.6518892", "0.6510376", "0.65076643", "0.65052754", "0.6501213", "0.650012", "0.64963967", "0.6489861", "0.6474386", "0.64728236", "0.64708376", "0.64629614", "0.64576674", "0.6445425", "0.64453316", "0.642808", "0.6427417", "0.64267105", "0.64254725", "0.6422988", "0.64225966", "0.64158136", "0.64078766", "0.64024305", "0.64006245", "0.6400602", "0.6399846", "0.63957125", "0.6395588", "0.6393854", "0.6387149", "0.6385705", "0.63855785", "0.63830984", "0.63779557", "0.6377037", "0.6374414", "0.6372051", "0.6371664" ]
0.0
-1
Check whether the given account code field is valid
function isAcctValid(field, num) { return !isNaN($(field).val()) && ($(field).val().length == num || $(field).val() == ""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static accountIsValid(account) {\n return true;\n }", "function validateCodeField(code) {\n if (code.length > 10) {\n return false;\n }\n return true;\n}", "function cekAccountNumber(field){\r\n\tvar accountNumber = /^[0-9][0-9]*$/;\r\n\tif(field.match(accountNumber)) {\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}", "isCodeFieldValid() {\n if (!this.promotion.useCodes) {\n return true;\n }\n return !this.isEmptyOrSpaces(this.promotion.code);\n }", "function codeValidator(code) {\n return code.length === 7 && (code.slice(0,4).match(/^[A-Za-z]+$/) != null) && (code.slice(4).match(/^[0-9]+$/) != null)\n}", "function validateCode (code) {\n code= code.toString()\n return code.startsWith([1])|| code.startsWith([2])|| code.startsWith([3])\n}", "function isAcctGood(field, num) {\n return !isNaN($(field).val()) && $(field).val().length == num;\n }", "function isValidCode(code) {\n if (!Number.isInteger(code)) {\n return false;\n }\n const codeString = code.toString();\n if (error_constants_1.errorValues[codeString]) {\n return true;\n }\n if (isJsonRpcServerError(code)) {\n return true;\n }\n return false;\n}", "function validateCode(code) {\r\n return /^[1|2|3]/.test(code);\r\n}", "static isValid(accountData) {\n var ret = typeof accountData.name == \"string\" &&\n typeof accountData.type == \"string\" &&\n typeof rootForType(accountData.type) == \"string\";\n if (!ret) {\n console.log(\"Invalid account: \", accountData);\n }\n return ret;\n }", "function containsCharacters(field, code) {\n let regEx;\n switch(code) {\n case 1 :\n // letters\n regEx = /(?=.*[a-zA-Z])/;\n return matchWithRegEx(regEx, field, 'Must contain at least one letter');\n case 2 :\n // letters and numbers\n regEx = /(?=.*\\d)(?=.*[a-zA-Z])/;\n return matchWithRegEx(regEx, field, 'Must contain one letter & one number');\n case 3 :\n // uppcase, lowercase and number\n regEx = /(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])/;\n return matchWithRegEx(regEx, field, 'Must contain one uppercase letter, one lowercase & one number');\n case 4 :\n // uppercase, lowercase, number and special char\n regEx = /(?=.*\\d)(?=.*[a-z])(?=.[A-Z])(?=.*\\W)/;\n return matchWithRegEx(regEx, field, 'Must contain at least one uppercase letter, one lowercase, one number and one special character');\n case 5 :\n regEx = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return matchWithRegEx(regEx, field, 'Must contain a valid email address');\n default :\n // default return\n return false;\n }\n}", "function isValidCode(code) {\n return code.length > 10;\n}", "function isValidAccountAddress(address){\n try {\n encodeAddress(\n isHex(address)\n ? hexToU8a(address)\n : decodeAddress(address)\n );\n\n return true;\n } catch (error) {\n return false;\n }\n}", "function checkCode(code) {\n return code < 20;\n }", "function validate_orderCode() {\r\n\t\tvar val = $(\"#orderCode\").val();\r\n\t\tvar exp = /^[A-Za-z0-9_-]{2,8}$/;\r\n\t\tif (val == '') {\r\n\t\t\t$(\"#orderCodeError\").show();\r\n\t\t\t$(\"#orderCodeError\").html(\"ORDER-CODE<b> shuld not be empty</b>\");\r\n\t\t\t$(\"#orderCodeError\").css(\"color\", \"red\");\r\n\t\t\torderCodeError = false;\r\n\t\t} else if (!exp.test(val)) {\r\n\t\t\t$(\"#orderCodeError\").show();\r\n\t\t\t$(\"#orderCodeError\").html(\"ORDER-CODE<b> shuld 2-8 only</b>\");\r\n\t\t\t$(\"#orderCodeError\").css(\"color\", \"green\");\r\n\t\t\torderCodeError = false;\r\n\t\t} else {\r\n\t\t\t$(\"#orderCodeError\").hide();\r\n\t\t\torderCodeError = true;\r\n\t\t}\r\n\t\treturn orderCodeError;\r\n\t}", "function validate_orderCode() {\r\n\t\tvar val = $(\"#orderCode\").val();\r\n\t\tvar exp = /^[A-Za-z0-9_-]{2,8}$/;\r\n\t\tif (val == '') {\r\n\t\t\t$(\"#orderCodeError\").show();\r\n\t\t\t$(\"#orderCodeError\").html(\"ORDER-CODE<b> shuld not be empty</b>\");\r\n\t\t\t$(\"#orderCodeError\").css(\"color\", \"red\");\r\n\t\t\torderCodeError = false;\r\n\t\t} else if (!exp.test(val)) {\r\n\t\t\t$(\"#orderCodeError\").show();\r\n\t\t\t$(\"#orderCodeError\").html(\"ORDER-CODE<b> shuld 2-8 only</b>\");\r\n\t\t\t$(\"#orderCodeError\").css(\"color\", \"green\");\r\n\t\t\torderCodeError = false;\r\n\t\t} else {\r\n\t\t\t$(\"#orderCodeError\").hide();\r\n\t\t\torderCodeError = true;\r\n\t\t}\r\n\t\treturn orderCodeError;\r\n\t}", "function isValidSecurityCode() {\r\n var x = document.getElementById(\"SecurityCode\");\r\n var regex = /^\\d{3}$/;\r\n if (!x.value.match(regex)) {\r\n document.getElementById('validCode').style.display = \"block\";\r\n document.getElementById('validCodeSpace').style.display = \"block\";\r\n isSecurityCode = false;\r\n }\r\n else {\r\n document.getElementById('validCode').style.display = \"none\";\r\n document.getElementById('validCodeSpace').style.display = \"none\";\r\n isSecurityCode = true;\r\n }\r\n}", "function postalCode() {\n var errors = document.querySelector(\"#errors\");\n var pCode = document.querySelector(\"#postalCode\");\n var code = pCode.value.trim();\n var patt = /^[A-Z][0-9][A-Z][0-9][A-Z][0-9]$/ig;\n if(!patt.test(code)) {\n errorMessage(\"<p>Please enter a valid Canadian postal code</p>\");\n return false;\n } else {\n return true;\n }\n}", "function validateSecurityCode() {\r\n var securityCode = document.getElementById(\"securitycode\");\r\n var regex = /^[0-9]{3}$/;\r\n if (!securityCode.value.match(regex)) {\r\n securityCode.style.borderColor = \"red\";\r\n document.getElementById(\"ValidSecurity\").style.display = \"block\";\r\n keysecurityCode = false;\r\n }\r\n else {\r\n securityCode.style.borderColor = \"darkturquoise\";\r\n document.getElementById(\"ValidSecurity\").style.display = \"none\";\r\n keysecurityCode = true;\r\n }\r\n}", "function checkDiscountcode(code) {\n if (DISCOUNTCODE === code) {\n hasDiscount = true;\n\t\t\t\talert(\"Success!\");\n } else {\n\t\t\thasDiscount = false;\n alert(\"Code Invalid\");\n }\n}", "function validateAccountInfo() {\n if (!volunteerRegObject.emailAddress) {\n return false;\n }\n if (!volunteerRegObject.password) {\n return false;\n }\n if (!volunteerRegObject.reenteredPassword) {\n return false;\n }\n return true;\n}", "function ValidateField(bank, name, number) {\n if (bank.id === \"default\") {\n console.log(bank.id);\n displayAlert(\"danger\", \"bank must not be empty\");\n return false;\n } else if (name.value === \"\" || !isNaN(name.value)) {\n console.log(name.value);\n displayAlert(\"danger\", \"invalid acc name\");\n return false;\n } else if (name.value.length < 5) {\n displayAlert(\"danger\", \"acc name too short\");\n return false;\n } else if (\n number.value === \"\" ||\n number.value.length !== 10 ||\n isNaN(number.value)\n ) {\n console.log(number.value);\n displayAlert(\"danger\", \"invalide acc number\");\n return false;\n } else {\n displayAlert(\"success\", \"Account added successfully\");\n //close the form\n animated(overlay, \"fadeOut\");\n AddRemoveClass(overlay, \"remove\", \"on\");\n AddRemoveClass(formContainer, \"remove\", \"open\");\n return true;\n }\n }", "function validateVisa(){\r\n\tvar creditNumber=document.getElementById(\"creditNumber\").value;\r\n\r\n\tif(creditNumber.length==0){\r\n\t\tprintError(\"creditNumber required\",\"creditError\",\"red\");\r\n\t\ttextboxBorder(\"creditNumber\");\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\tif(!creditNumber.match(/^[0-9]{16}$/)){\r\n\r\n\t\tprintError(\"enter 16 digit credit card number\",\"creditError\",\"blue\");\r\n\t\ttextboxBorder(\"creditNumber\");\r\n\t\treturn false;\r\n\t}\r\n\r\n\tprintSuccess(\"creditNumber\",\"green\",\"creditError\");\r\n\treturn true;\r\n\r\n\r\n}", "function luhnValidate(fullCode){\n return luhnCheckDigitCalculate(fullCode) == 0;\n}", "function isValidData(field) {\n // validation result\n var res = true;\n // Email validation\n var regex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/;\n\n\n // Clear global error message\n vm.messages.error = null;\n\n // Validate Name\n if ((field && field === 'name') || !field) {\n if ((typeof vm.credentials.name !== 'undefined') && (vm.credentials.name.trim() !== '')) {\n res &= true;\n vm.messages.name = null;\n } else {\n res &= false;\n vm.messages.name = 'Please insert your name';\n }\n }\n\n // Validate Email\n if ((field && field === 'email') || !field) {\n if (regex.exec(vm.credentials.email) !== null) {\n res &= true;\n vm.messages.email = null;\n } else {\n res &= false;\n vm.messages.email = 'Please insert a valid email address';\n }\n }\n\n // Validate Password\n if ((field && field === 'password') || !field) {\n if ((typeof vm.credentials.password !== 'undefined') &&\n (vm.credentials.password.trim() !== '')) {\n res &= true;\n vm.messages.password = null;\n } else {\n res &= false;\n vm.messages.password = 'Please insert your account password';\n }\n }\n\n return res;\n }", "static checkAccountNumber(key, userValue){\n\n var result = true;\n var msg = '';\n\n // check account number is numeric\n var numeric = userValue.match(/^\\d+$/);\n\n if (this.checkEmptyUserInput(userValue)) {\n result = false;\n // alert(key + ' cannot be empty');\n msg = key + ' cannot be empty';\n }\n else if (!numeric) {\n // alert(key + ' should be in numeric');\n result = false;\n msg = key + ' should be in numeric';\n }\n // Check if account number is 14 digits\n else if (userValue.length!=14)\n {\n // alert(key + ' should be 15 digits');\n msg = key + ' should be 15 digits';\n result =false;\n }\n\n return msg;\n\n\n /*\n\n if(num.match(/^\\d+$/)){\n //valid integer\n}else if(num.match(/^\\d+\\.\\d+$/)){\n //valid float\n}else{\n //not valid number\n}\n\n */\n\n }", "function checkPostalCodeValidity(form) {\n// Taken from URL: https://stackoverflow.com/questions/15774555/efficient-regex-for-canadian-postal-code-function/26788801\n\tvar value = form.postal_code.value;\n\tvar regex = /^[A-Za-z]\\d[A-Za-z][ -]?\\d[A-Za-z]\\d$/;\n var match = regex.exec(value);\n if (match){\n if ( (value.indexOf(\"-\") !== -1 || value.indexOf(\" \") !== -1 ) && value.length == 7 ) {\n return true;\n } else if ( (value.indexOf(\"-\") == -1 || value.indexOf(\" \") == -1 ) && value.length == 6 ) {\n return true;\n }\n } else {\n\t\t window.alert(\"Postal code must be in the format A0A 0A0.\");\n return false;\n }\n\n}", "function validateCCNum(field, value) {\n const hint = document.getElementById('cc-hint');\n if(!isValidCCNum(value)) {\n showError(field, hint);\n } else {\n hideError(field, hint);\n }\n}", "function check(fullcode) {\n return luhnChecksum(fullcode) === 0;\n}", "function validate_airlineCode (id) {\n\t/*var pass1 = document.getElementById(id).value; \n //alert(pass1.length);\n if( /^[A-z0-9 ]+$/.test(pass1) && pass1.length <= 3)\n {\n $('#'+id).css({'border':'1px solid #ddd'});\n return true;\n }\n else\n {\n error_msg_alert('Please enter valid Airline Code');\n $('#'+id).css({'border':'1px solid red'}); \n //alert(\"Use only letter in name!\"); \n document.getElementById(id).value=\"\";\n $('#'+id).focus(); \n g_validate_status = false;\n return false;\n } */\n\treturn true;\n}", "function isOkzipCode() {\n //we control de length and the digits were numbers matching their value\n // >9999 --> 5 digits or more && < 100000 less than 5 digits\n if (zipCode.value > 9999 && zipCode.value < 100000 ) {\n cleanErrorMessage(zipCode);\n return true;\n } else if (ccnum.value.includes(' ')) {\n cleanErrorMessage(zipCode);\n errorIndication(zipCode);\n return false;\n } else {\n errorIndication(zipCode);\n return false;\n }\n }", "function creditCardIsValid() {\n return ($(\"#cc-num\").val() > 0);\n }", "function validate_cc() {\n\t\tvar types = [\n\t\t\t\t{ '.ccNumberError': $accountNumber },\n\t\t\t\t{ '.ccExpiryError': $accountExpiry },\n\t\t\t\t{ '.ccCVCError': $accountCVC }\n\t\t\t];\n\n\t\ttypes.forEach( function ( type ) {\n\t\t\tvar key;\n\t\t\tfor ( key in type) {\n\t\t\t\tif ( $( type[key] ).hasClass('invalid') ) {\n\t\t\t\t\t$( key ).addClass( 'show' );\n\t\t\t\t} else if ( !$( type[key] ).hasClass( 'invalid' ) ) {\n\t\t\t\t\t$( key ).removeClass( 'show' ).addClass('hide' );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\n\t}", "function checkVerficationCodeMatch(){\n var entered = $(\"#verificationCode\").val();\n var code = $(\"#code\").text()\n if (entered != code){\n $(\"#divCheckVerificationCodeMatch\").html(\"Verification code is not correct\");\n $(\"#divCheckVerificationCodeMatch\").css(\"color\", \"red\");\n document.getElementById(\"signupbtn\").disabled = true;\n }else{\n $(\"#divCheckVerificationCodeMatch\").html(\"Verification code is correct.\");\n document.getElementById(\"signupbtn\").disabled = false;\n $(\"#divCheckVerificationCodeMatch\").css(\"color\", \"green\");\n }\n}", "function AndIEnterAnInvalidCode() {\n cy.get(\"input[name=code]\").type(\"wrong\");\n cy.get(\"input[name=password]\").type(Cypress.env(\"validTrustAdminPassword\"));\n }", "function nirValidator(assuranceCode){ \n if(nirRegex.test(assuranceCode)){\n var nir = Number(\n assuranceCode\n .replace(\"2A\",\"19\")\n .replace(\"2B\",\"18\")\n .slice(0, assuranceCode.length - 2)\n );\n return ( 97 - nir % 97 ) == Number( assuranceCode.slice(-2) );\n } else {\n return false;\n }\n}", "function validateCard () {\n\n isValid(cardNumInput);\n isCardValid = true;\n\n if (paymentSelect.value === 'credit card') {\n if (!/^\\d{13,16}$/.test(cardNumInput.value)) {\n isInvalid(cardNumInput);\n isCardValid = false;\n }\n }\n}", "function validateCode(code) {\n \tif (!code) {\n \t\treturn 65533;\n \t}\n\n \t// line feed becomes generic whitespace\n \tif (code === 10) {\n \t\treturn 32;\n \t}\n\n \t// ASCII range. (Why someone would use HTML entities for ASCII characters I don't know, but...)\n \tif (code < 128) {\n \t\treturn code;\n \t}\n\n \t// code points 128-159 are dealt with leniently by browsers, but they're incorrect. We need\n \t// to correct the mistake or we'll end up with missing € signs and so on\n \tif (code <= 159) {\n \t\treturn controlCharacters[code - 128];\n \t}\n\n \t// basic multilingual plane\n \tif (code < 55296) {\n \t\treturn code;\n \t}\n\n \t// UTF-16 surrogate halves\n \tif (code <= 57343) {\n \t\treturn 65533;\n \t}\n\n \t// rest of the basic multilingual plane\n \tif (code <= 65535) {\n \t\treturn code;\n \t}\n\n \treturn 65533;\n }", "function AndIEnterAnInvalidCode() {\n cy.get(\"input[name=code]\").type(\"wrong\");\n cy.get(\"input[name=password]\").type(Cypress.env(\"validAdminPassword\"));\n }", "function validatePostcode(postcode) {\n if (postcode >= 3000 && postcode <= 3207) {\n return true;\n } else if (postcode == 3800) {\n return true;\n } else {\n return false;\n }\n}", "validateAwardAccount() {\n let result = false;\n let account = this.awards.accountID;\n let state = this.awards.accountState;\n let accountExist = this.bank.players.some(p => p.id === account);\n\n if (accountExist) {\n state.reset();\n result = true;\n } else {\n state.hasError = true;\n }\n\n return result;\n }", "function ordersDeliveryPostcodeValid(pc_str) {\n\t\n\tvar result = true;\n\tif (!isEmpty(pc_str))\n\t{\n\t\tif (!isNumeric(pc_str)) // Don't check postcode length in case overseas order\n\t\t/*{\n\t\t\tif (!isLengthOkay(pc_str, 4))\n\t\t\t{\n\t\t\t\talert(\"Postcode needs to be 4 digits. You entered \" + pc_str);\n\t\t\t\tresult = false;\n\t\t\t}\n\t\t}\n\t\telse*/\n\t\t{\n\t\t\talert(\"Delivery postcode must be all digits. You entered \" + pc_str);\n\t\t\tresult = false;\n\t\t}\n\t}\n\telse\n\t{\n\t\talert(\"Delivery postcode is empty. Please enter a value.\");\n\t\tresult = false;\n\t}\n\treturn result;\n}", "function validateCanadaPostalCode(field) {\n // empty fields pass validation\n if (field === undefined || field === null) {\n return true;\n }\n var regex = new RegExp(/(^[A-Za-z0-9]{6}$)|(^[A-Za-z0-9]{3}\\s[A-Za-z0-9]{3}$)/);\n return regex.test(field);\n}", "function validateField(type, name, linenum)\r\n{\r\n\r\n\t/* On validate field:\r\n\r\n - EXPLAIN THE PURPOSE OF THIS FUNCTION\r\n\r\n\r\n FIELDS USED:\r\n\r\n --Field Name--\t\t\t\t--ID--\r\n\r\n\r\n */\r\n\r\n\r\n\t// LOCAL VARIABLES\r\n\r\n\r\n\r\n\t// VALIDATE FIELD CODE BODY\r\n\r\n\r\n\treturn true;\r\n\r\n}", "function isCCNumValid() {\n let ccNumPattern = /^\\d{4} \\d{4} \\d{4} \\d{4}$/;\n if (ccNumPattern.test(ccNumElement.value)) {\n document.getElementById('CCNumError').style.visibility = \"hidden\";\n return true;\n } else {\n document.getElementById('CCNumError').style.visibility = \"visible\";\n return false;\n }\n\n}", "function validateBarCode47(barcode) {\n\n if (barcode != null) {\n\tbarcode = barcode.replace(/\\D/g,\"\");\n\n\tif (barcode.length == 47) {\n\n\t var campo1 = barcode.substring(0,9);\n\t //console.log('Campo 1: ' + campo1 + ' ' + modulo10(campo1));\n\t var campo2 = barcode.substring(10,20);\n\t //console.log('Campo 2: ' + campo2 + ' ' + modulo10(campo2));\n\t var campo3 = barcode.substring(21,31);\n\t //console.log('Campo 3: ' + campo3 + ' ' + modulo10(campo3));\n\t var campo4 = barcode.substring(32,33); // Digito verificador\n\t //console.log('Campo 4: ' + campo4);\n\t var campo5 = barcode.substring(0,4) + barcode.substring(33,34) + \n barcode.substring(34,48) + barcode.substring(4, 9) +\n campo2 + campo3 ;\n\t //console.log('Campo 5: ' + campo5 + ' ' + modulo11(campo5)); \n\n\t //console.log(barcode.substring(9,10) + barcode.substring(20,21) + barcode.substring(31,32));\n\n\t return barcode.substring(9,10) == modulo10(campo1) &&\n\t\t barcode.substring(20,21) == modulo10(campo2) &&\n\t\t barcode.substring(31,32) == modulo10(campo3) &&\n\t\t modulo11(campo5) == campo4;\n\t}\n }\n\n return false;\n}", "verifyFunds({\n account,\n amount\n }) {\n if (this.ledger[account] === undefined) {\n throw new Error(`${account} is not a registered customer of the bank`);\n }\n let balance = this.ledger[account];\n return balance >= amount;\n }", "function validateUSAZipCode(field) {\n // empty fields pass validation\n if (field === undefined || field === null) {\n return true;\n }\n var regex = new RegExp(/(^\\d{5}$)|(^\\d{5}-\\d{4}$)/);\n return regex.test(field);\n}", "checkCode(onChainCode, contractName, address) {\n if (!onChainCode || onChainCode.replace(\"0x\", \"\").replace(/0/g, \"\") === \"\")\n throw new Error(\n `Cannot create instance of ${contractName}; no code at address ${address}`\n );\n }", "checkCode(onChainCode, contractName, address) {\n if (!onChainCode || onChainCode.replace(\"0x\", \"\").replace(/0/g, \"\") === \"\")\n throw new Error(\n `Cannot create instance of ${contractName}; no code at address ${address}`\n );\n }", "function isValid(iotaAreaCode) {\r\n // Check if all the characters fall within our alphabet\r\n const re = new RegExp(`^[${alphabet_1.IAC_APHABET}]*$`);\r\n let codeIsValid = re.test(iotaAreaCode);\r\n if (codeIsValid) {\r\n // Now validate using OLC validation\r\n codeIsValid = open_location_code_typescript_1.default.isFull(internal_1.iacToOlcInternal(iotaAreaCode));\r\n }\r\n return codeIsValid;\r\n}", "function checkCreditCard (radio, theField)\r\n{ var cardType = getRadioButtonValue (radio)\r\n var normalizedCCN = stripCharsInBag(theField.value, creditCardDelimiters)\r\n if (!isCardMatch(cardType, normalizedCCN))\r\n return warnInvalid (theField, iCreditCardPrefix + cardType + iCreditCardSuffix);\r\n else\r\n { theField.value = normalizedCCN\r\n return true\r\n }\r\n}", "function validateCVC(field) {\n if (field === undefined || field === null) {\n return false;\n }\n var cvc_regexp = /^[0-9]{3,4}?$/;\n if (cvc_regexp.test(field) === true) {\n return true;\n }\n return false;\n}", "function validate_PINCode (id) {\n\t/*var pass1 = document.getElementById(id).value; \n if( /^\\d{6}$/.test(pass1))\n {\n $('#'+id).css({'border':'1px solid #ddd'});\n return true;\n }\n else\n {\n error_msg_alert('Please enter valid PIN code');\n $('#'+id).css({'border':'1px solid red'}); \n //alert(\"Use only letter in name!\"); \n document.getElementById(id).value=\"\";\n $('#'+id).focus(); \n g_validate_status = false;\n return false;\n } */\n\treturn true;\n}", "function checkCreateAcctFields(origin) {\n var form_error = 0;\n\n // WEB-8822 / TFM\n // --------------\n // var uname = $('#edit-name').val();\n // --------------\n\n var email = $('#edit-mail').val();\n\n // trim and re-assign email + username only on blur\n $('#edit-mail').blur(function () {\n $('#edit-mail').val( trim($('#edit-mail').val()));\n });\n\n\n // WEB-8822 / TFM\n // --------------\n // $('#edit-name').blur(function () {\n // $('#edit-name').val( trimWS($('#edit-name').val()));\n // });\n // --------------\n\n if (origin) {\n var fname = $('#edit-first-name').val();\n var lname = $('#edit-last-name').val();\n var password = $('#edit-pass-pass1').val();\n var password_confirm = $('#edit-pass-pass2').val();\n\n // WEB-8822 / TFM\n // --------------\n if ($(\"#edit-mollom-captcha-wrapper\").length) {\n var captcha = $('#edit-mollom-captcha').val();\n }\n // --------------\n\n if (fname === '') {\n form_error = 1;\n }\n else if (lname === '') {\n form_error = 1;\n }\n else if (password === '') {\n form_error = 1;\n }\n else if (password_confirm === '') {\n form_error = 1;\n }\n // WEB-8822 / TFM\n // --------------\n else if (captcha === '') {\n form_error = 1;\n }\n // --------------\n\n if (\n $('.password-description').length &&\n $('.password-description').css('display') == 'block' &&\n $('#edit-pass-pass2').length &&\n $('#edit-pass-pass2').val() != '')\n {\n $('.password-description').css('display','none');\n }\n\n }\n\n // WEB-8822 / TFM\n // --------------\n // if (uname == '') {\n // form_error = 1;\n // }\n // --------------\n\n if (checkEmail(email) == false) {\n form_error = 1;\n }\n\n // if ($('#useremail-check-message').css('display') == 'block') {\n // form_error = 7;\n // }\n\n // WEB-9309 / TFM\n // ------------------------\n // if (form_error == 1) {\n // // if ($('#messages-wrapper').length) {\n // // $('#messages-wrapper').fadeOut('slow');\n // // }\n // $('#btnCreateAccount').css('opacity','0.5');\n // $('#btnCreateAccount').unbind('click');\n // $('#btnCreateAccount').unbind('keyup');\n // } else {\n if (form_error === 0) {\n // ------------------------\n $('#edit-submit').unbind('click')\n .unbind('keyup')\n .css('opacity','1')\n .click(function() {\n submitCreateAcctForm(origin);\n })\n .keyup(function(event) {\n checkKeyPressed(event);\n });\n }\n else{\n $('#btnCreateAccount').unbind('click').unbind('keyup').css('opacity','0.5');\n }\n\n}", "function validateCode ( code ) {\n\t \tif ( !code ) {\n\t \t\treturn invalid;\n\t \t}\n\n\t \t// line feed becomes generic whitespace\n\t \tif ( code === 10 ) {\n\t \t\treturn 32;\n\t \t}\n\n\t \t// ASCII range. (Why someone would use HTML entities for ASCII characters I don't know, but...)\n\t \tif ( code < 128 ) {\n\t \t\treturn code;\n\t \t}\n\n\t \t// code points 128-159 are dealt with leniently by browsers, but they're incorrect. We need\n\t \t// to correct the mistake or we'll end up with missing € signs and so on\n\t \tif ( code <= 159 ) {\n\t \t\treturn controlCharacters[ code - 128 ];\n\t \t}\n\n\t \t// basic multilingual plane\n\t \tif ( code < 55296 ) {\n\t \t\treturn code;\n\t \t}\n\n\t \t// UTF-16 surrogate halves\n\t \tif ( code <= 57343 ) {\n\t \t\treturn invalid;\n\t \t}\n\n\t \t// rest of the basic multilingual plane\n\t \tif ( code <= 65535 ) {\n\t \t\treturn code;\n\t \t} else if ( !codePointSupport ) {\n\t \t\treturn invalid;\n\t \t}\n\n\t \t// supplementary multilingual plane 0x10000 - 0x1ffff\n\t \tif ( code >= 65536 && code <= 131071 ) {\n\t \t\treturn code;\n\t \t}\n\n\t \t// supplementary ideographic plane 0x20000 - 0x2ffff\n\t \tif ( code >= 131072 && code <= 196607 ) {\n\t \t\treturn code;\n\t \t}\n\n\t \treturn invalid;\n\t }", "function validate_zip_code(type){\r\n var strValidChars = '0123456789';\r\n var zipcode_val = $('#'+type+'_zip_code_new').val();\r\n var flag = 1;\r\n \r\n //zipcode should be only 5 digit long\r\n if(zipcode_val.length < 5 || zipcode_val.length > 5){\r\n flag=0;\r\n }\r\n //if not numeric\r\n for(var i=0;i<zipcode_val.length;i++){\r\n strChar = zipcode_val.charAt(i);\r\n if (strValidChars.indexOf(strChar) == -1){\r\n flag=0;\r\n }\r\n }\r\n \r\n return flag;\r\n \r\n}", "function isValidPostalCode(code, country) {\n // debug.info( 'isValidPostalCode', code, country );\n code = $.trim(code);\n var format = getPostalCodeRegexMatrix(country);\n if (format) {\n if (code.length < parseInt(format.minlen)) {\n return false;\n }\n if (code.length > parseInt(format.maxlen)) {\n return false;\n }\n var re = new RegExp(format.regex);\n return re.test(code);\n }\n //getPostalCodeRegexMatrix will check the country as a key in the map postal_code_matrix, so for these countries which doesn't have postal code, we need to return true\n else if (format == '') {\n return true;\n }\n else {\n debug.log('No country found')\n return true;\n }\n}", "function isValidCodeForm()\n {\n if($scope.codiceVerifica.$invalid)\n {\n $ionicPopup.alert({\n title: 'ListenCheck',\n template: \"Il codice di verifica deve essere di 6 cifre\"\n });\n return false;\n }\n else return true;\n }", "function isAvaliableCountryCode(){\n var returnVal = false;\n\n id = document.getElementById('country'); \n countryCode = id.value;\n \n countryCode = countryCode.toUpperCase().trim(); \n\n var countryCodeRe = new RegExp(/^[A-Z]{2}$/i);\n\n if (countryCodeRe.test(countryCode.toString())) { \n id.value = countryCode;\n document.getElementById('country_error').style = \"display:none\"; \n return true;\n }\n else\n {\n document.getElementById('country_error').style = \"display:block\";\n return false;\n }\n}", "validateCodeError (data) {\n\t\t// verify we got back an code error with the attributes we specified\n\t\tconst codeError = data.codeError;\n\t\tconst expectedOrigin = this.expectedOrigin || '';\n\t\tconst expectedStackTraces = this.test.expectedStackTraces || this.inputCodeError.stackTraces;\n\t\tconst expectedTeamId = this.test.codeErrorInDifferentTeam ? this.test.codeErrorInDifferentTeam.teamId : this.test.team.id;\n\t\tconst expectedStreamId = this.test.codeErrorInDifferentTeam ? this.test.codeErrorInDifferentTeam.streamId : (this.inputCodeError.streamId || '');\n\t\tlet errors = [];\n\t\tlet result = (\n\t\t\t((codeError.id === codeError._id) || errors.push('id not set to _id')) && \t// DEPRECATE ME\n\t\t\t((codeError.teamId === expectedTeamId) || errors.push('teamId does not match the team')) &&\n\t\t\t((codeError.streamId === expectedStreamId) || errors.push('streamId does not match the stream')) &&\n\t\t\t((codeError.postId === (this.inputCodeError.postId || '')) || errors.push('postId does not match the post')) &&\n\t\t\t((codeError.deactivated === false) || errors.push('deactivated not false')) &&\n\t\t\t((typeof codeError.createdAt === 'number') || errors.push('createdAt not number')) &&\n\t\t\t((codeError.lastActivityAt === codeError.createdAt) || errors.push('lastActivityAt should be set to createdAt')) &&\n\t\t\t((codeError.modifiedAt >= codeError.createdAt) || errors.push('modifiedAt not greater than or equal to createdAt')) &&\n\t\t\t((codeError.creatorId === this.test.currentUser.user.id) || errors.push('creatorId not equal to current user id')) &&\n\t\t\t((codeError.numReplies === 0) || errors.push('codeError should have 0 replies')) &&\n\t\t\t((codeError.origin === expectedOrigin) || errors.push('origin not equal to expected origin')) &&\n\t\t\t(DeepEqual(codeError.stackTraces, expectedStackTraces) || errors.push('stackTraces does not match')) &&\n\t\t\t((codeError.providerUrl === this.inputCodeError.providerUrl) || errors.push('providerUrl does not match'))\n\t\t);\n\t\tAssert(result === true && errors.length === 0, 'response not valid: ' + errors.join(', '));\n\n\t\t// verify the code error in the response has no attributes that should not go to clients\n\t\tthis.test.validateSanitized(codeError, CodeErrorTestConstants.UNSANITIZED_ATTRIBUTES);\n\n\t\t// validate the code error's permalink\n\t\tthis.validatePermalink(codeError.permalink);\n\t}", "function isCvvCodeValid (cvv) {\r\n return /^\\d{3}$/.test(cvv); \r\n}", "function checkZipcode() {\n var pattern = new RegExp(/^[0-9]{5}$/i);\n \n if (pattern.test(zipcodeInput.val())) {\n $(\"#zipcode_error_message\").hide();\n zipcodeInput.removeClass('error');\n }\n else {\n $(\"#zipcode_error_message\").html(\"Enter valid zipcode\");\n $(\"#zipcode_error_message\").show();\n zipcodeInput.addClass('error');\n error_zipcode = true;\n }\n }", "function checkPincode()\r\n\t{\r\n\t\tvar pin=$(\"#pincode\").val();\r\n\t\t \r\n\t\t if(!isEmpty(pin))\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t$(\"#pincode\").css(\"border-color\",\"red\");\r\n\t\t\t\t$(\"#pincodeP\").text(\"Pincode is Required\").css(\"color\",\"red\").show();\r\n\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\tif(!pincodeRegEx.test(pin))\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t$(\"#pincode\").css(\"border-color\",\"red\");\r\n\t\t\t\t$(\"#pincodeP\").text(\"Invalid Pincode Entered\").css(\"color\",\"red\").show();\r\n\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t \r\n\t\telse\r\n\t\t\t{\r\n\t\t\t\t$(\"#pincode\").css(\"border-color\",\"\");\r\n\t\t\t\t$(\"#pincodeP\").hide();\r\n\r\n\t\t\t\treturn true;\r\n\t\t\t}\t\r\n\t}", "function PasscodeValidator(code) {\n var secret = code;\n this.validate = function(attempt) {\n return attempt == secret;\n }\n}", "edit_account(data) {\n\t\tutil.inputValidation(this.addressLine1,data.AddressLine1,'Address line 1','Account Info ');\n\t\tutil.inputValidation(this.addressLine2,data.AddressLine2,'Address Line 2','Account Info');\n\t\tutil.inputValidation(this.city,data.City,'City','Account Info');\n\t\tutil.inputValidation(this.state,data.State,'State','Account Info');\n\t\tutil.inputValidation(this.zip,data.Zip,'Zip','Account Info');\n\t\tutil.inputValidation(this.phone,data.Phone,'Phone','Account Info');\n\t\tutil.inputValidation(this.phoneContact,data.PhoneContact,'Phone Contact','Account Info');\n\t\tutil.inputValidation(this.fax,data.Fax,'Fax','Account Info');\n\t\tutil.inputValidation(this.faxContact,data.FaxContact,'Fax Contact','Account Info');\n\t\tutil.inputValidation(this.description,data.Description,'Description','Account Info');\n\t\tutil.scrolldown(this.nextBtn1)\n\t\tutil.elementClickable(this.nextBtn1);\n\t\treturn util.resultMessage(data.TestResultType);\n\t}", "testCode (code) {\n var regexcode =/^\\d{10}$/;\n return regexcode.test(code)\n }", "function cardnumber(ccnum)\n{\n var cardno = /^(?:4[0-9]{12}(?:[0-9]{3})?)$/;\n if(ccnum.value.match(cardno))\n {\n return true;\n }\n else\n {\n alert(\"Not a valid Visa credit card number!\");\n return false;\n }\n}", "verifyCountryCode(countryCode) {\r\n const countryCodeLowerCase = countryCode.toLowerCase();\r\n if (this.isCountryCode(countryCodeLowerCase)) {\r\n return countryCode;\r\n }\r\n else {\r\n const message = \"Invalid parameter for country code; \" + \"\\'\" + countryCode + \"\\'\" + \" is not acceptable. Only Canada (ca) is supported at the moment.\";\r\n throw new InvalidUserParameterException('INVALID COUNTRY CODE', message);\r\n }\r\n }", "function checkValidation(e) {\n setValidCodeError(\"\");\n setCode(inputCode.current.value);\n const codeLength = e.target.value.length;\n if (codeLength < 5 || codeLength > 5) {\n setGoBtnDisabled(true);\n } else {\n if (postcodeValidator(e.target.value, \"US\")) {\n setGoBtnDisabled(false);\n } else {\n setValidCodeError(\"Invalid zip Code\");\n setGoBtnDisabled(true);\n }\n }\n }", "function cardnumber(ccnum)\n{\n var cardno = /^(?:3[47][0-9]{13})$/;\n if(ccnum.value.match(cardno))\n {\n return true;\n }\n else\n {\n alert(\"Not a valid Amercican Express credit card number!\");\n return false;\n }\n}", "static async verifyAccount(email, code) {\n try {\n\n // get user object by email\n const user = await User.getUserByEmail(email);\n\n //if no user found through Not Found error\n if (!user) throw new ExpressError('No user found for this email', 404);\n\n // compare input code against hashed version in database\n if (await bcrypt.compare(code, user.account.verificationCode)) {\n // if matched, verify account\n\n //get database connection\n const [ db, client ] = await getConnection();\n\n //verify user\n const result = await db.collection('users').updateOne(\n { email: { $eq: email } },\n { $set: { 'account.isVerified': true, 'metadata.lastModified': new Date() } }\n );\n\n //close connection\n client.close();\n\n //return result\n return result;\n }\n\n throw new ExpressError('Incorrect code, account not verified', 401)\n\n } catch (err) {\n throw new ExpressError(err.message, err.status || 500);\n }\n }", "function codeOnChange () {\n var code=$('#code').val().trim();\n //Error\n var code_error=$('#code_error');\n //Error Msg\n var msgError=\"Empty Field\";\n\n if(!code){\n code_error.text(msgError);\n code_error.show();\n }else{\n if(code.length<2){\n code_error.text(\"size must be between 2 and 30\");\n code_error.show();\n\n }else {\n code_error.hide();\n }\n\n }\n\n}", "function validateZipCode(field) {\n if (field === undefined || field === null) {\n return false;\n }\n var zip_regexp = /^[0-9]+(?:[-\\s]*)?(?:[0-9]*)?$/;\n if (zip_regexp.test(field) !== true) {\n return false;\n }\n return validateMinLength(field, 5) && validateMaxLength(field, 10);\n}", "function postcodeValid(postcode) {\n var regex = /([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([AZa-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z]))))[0-9][A-Za-z]{2})/\n var postcode = noSpacesPostcode(postcodeInput.value);\n if (regex.test(postcode)) {\n return true\n } else {\n throw new Error('Enter a valid postcode & category')\n }\n}", "function isPostalCode(val) {\n\t// Validate characters only\n\tvar regex = /^[ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]{1}\\d{1}[A-Za-z]{1}\\d{1}[A-Za-z]{1}\\d{1}$/;\n\treturn val.match(regex);\n}", "verifyPostalCode(postalCode) {\r\n if (this.isPostalCode(postalCode)) {\r\n return postalCode;\r\n }\r\n else {\r\n const message = \"Invalid parameter for postal code; \" + \"\\'\" + postalCode + \"\\'\" + \" is in unacceptable format.\";\r\n throw new InvalidUserParameterException('INVALID POSTAL CODE', message);\r\n }\r\n }", "function ValidateZipCode(zipCode) \n{\n if (/(^\\d{5}$)/.test(zipCode))\n {\n return (true)\n }\n // alert(\"You have entered an invalid email address!\")\n return (false)\n}", "function isValidZipCode() {\r\n var x = document.getElementById(\"Code\");\r\n var regexs = /^\\d{6}$/; \r\n if (!x.value.match(regexs)) {\r\n document.getElementById('validZip').style.display = \"block\";\r\n document.getElementById('validZipSpace').style.display = \"block\";\r\n isCode = false;\r\n }\r\n else {\r\n document.getElementById('validZip').style.display = \"none\";\r\n document.getElementById('validZipSpace').style.display = \"none\";\r\n isCode = true;\r\n }\r\n}", "function ValidateCredentialsInput(account) {\n\n // Clear any previous ticket since it could be updated\n account.ticket = null;\n\n var host_args = {\n scheme: location.protocol,\n hostname: location.host,\n port: null // embedded in hostname\n };\n\n //\n // An AccountID must be present.\n //\n if (account.AccountID == null || account.AccountID == \"\") {\n alert(\"Must supply AccountID\");\n return false;\n }\n\n //\n // A ticket must be present\n //\n if ((account.Ticket != null) && (account.Ticket != \"\")) {\n\n account.ticket = g_opclient.createTicket(account.Ticket, \"/\", host_args);\n\n if (account.ticket == null) {\n return false;\n }\n\n return true;\n }\n else {\n alert(\"Must supply Ticket\");\n return false;\n }\n\n return true;\n}", "function isValidCC() {\n let ccError = document.createElement('p');\n // remove error message if it exists\n if (paymentLabel.querySelector('p')) {\n paymentLabel.querySelector('p').remove();\n };\n\n // if field is empty, display this error message\n if (ccNum.value.length === 0) {\n ccError.textContent = 'Please enter a credit card number.';\n ccError.style.color = 'red';\n paymentLabel.append(ccError);\n } else if (ccNum.value.length < 13 || ccNum.value.length > 16) {\n // if field is not empty but wrong length, display this message\n ccError.textContent = 'Please enter a valid credit card number that is between 13 and 16 digits long.';\n ccError.style.color = 'red';\n paymentLabel.append(ccError);\n } else if (/[^0-9]/.test(ccNum.value)) {\n // if field is right length but has incorrect characters, display this message\n ccError.textContent = 'Please enter numbers only.';\n ccError.style.color = 'red';\n paymentLabel.append(ccError);\n };\n return /^[0-9]{13}[0-9]?[0-9]?[0-9]?$/.test(ccNum.value);\n}", "function checkAccessoryPostalCodeError() {\n $regType = \"accessory\";\n $div = $( \"#accesssory-shipping-address #postalCode\" );\n $spanHelp = $( \"#reg-\" + $regType + \"-postalcode-help\" );\n if (($div.val() == \"\") || ($div.hasClass('error')) || ($div.parent().hasClass('error'))) {\n $spanHelp.show();\n } else {\n $spanHelp.hide();\n }\n}", "function validateAddress(){\n var res = false\n if (myForm.F00000035h.toLowerCase() !== \"berlin\"){\n return false;\n }else if (myForm.F00000035h.toLowerCase() == \"berlin\") {\n if (myForm.bzrnr != '') {\n res = true;\n }\n }else{\n res = false\n } \n\treturn res;\n}", "function validate_accountNo (id) {\n\t// var pass1 = document.getElementById(id).value;\n\n\t// if(isNaN(pass1) || pass1.length >35)\n\t// {\n\t// error_msg_alert('Please enter valid account number');\n\t// $('#'+id).css({'border':'1px solid red'});\n\t// //$('#'+id).next().hide();\n\t// //$(\"#\"+id).after(\"<span style='border:0px; color:red; float:right; background: initial;' class='form-control text-right'>Enter Number Only!</span>\");\n\t// document.getElementById(id).value=\"\";\n\t// $('#'+id).focus();\n\t// g_validate_status = false;\n\t// return false;\n\t// }\n\t// else if(!pass1.replace(/\\s/g, '').length)\n\t// {\n\t// error_msg_alert('It should not allow spaces');\n\t// $('#'+id).css({'border':'1px solid red'});\n\t// //alert(\"Use only letter in name!\");\n\t// document.getElementById(id).value=\"\";\n\t// $('#'+id).focus();\n\t// g_validate_status = false;\n\t// return false;\n\t// }\n\t// else\n\t// {\n\t// var iChars = \"!@#$%^&*()+=-[]\\\\\\';,./{}|\\\":<>?\";\n\t// var obj = document.getElementById(id).value;\n\t// for (var i = 0; i < obj.length; i++) {\n\t// if (iChars.indexOf(obj.charAt(i)) != -1) {\n\t// error_msg_alert('It should not allow special character.');\n\t// $('#'+id).css({'border':'1px solid red'});\n\t// document.getElementById(id).value=\"\";\n\t// $('#'+id).focus();\n\t// g_validate_status = false;\n\t// return (false);\n\t// }\n\t// else\n\t// {\n\t// $('#'+id).css({'border':'1px solid #ddd'});\n\t// return (true);\n\t// }\n\t// }\n\t// }\n\n\t// else\n\t// {\n\t// $('#'+id).css({'border':'1px solid #ddd'});\n\t// //$('#'+id).next().hide();\n\t// return true;\n\t// }\n\treturn true;\n}", "function cardnumber(ccnum)\n{\n var cardno = /^(?:3(?:0[0-5]|[68][0-9])[0-9]{11})$/;\n if(ccnum.value.match(cardno))\n {\n return true;\n }\n else\n {\n alert(\"Not a valid Dinners Club card number!\");\n return false;\n }\n}", "function cardnumber(ccnum)\n{\n var cardno = /^(?:3(?:0[0-5]|[68][0-9])[0-9]{11})$/;\n if(ccnum.value.match(cardno))\n {\n return true;\n }\n else\n {\n alert(\"Not a valid Dinners Club card number!\");\n return false;\n }\n}", "function zipCodeValid() {\n const zipCodeValue = zipCodeInput.value;\n const testZipCode = /^\\d{5}$/.test(zipCodeValue);\n \n if (testZipCode === true) {\n zipCodeInput.style.borderColor = 'white';\n displayError(zipCodeInput, '', 'zip-error');\n return true;\n } else {\n zipCodeInput.style.borderColor = 'red';\n displayError(zipCodeInput, 'Please enter a valid zip code (must be 5 digits long).', 'zip-error');\n return false;\n };\n}", "validateFormFields(account){\n let validationSuccess = false;\n if(account.name.trim()==\"\" || account.name.trim()==null){\n alert('Please enter Name');\n document.getElementById(\"name\").focus();\n return validationSuccess;\n } else if(account.email.trim()==\"\" || account.email.trim()==null){\n alert('Please enter Email');\n document.getElementById(\"email\").focus();\n return validationSuccess;\n } else if(!this.validateEmail(account.email.trim())) {\n document.getElementById(\"email\").focus();\n alert('Please enter valid Email');\n return validationSuccess;\n } else if(account.phoneno.trim()==\"\" || account.phoneno.trim()==null){\n document.getElementById(\"phone\").focus();\n alert('Please enter Phone number');\n return validationSuccess;\n } else if(!(account.phoneno.trim().length == 10)){\n alert('Phone number should be 10 digits');\n document.getElementById(\"phone\").focus();\n return validationSuccess;\n } else if(account.password.trim()==\"\" || account.password.trim()==null){\n alert('Password should not be empty');\n document.getElementById(\"password\").focus();\n return validationSuccess;\n } else if(account.password.trim().length < 5){\n alert('Password should have minimun 5 characters');\n document.getElementById(\"password\").focus();\n return validationSuccess;\n } else{\n validationSuccess = true;\n }\n\n return validationSuccess;\n }", "function addNewCodeValidation() {\n var codeToAdd = $(\"#codeToAdd\").val();\n var emailToAdd = $(\"#emailToAdd\").val();\n\n if (validateEmailField(emailToAdd) && validateCodeField(codeToAdd)) {\n var channel = loadedChannelId;\n if (!channels[codeToAdd] && !isEmpty(codeToAdd)) {\n var channelsKey = Object.keys(channels);\n var flag = true;\n for (var i = 0; i < channelsKey.length; i++) {\n if (channels[channelsKey[i]].split(\"[\")[0] == channel) {\n alert(\"The channel is already registred with the code \" + channelsKey[i].toUpperCase() + \", if you wish to have more than one code for your channel please contact us via e-mail.\");\n flag = false;\n break;\n }\n }\n if (flag) {\n addNewCode(codeToAdd, emailToAdd);\n }\n } else {\n alert(\"The code you want to use is already registred or empty, please try a different one\");\n }\n } else if (!validateCodeField(codeToAdd)) {\n alert(\"The code is too long, it can't have more than 10 characters\");\n } else {\n alert(\"Please put a correct e-mail address\");\n }\n}", "async verifyCode () {\n\t\t// we give the user 3 attempts to enter a confirmation code, after that, they'll\n\t\t// have to get a new confirmation email sent to them\n\t\tlet confirmFailed = false;\n\t\tif (this.request.body.confirmationCode !== this.user.get('confirmationCode')) {\n\t\t\tconfirmFailed = true;\n\t\t\tif (this.user.get('confirmationAttempts') === MAX_CONFIRMATION_ATTEMPTS) {\n\t\t\t\tthis.maxConfirmationAttempts = true;\n\t\t\t}\n\t\t\tthis.trackFailureEvent('Incorrect Code');\n\t\t}\n\t\telse if (Date.now() > this.user.get('confirmationCodeExpiresAt')) {\n\t\t\tconfirmFailed = true;\n\t\t\tthis.confirmationExpired = true;\n\t\t\tthis.trackFailureEvent('Expired');\n\t\t}\n\t\treturn confirmFailed; // if true, shortcuts and prepares for failure response\n\t}", "verfyUserByCode(attr, code){\n Auth.verifyCurrentUserAttributeSubmit(attr, code)\n .then(() => {\n console.log('user verified');\n }).catch(e => {\n console.log('failed with error', e);\n });\n }", "validatePostalCode(postalCode) {\n if(postalCode==='') {\n return 'Postal code required';\n } else if (!/^\\d+$/.test(postalCode)) {\n return 'Postal code invalid'\n } else if (postalCode.length > 10 || postalCode.length < 2) {\n return 'Postal code invalid (must be between 2-10 digits)'\n }\n \n return '';\n }", "function creditCardValid() {\n const creditCardValue = creditCardInput.value;\n const testCreditCard = /^\\d{13,16}$/.test(creditCardValue);\n \n if (testCreditCard === true) {\n creditCardInput.style.borderColor = 'white';\n displayError(creditCardInput, '', 'cc-error');\n return true;\n } else {\n creditCardInput.style.borderColor = 'red';\n displayError(creditCardInput, 'Please enter a valid credit card number (must be between 13-16 digits long).', 'cc-error');\n return false;\n };\n}", "function validate_IFSC (id) {\n\t/*\n var pass1 = document.getElementById(id).value; \n \n if( /^[A-Za-z]{4}\\d{7}$/.test(pass1) && pass1.length <= 11)\n {\n $('#'+id).css({'border':'1px solid #ddd'});\n return true;\n }\n else\n {\n error_msg_alert('Please enter valid IFSC/Swift Code');\n $('#'+id).css({'border':'1px solid red'}); \n //alert(\"Use only letter in name!\"); \n document.getElementById(id).value=\"\";\n $('#'+id).focus(); \n g_validate_status = false;\n return false;\n } */\n\treturn true;\n}", "function validateSchoolCode (schoolCode) {\n // INVALID: school code is empty\n var schoolCodeStr = String(schoolCode)\n if (schoolCodeStr.length == 0) {\n return 'University Code cannot be empty';\n\n // INVALID: University Code is not length 4\n } else if (schoolCodeStr.length < 4 || schoolCodeStr.length > 4) {\n return 'University Code must have 4 digits';\n }\n\n // Valid University Code\n return '';\n }", "function checkStateCode (theField, emptyOK)\r\n{ if (checkStateCode.arguments.length == 1) emptyOK = defaultEmptyOK;\r\n if ((emptyOK == true) && (isEmpty(theField.value))) return true;\r\n else\r\n { theField.value = theField.value.toUpperCase();\r\n if (!isStateCode(theField.value, false))\r\n return warnInvalid (theField, iStateCode);\r\n else return true;\r\n }\r\n}", "function checkStateCode (theField, emptyOK)\r\n{ if (checkStateCode.arguments.length == 1) emptyOK = defaultEmptyOK;\r\n if ((emptyOK == true) && (isEmpty(theField.value))) return true;\r\n else\r\n { theField.value = theField.value.toUpperCase();\r\n if (!isStateCode(theField.value, false))\r\n return warnInvalid (theField, iStateCode);\r\n else return true;\r\n }\r\n}", "function isErrorCode(code) {\n return !isNormalCode(code);\n}", "function account_holder_validate(event, allowSpace) {\n var keycode = ('which' in event) ? event.which : event.keyCode;\n if (allowSpace == true) { var reg = /[^0-9\\[\\]\\/\\\\#,+@!^()§$~%'\"=:;<>{}\\_\\|*?`]/g };\n return (reg.test(String.fromCharCode(keycode)) || keycode == 0 || keycode == 45 ||keycode == 46 || keycode == 8 || (event.ctrlKey == true && keycode == 114) || ( allowSpace == true && keycode == 32))? true : false;\n}", "validateZipCode(zipcode) {\n let re = /(^\\d{5}$)|(^\\d{5}-\\d{4}$)/;\n return re.test(zipcode);\n }" ]
[ "0.7226829", "0.70322907", "0.6692173", "0.66273445", "0.6592543", "0.6539768", "0.64986086", "0.64312786", "0.6426978", "0.64251643", "0.61999506", "0.6185829", "0.6064935", "0.6051408", "0.5996565", "0.5996565", "0.5965037", "0.596227", "0.5940497", "0.59356654", "0.5926284", "0.5924172", "0.5911973", "0.5897361", "0.5886629", "0.58815354", "0.5879552", "0.58527845", "0.579834", "0.5792025", "0.57757884", "0.57712036", "0.576907", "0.57504964", "0.5741452", "0.57403004", "0.5737043", "0.57346535", "0.57295597", "0.57146937", "0.57094085", "0.57030797", "0.57030386", "0.5686982", "0.56795144", "0.567839", "0.56698143", "0.5667573", "0.56580555", "0.56580555", "0.5648662", "0.56398606", "0.5637714", "0.56340057", "0.5631247", "0.5630993", "0.5630053", "0.5617705", "0.5615558", "0.56114376", "0.5605002", "0.5603261", "0.55990416", "0.559695", "0.5596923", "0.5596891", "0.55835074", "0.5575369", "0.55569845", "0.5551479", "0.55503935", "0.55498564", "0.55468804", "0.55446976", "0.5541682", "0.5529435", "0.55259633", "0.5525897", "0.5521341", "0.55192316", "0.5513385", "0.551103", "0.5510671", "0.5509686", "0.5504117", "0.5504117", "0.54865956", "0.5466744", "0.54557216", "0.5454125", "0.5450646", "0.54496115", "0.5449594", "0.5447751", "0.5447047", "0.5425513", "0.5425513", "0.5422853", "0.54153764", "0.5413444" ]
0.70928335
1
Check that all account fields have all correct numbers
function isAcctAllGood() { return isAcctGood("#acctCode1CP", 4) && isAcctGood("#acctCode2CP", 2) && isAcctGood("#acctCode4CP", 3) && isAcctGood("#acctCode5CP", 4) && isAcctGood("#acctCode6CP", 4); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isAcctGood(field, num) {\n return !isNaN($(field).val()) && $(field).val().length == num;\n }", "function isAcctValid(field, num) {\n return !isNaN($(field).val()) && ($(field).val().length == num || $(field).val() == \"\");\n }", "function CheckNumberIsProvidedForServiceBookingEnterDetails(NumberFields) {\r\n return NumberFields.length === 2 && (NumberFields.eq(0).val().length > 0 || NumberFields.eq(1).val().length > 0);\r\n}", "function cekAccountNumber(field){\r\n\tvar accountNumber = /^[0-9][0-9]*$/;\r\n\tif(field.match(accountNumber)) {\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}", "function isAllValid(){\n return (\n BILL_REGEX.test(billInput.value) && \n (NUM_REGEX.test(customPercent.value) || \n document.querySelector('input[name=\"tip-amount\"]:checked')) && \n NUM_REGEX.test(numPeople.value)\n )\n}", "function validateAbilityScoresCount(fields)\n{\n let sum = 0;\n fields.forEach(function(item,index,array) {\n sum += parseInt(item.value);\n });\n\n // If sum == 20, valid\n if(sum == 20)\n {\n fields.forEach(function(item,index,array) {\n item.setCustomValidity(\"\");\n });\n hitpoints.constitution = parseInt(fields[0].value);\n hitpoints.bonus = racialBonuses[0];\n hitPointsCalculator();\n setRacialBonusesAndTotals();\n }\n else\n {\n fields.forEach(function(item,index,array) {\n item.setCustomValidity(\"Ability scores must sum to 20.\");\n });\n hitpoints.constitution = null;\n hitpoints.bonus = null;\n hitPointsCalculator();\n setRacialBonusesAndTotals();\n }\n}", "function validateSummary4INT() {\n var _companyId = $(\"#companyId\").val();\n var acctGroupId = $(\"#acctGroup\").val();\n var shopId = $(\"#terminal\").val();\n\n if (_companyId && _companyId != \"\" && isNaN(_companyId)) {\n alert(ERROR_BAD_ACCT_NBR);\n throw \"BAD_ACCT_NBR\";\n }\n\n if (acctGroupId && acctGroupId != \"\" && isNaN(acctGroupId)) {\n alert(ERROR_BAD_ACCTGROUP_NBR);\n throw \"BAD_ACCTGROUP_NBR\";\n }\n\n if (shopId && shopId != \"\" && isNaN(shopId)) {\n alert(ERROR_BAD_SHOP_NBR);\n throw \"BAD_SHOP_NBR\";\n }\n}", "function validateCred(array) {\n let newArray = [];\n let tempNum = 0;\n let doubleNum = [];\n for (let i = array.length - 1; i >= 0; i--) {\n newArray.push(array[i]);\n i--;\n if (i >= 0) {\n tempNum = array[i] * 2;\n doubleNum.push(tempNum);\n }\n }\n\n let doubleNum9 = [];\n for (a of doubleNum) {\n if (a > 9) {\n doubleNum9.push(a - 9);\n } else {\n doubleNum9.push(a);\n }\n }\n\n let sumNewArray = 0;\n for (num of newArray) {\n sumNewArray += Number(num);\n }\n\n let sumDoubleNum9 = 0;\n for (num of doubleNum9) {\n sumDoubleNum9 += Number(num);\n }\n\n let sum = sumNewArray + sumDoubleNum9;\n\n if (sum % 10 === 0) {\n return true;\n } else {\n return false;\n }\n}", "function validateCred (array){\n let finalSum = 0\n for(let i=array.length-1; i>=0; i--){\n let num = array[i]\n if((i-array.length)%2==0){\n num*=2\n if(num>9){\n num-=9\n }\n }\n finalSum= finalSum+num\n }\n const check = (finalSum%10 === 0)\n return check\n}", "function allnumeric()\n{ \n\tvar uzip = document.registration.zip;\n\tvar numbers = /^[0-9]+$/;\n\tif(uzip.value.match(numbers))\n\t{\n\t\t// Focus goes to next field i.e. email.\n\t\tdocument.registration.email.focus();\n\t\treturn true;\n\t}\n\telse\n\t{\n\t\talert('ZIP code must have numeric characters only');\n\t\tuzip.focus();\n\t\treturn false;\n\t}\n}", "static checkAccountNumber(key, userValue){\n\n var result = true;\n var msg = '';\n\n // check account number is numeric\n var numeric = userValue.match(/^\\d+$/);\n\n if (this.checkEmptyUserInput(userValue)) {\n result = false;\n // alert(key + ' cannot be empty');\n msg = key + ' cannot be empty';\n }\n else if (!numeric) {\n // alert(key + ' should be in numeric');\n result = false;\n msg = key + ' should be in numeric';\n }\n // Check if account number is 14 digits\n else if (userValue.length!=14)\n {\n // alert(key + ' should be 15 digits');\n msg = key + ' should be 15 digits';\n result =false;\n }\n\n return msg;\n\n\n /*\n\n if(num.match(/^\\d+$/)){\n //valid integer\n}else if(num.match(/^\\d+\\.\\d+$/)){\n //valid float\n}else{\n //not valid number\n}\n\n */\n\n }", "function validateCred (array) {\n let sum = 0;\n let currentNum = 0;\n let counter = 0;\n\n for (let i = array.length - 2; i >= 0; i--) {\n if (counter % 2 == 0) {\n currentNum = array [i] * 2;\n if (currentNum > 9) {\n currentNum -= 9;\n sum += currentNum;\n counter += 1; \n } else {\n sum += currentNum;\n counter += 1\n }\n } else {\n currentNum = array [i];\n sum += currentNum;\n counter += 1;\n }\n }\n\n sum += array [array.length - 1];\n\n if (sum % 10 == 0) {\n return true;\n } else {\n return false;\n }\n}", "function validateNumberList(numberList){\n\tvar status = true;\n\tfor(var number of numberList){\n\t\tif(number.value == null)\n\t\t\tstatus = false; \n\t\t}\n\treturn status;\n}", "function verifyFields(){\n let fieldTexts = document.getElementsByClassName('input-field');\n let hasAllvalues = true;\n for(let i = 0; i < fieldTexts.length; i++){\n if(!fieldTexts[i].value){\n hasAllvalues = false;\n }\n }\n return hasAllvalues;\n}", "function fieldCheck(fields, headers) {\n\t\tfor(var i = 0; i < fields.length; i++) {\n\t\t\tif(i == 0) {\n\t\t\t\tconsole.log(headers[i].textContent);\n\t\t\t\tif(/\\s/.test(fields[i])) {\n\t\t\t\t\terrorGenerator(fields[i], \"\\tNo spaces in your username\", headers[i]);\n\t\t\t\t}\n\t\t\t\tspecialCharCheck(fields[i]);\n\t\t\t} else if(i == 3) {\n\t\t\t\tif(/[0-9]/.test(fields[i])) {\n\t\t\t\t\terrorGenerator(fields[i], \"\\tNo numbers in your name\", headers[i - 1]);\n\t\t\t\t}\n\t\t\t\tif(!/\\s{1}/.test(fields[i])) {\n\t\t\t\t\terrorGenerator(fields[i], \"\\tToo many spaces\", headers[i - 1]);\n\t\t\t\t}\n\t\t\t\tspecialCharCheck(fields[i]);\n\t\t\t} else if(i == 4) {\n\t\t\t\tif (!/^[0-9]{3}-?[0-9]{3}-?[0-9]{4}$/.test([fields[i]])) {\n\t\t\t\t\terrorGenerator(fields[i], \"\\tInvalid phone number\", headers[i -1]);\n\t\t\t\t}\n\t\t\t\tspecialCharCheck(fields[i]);\n\t\t\t} else if(i == 5) {\t\n\t\t\t\tif(!/[@]{1}/g.test(fields[i])) {\n\t\t\t\t\terrorGenerator(fields[i], \"\\tInvalid email\", headers[i - 1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function validateFields(){\n\tif(!getValue('nombreID')\n\t\t|| !getValue('contactoID') \n\t\t|| !getValue('estadoID')\n\t\t|| !getValue('ciudadID') \n\t\t|| !getValue('shortDesc') \n\t\t|| !getValue('longDesc')\n\t\t|| !isChecked('lblCheck'))\n\t\treturn 0;\n\telse\n\t\treturn 1;\n}", "isValid() {\n const { fields } = this.props;\n const fieldCount = fields.length;\n const validFieldCount = fields.filter(field => (\n this.wasFieldValidated(field) && this.isFieldValid(field)\n )).length;\n return fieldCount === validFieldCount;\n }", "function isAcctAllEmpty() {\n return $(\"#acctCode1CP\").val() == \"\" && $(\"#acctCode2CP\").val() == \"\" && $(\"#acctCode4CP\").val() == \"\" &&\n $(\"#acctCode5CP\").val() == \"\" && $(\"#acctCode6CP\").val() == \"\";\n }", "function fillAccountNo(thisField) \n{\n if (thisField.value.length < 12) {\n if (thisField.value.charAt(0) == \"0\") {\n var temp = \"00000000000\" + thisField.value ;\n thisField.value = temp.substring(temp.length-12);\n }\n }\n return true ;\n}", "function getAllValidFields(fields, row) {\n\t//console.log(fields, row);\n\tvar fields_list = fields.split('&&');\n\tvar all_valid = '';\n\t//console.log(fields_list)\n\t\n\tvar i = 0;\n\twhile (i<=fields_list.length-1) {\n\t\tif (row[fields_list[i]]!=null) {\n\t\t\tall_valid += row[fields_list[i]];\n\t\t};\n\t\ti++\n\t};\n\t\n\t//check valididty of multiple fields:\n\t//if (row[fields_list[0]]!=null) {console.log('field 0: ', row[fields_list[0]])}\n\t//if (row[fields_list[1]]!=null) {console.log('field 1: ', row[fields_list[1]])}\n\t//if ((row[fields_list[0]]!=null) || (row[fields_list[1]]!=null)) {console.log('Multiple valid fields: ', all_valid)}\n\t\n\tif (all_valid.length==0) {all_valid = blank};\n\treturn all_valid;\n}", "function chequearSoloNumeros(field) {\n if (/^([0-9])*$/.test(field.value)) {\n setValido(field);\n return true;\n } else {\n setInvalido(field, `${field.name} solo debe contener números`);\n return false;\n }\n }", "validateLineItemAmount(pLineItems) {\n let validAmountField = true;\n pLineItems.forEach(function(lLineItem) {\n if (!lLineItem.invoiceAmount || lLineItem.invoiceAmount === '' || (isNaN(parseFloat(lLineItem.invoiceAmount)) && !isFinite(lLineItem.invoiceAmount))) {\n validAmountField = false;\n }\n });\n return validAmountField;\n }", "classic_validate() {\n\t\t// check each column\n\t\tfor (var x = 0 ; x < this.width ; x++) {\n\t\t\tvar found_digits = new Array(this.max)\n\t\t\tfor (var i = 0 ; i < this.max ; i++)\n\t\t\t\tfound_digits[i] = false;\n\t\t\tfor (var y = 0 ; y < this.height ; y++) {\n\t\t\t\tvar digit = this.cells[x][y].value\n\t\t\t\t// if incorrect number\n\t\t\t\tif (!check_digit(digit,this.max))\n\t\t\t\t\treturn false\n\t\t\t\t// if two of the same in the column\n\t\t\t\tif (found_digits[digit-1])\n\t\t\t\t\treturn false\n\t\t\t\tfound_digits[digit-1] = true\n\t\t\t}\n\t\t\t// TODO : check if it works (had issues with for in)\n\t\t\tfor (var b in found_digits) {\n\t\t\t\tif (!b)\n\t\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\t// check each row\n\t\tfor (var y = 0 ; y < this.height ; y++) {\n\t\t\tvar found_digits = new Array(this.max)\n\t\t\tfor (var i = 0 ; i < this.max ; i++)\n\t\t\t\tfound_digits[i] = false;\n\t\t\tfor (var x = 0 ; x < this.width ; x++) {\n\t\t\t\tvar digit = this.cells[x][y].value\n\t\t\t\t// if incorrect number\n\t\t\t\tif (!check_digit(digit,this.max))\n\t\t\t\t\treturn false\n\t\t\t\t// if two of the same in the row\n\t\t\t\tif (found_digits[digit-1])\n\t\t\t\t\treturn false\n\t\t\t\tfound_digits[digit-1] = true\n\t\t\t}\n\t\t\tfor (var b in found_digits) {\n\t\t\t\tif (!b)\n\t\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\t// check each square\n\t\tfor (var i = 0 ; i < (this.width/3)*(this.height/3) ; i++) {\n\t\t\tvar found_digits = new Array(this.max)\n\t\t\tfor (var i = 0 ; i < this.max ; i++)\n\t\t\t\tfound_digits[i] = false;\n\t\t\tfor (var x = 3*(i%3) ; x < 3*((i%3)+1) ; x++) {\n\t\t\t\tfor (var y = 3*Math.floor(i/3) ; y < 3*(Math.floor((i+1)/3)) ; y++) {\n\t\t\t\t\tvar digit = this.cells[x][y].value\n\t\t\t\t\t// if incorrect number\n\t\t\t\t\tif (!check_digit(digit,this.max))\n\t\t\t\t\t\treturn false\n\t\t\t\t\t// if two of the same in the row\n\t\t\t\t\tif (found_digits[digit-1])\n\t\t\t\t\t\treturn false\n\t\t\t\t\tfound_digits[digit-1] = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (var b in found_digits) {\n\t\t\t\tif (!b)\n\t\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}", "function validateCred (array) {\n let sum = 0;\n // Luhn algorithm\n // move from right to left - first digit not doubled, next doubled, next not, etc...\n for (let i = array.length-1; i >= 0; i-=1) {\n // check\n if (i % 2 == 0) {\n let doubled = array[i] * 2;\n if (doubled > 9) {\n doubled -= 9;\n }\n sum += doubled;\n } else {\n sum += array[i];\n }\n }\n if (sum % 10 == 0) {\n return true;\n } else {\n return false;\n }\n}", "static accountIsValid(account) {\n return true;\n }", "function checkIfOnlyLettersNumbers(field) {\n if (/^[A-Za-z0-9\\s]*$/.test(field.value)) {\n setValid(field);\n return true;\n } else {\n setInvalid(field, `${field.name} must contain only letters and numbers`);\n return false;\n }\n}", "function allnumeric()\n { \n var uzip = document.registration.contact;\n var numbers = /^[0-9]+$/;\n if(uzip.value.match(numbers))\n {\n // Focus goes to next field i.e. email.\n document.registration.username.focus();\n return true;\n }\n else\n {\n alert('contact must have numeric characters only');\n uzip.focus();\n return false;\n }\n }", "function validateFields(fields){\n\tvar errors = 0;\n\t$.each(fields, function(i,arr){\n\t\tif($(arr[0]).val() == ''){\n\t\t\terrors += 1;\n\t\t\taddRedBorder(arr[0], null);\n\t\t}else{\n\t\t\tremoveRedBorder(arr[0]);\n\t\t}\n\t});\n\treturn errors;\n}", "function verifyFieldValue() {\n\tvar fieldValue = document.getElementById('phone_number').value; \n\tvar check = true;\n\tif (fieldValue != \"\") {\n\t\tif (isNumeric(fieldValue)) {\n\t\t\t/* the value is a number (public number) */\n\t\t} else {\n\t\t\t/* the value is not a number */\n\t\t\t/* check if the value contains '+' */\n\t\t\tvar plusIndex = fieldValue.lastIndexOf('+');\n\t\t\tif (plusIndex > -1) {\n\t\t\t\t/* the value contains '+' */\n\t\t\t\tif (plusIndex > 0) {\n\t\t\t\t\t/* the value contains '+' in another position than the first one */\n\t\t\t\t\tcheck = false;\n\t\t\t\t} else {\n\t\t\t\t\t/* it contains + on the first position */\n\t\t\t\t\t/* the rest of the value must be a number */\n\t\t\t\t\tif (isNumeric(fieldValue.substring(1)) == true) {\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* the rest of the value is not a number */\n\t\t\t\t\t\tcheck = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t/* the value dosn't contain '+' and is not a number*/\n\t\t\t\t/* check if the value has just one '*' */\n\t\t\t\tvar starFIndex = fieldValue.indexOf('*');\n\t\t\t\tvar starLIndex = fieldValue.lastIndexOf('*');\n\t\t\t\t\n\t\t\t\tif (starFIndex == starLIndex && starFIndex > 0) {\n\t\t\t\t\t/* the value has just one '*' */\n\t\t\t\t\t/* check if the '*' separates two numbers */\n\t\t\t\t\tvar firstNumber = fieldValue.substring(0, starFIndex -1);\n\t\t\t\t\tvar secondNumber = fieldValue.substring(starFIndex + 1);\n\t\t\t\t\tif (isNumeric(firstNumber) == true && isNumeric(secondNumber) == true) {\n\t\t\t\t\t\t/* the user introduced an extension number */\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* '*' doesn't separate two numbers */\n\t\t\t\t\t\tcheck = false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t/* the value has more than one '*' */\n\t\t\t\t\tcheck = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\t/* the value is null */\n\t\tcheck = false;\n\t}\n\t if (check == false) {\n\t\t/* display an error message */\n\t\tvar errorDiv = document.getElementById('warn_msg').style.display = \"\";\n\t\tvar errorText = document.getElementById('warn_msg').innerHTML = warnIcon+getLangMsg('err_invalid_phone_number_entered');\n\t\treturn false;\n\t} else {\n\t\treturn true;\n\t}\n}", "function validateNum() {\n var pass = true,\n num = '';\n\n ['#areacode', '#phnum1', '#phnum2'].forEach(function(id) {\n var $e = $(id),\n val = $e.val();\n\n if(!val || val.length !== parseInt($e.attr('maxlength'), 10)) {\n pass = false;\n $e.addClass('error');\n }\n else\n num += val;\n });\n\n if(!pass) return false;\n\n return num;\n }", "function validateDiscountItemFields(fields) {\r\n\tvar i;\r\n\r\n\tfor (i = 0; i < fields.length; i++) {\r\n\t\t// mandatory\r\n\t\tif (fields[i].value == '' || fields[i].value == null) {\r\n alert(TRANS_UI_CS_Library.ERROR_OFFER_ENTER);\r\n return false;\r\n\t\t}\r\n \r\n\t\t// input should be numeric\r\n\t\tif (isNaN(fields[i].value)) {\r\n\t\t\talert(TRANS_UI_CS_Library.ERROR_OFFER_NAN);\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n if (fields[i].key == 0) {\r\n // handle percentage input\r\n\t\t\tif (fields[i].value <= 0 || fields[i].value > 100) {\r\n\t\t\t\talert(TRANS_UI_CS_Library.ERROR_OFFER_RANGE_PCNT);\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n else {\r\n // handle currency input\r\n if (fields[i].value <= 0) {\r\n\t\t\t\talert(TRANS_UI_CS_Library.ERROR_OFFER_RANGE);\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n }\r\n\t}\r\n\treturn true;\r\n}", "checkValidate(member){\n\t\tlet a = $('#input_membership').val();\n\t\tlet b = a.toString();\n\t\tlet c = 0;\n\t\n\t\tfor (var i = 0; i < b.length; i++){\n\t\t\tlet l = 6-i;\n\t\t\tc += Number(b[i]) * l ; \n\t\t}\n\t\n\t\tif ((c % 11) !== 0 || b.length !== 6){\n\t\t\t$('#error02').show();\n\t\t\treturn false\n\t\t}\n\t\n\t\telse if ((c % 11) === 0 && b.length === 6){\n\t\t\t$('#error02').hide();\n\t\t\treturn true\n\t\t}\n\n\t}", "function checkNumbers(pw)\n{\n const numbersCheck = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\"];\n for(let i = 0; i<numbersCheck.length; i++)\n {\n if(pw.includes(numbersCheck[i]))\n {\n return true;\n }\n }\n return false;\n}", "_assertRecordValid(record: Object) {\n // Iterating over all record properties and searching\n // for nan and undefined since this values probably indicate \n // data corruption\n for (let prop in record) {\n // Asserting current value is valid(valid is not undefined and not NaN)\n if (record[prop] === undefined || record[prop] !== record[prop]) {\n // Declaring not valid\n console.log(`CRUDActions._assertRecordValid: found not valid record for field \n ${prop} and object: ${JSON.stringify(record, null, 4)}`)\n return false\n }\n }\n \n // Declaring valid\n return true\n }", "function validateFields() {\n\tvar isNotEmpty = true;\n\t\n\tfor (var i in registrationinfoArray){\n\t//check all fields are filled out \n\tif (!registrationInfoArray[i].value){\n\t\tregistrationInfoArray[i].style.backgroundColor = \"#f33\";\n\t\tisNotEmpty = false;\n\t}\t\n\telse{\n\t\tregistrationInfoArray[i].style.backgroundColor = \"#fff\";\n\t}\n\t}\n\t\n\treturn isNotEmpty;\n}", "function couldDigitize() {\n return getDigitizeUses() < getMaximumDigitizeUses();\n}", "function checkFormValid() {\n $(\"#checkForm\").validate({\n rules: {\n Digits: {\n min: 1,\n max: 10000000,\n required: true,\n digits: true\n },\n CreditCard: {\n required: true,\n creditcard: true\n }\n }\n });\n }", "function validateAccountInfo() {\n if (!volunteerRegObject.emailAddress) {\n return false;\n }\n if (!volunteerRegObject.password) {\n return false;\n }\n if (!volunteerRegObject.reenteredPassword) {\n return false;\n }\n return true;\n}", "checkNumberOfAccounts() {\n if (Object.keys(this._Wallet.current.accounts).length > 1) {\n this.showAccounts = true;\n }\n return;\n }", "function validateParts(parts) {\r\n\t\t\tfor (var i = 0; i < parts.length; ++i) {\r\n\t\t\t\tif (!gl.isPositiveInteger(parts[i])) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}", "function checkMultipleFields( recordData, fields, position ) {\n for( var i in fields ) {\n if( recordData[fields[i]] ) {\n var val = getCleanCellValue( recordData[fields[i]], position );\n if( val ) {\n return val;\n }\n }\n }\n return '';\n }", "function CheckNumbers(field, rules, i, options) {\n ///Assign Reguler experassion in a variable\n var regex = /^[0-9]+$/;\n //Match Reguler expression with user input data\n if (!regex.test(field.val())) {\n ///Show Message if Invalid Information\n return \"Please Enter Numbers Only.\"\n }\n}", "function verifyErrors() {\n let foundError = false;\n \n for (let error in field.validity) {\n // se não for customError\n // então verifica se tem error\n if (field.validity[error] && !field.validity.valid){\n foundError = error;\n }\n }\n \n return foundError;\n }", "function verify(f) {\n var msg;\n var empty_fields = \"\";\n var errors = \"\";\n\n // Loop through the elements of the form, looking for all \n // text and textarea elements that don't have an \"optional\" property\n // defined. Then, check for fields that are empty and make a list of them.\n // Also, if any of these elements have a \"min\" or a \"max\" property defined,\n // verify that they are numbers and in the right range.\n // If the element has a \"numeric\" property defined, verify that\n // it is a number, but don't check its range.\n // Put together error messages for fields that are wrong.\n for(var i = 0; i < f.length; i++) {\n var e = f.elements[i];\n if (((e.type == \"text\") || (e.type == \"textarea\")) && !e.optional) {\n // first check if the field is empty\n if ((e.value == null) || (e.value == \"\") || isblank(e.value)) {\n empty_fields += \"\\n \" + e.name;\n continue;\n }\n\n // Now check for fields that are supposed to be numeric.\n if (e.numeric || (e.min != null) || (e.max != null)) { \n var v = parseFloat(e.value);\n if (isNaN(v) || \n ((e.min != null) && (v < e.min)) || \n ((e.max != null) && (v > e.max))) {\n errors += \"- The field \" + e.name + \" must be a number\";\n if (e.min != null) \n errors += \" that is greater than \" + e.min;\n if (e.max != null && e.min != null) \n errors += \" and less than \" + e.max;\n else if (e.max != null)\n errors += \" that is less than \" + e.max;\n errors += \".\\n\";\n }\n } // end numeric check\n\t\t\t\n\t\t\t// check for emails field\n\t\t\tif (e.email && !isblank(e.value))\n\t\t\t{\n\t\t\t\tvar seenAt = false;\n\t\t\t\tvar append = \"\";\n\t\t\t\tfor(var j = 0; j < e.value.length; j++)\n\t\t\t\t{\n\t\t\t\t\tvar c = e.value.charAt(j);\n\t\t\t\t\tif ((c == ' ') || (c == '\\n') || (c == '\\t'))\n\t\t\t\t\tappend += \"\\n - not contain white space\";\n\t\t\t\t\tif ((c =='@') && (seenAt == true))\n\t\t\t\t\tappend += \"\\n - contain only one @\";\n\t\t\t\t\tif ((c =='@'))\n\t\t\t\t\tseenAt = true;\n\t\t\t\t}\n\t\t\t\tif (seenAt == false)\n\t\t\t\tappend += \"\\n - contain exactly one @\";\n\t\t\t\tif (append)\n\t\t\t\t\terrors += \"- The field \" + e.name + \" must: \" + append;\n\t\t\t} // end email check\n\t\t\t\n\t\t\t// link checker here - ie must be of form http://\n\t\t\tif (e.link && !isblank(e.value))\n\t\t\t{\n\t\t\t\tvar seenAt = false;\n\t\t\t\tvar append = \"\";\n\n\t\t\t\tfor(var j = 0; j < e.value.length; j++)\n\t\t\t\t{\n\t\t\t\t\tvar c = e.value.charAt(j);\n\t\t\t\t\tif ((c == ' ') || (c == '\\n') || (c == '\\t')) // must have no spaces\n\t\t\t\t\tappend += \"\\n - not contain white space\";\n\t\t\t\t}\n\t\t\t\t// must have http:// in it\n\t\t\t\tif (append)\n\t\t\t\t\terrors += \"- The field \" + e.name + \" must: \" + append;\n\t\t\t} // end if link\n }\n }\n\n // Now, if there were any errors, display the messages, and\n // return false to prevent the form from being submitted. \n // Otherwise return true.\n if (!empty_fields && !errors) return true;\n\n msg = \"______________________________________________________\\n\\n\"\n msg += \"The form was not submitted because of the following error(s).\\n\";\n msg += \"Please correct these error(s) and re-submit.\\n\";\n msg += \"______________________________________________________\\n\\n\"\n\n if (empty_fields) {\n msg += \"- The following required field(s) are empty:\" \n + empty_fields + \"\\n\";\n if (errors) msg += \"\\n\";\n }\n msg += errors;\n alert(msg);\n return false;\n}", "function getNbOfValidPassportFancy(data){\n let nbOfValidPassport = 0;\n let northPolePassport = /byr|iyr|eyr|hgt|hcl|ecl|pid/g;\n let birthYearCheck = /(\\bbyr:(19[2-9]\\d|200[0-2]))\\b/; //I've marked the word boundaries, but that may have been overkill\n let issueCheck = /(\\biyr:(201[0-9]|2020))\\b/;\n let expirationYear = /\\beyr:(202[0-9]|2030)\\b/;\n let heightCheck = /\\bhgt:((1[5-8][0-9]|19[0-3])cm|(59|6[0-9]|7[0-6])in)\\b/;\n let hairColorCheck = /\\bhcl:#([0-9]|[a-f]){6,6}\\b/;\n let eyeColorCheck = /\\becl:(amb|blu|brn|gry|grn|hzl|oth)\\b/;\n let passportIdCheck = /\\bpid:[0-9]{9}\\b/;\n let checks = [northPolePassport, birthYearCheck, issueCheck, expirationYear, heightCheck, \n hairColorCheck, eyeColorCheck, passportIdCheck];\n data.map(passport => {\n let result = true;\n // Felt cute like that, might change later\n checks.some(check => !passport.match(check)) ? result = false : nbOfValidPassport++;\n return result;\n })\n return nbOfValidPassport;\n}", "function validationforUpdate() {\n\tvar totalRows = mygrid.getRowsNum();\n \n\tfor (var rowId = 1; rowId <= totalRows ; rowId++) { \n \t\tif (!isValidQuantity(rowId, \"countedQuantity\")) {\n \t\t\treturn false;\n\t\t}\n }\n \n return true;\n}", "function allnumeric(tele) {\n var numbers = /^[0-9]+$/;\n if (tele.value.match(numbers)) {\n return true;\n } else {\n alert(\"Telephone code must be numeric\");\n return false;\n }\n}", "function checkContact( text ) {\n\tvar str= text.value.toString();\n\tvar len=str.length;\n\tvar check = true;\n\tvar err=\"\";\n\tfor(var i=0; i<len; i++)\n\t{\n\t\tif( ! (str.charAt(i)>=0 && str.charAt(i)<=9) )\n\t\t{\n\t\t\tcheck = false;\n\t\t}\n\t}\n\tif( check == false) {\n\t\terr=\"Only number Allowed\";\n\t}\n\telse if (len >=1 && len < 10) {\n\t\terr = \"Looks like you missed some digits.\"\n\t}\n\treturn err;\n}", "function checkValidFields(brushName, brushPrice) {\n let priceChunks = brushPrice.split(\"$\");\n if(priceChunks.length < 1) return false;\n if( !isNaN(parseFloat(priceChunks[1])) ) {\n return true;\n } else {\n return false;\n }\n}", "function validatePIN (pin) {\n // console.log(parseFloat(pin));\n if (pin.length === 4 || pin.length === 6) {\n if (typeof parseFloat(pin) != \"number\" || /\\D/.test(pin) || /[a-z]/.test(pin)) {\n return false;\n } else {\n return true;\n }\n } else {\n return false;\n }\n}", "function validateParts(parts) {\n\t\tfor (let i = 0; i < parts.length; ++i) {\n\t\t\tif (!isPositiveInteger(parts[i])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "validateInputs() {\n let inps = [].concat(\n this.queryAll(\"lightning-combobox\"),\n this.queryAll(\"lightning-input-field\"),\n );\n return inps.filter(inp => !inp.reportValidity()).length === 0;\n }", "function validateForm() {\r\n let regex = /^\\d*\\.?\\d*$/;\r\n if (\r\n regex.test(people.value) === false ||\r\n regex.test(priceB4Tip.value) === false ||\r\n regex.test(tipChoice.value) === false\r\n ) {\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n }", "function isValidNumDigits(field, min, max, sName) {\n\n\tvar str = field.value;\n\tvar len;\n\t\n // this will get rid of leading spaces \n while (str.substring(0,1) == ' ') \n str = str.substring(1, str.length);\n\n\t// this will get rid of trailing spaces \n while (str.substring(str.length-1,str.length) == ' ')\n str = str.substring(0, str.length-1);\n \n len = str.length;\n \n if ( (len >= min) && (len <= max) ) {\n\t\t\n\t\tfor (var i=0;i < len;i++) {\n\t\t\tif ((str.substring(i,i+1) < '0') || (str.substring(i,i+1) > '9')) {\n\t\t\t\talert(sName + ' should only contain numbers.');\n\t\t\t\tfield.focus();\n\t\t\t return false; \n\t\t\t}\n\t\t}\n\t\t\n } else {\n\t\tif (min == max) {\n\t\t\talert(sName + ' should be a ' + min + ' digit number.');\n\t\t} else {\n\t\t\talert(sName + ' should be a ' + min + ' - ' + max + ' digit number.');\n\t\t}\n\t\tfield.focus;\n\t\treturn false\n } \n \n return true;\n}", "function onlyNumbers(field) {\n if (/^\\d+$/.test(field.value)) {\n setValid(field);\n return true;\n } else {\n setInvalid(field, `${field.name} must contain only numbers`);\n return false;\n }\n}", "validateAll () {\n for (let fieldID of Object.keys(this.fields)) {\n this.fields[fieldID].validate()\n }\n }", "function valid_fields( fields, obj) {\n\n var valid = true;\n\n fields.every(function(value) {\n return valid = obj.hasOwnProperty( value );\n });\n\n return valid;\n}", "function _validateBoard(board) {\n for (var i = 0; i < 9; i++) {\n for (j = 0; j < 9; j++) {\n var val = parseInt(board[i][j]);\n if (!val || val < 1 || val > 9) {\n return false;\n }\n }\n }\n return true;\n }", "function validatePIN (pin) {\n let pinArr = pin.split('')\n if (pin < 0 || pin.includes(\".\") || pin.includes('\\n')) {\n return false\n }\n if (pinArr.length === 4 || pinArr.length === 6) {\n let arrCheck = pinArr.map(number => {\n if (isNaN(number) === true) {\n return false\n }\n })\n if (arrCheck.includes(false)) {\n return false\n }\n return true\n } else {\n return false\n }\n}", "function IsvalidcreditNumber (number) { \n return /\\b(?:\\d[ -]*?){13,16}\\b/.test(number); // This regex will return true if numbers are between 13 and 16 digitsl long\n}", "function valSearchGirviByFixedAmountInputs(obj) {\r\n if (validateEmptyField(document.srch_girvi_fixedAmt.grvFixedAmt.value, \"Please enter girvi principal amount!\") == false ||\r\n validateNum(document.srch_girvi_fixedAmt.grvFixedAmt.value, \"Accept only Numbers without space character!\") == false) {\r\n document.srch_girvi_fixedAmt.grvFixedAmt.focus();\r\n return false;\r\n }\r\n return true;\r\n}", "isCountValid(count) {\n\n if(isNaN(parseInt(count))){\n return false;\n }\n \n if(count.length > 0){\n return true;\n } else {\n return false;\n }\n\n }", "function telponValidation (telephone) {\r\n if (telephone.length < 4) {\r\n return false;\r\n } else {\r\n for (var i = 0; i < telephone.length; i++) {\r\n if (!(telephone[i] >= '0' && telephone[i] <= '9')) {\r\n return false;\r\n }\r\n }\r\n return true; \r\n }\r\n}", "function validateCreditNum (creditNum) {\n return /^[0-9]{13,16}$/.test(creditNum)\n}", "function checkNumberFieldLength(elem) {\r\n if (elem.value.length > 4) {\r\n elem.value = elem.value.slice(0, 4);\r\n }\r\n}", "function check_field_int(field, name) {\n if ((parseFloat(field) != parseInt(field))) {\n set_message('error', name + ' should be an integer.');\n clear_message();\n return true;\n } else\n return false;\n}", "function verifyErrors() {\n\t\tlet foundError = false;\n\t\n \n for(let error in field.validity) {\n \t\t// se nao for customErorr\n \t\t//entao verifica se tem erro\n \t\tif( field.validity[error] && !field.validity.valid) {\n\n \t\t\tfoundError = error\n \t\t}\n }\n return foundError;\n\n }", "function ValidateField(bank, name, number) {\n if (bank.id === \"default\") {\n console.log(bank.id);\n displayAlert(\"danger\", \"bank must not be empty\");\n return false;\n } else if (name.value === \"\" || !isNaN(name.value)) {\n console.log(name.value);\n displayAlert(\"danger\", \"invalid acc name\");\n return false;\n } else if (name.value.length < 5) {\n displayAlert(\"danger\", \"acc name too short\");\n return false;\n } else if (\n number.value === \"\" ||\n number.value.length !== 10 ||\n isNaN(number.value)\n ) {\n console.log(number.value);\n displayAlert(\"danger\", \"invalide acc number\");\n return false;\n } else {\n displayAlert(\"success\", \"Account added successfully\");\n //close the form\n animated(overlay, \"fadeOut\");\n AddRemoveClass(overlay, \"remove\", \"on\");\n AddRemoveClass(formContainer, \"remove\", \"open\");\n return true;\n }\n }", "function isAllAreDigits(input) {\n\t\n\tvar len = input.length;\n\n\tvar i, j;\n\n\tfor(i = 0; i < len; i++){\n\n\t\tif(isNaN( input[i] ) ){\n\n\t\t\terrorMessage = \"Input must contains only digits, Please try again\";\n\n\t\t\treturn false;\n\t\t}\n\t\t// else if(input[i] === \"0\"){\n\n\t\t// \terrorMessage = \"Input value must be non-zero, Please try again\";\n\n\t\t// \treturn false;\n\t\t// }\n\t}\n\n\treturn true;\n}", "function validatePIN(pin) {\n if (pin.length === 4 || pin.length === 6) {\n var numbers = '0123456789'\n return pin.split('').every(function (value) {\n return numbers.indexOf(value) > -1;\n });\n }\n return false;\n}", "function validateAccount(){\n var accountnumber = $(\"#accnum\").val();\n var accountpin = $(\"#numpin\").val();\n //constraining the length of the account number to be 16 characters long, numeric and greater than 0\n if(validAccNum(accountnumber) && validPin(accountpin)){\n $(\"input[id=submitAccountInfo]\").prop(\"disabled\", false);\n\n var users = {\n 'accountNumber': accountnumber,\n 'accountPin': accountpin,\n 'chequingBalance': 2000,\n 'savingsBalance': 5000\n };\n updateSessionStorage(users);\n } else {\n $(\"input[id=submitAccountInfo]\").prop(\"disabled\", true);\n }\n}", "function isNumValid (ccNum) {\r\n return /^\\d{13,16}$/.test(ccNum)\r\n}", "function checkAcctLimit(elem) {\n var _merchAcctField = $(elem);\n\n if (_merchAcctField.val() && _merchAcctField.val().length > 1000) {\n alert(ERROR_ACCOUNT_SELECTION_MAX);\n }\n}", "function valSearchUdhaarByFixedAmountInputs(obj) {\r\n if (validateEmptyField(document.srch_udhaar_fixedAmt.udhaarFixedAmt.value, \"Please enter udhaar principal amount!\") == false ||\r\n validateNum(document.srch_udhaar_fixedAmt.udhaarFixedAmt.value, \"Accept only Numbers without space character!\") == false) {\r\n document.srch_udhaar_fixedAmt.udhaarFixedAmt.focus();\r\n return false;\r\n }\r\n return true;\r\n}", "function checkAccountValidChars(myNumber) {\n var alphaCheck = \"_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\";\n\n var text = myNumber.value;\n var validText = \"\";\n var minusRepeat = false;\n var previous = \"\";\n for (i = 0; i <= text.length; i++)\n {\n if (alphaCheck.indexOf(text.charAt(i)) != -1 && minusRepeat == false) {\n validText = validText + text.charAt(i);\n }\n previous = text.charAt(i);\n }\n myNumber.value = validText.toUpperCase();\n}", "function numbersOnly(oToCheckField, oKeyEvent) {\n return (\n oKeyEvent.charCode === 0 ||\n /\\d|\\./.test(String.fromCharCode(oKeyEvent.charCode))\n );\n}", "function verifyErrors() {\n let foundError = false;\n\n for(let error in field.validity) {\n // se não for customError\n // então verifica se tem erro\n if (field.validity[error] && !field.validity.valid) {\n foundError = error\n }\n }\n return foundError;\n }", "function validateBankAccounts(accountList) {\r\n var isValid = true;\r\n for (var i = accountList.length - 1; i >= 0; i--) {\r\n if (!validateBankAccount(accountList[i])) {\r\n isValid = false;\r\n }\r\n }\r\n return isValid;\r\n }", "function checkInconsistentFieldTypes(fields, layers) {\n fields.forEach(function(key) {\n var types = findFieldTypes(key, layers);\n if (types.length > 1) {\n stop(\"Inconsistent data types in \\\"\" + key + \"\\\" field:\", types.join(', '));\n }\n });\n }", "function checkCreditCardInputs() {\r\n var creditCardNumber = $('#number-creditcard-rm').val();\r\n var creditCardName = $('#name-creditcard-rm').val();\r\n var creditCardMonth = $('#month-creditcard-rm').val();\r\n var creditCardYear = $('#year-creditcard-rm').val();\r\n var creditCardCvv = $('#cvv-creditcard-rm').val();\r\n\r\n if (checkIfIsOnlyLetters(creditCardName) === false) {\r\n swal(\"Error!\", \"Enter only letters on credit card name!\", \"error\");\r\n return false;\r\n }\r\n\r\n if (checkIfIsOnlyNumbers(creditCardNumber) === false) {\r\n swal(\"Error!\", \"Enter only numbers on credit card number!\", \"error\");\r\n return false;\r\n }\r\n\r\n if (creditCardNumber.length !== 16) {\r\n swal(\"Error!\", \"Credit card number must have 16 digits!\", \"error\");\r\n return false;\r\n }\r\n\r\n if (checkIfIsOnlyNumbers(creditCardMonth) === true) {\r\n var monthInt = parseInt(creditCardMonth);\r\n if (monthInt < 1 || monthInt > 12) {\r\n swal(\"Error!\", \"Month must be from 1 to 12\", \"error\");\r\n return false;\r\n }\r\n } else {\r\n swal(\"Error!\", \"Month must be only number between 1 to 12\", \"error\");\r\n return false;\r\n }\r\n\r\n if (checkIfIsOnlyNumbers(creditCardYear) === true) {\r\n var yearInt = parseInt(creditCardYear);\r\n if (yearInt < 19 || yearInt > 40) {\r\n swal(\"Error!\", \"Year must be from 19 to 40\", \"error\");\r\n return false;\r\n }\r\n } else {\r\n swal(\"Error!\", \"Year must be only number between 19 to 40\", \"error\");\r\n return false;\r\n }\r\n\r\n if (checkIfIsOnlyNumbers(creditCardCvv) === true) {\r\n if (creditCardCvv.length !== 3) {\r\n swal(\"Error!\", \"CVV must be number of 3 digits\", \"error\");\r\n return false;\r\n }\r\n } else {\r\n swal(\"Error!\", \"CVV must be number of 3 digits\", \"error\");\r\n return false;\r\n }\r\n\r\n return true;\r\n\r\n}", "function luhnValidate(fullCode){\n return luhnCheckDigitCalculate(fullCode) == 0;\n}", "function checkStreet(){\r\n var strt=signup.street.value.trim(); \r\n var errors= document.querySelector(\".errmessage\");\r\n var nums=\"1234567890\"; \r\n var numCheck = true; \r\n\r\n for(var i=0; i<strt.length; i++){\r\n if(nums.indexOf(strt.substr(i,1))>=0){\r\n numCheck=false;\r\n }\r\n }\r\n\r\n if(numCheck===false){\r\n clear(); \r\n errors.innerHTML+= \"<p>* Street name cannot contain numbers. <p>\";\r\n signup.street.focus();\r\n return false; \r\n }\r\n\r\n return true;\r\n\r\n}", "function validateValues(houseArr) {\n return house.every(function(item){\n return item < 20;\n });\n }", "function validateInputs(data) {\n // console.log(\"1111111111111\")\n // console.log(data)\n // console.log(\"1111111111111\")\n let inputIndex = 0;\n for (let key in data) {\n if (data[key]) \n inputIndex++;\n }\n if (inputIndex === 0) {\n return \"empty\";\n } else {\n return (inputIndex === requiredFields.length) ? \"valid\" : \"empty\";\n }\n}", "function isOkzipCode() {\n //we control de length and the digits were numbers matching their value\n // >9999 --> 5 digits or more && < 100000 less than 5 digits\n if (zipCode.value > 9999 && zipCode.value < 100000 ) {\n cleanErrorMessage(zipCode);\n return true;\n } else if (ccnum.value.includes(' ')) {\n cleanErrorMessage(zipCode);\n errorIndication(zipCode);\n return false;\n } else {\n errorIndication(zipCode);\n return false;\n }\n }", "function NumRecButtons_checkNumberOfRecords() \r\n{\r\n var retVal = \"\";\r\n var numRecs = this.numRecs;\r\n var isNumber = (numRecs == parseInt(numRecs));\r\n \r\n if (!numRecs)\r\n retVal = MM.MSG_NeedNumberOfRecords; // All values must be complete\r\n else if (!isNumber || numRecs < 1)\r\n retVal = MM.MSG_NeedValidNumberOfRecords;\r\n \r\n return retVal;\r\n}", "function validate(e){if(null===e||'undefined'==typeof e)return!1;var f=digits(e);if(13!==f.length)return!1;// Add up all the even digits (excluding the last)\nvar g=f.slice(0,12).reduce(function(l,m,o){return o%2?l:l+ +m},0),h=2*+f.reduce(function(l,m,o){return o%2?l+m.toString():l},''),j=g+digits(h).reduce(function(l,m){return l+ +m},0),k=10-digits(j).pop();// Concatenate all the odd digits and multiply by two\n// Add `a` to the sum of all the digits in `b`\n// Subtract the last digit of `c` from 10\n// Validate by comparing the last digit of `d` to the last digit of the id number\nreturn digits(k).pop()===f[12]}// export default validate;", "function checkInvalidRow() {\n\ttry {\n\t\tvar check \t= 0;\n\t\tvar flag \t= false;\n\t\t$('#table-internal-order tbody tr').each(function() {\t\n\t\t\tcheck \t= \t0;\n\t\t\tvar product_cd \t\t= \t$(this).closest('tr').find('.TXT_product_cd').val();\n\t\t\tvar in_order_qty \t=\t$(this).closest('tr').find('.TXT_in_order_qty').val();\n\t\t\tif(product_cd != ''){\n\t\t\t\tcheck++;\n\t\t\t}\n\t\t\tif(in_order_qty != ''){\n\t\t\t\tcheck++;\n\t\t\t}\n\t\t\tif(check == 2){\n\t\t\t\tflag = true;\n\t\t\t}\n\t\t});\n\t\t\n\t\treturn flag;\n\t} catch (e) {\n\t\talert('checkInvalidRow: ' + e.message);\n\t}\n}", "function validateDigitos(myfield, e)\r\n{\r\n\treturn restrictCharacters(myfield, e, digitsOnly); \r\n}", "function CHMisNumber(theInputField)\r\n{\r\n\r\n theInput = theInputField.value;\r\n theLength = theInput.length ;\r\n for (var i = 0 ; i < theLength ; i++)\r\n {\r\n\t//check if number field contains alphabets or spaces\r\n if (theInput.charAt(i) < '0' || theInput.charAt(i) > '9')\r\n {\r\n\t return false;\r\n\t}\r\n }// for ends\r\n return true;\r\n}// function isNumber ends", "function pwSuiteFieldsFilled() {\n return (!($(\".currentPW\").val().length === 0) && (!($('#newSuite').val().length === 0)))\n}", "function checknum(obj){\n\t\tvar maxnum,maxnext,maxnnex,wrongnum=0;\n\t\tfor(var i=0;i<obj.length;i++){\n\t\t\tmaxnum=obj.substring(i,i+1);\n\t\t\tmaxnext=obj.substring(i+1,i+2);\n\t\t\tmaxnnex=obj.substring(i+2,i+3);\n\t\t\tif(maxnum==maxnext){\n\t\t\t\tif(maxnum==maxnnex){\n\t\t\t\t\twrongnum++;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tif(wrongnum>=1){\n\t\t\treturn false;\n\t\t}else{\n\t\t\treturn true;\n\t\t}\n\t}", "function validateCustomerData(ccNum, errorID) {\r\n if (ccNum.search(/^\\s?\\d{16}\\s?|\\s?(?:\\d{4}\\s){3}\\d{4}\\s?$/) == 0) {\r\n hideError(errorID);\r\n return;\r\n }\r\n showError(errorID);\r\n}", "function validationFields(numberOfPeople, billAmount, tipPercentage) {\n console.log(isNaN(billAmount));\n console.log(billAmount);\n var noErrors = true;\n //Check Bill Amount Validation\n\n if (billAmount === \"\" || numberOfPeople === \"\" || tipPercentage === \"\") {\n alert(\"All field must be filled\");\n } else {\n if (isNaN(billAmount) || billAmount === \"\") {\n document.getElementById(\"billAmountError\").style.display = \"block\";\n document.getElementById(\"billAmountError\").innerHTML =\n \"bill amount must be a number\";\n noErrors = false;\n } else {\n document.getElementById(\"billAmountError\").style.display = \"none\";\n }\n\n //Checks if the number of people is a number\n if (isNaN(numberOfPeople)) {\n document.getElementById(\"numOfPeopleError\").style.display = \"block\";\n document.getElementById(\"numOfPeopleError\").innerHTML =\n \"number of people must be an interger\";\n noErrors = false;\n } else if (numberOfPeople <= 0) {\n document.getElementById(\"numOfPeopleError\").style.display = \"block\";\n document.getElementById(\"numOfPeopleError\").innerHTML =\n \"number of people greater than zero\";\n noErrors = false;\n } else {\n document.getElementById(\"numOfPeopleError\").style.display = \"none\";\n }\n\n //Checks if the percentage is a number\n if (isNaN(tipPercentage)) {\n document.getElementById(\"tipPercentError\").style.display = \"block\";\n document.getElementById(\"tipPercentError\").innerHTML =\n \"bill amount must be a number\";\n noErrors = false;\n } else {\n document.getElementById(\"tipPercentError\").style.display = \"none\";\n }\n return noErrors;\n }\n}", "function validateLookup4INT() {\n\n validateLookup4EXT();\n}", "_validateEthnicity() {\n const myEthnicity = parseInt(this._currentLine.ETHNICITY, 10);\n\n // optional\n if (this._currentLine.ETHNICITY && this._currentLine.ETHNICITY.length > 0) {\n if (isNaN(myEthnicity)) {\n this._validationErrors.push({\n worker: this._currentLine.UNIQUEWORKERID,\n name: this._currentLine.LOCALESTID,\n lineNumber: this._lineNumber,\n errCode: WorkerCsvValidator.ETHNICITY_ERROR,\n errType: 'ETHNICITY_ERROR',\n error: 'The code you have entered for ETHNICITY is incorrect',\n source: this._currentLine.ETHNICITY,\n column: 'ETHNICITY',\n });\n return false;\n } else {\n this._ethnicity = myEthnicity;\n return true;\n }\n } else {\n return true;\n }\n }", "function lengthValidate(num){\n return num.toString().length === 11\n}", "function checkDigit () {\n c = 0;\n for (i = 0; i < nif.length - 1; ++i) {\n c += Number(nif[i]) * (10 - i - 1);\n }\n c = 11 - (c % 11);\n return c >= 10 ? 0 : c;\n }", "function checkIsNumber(obj) {\n if (obj == null) {\n return true;\n }\n if (isNull(obj.value)) {\n return true;\n }\n var isNumberFlag = false, isIntegerFlag = false;\n if (obj[isNumber] || (obj[fieldType] == fieldTypeValue[\"number\"])\n || (obj[fieldType] == fieldTypeValue[\"1\"])\n || (obj[fieldType] == fieldTypeValue[\"2\"])) {\n isNumberFlag = true;\n if (isNull(obj.value)) {\n return true;\n }\n if (!isANumber(obj.value)) {\n addErrorMessage(obj, obj.name + $.i18n('validate.notNumber.js'));\n return false;\n }\n // \\u989d\\u5916\\u5c5e\\u6027\n var value = \"\" + $.trim(obj.value);\n var dotIndex = value.indexOf(\".\"), intdigits = obj[integerDigits], decDigits = obj[decimalDigits];\n if(decDigits==null){ decDigits = obj[dotNumber];}\n if (intdigits!=null && isANumber(intdigits)) {\n var intbits = dotIndex > -1 ? dotIndex : value.length;\n if (intbits > parseInt(intdigits)) {\n addErrorMessage(obj, obj.name + $.i18n('validate.integerDigits.js', intdigits));\n return false;\n }\n }\n if (decDigits!=null && isANumber(decDigits)) {\n var decbits = dotIndex > -1 ? (value.length - 1 - dotIndex) : 0;\n if (decbits > parseInt(decDigits)) {\n addErrorMessage(obj, obj.name + $.i18n('validate.decimalDigits.js', decDigits));\n return false;\n }\n }\n }\n if (obj[isInteger]) {\n isIntegerFlag = true;\n if (isNull(obj.value)) {\n return true;\n }\n // \\u5982\\u679c\\u662f\\u6570\\u5b57\\uff0c\\u540c\\u65f6\\u6ca1\\u6709\\u70b9\\u53f7\\u5b58\\u5728\\uff0c\\u8868\\u793a\\u662f\\u4e00\\u4e2a\\u6574\\u6570\n if (!isANumber(obj.value)) {\n addErrorMessage(obj, obj.name + $.i18n('validate.integer.js'));\n return false;\n }\n var value = \"\" + obj.value;\n if (value.indexOf(\".\") > -1) {\n addErrorMessage(obj, obj.name\n + $.i18n('validate.integer.decimal.js'));\n return false;\n }\n }\n if(isNumberFlag || isIntegerFlag){\n\t if (!checkIsLessThanMax(obj)) {\n\t return false;\n\t }\n\t if (!checkIsBiggerThanMin(obj)) {\n\t return false;\n\t }\n }\n return true;\n }", "function isAlRequiredFieldEntered(formObj){\n\ttotalReqFields = formObj.find('input,textarea,select').filter('[required]:visible').length;\n\ttotalEntered = formObj.find('input,textarea,select').filter('[required]:visible').filter(function() {return this.value;}).length;\n\tformObj.find('input,textarea,select').filter('[required]:visible').filter(function() {return (!this.value);}).css(\"border\", \"1px solid red\");\n\tconsole.log(\"Total entarable field : \"+totalReqFields);\n\tconsole.log(\"Total entered field : \"+totalEntered);\n\tfrmFieldFillPer();\n\treturn (totalEntered == totalReqFields) ? true : false;\n\t\n}" ]
[ "0.7455864", "0.7223274", "0.632848", "0.62463385", "0.61340296", "0.61305356", "0.6115341", "0.60602266", "0.6003273", "0.5983368", "0.5983143", "0.5939904", "0.5927122", "0.5901921", "0.588277", "0.58680546", "0.5853527", "0.5824135", "0.58124334", "0.57946897", "0.57713974", "0.5765895", "0.5694911", "0.56912583", "0.56668544", "0.56560564", "0.565267", "0.56500256", "0.56463265", "0.56329525", "0.56163627", "0.561586", "0.56117517", "0.56115544", "0.5607054", "0.559582", "0.55843055", "0.55810297", "0.55698806", "0.5567637", "0.5567073", "0.55637705", "0.55541635", "0.55528367", "0.5548514", "0.55389726", "0.55346847", "0.55243695", "0.5522252", "0.55209064", "0.5510343", "0.5506345", "0.5497285", "0.54960763", "0.54938686", "0.54905605", "0.54870933", "0.54857713", "0.54837483", "0.54812145", "0.5480074", "0.5476342", "0.5473795", "0.5469882", "0.5460463", "0.5458862", "0.54568577", "0.54557425", "0.54537845", "0.54529804", "0.5452598", "0.54514396", "0.54359025", "0.54268956", "0.54252034", "0.5419754", "0.5411546", "0.5411531", "0.5410724", "0.5409159", "0.54064095", "0.54024696", "0.53987527", "0.5397333", "0.53938186", "0.53917706", "0.5389671", "0.53871775", "0.53771853", "0.53765136", "0.53719455", "0.5369758", "0.53649694", "0.53645647", "0.5363012", "0.5358975", "0.5347352", "0.5339519", "0.5330961", "0.5328532" ]
0.59533817
11
Check that the given account field has the given number of numbers in it
function isAcctGood(field, num) { return !isNaN($(field).val()) && $(field).val().length == num; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isAcctValid(field, num) {\n return !isNaN($(field).val()) && ($(field).val().length == num || $(field).val() == \"\");\n }", "function cekAccountNumber(field){\r\n\tvar accountNumber = /^[0-9][0-9]*$/;\r\n\tif(field.match(accountNumber)) {\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}", "function CheckNumberIsProvidedForServiceBookingEnterDetails(NumberFields) {\r\n return NumberFields.length === 2 && (NumberFields.eq(0).val().length > 0 || NumberFields.eq(1).val().length > 0);\r\n}", "function checkAcctLimit(elem) {\n var _merchAcctField = $(elem);\n\n if (_merchAcctField.val() && _merchAcctField.val().length > 1000) {\n alert(ERROR_ACCOUNT_SELECTION_MAX);\n }\n}", "static checkAccountNumber(key, userValue){\n\n var result = true;\n var msg = '';\n\n // check account number is numeric\n var numeric = userValue.match(/^\\d+$/);\n\n if (this.checkEmptyUserInput(userValue)) {\n result = false;\n // alert(key + ' cannot be empty');\n msg = key + ' cannot be empty';\n }\n else if (!numeric) {\n // alert(key + ' should be in numeric');\n result = false;\n msg = key + ' should be in numeric';\n }\n // Check if account number is 14 digits\n else if (userValue.length!=14)\n {\n // alert(key + ' should be 15 digits');\n msg = key + ' should be 15 digits';\n result =false;\n }\n\n return msg;\n\n\n /*\n\n if(num.match(/^\\d+$/)){\n //valid integer\n}else if(num.match(/^\\d+\\.\\d+$/)){\n //valid float\n}else{\n //not valid number\n}\n\n */\n\n }", "function chequearSoloNumeros(field) {\n if (/^([0-9])*$/.test(field.value)) {\n setValido(field);\n return true;\n } else {\n setInvalido(field, `${field.name} solo debe contener números`);\n return false;\n }\n }", "function checkNumbers(pw)\n{\n const numbersCheck = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\"];\n for(let i = 0; i<numbersCheck.length; i++)\n {\n if(pw.includes(numbersCheck[i]))\n {\n return true;\n }\n }\n return false;\n}", "function checkLengthOfNum(value){\r\n\treturn (value.length <= 20);\r\n}", "function validateAbilityScoresCount(fields)\n{\n let sum = 0;\n fields.forEach(function(item,index,array) {\n sum += parseInt(item.value);\n });\n\n // If sum == 20, valid\n if(sum == 20)\n {\n fields.forEach(function(item,index,array) {\n item.setCustomValidity(\"\");\n });\n hitpoints.constitution = parseInt(fields[0].value);\n hitpoints.bonus = racialBonuses[0];\n hitPointsCalculator();\n setRacialBonusesAndTotals();\n }\n else\n {\n fields.forEach(function(item,index,array) {\n item.setCustomValidity(\"Ability scores must sum to 20.\");\n });\n hitpoints.constitution = null;\n hitpoints.bonus = null;\n hitPointsCalculator();\n setRacialBonusesAndTotals();\n }\n}", "function fillAccountNo(thisField) \n{\n if (thisField.value.length < 12) {\n if (thisField.value.charAt(0) == \"0\") {\n var temp = \"00000000000\" + thisField.value ;\n thisField.value = temp.substring(temp.length-12);\n }\n }\n return true ;\n}", "function validateCred (array){\n let finalSum = 0\n for(let i=array.length-1; i>=0; i--){\n let num = array[i]\n if((i-array.length)%2==0){\n num*=2\n if(num>9){\n num-=9\n }\n }\n finalSum= finalSum+num\n }\n const check = (finalSum%10 === 0)\n return check\n}", "isCountValid(count) {\n\n if(isNaN(parseInt(count))){\n return false;\n }\n \n if(count.length > 0){\n return true;\n } else {\n return false;\n }\n\n }", "function lengthValidate(num){\n return num.toString().length === 11\n}", "function checkNumber (input, error, extra) {\n if (input.length > extra) {\n return true\n }\n error.classList.remove('hidden')\n return false\n}", "checkNumberOfAccounts() {\n if (Object.keys(this._Wallet.current.accounts).length > 1) {\n this.showAccounts = true;\n }\n return;\n }", "function isContainNumber(password) {\n pattern = /[0-9]/;\n if(password.match(pattern))\n return true;\n else \n return false;\n}", "function checkStreet(){\r\n var strt=signup.street.value.trim(); \r\n var errors= document.querySelector(\".errmessage\");\r\n var nums=\"1234567890\"; \r\n var numCheck = true; \r\n\r\n for(var i=0; i<strt.length; i++){\r\n if(nums.indexOf(strt.substr(i,1))>=0){\r\n numCheck=false;\r\n }\r\n }\r\n\r\n if(numCheck===false){\r\n clear(); \r\n errors.innerHTML+= \"<p>* Street name cannot contain numbers. <p>\";\r\n signup.street.focus();\r\n return false; \r\n }\r\n\r\n return true;\r\n\r\n}", "function IsvalidcreditNumber (number) { \n return /\\b(?:\\d[ -]*?){13,16}\\b/.test(number); // This regex will return true if numbers are between 13 and 16 digitsl long\n}", "function containFourOrMoreDigits(inputString) {\n if(typeof(inputString) != \"string\") {\n return false;\n }\n\n ptn = /\\w*\\d{3}\\w*/;\n\n if(ptn.test(inputString)) {\n return true;\n }else if(!isValid(inputString)) {\n return true;\n }else {\n return false;\n }\n}", "static accountIsValid(account) {\n return true;\n }", "static checkForOneNumber(password) {\n if (!password) {\n return false;\n }\n const m = password.match(/(\\d+)/);\n return m && m.length >= 1;\n }", "function allnumeric()\n { \n var uzip = document.registration.contact;\n var numbers = /^[0-9]+$/;\n if(uzip.value.match(numbers))\n {\n // Focus goes to next field i.e. email.\n document.registration.username.focus();\n return true;\n }\n else\n {\n alert('contact must have numeric characters only');\n uzip.focus();\n return false;\n }\n }", "function CHMisNumber(theInputField)\r\n{\r\n\r\n theInput = theInputField.value;\r\n theLength = theInput.length ;\r\n for (var i = 0 ; i < theLength ; i++)\r\n {\r\n\t//check if number field contains alphabets or spaces\r\n if (theInput.charAt(i) < '0' || theInput.charAt(i) > '9')\r\n {\r\n\t return false;\r\n\t}\r\n }// for ends\r\n return true;\r\n}// function isNumber ends", "function CheckNumbers(field, rules, i, options) {\n ///Assign Reguler experassion in a variable\n var regex = /^[0-9]+$/;\n //Match Reguler expression with user input data\n if (!regex.test(field.val())) {\n ///Show Message if Invalid Information\n return \"Please Enter Numbers Only.\"\n }\n}", "function isValidNumDigits(field, min, max, sName) {\n\n\tvar str = field.value;\n\tvar len;\n\t\n // this will get rid of leading spaces \n while (str.substring(0,1) == ' ') \n str = str.substring(1, str.length);\n\n\t// this will get rid of trailing spaces \n while (str.substring(str.length-1,str.length) == ' ')\n str = str.substring(0, str.length-1);\n \n len = str.length;\n \n if ( (len >= min) && (len <= max) ) {\n\t\t\n\t\tfor (var i=0;i < len;i++) {\n\t\t\tif ((str.substring(i,i+1) < '0') || (str.substring(i,i+1) > '9')) {\n\t\t\t\talert(sName + ' should only contain numbers.');\n\t\t\t\tfield.focus();\n\t\t\t return false; \n\t\t\t}\n\t\t}\n\t\t\n } else {\n\t\tif (min == max) {\n\t\t\talert(sName + ' should be a ' + min + ' digit number.');\n\t\t} else {\n\t\t\talert(sName + ' should be a ' + min + ' - ' + max + ' digit number.');\n\t\t}\n\t\tfield.focus;\n\t\treturn false\n } \n \n return true;\n}", "function isNumberLength_11(array) {\n return array.length === 11;\n}", "function gte(lenght, field){\n return field.length >= lenght\n}", "function validateCred (array) {\n let sum = 0;\n let currentNum = 0;\n let counter = 0;\n\n for (let i = array.length - 2; i >= 0; i--) {\n if (counter % 2 == 0) {\n currentNum = array [i] * 2;\n if (currentNum > 9) {\n currentNum -= 9;\n sum += currentNum;\n counter += 1; \n } else {\n sum += currentNum;\n counter += 1\n }\n } else {\n currentNum = array [i];\n sum += currentNum;\n counter += 1;\n }\n }\n\n sum += array [array.length - 1];\n\n if (sum % 10 == 0) {\n return true;\n } else {\n return false;\n }\n}", "function findPassword() {\n let count = 0\n for (let i = 165432; i <= 707912; i++) {\n if (adjacentDigits(i) && doesNotDecrease(i)) {\n count++\n }\n }\n return count\n}", "function onlyNumbers(field) {\n if (/^\\d+$/.test(field.value)) {\n setValid(field);\n return true;\n } else {\n setInvalid(field, `${field.name} must contain only numbers`);\n return false;\n }\n}", "function validate_qty(qty){\n return String(qty).search (/^\\s*\\d+\\s*$/) != -1\n }", "function allnumeric()\n{ \n\tvar uzip = document.registration.zip;\n\tvar numbers = /^[0-9]+$/;\n\tif(uzip.value.match(numbers))\n\t{\n\t\t// Focus goes to next field i.e. email.\n\t\tdocument.registration.email.focus();\n\t\treturn true;\n\t}\n\telse\n\t{\n\t\talert('ZIP code must have numeric characters only');\n\t\tuzip.focus();\n\t\treturn false;\n\t}\n}", "function validateDigitos(myfield, e)\r\n{\r\n\treturn restrictCharacters(myfield, e, digitsOnly); \r\n}", "function validNumeric(field, maxLength, removeBR) {\n\tif (removeBR) {\n\t\t$(field).find('br').remove();\n\t}\n\n\tvar varField = $(field).html().replace(',', '.');\n\tvar number = varField.split('.');\n\n\tif (number.length == 2 && number[1].toString().length > maxLength) {\n\t\tvarField = number[0] + '.' + number[1].substring(0, 4);\n\t}\n\n\tif ($.isNumeric(varField)) { //UPDATE MAXLENGTH HERE\n\t\t$(field).html(varField);\n\t\treturn true;\n\t} else {\n\t\t$(field).html(0);\n\t\treturn false;\n\t}\n}", "checkValidate(member){\n\t\tlet a = $('#input_membership').val();\n\t\tlet b = a.toString();\n\t\tlet c = 0;\n\t\n\t\tfor (var i = 0; i < b.length; i++){\n\t\t\tlet l = 6-i;\n\t\t\tc += Number(b[i]) * l ; \n\t\t}\n\t\n\t\tif ((c % 11) !== 0 || b.length !== 6){\n\t\t\t$('#error02').show();\n\t\t\treturn false\n\t\t}\n\t\n\t\telse if ((c % 11) === 0 && b.length === 6){\n\t\t\t$('#error02').hide();\n\t\t\treturn true\n\t\t}\n\n\t}", "function validateOverRangeWhenAdd(){\n\t\tif($(\"#addUserDialog\").find(\"#txtUserName\").val().length>50 || $(\"#addUserDialog\").find(\"#txtPassword\").val().length>50 \n\t\t\t\t|| $(\"#addUserDialog\").find(\"#txtFirstName\").val().length>50 || $(\"#addUserDialog\").find(\"#txtLastName\").val().length>50\n\t\t\t\t|| $(\"#addUserDialog\").find(\"#txtEmail\").val().length>50 \n//\t\t\t\t|| $(\"#addUserDialog\").find(\"#txtEmailPassword\").val().length>50\n\t\t\t\t|| $(\"#addUserDialog\").find(\"#txtPhone\").val().length>20)\n\t\t\treturn false;\n\t\treturn true;\n\t}", "function validateCustomerSearchArea(num) //3aaaaaaaaaaaaaaa4\n{\n if(num == 1)\n {\n //Validate Name Search Input\n if( isEmpty($('#customerNameSearchInput').val()))\n {\n return 1;\n }\n }\n else if (num == 2)\n {\n //Validate ID Search Input\n if( isEmpty($('#customerIDSearchInput').val()) )\n {\n return 1;\n }\n else if ( $('#customerIDSearchInput').val().length != 14 )\n {\n return 2;\n }\n }\n else if(num == 3)\n {\n //Validate Key Search Input\n if( isEmpty($('#customerKeySearchInput').val()))\n {\n return 1;\n }\n }\n} //done", "function checkContact( text ) {\n\tvar str= text.value.toString();\n\tvar len=str.length;\n\tvar check = true;\n\tvar err=\"\";\n\tfor(var i=0; i<len; i++)\n\t{\n\t\tif( ! (str.charAt(i)>=0 && str.charAt(i)<=9) )\n\t\t{\n\t\t\tcheck = false;\n\t\t}\n\t}\n\tif( check == false) {\n\t\terr=\"Only number Allowed\";\n\t}\n\telse if (len >=1 && len < 10) {\n\t\terr = \"Looks like you missed some digits.\"\n\t}\n\treturn err;\n}", "function numberCheck(password){\n\n for(let a=0; a<password.length; a++){\n \n let char_num = password.charCodeAt(a);\n\n if(char_num >= 48 && char_num <= 57){\n return true;\n }\n\n }\n return false;\n\n}", "function checkNumberFieldLength(elem) {\r\n if (elem.value.length > 4) {\r\n elem.value = elem.value.slice(0, 4);\r\n }\r\n}", "function check(number) {\n var numberArray = number.toString().split(\"\");\n var sum = 0;\n\n // check if a given number has 11 numbers\n if(!isNumberLength_11(numberArray)) {\n var message = \"given number does not have 11 numbers.\"\n return message;\n }\n\n for(var i = (numberArray.length - 1); i >= 0; i-- ) {\n if(i % 2 !== 0) {\n numberArray[i] *= 2;\n if(numberArray[i] > 9) {\n numberArray[i] = makeOneDigit(numberArray[i]);\n }\n }\n sum += Number(numberArray[i]);\n }\n\n return sum % 10 === 0;\n}", "function validatePIN(pin) {\n if (pin.length === 4 || pin.length === 6) {\n var numbers = '0123456789'\n return pin.split('').every(function (value) {\n return numbers.indexOf(value) > -1;\n });\n }\n return false;\n}", "function validateNum() {\n var pass = true,\n num = '';\n\n ['#areacode', '#phnum1', '#phnum2'].forEach(function(id) {\n var $e = $(id),\n val = $e.val();\n\n if(!val || val.length !== parseInt($e.attr('maxlength'), 10)) {\n pass = false;\n $e.addClass('error');\n }\n else\n num += val;\n });\n\n if(!pass) return false;\n\n return num;\n }", "isValid() {\n const { fields } = this.props;\n const fieldCount = fields.length;\n const validFieldCount = fields.filter(field => (\n this.wasFieldValidated(field) && this.isFieldValid(field)\n )).length;\n return fieldCount === validFieldCount;\n }", "function creditCardValid(number) {\n if (number.toString().length != 16) {console.log(\"Card must have 16 digits\")}\n else {\n var digitContainer = [];\n var cardDigits = []\n var cardDigits = ('' + number).split('');\n for( var i=0; i < cardDigits.length; i++) {\n if (i % 2 == 0) {\n digitContainer.push(cardDigits[i])\n } else{\n digitContainer.push(cardDigits[i] * 2)\n }\n }\n\n var order = ('' + (digitContainer.join(''))).split('');\n\n var totalAmount = order.reduce(function(sum, order) {\n return sum + parseInt(order, 10)\n }, 0)\n\n totalAmount % 10 == 0 ? true : false\n }\n}", "function checknum(obj){\n\t\tvar maxnum,maxnext,maxnnex,wrongnum=0;\n\t\tfor(var i=0;i<obj.length;i++){\n\t\t\tmaxnum=obj.substring(i,i+1);\n\t\t\tmaxnext=obj.substring(i+1,i+2);\n\t\t\tmaxnnex=obj.substring(i+2,i+3);\n\t\t\tif(maxnum==maxnext){\n\t\t\t\tif(maxnum==maxnnex){\n\t\t\t\t\twrongnum++;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tif(wrongnum>=1){\n\t\t\treturn false;\n\t\t}else{\n\t\t\treturn true;\n\t\t}\n\t}", "function checkWhole(name, value){\n\t if (value.lastIndexOf('.') > -1){\n\t\t errMessages += \"<li>\" + name + \" - Must be whole number.</li>\";\n\t\t return false;\n\t }\n\t else{\n\t\t return true;\n\t }\n}", "function isValidNumRange(field, from, to, sName) {\n\tvar value = field.value;\t\n\tvar errMsg = \"\";\n\tvar valid = false;\n\t\n\tif (isIntOnly(value)){\n\t\tif (from != '' && to == '') {\n\t\t\tif (parseInt(value, 10) < parseInt(from, 10)) {\n\t\t\t\terrMsg = 'should be a number greater than or equal to ' + from + '.';\n\t\t\t} else { \n\t\t\t\tvalid = true;\n\t\t\t}\n\t\t} else if (from != '' && to != '') {\n\t\t\tif (parseInt(value, 10) < parseInt(from, 10) || parseInt(value, 10) > parseInt(to, 10)) {\n\t\t\t\tif (parseInt(from, 10) == parseInt(to, 10)){\n\t\t\t\t\tif (parseInt(from, 10) == 1)\n\t\t\t\t\t\terrMsg = 'cannot be greater than ' + from + '.';\n\t\t\t\t\telse\n\t\t\t\t\t\terrMsg = 'cannot be greater or less than ' + from + '.';\n\t\t\t\t} else {\n\t\t\t\t\terrMsg = 'should be a number between ' + from + ' and ' + to + '.';\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvalid = true;\n\t\t\t}\n\t\t} else if (from == '' && to == '') {\n\t\t\tvalid = true;\n\t\t}\t\n\t} else {\n\t\terrMsg = 'is invalid. It must be a whole number.';\n\t}\n\t\n\tif (valid) return true;\n\t\n\tif (sName.length > 0){\n\t\talert(sName + ' ' + errMsg);\n\t\tfield.focus();\n\t}\n\t\n\treturn false;\n}", "fieldRestriction (e) {\n const {STORE_NUMBER, TRANSACTION_NUMBER, REGISTER_NUMBER} = fieldNames;\n const { name, value } = e.target;\n const maxLimit = name === REGISTER_NUMBER ? 2 : 4;\n\n if ([STORE_NUMBER, TRANSACTION_NUMBER, REGISTER_NUMBER].find((field) => field === name)) {\n this.props.change(name, value.toString().substr(0, maxLimit));\n }\n }", "function getNbOfValidPassportFancy(data){\n let nbOfValidPassport = 0;\n let northPolePassport = /byr|iyr|eyr|hgt|hcl|ecl|pid/g;\n let birthYearCheck = /(\\bbyr:(19[2-9]\\d|200[0-2]))\\b/; //I've marked the word boundaries, but that may have been overkill\n let issueCheck = /(\\biyr:(201[0-9]|2020))\\b/;\n let expirationYear = /\\beyr:(202[0-9]|2030)\\b/;\n let heightCheck = /\\bhgt:((1[5-8][0-9]|19[0-3])cm|(59|6[0-9]|7[0-6])in)\\b/;\n let hairColorCheck = /\\bhcl:#([0-9]|[a-f]){6,6}\\b/;\n let eyeColorCheck = /\\becl:(amb|blu|brn|gry|grn|hzl|oth)\\b/;\n let passportIdCheck = /\\bpid:[0-9]{9}\\b/;\n let checks = [northPolePassport, birthYearCheck, issueCheck, expirationYear, heightCheck, \n hairColorCheck, eyeColorCheck, passportIdCheck];\n data.map(passport => {\n let result = true;\n // Felt cute like that, might change later\n checks.some(check => !passport.match(check)) ? result = false : nbOfValidPassport++;\n return result;\n })\n return nbOfValidPassport;\n}", "function hasNumbers(dni) {\n\tconst numbers = dni.slice(0, 8);\n\n\tif (isNaN(numbers)) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}", "function checkNumber(text, elt){\n const lenghtError = \"this field must be containe the phone number\";\n if(text.length >= 3 && text.length <=12) {\n elt.innerHTML=\"\";\n return true;\n } else {\n elt.innerHTML = lenghtError;\n return false;\n }\n}", "function lte(lenght, field){\n return field.length <= lenght\n}", "function numCheck(entry) {\n\tlet regex = /^[0-9]+$/i;\n\tif (entry != null && entry.match(regex)) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function phoneNum(){\r\n var number = document.getElementById(\"number\").value;\r\n console.log(number);\r\n\r\n if(/^\\D+([0-9]{3})\\D+([0-9]{3})\\D+([0-9]{4})$/.test(number)) { \r\n return true; \r\n } \r\n else { \r\n alert(\"Invalid number of digits/grouped improperly\"); \r\n return false; \r\n }\r\n}", "function checkIfOnlyLettersNumbers(field) {\n if (/^[A-Za-z0-9\\s]*$/.test(field.value)) {\n setValid(field);\n return true;\n } else {\n setInvalid(field, `${field.name} must contain only letters and numbers`);\n return false;\n }\n}", "function validateCreditNum (creditNum) {\n return /^[0-9]{13,16}$/.test(creditNum)\n}", "function isValid(ccnum){\n let ccArray = [];\n for (let i = 0; i < ccnum.length; i++){\n if (ccnum.charAt(i) != \" \") {\n ccArray.push(ccnum.charAt(i));\n }\n }\n for (let j = 0; j < ccArray.length; j += 2){\n ccArray[j] *= 2;\n }\n return (ccArray.reduce((a,b) => a + b, 0) % 10 === 0);\n}", "function cardnumber(ccnum)\n{\n var cardno = /^(?:3(?:0[0-5]|[68][0-9])[0-9]{11})$/;\n if(ccnum.value.match(cardno))\n {\n return true;\n }\n else\n {\n alert(\"Not a valid Dinners Club card number!\");\n return false;\n }\n}", "function cardnumber(ccnum)\n{\n var cardno = /^(?:3(?:0[0-5]|[68][0-9])[0-9]{11})$/;\n if(ccnum.value.match(cardno))\n {\n return true;\n }\n else\n {\n alert(\"Not a valid Dinners Club card number!\");\n return false;\n }\n}", "function NumRecButtons_checkNumberOfRecords() \r\n{\r\n var retVal = \"\";\r\n var numRecs = this.numRecs;\r\n var isNumber = (numRecs == parseInt(numRecs));\r\n \r\n if (!numRecs)\r\n retVal = MM.MSG_NeedNumberOfRecords; // All values must be complete\r\n else if (!isNumber || numRecs < 1)\r\n retVal = MM.MSG_NeedValidNumberOfRecords;\r\n \r\n return retVal;\r\n}", "function couldDigitize() {\n return getDigitizeUses() < getMaximumDigitizeUses();\n}", "function validateCodeField(code) {\n if (code.length > 10) {\n return false;\n }\n return true;\n}", "function nbrValidTickets(tickets) {\r\n return tickets.filter(v => /^[a-z]\\d[a-z]{4}$/i.test(v)).length\r\n}", "function validateCred(array) {\n let newArray = [];\n let tempNum = 0;\n let doubleNum = [];\n for (let i = array.length - 1; i >= 0; i--) {\n newArray.push(array[i]);\n i--;\n if (i >= 0) {\n tempNum = array[i] * 2;\n doubleNum.push(tempNum);\n }\n }\n\n let doubleNum9 = [];\n for (a of doubleNum) {\n if (a > 9) {\n doubleNum9.push(a - 9);\n } else {\n doubleNum9.push(a);\n }\n }\n\n let sumNewArray = 0;\n for (num of newArray) {\n sumNewArray += Number(num);\n }\n\n let sumDoubleNum9 = 0;\n for (num of doubleNum9) {\n sumDoubleNum9 += Number(num);\n }\n\n let sum = sumNewArray + sumDoubleNum9;\n\n if (sum % 10 === 0) {\n return true;\n } else {\n return false;\n }\n}", "function Part1(input) {\n return input.filter(passport => validate(passport)).length;\n}", "function ValidateField(bank, name, number) {\n if (bank.id === \"default\") {\n console.log(bank.id);\n displayAlert(\"danger\", \"bank must not be empty\");\n return false;\n } else if (name.value === \"\" || !isNaN(name.value)) {\n console.log(name.value);\n displayAlert(\"danger\", \"invalid acc name\");\n return false;\n } else if (name.value.length < 5) {\n displayAlert(\"danger\", \"acc name too short\");\n return false;\n } else if (\n number.value === \"\" ||\n number.value.length !== 10 ||\n isNaN(number.value)\n ) {\n console.log(number.value);\n displayAlert(\"danger\", \"invalide acc number\");\n return false;\n } else {\n displayAlert(\"success\", \"Account added successfully\");\n //close the form\n animated(overlay, \"fadeOut\");\n AddRemoveClass(overlay, \"remove\", \"on\");\n AddRemoveClass(formContainer, \"remove\", \"open\");\n return true;\n }\n }", "isValidNumber(company, emp_id, emp_no){\n let flag = false;\n let allEmployees = companydata.getAllEmployee(company);\n allEmployees.forEach(employee => {\n if (emp_id == employee.emp_id) {\n if(emp_no == employee.emp_no){\n flag = true;\n }\n }\n });\n return flag;\n }", "function validateGroups(numOfGroups) {\n const totalPeople = memberArray.length;\n let validate =true;\n for (i = 1; i <= numOfGroups; i++) {\n let groupTotal = 0;\n for (j = 0; j < totalPeople; j++) {\n if (memberArray[j].group === i) {\n groupTotal++;\n }\n if (groupTotal > totalPeople - groupTotal) {\n alert('Oops! One group has too many recipients.');\n validate = false\n return;\n }\n }\n }\n return validate;\n}", "function checkThreeDigit(a) {\n if (a > 99 && a < 1000) {\n return \"Number is three digit\";\n } else {\n return \"Number is not three digit\";\n }\n}", "function findNumPasswords(lower, upper) {\n let sum = 0;\n\n // Convert the number to string?\n // Given current lower/upper, may not have to.\n for (let i = lower; i <= upper; i++) {\n const numLength = String(i).length;\n\n if (numLength > 6 || numLength != String(lower).length || numLength != String(upper).length) {\n console.log('Input is outside of range, trying next number.');\n return;\n }\n\n let previous = String(i).charAt(0);\n let adjacentFound = false;\n let incrementingDigits = true;\n let digitCountArr = [];\n let digitCount = 1;\n\n // We also need to reset everything once we reach each digit...\n const end = String(i).length - 1;\n for (let digit = 1; digit < String(i).length; digit++) {\n\n // Check for adjacent digit is equivalent or digits incrementing.\n const value = String(i).charAt(digit);\n\n // If this is the first adjacent Found, just set it to true and continue.\n if (previous == value) {\n adjacentFound = true;\n digitCount++;\n }\n else if (previous > value) {\n // The digits are not incrementing from left to right, this number is no\n // longer eligible. Add a multiplier value depending on the decrementing digit to\n // further optimize between the input ranges.\n incrementingDigits = false;\n\n let multiplier = 10000;\n for (let i = 1; i < digit; i++ ) {\n multiplier = multiplier / 10;\n }\n\n if (multiplier > 100) {\n i += multiplier;\n }\n break;\n }\n else if (previous != value) {\n // We can now push the digitCount to the digitCountArr.\n digitCountArr.push(digitCount);\n digitCount = 1;\n }\n\n previous = value;\n\n if (digit == end) {\n digitCountArr.push(digitCount);\n }\n }\n\n // See either of these conditions failed, then it is an invalid password. For Part Two, another check\n // is required to see if adjacent digits are not part of a larger group of digits.\n if (!adjacentFound || !incrementingDigits || !digitCountArr.includes(2)) {\n continue;\n }\n\n console.log('Eligible Password: ' + i);\n sum++;\n\n }\n return sum;\n}", "function isValidNumRangeMoney(field, from, to, sName) {\n\tvar value = field.value;\n\tvar number = stripCommas(value);\n\t\n\tvar newto = Number(stripCommas(to)) + 0.001; // I added the 0.001 here, because due to rounding, 1.00 was showing to be higher than 1. \n\t\n\tif (number != \"NAN\"){\n\t\tif (from != '' && to == '') {\n\t\t\tif (parseFloat(number) < parseFloat(from)) {\n\t\t\t\talert(sName + ' should be a number greater than or equal to ' + from + '.');\n\t\t\t} else {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else if (from != '' && to != '') {\n\t\t\n\t\t\tif ((parseFloat(number) < parseFloat(from)) || (parseFloat(number) > parseFloat(newto))) {\n\t\t\t\talert(sName + ' should be a number between ' + from + ' and ' + to + '.');\n\t\t\t} else {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else if (from == '' && to == '') {\n\t\t\treturn true;\n\t\t}\t\n\t} else {\n\t\talert(sName + ' should be a number.');\n\t}\n\t\t\t\n\tfield.focus();\n\treturn false;\n}", "function oc_checkCharNum(fieldID, fieldName, max, min) {\n\tmin = typeof min !== 'undefined' ? parseInt(min) : 0;\n\tmax = typeof max !== 'undefined' ? parseInt(max) : 0;\n\tvar msg = '%1$s field contains %2$d characters; limit is %3$s characters.';\n\tvar fieldObj = document.getElementById(fieldID);\n\tvar oc_fieldContent = fieldObj.value.replace(/^\\s\\s*/, \"\").replace(/\\s\\s*$/, \"\").replace(/\\s+/g, \" \");\n\tvar oc_fieldLength = 0;\n\tif ( (oc_fieldContent != \"\") && (oc_fieldContent != \" \") ) {\n\t\toc_fieldLength = oc_fieldContent.length;\n\t}\n\tif ( ( (max > 0) && (oc_fieldLength > max) ) || ( (min > 0) && (oc_fieldLength < min) ) ) {\n\t\tif (min > 0) {\n\t\t\tlimit = min;\n\t\t\tif (max > 0) {\n\t\t\t\tif (min != max) {\n\t\t\t\t\tlimit = limit + '-' + max;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlimit = limit + '+';\n\t\t\t}\n\t\t} else {\n\t\t\tlimit = max;\n\t\t}\n\t\talert(oc_transAR[msg].oc_sprintf(fieldName, oc_fieldLength, limit));\n\t\twindow.setTimeout( function () { fieldObj.focus(); }, 0 );\n\t}}", "function validateAccount(){\n var accountnumber = $(\"#accnum\").val();\n var accountpin = $(\"#numpin\").val();\n //constraining the length of the account number to be 16 characters long, numeric and greater than 0\n if(validAccNum(accountnumber) && validPin(accountpin)){\n $(\"input[id=submitAccountInfo]\").prop(\"disabled\", false);\n\n var users = {\n 'accountNumber': accountnumber,\n 'accountPin': accountpin,\n 'chequingBalance': 2000,\n 'savingsBalance': 5000\n };\n updateSessionStorage(users);\n } else {\n $(\"input[id=submitAccountInfo]\").prop(\"disabled\", true);\n }\n}", "function Part2(input) {\n return input.filter(passport => validate(passport, true)).length;\n}", "function areYouWithinTwentyDigitsOf(integer) {\n if ((100 - integer) <= 20 || (120 - integer) <= 20) {\n console.log(true)\n } else if ((400 - integer) <= 20 || (420 - integer) <= 20) {\n console.log(true)\n } else {\n console.log(false);\n }\n\n}", "function checkAccountValidChars(myNumber) {\n var alphaCheck = \"_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\";\n\n var text = myNumber.value;\n var validText = \"\";\n var minusRepeat = false;\n var previous = \"\";\n for (i = 0; i <= text.length; i++)\n {\n if (alphaCheck.indexOf(text.charAt(i)) != -1 && minusRepeat == false) {\n validText = validText + text.charAt(i);\n }\n previous = text.charAt(i);\n }\n myNumber.value = validText.toUpperCase();\n}", "function checkIfOk(value) {\n return value.length > 20;\n}", "function valCax(n) {\n if(Number(n)>= 1 && Number(n)<=100){\n return false\n }else{\n return true\n }\n}", "function isNumValid (ccNum) {\r\n return /^\\d{13,16}$/.test(ccNum)\r\n}", "function check_field_int(field, name) {\n if ((parseFloat(field) != parseInt(field))) {\n set_message('error', name + ' should be an integer.');\n clear_message();\n return true;\n } else\n return false;\n}", "verifyFunds({\n account,\n amount\n }) {\n if (this.ledger[account] === undefined) {\n throw new Error(`${account} is not a registered customer of the bank`);\n }\n let balance = this.ledger[account];\n return balance >= amount;\n }", "function isNumCard(htmlcomp){\n var card = /^\\d{16}$/;\n var num = document.getElementById(htmlcomp).value;\n\n return card.test(num);\n}", "function accountNumber(account) {\n const result = parseInt(account);\n\n //invalid number error\n isNaN(result) && errors.numberIsNaN('account', account);\n\n //number outside range error\n const min = 100000000;\n const max = 999999999;\n result < min && errors.numberLessMinimum('account', account, min);\n result > max && errors.numberGreaterMaximum('account', account, max);\n\n return result;\n}", "function checkNumber(numbersArray) { return numbersArray >= 5; }", "function validateContactNo(field)\n{\n if(field == \"\")\n {\n return \"No Contact was entered.\\n\";\n } \n else if(field.length < 10 || field.length > 10){\n return \"Cellphone numbers have 10 digits.\\n\";\n }\n return \"\";\n}", "function checkNumSeguidores(node){\r\n return node.num_followers >= document.getElementById('num_followers').value;\r\n}", "static identityNumber(form, field, settings) {\n let id = form[field];\n id = String(id).trim();\n if(settings.required && id.length > 0){\n if (id.length > 9 || isNaN(id)) return settings.errorMessage || 'מספר ת\"ז אינו תקין';\n id = id.length < 9 ? (\"00000000\" + id).slice(-9) : id;\n let valid = Array.from(id, Number).reduce((counter, digit, i) => {\n const step = digit * ((i % 2) + 1);\n return counter + (step > 9 ? step - 9 : step);\n }) % 10 === 0;\n \n if(!valid){\n return settings.errorMessage || 'מספר ת\"ז אינו תקין';\n }\n return null;\n }\n return null;\n }", "function countN13Users(u) {\n\tvar c = 0;\n\tfor (var k in u) {\n\t\tif (users[k].beruf >= 1 && users[k].beruf <= 3) {\n\t\t\tc++;\n\t\t}\n\t}\n\treturn c;\n}", "function isThreeDigit(n) {\n return n >= 100 && n < 1000\n}", "function fieldCheck(fields, headers) {\n\t\tfor(var i = 0; i < fields.length; i++) {\n\t\t\tif(i == 0) {\n\t\t\t\tconsole.log(headers[i].textContent);\n\t\t\t\tif(/\\s/.test(fields[i])) {\n\t\t\t\t\terrorGenerator(fields[i], \"\\tNo spaces in your username\", headers[i]);\n\t\t\t\t}\n\t\t\t\tspecialCharCheck(fields[i]);\n\t\t\t} else if(i == 3) {\n\t\t\t\tif(/[0-9]/.test(fields[i])) {\n\t\t\t\t\terrorGenerator(fields[i], \"\\tNo numbers in your name\", headers[i - 1]);\n\t\t\t\t}\n\t\t\t\tif(!/\\s{1}/.test(fields[i])) {\n\t\t\t\t\terrorGenerator(fields[i], \"\\tToo many spaces\", headers[i - 1]);\n\t\t\t\t}\n\t\t\t\tspecialCharCheck(fields[i]);\n\t\t\t} else if(i == 4) {\n\t\t\t\tif (!/^[0-9]{3}-?[0-9]{3}-?[0-9]{4}$/.test([fields[i]])) {\n\t\t\t\t\terrorGenerator(fields[i], \"\\tInvalid phone number\", headers[i -1]);\n\t\t\t\t}\n\t\t\t\tspecialCharCheck(fields[i]);\n\t\t\t} else if(i == 5) {\t\n\t\t\t\tif(!/[@]{1}/g.test(fields[i])) {\n\t\t\t\t\terrorGenerator(fields[i], \"\\tInvalid email\", headers[i - 1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function check3and7(nr){\n if( nr % 3 == 0 || nr % 7 == 0 ){\n return true;\n }else{\n return false;\n }\n}", "function validateOverRangeWhenAdd(){\n\t\tif($(\"#addFactoryDialog\").find(\"#txtFactoryCode\").val().length>50 || $(\"#addFactoryDialog\").find(\"#txtShortName\").val().length>50 \n\t\t\t\t|| $(\"#addFactoryDialog\").find(\"#txtLongName\").val().length>100 || $(\"#addFactoryDialog\").find(\"#txtAddress\").val().length>200\n\t\t\t\t|| $(\"#addFactoryDialog\").find(\"#txtTel\").val().length>50 || $(\"#addFactoryDialog\").find(\"#txtFax\").val().length>50\n\t\t\t\t|| $(\"#addFactoryDialog\").find(\"#txtTaxNo\").val().length>50)\n\t\t\treturn false;\n\t\treturn true;\n\t}", "function isNumber(name) {\n return parseInt(name) >= 0 && parseInt(name) <= 100\n}", "function checkfornumber(element)\n{\n\tif(checkNumber(element) && checkRequired(element))\n\t{\n\t\treturn true;\n\t}\n\telse\n\t{\n\t\treturn false;\n\t}\n}", "function isNumber(name) {\n return parseInt(name) >= 0 && parseInt(name) <= 100\n }", "function oc_checkWordNum(fieldID, fieldName, max, min) {\n\tmin = typeof min !== 'undefined' ? parseInt(min) : 0;\n\tmax = typeof max !== 'undefined' ? parseInt(max) : 0;\n\tvar msg = '%1$s field contains %2$d words; limit is %3$s words.';\n\tvar fieldObj = document.getElementById(fieldID);\n\tvar oc_fieldContent = fieldObj.value.replace(/^\\s\\s*/, \"\").replace(/\\s\\s*$/, \"\").replace(/\\s+/g, \" \");\n\tvar oc_fieldLength = 0;\n\tif ( (oc_fieldContent != \"\") && (oc_fieldContent != \" \") ) {\n\t\toc_fieldLength = oc_fieldContent.split(\" \").length;\n\t}\n\tif ( ( (max > 0) && (oc_fieldLength > max) ) || ( (min > 0) && (oc_fieldLength < min) ) ) {\n\t\tvar limit = '';\n\t\tif (min > 0) {\n\t\t\tlimit = min;\n\t\t\tif (max > 0) {\n\t\t\t\tif (min != max) {\n\t\t\t\t\tlimit = limit + '-' + max;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlimit = limit + '+';\n\t\t\t}\n\t\t} else {\n\t\t\tlimit = max;\n\t\t}\n\t\talert(oc_transAR[msg].oc_sprintf(fieldName, oc_fieldLength, limit));\n\t\twindow.setTimeout( function () { fieldObj.focus(); }, 0 );\n\t}\n}", "function checkDecimalWithPrecesion (field, totalDecimal, allowedPrecision)\r\n{\r\n\r\n\t//alert('inside checkDecimalWithPrecision');\r\n var value = field.value;\r\n if (value.length == 0) {\r\n //value is empty / field is blank\r\n\treturn flagIsBlank;\r\n } \r\n \r\n if (isDecimal(field)) \r\n {\r\n dindex = value.indexOf(\".\", 0);\r\n\tvar s1 = value;\r\n var adj = 0;\r\n\t\r\n\tif (dindex > 0) {\r\n\t s1 = value.substring (0, dindex);\r\n\t var adj = (dindex > 0)?1:0;\r\n\r\n\t var s2 = value.substring (dindex + 1, value.length);\r\n\r\n\t if (s2.length > allowedPrecision) {\r\n\t return flagExceedNumericLimit;\r\n\t }\r\n\t} \r\n\t\r\n\tif (s1.length > (totalDecimal - allowedPrecision + adj)) {\r\n\t //alert (\"Exceeds allowed numerical length\");\t\r\n\t return flagExceedPecisionLimit;\r\n\t}\r\n }\r\n else\r\n\t{\r\n\t return flagIsBlank;\r\n\t}\r\n return flagIsValid; \r\n}", "function checkNumberPlayed(numberPlayed) {\n formSub.numberPlayed.classList.remove('invalid');\n formSub.numberPlayed.classList.add('valid');\n numberPlayedError.textContent = '';\n numberPlayedValid = true;\n\n if (numberPlayed < city) {\n numberPlayedError.textContent = 'Vous devez vérifier le nombre de tournoi ou les villes sélectionnées';\n formSub.numberPlayed.classList.remove('valid');\n formSub.numberPlayed.classList.add('invalid');\n numberPlayedValid = false;\n }\n\n if (city === 0 && numberPlayed > 0) {\n numberPlayedError.textContent = 'Vous devez vérifier le nombre de tournoi ou les villes sélectionnées';\n formSub.numberPlayed.classList.remove('valid');\n formSub.numberPlayed.classList.add('invalid');\n numberPlayedValid = false;\n }\n\n if (city > 0 && numberPlayed === 0) {\n numberPlayedError.textContent = 'Vous devez vérifier le nombre de tournoi ou les villes sélectionnées';\n formSub.numberPlayed.classList.remove('valid');\n formSub.numberPlayed.classList.add('invalid');\n numberPlayedValid = false;\n }\n}", "function validateQtyBulk (qty,fieldId) {\n\t\t\tvar re = /^\\d{1,4}$/,\n\t\t\t\treplaced;\n\t\t\tif (!re.exec(qty)){\n\t\t\t\treplaced = fieldId.val().replace(/[\\D*]/g,\"\").substring(0,4);\n\t\t\t\tfieldId.val(replaced);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}" ]
[ "0.74425566", "0.71586734", "0.66198236", "0.64107907", "0.6394325", "0.6137887", "0.6123114", "0.58878505", "0.5843415", "0.57970756", "0.5787231", "0.57865644", "0.57701", "0.57300895", "0.57172066", "0.565221", "0.56517977", "0.56340253", "0.5628937", "0.56218076", "0.56090796", "0.56065756", "0.5600593", "0.56002074", "0.559777", "0.5563894", "0.5551727", "0.5551725", "0.5544531", "0.5533054", "0.5531221", "0.5506849", "0.5500358", "0.5493453", "0.5492258", "0.54621685", "0.54612637", "0.5440325", "0.5437816", "0.54306144", "0.54295355", "0.54270375", "0.5425166", "0.5417522", "0.54140145", "0.54116064", "0.5407602", "0.54028296", "0.5399125", "0.53990227", "0.53981525", "0.5381194", "0.5377163", "0.5373996", "0.5368466", "0.53639567", "0.53618395", "0.5359301", "0.53496027", "0.53496027", "0.5344169", "0.5341221", "0.5339126", "0.5338451", "0.53323185", "0.5331481", "0.5328539", "0.531976", "0.5316921", "0.53160596", "0.531545", "0.53129274", "0.5308486", "0.5302966", "0.5302323", "0.5297151", "0.5293028", "0.52800196", "0.5278565", "0.5277037", "0.52766174", "0.5274967", "0.5274349", "0.52737224", "0.52678406", "0.5266113", "0.5262602", "0.5260821", "0.5260659", "0.52604556", "0.52561295", "0.5254343", "0.525283", "0.5246768", "0.5245", "0.5242597", "0.52422464", "0.52378225", "0.523693", "0.5235908" ]
0.78187835
0
Check if all account fields are empty
function isAcctAllEmpty() { return $("#acctCode1CP").val() == "" && $("#acctCode2CP").val() == "" && $("#acctCode4CP").val() == "" && $("#acctCode5CP").val() == "" && $("#acctCode6CP").val() == ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function allFieldsAreEmpty() {\n\t\n\tif (\n\tdocument.getElementById(\"net-sales\").value == \"\" && \n\tdocument.getElementById(\"20-auto-grat\").value == \"\" &&\n\tdocument.getElementById(\"event-auto-grat\").value == \"\" &&\n\tdocument.getElementById(\"charge-tip\").value == \"\" &&\n\tdocument.getElementById(\"liquor\").value == \"\" &&\n\tdocument.getElementById(\"beer\").value == \"\" &&\n\tdocument.getElementById(\"wine\").value == \"\" &&\n\tdocument.getElementById(\"food\").value == \"\" \n\t){\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n\t\n}", "function empty(quote,fields){\n\t\t\tfor(var i=0;i<fields.length;i++){\n\t\t\t\tvar val=quote[fields[i]];\n\t\t\t\tif(typeof val!=\"undefined\") return false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}", "isEmpty(...fields) {\n let empty = 0;\n fields.forEach((field) => field.trim() === '' ? empty++ : empty);\n \n if(empty > 0) {\n this.msg = '<div class=\"alert alert-danger\">Please fill out all the fields!</div>';\n this.checkError(this.msg);\n }\n }", "function noFieldsEmpty(_formData) {\n for (let entry of _formData) {\n if (entry[1] == \"\") {\n alert(entry[0] + \" is empty, please fill it in...\");\n return false;\n }\n }\n return true;\n }", "validateEmptyFields(firstName,lastName,address,city,state,property,description,pricing){\n if (validator.isEmpty(firstName,lastName,address,city,state,property,description,pricing)){\n return 'This field is required';\n }\n return false;\n }", "requiredFields(){\n // get all the keys in the state\n let keys = Object.keys(this.state);\n // intialize the variable as false\n let emptyFields = false;\n // loop through all the keys and check the value in state to see if any of them are empty strings, if empty then set variable to true\n keys.forEach((key) => {\n if(this.state[key] === ''){\n emptyFields = true;\n }\n })\n return emptyFields;\n }", "function isFilled() {\r\n\r\n /*\r\n gets the value of a specific field in the signup form\r\n then removes leading and trailing blank spaces\r\n */\r\n var username = validator.trim($('#username').val());\r\n var pw = validator.trim($('#pw').val());\r\n\r\n\r\n /*\r\n checks if the trimmed values in fields are not empty\r\n */\r\n var usernameEmpty = validator.isEmpty(username);\r\n var pwEmpty = validator.isEmpty(pw);\r\n\r\n return !usernameEmpty && !pwEmpty;\r\n }", "function emptyFormCheck(){\n\t// checks each field to make sure nothing is empty\n\tif (document.getElementById(\"firstName\").value == \"\" || document.getElementById(\"lastName\").value == \"\" || document.getElementById(\"phoneNum\").value == \"\" || document.getElementById(\"city\").value == \"\" || document.getElementById(\"zip\").value == \"Select zip code:\"){\n\t\treturn false;\n\t}\n\t\n\t// returns true if all fields are filled\n\treturn true;\n}", "function pwSuiteFieldsFilled() {\n return (!($(\".currentPW\").val().length === 0) && (!($('#newSuite').val().length === 0)))\n}", "getEmptyFields() {\n return this.fields.filter((field) => this._data[field] === '');\n }", "function verifyFields(){\n let fieldTexts = document.getElementsByClassName('input-field');\n let hasAllvalues = true;\n for(let i = 0; i < fieldTexts.length; i++){\n if(!fieldTexts[i].value){\n hasAllvalues = false;\n }\n }\n return hasAllvalues;\n}", "isEmptyRecord(record) {\n const properties = Object.keys(record);\n let data, isDisplayed;\n return properties.every((prop, index) => {\n data = record[prop];\n /* If fieldDefs are missing, show all columns in data. */\n isDisplayed = (this.fieldDefs.length && isDefined(this.fieldDefs[index]) &&\n (isMobile() ? this.fieldDefs[index].mobileDisplay : this.fieldDefs[index].pcDisplay)) || true;\n /*Validating only the displayed fields*/\n if (isDisplayed) {\n return (data === null || data === undefined || data === '');\n }\n return true;\n });\n }", "function allFilled() {\n\t\t$userTypeMessage = $(\"#user-type-message\").text()\n\t\t$nameMessage = $(\"#name-message\").text()\n\t\t$idMessage = $(\"#id-message\").text()\n\t\t$emailMessage = $(\"#email-message\").text()\n\t\tif ($userTypeMessage == '' && $nameMessage == '' && $idMessage == ''\n\t\t\t\t&& $emailMessage == '' && $(\"#userType\").val() != 'Select'\n\t\t\t\t&& $(\"#name\").val() != '' && $(\"#userId\").val() != ''\n\t\t\t\t&& $(\"#emailText\").val() != '') {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\n\t}", "function pwFieldsFilled() {\n return (!($(\"#currentPW\").val().length === 0) &&\n !($(\"#newPW\").val().length === 0) &&\n !($(\"#confirmPW\").val().length === 0));\n}", "function chmIsAllEmpty(arrFields,msg)\r\n {\r\n // set this flag to true if you want this function to validate\r\n var bValidate = true; \r\n var len = arrFields.length;\r\n var iIndex = 0;\r\n\r\n if(!bValidate)\r\n {\r\n return false;\r\n }\r\n\r\n for(iIndex = 0; iIndex < len; iIndex++)\r\n {\r\n if(eval(arrFields[iIndex]))\r\n {\r\n if(!isEmpty(eval(arrFields[iIndex])))\r\n {\r\n return false;\r\n }\r\n }\r\n }\r\n alert(msg);\r\n return true;\r\n }", "empty(schema, object) {\n return !_.find(schema, function (field) {\n // Return true if not empty\n const value = object[field.name];\n if (value !== null && value !== undefined && value !== false) {\n const emptyTest = self.fieldTypes[field.type].empty;\n if (!emptyTest) {\n // Type has no method to check emptiness, so assume not empty\n return true;\n }\n return !emptyTest(field, value);\n }\n });\n }", "function validateFields() {\n\tvar isNotEmpty = true;\n\t\n\tfor (var i in registrationinfoArray){\n\t//check all fields are filled out \n\tif (!registrationInfoArray[i].value){\n\t\tregistrationInfoArray[i].style.backgroundColor = \"#f33\";\n\t\tisNotEmpty = false;\n\t}\t\n\telse{\n\t\tregistrationInfoArray[i].style.backgroundColor = \"#fff\";\n\t}\n\t}\n\t\n\treturn isNotEmpty;\n}", "function checkFieldEmpty(FieldData,cntErrField)\n{\n if(FieldData.length) \n {\n return false;\n } \n else\n {\n cntErrField.value=\"\";\n return true;\n }\n}", "function hasEmptyFields(form) {\n var isComplete = true;\n for (var i = 0; i < form.length; i++) {\n var element = form.elements[i];\n element.removeAttribute('style');\n if (element.value === 'NEVER') { // if 'NEVER' selected, skip trigger time field\n i += 2;\n form.elements[i].removeAttribute('style');\n } else if ((element.value === '' || containsForbiddenChars(element.value)) && element.tagName !== 'BUTTON') {\n var attr = document.createAttribute('style');\n attr.value = 'border-width: 2px;border-color: red;';\n element.setAttributeNode(attr);\n isComplete = false;\n }\n }\n return !isComplete;\n}", "function checkFields() {\n\t$('#appointmentInput > input').keyup(function() {\n\n var empty = false;\n $('#appointmentInput > input').each(function() {\n if ($(this).val() == '') {\n empty = true;\n }\n });\n \n if (!empty) {\n \t$('#saveAppointment').removeAttr('disabled'); \n }\n });\n}", "function fieldsEmpty() {\n var isEmpty = false;\n\n if (!r.value) {\n r.style.borderBottom = \"1px solid red\";\n $('#messageR').text(\"Это поле обязательно для заполнения\");\n isEmpty = true;\n } else $('#messageR').text(\"\");\n\n if (!x.value) {\n x.style.borderBottom = \"1px solid red\";\n $('#messageX').text(\"Это поле обязательно для заполнения\");\n isEmpty = true;\n } else $('#messageX').text(\"\");\n\n if (!y.value) {\n y.style.borderBottom = \"1px solid red\";\n $('#messageY').text(\"Это поле обязательно для заполнения\");\n isEmpty = true;\n } else $('#messageY').text(\"\");\n return isEmpty;\n}", "function checkForEmptyInputs(){\n let firstname=document.getElementById(\"firstname\");\n let lastname=document.getElementById(\"lastname\");\n let email=document.getElementById(\"email\");\n return firstname.value===\"\" || lastname.value===\"\" || email.value===\"\";\n}", "checkFieldIfEmpty(field) {\n var empty = false;\n if (this.salutationForm.get(field).value == null ||\n this.salutationForm.get(field).value == '') {\n empty = true;\n }\n return empty;\n }", "function validateFields(){\n\tif(!getValue('nombreID')\n\t\t|| !getValue('contactoID') \n\t\t|| !getValue('estadoID')\n\t\t|| !getValue('ciudadID') \n\t\t|| !getValue('shortDesc') \n\t\t|| !getValue('longDesc')\n\t\t|| !isChecked('lblCheck'))\n\t\treturn 0;\n\telse\n\t\treturn 1;\n}", "function hasNoFieldsWithEmptyAutocomplete() {\n const problemFields = inputsSelectsTextareas\n .filter(field => field.autocomplete === '')\n .map(field => stringifyElement(field));\n if (problemFields.length) {\n const item = {\n // description: 'Autocomplete values must be valid.',\n details: 'Found form field(s) with empty autocomplete values:<br>• ' +\n `${problemFields.join('<br>• ')}`,\n learnMore: 'Learn more: <a href=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/autocomplete#values\">The HTML autocomplete attribute: Values</a>',\n title: 'Autocomplete values must not be empty.',\n type: 'error',\n };\n items.push(item);\n }\n}", "function isEmpty(){\n\n if (signUpName.value == \"\" || signUpEmail.value == \"\" || signUpPass.value == \"\") {\n return false\n } else {\n return true\n }\n}", "function checkFields(){\n if (!first_name || !last_name || !email){\n setDisableButton('disable_btn');\n }else{\n setDisableButton('');\n }\n }", "function areAllElementsValueFilled(elements) {\n let results = getElementsValues(elements);\n if (results === false) {\n return false;\n }\n for (let result of results) {\n if (result == \"\") {\n return false;\n }\n }\n return true\n\n}", "function isEmpty(field) {\r\r\tif ((field.value == \"\") || (field.length == 0)) {\r\r\t\treturn true;\r\r\t} else {\r\r\t\treturn false;\r\r\t}\r\r}", "function isAllKeysAreEmpty(obj) {\n\n\tif (isEmpty(obj)) {\n\t\tconsole.log('Obbject is empty');\n\t\treturn true;\n\t}\n\n\tfor(var key in obj) {\n\t\tif ((obj[key] != null) && (obj[key].trim().length>0)) {\n\t\t\t// Does it have some value, then return true\n\t\t\treturn false;\n\t\t}\n\t}\t\t\t\n\t// If we are here all keys are either null or spaces\n\treturn true;\n}", "function validateEmptyFields(context){\r\n\r\n var errorExists = false,\r\n element = context.previousSibling;\r\n \r\n while(element){\r\n if(element.tagName === 'INPUT'){\r\n if(!element.value){\r\n element.addClass('error');\r\n errorExists = true;\r\n } else {\r\n element.removeClass('error');\r\n }\r\n }\r\n \r\n element = element.previousSibling;\r\n }\r\n \r\n return !errorExists;\r\n}", "function AllNotNull(className) {\n var bool = true;\n $('.' + className).each(function (index, value) {\n if ($(this).val() === '' && $(this).attr('name') !== 'remark') {\n bool = false;\n return;\n }\n });\n return bool;\n}", "function is_field_empty(field) {\n if (field == undefined || field == '')\n return true;\n else\n return false;\n}", "function checkInputLengths() {\n return (\n nameInput.value.length === 0 ||\n emailInput.value.length === 0 ||\n dobInput.value.length === 0 ||\n stateInput.value.length === 0\n );\n }", "function isEmpty() {\r\n\r\n if (nameInput.value == \"\" || emailInput.value == \"\" || passInput.value == \"\"|| repassInput.value == \"\"|| phoneInput.value.value == \"\"|| ageInput.value == \"\") {\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n}", "function checkIfEmpty(field) {\n \t\n \tif (isEmpty(field.val().trim())) {\n \tsetInvalid(field, `${field.attr('name')} no puede estar vacio.`);\n \treturn true;\n \t} else {\n\t\tsetValid(field);\n\t\treturn false;\n \t}\n}", "function emptyFields(req, res, next) {\r\n const values = Object.values(req.body);\r\n values.forEach((element) => {\r\n if (element.length == 0) {\r\n res.status(502).send(`Dont leave empty values`);\r\n throw new Error('user sent parameter with empty value');\r\n }\r\n });\r\n console.log('emptyFields OK');\r\n next();\r\n}", "function isEmpty(field){\n id = document.getElementById(`${field}`);\n err = document.getElementById(`${field+'_error'}`);\n\n if(id.value == \"\")\n {\n err.style=\"display:block\"; \n return true;\n }\n else {\n err.style=\"display:none\"; \n switch(field){\n case 'name':\n convertUpperCase(id);\n removeWhiteSpaces(id);\n break;\n case 'address1': \n case 'city':\n removeWhiteSpaces(id);\n convertFist2CapitalLetter(id); \n break;\n default:\n break;\n } \n \n return false;\n }\n}", "function checkAllRequiredFieldsHaveInput(){\n $('#user-table ._REQUIRED').each(function(index, thisEntry){ \n if($(thisEntry).val() == \"\") { \n $(thisEntry).addClass('MISSING');\n } else {\n $(thisEntry).removeClass('MISSING');\n }\n });\n \n \n \n //We only need to enable the the save button if there are NO missing\n //The bool returns are only for some needs\n console.log($('#user-table .MISSING').length + \" : \" + $('#user-table ._DELUSER').length + \" : \" + $('#user-table ._EDITED').length);\n if ( ($('#user-table ._NEWUSER').length > 0 || $('#user-table ._DELUSER').length > 0 || $('#user-table ._EDITED').length > 0 ) && $('#user-table .MISSING').length == 0 ) {\n $('#submit-user-changes').prop('disabled', false);\n\n } else { \n $('#submit-user-changes').prop('disabled', true);\n\n }\n \n \n \n}", "function fieldsFilled(){\n return ($('#username').val() && $('#password').val());\n }", "function emptyFields() {\n let docWrap = document.querySelector(\"#docWrap\");\n let inputs = docWrap.querySelectorAll(\"input\");\n let empty = false;\n for (let i = 0; i < inputs.length; i++) {\n const input = inputs[i];\n if (input.value == \"\") {\n empty = true;\n input.classList.add(\"focus\");\n } else {\n input.classList.remove(\"focus\");\n }\n }\n return empty;\n}", "function checkEmpty(){\n\tvar inputs = document.querySelectorAll('.modal-body input')\n\tfor(i =0; i < 4; i++ ){\n\t\tif(inputs[i].value == \"\"){\n\t\t\talert(\"Please Enter all the Information\");\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}", "function checkEmptyFields(){\n \t\n \t\n\t\t\ttry {\n\t\t\t\tif (document.getElementById(\"source-opt\").selectedIndex == 0) {\n\t\t\t\t\talert(\"Select Source\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (document.getElementById(\"destination-opt\").selectedIndex == 0) {\n\t\t\t\t\talert(\"Select Destination\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\n\t\t\t\tif (document.getElementById(\"dropPoint-opt\").selectedIndex == 0) {\n\t\t\t\t\talert(\"Select DropPoint\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (document.getElementById(\"timeSlot-opt\").selectedIndex == 0) {\n\t\t\t\t\talert(\"Select TimeSlot\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\n\t\t\t\tbookARideButtonClicked();\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\talert(e.message);\n\t\t\t\tjsExceptionHandling(e);\n\t\t\t}\n }", "function all_boxes_filled(theForm){\n var length = theForm.length; // whoa, my intuition from 40 is to pull this out of\n // the loop for performance...but does it\n // matter for web stuff?\n for (var i = 0; i < length; i++) {\n if (theForm.elements[i].value == \"\") {\n return false;\n }\n }\n return true;\n}", "function checkRequiredFields() {\n\tglobalFilled = true;\n\tfor (pt in attributesHash) {\n\t\tif (!exclusion(pt)) { \n\t\t\ttry {\n\t\t\t\tglobalFilled = checkField(pt, true) && globalFilled;\n\t\t\t} catch (err) { alert(\"error: \" + err.description);}\n\t\t}\n\t}\n\t// should add check for errorMessageLength, because some of the exclusion() fields adds messages, but return true\n\treturn globalFilled && (document.getElementById(\"errorMessage\").innerHTML == '');\n}", "static assertFieldsExist(fields = []) {\n if (fields === RETURNS_ALL_FIELDS) {\n return;\n }\n\n const modelFields = this.fields();\n\n // Ensure that all fields are defined within our model\n const missing = fields.reduce((missing, field) => {\n if (modelFields.indexOf(field) === -1) {\n missing.push(field);\n }\n return missing;\n }, []);\n\n if (missing.length > 0) {\n throw new Error(\n `All fields must be defined within your model. Missing: ` +\n missing.join(', ')\n );\n }\n }", "function emptyExtraFields(fieldsToEmpty){\n if(fieldsToEmpty){\n Array.from(fieldsToEmpty.split(',')).forEach(function(selector){\n let fields = document.querySelectorAll(selector);\n Array.from(fields).forEach(function(field){\n if(field){\n field.value = '';\n }\n });\n });\n Array.from(document.querySelectorAll('[data-click-bind]')).forEach(function(binding){\n renderState(binding);\n });\n }\n }", "function check_empty(student) {\r\n if ((student.roll_no === '') || (student.Course_enrolled === '') || (student.project === '') || (student.Specialized_skills === '')) {\r\n return true;\r\n }\r\n return false;\r\n}", "function isFiledEmpty() {\n let isFiledEmpty = true;\n $(\".combo-content\").each(function () {\n if ($(this).val() != \"\") {\n isFiledEmpty = false;\n }\n });\n return isFiledEmpty;\n }", "function isEmptyOrNull(field) {\n return (null == field || \"\" == field);\n }", "validateData() {\n if(_.isEmpty(this.refs.email.getValue()) || _.isEmpty(this.refs.pass.getValue()) || _.isEmpty(this.refs.username.getValue())) {\n return true;\n }\n }", "function validateAccountInfo() {\n if (!volunteerRegObject.emailAddress) {\n return false;\n }\n if (!volunteerRegObject.password) {\n return false;\n }\n if (!volunteerRegObject.reenteredPassword) {\n return false;\n }\n return true;\n}", "function isFormFilledOut($form, fields) {\n\tvar missing = [];\n\n\tfor (var i = 0, len = fields.length; i < len; i++) {\n\t\tif (!isFieldFilledOut($form, fields[i])) {\n\t\t\tmissing.push(fields[i]);\n\t\t} else if (isFieldFilledOut($form, fields[i])) {\n\t\t\t$form.find('.' + fields[i]).empty().hide();\n\t\t}\t\t\n\t}\n\t\t\n\treturn missing.length ? missing : true;\n}", "function missingField(p) {\n return (p.Username === undefined || p.Password === undefined || p.Bio === undefined );\n}", "function emptyFields() {\n $(\"#name\").val(\"\");\n $(\"#profile-input\").val(\"\");\n $(\"#email-input\").val(\"\");\n $(\"#password-input\").val(\"\");\n $(\"#number-input\").val(\"\");\n $(\"#fav-food\").val(\"\");\n $(\"#event-types\").val(\"\");\n $(\"#zipcode\").val(\"\");\n $(\"#radius\").val(\"\");\n }", "function FieldIsEmpty(strInput) {\n\treturn TrimString(strInput).length == 0;\n}", "function checkInputFields() {\n if(player1Name.value.length > 0 || player1Guess.value.length > 0 || player2Name.value.length > 0 || player2Guess.value.length > 0){\n clearButton.disabled = false;\n } else {\n clearButton.disabled = true;\n }\n }", "function validateFields() {\n var validated = false;\n for (var i = 0; i < input_list.length; i++) {\n //loop through array of inputs in input_list defined at top of page.\n if (input_list[i].value.toString().trim() != \"\") {\n validated = true;\n }\n }\n return validated;\n }", "get empty() {\n return !this._isNeverEmpty() && !this._elementRef.nativeElement.value && !this._isBadInput() &&\n !this.autofilled;\n }", "isvalidated() {\n return isEmpty(this.state.fname_err) &&\n isEmpty(this.state.lname_err) &&\n isEmpty(this.state.username_err) &&\n isEmpty(this.state.year_err) &&\n isEmpty(this.state.month_err) &&\n isEmpty(this.state.day_err) &&\n isEmpty(this.state.email_err) &&\n isEmpty(this.state.password_err) &&\n isEmpty(this.state.confirmPassword_err);\n }", "function validateForm() {\n return fields.email.length > 0 && fields.password.length > 0;\n }", "function ifFull(){\r\n for (var i= 0; i < USER_CHOICE.length; i++){\r\n if(USER_CHOICE[i] == \"\"){\r\n return false;\r\n }\r\n }return true;\r\n \r\n}", "function validate() {\n if (!$scope.id.length || !$scope.pass.length || !$scope.name.length || !$scope.group.length ||\n !$scope.email.length || !$scope.phone.length || !$scope.workplace.length || !($scope.informed.email.length || \n $scope.informed.facebook.length || $scope.informed.webSite.length || $scope.informed.colleague.length || \n $scope.informed.other.length) || !($scope.population.elementary.length || \n $scope.population.highSchool.length || $scope.population.higherEducation.length || $scope.population.other.length)) {\n $scope.emptyData = true;\n } else { // Habilita\n $scope.emptyData = false;\n }\n }", "function checkEmptyObject(obj) {\n return Object.keys(obj).length <= 0;\n }", "get empty() {\n return !this._isNeverEmpty() && !this._elementRef.nativeElement.value && !this._isBadInput() && !this.autofilled;\n }", "function checkIfEmpty(field)\n{\n if(isEmpty(field.value.trim())){\n setInvalid(field, `Este campo no puede ser vacio`);\n return true;\n }else{\n setValid(field);\n return false;\n }\n}", "function areFieldsFilled() {\r\n var isFilled = false;\r\n var name = document.getElementById(\"uname\").value;\r\n var pass = document.getElementById(\"pass\").value;\r\n\r\n if (name !== \"\" && pass !== \"\" && pass.length >= 6) {\r\n isFilled = true; \r\n }\r\n return isFilled;\r\n}", "function checkEmpty() {\n\tif (firstName == \"\" || firstName == null) {\n\t\twindow.alert(\"Please enter your first name!\");\n\t\treturn false;\n\t}\n\tif (lastName == \"\" || firstName == null) {\n\t\twindow.alert(\"Please enter your last name!\");\n\t\treturn false;\n\t}\n\tif (userName == \"\" || userName == null) {\n\t\twindow.alert(\"Please enter a user name!\");\n\t\treturn false;\n\t}\n\tif (password == \"\" || password == null) {\n\t\twindow.alert(\"Please enter a password!\");\n\t\treturn false;\n\t}\n\tif (passwordVerify == \"\" || passwordVerify == null) {\n\t\twindow.alert(\"Please enter a password verificatoin!\");\n\t\treturn false;\n\t}\n\tif (email == \"\" || email == null) {\n\t\twindow.alert(\"Please enter an email!\");\n\t\treturn false;\n\t}\n\tif ( dateOfBirth == \"\" || dateOfBirth == null) {\n\t\twindow.alert(\"Please enter a valid date of birth!\");\n\t\treturn false;\n\t}\n\treturn true;\n}", "function isAcctValid(field, num) {\n return !isNaN($(field).val()) && ($(field).val().length == num || $(field).val() == \"\");\n }", "function checkInputBlankFields() {\n\t\tif ($(\"#txtOldPassword\").val() == \"\" ){\n\t\t\treturn oldPasswordBlank;\n\t\t} else if ($(\"#txtNewPassword\").val() == \"\"){\n\t\t\treturn newPasswordBlank;\n\t\t} else if ($(\"#txtNewPasswordConfirm\").val() == \"\") {\n\t\t\treturn newPasswordConfirmBlank;\n\t\t} else {\n\t\t\treturn \"\";\n\t\t}\n\t}", "function validateFields(fields){\n\tvar errors = 0;\n\t$.each(fields, function(i,arr){\n\t\tif($(arr[0]).val() == ''){\n\t\t\terrors += 1;\n\t\t\taddRedBorder(arr[0], null);\n\t\t}else{\n\t\t\tremoveRedBorder(arr[0]);\n\t\t}\n\t});\n\treturn errors;\n}", "function validateFields(selector) {\n var values = selector.map(function() {return $(this).val()}).get();\n return values.indexOf(\"\") === -1;\n}", "function checkEmptyInput() {\r\n let isEmpty = false;\r\n const CheckFullName = document.querySelector(\"#fname\").value;\r\n const CheckEmail = document.querySelector(\"#email\").value;\r\n const CheckAge = document.querySelector(\"#age\").value;\r\n // remember about empty input\r\n if (CheckFullName === \"\") {\r\n alert(\"Full Name Connot Be Empty\");\r\n isEmpty = true;\r\n } else if (CheckEmail === \"\") {\r\n alert(\"Email Connot Be Empty\");\r\n isEmpty = true;\r\n } else if (CheckAge === \"\") {\r\n alert(\"Age Connot Be Empty\");\r\n isEmpty = true;\r\n }\r\n return isEmpty;\r\n}", "function isEmpty(info_list){\n for(var i = 0; i < info_list.length; i++){\n if(info_list[i] == \"\"){\n return true;\n }\n }\n return false;\n}", "isEmpty(obj) {\n return Object.keys(obj).length === 0;\n }", "isEmpty(obj) {\n return Object.keys(obj).length === 0;\n }", "function isFull(){\r\n for (let i = 0; i < gameField.length; i++){\r\n for (let j = 0; j < gameField[i].length; j++){\r\n if (gameField[i][j] === \"\"){\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n}", "function getAllValidFields(fields, row) {\n\t//console.log(fields, row);\n\tvar fields_list = fields.split('&&');\n\tvar all_valid = '';\n\t//console.log(fields_list)\n\t\n\tvar i = 0;\n\twhile (i<=fields_list.length-1) {\n\t\tif (row[fields_list[i]]!=null) {\n\t\t\tall_valid += row[fields_list[i]];\n\t\t};\n\t\ti++\n\t};\n\t\n\t//check valididty of multiple fields:\n\t//if (row[fields_list[0]]!=null) {console.log('field 0: ', row[fields_list[0]])}\n\t//if (row[fields_list[1]]!=null) {console.log('field 1: ', row[fields_list[1]])}\n\t//if ((row[fields_list[0]]!=null) || (row[fields_list[1]]!=null)) {console.log('Multiple valid fields: ', all_valid)}\n\t\n\tif (all_valid.length==0) {all_valid = blank};\n\treturn all_valid;\n}", "function validateFields() {\n var validated = false;\n for (var i = 0; i < input_list.length; i++) {\n //loop through array of inputs in input_list defined at top of page.\n if (input_list[i].value.toString().trim() != \"\") {\n validated = true;\n }\n }\n return validated;\n}", "static isObjectPropertyAllHasEmptyValue(object) {\n if (lodash.isObject(object)) {\n for (var key in object) {\n if (\n object[key] !== \"\" &&\n !this.isEmptyArray(object[key]) &&\n !this.isEmpty(object[key])\n ) {\n return false;\n }\n }\n }\n\n return true;\n }", "function user_reminder_new_address() {\n //IF ALL FIELDS OF [NEW ADDRESS] ARE SET\n if ($('#new_street').val() != \"\" &&\n $('#new_zipcode').val() != \"\" &&\n $('#new_city').val() != \"\" &&\n $('#new_unit').val() != \"\" && \n $('#new_state').val() != \"\") {\n //IF NAME, PHONE OR EMAIL ARE NOT SET\n if ($('#first_name').val() == \"\" ||\n $('#last_name').val() == \"\" ||\n $('#telephone').val() == \"\" ||\n $('#email').val() == \"\") {\n //SHOW ALERT\n $('#alert-forgotten').removeClass('hide');\n };\n //true = new address\n check_all_inputs(true);\n }\n}", "allValid() {\n return (this.state.description.length > 0 &&\n this.state.title.length > 0 && this.state.time.length > 0)\n }", "function validateFields(foundErrors) {\n\t\tfor(const field in formData) {\n\t\t\tif(formData[field] === \"\") {\n\t\t\t\tfoundErrors.push({ message: `${field.split(\"_\").join(\" \")} cannot be left blank.`})\n\t\t\t}\n\t\t}\n\n\t\treturn foundErrors.length === 0;\n\t}", "function validateSubmitObj(){\n var flag = true;\n for(var key in infoSubmitObj){\n if(infoSubmitObj [key].length == 0){\n flag = false;\n }\n }\n return flag;\n }", "function validaDadosCampo(campo) {\r\n var validacao = true;\r\n for (let item of campo) {\r\n if ($(item).val() == '' || $(item).val() == null) {\r\n validacao = false;\r\n }\r\n }\r\n return validacao;\r\n}", "checkEmptyInput() {\n if (\n this.state.selected === \"\" ||\n this.state.date === \"\" ||\n this.state.date2 === \"\" ||\n this.state.timeStart === \"\" ||\n this.state.timeEnd === \"\"\n ) {\n alert(\"Error!Dont Leave Blank Fields!\");\n return false;\n }\n return true;\n }", "function isLoginEmpty(){\n\n if (logInPass.value == \"\" || logInEmail.value == \"\") {\n return false\n } else {\n return true\n }\n}", "isEmpty() {\n\t\treturn Object.keys(this.items).length == 0\n\t}", "function checkForBlankField(fname,lname,email,phone,address,uname,pass,confirmPass){\n\t\n\t// Nested if statements to check one by one\n\t// Returns whether is empty or not\n\t// Alert to inform user by highlighting borders and display an error message\n\tif(fname ==null || fname==\"\"){\n\t\t// Reset fields\n\t\tresetFields();\n\t\t// Highlights borders and displays error message\n\t\tdocument.getElementById(\"fnameError\").style.color = \"#F6482B\";\n\t\tdocument.getElementById(\"fname\").style.border = \"3px solid red\";\n\t\treturn false;\n\t}else if(lname == null || lname == \"\"){\n\t\tresetFields();\n\t\t\n\t\tdocument.getElementById(\"lnameError\").style.color = \"red\";\n\t\tdocument.getElementById(\"lname\").style.border = \"3px solid red\";\n\t\treturn false;\n\t}else if(email == null || email==\"\"){\n\t\tresetFields();\n\t\t\n\t\tdocument.getElementById(\"emailError\").style.color = \"red\";\n\t\tdocument.getElementById(\"email\").style.border = \"3px solid red\";\n\t\treturn false;\n\t}else if(phone == null || phone==\"\"){\n\t\tresetFields();\n\t\t\n\t\tdocument.getElementById(\"phoneError\").style.color = \"red\";\n\t\tdocument.getElementById(\"phone\").style.border = \"3px solid red\";\n\t\t\n\t\treturn false;\n\t}else if(address == null || address ==\"\"){\n\t\tresetFields();\n\t\t\n\t\tdocument.getElementById(\"addError\").style.color = \"red\";\n\t\tdocument.getElementById(\"address\").style.border = \"3px solid red\";\n\t\t\n\t\treturn false;\n\t}else if(uname == null || uname ==\"\"){\n\t\tresetFields();\n\t\t\n\t\tdocument.getElementById(\"usernameError\").style.color = \"red\";\n\t\tdocument.getElementById(\"uname\").style.border = \"3px solid red\";\n\t\treturn false;\n\t}else if(pass ==null || pass==\"\"){\n\t\tresetFields();\n\t\t\n\t\tdocument.getElementById(\"passError\").style.color = \"red\";\n\t\tdocument.getElementById(\"pword\").style.border = \"3px solid red\";\n\t\treturn false;\n\t}else if(confirmPass == null || confirmPass==\"\"){\n\t\tresetFields();\n\t\t\n\t\tdocument.getElementById(\"confirmPassError\").style.color = \"red\";\n\t\tdocument.getElementById(\"cpword\").style.border = \"3px solid red\";\n\t\treturn false;\n\t}else{\n\t\t\n\t\tresetFields();\n\t\t\n\t\treturn true;\n\t}\n\t\n\n\t\n}", "function checkEmpty(){\r\n var empty = false;\r\n var input = document.querySelectorAll('.text');\r\n input.forEach(inp => {\r\n if(inp.value = \"\")\r\n {\r\n empty = true;\r\n return empty;\r\n }\r\n })\r\n if(document.getElementById('tarea').value = \"\"){\r\n empty = true;\r\n return empty;\r\n }\r\n return empty;\r\n}", "function SP_AreAllRequiredFieldsFilled()\n{\n\n\tvar sFieldsList = SP_Trim(document.getElementById('requiredVariablesList').value);\n\tif (sFieldsList.length<=0)\n\treturn true;\n\t\n\tsFieldsList = new String(sFieldsList).split(\",\");\n\tvar nFilledCounter = 0;\n\tvar nFieldsListLength = 0;\n\n\tif(sFieldsList.length > 0)\n\tfor (i=0; i<sFieldsList.length; i++)\n\t{\n\t\t\n\t\n\t\t\tif(SP_Trim(sFieldsList[i]) != \"\")\n\t\t\t{\n\t\t\t\tnFieldsListLength++;\n\t\t\t\tvar oElement = document.getElementById(sFieldsList[i]);\n\t\t\t\tvar sElementType = SP_Trim(oElement.type);\n\t\t\t\t\n\t\t\t\tswitch (sElementType)\n\t\t\t\t{\n\t\t\t\t\tcase \"radio\":\n\t\t\t\t\tif (SP_GetRGValue(sFieldsList[i])!==\"\")\n\t\t\t\t\t\tnFilledCounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"checkbox\":\n\t\t\t\t\tif (oElement.checked)\n\t\t\t\t\t\tnFilledCounter++;\t\t\t\t\t\t\t\t\n\t\t\t\t\tbreak;\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\tif (SP_Trim(oElement.value)!=\"\")\n\t\t\t\t\t\tnFilledCounter++;\t\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"textarea\":\n\t\t\t\t\tif (SP_Trim(oElement.value)!=\"\")\n\t\t\t\t\t\tnFilledCounter++;\t\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"select-multiple\":\n\t\t\t\t\tif (oElement.selectedIndex>=0)\n\t\t\t\t\t\tnFilledCounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"select-one\":\n\t\t\t\t\tif (oElement.selectedIndex>0)\n\t\t\t\t\t\tnFilledCounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"hidden\":\n\t\t\t\t\tif (SP_Trim(oElement.value)!=\"\")\t\t\t\n\t\t\t\t\t\tnFilledCounter++;\t\t\t\t\t\t\n\t\t\t\t\tbreak;\t\t\t\t\t\t\t\t\t\n\t\n\t\t\t\t} // end case\n\t\t\t\t\n\t\t\t}\n\t\t\n\t}// end loop\n\treturn nFieldsListLength == nFilledCounter;\n\n}", "function isEmpty(obj) {\n return !obj || Object.keys(obj).length === 0;\n }", "function isNotEmpty() {\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tif (arguments[i].value === \"\" || arguments[i].value === null) {\n\t\t\t\t//if empty\n\t\t\t\terrors += 1;\n\t\t\t\targuments[i].placeholder = \"Fill in this feild!\";\n\t\t\t\targuments[i].classList.add(\"error-placeholder\");\n\t\t\t} else if (arguments[i].value.length < 3) {\n\t\t\t\t//if too short\n\t\t\t\terrors += 1;\n\t\t\t\targuments[i].placeholder = \"Enter a valid input!\";\n\t\t\t\targuments[i].value = \"\";\n\t\t\t\targuments[i].classList.add(\"error-placeholder\");\n\t\t\t}\n\t\t}\n\n\t}", "function validateWhitespace(){\n\t\tif($(\"#addUserDialog\").find(\"#txtUserName\").val().length!=$(\"#addUserDialog\").find(\"#txtUserName\").val().trim().length||\n\t\t\t\t$(\"#addUserDialog\").find(\"#txtPassword\").val().length!=$(\"#addUserDialog\").find(\"#txtPassword\").val().trim().length||\n\t\t\t\t$(\"#addUserDialog\").find(\"#txtFirstName\").val().length!=$(\"#addUserDialog\").find(\"#txtFirstName\").val().trim().length||\n\t\t\t\t$(\"#addUserDialog\").find(\"#txtLastName\").val().length!=$(\"#addUserDialog\").find(\"#txtLastName\").val().trim().length||\n\t\t\t\t$(\"#addUserDialog\").find(\"#txtEmail\").val().length!=$(\"#addUserDialog\").find(\"#txtEmail\").val().trim().length||\n//\t\t\t\t$(\"#addUserDialog\").find(\"#txtEmailPassword\").val().length!=$(\"#addUserDialog\").find(\"#txtEmailPassword\").val().trim().length||\n\t\t\t\t$(\"#addUserDialog\").find(\"#txtPhone\").val().length!=$(\"#addUserDialog\").find(\"#txtPhone\").val().trim().length)\n\t\t\treturn false;\n\t\treturn true;\n\t}", "is_empty()\n\t{\n\t\tconst { value } = this.props\n\t\treturn !value || !value.trim()\n\t}", "function validateBlanks(){\r\n\tvar inputElements = document.getElementsByTagName(\"input\");\r\n\tvar elementCount = inputElements.length;\r\n\tvar currentElement;\r\n\t\r\n\tfor (var i = 0; i < elementCount; i++)\r\n\t{\r\n\t\t//Validate ALL input elements in the form\r\n\t\tcurrentElement = inputElements[i];\r\n\t\tif (currentElement.value === \"\")\r\n\t\t{\r\n\t\t\tformValidity = false;\r\n\t\t\tcurrentElement.style.background = \"rgb(255,233,233)\";\r\n\t\t}\r\n\t\telse {\r\n\t\t\tcurrentElement.style.background = \"white\";\r\n\t\t}\r\n\t}\r\n\tif (formValidity === false)\r\n\t{\r\n\t\terrorText += \"All fields must be filled out! </br>\"\r\n\t}\r\n}", "function checkEmptyAll(id_d,message)\r\n{\r\n\tvar data_d = getValue(id_d);\r\n\t\r\n\tif(data_d=='')\r\n\t{\r\n\t\ttakeCareOfMsg(message);\r\n\t\treturn false;\r\n\t}\r\n\telse\r\n\t{\r\n\t\treturn true;\r\n\t}\r\n}", "function isEmpty() {\n return this.toString().length === 0;\n }", "is_empty(value) {\n return (\n (value == undefined) ||\n (value == null) ||\n (value.hasOwnProperty('length') && value.length === 0) ||\n (value.constructor === Object && Object.keys(value).length === 0)\n )\n }", "function isEmpty(obj) {\n return Object.keys(obj).length === 0;\n}" ]
[ "0.7424617", "0.7100695", "0.6996133", "0.6884646", "0.6821586", "0.6818323", "0.6804034", "0.679246", "0.6787676", "0.6777605", "0.67608184", "0.67560697", "0.6727968", "0.6720983", "0.6710236", "0.6706763", "0.66526717", "0.6649611", "0.6576145", "0.656723", "0.65627354", "0.6549778", "0.6543282", "0.6521336", "0.6511043", "0.6506315", "0.6476247", "0.6467461", "0.64565885", "0.6456577", "0.64176965", "0.6405424", "0.6390213", "0.63688815", "0.63627785", "0.63587946", "0.6348408", "0.6314886", "0.63011515", "0.6261944", "0.62500143", "0.62257653", "0.6210965", "0.6208628", "0.6200252", "0.61922824", "0.6191005", "0.6181616", "0.6178966", "0.61774796", "0.6167978", "0.6157678", "0.6150275", "0.61434287", "0.6141816", "0.6118527", "0.61176187", "0.61155283", "0.6092157", "0.60918504", "0.6077507", "0.6075109", "0.60732645", "0.6069209", "0.6067656", "0.60651493", "0.60615015", "0.6031183", "0.6029905", "0.60255307", "0.60250443", "0.6019526", "0.6008042", "0.5979646", "0.5964931", "0.5964931", "0.59542304", "0.59538305", "0.59498435", "0.5939734", "0.5937505", "0.59362966", "0.5920523", "0.59088874", "0.59067553", "0.58975166", "0.5893837", "0.58922803", "0.58836496", "0.5874618", "0.587155", "0.5866844", "0.5861835", "0.5856434", "0.58554626", "0.5852917", "0.5849775", "0.58447725", "0.58312356", "0.58181703" ]
0.8189654
0
Check the return of the ajax calls to make sure everything got entered correctly
function validateResult(result, numFiles) { console.log(result); // Should have 3 rows: request id, lines written in database, and files saved var results = result.split("\n"); if (results.length != 3) { $("#cpBody").hide(); $("#cpError").show().append(document.createTextNode("submitCP - " + result)); return; } var reqId = results[0].split(":")[1]; //var requestdID = reqId.split("_")[0]; // Chris added 20150924 // Jonathan changed back 20151221 if (reqId == "0" || results[1].charAt(0) != "1" || results[2].charAt(0) != numFiles) { $("#cpBody").hide(); $("#cpError").show().append(document.createTextNode("submitCP - Request processed incorrectly")); return; } var alertMsg = "<div class=\"alert alert-success\" role=\"alert\" id=\"alertSuccess\">"; alertMsg += "<a href=\"#\" class=\"close\" data-dismiss=\"alert\" aria-label=\"close\">&times;</a>"; alertMsg += "Request Submitted Successfully! Your Request ID is: <b>" + reqId + "</b></div>"; // Chris commented out 20150924 // Jonathan changed back 20151221 //alertMsg += "Request Submitted Successfully! Your Request ID is: <b>" + requestdID + "</b></div>"; // Chris added to fix this Success Message: "Request Submitted Successfully! Your Request ID is: 9696_New Account Info.txtRequest ID" to only show 9696 // Jonathan changed back 20151221 var alert = $(alertMsg); alert.prependTo("#cp"); $("#alertSuccess").alert(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleOnValidationDone(ajax) {\r\n if (ajax.readyState == 4) {\r\n if (ajax.status == 200) {\r\n var data = ajax.responseXML;\r\n // do nothing if we don't have initial values or we got error\r\n if (!handleAjaxMessages(data, null)) {\r\n return;\r\n }\r\n }\r\n }\r\n}", "function checkAndCallAjaxSubmit() {\n\tvar indentId = 0;\n\tvar departmentId = 0;\n\tvar itemId = 0;\n\tvar errorMessage = \"\";\n\n\tif (document.getElementById('indentId').value == 0)\n\t\terrorMessage = errorMessage + \"Please Select Indent No \\n\";\n\tif (document.getElementById('departmentId').value == 0)\n\t\terrorMessage = errorMessage + \"Please Select Department \\n\";\n\tif (document.getElementById('itemId').value == \"\")\n\t\terrorMessage = errorMessage + \"Please Select Item \\n\";\n\n\tdepartmentId = document.getElementById('departmentId').value;\n\tindentId = document.getElementById('indentId').value;\n\titemId = document.getElementById('itemId').value;\n\tif ((indentId != 0) && (departmentId != 0) && (itemId != 0)) {\n\t\tsubmitProtoAjax('indentSocTracker',\n\t\t\t\t'/hms/hms/stores?method=getIndentSocTrackerDetails&departmentId='\n\t\t\t\t\t\t+ departmentId + '&indentId=' + indentId + '&itemId='\n\t\t\t\t\t\t+ itemId);\n\t} else {\n\t\talert(errorMessage);\n\t\treturn false\n\t}\n\tif (errorMessage != \"\") {\n\t\talert(errorMessage);\n\t\treturn false\n\t}\n}", "function checkCompanyName() {\n var status;\n var companyName = $(\"#companyName\").val();\n $.ajax({\n url: 'checkCompanyName.htm',\n async: false,\n data: ({\n companyName: companyName\n\n }),\n success: function(result) {\n\n if (result == 'yes') {\n status = result;\n } else if (result == 'exception') {\n status = result;\n }\n }\n });\n return status;\n}", "function preCheck(){\n //Check format and send ajax if valid\n val = get_box_content()\n if(val != lastSearch){\n if (val.match(formatRegex) && val.match(lengthRegex)){\n //Run check\n sendRequest(val)\n }else{\n // submitButton.prop( \"disabled\", true );\n // resultsBox.empty()\n }\n }\n }", "function submitAjax() {\n\tif (flagUsername && flagPassword && flagEmail) {\n\t\tconsole.log(\"flagUsername: \" + flagUsername);\n\t\tconsole.log(\"flagPassword: \" + flagPassword);\n\t\tconsole.log(\"flagEmail: \" + flagEmail);\n\t\tcallAjax(\"test.php\");\n\t\tconsole.log(\"DONE!\");\n\t} else {\n\t\tcheckUsername();\n\t\tcheckPassword();\n\t\tcheckEmail();\n\t}\n}", "function OnSuccessCallMaladie(data, status, jqXHR) {\n\t\t\treturn true;\n\t\t}", "function checkCompanyPhoneExist(checkType,companyId) {\n var status;\n var phone = $(\"#contactNumber\").val();\n //var companyId = $(\"#companyId\").val();\n $.ajax({\n url: 'checkCompanyPhone.htm',\n async: false,\n data: ({\n phone: phone,\n type: checkType,\n companyId: companyId\n }),\n success: function(result) {\n\n if (result == 'yes') {\n status = result;\n } else if (result == 'exception') {\n status = result;\n }\n // $(\"#msg\").html(result);\n }\n\n });\n \n return status;\n}", "function getAjaxRetrieveEDIT() {\r\n\t$.ajax({\r\n\t\turl: 'processEdit.php',\r\n\t\ttype: 'POST',\r\n\t\tdata: '',\r\n\t\tsuccess: function(response) {\r\n\r\n\t\t\tif (response === 'index.php?failure=noIDFound') {\r\n\t\t\t\twindow.location.href = 'index.php?failure=noIDFound';\r\n\t\t\t} else {\r\n\t\t\t\tresponse = JSON.parse(response);\r\n\t\t\t\tconsole.log(response);\r\n\r\n\t\t\t\t$('#deleteBtn').val(response[0].id);\r\n\t\t\t\t$('#updateCms').val(response[0].id);\r\n\t\t\t\t$('#evenement').val(response[0].evenement);\r\n\t\t\t\t$('#datum_begin').val(response[0].datum_begin);\r\n\t\t\t\t$('#datum_eind').val(response[0].datum_eind);\r\n\t\t\t\t$('#Prijs').val(response[0].prijs);\r\n\t\t\t\t$('#max_deelname').val(response[0].max_deelnemers);\r\n\t\t\t\t$('#table_name').val(response[0].table_name);\r\n\r\n\t\t\t\tif (response[0].text_extra !== 'd-none') {\r\n\t\t\t\t\t$('#check1').click();\r\n\t\t\t\t\t$('#text_extra').val(response[0].text_extra);\r\n\t\t\t\t} \r\n\r\n\t\t\t\tif (response[0].text_vervoer !== 'd-none') {\r\n\t\t\t\t\t$('#check2').click();\r\n\t\t\t\t\t$('#text_vervoer').val(response[0].text_vervoer);\r\n\t\t\t\t\tgetVervoer(response[0].id);\r\n\t\t\t\t} \r\n\r\n\t\t\t\tif (response[0].vegetarisch !== 'd-none') {\r\n\t\t\t\t\t$('#check3').click();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (response[0].text_editie !== 'd-none') {\r\n\t\t\t\t\t$('#check4').click();\r\n\t\t\t\t\t$('#text_editie').val(response[0].text_editie);\r\n\t\t\t\t\tgetTextEditie(response[0].id);\r\n\t\t\t\t} \r\n\r\n\t\t\t\tif (response[0].text_accomodatie !== 'd-none') {\r\n\t\t\t\t\t$('#check5').click();\r\n\t\t\t\t\t$('#text_accomodatie').val(response[0].text_accomodatie);\r\n\t\t\t\t\tgetAccomodatie(response[0].id);\r\n\t\t\t\t} \r\n\r\n\t\t\t\tif (response[0].annuleringsverzekering !== 'd-none') {\r\n\t\t\t\t\t$('#check6').click();\r\n\t\t\t\t} \r\n\r\n\t\t\t\tif (response[0].text_verhuur !== 'd-none') {\r\n\t\t\t\t\t$('#check7').click();\r\n\t\t\t\t\t$('#text_verhuur').val(response[0].text_verhuur);\r\n\t\t\t\t\tgetVerhuur(response[0].id);\r\n\t\t\t\t} \r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}", "function check_site(val) {\n if ($('#checkName').val() == '' || $('#checkName').val() != val) {\n if (val != '' && val.length <= 25) {\n $(this).ajaxStart(function () {\n $('#busy-indicator').show();\n $('#unavailable').hide();\n $('#available').hide();\n });\n\n $(\"#loading\").ajaxStop(function () {\n $('#busy-indicator').hide();\n });\n\n $('#checkResponse').val($.ajax({\n url:'/sites/check_site_name',\n type:'post',\n async:false,\n data:{data:{site:val}},\n success:function (responce) {\n if (responce != 1) {\n $('#available').show();\n $('#unavailable').hide();\n } else {\n $('#available').hide();\n $('#unavailable').show();\n }\n $('#busy-indicator').hide();\n }\n }).responseText);\n } else {\n $('#busy-indicator').hide();\n $('#checkResponse').val(1);\n }\n } else {\n $('#available').show();\n $('#checkResponse').val('');\n }\n}", "ajaxSaveAllNumbersChanged() {\n let $ = jQuery.noConflict();\n let thisClass = this;\n\n if (this.xhrIsWorking === true) {\n alert(RdPostOrderObj.txtPreviousXhrWorking);\n return false;\n }\n\n let confirmed_val = confirm(RdPostOrderObj.txtConfirm);\n\n if (confirmed_val === true) {\n thisClass.xhrIsWorking = true;\n thisClass.disablePostSortable();\n $('.form-result-placeholder').html('');\n\n let formData = $('.menu_order_value').serialize();\n let additionalFormData = {\n 'action': 'RdPostOrderSaveAllNumbersChanged',\n 'security': RdPostOrderObj.ajaxnonce,\n '_wp_http_referer': $('input[name=\"_wp_http_referer\"]').val(),\n 'paged': ($.query.get('paged') ? $.query.get('paged') : 1),\n 'hookName': RdPostOrderObj.hookName,\n }\n formData += '&' + $.param(additionalFormData);\n\n $.ajax({\n url: ajaxurl,\n type: 'POST',\n data: formData,\n dataType: 'json'\n })\n .done((response, textStatus, jqXHR) => {\n // displaying result to the page.\n thisClass.displayNoticeElement(response, response, 'notice-error');\n\n if (typeof(response) !== 'undefined') {\n thisClass._ajaxReplaceTable(response);\n }\n })\n .fail((jqXHR, textStatus, errorThrown) => {\n let errResponse = jqXHR.responseJSON;\n let errResponseText = jqXHR.responseText;\n\n thisClass.displayNoticeElement(errResponse, errResponseText, 'notice-error');\n })\n .always((jqXHR, textStatus, errorThrown) => {\n let response;\n if (textStatus === 'success') {\n response = jqXHR;\n } else {\n response = jqXHR.responseJSON;\n }\n // mark XHR is not working.\n thisClass.xhrIsWorking = false;\n // re-activate sortable\n thisClass.enablePostSortable();\n });\n }// endif; confirmed\n\n return false;\n }", "function validatePublisherName() {\n var publisherName = $('#publisherName')[0].value;\n var alertSection = $('#publisherAlertSection');\n var siteURL = $('#siteURL')[0].value;\n\n $.ajax({\n url: siteURL + \"/administrator/validatePublisherName\",\n type: \"POST\",\n data: {publisherName: publisherName},\n success: function (data) {\n var flag = $.parseJSON(data);\n if (!flag) {\n alertSection.html('<div class=\"alert alert-danger\">Publisher Name already exists in database.</div>');\n $('#addPublisherBtn').prop('disabled', true);\n return false;\n } else {\n alertSection.html('<div id=\"addBookAlertSection\"></div>');\n $('#addPublisherBtn').prop('disabled', false);\n return true;\n }\n },\n error: function (XHR, status, response) {\n console.log(XHR.response);\n console.log(status);\n console.log(response);\n alertSection.html('<div class=\"alert alert-danger\">Error occurred when validating the Publisher Name' +\n ' field.</div>');\n return false;\n }\n });\n}", "function validateAndInsertUsingAjax(action, message) {\r\n\r\n\t/* Disable button to prevent redundant ajax request */\r\n\t$(\"#btnCargo\").prop('disabled', true);\r\n\r\n\t/* get the text field form values */\r\n\tvar id = $('#cargo_id').val();\r\n\tvar name = $('#cargo_driver').val();\r\n\tvar vehicle = $('#cargo_vehicletype').val();\r\n\tvar plate_no = $('#truck_plate_number').val();\r\n\tvar company = $('#cargo_company').val();\r\n\r\n\t$.ajax({\r\n\r\n\t\ttype : \"GET\",\r\n\t\turl : myContext + '/' + action,\r\n\t\tdata : \"cargo_id=\" + id + \"&cargo_driver=\" + name\r\n\t\t\t\t+ \"&cargo_vehicletype=\" + vehicle + \"&truck_plate_number=\"\r\n\t\t\t\t+ plate_no + \"&cargo_company=\" + company,\r\n\t\tcontentType : \"application/json; charset=utf-8\",\r\n\t\tdatatype : \"json\",\r\n\t\tcrossDomain : \"TRUE\",\r\n\t\tsuccess : function(response) {\r\n\t\t\tvar stringResponse = JSON.stringify(response)\r\n\t\t\t// we have the response\r\n\r\n\t\t\tvar obj = JSON.parse(stringResponse);\r\n\r\n\t\t\tif (obj.status == \"SUCCESS\") {\r\n\t\t\t\t/*\r\n\t\t\t\t * Enable button to make ajax request again after response\r\n\t\t\t\t * return\r\n\t\t\t\t */\r\n\t\t\t\t$(\"#btnCargo\").prop('disabled', false);\r\n\r\n\t\t\t\tvar userInfo = \"<ol>\";\r\n\r\n\t\t\t\tfor (i = 0; i < obj.result.length; i++) {\r\n\r\n\t\t\t\t\t/* Create html elements */\r\n\r\n\t\t\t\t\tuserInfo += \"<br><li><b>Name</b> : \"\r\n\t\t\t\t\t\t\t+ obj.result[i].cargo_driver;\r\n\r\n\t\t\t\t\tuserInfo += \"<br><li><b>Vehicle</b> : \"\r\n\t\t\t\t\t\t\t+ obj.result[i].cargo_vehicletype;\r\n\r\n\t\t\t\t\tuserInfo += \"<br><li><b>Plate number</b> : \"\r\n\t\t\t\t\t\t\t+ obj.result[i].truck_plate_number;\r\n\r\n\t\t\t\t\tuserInfo += \"<br><li><b>Company</b> : \"\r\n\t\t\t\t\t\t\t+ obj.result[i].cargo_company;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tuserInfo += \"</ol>\";\r\n\r\n\t\t\t\t/* Draw message in #info div */\r\n\t\t\t\t$('#info').html(message + userInfo);\r\n\r\n\t\t\t\t/* Show and hide div */\r\n\t\t\t\t$('#error').hide('slow');\r\n\t\t\t\t$('#info').show('slow');\r\n\r\n\t\t\t\t/* Populate DataTable */\r\n\t\t\t\tpopulateCargoDataTable();\r\n\r\n\t\t\t\t/* Hide modal */\r\n\t\t\t\t$('#modalAddCargoUser').modal('hide');\r\n\r\n\t\t\t} else {\r\n\t\t\t\t/*\r\n\t\t\t\t * Enable button to make ajax request again after response\r\n\t\t\t\t * return\r\n\t\t\t\t */\r\n\t\t\t\t$(\"#btnCargo\").prop('disabled', false);\r\n\r\n\t\t\t\tvar errorInfo = \"\";\r\n\r\n\t\t\t\tfor (i = 0; i < response.result.length; i++) {\r\n\r\n\t\t\t\t\terrorInfo += \"<br>\" + (i + 1) + \". \"\r\n\t\t\t\t\t\t\t+ response.result[i].code;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t/* Show error message from response */\r\n\t\t\t\t$('#error').html(\r\n\t\t\t\t\t\t\"Please correct following errors: \" + errorInfo);\r\n\r\n\t\t\t\t/* Show and hide div */\r\n\t\t\t\t$('#info').hide('slow');\r\n\t\t\t\t$('#error').show('slow');\r\n\r\n\t\t\t}\r\n\r\n\t\t},\r\n\r\n\t\t/* xhr.status shows server respond */\r\n\t\terror : function(xhr, desc, err) {\r\n\t\t\t/*\r\n\t\t\t * Enable button to make ajax request again after response return\r\n\t\t\t */\r\n\r\n\t\t\t$(\"#btnCargo\").prop('disabled', false);\r\n\t\t\tif (xhr.status == 500) {\r\n\t\t\t\talert('Error: ' + \"Server not respond \");\r\n\t\t\t}\r\n\t\t\tif (xhr.status == 403) {\r\n\t\t\t\talert('Error: ' + \"Access Denied\");\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t});\r\n\r\n}", "function alertContents() {\n try {\n if (httpRequest.readyState === 4) {\n if (httpRequest.status === 200) {\n //show the ajax box with the html from step 3 in it. Trigger create is used to apply the jqmobile styles to the returned html\n \t$(\".ajaxContent\").show().html(httpRequest.responseText).fadeIn(\"fast\").trigger(\"create\") ;\n \t$(\"#continue\").show();\n\n } else {\n alert('There was a problem with the request.');\n }\n }\n }\n catch( e ) {\n alert('Caught Exception: ' + e.description);\n }\n}", "function handleAjaxRequest(data, cbDone, cbFail) {\n $.post(SnthObj.ajaxurl, data, '' ,'json')\n .done(function(response) {\n if(response.type == 'success') {\n cbDone(response);\n } else {\n console.log(response.type);\n console.log(response.id);\n }\n })\n .fail(function() {cbFail()})\n }", "function executing_success(){\n\t\t\t\t\t\t\tvar ret = null;\n\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\tif App.HTTP['METHOD'] is called with the 'success' field settled, the next conditional is executed\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\tif (typeof function_success != \"undefined\") {\n\t\t\t\t\t\t\t\tif (typeof function_success != \"object\") {\n\t\t\t\t\t\t\t\t\tret = {\n\t\t\t\t\t\t\t\t\t\tdata: data\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\tfunction_success(ret, textStatus, jqXHR);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tret = Array();\n\n\t\t\t\t\t\t\t\t\tfor (i in function_success) {\n\t\t\t\t\t\t\t\t\t\tret.push({\n\t\t\t\t\t\t\t\t\t\t\tdata: data\n\t\t\t\t\t\t\t\t\t\t}, textStatus, jqXHR);\n\t\t\t\t\t\t\t\t\t\tfunction_success[i]({\n\t\t\t\t\t\t\t\t\t\t\tdata: data\n\t\t\t\t\t\t\t\t\t\t}, textStatus, jqXHR);\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\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\ta lateral message ('alertify' plugin) is shown if the 'log_ui_msg' is active (settled as 'true')\n\n\t\t\t\t\t\t\t\ta default message is shown if the response of the server doesn't have the field 'message'\n\n\t\t\t\t\t\t\t\tthe default message depends of the type of operation (CREATE, READ, UPDATE, DELETE, POST, PUT)\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\tvar semantic_ref = {\n\t\t\t\t\t\t\t\t\t\"CREATE\" : \"success\",\n\t\t\t\t\t\t\t\t\t\"READ\" : \"warning\",\n\t\t\t\t\t\t\t\t\t\"UPDATE\" : \"success\",\n\t\t\t\t\t\t\t\t\t\"DELETE\" : \"error\",\n\t\t\t\t\t\t\t\t\t\"POST\" : \"message\",\n\t\t\t\t\t\t\t\t\t\"GET\" : \"message\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tsemantic_default_message = {\n\t\t\t\t\t\t\t\t\t\"CREATE\" : \tApp.__GENERAL__.http_message_default_create,\n\t\t\t\t\t\t\t\t\t\"READ\" : \tApp.__GENERAL__.http_message_default_read,\n\t\t\t\t\t\t\t\t\t\"UPDATE\" : \tApp.__GENERAL__.http_message_default_update,\n\t\t\t\t\t\t\t\t\t\"DELETE\" : \tApp.__GENERAL__.http_message_default_delete,\n\t\t\t\t\t\t\t\t\t\"POST\" : \tApp.__GENERAL__.http_message_default_post,\n\t\t\t\t\t\t\t\t\t\"GET\" : \tApp.__GENERAL__.http_message_default_get,\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif(settings.log_ui_msg){\n\t\t\t\t\t\t\t\tif(!jqXHR.responseJSON){\n\t\t\t\t\t\t\t\t\tjqXHR.responseJSON ={}\n\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\tif(!jqXHR.responseJSON.message){\n\t\t\t\t\t\t\t\t\tjqXHR.responseJSON.message = semantic_default_message[semantic.toUpperCase()];\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\talertify[semantic_ref[semantic.toUpperCase()]](jqXHR.responseJSON.message);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tApp.__debug__(ret);\n\n\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t}", "function getRequest() {\n $.ajax({\n type: \"post\",\n url: \"http://onlineeducationservice.com/masterpanel/manage_api/get_randome_fake_student\",\n dataType: \"html\",\n success: function (response) {\n if (response != \"0\") {\n mypop(response);\n }\n else {\n return;\n }\n }\n });\n}", "function verifySubmit(){\n var nameEntered = $(\"[name='editName']\").val();\n var analysisId = $(\"[name='editId']\").val();\n\n $.ajax({\n url: $SCRIPT_ROOT + '/check_analysis_exists',\n data: { nameEntered:nameEntered, analysisId:analysisId },\n type: 'GET',\n success: function(data){\n if (data.exists){\n alert(\"An analysis by the same name already exists.\\n\" +\n \"Please choose a different name.\");\n return false;\n }\n\n if(confirm(\"ATTENTION: This will save the entered information to the\\n\" +\n \"database, potentially overwriting previous settings.\\n\" +\n \"Are you sure you want to continue?\")){\n submitAnalysis();\n\n } else{\n return false;\n }\n },\n error: function(error){\n\n }\n });\n }", "function checkError(ajax) {\n\t\tif (ajax.status != \"200\") {\n\t\t\tif (ajax.status != \"410\") {\n\t\t\t\tdocument.getElementById(\"errors\").innerHTML = \"Error Message: \" + ajax.statusText;\n\t\t\t}\n\t\t\tvar loadingGifs = document.getElementsByClassName(\"loading\");\n\t\t\tfor (var i = 0; i < loadingGifs.length; i++) {\n\t\t\t\tloadingGifs[i].style.display = \"none\";\n\t\t\t}\n\t\t\tif (ajax.status == \"410\") {\n\t\t\t\tdocument.getElementById(\"nodata\").style.display = \"block\";\n\t\t\t}\n\t\t\tdocument.getElementById(\"currentTemp\").style.display = \"none\";\n\t\t\tdocument.getElementById(\"slider\").style.display = \"none\";\n\t\t\tdocument.getElementById(\"buttons\").style.display = \"none\";\n\t\t} else {\n\t\t\tdocument.getElementById(\"nodata\").style.display = \"none\";\n\t\t\tdocument.getElementById(\"currentTemp\").style.display = \"block\";\n\t\t\tdocument.getElementById(\"slider\").style.display = \"block\";\n\t\t\tdocument.getElementById(\"buttons\").style.display = \"block\";\n\t\t}\n\t}", "function handleResponse(ajax) {\n\n // Check that the transaction is complete:\n if (ajax.readyState == 4) {\n \n // Check for a valid HTTP status code:\n if ((ajax.status == 200) || (ajax.status == 304) ) {\n \n // Put the received response in the DOM:\n\t document.getElementById('pleasewaitScreen').style.visibility=\"hidden\";\n var results = document.getElementById('suggestedkeywords');\n results.innerHTML = ajax.responseText;\n \n } else { // Bad status code, submit the form.\n //document.getElementById('dept_form').submit();\n }\n \n } // End of readyState IF.\n \n} // End of handleResponse() function.", "function doAjaxWithReturn(url, requestType, updateMethod){\n\ttry{\n\t\t\n\t\t$.ajax({\n\t\t\turl : G_URL_Rest + url,\n\t\t\ttype : requestType,\n\t\t\tdataType: \"json\",\n\t\t\tasync: false,\n\t\t\tcache: false,\n\t\t\tbeforeSend: function(request){\n\t\t\t\trequest.setRequestHeader(\"authorization\", G_Session);\n\t\t\t\tshowInProgress();\n\t\t\t\tconsole.log(\"doAjaxWithReturn \"+ url + \" request initiated\");\n\t\t\t // Handle the beforeSend event\n\t\t\t\t// Show Loading and parameters preparation\n\t\t\t\tif($('#divLoading').length > 0)\n\t\t\t\t\t$('#divLoading').addClass(\"show\");\n\t\t\t\t$('#successDiv').hide();\n\t\t\t\t$('#errorDiv').hide();\n\t\t\t\t\n\t\t\t},\n\t\t\tsuccess : updateMethod,\n\t\t\tcomplete: function(data, textStatus, request){\n\t\t\t\thideInProgress();\n\t\t\t\tif($('#divLoading').length > 0)\n\t\t\t\t\t$('#divLoading').removeClass(\"show\");\n\t\t\t\tconsole.log(\"doAjaxWithReturn \"+url +\" request complete\");\n\t\t\t // Handle the complete event\n\t\t\t\t// Hide Loading\n\t\t\t\t\n\t\t\t},\n\t\t\terror: function(data){\n\t\t\t\t//$('#errorMsg').html('Unable to perform User Action, Contact After some time or support');\n\t\t\t\t//$('#errorDiv').show();\n\t\t\t\t$('#msgContainer').html(\"<div class='alert alert-error' id='errorDiv' style='margin-top:10px;margin-bottom:10px'><a class='close' data-dismiss='alert'>x</a><div id='errorMsg'>Internal Server problem Happened,please try again after refresh, If problem exists contact support</div></div>\");\n\t\t\t}\n\t\t});\t\n\t} catch(error){\n\t\tconsole.log(\"doAjaxWithReturn \"+error);\n\t}\n}", "function testAjax() {\r\n $.ajax({\r\n url: serverURL + \"test\",\r\n type: 'GET',\r\n success: function (res) {\r\n console.log(\"Payment finished\");\r\n console.log(\"Server says\", res);\r\n\r\n console.log(\"Done thank you for the payment\");\r\n },\r\n\r\n error: function (err) {\r\n console.log(\"Payment error\");\r\n console.log(\"Error occured\", err);\r\n\r\n console.log(\"Done thank you for the payment\");\r\n }\r\n\r\n });\r\n //never run the code here until the success and error have completed\r\n //console.log(\"Done thank you for the payment\");\r\n //console.log(\"NOT FINISHED YET\");\r\n}", "function getReturnRecord(){\n console.log('searchreturn');\n\n\n var keywords=$('#search-input').val();\n // var selected1=$('#jobNo').val();\n // var selected2=$('#itemCode').val();\n if($('#jobNo').is(':checked')) {\n var selected=\"jobNo\";\n\n }else{\n var selected=\"itemCode\";\n }\n\n if(keywords.length>0){\n $.ajax({\n method:'POST',\n url:url,\n data:{keyWords:keywords,_token:token,searchType:selected}\n //error :function( jqXhr ) {\n // if( jqXhr.status === 401 ) //redirect if not authenticated user.\n // $( location ).prop( 'pathname', 'auth/login' );\n // if( jqXhr.status === 422 ) {\n // //process validation errors here.\n // var errors = jqXhr.responseJSON; //this will get the errors response data.\n // //show them somewhere in the markup\n // //e.g\n // errorsHtml = '<div class=\"alert alert-danger\"><ul>';\n //\n // $.each( errors , function( key, value ) {\n // errorsHtml += '<li>' + value[0] + '</li>'; //showing only the first error.\n // });\n // errorsHtml += '</ul></di>';\n //\n // $( '#form-errors' ).html( errorsHtml ); //appending to a <div id=\"form-errors\"></div> inside form\n // } else {\n // /// do some thing else\n // }\n //}\n }).done(function(markup){\n\n $('#search_results').html(markup);\n $('#search_results').show();\n // console.log(msg);\n\n })\n }\n else{\n console.log(\"CLEAR\");\n $('#search_results').hide();\n $('#search-results').hide();\n }\n\n}", "function check(url) {\n // empty array\n array2 = [];\n $.ajax({\n url: url,\n type: \"GET\",\n success: processData,\n error: errorFunction\n });\n}", "function ajaxFailed(ajax) {\n\t$('errors').textContent = $(\"name\").value + \" is taken \";\n $(\"reg\").disabled = true;\n}", "function check(a,b,c){\n let shouldRetry = b !== 'success' && b !== 'parsererror';\n if( shouldRetry && -- this.retries > 0 )\n setTimeout(() => { $.ajax(this) }, this.retryInterval || 100);\n }", "function ajaxSendProductList( url )\n{\n $('.ajaxLoading').show();\n\n $.post( url,function( data ) {\n\n\n if(data.status =='success')\n {\n console.log(\"called succes\");\n notyMessage(data.message);\n } else {\n console.log(\"called error\");\n notyMessageError(data.message);\n }\n $('.ajaxLoading').hide();\n });\n\n\n}", "function UsernameSecurityCheckAjaxMethod() {\n var user = $(\"#usernameCheck\").val();\n var security = $('#Securty').val();\n var answer = $('#AnswerCheck').val();\n $.ajax({\n type: \"POST\",\n url: \"Login.aspx/UsernameAndPasswordTwoCheckForgotPageMethod\",\n data: \"{userCheck: '\" + user + \"', security: '\" + security + \"', answer: '\" + answer + \"'}\",\n dataType: \"json\",\n contentType: \"application/json; charset=utf-8\",\n success: function () {\n $('.SecurityCheck').fadeOut(function () {\n $('.AllisGood').fadeIn(700);\n });\n },\n error: function () {\n if (security == \"Choose Security Question\") {\n $('#SecurityError').text(\"Please select Security Question.\");\n $('#SecurityError').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' });\n $('#SecurityError').addClass('animated shake');\n return false;\n }\n else if (answer == \"\") {\n $('#SecurityError').text(\"Please give Answer.\");\n $('#SecurityError').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' });\n $('#SecurityError').addClass('animated shake');\n return false;\n }\n else\n $('#SecurityError').text(\"It is not Correct.\");\n }\n });\n}", "function checkCompanyEmailExist(type, companyId) {\n var status;\n var email = $(\"#email\").val();\n $.ajax({\n url: 'checkCompanyEmail.htm',\n async: false,\n data: ({\n email: email,\n type: type,\n companyId: companyId\n\n }),\n success: function(result) {\n\n if (result == 'yes') {\n status = result;\n } else if (result == 'exception') {\n status = result;\n }\n }\n\n });\n return status;\n}", "function ajaxCompleted(ajax) {\n\tvar resp = JSON.parse(ajax.responseText);\n\tconsole.log(ajax.responseText);\n\tconsole.log(resp);\n\tvar stat = \"\";\n \n\tif (resp.status=='failed'){\n $(\"reg\").disabled = false;\n $(\"name\").style.backgroundColor = \"#98FB98\";\n\n }\n else{\n $(\"reg\").disabled=true;\n $('errors').textContent = $(\"name\").value + \" is taken \";\n $(\"name\").style.backgroundColor = \"#ff6666\";\n }\n}", "function carriageFaults() {\n\n var carriageNo = $('#carNum').val();\n var json = JSON.stringify(carriageNo);\n var output = {};\n $.ajax({\n url: host + \"/get_carriage_faults\",\n type: \"POST\",\n data: json,\n success: function (rt) {\n output = JSON.parse(rt);\n console.log(output.length);\n if (output.length > 0){\n // if faults exists open popup\n localStorage.setItem('carriageFaults', rt);\n openPopup('rf-1a');\n } else {\n getCarriageDetails();\n }\n \n },\n error: function () {\n console.log(\"error\");\n alert(\"there has been an error contacting the server\");\n }\n });\n}", "function ajax_complete( request, code ) {\n if( 400 == request.status ) {\n // application is reporting an error, details are in responseText\n var response = jQuery.parseJSON( request.responseText );\n var error_code =\n code + '.' +\n ( undefined == response.error_type ? 'X' : response.error_type.substr( 0, 1 ) ) + '.' +\n ( undefined == response.error_code ? 'X' : response.error_code );\n\n if( 'Permission' == response.error_type ) {\n error_dialog(\n 'Access Denied',\n '<p>You do not have permission to perform the selected operation.</p>' +\n '<p class=\"error_code\">Error code: ' + error_code + '</p>' );\n }\n else if( 'Notice' == response.error_type ) {\n error_dialog(\n 'Notice',\n '<p>' + response.error_message + '</p>' +\n '<p class=\"error_code\">Error code: ' + error_code + '</p>' );\n }\n else { // any other error...\n error_dialog(\n response.error_type + ' Error',\n '<p>' +\n ' The server was unable to complete your request.<br>' +\n ' Please notify a supervisor with the error code.' +\n '</p>' +\n '<p class=\"error_code\">Error code: ' + error_code + '</p>' );\n }\n }\n else if( 200 != request.status ) {\n // the web server has sent an error\n error_dialog(\n 'Networking Error',\n '<p>' +\n ' There was an error while trying to communicate with the server.<br>' +\n ' Please notify a supervisor with the error code.' +\n '</p>' +\n '<p class=\"error_code\">Error code: ' + code + '.200</p>' );\n }\n}", "function isRetentionCodeExists() {\n var isCodeExists = false;\n $.ajax({\n url: urls.Retention.CheckRetentionCodeExists,\n dataType: \"json\",\n type: \"POST\",\n data: JSON.stringify({ pRetentionCode: $(\"#txtRetentionCode\").val() }),\n contentType: 'application/json; charset=utf-8',\n async: false,\n processData: false,\n cache: false,\n success: function (data) {\n\n if (data.errortype == \"s\") {\n isCodeExists = true;\n showAjaxReturnMessage(data.message, \"w\");\n }\n else\n isCodeExists = false;\n },\n error: function (xhr, status, error) {\n //console.log(\"Error: \" + error);\n ShowErrorMessge();\n }\n });\n\n //return isCodeExists;\n}", "function validateContact(form) {\n $.when(contactAjaxCall())\n .done(function (result) {\n //console.log(result);\n\n if (result[\"form-valid\"]) {\n form.submit();\n }\n else {\n //form submission is not valid, give user feedback\n $(\"#email-contact\").removeClass(\"is-valid is-invalid\");\n $(\"#email-contact-hint\").removeClass(\"valid-feedback invalid-feedback\");\n $(\"#email-contact-hint\").text(\"\");\n\n $(\"#message-contact\").removeClass(\"is-valid is-invalid\");\n $(\"#message-contact-hint\").removeClass(\"valid-feedback invalid-feedback\");\n $(\"#message-contact-hint\").text(\"\");\n\n if (result[\"email\"]) {\n $(\"#email-contact\").addClass(\"is-valid\");\n $(\"#email-contact-hint\").addClass(\"valid-feedback\");\n $(\"#email-contact-hint\").text(\"Email Address is Valid\");\n }\n else {\n $(\"#email-contact\").addClass(\"is-invalid\");\n $(\"#email-contact-hint\").addClass(\"invalid-feedback\");\n $(\"#email-contact-hint\").text(\"Email Address is Invalid\");\n }\n\n if (result[\"message\"]) {\n $(\"#message-contact\").addClass(\"is-valid\");\n $(\"#message-contact-hint\").addClass(\"valid-feedback\");\n }\n else {\n $(\"#message-contact\").addClass(\"is-invalid\");\n $(\"#message-contact-hint\").addClass(\"invalid-feedback\");\n $(\"#message-contact-hint\").text(\"Required\");\n }\n\n return false;\n }\n });\n\n return false;\n}", "function postcodeCheck(){\n\t var x = document.getElementById(\"postcode\").value;\n\t console.log('clicked');\n\t console.log(x);\n\t $.ajax({\n\t type: \"POST\",\n\t url: \"assets/php/postcode_get.php\",\n\t dataType: 'json',\n\t data: {postcode: x},\n\t success: function (data) {\n\t if (Number.isInteger(data)) {\n\t if (data != -99) {\n\t \t\tconsole.log(data);\n $('#pc_result').val(data);\n \t// document.getElementById(\"postcode-message\").innerHTML = '<div class=\"inner valid\">Postcode valid</span>';\n }\n }\n if (data == -99){\n \tconsole.log(data);\n \tdocument.getElementById(\"postcode-message\").innerHTML ='<div class=\"inner error\">Postcode not valid</span>';\n }\n\t }\n\t });\n\t return false;\n\t}", "function checkAvailBalanceCreditCards(this_){\n var accountID = $(this_).val();\n\n if(accountID!==\"\"){\n \n $.ajax({ \n type: \"post\",\n data: {'accountNumber':accountID},\n url: \"personal/creditcardaccount/utilaccount\",\n async : true,\n cache: false,\n success:function(response){\n \n var balance = response[\"currencyCode\"] +\" \"+ parseFloat(response[\"availableBalanceString\"], 10).toFixed(2).replace(/(\\d)(?=(\\d{3})+\\.)/g, \"$1,\").toString();\n $(this_+\"-result\").html(\"<em>Available \"+ balance);\n $(this_+\"-hiddenCurrency\").val(response[\"currencyCode\"]);\n \n //CHECK ACCOUNT STATUS ON CHANGE\n if((response[\"black_listed\"] == true)){\n \n $(\"#accountBlackList\").removeClass(\"hide\");\n $(\"#fund-transfer-submit\").hide();\n }else{\n $(\"#accountBlackList\").addClass(\"hide\");\n $(\"#fund-transfer-submit\").show();\n }\n $(\"#currency\").val(response[\"currencyCode\"]);\n var valtoprint = $(\"#currency\").val();\n var valtoprint2 = $(\"#userAccountNumber2-hiddenCurrency\").val();\n $(\"#currency\").prop(\"disabled\", false);\n $(\"#currency-value\").val(response[\"currencyCode\"]);\n \n if(valtoprint == 'LKR'){\n $(\"#currency\").prop(\"disabled\", true);\n }\n\n }, error: function(){\n //alert('Error while request..');\n }\n });\n } else { $(this_+\"-result\").html(\"<em>...</em>\"); }\n}", "function GetResultsAndPagination(ReferralUrl) {\n // DomainName = \"localhost:50444\";\n var URL = \"http://\" + DomainName + \"/SavedSearchsGetSingleSearch\";\n $.ajax({\n cache: false,\n type: \"POST\",\n url: URL,\n data: { \"RefUrl\": ReferralUrl },\n success: function (data) {\n if (data != null) {\n var arr = data.split('$||$');\n if (arr[0] != \"0\") {\n $('.ajax-loading-block-window').css('display', 'none');\n $('.ssResultTopRow h5').show('slow');\n $('.SingleSearchResultCount').html(arr[0]);\n $('.SingleSearchResult').html(arr[1]);\n $('.SingleSearchResultPagination').html(arr[2]);\n }\n else {\n $('.ajax-loading-block-window').css('display', 'none');\n $('.ssResultTopRow h5').css('display', 'none');\n $('.SingleSearchResult').html('<h2>No Results Found.</h2>');\n }\n }\n },\n error: function (ex) {\n ExceptionHandling(ex);\n $('.ajax-loading-block-window').css('display', 'none');\n $('.ssResultTopRow h5').css('display', 'none');\n $('.SingleSearchResult').html('<h2>No Results Found.Please try again later.</h2>');\n }\n //error: function (xhr, ajaxOptions, thrownError) {\n // $('.ajax-loading-block-window').css('display', 'none');\n // $('.ssResultTopRow h5').css('display', 'none');\n // $('.SingleSearchResult').html('<h2>No Results Found.Please try again later.</h2>');\n //}\n });\n return true;\n}", "function validateAddress(){\n// create query address object to submit to web service api\n let oQueryAddress = {};\n// attach AddressLine1 and AddressLine2 from corresponding inputs\n oQueryAddress.AddressLine1 = $('#address-line-1').val();\n oQueryAddress.AddressLine2 = $('#address-line-2').val();\n\n// submit\n $.ajax({\n url: '/address/validate',\n// attach AddressLine1 and AddressLine2 to AJAX request\n data: oQueryAddress,\n method: 'GET',\n dataType: 'json',\n contentType: 'application/json'\n })\n// success callback\n .done((data)=>{\n let msg = data.ErrorMessage || 'OK';\n\n $('#address-validate').val(msg);\n $('#address-line-1').val(data.AddressLine1);\n $('#address-line-2').val(data.AddressLine2);\n\n // saveAddress(data);\n })\n .fail((err,status)=>{\n $('div.error').html(err.responseText);\n });\n}", "function SearchMember() {\n var phone = $.trim($('#addnewcontact-phone').val());\n \n //Validate field\n if (phone == '') {\n $('#divAddNewContactError1, #divAddNewContactError2').show();\n $('#divAddNewContactError1, #divAddNewContactError2').text('Please provide a phone number.');\n return;\n }\n\n //Show searching bar\n $('#divAddNewContactSearchFailed').hide();\n $('#divAddNewContactSearching').show();\n \n //Show bar for at least 3 seconds\n setTimeout(function () {\n\n console.log('sending ajax');\n\n //Run ajax\n $.ajax({\n type: \"GET\",\n url: \"/account/search/\",\n data: \"phone=\" + phone\n })\n .fail(function (response) {\n $('#divAddNewContactSearching').hide();\n \n console.log('fail');\n console.log(\"response.statusText: \" + response.statusText);\n console.log(\"response.responseText: \" + response.responseText);\n })\n .done(function (response) {\n\n if (response.Success) {\n $('#divAddNewContactSearching').hide();\n \n $('#addnewcontact-firstname').val(response.DynObject.firstname);\n $('#addnewcontact-lastname').val(response.DynObject.lastname);\n $('#addnewcontact-email').val(response.DynObject.email);\n }\n else {\n $('#divAddNewContactSearching').hide();\n $('#divAddNewContactSearchFailed').show();\n }\n\n console.log('done');\n console.log('response.Success: ' + response.Success);\n console.log('response.DynObject.firstname: ' + response.DynObject.firstname);\n console.log('response.DynObject.lastname: ' + response.DynObject.lastname);\n });\n\n }, 3000);\n}", "function saveReturnRecord(){\n console.log('addreturn');\n if($('#warrantyselect').is(':checked')) {\n var selected=\"warranty\";\n\n }else{\n selected=\"repair\";\n }\n $.ajax({\n method:'POST',\n url:url2,\n data:{_token:token, data: $('#form').serialize(), customer:$('#customer').val(),contact:$('#contact').val(),email:$('#email').val(),address:$('#address').val(),option:selected},\n success:function(data){\n successHTML = '<div class=\"alert-success alert\"><ul>';\n successHTML += '<li> Records added successfully </li>';\n successHTML += '</ul></di>';\n $( '#form-errors' ).html( successHTML );\n if(selected == 'warranty'){\n $( '#job_note_btn').prop( \"disabled\", false );\n }\n\n //console.log(data);\n },\n error :function( jqXhr ) {\n if( jqXhr.status === 401 ) //redirect if not authenticated user.\n $( location ).prop( 'pathname', 'auth/login' );\n if( jqXhr.status === 422 ) {\n //process validation errors here.\n var errors = jqXhr.responseJSON; //this will get the errors response data.\n //show them somewhere in the markup\n //e.g\n errorsHtml = '<div class=\"alert alert-danger\"><ul>';\n\n $.each( errors , function( key, value ) {\n errorsHtml += '<li>' + value[0] + '</li>'; //showing only the first error.\n });\n errorsHtml += '</ul></di>';\n\n $( '#form-errors' ).html( errorsHtml ); //appending to a <div id=\"form-errors\"></div> inside form\n } else {\n /// do some thing else\n }\n }\n });\n console.log('done');\n\n}", "function isSyncAjax(objRequest) {\t\t\t\t \r\n\tif(objRequest.readyState == 4){ \r\n\t\tif(objRequest.status == 200){ \r\n\t\t\treturn true; \r\n\t\t} \r\n\t} \r\n return false; \r\n}", "function OnErrorCallMaladie(jqXHR, status) {\n\t\t\treturn false;\n\t\t}", "function ajaxFailure(){\n\talert(\"Ajax request failed\");\n}", "function ajaxFailure(){\n\talert(\"Ajax request failed\");\n}", "function ajaxFailure(){\n\talert(\"Ajax request failed\");\n}", "function run_ajax(method, data, link, callback=function(res){dosages.get_dosages()}){\n $.ajax({\n method: method,\n data: data,\n url: link,\n success: function(res) {\n dosages.errors = {};\n callback(res);\n },\n error: function(res) {\n console.log(\"error\");\n dosages.errors = res.responseJSON;\n }\n })\n}", "function txnActionResult(data) {\n $(\"#btnPostAuth\").removeAttr(\"disabled\");\n $(\"#btnPostAuth2\").removeAttr(\"disabled\");\n\n if (data != null) {\n if (data.result == \"VALIDATION_ERROR\") {\n $.unblockUI();\n $(\"#postAuthForm\").data(\"validator\").invalidate(data);\n }\n else if (data.result == \"INTERNAL_ERROR\") {\n location.href = \"showError.htm?csrfToken=\" + csrfToken;\n }\n else if (data.result == \"PROCESSING_ERROR\") {\n location.href = \"../reports/showActionError.htm?csrfToken=\"\n + csrfToken\n + \"&code=\" + data.code\n + \"&description=\" + data.description\n + \"&confNbr=\" + data.confNbr;\n }\n else {\n // if all good reload the txn\n $(\"#txnDetailForm\").submit();\n }\n }\n}", "function getUserSuggestedPartners(getUserSuggestedPartners) {\n waitFunc('enable');\n $.ajax({\n type: 'post',\n url: 'includes/ajax.php',\n data: {getUserSuggestedPartners: getUserSuggestedPartners},\n success: function (data) {\n waitFunc('');\n if (data == 'error') {\n alertFunc('danger', 'Something went wrong, please try again')\n } else {\n $('#sgstdprtnrsrslts').html(data);\n $('[data-toggle=\"tooltip\"]').tooltip();\n }\n },\n error: function () {\n waitFunc('');\n alertFunc('info', 'Something went wrong, please try again');\n }\n });\n}", "function OnSuccessCallMaladie(data, status, jqXHR) {\n\t\t}", "function detect_exist(e){\n var id_value={\n id:e.target.value\n }\n\n console.log(e.target.value);\n //return;\n $.ajax({\n type:\"POST\",\n url:\"/id_exist_check\",\n contentType: 'application/json;charset=UTF-8',\n data:JSON.stringify(id_value),\n success:function(result){\n if(result==\"ok\"){\n $(\"#memberQuery\").attr(\"disabled\", false);\n $(\"#memberGetInRec\").attr(\"disabled\",false);\n $(\"#btnGetIn\").attr(\"disabled\",false);\n $(\"#btnGetInTimes\").attr(\"disabled\",false);\n $(\"#btnVIPGetIn\").attr(\"disabled\",false);\n $(\"#btnTranLittleGetInTimes\").attr(\"disabled\",false);\n $(\"#btnCourseLimitGetInTimes\").attr(\"disabled\",false);\n $(\"#btnCourseGetInTimes\").attr(\"disabled\",false);\n \n }else{\n $(\"#memberQuery\").attr(\"disabled\", true);\n $(\"#memberGetInRec\").attr(\"disabled\",true);\n $(\"#btnGetIn\").attr(\"disabled\",true);\n $(\"#btnGetInTimes\").attr(\"disabled\",true);\n\n $(\"#btnVIPGetIn\").attr(\"disabled\",true);\n $(\"#btnTranLittleGetInTimes\").attr(\"disabled\",true);\n $(\"#btnCourseLimitGetInTimes\").attr(\"disabled\",true);\n $(\"#btnCourseGetInTimes\").attr(\"disabled\",true);\n }\n },\n error:function(result){ \n alert(result);\n }\n });\n}", "function handleAjaxError(error){\n\t showErrorMessage(\"An error has occured\");\n\t return true;\t \n}", "function getUsers(){\n return $.ajax({\n url: \"/accounting/api/users/\",\n dataType:DEFAULT_DATATYPE\n }).done(function (data, textStatus, jqXHR){\n if (DEBUG) {\n console.log (\"RECEIVED RESPONSE: data:\",data,\"; textStatus:\",textStatus)\n }\n $(\"#user_list\").empty();\n //Extract the users\n var users = data.collection.items;\n for (var i=0; i < users.length; i++){\n var user = users[i].data[0].value;\n appendUserToList(user);\n }\n }).fail(function (jqXHR, textStatus, errorThrown){\n if (DEBUG) {\n console.log (\"RECEIVED ERROR: textStatus:\",textStatus, \";error:\",errorThrown)\n }\n //The behaviour upon failure is not defined. Left with log message\n alert (\"Could not get user's incomes\");\n });\n}", "function getUserSuggestedPartners(getUserSuggestedPartners) {\n waitFunc('enable');\n $.ajax({\n type: 'post',\n url: 'includes/ajax.php',\n data: { getUserSuggestedPartners: getUserSuggestedPartners },\n success: function(data) {\n waitFunc('');\n if (data == 'error') {\n alertFunc('danger', 'Something went wrong, please try again')\n } else {\n $('#sgstdprtnrsrslts').html(data);\n $('[data-toggle=\"tooltip\"]').tooltip();\n }\n },\n error: function() {\n waitFunc('');\n alertFunc('info', 'Something went wrong, please try again');\n }\n });\n}", "function ajaxBindCallback(){\n\t\tif(ajaxRequest.readyState == 0) { window.status = \"Waiting...\"; }\n\t\tif(ajaxRequest.readyState == 1) { window.status = \"Loading Page...\"; }\n\t\tif(ajaxRequest.readyState == 2) { window.status = \"Data Received...\";}\n\t\tif(ajaxRequest.readyState == 3) { window.status = \"Interactive...\"; }\n\t\tif(ajaxRequest.readyState == 4) {\n\t\t\twindow.status = \"Transaction Complete...\";\n\n // STOP TIMER AND FIND DIFFERENCE\n // MUST CREATE NEW TIMER INSTANCE :)\n var timer2 = new Date();\n var t_end = timer2.getTime();\n var t_diff = t_end - t_start;\n\n // TEST HTTP STATUS CODE - DISPLAY IN DUBUGGER AND STATUS\n switch (ajaxRequest.status.toString()) {\n case \"200\" :\n window.status = \"Page Loaded Sucessfully\";\n document.getElementById(pageElement).innerHTML = ajaxRequest.responseText;\n debugEvent(url, \"got\", ajaxRequest.responseText, t_diff);\n break;\n case \"403\" :\n window.status = \"Forbidden...\";\n debugEvent(url, \"error_403\", ajaxRequest.responseText, t_diff);\n break;\n case \"404\" :\n window.status = \"File Not Found...\";\n debugEvent(url, \"error_404\", ajaxRequest.responseText, t_diff);\n break;\n case \"500\" :\n window.status = \"File Not Found...\";\n debugEvent(url, \"error_500\", ajaxRequest.responseText, t_diff);\n break;\n default :\n window.status = \"Unknown Ajax Error...\"+ajaxRequest.status.toString();\n }\n\t\t\t}\n\t}", "function ajaxSuccess(data, status, xhrObj) {\n\t\t\t\tif (!data || !_.isObject(data)) {\n\t\t\t\t\tvar errorObj = {\n\t\t\t\t\t\t\"data\" : data,\n\t\t\t\t\t\t\"xhrObj\" : xhrObj,\n\t\t\t\t\t\t\"status\" : status\n\t\t\t\t\t};\n\t\t\t\t\t// flagError(\"iframe ajaxSuccess returned bad data.\", errorObj);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tvar backTime = Date.now(),\n\t\t\t\t\tdataObj = jsonToObj(data),\n\t\t\t\t\tcallTime = dataObj.a || 0,\n\t\t\t\t\tlag = backTime-callTime,\n\t\t\t\t\tcmd = dataObj.cmd;\n\t\t\t\t\n\t\t\t\tlocalStore({\"cmd\":'set',\"key\":'Old'});\n\t\t\t\t// if (!callTime) { flagError('No returned callTime for this ajax data.') }\n\t\t\t\tif (cmd == \"ping\") {\n\t\t\t\t\tadminUpdate(data);\n\t\t\t\t} else if (cmd == \"msg\") {\n\t\t\t\t\tadminMsg(data);\n\t\t\t\t} else if (cmd == \"load\") {\n\t\t\t\t\tadminLoad(data);\n\t\t\t\t}\n\t\t\t}", "function showValidity() {\n if (httpObject.readyState == 4 && httpObject.status == 200) {\n if (httpObject.responseText != \"\") {\n var response = JSON.parse(httpObject.responseText);\n setFormResponse(setResponses(response));\n }\n }\n}", "function processResponse() {\n // readyState of 4 signifies request is complete\n if (xhr.readyState == 4) {\n // status of 200 signifies sucessful HTTP call\n if (xhr.status == 200) {\n pageChangeResponseHandler(xhr.responseText);\n }\n }\n }", "function handleAjaxResult(returnResult, processName, funcSuccess, funcError, isNotShowSuccessMesg, isMesgSuccessNotBlocking, isMesgErrorNotBlocking) {\n if (typeof returnResult.Redirect != \"undefined\") {\n window.location = returnResult.Redirect;\n return;\n }\n\n if (typeof returnResult.Result != \"undefined\" && typeof returnResult.ErrMesgs != \"undefined\") {\n if (returnResult.Result == returnResult.ValueSuccess) {\n if (!isNotShowSuccessMesg) {\n var mesg = \"Process \" + processName + \" finish successfully\";\n if (typeof returnResult.SuccMesgs != \"undefined\" && returnResult.SuccMesgs != null) {\n for (i = 0; i < returnResult.SuccMesgs.length; i++) {\n mesg += \"<br/>\" + returnResult.SuccMesgs[i];\n }\n }\n if (typeof returnResult.ProcessId != \"undefined\" && returnResult.ProcessId != null) {\n //mesg += \"<br/> ProcessId = \" + returnResult.ProcessId;\n mesg += (\"<br/> ProcessId = <a href='#' onclick='openNewWindow(\\\"\" + gRootPath + \"LogMonitoring?processId=\" + returnResult.ProcessId + \"\\\")'>\" + returnResult.ProcessId + \"</a>\");\n }\n $.msgBox({\n title: \"SUCCESS\",\n content: mesg,\n success: function (result) {\n if (!isMesgSuccessNotBlocking) {\n if (funcSuccess && (typeof funcSuccess == \"function\")) {\n funcSuccess(returnResult);\n }\n }\n }\n });\n }\n\n if (isMesgSuccessNotBlocking || isNotShowSuccessMesg) {\n if (funcSuccess && (typeof funcSuccess == \"function\")) {\n funcSuccess(returnResult);\n }\n }\n } else {\n if (returnResult.ErrMesgs != null) {\n var errMesg = \"Process \" + processName + \" finish with error : <br/>\";\n if (typeof returnResult.ProcessId != \"undefined\" && returnResult.ProcessId != null) {\n //errMesg += \"ProcessId = \" + returnResult.ProcessId + \"<br/>\";\n errMesg += (\"ProcessId = <a href='#' onclick='openNewWindow(\\\"\" + gRootPath + \"LogMonitoring?processId=\" + returnResult.ProcessId + \"\\\")'>\" + returnResult.ProcessId + \"</a><br/>\");\n }\n for (i = 0; i < returnResult.ErrMesgs.length; i++) {\n errMesg += returnResult.ErrMesgs[i] + \"<br/>\";\n }\n $.msgBox({\n title: \"ERROR\",\n type: \"error\",\n content: errMesg,\n success: function (result) {\n if (!isMesgErrorNotBlocking) {\n if (funcError && (typeof funcError == \"function\")) {\n funcError(returnResult);\n }\n }\n }\n });\n }\n\n if (isMesgErrorNotBlocking) {\n if (funcError && (typeof funcError == \"function\")) {\n funcError(returnResult);\n }\n }\n }\n } else {\n alert(returnResult);\n window.location = window.location.origin;\n }\n}", "function run_ajax(method, data, link, callback=function(res){chores.get_chores()}){\n $.ajax({\n method: method,\n data: data,\n url: link,\n success: function(res) {\n chores.errors = {};\n callback(res);\n },\n error: function(res) {\n console.log(\"error\");\n chores.errors = res.responseJSON;\n // Will update with an error handling function later\n }\n })\n }", "function checkMultiple(x, y){\n $.ajax({\n url: window.location.pathname+ '/check',\n data: {\n x: x,\n y: y,\n checkMultiple: true\n },\n success: function(response){\n if (lost == false && win == false){\n if (response.lost == true){\n lost = true\n gameLost();\n } \n\n if (response.won == true){\n win = true\n gameWon();\n } \n\n remap(response); \n } \n },\n error: function(response){\n alert('something went wrong, please try again');\n }\n });\n }", "function defaultAjaxCallback(response, status, xhr, options){\n\t\tconsole.log(\"ajax callback \" + status);\n\t\tif(status === \"error\"){\n\t\t\t$(\"#\" + options.ajaxLoadDiv).html(\"Could not load the requested resource, double check so that the id etc. is correct and that the resource exist\");\n\t\t}\n\t}", "function isItMyFloor(){\n if(current_floor_owner == user_email)return true;\n return false;\n /*\n //alert(\"Current Floor Owner: \" + current_floor_owner);\n //alert(\"My Email: \" + user_email);\n $.ajax({\n type: \"POST\",\n cache: false,\n url: \"/locking_turn_get_current_floor_owner/\",\n success: function (option) {\n current_floor_owner = option['current_floor_owner_srv'];\n //console.log(\"From Srv , Current Owner: \" + current_floor_owner);\n\n //if(current_floor_owner == user_email)return true;\n //return false;\n },\n error: function (xhr, status, error) {\n alert(\"Some Error Occured while Releasing Floor.\");\n },\n async:false\n\n });*/\n\n\n\n }", "function ajaxBindCallback(){\n\t\tif(ajaxRequest.readyState == 0) { window.status = \"Waiting...\"; }\n\t\tif(ajaxRequest.readyState == 1) { window.status = \"Loading Page...\"; }\n\t\tif(ajaxRequest.readyState == 2) { window.status = \"Data Received...\";}\n\t\tif(ajaxRequest.readyState == 3) { window.status = \"Interactive...\"; }\n\t\tif(ajaxRequest.readyState == 4) {\n\t\t\twindow.status = \"Transaction Complete...\";\n\n // STOP TIMER AND FIND DIFFERENCE\n // MUST CREATE NEW TIMER INSTANCE :)\n var timer2 = new Date();\n var t_end = timer2.getTime();\n var t_diff = t_end - t_start;\n\n // TEST HTTP STATUS CODE - DISPLAY IN DUBUGGER AND STATUS\n switch (ajaxRequest.status.toString()) {\n case \"200\" :\n debugEvent(url, \"got\", ajaxRequest.responseText, t_diff);\n break;\n case \"403\" :\n debugEvent(url, \"error_403\", ajaxRequest.responseText, t_diff);\n break;\n case \"404\" :\n debugEvent(url, \"error_404\", ajaxRequest.responseText, t_diff);\n break;\n case \"500\" :\n debugEvent(url, \"error_500\", ajaxRequest.responseText, t_diff);\n break;\n }\n\t\t\t}\n\t}", "function checkNetConnection(){\n \n\t$.ajax({\n\t\t\turl: 'http://web-huertas.com/work/programs/Wizard_Git/assets/php/checkConnection.php',\n\t\t\tasync: false,\n\t\t\tdata: {'tag':'connection'},\n\t\t\tdataType:\"Json\",\n\t\t\tsuccess: function (data) {\n Success = true;//doesnt goes here\n },\n error: function (textStatus, errorThrown) {\n Success = false;//doesnt goes here\n }\n\n });\n //done after here\n return Success;\n} /// END checkNetConnection", "function handleChange(){\n\t\t\t// Error handles\n\t\t\tif(xhr.readyState === this.DONE && xhr.status !== 200){\n\t\t\t\tconsole.log('check yoself');\n\t\t\t}\n\t\t\t// success handles\n\t\t\tif(xhr.readyState === this.DONE && xhr.status === 200){\n\t\t\t\tcallback(xhr.response);\n\t\t\t}\n\n\t\t}", "function check_username() {\n var result;\n $.ajax({\n type: 'POST',\n url: 'models/validations/validate_account.php',\n data: {\n username: $('#username').val(),\n },\n cache: false,\n success: function(response) {\n if (response == 0) {\n var message = document.getElementById('checkUsername');\n message.style.color = \"#66cc66\";\n message.innerHTML = \"Username is available\";\n result = true;\n } else {\n var message = document.getElementById('checkUsername');\n message.style.color = \"#ff6666\";;\n message.innerHTML = \"Username has duplicate in the database\";\n result = false;\n }\n }\n\n });\n return result;\n}", "function processStateChangeCopiRef(){\r\n\tif (req.readyState == 4){ \r\n\t\t// Complete\r\n\t\tif (req.status == 200){\r\n\t\t\t// OK response\r\n\t\t document.getElementById(\"ajaxResponse\").innerHTML = req.responseText;\r\n\t\t\tif (req.responseText.length < 30){\r\n\t\t\talert(req.responseText); \r\n\t\t\t}\r\n\t\t\t} else {\r\n\t\t alert(\"Erreur Ajax - Problem: \" + req.statusText);\r\n\t\t alert(\"Erreur Ajax - status: \" + req.status);\r\n\t\t}\r\n\t} \r\n}", "function OnAjaxSuccess() {\n if (typeof CleanUpInputs === 'function') { CleanUpInputs(); } \n}", "function GetAllMachineAjaxCall() {\n $(TablesId.bakimOzeti).empty();\n requestQueryForBakimOzeti.machineNo = $(Inputs.bakimOzeti_machineNo).val();\n ShowLoader();\n $.ajax({\n type: \"POST\",\n contentType: \"application/json;charset=utf-8\",\n data: JSON.stringify(requestQueryForBakimOzeti),\n url: HttpUrls.BakimAriza_GetAllMachines,\n success: (list) => {\n if (list.length !== 0) {\n $(recordsNotFound.bakimOzeti).css('display', 'none');\n console.log('ozet', list)\n CreateBakimOzetiTable(list, TablesId.bakimOzeti);\n }\n else {\n $(`${recordsNotFound.bakimOzeti} h3`).text('Hiç Bir Kayit Bulunmamaktadır');\n $(recordsNotFound.bakimOzeti).css('display', 'block');\n HideLoader();\n }\n }\n });\n}", "function AllMachinesAjaxRequest() {\n ShowLoader();\n $(TablesId.BakimAriza_AllMachines).empty();\n $.ajax({\n type: \"POST\",\n contentType: \"application/json;charset=utf-8\",\n url: HttpUrls.BakimAriza_GetAllMachines,\n data: JSON.stringify(requestQueryForBakimAriza),\n success: (list) => {\n if (list.length !== 0) {\n $(recordsNotFound.BakimAriaz_AllMachines).css('display', 'none');\n CreateAllMachinesTableInBakimAriza(list, TablesId.BakimAriza_AllMachines);\n }\n else {\n \n $(`${recordsNotFound.BakimAriaz_AllMachines} h3`).text('Hiç Bir Kayit Bulunmamaktadır');\n $(recordsNotFound.BakimAriaz_AllMachines).css('display','block');\n\n HideLoader();\n }\n }\n });\n}", "function GetAllFindInBomAjaxCall() {\n if (requestQueryForFindInBom.pageNumber === 1) {\n disableButton(PreviousButtons.findInBom);\n ActiveButton(NextButtons.findInBom);\n }\n else {\n ActiveButton(PreviousButtons.findInBom);\n ActiveButton(NextButtons.findInBom);\n }\n\n\n requestQueryForFindInBom.Stk = $(Inputs.findInBom_searchStk).val();\n requestQueryForFindInBom.material = $('#inp-findInBom-searchMaterial').val();\n ShowLoader();\n $(TablesId.findInBom).empty();\n $.ajax({\n type: \"POST\",\n contentType: \"application/json;charset=utf-8\",\n url: HttpUrls.GetAllFindInBom,\n data: JSON.stringify(requestQueryForFindInBom),\n success: (list) => {\n if (list.length !== 0) {\n $('#recordNotFoundDiv_findInBom').css('display', 'none');\n console.log('find',list);\n CreateFindInBomTable(list, TablesId.findInBom);\n }\n else {\n disableButton(NextButtons.findInBom);\n $(`#recordNotFoundDiv_findInBom h3`).text('Hiç Bir Kayit Bulunmamaktadır');\n $('#recordNotFoundDiv_findInBom').css('display', 'block');\n HideLoader();\n }\n }\n });\n}", "ajaxResetAllPostsOrder() {\n let $ = jQuery.noConflict();\n let thisClass = this;\n\n if (this.xhrIsWorking === true) {\n alert(RdPostOrderObj.txtPreviousXhrWorking);\n return false;\n }\n\n let confirmed_val = confirm(RdPostOrderObj.txtConfirmReorderAll);\n\n if (confirmed_val === true) {\n thisClass.xhrIsWorking = true;\n thisClass.disablePostSortable();\n $('.form-result-placeholder').html('');\n\n let formData = {\n 'action': 'RdPostOrderResetAllPostsOrder',\n 'security': RdPostOrderObj.ajaxnonce,\n '_wp_http_referer': $('input[name=\"_wp_http_referer\"]').val(),\n 'paged': ($.query.get('paged') ? $.query.get('paged') : 1),\n 'hookName': RdPostOrderObj.hookName,\n }\n\n $.ajax({\n url: ajaxurl,\n type: 'POST',\n data: formData,\n dataType: 'json'\n })\n .done((response, textStatus, jqXHR) => {\n // displaying result to the page.\n thisClass.displayNoticeElement(response, response, 'notice-error');\n\n if (typeof(response) !== 'undefined') {\n thisClass._ajaxReplaceTable(response);\n }\n })\n .fail((jqXHR, textStatus, errorThrown) => {\n let errResponse = jqXHR.responseJSON;\n let errResponseText = jqXHR.responseText;\n\n thisClass.displayNoticeElement(errResponse, errResponseText, 'notice-error');\n })\n .always((jqXHR, textStatus, errorThrown) => {\n let response;\n if (textStatus === 'success') {\n response = jqXHR;\n } else {\n response = jqXHR.responseJSON;\n }\n // mark XHR is not working.\n thisClass.xhrIsWorking = false;\n // re-activate sortable\n thisClass.enablePostSortable();\n });\n }// endif; confirmed\n\n return false;\n }", "function checkNetConnection(){\n \n\n\t$.ajax({\n\t\t\turl: 'http://web-huertas.com/work/programs/Wizard_Git/assets/php/checkConnection.php',\n\t\t\tasync: false,\n\t\t\tdata: {'tag':'connection'},\n\t\t\tdataType:\"Json\",\n\t\t\tsuccess: function (data) {\n Success = true;//doesnt goes here\n },\n error: function (textStatus, errorThrown) {\n Success = false;//doesnt goes here\n }\n\n });\n //done after here\n return Success;\n} /// END checkNetConnection", "function verify_name(name){\n $(\".u_error\").hide();\n $(\".u_correct\").hide();\n if(name == \"\"){\n $(\".u_error\").show();\n $(\".u_error\").html(\"Please enter your name\");\n \n } else{\n $.ajax({\n url: \"action.php\",\n method: \"POST\",\n data: {check_name:1,name:name},\n success: function(data){ \n if(data == \"invalid_name\"){\n $(\".u_error\").show();\n $(\".u_error\").html(\"Invalid Name\");\n } else if(data == \"ok\"){\n $(\".u_correct\").show();\n $(\".u_correct\").html(\"OK\");\n }\n }\n });\n } \n }", "function updateUserName()\n{\n $.ajax({\n async: false,\n type: \"POST\",\n url: \"SavedUser\",\n success: function (data)\n {\n username = data;\n checkAdmin();\n },\n error: function (var1, error)\n {\n alert(error);\n return false;\n }\n });\n}", "function ajaxCall(data, destUrl)\n{\n\t$.ajax({\n\t type:\"POST\",\n\t cache:false,\n\t url: destUrl,\n\t data: data, // multiple data sent using ajax\n\t success: function (html) {\n\t \tif(destUrl == '/BudgetBunny/home')\n\t \t\ttransactionSuccess(html);\n\t \t\n\t \tif(destUrl == '/BudgetBunny/budgetsetuppage')\n\t \t{\t\n\t \t\twindow.location='/BudgetBunny/home';\n\t \t\treturn;\n\t \t}\n\t \t$('.total-budget').text($(html).find('.total-budget').text());\n\t \t\n\t \tsubmitSuccess();\n\t \tclose_div();\n\t }\n\t });\n}", "function ValidateInsuranceCompanyNameInsuranceCompanyLicenseNumber(id) {\n\n var isValid = jQuery(\"#InsuranceCompanyFormDiv\").validationEngine({ returnIsValid: true });\n if (isValid == true) {\n var txtInsuranceCompanyName = $(\"#txtInsuranceCompanyName\").val();\n var txtInsuranceCompanyLicenseNumber = $(\"#txtInsuranceCompanyLicenseNumber\").val();\n var jsonData = JSON.stringify({\n insuranceCompanyName: txtInsuranceCompanyName,\n insuranceCompanyLicenseNumber: txtInsuranceCompanyLicenseNumber,\n id: id\n });\n $.ajax({\n type: \"POST\",\n url: '/Insurance/ValidateInsuranceCompanyNameInsuranceCompanyLicenseNumber',\n async: false,\n contentType: \"application/json; charset=utf-8\",\n dataType: \"json\",\n data: jsonData,\n success: function (data) {\n if (data == 1) {//1 means Insurance Company Name and Insurance Company License Number matched\n ShowMessage('Insurance Company Name and Insurance Company License Number is already used. Please change!', \"Alert\", \"warning\", true);\n }\n else if (data == 2)//2 means Insurance Company Name matched\n {\n ShowMessage('Insurance Company Name is already used. Please change!', \"Alert\", \"warning\", true);\n }\n else if (data == 3) {//3 means Insurance Company License Number matched\n ShowMessage('Insurance Company License Number is already used. Please change!', \"Alert\", \"warning\", true);\n }\n else {\n SaveInsuranceCompany(id);\n }\n },\n error: function (msg) {\n }\n });\n }\n}", "function add_truck(pageContext) {\n let incorrect = false;\n\n // check if capacity is a number\n if (isNaN($(\"#capacityInput\").val())) {\n $(\"#capacityError\").text(\"Must be a number!\").show();\n incorrect = true;\n }\n\n // check if shift size is a number\n if (isNaN($(\"#shiftInput\").val())) {\n $(\"#shiftError\").text(\"Must be a number!\").show();\n incorrect = true;\n }\n\n // if there are mistakes then leave\n if (incorrect) return;\n\n // send request\n $.ajax({\n type: 'POST',\n contentType : 'application/json',\n dataType: 'json',\n url: pageContext + '/employee/truck/create',\n data: JSON.stringify({\n \"uniqueIdentificator\": $(\"#uniqueIdentificatorInput\").val(),\n \"capacity\": $(\"#capacityInput\").val(),\n \"shiftSize\": $(\"#shiftInput\").val(),\n \"status\": $(\"#statusSelect\").val(),\n \"cityId\": $(\"#citySelect\").val(),\n }),\n success: function (data) {\n // redirect\n if (data[\"status\"] === \"success\") {\n window.location.href = pageContext + '/employee/homepage';\n } else {\n // output error\n if (data[\"messages\"].hasOwnProperty(\"uniqueIdentificator\")) {\n $(\"#uniqueIdentificatorError\").text(data[\"messages\"][\"uniqueIdentificator\"]).show();\n }\n\n if (data[\"messages\"].hasOwnProperty(\"capacity\")) {\n $(\"#capacityError\").text(data[\"messages\"][\"capacity\"]).show();\n }\n\n if (data[\"messages\"].hasOwnProperty(\"shiftSize\")) {\n $(\"#shiftError\").text(data[\"messages\"][\"shiftSize\"]).show();\n }\n\n if (data[\"messages\"].hasOwnProperty(\"status\")) {\n $(\"#statusError\").text(data[\"messages\"][\"status\"]).show();\n }\n\n if (data[\"messages\"].hasOwnProperty(\"cityId\")) {\n $(\"#cityError\").text(data[\"messages\"][\"cityId\"]).show();\n }\n }\n },\n error: function () {\n }\n })\n}", "function callServer() {\n if (calling === 0) {\n clearData();\n $(messageBox).html(\"Validando curp...\");\n console.log(\"Llamando al servidor... Intento(\" + countCalls + \")\");\n calling = 1;\n $.ajax({\n url: url[countCalls] + \"curp.json\",\n data: {\n curp: curpInput.val()\n },\n type: \"POST\",\n timeout: 15000\n }).done(function(result) {\n console.log(\"La operación se ejecutó correctamente\");\n console.log(result); \n //alert(document.getElementsByName(\"pluginCurp\")[0].value);\n if (result.curp !== null && result.curp !== undefined) {\n showData(result); \n $(messageBox).html(\"CURP correcto.\");\n document.getElementsByName(\"pluginCurp\")[0].value=\"true\";\n } else {\n \n $(messageBox).html(result.mensaje);\n //Se agregó al plugin\n if(result.mensaje==\"Error al conectarse al servidor LDAP\")\n {\n document.getElementsByName(\"pluginCurp\")[0].value=\"false\";\n console.log(\"Cambiando a modo libre\");\n changeFree();\n }\n }\n\n }).error(function(data, textStatus, jqXHR) {\n console.log(\"Ocurrió un error: \" + textStatus);\n\n $(messageBox).html(\"Ocurrió un error.\");\n\n// if (textStatus === \"timeout\") {\n console.log(\"No se pudo establecer la conexión.\");\n console.log(\"Llamadas realizadas: \" + countCalls + \", disponibles: \" + url.length-1);\n if (countCalls < url.length-1) {\n console.log(\"Realizando un intento en otra instancia...\");\n countCalls++;\n calling = 0;\n callServer();\n } else {\n console.log(\"Cambiando a modo libre\");\n changeFree();\n }\n// }\n\n }).always(function() {\n calling = 0;\n });\n } else {\n console.log(\"Servidor ocupado.\");\n }\n }", "function get_data_memo() {\n debugger;\n contract_no = $('#contract_preterm').val();\n no_memo = $('#no-memo-preterm').val();\n tgl_pelunasan = $('#tgl-pelunasan-preterm').val();\n isi_cabang($('#branch-id-pt').html());\n\n\n $.ajax({\n url: 'Controller_pre_termination/get_data_memo',\n dataType: 'json',\n type: 'POST',\n data: {\n 'branch_id': branch_code_pt,\n 'contract_no': contract_no,\n 'tgl_pelunasan': tgl_pelunasan,\n 'flag_pilot' : flag_pilot,\n 'memo_no': no_memo\n },\n\n success: function(response) {\n console.log(response);\n try{\n var financetype = response['fintype'][0]['fin_desc'];\n financode = response['fintype'][0]['fin_code'];\n\n var flag_rv = true;\n var rv_stat = null\n if (response) {\n try {\n if (response['errorConsole']) {\n if(response['errorConsole'].includes(\"no data found\")){\n alert_error(\"Data tidak ditemukan\");\n } else {\n alert_error(response['errorConsole']);\n }\n } else {\n $('#pinalty-plus-preterm').prop('disabled',true);\n $('#uang-bayar-preterm').prop('disabled',true);\n $('#sumber-dana-preterm').prop('disabled',true);\n $('#reason-preterm').prop('disabled',true);\n $('#tgl-pelunasan-preterm').prop('disabled',true);\n var data_count = response['count'];\n var pelunasan = data_count['no_instalment'];\n var sisa_pokok = data_count['sisa_pokok'];\n titipan = data_count['titipan'];\n tot_pokok = data_count['tot_pokok'];\n bunga_berjalan = data_count['bunga_berjalan'];\n var tot_pinalty = data_count['tot_pinalty'];\n bunga_hapus = data_count['bunga'];\n var decodbungadn = data_count['decodbungadn'];\n var decodpokokdn = data_count['decodpokokdn'];\n dendapenalty = data_count['dendapenalty'];\n diskon_lunas = data_count['dis_lunas'];\n no_inst_preterm = data_count['no_inst_preterm'];\n totbung_tunggakan = data_count['totbung_tunggakan'];\n totpok_tunggakan = data_count['totpok_tunggakan'];\n\n //keperluan cetakan preterm syariah\n var tot_fas = data_count['tot_fas'];\n var sisa_ang = data_count['sisa_ang'];\n var tot_ang = data_count['tot_ang'];\n $('#fasilitas-preterm').val(accounting.formatMoney(tot_fas, '', 2, ',', '.'));\n $('#angsuran-ter-preterm').val(accounting.formatMoney(tot_ang, '', 2, ',', '.'));\n $('#sisa-ang-preterm').val(accounting.formatMoney(sisa_ang, '', 2, ',', '.'));\n\n\n isi_cabang(response['customer'][0]['branch_id']);\n $('#contract_preterm').val(response['customer'][0]['contract_no']);\n\n //label untuk syari'ah & konven\n $('#fintype-preterm').val(financetype);\n if (financetype =='SYARIAH')\n {\n document.getElementById('denda-preterm-cc').innerHTML = 'Sanksi yang harus dibayar Rp';\n document.getElementById('bunga-preterm-harian').innerHTML = 'Margin Harian Rp';\n document.getElementById('bunga-preterm-hapus').innerHTML = 'Margin yang dihapuskan Rp';\n document.getElementById('penalty-preterm-plus').innerHTML = 'Biaya'; \n\n }\n if (financetype =='KONVENSIONAL')\n {\n document.getElementById('denda-preterm-cc').innerHTML = 'Denda yang harus Dibayar Rp';\n document.getElementById('bunga-preterm-harian').innerHTML = 'Bunga Harian Berjalan Rp';\n document.getElementById('bunga-preterm-hapus').innerHTML = 'Bunga yang dihapuskan Rp';\n document.getElementById('penalty-preterm-plus').innerHTML = 'Penality Plus'; \n\n }\n\n $('#pelunasan-ke-pretem').val(pelunasan);\n $('#sisa-pokok-preterm').val(accounting.formatMoney(sisa_pokok, '', 2, ',', '.'));\n $('#tot-pokok-preterm').val(accounting.formatMoney(tot_pokok, '', 2, ',', '.'));\n $('#bunga-harian-preterm').val(accounting.formatMoney(bunga_berjalan, '', 2, ',', '.'));\n $('#denda-preterm').val(accounting.formatMoney(dendapenalty, '', 2, ',', '.'));\n\n //$('#tot-kewajiban-preterm').val(tot_wajib);\n $('#tot-titipan-preterm').val(accounting.formatMoney(titipan, '', 2, ',', '.'));\n $('#bunga-hapus-preterm').val(accounting.formatMoney(bunga_hapus, '', 2, ',', '.'));\n\n //show diskon pelunasan untuk kontrak syari'ah\n if (financode == 2) {\n $('#diskon-preterm-hide').show();\n $('#diskon-preterm').val(accounting.formatMoney(diskon_lunas, '', 2, ',', '.'));\n }\n table_asset_termination.clear().draw();\n\n $.each(response['customer'], function(index) {\n tgl_kontrak = this['contract_date'];\n no_cust = this['customer_no'];\n nama_cust = this['customer_name'];\n alamat = this['alamat_ktp'];\n due_date = this['due_date'];\n console.log(alamat);\n table_asset_termination.row.add([\n this['police_no'],\n this['engine_no'],\n this['chassis_no']\n ]).draw(false);\n $('#tgl-contract-preterm').val(tgl_kontrak);\n $('#no-cust-preterm').val(no_cust);\n $('#nama-cust-preterm').val(nama_cust);\n $('#alamat-termination').val(alamat);\n $('#tgl-tempo-termination').val(due_date);\n });\n\n\n $.each(response['DataMemo'], function() {\n pinalty_persen = this['adm_fee'];\n uang_bayar = this['fee_amt'];\n alasan = this['preterm_reason'];\n receive_no = this['receive_no'];\n pinalty_plus = this['termination_admin'];\n sumber_dana = this['fund_source'];\n memo = this['memo_no'];\n localStorage.setItem('rv_stat', this['rv_status']);\n var ref_flag = this['refinancing_flag'];\n var claim_status = this['claim_status'];\n var banding_status = this['banding_status'];\n var wf_status = this['wf_status'];\n var total_pokok = response['tenor'];\n var mydate = new Date(this['memo_date']);\n $('#inp-tgl-dummy').data(\"DateTimePicker\").date(mydate);\n var str = $('#inp-tgl-dummy').val();\n $('#tgl-memo-preterm').val(str);\n\n mydate = new Date(this['act_date']);\n $('#inp-tgl-dummy').data(\"DateTimePicker\").date(mydate);\n str = $('#inp-tgl-dummy').val();\n $('#tgl-pelunasan-preterm').val(str);\n\n //PDC\n if(this['payment_type'] == 1){\n $('input[type=radio][name=fillter_pembayaran][value=\"cash\"]').prop(\"checked\",false);\n $('input[type=radio][name=fillter_pembayaran][value=\"pdc\"]').prop(\"checked\",true);\n $('#btn-no-rv').hide();\n $('#btn-create-no-pdc').show();\n $('#div-show-pdc').show();\n $('#inp-pdc-pt').val(this['receive_no']);\n\n $('#inp-pdc-no-mdl').val(this['pdcno']);\n\n var mydate = new Date(this['pdcdate']);\n $('#inp-tgl-dummy').data(\"DateTimePicker\").date(mydate);\n var str = $('#inp-tgl-dummy').val();\n $('#inp-date-pdc-mdl').val(str);\n\n var mydate = new Date(this['pdcduedate']);\n $('#inp-tgl-dummy').data(\"DateTimePicker\").date(mydate);\n var str = $('#inp-tgl-dummy').val();\n $('#inp-due-date-mdl').val(str);\n\n $('#slc-bank-iss-mdl').val(this['bankid']);\n $('#inp-bank-branch-mdl').val(this['bankbr']);\n if(this['inkaso'] == 1){\n $('#chk-inkaso-pdc-dr').prop(\"checked\",true);\n }\n\n $('#inp-sts-pdc').val(this['statuspdc']);\n\n $('#inp-pdc-no-mdl').prop(\"disabled\", true);\n $('#inp-due-date-mdl').prop(\"disabled\", true);\n $('#slc-bank-iss-mdl').prop(\"disabled\", true);\n $('#inp-bank-branch-mdl').prop(\"disabled\", true);\n $('#chk-inkaso-pdc-dr').prop(\"disabled\", true);\n } //RV\n else {\n $('input[type=radio][name=fillter_pembayaran][value=\"cash\"]').prop(\"checked\",true);\n $('input[type=radio][name=fillter_pembayaran][value=\"pdc\"]').prop(\"checked\",false);\n $('#btn-no-rv').show();\n $('#btn-create-no-pdc').hide();\n $('#div-show-pdc').hide();\n $('#receive-preterm').val(this['receive_no']);\n\n $('#inp-pdc-no-mdl').prop(\"disabled\", false);\n $('#inp-due-date-mdl').prop(\"disabled\", false);\n $('#slc-bank-iss-mdl').prop(\"disabled\", false);\n $('#inp-bank-branch-mdl').prop(\"disabled\", false);\n $('#chk-inkaso-pdc-dr').prop(\"disabled\", false);\n }\n\n $('#pinalty-plus-preterm').val(accounting.formatMoney(pinalty_persen, '', 2, ',', '.'));\n $('#uang-bayar-preterm').val(accounting.formatMoney(uang_bayar, '', 2, ',', '.'));\n $('#receive-preterm').val(receive_no);\n $('#sumber-dana-preterm').val(sumber_dana);\n $('#reason-preterm').val(alasan);\n $('#no-memo-preterm').val(memo);\n $('#inp-statuswf-pt').val(wf_status);\n $('#inp-statusclaim-pt').val(claim_status);\n $('#inp-statusbanding-pt').val(banding_status);\n $('#total-pokok-preterm').val(total_pokok);\n\n //added by asb 17/04/18\n if(ref_flag == 'Y'){\n $('#slc-type-pelunasan option[value=Y]').prop('selected','selected');\n $('input[type=radio][name=fillter_pembayaran]').prop('checked', false);\n $('input[type=radio][name=fillter_pembayaran]').prop('disabled', true);\n $('#uang-bayar-preterm').prop('disabled', true);\n $(\"#btn-create-preterm\").html('Confirm');\n\n } else if(ref_flag == 'R') {\n //$(\"#slc-type-pelunasan\").val(\"R\").change();\n $('#slc-type-pelunasan option[value=R]').prop('selected','selected');\n $('input[type=radio][name=fillter_pembayaran]').prop('checked', false);\n $('input[type=radio][name=fillter_pembayaran]').prop('disabled', true);\n $('#denda-preterm').val(accounting.formatMoney(this['outst_penalty'], '', 2, ',', '.'));\n $('#uang-bayar-preterm').prop('disabled', true);\n $(\"#btn-create-preterm\").html('Confirm');\n } else {\n $('#slc-type-pelunasan option[value=N]').prop('selected','selected');\n $('input[type=radio][name=fillter_pembayaran]').prop('disabled', false);\n //$('#uang-bayar-preterm').prop('disabled', false);\n $(\"#btn-create-preterm\").html('Create RV/PDC');\n }\n\n $('input[type=radio][name=fillter_pembayaran]').prop('disabled', true);\n $('#slc-type-pelunasan').prop(\"disabled\",true); \n\n //resolve prod tidak count 0\n $('#bunga-harian-preterm').val(accounting.formatMoney(this['days_interest'], '', 2, ',', '.'));\n pinalty_plus = Math.round(pinalty_persen * parseFloat(this['outst_principal']) / 100);\n titipan = this['depo_amt'];\n tot_pokok = this['due_principal'] + this['due_interest'];\n $('#tot-pokok-preterm').val(accounting.formatMoney(tot_pokok, '', 2, ',', '.'));\n\n $('#hasil-pinalty-preterm').val(accounting.formatMoney(pinalty_plus, '', 2, ',', '.'));\n\n //diskon_lunas = this['outst_interest'] - this['days_interest'] - this['outst_penalty'];\n //diskon pelunasan untuk kontrak syari'ah\n diskon_lunas = this['outst_interest'] - this['days_interest'] - pinalty_plus;\n if (diskon_lunas < 0 && financode == 2) {\n diskon_lunas = 0;\n }\n //issue prod java tidak jalan, hasil count selalu 0\n // if (diskon_lunas !== 0) {\n // tot_wajib = parseFloat(sisa_pokok) + parseFloat(pinalty_plus) + parseFloat(dendapenalty) + parseFloat(bunga_berjalan) + parseFloat(tot_pokok);\n // } else {\n // tot_wajib = parseFloat(sisa_pokok) + parseFloat(bunga_hapus) + parseFloat(dendapenalty) + parseFloat(tot_pokok);\n // }\n $('#diskon-preterm').val(accounting.formatMoney(diskon_lunas, '', 2, ',', '.'));\n\n if (diskon_lunas !== 0) {\n tot_wajib = parseFloat(this['outst_principal']) + parseFloat(pinalty_plus) + parseFloat(this['outst_penalty']) + parseFloat(this['days_interest']) + parseFloat(tot_pokok);\n } else {\n tot_wajib = parseFloat(this['outst_principal']) + parseFloat(this['outst_interest']) + parseFloat(this['outst_penalty']) + parseFloat(tot_pokok);\n }\n\n total_bayar = tot_wajib - titipan;\n sisa_bayar = uang_bayar - total_bayar;\n console.log('total bayar: ' + total_bayar);\n console.log('selisih bayar: ' + sisa_bayar);\n\n $('#tot-titipan-preterm').val(accounting.formatMoney(this['depo_amt'], '', 2, ',', '.'));\n $('#tot-kewajiban-preterm').val(accounting.formatMoney(tot_wajib, '', 2, ',', '.'));\n $('#tot-bayarkan-preterm').val(accounting.formatMoney(total_bayar, '', 2, ',', '.'));\n $('#selisih-preterm').val(accounting.formatMoney(sisa_bayar, '', 2, ',', '.'));\n $('#btn-create-preterm').prop('disabled', false);\n $('#btn-cancel-preterm').prop('disabled', false);\n\n rv_stat = this['rv_status'];\n\n //rv status confirm / cancel\n if(rv_stat != '0' || sisa_pokok == 0){\n $('#pelunasan-ke-pretem').val(this['insta_no']);\n $('#sisa-pokok-preterm').val(accounting.formatMoney(this['outst_principal'], '', 2, ',', '.'));\n\n var tunggakanzz = this['due_interest'] + this['due_principal'];\n $('#tot-pokok-preterm').val(accounting.formatMoney(tunggakanzz, '', 2, ',', '.'));\n $('#bunga-harian-preterm').val(accounting.formatMoney(this['days_interest'], '', 2, ',', '.'));\n $('#denda-preterm').val(accounting.formatMoney(this['outst_penalty'], '', 2, ',', '.'));\n\n //$('#tot-kewajiban-preterm').val(tot_wajib);\n $('#tot-titipan-preterm').val(accounting.formatMoney(this['depo_amt'], '', 2, ',', '.'));\n $('#bunga-hapus-preterm').val(accounting.formatMoney(this['outst_interest'], '', 2, ',', '.'));\n pinalty_plus = Math.round(pinalty_persen * this['outst_principal'] / 100);\n $('#hasil-pinalty-preterm').val(accounting.formatMoney(pinalty_plus, '', 2, ',', '.'));\n\n //perhitungan diskon pelunasan kontrak syari'ah\n var diskons = this['outst_penalty'] - this['days_interest'] - pinalty_plus;\n if (diskons < 0 && financode == 2) {\n diskons = 0;\n }\n \n $('#pinalty-plus-preterm').prop('disabled',true);\n $('#uang-bayar-preterm').prop('disabled',true);\n $('#btn-create-preterm').prop('disabled',true);\n $('#btn-save-preterm').prop('disabled',true);\n //$('#btn-print-preterm').prop('disabled',true);\n $('#btn-cancel-preterm').prop('disabled',true);\n\n tot_pokok = this['due_principal'] + this['due_interest'];\n\n total_bayar = tot_wajib - this['depo_amt'];\n console.log('total bayar: ' + total_bayar);\n sisa_bayar = uang_bayar - total_bayar;\n $('#tot-kewajiban-preterm').val(accounting.formatMoney(tot_wajib, '', 2, ',', '.'));\n $('#tot-bayarkan-preterm').val(accounting.formatMoney(total_bayar, '', 2, ',', '.'));\n $('#selisih-preterm').val(accounting.formatMoney(sisa_bayar, '', 2, ',', '.'));\n\n if(rv_stat == '2'){\n alert_info(\"Memo telah tercancel\");\n } else if(rv_stat == '1'){\n if (this['receive_no'] == null){\n $('#tot-pokok-preterm').val(accounting.formatMoney(tot_pokok, '', 2, ',', '.'));\n alert_info(\"Memo telah terconfirm\");\n } else {\n if(this['payment_type'] == 1){\n alert_info(\"Memo telah terconfirm dengan no PDC \"+ this['receive_no']);\n } else {\n alert_info(\"Memo telah terconfirm dengan no RV \"+ this['receive_no']);\n }\n $('#tot-pokok-preterm').val(accounting.formatMoney(response['tunggakanmemo'], '', 2, ',', '.'));\n } \n }else {\n alert_info(\"Kontrak sudah tidak aktif\");\n }\n }\n });\n\n ref_bayar = $('#uang-bayar-preterm').val();\n localStorage.setItem('cont_pret', $('#contract_preterm').val());\n localStorage.setItem('memo_pret', $('#no-memo-preterm').val());\n //$('#pinalty-plus-preterm').change(); \n\n }\n } catch (e) {\n $('#loading-ajax').hide();\n alert_error('Terjadi Kesalahan error{get_data_memo} =>' + e);\n }\n\n } \n }catch (e) {\n $('#loading-ajax').hide();\n alert_error('Data tidak ditemukan');\n }\n\n\n },\n error: function(response) {\n console.log(response);\n alert_error('Tidak terhubung dengan server'); },async : false\n\n });\n //get_termiSya(); remark karena prosesnya bisa disederhanakan\n }", "function validarNombreCliente(){\r\n var elem = document.getElementById('agnombre').value;\r\n var rtdo = false;\r\n var msg = \"\";\r\n \r\n var datos = {\r\n nombre: elem\r\n }\r\n\r\n $.ajax({\r\n url:'buscarNombreCliente.php',\r\n type: 'POST',\r\n async: false,\r\n data: datos,\r\n success:function(datosRecibidos) {\r\n json = JSON.parse(datosRecibidos);\r\n rtdo =json;\r\n if(json){\r\n \r\n }else{\r\n msg = \"Ese nombre de cliente ya se encuentra registrado\"; \r\n \r\n }\r\n }\r\n })\r\n\r\n setValitationMesage('msjValidacionNombreCliente', rtdo, msg);\r\n return rtdo;\r\n \r\n}", "function startMeetingAjaxFailure(ajax) {\r\n\t\t$(\"#meeting-info\").html(ajax.responseText);\r\n\t}", "function ajaxPost() {\r\n\t// Check the validation to see if the call should be made\r\n\tif(validate()){\r\n\t\t// AJAX call begin\r\n\t\t$.ajax(\"/register\",{\r\n\t\t\t// serialize the data\r\n\t\t\tdata:$(\"#register\").serializeArray(),\r\n\t\t\ttype:\"POST\",\r\n\t\t\tdataType:\"text\",\r\n\t\t\t// on error (which with validation there never should be)\r\n\t\t\t// inform the user\r\n\t\t\terror: function(data){alert(\"A server error has occurred.\" + data.toString());},\r\n\t\t\t// on success\r\n\t\t\tsuccess: function(data){\r\n\t\t\t\t// if there are no error messages to return\r\n\t\t\t\tif(data==\"true\"){\r\n\t\t\t\t\t// go back to the login page\r\n\t\t\t\t\twindow.location.assign(\"/login\")\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// otherwise print the error message box\r\n\t\t\t\t\terror(data);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t} else {\r\n\t\t// the validation is checking only that the form was filled out (as the\r\n\t\t// rest of the validation is handled live and won't let us click the\r\n\t\t// submit button if it doesn't pass\r\n\t\terror(\"Please complete the form before submitting!\");\r\n\t}\r\n}", "function validate_ajax(obj) {\n\tvar subject = $('subject');\n\tif (subject) {\n\t\tvar slen = strlen(subject.value);\n\t\tif (slen < 1 || slen > 80) {\n\t\t\talert(\"标题长度(1~80字符)不符合要求\");\n\t\t\tsubject.focus();\n\t\t\treturn false;\n\t\t}\n\t}\n\tif($('seccode')) {\n\t\tvar code = $('seccode').value;\n\t\tvar x = new Ajax();\n\t\tx.get('cp.php?ac=common&op=seccode&code=' + code, function(s){\n\t\t\ts = trim(s);\n\t\t\tif(s.indexOf('succeed') == -1) {\n\t\t\t\talert(s);\n\t\t\t\t$('seccode').focus();\n\t\t \t\treturn false;\n\t\t\t} else {\n\t\t\t\tedit_save();\n\t\t\t\tobj.form.submit();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\t} else {\n\t\tedit_save();\n\t\tobj.form.submit();\n\t\treturn true;\n\t}\n}", "function updateStatus_2(pmiNo, episodeDate, status, preStatus) {\n\n $.ajax({\n url: 'search/changeStatus_2.jsp',\n method: 'POST',\n data: {\n status: status,\n pmiNo: pmiNo,\n episodeDate: episodeDate,\n preStatus: preStatus\n },\n success: function (result) {\n\n if (result.trim() === \"|1|\") {\n\n var patient = findPatient(pmiNo, episodeDate);\n var getPDIInfo = getPDI(pmiNo, episodeDate);\n reloadStat = \"1\";\n\n } else {\n\n //pmiNo = \"\";\n bootbox.alert(\"The patient has been taken by other doctor.\");\n clearCIS();\n\n }\n\n },\n error: function (err) {\n\n console.log(err);\n\n }\n });\n}", "function check_if_teams_ready() {\n $.ajax({\n data: {\n check: 'teams_ready',\n period: get_period()\n },\n success: function(data, textStatus) {\n if ('teams_ready' in data) {\n if (data['teams_ready']) {\n var per_btn = $('#next_period_btn');\n per_btn.attr('disabled', false);\n per_btn.val('Start next period');\n $('#order_btn').stopTime();\n }\n }\n else if ('error' in data) {\n log_error(data['error']);\n }\n }\n });\n\n}", "function updateReturnRecord(){\n $.ajax({\n method:'POST',\n url:url3,\n data:{_token:token, returnid:return_id, data: $('#form').serialize()},\n success:function(data){\n successHTML = '<div class=\"alert-success alert\"><ul>';\n successHTML += '<li> Records added successfully </li>';\n successHTML += '</ul></di>';\n $( '#form-errors' ).html( successHTML );\n $( '#wcn_btn').prop( \"disabled\", false );\n //console.log(data);\n },\n });\n console.log('done');\n\n}", "checkReadyForSubmit(){\n if(this.checkAnswersReady() && this.checkAddressReady() && this.checkMembership()){\n return true;\n }\n else{\n return false;\n }\n }", "function emailCheck(){\n $(\"#check_email\").val($(\"#check_email_message\"));\n\n $.ajax({\n url : $('#baseUrl').val() + \"/checkout/sign_up_and_login/check_email\",\n data: {\n email : $(\"#email\").val()\n },\n type : 'post',\n success : function(result) {\n HoldOn.close();\n var rs = JSON.parse(result);\n\n if (rs.state == \"success\") {\n $(\"#check_email\").css(\"color\", \"#6FD508\");\n $(\"#check_email\").html(rs.message);\n\n }else{\n $(\"#check_email\").css(\"color\", \"red\");\n $(\"#check_email\").html(rs.message);\n }\n },\n error : function() {\n HoldOn.close();\n alert($(\"#error_network_msg\").val());\n }\n });\n}", "function loadAjax(data, url, loadAJAX){\n $('#errMsgContainer').hide();\n $('#succMsgContainer').hide();\n $('#warnMsgContainer').hide();\n if(data != '') {\n $.ajax({\n type: \"POST\",\n url: url,\n data:data\n ,\n error: function (xhr, status, error) {\n alert(xhr.responseText);\n },\n success: function (result) {\n jsonAjax = jQuery.parseJSON(result);\n\n if(jsonAjax.html != '' && jsonAjax.html != undefined) {\n $(\"#\" + loadAJAX).html(jsonAjax.html);\n }\n\n if(jsonAjax.number_updates != '' && jsonAjax.number_updates != undefined && jsonAjax.number_updates != \"0\"){\n $('#succMsgContainer').show();\n $('#succMsgContainer').html(' <a href=\"#\" class=\"close\" data-dismiss=\"alert\" aria-label=\"close\">&times;</a> <strong>Success!</strong> '+jsonAjax.number_updates+' NEW Latest update/s were saved.');\n }\n\n if(jsonAjax.variablesInfo != '' && jsonAjax.variablesInfo != undefined){\n var value = jsonAjax.variablesInfo;\n $.each(jsonAjax.variablesInfo, function (i, object) {;\n if(object.display == \"none\"){\n $(\"#\"+i+\"_row\").hide();\n }else{\n $(\"#\"+i+\"_row\").show();\n };\n });\n }\n\n //If table sortable add function\n if(jsonAjax.sortable == \"true\"){\n $(\"#\"+loadAJAX+\"_table\").tablesorter();\n }\n\n //Error Messages (Successful, Warning and Error)\n if(jsonAjax.succmessage != '' && jsonAjax.succmessage != undefined ){\n $('#succMsgContainer').show();\n $('#succMsgContainer').html(jsonAjax.succmessage);\n }else if(jsonAjax.warnmessage != '' && jsonAjax.warnmessage != undefined ){\n $('#warnMsgContainer').show();\n $('#warnMsgContainer').html(jsonAjax.warnmessage);\n }else if(jsonAjax.errmessage != '' && jsonAjax.errmessage != undefined ){\n $('#errMsgContainer').show();\n $('#errMsgContainer').html(jsonAjax.errmessage);\n }\n\n $('.divModalLoading').hide();\n }\n });\n }\n}", "function validarNombreClienteEditar(){\r\n var elem = document.getElementById('editarNombre').value;\r\n var id = document.getElementById('editarId').value;\r\n var rtdo = false;\r\n var msg = \"\";\r\n \r\n var datos = {\r\n nombre: elem,\r\n id : id\r\n }\r\n\r\n $.ajax({\r\n url:'buscarNombreCliente.php',\r\n type: 'POST',\r\n async: false,\r\n data: datos,\r\n success:function(datosRecibidos) {\r\n json = JSON.parse(datosRecibidos);\r\n rtdo =json;\r\n if(json){\r\n \r\n }else{\r\n msg = \"Ese nombre de cliente ya se encuentra registrado\"; \r\n \r\n }\r\n }\r\n })\r\n\r\n setValitationMesage('msjValidacionNombreClienteEditar', rtdo, msg);\r\n return rtdo;\r\n \r\n}", "ajaxReNumberAll() {\n let $ = jQuery.noConflict();\n let thisClass = this;\n\n if (this.xhrIsWorking === true) {\n alert(RdPostOrderObj.txtPreviousXhrWorking);\n return false;\n }\n\n let confirmed_val = confirm(RdPostOrderObj.txtConfirmReorderAll);\n\n if (confirmed_val === true) {\n thisClass.xhrIsWorking = true;\n thisClass.disablePostSortable();\n $('.form-result-placeholder').html('');\n\n let formData = {\n 'action': 'RdPostOrderReNumberAll',\n 'security': RdPostOrderObj.ajaxnonce,\n '_wp_http_referer': $('input[name=\"_wp_http_referer\"]').val(),\n 'paged': ($.query.get('paged') ? $.query.get('paged') : 1),\n 'hookName': RdPostOrderObj.hookName,\n }\n\n $.ajax({\n url: ajaxurl,\n type: 'POST',\n data: formData,\n dataType: 'json'\n })\n .done((response, textStatus, jqXHR) => {\n // displaying result to the page.\n thisClass.displayNoticeElement(response, response, 'notice-error');\n\n if (typeof(response) !== 'undefined') {\n thisClass._ajaxReplaceTable(response);\n }\n })\n .fail((jqXHR, textStatus, errorThrown) => {\n let errResponse = jqXHR.responseJSON;\n let errResponseText = jqXHR.responseText;\n\n thisClass.displayNoticeElement(errResponse, errResponseText, 'notice-error');\n })\n .always((jqXHR, textStatus, errorThrown) => {\n let response;\n if (textStatus === 'success') {\n response = jqXHR;\n } else {\n response = jqXHR.responseJSON;\n }\n // mark XHR is not working.\n thisClass.xhrIsWorking = false;\n // re-activate sortable\n thisClass.enablePostSortable();\n });\n }// endif; confirmed\n\n return false;\n }", "function ajaxClearSchedule( url )\n{\n if(confirm('Are you sure you want to clear all vendors schedule.')) {\n $('.ajaxLoading').show();\n $.post( url+'/delete',function( data ) {\n\n if(data.status =='success')\n {\n console.log(\"called succes\");\n notyMessage(data.message);\n } else {\n console.log(\"called error\");\n notyMessageError(data.message);\n }\n $('.ajaxLoading').hide();\n });\n\n }\n \n}", "function errorFromAjaxCall( data , textStatus )\n{\n stringToApp = '<pre>' + preJs( data );\n (textStatus != undefined) ? stringToApp += ' textStatus= ' + textStatus : '';\n stringToApp += '</pre>';\n $( \"#errorMsgAjax\" ).append( stringToApp );\n\n\n}", "function checkOrders(){\n $.ajax({\n url: \"staffRequest.php?\",\n type: \"POST\",\n data: {\n \"action\" : \"orders\"\n },\n dataType : \"json\",\n success : handleResponse,\n error : ajaxFailed\n }\n\n );\n}", "function responder_registro() {\n\n if (objAjax.readyState == 4){\n if (objAjax.status == 200) {\n\n if (objAjax.responseText == \"false\") {\n\n alert(\"Datos introducidos incorrectos\");\n\n } else {\n\n mensaje_boton(\"Usuario añadido correctamente\", \"resumen_cita()\"); \n }\n }\n }\n}", "function loadForm() {\n //Declare a variable and store shrinkageBatch table ajax call in it\n var inventoryTransferAjax = $.ajax({\n url: inventoryTransferApiUrl + '/Get/' + inventoryTransferId,\n type: 'Get',\n contentType: 'application/json',\n beforeSend: function (req) {\n req.setRequestHeader('Authorization', \"coreBearer \" + authToken);\n }\n });\n\n //Declare a variable and store location table ajax call in it\n var locationAjax = $.ajax({\n url: locationApiUrl + '/Get',\n type: 'Get',\n beforeSend: function (req) {\n req.setRequestHeader('Authorization', \"coreBearer \" + authToken);\n }\n });\n\n //Declare a variable and store inventoryItem table ajax call in it\n var inventoryItemAjax = $.ajax({\n url: inventoryItemApiUrl + '/Get',\n type: 'Get',\n beforeSend: function (req) {\n req.setRequestHeader('Authorization', \"coreBearer \" + authToken);\n }\n });\n\n var accountAjax = $.ajax({\n url: acctsApiUrl + '/Get',\n type: 'Get',\n beforeSend: function (req) {\n req.setRequestHeader('Authorization', \"coreBearer \" + authToken);\n }\n });\n\n $.when(inventoryTransferAjax, locationAjax, inventoryItemAjax, accountAjax)\n .done(function (dataInventoryTransfer, dataLocation, dataInventoryItem, dataAccountAjax) {\n inventoryTransfer = dataInventoryTransfer[2].responseJSON;\n locations = dataLocation[2].responseJSON;\n inventoryItems = dataInventoryItem[2].responseJSON;\n accts = dataAccountAjax[2].responseJSON;\n //Prepares UI\n prepareUi();\n\n });\n}", "function runBatch(){\n $.ajax({\n url : \"/ajax_handler/run_batch/\",\n type: \"post\",\n data : {\n 'csrfmiddlewaretoken' : $(\"input[name=csrfmiddlewaretoken]\").val(),\n 'master_files' : $('input[name=\"master_files\"]:checked').map(function(){\n return $(this).val();\n }).get(),\n 'source_files' : $('input[name=\"source_files\"]:checked').map(function(){\n return $(this).val();\n }).get(),\n 'exact_matches': $(\".exact_matches\").is(\":checked\")? \"True\":\"False\"\n },\n dataType: \"html\",\n success: function(data, textStatus, jqXHR){\n //try to append the html data recieved\n console.log(data);\n $('#loading').hide();\n $('#results').show();\n $(\"#result_div\").html(data);\n }\n,\n error: function(jqXHR, textStatus, errorThrown){\n alert(textStatus)\n\n }\n\n });\n}", "function pesquisaEventosAjax()\r\n{\r\n\tif ($(\"#cd_contrato_evento\").val() != \"0\") {\r\n\t\t$.ajax({\r\n\t\t\ttype\t: \"POST\",\r\n\t\t\turl\t\t: systemName+\"/ocorrencia-administrativa/pesquisa-eventos\",\r\n\t\t\tdata\t: \"cd_contrato=\"+$(\"#cd_contrato_evento\").val(),\r\n\t\t\tdataType: 'json',\r\n\t\t\tsuccess\t: function(retorno){\r\n\t\t\t\tevent1 = retorno[0];\r\n\t\t\t\tevent2 = retorno[1];\r\n\t\t\t\t$(\"#cd_evento\").html(event1);\r\n\t\t\t\t$(\"#cd_evento2\").html(event2);\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n}", "function freePass() {\n\n $.ajax({\n url:\"free-pass.php\",\n method:\"POST\"\n }).done(function(result) {\n console.log(result);\n\n if (result = JSON.parse(result)) {\n\n //hideAll(result.state);\n\n if (result.status == true) {\n msg(false, false, \"game-drink-or-dare-free-pass-success\", \"Free Pass\", \"success\");\n } else {\n msg(false, false, \"game-drink-or-dare-free-pass-failure\", \"Free Pass\", \"danger\");\n }\n }\n });\n \n}", "ajaxSuccessAndContinue(response) {\n\n // Save Authorize State.\n this.props.saveState({\n authorize: {\n ...this.props.state.authorize,\n id: response.transactionId,\n success: response.success ? 1 : 0,\n attemptFailure: !response.success ? 1 : 0\n }\n })\n\n // AJAX Wordpress DB\n this.props.ajaxWordpressDB({\n authorize_id: response.transactionId,\n payment_status: response.success ? 1 : 0,\n attempt_failure: !response.success ? 1 : 0,\n total: this.props.state.payment.total.toFixed(2),\n address: this.address.value,\n city: this.city.value,\n zip: this.zip.element.value,\n state: this.st.value,\n })\n\n // AJAX Email\n this.props.ajaxEmail({\n member_id: this.props.state.user.id,\n first_name: this.props.state.user.firstName,\n last_name: this.props.state.user.lastName,\n email: this.props.state.user.email,\n address: this.address.value,\n city: this.city.value,\n state: this.st.value,\n zip: this.zip.element.value,\n authorize_id: response.transactionId,\n authorize_code: response.authCode,\n authorize_method: response.authMethod,\n membership: this.props.state.user.membership,\n membership_name: memberships[this.props.state.user.membership].name,\n payment_price: this.props.state.payment.price.toFixed(2),\n payment_taxRate: this.props.state.payment.taxRate,\n payment_taxTotal: this.props.state.payment.taxTotal.toFixed(2),\n payment_total: this.props.state.payment.total.toFixed(2),\n })\n\n // Next Step.\n this.props.nextStep()\n }", "function checkBalanceAndAccountStatus(this_){\n\n\tvar accountID = $(this_).val();\n\tif(accountID!==\"\"){\n\t\n $.ajax({ \n type: \"post\",\n data: {'accountNumber':accountID},\n url: \"personal/account/utilaccount\",\n cache: false,\n success:function(response){\n\t\t\t\n\t\t\t\tvar balance = response[\"currencyCode\"] +\" \"+ parseFloat(response[\"availableBalance\"], 10).toFixed(2).replace(/(\\d)(?=(\\d{3})+\\.)/g, \"$1,\").toString();\n $(this_+\"-result\").html(\"<em>Available \"+ balance);\n\t\t\t\t\n //CHECK ACCOUNT STATUS ON CHANGE\n if((response[\"black_listed\"] == true)){\n\t\t\t\t\n\t\t\t\t $(\"#accountBlackList\").removeClass(\"hide\");\n\t\t\t\t $(\"#fund-transfer-submit\").hide();\n }else{\n\t\t\t\t $(\"#accountBlackList\").addClass(\"hide\");\n\t\t\t\t $(\"#fund-transfer-submit\").show();\n }\n\t\t\t\t$(\"#currency\").val(response[\"currencyCode\"]);\n // alert(\"This is value : \");\n }, error: function(){\n //alert('Error while request..');\n }\n });\n } else { $(this_+\"-result\").html(\"<em>...</em>\"); }\n}" ]
[ "0.6774079", "0.66162777", "0.6510559", "0.62415147", "0.622469", "0.6218894", "0.6197411", "0.6181763", "0.61525995", "0.61516535", "0.61318296", "0.61312693", "0.61196315", "0.6118138", "0.6117282", "0.6114084", "0.6113576", "0.6085875", "0.60853696", "0.6078049", "0.6077572", "0.6076316", "0.6073947", "0.6063297", "0.605973", "0.60536677", "0.6045573", "0.60440993", "0.6015345", "0.6013622", "0.6011871", "0.60112065", "0.5982596", "0.59729236", "0.5971456", "0.59626323", "0.5952651", "0.59525573", "0.59490454", "0.59479934", "0.5936133", "0.59344333", "0.59344333", "0.59344333", "0.59285927", "0.59226006", "0.5921801", "0.5920389", "0.5912818", "0.5908507", "0.5905654", "0.5903223", "0.58916414", "0.5891143", "0.5889907", "0.5885745", "0.5881016", "0.58791196", "0.587893", "0.5875104", "0.58744454", "0.5871327", "0.5857051", "0.5854362", "0.58506733", "0.58505964", "0.5844309", "0.5841292", "0.5837094", "0.5831009", "0.5830607", "0.5830122", "0.5824999", "0.58213174", "0.5819914", "0.5819498", "0.5817691", "0.5814769", "0.5814552", "0.5814204", "0.5803161", "0.57994604", "0.57983446", "0.579779", "0.57977253", "0.57917947", "0.57856226", "0.5784388", "0.5783903", "0.5783308", "0.57827646", "0.5780771", "0.5779684", "0.5773466", "0.57700694", "0.5768798", "0.57613856", "0.5760352", "0.57553226", "0.57477236", "0.57476705" ]
0.0
-1
flag usada para ver se o usuario quer os manipuladores com profundidade ou nao generate a quadrilateral with triangles
function quad(a, b, c, d) { var t1 = subtract(vertices[b], vertices[a]); var t2 = subtract(vertices[c], vertices[b]); var normal = vec4(cross(t1, t2), 0); pointsArray.push(vertices[a]); normalsArray.push(normal); pointsArray.push(vertices[b]); normalsArray.push(normal); pointsArray.push(vertices[c]); normalsArray.push(normal); pointsArray.push(vertices[a]); normalsArray.push(normal); pointsArray.push(vertices[c]); normalsArray.push(normal); pointsArray.push(vertices[d]); normalsArray.push(normal); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawTriangle() {\n const canvas=document.getElementById(\"canvas4\");\n const ctx=canvas4.getContext(\"2d\");\n ctx.clearRect(0, 0, 1024, 512);\n\n let side1=prompt(\"Pick the length of the first side\")\n side1=Number(side1)\n\n let side2=prompt(\"Pick the length of the second side\")\n side2=Number(side2)\n\n let side3=prompt(\"Pick the length of the third side\")\n side3=Number(side3)\n\n while((side1*side1) + (side2*side2) != (side3*side3) || side1+10 >=512 || side2+10 >= 1024){\n alert(\"This is not a valid right triangle\")\n side1=prompt(\"Pick the length of the first side\")\n side1=Number(side1)\n side2=prompt(\"Pick the length of the second side\")\n side2=Number(side2)\n side3=prompt(\"Pick the length of the third side\")\n side3=Number(side3)\n }\n\n side1=side1+10\n side2=side2+10\n\n ctx.beginPath();\n ctx.moveTo(10, 10);\n ctx.lineTo(10, side1);\n ctx.lineTo(side2, side1);\n ctx.lineTo(10, 10);\n ctx.stroke();\n}", "function drawTriangle() {\n let op = document.getElementById(\"canvas4\").getContext(\"2d\");\n op.clearRect(0, 0, 1024, 512);\n let sides = [];\n let input;\n for (let i = 0; i<3; i++){\n do {\n input = Number(prompt(`Side ${i+1}:`));\n } while (isNaN(input) || input<=0);\n sides.push(input);\n }\n let a = Math.min(...sides);\n let c = Math.max(...sides);\n let b = sides.reduce((x,y) => x + y, 0) - a - c;\n if (c*c != a*a+b*b){\n alert(\"This is not a valid right triangle.\");\n } else if (a>1024 || b>512){\n alert(\"The triangle will not fit on the canvas.\");\n } else {\n op.beginPath();\n op.moveTo(10,10);\n op.lineTo(10, a+10);\n op.lineTo(b+10, a+10);\n op.lineTo(10,10);\n op.stroke();\n op.closePath();\n }\n}", "function drawTriangle() {\n var a = Number(prompt('Please enter side length'));\n var b = Number(prompt('Please enter side length'));\n var c = Number(prompt('Please enter side length'));\n let hypotenuse = Math.max(a, b, c);\n let left = Math.min(a, b, c);\n let bottom = a+b+c-hypotenuse-left;\n if (isNaN(a) || isNaN(b) || isNaN(c)) {\n alert('This is not a valid triangle')\n }\n else if (left**2 + bottom**2 != hypotenuse**2) {\n alert('This is not a valid right triangle');\n }\n else if (bottom>1024 || left>512) {\n alert('This is not a valid right triangle');\n }\n else{\n let triangle = document.getElementById('canvas4');\n if (canvas4.getContext) {\n var drawing = canvas4.getContext('2d');\n drawing.clearRect(0,0,1024,512);\n drawing.beginPath();\n drawing.moveTo(10, 10);\n drawing.lineTo(10, 10+left);\n drawing.lineTo(10+bottom, 10+left);\n drawing.lineTo(10,10);\n drawing.stroke()\n }\n }\n}", "checkTriangle(x,y,z){\n\t\tlet segmentA = x;\n\t\tlet segmentB = y;\n\t\tlet pointX = z;\n\t\tlet pointA = segmentA.a\n\t\tlet pointB = segmentA.b\n\t\tlet pointC = segmentB.b\n\t\tlet Ax = pointA[0];\n\t\tlet Ay = pointA[1];\n\t\tlet Bx = pointB[0];\n\t\tlet By = pointB[1];\n\t\tlet Cx = pointC[0];\n\t\tlet Cy = pointC[1];\n\t\tlet Xx = pointX[0];\n\t\tlet Xy = pointX[1];\n\t\tlet c = Math.sqrt((Ax-Bx)*(Ax-Bx)+(Ay-By)*(Ay-By))\n\t\tlet a = Math.sqrt((Bx-Cx)*(Bx-Cx)+(By-Cy)*(By-Cy))\n\t\tlet b = Math.sqrt((Ax-Cx)*(Ax-Cx)+(Ay-Cy)*(Ay-Cy))\n\t\tlet xa = Math.sqrt((Xx-Ax)*(Xx-Ax)+(Xy-Ay)*(Xy-Ay))\n\t\tlet xb = Math.sqrt((Xx-Bx)*(Xx-Bx)+(Xy-By)*(Xy-By))\n\t\tlet xc = Math.sqrt((Xx-Cx)*(Xx-Cx)+(Xy-Cy)*(Xy-Cy))\n\t\tlet gamma1 = Math.acos((xa*xa + xb*xb -c*c)/(2*xa*xb))\n\t\tlet gamma2 = Math.acos((xb*xb + xc*xc -a*a)/(2*xb*xc))\n\t\tlet gamma3 = Math.acos((xa*xa + xc*xc -b*b)/(2*xa*xc))\n\t\tlet result = gamma1+gamma2+gamma3\n\t\t//on edge or point will return true\n\t\tif (Math.round((result - Math.PI*2)*1000)){\n\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\treturn true;\n\t\t}\n\t}", "canPickTriangle() {\n }", "function isTriangle(a,b,c){\n let numbers = [a,b,c];\n for (let i = 0; i <= 2; i++) {\n if ((Number.isInteger(numbers[i])) == false) {\n console.log(`ERROR: number \"${numbers[i]}\" is not an integer`);\n return false;\n }\n else if (numbers[i] <= 0) {\n console.log( `ERORR: \"${numbers[i]}\" is not a side of triangle`);\n return false;\n }\n }\n if (a + b <= c) {\n console.log(`ERROR: number ${c} is not a side of triangle`);\n return false;\n }\n if (a + c <= b) {\n console.log(`ERROR: number ${b} is not a side of triangle`);\n return false;\n }\n if (b + c <= a) {\n console.log(`ERROR: number ${a} is not a side of triangle`);\n return false;\n } \n return true;\n}", "function isTriangle(a,b,c){\n \n let fierst =( a+b) > c;\n let second =( a+c) > b;\n let third =( b+c) > a;\n if(fierst && second && third){\n return true;\n }else return false\n \n}", "function is_triangle(a,b,c){\n if (a <= 0 || b <=0 || c <= 0){\n return false\n } else if ((a+b)>c && (a+c > b) && (c+b > a)){\n return true\n } else{\n return false\n }\n}", "generateTriangles() {\n\t\tvar icosphere = Icosphere.create(this.config.recursion_level);\n\n\t\tthis.triangles = icosphere.triangles;\n\t}", "function hexagon(sideLegnth){\n for(\n var i =0; i<6; i =i+1){\n triangle(sideLegnth)\n right(45)\n \n \n }\n \n\n\n}", "function isTriangle(a,b,c){\nvar length1 = a+b\nvar length2 = b+c\nvar length3 = a+c\n\n//conditional\n\nif(length1 > c && length2 > a && length3 > b ){\n return true;\n}else{\n return false;\n}\n}", "function makeCube (subdivisions) {\n \n // fill in your code here.\n // delete the code below first.\n\n\t//// Old code\n //addTriangle (-0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5);\n\n\t// var A = [-0.5, 0.5, 0.5];\n\t// var B = [ 0.5, 0.5, 0.5];\n\t// var C = [-0.5, -0.5, 0.5];\n\t// var D = [ 0.5, -0.5, 0.5];\n\t// var E = [-0.5, 0.5, -0.5];\n\t// var F = [ 0.5, 0.5, -0.5];\n\t// var G = [-0.5, -0.5, -0.5];\n\t// var H = [ 0.5, -0.5, -0.5];\n\n\t// var triangles = [\n\t// \t[A, C, B],\n\t// \t[B, C, D],\n\t// \t[E, A, F],\n\t// \t[F, A, B],\n\t// \t[E, G, A],\n\t// \t[A, G, C],\n\t// \t[B, D, F],\n\t// \t[F, D, H],\n\t// \t[F, H, E],\n\t// \t[E, H, G],\n\t// \t[H, D, G],\n\t// \t[G, D, C]\n\n\t// ];\n\n\t// // while subdivision is not finished , generate more triangles from last triangles array\n\t// while (subdivisions > 0){\n\t// \ttri_num = triangles.length;\n\t// \tfor(var i=0; i<tri_num; i++){\n\t// \t\tvar this_tri = triangles.shift();\n\t// \t\tvar m1 = [\n\t// \t\t\t(this_tri[0][0] + this_tri[1][0]) / 2,\n\t// \t\t\t(this_tri[0][1] + this_tri[1][1]) / 2,\n\t// \t\t\t(this_tri[0][2] + this_tri[1][2]) / 2\n\t// \t\t];\n\t// \t\tvar m2 = [\n\t// \t\t\t(this_tri[0][0] + this_tri[2][0]) / 2,\n\t// \t\t\t(this_tri[0][1] + this_tri[2][1]) / 2,\n\t// \t\t\t(this_tri[0][2] + this_tri[2][2]) / 2\n\t// \t\t];\n\t// \t\tvar m3 = [\n\t// \t\t\t(this_tri[1][0] + this_tri[2][0]) / 2,\n\t// \t\t\t(this_tri[1][1] + this_tri[2][1]) / 2,\n\t// \t\t\t(this_tri[1][2] + this_tri[2][2]) / 2\n\t// \t\t];\n\t// \t\tvar v0 = this_tri[0];\n\t// \t\tvar v1 = this_tri[1];\n\t// \t\tvar v2 = this_tri[2];\n\n\t// \t\ttriangles.push([v0, m1, m2]);\n\t// \t\ttriangles.push([m2, m1, m3]);\n\t// \t\ttriangles.push([m1, v1, m3]);\n\t// \t\ttriangles.push([m2, m3, v2]);\n\t// \t}\n\n\t// \tsubdivisions --;\n\n\t// }\n\t//// Old code\n\n\tvar triangles = [];\n\tconst step = 1 / subdivisions;\n\n\t// Front\n\tfor(var i=0; i<subdivisions; i++){\n\t\tfor(var j=0;j<subdivisions;j++){\n\t\t\tvar v0 = [-0.5 + i*step, -0.5 + j*step, 0.5];\n\t\t\tvar v1 = [-0.5 + (i+1)*step, -0.5 + j*step, 0.5];\n\t\t\tvar v2 = [-0.5 + i*step, -0.5 + (j+1)*step, 0.5];\n\t\t\tvar v3 = [-0.5 + (i+1)*step, -0.5 + (j+1)*step, 0.5];\n\n\t\t\ttriangles.push([v0, v3, v2]);\n\t\t\ttriangles.push([v0, v1, v3]);\n\t\t}\n\t}\n\n\t// Left\n\tfor(var i=0; i<subdivisions; i++){\n\t\tfor(var j=0;j<subdivisions;j++){\n\t\t\tvar v0 = [-0.5, -0.5+i*step, -0.5+j*step];\n\t\t\tvar v1 = [-0.5, -0.5+(i+1)*step, -0.5+j*step];\n\t\t\tvar v2 = [-0.5, -0.5+i*step, -0.5+(j+1)*step];\n\t\t\tvar v3 = [-0.5, -0.5+(i+1)*step, -0.5+(j+1)*step];\n\n\t\t\ttriangles.push([v0, v2, v3]);\n\t\t\ttriangles.push([v0, v3, v1]);\n\t\t}\n\t}\n\n\t// Right\n\tfor(var i=0; i<subdivisions; i++){\n\t\tfor(var j=0;j<subdivisions;j++){\n\t\t\tvar v0 = [0.5, -0.5+i*step, -0.5+j*step];\n\t\t\tvar v1 = [0.5, -0.5+(i+1)*step, -0.5+j*step];\n\t\t\tvar v2 = [0.5, -0.5+i*step, -0.5+(j+1)*step];\n\t\t\tvar v3 = [0.5, -0.5+(i+1)*step, -0.5+(j+1)*step];\n\n\t\t\ttriangles.push([v0, v3, v2]);\n\t\t\ttriangles.push([v0, v1, v3]);\n\t\t}\n\t}\n\n\t// Top\n\tfor(var i=0; i<subdivisions; i++){\n\t\tfor(var j=0;j<subdivisions;j++){\n\t\t\tvar v0 = [-0.5+i*step, 0.5, -0.5+j*step];\n\t\t\tvar v1 = [-0.5+(i+1)*step, 0.5, -0.5+j*step];\n\t\t\tvar v2 = [-0.5+i*step, 0.5, -0.5+(j+1)*step];\n\t\t\tvar v3 = [-0.5+(i+1)*step, 0.5, -0.5+(j+1)*step];\n\n\t\t\ttriangles.push([v0, v2, v3]);\n\t\t\ttriangles.push([v0, v3, v1]);\n\t\t}\n\t}\n\n\t// Back\n\tfor(var i=0; i<subdivisions; i++){\n\t\tfor(var j=0;j<subdivisions;j++){\n\t\t\tvar v0 = [-0.5 + i*step, -0.5 + j*step, -0.5];\n\t\t\tvar v1 = [-0.5 + (i+1)*step, -0.5 + j*step, -0.5];\n\t\t\tvar v2 = [-0.5 + i*step, -0.5 + (j+1)*step, -0.5];\n\t\t\tvar v3 = [-0.5 + (i+1)*step, -0.5 + (j+1)*step, -0.5];\n\n\t\t\ttriangles.push([v0, v2, v3]);\n\t\t\ttriangles.push([v0, v3, v1]);\n\t\t}\n\t}\n\n\t// Buttom\n\tfor(var i=0; i<subdivisions; i++){\n\t\tfor(var j=0;j<subdivisions;j++){\n\t\t\tvar v0 = [-0.5+i*step, -0.5, -0.5+j*step];\n\t\t\tvar v1 = [-0.5+(i+1)*step, -0.5, -0.5+j*step];\n\t\t\tvar v2 = [-0.5+i*step, -0.5, -0.5+(j+1)*step];\n\t\t\tvar v3 = [-0.5+(i+1)*step, -0.5, -0.5+(j+1)*step];\n\n\t\t\ttriangles.push([v0, v3, v2]);\n\t\t\ttriangles.push([v0, v1, v3]);\n\t\t}\n\t}\n\n\t// add triangles to finish the make process\n\tfor (tri of triangles){\n\t\taddTriangle(\n\t\t\ttri[0][0], tri[0][1], tri[0][2],\n\t\t\ttri[1][0], tri[1][1], tri[1][2],\n\t\t\ttri[2][0], tri[2][1], tri[2][2]\n\t\t\t);\n\t}\n\n \n}", "function validTriangle(a, b, c){\n var values = [a*a,b*b,c*c];\n var y,z;\n var flag = false;\n for(var x = 0;x<3;x++){\n y = (x + 1)%3;\n z = (x + 2)%3;\n if (( (values[x] + values[y] == values[z]) || (a == b && a == c) || ( (b == c && b == a) || (a==b || b ==c || c == a) ) ) && a != 0 && b != 0 && c != 0 && a + b > c && c + a > b && c + b > a){\n flag = true;\n }\n }\n return flag;\n}", "function checkIfTriangle(){\n const sum =sumOfAngle(Number(inputAngle[0].value),Number(inputAngle[1].value),Number(inputAngle[2].value))\n // console.log(sum);\n if(sum === 180){\n output.innerText = \"Hurrey ,this angles forms a Triangle 😃\"\n }\n else{\n output.innerText = \"Oops! it's not a Triangle 👋\"\n }\n // console.log(\"yess\")\n}", "_buildTriangles() {\n // geometry.faces.push( new THREE.Face3( 0, 1, 2 ) );\n\n // temporary vertice for buiding triangles\n var aIndex = undefined;\n var bIndex = undefined;\n var cIndex = undefined;\n var dIndex = undefined;\n\n // part 2: building the triangles from the vertice\n for (var iy = 0; iy < this.height - 1; iy++) {\n\n for (var ix = 0; ix < this.width - 1; ix++) {\n\n // (0, 0)\n if (ix == 0 && iy == 0) {\n aIndex = 0;\n bIndex = 1;\n cIndex = 2;\n dIndex = 3;\n\n // (1, 0)\n } else if (ix == 1 && iy == 0) {\n aIndex = ix;\n bIndex = (ix * 2) + 2;\n cIndex = (ix * 2) + 3;\n dIndex = ((ix - 1) * 2) + 2;\n\n // (0, 1)\n } else if (ix == 0 && iy == 1) {\n aIndex = 3;\n bIndex = 2;\n cIndex = this.firstRowSum + 1;\n dIndex = this.firstRowSum + 2;\n\n // (1, 1)\n } else if (ix == 1 && iy == 1) {\n aIndex = 2;\n bIndex = 5;\n cIndex = this.firstRowSum + 3;\n dIndex = this.firstRowSum + 1;\n\n // 1st row (except 1st col)\n } else if (iy == 0) {\n aIndex = ix * 2;\n bIndex = (ix * 2) + 2;\n cIndex = (ix * 2) + 3;\n dIndex = ((ix - 1) * 2) + 3;\n\n // 2nd row (except 1st and 2nd col)\n } else if (iy == 1) {\n aIndex = (ix * 2) + 1;\n bIndex = (ix * 2) + 3;\n cIndex = this.firstRowSum + 2 + ix;\n dIndex = this.firstRowSum + 1 + ix;\n\n // 1st col (except 1st and 2nd row)\n } else if (ix == 0) {\n aIndex = this.firstRowSum + (iy - 2) * this.width + 2;\n bIndex = this.firstRowSum + (iy - 2) * this.width + 1;\n cIndex = this.firstRowSum + (iy - 1) * this.width + 1;\n dIndex = this.firstRowSum + (iy - 1) * this.width + 2;\n\n // 2nd col (except 1st and 2nd row)\n } else if (ix == 1) {\n aIndex = this.firstRowSum + (iy - 2) * this.width + 1;\n bIndex = this.firstRowSum + (iy - 2) * this.width + 3;\n cIndex = this.firstRowSum + (iy - 1) * this.width + 3;\n dIndex = this.firstRowSum + (iy - 1) * this.width + 1;\n\n // # all other cases\n } else {\n aIndex = this.firstRowSum + this.width * (iy - 2) + ix + 1;\n bIndex = this.firstRowSum + this.width * (iy - 2) + ix + 2;\n cIndex = this.firstRowSum + this.width * (iy - 1) + ix + 2;\n dIndex = this.firstRowSum + this.width * (iy - 1) + ix + 1;\n }\n\n var face1 = new THREE.Face3(aIndex, bIndex, cIndex);\n var face2 = new THREE.Face3(aIndex, cIndex, dIndex);\n\n // getting a relevant color depending on altitude\n var altitude = Math.floor((this.geometry.vertices[aIndex].y) * this._groundResolution + this.min);\n var altiColor = this.altitudeColorPicker2(altitude);\n\n if (typeof altiColor === \"undefined\") {\n console.log(altitude);\n } else {\n face1.color.setRGB(altiColor.r, altiColor.g, altiColor.b);\n face2.color.setRGB(altiColor.r, altiColor.g, altiColor.b);\n }\n\n // Add triangle T1, vertices a, b, c\n this.geometry.faces.push(face1);\n\n // Add triangle T2, vertices a, c, d\n this.geometry.faces.push(face2);\n\n }\n\n }\n }", "generateTriangles() {\r\n // MP2: Implement the rest of this function!\r\n\r\n // positionData: 1D array of floats\r\n const deltaX = (this.maxX - this.minX) / this.div;\r\n const deltaY = (this.maxY - this.minY) / this.div;\r\n for (let i = 0; i <= this.div; i++) {\r\n for(let j = 0; j <= this.div; j++) {\r\n this.positionData.push(this.minX + deltaX * j);\r\n this.positionData.push(this.minY + deltaY * i);\r\n this.positionData.push(0);\r\n }\r\n }\r\n\r\n\r\n // faceData\r\n for (let i = 0; i < this.div; i++) {\r\n for(let j = 0; j < this.div; j++) {\r\n // bottom left index\r\n let bottomLeft = (i * (this.div + 1)) + j;\r\n let triangular1 = [bottomLeft, bottomLeft+1, bottomLeft + this.div + 1];\r\n let triangular2 = [bottomLeft + 1, bottomLeft + this.div + 2, bottomLeft + this.div + 1];\r\n this.faceData.push(...triangular1);\r\n this.faceData.push(...triangular2);\r\n }\r\n }\r\n\r\n // We'll need these to set up the WebGL buffers.\r\n this.numVertices = this.positionData.length/3;\r\n this.numFaces = this.faceData.length/3;\r\n }", "buildQuarterDome(numTriangleStrips = 32) {\n const zAxis = vec3.fromValues(0.0, 0.0, 1.0);\n const yAxis = vec3.fromValues(0.0, 1.0, 0.0);\n const start = vec3.fromValues(0.0, 1.0, 0.0);\n const halfPI = Math.PI / 2;\n const vertices = [];\n const indices = [];\n\n /* \n * This works by generating a large triangle composed of numTriangleStrips\n * number of triangle strips. A \"large triangle\" with numTriangleStrips = 2\n * would look like this.\n *\n * /\\\n * /__\\\n * /\\ /\\\n * /__\\/__\\\n * \n * The vertices are generated by starting at point 0,1,0, and rotating\n * 90 degrees around the z axis numTriangleStrips + 1 times. For each\n * iteration, vertices are generated by rotating 90 degrees about the y\n * axis.\n */\n for (let level = 0; level < numTriangleStrips + 1; ++level) {\n const angleZ = halfPI / numTriangleStrips * level;\n const rotationZ = mat4.fromRotation(mat4.create(), angleZ, zAxis);\n const vertsThisLevel = level + 1;\n\n for (let v = 0; v < vertsThisLevel; ++v) {\n const angleY = (vertsThisLevel === 1) ? 0 : halfPI / (vertsThisLevel - 1) * v;\n const rotationY = mat4.fromRotation(mat4.create(), angleY, yAxis);\n\n // \"start\" is rotated about Z then about Y.\n vertices.push(\n vec3.transformMat4(vec3.create(),\n vec3.transformMat4(vec3.create(), start, rotationZ), rotationY));\n }\n }\n\n /**\n * From the vertices generated above, create vertex indices that can be\n * used to draw the quarter dome.\n *\n * |Level|Triangles\n * |-----|---------\n * 0 | 0 |\n * / \\ | |\n * 1---2 | 1 | [0,2,1 UP]\n * / \\ / \\ | |\n * 3---4---5 | 2 | [1,4,3 UP] [2,5,4 UP] [1,2,4 DOWN]\n * / \\ / \\ / \\ | |\n * 6---7---8---9 | 3 | [3,7,6 UP] [4,8,7 UP] [5,9,8 UP] [3,4,7 DOWN] [4,5,8 DOWN]\n */\n for (let level = 1; level < numTriangleStrips + 1; ++level) {\n const numUp = level;\n const numDown = level - 1;\n // The start index for the level is a sequence: n(n+1) / 2.\n // I.e. the start points are 0, 1, 3, 6, 10, 15, ...\n const lInd = (level - 1)*level / 2;\n const nInd = lInd + level;\n\n // The vertices are pushed clockwise for vertex normal computation.\n for (let u = 0; u < numUp; ++u) {\n indices.push(lInd + u);\n indices.push(nInd + u + 1);\n indices.push(nInd + u);\n }\n\n for (let d = 0; d < numDown; ++d) {\n indices.push(lInd + d);\n indices.push(lInd + d + 1);\n indices.push(nInd + d + 1);\n }\n }\n\n return {vertices, indices};\n }", "function Puissance4(lig,col,l,c){\r\n //commencement de l'analyse\r\n console.log(\"Valeurs: \"+lig+\" \"+col+\" / Incrément \"+i+ \" \"+c);\r\n if(c == 0 && l == 0){\r\n //pour moi c'est inversé a verticale, b horizontal, c diag gauche et d diag droit\r\n // horizontalité\r\n var va = 1 +Puissance4(lig +1,col,1,0) + Puissance4(lig-1,col,-1,0);\r\n // verticalité\r\n var vb = 1 +Puissance4(lig,col+1,0,1) + Puissance4(lig,col-1,0,-1);\r\n // diagonale de droite\r\n var vc = 1 +Puissance4(lig+1,col+1,1,1) + Puissance4(lig-1,col-1,-1,-1); \r\n // diagonale de gauche\r\n var vd = 1 +Puissance4(lig-1,col+1,-1,1) + Puissance4(lig+1,col-1,1,-1);\r\n console.log(va,vb,vc,vd);\r\n if(va == 4 || vb == 4 || vc == 4 || vd == 4)return true;\r\n else return false; \r\n }\r\n //On vérifie que \"lig\" et \"col\" ne sortent pas du tableau \r\n if (lig<this.ligne && lig>=0 && col<this.colonne && col>=0){\r\n if(this.plateau[lig][col]==joueur){\r\n return 1+ Puissance4(lig + l, col + c, l, c);}\r\n else {return 0;}\r\n }\r\n else return 0;\r\n }", "function isTriangle (a, b, c){\n if (a === 0 || b === 0 || c === 0){\n return false;\n } else if (a+b <= c){\n return false;\n } else if (b+c <= a){\n return false;\n } else if (a+c <= b){\n return false;\n }\n\n return true;\n }", "function valorTriangulo(){\n if(trianguloAparienciaInteraccion == true && trianguloAparienciaTono == true && trianguloAparienciaMirada == true && trianguloAparienciaLlanto == true){\n trianguloApariencia = true;\n }else{\n trianguloApariencia = false;\n }\n}", "function perimetroQuadrado(lado) {\n \n return lado * 3;\n}", "function perimeterTriangle(side1, side2, side3){\n return -1;\n }", "function makeCube (subdivisions) {\n // fill in your code here.\n // delete the code below first.\n var side_len = 1 / subdivisions\n\n var start = 0.5\n for(var row = 0; row < subdivisions; row++) {\n for(var col = 0; col < subdivisions; col++) {\n // front\n addTriangle (-start + (col * side_len), start - (row * side_len), start, \n -start + side_len + (col * side_len), start - side_len - (row * side_len), start, \n -start + side_len + (col * side_len), start - (row * side_len), start);\n addTriangle (-start + (col * side_len), start - (row * side_len), start, \n -start + (col * side_len), start - side_len - (row * side_len), start,\n -start + side_len + (col * side_len), start - side_len - (row * side_len), start);\n\n // back\n addTriangle (-start + side_len + (col * side_len), start - side_len - (row * side_len), -start, \n -start + (col * side_len), start - (row * side_len), -start, \n -start + side_len + (col * side_len), start - (row * side_len), -start);\n addTriangle (-start + (col * side_len), start - side_len - (row * side_len), -start,\n -start + (col * side_len), start - (row * side_len), -start, \n -start + side_len + (col * side_len), start - side_len - (row * side_len), -start);\n \n // left\n addTriangle (-start, start - (row * side_len), -start + (col * side_len), \n -start, start - side_len - (row * side_len), -start + side_len + (col * side_len), \n -start, start - (row * side_len), -start + side_len + (col * side_len));\n addTriangle (-start, start - (row * side_len), -start + (col * side_len), \n -start, start - side_len- (row * side_len), -start + (col * side_len), \n -start, start - side_len - (row * side_len), -start + side_len + (col * side_len));\n\n // right\n addTriangle (start, start - side_len - (row * side_len), -start + side_len + (col * side_len),\n start, start - (row * side_len), -start + (col * side_len), \n start, start - (row * side_len), -start + side_len + (col * side_len));\n addTriangle (start, start - side_len- (row * side_len), -start + (col * side_len), \n start, start - (row * side_len), -start + (col * side_len), \n start, start - side_len - (row * side_len), -start + side_len + (col * side_len));\n\n // top\n addTriangle (-start + (col * side_len), start, -start + (row * side_len), \n -start + side_len + (col * side_len), start, -start + side_len + (row * side_len), \n -start + side_len + (col * side_len), start, -start + (row * side_len));\n addTriangle (-start + (col * side_len), start, -start + (row * side_len), \n -start + (col * side_len), start, -start + side_len + (row * side_len),\n -start + side_len + (col * side_len), start, -start + side_len + (row * side_len));\n \n // bottom\n addTriangle (-start + side_len + (col * side_len), -start, -start + side_len + (row * side_len),\n -start + (col * side_len), -start, -start + (row * side_len), \n -start + side_len + (col * side_len), -start, -start + (row * side_len));\n addTriangle (-start + (col * side_len), -start, -start + side_len + (row * side_len),\n -start + (col * side_len), -start, -start + (row * side_len), \n -start + side_len + (col * side_len), -start, -start + side_len + (row * side_len)); \n }\n }\n}", "generateTriangles() {\r\n // MP2: Implement the rest of this function!\r\n\r\n // We'll need these to set up the WebGL buffers.\r\n this.numVertices = this.positionData.length/3;\r\n this.numFaces = this.faceData.length/3;\r\n }", "function triangleCheck(lineA, lineB , lineC) {\n if (((lineA < lineB + lineC)&&(lineA > Math.abs(lineB - lineC)))||((lineB < lineA + lineC)&&(lineB > Math.abs(lineA - lineC)))||((lineC < lineB + lineC)&&(lineC > Math.abs(lineB - lineA)))){\n return true;\n }\n return false;\n}", "function triangle() {\n\n}", "function checkValidity(ring) {\n if (ring.length < 3) {\n return false;\n //if the last point is the same as the first, it's not a triangle\n } else if (ring.length === 3 &&\n ((ring[2][0] === ring[0][0]) && (ring[2][1] === ring[0][1]))) {\n return false;\n } else {\n return true;\n }\n}", "function checkValidity(ring) {\n if (ring.length < 3) {\n return false;\n //if the last point is the same as the first, it's not a triangle\n } else if (ring.length === 3 &&\n ((ring[2][0] === ring[0][0]) && (ring[2][1] === ring[0][1]))) {\n return false;\n } else {\n return true;\n }\n}", "function drawTriangle() {\n var i = 0, j = 0;\n var result = \"\\n\";\n do {\n j = 0;\n while(j<=i) {\n result = result + \"#\";\n j++;\n } \n result = result + \"\\n\"\n i++;\n }while(i<7);\n return result;\n}", "function checkValidity(ring) {\n\t if (ring.length < 3) {\n\t return false;\n\t //if the last point is the same as the first, it's not a triangle\n\t } else if (ring.length === 3 &&\n\t ((ring[2][0] === ring[0][0]) && (ring[2][1] === ring[0][1]))) {\n\t return false;\n\t } else {\n\t return true;\n\t }\n\t}", "function isTriangle(a, b, c) {\n if (a + b > c && a + c > b && b + c > a) {\n return true\n } else {\n return false\n }\n}", "function pressTo() {\n\n var sideA = document.getElementById('SideA').value\n var sideB = document.getElementById('SideB').value\n var sideC = document.getElementById('SideC').value\n var tri = document.getElementById('tri')\n\n var triangleSides = []\n triangleSides.push(sideA)\n triangleSides.push(sideB)\n triangleSides.push(sideC)\n console.log(triangleSides)\n\n /* Gloria Givondo Brilliant method\n var sides = [document.getElementById(\"lengthA\").value, document.getElementById(\"lengthB\").value, document.getElementById(\"lengthC\").value];\n var lengthA = sides[0]\n var lengthB = sides[1]\n var lengthC = sides[2]’\n })*/\n\n if(sideA == sideB && sideA == sideC){\n alert(\"Equilateral\")\n //method 1 jquery?\n tri.style.display = \"block\";\n //method 2 hide and show toggle attempt which causes default to JavaScript style for value 'tri' located in HTML, overriding display none ine CSS\n //document.getElementsByClassName('tri').style.display = \"block\"\n } else if(sideA == sideB || sideA == sideC || sideB == sideC){\n //note varied code direct ÍD or js variable for experimenting with concise code\n alert(\"Isosceles\")\n document.getElementById('tri2').style.display = \"block\"\n } else if (sideA + sideB <= SideC || sideC + sideA <= SideB || sideC + sideB <= SideA) {\n alert(\"Not a Triangle\")\n document.getElementById('not').style.display = \"block\"\n } else if (SideA !== sideB && sideA !== sideC && sideB !== sideC) {\n alert(\"Scalene\") //YET TO BE CORRECTLY RESOLVED AS EVEN VALUES 4,7,9 which defy previous if statement did not result to 'Scalene'alert\n document.getElementById('tri2').style.display = \"block\"\n }\n\n\n}//ends 'pressTo'function", "function draw_triangles(){\n //draw k\n draw_poly(1,6);\n draw_poly(1,7);\n draw_poly(2,5);\n draw_poly(2,6);\n draw_poly(3,4);\n draw_poly(3,5);\n draw_poly(4,3);\n draw_poly(4,4);\n draw_poly(4,5);\n draw_poly(4,6);\n draw_poly(4,7);\n draw_poly(4,8);\n draw_poly(5,2);\n draw_poly(5,3);\n draw_poly(5,5);\n draw_poly(5,6);\n draw_poly(6,1);\n draw_poly(6,2);\n draw_poly(6,6);\n draw_poly(6,7);\n\n //draw y\n draw_poly(4,12);\n draw_poly(4,13);\n draw_poly(5,13);\n draw_poly(5,14);\n draw_poly(6,14);\n draw_poly(4,17);\n draw_poly(4,18);\n draw_poly(5,16);\n draw_poly(5,17);\n draw_poly(6,15);\n draw_poly(6,16);\n draw_poly(7,14);\n draw_poly(7,15);\n draw_poly(8,13);\n draw_poly(8,14);\n draw_poly(9,12);\n draw_poly(9,13);\n \n //draw l\n draw_poly(6,19);\n draw_poly(6,20);\n draw_poly(5,20);\n draw_poly(5,21);\n draw_poly(4,21);\n draw_poly(4,22);\n draw_poly(3,22);\n draw_poly(3,23);\n draw_poly(2,23);\n draw_poly(2,24);\n draw_poly(1,24);\n draw_poly(1,25);\n\n //draw e\n draw_poly(6,26);\n draw_poly(6,27);\n draw_poly(5,25);\n draw_poly(5,26);\n draw_poly(4,25);\n draw_poly(4,26);\n draw_poly(4,27);\n draw_poly(3,26);\n draw_poly(3,27);\n draw_poly(3,28);\n draw_poly(3,29);\n draw_poly(3,30);\n draw_poly(4,30);\n draw_poly(4,29);\n draw_poly(5,29);\n\n //draw m\n draw_poly(6,35);\n draw_poly(6,36);\n draw_poly(5,36);\n draw_poly(5,37);\n draw_poly(4,37);\n draw_poly(4,38);\n draw_poly(3,38);\n draw_poly(4,39);\n draw_poly(4,40);\n draw_poly(4,41);\n draw_poly(5,41);\n draw_poly(5,40);\n draw_poly(6,40);\n draw_poly(6,39);\n draw_poly(4,43);\n draw_poly(4,44);\n draw_poly(4,45);\n draw_poly(5,45);\n draw_poly(5,44);\n draw_poly(6,44);\n draw_poly(6,43);\n\n //draw a\n draw_poly(6,48);\n draw_poly(6,49);\n draw_poly(6,50);\n draw_poly(6,52);\n draw_poly(5,48);\n draw_poly(5,49);\n draw_poly(5,51);\n draw_poly(5,52);\n draw_poly(4,49);\n draw_poly(4,50);\n draw_poly(4,51);\n\n //draw r\n draw_poly(6,55);\n draw_poly(6,56);\n draw_poly(5,56);\n draw_poly(5,57);\n draw_poly(4,57);\n draw_poly(4,58);\n draw_poly(4,59);\n draw_poly(4,60);\n\n //draw x\n draw_poly(3,63);\n draw_poly(3,64);\n draw_poly(3,66);\n draw_poly(3,67);\n draw_poly(4,64);\n draw_poly(4,65);\n draw_poly(4,66);\n draw_poly(5,64);\n draw_poly(5,65);\n draw_poly(5,66);\n draw_poly(6,63);\n draw_poly(6,64);\n draw_poly(6,66);\n draw_poly(6,67);\n\n //scale the name drawn\n// $('#main').attr('transform', \"scale(0.125)\");\n}", "function Triangle(p1, p2, p3) {\n this.blockers = [0,0,0,0,0,0,0,0,0,0];\n this.pos = [p1,p2,p3];\n //this.bounds = bounds(this.pos);\n var edge1 = sub(p3, p1);\n var edge2 = sub(p2, p1);\n var normal = cross(edge1, edge2);\n var axis;\n if (Math.abs(normal[0]) > Math.abs(normal[1]))\n if (Math.abs(normal[0]) > Math.abs(normal[2]))\n axis = 0; \n else \n axis = 2;\n else\n if (Math.abs(normal[1]) > Math.abs(normal[2])) \n axis = 1;\n else \n axis = 2;\n var u = (axis + 1) % 3;\n var v = (axis + 2) % 3;\n var normal = normalise(normal);\n var nu = normal[u] / normal[axis];\n var nv = normal[v] / normal[axis];\n var nd = dot(normal, p1) / normal[axis];\n var eu = p1[u];\n var ev = p1[v]; \n var d = (edge1[u] * edge2[v] - edge1[v] * edge2[u]);\n var nu1 = edge1[u] / d;\n var nv1 = -edge1[v] / d;\n var nu2 = edge2[v] / d;\n var nv2 = -edge2[u] / d;\n var dir = [\"dx\", \"dy\", \"dz\"];\n var orig = [\"ox\", \"oy\", \"oz\"];\n\tvar func = new Function(\"ox, oy, oz, dx, dy, dz, near, far\",\n\t\t\"var d = \" + dir[axis] + (nu ? (\" - \" + (-nu) + \" * \" + dir[u]) : \"\") + (nv ? (\" - \" + (-nv) + \" * \" + dir[v]) : \"\") +\";\\n\" +\n\t\t\"var t = (\" + nd + \" - \" + orig[axis] + (nu ? (\" - \" + nu + \" * \" + orig[u]) : \"\") + (nv ? (\" - \" + nv + \" * \" + orig[v]) : \"\") + \") / d;\\n\" +\n\t\t\"if (t < near || t > far)\\n\" +\n\t\t\"\treturn t;\\n\" +\n\t\t\"var Pu = \" + orig[u] + \" + t * \" + dir[u] + \" - \" + eu + \";\\n\" +\n\t\t\"var Pv = \" + orig[v] + \" + t * \" + dir[v] + \" - \" + ev + \";\\n\" +\n\t\t\"var a2 = Pv * \" + nu1 + \" - Pu * \" + (-nv1) + \";\\n\" +\n\t\t\"if (a2 < 0)\\n\" +\n\t\t\"\treturn -10000000;\\n\" +\n\t\t\"var a3 = Pu * \" + (-nu2) + \" - Pv * \" + nv2 + \";\\n\" +\n\t\t\"if (a3 > 0)\\n\" +\n\t\t\"\treturn -10000000;\\n\" +\n\t\n\t\t\"if ((a2 - a3) > 1)\\n\" +\n\t\t\"\treturn -10000000;\\n\" +\n\t\t\"return t;\\n\"\n\t)\n\tfunc.normal = normal;\n\tfunc.material = [0.7, 0.7, 0.7];\n\treturn func;\n}", "function triangle(a, b) {\n\n}", "function drawTriSpace(){\n triangleClear();\n loadMedicineGrid();\n var medAllNum =0;\n var inNums = 170;\n var outNums = 200;\n for (var i=0; i<trianglesContinued.length; i++) {\n if(trianglesContinued[i]!=undefined&&lines[i]!=undefined){\n \tif(trianglesContinued[i].eventSign=='ME'){\n \t\tvar medNums = 5;\n \t\tfor(var j = 0;j<mEvents.length;j++){\n \t\t\tif(mEvents[j]!=undefined){\n \t\t\t\tif(mEvents[j].m_sign=='ME'&&mEvents[j].m_point==i){\n \t\t\t if(mEvents[j].m_durable=='1'){\n \t\t\t\t if(mEvents[j].m_ended=='1'){\n \t\t\t\t \t lines[i].end_y=medNums;\n \t\t\t\t \t lines[i].start_x=mEvents[j].m_starttime;\n \t\t\t\t \t lines[i].start_y=medNums;\n \t\t\t\t \t trianglesContinued[i].y = medNums;\n \t\t\t\t \t stopTriangle[i].y = medNums;\n \t\t\t\t\t drawTriangle(triangleCtx, mEvents[j].m_starttime, medNums, 10,trianglesContinued[i].medicineText);\n \t\t\t\t\t drawLine(triangleCtx,mEvents[j].m_starttime, medNums,mEvents[j].m_endtime,medNums);\n \t\t\t\t\t drawTriangle(triangleCtx,mEvents[j].m_endtime, medNums, 10,''); \t\n \t\t\t\t }else{\n \t\t\t\t \t lines[i].end_y=medNums;\n \t\t\t\t \t lines[i].start_x=mEvents[j].m_starttime;\n \t\t\t\t \t lines[i].start_y=medNums;\n \t\t\t\t \t trianglesContinued[i].y = medNums;\n \t\t\t\t\t drawTriangle(triangleCtx, mEvents[j].m_starttime, medNums, 10,trianglesContinued[i].medicineText);\n \t\t drawLine(triangleCtx,mEvents[j].m_starttime, medNums,lines[i].end_x,medNums);\n \t\t drawArrow(triangleCtx,lines[i].end_x,medNums);\n \t\t if(lines[i].end_x<totalLong[i]+trianglesContinued[i].x){\n \t\t lines[i].end_x+=oneLong;\n \t\t }\n \t\t\t\t}\n \t\t\t\t \n \t\t\t}\n \t\t\tif('0'==mEvents[j].m_durable){\n \t\t\t trianglesContinued[i].y = medNums;\n \t\t\t drawTriangle(triangleCtx, mEvents[j].m_starttime, medNums, 10,trianglesContinued[i].medicineText);\n \t\t\t}\n \t\t}\n \t\t\t\tmedNums+=15;\n \t\t\t}\n \t\t}\n \t\t\n \t}\n \t\n \tvar inEventSpeed=1/(40*medicinesCount);\n \tif(trianglesContinued[i].eventSign=='IE'){\n \t\tfor(var j = 0;j<ioEvents.length;j++){\n \t\t\tif(ioEvents[j]!=undefined){\n \t\t\t\tif(ioEvents[j].ioe_sign=='IE'&&ioEvents[j].ioe_point==i){\n \t\t\t\t\tif(inNums<=185){\n \t\t\t\t\t\tif(ioEvents[j].ioe_ended=='1'){\n \t\t\t\t\t\t\tlines[i].end_y=inNums;\n \t\t\t\t\t\t\tlines[i].start_x=ioEvents[j].ioe_starttime;\n \t\t\t\t\t\t\tlines[i].start_y=inNums;\n \t\t\t\t\t\t\ttrianglesContinued[i].y = inNums;\n \t\t\t\t\t\t\tstopTriangle[i].y = inNums;\n \t\t\t\t\t\t\tdrawTriangle(triangleCtx, ioEvents[j].ioe_starttime, inNums, 10,inNums);\n \t\t\t\t\t\t\tdrawTriangle(triangleCtx,ioEvents[j].ioe_endtime, inNums, 10,''); \t\n \t\t\t\t\t\t\tdrawLine(triangleCtx,ioEvents[j].ioe_starttime, inNums,ioEvents[j].ioe_endtime,inNums);\n \t\t\t\t\t\t\tinNums+=15;\n \t\t\t\t\t\t}else{\n \t\t\t\t\t\t\tlines[i].end_y=inNums;\n \t\t\t\t\t\t\tlines[i].start_x=ioEvents[j].ioe_starttime;\n \t\t\t\t\t\t\tlines[i].start_y=inNums;\n \t\t\t\t\t\t\ttrianglesContinued[i].y = inNums;\n \t\t\t\t\t\t\tdrawTriangle(triangleCtx, ioEvents[j].ioe_starttime, inNums, 10,trianglesContinued[i].medicineText);\n \t\t\t\t\t\t\tdrawLine(triangleCtx,ioEvents[j].ioe_starttime, inNums,lines[i].end_x,inNums);\n \t\t\t\t\t\t\tdrawArrow(triangleCtx,lines[i].end_x,inNums);\n \t\t\t\t\t\t\t\n \t\t\t\t\t if(lines[i].end_x<totalLong[i]+ioEvents[j].ioe_starttime){\n \t\t\t\t\t lines[i].end_x+=inEventSpeed;\n \t\t\t\t\t }\n \t\t\t\t\t inNums+=15;\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\n \t\t\t\t\t}else{\n \t\t\t\t\t\t//console.log('备注---------------多了');\n \t\t\t\t\t}\n \t\t\t\t \n \t\t\t\n \t\t}\n// \t\t\t\tif(inNums<185){\n// \t\t\t\t\t\n// \t\t\t\t\tinNums+=15;\n// \t\t\t\t}else{\n// \t\t\t\t\t//console.log('备注');\n// \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\t\n \t}\n \tif(trianglesContinued[i].eventSign=='OE'){\n \t\tfor(var j = 0;j<ioEvents.length;j++){\n \t\t\tif(ioEvents[j]!=undefined){\n \t\t\t\tif(ioEvents[j].ioe_sign=='OE'&&ioEvents[j].ioe_point==i){\n \t\t\t\t\tif(outNums<=215){\n \t\t\t\t\t\tif(ioEvents[j].ioe_ended=='1'){\n \t\t\t\t\t\t\tlines[i].end_y=outNums;\n \t\t\t\t\t\t\tlines[i].start_x=ioEvents[j].ioe_starttime;\n \t\t\t\t\t\t\tlines[i].start_y=outNums;\n \t\t\t\t\t\t\ttrianglesContinued[i].y = outNums;\n \t\t\t\t\t\t\tstopTriangle[i].y = outNums;\n \t\t\t\t\t\t\tdrawTriangle(triangleCtx, ioEvents[j].ioe_starttime, outNums, 10,trianglesContinued[i].medicineText);\n \t\t\t\t\t\t\tdrawTriangle(triangleCtx,ioEvents[j].ioe_endtime, outNums, 10,''); \t\n \t\t\t\t\t\t\tdrawLine(triangleCtx,ioEvents[j].ioe_starttime, outNums,ioEvents[j].ioe_endtime,outNums);\n \t\t\t\t\t\t\toutNums+=15;\n \t\t\t\t\t\t}else{\n \t\t\t\t\t\t\tlines[i].end_y=outNums;\n \t\t\t\t\t\t\tlines[i].start_x=ioEvents[j].ioe_starttime;\n \t\t\t\t\t\t\tlines[i].start_y=outNums;\n \t\t\t\t\t\t\ttrianglesContinued[i].y = outNums;\n \t\t\t\t\t\t\tdrawTriangle(triangleCtx, ioEvents[j].ioe_starttime, outNums, 10,trianglesContinued[i].medicineText);\n \t\t\t\t\t\t\tdrawLine(triangleCtx,ioEvents[j].ioe_starttime, outNums,lines[i].end_x,outNums);\n \t\t\t\t\t\t\tdrawArrow(triangleCtx,lines[i].end_x,outNums);\n \t\t\t\t\t if(lines[i].end_x<totalLong[i]+trianglesContinued[i].x){\n \t\t\t\t lines[i].end_x+=oneLong;\n \t\t\t\t }\n \t\t\t\t\t outNums+=15;\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\n \t\t\t\t\t}else{\n \t\t\t\t\t\t//console.log('备注---------------多了');\n \t\t\t\t\t}\n \t\t\t\t \n \t\t\t\t}\n \t\t\t\t\n \t\t\n// \t\t\t\tif(outNums<215){\n// \t\t\t\t\t\n// \t\t\t\t\toutNums+=15;\n// \t\t\t\t}else{\n// \t\t\t\t\t//console.log('备注');\n// \t\t\t\t}\n \t\t\t\t\n \t\t\t}\n \t\t}\n \t\t\n \t}\n \t\n\n// if(lines[i].end_x<totalLong[i]+trianglesContinued[i].x){\n// lines[i].end_x+=oneLong;\n// }\n }\n }\n}", "function triangle(s1, s2, s3) {\n let perimeter = s1 + s2 + s3;\n let sides = [s1, s2, s3];\n let longest = Math.max(...sides);\n let shortest = Math.min(...sides);\n let mid = perimeter - longest - shortest; // ahh this is easy and smart!\n \n if (sides.includes(0) || longest >= mid + shortest) return \"invalid\";\n if (longest === shortest && shortest === mid) {\n return \"equilateral\";\n } else if (longest !== mid && mid !== shortest && longest !== shortest) {\n return \"scalene\";\n } else {\n return \"isosceles\";\n }\n}", "function createQuadrant(svg, quadNum, data, radius) {\n var quadrant = [{x: -1, y: -1}, {x: 1, y: -1}, {x: -1, y: 1}, {x: 1, y: 1}][quadNum - 1];\n\n var numOfRows = 0;\n var elementsLeft = data.length;\n var c = {x: quadrant.x*(radius*2.5)/2, y: quadrant.y*(radius*2.5)/2};\n\n createElement(svg, c.x, c.y, radius, data[0]);\n \n elementsLeft--;\n\n data = data.slice(1);\n\n while(elementsLeft > 0) {\n createRow(svg, ++numOfRows, radius, c, quadrant, data);\n data = data.slice(2*numOfRows);\n elementsLeft = elementsLeft - 2*numOfRows;\n }\n }", "function standardizeQuad( elem, alreadyclockwise ) {\n if ( elem.points.numberOfItems !== 4 )\n return false;\n\n if ( ! ( typeof alreadyclockwise === 'boolean' && alreadyclockwise ) )\n standardizeClockwise(elem);\n\n var n, tmp, slope,\n sslope = Infinity,\n shift = 0,\n pts = elem.points;\n\n /// determine shift to start at top-left ///\n for ( n=0; n<4; n++ )\n if ( pts.getItem((n+1)%4).x > pts.getItem(n).x ) {\n slope = Math.abs( (pts.getItem((n+1)%4).y-pts.getItem(n).y) / (pts.getItem((n+1)%4).x-pts.getItem(n).x) );\n if ( slope < sslope ) {\n shift = n;\n sslope = slope;\n }\n }\n if ( shift > 0 ) {\n tmp = [ pts.getItem(0), pts.getItem(1), pts.getItem(2), pts.getItem(3) ];\n pts.clear();\n for ( n=0; n<4; n++ )\n pts.appendItem(tmp[(n+shift)%4]);\n }\n\n return true;\n }", "isInQuadrant(q) {\n // Map quadrant to x & y coordinate pairs and multiply with coordinates,\n // then check sign:\n // 1: [ 1, 1]\n // 2: [-1, 1]\n // 3: [-1, -1]\n // 4: [ 1, -1]\n return this.x * (q > 1 && q < 4 ? -1 : 1) >= 0 && this.y * (q > 2 ? -1 : 1) >= 0;\n }", "function isTriangle(a,b,c) {\n longSide = Math.max(a,b,c);\n shortSide = Math.min(a+b, a+c, b+c);\n if (shortSide > longSide) {\n return true;\n }\n return false;\n}", "function triangle(...sides) {\n if (sides.some(side => side <= 0) || sides.length > 3) return 'invalid';\n if (sides.every(side => side === sides[0])) return 'equilateral';\n let [longest, ...otherSides] = sides.sort((a, b) => b - a);\n if (otherSides.reduce((total, len) => total + len) <= longest) return 'invalid';\n return otherSides.some(side => side === longest) ? 'isosceles' : 'scalene';\n}", "function PlanarCoordinates() {\n var x1 = parseFloat(document.getElementById('x1').value);\n var y1 = parseFloat(document.getElementById('y1').value);\n var x2 = parseFloat(document.getElementById('x2').value);\n var y2 = parseFloat(document.getElementById('y2').value);\n var x3 = parseFloat(document.getElementById('x3').value);\n var y3 = parseFloat(document.getElementById('y3').value);\n\n var length = {\n lineLengthAtoB: countDistance(x1, y1, x2, y2),\n lineLengthBtoC: countDistance(x2, y2, x3, y3),\n lineLengthAtoC: countDistance(x1, y1, x3, y3)\n }\n\n function countDistance(varX1, varY1, varX2, varY2) {\n var result = Math.sqrt(((varX2 - varX1) * (varX2 - varX1)) +\n ((varY2 - varY1) * (varY2 - varY1)));\n\n return result;\n }\n\n var resultAtoB = Count(length.lineLengthAtoB.toString());\n var resultBtoC = Count(length.lineLengthBtoC.toString());\n var resultAtoC = Count(length.lineLengthAtoC.toString());\n\n function Count(str) {\n var i;\n var index = str.length;\n\n for (i = 0; i < str.length; i++) {\n if (str[i] === '.'.toString()) {\n index = i + 4;\n\n break;\n }\n }\n\n return str.substring(0, index);\n }\n\n var form = formTriangle(parseFloat(resultAtoB), parseFloat(resultBtoC), parseFloat(resultAtoC));\n\n function formTriangle(a, b, c) {\n var biggest = a;\n var second = b;\n var third = c;\n if (b > a && b > c) {\n biggest = b;\n second = a;\n } else if (c > a && c > b) {\n biggest = c;\n second = a;\n }\n\n var val = second + third;\n\n if (val > biggest) {\n return true;\n } else {\n return false;\n }\n }\n\n var endResult = 'Distanance:<br />A to B = <span style=\"color: red;\">' + resultAtoB + \n '</span><br />B to C = <span style=\"color: red;\">' + resultBtoC + '</span><br />A to C = <span style=\"color: red;\">' + \n resultAtoC + '</span><br />';\n endResult += 'Can the lines form a triangle? <span style=\"color: red;\">' + form + '</span>';\n\n document.getElementById('result1').innerHTML = '<h4>Result Task 1:</h4> ' + endResult;\n}", "function pintarTriangulo() {\n\n ctx.beginPath();\n ctx.lineWidth = tamLinea;\n ctx.moveTo(mouse.x, mouse.y); //cogemos la posicion en x e y en la recta\n\n //TENIENDO EN CUENTA QUE LA RECTA ARRIBA A LA IZQUIERDA VALE 0,0 !\n ctx.lineTo(mouse.x - (parseInt(tamFigura) / 2), mouse.y + parseInt(tamFigura)); //desde la posicion x e y de antes, restamos en la posicion x \n //el tamaño de la figura y lo divimos entre dos ya que hay dos \n //partes esta parte unicamente dibuja del punto inicial una linea hacia la izquierda\n //tambien usamos la posicion de y mas el tamaño de la figura para que haga la linea\n //hacia abajo\n ctx.lineTo(mouse.x + (parseInt(tamFigura) / 2), mouse.y + parseInt(tamFigura)); //hacemos lo correspondiente pero ahora sumandole el tamaño de la figura a x para\n //que se mueva hacia la derecha la linea\n ctx.closePath(); //con close path se cerraran las lineas y de esta forma se formara el triangulo \n ctx.stroke();\n }", "function isTriangle(a, b, c) {\n if (a <= 0 || b <= 0 || c <= 0) return false;\n\n if (a + b > c && b + c > a && c + a > b) return true;\n else return false;\n}", "isInTriangle(x1, y1, x2, y2, x3, y3, x, y){\r\n var l1 = ((y2-y3)*(x-x3)+(x3-x2)*(y-y3)) / ((y2-y3)*(x1-x3)+(x3-x2)*(y1-y3));\r\n var l2 = ((y3-y1)*(x-x3)+(x1-x3)*(y-y3)) / ((y2-y3)*(x1-x3)+(x3-x2)*(y1-y3));\r\n var l3 = 1 - l1 - l2;\r\n return (l1 >= 0 && l1 <= 1 && l2 >= 0 && l2 <= 1 && l3 >= 0 && l3 <= 1);\r\n }", "function drawAtriangle(x, y, u, w, radius, cell) {\r\n\t\r\n\t// Si armure on met une bordure plus épaisse\r\n\tvar sw = 0;\r\n\tif(cell.isArmored) sw = 3;\r\n\t// On dessine le soldat\r\n\t$canvas.addLayer({\r\n\t\ttype: 'polygon',\r\n groups: [cell.legionId],\r\n\t\tbringToFront: true,\r\n\t\tfillStyle: tabCouleurs[cell.legionId],\r\n\t\tstrokeWidth : sw,\r\n\t\tstrokeStyle: '#000',\r\n\t\tx: x, y: y,\r\n\t\tsides: 3,\r\n\t\tradius: radius/100*70,\r\n\t\tname: 's'+u+','+w,\r\n\t\tlayer : true,\r\n\t\tclick : function(layer){\r\n\t\t\tif(!spectateur && moi.playerLegionId.indexOf(cell.legionId) != -1) clickAsolder(layer);\r\n\t\t},\r\n\t\ttouchend : function(layer){\r\n\t\t\tif(!spectateur && moi.playerLegionId.indexOf(cell.legionId) != -1) clickAsolder(layer);\r\n\t\t},\r\n\t}).addLayerToGroup('s'+u+','+w, 'plateau');\r\n}", "function triangular (min, max, mode) {\n if (typeof(min) == 'undefined')\n min = 0;\n if (typeof(max) == 'undefined') {\n max = min;\n min = 0;\n }\n if (typeof(mode) == 'undefined')\n mode = min + (max - min) / 2;\n var u = random();\n if (u < (mode - min) / (max - min)) {\n return min + Math.sqrt(u * (max - min) * (mode - min));\n } else {\n return max - Math.sqrt((1 - u) *\n (max - min) * (max - mode));\n }\n }", "function triangulate_polygon(poly, edge, triangles) {\n\t//console.log(\"triangulate_polygon\", poly, edge);\n\t// var new_triangles = [];\n\tvar a = edge[0];\n\tvar b = edge[1];\n\tvar c = 0;\n\tvar use_tri = null;\n\t//If P has more than one element then\n\tif (poly.length > 1) {\n\t\t// c:=First vertex of P\n\t\t// For each vertex v in P do\n\t\tfor (var v=0; v<poly.length; v++) {\t\n\t\t\t// If v ∈ CircumCircle (a, b, c) then\n\t\t\tvar new_tri = new DelaunayTriangle(a, b, poly[c]);\n\t\t\tif (Math.pow(_delaunay_distance(poly[v], new_tri), 2) < new_tri.r) {\n\t\t\t\t//c:=v\n\t\t\t\tc = v;\n\t\t\t\tuse_tri = new DelaunayTriangle(a, b, poly[c]);\n\t\t\t}\n\t\t\t//EndIf\n\t\t}\n\t\t//EndFor\n\t\t//Divide P into PE and PD giving P=PE +c+PD\n\t\tvar poly_e = poly.slice(0, c);\n\t\tvar poly_d = poly.slice(c + 1);\n\t\t//TriangulatePseudoPolygon(PE , ac, T)\n\t\ttriangulate_polygon(poly_e, [a, poly[c]], triangles);\n\t\t//TriangulatePseudoPolygon(PD , cd, T)\n\t\ttriangulate_polygon(poly_d, [poly[c], b], triangles);\n\t} else if (poly.length) {\n\t\tuse_tri = new DelaunayTriangle(a, b, poly[c]);\n\t}\n\t// EndIf\n\t//If P is not empty then\n\tif (use_tri) {\n\t\t// Add triangle with vertices a, b, c into T\n\t\ttriangles.push(use_tri);\n\t} else if (poly.length) {\n\t\tvar force_tri = new DelaunayTriangle(a, b, poly[c]);\n\t\tforce_tri.forced = true;\n\t\ttriangles.push(force_tri);\n\t}\n\t//EndIf\n\treturn triangles;\n}", "generateTriangles()\r\n{\r\n //Your code here\r\n var deltaX = (this.maxX - this.minX)/this.div;\r\n var deltaY = (this.maxY - this.minY)/this.div;\r\n \r\n // Populate vertex buffer and normal buffer\r\n for(var i = 0; i <= this.div; i++){\r\n for(var j = 0; j <= this.div; j++){\r\n this.vBuffer.push(this.minX + deltaX * j); //Start from bottom left, to the right \r\n this.vBuffer.push(this.minY + deltaY * i); // i is constant, Y is constant\r\n this.vBuffer.push(0);\r\n \r\n this.nBuffer.push(0);\r\n this.nBuffer.push(0);\r\n this.nBuffer.push(0);\r\n\r\n }\r\n }\r\n \r\n // Populate face buffer (index into vertex buffer)\r\n for(var i = 0; i < this.div; i++){\r\n for(var j = 0; j < this.div; j++){\r\n var locBuffer = i * (this.div + 1) + j;\r\n // First triangle in a square\r\n this.fBuffer.push(locBuffer);\r\n this.fBuffer.push(locBuffer + 1);\r\n this.fBuffer.push(locBuffer + this.div + 1);\r\n \r\n // Second triangle in a square\r\n this.fBuffer.push(locBuffer + 1);\r\n this.fBuffer.push(locBuffer + this.div + 1 + 1);\r\n this.fBuffer.push(locBuffer + this.div + 1);\r\n }\r\n }\r\n \r\n //(Div + 1) is the size of the grid\r\n this.numVertices = this.vBuffer.length/3;\r\n this.numFaces = this.fBuffer.length/3;\r\n this.diamondSquare(this.div + 1);\r\n this.setNormal();\r\n}", "function rightTriangle(sides) {\n let hypotenuse = Math.max(...sides);\n let legs = sides.filter(side => side !== hypotenuse);\n \n return Math.pow(legs[0], 2) + Math.pow(legs[1], 2) === Math.pow(hypotenuse, 2);\n}", "function triangle(side1, side2, side3) {\n let perimeter = side1 + side2 + side3;\n let longest = Math.max(side1, side2, side3);\n let shortest = Math.min(side1, side2, side3);\n let middle = perimeter - longest - shortest;\n\n if (isValid(shortest, middle, longest)) {\n return getTriangleType(side1, side2, side3);\n } else {\n return \"invalid\";\n }\n}", "function generatePascalsTriangle() {\n var result = [];\n var iRow, iVal, leftVal, rightVal, thisRow;\n for (iRow = 0; iRow < maxRows; ++iRow) {\n // special case for first row\n if (iRow === 0) {\n result.push([1]);\n continue;\n }\n thisRow = [];\n for (iVal = 0; iVal <= iRow; ++iVal) {\n leftVal = (iVal === 0 ? 0 : result[iRow - 1][iVal - 1]);\n rightVal = (iVal === iRow ? 0 : result[iRow - 1][iVal]);\n thisRow.push(leftVal + rightVal);\n }\n result.push(thisRow);\n }\n return result;\n}", "function drawQuad(centerPos, transform)\n{\n if(!global.scene.isRecording())\n {\n fadePath = false;\n\n var left = centerPos.x - 3;\n var right = centerPos.x + 3;\n var top = centerPos.z + 3;\n var bottom = centerPos.z - 3; \n \n var colorVal = new vec3(1,1,1);\n \n var v1 = centerPos.add(transform.forward.uniformScale(3.0)).add(transform.right.uniformScale(-3.0));\n var v2 = centerPos.add(transform.forward.uniformScale(-3.0)).add(transform.right.uniformScale(-3.0));\n var v3 = centerPos.add(transform.forward.uniformScale(-3.0)).add(transform.right.uniformScale(3.0));\n var v4 = centerPos.add(transform.forward.uniformScale(3.0)).add(transform.right.uniformScale(3.0));\n builder.appendVerticesInterleaved([\n // Position Normal UV Color Index\n v1.x, centerPos.y, v1.z, 0, 0, 1, 0, 1, colorVal.x,colorVal.y,colorVal.z,0, // 0\n v2.x, centerPos.y, v2.z, 0, 0, 1, 0, 0, colorVal.x,colorVal.y,colorVal.z,0, // 1 \n v3.x, centerPos.y, v3.z, 0, 0, 1, 1, 0, colorVal.x,colorVal.y,colorVal.z,0, // 2\n v4.x, centerPos.y, v4.z, 0, 0, 1, 1, 1, colorVal.x,colorVal.y,colorVal.z,0, // 3 \n ]);\n \n var startIndex = (pointCounter-1) * 4;\n builder.appendIndices([\n 0 + startIndex, 1 + startIndex, 2 + startIndex, // First Triangle\n 2 + startIndex, 3 + startIndex, 0 + startIndex, // Second Triangle\n ]);\n \n if(builder.isValid()){\n script.drawingObject.mesh = builder.getMesh();\n builder.updateMesh();\n }\n else{\n print(\"Follow Path Anim: Mesh data invalid!\");\n }\n } \n}", "function triangleSolver() {\n // this.given_conditions = {a:4, b:6, c:9}; //sss\n // this.given_conditions = {a:4, b:60, c:9}; //sas\n // this.given_conditions = {a:50,b:3,c:20}; //asa\n // this.given_conditions = {a:20,b:50,c:5} //aas\n // this.given_conditions = {a:2,b:4,c:1}; //sss-not possible\n // this.given_conditions = {a:5,b:2,c:70} //ssa; no solutions\n this.given_conditions = {a:5,b:10,c:70} //ssa; one solution\n // this.given_conditions = {a:16,b:10,c:30} //ssa; two solutions\n\n\n // converts degrees to radians\n var convertDegsToRads = function(degree_angle) {\n var radian_angle = degree_angle*(Math.PI)/180;\n return radian_angle;\n };\n\n // converts radians to degrees\n var convertRadsToDegs = function(radian_angle) {\n var degree_angle = radian_angle/(Math.PI)*180;\n return degree_angle;\n };\n\n // finds third angle given two angles, must be in degrees\n var findThirdAngle = function(angle1,angle2) {\n var angle = 180 - angle1 - angle2;\n return angle;\n }\n\n // finds the angle opposite of first_side, angles are in rads\n var lawOfCosinesAngle = function(first_side,second_side,third_side) {\n var angle = Math.acos((second_side**2 + third_side**2 - first_side**2) / (2*second_side*third_side));\n angle = convertRadsToDegs(angle); // convert from radians to degrees\n return angle;\n };\n\n // finds the (third) side opposite of the given angle, angles are in rads\n var lawOfCosinesSide = function(angle,first_side,second_side) {\n var side = (first_side**2 + second_side**2 - 2*first_side*second_side*(Math.cos(angle)))**(0.5);\n return side;\n };\n\n // finds the angle opposite of second_side, given that first_angle is opposite of first_side, angles are in rads\n var lawOfSinesAngle = function(first_angle,first_side,second_side) {\n var angle = Math.asin(second_side*(Math.sin(first_angle)/first_side));\n angle = convertRadsToDegs(angle); // convert from radians to degrees\n return angle;\n };\n\n // finds the side opposite of second_angle, given that first_angle is opposite of first_side, angles are in rads\n var lawOfSinesSide = function(first_angle,first_side,second_angle) {\n var side = Math.sin(second_angle)*first_side/Math.sin(first_angle);\n return side;\n };\n\n // determines if a triangle is possible to construct given three sides using Triangle Inequality Theorem\n // this.given_conditions = {a:2,b:4,c:1}; // sss-not possible\n this.tit = function() {\n var side1 = this.given_conditions.a;\n var side2 = this.given_conditions.b;\n var side3 = this.given_conditions.c;\n\n if (side1 + side2 > side3 && side1 + side3 > side2 && side3 + side2 > side1) {\n return this.sss();\n } else {\n return \"This is not a constructible triangle.\"\n };\n };\n\n\n // finds three angles when the given conditions are only sides\n // this.given_conditions = {a:4, b:6, c:9}; //sss\n this.sss = function() {\n var side1 = this.given_conditions.a;\n var side2 = this.given_conditions.b;\n var side3 = this.given_conditions.c;\n var solutions = {};\n\n solutions.angle1 = lawOfCosinesAngle(side1,side2,side3);\n solutions.angle2 = lawOfCosinesAngle(side2,side1,side3);\n solutions.angle3 = lawOfCosinesAngle(side3,side1,side2);\n\n return solutions;\n };\n\n // finds two angles opposite of the given sides and the side opposite of the given angle\n // this.given_conditions = {a:4, b:60, c:9};\n // this.given_conditions = {non-paired side, non-paired angle, non-paired side};\n this.sas = function () {\n\n var side1 = this.given_conditions.a;\n var angle3 = convertDegsToRads(this.given_conditions.b);\n var side2 = this.given_conditions.c;\n var solutions = {};\n\n solutions.side3 = lawOfCosinesSide(angle3,side1,side2);\n solutions.angle1 = lawOfSinesAngle(angle3,solutions.side3,side1);\n solutions.angle2 = lawOfCosinesAngle(side2,solutions.side3,side1);\n\n return solutions;\n };\n\n // finds two sides opposite of the given angles and the angle opposite of the given side\n // this.given_conditions = {a:50,b:3,c:20}\n // this.given_conditions = {non-paired angle, non-paired side, non-paired angle} //aas\n\n this.asa = function(){\n\n var angle1 = this.given_conditions.a;\n var side2 = this.given_conditions.b;\n var angle3 = this.given_conditions.c;\n var solutions = {};\n\n solutions.angle2 = findThirdAngle(angle1,angle3);\n solutions.side1 = lawOfSinesSide(convertDegsToRads(solutions.angle2),side2,convertDegsToRads(angle1));\n solutions.side3 = lawOfSinesSide(convertDegsToRads(solutions.angle2),side2,convertDegsToRads(angle3));\n\n return solutions;\n };\n // finds two sides and an angle, given that there is one opposite pair\n // this.given_conditions = {a:20,b:50,c:5} //aas\n // this.given_conditions = {non-paired angle, pair angle, pair side} //aas\n this.aas = function(){\n\n var angle1 = this.given_conditions.a;\n var angle2 = this.given_conditions.b;\n var side2 = this.given_conditions.c;\n var solutions = {};\n\n solutions.angle3 = findThirdAngle(angle1,angle2);\n solutions.side1 = lawOfSinesSide(convertDegsToRads(angle2),side2,convertDegsToRads(angle1));\n solutions.side3 = lawOfSinesSide(convertDegsToRads(angle2),side2,convertDegsToRads(solutions.angle3));\n\n return solutions;\n };\n\n // finds two angles and a side, given that there is one opposite pair\n // this handles ambiguous situations\n // this.given_conditions = {non-paired side, paired side, paired angle} //aas\n // this.given_conditions = {a:5,b:2,c:70} //ssa; no solutions\n // this.given_conditions = {a:5,b:10,c:70} //ssa; one solution\n // this.given_conditions = {a:16,b:10,c:30} //ssa; two solutions\n this.ssa = function(){\n\n var side1 = this.given_conditions.a;\n var side2 = this.given_conditions.b;\n var angle2 = convertDegsToRads(this.given_conditions.c);\n var solutions = {};\n var angle1 = lawOfSinesAngle(angle2,side2,side1);\n\n // ratio determines whether a triangle is possible\n // var ratio = side1*Math.sin(angle2)/side2;\n\n if (isNaN(angle1)) {\n return \"No possible triangle\";\n } else if ( (180 - angle1) + convertRadsToDegs(angle2) > 180) {\n // only one solution\n return \"one solution\";\n // var angle3 = findThirdAngle(angle1,convertRadsToDegs(angle2));\n // return angle3;\n } else {\n // two solution sets\n return \"two solutions\";\n\n };\n\n // solutions.angle3 = findThirdAngle(angle1,angle2);\n // solutions.side1 = lawOfSinesSide(convertDegsToRads(angle2),side2,convertDegsToRads(angle1));\n // solutions.side3 = lawOfSinesSide(convertDegsToRads(angle2),side2,convertDegsToRads(solutions.angle3));\n\n // return angle1;\n };\n\n\n}", "function isTriangle(a, b, c) {\n \n [a, b, c] = [a, b, c].sort((x, y) => x - y);\n \n return a + b > c;\n}", "function buildTriangle(x){\n var str=\"\";\n for(var i=1;i<=x;i++){\n str+=makeLine(i);\n }\n return str;\n}", "areCoordsWithinTriangle(coord, pointA, pointB, pointC) {\n let calcPointAB = ((coord.y - pointA.y) * (pointB.x - pointA.x) - (coord.x - pointA.x) * (pointB.y - pointA.y));\n let calcPointBC = ((coord.y - pointB.y) * (pointC.x - pointB.x) - (coord.x - pointB.x) * (pointC.y - pointB.y));\n let calcPointCA = ((coord.y - pointC.y) * (pointA.x - pointC.x) - (coord.x - pointC.x) * (pointA.y - pointC.y));\n\n if (calcPointAB * calcPointBC > 0 && calcPointBC * calcPointCA > 0) {\n return true;\n } else {\n return false;\n }\n }", "function kiemTra(X, Y, viTriMoi){\n X = viTriX + X;\n Y = viTriY + Y;\n viTriMoi = viTriMoi || ViTriXoay; // khi xoay khoi co bi qua ngoai man hinh khong\n\n\n\n for ( var y = 0; y < 4; ++y ) {\n for ( var x = 0; x < 4; ++x ) {\n if ( viTriMoi [ y ][ x ] ) {\n if ( typeof bangGiaTri[ y + Y ] == 'undefined' // kiem tra cac Dk cua khoi co kha thi hay khong, khong ra ngoai khung hinh\n || typeof bangGiaTri[ y + Y ][ x + X ] == 'undefined'\n || bangGiaTri[ y + Y ][ x + X ]\n || x + X < 0\n || y + Y >= dongBang\n || x + X>= cotBang ) {\n if (Y == 1) \n\t\t\t\t\t{\n\t\t\t\t\t\tThua = true; // neu khoi dang o dong tren cung thi thua\n\t\t\t\t\t\t\n\t\t\t\t\t}\n return false;\n }\n }\n }\n }\n return true;\n}", "function triangle(a1, a2, a3) {\n let total = a1 + a2 + a3;\n let angles = [a1, a2, a3];\n \n if (angles.includes(0) || total !== 180) return \"invalid\";\n if (angles.includes(90)) {\n return \"right\";\n } else if (angles.every(degree => degree < 90)) {\n return \"acute\";\n } else {\n return \"obtuse\";\n }\n}", "function isTriangleNumber(number) {\n if (number < 0) return false\n if (number === 0) return true;\n let sum=0;\n for(let i=1; i<=number; i++){\n sum+=i; \n if(sum===number){ \n return true; \n }\n }\n return false;\n}", "generateTriangles()\r\n{\r\n //Your code here\r\n var deltaX = (this.maxX - this.minX) / this.div;\r\n var deltaY = (this.maxY - this.minY) / this.div;\r\n\r\n for (var i = 0; i <= this.div; i++) {\r\n for (var j = 0; j <= this.div; j++) {\r\n // Fill the vertexes by interpolating across\r\n this.vBuffer.push(this.minX + deltaX * j);\r\n this.vBuffer.push(this.minY + deltaY * i);\r\n this.vBuffer.push(0); // set the z value to 0 initially for diamond-square\r\n // terrain is flat so normal starts with 0 in x and y\r\n this.nBuffer.push(0);\r\n this.nBuffer.push(0);\r\n this.nBuffer.push(1);\r\n }\r\n }\r\n\r\n for (var i = 0; i < this.div; i++) {\r\n for (var j = 0; j < this.div; j++) {\r\n var vid = i * (this.div + 1) + j;\r\n // fill in the faces\r\n this.fBuffer.push(vid);\r\n this.fBuffer.push(vid + 1);\r\n this.fBuffer.push(vid + this.div + 1);\r\n\r\n this.fBuffer.push(vid + 1);\r\n this.fBuffer.push(vid + 1 + this.div + 1);\r\n this.fBuffer.push(vid + this.div + 1);\r\n }\r\n }\r\n this.numVertices = this.vBuffer.length/3;\r\n this.numFaces = this.fBuffer.length/3;\r\n // Do the algorithm and then update the normals based on how the diamond square algorithm worked\r\n this.diamondSquare();\r\n this.updateVertexNormals();\r\n}", "function countTriangle(alas, tinggi) {\n var luas = 0.5*(alas*tinggi);\n return luas;\n}", "function genTriangle(svg, xCoord, yCoord, size, newColor)\n{\n deviceID++;\n\n // make a container to hold the triangle and text box\n var thisLayer = svg.select(\"#layer3\")\n .append(\"g\") \n .attr(\"id\", \"device\" + deviceID + \"container\")\n .attr(\"transform\", function() {\n return \"translate(\" + xCoord + \",\" + yCoord + \")\";\n });\n \n // add the triangle element \n thisLayer.append(\"path\")\n .attr(\"id\", \"device\" + deviceID)\n .attr(\"class\", \"point\")\n .style(\"fill\", DEVICES_COLOR)\n .attr(\"d\", d3.svg.symbol().type(\"triangle-up\"))\n .attr(\"size\", size);\n \n // the text box will be added when the optimization happens\n}", "function inQuad(p, l1, l2, l3, l4) {\n\tlet p1 = cross(l1, l2),\n\t\tp2 = cross(l2, l3),\n\t\tp3 = cross(l3, l4),\n\t\tp4 = cross(l4, l1)\n\n\tp1 = [p1[0]/p1[2], p1[1]/p1[2]]\n\tp2 = [p2[0]/p2[2], p2[1]/p2[2]]\n\tp3 = [p3[0]/p3[2], p3[1]/p3[2]]\n\tp4 = [p4[0]/p4[2], p4[1]/p4[2]]\n\n\treturn inTriangle(p, p1, p2, p3) || inTriangle(p, p2, p3, p4)\n}", "function Quadrilateral (sideOneLength,sideTwoLength,sideThreeLength,sideFourLength) {\n var sideOne = new Side (sideOneLength)\n var sideTwo = new Side (sideTwoLength)\n var sideThree = new Side (sideThreeLength)\n var sideFour = new Side (sideFourLength)\n var sidesArray = [sideOne, sideTwo, sideThree, sideFour]\n Polygon.call (this,sidesArray)\n}", "function drawTriangle()\n{\n var canvas=document.getElementById('myCanvas');\n var context=canvas.getContext('2d');\n \n //BRAZIL FLAG\n \n //DRAW RECTANGLE\n context.fillStyle='#00A859'; //colours the rectangle green\n context.fillRect(0,0,353,247); //sets x, y, width, height. This creates the rectangle needed for the flag.\n \n //DRAW DIAMOND\n context.fillStyle = \"#FFCC29\"; //colours the diamond green\n context.beginPath(); //starts a new path\n context.moveTo(45,124); //moves the path to the point x,y. This is the starting position of the diamond.\n context.lineTo(177,45); //creates a line to and from x,y. The lineTo draws a line \n context.lineTo(308,124);\n context.lineTo(177,202);\n context.closePath(); //closes the path\n context.fill(); //fills the diamond with colour\n \n //DRAW CIRCLE\n context.fillStyle = \"#3E4095\" //colour of the circle\n context.beginPath(); //starts a new path\n context.arc(177,124,50,50,Math.PI*2, true); //draws the circle\n context.fill(); //fills the circle with colour\n context.closePath(); //closes the path\n context.stroke(); \n}", "function myFunction() {\n\n var a = parseInt(document.getElementById(\"one\").value);\n var b = parseInt(document.getElementById(\"two\").value);\n var c = parseInt(document.getElementById(\"three\").value);\n // console.log(a);\n // console.log(b);\n // console.log(c);\n var result = triangles(a, b, c);\n\n alert(result)\n}", "function isTriangle(a,b,c)\n{\n var max = 0;\n if (a > b) {\n if (a > c) max = a;\n else max = c;\n }\n else {\n if (b > c) max = b;\n else max = c;\n }\n if(max == a) return c + b > a;\n if(max == b) return c + a > b;\n if(max == c) return b + a > c;\n\n}", "function inTriangle(arr){\n var c1 = crossProduct(arr[0], findPoint, arr[1]);\n var c2 = crossProduct(arr[1], findPoint, arr[2]);\n var c3 = crossProduct(arr[2], findPoint, arr[0]);\n if(c1*c2 >= 0 && c2*c3 >= 0 && c3*c1 >= 0){\n return true;\n }else{\n return false;\n }\n}", "function createTriangles(){ \n\t\t/* Obj.triangles = [[0,1,2], [3,4,5], ...] */\n\t\tObj.triangles = [];\n\t\tfor(var i = 0; i<Obj.positions.length/3; ++i){\n\t\t\tObj.triangles[i] = [3*i, 3*i+1, 3*i+2];\n\t\t}\n\t}", "get isConvex() {\n const { _coords } = this\n const numCoords = _coords.length\n\n if (numCoords < 6) return true\n else {\n for (let i = 0; i < numCoords; i += 2) {\n if (\n !this.isConvexTriangle(\n _coords[i],\n _coords[i + 1],\n _coords[(i + 2) % numCoords],\n _coords[(i + 3) % numCoords],\n _coords[(i + 4) % numCoords],\n _coords[(i + 5) % numCoords]\n )\n ) {\n return false\n }\n }\n }\n\n return true\n }", "function triangles() {\n\n\tvar jumbotronBg = document.getElementById('triangles');\n\tvar dimensions = jumbotronBg.getClientRects()[0];\n\n\tvar pattern = Trianglify({\n\t\tcell_size: 60,\n\t\twidth: dimensions.width, \n\t\theight: dimensions.height\n\t});\n\n\turl = pattern.canvas().toDataURL();\n\tjumbotronBg.style.background='url('+url+')'\n}", "function genSides(x){\r\n ro = [];\r\n co = [];\r\n for(var i = 0; i < x; i++){\r\n var c = 0;\r\n var cStr = \"\";\r\n var cBoo = false;\r\n\r\n var r = 0;\r\n var rStr = \"\";\r\n var rBoo = false;\r\n for(var k = 0; k < x; k++){\r\n if((cBoo == true && puz[i][k] == 0)|| (cBoo == true && puz[i][k] == 2)){\r\n cStr += c;\r\n c = 0;\r\n cBoo = false;\r\n cStr += \"<br>\";\r\n }\r\n\r\n if(puz[i][k] == 1){\r\n c++;\r\n cBoo = true;\r\n }\r\n\r\n if(k == (x-1) && puz[i][k] == 1){\r\n cStr += c;\r\n c = 0;\r\n cBoo = false;\r\n cStr += \" \";\r\n }\r\n\r\n if((rBoo == true && puz[k][i] == 0) || (rBoo == true && puz[k][i] == 2)){\r\n rStr += r;\r\n r = 0;\r\n rBoo = false;\r\n rStr += \" \";\r\n }\r\n\r\n if(puz[k][i] == 1){\r\n r++;\r\n rBoo = true;\r\n }\r\n\r\n if(k == (x-1) && puz[k][i] == 1){\r\n rStr += r;\r\n r = 0;\r\n rBoo = false;\r\n rStr += \" \";\r\n }\r\n }\r\n co.push(cStr);\r\n ro.push(rStr);\r\n }\r\n}", "function verifDiagonaleSlach() {\r\n\r\n let j = x;\r\n let k = y;\r\n\r\n //Initialisation des valeurs x et y pour la verification de la diagonale \r\n if (j != 0 && k != 0) {\r\n while (j != 0 && k != 0) {\r\n j--;\r\n k--;\r\n };\r\n }\r\n\r\n //Boucle de verification de la diagonale Slash\r\n if (j < 4 && k < 3) {\r\n do {\r\n if (document.querySelector(`#x${j}y${k}`).color == color &&\r\n document.querySelector(`#x${j + 1}y${k + 1}`).color == color &&\r\n document.querySelector(`#x${j + 2}y${k + 2}`).color == color &&\r\n document.querySelector(`#x${j + 3}y${k + 3}`).color == color) {\r\n\r\n if (playerActive == 1) {\r\n text1 = document.querySelector('.row')\r\n text1.innerHTML = \"victoire\".toUpperCase()\r\n text1.style.color = \"yellow\"\r\n text1.style.fontSize = \"170\"\r\n } else {\r\n text2 = document.querySelector('.row')\r\n text2.innerHTML=\"défaite\".toUpperCase()\r\n text2.style.color=\"red\"\r\n text2.style.fontSize=\"170\"\r\n }\r\n }\r\n j++;\r\n k++;\r\n } while (j < 3 && k < 3);\r\n }\r\n}", "function drawTriangle(size) {\n document.write('<br>');\n \n for(let i=0 ; i< size ; i++){\n for(let a=0; a<i; a++){\n document.write('&nbsp;') \n }\n for(let j=i; j<size; j++){\n //document.write( 'i=' + i + ' and j= ' + j );\n document.write(' $ ');\n }\n \n document.write('<br>');\n }\n }", "function init (e, input) {\n const rows = input.split('\\n')\n let validTriangles = rows.reduce(function (validTriangles, sides) {\n return sides !== '\\n' && isValidTriangle(sides) ? validTriangles + 1 : validTriangles\n }, 0)\n\n console.log(validTriangles)\n return validTriangles\n}", "function buildFace(geometry,triangleNumber,startPoint){\n\tvar material = new THREE.MeshStandardMaterial( { color : 0x000000 ,wireframe: true } );\n\tvar nextIndex = 0\n\tfor(i = triangleNumber; i>0; i--){\n\t\tstartPoint = buildTriangleLine(geometry,0.10,0.10,i,startPoint,nextIndex);\n\t\tnextIndex += 3*i;\n\t}\n\n\tstartPoint = new THREE.Vector3( -40, -30,startPoint.z);\n\ttriangleNumber--;\n\tfor(i = triangleNumber; i>0; i--){\n\t\tstartPoint = buildInvertedTriangleLine(geometry,0.10,0.10,i,startPoint,nextIndex);\n\t\tnextIndex += 3*i;\n\t}\n\t\n\tbuildBottomBorders(geometry,nextIndex);\n\tnextIndex += 6;\n\tbuildRightBorder(geometry,nextIndex);\n\tnextIndex += 6;\n\tbuildLeftBorder(geometry,nextIndex);\n\tnextIndex += 6;\n\treturn new THREE.Mesh( geometry, material );\n}", "function isTriangle(angle1, angle2, angle3) {\n const angles = angle1 + angle2 + angle3;\n\n return angles === 180;\n\n}", "function setup() {\n createCanvas(800, 800);\n strokeWeight(0);\n\n //Triangulos negros en pareja punta arriba\n for (var x = 160; x < 320; x = x + 20) {\n for (var y = 160; y < 320; y = y + 20) {\n fill(0);\n triangle(x, y, x, y + 20, x + 20, y + 20);\n noFill();\n\n }\n }\n\n //linea superior rectángulo blanco linea 1 y 5 + triangulo pareja \n //punta abajo\n for (var a = 200; a < 320; a = a + 80) {\n for (var b = 160; b < 320; b = b + 80) {\n fill(255)\n rect(a, b, 40, 20);\n noFill();\n\n fill(0);\n triangle(a, b, a + 20, b, a + 20, b + 20);\n triangle(a + 20, b, a + 40, b, a + 40, b + 20);\n noFill();\n\n }\n }\n\n\n //rectangulos línea 2 y 6 + triangulos punta abajo en pareja \n\n for (var c = 180; c < 320; c = c + 80) {\n for (var d = 180; d < 320; d = d + 80) {\n fill(255)\n rect(c, d, 40, 20);\n noFill();\n\n fill(0);\n triangle(c, d, c + 20, d, c + 20, d + 20);\n triangle(c + 20, d, c + 40, d, c + 40, d + 20);\n noFill();\n\n }\n }\n //rectangulos linea 3 y 7 + triangulos punta abajo en parejas \n for (var e = 160; e < 320; e = e + 80) {\n for (var f = 200; f < 320; f = f + 80) {\n fill(255)\n rect(e, f, 40, 20);\n noFill();\n\n fill(0)\n triangle(e, f, e + 20, f, e + 20, f + 20);\n triangle(e + 20, f, e + 40, f, e + 40, f + 20);\n noFill();\n\n\n }\n }\n\n // Rectángulos linea 4 y 8 + triangulos en pareja punta abajo \n for (var g = 140; g < 318; g = g + 80) {\n for (var h = 220; h < 318; h = h + 80) {\n fill(255)\n rect(g, h, 40, 20);\n noFill();\n fill(0);\n triangle(g, h, g + 20, h, g + 20, h + 20);\n triangle(g + 20, h, g + 40, h, g + 40, h + 20);\n noFill();\n fill(255)\n rect(140, 220, 20, 20)\n noFill();\n fill(255)\n rect(140, 300, 20, 20);\n noFill();\n fill(255)\n rect(320, 220, 20, 20);\n noFill();\n fill(255)\n rect(320, 300, 20, 20);\n noFill();\n\n }\n }\n}", "function triangular(n) {\n \n}", "function triArea() {\n let side1 = document.getElementById('side1').value;\n let side2 = document.getElementById('side2').value;\n let side3 = document.getElementById('side3').value;\n side1 = parseInt(side1);\n side2 = parseInt(side2);\n side3 = parseInt(side3);\n\n const resultArea = document.getElementById('resultArea');\n\n let s = (side1 + side2 + side3) / 2;\n let area = Math.sqrt(s * ((s - side1) * (s - side2) * (s - side3)));\n console.log(area);\n resultArea.innerHTML = `<p>The area of Triangle is ${area}</p>`;\n}", "boolMouseInTriangle(p, p0, p1, p2) {\n // 초기값 예외\n const startStayMousePosition = (p0.x === 0 && p0.y === 0);\n if (startStayMousePosition) return this.boolTriangle = false;\n\n // 삼각형 안에 마우스 유무 계산 => true / false 반환 \n this.boolTriangle = (((p1.y - p0.y) * (p.x - p0.x) - (p1.x - p0.x) * (p.y - p0.y)) || ((p2.y - p1.y) * (p.x - p1.x) - (p2.x - p1.x) * (p.y - p1.y)) || ((p0.y - p2.y) * (p.x - p2.x) - (p0.x - p2.x) * (p.y - p2.y))) >= 0;\n return this.boolTriangle;\n }", "generateTrianglePts(x, y) {\n return this.generateRightPointTriangle(x, y, 12, 10);\n }", "function generateTriangles(width, height) {\n var data = [];\n for (var j = 0; j < height; j++)\n {\n for (var i = 0; i <= width; i++)\n {\n data.push(i + j*(width+1)); //current pos\n data.push(i + (j+1)*(width+1)); //next row\n }\n //data.push(i + (j+1)*(width+1)); //next row\n data.push(0 + (j+1)*(width+1));\n \n }\n return data;\n}", "function buildTriangle(num) {\n var log = \"\";\n for (var k = 1; k <= num; k++) {\n log += makeLine(k);\n }\n return log;\n}", "generate() {\n\t\t// clear points and triangles\n\t\tvar points = [];\n\t\tthis.triangles = [];\n\n\t\t// generating points\n\t\tfor (let i = 0; i < this.rows; i++) {\n\t\t\tfor (let j = 0; j < this.columns; j++) {\n\t\t\t\tlet point = {};\n\t\t\t\t// generate y coordinates of points\n\t\t\t\tpoint.y = (i * this.size * 0.801) - this.size;\n\t\t\t\t// shift y coordinate for each point\n\t\t\t\tpoint.y += (Math.random() - 0.5) * this.variance * this.size * 2;\n\n\t\t\t\t// even row\n\t\t\t\tif (i % 2 == 0) {\n\t\t\t\t\t// generate and shift x coordinates\n\t\t\t\t\tpoint.x = (j * this.size) - this.size;\n\t\t\t\t\tpoint.x += (Math.random() - 0.5) * this.variance * this.size * 2;\n\t\t\t\t}\n\t\t\t\t// odd row\n\t\t\t\telse {\n\t\t\t\t\t// generate and shift x coordinates\n\t\t\t\t\tpoint.x = (j * this.size) - this.size + (this.size / 2);\n\t\t\t\t\tpoint.x += (Math.random() - 0.5) * this.variance * this.size * 2;\n\t\t\t\t}\n\t\t\t\tpoints.push(point);\n\t\t\t}\n\t\t}\n\n\t\t// generating triangle classes with these points\n\t\tfor (let i = 0; i < points.length; i++) {\n\t\t\tconst row = Math.floor(i / this.columns);\n\n\t\t\tif (i % this.columns !== this.columns - 1 && i < ((this.rows - 1) * this.columns)) {\n\t\t\t\tlet t1;\n\t\t\t\tlet t2;\n\n\t\t\t\t// even row\n\t\t\t\tif (row % 2 == 0) {\n\t\t\t\t\tt1 = new Triangle(points[i], points[i + 1], points[this.columns + i]);\n\t\t\t\t\tt2 = new Triangle(points[i + 1], points[this.columns + i + 1], points[this.columns + i]);\n\t\t\t\t}\n\t\t\t\t// odd row\n\t\t\t\telse {\n\t\t\t\t\tt1 = new Triangle(points[i], points[this.columns + i + 1], points[this.columns + i]);\n\t\t\t\t\tt2 = new Triangle(points[i], points[i + 1], points[this.columns + i + 1]);\n\t\t\t\t}\n\t\t\t\tthis.triangles.push(t1, t2);\n\t\t\t}\n\t\t}\n\t}", "checkValidity(){\n let val_a = +this.state.val_a;\n let val_b = +this.state.val_b;\n let val_c = +this.state.val_c;\n\n if (val_a <= 0 || val_b <= 0 || val_c <= 0) {\n this.setState(state => ({\n validatorMessage: 'A triangle\\'s side cannot be zero or negative in length',\n isValidTriangle: false,\n isValidInput: false\n }))\n } else if((val_a + val_b) < val_c ||\n (val_a + val_c) < val_b ||\n (val_b + val_c) < val_a) {\n this.setState(state => ({\n validatorMessage: 'The given values cannot form a valid triangle',\n isValidTriangle: false,\n isValidInput: false\n }))\n } else {\n this.setState(state => ({\n isValidTriangle: true,\n isValidInput: true,\n sides: [ val_a, val_b, val_c]\n }))\n }\n }", "get numTriangles() {\n const numVertices = this.numVertices\n return numVertices >= 3 ? numVertices - 2 : 0\n }", "function rightTriangle(sideA,sideB,sideC) {\n\n var combination1=((square(sideA)+square(sideB))==square(sideC));\n var combination2=((square(sideB)+square(sideC))==square(sideA));\n var combination3=((square(sideA)+square(sideC))==square(sideB));\n\n\n return (combination1||combination2||combination3);\n\n }", "function triangle(side1, side2, side3) {\n let [shortest, middle, longest] = [side1, side2, side3].sort((a, b) => a - b);\n if (isValidTriangle(shortest, middle, longest)) {\n return getTriangleType(side1, side2, side3);\n } else {\n return \"invalid\";\n }\n}", "generateTriangles()\n{\n //Your code here\n var dx = (this.maxX - this.minX) / this.div;\n var dy = (this.maxY - this.minY) / this.div;\n \n // Push vertex buffer\n for(var i = 0; i <= this.div; i ++)\n for(var j = 0; j <= this.div; j ++){\n this.vBuffer.push(this.minX + dx * j);\n this.vBuffer.push(this.minY + dy * i);\n this.vBuffer.push(0);\n }\n // Set Normal Buffer\n for(var i = 0; i <= this.div; i ++)\n for(var j = 0; j <= this.div; j ++){\n this.nBuffer.push(0);\n this.nBuffer.push(0);\n this.nBuffer.push(0);\n }\n for(var i = 0; i < this.div; i ++)\n for(var j = 0; j < this.div; j ++){\n \n // Revised div\n var rdiv = this.div + 1;\n // Revised vindex\n var vindex = i * rdiv + j;\n \n\n this.fBuffer.push(vindex);\n this.fBuffer.push(vindex + 1);\n this.fBuffer.push(vindex + rdiv);\n\n this.fBuffer.push(vindex + 1);\n this.fBuffer.push( vindex + 1 + rdiv );\n this.fBuffer.push( vindex + rdiv );\n\n }\n this.numVertices = this.vBuffer.length/3;\n this.numFaces = this.fBuffer.length/3;\n}", "triangulate(indexData = null, offset = 0) {\n // Algorithm \"Ear clipping method\" described here:\n // -> https://en.wikipedia.org/wiki/Polygon_triangulation\n //\n // Implementation inspired by:\n // -> http://polyk.ivank.net\n\n const { _coords } = this\n const { sRestIndices } = Polygon\n\n const numVertices = this.numVertices\n const numTriangles = this.numTriangles\n let i, restIndexPos, numRestIndices\n\n if (!indexData) indexData = new IndexData(numTriangles * 3)\n if (numTriangles === 0) return indexData\n\n Polygon.sRestIndices.length = numVertices\n for (i = 0; i < numVertices; ++i) Polygon.sRestIndices[i] = i\n\n restIndexPos = 0\n numRestIndices = numVertices\n\n const a = Pool.getPoint()\n const b = Pool.getPoint()\n const c = Pool.getPoint()\n const p = Pool.getPoint()\n\n while (numRestIndices > 3) {\n // In each step, we look at 3 subsequent vertices. If those vertices spawn up\n // a triangle that is convex and does not contain any other vertices, it is an 'ear'.\n // We remove those ears until only one remains -> each ear is one of our wanted\n // triangles.\n\n let otherIndex\n let earFound = false\n const i0 = sRestIndices[restIndexPos % numRestIndices]\n const i1 = sRestIndices[(restIndexPos + 1) % numRestIndices]\n const i2 = sRestIndices[(restIndexPos + 2) % numRestIndices]\n\n a.setTo(_coords[2 * i0], _coords[2 * i0 + 1])\n b.setTo(_coords[2 * i1], _coords[2 * i1 + 1])\n c.setTo(_coords[2 * i2], _coords[2 * i2 + 1])\n\n if (this.isConvexTriangle(a.x, a.y, b.x, b.y, c.x, c.y)) {\n earFound = true\n for (i = 3; i < numRestIndices; ++i) {\n otherIndex = sRestIndices[(restIndexPos + i) % numRestIndices]\n p.setTo(_coords[2 * otherIndex], _coords[2 * otherIndex + 1])\n\n if (MathUtil.isPointInTriangle(p, a, b, c)) {\n earFound = false\n break\n }\n }\n }\n\n if (earFound) {\n indexData.addTriangle(i0 + offset, i1 + offset, i2 + offset)\n sRestIndices.removeAt((restIndexPos + 1) % numRestIndices)\n\n numRestIndices--\n restIndexPos = 0\n } else {\n restIndexPos++\n if (restIndexPos === numRestIndices) break // no more ears\n }\n }\n\n Pool.putPoint(a)\n Pool.putPoint(b)\n Pool.putPoint(c)\n Pool.putPoint(p)\n\n indexData.addTriangle(\n Polygon.sRestIndices[0] + offset,\n Polygon.sRestIndices[1] + offset,\n Polygon.sRestIndices[2] + offset\n )\n return indexData\n }", "function triangle(...angles) {\n if (angles.some(isZero) || angles.reduce(sum) !== 180) {\n return 'invalid';\n } else if (angles.some(isNinetyDegrees)) {\n return 'right';\n } else if (angles.some(isGreaterThanNinety)) {\n return 'obtuse'\n } else {\n return 'acute';\n }\n}", "constructor({ length = .5, height = .5, width = .5}) {\n super();\n\n /* Bottom front left */\n this.vertices.push([width, length, 2]);\n\n /* 1) Bottom front right */\n this.vertices.push([width, length * 2, 2]);\n\n /* 2) top front right */\n this.vertices.push([width, length * 2, height + 2]);\n\n /* 3) top front left */\n this.vertices.push([width, length, height + 2]);\n\n /* 4) Bottom back right */\n this.vertices.push([0, length * 2, 2]);\n\n /* 5) Bottom back left */\n this.vertices.push([0, length, 2]);\n\n /* 6) top back right */\n this.vertices.push([0, length * 2, height + 2]);\n\n /* 7) top back left */\n this.vertices.push([0, length, height + 2]);\n\n // Pushing the triangles\n // Triangle 1 front bottom\n this.triangles.push([0, 1, 2]);\n\n //Triangle 2 front top\n this.triangles.push([0, 2, 3]);\n\n // Triangle 3 right bottom\n this.triangles.push([1, 4, 6]);\n\n // Triangle 4 right top\n this.triangles.push([1, 6, 2]);\n\n // Triangle 5 back bottom\n this.triangles.push([4, 5, 7]);\n\n // Triangle 6 back top\n this.triangles.push([4, 7, 6]);\n\n // Triangle 7 left bottom\n this.triangles.push([5, 0, 3]);\n\n // Triangle 8 left top\n this.triangles.push([5, 3, 7]);\n\n // Triangle 9 top bottom\n this.triangles.push([3, 2, 6]);\n\n // Triangle 10 top top\n this.triangles.push([3, 6, 7]);\n\n // Triangle 11 bottom bottom\n this.triangles.push([1, 0, 5]);\n\n // Triangle 12 bottom top\n this.triangles.push([1, 5, 4]);\n }", "function verifDiagonaleBackSlash() {\r\n\r\n let j = x;\r\n let k = y;\r\n\r\n //Initialisation des valeurs x et y pour la verification de la diagonale \r\n if (j != 0 && k != 5) {\r\n while (j != 0 && k != 5) {\r\n j--;\r\n k++;\r\n };\r\n }\r\n\r\n //Boucle de verification de la diagonale backSlash\r\n if (j < 4 && k > 2) {\r\n do {\r\n if (document.querySelector(`#x${j}y${k}`).color == color &&\r\n document.querySelector(`#x${j + 1}y${k - 1}`).color == color &&\r\n document.querySelector(`#x${j + 2}y${k - 2}`).color == color &&\r\n document.querySelector(`#x${j + 3}y${k - 3}`).color == color) {\r\n\r\n if (playerActive == 1) {\r\n text1 = document.querySelector('.row')\r\n text1.innerHTML = \"victoire\".toUpperCase()\r\n text1.style.color = \"yellow\"\r\n text1.style.fontSize = \"170\"\r\n } else {\r\n text2 = document.querySelector('.row')\r\n text2.innerHTML=\"défaite\".toUpperCase()\r\n text2.style.color=\"red\"\r\n text2.style.fontSize=\"170\"\r\n }\r\n }\r\n j++;\r\n k--;\r\n } while (j < 4 && k > 2);\r\n }\r\n}", "function makeTriangles (l, d, u, r) {\n var triangles = {\n left: l,\n down: d,\n up: u,\n right: r,\n display: displayTriangles,\n move: moveTriangles\n }\n return triangles;\n}", "function insideTriangle(ax, ay, bx, by, cx, cy, px, py) {\n var aX, aY, bX, bY,\n cX, cY, apx, apy,\n bpx, bpy, cpx, cpy,\n cCROSSap, bCROSScp, aCROSSbp;\n\n aX = cx - bx;\n aY = cy - by;\n bX = ax - cx;\n bY = ay - cy;\n cX = bx - ax;\n cY = by - ay;\n apx = px - ax;\n apy = py - ay;\n bpx = px - bx;\n bpy = py - by;\n cpx = px - cx;\n cpy = py - cy;\n\n aCROSSbp = aX * bpy - aY * bpx;\n cCROSSap = cX * apy - cY * apx;\n bCROSScp = bX * cpy - bY * cpx;\n\n return ((aCROSSbp >= 0.0) && (bCROSScp >= 0.0) && (cCROSSap >= 0.0));\n }", "function drawTri(x, y, dir) {\n // pen init\n penUp();\n moveTo(x, y);\n penWidth(1);\n penColor(\"black\");\n penDown();\n \n // choose the initial direction\n if(dir == \"up\") {\n turnTo(0);\n } else if(dir == \"right\") {\n turnTo(90);\n } else if(dir == \"down\") {\n turnTo(180);\n } else if(dir == \"left\") {\n turnTo(270);\n }\n turnRight(90); // start drawing the back\n \n // fill in a black triangle\n for (var i = triSize; i > 0; i -= 2) {\n moveForward(i);\n turnLeft(90);\n moveForward(1);\n turnLeft(90);\n moveForward(i-1);\n turnRight(90);\n moveForward(1);\n turnRight(90);\n }\n penUp();\n}", "function drawEquilateralTriangle(ctx, x, y, radius,\n\tisFill = false, rotate = 0, color = '#000000', size = 1) {\n\tlet x1, x2, x3, y1, y2, y3;\n\tif (rotate == 0) {\n\t\tx1 = x;\n\t\ty1 = y - radius;\n\t\tx2 = x - radius * Math.sin(Math.PI / 3);\n\t\ty2 = y + radius * Math.cos(Math.PI / 3);\n\t\tx3 = x + radius * Math.sin(Math.PI / 3);\n\t\ty3 = y2;\n\t\tdrawTriangle(ctx, x1, y1, x2, y2, x3, y3, isFill, color, size);\n\t} else if (rotate > 0){\n\t\tctx.save();\n\t\t/* move the canvas origin to the\n\t\t * center of the triangle\n\t\t */\n\t\tctx.translate(x, y);\n\t\t/* rotate the canvas */\n\t\tfor (; rotate > 0; --rotate)\n\t\t\tctx.rotate(Math.PI / 2);\n\t\tx1 = 0;\n\t\ty1 = -radius;\n\t\tx2 = - radius * Math.sin(Math.PI / 3);\n\t\ty2 = radius * Math.cos(Math.PI / 3);\n\t\tx3 = radius * Math.sin(Math.PI / 3);\n\t\ty3 = y2;\n\t\tdrawTriangle(ctx, x1, y1, x2, y2, x3, y3, isFill, color, size);\n\t\tctx.restore();\n\t} else {\n\t\talert('Error: rotate can not less than 0');\n\t}\n}", "function createTriPts(x, y) {\n return x + \",\" + (y-munit*4) //X & Y positions of the right side of the rectangle\n + \" \" + x + \",\" + y //X & Y positions of the right bottom corner of the rectangle\n + \" \" + (x-munit*4) + \",\" + y; //X & Y positions of the bottom of the rectangle\n}" ]
[ "0.66177833", "0.6473432", "0.64470845", "0.6386189", "0.61779207", "0.6164037", "0.6105742", "0.60984284", "0.6092106", "0.60847867", "0.60559255", "0.6035137", "0.6031295", "0.60100186", "0.5987254", "0.5931261", "0.5921831", "0.5913882", "0.5903669", "0.59003615", "0.58865774", "0.58469886", "0.5844872", "0.58312035", "0.58282626", "0.58271646", "0.581326", "0.581326", "0.5784438", "0.5775918", "0.57710147", "0.5769142", "0.57535845", "0.57462454", "0.57411605", "0.57399935", "0.5736759", "0.5719469", "0.57098496", "0.5699331", "0.5672064", "0.5644306", "0.56441337", "0.5642156", "0.5639825", "0.5638629", "0.56315804", "0.5614351", "0.56070715", "0.56037366", "0.5600908", "0.558375", "0.558131", "0.5570746", "0.55699676", "0.5557392", "0.55530435", "0.55513877", "0.554924", "0.55484045", "0.5535417", "0.55348784", "0.5521634", "0.5505642", "0.5498589", "0.549766", "0.5495058", "0.54917777", "0.5472321", "0.54651916", "0.5453056", "0.5448121", "0.5440226", "0.5429862", "0.5429821", "0.54274404", "0.5426865", "0.54266346", "0.5413983", "0.54116225", "0.5400051", "0.53986657", "0.53969485", "0.53936994", "0.53915215", "0.53907007", "0.53677446", "0.5366632", "0.5359446", "0.535484", "0.53533286", "0.534913", "0.5346488", "0.5345959", "0.534284", "0.5339471", "0.53346825", "0.5325481", "0.53113407", "0.5305322", "0.5303341" ]
0.0
-1
define faces of a cube
function colorCube() { quad( 1, 0, 3, 2 ); quad( 2, 3, 7, 6 ); quad( 3, 0, 4, 7 ); quad( 6, 5, 1, 2 ); quad( 4, 5, 6, 7 ); quad( 5, 4, 0, 1 ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cube(side) {\r\n var s = (side || 1) / 2;\r\n var coords = [];\r\n var normals = [];\r\n var texCoords = [];\r\n var indices = [];\r\n\r\n function face(xyz, nrm) {\r\n var start = coords.length / 3;\r\n var i;\r\n for (i = 0; i < 12; i++) {\r\n coords.push(xyz[i]);\r\n }\r\n for (i = 0; i < 4; i++) {\r\n normals.push(nrm[0], nrm[1], nrm[2]);\r\n }\r\n texCoords.push(0, 0, 1, 0, 1, 1, 0, 1);\r\n indices.push(start, start + 1, start + 2, start, start + 2, start + 3);\r\n }\r\n\r\n face([-s, -s, s, s, -s, s, s, s, s, -s, s, s], [0, 0, 1]);\r\n face([-s, -s, -s, -s, s, -s, s, s, -s, s, -s, -s], [0, 0, -1]);\r\n face([-s, s, -s, -s, s, s, s, s, s, s, s, -s], [0, 1, 0]);\r\n face([-s, -s, -s, s, -s, -s, s, -s, s, -s, -s, s], [0, -1, 0]);\r\n face([s, -s, -s, s, s, -s, s, s, s, s, -s, s], [1, 0, 0]);\r\n face([-s, -s, -s, -s, -s, s, -s, s, s, -s, s, -s], [-1, 0, 0]);\r\n return {\r\n vertexPositions: new Float32Array(coords),\r\n vertexNormals: new Float32Array(normals),\r\n vertexTextureCoords: new Float32Array(texCoords),\r\n indices: new Uint16Array(indices)\r\n }\r\n }", "function cube() {\r\n\r\n var half = 0.5\r\n var verts = [vec4(-half,-half,-half,1),\r\n vec4(half,-half,-half,1),\r\n vec4(half,half,-half,1),\r\n vec4(-half,half,-half,1),\r\n vec4(-half,-half,half,1),\r\n vec4(half,-half,half,1),\r\n vec4(half,half,half,1),\r\n vec4(-half,half,half,1)];\r\n\r\n var tris = [\r\n [1,0,2], //Bottom\r\n [3,2,0],\r\n [0,1,5], //Sides\r\n [5,4,0],\r\n [1,2,6],\r\n [6,5,1],\r\n [2,3,7],\r\n [7,6,2],\r\n [3,0,4],\r\n [4,7,3],\r\n [4,5,6], //Top\r\n [6,7,4]\r\n ];\r\n\r\n var colors = [vec4(1.0,0,0,1),\r\n vec4(1.0,0,0,1),\r\n\r\n vec4(0,1.0,0,1),\r\n vec4(0,1.0,0,1),\r\n\r\n vec4(0,0,1.0,1),\r\n vec4(0,0,1.0,1),\r\n\r\n vec4(0.5,0.5,0,1),\r\n vec4(0.5,0.5,0,1),\r\n\r\n vec4(0,0.5,0.5,1),\r\n vec4(0,0.5,0.5,1),\r\n\r\n vec4(0.5,0,0.5,1),\r\n vec4(0.5,0,0.5,1)];\r\n\r\n var normals = calculateNormals(verts,tris);\r\n\r\n return {\r\n verts: verts,\r\n tris: tris,\r\n normals: normals,\r\n face_colors: colors\r\n };\r\n}", "generateCubeVertices() {\n for (var i = 0; i < 24; i++) {\n this.vertices[i] = new Vertex()\n this.vertices[i].color = [Math.random(), Math.random(), Math.random()]\n }\n\n // Front face\n this.vertices[0].points.elements =[-this.size, -this.size, this.size]\n this.vertices[1].points.elements =[this.size, -this.size, this.size]\n this.vertices[2].points.elements =[this.size, this.size, this.size]\n this.vertices[3].points.elements =[-this.size, this.size, this.size]\n\n // Back face\n this.vertices[4].points.elements =[-this.size, -this.size, -this.size]\n this.vertices[5].points.elements =[-this.size, this.size, -this.size]\n this.vertices[6].points.elements =[ this.size, this.size, -this.size]\n this.vertices[7].points.elements =[ this.size, -this.size, -this.size]\n\n // Top face\n this.vertices[8].points.elements =[-this.size, this.size, -this.size]\n this.vertices[9].points.elements =[-this.size, this.size, this.size]\n this.vertices[10].points.elements =[ this.size, this.size, this.size]\n this.vertices[11].points.elements =[ this.size, this.size, -this.size]\n\n // Bottom face\n this.vertices[12].points.elements =[-this.size, -this.size, -this.size]\n this.vertices[13].points.elements =[ this.size, -this.size, -this.size]\n this.vertices[14].points.elements =[ this.size, -this.size, this.size]\n this.vertices[15].points.elements =[-this.size, -this.size, this.size]\n\n // Right face\n this.vertices[16].points.elements =[ this.size, -this.size, -this.size]\n this.vertices[17].points.elements =[ this.size, this.size, -this.size]\n this.vertices[18].points.elements =[ this.size, this.size, this.size]\n this.vertices[19].points.elements =[ this.size, -this.size, this.size]\n\n // Left face\n this.vertices[20].points.elements =[-this.size, -this.size, -this.size]\n this.vertices[21].points.elements =[-this.size, -this.size, this.size]\n this.vertices[22].points.elements =[-this.size, this.size, this.size]\n this.vertices[23].points.elements =[-this.size, this.size, -this.size]\n }", "function makeCube()\n{\n\t // vertices of cube\n\tvar rawVertices = new Float32Array([\n\t-0.5, -0.5, 0.5,\n\t0.5, -0.5, 0.5,\n\t0.5, 0.5, 0.5,\n\t-0.5, 0.5, 0.5,\n\t-0.5, -0.5, -0.5,\n\t0.5, -0.5, -0.5,\n\t0.5, 0.5, -0.5,\n\t-0.5, 0.5, -0.5]);\n\n\tvar rawColors = new Float32Array([\n 0.4, 0.4, 1.0, 1.0, // Z blue\n 1.0, 0.4, 0.4, 1.0, // X red\n 0.0, 0.0, 0.7, 1.0, // -Z dk blue\n 0.7, 0.0, 0.0, 1.0, // -X dk red\n 0.4, 1.0, 0.4, 1.0, // Y green\n 0.0, 0.7, 0.0, 1.0, // -Y dk green\n]);\n\n\tvar rawNormals = new Float32Array([\n\t0, 0, 1,\n\t1, 0, 0,\n\t0, 0, -1,\n\t-1, 0, 0,\n\t0, 1, 0,\n\t0, -1, 0 ]);\n\n\tvar indices = new Uint16Array([\n\t0, 1, 2, 0, 2, 3, // z face\n\t1, 5, 6, 1, 6, 2, // +x face\n\t5, 4, 7, 5, 7, 6, // -z face\n\t4, 0, 3, 4, 3, 7, // -x face\n\t3, 2, 6, 3, 6, 7, // + y face\n\t4, 5, 1, 4, 1, 0 // -y face\n\t]);\n\n\tvar verticesArray = [];\n\tvar colorsArray = [];\n\tvar normalsArray = [];\n\tfor (var i = 0; i < 36; ++i)\n\t{\n\t\t// for each of the 36 vertices...\n\t\tvar face = Math.floor(i / 6);\n\t\tvar index = indices[i];\n\n\t\t// (x, y, z): three numbers for each point\n\t\tfor (var j = 0; j < 3; ++j)\n\t\t{\n\t\t\tverticesArray.push(rawVertices[3 * index + j]);\n\t\t}\n\n\t\t// (r, g, b, a): four numbers for each point\n\t\tfor (var j = 0; j < 4; ++j)\n\t\t{\n\t\t\tcolorsArray.push(rawColors[4 * face + j]);\n\t\t}\n\n\t\t// three numbers for each point\n\t\tfor (var j = 0; j < 3; ++j)\n\t\t{\n\t\t\tnormalsArray.push(rawNormals[3 * face + j]);\n\t\t}\n\t}\n\n\treturn {\n\t\tvertices: new Float32Array(verticesArray),\n\t\tcolors: new Float32Array(colorsArray),\n\t\tnormals: new Float32Array(normalsArray)\n\t};\n}", "function Cube() {\n Drawable.call( this );\n var vertices = [\n // right\n 1, 0, 0,\n 1, 1, 1,\n 1, 0, 1,\n 1, 1, 0,\n // left\n 0, 1, 0,\n 0, 0, 1,\n 0, 1, 1,\n 0, 0, 0,\n // top\n 0, 1, 0,\n 1, 1, 1,\n 1, 1, 0,\n 0, 1, 1,\n // bottom\n 0, 0, 1,\n 1, 0, 0,\n 1, 0, 1,\n 0, 0, 0,\n // front\n 0, 0, 1,\n 1, 1, 1,\n 0, 1, 1,\n 1, 0, 1,\n // back\n 1, 0, 0,\n 0, 1, 0,\n 1, 1, 0,\n 0, 0, 0\n ];\n var uvcoords = [\n 0, 0,\n 1, 1,\n 0, 1,\n 1, 0\n ];\n var normals = [\n 1, 0, 0,\n -1, 0, 0,\n 0, 1, 0,\n 0,-1, 0,\n 0, 0, 1,\n 0, 0,-1\n ];\n var tangents = [\n 0, 1, 0,\n 0,-1, 0,\n 0, 0, 1,\n 0, 0,-1,\n 1, 0, 0,\n -1, 0, 0\n ];\n\n // center unit cube around the origin\n for ( var i = 0; i < vertices.length; ++i ) {\n vertices[ i ] -= 0.5;\n }\n\n var ret = {\n vertices: [],\n indices: [],\n normals: [],\n tangents: [],\n uvcoords: []\n };\n\n for ( var face = 0; face < 6; ++face ) {\n for ( var vertex = 0; vertex < 6; ++vertex ) { // 6 vertices per face\n ret.normals.push(\n normals[ face * 3 ],\n normals[ face * 3 + 1 ],\n normals[ face * 3 + 2 ]\n );\n ret.tangents.push(\n tangents[ face * 3 ],\n tangents[ face * 3 + 1 ],\n tangents[ face * 3 + 2 ]\n );\n ret.indices.push( face * 6 + vertex );\n }\n }\n\n function addPoint( face, point ) {\n ret.vertices.push(\n vertices[ face * 3 * 4 + point * 3 ],\n vertices[ face * 3 * 4 + point * 3 + 1 ],\n vertices[ face * 3 * 4 + point * 3 + 2 ]\n );\n ret.uvcoords.push(\n uvcoords[ point * 2 ],\n uvcoords[ point * 2 + 1 ]\n );\n }\n\n for ( face = 0; face < 6; ++face ) {\n // top triangle\n addPoint( face, 0 );\n addPoint( face, 1 );\n addPoint( face, 2 );\n // bottom triangle\n addPoint( face, 0 );\n addPoint( face, 3 );\n addPoint( face, 1 );\n }\n\n vertices = new Buffer().setData( ret.vertices );\n uvcoords = new Buffer().setData( ret.uvcoords );\n normals = new Buffer().setData( ret.normals );\n\n vertices = new VertexAttribute( 'Position' ).setBuffer( vertices );\n uvcoords = new VertexAttribute( 'UVCoord' ).setBuffer( uvcoords ).setSize( 2 );\n normals = new VertexAttribute( 'Normal' ).setBuffer( normals );\n\n var indices = new Buffer( Buffer.ELEMENT_BUFFER ).setData( ret.indices );\n\n var m = new Mesh();\n m.setVertexAttribute( vertices );\n m.setVertexAttribute( normals );\n m.setVertexAttribute( uvcoords );\n m.setIndexBuffer( indices );\n\n this.mesh = m;\n}", "function setCube() {\r\n var verts = [];\r\n verts = verts.concat(quad(1, 0, 3, 2));\r\n verts = verts.concat(quad(2, 3, 7, 6));\r\n verts = verts.concat(quad(3, 0, 4, 7));\r\n verts = verts.concat(quad(6, 5, 1, 2));\r\n verts = verts.concat(quad(4, 5, 6, 7));\r\n verts = verts.concat(quad(5, 4, 0, 1));\r\n\tfor (var i = 0; i < numCubeVertices; i++) {\r\n\t\tcubeVertexNormals.push(verts[i][0], verts[i][1], verts[i][2], 0.0);\r\n\t}\r\n cubePoints = verts;\r\n}", "function Cube () {\r\n\r\n\tthis.name = \"cube\";\r\n\t\r\n\t// vertices definition\r\n\t////////////////////////////////////////////////////////////\r\n\t\r\n\tthis.vertices = new Float32Array([\r\n\t\t-1.0, -1.0, 1.0,\r\n\t\t 1.0, -1.0, 1.0,\r\n\t\t-1.0, 1.0, 1.0,\r\n\t\t 1.0, 1.0, 1.0,\r\n\t\t-1.0, -1.0, -1.0,\r\n\t\t 1.0, -1.0, -1.0,\r\n\t\t-1.0, 1.0, -1.0,\r\n\t\t 1.0, 1.0, -1.0\r\n\t]);\r\n\r\n\t// triangles definition\r\n\t////////////////////////////////////////////////////////////\r\n\t\r\n\tthis.triangleIndices = new Uint16Array([\r\n\t\t0, 1, 2, 2, 1, 3, // front\r\n\t\t5, 4, 7, 7, 4, 6, // back\r\n\t\t4, 0, 6, 6, 0, 2, // left\r\n\t\t1, 5, 3, 3, 5, 7, // right\r\n\t\t2, 3, 6, 6, 3, 7, // top\r\n\t\t4, 5, 0, 0, 5, 1 // bottom\r\n\t]);\r\n\t\r\n\tthis.numVertices = this.vertices.length/3;\r\n\tthis.numTriangles = this.triangleIndices.length/3;\r\n\t\r\n}", "function Cube () {\r\n\r\n\tthis.name = \"cube\";\r\n\t\r\n\t// vertices definition\r\n\t////////////////////////////////////////////////////////////\r\n\t\r\n\tthis.vertices = new Float32Array([\r\n\t\t-1.0, -1.0, 1.0,\r\n\t\t 1.0, -1.0, 1.0,\r\n\t\t-1.0, 1.0, 1.0,\r\n\t\t 1.0, 1.0, 1.0,\r\n\t\t-1.0, -1.0, -1.0,\r\n\t\t 1.0, -1.0, -1.0,\r\n\t\t-1.0, 1.0, -1.0,\r\n\t\t 1.0, 1.0, -1.0\r\n\t]);\r\n\r\n\t// triangles definition\r\n\t////////////////////////////////////////////////////////////\r\n\t\r\n\tthis.triangleIndices = new Uint16Array([\r\n\t\t0, 1, 2, 2, 1, 3, // front\r\n\t\t5, 4, 7, 7, 4, 6, // back\r\n\t\t4, 0, 6, 6, 0, 2, // left\r\n\t\t1, 5, 3, 3, 5, 7, // right\r\n\t\t2, 3, 6, 6, 3, 7, // top\r\n\t\t4, 5, 0, 0, 5, 1 // bottom\r\n\t]);\r\n\t\r\n\tthis.numVertices = this.vertices.length/3;\r\n\tthis.numTriangles = this.triangleIndices.length/3;\r\n\t\r\n}", "function Cube(x, y, z, sx, sy, sz) {\n var _this = _super.call(this) || this;\n _this.vertices = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0\n ];\n // build colors\n var colors = [\n [1.0, 1.0, 1.0, 1.0],\n [1.0, 0.0, 0.0, 1.0],\n [0.0, 1.0, 0.0, 1.0],\n [0.0, 0.0, 1.0, 1.0],\n [1.0, 1.0, 0.0, 1.0],\n [1.0, 0.0, 1.0, 1.0] // Left face: purple\n ];\n // Convert the array of colors into a table for all the vertices.\n _this.colors = [];\n for (var j = 0; j < 6; j++) {\n var c = colors[j];\n // Repeat each color four times for the four vertices of the face\n for (var i = 0; i < 4; i++) {\n _this.colors = _this.colors.concat(c);\n }\n }\n // link vertices together into triangles. Polygon color\n // specified by color in similar index\n _this.indices = [\n 0, 1, 2, 0, 2, 3,\n 4, 5, 6, 4, 6, 7,\n 8, 9, 10, 8, 10, 11,\n 12, 13, 14, 12, 14, 15,\n 16, 17, 18, 16, 18, 19,\n 20, 21, 22, 20, 22, 23 // left\n ];\n return _this;\n }", "function Cube(){ \n this._geometry = new THREE.BoxGeometry( 1, 1, 1 );\n this._material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );\n this._mesh = new THREE.Mesh( this._geometry, this._material );\n}", "_face(pos)\n {\n if (this._cells.length === 12) {\n return this._face4(pos);\n } else if (this._cells.length === 200) {\n return this._face50(pos);\n } else {\n throw new SyntaxError('_face: unsupported cube size');\n }\n }", "function cube(a, b, c, d, e, f, g, h, verts, inds) {\r\n\tlet off = verts.length;\r\n\tverts.push(a, b, c, d, e, f, g, h);\r\n\tinds.push(off+0, off+2,\r\n\t\toff+3, off+4, off+0, // around vertex d\r\n\t\toff+7, off+6, off+4, // around vertex h\r\n\t\toff+5, off+2, off+6, // around vertex f\r\n\t\toff+1, off+0, off+2 // around vertex b\r\n\t);\r\n}", "function initCube(vCube, position, geometry) {\n var vertices = new Array(8);\n for (let i in geometry)\n {\n vertices[i] = new Array(3);\n for (let j in geometry[i])\n vertices[i][j] = add(vCube, geometry[i][j]);\n }\n\n var indices = [];\n var first = points.length;\n for (let i = 0; i < 96; i++)\n indices.push(first + i);\n\n var s1 = initSquare(vertices[1][Z], vertices[5][Z], vertices[3][Z], vertices[7][Z], \n position, F, WHITE); //Front\n var s2 = initSquare(vertices[0][Z], vertices[4][Z], vertices[2][Z], vertices[6][Z], \n position, Ba, RED); //Back\n var s3 = initSquare(vertices[1][X], vertices[0][X], vertices[3][X], vertices[2][X], \n position, L, YELLOW); //Left\n var s4 = initSquare(vertices[5][X], vertices[4][X], vertices[7][X], vertices[6][X], \n position, R, GREEN); //right\n var s5 = initSquare(vertices[3][Y], vertices[7][Y], vertices[2][Y], vertices[6][Y], \n position, T, CYAN); //top\n var s6 = initSquare(vertices[1][Y], vertices[5][Y], vertices[0][Y], vertices[4][Y], \n position, Bo, BLUE); //bottom\n var sqrs = [s1, s2, s3, s4, s5, s6];\n sqrs = sqrs.filter(function(square, ind) {\n return position.includes(ind);\n })\n\n // drawing edges of cube\n points.push(vertices[0][X], vertices[0][Y], vertices[1][X], vertices[1][Y],\n vertices[2][X], vertices[2][Y], vertices[3][X], vertices[3][Y],\n vertices[4][X], vertices[4][Y], vertices[5][X], vertices[5][Y],\n vertices[6][X], vertices[6][Y], vertices[7][X], vertices[7][Y],\n vertices[0][X], vertices[0][Z], vertices[2][X], vertices[2][Z],\n vertices[1][X], vertices[1][Z], vertices[3][X], vertices[3][Z],\n vertices[4][X], vertices[4][Z], vertices[6][X], vertices[6][Z],\n vertices[5][X], vertices[5][Z], vertices[7][X], vertices[7][Z],\n vertices[0][Y], vertices[0][Z], vertices[4][Y], vertices[4][Z],\n vertices[1][Y], vertices[1][Z], vertices[5][Y], vertices[5][Z],\n vertices[2][Y], vertices[2][Z], vertices[6][Y], vertices[6][Z],\n vertices[3][Y], vertices[3][Z], vertices[7][Y], vertices[7][Z]);\n\n for (let i in vertices) {\n for (let j in vertices[i]) {\n points.push(vertices[i][j]);\n }\n }\n\n for (let i = 0; i < 72; i++) {\n colors.push(BLACK);\n pick_squares.push(255);\n }\n\n return new Cube(position, indices, sqrs);\n}", "constructor() {\r\n super(\"positions\", \"normals\"); // Name the values we'll define per each vertex. They'll have positions and normals.\r\n\r\n // First, specify the vertex positions -- just a bunch of points that exist at the corners of an imaginary cube.\r\n this.positions.push(...Vec.cast(\r\n [-1, -1, -1], [1, -1, -1], [-1, -1, 1], [1, -1, 1], [1, 1, -1], [-1, 1, -1], [1, 1, 1], [-1, 1, 1],\r\n [-1, -1, -1], [-1, -1, 1], [-1, 1, -1], [-1, 1, 1], [1, -1, 1], [1, -1, -1], [1, 1, 1], [1, 1, -1],\r\n [-1, -1, 1], [1, -1, 1], [-1, 1, 1], [1, 1, 1], [1, -1, -1], [-1, -1, -1], [1, 1, -1], [-1, 1, -1]));\r\n // Supply vectors that point away from eace face of the cube. They should match up with the points in the above list\r\n // Normal vectors are needed so the graphics engine can know if the shape is pointed at light or not, and color it accordingly.\r\n this.normals.push(...Vec.cast(\r\n [0, -1, 0], [0, -1, 0], [0, -1, 0], [0, -1, 0], [0, 1, 0], [0, 1, 0], [0, 1, 0], [0, 1, 0],\r\n [-1, 0, 0], [-1, 0, 0], [-1, 0, 0], [-1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0],\r\n [0, 0, 1], [0, 0, 1], [0, 0, 1], [0, 0, 1], [0, 0, -1], [0, 0, -1], [0, 0, -1], [0, 0, -1]));\r\n\r\n // Those two lists, positions and normals, fully describe the \"vertices\". What's the \"i\"th vertex? Simply the combined\r\n // data you get if you look up index \"i\" of both lists above -- a position and a normal vector, together. Now let's\r\n // tell it how to connect vertex entries into triangles. Every three indices in this list makes one triangle:\r\n this.indices.push(0, 1, 2, 1, 3, 2, 4, 5, 6, 5, 7, 6, 8, 9, 10, 9, 11, 10, 12, 13, 14, 13, 15, 14, 16, 17, 18, 17, 19, \r\n 18, 20, 21, 22, 21, 23, 22);\r\n // It stinks to manage arrays this big. Later we'll show code that generates these same cube vertices more automatically.\r\n }", "function createCube(x, y, z, material) {\r\n var geometry = new THREE.BoxGeometry(1,1,1);\r\n cube = new THREE.Mesh(geometry, material);\r\n applyFaceColor(geometry, cube.id);\r\n cube.position.x = x;\r\n cube.position.y = y;\r\n cube.position.z = z;\r\n return cube;\r\n}", "function cubeVertices() {\n return [\n vec4(-0.5, 0, 0.5, 1.0),\n vec4(-0.5, 1, 0.5, 1.0),\n vec4(0.5, 1, 0.5, 1.0),\n vec4(0.5, 0, 0.5, 1.0),\n vec4(-0.5, 0, -0.5, 1.0),\n vec4(-0.5, 1, -0.5, 1.0),\n vec4(0.5, 1, -0.5, 1.0),\n vec4(0.5, 0, -0.5, 1.0)\n ];\n}", "function face(a, b, c, d){\n vertices.push(i[a]);\n vertices.push(i[b]);\n vertices.push(i[c]);\n\n vertices.push(i[a]);\n vertices.push(i[c]);\n vertices.push(i[d]);\n}", "function buildFirstCube(){\r\n\tvar colorCounter = 0;\r\n\tvar firstCubeGeom = initGeom();\r\n\t\r\n\t//Loops through the faceArray, assigning a color for each 2 faces\r\n\tfor(var i = 0; i < firstCubeGeom.faces.length; i += 2){\r\n\t\tvar face = firstCubeGeom.faces[i];\r\n\t\tface.color.setRGB(colorArray[colorCounter].r, colorArray[colorCounter].g, colorArray[colorCounter].b);\r\n\t\tface = firstCubeGeom.faces[i+1];\r\n\t\tface.color = firstCubeGeom.faces[i].color;\r\n\t\tcolorCounter++;\r\n\t}\r\n\t\r\n\tvar cubeMesh = new THREE.Mesh(firstCubeGeom, new THREE.MeshBasicMaterial({vertexColors: THREE.FaceColors}));\r\n\r\n\tcubeMesh.position.y = 20;\r\n\t\r\n\treturn cubeMesh;\r\n}", "function initGeom(){\r\n\tvar cubeGeom = new THREE.Geometry();\r\n\t\r\n\t//Array of the vectors of the cube\r\n\tvectorArray = [/**0**/new THREE.Vector3(-blockWidth/2, blockWidth/2, blockWidth/2),\r\n\t\t\t\t /**1**/new THREE.Vector3(-blockWidth/2, -blockWidth/2, blockWidth/2),\r\n\t\t\t\t /**2**/new THREE.Vector3(blockWidth/2, -blockWidth/2, blockWidth/2),\r\n\t\t\t\t /**3**/new THREE.Vector3(blockWidth/2, blockWidth/2, blockWidth/2),\r\n\t\t\t\t /**4**/new THREE.Vector3(blockWidth/2, blockWidth/2, -blockWidth/2),\r\n\t\t\t\t\t/**5**/new THREE.Vector3(blockWidth/2, -blockWidth/2, -blockWidth/2),\r\n\t\t\t\t /**6**/new THREE.Vector3(-blockWidth/2, -blockWidth/2, -blockWidth/2),\r\n\t\t\t\t /**7**/new THREE.Vector3(-blockWidth/2, blockWidth/2, -blockWidth/2)];\r\n\t\r\n\t//Array of the faces of the cube, 2 for each side\r\n\tfaceArray = [/**front**/new THREE.Face3(0, 1, 2), new THREE.Face3(2, 3, 0),\r\n\t\t\t\t /**right**/new THREE.Face3(3, 2, 5), new THREE.Face3(5, 4, 3),\r\n\t\t\t\t /**back**/new THREE.Face3(4, 5, 6), new THREE.Face3(6, 7, 4),\r\n\t\t\t\t /**left**/new THREE.Face3(7, 6, 1), new THREE.Face3(1, 0, 7),\r\n\t\t\t\t /**top**/new THREE.Face3(7, 0, 3), new THREE.Face3(3, 4, 7),\r\n\t\t\t\t /**bottom**/new THREE.Face3(1, 6, 5), new THREE.Face3(5, 2, 1)];\r\n\t\r\n\t//Sets these arrays to the cube's vertices and faces\r\n\tcubeGeom.vertices = vectorArray;\r\n\tcubeGeom.faces = faceArray;\r\n\t\r\n\treturn cubeGeom;\r\n}", "function createCube(gl) {\n var cube = [];\n // Coordinates Cube which length of one side is 1 with the origin on the center of the bottom)\n var vertices = new Float32Array([\n 0.5, 1.0, 0.5, -0.5, 1.0, 0.5, -0.5, 0.0, 0.5, 0.5, 0.0, 0.5, // v0-v1-v2-v3 front\n 0.5, 1.0, 0.5, 0.5, 0.0, 0.5, 0.5, 0.0,-0.5, 0.5, 1.0,-0.5, // v0-v3-v4-v5 right\n 0.5, 1.0, 0.5, 0.5, 1.0,-0.5, -0.5, 1.0,-0.5, -0.5, 1.0, 0.5, // v0-v5-v6-v1 up\n -0.5, 1.0, 0.5, -0.5, 1.0,-0.5, -0.5, 0.0,-0.5, -0.5, 0.0, 0.5, // v1-v6-v7-v2 left\n -0.5, 0.0,-0.5, 0.5, 0.0,-0.5, 0.5, 0.0, 0.5, -0.5, 0.0, 0.5, // v7-v4-v3-v2 down\n 0.5, 0.0,-0.5, -0.5, 0.0,-0.5, -0.5, 1.0,-0.5, 0.5, 1.0,-0.5 // v4-v7-v6-v5 back\n ]);\n\n // Normal\n var normals = new Float32Array([\n 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, // v0-v1-v2-v3 front\n 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, // v0-v3-v4-v5 right\n 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, // v0-v5-v6-v1 up\n -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, // v1-v6-v7-v2 left\n 0.0,-1.0, 0.0, 0.0,-1.0, 0.0, 0.0,-1.0, 0.0, 0.0,-1.0, 0.0, // v7-v4-v3-v2 down\n 0.0, 0.0,-1.0, 0.0, 0.0,-1.0, 0.0, 0.0,-1.0, 0.0, 0.0,-1.0 // v4-v7-v6-v5 back\n ]);\n\n // Indices of the vertices\n var indices = new Uint8Array([\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // right\n 8, 9,10, 8,10,11, // up\n 12,13,14, 12,14,15, // left\n 16,17,18, 16,18,19, // down\n 20,21,22, 20,22,23 // back\n ]);\n\n cube.vertexBuffer = initArrayBufferForLaterUse(gl,vertices,3,gl.FLOAT);\n cube.normalBuffer = initArrayBufferForLaterUse(gl,normals,3,gl.FLOAT);\n cube.indexBuffer = initElementArrayBufferForLaterUse(gl,indices,gl.STATIC_DRAW);\n cube.num_vertices = indices.length;\n cube.drawtype = gl.TRIANGLES;\n\n return cube;\n}", "function createCube(gl, scale, translation, rotationAxis) {\n // Vertex Data\n let vertexBuffer;\n vertexBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);\n\n let x = scale;\n\n console.log(\"Cube scale is : \" + x)\n\n let verts = [\n\n\n // Front face\n -x, -x, x,\n x, -x, x,\n x, x, x,\n -x, x, x,\n\n // Back face\n -x, -x, -x,\n -x, x, -x,\n x, x, -x,\n x, -x, -x,\n\n // Top face\n -x, x, -x,\n -x, x, x,\n x, x, x,\n x, x, -x,\n\n // Bottom face\n -x, -x, -x,\n x, -x, -x,\n x, -x, x,\n -x, -x, x,\n\n // Right face\n x, -x, -x,\n x, x, -x,\n x, x, x,\n x, -x, x,\n\n // Left face\n -x, -x, -x,\n -x, -x, x,\n -x, x, x,\n -x, x, -x\n ];\n\n\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(verts), gl.STATIC_DRAW);\n\n // Color data\n let colorBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer);\n let faceColors = [\n [1.0, 0.0, 0.0, 1.0], // Front face\n [0.0, 1.0, 0.0, 1.0], // Back face\n [0.0, 0.0, 1.0, 1.0], // Top face\n [1.0, 1.0, 0.0, 1.0], // Bottom face\n [1.0, 0.0, 1.0, 1.0], // Right face\n [0.0, 1.0, 1.0, 1.0] // Left face\n ];\n\n // Each vertex must have the color information, that is why the same color is concatenated 4 times, one for each vertex of the cube's face.\n let vertexColors = [];\n // for (const color of faceColors) \n // {\n // for (let j=0; j < 4; j++)\n // vertexColors.push(...color);\n // }\n faceColors.forEach(color => {\n for (let j = 0; j < 4; j++)\n vertexColors.push(...color);\n });\n\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertexColors), gl.STATIC_DRAW);\n\n // Index data (defines the triangles to be drawn).\n let cubeIndexBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeIndexBuffer);\n\n let cubeIndices = [\n 0, 1, 2, 0, 2, 3, // Front face\n 4, 5, 6, 4, 6, 7, // Back face\n 8, 9, 10, 8, 10, 11, // Top face\n 12, 13, 14, 12, 14, 15, // Bottom face\n 16, 17, 18, 16, 18, 19, // Right face\n 20, 21, 22, 20, 22, 23 // Left face\n ];\n\n // gl.ELEMENT_ARRAY_BUFFER: Buffer used for element indices.\n // Uint16Array: Array of 16-bit unsigned integers.\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(cubeIndices), gl.STATIC_DRAW);\n\n let cube = {\n buffer: vertexBuffer,\n colorBuffer: colorBuffer,\n indices: cubeIndexBuffer,\n vertSize: 3,\n nVerts: 24,\n colorSize: 4,\n nColors: 24,\n nIndices: 36,\n primtype: gl.TRIANGLES,\n modelViewMatrix: mat4.create(),\n currentTime: Date.now()\n };\n\n mat4.translate(cube.modelViewMatrix, cube.modelViewMatrix, translation);\n\n cube.update = function () {\n let now = Date.now();\n let deltat = now - this.currentTime;\n this.currentTime = now;\n let fract = deltat / duration;\n let angle = Math.PI * 2 * fract;\n\n // Rotates a mat4 by the given angle\n // mat4 out the receiving matrix\n // mat4 a the matrix to rotate\n // Number rad the angle to rotate the matrix by\n // vec3 axis the axis to rotate around\n mat4.rotate(this.modelViewMatrix, this.modelViewMatrix, angle, rotationAxis);\n };\n\n return cube;\n}", "getThreeFace(){return this.faceMesh;}", "function makeCube(highX, lowX, highY, lowY, highZ, lowZ, colors, array) {\n //vec4's alternate between vertex and color\n\n //front\n array.push(vec4(highX, lowY, highZ, 1.0));//Bottom Right\n array.push(colors[0]);\n array.push(vec4(0.0, 0.0, 1.0, 0.0)); //Normal Vector\n array.push(vec4(highX, highY, highZ, 1.0));//Top Right\n array.push(colors[0]);\n array.push(vec4(0.0, 0.0, 1.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, highY, highZ, 1.0));//Top Left\n array.push(colors[0]);\n array.push(vec4(0.0, 0.0, 1.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, highY, highZ, 1.0));//Top Left\n array.push(colors[0]);\n array.push(vec4(0.0, 0.0, 1.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, lowY, highZ, 1.0));//Bottom Left\n array.push(colors[0]);\n array.push(vec4(0.0, 0.0, 1.0, 0.0)); //Normal Vector\n array.push(vec4(highX, lowY, highZ, 1.0));//Bottom Right\n array.push(colors[0]);\n array.push(vec4(0.0, 0.0, 1.0, 0.0)); //Normal Vector\n\n //back\n array.push(vec4(lowX, lowY, lowZ, 1.0));\n array.push(colors[1]);\n array.push(vec4(0.0, 0.0, -1.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, highY, lowZ, 1.0));\n array.push(colors[1]);\n array.push(vec4(0.0, 0.0, -1.0, 0.0)); //Normal Vector\n array.push(vec4(highX, highY, lowZ, 1.0));\n array.push(colors[1]);\n array.push(vec4(0.0, 0.0, -1.0, 0.0)); //Normal Vector\n array.push(vec4(highX, highY, lowZ, 1.0));\n array.push(colors[1]);\n array.push(vec4(0.0, 0.0, -1.0, 0.0)); //Normal Vector\n array.push(vec4(highX, lowY, lowZ, 1.0));\n array.push(colors[1]);\n array.push(vec4(0.0, 0.0, -1.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, lowY, lowZ, 1.0));\n array.push(colors[1]);\n array.push(vec4(0.0, 0.0, -1.0, 0.0)); //Normal Vector\n\n //left\n array.push(vec4(highX, highY, highZ, 1.0));\n array.push(colors[2]);\n array.push(vec4(1.0, 0.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(highX, lowY, highZ, 1.0));\n array.push(colors[2]);\n array.push(vec4(1.0, 0.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(highX, lowY, lowZ, 1.0));\n array.push(colors[2]);\n array.push(vec4(1.0, 0.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(highX, lowY, lowZ, 1.0));\n array.push(colors[2]);\n array.push(vec4(1.0, 0.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(highX, highY, lowZ, 1.0));\n array.push(colors[2]);\n array.push(vec4(1.0, 0.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(highX, highY, highZ, 1.0));\n array.push(colors[2]);\n array.push(vec4(1.0, 0.0, 0.0, 0.0)); //Normal Vector\n\n //right\n array.push(vec4(lowX, highY, lowZ, 1.0));\n array.push(colors[3]);\n array.push(vec4(-1.0, 0.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, lowY, lowZ, 1.0));\n array.push(colors[3]);\n array.push(vec4(-1.0, 0.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, lowY, highZ, 1.0));\n array.push(colors[3]);\n array.push(vec4(-1.0, 0.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, lowY, highZ, 1.0));\n array.push(colors[3]);\n array.push(vec4(-1.0, 0.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, highY, highZ, 1.0));\n array.push(colors[3]);\n array.push(vec4(-1.0, 0.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, highY, lowZ, 1.0));\n array.push(colors[3]);\n array.push(vec4(-1.0, 0.0, 0.0, 0.0)); //Normal Vector\n\n //top\n array.push(vec4(highX, highY, highZ, 1.0));\n array.push(colors[4]);\n array.push(vec4(0.0, 1.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(highX, highY, lowZ, 1.0));\n array.push(colors[4]);\n array.push(vec4(0.0, 1.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, highY, lowZ, 1.0));\n array.push(colors[4]);\n array.push(vec4(0.0, 1.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, highY, lowZ, 1.0));\n array.push(colors[4]);\n array.push(vec4(0.0, 1.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, highY, highZ, 1.0));\n array.push(colors[4]);\n array.push(vec4(0.0, 1.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(highX, highY, highZ, 1.0));\n array.push(colors[4]);\n array.push(vec4(0.0, 1.0, 0.0, 0.0)); //Normal Vector\n\n //bottom\n array.push(vec4(highX, lowY, lowZ, 1.0));\n array.push(colors[5]);\n array.push(vec4(0.0, -1.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(highX, lowY, highZ, 1.0));\n array.push(colors[5]);\n array.push(vec4(0.0, -1.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, lowY, highZ, 1.0));\n array.push(colors[5]);\n array.push(vec4(0.0, -1.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, lowY, highZ, 1.0));\n array.push(colors[5]);\n array.push(vec4(0.0, -1.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(lowX, lowY, lowZ, 1.0));\n array.push(colors[5]);\n array.push(vec4(0.0, -1.0, 0.0, 0.0)); //Normal Vector\n array.push(vec4(highX, lowY, lowZ, 1.0));\n array.push(colors[5]);\n array.push(vec4(0.0, -1.0, 0.0, 0.0)); //Normal Vector\n\n if(array === track) {\n trackVertices += 36;\n } else if(array === rails) {\n railVertices += 36;\n } else if(array === cubes) {\n cubeVertices += 36;\n }\n\n}", "function appendCube (x, y, z) {\n if (!x && !y && !z) {\n // Don't create a cube in the center.\n return;\n }\n\n var size = 0.2;\n // Bottom\n var idx = cubeVerts.length / 8.0;\n cubeIndices.push(idx, idx + 1, idx + 2);\n cubeIndices.push(idx, idx + 2, idx + 3);\n\n // X Y Z U V NX NY NZ\n cubeVerts.push(x - size, y - size, z - size, 0.0, 1.0, 0.0, -1.0, 0.0);\n cubeVerts.push(x + size, y - size, z - size, 1.0, 1.0, 0.0, -1.0, 0.0);\n cubeVerts.push(x + size, y - size, z + size, 1.0, 0.0, 0.0, -1.0, 0.0);\n cubeVerts.push(x - size, y - size, z + size, 0.0, 0.0, 0.0, -1.0, 0.0);\n\n // Top\n idx = cubeVerts.length / 8.0;\n cubeIndices.push(idx, idx + 2, idx + 1);\n cubeIndices.push(idx, idx + 3, idx + 2);\n\n cubeVerts.push(x - size, y + size, z - size, 0.0, 0.0, 0.0, 1.0, 0.0);\n cubeVerts.push(x + size, y + size, z - size, 1.0, 0.0, 0.0, 1.0, 0.0);\n cubeVerts.push(x + size, y + size, z + size, 1.0, 1.0, 0.0, 1.0, 0.0);\n cubeVerts.push(x - size, y + size, z + size, 0.0, 1.0, 0.0, 1.0, 0.0);\n\n // Left\n idx = cubeVerts.length / 8.0;\n cubeIndices.push(idx, idx + 2, idx + 1);\n cubeIndices.push(idx, idx + 3, idx + 2);\n\n cubeVerts.push(x - size, y - size, z - size, 0.0, 1.0, -1.0, 0.0, 0.0);\n cubeVerts.push(x - size, y + size, z - size, 0.0, 0.0, -1.0, 0.0, 0.0);\n cubeVerts.push(x - size, y + size, z + size, 1.0, 0.0, -1.0, 0.0, 0.0);\n cubeVerts.push(x - size, y - size, z + size, 1.0, 1.0, -1.0, 0.0, 0.0);\n\n // Right\n idx = cubeVerts.length / 8.0;\n cubeIndices.push(idx, idx + 1, idx + 2);\n cubeIndices.push(idx, idx + 2, idx + 3);\n\n cubeVerts.push(x + size, y - size, z - size, 1.0, 1.0, 1.0, 0.0, 0.0);\n cubeVerts.push(x + size, y + size, z - size, 1.0, 0.0, 1.0, 0.0, 0.0);\n cubeVerts.push(x + size, y + size, z + size, 0.0, 0.0, 1.0, 0.0, 0.0);\n cubeVerts.push(x + size, y - size, z + size, 0.0, 1.0, 1.0, 0.0, 0.0);\n\n // Back\n idx = cubeVerts.length / 8.0;\n cubeIndices.push(idx, idx + 2, idx + 1);\n cubeIndices.push(idx, idx + 3, idx + 2);\n\n cubeVerts.push(x - size, y - size, z - size, 1.0, 1.0, 0.0, 0.0, -1.0);\n cubeVerts.push(x + size, y - size, z - size, 0.0, 1.0, 0.0, 0.0, -1.0);\n cubeVerts.push(x + size, y + size, z - size, 0.0, 0.0, 0.0, 0.0, -1.0);\n cubeVerts.push(x - size, y + size, z - size, 1.0, 0.0, 0.0, 0.0, -1.0);\n\n // Front\n idx = cubeVerts.length / 8.0;\n cubeIndices.push(idx, idx + 1, idx + 2);\n cubeIndices.push(idx, idx + 2, idx + 3);\n\n cubeVerts.push(x - size, y - size, z + size, 0.0, 1.0, 0.0, 0.0, 1.0);\n cubeVerts.push(x + size, y - size, z + size, 1.0, 1.0, 0.0, 0.0, 1.0);\n cubeVerts.push(x + size, y + size, z + size, 1.0, 0.0, 0.0, 0.0, 1.0);\n cubeVerts.push(x - size, y + size, z + size, 0.0, 0.0, 0.0, 0.0, 1.0);\n }", "function initCube(gl, myModel) {\r\n\t// Create a cube\r\n\t// v6----- v5\r\n\t// /| /|\r\n\t// v1------v0|\r\n\t// | | | |\r\n\t// | |v7---|-|v4\r\n\t// |/ |/\r\n\t// v2------v3\r\n\t// Coordinates\r\n var vertices = new Float32Array(myModel.meshes[0].vertices);\r\n\tvar vertices = new Float32Array([\r\n\t\t2.0, 2.0, 2.0, -2.0, 2.0, 2.0, -2.0,-2.0, 2.0, 2.0,-2.0, 2.0, // v0-v1-v2-v3 front\r\n\t\t2.0, 2.0, 2.0, 2.0,-2.0, 2.0, 2.0,-2.0,-2.0, 2.0, 2.0,-2.0, // v0-v3-v4-v5 right\r\n\t\t2.0, 2.0, 2.0, 2.0, 2.0,-2.0, -2.0, 2.0,-2.0, -2.0, 2.0, 2.0, // v0-v5-v6-v1 up\r\n\t\t-2.0, 2.0, 2.0, -2.0, 2.0,-2.0, -2.0,-2.0,-2.0, -2.0,-2.0, 2.0, // v1-v6-v7-v2 left\r\n\t\t-2.0,-2.0,-2.0, 2.0,-2.0,-2.0, 2.0,-2.0, 2.0, -2.0,-2.0, 2.0, // v7-v4-v3-v2 down\r\n\t\t2.0,-2.0,-2.0, -2.0,-2.0,-2.0, -2.0, 2.0,-2.0, 2.0, 2.0,-2.0 // v4-v7-v6-v5 back\r\n\t]);\r\n\t\r\n var texCoords = new Float32Array(myModel.meshes[0].texturecoords[0]);\r\n var normals = new Float32Array(myModel.meshes[0].normals);\r\n var tangents = new Float32Array(myModel.meshes[0].tangents);\r\n var bitangents = new Float32Array(myModel.meshes[0].bitangents);\r\n\r\n //var indices = new Uint16Array([].concat.apply([], myModel.meshes[0].faces)); // Indices of the vertices\r\n\tvar indices = new Uint16Array([\r\n\t\t0, 1, 2, 0, 2, 3, // front\r\n\t\t4, 5, 6, 4, 6, 7, // right\r\n\t\t8, 9,10, 8,10,11, // up\r\n\t\t12,13,14, 12,14,15, // left\r\n\t\t16,17,18, 16,18,19, // down\r\n\t\t20,21,22, 20,22,23 // back\r\n\t]);\r\n\r\n texCoords = new Float32Array([ // Texture coordinates\r\n .5, .75, .25, .75, .25, .5, .5, .5, // v0-v1-v2-v3 front\r\n .5, .75, .5, .5, .75, .5, .75, .75, // v0-v3-v4-v5 right\r\n .5, .75, .5, 1.0, .25, 1.0, .25, .75, // v0-v5-v6-v1 up\r\n .25, .75, 0.0, .75, 0.0, .5, .25, .5, // v1-v6-v7-v2 left\r\n .25, .25, .5, .25, .5, .5, .25, .5, // v7-v4-v3-v2 down\r\n .75, .5, 1.0, .5, 1.0, .75, .75, .75, // v4-v7-v6-v5 back\r\n ]);\r\n\r\n var o = new Object(); // Utilize Object to to return multiple buffer objects together\r\n\r\n // Write vertex information to buffer object\r\n o.vertexBuffer = initArrayBufferForLaterUse(gl, vertices, 3, gl.FLOAT);\r\n o.texCoordBuffer = initArrayBufferForLaterUse(gl, texCoords, 2, gl.FLOAT);\r\n o.normalBuffer = initArrayBufferForLaterUse(gl, normals, 3, gl.FLOAT);\r\n o.tangentBuffer = initArrayBufferForLaterUse(gl, tangents, 3, gl.FLOAT);\r\n o.bitangentBuffer = initArrayBufferForLaterUse(gl, bitangents, 3, gl.FLOAT);\r\n o.indexBuffer = initElementArrayBufferForLaterUse(gl, indices, gl.UNSIGNED_SHORT);\r\n\r\n if (!o.vertexBuffer || !o.texCoordBuffer || !o.indexBuffer) return null;\r\n\r\n o.numIndices = indices.length;\r\n\r\n // Unbind the buffer object\r\n gl.bindBuffer(gl.ARRAY_BUFFER, null);\r\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);\r\n\r\n return o;\r\n}", "function Face()\n {\n var normal_;\n var p0_;\n var p1_;\n var p2_;\n var center_;\n }", "function createCube(gl, translation, rotationAxis)\n{ \n // Vertex Data\n let vertexBuffer;\n vertexBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);\n\n let verts = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0\n ];\n\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(verts), gl.STATIC_DRAW);\n\n // Color data\n let colorBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer);\n\n let faceColors = [\n [1.0, 0.0, 0.0, 1.0], // Front face\n [0.0, 1.0, 0.0, 1.0], // Back face\n [0.0, 0.0, 1.0, 1.0], // Top face\n [1.0, 1.0, 0.0, 1.0], // Bottom face\n [1.0, 0.0, 1.0, 1.0], // Right face\n [0.0, 1.0, 1.0, 1.0] // Left face\n ];\n\n // Each vertex must have the color information, that is why the same color is concatenated 4 times, one for each vertex of the cube's face.\n let vertexColors = [];\n // for (const color of faceColors) \n // {\n // for (let j=0; j < 4; j++)\n // vertexColors.push(...color);\n // }\n faceColors.forEach(color =>{\n for (let j=0; j < 4; j++)\n vertexColors.push(...color);\n });\n\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertexColors), gl.STATIC_DRAW);\n\n // Index data (defines the triangles to be drawn).\n let cubeIndexBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeIndexBuffer);\n\n let cubeIndices = [\n 0, 1, 2, 0, 2, 3, // Front face\n 4, 5, 6, 4, 6, 7, // Back face\n 8, 9, 10, 8, 10, 11, // Top face\n 12, 13, 14, 12, 14, 15, // Bottom face\n 16, 17, 18, 16, 18, 19, // Right face\n 20, 21, 22, 20, 22, 23 // Left face\n ];\n\n // gl.ELEMENT_ARRAY_BUFFER: Buffer used for element indices.\n // Uint16Array: Array of 16-bit unsigned integers.\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(cubeIndices), gl.STATIC_DRAW);\n \n let cube = {\n buffer: vertexBuffer, colorBuffer:colorBuffer, indices:cubeIndexBuffer,\n vertSize:3, nVerts:24, colorSize:4, nColors: 24, nIndices:36,\n primtype:gl.TRIANGLES, modelViewMatrix: mat4.create(), currentTime : Date.now()\n };\n\n mat4.translate(cube.modelViewMatrix, cube.modelViewMatrix, translation);\n\n cube.update = function()\n {\n let now = Date.now();\n let deltat = now - this.currentTime;\n this.currentTime = now;\n let fract = deltat / duration;\n let angle = Math.PI * 2 * fract;\n \n // Rotates a mat4 by the given angle\n // mat4 out the receiving matrix\n // mat4 a the matrix to rotate\n // Number rad the angle to rotate the matrix by\n // vec3 axis the axis to rotate around\n mat4.rotate(this.modelViewMatrix, this.modelViewMatrix, angle, rotationAxis);\n };\n \n return cube;\n}", "function initCube() {\n var cubeMaterial = new THREE.MeshNormalMaterial();\n var cubeMaterial = new THREE.MeshBasicMaterial();\n\n var cube = new THREE.Mesh(new THREE.CubeGeometry(50, 50, 50), cubeMaterial);\n\n cube.material.color.setHex( 0xabcdef );\n cube.overdraw = true;\n return cube;\n}", "generateCubeVertices(size, centerX, centerY) {\n size /= 2;\n var x = [0, 0, 0, 0, 1, -1]\n var y = [0, 0, 1, -1, 0, 0]\n var z = [1, -1, 0, 0, 0, 0]\n var a = [-1, -1, 1, -1, 1, 1]\n var b = [-1, 1, 1, -1, 1, -1]\n\n for (var i = 0; i < 6; ++i) {\n for (var j = 0; j < 6; ++j) {\n var newX, newY, newZ\n if (x[i] != 0) { newX = x[i]; newY = a[j]; newZ = b[j]; }\n else if (y[i] != 0) { newX = a[j]; newY = y[i]; newZ = b[j];}\n else { newX = a[j]; newY = b[j]; newZ = z[i];}\n newX = centerX + size * newX + size;\n newY = centerY + size * newY + size;\n newZ = size * newZ + size;\n var vrt = new Vertex (newX, newY, newZ);\n vrt.normal = new Vector3([x[i], y[i], z[i]]);\n this.vertices.push (vrt);\n } \n }\n }", "function dadCube() {\n \t\tdadCubeVert = new Object();\t\t\t\t// Set up the cube vertices\n \t\tdadCubeVert = [\t\t\t\t\t\t\t// There are 8 points in the cube, so there 8 coordinates\n \t\t {x:-100, y: 100, z: 100},\n \t\t {x:-100, y:-100, z: 100},\n \t\t {x: 100, y:-100, z: 100},\n \t\t {x: 100, y: 100, z: 100}, \n \t\t {x: 100, y: 100, z:-100},\n \t\t {x: 100, y:-100, z:-100},\n \t\t {x:-100, y:-100, z:-100},\n \t\t {x:-100, y: 100, z:-100}\n \t\t \t];\n \t\t// Now the images used on each face\t\t\t\t\t\t\t\t\t\t ## SD crew members #\n \tdadCubeFace1 = new image(DEMO_ROOT + \"/def/resources/oldfart.jpg\");\t\t// # Old Fart\n \tdadCubeFace2 = new image(DEMO_ROOT + \"/def/resources/dodgit.jpg\");\t\t// # Doddering git\n \tdadCubeFace3 = new image(DEMO_ROOT + \"/def/resources/damevera.jpg\");\t// # Dame Vera Lynn\n \tdadCubeFace4 = new image(DEMO_ROOT + \"/def/resources/jpollock.jpg\");\t// # Jackson Pollock\n \tdadCubeFace5 = new image(DEMO_ROOT + \"/def/resources/colostomy.gif\");\t// # Colostomy Bag ####\n \tdadCubeFace6 = new image(DEMO_ROOT + \"/def/resources/sad_back.gif\");\t// Generic SD background\n \t\tdadCubeObj = new Object();\t// Set up the faces of the cube\n \t\tdadCubeObj=[ \n \t\t {p1:0, p2:1, p3:2, p4:3, u1:0,v1:0, u2:0,v2:1, u3:0.52,v3:1, u4:0.52,v4:0, params:new MeshBasicMaterial({ map: new Texture( dadCubeFace1.img ) })},\n \t\t {p1:3, p2:2, p3:5, p4:4, u1:0,v1:0, u2:0,v2:1, u3:0.52,v3:1, u4:0.52,v4:0, params:new MeshBasicMaterial({ map: new Texture( dadCubeFace2.img ) })},\n \t\t {p1:7, p2:6, p3:1, p4:0, u1:0,v1:0, u2:0,v2:1, u3:0.52,v3:1, u4:0.52,v4:0, params:new MeshBasicMaterial({ map: new Texture( dadCubeFace3.img ) })},\n \t\t {p1:7, p2:0, p3:3, p4:4, u1:0,v1:0, u2:0,v2:1, u3:0.52,v3:1, u4:0.52,v4:0, params:new MeshBasicMaterial({ map: new Texture( dadCubeFace4.img ) })},\n \t\t {p1:1, p2:6, p3:5, p4:2, u1:0,v1:0, u2:0,v2:1, u3:0.52,v3:1, u4:0.52,v4:0, params:new MeshBasicMaterial({ map: new Texture( dadCubeFace5.img ) })},\t\n \t\t {p1:4, p2:5, p3:6, p4:7, u1:0,v1:0, u2:0,v2:0.80, u3:1,v3:0.80, u4:1,v4:0, params:new MeshBasicMaterial({ map: new Texture( dadCubeFace6.img ) })}\n \t\t \t];\n \t\tdadCube3D = new codef3D(mainScreen, 900, 40, 1, 1600 );\t\t// Set up code object\n \t\tdadCube3D.faces4(dadCubeVert,dadCubeObj, false, true );\n \t\t// Main cube path/wobble.\n \t\tdadCubeMainWobble = new SeniorDads.Wobbler(\n \t\t\t\t[\n \t\t\t\t \t{value: 0, amp: 240, inc:0.08},\n \t\t\t\t \t{value: 0.5, amp: 20, inc:0.30}\n \t\t\t\t],\n \t\t\t\t[\n \t\t\t\t \t{value: 0, amp: 120, inc:0.06},\n \t\t\t\t \t{value: 0.5, amp: 20, inc:0.40}\n \t\t\t\t],\n \t\t\t\t[\n\t \t\t\t\t \t{value: 0, amp: 200, inc:0.07}\n \t\t\t\t \t]\n \t\t\t\t);\n \t\t// Wobble when the cube stops.\n \t\tdadCubeHoldWobble = new SeniorDads.Wobbler(\n \t\t\t\t[\n \t\t\t\t \t{value: 0, amp: 5, inc:0.20},\n \t\t\t\t \t{value: 0.5, amp: 10, inc:0.30}\n \t\t\t\t],\n \t\t\t\t[\n \t\t\t\t \t{value: 0, amp: 10, inc:0.30},\n \t\t\t\t \t{value: 0.5, amp: 5, inc:0.40}\n \t\t\t\t]\n \t\t);\n \t\t// Woble when it's just about to tumble away.\n \t\tdadCubeHoldRotWobble = new SeniorDads.Wobbler(\n \t\t\t\t[\n \t\t\t\t \t{value: 0, amp: 1, inc:0.20},\n \t\t\t\t \t{value: 0.5, amp: 0.5, inc:0.30}\n \t\t\t\t],\n \t\t\t\t[\n \t\t\t\t \t{value: 0, amp: 1, inc:0.30},\n \t\t\t\t \t{value: 0.5, amp: 0.5, inc:0.40}\n \t\t\t\t]\n \t\t\t\t,\n \t\t\t\t[\n \t\t\t\t \t{value: 0, amp: 1, inc:0.35},\n \t\t\t\t \t{value: 0.5, amp: 0.5, inc:0.45}\n \t\t\t\t] \n \t\t);\n \t}", "function Face(vertices) {\n this.vertices = vertices || [];\n}", "function turnFace(face) {\n var x,y,z;\n var direction,value;\n var mainAxis;\n var oldMat;\n switch (face) {\n case \"L\":\n mainAxis = 0; value = -1; direction = \"L\";\n break;\n case \"R\":\n mainAxis = 0; value = 1; direction = 0;\n break;\n case \"U\":\n mainAxis = 1;value = 1;direction = 0;\n break;\n case \"D\":\n mainAxis = 1;value = -1;direction = \"D\";\n break;\n case \"F\":\n mainAxis = 2;value = 1;direction = 0;\n break;\n case \"B\":\n mainAxis = 2;value = -1;direction = \"B\";\n break;\n case \"M\":\n mainAxis = 0;value = 0; direction = \"M\";\n break;\n case \"E\":\n mainAxis = 1;value = 0;direction = \"E\";\n break;\n case \"S\":\n mainAxis = 2;value = 0;direction = 0;\n break;\n case \"l\":\n mainAxis = 0; value = -1; direction = 0;\n break;\n case \"r\":\n mainAxis = 0; value = 1; direction = \"r\";\n break;\n case \"u\":\n mainAxis = 1;value = 1;direction = \"u\";\n break;\n case \"d\":\n mainAxis = 1;value = -1;direction = 0;\n break;\n case \"f\":\n mainAxis = 2;value = 1;direction = \"f\";\n break;\n case \"b\":\n mainAxis = 2;value = -1;direction = 0;\n break;\n case \"m\":\n mainAxis = 0;value = 0;direction = 0;\n break;\n case \"e\":\n mainAxis = 1;value = 0;direction = 0;\n break;\n case \"s\":\n mainAxis = 2;value = 0;direction = \"s\";\n break;\n }\n for (x = -1; x < 2; x++) {\n for (y = -1; y < 2; y++) {\n for (z = -1; z < 2; z++) {\n if (cubeState[x+1][y+1][z+1][mainAxis] === value) {\n oldMat = getRotationMatrix(x,y,z);\n if (!direction) \n oldMat = mult(oldMat,rotate(rotationAngle,getRotationAxes(x,y,z)[mainAxis]));\n else \n oldMat = mult(oldMat,rotate(rotationAngle,negateVec(getRotationAxes(x,y,z)[mainAxis])));\n setRotationMatrix(x,y,z,oldMat);\n }\n }\n }\n }\n}", "function makeCube(x, y, z) {\n return [\n { x: x - 1, y: y, z: z + 1 }, // FRONT TOP LEFT\n { x: x - 1, y: 0, z: z + 1 }, // FRONT BOTTOM LEFT\n { x: x + 1, y: 0, z: z + 1 }, // FRONT BOTTOM RIGHT\n { x: x + 1, y: y, z: z + 1 }, // FRONT TOP RIGHT\n { x: x - 1, y: y, z: z - 1 }, // BACK TOP LEFT\n { x: x - 1, y: 0, z: z - 1 }, // BACK BOTTOM LEFT\n { x: x + 1, y: 0, z: z - 1 }, // BACK BOTTOM RIGHT\n { x: x + 1, y: y, z: z - 1 }, // BACK TOP RIGHT\n ];\n }", "function Cube(_ref) {\n var _this = this;\n\n var _ref$center = _ref.center,\n center = _ref$center === undefined ? [0, 0, 0] : _ref$center,\n _ref$size = _ref.size,\n size = _ref$size === undefined ? 100 : _ref$size,\n _ref$thickness = _ref.thickness,\n thickness = _ref$thickness === undefined ? 0 : _ref$thickness,\n _ref$camera = _ref.camera,\n camera = _ref$camera === undefined ? null : _ref$camera;\n\n _classCallCheck(this, Cube);\n\n //create start and end points of cube\n var _center$map = center.map(function (p) {\n return p - size / 2;\n }),\n _center$map2 = _slicedToArray(_center$map, 3),\n x1 = _center$map2[0],\n y1 = _center$map2[1],\n z1 = _center$map2[2],\n _center$map3 = center.map(function (p) {\n return p + size / 2;\n }),\n _center$map4 = _slicedToArray(_center$map3, 3),\n x2 = _center$map4[0],\n y2 = _center$map4[1],\n z2 = _center$map4[2],\n _center = _slicedToArray(center, 3),\n cx = _center[0],\n cy = _center[1],\n cz = _center[2],\n vertices,\n vectors,\n labels;\n //store camera\n\n\n this.camera = camera;\n //initialize collection of WHS components\n this.components = [];\n this.textComponents = [];\n //track which instances we have been added to\n this.addedToInstances = [];\n\n //define 8 vertices of cube\n vertices = [[x1, y1, z1], [x1, y1, z2], [x1, y2, z1], [x1, y2, z2], [x2, y1, z1], [x2, y1, z2], [x2, y2, z1], [x2, y2, z2]];\n\n //build cube comprised of 12 edges\n //three edges for each of 4 opposite corners\n vectors = [[vertices[0], vertices[1]], [vertices[0], vertices[2]], [vertices[0], vertices[4]], [vertices[3], vertices[2]], [vertices[3], vertices[1]], [vertices[3], vertices[7]], [vertices[5], vertices[4]], [vertices[5], vertices[7]], [vertices[5], vertices[1]], [vertices[6], vertices[7]], [vertices[6], vertices[4]], [vertices[6], vertices[2]]];\n //loop the vectors\n\n var _loop = function _loop(i) {\n //create start and end points of vector\n var _vectors$i = _slicedToArray(vectors[i], 2),\n _vectors$i$ = _slicedToArray(_vectors$i[0], 3),\n x1 = _vectors$i$[0],\n y1 = _vectors$i$[1],\n z1 = _vectors$i$[2],\n _vectors$i$2 = _slicedToArray(_vectors$i[1], 3),\n x2 = _vectors$i$2[0],\n y2 = _vectors$i$2[1],\n z2 = _vectors$i$2[2],\n _vectors$i$1$map = vectors[i][1].map(function (p, idx) {\n return Math.abs(p - vectors[i][0][idx]);\n }),\n _vectors$i$1$map2 = _slicedToArray(_vectors$i$1$map, 3),\n w = _vectors$i$1$map2[0],\n h = _vectors$i$1$map2[1],\n d = _vectors$i$1$map2[2],\n _map = [w, h, d].map(function (d) {\n return d + thickness;\n }),\n _map2 = _slicedToArray(_map, 3),\n rw = _map2[0],\n rh = _map2[1],\n rd = _map2[2],\n px = (x1 + x2) / 2,\n py = (y1 + y2) / 2,\n pz = (z1 + z2) / 2,\n colors = [\"#\" + x1.toString(16).padStart(2, \"0\") + y1.toString(16).padStart(2, \"0\") + z1.toString(16).padStart(2, \"0\"), \"#\" + x2.toString(16).padStart(2, \"0\") + y2.toString(16).padStart(2, \"0\") + z2.toString(16).padStart(2, \"0\")],\n material = void 0;\n\n /* \n * Create an array of materials,\n * one material for each side of the box we will create.\n * The gradients will need to run in different directions based on direction of box.\n * The ends of the box will need to be a solid color.\n * \n * An array material will be converted to a gradient,\n * the array is the linearCoordinates of the gradient.\n * A string material will be converted to a solid color.\n * \n * Order of materials based on which side they are applied to:\n * +x, -x, +y, -y, +z, -z ]\n * \n */\n\n //x-axis boxes\n\n\n if (w) {\n material = [x1 > x2 ? colors[0] : colors[1], x1 < x2 ? colors[0] : colors[1], [x1, y1, x2, y2], [x1, y1, x2, y2], [x1, y1, x2, y2], [x2, y2, x1, y1]];\n } else if (h) {\n material = [[x2, y2, x1, y1], [x2, y2, x1, y1], y1 > y2 ? colors[0] : colors[1], y1 < y2 ? colors[0] : colors[1], [x2, y2, x1, y1], [x2, y2, x1, y1]];\n } else if (d) {\n material = [[z2, y2, z1, y1], [z1, y1, z2, y2], [x1, z1, x2, z2], [x2, z2, x1, z1], z1 > z2 ? colors[0] : colors[1], z1 < z2 ? colors[0] : colors[1]];\n }\n\n //create Box, add it to components\n _this.components.push(new _whs.Box({\n geometry: {\n width: rw,\n height: rh,\n depth: rd\n },\n material: material.map(function (r) {\n //if this is a string\n if (typeof r == \"string\") {\n /*\n //then it is a color, convert it to a hexadecimal number\n return new MeshBasicMaterial({\n color: Number(r.replace(\"#\", \"0x\")),\n map: new TextureLoader().load('img/Wood_Texture_Grayscale_360x360.jpg')\n });\n */\n //return no texture for solid colors\n return null;\n }\n //else, it is linearCoordinates for a gradient\n return new _three.MeshPhongMaterial({\n map: (0, _util.generateGradientTexture)({\n colors: colors,\n imageOpacity: 0.8,\n imageTexture: 'img/Wood_Texture_Grayscale_360x360.jpg',\n linearCoordinates: r,\n canvasDimensions: [Math.abs(r[0] - r[2]) + thickness, Math.abs(r[1] - r[3]) + thickness]\n })\n });\n }),\n position: [px, py, pz]\n }));\n /* alternate method uses Line (has no thickness) instead of Box\n new WHS.Line({\n curve: new THREE.LineCurve3(\n new THREE.Vector3(...vectors[i][0]),\n new THREE.Vector3(...vectors[i][1])\n ),\n material: new THREE.MeshBasicMaterial({\n color: 0x0000ff\n })\n }).addTo(app);\n */\n };\n\n for (var i = 0; i < vectors.length; i++) {\n _loop(i);\n }\n\n /* alternate method that uses single Box to represent cube\n //Box\n new WHS.Box({\n geometry: {\n width: 255,\n height: 255,\n depth: 255\n },\n material: new THREE.MeshBasicMaterial({\n color: 0x0000ff\n }),\n position: [0, 0, 0]\n }).addTo(app);\n */\n\n // create textual label for each vertice of the cube\n // (ordered in sync with vertices)\n labels = [\"Medievalist\", \"Conservative\", \"Right Wing\", 'Anti-intrusion\\nLibertarian', 'Security &\\nHealth & Safety\\nStatist', \"Leftist\", \"Progressive\", \"Liberal\"];\n\n //load font\n new _three.FontLoader().load(\"fonts/helvetiker_regular.typeface.json\", function (font) {\n //loop the labels\n for (var i = 0; i < labels.length; i++) {\n var _vertices$i = _slicedToArray(vertices[i], 3),\n px = _vertices$i[0],\n py = _vertices$i[1],\n pz = _vertices$i[2],\n distance = size / 7,\n text = void 0;\n //adjust position\n\n\n px += distance * (px > cx ? 1 : -1);\n py += distance * (py > cy ? 2 : -2);\n pz += distance * (pz > cz ? 1 : -1);\n //create Text\n text = new _Label.Label({\n text: labels[i],\n font: font,\n geometry: {\n size: size[100],\n height: 0\n },\n material: new _three.MeshPhongMaterial({\n color: 0xffffff\n }),\n position: [px, py, pz]\n });\n //center the pivot point of the text\n text.geometry.center();\n //add it to components\n _this.components.push(text);\n _this.textComponents.push(text);\n //add it to any instances we have already been added to\n _this._addLate(text);\n }\n });\n }", "function initCubes(){\n\tfor(var i = 0; i<numCubes; i++){\n\t for(var j = 0; j<rubikSize*rubikSize; j++){\n\t\t for(var k = 0; k<rubikSize; k++){\n\t\t\t var newCube = cubeModel();\n\t\t\t newCube.scale(0.25, 0.25, 0.25);\n\t\t\t newCube.translate(cubeOffset[i%3], cubeOffset[j%3], cubeOffset[k%3]);\n\t\t\t cubes.push(newCube);\n\t\t\t points = points.concat(newCube.points);\n\t\t\t colors = colors.concat(newCube.colors);\n\t\t }\n\t\t j+=k;\n\t }\n\t i+=j;\n\t}\n}", "function buildLeftBorder(geometry,currentIndex){\n\tif(facingCamera){/*Serve para construir face que pode ser vista de fora*/\n\n\t\tgeometry.vertices.push(new THREE.Vector3(0,0.25,0));//PONTO A\n\t\tgeometry.vertices.push(new THREE.Vector3(0,0.25,-0.10));// PONTO B\n\t\tgeometry.vertices.push(new THREE.Vector3(-0.25,-0.25,0));// PONTO C\n\t\t\n\t\tvar color = new THREE.Color( 0x000000 );\n\t\tvar face = new THREE.Face3(currentIndex,currentIndex+1,currentIndex+2,color);\n\t\tcurrentIndex += 3;\n\t\tgeometry.faces.push(face)\n\n\t\tgeometry.vertices.push(new THREE.Vector3(-0.25,-0.25,0));\n\t\tgeometry.vertices.push(new THREE.Vector3(0,0.25,-0.10));\n\t\tgeometry.vertices.push(new THREE.Vector3(-0.25,-0.25,-0.10));\n\t\tface = new THREE.Face3(currentIndex,currentIndex+1,currentIndex+2,color);\n\t\tcurrentIndex += 3;\n\t\tgeometry.faces.push(face)\n\n\t}\n\telse{/*Serve para construir face que pode ser vista de dentro*/\n\t\tgeometry.vertices.push(new THREE.Vector3(0,0.25,0));//PONTO A\n\t\tgeometry.vertices.push(new THREE.Vector3(-0.25,-0.25,0));// PONTO C A DIFERENCA ESTA NA ORDEM\n\t\tgeometry.vertices.push(new THREE.Vector3(0,0.25,-0.10));// PONTO B DESTAS DUAS LINHAS QUE ESTAO TROCADAS\n\t\t\t\n\t\tvar color = new THREE.Color( 0x000000 );\n\t\tvar face = new THREE.Face3(currentIndex,currentIndex+1,currentIndex+2,color);\n\t\tcurrentIndex += 3;\n\t\tgeometry.faces.push(face)\n\n\t\tgeometry.vertices.push(new THREE.Vector3(-0.25,-0.25,0));\n\t\tgeometry.vertices.push(new THREE.Vector3(-0.25,-0.25,-0.10));\n\t\tgeometry.vertices.push(new THREE.Vector3(0,0.25,-0.10));\n\t\tface = new THREE.Face3(currentIndex,currentIndex+1,currentIndex+2,color);\n\t\tcurrentIndex += 3;\n\t\tgeometry.faces.push(face)\n\n\n\t}\n}", "function renderCube(dimension) {\n\t\n\n\tcurrent_shape = 'cube';\n\n\tcontainer = document.createElement( 'div' );\n\tcontainer.style.marginTop = \"-65px\";\n\t\n\twhile (cubeContainer.firstChild) {\n\t\tconsole.log(\"cube removing child\"+cubeContainer.firstChild);\n\t\tcubeContainer.removeChild(cubeContainer.firstChild);\n\t}\n\t\n\tcubeContainer.appendChild( container );\n\t\n\tcamera = new THREE.PerspectiveCamera(50, window.innerWidth /window.innerHeight, 1, 700);\n\tcamera.position.y = 300;\n\tcamera.position.z = 250;\n\n\tscene = new THREE.Scene();\n\n\t// Cube\n\t//set the dimensions here using user input\n\tvar geometry = new THREE.BoxGeometry(dimension, dimension, dimension);\n\n\tfor (var i = 0; i < geometry.faces.length; i++) {\n\t\tgeometry.faces[i].color.setHex(0x000000);\n\t}\n\n\tvar material = new THREE.MeshBasicMaterial({\n\t\toverdraw: 0.5,\n\t\twireframe: true,\n\t\tvertexColors: THREE.FaceColors\n\t});\n\n\tcube = new THREE.Mesh(geometry, material);\n\t// var wf = new THREE.WireframeHelper(cube);\n\t// wf.material.color.setRGB(0, 0, 0);\n\tcube.position.y = 300;\n\n\tvar egh = new THREE.EdgesHelper(cube, 0x000000 );\n\tegh.material.linewidth = 5;\n\t//cube.position.x = -50;\n\tscene.add( egh );\n\tscene.add(cube);\n\t// scene.add(wf);\n\n\t// Plane\n\tgeometry = new THREE.PlaneBufferGeometry(dimension, dimension);\n\tgeometry.applyMatrix(new THREE.Matrix4().makeRotationX(-Math.PI / 2));\n\n\tmaterial = new THREE.MeshBasicMaterial({\n\t\tcolor: 0xe0e0e0,\n\t\toverdraw: 0.5\n\t});\n\n\tplane = new THREE.Mesh(geometry, material);\n\tplane.position.y = 200;\n\tscene.add(plane);\n\n\trenderer = new THREE.CanvasRenderer();\n\trenderer.setClearColor(0xffffff);\n\trenderer.setPixelRatio(window.devicePixelRatio);\n\trenderer.setSize(window.innerWidth/3, window.innerHeight/3);\n\t\n\tcubeContainer.appendChild(renderer.domElement);\n\n\tcubeContainer.addEventListener('mousedown', onDocumentMouseDown, false);\n\tcubeContainer.addEventListener('touchstart', onDocumentTouchStart, false);\n\tcubeContainer.addEventListener('touchmove', onDocumentTouchMove, false);\n\n\twindow.addEventListener('resize', onWindowResize, false);\n\n\tanimate();\n}", "setCube(_cube) {\n }", "function createScene() {\r\n // geometry\r\n var geometry = new THREE.Geometry(2,2,2);\r\n\r\n// Make the simplest shape possible: a triangle.\r\ngeometry.vertices.push(\r\n new THREE.Vector3(-10, 10, 0),\r\n new THREE.Vector3(-10, -10, 0),\r\n new THREE.Vector3( 10, -10, 0)\r\n);\r\n\r\n// Note that I'm assigning the face to a variable\r\n// I'm not just shoving it into the geometry.\r\nvar face = new THREE.Face4(0, 1, 2,3);\r\n\r\n// Assign the colors to the vertices of the face.\r\nface.vertexColors[0] = new THREE.Color(0xff0000); // red\r\nface.vertexColors[1] = new THREE.Color(0x00ff00); // green\r\nface.vertexColors[2] = new THREE.Color(0x0000ff); // blue\r\nface.vertexColors[3]= new THREE.Color(0x0000ff);\r\n// Now the face gets added to the geometry.\r\ngeometry.faces.push(face);\r\n\r\n// Using this material is important.\r\nvar material = new THREE.MeshBasicMaterial({vertexColors: THREE.VertexColors});\r\n\r\nvar mesh = new THREE.Mesh(geometry, material);\r\n scene.add(mesh);\r\n}", "function createCube() {\n var destObj = new Entity(null, [getRnd(-10, 10), getRnd(10,15), -getRnd(5, 25)], [1,1,1], 1);\n destObj.face_colors = getColors(getRnd(1, 7));\n destObj.acceleration = Vector3D.create([0,-1,0]);\n destObj.angle = getRnd(-1, 1);\n destObj.axis = Vector3D.create([getRnd(-1,1),getRnd(-1,1),getRnd(-1,1)]);\n return destObj;\n}", "getThreeFace(){return this.three_shelf_face}", "function drawCube(verticesColors, color){\n // Индексы вершин\n var indices = new Uint8Array([\n 0,1,2,0,2,3, // bottom\n 4,5,6,5,7,6, // top\n 0,3,4,3,4,7, // left\n 1,2,5,2,5,6, // right\n 0,1,5,0,4,5, // front\n 2,3,7,2,6,7 // back\n ]);\n n = initVertexBuffers(verticesColors, indices, color,{x:0, y:0, z:0},{x:0, y:0, z:0})\n\n gl.drawElements(gl.TRIANGLES, n, gl.UNSIGNED_BYTE, 0);\n}", "createCube(color, side, position) {\n\n let geometry = new THREE.CubeGeometry( 200, 600, 50 )\n let material = new THREE.MeshStandardMaterial({ color: color })\n let mesh = new THREE.Mesh( geometry, material )\n\n mesh.position.x = side === 'right' ? 300 : -300\n mesh.position.z = position\n mesh.position.y = -200\n\n mesh.shading = THREE.FlatShading\n mesh.castShadow = true\n mesh.receiveShadow = true\n \n this.scene.add( mesh )\n this.buildings.push( mesh )\n }", "constructor({\n width,\n height,\n sides = 3,\n }: {\n width: number,\n height: number,\n sides: number,\n }) {\n this.width = width;\n this.height = height;\n this.renderer = new WebGLRenderer();\n this.renderer.setSize(width, height);\n\n this.camera = new PerspectiveCamera(75, width / height, 0.1, 1000);\n this.camera.position.z = 6;\n this.camera.position.y = 3;\n this.camera.position.x = 3;\n this.camera.lookAt(new Vector3(0,0,0));\n new OrbitControls(this.camera, this.renderer.domElement);\n\n this.cubeContainer = new Object3D();\n this.cubes = buildCubePositions(sides).map((position, i) =>\n // TODO: don't remember the meaning behind name `front`...\n // why not just do `cubeColorsAt(i)`?\n buildBox(position, cubeColorsAt(i, front(CUBE_COLORS)))\n );\n\n this.cubes.forEach((cube) => {\n this.cubeContainer.add(cube)\n });\n\n this.scene = new Scene();\n this.scene.add(this.cubeContainer);\n\n // rotation stuff, see\n // https://github.com/jwhitfieldseed/rubik-js/blob/master/rubik.js#L261\n this.pivot = new Object3D();\n this.animateTurn = () => {};\n this.finishAnimatingTurn = () => {};\n\n setTimeout(() => {\n [\n \"B2\", \"D'\", \"L\", \"B'\", \"D\", \"R'\", \"B\", \"D2\", \"R'\", \"B'\", \"L'\", \"U'\",\n \"F'\", \"R'\", \"U2\", \"B\", \"L2\", \"B2\", \"L'\", \"U'\", \"F2\", \"U2\", \"B'\", \"U2\", \"F'\"\n ].reduce((promise, move) => {\n return promise\n .then(() => this.turn(move))\n .then(() => delay(250));\n }, Promise.resolve());\n }, 1000);\n }", "function renderCube(){\r\n\tvar tmpParSys = particleSystem;// We make a copy of the particle system because the cube object will be removed(including particles)\r\n\t\r\n\tscene.remove(cube) ; // We remove the cube.\r\n\tmaterial = new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true, opacity: 0 } ) ;\r\n material.transparent=true ;\r\n cube = new THREE.Mesh( new THREE.CubeGeometry( 300, 300, 300), material );\r\n\tcube.position.y = 175 ;\t\t\t\t\r\n\tvar xc= document.getElementById('x_color_id').value,yc=document.getElementById('y_color_id').value,zc=document.getElementById('z_color_id').value;\r\n\tvar planes = CreateCube(300,300,300,xc,yc,zc) ;\r\n\tvar i, j ;\r\n var pln, lln ;\r\n pln = planes.length ;\r\n for(i = 0; i < pln ; i++){\r\n \tlln = planes[i].length ;\r\n for(j = 0; j < lln; j++){\r\n \tcube.add(planes[i][j]) ;\r\n }\r\n } \r\n \tparticleSystem = tmpParSys ; \r\n\tfor (i = 0 ; i < particleSystem.length;i++) cube.add(particleSystem[i]) ;\r\n scene.add( cube );\r\n}", "function colorCube()\n{\n quad( 1, 0, 3, 2 );\n quad( 2, 3, 7, 6 );\n quad( 3, 0, 4, 7 );\n quad( 6, 5, 1, 2 );\n quad( 4, 5, 6, 7 );\n quad( 5, 4, 0, 1 );\n}", "function addBasicCube() {\n var geometry = new THREE.BoxGeometry(20, 20, 20, 10, 10, 10);\n for (var i = 0; i < objectCounts; i++) {\n var cube = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({\n color: 0xffffff, //\n wireframe: true,\n wireframeLinejoin: 'bevel'\n }));\n cube.position.x = Math.random() * range * 2 - range; //-400~400\n cube.position.y = Math.random() * range * 2 - range;\n cube.position.z = Math.random() * range * 2 - range;\n\n cube.rotation.x = Math.random() * 2 * Math.PI; //0~2PI\n cube.rotation.y = Math.random() * 2 * Math.PI;\n cube.rotation.z = Math.random() * 2 * Math.PI;\n\n cube.scale.x = Math.random(); //0~1\n cube.scale.y = Math.random();\n cube.scale.z = Math.random();\n\n scene.add(cube);\n }\n}", "function Cube(options)\n{\n\tvar cube = {};\n\n\tvar settings = jQuery.extend({\n\t\tstart_x :1,\n\t\tstart_y : 1,\n\t\tsize : 30,\n\t\tfill_color: new Color(0, 0, 255, 1)\n\t},\n\toptions);\n\n\t//Get the coordinates of the vertices in the cube\n\tcube.getCoords = function()\n\t{\n\t\tvar coords = [];\n\n\t\t//Find the vertical distance from the top left corner to the first point\n\t\t//using pythagoras theorem. The top left side is the hypotenuse.\n\t\t//All the ather vertices are calculated from this point.\n\t\tvar vert = Math.sqrt(Math.pow(settings.size, 2) / 5);\n\t\tvar hor = vert * 2;\n\n\t\tcoords[0] = {\n\t\t\tx : settings.start_x,\n\t\t\ty : settings.start_y + vert\n\t\t};\n\n\t\tcoords[1] = {\n\t\t\tx : settings.start_x + hor,\n\t\t\ty : settings.start_y\n\t\t};\n\n\t\tcoords[2] = {\n\t\t\tx : settings.start_x + hor * 2,\n\t\t\ty : settings.start_y + vert\n\t\t};\n\n\t\tcoords[3] = {\n\t\t\tx : settings.start_x + hor,\n\t\t\ty : settings.start_y + vert * 2\n\t\t};\n\n\t\tcoords[4] = {\n\t\t\tx : settings.start_x,\n\t\t\ty : settings.start_y + vert + settings.size\n\t\t};\n\n\t\tcoords[5] = {\n\t\t\tx : settings.start_x + hor,\n\t\t\ty : settings.start_y + vert * 2 + settings.size\n\t\t};\n\n\t\tcoords[6] = {\n\t\t\tx : settings.start_x + hor * 2,\n\t\t\ty : settings.start_y + vert + settings.size\n\t\t};\n\n\t\tcoords[7] = {\n\t\t\tx : settings.start_x + hor,\n\t\t\ty : settings.start_y + settings.size\n\t\t};\n\n\n\t\treturn coords;\n\t};\n\n\t//Draw the cube on the canvas passed in.\n\t//Draws and fills each side separately\n\tcube.draw = function(context) {\n\t\tvar coords = this.getCoords();\n\n//\t\t//Bottom side, Should be hidden\n//\t\tcontext.beginPath();\n//\t\tcontext.moveTo(coords[4].x, coords[4].y);\n//\t\tcontext.lineTo(coords[7].x, coords[7].y);\n//\t\tcontext.lineTo(coords[6].x, coords[6].y);\n//\t\tcontext.lineTo(coords[5].x, coords[5].y);\n//\t\tcontext.lineTo(coords[4].x, coords[4].y);\n//\t\tcontext.stroke();\n//\t\tcontext.closePath();\n//\n//\t\t//back left, Should be hidden\n//\t\tcontext.beginPath();\n//\t\tcontext.moveTo(coords[0].x, coords[0].y);\n//\t\tcontext.lineTo(coords[1].x, coords[1].y);\n//\t\tcontext.lineTo(coords[7].x, coords[7].y);\n//\t\tcontext.lineTo(coords[4].x, coords[4].y);\n//\t\tcontext.lineTo(coords[0].x, coords[0].y);\n//\t\tcontext.stroke();\n//\t\tcontext.closePath();\n//\n//\t\t//back right, Should be hidden\n//\t\tcontext.beginPath();\n//\t\tcontext.moveTo(coords[1].x, coords[1].y);\n//\t\tcontext.lineTo(coords[2].x, coords[2].y);\n//\t\tcontext.lineTo(coords[6].x, coords[6].y);\n//\t\tcontext.lineTo(coords[7].x, coords[7].y);\n//\t\tcontext.lineTo(coords[1].x, coords[1].y);\n//\t\tcontext.stroke();\n//\t\tcontext.closePath();\n\n\t\t//Top side\n\t\tcontext.fillStyle = settings.fill_color.getLighter(20).toString();\n\t\tcontext.beginPath();\n\t\tcontext.moveTo(coords[0].x, coords[0].y);\n\t\tcontext.lineTo(coords[1].x, coords[1].y);\n\t\tcontext.lineTo(coords[2].x, coords[2].y);\n\t\tcontext.lineTo(coords[3].x, coords[3].y);\n\t\tcontext.lineTo(coords[0].x, coords[0].y);\t\t\n\t\t//context.stroke();\n\t\tcontext.closePath();\n\t\tcontext.fill();\n\n\t\t//Front Left side\n\t\tcontext.fillStyle = settings.fill_color.toString();\n\t\tcontext.beginPath();\n\t\tcontext.moveTo(coords[0].x, coords[0].y);\n\t\tcontext.lineTo(coords[4].x, coords[4].y);\n\t\tcontext.lineTo(coords[5].x, coords[5].y);\n\t\tcontext.lineTo(coords[3].x, coords[3].y);\n\t\tcontext.lineTo(coords[0].x, coords[0].y);\n\t\t//context.stroke();\n\t\tcontext.closePath();\n\t\tcontext.fill();\n\n\t\t//Front Right\n\t\tcontext.fillStyle = settings.fill_color.getDarker(20).toString();\n\t\tcontext.beginPath();\n\t\tcontext.moveTo(coords[3].x, coords[3].y);\n\t\tcontext.lineTo(coords[2].x, coords[2].y);\n\t\tcontext.lineTo(coords[6].x, coords[6].y);\n\t\tcontext.lineTo(coords[5].x, coords[5].y);\n\t\tcontext.lineTo(coords[3].x, coords[3].y);\n\t\t//context.stroke();\n\t\tcontext.closePath();\n\t\tcontext.fill();\n\n\n\t\t\n\t\t\n\t};\n\n\treturn cube;\n}", "function cube(vertices, points, vertex, coordinate){\n quad(vertices, points, vertex, 0, 2, 1, 4, coordinate);\n quad(vertices, points, vertex, 3, 0, 5, 1, coordinate);\n quad(vertices, points, vertex, 3, 6, 0, 2, coordinate);\n quad(vertices, points, vertex, 1, 4, 5, 7, coordinate);\n quad(vertices, points, vertex, 5, 7, 3, 6, coordinate);\n quad(vertices, points, vertex, 2, 6, 4, 7, coordinate);\n}", "function createCube()\n{\n var geometry = new THREE.BoxGeometry( 10, 10, 10 ); // Create geometry (vertices) to display (box)\n var material = new THREE.MeshLambertMaterial( // Shader to be used by the mesh, set color\n {\n color: 0xCC0000 // red\n });\n\n var cube = new THREE.Mesh( geometry, material );\n return cube;\n}", "function Face( top_left_x, top_left_y, bottom_right_x, bottom_right_y )\n\t{\n\t\t// Increment the instance count and save it to the instance. \n // This will become the key to the private space.\n\t\tthis.i = instance++;\n\t\t\n\t\t// Create a new object in the private space.\n\t\tfaces[this.i] = {};\n\t\t\n\t\tfaces[this.i]._top_left_x = top_left_x;\n\t\tfaces[this.i]._top_left_y = top_left_y;\n\t\tfaces[this.i]._bottom_right_x = bottom_right_x;\n\t\tfaces[this.i]._bottom_right_y = bottom_right_y;\n\t}", "function BackFace(cubies) {\n Face.apply(this, [cubies]);\n}", "constructor({ width = 1.0, height = 1.0, length = 1.0 }) {\n super();\n /* Points 0, 1, 2, 3 are on the left.\n * Points 4, 5, 6, 7 are on the right.\n * x = width, y = length, z = height*/\n const topLeftOut = [(width / 2), 0, (height / 2)];\n const botLeftOut = [(width / 2), 0, -(height / 2)];\n const topLeftIn = [-(width / 2), 0, (height / 2)];\n const botLeftIn = [-(width / 2), 0, -(height / 2)];\n const topRightOut = [(width / 2), length, (height / 2)];\n const botRightOut = [(width / 2), length, -(height / 2)];\n const topRightIn = [-(width / 2), length, (height / 2)];\n const botRightIn = [-(width / 2), length, -(height / 2)];\n this.vertices.push(topLeftOut);\n this.vertices.push(botLeftOut);\n this.vertices.push(topLeftIn);\n this.vertices.push(botLeftIn);\n this.vertices.push(topRightOut);\n this.vertices.push(botRightOut);\n this.vertices.push(topRightIn);\n this.vertices.push(botRightIn);\n\n // Left side face\n this.triangles.push([0, 1, 2]);\n this.triangles.push([2, 3, 1]);\n // Back side face\n this.triangles.push([2, 3, 6]);\n this.triangles.push([3, 6, 7]);\n // Right side face\n this.triangles.push([4, 5, 6]);\n this.triangles.push([5, 6, 7]);\n // Bottom face\n this.triangles.push([3, 5, 1]);\n this.triangles.push([5, 6, 3]);\n // Front side face\n this.triangles.push([1, 5, 4]);\n this.triangles.push([0, 1, 4]);\n // Top face\n this.triangles.push([0, 2, 4]);\n this.triangles.push([2, 4, 6]);\n }", "function drawCube(){\r\n\r\n // Draw the cube by binding the array buffer to the cube's vertices\r\n // array, setting attributes, and pushing it to GL.\r\n\r\n gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexBuffer);\r\n gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, 3, gl.FLOAT, false, 0, 0);\r\n\r\n // Set the texture coordinates attribute for the vertices.\r\n\r\n gl.bindBuffer(gl.ARRAY_BUFFER, cubeTCoordBuffer);\r\n gl.vertexAttribPointer(shaderProgram.texCoordAttribute, 3, gl.FLOAT, false, 0, 0);\r\n\r\n // Specify the texture to map onto the faces.\r\n\r\n\r\n gl.activeTexture(gl.TEXTURE0);\r\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, cubeMap);\r\n gl.uniform1i(gl.getUniformLocation(shaderProgram, \"uSampler\"), 0);\r\n //gl.activeTexture(gl.TEXTURE1);\r\n //gl.bindTexture(gl.TEXTURE_CUBE_MAP, cubeTexture);\r\n\r\n // Draw the cube.\r\n\r\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeTriIndexBuffer);\r\n setMatrixUniforms();\r\n gl.drawElements(gl.TRIANGLES, 36, gl.UNSIGNED_SHORT, 0);\r\n}", "function createCubeAtPosition(x, y, rgba) {\n\tlet posOffset = objVertices.length;\n\tobjVertices.push([x, y + 1, 1]);\n\tobjVertices.push([x, y, 1]);\n\tobjVertices.push([x + 1, y, 1]);\n\tobjVertices.push([x + 1, y + 1, 1]);\n\tobjVertices.push([x, y + 1, 0]);\n\tobjVertices.push([x, y, 0]);\n\tobjVertices.push([x + 1, y, 0]);\n\tobjVertices.push([x + 1, y + 1, 0]);\n\t\n\tfindOrCreateMtl(rgba, objFaces.length);\n\tobjFaces.push([(1+posOffset), (2+posOffset), (3+posOffset), (4+posOffset)]);\n\tobjFaces.push([(8+posOffset), (7+posOffset), (6+posOffset), (5+posOffset)]);\n\tobjFaces.push([(4+posOffset), (3+posOffset), (7+posOffset), (8+posOffset)]);\n\tobjFaces.push([(5+posOffset), (1+posOffset), (4+posOffset), (8+posOffset)]);\n\tobjFaces.push([(5+posOffset), (6+posOffset), (2+posOffset), (1+posOffset)]);\n\tobjFaces.push([(2+posOffset), (6+posOffset), (7+posOffset), (3+posOffset)]);\n\n}", "function drawCube(){\n gl.useProgram(shaderProgram);\n // Draw the cube by binding the array buffer to the cube's vertices\n // array, setting attributes, and pushing it to GL.\n\n\n // Specify the texture to map onto the faces.\n\n\n var textures\n // Draw the cube.\n for(var i = 0; i < 6; i++) {\n gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexBuffer);\n gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, 3, gl.FLOAT, false, 0, 0);\n\n // Set the texture coordinates attribute for the vertices.\n\n gl.bindBuffer(gl.ARRAY_BUFFER, cubeTCoordBuffer);\n gl.vertexAttribPointer(shaderProgram.texCoordAttribute, 2, gl.FLOAT, false, 0, 0);\n\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, texs[i]);\n gl.uniform1i(gl.getUniformLocation(shaderProgram, \"uSampler\"), 0);\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeTriIndexBuffer[i]);\n setMatrixUniforms();\n gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0);\n }\n \n}", "function ReferenceFace() {\n this.i1, this.i2;\n // int\n this.v1, this.v2;\n // v\n this.normal = Vec2.zero();\n this.sideNormal1 = Vec2.zero();\n this.sideOffset1;\n // float\n this.sideNormal2 = Vec2.zero();\n this.sideOffset2;\n}", "function make( v1, v2, v3 ) {\n\n var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );\n face.centroid.add( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );\n that.faces.push( face );\n\n var azi = azimuth( face.centroid );\n\n that.faceVertexUvs[ 0 ].push( [\n correctUV( v1.uv, v1, azi ),\n correctUV( v2.uv, v2, azi ),\n correctUV( v3.uv, v3, azi )\n ] );\n\n }", "function Box(v0, v1, v2, v3) {\n this.vertices = [v0, v1, v2, v3];\n // Indicates which faces are shadowed\n this.faces = [true, false, false, true];\n\n this.draw = function() {\n // line(this.vertices[0][0], this.vertices[0][1], this.vertices[1][0], this.vertices[1][1]);\n // line(this.vertices[0][0], this.vertices[0][1], this.vertices[3][0], this.vertices[3][1]);\n }\n\n this.updateFaces = function() {\n // Check face 0\n if (mouseY < this.vertices[0][1]) {\n this.faces[0] = true;\n } else {\n this.faces[0] = false;\n }\n // Check face 1\n if (mouseX > this.vertices[1][0]) {\n this.faces[1] = true;\n } else {\n this.faces[1] = false;\n }\n // Check face 2\n if (mouseY > this.vertices[2][1]) {\n this.faces[2] = true;\n } else {\n this.faces[2] = false;\n }\n // Check face 3\n if (mouseX < this.vertices[0][0]) {\n this.faces[3] = true;\n } else {\n this.faces[3] = false;\n }\n }\n\n this.drawFaces = function() {\n if (this.faces[0]) {\n line(this.vertices[0][0], this.vertices[0][1], this.vertices[1][0], this.vertices[1][1]);\n }\n\n if (this.faces[1]) {\n line(this.vertices[1][0], this.vertices[1][1], this.vertices[2][0], this.vertices[2][1]);\n }\n\n if (this.faces[2]) {\n line(this.vertices[2][0], this.vertices[2][1], this.vertices[3][0], this.vertices[3][1]);\n }\n\n if (this.faces[3]) {\n line(this.vertices[0][0], this.vertices[0][1], this.vertices[3][0], this.vertices[3][1]);\n }\n }\n}", "function WireFrameCube(gl, color) {\n function defineVertices(gl) {\n // define the vertices of the cube\n var vertices = [\n // X, Y, Z R, G, B U, V,\n // bottom\n -0.5, 0.5, -0.5, /* V0 / 0 */ 1.0, 0.0, 0.0, 0.0, 1.0,\n -0.5, -0.5, -0.5, /* V1 / 1 */ 1.0, 0.0, 0.0, 1.0, 1.0,\n 0.5, -0.5, -0.5, /* V2 / 2 */ 1.0, 0.0, 0.0, 1.0, 0.0,\n 0.5, 0.5, -0.5, /* V3 / 3 */ 1.0, 0.0, 0.0, 0.0, 0.0,\n\n // top\n 0.5, 0.5, 0.5, /* V4 / 4 */ 0.0, 1.0, 0.0, 0.0, 1.0,\n -0.5, 0.5, 0.5, /* V5 / 5 */ 0.0, 1.0, 0.0, 1.0, 1.0,\n -0.5, -0.5, 0.5, /* V6 / 6 */ 0.0, 1.0, 0.0, 1.0, 0.0,\n 0.5, -0.5, 0.5, /* V7 / 7 */ 0.0, 1.0, 0.0, 0.0, 0.0,\n\n // front\n -0.5, -0.5, -0.5, /* V1 / 8 */ 0.0, 0.0, 1.0, 0.0, 1.0,\n 0.5, -0.5, -0.5, /* V2 / 9 */ 0.0, 0.0, 1.0, 1.0, 1.0,\n 0.5, -0.5, 0.5, /* V7 / 10 */ 0.0, 0.0, 1.0, 1.0, 0.0,\n -0.5, -0.5, 0.5, /* V6 / 11 */ 0.0, 0.0, 1.0, 0.0, 0.0,\n\n // back\n -0.5, 0.5, -0.5, /* V0 / 12 */ 1.0, 1.0, 0.0, 0.0, 1.0,\n 0.5, 0.5, -0.5, /* V3 / 13 */ 1.0, 1.0, 0.0, 1.0, 1.0,\n 0.5, 0.5, 0.5, /* V4 / 14 */ 1.0, 1.0, 0.0, 1.0, 0.0,\n -0.5, 0.5, 0.5, /* V5 / 15 */ 1.0, 1.0, 0.0, 0.0, 0.0,\n\n // left\n -0.5, 0.5, -0.5, /* V0 / 16 */ 1.0, 0.0, 1.0, 0.0, 1.0,\n -0.5, -0.5, -0.5, /* V1 / 17 */ 1.0, 0.0, 1.0, 1.0, 1.0,\n -0.5, -0.5, 0.5, /* V6 / 18 */ 1.0, 0.0, 1.0, 1.0, 0.0,\n -0.5, 0.5, 0.5, /* V5 / 19 */ 1.0, 0.0, 1.0, 0.0, 0.0,\n\n // right\n 0.5, -0.5, -0.5, /* V2 / 20 */ 0.0, 1.0, 1.0, 0.0, 1.0,\n 0.5, 0.5, -0.5, /* V3 / 21 */ 0.0, 1.0, 1.0, 1.0, 1.0,\n 0.5, 0.5, 0.5, /* V4 / 22 */ 0.0, 1.0, 1.0, 1.0, 0.0,\n 0.5, -0.5, 0.5, /* V7 / 23 */ 0.0, 1.0, 1.0, 0.0, 0.0,\n ];\n\n var buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);\n return buffer;\n }\n\n\n function defineEdges(gl) {\n // define the edges for the cube, there are 12 edges in a cube\n var vertexIndices = [\n // bottom\n 2, 1, 0,\n 0, 3, 2,\n\n // top\n 4, 5, 6,\n 6, 7, 4,\n\n // front\n 8, 9, 10,\n 10, 11, 8,\n\n // back\n 14, 13, 12,\n 12, 15, 14,\n\n // left\n 16, 17, 18,\n 18, 19, 16,\n\n // right\n 20, 21, 22,\n 22, 23, 20,\n ];\n var buffer = gl.createBuffer();\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(vertexIndices), gl.STATIC_DRAW);\n return buffer;\n }\n\n return {\n bufferVertices: defineVertices(gl),\n bufferEdges: defineEdges(gl),\n color: color,\n\n draw: function(gl, aVertexPositionId, aVertexColorId, aVertexTexCoordId) {\n gl.bindBuffer(gl.ARRAY_BUFFER, this.bufferVertices);\n gl.vertexAttribPointer(aVertexPositionId, 3, gl.FLOAT, false, 8 * Float32Array.BYTES_PER_ELEMENT, 0);\n gl.enableVertexAttribArray(aVertexPositionId);\n\n gl.vertexAttribPointer(aVertexColorId, 3, gl.FLOAT, false, 8 * Float32Array.BYTES_PER_ELEMENT, 3 * Float32Array.BYTES_PER_ELEMENT);\n gl.enableVertexAttribArray(aVertexColorId);\n\n gl.vertexAttribPointer(aVertexTexCoordId, 2, gl.FLOAT, false, 8 * Float32Array.BYTES_PER_ELEMENT, 6 * Float32Array.BYTES_PER_ELEMENT);\n gl.enableVertexAttribArray(aVertexTexCoordId);\n\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.bufferEdges);\n gl.drawElements(gl.TRIANGLES, 36 /* Anzahl Indices */ , gl.UNSIGNED_SHORT, 0);\n }\n }\n}", "function make( v1, v2, v3 ) {\n\n\t \t\tvar face = new Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );\n\t \t\tthat.faces.push( face );\n\n\t \t\tcentroid.copy( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );\n\n\t \t\tvar azi = azimuth( centroid );\n\n\t \t\tthat.faceVertexUvs[ 0 ].push( [\n\t \t\t\tcorrectUV( v1.uv, v1, azi ),\n\t \t\t\tcorrectUV( v2.uv, v2, azi ),\n\t \t\t\tcorrectUV( v3.uv, v3, azi )\n\t \t\t] );\n\n\t \t}", "function setupBuffers() {\r\n\r\n // Create a buffer for the cube's vertices.\r\n\r\n cubeVertexBuffer = gl.createBuffer();\r\n\r\n // Select the cubeVerticesBuffer as the one to apply vertex\r\n // operations to from here out.\r\n\r\n gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexBuffer);\r\n\r\n // Now create an array of vertices for the cube.\r\n\r\n var vertices = [\r\n // Front face\r\n -1.0, -1.0, 1.0,\r\n 1.0, -1.0, 1.0,\r\n 1.0, 1.0, 1.0,\r\n -1.0, 1.0, 1.0,\r\n\r\n // Back face\r\n -1.0, -1.0, -1.0,\r\n -1.0, 1.0, -1.0,\r\n 1.0, 1.0, -1.0,\r\n 1.0, -1.0, -1.0,\r\n\r\n // Top face\r\n -1.0, 1.0, -1.0,\r\n -1.0, 1.0, 1.0,\r\n 1.0, 1.0, 1.0,\r\n 1.0, 1.0, -1.0,\r\n\r\n // Bottom face\r\n -1.0, -1.0, -1.0,\r\n 1.0, -1.0, -1.0,\r\n 1.0, -1.0, 1.0,\r\n -1.0, -1.0, 1.0,\r\n\r\n // Right face\r\n 1.0, -1.0, -1.0,\r\n 1.0, 1.0, -1.0,\r\n 1.0, 1.0, 1.0,\r\n 1.0, -1.0, 1.0,\r\n\r\n // Left face\r\n -1.0, -1.0, -1.0,\r\n -1.0, -1.0, 1.0,\r\n -1.0, 1.0, 1.0,\r\n -1.0, 1.0, -1.0\r\n ];\r\n\r\n // Now pass the list of vertices into WebGL to build the shape. We\r\n // do this by creating a Float32Array from the JavaScript array,\r\n // then use it to fill the current vertex buffer.\r\n\r\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);\r\n\r\n // Map the texture onto the cube's faces.\r\n\r\n cubeTCoordBuffer = gl.createBuffer();\r\n gl.bindBuffer(gl.ARRAY_BUFFER, cubeTCoordBuffer);\r\n\r\n //need to change, coords are clockwise\r\n var textureCoordinates = [\r\n // Front\r\n //used\r\n -1.0, -1.0, 1.0,\r\n 1.0, -1.0, 1.0,\r\n 1.0, 1.0, 1.0,\r\n -1.0, 1.0, 1.0,\r\n\r\n // Back face\r\n -1.0, -1.0, -1.0,\r\n -1.0, 1.0, -1.0,\r\n 1.0, 1.0, -1.0,\r\n 1.0, -1.0, -1.0,\r\n\r\n // Top face\r\n -1.0, 1.0, -1.0,\r\n -1.0, 1.0, 1.0,\r\n 1.0, 1.0, 1.0,\r\n 1.0, 1.0, -1.0,\r\n\r\n // Bottom face\r\n -1.0, -1.0, -1.0,\r\n 1.0, -1.0, -1.0,\r\n 1.0, -1.0, 1.0,\r\n -1.0, -1.0, 1.0,\r\n\r\n // Right face\r\n 1.0, -1.0, -1.0,\r\n 1.0, 1.0, -1.0,\r\n 1.0, 1.0, 1.0,\r\n 1.0, -1.0, 1.0,\r\n\r\n // Left face\r\n -1.0, -1.0, -1.0,\r\n -1.0, -1.0, 1.0,\r\n -1.0, 1.0, 1.0,\r\n -1.0, 1.0, -1.0\r\n ];\r\n\r\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(textureCoordinates),\r\n gl.STATIC_DRAW);\r\n\r\n // Build the element array buffer; this specifies the indices\r\n // into the vertex array for each face's vertices.\r\n\r\n cubeTriIndexBuffer = gl.createBuffer();\r\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeTriIndexBuffer);\r\n\r\n // This array defines each face as two triangles, using the\r\n // indices into the vertex array to specify each triangle's\r\n // position.\r\n\r\n var cubeVertexIndices = [\r\n 0, 1, 2, 0, 2, 3, // front\r\n 4, 5, 6, 4, 6, 7, // back\r\n 8, 9, 10, 8, 10, 11, // top\r\n 12, 13, 14, 12, 14, 15, // bottom\r\n 16, 17, 18, 16, 18, 19, // right\r\n 20, 21, 22, 20, 22, 23 // left\r\n ]\r\n\r\n // Now send the element array to GL\r\n\r\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,\r\n new Uint16Array(cubeVertexIndices), gl.STATIC_DRAW);\r\n}", "function displayCube() {\n //Grab the canvas for the cube\n gl = canvas.getContext('experimental-webgl');\n\n /*=================== GEOMETRY =================== */\n\n var vertices = [\n //Cube (6 sides, each w/ 4 coordinates) #0-23\n -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1,\n -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1,\n -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1,\n 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1,\n -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1,\n -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1,\n\n //Axes (x, z, y) #24-29\n -1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, -1, 0, 1, 0, 0, -1, 0,\n\n //Important people scores - #30-31\n 0, 0, 0, //Hitler\n 0.5, 0, 0, //Stalin\n //Pol Pot\n //Marx\n //Lenin\n //Mussolini\n //Pinochet\n //Jefferson\n //Jackson\n //Hamilton\n //Robespierre\n //Mao\n //Gandhi\n //Bismarck\n //Hugo Chavez\n //Fidel Castro\n //Thatcher\n //Rand\n //Orwell\n //Putin\n //Milton Friedman\n //Adam Smith\n //FDR\n //JFK\n //Reagan\n //Ron Paul\n //Obama\n //Trump\n //Mugabe\n //Jinping\n //Corbyn\n //Sanders\n\n //Axis arrows #32-43\n -0.95, 0.05, 0, -0.95, -0.05, 0,\n 0.95, 0.05, 0, 0.95, -0.05, 0,\n 0, 0.05, -0.95, 0, -0.05, -0.95,\n 0, 0.05, 0.95, 0, -0.05, 0.95,\n 0.05, -0.95, 0, -0.05, -0.95, 0,\n 0.05, 0.95, 0, -0.05, 0.95, 0\n ];\n\n var colors = [\n //Cube\n 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,\n 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,\n 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,\n\n //Axes (Golden Yellow <-> Blue (X), Cyan <-> Red (Z), Pink <-> Green (Y))\n 1, 0.8745, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0,\n\n //Important people scores\n 0, 1, 0,\n 1, 1, 0,\n\n //Axis arrows\n 1, 0.8745, 0, 1, 0.8745, 0,\n 0, 0, 1, 0, 0, 1,\n 0, 1, 1, 0, 1, 1,\n 1, 0, 0, 1, 0, 0,\n 0, 1, 0, 0, 1, 0,\n 1, 0, 1, 1, 0, 1\n ];\n\n var indices = [\n //Cube\n 0, 1, 1, 2, 2, 3, 3, 0,\n 4, 5, 5, 6, 6, 7, 7, 4,\n 8, 9, 9, 10, 10, 11, 11, 8,\n 12, 13, 13, 14, 14, 15, 15, 12,\n 16, 17, 17, 18, 18, 19, 19, 16,\n\n //Axes\n 24, 25, 26, 27, 28, 29,\n\n //Axis arrows\n 24, 32, 24, 33,\n 25, 34, 25, 35,\n 27, 36, 27, 37,\n 26, 38, 26, 39,\n 29, 40, 29, 41,\n 28, 42, 28, 43\n ];\n\n // Create and store data into vertex buffer\n var vertex_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, vertex_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);\n\n // Create and store data into color buffer\n var color_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, color_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(colors), gl.STATIC_DRAW);\n\n // Create and store data into index buffer\n var index_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, index_buffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW);\n\n /*=================== SHADERS =================== */\n\n var vertCode = 'attribute vec3 position;' +\n 'uniform mat4 Pmatrix;' +\n 'uniform mat4 Vmatrix;' +\n 'uniform mat4 Mmatrix;' +\n 'attribute vec3 color;' + //Point color\n 'varying vec3 vColor;' +\n 'void main(void) { ' + //Pre-built function\n 'gl_Position = Pmatrix*Vmatrix*Mmatrix*vec4(position, .5);' +\n 'gl_PointSize = 16.0;' +\n 'vColor = color;' +\n '}';\n\n var fragCode = 'precision mediump float;' +\n 'varying vec3 vColor;' + //Circular point\n 'void main(void) {' +\n 'float r = 0.0, delta = 0.0, alpha = 1.0;' +\n 'vec2 cxy = 2.0 * gl_PointCoord - 1.0;' +\n 'r = dot(cxy, cxy);' +\n 'if (r > 1.0) {' +\n 'discard;' +\n '}' +\n 'gl_FragColor = vec4(vColor, 1);' +\n '}';\n\n var vertShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertShader, vertCode);\n gl.compileShader(vertShader);\n\n var fragShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragShader, fragCode);\n gl.compileShader(fragShader);\n\n var shaderprogram = gl.createProgram();\n gl.attachShader(shaderprogram, vertShader);\n gl.attachShader(shaderprogram, fragShader);\n gl.linkProgram(shaderprogram);\n\n /*======== Associating attributes to vertex shader =====*/\n var _Pmatrix = gl.getUniformLocation(shaderprogram, \"Pmatrix\");\n var _Vmatrix = gl.getUniformLocation(shaderprogram, \"Vmatrix\");\n var _Mmatrix = gl.getUniformLocation(shaderprogram, \"Mmatrix\");\n\n gl.bindBuffer(gl.ARRAY_BUFFER, vertex_buffer);\n var _position = gl.getAttribLocation(shaderprogram, \"position\");\n gl.vertexAttribPointer(_position, 3, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(_position);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, color_buffer);\n var _color = gl.getAttribLocation(shaderprogram, \"color\");\n gl.vertexAttribPointer(_color, 3, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(_color);\n gl.useProgram(shaderprogram);\n\n /*==================== MATRIX ====================== */\n\n function get_projection(angle, a, zMin, zMax) {\n var ang = Math.tan((angle * .5) * Math.PI / 180);\n return [\n 0.5 / ang, 0, 0, 0,\n 0, 0.5 * a / ang, 0, 0,\n 0, 0, -(zMax + zMin) / (zMax - zMin), -1,\n 0, 0, (-2 * zMax * zMin) / (zMax - zMin), 0\n ];\n }\n\n var proj_matrix = get_projection(40, canvas.width / canvas.height, 1, 100);\n var mo_matrix = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n var view_matrix = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n\n view_matrix[14] = view_matrix[14] - 6;\n\n /*================= Mouse events ======================*/\n\n var AMORTIZATION = 0.95;\n var drag = false;\n var old_x, old_y;\n var dX = 0, dY = 0;\n\n var mouseDown = function (e) {\n drag = true;\n old_x = e.pageX, old_y = e.pageY;\n e.preventDefault();\n return false;\n };\n\n var mouseUp = function (e) {\n drag = false;\n };\n\n var mouseMove = function (e) {\n if (!drag) return false;\n dX = (e.pageX - old_x) * 2 * Math.PI / canvas.width,\n dY = (e.pageY - old_y) * 2 * Math.PI / canvas.height;\n THETA += dX;\n PHI += dY;\n old_x = e.pageX, old_y = e.pageY;\n e.preventDefault();\n };\n\n canvas.addEventListener(\"mousedown\", mouseDown, false);\n canvas.addEventListener(\"mouseup\", mouseUp, false);\n canvas.addEventListener(\"mouseout\", mouseUp, false);\n canvas.addEventListener(\"mousemove\", mouseMove, false);\n\n /*=========================rotation================*/\n\n function rotateX(m, angle) {\n var c = Math.cos(angle);\n var s = Math.sin(angle);\n var mv1 = m[1], mv5 = m[5], mv9 = m[9];\n\n m[1] = m[1] * c - m[2] * s;\n m[5] = m[5] * c - m[6] * s;\n m[9] = m[9] * c - m[10] * s;\n\n m[2] = m[2] * c + mv1 * s;\n m[6] = m[6] * c + mv5 * s;\n m[10] = m[10] * c + mv9 * s;\n }\n\n function rotateY(m, angle) {\n var c = Math.cos(angle);\n var s = Math.sin(angle);\n var mv0 = m[0], mv4 = m[4], mv8 = m[8];\n\n m[0] = c * m[0] + s * m[2];\n m[4] = c * m[4] + s * m[6];\n m[8] = c * m[8] + s * m[10];\n\n m[2] = c * m[2] - s * mv0;\n m[6] = c * m[6] - s * mv4;\n m[10] = c * m[10] - s * mv8;\n }\n\n /*=================== Drawing =================== */\n\n var THETA = 0,\n PHI = 0;\n\n var animate = function (time) {\n\n if (!drag) {\n dX *= AMORTIZATION, dY *= AMORTIZATION;\n THETA += dX, PHI += dY;\n }\n\n //set model matrix to I4\n mo_matrix[0] = 1, mo_matrix[1] = 0, mo_matrix[2] = 0,\n mo_matrix[3] = 0,\n\n mo_matrix[4] = 0, mo_matrix[5] = 1, mo_matrix[6] = 0,\n mo_matrix[7] = 0,\n\n mo_matrix[8] = 0, mo_matrix[9] = 0, mo_matrix[10] = 1,\n mo_matrix[11] = 0,\n\n mo_matrix[12] = 0, mo_matrix[13] = 0, mo_matrix[14] = 0,\n mo_matrix[15] = 1;\n\n rotateY(mo_matrix, THETA);\n rotateX(mo_matrix, PHI);\n\n time_old = time;\n gl.enable(gl.DEPTH_TEST);\n\n gl.clearColor(0, 0, 0, 0);\n gl.clearDepth(1.0);\n gl.viewport(0, 0, canvas.width, canvas.height);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n gl.uniformMatrix4fv(_Pmatrix, false, proj_matrix);\n gl.uniformMatrix4fv(_Vmatrix, false, view_matrix);\n gl.uniformMatrix4fv(_Mmatrix, false, mo_matrix);\n\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, index_buffer);\n gl.drawElements(gl.LINES, indices.length, gl.UNSIGNED_SHORT, 0);\n\n //Show the scores for each important person\n gl.drawArrays(gl.POINTS, 30, 1);\n gl.drawArrays(gl.POINTS, 31, 1);\n\n window.requestAnimationFrame(animate);\n }\n animate(0);\n}", "function make( v1, v2, v3 ) {\n\n\t\tvar face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );\n\t\tface.centroid.add( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );\n\t\tthat.faces.push( face );\n\n\t\tvar azi = azimuth( face.centroid );\n\n\t\tthat.faceVertexUvs[ 0 ].push( [\n\t\t\tcorrectUV( v1.uv, v1, azi ),\n\t\t\tcorrectUV( v2.uv, v2, azi ),\n\t\t\tcorrectUV( v3.uv, v3, azi )\n\t\t] );\n\n\t}", "function drawCube() {\n setMV();\n Cube.draw();\n}", "function drawCube() {\n setMV();\n Cube.draw();\n}", "function loadTextures(){\n borderTexture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, borderTexture);\n\n let borderInfo= [\n {\n target: gl.TEXTURE_CUBE_MAP_POSITIVE_X,\n location: 'posx.png'\n },\n {\n target: gl.TEXTURE_CUBE_MAP_NEGATIVE_X,\n location: 'negx.png'\n },\n {\n target: gl.TEXTURE_CUBE_MAP_POSITIVE_Y,\n location: 'posy.png'\n },\n {\n target: gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,\n location: 'negy.png'\n },\n {\n target: gl.TEXTURE_CUBE_MAP_POSITIVE_Z,\n location: 'posz.png'\n },\n {\n target: gl.TEXTURE_CUBE_MAP_NEGATIVE_Z,\n location: 'negz.png'\n }\n ]\n borderInfo.forEach((face) => {\n let {target, location} = face\n gl.texImage2D(target, 0, gl.RGBA, 2048, 2048, 0, gl.RGBA, gl.UNSIGNED_BYTE, null)\n let image = new Image()\n image.src = location\n image.addEventListener('load', function() {\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, borderTexture)\n gl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image)\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP)\n })\n });\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP)\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR)\n}", "function addFlatCube(obj, x, y, z, s) {\n 'use strict';\n\n geometry = new THREE.CubeGeometry(3 * s, 3 * s, 0.5);\n mesh= new THREE.Mesh(geometry, material);\n\n mesh.position.set(x, y, z);\n obj.add(mesh);\n}", "function make( v1, v2, v3 ) {\n\n\t\tvar face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );\n\t\tthat.faces.push( face );\n\n\t\tcentroid.copy( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );\n\n\t\tvar azi = azimuth( centroid );\n\n\t\tthat.faceVertexUvs[ 0 ].push( [\n\t\t\tcorrectUV( v1.uv, v1, azi ),\n\t\t\tcorrectUV( v2.uv, v2, azi ),\n\t\t\tcorrectUV( v3.uv, v3, azi )\n\t\t] );\n\n\t}", "function make( v1, v2, v3 ) {\n\n\t\tvar face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );\n\t\tthat.faces.push( face );\n\n\t\tcentroid.copy( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );\n\n\t\tvar azi = azimuth( centroid );\n\n\t\tthat.faceVertexUvs[ 0 ].push( [\n\t\t\tcorrectUV( v1.uv, v1, azi ),\n\t\t\tcorrectUV( v2.uv, v2, azi ),\n\t\t\tcorrectUV( v3.uv, v3, azi )\n\t\t] );\n\n\t}", "function make( v1, v2, v3 ) {\n\n\t\tvar face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );\n\t\tthat.faces.push( face );\n\n\t\tcentroid.copy( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );\n\n\t\tvar azi = azimuth( centroid );\n\n\t\tthat.faceVertexUvs[ 0 ].push( [\n\t\t\tcorrectUV( v1.uv, v1, azi ),\n\t\t\tcorrectUV( v2.uv, v2, azi ),\n\t\t\tcorrectUV( v3.uv, v3, azi )\n\t\t] );\n\n\t}", "function skybox(){\r\n\tvar materialArray = [];\r\n\tmaterialArray.push(new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'img/sky2/nebula_px.jpg' ) }));\r\n\tmaterialArray.push(new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'img/sky2/nebula_nx.jpg' ) }));\r\n\tmaterialArray.push(new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'img/sky2/nebula_py.jpg' ) }));\r\n\tmaterialArray.push(new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'img/sky2/nebula_ny.jpg' ) }));\r\n\tmaterialArray.push(new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'img/sky2/nebula_pz.jpg' ) }));\r\n\tmaterialArray.push(new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'img/sky2/nebula_nz.jpg' ) }));\r\n\r\n\tfor (var i = 0; i < 6; i++) \r\n\t materialArray[i].side = THREE.BackSide;\r\n\r\n\tvar skyboxMaterial = new THREE.MeshFaceMaterial( materialArray );\r\n\tvar skyboxGeom = new THREE.CubeGeometry( 500, 500, 500);\r\n\tvar skybox = new THREE.Mesh( skyboxGeom, skyboxMaterial );\r\n\tscene.add( skybox );\r\n}", "function generateCube() {\n var geometry = new THREE.CubeGeometry(100, 100, 100);\n\n this.addGeometry(geometry);\n _camera.position.z = 500;\n\n return this;\n }", "worldFaces() {\n return this.baseMesh.geometry.faces;\n }", "function initCubeVertexBuffers(gl) {\r\n // Create a cube\r\n // Size: 1 by 1 by 1\r\n // v6----- v5\r\n // /| /|\r\n // v1------v0|\r\n // | | | |\r\n // | |v7---|-|v4\r\n // |/ |/\r\n // v2------v3\r\n var vertices = new Float32Array([\r\n // Coordinates\r\n 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, // v0-v1-v2-v3 front\r\n 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, // v0-v3-v4-v5 right\r\n 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, // v0-v5-v6-v1 up\r\n -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, // v1-v6-v7-v2 left\r\n -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, // v7-v4-v3-v2 down\r\n 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5 // v4-v7-v6-v5 back\r\n ]);\r\n\r\n var normals = new Float32Array([\r\n // Normal\r\n 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, // v0-v1-v2-v3 front\r\n 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, // v0-v3-v4-v5 right\r\n 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, // v0-v5-v6-v1 up\r\n -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, // v1-v6-v7-v2 left\r\n 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, // v7-v4-v3-v2 down\r\n 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0 // v4-v7-v6-v5 back\r\n ]);\r\n\r\n\r\n // Indices of the vertices\r\n var indices = new Uint8Array([\r\n // Indices\r\n 0, 1, 2, 0, 2, 3, // front\r\n 4, 5, 6, 4, 6, 7, // right\r\n 8, 9, 10, 8, 10, 11, // up\r\n 12, 13, 14, 12, 14, 15, // left\r\n 16, 17, 18, 16, 18, 19, // down\r\n 20, 21, 22, 20, 22, 23 // back\r\n ]);\r\n\r\n\r\n // Write the vertex property to buffers (coordinates, colors and normals)\r\n if (!initArrayBuffer(gl, 'a_Position', vertices, 3, gl.FLOAT)) return -1;\r\n if (!initArrayBuffer(gl, 'a_Normal', normals, 3, gl.FLOAT)) return -1;\r\n\r\n // Write the indices to the buffer object\r\n var indexBuffer = gl.createBuffer();\r\n if (!indexBuffer) {\r\n console.log('Failed to create the buffer object');\r\n return false;\r\n }\r\n\r\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);\r\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW);\r\n\r\n return indices.length;\r\n}", "function createTwoCubes() {\n // create a cube using coordinates\n var mesh = new Mesh3D();\n mesh.quad([0, 0, 0], [0, 10, 0], [10, 10, 0], [10, 0, 0]);\n mesh.quad([0, 0, 0], [10, 0, 0], [10, 0, 10], [0, 0, 10]);\n mesh.quad([10, 0, 0], [10, 10, 0], [10, 10, 10], [10, 0, 10]);\n mesh.quad([0, 0, 0], [0, 0, 10], [0, 10, 10], [0, 10, 0]);\n mesh.quad([0, 10, 0], [0, 10, 10], [10, 10, 10], [10, 10, 0]);\n mesh.quad([0, 0, 10], [10, 0, 10], [10, 10, 10], [0, 10, 10]);\n // another cube\n mesh.quad([20, 20, 20], [20, 30, 20], [30, 30, 20], [30, 20, 20]);\n mesh.quad([20, 20, 20], [30, 20, 20], [30, 20, 30], [20, 20, 30]);\n mesh.quad([30, 20, 20], [30, 30, 20], [30, 30, 30], [30, 20, 30]);\n mesh.quad([20, 20, 20], [20, 20, 30], [20, 30, 30], [20, 30, 20]);\n mesh.quad([20, 30, 20], [20, 30, 30], [30, 30, 30], [30, 30, 20]);\n mesh.quad([20, 20, 30], [30, 20, 30], [30, 30, 30], [20, 30, 30]);\n // return both of the cubes in one mesh\n return mesh;\n}", "function inHypercube(p)\n{\n\tconst HWIDE=2; // these are half dimensions\n\tconst HTHICK=.3;\n\tvar in0,in1;\n\tfor(in0=0;in0<3;in0++) //first coord can't be 3\n\t\tfor(in1=in0+1;in1<4;in1++) //2d coord after 1st\n\t\t{\n\t\t\tif\n\t\t\t(\n\t\t\t\t (Math.abs(coord(in0,p))<HWIDE)\n\t\t\t\t&&(Math.abs(coord(in1,p))<HWIDE)\n\t\t\t\t&&(Math.abs(Math.abs(coord(out0(in0,in1),p))-HWIDE)<HTHICK)\n\t\t\t\t&&(Math.abs(Math.abs(coord(out1(in0,in1),p))-HWIDE)<HTHICK)\n\t\t\t)\n\t\t\t{\n\t\t\t\tcolor=faceColor(in0,in1); //this colors 4 faces the same\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n}", "function createCubie(x, y, z) {\n\tlet colors = new Array(6)\n\tif(x == 1) {\n\t\tcolors[0] = c[cube_state[28 - y + 12*z]]\n\t\tcolors[1] = black\n\t} else if(x == -1) {\n\t\tcolors[0] = black\n\t\tcolors[1] = c[cube_state[22 + y + 12*z]]\n\t} else {\n\t\tcolors[0] = black\n\t\tcolors[1] = black\n\t}\n\n\tif(y == 1) {\n\t\tcolors[2] = c[cube_state[25 + x + 12*z]]\n\t\tcolors[3] = black\n\t} else if(y == -1) {\n\t\tcolors[2] = black\n\t\tcolors[3] = c[cube_state[31 - x + 12*z]]\n\t} else {\n\t\tcolors[2] = black\n\t\tcolors[3] = black\n\t}\n\n\tif(z == 1) {\n\t\tcolors[4] = c[cube_state[49 + x - 3*y]]\n\t\tcolors[5] = black\n\t} else if(z == -1) {\n\t\tcolors[4] = black\n\t\tcolors[5] = c[cube_state[4 + x + 3*y]]\n\t} else {\n\t\tcolors[4] = black\n\t\tcolors[5] = black\n\t}\n\tlet cube = createCube(colors)\n\tcube.position.x = x\n\tcube.position.y = y\n\tcube.position.z = z\n}", "function handleTextureLoaded(image, face) {\n\n // CODE GOES HERE\n texturesLoaded++;\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, SkyboxMap);\n\n if (face == 0) {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);\n } else if (face == 1) {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);\n } else if (face == 2) {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);\n } else if (face == 3) {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);\n } else if (face == 4) {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);\n } else if (face == 5) {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n }", "function initBuffers() {\n\n // Create a buffer for the cube's vertices.\n cubeVertexPositionBuffer = gl.createBuffer();\n \n // Select the cubeVertexPositionBuffer as the one to apply vertex\n // operations to from here out.\n gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer);\n \n // Now create an array of vertices for the cube.\n vertices = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0\n ];\n \n // Now pass the list of vertices into WebGL to build the shape. We\n // do this by creating a Float32Array from the JavaScript array,\n // then use it to fill the current vertex buffer.\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);\n cubeVertexPositionBuffer.itemSize = 3;\n cubeVertexPositionBuffer.numItems = 24;\n\n // Map the texture onto the cube's faces.\n cubeVertexTextureCoordBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexTextureCoordBuffer);\n \n // Now create an array of vertex texture coordinates for the cube.\n var textureCoordinates = [\n // Front\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // Back\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n 0.0, 0.0,\n // Top\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // Bottom\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // Right\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n 0.0, 0.0,\n // Left\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0\n ];\n\n // Pass the texture coordinates into WebGL\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(textureCoordinates), gl.STATIC_DRAW);\n cubeVertexTextureCoordBuffer.itemSize = 2;\n cubeVertexTextureCoordBuffer.numItems = 24;\n\n // Build the element array buffer; this specifies the indices\n // into the vertex array for each face's vertices.\n cubeVertexIndexBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer);\n \n // This array defines each face as two triangles, using the\n // indices into the vertex array to specify each triangle's\n // position.\n var cubeVertexIndices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23 // left\n ];\n \n // Now send the element array to GL\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(cubeVertexIndices), gl.STATIC_DRAW);\n cubeVertexIndexBuffer.itemSize = 1;\n cubeVertexIndexBuffer.numItems = 36;\n}", "getClosetFaces() { return this.faces; }", "function fillcubeStates() {\n for (i = -1; i < 2; i++) {\n for (j = -1; j < 2; j++) {\n for (k = -1; k < 2; k++) {\n cubeState[i+1][j+1][k+1][0] = i; // x Position\n cubeState[i+1][j+1][k+1][1] = j; // y Position\n cubeState[i+1][j+1][k+1][2] = k; // z Position\n cubeState[i+1][j+1][k+1][3] = [vec3(-1,0,0),vec3(0,-1,0),vec3(0,0,-1)]; // Cube reference Axis\n cubeState[i+1][j+1][k+1][4] = mat4(); // Cube rotation matrix\n }\n }\n }\n}", "function CubeShape()\n\t{\n\t\tmxCylinder.call(this);\n\t}", "setFaceColor(colorFunction) {\n this.checkVertices();\n let colors = [],\n vert = this.verts;\n for (let i = 0; i < vert.length; i += 9) {\n let x = (vert[i] + vert[i + 3] + vert[i + 6]) / 3;\n let y = (vert[i + 1] + vert[i + 4] + vert[i + 7]) / 3;\n let z = (vert[i + 2] + vert[i + 5] + vert[i + 8]) / 3;\n let color = colorFunction(x, y, z);\n for (let j = 0; j < 3; j++) {\n colors.push(color.r);\n colors.push(color.g);\n colors.push(color.b);\n }\n }\n this.colors = colors;\n }", "function cubeAndArrow(x,y,z,color,color1,innerArr1 = true,innerArr2 = true,innerArr3 = true,innerArr4 = true,innerArr5 = true,innerArr6 = true){\r\n\r\n Cubes = []\r\n cube = new Cube(x,y,z,0.5,0.5,0.5);\r\n Cubes.push(cube.gObject(color1, white , 0.8));\r\n\r\n if (innerArr1){\r\n if (x>0){\r\n arr1 = new Line([[x-0.5,y+0.2,z],[x-1,y+0.2,z]]);\r\n arr11 = new Line([[x+0.5,y+0.2,z],[x-1,y+0.2,z]]);\r\n Cubes.push(arr1.gObject(color, 3));\r\n Cubes.push(arr11.arrowHead(color,3));\r\n }else{\r\n arr1 = new Line([[x-0.5,y,z],[x-1,y,z]]);\r\n arr11 = new Line([[x+0.5,y,z],[x-1,y,z]]);\r\n Cubes.push(arr1.gObject(color, 3));\r\n Cubes.push(arr11.arrowHead(color,3));\r\n }\r\n }else{\r\n arr1 = new Line([[0,0,0],[0,0,0]]);\r\n arr11 = new Line([[0,0,0],[0,0,0]]);\r\n Cubes.push(arr1.gObject(color, 0));\r\n Cubes.push(arr11.arrowHead(color,0));\r\n }\r\n\r\n if (innerArr2){\r\n if (x<0){\r\n arr2 = new Line([[x+0.5,y+0.2,z],[x+1,y+0.2,z]]);\r\n arr22 = new Line([[x-0.5,y+0.2,z],[x+1,y+0.2,z]]);\r\n Cubes.push(arr2.gObject(color, 3));\r\n Cubes.push(arr22.arrowHead(color,3));\r\n }else{\r\n arr2 = new Line([[x+0.5,y,z],[x+1,y,z]]);\r\n arr22 = new Line([[x-0.5,y,z],[x+1,y,z]]);\r\n Cubes.push(arr2.gObject(color, 3));\r\n Cubes.push(arr22.arrowHead(color,3));\r\n }\r\n }else{\r\n arr2 = new Line([[0,0,0],[0,0,0]]);\r\n arr22 = new Line([[0,0,0],[0,0,0]]);\r\n Cubes.push(arr2.gObject(color, 0));\r\n Cubes.push(arr22.arrowHead(color,0));\r\n }\r\n\r\n if (innerArr3){\r\n if (y>0){\r\n arr3 = new Line([[x,y-0.5,z+0.2],[x,y-1,z+0.2]]);\r\n arr33 = new Line([[x,y+0.5,z+0.2],[x,y-1,z+0.2]]);\r\n Cubes.push(arr3.gObject(color, 3));\r\n Cubes.push(arr33.arrowHead(color,3));\r\n }else{\r\n arr3 = new Line([[x,y-0.5,z],[x,y-1,z]]);\r\n arr33 = new Line([[x,y+0.5,z],[x,y-1,z]]);\r\n Cubes.push(arr3.gObject(color, 3));\r\n Cubes.push(arr33.arrowHead(color,3));\r\n }\r\n }else{\r\n arr3 = new Line([[0,0,0],[0,0,0]]);\r\n arr33 = new Line([[0,0,0],[0,0,0]]);\r\n Cubes.push(arr3.gObject(color, 0));\r\n Cubes.push(arr33.arrowHead(color,0));\r\n }\r\n\r\n if (innerArr4){\r\n if (y<0){\r\n arr4 = new Line([[x,y+0.5,z+0.2],[x,y+1,z+0.2]]);\r\n arr44 = new Line([[x,y-0.5,z+0.2],[x,y+1,z+0.2]]);\r\n Cubes.push(arr4.gObject(color, 3));\r\n Cubes.push(arr44.arrowHead(color,3));\r\n }else{\r\n arr4 = new Line([[x,y+0.5,z],[x,y+1,z]]);\r\n arr44 = new Line([[x,y-0.5,z],[x,y+1,z]]);\r\n Cubes.push(arr4.gObject(color, 3));\r\n Cubes.push(arr44.arrowHead(color,3));\r\n }\r\n }else{\r\n arr4 = new Line([[0,0,0],[0,0,0]]);\r\n arr44 = new Line([[0,0,0],[0,0,0]]);\r\n Cubes.push(arr4.gObject(color, 0));\r\n Cubes.push(arr44.arrowHead(color,0));\r\n }\r\n\r\n if (innerArr5){\r\n if (z>0){\r\n arr5 = new Line([[x+0.2,y,z-0.5],[x+0.2,y,z-1]]);\r\n arr55 = new Line([[x+0.2,y,z+0.5],[x+0.2,y,z-1]]);\r\n Cubes.push(arr5.gObject(color, 3));\r\n Cubes.push(arr55.arrowHead(color,3));\r\n }else{\r\n arr5 = new Line([[x,y,z-0.5],[x,y,z-1]]);\r\n arr55 = new Line([[x,y,z+0.5],[x,y,z-1]]);\r\n Cubes.push(arr5.gObject(color, 3));\r\n Cubes.push(arr55.arrowHead(color,3));\r\n }\r\n }else{\r\n arr5 = new Line([[0,0,0],[0,0,0]]);\r\n arr55 = new Line([[0,0,0],[0,0,0]]);\r\n Cubes.push(arr5.gObject(color, 0));\r\n Cubes.push(arr55.arrowHead(color,0));\r\n }\r\n\r\n\r\n if (innerArr6){\r\n if (z<0){\r\n arr6 = new Line([[x+0.2,y,z+0.5],[x+0.2,y,z+1]]);\r\n arr66 = new Line([[x+0.2,y,z-0.5],[x+0.2,y,z+1]]);\r\n Cubes.push(arr6.gObject(color, 3));\r\n Cubes.push(arr66.arrowHead(color,3));\r\n }else{\r\n arr6 = new Line([[x,y,z+0.5],[x,y,z+1]]);\r\n arr66 = new Line([[x,y,z-0.5],[x,y,z+1]]);\r\n Cubes.push(arr6.gObject(color, 3));\r\n Cubes.push(arr66.arrowHead(color,3));\r\n }\r\n }else{\r\n arr6 = new Line([[0,0,0],[0,0,0]]);\r\n arr66 = new Line([[0,0,0],[0,0,0]]);\r\n Cubes.push(arr6.gObject(color, 0));\r\n Cubes.push(arr66.arrowHead(color,0));\r\n }\r\n\r\n return Cubes;\r\n\r\n}", "function initCubeBorders(){\n\tvar border1 = cubeModel([0,0,0,1]);\n\tborder1.scale(0.01, 0.77, 0.77);\n\tborder1.translate(0.77/6,0.0,0.0);\n\tpoints = points.concat(border1.points);\n\tcolors = colors.concat(border1.colors);\n\tborders.push(border1);\n\t\n\tvar border2 = cubeModel([0,0,0,1]);\n\tborder2.scale(0.01, 0.77, 0.77);\n\tborder2.translate(-0.77/6,0.0,0.0);\n\tpoints = points.concat(border2.points);\n\tcolors = colors.concat(border2.colors);\n\tborders.push(border2);\n\t\n\tvar border3 = cubeModel([0,0,0,1]);\n\tborder3.scale(0.77, 0.01, 0.77);\n\tborder3.translate(0.0,0.77/6,0.0);\n\tpoints = points.concat(border3.points);\n\tcolors = colors.concat(border3.colors);\n\tborders.push(border3);\n\t\n\tvar border4 = cubeModel([0,0,0,1]);\n\tborder4.scale(0.77, 0.01, 0.77);\n\tborder4.translate(0.0,-0.77/6,0.0);\n\tpoints = points.concat(border4.points);\n\tcolors = colors.concat(border4.colors);\n\tborders.push(border4);\n\t\n\tvar border5 = cubeModel([0,0,0,1]);\n\tborder5.scale(0.77, 0.77, 0.01);\n\tborder5.translate(0.0,0.0,0.77/6);\n\tpoints = points.concat(border5.points);\n\tcolors = colors.concat(border5.colors);\n\tborders.push(border5);\n\n\tvar border6 = cubeModel([0,0,0,1]);\n\tborder6.scale(0.77, 0.77, 0.01);\n\tborder6.translate(0.0,0.0,-0.77/6);\n\tpoints = points.concat(border6.points);\n\tcolors = colors.concat(border6.colors);\n\tborders.push(border6);\n}", "function makeCube() {\r\n const positionArray = new Float32Array([\r\n -1, -1, 1,\r\n 1, 1, 1,\r\n 1, -1, 1,\r\n 1, 1, 1,\r\n -1, -1, 1,\r\n -1, 1, 1,\r\n\r\n -1, -1, -1,\r\n 1, -1, -1,\r\n 1, 1, -1,\r\n 1, 1, -1,\r\n -1, 1, -1,\r\n -1, -1, -1,\r\n\r\n -1, 1, -1,\r\n 1, 1, 1,\r\n -1, 1, 1,\r\n 1, 1, 1,\r\n -1, 1, -1,\r\n 1, 1, -1,\r\n\r\n -1, -1, -1,\r\n -1, -1, 1,\r\n 1, -1, 1,\r\n 1, -1, 1,\r\n 1, -1, -1,\r\n -1, -1, -1,\r\n\r\n 1, -1, -1,\r\n 1, 1, 1,\r\n 1, 1, -1,\r\n 1, 1, 1,\r\n 1, -1, -1,\r\n 1, -1, 1,\r\n\r\n -1, -1, -1,\r\n -1, 1, -1,\r\n -1, 1, 1,\r\n -1, 1, 1,\r\n -1, -1, 1,\r\n -1, -1, -1,\r\n ]);\r\n const normalArray = positionArrayToNormalArray(positionArray);\r\n return [positionArray, normalArray];\r\n}", "setFaceColor( face, RGB) {\n\t\t// debug\n\t\t//console.log(\"atomicGLSphere(\"+this.name+\")::setFaceColor\");\n\t\tvar r = RGB[0];\n\t\tvar g = RGB[1];\n\t\tvar b = RGB[2];\n\n\t\t// switch face\n\t\tswitch(face){\n\t\t\tcase \"All\":\n\t\t\t\tthis.colorsArray = [];\n\t\t\t\tfor (var latNumber=0; latNumber <= this.latitudeBands; latNumber++) {\n \t\tfor (var longNumber = 0; longNumber <= this.longitudeBands; longNumber++) {\n \t\t// color\n \t\tthis.colorsArray.push(r);\n \t\tthis.colorsArray.push(g);\n \t\tthis.colorsArray.push(b);\n \t\t}\n \t\t}\n\t\t\tbreak;\n\t\t}\n\t}", "function CubeSea( texture, gridSize, cubeSize, lit, merge ) {\n var sea = new THREE.Object3D();\n\n sea.update = function() {};\n\n new THREE.TextureLoader().load( texture, function( map ){\n\n var _geo = new THREE.Geometry();\n var geo = new THREE.BoxGeometry( cubeSize, cubeSize, cubeSize );\n var mat = new (lit ? THREE.MeshLambertMaterial : THREE.MeshBasicMaterial)({\n map: map\n });\n if (!merge) {\n var _cube = new THREE.Mesh( geo, mat );\n } else {\n var matrix = new THREE.Matrix4();\n }\n\n for ( var x = 0; x < gridSize; ++x ) {\n for ( var y = 0; y < gridSize; ++y ) {\n for ( var z = 0; z < gridSize; ++z ) {\n var position = new THREE.Vector3( x - gridSize/2, y - gridSize/2, z - gridSize/2 );\n if ( position.x == 0 && position.y == 0 && position.z == 0 )\n continue;\n\n if (!merge) {\n var cube = _cube.clone();\n cube.position.copy( position );\n sea.add( cube );\n } else {\n _geo.merge( geo, matrix.makeTranslation( position.x, position.y, position.z ) );\n }\n }\n }\n }\n\n if (merge) {\n var _cubes = new THREE.Mesh( _geo, mat );\n sea.add( _cubes );\n }\n\n var size = 0.05;\n var geo = new THREE.BoxGeometry( size*2, size*2, size*2 );\n\n var rCube = new THREE.Mesh( geo, mat );\n\n var rotatingCubes = new THREE.Group();\n rotatingCubes.name = 'rotatingCubes';\n var positions = [ [0, 0.25, -0.8], [0.8, 0.25, 0], [0, 0.25, 0.8], [-0.8, 0.25, 0] ];\n for (var i = 0; i < positions.length; i++) {\n var _rCube = rCube.clone();\n _rCube.position.fromArray( positions[i] );\n rotatingCubes.add( _rCube );\n }\n\n sea.add( rotatingCubes );\n\n sea.update = function( timestamp ) {\n rotatingCubes.rotation.y = timestamp / 2000;\n };\n\n });\n\n return sea;\n\n}", "function setupShadersCube() {\r\n vertexShader = loadShaderFromDOM(\"shader-vs-cube\");\r\n fragmentShader = loadShaderFromDOM(\"shader-fs-cube\");\r\n \r\n shaderProgramCube = gl.createProgram();\r\n gl.attachShader(shaderProgramCube, vertexShader);\r\n gl.attachShader(shaderProgramCube, fragmentShader);\r\n gl.linkProgram(shaderProgramCube);\r\n\r\n if (!gl.getProgramParameter(shaderProgramCube, gl.LINK_STATUS)) {\r\n alert(\"Failed to cube setup shaders\");\r\n }\r\n\r\n gl.useProgram(shaderProgramCube);\r\n\r\n shaderProgramCube.vertexPositionAttribute = gl.getAttribLocation(shaderProgramCube, \"aVertexPosition\");\r\n gl.enableVertexAttribArray(shaderProgramCube.vertexPositionAttribute);\r\n\r\n shaderProgramCube.vertexNormalAttribute = gl.getAttribLocation(shaderProgramCube, \"aVertexNormal\");\r\n gl.enableVertexAttribArray(shaderProgramCube.vertexNormalAttribute);\r\n\r\n shaderProgramCube.mvMatrixUniform = gl.getUniformLocation(shaderProgramCube, \"uMVMatrix\");\r\n shaderProgramCube.pMatrixUniform = gl.getUniformLocation(shaderProgramCube, \"uPMatrix\");\r\n shaderProgramCube.nMatrixUniform = gl.getUniformLocation(shaderProgramCube, \"uNMatrix\");\r\n\r\n console.log(\"Cube shaders succesfully set up.\");\r\n}", "function colorCube(r, loc) {\n\n // First capture the index number of the first\n // vertex of our object\n v0 = vertices.length;\n console.log(\"Cube starting at vertex\", v0);\n\n // These are the vertices and colors of the cube.\n var cubevertices = [\n vec4( -0.5, -0.5, 0.5, 1.0 ),\n vec4( -0.5, 0.5, 0.5, 1.0 ),\n vec4( 0.5, 0.5, 0.5, 1.0 ),\n vec4( 0.5, -0.5, 0.5, 1.0 ),\n vec4( -0.5, -0.5, -0.5, 1.0 ),\n vec4( -0.5, 0.5, -0.5, 1.0 ),\n vec4( 0.5, 0.5, -0.5, 1.0 ),\n vec4( 0.5, -0.5, -0.5, 1.0 )\n ];\n\n var cubecolors = [\n vec4( 0.0, 0.0, 0.0, 1.0 ), // black\n vec4( 1.0, 0.0, 0.0, 1.0 ), // red\n vec4( 1.0, 1.0, 0.0, 1.0 ), // yellow\n vec4( 0.0, 1.0, 0.0, 1.0 ), // green\n vec4( 0.0, 0.0, 1.0, 1.0 ), // blue\n vec4( 1.0, 0.0, 1.0, 1.0 ), // magenta\n vec4( 0.5, 0.5, 0.5, 1.0 ), // gray\n vec4( 0.0, 1.0, 1.0, 1.0 ) // cyan\n ];\n\n\n // Next push all the vertices and colors \n // into the global arrays. Scale and translate\n // \n var v;\n for (var idx = 0; idx < cubevertices.length; idx++) { \n v = []\n for (var i = 0; i<3; i++) {\n v.push(r*cubevertices[idx][i] + loc[i]);\n }\n v.push(1.0);\n vertices.push(v);\n vertexColors.push(cubecolors[idx]);\n }\n\n // Now draw quads for all 6 surfaces\n // These index numbers will be relative to v0,\n // the first virtex number for this object.\n //\n quad( 1, 0, 3, 2 ); // front\n quad( 2, 3, 7, 6 ); // right\n quad( 3, 0, 4, 7 ); // bottom\n quad( 6, 5, 1, 2 ); // top\n quad( 4, 5, 6, 7 ); // back\n quad( 5, 4, 0, 1 ); // left \n}", "function cube() {\n\n}", "function initFaces(){\n\tf = [];\n\tfor (var o=0; o<faceObject.length; o+=1){\n\t\tfor (var i=0; i<faceObject[o].length; i+=1){\n\t\t\tf.push(faceObject[o][i]);\n\t\t}\n\t}\n}", "function makeCube (subdivisions) {\n \n // fill in your code here.\n // delete the code below first.\n\n\t//// Old code\n //addTriangle (-0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5);\n\n\t// var A = [-0.5, 0.5, 0.5];\n\t// var B = [ 0.5, 0.5, 0.5];\n\t// var C = [-0.5, -0.5, 0.5];\n\t// var D = [ 0.5, -0.5, 0.5];\n\t// var E = [-0.5, 0.5, -0.5];\n\t// var F = [ 0.5, 0.5, -0.5];\n\t// var G = [-0.5, -0.5, -0.5];\n\t// var H = [ 0.5, -0.5, -0.5];\n\n\t// var triangles = [\n\t// \t[A, C, B],\n\t// \t[B, C, D],\n\t// \t[E, A, F],\n\t// \t[F, A, B],\n\t// \t[E, G, A],\n\t// \t[A, G, C],\n\t// \t[B, D, F],\n\t// \t[F, D, H],\n\t// \t[F, H, E],\n\t// \t[E, H, G],\n\t// \t[H, D, G],\n\t// \t[G, D, C]\n\n\t// ];\n\n\t// // while subdivision is not finished , generate more triangles from last triangles array\n\t// while (subdivisions > 0){\n\t// \ttri_num = triangles.length;\n\t// \tfor(var i=0; i<tri_num; i++){\n\t// \t\tvar this_tri = triangles.shift();\n\t// \t\tvar m1 = [\n\t// \t\t\t(this_tri[0][0] + this_tri[1][0]) / 2,\n\t// \t\t\t(this_tri[0][1] + this_tri[1][1]) / 2,\n\t// \t\t\t(this_tri[0][2] + this_tri[1][2]) / 2\n\t// \t\t];\n\t// \t\tvar m2 = [\n\t// \t\t\t(this_tri[0][0] + this_tri[2][0]) / 2,\n\t// \t\t\t(this_tri[0][1] + this_tri[2][1]) / 2,\n\t// \t\t\t(this_tri[0][2] + this_tri[2][2]) / 2\n\t// \t\t];\n\t// \t\tvar m3 = [\n\t// \t\t\t(this_tri[1][0] + this_tri[2][0]) / 2,\n\t// \t\t\t(this_tri[1][1] + this_tri[2][1]) / 2,\n\t// \t\t\t(this_tri[1][2] + this_tri[2][2]) / 2\n\t// \t\t];\n\t// \t\tvar v0 = this_tri[0];\n\t// \t\tvar v1 = this_tri[1];\n\t// \t\tvar v2 = this_tri[2];\n\n\t// \t\ttriangles.push([v0, m1, m2]);\n\t// \t\ttriangles.push([m2, m1, m3]);\n\t// \t\ttriangles.push([m1, v1, m3]);\n\t// \t\ttriangles.push([m2, m3, v2]);\n\t// \t}\n\n\t// \tsubdivisions --;\n\n\t// }\n\t//// Old code\n\n\tvar triangles = [];\n\tconst step = 1 / subdivisions;\n\n\t// Front\n\tfor(var i=0; i<subdivisions; i++){\n\t\tfor(var j=0;j<subdivisions;j++){\n\t\t\tvar v0 = [-0.5 + i*step, -0.5 + j*step, 0.5];\n\t\t\tvar v1 = [-0.5 + (i+1)*step, -0.5 + j*step, 0.5];\n\t\t\tvar v2 = [-0.5 + i*step, -0.5 + (j+1)*step, 0.5];\n\t\t\tvar v3 = [-0.5 + (i+1)*step, -0.5 + (j+1)*step, 0.5];\n\n\t\t\ttriangles.push([v0, v3, v2]);\n\t\t\ttriangles.push([v0, v1, v3]);\n\t\t}\n\t}\n\n\t// Left\n\tfor(var i=0; i<subdivisions; i++){\n\t\tfor(var j=0;j<subdivisions;j++){\n\t\t\tvar v0 = [-0.5, -0.5+i*step, -0.5+j*step];\n\t\t\tvar v1 = [-0.5, -0.5+(i+1)*step, -0.5+j*step];\n\t\t\tvar v2 = [-0.5, -0.5+i*step, -0.5+(j+1)*step];\n\t\t\tvar v3 = [-0.5, -0.5+(i+1)*step, -0.5+(j+1)*step];\n\n\t\t\ttriangles.push([v0, v2, v3]);\n\t\t\ttriangles.push([v0, v3, v1]);\n\t\t}\n\t}\n\n\t// Right\n\tfor(var i=0; i<subdivisions; i++){\n\t\tfor(var j=0;j<subdivisions;j++){\n\t\t\tvar v0 = [0.5, -0.5+i*step, -0.5+j*step];\n\t\t\tvar v1 = [0.5, -0.5+(i+1)*step, -0.5+j*step];\n\t\t\tvar v2 = [0.5, -0.5+i*step, -0.5+(j+1)*step];\n\t\t\tvar v3 = [0.5, -0.5+(i+1)*step, -0.5+(j+1)*step];\n\n\t\t\ttriangles.push([v0, v3, v2]);\n\t\t\ttriangles.push([v0, v1, v3]);\n\t\t}\n\t}\n\n\t// Top\n\tfor(var i=0; i<subdivisions; i++){\n\t\tfor(var j=0;j<subdivisions;j++){\n\t\t\tvar v0 = [-0.5+i*step, 0.5, -0.5+j*step];\n\t\t\tvar v1 = [-0.5+(i+1)*step, 0.5, -0.5+j*step];\n\t\t\tvar v2 = [-0.5+i*step, 0.5, -0.5+(j+1)*step];\n\t\t\tvar v3 = [-0.5+(i+1)*step, 0.5, -0.5+(j+1)*step];\n\n\t\t\ttriangles.push([v0, v2, v3]);\n\t\t\ttriangles.push([v0, v3, v1]);\n\t\t}\n\t}\n\n\t// Back\n\tfor(var i=0; i<subdivisions; i++){\n\t\tfor(var j=0;j<subdivisions;j++){\n\t\t\tvar v0 = [-0.5 + i*step, -0.5 + j*step, -0.5];\n\t\t\tvar v1 = [-0.5 + (i+1)*step, -0.5 + j*step, -0.5];\n\t\t\tvar v2 = [-0.5 + i*step, -0.5 + (j+1)*step, -0.5];\n\t\t\tvar v3 = [-0.5 + (i+1)*step, -0.5 + (j+1)*step, -0.5];\n\n\t\t\ttriangles.push([v0, v2, v3]);\n\t\t\ttriangles.push([v0, v3, v1]);\n\t\t}\n\t}\n\n\t// Buttom\n\tfor(var i=0; i<subdivisions; i++){\n\t\tfor(var j=0;j<subdivisions;j++){\n\t\t\tvar v0 = [-0.5+i*step, -0.5, -0.5+j*step];\n\t\t\tvar v1 = [-0.5+(i+1)*step, -0.5, -0.5+j*step];\n\t\t\tvar v2 = [-0.5+i*step, -0.5, -0.5+(j+1)*step];\n\t\t\tvar v3 = [-0.5+(i+1)*step, -0.5, -0.5+(j+1)*step];\n\n\t\t\ttriangles.push([v0, v3, v2]);\n\t\t\ttriangles.push([v0, v1, v3]);\n\t\t}\n\t}\n\n\t// add triangles to finish the make process\n\tfor (tri of triangles){\n\t\taddTriangle(\n\t\t\ttri[0][0], tri[0][1], tri[0][2],\n\t\t\ttri[1][0], tri[1][1], tri[1][2],\n\t\t\ttri[2][0], tri[2][1], tri[2][2]\n\t\t\t);\n\t}\n\n \n}", "function Cube(size, colorMapURLs, specularMapURL, shininess, animation, lighting) {\n var s = size / 2;\n\n ItemElements.call(this, [ // vertices\n -s, -s, s, s, -s, s, s, s, s, -s, s, s,\n -s, -s, -s, -s, s, -s, s, s, -s, s, -s, -s,\n -s, s, -s, -s, s, s, s, s, s, s, s, -s,\n -s, -s, -s, s, -s, -s, s, -s, s, -s, -s, s,\n s, -s, -s, s, s, -s, s, s, s, s, -s, s,\n -s, -s, -s, -s, -s, s, -s, s, s, -s, s, -s\n ], [ // vertex indices\n 0, 1, 2, 0, 2, 3, \n 4, 5, 6, 4, 6, 7, \n 8, 9, 10, 8, 10, 11, \n 12, 13, 14, 12, 14, 15,\n 16, 17, 18, 16, 18, 19, \n 20, 21, 22, 20, 22, 23 \n ], [ // normals\n 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,\n 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1,\n 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,\n 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0,\n 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0,\n -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0,\n ], [ // texture coords\n 0, 0, 1, 0, 1, 1, 0, 1,\n 1, 0, 1, 1, 0, 1, 0, 0,\n 0, 1, 0, 0, 1, 0, 1, 1,\n 1, 1, 0, 1, 0, 0, 1, 0,\n 1, 0, 1, 1, 0, 1, 0, 0,\n 0, 0, 1, 0, 1, 1, 0, 1\n ], colorMapURLs, specularMapURL, shininess, animation, lighting);\n}", "function initBuffers(gl) {\n\n // Create a buffer for the cube's vertex positions.\n\n const positionBuffer = gl.createBuffer();\n\n // Select the positionBuffer as the one to apply buffer\n // operations to from here out.\n\n gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);\n\n // Now create an array of positions for the cube.\n\n const positions = [\n\t// Front face\n\t-1.0, -1.0, 0.0,\n\t 1.0, -1.0, 0.0,\n\t 1.0, 1.0, 0.0,\n\t-1.0, 1.0, 0.0,\n ];\n\n // Now pass the list of positions into WebGL to build the\n // shape. We do this by creating a Float32Array from the\n // JavaScript array, then use it to fill the current buffer.\n\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW);\n\n // Now set up the texture coordinates for the faces.\n\n const textureCoordBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer);\n\n /*\n const textureCoordinates = [\n\t// Front\n\t-1.0, -1.0,\n\t 1.0, -1.0,\n\t 1.0, 1.0,\n\t-1.0, 1.0,\n ];\n */\n\n const textureCoordinates = [\n\t// Front\n\t-1.2, -1.2,\n\t 1.2, -1.2,\n\t 1.2, 1.2,\n\t-1.2, 1.2,\n ];\n\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(textureCoordinates),\n gl.STATIC_DRAW);\n\n // Build the element array buffer; this specifies the indices\n // into the vertex arrays for each face's vertices.\n\n const indexBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);\n\n // This array defines each face as two triangles, using the\n // indices into the vertex array to specify each triangle's\n // position.\n\n const indices = [\n\t0, 1, 2, 0, 2, 3 // front\n ];\n\n // Now send the element array to GL\n\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,\n\t\t new Uint16Array(indices), gl.STATIC_DRAW);\n\n return {\n\tposition: positionBuffer,\n\ttextureCoord: textureCoordBuffer,\n\tindices: indexBuffer,\n };\n}", "function updateCubes() {\n cubePositionVectors = [];\n for (let i = 0; i < cubeFactor; ++i) {\n for (let j = 0; j < cubeFactor; ++j) {\n for (let k = 0; k < cubeFactor; ++k) {\n cubePositionVectors.push(i * 4);\n cubePositionVectors.push(j * 4);\n cubePositionVectors.push(k * 4);\n }\n }\n }\n\n const cubeCount = document.getElementById('cube_count');\n cubeCount.innerText = cubeFactor ** 3;\n }", "function updateCubes() {\n cubePositionVectors = [];\n for (let i = 0; i < cubeFactor; ++i) {\n for (let j = 0; j < cubeFactor; ++j) {\n for (let k = 0; k < cubeFactor; ++k) {\n cubePositionVectors.push(i * 4);\n cubePositionVectors.push(j * 4);\n cubePositionVectors.push(k * 4);\n }\n }\n }\n\n const cubeCount = document.getElementById('cube_count');\n cubeCount.innerText = cubeFactor ** 3;\n }", "function cubo(dim, color, material, alambrado){\n var cubeGeometry=new THREE.BoxGeometry(dim,dim,dim);\n var cubeMaterial;\n\n switch(material){\n case 'Basic': cubeMaterial = new THREE.MeshBasicMaterial({color: color, wireframe: alambrado});\n break;\n\n case 'Standard': cubeMaterial = new THREE.MeshStandardMaterial({color: color, wireframe: alambrado});\n break;\n\n case 'Physical': cubeMaterial = new THREE.MeshPhysicalMaterial({color: color, wireframe: alambrado});\n break;\n\n case 'Phong': cubeMaterial = new THREE.MeshPhongMaterial({color: color, wireframe: alambrado});\n break;\n\n case 'Lambert': cubeMaterial = new THREE.MeshLambertMaterial({color: color, wireframe: alambrado});\n break;\n }\n \n var cube = new THREE.Mesh(cubeGeometry, cubeMaterial)\n\n // add the cube to the scene\n scene.add(cube);\n return(cube);\n}", "initializeCube(cubeSize, texList = null) {\n cubeSize *= 0.5;\n this.m_minV = new Vector3D_1.default(-cubeSize, -cubeSize, -cubeSize);\n this.m_maxV = new Vector3D_1.default(cubeSize, cubeSize, cubeSize);\n this.createMaterial(texList);\n this.activeDisplay();\n }" ]
[ "0.7441803", "0.7368991", "0.73639846", "0.7356301", "0.72440046", "0.7172248", "0.7147309", "0.7147309", "0.7077254", "0.7039772", "0.7028733", "0.6981609", "0.6906486", "0.6893108", "0.6889303", "0.6867397", "0.6863341", "0.6794245", "0.67602104", "0.675611", "0.6752009", "0.6734683", "0.6705696", "0.6703769", "0.6644442", "0.6630274", "0.66118443", "0.65979075", "0.6590377", "0.656599", "0.65529466", "0.6551917", "0.6533128", "0.6522451", "0.6518899", "0.6517602", "0.65110445", "0.6508037", "0.6500579", "0.6436386", "0.6432902", "0.6417773", "0.64028573", "0.6385123", "0.6372446", "0.6362512", "0.6351622", "0.63446206", "0.633842", "0.63277906", "0.6327437", "0.63188386", "0.63176847", "0.6316445", "0.63158923", "0.6315416", "0.6267736", "0.6264868", "0.62597185", "0.6245738", "0.6239083", "0.62234586", "0.6214731", "0.6199719", "0.6198522", "0.6198522", "0.619303", "0.6186507", "0.6166569", "0.6166569", "0.6166569", "0.6160007", "0.6152769", "0.6146878", "0.6143544", "0.6133846", "0.6129222", "0.6128383", "0.6126075", "0.6125528", "0.6115323", "0.6108023", "0.6106962", "0.60777766", "0.6073088", "0.6071721", "0.60558826", "0.6052883", "0.6042606", "0.6042025", "0.603276", "0.6030754", "0.60271025", "0.60140663", "0.60129285", "0.6010384", "0.6002708", "0.6002708", "0.59984773", "0.59967643" ]
0.6440226
39
Funcao que retorne TRUE caso o ponto P esteja dentro do triangulo com vertices nas coordenadas A B C
function barycentric (A, B, C, P){ // Compute vectors var a = vec3(A); var b = vec3(B); var c = vec3(C); var p = vec3(P); var v0 = subtract(c, a); var v1 = subtract(b, a); var v2 = subtract(p, a); // Compute dot products var dot00 = dot(v0, v0); var dot01 = dot(v0, v1); var dot02 = dot(v0, v2); var dot11 = dot(v1, v1); var dot12 = dot(v1, v2); // Compute barycentric coordinates var invDenom = 1 / (dot00 * dot11 - dot01 * dot01); var u = (dot11 * dot02 - dot01 * dot12) * invDenom; var v = (dot00 * dot12 - dot01 * dot02) * invDenom; // Check if point is in triangle return (u >= 0) && (v >= 0) && (u + v < 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pointInTriangle(p, a, b, c){\n\tif(sameSide(p, a, b, c) && sameSide(p, b, a, c) && sameSide(p, c, a, b)){\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "areCoordsWithinTriangle(coord, pointA, pointB, pointC) {\n let calcPointAB = ((coord.y - pointA.y) * (pointB.x - pointA.x) - (coord.x - pointA.x) * (pointB.y - pointA.y));\n let calcPointBC = ((coord.y - pointB.y) * (pointC.x - pointB.x) - (coord.x - pointB.x) * (pointC.y - pointB.y));\n let calcPointCA = ((coord.y - pointC.y) * (pointA.x - pointC.x) - (coord.x - pointC.x) * (pointA.y - pointC.y));\n\n if (calcPointAB * calcPointBC > 0 && calcPointBC * calcPointCA > 0) {\n return true;\n } else {\n return false;\n }\n }", "function insideTriangle(p, vertices){\n if(sameSide(p, vertices[0], vertices[1], vertices[2]) && sameSide(p, vertices[1], vertices[0], vertices[2]) && sameSide(p, vertices[2], vertices[0], vertices[1])) return true;\n else return false;\n}", "function vertex_in_triangle(v, t) {\n\tfor (var p=0; p<pointnames.length; p++) {\n\t\tif (t[pointnames[p]] == v) {\n\t\t\treturn true;\n\t\t}\n\t}\n}", "function triangleCheck(lineA, lineB , lineC) {\n if (((lineA < lineB + lineC)&&(lineA > Math.abs(lineB - lineC)))||((lineB < lineA + lineC)&&(lineB > Math.abs(lineA - lineC)))||((lineC < lineB + lineC)&&(lineC > Math.abs(lineB - lineA)))){\n return true;\n }\n return false;\n}", "IsConvex()\n {\n\n let foundNegative = false;\n let foundPositive = false;\n for (let i = 0; i < this.vertices.length; i++)\n {\n // get 3 adjacent vertices\n let a = this.vertices[i];\n let b = this.vertices[(i + 1) % this.vertices.length];\n let c = this.vertices[(i + 2) % this.vertices.length];\n\n Vector.Cross();\n\n // if 1st pair, establish \n\n }\n }", "function inTriangle(arr){\n var c1 = crossProduct(arr[0], findPoint, arr[1]);\n var c2 = crossProduct(arr[1], findPoint, arr[2]);\n var c3 = crossProduct(arr[2], findPoint, arr[0]);\n if(c1*c2 >= 0 && c2*c3 >= 0 && c3*c1 >= 0){\n return true;\n }else{\n return false;\n }\n}", "function pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( cx - px ) * ( ay - py ) >= ( ax - px ) * ( cy - py ) &&\n ( ax - px ) * ( by - py ) >= ( bx - px ) * ( ay - py ) &&\n ( bx - px ) * ( cy - py ) >= ( cx - px ) * ( by - py );\n\n}", "checkTriangle(x,y,z){\n\t\tlet segmentA = x;\n\t\tlet segmentB = y;\n\t\tlet pointX = z;\n\t\tlet pointA = segmentA.a\n\t\tlet pointB = segmentA.b\n\t\tlet pointC = segmentB.b\n\t\tlet Ax = pointA[0];\n\t\tlet Ay = pointA[1];\n\t\tlet Bx = pointB[0];\n\t\tlet By = pointB[1];\n\t\tlet Cx = pointC[0];\n\t\tlet Cy = pointC[1];\n\t\tlet Xx = pointX[0];\n\t\tlet Xy = pointX[1];\n\t\tlet c = Math.sqrt((Ax-Bx)*(Ax-Bx)+(Ay-By)*(Ay-By))\n\t\tlet a = Math.sqrt((Bx-Cx)*(Bx-Cx)+(By-Cy)*(By-Cy))\n\t\tlet b = Math.sqrt((Ax-Cx)*(Ax-Cx)+(Ay-Cy)*(Ay-Cy))\n\t\tlet xa = Math.sqrt((Xx-Ax)*(Xx-Ax)+(Xy-Ay)*(Xy-Ay))\n\t\tlet xb = Math.sqrt((Xx-Bx)*(Xx-Bx)+(Xy-By)*(Xy-By))\n\t\tlet xc = Math.sqrt((Xx-Cx)*(Xx-Cx)+(Xy-Cy)*(Xy-Cy))\n\t\tlet gamma1 = Math.acos((xa*xa + xb*xb -c*c)/(2*xa*xb))\n\t\tlet gamma2 = Math.acos((xb*xb + xc*xc -a*a)/(2*xb*xc))\n\t\tlet gamma3 = Math.acos((xa*xa + xc*xc -b*b)/(2*xa*xc))\n\t\tlet result = gamma1+gamma2+gamma3\n\t\t//on edge or point will return true\n\t\tif (Math.round((result - Math.PI*2)*1000)){\n\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\treturn true;\n\t\t}\n\t}", "function checkCityLegality(coords, player, vertexList) {\n var vert = BoardState.findVertices(vertexList, coords)[0];\n if (vert.structure != 1) {\n return false;\n }\n if (vert.playerID != player.id) {\n return false;\n }\n return true;\n}", "function triangleInCircle(tri, c ,r) {\n\tfor(var i = 0; i < 3; i++) {\n\t\tif(pointInCircle(tri[i], c, r)){\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "isInTriangle(x1, y1, x2, y2, x3, y3, x, y){\r\n var l1 = ((y2-y3)*(x-x3)+(x3-x2)*(y-y3)) / ((y2-y3)*(x1-x3)+(x3-x2)*(y1-y3));\r\n var l2 = ((y3-y1)*(x-x3)+(x1-x3)*(y-y3)) / ((y2-y3)*(x1-x3)+(x3-x2)*(y1-y3));\r\n var l3 = 1 - l1 - l2;\r\n return (l1 >= 0 && l1 <= 1 && l2 >= 0 && l2 <= 1 && l3 >= 0 && l3 <= 1);\r\n }", "function pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( cx - px ) * ( ay - py ) - ( ax - px ) * ( cy - py ) >= 0 &&\n\t ( ax - px ) * ( by - py ) - ( bx - px ) * ( ay - py ) >= 0 &&\n\t ( bx - px ) * ( cy - py ) - ( cx - px ) * ( by - py ) >= 0;\n\n}", "function pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( cx - px ) * ( ay - py ) - ( ax - px ) * ( cy - py ) >= 0 &&\n\t ( ax - px ) * ( by - py ) - ( bx - px ) * ( ay - py ) >= 0 &&\n\t ( bx - px ) * ( cy - py ) - ( cx - px ) * ( by - py ) >= 0;\n\n}", "function pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( cx - px ) * ( ay - py ) - ( ax - px ) * ( cy - py ) >= 0 &&\n\t ( ax - px ) * ( by - py ) - ( bx - px ) * ( ay - py ) >= 0 &&\n\t ( bx - px ) * ( cy - py ) - ( cx - px ) * ( by - py ) >= 0;\n\n}", "function pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( cx - px ) * ( ay - py ) - ( ax - px ) * ( cy - py ) >= 0 &&\n\t ( ax - px ) * ( by - py ) - ( bx - px ) * ( ay - py ) >= 0 &&\n\t ( bx - px ) * ( cy - py ) - ( cx - px ) * ( by - py ) >= 0;\n\n}", "function contains(triangle, p) {\n // returns true if triangle contains any of the points\n var origin = triangle[0];\n var v1 = point.subtract(triangle[1], origin);\n var v2 = point.subtract(triangle[2], origin);\n var A = [[v1.x, v2.x], [v1.y, v2.y]];\n if (p.constructor === Array) {\n var b = [];\n for (var i=0; i<p.length; i++) {\n var p0 = point.subtract(p[i], origin);\n b.push([p0.x, p0.y]);\n var x = numeric.dot(numeric.inv(A), numeric.transpose(b));\n }\n for (var i=0; i<x.length; i++) {\n if (x[0][i] >=0 && x[0][i] <= 1\n && x[1][i] >=0 && x[1][i] <= 1\n && (x[0][i] + x[1][i] <= 1)) {\n return true;\n } else {\n return false;\n }\n }\n } else {\n var p0 = point.subtract(p, origin);\n var b = [p0.x, p0.y];\n var x = numeric.dot(numeric.inv(A), b);\n if (x[0] >=0 && x[0] <= 1\n && x[1] >=0 && x[1] <= 1\n && (x[0] + x[1] <= 1)) {\n return true;\n } else {\n return false;\n }\n }\n}", "get isConvex() {\n const { _coords } = this\n const numCoords = _coords.length\n\n if (numCoords < 6) return true\n else {\n for (let i = 0; i < numCoords; i += 2) {\n if (\n !this.isConvexTriangle(\n _coords[i],\n _coords[i + 1],\n _coords[(i + 2) % numCoords],\n _coords[(i + 3) % numCoords],\n _coords[(i + 4) % numCoords],\n _coords[(i + 5) % numCoords]\n )\n ) {\n return false\n }\n }\n }\n\n return true\n }", "function isTriangle(a, b, c) {\n if (a + b > c && a + c > b && b + c > a) {\n return true\n } else {\n return false\n }\n}", "function checkValidity(ring) {\n if (ring.length < 3) {\n return false;\n //if the last point is the same as the first, it's not a triangle\n } else if (ring.length === 3 &&\n ((ring[2][0] === ring[0][0]) && (ring[2][1] === ring[0][1]))) {\n return false;\n } else {\n return true;\n }\n}", "function checkValidity(ring) {\n if (ring.length < 3) {\n return false;\n //if the last point is the same as the first, it's not a triangle\n } else if (ring.length === 3 &&\n ((ring[2][0] === ring[0][0]) && (ring[2][1] === ring[0][1]))) {\n return false;\n } else {\n return true;\n }\n}", "function pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\t\treturn ( cx - px ) * ( ay - py ) - ( ax - px ) * ( cy - py ) >= 0 &&\n\t\t\t\t( ax - px ) * ( by - py ) - ( bx - px ) * ( ay - py ) >= 0 &&\n\t\t\t\t( bx - px ) * ( cy - py ) - ( cx - px ) * ( by - py ) >= 0;\n\n\t}", "function pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\t\treturn ( cx - px ) * ( ay - py ) - ( ax - px ) * ( cy - py ) >= 0 &&\n\t\t ( ax - px ) * ( by - py ) - ( bx - px ) * ( ay - py ) >= 0 &&\n\t\t ( bx - px ) * ( cy - py ) - ( cx - px ) * ( by - py ) >= 0;\n\n\t}", "function pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\t\treturn ( cx - px ) * ( ay - py ) - ( ax - px ) * ( cy - py ) >= 0 &&\n\t\t ( ax - px ) * ( by - py ) - ( bx - px ) * ( ay - py ) >= 0 &&\n\t\t ( bx - px ) * ( cy - py ) - ( cx - px ) * ( by - py ) >= 0;\n\n\t}", "function pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\t\treturn ( cx - px ) * ( ay - py ) - ( ax - px ) * ( cy - py ) >= 0 &&\n\t\t ( ax - px ) * ( by - py ) - ( bx - px ) * ( ay - py ) >= 0 &&\n\t\t ( bx - px ) * ( cy - py ) - ( cx - px ) * ( by - py ) >= 0;\n\n\t}", "static isConvexTriangle(ax, ay, bx, by, cx, cy) {\n // dot product of [the normal of (a->b)] and (b->c) must be positive\n return (ay - by) * (cx - bx) + (bx - ax) * (cy - by) >= 0\n }", "function inTriangle(p, a, b, c) {\n\t// Compute vectors\n\tlet v0 = [c[0] - a[0], c[1] - a[1]],\n\t\tv1 = [b[0] - a[0], b[1] - a[1]],\n\t\tv2 = [p[0] - a[0], p[1] - a[1]]\n\n\t// Compute dot products\n\tlet dot00 = dot(v0, v0),\n\t\tdot01 = dot(v0, v1),\n\t\tdot02 = dot(v0, v2),\n\t\tdot11 = dot(v1, v1),\n\t\tdot12 = dot(v1, v2)\n\n\t// Compute barycentric coordinates\n\tlet invDenom = 1 / (dot00 * dot11 - dot01 * dot01),\n\t\tu = (dot11 * dot02 - dot01 * dot12) * invDenom,\n\t\tv = (dot00 * dot12 - dot01 * dot02) * invDenom\n\n\t// Check if point is in triangle\n\treturn (u > 0) && (v > 0) && (u + v < 1)\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n\t return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n\t (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n\t (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n\t}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n\t return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n\t (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n\t (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n\t}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n\t return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n\t (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n\t (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n\t}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n\t return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n\t (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n\t (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n\t}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n\t return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n\t (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n\t (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n\t}", "function is_triangle(a,b,c){\n if (a <= 0 || b <=0 || c <= 0){\n return false\n } else if ((a+b)>c && (a+c > b) && (c+b > a)){\n return true\n } else{\n return false\n }\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function triangleInTriangle(triOne, triTwo) {\n\tfor(var i = 0; i < 3; i ++){\n\t\tif(pointInTriangle(triOne[i], triTwo[0], triTwo[1], triTwo[2])){\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n\n\treturn (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function checkValidity(ring) {\n\t if (ring.length < 3) {\n\t return false;\n\t //if the last point is the same as the first, it's not a triangle\n\t } else if (ring.length === 3 &&\n\t ((ring[2][0] === ring[0][0]) && (ring[2][1] === ring[0][1]))) {\n\t return false;\n\t } else {\n\t return true;\n\t }\n\t}", "function isTriangle (a, b, c){\n if (a === 0 || b === 0 || c === 0){\n return false;\n } else if (a+b <= c){\n return false;\n } else if (b+c <= a){\n return false;\n } else if (a+c <= b){\n return false;\n }\n\n return true;\n }", "function isTriangle(a,b,c){\n \n let fierst =( a+b) > c;\n let second =( a+c) > b;\n let third =( b+c) > a;\n if(fierst && second && third){\n return true;\n }else return false\n \n}", "boolMouseInTriangle(p, p0, p1, p2) {\n // 초기값 예외\n const startStayMousePosition = (p0.x === 0 && p0.y === 0);\n if (startStayMousePosition) return this.boolTriangle = false;\n\n // 삼각형 안에 마우스 유무 계산 => true / false 반환 \n this.boolTriangle = (((p1.y - p0.y) * (p.x - p0.x) - (p1.x - p0.x) * (p.y - p0.y)) || ((p2.y - p1.y) * (p.x - p1.x) - (p2.x - p1.x) * (p.y - p1.y)) || ((p0.y - p2.y) * (p.x - p2.x) - (p0.x - p2.x) * (p.y - p2.y))) >= 0;\n return this.boolTriangle;\n }", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}", "function valorTriangulo(){\n if(trianguloAparienciaInteraccion == true && trianguloAparienciaTono == true && trianguloAparienciaMirada == true && trianguloAparienciaLlanto == true){\n trianguloApariencia = true;\n }else{\n trianguloApariencia = false;\n }\n}", "function pointInTriangle (a, b, c) {\n var u = span(a, b);\n var v = span(a, c);\n var vxu = cross(v, u);\n var uxv = -vxu;\n\n return function (p) {\n var w = span(a, p);\n\n var vxw = cross(v, w);\n if (vxu * vxw < 0)\n return false;\n\n var uxw = cross(u, w);\n if (uxv * uxw < 0)\n return false;\n\n return Math.abs(uxw) + Math.abs(vxw) <= Math.abs(uxv);\n }\n}", "static pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n }", "function isCarBetweenRoutePoints(routePoints, carPosition) {\n //first: are there two routePoints?\n if (routePoints.length >= 2) {\n //get all routePoints\n fill(255, 0, 0);\n circle(carPosition[0], carPosition[1], 10, 10);\n\n for (let i = 0; i <= routePoints.length - 1; i++) {\n //save every two routePoints\n //if there is one left...\n if (i < routePoints.length - 1) {\n let firstRoutePoint = routePoints[i];\n let secondRoutePoint = routePoints[i + 1];\n\n stroke(255);\n noFill();\n quad(\n routePoints[i][0],\n routePoints[i][1],\n routePoints[i + 1][0],\n routePoints[i][1],\n routePoints[i + 1][0],\n routePoints[i + 1][1],\n routePoints[i][0],\n routePoints[i + 1][1]\n );\n if (\n carPosition[0] >= firstRoutePoint[0] &&\n carPosition[0] <= secondRoutePoint[0] &&\n carPosition[1] >= firstRoutePoint[1] &&\n carPosition[1] <= secondRoutePoint[1]\n ) {\n //console.log(\"das Auto befindet sich zwischen zwei routenpunkten\");\n return true;\n } else {\n return false;\n }\n }\n }\n } else {\n //console.log(\"zu wenig Routenpunkte\");\n let err = \"zu wenig Routenpunkte\";\n return err;\n }\n}", "function isTriplet (a, b, c) {\n if (a < b && b < c) {\n return true;\n } else {\n return false;\n }\n}", "get isSimple() {\n const { _coords } = this\n const numCoords = _coords.length\n if (numCoords <= 6) return true\n\n for (let i = 0; i < numCoords; i += 2) {\n const ax = _coords[i]\n const ay = _coords[i + 1]\n const bx = _coords[(i + 2) % numCoords]\n const by = _coords[(i + 3) % numCoords]\n const endJ = i + numCoords - 2\n\n for (let j = i + 4; j < endJ; j += 2) {\n const cx = _coords[j % numCoords]\n const cy = _coords[(j + 1) % numCoords]\n const dx = _coords[(j + 2) % numCoords]\n const dy = _coords[(j + 3) % numCoords]\n\n if (this.areVectorsIntersecting(ax, ay, bx, by, cx, cy, dx, dy))\n return false\n }\n }\n\n return true\n }", "function isTriangle(a, b, c) {\n \n [a, b, c] = [a, b, c].sort((x, y) => x - y);\n \n return a + b > c;\n}", "function isTriangle(a, b, c) {\n if (a <= 0 || b <= 0 || c <= 0) return false;\n\n if (a + b > c && b + c > a && c + a > b) return true;\n else return false;\n}", "contains(x, y) {\n const { _coords } = this\n // Algorithm & implementation thankfully taken from:\n // -> http://alienryderflex.com/polygon/\n\n let i,\n j = this.numVertices - 1\n let oddNodes = 0\n\n for (i = 0; i < this.numVertices; ++i) {\n const ix = _coords[i * 2]\n const iy = _coords[i * 2 + 1]\n const jx = _coords[j * 2]\n const jy = _coords[j * 2 + 1]\n\n if (((iy < y && jy >= y) || (jy < y && iy >= y)) && (ix <= x || jx <= x))\n oddNodes ^= Math.floor(ix + ((y - iy) / (jy - iy)) * (jx - ix) < x) //todo:\n\n j = i\n }\n\n return oddNodes !== 0\n }", "function insideTriangle(ax, ay, bx, by, cx, cy, px, py) {\n var aX, aY, bX, bY,\n cX, cY, apx, apy,\n bpx, bpy, cpx, cpy,\n cCROSSap, bCROSScp, aCROSSbp;\n\n aX = cx - bx;\n aY = cy - by;\n bX = ax - cx;\n bY = ay - cy;\n cX = bx - ax;\n cY = by - ay;\n apx = px - ax;\n apy = py - ay;\n bpx = px - bx;\n bpy = py - by;\n cpx = px - cx;\n cpy = py - cy;\n\n aCROSSbp = aX * bpy - aY * bpx;\n cCROSSap = cX * apy - cY * apx;\n bCROSScp = bX * cpy - bY * cpx;\n\n return ((aCROSSbp >= 0.0) && (bCROSScp >= 0.0) && (cCROSSap >= 0.0));\n }", "function validTriangle(a, b, c){\n var values = [a*a,b*b,c*c];\n var y,z;\n var flag = false;\n for(var x = 0;x<3;x++){\n y = (x + 1)%3;\n z = (x + 2)%3;\n if (( (values[x] + values[y] == values[z]) || (a == b && a == c) || ( (b == c && b == a) || (a==b || b ==c || c == a) ) ) && a != 0 && b != 0 && c != 0 && a + b > c && c + a > b && c + b > a){\n flag = true;\n }\n }\n return flag;\n}", "contains(px, py) {\n let d = dist(px, py, this.x, this.y);\n if (d < this.r) {\n return true;\n } else {\n return false;\n }\n }", "function isInside(x1, y1, x2, y2, x3, y3, x, y) {\n\n /* Calculate area of triangle ABC */\n let A = area(x1, y1, x2, y2, x3, y3);\n\n /* Calculate area of triangle PBC */\n let A1 = area(x, y, x2, y2, x3, y3);\n\n /* Calculate area of triangle PAC */\n let A2 = area(x1, y1, x, y, x3, y3);\n\n /* Calculate area of triangle PAB */\n let A3 = area(x1, y1, x2, y2, x, y);\n\n /* Check if sum of A1, A2 and A3 is same as A */\n return (10 > Math.abs(A - (A1 + A2 + A3)));\n}", "function checkSettlementLegality(coords, player, vertexList, roadList) {\n var vert = BoardState.requireVertex(vertexList, coords);\n if (!checkAdjacentPlayerRoads(coords, coords, player, roadList, vertexList)) {\n return false;\n }\n if (vert.structure !== undefined) {\n return false;\n }\n var neighborList = getVertexNeighbors(coords, vertexList);\n for (var i = 0; i < neighborList.length; i++) {\n if (neighborList[i].structure !== undefined) {\n return false;\n }\n }\n return true;\n}", "get isEquilateral() {\n if (this.side1 == this.side2 && this.side1 == this.side3 && this.side2 == this.side3 && this.side1 != 0) {\n return true\n } else {\n return false;\n }\n }", "function containsPoint(verts, px, py) {\n var num = verts.length;\n var i, j = num - 1;\n var oddNodes = false;\n for (i = 0; i < num; i++) {\n var vi = verts[i];\n var vj = verts[j];\n if (vi.y < py && vj.y >= py || vj.y < py && vi.y >= py) {\n if (vi.x + (py - vi.y) / (vj.y - vi.y) * (vj.x - vi.x) < px) {\n oddNodes = !oddNodes;\n }\n }\n j = i;\n }\n return oddNodes;\n}", "function checkAdjacentPlayerRoads(coords1, coords2, player, roadList, vertexList) {\n var testVertices1 = getVertexNeighbors(coords1, vertexList);\n for (var i = 0; i < testVertices1.length; i++) {\n var road1 = BoardState.requireRoad(roadList, coords1, testVertices1[i].coordinate); // Checks the vertices adjacent to the first coordinate for player roads\n if (road1 != undefined) {\n if (road1.playerID == player.id) {\n return true;\n }\n }\n }\n var testVertices2 = getVertexNeighbors(coords2, vertexList);\n for (i = 0; i < testVertices2.length; i++) {\n var road2 = BoardState.requireRoad(roadList, coords2, testVertices2[i].coordinate); // Checks the vertices adjacent to the second coordinate for player roads\n if (road2 != undefined) {\n if (road2.playerID == player.id) {\n return true;\n }\n }\n }\n return false;\n}", "isInQuadrant(q) {\n // Map quadrant to x & y coordinate pairs and multiply with coordinates,\n // then check sign:\n // 1: [ 1, 1]\n // 2: [-1, 1]\n // 3: [-1, -1]\n // 4: [ 1, -1]\n return this.x * (q > 1 && q < 4 ? -1 : 1) >= 0 && this.y * (q > 2 ? -1 : 1) >= 0;\n }", "function isConnection$3(element) {\n return element.waypoints;\n}", "function inKobonTriangle(segment) {\n for (var i = 0; i < kobons.length; i++) {\n var points = kobons[i].getUniquePoints();\n var aIsPoint;\n var bIsPoint;\n for (var j = 0; j < points.length; j++) {\n if (segment.intersect1.point.equals(points[j]))\n aIsPoint = true;\n if (segment.intersect2.point.equals(points[j]))\n bIsPoint = true;\n }\n if (aIsPoint && bIsPoint)\n return true;\n }\n return false;\n }", "function isConnectedXY (polygonA, polygonB) {\n if (polygonA[0] instanceof Array) polygonA=polygonA[0]; //this takes care of the fact that jsclip will return inner array\n if (polygonB[0] instanceof Array) polygonB=polygonB[0];\n for (var y = 0; y < polygonA.length; y++) { //compare points\n\tfor (var z=0; z< polygonB.length; z++) {\n\t //IMPORTANT. rounding to two decimal places b/c of errors with matching points\n\t var aX = polygonA[y].X.toFixed(0),//rounded to zero decimals b/c that's what jsclipperdoes\n\t\tbX = polygonB[z].X.toFixed(0),\n\t\taY = polygonA[y].Y.toFixed(0),\n\t\tbY = polygonB[z].Y.toFixed(0);\n\t polygonA[y].X = +aX;\n\t polygonB[z].X = +bX;\n\t polygonA[y].Y = +aY;\n\t polygonB[z].Y = +bY;\n\t // reassigning rounded point values in polygons for future use\n\t if (aX===bX && aY===bY) //points match\n\t\treturn true;\n\t}\n }\n return false;\n}", "function isTriangle(a,b,c){\nvar length1 = a+b\nvar length2 = b+c\nvar length3 = a+c\n\n//conditional\n\nif(length1 > c && length2 > a && length3 > b ){\n return true;\n}else{\n return false;\n}\n}", "valid(p) {\n return p.shape.every((row, dy) => {\n return row.every((value, dx) => {\n let x = p.x + dx;\n let y = p.y + dy;\n return (\n value === 0 ||\n (this.insideWalls(x) &&\n this.aboveFloor(y) && this.notOccupied(x, y))\n )});\n });\n }", "intersectionCheck(p3, p4) {\n let p0_x = this.p1.position[0];\n let p0_y = this.p1.position[2];\n let p1_x = this.p2.position[0];\n let p1_y = this.p2.position[2];\n let p2_x = p3.position[0];\n let p2_y = p3.position[2];\n let p3_x = p4.position[0];\n let p3_y = p4.position[2];\n let s1_x = p1_x - p0_x;\n let s1_y = p1_y - p0_y;\n let s2_x = p3_x - p2_x;\n let s2_y = p3_y - p2_y;\n let s = (-s1_y * (p0_x - p2_x) + s1_x * (p0_y - p2_y)) / (-s2_x * s1_y + s1_x * s2_y);\n let t = (s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) / (-s2_x * s1_y + s1_x * s2_y);\n if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {\n let x_result = p0_x + (t * s1_x);\n let y_Result = p0_y + (t * s1_y);\n return new Point(vec3.fromValues(x_result, 0, y_Result));\n }\n return null;\n }", "function isConnection$3(element) {\n return element.waypoints;\n }", "static _isInside(a, b, c, x, y) {\n\t\t// If x, y are on the right side of ab, the point is outside the triangle\n\t\tif (Munsell._cross(x - a[0], y - a[1], b[0] - a[0], b[1] - a[1]) < 0) return false;\n\t\t// If x, y are on the right side of bc, the point is outside the triangle\n\t\tif (Munsell._cross(x - b[0], y - b[1], c[0] - b[0], c[1] - b[1]) < 0) return false;\n\t\t// If x, y are on the right side of ca, the point is outside the triangle\n\t\tif (Munsell._cross(x - c[0], y - c[1], a[0] - c[0], a[1] - c[1]) < 0) return false;\n\t\treturn true;\n\t}", "compare(otherPoint) {\n if (typeof otherPoint === 'undefined') {\n console.warn('Compare Points: point not defined.');\n return false;\n }\n const a = E.toFixed(this.x) === E.toFixed(otherPoint.x);\n const b = E.toFixed(this.y) === E.toFixed(otherPoint.y);\n const c = E.toFixed(this.z) === E.toFixed(otherPoint.z);\n if (a && b && c) return true;\n return false;\n }", "function isvalid(vertex) {\n var x = vertex[0];\n var y = vertex[1];\n var d = vertex[2];\n\n if(y<0 || y>5) return false;\n\n var lowhigh = rows[y];\n\n var low = lowhigh[0];\n var high = lowhigh[1];\n var pos = 2*x + d;\n return pos >= low && pos <= high && (d == 0 || d == 1);\n}", "IsValidLocation(pt){\n if (pt.r < 1 || pt.r > this._size || pt.c < 1 || pt.c > this._size){\n return false;\n }\n return true;\n }", "contains(point) {\n if(!point) return false;\n // Iterate over _edges_\n let windingNumber = 0;\n for(let i = 0; i < this.vertices.length; ++i) {\n const start = this.vertices[i];\n const end = this.vertices[i + 1] || this.vertices[0];\n const edge = new Edge(start, end);\n\n if(edge.crosses(point.y)) {\n if(edge.isLeftOf(point)) {\n // Downward edge\n windingNumber++;\n } else {\n // Upward edge\n windingNumber--;\n }\n }\n }\n\n return windingNumber > 0;\n }", "function inNfp(p, nfp){\n\t\t\t\tif(!nfp || nfp.length == 0){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor(var i=0; i<nfp.length; i++){\n\t\t\t\t\tfor(var j=0; j<nfp[i].length; j++){\n\t\t\t\t\t\tif(_almostEqual(p.x, nfp[i][j].x) && _almostEqual(p.y, nfp[i][j].y)){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn false;\n\t\t\t}", "static isPointInPoly (poly, pt) {\n for (var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)\n ((poly[i].z <= pt.z && pt.z < poly[j].z) || (poly[j].z <= pt.z && pt.z < poly[i].z)) && (pt.x < (poly[j].x - poly[i].x) * (pt.z - poly[i].z) / (poly[j].z - poly[i].z) + poly[i].x) && (c = !c);\n return c;\n }", "is_vertex() {\n return this.level === 0;\n }", "function polyPoint(vertices, px, py) {\n let collision = false;\n \n // go through each of the vertices, plus the next vertex in the list\n let next = 0;\n for (let current=0; current<vertices.length; current++) {\n \n // get next vertex in list\n // if we’ve hit the end, wrap around to 0\n next = current+1;\n if (next == vertices.length) next = 0;\n \n // get the PVectors at our current position\n // this makes our if statement a little cleaner\n let vc = vertices[current]; // c for “current”\n let vn = vertices[next]; // n for “next”\n \n // compare position, flip ‘collision’ variable back and forth\n if ( ((vc.y > py && vn.y < py) || (vc.y < py && vn.y > py)) &&\n (px < (vn.x-vc.x) * (py-vc.y) / (vn.y-vc.y) + vc.x) ) {\n collision = !collision;\n }\n }\n return collision; \n}", "contains(p){\n return (this.x + this.size / 2 - p.getX()) ** 2 + (this.y + this.size / 2 - p.getY()) ** 2 <= this.size ** 2 / 4\n }", "static isPointInPoly (poly, pt) {\n\t for (var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)\n\t ((poly[i].z <= pt.z && pt.z < poly[j].z) || (poly[j].z <= pt.z && pt.z < poly[i].z)) && (pt.x < (poly[j].x - poly[i].x) * (pt.z - poly[i].z) / (poly[j].z - poly[i].z) + poly[i].x) && (c = !c);\n\t return c;\n\t }", "equals(...args) \r\n {\r\n let a, b;\r\n if (args[0] instanceof Vector2D) \r\n {\r\n a = args[0].x || 0;\r\n b = args[0].y || 0;\r\n } \r\n else if (args[0] instanceof Array) \r\n {\r\n a = args[0][0] || 0;\r\n b = args[0][1] || 0;\r\n } \r\n else \r\n {\r\n a = args[0] || 0;\r\n b = args[1] || 0;\r\n }\r\n return this.x === a && this.y === b;\r\n }", "isPointVisibleNaive(p1, p2, screenWidth) {\n\t\tlet currentLine = new LineSegment(p1, p2);\n\t\tlet intersectionPoint;\n\t\t//loops through all the edges to check if\n\t\t//currentLine intersects with any of them\n\t\tfor (let i = 0; i < this.polygonEdgeLines.length; i++) {\n\t\t\tintersectionPoint = LineSegment.getIntersectionPoint(currentLine, this.polygonEdgeLines[i]);\n\t\t\tif (intersectionPoint != null) {\n\t\t\t\tif (!(_.isEqual(intersectionPoint, p1) || _.isEqual(intersectionPoint, p2))) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst midPoint = new Point((p1.x + p2.x) / 2, (p1.y + p2.y) / 2);\n\t\tfor (let i = 0; i < this.polygon_list.length; i++) {\n\t\t\tif (this.polygon_list[i].pointIsInPolygon(midPoint, screenWidth)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "pointInTriangle(pt, t0, t1, t2, AScale)\n {\n let A = 0.5 * (-t1.y * t2.x + t0.y * (-t1.x + t2.x) + t0.x * (t1.y - t2.y) + t1.x * t2.y);\n let sign = A < 0 ? -1 : 1;\n let s = (t0.y * t2.x - t0.x * t2.y + (t2.y - t0.y) * pt.x + (t0.x - t2.x) * pt.y) * sign;\n let t = (t0.x * t1.y - t0.y * t1.x + (t0.y - t1.y) * pt.x + (t1.x - t0.x) * pt.y) * sign;\n return s > 0 && t > 0 && (s+t) < 2 * A * AScale * sign;\n }", "function isTriangle(a,b,c){\n let numbers = [a,b,c];\n for (let i = 0; i <= 2; i++) {\n if ((Number.isInteger(numbers[i])) == false) {\n console.log(`ERROR: number \"${numbers[i]}\" is not an integer`);\n return false;\n }\n else if (numbers[i] <= 0) {\n console.log( `ERORR: \"${numbers[i]}\" is not a side of triangle`);\n return false;\n }\n }\n if (a + b <= c) {\n console.log(`ERROR: number ${c} is not a side of triangle`);\n return false;\n }\n if (a + c <= b) {\n console.log(`ERROR: number ${b} is not a side of triangle`);\n return false;\n }\n if (b + c <= a) {\n console.log(`ERROR: number ${a} is not a side of triangle`);\n return false;\n } \n return true;\n}", "connectionPoint(x, y) {\n return (\n x > this.x &&\n x < this.x + this.w &&\n y > this.y &&\n y < this.y + this.h\n );\n }", "checkNextPosition(x,z)\n\t{\n\t\tvar ang = this.angleDirection;\n\t\t// Length of the each division of the plan\n\t\tvar lengthPlan = 50 / (this.scene.planTerrain.length-1);\n\t\tvar vehicleCoordI = this.scene.vehicleInitialMap[0];\n\t\tvar vehicleCoordJ = this.scene.vehicleInitialMap[1];\n\n\t\tvar i = vehicleCoordI-Math.round((x-3.8*Math.sin(ang)+1*Math.cos(ang))/lengthPlan);\n\t\tvar j = vehicleCoordJ-Math.floor((z+3.8*Math.cos(ang)+1*Math.sin(ang))/lengthPlan);\n\n\t\tif(this.scene.planTerrain[i][j] != 0)\n\t\t\treturn false;\n\n\t\ti = vehicleCoordI-Math.round((x-3.8*Math.sin(ang)-1*Math.cos(ang))/lengthPlan);\n\t\tj = vehicleCoordJ-Math.floor((z+3.8*Math.cos(ang)-1*Math.sin(ang))/lengthPlan);\n\n\t\tif(this.scene.planTerrain[i][j] != 0)\n\t\t\treturn false;\n\t\t\n\t\ti = vehicleCoordI-Math.round((x+0.4*Math.sin(ang)+1*Math.cos(ang))/lengthPlan);\n\t\tj = vehicleCoordJ-Math.floor((z-0.4*Math.cos(ang)+1*Math.sin(ang))/lengthPlan);\n\n\t\tif(this.scene.planTerrain[i][j] != 0)\n\t\t\treturn false;\n\t\t\n\t\ti = vehicleCoordI-Math.round((x+0.4*Math.sin(ang)-1*Math.cos(ang))/lengthPlan);\n\t\tj = vehicleCoordJ-Math.floor((z-0.4*Math.cos(ang)-1*Math.sin(ang))/lengthPlan);\n\n\t\tif(this.scene.planTerrain[i][j] != 0)\n\t\t\treturn false;\n\n\t\treturn true;\n\t}" ]
[ "0.70823693", "0.68719566", "0.6832996", "0.6297054", "0.6264374", "0.6241474", "0.6221555", "0.61915916", "0.6191021", "0.61803305", "0.6170195", "0.6164239", "0.61192226", "0.61192226", "0.61192226", "0.61192226", "0.60823536", "0.6059427", "0.60522795", "0.60518914", "0.60518914", "0.6046815", "0.6028584", "0.6028584", "0.6028584", "0.60179365", "0.60137576", "0.60132456", "0.60132456", "0.5999277", "0.5999277", "0.5999277", "0.5999277", "0.5999277", "0.5988651", "0.59857696", "0.59815013", "0.5975749", "0.5974226", "0.5972124", "0.59220827", "0.5920775", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5907102", "0.5880683", "0.5874116", "0.5842058", "0.583035", "0.58191645", "0.5799544", "0.5797567", "0.5778973", "0.57681614", "0.57599586", "0.57573783", "0.5742117", "0.57252187", "0.5699481", "0.56969", "0.5685209", "0.5672574", "0.56720424", "0.5667178", "0.56479436", "0.5640006", "0.563819", "0.56312895", "0.56215715", "0.560372", "0.56005317", "0.5591109", "0.55778885", "0.5562013", "0.5556047", "0.5549578", "0.5547946", "0.55203354", "0.55157036", "0.55133605", "0.55114144", "0.5501348", "0.5497102", "0.5484588", "0.5482832", "0.548016", "0.54528654" ]
0.0
-1
Multiplica a matriz m pelo vetor vec
function multMat4Vec4 (m, vec) { var tv = []; tv[0] = m[0][0] * vec[0] + m[0][1] * vec[1] + m[0][2] * vec[2] + m[0][3] * vec[3]; tv[1] = m[1][0] * vec[0] + m[1][1] * vec[1] + m[1][2] * vec[2] + m[1][3] * vec[3]; tv[2] = m[2][0] * vec[0] + m[2][1] * vec[1] + m[2][2] * vec[2] + m[2][3] * vec[3]; tv[3] = m[3][0] * vec[0] + m[3][1] * vec[1] + m[3][2] * vec[2] + m[3][3] * vec[3]; return tv; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mMulti(m,v){\n\tmMultiTest(m,v)\n\tconst newM = new Array(m.length)\n\tlet sum\n\tfor(let i=0;i<m.length;i++){\n\t\tnewM[i] = new Array()\n\t\tsum=0\n\t\tfor(let j=0;j<v.length;j++){\n\t\t\tsum += m[i][j] * v[j][0]\n\t\t}\n\t\tnewM[i][0] = sum\n\t}\n\n\treturn newM\n}", "function multiply(m, v)\r\n{\r\n var vv=vec4(\r\n m[0][0]*v[0] + m[0][1]*v[1] + m[0][2]*v[2]+ m[0][3]*v[3],\r\n m[1][0]*v[0] + m[1][1]*v[1] + m[1][2]*v[2]+ m[1][3]*v[3],\r\n m[2][0]*v[0] + m[2][1]*v[1] + m[2][2]*v[2]+ m[2][3]*v[3],\r\n m[3][0]*v[0] + m[3][1]*v[1] + m[3][2]*v[2]+ m[3][3]*v[3]);\r\n return vv;\r\n}", "function matmul(vec, mat) {\n const res = [];\n const m = vec.length;\n for (let col = 0; col < mat[0].length; ++col) {\n let tmp = 0;\n for (let row = 0; row < m; ++row) {\n tmp += vec[row] * mat[row][col];\n }\n res.push(tmp);\n }\n return res;\n}", "function mat_vector(m, v) {\n\tvar m11 = m[0], m12 = m[1], m13 = m[2], m21 = m[3], m22 = m[4], m23 = m[5];\n\tvar v11 = v[0], v21 = v[1];\n\treturn [m11*v11 + m12*v21 + m13,\n\t\t\tm21*v11 + m22*v21 + m23];\n}", "function multMatVec(u, v) {\n for ( var i = 0; i < u.length; ++i ) {\n if ( u[i].length != v.length ) {\n throw \"mult(): trying to add matrices of different dimensions\";\n }\n }\n\n let result = [];\n for ( var i = 0; i < u.length; ++i ) {\n let sum = 0;\n for ( var j = 0; j < u[i].length; ++j ) {\n sum += u[i][j] * v[j];\n }\n result.push( sum );\n }\n\n return result;\n}", "function mult4(mat, vec) {\n var result = [];\n for ( var i = 0; i < vec.length; ++i ) {\n var innerSum = 0;\n for (var j = 0; j < mat[i].length; ++j) {\n innerSum += vec[i] * mat[i][j];\n }\n result.push(innerSum);\n }\n return result;\n}", "multMatrixVector(m, v) {\n\t if (!(m instanceof p5.Matrix) || !(v instanceof p5.Vector)) {\n\t print('multMatrixVector : Invalid arguments');\n\t return;\n\t }\n\n\t var _dest = createVector();\n\t var mat = m.mat4;\n\n\t\t// Multiply in column major order.\n\t\t_dest.x = mat[0] * v.x + mat[4] * v.y + mat[8] * v.z + mat[12];\n\t\t_dest.y = mat[1] * v.x + mat[5] * v.y + mat[9] * v.z + mat[13];\n\t\t_dest.z = mat[2] * v.x + mat[6] * v.y + mat[10] * v.z + mat[14]; \n\t\tvar w = mat[3] * v.x + mat[7] * v.y + mat[11] * v.z + mat[15];\n\n\t\tif (Math.abs(w) > Number.EPSILON) {\n\t\t _dest.mult(1.0 / w);\n\t\t}\n\n\t\treturn _dest;\n\t}", "function multiply_point(M,V){\n var result = new Array(4);\n //Go through M \n for (var i=0; i < 4; i++){\n var vec1 = M.slice(0+i*4,4+i*4);\n\n result[i]= dot(vec1,V);\n }\n return result;\n\n}", "multiply(mat) {\n const m00 = this.v[0] * mat.v[0] + this.v[4] * mat.v[1] + this.v[8] * mat.v[2] + this.v[12] * mat.v[3];\n const m01 = this.v[0] * mat.v[4] + this.v[4] * mat.v[5] + this.v[8] * mat.v[6] + this.v[12] * mat.v[7];\n const m02 = this.v[0] * mat.v[8] + this.v[4] * mat.v[9] + this.v[8] * mat.v[10] + this.v[12] * mat.v[11];\n const m03 = this.v[0] * mat.v[12] + this.v[4] * mat.v[13] + this.v[8] * mat.v[14] + this.v[12] * mat.v[15];\n const m10 = this.v[1] * mat.v[0] + this.v[5] * mat.v[1] + this.v[9] * mat.v[2] + this.v[13] * mat.v[3];\n const m11 = this.v[1] * mat.v[4] + this.v[5] * mat.v[5] + this.v[9] * mat.v[6] + this.v[13] * mat.v[7];\n const m12 = this.v[1] * mat.v[8] + this.v[5] * mat.v[9] + this.v[9] * mat.v[10] + this.v[13] * mat.v[11];\n const m13 = this.v[1] * mat.v[12] + this.v[5] * mat.v[13] + this.v[9] * mat.v[14] + this.v[13] * mat.v[15];\n const m20 = this.v[2] * mat.v[0] + this.v[6] * mat.v[1] + this.v[10] * mat.v[2] + this.v[14] * mat.v[3];\n const m21 = this.v[2] * mat.v[4] + this.v[6] * mat.v[5] + this.v[10] * mat.v[6] + this.v[14] * mat.v[7];\n const m22 = this.v[2] * mat.v[8] + this.v[6] * mat.v[9] + this.v[10] * mat.v[10] + this.v[14] * mat.v[11];\n const m23 = this.v[2] * mat.v[12] + this.v[6] * mat.v[13] + this.v[10] * mat.v[14] + this.v[14] * mat.v[15];\n const m30 = this.v[3] * mat.v[0] + this.v[7] * mat.v[1] + this.v[11] * mat.v[2] + this.v[15] * mat.v[3];\n const m31 = this.v[3] * mat.v[4] + this.v[7] * mat.v[5] + this.v[11] * mat.v[6] + this.v[15] * mat.v[7];\n const m32 = this.v[3] * mat.v[8] + this.v[7] * mat.v[9] + this.v[11] * mat.v[10] + this.v[15] * mat.v[11];\n const m33 = this.v[3] * mat.v[12] + this.v[7] * mat.v[13] + this.v[11] * mat.v[14] + this.v[15] * mat.v[15];\n return this.setComponents(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33);\n }", "function addMatVec(m, v) {\n\t\treturn m.map(function(x, i, j) {\n\t\t\treturn x + v.get(j);\n\t\t});\n\t}", "function matrix_vector( M, v){\n\t\t\n\t\tb = [0.0, 0.0, 0.0];\n\t\tfor(i=0; i<3; i++){\n\t\t\tfor(j=0; j<3; j++){\n\t\t\t\tb[i] = b[i] + M[i][j] * v[j];\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn b;\n\t}", "multiply(mat) {\n const m00 = this.v[0] * mat.v[0] + this.v[2] * mat.v[1];\n const m01 = this.v[0] * mat.v[2] + this.v[2] * mat.v[3];\n const m10 = this.v[1] * mat.v[0] + this.v[3] * mat.v[1];\n const m11 = this.v[1] * mat.v[2] + this.v[3] * mat.v[3];\n return this.setComponents(m00, m01, m10, m11);\n }", "multiply(mat) {\n const m00 = this.v[0] * mat.v[0] + this.v[3] * mat.v[1] + this.v[6] * mat.v[2];\n const m01 = this.v[0] * mat.v[3] + this.v[3] * mat.v[4] + this.v[6] * mat.v[5];\n const m02 = this.v[0] * mat.v[6] + this.v[3] * mat.v[7] + this.v[6] * mat.v[8];\n const m10 = this.v[1] * mat.v[0] + this.v[4] * mat.v[1] + this.v[7] * mat.v[2];\n const m11 = this.v[1] * mat.v[3] + this.v[4] * mat.v[4] + this.v[7] * mat.v[5];\n const m12 = this.v[1] * mat.v[6] + this.v[4] * mat.v[7] + this.v[7] * mat.v[8];\n const m20 = this.v[2] * mat.v[0] + this.v[5] * mat.v[1] + this.v[8] * mat.v[2];\n const m21 = this.v[2] * mat.v[3] + this.v[5] * mat.v[4] + this.v[8] * mat.v[5];\n const m22 = this.v[2] * mat.v[6] + this.v[5] * mat.v[7] + this.v[8] * mat.v[8];\n return this.setComponents(m00, m01, m02, m10, m11, m12, m20, m21, m22);\n }", "function multMatrix(m) {\n modelView = mult(modelView, m);\n}", "function multMatrix(m) {\n modelView = mult(modelView, m);\n}", "function _vecInContext(v, m) {\n return [\n v[0] * m[0] + v[1] * m[4] + v[2] * m[8],\n v[0] * m[1] + v[1] * m[5] + v[2] * m[9],\n v[0] * m[2] + v[1] * m[6] + v[2] * m[10]\n ];\n }", "function multiply_matrix(M,N){\n var result = new Array(16);\n var index = 0;\n //Go through M \n for (var i=0; i < 4; i++){\n var vec1 = M.slice(0+i*4,4+i*4);\n vec1 = [ M[i], M[i+4], M[i+8], M[i+12]];\n //Go through N\n for (var j=0; j < 4; j++){\n var vec2 = [ N[j], N[j+4], N[j+8], N[j+12]];\n vec2 = N.slice(0+j*4,4+j*4);\n result[index]= dot(vec1,vec2);\n index++;\n }\n }\n return transpose(result);\n\n}", "function _vecInContext(v, m) {\n\t return [\n\t v[0] * m[0] + v[1] * m[4] + v[2] * m[8],\n\t v[0] * m[1] + v[1] * m[5] + v[2] * m[9],\n\t v[0] * m[2] + v[1] * m[6] + v[2] * m[10]\n\t ];\n\t }", "function matrix_multiply(m1, m2) {\n \n let mat = [];\n for (let i = 0; i < m1.length; i++){\n mat[i] = [];\n for (let j = 0; j < m2[0].length; j++){\n mat[i][j] = 0;\n for (let k = 0; k < m2.length; k++)\n mat[i][j] += m1[i][k]*m2[k][j];\n }\n }\n\n return mat;\n}", "function xformMatrix(m, v) {\n var out = [0, 0, 0, 0];\n var i, j;\n\n for(i = 0; i < 4; ++i) {\n for(j = 0; j < 4; ++j) {\n out[j] += m[4 * i + j] * v[i];\n }\n }\n\n return out;\n}", "times(b) {\r\n const len = b.length; // Usage: M.times(b) where b can be a scalar, a Vec, or another Mat. Returns a new Mat.\r\n if (typeof len === \"undefined\") return this.map(r => r.map(x => b * x)); // Mat * scalar case.\r\n const len2 = b[0].length;\r\n if (typeof len2 === \"undefined\") {\r\n let result = Vec.of(...new Array(this.length)); // Mat * Vec case.\r\n for (var r = 0; r < len; r++) result[r] = b.dot(this[r]);\r\n return result;\r\n }\r\n let result = Mat.from(new Array(this.length));\r\n for (let r = 0; r < this.length; r++) // Mat * Mat case.\r\n {\r\n result[r] = new Array(len2);\r\n for (let c = 0, sum = 0; c < len2; c++) {\r\n result[r][c] = 0;\r\n for (let r2 = 0; r2 < len; r2++)\r\n result[r][c] += this[r][r2] * b[r2][c];\r\n }\r\n }\r\n return result;\r\n }", "Multiply(values) {\n let vec = new VecX(values);\n while (vec.size < this.size) {\n vec.values.push(vec.values[0]);\n }\n ;\n this.values = this.values.map((val, index) => val * vec.values[index]);\n return this;\n }", "function multiplyVect(vector, scalar) {\n return [ scalar * vector[0],\n scalar * vector[1],\n scalar * vector[2]\n ];\n}", "function multVector (vec1, multiplier) {\n return [vec1[X] * multiplier, vec1[Y] * multiplier];\n}", "function matrix_multiply(m1, m2) {\n\n var mat = [];\n var i,j,k;\n for (i = 0; i < m1.length; i++){\n mat[i] = [];\n for (j = 0; j < m2[0].length; j++){\n mat[i][j] = 0;\n for (k = 0; k < m2.length; k++){\n mat[i][j] += m1[i][k]*m2[k][j];\n }\n }\n }\n\n return mat;\n}", "multiply(number) {\r\n return new Vector(...new Array(this.getDimensions()).fill(undefined).map((e, i) => this.values[i] * number));\r\n }", "function setmulvec(dest, a, b){\n for(var i = a.length; i--;) dest[i] = a[i] * b[i];\n}", "function vmul(m, v){\n v = v.slice();\n //homog coord\n v.push(1);\n var ret = [0, 0, 0, 0];\n for (var r = 0; r < 4; r++) {\n for (var i = 0; i < 4; i++) {\n ret[r] += m[r][i] * v[i];\n }\n }\n return ret.slice(0,-1);\n }", "function matrixMultiply(arrOne, arrTwo) {\n\n}", "function multMatrix(A,H){\r\n\tvar M = [[0,0,0],[0,0,0],[0,0,0]];\r\n\tvar ic = 0;\r\n\tvar mc = 0;\r\n\tfor(mc=0;mc<3;mc++){\r\n\t\tfor(ic=0;ic<3;ic++){\r\n\t\t\tvar cell = 0;\r\n\t\t\tfor(cell=0;cell<3;cell++){\r\n\t\t\t\tM[mc][ic] = M[mc][ic] + A[cell][ic]*H[mc][cell];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn M;\r\n}", "function ij_elem_mult(i, j) {\n // not using get_row and get_col bcs slightly diff here\n const row_of_mat1 = list_ref(mat1, i);\n const col_of_mat2 = map(rows => list_ref(rows, j), mat2);\n const multiplied = list_op((x, y) => x * y, row_of_mat1, col_of_mat2);\n return accumulate((x,y) => x + y, 0, multiplied);\n }", "scale (vec, m) {\n return [vec[0] * m, vec[1] * m];\n }", "scale (vec, m) {\n return [vec[0] * m, vec[1] * m];\n }", "scale (vec, m) {\n return [vec[0] * m, vec[1] * m];\n }", "scale (vec, m) {\n return [vec[0] * m, vec[1] * m];\n }", "scale(vec, m) {\n return [vec[0] * m, vec[1] * m];\n }", "scale(vec, m) {\n return [vec[0] * m, vec[1] * m];\n }", "multiply(matrix) {\n return this.clone().multiplyO(matrix);\n }", "function matrixMult(m1, m2) {\n\tvar m00 = m1[0][0] * m2[0][0] + m1[0][1] * m2[1][0];\n\tvar m01 = m1[0][0] * m2[0][1] + m1[0][1] * m2[1][1];\n\tvar m10 = m1[1][0] * m2[0][0] + m1[1][1] * m2[1][0];\n\tvar m11 = m1[1][0] * m2[0][1] + m1[1][1] * m2[1][1];\n return [[m00, m01], [m10, m11]];\n}", "static prod(M1,M2) {\r\n if(!(M1 instanceof Matrix) || !(M2 instanceof Matrix)) {\r\n console.log(Matrix.wrong_type_error_message2());\r\n return null;\r\n }\r\n if(M1.cols != M2.rows) {\r\n console.log(Matrix.wrong_dim_error_message());\r\n return null;\r\n }\r\n let result = new Matrix(M1.rows,M2.cols);\r\n let helper = M2.transpose();\r\n result.data = result.data.map((rows,main_index) => {\r\n return rows.map((col,sub_index) => {\r\n return Matrix.array_mult(M1.data[main_index],helper.data[sub_index]);\r\n });\r\n });\r\n return result;\r\n }", "scale (vec, m) {\n\t return [vec[0] * m, vec[1] * m];\n\t }", "function matmp(a,b){\n\tvar ret = new Array(6);\n\tfor(var i = 0; i < 3; i++){\n\t\tfor(var j = 0; j < 2; j++){\n\t\t\tvar val = 0;\n\t\t\tfor(var k = 0; k < 2; k++)\n\t\t\t\tval += a[k * 2 + j] * b[i * 2 + k];\n\t\t\tif(i === 2)\n\t\t\t\tval += a[2 * 2 + j];\n\t\t\tret[i * 2 + j] = val;\n\t\t}\n\t}\n\treturn ret;\n}", "function matrix_multiply(m1,m2) {\n // returns 2D array that is the result of m1*m2\n\n var res = new Array(m1.length) // creating a placeholder\n\n for (i = 0; i < m1.length; i++){\n res[i] = new Array(m2[0].length)\n for (j = 0; j < m2[0].length; j++){\n var temp = 0\n for (k = 0; k < m2.length; k++){\n temp += m1[i][k] * m2[k][j]\n }\n res[i][j] = temp\n }\n }\n return res\n}", "function multiply(M1, M2) {\n // prep\n var M = [];\n var dims = [M1.length, M1[0].length, M2.length, M2[0].length];\n // work\n for (var r=0, c; r<dims[0]; r++) {\n M[r] = [];\n var _row = row(M1, r);\n for (c=0; c<dims[3]; c++) {\n var _col = col(M2,c);\n var reducer = (a,v,i) => a + _col[i]*v;\n M[r][c] = _row.reduce(reducer, 0);\n }\n }\n return M;\n}", "scale(vec, m) {\n return [vec[0] * m, vec[1] * m];\n }", "scale(vec, m) {\n return [vec[0] * m, vec[1] * m];\n }", "scale(vec, m) {\n return [vec[0] * m, vec[1] * m];\n }", "scale(vec, m) {\n return [vec[0] * m, vec[1] * m];\n }", "scale(vec, m) {\n return [vec[0] * m, vec[1] * m];\n }", "static prod(mats)\n\t{\n\t\tif (mats.length == 0) {\n\t\t\treturn Matrix.identity();\n\t\t}\n\t\tvar result = mats[0];\n\t\tfor (var i=1; i<mats.length; ++i) {\n\t\t\tresult = Matrix.mul(result, mats[i]);\n\t\t}\n\t\treturn result;\n\t}", "function vec4multMat4(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}", "function vec4multMat4(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}", "function vec4multMat4(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}", "function multiplyMatrix4x4(...matricies) {\r\n return matricies.reduce((a, b) => {\r\n return [\r\n b[0] * a[0] + b[1] * a[4] + b[2] * a[8] + b[3] * a[12],\r\n b[0] * a[1] + b[1] * a[5] + b[2] * a[9] + b[3] * a[13],\r\n b[0] * a[2] + b[1] * a[6] + b[2] * a[10] + b[3] * a[14],\r\n b[0] * a[3] + b[1] * a[7] + b[2] * a[11] + b[3] * a[15],\r\n b[4] * a[0] + b[5] * a[4] + b[6] * a[8] + b[7] * a[12],\r\n b[4] * a[1] + b[5] * a[5] + b[6] * a[9] + b[7] * a[13],\r\n b[4] * a[2] + b[5] * a[6] + b[6] * a[10] + b[7] * a[14],\r\n b[4] * a[3] + b[5] * a[7] + b[6] * a[11] + b[7] * a[15],\r\n b[8] * a[0] + b[9] * a[4] + b[10] * a[8] + b[11] * a[12],\r\n b[8] * a[1] + b[9] * a[5] + b[10] * a[9] + b[11] * a[13],\r\n b[8] * a[2] + b[9] * a[6] + b[10] * a[10] + b[11] * a[14],\r\n b[8] * a[3] + b[9] * a[7] + b[10] * a[11] + b[11] * a[15],\r\n b[12] * a[0] + b[13] * a[4] + b[14] * a[8] + b[15] * a[12],\r\n b[12] * a[1] + b[13] * a[5] + b[14] * a[9] + b[15] * a[13],\r\n b[12] * a[2] + b[13] * a[6] + b[14] * a[10] + b[15] * a[14],\r\n b[12] * a[3] + b[13] * a[7] + b[14] * a[11] + b[15] * a[15],\r\n ];\r\n });\r\n}", "function vec4multMat4(out, a, m) {\n\t var x = a[0], y = a[1], z = a[2], w = a[3];\n\t out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n\t out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n\t out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n\t out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\t return out;\n\t}", "function vec4multMat4(out, a, m) {\n\t var x = a[0], y = a[1], z = a[2], w = a[3];\n\t out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n\t out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n\t out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n\t out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\t return out;\n\t}", "function matrix_multiply(m1, m2) {\n var result = [];\n for (var i = 0; i < m1.length; i++) {\n result[i] = [];\n for (var j = 0; j < m2[0].length; j++) {\n var sum = 0;\n for (var k = 0; k < m1[0].length; k++) {\n sum += m1[i][k] * m2[k][j];\n }\n result[i][j] = sum;\n }\n }\n return result;\n}", "function mulMatrixPoint(matrix, point)\n{\n return new THREE.Vector3(\n matrix.elements[0]*point.x + matrix.elements[4]*point.y + matrix.elements[8]*point.z + matrix.elements[12],\n matrix.elements[1]*point.x + matrix.elements[5]*point.y + matrix.elements[9]*point.z + matrix.elements[13],\n matrix.elements[2]*point.x + matrix.elements[6]*point.y + matrix.elements[10]*point.z + matrix.elements[14]\n );\n}", "function scale (vec, m) {\n return [vec[0] * m, vec[1] * m];\n }", "static mult(a, b) {\n let x = [];\n for (let row = 0; row < a.length; row++) {\n let y = [];\n for (let col = 0; col < b[0].length; col++) {\n let sum = 0;\n for (let k = 0; k < b.length; k++) {\n sum += a[row][k] * b[k][col];\n }\n y.push(sum);\n }\n x.push(y);\n }\n return x;\n }", "function addmulvec(dest, a, b){\n for(var i = a.length; i--;) dest[i] += a[i] * b[i];\n}", "function mulTranspose(val)\n{\n\tif(typeof val != typeof this)\n\t{\n\t\tthrow \"Incompatible types\";\n\t}\n\telse\n\t{\n\t\tif(this.size.x != val.size.y)\n\t\t{\n\t\t\tthrow \"Matrix cant be multiplied (check matrix size)\";\n\t\t}\n\n\t\tvar mat = new Matrix(this.size.y, val.size.x);\n\t\tfor(var i = 0; i < this.size.y; i++)\n\t\t{\n\t\t\tfor(var j = 0; j < val.size.x; j++)\n\t\t\t{\n\t\t\t\tvar sum = 0;\n\t\t\t\tfor(var k = 0; k < this.size.x; k++)\n\t\t\t\t{\n\t\t\t\t\tsum += this.matrix[k][i] * val.matrix[j][k];\n\t\t\t\t}\n\t\t\t\tmat.matrix[i][j] = sum;\n\t\t\t}\n\t\t}\n\n\t\tthis.matrix = mat.matrix;\n\t\tthis.size.x = mat.size.x;\n\t\tthis.size.y = mat.size.y;\n\t}\n}", "function dotMultiply(a, c){\n var temp = [];\n for (var i = a._data.length - 1; i >= 0; i--) {\n var t = []\n for (var j = a._data[0].length - 1; j >= 0; j--) {\n t.push([c*a._data[i][j]]);\n };\n temp.push(t);\n };\n\n return math.matrix(temp);\n}", "function scale (vec, m) {\n return [vec[0] * m, vec[1] * m];\n}", "function m_modVec(v) //objet x, y\n{\n return Math.sqrt(v.x*v.x + v.y*v.y);\n}", "function matrixMultiply() {\n \"use strict\";\n\n var i;\n var j;\n var k;\n\n newComposite = new Array(composite.length);\n\n for (i = 0; i < newComposite.length; i += 1) {\n newComposite[i] = new Array(newTransform[i].length);\n for (j = 0; j < composite.length; j += 1) {\n newComposite[i][j] = 0; // initialise to 0\n for (k = 0; k < newTransform.length; k += 1) {\n newComposite[i][j] += composite[i][k] * newTransform[k][j]; // multiply matrices together\n }\n }\n }\n composite = newComposite;\n}", "function mult2d(u, k)\r\n{\r\n return [u[0]*k, u[1]*k]\r\n}", "static matrixMultiply(l, r, o) {\n // Work out the product directly\n var a = l.a * r.a + l.c * r.b;\n var b = l.b * r.a + l.d * r.b;\n var c = l.a * r.c + l.c * r.d;\n var d = l.b * r.c + l.d * r.d;\n var e = l.e + l.a * r.e + l.c * r.f;\n var f = l.f + l.b * r.e + l.d * r.f; // make sure to use local variables because l/r and o could be the same\n\n o.a = a;\n o.b = b;\n o.c = c;\n o.d = d;\n o.e = e;\n o.f = f;\n return o;\n }", "function multRows(matrix, row, scalar){\n for (let i=0; i < matrix[row].length; i++){\n //matrix[row][i] *= scalar;\n matrix[row][i] = matrix[row][i].mul(scalar);\n }\n return matrix;\n}", "mulMat4v4(m, v, dest = math.vec4()) {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n dest[0] = m[0] * v0 + m[4] * v1 + m[8] * v2 + m[12] * v3;\n dest[1] = m[1] * v0 + m[5] * v1 + m[9] * v2 + m[13] * v3;\n dest[2] = m[2] * v0 + m[6] * v1 + m[10] * v2 + m[14] * v3;\n dest[3] = m[3] * v0 + m[7] * v1 + m[11] * v2 + m[15] * v3;\n return dest;\n }", "function productoCruz(vectores, indice, longitud) {\n longitud = arregloDosDimensiones[1].length;\n indice = arregloDosDimensiones[0].length;\n var suma = 0;\n var longitudv = 3;\n var multiplicado = 0;\n for (indice = 0; indice <= 3; indice++) {\n longitud = longitudv - 1;\n multiplicado = arregloDosDimensiones[0][indice] * arregloDosDimensiones[1][longitud];\n suma = suma + multiplicado;\n }\n}", "function MatrixMult( A, B )\r\n{\r\n\tvar C = [];\r\n\tfor ( var i=0; i<4; ++i ) \r\n\t{\r\n\t\tfor ( var j=0; j<4; ++j ) \r\n\t\t{\r\n\t\t\tvar v = 0;\r\n\t\t\tfor ( var k=0; k<4; ++k ) \r\n\t\t\t{\r\n\t\t\t\tv += A[j+4*k] * B[k+4*i];\r\n\t\t\t}\r\n\t\t\tC.push(v);\r\n\t\t}\r\n\t}\r\n\treturn C;\r\n}", "function mulMatrix(m, k) {\n mulStoreMatrix(m, m, k);\n}", "mult(m) {\n this.opFunc((x1, x2) => x1 * x2, m);\n }", "function matrixMultiply(matrix_1, matrix_2) {\n var matrix_3 = [[],[]];\n console.log(matrix_1.length);\n for(var i = 0; i < matrix_1.length; i++) {\n for(var j = 0; j < matrix_1.length; j++) {\n matrix_3[i][j] = (matrix_1[i][0] * matrix_2[0][j]) + (matrix_1[i][1] * matrix_2[1][j]);\n }\n }\n return matrix_3;\n}", "function multMatrix(mA, mB){\r\n let result = [0, 0, 0];\r\n let sum = 0;\r\n for(let i = 0; i < mA.length; ++i){\r\n for(let j = 0; j < 1; ++j){\r\n sum = 0;\r\n for(let k = 0; k < 1; ++k){\r\n sum = sum + mA[i + k] * mB[j + k]\r\n }\r\n result[j + i * 1] = sum;\r\n } \r\n }\r\n return result;\r\n}", "prod_esc(vec){ return (vec.x*this.x + vec.y*this.y + vec.z*this.z);}", "function comp_prod(m1,m2){\n\t// multiply component-wise\n\tconst ret = m1.map((row,i)=> row.map((col,j)=> m1[i][j]*m2[i][j]));\n\treturn ret;\n}", "scalingMat3v(v, m = math.identityMat3()) {\n m[0] = v[0];\n m[4] = v[1];\n return m;\n }", "function multiply_matrix_by_matrix(matrix_a, matrix_b) {\n let product_of_matrices = [\n [0, 0],\n [0, 0]\n ]\n\n product_of_matrices[0][0] = matrix_a[0][0] * matrix_b[0][0]\n product_of_matrices[0][0] += matrix_a[0][1] * matrix_b[1][0]\n\n product_of_matrices[0][1] = matrix_a[0][0] * matrix_b[0][1]\n product_of_matrices[0][1] += matrix_a[0][1] * matrix_b[1][1]\n\n product_of_matrices[1][0] = matrix_a[1][0] * matrix_b[0][0]\n product_of_matrices[1][0] += matrix_a[1][1] * matrix_b[1][0]\n\n product_of_matrices[1][1] = matrix_a[1][0] * matrix_b[0][1]\n product_of_matrices[1][1] += matrix_a[1][1] * matrix_b[1][1]\n\n return product_of_matrices\n}", "static multiplyScalar(v, s) {\n\t\treturn new vector(v.x*s, v.y*s);\n\t}", "function matrixMultiply(mat2, mat1) {\n return [mat1[0] * mat2[0] + mat1[1] * mat2[4] + mat1[2] * mat2[8] + mat1[3] * mat2[12], mat1[0] * mat2[1] + mat1[1] * mat2[5] + mat1[2] * mat2[9] + mat1[3] * mat2[13], mat1[0] * mat2[2] + mat1[1] * mat2[6] + mat1[2] * mat2[10] + mat1[3] * mat2[14], mat1[0] * mat2[3] + mat1[1] * mat2[7] + mat1[2] * mat2[11] + mat1[3] * mat2[15], mat1[4] * mat2[0] + mat1[5] * mat2[4] + mat1[6] * mat2[8] + mat1[7] * mat2[12], mat1[4] * mat2[1] + mat1[5] * mat2[5] + mat1[6] * mat2[9] + mat1[7] * mat2[13], mat1[4] * mat2[2] + mat1[5] * mat2[6] + mat1[6] * mat2[10] + mat1[7] * mat2[14], mat1[4] * mat2[3] + mat1[5] * mat2[7] + mat1[6] * mat2[11] + mat1[7] * mat2[15], mat1[8] * mat2[0] + mat1[9] * mat2[4] + mat1[10] * mat2[8] + mat1[11] * mat2[12], mat1[8] * mat2[1] + mat1[9] * mat2[5] + mat1[10] * mat2[9] + mat1[11] * mat2[13], mat1[8] * mat2[2] + mat1[9] * mat2[6] + mat1[10] * mat2[10] + mat1[11] * mat2[14], mat1[8] * mat2[3] + mat1[9] * mat2[7] + mat1[10] * mat2[11] + mat1[11] * mat2[15], mat1[12] * mat2[0] + mat1[13] * mat2[4] + mat1[14] * mat2[8] + mat1[15] * mat2[12], mat1[12] * mat2[1] + mat1[13] * mat2[5] + mat1[14] * mat2[9] + mat1[15] * mat2[13], mat1[12] * mat2[2] + mat1[13] * mat2[6] + mat1[14] * mat2[10] + mat1[15] * mat2[14], mat1[12] * mat2[3] + mat1[13] * mat2[7] + mat1[14] * mat2[11] + mat1[15] * mat2[15]];\n}", "function scalar(u,v){\r\n\t\tvar i =0;\r\n\t\tvar res =0;\r\n\t\tfor(i=0;i<u.length;i++)\r\n\t\t\tres += u[i]*v[i];\r\n\t\treturn res;\r\n\t}", "mult(n) {\n if(n instanceof Matrix && this.cols === n.rows) {\n const result = new Matrix(this.rows, n.cols);\n for(let row = 0; row < result.rows; row++) { // resulting matrix will have dimensions of the 1st matrix's rows and the # of columns in the 2nd matrix\n for(let col = 0; col < result.cols; col++) {\n let sum = 0;\n for(let index = 0; index < this.cols; index++) {\n sum += this.matrix[row][index] * n.matrix[index][col];\n }\n result.matrix[row][col] = sum;\n }\n }\n this.matrix = result.matrix;\n } else {\n for(let row = 0; row < this.rows; row++) {\n for(let col = 0; col < this.cols; col++) {\n this.matrix[row][col] *= n;\n }\n }\n }\n this.print();\n return this;\n }", "static mult(m1, m2) {\n return Matrix.opFunc((x1, x2) => x1 * x2, m1, m2);\n }", "function Matrix(mm) {\n\tvar\n\t\tself=this,\n\t\tM=mm;\n\t\t\n\tjQuery.extend(self,{\n\t\tmult: function(mm) {\n\t\t\tvar m=mm.M?mm.M:mm;\n\t\t\t\n\t\t\tvar result = new Array(4);\n\t\t\tfor (var i = 0; i<4;i++) {\n\t\t\t\tresult[i] = new Array(4);\n\t\t\t}\n\t\t\t\n\t\t\tfor(var i = 0; i < 4; i++){\n\t\t\t\tresult[i][0] = M[i][0] * m[0][0] + M[i][1] * m[1][0] + M[i][2] * m[2][0] + M[i][3] * m[3][0];\n\t\t\t\tresult[i][1] = M[i][0] * m[0][1] + M[i][1] * m[1][1] + M[i][2] * m[2][1] + M[i][3] * m[3][1];\n\t\t\t\tresult[i][2] = M[i][0] * m[0][2] + M[i][1] * m[1][2] + M[i][2] * m[2][2] + M[i][3] * m[3][2];\n\t\t\t\tresult[i][3] = M[i][0] * m[0][3] + M[i][1] * m[1][3] + M[i][2] * m[2][3] + M[i][3] * m[3][3];\n\t\t\t}\n\t\t\t\n\t\t\treturn new Matrix(result);\n\t\t},\n\t\t\n\t\tadd: function(mm) {\n\t\t\tvar m=mm.M?mm.M:mm;\n\t\t\t\n\t\t\tvar result = new Array(4);\n\t\t\tfor (var i = 0; i<4;i++) {\n\t\t\t\tresult[i] = new Array(4);\n\t\t\t}\n\t\t\t\n\t\t\tfor (var i=0; i<4; i++)\n\t\t\t\tfor (var j=0; j<4; j++)\n\t\t\t\t\tresult[i][j]=M[i][j]+m[i][j];\n\n\t\t\treturn new Matrix(result);\n\t\t},\n\t\t\n\t\t// the matrix\n\t\t'M': M\n\t});\n}", "multNormalMatrix(matrix) {\n let x = this[0];\n let y = this[1];\n let z = this[2];\n\n let S = new J3DIMatrix4(matrix);\n S.invert();\n S.transpose();\n\n this[0] = S.$matrix.m41 + x * S.$matrix.m11 + y * S.$matrix.m21 + z * S.$matrix.m31;\n this[1] = S.$matrix.m42 + x * S.$matrix.m12 + y * S.$matrix.m22 + z * S.$matrix.m32;\n this[2] = S.$matrix.m43 + x * S.$matrix.m13 + y * S.$matrix.m23 + z * S.$matrix.m33;\n let w = S.$matrix.m44 + x * S.$matrix.m14 + y * S.$matrix.m24 + z * S.$matrix.m34;\n if (w != 1 && w != 0) {\n this[0] /= w;\n this[1] /= w;\n this[2] /= w;\n }\n\n return this;\n }", "function multiplyMatrix (A, B) {\n var result = new Array(A.length).fill(0).map(row => new Array(B[0].length).fill(0));\n\n return result.map((row, i) => {\n return row.map((val, j) => {\n return A[i].reduce((sum, elm, k) => sum + (elm*B[k][j]) ,0)\n })\n })\n}", "static mul(mat1, mat2)\n\t{\n\t\tvar result = [];\n\t\tfor (var row=0; row<4; ++row) { //row of result\n\t\t\tfor (var col=0; col<4; ++col) { //col of result\n\t\t\t\tresult.push(Matrix.mul_helper(row, col, mat1, mat2));\n\t\t\t}\n\t\t}\n\t\treturn new Float32Array(result);\n\t}", "function Vx(v,x){\r\n\tvar j=0;\r\n\tvar w = new Array();\r\n\tfor(j=0;j<v.length;j++){\r\n\t\tw[j] = v[j]*x;\r\n\t}\r\n\treturn w;\r\n}", "function setValueM2( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix2fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat2array.set( elements );\n\n\t\tgl.uniformMatrix2fv( this.addr, false, mat2array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}", "function matrixMultiply(matrix1, matrix2) {\n let newMatrix = [[], []];\n for (let i=0; i<matrix1.length; i++) {\n for (let j=0; j<matrix1[0].length; j++) {\n newMatrix[i].push(matrix1[i][0] * matrix2[0][j] + matrix1[i][1] * matrix2[1][j]);\n }\n }\n return newMatrix;\n}", "multiply(multiplier) {\n return new Vector(this.x * multiplier, this.y * multiplier);\n }", "function setValueM2( gl, v ) {\n\n\t\tconst cache = this.cache;\n\t\tconst elements = v.elements;\n\n\t\tif ( elements === undefined ) {\n\n\t\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\t\tgl.uniformMatrix2fv( this.addr, false, v );\n\n\t\t\tcopyArray( cache, v );\n\n\t\t} else {\n\n\t\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\t\tmat2array.set( elements );\n\n\t\t\tgl.uniformMatrix2fv( this.addr, false, mat2array );\n\n\t\t\tcopyArray( cache, elements );\n\n\t\t}\n\n\t}", "function setValueM2( gl, v ) {\n\n\t\tconst cache = this.cache;\n\t\tconst elements = v.elements;\n\n\t\tif ( elements === undefined ) {\n\n\t\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\t\tgl.uniformMatrix2fv( this.addr, false, v );\n\n\t\t\tcopyArray( cache, v );\n\n\t\t} else {\n\n\t\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\t\tmat2array.set( elements );\n\n\t\t\tgl.uniformMatrix2fv( this.addr, false, mat2array );\n\n\t\t\tcopyArray( cache, elements );\n\n\t\t}\n\n\t}", "function setValueM2Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniformMatrix2fv( this.addr, false, data );\n\n}", "transformO(m) {\n if (!Matrix.isMatrixLike(m)) {\n m = new Matrix(m)\n }\n\n for (let i = this.length; i--; ) {\n // Perform the matrix multiplication\n const [x, y] = this[i]\n this[i][0] = m.a * x + m.c * y + m.e\n this[i][1] = m.b * x + m.d * y + m.f\n }\n\n return this\n }", "function matrix_multiply(ae, be, res){\n var a11 = ae[0][0], a12 = ae[0][1], a13 = ae[0][2], a14 = ae[0][3]\n var a21 = ae[1][0], a22 = ae[1][1], a23 = ae[1][2], a24 = ae[1][3]\n var a31 = ae[2][0], a32 = ae[2][1], a33 = ae[2][2], a34 = ae[2][3]\n var a41 = ae[3][0], a42 = ae[3][1], a43 = ae[3][2], a44 = ae[3][3]\n\n var b11 = be[0][0], b12 = be[0][1], b13 = be[0][2], b14 = be[0][3]\n var b21 = be[1][0], b22 = be[1][1], b23 = be[1][2], b24 = be[1][3]\n var b31 = be[2][0], b32 = be[2][1], b33 = be[2][2], b34 = be[2][3]\n var b41 = be[3][0], b42 = be[3][1], b43 = be[3][2], b44 = be[3][3]\n\n res[0][0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41\n res[0][1] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42\n res[0][2] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43\n res[0][3] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44\n\n res[1][0] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41\n res[1][1] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42\n res[1][2] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43\n res[1][3] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44\n\n res[2][0] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41\n res[2][1] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42\n res[2][2] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43\n res[2][3] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44\n\n res[3][0] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41\n res[3][1] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42\n res[3][2] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43\n res[3][3] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44\n}", "static multiplicationElementwise(m, n)\n {\n let newArr = new Synaptic_Matrix(m.rows, m.cols);\n\n if (n instanceof Synaptic_Matrix)\n {\n for (let i = 0; i < m.rows; i++)\n {\n for (let j = 0; j < m.cols; j++)\n {\n newArr.matrix[i][j] = m.matrix[i][j] * n.matrix[i][j];\n }\n }\n }\n else\n {\n for (let i = 0; i < m.rows; i++)\n {\n for (let j = 0; j < m.cols; j++)\n {\n newArr.matrix[i][j] = m.matrix[i][j] * n;\n }\n }\n }\n\n return newArr;\n }", "static multiply(a, b) {\n if (a.cols !== b.rows) {\n console.log('Cols of A must match rows of B');\n return undefined;\n }\n let result = new Matrix(a.rows, b.cols);\n for (let i = 0; i < result.rows; i++) {\n for (let j = 0; j < result.cols; j++) {\n // Dot product of values in col\n let sum = 0;\n for (let k = 0; k < a.cols; k++) {\n sum += a.data[i][k] * b.data[k][j];\n }\n result.data[i][j] = sum;\n }\n }\n return result;\n }" ]
[ "0.7930833", "0.77567196", "0.7678945", "0.7560042", "0.7467438", "0.7455137", "0.7390336", "0.71322954", "0.7122181", "0.7071654", "0.6920668", "0.68371475", "0.6811439", "0.6785799", "0.6785799", "0.6747603", "0.67365104", "0.66754806", "0.66000164", "0.65744895", "0.65739286", "0.65166724", "0.65081453", "0.65066284", "0.6467325", "0.6460032", "0.64351594", "0.64117515", "0.63989055", "0.63890916", "0.63877064", "0.6380869", "0.6380869", "0.6380869", "0.6380869", "0.6378618", "0.6378618", "0.6355839", "0.6348759", "0.6345408", "0.6344352", "0.6343223", "0.63207144", "0.6277817", "0.62767833", "0.62767833", "0.62767833", "0.62767833", "0.62767833", "0.62688464", "0.626844", "0.626844", "0.626844", "0.6248727", "0.6244281", "0.6244281", "0.6226026", "0.6207357", "0.6202239", "0.6199374", "0.61910945", "0.61876094", "0.61765635", "0.616019", "0.6154526", "0.6097122", "0.60853994", "0.6076083", "0.60679847", "0.60631543", "0.60587484", "0.6057044", "0.6054556", "0.6053095", "0.6047171", "0.603963", "0.6036571", "0.60269266", "0.6026924", "0.6020359", "0.6004218", "0.5993903", "0.5992118", "0.59818274", "0.5978516", "0.59769714", "0.59699714", "0.5955864", "0.59388554", "0.5935228", "0.59325325", "0.59297985", "0.5916793", "0.5887366", "0.5887366", "0.58820295", "0.5869515", "0.5859083", "0.5854223", "0.58453673" ]
0.679414
13
Dada a coordenada e a matriz de projecao multiplicada pela matriz de modelagem devolve a coordenada desse vetor na tela 2D e a sua profundidade com relacao a camera
function unproject (vec, im) { var dest = []; //output var tv = []; //transformed vector tv = multMat4Vec4(im, vec); if(tv[3] == 0.0) { return null; } dest[0] = tv[0] / tv[3]; dest[1] = tv[1] / tv[3]; dest[2] = tv[2] / tv[3]; dest[3] = 0.0; return dest; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateMatrices() {\n this.projection = perspective(this.fieldOfViewY, this.aspect, this.near, this.far);\n const up = vec3(0, 1, 0);\n this.view = lookAt(this.eye, this.at, up);\n this.viewProjection = mult(this.projection, this.view);\n }", "update(viewMatrix, projectionMatrix) {\n _math_Matrix44__WEBPACK_IMPORTED_MODULE_0__[\"default\"].multiplyTo(projectionMatrix, viewMatrix, this.__vp);\n this.zNear.x = this.__vp.m20 + this.__vp.m30;\n this.zNear.y = this.__vp.m21 + this.__vp.m31;\n this.zNear.z = this.__vp.m22 + this.__vp.m32;\n this.zNear.w = this.__vp.m23 + this.__vp.m33;\n this.zNear.normalize3();\n this.zFar.x = -this.__vp.m20 + this.__vp.m30;\n this.zFar.y = -this.__vp.m21 + this.__vp.m31;\n this.zFar.z = -this.__vp.m22 + this.__vp.m32;\n this.zFar.w = -this.__vp.m23 + this.__vp.m33;\n this.zFar.normalize3();\n this.bottom.x = this.__vp.m10 + this.__vp.m30;\n this.bottom.y = this.__vp.m11 + this.__vp.m31;\n this.bottom.z = this.__vp.m12 + this.__vp.m32;\n this.bottom.w = this.__vp.m13 + this.__vp.m33;\n this.bottom.normalize3();\n this.top.x = -this.__vp.m10 + this.__vp.m30;\n this.top.y = -this.__vp.m11 + this.__vp.m31;\n this.top.z = -this.__vp.m12 + this.__vp.m32;\n this.top.w = -this.__vp.m13 + this.__vp.m33;\n this.top.normalize3();\n this.left.x = this.__vp.m00 + this.__vp.m30;\n this.left.y = this.__vp.m01 + this.__vp.m31;\n this.left.z = this.__vp.m02 + this.__vp.m32;\n this.left.w = this.__vp.m03 + this.__vp.m33;\n this.left.normalize3();\n this.right.x = -this.__vp.m00 + this.__vp.m30;\n this.right.y = -this.__vp.m01 + this.__vp.m31;\n this.right.z = -this.__vp.m02 + this.__vp.m32;\n this.right.w = -this.__vp.m03 + this.__vp.m33;\n this.right.normalize3();\n }", "project(ax, ay, az, angles){\r\n var x = ax - this.camera_p.x;\r\n var y = ay - this.camera_p.y;\r\n var z = az - this.camera_p.z;\r\n \r\n var dx = angles.cy*(angles.sz*y + angles.cz*x) - angles.sy*z;\r\n var dy = angles.sx*(angles.cy*z + angles.sy*(angles.sz*y + angles.cz*x)) + angles.cx*(angles.cz*y - angles.sz*x);\r\n var dz = angles.cx*(angles.cy*z + angles.sy*(angles.sz*y + angles.cz*x)) - angles.sx*(angles.cz*y - angles.sz*x);\r\n return {x: (this.view_p.z*dx)/dz - this.view_p.x, y: (this.view_p.z*dy)/dz - this.view_p.y, dx:dx, dy:dy, dz:dz};\r\n }", "constructor(){\n this.theta = 45; //angulo azimutal, de 0 a 360 grados\n this.phi = 45; //angulo polar, de 0 a 360 grados\n this.r = 10; //distancia al punto\n this.fovy = glMatrix.toRadian(50); \n this.aspect = 1;\n this.zNear = 0.1;\n this.zFar = 200.0;\n this.viewMatrix = mat4.create();\n this.projMatrix = mat4.create();\n this.objetivo = new ObjetoGrafico();//objetivo por defecto, inicia en 0,0,0\n }", "function UpdateProjectionMatrix()\r\n{\r\n\t// Parámetros para la matriz de perspectiva\r\n\tvar r = canvas.width / canvas.height;\r\n\tvar n = (transZ - 1.74);\r\n\r\n\tconst min_n = 0.001;\r\n\t\r\n\tif ( n < min_n ) n = min_n;\r\n\tvar f = (transZ + 1.74);;\r\n\tvar fov = 3.145 * 60 / 180;\r\n\tvar s = 1 / Math.tan( fov/2 );\r\n\r\n\t// Matriz de perspectiva\r\n\tperspectiveMatrix = [\r\n\t\ts/r, 0, 0, 0,\r\n\t\t0, s, 0, 0,\r\n\t\t0, 0, (n+f)/(f-n), 1,\r\n\t\t0, 0, -2*n*f/(f-n), 0\r\n\t];\r\n}", "setViewAndCameraMatrix() {\r\n let gl = glSys.get();\r\n // Step A1: Set up the viewport: area on canvas to be drawn\r\n gl.viewport(this.mViewport[0], // x position of bottom-left corner of the area to be drawn\r\n this.mViewport[1], // y position of bottom-left corner of the area to be drawn\r\n this.mViewport[2], // width of the area to be drawn\r\n this.mViewport[3]); // height of the area to be drawn\r\n // Step A2: set up the corresponding scissor area to limit the clear area\r\n gl.scissor(this.mScissorBound[0], // x position of bottom-left corner of the area to be drawn\r\n this.mScissorBound[1], // y position of bottom-left corner of the area to be drawn\r\n this.mScissorBound[2], // width of the area to be drawn\r\n this.mScissorBound[3]);// height of the area to be drawn\r\n\r\n // Step A3: set the color to be clear\r\n gl.clearColor(this.mBGColor[0], this.mBGColor[1], this.mBGColor[2], this.mBGColor[3]); // set the color to be cleared\r\n // Step A4: enable the scissor area, clear, and then disable the scissor area\r\n gl.enable(gl.SCISSOR_TEST);\r\n gl.clear(gl.COLOR_BUFFER_BIT);\r\n gl.disable(gl.SCISSOR_TEST);\r\n\r\n // Step B: Compute the Camera Matrix\r\n let center = [];\r\n if (this.mCameraShake !== null) {\r\n center = this.mCameraShake.getCenter();\r\n } else {\r\n center = this.getWCCenter();\r\n }\r\n\r\n // Step B1: following the translation, scale to: (-1, -1) to (1, 1): a 2x2 square at origin\r\n mat4.scale(this.mCameraMatrix, mat4.create(), vec3.fromValues(2.0 / this.getWCWidth(), 2.0 / this.getWCHeight(), 1.0));\r\n\r\n // Step B2: first operation to perform is to translate camera center to the origin\r\n mat4.translate(this.mCameraMatrix, this.mCameraMatrix, vec3.fromValues(-center[0], -center[1], 0));\r\n }", "_getWorldCoords() {\n const corners = [\n tempCorner1.set(-1, 1, 0), // plane's top left corner\n tempCorner2.set(1, 1, 0), // plane's top right corner\n tempCorner3.set(1, -1, 0), // plane's bottom right corner\n tempCorner4.set(-1, -1, 0), // plane's bottom left corner\n ];\n\n // corners with model view projection matrix applied\n let mvpCorners = [];\n // eventual clipped corners\n let clippedCorners = [];\n\n // we are going to get our plane's four corners relative to our model view projection matrix\n for(let i = 0; i < corners.length; i++) {\n const mvpCorner = corners[i].applyMat4(this._matrices.modelViewProjection.matrix);\n mvpCorners.push(mvpCorner);\n\n // Z position is > 1 or < -1 means the corner is clipped\n if(Math.abs(mvpCorner.z) > 1) {\n clippedCorners.push(i);\n }\n }\n\n // near plane is clipping, get intersections between plane and near plane\n if(clippedCorners.length) {\n mvpCorners = this._getNearPlaneIntersections(corners, mvpCorners, clippedCorners);\n }\n\n // we need to check for the X and Y min and max values\n // use arbitrary integers that will be overriden anyway\n let minX = Infinity;\n let maxX = -Infinity;\n\n let minY = Infinity;\n let maxY = -Infinity;\n\n for(let i = 0; i < mvpCorners.length; i++) {\n const corner = mvpCorners[i];\n\n if(corner.x < minX) {\n minX = corner.x;\n }\n if(corner.x > maxX) {\n maxX = corner.x;\n }\n\n if(corner.y < minY) {\n minY = corner.y;\n }\n if(corner.y > maxY) {\n maxY = corner.y;\n }\n }\n\n return {\n top: maxY,\n right: maxX,\n bottom: minY,\n left: minX,\n };\n }", "setProjectionMatrix() {\n\n if( this.projType === \"perspective\") {\n const aspect = this.width / this.height;\n mat4.perspective(this.projMatrix, glMatrix.toRadian(45.0), aspect, 0.1, 1000.0);\n }\n\n if( this.projType === \"orthographic\"){\n mat4.ortho(this.projMatrix, -(this.width/this.height), (this.width/this.height), -1,1,0.5,1000.0);\n }\n }", "function update_projection() {\r\n\tlet p, w = gl.canvas.width, h = gl.canvas.height;\r\n\tif (show_perspective) {\r\n\t\tp = perspective(45, w/h, 0.01, 10);\r\n\t\t// Need to move the camera away from the origin and flip the z-axis\r\n\t\tp = mult(p, mult(translate(0, 0, -3), scalem(1, 1, -1)));\r\n\t} else {\r\n\t\tp = (w > h) ? ortho(-w/h, w/h, -1, 1, 10, -10) : ortho(-1, 1, -h/w, h/w, 10, -10);\r\n\t}\r\n\tgl.uniformMatrix4fv(projection_loc, false, flatten(p));\r\n}", "function proj(point) {\n // Shift the point by the camera's position.\n var shifted = [point[0] - camera[0], point[1] - camera[1], point[2] - camera[2]];\n // Rotate the point by the camera's rotation.\n var rotated = rotateX(\n rotateY(\n rotateZ(\n [shifted[0], shifted[1], shifted[2]],\n rotation[2]),\n rotation[1]),\n rotation[0]);\n if (rotated[2] <= 0 || rotated[2] > 100) {\n // Return false for points behind the camera or too far in front of it, which shouldn't be drawn.\n return false;\n }\n return [rotated[0] / rotated[2] * zoom, rotated[1] / rotated[2] * zoom];\n}", "function PerspectiveTransform( a11, a21, a31, a12, a22, a32, a13, a23, a33)\r\n{\r\n\tthis.a11 = a11;\r\n\tthis.a12 = a12;\r\n\tthis.a13 = a13;\r\n\tthis.a21 = a21;\r\n\tthis.a22 = a22;\r\n\tthis.a23 = a23;\r\n\tthis.a31 = a31;\r\n\tthis.a32 = a32;\r\n\tthis.a33 = a33;\r\n\tthis.transformPoints1=function( points)\r\n\t\t{\r\n\t\t\tvar max = points.length;\r\n\t\t\tvar a11 = this.a11;\r\n\t\t\tvar a12 = this.a12;\r\n\t\t\tvar a13 = this.a13;\r\n\t\t\tvar a21 = this.a21;\r\n\t\t\tvar a22 = this.a22;\r\n\t\t\tvar a23 = this.a23;\r\n\t\t\tvar a31 = this.a31;\r\n\t\t\tvar a32 = this.a32;\r\n\t\t\tvar a33 = this.a33;\r\n\t\t\tfor (var i = 0; i < max; i += 2)\r\n\t\t\t{\r\n\t\t\t\tvar x = points[i];\r\n\t\t\t\tvar y = points[i + 1];\r\n\t\t\t\tvar denominator = a13 * x + a23 * y + a33;\r\n\t\t\t\tpoints[i] = (a11 * x + a21 * y + a31) / denominator;\r\n\t\t\t\tpoints[i + 1] = (a12 * x + a22 * y + a32) / denominator;\r\n\t\t\t}\r\n\t\t}\r\n\tthis. transformPoints2=function(xValues, yValues)\r\n\t\t{\r\n\t\t\tvar n = xValues.length;\r\n\t\t\tfor (var i = 0; i < n; i++)\r\n\t\t\t{\r\n\t\t\t\tvar x = xValues[i];\r\n\t\t\t\tvar y = yValues[i];\r\n\t\t\t\tvar denominator = this.a13 * x + this.a23 * y + this.a33;\r\n\t\t\t\txValues[i] = (this.a11 * x + this.a21 * y + this.a31) / denominator;\r\n\t\t\t\tyValues[i] = (this.a12 * x + this.a22 * y + this.a32) / denominator;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\tthis.buildAdjoint=function()\r\n\t\t{\r\n\t\t\t// Adjoint is the transpose of the cofactor matrix:\r\n\t\t\treturn new PerspectiveTransform(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this.a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this.a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this.a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this.a21);\r\n\t\t}\r\n\tthis.times=function( other)\r\n\t\t{\r\n\t\t\treturn new PerspectiveTransform(this.a11 * other.a11 + this.a21 * other.a12 + this.a31 * other.a13, this.a11 * other.a21 + this.a21 * other.a22 + this.a31 * other.a23, this.a11 * other.a31 + this.a21 * other.a32 + this.a31 * other.a33, this.a12 * other.a11 + this.a22 * other.a12 + this.a32 * other.a13, this.a12 * other.a21 + this.a22 * other.a22 + this.a32 * other.a23, this.a12 * other.a31 + this.a22 * other.a32 + this.a32 * other.a33, this.a13 * other.a11 + this.a23 * other.a12 +this.a33 * other.a13, this.a13 * other.a21 + this.a23 * other.a22 + this.a33 * other.a23, this.a13 * other.a31 + this.a23 * other.a32 + this.a33 * other.a33);\r\n\t\t}\r\n\r\n}", "getProjMatrix() {\nreturn this.projMat;\n}", "function PerspectiveTransform( a11, a21, a31, a12, a22, a32, a13, a23, a33)\n{\n\tthis.a11 = a11;\n\tthis.a12 = a12;\n\tthis.a13 = a13;\n\tthis.a21 = a21;\n\tthis.a22 = a22;\n\tthis.a23 = a23;\n\tthis.a31 = a31;\n\tthis.a32 = a32;\n\tthis.a33 = a33;\n\tthis.transformPoints1=function( points)\n\t\t{\n\t\t\tvar max = points.length;\n\t\t\tvar a11 = this.a11;\n\t\t\tvar a12 = this.a12;\n\t\t\tvar a13 = this.a13;\n\t\t\tvar a21 = this.a21;\n\t\t\tvar a22 = this.a22;\n\t\t\tvar a23 = this.a23;\n\t\t\tvar a31 = this.a31;\n\t\t\tvar a32 = this.a32;\n\t\t\tvar a33 = this.a33;\n\t\t\tfor (var i = 0; i < max; i += 2)\n\t\t\t{\n\t\t\t\tvar x = points[i];\n\t\t\t\tvar y = points[i + 1];\n\t\t\t\tvar denominator = a13 * x + a23 * y + a33;\n\t\t\t\tpoints[i] = (a11 * x + a21 * y + a31) / denominator;\n\t\t\t\tpoints[i + 1] = (a12 * x + a22 * y + a32) / denominator;\n\t\t\t}\n\t\t}\n\tthis. transformPoints2=function(xValues, yValues)\n\t\t{\n\t\t\tvar n = xValues.length;\n\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tvar x = xValues[i];\n\t\t\t\tvar y = yValues[i];\n\t\t\t\tvar denominator = this.a13 * x + this.a23 * y + this.a33;\n\t\t\t\txValues[i] = (this.a11 * x + this.a21 * y + this.a31) / denominator;\n\t\t\t\tyValues[i] = (this.a12 * x + this.a22 * y + this.a32) / denominator;\n\t\t\t}\n\t\t}\n\n\tthis.buildAdjoint=function()\n\t\t{\n\t\t\t// Adjoint is the transpose of the cofactor matrix:\n\t\t\treturn new PerspectiveTransform(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this.a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this.a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this.a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this.a21);\n\t\t}\n\tthis.times=function( other)\n\t\t{\n\t\t\treturn new PerspectiveTransform(this.a11 * other.a11 + this.a21 * other.a12 + this.a31 * other.a13, this.a11 * other.a21 + this.a21 * other.a22 + this.a31 * other.a23, this.a11 * other.a31 + this.a21 * other.a32 + this.a31 * other.a33, this.a12 * other.a11 + this.a22 * other.a12 + this.a32 * other.a13, this.a12 * other.a21 + this.a22 * other.a22 + this.a32 * other.a23, this.a12 * other.a31 + this.a22 * other.a32 + this.a32 * other.a33, this.a13 * other.a11 + this.a23 * other.a12 +this.a33 * other.a13, this.a13 * other.a21 + this.a23 * other.a22 + this.a33 * other.a23, this.a13 * other.a31 + this.a23 * other.a32 + this.a33 * other.a33);\n\t\t}\n\n}", "project(coord, transMat) {\n var point = BABYLON.Vector3.TransformCoordinates(coord, transMat);\n // The transformed coordinates will be based on coordinate system\n // starting on the center of the screen. But drawing on screen normally starts\n // from top left. We then need to transform them again to have x:0, y:0 on top left.\n var x = point.x * this.workingWidth + this.workingWidth / 2.0 >> 0; // >>0 二进制右移 相当于取整\n var y = -point.y * this.workingHeight + this.workingHeight / 2.0 >> 0;\n return (new BABYLON.Vector2(x, y));\n }", "function Maths() {\n\tconst PI = 3.14;\n\t\n\t/**\n\t * Shifts angle into radian. \n\t */\n\tthis.toRadians = function(angle) {\n\t\treturn (angle / 180) * PI;\n\t}\n\t\n\t/**\n\t * Creates perspective transformation (projection) matrix from arguments.\n\t * \n\t * @param nearPlane - Vector4f-type object argument of nearest clipping plane\n\t * @param farPlane - Vector4f-type object argument of farthest clipping plane\n\t * @param FOV - Number-type argument of field of view\n\t * \n\t * @return Matrix4f-type object of projection Matrix\n\t */\n\tthis.createProjectionMatrix = function(nearPlane, farPlane, FOV) {\n\t\tvar projectionMatrix = new __WEBPACK_IMPORTED_MODULE_0__matrix_Matrix4f__[\"a\" /* Matrix4f */]();\n\t\tvar aspectRatio = __WEBPACK_IMPORTED_MODULE_2__index__[\"a\" /* gl */].viewportWidth / __WEBPACK_IMPORTED_MODULE_2__index__[\"a\" /* gl */].viewportHeight;\n\t\tvar yScale = 1 / Math.tan(Math.toRadians(FOV / 2));\n\t\tvar xScale = yScale / aspectRatio;\n\t\tvar frustumLength = farPlane - nearPlane;\n\t\t\n\t\tprojectionMatrix.setIdentity();\n\t\t\n\t\tprojectionMatrix.m[0][0] = xScale;\n\t\tprojectionMatrix.m[1][1] = yScale;\n\t\tprojectionMatrix.m[2][2] = -((farPlane + nearPlane) / frustumLength); \n\t\tprojectionMatrix.m[2][3] = -1;\n\t\tprojectionMatrix.m[3][2] = -((2 * nearPlane * farPlane) / frustumLength);\n\t\tprojectionMatrix.m[3][3] = 0; \n\t\t\n\t\treturn projectionMatrix;\n\t\t\n\t}\n\t\n\t/**\n\t * Creates camera view transformation (view) matrix from camera object.\n\t * \n\t * @param camera - Camera-type object argument\n\t * \n\t * @return Matrix4f-type object of view matrix\n\t */\n\tthis.createViewMatrix = function(camera) {\n\t\tvar viewMatrix = new __WEBPACK_IMPORTED_MODULE_0__matrix_Matrix4f__[\"a\" /* Matrix4f */]();\n\t\tviewMatrix.setIdentity();\n\t\tviewMatrix.rotate(Math.toRadians(camera.getPitch()), new __WEBPACK_IMPORTED_MODULE_1__vector_Vector3f__[\"a\" /* Vector3f */](1, 0, 0));\n\t\tviewMatrix.rotate(Math.toRadians(camera.getYaw()), new __WEBPACK_IMPORTED_MODULE_1__vector_Vector3f__[\"a\" /* Vector3f */](0, 1, 0));\n\t\tviewMatrix.rotate(Math.toRadians(camera.getRoll()), new __WEBPACK_IMPORTED_MODULE_1__vector_Vector3f__[\"a\" /* Vector3f */](0, 0, 1));\n\t\tvar negativeCameraPosition = new __WEBPACK_IMPORTED_MODULE_1__vector_Vector3f__[\"a\" /* Vector3f */](\n\t\t\t\t-camera.getPosition().x, -camera.getPosition().y, -camera.getPosition().z);\n\t\tviewMatrix.translate3f(negativeCameraPosition);\n\t\t\n\t\treturn viewMatrix;\n\t}\n\t\n\t\n}", "function setupCamera() {\r\n\t\r\n\t\t// Rotate along temp in world coordinates\t\r\n\t\tvar yAxisInModelSpace = vec3.fromValues(mwMatrix[1], mwMatrix[5], mwMatrix[9]);\r\n\t\tmat4.rotate(mwMatrix, mwMatrix, -rotX/180*Math.PI, yAxisInModelSpace); \r\n\t\trotX = 0;\r\n\t\t\r\n\t\t// Rotate along the (1 0 0) in world coordinates\r\n\t\tvar xAxisInModelSpace = vec3.fromValues(mwMatrix[0], mwMatrix[4], mwMatrix[8]);\r\n\t\tmat4.rotate(mwMatrix, mwMatrix, -rotY/180*Math.PI, xAxisInModelSpace);\r\n\t\trotY = 0;\t\t\t\t\r\n\t}", "updateViewMatrix() {\n //Optimize camera transform update, no need for scale nor rotateZ\n if (this.mode == 0) {\n this.transform.matView.reset()\n .vtranslate(this.transform.position)\n .rotateX(this.transform.rotation.x * this.transform.deg2Rad)\n .rotateY(this.transform.rotation.y * this.transform.deg2Rad);\n }\n else {\n this.transform.matView.reset()\n .rotateX(this.transform.rotation.x * this.transform.deg2Rad)\n .rotateY(this.transform.rotation.y * this.transform.deg2Rad)\n .vtranslate(this.transform.position);\n }\n this.transform.updateDirection();\n //Cameras work by doing the inverse transformation on all meshes, the camera itself is a lie :)\n C_Matrix4.invert(this.viewMatrix, this.transform.matView.raw);\n return this.viewMatrix;\n }", "static makeViewMatrix(cameraPos, target, cameraUp){\n // cameraForward\n let f = Vector.sub(cameraPos, target);\n Vector.normalize(f);\n \n // cameraRight\n let r = Vector.cross(cameraUp, f);\n Vector.normalize(r);\n \n // should be unit vector already\n let v = Vector.cross(f, r);\n \n let p = cameraPos;\n \n return Matrix.make(\n [\n [r[0], r[1], r[2], -r[0]*p[0]-r[1]*p[1]-r[2]*p[2] ],\n [v[0], v[1], v[2], -v[0]*p[0]-v[1]*p[1]-v[2]*p[2] ],\n [f[0], f[1], f[2], -f[0]*p[0]-f[1]*p[1]-f[2]*p[2] ],\n [ 0, 0, 0, 1 ]\n ]\n );\n}", "camera({ viewportWidth, viewportHeight }) {\n const fovy = Math.PI / 2;\n const aspect = viewportWidth / viewportHeight;\n const near = 0.01;\n const f = 1.0 / Math.tan(fovy / 2);\n const out = [];\n const eps = 1.0;\n\n /*\n Note that we do not use a normal perspective matrix.\n\n This projection matrix below is basically this matrix\n https://github.com/stackgl/gl-mat4/blob/master/perspective.js\n Except that we've let 'far' go to infinity,\n and that we add an epsilon factor at some places\n\n It is basically the matrix given in equation (8) of this article:\n http://www.gamesustra.com/view/feature/131351/the_mechanics_of_robust_stencil_php.?print=1\n */\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = -1 + eps;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = (eps - 2) * near;\n out[15] = 0;\n\n return mat4.multiply([], out, camera.view());\n }", "get viewProjectionMatrix$() {\n\t\treturn (this._vp.m || (this._vp.m = SpiderGL.Math.Mat4.mul(this.projectionMatrix$, this.viewMatrix$)));\n\t}", "updateProjMat()\n {\n if ( this.proj_type_str == 'Perspective' )\n this.proj_mat = Mat4_Perspective( this.fovy_deg, this.viewport.ratio_yx, this.near, this.far )\n else if ( this.proj_type_str == 'Orthogonal' )\n {\n const near_adjust = 5.0 // this is used so the grid is not clipped\n this.proj_mat = Mat4_Orthogonal( this.viewport.ratio_yx, this.half_size_y, this.near-near_adjust, this.far ) \n }\n else \n throw new Error(`invalid string in 'proj_type'`)\n }", "function computeProjections() {\n for (var n = 0; n < roots.length; n++) {\n // compute projections and resize by 100 and translated by 300\n rootProj[n] = [dotprod(projMatrix[0], roots[n]) * zoom + translateX,\n dotprod(projMatrix[1], roots[n]) * zoom + translateY];\n }\n}", "project(mode) {\n this.mode = mode;\n let controlsOpts = this.controls;\n\n let aspect = this.aspect;\n //let frustumSize = controlsOpts.boxHeight;\n let distance = controlsOpts.distance;\n\n if (mode === 'perspective') {\n this._camera = new PerspectiveCamera(this.fov, this.aspect, this.near, this.far);\n //默认绘制的物体是贴近近裁面的,根据近裁面呈现高度为frustumSize的物体需要相机位置\n //let centerPosition = new Vector3(0, 0, (this.far - this.near)/2);\n\n\n // let vFOV = _Math.degToRad(this.fov); // convert vertical fov to radians\n\n // var dist = frustumSize / (2 * Math.tan(vFOV / 2));\n this._camera.position.set(0, 0, distance);\n\n\n\n } else {\n //给定一个大的投影空间,方便数据的计算\n //this._camera = new OrthographicCamera(frustumSize * aspect / -2, frustumSize * aspect / 2, frustumSize / 2, frustumSize / - 2, this.near, this.far);\n this._camera = new OrthographicCamera(controlsOpts.boxWidth / -2, controlsOpts.boxWidth / 2, controlsOpts.boxHeight / 2, controlsOpts.boxHeight / - 2, this.near, this.far);\n this._camera.position.set(0, 0, distance);\n }\n\n // console.info(\"getVisableSize\", this.getVisableSize());\n\n }", "function projection(width, height) {\n return [2 / width, 0, 0, 0, 0, -2 / height, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n}", "proj(vec1,vec2){\n\t\tlet res = this.dot(vec1,vec2);\n\t\tlet proj = vec2.map(x => x*res);\n\t\treturn proj;\n\t}", "function vproj2d(a, b)\r\n{\r\n return mult2d(unit2d(a), sproj2d(a, b));\r\n}", "static projection(v1, v2) {\n\t\tlet dp = vector.dot(v1, v2)\n\t\tlet v2Normalized = vector.normalize(v2)\n\n\t\treturn new vector(dp*v2.x, dp*v2.y)\n\t}", "function makeProjectionMatrixFromMercatorParams(_ref8) {\n var width = _ref8.width,\n height = _ref8.height,\n pitch = _ref8.pitch,\n altitude = _ref8.altitude,\n _ref8$farZMultiplier = _ref8.farZMultiplier,\n farZMultiplier = _ref8$farZMultiplier === undefined ? 10 : _ref8$farZMultiplier;\n\n var _getClippingPlanes = getClippingPlanes({ altitude: altitude, pitch: pitch }),\n nearZ = _getClippingPlanes.nearZ,\n farZ = _getClippingPlanes.farZ;\n\n var fov = getFov({ height: height, altitude: altitude });\n\n var projectionMatrix = __WEBPACK_IMPORTED_MODULE_0_gl_mat4_perspective___default()(createMat4(), fov, // fov in radians\n width / height, // aspect ratio\n nearZ, // near plane\n farZ * farZMultiplier // far plane\n );\n\n return projectionMatrix;\n}", "function updateProjectionMatrix() {\r\n let aspect = gl.canvas.width / gl.canvas.height;\r\n let p = mat4.perspective(mat4.create(), Math.PI / 4, aspect, 0.1, 10);\r\n gl.uniformMatrix4fv(gl.program.uProjectionMatrix, false, p);\r\n}", "function setUpCamera() {\n \n // set up your projection\n // defualt is orthographic projection\n let projMatrix = glMatrix.mat4.create();\n //glMatrix.mat4.ortho(projMatrix, -5, 5, -5, 5, 1.0, 300.0);\n glMatrix.mat4.perspective(projMatrix, radians(60), 1, 5, 100);\n gl.uniformMatrix4fv (program.uProjT, false, projMatrix);\n\n \n // set up your view\n // defaut is at (0,0,-5) looking at the origin\n let viewMatrix = glMatrix.mat4.create();\n glMatrix.mat4.lookAt(viewMatrix, [0, 3, -11], [0, 0, 0], [0, 1, 0]);\n gl.uniformMatrix4fv (program.uViewT, false, viewMatrix);\n}", "function solveProjection(coords) {\n var a = [];\n var b = [];\n for (var i = 0; i < 4; i++) {\n var c = coords[i];\n a.push([c.sx, c.sy, 1, 0, 0, 0, -c.sx*c.tx, -c.sy*c.tx]);\n a.push([0, 0, 0, c.sx, c.sy, 1, -c.sx*c.ty, -c.sy*c.ty]);\n b.push(c.tx);\n b.push(c.ty);\n }\n return solveSystem(a, b);\n}", "function applyProjection(p, m) {\n\t var x = p.x,\n\t y = p.y,\n\t z = p.z;\n\t var e = m.elements;\n\t var w = e[3] * x + e[7] * y + e[11] * z + e[15];\n\t //This is the difference between this function and\n\t //the normal THREE.Vector3.applyProjection. We avoid\n\t //inverting the positions of points behind the camera,\n\t //otherwise our screen area computation can result in\n\t //boxes getting clipped out when they are in fact partially visible.\n\t if (w < 0) w = -w;\n\t var d = 1.0 / w;\n\t p.x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * d;\n\t p.y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * d;\n\t //We also don't need the Z\n\t //p.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * d;\n\t }", "get projectionMatrix() {\n\t\treturn this._p.matrix;\n\t}", "function Camera() {\n\tthis.eye = new Vec3();\n\tthis.U = new Vec3();\n\tthis.V = new Vec3();\n\tthis.W = new Vec3();\n\tthis.width = 1.0;\n\tthis.height = 1.0; // \"width\" and \"height\" are width and heigh of the canvas window in scene space. \n\tthis.rows = 0.0; \n\tthis.cols = 0.0;// \"rows\" and \"cols\" are the the number of pixels rows and columns\n\t\n\t/**\n\t * This function is used to 'send' the camera to the kernel.\n\t */\n\tthis.toFloat32Array = function (){\n\t\treturn new Float32Array([\n\t\t\tthis.eye.x, this.eye.y, this.eye.z,\n\t\t\tthis.U.x, this.U.y, this.U.z,\n\t\t\tthis.V.x, this.V.y, this.V.z,\n\t\t\tthis.W.x, this.W.y, this.W.z,\n\t\t\tthis.width, this.height,\n\t\t\tthis.rows, this.cols ]);\n\t}\n\t\n\tthis.defaultInit = function (){\n\t\tthis.eye.x = this.eye.y = this.eye.z = 0.0;\n\t\tthis.U.x=1.0; this.U.y=0.0; this.U.z=0.0; \n\t\tthis.V.x=0.0; this.V.y=1.0; this.V.z=0.0;\n\t\tthis.W.x=0.0; this.W.y=0.0; this.W.z=-1.0;\n\t}\n}", "getProjection(other_vector) {\n\n }", "function setProjection() {\n\n // Set bounds for projection.\n viewerDist = length(subtract(e, a));\n pn = viewerDist - 6;\n pf = viewerDist + 64;\n\n // Perspecive projection bounds.\n pt = pn * Math.tan(Math.PI / 4);\n pb = -pt;\n pr = pt;\n pl = -pr;\n\n getPerspective();\n}", "genRay( pix_x, pix_y )\n {\n const fname = 'SimpleCamera.genRay():'\n\n Check( 0 <= pix_x && pix_x < this.viewport.width )\n Check( 0 <= pix_y && pix_y < this.viewport.height )\n\n // compute ray origin and direction in Eye Cords, according to camera type\n\n let org_ec = null, \n dir_ec = null\n\n if ( this.proj_type_str == 'Perspective' )\n {\n const \n r_yx = this.viewport.ratio_yx, // viewport ratio (height/width)\n fovy_r = (this.fovy_deg*Math.PI)/180.0, // fovy, in radians\n h_ec = Math.tan(0.5*fovy_r),\n w_ec = h_ec/r_yx,\n cx = w_ec * ( -1.0 + (2.0*(pix_x+0.5))/this.viewport.width ),\n cy = h_ec * ( -1.0 + (2.0*(pix_y+0.5))/this.viewport.height )\n \n dir_ec = new Vec3([ cx, cy, -1 ])\n org_ec = new Vec3([ 0.0, 0.0, 0.0]) // z == -this.near, i think ....\n }\n else if ( this.proj_type_str == 'Orthogonal' )\n {\n //throw new Error(`${fname} I still don't know how to do this`)\n // compute r,l,b,t,n as in 'Mat4_Orthogonal'\n const \n hsy = this.half_size_y,\n asp_rat = this.viewport.ratio_yx,\n r = hsy/asp_rat,\n l = -r,\n b = -hsy,\n t = +hsy,\n cx = r *( -1.0 + (2.0*(pix_x+0.5))/this.viewport.width ),\n cy = t *( -1.0 + (2.0*(pix_y+0.5))/this.viewport.height )\n\n dir_ec = new Vec3([ 0, 0, -1 ])\n org_ec = new Vec3([ cx, cy, -this.near ]) \n }\n else \n throw new Error(`${fname} invalid string in 'proj_type'`)\n\n // compute the ray dir and org in world coordinates, by using inverse view matrix\n let\n org_wc = this.view_mat_inv.apply_to( org_ec, 1 ),\n dir_wc = this.view_mat_inv.apply_to( dir_ec, 0 )\n\n // done\n return new Ray( org_wc, dir_wc )\n }", "cameraCoords() {\n let coords0 = vec3.fromValues(5, 2, 0);\n let coords1 = vec3.fromValues(3, 3, 1);\n let coords2 = vec3.fromValues(-3,3,1);\n return new Array(coords0, coords1, coords2);\n }", "function GCamera()\r\n{\r\n this.gl = undefined;\r\n\tthis.pMatrix = mat4.create();\r\n\t\r\n\t\r\n\tthis.rotMat = mat4.create();\r\n\tthis.tranMat = mat4.create();\r\n\t\r\n\tthis.eye = vec3.fromValues(0, 0, 0);\r\n\tthis.up = vec3.fromValues(0, 1, 0);\r\n\tthis.lookAt = vec3.fromValues(0, 0, 1);\r\n\t\r\n\tthis.mvMatrix = mat4.create();\r\n\t\r\n\tthis.aspect = 1.7777777777777777;\r\n\tthis.fovy = 0.8*(3.14159/4);\r\n\r\n this.inverseProjectionReady = false;\r\n this.inverseProjectionMatrix = mat4.create();\r\n}", "function setupWebGL(){\n gl.enable(gl.DEPTH_TEST);\n //set the clear color\n gl.clearColor(0.1, 0.1, 0.2, 1.0); \n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); \n\n gl.viewport(0, 0, canvas.width, canvas.height);\n\n // Matrix de Proyeccion Perspectiva\n\n mat4.perspective(projMatrix,45, canvas.width / canvas.height, 0.1, 100.0);\n mat4.identity(viewMatrix);\n mat4.translate(viewMatrix,viewMatrix, [0.0, 0.0, -5.0]);\n}", "function initMatrices(canvas){\n\t// Erstellen einer ModelViewMatrix mit einer Kamera bei 0, 0, -8\n\tmodelViewMatrix = mat4.create();\n\tmat4.translate(modelViewMatrix,modelViewMatrix, [0, 0, -8]);\n\n\t// Erstellen einer ProjectionMatrix in der 45° Sehfeld\n\tprojectionMatrix = mat4.create();\n\tmat4.perspective(projectionMatrix, Math.PI / 4, canvas.width / canvas.height, 1, 10000);\n\t\n\trotationAxis = vec3.create();\n\tvec3.normalize(rotationAxis, [1, 1, 1]);\n}", "function initMatrices(canvas){\n\t// Erstellen einer ModelViewMatrix mit einer Kamera bei 0, 0, -8\n\tmodelViewMatrix = mat4.create();\n\tmat4.translate(modelViewMatrix,modelViewMatrix, [0, 0, -8]);\n\n\t// Erstellen einer ProjectionMatrix in der 45° Sehfeld\n\tprojectionMatrix = mat4.create();\n\tmat4.perspective(projectionMatrix, Math.PI / 4, canvas.width / canvas.height, 1, 10000);\n\t\n\trotationAxis = vec3.create();\n\tvec3.normalize(rotationAxis, [1, 1, 1]);\n}", "function point_plane_proj(p,v,y) {\n // normalized direction from p to v\n var r = norm_vec(from_to_vec(p,v));\n // assumed: the plane is for any x,z value and fixed Y=y\n var normal = [0,1,0];\n // for linear algebra\n var on_plane = [0,y,0];\n // solution from the written homework, saying v' = len*r + p\n var len = dot_vec(normal, from_to_vec(p,on_plane))/dot_vec(normal, r)\n var v_out = add_vec(scale_vec(r,len),p);\n // can do a sanity check: v_out's y-component should be essentially y\n if(Math.abs(v_out[1]-y)>0.001){\n console.log('WARNING: point_plane_proj made a bad projection on inputs (p,v,y) = ('+p+', '+v+', '+y+')');\n }\n // now to avoid colliding with the plane, add 0.001 to the y coord\n return [v_out[0],y+0.001,v_out[2]];\n}", "getUpdatedProjectionModel() {\n matrix.setIdentityMat4(this.model);\n // x, y, z are negative because objects move opposite to the direction the camera is moving\n matrix.translateMat4(this.model, -this.x, -this.y, -this.z);\n matrix.applyXZRotationMat4(this.model, this.xzAngle);\n matrix.applyYZRotationMat4(this.model, -this.yzAngle);\n\n matrix.multiplyMat4ByMat4(this.projection, this.model, this.projectionModel);\n return this.projectionModel;\n }", "calcProjectionCoords(points) {\n const projection = this.projection();\n return (points.map(point => {\n if ('geometry' in point) {\n return (projection(point.geometry.coordinates))\n }\n return (projection(point.coordinates))\n })\n )\n }", "function drawScene() {\n // set the rendering environment to full canvas size\n gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight);\n // Clear the canvas before we start drawing on it.\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n \n // Establish the perspective with which we want to view the\n // scene. Our field of view is 45 degrees, with a width/height\n // ratio and we only want to see objects between 0.1 units\n // and 100 units away from the camera.\n mat4.perspective(45, gl.viewportWidth / gl.viewportHeight, 0.1, 100.0, pMatrix);\n\n // Set the drawing position to the \"identity\" point, which is\n // the center of the scene.\n mat4.identity(mvMatrix);\n //mat4.rotate(pMatrix, degToRad(180), [0,1,0]);\n // Now move the drawing position a bit to where we want to start\n // drawing the cube.\n\n //GRADNJA LABIRINTA\n //mat4.translate(pMatrix, [0,0,2]);\n mat4.translate(pMatrix, [0,0,-6]);\n if (tloris){\n mat4.rotate(pMatrix, degToRad(90), [1, 0, 0]);\n mat4.translate(pMatrix, [0,-30,6]);\n }else{\n mat4.rotate(pMatrix, degToRad(15), [1,0,0]);\n mat4.translate(pMatrix, [0, 0, 6]);\n }\n //SAMO OPAZOVANJE\n\n\n\n // OBRAČANJE KAMERE LEVO IN DESNO\n //mat4.translate(pMatrix, [0,0,-6]);\n mat4.rotate(pMatrix, degToRad(-yaw), [0,1,0]);\n mat4.translate(pMatrix, [-2, 0, 3]); //zmer od začetka riše zato je to konstanta...\n //mat4.translate(pMatrix, [-xPosition, -yPosition, -zPosition]);\n\n cameraCoord = [xPosition - 0.86, yPosition, zPosition + 7.2];\n //console.log(xPosition - 0.86, yPosition, zPosition + 7.2);\n\n checkForCollision();\n //console.log(cameraCoord);\n\n mat4.translate(mvMatrix, [0.0, 0.0, -7.0]);\n\n\n //drawFloor\n specifeTextureAndFloor()\n drawFloor();\n specifeTextureAndCube();\n drawSideWalls();\n\n //mvPushMatrix();\n mat4.translate(mvMatrix, [0.0, 0.0, -38.0]);\n drawInsideWalls();\n\n\n specifeTextureForMarker(); //added\n drawMe();\n\n\n\n specifeTextureAndWin();\n mat4.identity(mvMatrix);\n mvPushMatrix();\n mat4.translate(mvMatrix,[2*8,2,11])\n setMatrixUniforms();\n gl.drawElements(gl.TRIANGLES, cubeVertexIndexBuffer.numItems, gl.UNSIGNED_SHORT, 0); \n mvPopMatrix();\n\n specifeTextureForGhosts();\n drawGhosts();\n\n specifeTextureForSky() //sky block\n mvPushMatrix();\n mat4.scale(mvMatrix, [50, 50, 50]);\n setMatrixUniforms();\n gl.drawElements(gl.TRIANGLES, cubeVertexIndexBuffer.numItems, gl.UNSIGNED_SHORT, 0);\n mvPopMatrix();\n //gl.drawElements(gl.TRIANGLES, cubeVertexIndexBuffer.numItems, gl.UNSIGNED_SHORT, 0); \n\n\n\n}", "function setUpProjectionMat() {\n let projectionMat = mat3.create();\n mat3.fromScaling(projectionMat, [2.0 / gl.drawingBufferWidth, 2.0 / gl.drawingBufferHeight]);\n gl.uniformMatrix3fv(context.uProjectionMatId, false, projectionMat);\n}", "function getProjectiveTransform(points) {\n var eqMatrix = new Matrix(9, 8, [\n [ 1, 1, 1, 0, 0, 0, -points[3][0],-points[3][0],-points[3][0] ], \n [ 0, 1, 1, 0, 0, 0, 0,-points[2][0],-points[2][0] ],\n [ 1, 0, 1, 0, 0, 0, -points[1][0], 0,-points[1][0] ],\n [ 0, 0, 1, 0, 0, 0, 0, 0,-points[0][0] ],\n\n [ 0, 0, 0, -1,-1,-1, points[3][1], points[3][1], points[3][1] ],\n [ 0, 0, 0, 0,-1,-1, 0, points[2][1], points[2][1] ],\n [ 0, 0, 0, -1, 0,-1, points[1][1], 0, points[1][1] ],\n [ 0, 0, 0, 0, 0,-1, 0, 0, points[0][1] ]\n\n ]);\n \n var kernel = eqMatrix.rowEchelon().values;\n var transform = new Matrix(3, 3, [\n [-kernel[0][8], -kernel[1][8], -kernel[2][8]],\n [-kernel[3][8], -kernel[4][8], -kernel[5][8]],\n [-kernel[6][8], -kernel[7][8], 1]\n ]);\n return transform;\n}", "function Camera(startPos, wView, hView, ctx) {\n this.direction = {x: 0, y: 0};\n this.x = startPos.x;\n this.y = startPos.y;\n this.width = wView;\n this.height = hView;\n this.scale = 1;\n\n this.toWorld = function(clientX, clientY) {\n return [\n clientX/this.scale - ((wView/this.scale/2) - this.x),\n clientY/this.scale - ((hView/this.scale/2) - this.y)\n ]\n };\n\n this.zoom = function() {\n if (this.scale == 1) {\n this.scale = 0.75;\n } else {\n this.scale = 1;\n }\n };\n\n this.update = function(mod) {\n if (this.direction.x == 1) {\n this.x += 5;\n }\n if (this.direction.x == -1) {\n this.x -= 5;\n }\n if (this.direction.y == 1) {\n this.y += 5;\n }\n if (this.direction.y == -1) {\n this.y -= 5;\n }\n };\n\n this.render = function() {\n // Apply the scale first\n ctx.scale(this.scale, this.scale);\n // Move the scene, in relation to the middle of the viewport ()\n ctx.translate(this.width/this.scale/2 - this.x, (this.height/this.scale/2) - this.y);\n };\n\n this.inside = function(x, y, width, height) {\n // target x + 1/2 width of target should be great than left bound\n // left bound = camera.x (center) - width/2\n // width should be / by scale\n if (x + width/2/this.scale > this.x - ((this.width/this.scale)/2)\n && x - width/2/this.scale < this.x + ((this.width/this.scale)/2)) {\n if (y + height/2/this.scale > this.y - ((this.height/this.scale)/2)\n && y - height/2/this.scale < this.y + ((this.height/this.scale)/2)) {\n return true\n }\n }\n return false\n };\n}", "get viewProjectionMatrix() {\n\t\treturn SpiderGL.Math.Mat4.dup(this.viewProjectionMatrix$);\n\t}", "static makeProjectionMatrix(fov, znear, zfar, aspectRatio){\n \n let t = 1/Math.tan(fov/2);\n \n return Matrix.make(\n [\n [(1/aspectRatio)*t, 0, 0, 0 ],\n \n [ 0, t, 0, 0 ],\n \n [ 0, 0, (-znear-zfar)/(znear-zfar), (2*znear*zfar)/(znear-zfar)],\n \n [ 0, 0, 1, 0 ]\n ]\n );\n}", "function projectPoint(modelViewMatrix, projMatrix, viewport, src, dest) {\n\tif (!dest)\n\t\tdest = new Float32Array(3);\n\n\t_v0[0] = src[0]; _v0[1] = src[1]; _v0[2] = src[2]; _v0[3] = 1;\n\n\t// transform point from model space to clip space\n\ttransformVector4(modelViewMatrix, _v0, _v1);\n\ttransformVector4(projMatrix, _v1, _v0);\n\n\t/* to normalized device coordinates */\n\t_v0[0] /= _v0[3];\n\t_v0[1] /= _v0[3];\n\t_v0[2] /= _v0[3];\n\n\t/* to window coordinates */\n\tdest[0] = viewport[0] + 0.5 * (1 + _v0[0]) * viewport[2];\n\tdest[1] = -viewport[1] + 0.5 * (1 - _v0[1]) * viewport[3];\n\tdest[2] = 0.5 * (1 + _v0[2]);\n\n\treturn dest;\n}", "getViewProjectionMatrix(gl) {\n mat4.lookAt(this._viewMatrix, this._eye, this._lookAtPoint, this._up);\n const aspectRatio = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const projectionMatrix = mat4.create();\n mat4.perspective(projectionMatrix, this._fovY, aspectRatio, this._near, this._far);\n\n const vpMatrix = mat4.create();\n mat4.multiply(vpMatrix, projectionMatrix, this._viewMatrix);\n return vpMatrix;\n }", "function perspective_project(vec, d) {\n var x = vec[0];\n var y = vec[1];\n var z = vec[2];\n if (z > 0) {\n return [x * d / z, -y * d / z];\n } else {\n return false;\n }\n}", "function makeProjectionMatrixFromMercatorParams(_ref10) {\n var width = _ref10.width,\n height = _ref10.height,\n pitch = _ref10.pitch,\n altitude = _ref10.altitude,\n _ref10$farZMultiplier = _ref10.farZMultiplier,\n farZMultiplier = _ref10$farZMultiplier === undefined ? 10 : _ref10$farZMultiplier;\n\n var _getClippingPlanes = getClippingPlanes({ altitude: altitude, pitch: pitch }),\n nearZ = _getClippingPlanes.nearZ,\n farZ = _getClippingPlanes.farZ;\n\n var fov = getFov({ height: height, altitude: altitude });\n\n var projectionMatrix = __WEBPACK_IMPORTED_MODULE_3_gl_mat4___default.a.perspective(Object(__WEBPACK_IMPORTED_MODULE_0__viewport__[\"a\" /* createMat4 */])(), fov, // fov in radians\n width / height, // aspect ratio\n nearZ, // near plane\n farZ * farZMultiplier // far plane\n );\n\n return projectionMatrix;\n}", "function getProjectionMatrix(_ref11) {\n var width = _ref11.width,\n height = _ref11.height,\n pitch = _ref11.pitch,\n altitude = _ref11.altitude,\n _ref11$farZMultiplier = _ref11.farZMultiplier,\n farZMultiplier = _ref11$farZMultiplier === undefined ? 10 : _ref11$farZMultiplier;\n\n var _getClippingPlanes = getClippingPlanes({ altitude: altitude, pitch: pitch }),\n nearZ = _getClippingPlanes.nearZ,\n farZ = _getClippingPlanes.farZ;\n\n var fov = getFov({ height: height, altitude: altitude });\n\n var projectionMatrix = __WEBPACK_IMPORTED_MODULE_2_gl_mat4_perspective___default()([], fov, // fov in radians\n width / height, // aspect ratio\n nearZ, // near plane\n farZ * farZMultiplier // far plane\n );\n\n return projectionMatrix;\n}", "projectionOn(e3v) {\nreturn E3Vec.projectionV3(this.xyz, e3v.xyz);\n}", "function viewingInit(gl) {\n // Set up an orthographic projection matrix (parallel lines are always parallel)\n var left = 0;\n var right = gl.canvas.clientWidth;\n var bottom = gl.canvas.clientHeight;\n var top = 0;\n var near = 2000;\n var far = -2000;\n //var projectionMatrix = m4.orthographic(left, right, bottom, top, near, far);\n\n // Set up a perspective projection matrix (parallel lines meet at infinity)\n var fieldOfViewDegrees = 60;\n var fieldOfViewRadians = fieldOfViewDegrees * Math.PI / 180;\n var aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n var zNear = 1;\n var zFar = 2000;\n var projectionMatrix = m4.perspective(fieldOfViewRadians, aspect, zNear, zFar);\n \n // Set up the camera matrix\n // Create the cameraMatrix\n var cameraMatrix = m4.identity();\n cameraMatrix = m4.xRotate(cameraMatrix, cameraAngleRadians[0]);\n cameraMatrix = m4.yRotate(cameraMatrix, cameraAngleRadians[1]);\n cameraMatrix = m4.zRotate(cameraMatrix, cameraAngleRadians[2]);\n cameraMatrix = m4.translate(cameraMatrix, xCameraOffset, yCameraOffset, zCameraOffset + camRadius * 1.5);\n\n // Set up for the lookAt miatrix\n // get camera's position from the matrix\n var cameraPosition = [\n cameraMatrix[12],\n cameraMatrix[13],\n cameraMatrix[14],\n ];\n // get the vector for 'up' for computing normals\n var up = [0, 1, 0];\n\n // Pick some place to lookAt\n var target = [0, 250, 0];\n // Compute the camera's matrix to lookAt point\n var lookAtMatrix = m4.lookAt(cameraPosition, target, up);\n\n // Set up the view matrix, 'moves' the camera to the origin\n //var viewMatrix = m4.inverse(cameraMatrix);\n var viewMatrix = m4.inverse(lookAtMatrix);\n\n // view projection matrix\n var viewProjectionMatrix = m4.multiply(projectionMatrix, viewMatrix);\n // Compute the world matrix\n var worldMatrix = m4.identity();\n var worldInverseMatrix = m4.inverse(worldMatrix);\n var worldInverseTransposeMatrix = m4.transpose(worldInverseMatrix);\n // worldViewProjectMatrix\n var worldViewProjectMatrix = m4.multiply(viewProjectionMatrix, worldInverseTransposeMatrix);\n\n // Put it into our main matrix\n //matrix = m4.multiply(matrix, viewProjectionMatrix);\n //matrix = m4.multiply(matrix, worldViewProjectMatrix);\n\n // Set the uniforms in the shaders\n gl.uniformMatrix4fv(programInfo.uniforms.worldViewProjection, false, worldViewProjectMatrix);\n gl.uniformMatrix4fv(programInfo.uniforms.worldInverseTranspose, \n false, \n worldInverseTransposeMatrix);\n gl.uniformMatrix4fv(programInfo.uniforms.world, false, worldMatrix);\n // set the camera/view position\n gl.uniform3fv(programInfo.uniforms.viewWorldPosition, cameraPosition);\n\n //var v = m4.transformPoint(worldMatrix, [20, 30, 50]);\n //gl.uniform3fv(programInfo.uniforms.lightWorldPosition, v);\n\n return worldViewProjectMatrix;\n}", "function updateMatrix(Rpx,Rpy,Gpx,Gpy,Bpx,Bpy,Wpx,Wpy) {\n convCoords = [Rpx,Rpy,Gpx,Gpy,Bpx,Bpy,Wpx,Wpy];\n //http://www.brucelindbloom.com/Eqn_RGB_XYZ_Matrix.html\n //http://www.dr-lex.be/random/matrix_inv.html\n // Convert the (x,y) values to X Y Z.\n var Xr = Rpx / Rpy;\n var Xg = Gpx / Gpy;\n var Xb = Bpx / Bpy;\n var Xw = Wpx / Wpy;\n var Yr = 1;\n var Yg = 1;\n var Yb = 1;\n var Yw = 1;\n var Zr = (1 - Rpx - Rpy) / Rpy;\n var Zg = (1 - Gpx - Gpy) / Gpy;\n var Zb = (1 - Bpx - Bpy) / Bpy;\n var Zw = (1 - Wpx - Wpy) / Wpy;\n\n // Get ready for a bunch of painful math. I need to invert a matrix, then multiply it by a vector.\n // Determinant for inverse matrix\n var sDet = (Xr*((Zb*Yg)-(Zg*Yb)))-(Yr*((Zb*Xg)-(Zg*Xb)))+(Zr*((Yb*Xg)-(Yg*Xb)));\n \n var Sr = ((((Zb*Yg)-(Zg*Yb))/sDet)*Xw) + ((-((Zb*Xg)-(Zg*Xb))/sDet)*Yw) + ((((Yb*Xg)-(Yg*Xb))/sDet)*Zw);\n var Sg = ((-((Zb*Yr)-(Zr*Yb))/sDet)*Xw) + ((((Zb*Xr)-(Zr*Xb))/sDet)*Yw) + ((-((Yb*Xr)-(Yr*Xb))/sDet)*Zw);\n var Sb = ((((Zg*Yr)-(Zr*Yg))/sDet)*Xw) + ((-((Zg*Xr)-(Zr*Xg))/sDet)*Yw) + ((((Yg*Xr)-(Yr*Xg))/sDet)*Zw);\n \n // This should be the completed RGB -> XYZ matrix.\n // Multiply the first three members by R, G, and B respectively, then add\n // them together to get X, for example.\n convMatrix[0] = Sr*Xr;\n convMatrix[1] = Sg*Xg;\n convMatrix[2] = Sb*Xb;\n convMatrix[3] = Sr*Yr;\n convMatrix[4] = Sg*Yg;\n convMatrix[5] = Sb*Yb;\n convMatrix[6] = Sr*Zr;\n convMatrix[7] = Sg*Zg;\n convMatrix[8] = Sb*Zb;\n}", "function determineCameraTransform(camLoc, up) {\r\n\r\n // Perspective Normalization\r\n far = 100;\r\n near = 0.01;\r\n var Sx = 1 / Math.tan(Math.PI/8);\r\n var Sy = 1 / Math.tan(Math.PI/8);\r\n var alpha = ((far + near) / (far - near));\r\n var beta = -2 * near * far / (near - far);\r\n var perspectiveNormalizationXform = mat4(Sx,0,0,0,\r\n 0,Sy,0,0,\r\n 0,0,alpha,beta,\r\n 0,0,-1,0);\r\n\r\n // Translate To Origin\r\n var translateToOriginXform =mat4(1,0,0,-camLoc[0],\r\n 0,1,0,-camLoc[1],\r\n 0,0,1,-camLoc[2],\r\n 0,0,0,1);\r\n\r\n // Rotate Align transform\r\n var z = normalize(camLoc);\r\n var x = normalize(cross(up, z));\r\n var y = normalize(cross(z, x));\r\n var rotateAlignXform = mat4(x[0],x[1],x[2],0,\r\n y[0],y[1],y[2],0,\r\n z[0],z[1],z[2],0,\r\n 0,0,0,1);\r\n\r\n // World to Camera Centric\r\n var worldToCameraCentricXform = mult(rotateAlignXform, translateToOriginXform);\r\n\r\n // World To Canonical View Xform\r\n return mult(perspectiveNormalizationXform, worldToCameraCentricXform);\r\n}", "adjust() {\n this.custom_adjust();\n glMatrix.mat4.perspective(this.projection_matrix, glMatrix.glMatrix.toRadian(tracker.camera.fovy), tracker.camera.aspect, tracker.camera.near, tracker.camera.far);\n glMatrix.mat4.lookAt(this.view_matrix, tracker.camera.eye_point, tracker.camera.aim_point, tracker.camera.up_vector);\n // glMatrix.mat4.identity(this.model_matrix);\n glMatrix.mat4.multiply(this._mvp_matrix, this.projection_matrix, this.view_matrix);\n }", "processSurface(v,j) {\n\n let c = v.position;\n let vtemp, vtemp1;\n // console.log(c);\n // c = new THREE.Vector3(0,0,0);\n // geometry changes\n vtemp = v.children[0].geometry.clone();\n // vtemp = vtemp.applyMatrix( new THREE.Matrix4().makeRotationY(Math.PI/2) );\n vtemp = vtemp.applyMatrix( new THREE.Matrix4().makeTranslation(c.x, c.y, c.z ));\n // let vtemp = v.children[0].geometry;\n vtemp1 = v.children[1].geometry;\n // vtemp1 = vtemp1.applyMatrix( new THREE.Matrix4().makeRotationY(Math.PI/2) );\n vtemp1 = vtemp1.clone().applyMatrix( new THREE.Matrix4().makeTranslation(c.x, c.y, c.z ));\n // debug\n // let mesh = new THREE.Mesh(vtemp1, new THREE.MeshBasicMaterial( {color:0xff0000,side: THREE.DoubleSide, wireframe: true}));\n // v.children[0].material = new THREE.MeshBasicMaterial( {wireframe:true,color:0xff0000,side: THREE.DoubleSide});\n // v.children[1].material = new THREE.MeshBasicMaterial( {wireframe:true,color:0x00ff00,side: THREE.DoubleSide});\n // console.log({v});\n // let test = v.clone();\n // let nn = v.children[1].clone();\n // nn.geometry = v.children[1].geometry.clone();\n // nn.material = new THREE.MeshBasicMaterial( {color:0x00ff00,side: THREE.DoubleSide, wireframe: true});\n // nn.position.copy(v.position);\n \n // nn.rotation.copy(v.rotation);\n // nn.rotateX(Math.PI);\n // nn.geometry.applyMatrix( new THREE.Matrix4().makeRotationX(Math.PI) );\n\n // console.log(v.rotation,'rot');\n // nn.position.copy(v.position);\n // nn.geometry.applyMatrix( new THREE.Matrix4().makeTranslation(v.position.x, v.position.y, v.position.z ) );\n\n // nn.geometry.applyMatrix( new THREE.Matrix4().makeTranslation(-v.position.x, -v.position.y, -v.position.z ) );\n // nn.geometry.applyMatrix( new THREE.Matrix4().makeRotationX(Math.PI) );\n // nn.geometry.applyMatrix( new THREE.Matrix4().makeTranslation(v.position.x, v.position.y, v.position.z ) );\n\n // console.log({v},{nn},{test});\n // this.scene.add(test);\n // if(j===1) {\n // this.scene.add(test);\n // this.scene.add(nn);\n // this.scene.add( new THREE.AxesHelper( 20 ) );\n // }\n \n // \n // console.log({nn});\n \n\n\n let len = v.children[0].geometry.attributes.position.array.length/3;\n let len1 = v.children[1].geometry.attributes.position.array.length/3;\n // console.log(len,len1);\n // fragment id\n let offset = new Array(len).fill(j/100);\n vtemp.addAttribute( 'offset', new THREE.BufferAttribute( new Float32Array(offset), 1 ) );\n\n let offset1 = new Array(len1).fill(j/100);\n vtemp1.addAttribute( 'offset', new THREE.BufferAttribute( new Float32Array(offset1), 1 ) );\n\n // axis\n let axis = getRandomAxis();\n let axes = new Array(len*3).fill(0);\n let axes1 = new Array(len1*3).fill(0);\n for (let i = 0; i < len*3; i=i+3) {\n axes[i] = axis.x;\n axes[i+1] = axis.y;\n axes[i+2] = axis.z;\n }\n vtemp.addAttribute( 'axis', new THREE.BufferAttribute( new Float32Array(axes), 3 ) );\n // volume axes\n for (let i = 0; i < len1*3; i=i+3) {\n axes1[i] = axis.x;\n axes1[i+1] = axis.y;\n axes1[i+2] = axis.z;\n }\n vtemp1.addAttribute( 'axis', new THREE.BufferAttribute( new Float32Array(axes1), 3 ) );\n\n\n // centroid\n let centroidVector = getCentroid(vtemp);\n let centroid = new Array(len*3).fill(0);\n let centroid1 = new Array(len1*3).fill(0);\n for (let i = 0; i < len*3; i=i+3) {\n centroid[i] = centroidVector.x;\n centroid[i+1] = centroidVector.y;\n centroid[i+2] = centroidVector.z;\n }\n for (let i = 0; i < len1*3; i=i+3) {\n centroid1[i] = centroidVector.x;\n centroid1[i+1] = centroidVector.y;\n centroid1[i+2] = centroidVector.z;\n }\n vtemp.addAttribute( 'centroid', new THREE.BufferAttribute( new Float32Array(centroid), 3 ) );\n vtemp1.addAttribute( 'centroid', new THREE.BufferAttribute( new Float32Array(centroid1), 3 ) );\n \n\n return {surface: vtemp, volume: vtemp1};\n }", "function _camera (pMatrix, mvMatrix) {\n _pMatrix = pMatrix;\n _mvMatrix = mvMatrix;\n }", "canvasToWorldCoordinates(p) {\r\n\t\tlet m = MathTools.inverseMatMul(this.camera.t, [\r\n\t\t\t[p.x-window.innerWidth/2+this.camera.x],\r\n\t\t\t[window.innerHeight-(p.y+window.innerHeight/2)+this.camera.y]\r\n\t\t])\r\n\t\treturn {\r\n\t\t\tx: m[0][0],\r\n\t\t\ty: m[1][0]\r\n\t\t}\r\n\t}", "project() {\r\n for (let j = 0; j < this.objs.length; j++) {\r\n let item = this.objs[j];\r\n for (let i = 0; i < item.vertexs.length && i < 3; i++) {\r\n if (item.changed[i]) { // if the drawable has moved position\r\n let fur = this.locate(item.vertexs[i]);\r\n let htheta = Math.atan(fur[2]/fur[0]); // verticle theta\r\n let vtheta = Math.atan(fur[1]/fur[0]); // horizontal theta\r\n\r\n //console.log('fur', fur, 'horiz theta', htheta, 'verticle theta', vtheta);\r\n\r\n if (Math.abs(htheta) < this.cam.fovHoriz && \r\n Math.abs(vtheta) < this.cam.fovVert) item._visible[i] = true;\r\n else item._visible[i] = false;\r\n\r\n // this could be changed to be xy scaled by distance?\r\n let w = this.cvs.width/2;\r\n let h = this.cvs.height/2;\r\n item.projected[i] = [\r\n w + (htheta/this.cam.fovHoriz * w), \r\n h - (vtheta/this.cam.fovVert * h), \r\n fur[2]\r\n ];\r\n \r\n //console.log('vertex visible', item._visible[i], item.projected[i]);\r\n }\r\n }\r\n \r\n }\r\n }", "get modelViewProjectionMatrix$() {\n\t\treturn (this._mvp.m || (this._mvp.m = SpiderGL.Math.Mat4.mul(this.viewProjectionMatrix$, this.modelMatrix$)));\n\t}", "rotCamera(y_axis, x_axis_p)\n\t{\n\t\tlet XYZrotated = {\n\t\t X: null,\n\t\t Y: null,\n\t\t Z: null};\n\t\tXYZrotated = this.rotateXYZ(this.camera.view, y_axis, x_axis_p);\n\t\t// Normalize\n\t\tXYZrotated.X = this.normalizeVect(XYZrotated.X);\n\t\tXYZrotated.Y = this.normalizeVect(XYZrotated.Y);\n\t\tXYZrotated.Z = this.normalizeVect(XYZrotated.Z);\n\t\t// Reduce residue of Y\n\t\tlet a = this.innerProductXYZ(XYZrotated.X, XYZrotated.Y);\n\t\tXYZrotated.Y.x -= a * XYZrotated.X.x;\n\t\tXYZrotated.Y.y -= a * XYZrotated.X.y;\n\t\tXYZrotated.Y.z -= a * XYZrotated.X.z;\n\t\t// Reduce residue of Z\n\t\ta = this.innerProductXYZ(XYZrotated.X, XYZrotated.Z);\n\t\tXYZrotated.Z.x -= a * XYZrotated.X.x;\n\t\tXYZrotated.Z.y -= a * XYZrotated.X.y;\n\t\tXYZrotated.Z.z -= a * XYZrotated.X.z;\n\t\ta = this.innerProductXYZ(XYZrotated.Y, XYZrotated.Z);\n\t\tXYZrotated.Z.x -= a * XYZrotated.Y.x;\n\t\tXYZrotated.Z.y -= a * XYZrotated.Y.y;\n\t\tXYZrotated.Z.z -= a * XYZrotated.Y.z;\n\t\t// Return\n\t\tthis.camera.view = XYZrotated;\n\t}", "resize(width, height) {\n\n let dd2 = (width > height) ? width / 2 : height / 2;\n \n m4_ortho_res(this.projectionMatrix, width, height, -dd2, dd2); \n\n this.near = -dd2;\n this.far = dd2;\n }", "function ReSet(){\n\ttransform.position.x = ((tempLon * 20037508.34 / 180)/100)-iniRef.x;\n\ttransform.position.z = System.Math.Log(System.Math.Tan((90 + tempLat) * System.Math.PI / 360)) / (System.Math.PI / 180);\n\ttransform.position.z = ((transform.position.z * 20037508.34 / 180)/100)-iniRef.z; \n\tcam.position.x = ((tempLon * 20037508.34 / 180)/100)-iniRef.x;\n\tcam.position.z = System.Math.Log(System.Math.Tan((90 + tempLat) * System.Math.PI / 360)) / (System.Math.PI / 180);\n\tcam.position.z = ((cam.position.z * 20037508.34 / 180)/100)-iniRef.z; \n}", "getPoints(){\n let v = this.vertices.slice();\n glmatrix.mat4.identity(this.m);\n\n glmatrix.mat4.multiply(this.m, this.m, this.mT);\n glmatrix.mat4.multiply(this.m, this.m, this.mRY);\n glmatrix.mat4.multiply(this.m, this.m, this.mTAnchor);\n\n\n let verts = [];\n for (var i = 0; i < v.length; i++) {\n glmatrix.vec3.transformMat4(v[i], v[i], this.m);\n }\n\n return v;\n }", "rotCamera(y_axis, x_axis_p)\n\t{\n\t\tlet XYZrotated = {\n\t\t X: null,\n\t\t Y: null,\n\t\t Z: null};\n\t\tXYZrotated = this.rotateXYZ(this.camera.view, y_axis, -x_axis_p);\n\t\t// Normalize\n\t\tXYZrotated.X = this.normalizeVect(XYZrotated.X);\n\t\tXYZrotated.Y = this.normalizeVect(XYZrotated.Y);\n\t\tXYZrotated.Z = this.normalizeVect(XYZrotated.Z);\n\t\t// Reduce residue of Y\n\t\tlet a = this.innerProductXYZ(XYZrotated.X, XYZrotated.Y);\n\t\tXYZrotated.Y.x -= a * XYZrotated.X.x;\n\t\tXYZrotated.Y.y -= a * XYZrotated.X.y;\n\t\tXYZrotated.Y.z -= a * XYZrotated.X.z;\n\t\t// Reduce residue of Z\n\t\ta = this.innerProductXYZ(XYZrotated.X, XYZrotated.Z);\n\t\tXYZrotated.Z.x -= a * XYZrotated.X.x;\n\t\tXYZrotated.Z.y -= a * XYZrotated.X.y;\n\t\tXYZrotated.Z.z -= a * XYZrotated.X.z;\n\t\ta = this.innerProductXYZ(XYZrotated.Y, XYZrotated.Z);\n\t\tXYZrotated.Z.x -= a * XYZrotated.Y.x;\n\t\tXYZrotated.Z.y -= a * XYZrotated.Y.y;\n\t\tXYZrotated.Z.z -= a * XYZrotated.Y.z;\n\t\t// Return\n\t\tthis.camera.view = XYZrotated;\n\t}", "function updateMVP() {\n\n\tviewMatrix_value = SC.getViewMatrix(); // obtain the new view matrix from camera\n\tmvMatrix_value = mat4.create(); // Reset to identity matrix\n\tmvpMatrix_value = mat4.create();\n\tnormalMatrix_value = mat3.create();\n\n\t// Obtain the ModelView Matrix\n\tmat4.multiply(mvMatrix_value, modelMatrix_value, mvMatrix_value);\n\tmat4.multiply(mvMatrix_value, viewMatrix_value, mvMatrix_value);\n\n\t// Based on MV, obtain MVP\n\tmat4.multiply(mvpMatrix_value, mvMatrix_value, mvpMatrix_value);\n\tmat4.multiply(mvpMatrix_value, projMatrix_value, mvpMatrix_value);\n\n\t// Based on MV, obtain Normal Matrix\n\tmat3.fromMat4(normalMatrix_value, mvMatrix_value);\n\tmat3.invert(normalMatrix_value, normalMatrix_value);\n\tmat3.transpose(normalMatrix_value, normalMatrix_value);\n\n\t// Update the graphics card with the latest values\n\tgl.useProgram(shader_program);\n\tgl.uniformMatrix4fv(viewMatrix_location, gl.FALSE, viewMatrix_value);\n\tgl.uniformMatrix4fv(mvMatrix_location, gl.FALSE, mvMatrix_value);\n\tgl.uniformMatrix4fv(mvpMatrix_location, gl.FALSE, mvpMatrix_value);\n\tgl.uniformMatrix3fv(normalMatrix_location, false, normalMatrix_value);\n\tgl.useProgram(null);\n}", "function updateCamera() {\n camera.updateProjectionMatrix();\n }", "function displayViewProjectionMatrices() {\n\t\tdisplayMatrix(\"Projection\", projection, 10, 100);\n\t\tdisplayMatrix(\"Viewport\", viewport, 10, 200);\n\t\tdisplayMatrix(\"Projection-Viewport\", viewportProjection, 10, 300);\n\t}", "_setMVMatrix() {\n if(this._updateMVMatrix) {\n // compose our world transformation matrix from custom origin\n this._matrices.world.matrix = this._matrices.world.matrix.composeFromOrigin(this._translation, this.quaternion, this.scale, this._boundingRect.world.transformOrigin);\n\n // we need to scale our planes, from a square to a right sized rectangle\n // we're doing this after our transformation matrix because this scale transformation always have the same origin\n this._matrices.world.matrix.scale({\n x: this._boundingRect.world.width,\n y: this._boundingRect.world.height,\n z: 1\n });\n\n\n // our model view matrix is our world matrix multiplied with our camera view matrix\n // in our case we're just subtracting the camera Z position to our world matrix\n this._matrices.modelView.matrix.copy(this._matrices.world.matrix);\n this._matrices.modelView.matrix.elements[14] -= this.camera.position.z;\n\n // our modelViewProjection matrix, useful for bounding box calculations and frustum culling\n // this is the result of our projection matrix multiplied by our modelView matrix\n this._matrices.modelViewProjection.matrix = this._matrices.projection.matrix.multiply(this._matrices.modelView.matrix);\n\n // check if we should draw the plane but only if everything has been initialized\n if(!this.alwaysDraw) {\n this._shouldDrawCheck();\n }\n\n // update our matrix uniform\n this.renderer.useProgram(this._program);\n this.gl.uniformMatrix4fv(this._matrices.modelView.location, false, this._matrices.modelView.matrix.elements);\n }\n\n // reset our flag\n this._updateMVMatrix = false;\n }", "get modelViewProjectionMatrix() {\n\t\treturn SpiderGL.Math.Mat4.dup(this.modelViewProjectionMatrix$);\n\t}", "apply(){\n var transform = mat4.create();\n mat4.identity(transform);\n\n mat4.translate(transform, transform, [this.x_center,this.y_center,this.z_center]);\n mat4.rotate(transform, transform, this.elapsedAngle, [0, 1, 0]);\n\n mat4.translate(transform,transform,[this.radius,0,0]);\n\n if(this.direction == 1){\n mat4.rotate(transform,transform,Math.PI,[0,1,0]);\n }\n return transform;\n }", "function d$2(o,r){o.include(o$7),o.vertex.include(r$b,r),o.varyings.add(\"vPositionWorldCameraRelative\",\"vec3\"),o.varyings.add(\"vPosition_view\",\"vec3\"),o.vertex.uniforms.add(\"uTransform_WorldFromModel_RS\",\"mat3\"),o.vertex.uniforms.add(\"uTransform_WorldFromModel_TH\",\"vec3\"),o.vertex.uniforms.add(\"uTransform_WorldFromModel_TL\",\"vec3\"),o.vertex.uniforms.add(\"uTransform_WorldFromView_TH\",\"vec3\"),o.vertex.uniforms.add(\"uTransform_WorldFromView_TL\",\"vec3\"),o.vertex.uniforms.add(\"uTransform_ViewFromCameraRelative_RS\",\"mat3\"),o.vertex.uniforms.add(\"uTransform_ProjFromView\",\"mat4\"),o.vertex.code.add(t$i`vec3 positionWorldCameraRelative() {\nvec3 rotatedModelPosition = uTransform_WorldFromModel_RS * positionModel();\nvec3 transform_CameraRelativeFromModel = dpAdd(\nuTransform_WorldFromModel_TL,\nuTransform_WorldFromModel_TH,\n-uTransform_WorldFromView_TL,\n-uTransform_WorldFromView_TH\n);\nreturn transform_CameraRelativeFromModel + rotatedModelPosition;\n}\nvec3 position_view() {\nreturn uTransform_ViewFromCameraRelative_RS * positionWorldCameraRelative();\n}\nvoid forwardPosition() {\nvPositionWorldCameraRelative = positionWorldCameraRelative();\nvPosition_view = position_view();\ngl_Position = uTransform_ProjFromView * vec4(vPosition_view, 1.0);\n}\nvec3 positionWorld() {\nreturn uTransform_WorldFromView_TL + vPositionWorldCameraRelative;\n}`),o.fragment.uniforms.add(\"uTransform_WorldFromView_TL\",\"vec3\"),o.fragment.code.add(t$i`vec3 positionWorld() {\nreturn uTransform_WorldFromView_TL + vPositionWorldCameraRelative;\n}`);}", "function camera_perspective_view() {\n camera.rotation.x += Math.PI/4;\n camera.position.x = -1;\n camera.position.z = 6;\n camera.position.y = -0.4;\n camera.lookAt(new THREE.Vector3(0,0,0))\n}", "function transform(p) {\n\t\t\t\t\tvar pp = vec4.create();\n\t\t\t\t\tvec3.transformMat4(pp, p, tunnelMatrix);\n\t\t\t\t\tvec3.transformMat4(pp, pp, world);\n\t\t\t\t\tvec3.transformMat4(pp, pp, camera);\n\t\t\t\t\treturn pp;\n\t\t\t\t}", "function findProjection(pos, a, b) {\n let v1 = p5.Vector.sub(a, pos);\n let v2 = p5.Vector.sub(b, pos);\n v2.normalize();\n let sp = v1.dot(v2);\n v2.mult(sp);\n v2.add(pos);\n return v2;\n}", "function drawModel_Merc()\n{\n viewMatrix_Scene3 = mat4.create();\n\n \n \n\t//gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);\n\tgl.useProgram(MercedesProgramObject_Merc);\n\t//lighting details\n\t\n// if(gParts_Table)\n// console.log(gParts_Table.length);\n\n\n\tvar modelMatrix = mat4.create();\n \n \n viewScene3[0] = Math.sin(MercRotY) + MercTransX_Eye\n viewScene3[1] = -1.0 + (MercTransY_Eye * 6)\n viewScene3[2] = Math.cos(MercRotY) + MercTransZ_Eye\n //Initially values [0.0, -1.5, 1.0], [0.0, -1.5, 0.0]\n mat4.lookAt(viewMatrix_Scene3, viewScene3, [MercTransX_Eye, -1.0 + MercTransY_Eye, MercTransZ_Eye], [0.0, 1.0, 0.0]);\n //var angleInRadian = degreeToRadian(gAngle);\n mat4.translate(modelMatrix, modelMatrix, [MercTransX, MercTransY, MercTransZ]);\n\n // mat4.rotateY(modelMatrix, modelMatrix, deg2rad(180));\n mat4.scale(modelMatrix, modelMatrix, [MercScale, MercScale, MercScale]);\n\n GRPushToStack_logo(modelMatrix);\n\t//var angleInRadian = degreeToRadian(gAngle);\n\t// mat4.translate(modelMatrix, modelMatrix, [0.0,transY_Merc,-100.0]);\n // mat4.scale(modelMatrix, modelMatrix, [0.2,0.2,0.2]);\n//\tmat4.rotateY(modelMatrix,modelMatrix,degreeToRadian(gAngleTriangle_modelLoading));\n\t\n\t//gAngleTriangle_modelLoading += 0.005;\n\t//mat4.rotateY(modelMatrix,modelMatrix,degreeToRadian(gAngleTriangle));\n\t//mat4.multiply(modelViewMatrix, modelViewMatrix, modelMatrix);\n\tgl.uniformMatrix4fv(modelUniform_modelLoading_Merc,false,modelMatrix);\n\tgl.uniformMatrix4fv(viewUniform_modelLoading_Merc,false,viewMatrix_Scene3);\n\tgl.uniformMatrix4fv(projectionUniform_modelLoading_Merc,false,perspectiveMatrix);\n gl.uniform3fv(cameraPosUniform_Merc,[0.0,0.0,0.0]);\n\n var lightPos = [100.0,100.0,100.0];\n \n gl.uniform3fv(u_lightDirectionUniform_Merc,vec3.normalize(lightPos,[100.0,100.0,100.0]));\n\n\n\n\t\n\t// if(gParts_Table)\n\t// {\n\t\t\n\n\t// \tfor(var i = 0; i < gParts_Table.length;i++)\n\t// \t{\n\n\t// \t\tif(gbLighting_modelLoading){\n\t// \t\t\tgl.uniform1i(LKeyPressed_modelLoading, 1);\n\t// \t\t\tgl.uniform3fv(LAUniform_modelLoading, light_ambient_modelLoading);\n\t// \t\t\tgl.uniform3fv(LDUniform_modelLoading, light_diffuse_modelLoading);\n\t// \t\t\tgl.uniform3fv(LSUniform_modelLoading, light_specular_modelLoading);\n\t\t\t\t\n\t// \t\t\tgl.uniform4fv(LightPositionUniform_modelLoading, light_position_modelLoading);\n\t\t\t\t\n\t// \t\t\t//set material properties\n\t// \t\t\tgl.uniform3fv(KAUniform_modelLoading, gParts_Table[i].material.ambient);\n\t// \t\t\tgl.uniform3fv(KDUniform_modelLoading, gParts_Table[i].material.diffuse);\n\t// \t\t\tgl.uniform3fv(KSUniform_modelLoading, gParts_Table[i].material.specular);\n\t// \t\t\tgl.uniform1f(MaterialShininessUniform_modelLoading,gParts_Table[i].material.shininess);\n\t\t\t\t\n\t// \t\t\t}\n\t// \t\t\telse\n\t// \t\t\t{\n\t// \t\t\t\t\tgl.uniform1i(LKeyPressed_modelLoading, 0);\n\t// \t\t\t}\n\t// \t\tgl.bindTexture(gl.TEXTURE_2D, gParts_Table[i].material.diffuseMap);\n\n\t// \t\t\tgl.bindVertexArray(vao_mercedes_modelLoading[i]);\n\t\t\n\t// \t\t\tgl.drawArrays(gl.TRIANGLES,0,numElements_Teapot[i]);\n\t// \t}\n \n\t// }\n\n\n if(gParts_Teapot_Merc)\n\t{\n\t\t\n\n\t\tfor(var i = 0; i < gParts_Teapot_Merc.length;i++)\n\t\t{\n\n\t\t\tif(gbLighting_modelLoading_Merc){\n\t\t\t\tgl.uniform1i(LKeyPressed_modelLoading_Merc, 1);\n\t\t\t\t// gl.uniform3fv(LAUniform_modelLoading, light_ambient_modelLoading);\n\t\t\t\t// gl.uniform3fv(LDUniform_modelLoading, light_diffuse_modelLoading);\n\t\t\t\t// gl.uniform3fv(LSUniform_modelLoading, light_specular_modelLoading);\n\t\t\t\t\n\t\t\t\t// gl.uniform4fv(LightPositionUniform_modelLoading, light_position_modelLoading);\n\t\t\t\t\n\t\t\t\t//set material properties\n\t\t\t\tgl.uniform3fv(ambientUniform_Merc, gParts_Teapot_Merc[i].material.ambient);\n\t\t//\t\tgl.uniform3fv(diffuseMapUniform, gParts_Teapot[i].material.diffuseMap);\n\t\t\t\tgl.uniform3fv(diffuseUniform_Merc, gParts_Teapot_Merc[i].material.diffuse);\n gl.uniform3fv(specularUniform_Merc, gParts_Teapot_Merc[i].material.specular);\n\t\t\t\tgl.uniform1f(shininessUniform_Merc,gParts_Teapot_Merc[i].material.shininess);\n\t\t\t\tgl.uniform1f(opacityUniform_Merc,gParts_Teapot_Merc[i].material.opacity);\n\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t\tgl.uniform1i(LKeyPressed_modelLoading_Merc, 0);\n\t\t\t\t}\n\t\t\tgl.bindTexture(gl.TEXTURE_2D, gParts_Teapot_Merc[i].material.diffuseMap);\n\n\t\t\t\tgl.bindVertexArray(vao_teapot_Merc[i]);\n\t\t\n\t\t\t\tgl.drawArrays(gl.TRIANGLES,0,numElements_table[i]);\n\t\t}\n \n\t}\n\t\n\t\n\tgl.useProgram(null);\n\n //logo\n GRDisplayLogo();\n\n\n\t// requestAnimationFrame(drawModel_Merc,canvas);\n\t console.log(i);\n\t\n\t// if( gAngleTriangle_modelLoading_Merc >= 360.0)\n\t// \t\tgAngleTriangle_modelLoading_Merc = 0.0;\n\t// \telse\n\t// \t\tgAngleTriangle_modelLoading_Merc = gAngleTriangle_modelLoading_Merc + 1.0;\n\t\n\t// if( gAngleSquare_modelLoading_Merc >= 360.0)\n\t// \t\tgAngleSquare_modelLoading_Merc = 0.0;\n\t// \telse\n\t// \t\tgAngleSquare_modelLoading_Merc = gAngleSquare_modelLoading_Merc + 1.0;\n}", "function PerspectiveTransform(a11, a21, a31, a12, a22, a32, a13, a23, a33) {\n this.a11 = a11;\n this.a12 = a12;\n this.a13 = a13;\n this.a21 = a21;\n this.a22 = a22;\n this.a23 = a23;\n this.a31 = a31;\n this.a32 = a32;\n this.a33 = a33;\n }", "function calculateMatrixAndOffset(_ref) {\n var projectionMode = _ref.projectionMode,\n positionOrigin = _ref.positionOrigin,\n viewport = _ref.viewport;\n var viewMatrixUncentered = viewport.viewMatrixUncentered,\n projectionMatrix = viewport.projectionMatrix;\n var viewMatrix = viewport.viewMatrix,\n viewProjectionMatrix = viewport.viewProjectionMatrix;\n\n var projectionCenter = void 0;\n\n switch (projectionMode) {\n\n case __WEBPACK_IMPORTED_MODULE_4__lib_constants__[\"a\" /* COORDINATE_SYSTEM */].IDENTITY:\n case __WEBPACK_IMPORTED_MODULE_4__lib_constants__[\"a\" /* COORDINATE_SYSTEM */].LNGLAT:\n projectionCenter = ZERO_VECTOR;\n break;\n\n // TODO: make lighitng work for meter offset mode\n case __WEBPACK_IMPORTED_MODULE_4__lib_constants__[\"a\" /* COORDINATE_SYSTEM */].METER_OFFSETS:\n // Calculate transformed projectionCenter (in 64 bit precision)\n // This is the key to offset mode precision (avoids doing this\n // addition in 32 bit precision)\n var positionPixels = viewport.projectFlat(positionOrigin);\n // projectionCenter = new Matrix4(viewProjectionMatrix)\n // .transformVector([positionPixels[0], positionPixels[1], 0.0, 1.0]);\n projectionCenter = __WEBPACK_IMPORTED_MODULE_2_gl_vec4_transformMat4___default()([], [positionPixels[0], positionPixels[1], 0.0, 1.0], viewProjectionMatrix);\n\n // Always apply uncentered projection matrix if available (shader adds center)\n // Zero out 4th coordinate (\"after\" model matrix) - avoids further translations\n // viewMatrix = new Matrix4(viewMatrixUncentered || viewMatrix)\n // .multiplyRight(VECTOR_TO_POINT_MATRIX);\n viewMatrix = __WEBPACK_IMPORTED_MODULE_1_gl_mat4_multiply___default()([], viewMatrixUncentered || viewMatrix, VECTOR_TO_POINT_MATRIX);\n viewProjectionMatrix = __WEBPACK_IMPORTED_MODULE_1_gl_mat4_multiply___default()([], projectionMatrix, viewMatrix);\n break;\n\n default:\n throw new Error('Unknown projection mode');\n }\n\n var viewMatrixInv = __WEBPACK_IMPORTED_MODULE_0_gl_mat4_invert___default()([], viewMatrix) || viewMatrix;\n var cameraPos = [viewMatrixInv[12], viewMatrixInv[13], viewMatrixInv[14]];\n\n return {\n viewMatrix: viewMatrix,\n viewProjectionMatrix: viewProjectionMatrix,\n projectionCenter: projectionCenter,\n cameraPos: cameraPos\n };\n}", "function createProjection(x1, y1, x2, y2) {\n // Creating two vector objects\n var startVector = createVector(x1, y1);\n var endVector = createVector(x2, y2);\n // Get the direction from strat to end\n var dirVector = endVector.copy().sub(startVector);\n // Save the magnitude = length of the distance\n var magnitude = dirVector.mag();\n // Reduce to unit vector of length 1, then divide the 10 logos in\n dirVector.normalize();\n dirVector.mult(magnitude / 10);\n // This makes all no sense but is working nicely\n for (var i = 0; i < projection.length; i++) {\n startVector.add(dirVector);\n var tempLogo = select('#logo' + i);\n tempLogo.position((startVector.x - LOGOHALF), startVector.y - LOGOHALF);\n }\n}", "function update_model_view() {\r\n\tlet mv = mult(rotateZ(thetas[2]), mult(rotateY(thetas[1]), rotateX(thetas[0])));\r\n\tmv = mult(translate(position[0], position[1], position[2]), mv);\r\n\tmv = mult(scalem(cur_scale, cur_scale, cur_scale), mv);\r\n\tgl.uniformMatrix4fv(model_view_loc, false, flatten(mv));\r\n}", "function setupCamera() {\n camera = new PerspectiveCamera(60, config.Screen.RATIO, 0.1, 1000);\n //camera = new PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);\n //Officiel:x=90,y=40,z=30\n //plus pres:40,10,0\n //47,9,2\n camera.position.x = 90;\n camera.position.y = 40;\n camera.position.z = 30;\n camera.lookAt(new Vector3(0, 0, 0));\n console.log(\"Finished setting up Camera...\");\n scene.add(camera);\n}", "orthoMat4c(left, right, bottom, top, near, far, dest) {\n if (!dest) {\n dest = math.mat4();\n }\n const rl = (right - left);\n const tb = (top - bottom);\n const fn = (far - near);\n\n dest[0] = 2.0 / rl;\n dest[1] = 0.0;\n dest[2] = 0.0;\n dest[3] = 0.0;\n\n dest[4] = 0.0;\n dest[5] = 2.0 / tb;\n dest[6] = 0.0;\n dest[7] = 0.0;\n\n dest[8] = 0.0;\n dest[9] = 0.0;\n dest[10] = -2.0 / fn;\n dest[11] = 0.0;\n\n dest[12] = -(left + right) / rl;\n dest[13] = -(top + bottom) / tb;\n dest[14] = -(far + near) / fn;\n dest[15] = 1.0;\n\n return dest;\n }", "function setProjection(matrix) {\n\t\tif(matrix) {\n\t\t\tmat4.set(matrix, projection);\n\t\t} else {\n\t\t\t// Set frustum to +- size of the canvas.\n\t\t\tvar r = ctx.width;\n\t\t\tvar t = ctx.height;\n\t\t\t// glMatrix has a bug. Set near to far to cancel the wrong transform in glMatrix.\n\t\t\t// mat4.ortho(-r, r, -t, t, 2, 0, projection);\n\t\t\t// Assume an orthogonal projection with a symmetric frustum.\n\t\t\t// Projection should be the unity matrix at this point.\n\t\t\t// See mat4.multiplyVec4 for indices.\n\t\t\tprojection[0] = 1.0 / r;\n\t\t\tprojection[5] = 1.0 / t;\n\t\t\t// We do not clip at the near or far plane,\n\t\t\t// thus we leave out scaling the z-coordinate.\n\t\t\t//projection[10] = //-2/f-n;\n\t\t\t//projection[11] = -(f+n)/(f-n);\n\t\t}\n\t}", "draw(gl) {\n let camera = this.engine.camera;\n let pvmMatrix = mat4.create();\n let modelMatrix = mat4.create(); // Creates a blank identity matrix\n \n // Step A: compute translation, for now z is always at 0.0\n mat4.translate(modelMatrix, modelMatrix, vec3.fromValues(this.originX, this.originY, 0.0));\n // Step B: concatenate with rotation.\n // mat4.rotateZ(matrix, matrix, this.getRotationInRad());\n // Step C: concatenate with scaling\n // mat4.scale(modelMatrix, modelMatrix, vec3.fromValues(this.width, this.height, 1.0));\n\n mat4.multiply(pvmMatrix, camera.getPVMatrix(), modelMatrix);\n\n // Activates the vertex buffer\n gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer.id);\n\n Grid.shader.activate(gl);\n // Describe the characteristic of the vertex position attribute\n gl.vertexAttribPointer(Grid.shader.getPositionLocation(),\n 3, // each element is a 3-float (x,y,z)\n gl.FLOAT, // data type is FLOAT\n false, // if the content is normalized vectors\n 0, // number of bytes to skip in between elements\n 0); // offsets to the first element\n\n gl.enableVertexAttribArray(Grid.shader.getPositionLocation());\n gl.uniformMatrix4fv(Grid.shader.getPVMTransformLocation(), false, pvmMatrix);\n gl.uniform4fv(Grid.shader.getColorLocation(), this.color);\n // Grid.shader.activate();\n\n gl.drawArrays(gl.LINES, 0, this.num_lines * 2);\n\n // Activates the vertex buffer\n gl.bindBuffer(gl.ARRAY_BUFFER, this.backgroundVertexBuffer.id);\n gl.vertexAttribPointer(Grid.shader.getPositionLocation(),\n 3, // each element is a 3-float (x,y,z)\n gl.FLOAT, // data type is FLOAT\n false, // if the content is normalized vectors\n 0, // number of bytes to skip in between elements\n 0); // offsets to the first element\n\n gl.enableVertexAttribArray(Grid.shader.getPositionLocation());\n gl.uniformMatrix4fv(Grid.shader.getPVMTransformLocation(), false, pvmMatrix);\n\n // gl.uniform4fv(Grid.shader.getColorLocation(), [0.0, 0.5, 0.0, 1.0]);\n // gl.drawArrays(gl.TRIANGLES, 0, 36);\n\n for(let i = 0; i < this.num_triangles; i += 1) {\n gl.uniform4fv(Grid.shader.getColorLocation(), this.colors[i]);\n // console.log(this.colors[i]);\n // if (i % 2 == 0) {\n // gl.uniform4fv(Grid.shader.getColorLocation(), [0.0, i / this.num_triangles, 0.0, 1.0]);\n // } else {\n // gl.uniform4fv(Grid.shader.getColorLocation(), [0.0, 0.0, i / this.num_triangles, 1.0]);\n // }\n \n gl.drawArrays(gl.TRIANGLES, i * 3, 3);\n }\n }", "_initMatrices() {\n // create our matrices, they will be set after\n const matrix = new Mat4();\n this._matrices = {\n world: {\n // world matrix (global transformation)\n matrix: matrix,\n },\n modelView: {\n // model view matrix (world matrix multiplied by camera view matrix)\n name: \"uMVMatrix\",\n matrix: matrix,\n location: this.gl.getUniformLocation(this._program.program, \"uMVMatrix\"),\n },\n projection: {\n // camera projection matrix\n name: \"uPMatrix\",\n matrix: matrix,\n location: this.gl.getUniformLocation(this._program.program, \"uPMatrix\"),\n },\n modelViewProjection: {\n // model view projection matrix (model view matrix multiplied by projection)\n matrix: matrix,\n }\n };\n }", "updateMatrix() {\n this.matrix.set(\n 1 - 2 * (Math.pow(this.y, 2) + Math.pow(this.z, 2)),\n 2 * (this.x * this.y - this.s * this.z),\n 2 * (this.x * this.z + this.s * this.y),\n 0,\n 2 * (this.x * this.y + this.s * this.z),\n 1 - 2 * (Math.pow(this.x, 2) + Math.pow(this.z, 2)),\n 2 * (this.y * this.z - this.s * this.x),\n 0,\n 2 * (this.x * this.z - this.s * this.y),\n 2 * (this.y * this.z + this.s * this.x),\n 1 - 2 * (Math.pow(this.x, 2) + Math.pow(this.y, 2)),\n 0,\n 0,\n 0,\n 0,\n 1\n );\n }", "function getMatrixComposed ( { radius: r = 50, latitude: lat = 0, longitude: lon = 0, sclX = 1, sclY = 1, height: sclZ = 1 } = {} ) {\n\n\tconst position = latLonToXYZ( r + 0.5 * sclZ, lat, lon );\n\tconst matrix = new THREE.Matrix4();\n\tconst quaternion = new THREE.Quaternion().setFromRotationMatrix(\n\t\tmatrix.lookAt(\n\t\t\tnew THREE.Vector3( 0, 0, 0 ),\n\t\t\tposition,\n\t\t\tnew THREE.Vector3( 0, 0, 1 )\n\t\t)\n\t);\n\tconst scale = new THREE.Vector3( sclX, sclY, sclZ );\n\n\tmatrix.compose(\n\t\tposition,\n\t\tquaternion,\n\t\tscale\n\t);\n\n\treturn matrix;\n\n}", "render(camera, meshes) {\n // To understand this part, please read the prerequisites resources\n // 观察矩阵 也就是摄像机\n // 在计算机图形学中,如果想换个角度观察一座山,您可以移动摄像机也可以……移动山\n // glm::mat4 CameraMatrix = glm::LookAt(\n // cameraPosition, // the position of your camera, in world space\n // cameraTarget, // where you want to look at, in world space\n // upVector // probably glm::vec3(0,1,0), but (0,-1,0) would make you looking upside-down, which can be great too\n // );\n var viewMatrix = BABYLON.Matrix.LookAtLH(camera.Position, camera.Target, BABYLON.Vector3.Up());\n\n // 投影矩阵 perspective 确定物体距离摄像机的空间距离 xy固定时z大的会画在前面\n // Creates a left-handed perspective projection matrix\n // Generates a really hard-to-read matrix, but a normal, standard 4x4 matrix nonetheless\n // glm::mat4 projectionMatrix = glm::perspective(\n // glm::radians(FoV), // The vertical Field of View, in radians: the amount of \"zoom\". Think \"camera lens\". Usually between 90&deg; (extra wide) and 30&deg; (quite zoomed in)\n // 4.0f / 3.0f, // Aspect Ratio. Depends on the size of your window. Notice that 4/3 == 800/600 == 1280/960, sounds familiar ?\n // 0.1f, // Near clipping plane. Keep as big as possible, or you'll get precision issues.\n // 100.0f // Far clipping plane. Keep as little as possible.\n // );\n var projectionMatrix = BABYLON.Matrix.PerspectiveFovLH(0.78,\n this.workingWidth / this.workingHeight, 0.01, 1.0); //水平视角、宽高比、近水平视场、远水平视场\n\n for (var index = 0; index < meshes.length; index++) {\n // current mesh to work on\n var cMesh = meshes[index];\n // Beware to apply rotation before translation\n\n // 创建世界空间旋转矩阵 平移*旋转\n // 物体所有顶点都应该位于世界空间 物体需要从模型空间(Model Space)(顶点都相对于模型的中心定义)变换到世界空间(顶点都相对于世界空间中心定义)。\n var worldMatrix = BABYLON.Matrix.RotationYawPitchRoll(\n cMesh.Rotation.y, cMesh.Rotation.x, cMesh.Rotation.z)\n .multiply(BABYLON.Matrix.Translation(\n cMesh.Position.x, cMesh.Position.y, cMesh.Position.z)); // Multiply two matrices矩阵相乘\n\n //var transformMatrix => worldMatrix * viewMatrix * projectionMatrix;\n var transformMatrix = worldMatrix.multiply(viewMatrix).multiply(projectionMatrix);\n\n // 8个点的循环\n cMesh.Vertices.forEach(\n meshPoint => {\n // First, we project the 3D coordinates into the 2D space\n var projectedPoint = this.project(meshPoint, transformMatrix);\n // Then we can draw on screen\n this.drawPoint(projectedPoint);\n }\n )\n }\n }", "function getPerspective() {\n P = [\n pn / pr, 0, 0, 0,\n 0, pn / pt, 0, 0,\n 0, 0, -(pf + pn) / (pf - pn), -1,\n 0, 0, -(2 * pf * pn) / (pf - pn), 0\n ];\n}", "function WoWMapProjection(){}", "function ThirdPersonCamera(pos, vPoint, worUp) {\n this.position = pos;\n this.viewPoint = vPoint;\n this.rotationAboutX = 0;\n this.rotationAboutY = 0;\n this.worldUp = worUp;\n\n this.updateVectors();\n}", "get worldCamera() {}", "function matrixFromCamera(state, dimensions) {\n var angle = state.angle, ratio = state.ratio, x = state.x, y = state.y;\n var width = dimensions.width, height = dimensions.height;\n var matrix = matrices_1.identity();\n var smallestDimension = Math.min(width, height);\n var cameraCentering = matrices_1.translate(matrices_1.identity(), -x, -y), cameraScaling = matrices_1.scale(matrices_1.identity(), 1 / ratio), cameraRotation = matrices_1.rotate(matrices_1.identity(), -angle), viewportScaling = matrices_1.scale(matrices_1.identity(), 2 * (smallestDimension / width), 2 * (smallestDimension / height));\n // Logical order is reversed\n matrices_1.multiply(matrix, viewportScaling);\n matrices_1.multiply(matrix, cameraRotation);\n matrices_1.multiply(matrix, cameraScaling);\n matrices_1.multiply(matrix, cameraCentering);\n return matrix;\n}", "function CubeCamera( near, far, cubeResolution ) {\n\n\t \tObject3D.call( this );\n\n\t \tthis.type = 'CubeCamera';\n\n\t \tvar fov = 90, aspect = 1;\n\n\t \tvar cameraPX = new PerspectiveCamera( fov, aspect, near, far );\n\t \tcameraPX.up.set( 0, - 1, 0 );\n\t \tcameraPX.lookAt( new Vector3( 1, 0, 0 ) );\n\t \tthis.add( cameraPX );\n\n\t \tvar cameraNX = new PerspectiveCamera( fov, aspect, near, far );\n\t \tcameraNX.up.set( 0, - 1, 0 );\n\t \tcameraNX.lookAt( new Vector3( - 1, 0, 0 ) );\n\t \tthis.add( cameraNX );\n\n\t \tvar cameraPY = new PerspectiveCamera( fov, aspect, near, far );\n\t \tcameraPY.up.set( 0, 0, 1 );\n\t \tcameraPY.lookAt( new Vector3( 0, 1, 0 ) );\n\t \tthis.add( cameraPY );\n\n\t \tvar cameraNY = new PerspectiveCamera( fov, aspect, near, far );\n\t \tcameraNY.up.set( 0, 0, - 1 );\n\t \tcameraNY.lookAt( new Vector3( 0, - 1, 0 ) );\n\t \tthis.add( cameraNY );\n\n\t \tvar cameraPZ = new PerspectiveCamera( fov, aspect, near, far );\n\t \tcameraPZ.up.set( 0, - 1, 0 );\n\t \tcameraPZ.lookAt( new Vector3( 0, 0, 1 ) );\n\t \tthis.add( cameraPZ );\n\n\t \tvar cameraNZ = new PerspectiveCamera( fov, aspect, near, far );\n\t \tcameraNZ.up.set( 0, - 1, 0 );\n\t \tcameraNZ.lookAt( new Vector3( 0, 0, - 1 ) );\n\t \tthis.add( cameraNZ );\n\n\t \tvar options = { format: RGBFormat, magFilter: LinearFilter, minFilter: LinearFilter };\n\n\t \tthis.renderTarget = new WebGLRenderTargetCube( cubeResolution, cubeResolution, options );\n\n\t \tthis.updateCubeMap = function ( renderer, scene ) {\n\n\t \t\tif ( this.parent === null ) this.updateMatrixWorld();\n\n\t \t\tvar renderTarget = this.renderTarget;\n\t \t\tvar generateMipmaps = renderTarget.texture.generateMipmaps;\n\n\t \t\trenderTarget.texture.generateMipmaps = false;\n\n\t \t\trenderTarget.activeCubeFace = 0;\n\t \t\trenderer.render( scene, cameraPX, renderTarget );\n\n\t \t\trenderTarget.activeCubeFace = 1;\n\t \t\trenderer.render( scene, cameraNX, renderTarget );\n\n\t \t\trenderTarget.activeCubeFace = 2;\n\t \t\trenderer.render( scene, cameraPY, renderTarget );\n\n\t \t\trenderTarget.activeCubeFace = 3;\n\t \t\trenderer.render( scene, cameraNY, renderTarget );\n\n\t \t\trenderTarget.activeCubeFace = 4;\n\t \t\trenderer.render( scene, cameraPZ, renderTarget );\n\n\t \t\trenderTarget.texture.generateMipmaps = generateMipmaps;\n\n\t \t\trenderTarget.activeCubeFace = 5;\n\t \t\trenderer.render( scene, cameraNZ, renderTarget );\n\n\t \t\trenderer.setRenderTarget( null );\n\n\t \t};\n\n\t }", "function figureCamera() {\n camera = new THREE.PerspectiveCamera(100, window.innerWidth / window.innerHeight, 0.1, 1000);\n camera.position.set(1, 1, 4);\n}" ]
[ "0.6858472", "0.6798434", "0.6676082", "0.65245855", "0.6514868", "0.646527", "0.6411898", "0.64096445", "0.63940495", "0.6374187", "0.6373161", "0.636634", "0.6313147", "0.6306902", "0.62800854", "0.62518144", "0.6242374", "0.6195277", "0.61807036", "0.61754405", "0.6171818", "0.61360943", "0.6116328", "0.609625", "0.6093763", "0.60910517", "0.6088772", "0.6077115", "0.60742676", "0.60683113", "0.60469806", "0.60375553", "0.6031388", "0.6027685", "0.6026645", "0.6022845", "0.60180837", "0.6008269", "0.60000867", "0.59924424", "0.5992312", "0.5992312", "0.59830445", "0.59578234", "0.5950477", "0.5941707", "0.5936295", "0.59333336", "0.5927932", "0.5920498", "0.5908788", "0.5901542", "0.5897539", "0.5881882", "0.58771265", "0.58713996", "0.5870281", "0.5869771", "0.58591443", "0.585863", "0.58545274", "0.5849406", "0.5847887", "0.58334166", "0.5828168", "0.58205914", "0.5816351", "0.58058524", "0.58035773", "0.580312", "0.57977384", "0.57621044", "0.5756888", "0.5749906", "0.57456386", "0.5743871", "0.573968", "0.5736037", "0.5711582", "0.5708385", "0.5700749", "0.57002574", "0.56967986", "0.56848544", "0.568158", "0.56773573", "0.5674103", "0.5671822", "0.56710714", "0.56706893", "0.567007", "0.56667465", "0.56561244", "0.5653078", "0.5642133", "0.5641773", "0.5638646", "0.5631112", "0.5625972", "0.56188905", "0.56054884" ]
0.0
-1
atribuir zero ao vetores do escalonamento e translacao aos tres eixos
function zerarEixos (){ eixoTransladar[0] = 0; eixoTransladar[1] = 0; eixoTransladar[2] = 0; eixoEscalar[0] = 0; eixoEscalar[1] = 0; eixoEscalar[2] = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function zerarTransformacao () {\n botaoT = 0; \n botaoS = 0;\n botaoR = 0;\n}", "function reestablece(){\n colector = \"0\";\n operacion = \"\";\n operador0 = 0;\n operador1 = 0;\n resultado = 0;\n iteracion = 0;\n }", "function unDoIVAGastosVenta(IVAxGtos,costoDesProd,IVA) {\n\nvar nvoIVAGtosVenta;\n\n if (IVAxGtos==0) {\n nvoIVAGtosVenta = 0;\n }else {\n nvoIVAGtosVenta = ((IVAxGtos) + (IVAxGastosVenta(costoDesProd,IVA)));\n }\n return nvoIVAGtosVenta;\n}", "function ActualiserPointsVie(){\n\t//les PDV diminuent si le joueur s'eloigne des artefacts (zoneSure) sans lumiere (torcheJoueur)\n\tif(transform.Find(\"torcheJoueur(Clone)\") == null && !zoneSure){\n\t\tif(vitesseCorruption < 0){\n\t\t\tvitesseCorruption = 0;\n\t\t}else{\n\t\t\tvitesseCorruption += Time.deltaTime/2;\n\t\t}\n\t\tpointsVie -= vitesseCorruption*Time.deltaTime;\n\t} else{\n\t\t//la vitesse de reduction des PDV diminue jusqu'a 0\n\t\tif(vitesseCorruption > 0){\n\t\t\tvitesseCorruption -= Time.deltaTime*2;\n\t\t}else{\n\t\t\tvitesseCorruption = 0;\n\t\t\t//soigne si la vitesse de corruption est 0 et le joueur a obtenu la potion\n\t\t\tif(Joueur.powerUpPotion){\n\t\t\t\tpointsVie += Time.deltaTime;\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t}\n\t//actualise l'element visuel\n\tbarreVie.fillAmount = pointsVie/pointsVieMax;\n}", "function zero(){ return 0;}", "nuevoCiclo() {\n let suma = 0;\n for (let i = 0; i < this.vecinos.length; i++) {\n if (this.vecinos[i].estado === 1) {\n suma++;\n }\n }\n\n // Aplicamos las normas\n this.estadoProx = this.estado; // Por defecto queda igual\n\n // Vida: tiene 3 vecinos\n if (this.estado === 0 && suma === 3) {\n this.estadoProx = 1;\n }\n\n // Muerte: menos de 2(soledad) o mas de 3 (inanicion)\n if (this.estado == 1 && (suma < 2 || suma > 3)) {\n this.estadoProx = 0;\n }\n }", "ajuste_potencia(){\n if (this.energia_disponible()){\n let danio_total = this.calcular_danio_total();\n let inyect_total = this.inyectores_disponibles();\n let plasma_inyector = (danio_total+this._plasma_requerido - inyect_total * limit_plasma)/this.inyectores_disponibles();\n for (let i = 0; i < this._injectores.length; i++) {\n if (this._injectores[i]._danio_por!==100){\n if (plasma_inyector<0){\n this._injectores[i].set_plasma = this._injectores[i].calcular_poder()+plasma_inyector;\n } else {\n this._injectores[i].set_plasma = this._injectores[i].calcular_poder();\n this._injectores[i].set_extra_plasma = plasma_inyector;\n\n }\n }\n }\n this._potencia_disponible = true;\n } else {\n this._potencia_disponible = false;\n\n }\n }", "function afficherLesZeros() {\n\tif ( typeof ordZer != \"undefined\") {//si l'object existe on le retire.\n\t\tboard.removeObject(ordZer);\n\t}\n\tif ( typeof zero1 != \"undefined\") {\n\t\tboard.removeObject(zero1);\n\t}\n\tif ( typeof zero2 != \"undefined\") {\n\t\tboard.removeObject(zero2);\n\t}\n\tordZer = board.create('point', [0, (dynamiqueC())], {\n\t\tstyle : 6,\n\t\tname : '',\n\t\tfixed : true\n\t});\n\tordZer.setAttribute({\n\t\tstrokeColor : 'black',\n\t\tfillColor : 'red',\n\t\tsize : 4\n\t});\n\tvar discriminant = dynamiqueB() * dynamiqueB() - (4 * dynamiqueA() * dynamiqueC());\n\tvar valDiscriminant = Math.sqrt(discriminant);\n\tif (discriminant > 0) {\n\t\tvar premierZero = ((-dynamiqueB() + valDiscriminant) / (2 * dynamiqueA())).toFixed(2);\n\t\tvar deuxiemeZero = ((-dynamiqueB() - valDiscriminant) / (2 * dynamiqueA())).toFixed(2);\n\t\tzero1 = board.create('point', [premierZero, 0], {\n\t\t\tstyle : 6,\n\t\t\tname : premierZero,\n\t\t\tfixed : true\n\t\t});\n\t\tzero1.setAttribute({\n\t\t\tstrokeColor : 'black',\n\t\t\tfillColor : 'red',\n\t\t\tsize : 4\n\t\t});\n\t\tzero2 = board.create('point', [deuxiemeZero, 0], {\n\t\t\tstyle : 6,\n\t\t\tname : deuxiemeZero,\n\t\t\tfixed : true\n\t\t});\n\t\tzero2.setAttribute({\n\t\t\tstrokeColor : 'black',\n\t\t\tfillColor : 'red',\n\t\t\tsize : 4\n\t\t});\n\t\t// Afficher les 2 zéros\n\t\tboard.on('update', function() {\n\t\t\tdocument.getElementById('lesZeros').innerHTML = \"Les zéros sont: \" + premierZero + \" et \" + deuxiemeZero;\n\t\t});\n\t} else if (discriminant < 0) {\n\t\tvar bulleAucuneSolution = board.create('text', [-2, 0, \" L'équation n'a aucune solution \"], {\n\t\t\tanchor : ordZer,\n\t\t\tstrokeColor : \"#fff\",\n\t\t\tcssClass : 'mytext'\n\t\t});\n\t\t// équation test: x²- 3x+4\n\n\t\t// si le discriminant est < 0, Afficher que l'équation n'a pas de zéros\n\t\tboard.on('update', function() {\n\t\t\tdocument.getElementById('lesZeros').innerHTML = \"L'équation n'a pas de zéros\";\n\t\t});\n\n\t} else if (discriminant == 0) {\n\t\tvar seulZero = point1.X();\n\t\t// si le discriminant ==0, Afficher le seul zéro de l'équation\n\t\tboard.on('update', function() {\n\t\t\tdocument.getElementById('lesZeros').innerHTML = \"Il y a un seul zéro: \" + seulZero;\n\t\t});\n\n\t}\n\n\t//injecter les valeurs des paramètres a, b et c dans la formule quadratique pour\n\t//qu'ils s'affichent de façon dynamique\n\n\tboard.on('update', function() {\n\t\tdocument.getElementById('paraB').innerHTML = dynamiqueB();\n\t});\n\tboard.on('update', function() {\n\t\tdocument.getElementById('paraB2').innerHTML = dynamiqueB();\n\t});\n\tboard.on('update', function() {\n\t\tdocument.getElementById('paraA').innerHTML = \"(\" + dynamiqueA() + \")\";\n\t});\n\tboard.on('update', function() {\n\t\tdocument.getElementById('paraC').innerHTML = \"(\" + dynamiqueC() + \")\";\n\t});\n\tboard.on('update', function() {\n\t\tdocument.getElementById('paraA2').innerHTML = \"(\" + dynamiqueA() + \")\";\n\t});\n\tpoint1.on('move', function() {//function pour cacher le bulles avec un event.\n\t\tif ( typeof ordZer != \"undefined\") {//si l'object existe on le detruis.\n\t\t\tordZer.setAttribute({\n\t\t\t\tvisible : false\n\t\t\t});\n\t\t}\n\t\tif ( typeof zero1 != \"undefined\") {\n\t\t\tzero1.setAttribute({\n\t\t\t\tvisible : false\n\t\t\t});\n\t\t}\n\t\tif ( typeof zero2 != \"undefined\") {\n\t\t\tzero2.setAttribute({\n\t\t\t\tvisible : false\n\t\t\t});\n\t\t}\n\t\tif ( typeof bulleAucuneSolution != \"undefined\") {\n\t\t\tbulleAucuneSolution.setAttribute({\n\t\t\t\tvisible : false\n\t\t\t});\n\t\t}\n\t});\n\tpoint2.on('move', function() {//function pour cacher la bulle et les zeros avec un event.\n\t\tif ( typeof ordZer != \"undefined\") {//si l'object existe on le retire.\n\t\t\tordZer.setAttribute({\n\t\t\t\tvisible : false\n\t\t\t});\n\t\t}\n\t\tif ( typeof zero1 != \"undefined\") {\n\t\t\tzero1.setAttribute({\n\t\t\t\tvisible : false\n\t\t\t});\n\t\t}\n\t\tif ( typeof zero2 != \"undefined\") {\n\t\t\tzero2.setAttribute({\n\t\t\t\tvisible : false\n\t\t\t});\n\t\t}\n\t\tif ( typeof bulleAucuneSolution != \"undefined\") {\n\t\t\tbulleAucuneSolution.setAttribute({\n\t\t\t\tvisible : false\n\t\t\t});\n\t\t}\n\t});\n}", "function trataColisoes()\n{\n //lateral esquerda - 1\n if(esfera.posicao[0] - esfera.raio < parametrosMesa.xMin)\n {\n if(ultimaColisao != 1)\n {\n veloc[0] = -parametrosMesa.coeficienteRestituicao * veloc[0];\n ultimaColisao = 1;\n } \n }\n\n //lateral direita - 2\n if(esfera.posicao[0] + esfera.raio > parametrosMesa.xMax)\n {\n if(ultimaColisao != 2)\n {\n veloc[0] = -parametrosMesa.coeficienteRestituicao * veloc[0];\n ultimaColisao = 2;\n } \n }\n\n //cima - 3\n if(esfera.posicao[1] - esfera.raio < parametrosMesa.zMax)\n {\n if(ultimaColisao != 3)\n {\n veloc[2] = -parametrosMesa.coeficienteRestituicao * veloc[2];\n ultimaColisao = 3; \n }\n \n }\n\n //corredor direito - 4\n if(esfera.posicao[1] - esfera.raio > -30)\n { \n if( ( (esfera.posicao[0] - esfera.raio < -19.75) && (esfera.posicao[0] + esfera.raio > -17.75) ) || \n ( (esfera.posicao[0] + esfera.raio > -18.75) && (esfera.posicao[0] - esfera.raio < -20.75) ) )\n {\n if(ultimaColisao != 4)\n {\n veloc[0] = -parametrosMesa.coeficienteRestituicao * veloc[0];\n ultimaColisao = 4;\n } \n }\n \n\n //corredor esquerdo - 5\n if( (esfera.posicao[0] + esfera.raio > 19.04) && (esfera.posicao[0] - esfera.raio < 21.04) || \n (esfera.posicao[0] - esfera.raio < 20.04) && (esfera.posicao[0] + esfera.raio > 18.04) )\n {\n if(ultimaColisao != 5)\n {\n veloc[0] = -parametrosMesa.coeficienteRestituicao * veloc[0];\n ultimaColisao = 5;\n } \n }\n }\n\n /*//corner direito - 6\n if(esfera.posicao[0] - esfera.posicao[1] >= 50)\n {\n if(ultimaColisao != 6)\n {\n //TODO \n var normal = [-0.7, 0, -0.7];\n var normalx2 = [-1.4, 0, -1.4];\n var cosseno = mult(normal, normalize(veloc));\n var quase = mult(normalx2, cosseno);\n var vetorRefletido = subtract(quase, normalize(veloc) );\n veloc[0] = vetorRefletido[0]; veloc[2] = vetorRefletido[2];\n ultimaColisao = 6;\n }\n }\n\n //corner esquerdo - 7\n if(-esfera.posicao[0] + esfera.posicao[1] >= 50){\n if(ultimaColisao != 7)\n {\n //TODO \n var normal = [-0.7, 0, -0.7];\n var normalx2 = [-1.4, 0, -1.4];\n var cosseno = mult(normal, normalize(veloc));\n var quase = mult(normalx2, cosseno);\n var vetorRefletido = subtract(quase, normalize(veloc) );\n veloc[0] = vetorRefletido[0]; veloc[2] = vetorRefletido[2];\n ultimaColisao = 7;\n }\n }*/\n}", "function mantenerPosicion()\n{\n if(vaca.cargaOK)\n {\n for(var i=0; i < cantidadVacas; i++)\n {\n var x = aleatorio(0, 25);\n var y = aleatorio(0, 25);\n var x = x * 30;\n var y = y * 20;\n xVaca[i] = x;\n yVaca[i] = y;\n }\n if(cerdo.cargaOK)\n {\n for(var i=0; i < cantidadCerdos; i++)\n {\n var x = aleatorio(0, 25);\n var y = aleatorio(0, 25);\n var x = x * 30;\n var y = y * 20;\n xCerdo[i] = x;\n yCerdo[i] = y;\n }\n }\n if(pollo.cargaOK)\n {\n for(var i=0; i < cantidadPollos; i++)\n {\n var x = aleatorio(0, 25);\n var y = aleatorio(0, 25);\n var x = x * 30;\n var y = y * 20;\n xPollo[i] = x;\n yPollo[i] = y;\n }\n }\n }\n dibujar();\n}", "function DescuentoASO(){\n //obtiene sal_aso\n var sal_aso=document.getElementById(\"sal_aso\").value\n //valor del input de sueldo neto\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n //si anteriormente ya tenia un valor restaura ante cambios del operador\n if(sal_aso > 0)\n {\n var suma=parseFloat(SaldoNeto) + parseFloat(sal_aso);\n document.getElementById(\"sueldoNeto\").value=suma;\n }\n //valor del input ASO\n var monto= document.getElementById('InputASO').value;\n //el nuevo valor de Saldo Neto\n var SaldoNeto= document.getElementById(\"sueldoNeto\").value;\n document.getElementById(\"sueldoNeto\").value=(SaldoNeto-monto);\n document.getElementById(\"sal_aso\").value=monto;\n //guardamos el valor de salario neto(esto se actualizara con cada descuento)\n var sueldoneto=document.getElementById('sueldoNeto').value;\n document.getElementById(\"sal_neto\").value=sueldoneto;\n }", "function controlDiferenciaFaltanteSobrante()\n{\n let totalGeneral=0;\n if($(\"#totalEfectivo\").val()==\"\"){\n $(\"#totalEfectivo\").val(0)\n }\n \n if($(\"#totalCheque\").val()==\"\"){\n $(\"#totalCheque\").val(0)\n }\n if($(\"#totalTarjeta\").val()==\"\"){\n $(\"#totalTarjeta\").val(0)\n }\n totalGeneral=totalGeneral+parseInt($(\"#totalEfectivo\").val());\n totalGeneral=totalGeneral+parseInt($(\"#totalCheque\").val());\n totalGeneral=totalGeneral+parseInt($(\"#totalTarjeta\").val());\n totalGeneral=totalGeneral+parseInt($(\"#montoAperturaCaja\").val());\n if (totalGeneral>totalCaja) {\n $(\"#totalFaltante\").val(0);\n $(\"#sobrante\").val(totalGeneral-totalCaja);\n }else if (totalGeneral<totalCaja) {\n $(\"#totalFaltante\").val(totalCaja-totalGeneral);\n $(\"#sobrante\").val(0);\n } else {\n $(\"#totalFaltante\").val(0);\n $(\"#sobrante\").val(0);\n }\n $(\"#montoCierre\").val(totalGeneral);\n console.warn(totalCaja);\n console.warn(totalGeneral);\n\n}", "function botonera_push_btn3_0() \n {\n var txt3_respuesta =$(\"#p3_respuesta\").text();\n\n if(isNaN(txt3_respuesta))\n {\n // txt3_respuesta = 0;\n }else\n {\n txt3_respuesta = txt3_respuesta + 0;\n }\n\n $(\"#p3_respuesta\").text(txt3_respuesta);\n \n }", "function DescuentoAusencia(){\n //recupero el valor de ausencia\n var sal_aus= document.getElementById(\"sal_aus\").value;\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n //reestablece los valores al cambiar dias\n if(sal_aus > 0)\n {\n var suma=parseFloat(SaldoNeto) + parseFloat(sal_aus);\n document.getElementById(\"sueldoNeto\").value=suma;\n \n }\n var SueldoBrutoIni=document.getElementById('sueldoBruto').value;\n //calcula el jpornal diario\n var jornal=SueldoBrutoIni/30;\n //obtiene la cantidad de dias\n var dias=document.getElementById('DiaAusencia').value;\n //calcula jornal diario por cantidad de dias\n document.getElementById(\"sal_aus\").value=jornal*dias;\n //Actualiza el neto a cobrar\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n document.getElementById(\"sueldoNeto\").value=SaldoNeto-(jornal*dias);\n //guardamos el valor de salario neto(esto se actualizara con cada descuento)\n var sueldoneto=document.getElementById('sueldoNeto').value;\n document.getElementById(\"sal_neto\").value=sueldoneto;\n \n \n }", "function realizarInversion() {\n \n rangos = rango.getRango()\n // Ya estamos haciendo una/s inversion/es\n if (realizandoInversion == true){}\n \n // Podemos realizar inversiones\n else {\n \n realizandoInversion = true\n\n // Hacemos algunas comprobaciones\n // TODO Añadir que solo cojas aquellos que tengan keys\n comprobarPreInversion(function(superanComprobaciones){\n \n console.log('Superan las comprobaciones: ', superanComprobaciones)\n \n // Obtenemos los mejores valores para invertir de cada usuario\n obtenerValoresOptimosXUsuario(superanComprobaciones,function(monedasXUsuario,mejoresValores){\n \n // Obtenemos las monedas no penalizadas de cada usuario\n obtenerNoPenalizadasXUsuario(monedasXUsuario,superanComprobaciones,function(noPenalizadasXUsuario){\n \n // Solo compraremos aquellas monedas que no tengamos\n seleccionMonedasNuevas(noPenalizadasXUsuario,superanComprobaciones,function(noCompradasXUsuario){\n \n // Filtramos por el crecimiento de la moneda en las ultimas 3horas\n filtrarCrecimienPositivo(noCompradasXUsuario,{minutos:[180],intervalos:[5]},function(primerCrecPositivo){\n \n console.log('Primer crecPositivo ' , primerCrecPositivo)\n \n // Filtramos de nuevo por el crecimiento de la moneda en los ultimos 30min\n filtrarCrecimienPositivo(primerCrecPositivo,{minutos:[30],intervalos:[5]},function(segundoCrecPositivo){\n \n console.log('Segundo crec positivo ', segundoCrecPositivo)\n\n // Calculamos la cantidad de operaciones que podemos hacer\n calcularNumeroOperaciones(segundoCrecPositivo,function(opsXUsuario,parametros){\n \n // Elegimos las monedas que vamos a comprar\n // de manera aleatoria\n elegirMonedas(segundoCrecPositivo,opsXUsuario,function(monedasElegidasXUsuario){\n \n console.log(' ')\n console.log('Preparamos compras ',monedasElegidasXUsuario)\n console.log(' ')\n \n // Preparamos las compras (precios,cantidades,moneda..etc)\n prepararCompra(monedasElegidasXUsuario,parametros,function(comprasXUsuario){\n \n // Compramos las monedas elegidas\n comprarMonedas(comprasXUsuario,function(compradas,usuariosConCompras){\n\n // Calculamos la cantidad gastada por cada usuario\n prepararActualizacionSaldo(compradas,function(gastadoXUsuario){\n\n // Actualizamos el saldo de cada usuario\n actualizarSaldo(gastadoXUsuario,function(errores,params){\n\n if (errores){console.log('Ha habido problemas a la hora de actualizar el saldo')}\n \n // Añadimos las monedas al seguimiento de compras\n crearSeguimientoCompras(compradas,params)\n\n })\n }) \n })\n })\n }) \n })\n })\n })\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n })\n })\n })\n })\n }\n}", "constructor(){\n this.hasSavedValues = false\n this.publicoAlvoSim= 0,\n this.publicoAlvoNao= 0,\n this.publicoAlvoALVA= 0,\n this.XER= 0,\n this.COP= 0,\n this.listaPrefixos= [],\n this.operacaoNaoVinculada= 0,\n this.operacaoVinculada= 0,\n this.operacaoVinculadaEmOutroNPJ= 0,\n this.acordoRegPortalSim= 0,\n this.acordoRegPortalNao= 0,\n //this.acordoRegPortalDuplicados= 0,\n this.totaisEstoque = 0,\n this.totaisFluxo = 0,\n this.estoqueNumber= 0,\n this.fluxoNumber= 0,\n this.duplicadoSimNao = 0,\n this.analisadoSimNao = 0\n }", "function _AtualizaPontosVida() {\n // O valor dos ferimentos deve ser <= 0.\n var pontos_vida_corrente =\n gPersonagem.pontos_vida.total_dados + gPersonagem.pontos_vida.bonus.Total() + gPersonagem.pontos_vida.temporarios\n - gPersonagem.pontos_vida.ferimentos - gPersonagem.pontos_vida.ferimentos_nao_letais;\n ImprimeNaoSinalizado(\n pontos_vida_corrente, Dom('pontos-vida-corrente'));\n Dom('pontos-vida-dados').value = gPersonagem.pontos_vida.total_dados ?\n gPersonagem.pontos_vida.total_dados : '';\n ImprimeSinalizado(\n gPersonagem.pontos_vida.bonus.Total(), Dom('pontos-vida-bonus'), false);\n ImprimeSinalizado(\n gPersonagem.pontos_vida.temporarios, Dom('pontos-vida-temporarios'), false);\n ImprimeSinalizado(\n -gPersonagem.pontos_vida.ferimentos, Dom('ferimentos'), false);\n ImprimeSinalizado(\n -gPersonagem.pontos_vida.ferimentos_nao_letais, Dom('ferimentos-nao-letais'), false);\n\n // Companheiro animal.\n if (gPersonagem.canimal != null) {\n Dom('pontos-vida-base-canimal').value = gPersonagem.canimal.pontos_vida.base;\n Dom('pontos-vida-temporarios-canimal').value = gPersonagem.canimal.pontos_vida.temporarios;\n var pontos_vida_canimal = gPersonagem.canimal.pontos_vida;\n ImprimeSinalizado(-pontos_vida_canimal.ferimentos, Dom('ferimentos-canimal'), false);\n ImprimeSinalizado(-pontos_vida_canimal.ferimentos_nao_letais, Dom('ferimentos-nao-letais-canimal'), false);\n var pontos_vida_corrente_canimal =\n pontos_vida_canimal.base + pontos_vida_canimal.bonus.Total() + pontos_vida_canimal.temporarios\n - pontos_vida_canimal.ferimentos - pontos_vida_canimal.ferimentos_nao_letais;\n Dom('pontos-vida-corrente-canimal').textContent = pontos_vida_corrente_canimal;\n Dom('notas-canimal').textContent = gPersonagem.canimal.notas;\n Dom('canimal-raca').value = gPersonagem.canimal.raca;\n }\n\n // Familiar.\n if (gPersonagem.familiar == null ||\n !(gPersonagem.familiar.chave in tabelas_familiares) ||\n !gPersonagem.familiar.em_uso) {\n return;\n }\n Dom('pontos-vida-base-familiar').textContent = gPersonagem.familiar.pontos_vida.base;\n Dom('pontos-vida-temporarios-familiar').value = gPersonagem.familiar.pontos_vida.temporarios;\n var pontos_vida_familiar = gPersonagem.familiar.pontos_vida;\n ImprimeSinalizado(-pontos_vida_familiar.ferimentos, Dom('ferimentos-familiar'), false);\n ImprimeSinalizado(-pontos_vida_familiar.ferimentos_nao_letais, Dom('ferimentos-nao-letais-familiar'), false);\n var pontos_vida_corrente_familiar =\n pontos_vida_familiar.base + pontos_vida_familiar.bonus.Total() + pontos_vida_familiar.temporarios\n - pontos_vida_familiar.ferimentos - pontos_vida_familiar.ferimentos_nao_letais;\n Dom('pontos-vida-corrente-familiar').textContent = pontos_vida_corrente_familiar;\n}", "setZero() {\n _instance.setZero()\n }", "function reglaRebajaPrecios(){\n if(producto.super_avance.sellIn = 0)\n {\n precio_SuperAvance - 2;\n\n if(producto.fc_superduper.sellIn = 0){\n precio_FullSuperDuper - 2;\n\n if(producto.f_cobertura.sellIn = 0){\n precio_FullCobertura - 2;\n }\n }\n }else{\n }\n}", "function actualizarCantidadMovimientos() {\n limiteMovimientos -= 1;\n}", "function ultimo_mes(){\n if(mes_actual!=0){\n mes_actual--;\n }else if(mes_actual==0){\n mes_actual=10;\n año_actual--;\n }\n dibujar_fecha();\n escribir_mes();\n escogerdia1();\n escogerdia2();\n}", "function mesAnt() {\r\n if (mesActu === 0) {\r\n //si el mes actual es enero, se decrementa en 1 el año y se coloca como mes actual diciembre\r\n anioActu--;\r\n mesActu = 11;\r\n llenarMes();\r\n } else {\r\n mesActu--;\r\n llenarMes();\r\n }\r\n}", "function potencia(base, expoente) {\n return 0\n}", "function PontosComeco(){\r\n\r\n if(pontuacao == 0){\r\n\r\n pontuacao = 0\r\n Pontos.innerText = pontuacao\r\n }\r\n}", "function atualizaEstoque(estoqueTotal, gatos = 0, cachorros = 0){\n let movimentoGatos = validaMovimentoGatos(estoqueTotal.gatos, gatos); \n let movimentoCachorros = validaMovimentoCachorros(estoqueTotal.cachorros, cachorros); \n let saldoGatos = estoqueTotal.gatos + movimentoGatos //atualiza o estique de gatos\n let saldoCachorros = estoqueTotal.cachorros + movimentoCachorros // atualiza o esstoque de cachorros\n\n let saldoTotal = saldoGatos + saldoCachorros;\n\n return {\n gatos: saldoGatos,\n cachorros: saldoCachorros,\n total: saldoTotal,\n }\n}", "siguienteNivel() {\n this.subnivel = 0\n this.iluminar()\n this.agregarSecuencia()\n }", "function updateValues() {\r\n //Toma los valores de cada transaccion ingresada\r\n const amounts = transactions.map(transaction => transaction.amount);\r\n //Sumando y restando todos los valores\r\n const total = amounts.reduce((acc, item) => (acc += item), 0).toFixed(2);\r\n\r\n //Ingresos totales\r\n const income = amounts\r\n .filter(item => item > 0)\r\n .reduce((acc, item) => (acc += item), 0)\r\n .toFixed(2);\r\n\r\n //Egresos o expensas totales\r\n const expense = (\r\n amounts.filter(item => item < 0).reduce((acc, item) => (acc += item), 0) *-1\r\n ).toFixed(2);\r\n\r\n // Mostrando en pantalla lo calculado anteriormente\r\n balance.innerText = `$${total}`;\r\n money_plus.innerText = `$${income}`;\r\n money_minus.innerText = `$${expense}`;\r\n}", "function EntradasAdicionarFerimentos(valor, nao_letal) {\n var tipo = nao_letal ? \"ferimentos_nao_letais\" : \"ferimentos\";\n gEntradas[tipo] += valor;\n if (gEntradas[tipo] < 0) {\n gEntradas[tipo] = 0;\n }\n}", "function EntradasAdicionarFerimentos(valor, nao_letal) {\n var tipo = nao_letal ? \"ferimentos_nao_letais\" : \"ferimentos\";\n gEntradas[tipo] += valor;\n if (gEntradas[tipo] < 0) {\n gEntradas[tipo] = 0;\n }\n}", "movimientochamp()\n {\n \n if(this.disminuyendoVelocidad && this.speed > -this.limitspeed){\n this.speed -= this.aceleracion; //Disminuye Vel\n this.disminuyendoVelocidad = false;\n }\n\n if(this.aumentandoVelocidad){\n this.speed += this.aceleracion; //Aumenta vel.\n this.aumentandoVelocidad = false;\n }\n this.moverse();\n }", "function touches0() {\n\tif (num[14]==true){\n\t\twindow.document.calculatrice.affiche.value = \n\t\twindow.document.calculatrice.affiche.value + \"0\";\n\t} else {\n\t\twindow.document.calculatrice.affiche.value = \n\t\twindow.document.calculatrice.affiche.value + \"\";\n\t}\n}", "function putzero(e)\n {\n e.target.value==='' && change(0,index)\n }", "function decrease() {\n if ((seconds) > 0) {\n console.log('TRUEEEE')\n setSeconds(seconds => seconds - 1)\n\n if (isSingle) setElixir(elixir => subtract_or_min(elixir, (1 / SINGLE_RATE), 0))\n else if (isDouble) setElixir(elixir => subtract_or_min(elixir, (1 / DOUBLE_RATE), 0))\n else if (isTriple) setElixir(elixir => subtract_or_min(elixir, (1 / TRIPLE_RATE), 0))\n } else reset()\n \n }", "resumen_estado_nave(){\n this.ajuste_potencia();\n if (typeof this._potencia_disponible !== \"undefined\"){\n if (this._potencia_disponible){\n let estado_plasma = \"\";\n for (let i = 0; i < this._injectores.length; i++) {\n estado_plasma += \"Plasma \"+i.toString()+\": \";\n let total = this._injectores[i].get_plasma+this._injectores[i].get_extra_plasma;\n estado_plasma += total+\"mg/s \";\n }\n console.log(estado_plasma);\n\n for (let i = 0; i < this._injectores.length; i++) {\n if (this._injectores[i].get_danio_por<100){\n if (this._injectores[i].get_extra_plasma>0){\n console.log(\"Tiempo de vida: \"+this._injectores[i].tiempo_vuelo().toString()+\" minutos.\");\n } else {\n console.log(\"Tiempo de vida infinito!\");\n break;\n }\n }\n }\n } else {\n console.log(\"Unable to comply.\")\n console.log(\"Tiempo de vida 0 minutos.\")\n }\n } else {\n throw \"_potencia_disponible: NO DEFINIDA\";\n }\n }", "updateTCUs() {\r\n this.calculateTCUs(-1, -1);\r\n }", "function resetValOrden() {\n entra = false;\n sale = false;\n tray = false;\n trayLin = false;\n initIn = false;\n initMul = false;\n idLineTray = -1;\n idTray = -1;\n valTLF = false;\n valMovTF = false;\n elimEF = false;\n elimSI = false;\n elimSF = false;\n elimTR = false;\n elimTLF = false;\n elimTLI = false;\n elimTM = false;\n}", "resetInvincibility() {\n this.currentInvincibility = 0;\n }", "function vaciarCesta(){\n //borrar los productos guardados en el array\n arrayCesta=[];\n //Renderizar cambios\n renderCesta();\n calcularTotal();\n}", "function valueReset(){\n miContador.valueInit = 0;\n miContador.valueMax = 1000;\n miContador.valueActual = 0;\n miContador.valueMin = -1000;\n alert(miContador.valueActual);\n}", "cambio(){\n\n productos.forEach(producto => {\n if(producto.nombre === this.productoSeleccionado) this.productoActual = producto;\n });\n\n //Ver si el producto actual tiene varios precios\n if(this.productoActual.variosPrecios){\n //Verificar si sobrepasa algun precio extra\n\n //Si es menor al tope del primer precio\n if(this.cantidadActual < this.productoActual.precios.primerPrecio.hasta){\n this.precioActual = this.productoActual.precios.primerPrecio.precio;\n //Seteamos el precio tachado a 0 de nuevo\n this.precioPorUnidadTachado = 0;\n }\n //Si es mayor o igual al tope del primer precio pero menor al tope del segundo\n else if(this.cantidadActual >= this.productoActual.precios.primerPrecio.hasta && this.cantidadActual < this.productoActual.precios.segundoPrecio.hasta){\n this.precioActual = this.productoActual.precios.segundoPrecio.precio;\n //Asignamos un nuevo precio tachado\n this.precioPorUnidadTachado = this.productoActual.precios.primerPrecio.precio;\n }\n //Si es igual o mayor al tope del segundo precio\n else if(this.cantidadActual >= this.productoActual.precios.segundoPrecio.hasta){\n this.precioActual = this.productoActual.precios.tercerPrecio.precio;\n //Asignamos un nuevo precio tachado\n this.precioPorUnidadTachado = this.productoActual.precios.primerPrecio.precio;\n }\n }\n }", "function resetear(){\n resultado.innerHTML = \"0\";\n operandoa = 0;\n operandob = 0;\n operacion = \"\";\n control_punto = 0;\n }", "actualizar(){ \n\n this.sellIn--;\n if(this.sellIn < 0){\n this.quality -= 4 \n } else {\n this.quality-=2\n }\n if(this.quality > 50){\n this.quality = 50\n }\n }", "reiniciarConteo() {\n this.ultimo = 0;\n this.tickets = [];\n this.grabarArchivo();\n this.ultimos4 = []\n console.log('Se ha inicializado el sistema');\n \n }", "function actualizarCantidad() {\n\n var total = 0;\n var cantidadFumigacion = 0;\n var contador = 0;\n\n // Se recorren todos los despegues\n while (contador < elDiaDeHoy.despeguesDeAvionetas.length) {\n\n // Se toma la avioneta y se evalua si es de fumigacion\n if (elDiaDeHoy.despeguesDeAvionetas[contador].Avioneta.esDeFumigacion) {\n\n // si la avioneta es de fumigacion se incrementa el contador de fumigacion en uno;\n cantidadFumigacion++;\n }\n\n // se incrementa el total en uno.\n total++;\n\n // se avanza en uno el contador\n contador++;\n }\n\n // Se actualizan los totales del dia. \n elDiaDeHoy.cantidadTotal = total;\n elDiaDeHoy.cantidadDeFumigacion = cantidadFumigacion;\n}", "function agregarCeros(tiempo){\n if(tiempo < 10){\n tiempo = \"0\"+tiempo\n }\n return tiempo\n}", "function DescuentoJudicial(){ \n //obtiene el valor anterior de sal_jud\n var sal_jud=document.getElementById(\"sal_jud\").value\n //valor del input de sueldo neto\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n //si anteriormente ya tenia un valor restaura ante cambios del operador\n if(sal_jud > 0)\n {\n var suma=parseFloat(SaldoNeto) + parseFloat(sal_jud);\n document.getElementById(\"sueldoNeto\").value=suma;\n }\n //valor del input del descuento judicial\n var monto= document.getElementById('inputJudicial').value;\n //el nuevo valor de Saldo Neto\n var SaldoNeto= document.getElementById(\"sueldoNeto\").value;\n document.getElementById(\"sueldoNeto\").value=(SaldoNeto-monto);\n document.getElementById(\"sal_jud\").value=monto;\n //guardamos el valor de salario neto(esto se actualizara con cada descuento)\n var sueldoneto=document.getElementById('sueldoNeto').value;\n document.getElementById(\"sal_neto\").value=sueldoneto;\n \n }", "function ocultar_estilos() {\n document.querySelector(\"#val_tamaño\").classList.remove('valor_tam_off');\n document.querySelector(\"#val_tamaño\").classList.add('valor_tam');\n \n document.querySelector(\"#btn_empezar\").classList.remove('btn_off');\n document.querySelector(\"#btn_empezar\").classList.add('btn_on');\n \n document.querySelector(\"#canvas\").classList.remove('canvas_on');\n document.querySelector(\"#canvas\").classList.add('canvas_off');\n \n document.querySelector(\"#btn_reiniciar\").classList.remove('btn_on');\n document.querySelector(\"#btn_reiniciar\").classList.add('btn_off'); \n\n document.querySelector(\"#img_logo\").classList.remove('btn_off');\n document.querySelector(\"#img_logo\").classList.add('btn_on');\n \n document.querySelector(\"#titulo_jugador_uno\").classList.remove('btn_off');\n document.querySelector(\"#titulo_jugador_uno\").classList.add('btn_on'); \n\n document.querySelector(\"#titulo_jugador_dos\").classList.remove('btn_off');\n document.querySelector(\"#titulo_jugador_dos\").classList.add('btn_on'); \n\n document.querySelector(\"#nombre_jugador_dos\").classList.remove('btn_off');\n document.querySelector(\"#nombre_jugador_dos\").classList.add('btn_on'); \n\n document.querySelector(\"#nombre_jugador_uno\").classList.remove('btn_off');\n document.querySelector(\"#nombre_jugador_uno\").classList.add('btn_on'); \n \n document.querySelector(\"#j2\").classList.remove('btn_on');\n document.querySelector(\"#j2\").classList.add('btn_off'); \n\n document.querySelector(\"#j1\").classList.remove('btn_on');\n document.querySelector(\"#j1\").classList.add('btn_off'); \n\n\n }", "function conToDeciPreInf(){\n player.money = new Decimal(player.money)\n player.tickSpeedCost = new Decimal(player.tickSpeedCost)\n player.tickspeed = new Decimal(player.tickspeed)\n player.firstAmount = new Decimal(player.firstAmount)\n player.secondAmount = new Decimal(player.secondAmount)\n player.thirdAmount = new Decimal(player.thirdAmount)\n player.fourthAmount = new Decimal(player.fourthAmount)\n player.fifthAmount = new Decimal(player.fifthAmount)\n player.sixthAmount = new Decimal(player.sixthAmount)\n player.seventhAmount = new Decimal(player.seventhAmount)\n player.eightAmount = new Decimal(player.eightAmount)\n player.firstCost = new Decimal(player.firstCost)\n player.secondCost = new Decimal(player.secondCost)\n player.thirdCost = new Decimal(player.thirdCost)\n player.fourthCost = new Decimal(player.fourthCost)\n player.fifthCost = new Decimal(player.fifthCost)\n player.sixthCost = new Decimal(player.sixthCost)\n player.seventhCost = new Decimal(player.seventhCost)\n player.eightCost = new Decimal(player.eightCost)\n player.sacrificed = new Decimal(player.sacrificed)\n player.totalmoney = new Decimal(player.totalmoney)\n}", "function fasesTorneo() {\n vm.paso = 3;\n obtenerFases();\n obtenerTiposDeFase();\n obtenerPenalizaciones();\n }", "function TipoDescuento1(){\n //recuperamos el valor descuento 1 anterior\n var descuento1=document.getElementById(\"tipo_des1\").value;\n \n //recuperamos el sueldo neto del input\n var SueldoNeto=document.getElementById('sueldoNeto').value;\n //si anteriormente ya tenia un valor, debe reestablecer\n if(descuento1 > 0)\n {\n var suma=parseFloat(SueldoNeto) + parseFloat(descuento1);\n document.getElementById(\"sueldoNeto\").value=suma;\n }\n\n //el valor que se ingreso en monto\n var monto= document.getElementById('tipoDescuento1').value;\n document.getElementById(\"tipo_des1\").value=monto;\n //Actualiza el neto a cobrar\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n document.getElementById(\"sueldoNeto\").value=SaldoNeto-monto;\n \n //codigo de descuento la cual guardaremos\n var posicion=document.getElementById('tipodescuento1').options.selectedIndex;\n var codigoDescuento1=document.getElementById('tipodescuento1').options[posicion].value;\n document.getElementById(\"cod_des1\").value=codigoDescuento1;\n \n //guardamos el valor de salario neto(esto se actualizara con cada descuento)\n var sueldoneto=document.getElementById('sueldoNeto').value;\n document.getElementById(\"sal_neto\").value=sueldoneto;\n }", "function utilizacionDeInstalacion(po, numServ, cadena){\n let cuerpo = po\n for(let i = 0; i < cadena.length; i++){\n let base = ((numServ - (i+1))/numServ) * cadena[i]\n cuerpo += base\n }\n return 1 - cuerpo\n}", "function escrever(){\n //.value para saber o valor de um input\n var minhaIdade = ano.value - anoNascimento\n resposta.textContent = minhaIdade\n}", "function noNegative() {\n if ($scope.correctionResultOneDP < 0) {\n $scope.correctionResultOneDP = 0;\n $scope.correctionResult = 0;\n }\n if ($scope.ratioResultOneDP < 0) {\n $scope.ratioResultOneDP = 0;\n $scope.ratioResult = 0;\n }\n }", "zero(){\n this.x = 0;\n this.y = 0;\n this.z = 0;\n }", "function iniciar(){\n for(let i = 1; i <= 31; i ++){\n let dezena = diaSorteService.montaDezena(i);\n vm.dezenas.push(dezena);\n }\n vm.selecaoAtual = -1;\n }", "function fin() {\n //ponemos el contados y el tiempo final a 0\n contador = 0;\n tiempoFinal = 0;\n console.log('fin');\n\n //desbloqueamos el boton de finalizar para que puedan guardar el movimiento\n document.getElementById('siguiente').innerHTML = '<b>FINALIZAR</b>';\n document.getElementById('siguiente').disabled = false;\n document.getElementById('siguiente').style.backgroundColor = 'rgb(3, 119, 25)';\n}", "function aplicarDescuento(){\n if (numeroDeClases >= 12) {\n console.log(\"El total a abonar con su descuento es de \" + (totalClase - montoDescontar));\n } else if (numeroDeClases <= 11) {\n console.log(\"Aún NO aplica el descuento, el valor total a abonar es de \" + totalClase);\n }\n }", "setZero() {\n this.x = this.y = this.z = 0\n }", "clearData(){\n this.publicoAlvoSim= 0,\n this.publicoAlvoNao= 0,\n this.publicoAlvoALVA= 0,\n this.XER= 0,\n this.COP= 0,\n this.listaPrefixos= [],\n this.operacaoNaoVinculada= 0,\n this.operacaoVinculada= 0,\n this.operacaoVinculadaEmOutroNPJ= 0,\n this.acordoRegPortalSim= 0,\n this.acordoRegPortalNao= 0,\n //this.acordoRegPortalDuplicados= 0,\n this.totaisEstoque = 0,\n this.totaisFluxo = 0,\n this.estoqueNumber= 0,\n this.fluxoNumber= 0,\n this.duplicadoSimNao = 0,\n this.analisadoSimNao = 0\n }", "function leerTecla(){\n\tswitch (valorTecla) {\n\t\tcase 38: // up\n\t\tcase 37: // left\n\t\tcase 40: // down\n\t\tcase 39: // right\n\t\t\tmoverCamara(valorTecla);\n\t\t\tbreak;\n\n\t\tcase 32: // space\n\t\t\tbreak;\n\n\t\tcase 65: // a\n\t\t\tbreak;\n\n\t\tcase 83: // s\n\t\t\tbreak;\n\t}\n\tvalorTecla=0;\n}", "recibirDisparo(potencia) {\n this.escudo = this.escudo - potencia;\n return this.escudo;\n }", "static set zero(value) {}", "function _AtualizaGeral() {\n _AtualizaNomeRacaAlinhamentoXp();\n _AtualizaDadosVida();\n _AtualizaPontosVida();\n _AtualizaAtributos();\n _AtualizaClasses();\n _AtualizaDominios();\n _AtualizaFamiliar();\n _AtualizaCompanheiroAnimal();\n _AtualizaTamanho();\n _AtualizaModificadoresAtributos();\n _AtualizaIniciativa();\n _AtualizaAtaque();\n _AtualizaEstilosLuta();\n _AtualizaSalvacoes();\n _AtualizaHabilidadesEspeciais();\n _AtualizaImunidades();\n _AtualizaResistenciaMagia();\n _AtualizaTalentos();\n _AtualizaProficienciaArmas();\n _AtualizaPericias();\n _AtualizaListaArmas();\n _AtualizaListaArmaduras();\n _AtualizaListaEscudos();\n _AtualizaEquipamentos();\n _AtualizaFeiticos();\n _AtualizaNotas();\n _AtualizaModoVisao();\n}", "function FimJogo(){\n\t\tswitch(_vitoria){\n\t\t\tcase 1:AnunciarVitoria(1);p1.Vencer();break;\n\t\t\tcase 2:AnunciarVitoria(2);p2.Vencer();break;\n\t\t\tcase 4:AnunciarVitoria(3);p3.Vencer();break;\n\t\t\tcase 8:AnunciarVitoria(4);p4.Vencer();break;\n\t\t\tcase 0:AnunciarVitoria(0);AnimacaoEmpate();break;\n\t\t\tdefault:if(_minutos==0 && _segundos==0){AnunciarVitoria(0);AnimacaoEmpate();}break;\n\t\t}\n\t}", "function zeraPontos(i) {\n // var jogador = jogadores[i];\n for (var x = 0; x < jogadores.length; x++) {\n jogadores[x].vitorias = 0;\n jogadores[x].empates = 0;\n jogadores[x].derrotas = 0;\n jogadores[x].pontos = 0;\n jogadores[x].status = \"\";\n maiorPontuacao = 0;\n }\n /*\n jogador.vitorias = 0;\n jogador.empates = 0;\n jogador.derrotas = 0;\n jogador.pontos = 0;\n jogador.status = \"\";\n maiorPontuacao = 0;\n */\n exibeJogadoresNaTela(jogadores);\n}", "function activacion(valor) {\n return valor >= 0 ? 1 : 0;//Devuelvo 1 o 0 dependiendo si la condicion se cumple\n }", "function _AtualizaAtaque() {\n ImprimeSinalizado(gPersonagem.bba, DomsPorClasse('bba'));\n ImprimeNaoSinalizado(gPersonagem.numero_ataques,\n DomsPorClasse('numero-ataques'));\n // Corpo a corpo.\n var span_bba_cac = Dom('bba-corpo-a-corpo');\n ImprimeSinalizado(gPersonagem.bba_cac, span_bba_cac);\n var titulo_span_bba_cac = {};\n titulo_span_bba_cac[Traduz('bba')] = gPersonagem.bba;\n titulo_span_bba_cac[Traduz('força')] = gPersonagem.atributos['forca'].modificador;\n titulo_span_bba_cac[Traduz('tamanho')] = gPersonagem.tamanho.modificador_ataque_defesa;\n TituloChaves(titulo_span_bba_cac, span_bba_cac);\n\n // Distancia.\n var span_bba_distancia = Dom('bba-distancia');\n ImprimeSinalizado(gPersonagem.bba_distancia, span_bba_distancia);\n var titulo_span_bba_distancia = {};\n titulo_span_bba_distancia[Traduz('bba')] = gPersonagem.bba;\n titulo_span_bba_distancia[Traduz('destreza')] = gPersonagem.atributos['destreza'].modificador;\n titulo_span_bba_distancia[Traduz('tamanho')] = gPersonagem.tamanho.modificador_ataque_defesa;\n TituloChaves(titulo_span_bba_distancia, span_bba_distancia);\n\n // Agarrar\n var span_bba_agarrar = Dom('bba-agarrar');\n ImprimeSinalizado(gPersonagem.agarrar, span_bba_agarrar);\n var titulo_span_bba_agarrar = {};\n titulo_span_bba_agarrar[Traduz('bba')] = gPersonagem.bba;\n titulo_span_bba_agarrar[Traduz('força')] = gPersonagem.atributos['forca'].modificador;\n titulo_span_bba_agarrar[Traduz('tamanho especial')] = gPersonagem.tamanho.modificador_agarrar;\n TituloChaves(titulo_span_bba_agarrar, span_bba_agarrar);\n}", "function calcular(){ \n\n\n \n let total = soma(rend) - soma(des)\n \n if( Number(rend) == 0 || Number(des) == 0 ) {\n erro.style.display = 'block'\n } else if(total >0) {\n res.style.display='block'\n form.style.display = 'none'\n botaodecalcular.style.display = 'none'\n document.body.style.background= '#0000FF'\n retorno.style.display = 'block'\n res.innerHTML+= `SALDO POSITVO`\n res.innerHTML+= ` <p> O final e de: R$${total.toFixed(2)}</p>`\n \n } else {\n res.style.display='block'\n form.style.display = 'none'\n botaodecalcular.style.display = 'none'\n document.body.style.background= '#FF0000'\n retorno.style.display = 'block'\n res.innerHTML+= `SALDO NEGATIVO \\u{2716}`\n res.innerHTML+= `<p> O saldo negativo e de: R$${total.toFixed(2)}</p> `\n }\n\n \n \n///Boatao para voltar ao formulario\n}", "function TipoDescuento4(){\n //recuperamos el valor descuento 4 anterior\n var descuento4=document.getElementById(\"tipo_des4\").value;\n \n //recuperamos el sueldo neto del input\n var SueldoNeto=document.getElementById('sueldoNeto').value;\n //si anteriormente ya tenia un valor, debe reestablecer\n if(descuento4 > 0)\n {\n var suma=parseFloat(SueldoNeto) + parseFloat(descuento4);\n document.getElementById(\"sueldoNeto\").value=suma;\n }\n \n var monto= document.getElementById('tipoDescuento4').value;\n document.getElementById(\"tipo_des4\").value=monto;\n //Actualiza el neto a cobrar\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n document.getElementById(\"sueldoNeto\").value=SaldoNeto-monto;\n \n //codigo de descuento la cual guardaremos\n var posicion=document.getElementById('tipodescuento4').options.selectedIndex;\n var codigoDescuento4=document.getElementById('tipodescuento4').options[posicion].value;\n document.getElementById(\"cod_des4\").value=codigoDescuento4;\n //guardamos el valor de salario neto(esto se actualizara con cada descuento)\n var sueldoneto=document.getElementById('sueldoNeto').value;\n document.getElementById(\"sal_neto\").value=sueldoneto;\n }", "siguienteNivel() {\n this.subNivel = 0;\n this.iluminarSecuencia();\n this.agregarEventosClick();\n }", "function actualizarVuelto() {\n obtenerDatosEntrada();\n vuelto = subTotal - dataOrder.order.total;\n vuelto = parseFloat(vuelto.toFixed(2));\n $('#p-pi-change').text(toFixedTrunc(vuelto, 2));\n}", "zero() {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n }", "function TipoDescuento3(){\n //recuperamos el valor descuento 3 anterior\n var descuento3=document.getElementById(\"tipo_des3\").value;\n \n //recuperamos el sueldo neto del input\n var SueldoNeto=document.getElementById('sueldoNeto').value;\n //si anteriormente ya tenia un valor, debe reestablecer\n if(descuento3 > 0)\n {\n var suma=parseFloat(SueldoNeto) + parseFloat(descuento3);\n document.getElementById(\"sueldoNeto\").value=suma;\n }\n \n var monto= document.getElementById('tipoDescuento3').value;\n document.getElementById(\"tipo_des3\").value=monto;\n //Actualiza el neto a cobrar\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n document.getElementById(\"sueldoNeto\").value=SaldoNeto-monto;\n \n //codigo de descuento la cual guardaremos\n var posicion=document.getElementById('tipodescuento3').options.selectedIndex;\n var codigoDescuento3=document.getElementById('tipodescuento3').options[posicion].value;\n document.getElementById(\"cod_des3\").value=codigoDescuento3;\n //guardamos el valor de salario neto(esto se actualizara con cada descuento)\n var sueldoneto=document.getElementById('sueldoNeto').value;\n document.getElementById(\"sal_neto\").value=sueldoneto;\n }", "function reglaAumPrecioFullCobertura(){\n if(producto.f_cobertura.sellIn -1){\n precio_FullCobertura + 1;\n }else{\n\n }\n}", "function obtenerMovimientoAdecuado(datosEsenciales){\n var estadisticos = [0,0,0,0];\n var valormax = 0;\n var movimiento;\n var sumatoria = 0;\n //Buscamos el valor valor de los pesos de los primeros 4 caminos\n for(var i = 0; i<datosEsenciales.length; i++){\n sumatoria += datosEsenciales[i][1];\n valormax = obtenerMaximo(valormax, datosEsenciales[i][1]);\n }\n\n //Obtenemos el indice o camino que contiene el valor mayor de los pesos\n for(var i = 0; i<datosEsenciales.length; i++){\n if(datosEsenciales[i][1] == valormax){\n movimiento = datosEsenciales[i][0];\n break;\n }\n }\n //Calculamos los porcentajes de exito por cada uno de los primeros 4 caminos\n for(var i = 0; i<datosEsenciales.length; i++){\n if(datosEsenciales[i][1] != undefined)\n estadisticos[datosEsenciales[i][0]] = Math.round((datosEsenciales[i][1]/sumatoria)*100);\n }\n if(movimiento == undefined)\n movimiento = (Math.floor(Math.random() * (4 - 0) + 0));\n return {movimientoAdecuado: movimiento, estadisticos: estadisticos}\n }", "posZahtMet()\n {\n this.posZah=!this.posZah;\n }", "function sakuraFall(v) {\n const s = 80 * 5;\n if (+v <= 0) return 0;\n return s / +v;\n}", "checkSigns(){\n let root = this.findRoot();\n let oneX = this.findOneX();\n //o calculo será realizado a cada dois números inseridos\n if(this.findRoot() == -1 && this.findOneX()== -1){\n this.CalC();\n\n //verificando se existe uma raiz no índice do vetor\n }else if(root > -1){\n //verificar o que vem depois da raiz\n //se for um sinal, nesse caso só pode ser um sinal de divisão\n if(isNaN(this._operation[root+1])){\n this.findOneUnderXIndex();\n this.findRootIndex();\n this.CalC();\n\n //se o que vem depois da raiz for número\n }else if(!isNaN(this._operation[root+1])){\n this.findRootIndex();\n this.findOneUnderXIndex();\n this.CalC();\n }\n \n }else if(oneX > -1){\n this.findOneUnderXIndex();\n this.CalC();\n }\n this.showConsole();\n }", "function resetZeroValues() {\n for (i = 0; i < self.flowCategories.length; i++) {\n if (self.flowCategories[i].item_amount === 0) {\n self.flowCategories[i].item_amount = null;\n }\n }\n } // end resetZeroValues", "function botonagregar(){\n if (opcion() == \"Ingreso\") {\n contenedor_Ingreso.innerHTML = \"\";\n let descripcion=document.getElementById('descripcion').value;\n let monto=document.getElementById('monto').value;\n let suma=(parseFloat(tIngreso) + parseFloat(monto));\n tIngreso= suma;\n pIngreso.innerHTML= \"+\" + tIngreso.toFixed(2)\n //Creacion de cadena par crear Array Ingreso\n let tabla=\"<tr> <th>\" + descripcion + \"</th> <th>\" + monto + \"</th> </tr>\"; \n vIngreso.push(tabla);\n console.log(vIngreso);\n\n //Bucle para escribir datos en el array Ingreso\n for (let i = 0; i < vIngreso.length; i++) {\n contenedor_Ingreso.innerHTML = vIngreso.join(\"\");\n };\n\n \n }\n \n\n\nif(opcion()==\"Egreso\"){\ncontenedor_Egreso.innerHTML=\"\";\n let descripcion= document.getElementById('descripcion').value;\n let monto= document.getElementById('monto').value;\n let suma= (parseFloat(tEgreso) + parseFloat(monto));\n tEgreso=suma;\n pEgreso.innerHTML=\"-\" + tEgreso.toFixed(2)\n \n //Calculando porcentaje\n portotal= (tEgreso *100)/tIngreso;\n porcentajetotal.innerHTML= Math.ceil(portotal) + \" % \" \n \n // Calcular porcentaje por cada egreso\n var porcentaje_Egreso= (monto * 100)/ tIngreso;\n // Creacion de cadena para array Egreso\n let tabla=\"<tr> <th>\" + descripcion + \"</th> <th>\" + monto + \"</th> <td class='text-white bg-dark'>\" + Math.ceil(porcentaje_Egreso) + \" % </td> </tr>\";\n vEgreso.push(tabla);\n \n //Bucle para escribir datos en el array de Egresos\n for(let i=0; i <vEgreso.length; i++){\n contenedor_Egreso.innerHTML= vEgreso.join(\"\");\n };\n}\n //dinero total calculados\n pTotal=document.getElementById('montoTotal');\ntotalMonto=(parseFloat(tIngreso)-parseFloat(tEgreso));\n pTotal.innerHTML= \"$\" + totalMonto.toFixed(2)\n}", "function AjPoFo() {\r\n \r\n if (perso.Por < 2) { //Test si assez d'argent\r\n alert(\"Vous n'avez pas assez d'argent\");\r\n console.log(\"Pas assez d'argent / nombre de potion = \"+ perso.Pinv[0]);\r\n } else {\r\n perso.Por -= 2; //Or du perso -2\r\n perso.Pinv[0] += 1; //Nombre de potion +1 \r\n document.getElementById('or').value = perso.Por; //affiche Or du perso dans la div caracteristique\r\n document.getElementById('nbPoFo').value = perso.Pinv[0]; //affiche le nombre de potion\r\n console.log(\"Achat d'une potion de force / nombre de potion = \"+ perso.Pinv[0]);\r\n }\r\n\r\n}", "function TipoDescuento2(){\n //recuperamos el valor descuento 2 anterior\n var descuento2=document.getElementById(\"tipo_des2\").value;\n \n //recuperamos el sueldo neto del input\n var SueldoNeto=document.getElementById('sueldoNeto').value;\n //si anteriormente ya tenia un valor, debe reestablecer\n if(descuento2 > 0)\n {\n var suma=parseFloat(SueldoNeto) + parseFloat(descuento2);\n document.getElementById(\"sueldoNeto\").value=suma;\n }\n var monto= document.getElementById('tipoDescuento2').value;\n document.getElementById(\"tipo_des2\").value=monto;\n //Actualiza el neto a cobrar\n var SaldoNeto= document.getElementById('sueldoNeto').value;\n document.getElementById(\"sueldoNeto\").value=SaldoNeto-monto;\n \n //codigo de descuento la cual guardaremos\n var posicion=document.getElementById('tipodescuento2').options.selectedIndex;\n var codigoDescuento2=document.getElementById('tipodescuento2').options[posicion].value;\n document.getElementById(\"cod_des2\").value=codigoDescuento2;\n //guardamos el valor de salario neto(esto se actualizara con cada descuento)\n var sueldoneto=document.getElementById('sueldoNeto').value;\n document.getElementById(\"sal_neto\").value=sueldoneto;\n }", "function revelarSumario(){\n\t\tsumario.removeClass('easing-invertido');\n\t\tsetTimeout(function(){\n\t\t\tsumario.addClass('visivel');\n\t\t\tsumarioAberto = true;\n\t\t}, 20)\n\t}", "function resetarVariaveis() {\r\n tabuleiro = ['', '', '', '', '', '', '', '', ''];\r\n jogadorAtual = 0;\r\n jogadorAnterior;\r\n estadosJogo.empate = false;\r\n estadosJogo.vitoria = false;\r\n}", "function totales()\n{\n var subtotal = 0;\n var total = 0.00;\n var totalcantidad = 0;\n var subcantidad = 0;\n var total_dinero = 0;\n var total_cantidad = 0;\n var sub_exento=0;\n $(\"#inventable>tbody tr\").each(function()\n {\n var compra = $(this).find(\".precio_compra\").val();\n var unidad = $(this).find(\".unidad\").val();\n var venta = $(this).find(\".precio_venta\").val();\n var cantidad = parseInt($(this).find(\".cant\").val());\n var vence = $(this).find(\".vence\").val();\n var exento = parseInt($(this).find(\".exento\").val());\n console.log(cantidad);\n if (isNaN(cantidad) == true)\n {\n cantidad = 0;\n }\n subtotal = compra * cantidad;\n\n totalcantidad += cantidad;\n if (isNaN(subtotal) == true)\n {\n subtotal = 0;\n }\n\n if(exento==1)\n {\n sub_exento=sub_exento+subtotal;\n }\n else\n {\n total += subtotal;\n }\n\n });\n if (isNaN(total) == true)\n {\n total = 0;\n }\n sumas_sin_iva=total;\n sumas_sin_iva=round(total, 2);\n\n if(isNaN(sub_exento))\n {\n sub_exento=0;\n }\n\n tipo_doc=$('#tipo_doc').val();\n\n percepcion = $('#percepcion').val();\n\n var monto_percepcion = $('#monto_percepcion').val();\n var iva = $('#porc_iva').val();\n\n total_percepcion=0;\n iva = round((total * iva), 4);\n sub_exento = round(sub_exento, 2);\n\n if (total >= monto_percepcion)\n total_percepcion = round((total * percepcion), 4);\n\n total += total_percepcion;\n if(tipo_doc=='CCF')\n {\n total += iva;\n }\n else\n {\n iva=0;\n\n }\n\n\n total+= sub_exento;\n total_dinero =parseFloat(total).toFixed(2);\n /*if(total_dinero=='0'){\n total_dinero=\"0.00\";\n }else{\n total_dinero=total_dinero =parseFloat(total).toFixed(2);;\n }*/\n total_cantidad = round(totalcantidad,2);\n $('#totcant').html(total_cantidad);\n $('#sumas_sin_iva').html(round(sumas_sin_iva,2));\n $('#subtotal').html(round((sumas_sin_iva+iva), 2));\n $('#iva').html(round(iva,2));\n $('#venta_exenta').html(sub_exento);\n $('#total_percepcion').html(round(total_percepcion, 2));\n $('#total_dinero').html(total_dinero);\n $('#totaltexto').load('compras.php?' + 'process=total_texto&total=' + total_dinero);\n}", "Trap() {\n this.m_vVelocity.Zero();\n }", "constructor()\n {\n this.unidad = 0\n this.subida1 = 0\n this.subida2 = 0\n this.subida3 = 0\n this.bajada1 = 0\n this.bajada2 = 0\n this.bajada3 = 0\n this.error = 0\n this.oContadorAjuste=new cContadorAjuste()\n }", "function reset_values() {\n account[0] = initial_deposit;\n account[1] = 0; // I will save my profit here \n}", "function IA_Actualizador() {\n IA.call(this);\n\n //\n this.actualizacion = function() {\n\n // Mientras la serpiente este viva el juego seguira.\n if(!victoria) clearInterval(jugando);\n\n Tablero.prototype.limpiar(tablero);\n muros.dibujarTodo();\n\n // Dibujo la serpiente.\n for(var i=0; i<serpiente.obtenerCant();i++) {\n if(i==0) {\n\n if(!serpiente.obtenerPos(0).giro) serpiente.obtenerPos(i).movimiento();\n\n // Verificamos la nueva posicion.\n var puntoi = serpiente.obtenerPos(0).obtenerPI();\n var pos_actual = esc.obtenerPos(puntoi.obtenerX()/esc.multiplicador, puntoi.obtenerY()/esc.multiplicador);\n\n if(victoria && pos_actual.obtenerPared()) victoria=false;\n else if(victoria && pos_actual.obtenerManzana()) {\n // Removemos la posicion actual de la manzana.\n var pos = pos_actual.obtenerObjManzana();\n pos_actual.desactivarManzana();\n pos_actual.establecerManzana(null);\n manzanas.obtenerPos(pos).posAleatoria();\n\n serpiente.extender(serpiente);\n\n // Agregamos la nueva posicion.\n var x = manzanas.obtenerPos(pos).obtenerCentro().obtenerX();\n var y = manzanas.obtenerPos(pos).obtenerCentro().obtenerY();\n esc.obtenerPos(x/esc.multiplicador, y/esc.multiplicador).activarManzana();\n esc.obtenerPos(x/esc.multiplicador, y/esc.multiplicador).establecerManzana(pos);\n }\n }\n else {\n\n var puntoi = serpiente.obtenerPos(i-1).obtenerPF().clone();\n var puntof = serpiente.obtenerPos(i).obtenerPI().clone();\n\n serpiente.obtenerPos(i).establecerPI(puntoi);\n serpiente.obtenerPos(i).establecerPF(puntof);\n }\n serpiente.obtenerPos(i).dibujar();\n }\n\n // Verficamos que la cabeza de la serpiente no coma su propio cuerpo.\n var puntoi = serpiente.obtenerPos(0).obtenerPI();\n var j=1;\n while(j<serpiente.obtenerCant() && victoria) {\n if(serpiente.obtenerPos(j).obtenerPF().equals(puntoi)) victoria=false;\n j++;\n }\n\n\n serpiente.obtenerPos(0).giro = false;\n\n // Dibujo de manzanas.\n for(var i=0; i<manzanas.obtenerCant(); i++) {\n manzanas.obtenerPos(i).dibujar();\n }\n\n }\n}", "avancer() {\n\t\tlet fermee = this.cellule.ouverture(this.direction);\n\t\tif (fermee) { //il y a un mur\n\t\t\treturn this.finMouvement();\n\t\t} else if (this.verifierBlocage()===true) { //la porte est bloquee\n return this.finMouvement();\n }\n\t\tthis.visuel.style.transitionDuration = (this.animMouvement) + \"ms\";\n\t\tthis.cellule = this.cellule.voisine(this.direction);\n\n console.log(\"Déplacement: \"+[\"↑\",\"→\",\"↓\",\"←\"][this.direction]+\" / \"+this.cellule.infoDebogage());\n\n\t\tthis.visuel.addEventListener('transitionend', this.evt.visuel.transitionend);\n\t}", "function mover_cero(t, ya_realizados, mov_ant, direccion = null) { //mov_ant = Movimientos ya realizados en ese nivel de profunddida + movimiento del que vengo\n\n var index = t.indexOf(\"0\");\n var mov_restantes = calcular_mov_restantes(index, ya_realizados, mov_ant);\n\n if (direccion === null) {\n if (mov_restantes.length === 0) {\n return 0;\n }\n if (mov_restantes.includes(6)) {\n var aux = t[index + 4];\n t[index + 4] = t[index];\n t[index] = aux;\n return 6;\n\n } else if (mov_restantes.includes(9)) {\n var aux = t[index - 1];\n t[index - 1] = t[index];\n t[index] = aux;\n return 9;\n } else if (mov_restantes.includes(12)) {\n var aux = t[index - 4];\n t[index - 4] = t[index];\n t[index] = aux;\n return 12;\n\n } else if (mov_restantes.includes(3)) {\n var aux = t[index + 1];\n t[index + 1] = t[index];\n t[index] = aux;\n return 3;\n\n }\n } else {\n switch (direccion) {\n case 12:\n var aux = t[index - 4];\n t[index - 4] = t[index];\n t[index] = aux;\n return 12;\n case 3:\n var aux = t[index + 1];\n t[index + 1] = t[index];\n t[index] = aux;\n return 3;\n case 6:\n var aux = t[index + 4];\n t[index + 4] = t[index];\n t[index] = aux;\n return 6;\n case 9:\n var aux = t[index - 1];\n t[index - 1] = t[index];\n t[index] = aux;\n return 9;\n }\n }\n\n}", "function restTiempo(){\n tiempo--;\n document.getElementById(\"tiempo\").innerHTML = \"&nbsp;&nbsp;&nbsp;&nbsp;TIEMPO: \"+tiempo+\" Seg\";\n if ( tiempo==0){\n alert(\"ACABO EL TIEMPO\")\n tiempo = 30;\n } \n}", "niveauSuivant()\r\n\t{\r\n\t\tthis._termine = false;\r\n\t\tthis._gagne = false;\r\n\t\tthis._niveau++;\r\n\t\tthis.demarrerNiveau();\r\n\t}", "computeZeros() {\n let zeroL = this.fx - Math.sqrt(this._d ** 2 - this.fy ** 2);\n let zeroR = this.fx + Math.sqrt(this._d ** 2 - this.fy ** 2);\n return ([zeroL, zeroR]);\n }", "reduce (){\n this.hunger -= 2\n this.energy -= 1\n this.hygiene -= 1\n this.fun -= 2\n }", "function Asigna() {\r\n //var a = SinDuplicadosIdTrains.length;\r\n var SinSalir = 0;\r\n var Catrasado = 0;\r\n var Crelenti = 0;\r\n var Caldia = 0;\r\n \r\n for (var i = 0; i < statusA.length; i++) {\r\n if (statusA[i] === \"0\") {\r\n SinSalir++;\r\n } else if (statusA[i] === \"5\") {\r\n Catrasado++;\r\n } else if (statusA[i] === \"4\") {\r\n Crelenti++;\r\n } else if (statusA[i] === \"3\") {\r\n Caldia++;\r\n }\r\n \r\n }\r\n\r\n document.getElementById(\"cst\").textContent = Caldia;\r\n document.getElementById(\"csr\").textContent = Crelenti;\r\n document.getElementById(\"csa\").textContent = Catrasado;\r\n}", "function IndicadorTotal () {}", "function calculaVazaoAtual(){\n var vazaoAtual = 10/(1000/this.state.graficos.rpmAtual);\n if(vazaoAtual<84){\n return alert(\"Produção em nível crítico com RPM atual!!\")\n }\n }", "function cAllClear() {\n // AC\n zeroValues();\n document.getElementById(\"total\").textContent = \"0\";\n document.getElementById(\"outputTyped\").textContent = \"0\";\n oldTotal = 0;\n}", "function saldo_asignado (currency) {\n let asignado = 0\n const destinos = document.querySelectorAll('.destinos input')\n for (var i = 0; i < destinos.length; ++i) {\n const destino = destinos[i]\n asignado += exchange({ amount: parseFloat(destino.value),\n currency: destino.dataset.currency },\n currency).amount\n }\n return asignado\n }" ]
[ "0.7072811", "0.6000572", "0.5937992", "0.58426064", "0.58335453", "0.5795253", "0.57789534", "0.577218", "0.5715374", "0.5709285", "0.5706147", "0.5677101", "0.56067055", "0.5595527", "0.5586363", "0.5584008", "0.5581596", "0.5580311", "0.557516", "0.55574065", "0.5549408", "0.5540538", "0.5524512", "0.5511576", "0.5500015", "0.5489864", "0.5487495", "0.54836375", "0.54836375", "0.547613", "0.5475632", "0.547452", "0.5464609", "0.54631287", "0.54623765", "0.54517174", "0.5451055", "0.5439634", "0.54245555", "0.5421886", "0.54090977", "0.53855515", "0.53777397", "0.53769827", "0.53695333", "0.536734", "0.5361118", "0.53577656", "0.5344282", "0.5319295", "0.5308775", "0.53072137", "0.5306555", "0.5295689", "0.52941674", "0.5292363", "0.52914625", "0.52904767", "0.5286319", "0.5280029", "0.5279891", "0.5275758", "0.52726907", "0.5271124", "0.5270711", "0.52704763", "0.5269556", "0.526408", "0.5259351", "0.5257527", "0.52521867", "0.5250226", "0.5247447", "0.5244797", "0.5242241", "0.5234138", "0.5232695", "0.5230408", "0.5229536", "0.52274245", "0.5224476", "0.5220915", "0.52176327", "0.5215895", "0.52095985", "0.52013075", "0.51770365", "0.5167523", "0.51640856", "0.51627904", "0.5160937", "0.51571745", "0.5155545", "0.5148689", "0.51473504", "0.5144512", "0.51357156", "0.5128721", "0.5128214", "0.51270175" ]
0.71572745
0
atribuir 0 as variaveis que indicam qual a tranfomacao selecionada no momento
function zerarTransformacao () { botaoT = 0; botaoS = 0; botaoR = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function activacion(valor) {\n return valor >= 0 ? 1 : 0;//Devuelvo 1 o 0 dependiendo si la condicion se cumple\n }", "function activar(quien, //requerido\nmomento, //opcional\nobjeto = 'omarxxx' //dato por defecto\n) {\n momento ? console.log(\"quien\" + quien, \"objeto\" + objeto, \"momento\" + momento) : console.log(\"quien\" + quien, \"objeto\" + objeto);\n}", "function valorTriangulo(){\n if(trianguloAparienciaInteraccion == true && trianguloAparienciaTono == true && trianguloAparienciaMirada == true && trianguloAparienciaLlanto == true){\n trianguloApariencia = true;\n }else{\n trianguloApariencia = false;\n }\n}", "function siamoNellaPrimaSettimana() {\n return indiceSettimana == 0;\n }", "function PontosComeco(){\r\n\r\n if(pontuacao == 0){\r\n\r\n pontuacao = 0\r\n Pontos.innerText = pontuacao\r\n }\r\n}", "function activar2(quien, objeto, momento) {\r\n if (objeto === void 0) { objeto = 'batisenal '; }\r\n if (momento) {\r\n var mensaje = quien + \" activo la \" + objeto + \" en la \" + momento;\r\n }\r\n else {\r\n var mensaje = quien + \" activo la \" + objeto + \" \";\r\n }\r\n console.log('El mensaje es: ', mensaje);\r\n}", "function mesAnt() {\r\n if (mesActu === 0) {\r\n //si el mes actual es enero, se decrementa en 1 el año y se coloca como mes actual diciembre\r\n anioActu--;\r\n mesActu = 11;\r\n llenarMes();\r\n } else {\r\n mesActu--;\r\n llenarMes();\r\n }\r\n}", "function microondas(alimento, adicional) {\n switch (alimento) {\n case 'pipoca':\n time = 10;\n break;\n case 'macarrao':\n time = 8;\n break;\n case 'carne':\n time = 15;\n break;\n case 'feijao':\n time = 12;\n break;\n case 'brigadeiro':\n time = 8;\n break;\n default:\n time = - adicional;\n console.log(\"Prato inexistente!\");\n break;\n }\n\n if (time > 0) {\n adicional = time + adicional;\n\n if (adicional < time) {\n return console.log(\"Tempo insuficiente!\");\n //console.log(\"Para o alimento, \" + escolha + \", o tempo é de \" + adcional + \" segundos!\");\n } else if ((adicional > (time * 2)) && (adicional <= (time * 3))) {\n console.log(\"A comida queimou!\");\n //console.log(\"Para o alimento, \" + escolha + \", o tempo é de \" + adcional + \" segundos!\");\n } else if (adicional > time * 3) {\n return console.log(\"kabumm\");\n } else {\n return console.log(\"Prato pronto, bom apetite!!!\");\n }\n }\n}", "function onObligatorioMonto() {\n\t// Si obligatorio activar la obligatoriedad de los relacionados.\n\tif (get(FORMULARIO + '.ObligatorioMonto') == 'S') {\n\t\tset(FORMULARIO + '.ObligatorioPeriodoInicioV', 'S');\t\t\n\t\tset(FORMULARIO + '.ObligatorioPeriodoFinV', 'S');\n\t}\t\t\n}", "function MascaraPeriodo(data, event){\n if(mascaraInteiro(data)==false){\n event.returnValue = false;\n } \n return formataCampo(data, '00/0000', event);\n}", "function IndicadorEstadoCivil () {}", "function no_trabajo1Verificar(value, form)\n{\n\tif(value != \"\"){\n\t\tif(value == 1)\n\t\t\thabilita_no_trabajo1(form);\n\t\telse if(value == 0)\n\t\t\tdeshabilita_no_trabajo1(form);\t\n\t}\n}", "function mostraNotas(){}", "function listadoGuiaremEstadoDeseleccionado(){\n\t\t var total=$('input[id^=\"accionAsociacionGuiarem\"][value!=\"0\"]').length;\n\t\t\tif(total!=0){\n\t\t\t\tn = document.getElementById('idTableGuiaRelacion').rows.length;\n\t\t\t\tif(n>1){\n\t\t\t\t\tfor(x=1;x<n;x++){\n\t\t\t\t\t\taAG=\"accionAsociacionGuiarem[\"+x+\"]\";\n\t\t\t\t\t\tdocument.getElementById(aAG).value=0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t}", "function onObligatorioNOrdenes() {\n\t// Si obligatorio activar la obligatoriedad de los relacionados.\n\tif (get(FORMULARIO + '.ObligatorioNOrdenes') == 'S') {\n\t\tset(FORMULARIO + '.ObligatorioPeriodoInicio', 'S');\t\t\n\t\tset(FORMULARIO + '.ObligatorioPeriodoFin', 'S');\n\t}\t\t\n}", "function attaquer() \n{\n if (presenceEnnemi === 666){\n dialogBox(\"MORT DE CHEZ MORT ARRETE MAINTENANT. TU PEUX PAS ATTAQUER T'ES MORT. MORT. MOOOOORT\");\n }else if (presenceEnnemi === 0){\n dialogBox(\"Tu n'as pas d'adversaire, va chercher la merde on en reparle après.\");\n }else if (presenceEnnemi = 1, tourJoueur(tour)=== true){\n var Min= Number(personnage.force - 10)\n var Max= Number(personnage.force + 10)\n\n function getRndInterger(min, max) {\n return Math.floor(Math.random() * (max - min + 1) ) + min;}\n\nvaleurAttaque = getRndInterger(Min, Max);\nactionPerso = 1;\nreactionEnnemi();\nesquiveReussie = 0;\nresetSpecial();\n}\n\n}", "function valueReset(){\n miContador.valueInit = 0;\n miContador.valueMax = 1000;\n miContador.valueActual = 0;\n miContador.valueMin = -1000;\n alert(miContador.valueActual);\n}", "function delayTran(d){\n\t\tif (!trans || (trans && d.year == trans.year && d.hotness == trans.hotness && d.popularity == trans.popularity)) {\n\t\t\treturn 0;\n\t\t} else {\n\t\t\treturn outTransLength/2;\n\t\t}\n\t}", "function zero(){ return 0;}", "function condiçaoVitoria(){}", "function touches0() {\n\tif (num[14]==true){\n\t\twindow.document.calculatrice.affiche.value = \n\t\twindow.document.calculatrice.affiche.value + \"0\";\n\t} else {\n\t\twindow.document.calculatrice.affiche.value = \n\t\twindow.document.calculatrice.affiche.value + \"\";\n\t}\n}", "function activaFuncionamientoReloj() {\n let tiempo = {\n hora: 0,\n minuto: 0,\n segundo: 0\n };\n\n tiempo_corriendo = null;\n\n\n tiempo_corriendo = setInterval(function () {\n // Segundos\n tiempo.segundo++;\n if (tiempo.segundo >= 60) {\n tiempo.segundo = 0;\n tiempo.minuto++;\n }\n\n // Minutos\n if (tiempo.minuto >= 60) {\n tiempo.minuto = 0;\n tiempo.hora++;\n }\n\n $horasDom.text(tiempo.hora < 10 ? '0' + tiempo.hora : tiempo.hora);\n $minutosDom.text(tiempo.minuto < 10 ? '0' + tiempo.minuto : tiempo.minuto);\n $segundosDom.text(tiempo.segundo < 10 ? '0' + tiempo.segundo : tiempo.segundo);\n }, 1000);\n corriendo = true;\n\n }", "function IndicadorAntiguedad () {}", "function _AtualizaPontosVida() {\n // O valor dos ferimentos deve ser <= 0.\n var pontos_vida_corrente =\n gPersonagem.pontos_vida.total_dados + gPersonagem.pontos_vida.bonus.Total() + gPersonagem.pontos_vida.temporarios\n - gPersonagem.pontos_vida.ferimentos - gPersonagem.pontos_vida.ferimentos_nao_letais;\n ImprimeNaoSinalizado(\n pontos_vida_corrente, Dom('pontos-vida-corrente'));\n Dom('pontos-vida-dados').value = gPersonagem.pontos_vida.total_dados ?\n gPersonagem.pontos_vida.total_dados : '';\n ImprimeSinalizado(\n gPersonagem.pontos_vida.bonus.Total(), Dom('pontos-vida-bonus'), false);\n ImprimeSinalizado(\n gPersonagem.pontos_vida.temporarios, Dom('pontos-vida-temporarios'), false);\n ImprimeSinalizado(\n -gPersonagem.pontos_vida.ferimentos, Dom('ferimentos'), false);\n ImprimeSinalizado(\n -gPersonagem.pontos_vida.ferimentos_nao_letais, Dom('ferimentos-nao-letais'), false);\n\n // Companheiro animal.\n if (gPersonagem.canimal != null) {\n Dom('pontos-vida-base-canimal').value = gPersonagem.canimal.pontos_vida.base;\n Dom('pontos-vida-temporarios-canimal').value = gPersonagem.canimal.pontos_vida.temporarios;\n var pontos_vida_canimal = gPersonagem.canimal.pontos_vida;\n ImprimeSinalizado(-pontos_vida_canimal.ferimentos, Dom('ferimentos-canimal'), false);\n ImprimeSinalizado(-pontos_vida_canimal.ferimentos_nao_letais, Dom('ferimentos-nao-letais-canimal'), false);\n var pontos_vida_corrente_canimal =\n pontos_vida_canimal.base + pontos_vida_canimal.bonus.Total() + pontos_vida_canimal.temporarios\n - pontos_vida_canimal.ferimentos - pontos_vida_canimal.ferimentos_nao_letais;\n Dom('pontos-vida-corrente-canimal').textContent = pontos_vida_corrente_canimal;\n Dom('notas-canimal').textContent = gPersonagem.canimal.notas;\n Dom('canimal-raca').value = gPersonagem.canimal.raca;\n }\n\n // Familiar.\n if (gPersonagem.familiar == null ||\n !(gPersonagem.familiar.chave in tabelas_familiares) ||\n !gPersonagem.familiar.em_uso) {\n return;\n }\n Dom('pontos-vida-base-familiar').textContent = gPersonagem.familiar.pontos_vida.base;\n Dom('pontos-vida-temporarios-familiar').value = gPersonagem.familiar.pontos_vida.temporarios;\n var pontos_vida_familiar = gPersonagem.familiar.pontos_vida;\n ImprimeSinalizado(-pontos_vida_familiar.ferimentos, Dom('ferimentos-familiar'), false);\n ImprimeSinalizado(-pontos_vida_familiar.ferimentos_nao_letais, Dom('ferimentos-nao-letais-familiar'), false);\n var pontos_vida_corrente_familiar =\n pontos_vida_familiar.base + pontos_vida_familiar.bonus.Total() + pontos_vida_familiar.temporarios\n - pontos_vida_familiar.ferimentos - pontos_vida_familiar.ferimentos_nao_letais;\n Dom('pontos-vida-corrente-familiar').textContent = pontos_vida_corrente_familiar;\n}", "function AjPoFo() {\r\n \r\n if (perso.Por < 2) { //Test si assez d'argent\r\n alert(\"Vous n'avez pas assez d'argent\");\r\n console.log(\"Pas assez d'argent / nombre de potion = \"+ perso.Pinv[0]);\r\n } else {\r\n perso.Por -= 2; //Or du perso -2\r\n perso.Pinv[0] += 1; //Nombre de potion +1 \r\n document.getElementById('or').value = perso.Por; //affiche Or du perso dans la div caracteristique\r\n document.getElementById('nbPoFo').value = perso.Pinv[0]; //affiche le nombre de potion\r\n console.log(\"Achat d'une potion de force / nombre de potion = \"+ perso.Pinv[0]);\r\n }\r\n\r\n}", "function eq_tempo(){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) ottobre 2011.\n // funzione per il calcolo del valore dell'equazione del tempo per la data odierna.\n // algoritmo di P.D. SMITH.\n \nvar njd=calcola_jd(); // giorno giuliano in questo istante a Greenwich.\n njd=jdHO(njd)+0.5; // g. g. a mezzogiorno di Greenwich.\n\nvar ar_sole=pos_sole(njd); // calcolo dell'ascensione retta del sole.\nvar anno=jd_data(njd); // anno di riferimento.\n\nvar Tempo_medio_Greenw=tsg_tmg_data(ar_sole[0],anno[2],njd); // tempo medio di Greenwich.\nvar valore_et=12-Tempo_medio_Greenw; // valore dell'equazione del tempo.\n\n valore_et=valore_et*60; // valore in minuti.\n\n valore_et=valore_et.toFixed(6);\n\n\n\nreturn valore_et\n\n}", "function continuaEscriure ()\r\n{\r\n this.borra ();\r\n this.actual=\"\";\r\n this.validate=0;\r\n}", "isZero() {\n return this.value == 0;\n }", "function inicializar(){var v=document.getElementById(\"comprobacion\"); v.innerHTML=\"\"; nota=0.0;}", "function duracionCero(hrs, min){\n \n if($(hrs).val()===\"0\" && $(min).val()===\"00\"){\n alert(\"La duracion (horas y minutos) de la audiencia no pueden ser cero\");\n $(hrs).val('');\n $(min).val('');\n }\n}", "function validacionfecFinValifecInicVali(){\n\t\t\tif ((get('calGuiasFrm.fecFinVali','T').toString()==\"\") || \n\t\t\t(get('calGuiasFrm.fecInicVali','T').toString()==\"\"))\n\t\t\t\t//en este caso no hay alguno de los valores introducidos y no se puede realizar la verificaci?n.\n\t\t\t\treturn 'OK';\n\t\t\t\n\t\t\t\tvar errorLevel = EsFechaValida(get('calGuiasFrm.fecInicVali','T') ,get('calGuiasFrm.fecFinVali','T') , \"calGuiasFrm\", \"N\");\n\t\t\t\t\n\t\t\t\n\t\t\tif ( errorLevel == 3){\n\t\t\t return GestionarMensaje(\"CalGuias.fecFinValifecInicVali.message\");\n\t\t\t}else\n\t\t\t return 'OK';\n\t\t}", "function Selecionar(Nombre){\n \n if(Inicio != 0){\n if(Estado < 10){\n if(Estados[Nombre - 1].Estado == 2){\n if(Estado % 2 != 0){\n $(\"#\"+Nombre).text('x');\n Estados[Nombre -1].Estado = 1; \n \n }else{\n $(\"#\"+Nombre).text('0');\n Estados[Nombre -1].Estado = 0;\n \n }\n Estado ++;\n ValidarGuardar();\n Tiempo(1)\n }else{\n alert('Ya Tiene Valor');\n }\n \n }else{\n alert('Juego Terminado');\n }\n }else{\n\n }\n\n}", "nuevaFrutaCantidad() {\n if (this.nuevaFrutaCantidad < 0) { this.nuevaFrutaCantidad = 0; }\n if (!Number.isInteger(this.nuevaFrutaCantidad)) { this.nuevaFrutaCantidad = 0; }\n }", "function reglaRebajaPrecios(){\n if(producto.super_avance.sellIn = 0)\n {\n precio_SuperAvance - 2;\n\n if(producto.fc_superduper.sellIn = 0){\n precio_FullSuperDuper - 2;\n\n if(producto.f_cobertura.sellIn = 0){\n precio_FullCobertura - 2;\n }\n }\n }else{\n }\n}", "function resetarVariaveis() {\r\n tabuleiro = ['', '', '', '', '', '', '', '', ''];\r\n jogadorAtual = 0;\r\n jogadorAnterior;\r\n estadosJogo.empate = false;\r\n estadosJogo.vitoria = false;\r\n}", "function controlDiferenciaFaltanteSobrante()\n{\n let totalGeneral=0;\n if($(\"#totalEfectivo\").val()==\"\"){\n $(\"#totalEfectivo\").val(0)\n }\n \n if($(\"#totalCheque\").val()==\"\"){\n $(\"#totalCheque\").val(0)\n }\n if($(\"#totalTarjeta\").val()==\"\"){\n $(\"#totalTarjeta\").val(0)\n }\n totalGeneral=totalGeneral+parseInt($(\"#totalEfectivo\").val());\n totalGeneral=totalGeneral+parseInt($(\"#totalCheque\").val());\n totalGeneral=totalGeneral+parseInt($(\"#totalTarjeta\").val());\n totalGeneral=totalGeneral+parseInt($(\"#montoAperturaCaja\").val());\n if (totalGeneral>totalCaja) {\n $(\"#totalFaltante\").val(0);\n $(\"#sobrante\").val(totalGeneral-totalCaja);\n }else if (totalGeneral<totalCaja) {\n $(\"#totalFaltante\").val(totalCaja-totalGeneral);\n $(\"#sobrante\").val(0);\n } else {\n $(\"#totalFaltante\").val(0);\n $(\"#sobrante\").val(0);\n }\n $(\"#montoCierre\").val(totalGeneral);\n console.warn(totalCaja);\n console.warn(totalGeneral);\n\n}", "function Tt(e,t,a,s){var n=e+\" \";switch(a){case\"s\":return t||s?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return n+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||s?\"sekundi\":\"sekundah\":e<5?t||s?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return n+=1===e?t?\"minuta\":\"minuto\":2===e?t||s?\"minuti\":\"minutama\":e<5?t||s?\"minute\":\"minutami\":t||s?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return n+=1===e?t?\"ura\":\"uro\":2===e?t||s?\"uri\":\"urama\":e<5?t||s?\"ure\":\"urami\":t||s?\"ur\":\"urami\";case\"d\":return t||s?\"en dan\":\"enim dnem\";case\"dd\":return n+=1===e?t||s?\"dan\":\"dnem\":2===e?t||s?\"dni\":\"dnevoma\":t||s?\"dni\":\"dnevi\";case\"M\":return t||s?\"en mesec\":\"enim mesecem\";case\"MM\":return n+=1===e?t||s?\"mesec\":\"mesecem\":2===e?t||s?\"meseca\":\"mesecema\":e<5?t||s?\"mesece\":\"meseci\":t||s?\"mesecev\":\"meseci\";case\"y\":return t||s?\"eno leto\":\"enim letom\";case\"yy\":return n+=1===e?t||s?\"leto\":\"letom\":2===e?t||s?\"leti\":\"letoma\":e<5?t||s?\"leta\":\"leti\":t||s?\"let\":\"leti\"}}", "function qidirish() {\n let dateStart=document.getElementById(\"dateStart\");\n let dateEnd=document.getElementById(\"dateEnd\");\n let fanQidiruv=document.getElementById(\"fanQidiruv\");\n if(fanQidiruv.value==0){\n oqituvchiService.getAllQidiruvSana(dateStart.value,dateEnd.value,printpost,console.log(\"xato\"));\n }\n else{\n oqituvchiService.getAllQidiruvSanaFan(dateStart.value,dateEnd.value,fanQidiruv.value,printpost,console.log(\"xato\"));\n }\n}", "function sequencia1(num) {\n return 0\n}", "function ultimo_mes(){\n if(mes_actual!=0){\n mes_actual--;\n }else if(mes_actual==0){\n mes_actual=10;\n año_actual--;\n }\n dibujar_fecha();\n escribir_mes();\n escogerdia1();\n escogerdia2();\n}", "function controllaDati() {\r\n\t\tvar err=false;\r\n\t\tvar check=true;\r\n\t\tvar elem = document.getElementById(\"nomeRicetta\");\r\n\t\tif(elem.value.length == 0) {\r\n\t\t\t\tdocument.getElementById(\"nomeRicettaErr\").innerHTML= \"Inserisci il titolo\";\r\n\t\t\t\terr=true;\r\n\t\t\t\tcheck=false;\r\n\t\t} else {\r\n\t\t\t\tdocument.getElementById(\"nomeRicettaErr\").innerHTML= \"\";\r\n\t\t}\r\n\t\telem = document.getElementById(\"nomeAutore\");\r\n\t\tif( elem.value.length==0 ) {\r\n\t\t\t\tdocument.getElementById(\"nomeAutoreErr\").innerHTML= \"Inserisci il nome dell'autore\";\r\n\t\t\t\terr=true;\r\n\t\t\t\tcheck=false;\r\n\t\t} else {\r\n\t\t\t\tdocument.getElementById(\"nomeAutoreErr\").innerHTML= \"\";\r\n\t\t}\r\n\t\telem = document.getElementById(\"areaProcedimento\");\r\n\t\tif( elem.value.length==0 ) {\r\n\t\t\t\tdocument.getElementById(\"areaProcedimentoErr\").innerHTML= \"Inserisci il procedimento\";\r\n\t\t\t\terr=true;\r\n\t\t\t\tcheck=false;\r\n\t\t} else {\r\n\t\t\t\tdocument.getElementById(\"areaProcedimentoErr\").innerHTML= \"\";\r\n\t\t}\r\n\t\telem = document.getElementById(\"ingrediente0\");\r\n\t\tif( elem.value.length==0 ) {\r\n\t\t\t\tdocument.getElementById(\"ingrediente0Err\").innerHTML= \"<p>Inserisci almeno il primo ingrediente</p>\";\r\n\t\t\t\terr=true;\r\n\t\t\t\tcheck=false;\r\n\t\t} else {\r\n\t\t\t\tdocument.getElementById(\"ingrediente0Err\").innerHTML= \"\";\r\n\t\t}\r\n\t\telem = document.getElementById(\"quantita0\");\r\n\t\tif( isNaN(elem.value) || parseInt(elem.value)<0 || parseInt(elem.value) > 9999) {\r\n\t\t\t\tdocument.getElementById(\"quantitaN0Err\").innerHTML= \"La quantità deve essere numerica\";\r\n\t\t\t\terr=true;\r\n\t\t\t\tcheck=false;\r\n\t\t} else {\r\n\t\t\t\tdocument.getElementById(\"quantitaN0Err\").innerHTML= \"\";\r\n\t\t}\r\n\t\tif (check==false) {\r\n\t\t\treturn !err;\r\n\t\t}\r\n\t\t\r\n}", "procMorreu()\n\t// retorna se jah foi usado\n\t{\n\t\tthis._personagemJahPegou = true;\n\n\t\tif (this._informacoesPocao.ativadoInstant)\n\t\t\tControladorJogo.pers.controladorPocoesPegou.adicionarPocaoUsando(this);\n\t\telse\n\t\t\tControladorJogo.pers.controladorPocoesPegou.adicionarPocao(this);\n\n\t\treturn this._informacoesPocao.ativadoInstant;\n\t}", "function t(e,t,a,i){var r=e+\" \";switch(a){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\",r;case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\",r;case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\",r;case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\",r}}", "function t(e,t,n,a){var o=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return o+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return o+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return o+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\";case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return o+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\";case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return o+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\";case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return o+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\"}}", "function positive(numero) {\n\n var positivo=(numero>0);\n\n return positivo;\n }", "function falso(){\n\tif(cont==2||cont==3||cont==5||cont==6||cont==7||cont==8||cont==10||cont==11||cont==13||cont==17||cont==19){\n\t\talert(\"ESA ES MI CHICA! CORRECTO\");\n\t\tpuntos = puntos + 1;\n\t}else{\n\t\talert(\"MALA NOVIA!!! ERROR\");\n\t}\n\tconsole.log(puntos);\n\tcambiarPagina();\n}", "function t(e,t,a,i){var s=e+\" \";switch(a){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return s+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return s+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return s+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\";case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return s+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\";case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return s+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\";case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return s+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\"}}", "function eq_tempo_data2(anno,njd){\n\n // funzione per il calcolo dell'equazione del tempo.\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) gennaio 2012.\n // algoritmo di MEEUS.\n \n njd=jdHO(njd); // riporta il g.g. all'ora H0(zero) del giorno. \n \nvar ar_sole=pos_sole(njd); // calcolo dell'ascensione retta del sole.\nvar ar_sole_app=pos_app(njd,ar_sole[0],ar_sole[1]);\nvar TSG=temposid_app(njd);\nvar valore_et=0;\nvar h=TSG-ar_sole_app[0];\n \nif(h<0 ) {valore_et=12+h;}\nif(h>0 ) {valore_et=h-12;}\n \n valore_et=valore_et*60; // valore in minuti.\n\n valore_et=valore_et.toFixed(6);\n\nreturn valore_et\n\n}", "function NotaFinal() {\r\n var pre1a = document.getElementById(\"pre1a\").value;\r\n if (pre1a == \"\") {\r\n alert(\"Pregunta 1: Califiqué la pregunta\");\r\n } else {\r\n var pre2a = document.getElementById(\"pre2a\").value;\r\n if (pre2a == \"\") {\r\n alert(\"Pregunta 2: Califiqué la pregunta\");\r\n } else {\r\n pregunta1();\r\n pregunta2();\r\n pregunta3();\r\n cor =\r\n parseFloat(tpre1) +\r\n parseFloat(tpre2) +\r\n parseFloat(tpre3);\r\n Calculo_nota();\r\n }\r\n }\r\n}", "function gps_asignarFecha() {\n var sfecha = document.getElementById(\"sfecha\").value;\n \n if (sfecha == 1 || sfecha == 2 || sfecha == 3) {\n gps_fechasHoy(); \n }\n if (sfecha == 4) {\n gps_fechasAyer();\n }\n \n gps_habilitarAutoConsulta(false);\n gps_mostrarComponente('gps-controls', true);\n\n // Habilita autoconsulta para opcion predefinida 2 (localizacion actual)\n if (sfecha == 2) {\n gps_habilitarAutoConsulta(true);\n gps_mostrarComponente('gps-controls', false);\n }\n}", "function t(e,t,n,i){var a=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return a+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return a+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return a+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\";case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return a+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\";case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return a+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\";case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return a+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\"}}", "function t(e,t,n,o){var i=e+\" \";switch(n){case\"s\":return t||o?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return i+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||o?\"sekundi\":\"sekundah\":e<5?t||o?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return i+=1===e?t?\"minuta\":\"minuto\":2===e?t||o?\"minuti\":\"minutama\":e<5?t||o?\"minute\":\"minutami\":t||o?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return i+=1===e?t?\"ura\":\"uro\":2===e?t||o?\"uri\":\"urama\":e<5?t||o?\"ure\":\"urami\":t||o?\"ur\":\"urami\";case\"d\":return t||o?\"en dan\":\"enim dnem\";case\"dd\":return i+=1===e?t||o?\"dan\":\"dnem\":2===e?t||o?\"dni\":\"dnevoma\":t||o?\"dni\":\"dnevi\";case\"M\":return t||o?\"en mesec\":\"enim mesecem\";case\"MM\":return i+=1===e?t||o?\"mesec\":\"mesecem\":2===e?t||o?\"meseca\":\"mesecema\":e<5?t||o?\"mesece\":\"meseci\":t||o?\"mesecev\":\"meseci\";case\"y\":return t||o?\"eno leto\":\"enim letom\";case\"yy\":return i+=1===e?t||o?\"leto\":\"letom\":2===e?t||o?\"leti\":\"letoma\":e<5?t||o?\"leta\":\"leti\":t||o?\"let\":\"leti\"}}", "function controlaAnho(){\r\n\tvar fiscalYear = getValueFormatless('fiscalPeriodYear');\r\n\tvar declaType = document.getElementById('declarationType').value;\r\n\tvar fecha = new Date();\r\n\tvar anhoActual = getActualYear();\r\n\t\r\n\tif(fiscalYear != 0){\r\n\t\t//Si es clausura tiene que ser menor o igual q el a?o actual\r\n\t\tif(declaType == '| 5 | CLAUSURA'){\r\n\t\t\tif(fiscalYear > anhoActual){//Mayor o igual? O solo igual se permite\r\n\t\t\t\talert('Para las ddjj de tipo CLAUSURA, el año debe ser el menor o igual al año actual.');\r\n\t\t\t\tdocument.getElementById('fiscalPeriodYear').value = \"\";\r\n\t\t\t\tdocument.getElementById('fiscalPeriodYear').focus();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}else{//Si no es clausura, el a?o tiene que ser menor al actual\r\n\t\t\tif(fiscalYear >= anhoActual){\r\n\t\t\t\talert('Para las ddjj ORIGINALES y RECTIFICATIVAS, el año debe ser menor al año actual.');\r\n\t\t\t\tdocument.getElementById('fiscalPeriodYear').value = \"\";\r\n\t\t\t\tdocument.getElementById('fiscalPeriodYear').focus();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t} \r\n\t}\r\n\t//getPorcentajeMoras(document.getElementById('fiscalPeriodYear')); \t\t \r\n}", "function agregarCeros(tiempo){\n if(tiempo < 10){\n tiempo = \"0\"+tiempo\n }\n return tiempo\n}", "setAnteriorSala(){\n switch (this.entradaAnteriorSala) {\n case posicionSala.derecha:\n this.izquierda = this.anteriorSala;\n break;\n case posicionSala.izquierda:\n this.derecha = this.anteriorSala;\n break;\n case posicionSala.abajo:\n this.arriba = this.anteriorSala;\n break;\n case posicionSala.arriba:\n this.abajo = this.anteriorSala;\n break;\n\n\n }\n }", "function define(){\n add.setAttribute('disabled', \"\");\n btn.setAttribute('disabled', \"\");\n let o = document.getElementById('select');\n if(ul.children.length == 0){ /* Comprabamos si hay ejercicios en lista, si es asi seguimos */\n alert('agrege ejercicios');\n add.removeAttribute('disabled', \"\");\n btn.setAttribute('disabled', \"\");\n return false\n } \n\n if(o.options[o.selectedIndex].value == 1){ /* Seteamos el tiempo de entrenamiento y descanso */\n pre = 10;\n time = 60;\n rest = 30; \n } else if (o.options[o.selectedIndex].value == \"\"){ \n alert('Seleccione una rutina')\n add.removeAttribute('disabled', \"\")\n return false\n } else {\n pre = 10;\n time = 30;\n rest = 10;\n }\n\n o.setAttribute('style', 'display: none')\n\n let a = 0 /* \"Contador de ejercicios\" */\n\n countdown();\n\n function countdown(){ \n if(a == ul.children.length){ /* Una vez que todos los ejercicios de la lista fueron hechos se para la ejecucion */\n alert('Entrenamiento Finalizado Felicidades');\n clearTimeout();\n o.setAttribute('style', 'display: inline');\n reset();\n add.removeAttribute('disabled', \"\")\n } else { \n timer.innerHTML = pre\n info.innerHTML = \"Preparate!\"\n if(pre == 0){\n ul.children[a].setAttribute('class', 'active')\n timer.innerHTML = time\n info.innerHTML = 'Entrena!'\n if(time == 0){\n timer.innerHTML = rest\n info.innerHTML = \"Descansa Crack\"\n if(rest == 0 && o.options[o.selectedIndex].value == 1){ \n rest +=30\n time +=60 /*Esta parte es para reiniciar los valores del cronometro en cada intervalo hasta que a == ul.children.lenght */\n a++ /* Sumamos 1 al valor en cada iteracion */\n } else if(rest == 0 && o.options[o.selectedIndex].value == 2) {\n rest +=10\n time +=30 \n a++ \n }\n else \n rest -= 1\n setTimeout(countdown, 1000)\n } else {\n time -= 1\n setTimeout(countdown, 1000)\n }\n } else {\n pre-= 1\n setTimeout(countdown, 1000)\n }\n } \n } \n}", "function t(e,t,n,i){var r=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\";case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\";case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\";case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\"}}", "function t(e,t,n,i){var r=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\";case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\";case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\";case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\"}}", "function t(e,t,n,i){var r=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\";case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\";case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\";case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\"}}", "function t(e,t,n,i){var r=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\";case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\";case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\";case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\"}}", "function FimJogo(){\n\t\tswitch(_vitoria){\n\t\t\tcase 1:AnunciarVitoria(1);p1.Vencer();break;\n\t\t\tcase 2:AnunciarVitoria(2);p2.Vencer();break;\n\t\t\tcase 4:AnunciarVitoria(3);p3.Vencer();break;\n\t\t\tcase 8:AnunciarVitoria(4);p4.Vencer();break;\n\t\t\tcase 0:AnunciarVitoria(0);AnimacaoEmpate();break;\n\t\t\tdefault:if(_minutos==0 && _segundos==0){AnunciarVitoria(0);AnimacaoEmpate();}break;\n\t\t}\n\t}", "function t(e,t,n,a){var r=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\";case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\";case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\";case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\"}}", "function t(e,t,n,a){var r=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\";case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\";case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\";case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\"}}", "function t(e,t,n,a){var r=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\";case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\";case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\";case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\"}}", "function t(e,t,n,a){var r=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\";case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\";case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\";case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\"}}", "function t(e,t,n,a){var r=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\";case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\";case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\";case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\"}}", "function t(e,t,n,a){var i=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return i+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return i+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return i+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\";case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return i+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\";case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return i+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\";case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return i+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\"}}", "function t(e,t,n,a){var i=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return i+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return i+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return i+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\";case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return i+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\";case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return i+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\";case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return i+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\"}}", "function intialisation() {\n console.log(\"Reintialisation\");\n initialiser = 1;\n fin = 0;\n tabPlaying = [0,0,0,0,0]; //Tableau à 0 quand le son est stoppé\n enCours = false; //Si les numéros sont entrain de tourner\n selectMatricule; //Matricule sélectionné\n pointsFixes = []; //Tableau comportant les coordonées des pastilles\n seuil = 1; //Seuil pour la fusion de détections trop proches\n suppresion = 0; //Variable pour compter le nombre de détections fusionées\n nbMatricule = 14; //Nombre de matricule\n numPrecedent = 10; //Retient le dernier nombre d'occurence\n //Scanne les tâches pour initialiser\n initialiserPointsFixes();\n if(debutCache) {\n debutCache = 0;\n setTimeout(function() {\n startNumber();\n cacheGomettes();\n }, 3000);\n }\n}", "function t(e,t,n,a){var s=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return s+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return s+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return s+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\";case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return s+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\";case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return s+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\";case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return s+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\"}}", "function t(e,t,n,i){var a=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return a+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\",a;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return a+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\",a;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return a+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\",a;case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return a+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\",a;case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return a+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\",a;case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return a+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\",a}}", "function t(e,t,n,i){var a=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return a+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\",a;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return a+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\",a;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return a+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\",a;case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return a+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\",a;case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return a+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\",a;case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return a+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\",a}}", "function t(e,t,n,i){var a=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return a+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\",a;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return a+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\",a;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return a+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\",a;case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return a+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\",a;case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return a+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\",a;case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return a+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\",a}}", "function t(e,t,n,i){var r=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\",r;case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\",r;case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\",r;case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\",r}}", "function t(e,t,n,i){var r=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\",r;case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\",r;case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\",r;case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\",r}}", "function t(e,t,n,i){var r=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\",r;case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\",r;case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\",r;case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\",r}}", "function t(e,t,n,i){var r=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\",r;case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\",r;case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\",r;case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\",r}}", "function t(e,t,n,i){var r=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\",r;case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\",r;case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\",r;case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\",r}}", "function t(e,t,n,i){var r=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\",r;case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\",r;case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\",r;case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\",r}}", "function t(e,t,n,i){var r=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\",r;case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\",r;case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\",r;case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\",r}}", "function t(e,t,n,i){var r=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\",r;case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\",r;case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\",r;case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\",r}}", "function t(e,t,n,i){var r=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\",r;case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\",r;case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\",r;case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\",r}}", "function t(e,t,n,a){var r=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\",r;case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\",r;case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\",r;case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\",r}}", "function t(e,t,n,a){var r=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\",r;case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\",r;case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\",r;case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\",r}}", "function t(e,t,n,a){var r=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\",r;case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\",r;case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\",r;case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\",r}}", "function t(e,t,n,a){var r=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\",r;case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\",r;case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\",r;case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\",r}}", "function t(e,t,n,a){var r=e+\" \";switch(n){case\"s\":return t||a?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||a?\"sekundi\":\"sekundah\":e<5?t||a?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||a?\"minuti\":\"minutama\":e<5?t||a?\"minute\":\"minutami\":t||a?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||a?\"uri\":\"urama\":e<5?t||a?\"ure\":\"urami\":t||a?\"ur\":\"urami\",r;case\"d\":return t||a?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||a?\"dan\":\"dnem\":2===e?t||a?\"dni\":\"dnevoma\":t||a?\"dni\":\"dnevi\",r;case\"M\":return t||a?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||a?\"mesec\":\"mesecem\":2===e?t||a?\"meseca\":\"mesecema\":e<5?t||a?\"mesece\":\"meseci\":t||a?\"mesecev\":\"meseci\",r;case\"y\":return t||a?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||a?\"leto\":\"letom\":2===e?t||a?\"leti\":\"letoma\":e<5?t||a?\"leta\":\"leti\":t||a?\"let\":\"leti\",r}}", "function UtilPoFo() {\r\n if (perso.Pinv[0] != 0) { //Test si il reste des potion\r\n if (perso.Pfor >= 100) { //Test si le maximum est atteint\r\n alert(\"Vous avez atteint la force maximale\");\r\n console.log(\"Force au max / nombre de potion = \"+ perso.Pinv[0]);\r\n } else {\r\n perso.Pinv[0] -= 1; // -1 potion\r\n perso.Pfor += 1; // +1 caracteristique\r\n document.getElementById('nbPoFo').value = perso.Pinv[0]; //affichage du nombre de potion dans l'inventaire\r\n document.getElementById('force').value = perso.Pfor; //affichage de la force dans les caractéristique\r\n console.log(\"Utilisation d'une potion de force / nombre de potion = \"+ perso.Pinv[0]);\r\n console.log(\"La force de \"+ perso.Pnom + \" monte a \"+perso.Pfor);\r\n }\r\n } else {\r\n alert(\"Vous n'avez plus de potion\");\r\n console.log(\"Pas de potion de force / nombre de potion = \"+ perso.Pinv[0]);\r\n }\r\n\r\n}", "function _AtualizaAtaque() {\n ImprimeSinalizado(gPersonagem.bba, DomsPorClasse('bba'));\n ImprimeNaoSinalizado(gPersonagem.numero_ataques,\n DomsPorClasse('numero-ataques'));\n // Corpo a corpo.\n var span_bba_cac = Dom('bba-corpo-a-corpo');\n ImprimeSinalizado(gPersonagem.bba_cac, span_bba_cac);\n var titulo_span_bba_cac = {};\n titulo_span_bba_cac[Traduz('bba')] = gPersonagem.bba;\n titulo_span_bba_cac[Traduz('força')] = gPersonagem.atributos['forca'].modificador;\n titulo_span_bba_cac[Traduz('tamanho')] = gPersonagem.tamanho.modificador_ataque_defesa;\n TituloChaves(titulo_span_bba_cac, span_bba_cac);\n\n // Distancia.\n var span_bba_distancia = Dom('bba-distancia');\n ImprimeSinalizado(gPersonagem.bba_distancia, span_bba_distancia);\n var titulo_span_bba_distancia = {};\n titulo_span_bba_distancia[Traduz('bba')] = gPersonagem.bba;\n titulo_span_bba_distancia[Traduz('destreza')] = gPersonagem.atributos['destreza'].modificador;\n titulo_span_bba_distancia[Traduz('tamanho')] = gPersonagem.tamanho.modificador_ataque_defesa;\n TituloChaves(titulo_span_bba_distancia, span_bba_distancia);\n\n // Agarrar\n var span_bba_agarrar = Dom('bba-agarrar');\n ImprimeSinalizado(gPersonagem.agarrar, span_bba_agarrar);\n var titulo_span_bba_agarrar = {};\n titulo_span_bba_agarrar[Traduz('bba')] = gPersonagem.bba;\n titulo_span_bba_agarrar[Traduz('força')] = gPersonagem.atributos['forca'].modificador;\n titulo_span_bba_agarrar[Traduz('tamanho especial')] = gPersonagem.tamanho.modificador_agarrar;\n TituloChaves(titulo_span_bba_agarrar, span_bba_agarrar);\n}", "function t(e,t,n,i){var s=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return s+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return s+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return s+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\";case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return s+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\";case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return s+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\";case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return s+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\"}}", "constructor(){\n this.hasSavedValues = false\n this.publicoAlvoSim= 0,\n this.publicoAlvoNao= 0,\n this.publicoAlvoALVA= 0,\n this.XER= 0,\n this.COP= 0,\n this.listaPrefixos= [],\n this.operacaoNaoVinculada= 0,\n this.operacaoVinculada= 0,\n this.operacaoVinculadaEmOutroNPJ= 0,\n this.acordoRegPortalSim= 0,\n this.acordoRegPortalNao= 0,\n //this.acordoRegPortalDuplicados= 0,\n this.totaisEstoque = 0,\n this.totaisFluxo = 0,\n this.estoqueNumber= 0,\n this.fluxoNumber= 0,\n this.duplicadoSimNao = 0,\n this.analisadoSimNao = 0\n }", "function actividade()\n{\n\n estado = 4;\n\n // animacao pacman e monstros\n\n if (flag_vida != 0)\n {\n for(i = 0; i < 5; i++)\n {\n descarta_objecto(i);\n }\n move_pacman();\n move_monstros();\n for(i = 0; i < 5; i++)\n {\n chama_objecto(i);\n }\n animacao_pisca();\n accao();\n\n condicao_vit_derr = setTimeout(\"actividade(); \", velocidade);\n }\n else\n {\n if (jogador_total_comida[jog_activo] > 0)\n {\n clearTimeout(condicao_vit_derr);\n setTimeout(\"morre(); \", 500);\n }\n else\n {\n vidas_jogador[jog_activo]++;\n clearTimeout(condicao_vit_derr);\n setTimeout(\"vitoria(); \", 500);\n }\n }\n}", "function estado() {\n\tmostrarDuracion(medio.currentTime,duracion_avance)\n\tif( !medio.ended ) {\t\t\n\t\tvar total = parseInt( medio.currentTime*maximo/medio.duration )\n\t\tprogreso.style.width = total + \"px\"\n\t} else {\n\t\ttotal = parseInt( medio.currentTime*maximo/medio.duration )\n\t\tprogreso.style.width = total + \"px\"\n\t\treproducir.innerHTML = \"Reproducir\"\n\t\twindow.clearInterval(bucle)\n\t}\t\n}", "constructor(){\n this.transactions = {};\n this.timestamps = {};\n this.current = -1;\n\t\tthis.max;\n\t\tthis.min;\n }", "function resetValOrden() {\n entra = false;\n sale = false;\n tray = false;\n trayLin = false;\n initIn = false;\n initMul = false;\n idLineTray = -1;\n idTray = -1;\n valTLF = false;\n valMovTF = false;\n elimEF = false;\n elimSI = false;\n elimSF = false;\n elimTR = false;\n elimTLF = false;\n elimTLI = false;\n elimTM = false;\n}", "function NotaFinal() {\r\n\r\n pregunta1();\r\n pregunta3();\r\n cor =\r\n parseFloat(tpre1) +\r\n parseFloat(tpre3);\r\n Calculo_nota();\r\n}", "function t(e,t,a,n){var r=e+\" \";switch(a){case\"s\":return t||n?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||n?\"sekundi\":\"sekundah\":e<5?t||n?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||n?\"minuti\":\"minutama\":e<5?t||n?\"minute\":\"minutami\":t||n?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||n?\"uri\":\"urama\":e<5?t||n?\"ure\":\"urami\":t||n?\"ur\":\"urami\";case\"d\":return t||n?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||n?\"dan\":\"dnem\":2===e?t||n?\"dni\":\"dnevoma\":t||n?\"dni\":\"dnevi\";case\"M\":return t||n?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||n?\"mesec\":\"mesecem\":2===e?t||n?\"meseca\":\"mesecema\":e<5?t||n?\"mesece\":\"meseci\":t||n?\"mesecev\":\"meseci\";case\"y\":return t||n?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||n?\"leto\":\"letom\":2===e?t||n?\"leti\":\"letoma\":e<5?t||n?\"leta\":\"leti\":t||n?\"let\":\"leti\"}}", "function zero (data) {\n return data === 0;\n }", "function t(e,t,a,n){var r=e+\" \";switch(a){case\"s\":return t||n?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return r+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||n?\"sekundi\":\"sekundah\":e<5?t||n?\"sekunde\":\"sekundah\":\"sekund\",r;case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return r+=1===e?t?\"minuta\":\"minuto\":2===e?t||n?\"minuti\":\"minutama\":e<5?t||n?\"minute\":\"minutami\":t||n?\"minut\":\"minutami\",r;case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return r+=1===e?t?\"ura\":\"uro\":2===e?t||n?\"uri\":\"urama\":e<5?t||n?\"ure\":\"urami\":t||n?\"ur\":\"urami\",r;case\"d\":return t||n?\"en dan\":\"enim dnem\";case\"dd\":return r+=1===e?t||n?\"dan\":\"dnem\":2===e?t||n?\"dni\":\"dnevoma\":t||n?\"dni\":\"dnevi\",r;case\"M\":return t||n?\"en mesec\":\"enim mesecem\";case\"MM\":return r+=1===e?t||n?\"mesec\":\"mesecem\":2===e?t||n?\"meseca\":\"mesecema\":e<5?t||n?\"mesece\":\"meseci\":t||n?\"mesecev\":\"meseci\",r;case\"y\":return t||n?\"eno leto\":\"enim letom\";case\"yy\":return r+=1===e?t||n?\"leto\":\"letom\":2===e?t||n?\"leti\":\"letoma\":e<5?t||n?\"leta\":\"leti\":t||n?\"let\":\"leti\",r}}", "static set zero(value) {}" ]
[ "0.6264219", "0.58171034", "0.5653906", "0.5601469", "0.5569281", "0.55285543", "0.5510643", "0.5474704", "0.54111606", "0.5409865", "0.5397516", "0.538805", "0.5379643", "0.53746134", "0.53612113", "0.5358661", "0.53470415", "0.5317938", "0.5308845", "0.5276595", "0.52680933", "0.52657646", "0.5263303", "0.52619845", "0.5251365", "0.52489763", "0.52398306", "0.52228206", "0.5215609", "0.5211132", "0.51988864", "0.5198044", "0.51849973", "0.5184227", "0.5179024", "0.51462483", "0.5137979", "0.5136022", "0.51274425", "0.51254845", "0.5112888", "0.5112337", "0.51114136", "0.5100599", "0.5099753", "0.5099288", "0.5097501", "0.509204", "0.50898516", "0.5086728", "0.5086667", "0.5085165", "0.50835156", "0.50800776", "0.50707495", "0.50690895", "0.5068735", "0.5068735", "0.5068735", "0.5068735", "0.50681394", "0.5067917", "0.5067917", "0.5067917", "0.5067917", "0.5067917", "0.50620514", "0.50620514", "0.506078", "0.5060512", "0.5058824", "0.5058824", "0.5058824", "0.5055418", "0.5055418", "0.5055418", "0.5055418", "0.5055418", "0.5055418", "0.5055418", "0.5055418", "0.5055418", "0.50531894", "0.50531894", "0.50531894", "0.50531894", "0.50531894", "0.50527966", "0.5046225", "0.5040306", "0.50390077", "0.50379634", "0.50300455", "0.5020643", "0.5018611", "0.5016925", "0.5016843", "0.5010039", "0.50052536", "0.50025874" ]
0.5627493
3
CALCULA o vetor normal dos objetos carregados caso o arquivo obj nao dispolibilizou
function calc_normal(a, b, c) { var t1 = subtract(b, a); var t2 = subtract(c, b); var normal = vec4(cross(t1, t2), 0); normalsArray.push(normal); normalsArray.push(normal); normalsArray.push(normal); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function restaVotos (obj){\n let resta = obj.votos_positivos - obj.votos_negativos;\n console.log(resta);\n}", "function loadObj(name, file)\n{\n let obj_info = ObjectPool[name].ObjectInfo;\n if (obj_info == null) return null;\n\n if (file == null)\n {\n obj_info.positions = [];\n obj_info.indices = [];\n obj_info.textureCoordinates = [];\n obj_info.textureIndices = [];\n obj_info.vertexNormals = [];\n obj_info.normalIndices = [];\n return null;\n }\n\n let strs = (file.name).split(\".\");\n if (strs[1] !== \"obj\") return null;\n\n let reader = new FileReader();\n\n reader.onload = function () {\n let res = objStrAna(this.result);\n let lines = res.split('=');\n let objInfo = {\n verPosition : [],\n texPosition : [],\n norPosition : [],\n indicesForVer : [],\n indicesForTex : [],\n indicesForNor : []\n };\n for (let id in lines){\n let line = lines[id];\n let items = line.split(' ');\n switch (items[0]){\n case 'v' :\n objInfo.verPosition.push(parseFloat(items[1]));\n objInfo.verPosition.push(parseFloat(items[2]));\n objInfo.verPosition.push(parseFloat(items[3]));\n break;\n\n case 'vt' :\n objInfo.texPosition.push(parseFloat(items[1]));\n objInfo.texPosition.push(parseFloat(items[2]));\n //objInfo.texPosition.push(parseFloat(items[3]));\n break;\n\n case 'vn' :\n objInfo.norPosition.push(parseFloat(items[1]));\n objInfo.norPosition.push(parseFloat(items[2]));\n objInfo.norPosition.push(parseFloat(items[3]));\n break;\n\n case 'f' :\n for (let i=1; i<=3; i++) {\n let iitems = items[i].split('\\/');\n objInfo.indicesForVer.push(parseInt(iitems[0]) - 1);\n if (iitems[1].length > 0)\n objInfo.indicesForTex.push(parseInt(iitems[1]) - 1);\n if (iitems[2].length > 0)\n objInfo.indicesForNor.push(parseInt(iitems[2]) - 1);\n }\n\n break;\n\n default :\n let list = [];\n for (let i=1; i<items.length; i++){\n list.push(items[i]);\n }\n if (items[0] === '') break;\n objInfo[items[0]] = list;\n break;\n\n }\n\n }\n\n let maxVer = [-1000000.0, -1000000.0, -1000000.0];\n let minVer = [1000000.0, 1000000.0, 1000000.0];\n for (let id in objInfo.verPosition){\n let item = objInfo.verPosition[id];\n if (maxVer[id%3] < item) maxVer[id%3] = item;\n if (minVer[id%3] > item) minVer[id%3] = item;\n }\n let delta = 0;\n for (let i=0; i<3; i++){\n if (maxVer[i] - minVer[i] > delta){\n delta = maxVer[i] - minVer[i];\n }\n }\n\n for (let id in objInfo.verPosition){\n let item = objInfo.verPosition[id];\n objInfo.verPosition[id] = item / delta;\n }\n\n obj_info.positions = objInfo.verPosition;\n obj_info.indices = objInfo.indicesForVer;\n obj_info.textureCoordinates = objInfo.texPosition;\n obj_info.textureIndices = objInfo.indicesForTex;\n obj_info.vertexNormals = objInfo.norPosition;\n obj_info.normalIndices = objInfo.indicesForNor;\n\n refreshItemInObjectPool(name);\n };\n\n reader.readAsText(file);\n\n return file;\n}", "parse( objdata )\r\n\t{\r\n\t\tvar lines = objdata.split('\\n');\r\n\t\tfor ( var i=0; i<lines.length; ++i ) \r\n\t\t{\r\n\t\t\tvar line = lines[i].trim();\r\n\t\t\tvar elem = line.split(/\\s+/);\r\n\t\t\tswitch ( elem[0][0] ) \r\n\t\t\t{\r\n\t\t\t\t// Vértices...\r\n\t\t\t\tcase 'v':\r\n\t\t\t\t\tswitch ( elem[0].length ) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Coordenadas de los vértices\r\n\t\t\t\t\t\tcase 1:\r\n\t\t\t\t\t\t\tthis.vpos.push( [ parseFloat(elem[1]), parseFloat(elem[2]), parseFloat(elem[3]) ] );\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\t\tswitch ( elem[0][1] ) \r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t// Coordenada de textura\r\n\t\t\t\t\t\t\t\tcase 't':\r\n\t\t\t\t\t\t\t\t\tthis.tpos.push( [ parseFloat(elem[1]), parseFloat(elem[2]) ] );\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t\t// Normal\r\n\t\t\t\t\t\t\t\tcase 'n':\r\n\t\t\t\t\t\t\t\t\tthis.norm.push( [ parseFloat(elem[1]), parseFloat(elem[2]), parseFloat(elem[3]) ] );\r\n\t\t\t\t\t\t\t\t\tbreak;\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}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t// Caras...\r\n\t\t\t\tcase 'f':\r\n\t\t\t\t\tvar f=[], tf=[], nf=[];\r\n\t\t\t\t\tfor ( var j=1; j<elem.length; ++j ) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar ids = elem[j].split('/');\r\n\t\t\t\t\t\tvar vid = parseInt(ids[0]);\r\n\r\n\t\t\t\t\t\tif ( vid < 0 ) vid = this.vpos.length + vid + 1;\r\n\t\t\t\t\t\tf.push( vid - 1 );\r\n\r\n\t\t\t\t\t\tif ( ids.length > 1 && ids[1] !== \"\" ) \r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar tid = parseInt(ids[1]);\r\n\t\t\t\t\t\t\tif ( tid < 0 ) tid = this.tpos.length + tid + 1;\r\n\t\t\t\t\t\t\ttf.push( tid - 1 );\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( ids.length > 2 && ids[2] !== \"\" ) \r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar nid = parseInt(ids[2]);\r\n\t\t\t\t\t\t\tif ( nid < 0 ) nid = this.norm.length + nid + 1;\r\n\t\t\t\t\t\t\tnf.push( nid - 1 );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.face.push(f);\r\n\t\t\t\t\tif ( tf.length ) this.tfac.push(tf);\r\n\t\t\t\t\tif ( nf.length ) this.nfac.push(nf);\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function objFunc(data) {\n\n //parse color set for list of vertex\n if (data.substr(0,7) == \"usemtl \") {\n\n //sets current color array from material list object\n currentBufferMaterial = data.slice(7);\n currentDiffuseColor = materialList[currentBufferMaterial] \n //takes the current color array and adds it to the vertex color array \n //does it for each vertex that has been added\n //this is because obj files give off vertex -> color -> faces in that order\n //this matches the position and color together \n \n \n// for (var i = 0; i < currentVertexCount; i++){\n// vertexDiffuseColor = vertexDiffuseColor.concat(currentDiffuseColor);\n// }\n// \n// currentVertexCount = 0; //resets counter \n \n \n } //parses vertexs\n else if (data.substr(0,2) == \"v \") {\n indexSpace1 = data.indexOf(\" \",2);\n indexSpace2 = data.indexOf(\" \",indexSpace1 + 1);\n\n buffer_vertexPositions.push(parseFloat(data.substring(2, indexSpace1)));\n buffer_vertexPositions.push(parseFloat(data.substring(indexSpace1 + 1, indexSpace2)));\n buffer_vertexPositions.push(parseFloat(data.substring(indexSpace2 + 1)));\n \n // currentVertexCount++;\n \n \n } //parse normals\n else if (data.substr(0,3) == \"vn \") {\n \n //vertex normals are given per vertx in face\n //this means either 3 or 4 will be given per set of vertx on a face\n //because we are using flat faces they are all the same\n \n indexSpace1 = data.indexOf(\" \",3);\n indexSpace2 = data.indexOf(\" \",indexSpace1 + 1);\n\n buffer_vertexNormals.push(parseFloat(data.substring(3, indexSpace1)));\n buffer_vertexNormals.push(parseFloat(data.substring(indexSpace1 + 1, indexSpace2)));\n buffer_vertexNormals.push(parseFloat(data.substring(indexSpace2 + 1)));\n \n \n \n\n } //parse textures\n else if (data.substr(0,3) == \"vt \") {\n \n indexSpace1 = data.indexOf(\" \",3);\n// indexSpace2 = data.indexOf(\" \",indexSpace1 + 1);\n\n buffer_vertexColors.push(parseFloat(data.substring(3, indexSpace1)));\n buffer_vertexColors.push(parseFloat(data.substring(indexSpace1 + 1)));\n \n \n \n\n }//parse indices\n else if (data.substr(0,2) == \"f \") {\n \n var triSet = data.substring(2).split(\" \");\n for (var j = 0; j < 3; j++) {\n var triSubset = triSet[j].split(\"/\"); \n vertexPositions.push(buffer_vertexPositions[ 3 * (parseInt(triSubset[0])-1) ]);\n vertexPositions.push(buffer_vertexPositions[ 3 * (parseInt(triSubset[0])-1) + 1 ]);\n vertexPositions.push(buffer_vertexPositions[ 3 * (parseInt(triSubset[0])-1) + 2 ]);\n vertexNormals.push(buffer_vertexNormals[ 3 * (parseInt(triSubset[2])-1) ]);\n vertexNormals.push(buffer_vertexNormals[ 3 * (parseInt(triSubset[2])-1) + 1 ]);\n vertexNormals.push(buffer_vertexNormals[ 3 * (parseInt(triSubset[2])-1) + 2 ]);\n vertexColors.push(buffer_vertexColors[ 2 * (parseInt(triSubset[1])-1) ]);\n vertexColors.push(buffer_vertexColors[ 2 * (parseInt(triSubset[1])-1) + 1 ]);\n \n vertexDiffuseColor.push(currentDiffuseColor[0]);\n vertexDiffuseColor.push(currentDiffuseColor[1]);\n vertexDiffuseColor.push(currentDiffuseColor[2]);\n }\n vertexIndices.push(3 * faceIndex);\n vertexIndices.push(3 * faceIndex + 1);\n vertexIndices.push(3 * faceIndex + 2);\n \n \n //for Quads we need to add extra face\n //if \n // f 1 2 3 4\n // we need 1, 2, 3 and 1, 3, 4\n \n if (triSet.length == 4 ) {\n for (var j = 0; j < 4; j++) {\n if (j == 1) continue;\n var triSubset = triSet[j].split(\"/\"); \n vertexPositions.push(buffer_vertexPositions[ 3 * (parseInt(triSubset[0])-1) ]);\n vertexPositions.push(buffer_vertexPositions[ 3 * (parseInt(triSubset[0])-1) + 1 ]);\n vertexPositions.push(buffer_vertexPositions[ 3 * (parseInt(triSubset[0])-1) + 2 ]);\n vertexNormals.push(buffer_vertexNormals[ 3 * (parseInt(triSubset[2])-1) ]);\n vertexNormals.push(buffer_vertexNormals[ 3 * (parseInt(triSubset[2])-1) + 1 ]);\n vertexNormals.push(buffer_vertexNormals[ 3 * (parseInt(triSubset[2])-1) + 2 ]);\n vertexColors.push(buffer_vertexColors[ 2 * (parseInt(triSubset[1])-1) ]);\n vertexColors.push(buffer_vertexColors[ 2 * (parseInt(triSubset[1])-1) + 1 ]);\n \n vertexDiffuseColor.push(currentDiffuseColor[0]);\n vertexDiffuseColor.push(currentDiffuseColor[1]);\n vertexDiffuseColor.push(currentDiffuseColor[2]);\n }\n vertexIndices.push(3 * faceIndex);\n vertexIndices.push(3 * faceIndex + 1);\n vertexIndices.push(3 * faceIndex + 2);\n vertexDiffuseColor.concat(currentDiffuseColor);\n }\n\n \n\n //All faces are orderd by vertex normal index order\n //as why stated in the \"vn\" section need to check for 3 or 4 vn\n\n } \n \n}", "function vetObjs(){\r\n\tvar vet = [];//vetor vazio\r\n\t\r\n\tvet.push({\"nome\":\"Marco\", \"salario\":4500});\r\n\tvet.push({\"nome\":\"Allan\", \"salario\":800});\r\n\tvet.push({\"nome\":\"Garcia\", \"salario\":15000});\r\n\tvet.push({\"nome\":\"Chiara\", \"salario\":30000});\r\n\t\r\n\tsoma=0.0;\r\n\t//[{..},{..},{..},{..}]\r\n\t//0-{..} 1-{..} 2-{..} 3-{..}\r\n\tfor(var i in vet){\r\n\t\tsoma = soma + vet[i].salario;\r\n\t}\r\n\talert(soma);\r\n\t}", "function normalize_parsed_OBJ( mesh )\n {\n /// 1 Initialize a min and max variable for x,y,z.\n /// 2 Iterate over each vertex and update the min and max.\n /// 3 Iterate again over each vertex, translating it by -(min+max)/2\n /// and scaling it by one over the maximum coordinate of (max-min).\n \n /// 1\n // Use slice(0) to create a deep copy.\n var min = mesh.vertex.positions[0].slice(0);\n var max = mesh.vertex.positions[0].slice(0);\n \n /// 2\n for( var i = 0; i < mesh.vertex.positions.length; ++i )\n {\n min = cmin( min, mesh.vertex.positions[i] );\n max = cmax( max, mesh.vertex.positions[i] );\n }\n \n /// 3\n var s = 2. / Math.max.apply( null, sub( max, min ) );\n for( var i = 0; i < mesh.vertex.positions.length; ++i )\n {\n mesh.vertex.positions[i] = scale( s, add( mesh.vertex.positions[i], scale( -.5, add( min, max ) ) ) );\n }\n }", "function calcularFObjetivo(x){\n\tx[23] = x[0];\n\treturn calcularKilometros(x);\n}", "function checkObjetivo () {\n\t\n\tif (fases[nDaFase].produtosC.length != 0) {\n\t\t//produto determinado\n\t\t/*for (var i = 0; i < fases[nDaFase].produtosC.length; i++) {\n\t\t\tfor (var j = 0; j < carArray.length; j++) {\n\t\t\t\tif(fases[nDaFase].produtosC[i].nome == carArray[j].nome && fases[nDaFase].produtosC[i].qtdP == carArray[j].qtd){\n\t\t\t\t\tfalhouObj = false;*/\n\t\t\t\t\t/*$(\"#cate4\").fadeIn();\n\n\t\t\t\t\tif (!fezUmaVez) {\n\t\t\t\t\t\tfezUmaVez = true;\n\t\t\t\t\t\tvar tempPontos = localStorage.getItem('pontos');\n\t\t\t\t\t\ttempPontos = 200+Number(tempPontos);\n\t\t\t\t\t\tlocalStorage.setItem(\"pontos\", tempPontos);\n\n\t\t\t\t\t\tchamaBoxA(200);\n\t\t\t\t\t}*/\n\n\t\t\t\t/*}else{\n\t\t\t\t\tfalhouObj = true;\n\t\t\t\t\t//$(\"#cate4\").fadeOut();\n\t\t\t\t}\n\t\t\t}\n\t\t}*/\n\t\tvar contCriterio = 0;\n\t\tfor (var i = 0; i < fases[nDaFase].produtosC.length; i++) {\n\t\t\tfor (var j = 0; j < carArray.length; j++) {\n\t\t\t\tif(fases[nDaFase].produtosC[i].nome == carArray[j].nome && fases[nDaFase].produtosC[i].qtdP == carArray[j].qtd){\n\t\t\t\t\tcontCriterio++;\n\n\t\t\t\t}else{\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t/*var tempCarNome = new Array();\n\t\tvar tempCarQtd = new Array();\n\n\t\tfor (var j = 0; j < carArray.length; j++) {\n\t\t\ttempCarNome += carArray[j].nome;\n\t\t\ttempCarQtd += carArray[j].qtd;\n\t\t}\n\n\t\tvar contCriterio = 0;\n\t\tfor (var i = 0; i < fases[nDaFase].produtosC.length; i++) {\n\t\t\t\n\t\t\tif(tempCarNome.indexOf(fases[nDaFase].produtosC[i].nome)>=0 && tempCarQtd.indexOf(fases[nDaFase].produtosC[i].qtdP)>=0){\n\t\t\t\t\n\t\t\t\tcontCriterio++;\n\t\t\t}else{\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}*/\n\n\t\tif (contCriterio == fases[nDaFase].produtosC.length) {\n\t\t\tfalhouObj = false;\n\t\t\t/*$(\"#cate4\").fadeIn();\n\n\t\t\tif (!fezUmaVez) {\n\t\t\t\tfezUmaVez = true;\n\t\t\t\tvar tempPontos = localStorage.getItem('pontos');\n\t\t\t\ttempPontos = 200+Number(tempPontos);\n\t\t\t\tlocalStorage.setItem(\"pontos\", tempPontos);\n\n\t\t\t\tchamaBoxA(200);\n\t\t\t}*/\n\n\t\t}else{\n\t\t\tfalhouObj = true;\n\t\t}\n\n\t}else{\n\t\t//por categoria\t\t\n\t\t\n\t\tfor (var i = 0; i < fases[nDaFase].qualSessao.length; i++) {\n\t\t\tfor (var j = 0; j < carArray.length; j++) {\n\n\t\t\t\tif (carArray[j].sessao.indexOf(fases[nDaFase].qualSessao[i])<0){\n\t\t\t\t\tfalhouObj = true;\n\t\t\t\t\t//$(\"#cate4\").fadeOut();\n\t\t\t\t}else{\n\t\t\t\t\tfalhouObj = false;\n\t\t\t\t\t/*$(\"#cate4\").fadeIn();\n\n\t\t\t\t\tif (!fezUmaVez) {\n\t\t\t\t\t\tfezUmaVez = true;\n\t\t\t\t\t\tvar tempPontos = localStorage.getItem('pontos');\n\t\t\t\t\t\ttempPontos = 200+Number(tempPontos);\n\t\t\t\t\t\tlocalStorage.setItem(\"pontos\", tempPontos);\n\n\t\t\t\t\t\tchamaBoxA(200);\n\t\t\t\t\t}*/\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\t\n\t\t\n\t}\n\n\tif (carArray.length <= 0) {\n\t\tfalhouObj = true;\n\t\t$(\"#cate4\").fadeOut();\n\t}\n\n\tif (falhouObj) {\n\t\t$(\"#cate4\").fadeOut();\n\t}else{\n\t\t$(\"#cate4\").fadeIn();\n\n\t\tif (!fezUmaVez) {\n\t\t\tfezUmaVez = true;\n\t\t\ttempPontos = localStorage.getItem('pontos');\n\t\t\ttempPontos = 200+Number(tempPontos);\n\t\t\t//localStorage.setItem(\"pontos\", tempPontos);\n\n\t\t\tchamaBoxA(200);\n\t\t}\n\n\t\t$(\"#BoxMsgCaixa\").fadeIn(function(){\n\t\t\tsetTimeout(function(){\n\t\t\t\t$(\"#BoxMsgCaixa\").fadeOut();\n\t\t\t},4000);\n\t\t});\n\t}\t\n\n\tconsole.log(\"Falhou o bjetivo? \"+falhouObj);\n}", "cambio(){\n\n productos.forEach(producto => {\n if(producto.nombre === this.productoSeleccionado) this.productoActual = producto;\n });\n\n //Ver si el producto actual tiene varios precios\n if(this.productoActual.variosPrecios){\n //Verificar si sobrepasa algun precio extra\n\n //Si es menor al tope del primer precio\n if(this.cantidadActual < this.productoActual.precios.primerPrecio.hasta){\n this.precioActual = this.productoActual.precios.primerPrecio.precio;\n //Seteamos el precio tachado a 0 de nuevo\n this.precioPorUnidadTachado = 0;\n }\n //Si es mayor o igual al tope del primer precio pero menor al tope del segundo\n else if(this.cantidadActual >= this.productoActual.precios.primerPrecio.hasta && this.cantidadActual < this.productoActual.precios.segundoPrecio.hasta){\n this.precioActual = this.productoActual.precios.segundoPrecio.precio;\n //Asignamos un nuevo precio tachado\n this.precioPorUnidadTachado = this.productoActual.precios.primerPrecio.precio;\n }\n //Si es igual o mayor al tope del segundo precio\n else if(this.cantidadActual >= this.productoActual.precios.segundoPrecio.hasta){\n this.precioActual = this.productoActual.precios.tercerPrecio.precio;\n //Asignamos un nuevo precio tachado\n this.precioPorUnidadTachado = this.productoActual.precios.primerPrecio.precio;\n }\n }\n }", "function montaValorMes () {\r\n\t\t\t// laco de despesas\r\n\t\t\tfor (var x in $scope.despesas) {\r\n\t\t\t\t// separo a despesa\r\n\t\t\t\tvar despesa = $scope.despesas[x];\r\n\t\t\t\t// crio um atributo pres(array) na despesa\r\n\t\t\t\tdespesa.pres = [];\r\n\r\n\t\t\t\t// laco de meses até 8\r\n\t\t\t\t// for (var m=0; m<8; m++) {\r\n\t\t\t\tfor (var m=0; m<$scope.tlmeses; m++) {\r\n\t\t\t\t\tvar day = moment().add(m, \"M\").date(); // dia atual + 1\r\n\t\t\t\t\tvar month = moment().add(m, \"M\").month(); // mes atual + 1\r\n\t\t\t\t\tvar year = moment().add(m, \"M\").year(); // ano atual + 1\r\n\t\t\t\t\tvar data = ''; // variavel data\r\n\r\n\t\t\t\t\t// laco de prestacoes da despesa\r\n\t\t\t\t\tfor (var p=0; p<despesa.prestacoes; p++) {\r\n\t\t\t\t\t\tvar dia = moment(despesa.datavencimento).add(p, \"M\").date(); // dia da data despesa + index\r\n\t\t\t\t\t\tvar mes = moment(despesa.datavencimento).add(p, \"M\").month(); // mes data despesa + index\r\n\t\t\t\t\t\tvar ano = moment(despesa.datavencimento).add(p, \"M\").year(); // ano data despesa + index\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// caso o mes e ano da despesa seja = ao mes e ano atual \r\n\t\t\t\t\t\tif (mes === month && ano === year) {\r\n\t\t\t\t\t\t\tdata = {\"data\": mes+\"/\"+ano, \"valor\":despesa.valor};\r\n\t\t\t\t\t\t\t// pegando a prestação atual\r\n\t\t\t\t\t\t\tif (m === 0) { // m = o ( mes atual )\r\n\t\t\t\t\t\t\t\tdespesa.prestacao = (p+1)+\"/\"+despesa.prestacoes;\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\r\n\t\t\t\t\tif (!despesa.prestacao) {\r\n\t\t\t\t\t\t// se ano = atual mas mes menor ou ano menor\r\n\t\t\t\t\t\tif ( (ano === year && mes < month) || (ano < year) ) {\r\n\t\t\t\t\t\t\tdespesa.prestacao = despesa.prestacoes+\"/\"+despesa.prestacoes;\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tdespesa.prestacao = \"0/\"+despesa.prestacoes;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( data === '' ) {\r\n\t\t\t\t\t\tdespesa.pres.push({\"data\": \"00/0000\", \"valor\":\"xxxx\", \"color\":\"background:#f0f5f5; color:#ccc;\", \"icon\":\"fa-trophyx\"});\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tdespesa.pres.push(data);\r\n\t\t\t\t\t\t$scope.totais[m].valor = $scope.totais[m].valor + parseInt(despesa.valor);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif($scope.totais[m-1] != undefined && $scope.totais[m].valor < $scope.totais[m-1].valor) {\r\n\t\t\t\t\t\t\t$scope.totais[m].icon = \"fa-arrow-down\";\r\n\t\t\t\t\t\t}else if($scope.totais[m-1] != undefined && $scope.totais[m].valor > $scope.totais[m-1].valor) {\r\n\t\t\t\t\t\t\t$scope.totais[m].icon = \"fa-arrow-up\";\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t$scope.totais[m].icon = \"fa-arrow-right\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$scope.totalgeral = $scope.totalgeral + parseFloat(despesa.valor);\r\n\t\t\t}\r\n\t\t}", "_proximaImgVivo() {\n\t\t//mudar index (como vetor circular)\n\t\tthis._indexImgVivo = (this._indexImgVivo + 1) % this._vetorImgsVivo.length;\n\t\t//mudar img em formaGeometrica\n\t\tthis._colocarImgVivoAtual();\n\t}", "function testObjs(vetobj){\r\n\t//sei que ha dois indices: nun e str\r\n\t//posso entao acessar via .num e .str\r\n\tvar media=0.0;\r\n\tvar conc = \"\";\r\n\t//tenho que extrair as nums e os strs\r\n\t//preciso percorrer o vetor com o for\r\n\tfor(var i in vetobj){\r\n\t\t//cada vetobj[i] eh um objeto que possui indice num e indice str\r\n\t\tmedia = media + vetobj[i].num;\r\n\t\tconc = conc + vetobj[i].str;\r\n\t}\r\n\tatert(media/vetobj.length);\r\n\talert(conc);\r\n}", "function coherencia(objeto){\n // extrae las variables nesesarias para la evaluacion\n var estructura= objeto.structure;\n var nivelagregacion=objeto.aggregationlevel;\n var tipointeractividad=objeto.interactivitytype; \n var nivelinteractivo=objeto.interactivitylevel;\n var tiporecursoeducativo=objeto.learningresourcetype;\n \n //inicializa las reglas y las variables de los pesos\n var r=0;\n var pesor1=0;\n var pesor2=0;\n var pesor3=0;\n\n //verifica las reglas que se van a evaluar\n if (estructura===\"atomic\" && nivelagregacion===\"1\"){\n r++;\n pesor1=1;\n }else if (estructura===\"atomic\" && nivelagregacion===\"2\"){\n r++;\n pesor1=0.5;\n }else if (estructura===\"atomic\" && nivelagregacion===\"3\"){\n r++;\n pesor1=0.25;\n }else if (estructura===\"atomic\" && nivelagregacion===\"4\"){\n r++;\n pesor1=0.125;\n }else if (estructura===\"collection\" && nivelagregacion===\"1\"){\n r++;\n pesor1=0.5;\n }else if (estructura===\"networked\" && nivelagregacion===\"1\"){\n r++;\n pesor1=0.5; \n }else if (estructura===\"hierarchical\" && nivelagregacion===\"1\"){\n r++;\n pesor1=0.5; \n }else if (estructura===\"linear\" && nivelagregacion===\"1\"){\n r++;\n pesor1=0.5; \n }else if (estructura===\"collection\" && (nivelagregacion===\"2\" || \n nivelagregacion===\"3\" || \n nivelagregacion===\"4\") ){\n r++;\n pesor1=1; \n }else if (estructura===\"networked\" && (nivelagregacion===\"2\" || \n nivelagregacion===\"3\" || \n nivelagregacion===\"4\") ){\n r++;\n pesor1=1; \n }else if (estructura===\"hierarchical\" && (nivelagregacion===\"2\" || \n nivelagregacion===\"3\" || \n nivelagregacion===\"4\") ){\n r++;\n pesor1=1; \n }else if (estructura===\"linear\" && (nivelagregacion===\"2\" || \n nivelagregacion===\"3\" || \n nivelagregacion ===\"4\") ){\n r++;\n pesor1=1; \n }\n\n if (tipointeractividad===\"active\" && (nivelinteractivo===\"very high\" || \n nivelinteractivo===\"high\" || \n nivelinteractivo===\"medium\" || \n nivelinteractivo===\"low\" ||\n nivelinteractivo===\"very low\") ){\n $r++;\n $pesor2=1; \n }else if (tipointeractividad===\"mixed\" && (nivelinteractivo===\"very high\" || \n nivelinteractivo===\"high\" || \n nivelinteractivo===\"medium\" || \n nivelinteractivo===\"low\" ||\n nivelinteractivo===\"very low\") ){\n r++;\n pesor2=1;\n }else if (tipointeractividad===\"expositive\" && (nivelinteractivo===\"very high\" || \n nivelinteractivo===\"high\") ){\n r++;\n pesor2=0;\n }else if (tipointeractividad===\"expositive\" && nivelinteractivo===\"medium\" ){\n r++;\n pesor2=0.5;\n }else if (tipointeractividad===\"expositive\" && ( nivelinteractivo===\"low\" ||\n nivelinteractivo===\"very low\") ){\n r++;\n pesor2=1;\n } \n if ( tipointeractividad===\"active\" && (tiporecursoeducativo===\"exercise\" || \n tiporecursoeducativo===\"simulation\" || \n tiporecursoeducativo===\"questionnaire\" || \n tiporecursoeducativo===\"exam\" ||\n tiporecursoeducativo===\"experiment\" ||\n tiporecursoeducativo===\"problem statement\" ||\n tiporecursoeducativo===\"self assessment\") ){\n r++;\n pesor3=1; \n }else if (tiporecursoeducativo===\"active\" && (tiporecursoeducativo===\"diagram\" || \n tiporecursoeducativo===\"figure\" || \n tiporecursoeducativo===\"graph\" || \n tiporecursoeducativo===\"index\" ||\n tiporecursoeducativo===\"slide\" ||\n tiporecursoeducativo===\"table\" ||\n tiporecursoeducativo===\"narrative text\" ||\n tiporecursoeducativo===\"lecture\") ){\n r++;\n pesor3=0;\n \n }else if (tipointeractividad===\"expositive\" && (tiporecursoeducativo===\"exercise\" || \n tiporecursoeducativo===\"simulation\" || \n tiporecursoeducativo===\"questionnaire\" || \n tiporecursoeducativo===\"exam\" ||\n tiporecursoeducativo===\"experiment\" ||\n tiporecursoeducativo===\"problem statement\" ||\n tiporecursoeducativo===\"self assessment\") ){\n r++;\n pesor3=0; \n }else if (tipointeractividad===\"expositive\" && (tiporecursoeducativo===\"diagram\" || \n tiporecursoeducativo===\"figure\" || \n tiporecursoeducativo===\"graph\" || \n tiporecursoeducativo===\"index\" ||\n tiporecursoeducativo===\"slide\" ||\n tiporecursoeducativo===\"table\" ||\n tiporecursoeducativo===\"narrative text\" ||\n tiporecursoeducativo===\"lecture\") ){\n r++;\n pesor3=1;\n }else if (tipointeractividad===\"mixed\" && (tiporecursoeducativo===\"exercise\" || \n tiporecursoeducativo===\"simulation\" || \n tiporecursoeducativo===\"questionnaire\" || \n tiporecursoeducativo===\"exam\" ||\n tiporecursoeducativo===\"experiment\" ||\n tiporecursoeducativo===\"problem statement\" ||\n tiporecursoeducativo===\"self assessment\" ||\n tiporecursoeducativo===\"diagram\" ||\n tiporecursoeducativo===\"figure\" ||\n tiporecursoeducativo===\"graph\" ||\n tiporecursoeducativo===\"index\" ||\n tiporecursoeducativo===\"slide\" ||\n tiporecursoeducativo===\"table\" ||\n tiporecursoeducativo===\"narrative text\" ||\n tiporecursoeducativo===\"lecture\" )){\n r++;\n pesor3=1; \n } \n m_coherencia=0;\n if (r>0) {\n\n // hace la sumatoria de los pesos \n m_coherencia= ( pesor1 + pesor2 + pesor3) / r;\n \n \n //alert(mensaje);\n return m_coherencia;\n //echo \"* Coherencia de: \". m_coherencia.\"; \". evaluacion.\"<br><br>\";\n }else{\n \n return m_coherencia;\n \n }\n\n\n }", "function getFormatDocumentum(pObjeto){\n\n\t//18 ENERO 2016\n\tvar vSrc = pObjeto.value;\n\tvSrc = vSrc.replace(/ /g, ''); //Quitar espacios en cadena\n\tvSrc = vSrc.trim();\t\n\tpObjeto.value = vSrc; \n\t\n\tvar vSeparador = '-';\n\tvar vPatron = new Array(3,3,3,4,4,5,2,2,3);\n\tvar vNumerico = true;\n\n\tif(pObjeto.valant != pObjeto.value){\n\t\tval = pObjeto.value\n\t\tlargo = val.length\n\t\tval = val.split(vSeparador)\n\t\tval2 = ''\n\n\t\tfor(r=0;r<val.length;r++){\n\t\t\tval2 += val[r]\t\n\t\t}\n\n\t\tif(vNumerico){\n\t\t\tfor(z=0;z<val2.length;z++){\n\t\t\t\tif(isNaN(val2.charAt(z))){\n\t\t\t\t\tletra = new RegExp(val2.charAt(z),\"g\")\n\t\t\t\t\tval2 = val2.replace(letra,\"\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tval = ''\n\t\tval3 = new Array()\n\n\t\tfor(s=0; s<vPatron.length; s++){\n\t\t\tval3[s] = val2.substring(0,vPatron[s])\n\t\t\tval2 = val2.substr(vPatron[s])\n\t\t}\n\n\t\tfor(q=0;q<val3.length; q++){\n\t\t\tif(q ==0){\n\t\t\t\tval = val3[q]\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(val3[q] != \"\"){\n\t\t\t\t\tval += vSeparador + val3[q]\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpObjeto.value = val\n\t\tpObjeto.valant = val\n\n\t\t}\n\n}", "function loadOBJ(objName, file, material, scale, xOff, yOff, zOff, xRot, yRot, zRot) {\r\n var onProgress = function(query) {\r\n if ( query.lengthComputable ) {\r\n var percentComplete = query.loaded / query.total * 100;\r\n console.log( Math.round(percentComplete, 2) + '% downloaded' );\r\n }\r\n };\r\n var onError = function() {\r\n console.log('Failed to load ' + file);\r\n };\r\n var loader = new THREE.OBJLoader();\r\n loader.load(file, function(object) {\r\n object.traverse(function(child) {\r\n if (child instanceof THREE.Mesh) {\r\n child.material = material;\r\n }\r\n });\r\n object.position.set(xOff,yOff,zOff);\r\n object.rotation.x= xRot;\r\n object.rotation.y = yRot;\r\n object.rotation.z = zRot;\r\n object.scale.set(scale,scale,scale);\r\n object.name = objName;\r\n scene.add(object);\r\n\r\n }, onProgress, onError);\r\n}", "function loadOBJ(objName, file, material, scale, xOff, yOff, zOff, xRot, yRot, zRot) {\r\n var onProgress = function(query) {\r\n if ( query.lengthComputable ) {\r\n var percentComplete = query.loaded / query.total * 100;\r\n console.log( Math.round(percentComplete, 2) + '% downloaded' );\r\n }\r\n };\r\n var onError = function() {\r\n console.log('Failed to load ' + file);\r\n };\r\n var loader = new THREE.OBJLoader();\r\n loader.load(file, function(object) {\r\n object.traverse(function(child) {\r\n if (child instanceof THREE.Mesh) {\r\n child.material = material;\r\n }\r\n });\r\n object.position.set(xOff,yOff,zOff);\r\n object.rotation.x= xRot;\r\n object.rotation.y = yRot;\r\n object.rotation.z = zRot;\r\n object.scale.set(scale,scale,scale);\r\n object.name = objName;\r\n scene.add(object);\r\n\r\n }, onProgress, onError);\r\n}", "auxiliarPredicado(tipo, nombre, valor, objeto) {\n //Verificamos si lo que se buscó en el predicado es un atributo o etiqueta\n if (tipo == \"atributo\") {\n //Recorremos los atributos del objecto en cuestion\n for (let att of objeto.atributos) {\n //Si los nombres de atributos son iguales\n if (att.dameNombre() == nombre) {\n //Si los valores de los atributos son iguales al valor ingresado en el predicado\n if (att.dameValor() == valor) {\n //Guardamos el elemento que contiene el atributo\n this.consolaSalidaXPATH.push(objeto);\n //Esta linea de codigo para para verificar el nuevo punto de inicio de la consola final, para no redundar\n if (!this.controladorPredicadoInicio) {\n this.contadorConsola = this.consolaSalidaXPATH.length - 1;\n this.controladorPredicadoInicio = true;\n }\n } //Cierre comparacion valor\n } //Cierre comparacion nombre\n } //Cierre for para recorrer atributos\n for (let entry of objeto.hijos) {\n for (let att of entry.atributos) {\n //Si los nombres de atributos son iguales\n if (att.dameNombre() == nombre) {\n //Si los valores de los atributos son iguales al valor ingresado en el predicado\n if (att.dameValor() == valor) {\n //Guardamos el elemento que contiene el atributo\n this.consolaSalidaXPATH.push(objeto);\n //Esta linea de codigo para para verificar el nuevo punto de inicio de la consola final, para no redundar\n if (!this.controladorPredicadoInicio) {\n this.contadorConsola = this.consolaSalidaXPATH.length - 1;\n this.controladorPredicadoInicio = true;\n }\n } //Cierre comparacion valor\n } //Cierre comparacion nombre\n } //Ci\n }\n }\n else {\n //Si lo que se busca es una etiqueta en el predicado\n for (let entry of objeto.hijos) {\n //Recorremos cada uno de los hijos y verificamos el nombre de la etiqueta\n if (entry.dameID() == nombre) {\n //Sí hay concidencia, se procede a examinar si el valor es el buscado\n if (entry.dameValor().substring(1) == valor) {\n //Agregamos el objeto a la consola de salida\n this.consolaSalidaXPATH.push(objeto);\n //Al iguar que n fragmento anteriores, se establece el nuevo punto de inicio\n if (!this.controladorPredicadoInicio) {\n this.contadorConsola = this.consolaSalidaXPATH.length - 1;\n this.controladorPredicadoInicio = true;\n } //cierreControladorInicio\n } //CIERRE VALOR\n } //CIERREID\n } //CIERRE RECORRIDO DE HIJOS\n }\n //La siguiente linea comentada es para recursividad, pendiente de uso.\n }", "function import3dObjSync(config) {\n var scale = config.scale || 1;\n var xRot = config.xRot || null;\n var yRot = config.yRot || null;\n var zRot = config.zRot || null;\n\n var vertex = [],\n faces = [],\n uvs = [];\n var re = /\\s+/;\n\n var minx, miny, minz, maxx, maxy, maxz;\n minx = miny = minz = maxx = maxy = maxz = 0;\n\n var data = getOBJFileSync(config);\n if (data == false) {\n return;\n }\n var lines = data.split(\"\\n\");\n\n for (let i = 0, imax=lines.length; i < imax; i++) {\n let line = lines[i].split(re);\n switch (line[0]) {\n case \"v\":\n var x = parseFloat(line[1]) * scale,\n y = parseFloat(line[2]) * scale,\n z = parseFloat(line[3]) * scale;\n vertex.push({\n x: x,\n y: y,\n z: z\n });\n if (x < minx) {\n minx = x\n } else {\n if (x > maxx) {\n maxx = x\n }\n }\n if (y < miny) {\n miny = y\n } else {\n if (y > maxy) {\n maxy = y\n }\n }\n if (z < minz) {\n minz = z\n } else {\n if (z > maxz) {\n maxz = z\n }\n }\n break;\n case \"vt\":\n var u = parseFloat(line[1]),\n v = parseFloat(line[2]);\n uvs.push([u, v]);\n break;\n case \"f\":\n line.splice(0, 1);\n var vertices = [],\n uvcoords = [];\n for (var j = 0, vindex, vps; j < line.length; j++) {\n vindex = line[config.reorder ? line.length - j - 1 : j];\n if (vindex.length !== 0) {\n vps = vindex.split(\"/\");\n vertices.push(parseInt(vps[0]) - 1);\n if (vps.length > 1 && vindex.indexOf(\"//\") === -1) {\n var uv = parseInt(vps[1]) - 1;\n if (uvs.length > uv) {\n uvcoords.push(uvs[uv][0], uvs[uv][1])\n }\n }\n }\n }\n faces.push(vertices);\n if (uvcoords.length !== 0) {\n poly.uvs = uvcoords\n }\n break\n }\n }\n if (config.center) {\n var cdispx = (minx + maxx) / 2,\n cdispy = (miny + maxy) / 2,\n cdispz = (minz + maxz) / 2;\n for (var i = 0; i < vertex.length; i++) {\n vertex[i].x -= cdispx;\n vertex[i].y -= cdispy;\n vertex[i].z -= cdispz\n }\n }\n if (config.scaleTo) {\n var sizex = maxx - minx,\n sizey = maxy - miny,\n sizez = maxz - minz;\n var scalefactor = 0;\n if (sizey > sizex) {\n if (sizez > sizey) {\n scalefactor = 1 / (sizez / config.scaleTo)\n } else {\n scalefactor = 1 / (sizey / config.scaleTo)\n }\n } else {\n if (sizez > sizex) {\n scalefactor = 1 / (sizez / config.scaleTo)\n } else {\n scalefactor = 1 / (sizex / config.scaleTo)\n }\n }\n for (let i = 0, imax=vertex.length; i < imax; i++) {\n vertex[i].x *= scalefactor;\n vertex[i].y *= scalefactor;\n vertex[i].z *= scalefactor\n }\n }\n rotateZ3D(zRot, vertex, true);\n rotateY3D(yRot, vertex, true);\n rotateX3D(xRot, vertex, true);\n\n return {\n points: vertex,\n polygons: faces\n }\n }", "function obj2Arr(data) {\n var temp;\n\n if (!data.hasOwnProperty('folder')) {\n \tdata.folder = [];\n }\n\n // folder\n if (data.folder.constructor == Object) {\n temp = data.folder;\n delete data.folder;\n data.folder = [temp];\n }\n\n for (h = 0; h < data.folder.length; h++) {\n // file\n if (data.folder[h].file.constructor == Object) {\n temp = data.folder[h].file;\n delete data.folder[h].file;\n data.folder[h].file = [temp];\n }\n }\n\n // tag_list\n if (data.hasOwnProperty(\"tag_list\")) {\n if (data.tag_list.i.constructor == Object) {\n temp = data.tag_list.i;\n delete data.tag_list.i;\n data.tag_list.i = [temp];\n }\n }\n\n // object info\n if (data.entity.hasOwnProperty(\"obj_info\")){\n if (data.entity.obj_info.constructor === Object) {\n temp = data.entity.obj_info;\n delete data.entity.obj_info;\n data.entity.obj_info = [temp];\n }\n }\n\n // animation\n if (data.entity.animation.constructor == Object) {\n temp = data.entity.animation;\n delete data.entity.animation;\n data.entity.animation = [temp];\n }\n\n if (data.entity.hasOwnProperty(\"var_defs\")) {\n if (data.entity.var_defs.i.constructor == Object) {\n temp = data.entity.var_defs.i;\n delete data.entity.var_defs.i;\n data.entity.var_defs.i = [temp];\n } \n }\n\n // meta\n for (var i = 0; i < data.entity.animation.length; i++){\n \n // varline\n if (data.entity.animation[i].hasOwnProperty(\"meta\")){\n if (data.entity.animation[i].meta.hasOwnProperty(\"varline\")) {\n if (data.entity.animation[i].meta.varline.constructor == Object) {\n temp = data.entity.animation[i].meta.varline;\n delete data.entity.animation[i].meta.varline;\n data.entity.animation[i].meta.varline = [temp];\n }\n for (var j = 0; j < data.entity.animation[i].meta.varline.length; j++) {\n if (data.entity.animation[i].meta.varline[j].key.constructor == Object) {\n temp = data.entity.animation[i].meta.varline[j].key;\n delete data.entity.animation[i].meta.varline[j].key;\n data.entity.animation[i].meta.varline[j].key = [temp];\n }\n }\n }\n\n // tagline\n if (data.entity.animation[i].meta.hasOwnProperty(\"tagline\")) {\n if (data.entity.animation[i].meta.tagline.key.constructor == Object) {\n temp = data.entity.animation[i].meta.tagline.key;\n delete data.entity.animation[i].meta.tagline.key;\n data.entity.animation[i].meta.tagline.key = [temp];\n }\n for (var j = 0; j < data.entity.animation[i].meta.tagline.key.length; j++) {\n if (data.entity.animation[i].meta.tagline.key[j].tag) {\n if (data.entity.animation[i].meta.tagline.key[j].tag.constructor == Object) {\n temp = data.entity.animation[i].meta.tagline.key[j].tag;\n delete data.entity.animation[i].meta.tagline.key[j].tag;\n data.entity.animation[i].meta.tagline.key[j].tag = [temp];\n }\n }\n }\n }\n }\n }\n\n for (var i = 0; i < data.entity.animation.length; i++){\n\n // mainline.key\n if (data.entity.animation[i].mainline.key.constructor == Object) {\n temp = data.entity.animation[i].mainline.key;\n delete data.entity.animation[i].mainline.key;\n data.entity.animation[i].mainline.key = [temp];\n }\n\n for (var j = 0; j < data.entity.animation[i].mainline.key.length; j++) {\n\n // mainline.key[].bone_ref\n if (data.entity.animation[i].mainline.key[j].hasOwnProperty('bone_ref')) {\n if (data.entity.animation[i].mainline.key[j].bone_ref.constructor == Object) {\n temp = data.entity.animation[i].mainline.key[j].bone_ref;\n delete data.entity.animation[i].mainline.key[j].bone_ref;\n data.entity.animation[i].mainline.key[j].bone_ref = [temp];\n }\n }\n \n\n // mainline.key[].object_ref\n if (data.entity.animation[i].mainline.key[j].hasOwnProperty('object_ref')) {\n if (data.entity.animation[i].mainline.key[j].object_ref.constructor == Object) {\n temp = data.entity.animation[i].mainline.key[j].object_ref;\n delete data.entity.animation[i].mainline.key[j].object_ref;\n data.entity.animation[i].mainline.key[j].object_ref = [temp];\n }\n }\n }\n \n // timeline\n if (!data.entity.animation[i].hasOwnProperty('timeline')) {\n \tdata.entity.animation[i].timeline = [];\n }\n\n if (data.entity.animation[i].timeline.constructor == Object) {\n temp = data.entity.animation[i].timeline;\n delete data.entity.animation[i].timeline;\n data.entity.animation[i].timeline = [temp];\n }\n\n for (var k = 0; k < data.entity.animation[i].timeline.length; k++) {\n\n // timeline[].key\n if (data.entity.animation[i].timeline[k].key.constructor == Object) {\n temp = data.entity.animation[i].timeline[k].key;\n delete data.entity.animation[i].timeline[k].key;\n data.entity.animation[i].timeline[k].key = [temp];\n }\n if (data.entity.animation[i].timeline[k].hasOwnProperty('meta')) {\n if (data.entity.animation[i].timeline[k].meta.hasOwnProperty('tagline')) {\n if (data.entity.animation[i].timeline[k].meta.tagline.key.constructor == Object) {\n temp = data.entity.animation[i].timeline[k].meta.tagline.key;\n delete data.entity.animation[i].timeline[k].meta.tagline.key;\n data.entity.animation[i].timeline[k].meta.tagline.key = [temp];\n }\n \n for (var l = 0; l < data.entity.animation[i].timeline[k].meta.tagline.key.length; l++) {\n if (!data.entity.animation[i].timeline[k].meta.tagline.key[l].tag) {\n data.entity.animation[i].timeline[k].meta.tagline.key[l].tag = [];\n }\n if (data.entity.animation[i].timeline[k].meta.tagline.key[l].tag.constructor == Object) {\n temp = data.entity.animation[i].timeline[k].meta.tagline.key[l].tag;\n delete data.entity.animation[i].timeline[k].meta.tagline.key[l].tag;\n data.entity.animation[i].timeline[k].meta.tagline.key[l].tag = [temp];\n }\n }\n }\n else if (data.entity.animation[i].timeline[k].meta.hasOwnProperty('varline')) {\n if (!data.entity.animation[i].timeline[k].meta.varline) {\n data.entity.animation[i].timeline[k].meta.varline = [];\n }\n \tif (data.entity.animation[i].timeline[k].meta.varline.constructor == Object) {\n \t\ttemp = data.entity.animation[i].timeline[k].meta.varline;\n \t\tdelete data.entity.animation[i].timeline[k].meta.varline;\n \t\tdata.entity.animation[i].timeline[k].meta.varline = [temp];\n \t}\n\n\n \tfor (var m = 0; m < data.entity.animation[i].timeline[k].meta.varline.length; m++) {\n \t\tif (data.entity.animation[i].timeline[k].meta.varline[m].key.constructor == Object) {\n \t\t\ttemp = data.entity.animation[i].timeline[k].meta.varline[m].key;\n \t\t\tdelete data.entity.animation[i].timeline[k].meta.varline[m].key\n \t\t\tdata.entity.animation[i].timeline[k].meta.varline[m].key = [temp];\n \t\t}\n \t}\n }\n }\n }\n }\n\n if (data.hasOwnProperty('obj_info')) {\n \tfor (var i = 0; i < data.entity.obj_info.length; i++) {\n\t \tif (data.entity.obj_info[i].hasOwnProperty('var_defs')) {\n\t \t\tif (data.entity.obj_info[i].var_defs.i.constructor == Object) {\n\t \t\t\ttemp = data.entity.obj_info[i].var_defs.i;\n\t \t\t\tdelete data.entity.obj_info[i].var_defs.i;\n\t \t\t\tdata.entity.obj_info[i].var_defs.i = [temp];\n\t \t\t}\n\t \t}\n\t }\n }\n \n\n // atlas\n if (data.hasOwnProperty(\"atlas\")) {\n if(data.atlas.i.constructor == Object) {\n temp = data.atlas.i;\n delete data.atlas.i;\n data.atlas.i = [temp];\n }\n }\n}", "function ocen_statycznie()\n{\n return szachownica.ocena.material + (szachownica.ocena.faza_gry * szachownica.ocena.tablice + (70 - szachownica.ocena.faza_gry) * szachownica.ocena.tablice_koncowka) * 0.03;\n}", "calculateNormals() {\r\n // MP2: Implement this function!\r\n \r\n }", "function Incentivo() {\n\n obj = this;\n\n // Public variables\n this.filtro = {\n DATA_INI_INPUT: moment().subtract(3, 'month').toDate(),\n DATA_FIM_INPUT: moment().toDate()\n };\n this.dado = {};\n\n obj.ALTERANDO = false;\n obj.SELECTED = null;\n obj.DADOS = []\n obj.DADOS.push({ID:'', DESCRICAO:'', PERCENTUAL: '',PERCENTUAL_IR:''});\n obj.ORDER_BY = 'ID';\n\n obj.consultar = function(){\n var ds = {\n FLAG : 0\n };\n\n $ajax.post('/_31070/consultar',ds,{contentType: 'application/json'})\n .then(function(response) {\n obj.DADOS = response; \n }\n );\n };\n\n obj.cancelar = function(){\n obj.ALTERANDO = false;\n }\n\n obj.modalIncluir = function(){\n obj.ALTERANDO = false;\n\n obj.NOVO = {\n ID : 0,\n DESCRICAO : '',\n PERCENTUAL : 0,\n PERCENTUAL_IR : 0\n };\n\n $('#modal-incluir').modal(); \n };\n\n obj.modalAlterar = function(){\n obj.ALTERANDO = true;\n\n obj.NOVO = {\n ID : obj.SELECTED.ID,\n DESCRICAO : obj.SELECTED.DESCRICAO,\n PERCENTUAL : Number(obj.SELECTED.PERCENTUAL),\n PERCENTUAL_IR : Number(obj.SELECTED.PERCENTUAL_IR)\n };\n\n $('#modal-incluir').modal(); \n };\n\n obj.incluir = function(){\n addConfirme('<h4>Confirmação</h4>',\n 'Deseja realmente gravar?',\n [obtn_sim,obtn_nao],\n [{ret:1,func:function(){\n var ds = {\n ITEM : obj.NOVO\n };\n\n $ajax.post('/_31070/incluir',ds,{contentType: 'application/json'})\n .then(function(response) {\n obj.consultar();\n $('#modal-incluir').modal('hide'); \n showSuccess('Gravado com sucesso!'); \n obj.ALTERANDO = false; \n }\n );\n }}] \n );\n\n \n };\n\n obj.alterar = function(){\n addConfirme('<h4>Confirmação</h4>',\n 'Deseja realmente gravar?',\n [obtn_sim,obtn_nao],\n [{ret:1,func:function(){\n var ds = {\n ITEM : obj.NOVO\n };\n\n $ajax.post('/_31070/alterar',ds,{contentType: 'application/json'})\n .then(function(response) {\n obj.consultar();\n $('#modal-incluir').modal('hide'); \n showSuccess('Alterado com sucesso!');\n obj.ALTERANDO = false; \n }\n );\n }}] \n );\n };\n\n obj.excluir = function(){\n addConfirme('<h4>Confirmação</h4>',\n 'Deseja realmente excluir o incentivo ('+obj.SELECTED.DESCRICAO+')?',\n [obtn_sim,obtn_nao],\n [{ret:1,func:function(){\n var ds = {\n ITEM : obj.SELECTED\n };\n\n $ajax.post('/_31070/excluir',ds,{contentType: 'application/json'})\n .then(function(response) {\n obj.consultar();\n showSuccess('Excluido com sucesso!'); \n obj.ALTERANDO = false; \n }\n ); \n }}] \n );\n };\n\n obj.consultar();\n }", "function calculPanier(oursObject) {\n \n let totalPanier = 0;\n//conversion du prix\n oursObject.forEach((ours) => {\n let convertitPrix = 0;\n convertitPrix = parseInt(ours.prix);\n totalPanier = totalPanier + convertitPrix;\n });\n return totalPanier;\n}", "function formulaCos() {\n objetoA = Object.values(selected).slice(1);\n\n for (let index = 0; index < newArray.length; index++) {\n objetoB = Object.values(newArray[index]).slice(1);\n\n var numerador = 0;\n var denominadorA = 0;\n var denominadorB = 0;\n\n for (let index = 1; index < objetoA.length; index++) {\n numerador += (parseInt(objetoA[index]) * parseInt(objetoB[index]));\n denominadorA += (parseInt(objetoA[index]) * parseInt(objetoA[index]));\n denominadorB += (parseInt(objetoB[index]) * parseInt(objetoB[index]));\n }\n\n denominadorA = Math.sqrt(denominadorA);\n denominadorB = Math.sqrt(denominadorB);\n var valorK = numerador / (denominadorA * denominadorB);\n var valorFinalK = parseInt(valorK * 100);\n\n if (valorFinalK < 99) {\n nuevosK.push({\n foto: newArray[index].foto,\n persona: newArray[index].nombres,\n valorK: valorFinalK + \"%\",\n info: objetoB,\n });\n }\n\n }\n setListaOrdenados(nuevosK.sort((a, b) => (a.valorK > b.valorK) ? - 1 : 1).slice(0, indexLista));\n console.log(listaOrdenados);\n }", "function calcularMediaRealPlantilla() {\r\n\tvar sumaMediasReales = 0;\r\n\tvar numeroJugadores = 0;\r\n\tfor (jugador in jugadores) {\r\n\t\tnumeroJugadores++;\r\n\t\tsumaMediasReales = sumaMediasReales + jugadores[jugador][\"mediareal\"];\r\n\t}\r\n\treturn sumaMediasReales/numeroJugadores;\r\n}", "function calcularNotaPromedio(){\n var sumaNotas = 0.0;\n\n for(var i = 0; i < estudiantes.length; ++i){\n sumaNotas += estudiantes[i].nota;\n }\n\n alert(\"La nota promedio es: \" + (sumaNotas/estudiantes.length).toFixed(2));\n}", "function geomFromOBJ(objcode) {\n\tlet lines = objcode.split(/\\r\\n|\\n/)\n let vertices = []\n let gvertices = []\n\tlet normals = []\n let gnormals = []\n\tlet texCoords = []\n\tlet gtexCoords = []\n\tlet memo = {}\n\tlet gindices = []\n\tlet indexcount=0;\n\tfor (let line of lines) {\n\t\tif (line.substring(0,2) == \"vn\") {\n\t\t\tlet match = line.match(/vn\\s+([0-9.e-]+)\\s+([0-9.e-]+)\\s+([0-9.e-]+)/)\n\t\t\tnormals.push([+match[1], +match[2], +match[3]])\n\t\t} else if (line.substring(0,2) == \"vt\") {\n let match = line.match(/vt\\s+([0-9.e-]+)\\s+([0-9.e-]+)/)\n texCoords.push([+match[1], +match[2]])\n\t\t} else if (line.substring(0,1) == \"v\") {\n let match = line.match(/v\\s+([0-9.e-]+)\\s+([0-9.e-]+)\\s+([0-9.e-]+)/)\n vertices.push([+match[1], +match[2], +match[3]])\n\t\t} else if (line.substring(0,1) == \"f\") {\n\t\t\tlet face = []\n\t\t\tlet match\n // this only works for v/vt/vn input\n\t\t\tlet regex = /([0-9]+)\\s*(\\/\\s*([0-9]*))?\\s*(\\/\\s*([0-9]*))?/g\n\t\t\twhile (match = regex.exec(line)) {\n let V = match[1]\n let T = match[3]\n let N = match[5]\n\t\t\t\tlet name = `${V}/${T}/${N}`\n\t\t\t\tlet id = memo[name]\n\t\t\t \tif (id == undefined) {\n\t\t\t\t\t// a new vertex/normal/texcoord combo, create a new entry for it\n\t\t\t\t\tid = indexcount;\n\t\t\t\t\tlet v = vertices[(+V)-1]\n gvertices.push(v[0], v[1], v[2])\n if (T && texCoords.length) {\n let vt = texCoords[(+T)-1]\n gtexCoords.push(vt[0], vt[1])\n }\n if (N && normals.length) {\n let vn = normals[(+N)-1]\n gnormals.push(vn[0], vn[1], vn[2])\n }\n\t\t\t\t\tmemo[name] = id;\n\t\t\t\t\tindexcount++;\n\t\t\t\t}\n\t\t\t\tif (face.length >= 3) {\n\t\t\t\t\t// triangle strip\n\t\t\t\t\t//face.push(face[face.length-1], face[face.length-2]);\n\t\t\t\t\t// triangle fan poly\n\t\t\t\t\tface.push(face[face.length-1], face[0]);\n\t\t\t\t}\n \t\t\t\tface.push(id);\n\t\t\t}\n\t\t\tfor (let id of face) {\n\t\t\t\tgindices.push(id);\n\t\t\t}\n\t\t} else {\n\t\t\t//console.log(\"ignored\", line)\n\t\t}\n\n }\n let geom = {\n vertices: new Float32Array(gvertices)\n }\n\tif (gnormals.length) geom.normals = new Float32Array(gnormals)\n\tif (gtexCoords.length) geom.texCoords = new Float32Array(gtexCoords)\n\tif (gindices.length) {\n geom.indices = new Uint32Array(gindices)\n }\n\treturn geom\n}", "CalcImporte(prd) {\n //alert('calculando');\n insumo.UltPrd = prd; //validar\n insumo.precio = $(`#prec_${prd}`).val();\n insumo.cantBueno = $(`#cantBueno_${prd}`).val();\n insumo.cantMalo = $(`#cantMalo_${prd}`).val();\n insumo.valorBueno = parseFloat(insumo.precio) * parseInt(insumo.cantBueno);\n insumo.valorMalo = parseFloat(insumo.precio) * parseInt(insumo.cantMalo);\n insumo.subTotal = insumo.valorBueno + insumo.valorMalo; // subTotal linea\n //\n $(`#valorBueno_v${prd}`).val(insumo.valorBueno.toFixed(10));\n $(`#valorBueno_d${prd}`).val(\"¢\" + insumo.valorBueno.toFixed(2).replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\"));\n $(`#valorMalo_v${prd}`).val(insumo.valorMalo.toFixed(10));\n $(`#valorMalo_d${prd}`).val(\"¢\" + insumo.valorMalo.toFixed(2).replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\"));\n $(`#subtotal_v${prd}`).val(insumo.subTotal.toFixed(10));\n $(`#subtotal_d${prd}`).val(\"¢\" + insumo.subTotal.toFixed(2).replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\"));\n }", "function loadPano(panoObjects){\n console.log('loadPano', panoObjects)\n const filePath = panoObjects.panoPath \n let newPanoId = gPanos.length\n console.log(panoObjects.data)\n const panos = Object.values(panoObjects.data)\n console.log('panos', panos, typeof panos, panos.length)\n const panoBaseId = gPanos.length-1\n let panoIdNum \n Object.values(panos).forEach(pano => { \n // debugger\n panoIdNum = panoBaseId + Number(pano.id)\n console.log('pano', pano)\n // Populate New Pano with loaded values\n //panoIdNum = Number(pano.id) + panoBaseId - 1\n let curPano = gPanos[ panoIdNum -1 ]\n if (panoIdNum %2 == 0){\n curPano.elements.main.setAttribute('class', 'pano_a')\n } else {\n curPano.elements.main.setAttribute('class', 'pano_b');\n }\n \n curPano.elements.message.innerHTML = filePath\n curPano.elements.title.innerHTML = \"<b>Pano \"+pano.id+\"</b>\"\n // curPano.elements.addButton.value = \"Save\"\n curPano.elements.addButton.setAttribute(\"hidden\", true)\n curPano.elements.deleteButton.style.display = \"block\"\n curPano.elements.viewName.setAttribute('value', pano.name)\n curPano.elements.inputFile.setAttribute('value', pano.file)\n curPano.elements.posx.setAttribute('value', pano.x) \n curPano.elements.posy.setAttribute('value', pano.y) \n curPano.elements.posz.setAttribute('value', pano.z)\n // curPano.elements.inputFile.setAttribute('onchange', 'input_file-'+newPanoId)\n // Create new Pano \n // pano object {elements, values}\n let newPano = {\n elements: { \n main: curPano.elements.main, \n title: curPano.elements.title, \n message: curPano.elements.message, \n addButton: curPano.elements.addButton,\n deleteButton: curPano.elements.deleteButton,\n inputFile: curPano.elements.inputFile,\n viewName: curPano.elements.viewName,\n viewNameEnabled: curPano.elements.viewNameEnabled, \n camPosEnabled: curPano.elements.camPosEnabled, \n posx: curPano.elements.posx,\n posy: curPano.elements.posy,\n posz: curPano.elements.posz\n },\n values:{}\n }\n\n // gPanos.push(newPano);\n \n // Create New Pano panel\n createPano(gPanos.length)\n })\n\n // Enable Make Panos button\n const makePanoBtn = document.querySelector('#submit_button')\n makePanoBtn.disabled = false\n makePanoBtn.setAttribute('class', 'submit_button')\n console.log(makePanoBtn)\n }", "function totales()\n{\n var subtotal = 0;\n var total = 0.00;\n var totalcantidad = 0;\n var subcantidad = 0;\n var total_dinero = 0;\n var total_cantidad = 0;\n var sub_exento=0;\n $(\"#inventable>tbody tr\").each(function()\n {\n var compra = $(this).find(\".precio_compra\").val();\n var unidad = $(this).find(\".unidad\").val();\n var venta = $(this).find(\".precio_venta\").val();\n var cantidad = parseInt($(this).find(\".cant\").val());\n var vence = $(this).find(\".vence\").val();\n var exento = parseInt($(this).find(\".exento\").val());\n console.log(cantidad);\n if (isNaN(cantidad) == true)\n {\n cantidad = 0;\n }\n subtotal = compra * cantidad;\n\n totalcantidad += cantidad;\n if (isNaN(subtotal) == true)\n {\n subtotal = 0;\n }\n\n if(exento==1)\n {\n sub_exento=sub_exento+subtotal;\n }\n else\n {\n total += subtotal;\n }\n\n });\n if (isNaN(total) == true)\n {\n total = 0;\n }\n sumas_sin_iva=total;\n sumas_sin_iva=round(total, 2);\n\n if(isNaN(sub_exento))\n {\n sub_exento=0;\n }\n\n tipo_doc=$('#tipo_doc').val();\n\n percepcion = $('#percepcion').val();\n\n var monto_percepcion = $('#monto_percepcion').val();\n var iva = $('#porc_iva').val();\n\n total_percepcion=0;\n iva = round((total * iva), 4);\n sub_exento = round(sub_exento, 2);\n\n if (total >= monto_percepcion)\n total_percepcion = round((total * percepcion), 4);\n\n total += total_percepcion;\n if(tipo_doc=='CCF')\n {\n total += iva;\n }\n else\n {\n iva=0;\n\n }\n\n\n total+= sub_exento;\n total_dinero =parseFloat(total).toFixed(2);\n /*if(total_dinero=='0'){\n total_dinero=\"0.00\";\n }else{\n total_dinero=total_dinero =parseFloat(total).toFixed(2);;\n }*/\n total_cantidad = round(totalcantidad,2);\n $('#totcant').html(total_cantidad);\n $('#sumas_sin_iva').html(round(sumas_sin_iva,2));\n $('#subtotal').html(round((sumas_sin_iva+iva), 2));\n $('#iva').html(round(iva,2));\n $('#venta_exenta').html(sub_exento);\n $('#total_percepcion').html(round(total_percepcion, 2));\n $('#total_dinero').html(total_dinero);\n $('#totaltexto').load('compras.php?' + 'process=total_texto&total=' + total_dinero);\n}", "get normal (){\n\t\treturn this.dir.perp(1);\t\t\t\n\t}", "function criarObjetoFis(_objeto) {\n var objeto = _objeto;\n switch (objeto) {\n case \"Esfera\":\n {\n try {\n if (document.getElementById(\"MassaEsfera\").value === \"\" || document.getElementById(\"MassaEsfera\").value <= 0) {\n alert(\"O valor da da massa não pode ser vazio nem menor que zero!\");\n } else {\n objetoAtual = new ObjetoFisica(document.getElementById(\"NomeEsfera\").value,\n parseInt(document.getElementById(\"Raio\").value),\n \"Esfera\",\n document.getElementById(\"MaterialEsfera\").value,\n indice,\n getVector3(\"posEsfera\"),\n getVector3(\"vEsfera\"),\n document.getElementById(\"MassaEsfera\").value,\n document.getElementById(\"amortce_Linear_Esfera\").value,\n document.getElementById(\"amortce_Angular_Esfera\").value,\n getVector3(\"rotEsfera\"),\n getVector3(\"acEsfera\"),\n getQuaternion(\"oEsfera\"),\n colisao('esfera'),\n true);\n objetoAtual.CriaEsfera();//Colocar como parametro a cena.\n listaObjetosFis.push(objetoAtual);\n console.log(objetoAtual.getOrientacao());\n //console.log(objetoAtual.teste());\n document.getElementById(\"listaObjetos\").appendChild(objetoAtual.getDiv());\n document.getElementById(\"listaDeObjetos_Efera\").appendChild(objetoAtual.addLista('esfera'));\n document.getElementById(\"listaDeObjetos_Cubo\").appendChild(objetoAtual.addLista('cubo'));\n document.getElementById(\"listaDeObjetos_Alvo\").appendChild(objetoAtual.addLista('alvo'));\n indice++;\n }\n } catch (e) {\n alert(e);\n }\n break;\n }\n case \"Cubo\":\n {\n try {\n if (document.getElementById(\"MassaCubo\").value === \"\" || document.getElementById(\"MassaCubo\").value <= 0) {\n alert(\"O valor da da massa não pode ser vazio nem menor que zero!\");\n } else {\n objetoAtual = new ObjetoFisica(document.getElementById(\"NomeCubo\").value,\n parseInt(document.getElementById(\"TamanhoCubo\").value),\n \"Cubo\",\n document.getElementById(\"MaterialCubo\").value,\n indice,\n getVector3(\"posCubo\"),\n getVector3(\"vCubo\"),\n document.getElementById(\"MassaCubo\").value,\n document.getElementById(\"amortce_Linear_Cubo\").value,\n document.getElementById(\"amortce_Angular_Cubo\").value,\n getVector3(\"rotCubo\"),\n getVector3(\"acCubo\"),\n getQuaternion(\"oCubo\"),\n colisao('cubo'),\n true);\n objetoAtual.CriaCubo();\n listaObjetosFis.push(objetoAtual);\n //alert(objetoAtual.teste());\n document.getElementById(\"listaObjetos\").appendChild(objetoAtual.getDiv());\n document.getElementById(\"listaDeObjetos_Efera\").appendChild(objetoAtual.addLista('esfera'));\n document.getElementById(\"listaDeObjetos_Cubo\").appendChild(objetoAtual.addLista('cubo'));\n document.getElementById(\"listaDeObjetos_Alvo\").appendChild(objetoAtual.addLista('alvo'));\n indice++;\n }\n } catch (e) {\n alert(e);\n }\n break;\n }\n case \"Alvo\":\n {\n try {\n objetoAtual = new ObjetoFisica(document.getElementById(\"NomeAlvo\").value,\n parseInt(document.getElementById(\"TamanhoAlvo\").value),\n \"Alvo\",\n null,\n indice,\n getVector3(\"posAlvo\"),\n getVector3(\"vAlvo\"),\n document.getElementById(\"MassaAlvo\").value,\n document.getElementById(\"amortce_Linear_Alvo\").value,\n document.getElementById(\"amortce_Angular_Alvo\").value,\n getVector3(\"rotAlvo\"),\n getVector3(\"acAlvo\"),\n getQuaternion(\"oAlvo\"),\n colisao('alvo'),\n false);\n objetoAtual.CriaAlvo();\n listaObjetosFis.push(objetoAtual);\n //alert(objetoAtual.teste());\n document.getElementById(\"listaObjetos\").appendChild(objetoAtual.getDiv());\n document.getElementById(\"listaDeObjetos_Efera\").appendChild(objetoAtual.addLista('esfera'));\n document.getElementById(\"listaDeObjetos_Cubo\").appendChild(objetoAtual.addLista('cubo'));\n document.getElementById(\"listaDeObjetos_Alvo\").appendChild(objetoAtual.addLista('alvo'));\n indice++;\n } catch (e) {\n alert(e);\n }\n break;\n }\n }\n}", "function update_obj(obj) {\n obj.transform = obj.matrix;\n obj.transform = CG.Matrix4.multiply(viewProjectionMatrix, obj.transform);\n\n obj.vector.forEach((vertex, index) => {\n obj.new_vertices[index] = obj.transform.multiplyVector3(vertex);\n });\n }", "function ordenarProductosPrecio(productos, orden){\n\n //creo una variable donde se van a cagar los productos por orden de precio\n\n //variable de menor a mayor\n let productosOrdenPrecioAsc = [];\n //variable de mayor a menor\n let productosOrdenPrecioDesc = [];\n\n //guardamos una copia del array de productos traidos del json\n\n let productosCopia = productos.slice();\n\n // creo una variable que va a ser un array con solo los precios de cada producto, la cargamos mediante un map\n \n let arrayProductosOrdenPrecio = productosCopia.map((producto) => {return producto.precio} );\n\n //ordeno el array con los precios\n \n let comparar = (a,b) => {return a - b};\n \n arrayProductosOrdenPrecio.sort(comparar);\n\n // recorro el array con los precios de los productos en orden\n\n for(precio of arrayProductosOrdenPrecio){\n \n //guardo el indice donde se encuentra el producto que coincide con el precio del array con precios ordenados\n\n let indice = productosCopia.findIndex( (productoCopia) => { if(productoCopia.precio==precio){ \n\n return productoCopia \n\n } } );\n\n //guardo en el array de productos por orden de precio que cree al principio de la funcion, el producto del array que coincida con el indice\n\n //mayor a menor\n productosOrdenPrecioDesc.unshift(productosCopia[indice]);\n //menor a mayor\n productosOrdenPrecioAsc.push(productosCopia[indice]);\n\n /*Luego de guardarlo, elimino ese producto del array copia ya que \n el metodo findIndex devuelve el indice del primer elemto que coincida y si hay productos con la misma fecha\n se va a guardar siempre el primero que encuentre (resumen: lo elimino para que no se guarden elementos repetidos)*/\n\n productosCopia.splice(indice,1);\n \n }\n\n //retornamos el nuevo array de productos ordenados por precio \n\n if(orden == \"asc\"){\n\n return productosOrdenPrecioAsc;\n\n }\n\n if(orden == \"des\"){\n\n return productosOrdenPrecioDesc;\n\n }\n\n if(orden != \"asc\" && orden != \"des\"){\n\n console.log(\"ingrese correctamente el parametro indicador del ordenamiento por precio\");\n\n }\n \n\n}", "imprimirVehiculos() {\n\t\tthis.vehiculos.forEach(vehiculo => {\n\t\t\tif (vehiculo.puertas) {\n\t\t\t\tconsole.log(`Marca: ${vehiculo.marca} // Modelo: ${vehiculo.modelo} // Puertas: ${vehiculo.puertas} // Precio: $${this.formatearPrecio(vehiculo.precio)}`)\n\t\t\t}\n\t\t\tif (vehiculo.cilindrada) {\n\t\t\t\tconsole.log(`Marca: ${vehiculo.marca} // Modelo: ${vehiculo.modelo} // Cilindrada: ${vehiculo.cilindrada}cc // Precio: $${this.formatearPrecio(vehiculo.precio)}`)\n\t\t\t}\n\t\t});\n\t}", "function volar(golondrina, distancia) {\n \n return{\n energia: golondrina.energia - (2*distancia), \n nombre:golondrina.nombre}\n}", "calcula(i){\n let vP = this.arrCamisas[i].camisap*10;\n let vM = this.arrCamisas[i].camisam*12;\n let vG = this.arrCamisas[i].camisag*15;\n\n let valortotal = vP+vM+vG;\n\n return valortotal;\n }", "function calcular_total_Modificado() {\n var totalfactura = 0;\n var importe_porcentaje = 0;\n var totaltraido = $(\"#totalfijo\").text();\n if (totaltraido == \"0\") {\n return false;\n }\n var entradavalor = $('#totalcondescuento').val();\n if (entradavalor == \"\") {\n return false;\n }\n totaltraido = parseFloat(totaltraido);\n entradavalor = parseFloat(entradavalor);\n if (entradavalor > totaltraido) {\n $(\"#mostrarimporte\").text(\"0 %\");\n $(\"#datosfactura tr\").remove();\n var total1 = $(\"#totalfijo\").text();\n var valor1 = LITERAL(total1);\n var tabladatos = $('#datosfactura');\n $(\"#totalacobrarcondescuentoenlaventa\").text(total1);\n tabladatos.append(\"<tr><td id='totalcondescuentoventa'>\" + total1 + \"</td><td id='totalventaliteral'>\" + valor1 + \"</td><tr>\");\n return false;\n }\n if (totaltraido === '') {\n totaltraido = totalfactura;\n }\n var numero = parseInt(totaltraido);\n importe_porcentaje = (entradavalor * 100).toFixed(2);\n var porcentajemitad = importe_porcentaje / numero;\n var porcentajereal = (100 - porcentajemitad).toFixed(1);\n\n if (entradavalor == \"0\" || entradavalor == \"\") {\n $(\"#mostrarimporte\").text(\"0 %\");\n\n var idselecionado = $(\"#descuentos\").val();\n var route = \"/Descuento/\" + idselecionado + \"/edit\";\n var totalcargado = $(\"#totaldefacturas\").val(totalfactura);\n $(\"#totaldefacturassindescuento\").val(totalfactura);\n\n $(\"#datosfactura tr\").remove();\n var total1 = $(\"#totalfijo\").text();\n var valor1 = LITERAL(total1);\n var tabladatos = $('#datosfactura');\n $(\"#totalacobrarcondescuentoenlaventa\").text(total1);\n tabladatos.append(\"<tr><td id='totalcondescuentoventa'>\" + total1 + \"</td><td id='totalventaliteral'>\" + valor1 + \"</td><tr>\");\n var total1 = parseFloat(total1);\n var porcentaje = total1 * 0.3;\n porcentaje = porcentaje.toFixed(2);\n var saldo = total1 - porcentaje;\n $(\"#aCuenta\").val(porcentaje);\n $(\"#saldo\").val(saldo.toFixed(2));\n\n } else {\n $(\"#mostrarimporte\").text(porcentajereal + \" %\");\n $(\"#datosfactura tr\").remove();\n var total1 = \"\" + entradavalor + \"\";\n var valor1 = LITERAL(total1);\n var tabladatos = $('#datosfactura');\n $(\"#totalacobrarcondescuentoenlaventa\").text(entradavalor);\n tabladatos.append(\"<tr><td id='totalcondescuentoventa'>\" + entradavalor + \"</td><td id='totalventaliteral'>\" + valor1 + \"</td><tr>\");\n var total1 = parseFloat(entradavalor);\n var porcentaje = total1 * 0.3;\n porcentaje = porcentaje.toFixed(2);\n var saldo = total1 - porcentaje;\n $(\"#aCuenta\").val(porcentaje);\n $(\"#saldo\").val(saldo.toFixed(2));\n }\n}", "function calcularMontos() {\n validarBotonCLiente();\n\n var rowCountFactura = $('#tblDetalleFactura tr').length;\n if (rowCountFactura > 1) {\n var estado = false;\n var tipoCambio = parseFloat($('#txtTipoCambio').val());\n var totalRecibos = 0;\n var totalBase = 0;\n var totalImpuesto = 0;\n var totalRetencion = 0;\n var totalNeto = 0;\n var totalDescuento = 0;\n\n var totalAplicar = 0;\n\n //variables para validar que no se esta dejando saldo pendiente en el cobro \n var MontoPendienteDoc = 0;\n var MontoaAplicarDoc = 0;\n var MontoDepositadoTotal = $(\"#txtMVoucher\").val();\n\n $('#tblDetalleFactura tr').each(function () {\n var IdFacturaTmp = $(this).find(\".tmpIdFactura\").html();\n if (!isNaN(IdFacturaTmp) && IdFacturaTmp != null) {\n var Base = $(this).find(\".tmpBase\").html();\n var Impuesto = $(this).find(\".tmpImpuesto\").html();\n var Retencion = $(this).find(\".tmpRetencion\").html();\n var Descuento = $(this).find(\".tmpDescuento\").html();\n\n\n\n var saldo = $(this).find(\".tmpFinal\").html();\n var pendienteAplicacion = $(this).find(\".tmpPendienteAplicacion\").html();\n var montoAplicar = quitarformatoMoneda($('#txtFactMontoAplicar' + IdFacturaTmp).val());\n var estadoEnDB = $(this).find(\".tmpEnDB\").html();\n\n MontoPendienteDoc = saldo;\n MontoaAplicarDoc = montoAplicar;\n\n //VALIDACION MONTO MENOR\n if (estadoEnDB == false) {\n if (parseFloat(montoAplicar) != 0 && parseFloat(montoAplicar) <= parseFloat(saldo - pendienteAplicacion)) {\n $('#txtFactMontoAplicar' + IdFacturaTmp).css('border', '1px solid gray');\n } else {\n if (isNaN(montoAplicar) || montoAplicar == null || montoAplicar == '') {\n $('#txtFactMontoAplicar' + IdFacturaTmp).val(0);\n montoAplicar = 0;\n }\n $('#txtFactMontoAplicar' + IdFacturaTmp).css('border', '1px solid red');\n }\n }\n\n var detalleFactura = {\n IdFactura: IdFacturaTmp,\n montoAplicarNuevo: montoAplicar\n };\n\n ActualizarFacturaDetalle(detalleFactura);\n var IdMonedaTmp = $(this).find(\".tmpIdMonedaFact\").html();\n if (IdMonedaTmp == '44') { //Moneda Dolar\n montoAplicar = (parseFloat(montoAplicar) * tipoCambio);\n }\n\n totalAplicar = parseFloat(totalAplicar) + parseFloat(montoAplicar);\n totalRecibos += 1;\n estado = true;\n }\n });\n\n\n if (estado == true) {\n\n\n $(\"#txtMAplicar\").val(formatoCurrency(totalAplicar));\n $(\"#hidMAplicar\").val(totalAplicar);\n ValidaMontosAplicarSaldo(MontoDepositadoTotal, totalAplicar, MontoaAplicarDoc, MontoPendienteDoc);\n }\n } else {\n LimpiarTotalAplicarFactura();\n }\n}", "function calcularTotal() {\n // Limpiamos precio anterior\n total = 0;\n // Recorremos el array del carrito\n carrito.forEach((item) => {\n // De cada elemento obtenemos su precio\n const miItem = baseDeDatos.filter((itemBaseDatos) => {\n return itemBaseDatos.id === parseInt(item);\n });\n total = total + miItem[0].precio;\n });\n // Renderizamos el precio en el HTML\n DOMtotal.textContent = total.toFixed(2);\n}", "function totalCarrito(carrito) {\n console.log(carrito);\n let total = 0;\n carrito.forEach(p => total += p.subtotal());\n return total.toFixed(2);\n}", "function dibujarFresado120(modelo,di,pos,document){\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior)\n\tvar fresado2 = new RVector(pos.x+anchura1,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior)\n\t\n\tvar fresado8 = new RVector(pos.x+anchura1+anchura2,pos.y)\n\t\n\tvar fresado9 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca)\n\tvar fresado10 = new RVector(pos.x+anchura1,pos.y+alaInferior+alturaPlaca)\n\tvar fresado11 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+alturaPlaca)\n\t\n\tvar fresado16 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado9, fresado11 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado10 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\n\n\t\n\t\n\t\n\t//anchura1\n\tif (anchura1>pliegueSuperior){ \n\t\tvar fresado17 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado18 = new RVector(pos.x+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado19 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado20 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado20 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t//anchura2\n\tif (anchura2>pliegueSuperior*2){ \n\t\tvar fresado23 = new RVector(pos.x+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado24 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado22 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado21 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\treturn op_fresado;\n}", "function obtenerPromediosDePartidos(partido, miembrosDelPartido) {\n \n if (miembrosDelPartido > 1) {\n let votosTotal = [0];\n\n members1.forEach((miembro) => {\n if (miembro.party === partido) {\n votosTotal.push(miembro.votes_with_party_pct);\n }\n return votosTotal;\n });\n\n suma = votosTotal.reduce((a, b) => a + b) / miembrosDelPartido;\n\n return suma.toFixed(2);\n \n } else {\n return suma = \"0.00\"\n }\n \n\n }", "function actualizarCantidad() {\n\n var total = 0;\n var cantidadFumigacion = 0;\n var contador = 0;\n\n // Se recorren todos los despegues\n while (contador < elDiaDeHoy.despeguesDeAvionetas.length) {\n\n // Se toma la avioneta y se evalua si es de fumigacion\n if (elDiaDeHoy.despeguesDeAvionetas[contador].Avioneta.esDeFumigacion) {\n\n // si la avioneta es de fumigacion se incrementa el contador de fumigacion en uno;\n cantidadFumigacion++;\n }\n\n // se incrementa el total en uno.\n total++;\n\n // se avanza en uno el contador\n contador++;\n }\n\n // Se actualizan los totales del dia. \n elDiaDeHoy.cantidadTotal = total;\n elDiaDeHoy.cantidadDeFumigacion = cantidadFumigacion;\n}", "readSelectedFile() {\n var fileReader = new FileReader();\n var objFile = document.getElementById(\"fileInput\").files[0];\n\n if (!objFile) {\n alert(\"OBJ file not set!\");\n return;\n }\n\n fileReader.readAsText(objFile);\n fileReader.onloadend = function() {\n // alert(fileReader.result);\n var customObj = new CustomOBJ(shader, fileReader.result);\n _inputHandler.scene.addGeometry(customObj);\n }\n }", "function ver() { //funcion que recorrera las imagenes y las mostrara\n let contenido=\"\";\n\n for(let i=0;i<fileVal.length;i++){\n let imgtemporal=fileVal[i].name;\n insetar(imgtemporal);\n \n }\n\n}", "function actualizarDatos(){\r\n centro1X = centroX-dist/2;\r\n centro2X = centroX +dist/2;\r\n console.log(centro1X-rad1);\r\n arrayMedidores[0].x = centro1X-rad1;\r\n arrayMedidores[1].x = centro1X-(-rad1);\r\n arrayMedidores[2].x = centro2X-rad2;\r\n arrayMedidores[3].x = centro2X-(-rad2);\r\n d=dist/PixelMet;\r\n\r\n arrayCargas=[];\r\n arrayCargas2=[];\r\n for(var i = 0;i < maxCargas ; i++){\r\n var posicion = calPosUno(i);\r\n var q = calCargaUno(i);\r\n arrayCargas.push(new CargaP(centro1X+posicion*PixelMet,centroY,10,q))\r\n }\r\n for(var i = 1;i < maxCargas ; i++){\r\n var posicion = calPosDos(i);\r\n var q = calCargaDos(i);\r\n arrayCargas2.push(new CargaP(centro2X-posicion*PixelMet,centroY,10,q))\r\n }\r\n\r\n\r\n\r\n var conta = sliderPas.value;\r\n for(var i = 0 ;i<arrayCargas.length;i++){\r\n if(i<conta){\r\n arrayCargas[i].Boolshow = 1;\r\n }\r\n else {\r\n arrayCargas[i].Boolshow = 0;\r\n }\r\n }\r\n\r\n for(var i = 0 ;i<arrayCargas2.length;i++){\r\n if(i<conta){\r\n \tarrayCargas2[i].Boolshow = 1;\t}\r\n else {\r\n \tarrayCargas2[i].Boolshow = 0; }\r\n }\r\n}", "function normalizar() {\n console.log(this.coords.map((elemento) => elemento / this.length));\n}", "function nota_promedio(){\n\t\tvar sum = 0;\n\t\tvar pro = 0;\n\t\tfor(num = 0; num < alumnos.length; num ++){\n\t\t\tsum += (alumnos[num].nota);\n\t\t}\n\t\tpro = sum / 10;\n\t\tdocument.getElementById(\"promedio\").innerHTML = \"El Promedio es: <b>\" + pro.toFixed(2) + \"</b>\";\n\t}", "function calcularMedia(puntuacionesPartidos) {\n let sumaPuntos = 0;\n for (let i = 0; i < puntuacionesPartidos.length; i++) {\n sumaPuntos += puntuacionesPartidos[i];\n }\n return Math.round(sumaPuntos / puntuacionesPartidos.length);\n}", "get importNormals() {}", "computeTotals()\n {\n if (this.file.transactions.length == 0)\n return\n\n this.totalSpendings = this.file.transactions\n .map(x => Math.min(x.amount, 0))\n .reduce((acc, x) => acc + x)\n\n this.totalIncome = this.file.transactions\n .map(x => Math.max(x.amount, 0))\n .reduce((acc, x) => acc + x)\n }", "asistenciasTotalesPorDia(equipo){\n let len = equipo.length;\n let asistencia_total = [];\n let total_lunes=0;\n let total_martes=0;\n let total_miercoles=0;\n let total_jueves=0;\n let total_viernes=0;\n let total_sabado=0;\n let total_domingo=0;\n \n for (var i = 0; i <len; ++i) {\n total_lunes = total_lunes + (equipo[i].asistencia.lunes * equipo[i].factor_dias_laborados);\n total_martes = total_martes+ (equipo[i].asistencia.martes * equipo[i].factor_dias_laborados);\n total_miercoles = total_miercoles + (equipo[i].asistencia.miercoles * equipo[i].factor_dias_laborados);\n total_jueves = total_jueves + (equipo[i].asistencia.jueves * equipo[i].factor_dias_laborados);\n total_viernes = total_viernes + (equipo[i].asistencia.viernes * equipo[i].factor_dias_laborados);\n total_sabado = total_sabado + (equipo[i].asistencia.sabado * equipo[i].factor_dias_laborados);\n // total_domingo = total_domingo + (equipo[i].asistencia.domingo * equipo[i].factor_dias_laborados);\n }\n\n asistencia_total.push(total_lunes);\n asistencia_total.push(total_martes);\n asistencia_total.push(total_miercoles);\n asistencia_total.push(total_jueves);\n asistencia_total.push(total_viernes);\n asistencia_total.push(total_sabado);\n // asistencia_total.push(total_domingo);\n\n \n return asistencia_total;\n }", "processData()\n\t{\n\t\tlet filas = this.controlFilas; // Filas\n\t\tlet columnas = this.controlColumnas; // Columnas\n\t\tlet sumaClase = 0; // Sumas del tamaño de la clase\n\t\tlet data = []; // Matriz para datos\n\t\tdata[0] = []; // Init\n\t\tdata[1] = []; // fin\n\t\tdata[2] = []; // marca clase\n\t\tdata[3] = []; // Unidades\n\n\t\t// Recogemos los datos\n\t\tfor(let i = 0; i < filas; i++){\n\t\t\tfor(let j = 0; j < columnas; j++){\n\t\t\t\t// Verificamos si hay un dato\n\t\t\t\tif(document.getElementById((i+1)+''+(j+1)).value.length > 0){\n\t\t\t\t\t// Verificamos que solo se sumen columnas 1 y 2\n\t\t\t\t\tif(j == 0 || j == 1){\n\t\t\t\t\t\tsumaClase += parseFloat(document.getElementById((i+1)+''+(j+1)).value);\n\t\t\t\t\t\tif(j == 0){\n\t\t\t\t\t\t\t// Guardamos datos\n\t\t\t\t\t\t\tdata[0].push(parseFloat(document.getElementById((i+1)+''+(j+1)).value));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Guardamos datos\n\t\t\t\t\t\t\tdata[1].push(parseFloat(document.getElementById((i+1)+''+(j+1)).value));\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if(j == 2){\n\t\t\t\t\t\t// Guardamos datos\n\t\t\t\t\t\tdata[3].push(parseFloat(document.getElementById((i+1)+''+(j+1)).value));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Inyectamos\n\t\t\t\t\tdocument.getElementById((i+1)+''+(j+1)).value = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdata[2].push(sumaClase / 2); // Guardamos datos\n\t\t\tsumaClase = 0; // Reseteamos\n\t\t}\n\n\t\t// Mostramos texto para resultados\n\t\tlet h = document.createElement('h2');\n\t\th.setAttribute('class', 'results-title');\n\t\tlet hText = document.createTextNode('Resultados:');\n\t\th.appendChild(hText);\n\t\tdocument.getElementById('main-content').appendChild(h);\n\n\t\t// Obtenem0s medidas de tendencia central\n\t\tlet table = document.createElement('table');\n\t\ttable.setAttribute('id', 'medidas');\n\t\tlet caption = document.createElement('caption');\n\t\tcaption.setAttribute('class', 'padding');\n\t\tlet text = document.createTextNode('Medidas de tendencia central');\n\t\tcaption.appendChild(text);\n\t\ttable.appendChild(caption);\n\t\tlet row = table.insertRow(0);\n\t\tlet cell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Media aritmética');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.mediaAritmetica(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\trow = table.insertRow(1);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Moda');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.moda(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\trow = table.insertRow(2);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Mediana');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.mediana(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\trow = table.insertRow(3);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Media armónica');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.mediaArmonica(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\trow = table.insertRow(4);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Media geométrica');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.mediaGeometrica(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\tdocument.getElementById('main-content').appendChild(table);\n\n\t\t// Obtenem0s medidas de dispersión\n\t\ttable = document.createElement('table');\n\t\ttable.setAttribute('id', 'medidas');\n\t\tcaption = document.createElement('caption');\n\t\tcaption.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Medidas de dispersión');\n\t\tcaption.appendChild(text);\n\t\ttable.appendChild(caption);\n\t\trow = table.insertRow(0);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Desviación media');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.desviacionMedia(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\trow = table.insertRow(1);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Desviación estandar');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.desviacionEstandar(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\trow = table.insertRow(2);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Varianza');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.varianza(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\tdocument.getElementById('main-content').appendChild(table);\n\t}", "function cleanData(listOfObjs) {\n for (let prop in listOfObjs) {\n if (listOfObjs.hasOwnProperty(prop)) {\n if (listOfObjs[prop] === Object(listOfObjs[prop])) {\n cleanData(listOfObjs[prop]);\n } else if (listOfObjs[prop] === \"\") {\n listOfObjs[prop] = null;\n\n } else if (!isNaN(listOfObjs[prop])) {\n listOfObjs[prop] = parseFloat(listOfObjs[prop])\n }\n }\n }\n}", "function dibujarFresado115(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4]\n\t\n\t//sacar el mayor pliegue\n\tpliegueInferior=pliegueInf1\n\tfor (n=1 ; n<4 ; n=n+1){\n\t\tif (pliegueInferior<plieguesInf[n]) {\n\t\t\tpliegueInferior=plieguesInf[n]\n\t\t}\n\t}\n\t\n\t\n\t\n\t//Puntos trayectoria\t\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior)\n\t\n\tvar fresado16 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior) \n\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado22 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado2 = new RVector(pos.x+alaIzquierda,pos.y)\n\t\n\t\n\tvar line = new RLineEntity(document, new RLineData( fresado16 , fresado14 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado20 , fresado13 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado12 , fresado19 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado18 , fresado11 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado21 ));\n\top_fresado.addObject(line,false);\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t//anchura1 - Inferior\n\tif (anchura1>pliegueInf1) {\n\t\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado3 = new RVector(pos.x+alaIzquierda+anchura1-pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t\top_fresado.addObject(line,false);\n\t} \n\t\n\t//anchura2 - Inferior\n\tif (anchura2>(pliegueInf2*2)) {\n\t\tvar fresado4 = new RVector(pos.x+alaIzquierda+anchura1+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado5 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado5 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t//anchura3 - Inferior\n\tif (anchura3>(pliegueInf3*2)) {\n\t\tvar fresado6 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado7 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado7 ));\n\t\top_fresado.addObject(line,false);\n\t} \n\t\n\t//anchura4 - Inferior\n\tif (anchura4>pliegueInf4) {\n\t\tvar fresado8 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado9 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t} \n\t\n\t\n\t\n\n\t\n\t\n\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)) {\n\t\tvar fresado25 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) { //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)) {\n\t\tvar fresado31 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) {\n\t\t\tvar fresado29 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\tvar fresado33 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2) {\n\t\tvar fresado37 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) {\n\t\t\tvar fresado35 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\tvar fresado39 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior) {\n\t\tvar fresado43 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) {\n\t\t\tvar fresado41 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\tvar fresado2 = new RVector(pos.x+alaIzquierda,pos.y)\n\tvar fresado25 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado25 ));\n\top_fresado.addObject(line,false);\n\t\n\t\n\t\n\treturn op_fresado; \n}", "nuevoCiclo() {\n let suma = 0;\n for (let i = 0; i < this.vecinos.length; i++) {\n if (this.vecinos[i].estado === 1) {\n suma++;\n }\n }\n\n // Aplicamos las normas\n this.estadoProx = this.estado; // Por defecto queda igual\n\n // Vida: tiene 3 vecinos\n if (this.estado === 0 && suma === 3) {\n this.estadoProx = 1;\n }\n\n // Muerte: menos de 2(soledad) o mas de 3 (inanicion)\n if (this.estado == 1 && (suma < 2 || suma > 3)) {\n this.estadoProx = 0;\n }\n }", "function rellenarArray(Arr){\n var line4 = [];\n a = 0;\n var j = 0;\n count = 0;\n media = 0;\n for (var prop_name in Arr) {\n a = parseFloat(prop_name); \n line4.push([a, Arr[prop_name]]) \n if (j==0){\n inicio = a;\n maximo = parseFloat(Arr[prop_name]);\n minimo = parseFloat(Arr[prop_name]);\n j = 1; \n }\n if (parseFloat(Arr[prop_name]) > maximo){maximo = parseFloat(Arr[prop_name])}\n if (parseFloat(Arr[prop_name]) < minimo){minimo = parseFloat(Arr[prop_name])}\n media += parseFloat(Arr[prop_name]);\n count += 1;\n };\n finGra = a;\n media = media/count;\n return line4;\n}", "function recupararFoto(nombre) {\n for (let objeto of objetos) {\n if (objeto.nombre == nombre) {\n return objeto.imagen;\n }\n }\n}", "function obtenerMovimientoAdecuado(datosEsenciales){\n var estadisticos = [0,0,0,0];\n var valormax = 0;\n var movimiento;\n var sumatoria = 0;\n //Buscamos el valor valor de los pesos de los primeros 4 caminos\n for(var i = 0; i<datosEsenciales.length; i++){\n sumatoria += datosEsenciales[i][1];\n valormax = obtenerMaximo(valormax, datosEsenciales[i][1]);\n }\n\n //Obtenemos el indice o camino que contiene el valor mayor de los pesos\n for(var i = 0; i<datosEsenciales.length; i++){\n if(datosEsenciales[i][1] == valormax){\n movimiento = datosEsenciales[i][0];\n break;\n }\n }\n //Calculamos los porcentajes de exito por cada uno de los primeros 4 caminos\n for(var i = 0; i<datosEsenciales.length; i++){\n if(datosEsenciales[i][1] != undefined)\n estadisticos[datosEsenciales[i][0]] = Math.round((datosEsenciales[i][1]/sumatoria)*100);\n }\n if(movimiento == undefined)\n movimiento = (Math.floor(Math.random() * (4 - 0) + 0));\n return {movimientoAdecuado: movimiento, estadisticos: estadisticos}\n }", "function parseObj(model, lines) {\n // OBJ allows a face to specify an index for a vertex (in the above example),\n // but it also allows you to specify a custom combination of vertex, UV\n // coordinate, and vertex normal. So, \"3/4/3\" would mean, \"use vertex 3 with\n // UV coordinate 4 and vertex normal 3\". In WebGL, every vertex with different\n // parameters must be a different vertex, so loadedVerts is used to\n // temporarily store the parsed vertices, normals, etc., and indexedVerts is\n // used to map a specific combination (keyed on, for example, the string\n // \"3/4/3\"), to the actual index of the newly created vertex in the final\n // object.\n var loadedVerts = {\n v: [],\n vt: [],\n vn: []\n };\n\n var indexedVerts = {};\n\n for (var line = 0; line < lines.length; ++line) {\n // Each line is a separate object (vertex, face, vertex normal, etc)\n // For each line, split it into tokens on whitespace. The first token\n // describes the type.\n var tokens = lines[line].trim().split(/\\b\\s+/);\n\n if (tokens.length > 0) {\n if (tokens[0] === 'v' || tokens[0] === 'vn') {\n // Check if this line describes a vertex or vertex normal.\n // It will have three numeric parameters.\n var vertex = new _main.default.Vector(\n parseFloat(tokens[1]),\n parseFloat(tokens[2]),\n parseFloat(tokens[3])\n );\n\n loadedVerts[tokens[0]].push(vertex);\n } else if (tokens[0] === 'vt') {\n // Check if this line describes a texture coordinate.\n // It will have two numeric parameters.\n var texVertex = [parseFloat(tokens[1]), parseFloat(tokens[2])];\n loadedVerts[tokens[0]].push(texVertex);\n } else if (tokens[0] === 'f') {\n // Check if this line describes a face.\n // OBJ faces can have more than three points. Triangulate points.\n for (var tri = 3; tri < tokens.length; ++tri) {\n var face = [];\n\n var vertexTokens = [1, tri - 1, tri];\n\n for (var tokenInd = 0; tokenInd < vertexTokens.length; ++tokenInd) {\n // Now, convert the given token into an index\n var vertString = tokens[vertexTokens[tokenInd]];\n var vertIndex = 0;\n\n // TODO: Faces can technically use negative numbers to refer to the\n // previous nth vertex. I haven't seen this used in practice, but\n // it might be good to implement this in the future.\n\n if (indexedVerts[vertString] !== undefined) {\n vertIndex = indexedVerts[vertString];\n } else {\n var vertParts = vertString.split('/');\n for (var i = 0; i < vertParts.length; i++) {\n vertParts[i] = parseInt(vertParts[i]) - 1;\n }\n\n vertIndex = indexedVerts[vertString] = model.vertices.length;\n model.vertices.push(loadedVerts.v[vertParts[0]].copy());\n if (loadedVerts.vt[vertParts[1]]) {\n model.uvs.push(loadedVerts.vt[vertParts[1]].slice());\n } else {\n model.uvs.push([0, 0]);\n }\n\n if (loadedVerts.vn[vertParts[2]]) {\n model.vertexNormals.push(loadedVerts.vn[vertParts[2]].copy());\n }\n }\n\n face.push(vertIndex);\n }\n\n if (face[0] !== face[1] && face[0] !== face[2] && face[1] !== face[2]) {\n model.faces.push(face);\n }\n }\n }\n }\n }\n // If the model doesn't have normals, compute the normals\n if (model.vertexNormals.length === 0) {\n model.computeNormals();\n }\n\n return model;\n }", "function vaciarCarrito() {\n // Limpiamos los productos guardados\n carrito = [];\n // Renderizamos los cambios\n renderizarCarrito();\n calcularTotal();\n}", "function calcola_tariffa(totale,versato) {\n\tif(totale == '') totale=0;\n\tif(versato == '') versato=0;\n\tvar differenza=(parseFloat(totale).toFixed(2))-(parseFloat(versato).toFixed(2));\n\tdifferenza=differenza.toFixed(2);\n\t//var re_dot = new RegExp(/\\./);\n\t//if(!differenza.match(re_dot)) { \n\t//\tdifferenza=differenza+\".00\";\n\t//}\n\t//var differenza_dec=check_euro(differenza);\n\t//alert(differenza_dec);\n\treturn differenza;\n}", "calculateStatistics() {\n let saleCount = 0;\n let amount = 0;\n let average = 0;\n let max = undefined;\n let min = undefined;\n let upperBound = 0;\n let lowerBound = 0;\n\n //Se calcula max, min y amount\n this.sales.forEach((sale) => {\n saleCount++;\n amount += sale.amount;\n\n if (typeof max === \"undefined\" && typeof min === \"undefined\") {\n max = sale;\n min = sale;\n } else {\n max = max.amount >= sale.amount ? max : sale;\n min = min.amount <= sale.amount ? min : sale;\n }\n });\n\n //Se calcula average y las cotas superior e inferior\n if (saleCount > 0) {\n average = amount / saleCount;\n this.sales.forEach((sale) => {\n if (sale.amount >= average) {\n upperBound++;\n } else {\n lowerBound++;\n }\n });\n\n //Se convierte en fracciones\n upperBound = upperBound / saleCount;\n lowerBound = lowerBound / saleCount;\n }\n\n //Se actualiza los parametros del objeto\n this.amount = amount;\n this.average = average;\n this.maxSale = max;\n this.minSale = min;\n this.upperBound = upperBound;\n this.lowerBound = lowerBound;\n }", "function readOBJ(path) {\n\tconsole.log(\"Reading OBJ file: \" + path);\n\tvar obj = new Mesh();\n\tvar req = new XMLHttpRequest();\n\treq.open('GET', path, false);\n\t\n\treq.send(null);\n\tobj.load(req.response);\n\tobj.computeNormals();\n\tconsole.log(\"OBJ file successfully loaded (nbV: \" + obj.nbV() + \", nbF: \" + obj.nbF() + \")\");\n\t\n\treturn obj;\n}", "function dibujarFresado111(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\t\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4, pliegueInf5]\n\t\n\t//sacar el mayor pliegue\n\tpliegueInferior=pliegueInf1\n\tfor (var n=0 ; n<5 ; n=n+1){\n\t\tif (pliegueInferior<plieguesInf[n]){\n\t\t\tpliegueInferior=plieguesInf[n]\n }\n }\n\t\n\t\n\t\n\t//Puntos trayectoria \n\n\t\n\tvar fresado11 = new RVector(pos.x+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior)\n\tvar fresado15 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior) //nuevo\n\t\n\t\n\t\n\tvar fresado16 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior) \n\tvar fresado17 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado22 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca) //muevo\n\t\n\tvar fresado23 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\t\n\t\n\t\n\tif (anchura5>pliegueInf5){\n\t\tvar fresado14b = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior-pliegueInf5-alaInferior)\n var line = new RLineEntity(document, new RLineData( fresado14b , fresado23 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }else{\n var line = new RLineEntity(document, new RLineData( fresado15 , fresado23 ));\n\t op_fresado.addObject(line,false);\n }\n\t\n\tvar line = new RLineEntity(document, new RLineData( fresado16 , fresado15 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado15 , fresado22 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado14 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado13 , fresado20 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado12 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado18 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado22 ));\n\top_fresado.addObject(line,false);\n\t\n\t\n\t\n\t\n\t\n\t//anchura1 - Inferior\n\tif (anchura1>pliegueInf1){\n\t\t//var fresado10 = new RVector(pos.x,pos.y+pliegueInferior+alaInferior) \n\t\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t//var fresado2 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado3 = new RVector(pos.x+anchura1-pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t\n\t\t//dibujarFresado_auxiliar(doc,fresado10,fresado1)\n var line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t//dibujarFresado_auxiliar(doc,fresado2,fresado11)\n } \n\t\n\t//anchura2 - Inferior\n\tif (anchura2>(pliegueInf2*2)){\n\t\tvar fresado4 = new RVector(pos.x+anchura1+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado5 = new RVector(pos.x+anchura1+anchura2-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n var line = new RLineEntity(document, new RLineData( fresado4 , fresado5 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }\n\t\n\t//anchura3 - Inferior\n\tif (anchura3>(pliegueInf3*2)){\n\t\tvar fresado6 = new RVector(pos.x+anchura1+anchura2+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado7 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n var line = new RLineEntity(document, new RLineData( fresado6 , fresado7 ));\n\t op_fresado.addObject(line,false);\n } \n\t\n\t//anchura4 - Inferior\n\tif (anchura4>(pliegueInf4*2)){\n\t\tvar fresado8 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado9 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n var line = new RLineEntity(document, new RLineData( fresado8 , fresado9 ));\n\t op_fresado.addObject(line,false);\n\t\t\n } \n\t\n\t//anchura4 - Inferior\n\tif (anchura5>pliegueInf5){\n\t\tvar fresado10 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueInf5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n\t\tvar fresado11 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n var line = new RLineEntity(document, new RLineData( fresado10 , fresado11 ));\n\t op_fresado.addObject(line,false);\n\t\t\n } \n\t\n\t\n\t\n\n\t\n\t\n\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)){\n\t\tvar fresado25 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x+anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado27 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t op_fresado.addObject(line,false);\n }\n }\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)){\n\t\tvar fresado31 = new RVector(pos.x+anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado29 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado33 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n }\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado37 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado35 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado39 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n }\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior*2){\n\t\tvar fresado43 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado41 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado45 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado46 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado45 , fresado46 ));\n\t op_fresado.addObject(line,false);\n }\n }\n\t\n\t//anchura5 - Superior\n\tif (anchura5>pliegueSuperior){\n\t\tvar fresado49 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado50 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado49 , fresado50 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado47 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado48 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado47 , fresado48 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n }\n\t\n\t\n\treturn op_fresado;\n}", "function valorTotalDesconto(descontoreal) {\n\t\tvar valorTotal = 0,\n\t\tvalor;\n\t\t\n\t\t$('.grid tbody tr').each(function(i){\n\t\t\tvalor = $(this).find('.itemTotal').text();\n\t\t\tvalor = valor.replace('R$ ', '').replace('.', '').replace(',', '.');\n\t\t\tvalorTotal += parseFloat(valor);\n\t\t});\n\t\t$('.valorTotal').text('R$ '+ number_format(valorTotal - descontoreal, 2, ',', '.'));\n\t}", "function promedio (json) {\r\n\tvar promedio = 0;\r\n\testudiantes.forEach(function (obj){\r\n\t\tpromedio += parseFloat(obj.nota);\r\n\t})\r\n\tpromedio = (promedio)/estudiantes.length;\r\n\tpromedio = \"El promedio de las notas obtenidas por los estudiantes del curso es: \" + promedio;\r\n\t\r\n\tdocument.getElementById('promedio').innerHTML = promedio;\r\n\talert(promedio);\r\n\r\n\tconsole.log(promedio);\r\n\r\n}", "function incrementer_niveau_fils(obj,niv){\n\n for(key in obj){\n obj[key].niveau=(niv+1);\n incrementer_niveau_fils(obj[key].fils);\n }\n \n}", "calculateNormals() {\r\n // MP2: Implement this function!\r\n\r\n // initialize an NArray containing M normals\r\n let normals = [];\r\n for(let i = 0; i < this.numVertices; i++) {\r\n normals.push([0, 0, 0]);\r\n }\r\n\r\n // iterate all triangles\r\n for(let i = 0; i < this.numFaces; i++) {\r\n let indices = this.getTriangleVertexByIndex(i);\r\n let vertices = this.createAndGetPosDataByIndex(indices);\r\n let N = this.computeNormalForTriangles(vertices[0], vertices[1], vertices[2]);\r\n // average vertex normals by scale with factor 0.5\r\n glMatrix.vec3.scale(N, N, 0.5);\r\n\r\n indices.forEach(function(index) {\r\n normals[index] = normals[index].map((a, i) => a + N[i]);\r\n });\r\n }\r\n\r\n // normalize each normal in N array to unit length\r\n for(let i = 0; i < this.numVertices; i++) {\r\n let tmp = glMatrix.vec3.fromValues(normals[i][0], normals[i][1], normals[i][2]);\r\n glMatrix.vec3.normalize(tmp, tmp);\r\n this.normalData.push(...tmp);\r\n }\r\n }", "function LoaderUtil() {\n\t\n\tthis.removeEmptyStrings = function(data) {\n\t\tvar result = [];\n\t\tfor(var i = 0; i < data.length; i++) {\n\t\t\tif(!data[i] == \"\") {\n\t\t\t\tresult.push(data[i]);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn result;\n\t}\n\t\n\tthis.generateNormalsCW = function(vertices, indices) {\n \tfor (var i = 0; i < indices.length; i += 3 ) {\n \t\tvar v0 = vertices[indices[i ]].getPos();\n \t var v1 = vertices[indices[i + 1]].getPos();\n \t var v2 = vertices[indices[i + 2]].getPos();\n \t \n \t var normal = v1.sub(v0).cross(v2.sub(v0)).normalize();\n \t \n \t vertices[indices[i\t ]].setNormal(vertices[indices[i ]].getNormal().push(normal));\n \t vertices[indices[i + 1]].setNormal(vertices[indices[i + 1]].getNormal().push(normal));\n \t vertices[indices[i + 2]].setNormal(vertices[indices[i + 2]].getNormal().push(normal));\n \t}\n \n \tfor (var i = 0; i < vertices.length; ++i ) {\t\n \t vertices[i].setNormal(vertices[i].getNormal().normalize());\n \t} \n\t}\n\t\n\tthis.generateNormalsCCW = function(vertices, indices)\t{\n\t for (var i = 0; i < indices.length; i += 3 ) {\n\t \tvar v0 = vertices[indices[i ]].getPos();\n\t \tvar v1 = vertices[indices[i + 1]].getPos();\n\t \tvar v2 = vertices[indices[i + 2]].getPos();\n\t \n\t \tvar normal = v2.sub(v0).cross(v1.sub(v0)).normalize();\n\t \n\t vertices[indices[i\t ]].setNormal(vertices[indices[i ]].getNormal().push(normal));\n\t vertices[indices[i + 1]].setNormal(vertices[indices[i + 1]].getNormal().push(normal));\n\t vertices[indices[i + 2]].setNormal(vertices[indices[i + 2]].getNormal().push(normal));\n\t }\n\n\t for (var i = 0; i < vertices.length; ++i ) {\t\n\t \tvertices[i].setNormal(vertices[i].getNormal().normalize());\n\t } \n\t}\n\t\n\tthis.peekLast = function() {\n\t\treturn this[this.length - 1];\n\t}\n}", "function _AtualizaModificadoresAtributos() {\n // busca a raca e seus modificadores.\n var modificadores_raca = tabelas_raca[gPersonagem.raca].atributos;\n\n // Busca cada elemento das estatisticas e atualiza modificadores.\n var atributos = [\n 'forca', 'destreza', 'constituicao', 'inteligencia', 'sabedoria', 'carisma' ];\n for (var i = 0; i < atributos.length; ++i) {\n var atributo = atributos[i];\n // Valor do bonus sem base.\n var dom_bonus = Dom(atributo + '-mod-bonus');\n ImprimeSinalizado(gPersonagem.atributos[atributo].bonus.Total(['base']), dom_bonus, false);\n Titulo(gPersonagem.atributos[atributo].bonus.Exporta(['base']), dom_bonus);\n\n // Escreve o valor total.\n var dom_valor = Dom(atributo + '-valor-total');\n ImprimeNaoSinalizado(gPersonagem.atributos[atributo].bonus.Total(), dom_valor);\n Titulo(gPersonagem.atributos[atributo].bonus.Exporta(), dom_valor);\n\n // Escreve o modificador.\n ImprimeSinalizado(\n gPersonagem.atributos[atributo].modificador,\n DomsPorClasse(atributo + '-mod-total'));\n }\n}", "function FILTRO_agentes_involucrados(cdr_filtrado){\n\n let resultado = '';\n\n // inicio\n\n let dataAgentes;\n let result;\n\n dataAgentes = cdr_filtrado\n .map(function(x) {\n result=[];\n\n result.push({\n id_inv_agentes: x.id_inv_agentes,\n numero_agentes: x.numero_agentes,\n nombre_reportes_agentes: x.nombre_reportes_agentes,\n titulo: 'Agentes: '\n });\n result = result[0];\n return result;\n })\n .filter(function(x){\n return x.nombre_reportes_agentes !== '' ? true: false;\n });\n\n resultado = _.uniqBy(dataAgentes, 'id_inv_agentes');\n\n\n\treturn resultado;\n}", "function normalizar (anotacionesGrupo, nota) {\n //Se obtienen las primeras anotaciones del grupo que fueron generados automaticamente\n var criteriosDeRubrica = _.filter(anotacionesGrupo, function(value, key) {return filtradoTags2(value.tags);})\n\n //Se agrupan por pregunta y se obtiene el valor maximo de cada una\n var puntuacionMaximaEjercicios = _(criteriosDeRubrica ).groupBy((d)=>d.tags[1]).map((puntuaciones, pregunta) => ({\n 'pregunta': pregunta,\n 'puntuacionMayor': parseInt(_.maxBy(puntuaciones, function(o) { return parseInt(o.tags[0].slice(10)) }).tags[0].slice(10))\n })).value();\n\n //Suma las puntuaciones maximas\n var valorExamen=_.sumBy(puntuacionMaximaEjercicios, 'puntuacionMayor');\n\n return (nota*10)/valorExamen;\n}", "function dibujarFresado139(modelo,di,pos,document){\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\t\n\t//Puntos fresado\n\tvar fresado1 = new RVector(pos.x,pos.y)\n\tvar fresado2 = new RVector(pos.x,pos.y+pliegueInferior)\n\tvar fresado3 = new RVector(pos.x-anchura3,pos.y+pliegueInferior)\n\tvar fresado4 = new RVector(pos.x-anchura3-anchura2,pos.y+pliegueInferior)\n\tvar fresado5 = new RVector(pos.x-anchura3-anchura2-anchura1,pos.y+pliegueInferior)\n\tvar fresado6 = new RVector(pos.x-anchura3-anchura2-anchura1,pos.y+pliegueInferior+alturaPlaca)\n\tvar fresado7 = new RVector(pos.x-anchura3-anchura2,pos.y+pliegueInferior+alturaPlaca)\n\tvar fresado8 = new RVector(pos.x-anchura3,pos.y+pliegueInferior+alturaPlaca)\n\tvar fresado9 = new RVector(pos.x,pos.y+pliegueInferior+alturaPlaca)\n\tvar fresado10 = new RVector(pos.x,pos.y+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado10 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado7 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado5 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\treturn op_fresado;\n}", "function createModelsWithObj(modelDescription, materialsDictionary, out) {\n\n //return value is an object\n //property name comes forom the model's name.\n\n var modelDictionary = {};\n var numberModels = 0;\n\n //All array indexes are empty because OBJ indexes start at 1\n //Arrays of values are usually common throughout all files\n\n var allVertices = [[]];\n var allColors = null;\n var allNormals = [[]];\n var avrNormals = null;\n var allTextureCoords = [[]];\n \n //instance\n //Model being defined, Objs can define more then one model\n var currentModel = null;\n\n //If state is active\n var smoothShading = false;\n var materialName = null;\n var colorIndex = 0;\n\n //Collecting data for scratch var\n var startLineIndexes = new Array(3);\n var endLineIndexes = new Array(3);\n var vector = new loadingObj_vector3();\n var vertexIndexes = new Array(3);\n\n //Lines segments --- allowing normal vectors to be created\n var create_visible_normals = false;\n\n function colorsFromMaterials() {\n var material, name, number_colors, index;\n if (Object.keys(materialsDictionary).length > 0) {\n number_colors = Object.keys(materialsDictionary).length;\n all_colors = new Array(number_colors);\n for (name in materialsDictionary) {\n material = materialsDictionary[name];\n if (material.hasOwnProperty('Kd')) {\n index = material.index;\n all_colors[index] = material.Kd;\n }\n }\n\n }\n }\n\n function parsingPoints(sp) {\n var index;\n\n if (currentModel.points === null) {\n currentModel.points = new PointsData();\n currentModel.points.material = materialsDictionary[materialName];\n }\n\n //Aquires the indexes of the vertices that define the point(s)\n index = sp.getWord();\n while (index) {\n //Add a point to model def\n currentModel.points.vertices.push(index);\n currentModel.points.colors.push(colorIndex);\n \n index = sp.getWord();\n }\n }\n \n function parsingLines(sp) {\n if (currentModel.lines === null) {\n currentModel.lines = new LinesData();\n currentModel.lines.material = materialsDictionary[materialName];\n }\n\n // Get indexes of vertices that define point/points\n sp.getIndexes(startLineIndexes);\n while (sp.getIndexes(endLineIndexes)) {\n // Adds a line to the model def\n currentModel.lines.vertices.push(startLineIndexes[0]);\n currentModel.lines.vertices.push(endLineIndexes[0]);\n currentModel.lines.colors.push(colorIndex);\n currentModel.lines.colors.push(colorIndex);\n if (startLineIndexes[1] !== null && startLineIndexes[1] >= 0) {\n currentModel.lines.texture.push(startLineIndexes[1]);\n currentModel.lines.texture.push(endLineIndexes);\n }\n\n startLineIndexes[0] = endLineIndexes[0];\n startLineIndexes[1] = endLineIndexes[1];\n }\n }\n\n function parsingFaces(sp) {\n var indexList, numberTriangles, triangles, n, edge1, edge2, normal, normalIndex;\n\n if(currentModel.triangles === null) {\n currentModel.triangles = new TrianglesData();\n currentModel.triangles.material = materialsDictionary[materialName];\n }\n\n triangles = currentModel.triangles;\n\n //indexes of vertices that define the face\n indexList = [];\n while (sp.getIndexes(vertexIndexes)) {\n indexList.push(vertexIndexes.slice());\n }\n\n //Creates triangles for faces\n numberTriangles = indexList.length - 2;\n n = 1;\n while (n <= numberTriangles) {\n triangles.vertices.push(indexList[0][0]);\n triangles.vertices.push(indexList[n][0]);\n triangles.vertices.push(indexList[n + 1]);\n\n triangles.colors.push(colorIndex);\n triangels.color.push(colorIndex);\n triangles.colors.push(colorIndex);\n\n if (indexList[0][1] > -1) {\n triangles.textures.push(indexList[0][1]);\n triangles.textures.push(indexList[n][1]);\n triangles.textures.push(indexList[n + 1][1]);\n }\n\n\n // The normal vectors are set:\n // If normal vectors are included in the OBJ file: use the file data\n // If normal vectors not in OBJ data:\n // the flat_normal is set to the calculated face normal.\n // the smooth_normals is set to an average normal if smoothing is on.\n\n if(indexList[0][2] === -1) {\n\n // There was no normal vector in the OBJ file; calculate a normal vector\n // using a counter-clockwise vertex winding.\n // Only calculate one normal for faces with more than 3 vertices\n \n if (n === 1) {\n edge1 = vector.createFrom2Points(allVertices[indexList[0][0]], allVertices[indexList[n][0]]);\n edge2 = vector.createFrom2Points(allVertices[indexList[n][0]], allVertices[indexList[n + 1][0]]);\n normal = new Float32Array(3);\n vector.crossProduct(normal, edge1, edge2);\n vector.normalize(normal);\n\n allNormals.push(normal);\n normalIndex = allNormals.length -1;\n }\n\n triangles.flat_normal.push(normalIndex);\n triangles.flat_normal.push(normalIndex);\n triangles.flat_normal.push(normalIndex);\n\n if (smoothShading) {\n //indexes point to vertex so average normal vector can be accessed at another point\n triangles.smooth.normals.push(-indexList[0][0]);\n triangles.smooth.normals.push(-indexList[n][0]);\n triangles.smooth.normals.push(-indexList[n + 1][0]);\n } else {\n triangles.smooth.normals.push(normalIndex);\n triangles.smooth.normals.push(normalIndex);\n triangles.smooth.normals.push(normalIndex);\n }\n\n } else {\n // Use normal vector from the obj file\n triangles.flat_normal.push(indexList[0][2]);\n triangles.flat_normal.push(indexList[n][2]);\n triangles.flat_normal.push(indexList[n + 1][2]);\n\n triangles.smooth_normal.push(indexList[0][2]);\n triangles.smooth_normal.push(indexList[n][2]);\n triangles.smooth_normal.push(indexList[n + 1][2]);\n }\n n += 1 //for more then one triangle\n }\n }\n\n function ParsingObjLines() {\n var sp, lines, whichLine, command, modelName, currentModelFile, vertices, x, y, z, dotPosition, dx, dy, dz, u, v, coords, normal;\n\n //Creating StringParser\n sp = new StringParser();\n\n //breaks up the input into different lines of text\n lines = modelDescription.split('\\n');\n\n //vertices are broken into sections, this is for each model, face indexes for vertices are global for the vertex list. TODO Keep a single list of vertices for all models.\n vertices = [];\n\n //OBJ vertices are indexed starting at the number one, remember that it is not 0\n verticess.push([]); //empty vertex for [0]\n\n for (whichLine = 0; whichLine < lines.length; whichLine += 1) {\n sp.init(lines[whichLine]);\n command = sp.getWord();\n\n if (command) {\n switch (command) {\n case '#':\n break; \n\n case 'mtllib': //save material data filename for later\n currentMaterialFiles = sp.getWord();\n //Removing the filename extention\n dotPosition = currentMaterialFiles.lastIndexOf('.');\n if (dotPosition > 0) {\n currentMaterialFiles = currentMaterialFiles.substr(0, dotPosition);\n }\n break;\n }\n }\n }\n }\n}", "asistencia(equipo) {\n let asistencia_total =[];\n\n for (var i = 0, len = equipo.length; i < len; ++i) {\n var total =+ equipo[i].asistencia.lunes + equipo[i].asistencia.martes + equipo[i].asistencia.miercoles + equipo[i].asistencia.jueves + equipo[i].asistencia.viernes + equipo[i].asistencia.sabado;\n asistencia_total.push(total);\n }\n \n return asistencia_total;\n }", "function dibujarFresado103(modelo,di,pos,document){\n\t\n\t\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\t////////////////////////// Modelo F3 //////////////////////-\t\n\tvar alturas=[altura1,altura2,altura3,altura4,altura5,altura6,altura7,altura8,altura9,altura10]\n\t\n\tvar nPestanas=numeroPestanas003(alturas)\n\t\n\t\n\tvar fresado1\n\tvar fresado2\n\tvar fresado3\n\tvar fresado4\n\tvar fresado5\n\tvar fresado6\n\tvar fresado7\n\tvar fresado8\n\tvar fresado9\n\tvar fresado10\n\tvar fresado11\n\tvar fresado12\n\tvar fresado13\n\tvar fresado14\n\tvar fresado15\n\tvar fresado16\n\tvar fresado17\n\tvar fresado18\n\tvar fresado19\n\tvar fresado20\n\tvar fresado21\n\tvar fresado22\n\t\n\tvar x\n\tvar y\n\t\n\t//Puntos trayectoria\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y\n\tif (dibujoHorizontal==1) { //Dibujo horizontal\n\t\tfresado1 = new RVector(y,x)\n\t}else{ //dibujo vertical\n\t\tfresado1 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1\n\tif (dibujoHorizontal==1) {\n\t\tfresado2 = new RVector(y,x)\n\t}else{\n\t\tfresado2 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2\n\tif (dibujoHorizontal==1) {\n\t\tfresado3 = new RVector(y,x)\n\t}else{\n\t\tfresado3 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3\n\tif (dibujoHorizontal==1) {\n\t\tfresado4 = new RVector(y,x)\n\t}else{\n\t\tfresado4 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4\n\tif (dibujoHorizontal==1) {\n\t\tfresado5 = new RVector(y,x)\n\t}else{\n\t\tfresado5 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5\n\tif (dibujoHorizontal==1) {\n\t\tfresado6 = new RVector(y,x)\n\t}else{\n\t\tfresado6 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6\n\tif (dibujoHorizontal==1) {\n\t\tfresado7 = new RVector(y,x)\n\t}else{\n\t\tfresado7 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7\n\tif (dibujoHorizontal==1) {\n\t\tfresado8 = new RVector(y,x)\n\t}else{\n\t\tfresado8 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7+altura8\n\tif (dibujoHorizontal==1) {\n\t\tfresado9 = new RVector(y,x)\n\t}else{\n\t\tfresado9 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7+altura8+altura9\n\tif (dibujoHorizontal==1) {\n\t\tfresado10 = new RVector(y,x)\n\t}else{\n\t\tfresado10 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7+altura8+altura9+altura10\n\tif (dibujoHorizontal==1) {\n\t\tfresado11 = new RVector(y,x)\n\t}else{\n\t\tfresado11 = new RVector(x,y)\n\t}\n\t\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y\n\tif (dibujoHorizontal==1) {\n\t\tfresado12 = new RVector(y,x)\n\t}else{\n\t\tfresado12 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1\n\tif (dibujoHorizontal==1) {\n\t\tfresado13 = new RVector(y,x)\n\t}else{\n\t\tfresado13 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2\n\tif (dibujoHorizontal==1) {\n\t\tfresado14 = new RVector(y,x)\n\t}else{\n\t\tfresado14 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3\n\tif (dibujoHorizontal==1) {\n\t\tfresado15 = new RVector(y,x)\n\t}else{\n\t\tfresado15 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4\n\tif (dibujoHorizontal==1) {\n\t\tfresado16 = new RVector(y,x)\n\t}else{\n\t\tfresado16 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5\n\tif (dibujoHorizontal==1) {\n\t\tfresado17 = new RVector(y,x)\n\t}else{\n\t\tfresado17 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6\n\tif (dibujoHorizontal==1) {\n\t\tfresado18 = new RVector(y,x)\n\t}else{\n\t\tfresado18 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7\n\tif (dibujoHorizontal==1) {\n\t\tfresado19 = new RVector(y,x)\n\t}else{\n\t\tfresado19 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7+altura8\n\tif (dibujoHorizontal==1) {\n\t\tfresado20 = new RVector(y,x)\n\t}else{\n\t\tfresado20 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7+altura8+altura9\n\tif (dibujoHorizontal==1) {\n\t\tfresado21 = new RVector(y,x)\n\t}else{\n\t\tfresado21 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7+altura8+altura9+altura10\n\tif (dibujoHorizontal==1) {\n\t\tfresado22 = new RVector(y,x)\n\t}else{\n\t\tfresado22 = new RVector(x,y)\n\t}\n\t\n\t\n\t\n\t\n\t\n\t\n\tvar fresadoIzq=[fresado12,fresado13,fresado14,fresado15,fresado16,fresado17,fresado18,fresado19,fresado20,fresado21,fresado22] //Se ponen los puntos en un vector para poder usarlos en un bucle for\n\tvar fresadoDer=[fresado1,fresado2,fresado3,fresado4,fresado5,fresado6,fresado7,fresado8,fresado9,fresado10,fresado11] //Se ponen los puntos en un vector para poder usarlos en un bucle for\n\t\n\t\n\t//Dibujar lineas horizontales\n\tif (nPestanas==2) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t} else if ( nPestanas==3) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t} else if ( nPestanas==4) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t} else if ( nPestanas==5) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t} else if ( nPestanas==6) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado17 ));\n\t\top_fresado.addObject(line,false);\n\t} else if ( nPestanas==7) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado17 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t} else if ( nPestanas==8) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado17 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado19 ));\n\t\top_fresado.addObject(line,false);\n\t} else if (nPestanas==9) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado17 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado19 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado20 ));\n\t\top_fresado.addObject(line,false);\n\t} else if (nPestanas==10) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado17 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado19 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado20 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado21 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t\n\t//dibujar lineas verticales\n\tvar pliegueIzq=[pliegueIzq1,pliegueIzq2,pliegueIzq3,pliegueIzq4,pliegueIzq5,pliegueIzq6,pliegueIzq7,pliegueIzq8,pliegueIzq9,pliegueIzq10]\n\tvar pliegueDer=[pliegueDer1,pliegueDer2,pliegueDer3,pliegueDer4,pliegueDer5,pliegueDer6,pliegueDer7,pliegueDer8,pliegueDer9,pliegueDer10]\n\t\n\tfor (var n=0 ; n<nPestanas ; n=n+1){\n\t\tif (pliegueDer[n]==1) {\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresadoDer[n] , fresadoDer[n+1] ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t\tif (pliegueIzq[n]==1) {\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresadoIzq[n] , fresadoIzq[n+1] ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\treturn op_fresado;\n}", "function dibujarFresado118(modelo,di,pos,document){\n\t\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4, pliegueInf5]\n\tEAction.handleUserMessage(\"ha entrado 11111111111111111 \");\n\t//sacar el mayor pliegue\n\tpliegueInferior=pliegueInf1\n\tfor (n=0;n<5;n=n+1){ \n\t\tif (pliegueInferior<plieguesInf[n]){\n\t\t\tpliegueInferior=plieguesInf[n]\n\t\t}\n\t}\n\t\n\t\n\t\n\t//Puntos trayectoria \n\t\n\t\n\tvar fresado11 = new RVector(pos.x-anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x-anchura1-anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x-anchura1-anchura2-anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4,pos.y+alaInferior+pliegueInferior)\n\tvar fresado15 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior) //nuevo\n\t\n\t\n\t\n\tvar fresado16 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior) \n\tvar fresado17 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x-anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x-anchura1-anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x-anchura1-anchura2-anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado22 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca) //muevo\n\t\n\tvar fresado23 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\t\n\t\n\t\n\tif (anchura5>pliegueInf5){ \n\t\tvar fresado14b = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior-pliegueInf5-alaInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado14b , fresado23 ));\n\t\top_fresado.addObject(line,false);\n\n\t}else{\n\t\tvar line = new RLineEntity(document, new RLineData( fresado15 , fresado23 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado16 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado15 , fresado22 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado13 , fresado20 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado12 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado22 ));\n\t\top_fresado.addObject(line,false);\n\n\t\n\t\n\t\n\tEAction.handleUserMessage(\"ha entrado 44444444444444444444444444 \");\n\t\n\t\n\t//anchura1 - Inferior\n\tif (anchura1>pliegueInf1){\n\t\t//var fresado10 = new RVector(pos.x,pos.y+pliegueInferior+alaInferior) \n\t\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t//var fresado2 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado3 = new RVector(pos.x-anchura1+pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t\n\t\t//dibujarFresado_auxiliar(doc,fresado10,fresado1)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t//dibujarFresado_auxiliar(doc,fresado2,fresado11)\n\t}\n\t\n\t//anchura2 - Inferior\n\tif (anchura2>(pliegueInf2*2)){ \n\t\tvar fresado4 = new RVector(pos.x-anchura1-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado5 = new RVector(pos.x-anchura1-anchura2+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado5 ));\n\t\top_fresado.addObject(line,false);\n\n\t}\n\t\n\t//anchura3 - Inferior\n\tif (anchura3>(pliegueInf3*2)){ \n\t\tvar fresado6 = new RVector(pos.x-anchura1-anchura2-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado7 = new RVector(pos.x-anchura1-anchura2-anchura3+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado7 ));\n\t\top_fresado.addObject(line,false);\n\t} \n\t\n\t//anchura4 - Inferior\n\tif (anchura4>(pliegueInf4*2)){ \n\t\tvar fresado8 = new RVector(pos.x-anchura1-anchura2-anchura3-pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado9 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t} \n\n\t//anchura4 - Inferior\n\tif (anchura5>pliegueInf5){ \n\t\tvar fresado10 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-pliegueInf5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n\t\tvar fresado11 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado11 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t} \n\t\n\t\n\t\n\n\tEAction.handleUserMessage(\"ha entrado 555555555555555555555555555555555555555555555555 \");\n\t\n\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)){ \n\t\tvar fresado25 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x-anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado27 = new RVector(pos.x-anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x-anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)){ \n\t\tvar fresado31 = new RVector(pos.x-anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x-anchura1-anchura2+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado29 = new RVector(pos.x-anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x-anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado33 = new RVector(pos.x-anchura1-anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x-anchura1-anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado37 = new RVector(pos.x-anchura1-anchura2-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x-anchura1-anchura2-anchura3+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado35 = new RVector(pos.x-anchura1-anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x-anchura1-anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado39 = new RVector(pos.x-anchura1-anchura2-anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x-anchura1-anchura2-anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior*2){ \n\t\tvar fresado43 = new RVector(pos.x-anchura1-anchura2-anchura3-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado41 = new RVector(pos.x-anchura1-anchura2-anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x-anchura1-anchura2-anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado45 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado46 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado45 , fresado46 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura5 - Superior\n\tif (anchura5>pliegueSuperior){ \n\t\tvar fresado49 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado50 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado49 , fresado50 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado47 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado48 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado47 , fresado48 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\treturn op_fresado;\n\t\n\t\n\t\n\t\n\t\n}", "set importNormals(value) {}", "function Filtro() {\n \n obj = this; \n\n // Public methods \n this.consultar = consultar;\n// this.consultarDetalhe = consultarDetalhe;\n this.merge = merge;\n \n \n this.incluir = incluir; \n this.confirmar = confirmar; \n this.alterar = alterar; \n this.cancelar = cancelar; \n this.excluir = excluir; \n \n this.changeDataInicial = changeDataInicial;\n this.changeDataFinal = changeDataFinal;\n this.changeDataCorrente = changeDataCorrente;\n \n this.Modal = Modal; \n \n this.ORDER_BY = 'ID*1';\n this.INCLUINDO = false;\n this.ALTERANDO = false;\n this.DADOS = [];\n this.DADOS_RENDER = [];\n\n this.DADOS = [];\n this.DADOS_DETALHES = [];\n \n this.TOTAL_GERAL = 0;\n this.SELECTEDS = [];\n this.SELECTED = {};\n this.SELECTED_BACKUP = {};\n \n\t }", "function onReadOBJFile(fileString, so, gl, scale, reverse) {\n var objDoc = new OBJDoc(so.filePath); // Create a OBJDoc object\n objDoc.defaultColor = so.color;\n var result = objDoc.parse(fileString, scale, reverse); // Parse the file\n if (!result) {\n so.objDoc = null; so.drawingInfo = null;\n console.log(\"OBJ file parsing error.\");\n return;\n }\n so.objDoc = objDoc;\n}", "function dibujarFresado123(modelo,di,pos,document){\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior) \n\t\n\tvar fresado2 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior)\n\t\n\tvar fresado4 = new RVector(pos.x+alaIzquierda,pos.y) \n\t\n\t\n\t\n\t\n\t\n\tvar fresado6 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y) \n\t\n\t\n\t\n\t\n\tvar fresado9 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca)\n\tvar fresado10 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+alturaPlaca)\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+alturaPlaca)\n\t\n\tvar fresado12 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado2 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado12 ));\n\t\top_fresado.addObject(line,false);\n\t\n\n\n\t\n\n\t\n\t//anchura1\n\tif (anchura1>pliegueSuperior){ \n\t\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado18 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado19 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado20 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado20 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\n\t//anchura2\n\tif (anchura2>pliegueSuperior*2){ \t\t\n\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado22 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado21 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\n\n\treturn op_fresado; \n\n}", "function getInfoDeDocumento(datos, rostro) {\n console.log('====================datos para analizar=====');\n console.log(datos);\n console.log('=============================================');\n\n //regresa false si no es el documento, regresa la info analizada si es el documento en cuestion\n let stsIne = ine.getInfoFromIne(datos, rostro);\n let stsCfe = cfe.getInfoFromCfe(datos, rostro);\n let stsTelmex = telmex.getInfoFromTelmx(datos, rostro);\n let stsAxtel = axtel.getInfoFromAxt(datos, rostro);\n let stsPassMx = passMx.getInfoFromPasspMX(datos, rostro);\n let stsFormMigrtMx = formMigrtMx.getInfoFromFormMigMX(datos, rostro);\n let stsDni = dni.getInfoFromDni(datos, rostro);\n // let stsLicDeCondCmdx = licDeCondCdmxs.getInfoFromLicDeCondCdmx(datos, rostro);\n\n if (stsIne != false) return stsIne;\n if (stsCfe != false) return stsCfe;\n if (stsTelmex != false) return stsTelmex;\n if (stsAxtel != false) return stsAxtel;\n if (stsPassMx != false) return stsPassMx;\n if (stsFormMigrtMx != false) return stsFormMigrtMx;\n if (stsDni != false) return stsDni;\n // if (stsLicDeCondCmdx != false) return stsLicDeCondCmdx;\n\n return getInfoFromUnkn(datos); //si ningun documento es reconocido se envia vacio\n}", "function dibujarFresado102(modelo,di,pos,document){\n\t\n\t\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\t\n\t////////////////////////// Modelo F2 //////////////////////-\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4, pliegueInf5, pliegueInf6, pliegueInf7]\n\n\t//sacar el mayor pliegue\n\tvar pliegueInferior=pliegueInf1\n\tfor (var n=0; n<7;n=n+1){\n\t\tif (pliegueInferior<plieguesInf[n]){\n\t\t\tpliegueInferior=plieguesInf[n]\n\t\t}\n\t}\n\t\n\t\n\t\n\t//Puntos trayectoria \n\t\n\t\n\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior)\n\tvar fresado2 = new RVector(pos.x+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado3 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado4 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado5 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior)\n\tvar fresado6 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior)\n\tvar fresado7 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6,pos.y+alaInferior+pliegueInferior)\n\tvar fresado8 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+anchura7,pos.y+alaInferior+pliegueInferior)\n\tvar fresado9 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado10 = new RVector(pos.x+anchura1,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado11 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado15 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado16 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+anchura7,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\t\n\t\n\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado8 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado16 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado10 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado11 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado12 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado13 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado14 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado15 ));\n\top_fresado.addObject(line,false);\n\t\n\t\n\t\n\n\tcrearFresado=1 \n\t//anchura1 - Superior\n\tif (anchura1>pliegueSuperior){\n\t\tvar fresado17 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado18 = new RVector(pos.x+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado19 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado20 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado20 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura2 - Superior\n\tif (anchura2>pliegueSuperior*2){ \n\t\tvar fresado23 = new RVector(pos.x+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado24 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado22 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado21 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\tvar fresado25 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado26 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado29 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado30 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado28 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado27 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\tvar fresado31 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado32 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\t\top_fresado.addObject(line,false);\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior*2 ) {\n\t\tvar fresado35 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado36 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\tif ( crearFresado==1 ) {\n\t\t\tvar fresado34 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado33 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado34 , fresado33 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\tvar fresado37 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado38 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura5 - Superior\n\tif ( anchura5>pliegueSuperior*2 ) {\n\t\tvar fresado41 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado42 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\t\n\t\tif ( crearFresado==1 ) {\n\t\t\tvar fresado40 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado39 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado40 , fresado39 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\t\n\t\t\tvar fresado43 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado44 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t}\n\t}\n\t\n\t\n\t//anchura6 - Superior\n\tif ( anchura6>pliegueSuperior*2 ) {\n\t\tvar fresado47 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado48 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado47 , fresado48 ));\n\t\top_fresado.addObject(line,false);\n\n\t\t\n\t\tif ( crearFresado==1 ) {\n\t\t\tvar fresado46 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado45 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado46 , fresado45 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\t\n\t\t\tvar fresado49 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado50 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado49 , fresado50 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura7 - Superior\n\tif ( anchura7>pliegueSuperior ) {\n\t\tvar fresado53 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado54 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+anchura7,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado53 , fresado54 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif ( crearFresado==1 ) {\n\t\t\tvar fresado52 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado51 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado51 , fresado52 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t//anchura1 - Inferior\n\tif ( anchura1>(pliegueInf1) ) { \n\t\tvar fresado55 = new RVector(pos.x,pos.y+pliegueInferior+alaInferior-pliegueInf1)\n\t\tvar fresado56 = new RVector(pos.x+anchura1-pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado55 , fresado56 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t//anchura2 - Inferior\n\tif ( anchura2>(pliegueInf2)*2 ) { \n\t\tvar fresado55 = new RVector(pos.x+anchura1+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado56 = new RVector(pos.x+anchura1+anchura2-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado56 , fresado55 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t//anchura3 - Inferior\n\tif ( anchura3>(pliegueInf3)*2 ) { \n\t\tvar fresado55 = new RVector(pos.x+anchura1+anchura2+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado56 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado55 , fresado56 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t}\n\t\n\t//anchura4 - Inferior\n\tif ( anchura4>(pliegueInf4)*2 ) { \n\t\tvar fresado55 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado56 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado55 , fresado56 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t}\n\t\n\t//anchura5 - Inferior\n\tif ( anchura5>(pliegueInf5)*2 ) { \n\t\tvar fresado55 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueInf5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n\t\tvar fresado56 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5-pliegueInf5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado55 , fresado56 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t//anchura6 - Inferior\n\tif ( anchura6>(pliegueInf6)*2 ) { \n\t\tvar fresado55 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+pliegueInf6,pos.y+alaInferior+pliegueInferior-pliegueInf6)\n\t\tvar fresado56 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6-pliegueInf6,pos.y+alaInferior+pliegueInferior-pliegueInf6)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado55 , fresado56 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t//anchura7 - Inferior\n\tif ( anchura7>(pliegueInf7) ) { \n\t\tvar fresado55 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+pliegueInf7,pos.y+alaInferior+pliegueInferior-pliegueInf7)\n\t\tvar fresado56 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+anchura7,pos.y+alaInferior+pliegueInferior-pliegueInf7)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado55 , fresado56 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t\n\treturn op_fresado\n\t\n}", "function dibujarFresado114(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior) \n\tvar fresado2 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior)\n\tvar fresado4 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior)\n\tvar fresado5 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior)\n\t\n\t\n\t\n\t\n\t\n\tvar fresado6 = new RVector(pos.x+alaIzquierda,pos.y) //punto fresado abajo a la izquierda\n\t\n\t\n\t\n\t\n\tvar fresado9 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca)\n\tvar fresado10 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+alturaPlaca)\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+alturaPlaca)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+alturaPlaca)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca)\n\t\n\tvar fresado14 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado5 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado13 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado10 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado11 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado12 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado14 ));\n\top_fresado.addObject(line,false);\n\n\t\n\t\n\t\n\t\n\t//anchura1\n\tif (anchura1>pliegueSuperior){\n\t\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado18 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\n\t\tif (crearFresado==1){\n\t\t\tvar fresado19 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado20 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado20 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura2\n\tif (anchura2>pliegueSuperior*2){\n\t\t\n\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado22 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado21 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\tvar fresado25 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura3\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado29 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado30 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\top_fresado.addObject(line,false);\n\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\n\t\t\tvar fresado31 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado32 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\t\top_fresado.addObject(line,false);\n\n\t\t}\n\t}\n\t\n\t\n\t//anchura4\n\tif (anchura4>pliegueSuperior){\n\t\tvar fresado35 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado36 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado34 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado33 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\n\t\t}\n\t}\n\t\n\t\n\n\treturn op_fresado; \n\n}", "function OBJReader () {}", "calculateNormal(){\n this.normal = vec3.create();\n for (let i = 0; i < this.polygons.length; i++) {\n vec3.add(this.normal, this.normal, this.polygons[i].getNormal());\n }\n vec3.normalize(this.normal, this.normal)\n }", "function update(){\n var novoArray = [];\n\n carrinho.forEach(item=>{\n if(item.quant>0){\n novoArray.push(item);\n }\n })\n\n return carrinho = novoArray;\n}", "function dibujarFresado110(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4]\n\t\n\t//sacar el mayor pliegue\n\tpliegueInferior=pliegueInf1\n\tfor (var n=0; n<4 ;n=n+1){\n\t\tif (pliegueInferior<plieguesInf[n]){\n\t\t\tpliegueInferior=plieguesInf[n]\n }\n }\n\t\n\t\n\tvar fresado11 = new RVector(pos.x+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior)\n\t\n\t\n\t\n\tvar fresado16 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior) \n\tvar fresado17 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado22 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\tif (anchura4>pliegueInf4){\n\t\tvar fresado15 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior-pliegueInf4-alaInferior)\n var line = new RLineEntity(document, new RLineData( fresado15 , fresado22 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }else{\n var line = new RLineEntity(document, new RLineData( fresado14 , fresado22 ));\n\t op_fresado.addObject(line,false);\n\n }\n\t var line = new RLineEntity(document, new RLineData( fresado16 , fresado14 ));\n\t op_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado20 , fresado13 ));\n\t op_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado12 , fresado19 ));\n\t op_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado18 , fresado11 ));\n\t op_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado17 , fresado21 ));\n\t op_fresado.addObject(line,false);\n\t\n\t\n\t\n\t\n\t\n\t\n\t//anchura1 - Inferior\n\tif (anchura1>pliegueInf1){\n\t\t//var fresado10 = new RVector(pos.x,pos.y+pliegueInferior+alaInferior) \n\t\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t//var fresado2 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado3 = new RVector(pos.x+anchura1-pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t\n\t\t//dibujarFresado_auxiliar(doc,fresado10,fresado1)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t op_fresado.addObject(line,false);\n\t\t//dibujarFresado_auxiliar(doc,fresado2,fresado11)\n }\n\t\n\t//anchura2 - Inferior\n\tif (anchura2>(pliegueInf2*2)){\n\t\tvar fresado4 = new RVector(pos.x+anchura1+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado5 = new RVector(pos.x+anchura1+anchura2-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n var line = new RLineEntity(document, new RLineData( fresado4 , fresado5 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }\n\t\n\t//anchura3 - Inferior\n\tif (anchura3>(pliegueInf3*2)){\n\t\tvar fresado6 = new RVector(pos.x+anchura1+anchura2+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado7 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n var line = new RLineEntity(document, new RLineData( fresado6 , fresado7 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }\n\t\n\t//anchura4 - Inferior\n\tif (anchura4>pliegueInf4){\n\t\tvar fresado8 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado9 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n var line = new RLineEntity(document, new RLineData( fresado8 , fresado9 ));\n\t op_fresado.addObject(line,false);\n\t\t\n } \n\t\n\t\n\t\n\n\t\n\t\n\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)){\n\t\tvar fresado25 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x+anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado27 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }\n }\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)){\n\t\tvar fresado31 = new RVector(pos.x+anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado29 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado33 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n }\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado37 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado35 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado39 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n }\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior){ \n\t\tvar fresado43 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado41 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t op_fresado.addObject(line,false);\n }\n }\n\t\n\t\n\t\n\treturn op_fresado;\n}", "constructor(){\n this.hasSavedValues = false\n this.publicoAlvoSim= 0,\n this.publicoAlvoNao= 0,\n this.publicoAlvoALVA= 0,\n this.XER= 0,\n this.COP= 0,\n this.listaPrefixos= [],\n this.operacaoNaoVinculada= 0,\n this.operacaoVinculada= 0,\n this.operacaoVinculadaEmOutroNPJ= 0,\n this.acordoRegPortalSim= 0,\n this.acordoRegPortalNao= 0,\n //this.acordoRegPortalDuplicados= 0,\n this.totaisEstoque = 0,\n this.totaisFluxo = 0,\n this.estoqueNumber= 0,\n this.fluxoNumber= 0,\n this.duplicadoSimNao = 0,\n this.analisadoSimNao = 0\n }", "function dibujarFresado109(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4]\n\t\n\t//sacar el mayor pliegue\n\tpliegueInferior=pliegueInf1\n\tfor (var n=0; n<4 ;n=n+1){\n\t\tif (pliegueInferior<plieguesInf[n]){\n\t\t\tpliegueInferior=plieguesInf[n]\n\t\t}\n\t} \n\t\n\t\n\t//Puntos trayectoria \n \n\t\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado15 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior)\n\t\n\tvar fresado16 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+pliegueIzq)\n\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado22 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\n\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado15 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado22 , fresado17 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado16 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado18 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado12 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado13 , fresado20 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado14 ));\n\top_fresado.addObject(line,false);\n\n\t\n\t\n\t\n\t\n\t\n\t//anchura1 - Inferior\n\tif (anchura1>pliegueInf1){\n\t\tvar fresado10 = new RVector(pos.x+alaIzquierda,pos.y+pliegueInferior+alaInferior-pliegueIzq) \n\t\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado2 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado3 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado1 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado11 ));\n\t\top_fresado.addObject(line,false);\n\n\t} \n\t\n\t//anchura2 - Inferior\n\tif (anchura2>(pliegueInf2*2)){\n\t\tvar fresado4 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado5 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado5 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t//anchura3 - Inferior\n\tif (anchura3>(pliegueInf3*2)){\n\t\tvar fresado6 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado7 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado7 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t} \n\t\n\t//anchura4 - Inferior\n\tif (anchura4>pliegueInf4){\n\t\tvar fresado8 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado9 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t} \n\t\n\t\n\t\n\n\t\n\t\t\n\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)){\n\t\tvar fresado25 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)){\n\t\tvar fresado31 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado29 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado33 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2){ \n\t\tvar fresado37 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t\top_fresado.addObject(line,false);\n\t \n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado35 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado39 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior){\n\t\tvar fresado43 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado41 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t\n\treturn op_fresado;\n}", "complementoAnnyAtributte(objeto) {\n for (let a of objeto.hijos) {\n this.codigoTemporal += \"P =\" + a.posicion + \";\\n\";\n this.codigoTemporal += \"imprimirAtributoAny();\\n\";\n for (let b of a.atributos) {\n // salidaXPATH.getInstance().push(b.dameNombre()+\"=\"+b.dameValor());\n }\n this.complementoAnnyAtributte(a);\n }\n }", "function rimuovi(){\n\n\tvar j = 0;\n\n\t// Per ogni elemento controllo la condizione\n\t// Se è idoneo, copio elemento in J\n\n\tfor(var i = 0; i<persone.length; i++){\n\t\tif(persone[i].altezza > 1.5) {\n\t\t\tpersone[j++] = persone[i];\n\t\t}\n\t}\n\t// Aggiorno array con valori nuovi messi in J\n\tpersone.length = j;\n\n\t// Visualizzo\n\tvisualizzaPersone();\n}", "function completitud(oa, es){\n var titulo=0; var keyword=0; var descripcion=0; var autor=0;\n var tipoRE=0; var formato=0; var contexto=0; var idioma=0;\n var tipointer=0; var rangoedad=0; var nivelagregacion=0;\n var ubicacion=0; var costo=0; var estado=0; var copyright=0;\n\n // verifica que la variable tenga un valor y asigna el peso a las variables\n if (oa.title!=\"\") {\n titulo=0.15;\n }\n if (oa.keyword!=\"\") {\n keyword=0.14;\n }\n if (oa.description!=\"\") {\n descripcion=0.12;\n }\n if (oa.entity!=\"\") {\n autor=0.11;\n }\n if (oa.learningresourcetype!=\"\") {\n tipoRE=0.09;\n }\n if (oa.format!=\"\") {\n formato=0.08;\n }\n\n \n // hace la comprobacion cuantos contextos existe en el objeto\n var context=oa.context;\n // cuenta cuantas ubicaciones tiene el objeto\n var can=context.length;\n // asigna el nuevo peso que tendra cada contexto\n var pesocontexto=0.06/can;\n // comprueba que los contextos sean diferentes a vacio o a espacio \n for (var w=0; w <can ; w++) { \n if (context[w]!=\"\") {\n // calcula el nuevo peso para entregar para el calculo de la metrica\n contexto=contexto+pesocontexto;\n }\n }\n\n\n\n\n\n if (oa.language!=\"\") {\n idioma=0.05;\n }\n if (oa.interactivitytype!=\"\") {\n tipointer=0.04;\n }\n if (oa.typicalagerange!=\"\") {\n rangoedad=0.03;\n }\n if (oa.aggregationlevel!=\"\") {\n nivelagregacion=0.03;\n }\n // hace la comprobacion cuantas ubicaciones existe en el objeto\n var location=oa.location;\n // cuenta cuantas ubicaciones tiene el objeto\n var can=location.length;\n // asigna el nuevo peso que tendra cada ubicacion\n var peso=0.03/can;\n // comprueba que las ubicaciones sean diferentes a vacio o a espacio \n for (var i=0; i <can ; i++) { \n if (location[i]!=\"\") {\n // calcula el nuevo peso para entregar para el calculo de la metrica\n ubicacion=ubicacion+peso;\n }\n }\n \n\n if (oa.cost!=\"\") {\n costo=0.03;\n }\n if (oa.status!=\"\") {\n estado=0.02;\n }\n if (oa.copyrightandotherrestrictions!=\"\") {\n copyright=0.02;\n }\n\n \n \n // hace la sumatoria de los pesos \n var m_completitud=titulo + keyword + descripcion + autor + tipoRE + formato + contexto + idioma +\n tipointer + rangoedad + nivelagregacion + ubicacion + costo + estado + copyright;\n\n \n //alert(mensaje);\n return m_completitud;\n \n //echo \"* Completitud de: \".m_completitud.\"; \".evaluacion.\"<br>\";\n }", "function dibujarFresado137(modelo,di,pos,document){\n\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\n\t//Puntos fresado\n\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior)\n\tvar fresado2 = new RVector(pos.x+alaIzquierda+anchura1-pliegueInferior,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+alaIzquierda+anchura1+pliegueInferior,pos.y+alaInferior)\n\tvar fresado4 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueInferior,pos.y+alaInferior)\n\tvar fresado5 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueInferior,pos.y+alaInferior)\n\tvar fresado6 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueInferior,pos.y+alaInferior)\n\tvar fresado7 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueInferior,pos.y+alaInferior)\n\tvar fresado8 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior)\n\tvar fresado9 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior)\n\tvar fresado10 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado15 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado16 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado17 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado18 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\n\tvar fresado19\n\tif (anchura1>alaSuperior){ \n\t\tfresado19 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+alaSuperior)\n\t}else{ \n\t\tfresado19 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+anchura1)\n\t}\n\t\n\t\n\tvar fresado20\n\tif (anchura4>alaSuperior){\n\t\tfresado20 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+alaSuperior)\n\t}else{ \n\t\tfresado20 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+anchura4)\n\t}\n\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado2 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado4 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado6 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado14 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado19 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado12 , fresado17 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado20 ));\n\t\top_fresado.addObject(line,false);\n\t\n\n\t\n\t\n\t\n\t\n\t//anchura1\n\tif (anchura1>pliegueInferior){ \n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado2 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado21 = new RVector(pos.x+alaIzquierda+anchura1-pliegueInferior+margenFresado,pos.y)\n\t\t\tvar fresado22 = new RVector(pos.x+alaIzquierda+anchura1-pliegueInferior+margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\n\t//anchura2 \n\tif (anchura2>pliegueInferior*2){ \n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado4 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+anchura1+pliegueInferior-margenFresado,pos.y)\n\t\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+anchura1+pliegueInferior-margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado25 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueInferior+margenFresado,pos.y)\n\t\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueInferior+margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t\n\t//anchura3 \n\tif (anchura3>pliegueInferior*2){ \n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado6 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueInferior-margenFresado,pos.y)\n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueInferior-margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\t\n\t\t\tvar fresado29 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueInferior+margenFresado,pos.y)\n\t\t\tvar fresado30 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueInferior+margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\t\top_fresado.addObject(line,false);\n\n\t\t}\n\t}\n\t\n\t//anchura4 //inferior\n\tif (anchura4>pliegueInferior){ \n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado31 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueInferior-margenFresado,pos.y)\n\t\t\tvar fresado32 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueInferior-margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\t\top_fresado.addObject(line,false);\n\n\t\t}\n\t}\n\t\n\t\n\n\treturn op_fresado; \n\n}", "clearData(){\n this.publicoAlvoSim= 0,\n this.publicoAlvoNao= 0,\n this.publicoAlvoALVA= 0,\n this.XER= 0,\n this.COP= 0,\n this.listaPrefixos= [],\n this.operacaoNaoVinculada= 0,\n this.operacaoVinculada= 0,\n this.operacaoVinculadaEmOutroNPJ= 0,\n this.acordoRegPortalSim= 0,\n this.acordoRegPortalNao= 0,\n //this.acordoRegPortalDuplicados= 0,\n this.totaisEstoque = 0,\n this.totaisFluxo = 0,\n this.estoqueNumber= 0,\n this.fluxoNumber= 0,\n this.duplicadoSimNao = 0,\n this.analisadoSimNao = 0\n }", "function temp_ (OBJ){\n let kelvin = 273.15; \n let sum = 0; \n for(let i =0;i<OBJ.length;i++){\n sum = sum + (OBJ[i].main.temp - kelvin)\n //console.log(OBJ[i].main.temp - kelvin)\n }\n console.log(\"--> Average Temperature for the next 5 days:\", (sum/OBJ.length).toFixed(3), \" C\")\n return determineTemp(sum/OBJ.length)\n}", "function cumpleanosDos(persona){\n\n return {\n \n ...persona,\n edad: persona.edad + 1\n\n }\n\n /* Aqui lo que hacemos es retornar un nuevo objeto con los atributos de la\n persona y podremos cambiar los atributos y agregar atributos nuevos\n \n Esto arreglara el problema de que cuando se invoque la funcion tambien se\n cambie el objeto, con este ejemplo retornara un objeto nuevo con la \n edad modificada y si vemos el objeto este no tendra ningun cambio\n \n \n */\n}", "function dibujarFresado113(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\t//Puntos trayectoria\t\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1,pos.y+alaInferior)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2,pos.y+alaInferior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3,pos.y+alaInferior)\n\tvar fresado15 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior)\n\t\n\tvar fresado16 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior)\n\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1,pos.y+alaInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2,pos.y+alaInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3,pos.y+alaInferior+alturaPlaca)\n\tvar fresado22 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca)\n\t\n\tvar line = new RLineEntity(document, new RLineData( fresado16 , fresado15 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado22 , fresado17 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado16 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado18 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado12 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado13 , fresado20 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado14 ));\n\top_fresado.addObject(line,false);\n\t\n\t\n\t\n\t\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)) {\n\t\tvar fresado25 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\tif (crearFresado==1) { //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)) {\n\t\tvar fresado31 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) {\n\t\t\tvar fresado29 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\tvar fresado33 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2) {\n\t\tvar fresado37 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) {\n\t\t\tvar fresado35 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\tvar fresado39 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior) {\n\t\tvar fresado43 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) {\n\t\t\tvar fresado41 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\t\n\treturn op_fresado; \n}", "function FILTRO_agent_filtrado(agent, agentes_involucrados) {\n\n // console.log('AUDIT FILTRADO DEL FILTRO...', audit.length);\n\n let resultado = agent;\n\n if(agent && agentes_involucrados) {\n\n let agent_filtrado = agent\n .filter(function(x) {\n\n for(let i = 0; i < agentes_involucrados.length ; i++){\n return x.id_inv_agentes ===agentes_involucrados[i].id_inv_agentes ? true: false;\n }\n\n\n });\n resultado = agent_filtrado;\n }\n\n console.log( 'agent_Filtrado', agent.length, agentes_involucrados.length, resultado.length);\n\n return resultado;\n }" ]
[ "0.6029366", "0.58650607", "0.5625268", "0.5530662", "0.5504705", "0.54976696", "0.544303", "0.539328", "0.52866083", "0.5272395", "0.5261161", "0.5258063", "0.5251595", "0.52121985", "0.5151678", "0.5151678", "0.5132939", "0.51169664", "0.5101407", "0.5093301", "0.50835276", "0.507846", "0.50776213", "0.50728154", "0.504287", "0.50342983", "0.5019252", "0.50160277", "0.5015218", "0.49972922", "0.49925134", "0.49882528", "0.49881428", "0.4978563", "0.49695462", "0.49567252", "0.49542212", "0.4949696", "0.4939155", "0.49369234", "0.49311733", "0.4926765", "0.492328", "0.49203223", "0.49179733", "0.49109918", "0.48949873", "0.48830685", "0.4881258", "0.48753548", "0.4869365", "0.48608726", "0.48585212", "0.4853355", "0.48505133", "0.48499405", "0.48467186", "0.48463082", "0.48390538", "0.4838658", "0.48327017", "0.48265225", "0.4822051", "0.4817023", "0.4810495", "0.48059157", "0.4801213", "0.4798904", "0.4795617", "0.4794558", "0.4792265", "0.4788822", "0.4783139", "0.4772457", "0.47701097", "0.47692606", "0.47668642", "0.47648925", "0.4760192", "0.4759838", "0.47560614", "0.47503245", "0.475011", "0.47501048", "0.47496217", "0.47452623", "0.47436303", "0.47424915", "0.4742336", "0.4738144", "0.47353446", "0.4732909", "0.4730406", "0.47220486", "0.47214305", "0.4721001", "0.4720128", "0.47194916", "0.47189197", "0.4717619", "0.4717467" ]
0.0
-1
list service of shop
function showlistService() { $.ajax({ async : true, url : "http://localhost:8080/repairvehicle/admin/getservice", method : "GET", headers : { "accept" : "application/json;odata=verbose", "content-type" : "application/json;odata=verbose" }, success : function(data) { $('.listService input').prop('checked', false); var idservices = $('#idservices').val(); // console.log(JSON.parse(idservices)); $.each(data, function(k, v) { var html = '<li><input type="checkbox" value=' + v.id + ' />' + v.name + '</li>'; $('.listService').append(html); }); for (var i = 0; i < JSON.parse(idservices).length; i++) { var value = JSON.parse(idservices)[i]; // console.log(value); $('.listService input[value=' + value + ']').prop('checked', true); } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getServicesList() {\n\t\tcustApi.getServices().\n\t\tsuccess(function (data, status, header, config) {\n\t\t\tconsole.log(\"Services retrieved successfully\");\n\t\t\tvar serviceMap = buildServicesMap(data.payload);\n\t\t\tvm.model.physiotherapyId = serviceMap[\"physiotherapy\"];\n\t\t}).\n\t\terror(function (data, status, header, config) {\n\t\t\tconsole.log(\"Error in retrieving services\");\n\t\t});\n\t}", "function getServicesList() {\n\t\t\tcustApi.getServices().\n\t\t\tsuccess(function (data, status, header, config) {\n\t\t\t\tconsole.log(\"Services retrieved successfully\");\n\t\t\t\tvm.apptCost = data.payload[0].rate;\n\t\t\t\tvar serviceMap = buildServicesMap(data.payload);\n\t\t\t\tvm.physiotherapyId = serviceMap[\"physiotherapy\"];\n\t\t\t\tcustportalGetSetService.setPhysioId({\"physioId\": vm.physiotherapyId, \"apptCost\": vm.apptCost});\n\t\t\t}).\n\t\t\terror(function (data, status, header, config) {\n\t\t\t\tconsole.log(\"Error in retrieving services\");\n\t\t\t});\n\t\t}", "function listServices() {\n $(\".services\").append(\n services.map(service => \n $(\"<li>\").text(service.service_type))\n );\n }", "function ShoppingListService() {\n let service = this;\n\n const items = [];\n\n // ADD ITEMS\n service.addItem = (itemName, quantity) => {\n const item = {\n name: itemName,\n quantity: quantity\n };\n items.push(item);\n };\n\n // GET ITEMS\n service.getItems = () => items;\n\n // REMOVE ITEM\n service.removeItem = itemIndex => items.splice(itemIndex, 1);\n }", "function ShoppingListService() {\n var items = [];\n\n this.addItem = function(itemName, itemQuantity) {\n items.push({\n name: itemName,\n quantity: itemQuantity\n });\n }\n\n this.removeItem = function(index) {\n items.splice(index, 1);\n }\n\n this.getItems = function() {\n return items;\n }\n }", "function getShops(item){\n\t\t\n\t}", "ListAvailableServices() {\n let url = `/hosting/reseller`;\n return this.client.request('GET', url);\n }", "function ShoppingListService(maxItems) {\n var service = this;\n service.arr = [];\n // List of shopping items\n var items = [\n {\n name : \"Milk\",\n quantity : \"2 litres\"\n },\n {\n name : \"Toast\",\n quantity : \"1 packet\"\n },\n {\n name : \"Bread\",\n quantity : \"1 packet\"\n },\n {\n name : \"Fruits\",\n quantity : \"1 dozen\"\n },\n {\n name : \"Tea\",\n quantity : \"2 packets\"\n },\n {\n name : \"Cookie\",\n quantity : \"7 packets\"\n }\n ];\n\n service.addItem = function() {\n return service.arr;\n };\n\n service.getItems = function () {\n return items;\n };\n\n service.removeItem = function (itemIndex) {\n var i = items[itemIndex];\n items.splice(itemIndex, 1);\n service.arr.push(i);\n };\n}", "ListAvailableServices() {\n let url = `/hpcspot`;\n return this.client.request('GET', url);\n }", "function ShoppingService(){\n\nthis.list = [];\nvar list = this.list;\n\nthis.saveList = function(amount, name){\n\tvar item = {\n\t\tamount: amount,\n\t\tname: name\n\t};\n\n\tlist.push(item);\n};\n\nthis.remove = function(index){\n\tlist.splice(index, 1);\n}\n\n}", "function printServiceList(services) {\n let listForPrint = '';\n\n for (let i = 0; i < services.length; i++) {\n listForPrint = listForPrint + services[i].id + ' / ' + services[i].name + ' / ' + services[i].costs + '\\n';\n }\n\n alert(\"sorted services: \\n\" + listForPrint);\n }", "getServiceInfos(service) {\n return this.OvhHttp.get(\n `${service.path}/${window.encodeURIComponent(\n service.serviceName,\n )}/serviceInfos`,\n {\n rootPath: 'apiv6',\n },\n ).then(\n (serviceInfos) =>\n new BillingService({\n ...service,\n ...serviceInfos,\n }),\n );\n }", "function ShoppingListService(maxItems) {\n var service = this;\n\n // List of shopping items\n var items = [];\n\n // Servie method for adding item\n service.addItem = function (itemName, quantity) {\n console.log('inside additem');\n if ((maxItems === undefined) || (maxItems !== undefined) && (items.length < maxItems)) {\n var item = {\n name: itemName,\n quantity: quantity\n };\n items.push(item);\n }else{\n throw new Error(\"Max Items (\" + maxItems +\") reached.\");\n }\n };\n\n // Servie method to remove items from list\n service.removeItem = function (itemIndex) {\n console.log('inside removeitem: ', itemIndex);\n items.splice(itemIndex, 1);\n }\n\n // Servie method to get items\n service.getItems = function () {\n console.log('inside getitems: ', items);\n return items;\n };\n }", "ListAvailableServices() {\n let url = `/saas/csp2`;\n return this.client.request('GET', url);\n }", "ListAvailableServices() {\n let url = `/pack/xdsl`;\n return this.client.request('GET', url);\n }", "async getAllServices() {\n debug('get Dot4 service IDs from dot4SaKpiRepository');\n this.allServices = await this.request({\n method: 'get',\n url: '/api/service',\n });\n debug(`loaded ${this.allServices.length} services`);\n }", "function ShoppingListCheckOffService() {\n var service = this;\n // Default buy and bought object arrays\n var buyItems = [\n {name: \"Bread Sticks\", quantity: 4, type: \"pack\", pricePerItem: 1.54},\n {name: \"Brownies\", quantity: 3, type: \"carton\", pricePerItem: 2.85},\n {name: \"Butter\", quantity: 8, type: \"stick\", pricePerItem: .79},\n {name: \"Chicken Breast\", quantity: 1.5, type: \"lb\", pricePerItem: 4.26},\n {name: \"Chips\", quantity: 1, type: \"bag\", pricePerItem: 2.50},\n {name: \"Coca-Cola\", quantity: 6, type: \"can\", pricePerItem: .89},\n {name: \"Garlic\", quantity: 2, type: \"clove\", pricePerItem: .50},\n {name: \"Marinara Sauce\", quantity: 2, type: \"jar\", pricePerItem: 2.99},\n {name: \"Milk\", quantity: 1, type: \"gallon\", pricePerItem: 3.50},\n {name: \"Ziti Noodles\", quantity: 3, type: \"carton\", pricePerItem: .99}\n ];\n var boughtItems = [];\n\n service.buyItem = function(index) {\n // Add current item to bought list\n console.log(buyItems[index]);\n boughtItems.push(buyItems[index]);\n\n // Remove current item from buy list\n buyItems.splice(index, 1)\n }\n // Returns Buy Items List\n service.getBuyItems = function() {\n return buyItems;\n }\n // Returns Bought Items List\n service.getBoughtItems = function() {\n return boughtItems;\n }\n }", "static get service() {\n return 'carts';\n }", "function getServices(){\n self.services = servicesService.getServices();\n $log.debug(self.services);\n }", "function findServicedAll() {\n findServiced(spec1);\n findServiced(spec2);\n findServiced(spec3);\n\n localStorage.setItem('list', JSON.stringify(list));\n getList();\n}", "function findServicedAll() {\n findServiced(spec1);\n findServiced(spec2);\n findServiced(spec3);\n\n localStorage.setItem('list', JSON.stringify(list));\n getList();\n}", "function getAllServiceName() {\n var services = Array();\n\n $.ajax({\n url: OVEconfig.BASEURL + '/practitioner/getspservices/',\n type: 'POST',\n async: false,\n data: {all: true, sp_id: $('input#sp_id').val()},\n dataType: 'json',\n success: function(data) {\n services = data.services_list;\n },\n error: function(xhr, errorType, errorMsg) {\n console.log(errorMsg)\n }\n });\n\n var servicename = 'No Services';\n\n if (services != null && services.length > 0) {\n var servicename = '';\n for (var i = 0; i < services.length; i++)\n {\n servicename += (services[i].name) ? ((i < services.length - 1) ? (services[i].name + \",\") : services[i].name) : (servicename);\n }\n }\n $('#servicename').html(servicename);\n}", "function listServices(category){\n const listOptions = {\n method:'GET',\n\n };\n fetch(`https://thefoth.herokuapp.com/api/v1/services/category?category=${category}`, listOptions)\n .then((res) => res.json())\n .then((datas) => {\n let layout = '';\n datas.services.forEach(data => {\n const row = `<div class=\"col-md-3\">\n <a id=\"${data.id}\" class=\"service-click\" onclick=\"getElementId(this);\"><img src=\"${data.logo}\"></a>\n <div class=\"product-bottom text-center\">\n <i class=\"fa fa-star\"></i>\n <i class=\"fa fa-star\"></i>\n <i class=\"fa fa-star\"></i>\n <i class=\"fa fa-star\"></i>\n <i class=\"fa fa-star-half-o\"></i>\n <h3>${data.name}</h3>\n </div>\n </div>`;\n layout += row;\n });\n document.getElementById('fill-category').innerHTML = layout;\n })\n }", "_get_local_service_list() {\n var out = [];\n for (var k in this.services) {\n if (this.services.hasOwnProperty(k)) {\n out.push(k);\n }\n }\n return out;\n }", "function shop() {\n\tshowCategoriesList();\n}", "function getServices(category) {\n\t// Previous DOM content is cleared from the page\n\t$(\"#serviceCard\").hide();\n\t$(\"#serviceList\").html(\"\");\n\n\t// JSON file is called here\n\t$.getJSON(`/api/services/bycategory/${category}`, services => {\n\t\t$.each(services, (index, service) => {\n\t\t\t// Services are appended to the page on an unordered list\n\t\t\t$(\"#serviceList\").append(\n\t\t\t\t$(\"<li />\")\n\t\t\t\t\t.attr(\"class\", \"list-group-item border-dark list-group-item-action\")\n\t\t\t\t\t.text(service.ServiceName)\n\t\t\t\t\t.on(\"click\", e => {\n\t\t\t\t\t\t// click event is added to the anchors\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tgetService(service.ServiceID);\n\t\t\t\t\t})\n\t\t\t);\n\t\t\t\n\t\t});\n\t\t$(\"#servicesContainer\").show();\n\t});\n}", "function ShoppingListService(maxItems){\n /* as a Controller as Syntax, we are attaching all properties directly to the instance of the controller\n that is automatically attached to $scope for us*/\n var service = this;\n\n var items = []; // List of shopping items\n\n service.addItem = function (itemName, itemQuantity) { // service method responsible to add elements to Shopping List\n\n if((maxItems === undefined) || (maxItems !== undefined) && (items.length < maxItems)){\n var item = {\n name: itemName,\n quantity: itemQuantity\n };\n items.push(item);\n }else{\n throw new Error(\"Max Items (\"+ maxItems +\") reached.\");\n }\n\n };\n\n service.removeItem = function (itemIndex) { // service method responsible to remove elements of Shopping List\n items.splice(itemIndex, 1);\n };\n\n service.getItems = function () { // service method responsible to show all elements in Shopping List\n return items;\n };\n }", "function ShoppingListService(maxItems) {\n var service = this;\n\n // List of shopping items\n var items = [];\n\n service.addItem = function (itemName, quantity) {\n if ((maxItems === undefined) ||\n (maxItems !== undefined) && (items.length < maxItems)) {\n var item = {\n name: itemName,\n quantity: quantity\n };\n items.push(item);\n }\n else {\n throw new Error(\"Max items (\" + maxItems + \") reached.\");\n }\n };\n\n service.removeItem = function (itemIndex) {\n items.splice(itemIndex, 1);\n };\n\n service.getItems = function () {\n return items;\n };\n}", "SitebuilderFullServices(packName) {\n let url = `/pack/xdsl/${packName}/siteBuilderFull/services`;\n return this.client.request('GET', url);\n }", "function ShoppingListCheckOffService(){\n var service = this;\n\n // Items already bought\n var bought = [];\n\n //Items to Buy\n var buyList = [{item_name:\"oranges\", item_quantity:10},\n {item_name:\"apples\", item_quantity:400},\n {item_name:\"mangoes\", item_quantity:20},\n {item_name:\"kiwi\", item_quantity:50},\n {item_name:\"grapes\", item_quantity:100},\n {item_name:\"jackfruit\", item_quantity:400}];\n\n service.removeItem = function (itemIndex) {\n var item = buyList[itemIndex];\n bought.push(item);\n buyList.splice(itemIndex, 1);\n };\n\n service.getItems = function(TypeOfList){\n if (TypeOfList ==\"ToBuyList\") {\n return buyList;\n }else if (TypeOfList ==\"BoughtList\") {\n return bought;\n }\n }\n}", "constructor() {\n this.services = [];\n }", "async function getShops(req, res) {\n \n try {\n const shops = await shopService.query(req.query)\n res.send(shops)\n } catch (err) {\n // logger.error('Cannot get shops', err);\n res.status(500).send({ error: 'cannot get shops' })\n\n }\n}", "function ShoppingListCheckOffService() {\n var service = this;\n\n // List of shopping items\n var to_buy_items = [{name: \"Beer\",quantity: \"15\"},{name: \"Gin\",quantity: \"1\"},{name: \"Bread\",quantity: \"3\"},{name: \"Milk\",quantity: \"2\"},{name: \"Donuts\",quantity: \"200\"},{name: \"Cookies\",quantity: \"300\"},{name: \"Chocolate\",quantity: \"5\"}]; \n var bought_items = [];\n\n service.BuyItem = function (itemIndex) { \n var item = to_buy_items[itemIndex];\n bought_items.push(item);\n to_buy_items.splice(itemIndex, 1);\n };\n\n service.getItems = function () {\n return to_buy_items;\n };\n service.getBoughtItems = function () {\n return bought_items;\n }; \n \n}", "function renderServices( serviceList ) {\n let HTML = '';\n\n for ( let i=0; i<serviceList.length; i++ ) {\n const service = serviceList[i];\n HTML += `<div class=\"service\">\n <i class=\"fa fa-${service.icon}\"></i>\n <h5>${service.title}</h5>\n <p>${service.description}</p>\n </div>`\n }\n\n return document.querySelector('#services').innerHTML = HTML;\n}", "function ShoppingListCheckOffService() {\n var service = this;\n\n // List of shopping items\n var shop_items = [\n { name: \"cookies\", quantity: 1 },\n { name: \"cookies\", quantity: 2 },\n { name: \"cookies\", quantity: 3 },\n { name: \"cookies\", quantity: 4 },\n { name: \"cookies\", quantity: 5 },\n ];\n var service = this;\n\n // List of shopping items\n var bought_items = [];\n\n service.bought = function (itemIndex) {\n bought_items.push(shop_items[itemIndex]);\n shop_items.splice(itemIndex, 1);\n };\n\n service.getShopItems = function () {\n return shop_items;\n };\n\n service.getBoughtItems = function () {\n return bought_items;\n };\n}", "async getProductsByStore(id) {\n return await this.get(`/tienda/ProductosPorTienda?IdTienda=${id}`);\n }", "GetListOfTasks(serviceName) {\n let url = `/hosting/reseller/${serviceName}/task`;\n return this.client.request('GET', url);\n }", "getServices() {\n // This accessory only provides one service - a switch\n return [this.service];\n }", "ListTheEmailProServices(packName) {\n let url = `/pack/xdsl/${packName}/emailPro/services`;\n return this.client.request('GET', url);\n }", "async getServices (req, res) {\n console.log('getting services')\n\n const user = await jwt.getUser(req, res)\n const services = await user.getServices()\n\n if (!services.length > 0) return res.status(204).send([])\n\n res.status(200).send(services)\n }", "VOIPLineServices(packName) {\n let url = `/pack/xdsl/${packName}/voipLine/services`;\n return this.client.request('GET', url);\n }", "async componentWillMount() {\n const responseService = await serviceService.list();\n let services = [];\n for (const service of responseService.data.items) {\n let dataService = service.name;\n services.push(dataService);\n }\n\n this.setState({ service: services });\n }", "function ShoppingListCheckOffService(){\n\n var service = this;\n\n var shoppingList = [\n {name: 'blueberry', quantity: 13},\n {name: 'mango', quantity: 5},\n {name: 'grapes', quantity: 4},\n {name: 'strawberry', quantity: 11},\n {name: 'avocado', quantity: 6},\n ];\n\n var alreadyBoughtShoppingList = [];\n\n //gets the to buy list\n service.getToBuyList = function(){\n\n return shoppingList;\n };\n //gets the already bought list\n service.getAlreadyBoughtShoppingList = function(){\n\n return alreadyBoughtShoppingList;\n };\n //pass an item to the right\n service.getItemToAlreadyBoughtList = function(indexItem){\n\n var item = shoppingList[indexItem];\n console.log(\"item to pass: \",item.name + ' ' + item.quantity);\n shoppingList.splice(indexItem, 1);\n alreadyBoughtShoppingList.push(item);\n };\n\n\n }", "function ShoppingListCheckOffService(){\n\n var service = this;\n\n var shoppingList = [\n {name: 'tomatoes', quantity: 10},\n {name: 'oranges', quantity: 5},\n {name: 'watermelon', quantity: 3},\n {name: 'apples', quantity: 15},\n {name: 'bananas', quantity: 3},\n ];\n\n var alreadyBoughtShoppingList = [];\n\n //gets the to buy list\n service.getToBuyList = function(){\n\n return shoppingList;\n };\n //gets the already bought list\n service.getAlreadyBoughtShoppingList = function(){\n\n return alreadyBoughtShoppingList;\n };\n //pass an item to the right\n service.getItemToAlreadyBoughtList = function(indexItem){\n\n var item = shoppingList[indexItem];\n console.log(\"item to pass: \",item.name + ' ' + item.quantity);\n shoppingList.splice(indexItem, 1);\n alreadyBoughtShoppingList.push(item);\n };\n\n\n }", "function Services(props) {\n var namespace = props.namespace,\n services = props.services,\n onFetch = props.onFetch;\n return /*#__PURE__*/react_default.a.createElement(react_default.a.Fragment, null, /*#__PURE__*/react_default.a.createElement(Services_ServiceList, {\n services: services,\n namespace: namespace\n }), /*#__PURE__*/react_default.a.createElement(Poller, {\n namespace: namespace,\n onFetch: onFetch\n }));\n}", "printServicesInfo() {\n let endPoints = listEndpoints(this.app);\n logger.debug(\"Endpoints are : \", endPoints);\n }", "function ShoppingListCheckOffService() {\n var service = this;\n var toBuyList = [\n {name: \"Milk\", quantity: 2}, {name:\"Donuts\", quantity: 12}, {name:\"Cookies\", quantity:10}, {name:\"Chocolate\",quantity:3}, {name: \"Peanut Butter\", quantity:2}\n ];\n var alreadyBoughtList = [];\n\n service.boughtItem = function(itemIndex) {\n var item = toBuyList[itemIndex];\n alreadyBoughtList.push(item);\n toBuyList.splice(itemIndex,1);\n };\n\n service.getToBuyItems = function () {\n return toBuyList;\n };\n\n service.getAlreadyBoughtItems = function () {\n return alreadyBoughtList;\n };\n\n}", "function ShoppingListCheckOffService() {\n var service = this;\n\n // List of items to buy\n var toBuy = [\n {name: \"Cumin\", quantity: 10},\n {name: \"Berbere\", quantity: 10},\n {name: \"Cajun Spice\", quantity: 10},\n {name: \"Saffron\", quantity: 10},\n {name: \"Jerk Spice\", quantity: 10}\n ];\n\n // List of items already bought\n var bought = [];\n\n service.getToBuy = function () {\n return toBuy;\n }\n\n service.getBought = function () {\n return bought;\n }\n\n service.removeItem = function (itemIndex) {\n return toBuy.splice(itemIndex, 1)[0];\n console.log(itemIndex);\n }\n\n service.checkIfEmpty = function () {\n if (toBuy.length <= 0) {\n return true;\n }\n return false;\n }\n\n service.boughtNotEmpty = function () {\n if (bought.length !== 0) {\n return false;\n }\n return true;\n }\n\n service.pushToBought = function (removedItem) {\n bought.push(removedItem);\n return bought;\n }\n}", "function goService(urlService, idService){\r\n\tmainTab_GoTab('AllServices'); \r\n\tsrvConfigToggle('id_'+idService+'_2', urlService);\r\n}", "function ServiceList(props) {\n var namespace = props.namespace,\n services = props.services;\n var filtered = services.filter(function (item) {\n return item.namespace === namespace;\n });\n return /*#__PURE__*/react_default.a.createElement(Table_Table, {\n data: filtered\n }, /*#__PURE__*/react_default.a.createElement(Column, {\n header: /*#__PURE__*/react_default.a.createElement(Table_Cell, null, \"Name\"),\n cell: /*#__PURE__*/react_default.a.createElement(ServiceListCells_NameCell, null)\n }), /*#__PURE__*/react_default.a.createElement(Column, {\n columnKey: \"clusterIp\",\n header: /*#__PURE__*/react_default.a.createElement(Table_Cell, null, \"Cluster\"),\n cell: /*#__PURE__*/react_default.a.createElement(Table_TextCell, null)\n }), /*#__PURE__*/react_default.a.createElement(Column, {\n header: /*#__PURE__*/react_default.a.createElement(Table_Cell, null, \"Ports\"),\n cell: /*#__PURE__*/react_default.a.createElement(PortCell, null)\n }), /*#__PURE__*/react_default.a.createElement(Column, {\n header: /*#__PURE__*/react_default.a.createElement(Table_Cell, null, \"Labels\"),\n cell: /*#__PURE__*/react_default.a.createElement(ServiceListCells_LabelCell, null)\n }), /*#__PURE__*/react_default.a.createElement(Column, {\n header: /*#__PURE__*/react_default.a.createElement(Table_Cell, null),\n cell: /*#__PURE__*/react_default.a.createElement(components_ResourceActionCell, null)\n }));\n}", "getProducts() {}", "async readServices() {\n let response = await fetch(url + 'get/services')\n let data = await response.json();\n return data\n }", "function ShoppingListCheckOffServiceFactory(){\n var service = {};\n\n //toBuyList is used to store predefined list of items you can buy\n service.toBuyList = [{name: 'banana', quantity: 10},\n\t\t\t\t\t\t {name: 'apple', quantity: 20},\n\t\t\t\t\t\t {name: 'grape', quantity: 30},\n\t\t\t\t\t\t {name: 'watermelon', quantity: 5},\n\t\t\t\t\t\t {name: 'strawberry', quantity: 40}];\n //boughtList is used to show the items you have bought\n service.boughtList = [];\n\n service.getToBuyList = function(){\n return service.toBuyList;\n };\n\n service.getBoughtList = function(){\n return service.boughtList;\n };\n\n //buyItem function moves the selected item from toBuyList to boughtList\n service.buyItem = function(itemIndex){\n var item = {};\n item.name = service.toBuyList[itemIndex].name;\n item.quantity = service.toBuyList[itemIndex].quantity;\n service.boughtList.push(item);\n service.toBuyList.splice(itemIndex, 1);\n };\n\n //cancelTransaction function moves the selected item from boughtList to toBuyList\n service.cancelTransaction = function(itemIndex){\n var item = {};\n item.name = service.boughtList[itemIndex].name;\n item.quantity = service.boughtList[itemIndex].quantity;\n service.toBuyList.push(item);\n service.boughtList.splice(itemIndex, 1);\n };\n\treturn service;\n }", "function getAllServiceTypes() {\r\n return get('/servicetype/getall').then(function (res) {\r\n return res.data;\r\n }).catch(function (err) {\r\n return err.response.data;\r\n });\r\n}", "list() {\n this._followRelService(\"list\", \"List\");\n }", "handleServiceLinking(url) {\n if (url.indexOf('services') > -1 || url.split('/')[1] == 'services') {\n let urlParams = getAllUrlParams(url);\n this.setState({navigating: true});\n return Actions.service({\n list: true,\n searchCriteria: urlParams.query,\n serviceTypeIds: urlParams.type && urlParams.type.constructor === Array\n ? urlParams.type.map((el) => parseInt(el))\n : [parseInt(urlParams.type)]\n });\n }\n }", "function getServices() {\n bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes = {\n \"Pickup\": \"PIC\",\n \"Delivery\": \"DLV\",\n \"FactoryStuffing\": \"FAS\",\n \"ExportClearance\": \"EXC\",\n \"ImportClearance\": \"IMC\",\n \"CargoInsurance\": \"CAI\"\n }\n\n var _input = {\n \"EntityRefKey\": bkgBuyerSupplierDirectiveCtrl.ePage.Entities.Header.Data.UIJobPickupAndDelivery.PK,\n };\n\n var inputObj = {\n \"FilterID\": appConfig.Entities.JobService.API.FindAll.FilterID,\n \"searchInput\": helperService.createToArrayOfObject(_input)\n }\n if (!bkgBuyerSupplierDirectiveCtrl.obj.isNew) {\n apiService.post('eAxisAPI', appConfig.Entities.JobService.API.FindAll.Url, inputObj).then(function (response) {\n if (response.data.Response) {\n bkgBuyerSupplierDirectiveCtrl.ePage.Entities.Header.Data.UIJobServices = response.data.Response\n if (bkgBuyerSupplierDirectiveCtrl.ePage.Entities.Header.Data.UIJobServices.length != 0) {\n for (var i in bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes) {\n var tempObj = _.filter(bkgBuyerSupplierDirectiveCtrl.ePage.Entities.Header.Data.UIJobServices, {\n 'ServiceCode': bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes[i]\n })[0];\n if (tempObj == undefined) {\n bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes[i] = 'false'\n } else {\n bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes[i] = tempObj.ServiceCode\n }\n }\n } else {\n for (var i in bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes) {\n bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes[i] = \"false\"\n }\n }\n }\n });\n } else {\n for (var i in bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes) {\n bkgBuyerSupplierDirectiveCtrl.ePage.Masters.serviceTypes[i] = \"false\"\n }\n }\n\n }", "function ShoppingListCheckOffService () {\n var service = this;\n // list of items to buy\n var toBuyList = [\n {name: \"cookies\", quantity: '10 bags'},\n {name: \"soda\", quantity: '5 bottles'},\n {name: \"chips\", quantity: '10 bags'},\n {name: \"water\", quantity: '20 bottles'},\n {name: \"fruits\", quantity: '15 pounds'}\n ];\n var boughtList = [];\n service.getToBuyList = function () {\n return toBuyList;\n };\n\n service.getBoughtList = function () {\n return boughtList;\n };\n\n service.checkOff = function (itemIndex){\n var boughtItem = toBuyList.splice(itemIndex, 1);\n boughtList.push({boughtItem.name, boughtItem.quantity});\n console.log(boughtList);\n };\n\n\n\n }", "getServices(ownedServices, allServices){\n let whatToOffer = [];\n //#1 - iterate categories\n allServices.forEach((category)=>{\n //#2 - create category header\n let newCategory = {\n categoryName: category.categoryName,\n location: 'in/out',//TODO\n totalPickedItems : 0,//TODO\n totalPriceItems : 0,//TODO\n subCategories : []\n }\n\n //#3 - iterate subcategories to add to category\n category.subCategories.forEach((subCategory)=>{ \n //#4 - create sub-category header\n let newSubCategory = {\n subCategoryName : subCategory.subCategoryName,\n numberOfPicked : 0,//TODO\n pricePicked : 0,//TODO\n options : []\n }\n\n //#5 - iterate services to add to subcategory\n subCategory.services.forEach((service)=>{\n //#6 - create service item to add to subcategory\n let newService = {\n optionId: service.id_service,\n optionLabel : service.name_service,\n optionPrice : parseFloat(service.price),\n optionSelected : false\n }\n\n //#7 - Add it to subcategory options list (if professional has it)\n newSubCategory.options.push(newService);\n })\n\n //#8 - Push SubCategory to Category if it has options (services)\n if(newSubCategory.options.length > 0){\n newCategory.subCategories.push(newSubCategory);\n }\n\n });\n\n //#9 - Push category to 'What to offer' if category has subcategories\n if(newCategory.subCategories.length > 0){\n whatToOffer.push(newCategory);\n }\n });\n\n //#10 - Finaly, set as 'myServices'\n this.myServices = whatToOffer;\n\n }", "HubicPersoServices(packName) {\n let url = `/pack/xdsl/${packName}/hubic/services`;\n return this.client.request('GET', url);\n }", "async getService (req, res) {\n console.log('getting services')\n const user = await jwt.getUser()\n const service = await Services.findById(req.params.service)\n\n if (!service) return res.status(204).send('No service found with that ID')\n\n res.status(200).send(service)\n }", "function getServices(parentEl) {\n // API Fetch\n fetch(\n \"https://cdn.contentful.com/spaces/9635uuvwn9dq/environments/master/entries?access_token=cgtQv23ag7qZw92QlPnJwslq6vWfK8sDwB8fNk62QTI&content_type=service\"\n )\n .then((resp) => resp.json())\n .then((data) => processServices(data, parentEl));\n}", "fetch(callback) {\n let proc = cp.spawnSync(this._serviceCmd, [\"list\"]);\n let firstline = true;\n let lines = proc.stdout.toString().split(/\\n/);\n let services = new Map();\n\n lines.forEach((line) => {\n if (!firstline && line) {\n let s = this._parseLine(line);\n services.set(s.name, s);\n }\n\n firstline = false;\n });\n\n let serviceList = new ServiceList(services);\n\n if (callback) callback(serviceList);\n\n return serviceList;\n }", "function agregoServicios() {\n for (let i = 0; i < SERVICIOS.length; i++) {\n document.getElementById(\"otrosservicios\").innerHTML += \"<li>\" + SERVICIOS[i].nombre + \"</li>\"\n }\n}", "async list(req, res) {\n try {\n const orders = await Orderservice.findAll({\n attributes: [\n 'id',\n 'client_id',\n 'is_package',\n 'services',\n 'situation',\n 'amount',\n 'date_order',\n ],\n include: [{ model: Client, as: 'client', attributes: ['name'] }],\n });\n return res.json(orders);\n } catch (error) {\n return res.status(401).json({ error: 'Does not exist order' });\n }\n }", "async function list(req, res) {\n res.json({\n data: await service.list(),\n });\n}", "function serviceproviders(){\n\t$.ajax({\n\t\turl: 'service_provider/list',\n\t\tdataType:'JSON',\n\t\ttype:'POST',\n\t\tsuccess:function(msg){\n\t\t\t\n\t\t}\n\t});\n}", "Exchange2013Services(packName) {\n let url = `/pack/xdsl/${packName}/exchangeAccount/services`;\n return this.client.request('GET', url);\n }", "static get service() {\n return 'stores';\n }", "function generateServices() {\n\tconst services = [\n\t\t'Wash', 'Hull Wash', 'Topside Wax', 'Hull Wax', 'Compounding Service', 'Interior Cleaning', 'Teak Cleaning', 'Teak Sealing', 'Engine Room Detailing', 'System Check', 'Bottom Cleaning'];\n\t\treturn services[Math.floor(Math.random() * services.length)];\n}", "function goShopping () { \n listProducts();\n}", "getServiceNames(grpcPkg) {\n // Define accumulator to collect all of the services available to load\n const services = [];\n // Initiate recursive services collector starting with empty name\n this.collectDeepServices('', grpcPkg, services);\n return services;\n }", "findAllServices(identifier) {\n return this.services.filter(service => service.id === identifier);\n }", "function ShoppingListFactory() {\n var factory = function (maxItems) { // factory function that creates a service \"ShoppingListService\"\n return new ShoppingListService(maxItems);\n };\n\n return factory;\n }", "getStores() {\n Service.get(this).getStores(state.get(this).params.companyId);\n }", "function ShoppingListCheckOffService() {\n var service = this;\n\n // List of shopping items to be bought\n var buyItems = [\n {\n name: \"Cookies\",\n quantity: 10,\n },\n {\n name: \"Chips\",\n quantity: 5,\n },\n {\n name: \"Soda-cans\",\n quantity: 8,\n },\n {\n name: \"Gummy bears\",\n quantity: 6,\n },\n {\n name: \"Pepto Bismol\",\n quantity: 3,\n }\n ];\n\n //List of items which are already bought\n var boughtItem = [];\n \n \n //Return the pre-populated array to the ToBuyShoppingController\n service.getBuyItemsArray = function () {\n return buyItems;\n }\n\n //Remove the items from the buyitems array and add the same item to the bought items array\n service.removeFromBuyAddToBought = function (itemIndex) {\n boughtItem.push(buyItems[itemIndex]); \n buyItems.splice(itemIndex, 1);\n }\n\n //Return the bought items array to the AlreadyBoughtShoppingController\n service.getBoughtItemsArray = function () {\n return boughtItem;\n }\n\n }", "static list(){\n //console.log('list di ProductController');\n Product.list((err, data) => {\n if(err){\n View.error(err);\n }\n else{\n View.list(data);\n }\n })\n }", "function TopListService() {\r\n\tthis.base_url = \"http://webservice.backend.com:3000\";\r\n\tthis.find_by_id = function(id, callback){\r\n\t\tvar c = new Client.RailsClient(this.base_url);\r\n\t\tc.get_one(\"top_lists\", id, callback );\r\n\t}\r\n\tthis.all = function(id, callback){\r\n\t\tvar c = new Client.RailsClient(this.base_url);\r\n\t\tc.get_all(\"top_lists\", id, callback );\r\n\t}\r\n}", "async function list(req, res) {\n res.json({ data: await service.list() });\n}", "async function list(req, res, next){\n let data = await service.list();\n res.json({\n data\n });\n}", "ExchangeServices(packName) {\n let url = `/pack/xdsl/${packName}/exchangeIndividual/services`;\n return this.client.request('GET', url);\n }", "function getService(service) {\n for (var i = 0; i < window.services.length; i++)\n if (window.services[i].id === service) return services[i];\n}", "ListAvailableServices() {\n let url = `/cluster/hadoop`;\n return this.client.request('GET', url);\n }", "function viewSaleProduct() {\n connection.query(\"SELECT * FROM store\", function (err, results) {\n if (err) throw err;\n console.table(results);\n })\n}", "function getServicesForNearestDealer(req,res){\n\n\n\n\n}", "function ShoppingListCheckOffService() {\n\t//---------//\n\t//Variables//\n\t//---------//\n\tvar checkService = this; //Using \"checkService\" instead of \"this\". Just for aesthetics.\n\tvar boughtItems = []; //Variable to store items that have been bought.\n\tvar toBuyItems = [{name: \"sodas\", quantity: 10}, //Variable with preloaded items to buy.\n \t{name: \"candies\", quantity: 10},\n \t{name: \"sugars\", quantity: 10},\n \t{name: \"beans\", quantity: 10},\n \t{name: \"cereals\", quantity: 10}\n\t];\n\n\t//---------//\n\t//Functions//\n\t//---------//\n\n\t/* sendBuyItems() returns our list of items in the service to outside functions */\n\tcheckService.sendBuyItems = function() {\n\t\treturn toBuyItems;\n\t}\n\n\t/* sendBoughtItems() returns our list of items that were bought */\n\tcheckService.sendBoughtItems = function() {\n\t\treturn boughtItems;\n\t}\n\n\t/* listSwap moves an item from the unbought to the bought list/array */\n\tcheckService.listSwap = function(index) {\n\t\tboughtItems.push(toBuyItems[index]);\n\t\ttoBuyItems.splice(index, 1);\n\t}\n}", "function fill_services(array) {\n const service_list = document.createElement('ul');\n array.forEach(({ id, links }) => {\n const inner_service = document.createElement('li');\n service_list.appendChild(inner_service);\n\n if (links.length > 1) {\n const inner_service_title = document.createTextNode(\n id.split('_').join(' ')\n );\n inner_service.appendChild(inner_service_title);\n links.forEach(({ name, link }) => {\n const new_link = document.createElement('a');\n const new_link_name = document.createTextNode(`[${name}]`);\n const space = document.createTextNode(' ');\n\n inner_service.appendChild(space);\n new_link.href = link;\n new_link.appendChild(new_link_name);\n inner_service.appendChild(new_link);\n });\n } else {\n const new_link = document.createElement('a');\n const new_link_name = document.createTextNode(id.split('_').join(' '));\n new_link.href = links[0].link;\n new_link.appendChild(new_link_name);\n inner_service.appendChild(new_link);\n }\n });\n return service_list;\n}", "async function list(req, res, next) {\n const data = await service.list()\n res.json({data})\n}", "function servicePopulate(branch) {\n branch.services.map(function (service) {\n var option = document.createElement(\"option\");\n option.text = service.serviceName;\n option.value = service.id;\n serviceSelect.appendChild(option);\n });\n}", "get serviceName() {\n return this.getStringAttribute('service_name');\n }", "function viewSale() {\n connection.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n for (var i = 0; i < res.length; i++) {\n console.log();\n console.log(\"---------------------------------------------\");\n console.log(res[i].item_id + \" | \" + res[i].product_name + \" | \" + res[i].department_name + \" | $\" + res[i].price + \" | \" + res[i].stock_quantity);\n }\n });\n manager();\n}", "fetchServicesFromApi()\n {\n //all paths are configurable in 'config.js'\n const serviceCatalogAPI = bcConfig.urlBase + bcConfig.urlPathToREDCap + bcConfig.serviceCatalogApi;\n\n fetch(serviceCatalogAPI)\n .then(response => response.json())\n .then(jsondata => {\n this._jsondata = jsondata;//need this for searches\n this.parseJsonListOfServices(jsondata);\n if (this.fullServiceList) \n {\n this.setStateData(this.fullServiceList);\n }\n else\n {\n this.setStateData([]);\n }\n }).catch(err => this.setStateData([]));\n }", "function ShopController(ProductService){\n\n this.sortOrder = \"price\";\n this.newItem = {};\n this.taxRate = 1.0575;\n\n // Calling getAll() to retrieve list of all items from service.\n this.items = ProductService.getAll();\n\n\n /**\n * Calling addNew() function in service by using this function\n * @param {Object} product product must be used as argument to connect this function to service.\n */\n this.addProduct = function addProduct(product){\n ProductService.addNew(product);\n };\n\n\n /**\n * Sorts products forsale by product property(e.g. product price)\n * @param {String} sortOrder product property to sort by\n */\n this.sortCategory = function sortCategory(sortOrder){\n if(this.sortOrder === sortOrder){\n this.sortOrder=\"-\" + sortOrder;\n }\n else{\n this.sortOrder = sortOrder;\n }\n };\n\n\n\n }", "ListAvailableServices() {\n let url = `/cdn/webstorage`;\n return this.client.request('GET', url);\n }", "addServices(services) {\n for (let s of services) {\n this.addService(s);\n }\n }", "function getServersList() {\n if (window.sos && window.sos.length > 0) {\n var selectSrv = document.getElementById('server-select');\n for (var i = 0; i < sos.length; i++) {\n var srv = sos[i];\n var option = document.createElement('option');\n var serverLoopString = option.value = srv.ip + ':' + srv.po;\n option.text = (i + 1) + '. ' + option.value;\n selectSrv.appendChild(option);\n }\n } else {\n setTimeout(getServersList, 100);\n }\n }", "function getAllWorkshops(req, res) {\n res.json(workshops);\n}", "function _getServices() {\n if (!_isReady()) {\n return;\n }\n if (!_sonosSystem.availableServices) {\n _services = {};\n log.warn(LOG_PREFIX, 'No services available...');\n return;\n }\n try {\n const stringified = JSON.stringify(_sonosSystem.availableServices);\n const services = JSON.parse(stringified);\n if (diff(_services, services)) {\n log.verbose(LOG_PREFIX, 'Services changed.', services);\n _services = services;\n _self.emit('services-changed', services);\n }\n } catch (ex) {\n log.exception(LOG_PREFIX, 'Unable to get services', ex);\n }\n }", "function getWorkOrderListFromServiceNow() \n{\n RMPApplication.debug(\"begin getWorkOrderListFromServiceNow\");\n c_debug(dbug.order, \"=> getWorkOrderListFromServiceNow\");\n\n id_search_results.setVisible(false);\n initDataTable();\n clearOrderDataTable();\n clearTaskDataTable();\n var wo_type = $(\"#id_woTypeFilter\").val();\n\n // TO DO\n // Adjust the following values with the contract\n switch (wo_type) {\n case 'intervention':\n break;\n case 'imac':\n break;\n case 'tous':\n break;\n default:\n var title = ${P_quoted(i18n(\"error_getWOListFromSN_title\", \"Type d'incident\"))};\n var content = ${P_quoted(i18n(\"error_getWOListFromSN_msg\", \"La recherche pour le type d'incident sélectionné n'est pas encore implémentée !\"))};\n dialog_error(title, content, btn_ok);\n return;\n }\n getFilter();\n\n RMPApplication.debug(\"end getWorkOrderListFromServiceNow\");\n}", "function mostrarServicios(){\n\n //llenado de la tabla\n cajas_hoy();\n cajas_ayer() ;\n}" ]
[ "0.7313496", "0.7298795", "0.7247098", "0.6932875", "0.66493374", "0.6622507", "0.6619854", "0.6491897", "0.6474934", "0.6401329", "0.63241136", "0.6318888", "0.6311028", "0.6266202", "0.625117", "0.62411", "0.6174", "0.6154078", "0.61437386", "0.61323404", "0.61323404", "0.6117271", "0.6106319", "0.6102106", "0.6087586", "0.60821694", "0.6064427", "0.60592926", "0.6041205", "0.59984004", "0.59920776", "0.59756106", "0.59630984", "0.596282", "0.5921747", "0.5917984", "0.5916779", "0.5916638", "0.59142834", "0.5892485", "0.5864607", "0.5809992", "0.579369", "0.5786418", "0.5784131", "0.5776298", "0.57742757", "0.57666594", "0.5757888", "0.57426846", "0.57397354", "0.5737153", "0.5724927", "0.57235754", "0.5716335", "0.57078594", "0.5692819", "0.5685764", "0.5671164", "0.56500703", "0.56472766", "0.56283253", "0.5622771", "0.5616018", "0.5586918", "0.5578637", "0.5578424", "0.55671954", "0.5555715", "0.55554813", "0.5545564", "0.5537897", "0.5535647", "0.5528972", "0.5526344", "0.5510076", "0.54873633", "0.5479747", "0.54704964", "0.54427415", "0.54297864", "0.54297704", "0.54125583", "0.5411182", "0.5390363", "0.53838336", "0.53810376", "0.5363088", "0.53604275", "0.5353861", "0.5345342", "0.5338142", "0.5331956", "0.53266454", "0.5319168", "0.53123856", "0.5310401", "0.53059435", "0.5303284", "0.52933" ]
0.5902206
39
............................ ............................................... ................................................. ......................................... ................................................. ............................................... .....................................
function requestBookmarksBar(on, layout) { if(on != null) { if(on) { on = 1; } else { on = 0; } } let Data = { on: on, layout: layout }; ipcRenderer.send('request-set-bookmarks-bar', Data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "transient private internal function m185() {}", "transient protected internal function m189() {}", "constructor () {\r\n\t\t\r\n\t}", "transient private protected internal function m182() {}", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "function _____SHARED_functions_____(){}", "static private internal function m121() {}", "transient final private internal function m170() {}", "transient final protected internal function m174() {}", "__previnit(){}", "static final private internal function m106() {}", "obtain(){}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "constructor (){}", "static transient final private protected internal function m40() {}", "transient private protected public internal function m181() {}", "initialize()\n {\n }", "constructor() {\n\t}", "constructor() {\n\t}", "function init() {\n\n\n}", "transient private public function m183() {}", "transient final private protected internal function m167() {}", "static transient final private internal function m43() {}", "init () {}", "init () {}", "constructor() {\n\n\t}", "init() { }", "init() { }", "init() { }", "init() { }", "init() { }", "static private protected internal function m118() {}", "init() {\n }", "static transient private protected internal function m55() {}", "constructor () { super() }", "function Scdr() {\r\n}", "function _construct()\n\t\t{;\n\t\t}", "constructor( ) {}", "initialize() {\n\n }", "static transient final protected internal function m47() {}", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }" ]
[ "0.6656219", "0.6558244", "0.62058413", "0.606806", "0.6020118", "0.5967327", "0.5945764", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5900506", "0.5738574", "0.5738119", "0.5684605", "0.5675611", "0.5616851", "0.5581659", "0.55690026", "0.5547605", "0.5547605", "0.5547605", "0.5547605", "0.5547605", "0.5547605", "0.55473167", "0.55166596", "0.550749", "0.5503864", "0.548711", "0.548711", "0.5477591", "0.5473409", "0.54622126", "0.54594463", "0.5451306", "0.5451306", "0.54436135", "0.54036206", "0.54036206", "0.54036206", "0.54036206", "0.54036206", "0.5397059", "0.5395382", "0.53814614", "0.5381129", "0.536528", "0.5362011", "0.5341163", "0.53342265", "0.5326499", "0.53023624", "0.53023624", "0.53023624", "0.53023624", "0.53023624", "0.53023624", "0.53023624", "0.53023624", "0.53023624", "0.53023624", "0.53023624", "0.53023624", "0.53023624", "0.53023624", "0.53023624", "0.53023624", "0.53023624" ]
0.0
-1
........ ................. ................ ................ ................ ................. ..............
function init() { loadTheme(); loadBorderRadius(); loadBookmarksBar(); loadStartPage(); loadHomePage(); loadSearchEngine(); loadCache(); loadWelcome(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "transient protected internal function m189() {}", "static private internal function m121() {}", "transient private internal function m185() {}", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "function _____SHARED_functions_____(){}", "constructor () {\r\n\t\t\r\n\t}", "transient private protected internal function m182() {}", "function Scdr() {\r\n}", "function init() {\n\n\n}", "transient final private internal function m170() {}", "obtain(){}", "transient final protected internal function m174() {}", "__previnit(){}", "rolledBack() {}", "static final private internal function m106() {}", "firstDraw() {}", "transient private protected public internal function m181() {}", "function startPoint()\n{\n\n}", "function Rep() {\r\n}", "transient final private protected internal function m167() {}", "getNextFrame() {\nvar f;\nf = this.fCur + 1;\nif (this.fCount <= f) {\nf = 0;\n}\nreturn this.setFrameAt(f);\n}", "function generateSeq() {\r\n\r\n}", "function comportement (){\n\t }", "function sprinkles() {\n\n\t}", "constructor (){}", "draw () { //change name to generate?? also need to redo\n return null;\n }", "prepare() {}", "static private protected public internal function m117() {}", "static private protected internal function m118() {}", "transient private public function m183() {}", "init () {}", "init () {}", "_firstRendered() { }", "static transient private protected internal function m55() {}", "static transient final private internal function m43() {}", "static transient final private protected internal function m40() {}", "initialize()\n {\n }", "init() { }", "init() { }", "init() { }", "init() { }", "init() { }", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "function y(e){let t=R,n=D,r=j,s=v,i=M,o=B,a=_,u=new Uint8Array(x.slice(0,R)),d=E,c=E.slice(0,E.length),g=F,l=Y,p=e();return R=t,D=n,j=r,v=s,M=i,B=o,_=a,x=u,Y=l,E=d,E.splice(0,E.length,...c),F=g,P=new DataView(x.buffer,x.byteOffset,x.byteLength),p}", "function init(){\n\n}", "function init(){\n\n}", "function init () {\n\n}", "function RgbaBase() {\n\n}", "init() {\n }", "function Sread() {\r\n}", "function _construct()\n\t\t{;\n\t\t}", "function setup() {\n\n\n}", "function setup() {\n\n\n}", "added() {}", "start() {// [3]\n }", "function miFuncion (){}", "preload () {}" ]
[ "0.6418301", "0.6112988", "0.5816339", "0.57538784", "0.5726322", "0.5716015", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.57092524", "0.5683004", "0.5644448", "0.5572053", "0.557023", "0.5432387", "0.5351645", "0.534295", "0.5297809", "0.5266907", "0.526253", "0.52525395", "0.5248942", "0.52268916", "0.52020174", "0.51992106", "0.51931894", "0.51785344", "0.5178463", "0.5175467", "0.51680124", "0.5166629", "0.51665413", "0.5146636", "0.5136546", "0.51359236", "0.51336503", "0.51296484", "0.51296484", "0.51278895", "0.5119102", "0.51141393", "0.5113035", "0.51061577", "0.5106024", "0.5106024", "0.5106024", "0.5106024", "0.5106024", "0.5085231", "0.5085231", "0.5085231", "0.5085231", "0.5085231", "0.5085231", "0.5081078", "0.5069955", "0.5069955", "0.50673324", "0.50616497", "0.5055981", "0.5050507", "0.50485", "0.50224555", "0.50224555", "0.5021664", "0.5010532", "0.50095725", "0.50089264" ]
0.0
-1
All functions to be called on $(window).load() should be in this function
function qodeOnWindowLoad() { qodeInitElementorCustomFont(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function documentReadyFunction() {\n onPageLoadOrResize();\n onPageLoad();\n }", "function eltdfOnWindowLoad() {\n\t eltdfWooCommerceStickySidebar().init();\n\t eltdfInitButtonLoading();\n eltdfInitProductListMasonryShortcode();\n }", "function onLoaded()\n\t{\n\t\twindow.initExhibitorsList();\n\t\twindow.initFloorPlans();\n\t\twindow.initConciege();\n\t\twindow.initAmenities();\n\t\twindow.initVisas();\n\t}", "function init()\n {\n $(document).on(\"loaded:everything\", runAll);\n }", "function pageLoad(){\n $jQ('body').zIndex(); // jQuery UI Check\n window.onbeforeunload=function(){return '';}; // Hack to prevent any page.reload\n startCSSInfo();\n hackUserAgent();\n hackRemoveAnimations();\n hackDisableSubmit();\n hackActions();\n setNumScripts();\n setTimeStatus();\n setSystemColors();\n setVisibility();\n setUserActions();\n setAllVisibleElementsInfo();\n hackFrameScroll();\n}", "function loaded() {\n\taddElements();\n\tosScroll();\n\t// initiate tabs\n\t$('#tabs').tab();\n\t// set event listeners\n\tsetOneTimeEventListeners();\n\t//updateChecked();\n}", "function qodeOnWindowLoad() {\n qodeInitElementorCoverBoxes();\n }", "function alwaysRunOnload () {\n\t\n\t}", "function addToWindowOnLoad(funct){\r\nvar oldOnload = window.onload;\r\nif (typeof window.onload != 'function') {\r\nwindow.onload = funct;\r\n} else {\r\nwindow.onload = function() {\r\noldOnload();\r\nfunct();\r\n }\r\n }\r\n}", "function qodeOnWindowLoad() {\n\t qodeInitNewsShortcodesPagination().init();\n }", "function mainLoaded() {\n if (typeof(executeOnContentLoad) == \"function\") {\n if (contentLoadDestination && location.hash != contentLoadDestination) return;//wait til we are on the correct page\n var fn = executeOnContentLoad;\n executeOnContentLoad = null;\n contentLoadDestination = null;\n fn();\n }\n }", "function setLoadlist() {\n getWindowHeight(); //get window height\n getWindowWidth(); //get window width\n setParallaxContainerDimensions(); //set parallax container height & width\n setParallaxImgDimensions(); //set parallax image element height & width\n getParallaxInfo(); //get parallax container and element information\n getWindowScrollPos(); //get current window scroll position\n\n if (typeof _onReady === 'function') {\n _onReady.call();\n }\n\n setParallaxScroll();\n }", "function eltdfOnWindowLoad() {\n eltdfDropDownMenu();\n eltdfSetDropDownMenuPosition();\n eltdfInitDividedHeaderMenu();\n }", "function pageReady() {\n legacySupport();\n\n updateHeaderActiveClass();\n initHeaderScroll();\n\n setLogDefaultState();\n setStepsClasses();\n _window.on('resize', debounce(setStepsClasses, 200))\n\n initMasks();\n initValidations();\n initSelectric();\n initDatepicker();\n\n _window.on('resize', debounce(setBreakpoint, 200))\n }", "function page_loaded() {\n post_load_setup();\n}", "function runOnLoad(window) {\n // Listen for one load event before checking the window type\n window.addEventListener(\"load\", function runOnce() {\n window.removeEventListener(\"load\", runOnce, false);\n watcher(window);\n }, false);\n }", "function edgtfOnDocumentReady() {\n edgtfHeaderBehaviour();\n edgtfSideArea();\n edgtfSideAreaScroll();\n edgtfFullscreenMenu();\n edgtfInitMobileNavigation();\n edgtfMobileHeaderBehavior();\n edgtfSetDropDownMenuPosition();\n edgtfDropDownMenu(); \n edgtfSearch();\n }", "function runOnLoad(window) {\r\n\t\t//updateCheck(window);\r\n // Listen for one load event before checking the window type\r\n window.addEventListener(\"load\", function runOnce() {\r\n window.removeEventListener(\"load\", runOnce, false);\r\n\t\t\t//updateCheck(window);\r\n watcher(window);\r\n }, false);\r\n }", "function pageReady(){\n handleUTM();\n legacySupport();\n initModals();\n initScrollMonitor();\n initVideos();\n _window.on('resize', debounce(initVideos, 200))\n initSmartBanner();\n initTeleport();\n initMasks();\n }", "function onPageLoad() {\n // winResize();\n // winScroll();\n }", "function _init() {\n $(function() {\n $(window).resize(_checkWindowSize).resize();\n _sessionTimeoutWarning();\n });\n }", "function loadUp(){\n\tif (globalDebug) {console.group(\"LoadUp\");}\n\n\t//load web fonts\n\t//loadWebFonts();\n\n\t// always\n\tniceScrollInit();\n\n\troyalSliderInit();\n\n\tisotopeInit();\n\n\tif($(\".classic-infinitescroll-wrapper\").length) classicInfiniteScrollingInit($(\".classic-infinitescroll-wrapper\"));\n\n\tprogressbarInit();\n\tmenusHover();\n\n\n\tmagnificPopupInit();\n\n\tinitVideos();\n\tresizeVideos();\n\n\tsearchTrigger();\n\t// sidebarHeight();\n\n\t//Set textarea from contact page to autoresize\n\tif($(\"textarea\").length) { $(\"textarea\").autosize(); }\n\n\t$(\".pixcode--tabs\").organicTabs();\n\n\tif (globalDebug) {console.groupEnd();}\n}", "function alwaysRunOnload () {\n\t\t// Placeholder/Future use.\n\t}", "function pageFullyLoaded () {}", "function qodeOnWindowLoad() {\n qodeInitElementorAdvancedImageGalleryMasonry();\n }", "function window_load() {\n \tdocument.getElementById('topimage').style.height\n \t\t= (window.innerHeight - document.getElementById('header').clientHeight) + \"px\";\n // console.log(window.innerHeight - document.getElementById('header').clientHeight\n\n // update Y position\n for (var i = 0; i < mCircles.length; i++) {\n \tSCROLL_Y[i] = mCircles[i].offset().top;\n\n \tif (!mInitialize) {\n\t\t\tfor (var k = 0; k < mCircles[i].length; k++) {\n\t\t\t\tsetCircleColor(mCircles[i][k], i);\n\t\t\t\tsetCircleSize(mCircles[i][k]);\n\t\t\t}\n\t\t}\n\t}\n\n\t// call loading json function\n\treadJson();\n\n\t// call adjust work detail element\n\tadjustWorkDetailPanel();\n}", "function runOnLoad(window) {\n // Listen for one load event before checking the window type\n window.addEventListener(\"load\", function runOnce() {\n window.removeEventListener(\"load\", runOnce, false);\n watcher(window);\n }, false);\n }", "function eltdfOnDocumentReady() {\n eltdfHeaderBehaviour();\n eltdfSideArea();\n eltdfSideAreaScroll();\n eltdfFullscreenMenu();\n eltdfInitDividedHeaderMenu();\n eltdfInitMobileNavigation();\n eltdfMobileHeaderBehavior();\n eltdfSetDropDownMenuPosition();\n eltdfDropDownMenu();\n eltdfSearch();\n eltdfVerticalMenu().init();\n }", "function init() {\n documentReady(documentLoaded);\n}", "function initOnDomReady() {}", "function completed(){document.removeEventListener(\"DOMContentLoaded\",completed);window.removeEventListener(\"load\",completed);jQuery.ready();}// Catch cases where $(document).ready() is called", "function completed(){document.removeEventListener(\"DOMContentLoaded\",completed);window.removeEventListener(\"load\",completed);jQuery.ready();}// Catch cases where $(document).ready() is called", "function completed(){document.removeEventListener(\"DOMContentLoaded\",completed);window.removeEventListener(\"load\",completed);jQuery.ready();}// Catch cases where $(document).ready() is called", "function completed(){document.removeEventListener(\"DOMContentLoaded\",completed);window.removeEventListener(\"load\",completed);jQuery.ready();}// Catch cases where $(document).ready() is called", "function eltdfOnDocumentReady() {\n eltdfInitQuantityButtons();\n eltdfInitSelect2();\n\t eltdfInitPaginationFunctionality();\n\t eltdfReinitWooStickySidebarOnTabClick();\n eltdfInitSingleProductLightbox();\n\t eltdfInitSingleProductImageSwitchLogic();\n eltdfInitProductListCarousel();\n }", "function initLoad() {\n\t/////////////////// MAPPER LES LIENS ///////////////////\n\tif (Modernizr.history) {\t\n\t\t// menu\n\t\t$(\"#cn-wrapper a\").each(function() {\n\t\t\t$(this).click(function() {\n\t\t\t\teverPushed = true;\n\t\t\t\t$(\".cn-wrapper li a.survol\").removeClass(\"survol\");\n\t\t\t\tloadStart($(this).attr(\"href\"));\n\t\t\t\treturn false;\n\t\t\t});\n\t\t});\n\t\t$(\"#container-map-ima area\").each(function() {\n\t\t\t$(this).click(function() {\n\t\t\t\teverPushed = true;\n\t\t\t\t$(\".cn-wrapper li a.survol\").removeClass(\"survol\");\n\t\t\t\tloadStart($(this).attr(\"href\"));\n\t\t\t\treturn false;\n\t\t\t});\n\t\t});\n\t\t// footer \n\t\t/*$(\"#bloc-btn-bottom a[href^=mentions]\").click(function() {\n\t\t\tloadStart($(this).attr(\"href\"));\n\t\t\teverPushed = true;\n\t\t\treturn false;\n\t\t});*/\n\t\t// contenu\n\t\tmapAllLinks();\n\t\n\t\t/////////////////// GESTION D'URL ///////////////////\n\t\t$(window).bind(\"popstate\", function() {\n\t\t\t\n\t\t\tif (everPushed) {\n\t\t\t link = location.pathname.substr(0, location.pathname.length-1).replace(/^.*[\\\\/]/, \"\"); \n\t\t\t loadStart(link);\n\t\t\t }\n\n\t\t});\n\t\t\n\t\t\n\n\t}\n}", "function init() {\n\t\t$(document).on('pageBeforeInit', function (e) {\n\t\t\tvar page = e.detail.page;\n\t\t\tload(page.name, page.query);\n\t\t});\n }", "function startatLoad(){\r\n\tloadNavbar(function(){\r\n\t\tgetPT1000XMLData(function(){\r\n\t\t\tshowPT1000values();\r\n\t\t});\r\n\t});\r\n}", "function onPageLoad() {\r\n\t// although jQuery already has an on page load, \r\n\t// this function was added for sake of organization.\r\n\tvar trigger = \"load\";\r\n}", "function qodeOnWindowLoad() {\n qodeInitElementorCardsSlider();\n }", "function fireLoaded() {\n\t\tvar i;\n\t\tpageloaded = true;\n\t\t// For browsers with no DOM loaded support\n\t\tif (!domready) {\n\t\t\tfireReady();\n\t\t}\n\t\tfor (i = 0; i < loadedfn.length; i += 1) {\n\t\t\tloadedfn[i]();\n\t\t}\n\t\tloadedfn = [];\n\t}", "function addLoadEvent( _func ) {\r\n// document.observe('dom:loaded', _func);\r\n Event.observe(window, 'load', _func);\r\n}", "function windowLoaded () {\n remote.getGlobal(\"share\").openFileDialog = openFileDialog;\n remote.getGlobal(\"share\").setAudioLogLin = setAudioLogLin;\n\n console.log(\"window loaded\");\n slidersInitialise(); // in sliders.js\n initialiseDragDrop (); // in dragdrop.js\n initialise_vis(); // in visualiser.js\n}", "function qodefOnWindowLoad() {\n qodefInitProductListMasonryShortcode();\n }", "function eltdfOnWindowLoad() {\n\n }", "function onLoad()\n{}", "function pageReady() {\n svg4everybody();\n initScrollMonitor();\n initModals();\n }", "function pageLoad() {\n setControlValues();\n processHashInstruction();\n\n if (Common.isIE) Common.fixToMaxItemWidth('settings-header', 16, false);\n\n document.getElementById('theme').addEventListener('change', themeSelectChange);\n document.getElementById('defaults').addEventListener('click', defaultsClick);\n document.getElementById('save').addEventListener('click', saveClick);\n document.getElementById('cancel').addEventListener('click', cancelClick);\n\n document.getElementById('offline').style\n .display = (navigator.onLine ? 'none' : 'block');\n window.addEventListener('offline', appOffline);\n window.addEventListener('online', appOnline);\n}", "function pageLoadHashInit() {\r\n\t\t\t\t\r\n\t\t\t\t\tif ($('body[data-animated-anchors=\"true\"]').length > 0) {\r\n\t\t\t\t\t\tif ($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// Inside tabs\r\n\t\t\t\t\t\t\tif (typeof nectarGetQueryParam['tab'] != 'undefined') {\r\n\t\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\t\tpageLoadHash();\r\n\t\t\t\t\t\t\t\t}, 800);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// Regular\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tpageLoadHash();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ($('#nectar_fullscreen_rows[data-mobile-disable=\"on\"]').length > 0 && $('.nectar-box-roll').length == 0 && \r\n\t\t\t\t\t\tnectarDOMInfo.usingMobileBrowser) {\r\n\t\t\t\t\t\t\tpageLoadHash();\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}", "function womOn()\r\n{\r\n\twindow.wom_old_onload = (typeof(window.onload) != 'undefined') ? window.onload : function(){ };\r\n window.onload = womGoReal;\r\n $(document).ready(function()\r\n {\r\n \twomGo();\r\n });\r\n}", "function tabLoad() {\n // Tab load safety check\n if (tabHasLoaded) {\n return;\n }\n tabHasLoaded = true;\n\n setupPage();\n\n getAlerts();\n }", "function mkdOnWindowLoad() {\n mkdSmoothTransition();\n }", "function loaded() {\r\n\r\n const $loginForm = classifyForm('.login-popup');\r\n\r\n if ($loginForm.length) {\r\n registerLoginValidation($loginForm);\r\n }\r\n\r\n }", "function onPageLoad() {\n $('button[data-button-cerca]').click(ricercaConciliazione.bind(undefined, false));\n $(\"#buttonNuovaConciliazione\").click(apriCollapseNuovaConciliazione);\n $('#inserimento_buttonSalva').click(gestisciConciliazione.bind(undefined, 'inserimento', 'gestioneConciliazionePerTitolo_inserisci.do'));\n $('#aggiornamento_buttonSalva').click(gestisciConciliazione.bind(undefined, 'aggiornamento', 'gestioneConciliazionePerTitolo_aggiornamento.do'));\n\n definisciRadioEntrataSpesa();\n definisciCaricamentoSelectViaAjax();\n definisciPulsantiAnnullamento();\n definisciRicercaGuidataConto();\n\n $(document).on('contoCaricato', gestioneContoCaricato);\n }", "function onPageLoaded() {\n}", "function pageReady() {\n legacySupport();\n initSliders();\n }", "function _WindowwOnLoad() {\r\n uuready.gone.win = 1;\r\n _DOMContentLoaded();\r\n win.xwin && win.xwin(uu); // window.xwin(uu) callback\r\n uulazyfire(\"canvas\");\r\n uulazyfire(\"audio\");\r\n uulazyfire(\"video\");\r\n}", "function onloadHandler(){\n console.info(\"Nick Cage is ready!\");\n // where the magic happens\n replaceAllElements();\n }", "function onLoad() {\n document.documentElement.removeAttribute(\"viewBox\");\n readFrames();\n sozi.events.fire(\"documentready\");\n }", "function popupPagesLoad() {\n\t\t\t$(document).ready(function() {\n\t\t\t\t$('.js-lightbox').addClass('is-active');\n\t\t\t})\n\t\t}", "function onLoad() {\n document.documentElement.removeAttribute('viewBox');\n readFrames();\n sozi.events.fire('documentready');\n }", "function _pageLoaded() {\n window.removeEventListener( 'load', _pageLoaded );\n refresh();\n }", "function mapAndContentOnload() {\r\n if (windowWidth > 1189) {\r\n \tlegalContentHeight = Math.round($(window).height() * 0.28);\r\n \tlegalMapHeight = Math.round($(window).height() * 0.51);\r\n }\telse if ((windowWidth < 1189) && (windowWidth > 889)) {\r\n \tlegalContentHeight = Math.round($(window).height() * 0.28);\r\n \tlegalMapHeight = Math.round($(window).height() * 0.45);\r\n }\telse if (windowWidth < 889) {\r\n \tlegalContentHeight = Math.round($(window).height() * 0.28);\r\n \tlegalMapHeight = Math.round($(window).height() * 0.60);\r\n }\r\n\t$(\"#legal-content\").css(\"height\", legalContentHeight);\r\n\t$(\"#mapdiv\").css(\"height\", legalMapHeight);\r\n}", "function addLoadEvent(func) {\n if (typeof window.onload != 'function') {\n window.onload = func;\n } else {\n var old = window.onload;\n window.onload = function() {\n if (oldonload) {\n old();\n }\n func();\n }\n }\n }", "function initializePage() {\n handleGlobalEvent();\n handleSideBar();\n handleMessageBar();\n handleCollapsibleController();\n handleResetButton();\n handleDisabledSubmit();\n handleAjaxError();\n handleAjaxSetup();\n }", "function runOnloadIfWidgetsEnabled () {\n\t\t\n\t}", "function scriptLoadHandler() {\n // Restore jQuery and window.jQuery to their previous values and store the\n // new jQuery in our local jQuery variable\n jQuery = window.jQuery.noConflict(true);\n PlannTo.jQuery = jQuery;\n\n // Call our main function\n\n main();\n }", "function mkdfOnWindowLoad() {\n\t\tuncoveringFooter();\n\t}", "function load(){\r\n\t\t//Check to see if this window is the logout popup, close the window if it is\r\n\t\tif(window.location.href.indexOf('timeout') > -1){\r\n\t\t\tself.close();\r\n\t\t}\r\n\t\r\n\t\tvar db = $(\".dashboardNote\");\r\n\t\t\r\n\t\t//Only proceed if on dashboard page\r\n\t\tif(db.length > 0){\r\n\r\n\t\t\t//Check to see if jquery was loaded inside iframe instead of main page, if so refresh entire page.\r\n\t\t\t//Must check to see if jquery was loaded in iframe, if so need to refresh page, there is no tab panel in iframe\r\n\t\t\tvar tabs = $(\".tabNavigation\");\r\n\t\t\t\r\n\t\t\tif(tabs.length == 0){\r\n\t\t\t\t//If not tab panel was found jquery was loaded in iframe need to refresh the parent page so jquery loads in main page.\r\n\t\t\t\twindow.top.location = '/' + id + '?customAutoRefresh=1';\r\n\t\t\t}else{\r\n\t\t\t\t//Check to see if URL contains 'customAutoRefresh', if it does this is a page load after auto refrhes, need to auto start\r\n\t\t\t\tvar url = window.location.href;\r\n\r\n\t\t\t\tif(url.indexOf('customAutoRefresh') == -1){\r\n\t\t\t\t\t//Create a new button on the dashboard to start auto refresh\r\n\t\t\t\t\t$(\".dashboardHeader div:first\").append('<input id=\"customAutoRefresh\" type=\"button\" title=\"Start\" class=\"btn\" value=\" Start Fullscreen Auto Refresh \" style=\"margin-left: 5px;\">');\r\n\t\t\t\t\t\r\n\t\t\t\t\t//Attached event handler to new button we added.\r\n\t\t\t\t\t$(\"#customAutoRefresh\").click(function(){\r\n\t\t\t\t\t\tstart();\r\n\t\t\t\t\t});\r\n\t\t\t\t}else{\r\n\t\t\t\t\tstart();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function loadFunction(){\n\tvalidateLogin();\n\tgetImg();\n\tgetTags();\n\tgetUploader()\n\tgetComments();\n\tupdateViewCount();\n\t\n}", "function startatLoad(){\r\n\tloadNavbar(function(){\r\n\t\tsetSelectMenuesValues(function(){\r\n\t\t\t\tgetXMLData(function(){\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t});\r\n}", "function bindEvents() {\n $(document).on('ready', onDocumentReady);\n }", "function on_load() {\r\n $(\"#page_title_container\").css(\"height\", window_height + \"px\");\r\n $(\"#content01\").css(\"height\", window_height + \"px\");\r\n $(\"#content02\").css(\"height\", window_height + \"px\");\r\n $(\"#content03\").css(\"height\", window_height + \"px\");\r\n}", "function onWindowLoad() {\n // window is loaded, now lets listen for when the device is ready\n document.addEventListener(\"deviceready\", onCordovaReady, false);\n window.removeEventListener(\"load\", onWindowLoad, false);\n }", "function preLoad() {\n return;\n}", "function scriptLoadHandler() {\n\t\t// Restore jQuery and window.jQuery to their previous values and store the\n\t\t// new jQuery in our local jQuery variable\n\t\tjQuery = window.jQuery.noConflict(true);\n\t\t$ = window.jQuery;\n\t\t// Call our main function\n\t\tmain(); \n\t}", "function handlePageLoad() {\n // Add a listener to be triggered when we scroll through the pages\n window.addEventListener('hashchange', function() {\n debug('Hash change detected: ' + location.hash + ' State: ' + document.readyState);\n processUserList();\n }, false);\n\n queryUserId();\n queryReviveSkill();\n }", "function pageLoaded(){\t\n\tconsole.log(\"Page loaded.\");\n\tconsole.log(\"Loading jQuery...\");\t\n\tloadJQuery();\t\n}", "__initJS() {\n var mq = window.matchMedia( \"(max-width: 767px)\" );\n this.__checkWinSize( mq );\n const self = this;\n $( window ).on( 'load resize', function () {\n self.__checkWinSize( mq );\n } );\n }", "function ready() {\n\n\tif(!Modernizr.csstransforms3d) $('body').prepend('<div class=\"alert\"><div class=\"box\"><h2>Fatti un regalo.</h2><p>Questo sito usa tecnologie moderne non compatibili con il tuo vecchissimo browser.</p><p>Fatti un regalo, impiega due minuti a installare gratuitamente un browser recente, tipo <a href=\"http://www.google.it/intl/it/chrome/browser/\">Google Chrome</a>. Scoprirai che il web è molto più bello!</p></div></div>');\n\tloader.init();\n\t$('nav').addClass('hidden');\n\t//particles.init();\n\twork.init();\n\tnewhash.change(true);\n\textra();\n\tskillMng.init();\n\tcomponentForm.init();\n\tresponsiveNav();\n\tmaterial_click();\n\tcuul.init();\n\tdisableHover();\n\tscroll_down.init();\n}", "function _onAllJsIncludesDone() {\n\t\tinitNavigationMode();\n//\t\tSitoolsDesk.loadPreferences(this);\n\n\t\tthis.fireEvent('modulesLoaded');\n\t}", "function screenLoad(){\r\n\t\t\tcenterAlignPortraits();\r\n\t\t\tadjustBiographyPlacement();\r\n\t\t\tupdateLatonaTeamRowHeight();\r\n\t\t}", "function SetupAfterAllLoaded() {\n /**\n * CHECK IMAGE LOADED -> IF LOADED COMPLETE THEN EXECUTE 'SLIDE-END'\n */\n slData.nImage = slData.nImage + 1;\n if (slData.nImage == slData.imageLen\n && (!slData.isVideoback || (slData.isVideoback && slData.isVideobackLoaded))) {\n setTimeout(function () {\n VariableModule(that);\n (slData['id'] == 'home') ? M.Module('LAYER').LoadHomeEnd()\n : that.LOAD.SlideEnd($slCur);\n }, 10);\n }\n }", "function coreInitLoadPage() {\n if (typeof $(\"body\").attr(\"control\") !== \"undefined\")\n WEBUI.MAINPAGE = $(\"body\")[$(\"body\").attr(\"control\").split(\".\")[1]]();\n }", "function initContent() {\n var msHide = document.querySelectorAll('.ms-hide');\n\n /**\n * Place the Yellow ribbon after the header.\n */\n $('#s4-workspace').prepend($('#DeltaPageStatusBar'));\n\n if (msHide.length > 0) {\n /**\n * Hide all right section web parts that are marked as \"hidden\".\n */\n if ($('.ms-hide').closest('.right-section')) {\n $('.right-section .ms-hide').parent().hide();\n }\n checkContentTypes();\n checkOrgChartZone();\n checkGatewayPage();\n }\n\n adjustArticleImageBlock();\n adjustWireStories();\n collapsibleList();\n customCheckboxes();\n howDoI();\n articleComments();\n startMyVMSNet();\n startUserControls();\n\n /**\n * Window Load Events.\n */\n window.addEventListener('load', function () {\n introText();\n wireStories();\n wireCatagory();\n updateMoreSearchText();\n });\n }", "function init() {\n // THIS IS THE CODE THAT WILL BE EXECUTED ONCE THE WEBPAGE LOADS\n }", "function lightboxDocumentReady() {\n registerAjaxLogin();\n registerAjaxSaveRecord();\n registerAjaxListEdit();\n registerAjaxEmailRecord();\n registerAjaxSMSRecord();\n registerAjaxTagRecord();\n registerAjaxEmailSearch();\n registerAjaxBulkEmail();\n registerAjaxBulkExport();\n registerAjaxBulkDelete();\n $('.mainFocus').focus();\n}", "function page_shown(e) {\n if (e.persisted) post_load_setup();\n}", "function onWindowLoad() {\n\t\t\tdata.title=document.title;\n\t\t\tdata.innerHeight=window.innerHeight;\n\t\t\tdata.innerWidth=window.innerWidth;\n\t\t\tdata.navigator=window.navigator.userAgent;\t\n\t\t\t}", "function initialize(){//init when a new page load\r\n\t $('#info_dom').append('<li id=\"iRoot\"><ul></ul></li>');\r\n\t init_models();\r\n\t // init_interaction_area();\r\n\t //info_window_create();\r\n\t // $('#resource_tabs').tabs();\r\n\t // resources_window_create();\r\n\t init_interaction_actions();\r\n\t init_page_actions();\r\n}", "function ajax_Load() {\n //$(\".consoleLogOutput\").append('<div class=\"consoleLog_helm\">ajax_Load() event starting.</div>');\n \n if (helm.alreadyInitialized && helm.RefreshHelmDataAfterUpdatePanelPostBack) {\n helm.jQueryBindEvents();\n helm.Initialize(true); //true -> because this is after ajax request\n } else {\n //reset the refresh overrides\n helm.alreadyInitialized = true;\n helm.RefreshHelmDataAfterUpdatePanelPostBack = true;\n }\n \n }", "function onDocumentLoading(){\r\n $(\"#progressSpinner\").show();\r\n\r\n if(PendingFullScreen)\r\n setFullScreen(true);\r\n\r\n if(!slider && FlexPaperFullScreen){\r\n\t addSlider('zoomSliderFullScreen');\r\n fpToolbarLoadButtons();\r\n }\r\n}", "function tabLoad() {\n // Tab load safety check\n if (tabHasLoaded) {\n return;\n }\n tabHasLoaded = true;\n\n setupPage();\n\n getTaskStatuses();\n getTasks();\n }", "function mapsLoaded() {\n $(init);\n}", "function onPageLoad()\n\t{\n\t\t//Set page size\n\t\tSetSize();\n\t\tloadPreferences();\n\t}", "function whenDocumentIsReady(fn) {\n if (document.readyState != 'loading'){\n fn();\n } else {\n document.addEventListener('DOMContentLoaded', fn);\n }\n}", "function storage_initload() {\r\n\t$('body').bind('myfiles_storage_update', function(event) { \r\n\t\tstorage_refresh();\t\r\n\t}); \r\n}", "function tt_SetOnloadFnc() {\n tt_AddEvtFnc(document, \"DOMContentLoaded\", tt_HideSrcTags);\n tt_AddEvtFnc(window, \"load\", tt_HideSrcTags);\n if (tt_body.attachEvent)\n tt_body.attachEvent(\"onreadystatechange\",\n\t\t\tfunction() {\n\t\t\t if (tt_body.readyState == \"complete\")\n\t\t\t tt_HideSrcTags();\n\t\t\t});\n if (/WebKit|KHTML/i.test(navigator.userAgent)) {\n var t = setInterval(function() {\n if (/loaded|complete/.test(document.readyState)) {\n clearInterval(t);\n tt_HideSrcTags();\n }\n }, 10);\n }\n}", "function WindowOnload(e)\r\n{\r\n\t// Call every onload handler in the list.\r\n\tfor (var i = 0; i < window.onloadHandlers.length; i++)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\twindow.onloadHandlers[i](e);\r\n\t\t}\r\n\t\tcatch (ex)\r\n\t\t{}\r\n\t}\r\n}", "function LoadViaAjax() {\t\t\r\n\t\t\r\n\t\tFirstLoad();\t\t\r\n\t\tLazyLoad();\t\t\r\n\t\tHeroSection();\r\n\t\tFitThumbScreen();\r\n\t\tPortfolio();\t\t\r\n\t\tBackToTop();\r\n\t\tPageShare();\r\n\t\tSliders();\r\n\t\tJustifiedGrid();\r\n\t\tLightbox();\r\n\t\tAppearIteam();\r\n\t\tContactMap();\r\n\t\tContactForm();\t\t\r\n\t\r\n\t}//End Load Via Ajax\t\t\t\t", "function scriptLoadHandler() {\n // Restore $ and window.jQuery to their previous values and store the\n // new jQuery in our local jQuery variable\n jQuery = window.jQuery.noConflict(true);\n // Call our main function\n main();\n }" ]
[ "0.7603902", "0.7389519", "0.708341", "0.6952638", "0.6912849", "0.68762875", "0.68374676", "0.6803991", "0.67885834", "0.67871064", "0.67627656", "0.67270035", "0.67181396", "0.6708863", "0.6699525", "0.6696686", "0.66750526", "0.6656467", "0.6648514", "0.6634142", "0.66316015", "0.6597189", "0.6578348", "0.65642977", "0.65566176", "0.65480673", "0.65350354", "0.6522304", "0.6518866", "0.6518828", "0.65086126", "0.65086126", "0.65086126", "0.65086126", "0.65062237", "0.64987963", "0.6485389", "0.64751816", "0.6472626", "0.6471139", "0.6445989", "0.6431515", "0.6423696", "0.64209896", "0.64086556", "0.64029104", "0.6391151", "0.6381879", "0.637367", "0.6372482", "0.6359348", "0.6330583", "0.63295615", "0.6320193", "0.6318907", "0.63096625", "0.63080424", "0.63053316", "0.630526", "0.62963915", "0.629146", "0.62894154", "0.62596625", "0.62583274", "0.62575305", "0.6256747", "0.6251715", "0.62390834", "0.6238849", "0.62385124", "0.62364864", "0.62346846", "0.62307966", "0.6229762", "0.6228179", "0.622771", "0.62191314", "0.6218411", "0.62132007", "0.618616", "0.6180546", "0.6177206", "0.6177047", "0.6172935", "0.6162668", "0.6160676", "0.61598593", "0.6159826", "0.6153298", "0.61492294", "0.61455023", "0.61437577", "0.6135868", "0.6135114", "0.61307335", "0.6119582", "0.61139196", "0.6111272", "0.6104426", "0.6102879", "0.6095081" ]
0.0
-1
This will update the house state acccording to passed update parameters.
updateHouseFromState(component){ var state_manager = this, house = state_manager.state.house, promise; if (!house) { promise = Promise.resolve(); } else if (state_manager.state.dataset === 'energy' && !state_manager.matchesEnergyState()){ promise = state_manager.setHouseEnergyFromState(component); } else if (state_manager.state.dataset === 'power' && !state_manager.matchesPowerState()){ promise = state_manager.setHousePowerFromState(component); } else if (state_manager.state.dataset === 'irradiance'){ promise = state_manager.setIrradianceData(component); } else { promise = Promise.resolve(); } return promise.then(()=>{ state_manager.update_in_progress = false; return new Promise((fnResolve, fnReject)=>{ component.syncFromStateManager(fnResolve); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setParams(params){\n var state_manager = this,\n url, house, params;\n if (state_manager.update_in_progress) return false;\n state_manager.update_in_progress = true;\n\n params = Object.assign({}, state_manager.state, params);\n if (params.house_id){\n house = state_manager.houses.find((h)=>{ return h.data.id == params.house_id; });\n } else {\n house = state_manager.state.house || state_manager.houses[0];\n params.house_id = house.data.id;\n }\n\n house.verifyMonthState(params);\n if (params.dataset === 'irradiance'){\n params.date_interval = house.verifyPowerRange(params.date_interval || [], params);\n url = `/irradiance/${params.month}/${params.year}/${params.view}?${query_string.stringify({dates: params.date_interval})}`;\n } else if (params.dataset === 'energy'){\n url = `/houses/${params.house_id}/energy/${params.year}/${params.graph_attr}/${params.view}`;\n } else {\n params.date_interval = house.verifyPowerRange(params.date_interval || [], params);\n url = `/houses/${params.house_id}/power/${params.month}/${params.year}/${params.view}?${query_string.stringify({dates: params.date_interval})}`;\n }\n\n state_manager.history.push(url);\n }", "update() {\n const {name, address1, address2, city, state: stateVal, zip, phone, creditValuePercentage, maxSpending, payoutAmountPercentage} = this.displayData.details;\n const {companyId, storeId} = state.get(this).params;\n const params = {\n name,\n address1,\n address2,\n city,\n state: stateVal,\n zip,\n phone,\n companyId,\n storeId\n };\n // Alternate usage\n if (this.alternativeGcmgr) {\n params.creditValuePercentage = creditValuePercentage;\n params.maxSpending = maxSpending;\n params.payoutAmountPercentage = payoutAmountPercentage;\n }\n // Update the store\n Service.get(this).update(params)\n .then(() => {\n // Redirect\n state.get(this).go('main.corporate.store.details', {companyId: params.companyId, storeId: params.storeId});\n });\n }", "updateStateFromUrl(location, component){\n var state_manager = this,\n params = state_manager.parseUrl(location.pathname),\n house = null;\n if (params.house_id){\n house = state_manager.houses.find((h)=>{ return h.data.id == params.house_id; });\n } else if (params.dataset === 'irradiance'){\n // Irradiance needs a house to verify params and\n house = state_manager.state.house || state_manager.houses[0];\n }\n\n if (house){\n // params should already be verified if set through StateManager#setParams, but\n // verify here again before setting state in case URL manually loaded.\n house.verifyMonthState(params);\n if (params.dataset === 'power' || params.dataset === 'irradiance') {\n var date_interval = location.query.dates || [];\n params.date_interval = house.verifyPowerRange([+date_interval[0], +date_interval[1]], params);\n }\n state_manager.state.house = house;\n state_manager.state.house_id = house.data.id;\n }\n\n Object.assign(state_manager.state, params);\n if (state_manager.state.house_id) {\n state_manager.updateHouseFromState(component);\n } else {\n component.syncFromStateManager(()=>{\n state_manager.update_in_progress = false;\n });\n }\n }", "function update(){\n updateSnakeMovement();\n updateGameFinishedState();\n updateFoodAcquiredState();\n }", "update(data={}) {\n this.state = Object.assign(this.state, data);\n\n // notify all the Listeners of updated state\n this.notifyObervers(this.state);\n }", "updateState() {\n\t\tthis.trigger(this.state);\n\t}", "function updateRoomState(rooms) {\r\n\tconsole.log(\"updated\");\r\n\troomState = rooms;\r\n\tconsole.log(roomState);\r\n}", "function updateState() {\n gState.push({\n board: copyMat(gBoard),\n shownCount: gGame.shownCount,\n markedCount: gGame.markedCount,\n lives: gGame.lives,\n safeClick: gGame.safeClick,\n hints: gGame.hints,\n manualMode: gGame.isManualOn,\n gManualMode: gManualMode.isManualOn\n });\n}", "function updateState(data) {\n updateVoteFinishArea(data.state);\n}", "function updateStateMaps() {\n // XXX\n }", "function updateState() {\n //create our state object and notify our listener\n var state = {\n currentUniverseTime: new Date(currentUniverseTime)\n };\n\n fireStateChanged(state);\n\n // call update() again in a certain number of milliseconds\n updateStateTimeout = setTimeout(function () {\n updateState();\n }, timeBetweenStateUpdatesMs);\n }", "function updateState(stateChange) {\n if (isNaN(stateChange)) {\n console.error(\"Invalid state change\");\n return;\n }\n currState += stateChange;\n currState = currState % states.length;\n console.assert(\n currState >= 0 && currState < states.length,\n \"currState got out of bounds on updateState: \",\n currState\n );\n clearButtons();\n switch (getRoomName()) {\n case \"START\":\n buildStartRoom();\n break;\n case \"GAME\":\n buildGameRoom();\n break;\n case \"RESULTS\":\n buildResultsRoom();\n break;\n }\n}", "update() {\n this.setState({\n numberOfGuests: this.props.model.getNumberOfGuests(),\n menu: this.props.model.getMenu(),\n menuPrice: this.props.model.calcCost(),\n });\n }", "function update() {\n updateGym(id, name, address1, address2, town, county, openingHours)\n .then(() => {\n alert(\"Gym Information updated!\");\n })\n .catch((error) => {\n alert(error.message);\n });\n }", "update(state) {\n\n const old_state = this._state;\n if (!('page' in old_state)) {\n old_state.page = window.location.pathname.replace(/\\//g, '') || null;\n }\n this._state = Object.assign({}, old_state, state);\n\n // serialize state to url, forcing page change as needed\n const url_search_params = new URLSearchParams(window.location.search);\n for (const k of Object.keys(url_param_names)) {\n if (k in this._state) {\n if (typeof this._state[k] === \"undefined\" || this._state[k] === null) {\n url_search_params.delete(k)\n } else {\n url_search_params.set(url_param_names[k], this._state[k])\n }\n }\n }\n\n const url = new URL(window.location);\n url.search = '?' + url_search_params.toString();\n if (old_state['page'] !== this._state['page'] || old_state['area_id'] !== this._state['area_id']) {\n if (!!state['page']) {\n url.pathname = '/' + state['page'] + '/';\n } else {\n url.pathname = '/'\n }\n window.location.href = url;\n } else {\n window.history.replaceState(null, document.title, url.toString())\n }\n }", "async updateState() {\n const stateResponses = await Promise.all([\n this.bulb.getLightState(),\n this.bulb.getDeviceInfo()\n ]).catch(err => {\n console.error(err.message);\n generateErrorQRCode(`Could not get status of ${deviceName}`);\n });\n const newState = lifxStateToCapstone_Yeet(\n stateResponses[0],\n stateResponses[1]\n );\n\n if (!_.isEqual(this.bulbState, newState)) {\n // the light bulb state has changed\n console.debug(\"State has changed\");\n this.bulbState = newState;\n // TODO: remove console.log once we can correctly pad the image. Instead\n // of logging this object, we will display it on the e-ink display.\n generateQRCode(this.bulbState);\n }\n }", "function updateHouse(req, cb) {\n var id = req.params.house, data = req.body;\n req.getConnection(function(err, connection){\n connection.query(\n 'UPDATE `apartments` SET ? WHERE `id` = ?', [data, id], function(err) {\n if (err) { return cb(err); }\n read(id, cb);\n });\n });\n }", "function updateState(){\n // (TODO) handle it without reaching the neighbor-wrtc module...\n if (this.neighborhoods.o.living.ms.arr.length > 0 &&\n this.neighborhoods.i.living.ms.arr.length > 0 &&\n this.state !== 'connect'){\n // #1 connected means (1+ inview, 1+ outview)\n this.state = 'connect';\n this.emit('statechange', 'connect');\n } else if (\n (this.neighborhoods.o.living.ms.arr.length === 0 &&\n this.neighborhoods.i.living.ms.arr.length > 0) ||\n (this.neighborhoods.o.living.ms.arr.length > 0 ||\n this.neighborhoods.i.living.ms.arr.length === 0) &&\n (this.state !== 'partial')){\n // #2 partially connected means (1+ inview, 0 outview) or (0 i, 1+ o)\n this.state = 'partial';\n this.emit('statechange', 'partial');\n } else if (this.neighborhoods.o.living.ms.arr.length === 0 &&\n this.neighborhoods.i.living.ms.arr.length === 0 && \n this.state !== 'disconnect'){\n // #3 disconnected means (0 inview, 0 outview)\n this.state = 'disconnect';\n this.emit('statechange', 'disconnect');\n };\n}", "update() {\n BaseState.update.call(this);\n }", "updateState(state) {\n this.updateStateInner(state, this._props);\n }", "function updateState(state) {\n return Object.assign({}, state, (0, _uscoOrbitControls.update)(settings, state));\n }", "async setState(state) {\n\n const chrChanged = !this.state || this.state.chr1 !== state.chr1 || this.state.chr2 !== state.chr2\n this.state = state\n // Possibly adjust pixel size\n const minPS = await this.minPixelSize(this.state.chr1, this.state.chr2, this.state.zoom)\n this.state.pixelSize = Math.max(state.pixelSize, minPS)\n\n let hicEvent = new HICEvent(\"LocusChange\", {\n state: this.state,\n resolutionChanged: true,\n chrChanged: chrChanged\n })\n\n this.update(hicEvent)\n this.eventBus.post(hicEvent)\n }", "function update() {\n switch (currentState) {\n case State.FOLLOWING:\n if (ball.getOwner() === ctl) {\n currentState = State.AIMING;\n aimAndFire();\n } else {\n moveTowardsBall();\n currentState = State.WAITING;\n }\n case State.WAITING:\n break;\n case State.AIMING:\n break;\n }\n }", "update(state)\r\n {\r\n // refer to gameState field and set as 1 or 0\r\n database.ref(\"/\").update({\r\n gameState: state\r\n })\r\n }", "update(data = {}) {\n this.state = Object.assign(this.state, data);\n this.notify(this.state);\n }", "function update_state(account,area,mid,state,detection,rm,alarm_ws,with_cam,with_lights,with_pir,with_ext){\n\t if(typeof with_lights !== \"undefined\") {\twith_lights=parseInt(with_lights);\t};\n\t if(typeof with_cam !== \"undefined\") \t{\twith_cam=parseInt(with_cam);\t};\n\t if(typeof with_pir !== \"undefined\") \t{\twith_pir=parseInt(with_pir);\t};\n\t if(typeof with_ext !== \"undefined\") \t{\twith_ext=parseInt(with_ext);\t};\n\t//console.log(\"running update state on \"+mid+\"/\"+state+\"/\"+rm);\n\n\t// set the rulemanager text explainaition for the complete area\n\tif(state>=0){\n\t\t$(\"#\"+account+\"_\"+area+\"_status\").click(function(){\n\t\t\tvar rm_int=rm;\n\t\t\treturn function(){\n\t\t\t\ttxt2fb(format_rm_status(rm_int));\n\t\t\t};\n\t\t}());\n\t};\n\t// set the rulemanager text explainaition\n\n\t// text state of the m2m\n\tvar e=$(\"#\"+mid+\"_state\");\n\tif(e.length){\n\t\tif(with_pir==0){ \t// no PIR sensor, show \"detection disabled\"\n\t\t\te.text(state2str(5,detection));\n\t\t} else {\t\t// with PIR, show regular state\n\t\t\te.text(state2str(state,detection));\n\t\t}\n\t\tif(alarm_ws==0){ // if alarm_ws is == 1, we'll send images to the WS on an alert and the site show show an popup (created below)\n\t\t\te.text(e.text()+\", silent mode\");\n\t\t};\n\t}\n\t// text state of the m2m\n\n\t// icons of the area\n\te=$(\"#\"+account+\"_\"+area+\"_icon\");\n\tif(e.length){\n\t\tif(detection>0){\n\t\t\te.removeClass(\"area_sym_not_protected\");\n\t\t\te.addClass(\"area_sym_protected\");\n\t\t} else {\n\t\t\te.addClass(\"area_sym_not_protected\");\n\t\t\te.removeClass(\"area_sym_protected\");\n\t\t}\n\t}\n\t// icons of the area\n\t// text state of the area\n\te=$(\"#\"+account+\"_\"+area+\"_status\");\n\tif(e.length){\n\t\te.text(state2str(-2,detection));\n\t\tif(detection>0){\n\t\t\te.removeClass(\"area_sym_not_protected\");\n\t\t\te.addClass(\"area_sym_protected\");\n\t\t} else {\n\t\t\te.addClass(\"area_sym_not_protected\");\n\t\t\te.removeClass(\"area_sym_protected\");\n\t\t}\n\t}\n\t// text state of the area\n\n\t// glow icon state of the m2m\n\tif($(\"#\"+mid+\"_glow\").length){\n\t\tstate2glow($(\"#\"+mid+\"_glow\"),state,detection);\n\t}\n\t// glow icon state of the m2m\n\t\n\t// POP UP\n\tif(detection>0 && state>0 && alarm_ws>0){\n\t \t// if we change to alert-state, show popup with shortcut to the liveview\n\t\tshow_alert_fb(mid);\n\t} else {\n\t\t// if we change to non-alert-state and there is still the alert popup, show the old_alert popup\n\t\tif($(\"#\"+mid+\"_liveview_alert_fb\").length && alarm_ws>0){\n\t\t\tvar open_alarms=$(\"#\"+mid+\"_alarm_counter\");\n\t\t\tif(open_alarms.length){\n\t\t\t\tshow_old_alert_fb(mid,open_alarms.text());\n\t\t\t}\n\t\t};\n\t}\n\t// POP UP\n\t\n\t// make buttons available/unavailable\n\tvar lv=$(\"#\"+mid+\"_toggle_liveview\");\n\tvar cv=$(\"#\"+mid+\"_toggle_setupcontrol\");\n\tvar av=$(\"#\"+mid+\"_toggle_alarms\");\n\tvar ev=$(\"#\"+mid+\"_toggle_extension\");\n\n\tvar lt=$(\"#\"+mid+\"_toggle_liveview_text\");\n\tvar ct=$(\"#\"+mid+\"_toggle_setupcontrol_text\");\n\tvar at=$(\"#\"+mid+\"_toggle_alarms_text\");\n\tvar et=$(\"#\"+mid+\"_toggle_extension_text\");\n\n\tif(state<0){ // box offline\n\t\t// live view \n\t\tlv.addClass(\"button_deactivated\"); // avoids clickability\n\t\tlv.addClass(\"live_sym_not_available\");\n\t\tlv.removeClass(\"live_sym\");\n\n\t\tlt.addClass(\"sym_text_not_available\");\n\t\tlt.removeClass(\"toggle_liveview_text_active\");\n\t\n\t\t// extension view\n\t\tev.addClass(\"button_deactivated\"); // avoids clickability\n\t\tev.addClass(\"extension_sym_not_available\");\n\t\tev.removeClass(\"extension_sym\");\n\n\t\tet.addClass(\"sym_text_not_available\");\n\t\tet.removeClass(\"toggle_extension_text_active\");\n\t\n\t\t// color view\n\t\tcv.addClass(\"button_deactivated\"); // avoids clickability\n\t\tcv.addClass(\"color_sym_not_available\");\n\t\tcv.removeClass(\"color_sym\");\n\n\t\tct.addClass(\"sym_text_not_available\");\n\t\tct.removeClass(\"toggle_setupcontrol_text_active\");\n\n\t\thide_liveview(mid,true);\n\t\thide_setupcontrol(mid);\n\t} else { // box is online, maybe just a \"motion -> no motion\" change\n\t\tif(lv.is(\":visible\") && lt.is(\":visible\")){\n\t\t\tlv.removeClass(\"button_deactivated\");\n\t\t\tlv.removeClass(\"live_sym_not_available\");\n\t\t\tlv.addClass(\"live_sym\"); // jquery will check for duplicates\n\t\t\tlt.removeClass(\"sym_text_not_available\");\n\t\t}\n\n\t\tif(ev.is(\":visible\") && et.is(\":visible\")){\n\t\t\tev.removeClass(\"button_deactivated\");\n\t\t\tev.removeClass(\"extension_sym_not_available\");\n\t\t\tev.addClass(\"extension_sym\"); // jquery will check for duplicates\n\t\t\tet.removeClass(\"extension_text_not_available\");\n\t\t}\n\n\t\tif(cv.is(\":visible\") && ct.is(\":visible\")){\n\t\t\tcv.removeClass(\"button_deactivated\");\n\t\t\tcv.removeClass(\"color_sym_not_available\");\n\t\t\tcv.addClass(\"color_sym\"); // jquery checks for duplicates\n\t\t\tct.removeClass(\"sym_text_not_available\");\n\t\t}\n\t}\n\t// make buttons available/unavailable\n\n}", "update(newState, silent) {\n silent = silent || false;\n // Set values on this to match the new state\n Object.keys(newState).forEach((prop) => {\n this[prop] = newState[prop];\n });\n\n if (!silent) {\n this.trigger('update', this.toJSON());\n }\n }", "_update() {\n // Call subclass lifecycle method\n const stateNeedsUpdate = this.needsUpdate();\n // End lifecycle method\n debug(TRACE_UPDATE, this, stateNeedsUpdate);\n\n if (stateNeedsUpdate) {\n this._updateState();\n }\n }", "update(state)\r\n {\r\n //updating the database and referring\r\n database.ref('/').update({\r\n gameState : state\r\n }); \r\n }", "function update(state)\n{\n database.ref('/').update({\n gameState : state\n });\n}", "updateState(state, flat) {\n if (this.stateConfig.includes(state)) {\n this.state = state;\n }\n this.dispatch(flat);\n }", "updateGameState(key, value) {\n let newState = update(this.state, {\n gameStates: {\n [key]: { $set: value }\n }\n });\n\n this.setState(newState);\n\n if (this.debug){ console.log('changed gameState for ' + key + ' to ' + value) }\n }", "update(data = {}) {\r\n console.log(data);\r\n this.state = Object.assign(this.state, data);\r\n this.notify(this.state);\r\n }", "update(){\n\t\tthis.setState({\n\t\t\tusersCards:JSON.parse(JSON.stringify(modelInstance.getUsersCards())),\n\t\t\topponentsCards:JSON.parse(JSON.stringify(modelInstance.getOpponentsCards())),\n\t\t}, () => this.saveOriginalHealth());\n\t}", "function update() {}", "stateUpdate() {\n this.handlestateVariable();\n this.handlestateVariable2();\n this.handleCChange();\n this.handleAChange();\n this.handleidCapture();\n this.handleimgCapture();\n this.handleConfigChange();\n this.idcaptureVal();\n this.imgcaptureVal();\n }", "update() {\n const state = this.store.getState();\n\n if (this.isPresenting !== state.webvr.isPresenting) {\n this.vrEffect.setFullScreen(state.webvr.isPresenting);\n this.isPresenting = state.webvr.isPresenting;\n }\n\n if (this.isPresenting) {\n this.vrControls.update();\n } else {\n const dt = (state.app.timestamp - this.timestamp) || 0;\n this.timestamp = state.app.timestamp;\n\n this.flyControls.update(dt);\n }\n\n // update all components with their state\n const componentState = this.select(state);\n Object.keys(this.components)\n .forEach(id => this.components[id].update(componentState[id]));\n }", "updateAddressFactValue(state, addressFactValue) {\r\n state.addressFactValue = addressFactValue;\r\n }", "updateData(config) {\r\n this.setState(config);\r\n }", "function uiUpdate(state) {\n\n gui.source.set(state._source)\n gui.phase.set(state._phase)\n gui.hand.set(state._hand)\n gui.manaPool.set(state._mana)\n gui.map.set(state._land.landMap)\n gui.map.setPlayer(state.playerHero, state._land.landPlayer)\n gui.resources(state)\n\n}", "updateGame(){\n //Update state of objectives\n this.isObjectiveTaken();\n //Update if game is over \n this.isOver();\n\n //check whether game is over\n if(!this.gameOver){\n //updates all players data\n this.updatePlayers();\n }\n }", "updateMainCoinContractAddress(state, mainCoinAddress) {\n state.mainCoinContractAddress = mainCoinAddress\n }", "update() {\n this.setState({\n numberOfGuests: modelInstance.getNumberOfGuests(),\n menu: modelInstance.getMenu()\n })\n }", "function updateState(state) {\n cellClientProps = updateCellClientProps(state, cellClientProps);\n //draw a white background\n background(255, 255, 255);\n\n for (var playerId in state.players) {\n if (state.players.hasOwnProperty(playerId)) {\n let plyr = state.players[playerId];\n let color = plyr.blob.color;\n stroke(color[0],color[1],color[2]);\n for (var i=0; i<plyr.blob.cellInds.length; i++) {\n let c = cellClientProps.ps[plyr.blob.cellInds[i]];\n let a = plyr.blob.amts[i];\n strokeWeight(sqrt(a));\n point(c.x,c.y);\n }\n }\n }\n\n stroke(0);strokeWeight(12);\n for (let i=0; i<cellClientProps.ps.length; i++) {\n let p = cellClientProps.ps[i];\n point(p.x,p.y);\n }\n image(pointer, mouseX, mouseY);\n}", "function gameWinState() {\n crazySpace.update();\n }", "handleUpdate() {\n // Re-combining fields into one location field \n // for easy update, not currently in use\n var location = this.state.building + \".\" + this.state.floor + \".\" + this.state.room\n fetch(myPut + '/' + this.state.oneApp.id, {\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n method: 'put',\n body: JSON.stringify({\n title: this.state.title,\n meetingdate: this.state.meetingdate,\n meeting_user: this.state.meeting_user,\n note: this.state.note,\n location: this.state.location\n })\n })\n .then(() => this.fetchAppointment())\n alert('The appointment has been successfully updated')\n }", "REMOTE_STATE_UPDATE(state, remoteState) {\n state.config = remoteState.config;\n }", "update(state) {\r\n // '/' means root in main database\r\n database.ref('/').update({gameState: state});\r\n }", "updateStateDevice(param) {\n\t\tthis.deviceService.updateState(param)\n\t\t\t.success((data) => {\n\t\t\t\tthis.search(false);\n\t\t\t})\n\t\t\t.error((e) => {\n\t\t\t\tthis.kMessageService.showError('Hubo un error al actualizar el estado del dispositivo');\n\t\t\t\tthis.kLoadingService.hide();\n\t\t\t});\n\t}", "update(state){\r\n\r\n database.ref('/').update({\r\n gameState: state\r\n });\r\n\r\n }", "function update(state){\n database.ref('/').update({\n gameState:state\n });\n}", "update(){}", "update(){}", "update(){}", "update(state)\r\n {\r\n database.ref('/').update({\r\n gameState: state\r\n });\r\n }", "function update(state){\n database.ref('/').update({\n gameState: state\n });\n}", "function update(state) {\n database.ref('/').update({\n gameState : state,\n })\n}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "function update() {\n updatePaddle();\n updatePuck();\n checkPaddle();\n checkBricks();\n }", "_handleUpdate(id, worker_fname, worker_sname, worker_lname, worker_reason, date_absence) {\n this.props.navigation.navigate('updateAbsence', { id: id, worker_fname: worker_fname, worker_sname: worker_sname, worker_lname: worker_lname, worker_reason: worker_reason, date_absence: date_absence });\n }", "function update(state){\n database.ref(\"/\").update({\n gameState : state\n });\n}", "function stateUpdated() {\n\tvar keys, i, key, value, thing;\n\n\t// we must wait for the players list before loading the cards\n\tif (!participantsLoaded) {\n\t\treturn;\n\t}\n\n\twaveState = wave.getState();\n\tif (!waveState) {\n\t\treturn;\n\t}\n\tkeys = waveState.getKeys();\n\twaveStateValues = {};\n\n\t// Update stuff\n\tfor (i = 0; (key=keys[i]); i++) {\n\t\tvalue = waveState.get(key);\n\t\tif (typeof value == \"string\") {\n\t\t\twaveStateValues[key] = value;\n\n\t\t\tthing = getThing(key);\n\t\t\tthing.updateState(value);\n\t\t}\n\t}\n\n\t// Check for deleted objects\n\t// by keys that were in the state before but now are not\n\tfor (i = waveStateKeys.length; i--;) {\n\t\tkey = waveStateKeys[i];\n\t\tif (!(key in waveStateValues)) {\n\t\t\tthing = getThing(key);\n\t\t\tthing.remove();\n\t\t}\n\t}\n\n\twaveStateKeys = keys;\n\n\tif (!stateLoaded) {\n\t\tstateLoaded = true;\n\t\tif (participantsLoaded) {\n\t\t\tonEverythingLoad();\n\t\t}\n\t}\n}", "async updateState(state) {\n let key = this.ctx.stub.createCompositeKey(this.name, [state.getKey()]);\n let data = Utils.serialize(state);\n await this.ctx.stub.putState(key, data);\n }", "update () {}", "handleUpdatedState(state) {\n this.lastTechnology = state.selectedTechnology;\n this.totalClicks = state.clickCounter;\n }", "function stateUpdateParamsSurrogate(state, toParams) {\n var oldOnEnter = state.self.onEnter;\n state.self.onEnter = function () {\n _StickyState.stateEntering(state, toParams, oldOnEnter, true);\n };\n restore.addRestoreFunction(function () {\n state.self.onEnter = oldOnEnter;\n });\n\n return state;\n }", "function stateUpdateParamsSurrogate(state, toParams) {\n var oldOnEnter = state.self.onEnter;\n state.self.onEnter = function () {\n _StickyState.stateEntering(state, toParams, oldOnEnter, true);\n };\n restore.addRestoreFunction(function () {\n state.self.onEnter = oldOnEnter;\n });\n\n return state;\n }", "update(object) {\n for (const prop in object){\n this.state[prop] = object[prop];\n }\n //change has been made to data so call handler\n this.fire();\n\n }", "update(object) {\n for (const prop in object){\n this.state[prop] = object[prop];\n }\n //change has been made to data so call handler\n this.fire();\n\n }", "updateState(update) {\n\t\t// console.log(\"Fetching player updates\");\n\n\t\t// Get the ID of the player who triggered this update\n\t\tlet pid = update.pid;\n\t\tlet player = this.stage.getPlayer(pid);\n\n\t\t// Only clients with a player that is still alive can make updates\n\t\tif (player) {\n\t\t\tif (update.type == \"move\") {\n\t\t\t\tplayer.setMovementDirection(update.x, update.y);\n\t\t\t} else if (update.type == \"cursor\") {\n\t\t\t\tplayer.setCursorDirection(update.x, update.y, update.width, update.height);\n\t\t\t} else if (update.type == \"click\") {\n\t\t\t\tplayer.setFiringDirection(update.x, update.y, update.width, update.height);\n\t\t\t} else if (update.type == \"weapon-toggle\") {\n\t\t\t\tplayer.setWeapon(update.toggle);\n\t\t\t}\n\t\t}\n\t}", "function updateState(s) {\n s.wkWidth != null && (state.wkWidth = s.wkWidth);\n s.wkHeight != null && (state.wkHeight = s.wkHeight);\n s.bkWidth != null && (state.bkWidth = s.bkWidth);\n s.bkHeight != null && (state.bkHeight = s.bkHeight);\n s.x != null && (state.x = s.x);\n s.y != null && (state.y = s.y);\n }", "function update(state){\n database.ref(\"/\").update({\n gameState:state\n });\n}", "function updateState() {\n\n\t\teditHistory.pushState();\n\t\tupdatePageBackground();\n\t}", "updateL2CoinContractAddress(state, L2CoinAddress) {\n state.L2CoinContractAddress = L2CoinAddress\n }", "updateLayer(state) {\n return;\n }", "update(state){\r\n database.ref('/').update({\r\n gameState: state\r\n });\r\n }", "adminUpdate(){\n this.setState({\n users: adminStore.adminReturnUsers(),\n places: adminStore.adminReturnPlaces(),\n events: eventStore.getAllEvents()\n })\n }", "function processUpdate(oldLocation, newLocation, didCapture) {\n checkerState.board[convertSides(newLocation)] = checkerState.board[convertSides(oldLocation)]\n checkerState.board[convertSides(oldLocation)] = \"empty\"\n checkRemoteKingMe();\n\n\n //Ready to own selection\n if (!didCapture) {\n checkerState.State = \"waiting_selection\";\n }\n //Lastly update board\n\n updateBoard();\n \n \n }", "function update() {\n\t\t\n\t}", "update()\n {\n \n }", "function updateRule() {\n let keepAlive = [];\n let resurrect = [];\n\n for (let i = 0; i <= 6; i++) {\n if ($(`#checkAliveHexagon${i}`).is(\":checked\")) keepAlive.push(i);\n if ($(`#checkResurrectHexagon${i}`).is(\":checked\")) resurrect.push(i);\n }\n \n automata.rule = new Rule({\n \"tilingType\": \"Hexagon\",\n \"ruleType\": \"GameOfLife\",\n \"neighbourhoodType\": \"Edge\",\n \"deadValue\": 0,\n \"aliveValue\": 1,\n \"keepAlive\": keepAlive,\n \"resurrect\": resurrect\n });\n }", "function updateState(stateName) {\n localStorage.setItem('stateName', stateName);\n stateArray = find(data, index => index.state === stateName);\n split = (stateArray) ? stateArray.split / 100 : 0;\n makeList(stateArray);\n\n //DISPLAYS SPLIT, CPL AND RIDER INFO TO MAIN SCREEN\n $('#split').text(`UW:${stateArray ? stateArray.UW : ''} split:${stateArray ? stateArray.split : ''} CPL:${stateArray ? stateArray.cpl : ''} Rider:${stateArray ? stateArray.pud : ''}`\n );\n display = (stateArray) ? stateArray.end : false;\n updateCustomAttributes(stateName)\n\n toggleEndorsementCalc(display);\n displayRiskRateDiv()\n checkCalc();\n\n\n}", "function updateGame() {\n updateGameState();\n updateDirection();\n }", "updateSettings(newSettings, key = null) {\n let {uLat, uLon} = this.state.userCoordinates\n if(newSettings[\"sortBy\"] == \"distance\" && (!uLat||!uLon)){\n Alert.alert(\"Please try again\",\"We're still trying to find your location\");\n return;\n }\n if (key) {\n let oldSettings = this.state[key]\n this.setState({[key]: {...oldSettings, ...newSettings}})\n } else {\n this.setState(newSettings)\n }\n \n }", "function updateState(status, state) {\n consolelog('state (before): ' + stateLog());\n if (!isWithinCycle(state)) {\n // change state only if not within cycle \n // (ex: accidental full charge/discharge within cycle)\n var isDischarged = \n !status.isCharging && status.percentage === dischargedLimit;\n if (isDischarged) {\n resetCycle();\n consolelog('resetCycle()');\n }\n }\n if (status.percentage >= upperLimit) {\n if (state.shallow !== 'upper') {\n state.shallow = 'upper';\n setState(state);\n consolelog('shallow = upper');\n }\n } else if (status.percentage <= lowerLimit) {\n if (state.shallow !== 'lower') {\n state.shallow = 'lower';\n setState(state);\n consolelog('shallow = lower');\n }\n }\n consolelog('state (after): ' + stateLog());\n}", "setStateFromQueryParams () {\n const urlParams = new URLSearchParams(window.location.search);\n const paramKeys = ['checkInDate', 'checkOutDate', 'adultsCount', 'teensCount', 'kidsCount', 'roomCount'];\n const newState = {};\n paramKeys.forEach(paramKey => {\n const paramVal = urlParams.get(paramKey);\n if (paramVal !== null) {\n switch (paramKey) {\n case 'checkInDate':\n case 'checkOutDate':\n newState[paramKey] = paramVal;\n break;\n case 'adultsCount':\n case 'teensCount':\n case 'kidsCount':\n case 'roomCount':\n newState[paramKey] = parseInt(paramVal, 10);\n break;\n default:\n break;\n }\n }\n });\n this.setState(newState);\n }", "update(state){\ndatabase.ref('/').update({gamestate:state})\ngameState=state;\n}", "_update() {\n }", "update(startingData) {}", "updateState(state) {\n $('#tournament-name').text(state.casters.tournament);\n $('#tournament-bracket').attr('format', state.tournament.bracket.format);\n\n this.bracket = state.tournament.bracket;\n\n $('#bracket-items').html('');\n for (const r in this.bracket.rounds) {\n $('#bracket-items').append(bracketItem(this.bracket.rounds[r]));\n }\n\n // final\n if ('Final' in this.bracket.rounds) {\n const final = this.bracket.rounds.Final;\n\n if (final.winner === 1) {\n $('#bracket-winner .name').text(final.team1);\n setCSSImage(\n $('#bracket-winner .logo'),\n final.team1Logo && final.team1Logo !== '' ? final.team1Logo : './images/default-logo.png',\n );\n }\n else if (final.winner === 2) {\n $('#bracket-winner .name').text(final.team2);\n setCSSImage(\n $('#bracket-winner .logo'),\n final.team2Logo && final.team2Logo !== '' ? final.team2Logo : './images/default-logo.png',\n );\n }\n else {\n $('#bracket-winner .name').text('');\n setCSSImage($('#bracket-winner .logo'), '');\n }\n }\n }", "function OnStateUpdate(self, state)\n {\n self.state = state.state;\n if (\"brightness\" in state.attributes)\n {\n self.level = state.attributes.brightness\n }\n else\n {\n self.level = 0\n }\n\n set_view(self, self.state, self.level)\n }", "update() { }" ]
[ "0.657095", "0.627396", "0.62181234", "0.6190987", "0.6131534", "0.60751915", "0.605665", "0.5965384", "0.5955696", "0.59434247", "0.58862865", "0.5886038", "0.5868046", "0.58601344", "0.58038276", "0.5797452", "0.57857", "0.5774026", "0.57545376", "0.5752158", "0.5750917", "0.5739067", "0.57347256", "0.5733572", "0.5732388", "0.57315016", "0.57216245", "0.57123274", "0.57081383", "0.5699538", "0.5694637", "0.567278", "0.5670151", "0.5663425", "0.5655852", "0.56461734", "0.56171066", "0.5609051", "0.56021136", "0.56017727", "0.55944973", "0.5587293", "0.5585331", "0.55836105", "0.55787903", "0.55765224", "0.55756164", "0.5574462", "0.5571294", "0.5569847", "0.55662704", "0.5562389", "0.5562389", "0.5562389", "0.5562307", "0.55604535", "0.5558824", "0.5553063", "0.5553063", "0.5553063", "0.5553063", "0.5553063", "0.5553063", "0.5553063", "0.5553063", "0.5553063", "0.5545766", "0.5541152", "0.5538255", "0.5530962", "0.55286837", "0.5527496", "0.5526061", "0.5518529", "0.5518529", "0.55123013", "0.55123013", "0.550721", "0.5503656", "0.5500981", "0.5481013", "0.5470786", "0.546498", "0.5459754", "0.5454943", "0.5451284", "0.5434712", "0.542986", "0.5422725", "0.5422317", "0.5414333", "0.53995013", "0.5386399", "0.537991", "0.5379014", "0.53767866", "0.53662956", "0.5365081", "0.5363807", "0.5362374" ]
0.6581733
0
Change Params > Change Url
setParams(params){ var state_manager = this, url, house, params; if (state_manager.update_in_progress) return false; state_manager.update_in_progress = true; params = Object.assign({}, state_manager.state, params); if (params.house_id){ house = state_manager.houses.find((h)=>{ return h.data.id == params.house_id; }); } else { house = state_manager.state.house || state_manager.houses[0]; params.house_id = house.data.id; } house.verifyMonthState(params); if (params.dataset === 'irradiance'){ params.date_interval = house.verifyPowerRange(params.date_interval || [], params); url = `/irradiance/${params.month}/${params.year}/${params.view}?${query_string.stringify({dates: params.date_interval})}`; } else if (params.dataset === 'energy'){ url = `/houses/${params.house_id}/energy/${params.year}/${params.graph_attr}/${params.view}`; } else { params.date_interval = house.verifyPowerRange(params.date_interval || [], params); url = `/houses/${params.house_id}/power/${params.month}/${params.year}/${params.view}?${query_string.stringify({dates: params.date_interval})}`; } state_manager.history.push(url); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateURL () {\n var newSearch = \"?\" + Object.keys(parameters).filter(function (key) {\n return Boolean(parameters[key])\n }).map(function (key) {\n return encodeURIComponent(key) + \"=\" + encodeURIComponent(parameters[key])\n }).join(\"&\");\n history.replaceState(null, null, newSearch)\n }", "function updateUrlParam() {\n // Update url parameter\n window.history.replaceState(\n null,\n null,\n `?page=${page}&limit=${perPage}&past-events=${pastEvents}`\n ); // -> set url param\n}", "function updateURL () {\n var parms = QueryParams.map(input => {\n var parm = input.queryStringParm;\n return parm + \"=\" + encodeURIComponent(input.location.val());\n });\n var s = parms.join(\"&\");\n window.history.pushState(null, null, location.origin+location.pathname+\"?\"+s);\n }", "function updateURL() {\n var filters = window.getPostFilterValues();\n var params = '';\n for(let key in filters){\n var val = filters[key];\n if (typeof val === 'object') {\n params += key + '=' + val.join(',') + \"&\";\n }else{\n params += key + '=' + val + \"&\";\n }\n }\n params = params.length > 0 ? params.substr(0, params.length - 1) : params;\n var newUrl = window.location.href;\n newUrl = newUrl.split('?')[0] + ('?' + params);\n window.history.pushState(null, null, newUrl);\n }", "changeUrl(pageNumber) \r\n\t{\r\n\t\tUrl.changeParameter(this.settings.url_parameter, pageNumber, this.settings.separator);\r\n\t}", "function changeUrlParam (param, value) {\n var currentURL = window.location.href+'&';\n var change = new RegExp('('+param+')=(.*)&', 'g');\n var newURL = currentURL.replace(change, '$1='+value+'&');\n\n if (getURLParameter(param) !== null){\n try {\n window.history.replaceState('', '', newURL.slice(0, - 1) );\n } catch (e) {\n console.log(e);\n }\n } else {\n var currURL = window.location.href;\n if (currURL.indexOf(\"?\") !== -1){\n window.history.replaceState('', '', currentURL.slice(0, - 1) + '&' + param + '=' + value);\n } else {\n window.history.replaceState('', '', currentURL.slice(0, - 1) + '?' + param + '=' + value);\n }\n }\n}", "function changeUrlParam(param, value) {\r\n var currentURL = window.location.href + '&';\r\n var change = new RegExp('(' + param + ')=(.*)&', 'g');\r\n var newURL = currentURL.replace(change, '$1=' + value + '&');\r\n\r\n if (getURLParameter(param) !== null) {\r\n try {\r\n window.history.replaceState('', '', newURL.slice(0, -1));\r\n } catch (e) {\r\n console.log(e);\r\n }\r\n } else {\r\n var currURL = window.location.href;\r\n if (currURL.indexOf(\"?\") !== -1) {\r\n window.history.replaceState('', '', currentURL.slice(0, -1) + '&' + param + '=' + value);\r\n } else {\r\n window.history.replaceState('', '', currentURL.slice(0, -1) + '?' + param + '=' + value);\r\n }\r\n }\r\n}", "updateUrl(action, params) {\n\n let url_params = {\n profile: params.profile,\n 'test-name': params.testName,\n 'data-provider': params.dataProvider,\n version: params.version,\n level: params.level\n };\n\n switch (action.isById) {\n case true:\n this.url = `${this.initUrl}${action.url}/${params.id}`\n break;\n\n case false:\n let queryParams = this.$httpParamSerializer(\n _.transform(url_params, (res, v, k) => {\n if (v) res[k] = v;\n }));\n this.url = `${this.initUrl}${action.url}?${queryParams}`;\n break;\n\n case 'irrelevant':\n url_params[id] = params.id;\n let queryParam = this.$httpParamSerializer(\n _.transform(url_params, (res, v, k) => {\n if (v) res[k] = v;\n }));\n this.url = `${this.initUrl}${action.url}?${queryParam}`;\n break;\n }\n }", "function updateParam(name, value) {\n var newUrlHash = biomart.url.jsonify(location.href);\n if (value) biomart.params[name] = value;\n else delete biomart.params[name];\n _urlHash.query = $.param(biomart.params);\n newUrlHash.fragment = biomart.url.stringify(_urlHash);\n location = biomart.url.stringify(newUrlHash);\n }", "function updateURL(paramName, value) {\n let urlData = queryString.parse(window.location.hash)\n urlData[paramName] = value\n window.location.hash = queryString.stringify(urlData)\n}", "function update_url_inplace(param, newvalue) {\n var newurl = new URL(window.location);\n var params = new URLSearchParams(newurl.search);\n params.set(param, newvalue);\n\n newurl.search = params.toString();\n var updated = newurl.toString();\n history.replaceState({path: updated}, '', updated);\n}", "function setURLParameters(paramobjs) {\n let nurl = new URL(window.location.href);\n let first = true;\n for (let key in paramobjs) {\n if (first) {\n nurl.searchParams.set(paramobjs[key].paramname, paramobjs[key].paramvalue);\n first = false;\n } else {\n nurl.searchParams.append(paramobjs[key].paramname, paramobjs[key].paramvalue);\n }\n }\n history.pushState('', document.title, nurl.toString());\n}", "function setUrl(newValue, oldValue) {\n // set the full url\n $location.search({\n species: $scope.browserLocation.genome, // filter is from Genoverse module\n chromosome: $scope.browserLocation.chromosome,\n start: $scope.browserLocation.start,\n end: $scope.browserLocation.end\n });\n $location.replace();\n }", "function setRouteParameters(params, saveHistory = false) {\r\n let url = UU5.Common.Url.parse(window.location.href.replace(/#.*/, \"\"))\r\n .set({ parameters: params })\r\n .toString();\r\n if (saveHistory) {\r\n history.pushState({}, document.title, url);\r\n } else {\r\n history.replaceState({}, document.title, url);\r\n }\r\n}", "changeUrl()\n\t{\n\t\tUrl.change('checkout');\n\t}", "function SetURLParameter(param_name, param_value, url)\n{\n if (!url)\n {\n url = window.location.href;\n }\n var new_url = \"\";\n // find the parameter is in the URL\n var param_pos = url.indexOf(\"?\" + param_name + \"=\");\n if (0 > param_pos)\n {\n param_pos = url.indexOf(\"&\" + param_name + \"=\");\n }\n if (0 > param_pos)\n {\n param_pos = url.indexOf(\"&amp;\" + param_name + \"=\");\n }\n // check if the parameter was found\n if (0 > param_pos)\n {\n // param_name field not found\n new_url = url + \"&\" + param_name + \"=\" + param_value;\n }\n else\n {\n // param_name field found, update the parameter\n ++param_pos;\n // check if other parameters follow\n var next_param_pos = url.indexOf(\"&\", param_pos);\n if (0 > next_param_pos)\n {\n // nothing follows\n new_url = url.substr(0, param_pos) + param_name + \"=\" + param_value;\n }\n else\n {\n // other parameters follow\n new_url = url.substr(0, param_pos) + url.substr(next_param_pos + 1) + \"&\" + param_name + \"=\" + param_value;\n }\n }\n return new_url;\n}", "function setUrl(params) {\n\t\tvar key,\n querystring = \"?\";\n\n\t\tparams = QUnit.extend(QUnit.extend({}, QUnit.urlParams), params);\n\n\t\tfor (key in params) {\n\t\t\tif (params.hasOwnProperty(key)) {\n\t\t\t\tif (hasOwn.call(params, key)) {\n\t\t\t\t\tif (params[key] === undefined) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tquerystring += encodeURIComponent(key);\n\t\t\t\t\tif (params[key] !== true) {\n\t\t\t\t\t\tquerystring += \"=\" + encodeURIComponent(params[key]);\n\t\t\t\t\t}\n\t\t\t\t\tquerystring += \"&\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn location.protocol + \"//\" + location.host +\n location.pathname + querystring.slice(0, -1);\n\t}", "function updateUrl() {\n urlRouter.updateUrl(urlRouter.buildExploreUrlFromPrefs());\n }", "_changeUrl(url) {\n this.rawUrl = url;\n }", "function modify_url(url, new_params, new_url_parts) {\n var url = decompose_url(url)\n $.extend(url.params, new_params)\n $.extend(url, new_url_parts || {})\n return url.netloc + url.path + url.file + '?' + $.param(url.params) + url.hash;\n}", "function updateParamsToUrl(paramKey, paramValue) {\n\n paramValue = window.btoa(JSON.stringify(paramValue));\n\n var nextUrl = window.location.origin + window.location.pathname;\n\n var params = getUrlVars(); //Get all the query params as an ARRAY\n\n var size = Object.keys(params).length;\n var i = 0;\n if (size == 0) {\n window.location.href = window.location.href + \"?\" + paramKey + \"=\" + paramValue;\n } else {\n\n nextUrl += '?'; // ? for started to attach the query string to url\n\n params[paramKey] = paramValue;\n\n // This is for search,selection by any one of ways => BRAND or SEARCH Keyword\n if (paramKey == 'search' && params['brand'] != undefined) {\n params['brand'] = '';\n }\n if (paramKey == 'brand' && params['search'] != undefined) {\n params['search'] = '';\n }\n\n if (paramKey == 'brand') {\n params['width'] = '';\n params['diameter'] = '';\n }\n\n // Attach the query params to the nextURL \n $.each(params, function(key, value) {\n if (value != '') {\n if (i == size) {\n nextUrl += key + '=' + value;\n } else {\n nextUrl += key + '=' + value + '&';\n }\n }\n\n i++;\n });\n\n\n window.location.href = nextUrl;\n }\n}", "function updateQuery() {\n var newUrl = window.location.href;\n // clean out valueless parameters to simplify ensuing matching\n newUrl = newUrl.replace(/(.*[?&])param1(&(.*))?$/, \"$1$3\");\n if (param1 !== default1) {\n if (newUrl.match(/[?&]param1=/)) {\n newUrl = newUrl.replace(/(.*[?&]param1=)[^&]*(.*)/, '$1' + param1 + '$2');\n } else if (newUrl.indexOf('?') > 0) {\n newUrl = newUrl + '&param1=' + param1;\n } else {\n newUrl = newUrl + '?param1=' + param1;\n }\n } else {\n newUrl = newUrl.replace(/(.*[?&])param1=[^&]*&?(.*)/, '$1$2');\n }\n\n // tidy up\n if (newUrl.match(/[?&]$/)) {\n newUrl = newUrl.slice(0, -1);\n } \n window.history.pushState('', '', newUrl);\n}", "function updateURLWithParams(paramsToUpdate, doReplace) {\n const url = new URL(window.location);\n for (const [param, val] of Object.entries(paramsToUpdate)) {\n if (val != undefined && (!val.trim || val.trim() !== \"\")) {\n url.searchParams.set(param, val);\n }\n else {\n url.searchParams.delete(param);\n }\n }\n updateURLTo(url, doReplace);\n}", "addParamToURL(urlParam) {\n if (this.props.showArticleFinder) { return; }\n window.history.pushState({}, '', `?showArticle=${urlParam}`);\n }", "function updateParamsByUrl(){\n\t\t\n\t\tvar emptyCnt=resetAllTxtFields(\"paramKeyTxtName[]\");\n\t\tvar fullUrl = $('#OData').find('[name=\"oDataURL\"]').val();\n\t\t\n\t\tif(fullUrl!=null)\tfullUrl = fullUrl.trim();\n\t\t\n\t\tvar urlArr = fullUrl.split(\"?\");\n\t\tvar paramArr = \"\";\n\t\t//var paramStr = urlArr[1]; \n\t\tif( urlArr[1]!=null ){\n\t\t\tparamArr = urlArr[1].split(\"&\");\t\n\t\t}\n\t\t\n\t\tvar keyvalArr;\n\t\t\n\t\tif(paramArr!=null && paramArr.length>0){\n\t\t\tvar paramId, paramVal;\n\t\t\tfor(var idx=0; idx< paramArr.length; idx++){\n\t\t\t\tkeyvalArr = paramArr[idx].split(\"=\");\n\t\t\t\tparamId = keyvalArr[0];\n\t\t\t\tparamVal = keyvalArr[1];\n\t\t\t\tif(paramId === undefined) \tparamId=\"\";\n\t\t\t\tif(paramVal === undefined) \tparamVal=\"\";\n\t\t\t\tif(paramId!=\"\"){\n\t\t\t\t\taddParamRow(paramId,paramVal);\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfor(var empCnt=0; empCnt<emptyCnt ; empCnt++){\n\t\t\t\taddParamRow(\"\",\"\");\n\t\t\t}\t\t\t\n\t\t}else{//Add a empty row if no parameter field\n\t\t\taddParamRow(\"\",\"\");\n\t\t}\n\t\t\n\t\t$(\"#oDataURL\").removeClass(\"txtFocusClass\");\n\t\t$(\"#oDataURL\").addClass(\"defaultTxtClass\");\n\t}", "function replaceParams() {\n var href = $(this).attr(\"href\") || $(this).serialize()\n href = PlaceGuide.cleanParamString(href)\n var state = href.match(/[\\?\\&]/) ? $.deparam.querystring(href) : {}\n $.bbq.pushState(state, PlaceGuide.REPLACE_EXISTING)\n return false\n }", "function setQueryParameter(name, val) {\n\tfunction updateURLParameter(url, param, paramVal){\n\t\tvar newAdditionalURL = \"\";\n\t\tvar tempArray = url.split(\"?\");\n\t\tvar baseURL = tempArray[0];\n\t\tvar additionalURL = tempArray[1];\n\t\tvar temp = \"\";\n\t\tif (additionalURL) {\n\t\t\ttempArray = additionalURL.split(\"&\");\n\t\t\tfor (var i=0; i<tempArray.length; i++){\n\t\t\t\tif(tempArray[i].split('=')[0] !== param){\n\t\t\t\t\tnewAdditionalURL += temp + tempArray[i];\n\t\t\t\t\ttemp = \"&\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar rows_txt = temp + \"\" + param + \"=\" + paramVal;\n\t\treturn baseURL + \"?\" + newAdditionalURL + rows_txt;\n\t}\n\n\twindow.history.replaceState('', '', updateURLParameter(window.location.href, name, val.toString()));\n}", "function set_url(query) {\n var val = [];\n val.push(\"court\" + \"=\" + query.Court);\n if(query.Phase !== \"all\")\n val.push(\"phase\" + \"=\" + query.Phase)\n ;\n if(query.State !== \"all\")\n val.push(\"state\" + \"=\" + query.State)\n ;\n // if(highlight) val.push(\"highlight=\" + highlight);\n history.pushState(null, null, '?' + val.join('&'));\n }", "setParams() {\n helpers.setURLParams('?tool='+toolParam)\n }", "setParams() {\n helpers.setURLParams('?tool='+toolParam)\n }", "setParams() {\n helpers.setURLParams('?tool='+toolParam)\n }", "function addOrUpdateUrlParameterValue(key, value) {\n var url = window.location.href;\n var regExp = new RegExp(\"([?&])\" + key + \"=.*?(&|$)\", \"i\");\n var separator = url.indexOf('?') !== -1 ? \"&\" : \"?\";\n if (url.match(regExp)) {\n window.history.pushState({}, null, url.replace(regExp, '$1' + key + \"=\" + value + '$2'));\n } else {\n window.history.pushState({}, null, url + separator + key + \"=\" + value);\n }\n}", "function updateQueryStringParameter(key, value) {\n let uri = window.location.href;\n let re = new RegExp(\"([?&])\" + key + \"=.*?(&|$)\", \"i\");\n let separator = uri.indexOf('?') !== -1 ? \"&\" : \"?\";\n if (key === 'bldg') {\n uri = removeParam('flr', uri);\n }\n if (uri.match(re)) {\n window.location.href = uri.replace(re, '$1' + key + \"=\" + value + '$2');\n } else {\n window.location.href = uri + separator + key + \"=\" + value;\n }\n}", "function updateURLParameter(url, param, paramVal) {\n\tvar theAnchor = null;\n\tvar newAdditionalURL = \"\";\n\tvar tempArray = url.split(\"?\");\n\tvar baseURL = tempArray[0];\n\tvar additionalURL = tempArray[1];\n\tvar temp = \"\";\n\n\tif (additionalURL) {\n\t\tvar tmpAnchor = additionalURL.split(\"#\");\n\t\tvar theParams = tmpAnchor[0];\n\t\ttheAnchor = tmpAnchor[1];\n\t\tif (theAnchor) {\n\t\t\tadditionalURL = theParams;\n\t\t}\n\n\t\ttempArray = additionalURL.split(\"&\");\n\n\t\tfor (i = 0; i < tempArray.length; i++) {\n\t\t\tif (tempArray[i].split('=')[0] != param) {\n\t\t\t\tnewAdditionalURL += temp + tempArray[i];\n\t\t\t\ttemp = \"&\";\n\t\t\t}\n\t\t}\n\t} else {\n\t\tvar tmpAnchor = baseURL.split(\"#\");\n\t\tvar theParams = tmpAnchor[0];\n\t\ttheAnchor = tmpAnchor[1];\n\n\t\tif (theParams) {\n\t\t\tbaseURL = theParams;\n\t\t}\n\t}\n\n\tif (theAnchor) {\n\t\tparamVal += \"#\" + theAnchor;\n\t}\n\n\tvar rows_txt = temp + \"\" + param + \"=\" + paramVal;\n\treturn baseURL + \"?\" + newAdditionalURL + rows_txt;\n}", "function addParamter(name, value, addParamHeader) {\n var url = window.location.href.substr(window.location.href.lastIndexOf(\"/\") + 1); //window.location.href;\n //check if already in location\n var regex = new RegExp(\"([?&]\" + name + \"=)(([^&#]*)|&|#|$)\");\n if (regex.test(url)) {\n //replace the existing value\n //window.location.href = url.replace(regex, '$1' + value);\n history.replaceState(null, \"\", url.replace(regex, '$1' + value));\n } else {\n //append to the end of the url\n //window.location.href = url + (/\\?/.test(url) ? \"&\" : \"?\") + name + \"=\" + value;\n history.replaceState(null, \"\", url + (/\\?/.test(url) ? \"&\" : \"?\") + name + \"=\" + value);\n }\n}", "static setUrl({\n protocol = this.getProtocol(),\n host = this.getHost(),\n path = this.getPath(),\n search = this.getSearch(),\n hash = this.getHash()\n })\n {\n protocol = encodeURI(protocol);\n host= encodeURI(host);\n path = encodeURI(path);\n search = encodeURI(search);\n hash = encodeURI(hash);\n let url = protocol + \"//\" + host + path + search + hash;\n window.history.pushState({path: url}, '', url);\n }", "function updateQueryStringParameter(kvpairs) {\n console.log('updateQueryStringParameter: begin');\n var uri = URI(window.location.href);\n\n for (var key in kvpairs) {\n\tvar value = kvpairs[key];\n\turi.removeSearch(key);\n\turi.addSearch(key, value);\n }\n\n return uri.href();\n}", "function addOrUpdateUrlParameterValue(key, value) {\n var url = window.location.href;\n var regExp = new RegExp(\"([?&])\" + key + \"=.*?(&|$)\", \"i\");\n var separator = url.indexOf(\"?\") !== -1 ? \"&\" : \"?\";\n\n if (url.match(regExp)) {\n window.history.pushState({}, null, url.replace(regExp, \"$1\" + key + \"=\" + value + \"$2\"));\n } else {\n window.history.pushState({}, null, url + separator + key + \"=\" + value);\n }\n} // Document ready", "function reload_with_new_param(param, value){\n var per_page_added = false;\n var url = window.location.href;\n var base_url = window.location.href.indexOf('?') > 0 ? window.location.href.split(\"?\")[0] : window.location.href\n var new_params = \"\";\n var params = window.location.href.indexOf('?') > 0 ? window.location.href.split(\"?\")[1] : \"\"\n if(params != \"\"){\n var parts = params.indexOf('&') > 0 ? params.split(\"&\") : new Array(params)\n for (var i = 0; i < parts.length; i++ )\n {\n if(!(param == 'per_page' && parts[i].split(\"=\")[0] == 'page')){\n if( parts[i].split(\"=\")[0] == param){\n per_page_added = true\n new_params = new_params + (new_params == 0 ? \"?\"+param+\"=\"+value : \"&\"+param+\"=\"+value)\n }else{\n if(parts[i].split(\"=\")[0] != param){\n new_params = new_params + (new_params == 0 ? \"?\"+parts[i] : \"&\"+parts[i])\n }\n }\n }\n \n\n }\n new_params = !per_page_added ? (new_params != 0 ? new_params+\"&\"+param+\"=\"+value : \"?\"+param+\"=\"+value ) : new_params\n }\n window.location.href = base_url + (new_params == 0 ? \"?\"+param+\"=\"+value : new_params)\n}", "function changeUrlTalents(talents) {\n $location.search('talents', generateUrlTalents(talents));\n }", "function updateQueryStringParam(key, value) {\n baseUrl = [location.protocol, '//', location.host, location.pathname].join('');\n urlQueryString = document.location.search;\n var newParam = key + '=' + value,\n params = '?' + newParam;\n\n // If the \"search\" string exists, then build params from it\n if (urlQueryString) {\n keyRegex = new RegExp('([\\?&])' + key + '[^&]*');\n // If param exists already, update it\n if (urlQueryString.match(keyRegex) !== null) {\n params = urlQueryString.replace(keyRegex, \"$1\" + newParam);\n } else { // Otherwise, add it to end of query string\n params = urlQueryString + '&' + newParam;\n }\n }\n window.history.replaceState({}, \"\", baseUrl + params);\n}", "function setUrlParams(){\n (window.onpopstate = function () {\n var match,\n pl = /\\+/g, // Regex for replacing addition symbol with a space\n search = /([^&=]+)=?([^&]*)/g,\n decode = function (s) { return decodeURIComponent(s.replace(pl, \" \")); },\n query = window.location.search.substring(1);\n\n urlParams = new setUrlParamDefaults();\n while (match = search.exec(query))\n urlParams[decode(match[1])] = decode(match[2]);\n })();\n}", "function updateURL(url, key, value) {\n var re = new RegExp(\"([?&])\" + key + \"=.*?(&|$)\", \"i\"),\n separator = url.indexOf('?') !== -1 ? \"&\" : \"?\";\n return url.match(re) ? url.replace(re, '$1' + key + \"=\" + value + '$2') : url + separator + key + \"=\" + value;\n }", "function setUrl(state) {\n const currentIndex = state.editCartItem;\n const currentQuery = queryString.parse(window.location.search)\n const item = state.cart[currentIndex];\n if (!item) {\n return;\n }\n\n const mapItem = cartItemToMapItem(item);\n\n const newQuery = _.extend({}, currentQuery, {\n lat: mapItem.mapCenter.lat.toFixed(4),\n lng: mapItem.mapCenter.lng.toFixed(4),\n zoom: mapItem.mapZoom,\n size: mapItem.size,\n orientation: mapItem.orientation,\n material: mapItem.material,\n mapStyle: mapItem.mapStyle,\n posterStyle: mapItem.posterStyle,\n labelsEnabled: mapItem.labelsEnabled,\n labelHeader: mapItem.labelHeader,\n labelSmallHeader: mapItem.labelSmallHeader,\n labelText: mapItem.labelText,\n updateCoords: item.autoUpdateCoordinates,\n });\n\n window.history.replaceState(null, null, `?${queryString.stringify(newQuery)}`);\n}", "function setParam(url, paramName, value){\n url = url || '';\n\n var re = new RegExp('(\\\\?|&)'+ paramName +'=[^&]*' );\n var param = paramName +'='+ encodeURIComponent( value );\n\n if ( re.test(url) ) {\n return url.replace(re, '$1'+ param);\n } else {\n if (url.indexOf('?') === -1) {\n url += '?';\n }\n if (url.indexOf('=') !== -1) {\n url += '&';\n }\n return url + param;\n }\n\n }", "function modifyURL(newUrl) {\r\n\tif (window.history.pushState && window.history.replaceState) {\r\n\t\twindow.history.pushState({}, document.title, newUrl);\r\n\t}\r\n}", "function updatePageUrl() {\n // here we have updated the globals so we will take the url data from the history object\n // unless its the list view where we use the default dates\n // (if we were coming from the updated url ones the setPageUrl method would trigger instead of this one)\n if (scheduled.currentView == 'list') {\n scheduled.listDateStart = scheduled.defaultlistDateStart;\n scheduled.listDateEnd = scheduled.defaultlistDateEnd;\n }\n\n var urlParams = createUrl();\n var url = window.location.origin + window.location.pathname + urlParams;\n History.pushState(null, null, url);\n }", "function finalurl() {\n var url = new URL(window.location.href);\n var search_params = url.searchParams;\n search_params.set('sorting', document.getElementById(\"sort-list\").value);\n url.search = search_params.toString();\n var new_url = url.toString();\n return new_url\n }", "function removeParam() {\n window.history.pushState({}, document.title, \"/trade\");\n }", "function changeUrl(title, url) {\n if (typeof (history.pushState) != \"undefined\") {\n var obj = { Title: title, Url: url };\n history.pushState(obj, obj.Title, obj.Url);\n } else {\n alert(\"Browser does not support HTML5.\");\n }\n }", "function PassParameters(el){\n\n\tvar source = getParameterByName('utm_source');\n\tvar medium = getParameterByName('utm_medium');\n\tvar campaign = getParameterByName('utm_campaign');\n\tvar content = getParameterByName('utm_content');\n\tvar term = getParameterByName('utm_term');\n\tvar newURL = \"https://donate.starlight.org.au/what-would-you-do//?\";\n\n\tif (source != \"\"){\n\t\tnewURL += \"utm_source=\" + source;\n\t}\n\tif (medium != \"\"){\n\t\tnewURL += \"&utm_medium=\" + medium;\n\t}\n\n\tif (campaign != \"\") {\n\t\tnewURL += \"&utm_campaign=\" + campaign;\n\t}\n\n\tif (term != \"\") {\n\t\tnewURL += \"&utm_term=\" + term;\n\t}\n\n\tif (content != \"\"){\n\t\tnewURL += \"&utm_content=\" + content;\n\t}\n\n\n\t$(el).attr('href', newURL); \n\n}", "function updateUrl() {\n const out = [\n state.sv,\n state.endTime,\n ];\n\n for (const row of state.rows) {\n out.push(row.label);\n out.push(row.duration);\n }\n const encodedState = btoa(JSON.stringify(out));\n window.history.replaceState(null, '', `?state=${encodedState}`);\n}", "function setPageURL(pagename, urlparams = undefined) {\n cleanURL().then(function () {\n switch (pagename) {\n case 'course_professormenu':\n case 'course_studentmenu':\n case 'panel-left':\n case 'desktopmainmenu':\n break;\n case 'coursehome':\n location.hash = pagename;\n setTimeout(function () {\n setURLParameters([{\n paramname: 'id',\n paramvalue: currentcourse.courseid\n }]);\n }, 300);\n break;\n default:\n location.hash = pagename;\n if (typeof urlparams !== 'undefined') {\n setTimeout(function () {\n setURLParameters(urlparams);\n }, 300);\n }\n }\n });\n}", "function addParameterToURL(url, key, val){\n\t\turl += (url.split('?')[1] ? '&':'?') + key + \"=\" + val;\n\t\treturn url;\n\t}", "function setUrlParameters(address, parameters) {\n\tvar ret = address;\n\tif (ret.indexOf('?') >= 0) {\n\t\tret = ret.substring(0, ret.indexOf('?'));\n\t}\n\treturn ret + '?' + $.param(parameters);\n}", "pushParams() {\n const entities = this.getEntities(),\n targetKeyword = this.isCategory() ? 'category' : 'files';\n\n if (window.history && window.history.replaceState) {\n window.history.replaceState({}, document.title,\n `?${$.param(this.getParams())}&${targetKeyword}=${entities.join('|')}`\n );\n }\n\n $('.permalink').prop('href', `?${$.param(this.getPermaLink())}&${targetKeyword}=${entities.join('%7C')}`);\n }", "function setURLParameter(url, name, value) {\n const urlParsed = coreHttp.URLBuilder.parse(url);\n urlParsed.setQueryParameter(name, value);\n return urlParsed.toString();\n}", "function setURLParameter(url, name, value) {\n const urlParsed = coreHttp.URLBuilder.parse(url);\n urlParsed.setQueryParameter(name, value);\n return urlParsed.toString();\n}", "function addURLParam(element, newParam){\r\n var originalSrc = element.attr('src');\r\n element.attr('src', originalSrc + getUrlParamSign(originalSrc) + newParam);\r\n }", "function addURLParam(element, newParam){\r\n var originalSrc = element.attr('src');\r\n element.attr('src', originalSrc + getUrlParamSign(originalSrc) + newParam);\r\n }", "function addURLParam(element, newParam){\r\n var originalSrc = element.attr('src');\r\n element.attr('src', originalSrc + getUrlParamSign(originalSrc) + newParam);\r\n }", "function addURLParam(element, newParam){\n var originalSrc = element.attr('src');\n element.attr('src', originalSrc + getUrlParamSign(originalSrc) + newParam);\n }", "function addURLParam(element, newParam){\n var originalSrc = element.attr('src');\n element.attr('src', originalSrc + getUrlParamSign(originalSrc) + newParam);\n }", "function addURLParam(element, newParam) {\n var originalSrc = element.attr('src');\n element.attr('src', originalSrc + getUrlParamSign(originalSrc) + newParam);\n }", "function set_url_params(query, init_query) {\n var base_url = script_vars.current_url;\n var base_url_depaged = script_vars.current_url_depaged;\n var url = '';\n\n Object.keys(query).forEach(function(key) {\n console.log(query[key])\n // Go through each query key and set/delete url param\n if (typeof query[key] != 'undefined') {\n if(url) {\n url += '&';\n }\n url+= key + '=' + query[key];\n }\n })\n\n if(url) {\n url = '?' + url;\n }\n\n // If query has changed navigate to depaged base url (reset the page)\n if (query !== init_query) {\n // TODO - determine whether we need to detect page has not changed\n base_url = base_url_depaged;\n }\n\n window.location = base_url + url;\n }", "function addParamsToURL(){\n\t\t\n\t\tif (!$(\"#tsvDownload\").attr('baseDownloadLink')){\n\t\t\t$(\"#tsvDownload\").attr('baseDownloadLink', $(\"#tsvDownload\").attr('href'));\n\t\t}\n\n\t\tif (!$(\"#xlsDownload\").attr('baseDownloadLink')){\n\t\t\t$(\"#xlsDownload\").attr('baseDownloadLink', $(\"#xlsDownload\").attr('href'));\n\t\t}\n\t\t\n\t\tvar link = $(\"#tsvDownload\").attr('baseDownloadLink');\n\t\tlink += selectedFilters;\n\t\t$(\"#tsvDownload\").attr('href', link);\n\n\t\tlink = $(\"#xlsDownload\").attr('baseDownloadLink');\n\t\tlink += selectedFilters;\n\t\t$(\"#xlsDownload\").attr('href', link);\n\t}", "function changeURL(title, url) {\n var baseURL = \"categories.html?cat=\";\n var obj = {Title: title, Url: url};\n history.pushState(obj, obj.Title, obj.Url);\n }", "function setParams(state) {\r\n var selector = state.activeFilter.selector;\r\n var newParam = \"?filter=\" + selector.replace(/^\\./g, \"\");\r\n\r\n if (selector === targetSelector && getSelectorFromParam()) {\r\n // Equivalent to filter \"all\", remove the hash\r\n history.pushState(null, document.title, window.location.pathname);\r\n // or history.replaceState()\r\n } else if (\r\n newParam !== getSelectorFromParam() &&\r\n selector !== targetSelector\r\n ) {\r\n // Change the hash\r\n history.pushState(\r\n null,\r\n document.title,\r\n window.location.pathname + newParam\r\n ); // or history.replaceState()\r\n }\r\n }", "_changeUrl(url) {\n var self = this;\n self.endpoint = url;\n }", "function setDataUrlParams(params)\n\t{\n\t\tobjThis.selectorElt.tagSuggest().setDataUrlParams(params);\n\t}", "function modifyTourUri(){\n\t\tserverUri = Parameters.getTourServerUri() + \"/path\";\n\t}", "function updateQueryString(key, value, url) {\n if (!url) url = window.location.href;\n var re = new RegExp(\"([?&])\" + key + \"=.*?(&|#|$)(.*)\", \"gi\"),\n hash;\n\n if (re.test(url)) {\n if (typeof value !== 'undefined' && value !== null) {\n return url.replace(re, '$1' + key + \"=\" + value + '$2$3');\n } else {\n hash = url.split('#');\n url = hash[0].replace(re, '$1$3').replace(/(&|\\?)$/, '');\n if (typeof hash[1] !== 'undefined' && hash[1] !== null)\n url += '#' + hash[1];\n return url;\n }\n }\n else {\n if (typeof value !== 'undefined' && value !== null) {\n var separator = url.indexOf('?') !== -1 ? '&' : '?';\n hash = url.split('#');\n url = hash[0] + separator + key + '=' + value;\n if (typeof hash[1] !== 'undefined' && hash[1] !== null) {\n url += '#' + hash[1];\n }\n return url;\n } else {\n return url;\n }\n }\n }", "function updateQueryString(key, value, url) {\n// \n// see http://stackoverflow.com/questions/5999118/add-or-update-query-string-parameter\n// \n if (!url) url = window.location.href;\n var re = new RegExp(\"([?&])\" + key + \"=.*?(&|#|$)(.*)\", \"gi\"),\n hash;\n\n if (re.test(url)) {\n if (typeof value !== 'undefined' && value !== null)\n return url.replace(re, '$1' + key + \"=\" + value + '$2$3');\n else {\n hash = url.split('#');\n url = hash[0].replace(re, '$1$3').replace(/(&|\\?)$/, '');\n if (typeof hash[1] !== 'undefined' && hash[1] !== null) \n url += '#' + hash[1];\n return url;\n }\n }\n else {\n if (typeof value !== 'undefined' && value !== null) {\n var separator = url.indexOf('?') !== -1 ? '&' : '?';\n hash = url.split('#');\n url = hash[0] + separator + key + '=' + value;\n if (typeof hash[1] !== 'undefined' && hash[1] !== null) \n url += '#' + hash[1];\n return url;\n }\n else\n return url;\n }\n}", "function updateUrl() {\n // If we're missing some direction preferences in the URL, we'll update\n // the URL to include them.\n // Replace url state in this case to avoid an infinite loop in browser history\n var replaceUrlState = urlRouter.directionsPrefsMissingFromUrl();\n urlRouter.updateUrl(urlRouter.buildDirectionsUrlFromPrefs(), replaceUrlState);\n }", "function redirectWithNewParam(a,b) {\r\n\t\tvar c,d;\r\n\t\tc=window.location.href;\r\n\t\tc=c.split(\"#\");\r\n\t\td=c.length==2?\"#\"+c[1]:\"\";\r\n\t\tc=c[0];\r\n\t\tvar e=c.match(/[\\?&]\\w+=[^&#]*/g), f={};\r\n\t\tif(e) for(var g=0;g<e.length;++g){\r\n\t\t\te[g]=e[g].split(\"=\");\r\n\t\t\tf[e[g][0].substring(1)]=decodeURIComponent(e[g][1].replace(/\\+/g,\"%20\"))\r\n\t\t}\r\n\t\tf[b]=a;\r\n\t\tf[\"persist_\"+b]=\"1\";\r\n\t\tc=c.split(\"?\");\r\n\t\tc=c[0];\r\n\t\toj(c,f,d);\r\n\t}", "function cambiarUrl(thisObj){\n\tvar campo = thisObj.attr('name');\n\tvar valor = thisObj.val();\n\tvar nombrePath = window.location.pathname;\n\tvar parametrosInput = thisObj.parents('form').find('#parametrosUrl').val();\n\n\t\n\twindow.history.replaceState(\"object\", nombrePath, nombrePath +'?'+ parametrosInput);\n\n\tthisObj.parents('form').find('#parametrosUrl').val(parametrosInput);\n\n\tvar parametrosUrl = {};\n\tvar campoCambiado = false;\n\n\tif (location.search) {\n\t var parts = location.search.substring(1).split('&');\n\t parametrosInput = '';\n\t for (var i = 0; i < parts.length; i++) {\n\t var nv = parts[i].split('=');\n\t if (!nv[0]) continue;\n\t if(nv[0] == campo){\n\t \tnv[1] = valor;\n\t \tcampoCambiado = true;\n\t }\n\t parametrosInput = parametrosInput + ((parametrosInput)? '&' : '') + nv[0] +'='+ nv[1];\n\t //guarda los parametros en un array\n\t parametrosUrl[nv[0]] = nv[1] || true;\n\t if (campoCambiado) {\n\t \tif ( thisObj.hasClass('select_dynamic') ) { break; }\n\t }\n\t \n\t }\n\t}\n\tif (!campoCambiado) {\n\t\tparametrosInput = parametrosInput + ((parametrosInput)? '&' : '') + campo +'='+ valor;\n\t}\n \n thisObj.parents('form').find('#parametrosUrl').val(parametrosInput);\n\n\twindow.history.replaceState(\"object\", nombrePath, nombrePath +'?'+ parametrosInput);\n\t\n}", "GoTo(route, params, query){// function used to change the path of our browser\n var path = routes[route].path(params)\n var qs = Qs.stringify(query)\n var url = path + (qs == '' ? '' : '?'+qs)\n history.pushState({},\"\",url)\n Link.onPathChange()\n }", "function setNewUrl(url, title) {\n if (!title)\n title = 'default';\n go_back_uri.push('/' + window.location.href.replace(/^(?:\\/\\/|[^\\/]+)*\\//, \"\"));\n window.history.pushState({urlPath: url}, title, url);\n}", "removeParamFromURL(event) {\n if (this.props.showArticleFinder) { return; }\n const viewer = document.getElementsByClassName('article-viewer')[0];\n if (!viewer || event) {\n if (window.location.search) {\n window.history.replaceState(null, null, window.location.pathname);\n }\n }\n }", "function UpdateQueryString(key, value, url) {\n\tif (!url)\n\t\turl = window.location.href;\n\tvar re = new RegExp(\"([?&])\" + key + \"=.*?(&|#|$)(.*)\", \"gi\"),\n\t hash;\n\n\tif (re.test(url)) {\n\t\tif ( typeof value !== 'undefined' && value !== null)\n\t\t\treturn url.replace(re, '$1' + key + \"=\" + value + '$2$3');\n\t\telse {\n\t\t\thash = url.split('#');\n\t\t\turl = hash[0].replace(re, '$1$3').replace(/(&|\\?)$/, '');\n\t\t\tif ( typeof hash[1] !== 'undefined' && hash[1] !== null)\n\t\t\t\turl += '#' + hash[1];\n\t\t\treturn url;\n\t\t}\n\t} else {\n\t\tif ( typeof value !== 'undefined' && value !== null) {\n\t\t\tvar separator = url.indexOf('?') !== -1 ? '&' : '?';\n\t\t\thash = url.split('#');\n\t\t\turl = hash[0] + separator + key + '=' + value;\n\t\t\tif ( typeof hash[1] !== 'undefined' && hash[1] !== null)\n\t\t\t\turl += '#' + hash[1];\n\t\t\treturn url;\n\t\t} else\n\t\t\treturn url;\n\t}\n}", "function addURLParam(element, newParam){\r\n var originalSrc = element.getAttribute('src');\r\n element.setAttribute('src', originalSrc + getUrlParamSign(originalSrc) + newParam);\r\n }", "function addURLParam(element, newParam){\r\n var originalSrc = element.getAttribute('src');\r\n element.setAttribute('src', originalSrc + getUrlParamSign(originalSrc) + newParam);\r\n }", "function addURLParam(element, newParam){\n var originalSrc = element.getAttribute('src');\n element.setAttribute('src', originalSrc + getUrlParamSign(originalSrc) + newParam);\n }", "function addURLParam(element, newParam){\n var originalSrc = element.getAttribute('src');\n element.setAttribute('src', originalSrc + getUrlParamSign(originalSrc) + newParam);\n }", "function addURLParam(element, newParam){\n var originalSrc = element.getAttribute('src');\n element.setAttribute('src', originalSrc + getUrlParamSign(originalSrc) + newParam);\n }", "function addUrlParam(paramName, paramValue) {\n\t var currentUrl = $(location).attr('href');\n\t if (currentUrl.indexOf('#') == (currentUrl.length - 1)) {\n\t\t currentUrl = currentUrl.substring(0, currentUrl.length - 1);\n\t }\n\t var indexOf = currentUrl.indexOf('?');\n\t // Check if the current URL contains ? (there is at least one param)\n\t if (indexOf != -1) {\n\t\t indexOf = currentUrl.indexOf('?' + paramName + '=');\n\t\t // Check if the current URL contains ?paramName= (the paramName exists)\n\t\t if (indexOf != -1) {\n\t\t\t var newUrl = getUrlWithReplaceParam(currentUrl, indexOf, paramName, paramValue, '?');\n\t\t\t $(location).attr('href', newUrl);\n\t\t } else {\n\t\t\t// Check if the current URL contains &paramName= (the paramName exists)\n\t\t\t indexOf = currentUrl.indexOf('&' + paramName + '=');\n\t\t\t if (indexOf != -1) {\n\t\t\t\t var newUrl = getUrlWithReplaceParam(currentUrl, indexOf, paramName, paramValue, '&');\n\t\t\t\t $(location).attr('href', newUrl);\n\t\t\t } else {\n\t\t\t\t $(location).attr('href', currentUrl + \"&\" + paramName + \"=\" + paramValue);\n\t\t\t }\n\t\t }\n\t } else {\n\t\t $(location).attr('href', currentUrl + \"?\" + paramName + \"=\" + paramValue);\n\t }\n\t}", "function addURLParam(element, newParam) {\n var originalSrc = element.getAttribute('src');\n element.setAttribute('src', originalSrc + getUrlParamSign(originalSrc) + newParam);\n }", "function assignUrl() {\n\tlet params = new URLSearchParams(window.location.search.substring(1));\t\n\tif (params.toString().length > 0 & params.has(\"v\")) {\n\t loadingtext.style.visibility = \"visible\"; \n\t var xhr = new XMLHttpRequest();\n\t xhr.addEventListener(\"load\", decodeListener);\n\t xhr.open(\"POST\",\n\t\t \"https://w6reayr37i.execute-api.us-east-1.amazonaws.com/test\",\n\t\t true);\n\t xhr.setRequestHeader('Content-Type', 'application/json');\n\t xhr.overrideMimeType( \"application/json; charset=x-user-defined\" );\n\t xhr.send(JSON.stringify(new String (params.get(\"v\"))));\n\t}\n\telse {\n\t loadingtext.style.visibility = \"hidden\";\n\t}\n }", "function addToURL(key, value) {\n\tkey = encodeURI(key); value = encodeURI(value);\n\tvar kvp = document.location.search.substr(1).split(\"&\");\n\tvar i = kvp.length; \n\tvar x;\n\n\t// format url\n\twhile (i--) {\n\t\tx = kvp[i].split(\"=\");\n\t\tif (x [0] == key) {\n\t\t\tx [1] = value;\n\t\t\tkvp [i] = x.join(\"=\");\n\t\t\tbreak;\n\t\t} // if\n\t} // while\n\n\t// join keys and values together\n\tif (i < 0) kvp[kvp.length] = [key, value].join(\"=\");\n\n\t// reload page\n\tdocument.location.search = kvp.join(\"&\"); \n} // addToURL", "updateQueryParam(paramLayer, paramProperty) {\r\n // Get the layer name from the URL\r\n let queryString = `layer=${paramLayer}`;\r\n\r\n // Get the property name (if it exists) from the URL\r\n if (paramProperty) {\r\n queryString += `&property=${paramProperty}`;\r\n }\r\n\r\n // Construct the new URL from the query string\r\n let pageUrl = '?' + queryString;\r\n window.history.pushState('', '', pageUrl);\r\n\r\n // Update layer\r\n this.updateLayer(paramLayer, paramProperty);\r\n }", "function replaceUrlParam(url, paramName, paramValue){\n var pattern = new RegExp('\\\\b('+paramName+'=).*?(&|$)')\n if(url.search(pattern)>=0){\n return url.replace(pattern,'$1' + paramValue + '$2');\n }\n return url + (url.indexOf('?')>0 ? '&' : '?') + paramName + '=' + paramValue \n }", "function replaceURL(url){window.location.replace=url}", "function updateHistory(key, value) {\n var params = getQueryParams(location.search);\n params[key] = value;\n history.pushState(null, null, location.href.substring(0, location.href.indexOf(\"?\")) + buildQueryParamsString(params));\n }", "function pushURL() {\n var baseUrl = location.protocol + \"//\" + location.host + location.pathname;\n\n var searchParams = new URLSearchParams();\n\n mapX = map.getView().getCenter()[0];\n mapY = map.getView().getCenter()[1];\n mapZoom = map.getView().getZoom();\n\n searchParams.set(\"x\", mapX);\n searchParams.set(\"y\", mapY);\n if (mapZoom != undefined) {\n searchParams.set(\"zoom\", mapZoom);\n }\n if (mapCX != undefined) {\n searchParams.set(\"cx\", mapCX);\n }\n if (mapCY != undefined) {\n searchParams.set(\"cy\", mapCY);\n }\n searchParams.set(\"formula\", mapLayer);\n searchParams.set(\"style\", mapStyle);\n\n var parameter = \"?\" + searchParams.toString();\n\n var url = baseUrl + parameter;\n\n window.history.pushState({}, window.title, url);\n}", "function changeURL(){\n\tvar currentURL = window.location.origin;\n\tdocument.location.href = currentURL + \"/company\";\n}", "function getUrlWithParam(controller, action, queryParamName, queryParamValue) {\n ///User/LogOn -- example\n return \"\" + controller + \"/\" + action + \"?\" + queryParamName + \"=\" + queryParamValue;\n }", "function updateQueryString(key, value, url) {\n if (!url) url = window.location.href;\n var re = new RegExp(\"([?|&])\" + key + \"=.*?(&|#|$)\", \"gi\");\n\n if (url.match(re)) {\n if (value)\n return url.replace(re, '$1' + key + \"=\" + value + '$2');\n else\n return url.replace(re, '$2');\n }\n else {\n if (value) {\n var separator = url.indexOf('?') !== -1 ? '&' : '?',\n hash = url.split('#');\n url = hash[0] + separator + key + '=' + value;\n if (hash[1]) url += '#' + hash[1];\n return url;\n }\n else\n return url;\n }\n}", "function getUrlWithReplaceParam(startString, startIndexOf, paramName, paramValue, paramChar) {\n\t var urlToUse = '';\n\t var fullParamNameLength = (paramChar + paramName + '=').length;\n\t var indexOfStartParamValue = startIndexOf + fullParamNameLength;\n\t var indexOfEndOfParamValue = startString.indexOf('&', indexOfStartParamValue);\n\t if (indexOfEndOfParamValue != -1) {\n\t\t urlToUse = startString.substring(0,indexOfStartParamValue) + paramValue + startString.substring(indexOfEndOfParamValue);\n\t } else {\n\t\t urlToUse = startString.substring(0,indexOfStartParamValue) + paramValue;\n\t }\n\t return urlToUse;\n \t}", "function viewer_reloadWithParamInURL() {\n\tvar ret = base_page_url;\n\t\n\tret += '?graph_preload=';\n\t\n\t//granularity\n\tret += $(\"#granularity\").val();\n\tret += \",\";\n\t\n\t//dateFrom\n\tret += new Date( $(\"#from\").datepicker( \"getDate\" ) ).getTime();;\n\tret += \",\";\n\t\n\t//dateTo\n\tret += new Date( $(\"#to\").datepicker( \"getDate\" ) ).getTime();\n\t\n\t//variables\n\tfor(var i=0; i<graph_elements_list.length; i++) {\n\t\tret += \",\";\n\t\t//device_id\n\t\tret += graph_elements_list[i].device_id;\n\t\tret += \",\";\n\t\t//device_name\n\t\tret += graph_elements_list[i].device_name;\n\t\tret += \",\";\n\t\t//variable_name\n\t\tret += graph_elements_list[i].variable_name;\n\t\tret += \",\";\n\t\t//unit\n\t\tret += graph_elements_list[i].unit;\n\t\tret += \",\";\n\t\t//color\n\t\tret += graph_elements_list[i].color;\n\t}\n\t\n\tdocument.location.href = ret;\n}", "function __setUrlParam($url, $name, $value) {\r\n\r\n var charFix = $url.indexOf(\"?\")!=-1?\"&\":\"?\";\r\n var nIdxStart = $url.indexOf(\"&\" + $name + \"=\");\r\n if (nIdxStart==-1) {\r\n nIdxStart = $url.indexOf(\"?\" + $name + \"=\");\r\n }\r\n if (nIdxStart==-1) { //no params\r\n $url = $url + charFix + $name + \"=\" + $value;\r\n return $url;\r\n }\r\n /**\r\n * from upper it found the name start and then try to found the value end position\r\n * the value and be empty or it's the url end\r\n */\r\n var nIdxEnd = $url.indexOf(\"&\", nIdxStart+1);\r\n var urlPreFix = $url.substr(0, nIdxStart+1);\r\n var urlEndFix = \"\";\r\n if (nIdxEnd!=-1) {\r\n urlEndFix = $url.substr(nIdxEnd);\r\n }\r\n $url = urlPreFix + $name + \"=\" + $value + urlEndFix;\r\n return $url;\r\n}", "function urlFix(url){\r\n var _url = url;\r\n\r\n //delete params\r\n _url = url.replace(delParamReg, '');\r\n\r\n //overwrite and add params\r\n _url = _url.replace(overwriteParamReg, '').replace(/&$/, '');\r\n _url += '&' + addParams.join('&') + '&urlfixed=1';\r\n\r\n return _url;\r\n}" ]
[ "0.76082027", "0.75800586", "0.75368696", "0.73101854", "0.725429", "0.72129005", "0.71997577", "0.7056407", "0.7021475", "0.6951297", "0.69001603", "0.68651956", "0.68369687", "0.68095654", "0.68024427", "0.6786734", "0.67732877", "0.6755107", "0.6715941", "0.67115504", "0.66914296", "0.66589016", "0.66154945", "0.66147035", "0.66044396", "0.65868646", "0.65388155", "0.6536814", "0.6533483", "0.6533483", "0.6533483", "0.6529158", "0.65251595", "0.648357", "0.64708596", "0.64375913", "0.64372885", "0.64307", "0.63883656", "0.63744277", "0.6365959", "0.6364866", "0.63597494", "0.6332454", "0.6329921", "0.6329826", "0.6321334", "0.6319442", "0.6300308", "0.6282275", "0.6260687", "0.6247934", "0.6244094", "0.6241979", "0.6232616", "0.6229789", "0.6216785", "0.6216785", "0.6215059", "0.6215059", "0.6215059", "0.6213252", "0.6213252", "0.62042224", "0.61875975", "0.6181648", "0.6175884", "0.61654115", "0.6162", "0.61603105", "0.6160143", "0.6154015", "0.61171865", "0.6116799", "0.6102979", "0.6100666", "0.6094116", "0.6091429", "0.60884774", "0.60812795", "0.6075173", "0.6075173", "0.60676897", "0.60676897", "0.60676897", "0.60660636", "0.6058984", "0.6058648", "0.60575134", "0.6044061", "0.60428375", "0.60377645", "0.6028639", "0.60285795", "0.6016911", "0.6009244", "0.5999026", "0.5987207", "0.59795487", "0.59749746", "0.5972644" ]
0.0
-1
Url Changed > Change State
updateStateFromUrl(location, component){ var state_manager = this, params = state_manager.parseUrl(location.pathname), house = null; if (params.house_id){ house = state_manager.houses.find((h)=>{ return h.data.id == params.house_id; }); } else if (params.dataset === 'irradiance'){ // Irradiance needs a house to verify params and house = state_manager.state.house || state_manager.houses[0]; } if (house){ // params should already be verified if set through StateManager#setParams, but // verify here again before setting state in case URL manually loaded. house.verifyMonthState(params); if (params.dataset === 'power' || params.dataset === 'irradiance') { var date_interval = location.query.dates || []; params.date_interval = house.verifyPowerRange([+date_interval[0], +date_interval[1]], params); } state_manager.state.house = house; state_manager.state.house_id = house.data.id; } Object.assign(state_manager.state, params); if (state_manager.state.house_id) { state_manager.updateHouseFromState(component); } else { component.syncFromStateManager(()=>{ state_manager.update_in_progress = false; }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function respondToState(){\n\t\t_oldUrl = _currentUrl;\n\t\tif(_useAPI) _currentUrl = cleanUrl(window.location.pathname || \"\");\n\t\telse _currentUrl = cleanUrl(window.location.hash || \"\");\n\t\t//Remove slash in beginning\n\t\tif(_currentUrl == \"/\") _currentUrl = \"\";\n\t\telse if(_currentUrl.indexOf(\"/\") == 0) _currentUrl = _currentUrl.substr(1);\n\t\t//Add slash in end\n\t\tif(_currentUrl.substr(_currentUrl.length-1) != \"/\") _currentUrl = _currentUrl+\"/\";\n\t\tif(_allowCookies || _firstTime) track(); //Track first page. After that only when cookies have been accepted.\n\t\tsetCanonical();\n\t\treadParameters();\n\t\tif(!_firstTime && _oldUrl == _currentUrl){\n\t\t\t//console.log(\"Same url firing statechange\", _oldUrl);\n\t\t\twindow.dispatchEvent(GLBCustomEvent(\"subPageChange\", 0));\n\t\t\treturn;\n\t\t}\n\t\t_firstTime = false;\n\t\tsetTitle();\n\t\t//Pages listening can animIn/Out\n\t\twindow.dispatchEvent(GLBCustomEvent(\"pageChange\", 0));\n\t}", "function _urlChangedCallback() {\n if (_oldHref == location.href) {\n return;\n }\n _oldHref = location.href\n var parsedUrl = {href: location.href};\n if (urlParser) {\n parsedUrl = urlParser.parse(location.href);\n }\n //var newLocation = parse(location.href);\n var changes = {};\n for (var entry in parsedUrl) {\n if (parsedUrl[entry] != _oldParsedUrl[entry]) {\n\n\n changes[entry] = {\n \"old\": _oldParsedUrl[entry],\n \"new\": parsedUrl[entry]\n }\n\n\n }\n }\n for (var entry in changes) {\n var callbackName = \"on\" + entry + \"changed\";\n if (_export[callbackName] && (_export[callbackName] instanceof Function)) {\n _export[callbackName].call(null, changes);\n }\n }\n _oldParsedUrl = parsedUrl;\n\n }", "function _urlChangedCallback() {\n if (_oldHref == location.href) {\n return;\n }\n _oldHref = location.href\n var parsedUrl = {href: location.href};\n if (urlParser) {\n parsedUrl = urlParser.parse(location.href);\n }\n //var newLocation = parse(location.href);\n var changes = {};\n for (var entry in parsedUrl) {\n if (parsedUrl[entry] != _oldParsedUrl[entry]) {\n\n\n changes[entry] = {\n \"old\": _oldParsedUrl[entry],\n \"new\": parsedUrl[entry]\n }\n\n\n }\n }\n for (var entry in changes) {\n var callbackName = \"on\" + entry + \"changed\";\n if (_export[callbackName] && (_export[callbackName] instanceof Function)) {\n _export[callbackName].call(null, changes);\n }\n }\n _oldParsedUrl = parsedUrl;\n\n }", "update_url(new_url_path){\n // If the url has changed\n this.setState({\n url_path: new_url_path\n });\n }", "_changeUrl(url) {\n this.rawUrl = url;\n }", "function processURLChange()\n {\n switch(window.location.hash) {\n\n case '#restart':\n currentSubunit()\n break\n\n case '#previous':\n previousSubunit()\n break\n\n case '#next':\n nextSubunit()\n break\n\n default:\n updateUnitFromURL()\n }\n }", "changeState(state) {\r\n if(this._config.states[state]){\r\n this._state = state;\r\n this._history.push(this._state);\r\n }else{\r\n throw new Error;\r\n }\r\n }", "function updateUrl() {\n const out = [\n state.sv,\n state.endTime,\n ];\n\n for (const row of state.rows) {\n out.push(row.label);\n out.push(row.duration);\n }\n const encodedState = btoa(JSON.stringify(out));\n window.history.replaceState(null, '', `?state=${encodedState}`);\n}", "on_STATE_CHANGE (e) {\n\n\t\t// Log the State\n\t\tvar State = historyHTML5.getState();\n\t\thistoryHTML5.log('statechange:', State.data, State.title, State.url);\n\n\t\tif (this._stateChangeCallbackFn) this._stateChangeCallbackFn(State.title, State.url);\n\t}", "function updateState(){\r\n // If we already have hash on URL it won't trigger hash change\r\n // So I force a hash change\r\n if ( firstLoad && hash || isReload){\r\n window.location.hash = '#';\r\n } \r\n\r\n window.location.hash = '#' + presentSlideNumber;\r\n updateCurrentSlide();\r\n }", "function updateState() {\n\n\t\teditHistory.pushState();\n\t\tupdatePageBackground();\n\t}", "changeState(state) {\r\n var states = this.config.states;\r\n if(states.hasOwnProperty(state)) {\r\n this.currentState = state;\r\n this.history.push(this.currentState);\r\n this.cancelled = [];\r\n }\r\n else throw new Error(\"State doesn't exist\");\r\n }", "changeUrl()\n\t{\n\t\tUrl.change('checkout');\n\t}", "onUrlChange(fn) {\n this._urlChangeListeners.push(fn);\n\n if (!this._urlChangeSubscription) {\n this._urlChangeSubscription = this.subscribe(v => {\n this._notifyUrlChangeListeners(v.url, v.state);\n });\n }\n }", "function state (url, no_push) {\n $('#main').load(url+(url.indexOf('?')>0?'&':'?')+'_main');\n load_page_data(url);\n if (no_push !== 'no push') {\n history.pushState({}, undefined, url);\n }\n}", "function hashChanged(e){\n\t\trespondToState();\n\t}", "function changeUrl(title, url) {\n if (typeof (history.pushState) != \"undefined\") {\n var obj = { Title: title, Url: url };\n history.pushState(obj, obj.Title, obj.Url);\n } else {\n alert(\"Browser does not support HTML5.\");\n }\n }", "changeState(state) {\r\n if (this.states[state] == undefined) throw new ErrorEvent(\"illegal state\")\r\n this.history.push(this.state);\r\n this.state = state;\r\n this.second_history = new Array();\r\n }", "onUrlChange(fn) {\n this._urlChangeListeners.push(fn);\n if (!this._urlChangeSubscription) {\n this._urlChangeSubscription = this.subscribe(v => {\n this._notifyUrlChangeListeners(v.url, v.state);\n });\n }\n }", "onUrlChange(fn) {\n this._urlChangeListeners.push(fn);\n if (!this._urlChangeSubscription) {\n this._urlChangeSubscription = this.subscribe(v => {\n this._notifyUrlChangeListeners(v.url, v.state);\n });\n }\n }", "onUrlChange(fn) {\n this._urlChangeListeners.push(fn);\n if (!this._urlChangeSubscription) {\n this._urlChangeSubscription = this.subscribe(v => {\n this._notifyUrlChangeListeners(v.url, v.state);\n });\n }\n }", "onUrlChange(fn) {\n this._urlChangeListeners.push(fn);\n if (!this._urlChangeSubscription) {\n this._urlChangeSubscription = this.subscribe(v => {\n this._notifyUrlChangeListeners(v.url, v.state);\n });\n }\n }", "onUrlChange(fn) {\n this._urlChangeListeners.push(fn);\n if (!this._urlChangeSubscription) {\n this._urlChangeSubscription = this.subscribe(v => {\n this._notifyUrlChangeListeners(v.url, v.state);\n });\n }\n }", "function updateUrl() {\n urlRouter.updateUrl(urlRouter.buildExploreUrlFromPrefs());\n }", "function onUrlChange() {\n\t$('input#id_imgUrl').change(function() {\n\t\tconsole.log('url change detected');\n\t\tupdateThumb(thumbTarget, this);\n\t});\n}", "stateChanged(state) { }", "function modifyURL(newUrl) {\r\n\tif (window.history.pushState && window.history.replaceState) {\r\n\t\twindow.history.pushState({}, document.title, newUrl);\r\n\t}\r\n}", "setUrl(url) {\n assert(/^https?:\\/\\//.test(url));\n\n if (url != this.url_) {\n // Clear the internal state and start with a new URL.\n this.clearInternalState();\n this.url_ = url;\n this.loadWithFallbackTimer();\n } else {\n // Same URL was requested again. Reload later if a request is under way.\n if (this.isPerformingRequests_)\n this.reloadRequested_ = true;\n else\n this.loadWithFallbackTimer();\n }\n }", "update(state) {\n\n const old_state = this._state;\n if (!('page' in old_state)) {\n old_state.page = window.location.pathname.replace(/\\//g, '') || null;\n }\n this._state = Object.assign({}, old_state, state);\n\n // serialize state to url, forcing page change as needed\n const url_search_params = new URLSearchParams(window.location.search);\n for (const k of Object.keys(url_param_names)) {\n if (k in this._state) {\n if (typeof this._state[k] === \"undefined\" || this._state[k] === null) {\n url_search_params.delete(k)\n } else {\n url_search_params.set(url_param_names[k], this._state[k])\n }\n }\n }\n\n const url = new URL(window.location);\n url.search = '?' + url_search_params.toString();\n if (old_state['page'] !== this._state['page'] || old_state['area_id'] !== this._state['area_id']) {\n if (!!state['page']) {\n url.pathname = '/' + state['page'] + '/';\n } else {\n url.pathname = '/'\n }\n window.location.href = url;\n } else {\n window.history.replaceState(null, document.title, url.toString())\n }\n }", "hashChange(event) {\n\t\t// This support the abort a cicle\n\t\tif (this.engineIsRunning === true) {\n\t\t\tthis.engineIsRunning = false;\n\t\t\treturn;\n\t\t}\n\t\tthis.currentUrl = event ? event.newURL : window.location.href;\n\t\tthis.previousUrl = event ? event.oldURL : window.location.href;\n\t\t// Save the old routes if user abort and need restore it\n\t\tthis.oldRoutesBkp = this.cloneRoutes({source: this.oldRoutes});\n\t\t// Save a copy of currentRoutes as oldRoutes\n\t\tthis.oldRoutes = this.cloneRoutes({source: this.currentRoutes});\n\t\t// Clean current routes\n\t\tthis.currentRoutes = getEmptyRouteObjetc();\n\t\tthis.engine();\n\t}", "stateChanged(_state) { }", "_handleAppStateChange(currentAppState) {\n this._appState = currentAppState;\n this._checkInitialURL();\n }", "function changeURL(title, url) {\n var baseURL = \"categories.html?cat=\";\n var obj = {Title: title, Url: url};\n history.pushState(obj, obj.Title, obj.Url);\n }", "changeState(state) {\r\n\r\n\r\n if (!this.statuses.includes(state)) {\r\n throw new Error(\"yryjinug\")\r\n }\r\n this.history1.push(this.activeState);\r\n this.activeState = state;\r\n this.history2 = [];\r\n\r\n\r\n }", "changed()\n {\n if (window.location.hash !== this.lastHash)\n {\n this.lastHash = window.location.hash;\n return true;\n }\n else\n {\n return false;\n }\n }", "function updateURL () {\n var parms = QueryParams.map(input => {\n var parm = input.queryStringParm;\n return parm + \"=\" + encodeURIComponent(input.location.val());\n });\n var s = parms.join(\"&\");\n window.history.pushState(null, null, location.origin+location.pathname+\"?\"+s);\n }", "handleResourceUrlChange(e) {\n\t\tthis.setState({\n\t\t\tresourceUrl: e.target.value\n\t\t});\n\t}", "replaceState(state, title, url) {\n this._history.pop();\n this._history.push({ state, title, url });\n this._update();\n }", "_changeUrl(url) {\n var self = this;\n self.endpoint = url;\n }", "function setUrl(newValue, oldValue) {\n // set the full url\n $location.search({\n species: $scope.browserLocation.genome, // filter is from Genoverse module\n chromosome: $scope.browserLocation.chromosome,\n start: $scope.browserLocation.start,\n end: $scope.browserLocation.end\n });\n $location.replace();\n }", "function updatePageUrl() {\n // here we have updated the globals so we will take the url data from the history object\n // unless its the list view where we use the default dates\n // (if we were coming from the updated url ones the setPageUrl method would trigger instead of this one)\n if (scheduled.currentView == 'list') {\n scheduled.listDateStart = scheduled.defaultlistDateStart;\n scheduled.listDateEnd = scheduled.defaultlistDateEnd;\n }\n\n var urlParams = createUrl();\n var url = window.location.origin + window.location.pathname + urlParams;\n History.pushState(null, null, url);\n }", "pushState(state, title, url) {\n this._history.push({ state, title, url });\n this._update();\n }", "function filterChanged(url) {\n var checkChange = setInterval(function() {\n if (url != window.location.href) {\n console.log(\"changed\");\n $('.snize-filters-sidebar').append('<button class=\"button close-filter\">Update</button>'); \n clearInterval(checkChange);\n }\n }, 100);\n }", "changeState(state) {\r\n if (this.config.states[state]) {\r\n this.history.push(this.currentState);\r\n this.currentState = state;\r\n this.isRedo = false;\r\n } else {\r\n throw new Error();\r\n }\r\n\r\n }", "function hashChanged() {\n var url = \"#\" + (document.location.hash.slice(1) || \"\");\n history.push(url);\n trigger(\"GET\", url);\n }", "function updateUrlParam() {\n // Update url parameter\n window.history.replaceState(\n null,\n null,\n `?page=${page}&limit=${perPage}&past-events=${pastEvents}`\n ); // -> set url param\n}", "replaceState(state, title, url = this.url) {\n url = URL.resolve(this.current.window.document.URL, url);\n // TODO: check same origin\n this.replaceEntry(this.current.window, url, state || {});\n this.updateLocation(this.current.window, url);\n }", "onChangeURL(e) {\n this.setState({\n url: e.target.value\n });\n }", "static setUrl({\n protocol = this.getProtocol(),\n host = this.getHost(),\n path = this.getPath(),\n search = this.getSearch(),\n hash = this.getHash()\n })\n {\n protocol = encodeURI(protocol);\n host= encodeURI(host);\n path = encodeURI(path);\n search = encodeURI(search);\n hash = encodeURI(hash);\n let url = protocol + \"//\" + host + path + search + hash;\n window.history.pushState({path: url}, '', url);\n }", "function stateCalled(e){\r\n hideSharePopUp();\r\n\r\n // update current slide number with history state slide number value\r\n presentSlideNumber = setSlideNumberFromURL();\r\n\r\n // using scene go slide since we update state in our go method\r\n window.scene.goSlide( presentSlideNumber );\r\n\r\n updateState();\r\n updateGUI();\r\n }", "changeState(state) {\r\n let history = this.history;\r\n this.i = history.length;\r\n switch (state) {\r\n case 'busy': this.active = 'busy';\r\n history.push('busy');\r\n break;\r\n case 'sleeping': this.active = 'sleeping';\r\n history.push('sleeping');\r\n break;\r\n case 'normal': this.active = 'normal';\r\n history.push('normal');\r\n break;\r\n case 'hungry': this.active = 'hungry';\r\n history.push('hungry');\r\n break;\r\n default: reset();\r\n }\r\n }", "function handleChange(event) {\n switch (event.target.name) {\n case \"longurl\":\n setUrl(event.target.value);\n break;\n\n default:\n break;\n }\n }", "function setNewUrl(url, title) {\n if (!title)\n title = 'default';\n go_back_uri.push('/' + window.location.href.replace(/^(?:\\/\\/|[^\\/]+)*\\//, \"\"));\n window.history.pushState({urlPath: url}, title, url);\n}", "function on_tab_updated(id, change_info, tab)\n {\n if (tab.active && change_info.url) { update_in_tab(tab); }\n }", "stateChanged(state) {\n }", "go(path, query = '', state = null) {\n this._platformStrategy.pushState(state, '', path, query);\n\n this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);\n }", "function o(e){window.history.replaceState(null,\"\",r.state.url),window.location.replace(e)}", "__onHashChange() {\n var currentState = this._readState();\n\n if (\n qx.lang.Type.isString(currentState) &&\n currentState != this.getState()\n ) {\n this._onHistoryLoad(currentState);\n }\n }", "function update(){\r\n //needs to update server with link/navigation information\r\n //ajax\r\n}", "function DefineState(event) {\n\n // Prevent Link from Firing\n event.preventDefault();\n\n // Retrieve quest id from link rel attribute\n var thisCurrentUser = $(this).attr('rel');\n \n \t\t// Set LocalStorage Current Quest ID\n \t\tlocalStorage.setItem('CurrentQuestID', thisQuestid); \n \n document.location=\"/questArea\";\n\n}", "function updateState(imageId, imagePage, commentPage, currentAuthor) {\n let state = window.history.state;\n state.imageId = imageId;\n state.imagePage = imagePage;\n state.commentPage = commentPage;\n state.currentAuthor = currentAuthor;\n window.history.replaceState(state, \"\", window.location.href);\n }", "changeUrl(pageNumber) \r\n\t{\r\n\t\tUrl.changeParameter(this.settings.url_parameter, pageNumber, this.settings.separator);\r\n\t}", "function onTabUpdate(tabId, changeInfo, tab) {\n var url = tab.url;\n\n var url_protocol_stripped = /^http[s]?:\\/\\/(.*)/g.exec(url);\n\n if (url_protocol_stripped != null && url_protocol_stripped.length >= 2) {\n var match_url = url_protocol_stripped[[1]].split(\"/\");\n doRedirectIfSaved(tabId, match_url);\n }\n}", "handleChange(value) {\n this.props.history.push(value.url);\n }", "_update() {\n window.location.pathname = this._current().url;\n }", "function newState(state) {\n alert(\"This functionality is yet to be implemented!\");\n }", "go(path, query = '', state = null) {\n this._platformStrategy.pushState(state, '', path, query);\n this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);\n }", "go(path, query = '', state = null) {\n this._platformStrategy.pushState(state, '', path, query);\n this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);\n }", "go(path, query = '', state = null) {\n this._platformStrategy.pushState(state, '', path, query);\n this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);\n }", "go(path, query = '', state = null) {\n this._platformStrategy.pushState(state, '', path, query);\n this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);\n }", "go(path, query = '', state = null) {\n this._platformStrategy.pushState(state, '', path, query);\n this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);\n }", "function look_ruby_update_url(url, title) {\r\n if (window.location.href !== url) {\r\n if (url !== '') {\r\n history.replaceState(null, null, url);\r\n document.title = title;\r\n }\r\n //update ga\r\n look_ruby_update_ga(url);\r\n\r\n }\r\n }", "function updateUrl() {\n // If we're missing some direction preferences in the URL, we'll update\n // the URL to include them.\n // Replace url state in this case to avoid an infinite loop in browser history\n var replaceUrlState = urlRouter.directionsPrefsMissingFromUrl();\n urlRouter.updateUrl(urlRouter.buildDirectionsUrlFromPrefs(), replaceUrlState);\n }", "function loadPreviousState() {\n var i, list,\n $settings = gui.pages.get( 'settings' ),\n server = store.getRecord( '__current_server' );\n if ( server && server.url ) {\n $settings.find( '.url-helper li' ).removeClass( 'active' ).find( '[data-value=\"' + server.helper + '\"]' ).parent( 'li' ).addClass( 'active' );\n $settings.find( 'input#server' ).val( server.inputValue );\n list = store.getFormList( server.url );\n gui.parseFormlist( list, $( '#form-list' ) );\n console.log( 'server state: ', server );\n if ( typeof server.refresh !== 'undefined' && server.refresh === true ) {\n $( '#refresh-list' ).click();\n server.refresh = false;\n store.setRecord( '__current_server', server );\n }\n }\n }", "function OnChange(self, state)\n {\n if (self.state != self.ViewModel.TextValue())\n {\n self.state = self.ViewModel.TextValue()\n args = self.parameters.post_service\n args[\"value\"] = self.state\n self.call_service(self, args)\n }\n\n }", "function stateChange(){\n\n}", "preStateChange(action){return;}", "function changeToLive(url,domain) {\n\n url = (stg.indexOf('https://'+domain) > -1? stageLiveURL : liveURL ) + languagePath.split(siteRootPath)[1] + smartUrl(url) ;\n redirect(url);\n}", "function changeState() {\n var state = $(this).attr(\"data-state\");\n var animateImage = $(this).attr(\"data-animate\");\n var stillImage = $(this).attr(\"data-still\");\n\n if (state == \"still\") {\n $(this).attr(\"src\", animateImage);\n $(this).attr(\"data-state\", \"animate\");\n }\n\n else if (state == \"animate\") {\n $(this).attr(\"src\", stillImage);\n $(this).attr(\"data-state\", \"still\");\n }\n }", "pushState(state, title, url = this.url) {\n url = URL.resolve(this.current.window.document.URL, url);\n // TODO: check same origin\n this.addEntry(this.current.window, url, state || {});\n this.updateLocation(this.current.window, url);\n }", "function updateURL() {\n var filters = window.getPostFilterValues();\n var params = '';\n for(let key in filters){\n var val = filters[key];\n if (typeof val === 'object') {\n params += key + '=' + val.join(',') + \"&\";\n }else{\n params += key + '=' + val + \"&\";\n }\n }\n params = params.length > 0 ? params.substr(0, params.length - 1) : params;\n var newUrl = window.location.href;\n newUrl = newUrl.split('?')[0] + ('?' + params);\n window.history.pushState(null, null, newUrl);\n }", "function checkHash() {\n if(window.location.href.indexOf(\"unity\") > -1) {\n currentState = pageStates.UNITY;\n }\n else if (window.location.href.indexOf(\"custom\") > -1) {\n currentState = pageStates.CUSTOM;\n }\n else if (window.location.href.indexOf(\"web\") > -1) {\n currentState = pageStates.WEB;\n }\n else\n {\n currentState = pageStates.DEFAULT;\n }\n}", "function changeLocation(newURL, title, navIndex) {\n if (UTIL.idExists(\"jbmnplsWebpage\")) {\n DEBUGGER.refresh();\n $(\"#jbmnplsWebpage\").attr(\"src\", newURL);\n if (title.empty()) {\n title = \"Jobmine Plus\";\n }\n document.title = title;\n setNavSelection(navIndex);\n }\n}", "function runAddressChangeCallback() {\n var address = go.formatURL(location.hash);\n // If address is not current address and isn't held, then run action\n if (address != go.wait && address != _currentAddress) {\n go.run(\n new ActionEvent({ url: address })\n );\n }\n }", "function pageChanged(newPage){\n\t\t$state.go(\"root.sectionList\" , {pageId:newPage});\n\t}", "function stateChange(XHR, passFn, failFn, waitFn) {\n if (waitFn) {\n waitFn(XHR);\n }\n if (XHR.readyState === 4) {\n if (XHR.status === 200) {\n if (passFn) {\n passFn(XHR);\n }\n } else if (failFn) {\n failFn(XHR);\n }\n }\n }", "function OnStateUpdate(self, state)\n {\n self.state = state.state;\n self.access_token = state.attributes.access_token\n refresh_frame(self)\n }", "updateURL (to, from) {\n this.$emit('updateURL', to, from, this)\n }", "function update_state()\n {\n var query = { _list: me.selected_list }\n\n if (settings.selected_uid) {\n query._id = settings.selected_uid;\n }\n\n if (window.history.replaceState) {\n window.history.replaceState({}, document.title, rcmail.url('', query));\n }\n }", "componentWillUpdate() {\n this.url = splitUrl(window.location.pathname)[0];\n console.log(\"URL \" + this.url);\n }", "_stateChanged(_state) {\n throw new Error('_stateChanged() not implemented');\n }", "function changeState(that, state)\n{\n\t$(that).data(\"libre\", state);\n}", "function pushStateHandler(url) {\n history.pushState(url, null, url);\n return false;\n}", "async handleNewBlockedUrl() {\n const fullUrl = new URL(toUrlString(this.forms.blockedUrls.input.trim()));\n const blockedUrl = fullUrl.pathname\n ? `${fullUrl.host}${fullUrl.pathname}`\n : fullUrl.host;\n await this.setSyncStorageState({ blockedUrls: [...this.state.blockedUrls, blockedUrl] });\n }", "_stateChanged(state) {\n console.log(state);\n }", "function dispatchRouteChange() {\n // remove hash\n var href = location.hash.substr(1, location.hash.length - 1);\n\n routerState$.patch({\n route: href === '' ? '/' : href.split('?')[0],\n params: getUrlParams(href)\n });\n }", "function updateURL () {\n var newSearch = \"?\" + Object.keys(parameters).filter(function (key) {\n return Boolean(parameters[key])\n }).map(function (key) {\n return encodeURIComponent(key) + \"=\" + encodeURIComponent(parameters[key])\n }).join(\"&\");\n history.replaceState(null, null, newSearch)\n }", "handleStateChange(e) {\n const unProcesedKey = e._targetInst.key\n const StateId = unProcesedKey.split('STATE_')[unProcesedKey.split('STATE_').length - 1]\n this.props.fetchCityWatcher({ stateCode: StateId })\n }", "stateChange(state){\n\t\tLogger.info(`Ably realtime state changed to: ${state.current}`);\n\t}", "function changetState(s,t,i){\n\t\tvar rurl = $('#r').val();\n\t\tvar query='&t='+t+'&i='+i;\n\t\t$.ajax({\n\t\t\ttype: 'POST',\n\t\t\tdataType: \"json\",\n\t\t\turl: URL_STATE+s+query,\n\t\t\tsuccess: function (response) {\n\t\t\t\tvar response = $.parseJSON(JSON.stringify(response));\n\t\t\t\tif(response.error){\n\t\t\t\t\tMessageDialog.show(response.message,'Active');\n\t\t\t\t}else{\t\t\t\t\t\n\t\t\t\t\twindow.location=rurl;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}" ]
[ "0.72138965", "0.7142185", "0.711696", "0.7074623", "0.6819557", "0.6775527", "0.6682083", "0.6672039", "0.6529458", "0.65114504", "0.650442", "0.6476672", "0.64537483", "0.6432621", "0.6425732", "0.6415419", "0.6409642", "0.63951916", "0.6388429", "0.6388429", "0.6388429", "0.6388429", "0.6388429", "0.6356624", "0.63477033", "0.63424945", "0.6306762", "0.6292641", "0.6292614", "0.6243825", "0.6237055", "0.6205602", "0.61481047", "0.6143645", "0.6138638", "0.61249363", "0.6092639", "0.6090004", "0.6077096", "0.60626143", "0.6057144", "0.6032906", "0.6026127", "0.6011868", "0.599096", "0.5959256", "0.5956092", "0.59475225", "0.5925761", "0.5923064", "0.59090626", "0.5902435", "0.58892894", "0.587738", "0.586985", "0.58639765", "0.5857674", "0.5847378", "0.5833597", "0.58306026", "0.581075", "0.580922", "0.5805124", "0.5779131", "0.5778537", "0.57766277", "0.576989", "0.576989", "0.576989", "0.576989", "0.576989", "0.5764717", "0.57606", "0.57532626", "0.5749831", "0.5747125", "0.5743772", "0.5741033", "0.5740223", "0.57241786", "0.57176757", "0.57138944", "0.57130206", "0.57040197", "0.57022125", "0.56976146", "0.5685492", "0.5685158", "0.5679116", "0.5676204", "0.5675691", "0.5671791", "0.56697905", "0.5667573", "0.56673044", "0.5666846", "0.56632406", "0.5663079", "0.56620586", "0.56598693" ]
0.56659
96
TODO Implement this with a HashMap to get a better efficiency. Otherwise, complexity while loading the list would be O(n^2) in the worst cases, with HashMap it would improve to O(n).
function getAllStudentData() { var studentData = {moduleStudentList, studentChanges}; return studentData; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadList() {\n return loadListFunctionality();\n }", "function loadList(){\n let list = [];\n // Load the item from localStorage.\n let newList = localStorage.getItem(\"list\");\n\n // Check to see if the item returned null\n if (newList == null || newList == undefined){\n // If it did, save a new list.\n saveList();\n return list;\n } else {\n // If it didn't, parse the JSON string and save it to list.\n list = JSON.parse(newList);\n return list;\n }\n}", "prepLoadList (list, callback) {\n\n // store here for when loadList gets called.\n this._list = list;\n\n // only want a single instance of this function.\n this._bulkLoadCompleteFn = callback;\n }", "function findLists() {}", "function loadLists() {\n\tloadEquipmentSlots();\n\tloadNpcList();\n}", "handleLoadList(listId) {\n // UNLOAD THE CURRENT LIST AND INSTEAD LOAD THE CURRENT LIST\n this.model.loadList(listId);\n }", "function loadList() {\r\n if(!localStorage.getItem(\"list\"))\r\n return [];\r\n var list = localStorage.getItem(\"list\").split(',');\r\n return list;\r\n}", "loadList(listId) {\n this.moveListToFront(listId);\n this.view.refreshLists(this.toDoLists);\n let listIndex = -1;\n for (let i = 0; (i < this.toDoLists.length) && (listIndex < 0); i++) {\n if (this.toDoLists[i].id === listId)\n listIndex = i;\n }\n if (listIndex >= 0) {\n let listToLoad = this.toDoLists[listIndex];\n this.currentList = listToLoad;\n this.view.viewList(this.currentList);\n if(this.toDoLists[listIndex].items.length > 0){\n this.enableItemControls();\n }\n }\n this.tps.clearAllTransactions();\n this.view.disableAddListButton();\n this.view.disableRedoAndUndoButton();\n }", "function loadData(listName) {\n\t\t//load the shopping lists collection from local storage\n\t\tshoppingLists = JSON.parse(localStorage.getItem(\"shoppingLists\"));\n\t\t//set the current working list \n\t\tsessionList = shoppingLists[listName];\n\n\t\t//call the function to display the list on screen, but set save to false since local storage is up to date\n\n\n\t\tsessionList.forEach(function(item) {\n\t\t\taddItem(item, false);\n\t\t});\n}", "function loadList (array){\n array.forEach(function(item){\n addItem(item.name, item.id, item.done, item.trash);\n });\n }", "function loadList(array){\n array.forEach(function(item){\n addSearchHistory(item.city, item.id, item.temp, item.weather_el, item.weather_icon);\n });\n}", "async readListPair() {\n const filePath = path.resolve(__dirname + '../../../../config/crowdtangle_list.json');\n let listPairs;\n try {\n const fileContents = await readFile(filePath, { encoding: 'utf8' });\n listPairs = JSON.parse(fileContents);\n } catch (err) {\n listPairs = {};\n }\n \n // lists are stored with hashes for security\n const listPair = listPairs[this.hashedToken];\n if (typeof listPair === 'object') {\n return listPair;\n }\n return {\n crowdtangle_list_account_pairs: {},\n crowdtangle_saved_searches: {},\n };\n }", "function loadList(array){\n array.forEach(function(item){\n addToDo(item.name, item.id, item.done, item.trash)\n });\n}", "loadData(state, lists) {\n state.lists = lists;\n }", "changeList(add) {\n let nextOffset = this.state.offset + add*PKM_PER_PAGE;\n if (nextOffset >= this.pkmMax || nextOffset < 0)\n return;\n\n // Checks if the page is at the cache, and fails to load, otherwise\n if (nextOffset in this.cache) {\n let list = this.cache[nextOffset];\n this.setState({\n pkmList: list,\n offset: nextOffset,\n nextDisabled: (nextOffset + PKM_PER_PAGE >= this.pkmMax),\n prevDisabled: (nextOffset - PKM_PER_PAGE < 0)\n });\n }\n\n // Load more pages to cache\n let futureOffset = nextOffset + 3*PKM_PER_PAGE;\n if (futureOffset < this.pkmMax && !(futureOffset in this.cache)) {\n getJSON(`https://pokeapi.co/api/v2/pokemon/?limit=${PKM_PER_PAGE}&offset=${futureOffset}`,\n false, (response) => {\n if (!(futureOffset in this.cache))\n this.cache[futureOffset] = response.responseJSON.results;\n });\n }\n }", "function getList() {\n if (storage.get(ListName) != null) {\n masterList = storage.get(ListName);\n showList(masterList);\n }\n}", "function loadList(array) {\n array.forEach(function (item) {\n addToDo(item.name, item.id, item.done, item.trash);\n });\n}", "function loadList(array) {\n array.forEach(function (item) {\n addToDo(item.name, item.id, item.done, item.trash);\n });\n}", "function loadList(array) {\n array.forEach(function(item) {\n addToDo(item.name, item.id, item.done, item.trash);\n });\n}", "function loadListFunctionality() {\n return fetch(API_URL)\n .then(function (response) {\n return response.json();\n })\n .then(function (json) {\n json.results.forEach(function (item) {\n let pokemon = {\n name: item.name,\n detailsUrl: item.url,\n };\n pokemonRepository.add(pokemon);\n });\n })\n .catch(function (e) {\n console.error(e);\n });\n}", "function loadPlayerList() {\n Player_v.all({order: 'id'}, function(err, results) {\n var players = [];\n var player = {};\n player.player_name = 'Not Selected';\n player.id = \"\";\n players[0] = player;\n\n if(results.length > 0) {\n for (var i = 0; i < results.length; i++) {\n // create a brand new instance of player object for every record. One cannot reuse the same player variable.\n var player = { player_name: results[i].first_name + \" \" + results[i].last_name + \"-\" + results[i].city + \"/\" + results[i].state_or_province,\n id: results[i].id};\n players.push(player);\n }\n } // end of if.\n\n this.player_list = players;\n\n next(); // process the next tick.\n }.bind(this));\n}", "queryLists() {\n fetch(\"https://deco3801-oblong.uqcloud.net/wanderlist/get_bucketlist_belonging_to_user/\" + this.state.userData.id)\n .then(response => response.json())\n .then(obj => this.loadLists(obj));\n }", "function getCurrentList(){\n const ss = getSpreadSheet();\n var list_page = ss.getSheetByName(LIST_SHEET);\n if(list_page.getLastRow() < 1) return {};\n var currList = list_page.getRange(1,1,list_page.getLastRow(), 3).getValues();\n\n return currList.reduce(function (map, obj) {\n map[obj[0]] = obj.slice(1);\n return map;\n }, {});\n}", "function load(key) {\n const func = getGlobal(key);\n if (!func) {\n return;\n }\n // Get one item from storage\n const getItem = (index) => {\n const name = cachePrefix + index;\n const item = func.getItem(name);\n if (typeof item !== 'string') {\n // Does not exist\n return false;\n }\n // Get item, validate it\n let valid = true;\n try {\n // Parse, check time stamp\n const data = JSON.parse(item);\n if (typeof data !== 'object' ||\n typeof data.cached !== 'number' ||\n data.cached < minTime ||\n typeof data.provider !== 'string' ||\n typeof data.data !== 'object' ||\n typeof data.data.prefix !== 'string') {\n valid = false;\n }\n else {\n // Add icon set\n const provider = data.provider;\n const prefix = data.data.prefix;\n const storage = storage_1.getStorage(provider, prefix);\n valid = storage_1.addIconSet(storage, data.data);\n }\n }\n catch (err) {\n valid = false;\n }\n if (!valid) {\n func.removeItem(name);\n }\n return valid;\n };\n try {\n // Get version\n const version = func.getItem(versionKey);\n if (version !== cacheVersion) {\n if (version) {\n // Version is set, but invalid - remove old entries\n destroyCache(func);\n }\n // Empty data\n initCache(func, key);\n return;\n }\n // Get number of stored items\n let total = getCount(func);\n for (let i = total - 1; i >= 0; i--) {\n if (!getItem(i)) {\n // Remove item\n if (i === total - 1) {\n // Last item - reduce country\n total--;\n }\n else {\n // Mark as empty\n exports.emptyList[key].push(i);\n }\n }\n }\n // Update total\n setCount(func, key, total);\n }\n catch (err) {\n //\n }\n }", "function loadList(array) {\n array.forEach(function (item) {\n addTask(item.name, item.id, item.done, item.trash);\n });\n}", "function loadListPageData() {\n $('#list > ul').html(setListPageSensors());\n}", "function loadList(array) {\n array.forEach(function(item) {\n addToDo(item.name, item.date, item.priority, item.id, item.done, item.trash);\n });\n }", "function getFromLocalStorage() {\n const reference = localStorage.getItem('lists');\n // if reference exists\n if (reference) {\n // converts back to array and store it in lists array\n lists = JSON.parse(reference);\n renderLists(lists);\n }\n}", "function loadWordList(fileName, list, extractFunc, filterFunc) {\n var parser, value;\n\n parser = csv({ trim: true }, function(err, data) {\n //console.log(\"Words record: \" + JSON.stringify(data));\n data.forEach(function(record) {\n if (!filterFunc || filterFunc(record)) {\n value = extractFunc(record);\n //console.log(\"List add: \" + value);\n list.push(value);\n }\n });\n });\n\n var input = fs.createReadStream(fileName);\n input.pipe(parser); \n}", "function List() {\n this.dataStore = []; //initializes an empty arry to store list elements\n this.listSize = 0; //property: number of elements in a list\n this.pos = 0; //property: current position in list\n this.length = length; //property: returns the number of elements in list\n this.toString = toString; //function: returns string representation of list\n this.clear = clear; //function: clears all elements from list\n this.insert = insert; //function: insets new element after existing element\n this.append = append; //function: adds new element to end of list\n this.remove = remove; //function: removes element from list\n this.front = front; //function: sets current position to first element of list\n this.end = end; //function: sets current position to last element of list\n this.prev = prev; //function: moves current position back one element\n this.next = next; //function: moves current position forward one element\n this.currPos = currPos; //function: returns the current position in list\n this.moveTo = moveTo; //function: moves the current poistion to specified position\n this.getElement = getElement; //function: returns element at current position\n this.find = find; //function: return position of element or -1 if not found\n this.contains = contains; //function: returns true if element is in dataStore false if not\n}", "function loadStateList() {\n\tLookup.all({where: {'lookup_type':'STATE_OR_PROVINCE', 'context_code':'US'}}, function(err, lookups){\n\t this.state_or_province_list = lookups;\n\t next(); // process the next tick. If you don't put it here, it will stuck at this point.\n\t}.bind(this));\n}", "function loadList() {\n showLoadingMessage('Loading Pokemon list, please wait...');\n return fetch(apiUrl)\n .then(function(response) {\n return response.json();\n })\n .then(function(json) {\n hideLoadingMessage();\n json.results.forEach(function(item) {\n var pokemon = {\n name: item.name,\n detailsUrl: item.url\n };\n add(pokemon);\n });\n })\n .catch(function(e) {\n /* eslint-disable no-console */\n console.error(e);\n /* eslint-enable no-console */\n });\n }", "function loadSavedList() {\n fetchUrl('/githubSearch/list')\n .then(function(response) { // if has response, then build the list\n buildSavedList(JSON.parse(JSON.stringify(response)));\n }).catch(function(error) {\n console.log('Request failed', error);\n });\n }", "function loadList() {\n newToDoItem(\"Buy milk\", true)\n newToDoItem(\"Do dishes\", false)\n newToDoItem(\"Feed Tito\", true)\n}", "function getList(listName) {\n var transaction = db.transaction([collection], \"readonly\"),\n store = transaction.objectStore(collection),\n theList = [],\n tagIndex, tagCursor;\n\n // tagIndex = store.index(listName),\n // range = IDBKeyRange.bound('A', 'z\\uffff'),\n // tagCursor = tagIndex.openCursor();\n if(listName == \"id\") {\n \ttagCursor = store.openCursor();\n }\n else {\n \ttagIndex = store.index(listName);\n \ttagCursor = tagIndex.openCursor();\n }\n \n\n\n tagCursor.onsuccess = function(event) {\n var cursor = event.target.result;\n if(cursor) {\n // check whether the tag is already included\n if( !theList.some(function(elem){return elem == cursor.key}) ) {\n // console.log( \"going to add '\" + cursor.key + \"'\" );\n theList.push(cursor.key);\n }\n cursor.continue();\n }\n }; // end tagCursor.onsuccess\n\n transaction.oncomplete = function(event) {\n \tvar fragment = document.createDocumentFragment();\n\n // only construct an options list for dropdowns\n if( listName == \"author\" || listName == \"tags\") { \n for(var i =0, len = theList.length; i < len; i += 1) {\n var element = document.createElement(\"option\");\n element.value = theList[i];\n element.innerHTML = theList[i];\n fragment.appendChild(element);\n } \n }\n\n if(listName == \"tags\") {\n \tupdateElement(pageElements.tagSelect, fragment);\n }\n else if(listName == \"author\") {\n updateElement(pageElements.authorSelect, fragment);\n }\n else {\n \trandomChoices(theList, 5);\n }\n }; //end oncomplete\n\n }", "load(l) {\n if( typeof l === 'undefined' ) {\n throw(new Error('Illegal to pass undefined to load'));\n }\n if( this.willChop.length !== 0 ){\n throw(new Error('Illegal to load more than once'));\n }\n // FIXME: rename to willDestroy\n this.willChop = l;\n this.chopIntoPrecompute();\n\n // console.log(this.precompute);\n\n // this.willChopOriginal = this.willChopOriginal.concat(l); // lazy\n }", "function loadList() {\n return fetch(apiUrl)\n .then(function (response) {\n return response.json();\n })\n .then(function (json) {\n json.results.forEach(function (item) {\n let pokemon = {\n entry: (entryNo++).toString().padStart(3, '0'), //add leading zeros\n name: item.name,\n detailsUrl: item.url,\n };\n\n pokemonList.push(pokemon);\n });\n })\n .catch(function (e) {\n console.error(e);\n });\n }", "load(wordlist) {\n\n wordlist = wordlist || this.wordlist;\n\n return fs\n .readFileAsync(wordlist)\n .then((wordlistAsBuffer) => {\n let wordlistAsStringArray = wordlistAsBuffer.toString().split('\\n');\n this._bitmap = _.fill(new Array(0xfffff), 0);\n return wordlistAsStringArray;\n })\n .each((wordAsString) => {\n let wordHashCode = wordAsString.hashCode(5);\n let index = parseInt(wordHashCode, 16);\n this.bitmap[index] = 1;\n });\n }", "function loadList() {\n\t$.ajax({\n\t\tmethod : \"GET\",\n\t\turl : \"./php/loaders/loadList.php\",\n\t\tsuccess : function(result) {\n\t\t\t\tfor ( i = 0; i < result['authors'].length; i++) {\n\t\t\t\tloadedAuthors[i] = {\n\t\t\t\t\t\"name\" : result['authors'][i]['name'],\n\t\t\t\t\t\"url\" : result['authors'][i]['url']\n\t\t\t\t};\n\t\t\t}\n\n\t\t},\n\t\terror : function() {\n\t\t\t//alert(\"Errore caricamento lista!\");\n\t\t}\n\t});\n}", "function loadList() {\n\t\t\treturn fetch(apiUrl)\n\t\t\t\t.then(function (response) {\n\t\t\t\treturn response.json();\n\t\t\t})\n\t\t\t\t.then(function (json) {\n\t\t\t\tjson.results.forEach(function (item) {\n\t\t\t\t\tlet pokemon = {\n\t\t\t\t\tname: item.name,\n\t\t\t\t\tdetailsUrl: item.url\n\t\t\t\t\t};\n\t\t\t\t\tadd(pokemon);\n\t\t\t\t});\n\t\t\t})\n\t\t\t\t.catch(function (e) {\n\t\t\tconsole.error(e);\n\t\t\t});\n\t\t}", "function loadThings(data) {\n \n data.forEach(function(e, i, a) {\n _things[e._id] = e;\n });\n}", "function loadList () {\n return fetch(apiUrl).then(function (response) {\n return response.json();\n }).then(function (json) {\n json.results.forEach(function (item) {\n let pokemon = {\n name: item.name,\n detailsUrl: item.url\n };\n add(pokemon);\n });\n }).catch(function (e) {\n window.alert(e);\n })\n }", "function loadList() {\n return fetch(apiURL).then(function(response){\n return response.json();\n }).then (function(json){\n json.results.forEach(function(item){\n let pokemon = {\n name: item.name,\n detailsUrl: item.url,\n \n };\n add(pokemon);\n });\n }).catch(function(e){\n console.error(e);\n });\n}", "function prepareList() {\n\t\t// find td of first entry, make it to a template\n\t\tlistNode = document.querySelector('.object-list tbody tr');\n\t\tif (listNode && listNode.parentElement) {\n\t\t\tlistStart = listNode.parentElement;\n\t\t\tlistNode.parentElement.removeChild(listNode);\n\t\t} else {\n\t\t\tconsole.error('No listitem found, could not load objects list.');\n\t\t\treturn;\n\t\t}\n\t}", "function loadList() {\n return fetch(apiUrl).then(function (response) {\n return response.json();\n }).then(function (json) {\n json.results.forEach(function (item) {\n var pokemon = {\n name: item.name,\n detailsUrl: item.url\n };\n add(pokemon);\n });\n }).catch(function (e) {\n console.error(e);\n })\n }", "function loadList() {\n return fetch(apiUrl).then(function (response) {\n return response.json();\n }).then(function (json) {\n json.results.forEach(function (item) {\n let pokemon = {\n name: item.name,\n detailsUrl: item.url\n };\n add(pokemon);\n });\n }).catch(function (e) {\n console.error(e);\n });\n }", "function loadList() {\n return fetch(apiUrl).then(function(response) {\n return response.json();\n }).then(function(json) {\n json.results.forEach(function(item) {\n let pokemon = {\n name: item.name,\n detailsUrl: item.url\n };\n add(pokemon);\n });\n }).catch(function(e) {\n console.error(e);\n })\n}", "function loadList() {\n return fetch(apiUrl)\n .then(function (response) {\n return response.json();\n })\n .then(function (json) {\n json.results.forEach(function (item) {\n let pokemon = {\n name: item.name,\n detailsUrl: item.url\n };\n add(pokemon);\n });\n })\n .catch(function (e) {\n console.error(e);\n });\n }", "function loadList() {\n return fetch(apiUrl)\n .then(function (response) {\n return response.json();\n })\n .then(function (json) {\n json.results.forEach(function (item) {\n let pokemon = {\n name: item.name,\n detailsUrl: item.url,\n };\n add(pokemon);\n });\n })\n .catch(function (e) {\n console.error(e);\n });\n }", "function loadList() {\n return fetch(apiUrl)\n .then(function (response) {\n return response.json();\n })\n .then(function (json) {\n json.results.forEach(function (item) {\n let pokemon = {\n name: item.name,\n detailsUrl: item.url,\n };\n add(pokemon);\n });\n })\n .catch(function (e) {\n console.error(e);\n });\n }", "function initListStorage() {\n var testList = localStorage.getItem(\"list\");\n if (testList) {\n list = JSON.parse(testList);\n }\n setList(list);\n}", "function refreshList() {\n axios.get(url + HoldRoute + \"/withtools/json\").then((response) => {\n setList(response.data);\n });\n }", "function storeListInLocalStorage(list) {\n let lists;\n if(localStorage.getItem('lists') === null){\n lists = [];\n } else {\n lists = JSON.parse(localStorage.getItem('lists'));\n }\n \n lists.push(list);\n \n localStorage.setItem('lists', JSON.stringify(lists));\n\n // document.getElementById(list.imdbID).disabled = true;\n}", "function getObjFromList(i) {\n\t\tif(i>=this.list.length) return null;\n\t\treturn this.list[i];\n\t}", "function initializeMap(list) {\n var result = {};\n for (var i = 0; i < list.length; i += 2) {\n // Call asFirstClass() here to prevent, for example, a toxic\n // function being used as the toString property of an object\n // literal.\n\tsetPub(result, list[$A$Num(i)], asFirstClass(list[$A$Num(i + 1)]));\n }\n return result;\n }", "function loadData() {\n\tlet data = JSON.parse(localStorage.getItem(\"tasks\"))\n\tlet li = \"\";\n\tfor (let i = 0; i < data.length; i++) {\n\t\tli += dataGenerat(data[i], i);\n\t\t$(\"ul\").html(\"\").append(li);\n\t}\n}", "function fromListPartial(n, list, hasStrings) {\n var ret;\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings\n ? copyFromBufferString(n, list)\n : copyFromBuffer(n, list);\n }\n return ret;\n }", "async function loadData() {\r\n // wait for response from fetch API\r\n var response = await fetch('stories.txt');\r\n // wait for response --> text\r\n let fileData = await response.text();\r\n //console.log(fileData);\r\n let combos = fileData.split(\"afeiwoh6879DWIOIh\"); // split at split constant\r\n console.log(combos.length);\r\n for (let i = 0; i < combos.length; i+=2) {\r\n let key = combos[i].trim(); // first item is title\r\n let val = combos[i + 1].trim(); // second item is story\r\n console.log(\"key: \" + key); \r\n // console.log(\"val: \" + val); \r\n stories.set(key, val);\r\n }\r\n console.log(\"stories map size: \" + stories.size);\r\n}", "function loadLPOData(id) {\n spWeb = context.get_web();\n item = spWeb.get_lists().getByTitle(lpoList).getItemById(id);\n\n context.load(item);\n context.executeQueryAsync(onGetLPODataSuccess, onGetLPODataFail);\n}", "function loadList() {\n return fetch(APIURL)\n .then(function (response) {\n return response.json(); // this returns the promise\n }).then(function (json) {\n json.results.forEach(function (item) {\n // get pokemon's name and details url when resolved\n let pokemon = {\n name: item.name.charAt(0).toUpperCase() + item.name.slice(1),\n detailsURL: item.url\n };\n add(pokemon);\n });\n }).catch(function (e) {\n console.error(e); // eslint-disable-line no-console\n });\n }", "function afterReadList(list) {\n console.log(\"list\", list);\n\n // double check if list is an array object\n list.forEach(function (data) {\n root.mapAddMarker(fireBaseGetMarkerData(data));\n });\n\n root.mapChangeMapBounds();\n }", "function load() {\n listModel.clear();\n var jsonObject = JSON.parse(listModel.source);\n var apps = jsonObject.apps\n for (var app in apps) {\n // Provide the file scheme to the icon for reliable loading of the icon. Without\n // it the path can be interpreted as a relative path to a resource file bundled\n // with the binary\n listModel.append({icon: \"file://\" + apps[app].icon, appId: apps[app].id});\n }\n}", "function loadList() {\n return fetch(apiUrl).then(function(response) {\n return response.json();\n }).then(function (json) {\n json.results.forEach(function(item) {\n let pokemon = {\n name: item.name,\n detailsUrl: item.url\n };\n addpoke(pokemon);\n });\n }).catch(function(e) {\n /* eslint-disable no-console */\n console.error(e);\n /* eslint-enable no-console */\n });\n }", "function load_activities() {\n\n if (localStorage.getItem(\"MyActivities\") != null) {\n\n // let get_MyActivities_json = localStorage.getItem(\"MyActivities\");\n // let temp = JSON.parse(get_MyActivities_json);\n let temp = new Map(JSON.parse(localStorage.MyActivities));\n\n console.log(\"# activities \", temp.size);\n if (temp.size > 0) {\n MyActivities = temp;\n console.log(\"activities present in storage\");\n } else {\n console.log(\"local storage empty\");\n MyActivities = init_MyActivities();\n console.log(MyActivities.size);\n sauvegarde();\n }\n }else{\n init_MyActivities();\n }\n\n}", "function fromListPartial(n, list, hasStrings) {\n var ret;\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n return ret;\n }", "function findObjectById(list, id){\n if(!list){\n return null;\n }\n \n for(var i = 0; i < list.size(); i++){\n if(list.get(i).id == id){\n return list.get(i);\n }\n }\n\n return null;\n}", "function updateActiveList() {\n // first get the data from the storage\n activeList = JSON.parse(localStorage.getItem(activeListName));\n if (activeList) {\n // if found some data\n console.log('There is data in the LocalStorage for the active list');\n console.log('Active array contents:', activeList);\n // then present it on the page\n repopulateList();\n } else {\n // If no data in the storage - continue\n console.log('No data in the localStorage for the active list');\n activeList = [];\n }\n}", "function loadScheduleList (){\n for (i = startHr; i <= endHr; i++) {\n time = i.toString();\n indx = i - startHr;\n scheduleList[indx].task = localStorage.getItem(time);\n if (!scheduleList[indx].task) {\n scheduleList[indx].time = time;\n scheduleList[indx].task = '';\n }\n }\n}", "function fromListPartial(n, list, hasStrings) {\n var ret;\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n return ret;\n }", "function main() {\n const lotr = new HashMap();\n\n HashMap.MAX_LOAD_RATIO = 0.5;\n HashMap.SIZE_RATIO = 3; \n\n lotr.set(\"Hobbit\", \"Bilbo\");\n lotr.set(\"Hobbit\", \"Frodo\");\n lotr.set(\"Wizard\", \"Gandalf\");\n lotr.set(\"Human\", \"Aragorn\");\n lotr.set(\"Elf\", \"Legolas\");\n lotr.set(\"Maiar\", \"The Necromancer\");\n lotr.set(\"Maiar\", \"Sauron\");\n lotr.set(\"RingBearer\", \"Gollum\");\n lotr.set(\"LadyOfLight\", \"Galadriel\");\n lotr.set(\"HalfElven\", \"Arwen\");\n lotr.set(\"Ent\", \"Treebeard\");\n\n console.log(\"LOTR\", lotr); //length is 9, there are collisions in the data under \"Hobbit\" and \"Maiar\" \n console.log(lotr.get(\"Maiar\")); // we currently don't have code to resolve collisions\n console.log(lotr.get(\"Hobbit\")); // same reason as above- no code to resolve collisions \n console.log(lotr._capacity); // 24, since we exceed the initial length of 8 we must multiply by size ratio to accomodate, 8 x 3. \n}", "function populateData(url){\nfetch(url).then(response => response.json()).then(data => {\n const top10MostLikedVideos = data.result;\n\n // 0 corresponds to the first item in the list of videos\n const firstVideo = top10MostLikedVideos[0];\n\n console.log(firstVideo); // look at the details for the first video in the developer tools\n\n top10MostLikedVideos.map(function(video, idx) {\n populateListItem(video, idx);\n });\n})\n}", "function lookupFrom(fileList) {\n var lookup = {}\n for(let node of fileList) {\n lookup[node.id] = node\n // Create dirs and files only for directory nodes\n if(!isFileNode(node)) {\n node.dirs = []\n node.files = []\n }\n }\n return lookup\n}", "function populateList(type, id) {\n\n var storyList = showLists[type][id];\n var cachedItems = itemCacheByUserId[id]\n for (var i = 0, l = cachedItems.length; i < l; i++) {\n if( cachedItems[i].status === \"0\" ) {\n if(!storyList['pendingTabs'])\n storyList['pendingTabs'] = []\n storyList['pendingTabs'][i] = cachedItems[i] || null\n }\n if( cachedItems[i].status === \"1\" ) {\n if(!storyList['workingTabs'])\n storyList['workingTabs'] = []\n storyList['workingTabs'][i] = cachedItems[i] || null\n }\n if( cachedItems[i].status === \"2\" ) {\n if(!storyList['historyTabs'])\n storyList['historyTabs'] = []\n storyList['historyTabs'][i] = cachedItems[i] || null\n }\n }\n \n}", "function loadToDoList()\n{\n //use the local storage API load the JSON formateted to-do list, and decode it\n var theList =JSON.parse(window.localStorage.getItem(\"todoList\"));\n \n if(null==theList || theList ==\"null\")\n {\n deleteAllRows(); \n }\n else\n {\n var count =0;\n for(var obj in theList)\n {\n count++; \n }\n \n //remove any existing rows from the table\n deleteAllRows();\n \n //loop through the to-dos\n for(var i=0;i<count;i++)\n {\n //adding a row to the table for each one\n addTableRow(theList[\"row\"+i],true);// true because to prevent user from being alerted as each row is loaded at startup\n }\n }\n}", "function cacheList() {\n if (list.match(/^\\w+$/)) {\n return '';\n }\n var listVar = Blockly.JavaScript.variableDB_.getDistinctName(\n 'tmpList', Blockly.Variables.NAME_TYPE);\n var code = 'var ' + listVar + ' = ' + list + ';\\n';\n list = listVar;\n return code;\n }", "function qsshift(listName, cb) {\n // this.hkeys(listName, console.log);\n // this.lrange(listName + '__order', 0, 10, console.log);\n\n return this.lpop(listName + '__order', function (err, first) {\n\n // Look for the first item in hashmap if list is empty. If it doesn't exist\n // see if there are still items in the array and set those as order\n if (!first) {\n return this.hkeys(listName, function (err, keys) {\n console.log('hashkeys', keys);\n\n if (!keys.length) {\n return cb && cb();\n }\n\n // If still keys are present in the order-array shove\n // them as paramaters in client.lpush.\n // Prepare params:\n keys.unshift(listName + '__order');\n keys.push(function (err, result) {\n if (err) {\n return cb && cb(err);\n }\n \n return this.qsshift(listName, cb);\n }.bind(this));\n\n this.lpush.apply(this, keys);\n }.bind(this));\n }\n\n return this.hget(listName, first, function (err, item) {\n if (err) {\n return cb && cb(err);\n }\n\n return this.hdel(listName, first, function (err) {\n if (err) {\n return cb && cb(err);\n }\n\n if (item === null) {\n return this.qsshift(listName, cb);\n }\n\n return cb && cb(err, first);\n }.bind(this));\n }.bind(this));\n }.bind(this));\n}", "function ListContains(list, value) //Function returns true if an item is in a list.\r\n{\r\n\tfor (i = 0; i < list.length; i++)\r\n\t{\r\n\t\tif (list[i] == value)\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}", "function getList(filename) {\n fs.readFile(filename, function(err, data) {\n if (err) {\n return console.error(err);\n }\n\n list = [];\n rawList = data.toString().split(\"\\n\");\n for (item in rawList) {\n newEntry = rawList[item].split(\",\");\n list.push(newEntry);\n }\n\n getCoordBatch(list);\n });\n}", "function loadData() {\n ul.innerHTML = \"\";\n taskList.loadFromJson(JSON.parse(localStorage.getItem(\"tasks\")) || []);\n taskList.getAllTasks().forEach(task => loadTask(task));\n}", "function getValues(list) {\n /* Get values */\n var storedValues = window.localStorage.myitems;\n /* If empty, */\n /* Then, create default */\n if(!storedValues) {\n /* Default list, could be a premade list for demoing */\n list.innerHTML = '';\n }\n /* Otherwise, update the list with the stored values */\n else {\n list.innerHTML = storedValues;\n }\n}", "function getPagePart(name, loadedList) {\n var cached = cachedPageParts[name];\n if (cached) return cached;\n try {\n cached = fs.readFileSync(config.pagePartDir + \"/\" + name, 'utf8');\n // Process inclusion in this page part.\n cached = formatPagePart(cached, loadedList);\n cachedPageParts[name] = cached;\n } catch (err) {\n console.log(\"unable to load: \" + name);\n return \"\";\n }\n return cached;\n}", "function findObjectById(list, id){\r\n\tif(!list){\r\n\t\treturn null;\r\n\t}\r\n\t\r\n\tfor(var i = 0; i < list.size(); i++){\r\n\t\tif(list.get(i).id == id){\r\n\t\t\treturn list.get(i);\r\n\t\t}\r\n\t}\r\n\r\n\treturn null;\r\n}", "function loadList() {\n var begin = ((currentPage - 1) * numberPerPage);\n var end = begin + numberPerPage;\n\n pageList = filteredData.slice(begin, end);\n console.log(pageList);\n renderTable(pageList);\n numberOfPages = getNumberOfPages(filteredData)\n check();\n}", "function searchID(_id,list){\n for (let i = 0; i < list.length; i++){\n if (list[i]._id == _id){\n return list[i];\n }\n }\n return undefined;\n}", "load() {\n // set name\n loadUnitInfo(this.state.id)\n .then(({name}) => name)\n .then((name) => {\n this.setState({\n name: name,\n });\n });\n\n // get list\n const response = searchBy(\"parent.id\", this.state.id);\n response.then((unit) => {\n var result = unit.map(function (a) {\n return {\n name: a.displayName,\n id: a.id\n }\n });\n if (result.length > 0) {\n this.setState({\n unitInfo: result,\n });\n\n }\n\n })\n }", "function List() {\n this.listSize = 0;\n this.dataStore = []; // initializes an empty array to store list elements\n this.appendIfLarger = appendIfLarger;\n this.appendIfSmaller = appendIfSmaller;\n this.largest;\n this.smallest;\n}", "function loadList(){\n xmlhttp = new XMLHttpRequest();\n xmlhttp.onreadystatechange = function() {\n\tif (this.readyState == 4 && this.status == 200) {\n\t updateList(this);\n }\n };\n xmlhttp.open(\"GET\", \"filename.xml\", true);\n xmlhttp.send();\n}", "function loadCountryList() {\n\tLookup.all({where: {'lookup_type':'COUNTRY', 'enabled_flag':'Y'}}, function(err, lookups){\n\t this.country_list = lookups;\n\t next(); // process the next tick. If you don't put it here, it will stuck at this point.\n\t}.bind(this));\n}", "function loadItemsToList() {\n var shoppingItems = JSON.parse(localStorage.getItem(\"shoppingItems\"));\n for (let item of shoppingItems) {\n $( \"#CreateShoppinglist > ul\" ).append( \"<li>\" + item + \"</li>\" );\n }\n}", "function getList(listPath) {\n return fs.readFile(listPath, \"utf-8\")\n .then(data => data\n .toString()\n .trim()\n .split(\",\")\n )\n}", "function fromListPartial(n, list, hasStrings) {\n var ret;\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n return ret;\n }", "getReadList(state, list) {\n\t\t\tstate.readList = list;\n\t\t}", "function loadPicklist(picklist_index, path) {\n let csv_file = fs.readFileSync(path).toString();\n // splits file be \"\\n\", the new line character\n let picklist_teams = csv_file.split(\"\\n\");\n // gets the picklist title from teams\n // splice automatically removes the title from the list of things\n let picklist_title = picklist_teams.splice(0,1)[0];\n $(\"#picklist-title-\" + picklist_index).text(picklist_title);\n // adds it to the picklists object\n picklists[picklist_index] = picklist_teams;\n createPicklistTable(picklist_index);\n}", "function loadLocalStorage(string) {\n\t\t//clear any existing items first\n\t\t$('.item').slideUp(100, function() {\n\t\t\t$(this).remove();\n\t\t});\n\t\t\n\n\n\t\t//what is the title of this list?\n\t\t$('#list-title').text(localStorage.getItem(string + '_list-title'));\n\t\t//what is the description?\n\t\t$('#list-desc').text(localStorage.getItem(string + '_list-desc'));\n\n\t\t//what is the color scheme?\n\t\tscheme = localStorage.getItem(string + '_color-scheme')\n\t\tcolorChange();\n\n\t\t//now all the list items\n\t\titemLength = parseInt(localStorage.getItem(string + '_list-length'), 10);\n\n\t\tfor (var i = 0; i < itemLength; i++) {\n\t\t\tvar title = localStorage.getItem(string + '_item-title_' + i);\n\t\t\tvar desc = localStorage.getItem(string + '_item-notes_' + i);\n\t\t\tvar classes = localStorage.getItem(string + '_item-classes_' + i);\n\t\t\tvar list;\n\t\t\tvar display;\n\n\t\t\t//which list does this go to?\n\t\t\t//is this an archived item?\n\t\t\tif (classes.indexOf(\"deleted\") != -1) {\n\t\t\t\t//this is archived\n\t\t\t\tlist = '#archive';\n\t\t\t\tdisplay = false;\n\t\t\t} else {\n\t\t\t\t//this goes in the main list\n\t\t\t\tlist = '#the-list';\n\t\t\t\tdisplay: true;\n\t\t\t}\n\t\t\taddMoreItems(classes, display, title, desc, list)\n\t\t}\n\t\t//end the for loop\n\n\t\t//get the time information\n\t\t//the time information\n\t\tvar savedTimeString = localStorage.getItem(string + '_time');\n\t\t//we are only using 1 clokan so far. if this ever changes, then this needs to change\n\t\tvar arrayOfTime = savedTimeString.split(',');\n\t\tfor (var j = 0; j < arrayOfTime.length; j++) {\n\t\t\tvar numeral = parseInt(arrayOfTime[j], 10);\n\t\t\tinformadata[0].push(numeral);\n\t\t}\n\t\t// console.log(informadata[0]);\n\t}", "function loadList() {\r\n\t$('#tml-list').append('<h3 class=\"tml-list-h3\">Template singoli</h3>')\r\n\t// carico i template singoli\r\n\tfor (var i = 1; i < numTemplatesS+1; i++) {\r\n\t\t// creo list item ancora\r\n\t\tvar listItem = \"<li class='tml-list-item' ><div class='tml-list-item-div'><a class='tml-list-item-a' onclick='selectTml(this)' href='javascript:void(0)' id='tml\"+i+\"'></a></div></li>\";\r\n\t\t// appendo l'elemento alla lista\r\n\t\t$('#tml-list').append(listItem);\r\n\t\t// creo l'oggetto ractive col template relativo\r\n\t\t// type 0: template singoli tml'x'.html, 1: template composti ctml'x'.html\r\n\t\tloadTemplates( i , 0);\r\n\t}\r\n\r\n\t$('#tml-list').append('<h3 class=\"tml-list-h3\">Template composti</h3>')\r\n\t// carico i template singoli\r\n\tfor (var i = 1; i < numTemplatesC+1; i++) {\r\n\t\t// creo list item ancora\r\n\t\tvar listItem = \"<li class='tml-list-item' ><div class='tml-list-item-div'><a class='tml-list-item-a' onclick='selectTml(this)' href='javascript:void(0)' id='ctml\"+i+\"'></a></div></li>\";\r\n\t\t// appendo l'elemento alla lista\r\n\t\t$('#tml-list').append(listItem);\r\n\t\t// creo l'oggetto ractive col template relativo\r\n\t\t// type 0: template singoli tml'x'.html, 1: template composti ctml'x'.html\r\n\t\tloadTemplates( i , 1);\r\n\t}\r\n\r\n}", "function get(list,index){\n if(list.includes(list[index])){\n return list[index];\n }else{\n throw \"El elemento no existe\";\n }\n}", "function fromListPartial(n,list,hasStrings){var ret;if(n<list.head.data.length){\n// slice is the same for buffers and strings\nret=list.head.data.slice(0,n);list.head.data=list.head.data.slice(n)}else if(n===list.head.data.length){\n// first chunk is a perfect match\nret=list.shift()}else{\n// result spans more than one buffer\nret=hasStrings?copyFromBufferString(n,list):copyFromBuffer(n,list)}return ret}", "loadLists(obj) {\n var listData = [];\n var i;\n console.log(obj)\n for(i = 0; i < obj.length; i++) {\n listData.push({title: obj[i]['name'], activityCount: obj[i]['activity_count'], key: obj[i]['id'].toString()})\n }\n \n this.setState({listData: listData});\n }", "function fromListPartial(n, list, hasStrings) {\n var ret;\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n return ret;\n}", "function fromListPartial(n, list, hasStrings) {\n var ret;\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n return ret;\n}", "function fromListPartial(n, list, hasStrings) {\n var ret;\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n return ret;\n}" ]
[ "0.6594202", "0.5836811", "0.57855827", "0.57712096", "0.5690001", "0.5687925", "0.567906", "0.5672089", "0.5660611", "0.5626623", "0.5584438", "0.5461377", "0.5451134", "0.5447851", "0.5418069", "0.53894234", "0.5317656", "0.5317656", "0.5317158", "0.53107667", "0.53044695", "0.53023195", "0.5295396", "0.5273875", "0.5271636", "0.52704513", "0.52688986", "0.52617127", "0.5253844", "0.5252013", "0.52519286", "0.525119", "0.5246767", "0.5243542", "0.52319473", "0.5229971", "0.52293557", "0.522842", "0.5223899", "0.520602", "0.5190242", "0.5184578", "0.5179214", "0.5178893", "0.5170544", "0.51671904", "0.5162115", "0.5155007", "0.51545054", "0.51545054", "0.5150962", "0.513889", "0.5138302", "0.51346153", "0.5125704", "0.51204383", "0.51146203", "0.51098394", "0.51037914", "0.5091332", "0.5083871", "0.5077826", "0.50757694", "0.50730693", "0.5061623", "0.50543004", "0.5053743", "0.505003", "0.5047802", "0.50427276", "0.50402355", "0.5032489", "0.50298303", "0.50275505", "0.50253147", "0.50212276", "0.50211954", "0.50201756", "0.5019857", "0.50188035", "0.50126857", "0.5010901", "0.50083053", "0.5006613", "0.50065845", "0.5006413", "0.50060314", "0.50049967", "0.50023913", "0.5001614", "0.49962246", "0.49927944", "0.49922442", "0.4991452", "0.49892178", "0.49858388", "0.49757117", "0.4972221", "0.49703866", "0.49703866", "0.49703866" ]
0.0
-1
or not in lowercase grandma still thinks that should be replaced with a 2. bless her. 'I love to text' becomes 'I love 2 text' 'see you tomorrow' becomes 'see you 2morrow' 'look at that octopus' becomes 'look at that oc2pus' Note that 'too' should become '2', not '2o'
function textin(str){ str = str.replace(/two/gi, 2).replace(/too/gi,2).replace(/to/gi,2) return str; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function textin(s){\n return s.replace(/two|too|to/gi,2)\n }", "function leetify(word) {\n //get the word in all lowercase letters\n var modifiedWord = word.toLowerCase();\n\n //replace all As with the number 4\n modifiedWord = modifiedWord.replace(/a/g, '4');\n\n //replace all Es with the number 3\n modifiedWord = modifiedWord.replace(/e/g, '3');\n\n //replace all Is with the number 1\n modifiedWord = modifiedWord.replace(/i/g, '1');\n\n //replace all Os with the number 0\n modifiedWord = modifiedWord.replace(/o/g, '0');\n\n //send it back\n //console.log(modifiedWord);\n return modifiedWord;\n}", "function leetify(word) {\n //get the word in all lowercase letters\n var modifiedWord = word.toLowerCase();\n\n //replace all As with the number 4\n modifiedWord = modifiedWord.replace(/a/g, '4');\n\n //replace all Es with the number 3\n modifiedWord = modifiedWord.replace(/e/g, '3');\n\n //replace all Is with the number 1\n modifiedWord = modifiedWord.replace(/i/g, '1');\n\n //replace all Os with the number 0\n modifiedWord = modifiedWord.replace(/o/g, '0');\n\n //send it back\n //console.log(modifiedWord);\n return modifiedWord;\n}", "function toonify(accent, sentence){\n if (accent == 'daffy') {\n var newstr = sentence.replace(/s/g, 'th');\nconsole.log(newstr);\n}\nelse if (accent == 'elmer') {\n var newstr = sentence.replace(/r/g, 'w');\nconsole.log(newstr);\n}}", "function replaceBadWords(string){\n let stringLower = string.toLowerCase();\n let arr = stringLower.split(' ');\n\n let arrRes = arr.map((item)=>{\n if(item.includes(`fuck`)){\n return item.replace(`fuck`, `****`);\n };\n\n if(item.includes(`shit`)){\n return item.replace(`shit`, `****`);\n };\n\n return item;\n });\n \n return arrRes.join(` `)[0].toUpperCase()+arrRes.join(` `).slice(1, arrRes.join(` `).length);\n\n}", "function encryptorMin(word) {\n word = word.replace(/a/gi, '4');\n word = word.replace(/e/gi, '3');\n word = word.replace(/i/gi, '1');\n word = word.replace(/s/gi, '5');\n word = word.replace(/o/gi, '0');\n console.log(word);\n}", "function replaceText(v) {\r\n v = v.replace(/\\bAndrew Philip Kehoe\\b/g, \"a monster\");\r\n v = v.replace(/\\bKehoe, Andrew Philip\\b/g, \"a monster\");\r\n v = v.replace(/\\bSeung-Hui Cho\\b/g, \"a monster\");\r\n v = v.replace(/\\bCho, Seung-Hui\\b/g, \"a monster\");\r\n v = v.replace(/\\bAdam Peter Lanza\\b/g, \"a monster\");\r\n v = v.replace(/\\bLanza, Adam Peter\\b/g, \"a monster\");\r\n v = v.replace(/\\bNikolas Jacob Cruz\\b/g, \"a monster\");\r\n v = v.replace(/\\bCruz, Nikolas Jacob\\b/g, \"a monster\");\r\n v = v.replace(/\\bThomas Watt Hamilton\\b/g, \"a monster\");\r\n v = v.replace(/\\bHamilton, Thomas Watt\\b/g, \"a monster\");\r\n v = v.replace(/\\bRobert Steinhäuser\\b/g, \"a monster\");\r\n v = v.replace(/\\bSteinhäuser, Robert\\b/g, \"a monster\");\r\n v = v.replace(/\\bCharles Joseph Whitman\\b/g, \"a monster\");\r\n v = v.replace(/\\bWhitman, Charles Joseph\\b/g, \"a monster\");\r\n v = v.replace(/\\bTim Kretschmer\\b/g, \"a monster\");\r\n v = v.replace(/\\bKretschmer, Tim\\b/g, \"a monster\");\r\n v = v.replace(/\\bMarc Lépine\\b/g, \"a monster\");\r\n v = v.replace(/\\bLépine, Marc\\b/g, \"a monster\");\r\n v = v.replace(/\\bEric David Harris\\b/g, \"a monster\");\r\n v = v.replace(/\\bHarris, Eric David\\b/g, \"a monster\");\r\n v = v.replace(/\\bWellington Menezes de Oliveira\\b/g, \"a monster\");\r\n v = v.replace(/\\bMenezes de Oliveira, Wellington\\b/g, \"a monster\");\r\n v = v.replace(/\\bFarda Gadirov\\b/g, \"a monster\");\r\n v = v.replace(/\\bGadirov, Farda\\b/g, \"a monster\");\r\n v = v.replace(/\\bBai Ningyang\\b/g, \"a monster\");\r\n v = v.replace(/\\bWilli Walter Seifert\\b/g, \"a monster\");\r\n v = v.replace(/\\bSeifert, Willi Walter\\b/g, \"a monster\");\r\n v = v.replace(/\\bDimitrios Pagourtzis\\b/g, \"a monster\");\r\n v = v.replace(/\\bPagourtzis\\b/g, \"a monster\");\r\n v = v.replace(/\\bPagourtzis, Dimitrios\\b/g, \"a monster\");\r\n v = v.replace(/\\bMatti Juhani Saari\\b/g, \"a monster\");\r\n v = v.replace(/\\bSaari, Matti Juhani\\b/g, \"a monster\");\r\n v = v.replace(/\\bWu Huanming\\b/g, \"a monster\");\r\n v = v.replace(/\\bZhao Moumou\\b/g, \"a monster\");\r\n v = v.replace(/\\bChristopher Sean Harper-Mercer\\b/g, \"a monster\");\r\n v = v.replace(/\\bHarper-Mercer, Christopher Sean\\b/g, \"a monster\");\r\n v = v.replace(/\\bJeffrey James Weise\\b/g, \"a monster\");\r\n v = v.replace(/\\bWeise, Jeffrey James\\b/g, \"a monster\");\r\n v = v.replace(/\\bYan Yanming\\b/g, \"a monster\");\r\n v = v.replace(/\\bMamoru Takuma\\b/g, \"a monster\");\r\n v = v.replace(/\\bTakuma, Mamoru\\b/g, \"a monster\");\r\n v = v.replace(/\\bAla Hisham Abu Dheim\\b/g, \"a monster\");\r\n v = v.replace(/\\bZheng Minsheng\\b/g, \"a monster\");\r\n v = v.replace(/\\bPekka-Eric Auvinen\\b/g, \"a monster\");\r\n v = v.replace(/\\bAuvinen, Pekka-Eric\\b/g, \"a monster\");\r\n v = v.replace(/\\bPekka-Eric\\b/g, \"a monster\");\r\n v = v.replace(/\\bU Win-maung\\b/g, \"a monster\");\r\n v = v.replace(/\\bWang Xiangjun\\b/g, \"a monster\");\r\n v = v.replace(/\\bOne L. Goh\\b/g, \"a monster\");\r\n v = v.replace(/\\bGoh, One L\\b/g, \"a monster\");\r\n v = v.replace(/\\bLee Chi Hang\\b/g, \"a monster\");\r\n v = v.replace(/\\bMohammed Ahmad Misleh al-Nazari\\b/g, \"a monster\");\r\n v = v.replace(/\\bBranimir Donchev\\b/g, \"a monster\");\r\n v = v.replace(/\\bDonchev, Branimir\\b/g, \"a monster\");\r\n v = v.replace(/\\bAnatoly\\b/g, \"a monster\");\r\n v = v.replace(/\\bFedorenko, Anatoly\\b/g, \"a monster\");\r\n v = v.replace(/\\bSergei Lepnev\\b/g, \"a monster\");\r\n v = v.replace(/\\bLepnev, Sergei\\b/g, \"a monster\");\r\n v = v.replace(/\\bPatrick Edward Purdy\\b/g, \"a monster\");\r\n v = v.replace(/\\bPurdy, Patrick Edward\\b/g, \"a monster\");\r\n v = v.replace(/\\bMohammed Fathi Farhat\\b/g, \"a monster\");\r\n v = v.replace(/\\bSteven Phillip Kazmierczak\\b/g, \"a monster\");\r\n v = v.replace(/\\bKazmierczak, Steven Phillip\\b/g, \"a monster\");\r\n v = v.replace(/\\bKarel Charva\\b/g, \"a monster\");\r\n v = v.replace(/\\bCharva, Karel\\b/g, \"a monster\");\r\n v = v.replace(/\\bAndrew Douglas Golden\\b/g, \"a monster\");\r\n v = v.replace(/\\bGolden, Andrew Douglas\\b/g, \"a monster\");\r\n v = v.replace(/\\bCharles Carl Roberts\\b/g, \"a monster\");\r\n v = v.replace(/\\bRoberts, Charles Carl\\b/g, \"a monster\");\r\n v = v.replace(/\\bKipland Philip Kinkel\\b/g, \"a monster\");\r\n v = v.replace(/\\bKinkel, Kipland Philip\\b/g, \"a monster\");\r\n v = v.replace(/\\bHeinz Jakob Friedrich Ernst Schmidt\\b/g, \"a monster\");\r\n v = v.replace(/\\bSchmidt, Heinz Jakob Friedrich Ernst\\b/g, \"a monster\");\r\n v = v.replace(/\\bLiu Hongwen\\b/g, \"a monster\");\r\n v = v.replace(/\\bKim De Gelder\\b/g, \"a monster\");\r\n v = v.replace(/\\bDe Gelder, Kim\\b/g, \"a monster\");\r\n v = v.replace(/\\bEric Christopher Houston\\b/g, \"a monster\");\r\n v = v.replace(/\\bHouston, Eric Christopher\\b/g, \"a monster\");\r\n v = v.replace(/\\bFang Jiantang\\b/g, \"a monster\");\r\n v = v.replace(/\\bWu Yechang\\b/g, \"a monster\");\r\n v = v.replace(/\\bAnthony F. Barbaro\\b/g, \"a monster\");\r\n v = v.replace(/\\bBarbaro, Anthony F.\\b/g, \"a monster\");\r\n v = v.replace(/\\bStanislaw Lawrynowicz\\b/g, \"a monster\");\r\n v = v.replace(/\\bLawrynowicz, Stanislaw\\b/g, \"a monster\");\r\n v = v.replace(/\\bLu Xiaoxi\\b/g, \"a monster\");\r\n v = v.replace(/\\bGabe Parker\\b/g, \"a monster\");\r\n v = v.replace(/\\bParker, Gabe\\b/g, \"a monster\");\r\n v = v.replace(/\\bRobert Kausler\\b/g, \"a monster\");\r\n v = v.replace(/\\bKausler, Robert\\b/g, \"a monster\");\r\n v = v.replace(/\\bMichael Peter Slobodian\\b/g, \"a monster\");\r\n v = v.replace(/\\bSlobodian, Michael Peter\\b/g, \"a monster\");\r\n v = v.replace(/\\bCharles Andrew Williams\\b/g, \"a monster\");\r\n v = v.replace(/\\bWilliams, Charles Andrew\\b/g, \"a monster\");\r\n v = v.replace(/\\bStephen Paddock\\b/g, \"a monster\");\r\n v = v.replace(/\\bOmar Mateen\\b/g, \"a monster\");\r\n v = v.replace(/\\bAdam Lanza\\b/g, \"a monster\");\r\n v = v.replace(/\\bDevin Patrick Kelley\\b/g, \"a monster\");\r\n v = v.replace(/\\bGeorges Pierre Hennard\\b/g, \"a monster\");\r\n v = v.replace(/\\bGeorges Hennard\\b/g, \"a monster\");\r\n v = v.replace(/\\bJames Huberty\\b/g, \"a monster\");\r\n v = v.replace(/\\bCharles Whitman\\b/g, \"a monster\");\r\n v = v.replace(/\\bnikolas cruz\\b/g, \"a monster\");\r\n v = v.replace(/\\bNikolas Cruz\\b/g, \"a monster\");\r\n v = v.replace(/\\bRizwan Farook\\b/g, \"a monster\");\r\n v = v.replace(/\\bTashfeen Malik\\b/g, \"a monster\");\r\n v = v.replace(/\\bPatrick Sherrill\\b/g, \"a monster\");\r\n v = v.replace(/\\bEric Harris\\b/g, \"a monster\");\r\n v = v.replace(/\\bDylan Klebold\\b/g, \"a monster\");\r\n v = v.replace(/\\bDylan Bennet Klebold\\b/g, \"a monster\");\r\n v = v.replace(/\\bJiverly Antares Wong\\b/g, \"a monster\");\r\n v = v.replace(/\\bJiverly Voong\\b/g, \"a monster\");\r\n v = v.replace(/\\bNidal Hasan\\b/g, \"a monster\");\r\n v = v.replace(/\\bNidal Malik Hasan\\b/g, \"a monster\");\r\n v = v.replace(/\\bHoward Unruh\\b/g, \"a monster\");\r\n v = v.replace(/\\bHoward Barton Unruh\\b/g, \"a monster\");\r\n v = v.replace(/\\bGeorge Banks\\b/g, \"a monster\");\r\n v = v.replace(/\\bGeorge Emil Banks\\b/g, \"a monster\");\r\n v = v.replace(/\\bKwan Fai \"Willie\" Mak\\b/g, \"a monster\");\r\n v = v.replace(/\\bWai-Chiu \"Tony\" Ng\\b/g, \"a monster\");\r\n v = v.replace(/\\bBenjamin Ng\\b/g, \"a monster\");\r\n v = v.replace(/\\bAaron Alexis\\b/g, \"a monster\");\r\n v = v.replace(/\\bJames Holmes\\b/g, \"a monster\");\r\n v = v.replace(/\\bJames Eagan Holmes\\b/g, \"a monster\");\r\n v = v.replace(/\\bJames Ruppert\\b/g, \"a monster\");\r\n v = v.replace(/\\bJames Urban Ruppert\\b/g, \"a monster\");\r\n v = v.replace(/\\bMichael Kenneth McLendon\\b/g, \"a monster\");\r\n v = v.replace(/\\bChristopher Thomas\\b/g, \"a monster\");\r\n v = v.replace(/\\bJames Edward Pough\\b/g, \"a monster\");\r\n v = v.replace(/\\bJames Edward \"Pop\" Pough\\b/g, \"a monster\");\r\n v = v.replace(/\\bJames Pough\\b/g, \"a monster\");\r\n v = v.replace(/\\bMark O. Barton\\b/g, \"a monster\");\r\n v = v.replace(/\\bMark Orrin Barton\\b/g, \"a monster\");\r\n v = v.replace(/\\bMark Barton\\b/g, \"a monster\");\r\n v = v.replace(/\\bJeff Weise\\b/g, \"a monster\");\r\n v = v.replace(/\\bJeffrey Weise\\b/g, \"a monster\");\r\n v = v.replace(/\\bChris Harper-Mercer\\b/g, \"a monster\");\r\n v = v.replace(/\\bHarper-Mercer\\b/g, \"a monster\");\r\n v = v.replace(/\\bAnthony Barbaro\\b/g, \"a monster\");\r\n v = v.replace(/\\bAndrew Kehoe\\b/g, \"a monster\");\r\n v = v.replace(/\\bThomas Hamilton\\b/g, \"a monster\");\r\n v = v.replace(/\\bWellington Oliveira\\b/g, \"a monster\");\r\n v = v.replace(/\\bWalter Seifert\\b/g, \"a monster\");\r\n v = v.replace(/\\bMatti Saari\\b/g, \"a monster\");\r\n v = v.replace(/\\bChristopher a monster\\b/g, \"a monster\");\r\n v = v.replace(/\\bAlaa Abu Dhein\\b/g, \"a monster\");\r\n v = v.replace(/\\bMichael Tselousov\\b/g, \"a monster\");\r\n v = v.replace(/\\bOne Goh\\b/g, \"a monster\");\r\n v = v.replace(/\\bElliot Rodger\\b/g, \"a monster\");\r\n v = v.replace(/\\bPatrick Purdy\\b/g, \"a monster\");\r\n v = v.replace(/\\bSteven Kazmierczak\\b/g, \"a monster\");\r\n v = v.replace(/\\bAndrew Golden\\b/g, \"a monster\");\r\n v = v.replace(/\\bMitchell Johnson\\b/g, \"a monster\");\r\n v = v.replace(/\\bCharles Roberts\\b/g, \"a monster\");\r\n v = v.replace(/\\bShi Ruoqiu\\b/g, \"a monster\");\r\n v = v.replace(/\\bRobert Smith\\b/g, \"a monster\");\r\n v = v.replace(/\\bJohn Zawahri\\b/g, \"a monster\");\r\n v = v.replace(/\\bGang Lu\\b/g, \"a monster\");\r\n v = v.replace(/\\bKipland Kinkel\\b/g, \"a monster\");\r\n v = v.replace(/\\bHeinz Schmidt\\b/g, \"a monster\");\r\n v = v.replace(/\\bMatthew Murray\\b/g, \"a monster\");\r\n v = v.replace(/\\bChen Peiquan\\b/g, \"a monster\");\r\n v = v.replace(/\\bClemmie Henderson\\b/g, \"a monster\");\r\n v = v.replace(/\\bWang Hongbin\\b/g, \"a monster\");\r\n v = v.replace(/\\bJaylen Fryberg\\b/g, \"a monster\");\r\n v = v.replace(/\\bAlexander Koryakov\\b/g, \"a monster\");\r\n v = v.replace(/\\bMohammed Merah\\b/g, \"a monster\");\r\n v = v.replace(/\\bAnton Pettersson\\b/g, \"a monster\");\r\n v = v.replace(/\\bMa Jiajue\\b/g, \"a monster\");\r\n v = v.replace(/\\bLuke Woodham\\b/g, \"a monster\");\r\n v = v.replace(/\\bFelin Mateo\\b/g, \"a monster\");\r\n v = v.replace(/\\bChen Yanfu\\b/g, \"a monster\");\r\n v = v.replace(/\\bMichael Carneal\\b/g, \"a monster\");\r\n v = v.replace(/\\bRafael Solich\\b/g, \"a monster\");\r\n v = v.replace(/\\bPeter Odighizuwa\\b/g, \"a monster\");\r\n v = v.replace(/\\bThomas Lane\\b/g, \"a monster\");\r\n v = v.replace(/\\bSuthat Wannasarn\\b/g, \"a monster\");\r\n v = v.replace(/\\bBarry Loukaitis\\b/g, \"a monster\");\r\n v = v.replace(/\\bAdam Labus\\b/g, \"a monster\");\r\n v = v.replace(/\\bFrederick Davidson\\b/g, \"a monster\");\r\n v = v.replace(/\\bRobert Flores Jr\\b/g, \"a monster\");\r\n v = v.replace(/\\bDalton Stidham\\b/g, \"a monster\");\r\n v = v.replace(/\\bMichael Slobodian\\b/g, \"a monster\");\r\n v = v.replace(/\\bCharles Williams\\b/g, \"a monster\");\r\n v = v.replace(/\\bTyrone Mitchell\\b/g, \"a monster\");\r\n v = v.replace(/\\bJohn Higgins\\b/g, \"a monster\");\r\n v = v.replace(/\\bBrenda Spencer\\b/g, \"a monster\");\r\n v = v.replace(/\\bJames Wilson Jr\\b/g, \"a monster\");\r\n v = v.replace(/\\bRobert Poulin\\b/g, \"a monster\");\r\n v = v.replace(/\\bMark Houston\\b/g, \"a monster\");\r\n v = v.replace(/\\bSteven Abrams\\b/g, \"a monster\");\r\n v = v.replace(/\\bHuan Yun Xiang\\b/g, \"a monster\");\r\n v = v.replace(/\\bYang Jiaqin\\b/g, \"a monster\");\r\n v = v.replace(/\\bWayne Lo\\b/g, \"a monster\");\r\n v = v.replace(/\\bAnatcha, Boonkwan\\b/g, \"a monster\");\r\n v = v.replace(/\\bBoonkwan Anatcha\\b/g, \"a monster\");\r\n v = v.replace(/\\bWu Jianguo\\b/g, \"a monster\");\r\n v = v.replace(/\\bChen Wenzhen\\b/g, \"a monster\");\r\n v = v.replace(/\\bWilliam Atchison\\b/g, \"a monster\");\r\n v = v.replace(/\\bJames Wilson Jr\\b/g, \"a monster\");\r\n v = v.replace(/\\bEric Houston\\b/g, \"a monster\");\r\n\r\n return v;\r\n}", "function fruitChange(speech) {\n if (typeof speech !== 'string') return \"Strawberry\";\n \n speech = speech.replace('strawberry', 'banana');\n speech = speech.replace('Strawberries', 'Bananas');\n speech = speech.replace('strawberries', 'bananas');\n speech = speech.replace('Strawberry', 'Banana');\n return speech; \n}", "function myReplace(str, before, after) {\r\n var str2= str.split(' ')\r\n for(var i= 0; i<str2.length; i++){\r\n if(str2[i]=== before){\r\n str2[i]=after\r\n var letra=before[0]// letra de antes\r\n //console.log(letra)\r\n if(letra === letra.toUpperCase()){ \r\n//console.log('meh')\r\n var letra2= after[0].toUpperCase() \r\n var after2=after.slice(1)\r\n //console.log(letra2+after2)\r\n str2.splice(i, 1, letra2+after2)\r\n }else{\r\n var letra2= after[0].toLowerCase()\r\n console.log('meee')\r\n str2.splice(i, 1, letra2+after.slice(1))\r\n }\r\n }\r\n }\r\n var str3= str2.join(' ')\r\n return str3;\r\n}", "function ReplaceText(text) {\n text = String(text);\n\n function mixCase(letter) {\n var upper = Math.random() < 0.5;\n if (upper) {\n return letter.toUpperCase();\n }\n else {\n return letter.toLowerCase();\n }\n }\n\n function lowCase(letter) {\n return letter.toLowerCase();\n }\n\n function upCase(letter) {\n return letter.toUpperCase();\n }\n\n var answer = \"\";\n var cases = [];\n\n for (var i = 0; i < text.length; i++) {\n if (text[i] == '<') {\n i++;\n if (text[i] == \"/\") {\n cases.pop();\n while (text[i] != '>') {\n i++;\n }\n }\n else if (text[i] == 'm') {\n cases.push(mixCase);\n while (text[i] != '>') {\n i++;\n }\n }\n else if (text[i] == 'u') {\n cases.push(upCase);\n while (text[i] != '>') {\n i++;\n }\n }\n else if (text[i] == 'l') {\n cases.push(lowCase);\n while (text[i] != '>') {\n i++;\n }\n }\n else {\n alert(i + \"Error!\");\n }\n }\n else {\n if (cases.length == 0) {\n answer += text[i];\n }\n else {\n var currLetter = text[i];\n\n for (var j = cases.length - 1; j >= 0; j--) {\n currLetter = cases[j](currLetter);\n }\n\n answer += currLetter;\n }\n }\n }\n\n return answer;\n}", "function mustpraise(s){\n //Praise makes people more handsome\n var changeCount = 0\n var toUpper = false\n var pos\n var c = s.replace(/\\b(?:evil|greedy|ugly|shameless|obscene|obese)/ig, function(match,index) {\n changeCount++\n pos = index\n if(match.charCodeAt(0) < 97) {\n toUpper = true\n return 'HANDSOME'\n } else {\n return 'handsome'\n }\n }).replace(/\\bhate/ig, function(match) {\n if(match.charCodeAt(0) < 97 || toUpper) {\n return 'PRAISE'\n } else {\n return 'praise'\n }\n })\n if(c.length < 50 && changeCount === 0) {\n c += ' The handsome myjinxin, we praise him!!!!'\n } else if(c.length < 50) {\n var up = toUpper === true ? 'VERY ' : 'very '\n while(c.length < 50) {\n c = c.substring(0, pos) + up + c.substring(pos)\n }\n }\n return c\n}", "function myReplace(str, before, after) {\n // if char at first index of before matches itself made uppercase ->\n if (before[0] === before[0].toUpperCase()) {\n // first letter in after is replaced with itself uppercase \n after = after.replace(/[a-z]/i , after[0].toUpperCase());\n }\n // replace word (before) in str with after. Return str\n str = str.replace(before, after);\n return str;\n}", "function filterProfanity(txtmsg){\n txtmsg;\n var lowertxtmsg = txtmsg.toLowerCase();\n var profanity = [\"fuck\", \"shit\", \"bitch\", \n \"cunt\", \"fucking\", \"fuckyou\", \"gay\", \"retard\", \"retarted\", \"function\"];\n for(var i=0; i < profanity.length; i++){\n lowertxtmsg = lowertxtmsg.replace(profanity[i], \"####\");\n }\n return lowertxtmsg;\n }", "function doReplacement(str) {\n\n\t\t// replace a bunch of common words and phrases with VICEisms\n\t\t// NOTE: I'm not sure how well this scales, but it's about as good\n\t\t// as JS can do.\n\t\treturn str\n\t\t\t.replace(/\\s(a\\s*)?man\\s/g, ' some guy ')\n\t\t\t.replace(/\\sdoctor[\\s\\.]/g, ' my dealer ')\n\t\t\t.replace(/\\sdoctors[\\s\\.]/g, ' the people at my dispensery ')\n\t\t\t.replace(/\\sscientist[\\s\\.]/g, ' some smart guy ')\n\t\t\t.replace(/\\sscientists[\\s\\.]/g, randomCurseWord('some', 'nerds'))\n\t\t\t.replace(/\\sscience[\\s\\.]/g, ' cool stuff ')\n\t\t\t.replace(/\\smany\\s/g, ' a lot of ')\n\t\t\t.replace(/\\s(in)?\\s*the\\s*world[\\s\\.]/g, ' somewhere outside of Brooklyn ')\n\t\t\t.replace(/\\smy\\s/g, randomCurseWord('my', ''))\n\t\t\t.replace(/\\syour\\s/g, randomCurseWord('your', ''))\n\t\t\t.replace(/\\shis\\s/g, randomCurseWord('his', ''))\n\t\t\t.replace(/\\sher\\s/g, randomCurseWord('her', ''))\n\t\t\t.replace(/\\sa\\s/g, randomCurseWord('a', ''));\n\n\t\t// TODO: insert random VICEy phrases\n\t}", "function fix(){\n var str1 = document.getElementById(\"change\").innerHTML;\n var rep1 = str1.replace(/strawberries/gi, \" bananas \").replace(/strawberry/gi,\"banana\");\n document.getElementById(\"change\").innerHTML = rep1;\n }", "function translatePigLatin(str) {\n\nlet myRegex = /^([aeiou])/\n\nreturn str\n .replace(/^[aeiou]\\w*/,\"$&way\")\n .replace(/(^[^aeiou]+)(\\w*)/, \"$2$1ay\");\n\n \n}", "function SwapII(str) { \n str = str.replace(/(\\d)([A-Za-z]+)(\\d)/, \"$3$2$1\");\n var parts = str.split('');\n var results = '';\n for (var i = 0; i < parts.length; i++){\n if (parts[i] == parts[i].toLowerCase()){\n results += parts[i].toUpperCase();\n } else if (parts[i] == parts[i].toUpperCase()){\n results += parts[i].toLowerCase();\n } else {\n results += parts[i];\n }\n }\n return results;\n}", "function myReplace1(str, before, after) {\n // Find index where before is on string\n var index = str.indexOf(before);\n // Check to see if the first letter is uppercase or not\n if (str[index] === str[index].toUpperCase()) {\n // Change the after word to be capitalized before we use it.\n after = after.charAt(0).toUpperCase() + after.slice(1);\n } else {\n // Change the after word to be uncapitalized before we use it.\n after = after.charAt(0).toLowerCase() + after.slice(1);\n }\n // Now replace the original str with the edited one.\n str = str.replace(before, after);\n\n return str;\n}", "static spongebobMemeify(text, acknowledge) {\n let split = text.split('');\n if (acknowledge && acknowledge.length && text.startsWith(acknowledge)) split.splice(0,acknowledge.length);\n return split.map((char, index) => {\n if (index % 2 === 0) return char.toLowerCase();\n else return char.toUpperCase();\n }).join('');\n }", "function replaceVowel(word){\n word = word.toLowerCase();\n return word\n .replace(/a/g,\"1\")\n .replace(/e/g,\"2\")\n .replace(/i/g,\"3\")\n .replace(/o/g,\"4\")\n .replace(/u/g,\"5\");\n \n}", "function unpluralize(word) {\n if (word.match(/is\\b/g)) {\n return word;\n } else if (word.match(/ies\\b/g)) {\n return word.replace(/.{3}\\b/, 'y');\n } else if (word.match(/ses\\b|hes\\b|xes\\b|zes\\b/g)) {\n return word.replace(/.{2}\\b/, '');\n } else if (word.match(/s\\b/g)) {\n return word.replace(/.{1}\\b/, '');\n } else {\n return word;\n }\n}", "function replaceText(v)\n{\n //Replace League of Legends with Time Wasting Olympics\n v = v.replace(\n /\\b(?:League of Legends)|(?:Legends of League)\\b/g,\n \"Time Wasting Olympics\"\n );\n v = v.replace(/\\b(?:LEAGUE OF LEGENDS)\\b/g, \"TIME WASTING OLYMPICS\");\n\n //Changes worlds to something more palatable\n v = v.replace(/\\b(?:Worlds)\\b/g, \"NoogieCon2k15\");\n v = v.replace(/\\b(?:worlds)\\b/g, \"NoogieCon2k15\");\n\n //Changes the word Esports\n v = v.replace(/\\b(?:Esports)\\b/g, \"nErdsports\");\n v = v.replace(/\\b(?:esports)\\b/g, \"nErdsports\");\n v = v.replace(/\\b(?:esport)\\b/g, \"nErdsport\"); \n v = v.replace(/\\b(?:esport)\\b/g, \"nErdsport\");\n\n\n\n //Change the word lol and different renditions of it \n v = v.replace(/\\b(?:LOL)\\b/g, \"laugh out loud ;D\");\n v = v.replace(/\\b(?:LoL)\\b/g, \"laugh out loud ;D\");\n v = v.replace(/\\b(?:lol)\\b/g, \"laugh out loud ;D\");\n\n return v;\n}", "function myReplace2(str, before, after) {\n // Check if first character of argument \"before\" is a capital or lowercase letter and change the first character of argument \"after\" to match the case\n if (/^[A-Z]/.test(before)) {\n after = after[0].toUpperCase() + after.substring(1)\n } else {\n after = after[0].toLowerCase() + after.substring(1)\n }\n\n // return string with argument \"before\" replaced by argument \"after\" (with correct case)\n return str.replace(before, after);\n}", "function replacer(match) {\n let len = match.length;\n\n // This is completely arbitrary but just demonstrating\n // you can make up your own logic\n if (len == 3) {\n // Make the word upper case\n return match.toUpperCase();\n } else if (len == 4) {\n // Pick a random word from the array\n let index = floor(random(0, four.length));\n return four[index];\n } else if (len == 5) {\n // Pick a random word from the array\n let index = floor(random(0, five.length));\n return five[index];\n }\n\n }", "function myReplace2(str, before, after) {\n // Check if first character of argument \"before\" is a capital or lowercase letter and change the first character of argument \"after\" to match the case\n if (/^[A-Z]/.test(before)) {\n //change after letter to uppercase if before letter is uppercase\n after = after[0].toUpperCase() + after.substring(1)\n } else {\n //change after letter to lowercase if before letter is lowercase\n after = after[0].toLowerCase() + after.substring(1)\n }\n\n // return string with argument \"before\" replaced by argument \"after\" (with correct case)\n return str.replace(before, after);\n}", "function crazyCase3SonOfCrazyCase(str) {\n let newStr = '';\n let crazies = ' 1234567890!@#$%.,?/()'\n let count = 0;\n for (let i = 0; i < str.length; i++) {\n\n if (crazies.includes(str[i])){\n newStr = newStr + str[i].toLowerCase();\n }\n else if (count % 2 === 1) {\n \n newStr = newStr + str[i].toUpperCase();\n count ++;\n } else {\n newStr = newStr + str[i].toLowerCase();\n count ++\n }\n }\n return newStr\n }", "function myReplace(str, before, after) {\r\n var arr = [];\r\n arr = str.split(\" \");\r\n \r\n for(var i = 0; i < arr.length; i++){\r\n if(arr[i]===before){\r\n if(arr[i].charCodeAt(0) <= 90){\r\n var up = after.substr(0,1).toUpperCase();\r\n var rest = after.substr(1);\r\n after = up+rest;\r\n arr[i] = after;\r\n }\r\n else{\r\n arr[i] = after;\r\n }\r\n }\r\n }\r\n str = arr.join(\" \");\r\n return str;\r\n}", "function staggeredCase(input) {\n\n}", "function danish(sentence) {\n \nreturn sentence.replace(/\\bapple|blueberry|cherry\\b/, 'danish');\n\n}", "function changeCase() {\n let text = 'This IS a Sample TeXt';\n var newtext = \"\";\n for(var i = 0; i<text.length; i++){\n if(text[i] === text[i].toLowerCase()){\n newtext += text[i].toUpperCase();\n }else {\n newtext += text[i].toLowerCase();\n }\n }\n return newtext;\n}", "function tongues(code) {\n var alpha = 'aiyeoubkxznhdcwgpvjqtsrlmf';\n var repl = 'eouaiypvjqtsrlmfbkxznhdcwg';\n \n return code.replace(/[a-z]/gi, function(m) {\n var lower = m.toLowerCase();\n return lower === m ? repl[alpha.indexOf(m)] : repl[alpha.indexOf(lower)].toUpperCase();\n });\n}", "function translatePigLatin(str) {\nlet consonantRegex = /^[^aeiou]+/;\nlet newConsonants = str.match(consonantRegex)\nreturn newConsonants !== null\n? str\n.replace(consonantRegex,\"\")\n.concat(newConsonants)\n.concat(\"ay\")\n: str.concat(\"way\")\n}", "function ermahgerd(text) {\n return text.toUpperCase().replace(/[AEIOU]/g, \"ER\").replace(/ERER|ERH/g, \"ER\").replace(/MY/g, \"MAH\").replace(/RR/g, \"R\").replace(/\\b[A-Z]{3,}ER\\b/g, match=>match.substr(0, match.length-2));\n}", "function replaceNice (string) {\n return string.replace('-', ' ').split(' ').map(function (elm) {\n return elm.charAt(0).toUpperCase() + elm.slice(1)\n }).join(' ')\n }", "function correct(string)\n{\n return string\n .replace(/5/g, 'S')\n .replace(/0/g, 'O')\n .replace(/1/g, 'I');\n\n}", "function pluralize(text){\n var replacements = {\n 'Yourself': 'Themselves',\n 'yourself': 'themselves',\n 'Your': 'Their',\n 'your': 'their',\n 'You': 'They',\n 'you': 'they'\n };\n\n $.each(replacements, function (singular, plural){\n text = text.replace(new RegExp(singular,'g'),plural);\n });\n return text;\n}", "function myReplace(str, before, after) {\r\n\ts = str.split(' ');\r\n\ti = str.indexOf(before);\r\n\tfor (var i in s) {\r\n\t\tif (s[i] !== before)\r\n\t\t\tcontinue;\r\n\t\tif (s[i][0].toLowerCase() !== s[i][0]) {\r\n\t\t\ts[i] = after;\r\n\t\t\ts[i] = s[i][0].toUpperCase() + after.slice(1);\r\n\t\t} else {\r\n\t\t\ts[i] = after;\r\n\t\t}\r\n\t}\r\n\treturn s.join(' ');\r\n}", "function changeToPigLatin(text) {\n\n var wordArray = text.split(\" \");\n var newtext = \"\";\n\n wordArray.forEach(element => {\n\n if (element[0] === 'a' || element[0] === 'e' || element[0] === 'i' || element[0] === 'u' || element[0] === 'o') {\n console.log(newtext.concat(element.slice(1, 6) + element[0] + \"way\"));\n }\n else if (getCount(element) === 1) {\n console.log(newtext.concat(element.slice(1, 7) + element[0] + \"ay\"));\n }\n else if (getCount(element) === 2) {\n console.log(newtext.concat(element.slice(2, 8) + element[0] + element[1] + \"ay\"));\n }\n\n });\n\n return text;\n}", "function makespeakable(phrase) {\n phrase = phrase.replace(/['\"]/g, \"\");\n phrase = phrase.replace(/[-+]/g, \" \");\n phrase = phrase.replace(/([A-Z])(?=[A-Z])/g, \"$1 \"); //split apart capitals\n phrase = phrase.replace(/([A-Za-z])([0-9])/g, \"$1 $2\"); // split letter-number\n phrase = phrase.replace(/([0-9])([A-Za-z])/g, \"$1 $2\"); // split number-letter\n return phrase.replace(/\\b[A-Z](?=[[:space:][:punct:]])/g, function(match) {\n return say_letter[match.toUpperCase()];\n })\n .replace(/[0-9]+ ?(st|nd|rd|th)\\b/g, function(match) {\n return n2w.toOrdinalWords(parseInt(match)).replace(/[-,]/g, \" \");\n })\n .replace(/[0-9]+/g, function(match) {\n return n2w.toWords(match).replace(/[-,]/g, \" \");\n });\n}", "function myTranslatePigLatin(str) {\n const regex = /(^[b-df-hj-np-tv-z]+)(\\w*)/g;\n if (regex.test(str)){\n return str.replace(regex, '$2$1ay');\n }\n return str.concat('way');\n}", "function change_case(words) {\n let string = \"\";\n for (let i = 0; i < words.length; i++) {\n if (/[A-Z]/.test(words[i])) string += words[i].toLowerCase();\n else string += words[i].toUpperCase();\n }\n return string;\n}", "function leech(v){\n\tv=v.replace(/o/gi,\"0\");\n v=v.replace(/i/gi,\"1\");\n v=v.replace(/z/gi,\"2\");\n v=v.replace(/e/gi,\"3\");\n v=v.replace(/a/gi,\"4\");\n v=v.replace(/s/gi,\"5\");\n v=v.replace(/t/gi,\"7\");\n return v;\n}", "function captialize(word){\n\treturn word.charAt(0).toUpperCase() + word.slice(1);\n}", "function wordCaseChanger(word){\r\n\tlet output='';\r\n\tlet changedLetter='';\r\n\tfor(let i=0; i<word.length; i++){\r\n\t\tchangedLetter=caseChanger(word[i]);\r\n\t\toutput=output+changedLetter;\r\n\t}\r\n\tconsole.log(output);\r\n}", "function encryptorMassive(word) {\n let newWord = '';\n word = word.toLowerCase();\n for(let i = 0; i < word.length; i++) {\n if(word[i] == 'a') {\n newWord += 4;\n } else if(word[i] == 's') {\n newWord += 5;\n } else if(word[i] == 'i') {\n newWord += 1;\n } else if(word[i] == 'e') {\n newWord += 3;\n } else if(word[i] == 'o') {\n newWord += 0;\n } else {\n newWord += word[i];\n }\n }\n console.log(newWord);\n}", "function myReplace(str, before, after) {\n var index = str.indexOf(before);\n if(str[index] === str[index].toUpperCase() ) {\n after = after.charAt(0).toUpperCase() + after.slice(1);\n } else {\n after = after.charAt(0).toLowerCase() + after.slice(1);\n }\n str = str.replace(before, after);\n \n return str;\n \n }", "function makeItSpongeBob(string) {\n var doubleCase = '';\n var i = 0;\n while (i < string.length) {\n var n = string.charAt(i);\n //console.log(`value of n : ${n}`);\n if(n == n.toUpperCase()) {\n n = n.toLowerCase();\n console.log(n);\n }\n doubleCase +=n;\n if(n == n.toLowerCase()) {\n n = n.toUpperCase();\n console.log(n);\n }\n doubleCase +=n;\n \n \n i++;\n }\n console.log(doubleCase);\n }", "function changeScream(str) {\n\n let arrayScream = str.split(\" \")\n\n for (let i = 0; i < arrayScream.length; i++) {\n const wordScream = arrayScream[i]\n if (wordScream.includes(\"scream\")) {\n arrayScream[i] = wordScream.toUpperCase()\n }\n }\n\n return arrayScream.join(\" \")\n\n}", "function myReplace(str, before, after) {\n var newBefore;\n if(before.toLowerCase() === before){\n //make after lower\n newBefore = after.toLowerCase();\n }else if(before.toUpperCase() === before){\n //make after upper\n newBefore = after.toUpperCase();\n }else {\n //make only first letter upper\n newBefore = after.replace(/(^[a-z])/,function (p) { return p.toUpperCase(); } );\n }\n\n return str.replace(before, newBefore);\n}", "function myReplace(str, before, after) {\n \n // check if before word is uppercase and match case of after\n if (before[0] === before[0].toUpperCase()){\n var capitalizedAfter = after.replace(after[0], after[0].toUpperCase());\n return str.replace(before, capitalizedAfter);\n }\n\n // check if before word is lowercase and match case of after\n else if (before[0] === before[0].toLowerCase()){\n var lowercaseAfter = after.replace(after[0], after[0].toLowerCase());\n return str.replace(before, lowercaseAfter);\n }\n}", "function wordHax(str) {\n \n \n \n for (i = 0; i < strArray.length; i++) {\n var strArray = str.split(\" \");\n }\n if (strArray[i].length > 3)\n {\n \n strArray[i] = strArray[i](/a|e|i|o|u/gi, \"\");\n \n }\n else\n {\n \n x.toUpperCase();\n \n }\n \n }", "function correct(string)\n{\n return string.replace(/0/g,\"O\").replace(/1/g,\"I\").replace(/5/g,\"S\");\n}", "function myReplace(str, before, after) {\n\n\t// add this to ensure multiple matches\n\tconst pattern = new RegExp(before, 'gi');\n\n\t// handle the Note case given:\n\tconst isLowerCase = function(txt) {\n\t\treturn txt == txt.toLowerCase() && txt != txt.toUpperCase();\n\t}\n\t\n\t// define a replacer callback\n\tconst replacer = function (match) {\n\t\tif (isLowerCase(match.substr(0,1))) {\n\t\t\treturn after;\n\t\t}\n\t\telse {\n\t\t\treturn after.substr(0,1).toUpperCase() + after.substr(1);\n\t\t}\n\t}\n\n \tstr = str.replace(pattern, replacer);\n\n \treturn str;\n\n}", "function teachManners(phrase) {\n return phrase.toLowerCase().replace(exclamations, '');\n\n}", "function changeTextInSearchOther(new_text, plus) {\n\t\tvar current_element = document.querySelector(\"#other_content span\")\n\t\tvar current_text = current_element.innerHTML;\n\t\tvar toChange = new_text.substring(new_text.indexOf(\" \") + 1);\n\t\tvar index = current_text.indexOf(\",\");\n\t\tif (toChange == \"room\") {\n\t\t\tvar toReplace = current_text.substring(0, index);\n\t\t\tcurrent_text = current_text.replace(toReplace, new_text);\n\t\t} else { // adult or children - change number of guests\n\t\t\tvar start_index = current_text.indexOf(\",\") + 2;\n\t\t\tvar end_index = current_text.indexOf(\"guests\");\n\t\t\tvar replaceWith = parseInt(current_text.substring(start_index, end_index));\n\t\t\tif (plus) {\n\t\t\t\treplaceWith += 1;\n\t\t\t} else {\n\t\t\t\treplaceWith -= 1;\n\t\t\t}\n\t\t\treplaceWith.toString();\n\t\t\tvar pre = current_text.substring(0,start_index);\n\t\t\tcurrent_text = pre + replaceWith + \" guests\"\n\t\t}\n\t\tchangeHtml(current_element,current_text);\n\t}", "function myReplace(str, before, after) {\n // Find index where before is on string\n var index = str.indexOf(before);\n // Check to see if the first letter is uppercase or not\n if (str[index] === str[index].toUpperCase()) {\n // Change the after word to be capitalized before we use it.\n after = after.charAt(0).toUpperCase() + after.slice(1)\n }\n // Now replace the original str with the edited one.\n str = str.replace(before, after)\n return str;\n}", "function translatePigLatin1(str) {\n let consonantRegex = /^[^aeiou]+/;\n let myConsonants = str.match(consonantRegex);\n return myConsonants !== null\n ? str\n .replace(consonantRegex, \"\")\n .concat(myConsonants)\n .concat(\"ay\")\n : str.concat(\"way\");\n}", "function convertToScreaming(phrase){\n return `${phrase.toUpperCase()}!!!!!!!!!!!!!!!!!!!!`\n}", "function pigIt(str) {\r\n let temp = str.split(\" \");\r\n return temp\r\n .map(word => {\r\n return word.match(/[A-z]/i)\r\n ? `${word.substr(1)}${word.substr(0, 1)}ay`\r\n : word;\r\n })\r\n .join(\" \");\r\n\r\n}", "function myReplace (str, before, after) {\n let regexp = new RegExp(before, 'i');\n let match = str.match(regexp);\n let firstLetter = match[0][0];\n if (firstLetter === firstLetter.toUpperCase()) {\n after = after[0].toUpperCase() + after.substring(1);\n }\n\n return str.replace(regexp, after);\n}", "function myReplace(str, before, after) {\n var b = before.split('');\n var a = after.split('');\n if (b[0] === b[0].toUpperCase()){\n a[0] = a[0].toUpperCase();\n }\n else if (b[0] === b[0].toLowerCase()){\n a[0] = a[0].toLowerCase();\n }\n after = a.join('');\n\n return str.replace(before, after);\n}", "static myReplace(str, toReplace, withStr) {\n\n let firstLetter = withStr.charAt(0).toLowerCase();\n if(toReplace.charAt(0) == toReplace.charAt(0).toUpperCase()) {\n firstLetter = withStr.charAt(0).toUpperCase();\n } \n withStr = firstLetter + withStr.slice(1);\n\n return str.replace(toReplace, withStr);\n\n }", "function titleizeWord(word,idx) { //idx is word's position\n var lower = word.toLowerCase();\n switch (lower) {\n\tcase 'a':\n\tcase 'the':\n\t if (idx) return lower;\n }\n var first = lower[0].toUpperCase();\n return first+lower.substr(1);\n}", "function updateGuessedWord(guessedLetter, cw) {\n let guessedWord = _model.getGuessedWord();\n let newString = guessedWord;\n let n = 0;\n for (let i = 0; i < cw.length; i++) {\n if (cw.charAt(i) === guessedLetter && guessedWord.charAt(i) === '_') {\n newString = replaceAt(guessedWord, i, guessedLetter);\n guessedWord = newString;\n n++;\n }\n }\n _model.setGuessedWord(newString);\n return n;\n }", "function myReplace(str, before, after) {\n\n if (before[0].match(/[A-Z]/)) {\n if (after[0].match(/[a-z]/)) {\n after = String.fromCharCode(after.charCodeAt(0) - 32) + after.substring(1)\n }\n }\n\n str = str.replace(before, after);\n console.log(str);\n return str;\n}", "function minusMayus2() {\n var string = document.getElementById(\"frase\").value.toUpperCase();\n var nuevoString;\n\n if (string.length <= 3) {\n nuevoString = string;\n } else if (string.length > 3) {\n nuevoString =\n string.substring(0, 3).toLowerCase() +\n string.substring(4, string.length - 1).toUpperCase();\n }\n\n document.getElementById(\"return\").innerHTML = nuevoString;\n}", "function changeText (paragraph) {\n newParagraph1 = paragraph.replace(/strawberry|Strawberry/g, \"banana\");\n newParagraph2 = newParagraph1.replace(/strawberries|Strawberries/g, \"bananas\");\n\n//4. Given the following paragraph, create a JavaScript function that changes all mentions of strawberry to banana and strawberries to bananas:\nStrawberries are a popular part of spring and summer diets throughout America. Mouths water from coast to coast each spring, when small white blossoms start to appear on strawberry bushes. They announce the impending arrival of the ruby red berries that so many people crave. Ripe strawberries taste sweet and have only a slight hint of tartness. They are also one of the healthiest fruits around. There are countless recipes for the luscious red berry, but many people prefer to eat them fresh and unaccompanied.\n return newParagraph2;\n}", "function whisper(string){ return string.toLowerCase() }", "function Censurador(){\n\tvar str = document.getElementById(\"entrada\").value;\n\tif(str.includes(\"Ubisoft\")){\n\t\tdocument.getElementById(\"entrada\").value = str.replace(\"Ubisoft\", \"Bugisoft\");\n\t}\n\n\tif(str.includes(\"gg izi\")){\n\t\tdocument.getElementById(\"entrada\").value = str.replace(\"gg izi\", \"Nice Game My Dear Friend\");\n\t}\n\tvar censurada = \"\";\n\tfor(i = 0; i < forbidden.length; i++){\n\t\tif(str.includes(forbidden[i])){\n\t\t\tvar censure = forbidden[i];\n\t\t\tvar censure_time = censure.length;\n\t\t\tvar tam = cens.length;\n\t\t\t\n\t\t\tfor(j = 0; j < censure_time; j++){\n\t\t\t\tcensurada = censurada + cens[j%tam];\n\t\t\t}\n\t\t\t// alert(censurada);\n\t\t\tdocument.getElementById(\"entrada\").value = str.replace(censure, censurada); \n\t\t}\n\n\t}\n}", "function translatePigLatin(str) {\n let consonantRegex = /^[^aeiou]+/;\n \n let myConsonants = str.match(consonantRegex);\n \n return myConsonants !== null ? str.replace(consonantRegex, \"\").concat(myConsonants).concat('ay') : str.concat('way')\n \n }", "function replaceEO(str) {\n var phrase = str.split(' ');\n // console.log(phrase);\n for (var i = 0; i < phrase.length; i++) {\n\n let word = phrase[i];\n\n if(i%2===0)\n {\n word = word.toUpperCase();\n }\n\n console.log(word);\n }\n\n}", "function whisper(str){\n return \"...\" + str.toLowerCase() + \"...\"\n}", "function toonify(accent, sentence) {\n if(accent === 'daffy') {\n return sentence.replace(/s/g, 'th');\n } else if(accent === 'elmer') {\n return sentence.replace(/r/g, 'w');\n } else if(accent === 'porky') {\n return sentence.replace(/th/g, 'th-th-th-th');\n } else {\n return sentence;\n }\n}", "function solve1(s){\n let upper = s.split('').filter(x => x === x.toUpperCase()).length\n let lower = s.length - upper\n return (upper > lower) ? s.toUpperCase() : s.toLowerCase()\n}", "function translatePigLatin2(str) {\n return str\n .replace(/^[aeiou]\\w*/, \"$&way\")\n .replace(/(^[^aeiou]+)(\\w*)/, \"$2$1ay\");\n}", "modify(str, mod){\n\t\tvar vowels = ['a', 'e', 'i', 'o', 'u', 'y']\n\t\tswitch(mod){\n\t\t\tcase \"cap\":\n\t\t\t//This modification simply capitalizes the string.\n\t\t\treturn str.charAt(0).toUpperCase() + str.substring(1);\n\t\t\tbreak;\n\t\t\tcase \"capAll\":\n\t\t\treturn str.toUpperCase();\n\t\t\tcase \"a\":\n\t\t\t//this modification adds the correct a/an to the string, assumes noun input.\n\t\t\tif (vowels.includes(str.charAt(0).toLowerCase()) && !(str.charAt(0).toLowerCase() ==\"u\" && str.charAt(1).toLowerCase() == \"n\") || (vowels.includes(str.charAt(1).toLowerCase()) && str.charAt(1) != \"u\" && str.charAt(0) == 'h')){\n\t\t\t\treturn \"an \" + str;\n\t\t\t}else{\n\t\t\t\treturn \"a \" + str;\n\t\t\t}\n\t\t\tbreak;\n\t\t\tcase \"ed\":\n\t\t\t//WIP: Convert verb to past tense.\n\t\t\t//NOTE: This assumes input of simple present singular form, and only does simple past tense.\n\t\t\t//This is also only the affirmative.\n\t\t\treturn str + \"ed\";\n\t\t\tbreak;\n\t\t\tcase \"s\":\n\t\t\tvar es_single_cases = ['s', 'x', 'z'];\n\t\t\tvar es_double_cases = ['ch', 'sh', 'ss'];\n\t\t\tvar irregulars = ['woman','man','child','tooth','foot','person','leaf','mouse','goose','half','knife','wife','life','elf','loaf','potato','tomato','cactus','focus','fungus','nucleus','syllabus','analysis','diagnosis','oasis','thesis','crisis','phenomenon','criterion','datum'];\n\t\t\tvar irregulars_pl = ['women','men','children','teeth','feet','people','leaves','mice','geese','halves','knives','wives','lives','elves','loaves','potatoes','tomatoes','cacti','foci','fungi','nuclei','syllabi','analyses','diagnoses','oases','theses','crises','phenomena','criteria','data'];\n\t\t\tvar nonconverts = ['sheep','fish','deer','species','aircraft'];\n\t\t\tif(irregulars.includes(str)){\n\t\t\t\treturn irregulars_pl[irregulars.indexOf(str)];\n\t\t\t}else if(nonconverts.includes(str)){\n\t\t\t\treturn str;\n\t\t\t}else if(str.charAt(-1) == \"y\" && !vowels.includes(str.charAt(-1))){\n\t\t\t\treturn str.substring(0, str.length - 1) + \"ies\";\n\t\t\t}else if(es_single_cases.includes(str.charAt(-1)) || es_double_cases.includes(str.substring(str.length - 2))){\n\t\t\t\treturn str + \"es\";\n\t\t\t}else{\n\t\t\t\treturn str + \"s\";\n\t\t\t}\n\t\t\tbreak;\n\t\t\tcase \"ff\":\n\t\t\t//Fifty-fifty chance of the modified string being included at all\n\t\t\tif(Math.random() > 0.5){\n\t\t\t\treturn str;\n\t\t\t}else{\n\t\t\t\treturn \"\";\n\t\t\t}\n\t\t\tbreak;\n\t\t\tcase \"uncap\":\n\t\t\t//Just the opposite of the capitalization mod, make the first letter letter.\n\t\t\treturn str.charAt(0).toLowerCase() + str.substring(1);\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\tthrow \"ERROR: INVALID MODIFIER \" + mod;\n\t\t}\n\t}", "function correct(word) {\n \n}", "function changeTextCase(str) {\n String.prototype.toMixCase = function () {\n var result = '';\n for (var i = 0; i < this.length; i++) {\n result += (Math.floor(Math.random() * 2) === 1) ?\n this[i].toUpperCase() : this[i].toLowerCase();\n }\n\n return result\n }\n\n return str\n .replace(/<upcase>(.*?)<\\/upcase>/g, function (_, match) { return match.toUpperCase(); })\n .replace(/<lowcase>(.*?)<\\/lowcase>/g, function (_, match) { return match.toLowerCase(); })\n .replace(/<mixcase>(.*?)<\\/mixcase>/g, function (_, match) { return match.toMixCase(); });\n}", "function spinalize(match, p1, p2, p3) {\n if (p1) { return dash + match.toLowerCase(); }\n if (p2) { return dash; }\n if (p3) { return dash; }\n }", "function change(str){\n str = str.toLowerCase(); //changes all the charaters in the string to lower case\n var alpha = \"abcdefghijklmnopqrstuvwxyz\"; // create a new variable of all the letters in the alphabet\n var finalString = \"\"; // creates a new string\n \n \n for(var i = 0; i < alpha.length; i++) { //loop through all the letters of the alphabet\n if(str.indexOf(alpha[i]) !== -1) { //the indexOf method checks the location of a alpha letter in the string. If it is not in there it will return -1, which is a falsy value. \n\t\tfinalString += 1; //adds one if the value is located in the alphabet \n } else {\n\t\tfinalString += 0; //otherwise it adds 0\n }\n }\n return finalString; //returns the final value\n}", "function n(t){if(\"string\"!==typeof t)throw new TypeError(\"expected a string.\");return t=t.replace(/([A-Z])/g,\" $1\"),1===t.length?t.toUpperCase():(t=t.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),t=t.charAt(0).toUpperCase()+t.slice(1),t.replace(/[\\W_]+(\\w|$)/g,(function(t,e){return e.toUpperCase()})))}", "function sayHiToGrandma(string) {\n if (string.toLowerCase() === string) {\n return \"I can\\'t hear you!\"\n //this translates the string to lowercase and then checks if it is the same as the original string, thereby checking if the original string was all lowercase\n} else if (string.toUpperCase() === string) {\n return \"YES INDEED!\"\n //checks if original string was all caps\n} else {\n return \"I love you, too.\"\n //checks if original string was mixed case\n}\n}", "function translatePigLatin(str) {\n // My code\n // We write a regex to search for the occurence of a consonant word or cluster at the start of str.\n let consonantRgx = /^[^aeiou]+/;\n // We check if a consonant word or cluster is found. The .test() method returns a boolean true or false.\n if (consonantRgx.test(str)) {\n // We use the match() method to assign the consonant word or cluster found at the start of str to a variable.\n let consonant = str.match(consonantRgx);\n // We use the replace() method to replace the matched consonant word or cluster with an empty string.\n // Example: 'leaped' becomes 'eaped', and 'them' becomes 'em'.\n let newStr = str.replace(consonantRgx, '');\n // We return newStr concatenated with the removed consonant word or cluster and 'ay'.\n // Example: 'eaped' now becomes 'eaped' += 'l' + 'ay'.\n return newStr += consonant + 'ay';\n }\n // If str doesn't start with a consonant word or cluster , we just concatenate str with 'way'.\n return str + 'way';\n // My code\n}", "function toTitleCaseStrong(str) {\n if (!str) {\n return str;\n }\n var allCaps = (str === str.toUpperCase());\n \n \n str = str.replace(/\\b([^\\W_\\d][^\\s-\\/]*) */g, function(txt) {\n return ((txt === txt.toUpperCase()) && !allCaps) ? txt : txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();\n });\n // Cap O'Reilley's, L'Amour, D'Artagnan as long as 5+ letters\n str = str.replace(/[oOlLdD]'[A-Za-z']{3,}/g, function(txt) {\n return ((txt === txt.toUpperCase()) && !allCaps) ? txt : txt.charAt(0).toUpperCase() + txt.charAt(1) + txt.charAt(2).toUpperCase() + txt.substr(3).toLowerCase();\n });\n // Cap McFarley's, as long as 5+ letters long\n str = str.replace(/[mM][cC][A-Za-z']{3,}/g, function(txt) {\n return ((txt === txt.toUpperCase()) && !allCaps) ? txt : txt.charAt(0).toUpperCase() + txt.charAt(1).toLowerCase() + txt.charAt(2).toUpperCase() + txt.substr(3).toLowerCase();\n });\n // anything sith an \"&\" sign, cap the word after &\n str = str.replace(/&\\w+/g, function(txt) {\n return ((txt === txt.toUpperCase()) && !allCaps) ? txt : txt.charAt(0) + txt.charAt(1).toUpperCase() + txt.substr(2);\n });\n \n str = str.replace(/[^ ]+/g, function(txt) {\n var txtLC = txt.toLowerCase();\n return (ignoreWords.indexOf(txtLC) > -1) ? txtLC : txt;\n });\n str = str.replace(/[^ ]+/g, function(txt) {\n var txtLC = txt.toUpperCase();\n return (capWords.indexOf(txtLC) > -1) ? txtLC : txt;\n });\n str = str.charAt(0).toUpperCase() + str.substr(1);\n return str;\n }", "function compare( word, guess ) { // DO NOT MODIFY\n\nlet count = 0;\nlet word1 = word.toUpperCase();\nlet word2 = guess.toUpperCase();\n for(let i = 0; i < word1.length; i++){\n let word2Index = word2.indexOf(word1[i]);\n if(word2Index >= 0){\n word2 = word2.replace(word2.charAt(word2ndex),\"\");\n count++;\n }\n }\n return count; \n}", "cap(lower) {\n return lower.replace(/^\\w/, c => c.toUpperCase());\n }", "function mapWords(word) {\n var capitalised = capitalise(word);\n var val = words.get(capitalised);\n if (val) {\n words.set(capitalised, val + 1);\n }\n else {\n words.set(capitalised, 1);\n }\n}", "function kungfoo(input) {\n var array = input.split(' ').map(function(item, i){\n if(i%2 !== 0 && i !== 0){\n return item.toUpperCase()\n } else {\n return item\n }\n })\n return array.join(' ');\n}", "function toWeirdCase(str) {\n const wordToWeirdCase = (word) => word.split('').map((element, inx) => (\n inx % 2 ? element.toLowerCase() : element.toUpperCase()\n )).join('') \n return str.split(' ').map(wordToWeirdCase).join(' ');\n}", "function whisper(string) {\n return '...' + string.toLowerCase() + '...';\n}", "function grammarize (name) {\n const wrongWords = ['arent', 'githubbin', 'its']\n const rightWords = [\"aren't\", 'GitHubbin', \"it's\"]\n let correctedName = name\n\n // Correct listed terms\n wrongWords.forEach((word, i) => {\n if (name.match(word)) {\n correctedName = name.replace(word, rightWords[i])\n }\n })\n\n // First Char to upper case\n correctedName = correctedName.charAt(0).toUpperCase() + correctedName.substr(1)\n\n return correctedName\n}", "function pigLatin(str) {\n let vowels = \"aeiouAEIOU\";\n str = str.replace(\".\", \"\");\n const strArr = str.split(\" \");\n //\n const newStrArr = [];\n strArr.map((word) => {\n if (vowels.includes(word[0])) {\n word += \"way\";\n newStrArr.push(word);\n } else {\n let firstLetter = word[0].toLowerCase();\n let newWord = word.slice(1);\n newStrArr.push(newWord + firstLetter + \"ay\");\n }\n });\n //\n let capital = newStrArr[0][0].toUpperCase();\n const output = newStrArr[0].replace(newStrArr[0][0], capital);\n newStrArr.shift();\n newStrArr.unshift(output);\n\n console.log(newStrArr.join(\" \") + \".\");\n}", "function tea42(input) {\n var myString = input.toString();\n return myString.replace(/2/g,'t');\n}", "function translatePigLatin(str) {\n //check if srting start with consonant\n //convert str to array\n let arr = [...str.toLowerCase()];\n let vowels = ['a', 'e', 'i', 'o', 'u'];\n let firstConsonants = [];\n //if str strat with vowle add 'way' to the end\n if(vowels.indexOf(arr[0]) !== -1){\n return str + \"way\";\n }\n\n for (let char in arr) {\n if (!vowels.includes(arr[char])) {\n firstConsonants.push(arr[char]);\n } else {\n return arr.splice(char).join(\"\") + firstConsonants.join(\"\") + \"ay\";\n \n }\n } \n //if str start with consonant move the character to the end and add \"ay\" to the end of it \n\n}", "function spinalTap(str) {\n let lowercase = str.toLowerCase();\n let spinalCase = lowercase.replace(/ /g, \"-\"); //when using replace looking for the variable goes between / /g and g means global, second parameter is what it will be replaced with\n return spinalCase;\n}", "function switcheroo(x) {\n return x.replace(/a/g, \"t\").replace(/b/g, \"a\").replace(/t/g, \"b\");\n}", "function myReplace(str, before, after) {\n if (before.charCodeAt(0) >= 65 && before.charCodeAt(0) <= 90) {\n after = after.charAt(0).toUpperCase() + after.substring(1);\n }\n var strArray = str.split(\" \");\n for (var i = 0; i < strArray.length; i++) {\n if (strArray[i] === before) {\n strArray[i] = after;\n }\n }\n str = strArray.join(' ');\n return str;\n}", "function changer(str) {\n return str.split(\"\").map(a=>{\n let unicode = a.charCodeAt(0);\n if ((unicode >= 65 && unicode < 90) || (unicode >= 97 && unicode < 122)) {\n return String.fromCharCode(unicode+1);\n } else if (unicode === 122 || unicode === 90) {\n return \"A\";\n }\n return a;\n }).map(b=>{\n if(/[aeiouAEIOU]/.test(b)) {\n return b.toUpperCase();\n }\n return b.toLowerCase();\n }).join(\"\");\n}", "function capitalizer(str, position) {\r\n}", "function pluralize()\r\n{\r\n var quantity = Number(document.project4.num1.value);\r\n var noun = document.project4.word1.value;\r\n\r\n if (noun == 'mouse') {\r\n if (quantity > 1) {\r\n return quantity + \" mice \";\r\n }\r\n else {\r\n return quantity + \"mouse\";\r\n }\r\n }\r\n else if (noun == 'deer')\r\n {\r\n return quantity + \"deer\";\r\n }\r\n else if (noun == 'cactus')\r\n {\r\n if (quantity > 1)\r\n return quantity + \"cacti\"\r\n }\r\n\r\n if (quantity > 1)\r\n {\r\n //tacK on an 's' tot the noun aka CONCATENATE\r\n return quantity + \" \" + noun + \"s\";\r\n }\r\n else\r\n {\r\n return quantity + \" \" + noun;\r\n }\r\n}" ]
[ "0.6928495", "0.68726045", "0.68726045", "0.6618447", "0.65311235", "0.65127814", "0.64730704", "0.6435399", "0.6434114", "0.63740873", "0.6358453", "0.63354117", "0.62533647", "0.6246775", "0.6218038", "0.62090117", "0.61730987", "0.61656284", "0.6152095", "0.6150311", "0.6144314", "0.6143941", "0.6141157", "0.6140211", "0.6129491", "0.61103284", "0.60935366", "0.60918313", "0.6082396", "0.60694295", "0.60676366", "0.6065297", "0.6057874", "0.60570174", "0.60432637", "0.6035297", "0.60348403", "0.6030676", "0.60258955", "0.60180575", "0.5995547", "0.5994082", "0.5985229", "0.5982908", "0.596833", "0.59653664", "0.5963391", "0.5954759", "0.59492123", "0.5941458", "0.5938156", "0.5927867", "0.5927688", "0.5927606", "0.59247786", "0.5914937", "0.59136057", "0.5912813", "0.5911606", "0.59056455", "0.59034616", "0.5903026", "0.58881265", "0.588054", "0.5880335", "0.58795965", "0.58783734", "0.5869478", "0.5863122", "0.5861901", "0.5861503", "0.5849378", "0.5846901", "0.58465093", "0.58342195", "0.5833393", "0.5832521", "0.58282036", "0.58280885", "0.58183056", "0.5816202", "0.58108723", "0.5800531", "0.5792347", "0.5789296", "0.57839066", "0.57821786", "0.57820565", "0.57803935", "0.5778341", "0.5777229", "0.57770216", "0.5776474", "0.5771553", "0.57605475", "0.575997", "0.5758096", "0.5750878", "0.5750803", "0.5742869" ]
0.6789782
3
make the window canvas and set grid
function setup() { createCanvas(602, 602); // showing grid cellSize = (width - 2) / cols; grid = make2DArray(cols, rows); // color button. p5.js button = createButton("green"); button = createButton("blue"); button = createButton("red"); button = createButton("black"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawGrid() {\n\t\tcontext.fillStyle = GRID_COLOR;\n\t\tfor (var i = GRID_CELL_WIDTH; i < canvas.width; i = i + GRID_CELL_WIDTH) {\n\t\t\tfor (var j = GRID_CELL_WIDTH; j < canvas.height; j = j + GRID_CELL_WIDTH) {\n\t\t\t\tcontext.fillRect(i, j, 1, 1);\n\t\t\t}\n\t\t}\n\t}", "function makeGrid() {\nfor (let x = 0; x < rowsNum.value ; x ++) {\n const insertRow = pixelCanvas.insertRow(0) ;\n for (let y = 0 ; y < cellsNum.value ; y ++) {\n insertRow.insertCell(0) ;\n }\n}\n\n}", "function makeGrid() {\n canvas.find('tablebody').remove();\n\n // \"submit\" the size form to update the grid size\n let gridRows = gridHeight.val();\n let gridCol = gridWeight.val();\n\n // set tablebody to the table\n canvas.append('<tablebody></tablebody>');\n\n let canvasBody = canvas.find('tablebody');\n\n // draw grid row\n for (let i = 0; i < gridRows; i++) {\n canvasBody.append('<tr></tr>');\n }\n\n // draw grid col\nfor (let i = 0; i < gridCol; i++) {\n canvas.find('tr').append('<td class=\"transparent\"></td>');\n }\n\n }", "initBoard() {\n this.canvas = document.createElement('canvas');\n this.ctx = this.canvas.getContext('2d');\n this.width = this.canvas.width = this.tileWidth * this.columns;\n this.height = this.canvas.height = this.tileHeight * this.rows;\n this.canvas.style.border = \"none\";\n this.initStage();\n }", "function drawGrid() {\n noFill();\n stroke(230, 50);\n strokeWeight(2);\n\n for (let j = 0; j < config.numRows; j++) {\n for (let i = 0; i < config.numCols; i++) {\n rect(i * colWidth, j * rowHeight, colWidth, rowHeight)\n }\n }\n }", "function setup() {\n createCanvas(windowWidth, windowHeight);\n rectMode(CENTER);\n angleMode(DEGREES);\n \n for (let i = 0; i < windowWidth; i += W){\n gridLoc.push([]);\n for (let j = 0; j < windowHeight; j += W){\n // gridLoc[i].push(j);\n grid.push(new Cells(i,j,W));\n } \n }\n}", "function drawGrid(){\n\tvar obj = gridSize();\n\tvar canvas = document.getElementById('grid');\n\t\n\t//Adjust the workspace so that both canvases can fit into it\n\tvar gridCont = document.getElementById('grid_cont');\n\tgridCont.style.width = `${obj.colWidth * obj.cols+0.5}px`;\n\tgridCont.style.height = `${obj.rowHeight * obj.rows+0.5}px`;\n\t\n\tvar context = canvas.getContext('2d');\n\tcontext.scale(dpr,dpr);\n\t\n\t//Set the canvas size\n\tcanvas.width = (obj.colWidth * obj.cols+0.5)*dpr;\n\tcanvas.height = (obj.rowHeight*obj.rows+0.5)*dpr;\n\t\n\tcanvas.style.width = `${obj.colWidth * obj.cols+0.5}px`;\n\tcanvas.style.height = `${obj.rowHeight*obj.rows+0.5}px`;\n\tcontext.scale(dpr,dpr);\n\n\tcontext.lineWidth = 0.5;\n\t\n\tcontext.strokeStyle = \"#cccccc\";\n\n\t//Draw the vertical grid lines5\n\tfor (var i = 0; i<=obj.cols; i+=2) {\n\t\tcontext.strokeRect(obj.colWidth*i+0.5,0.5,obj.colWidth,canvas.height);\n\n\t}\n\t//draw horizontal lines\n\tfor (var j = 0; j<=obj.rows; j+=2){\n\t\tcontext.strokeRect(0.5,obj.rowHeight*j+0.5,canvas.width,obj.rowHeight);\n\n\t}\n\t\n\n}", "function setup() {\n\n\n createCanvas(windowWidth - 20, windowHeight - 20);\n rectMode(CENTER);\n cols = Math.floor(width / grid);\n rows = Math.floor(height / grid);\n mid_col = Math.round(cols / 2);\n\n reset();\n}", "function drawGrid() {\n\t\tcontext.strokeStyle = '#000000';\n\t\tfor ( var x = 0; x < theCanvas.width; x = x + gridSize) {\n\t\t\tfor ( var y = 0; y < theCanvas.height; y = y + gridSize) {\n\t\t\t\tcontext.strokeRect(x, y, gridSize, gridSize);\n\t\t\t}\n\t\t}\n\t}", "function init() {\r\n /*************************************************\r\nwindow resizing event, recalculates the grid pattern\r\non a window resizing to keep the perfect square shape\r\nregardless of window shape/size\r\n*************************************************/\r\n\r\n addEvent(window, \"resize\", function (event) {\r\n screenRatio = window.innerWidth / window.innerHeight\r\n let rect = cnv.getBoundingClientRect()\r\n offsetX = rect.left\r\n offsetY = rect.top\r\n canvasWidth = rect.width * devicePixelRatio\r\n canvasHeight = rect.height * devicePixelRatio\r\n cnv.width = canvasWidth\r\n cnv.height = canvasHeight\r\n log(\"ScreenRatio: \" + screenRatio.toString())\r\n recalc()\r\n })\r\n\r\n cnv = document.getElementById(\"myCanvas\")\r\n ctx = cnv.getContext(\"2d\")\r\n\r\n /*************************************************\r\n mouse events, setting up function handlers for each mouse\r\n event\r\n *************************************************/\r\n\r\n log(\"setting up Mouse events\")\r\n $(\"#myCanvas\").mousedown(function (e) {\r\n handleMouseDown(e)\r\n })\r\n $(\"#myCanvas\").mousemove(function (e) {\r\n handleMouseMove(e)\r\n })\r\n $(\"#myCanvas\").mouseup(function (e) {\r\n handleMouseUp(e)\r\n })\r\n $(\"#myCanvas\").mouseout(function (e) {\r\n handleMouseOut(e)\r\n })\r\n //mousewheel\r\n cnv.addEventListener(\"onwheel\" in document ? \"wheel\" : \"mousewheel\", (e) => handleMouseWheel(e))\r\n\r\n /*************************************************\r\n calculating screen ratio and display size to assist\r\n in calculating canvas size for best resolution\r\n *************************************************/\r\n\r\n screenRatio = window.innerWidth / window.innerHeight\r\n screenWidth = screen.width\r\n screenHeight = screen.height\r\n log(\"screen: w(\" + screenWidth.toString() + \") h(\" + screenHeight.toString() + \")\")\r\n log(\"window (default): w(\" + window.innerWidth.toString() + \") h(\" + window.innerHeight.toString() + \")\")\r\n log(\"screen ratio is: \" + screenRatio.toString())\r\n log(\"preparing to draw initial grid\")\r\n\r\n cnv.width = canvasWidth\r\n cnv.height = canvasHeight\r\n\r\n /*************************************************\r\n calculating sizes of the grids to best fit default\r\n grid onto canvase at startup\r\n *************************************************/\r\n\r\n gridsize = $(\"#pixelSelect\").eq(0).val()\r\n log(`Default selected grid size: ` + gridsize)\r\n let tempzoom = $(\"#myRange\").eq(0).val()\r\n zoomlevel = parseInt(tempzoom)\r\n log(`Default selected zoom level: ` + zoomlevel.toString())\r\n numG = $(\"#numGrid\").eq(0).val()\r\n log(`Default number of grid squares: ` + numG)\r\n let rect = cnv.getBoundingClientRect()\r\n\r\n /*************************************************\r\n using devicePixelRatio, recalculate canvase dimensions\r\n to make perfect squares regardless of display\r\n resolution\r\n *************************************************/\r\n\r\n canvasWidth = rect.width * devicePixelRatio\r\n canvasHeight = rect.height * devicePixelRatio\r\n offsetX = rect.left\r\n offsetY = rect.top\r\n cnv.width = canvasWidth\r\n cnv.height = canvasHeight\r\n recalc()\r\n}", "function drawGrid() {\n var canvas = document.getElementById('mainCanvas');\n\n // Draw a black background\n var ctx = canvas.getContext('2d');\n ctx.fillStyle = window.backgroundColor;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n\n // Get the padding for the grid\n var padding = getGridPadding();\n\n // Set the stroke color to grey\n ctx.strokeStyle = window.gridColor;\n\n // Set the stroke size to 1/10th of the cell size\n ctx.lineWidth = window.cellSize / window.gridLineWidthRatio;\n\n // Draw the vertical lines of the grid\n var offset;\n for (var i = 0; i <= window.numCellsX; i++) {\n offset = i * window.cellSize;\n ctx.beginPath();\n ctx.moveTo(padding.horizontal + offset, padding.vertical);\n ctx.lineTo(padding.horizontal + offset, (canvas.height - padding.vertical));\n ctx.stroke();\n }\n\n // Draw the horizontal lines of the grid\n for (i = 0; i <= window.numCellsY; i++) {\n offset = i * window.cellSize;\n ctx.beginPath();\n ctx.moveTo(padding.horizontal, padding.vertical + offset);\n ctx.lineTo((canvas.width - padding.horizontal), padding.vertical + offset);\n ctx.stroke();\n }\n\n // Draw the cells on to the grid\n drawCells();\n}", "function makeCanvas(x, y) {\n canvas.style.setProperty(\"--grid-cols\", x);\n canvas.style.setProperty(\"--grid-rows\", y);\n for (let i = 0; i < x * y; i++) {\n let cell = document.createElement(\"div\");\n canvas.appendChild(cell).className = \"cell\";\n }\n}", "function drawGrid() {\n jaws.context.save();\n jaws.context.strokeStyle = \"rgba(5,119,17,0.7)\";\n jaws.context.beginPath();\n\n for (var x = 0; x < m_viewport.max_x; x += cell_size) {\n jaws.context.moveTo(x - m_viewport.x, 0);\n jaws.context.lineTo(x - m_viewport.x, jaws.height);\n }\n for (var y = 0; y < m_viewport.max_y; y += cell_size) {\n jaws.context.moveTo(0, y - m_viewport.y);\n jaws.context.lineTo(jaws.width, y - m_viewport.y);\n }\n\n jaws.context.closePath()\n jaws.context.stroke()\n jaws.context.restore()\n }", "function onWindowResize() {\n // Resize the canvas\n var canvas = document.getElementById('mainCanvas');\n canvas.width = $(window).width();\n canvas.height = $(window).height();\n\n // Resize the cells\n window.cellSize = Math.max(3, Math.min($(window).width() / window.numCellsX, $(window).height() / window.numCellsY));\n\n drawGrid();\n}", "function makeGrid() {\n\n\n}", "function setup() {\n createCanvas(400, 400);\n cols = floor(width / w);\n rows = floor(height / w);\n \n // let's create the cell object and put it in the grid\n for (let j = 0; j < rows; j++) {\n for (let i = 0; i < cols; i++) {\n var cell = new Cell(i, j);\n grid.push(cell);\n }\n }\n \n background(0)\n }", "function drawGrid(){\n\t\tvar h = gameArea.canvas.height();\n\t\tvar w = gameArea.canvas.width();\n \n\n var paths = {\n strokeStyle : settings.gridColor,\n strokeWidth: .5,\n layer :true,\n name: 'grid'\n };\n \n var pathCount = 0;\n\t\tfor (var y = 0; y <= h; y += h/settings.rows) {\n pathCount++;\n paths[\"p\"+pathCount] = {\n type: 'line',\n x1: 0, y1: y,\n x2: w, y2: y\n };\n\t\t}\n\n\t\tfor (var x = 0; x <= w; x += w/settings.columns) {\n pathCount++;\n paths[\"p\"+pathCount] = {\n type: 'line',\n x1: x, y1: 0,\n x2: x, y2: h\n };\n\t\t}\n gameArea.canvas.drawPath(paths);\n\t}", "function createGrid(width, height) {\n\n}", "function setupGrid() {\n\n // Initialize the grid with all false values, i.e. the inactive state\n for (let i = 0; i < numRectanglesWide; i++) {\n grid.push([]);\n for (let j = 0; j < numRectanglesHigh; j++) {\n grid[i].push(false);\n }\n }\n\n ctx.strokeStyle = gridColor;\n ctx.lineWidth = gridThickness;\n\n const drawLine = (x1, y1, x2, y2) => {\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.stroke();\n };\n\n // Since we draw the lines on the left and top sides of each rectangle,\n // we need to use <= instead of < so that the last border is drawn\n\n // Draws vertical grid lines\n for (let i = 0; i <= numRectanglesWide; i++) {\n const x = i * rectangleWidth + i * gridThickness;\n drawLine(x, 0, x, canvas.height);\n }\n\n // Draws horizontal grid lines\n for (let i = 0; i <= numRectanglesHigh; i++) {\n const y = i * rectangleHeight + i * gridThickness;\n drawLine(0, y, canvas.width, y);\n }\n }", "function drawCanvas() {\n\t\tdrawer.drawWallGrid(context, solver.gridWall, solver.xLength, solver.yLength, selectedSpacesGrid); \n\t\tdrawInsideSpaces(context, drawer, colourSet, solver, purificator, selectedSpacesGrid);\n\t\tdrawer.drawSudokuFrames(context, solver, mouseCoorsItem); \n\t\tsolver.callStateForItem(spanState);\n\t}", "function makeGrid(){\n\tfor(let row = 0; row < inputHeight.value; row++){\n\t\tconst tableRow = pixelCanvas.insertRow(row);\n\t\tfor(let cell = 0; cell < inputWidth.value; cell++){\n\t\t\tconst cellBlock = tableRow.insertCell(cell);\n\t\t}\n\t}\n}", "function renderCanvas(e) {\n\tif (!isActive) return;\n\n\t//clear canvas\n\tctx.clearRect(0, 0, canvas.width, canvas.height);\n\n\t//draw the background grid\n\tfunction drawGrid() {\n\t\tvar gridS = gridSize,\n\t\t\tcanvasTop = Vector2.ScreenToWorld(Vector2.Zero),\n\t\t\tcanvasBottom = Vector2.ScreenToWorld(new Vector2(canvas.width, canvas.height)),\n\t\t\tcanvasMiddle = canvasTop.lerp(canvasBottom, 0.5);\n\n\n\t\tctx.beginPath();\n\t\tctx.strokeStyle = colors.grid;\n\t\tctx.lineWidth = gridThickness;\n\t\t//draw horizontal lines\n\t\tfor (var middleY = canvasMiddle.y, n = 0; middleY + gridS * n <= canvasBottom.y; n++) {\n\n\t\t\tvar y1 = middleY + gridS * n,\n\t\t\t\ty2 = middleY - gridS * n,\n\t\t\t\tscreenY1 = Vector2.WorldToScreen(new Vector2(0, y1)).y + offset.y % gridS,\n\t\t\t\tscreenY2 = Vector2.WorldToScreen(new Vector2(0, y2)).y + offset.y % gridS;\n\n\t\t\tctx.moveTo(0, screenY1);\n\t\t\tctx.lineTo(canvas.width, screenY1);\n\t\t\tctx.stroke();\n\n\t\t\tctx.moveTo(0, screenY2);\n\t\t\tctx.lineTo(canvas.width, screenY2);\n\t\t\tctx.stroke();\n\t\t}\n\t\tctx.beginPath();\n\t\tfor (var middleX = canvasMiddle.x, n = 0; middleX + gridS * n <= canvasBottom.x; n++) {\n\n\t\t\tvar x1 = middleX + gridS * n,\n\t\t\t\tx2 = middleX - gridS * n,\n\t\t\t\tscreenX1 = Vector2.WorldToScreen(new Vector2(x1, 0)).x + offset.x % gridS,\n\t\t\t\tscreenX2 = Vector2.WorldToScreen(new Vector2(x2, 0)).x + offset.x % gridS\n\n\t\t\tctx.moveTo(screenX1, 0);\n\t\t\tctx.lineTo(screenX1, canvas.width);\n\t\t\tctx.stroke();\n\n\t\t\tctx.moveTo(screenX2, 0);\n\t\t\tctx.lineTo(screenX2, canvas.width);\n\t\t\tctx.stroke();\n\t\t}\n\t}\n\t//draw the connections\n\tfunction drawConnection(port1, port2) {\n\t\t//render line\t\n\t\tctx.strokeStyle = colors.port_set[port1.type];\n\n\t\tvar startpoint = port1.screenPos;\n\t\tvar endpoint = port2.screenPos;\n\n\t\tctx.moveTo(startpoint.x, startpoint.y);\n\t\tctx.lineTo(endpoint.x, endpoint.y);\n\t\tctx.stroke();\n\t}\n\t//draw the modules\n\tfunction drawModule(module) {\n\t\t//get the module display corners\n\t\tvar p0 = Vector2.WorldToScreen(module.pos),\n\t\t\tp1 = p0.add(module.size);\n\n\t\t//draw module box\n\t\tctx.beginPath();\n\t\tctx.fillStyle = colors.module_bg;\n\t\tctx.moveTo(p0.x, p0.y);\n\t\tctx.lineTo(p0.x, p1.y);\n\t\tctx.lineTo(p1.x, p1.y);\n\t\tctx.lineTo(p1.x, p0.y);\n\t\tctx.fill();\n\n\t\t//draw module label\n\t\tctx.beginPath();\n\t\tctx.fillStyle = '#000000';\n\t\tctx.font = moduleFont();\n\t\tctx.textAlign = 'center';\n\t\tctx.textBaseline = 'middle';\n\t\tctx.fillText(module.codec.getName(), lerp(p0.x, p1.x, 0.5), lerp(p0.y, p1.y, 0.5));\n\n\t\t//draw input ports\n\t\tfor (var j = 0; j < module.inputs.length; j++) {\n\t\t\tvar port = module.inputs[j],\n\t\t\t\tpos = port.screenPos,\n\t\t\t\tradius = portRadius * zoomMultiplier;\n\n\t\t\t//draw the port circle\n\t\t\tctx.beginPath();\n\t\t\tctx.fillStyle = colors.port_set[port.type];\n\t\t\tctx.arc(pos.x, pos.y, radius, 0, 2 * Math.PI);\n\t\t\tctx.fill();\n\t\t}\n\n\t\t//draw output ports\n\t\tfor (var j = 0; j < module.outputs.length; j++) {\n\t\t\tvar port = module.outputs[j],\n\t\t\t\tpos = port.screenPos,\n\t\t\t\tradius = portRadius * zoomMultiplier;\n\n\t\t\t//draw the port circle\n\t\t\tctx.beginPath();\n\t\t\tctx.fillStyle = colors.port_set[port.type];\n\t\t\tctx.arc(pos.x, pos.y, radius, 0, 2 * Math.PI);\n\t\t\tctx.fill();\n\t\t}\n\t}\n\t//draw the zoom multiplier if zoomed in/out\n\tfunction drawZoom() {\n\t\tvar text = 'x' + zoomMultiplier.toFixed(1);\n\n\t\tctx.beginPath();\n\t\tctx.textAlign = 'left';\n\t\tctx.textBaseline = 'top';\n\t\tctx.fillStyle = '#777';\n\t\tctx.font = zoomMultiplierFont();\n\t\tctx.fillText(text, 5, 5);\n\t}\n\n\t//draw the grid\n\tdrawGrid();\n\n\t//draw modules\n\tctx.font = moduleFont();\n\tfor (var i = 0; i < modules.length; i++) {\n\t\tvar module = modules[i];\n\t\tdrawModule(module);\n\t}\n\n\t//draw connections\n\tctx.beginPath();\n\tctx.lineWidth = connectionThickness * zoomMultiplier;\n\n\tfor (var i = 0; i < connections.length; i++) {\n\t\tvar port1 = connections[i].inputPort, port2 = connections[i].outputPort;\n\n\t\tdrawConnection(port1, port2);\n\t}\n\n\tdrawZoom();\n\n\t//all of the below require e, if its null then stop here\n\tif (e == null) return;\n\n\t//draw the dragObject (if its a maybe connection)\n\tif (dragItem != null && dragItem.render != null) {\n\t\tdragItem.render(ctx, e);\n\t}\n}", "function resizeCanvas() {\r\n winWidth = window.innerWidth;\r\n winHeight = window.innerHeight;\r\n cnvs.width = winWidth;\r\n cnvs.height = winHeight;\r\n\r\n // Create star field\r\n buildStars();\r\n}", "function drawHlGrid(){\n\tvar obj = gridSize();\n\tvar canvas = document.getElementById('hl_grid');\n\t\n\tvar context = canvas.getContext('2d');\n\tcontext.scale(dpr,dpr);\n\t\n\t//Set the canvas size\n\tcanvas.width = (obj.colWidth * obj.cols+0.5)*dpr;\n\tcanvas.height = (obj.rowHeight*obj.rows+0.5)*dpr;\n\t\n\tcanvas.style.width = `${obj.colWidth * obj.cols+0.5}px`;\n\tcanvas.style.height = `${obj.rowHeight*obj.rows+0.5}px`;\n\tcontext.scale(dpr,dpr);\n\n}", "function makeGrid(height, width) {\n // set size of canvas\n for (var i = 0; i < height.value; i++) {\n const row = canvas.insertRow(i); // calls the function to set size rows\n for (var j = 0; j < width.value; j++) {\n const cell = row.insertCell(j); // cal the function to set size of insertCell\n cell.addEventListner(\"click\", fillSquare);\n }\n }\n}", "renderGrid() {\n this.gridCanvas.background(240);\n this.gridCanvas.fill(70, 70, 200);\n \n for (let w = 0; w < this.plotterGridSize.width; w++) {\n for (let h = 0; h < this.plotterGridSize.height; h++) {\n if (!this.plotterGrid.getCellState(w, h)) {\n continue;\n }\n\n this.gridCanvas.rect(w * this.cellSize, h * this.cellSize, this.cellSize, this.cellSize);\n }\n }\n\n this.lastRenderedCanvasStep = this.plotterGrid.getCurrentStep();\n }", "function makeGrid(height, width) {\r\n// Grid is cleared\r\n pixelCanvas.empty();\r\n// Create new grid\r\n// Create rows\r\n for (let row = 0; row < height; row++) {\r\n let tableRow = $('<tr></tr>');\r\n// Create columns\r\n for (let col = 0; col < width; col++) {\r\n let tableCell = $('<td></td>');\r\n// Append table data to create grid\r\n tableRow.append(tableCell);\r\n }// End col for loop\r\n pixelCanvas.append(tableRow);\r\n }// End row for loop\r\n }// End makeGrid function", "function setUpCanvas() {\n /* clearing up the screen */\n clear();\n /* Set display size (vw/vh). */\n var sizeWidth = (80 * window.innerWidth) / 100,\n sizeHeight = window.innerHeight;\n //Setting the canvas site and width to be responsive\n upperLayer.width = sizeWidth;\n upperLayer.height = sizeHeight;\n upperLayer.style.width = sizeWidth;\n upperLayer.style.height = sizeHeight;\n lowerLayer.width = sizeWidth;\n lowerLayer.height = sizeHeight;\n lowerLayer.style.width = sizeWidth;\n lowerLayer.style.height = sizeHeight;\n rect = upperLayer.getBoundingClientRect();\n}", "function draw_grid(){\n //background(254);\n for (var x = 0; x < width; x +=GridSize*Zoom) {\n\t\tfor (var y = 0; y < height; y += GridSize*Zoom) {\n //background(234);\n\t\t\tstroke(204, 102, 0);\n\t\t\tstrokeWeight(0.04);\n line(-x, -height, -x, height);\n line(x, -height, x, height);\n line(-width, y, width, y);\n line(-width, -y, width, -y);\n\t\t}\n }\n}", "function drawGrid() {\n for (let i = 0; i < canvas.width; i += gridSize) {\n ctx.beginPath()\n ctx.moveTo(i, 0)\n ctx.lineTo(i, canvas.height)\n ctx.strokeStyle = canvasGridColor\n ctx.stroke()\n }\n\n for (let i = 0; i < canvas.height + gridSize; i += gridSize) {\n ctx.beginPath()\n ctx.moveTo(0, i)\n ctx.lineTo(canvas.width, i)\n ctx.strokeStyle = canvasGridColor\n ctx.stroke()\n }\n}", "function fullscreen(){\n if (WIDTH == 80) {\n canvas.height = window.innerHeight; \n canvas.width = window.innerWidth;\n HEIGHT = window.innerHeight/10;\n WIDTH = window.innerWidth/10;\n } else {\n canvas.height = 600;\n canvas.width = 600;\n HEIGHT = 60;\n WIDTH = 80;\n }\n gridSetup();\n}", "function makeGrid() {\r\n newCanvas.innerHTML = \"\";\r\n for (let h = 0; h < gridHeight.value; h++) {\r\n const rows = document.createElement(\"tr\");\r\n newCanvas.insertAdjacentElement(\"afterbegin\", rows);\r\n for (let w = 0; w < gridWidth.value; w++) {\r\n const cells = document.createElement(\"td\");\r\n cells.addEventListener(\"click\", function () {\r\n cells.style.backgroundColor = cellColor.value;\r\n });\r\n rows.appendChild(cells);\r\n }\r\n }\r\n}", "function makeGrid() {\n\n canvas.innerHTML = '';\n\t\n\t\n // This builds the rows and columns\n var fragment = document.createDocumentFragment();\n\t\n for (let a = 0; a < height.value; a++) {\n var tr = document.createElement('tr');\n\n for (let b = 0; b < width.value; b++) {\n var td = document.createElement('td');\n tr.appendChild(td);\n }\n\n tr.addEventListener('click', clickedBox);\n fragment.appendChild(tr);\n\t\n }\n \n \n \n // Push grid onto DOM\n canvas.appendChild(fragment);\n \n}", "function drawGrids() {\n context.strokeStyle = \"rgba(0,255,0,255)\";\n context.lineWidth = 1;\n context.beginPath();\n context.moveTo(0,0);\n context.lineTo(screenWidth, screenHeight);\n context.moveTo(0,screenHeight);\n context.lineTo(screenWidth, 0);\n context.stroke();\n}", "function init() {\n this.grid = setupGrid(this.rows, this.lines, this.pattern);\n draw(this.canvas, this.grid);\n}", "function makeGrid()\n\t{\n\t\tgridData = []\n\t\tK = 0\n\t\tfor (var i = window.nCells.hori ; i >= 0; i--) {\n\t\t\tgridData.push({x1:K,x2:K,y1:0,y2:screenH()})\n\t\t\tK += window.cellDim.w\n\t\t};\n\t\tK = 0\n\t\tfor (var i = window.nCells.vert ; i >= 0; i--) {\n\t\t\tgridData.push({x1:0,x2:screenW(),y1:K,y2:K})\n\t\t\tK += window.cellDim.h\n\t\t};\n\n\t\tsvg.selectAll(\"line.gridLine\").remove()\n\t\tsvg.selectAll(\"line.gridLine\")\n\t\t\t.data(gridData)\n\t\t\t.enter()\n\t\t\t.append(\"line\")\n\t\t\t.attr('class','gridLine')\n\t\t\t.attr(\"x1\",function(d){return(d.x1)})\n\t\t\t.attr(\"x2\",function(d){return(d.x2)})\n\t\t\t.attr(\"y1\",function(d){return(d.y1)})\n\t\t\t.attr(\"y2\",function(d){return(d.y2)})\n\t\t\t.attr(\"stroke-width\",.2)\n\t\t\t.attr(\"stroke\",'rgb(0,0,0)');\n\t}", "function createGrid(){\n var color = '#BDBDBD';\n \n //Creates vertical grid\n for(var i = origin.x; i < canvasWidth; i += step){ //Populates right of the origin\n var line = two.makeLine(i, 0, i, canvasHeight);\n line.linewidth = 1;\n line.stroke = color;\n }\n for(var i = origin.x; i > 0; i -= step){ //Populates left of the origin\n var line = two.makeLine(i, 0, i, canvasHeight);\n line.linewidth = 1;\n line.stroke = color;\n }\n \n \n //Creates horizontal grid\n for(var i = origin.y; i < canvasHeight; i += step){ //Populates above the origin\n var line = two.makeLine(0, i, canvasWidth, i);\n line.linewidth = 1;\n line.stroke = color;\n }\n for(var i = origin.y; i > 0; i -= step){ //Populates below the origin\n var line = two.makeLine(0, i, canvasWidth, i);\n line.linewidth = 1;\n line.stroke = color;\n }\n}", "function setupTavern() {\n\n//draw a grid\n//make objects of each area\n\n\n}", "function setup() {\n createCanvas(windowWidth - 20, 200);\n \n }", "function drawSelGrid(){\n\tvar obj = gridSize();\n\tvar canvas = document.getElementById('sel_grid');\n\t\n\tvar context = canvas.getContext('2d');\n\tcontext.scale(dpr,dpr);\n\t\n\t//Set the canvas size\n\tcanvas.width = (obj.colWidth * obj.cols+0.5)*dpr;\n\tcanvas.height = (obj.rowHeight*obj.rows+0.5)*dpr;\n\t\n\tcanvas.style.width = `${obj.colWidth * obj.cols+0.5}px`;\n\tcanvas.style.height = `${obj.rowHeight*obj.rows+0.5}px`;\n\tcontext.scale(dpr,dpr);\n\n}", "function initCanvas() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n\n columns = Math.round(canvas.width / fontSize);\n drops = [];\n\n // Set initial position on y coordinate for each column\n for (var i = 0; i < columns; i++) {\n drops[i] = 1;\n }\n\n drawnToBottom = false;\n}", "function makeGrid(height, width) {\n // Firstly clear canvas and then start again\n while (canvas.hasChildNodes()){\n canvas.removeChild(canvas.firstChild);\n }\n // Iterate with given height and width to create the clear canvas\n for(var x = 0; x<height; x++){\n var row = document.createElement('tr');\n canvas.appendChild(row);\n for(var y = 0; y<width; y++){\n var column = document.createElement('td');\n row.appendChild(column);\n }\n }\n\n}", "function makeGrid() {\n canvas.find('tbody').remove();\n\n //submit button size changes to fit grid size\n var gridRows = heightInput.val();\n var gridCol = weightInput.val();\n\n //tbody set to the table\n canvas.append('<tbody></tbody>');\n\n var canvasBody = canvas.find('tbody');\n\n //drawing grid rows\n for (var i = 0; i < gridRows; i++) {\n canvasBody.append('<tr></tr>');\n }\n\n //draw grid col\n for (var i = 0; i < gridCol; i++) {\n canvas.find('tr').append('<td class=\"transparent\"></td>');\n }\n }", "function makeGrid() {\n\t\tfor(let col = 0; col < gridHeight; col++){\n\t\t\tconst cellRow = $('<tr></tr>'); //CREATES TABLE ROWS\n\t\t\tcanvas.append(cellRow);\n\t\t\tfor (let row = 0; row < gridWidth; row++){\n\t\t\t\tconst cell = $('<td></td>');\n\t\t\t\tcellRow.append(cell);\n\t\t\t};\n\t\t};\n\t}", "initialise_grid(element) {\n const [width, height] = [document.body.offsetWidth, document.body.offsetHeight];\n this.grid = new DOM.Canvas(null, width, height, { class: \"grid\" });\n element.add(this.grid);\n this.update_grid();\n }", "function setup() {\n createCanvas(400,400);\n cols = floor(width/w);\n rows = floor(height/w);\n \n // build the grid\n for (var j = 0; j < rows; j++) {\n for (var i = 0; i < cols; i++) {\n var cell = new Cell(i,j); // instantiate a Cell object\n grid.push(cell);\n }\n \n }\n}", "function gridify_the_canvas(canvas){\n\t\n\t\n\tvar counter = 0, row = 0, column = 0 ;\n\t\t\n\tfor(y=0 ; y< canvas.height; y+= gridSpace_height){ \t\n\t\tfor(x=0 ; x < canvas.width; x+= gridSpace_width){ \n\t\t\t\n\t\t\t\n\t\t\tcenterPoint = {'x': column*gridSpace_width + gridSpace_width/2 ,\n\t\t\t\t'y': row*gridSpace_height + gridSpace_height/2 };\n\t\t\tvar topLeft = {'x': x, 'y': y}, topRight = {'x': x +gridSpace_width, 'y': y},\n\t\t\tbottomLeft = { 'x' : x, 'y': y + gridSpace_height }, \n\t\t\tbottomRight = {'x' : x+gridSpace_width, 'y': y + gridSpace_height }\t\n\t\t\t\n\t\t\tvar grid = new createjs.Grid({ 'width' : gridSpace_width,\n\t\t\t 'height' : gridSpace_height, 'row' : row, 'column': column,\n\t\t\t 'centerPoint': centerPoint, 'topLeft': topLeft ,\n\t\t\t 'topRight': topRight, 'bottomLeft': bottomLeft, 'bottomRight': bottomRight,\n\t\t\t 'order': counter, 'name' : 'grid_' + counter\t\t\t \n\t\t\t });\n\t\t\t\n\t\t\tgrids.push( grid);//I want global access to them\n\t\t\tstage.addChild(grid);\n\t\t\t\n\t\t\tcounter++;\n\t\t\tcolumn++; \t\n\t\t\t\n\t\t\t\n\t\t}\n\t\trow++; column = 0;\t\n\t}\n\t\n\t//Lets set some general grid information for snapping\n\tvar number_of_grids_in_one_row = canvas.width / gridSpace_width,\n\t number_of_grids_in_one_column = canvas.height / gridSpace_height;\n\t\t\n\tgridInformation.number_of_grids_in_one_row =number_of_grids_in_one_row;\n\tgridInformation.number_of_grids_in_one_column = number_of_grids_in_one_column;\n\tgridInformation.number_of_grids = number_of_grids_in_one_row\n\t\t* number_of_grids_in_one_column;\n\t\n\tgridInformation.row_index = function(me){\n\t\tvar row_index = [];\n\t\tfor (var i = 0; i <= me.number_of_grids_in_one_column; i++) {\n\t\t\trow_index.push(i);\n\t\t}\n\t\t \n\t\treturn row_index;\t\n\t}(gridInformation)\n\t\n\t\t\t\n\t\t\n}", "function drawGrid() {\n\t\tvar gridS = gridSize,\n\t\t\tcanvasTop = Vector2.ScreenToWorld(Vector2.Zero),\n\t\t\tcanvasBottom = Vector2.ScreenToWorld(new Vector2(canvas.width, canvas.height)),\n\t\t\tcanvasMiddle = canvasTop.lerp(canvasBottom, 0.5);\n\n\n\t\tctx.beginPath();\n\t\tctx.strokeStyle = colors.grid;\n\t\tctx.lineWidth = gridThickness;\n\t\t//draw horizontal lines\n\t\tfor (var middleY = canvasMiddle.y, n = 0; middleY + gridS * n <= canvasBottom.y; n++) {\n\n\t\t\tvar y1 = middleY + gridS * n,\n\t\t\t\ty2 = middleY - gridS * n,\n\t\t\t\tscreenY1 = Vector2.WorldToScreen(new Vector2(0, y1)).y + offset.y % gridS,\n\t\t\t\tscreenY2 = Vector2.WorldToScreen(new Vector2(0, y2)).y + offset.y % gridS;\n\n\t\t\tctx.moveTo(0, screenY1);\n\t\t\tctx.lineTo(canvas.width, screenY1);\n\t\t\tctx.stroke();\n\n\t\t\tctx.moveTo(0, screenY2);\n\t\t\tctx.lineTo(canvas.width, screenY2);\n\t\t\tctx.stroke();\n\t\t}\n\t\tctx.beginPath();\n\t\tfor (var middleX = canvasMiddle.x, n = 0; middleX + gridS * n <= canvasBottom.x; n++) {\n\n\t\t\tvar x1 = middleX + gridS * n,\n\t\t\t\tx2 = middleX - gridS * n,\n\t\t\t\tscreenX1 = Vector2.WorldToScreen(new Vector2(x1, 0)).x + offset.x % gridS,\n\t\t\t\tscreenX2 = Vector2.WorldToScreen(new Vector2(x2, 0)).x + offset.x % gridS\n\n\t\t\tctx.moveTo(screenX1, 0);\n\t\t\tctx.lineTo(screenX1, canvas.width);\n\t\t\tctx.stroke();\n\n\t\t\tctx.moveTo(screenX2, 0);\n\t\t\tctx.lineTo(screenX2, canvas.width);\n\t\t\tctx.stroke();\n\t\t}\n\t}", "function createGrid() {\n var gridCanvas = document.createElement('canvas');\n gridCanvas.width = gridSize.cols*gridSize.square;\n gridCanvas.height = gridSize.rows*gridSize.square;\n var gridContext = gridCanvas.getContext('2d');\n\n // pass canvas to external variable so it can be used elsewhere as an image\n gridImage = gridCanvas;\n\n var horizontal;\n var vertical;\n var positionX = 0+(canvas.width/2)-32+320; // starting position of hooks\n var positionY = 0;\n var order;\n\n for (var i = 0; i < gridSize.cols; i++) {\n if (order === true) {\n order = false;\n } else {\n order = true;\n }\n drawCol(gridContext,positionX,order);\n positionX += 64;\n }\n}", "function defaultGrid(){\n gridSize(24)\n createDivs(24)\n}", "function setup() {\n createCanvas(SCREEN_SIZE, SCREEN_SIZE);\n background(0);\n strokeWeight(4);\n colorMode(HSB);\n \n // divide screen to bounded cells\n cols = floor(width/w); \n rows = floor(height/w);\n // make the grid\n for(let i = 0; i < cols * rows; i++){\n grid[i] = undefined;\n }\n // pick a random point, instead we will chose the center for better visualization\n let x = width / 2;\n let y = height / 2;\n // the index of the random point in the bounded cells\n let i = floor(x / w);\n let j = floor(y / w);\n // create as a vector\n let pos = createVector(x, y);\n // insert that random point to the background grid\n grid[i + j * cols] = pos;\n active.push(pos);\n \n}", "function makeGrid() {\n\n // get the table element\n const canvas = document.getElementById('pixelCanvas');\n // reset grid\n while(canvas.firstChild) {\n canvas.removeChild(canvas.firstChild);\n }\n\n\n var width = sizeForm.width.value;\n var height = sizeForm.height.value;\n console.debug(width);\n console.debug(height);\n \n // create grid with height and width inputs\n for(y = 0; y < height; y++) {\n row = canvas.appendChild(document.createElement('TR'));\n for(x = 0; x < width; x++) {\n cell = row.appendChild(document.createElement('TD'));\n }\n }\n\n canvas.addEventListener('click', changeColor);\n\n}", "function setGrid(width,height){\n\tbd.cellWidth = bd.width/width;\n\tbd.cellHeight = bd.height/height;\n\tbd.x = width;\n\tbd.y = height;\n\n\tctx.clearRect(0,0,bd.width,bd.height);\n\t//Initalizes the state array and the neighbor array\n\tstate\t = new Array(width);\n\tneighbor = new Array(width);\n\tfor(var x = 0; x < width; x ++){\n\n\t\tstate[x] \t= new Array(height);\n\t\tneighbor[x] = new Array(height);\n\n\t\tfor(var y = 0; y < height; y ++){\n\t\t\tif(random && Math.random()>0.5)\n\t\t\t\tstate[x][y] = true;\n\t\t\telse state[x][y] = false;\n\t\t\t\tneighbor[x][y] = 0;\n\t\t}\n\t}\n}", "function setup(){\n createCanvas(windowWidth,windowHeight);\n background(150); //draw grey canvas width and height of window.\n }", "function drawGrid() {\n ctxbg.clearRect(0, 0, W, H);\n printMouse(canvasToObj({x: mouseX, y: mouseY}));\n /*\n ctxbg.fillStyle = '#F0EDEE';\n ctxbg.beginPath();\n ctxbg.rect(0,0,W,H);\n ctxbg.closePath();\n ctxbg.fill();\n */\n\n let o00 = canvasToObj({x: 0, y: 0});\n let oWH = canvasToObj({x: W, y: H});\n let corigin = objToCanvas({x: 0, y: 0});\n\n if (corigin.x <=W && corigin.x >=0) {\n ctxbg.beginPath();\n ctxbg.moveTo(corigin.x, 0);\n ctxbg.lineTo(corigin.x, H);\n ctxbg.lineWidth = 1;\n ctxbg.strokeStyle = '#000000';\n ctxbg.stroke();\n }\n if (corigin.y <=H && corigin.y >=0) {\n ctxbg.beginPath();\n ctxbg.moveTo(0, corigin.y);\n ctxbg.lineTo(W, corigin.y);\n ctxbg.lineWidth = 1;\n ctxbg.strokeStyle = '#000000';\n ctxbg.stroke();\n }\n\n let gridSize = 0.001;\n let maxgridsize = W/20/(scale*epsilonScale);\n for (let c = 0; gridSize <= maxgridsize; c++) {\n if (c % 3 == 1) { // alternate 2, 5, 10\n gridSize *= 1.25;\n }\n gridSize *= 2;\n }\n let textSize = 0;\n if (gridSize < 1) {\n textSize = 1;\n }\n for (let i = Math.round(o00.x/gridSize);\n i <= Math.round(oWH.x/gridSize); i++) {\n let pt = objToCanvas({x: gridSize*i, y: 0});\n // drawLabel\n let textY = Math.min(H-5, Math.max(corigin.y, 20+topBarMargin));\n ctxbg.font = '16px Consolas';\n ctxbg.fillStyle = '#111111';\n ctxbg.fillText((gridSize*i).toFixed(textSize), pt.x+1, textY-3);\n // drawGrid\n ctxbg.beginPath();\n\n ctxbg.moveTo(pt.x, 0);\n ctxbg.lineTo(pt.x, H);\n ctxbg.lineWidth = 0.3;\n ctxbg.strokeStyle = '#000000';\n ctxbg.stroke();\n }\n for (let i = Math.round(oWH.y/gridSize);\n i <= Math.round(o00.y/gridSize); i++) {\n let pt = objToCanvas({x: 0, y: gridSize*i});\n // drawLabel\n let textX = Math.min(W-sideBarMargin-45, Math.max(corigin.x, 0));\n ctxbg.font = '16px Consolas';\n ctxbg.fillStyle = '#111111';\n ctxbg.fillText((gridSize*i).toFixed(textSize), textX+1, pt.y-3);\n // drawGrid\n ctxbg.beginPath();\n\n ctxbg.moveTo(0, pt.y);\n ctxbg.lineTo(W, pt.y);\n ctxbg.lineWidth = 0.3;\n ctxbg.strokeStyle = '#000000';\n ctxbg.stroke();\n }\n}", "function setUpCanvas() {\r\n canvas = document.createElement(\"CANVAS\");\r\n canvas.id = \"canvas\";\r\n canvas.style.width = \"100%\";\r\n canvas.style.height = \"100%\";\r\n canvas.style.background = 'black';\r\n canvas.style.marginLeft = 'auto';\r\n canvas.style.marginRight = 'auto';\r\n canvas.style.display = 'block';\r\n }", "function _createGrid() {\n\t_grid = [$game.VIEWPORT_WIDTH];\n\tvar i = $game.VIEWPORT_WIDTH;\n\twhile(--i >= 0) {\n\t\t_grid[i] = [$game.VIEWPORT_HEIGHT];\n\t\tvar j = $game.VIEWPORT_HEIGHT;\n\t\twhile(--j >= 0) {\n\t\t\t//place random object\n\t\t\tvar item = _makeRandomItem();\n\t\t\t_grid[i][j] = {\n\t\t\t\titem: item,\n\t\t\t\titemRevealed: false\n\t\t\t};\n\t\t}\n\t}\n}", "function init () {\n resizeCanvas();\n}", "function drawGrid() {\n\t\t\t// add container styles\n\t\t\t$container.addClass('container gantt');\n\t\t\t\n\t\t\t// empty container\n\t\t\t$container.empty();\n\t\t\t\t\t\t\n\t\t\t// render contents into container\n\t\t\t$container.append(gridTmpl(controller));\t\n\t\t\tinitEls();\n\t\t\t\n\t\t\t// adjust layout components\n\t\t\tadjustLayout();\n\t\t\tinitHScroller();\t\t\t\n\t\t}", "function drawGrid() {\n // Draw frame.\n let cell = grid[0][0];\n let frameW = cell.width * GRID_COLS;\n let frameH = cell.height * GRID_ROWS;\n\n context.fillStyle = COLOUR_FRAME;\n context.fillRect(cell.left, cell.top, frameW, frameH);\n\n // Draw the base of the frame.\n context.fillStyle = COLOUR_FRAME_BOTTOM;\n context.fillRect(\n cell.left - margin / 2,\n cell.top + frameH - margin / 2,\n frameW + margin,\n margin\n );\n\n // Draw cells.\n for (let row of grid) {\n for (let cell of row) {\n cell.draw(context);\n }\n }\n}", "function makeGrid() {\n pixelCanvas.innerHTML = \"\";\n for (let i = 0; i < gridHeight;i++) {\n const tr = document.createElement(\"tr\");\n for(let j = 0; j < gridWidth; j++){\n const td = document.createElement(\"td\");\n tr.appendChild(td);\n }\n fragment.appendChild(tr);\n }", "function setup() {\n createCanvas(600, 600);\n textAlign(CENTER, CENTER);\n W = H = winNum = gridSize;\n tileSize = width/W; // Assume square grid\n \n init();\n}", "function makeGrid(e) {\n\n canvas.innerHTML = '';\n\n // console.log(canvas);\n\n for (var i = 0; i < gridHeight.value; i++) {\n let row = canvas.appendChild(document.createElement('tr'));\n row.classList.add('row');\n canvas.append(row);\n\n for (var j = 0; j < gridWidth.value; j++) {\n let pixels = row.appendChild(document.createElement('td'));\n pixels.classList.add('pixel');\n pixels.innerHTML;\n };\n };\n let brush = false;\n let $td = document.getElementsByTagName('td');\n\n for (var i = 0; i < $td.length; i++) {\n $td[i].addEventListener('mousedown', (e) => {\n brush = true;\n if (brush) {\n e.target.style.backgroundColor = colorValue.value;\n };\n for (var i = 0; i < $td.length; i++) {\n $td[i].addEventListener('mousemove', (e) => {\n if (brush) {\n e.target.style.backgroundColor = colorValue.value;\n };\n });\n };\n });\n };\n for (var i = 0; i < $td.length; i++) {\n $td[i].addEventListener('mouseup', () => {\n brush = false;\n });\n };\n }", "function drawGrid() {\r\n var gridOptions = {\r\n majorLines: {\r\n separation: majorSeperation,\r\n color: \"#d3d3d3\",\r\n },\r\n }\r\n ctx.clearRect(0, 0, cnv.width, cnv.height)\r\n cnv.width = canvasWidth\r\n cnv.height = canvasHeight\r\n drawGridLines(cnv, gridOptions.majorLines)\r\n\r\n return\r\n}", "function windowToGrid(window, x, y, width, height) {\n var screen = window.screen().frameWithoutDockOrMenu();\n\n window.setFrame({\n x: Math.round( x * screen.width ) + padding + screen.x,\n y: Math.round( y * screen.height ) + padding + screen.y,\n width: Math.round( width * screen.width ) - ( 2 * padding ),\n height: Math.round( height * screen.height ) - ( 2 * padding )\n });\n\n window.focusWindow();\n\n return window;\n}", "createGrids () {\n }", "function makeGrid() {\n const body = document.getElementsByTagName(\"body\")[0];\n const table = document.querySelector(\"#pixelCanvas\");\n const tableBody = document.createElement(\"tbody\");\n\n // Removing the previous grid (if any)\n if (table.firstChild) {\n table.firstChild.remove();\n };\n\n // Making a grid using user input\n for (let i = 0; i < newHeight; i++) {\n const row = document.createElement(\"tr\");\n\n for (let j = 0; j < newWidth; j++) {\n const cell = document.createElement(\"td\");\n row.appendChild(cell);\n };\n\n tableBody.appendChild(row);\n };\n\n table.appendChild(tableBody);\n body.appendChild(table);\n\n // Adding an event which changes background color for individual cells\n const td = document.getElementsByTagName(\"td\");\n\n for (let i = 0; i < td.length; i++) {\n td[i].onclick = function() {\n this.style.backgroundColor = newColor;\n };\n };\n}", "createGameGrid (x, y) {\n while (y < 1080){\n while (x < 1920){\n const cell = this.add.rectangle(x, y, 192, 180).setInteractive()\n cell.setStrokeStyle(2, 0x000000)\n cell.alpha = 0.01\n this.gameGridCellGroup.add(cell)\n x += 192\n }\n if (x > 1920) {\n x = 96\n y += 180\n }\n }\n }", "function windowResized() {\n canvasContainer = select(\"#tiling-generator\");\n var w = canvasContainer.width;\n w = Math.min(w, 1000);\n padding = 15 * (w / 1000);\n if (w < 550) {\n gridXAmount = 18;\n gridYAmount = 18;\n } else if (w >= 550 && w < 750) {\n gridXAmount = 24;\n gridYAmount = 24;\n } else if (w >= 751) {\n gridXAmount = 32;\n gridYAmount = 18;\n }\n cnvs = resizeCanvas(w, ((w - (padding * 2)) * gridYAmount / gridXAmount) + padding * 2);\n tileWidth = (width - (padding * 2)) / gridXAmount;\n ran = 0.4;\n ranFloor = 0.7;\n ranCeiling = 1.5;\n linesMult = 2;\n // var strokeFloorScalar = (w > 500) ? 1.125 : 1.5;\n strokeFloor = 1 * (tileWidth * 32 / 1280);\n strokeCeiling = 1.5 * (tileWidth * 32 / 1280);\n if (!looping) {\n redraw();\n }\n}", "function initCanvas(width, height){}", "function renderGrid() {\n let { C, cols, rows, px, grid_color, render_border } = state\n C.gx.clearRect(\n -render_border,\n -render_border,\n C.gx.canvas.width,\n C.gx.canvas.height\n )\n C.gx.strokeStyle = grid_color\n C.gx.lineWidth = 1\n C.gx.strokeRect(0.5, 0.5, sub(mul(cols, px), 1), sub(mul(rows, px), 1))\n C.gx.lineWidth = 2\n for (let c = 1; c < state.cols; c++) {\n C.gx.beginPath()\n C.gx.moveTo(mul(c, px), 0)\n C.gx.lineTo(mul(c, px), mul(rows, px))\n C.gx.stroke()\n }\n for (let r = 1; r < state.rows; r++) {\n C.gx.beginPath()\n C.gx.moveTo(0, mul(r, px))\n C.gx.lineTo(mul(cols, px), mul(r, px))\n C.gx.stroke()\n }\n}", "init() {\n let i, cells, cell, cellMeta;\n let width = null;\n let height = null;\n\n if (!this.config.isFullScreen) {\n width = this.canvas.width;\n height = this.canvas.height;\n }\n\n this.board.calculateCellLayout(width, height);\n this.canvas.width = this.board.width;\n this.canvas.height = this.board.height;\n cells = this.board.populateBoard(this.config.isRandom);\n\n this.drawCells(cells);\n this.isInitialized = true;\n }", "renderCanvas() {\n /**\n * @type {p5.Vector} mouse\n */\n let mouse = this.p.createVector(this.p.mouseX - this.position.x, this.p.mouseY - this.position.y);\n mouse.x = Math.floor(mouse.x / this.cellSize) * this.cellSize;\n mouse.y = Math.floor(mouse.y / this.cellSize) * this.cellSize;\n\n this.canvas.image(this.gridCanvas, 0, 0);\n this.canvas.fill(255, 120, 0, 120);\n this.canvas.rect(mouse.x, mouse.y, this.cellSize, this.cellSize);\n\n this.canvasUpdateRequired = false;\n }", "_createInnerWindow({ x, y, rectWidth, rectHeight }) {\n this.graphics.fillStyle(this.windowColor, this.windowAlpha);\n this.graphics.fillRect(x + 1, y + 1, rectWidth - 1, rectHeight - 1);\n }", "drawGrid() {\n translate(this.xOffset, this.yOffset);\n background(color('black'));\n for (let x = 0; x <= this.width; x++) {\n\n for (let y = 0; y <= this.height; y++) {\n fill(color('white'))\n strokeWeight(1);\n rect(x * this.boxSize, y * this.boxSize, this.boxSize, this.boxSize);\n\n // Draw the position of the entry\n fill(color('gray'));\n if (this.gridLayout[x][y] != null)\n text(x + \",\" + y + \"\\n\" + this.gridLayout[x][y].name, x * this.boxSize, y * this.boxSize, this.boxSize, this.boxSize);\n else\n text(x + \",\" + y + \"\\n\", x * this.boxSize, y * this.boxSize, this.boxSize, this.boxSize);\n }\n }\n }", "function grid() {\n\tvar spaceX = 64;\n\tvar spaceY = spaceX;\n\n\tstroke(200);\n\tfor (var i = 64; i < width; i += 64) {\n\t\tline(i, 0, i, height);\n\t}\n\tfor (var i = 64; i < height; i += 64) {\n\t\tline(0, i, width, i);\n\t}\n}", "function makeGrid() {\n const height = inputHeight.val();\n const width = inputWidth.val();\n\n for (let i = 0; i < height; i++) {\n const row = $('<tr></tr>');\n for (let j = 0; j < width; j++) {\n row.append('<td></td>');\n }\n canvas.append(row);\n }\n}", "function makeGrid() {\r\n Artmaker.canvas.innerHTML = \"\";\r\n while (Artmaker.canvas.rows.length > 0) {\r\n Artmaker.canvas.deleteRow(0);\r\n }\r\n for (var i = 0; i < Artmaker.rows.value; i++) {\r\n var row = Artmaker.canvas.insertRow(i);\r\n row.setAttribute(\"class\", \"row\");\r\n for (var j = 0; j < Artmaker.columns.value; j++) {\r\n var cell = row.insertCell(j);\r\n cell.addEventListener(\"click\", function(e) {\r\n e.target.style.backgroundColor = Artmaker.color.value;\r\n });\r\n }\r\n }\r\n return false;\r\n}", "fillRect( w, h ) {\n for (var x = 0; x < w; x++) {\n for (var y = 0; y < h; y++) {\n this.grid[x][y] = true;\n }\n }\n }", "function setup() // P5 Setup Function\n{\n let sz = g_canvas.cell_size;\n let width = sz * g_canvas.wid; // Our 'canvas' uses cells of given size, not 1x1 pixels.\n let height = sz * g_canvas.hgt;\n createCanvas( width, height ); // Make a P5 canvas.\n draw_grid( 20, 0, 'white', 'red' );\n}", "function makeGrid() {\n var {width, height} = size_input();\n\n for (rowNum = 0; rowNum < height; rowNum++) {\n grid.append(\" <tr></tr>\");\n }\n for (colNum = 0; colNum < width; colNum++) {\n $(\"#pixel_canvas tr\").append(\" <td></td>\");\n }\n}", "function setDefaultGrid() {\n setGridSize(16);\n fillGrid(16);\n}", "function drawGrid() {\n for (r = 0; r < ROW; r++) {\n for (c = 0; c < COLUMN; c++) {\n drawSquare(c, r, grid[r][c]);\n }\n }\n }", "function drawGrid(){\n var i, y,\n gridLine,\n gridLines = graph.paper.set(),\n avalaibleArea = graph.height - graph.padding.top - graph.padding.bottom;\n\n if (graph.options.grid.show) {\n for (i = 0; i < graph.options.grid.numYLabels; i++) {\n y = graph.height -\n i / (graph.options.grid.numYLabels - 1) * avalaibleArea -\n graph.padding.bottom +\n graph.padding.top;\n gridLine = graph.paper.path(\"M0\" + \" \" + y + \"L\" + graph.width + \" \" + y).attr('stroke', '#ddd');\n gridLines.push(gridLine);\n }\n } else if (graph.options.grid.showBaseline) {\n y = graph.height -\n graph.padding.bottom +\n graph.padding.top;\n gridLine = graph.paper.path(\"M0\" + \" \" + y + \"L\" + graph.width + \" \" + y).attr('stroke', '#ddd');\n gridLines.push(gridLine);\n }\n\n graph.grid = {\n lines: gridLines\n };\n }", "function makeGrid() {\n\tfor (y = 0; y < sizeY; y++ ){\n\t\t$('#pixelCanvas').append('<tr>');\n\t\t\tfor(x = 0; x< sizeX; x++ ){\n\t\t\t\t$('#pixelCanvas tr:last-child').append('<td></td>');\n\t\t\t}\n\t\t$('#pixelCanvas').append('</tr>');\n\t}\n}", "function makeGrid() {\n\tvar grid = $('#grid');\n\t// Capture grid height and width and limit it to 1 to 30\n\tvar height = Number($('#grid-height').val());\n\t$('#win').removeClass('win-is-visible');\n\tif (height > 30) {\n\t\theight = 30;\n\t}\n\tif (height < 1) {\n\t\theight = 1;\n\t}\n\tvar width = Number($('#grid-width').val());\n\tif (width > 30) {\n\t\twidth = 30;\n\t}\n\tif (width < 1) {\n\t\twidth = 1;\n\t}\n\t// Reset game variables\n\tgrid.html('');\n\tgridArr = [];\n\ttilesFound = 0;\n\tnonogram = false;\n\t// Construct grid in dom and gridArr variable\n\tgrid.prepend('<div id=\\'y-numbers\\'</div>');\n\tfor (var x = 0; x < width + 1; x++){\n\t\tx == 0 ? $('#y-numbers').append('<div id=\\'corner\\'></div>') : \n\t\t\t$('#y-numbers').append('<div id=\\'column-'+ (x - 1) +'\\'><ul></ul></div>');\n\t}\n\tfor (var y = 0; y < height; y++){\n\t\tgrid.append('<div id='+ y +'-row></div>');\n\t\tgridArr.push([]);\n\t\tfor (var x = 0; x < width + 1; x++){\n\t\t\tif (x === 0){\n\t\t\t\t$('#'+ y +'-row').append('<div id=\\'row-'+ y +'\\'><ul></ul></div>');\n\t\t\t}\n\t\t\telse{\n\t\t\t\t$('#'+ y +'-row').append('<div class=\\'pixel '+ (x - 1) +'\\' data-isPixel = \\'false\\' data-y='+ y +' data-x='+ (x - 1) +' onclick=\\'handlePixel(this)\\'></div>');\n\t\t\t\tgridArr[y].push(0);\n\t\t\t}\n\t\t}\n\t}\n\t// Append color picker and nonogramify buttons\n\t$('#grid').append('<div id=\"color-picker\"><p>Color Picker</p><input id=\"grid-color\" type=\"color\"></div><button id=\"nonogramify\" onclick=\"nonogramify()\">Create Nonogram</button>');\n}", "function makeCells() {\n const rows = InputHeight.val();\n const cols = InputWidth.val();\n const pixelSize = InputSize.val() + 'px';\n const TotalCells = rows * cols;\n // Setting memory limit for undo-redo operations\n UndoLimit = (TotalCells < 400) ? 5 : (TotalCells < 1600) ? 3 : 2;\n // \"Start drawing\" button goes to the normal mode\n SubmitBtn.removeClass('pulse');\n // Creating table rows\n for (let i = 0; i < rows; i++) {\n Canvas.append('<tr class=\"tr\"></tr>');\n }\n CanvasTr = $('.tr');\n // Creating cells to every row\n for (let j = 0; j < cols; j++) {\n CanvasTr.append('<td class=\"td\"></<td>');\n }\n CanvasTd = $('.td');\n CanvasTr.css('height', pixelSize);\n CanvasTd.css('width', pixelSize);\n isSmthOnCanvas = false;\n // Turning off the context menu over canvas\n Canvas.contextmenu(function () {\n return false;\n })\n // Adding a delay for avoid overloading browser by simultaneously animation\n if (body.hasClass('checked') == false) {\n setTimeout(function () {\n CanvasBgr.slideToggle(250);\n }, 700);\n // For hiding useless elements\n body.addClass('checked');\n }\n else {\n CanvasBgr.slideToggle(250);\n };\n drawing();\n manageHistory();\n }", "function makeGrid(){\r\n $('#pixel_canvas').children().remove();\r\n row=$('#input_height').val();\r\n column=$('#input_width').val();\r\n var i=0;\r\n while(i<row){\r\n $('#pixel_canvas').append('<tr></tr>');\r\n for(var j=0;j<column;j++){\r\n $('tr').last().append('<td></td>');\r\n }\r\n i++;\r\n }\r\n }", "function setup() {\n createCanvas(windowWidth, windowHeight);\n rectMode(CENTER); \n}", "function makeGrid() {\n // Variables for Function\n const gridHeight = document.getElementById('inputHeight').value;\n const gridWidth = document.getElementById('inputWidth').value;\n const canvas = document.getElementById('pixelCanvas');\n canvas.innerHTML = \"\"; // Resets grid when new submitted again.\n // Function below Creates Rows & Columns\n for (let y = 0; y < gridHeight; ++y) {\n var row = document.createElement('tr');\n canvas.appendChild(row);\n for (let x = 0; x < gridWidth; ++x) {\n var col = document.createElement('td');\n row.appendChild(col);\n // eventListener assigns color to background when cell clicked.\n col.addEventListener('click', function(c) {\n var color = setColor();\n c.target.style.backgroundColor = color;\n });\n }\n }\n}", "function createGrid() {\n\n const frame = null; // get a reference to the frame\n\n // Add Code to create the game grid\n for (let i = 0; i < 10 ; i++) {\n buildRow(frame); \n }\n resetGame();\n}", "function makeGrid(gridHeight, gridWidth) {\n gridCanvas.innerHTML = \"\"; //clear previous table\n //Table creation code from:\n //https://stackoverflow.com/questions/14643617/create-table-using-javascript\n for (var h = 1; h <= gridHeight; h++) {\n var row = document.createElement('tr');\n for (var w = 1; w <= gridWidth; w++) {\n var column = document.createElement('td');\n row.appendChild(column);\n column.addEventListener('click', function(event) {\n event.target.style.backgroundColor = cellColor;\n })\n }\n gridCanvas.appendChild(row);\n }\n}", "function g() {\n 'use strict';\n var x,\n y,\n grid = canvasDatagrid({\n parentNode: document.body,\n allowFreezingColumns: true,\n allowFreezingRows: true,\n debug: false\n });\n grid.style.columnHeaderCellHeight = 40;\n grid.style.cellHeight = 40;\n grid.style.height = '100%';\n grid.style.width = '100%';\n function getData(prefix) {\n var data = [];\n for (x = 0; x < 100; x += 1) {\n data[x] = {};\n for (y = 0; y < 50; y += 1) {\n data[x][String.fromCharCode(65 + y)] = prefix + x + ':' + y;\n }\n }\n data[x - 1].A = 'EOF';\n data[x - 1][String.fromCharCode(65 + y - 1)] = 'EOF';\n return data;\n }\n grid.data = getData('');\n for (x = 0; x < 10; x += 1) {\n grid.schema[x].width = 1000;\n // grid.schema[x].hidden = true;\n }\n grid.style.height = '100%';\n grid.style.width = '100%';\n // grid.style.height = 'auto';\n // grid.style.width = 'auto';\n setTimeout(function () {\n grid.scrollIntoView(20, 75, .5, .5);\n }, 1000);\n}", "function generateGrid(x) {\n \tfor (var rows = 0; rows < x; rows++) {\n \tfor (var columns = 0; columns < x; columns++) {\n \t$('#container').append(\"<div class='cell'></div>\");\n };\n };\n $('.cell').width(720/x);\n $('.cell').height(720/x);\n\t\tpaint();\n}", "constructor() {\n this.gridNumber = settings.canvasSize / settings.step;\n this.reset();\n }", "resizeCanvas() {\n const containerWidth = this.worldContainer.offsetWidth;\n this.canvasWidth = containerWidth;\n this.canvasHeight = containerWidth;\n\n this.canvas.width = this.canvasWidth;\n this.canvas.height = this.canvasHeight;\n\n this.cellSize = this.canvasWidth / this.colNumber;\n this.renderWorld();\n }", "function drawGrid(){\n // draw border\n drawSquare(zeroX, zeroY, squareSize*5, borderW, \"black\", \"white\");\n \n // draw each square in the grid\n for (var i = 0; i < 5; i++){\n for (var j = 0; j < 5; j++) {\n drawSquare(zeroX + i*squareSize, zeroY + j*squareSize, squareSize, \n gridW, \"black\", \"white\");\n }\n }\n penUp();\n}", "update_grid() {\n // Constants for parameters of the grid pattern.\n // The (average) length of the dashes making up the cell border lines.\n const DASH_LENGTH = this.default_cell_size / 16;\n // The border colour.\n const BORDER_COLOUR = \"lightgrey\";\n\n const [width, height] = [document.body.offsetWidth, document.body.offsetHeight];\n const canvas = this.grid;\n canvas.resize(width, height);\n\n const scale = 2 ** this.scale;\n\n const context = canvas.context;\n context.strokeStyle = BORDER_COLOUR;\n context.lineWidth = Math.max(1, CONSTANTS.GRID_BORDER_WIDTH * scale);\n context.setLineDash([DASH_LENGTH * scale]);\n\n // We want to centre the horizontal and vertical dashes, so we get little crosses in the\n // corner of each grid cell. This is best effort: it is perfect when each column and row\n // is the default size, but otherwise may be imperfect.\n const dash_offset = -DASH_LENGTH * scale / 2;\n\n const offset = this.view;\n\n const [[left_col, left_offset], [top_row, top_offset]] = this.col_row_offset_from_offset(\n offset.sub(new Offset(width / scale / 2, height / scale / 2))\n );\n const [[right_col,], [bottom_row,]] = this.col_row_offset_from_offset(\n offset.add(new Offset(width / scale / 2, height / scale / 2))\n );\n\n // Draw the vertical lines.\n context.beginPath();\n for (let col = left_col, x = left_offset - offset.left;\n col <= right_col; x += this.cell_size(this.cell_width, col++)) {\n context.moveTo(x * scale + width / 2, 0);\n context.lineTo(x * scale + width / 2, height);\n }\n context.lineDashOffset = offset.top * scale - dash_offset - height % this.default_cell_size / 2;\n context.stroke();\n\n // Draw the horizontal lines.\n context.beginPath();\n for (let row = top_row, y = top_offset - offset.top;\n row <= bottom_row; y += this.cell_size(this.cell_height, row++)) {\n context.moveTo(0, y * scale + height / 2);\n context.lineTo(width, y * scale + height / 2);\n }\n context.lineDashOffset = offset.left * scale - dash_offset - width % this.default_cell_size / 2;\n context.stroke();\n }", "function drawGrid() {\n var bw = 625;\n var bh = 625;\n\n // +1's needed for right border consistency\n var cw = bw + 1; \n var ch = bh + 1;\n\n for (var x = 0; x <= bw; x += 25) {\n ctx.moveTo(0.5 + x, 0);\n ctx.lineTo(0.5 + x, bh);\n }\n \n for (var x = 0; x <= bh; x += 25) {\n ctx.moveTo(0, 0.5 + x);\n ctx.lineTo(bh, 0.5 + x);\n }\n\n ctx.strokeStyle = \"grey\";\n ctx.stroke();\n}", "function makeGrid(x, y) {\n for (var rows = 0; rows < x; rows++) {\n for (var columns = 0; columns < y; columns++) {\n $(\"#container\").append(\"<div class='grid'></div>\");\n };\n };\n $(\".grid\").height(960/x);\n $(\".grid\").width(960/y);\n}", "function environmentSetUp(){\n \n //Draws background\n var bkg = two.makeRectangle(origin.x, origin.y, canvasWidth, canvasHeight);\n bkg.fill = 'rgba(0, 20, 255, 0.07)';\n\n \n //Draws grid lines\n createGrid();\n\n \n //Draws x and y axes\n var xAxis = two.makeLine(0, midHeight, canvasWidth, midHeight);\n var yAxis = two.makeLine(midWidth, 0, midWidth, canvasHeight);\n \n \n //Draws borders\n var topBorder = two.makeLine(0, 0, canvasWidth, 0);\n topBorder.stroke = '#1976D2'\n topBorder.linewidth = 5;\n \n var rightBorder = two.makeLine(canvasWidth, 0, canvasWidth, canvasHeight);\n rightBorder.stroke = '#1976D2';\n rightBorder.linewidth = 5;\n \n var bottomBorder = two.makeLine(0, canvasHeight, canvasWidth, canvasHeight);\n bottomBorder.stroke = '#1976D2';\n bottomBorder.linewidth = 5;\n \n var leftBorder = two.makeLine(0, 0, 0, canvasHeight);\n leftBorder.stroke = '#1976D2';\n leftBorder.linewidth = 5;\n}" ]
[ "0.73653895", "0.7218821", "0.7203408", "0.717473", "0.7147267", "0.71271014", "0.7113312", "0.71114695", "0.7080385", "0.70702493", "0.69907415", "0.69788057", "0.69760615", "0.69738656", "0.694622", "0.6940206", "0.69292825", "0.6928185", "0.6927859", "0.6904218", "0.6903939", "0.6883245", "0.6868009", "0.6860037", "0.6850762", "0.683904", "0.6832939", "0.68266535", "0.68192416", "0.6808315", "0.6800913", "0.68000007", "0.6797478", "0.6774942", "0.67723393", "0.6749453", "0.67484117", "0.6739", "0.6731978", "0.67303264", "0.6715507", "0.6709031", "0.67000544", "0.6692317", "0.668598", "0.66816616", "0.667843", "0.66715914", "0.666356", "0.6661377", "0.66487294", "0.66353214", "0.6635262", "0.6632326", "0.66272324", "0.6613383", "0.6612589", "0.66098005", "0.6589636", "0.65755796", "0.65755445", "0.65718365", "0.65671813", "0.6559659", "0.65586543", "0.6549533", "0.6543588", "0.6535944", "0.6533838", "0.65323627", "0.6527048", "0.65260345", "0.6523049", "0.652277", "0.6519951", "0.6515909", "0.6506242", "0.6501658", "0.65008795", "0.6493081", "0.6483517", "0.6480072", "0.6472334", "0.6447501", "0.6446832", "0.6437101", "0.6433261", "0.64261967", "0.64244765", "0.6422339", "0.6419592", "0.64119804", "0.64096755", "0.6407124", "0.64014924", "0.6398284", "0.639055", "0.6390337", "0.638985", "0.6385724", "0.63848805" ]
0.0
-1
switches between balck and white
function mousePressed() { let xcoord = floor(mouseX / cellSize); let ycoord = floor(mouseY / cellSize); if (grid[xcoord][ycoord]===1) { grid[xcoord][ycoord]=0; } else { grid[xcoord][ycoord] = 1; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function turnBlackBgAndWhiteFo() {\n setInterval(changeBgAndFont, 0000);\n}", "function blinkingText() {\r\n if ($(\"#start-game-btn\").hasClass(\"dark-green\")) {\r\n $(\"#start-game-btn\").removeClass(\"dark-green\").addClass(\"off-white\");\r\n }\r\n else {\r\n $(\"#start-game-btn\").removeClass(\"off-white\").addClass(\"dark-green\");\r\n }\r\n }", "function buttonRainbowMode() {\n randomBirdsColourChange();\n}", "turnGhostsBlue() {}", "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}", "switchTurn() {\n\t\tthis.turn = (this.turn == 'W' ? 'B' : 'W');\n\t\tthis.turnStatus.text(this.turn == 'W' ? 'White:' : 'Black:');\n\t}", "function turnOnGrayStyle(){\n if(currentColorSetting != \"GrayStyle\")\n {\n removeCurrentColorSetting();\n toggleGraystyle();\n currentColorSetting = \"GrayStyle\";\n toggleAriaButtonPress('#color-scheme-b-o-w');\n }\n}", "function switchBlue(){\n\t\t$(\"p\").css(\"switch\", \"blue\");\n\t}", "brighter(){\n\t\tthis.addColorValue(\"red\", 30);\n\t\tthis.addColorValue(\"green\", 30);\n\t\tthis.addColorValue(\"blue\", 30);\n\t}", "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 cambiarColor(){\n\tif( boton.style.background == \"yellow\"){\n\t\tboton.style.background = \"orange\";\n\t}else{\n\t\tboton.style.background = \"yellow\";\n\t}\t\n}", "function switchColor(){\n\tif (currentColor === \"red\"){\n\t\tcurrentColor = \"black\";\n\t}\telse {\n\t\t\tcurrentColor = \"red\";\n\t\t}\n}", "function switchPink(){\n\t\t$(\"body\").css(\"background\", \"pink\");\n\t\t$(\"body\").css(\"color\", \"white\");\n\t}", "set dryColor(value) {}", "function resetSnoozes() {\n\n if (bgHigher(BGUrgentLow+1)) BGUrgentLowSnooze = 0;\n if (bgHigher(BGLow+1)) BGLowSnooze = 0;\n if (bgLower(BGUrgentHigh-1)) BGUrgentHighSnooze = 0;\n if (bgLower(BGHigh-1)) BGHighSnooze = 0;\n}", "function toggle(obj) {\n if (obj !== bunny) {\n obj.factor = 1.0 - obj.factor;\n obj.tint = obj.factor ? 0xff0033 : 0x00ff00;\n }\n }", "function goGreen() {\n console.log('We have lift off!');\n $redSignal.removeClass('is-active');\n $greenSignal.addClass('is-active');\n }", "function myFunction() {\n\tvar checkstatus = document.getElementById(\"body\").style.backgroundColor;\t\n\t\n\tif (checkstatus == \"white\"){\n\t\tdocument.getElementById(\"body\").style.backgroundColor = \"black\";\n\t\tdocument.getElementById(\"toggleswitch\").style.cssFloat = \"left\"; \n\t\tdocument.getElementById(\"toggleswitch\").innerHTML = \"OFF\";\n\t}\n else if(checkstatus == \"black\"){\n\t\tdocument.getElementById(\"body\").style.backgroundColor = \"white\";\n\t\tdocument.getElementById(\"toggleswitch\").style.cssFloat = \"right\";\n\t\tdocument.getElementById(\"toggleswitch\").innerHTML = \"ON\";\n\t\tdocument.getElementById(\"toggleswitch\").style.color = \"red\";\n\t\t\n\t}\n\t\n}", "function turnWhiteBgAndBlackFo() {\n\t$('*').css('background-color','');\n\t$('body').each(function(element){\n\t\t$(this).css('color','black');\n\t});\n\t$('*').css('color','');\n}", "function darkMode() {\r\n\r\n if (!darkOn){\r\n console.log(\"Dark Mode On\");\r\n document.querySelector(\".container\").style.backgroundColor = \"black\";\r\n document.querySelector(\"button\").textContent = dark;\r\n \r\n let images = document.getElementsByClassName(\"neural_network\");\r\n for(let i = 0;i < images.length; i++){\r\n images[i].style.backgroundColor = \"#013220\";\r\n }\r\n\r\n darkOn = true;\r\n } else {\r\n console.log(\"Dark Mode Off\");\r\n document.querySelector(\".container\").style.backgroundColor = \"#c64756\";\r\n document.querySelector(\"button\").textContent = sunny;\r\n darkOn = false;\r\n\r\n let images = document.getElementsByClassName(\"neural_network\");\r\n for(let i = 0;i < images.length; i++){\r\n images[i].style.backgroundColor = \"\";\r\n }\r\n }\r\n}", "bluer(){\n\t\tthis.multiplyColorValue(\"blue\", 1.2);\n\t}", "darker(){\n\t\tthis.addColorValue(\"red\", -30);\n\t\tthis.addColorValue(\"green\", -30);\n\t\tthis.addColorValue(\"blue\", -30);\n\t}", "function colorAllClimbsWhite() {\n $(Climbsim.scene.children).each(function () {\n if (this instanceof THREE.Line) {\n this.material.color.set('white');\n }\n })\n}", "function changeWhite() {\n $(this).css('background-color', 'white')\n }", "blackout(){\n if (this.counter === 2 || this.counter ===12 || this.counter === 16 || this.counter === 18 || this.counter >= 20 && this.counter <=34|| this.counter >= 35\n && this.counter <=37 && keyIsDown(UP_ARROW)){\n\n push();\n fill(0);\n rect(0,0,1500,700);\n fill(255);\n textSize(50);\n textAlign(CENTER, CENTER);\n text(`BLACK OUT`, width / 2, height / 2);\n pop();\n this.fill= {\n r : 200,\n g : 1,\n b : 6,\n }\n }\n else {\n this.fill= {\n r : 0,\n g : 0,\n b : 0,\n }\n }\n }", "function showBlack(){\n\tdocument.getElementById(\"flipper\").className = \"showBlack\";\n}", "function EnableDarknessTag() {}", "function checkOffscreenBlue() {\n if (isOffscreen(circle1)) {\n state = `ignored`;\n }\n }", "function swap(colour){\n if (colour == \"white\"){\n return (\"black\")\n } else {\n return (\"white\")\n }\n}", "function toggleWhiteboard()\n {\n if ( boardMode )\n {\n closeWhiteboard();\n }\n else\n {\n showWhiteboard();\n }\n updateGUI();\n }", "function showWhiteboard()\n {\n activeStroke = null;\n mode = 1;\n boardMode = true;\n\n // set container to board mode\n container.style.pointerEvents = \"auto\";\n container.style.overflowX = \"hidden\";\n container.style.overflowY = \"scroll\";\n\n // show board, adjust height, re-draw scribbles\n drawingCanvas[1].canvas.style.visibility = \"visible\";\n adjustWhiteboardHeight();\n playbackEvents(1);\n }", "function rainbow(my) {\n entities.forEach(function(element) {\n if (element.rainbow) {\n (element.color >= 17) ? element.color = 0 : element.color++\n //(element.children.color >= 17) ? element.children.color = 0 : element.children.color++\n } \n element.rainbowTime -= 1\n if (element.rainbowTime <= 0) {\n element.rainbow = false\n element.color = (room.gamemode === 'tdm') ? [10, 11, 12, 15, 13][(-element.team) - 1] : 12\n }\n }\n )}", "function toggle_blank(black) {\n\n\tvar other = ie ? document.all[\"other\"] : document.getElementById(\"other\");\n\tvar color = black ? \"black\" : \"white\";\n\tother.style.backgroundColor = (other.style.backgroundColor == color) ? \"transparent\" : color;\n}", "blink(text) {\n if ((text.alpha === 1)) {\n if (this.tick === 45) {\n text.setAlpha(0);\n this.tick = 0;\n }\n }\n else {\n if (this.tick === 30) {\n text.setAlpha(1);\n this.tick = 0;\n }\n }\n }", "function carouselSwitchColorDark(element){\r\n element.style.color = 'black';\r\n element.style.transition = 'all 0.6s';\r\n element.style.textShadow = '';\r\n}", "function state2glow(b,state,det){\n\tb.removeClass(\"glow_red\");\n\tb.removeClass(\"glow_purple\");\n\tb.removeClass(\"glow_green\");\n\tb.removeClass(\"glow_yellow\");\n\n\n\tif(state==-1){ //disconnected\n\t\tb.addClass(\"glow_purple\");\n\t} else if(state>=1 && det>0){\n\t\tb.addClass(\"glow_red\");\n\t} else if(state>=1 && det==0){\n\t\tb.addClass(\"glow_yellow\");\n\t} else {\n\t\tb.addClass(\"glow_green\");\n\t};\n}", "function switchGreen(){\n\t\t$(\"h2\").css(\"switch\", \"green\");\n\t\n\t}", "function switchwater() {\n clearTimeout(timeout);\n if (this.value === \"on\") {\n showpies()\n d3.select(\".waterswitchlabel\").text(\"hide\");\n }else if(this.value === \"off\"){\n hidepies()\n d3.select(\".waterswitchlabel\").text(\"show\");\n }\n }", "function fadeToBlack() {\n var ctx = hangmanGame.canvas.getContext(\"2d\");\n\n if (hangmanGame.frameCount % 2 === 0) {\n if (blackOpac < 1) {\n blackOpac = round(blackOpac + 0.025, 1000);\n }\n }\n\n if (blackOpac > 1) {\n blackOpac = 1;\n }\n\n ctx.globalAlpha = blackOpac;\n ctx.fillStyle = \"#000000\";\n ctx.fillRect(0, 0, hangmanGame.canvas.width, hangmanGame.canvas.height);\n ctx.fillStyle = fontColor;\n ctx.globalAlpha = 1;\n}", "function switchGray() {\n\t// document.body.innerHTML = \"changes text\";\n\t// alert(\"Barry\");\n document.body.style.backgroundColor = 'gray';\n document.body.style.color = 'white';\n}", "function resetNeutralColors() {\n\t\t$('#virtual-blink').css('background-color', \"#eee\");\n\t\t$('#color-zoom').css({'top': '-190px', 'left': '61px', 'background-color' : '#eee'});\t\t\n\t\t$('.color-swatch').removeClass('.light-off').css('background-image', 'none');\n\t\t$('#color-display #rgb input').val('255');\t\n\t}", "blink() {\n let xEyes = 20;\n let yEyes = 50;\n let sEyes = 1.0;\n\n if (this.sleep === true) {\n fill(255, 255, 255);\n\n rect(\n this.x + 125 * sEyes,\n this.y + 130 * sEyes,\n xEyes * sEyes,\n yEyes * sEyes\n );\n rect(\n this.x + 55 * sEyes,\n this.y + 130 * sEyes,\n xEyes * sEyes,\n yEyes * sEyes\n );\n }\n }", "function cambiacolor(el){\n if(el.style.color !== 'blue')\n el.style.color = 'blue'\n \n else if (el.style.color === 'blue')\n el.style.color = 'red'\n \n else if (el.style.color === 'red')\n el.style.color = '#000'\n}", "function changeColor()\n\t\t{\n\n\t\t(this.style.backgroundColor == \"black\") ? this.style.backgroundColor = \"white\" : this.style.backgroundColor = \"black\";\n\t\t\t\n\t\t}", "function gray()\n{\n val = \"GRAY\";\n draw();\n}", "function advanceTurn(){\n if (turn == \"white\"){\n turn = \"black\"\n } else if (turn == \"black\"){\n turn = \"white\"\n }\n}", "function creepyHut(){\n\tcurrentBG = hut;\n\tbackground(hut);\n}", "function orangeGreenSwitch() {\n const container = document.querySelector(\".spinner__background\");\n if (isOrange == true) {\n container.classList.add(\"bg--green\");\n turnRight.classList.add(\"btn--green\");\n turnLeft.classList.add(\"btn--green\");\n price.style.color = \"#54bf29\";\n orderButton.classList.add(\"btn--green\");\n isOrange = false;\n } else {\n container.classList.remove(\"bg--green\");\n turnRight.classList.remove(\"btn--green\");\n turnLeft.classList.remove(\"btn--green\");\n price.style.color = \"#ff922c\";\n orderButton.classList.remove(\"btn--green\");\n isOrange = true;\n }\n\n}", "function makeNight(){\n bgColor = \"#191970\";\n grassColor= \"#006400\";\n}", "function darkOn() {\n cloudObject.div.classList.add('dark');\n cloudObject.body.classList.add('dark');\n cloudObject.form.classList.add('dark');\n }", "static light() {\n window.localStorage.setItem('colorScheme', 'light')\n this.#isDark = false;\n this.#applyScheme();\n }", "greyOut(list) {\r\n list.forEach((item) => {\r\n if (\r\n String(item.color.rgb()) ===\r\n String(chroma(item.div.style.backgroundColor).rgb())\r\n ) {\r\n item.div.style.backgroundColor = chroma(\r\n item.div.style.backgroundColor\r\n ).darken(2);\r\n }\r\n });\r\n }", "function rainingTrue() {\n //background(160,209,230);\n rainingNow = true;\n setTimeout(function() {\n rainingNow = false;\n }, 5000);\n //Change to blue sky\n}", "function rainbowColor() {\n updatePenMode(\"random\");\n}", "function snowBackBuffer() {\n if (backBuffer != null) {\n var width = backBuffer.getWidth();\n var height = backBuffer.getHeight();\n for (var iY = 0; iY < height; iY++) {\n for (var iX = 0; iX < width; iX++) {\n var randomValue = Math.min(Math.floor(Math.random() * 255.0));\n\n backBuffer.setRGB(iX, iY, PALETTE_GRAY_STANDARD[randomValue]);\n }\n }\n }\n }", "function carouselSwitchColorLight(element){\r\n element.style.color = 'white';\r\n // Color transition effect\r\n element.style.transition = 'all 0.6s';\r\n /* 1 pixel black shadow to left, top, right and bottom */\r\n element.style.textShadow = '-0.7px 0 black, 0 0.7px black, 0.7px 0 black, 0 -0.7px black';\r\n}", "function colorizeBlack(el){\n let shade=el.style.backgroundColor;\n if(shade==''){\n el.style.backgroundColor=\"rgba(0,0,0,0.1)\"; \n }\n else{\n\n if(shade.substr(3,1) == 'a' && shade.substr(14,1) != '1'){\n let alpha = parseFloat(\"0.\"+shade.substr(16,1))\n alpha = alpha + 0.1;\n shade = shade.substr(0,13)+alpha+\")\";\n }\n else{\n el.style.backgroundColor=\"rgba(0,0,0,1)\";\n }\n el.style.backgroundColor=shade;\n }\n}", "function changeBackgroundColor(state) {\n switch (state) {\n case \"winner\":\n background_winner.style.visibility = \"visible\";\n background_loser.style.visibility = \"hidden\";\n\n counter.style.fill = \"#000000\";\n auto_screen_off_settings.style.fill = \"#000000\";\n break;\n case \"loser\":\n background_winner.style.visibility = \"hidden\";\n background_loser.style.visibility = \"visible\";\n\n counter.style.fill = \"#ffffff\";\n auto_screen_off_settings.style.fill = \"#ffffff\";\n break;\n default:\n background_winner.style.visibility = \"hidden\";\n background_loser.style.visibility = \"hidden\";\n\n counter.style.fill = \"#ffffff\";\n auto_screen_off_settings.style.fill = \"#ffffff\";\n break;\n }\n}", "function setMonocolor() {\n let button = document.getElementById(\"colorToggle\");\n let colorElement = document.getElementById(\"lowerColorSettings\");\n\n monoColor = monoColor ? false : true;\n\n if (monoColor) {\n colorElement.style.display = \"none\";\n button.value = \"Kaksiv\\u00E4rinen\";\n }\n else {\n colorElement.style.display = \"block\";\n button.value = \"Yksiv\\u00E4rinen\";\n }\n}", "function chcolor(){if(v_chcolor == 1){ document.getElementById(\"sgb\").style.color=color[x];(x < color.length-1) ? x++ : x = 0;}}", "function toggle() {\n if (rubrik.style.color == \"red\") {\n rubrik.style.color = \"green\"\n }\n else \n rubrik.style.color = \"red\"\n}", "function switchtoBrush()\r\n{\r\n isEraser=false;\r\n activeElement.textContent=\"BRUSH\";\r\n brush.style.color=\"white\";\r\n brush.style.backgroundColor=\"black\";\r\n currentColor=`#${brushColor.value}`;\r\n currentSize=10;\r\n brushSize.innerText=currentSize;\r\n brushSizeRanger.value=currentSize;\r\n}", "function handleBlackAndWhiteConversionUI() {\n\tvar slider = document.getElementById(\"BlackAndWhiteThresholdSlider\");\n\tvar num_input = document.getElementById(\"BlackAndWhiteThresholdValue\");\n\t\n\tif (document.getElementById(\"BlackAndWhiteThresholdMethod\").value === \"automatic\") {\n\t\tslider.style.visibility = \"hidden\"; \n\t\tnum_input.style.visibility = \"hidden\"; \n\t}\n\telse {\n\t\tslider.style.visibility = \"visible\";\n\t\tnum_input.style.visibility = \"visible\";\n\t}\n}", "function changeColor(e){\n if (colorScheme == \"BLACK\"){\n e.target.style.backgroundColor = \"BLACK\";\n e.target.style.opacity = 1;\n } else if (colorScheme == \"RAINBOW\"){\n e.target.style.backgroundColor = \"#\" + Math.floor(Math.random() * 4096).toString(16);\n e.target.style.opacity = 1;\n } else if (colorScheme == \"DARKEN\"){\n let darken = Number(e.target.style.opacity);\n e.target.style.opacity = darken += 0.1;\n e.target.style.backgroundColor = '#000';\n }\n}", "function isBlack(hsl) {\n flag = 'false';\n if (getLightness(hsl) <= 5) {\n debug(\"Value is black\"); // test\n return true;\n }\n return false;\n}", "function use_plyr_bg_color() {\n ctx.strokeStyle = BLACK;\n ctx.fillStyle = BLACK;\n if (sessionStorage.getItem(\"page\") === BLACK) {\n ctx.strokeStyle = WHITE;\n ctx.fillStyle = WHITE;\n }\n }", "function RainbowProfile() {\r\n}", "function draw(v,c,bc,w,h) {\n if(v.paused || v.ended) return false;\n // First, draw it into the backing canvas\n\t bc.drawImage(v, 0, 0, w, h);\n\t\tvar idata = document.getElementsByClassName(\"slide1\");\n var idata = bc.getImageData(0, 0, w, h);\n var data = idata.data.length / 4;\n\n for (var i = 0; i < data; i++) {\n\t\t\tif (activatedYellow){\n\t\t\t\tvar r = idata.data[i * 4 + 1];\n\t\t\t\tvar g = idata.data[i * 4 + 0];\n\t\t\t\tvar b = idata.data[i * 4 + 2];\n\t\t\t\tif (g > 100 && r > 100 && b > 100){\n\t\t\t\t\tidata.data[i * 4 + 3] = 0;\n\t\t\t\t}\n\t\t\t} else if (activatedBlue) {\n\t\t\t\tif( i%4 != 3 ){\n\t\t\t\t\tidata.data[i * 4] = 127 + 2*data[i] - data[i * 4 + 4] - data[i * 4 + w*4];\n\t\t\t\t}\n\t\t\t} else if (activatedGreen) {\n var r = idata.data[i * 4 + 0];\n\t\t\t\tvar g = idata.data[i * 4 + 1];\n\t\t\t\tvar b = idata.data[i * 4 + 2];\n\t\t\t\tvar brightness = (3*r+4*g+b)>>>3;\n idata.data[i * 4] = brightness;\n idata.data[i * 4 + 1] = brightness;\n idata.data[i * 4 + 2] = brightness;\n \t}\n\t\t}\n c.putImageData(idata, 0, 0);\n\n setTimeout(function(){draw(v,c,bc,w,h);}, 0);\n}", "function shadeSwitch(shade) {\n if (shade == \"Light\") {\n return 'light';\n }\n else if (shade == \"Fair\") {\n return 'fair';\n }\n else if (shade == \"Heavy\") {\n return 'heavy'\n }\n return 'unlabeled';\n}", "function changeToBlack() {\n\n\tquoteBox.style.backgroundColor = 'blue';\n\tquoteParagraph.style.color = '#f6dbc4';\n\tquoteBox.style.borderColor = '#808080';\n\t\n\n}", "function drawRainbow(e) {\n let R;\n let G;\n let B;\n let rgbExtract = extractRGB(e);\n if (e.target.style.backgroundColor === \"\") {\n e.target.style.backgroundColor = `rgb(${Math.round(Math.random()*255)},${Math.round(Math.random()*255)},${Math.round(Math.random()*255)})`;\n } else {\n //darkens divs that have already have color\n R = rgbExtract[0];\n G = rgbExtract[1];\n B = rgbExtract[2];\n e.target.style.backgroundColor = `rgb(${R*.7},${G*.7},${B*.7})`\n }\n \n}", "function toggle_bg()\n{\n var preview = $(\"#preview\");\n var bg_switch = $(\"#switch-toggle-bg\");\n\n if (preview.hasClass(\"preview-light\"))\n {\n preview\n .removeClass(\"preview-light\")\n .addClass(\"preview-dark\");\n\n bg_switch\n .removeClass(\"switch-toggle-bg-light\")\n .addClass(\"switch-toggle-bg-dark\");\n }\n else\n {\n preview\n .removeClass(\"preview-dark\")\n .addClass(\"preview-light\");\n\n bg_switch\n .removeClass(\"switch-toggle-bg-dark\")\n .addClass(\"switch-toggle-bg-light\");\n }\n\n match_spectrums();\n}", "function drawBias() {\n\tctx.fillStyle = \"white\";\n\tctx.font = \"14px Monospace\";\n\tctx.fillText(\"BIASES\", 30, 180);\n\t\n\tif (network == null) return;\n\t\n\tlet biases = network.bias.matrix[0];\n\tfor (let i=0; i<biases.length; i++) {\n\t\tlet hue;\n\t\t// determine hue; red = negative value, blue = positive value\n\t\tif (biases[i] < 0) {\n\t\t\thue = 0;\n\t\t} else {\n\t\t\thue = 200;\n\t\t}\n\t\t// determine lightness; lighter = larger absolute value\n\t\tlet lightness = Math.abs(biases[i])*95 + 5;\n\t\tctx.fillStyle = \"hsl(\"+hue+\",100%,\"+lightness+\"%)\";\n\t\t\n\t\tctx.fillRect(30 + 5*i, 190, 4, 4);\n\t}\n}", "function setSwitchColor(name, color) {\n if (canvasObjects[name].attrs.fill != color) {\n canvasObjects[name].attr({\"fill\": color})\n }\n }", "function switchToColor() {\n if (colorLine != true) {\n colorBtn.innerHTML = 'Turn Off Colored Line';\n colorLine = true;\n blackLine = false;\n } else {\n colorBtn.innerHTML = 'Turn On Colored Line';\n colorLine = false;\n blackLine = true;\n }\n}", "function mudarCorBotaoLike(flag) {\n if (flag) document.getElementById(\"likeBt\").style = \"filter: invert(32%) sepia(95%) saturate(1073%) hue-rotate(103deg) brightness(95%) contrast(105%);\"\n else document.getElementById(\"likeBt\").style = \"\"\n}", "function tickBlack() {\n\tblackInt = setInterval(function(){\n\t\toneSecond();\n\t}, 1000)\t\n}", "brighten(amount = 10) {\n const rgb = this.toRgb();\n rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));\n rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));\n rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));\n return new TinyColor(rgb);\n }", "function blink() {\n light.toggle();\n }", "function switchPlayer(){\n if(playerRed==true)\n {\n playerRed=false;\n playerYellow=true;\n }\n else\n {\n playerRed=true;\n playerYellow=false;\n }\n}", "function setColorCap(model) {\n\n switch (model) {\n\n case 1:\n $(\"#col-gold\").hide();\n $(\"#cap-128\").hide();\n $(\"#cap-32\").show();\n break;\n\n case 2:\n $(\"#col-gold\").show();\n $(\"#cap-128\").hide();\n break;\n\n case 3:\n $(\"#col-gold\").show();\n $(\"#cap-32\").hide();\n $(\"#cap-128\").show();\n break;\n\n case 4:\n $(\"#cap-32\").hide();\n $(\"#cap-128\").show();\n break;\n\n default:\n break;\n\n }\n\n return;\n }", "function updateChoseOfColor(){\r\n if ( isCar && !isTruck && !isTw )\r\n currentColor = cCar;\r\n else if ( !isCar && isTruck && !isTw )\r\n currentColor = cTruck;\r\n else if ( !isCar && !isTruck && isTw )\r\n currentColor = cTw;\r\n else if ( isCar && isTruck && !isTw )\r\n currentColor = cTruckCar;\r\n else if ( !isCar && isTruck && isTw )\r\n currentColor = cTruckTw;\r\n else if ( isCar && !isTruck && isTw )\r\n currentColor = cCarTw;\r\n else if ( isCar && isTruck && isTw )\r\n currentColor = cAll;\r\n else\r\n currentColor = cTruck;\r\n\r\n }", "static toggle() {\n if (this.isLight()) {\n this.dark()\n } else {\n this.light()\n }\n }", "stateCheck()\n {\n if(this.state == 5) this.color = \"green\";\n if(this.state == 4) this.color = \"rgb(82, 204, 82)\";\n if(this.state == 3) this.color = \"rgb(177, 252, 164)\";\n if(this.state == 2) this.color = \"rgb(112, 224, 112)\";\n if(this.state == 1) this.color = \"rgb(204, 227, 166)\";\n if(this.state == 0) this.color = \"rgb(163, 155, 118)\";\n }", "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 brightCanvas( image ) {\n \tvar alpha, dirLuminance;\n \tvar ratio = 0.95; // set to 0.95\n \tif (ratio < 0.0) {\n \talpha = 1 + ratio;\n \tdirLuminance = 0; // blend with black\n \t} else {\n \talpha = 1 - ratio;\n \tdirLuminance = 1; // blend with white\n \t}\n\n \tfor (var x = 0; x < image.width; x++) {\n \tfor (var y = 0; y < image.height; y++) {\n \tvar pixel = getPixel(image, x, y);\n\n \tpixel[0] = (alpha * pixel[0]/255. + (1-alpha) * dirLuminance)*255;\n \tpixel[1] = (alpha * pixel[1]/255. + (1-alpha) * dirLuminance)*255;\n \tpixel[2] = (alpha * pixel[2]/255. + (1-alpha) * dirLuminance)*255;\n\n \tsetPixel(image, pixel, x, y);\n \t}\n \t}\n\n \treturn image;\n}", "function toggleBgnd(elem) {\n\t$(elem).css(\"background-color\", function() {\n\t\tthis.switch = !this.switch\n\treturn this.switch ? \"red\" : \"white\"})\n}", "resetTurn() {\n\t\tthis.turn = 'W';\n\t\tthis.turnStatus.text('White:');\n\t}", "function shouldUseWhiteFont(element) {\n // element.style.backgroundColor returns a string in rgb format then r,g,b are extracted\n const [r, g, b] = extractRGBfromString(element)\n const isWhite = (r * 0.299 + g * 0.587 + b * 0.114) < 186\n isWhite ? element.style.color = \"white\" : element.style.color = \"#333333\"\n}", "constructor(white, red, green, blue) {\n this.white = white;\n this.red = red;\n this.green = green;\n this.blue = blue;\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}", "lighten() {\n this.pweighted = false;\n this.psquare.classList.remove('square--weighted');\n }", "function changeColor(){\n\tif(colorRGB === 0xFFFFFF){ //white\n\t\tcolorRGB = 0xC0C0C0; //ltgrey\n\t\tcolorSel.classList.toggle(\"whiteRGB\");\n\t\tcolorSel.classList.toggle(\"greyRGB\");\n\n\t} else if (colorRGB === 0xC0C0C0){ //ltgrey\n\t\tcolorRGB = 0xFFC0CB; //pink\n\t\tcolorSel.classList.toggle(\"greyRGB\");\n\t\tcolorSel.classList.toggle(\"pinkRGB\");\n\n\n\t} else if (colorRGB === 0xFFC0CB){ //pink\n\t\tcolorRGB = 0xFFFFFF; //white\n\t\tcolorSel.classList.toggle(\"whiteRGB\");\n\t\tcolorSel.classList.toggle(\"pinkRGB\");\n\t}\n\t// colorSel.classList.add(\"pinkRGB\");\n\t// classList.remove\n\t\n}", "get color() { return this.active ? Climber.ACTIVE_COLOR : Climber.INACTIVE_COLOR; }", "setBeakerColor()\n {\n if(this.gameDifficulty === 3)\n {\n let color = this.determineDifficulty2_Color();\n\n }\n else if (this.gameDifficulty === 2)\n {\n\n let color = this.determineDifficulty2_Color();\n }\n else\n {\n\n let color = this.determineDifficulty1_Color();\n\n }\n }", "function black(){\n $(this).css('background-color','black')\n }", "Blend() {}", "function bleh() {}", "function setColor() {\n roll.style.backgroundColor = roll.style.backgroundColor == \"green\" ? \"blue\" : \"green\";\n }", "function SwitchColor(pnt){\r\n\tvar value = pnt.value;\r\n\t\r\n\tif (value == \"Undecided\"){\r\n\t\tpnt.style.backgroundColor = \"#FFFFFF\";\r\n\t\tpnt.style.color = \"#000000\";\r\n\t} else {\r\n\t\tpnt.style.backgroundColor = \"#000000\";\r\n\t\tpnt.style.color = \"#FFFFFF\";\r\n\t}\r\n\t\r\n}", "function notSoRandom(b, w) {\n //coding and coding..\n return Math.round(Math.random()) ? 'Black' : 'White';\n\n }" ]
[ "0.67784274", "0.6456392", "0.63991755", "0.6378684", "0.6342049", "0.63056463", "0.6260995", "0.62543297", "0.62380594", "0.61388177", "0.6083121", "0.6074812", "0.60726655", "0.6071022", "0.6057327", "0.60376686", "0.60343444", "0.60210884", "0.6001545", "0.5993665", "0.5991858", "0.59812564", "0.59603095", "0.5951082", "0.5942448", "0.59405375", "0.59185284", "0.59040344", "0.59020144", "0.5901869", "0.5886405", "0.5883763", "0.5865639", "0.58615535", "0.58603555", "0.58544844", "0.58442795", "0.58439463", "0.58238375", "0.58226264", "0.58223957", "0.5816281", "0.5815578", "0.58083403", "0.5807858", "0.58017385", "0.5796063", "0.57950205", "0.57904124", "0.57893705", "0.5772504", "0.5772188", "0.5746172", "0.5745339", "0.57333964", "0.5719674", "0.5713405", "0.5710399", "0.5709133", "0.5708733", "0.5708451", "0.57081664", "0.57050323", "0.5702434", "0.57014555", "0.5696536", "0.56946063", "0.5693444", "0.5692565", "0.5691664", "0.5690916", "0.56860673", "0.5685956", "0.56855285", "0.56746227", "0.56735045", "0.56707233", "0.5668761", "0.56653047", "0.56632763", "0.5659751", "0.5659121", "0.56532675", "0.5650573", "0.56432396", "0.56429344", "0.5640432", "0.56394786", "0.56341535", "0.5633236", "0.5631949", "0.5631502", "0.562285", "0.5616738", "0.56138813", "0.56137985", "0.5611938", "0.56105125", "0.56074554", "0.5605485", "0.5604176" ]
0.0
-1
switches color between white and colour.
function mousePressed() { let xcoord = floor(mouseX / cellSize); let ycoord = floor(mouseY / cellSize); if (grid[xcoord][ycoord]) { grid[xcoord][ycoord]=0; } else { grid[xcoord][ycoord] = 1; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function switchColor(){\n\tif (currentColor === \"red\"){\n\t\tcurrentColor = \"black\";\n\t}\telse {\n\t\t\tcurrentColor = \"red\";\n\t\t}\n}", "function changeColor()\n\t\t{\n\n\t\t(this.style.backgroundColor == \"black\") ? this.style.backgroundColor = \"white\" : this.style.backgroundColor = \"black\";\n\t\t\t\n\t\t}", "function changeColor(){\n\tif(colorRGB === 0xFFFFFF){ //white\n\t\tcolorRGB = 0xC0C0C0; //ltgrey\n\t\tcolorSel.classList.toggle(\"whiteRGB\");\n\t\tcolorSel.classList.toggle(\"greyRGB\");\n\n\t} else if (colorRGB === 0xC0C0C0){ //ltgrey\n\t\tcolorRGB = 0xFFC0CB; //pink\n\t\tcolorSel.classList.toggle(\"greyRGB\");\n\t\tcolorSel.classList.toggle(\"pinkRGB\");\n\n\n\t} else if (colorRGB === 0xFFC0CB){ //pink\n\t\tcolorRGB = 0xFFFFFF; //white\n\t\tcolorSel.classList.toggle(\"whiteRGB\");\n\t\tcolorSel.classList.toggle(\"pinkRGB\");\n\t}\n\t// colorSel.classList.add(\"pinkRGB\");\n\t// classList.remove\n\t\n}", "function changeWhite() {\n $(this).css('background-color', 'white')\n }", "function setSwitchColor(name, color) {\n if (canvasObjects[name].attrs.fill != color) {\n canvasObjects[name].attr({\"fill\": color})\n }\n }", "function swapColor(color) {\n\treturn (color === COLOR.BLACK) ? COLOR.WHITE : COLOR.BLACK;\n}", "set color(value) {}", "function setColor() {\n roll.style.backgroundColor = roll.style.backgroundColor == \"green\" ? \"blue\" : \"green\";\n }", "function changeColor(e){\n if (colorScheme == \"BLACK\"){\n e.target.style.backgroundColor = \"BLACK\";\n e.target.style.opacity = 1;\n } else if (colorScheme == \"RAINBOW\"){\n e.target.style.backgroundColor = \"#\" + Math.floor(Math.random() * 4096).toString(16);\n e.target.style.opacity = 1;\n } else if (colorScheme == \"DARKEN\"){\n let darken = Number(e.target.style.opacity);\n e.target.style.opacity = darken += 0.1;\n e.target.style.backgroundColor = '#000';\n }\n}", "function 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}", "function switchPink(){\n\t\t$(\"body\").css(\"background\", \"pink\");\n\t\t$(\"body\").css(\"color\", \"white\");\n\t}", "function toggleColor(element) {\n if (element.style.color === \"green\") {\n element.style.color = \"black\"\n } else {\n element.style.color = \"green\"\n }\n}", "set dryColor(value) {}", "function setcolour() {\n if ( Number.isNaN(outputColourValue) ) {\n setINITIALcolour();\n } else {\n if (outputColourValue > 360 && outputColourValue < 368) {\n neonlightcolor = '#fff';\n } else {\n neonlightcolor = 'hsl(' + outputColourValue + ', 100%, 50%)';\n }\n }\n root.style.setProperty(\"--neonlightcolor\", neonlightcolor);\n}", "function turnOnGrayStyle(){\n if(currentColorSetting != \"GrayStyle\")\n {\n removeCurrentColorSetting();\n toggleGraystyle();\n currentColorSetting = \"GrayStyle\";\n toggleAriaButtonPress('#color-scheme-b-o-w');\n }\n}", "function flipColor(color) {\n return color === Color.BLACK ? Color.WHITE : Color.BLACK;\n}", "function changeColorScheme() {\n\n}", "function cambiarColor(){\n\tif( boton.style.background == \"yellow\"){\n\t\tboton.style.background = \"orange\";\n\t}else{\n\t\tboton.style.background = \"yellow\";\n\t}\t\n}", "function cambiacolor(el){\n if(el.style.color !== 'blue')\n el.style.color = 'blue'\n \n else if (el.style.color === 'blue')\n el.style.color = 'red'\n \n else if (el.style.color === 'red')\n el.style.color = '#000'\n}", "function changeColor() {\n\n\t// Define variables.\n\tvar classes = this.class(),\n\t\tswatches = select('#swatches');\n\t\n\t// Toggle active class.\n\tif (classes.indexOf('active') >= 0) {\n\t\tthis.removeClass('active');\t\n\t} else {\n\t\tthis.addClass('active');\n\t}\n\t\n\t// Toggle swatches panel.\n\tif (board.swatchOpen) {\n\t\tswatches.hide();\n\t} else {\n\t\tswatches.show();\n\t}\n\tboard.swatchOpen = !board.swatchOpen;\t\n\t\n\t// Prevent default functionality.\n\treturn false;\t\n\t\n}", "function toggle() {\n if (rubrik.style.color == \"red\") {\n rubrik.style.color = \"green\"\n }\n else \n rubrik.style.color = \"red\"\n}", "function penColor(color) {\n $._setColor(color);\n}", "function colorChanger(color){\n\n mouse.color = color;\n hold.style.background = color;\n\n\n\n\n}", "function ChangeColor(n){\n noteBackground = n;\n let button = document.getElementById(\"add\");\n if(n==='white' || n===\"yellow\"){\n button.style.background=n;\n button.style.color='black'\n }\n else{\n button.style.background=n;\n button.style.color='white'\n }\n \n }", "set healthyColor(value) {}", "function square_change_colour(){\n\tif(settings.last_colour_square == 'black'){\n\t\tsettings.last_colour_square = 'white';\n\t} else {\n\t\tsettings.last_colour_square = 'black';\n\t}\n}", "function ChangeColor(){\n selected_object.material.color.setHex(shape_params.color);\n }", "function setColor(){\n\tcolor1.value = \"#FF0000\";\n\tcolor2.value = \"#ffff00\";\n}", "function carouselSwitchColorDark(element){\r\n element.style.color = 'black';\r\n element.style.transition = 'all 0.6s';\r\n element.style.textShadow = '';\r\n}", "function SwitchColor(pnt){\r\n\tvar value = pnt.value;\r\n\t\r\n\tif (value == \"Undecided\"){\r\n\t\tpnt.style.backgroundColor = \"#FFFFFF\";\r\n\t\tpnt.style.color = \"#000000\";\r\n\t} else {\r\n\t\tpnt.style.backgroundColor = \"#000000\";\r\n\t\tpnt.style.color = \"#FFFFFF\";\r\n\t}\r\n\t\r\n}", "function switchToColor() {\n if (colorLine != true) {\n colorBtn.innerHTML = 'Turn Off Colored Line';\n colorLine = true;\n blackLine = false;\n } else {\n colorBtn.innerHTML = 'Turn On Colored Line';\n colorLine = false;\n blackLine = true;\n }\n}", "_setColor(color) {\n this._context.fillStyle = this._context.strokeStyle =\n color ? color : Chart.DEFAULT_FORE_COLOR;\n }", "function setColor() {\n var r_hex = parseInt(r.value, 10).toString(16);\n var g_hex = parseInt(g.value, 10).toString(16);\n var b_hex = parseInt(b.value, 10).toString(16);\n\n\n //updates the sliders output colors\n r_out.style.backgroundColor=\"#\"+r_hex+\"0000\";\n r_out.value=r.value;\n g_out.style.backgroundColor=\"#00\"+g_hex+\"00\";\n g_out.value=g.value;\n b_out.style.backgroundColor=\"#0000\"+b_hex;\n b_out.value=b.value;\n\n hex = \"#\" + pad(r_hex) + pad(g_hex) + pad(b_hex);\n strokeOut.style.backgroundColor=hex;\n}", "function changeColor(e) {}", "set color(value) {\n this._state.color.set(value || [0.7, 0.7, 0.8]);\n this._renderer.imageDirty();\n }", "function alterColor(e) {\n const currentSquare = this;\n if (state === \"Color\") {\n currentSquare.style.backgroundColor = getColor();\n } else if (state === \"Erase\") {\n currentSquare.style.backgroundColor = defaultSquareColor;\n } else if (state === \"Random\") {\n setColor(getRandomColor());\n currentSquare.style.backgroundColor = getColor();\n }\n}", "change(colorDefault, colorTochange){\n\t\tif(this.color != colorDefault){\n\t\t\tthis.color = colorDefault\n\t\t}else{\n\t\t\tthis.color = colorTochange\n\t\t}\n\t}", "function carouselSwitchColorLight(element){\r\n element.style.color = 'white';\r\n // Color transition effect\r\n element.style.transition = 'all 0.6s';\r\n /* 1 pixel black shadow to left, top, right and bottom */\r\n element.style.textShadow = '-0.7px 0 black, 0 0.7px black, 0.7px 0 black, 0 -0.7px black';\r\n}", "function changeColor(c) {\n block.style.color = c;\n}", "function erase_color(_red, _green, _blue, _alpha){\n\tinit();\n\tcameraObj.erase_color = [_red, _green, _blue, _alpha];\n}", "function setColorSwatch (swatch, color) {\n\tvar trial_color = colorStringFromColorStruct(color);\n\tswatch.css(\"background-color\", trial_color);\n//\tswatch.css(\"opacity\", color.a);\t\n}", "function setINITIALcolour() {\n neonlightcolor = \"#222222\";\n root.style.setProperty(\"--neonlightcolor\", neonlightcolor);\n}", "updateColor() {\n this.color = this.player_side == PLAYER_1 ? \"#dfe6e9\" : \"#ffeaa7\";\n }", "function chcolor(){if(v_chcolor == 1){ document.getElementById(\"sgb\").style.color=color[x];(x < color.length-1) ? x++ : x = 0;}}", "setColor(c){\n\t\tthis.color=c;\n\t}", "apagaColor(color) {\n this.colores[color].classList.remove(\"light\");\n }", "changeColor() {\n //this.color = \n }", "function blackShading(e) {\n if (e.target.style.backgroundColor = 'white') {\n e.currentTarget.style.backgroundColor = 'black';\n }\n}", "function switchColor () {\n if (!gl) {\n gl = canvas.getContext(\"webgl\") || canvas.getContext(\"experimental-webgl\");\n if (!gl) {\n alert(\"Browser unsupported!\");\n return;\n }\n\n gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);\n\n}\n //get a random color\n var color = getRandomColor();\n\n gl.clearColor(color[0], color[1], color[2], 1.0);\n\n gl.clear(gl.COLOR_BUFFER_BIT);\n\n}", "function turnOnColorDefault(){\n if(currentColorSetting != \"Default\")\n {\n removeCurrentColorSetting();\n currentColorSetting = \"Default\";\n toggleAriaButtonPress('#color-scheme-default');\n }\n}", "illuminateColor(color){\r\n this.color[color].classList.add('light')\r\n setTimeout(()=>this.turnOffColor(color),350)\r\n}", "changeColor() {\n // wrap around, but should be 7?\n\t\tvar nxtColorIdx = this.current + 1 > 6 ? 0 : this.current + 1;\n var curColorIdx = this.current;\n // color transition, set old color invisible\n var esta = this;\n\t\tANIM.customAnimation.to(this.materials[curColorIdx], 5, {\n\t\t\topacity: 0,\n\t\t\tonComplete: function() {\n\t\t\t\testa.obj.children[curColorIdx].visible = false\n\t\t\t}\n\t\t});\n // set next color visible and gradually switch to new color\n this.obj.children[nxtColorIdx].visible = true\n ANIM.customAnimation.to(this.materials[nxtColorIdx], 4, {\n\t\t\topacity: 1\n\t\t});\n\n this.current = nxtColorIdx;\n }", "function hoverColor() {\n\tif (this.id !== board.currentColor) {\n\t\tif (this.id === 'blue') {\n\t\t\t$(this).css('background-color', active_blue)\n\t\t} else if (this.id === 'yellow') {\n\t\t\t$(this).css('background-color', active_yellow)\n\t\t} else if (this.id === 'green') {\n\t\t\t$(this).css('background-color', active_green)\n\t\t} else if (this.id === 'purple') {\n\t\t\t$(this).css('background-color', active_purple)\n\t\t} else if (this.id === 'red') {\n\t\t\t$(this).css('background-color', active_red)\n\t\t} else if (this.id === 'brown') {\n\t\t\t$(this).css('background-color', active_brown)\n\t\t}\n\t}\n}", "changeColor(color){\n this.circleBasic.set('fill', ColorLuminance(color, -0.1));\n this.circleBasicEtx.set('fill', ColorLuminance(color, 0.1));\n this.text.set({\n fill : ColorLuminance(color, -0.15),\n stroke : ColorLuminance(color, -0.20)\n });\n }", "function dark() {\n if (document.body.style.backgroundColor == 'rgb(255, 255, 255)') {\n\n document.body.style.backgroundColor = '#333';\n }\n else {\n document.body.style.backgroundColor = 'rgb(255, 255, 255)';\n }\n}", "function black(){\n $(this).css('background-color','black')\n }", "function changeColorFaded() {\n\n temp = 330;\n cont1 = 0;\n cont2 = 125;\n cont3 = 254;\n\n function cycler(cont) {\n if(cont >= 255) \n op = 'decr';\n else\n op = 'incr';\n\n switch(op) {\n case 'decr':\n cont--;\n break;\n case 'incr':\n cont++;\n break;\n }\n return cont;\n }\n\n var r = cycler(cont1);\n var g = cycler(cont2);\n var b = cycler(cont3);\n // Costruisco un colore RGB utilizzando i 3 numeri creati sopra \n \n colore_rgb = \"rgb(\" + r + \",\" + g + \", \" + b + \")\";\n \n // Applico il colore al tag span id->letterN\n letterN.style.color = colore_rgb;\n }", "function changeColor(object){\n \n object.colorBlack = object.colorBlink; \n \n setTimeout(() => {\n object.colorBlack = 'rgb(0,0,0)';\n }, 2000);\n}", "function activeColor(rgbIndex){\n cleanActives(rgb, off, on)\n\n if (rgbIndex < 3){\n rgb[rgbIndex] = on\n }\n}", "set colorValue(value) {}", "apagarColor(color) {\n this.colores[color].classList.remove('light');\n }", "darker(){\n\t\tthis.addColorValue(\"red\", -30);\n\t\tthis.addColorValue(\"green\", -30);\n\t\tthis.addColorValue(\"blue\", -30);\n\t}", "function swap(colour){\n if (colour == \"white\"){\n return (\"black\")\n } else {\n return (\"white\")\n }\n}", "function setColor(winner) {\n\tif (winner == 'x') {\n\t\treturn('green');\n\t}\n\telse if (winner == 'o') {\n\t\treturn('yellow');\n\t}\n}", "function colorForCurrent(){\n\n}", "turnOffColor(color){\r\n this.color[color].classList.remove('light')\r\n}", "function changeColor(){\n if(document.getElementById(\"intro\").style.color == \"blue\"){\n document.getElementById(\"intro\").style.color=\"black\";\n }\n else{\n document.getElementById(\"intro\").style.color=\"blue\";\n }\n}", "function colorChange (color) {\n\tfor (var i = 0; i < squares.length; i++) {\n\t\tsquares[i].style.backgroundColor = color;\n\t}\n}", "function colorAllClimbsWhite() {\n $(Climbsim.scene.children).each(function () {\n if (this instanceof THREE.Line) {\n this.material.color.set('white');\n }\n })\n}", "function fadeToWhite(element,red,green,blue) {\n \n if ($(element).fade) {\n clearTimeout($(element).fade);\n }\n $(element).css('background-color', \"rgb(\"+red+\",\"+green+\",\"+blue+\")\")\n if (red == 255 && green == 255 && blue == 255) {\n return;\n }\n var newred = red + Math.ceil((255 - red)/10);\n var newgreen = green + Math.ceil((255 - green)/10);\n var newblue = blue + Math.ceil((255 - blue)/10);\n var repeat = function() {\n fadeToWhite($(element), newred, newgreen, newblue)\n };\n $(element).fade = setTimeout(repeat,10);\n}", "function colourBlack(el){\n el.style.backgroundColor=\"black\";\n}", "invertColor(color){\r\n if(color === \"b\") return \"w\";\r\n if(color === \"w\") return \"b\";\r\n }", "function getColor(num){\n if (num>4) {\n return \"white\";\n } else {\n return \"#776e65\";\n }\n }", "function changeEveryColorToRed(colors) {\n}", "function newColor1()\n{\n\tIN.doFocus();\n\tIN.clr=\"#109FA6\";\n\trcCookie.set(\"c\",IN.clr,365);\n\tIN.ec(\"ForeColor\",false,IN.clr);\n\tIN.tBC();\n}", "set color(c){\n this.currentColor = this.findPalRGB(c);\n }", "_setCurrentColor ([r, g, b]) {\n\t\tthis.currentColor = [r, g, b];\n\t\tthis.shadowRoot.host.setAttribute(\"style\", `background: rgb(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)})`);\n\t}", "function MainColour(Id){\n\te = document.getElementById(Id);\n\t\te.style.color = \"white\";\n}", "function resetNeutralColors() {\n\t\t$('#virtual-blink').css('background-color', \"#eee\");\n\t\t$('#color-zoom').css({'top': '-190px', 'left': '61px', 'background-color' : '#eee'});\t\t\n\t\t$('.color-swatch').removeClass('.light-off').css('background-image', 'none');\n\t\t$('#color-display #rgb input').val('255');\t\n\t}", "function updateCurrentColor(jscolor) {\n board.changeColor(\"#\" + jscolor);\n}", "function changecolor(color) {\r\n document.body.style.background = color;\r\n }", "function turnRed() {\n //call the clear function\n\n//change the color of the element to Red\n}", "function changeScribbleColor(e){\n pureweb.getFramework().getState().setValue('ScribbleColor', document.getElementById('color').value);\n}", "function changeColor (color) {\n // -(7.1)- Loop through all squares \n for (let index = 0; index < squares.length; index++) {\n\n // -(7.2)- Change each color to match goal color\n squares[index].style.backgroundColor = color;\n }\n}", "function colorShift() {\n const red = document.querySelector('#red'); \n red.style.color = '#000000';\n setTimeout(() => {\n red.style.color = '#ff0000';\n }, 1000);\n}", "setColor(color) {\n if(color.indexOf(\"#\") >= 0) {\n this.colorHex = color;\n this.colorRGB = this.hexToRgb(this.colorHex);\n }\n else {\n this.colorRGB = color;\n this.colorHex = this.rgbToHex(this.colorRGB);\n }\n\n this.$colorInner.style.backgroundColor = this.colorHex;\n this.$colorInput.value = this.colorHex;\n }", "apagarColor(color) {\n this.colores[color].classList.remove(\"light\");\n }", "function changeColors(color){\n\tsquares.forEach(function(square){\n\t\tsquare.style.background = color;\n\t});\n}", "function colorIn(e) {\n this.style.backgroundColor = '';\n this.classList.remove('fine');\n this.classList.remove('erase');\n this.classList.add(\"change\");\n}", "function resetColors(){\r\n\t\r\n\tcolors = createSquares(mode);\r\n\r\n\t\r\n\tassignColors();\r\n\r\n\t// update message\r\n\tmessage.textContent = \"\";\r\n\r\n\t// change h1Header\r\n\th1Header.style.backgroundColor=\"rgb(60, 118, 174)\";\r\n\r\n\t// change text of new colors/ reset button\r\n\tresetBtn.textContent = \"New Colors\";\r\n}", "function setColor() {\n \t\t\t$(this).setPixels({\n\t \t\tx: 260, y: 30,\n\t \t\twidth: 60, height: 40,\n\t \t\t// loop through each pixel\n\t \t\teach: function(px) {\n\t \t\t\tpx.r = rgb_r;\n\t \t\t\tpx.g = rgb_g;\n\t \t\t\tpx.b = rgb_b;\n\t \t\t}\n \t\t\t});\n\t\t}", "static light() {\n window.localStorage.setItem('colorScheme', 'light')\n this.#isDark = false;\n this.#applyScheme();\n }", "function switchGray() {\n\t// document.body.innerHTML = \"changes text\";\n\t// alert(\"Barry\");\n document.body.style.backgroundColor = 'gray';\n document.body.style.color = 'white';\n}", "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 changeColors(color) {\n\t//loop through all squares\n\tfor(var i = 0; i < squares.length; i++) {\n\t\t//change each color to match given color\n\t\tsquares[i].style.backgroundColor = color;\n\t}\n}", "function resetColor(el) {\n el.css(\"transition\",\"\");\n el.css(\"transition\");\n el.css(\"background-color\",\"\");\n el.css(\"background-color\");\n}", "function switchBlue(){\n\t\t$(\"p\").css(\"switch\", \"blue\");\n\t}", "function makeNight(){\n bgColor = \"#191970\";\n grassColor= \"#006400\";\n}", "function colourChange() {\n if (aktuellerSpieler === playerOne) {\n return \"#78CDD7\"\n } else if (aktuellerSpieler === playerTwo) {\n return \"#F7CACD\"\n }\n}", "function changeColor() {\n\tvar newColor = generateColor();\n\tbody.style.background = newColor;\n\th5.textContent = \"New CSS Background Color: \" + newColor;\n\th4.textContent = \"One color background selected\";\n}", "setColor(color) {\n this.color = color;\n }" ]
[ "0.79110974", "0.74066544", "0.7144236", "0.70611745", "0.7046343", "0.70356035", "0.70246357", "0.6965847", "0.6799679", "0.6748969", "0.6686483", "0.6646951", "0.6639724", "0.6619145", "0.65978265", "0.6545358", "0.65380853", "0.65254825", "0.6519358", "0.6491892", "0.64717126", "0.646859", "0.6450062", "0.64492565", "0.6437189", "0.6433803", "0.642363", "0.64105767", "0.640999", "0.6396905", "0.6392672", "0.63769543", "0.637489", "0.6351761", "0.6343881", "0.633774", "0.63252795", "0.6321003", "0.6319949", "0.63176084", "0.63166606", "0.6307046", "0.6305507", "0.6292313", "0.62870836", "0.6282832", "0.627951", "0.6276573", "0.62753487", "0.6271635", "0.6266572", "0.62608486", "0.6258838", "0.62587404", "0.62353003", "0.6229084", "0.6227508", "0.62246895", "0.6222697", "0.62206453", "0.6220109", "0.6220078", "0.62143546", "0.62116176", "0.620754", "0.6201712", "0.6197031", "0.61894554", "0.61889154", "0.6178431", "0.6168095", "0.61537963", "0.61510324", "0.6144652", "0.6137487", "0.6132201", "0.61291355", "0.61084634", "0.61079705", "0.610777", "0.610697", "0.6101975", "0.6101758", "0.6101628", "0.6101579", "0.61006474", "0.6099574", "0.60954785", "0.60920626", "0.60797566", "0.6074161", "0.60668224", "0.6057744", "0.6055916", "0.6053397", "0.60504466", "0.60491455", "0.6049023", "0.6048747", "0.60478103", "0.6040548" ]
0.0
-1
ITERATION BUTTON ON CLICK HANDLER
function iteration_button_onclick(clicked_id) { location.href = "/view/iteration"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleButton() {}", "_buttonClickHandler() { }", "handleClick() {}", "buttonClick(ev) {\n\n\t\t// Get the button using the index\n\t\tvar btn = this.props.buttons[ev.currentTarget.dataset.index];\n\n\t\t// If there's a callback\n\t\tif(typeof btn.callback == 'function') {\n\t\t\tbtn.callback(btn);\n\t\t} else {\n\t\t\tthis.props.close();\n\t\t}\n\t}", "_nextButtonClickHandler() {\n const that = this;\n\n that.next();\n }", "on_button(evt)\n\t{\n\t\tlet i = parseInt(evt.currentTarget.getAttribute(\"data-slide-idx\"));\n\t\t(i == this.current) || this.show(i);\n\t}", "menuButtonClicked() {}", "clickHandler() {\n // Activate if not active\n if (this.active === false) {\n // Button view press effect\n this.changeToActive();\n // No click 'action' for input - text is removed in visualEffectOnActivation\n }\n }", "function onClick( event ) {\n for( var i = 0; i < _buttons.length; i++ ) {\n var button = _buttons[i];\n \n if( button.contains( event.layerX, event.layerY ) ) {\n actionPerformed( button.getActionCommand() );\n return;\n }\n }\n \n if( event.which == 1 ) {\n location.href = linkHref;\n }\n }", "buttonClicked() {\n alert(\"buttonclicked of button\");\n }", "function getButtonClicked(e) {\n if (e.target.nodeName === \"BUTTON\") {\n categoryName = e.target.getAttribute(\"id\");\n loadQuestionsRandom(categoryName);\n showSection(sectionQuestion);\n setTimeout(() => {\n $(\"#category\").text(categoryName);\n loadQuiz();\n }, 500);\n }\n }", "handleClick( event ){ }", "onClick() {\n }", "function clickBtn(ev){\r\n\r\n //Brightspace ref: week 6\r\n let clickedButton = ev.target;\r\n\r\n let btnsArray=[\r\n ctrlBtns[0],\r\n ctrlBtns[1],\r\n ctrlBtns[2],\r\n ];\r\n\r\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf\r\n let index = btnsArray.indexOf(clickedButton);\r\n p(index);\r\n\r\n // /MDN ref:https://developer.mozilla.org/en-US/docs/Web/API/Element\r\n p(clickedButton.id);\r\n //handle moving id-active to the currently clicked button\r\n //remove currently present id 'active'\r\n for(let i=0; i < ctrlBtns.length ; i++){\r\n if(ctrlBtns[i].id){\r\n //MDN ref:https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute\r\n ctrlBtns[i].removeAttribute('id')\r\n }\r\n }\r\n //assign id=\"active\" to currently clicked button\r\n clickedButton.id=\"active\";\r\n //Load corresponding data into the container div\r\n cntnr.innerHTML = `<h2>${pages[index].heading}</h2> \r\n <img src=\"${pages[index].img}\" alt=\"${pages[index].alt}\">\r\n <p>${pages[index].bodyText}</p>\r\n `;\r\n\r\n }", "function __clickhandler() {\n buttonfunc(elemnode); return false;\n }", "onClick() {\n // Verifica se existe a função para processar o click e a invoca\n if(this.handleClick) {\n this.handleClick(this);\n }\n }", "buttonHandler(){\n\t\tvar items = this.props.hey.questions.present;\n\t\tlet conditions = this.props.hey.conditions.present;\n\t\tlet counter = this.props.hey.counter.present;\n\t\tconst action = this.props.action;\n\t\tconst increment = this.props.increment;\n\t\tconst hide = this.props.hideState;\n\t\tsendButtonHandler(items,conditions,counter,action,increment,hide);\n\t}", "handleClickButtons(event){\n let label = event.target.label;\n if(label === 'Previous'){\n this.pageNo -=1;\n }else if(label === 'Next'){\n this.pageNo +=1;\n }\n this.preparePaginationList();\n }", "function clickBtnPager() {\n // remet à jour les données de state en demandant la page\n // identifiée dans l'attribut data-page\n // noter ici le 'this' QUI FAIT AUTOMATIQUEMENT REFERENCE\n // A L'ELEMENT AUQUEL ON ATTACHE CE HANDLER\n getQuizzes(this.dataset.page);\n }", "function buttonClicked(index) {\n var button = vm.buttons[index];\n if (vm.buttons.length > 1) {\n angular.forEach(vm.buttons, function (value) {\n value.selected = false;\n });\n button.selected = true;\n } else {\n button.selected = !button.selected;\n }\n if (button.onClickCallback) {\n button.onClickCallback(button.selected);\n }\n }", "clickHandler(e) {\n // Only activate if there is a buttonHandler\n if (this.buttonHandler !== false) {\n // Activate if not active\n if (this.active === false) {\n // Button view press effect\n this.changeToActive();\n // Click action\n this.clickAction();\n }\n }\n }", "function listenForClick() {\n loopThroughGrid();\n clickTurnBtn();\n }", "function increment() {\n console.log(\"The button was clicked\")\n}", "function addButtonEvent() {\n\t\t\tbtnList.begin.click(API.begin);\n\t\t\tbtnList.fastBackward.click(function () {API.backward(FAST_STEP_NUM); });\n\t\t\tbtnList.backward.click(function () {API.backward(1); });\n\t\t\tbtnList.forward.click(function () {API.forward(1); });\n\t\t\tbtnList.fastForward.click(function () {API.forward(FAST_STEP_NUM); });\n\t\t\tbtnList.end.click(API.end);\n\t\t\tbtnList.flag.click(API.flag);\n\t\t\tbtnList.auto.click(API.setAuto);\n\t\t}", "function buttonClicked () {\n let clickedButton = event.target;\n\n valueHTML();\n\n}", "clicked(index){\r\n this.indice = index;\r\n }", "function processButton(param) {\n\n switch (param.element) {\n case \"조회\":\n case \"실행\":\n {\n processRetrieve({});\n }\n break;\n case \"닫기\":\n {\n processClose({});\n }\n break;\n }\n\n }", "handleJDotterClick() {}", "function btnClick(i) {\n btns[i].addEventListener('click', () => {\n\n if(i === currentInclude) return\n else {\n\n //highlight the currently selected buttons\n gsap.to(btns[i], {\n duration: 0.1,\n color: '#FF4242', //red-500\n })\n gsap.to(btns[currentInclude], {\n duration: 0.1,\n color: '#313335' //gray-700\n })\n //now change the selectors on the side to show the right option as well\n gsap.to([selectors[0][currentInclude], selectors[1][currentInclude]], {\n duration: 0.1,\n opacity: 0\n })\n gsap.to([selectors[0][i], selectors[1][i]], {\n duration: 0.1,\n opacity: 1\n })\n\n\n\n //if we're moving down the list, swoop down. if up, swoop up\n //just do nothing if it's already selected\n if(i > currentInclude) {\n //first scroll the current image out\n gsap.to(includeArr[currentInclude], {\n duration: 0.5,\n y: '-50%',\n opacity: 0,\n ease: \"elastic.out(0.5, 0.75)\",\n })\n\n //now bring the new image and description in\n gsap.fromTo(includeArr[i], {\n y: '50%',\n opacity: 0,\n }, \n {\n duration: 0.5,\n y: '0%',\n opacity: 1,\n ease: \"elastic.out(0.5, 0.75)\"\n }\n )\n } else if (i < currentInclude) {\n //first scroll the SVG/descriptions to be shown\n gsap.to(includeArr[currentInclude], {\n duration: 0.5,\n y: '50%',\n opacity: 0,\n ease: \"elastic.out(0.5, 0.75)\",\n })\n gsap.fromTo(includeArr[i], {\n y: '-50%',\n opacity: 0,\n },\n {\n duration: 0.5,\n y: '0%',\n opacity: 1,\n ease: \"elastic.out(0.5, 0.75)\",\n }\n )\n }\n\n //now start playing the current animation\n //animations[i].play()\n\n\n //update the currently selected animation state\n updateInclude(i);\n }\n });\n\n \n //hover/mouseover event\n btns[i].addEventListener('mouseenter', () => {\n gsap.to(btns[i], {\n duration: 0.25,\n scale: 1.1,\n })\n })\n\n //hover/mouseleave event\n btns[i].addEventListener('mouseleave', () => {\n gsap.to(btns[i], {\n duration: 0.25,\n scale: 1\n })\n })\n }", "function pressed(num){\n\tif (num == 1) {\n\t\teensButton.style.background = \"green\";\n\t\toneensButton.style.background = \"grey\";\n\t\thuidig = true;\n\t\tsubmitButton.style.display = \"inline-block\"\n\t}\n\telse if (num == 2) {\n\t\teensButton.style.background = \"grey\";\n\t\toneensButton.style.background = \"green\";\n\t\thuidig = false;\n\t\tsubmitButton.style.display = \"inline-block\"\n\t}\n\telse {\n\t\teensButton.style.background = \"grey\";\n\t\toneensButton.style.background = \"grey\";\n\t\thuidig = null;\n\t\tsubmitButton.style.display = \"none\"\n\t}\n}", "function processButton(param) {\n switch (param.element) {\n case \"조회\":\n processRetrieve({});\n break;\n case \"닫기\":\n processClose({});\n break;\n case \"실행\":\n processRetrieve({});\n break;\n }\n }", "function processButton(param) {\n\n switch (param.element) {\n case \"조회\":\n {\n var args = {\n target: [{ id: \"frmOption\", focus: true }]\n };\n gw_com_module.objToggle(args);\n }\n break;\n case \"실행\":\n {\n processRetrieve({});\n }\n break;\n case \"닫기\":\n {\n processClose({});\n }\n break;\n }\n\n }", "click_extra() {\r\n }", "function choiceClick(counter) {\n $('#picture .slick-next').trigger('click');\n $('.img-overlay').find('.click-overlay').parent().next().find('.overlay').addClass('click-overlay');\n $('#picture-array .slick-next').trigger('click');\n $('.image_number').html(counter + 1 + ' of 46');\n}", "function handleButtons () {\n handleStartButton();\n handleSubmitButton();\n handleNextButton();\n handleShowAllQandA();\n handleRestartButton();\n }", "function onClickEvent() {\n 'use strict';\n var sender = this.id;\n\n switch (sender) {\n case \"btnCreateCourse\":\n onCreateCourse();\n break;\n case \"btnModifyCourse\":\n onModifyCourse();\n break;\n case \"btnDeleteCourse\":\n onDeleteCourse();\n break;\n case \"btnRefreshCourses\":\n onRefreshCourse();\n break;\n }\n }", "clicked(x, y) {}", "click() { }", "function setupButtons(){\n //speak(quiz[currentquestion]['question'])\n\t\t$('.choice').on('click', function(){\n\t\tsynth.cancel();\n is_on = 0;\n\t\tpicked = $(this).attr('data-index');\n\t\tspeak(quiz[currentquestion]['choices'][picked], LINGUA_RISPOSTA);\n\t\tshow_button();\n\t\t// risposte in francese\n\t\t$('.choice').removeAttr('style').off('mouseout mouseover');\n\t\t$(this).css({'font-weight':'900', 'border-color':'#51a351', 'color':'#51a351', 'background' : 'gold'});\n\t\tif(submt){\n\t\t\t\tsubmt=false;\n\t\t\t\t$('#submitbutton').css({'color':'#fff','cursor':'pointer'}).on('click', function(){\n\t\t\t\t$('.choice').off('click');\n\t\t\t\t$(this).off('click');\n\t\t\t\tprocessQuestion(picked);\n //\n\t\t\t\t});\n\t\t\t}\n\t\t})\n\t}", "function handleClick() {\n // retrieve the index of the button in the node list\n const index = [...buttons].findIndex(button => button === this);\n\n // color and rescale every button up to the selected one\n [...buttons].slice(rating, index + 1).forEach((button, i) => {\n // transition delay for the change in color and scale, on the button\n // animation delay inherited by the pseudo elements, to add a small detail\n // both based on the total number of stars\n const stars = (index + 1) - rating;\n button.style.transitionDelay = `${i * duration / stars}s`;\n button.style.animationDelay = `${i * duration / stars}s`;\n // class allowing to style the button and animate the pseudo elements\n button.classList.add('active');\n });\n\n // remove the class allowing the animation from every button after the selected one\n [...buttons].slice(index + 1, rating).forEach((button, i) => {\n // delay on the transition to have the buttons styled progressively and in the opposite order\n const stars = rating - (index + 1);\n button.style.transitionDelay = `${(stars - i - 1) * duration / stars}s`;\n button.classList.remove('active');\n });\n\n // update rating to refer to the new index\n rating = index + 1;\n}", "function commandButtonHandle(){\n\t\tswitch(this.id){\n\t\t\tcase \"commandbutton_1\":\n\t\t\t\tonDealCardsClicked();\n\t\t\t\tbreak;\n\t\t\tcase \"commandbutton_2\":\n\t\t\t\tonMaxBetClicked();\n\t\t\t\tbreak;\n\t\t\tcase \"commandbutton_3\":\n\t\t\t\tonAddFiveClicked();\n\t\t\t\tbreak;\n\t\t\tcase \"commandbutton_4\":\n\t\t\t\tonRemoveFiveClicked();\n\t\t\t\tbreak;\n\t\t}\n\t}", "_addClickFunctionality(button, option){\n\t\tvar config = this;\n\t\tbutton.click(function(){\n\t\t\tconfig.clicked_button = event.target;\n\t\t\tconfig._updatePrice(config.clicked_button)\n\t\t\tconfig._sortButtonColoring(config.clicked_button);\n\t\t\tconfig._updateMagento(config.clicked_button);\n\t\t\tconfig._eraseCategories(config.clicked_button);\n\t\t\tconfig._hideCategories(config.clicked_button);\n\t\t\tconfig._decideNext(config.clicked_button, option);\n\t\t});\n\t}", "onclick(){}", "onclickAnswer(index){\n this.props.selected(index);\n this.props.next();\n }", "function markButton(event){\n// $(\"#qwerty button\").on(\"click\", (event) => {\nevent.target.disabled = true;\nevent.target.classList.add (\"chosen\")\n// if (event.target.tagName === \"BUTTON\")\napp.handleInteraction(event.target.innerHTML.toLowerCase());\n}", "function theClick() {\r\n console.log('inicia')\r\n dataNodes()\r\n dataElements()\r\n backEnd()\r\n}", "addHandlerClick(handler) {\n // NOTE Event delegation. Figure out which button was clicked, based on the event\n this._parentElement.addEventListener('click', function (e) {\n // Select the closest button-element to the clicked element.\n const btn = e.target.closest('.btn--inline');\n\n if (!btn) return;\n // The Controller is made and marked in the controller.js\n\n const goToPage = +btn.dataset.goto;\n\n handler(goToPage);\n });\n }", "initButtonsEventClick(){\n let buttons = document.querySelectorAll(\".row > button\");\n buttons.forEach(btn=>{\n btn.addEventListener(\"click\", e=>{\n let txtBtn = btn.innerHTML;\n this.excBtn(txtBtn);\n //console.log(txtBtn+\" \"+e.type);\n //console.log(txtBtn);\n });\n });\n }", "clickHandler() {\n // Activate if not active\n if (this.active === 'safety') {\n // Button view press effect\n this.removeSafety();\n } else if (this.active === false) {\n // Button view press effect\n this.changeToActive();\n // Click action\n this.clickAction();\n }\n }", "function clickHandler() {\n console.log(\"Button 2 Pressed\");\n }", "unsignedButtonClicked()\n\t{\n\t\tthis.db.set( 'letterType', 3 );\n\t\treturn this.router.navigateToRoute( 'voting-form' );\n\t}", "initButtons() {\n const self = this;\n const actions = [\n {\n id: 'compile',\n run: () => {\n self.compile();\n },\n },\n {\n id: 'save',\n run: () => {\n self.save();\n },\n },\n ];\n\n for (let action of actions) {\n const a = document.getElementById(action.id);\n a.addEventListener('click', action.run);\n this.views[action.id] = a;\n }\n }", "makeButtonHandler() {\n\t\tconst filter = (interaction) => true;\n\n\t\tvar collector = this.globalScrollUpdateMessage.createMessageComponentCollector({filter, time: 120000})\n\n\t\tcollector.on(\"collect\", interaction => {\n\t\t\tconsole.log(interaction);\n\n\t\t\tif(interaction.customId == \"next\") {\n\t\t\t\tinteraction.update(this.getOffsetGlobalScrollIndex(1))\n\t\t\t} else if (interaction.customId == \"back\") {\n\t\t\t\tinteraction.update(this.getOffsetGlobalScrollIndex(-1));\n\t\t\t}\n\t\t})\n\t\n\t}", "function rawSubmitInfiniteRick(thisbtn) {\n\n}", "clickHandler(event) {\n declarativeClickHandler(this);\n }", "function next_button(number){\r\n show(number);\r\n sound_color(setOf[number]);\r\n\r\n}", "function handleClick(number) {\n console.log(`Button ${number} was clicked`);\n }", "function button_click(e) {\n e.preventDefault();\n var $this = e.target,\n name = $this.ancestor('.plugin.well').getAttribute('data-key'), // Get addon name.\n action = $this.getAttribute('data-action');\n if ($this.hasClass('disabled')) {\n return;\n }\n Y.log($this);\n // Get the addon object key to add to action list.\n\n Y.log('Button '+action+' started for '+name);\n // Add addon to actions array.\n if (action in M.local_rlsiteadmin.data_actions) {\n M.local_rlsiteadmin.data_actions[action][name] = name;\n Y.log(M.local_rlsiteadmin.data_actions);\n } else {\n Y.log('Unknown action requested: '+action);\n }\n\n // Disable button for this plugin.\n $this.addClass('disabled');\n M.local_rlsiteadmin.action_dropdown_update();\n }", "function clicked() {\n search()\n; }", "function buttonsClick(e) {\n var target = e.target;\n while (target.id != \"story_content\") {\n switch (target.className) {\n case \"top\":\n moveBlockUp(target);\n return;\n case \"bottom\":\n moveBlockDown(target);\n return;\n case \"delete\":\n deleteBlock(target);\n return;\n case \"addmarker\":\n setactiveMarker(target);\n return;\n case \"addmarkerArtifact\":\n setactiveMarker(target);\n return;\n case \"removemarker\":\n removeMarker(target);\n return;\n case \"image_story gallery\":\n galleryChangePicture(target);\n return;\n case \"block_story\":\n editBlock(target);\n return;\n }\n target = target.parentNode;\n }\n}", "function processButton(param) {\n\n switch (param.element) {\n case \"조회\":\n {\n var args = {\n target: [{ id: \"frmOption\", focus: true }]\n };\n gw_com_module.objToggle(args);\n }\n break;\n case \"닫기\":\n {\n processClose({});\n }\n break;\n case \"실행\":\n {\n processRetrieve({});\n }\n break;\n case \"취소\":\n {\n closeOption({});\n }\n break;\n }\n\n }", "function handleClick() {\n\t\t window.ctaClick();\n\t\t}", "function handleClick() {\n\t\t window.ctaClick();\n\t\t}", "function handleNextButton() {\r\n $('#container').on('click', '#js-next-button', function(event) {\r\n\r\n if(questionNum === 10) {\r\n createResultsPage(correctAnswers);\r\n } else {\r\n iterateQuestion();\r\n nextQuestion();\r\n }\r\n });\r\n}", "function handleNextButton() {\n $(\".feedBackPage\").on(\"click\", \".next-btn\", function(event) {\n $(\".feedBackPage\").hide();\n if (questionNumber === QUIZ.length - 1) {\n renderResults();\n } else {\n iterateQuestion();\n renderQuestion();\n $(\".form-container\").show();\n }\n });\n console.log(\"handleNextButton() ran\");\n}", "function clickHandler(event) {\n songNumber = $(this).data('song-number');\n if (currentlyPlayingSong !== null) {\n // Revert to song number for currently playing song because user started playing new song.\n currentlyPlayingCell = $('.song-number[data-song-number=\"' + currentlyPlayingSong + '\"]');\n currentlyPlayingCell.html(currentlyPlayingSong);\n }\n if (currentlyPlayingSong !== songNumber) {\n // Switch from Play -> Pause button to indicate new song is playing.\n $(this).html('<a class=\"album-song-button\"><i class=\"fa fa-pause\"></i></a>');\n currentlyPlayingSong = songNumber;\n } else if (currentlyPlayingSong === songNumber) {\n // Switch from Pause -> Play button to pause currently playing song.\n $(this).html('<a class=\"album-song-button\"><i class=\"fa fa-play\"></i></a>');\n currentlyPlayingSong = null;\n }\n }", "function setupButtons(){\r\n\t\t\t$('.choice').on('click', function(){\r\n\t\t\t\tpicked = $(this).attr('data-index');\r\n\t\t\t\t$('.choice').removeAttr('style').off('mouseout mouseover');\r\n\t\t\t\t$(this).css({'font-weight':'bold', 'border-color':'#51a351', 'color':'#51a351'});\r\n\t\t\t\tif(submt){\r\n\t\t\t\t\tsubmt=false;\r\n\t\t\t\t\t$('#submitbutton').css({'color':'#fff','cursor':'pointer'}).on('click', function(){\r\n\t\t\t\t\t\t$('.choice').off('click');\r\n\t\t\t\t\t\t$(this).off('click');\r\n\t\t\t\t\t\tprocessQuestion(picked);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}", "_previousButtonClickHandler() {\n const that = this;\n\n that.prev();\n }", "function handleClick(event)\n{\n}", "function click() {\n\n setName('Ram')\n setAge(21)\n // console.log(\"button clicked\")\n console.log(name,age)\n }", "function handleButtonPress(e) {\n // console.log(clic_id);\n console.log(e.target.id);\n}", "function buttonHandler(){\n if (expression === 0 || expression === \"0\" || done){\n expression = \"\";\n done = false;\n }\n // get value of clicked button\n var char = $(this).attr(\"value\");\n // add value to expression\n expression += String(char);\n if (expression == \".\"){\n expression = \"0.\";\n }\n drawResult();\n}", "function Nextt() {\r\n questions.questionthree();\r\n $(\"#submit\").attr(\"onclick\", \"C()\");\r\n $(\"#previous\").attr(\"onclick\", \"previouss(), reset()\");\r\n $(\"#next\").attr(\"onclick\", \"Nexttt(), reset()\");\r\n }", "function operatorClicked(eventData) {\n\tlet buttonInformation = eventData;\n\tlet operatorClicked = buttonInformation.target.textContent;\n\tinsertDisplay(operatorClicked);\n}", "initButtons() {\n let buttons = document.querySelectorAll('.btn');\n buttons.forEach(btn => { \n btn.addEventListener('click', e => {\n let btnClick = btn.innerHTML;\n this.actionCalc(btnClick); \n }, false);\n }); \n }", "function buttons(){\n $('#ingredients').click(event => {\n $('#welcome').addClass('hidden')\n $('#recipe-search').removeClass('hidden')\n $('#recipe-search').prepend(`<p>What ingredients would you like to use? (i.e. 'gochujang, rice')</p>`)\n })\n $('#dishes').click(event => {\n $('#welcome').addClass('hidden')\n $('#recipe-search').removeClass('hidden')\n $('#recipe-search').prepend(`<p>What are we cooking? (i.e. 'carbonara')</p>`)\n })\n}", "function selectButtonHandler() {\n var self = this;\n\n makeButtonActive(self); //highlights this button\n\n thingView.clearStatus(); //clears whatever's in the status window \n\n //if this is the makeNewThing button, show the makeThing form\n if ($(this).hasClass(\"makeNewThing\")) { //generates a new form\n thingForm = new ThingForm();\n thingForm.newForm($('div#status'));\n\n } else //get object current li relates to, print status of that object\n {\n thingView.printThing(thingModel.allThings[$(this).attr(\"data\")]);\n }\n\n}", "function auxClicked(ev) {\n clicked(ev, dificuldade, score);\n }", "visitElementClicked() {\r\n this.props.visitListClick(this.props.index);\r\n }", "function ansClicked (eventData) {\n\tlet buttonInformation = eventData;\n\tlet ansClicked = buttonInformation.target.textContent;\n\tinsertDisplay(ansClicked);\n\t\n}", "function clicked(d,i) {\n\n}", "function clicked(d,i) {\n\n}", "function ButtonClick(event) {\n // store which button has been clicked in currentButton\n //let currentButton = event.currentTarget; <- one way of getting a ref to the button\n let currentButton = event.currentTarget;\n switch (currentButton.getAttribute(\"id\")) {\n case \"HideButton\":\n FirstProjectImage.style.display = \"none\";\n break;\n case \"HalfSizeButton\":\n FirstProjectImage.style.maxWidth = \"50%\";\n FirstProjectImage.style.display = \"block\";\n break;\n case \"ThreeQuarterSizeButton\":\n FirstProjectImage.style.maxWidth = \"75%\";\n FirstProjectImage.style.display = \"block\";\n break;\n case \"ShowButton\":\n FirstProjectImage.style.display = \"block\";\n FirstProjectImage.style.maxWidth = \"100%\";\n break;\n }\n }", "function updateButton(button, choice){\n document.getElementById(button).setAttribute('onclick', 'nextStep(' + choice +')');\n}", "function renderNextQuestion () {\r\n $('main').on('click', '.nextButton', function (event) {\r\n increaseQuestionNumber();\r\n renderQuestion();\r\n checkAnswer();\r\n });\r\n}", "function addClickEvent() {\n $('.topic-button').on('click', function() {\n removeGifs();\n\n ingredient = $(this).attr('data-food');\n\n giphySearch(ingredient);\n });\n}", "function buttonActions() {\n\t\t$(\".button\").on(\"click\", function() {\n\t\t\tvar routeGiven = $(this).attr(\"id\");\n\t\t\tif ($(this).hasClass(\"clicked\")) {\n\t\t\t\t$(this).removeClass(\"clicked\");\n\t\t\t\troutes[routeGiven][\"vRefresh\"] = false;\n\t\t\t\t$(\".route_\" + routeGiven + \",\" + \".path_\" + routeGiven).css({\n\t\t\t\t\t\"visibility\": \"hidden\"\n\t\t\t\t});\n\t\t\t\t$(\"#\"+routeGiven).css({\n\t\t\t\t\t\"background-color\": \"#fff\",\n\t\t\t\t\t\"color\": \"#000\"\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t$(this).addClass(\"clicked\");\n\t\t\t\troutes[routeGiven][\"vRefresh\"] = true;\n\t\t\t\t$(\".route_\" + routeGiven + \",\" + \".path_\" + routeGiven).css({\n\t\t\t\t\t\"visibility\": \"visible\"\n\t\t\t\t});\n\t\t\t\t$(\"#\"+routeGiven).css({\n\t\t\t\t\t\"background-color\": \"#\" + routes[routeGiven][\"color\"],\n\t\t\t\t\t\"color\": \"#fff\"\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t}", "function onContinueBtnClick () {\n\n $('.js-continue-btn').click( event => {\n\n if (event.target.value === 'Next Question' || event.target.value === 'See Results') {\n showNextQuestion();\n }\n\n });\n\n}", "function makeButt(value, answ) {\n // *** Append A Button To DOM\n const betterNextContainer = `\n <article class=\"col-7 col-md-4 id=\"nxtBtn>\n <h3>${value}</h3>\n <div class=\"row\">\n <button class=\"button nxt\"> Next </button>\n </div>\n <article>\n `;\n\n $(\".qa\").append(betterNextContainer);\n // *** If User is Wrong, Display the Correct Answer\n if (answ !== null) {\n const betterCorrectContainer = `\n <article class=\"col-7 col-md-4\">\n <h4 class=\"spacer\"> Correct Answer: </h4>\n <div class=\"row\">\n <h5 class=\"col cor-ans\">${answ}</h5>\n </div>\n </article>\n `;\n $(\".qa\").append(betterCorrectContainer);\n }\n // Increase the Value of curQuest So Next Question Will Load When User Clicks\n curQuest++;\n $(\".nxt\").click((event) => {\n event.preventDefault();\n $(\".qa\").remove();\n renderQuizBetter();\n });\n}", "function handleNextButton() {\n //when \"next\" button is clicked in HTML container\n $('#container').on('click', '#next-button', function(event) {\n//if the number of the question we're on is the final question\n //then display results page with correct answer score count\n if(questionNumber === 10) {\n renderResultsPage(correctAnswers);\n//if not, go to the next question\n } else {\n iterateQuestion();\n nextQuestion();\n }\n });\n}", "handleClick(e, number) {\n console.log(\"clicke\" + e.target);\n this.counter += number;\n }", "function nextQuestionBtn() {\n currentQuestionIndex++;\n setNextQuestion();\n}", "function operandClicked(key) {\r\n operatorButtons.forEach(operator => {\r\n if(operator.innerText === key) {\r\n operator.click();\r\n }\r\n })\r\n}", "function buttonClickListener(event) {\n var element = event.target;\n\n // Pop up and alert to say which button was pressed.\n \t/*if (element.type && element.type === \"button\") {\n \t\talert(\"You clicked the \" + element.id + \" button with value \" + element.value);\n \t}\n\t*/\n\tif(element.value==3)\n\t{\n\t\t\n\t\tdoMandala();\n\t}\n\telse if(element.value==4)\n\t{\n\t\t\n\t\tdoPolygon();\n\t}\n\telse if(element.value==8)\n\t{\n\t\t\n\t\tdoOctagon();\n\t}\n \t //Call the generic event logging function\n \tlogDrawings( event );\n}", "function clickedNext(currentPage, targetSlot) {\n //console.log(\"NEXT FUNCTION ACTIVATED\");\n ++currentPage;\n targetSlot.spawnMenu(currentPage);\n}", "function buttonClick () { \r\n increment();\r\n}", "metodoClick(){\n console.log(\"diste click\")\n }", "function onClickNaviNext(el) {\n curPageNumber = curPageNumber + 1;\n refreshTable();\n debug('Next button clicked. page number : ' + curPageNumber);\n }", "handlePress(i) {\n\t\tif (i == 1) {\n\t\t\tthis.gotoPhoto();\n\t\t} else if (i == 2) {\n\t\t\tthis.gotoGallery();\n\t\t}\n\t}", "function handleNextQuestionButton () {\n $('.quiz').on('click','.js-next-question-btn', function () {\n console.log('js-next-question-btn was clicked.');\n event.preventDefault();\n if (store.submitBtnClicked === true) {\n render();\n }\n\n });\n}" ]
[ "0.6839906", "0.6758388", "0.6748291", "0.671693", "0.67093885", "0.65899754", "0.6576874", "0.6537178", "0.6492638", "0.64111495", "0.6411078", "0.6410307", "0.640575", "0.640229", "0.6377328", "0.6345447", "0.63105553", "0.6290757", "0.62893724", "0.6267743", "0.6257519", "0.62530744", "0.6247364", "0.6240094", "0.62372524", "0.62152296", "0.6212278", "0.6204225", "0.6197152", "0.6193523", "0.618391", "0.61825836", "0.6174712", "0.61675656", "0.6145121", "0.6144528", "0.6142881", "0.61408365", "0.61398673", "0.6133127", "0.61214846", "0.6121167", "0.6104358", "0.60984427", "0.609647", "0.60886264", "0.6088065", "0.60857064", "0.6076216", "0.6075813", "0.60758126", "0.6075425", "0.60753864", "0.60667235", "0.6056801", "0.6056096", "0.6037883", "0.60245776", "0.6014188", "0.6011501", "0.60014266", "0.59992445", "0.59992445", "0.5994149", "0.5993693", "0.5991154", "0.5987467", "0.5985857", "0.59817165", "0.59762263", "0.5973282", "0.5970066", "0.59699374", "0.5966644", "0.59628695", "0.59625286", "0.5954944", "0.59544784", "0.5953817", "0.595261", "0.5947132", "0.5947132", "0.5943442", "0.5941924", "0.59387547", "0.5936648", "0.59317833", "0.59312093", "0.5924414", "0.59217244", "0.5921714", "0.5919765", "0.59122753", "0.59118396", "0.5911015", "0.5909878", "0.5908755", "0.5905026", "0.5900891", "0.59001255" ]
0.6807116
1
Sends the email to Michael's Place staff and displays the 'program' route.
sendEmail() { this.validationController.validate().then(errors => { if (errors.length === 0) { var email = this; this.api.email.sendToStaff(this.subject, this.message) .then(function() { log.debug('Email sent succesfully. Rerouting to program page.'); email.router.navigateToRoute('program'); }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function main () {\n // send mail with defined transport object\n transporter.sendMail({\n from: email, // sender address\n to: '[email protected]', // list of receivers\n subject: 'Client Enquiry', // Subject line\n html: message\n }, function (err) {\n if (err) {\n console.log(err)\n res.render('error')\n } else {\n console.log('Message sent successfully:')\n res.render('confirmation')\n }\n })\n }", "function sendEmailToJohn(team){\n var body = '';\n var subject = '';\n if(team == 'CANCELLED AT LAST MINUTE'){\n body = 'Hello John, somebody got to the install page but cancelled';\n subject = 'Shitofski, close but no cigar';\n\n }else{\n body = 'Hello John, ' + team + ' have installed SlackDublinBus';\n subject = 'Somebody has installed SlackDublinBus on SLack ✔';\n }\n var mailOptions = {\n from: '\" Slack Dublin Bus 🚌\" <[email protected]>', // sender address\n to: '[email protected]', // list of receivers\n subject: subject, // Subject line\n text: body, // plaintext body\n html: '<b>Hello John, ' + team + ' have installed SlackDublinBus</b>' // html body\n };\n\n // send mail with defined transport object\n transporter.sendMail(mailOptions, function(error, info){\n if(error){\n return console.log(error);\n }\n console.log('Message sent: ' + info.response);\n });\n}", "function sendEmail() {\n var milestoneData = getMilestoneData();\n var htmlBody = getEmailHtml(milestoneData);\n var recipients = getMailAddress();\n var projectTitle = getProjectTitle();\n MailApp.sendEmail({\n to : recipients,\n subject : 'Weekly Updates (' + projectTitle + ')',\n htmlBody : htmlBody\n });\n}", "function sendApplicationEmail(user) {\n var message = new Message({\n template: 'application',\n subject: 'Kent Hack Enough Application',\n recipients: [{\n email: user.email,\n locals: {\n name: {\n first: user.application.name.split(' ')[0],\n last: user.application.name.split(' ')[1]\n }\n }\n }]\n });\n message.send();\n}", "function sendEmail(number){\n var message = \"There are currently \" + number + \" daily tasks over one hour past due.\"\n MailApp.sendEmail(adminEmail,\"Past Due Daily Tasks\",message);\n}", "async function main() {\n\n // Generate test SMTP service account from ethereal.email\n // Only needed if you don't have a real mail account for testing\n let testAccount = await nodemailer.createTestAccount();\n\n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n host: \"smtp.ethereal.email\",\n port: 587,\n secure: false, // true for 465, false for other ports\n auth: {\n user: testAccount.user, // generated ethereal user\n pass: testAccount.pass // generated ethereal password\n }\n });\n\n // send mail with defined transport object\n let info = await transporter.sendMail({\n from:`admin <${req.body.email}>`, // sender address\n to: \"[email protected]\", // list of receivers\n subject: `Application - ${req.body.subject}`, // Subject line\n html: output,\n });\n\n console.log(\"Message sent: %s\", info.messageId);\n // Message sent: <[email protected]>\n\n // Preview only available when sending through an Ethereal account\n console.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\n // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...\n \n res.render('contact')\n \n }", "function sendEmail(address) {\n window.location.href = 'mailto:' + address;\n }", "preparingEmailSending() {\n const url = 'mailto:' + this.state.email + '?subject=Your Storj mnemonic&body=' + this.state.mnemonic;\n Linking.openURL(url); \n }", "function sendMailToOrganizer() {\n let item = document.getElementById(\"calendar-task-tree\").currentTask;\n if (item != null) {\n let organizer = item.organizer;\n let email = cal.email.getAttendeeEmail(organizer, true);\n let emailSubject = cal.l10n.getString(\"calendar-event-dialog\", \"emailSubjectReply\", [\n item.title,\n ]);\n let identity = item.calendar.getProperty(\"imip.identity\");\n cal.email.sendTo(email, emailSubject, null, identity);\n }\n}", "function sendMail(){\n\tvar email = Session.getActiveUser().getEmail();\n\tMailApp.sendEmail(email, \"Your Putzparty form was submitted!\", \"yeah!\");\n}", "function sendEmail (student) {\n console.log(`Dear ${student.name}, you are accepted at CeroUno.io`);\n console.log(`Email sent to: ${student.email}`);\n}", "function useMail(s){\r\n s = s.replace(/\\s+/g, ''); // .replace(/\\[dot\\]/g,\".\")\r\n this.location.href = \"mailto://\" + s + \"?subject=link from fbt-mechatronik.de\" + iAM;\r\n} // useMail", "async function main(){\n\n\t\t\t// create reusable transporter object using the default SMTP transport\n\t\t\tlet transporter = nodemailer.createTransport({\n\t\t\t\thost: keys.host,\n\t\t\t\tport: keys.port,\n\t\t\t\tsecure: true, // true for 465, false for other ports\n\t\t\t\tauth: {\n\t\t\t\t\tuser: keys.auth.user,\n\t\t\t\t\tpass: keys.auth.pass\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tlet info = await transporter.sendMail({\n\t\t\t\tfrom: req.body.from,\n\t\t\t\tto: '[email protected]', // list of receivers\n\t\t\t\tsubject: 'New Inquiry From: alonzoalden.com', // Subject line\n\t\t\t\t//text: req.body.from + ' /n ' + req.body.text, // plain text body\n\t\t\t\thtml: 'From: ' + req.body.from + ' <br /><br /> '\n\t\t\t\t\t+ 'Subject: ' + req.body.subject + ' <br /><br /> '\n\t\t\t\t\t+ 'Text: ' + req.body.text\n\t\t\t});\n\n\t\t\tconsole.log(\"Message sent: %s\", info.messageId);\n\t\t\t// Message sent: <[email protected]>\n\n\t\t\t// Preview only available when sending through an Ethereal account\n\t\t\tconsole.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\n\t\t\t// Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...\n\t\t}", "function mail(firstName, lastName, email) { \n //use predefined auth variables to send email with Habitack gmail\n return transporter.sendMail({\n from: 'Habitack Team <[email protected]>', // sender address\n to: email, // list of receivers\n subject: \"Welcome to Habitack!\", // Subject line\n //body\n html: `<h1>Hello ${firstName} ${lastName},</h1> <br /> \n <p>Welcome to your journey towards self improvement! Below is an introduction guide to help get you started</p><br />\n <p>Habitack is a habit tracker designed to facilitate users with tracking goals that can change your life for the better. <br />\n Our job is to calculate your progress and show you results. Your job is to attack daily challenges with the help of habitack. </p> <br />\n <p>Pages: </p> <br />\n <ol> \n <li>Goals Page</li>\n <ul>\n <li>List goals for the user</li>\n <li>Add new goal</li>\n <li>Delete goal</li>\n <li>Add photo to goal</li>\n </ul>\n <li>Stats Page</li>\n <ul>\n <li>Display the stats for a current goal</li>\n </ul>\n <li>Account Page</li>\n <ul>\n <li>Change account information</li>\n </ul>\n </ol>`\n })\n .then(r => console.log(r))\n .catch(e => console.log(e))\n}", "sendEmail() {\n email([EMAIL], null, null, null, null);\n }", "async function main() {\n \n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n host: \"smtp.live.com\",\n port: 587,\n secure: false, // true for 465, false for other ports\n auth: {\n user: emailData.mailUser,\n pass: emailData.mailPassword, \n },\n });\n \n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: `www.aleksandergorecki.com ${emailData.mailUser}`, // sender address\n to: \"[email protected]\", // list of receivers\n subject: \"New info from www.aleksandergorecki.com\", // Subject line\n text: \"Hello world?\", // plain text body\n html: output, // html body\n });\n \n console.log(\"Message sent: %s\", info.messageId);\n \n // Preview only available when sending through an Ethereal account\n console.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\n }", "async function main() {\n\n // Generate test SMTP service account from ethereal.email\n // Only needed if you don't have a real mail account for testing\n let testAccount = await nodemailer.createTestAccount();\n\n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n host: \"smtp.ethereal.email\",\n port: 587,\n secure: false, // true for 465, false for other ports\n auth: {\n user: testAccount.user, // generated ethereal user\n pass: testAccount.pass // generated ethereal password\n }\n });\n\n // send mail with defined transport object\n let info = await transporter.sendMail({\n from:`admin <${req.body.email}>`,\n to: \"[email protected]\",\n subject: `Application - ${req.body.position}`,\n html: output,\n attachments: [{\n filename: cv.originalname,\n contentType: cv.mimetype,\n encoding: cv.encoding,\n content: cv.buffer\n }]\n \n });\n \n \n\n console.log(\"Message sent: %s\", info.messageId);\n // Message sent: <[email protected]>\n\n // Preview only available when sending through an Ethereal account\n console.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\n // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...\n \n Job.find({}, (err, allJobs) => err ? console.log(err) : res.render('job-page', { \n allJobs: allJobs,\n \n }));\n }", "sendEmail() {\r\n emailService.sendEmail(\r\n ['[email protected]'],\r\n null,\r\n null,\r\n 'A new organization is awaiting your approval',\r\n 'organization name: '+ this.state.org.org_name +\r\n '\\norganizaion description: ' + this.state.org.description +\r\n '\\nusername asking to create organization: ' + this.state.org.admin_name,\r\n null,\r\n )\r\n }", "function emailContact() {\n\n\t/**\n\t * Appcelerator Analytics Call\n\t */\n\tTi.Analytics.featureEvent(Ti.Platform.osname+\".profile.emailButton.clicked\");\n\t\n\t/**\n\t * Account for if the user is on iOS and using a simulator - iOS Simulator no \n\t * longer supports sending email as of iOS 8\n\t */\n\tif(OS_IOS && Ti.Platform.model === \"Simulator\"){\n\t\talert(\"Simulator does not support sending emails. Use a device instead\");\n\t\treturn;\n\t}\n\t/**\n\t * Create an Email Dialog\n\t * DOCS: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.EmailDialog\n\t */\n\tvar emailDialog = Ti.UI.createEmailDialog();\n\t\n\t/**\n\t * Setup the Email Dialog information, in this case just the recipients field\n\t */\n\temailDialog.toRecipients = [_args.email];\n\t\n\t/**\n\t * Once we have created and setup the Email Dialog, lets open the view\n\t */\n\temailDialog.open();\n}", "async function main(){\n\n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n host: \"smtp.gmail.com\",\n port: 587,\n secure: false, // true for 465, false for other ports\n auth: {\n user: '[email protected]', // generated ethereal user\n pass: 'VFgg%%$#%&GFR' // generated ethereal password\n },\n tls:{\n rejectUnauthorized:false\n }\n });\n\n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: '\"'+req.body.name+'\" <[email protected]>', // sender address\n to: \"[email protected]\",\n replyTo: req.body.email,// list of receivers\n subject: req.body.noOfTravlers+' pax -'+ req.body.city+' - '+fromDate + ' to '+toDate, // Subject line\n // text: \"Hello world?\", // plain text body\n html: userInfo // html body\n });\n\n console.log(\"Message sent: %s\", info.messageId);\n // Message sent: <[email protected]>\n\n // Preview only available when sending through an Ethereal account\n console.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\n // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...\n }", "function sendEmailToUser(address, firstName, lastName, email, phoneNumber, zestimate) {\n const emailText = `Hi ${firstName}!, thank you for signing up! Here are your account details: \n \\n Name: ${firstName}\n \\n Last name: ${lastName}\n \\n Phone: ${phoneNumber !== 'null' ? phoneNumber : ''}\n \\n\\n And here is the zestimate we found for the address: ${address}\n \\n ${zestimate} $ (per month)\n \\n Thank you, \n \\n The Rent-With-Me team :)`;\n const mailOptions = {\n from: companyEmail,\n to: email,\n subject: 'Congrats for joining Rent-With-Me!',\n text: emailText\n };\n transporter.sendMail(mailOptions, function(error, info){\n if (error) {\n console.log(error);\n } else {\n console.log('Email sent: ' + info.response);\n }\n });\n}", "async welcome(options) {\n\t\ttry {\n\t\t\tconst email = {\n\t\t\t\tfrom: this.from,\n\t\t\t\tsubject: options.subject,\n\t\t\t\tto: options.to,\n\t\t\t\thtml: pug.renderFile(path.join(__dirname, 'templates/welcome.pug'), {\n\t\t\t\t\tusername: options.username,\n\t\t\t\t\tmessage: options.message,\n\t\t\t\t}),\n\t\t\t}\n\t\t\tconst response = await this.transporter.sendMail(email)\n\n\t\t\tif (process.env.NODE_ENV === 'development') {\n\t\t\t\tconsole.log(response)\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (process.env.NODE_ENV === 'development') {\n\t\t\t\tconsole.log(error)\n\t\t\t}\n\n\t\t\tthrow error\n\t\t}\n\t}", "async function main() {\n // create reusable transporter object using the default SMTP transport\n var transporter = nodemailer.createTransport({\n host: \"smtp.gmail.com\", // hostname\n auth: {\n user: \"[email protected]\",\n pass: \"Moon_2021!\",\n },\n });\n\n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: email, // sender address\n to: \"[email protected]\", // list of receivers\n subject: email, // Subject line\n text: message, // plain text body\n html: message, // html body\n });\n\n console.log(\"Message sent: %s\", info.messageId);\n // Message sent: <[email protected]>\n }", "function sendReminder() {\r\n//create the HTML file and send the email\r\nvar email = retrieveAnnouncement(reminder_doc_id);\r\n//send email\r\nGmailApp.sendEmail(labEmail, \"Newsletter Submission Reminder\", \"Error Sending Email\", {htmlBody: email});\r\n}", "function printEmail(name, site, tld) {\n var at = \"@\";\n $('<a id=\"email\" class=\"pro\" href=\"mailto:' + name + at + site + '.' + tld + '\">' + name + at + site + '.' + tld + '</a>').replaceAll('#email');\n }", "async function main() {\r\n let transporter = nodemailer.createTransport({\r\n host: `${keys.host}`, // Make sure to set up these in the config file.\r\n port: `${keys.port}`, // Refer to your email provider for your mail provider's configuration.\r\n secure: false,\r\n auth: {\r\n user: `${keys.user}`,\r\n pass: `${keys.password}`,\r\n },\r\n });\r\n\r\n let subject = date.getMonth + \" \" + date.getDate\r\n\r\n let info = await transporter.sendMail({\r\n from: `${keys.from}`,\r\n to: `${keys.to}`,\r\n subject: subject,\r\n text: \"Hello, Email World.\",\r\n html: undefined, // none, we are using text\r\n });\r\n\r\n console.log(\"Message Sent: %s\", info.subject);\r\n}", "sendTextEmail() {\n email([EMAIL], null, null, null, this.state.text);\n }", "function sendmail(){\t\n\n\tvar mailOptions = {\n\t from: 'Fred Foo ✔ <[email protected]>', // sender address\n\t to: '[email protected]', // list of receivers\n\t subject: 'Hello ✔', // Subject line\n\t text: 'Hello world ✔', // plaintext body\n\t html: '<b>Hello world ✔</b>' // html body\n\t};\n\n\t// send mail with defined transport object\n\ttransporter.sendMail(mailOptions, function(error, info){\n\t if(error){\n\t console.log(error);\n\t }else{\n\t console.log('Message sent: ' , info);\n\t }\n\t});\n}", "function sendEmail(){\n GmailApp.sendEmail(\"[email protected]\", \"Auto-mailer: File Ownership transferred\", \"Script executed at:\" + Utilities.formatDate(new Date(), \"GMT+5:30\",\"dd-MMM-yyyy HH:mm:ss \"));\n}", "function email(name){\n window.location.assign(\"mailto: \" + name);\n }", "function sendAlert(reason, data) {\n \n var to = '[email protected]'\n \n var from = 'Psych2500 Daemon'\n \n var subject\n var body\n \n if (reason == 'NOCLASS') {\n \n subject = 'No 2500 class this week'\n body = 'That is all there is to discuss. Thanks!'\n \n } else if (reason == 'ERRORS') {\n \n subject = 'Errors in returnComments() found'\n body = 'Hi, I just ran returnComments() for Psych2500. Errors occurred. This is what happened:\\n\\n'+data\n }\n \n \n MailApp.sendEmail({\n to: to,\n from: from,\n subject: subject,\n htmlBody: body, \n }); \n \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 main(){\r\n\r\n // Generate test SMTP service account from ethereal.email\r\n // Only needed if you don't have a real mail account for testing\r\n\r\n\r\n // create reusable transporter object using the default SMTP transport\r\n let transporter = nodemailer.createTransport({\r\n host: \"some host\",\r\n port: 465,\r\n secure: true, // true for 465, false for other ports\r\n auth: {\r\n user:\"some user\", // generated ethereal user\r\n pass:\"some password\" // generated ethereal password\r\n }\r\n });\r\n\r\n // setup email data with unicode symbols\r\n let mailOptions = {\r\n from: \"some user\",\r\n to: myMail, // list of receivers\r\n subject: myTask, // Subject line\r\n text: myTekst, // plain text body\r\n html: myTekst // html body\r\n\r\n };\r\n\r\n // send mail with defined transport object\r\n let info = await transporter.sendMail(mailOptions)\r\n\r\n console.log(\"Message sent: %s\", info.messageId);\r\n // Preview only available when sending through an Ethereal account\r\n console.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\r\n\r\n // Message sent: <[email protected]>\r\n // Preview URL: Status change from 1 to 0\r\n}", "sendHome() {\n this.planManager.goHome();\n }", "function main() {\n console.log(\"connecting to emailer-svc\");\n client = new emailer.Emailer(\"emailer-svc:50051\", grpc.credentials.createInsecure());\n console.log(\"sending email\");\n client.email({recipient: \"[email protected]\", subject: \"hi brian\", body: \"you are my bro\"},\n function(err, response) {\n console.log(\"Error: \" + err);\n console.log('Email ID:', response.id);\n });\n}", "async function main(data) {\n // create reusable transporter object using the default SMTP transport\n var transporter = nodemailer.createTransport({\n service: 'Gmail',\n auth: {\n user: process.env.OFFICER_EMAIL,\n pass: process.env.OFFICER_EMAIL_PASS\n }\n });\n\n // setup email data with unicode symbols\n let mailOptions = {\n from: `\"Fauzan Bank 👻\" <${process.env.OFFICER_EMAIL}>`, // sender address\n to: data.email, // list of receivers\n subject: `${data.subject} ✔`, // Subject line\n text: `${data.text}` // plain text body\n };\n\n // send mail with defined transport object\n transporter.sendMail(mailOptions)\n}", "async send(data) {\n const from = data.username;\n // 1) Render HTML based on a pug template\n if (!data.template) data.template = \"general\";\n\n const html = pug.renderFile(`${__dirname}/../views/email/${data.template}.pug`, {\n message: data.message,\n title: data.title \n });\n\n // 2) Define email options\n const msg = {\n to: data.email,\n from: email,\n subject: data.subject,\n text: data.message,\n html,\n text: htmlToText.fromString(html)\n };\n \n // 3) Create a transport and send email\n await sgMail.send(msg);\n }", "function sendMail(e){\n\te.preventDefault()\n\tconst receiver = document.querySelector(\"#receiverName\").value\n\tconst content = document.querySelector(\"#inputContent\").value\n\t//const appendMail = new Mail(receiver.value, content)\n\t//auser.send.push(newMail)\n\n const newMail = {\n \"receiver\":receiver,\n \"content\":content\n }\n RequestModule.sendmail(newMail, function(newmail){\n sent.insertBefore(mailHTML(newmail), sent.children[1])\n if(receiver === currentUser){\n inbox.insertBefore(mailHTML(newmail), inbox.children[1])\n }\n })\n\n // Server side funtions will be added below in phase2.\n}", "function reservmail(req, res, next) {\n sendEmailWithTemplate(req.body.reservationId, req, res, 'reservmail');\n}", "function attemptContact() {\n \"use strict\";\n var variables = getVariables();\n if (variables) {\n sendEmail(variables);\n }\n}", "function sendEmail(uname, orderNum){\n\tUser.findOne({username: uname}, function(err, user){\n\t\tif(err){ \n\t\t\tconsole.log(err);\n\t\t\treturn;\n\t\t}\n\t\tvar smtpTransport = nodemailer.createTransport(configs.mailer.options);\n\t\t\n\t\tvar mailOptions = {\n\t\t\tfrom: configs.mailer.from,\n\t\t\tsubject: 'Your Order Is Ready'\n\t\t};\n\t\tmailOptions.to = user.email;\n\t\tmailOptions.text = 'Dear ' + user.displayName + ',\\n\\n' +\n\t\t\t\t\t\t\t\t'Your order with order number ' + orderNum + ' is ready for collection.\\n'+\n\t\t\t\t\t\t\t\t'You can collect your order at the cafeteria.\\n\\n'+\n\t\t\t\t\t\t\t\t'The CMS Team';\n\t\tsmtpTransport.sendMail(mailOptions, function(err){ \n\t\t\tif(err) console.log('Email not sent' + err); \n\t\t});\n\t});\n }", "function sendMail(){ \n\tlogincontroller.logincheck(name,password,(err,data)=>{\n \tif(err) throw err;\n \telse{\n \t\tconsole.log(\"\\n------------------------------Compose Mail---------------------------------\\n\\n\")\n \t\tconsole.log(\"------------------------------------------------------------------------------\")\n \t\tconsole.log(\"Sender Name=> \"+data[0].name+\" ---------Sender Email ID => \"+data[0].emailid);\n \t\tconsole.log(\"------------------------------------------------------------------------------\")\n \t\tvar reciever = readline.question(\"Reciever Email Id => \");\n \t\tconsole.log(\"------------------------------------------------------------------------------\")\n \t\tvar subject = readline.question(\"Subject => \");\n \t\tconsole.log(\"------------------------------------------------------------------------------\")\n \t\tvar message = readline.question(\"Message = >\")\n \t\tconsole.log(\"------------------------------------------------------------------------------\\n\")\n\t\tmailcontroller.sendmail(data[0].emailid,reciever,subject,message,(err)=>{\n\t\t\tif(err) throw err;\n\t\t\telse{\n\t\t\t\tconsole.log(\"\\n---------Mail Sent Successfully---------\");\n\t\t\t\tconsole.log(\"\\n---------------------------Welcome \"+data[0].name+\"------------------------\");\n\t\t\t\thomeUI();\n\t\t\t}\n\t\t});\t\n\t\n \t}\n\n });\n\n}", "async send(template, subject) {\n // 1) Render HTML based on a pug template\n const html = pug.renderFile(`${__dirname}/../views/email/${template}.pug`, {\n name: this.name,\n url: this.url,\n role: this.role,\n subject,\n });\n\n // 2) Define email options\n const mailOptions = {\n from: this.from,\n to: this.receiver,\n subject,\n html,\n text: htmlToText.fromString(html),\n };\n\n // 3) Create a transport and send email\n this.transport().sendMail(mailOptions);\n }", "async handle ({ email, username, bets, total }) {\r\n await Mail.send(\r\n ['emails.new_bets'],\r\n { username, bets, total },\r\n (message) => {\r\n message\r\n .to(email)\r\n .from('[email protected]', 'TGL | BETS')\r\n .subject('Novas apostas');\r\n }\r\n ); }", "async send(template, subject) {\n // 1 ) Render The HTML based on a pub template\n const html = pug.renderFile(\n `${__dirname}/../../views/email/${template}.pug`,\n {\n firstName: this.firstName,\n url: this.url,\n subject\n }\n );\n\n // 2) Define email options\n const mailOptions = {\n from: this.from,\n to: this.to,\n subject,\n html,\n text: htmlToText.fromString(html)\n };\n\n // 3) Create a transport and send email\n await this.newTransport().sendMail(mailOptions);\n }", "function newTeamNotify(com_id, comName){\n //com_id = '22';\n //comName = 'aaa';\n MailApp.sendEmail({to:\"[email protected],[email protected], [email protected]\" , subject: \"New Team Registered\", htmlBody: \"The Following Team has Registered: <br><br><br> Company Name: \" + comName + \"<br><br> iBoost Team ID : \" + com_id+\"<br><br><br><br> Best, <br><br> <img src='cid:logo' height='50' width='150'>\", inlineImages:{logo: imageLogo}});\n}", "function sendQuizLinkEmail(req, res, next, msg) {\n sgMail.send(msg)\n .then(() => {\n res.status(200).redirect('/quiz_soft/dashboard');\n })\n .catch((error) => {\n console.error(error)\n res.status(500).redirect('/quiz_soft/dashboard');\n });\n}", "function BuildAndSendWorkout() {\n var workout = BuildMainWorkout() + \"\\n\\n----------------------------------\\n\" + BuildAux();\n this.mods.forEach(mod => {\n workout = workout + \"\\n\\nMod: \" + mod[\"Name\"];\n });\n var config = ReadInNamedRangeInverse(\"Config\");\n \n MailApp.sendEmail(find(config, \"MY_EMAIL\")[\"Value\"], \"Workout\", workout);\n }", "deliver() {\n return \"Deliver by land in a box.\";\n }", "async function main() {\n // Generate test SMTP service account from ethereal.email\n // Only needed if you don't have a real mail account for testing\n let testAccount = await nodemailer.createTestAccount();\n\n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n host: process.env.SMTP_HOST,\n port: process.env.SMTP_PORT,\n secure: true, // true for 465, false for other ports\n auth: {\n user: process.env.SITE_EMAIL_ADDRESS, // generated ethereal user\n pass: process.env.SITE_EMAIL_PASSWD // generated ethereal password\n },\n });\n \n let info = await transporter.sendMail({\n from: process.env.SITE_EMAIL_USER, \n to:props.recipientEmail,\n subject: \"Reset Your Password on Dig2Pin\", \n // text: \"Hello world?\", \n html: '<div><p>Hi '+props.recipientEmail+'</p><div><p> We have received your request to reset your password. Please follow the link below to reset your password. </p><ul><li><a href=' + props.forgotPasswordUrl + '> Reset Password </a></li></ul><p>If you didn’t ask for your password to be reset, you can safely ignore this email.</p></div></div></body>',\n });\n }", "function run(){\r\n var emailList = ['[email protected]'];\r\n var emailTitle = 'ALERT: 404 Pages Found'\r\n // Found in URL\r\n var spreadsheetId = 'xXxXXxXXxxXXxxXXxxXXxxXXXx';\r\n var sheetName = 'Sheet 1'\r\n\r\n sendEmails(spreadsheetId,sheetName,emailList,emailTitle)\r\n}", "async send(template, subject) {\n const events = await (await Event.find()).reverse();\n //Render html based on a pug template\n const html = pug.renderFile(\n `${__dirname}/../views/emails/${template}.pug`,\n {\n firstName: this.firstName,\n url: this.url,\n message: this.message,\n subject,\n events,\n }\n );\n\n //Define Email options\n const mailOptions = {\n from: this.from,\n to: this.to,\n subject,\n html,\n text: htmlToText.fromString(html),\n };\n\n //create a transport and send email\n await this.newTransport().sendMail(mailOptions);\n }", "function btn() {\n var name = document.getElementById('artistName').value;\n var email = document.getElementById('email').value;\n var phone = document.getElementById('phoneNum').value;\n var message = document.getElementById('statement').value;\n var artTitle = document.getElementById('artworkTitle').value;\n var body = \"\";\n\n\n if (name != \"\" && email != \"\" && phone != \"\" && message != \"\" && artTitle != \"\") {\n var valid = true;\n\n } else {\n var valid = false;\n }\n\n if (valid) {\n body = \"Dear Art Gallery,%0D%0A%0D%0A\" +\n artTitle + \" is the title of this art piece.%0D%0A\" +\n \"Here is a statement about this piece: %0D%0A\" +\n message + \"%0D%0A%0D%0A\" +\n \"Thank you,%0D%0A\" +\n name + \"%0D%0A\" +\n email + \"%0D%0A\" +\n phone;\n\n // constructed the body of the message above.\n window.open('mailto:[email protected]?subject=Artwork Submission&body=' + body);\n alert('Thank you for the submission! If we choose your artwork, we will be in contact shortly.');\n\n\n } else {\n alert(\"Please fill in all fields.\");\n }\n}", "function notifyAdminOfTaskCompletion(task) {\n var transporter = nodemailer.createTransport(smtpTransport({\n host: 'smtp.zoho.com',\n port: 465,\n secure: true, // use SSL\n auth: {\n user: '[email protected]',\n pass: 'june2013'\n }\n }));\n var mailOptions = {\n to: '[email protected]',\n from: '[email protected]',\n subject: 'New Task',\n text: \"Job No: \" + task.jobId + \" has been completed and the customer is satisfied\"\n };\n transporter.sendMail(mailOptions, function(err) {\n if (err)\n console.log(\"not sent: \" + err);\n else\n console.log(\"successfully sent\");\n });\n }", "function emailMessage(){\n if (req.body.frequency == 'Hourly'){\n return 'Hello ' + req.body.firstName.charAt(0).toUpperCase() + req.body.firstName.slice(1) + '!\\n\\n' + \n 'You will be reminded every ' + req.body.timeLine + ' hours via email to take your ' + req.body.medicineName + '.'; \n }else{\n return 'Hello ' + req.body.firstName.charAt(0).toUpperCase() + req.body.firstName.slice(1) + '!\\n\\n' +\n 'You will be reminded every ' + req.body.timeLine + ' minutes via email to take your ' + req.body.medicineName + '.'; \n }\n }", "function sendReminderToFaculty() {\n \n // NB: this function is set up only to send reminders 7 days in advance\n // ...to tweak this, we'd make 'days-in-advance' an argument\n \n // get date info in verbose, regex, and terse form (see getDateInfo() help for more)\n var date_info = getDateInfo(7)\n var date_verbose = date_info[0]\n \n // get course specific variables (folder/spreadsheet ids)\n var local_vars = initializeCourseVariables()\n var course_schedule = local_vars['schedule']\n var email_template = local_vars['email - 1 week reminder']\n var syllabus = local_vars['syllabus']\n\n var faculty_data = getFacultyInfo(date_verbose, course_schedule)\n var faculty_name = faculty_data[0]\n var faculty_email = faculty_data[1] \n \n // string formatting of date (to make email prettier)\n var month_names = [ \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" ];\n var weekday_names = [\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"Sunday\"]\n var d = new Date() \n d.setDate(d.getDate() + 7)\n var day_of_the_month = d.getDate()\n var day_of_the_week = weekday_names[d.getDay()-1]\n var month = month_names[d.getMonth()] \n\n // initialize email vars\n // (we do this in the case of \"NOCLASS\", for which these vars should be null)\n var cc\n var bcc\n var attachment\n var from\n \n if ((faculty_name == \"NOCLASS\") || (!faculty_name)) {\n\n var title = \"No 2500 class next week\"\n var body = \"There's no class next week (\"+ day_of_the_week + \", \" + month + \" \" + day_of_the_month+\")\"\n \n } else {\n \n var email_content = SpreadsheetApp.openById(email_template) \n var data = arrayTranspose(email_content.getDataRange().getValues())\n\n // email parameters:\n var title = data[0][1]\n var from = data[1][1]\n var cc = data[2][1]\n var bcc = data[3][1]\n var greeting = data[4][1] + ' ' + faculty_name + \",<br /><br />\" // eg. \"Dear Professor\" + \" \" + \"Feynman, <br /><br />\"\n var opening_line = data[5][1] + day_of_the_week + ', ' + month + ' ' + day_of_the_month\n var main_body = data[6][1] \n var body = greeting + opening_line + main_body\n var attachment = DriveApp.getFileById(syllabus) \n \n }\n\n MailApp.sendEmail({\n to: faculty_email,\n cc: cc, // this goes to Mahzarin, be careful when you're testing!\n bcc: bcc,\n name: from,\n subject: title,\n htmlBody: body, \n attachments: attachment\n }); \n}", "function notifyAdminOfTaskCompletion(task) {\n var transporter = nodemailer.createTransport(smtpTransport({\n host: 'smtp.zoho.com',\n port: 465,\n secure: true, // use SSL\n auth: {\n user: '[email protected]',\n pass: 'june2013'\n }\n }));\n var mailOptions = {\n to: '[email protected]',\n from: '[email protected]',\n subject: 'New Task',\n text: \"Job No: \" + task.jobId + \" has been completed and the customer is satisfied\"\n };\n transporter.sendMail(mailOptions, function(err) {\n if (err)\n console.log(\"not sent: \" + err);\n else\n console.log(\"successfully sent\");\n });\n }", "function launchEmail()\n{\n launchApplication(\"/luminis/luminisService/mailAccountServices/mailAccount/getMailAppLaunchData\");\n}", "function apiTestEmail(req, res) {\n\ttheApp.lib.mailer.send(\"[email protected]\", \"test\", {\n\t\tfirstname: \"Jacob\"\n\t}, function(success) {\n\t\tif (success) {\n\t\t\tres.json(\"Sent email\");\n\t\t} else {\n\t\t\tres.json(\"Failed to send\");\n\t\t}\n\t});\n}", "function sendMail(txt) {\n var MAIL_INFO = {\n from: gmailconfig.auth.user,\n to: gmailconfig.auth.user, // send to myself\n subject: 'Twitter Bot Here!',\n text: txt\n };\n transporter.sendMail(MAIL_INFO, emailSent)\n}", "async function main() {\n // Generate test SMTP service account from ethereal.email\n // Only needed if you don't have a real mail account for testing\n // let testAccount = await nodemailer.createTestAccount();\n \n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n host: \"smtp.gmail.com\",\n port: 587,\n secure: false, // true for 465, false for other ports\n auth: {\n user: \"[email protected]\",\n pass: \"test@2020\",\n },\n tls: {\n rejectUnauthorized: false\n }\n });\n \n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: '\"Crazy RH\" <[email protected]>', // sender address\n to: globalEmail, // list of receivers\n subject: \"Hello 6\", // Subject line\n // text: \"Hello world?\", // plain text body\n // html: \"<b>Hello world?</b>\", // html body\n // html: `this is message`\n // html: `<h1>Valider</a><hr><a href='http://localhost:3000/reserv/1'>confermation</a>`\n html: ` \n <section style='background-color: #F5F5F5;'>\n <center>\n <div class='container border border-warning rounded' style='background-color: white;max-width:660px'>\n <!-- <center> -->\n <div style='background-color: #f96b13;padding: 4px;'></div>\n <div style='width: 100%;'>\n <div style='display: flex; width: 100%;margin-top: 20px;'>\n <h4 style='font-family:Arial,Helvetica,Verdana,sans-serif;font-size:18px;line-height:20px;color:#4c535d;padding:2% 0% 2% 20%;text-align:left;width: 50%;margin: 2% 0%;'>Vol ID : `+globalvolid+`</h4>\n <h4 style='font-family:Arial,Helvetica,Verdana,sans-serif;font-size:18px;line-height:20px;color:#4c535d;padding:2% 0% 2% 0%;text-align:left;width: 50%;margin: 2% 0%;'>Reservation ID : `+globalIdReservation+`</h4>\n </div>\n <div style='display: flex; width: 100%;margin-top: 20px;'>\n <h4 style='font-family:Arial,Helvetica,Verdana,sans-serif;font-size:18px;line-height:20px;color:#4c535d;padding:2% 0% 2% 20%;text-align:left;width: 50%;margin: 2% 0%;'>Nom : </h4>\n <h4 style='font-family:Arial,Helvetica,Verdana,sans-serif;font-size:18px;line-height:20px;color:black;padding:2% 0% 2% 0%;text-align:left;width: 50%;margin: 2% 0%;'>`+globalNom+` </h4>\n </div>\n <hr style=' width: 80%;padding: 2px; background-color: #bdc3c7; border: none;'>\n <div style='display: flex; width: 100%;'>\n <h4 style='font-family:Arial,Helvetica,Verdana,sans-serif;font-size:18px;line-height:20px;color:#4c535d;padding:2% 0% 2% 20%;text-align:left;width: 50%;margin: 2% 0%;'>Prenom : </h4>\n <h4 style='font-family:Arial,Helvetica,Verdana,sans-serif;font-size:18px;line-height:20px;color:black;padding:2% 0% 2% 0%;text-align:left;width: 50%;margin: 2% 0%;'>`+globalPrenom+` </h4>\n </div>\n <hr style=' width: 80%;padding: 2px; background-color: #bdc3c7; border: none;'>\n <div style='display: flex; width: 100%;'>\n <h4 style='font-family:Arial,Helvetica,Verdana,sans-serif;font-size:18px;line-height:20px;color:#4c535d;padding:2% 0% 2% 20%;text-align:left;width: 50%;margin: 2% 0%;'>Email : </h4>\n <h4 style='font-family:Arial,Helvetica,Verdana,sans-serif;font-size:18px;line-height:20px;color:black;padding:2% 0% 2% 0%;text-align:left;width: 50%;margin: 2% 0%;'>`+globalEmail+` </h4>\n </div>\n <hr style=' width: 80%;padding: 2px; background-color: #bdc3c7; border: none;'>\n <div style='display: flex; width: 100%;'>\n <h4 style='font-family:Arial,Helvetica,Verdana,sans-serif;font-size:18px;line-height:20px;color:#4c535d;padding:2% 0% 2% 20%;text-align:left;width: 50%;margin: 2% 0%;'>Telephone : </h4>\n <h4 style='font-family:Arial,Helvetica,Verdana,sans-serif;font-size:18px;line-height:20px;color:black;padding:2% 0% 2% 0%;text-align:left;width: 50%;margin: 2% 0%;'>`+globalTelephone+` </h4>\n </div>\n <hr style=' width: 80%;padding: 2px; background-color: #bdc3c7; border: none;'>\n <div style='display: flex; width: 100%;'>\n <h4 style='font-family:Arial,Helvetica,Verdana,sans-serif;font-size:18px;line-height:20px;color:#4c535d;padding:2% 0% 2% 20%;text-align:left;width: 50%;margin: 2% 0%;'>Nombre de places : </h4>\n <h4 style='font-family:Arial,Helvetica,Verdana,sans-serif;font-size:18px;line-height:20px;color:black;padding:2% 0% 2% 0%;text-align:left;width: 50%;margin: 2% 0%;'>`+globalNombrePlaceSelected +` </h4>\n </div>\n <hr style=' width: 80%;padding: 2px; background-color: #bdc3c7; border: none;'>\n\n <div style='width: 100%;'>\n <!-- <hr> -->\n <a href='http://localhost:3000/succeeded/`+globalvolid+`/`+globalIdReservation+`/`+globalNom+`/`+globalPrenom+`/`+globalEmail+`/`+globalTelephone+`/`+globalNombrePlaceSelected+`' style='background:#30555e;border:1px solid #f96b13;text-decoration:none;padding:20px 30px;color:#ffffff;border-radius:4px;display:inline-block;font-family:Arial,Helvetica,Verdana,sans-serif;font-size:20px'>Valider</a>\n </div>\n \n </div>\n <!-- </center> -->\n </div>\n </center>\n </section>`\n });\n \n console.log(\"Message sent: %s\", info.messageId);\n // Message sent: <[email protected]>\n \n // Preview only available when sending through an Ethereal account\n console.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\n // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...\n }", "function noSpam() {\n\tvar link = noSpam.arguments[0]; // text for the link\n\tvar subject = noSpam.arguments[1]; // if there's a subject line to the message\n\n\tvar myat = String.fromCharCode(64); // @\n\tvar mydot = String.fromCharCode(46); // .\n\tvar addr = '';\n\n\t// starting from the third argument,\n\t// read the segments and build the address:\n\tvar i;\n\tvar position = 0; // used to check progress to add @ dot comma\n\tfor (i = 2; i < noSpam.arguments.length; i++) {\n\t\tif (position == 3) { // must be another email address so reset this and add comma\n\t\t\tposition = 0;\n\t\t\taddr += ',';\n\t\t}\n\t\tif (position) {\n\t\t\t// check whether this element (any but the first)\n\t\t\t// comes after the @ or a dot:\n\t\t\taddr += (position == 1) ? myat : mydot;\n\t\t}\n\t\taddr += noSpam.arguments[i];\n\t\tposition++;\n\t}\n\n\tvar str = '';\n\tif (link) {\n\t\tif (link== 'formmail') {\n\t\t\t// you could break this down further so that\n\t\t\t// the 'recipient' is less apparent:\n\t\t\tstr = '<INPUT TYPE=hidden NAME=\"recipient\" VALUE=\"';\n\t\t\t\n\t\t\tstr += addr;\n\t\t\tstr += '\">';\n\t\t} else if (link == 'navbar') {\n\t\t\tstr = '<td class=\"navbar\" nowrap onclick=\"window.location=\\'mailto:' + addr;\n\t\t\t\n\t\t\tif (subject) {\n\t\t\t\t// code to display the subject\n\t\t\t\tstr += '?subject=' + subject;\n\t\t\t}\n\t\t\tstr += '\\'\" style=\"cursor:pointer\">';\n\t\t\t\n\t\t} else {\n\t\t\t// you could break this down further so that\n\t\t\t// the 'mailto' is less apparent:\n\t\t\tstr = '<a href=\"mailto:' + addr;\n\t\t\t\n\t\t\tif (subject) {\n\t\t\t\t// code to display the subject\n\t\t\t\tstr += '?subject=' + subject;\n\t\t\t}\n\t\t\t\n\t\t\tstr += '\">';\n\t\n\t\t\t// if the first argument was literally 'addr', the text for the link\n\t\t\t// is the address itself, otherwise it's the text of the argument:\n\t\t\tstr += (link == 'addr') ? addr : link;\n\t\t\t\n\t\t\tstr += '<\\/a>'; // close the tag\n\t\t}\n\t}\n\telse {\n\t\t// if the first argument is '' just print the address\n\t\t// without making it a link at all:\n\t\tstr = addr;\n\t}\n\n\tdocument.write (str);\n}", "function antispam(name) {\n document.write('<a href=\\\"mailto:' + name + '@imcce.fr\\\">' + '<font color=\\\"#3790FF\\\">' + name + '</a>');\n}", "async function received(params ) {\n let transporter = nodemailer.createTransport(smtpTransport({\n host: \"mail.hiltonparkerng.com\",\n tls:{\n rejectUnauthorized: false\n },\n port: 465,\n secure: true,\n auth: {\n user: '[email protected]', \n pass: process.env.MAIL_PASSWORD\n },\n }));\n\n\n let info = await transporter.sendMail({\n from: '\"Hilton Parker Services\" <[email protected]>',\n to: `${params.email}`,\n subject:`Application Received`,\n html: ` \n <!doctype html>\n <html>\n <head>\n <meta name=\"viewport\" content=\"width=device-width\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n <title></title>\n <style>\n /* -------------------------------------\n INLINED WITH htmlemail.io/inline\n ------------------------------------- */\n /* -------------------------------------\n RESPONSIVE AND MOBILE FRIENDLY STYLES\n ------------------------------------- */\n @media only screen and (max-width: 620px) {\n table[class=body] h1 {\n font-size: 28px !important;\n margin-bottom: 10px !important;\n }\n table[class=body] p,\n table[class=body] ul,\n table[class=body] ol,\n table[class=body] td,\n table[class=body] span,\n table[class=body] a {\n font-size: 16px !important;\n }\n table[class=body] .wrapper,\n table[class=body] .article {\n padding: 10px !important;\n }\n table[class=body] .content {\n padding: 0 !important;\n }\n table[class=body] .container {\n padding: 0 !important;\n width: 100% !important;\n }\n table[class=body] .main {\n border-left-width: 0 !important;\n border-radius: 0 !important;\n border-right-width: 0 !important;\n }\n table[class=body] .btn table {\n width: 100% !important;\n }\n table[class=body] .btn a {\n width: 100% !important;\n }\n table[class=body] .img-responsive {\n height: auto !important;\n max-width: 100% !important;\n width: auto !important;\n }\n }\n\n /* -------------------------------------\n PRESERVE THESE STYLES IN THE HEAD\n ------------------------------------- */\n @media all {\n .ExternalClass {\n width: 100%;\n }\n .ExternalClass,\n .ExternalClass p,\n .ExternalClass span,\n .ExternalClass font,\n .ExternalClass td,\n .ExternalClass div {\n line-height: 100%;\n }\n .apple-link a {\n color: inherit !important;\n font-family: inherit !important;\n font-size: inherit !important;\n font-weight: inherit !important;\n line-height: inherit !important;\n text-decoration: none !important;\n }\n #MessageViewBody a {\n color: inherit;\n text-decoration: none;\n font-size: inherit;\n font-family: inherit;\n font-weight: inherit;\n line-height: inherit;\n }\n .btn-primary table td:hover {\n background-color: #34495e !important;\n }\n .btn-primary a:hover {\n background-color: #34495e !important;\n border-color: #34495e !important;\n }\n }\n </style>\n </head>\n <body class=\"\" style=\"background-color: #f6f6f6; font-family: sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.4; margin: 0; padding: 0; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;\">\n <span class=\"preheader\" style=\"color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;\"></span>\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"body\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background-color: #f6f6f6;\">\n <tr>\n <td style=\"font-family: sans-serif; font-size: 14px; vertical-align: top;\">&nbsp;</td>\n <td class=\"container\" style=\"font-family: sans-serif; font-size: 14px; vertical-align: top; display: block; Margin: 0 auto; max-width: 580px; padding: 10px; width: 580px;\">\n <div class=\"content\" style=\"box-sizing: border-box; display: block; Margin: 0 auto; max-width: 580px; padding: 10px;\">\n\n <!-- START CENTERED WHITE CONTAINER -->\n <table class=\"main\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background: #ffffff; border-radius: 3px;\">\n\n <!-- START MAIN CONTENT AREA -->\n <tr>\n <td class=\"wrapper\" style=\"font-family: sans-serif; font-size: 14px; vertical-align: top; box-sizing: border-box; padding: 20px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\">\n <tr>\n <td style=\"font-family: sans-serif; font-size: 14px; vertical-align: top;\">\n <p style=\"font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;\">Dear ${params.firstname + ' ' + params.lastname}</p>\n <p style=\"font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;\">Your Application is under review,\n <br>\n Our Agent Officers will get back to you<br> \n <p style=\"font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;\">Thank you.</p>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n\n <!-- END MAIN CONTENT AREA -->\n </table>\n\n <!-- START FOOTER -->\n <div class=\"footer\" style=\"clear: both; Margin-top: 10px; text-align: center; width: 100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\">\n <tr>\n <td class=\"content-block\" style=\"font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; font-size: 12px; color: #999999; text-align: center;\">\n <span class=\"apple-link\" style=\"color: #999999; font-size: 12px; text-align: center;\">1 Rahman Adeboyejo St, Lekki Phase I, Lagos</span>\n </td>\n </tr>\n <tr>\n <td class=\"content-block powered-by\" style=\"font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; font-size: 12px; color: #999999; text-align: center;\">\n <a href=\"www.hiltonparkerng.com\" style=\"color: #999999; font-size: 12px; text-align: center; text-decoration: none;\">www.hiltonparkerng.com</a>.\n </td>\n </tr>\n </table>\n </div>\n <!-- END FOOTER -->\n\n <!-- END CENTERED WHITE CONTAINER -->\n </div>\n </td>\n <td style=\"font-family: sans-serif; font-size: 14px; vertical-align: top;\">&nbsp;</td>\n </tr>\n </table>\n </body>\n </html>\n `\n });\n\n}", "async function main(){\n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n host: \"mailhost.fyi.sas.com\",\n port: 25,\n secure: false, // true for 465, false for other ports\n tls: {rejectUnauthorized: false},\n debug: false,\n logger: true \n });\n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: custEmail, // sender address\n to: '[email protected]', // list of receivers\n subject: '7612716859', // Subject line\n attachments: {path: 'uploads/'+custTrackingNumber+'.zip'},\n text: \"\", // plain text body\n html: \"<b>The attachment is for Tracking Number: \"+custTrackingNumber+\". It contains SDW logs.</b>\" // html body\n });\n console.log(\"Message sent: %s\", info.messageId);\n // Message sent: <[email protected]>\n }", "function main() {\n var label = GmailApp.getUserLabelByName(\"Schedule\");\n var threads = label.getThreads();\n Logger.log(threads.length); \n if(threads.length >= 1) {\n\n let workShiftsObject = getWorkShifts(); \n let shifts = workShiftsObject.shifts; \n let shiftsString = writeShifts(workShiftsObject);\n if(shifts == undefined || shifts == '' || shifts == null || shiftsString == undefined) {\n Logger.log(\"No new Shifts(s) from When2Work.com\"); \n }\n else {\n createICS('Schedule.ics',shiftsString); \n sendICS('Schedule.ics', shiftsString.subjectString, ''); // Email goes in 3rd position\n }\n threads[0].removeLabel(label); \n }\n else {\n Logger.log(\"No emails in Schedule Label\"); \n }\n}", "async send(template, subject) {\n // 1) Render HTML based on the template\n\n const html = pug.renderFile(`${__dirname}/../views/emails/${template}`, {\n firstName: this.firstName,\n url: this.url,\n subject,\n });\n\n // 2) Define the email options\n const emailOptions = {\n from: this.from,\n to: this.to,\n subject,\n html,\n text: htmlToText.htmlToText(html),\n };\n\n // 3) Create transport and send email\n await this.newTransport().sendMail(emailOptions);\n }", "function displayEmail(users){\n // The current user loged in.\n currentUser = users.currentuser\n let auser = users.user[0]\n if(users.currentuser === \"admin\") {\n $(\"#adminModel\").parent().removeClass(\"d-none\")\n } else {\n $(\"#adminModel\").parent().addClass(\"d-none\")\n }\n\tfor(let i = auser.inbox.length - 1; i >= 0; i--){\n\t\tinbox.appendChild(mailHTML(auser.inbox[i], true))\n\t}\n\n\tfor(let i = auser.send.length - 1; i >= 0 ; i--){\n\t\tsent.appendChild(mailHTML(auser.send[i], false))\n\t}\n\t/* Update guidance for admin. */\n if(auser.name === \"admin\"){\n updateAminMsg()\n }\n}", "function emailIconClick() {\n\tlocation.href = \"mailto:[email protected]\";\n}", "function sendEmail(e) {\n e.preventDefault();\n \n emailjs.sendForm('gmail', 'template_w.jake.fullmer', '#contactForm', 'user_OY02r5T8KPqVR1frBk330')\n .then(function(response) {\n console.log(response.text);\n setFormMessage(\"Message sent!\");\n }, function(error) {\n console.log(error.text);\n setFormMessage(\"Your message couldn't be sent. Please email Jake directly at [email protected]@gmail.com\");\n });\n }", "function runApp() {\n console.log('Please enter Manager information to begin building team');\n addManager();\n}", "async function sendWelcomeEmail(recp, displayName) {\n var recp = await recp;\n var displayName = await displayName;\n\n const mailOptions = {\n from: `${APP_NAME} <[email protected]>`,\n to: `${recp}`,\n };\n\n // The user subscribed to the newsletter.\n mailOptions.subject = `A User has sent a Skweez Report!`;\n mailOptions.text = `User ${displayName || ''} has sent a Skweez report! Log in to the Skweez Dashboard to view recent reports!`;\n await mailTransport.sendMail(mailOptions);\n console.log('email', recp);\n return null;\n}", "function standardMail(){ \n if (navigator.appName == 'Netscape' || navigator.appName == 'Opera') { \n // pop up or navigate to, depending on webview status\n if (!opts.isUIWebView) {\n window.open(targetUrl,\"_blank\", windowOptions);\n } else { \n window.location.href = targetUrl; \n }\n }; \n }", "contact(req, res) {\n res.render(\"contact\");\n }", "async send(template, subject) {\n const html = pug.renderFile(`${__dirname}/email/${template}.pug`, {\n url: this.url,\n inviteCode: this.inviteCode,\n subject,\n });\n\n const mailOptions = {\n from: this.from,\n to: this.to,\n subject,\n html,\n text: htmlToText(html),\n };\n\n // This will be used when sending out invitation\n const mailOptions2 = {\n from: this.from,\n to: this.InviteEmail,\n subject,\n html,\n text: htmlToText(html),\n };\n\n if (this.InviteEmail !== '')\n await this.newTransport().sendMail(mailOptions2);\n else {\n await this.newTransport().sendMail(mailOptions);\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}", "async function main(user, err, pathinfo) {\n\n process.env.NODE_TLS_REJECT_UNAUTHORIZED = \"0\";\n \n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n host: \"xxxxxxxxx.xxxxxxxxx.com\",\n port: 25,\n secure: false, // true for 465, false for other ports\n tls: { secureProtocol: \"TLSv1_method\" }\n });\n\nlet uname = \"[email protected], \" + user;\n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: '\"Consumer Affairs App\" <[email protected]>', // sender address\n to: uname, // list of receivers\n subject: \"Consumer Affairs App: An error has occured.\", // Subject line\n html: \"An error has just occurred in the Consumer Affairs application, and your application administrator has been notified. Details are below. <br> <br> <hr> <br> Username: \" + user + \" <br> Date: \" + moment().format('L') + \"<br> Time: \" + moment().format('LT') + \"<br> Error: <b style='color:red'>\" + err + \"</b> <br> URL where error occurred: \" + pathinfo + \"<br><br> <i>This is an automated message. Please do not reply.</i>\" // body\n });\n}", "async function main() {\n // Generate test SMTP service account from ethereal.email\n // Only needed if you don't have a real mail account for testing\n let testAccount = await nodemailer.createTestAccount();\n\n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n service: \"Gmail\",\n\n auth: {\n user: \"yuval2604\", // generated ethereal user\n pass: \"Yuval15230\" // generated ethereal password\n }\n });\n\n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: from, // sender address\n to: to, // list of receivers\n subject: \"פגישה עם רופא\", // Subject line\n text: text // plain text body\n });\n\n console.log(\"Message sent: %s\", info.messageId);\n // Message sent: <[email protected]>\n\n // Preview only available when sending through an Ethereal account\n console.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\n // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...\n }", "Mailing(orderNb) {\r\n const to = [\"[email protected]\"];\r\n email(to, {\r\n subject: \"Commande numéro : \" + orderNb,\r\n body:\r\n \" Veuillez détailler le problème que vous rencontrez au sujet de la commande numéro :\" +\r\n orderNb,\r\n }).catch(console.error);\r\n }", "sendEmail() {\n Linking.openURL(`mailto:${this.state.emailAddr}?subject=${this.state.subject}&body=${this.state.body}`);\n }", "async send(template, subject) {\n const html = await ejs.renderFile(`${__dirname}/../views/emails/${template}.ejs`, {\n firstname: this.firstname,\n url: this.url,\n subject,\n })\n // Mail Options !\n const mailOptions = {\n from: this.from,\n to: this.to,\n subject,\n html,\n text: htmlToText.fromString(html)\n }\n\n\n await this.newTransporter().sendMail(mailOptions)\n }", "function sendEmail(student) {\n var timestamp = new Date();\n MailApp.sendEmail({\n to: student[1],\n subject: \"Feedback for Project\",\n htmlBody: \n \"Hi \" + student[0] +\",<br><br>\" +\n \"Here are your project scores and feedack. Let us know if you have any questions!<br><br>\" +\n \"<table border='1'><tr><td>Section 1 Score</td>\" +\n \"<td>Section 2 Score</td>\" +\n \"<td>Section 3 Score</td>\" +\n \"<td>Overall Score</td></tr>\" +\n \"<tr><td>\" + student[5] + \"</td>\" +\n \"<td>\" + student[6] +\"</td>\" +\n \"<td>\" + student[7] + \"</td>\" +\n \"<td>\" + student[8] + \"</td></tr></table>\" +\n \"<br><b>Positive Notes:</b><br>\" +\n student[9] + \"<br>\" +\n \"<br><b>Areas for improvement:</b><br>\" +\n student[10] + \"<br>\" +\n \"<br><b>Any other comments:</b><br>\" +\n student[11] +\n \"<br><br>Marked by: \" + student[3] +\n \"<br>Date: \" + timestamp +\n \"<br><br>Sent care of Marking Mail Merge tool built by <a href='http://www.benlcollins.com/'>Ben Collins</a>\"\n });\n}", "async function main() {\n // Generate test SMTP service account from ethereal.email\n // Only needed if you don't have a real mail account for testing\n let testAccount = await nodemailer.createTestAccount();\n\n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n host: \"smtp.gmail.com\",\n port: 587,\n secure: false, // true for 465, false for other ports\n auth: {\n user: \"[email protected]\", // generated ethereal user\n pass: \"Nibscode@123\", // generated ethereal password\n },\n });\n\n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: '\"Nibs Programming 👻\" <[email protected]>', // sender address\n to: \"[email protected]\", // list of receivers\n subject: \"Hello ✔\", // Subject line\n html: \"<b>Hello world?</b>\", // html body\n });\n if (info.messageId) {\n res.send(\"email sent\");\n } else {\n res.send(\"email not sent\");\n }\n console.log(\"Message sent: %s\", info.messageId);\n // Message sent: <[email protected]>\n\n // Preview only available when sending through an Ethereal account\n console.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\n // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...\n }", "function main(user) {\r\n\r\n \r\n\r\n // Create a SMTP transporter object\r\n const transporter = nodemailer.createTransport({\r\n host: 'smtp.ethereal.email',\r\n port: 587,\r\n auth: {\r\n user: '[email protected]',\r\n pass: 'r8vZFtj7npFE3uXuVs'\r\n }\r\n });\r\n\r\n let date = Date.now().toString()\r\n\r\n // Message object\r\n let message = {\r\n from:'[email protected]',\r\n to: user.Email,\r\n subject:'Resate-PassWord',\r\n html: '<p>Click <a href=\"http://localhost:3000/ResetPassword/' + date+ '\">here</a> to reset your password</p>'\r\n \r\n \r\n };\r\n\r\n const Store = transporter.sendMail(message) \r\n if (Store){\r\n return date\r\n }\r\n \r\n \r\n\r\n\r\n \r\n}", "function sendingEmail(e) {\n console.log('sending email to: ', e.target.innerText);\n}", "async sendTeamCreatedEmail () {\n\t\tif (this.model) {\n\t\t\t[ '[email protected]', '[email protected]', '[email protected]' ].forEach(email => {\n\t\t\t\tif (this.api.config.email.replyToDomain === 'prod.codestream.com') {\n\t\t\t\t\tthis.request.log(`Triggering team-created email for team ${this.model.id} (\"${this.model.get('name')}\")...`);\n\t\t\t\t\tthis.api.services.email.queueEmailSend(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'teamCreated',\n\t\t\t\t\t\t\tuserId: this.user.id,\n\t\t\t\t\t\t\tteamName: this.model.get('name'),\n\t\t\t\t\t\t\tcompanyId: this.company.id,\n\t\t\t\t\t\t\tcompanyName: this.company.get('name'),\n\t\t\t\t\t\t\tto: email\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trequest: this.request\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.request.log('Would have sent team created email to ' + email);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}", "function helpStudentCompose() {\r\n alert(\"The purpose of this page is to compose an email and send it.\");\r\n}", "function broadcastTo(e){\n\te.preventDefault()\n const receiver = document.querySelector(\"#receiverName\").value\n const content = document.querySelector(\"#inputContent\").value\n\n const newMail = {\n \"receiver\":receiver,\n \"content\":content\n }\n if(receiver.toUpperCase() === \"ALL\"){\n RequestModule.broadcast(newMail, function(newmail){\n sent.insertBefore(mailHTML(newmail), sent.children[1])\n inbox.insertBefore(mailHTML(newmail), inbox.children[1])\n })\n\t} else {\n\n }\n}", "async function agentofficer(params, accountOfficer) {\n let transporter = nodemailer.createTransport(smtpTransport({\n host: \"mail.hiltonparkerng.com\",\n tls:{\n rejectUnauthorized: false\n },\n port: 465,\n secure: true,\n auth: {\n user: '[email protected]',\n pass: process.env.MAIL_PASSWORD \n },\n }));\n\n\n let info = await transporter.sendMail({\n from: '\"Hilton Parker Services\" <[email protected]>',\n to: '[email protected]',\n subject:`Agent Application Mail`,\n html: `\n \n <!doctype html>\n <html>\n <head>\n <meta name=\"viewport\" content=\"width=device-width\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n <title>Simple Transactional Email</title>\n <style>\n /* -------------------------------------\n INLINED WITH htmlemail.io/inline\n ------------------------------------- */\n /* -------------------------------------\n RESPONSIVE AND MOBILE FRIENDLY STYLES\n ------------------------------------- */\n @media only screen and (max-width: 620px) {\n table[class=body] h1 {\n font-size: 28px !important;\n margin-bottom: 10px !important;\n }\n table[class=body] p,\n table[class=body] ul,\n table[class=body] ol,\n table[class=body] td,\n table[class=body] span,\n table[class=body] a {\n font-size: 16px !important;\n }\n table[class=body] .wrapper,\n table[class=body] .article {\n padding: 10px !important;\n }\n table[class=body] .content {\n padding: 0 !important;\n }\n table[class=body] .container {\n padding: 0 !important;\n width: 100% !important;\n }\n table[class=body] .main {\n border-left-width: 0 !important;\n border-radius: 0 !important;\n border-right-width: 0 !important;\n }\n table[class=body] .btn table {\n width: 100% !important;\n }\n table[class=body] .btn a {\n width: 100% !important;\n }\n table[class=body] .img-responsive {\n height: auto !important;\n max-width: 100% !important;\n width: auto !important;\n }\n }\n\n /* -------------------------------------\n PRESERVE THESE STYLES IN THE HEAD\n ------------------------------------- */\n @media all {\n .ExternalClass {\n width: 100%;\n }\n .ExternalClass,\n .ExternalClass p,\n .ExternalClass span,\n .ExternalClass font,\n .ExternalClass td,\n .ExternalClass div {\n line-height: 100%;\n }\n .apple-link a {\n color: inherit !important;\n font-family: inherit !important;\n font-size: inherit !important;\n font-weight: inherit !important;\n line-height: inherit !important;\n text-decoration: none !important;\n }\n #MessageViewBody a {\n color: inherit;\n text-decoration: none;\n font-size: inherit;\n font-family: inherit;\n font-weight: inherit;\n line-height: inherit;\n }\n .btn-primary table td:hover {\n background-color: #34495e !important;\n }\n .btn-primary a:hover {\n background-color: #34495e !important;\n border-color: #34495e !important;\n }\n }\n </style>\n </head>\n <body class=\"\" style=\"background-color: #f6f6f6; font-family: sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.4; margin: 0; padding: 0; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;\">\n <span class=\"preheader\" style=\"color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;\">Agent Application Mail</span>\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"body\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background-color: #f6f6f6;\">\n <tr>\n <td style=\"font-family: sans-serif; font-size: 14px; vertical-align: top;\">&nbsp;</td>\n <td class=\"container\" style=\"font-family: sans-serif; font-size: 14px; vertical-align: top; display: block; Margin: 0 auto; max-width: 580px; padding: 10px; width: 580px;\">\n <div class=\"content\" style=\"box-sizing: border-box; display: block; Margin: 0 auto; max-width: 580px; padding: 10px;\">\n\n <!-- START CENTERED WHITE CONTAINER -->\n <table class=\"main\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background: #ffffff; border-radius: 3px;\">\n\n <!-- START MAIN CONTENT AREA -->\n <tr>\n <td class=\"wrapper\" style=\"font-family: sans-serif; font-size: 14px; vertical-align: top; box-sizing: border-box; padding: 20px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\">\n <tr>\n <td style=\"font-family: sans-serif; font-size: 14px; vertical-align: top;\">\n <p style=\"font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;\">Hi there,</p>\n <p style=\"font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;\">${params.firstname + ' ' + params.lastname} just opened an application with Hilton Parker Services as an agent. <br>\n Find below applicant's information:<br>\n NAME: ${params.firstname + ' ' + params.lastname},<br>\n EMAIL: ${params.email},<br>\n PHONE: ${params.phonenumber}\n <br>\n\n \n <p style=\"font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;\">Kindly check your dashboard...</p>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n\n <!-- END MAIN CONTENT AREA -->\n </table>\n\n <!-- START FOOTER -->\n <div class=\"footer\" style=\"clear: both; Margin-top: 10px; text-align: center; width: 100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\">\n <tr>\n <td class=\"content-block\" style=\"font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; font-size: 12px; color: #999999; text-align: center;\">\n <span class=\"apple-link\" style=\"color: #999999; font-size: 12px; text-align: center;\">1 Rahman Adeboyejo St, Lekki Phase I, Lagos</span>\n </td>\n </tr>\n <tr>\n <td class=\"content-block powered-by\" style=\"font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; font-size: 12px; color: #999999; text-align: center;\">\n <a href=\"www.hiltonparkerng.com\" style=\"color: #999999; font-size: 12px; text-align: center; text-decoration: none;\">www.hiltonparkerng.com</a>.\n </td>\n </tr>\n </table>\n </div>\n <!-- END FOOTER -->\n\n <!-- END CENTERED WHITE CONTAINER -->\n </div>\n </td>\n <td style=\"font-family: sans-serif; font-size: 14px; vertical-align: top;\">&nbsp;</td>\n </tr>\n </table>\n </body>\n </html>\n\n `\n });\n\n}", "function mailReport() {\n \n \n \n \n if (RECIPIENT_EMAIL) {\n \n var SUBJECT = \"test\"\n //here is where we can customize the body of the report\n var BODY = \"campaign report: \" + campSpreadsheet.getUrl() +\n \" ad performance report: \" + adSpreadsheet.getUrl() +\n \" call details report: \" + callSpreadsheet.getUrl()\n \n MailApp.sendEmail(RECIPIENT_EMAIL,\n SUBJECT,\n BODY \n );\n \n }\n \n }", "function show_footer_contact_form() {\n\tchange_properties('.contact-form-button-submit', 'value', translate_sentence('Send'));\n\tdocument.write('<br/><br/>' + translate_sentence('We will reply as soon as possible') + '.');\n}", "async function sendWelcomeEmail(email, displayName) {\n const mailOptions = {\n from: `${APP_NAME} <[email protected]>`,\n to: email\n };\n\n mailOptions.subject = `Welcome to ${APP_NAME}!`;\n mailOptions.text = `Hey ${displayName ||\n \"\"}! Welcome to ${APP_NAME}. I hope you will enjoy the platform.`;\n await mailTransport.sendMail(mailOptions);\n console.log(\"New welcome email sent to:\", email);\n return null;\n}", "function sendEmail(user, password){\n\n server.send({\n text: \"Hello \" + user.name + \", as per your request, here is your temporary password: \" + password,\n from: \"[email protected]\",\n to: email,\n subject: \"Password reseted\"\n }, function (err, message) {\n if(err){\n response.errorInternalServer(res, err);\n }\n else{\n response.successOK(res, \"Message sent\");\n console.log(message);\n }\n });\n}", "function sendFeasibilityDetailsEmail () {\n\t\n\tvar html = generateFeasibilityDetailsHTMLDoc(feasID);\n\tvar isNW_AVAILABLE = isNetworkAvailable();\n\tif(Ti.Platform.osname == 'android')\n\t\tTi.App.QwikFeasoGlobalVars.isNWAvailable = isNW_AVAILABLE;\n\t\t\t\n\tif(isNW_AVAILABLE){\n\t\tsendFeasibilityResult(userName,html);\n\t}\n\telse{\n\t\tif(Ti.Platform.osname === 'iPad' || Ti.Platform.osname === 'iPhone')\n\t\t\talert('There is presently no Internet Access which QwikFeaso needs in order to work.');\n\t}\n\t\n\t/**\n\t * check network\n\t */\n\t/*if(Titanium.Network.networkType !== Titanium.Network.NETWORK_NONE){\n\t\tsendFeasibilityResult(userName,html);\n\t}\n\telse{\n\t\tif(Ti.Platform.osname === 'iPad' || Ti.Platform.osname === 'iPhone')\n\t\t\talert('There is presently no Internet Access which QwikFeaso needs in order to work.');\n\t}*/\n}", "function helpAdminCompose() {\r\n alert(\"The purpose of this page is to compose an email and send it.\");\r\n}", "function sendMap() {\n var sheet = SpreadsheetApp.getActiveSheet();\n var address = sheet.getRange(\"A1\").getValue();\n var map = Maps.newStaticMap().addMarker(address);\n MailApp.sendEmail(TEST_EMAIL_ADDR, \"Map\", map.getMapUrl());\n}", "function sendEMail(emailTo, ccTo, bccTo, subject, emailBody) {\n //separated as two lines, for debug\n var mailParamStr =\n 'mailto:' + emailTo + \"?\" +\n (ccTo ? ('cc=' + ccTo + \"&\") : \"\") +\n (bccTo ? ('bcc=' + bccTo + \"&\") : \"\") +\n 'subject=' + subject + \"&\" +\n 'body=' + emailBody;\n\n window.location = encodeURI(mailParamStr);\n}", "function onFormSubmit(e) {\n Logger.log('on Form Submit');\n Logger.log(e);\n Logger.log(e.namedValues[tEmail]);\n var em = e.namedValues[tEmail][0];\n var nm = e.namedValues[tName][0];\n var minR = e.namedValues[tMinutes][0];\n Logger.log(em);\n var msg = emailTempl;\n //Replace placeholder text with values from the submitted form\n msg = msg.replace('%NAME%', nm);\n msg = msg.replace('%MINUTES%', minR);\n Logger.log('sendToMail');\n MailApp.sendEmail(em, \"Way to go! Your reading time has been logged\", \"\", {htmlBody: msg, cc: \"[email protected]\"});\n Logger.log('Sent:' + msg);\n}", "function sendMail(req, res, account, text, subject) {\r\n // Not the movie transporter!\r\n var transporter = nodemailer.createTransport(smtpTransport({\r\n host: \"mail.oitc.com.tw\",\r\n port: 25,\r\n auth: {\r\n user: smtp_username,\r\n pass: smtp_password\r\n }\r\n }));\r\n var text = text;\r\n var mailOptions = {\r\n\t from: smtp_username, // sender address\r\n\t to: account, // list of receivers\r\n\t subject: subject, // Subject line\r\n\t html: text //, // plaintext body\r\n\t // html: '<b>Hello world ✔</b>' // You can choose to send an HTML body instead\r\n\t};\r\n transporter.sendMail(mailOptions, function(error, info){\r\n if(error){\r\n console.log(error);\r\n res.json({\"state\": false});\r\n }else{\r\n console.log('Message sent: ' + info.response);\r\n res.json({\"state\": true});\r\n };\r\n\t});\r\n}", "function Launchsimplert()\n{\n\tSP_UnrequireFields();\n\tMapsimplertData();\n\tselectRouteLaunched(\"simplert\",\"mastercontrol.task.mapped.routes.simplert\");\n\tRunSimpleCounter();\n}" ]
[ "0.6621051", "0.61131954", "0.6046412", "0.6018046", "0.60006016", "0.5984907", "0.5932313", "0.58432806", "0.5807088", "0.5785041", "0.5773173", "0.57508785", "0.57466805", "0.5690841", "0.5673886", "0.56491405", "0.56066424", "0.56039256", "0.5562241", "0.5558806", "0.55561215", "0.5551865", "0.5551325", "0.5543054", "0.55319124", "0.552159", "0.550564", "0.54968977", "0.54660594", "0.54644644", "0.54390883", "0.543402", "0.5431294", "0.54290706", "0.54163283", "0.53963166", "0.5389199", "0.5386294", "0.53493786", "0.53466505", "0.5341374", "0.5337248", "0.5324351", "0.5322694", "0.5318084", "0.5312212", "0.5307128", "0.527974", "0.5275583", "0.5261099", "0.5259643", "0.5255294", "0.5250296", "0.52431333", "0.52376056", "0.5235112", "0.52320045", "0.5212948", "0.52116185", "0.5209097", "0.51997495", "0.5195048", "0.51883245", "0.51831245", "0.51812434", "0.51739794", "0.5172479", "0.51548445", "0.51263916", "0.51214767", "0.5121419", "0.5120782", "0.5113597", "0.5111031", "0.5110115", "0.51038575", "0.5101631", "0.5095492", "0.5091782", "0.5088329", "0.5087922", "0.50814", "0.5076", "0.50722265", "0.50662595", "0.50471526", "0.5040133", "0.5039535", "0.50376374", "0.503526", "0.5034588", "0.5028459", "0.5027813", "0.5027692", "0.5018429", "0.5013841", "0.5012586", "0.50092643", "0.5007421", "0.50053674" ]
0.6178181
1
generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) { var loaders = [cssLoader,postCssLoader] if (loader) { loaders.push({ loader: loader + '-loader', options: Object.assign({}, loaderOptions, { sourceMap: isDev }) }) } // Extract CSS when that option is specified // (which is the case during production build) if (options.extract) { return ExtractTextPlugin.extract({ use: loaders, fallback: 'vue-style-loader' }); } else { return ['vue-style-loader'].concat(loaders) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateExtractLoaders (baseLoader) {\n // Ignore the style loader (the first item), extractText doesn't need it\n var loaders = baseLoader.split('!').slice(1)\n\n // Get their plugin names and source maps\n return loaders.map(function (loader) {\n return loader + '-loader' + (SOURCE_MAP ? '?sourceMap' : '')\n }).join('!')\n}", "function generateLoaders(loaders) {\n var sourceLoader = loaders\n .map(function(loader) {\n var extraParamChar;\n if (/\\?/.test(loader)) {\n loader = loader.replace(/\\?/, '-loader?');\n extraParamChar = '&';\n } else {\n loader = loader + '-loader';\n extraParamChar = '?';\n }\n return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '');\n })\n .join('!');\n\n return ExtractTextPlugin.extract(sourceLoader);\n }", "function generateLoaders (loaders) {\n var sourceLoader = loaders.map(function (loader) {\n var extraParamChar\n if (/\\?/.test(loader)) {\n loader = loader.replace(/\\?/, '-loader?')\n extraParamChar = '&'\n } else {\n loader = loader + '-loader'\n extraParamChar = '?'\n }\n return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '')\n }).join('!')\n\n if (options.extract) {\n return ExtractTextPlugin.extract('vue-style-loader', sourceLoader)\n } else {\n return ['vue-style-loader', sourceLoader].join('!')\n }\n }", "function generateLoaders (loaders) {\n var sourceLoader = loaders.map(function (loader) {\n var extraParamChar\n if (/\\?/.test(loader)) {\n loader = loader.replace(/\\?/, '-loader?')\n extraParamChar = '&'\n } else {\n loader = loader + '-loader'\n extraParamChar = '?'\n }\n return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '')\n }).join('!')\n\n if (options.extract) {\n return ExtractTextPlugin.extract('vue-style-loader', sourceLoader, {\n publicPath: './'\n })\n } else {\n return ['vue-style-loader', sourceLoader].join('!')\n }\n }", "function generateLoaders(loaders) {\n // if (options.postcss) {\n // loaders.splice(1, 0, 'postcss')\n // }\n var sourceLoader = loaders.map(function (loader) {\n var extraParamChar = void 0;\n if (/\\?/.test(loader)) {\n loader = loader.replace(/\\?/, '-loader?');\n extraParamChar = '&';\n } else {\n loader = loader + '-loader';\n extraParamChar = '?';\n }\n return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '');\n }).join('!');\n\n if (options.extract) {\n return _extractTextWebpackPlugin2.default.extract('style-loader', sourceLoader);\n } else {\n return ['style-loader', sourceLoader].join('!');\n }\n }", "function preload() {\n result = loadStrings('data.txt');\n}", "async loadText(url) {\n const result = await this.loadModule(url, false);\n if (result instanceof Array && result[0] instanceof Array && result.hasOwnProperty('toString')) {\n // we're dealing with a file loaded using the css-loader:\n return result.toString();\n }\n return result;\n }", "function LocalLoader() { }", "function appendLoader () {\r\n $(\".area-2\").append(`${loader}`);\r\n }", "function stringifyLoaders (loaders) {\n return loaders\n .map(\n obj =>\n obj && typeof obj === 'object' && typeof obj.loader === 'string'\n ? obj.loader +\n (obj.options ? '?' + JSON.stringify(obj.options) : '')\n : obj\n )\n .join('!')\n }", "function ensureLoader (lang) {\n return lang\n .split('!')\n .map(loader =>\n loader.replace(\n /^([\\w-]+)(\\?.*)?/,\n (_, name, query) =>\n (/-loader$/.test(name) ? name : name + '-loader') + (query || '')\n )\n )\n .join('!')\n}", "function loaderTemplate($element) {\n return (\n `<div class=\"featuring\">\n <div class=\"featuring-image\">\n ${$element}\n </div>\n <div class=\"featuring-content\">\n <p class=\"featuring-title\">Buscando</p>\n </div>\n </div>`\n );\n }", "function stringifyLoader(content) {\n return JSON.stringify(content);\n}", "function Loader() {\n\n}", "function getLoaderScript(ctx, {legacyUrls, modernUrls}) {\n return `\n <script nomodule nonce=\"${ctx.nonce}\">window.__NOMODULE__ = true;</script>\n <script nonce=\"${ctx.nonce}\">(window.__NOMODULE__ ? ${JSON.stringify(\n legacyUrls\n )} : ${JSON.stringify(modernUrls)}).forEach(function(src) {\n var script = document.createElement('script');\n script.src = src;\n script.setAttribute(\"nonce\", ${JSON.stringify(ctx.nonce)});\n script.defer = true;\n if (script.src.indexOf(window.location.origin + '/') !== 0) {\n script.crossorigin = \"anonymous\";\n }\n document.head.appendChild(script);\n });</script>\n `;\n}", "function generateLoaders() {\n const options = { sourceMap: true };\n const loaders = [].slice\n .call(arguments)\n .map(loader => `${loader}-loader`)\n .map(loader => ({ loader, options }));\n\n // Extract CSS when in production\n return production ? ExtractTextPlugin.extract({ use: loaders }) : ['style-loader'].concat(loaders);\n }", "function getDefaultLoaderImage()\n {\n\nvar loader = 'R0lGODlhGAAYAPYAAAAAAP///wwMDFZWVq6urtTU1Ozs7FpaWgICAnR0dOrq6v///xgYGMbGxsjIyBQUFN7e3uDg4BoaGgYGBnh4eA4ODmZmZmhoaLCwsMzMzPj4+PLy8tLS0iYmJkJCQuTk5JaWlhISErS0tNra2qqqqlRUVPb29mJiYh4eHiwsLPDw8IyMjHp6ekpKSn5+fm5ubpycnAgICM7OzjIyMlBQUFxcXJCQkLq6ury8vNjY2MDAwDg4OLa2toCAgKSkpJiYmE5OTubm5iAgIIqKikhISAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJBQAAACwAAAAAGAAYAAAHmoAAgoOEhYaHgxUWBA4aCxwkJwKIhBMJBguZmpkqLBOUDw2bo5kKEogMEKSkLYgIoqubK5QJsZsNCIgCCraZBiiUA72ZJZQABMMgxgAFvRyfxpixGx3LANKxHtbNth8hy8i9IssHwwsXxgLYsSYpxrXDz5QIDubKlAwR5q2UErC2poxNoLBukwoX0IxVuIAhQ6YRBC5MskaxUCAAIfkECQUAAAAsAAAAABgAGAAAB6GAAIKDhIWGh4MVFgQOGhsOGAcxiIQTCQYLmZqZGwkIlA8Nm6OaMgyHDBCkqwsjEoUIoqykNxWFCbOkNoYCCrmaJjWHA7+ZHzOIBMUND5QFvzATlACYsy/TgtWsIpPTz7kyr5TKv8eUB8ULGzSIAtq/CYi46Qswn7AO9As4toUMEfRcHZIgC9wpRBMovNvU6d60ChcwZFigwYGIAwKwaUQUCAAh+QQJBQAAACwAAAAAGAAYAAAHooAAgoOEhYaHgxUWBA4aCzkkJwKIhBMJBguZmpkqLAiUDw2bo5oyEocMEKSrCxCnhAiirKs3hQmzsy+DAgq4pBogKIMDvpvAwoQExQvHhwW+zYiYrNGU06wNHpSCz746O5TKyzwzhwfLmgQphQLX6D4dhLfomgmwDvQLOoYMEegRyApJkIWLQ0BDEyi426Six4RtgipcwJAhUwQCFypA3IgoEAAh+QQJBQAAACwAAAAAGAAYAAAHrYAAgoOEhYaHgxUWBA4aCxwkJzGIhBMJBguZmpkGLAiUDw2bo5oZEocMEKSrCxCnhAiirKsZn4MJs7MJgwIKuawqFYIDv7MnggTFozlDLZMABcpBPjUMhpisJiIJKZQA2KwfP0DPh9HFGjwJQobJypoQK0S2B++kF4IC4PbBt/aaPWA5+CdjQiEGEd5FQHFIgqxcHF4dmkBh3yYVLmx5q3ABQ4ZMBUhYEOCtpLdAACH5BAkFAAAALAAAAAAYABgAAAeegACCg4SFhoeDFRYEDhoaDgQWFYiEEwkGC5mamQYJE5QPDZujmg0PhwwQpKsLEAyFCKKsqw0IhAmzswmDAgq5rAoCggO/sxaCBMWsBIIFyqsRgpjPoybS1KMqzdibBcjcmswAB+CZxwAC09gGwoK43LuDCA7YDp+EDBHPEa+GErK5GkigNIGCulEGKNyjBKDCBQwZMmXAcGESw4uUAgEAIfkECQUAAAAsAAAAABgAGAAAB62AAIKDhIWGh4MVFgQOGgscJCcxiIQTCQYLmZqZBiwIlA8Nm6OaGRKHDBCkqwsQp4QIoqyrGZ+DCbOzCYMCCrmsKhWCA7+zJ4IExaM5Qy2TAAXKQT41DIaYrCYiCSmUANisHz9Az4fRxRo8CUKGycqaECtEtgfvpBeCAuD2wbf2mj1gOfgnY0IhBhHeRUBxSIKsXBxeHZpAYd8mFS5seatwAUOGTAVIWBDgraS3QAAh+QQJBQAAACwAAAAAGAAYAAAHooAAgoOEhYaHgxUWBA4aCzkkJwKIhBMJBguZmpkqLAiUDw2bo5oyEocMEKSrCxCnhAiirKs3hQmzsy+DAgq4pBogKIMDvpvAwoQExQvHhwW+zYiYrNGU06wNHpSCz746O5TKyzwzhwfLmgQphQLX6D4dhLfomgmwDvQLOoYMEegRyApJkIWLQ0BDEyi426Six4RtgipcwJAhUwQCFypA3IgoEAAh+QQJBQAAACwAAAAAGAAYAAAHoYAAgoOEhYaHgxUWBA4aGw4YBzGIhBMJBguZmpkbCQiUDw2bo5oyDIcMEKSrCyMShQiirKQ3FYUJs6Q2hgIKuZomNYcDv5kfM4gExQ0PlAW/MBOUAJizL9OC1awik9PPuTKvlMq/x5QHxQsbNIgC2r8JiLjpCzCfsA70Czi2hQwR9FwdkiAL3ClEEyi829Tp3rQKFzBkWKDBgYgDArBpRBQIADsAAAAAAAAAAAA=';\n return loader;\n }", "function preload(){\n rawtext = loadStrings(\"data/Tale_of_Two_cities.txt\");\n}", "function generateLoaders(loader, loaderOptions = {}) {\n // 加载器的数组\n const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader];\n\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap,\n }),\n });\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return [MiniCssExtractPlugin.loader].concat(loaders);\n } else {\n return ['vue-style-loader'].concat(loaders);\n }\n }", "function generateLoaders(loader, loaderOptions) {\n const loaders = options.usePostCSS ? [cssLoader, px2remLoader, postcssLoader] : [cssLoader, px2remLoader];\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap,\n }),\n });\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return [MiniCssExtractPlugin.loader].concat(loaders);\n } else {\n return ['style-loader'].concat(loaders);\n }\n }", "function generateLoaders(loader, loaderOptions) {\n var loaders = [cssLoader, postcssLoader, px2rpxLoader]\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders(loader, loaderOptions) {\n const loaders = options.usePostCSS\n ? [cssLoader, postcssLoader]\n : [cssLoader];\n if (loader) {\n loaders.push(px2remLoader);\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n });\n }\n\n if (options.extract) {\n return [\n {\n loader: MiniCssExtractPlugin.loader,\n options: {\n publicPath: config.build.cssPublicPath\n }\n }\n ].concat(loaders);\n } else {\n return ['vue-style-loader'].concat(loaders);\n }\n }", "async function loader(\n args\n ) {\n try {\n const isCommonjs = args.namespace.endsWith('commonjs');\n \n const key = removeEndingSlash(args.path);\n const contents = polyfilledBuiltins.get(key) || polyfillLib[key + '.js'];\n const resolveDir = path.dirname(key);\n\n if (isCommonjs) {\n return {\n loader: 'js',\n contents: commonJsTemplate({\n importPath: args.path,\n }),\n resolveDir,\n };\n }\n return {\n loader: 'js',\n contents,\n resolveDir,\n };\n } catch (e) {\n console.error('node-modules-polyfill', e);\n return {\n contents: `export {}`,\n loader: 'js',\n };\n }\n }", "function preload() {\r\n result = loadStrings('assets/characteridle.txt');\r\n runresult = loadStrings('assets/characterrun.txt');\r\n runresultleft = loadStrings('assets/characterrunleft.txt');\r\n jumpresult = loadStrings('assets/characterjump.txt');\r\n // obstactles = loadStrings('assets/static.txt');\r\n}", "function generateLoaders (loader, loaderOptions) {\n const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]\n\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n return [].concat(options.extract ? MiniCssExtractPlugin.loader : 'vue-style-loader').concat(loaders)\n }", "function getLoader(id) {\n return $(\"<div/>\", {\"class\": \"ytbsp-loader\", \"id\": id});\n}", "function LoaderProto() {}", "function LoaderProto() {}", "function LoaderProto() {}", "function generateLoaders(loader, loaderOptions) {\n var loaders = [cssLoader]\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n // return ExtractTextPlugin.extract({\n // use: loaders,\n // fallback: 'vue-style-loader'\n // })\n return [MiniCssExtractPlugin.loader].concat(loaders)\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function loader() {\n loaded += 1;\n if(loaded === toLoad) {\n spinner.stop();\n process.stdout.write('\\r ' + url);\n console.log('');\n }\n }", "initLoader(loaderName) {\n loaderName = true;\n }", "function XLoader() {\r\n return __loadScript(\"YLoader\", 2);\r\n}", "function generateLoaders (loader, loaderOptions) {\n const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]\n\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader',\n publicPath:'../../'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders (loader, loaderOptions) {\n // 将上面的基础cssLoader配置放在一个数组里面\n const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]\n // 如果该函数传递了单独的loader就加到这个loaders数组里面,这个loader可能是less,sass之类的\n if (loader) {\n loaders.push({\n // 加载对应的loader\n loader: loader + '-loader',\n // Object.assign是es6的方法,主要用来合并对象的,浅拷贝\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n // Extract CSS when that option is specified\n // (which is the case during production build)\n // 注意这个extract是自定义的属性,可以定义在options里面,\n //主要作用就是当配置为true就把文件单独提取,false表示不单独提取,\n //这个可以在使用的时候单独配置,瞬间觉得vue作者好牛逼\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n // 上面这段代码就是用来返回最终读取和导入loader,来处理对应类型的文件\n }", "function loader(source, inputSourceMap) {\n const config = loaderUtils.getOptions(this) || {};\n config.module = config['module'] || 'Icon.SvgAsset';\n config.tagger = config['tagger'] || 'svgAsset';\n\n const packageName = config['package'] || 'user/project',\n taggerName =\n '_' +\n [\n packageName.replace(/-/g, '_').replace(/\\//g, '$'),\n config.module.replace(/\\./g, '_'),\n config.tagger,\n ].join('$'),\n escapedTaggerName = taggerName.replace(/\\$/g, '\\\\$'),\n moduleNameCapture = \"'([a-zA-Z-./]+)'\",\n regexp = regexpForFunctionCall(escapedTaggerName, [moduleNameCapture]);\n\n return source.replace(regexp, \"require('$1').default\");\n}", "function generateLoaders(loader, loaderOptions) {\n const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]\n\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders(loader, loaderOptions) {\n const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]\n\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders (loader, loaderOptions) {\n const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]\n\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders(loader, loaderOptions) {\n const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]\n\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders(loader, loaderOptions) {\n const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]\n\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders (loader, loaderOptions) {\n const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]\n\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader',\n publicPath: '../../'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders(loader, loaderOptions) {\n const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]\n\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return [MiniCssExtractPlugin.loader].concat(loaders)\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "loadString(){\n return this.loadContent(result).then(function(buf){\n return buf.toString('UTF-8');\n });\n }", "function createTranslateLoader(http) {\n}", "function generateLoaders (loader, loaderOptions) {\n var loaders = [cssLoader]\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders(loader, loaderOptions) {\n var loaders = [cssLoader]\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders(loader, loaderOptions) {\n const loaders = [cssLoader]\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders (loader, loaderOptions) {\n const loaders = [cssLoader]\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders(loader, loaderOptions) {\n var loaders = [cssLoader]\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders (loader, loaderOptions) {\n var loaders = [cssLoader]\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders (loader, loaderOptions) {\n var loaders = [cssLoader]\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function generateLoaders (loader, loaderOptions) {\n var loaders = [cssLoader]\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n }", "function loadText(fileName) {\n\n loading[fileName] = true;\n getData(fileName, 'txt', {\n headers: { \n 'Cache-Control': 'no-cache, must-revalidate, no-store',\n 'Pragma': 'no-cache'\n }\n }).then(function(data) {\n \n register(fileName, data);\n delete loading[fileName];\n forEach(uninitialised, function(module, moduleName) {\n define(moduleName, module.dependencies, module.def);\n });\n });\n\n }", "function generateLoaders (loader, loaderOptions) {\n var cssLoaders = Object.assign({}, _cssLoaders)\n\n if (loaderOptions && loaderOptions.cssModule) {\n cssLoaders.options = Object.assign({}, _cssLoaders.options, _cssLoadersModule)\n delete loaderOptions.cssModule\n }\n\n var loaders = [\n cssLoaders,\n {\n loader: 'postcss-loader',\n options: { sourceMap: options.sourceMap }\n }\n ]\n\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, { sourceMap: options.sourceMap })\n })\n }\n\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'style-loader'\n })\n } else {\n return ['style-loader'].concat(loaders)\n }\n }", "function createWorkerString (fn) {\n return `importScripts(\"resource://gre/modules/workers/require.js\");\n const { createTask } = require(\"resource://devtools/shared/worker/helper.js\");\n createTask(self, \"workerifiedTask\", ${fn.toString()});\n `;\n}", "load() {}", "load() {}", "load(id) {\n if (id === utilsPath) {\n const utilPath = `${__dirname}/utils.js`;\n const source = fs.readFileSync(utilPath, 'utf8');\n \n return {source};\n }\n \n if (id.endsWith(`.${extension}`)) {\n const source = fs.readFileSync(id, 'utf8');\n const context = createContext(id);\n const ast = bizubee\n .parseString(source)\n .getJSTree({});\n return {context, source, ast};\n } else {\n return defaultResolver.load(id);\n }\n }", "function generateLoaders (loader, loaderOptions) {\n const loaders = [cssLoader, postcssLoader]\n\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: !isProd\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (isProd) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'vue-style-loader'\n })\n } else {\n return ['vue-style-loader'].concat(loaders)\n }\n}", "function loadCode_dep(text) {\n\tif (isdef(text)) text = text.trim();\n\tif (isEmpty(text)) {\n\t\t//console.log('text is empty!!! no script loaded!');\n\t\treturn;\n\t}\n\t//console.log('text', text);\n\n\tvar scriptTag = document.createElement(\"script\");\n\tscriptTag.onload = () => console.log('code loaded.....');\n\tscriptTag.setAttribute(\"type\", \"text/javascript\");\n\tscriptTag.innerHTML = text;\n\tdocument.getElementsByTagName(\"body\")[0].appendChild(scriptTag);\n}", "function analyzeLoaders(loaders, namePrefix = '') {\n const loaderDescriptions = {};\n const extensionsLoaders = Object.entries(Object.entries(loaders)\n .map(([name, description]) => ({ ...description, name }))\n .filter(isLoaderDescription)\n .reduce((previous, loaderDescription) => {\n const { filetypes, name, ...description } = loaderDescription;\n loaderDescriptions[namePrefix + name] = Object.freeze(description);\n utils_1.ensureArray(filetypes).forEach(filetype => {\n if (!filetype) {\n throw new Error('Empty file type is forbidden');\n }\n if (!(filetype in previous)) {\n previous[filetype] = [];\n }\n previous[filetype].push(namePrefix + name);\n });\n return previous;\n }, {})).reduce((previous, [extension, descriptionNames]) => {\n previous[extension] = Object.freeze(descriptionNames);\n return previous;\n }, {});\n return [Object.freeze(loaderDescriptions), Object.freeze(extensionsLoaders)];\n}", "function addLoader(){\n\t\t\t\t\t$contain.append( '<i class=\"enlarge_loader\"><i></i></i>' );\n\t\t\t\t}", "_render() {\n const loaderInner = htmlHelper.createDivWithClass('');\n this.loader.appendChild(loaderInner);\n }", "function __get_loading_content() {\r\n return '<div id=\"lightbox-loading\">' +\r\n '<div id=\"lightbox-loading-inner\">' +\r\n '<a href=\"#\" id=\"lightbox-loading-link\">' +\r\n '<img src=\"' + settings.imageDir + \"/\" + settings.imageLoading + '\">' +\r\n '</a>' +\r\n '</div>' +\r\n '</div>';\r\n }", "function createLoad(name) {\n return {\n status: 'loading',\n name: name,\n linkSets: [],\n dependencies: [],\n metadata: {}\n };\n }", "function createLoad(name) {\n return {\n status: 'loading',\n name: name,\n linkSets: [],\n dependencies: [],\n metadata: {}\n };\n }", "function createLoad(name) {\n return {\n status: 'loading',\n name: name,\n linkSets: [],\n dependencies: [],\n metadata: {}\n };\n }", "function createLoad(name) {\n return {\n status: 'loading',\n name: name,\n linkSets: [],\n dependencies: [],\n metadata: {}\n };\n }", "function mkloader (dest, name) {\n return function _loadParser (p1, p2, p3, p4) {\n return (dest[name] = _req(name))(p1, p2, p3, p4)\n }\n }", "static fromString(source, filename) {\n const ast = espree.parse(source, {\n ecmaVersion: 2017,\n sourceType: \"module\",\n loc: true,\n });\n return new TemplateExtractor(ast, filename || \"inline\", source);\n }", "function getBootLoaderStr(bootArgs) {\n\n var bootArgsStr = \"\";\n\n for (var i = 0; i < bootArgs.length; i++) {\n\n if (bootArgs[i] == \"c\") {\n bootArgsStr += \"硬盘\";\n } else if (bootArgs[i] == \"d\") {\n bootArgsStr += \"光驱\";\n } else if (bootArgs[i] == \"n\") {\n bootArgsStr += \"网络\";\n }\n\n if (i != bootArgs.length - 1) {\n bootArgsStr += \",\";\n }\n }\n\n return bootArgsStr;\n}", "function generateLoaders(loader, loaderOptions) {\n const loaders = options.usePostCSS\n ? [cssLoader, postcssLoader]\n : [cssLoader];\n\n if (loader) {\n loaders.push({\n loader: loader + \"-loader\",\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap,\n }),\n });\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n const miniCssLoader = {\n loader: MiniCssExtractPlugin.loader,\n options: {\n // you can specify a publicPath here\n // by default it uses publicPath in webpackOptions.output\n // publicPath: '../',\n // hmr: process.env.NODE_ENV === 'development',\n hmr: false,\n },\n };\n\n loaders.unshift(miniCssLoader);\n }\n\n return loaders;\n }", "function init() {\n return {\n loaders: [ new LocalLoader() ],\n fetch: function(dep_name, targetConfig) {\n var output;\n this.loaders.forEach(function(l) {\n if (!output && l.match(dep_name)) {\n output = l.load(dep_name, targetConfig);\n }\n });\n return output;\n }\n };\n}", "function AtlasLoaderPlugin(fileExtension,plugin){return function(){AtlasPictureInfoFactory.addLoader(fileExtension,plugin);};}", "function Loader() {\n var $obj = this;\n this.append = function () {\n this.node = $('<div/>').addClass('zoomPreload').css('visibility', 'hidden').html(settings.preloadText);\n $('.zoomPad', el).append(this.node);\n };\n this.show = function () {\n this.node.top = (smallimage.oh - this.node.height()) / 2;\n this.node.left = (smallimage.ow - this.node.width()) / 2;\n //setting position\n this.node.css({\n top: this.node.top,\n left: this.node.left,\n position: 'absolute',\n visibility: 'visible'\n });\n };\n this.hide = function () {\n this.node.css('visibility', 'hidden');\n };\n return this;\n }", "function generateLoaders(loader, loaderOptions) {\n let loaders = [];\n // 生产环境使用MiniCssExtractPlugin提取css内容,用于提取css内容到一个独立的文件中\n if (options.environment === 'prod') {\n // MiniCssExtractPlugin.loader需要配合MiniCssExtractPlugin使用\n loaders = [\n VueCssLoader,\n {\n loader: MiniCssExtractPlugin.loader,\n options: {\n esModule: true\n }\n },\n cssLoader,\n postCssLoader\n ];\n } else {\n loaders = [VueCssLoader, cssLoader, postCssLoader];\n }\n\n if (loader) {\n loaders.push({\n loader: `${loader}-loader`,\n options: { ...loaderOptions, sourceMap: options.sourceMap }\n });\n }\n\n // 如果是sass、scss文件,则增加sass-resources-loader\n if (\n (loader === 'sass' || loader === 'scss') &&\n config.webpack.sassResources &&\n config.webpack.sassResources.length > 0\n ) {\n loaders.push({\n loader: 'sass-resources-loader',\n options: {\n resources: config.webpack.sassResources || []\n }\n });\n }\n\n return loaders;\n }", "_generateStringContent(language) {\n let text = '';\n let langGen = this._dlgResourceSet.languageStrings(language);\n for (const [id, str] of langGen) {\n text += makeLine(0, generateCppStringDefinition(id, str));\n }\n return text;\n }", "function Loader(parent, options) {\n\n // Initialization of loader state from options\n this._global = options.global || Object.create(null);\n this._baseURL = options.baseURL || this.global && this.global.baseURL;\n if (options.linkedTo === null || options.linkedTo) {\n throw new Error(\"Setting 'linkedTo' not yet supported.\");\n }\n this._strict = options.string === undefined ? false : !! options.string;\n this._resolve = options.resolve || parent.resolve;\n this._fetch = options.fetch || parent.fetch;\n this._translate = options.translate || parent.translate;\n\n // The internal table of module instance objects\n this._mios = {};\n }", "function wrapInES6StringExport(str) {\n\treturn `\nimport { glsl } from '@davidisaaclee/video-graph';\n\nexport default glsl\\`\n${str}\n\\`;\n\t`;\n}", "function showThisLoader(type, colorClass) {\n type = typeof type !== 'undefined' ? type : \"dots\";\n colorClass = typeof colorClass !== 'undefined' ? colorClass : 'dark';\n\n var loader = {\n dots : '<div class=\"loader-dots '+ colorClass +'\">' +\n '<div class=\"sk-bounce1\"></div>' +\n '<div class=\"sk-bounce2\"></div>' +\n '<div class=\"sk-bounce3\"></div>' +\n '</div>',\n cubeGrid : '<div class=\"loader-cube-grid '+ colorClass +'\">' +\n '<div class=\"sk-cube sk-cube1\"></div>' +\n '<div class=\"sk-cube sk-cube2\"></div>' +\n '<div class=\"sk-cube sk-cube3\"></div>' +\n '<div class=\"sk-cube sk-cube4\"></div>' +\n '<div class=\"sk-cube sk-cube5\"></div>' +\n '<div class=\"sk-cube sk-cube6\"></div>' +\n '<div class=\"sk-cube sk-cube7\"></div>' +\n '<div class=\"sk-cube sk-cube8\"></div>' +\n '<div class=\"sk-cube sk-cube9\"></div>' +\n '</div>',\n fadingCircle: '<div class=\"loader-fading-circle '+ colorClass +'\">' +\n '<div class=\"sk-circle1 sk-circle\"></div>' +\n '<div class=\"sk-circle2 sk-circle\"></div>' +\n '<div class=\"sk-circle3 sk-circle\"></div>' +\n '<div class=\"sk-circle4 sk-circle\"></div>' +\n '<div class=\"sk-circle5 sk-circle\"></div>' +\n '<div class=\"sk-circle6 sk-circle\"></div>' +\n '<div class=\"sk-circle7 sk-circle\"></div>' +\n '<div class=\"sk-circle8 sk-circle\"></div>' +\n '<div class=\"sk-circle9 sk-circle\"></div>' +\n '<div class=\"sk-circle10 sk-circle\"></div>' +\n '<div class=\"sk-circle11 sk-circle\"></div>' +\n '<div class=\"sk-circle12 sk-circle\"></div>' +\n '</div>'\n };\n\n if(loader[type] == undefined) {\n return type;\n } else {\n return loader[type];\n }\n\n}", "_loading() {\n }", "function createLoaderLoad(object) {\n return {\n // modules is an object for ES5 implementation\n modules: {},\n loads: [],\n loaderObj: object\n };\n }", "function scriptLoader()\n{\n addJavascript(\"phoneticMapper.js\", \"head\");\n addJavascript(\"vedatype.js\", \"head\");\n addJavascript(\"slp01.js\", \"head\"); \n}", "constructor () {\n this.hdrCubeLoader = new HDRCubeTextureLoader();\n this.gltfLoader = new GLTFLoader();\n this.fbxLoader = new FBXLoader();\n this.jsonLoader = new JSONLoader();\n this.textureLoader = new TextureLoader();\n this.fontLoader = new FontLoader();\n this.isLoaded = false;\n }", "function ComponentDefLoader() {\n this.pending = null;\n this.loading = 0;\n this.counter = 0;\n this.scriptTagCounter = 0;\n this.requestedDescriptors = {};\n this.lastContextParameterName;\n}", "function loading() {\n push();\n textSize(32);\n textStyle(BOLD);\n textAlign(CENTER, CENTER);\n text(`Loading ${modelName}...`, width / 2, height / 2);\n pop();\n}", "function Loader(){\n /* Initialise tasking system */\n init();\n /* Task payloads */\n elements = document.getElementsByName(\"md\");\n for(var i = 0; i < elements.length; i++){\n /* Add task to remove element */\n addTask(function(){\n var elem = getVar();\n elem.innerHTML = \"\";\n });\n /* Add reference to element to be cleaned */\n addVar(elements[i]);\n /* Process the element lines */\n var lines = elements[i].innerHTML.split(\"\\n\");\n for(var e = 0; e < lines.length; e++){\n /* Add task to task stack */\n addTask(function(){\n var elem = getVar();\n var line = getVar();\n var skip = false;\n /* <<<< Entire line tests >>>> */\n if(line.length == 0){\n line = \"<br /><br />\";\n }\n /* <<<< Start of line tests >>>> */\n if(line[0] == '#'){\n var temp = line;\n /* Find out type of header */\n var len = line.length;\n var h = 1;\n for(var z = 1; z < len; z++){\n if(line[z] == '#'){\n h++;\n }else{\n /* Make sure next character is space */\n if(line[z] == ' '){\n /* Remove previous markers */\n temp = line.slice(h + 1);\n }\n z = line.length;\n }\n }\n /* Add HTML */\n temp = \"<h\" + h + \">\" + temp + \"</h\" + h + \">\";\n /* Replace line for searching */\n line = temp;\n }\n if(line[0] == ' '){\n if(line[1] == ' '){\n /* Check whether we have a list or potential code block */\n if(line[2] == ' '){\n /* Check whether we have code block */\n if(line[3] == ' '){\n /* Escape the string */\n temp = line.slice(4);\n temp = temp.replace(\n /&/g, \"&amp;\"\n ).replace(\n /</g, \"&lt;\"\n ).replace(\n />/g, \"&gt;\"\n ).replace(\n /\"/g, \"&quot;\"\n );\n /* Check the length, add some space is zero */\n if(temp.length <= 0){\n temp += ' ';\n }\n /* Throw some pre-tags around it */\n line = \"<pre name=\\\"code\\\" style=\\\"margin:0px;\\\">\" + temp + \"</pre>\";\n skip = true;\n }\n }else{\n /* Indent the list */\n var point = line.slice(2).split(\" \");\n var pointLen = point[0].length;\n if(point[0] == \"*\"){\n point[0] = \"&middot;&nbsp;\";\n }\n var temp = \"<tt name=\\\"list\\\">&nbsp;&nbsp;\" + point[0];\n for(var z = point[0].length; z < TAB_MAX; z++){\n temp += \"&nbsp;\";\n }\n temp += \"</tt>\" + line.slice(2 + pointLen);\n line = temp + \"<br />\";\n }\n }\n }\n /* <<<< Middle of line tests >>>> */\n /* Only perform tests if we shouldn't be skipping */\n if(!skip){\n var temp = \"\";\n var images = line.split(\"![\");\n if(!(images.length == 1 && !(images[0] == '!' && images[1] == '['))){\n for(var z = 0; z < images.length; z++){\n var endS = images[z].indexOf(']');\n var begC = images[z].indexOf('(', endS);\n var endC = images[z].indexOf(')', begC);\n /* If invalid, skip over */\n if(endS < 0 || begC < 0 || endC < 0 || endS + 1 != begC){\n /* Put everything back as it was */\n if(z > 0){\n temp += \"![\";\n }\n temp += images[z];\n }else{\n temp += \"<img alt=\\\"\";\n temp += images[z].slice(0, endS);\n temp += \"\\\" src=\\\"\";\n temp += images[z].slice(begC + 1, endC);\n temp += \"\\\">\";\n /* Add everything that wasn't part of the breakup */\n temp += images[z].slice(endC + 1);\n }\n }\n line = temp;\n }\n temp = \"\";\n var links = line.split(\"[\");\n if(!(links.length == 1 && line[0] != '[')){\n for(var z = 0; z < links.length; z++){\n var endS = links[z].indexOf(']');\n var begC = links[z].indexOf('(', endS);\n var endC = links[z].indexOf(')', begC);\n /* If invalid, skip over */\n if(endS < 0 || begC < 0 || endC < 0 || endS + 1 != begC){\n /* Put everything back as it was */\n if(z > 0){\n temp += \"[\";\n }\n temp += links[z];\n }else{\n temp += \"<a href=\\\"\";\n temp += links[z].slice(begC + 1, endC);\n temp += \"\\\">\";\n temp += links[z].slice(0, endS);\n temp += \"</a>\";\n /* Add everything that wasn't part of the breakup */\n temp += links[z].slice(endC + 1);\n }\n }\n line = temp;\n }\n var pos = 0;\n while(pos >= 0){\n /* Search for first instance */\n pos = line.indexOf(\"**\");\n if(pos >= 0){\n /* Replace first instance */\n line = line.slice(0, pos) + \"<b>\" + line.slice(pos + 2);\n /* Search for second instance */\n pos = line.indexOf(\"**\");\n if(pos >= 0){\n /* Replace second instance */\n line = line.slice(0, pos) + \"</b>\" + line.slice(pos + 2);\n }\n }\n }\n pos = 0;\n while(pos >= 0){\n /* Search for first instance that doesn't start with spaces */\n pos = line.indexOf(\"*\");\n if(pos >= 0){\n /* Replace first instance */\n line = line.slice(0, pos) + \"<i>\" + line.slice(pos + 1);\n /* Search for second instance */\n pos = line.indexOf(\"*\");\n if(pos >= 0){\n /* Replace second instance */\n line = line.slice(0, pos) + \"</i>\" + line.slice(pos + 1);\n }\n }\n }\n pos = 0;\n while(pos >= 0){\n /* Search for first instance that doesn't start with spaces */\n pos = line.indexOf(\"`\");\n if(pos >= 0){\n /* Replace first instance */\n line = line.slice(0, pos) + \"<pre class=\\\"inline\\\">\" + line.slice(pos + 1);\n /* Search for second instance */\n pos = line.indexOf(\"`\");\n if(pos >= 0){\n /* Replace second instance */\n line = line.slice(0, pos) + \"</pre>\" + line.slice(pos + 1);\n }\n }\n }\n }\n /* Add line to element */\n elem.innerHTML += line;\n });\n /* Add reference to elements */\n addVar(elements[i]);\n /* Allow function to access line */\n addVar(lines[e]);\n }\n /* Add task to swap elements XMP for P */\n addTask(function(){\n var elem = getVar();\n var nElem = document.createElement('p');\n nElem.innerHTML = elem.innerHTML;\n elem.parentNode.insertBefore(nElem, elem);\n elem.parentNode.removeChild(elem);\n });\n /* Add reference to element to be cleaned */\n addVar(elements[i]);\n }\n /* Process tasks */\n process();\n}", "function generateLoaders (loader = null, loaderOptions = {}, module = false) {\n\n var cssLoader = {\n loader: 'css-loader',\n options: {\n minimize: process.env.NODE_ENV === 'production',\n sourceMap: options.sourceMap,\n modules: !!module\n }\n }\n\n var loaders = [cssLoader]\n\n if (loader) {\n loaders.push({\n loader: loader + '-loader',\n options: Object.assign({}, loaderOptions, {\n sourceMap: options.sourceMap\n })\n })\n }\n\n // Extract CSS when that option is specified\n // (which is the case during production build)\n if (options.extract) {\n return ExtractTextPlugin.extract({\n use: loaders,\n fallback: 'style-loader'\n })\n } else {\n return ['style-loader'].concat(loaders)\n }\n }", "loadLocalTLE(id, callback) {\n $.get(\"assets/tle/\" + id + \".txt\", function (data) {\n callback(data.split(\"\\n\"));\n });\n }", "function animateLoader() {\n var length = (ellipses.text().length + 1) % 5;\n ellipses.text(Array(length + 1).join(\".\"));\n padding.text(Array(length + 1).join('\\xA0')); //add padding to the front of the loader to keep it centred\n }", "function loader(contents) {\n this.cacheable && this.cacheable();\n const callback = this.async();\n const options = getLoaderOptions(this);\n const instanceOrError = (0, instances_1.getTypeScriptInstance)(options, this);\n if (instanceOrError.error !== undefined) {\n callback(new Error(instanceOrError.error.message));\n return;\n }\n const instance = instanceOrError.instance;\n (0, instances_1.buildSolutionReferences)(instance, this);\n successLoader(this, contents, callback, instance);\n}", "function preload() {\n //font can be a ttf or otf\n miniver = loadFont('assets/Miniver-Regular.ttf');\n}", "cargando() {\n var cargandoDibujo = `\n <div class=\"container\">\n <section>\n <div class=\"loader loader-1\">\n <div class=\"loader-outter\"></div>\n <div class=\"loader-inner\"></div>\n </div>\n </section>\n </div>\n `;\n\n document.body.innerHTML += cargandoDibujo;\n }", "toString() {\n return `${ this.constructor.name }<${ \n this.sourceAttribute } -> ${ this.destinationAttribute \n }> {\\n loaded: ${ \n this.loaded \n },\\n host: ${ \n (this.host + '').replace(/\\n/g, '\\n ') \n }\\n}`;\n }", "constructor() {\n var loading_phrases = [\n 'Getting the fuzz...',\n 'Loading the madness...',\n 'To load or not to load...',\n 'Lets talk while I load...',\n 'I sure hope this loads soon...',\n 'I know. I know. Load faster...'\n ];\n var phrase_index = parseInt(Math.random() * loading_phrases.length);\n var phrase = loading_phrases[phrase_index];\n var loading_text = document.getElementById('app-loading-text');\n\n loading_text.textContent = phrase;\n }", "constructor() {\n super();\n\n /**\n * The name of the underlying native loader plugin used to load text.\n */\n this.textPluginName = 'text';\n\n this.moduleRegistry = Object.create(null);\n this.useTemplateLoader(new TextTemplateLoader());\n // TODO: find way receive current loader from aurelia\n loader = this;\n\n this.addPlugin('template-registry-entry', {\n fetch: async(address, _loader) => {\n const entry = this.getOrCreateTemplateRegistryEntry(address);\n if (!entry.templateIsLoaded) {\n await this.templateLoader.loadTemplate(this, entry);\n }\n return entry;\n }\n });\n\n // TODO: add event emitter hook here to watch module updates.\n // Not clear what to call\n // loadModule\n // loadTemplate\n\n PLATFORM.eachModule = function(callback) {\n if (System.registry) { // SystemJS >= 0.20.x\n for (let [k, m] of System.registry.entries()) {\n try {\n if (callback(k, m)) return;\n } catch (e) {\n // catch error\n }\n }\n return;\n }\n\n // SystemJS < 0.20.x\n let modules = System._loader.modules;\n for (let key in modules) {\n try {\n if (callback(key, modules[key].module)) return;\n } catch (e) {\n // catch error\n }\n }\n };\n }", "function getLoadingBlock(id,mode)\r\n{\r\n\treturn\t'<div id=\"loading'+id+'\" name=\"loadingDiv\" align = \"center\">'+\r\n\t\t\t'<img src=\"include/img/loading.gif\" align=\"absmiddle\">&nbsp;&nbsp;<span class=\"load_text\">Loading .....</span></div>'+\r\n\t\t\t(mode!=3 ? '<div id = \"loaded_content'+id+'\" name=\"loadedContent\" style=\"position:absolute; left:-10000px;\"></div>' : '');\r\n}", "registerLoader (name, loaderFunc) {\n registerLoader(name, loaderFunc)\n }", "registerLoader (name, loaderFunc) {\n registerLoader(name, loaderFunc)\n }" ]
[ "0.7097612", "0.66899395", "0.65110594", "0.6465504", "0.6258431", "0.6010432", "0.5984854", "0.59450746", "0.5914225", "0.5876885", "0.5864139", "0.58447176", "0.58063155", "0.57963324", "0.5714089", "0.5599972", "0.5590975", "0.5579531", "0.555193", "0.55507267", "0.55353403", "0.55254835", "0.54861146", "0.5477359", "0.5473788", "0.54611784", "0.5457616", "0.5457616", "0.5457616", "0.5456095", "0.5454348", "0.54461616", "0.5443727", "0.54407513", "0.5421154", "0.54193527", "0.54092836", "0.54092836", "0.5403692", "0.53983355", "0.53983355", "0.5397897", "0.5380854", "0.53728145", "0.53484976", "0.53395075", "0.53270245", "0.53223604", "0.531608", "0.5314602", "0.5308631", "0.5308631", "0.5308631", "0.5295619", "0.527393", "0.5261546", "0.5260303", "0.5260303", "0.52591896", "0.52184874", "0.5199061", "0.5189703", "0.5177688", "0.5168191", "0.5154803", "0.5154494", "0.5154494", "0.5154494", "0.5154494", "0.5144513", "0.51213473", "0.511363", "0.51070446", "0.5105482", "0.5104756", "0.5087246", "0.5065168", "0.50348246", "0.50332206", "0.5026379", "0.50260955", "0.501885", "0.5012476", "0.49986032", "0.4996621", "0.49949107", "0.49884808", "0.4986536", "0.49675018", "0.49646375", "0.49425408", "0.4940877", "0.4939552", "0.4932277", "0.4924378", "0.49233446", "0.49230042", "0.49211568", "0.49181262", "0.49181262" ]
0.55011874
22
Emits a log message to the console.
log(level, message, extraInfo) { if ((0, logging_1.logLevelSeverity)(level) >= (0, logging_1.logLevelSeverity)(__classPrivateFieldGet(this, _Client_logLevel, "f"))) { __classPrivateFieldGet(this, _Client_logger, "f").call(this, level, message, extraInfo); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "log(message) {\n this.stream.write((new Date()).toUTCString() + \" ------ \" + message + \"\\n\");\n this.emit('log', message);\n }", "log (message) {\n this.getConsole().showMessage(message);\n }", "function log() {\n var objs = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n objs[_i - 0] = arguments[_i];\n }\n var message = new (Array.bind.apply(LogMessage, [null].concat(objs)));\n self[\"port\"].emit(message.name, message);\n}", "function log(message){\n console.log(message);\n }", "function log(message) {\n console.log(message);\n}", "function log(message) {\n console.log(message);\n}", "function log(msg) {\n console.log(msg);\n}", "function log(message) {\r\n\tconsole.log(message);\r\n}", "log(message) {\n //Sends an HTTP request\n console.log('testing' + message);\n\n //Raise an event\n // 'this' references Logger class itself, which extends EventEmitter\n this.emit('messageLogged', { id: 1, url: 'http://' });\n }", "function log(msg) {\n console.log(msg);\n}", "function log(msg) {\n console.log(msg);\n}", "function log(message) {\n console.log(message);\n}", "log(message) {\n console.log(message);\n }", "function log(message) {\n if (logToConsole) {\n console.log(message);\n }\n }", "function log(message) {\n if (logToConsole) {\n console.log(message);\n }\n }", "log(message){\n // Send an HTTP request\n console.log(message);\n \n // Raise an event\n /*\n \n We first give the name of the event we want to emit. Then, we can pass\n some data. It's good practice to encapsulate the event argument in an\n object where the data is labeled. \n \n */\n this.emit('messageLogged', { id: 1, url: 'http://'});\n }", "function emit(msg){\n\tconsole.log(msg);\n}", "function _log(msg) {\n console.log(chalk.yellow('>> ') + msg);\n}", "log(message) {\n\n // send http request\n console.log(message);\n \n // Raise: messageLogged event\n // - As Logger inherits EventsEmitter, it's base methods can be called too\n // - Pass data through event argument read as eventArg, arg, or whatever\n this.emit('messageLogged', { id: 1, data: {id: 1, url: 'http://...'} });\n \n }", "function doLog() {\n console.log(\"This is a log message.\");\n}", "function log(msg) {\n\tif (log.enabled) {\n\t\tconsole.log('QUOOR: ' + msg);\n\t}\n}", "function log() {\n var array = ['Message from server:'];\n array.push.apply(array, arguments);\n socket.emit('log', array);\n }", "function log() {\n var array = ['Message from server:'];\n array.push.apply(array, arguments);\n socket.emit('log', array);\n }", "function log() {\n var array = ['Message from server:'];\n array.push.apply(array, arguments);\n socket.emit('log', array);\n }", "function log() {\n var array = ['Message from server:'];\n array.push.apply(array, arguments);\n socket.emit('log', array);\n }", "function log() {\n var array = ['Message from server:'];\n array.push.apply(array, arguments);\n socket.emit('log', array);\n }", "function logMessage() {\n if (debugTurnedOn() && consoleLogExists) {\n console.log.apply(console, decorateLog(arguments, 'MESSAGE:'));\n }\n}", "function writeLog(msg) {\n if (logEnabled) {\n console.log(msg);\n }\n}", "function log(){\n\t\tvar array = [\">>> Message from server: \"];\n\t \tarray.push.apply(array,arguments);\n\t socket.emit('log', array);\n\t}", "function log(){\n\t\tvar array = [\">>> \"];\n\t for (var i = 0; i < arguments.length; i++) {\n\t \tarray.push(arguments[i]);\n\t }\n\t socket.emit('log', array);\n\t}", "function log() {\r\n\t var array = ['Message from server:'];\r\n\t array.push.apply(array, arguments);\r\n\t socket.emit('log', array);\r\n\t}", "function showLog(msg, arg) {\n console.log(msg, arg)\n}", "function log() {\n var array = [\"Message from server:\"];\n array.push.apply(array, arguments);\n socket.emit(\"log\", array);\n }", "function log(message) {\n console.log('Log created by :' + message);\n}", "function log(msg) {\n\t\t\tif (debug) {\n\t\t\t\tconsole.log(msg);\n\t\t\t}\n\t\t}", "function writeMessage(message){\n console.log(message);\n}", "function log(logmessage) {\n\tconsole.log(logmessage);\n}", "function log(){\n\t\tvar array = [\">>> Message from server: \"];\n\t for (var i = 0; i < arguments.length; i++) {\n\t \tarray.push(arguments[i]);\n\t }\n\t socket.emit('log', array);\n\t}", "function log() {\n console.log.apply(console, arguments);\n var array = ['Server:'];\n array.push.apply(array, arguments);\n socket.emit('video:log', array);\n }", "function log(msg)\n{\n Services.console.logStringMessage(msg);\n}", "function consoleLog(msg) {\n if (verbose) {\n var now = new Date();\n Ext.log({}, Ext.Date.format(now, 'U') + ' | ' + msg);\n }\n }", "function log(message) {\n console.log(message);\n document.getElementById('terminal').innerHTML += '<p>' + message + '</p>';\n}", "function log(message) {\n console.log(message);\n document.getElementById('terminal').innerHTML += '<p>' + message + '</p>';\n}", "function log(msg) {\n $('#console').append('<p>' + msg + '</p>');\n}", "function log () {\n if (shouldLog) {\n console.log.apply(this, arguments)\n }\n}", "function log(msg) {\n logMsg(\"CONSOLE: \" + msg);\n // why doesn't that work?\n pxsim.board().writeSerial(msg + \"\\n\");\n }", "function log(message) {\n if (console && console.log) {\n console.log(message);\n }\n }", "function logMessage(msg) {\n console.log((new Date()) + ' > ' + msg);\n}", "log(message) {\n if (this.verbose) {\n // tslint:disable-next-line no-console\n console.log(message);\n }\n }", "function log(message) {\n\tif(console && console.log) {\n\t\tconsole.log(message);\n\t}\n}", "function log(text) {\n\ttext = (new Date()) + \": \" + text;\n\tconsole.log(text);\n\tlogst.write(text);\n\tlogst.write('\\n');\n}", "function writeLine(message){\n\tif (debug) console.log(message);\n}", "function log(message) {\n if (typeof console != \"undefined\" && console.log) {\n console.log(message);\n }\n }", "function log() {\n\t\t//var args = [].slice.call(arguments);\n\t\t//send('LOG', args);\n\t}", "function log() {\n setTimeout(console.log.bind(console, arguments[0], arguments[1] || ''));\n }", "function log() {\n setTimeout(console.log.bind(console, arguments[0], arguments[1] || ''));\n }", "log (message) {\n // eslint-disable-next-line no-console\n if (this.verbose) console.log(message)\n }", "function log() {\n var array = ['Message from server:'];\n array.push.apply(array, arguments);\n socket.emit('log', array);\n console.log(arguments);\n }", "function log(msg) {\n if(debug)\n console.log(msg);\n}", "function log(msg) {\n\n if (window.console && console.log) {\n console.log(msg);\n }\n\n }", "function log(text) {\n console.log(text);\n}", "function logAndEmit(e) {\n console.log(e.toString());\n this.emit('end');\n}", "log(message) {\n this._signal.emit(message);\n }", "write(message) {\n message_log.write(message)\n }", "function log(message) {\n if(typeof window.console !== 'undefined') {\n console.log(message);\n }\n }", "function log(msg) {\n\t\tif (DEBUG) {\n\t\t\tif (typeof console != 'undefined')\n\t\t\t\tconsole.log(msg);\n\t\t}\n\t}", "function log(msg) {\n plugins.util.log(plugins.util.colors.blue(msg));\n}", "function log() { console.log.apply(console, arguments); }", "function log() { console.log.apply(console, arguments); }", "function console_log(msg) {\n\t\tconsole.log(msg);\n\t\tvar c = document.getElementById('console_log');\n\t\tc.innerHTML = msg + \"<br>\" + c.innerHTML;\n\t}", "function log() {\n console.log('%s - %s', timestamp(), format.apply(null, arguments));\n }", "_log (str) {\n if (this.context.runnerOptions.stream) console.log(str)\n else this._logs.push(str)\n }", "function log(txt){ console.log(txt); }", "log(message) {\n //send http request\n \n console.log(message);\n this.emit('messageLogged', {id: 1, url: 'http://'}); // making a noise, produce a signaling\n \n }", "function msg() {\n if (!check.assigned(message.get('log'))) {\n console.log(arguments[0]);\n return;\n }\n message.get('log').put(arguments[0], arguments[1], __filename.split('/').pop(), arguments.callee.caller.name.toString());\n }", "function log( message ) {\n\t\tif (win.console) {\n\t\t\twin.console.log(message);\n\t\t}\n\t}", "function h$log() {\n console.log.apply(console, arguments);\n}", "function logToConsoleAndLog(message) {\n console.log(message);\n fs.appendFile(constants.LOG_PATH, message + '\\n', function (err) {\n if(err) throw err;\n })\n}", "function logToConsoleAndStdOut(msg) {\n console.log(msg);\n window.webContents.send(\"debug-message\", msg);\n}", "function messWithConsole() {\n clearConsole();\n setInterval( addLog, 10 );\n }", "function publicLog(message) {\n if (consoleCheckbox.checked) {\n var logMessage = document.createElement('p');\n logMessage.className = 'logMessage';\n logMessage.innerHTML = message;\n publicConsoleLabel.appendChild(logMessage);\n }\n console.log(message);\n}", "function log(message) {\n if (debug) console.log(message);\n}", "function log(message) {\n console.log(path.basename(__filename) + \": \" + message);\n}", "function log(message) {\n console.log(VERSION, message);\n}", "function log() {\n if ( arguments.length === 0 ) { return; }\n \n var sep = ', ';\n var message = arguments[0];\n for (var i=1; i<arguments.length; i++ ) {\n message += sep + arguments[i];\n }\n \n console.log( message );\n logStream.write( message + '\\n' );\n}", "function logger(message) {\n\tif (window.console != null && typeof window.console != \"undefined\") {\n\t\tconsole.log(message);\n\t}\n}", "function log(){\n console.log('logging');\n}", "function log() {\n\t console.log('%s - %s', timestamp(), format$1.apply(null, arguments));\n\t}", "function log() {\n\t console.log('%s - %s', timestamp(), format$1.apply(null, arguments));\n\t}", "function log() {\n\t console.log('%s - %s', timestamp(), format$1.apply(null, arguments));\n\t}", "function log( message ) {\r\n\t\tif (win.console) {\r\n\t\t\twin.console.log(message);\r\n\t\t}\r\n\t}", "function log( message ) {\r\n\t\tif (win.console) {\r\n\t\t\twin.console.log(message);\r\n\t\t}\r\n\t}", "function log(message) {\n\t//Would send HTTP request\n\tconsole.log(message); \n}", "static log(...args) {\n if (this.toLog('LOG')) {\n console.log.apply(console, arguments);\n }\n }", "function log(string){\n console.log(`[LOG] ${string}`);\n\n let now = new Date().toISOString().slice(0,-5);\n let log_line = `[${now}] ${string}\\n`;\n log_stream.write(log_line);\n}", "log(message) {\n // Send http request\n console.log(message);\n\n //Raised an event\n // commented out of app.js after adding into logger.js\n\n this.emit('messageLogged', {id: 1, url: 'http:' }); \n }", "function log(msg) {\n if(window.console && window.console.log) {\n console.log(msg);\n }\n }", "function log () {\n var array = ['Message from server:']\n array.push.apply(array, arguments)\n // socket.emit('log', array);\n console.log(array)\n }", "function console_log(msg){\n\tif(menu_config.development_mode){\n\t\tconsole.log(msg);\n\t}\n}", "function log(message) {\n if (VERBOSE_LOGGING)\n postmessage('@console', \"Worker Log : \" + message);\n }", "function log(tag, msg)\n{\n\tconsole.log(tag + \": \" + msg)\n}" ]
[ "0.7299146", "0.7243611", "0.6986023", "0.6982114", "0.6894218", "0.6894218", "0.6887443", "0.6858936", "0.6855277", "0.6852113", "0.6852113", "0.68519455", "0.68457943", "0.68237346", "0.68237346", "0.67943", "0.67900395", "0.6780896", "0.6741777", "0.67223793", "0.6720877", "0.66934645", "0.6688841", "0.6688841", "0.6688841", "0.6688841", "0.66454774", "0.66330385", "0.6592335", "0.6589192", "0.6589049", "0.6565466", "0.6539676", "0.6532384", "0.6527382", "0.65173805", "0.6510497", "0.6509522", "0.6503745", "0.6498997", "0.64912915", "0.64813024", "0.64813024", "0.64775217", "0.64719236", "0.6470803", "0.6464166", "0.6455554", "0.64397746", "0.6405839", "0.64004105", "0.63967866", "0.63964677", "0.6388579", "0.63750225", "0.63750225", "0.63729393", "0.63696", "0.63656944", "0.6360071", "0.635638", "0.6344266", "0.63386416", "0.6320903", "0.6318733", "0.6299668", "0.6299502", "0.62972313", "0.62972313", "0.629387", "0.6292541", "0.62909424", "0.62881774", "0.6286853", "0.6283148", "0.62687427", "0.6255488", "0.62491477", "0.6241983", "0.6241045", "0.62235653", "0.62182015", "0.6215966", "0.6214134", "0.6211872", "0.6207473", "0.61939657", "0.6190167", "0.6190167", "0.6190167", "0.6189455", "0.6189455", "0.61877596", "0.6184474", "0.6179455", "0.61742103", "0.61717975", "0.61667234", "0.6163724", "0.6161494", "0.615605" ]
0.0
-1
Transforms an API key or access token into a headers object suitable for an HTTP request. This method uses the instance's value as the default when the input is undefined. If neither are defined, it returns an empty object
authAsHeaders(auth) { const headers = {}; const authHeaderValue = auth !== null && auth !== void 0 ? auth : __classPrivateFieldGet(this, _Client_auth, "f"); if (authHeaderValue !== undefined) { headers["authorization"] = `Bearer ${authHeaderValue}`; } return headers; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static async _defaultHeaders(headers = {}) {\n let newHeaders = Object.assign(headers, {\n Authorization: `Bearer ${(await Login.tokens()).access_token}`,\n });\n return newHeaders;\n }", "prepareHeaders(value = null) {\n const headers = {\n API_KEY: API.HOST_API_KEY // always send api key with every request header\n };\n if (this.sessionId) {\n headers.SESSION_ID = this.sessionId; // always send session id with every request header\n }\n if (typeof value === 'string' && value != null) {\n headers['Content-Type'] = 'text/plain;charset=utf-8';\n } else {\n headers['Content-Type'] = 'application/json;charset=utf-8';\n }\n return headers;\n }", "static getAuthHeader() {\n let token = AuthService.getAuthToken();\n if (token) {\n return {\n 'Authorization': 'Bearer ' + AuthService.getAuthToken()\n };\n } else {\n return {};\n }\n }", "get apiHeader() {\n const token = this.apiKey ? 'Bearer ' + this.apiKey : '';\n const apiHeader = new HttpHeaders({\n Authorization: token,\n 'Content-Type': 'application/json',\n 'Cache-Control': 'no-cache',\n Pragma: 'no-cache',\n Expires: 'Sat, 01 Jan 2000 00:00:00 GMT'\n });\n return apiHeader;\n }", "function makeHeaders(token, json) {\n let headers = {};\n if (token) {\n headers['access_token'] = token;\n }\n if (json) {\n headers['Content-Type'] = 'application/json';\n }\n return headers;\n}", "parse (req) {\n const config = this.configuration;\n const header = req.headers[config.headerField];\n\n if (header) {\n return {\n strategy: this.name,\n apiKey: header\n };\n }\n\n return null;\n }", "static getApiAuthHeader() {\n return {'authorization': `bearer ${Auth.getToken()}`};\n }", "headers(options = {}) {\n let headers = Object.assign({},\n {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n ReactOnRails.authenticityHeaders(),\n options);\n\n\n return headers;\n }", "static buildHeaders(additionalHeaders = {}) {\n const headers = {\n ...DEFAULT_HEADERS,\n ...additionalHeaders,\n };\n\n if (typeof window === 'undefined') {\n return headers;\n }\n\n delete headers['User-Agent'];\n delete headers['Accept-Encoding'];\n return headers;\n }", "get HTTPHeaders() {\n return {\n Authorization: this[sAuthHeader] || null,\n 'User-Agent': CouchbaseLiteUserAgent,\n };\n }", "function getBearerTokenHeader() {\n return {\n 'authorization': `Bearer ${process.env.BEARER_TOKEN}`\n };\n}", "async resolveHeaders() {\n return {};\n }", "_getHeadervalue() {\n return {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n clientid: this.getClientID(),\n userId: this.getUserID()\n }\n }", "function AuthHeader() {\n const currentUser = Cookie.getJSON(\"user\");\n\n if (currentUser && currentUser.token) {\n return { Authorization: `Bearer ${currentUser.token}` };\n } else {\n return {};\n }\n}", "_cleanRequestHeaders() {\n if (this.options.resetHeaders) {\n headers = Object.assign({}, this.options.defaultHeaders);\n }\n }", "request(config) {\n config.headers = config.headers || {};\n if(localStorageService.get('token') && Util.isSameOrigin(config.url)) {\n config.headers.Authorization = localStorageService.get('token');\n }\n return config;\n }", "function getHeaders(multipart = false) {\n let defaultHeaders = DEFAULT_HEADERS\n\n if (multipart) {\n defaultHeaders = {}\n }\n\n if (localStorage.jwt) {\n defaultHeaders = {\n 'Authorization': `Bearer ${localStorage.jwt}`,\n ...defaultHeaders\n }\n }\n\n return defaultHeaders\n}", "function createOAuthHeader(data, ctx) {\n if (typeof data.options.tokenJSONpath !== 'string') {\n return {};\n }\n // Extract token\n const tokenJSONpath = data.options.tokenJSONpath;\n const tokens = JSONPath.JSONPath({ path: tokenJSONpath, json: ctx });\n if (Array.isArray(tokens) && tokens.length > 0) {\n const token = tokens[0];\n return {\n Authorization: `Bearer ${token}`,\n 'User-Agent': 'openapi-to-graphql'\n };\n }\n else {\n httpLog(`Warning: could not extract OAuth token from context at ` +\n `'${tokenJSONpath}'`);\n return {};\n }\n}", "async getHeaders(options) {\n let headers = {};\n if (options && options.headers) {\n // customise headers\n const { headers: customHeaders } = options;\n headers = customHeaders;\n return headers;\n }\n const token = localStorage.getItem(\"token\");\n if (token && typeof token === \"string\") headers.Authorization = `bearer ${token.replace(/['\"]+/g, \"\")}`;\n headers[\"Content-Type\"] = \"application/json\";\n headers = { ...headers };\n return headers;\n }", "setRequestHeaders(headers) {\n headers = headers || {};\n\n // set additional headers\n if (process.env.BROKER_V2_AUTH_KEY) {\n headers['Authorization'] = 'Bearer ' + process.env.BROKER_V2_AUTH_KEY;\n }\n if (process.env.BROKER_V2_API_KEY) {\n headers['X-Api-Key'] = process.env.BROKER_V2_API_KEY;\n }\n if (process.env.BROKER_V2_TENANT) {\n headers['Fiware-Service'] = process.env.BROKER_V2_TENANT;\n }\n if (process.env.BROKER_V2_SUBTENANT) {\n headers['Fiware-Servicepath'] = process.env.BROKER_V2_SUBTENANT;\n }\n\n return headers;\n }", "static getBearerAuthHeader(token) {\n return { Authorization: 'Bearer ' + token };\n }", "getHeaders() {\r\n const headers = {\r\n Accept: \"application/json, text/plain, */*\",\r\n };\r\n if (this.requestHeaders) {\r\n for (let prop in this.requestHeaders) {\r\n headers[prop] = this.requestHeaders[prop];\r\n }\r\n }\r\n return new Headers(headers);\r\n }", "getAuthHeader(token) {\n return {\n Authorization: `Bearer ${token}`,\n };\n }", "get authHeader() {\n const localStorageToken = localStorage.getItem(this.config.jwtTokenName);\n const token = localStorageToken ? 'Bearer ' + localStorageToken : '';\n const authHeader = new HttpHeaders({\n Authorization: token,\n 'Content-Type': 'application/json',\n 'Cache-Control': 'no-cache',\n Pragma: 'no-cache',\n Expires: 'Sat, 01 Jan 2000 00:00:00 GMT'\n });\n return authHeader;\n }", "resetRequestHeaders() {\n headers = Object.assign({}, this.options.defaultHeaders);\n }", "function request(config) {\n config.headers = config.headers || {};\n if ($cookieStore.get('token')) {\n config.headers.Authorization = 'Bearer ' + $cookieStore.get('token');\n }\n return config;\n }", "addDefaultRequestInterceptor() {\n\t\tthis.axiosInstance.interceptors.request.use((config) => {\n\t\t\tlet need = Object.keys(this.option.auth).length > 0\n\t\t\tif (need) {\n\t\t\t\tconst timestamp = Date.now()\n\n\t\t\t\tlet query = {}\n\t\t\t\tconst array = config.url.split('?')\n\t\t\t\tif (array.length > 1) {\n\t\t\t\t\tquery = qs.parse(array[1])\n\t\t\t\t}\n\t\t\t\tconst data = config.data || {}\n\t\t\t\tconst params = config.params || {}\n\n\t\t\t\t// signature\n\t\t\t\tconst signature = sign(\n\t\t\t\t\tObject.assign({\n\t\t\t\t\t\t__timestamp__: timestamp\n\t\t\t\t\t}, data, params, query),\n\t\t\t\t\tthis.option.auth.token\n\t\t\t\t)\n\n\t\t\t\t// headers\n\t\t\t\tconfig.headers = {\n\t\t\t\t\t'h-token': this.option.auth.token,\n\t\t\t\t\t'h-nonce': this.option.auth.nonce,\n\t\t\t\t\t'h-signature': signature,\n\t\t\t\t\t'h-timestamp': timestamp\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn config\n\t\t}, (err) => {\n\t\t\treturn Promise.reject(err)\n\t\t})\n\t}", "get noTokenHeader() {\n return new HttpHeaders({\n 'Content-Type': 'application/json',\n 'Cache-Control': 'no-cache',\n Pragma: 'no-cache',\n Expires: 'Sat, 01 Jan 2000 00:00:00 GMT'\n });\n }", "function getHeaders() {\n if (accessToken) {\n return { \"Authorization\": \"Bearer \" + accessToken };\n }\n }", "function request(config) {\n\t var token = $sessionStorage.authData && $sessionStorage.authData.Token;\n\t\n\t if (token) {\n\t config.headers.Authorization = token;\n\t config.headers = config.headers || {};\n\t }\n\t\n\t return config;\n\t }", "function exportNodeCompatibleHeaders(headers) {\n var obj = Object.assign({\n __proto__: null\n }, headers[MAP]); // http.request() only supports string as Host header. This hack makes\n // specifying custom Host header possible.\n\n var hostHeaderKey = find(headers[MAP], 'Host');\n\n if (hostHeaderKey !== undefined) {\n obj[hostHeaderKey] = obj[hostHeaderKey][0];\n }\n\n return obj;\n}", "prepareAuthHeader(config = {}) {\n switch (config.AUTH_TYPE) {\n case 'JWT' :\n this.AUTH_HEADER = `JWT ${config.JWT}`;\n break;\n case 'BASIC' :\n this.AUTH_HEADER = `BASIC ${config.B64}`;\n break;\n case 'TOKEN' :\n this.AUTH_HEADER = `BEARER ${config.TOKEN}`;\n break;\n }\n\n // Add authentication header to axios\n this.axios.interceptors.request.use(\n config => {\n config.headers.authorization = this.AUTH_HEADER;\n return config;\n }\n );\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Bearer ${this.token}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Bearer ${this.token}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Bearer ${this.token}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Bearer ${this.token}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Bearer ${this.token}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Bearer ${this.token}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Bearer ${this.token}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Bearer ${this.token}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Bearer ${this.token}`;\n }", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function exportNodeCompatibleHeaders$1(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP$1]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find$1(headers[MAP$1], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "function parseOAuthHeaders(oAuthEchoHeaders) {\n var credentials = oAuthEchoHeaders['X-Verify-Credentials-Authorization'];\n var apiUrl = oAuthEchoHeaders['X-Auth-Service-Provider'];\n\n return {\n apiUrl: apiUrl,\n credentials: credentials\n };\n }", "function default_1(user) {\n if (Object.keys(user).length === 0) {\n return {};\n }\n const response = {\n name: user.name,\n login: user.login,\n avatar_url: user.avatar_url\n };\n return response;\n}", "function exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find$1(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}", "headers () {\n return {\n 'content-type': 'application/json',\n 'accept': 'application/json',\n 'Authorization': localStorage.getItem('jwt')\n }\n }", "function wrapJwtInHeader(token) {\n return { headers: { Authorization: 'Bearer ' + token } };\n}", "function getHeaders() {\n return {\n \"Content-Type\": \"application/json\",\n \"x-merchant-checksum\": \"test_value\",\n \"x-merchant-id\": merchantId,\n \"x-merchant-channel-id\": merchantId,\n \"x-timestamp\": Date.now()\n }\n}", "getAuthorizationHeader() {\n const accessToken = this.getState(\"tokenResponse.access_token\");\n\n if (accessToken) {\n return \"Bearer \" + accessToken;\n }\n\n const {\n username,\n password\n } = this.state;\n\n if (username && password) {\n return \"Basic \" + this.environment.btoa(username + \":\" + password);\n }\n\n return null;\n }", "function parseOAuthHeaders(oAuthEchoHeaders) {\n var credentials = oAuthEchoHeaders['X-Verify-Credentials-Authorization'];\n var apiUrl = oAuthEchoHeaders['X-Auth-Service-Provider'];\n\n return {\n apiUrl: apiUrl,\n credentials: credentials\n };\n }", "function getHeaders(apiKey) {\r\n return new Headers({\r\n Accept: 'application/json',\r\n 'x-goog-api-key': apiKey\r\n });\r\n}", "setHeader() {\n if (this.hasValidToken()) {\n axios.defaults.headers.common['Authorization'] = `Bearer ${this.token}`;\n }\n }", "function parseOAuthHeaders(oAuthEchoHeaders) {\n var credentials = oAuthEchoHeaders['oauth_echo_header'];\n var apiUrl = oAuthEchoHeaders['oauth_echo_service'];\n\n return {\n apiUrl: apiUrl,\n credentials: credentials\n };\n }", "function parseOAuthHeaders(oAuthEchoHeaders) {\n var credentials = oAuthEchoHeaders['oauth_echo_header'];\n var apiUrl = oAuthEchoHeaders['oauth_echo_service'];\n\n return {\n apiUrl: apiUrl,\n credentials: credentials\n };\n }", "setQLRequestHeaders(headers) {\n headers = headers || {};\n\n // set additional headers\n if (process.env.QL_V2_AUTH_KEY) {\n headers['Authorization'] = 'Bearer ' + process.env.QL_V2_AUTH_KEY;\n }\n if (process.env.QL_V2_API_KEY) {\n headers['X-Api-Key'] = process.env.QL_V2_API_KEY;\n }\n if (process.env.QL_V2_TENANT) {\n headers['Fiware-Service'] = process.env.QL_V2_TENANT;\n }\n if (process.env.QL_V2_SUBTENANT) {\n headers['Fiware-Servicepath'] = process.env.QL_V2_SUBTENANT;\n }\n\n return headers;\n }", "function maybeAddAcceptHeader (headers = {}) {\n return headers.hasOwnProperty('Accept')\n ? headers\n : {'Accept': 'application/json', 'Content-Type': 'application/json;charset=UTF-8', ...headers}\n}", "#genHeaders(headerNames) {\n\t\tconst headers = {};\n\n\t\tif (headerNames.includes('Content-Type')) headers['Content-Type'] = 'application/x-www-form-urlencoded';\n\t\tif (headerNames.includes('Authorization')) headers['Authorization'] = `OAuth ${this.accessToken}`;\n\n\t\treturn headers;\n\t}", "function getHeaders(apiKey) {\n return new Headers({\n Accept: 'application/json',\n 'x-goog-api-key': apiKey\n });\n}", "_authHTTPConfig (httpConfig) {\n\t\thttpConfig = this._getHTTPConfig(httpConfig);\n\t\thttpConfig.headers = Object.assign(httpConfig.headers || {}, {\n\t\t\t'Access-Token': this._authToken\n\t\t});\n\t\treturn httpConfig;\n\t}", "function getDefaultUserAgentKey() {\n return Constants.HeaderConstants.USER_AGENT;\n}", "function getDefaultUserAgentKey() {\n return Constants.HeaderConstants.USER_AGENT;\n}", "function createHeaders(token, contentLength){\n var headers ={\n 'Authorization': 'Bearer ' + token,\n 'Content-Type': 'application/json'\n };\n \n return headers;\n}", "function getConfig() {\n\t\treturn {\n\t\t\theaders: {\n\t\t\t\t'Auth-Token': 'test'\n\t\t\t}\n\t\t};\n\t}", "clone() {\n const resultPreservingCasing = {};\n for (const headerKey in this._headersMap) {\n const header = this._headersMap[headerKey];\n resultPreservingCasing[header.name] = header.value;\n }\n return new HttpHeaders(resultPreservingCasing);\n }", "clone() {\n const resultPreservingCasing = {};\n for (const headerKey in this._headersMap) {\n const header = this._headersMap[headerKey];\n resultPreservingCasing[header.name] = header.value;\n }\n return new HttpHeaders(resultPreservingCasing);\n }", "clone() {\n const resultPreservingCasing = {};\n for (const headerKey in this._headersMap) {\n const header = this._headersMap[headerKey];\n resultPreservingCasing[header.name] = header.value;\n }\n return new HttpHeaders(resultPreservingCasing);\n }", "function createApiRequest(apiKey) {\n var apiRequest = request.defaults({\n auth: {\n bearer: apiKey\n }\n });\n\n return apiRequest;\n}", "getAuthHeader() {\n return {\n 'Authorization': 'Bearer ' + localStorage.getItem('access_token')\n }\n }", "prepareRequest(options) {\n options.headers['Authorization'] = 'Bearer ' + this.token;\n }", "__getRequestOptions(path, host_name, api_key) {\n return {\n hostname: host_name,\n path: path,\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n 'api_key': api_key,\n 'Accept': 'application/json'\n }\n };\n }" ]
[ "0.654885", "0.65065837", "0.61355853", "0.5976861", "0.5959714", "0.5936714", "0.5783224", "0.5607589", "0.556974", "0.54544586", "0.54400766", "0.54378533", "0.54142433", "0.5412223", "0.539509", "0.5370538", "0.5350623", "0.5338816", "0.53290856", "0.5317778", "0.5273668", "0.5247136", "0.52465624", "0.52283317", "0.52257854", "0.5212607", "0.52055156", "0.5202877", "0.5197238", "0.5175842", "0.5166132", "0.5145969", "0.5138592", "0.5138592", "0.5138592", "0.5138592", "0.5138592", "0.5138592", "0.5138592", "0.5138592", "0.5138592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5122592", "0.5103174", "0.5096818", "0.5090413", "0.507884", "0.5078216", "0.507371", "0.5055137", "0.50432616", "0.5041357", "0.50409067", "0.50211936", "0.50163966", "0.50163966", "0.4997291", "0.49951968", "0.49885112", "0.49746758", "0.49646813", "0.4935576", "0.4935576", "0.4917628", "0.49168834", "0.49001718", "0.49001718", "0.49001718", "0.48988706", "0.48855585", "0.4884937", "0.48690805" ]
0.5312011
20
Get scalar between 0 and 1 based on mouse position in element
function getVelocityScalar (element, clientX) { var width = element.offsetWidth, leftSide = element.getBoundingClientRect().left; return (clientX - leftSide) / width; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "normalize(mousePos) {\n const posOnOrigin = mousePos - this.slider.getBoundingClientRect().left; //Translated position on origin\n\n if (this.isBehindLowerLimit(posOnOrigin)) { //mouse is behind lower limit\n return 0; //...return start position\n }\n\n const point = posOnOrigin - this.cursor.clientWidth/2; //mouse is somewhere in between\n return point;\n }", "_trackOnClick(elem) {\n // TODO vertical: [1]\n var val = Px.d3.mouse(elem)[0], // Get the mouse position\n prop = 'value'; //assume it should affect the left value\n\n if(this.isRange) {\n //check to see which is closer\n var scaled = this._scale.invert(val),\n half = (this.endValue - this.value) / 2 + this.value;\n\n prop = (scaled > this.endValue || scaled > half) ? 'endValue' : 'value';\n }\n\n this._calcSliderValue(val, prop);\n }", "function mousePosition(mousePos, dimension) {\n return Math.floor(mousePos / dimension * (base * 2)) - base;\n }", "function getMousePos() {\n\t\t\t\t\t\t\treturn (mouseTopPerc * 400) + 10;\n\t\t\t\t\t\t}", "get Mouse0() {}", "getMouseVec2(e) { return { x: e.pageX - this.offsetX, y: e.pageY - this.offsetY }; }", "set Mouse0(value) {}", "get x()\n\t{\n\t\tif (this._x != null)\n\t\t\treturn this._x;\n\n\t\t/*\n\t\tif (this.isInput)\n\t\t\treturn this.node.posSmooth.x;\n\n\t\treturn this.node.posSmooth.x + this.node.width;\n\t\t*/\n\n\t\treturn this.node.input.plugPositions()[this.isInput ? 'inputs'\n\t\t\t: 'outputs'].filter(o => o.plug === this)[0].x;\n\t}", "CalculatePosition(e) {\n\t\tlet sliderOffsetWidth = this.node.offsetWidth\n\t\tlet sliderOffsetLeft = this.node.offsetLeft + this.node.offsetParent.offsetLeft\n\n\t\tlet x = Math.max(Math.min(e.x-sliderOffsetLeft, sliderOffsetWidth), 0)\n\t\treturn (x / sliderOffsetWidth) * 100\n\t}", "get hitbox_x1() { return -7; }", "get_global_mouse_x(mouse_event) {\n const scale = this.get_empirical_scale();\n const annbox = jquery_default()(\"#\" + this.config[\"annbox_id\"]);\n const raw = (mouse_event.pageX - annbox.offset().left + annbox.scrollLeft())/scale;\n // return Math.round(raw);\n return raw;\n }", "currentPointerPosition(e) {\n const [x, y] = Mouse.rel(e);\n return this.positionToSequence({\n xPos: x,\n yPos: y,\n });\n }", "updateMouseValues() {\n // map randomInc to the mouse X\n this.randomInc = map(mouseX, 0, width, 0, 5);\n // constarin random inc between 0 and 5\n this.randomInc = constrain(this.randomInc, 0, 5);\n // map damping to the mouse Y\n this.damping = map(mouseY, 0, height, 0, 1);\n // constrain damping between 0 and 1\n this.damping = constrain(this.damping, 0, 1);\n }", "function mousedown() {\n index = this.index;\n scene = this.scene;\n v1 = pv.vector(pv.event.pageX, pv.event.pageY);\n m1 = this.transform();\n k = 1 / (m1.k * this.scale);\n if (bound) {\n bound = {\n x: (1 - m1.k) * this.width(),\n y: (1 - m1.k) * this.height()\n };\n }\n }", "function mouse_coords(evt) {\r\n\tlet t = evt.currentTarget;\r\n\tlet x = evt.clientX - t.clientLeft - t.getBoundingClientRect().left + t.scrollLeft;\r\n\tlet y = evt.clientY - t.clientTop - t.getBoundingClientRect().top + t.scrollTop;\r\n\tx = 2*(x/t.width) - 1;\r\n\ty = 1 - 2*(y/t.height);\r\n\treturn vec2(x, y);\r\n}", "function WhereMouse( evt ){\n\n evt = !evt ? event : evt\n \n var Mouse_X = evt.clientX; \n var Mouse_Y = evt.clientY;\n \n var scroll_x=document.body.scrollLeft || document.documentElement.scrollLeft;\n var scroll_y=document.body.scrollTop || document.documentElement.scrollTop;\n \n Mouse_X += scroll_x;\n Mouse_Y += scroll_y;\n \n document.getElementById('imp1').value=Mouse_X\n document.getElementById('imp2').value=Mouse_Y\n}", "function mouseXY(e){\r\n var rect = canvas.getBoundingClientRect();\r\n mouseX = e.x - rect.left;\r\n mouseY = e.y - rect.top;\r\n\r\n}", "getHorizontalPosition(event){\n const pointerX = event.clientX - this.zoomImgSize.left;\n return this.turnToPercentage(pointerX, this.zoomImgSize.width);\n }", "function getMousePos(evt) {\n var rect = canvas.getBoundingClientRect();//returns size of element and its position relative to the viewport\n return {\n x: evt.clientX - rect.left,\n y: evt.clientY - rect.top\n };\n}", "function opacityMod(){\n if(mouseIsPressed && mouseX >= 665 && mouseX <= 670){\n if(mouseY >= 400 && mouseY <= 570){\n opacityConst = mouseY\n return opacityConst\n } else{\n return opacityConst\n }\n } else{\n return opacityConst\n }\n}", "function getMousePos(e){\n if(!e){\n var e = event;\n }\n if(e.offsetX){\n mouseX=e.offsetX;\n mouseY=e.offsetY;\n //console.log(\"here is x and y\", mouseX, mouseY)\n }\n else if (e.layerX){\n mouseX=e.layerX;\n mouseY=e.layerY;\n }\n }", "static get niceMouseDelta() {}", "function getMousePos(e) {\n if (!e)\n var e = event;\n\n if (e.offsetX) {\n mouseX = e.offsetX;\n mouseY = e.offsetY;\n }\n else if (e.layerX) {\n mouseX = e.layerX;\n mouseY = e.layerY;\n }\n }", "function getMousePos(e) {\n if (!e)\n var e = event;\n\n if (e.offsetX) {\n mouseX = e.offsetX;\n mouseY = e.offsetY;\n }\n else if (e.layerX) {\n mouseX = e.layerX;\n mouseY = e.layerY;\n }\n }", "function mousePressed() {\n if (((mouseX >= 842) && (mouseX <= 917)) && ((mouseY >= 167) && (mouseY <= 243))) {\n value = 1;\n } else if (((mouseX >= 612) && (mouseX <= 687)) && ((mouseY >= 312) && (mouseY <= 487))) {\n value = 2;\n } else if (((mouseX >= 137) && (mouseX <= 212)) && ((mouseY >= 312) && (mouseY <= 487))) {\n value = 3;\n } else if (((mouseX >= 842) && (mouseX <= 917)) && ((mouseY >= 447) && (mouseY <= 522))) {\n value = 4;\n } else if (((mouseX >= 12) && (mouseX <= 87)) && ((mouseY >= 547) && (mouseY <= 622))) {\n value = 5;\n } else if (((mouseX >= 430) && (mouseX <= 505)) && ((mouseY >= 682) && (mouseY <= 757))) {\n value = 6;\n } else {\n value = 0;\n } //end else\n resetcode();\n} //end mousePressed", "function mousePressed(){\n console.log (mouseX, mouseY);\n}", "function kwmousePosition(event, element)\n{\n var offset = jQuery(element).offset();\n return {left: event.pageX - offset.left, top: event.pageY - offset.top};\n}", "function currentBox(){\n return [floor(mouseX / scl), floor(mouseY/scl)]\n}", "pageX() {\n return ELEM._getVisibleLeftPosition(this.elemId);\n }", "get x() {\n\t\t\treturn this._x / this.scale;\n\t\t}", "function mouseClicked(){\n // the x position will take the value of the horizontal mouse position\n xPos=mouseX;\n // the y position will take the value of the vertical mouse position\n yPos = mouseY;\n}", "function getMousePos(e) {\n $cc = document.getElementById('canvasContainer');\n var rect = $cc.getBoundingClientRect();\n x = Math.floor ( (e.clientX - rect.left - overscan) / pixelSize );\n y = Math.floor ( (e.clientY - rect.top - overscan) / pixelSize );\n magX = x;\n magY = y;\n \n if ( magnifyOn ) {\n if ( x > magStart ) {\n magX = ( ( magX - magStart ) / multiplier );\n magY = ( magY / multiplier);\n magX += magAdjustX;\n magY += magAdjustY;\n } else {\n magX += imgAdjustX;\n magY += imgAdjustY;\n }\n }\n \n return {\n pointerX: Math.floor ( x ),\n pointerY: Math.floor ( y ),\n x: Math.floor ( magX ),\n y: Math.floor ( magY )\n };\n }", "_mousePosition(event)\n {\n // Used to get the absolute size\n let rect = this.parent.getBoundingClientRect();\n \n /* relationship bitmap vs element for X/Y */\n \n // Gets the x scale\n let scaleX = this.parent.width / rect.width;\n \n // Gets the y scale\n let scaleY = this.parent.height / rect.height;\n \n \n // Returns two possible values\n return {\n // Mouse x position after taking into account the size/position of canvas and scale\n x: (event.clientX - rect.left) * scaleX,\n \n // Mouse y position after taking into account the size/position of canvas and scale\n y: (event.clientY - rect.top) * scaleY\n \n };\n \n }", "function getPos_x(){\n return x;\n}", "function getMousePos(canvas, evt) {\n\t\t var rect = canvas.getBoundingClientRect(), // abs. size of element\n\t\t scaleX = canvas.width / rect.width, // relationship bitmap vs. element for X\n\t\t scaleY = canvas.height / rect.height; // relationship bitmap vs. element for Y\n\n\t\t return {\n\t\t x: (evt.clientX - rect.left) * scaleX, // scale mouse coordinates after they have\n\t\t y: (evt.clientY - rect.top) * scaleY // been adjusted to be relative to element\n\t\t }\n\t\t}", "mousePos(dst) {\n dst = dst || new VMathArrayConstructor(2);\n this.camera.physicalToVirtual(dst, this.mouse_pos);\n return dst;\n }", "get x() {\n return this._x / this.scale;\n }", "function offset(e) {\n e = e || window.event;\n var target = e.target || e.srcElement, rect = target.getBoundingClientRect(), offsetX = e.clientX - rect.left, offsetY = e.clientY - rect.top;\n return vec2.fromValues(offsetX, offsetY);\n }", "function offset(e) {\n e = e || window.event;\n var target = e.target || e.srcElement, rect = target.getBoundingClientRect(), offsetX = e.clientX - rect.left, offsetY = e.clientY - rect.top;\n return vec2.fromValues(offsetX, offsetY);\n }", "function getMousePos(e) {\n if (!e)\n var e = event;\n\n if (e.offsetX) {\n mouseX = e.offsetX;\n mouseY = e.offsetY;\n }\n else if (e.layerX) {\n mouseX = e.layerX;\n mouseY = e.layerY;\n }\n }", "function getMousePos(e) {\n if (!e)\n var e = event;\n\n if (e.offsetX) {\n mouseX = e.offsetX;\n mouseY = e.offsetY;\n }\n else if (e.layerX) {\n mouseX = e.layerX;\n mouseY = e.layerY;\n }\n }", "function onMouseMove(event) {\n mousePos = event.point;\n}", "getMousePos(e) {\n if (!e) {\n let e = event\n }\n if (e.offsetX) {\n this.mouseX = e.offsetX\n this.mouseY = e.offsetY\n }\n else if (e.layerX) {\n this.mouseX = e.layerX\n this.mouseY = e.layerY\n }\n }", "function getMousePos(canvas, evt) {\n\t\tvar rect = canvas.getBoundingClientRect(), // abs. size of element\n\t\tscaleX = canvas.width / rect.width, // relationship bitmap vs. element for X\n\t\tscaleY = canvas.height / rect.height; // relationship bitmap vs. element for Y\n\t\treturn {\n\t\t\tx: (evt.clientX - rect.left) * scaleX, // scale mouse coordinates after they have\n\t\t\ty: (evt.clientY - rect.top) * scaleY // been adjusted to be relative to element\n\t\t}\n\t}", "calculateMousePos(evt) {\n let rect = this.canvasEl.getBoundingClientRect();\n let root = document.documentElement;\n var mouseX = evt.clientX - rect.left - root.scrollLeft;\n var mouseY = evt.clientY - rect.top - root.scrollTop;\n return {\n x: mouseX,\n y: mouseY\n };\n }", "getMousePos() {\n let g = this,\n _main = window._main,\n cxt = g.context,\n cards = _main.cards,\n x = g.mouseX,\n y = g.mouseY;\n // Mouse movement to draw plants\n if (g.canDrawMousePlant) {\n g.mousePlantCallback(x, y);\n }\n }", "function getMousePos(e) {\n if (!e)\n var e = event;\n\n if (e.offsetX) {\n mouseX = e.offsetX;\n mouseY = e.offsetY;\n }\n else if (e.layerX) {\n mouseX = e.layerX;\n mouseY = e.layerY;\n }\n}", "function getMousePos (e) {\n if (!e) var e = event\n if (e.offsetX) {\n mouseX = e.offsetX\n mouseY = e.offsetY\n } else if (e.layerX) {\n mouseX = e.layerX\n mouseY = e.layerY\n }\n}", "function getMousePos(e) {\n if (!e)\n var e = event;\n\n if (e.offsetX) {\n mouseX = e.offsetX;\n mouseY = e.offsetY;\n }\n else if (e.layerX) {\n mouseX = e.layerX;\n mouseY = e.layerY;\n }\n}", "function getMousePos(e) {\n if (!e)\n e = event;\n\n if (e.offsetX) {\n g_mouseX = e.offsetX;\n g_mouseY = e.offsetY;\n }\n else if (e.layerX) {\n g_mouseX = e.layerX;\n g_mouseY = e.layerY;\n }\n}", "function mousePositionElement(e, el) {\n var mousePosDoc = mousePositionDocument(e); // var target = mouseTarget(e);\n\n var target = el;\n var targetPos = findPos(target);\n var posx = mousePosDoc.x - targetPos.left;\n var posy = mousePosDoc.y - targetPos.top;\n return {\n x: posx,\n y: posy\n };\n}", "function mousePositionElement(e, el) {\n var mousePosDoc = mousePositionDocument(e); // var target = mouseTarget(e);\n\n var target = el;\n var targetPos = findPos(target);\n var posx = mousePosDoc.x - targetPos.left;\n var posy = mousePosDoc.y - targetPos.top;\n return {\n x: posx,\n y: posy\n };\n}", "function getMousePos(e) \n{\n\t//returns two values, x and y, representing the coordinates relative to the event provided in the parameters\n\treturn { x: e.offsetX, y: e.offsetY };\n}", "function getMousePos(event) {\n var e = event || window.event;\n var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;\n var scrollY = document.documentElement.scrollTop || document.body.scrollTop;\n var x = e.pageX || e.clientX + scrollX;\n var y = e.pageY || e.clientY + scrollY;\n //alert('x: ' + x + '\\ny: ' + y);\n var intElemClientWidth = document.body.clientWidth;\n var intElemClientHeight = document.body.clientHeight;\n console.log(intElemClientWidth,intElemClientHeight,x,y);\n\n\n player.selectCharacter(intElemClientWidth,intElemClientHeight,x,y);\n return { 'x': x, 'y': y };\n}", "function mousePressed() {\n\tx = 40;//Cada vez que pressiona o mouse posicao x recebe o valor\n\ty = 10;//Cada vez que pressiona o mouse posicao y recebe o valor\n}", "function $getMouseX(e) {\r\n\t\tvar scrollX = $getScrollX();\r\n\t\tif (e.pageX) return e.pageX + scrollX;\r\n\t\tif (e.clientX) return e.clientX + scrollX;\r\n\t\treturn 0;\r\n\t}", "function getMousePosScale(canvas, evt){\n var rect = canvas.getBoundingClientRect(),\n\tscaleX = canvas.width / rect.width,\n\tscaleY = canvas.height / rect.height;\n\n return {\n\t x: (evt.clientX - rect.left) * scaleX,\n\t y: (evt.clientY - rect.top) * scaleY\n }\n}", "function getMouseXY(e) {\n tempX = e.clientX\n tempY = e.clientY\n // catch possible negative values in NS\n if (tempX < 0){tempX = 0}\n if (tempY < 0){tempY = 0}\n }", "function getMousePos(canvas, evt) {\n var rect = canvas.getBoundingClientRect();\n return {\n x: Math.floor(((evt.clientX - rect.left)/3)/5),\n y: Math.floor(((evt.clientY - rect.top)/3)/5)\n };\n}", "function getRelativePosition(e, el) {\n div = document.getElementById(\"scene\");\n dim = div.getBoundingClientRect();\n x = Math.floor( ((e.clientX - dim.left) / pw) / level);\n y = Math.floor(((e.clientY - dim.top) / pw) / level);\n}", "function getMousePos(evt) { //return the mouse pos on canvas\n var rect = ctx.getBoundingClientRect();\n return {\n x: evt.clientX - rect.left,\n y: evt.clientY - rect.top\n };\n }", "function onMouseUpdate(e) {\n x = e.pageX;\n y = e.pageY;\n}", "_positionFromMouseEvent(event, element, mouseService) {\n const coords = mouseService.getCoords(event, element, this._bufferService.cols, this._bufferService.rows);\n if (!coords) {\n return;\n }\n return { x: coords[0], y: coords[1] + this._bufferService.buffer.ydisp };\n }", "function integerSnapTranslate() {\n let transX = mouseX;\n let transY = mouseY;\n\n if (document.getElementById(\"intSnap\").checked) {\n // perform translation\n transX = Math.round(transX / gridSpacing) * gridSpacing;\n // -1 flips y direction so that positive y values are above origin\n transY = Math.round(transY / gridSpacing) * gridSpacing;\n }\n\n return {\n x: transX,\n y: transY\n };\n}", "function getMousePos(evt) {\n var rect = canvas.getBoundingClientRect();\n return {\n x: Math.round((evt.clientX - rect.left) / (rect.right - rect.left) * canvas.width),\n y: Math.round((evt.clientY - rect.top) / (rect.bottom - rect.top) * canvas.height)\n };\n}", "function mouse(e) {\n return [e.pageX - rx, e.pageY - ry];\n }", "function clipspaceMousePos() {\n return [2.0 * mousePosition[0] / canvas.width - 1.0, -2.0 * mousePosition[1] / canvas.height + 1.0]\n}", "function mouseClicked(){\n\tconsole.log(mouseX, mouseY);\n}", "function mouseToCenter(){\n return dist(mouseX, mouseY, center.x, center.y);\n}", "set Mouse1(value) {}", "function getMousePos(canvas, evt)\n{\n var rect = canvas.getBoundingClientRect();\n return {\n x: (evt.clientX - rect.left) / (rect.right - rect.left) * canvas.width,\n y: (evt.clientY - rect.top) / (rect.bottom - rect.top) * canvas.height\n };\n}", "getPos(evt) {\r\n if (evt.changedTouches != undefined) { // convert touch into click-like event\r\n evt = evt.changedTouches[0];\r\n }\r\n var w = this.canvas.width;\r\n var h = this.canvas.height;\r\n var r = this.cfg.radius;\r\n\r\n var rect = evt.target.getBoundingClientRect();\r\n var evtx = evt.clientX - rect.left;\r\n var evty = evt.clientY - rect.top;\r\n var x = map(constrain(evtx, r, w - r), r, w - r, this.cfg.range.x[0], this.cfg.range.x[1]);\r\n var y = map(constrain(evty, r, h - r), h - r, r, this.cfg.range.y[0], this.cfg.range.y[1]);\r\n\r\n return {x: Math.round(x), y: Math.round(y)};\r\n }", "effect(){\n return(player.points.pow(0.25).times(0.5).plus(1))\n }", "function calculateMousePos(evt){\n var rect = canvas.getBoundingClientRect();\n var root = document.documentElement;\n var mouseX = evt.clientX - rect.left - root.scrollLeft;\n var mouseY = evt.clientY - rect.top - root.scrollTop;\n return {\n x:mouseX,\n y:mouseY\n }\n}", "getMousePos(canvas, event) {\n var rect = canvas.getBoundingClientRect();\n return {\n x: event.clientX - rect.left,\n y: event.clientY - rect.top\n };\n}", "function mousePos(canvas, e) {\n let rect = canvas.getBoundingClientRect();\n let scaleX = canvas.width / rect.width;\n let scaleY = canvas.height / rect.height;\n return {\n x: (e.clientX - rect.left) * scaleX,\n y: (e.clientY - rect.top) * scaleY\n }\n}", "function calculateMousePosition(evt) {\r\n\tvar rect = canvas.getBoundingClientRect();\r\n\tvar root = document.documentElement;\r\n\tvar mouseX = evt.clientX - rect.left - root.scrollLeft;\r\n\tvar mouseY = evt.clientY - rect.top - root.scrollTop;\r\n\t//return as an object\r\n\treturn{\r\n\t\tx: mouseX,\r\n\t\ty: mouseY\r\n\t};\r\n}", "function getMousePos(e) {\r\n var rect = canvas.getBoundingClientRect();\r\n return {\r\n x: e.clientX - rect.left,\r\n y: e.clientY - rect.top\r\n };\r\n }", "function getMousePos(evt) {\n \tvar rect = canvas.getBoundingClientRect();\n \t\n \treturn {\n \t\tx: Math.floor(evt.clientX - rect.left),\n \t\ty: Math.floor(evt.clientY - rect.top)\n \t};\n }", "function getMousePos(evt) {\n \tvar rect = canvas.getBoundingClientRect();\n \t\n \treturn {\n \t\tx: Math.floor(evt.clientX - rect.left),\n \t\ty: Math.floor(evt.clientY - rect.top)\n \t};\n }", "function getCurPos() {\n let xPos = event.offsetX;\n let yPos = event.offsetY;\n //for each selected==true ? card chang its position : nothing\n player.cards.onHand.forEach(element => {\n if (element.selected) {\n element.speaking = false;\n let distanceX = element.width / 2;\n let distanceY = element.height / 2;\n element.x = xPos - distanceX;\n element.y = yPos - distanceY;\n }\n });\n}", "get Mouse1() {}", "function getMousePosition(e) {\n mouseX = e.offsetX;\n mouseY = e.offsetY;\n}", "function calculateMousePos( e ) {\n var rect = canvas.getBoundingClientRect();\n var root = document.documentElement;\n var mouseX = e.clientX - rect.left - root.scrollLeft;\n var mouseY = e.clientY - rect.top - root.scrollTop;\n return {\n x : mouseX,\n y : mouseY\n };\n}", "function mouseSquare()\n{\n var mouse={x:-1, y:-1} ;\n if ((mouseX/pixelSize) >= 100 && (mouseX/pixelSize) < 900 && \n (mouseY/pixelSize) >= 100 && (mouseY/pixelSize) < 900) {\n mouse.x=Math.floor((mouseX/pixelSize)/100)-1;\n mouse.y=Math.floor((mouseY/pixelSize)/100)-1;\n if (reverse) {\n mouse.x=7-mouse.x;\n mouse.y=7-mouse.y;\n }\n }\n return mouse;\n}", "function getMouse(e) {\n var element = canvas, offsetX = 0, offsetY = 0;\n if (element.offsetParent) {\n do {\n offsetX += element.offsetLeft;\n offsetY += element.offsetTop;\n } while ((element = element.offsetParent));\n }\n // Add padding and border style widths to offset\n offsetX += stylePaddingLeft;\n offsetY += stylePaddingTop;\n\n offsetX += styleBorderLeft;\n offsetY += styleBorderTop;\n\n mx = e.pageX - offsetX;\n my = e.pageY - offsetY\n}", "function makeComparison($el) {\n const fps = 60;\n const throttleDelay = 1000 / fps;\n\n $el.onmousemove = updatePosition\n\n function updatePosition(e) {\n const relative = e.offsetX / $el.clientWidth;\n $el.style.setProperty('--current-position', `${relative * 100}%`);\n }\n }", "getTouchOffsetValue(event) {\n let targetElement = this.viewerContainer;\n let offset = targetElement.getBoundingClientRect();\n let touchOffsetValues = event.touches[0];\n if (isNullOrUndefined(touchOffsetValues)) {\n touchOffsetValues = event.changedTouches[0];\n }\n let offsetX = touchOffsetValues.pageX - offset.left;\n let offsetY = touchOffsetValues.pageY - offset.top;\n return new Point(offsetX, offsetY);\n }", "function calculateMousePos(evt) {\n\tvar rect = canvas.getBoundingClientRect();\n\tvar root = document.documentElement;\n\tvar mouseX = evt.clientX - rect.left - root.scrollLeft;\n\tvar mouseY = evt.clientY - rect.top - root.scrollTop;\n\treturn {\n\t\tx:mouseX,\n\t\ty:mouseY\n\t};\n}", "function getMousePos(event)\n {\n var rect = canvas.getBoundingClientRect();\n return {\n x: Math.floor((event.clientX - rect.left) / 40),\n y: Math.floor((event.clientY - rect.top) / 40)\n };\n }", "function calculateMousePos(evt) {\n\tvar rect = canvas.getBoundingClientRect();\n\tvar root = document.documentElement;\n\tvar mouseX = evt.clientX - rect.left - root.scrollLeft;\n\tvar mouseY = evt.clientY - rect.top - root.scrollTop;\n\treturn {\n\t\tx: mouseX,\n\t\ty: mouseY\n\t};\n}", "function MousePos(event) {\n\t\tvar p = svg.createSVGPoint();\n\t\tp.x = event.clientX;\n\t\tp.y = event.clientY;\n\t\tvar matrix = svg.getScreenCTM();\n\t\tp = p.matrixTransform(matrix.inverse());\n\t\treturn {\n\t\t\tx: p.x,\n\t\t\ty: p.y\n\t\t}\n}", "function mousePos(layer) {\n return isCamLayer(layer) ? game.camMousePos : app.mousePos();\n }", "function getMouse(e) {\n\t\t\tvar element = canvas, offsetX = 0, offsetY = 0;\n\t\n\t\t\tif (element.offsetParent) {\n\t\t\tdo {\n\t\t\t\toffsetX += element.offsetLeft;\n\t\t\t\toffsetY += element.offsetTop;\n\t\t\t} while ((element = element.offsetParent));\n\t\t\t}\n\t\n\t\t\t// Add padding and border style widths to offset\n\t\t\toffsetX += stylePaddingLeft;\n\t\t\toffsetY += stylePaddingTop;\n\t\n\t\t\toffsetX += styleBorderLeft;\n\t\t\toffsetY += styleBorderTop;\n\t\n\t\t\tmx = e.pageX - offsetX;\n\t\t\tmy = e.pageY - offsetY\n\t}", "function getMouse(e) {\n var element = canvas, offsetX = 0, offsetY = 0;\n\n if (element.offsetParent) {\n do {\n offsetX += element.offsetLeft;\n offsetY += element.offsetTop;\n } while ((element = element.offsetParent));\n }\n\n // Add padding and border style widths to offset\n offsetX += stylePaddingLeft;\n offsetY += stylePaddingTop;\n\n offsetX += styleBorderLeft;\n offsetY += styleBorderTop;\n\n mx = e.pageX - offsetX;\n my = e.pageY - offsetY\n}", "function getMouse(e) {\n var element = canvas, offsetX = 0, offsetY = 0;\n\n if (element.offsetParent) {\n do {\n offsetX += element.offsetLeft;\n offsetY += element.offsetTop;\n } while ((element = element.offsetParent));\n }\n\n // Add padding and border style widths to offset\n offsetX += stylePaddingLeft;\n offsetY += stylePaddingTop;\n\n offsetX += styleBorderLeft;\n offsetY += styleBorderTop;\n\n mx = e.pageX - offsetX;\n my = e.pageY - offsetY\n}", "function CurrentMouseRay()\n{\n return MouseRay(prevFrameMouseX, prevFrameMouseY);\n}", "function getMousePosition(){\n\t\t\t$(\"canvas\").mousemove(function(event){\n\t\t\t\tvar canvasOffsetX = $(this).position().left;\n\t\t\t\tvar canvasOffsetY = $(this).position().top;\n\n\n\n\t\t\t\tvar posX = Math.floor(event.pageX - canvasOffsetX);\n\t\t\t\tvar posY = Math.floor(event.pageY - canvasOffsetY);\n\n\t\t\t\t//TODO: every 0.5 - 1.0s, push this into a data structure to prep for time-series graph\n\t\t\t\t//NOTE: here would be a potentially good location to add plotly functionality \n\t\t\t\t// console.log(posX, posY);\n\t\t\t\tpositionTracker.pos_x = posX;\n\t\t\t\tpositionTracker.pos_y = posY;\n\t\t\t\t// console.log(res, canvasOffsetX, canvasOffsetY);\n\n\t\t\t});\n\t\t}", "function onMouseMove(event) {\n\tmousePos = event.point;\n}", "on_mousemove(e, localX, localY) {\n\n }" ]
[ "0.6802194", "0.6790664", "0.67010146", "0.6638168", "0.63888645", "0.62168574", "0.6214115", "0.620874", "0.6197", "0.61935127", "0.61898494", "0.61816037", "0.61734617", "0.6155172", "0.615382", "0.6132754", "0.6108427", "0.6070771", "0.6060658", "0.6040117", "0.6036851", "0.6032879", "0.6013143", "0.60094994", "0.60012656", "0.5991933", "0.5987044", "0.5983682", "0.59745884", "0.5946241", "0.59456354", "0.59337056", "0.5926908", "0.59263754", "0.5917926", "0.5917447", "0.5909379", "0.5909052", "0.5909052", "0.59044385", "0.59044385", "0.5902535", "0.5889423", "0.5879684", "0.58770627", "0.5869615", "0.5864425", "0.5864345", "0.58546615", "0.58526313", "0.585046", "0.585046", "0.58439094", "0.58430886", "0.58424723", "0.58386713", "0.5837018", "0.58363855", "0.5826412", "0.5825646", "0.582411", "0.5823422", "0.5822623", "0.58159405", "0.58049756", "0.57941115", "0.5780818", "0.57788914", "0.57778347", "0.5772479", "0.57705534", "0.57684845", "0.5767424", "0.57659143", "0.5763413", "0.57591885", "0.5757348", "0.5750411", "0.5744658", "0.5744658", "0.5741195", "0.573199", "0.57304275", "0.5730396", "0.5724527", "0.57236844", "0.5721493", "0.5709829", "0.5705257", "0.57031506", "0.57029986", "0.57023275", "0.57018226", "0.56941605", "0.56914127", "0.56914127", "0.56895244", "0.5686934", "0.56808865", "0.5677817" ]
0.6437527
4
Hide control when scrolled all the way to the end
function updateControlVisability () { if (!didScroll) { return; } if (content.scrollLeft === 0) { leftEl.style.display = 'none'; } else { leftEl.style.display = 'block'; } if (content.scrollLeft === content.scrollWidth - content.offsetWidth) { rightEl.style.display = 'none'; } else { rightEl.style.display = 'block'; } didScroll = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hideScrollElem(){\n\t$('.dragger_container').hide(0)\n\t$(\".scrollUpBtn\").hide(0)\n\t$(\".scrollDownBtn\").hide(0)\n}", "function handleScrollStop() {\n scrollEngaged = false;\n}", "stop() {\n\t\tthis.scroll.stop();\n\t}", "function end(event) {\r\n\t\tvar el = event.target\r\n\t\tel.blur();\r\n\t\tself.endScroll();\r\n\t\tevent.stopPropagation();\r\n\t}", "function onscrollstop() {\n scroller.classList.remove('scrolling');\n frozenTHead.style.clip = getClipRect(scroller.scrollLeft, scrollerRect.width);\n frozenTHead.style.top = offsetTop + 'px';\n frozenTHead.style.transform = 'translateX(' + -scroller.scrollLeft + 'px)';\n }", "function unHideAfterThreshold(e) {\n\n if(!buttonDelayed) {\n return;\n }\n\n if($(window).scrollTop() >= e.data.threshold) {\n $('.awa-button-hidden').removeClass('awa-button-hidden');\n }\n\n }", "disableHideOnScroll() {\n this.root.removeAttribute('data-hide-on-scroll');\n this.hideOnScroll = false;\n this.root.classList.remove('is-hidden-scroll');\n }", "hide() {\n this.isVisible = false;\n }", "function hideElementsOnScroll() {\n hideHeaderOnScroll();\n hideAllDropdownContents();\n}", "function ScrollStop() {\r\n return false;\r\n}", "function scrollTopButtonHide() {\n\t\tif ($(window).width() < 1500) {\n\n\t\t\t$(window).on('scroll', function() {\n\t\t\t\tif ($(this).scrollTop() > 100) {\n\t\t\t\t\t$('.js-scroll-top-button').addClass('-show');\n\t\t\t\t} else {\n\t\t\t\t\t$('.js-scroll-top-button').removeClass('-show');\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif ($(document).scrollTop() > 100) {\n\t\t\t\t$('.js-scroll-top-button').addClass('-show');\n\t\t\t}\n\n\t\t}\n\t}", "keyboardDidHide(e) {\n //this.refs.scrollView.scrollTo({y: 50});\n //this.refs.scrollView.measure((ox, oy, width, height, px, py) => this.refs.scrollView.scrollTo({y: oy - 200}));\n }", "hideOffscreenElements() {\n const startIndex = Math.floor(-(this.scrollContainer.y - this.y) / this.itemHeight);\n const endIndex = Math.floor(startIndex + (this.height / this.itemHeight));\n for (let i = 0; i < this.items.length; i++) {\n const item = this.items[i];\n item.visible = false;\n if (i >= startIndex && i <= endIndex + 1) {\n item.visible = true;\n }\n }\n }", "function hideButtons(){\r\n\t\t\tif (slider.scrollLeft <= 20) {\r\n\t\t\t\tslideLeft.style.display = \"none\";\r\n\t\t\t}else{\r\n\t\t\t\tslideLeft.style.display = \"grid\";\r\n\t\t\t}\r\n\t\t\tif (maxScrollLeft == 0) {\r\n\t\t\t\tslideRight.style.display = \"none\";\r\n\t\t\t}else{\r\n\t\t\t\tslideRight.style.display = \"grid\";\r\n\t\t\t}\r\n\t\t}", "function hideCallmeScroll() {\n\t\t\t$(\".callme-input-scroll-fields\").hide( \"slide\", {direction: \"right\" }, 1000 );;\n\t\t}", "function checkScrollHeight() {\n let pos = window.scrollY\n let button = document.querySelector('.goto')\n\n if (pos > 50) {\n button.style.display = \"block\"\n } else {\n button.style.display = \"none\"\n }\n}", "stop() {\n\t\tclearTimeout(this.scrollTimeout_);\n\t}", "checkScroll() {\n const termsContainer = this.shadowRoot.getElementById('terms-container');\n if(termsContainer.offsetHeight + termsContainer.scrollTop >= termsContainer.scrollHeight - 5) {\n this.disabled = false;\n }\n }", "hideInfobar() {\n clearInterval(this.flag);\n clearInterval(this.flag1);\n this.visible = false;\n }", "function handleScrolling() {\n\tlet scrolled = root.scrollHeight - root.clientHeight;\n\tif((root.scrollTop / scrolled) > 0.95 ) {\n\t\tbtnToTop.style.display = 'block';\n\t} else {\n\t\tbtnToTop.style.display = 'none';\n\t};\n}", "hide() {\n if (this[$visible]) {\n this[$visible] = false;\n this[$updateVisibility]({ notify: true });\n }\n }", "_stopInterval() {\n this._stopScrolling.next();\n }", "forceHide() {\n this.__count = 0;\n this.hide();\n }", "_verticalScrollbarHandler() {\n const scrollViewer = this,\n verticalScrollBar = scrollViewer.$.verticalScrollBar,\n value = verticalScrollBar.value;\n\n if (scrollViewer.disabled) {\n return;\n }\n\n if (verticalScrollBar.max === value) {\n if (!scrollViewer._bottomReached) {\n scrollViewer.$.fireEvent('scrollBottomReached');\n delete scrollViewer._topReached;\n scrollViewer._bottomReached = true;\n }\n\n return;\n }\n\n if (verticalScrollBar.min === value) {\n if (!scrollViewer._topReached) {\n scrollViewer.$.fireEvent('scrollTopReached');\n delete scrollViewer._bottomReached;\n scrollViewer._topReached = true;\n }\n return;\n }\n\n delete scrollViewer._topReached;\n delete scrollViewer._bottomReached;\n }", "Hide() {\n if (this.COLLIDER != undefined) \n this.COLLIDER.Disable();\n \n return super.Hide();\n }", "hide() {\n RB.scrollManager.markForUpdate(this.$el);\n\n const height = this._$banner.outerHeight();\n\n this.$el\n .prop('hidden', true)\n .addClass('hidden')\n .css('max-height', '');\n\n /*\n * If we set the height immediately, the browser will appear to not\n * animate, since it can't transition heights (only max-heights). So\n * we delay for a short period after we know the transition will have\n * completed.\n */\n _.delay(\n () => {\n this.$el.css('height', '');\n RB.scrollManager.markUpdated(this.$el);\n RB.scrollManager.scrollYOffset -= height;\n },\n 500);\n }", "function hide_controls() {\r\n\r\n //Let the mouse movement lister know that the controls are now hidden.\r\n controls_hidden = true;\r\n\r\n //Hide the cursor on the body.\r\n $(document.body).css(\"cursor\", \"none\");\r\n\r\n //Fade out the control bar over 1500ms using opacity.\r\n $(\"#control_container\").animate({ opacity: 0 }, 1500);\r\n\r\n }", "checkIfVisibleFallback_() {\n const elTop = this.element_./*OK*/ getBoundingClientRect().top;\n const winInnerHeight = this.win_./*OK*/ innerHeight;\n\n if (winInnerHeight > elTop) {\n this.cb_();\n this.win_.removeEventListener('scroll', this.scrollHandler_);\n }\n }", "scrollToMax () {\n this.scrollView(0);\n }", "hide() {\n\t\tthis.isVisible = false;\n this.element.classList.remove('hide')\n\t\tthis.element.classList.remove('showCarousel')\n\t\tthis.element.classList.add('hideCarousel')\n\t\tthis.buttons.style.paddingTop = \"72px\"\n\t\t\n\t}", "enableHideOnScroll() {\n if (!this.sticky) {\n this.enableSticky();\n }\n\n this.root.setAttribute('data-hide-on-scroll', '');\n this.hideOnScroll = true;\n }", "_stopScrolling(event) {\n return false;\n }", "function handleScroll() {\n var yPos = window.pageYOffset\n if (yPos>700) {\n setShowTopButton(true)\n } else {\n setShowTopButton(false)\n }\n }", "offscreen () {\n if(this.y > height + this.pipeHeight) \n return true; \n return false;\n }", "hideGUI( ) {\n this.fireCallback( this.events.eventHandle.onChangeVisibility, false );\n }", "function isScrollEnd() {\n var el, rect, offsetTop, prev;\n el = element.get(0);\n rect = el.getBoundingClientRect();\n offsetTop = el.offsetTop;\n prev = scope.$prevPosition;\n\n //if (rect.top - $window.innerHeight / 4 < $window.innerHeight && offsetTop > prev) {\n if (rect.bottom < 200 && el.offsetHeight > initialHeight) {\n scope.$eval(attr.onLastScroll);\n initialHeight = el.offsetHeight;\n }\n }", "function hide() {\n\t\t\tdiv.hide();\n\t\t\tEvent.stopObserving(div, 'mouseover', onMouseMove);\n\t\t\tEvent.stopObserving(div, 'click', onClick);\n\t\t\tEvent.stopObserving(document, 'click', hide);\n\t\t\tEvent.stopObserving(textarea, 'click', hide);\n\t\t\tEvent.stopObserving(textarea, 'keydown', onKeyDown);\n\t\t\tvisible = false;\n\t\t}", "handleScroll(){\n this.setState({\n detachIOPanel: window.scrollY > 80\n });\n }", "_checkScrollingControls() {\n if (this.disablePagination) {\n this._disableScrollAfter = this._disableScrollBefore = true;\n }\n else {\n // Check if the pagination arrows should be activated.\n this._disableScrollBefore = this.scrollDistance == 0;\n this._disableScrollAfter = this.scrollDistance == this._getMaxScrollDistance();\n this._changeDetectorRef.markForCheck();\n }\n }", "disable() {\n if (this._scrollSubscription) {\n this._scrollSubscription.unsubscribe();\n this._scrollSubscription = null;\n }\n }", "disable() {\n if (this._scrollSubscription) {\n this._scrollSubscription.unsubscribe();\n this._scrollSubscription = null;\n }\n }", "function hideToTop() {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (nectarDOMInfo.scrollTop < 350 || $offCanvasEl.is('.fullscreen.open') ) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tvar $animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$('#to-top').stop().transition({\r\n\t\t\t\t\t\t\t'bottom': '-30px'\r\n\t\t\t\t\t\t}, $animationTiming, 'easeInOutQuint');\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$window.off('scroll', hideToTop);\r\n\t\t\t\t\t\t$window.on('scroll', showToTop);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "_onScrollEnd() {\n\n // Enable the animation class\n this._enableAnimation();\n\n // Stop after one frame so that animation is fully reenabled\n window.setTimeout(function() {\n this.stop({\n type: 'scroll'\n });\n }.bind(this), 1);\n }", "function hide_animation_overflow_area (direction){\n var index = '#filaIndiceDesb'+direction;\n $(index).hide();\t\n}", "hide()\n\t{\n\t\t// hide the decorations:\n\t\tsuper.hide();\n\n\t\t// hide the stimuli:\n\t\tif (typeof this._items !== \"undefined\")\n\t\t{\n\t\t\tfor (let i = 0; i < this._items.length; ++i)\n\t\t\t{\n\t\t\t\tif (this._visual.visibles[i])\n\t\t\t\t{\n\t\t\t\t\tconst textStim = this._visual.textStims[i];\n\t\t\t\t\ttextStim.hide();\n\n\t\t\t\t\tconst responseStim = this._visual.responseStims[i];\n\t\t\t\t\tif (responseStim)\n\t\t\t\t\t{\n\t\t\t\t\t\tresponseStim.hide();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// hide the scrollbar:\n\t\t\tthis._scrollbar.hide();\n\t\t}\n\t}", "keepBottomScroll() {\n if (!this.tree.hasFocus()) {\n // Scroll to end unless user is interacting with the list\n this.$container.scrollTop(this.$container[0].scrollHeight);\n }\n }", "function hideSuggestions()\n{\nvar oScroll = document.getElementById(\"scroll\");\noScroll.style.visibility = \"hidden\";\n}", "function giveBackScroll () {\n var body = document.body;\n body.style.overflowY = \"visible\";\n }", "function showMoreVisible() {\n var threshold, target = $(\"#\"+self.elementName );\n\n if (!target.length) return;\n\n threshold = $(window).scrollTop() + $(window).height() - target.height();\n //console.log(threshold);\n if (target.offset().top < threshold) {\n if (!target.data(\"visible\")) {\n // console.log(\"target became visible (inside viewable area)\");\n target.data(\"visible\", true);\n\n Session.set(\"itemsLimit\", Session.get(\"itemsLimit\") + self.ITEMS_INCREMENT);\n }\n } else {\n if (target.data(\"visible\")) {\n //console.log(\"target became invisible (below viewable arae)\");\n target.data(\"visible\", false);\n }\n }\n }", "function isBottomedOut() {\n if (confine && scrollbarYPos() > stickyBottomLine) {\n return true;\n }\n\n return false;\n }", "function checkVisible(){\n\t\tif (firedAnimation){\n\t\t\t// animation has already fired, detach the event listeners\n\t\t\tdocument.removeEventListener(\"scroll\", checkVisible, false);\n\t\t\twindow.removeEventListener(\"resize\", checkVisible, false);\n\t\t\treturn;\n\t\t}\n\t\tvar rect = chart.getBoundingClientRect();\n\t\tvar top = window.pageYOffset || document.documentElement.scrollTop;\n\t\tvar left = window.pageXOffset || document.documentElement.scrollLeft;\n\n\t\tif ((rect.top>=0)&&(rect.top <window.innerHeight) && \n\t\t\t(rect.left>=0)&&(rect.left <window.innerWidth)){\n\t\t\t// this means that we partly see the chart\n\t\t\t// fire the animation (only once)\n\t\t\tfiredAnimation = true;\n\t\t\tsetAnimate(startValue, endValue, (500/animationSpeed));\t\t\t\t\t\n\t\t}\n\t}", "checkForEnd() {\n if (this.rightPage !== 50) {\n this.onLastPage = false;\n } else {\n this.onLastPage = true;\n }\n }", "isHide() {\n return this.x < 0\n }", "function resetScroll() {\n var viewer = $find(viewerID);\n\n // Check the isLoading client-side property before using the reportAreaScrollPosition property.\n // Otherwise an exception will be thrown.\n if (!viewer.get_isLoading()) {\n viewer.set_reportAreaScrollPosition(new Sys.UI.Point(0,0));\n }\n}", "function blur () {\n hasFocus = false;\n if (!noBlur) {\n ctrl.hidden = shouldHide();\n }\n }", "function stopSeek() {\n isMouseDown = false;\n\n clearTimeout(navTimer);\n }", "hide() {\n const that = this,\n ownerElement = that.closest('jqx-splitter');\n\n that.$.addClass('jqx-hidden');\n\n if (ownerElement) {\n const ownerItems = ownerElement.items;\n\n if (ownerElement.hasAnimation) {\n let animatedItem;\n\n for (let i = 0; i < ownerItems.length; i++) {\n if (ownerItems[i].$.hasClass('animate')) {\n animatedItem = true;\n ownerItems[i].addEventListener('transitionend', function () {\n that.closest('jqx-splitter')._autoFitItems();\n }, { once: true });\n }\n }\n\n if (animatedItem) {\n return;\n }\n }\n\n ownerElement._autoFitItems();\n }\n }", "hide() {\n super.hide();\n this.overlay.classList.add(\"hidden\");\n unblurBaseElements(this);\n }", "function onFocus(){\n abortControlsAutoHide( this );\n}", "function slide_hideControl() {\n if (mayControlsBeHidden == 1) {\n if (document.getElementById(\"controle\").style.visibility != \"hidden\") {\n document.getElementById(\"controle\").style.visibility = \"hidden\";\n window.clearTimeout(idshowcontroltimeout);\n }\n }\n}", "function stopTheScroll () {\n $('body').css({\n 'overflow': 'hidden',\n })\n }", "_scrollSpy() {\n const currentScrollPosition = scrollPosition();\n if (currentScrollPosition.top > this.props.scrollStart) {\n if (!this.state.isVisible) {\n this.setState({ isVisible: true });\n }\n } else {\n if (this.state.isVisible) {\n this.setState({ isVisible: false });\n }\n }\n }", "_refreshVerticalScrollBarVisibility(scrollHeight) {\n const that = this;\n\n if (that._autoHeight) {\n that.scrollTop = 0;\n that.scrollHeight = 0;\n return;\n }\n\n if (that.computedHorizontalScrollBarVisibility) {\n scrollHeight += that.$.horizontalScrollBar.offsetHeight;\n }\n\n that.scrollHeight = scrollHeight;\n\n if (that.paging.enabled && that.paging.spinner.visible) {\n that.$.verticalScrollBarVisibility.classList.remove('jqx-hidden');\n }\n\n if (!that.computedVerticalScrollBarVisibility) {\n that.scrollTop = 0;\n }\n }", "_refreshVerticalScrollBarVisibility(scrollHeight) {\n const that = this;\n\n if (that._autoHeight) {\n that.scrollTop = 0;\n that.scrollHeight = 0;\n return;\n }\n\n if (that.computedHorizontalScrollBarVisibility) {\n scrollHeight += that.$.horizontalScrollBar.offsetHeight;\n }\n\n that.scrollHeight = scrollHeight;\n\n if (that.paging.enabled && that.paging.spinner.visible) {\n that.$.verticalScrollBarVisibility.classList.remove('smart-hidden');\n }\n\n if (!that.computedVerticalScrollBarVisibility) {\n that.scrollTop = 0;\n }\n }", "function noScroll() {\n window.scrollTo(0, scroll);\n }", "blur() {\r\n this.isFocussed = false;\r\n this.showLimits = true;\r\n }", "function cancelScroll() {\n\tif (!o3_followscroll || typeof over.scroller == 'undefined') return;\n\tover.scroller.canScroll = 1;\n\t\n\tif (over.scroller.timer) {\n\t\tclearTimeout(over.scroller.timer);\n\t\tover.scroller.timer=null;\n\t}\n}", "function cancelScroll() {\n $(window).scrollTop(savedY);\n}", "_verticalScrollbarHandler(event) {\n const that = this;\n const value = event.detail.value;\n event.stopPropagation();\n\n if (that.isVirtualized) {\n that._recycle();\n }\n else {\n that.$.itemsContainer.scrollTop = value;\n }\n\n that._updateTopVisibleIndex();\n\n if (event.context.max === event.context.value) {\n that.$.fireEvent('scrollBottomReached');\n return;\n }\n\n if (event.context.min === event.context.value) {\n that.$.fireEvent('scrollTopReached');\n }\n }", "function blur () {\n if (!noBlur) {\n hasFocus = false;\n ctrl.hidden = shouldHide();\n }\n }", "function noscroll() {\n window.scrollTo(0, 0);\n }", "function stopShowing() {\n\t}", "function stopShowing() {\n\t}", "onHide() {}", "onHide() {}", "function onScroll(){\n\tif (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20){\n\t\tupButtonTrending.style.display = \"block\";\n\t\tupButtonSearch.style.display = \"block\";\n\t}\n\telse{\n\t\tupButtonTrending.style.display = \"none\";\n\t\tupButtonSearch.style.display = \"none\";\n\t}\n}", "function hideCarets() {\n TweenMax.to(leftcaret, 1, {opacity: 0});\n TweenMax.to(rightcaret, 1, {opacity: 0});\n }", "function doHideSlide()\n {\n // no need to check status cause math always sets margin bottom to\n // completely hide the bar\n setStatus('hidden');\n var margin;\n \n //stop other slide effect\n if($('#oc_flash-player').is(':animated')) {\n $('#oc_flash-player').stop();\n }\n \n margin = '+='+ (-1 * parseInt($('#oc_flash-player').css('marginBottom'))).toString() +'px';\n \n $('#oc_flash-player').animate({\n marginBottom: margin\n }, {\n duration: _time,\n specialEasing: 'swing'\n });\n doHideAdvLinkSlide();\n \n }", "onFrameHide() {\n this.isFrameShowing = false;\n if (!this.isSelected) {\n this.normalizeDisplayLabels();\n }\n }", "function hideControls() {\n $('.carousel-control').fadeOut(500);\n }", "onFocusOut() {\n this.updateFocused(false);\n }", "function percentSliderStop() {\n\n\t\t$('#tag-percent-input').blur();\n\t}", "function hideCardLimitPopup(){\n $(cardLimitPopup).css({\n \"display\" : \"none\"\n })\n $(\"body\").css({\n \"overflow\" : \"scroll\"\n })\n }", "scrollDown() {\r\n if (this.bar.y + this.bar.displayHeight !== this.track.y + this.track.height && !this.barMoving) {\r\n const testPosition = this.bar.y + (this.vslice * 2);\r\n let moveToY = null;\r\n this.barMoving = true;\r\n this.bar.disableInteractive();\r\n\r\n // Ensure the bar can't move below the track.\r\n if (testPosition >= this.track.y + this.track.height) {\r\n moveToY = this.maxY;\r\n } else {\r\n moveToY = this.bar.y + this.vslice;\r\n }\r\n\r\n this.addScrollTween({ y: moveToY });\r\n }\r\n }", "function gestoreScroll() {\r\n if (document.body.scrollTop > 800 || document.documentElement.scrollTop > 800) {\r\n nodoPulsTop.style.display = \"block\";\r\n } else {\r\n nodoPulsTop.style.display = \"none\";\r\n }\r\n}", "function endScroll($el) {\n if (interval) {\n window.clearInterval(interval);\n interval = undefined;\n }\n }", "function hideVideoControl() {\n videoCtrlTl.to(videocontrol, 1, {opacity: 0});\n }", "function startHidden() {\n $(\"#hider\").hide();\n }", "afterHidden() {}", "function scrollDown() {\r\n window.scrollTo(0, window.innerHeight-16);\r\n }", "function scrollFunction() {\n if (document.body.scrollTop > 1500 || document.documentElement.scrollTop > 1500) {\n scrollbutton.style.display = \"block\";\n } else {\n scrollbutton.style.display = \"none\";\n }\n}", "function scrollFunction() {\n if (\n document.body.scrollTop > 20 ||\n document.documentElement.scrollTop > 20\n ) {\n mybutton.style.display = \"block\";\n } else {\n mybutton.style.display = \"none\";\n }\n }", "endInfiniteScroll() {\n if (!this._hasInfiniteScroll) {\n return;\n }\n this._modalComponent._infiniteScroll.complete();\n this._setItems(this.items);\n }", "_scrollButtonFarClickHandler() {\n const that = this;\n\n if (that.$.scrollButtonFar.disabled) {\n return;\n }\n\n that._scroll(1);\n }", "function hideTheViewMoreButtonIfEndOfRecord(isEnd) {\nif (isEnd == '0') {\n$('#search-page .click-to-view-more').hide();\n} else {\n$('#search-page .click-to-view-more').show();\n}\n}", "hide() {\n if (this.facingCamera || !this.initialized) {\n this.updateVisibility(false);\n }\n }", "function scrollEvt() {\n if (document.getElementById(\"introDiv\").getBoundingClientRect().bottom < 500) {\n checkShowfull();\n }\n\n if (document.getElementById(\"introDiv\").getBoundingClientRect().bottom < 500 && !backToTopShown) {\n fadeIn(document.getElementById(\"backToTopBtn\"));\n backToTopShown = true;\n }\n else if (document.getElementById(\"introDiv\").getBoundingClientRect().bottom > 500 && backToTopShown) {\n fadeOut(document.getElementById(\"backToTopBtn\"));\n backToTopShown = false;\n }\n}", "function scrollFunction(instance, mybutton) {\n if (instance.scroll().ratio.y > 0.11) {\n mybutton.style.display = \"block\";\n } else {\n mybutton.style.display = \"none\";\n }\n}", "function noAutoscroll() {\n _displaymode &= ~LCD_ENTRYSHIFTINCREMENT;\n command(LCD_ENTRYMODESET | _displaymode);\n}", "function hide() {\n if (isLogOpen === false) {\n return;\n }\n\n $modalContainer.html('');\n $modalContainer.scrollTop();\n $modalContainer.hide();\n scrollBar.load();\n\n isLogOpen = false;\n}", "function hideNotificationOnScroll() {\n\t\t\tvar coreFunc = function() {\n\t\t\t\t$mainSliders.each(function() {\n\t\t\t\t\t// Bail if no Title,\n\t\t\t\t\t// the Notification is entirely dependant on the Title Attribute\n\t\t\t\t\tif ( $(this).attr('title') === undefined ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (isCenterOfElementInViewport($(this))) {\n\t\t\t\t\t\tvar $that = $(this);\n\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t$that.removeClass('show-notification');\n\t\t\t\t\t\t\t$(window).off('scroll', coreFunc);\n\t\t\t\t\t\t}, 2000);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tcoreFunc();\n\t\t\t$(window).on('scroll', coreFunc);\n\t\t}" ]
[ "0.6726268", "0.66817725", "0.6649691", "0.6581461", "0.6451372", "0.63648736", "0.63556045", "0.6304638", "0.62715155", "0.6259932", "0.62428844", "0.61829907", "0.61717117", "0.6144814", "0.6123726", "0.6107958", "0.6090189", "0.60758126", "0.606108", "0.60537875", "0.6020973", "0.6006291", "0.60030466", "0.5994046", "0.5983133", "0.5972062", "0.59655786", "0.5963703", "0.5954335", "0.5952715", "0.59460086", "0.59420776", "0.59411514", "0.594115", "0.5916484", "0.59091955", "0.5908789", "0.59077805", "0.5897233", "0.58828396", "0.58828396", "0.588266", "0.5875657", "0.5868032", "0.58354306", "0.5831642", "0.5820155", "0.58118194", "0.5810477", "0.58008677", "0.58006716", "0.5798491", "0.5795817", "0.5780611", "0.5773814", "0.57734704", "0.5770252", "0.5765282", "0.57587534", "0.57576144", "0.5756877", "0.57531905", "0.5749315", "0.5745147", "0.5740582", "0.57368714", "0.57276237", "0.57238543", "0.57168865", "0.5716506", "0.57107997", "0.5710479", "0.5710479", "0.57078266", "0.57078266", "0.57074726", "0.56982297", "0.569405", "0.5689548", "0.5685628", "0.56816727", "0.56726587", "0.5653058", "0.56526136", "0.56522304", "0.5646418", "0.56449205", "0.5642496", "0.5637247", "0.56345063", "0.56324965", "0.56272024", "0.5623429", "0.56208885", "0.5618104", "0.5615074", "0.5614744", "0.5614457", "0.5610973", "0.56060946", "0.5605653" ]
0.0
-1
A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers.
function happyNumber(n) { while(n !== 1) { n = n.toString().split('').map(a => a*a).reduce((x, y) => (x + y))} return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isHappy(n){\n let a = n.toString();\n let sum = 0;\n for (let digit of a) {\n let product = digit * digit;\n sum += product;\n }\n if (sum === 1) {\n return true;\n } else {\n return isHappy(sum);\n }\n}", "function isHappy(n) {\n let set = new Set()\n while(n != 1) {\n let sum = 0\n let current = n\n while(current != 0) {\n const num = current % 10\n sum += (num * num)\n current = Math.floor(current / 10)\n }\n if (set.has(sum)) {\n return false\n }else{\n set.add(sum)\n n = sum\n }\n }\n return true\n}", "function solution_1 (n) {\r\n function sumSquaresOfDigits (n) {\r\n return String(n)\r\n .split('')\r\n .map(digit => +digit)\r\n .reduce((sum, digit) => sum + digit ** 2, 0);\r\n }\r\n const seen = new Set([n]); // this set is here to detect cycles\r\n let processedN = sumSquaresOfDigits(n) // i introduce this variable here to avoid calculating it twice (in the while loop condition and in the subsequent line)\r\n while (processedN !== 1) {\r\n n = processedN;\r\n if (seen.has(n)) return false;\r\n seen.add(n);\r\n processedN = sumSquaresOfDigits(n);\r\n }\r\n return true;\r\n}", "function isHappy(num){\n switch(num){\n case 1:\n return true;\n case 4:\n return false;\n default:\n let reNumStr = num.toString();\n return isHappy(sumSquares(reNumStr));\n }\n}", "function happyNumber(number){\n console.log(number);\n let squaredNumber = (number*number);\n console.log(squaredNumber);\n for(i = 0; i < number.length; i++){\n \n }\n}", "function narcissisticNumbers() {\n var counter = 0;\n\n while (counter <= 25) {\n var sum = [];\n\n // for (var i = 0; i < 10; i++) {\n // if (Math.pow(i, i.toString().length) === i) {\n // sum = i;\n // console.log(sum);\n // }\n // }\n for (var i = 0; i < Infinity; i++) {\n var length = i.toString().length;\n var numberIndex = 0;\n if (Math.pow())\n\n }\n }\n}", "function iteratedSquare(n) {\n while (true) {\n if (n === 1 || n === 89) {\n break;\n }\n n = n\n .toString()\n .split(\"\")\n .reduce((prev, curr) => {\n return +prev + (+curr) ** 2;\n }, 0);\n }\n return n;\n}", "function bai11(n) {\n var tong = 0;\n var tich = 1;\n for (let i = 1; i <= n; i++) {\n tich*=i;\n tong+=tich; \n }\n return tong;\n}", "function increaseNumberRoundness(n) {\n let consecutiveNonZeroes = /^[1-9]+0*$/;\n \n return !consecutiveNonZeroes.test(n);\n}", "function perfectSquare(number){\n for (i = 1; i < number/i+1; i++){\n console.log(i);\n if(i * i === number){\n return true;\n }\n }\n return false;\n}", "function bai6(n) {\n var tong = 0;\n for (let i = 1; i <= n; i++) {\n tong+=1/(i*(i+1));\n }\n return tong;\n}", "function squareDigitsSequence(n) {\n let set = new Set([n])\n let dup = false\n\n function newN(num){\n let sum = 0\n let arr = num.toString().split('').map(x=>x**2)\n for(let number of arr){\n sum+= number\n }\n return sum\n }\n\n while(dup === false){\n n = newN(n)\n if(set.has(n)) dup = true\n set.add(n)\n }\n return set.size + 1\n}", "function solution(number){\n let sum = 0;\n \n for ( i = 1; i < 10; i ++) {\n if (i % 3 === 0 || i % 5 === 0) {\n sum += i;\n };\n };\n return sum;\n }", "function soHoanHao(a){\n let tong = 0;\n for( let i=1 ; i <a ; i++){\n if(a % i == 0){\n tong = tong +i;\n }\n } \n if(tong === a){\n return true;\n }else{\n return false;\n }\n \n}", "function bai7(n) {\n var tong = 0;\n for (let i = 1; i <= n; i++) {\n tong+=(i/(i+1));\n }\n return tong;\n}", "function luhnaAlgorithm(arr){\r\n let notMultipledNumber = 0;\r\n let multipledNumbers = 0;\r\n let pairIndex = 1;\r\n for(let i = arr.length-1; i >= 0; i--){\r\n if( pairIndex%2 !== 0 ) {\r\n notMultipledNumber+=Number(arr[i]);\r\n pairIndex++;\r\n }else{\r\n let el = Number(arr[i]) * 2;\r\n if (el >= 10){\r\n el = (el - 10) + 1;\r\n multipledNumbers +=el;\r\n }else{\r\n multipledNumbers += el;\r\n }\r\n pairIndex++;\r\n }\r\n }\r\n console.log(notMultipledNumber);\r\n console.log(multipledNumbers);\r\n const finalLuhnaValue = notMultipledNumber + multipledNumbers;\r\n return finalLuhnaValue%10 === 0 ? true : false;\r\n }", "function perfectNumber1(upTo) {\n let perfectNum1 = '';\n for (let i = 6; i < upTo; i++) {\n let divisor = 0; \n\n for (let j = 1; j < i; j++) { \n\n if (i % j == 0) {\n divisor += j; \n }\n \n if (j == i - 1 && divisor == i) { \n perfectNum1 += i;\n perfectNum1 += ' ';\n }\n }\n }\n return perfectNum1;\n}", "function featured(number) {\n while (true) {\n number += 1;\n\n if (number % 7 === 0 && number % 2 !== 0 && digitsAreUnique(number)) {\n return number;\n }\n }\n}", "function squareRoot( number ) {\n\tvar x = 1,\n\t\ty = 1,\n\t\tcount = 0;\n\n\tfor (var i=0; i < number; ++i) {\n\t\t// This finds the answer\n\t\tx = 0.5*(x+(number/x))\n\n\t\t// If the answer is the same as the last time, increment a counter\n\t\tif (y == x)\n\t\t\tcount++;\n\t\t// If the answer is different, restart the counter\n\t\telse {\n\t\t\tcount=0;\n\t\t\ty = x;\n\t\t}\n\t\t// If we get the same answer 6 times in a row, break out of the rest of this loop\n\t\tif (count == 6)\n\t\t\tbreak;\n\t}\n\treturn x;\n}", "function isLucky(n) {\n const numberToString = n.toString();\n let firstHalf = 0;\n let secondHalf = 0;\n\n for (let i = 0; i < numberToString.length; i++) {\n const length = numberToString.length;\n const number = parseInt(numberToString[i]);\n if (i <= (length / 2) - 1) {\n firstHalf += number;\n } else {\n secondHalf += number;\n }\n }\n\n return firstHalf === secondHalf;\n\n}", "function randomOne () {\n var randomNumber\n var sumDigitsRandomNumber\n\n function generateRandomNumber () { // eslint-disable-line no-unused-vars\n return (Math.floor(Math.random() * (9999 - 1000 + 1) + 1000) + '')\n }\n\n function sumOfDigits (number) {\n var listOfDigits = (number + '').split('')\n var totalDigits = listOfDigits.length\n var totalSumOfDigits = 0\n\n for (var i = 0; i < totalDigits; i++) {\n totalSumOfDigits += parseInt(listOfDigits[i], 10)\n }\n\n return totalSumOfDigits\n }\n\n function checkMoreOneDigit (number) {\n return ((number + '').split('').length) > 1\n }\n\n // Logic body -----\n\n randomNumber = generateRandomNumber()\n\n do {\n randomNumber = sumOfDigits(randomNumber) // 11\n } while (checkMoreOneDigit(randomNumber))\n\n return randomNumber\n}", "function generateOneNumber() {\n const getRandomInt = (max) => {\n return Math.floor(Math.random() * Math.ceil(max));\n };\n while (true) {\n var output = getRandomInt(5);\n if (output % 2 === 0 && output !== 0){\n break;\n }\n }\n return output;\n }", "function hailstoneSequence(n) {\n let c = 0\n while(n>1){\n n % 2 === 0? n /= 2: n = 3 * n + 1\n c++\n }\n return c\n}", "function solution(number) {\n var sum = 0;\n for (var i = 1; i < number; i++) {\n if (!(i % 3) || !(i % 5)) {\n sum += i;\n }\n }\n return sum;\n}", "function solution(number) {\n if (number < 0) return 0;\n let multiples = [];\n for (let num = 0; num < number; num++) {\n if (num % 5 === 0 || num % 3 === 0) {\n if (!multiples.includes(num)) {\n multiples.push(num);\n }\n }\n }\n return multiples.reduce((sum, num) => (sum += num));\n}", "function sum(n) {\n let count = 1;\n let temp = n;\n while (Math.floor(temp / 10) !== 0) {\n count++;\n temp = temp / 10; \n }\n n = n + (n * Math.pow(10, count) + n) +(n * Math.pow(10, count * 2) + (n * Math.pow(10, count) + n));\n console.log(n); \n}", "function solution(number){\n let i = number - 1\n let multiples = []\n while (i > 0) {\n if (i % 3 == 0 || i % 5 == 0) {\n multiples.push(i)\n }\n i--\n }\n let result = 0\n multiples.forEach(element => result = element + result)\n return result\n }", "function squarePlusOne(n){\n var f = (n * n) + 1;\n return f;\n}", "function bai12(x,n) {\n var tong = 0;\n var tich = 1;\n for (let i = 1; i <= Math.abs(n); i++) {\n tich*=x;\n tong+=tich;\n }\n return tong;\n}", "function squareSum(numbers){\n var hasil = 0 // 17\n hasil += numbers[0] * numbers[0]\n hasil += numbers[1] * numbers[1]\n hasil += numbers[2] * numbers[2]\n return hasil\n}", "function sumOdd(n) {\n // let firstDigit= (n*n)-(n-1);\n // let result = 0, count = 0;\n\n // while (count<n) {\n // if (firstDigit%2 !== 0) {\n // result+=firstDigit;\n // count++;\n // }\n // firstDigit++;\n // }\n // return result;\n\n return Math.pow(n,3);\n}", "function testThisNumber(){\n superNumber.forEach(function(element){\n resultNum = testNum / element;\n switch (Number.isInteger(resultNum)){\n case false:\n testNum++;\n testThisNumber();\n break;\n\n default:\n break;\n };\n })\n}", "function solutionFive(){\n //Modulus is expensive so try to cut down on its use.\n //The last digit must be a 0\n //Sum of digits must be divisible by 9. Difficult to reverse engineer so will have to check each number.\n //Will just be easier to see if divisible my 9.\n //Second digit must be a 2 4 6 or 8\n //The last three digits must be divisible by 8\n //Difference of sums of alternating digits must equal 11\n //Start with 360 and always add 360 to always be in line with first 10 rules (except 7)\n let baseNum = (()=>{\n let b = 20;//Start at 20, covers 10, 5, 2\n while(b%18!=0 || b%16!=0 || b%15!=0 || b%14!=0){//18 will cover 9, 6, 4, 3, 16 will cover 8, 14 will cover 7\n b+=20;\n }\n return b;\n })();\n baseNum/=10;//Remove the zero from the end\n //(Rules for primes deal with subtracting the last digit from the rest of the number to see if the differnce is divisible by the prime)\n //(Since we know the last digit must be zero then the subtraction plays no role so we can check the primes against the truncated number)\n let num = baseNum;\n while(num%11!=0 || num%13!=0 || num%17!=0 || num%19!=0){//Then do the primes\n num+=baseNum;//Always add baseNum to stay lined up with all non-prime numbers (and 7)\n }\n num*=10;//Add the zero back to the end. This cuts our time in about half\n return num;\n\n}", "function sunOfDigits() {\n var a = 998;\n var sum = 0;\n while (a > 0) {\n sum += a % 10;\n a = Math.floor(a / 10);\n }\n console.log(sum);\n}", "function bai9(n) {\n var tich = 1;\n for (let i = 1; i <= n; i++) {\n tich*=i;\n }\n return tich;\n}", "function matchstickHouses(num) {\n if (num === 0 ) return 0;\n \n let total = 6;\n for (let i = 2; i <= num; i++) {\n total += 5\n }\n\n return total\n}", "function squareNum(number) {\n\tconsole.log('Squaring will be done!');\n\treturn Math.pow(number, 2);\n}", "function addRepeat(num1, num2) {\n let isTrue = false\n let sum = 0\n\n for (let i = 0; i < (num2 / num1); i++) {\n sum += num1\n if (sum === num2) {\n isTrue = !isTrue\n }\n }\n return isTrue\n\n}", "function solution(N) {\n \n let random = Math.floor(Math.random() * 100) + N;\n while(random%10 != 0) {\n random ++;\n }\n if (random>1000000000) {\n return 0;\n }\n return random;\n}", "function solution(number){\n var sum = 0;\n for(i = 0; i < number; i++){\n if(i % 3 === 0 || i % 5 === 0){\n sum = sum + i;\n }\n }\n return sum\n}", "function generateWinningNumber(){\n return 1 + Math.floor(100*Math.random());\n}", "function halvingSum(n) {\n let sum = 0;\n while (n >= 1 ){\n sum += n;\n n = Math.floor(n/2);\n }\n return sum\n}", "function bai13(x,n) {\n var tong = 0;\n var tich = 1;\n for (let i = 1; i <= Math.abs(n); i++) {\n tich*=x*x;\n tong+=tich;\n }\n return tong;\n}", "function problem5(){\n var sN = 0;\n c=false;\n while(c===false){\n sN+=380;\n for(var x=3; x<=18;x++){\n if(sN%x!==0){\n break;\n }\n if(sN%x==0 && x===18){\n c=true;\n return sN;\n }\n }\n }\n}", "function solution(number) {\n let multiples = [];\n for (let i = 1; i < number; ++i) {\n if (i % 3 === 0 || i % 5 === 0) {\n multiples.push(i);\n }\n }\n return multiples.reduce((a, b) => a + b, 0);\n}", "function solution(number){\n\tconst numbers = [];\n\tconst sum;\n\t\n \tnumbers += number % 3 || 5;\n \t//take out duplicates\n\n \treturn sum = numbers.reduce( (accumulator, currentValue) => accumulator + currentValue );\n}", "function solution(number){\n let sum = 0;\n if (number < 0) {\n return 0;\n }\n for (i = 0; i < number; i++) {\n if (i % 3 === 0 || i % 5 === 0) {\n sum += i \n }\n }\n return sum;\n}", "function sumSquareFirst(){ \n let result = 0;\n for (let index = 1; index <= 10; index++) {\n result += index;\n }\n return result*result;\n}", "function isSquare(number) {\n for(var i = 0; i < number; i++) {\n if( number / i === i) { //alt i * i === number. Return true;\n return true;\n }\n }\n return false; //return false after loop.\n //if inside loop, may return false WAY too early. Checking 2 * 2,\n //if its not case return false BEFORE we come upon 4 * 4 forr 16.\n\n //check ALL possible i's in loop.\n //THEN if we havent found it, return false.\n}", "function isSimple(n) {\n // for (let d = 2; d < n; d++) {\n // if (n % d === 0) {\n // return false;\n // }\n // }\n\n // return true;\n let d = 2;\n\n while (d < n) {\n if (n % d === 0) {\n return false;\n }\n\n d++;\n }\n\n return true;\n}", "function myVeryOwnSquareRoot1(num){\n\tvar guess=0;\n\twhile(guess*guess<num){\n\t\tguess++;\n\t}\n\treturn guess;\n}", "function doble(n) {\n return n*2;\n}", "function findPerfectSquare(startingNumber) { \n let numberBuilder = [];\n findPermutations(startingNumber.toString());\n\n console.log(`prefect squares: ${prefectSquares}`);\n //console.log('The largest perfect square using all the digits from 1 to 9 exactly once is: ' + largestSquare);\n console.log(`The findPermutations function was called ${howManyTimesIsFindPermutationsCalled} times`);\n}", "function solution(n){\n let temp = Math.floor((n - Math.floor(n)) * 100);\n \n if(temp < 10){\n temp *= 10;\n };\n \n if(temp >= 25 && temp <= 74){\n return Math.floor(n) + 0.5;\n };\n \n if(temp >= 75 && temp <= 99){\n return Math.floor(n) + 1;\n };\n \n return Math.floor(n);\n}", "function oneToAHundred() {\n var number = 0;\n while (number < 100) {\n number++;\n console.log(number);\n }\n}", "function solution(number) {\n const result = new Set();\n let i = 1;\n let te, fe;\n while (i) {\n if (!te && 3 * i < number) {\n result.add(3 * i);\n } else {\n te = true;\n }\n if (!fe && 5 * i < number) {\n result.add(5 * i);\n } else {\n fe = true;\n }\n if (te && fe) {\n break;\n }\n i++\n };\n return Array.from(result).reduce((prev, next) => prev + next, 0);\n}", "function featured(number) {\n let counter = number + 1;\n \n while (true) {\n if ((counter % 7 === 0) && (counter % 2 !== 0) && (digitsNotSame(counter))) {\n return counter;\n } else if (counter >= 9876543201) {\n return 'No number meets the requirements.';\n } else counter += 1;\n }\n}", "function squareDigits(num){\n //input: number\n //output: altered number\n //algo\n // [x] look at the num\n // [x] change num to string\n // [x] individualize each num(string)\n // [x] convert string to num\n // [x] multiply each number by itself\n // [x] put numbers back together\n // [] return the altered number\n const digits = num.toString().split('')\n const numString = digits.map(num => num * num).join('')\n return Number(numString);\n }", "function squareDigits(num){\n let numberString = Array.from(num.toString())\n for(i = 0; i < numberString.length; i++){\n numberString.splice(i, 1, Math.pow(parseInt(numberString[i]), 2))\n console.log(numberString)\n }\n return parseInt(numberString.join(''))\n }", "function squareDigits(num){\n //may the code be with you\n \n var newnum=num.toString()\n \n var square = \"\"\n for (i=0;i<newnum.length;i++){\n square += newnum[i] ** 2\n \n }\n return parseInt(square)\n \n }", "function squareofNumber(square) {\n return square*square;\n }", "function halvingSum(n) {\n \n let sum = 0;\n\n while (n>0) {\n sum += n;\n n = Math.floor(n/2);\n }\n return sum;\n }", "function squareEveryDigit(number) {\n\n return Number( \n number.toString() \n .split('') \n .map(number => number * number) \n .join('') \n );\n }", "function findDigit(a, b) {\n while (Math.floor(b / 10) !== 0) {\n if (b % 10 === a) {\n console.log(\"Yes\");\n return;\n } \n b = Math.floor(b / 10);\n }\n if (b === a) {\n console.log(\"Yes\"); \n } else console.log(\"No\");\n}", "function problem7(){\n c=1;\n x=3;\n while( c < 10001 ){\n if(fasterPrime(x)){\n c++;\n }\n x+=2;\n }\n return x-2;\n}", "function helper(n) {\n let curSum = 0;\n\n while (n !== 0) {\n curSum += (n % 10) * (n % 10);\n n = Math.floor(n / 10);\n }\n\n return curSum;\n}", "function isPerfectNumber(number){\n var sum = 0;\n for(var i = 1; i < number; i++){\n if(number % i == 0){\n sum += i;\n }\n } \n if(sum == number){\n console.log(number + ' is perfect number!');\n }else{\n console.log(number + ' is not perfect number!');\n }\n console.log(sum);\n}", "function isPerfectSquare(input) {\n // Square numbers are non-negative\n if (input < 0) return false;\n\n let count = 0;\n while (true) {\n const squared = count * count;\n if (input === squared) {\n return true;\n } else if (input < squared) {\n return false;\n }\n count++;\n }\n}", "function thirt(n) {\n const pattern = [1, 10, 9, 12, 3, 4];\n const reversed = String(n).split('').reverse();\n let sum = 0;\n let j = 0;\n for (let i = 0; i <= reversed.length - 1; i += 1) {\n if (pattern[j]) {\n sum += parseInt(reversed[i]) * pattern[j];\n } else {\n j = 0;\n sum += parseInt(reversed[i]) * pattern[j];\n }\n j += 1;\n }\n return sum === n\n ? sum\n : thirt(sum);\n}", "function perfectNumbers (numberInput) {\n var divisors = []\n for (var i = 1; i <= numberInput; i++) if (numberInput % i === 0) divisors.push(i)\n if (divisors.reduce(function (acc, element) {\n return acc + element\n }, 0) === numberInput * 2) return true\n return false\n}", "function solution (num) {\n if (num > 999) {\n var thousand = Math.floor((num / 1000));\n }\n\n let hundredsPlace = num % 1000;\n if (hundredsPlace >= 900) {\n var ninehundred = Math.floor(hundredsPlace / 900);\n } else if (hundredsPlace < 900 && hundredsPlace > 500) {\n var fiveshun = Math.floor(hundredsPlace / 500);\n var hundreds = Math.floor((num % 500) / 100);\n } else if (hundredsPlace == 500) {\n var fiveshun = Math.floor(hundredsPlace / 500);\n } else if (hundredsPlace >= 400 && hundredsPlace < 500) {\n var fourhundred = Math.floor(hundredsPlace / 400);\n } else if (hundredsPlace < 400) {\n var hundreds = Math.floor((num % 500) / 100);\n }\n\n let tensPlace = num % 100;\n if (tensPlace >= 90) {\n var ninty = Math.floor(tensPlace / 90);\n } else if (tensPlace < 90 && tensPlace > 50) {\n var fifty = Math.floor(tensPlace / 50);\n var tens = Math.floor((num % 50) / 10);\n } else if (tensPlace == 50) {\n var fifty = Math.floor(tensPlace / 50);\n } else if (tensPlace < 50 && tensPlace >= 40) {\n var forty = Math.floor(tensPlace / 40);\n } else if (tensPlace < 40) {\n var tens = Math.floor((num % 50) / 10);\n }\n\n let singlesPlace = num % 10\n if (singlesPlace == 9) {\n var nine = Math.floor(singlesPlace / 9);\n } else if (singlesPlace < 9 && singlesPlace > 5) {\n var five = Math.floor(singlesPlace / 5);\n var ones = (num % 5) / 1;\n } else if (singlesPlace == 5) {\n var five = Math.floor(singlesPlace / 5);\n } else if (singlesPlace >= 4 && singlesPlace < 5) {\n var four = Math.floor((num % 5) / 4);\n } else if (singlesPlace < 4) {\n var ones = (num % 5) / 1;\n }\n\n let obj = {\n M: thousand,\n CM: ninehundred,\n D: fiveshun,\n CD: fourhundred,\n C: hundreds,\n XC: ninty,\n L: fifty,\n XL: forty,\n X: tens,\n IX: nine,\n V: five,\n IV: four,\n I: ones\n };\n return answer(obj)\n}", "function squareDigits(num) {\n\t//may the code be with you\n\tlet newArray = [];\n\tlet finalNumber;\n\tnum = [...num.toString()];\n\tnum.forEach((number) => {\n\t\tlet total = number ** 2;\n\t\tnewArray.push(total);\n\t});\n\n\tfinalNumber = parseInt(newArray.join(\"\"));\n\tconsole.log(finalNumber);\n}", "function sum(a) {\n if (a % 10 === 0) {\n console.log(a);\n } else {\n let count = 1;\n let num = a % 10;\n let rest = Math.floor(a / 10); \n while (Math.floor(a / 10) !== 0 ) {\n a = Math.floor(a / 10);\n count = count * 10;\n } console.log((num * count) + rest);\n }\n}", "function isLucky(n) {\n const nString = n.toString();\n let firstHalfSum = 0;\n let secondHalfSum = 0;\n debugger;\n for (let i = 0; i < nString.length / 2; i++) {\n firstHalfSum += parseInt(nString[i])\n }\n for (let i = nString.length / 2; i < nString.length; i++) {\n secondHalfSum += parseInt(nString[i])\n }\n console.log(firstHalfSum, secondHalfSum)\n if (firstHalfSum === secondHalfSum) {\n return true\n } else {\n return false\n }\n}", "function cannonball(n) {\n if( n === 1){\n return 1;\n }else{\n return n * n + cannonball(n - 1);\n }\n}", "function solutionSeven(){\n var f = bigInt(factorial(1000));\n return bigInt(f).plus(1);\n}", "function simpleEvenAdding(num){\n\tvar answer=0;\n\tfor (var s=0; s<=num; s++){\n\t\tif (s % 2 === 0) {\n\t\t\tanswer+=s;\t\n\t\t}\n\t}\n\tconsole.log(answer);\n}", "function persistence(n){\r\n let total = 1;\r\n let count = 0;\r\n let temp;\r\n let numToStr = n.toString().split(\"\");\r\n \r\n if(n <= 24 && n >= 10 || n <= 33 && n >= 30) {\r\n count++; \r\n return count;\r\n }\r\n \r\n if(n < 10){\r\n \treturn count; \r\n }\r\n\r\n function callLoop(numStr){\r\n for(let int of numStr){\r\n if(Number(int) === 0){\r\n \tcount++;\r\n return count;\r\n } else {\r\n \ttotal *= Number(int); \r\n }\r\n }\r\n \r\n if(total >= 10){\r\n count++;\r\n temp = total.toString().split(\"\");\r\n total = 1;\r\n return callLoop(temp);\r\n } else {\r\n count++;\r\n return count;\r\n }\r\n } \r\n \r\n\treturn callLoop(numToStr);\r\n}", "function bai5(n) {\n var tong = 0;\n for (let i = 0; i <= n; i++) {\n tong+=(1/((2*i)+1));\n }\n return tong;\n}", "function nextPrime(input){\n let counter\n input++; \n while(true){\n counter = 0;\n for (let i = 2; i <= Math.sqrt(input); i++) {\n if(input % i == 0) counter++\n }\n if(counter == 0 && input > 1) {\n return input \n } else {\n input++\n continue\n }\n }\n}", "function iterarativeFactorial(number) {\n if (number === 0) {\n return 0;\n }\n if (number === 1) {\n return 1;\n } else if (number > 1) {\n\n let factorial = 1;\n\n while (number > 0) {\n factorial *= number;\n number--\n }\n return factorial;\n }\n}", "function factorialIterative(number){\n let fact = 1;\n for (let i = 1; i <= number; i++){\n fact *= i;\n }\n return fact;\n }", "function whatsNext(arr) {\n var BigNumber = require('bignumber.js');\n arr = arr.map(v => new BigNumber(v));\n var len = arr.length;\n if (len % 2 == 0) {\n var zero = arr.pop(),\n ones = arr.pop() || new BigNumber(0),\n zero2 = arr.pop() || new BigNumber(0);\n arr.push(zero2.minus(1), new BigNumber(1), zero.plus(1), ones.minus(1));\n } else {\n var ones = arr.pop(),\n zero = arr.pop() || new BigNumber(0);\n arr.push(zero.minus(1), new BigNumber(1), new BigNumber(1), ones.minus(1));\n }\n if (arr[0] < 1) arr.shift();\n if (arr[arr.length - 1] < 1) arr.pop();\n \n for (var i = 1; i < arr.length; )\n if (arr[i].toString() == \"0\")\n arr.splice(i - 1, 3, arr[i - 1].plus(arr[i + 1]));\n else\n i++;\n\n console.log(arr.length);\n console.log(arr.map(n => n.toString()).join` `);\n}", "function findTwice(number){\n\treturn number * number;\n}", "function checkYuGiOh(n) {\r\n let numbers = [];\r\n\r\n for(let i=1; i<=n ; i++) {\r\n numbers.push(i)\r\n }\r\n\r\n if(typeof n === \"string\" && n.indexOf(\" \") >= 0) {\r\n console.log(`invalid parameter: \"${n}\"`);\r\n } else {\r\n for(let i=0; i<numbers.length; i++) {\r\n if(numbers[i] % 2 === 0 && numbers[i] % 3 === 0 && numbers[i] % 5 ===0 ) {\r\n numbers[i] = \"yu-gi-oh\";\r\n } else if(numbers[i] % 2 === 0 && numbers[i] % 3 === 0) {\r\n numbers[i] = \"yu-gi\";\r\n } else if(numbers[i] % 2 === 0 && numbers[i] % 5 === 0) {\r\n numbers[i] = \"yu-oh\";\r\n } else if(numbers[i] % 2 === 0) {\r\n numbers[i] = \"yu\";\r\n } else if(numbers[i] % 3 === 0) {\r\n numbers[i] = \"gi\";\r\n } else if(numbers[i] % 5 === 0) {\r\n numbers[i] = \"oh\";\r\n }\r\n }\r\n console.log(numbers);\r\n }\r\n}", "function isLucky(n) {\n let N = n.toString().split(\"\");\n let sumFirst = 0;\n let sumSecond = 0;\n for(let i =0,j=N.length/2; i < N.length/2;i++) {\n sumFirst += parseInt(N[i]);\n sumSecond += parseInt(N[j]); \n j++\n }\n return (sumFirst == sumSecond);\n}", "function findNextSquare(n) {\n return Number.isInteger(Math.sqrt(n)) ? Math.pow(Math.sqrt(n) + 1, 2) : -1;\n}", "function solution(number){\n var num =[];\n for(var i=1; i<number; i++){\n if(i%3 === 0 || i%5 ===0){num.push(i);}\n }\n var result = num.reduce(function(sum, current) {\n return sum + current;\n }, 0);\n return result;\n}", "function narcissistic(value) {\n let sum = 0;\n // console.log(value);\n // console.log(value.toString())\n // console.log(value.toString().split(''));\n\n let valueArray = Array.from(value.toString()).map(Number)\n console.log(valueArray);\n valueArray.forEach((val) => {\n sum += (val ** (valueArray.length))\n })\n console.log(value, sum);\n if (value === sum){\n return true\n } else {\n return false\n }\n }", "function findFactorialIterative(number) {\n let answer = 1\n if (number === 2) {\n answer = 2\n }\n for (let i = 2; i <= number; i++) {\n answer = answer * i\n }\n return answer\n}", "function isSimple(n) {\r\n if (n === 2) {\r\n //console.log('2 is simple number');\r\n return true;\r\n }\r\n var r = Math.round(Math.sqrt(n));\r\n var dividers = [];\r\n for (var i = 1; i <= r; i++) {\r\n if (n % i === 0) {\r\n dividers.push(i);\r\n }\r\n }\r\n //console.log(dividers);\r\n return dividers.length === 1 && dividers[0] === 1;\r\n}", "function problem10(){\n let c=2;\n let x=3;\n while( x < 2000000 ){\n if(fasterPrime(x) === true){\n c+=x;\n }\n x+=2;\n }\n return c;\n}", "function factorial(number) { // Recibe un valor entero positivo\n if (number < 0) // Si es valor es un numero negativo entonces devuelve un -1 para hacer saber al usuario que se ingreso un valor invalido\n return -1; // retorno de valor invalido \n else if (number == 0) // Si el valor es 0, por definicion se devuelve un 1 por que 0! es 1, pero tambien sirve para la recursividad dentro de factorial\n return 1; // Devuelve el valor de 1 si es que el numero original es de 0 o si es la ultima iteracion de la funcion recursiva \n else { // Si el numero es un valor mayor a 1 se entra en la recursividad de la funcion \n return (number * factorial(number - 1)); // La recursividad funciona diciendo que el numero se multiplicara por la funcion - 1, y hasta que el numero dentro de la funcion no se vuelva 0 entonces se restara uno del valor del numero y se volver a multiplicar\n // Si el valor fuese 5, seria 5 * 5 - 1 * 5 - 1 - 1,5-1-1-1 * 5-1-1-1-1 * 0, claro que si se multiplica por 0 entonces el valor final seria 0, pero dentro del if si el valor es 0 hay un return de 1. \n // Pero el valor no sera de 1, dado que este return esta dentro de la primera iteracion de la recursividad, entonces el valor seria 5*4*3*2*1*1 = 120\n }\n}", "function fact(number) {\n let res = 1;\n for (let i = 1; i <= number; i++) {\n res *= i;\n }\n return res;\n }", "function solution1(num) {\n\n\t// req 3\n\tif (num <= 0) {\n\t\treturn 0;\n\t}\n\n\tlet arr = [];\n\n\tfor (let i = 1; i < num; i++) {\n\n\t\tarr.push(i);\n\t}\n\n\t// req 1 & 4\n\tlet multiples = arr.filter(x => x % 3 === 0 || x % 5 === 0);\n\n\tlet sum = 0;\n\tfor (let i = 0; i < multiples.length; i++) {\n\n\t\tsum += multiples[i];\n\t}\n\n\treturn sum;\n}", "function subtracktOddNumber(num) {\n var sum = 0;\n var sum1 = 0;\n for (var i = 1; i <= num; i++) {\n if (i % 2 === 0) {\n sum += i;\n } else if (i % 2 !== 2 && i <= num / 2) {\n sum1 += i;\n }\n\n }\n\n return (sum - sum1) * 12.5;\n}", "function messyMath(num) {\n\tvar sum = 0;\n\tfor(var count = 0; count <= num; count++) {\n\t\t// console.log(\"sum: \" + sum + \" %3: \" + count % 3 + \" %7: \" + count % 7);\n\t\tif(count * 3 === num) {\n\t\t\treturn -1;\n\t\t} else if(count % 3 === 0) {\n\t\t\tcontinue;\n\t\t} else if(count % 7 === 0) {\n\t\t\tsum += count * 2;\n\t\t} else {\n\t\t\tsum += count;\n\t\t}\n\t}\n\treturn sum;\n}", "function checkPerfectNumber(number) {\n\t\tlet temp = 0;\n\t\tfor (let i = 1; i <= number / 2; i++) {\n\t\t\tif (number % i === 0) {\n\t\t\t\ttemp += i;\n\t\t\t}\n\t\t}\n\n\t\tif (temp === number && temp !== 0) {\n\t\t\treturn true//'It is a perfect number.';\n\t\t}\n\t\telse {\n\t\t\treturn false //'It is not a perfect number.';\n\t\t}\n\t}", "function factorialIterative(number){\n let fact = 1;\n for (let i = 1; i <= number; i++){\n fact *= i;\n }\n return fact;\n}", "function getNextNumber(number) {\r\n\r\n if (number %2 === 0) { return number / 2; }\r\n else { if (fullMode === true) { return (number * 3 + 1) } else { return (number * 3 + 1) / 2; } }\r\n\r\n}" ]
[ "0.75011486", "0.7327769", "0.6792056", "0.660205", "0.641511", "0.6352151", "0.627131", "0.62252057", "0.61079353", "0.604535", "0.6023613", "0.59819746", "0.5981953", "0.5979863", "0.597401", "0.59496266", "0.59410703", "0.588869", "0.58883226", "0.588421", "0.5867044", "0.5864925", "0.5860962", "0.585574", "0.584875", "0.5847071", "0.5841119", "0.581433", "0.5813142", "0.57905585", "0.5785217", "0.5783544", "0.5780891", "0.57737494", "0.57736933", "0.57718647", "0.57685345", "0.5737697", "0.57353306", "0.57274556", "0.57243484", "0.5721922", "0.57149166", "0.5713878", "0.5713824", "0.5706473", "0.5701529", "0.5699247", "0.569183", "0.56876045", "0.5686962", "0.5686023", "0.5680162", "0.5669769", "0.5668734", "0.56637555", "0.5656434", "0.56512314", "0.5644671", "0.56398076", "0.56371254", "0.5631286", "0.56279707", "0.56260455", "0.5618754", "0.56156117", "0.55988413", "0.5591152", "0.5589058", "0.55886894", "0.55864346", "0.5585717", "0.5582287", "0.558146", "0.5581087", "0.5580699", "0.5577898", "0.5576442", "0.5566561", "0.55504817", "0.55498177", "0.5537416", "0.5531243", "0.55283004", "0.55248976", "0.5523762", "0.55211973", "0.55207783", "0.5520437", "0.55160815", "0.551152", "0.55062866", "0.5504017", "0.55020785", "0.5501469", "0.550032", "0.5497603", "0.5497382", "0.5496023", "0.54919344" ]
0.8048565
0
salva um registro no IndexedDb
function addDataIndexedDb(dataJson){ var date = dataJson.date; var description = dataJson.description; var value = dataJson.value; var transaction = db.transaction([constDbObject],"readwrite"); transaction.oncomplete = function(event) { console.log("Sucesso :)"); }; transaction.onerror = function(event) { console.log("Erro :("); }; var objectStore = transaction.objectStore(constDbObject); objectStore.add({date:date, description:description, value:value}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveSauvegarde(id,nbCoupe,aireAtteinte,temps,score) {\n // création d'un objet contenant les données\n // il sert d'\"enregistrement\" dans la base\n var sauvegarde = {\n\t\tid:id,\n nbCoupe: nbCoupe,\n aireMinimaleAtteinte: aireAtteinte,\n\t\ttemps:temps,\n\t\tscore:score\n }\n\n // on ouvre la base, et on déclare les listeners\n var request = indexedDB.open(\"spacelash2\", 1);\n request.onerror = errorOpen;\n request.onupgradeneeded = createDatabase;\n\n request.onsuccess = function(event) {\n // ici la base a été ouverte avec succés, il faut ajouter l'enregistrement\n\n // on récupère l'objet database\n var db = event.target.result; \n\n // on ouvre une transaction qui permettra d'effectuer\n // les opérations sur la base\n var transaction = db.transaction([\"sauvegarde\"], \"readwrite\");\n transaction.oncomplete = function(event) {\n \n \n };\n\n transaction.onerror = function(event) {\n window.alert('erreur de transaction ');\n };\n\n // on récupère l'object store dans lequel on veut stocker l'objet\n var sauvegardeStore = transaction.objectStore(\"sauvegarde\");\n\n // on créé l'ordre d'ajouter un enregistrement\n // sera effectivement executé lors de la fermeture de la transaction\n var req = sauvegardeStore.put(sauvegarde);\n req.onsuccess = function(event) {\n \n }\n req.onerror = function(event) {\n window.alert('erreur ajout');\n }\n }\n}", "function ormarmesto() {\n document.getElementById(\"ourormar\").innerHTML = \"\" ; \n var request = window.indexedDB.open(dbName);\n request.onsuccess = function(event) {\n // Enumerate the entire object store.\n var db = klDB.indexedDB.db;\n var trans = db.transaction(\"nalogstore\", \"readonly\");\n var request = trans.objectStore(\"nalogstore\").openCursor();\n var a = document.createElement(\"a\");\n request.onsuccess = function(event) {\n var cursor = request.result || event.result;\n // If cursor is null then we've completed the enumeration.\n if (!cursor) {\n document.getElementById(\"ourormar\").appendChild(a);\n return;\n }\n\t\t\ta.textContent = cursor.value.interkey;\n\t\t\t a.addEventListener(\"click\", function() {\n klDB.indexedDB.izmeni(cursor.value.interkey);\n }, true);\n // some fun with jquery mobile data attributes\n a.setAttribute(\"href\", \"izmeni.html#outtabela\");\n a.setAttribute(\"data-iconpos\", \"notext\");\n a.setAttribute(\"data-role\", \"button\");\n a.setAttribute(\"data-icon\", \"save\"); \n a.setAttribute(\"data-inline\", \"true\");\n cursor.continue();\n }\n } \n }", "function addStudentInDatabase() {\n const roll = document.getElementById(\"add_roll\").value;\n const name = document.getElementById(\"add_name\").value;\n const department = document.getElementById(\"add_department\").value;\n const year = document.getElementById(\"add_year\").value;\n const semester = document.getElementById(\"add_semester\").value;\n\n const addStudentInfo = {\n Roll: roll,\n Name: name,\n Department: department,\n Year: year,\n Semester: semester\n };\n\n const tx = db.transaction(\"StudentTable\", \"readwrite\");\n const studentInfo = tx.objectStore(\"StudentTable\");\n studentInfo.add(addStudentInfo);\n}", "constructor(param){ \n // homologamos variable principal de indexedDB\n // window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;\n // window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction;\n // window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange;\n\n this.db=param.db;\n\n if (!window.indexedDB) {\n console.log(\"Su navegador no soporta una versión estable de indexedDB. Tal y como las características no serán validas\");\n }else{\n this.request = indexedDB.open(param.db, 1, 'base de '+param.db, 2*1024 * 1024);\n\n this.request.onsuccess = (e)=>{\n this.link = this.request.result;\n japp.link = this.request.result;\n }\n\n this.request.onupgradeneeded = ()=>{\n this.link = this.request.result;\n const producto = this.link.createObjectStore('producto', {keyPath: 'codigo'});\n const venta = this.link.createObjectStore('venta', {keyPath: 'tiempo'});\n const categoria = this.link.createObjectStore('categoria', {keyPath: 'nombre'});\n const mesa = this.link.createObjectStore('mesa', {keyPath: 'mesa'});\n const histo = this.link.createObjectStore('histo', {keyPath: 'tiempo'});\n const config = this.link.createObjectStore('config', {keyPath: 'param'});\n this.link.createObjectStore('recetas', {keyPath: 'nombre'});\n\n const AC = this.link.createObjectStore('AC', {keyPath: 'codigo'});\n\n producto.onerror=(e)=>{\n console.log(e);\n }\n\n producto.onsuccess=(e)=>{\n console.log(e);\n \n }\n }\n\n this.request.onerror = (e)=>{\n console.log (\"No fue posible crear el acceso a la base de datos\");\n //console.log ( e.target.errorCode );\n };\n\n }\n\n }", "async save(objeto) {\n \n\n const contenido = await this.read();\n\n let id = contenido.length + 1;\n\n let item = {\n id: objeto.id,\n timestamp: objeto.timestamp,\n id_producto: objeto.producto.id,\n }; \n try {\n await knex(\"carrito\").insert(item);\n return item;\n } catch (error) {\n throw error;\n } \n \n }", "function adicionaLivro() {\n var eLivro = { id: \"\", titulo: \"\", autor: \"\"};\n eLivro.id = $('#id').val();\n eLivro.titulo = $('#titulo').val();\n eLivro.autor = $('#autor').val();\n\n if (eLivro.id && eLivro.titulo && eLivro.autor) {\n var objectStore = dbLivros.transaction([\"eLivros\"], \"readwrite\").objectStore('eLivros');\n var request = objectStore.add(eLivro);\n request.onerror = function (event) {\n // nao adicionou\n msgErro(\"Não foi possivel adicionar esse livro....\");\n };\n request.onsuccess = function (event) {\n // adicionou: limpa linha de edição\n acrescentaLivroTabela(eLivro);\n $('#id').val('');\n $('#titulo').val('');\n $('#autor').val('');\n msgDebug(\"Livro adicionado! \");\n };\n } else {\n msgErro(\"Dados do livro incompletos: preencha todos os campos...\");\n }\n}", "function simpanData(id, nama, stok, harga, deskripsi) {\n let tx = undefined;\n if (id == 0) {\n dbprom.then((db) => {\n tx = db.transaction('produk', 'readwrite'); //buka transaksi\n let dbstore = tx.objectStore('produk'); //pilih store ==>table\n return dbstore.add({ //tambahkan data dengan fungsi add\n nama: nama,\n stok: stok,\n harga: harga,\n deskripsi: deskripsi\n });\n }).then(() => {\n console.log('data berhasil ditambahkan');\n }).catch((e) => {\n tx.abort();\n console.log('error menambahkan ' + e);\n })\n }else{ //jika data disimpan dalam mode ubah\n dbprom.then((db) => {\n tx = db.transaction('produk', 'readwrite'); //buka transaksi\n let dbstore = tx.objectStore('produk'); //pilih store ==>table\n return dbstore.put({ //ubah data dengan fungsi put\n id: id,\n nama: nama,\n stok: stok,\n harga: harga,\n deskripsi: deskripsi\n });\n }).then(() => {\n console.log('data berhasil diubah');\n }).catch((e) => {\n tx.abort();\n console.log('error mengubah ' + e);\n })\n } \n}", "function alterarCadastro()\r\n{\r\n\t//checa de o browser consegue trabalhar com indexeDB\r\n\tif(!indexedDB)\r\n\t{\r\n\t\tconsole.log(\"Seu navegador não suporta indexedDB.\");\r\n\t\treturn;\t\t\r\n\t}\r\n\r\n\t//abre o pseudo banco (ou cria, caso não exista)\r\n\tlet request=indexedDB.open(\"usersDB\",2);\r\n\r\n\t//se IndexedDB der erro\r\n\trequest.onerror = (event) => {alert(\"Erro ao utilizar IndexedDB.\");};\r\n\r\n\t//cria o schema do banco\r\n\trequest.onupgradeneeded = (event) => \r\n\t{ \r\n\t\tlet db=request.result;\r\n\t\tlet store=db.createObjectStore(\"users\", {keyPath: \"email\"});\r\n\t};\r\n\t\r\n\t//realiza os operacoes no pseudobanco \r\n\trequest.onsuccess = (event) => \r\n\t{\r\n\t\tlet db=request.result;\r\n\t\tlet tx=db.transaction(\"users\", \"readwrite\");\r\n\t\tlet store=tx.objectStore(\"users\");\t\r\n\t\t\r\n\t\t//se browser suporta storage\r\n\t\tif (typeof(Storage) !== \"undefined\") \r\n\t\t{\r\n\t\t\tlet atualiza = store.openCursor();\t\t\t\t\t//abre cursor para atualizar\r\n\t\t\tatualiza.onsuccess = (event) => \r\n\t\t\t{\r\n\t\t\t\tlet cursor = event.target.result;\r\n\t\t\t\tif(cursor) {\r\n\t\t\t\t\tif(cursor.value.email == logado) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tlet dados = cursor.value;\t\t\t\t//recupera dados no banco\r\n\t\t\t\t\t\t//console.log(dados);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tlet nome=document.getElementById(\"nome\").value;\r\n\t\t\t\t\t\tlet email=document.getElementById(\"email\").value;\r\n\t\t\t\t\t\tlet telefone=document.getElementById(\"telefone\").value;\r\n\t\t\t\t\t\tlet endereco=document.getElementById(\"endereco\").value;\r\n\t\t\t\t\t\tlet cidade=document.getElementById(\"cidade\").value;\r\n\t\t\t\t\t\tlet estado=document.getElementById(\"estado\").value;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//se alguma dos inputs estiverem vazios, nao alterar nada no banco\r\n\t\t\t\t\t\tif(nome!==\"\")\r\n\t\t\t\t\t\t\tdados.nome = nome;\r\n\t\t\t\t\t\t//if(email!==\"\") \r\n\t\t\t\t\t\t//{\r\n\t\t\t\t\t\t\t//dados.email = email;\r\n\t\t\t\t\t\t\t//localStorage.setItem(\"atualLogado\", email); //troca email logado tb\r\n\t\t\t\t\t\t//}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(telefone!==\"\")\r\n\t\t\t\t\t\t\tdados.telefone = telefone;\r\n\t\t\t\t\t\tif(endereco!==\"\")\r\n\t\t\t\t\t\t\tdados.endereco = endereco;\r\n\t\t\t\t\t\tif(cidade!==\"\")\r\n\t\t\t\t\t\t\tdados.cidade = cidade;\r\n\t\t\t\t\t\tif(estado!==\"\")\r\n\t\t\t\t\t\t\tdados.estado = estado;\r\n\t\t\t\t\t\tif(nome==\"\" && (email==\"\" || email == logado) && telefone==\"\" && endereco==\"\" && cidade==\"\" && estado==\"\") \r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\talert(\"Pelo menos um dos campos devem ser preechidos\");\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\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//atualiza banco\r\n\t\t\t\t\t\tconsole.log(\"Novo nome: \"+dados.nome);\r\n\t\t\t\t\t\tlet atualizaBD = cursor.update(dados);\r\n\t\t\t\t\t\tatualizaBD.onsuccess = () => {alert(\"Os dados foram atualizados com sucesso\" + dados.nome);};\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tatualizaBD.onerror = () => {alert(\"Não foi possível atualizar o Banco de Dados\");};\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//nao encontrou ninguem com o email logado, no banco\r\n\t\t\t\t\telse {alert(\"Não foi possível encontrar o usuário do email \"+logado);}\r\n\t\t\t\t}\r\n\t\t\t\t//nao conseguiu reabrir o banco para o update\r\n\t\t\t\telse {alert(\"Não foi possível reabrir o banco;\");}\t\r\n\t\t\t\tcursor.continue();\r\n\t\t\t};\t\t\t\r\n\t\t}\r\n\t\telse {alert(\"Seu navegador não suporte Local Storage\");}\r\n\r\n\t\t//encerra banco\r\n\t\ttx.oncomplete = () => {db.close();}\t\r\n\t};\r\n}", "save() {\n this.db.write();\n }", "function insertAnuncio(anuncio) {\n\n // Calcula novo Id a partir do último código existente no array para novo cadastro. Se edição, retorna valor salvo\n if (edicao != 1) {\n novoId = (dados.livros.length)+1;\n }\n else {\n novoId = idAtual;\n }\n \n // Organiza os dados na forma do registro\n let novoAnuncio = {\n \"user_id\": usuario_logado,\n \"id\": novoId,\n \"fotAn\": anuncio.fotAn,\n \"titAn\": anuncio.titAn,\n \"descAn\": anuncio.descAn,\n \"locAn\": anuncio.locAn,\n \"contAn\": anuncio.contAn\n };\n\n // Insere o novo objeto no array para novos cadastros, ou atualiza em caso de edição\n if (edicao != 1) {\n dados.livros.push(novoAnuncio);\n displayMessage(\"Anuncio inserido com sucesso!\");\n }\n else {\n dados.livros[novoId-1] = novoAnuncio;\n displayMessage(\"Anuncio atualizado com sucesso!\");\n }\n\n // Atualiza os dados no Local Storage\n localStorage.setItem('dados', JSON.stringify(dados));\n\n // Altera \"edicao\" para diferente de 1, considerando que a próxima tarefa seja novo cadastro\n edicao = 0;\n}", "function salidaSitio() {\n //check to ensure the mydb object has been created\n if (mydb) {\n //Get all the sitios from the database with a select statement, set outputSitiosList as the callback function for the executeSql command\n mydb.transaction(function (t) {\n t.executeSql(\"SELECT * FROM sitios\", [], actualizarSitio);\n });\n } else {\n // alert(\"¡Tú navegador web/browser no soporta WebSQL!\");\n }\n}", "function insertTempObra(x) {\n //code Insertando avances fisicos\n \n if (AOTI && x >= AOTI.length) {\n //code\n console.log(\"Todas las inserciones terminadas:::::::::::::::::::::::::::::::::\");\n location.href=\"mapa_proyectos.html\";\n // insertarAvanceFinancieroProyectos(0);\n }\n \n else if (AOTI && AOTI.length > 0) {\n console.log(\"Cargando datos espere un momento ::: 4 X=\" + x + \" Avances: \"+ AOTI.length);\n \n \n \n db.transaction(function(tx) {\n \n tx.executeSql('INSERT INTO TempAvanceObras(idAvanceFinanciero, idAvanceFisico, idObra)' +\n ' VALUES (?, ?, ?)',\n [AOTI.item(x).idAvanceFinanciero, AOTI.item(x).idAvanceFisico, AOTI.item(x).idObraFisico]);\n console.log(\"Avance Temp en Proyectos: \" + AOTI.item(x).idObraFisico);\n \n \n }, errorCB, function (){\n console.log(\"Se inserto correctamente el avance temporal: \" + AOTI.item(x).idObraFisico);\n \n x++;\n insertTempObra(x);\n \n }); \n \n } else {\n console.log(\"No hay avances temporales de obra :::::::::::::::::::::::\");\n // insertarAvanceFinancieroProyectos(0);\n }\n}", "function GuardarObjectPagina(){\n var Objetos;\n var PaginaID;\n var CuentoID;\n\t\n $('.actual').each(function () {\n var id = $(this)[0].id.split('_')[1];\n Objetos = getObjetos(id);\n \n PaginaID= parseInt($(this)[0].id.split('_')[1]);\n CuentoID= parseInt(CuentoActual.ID.split('_')[1]);\n\n });\n\n db.transaction(InsertObject, errorinsertObject, successinsertObject);\n\n function InsertObject(tx) {\n for(var i = 0; i < Objetos.length; i++) {\n var sql = \"INSERT OR REPLACE INTO `Objetos`(`ID`, `Posx`, `Posy`, `Zoom`, `Angulo`, `ID_Paginas`, `ID_Tipo`, `ID_Cuento`)\";\n sql += \" VALUES (\"+Objetos[i].id+\",\"+Objetos[i].x+\",\"+Objetos[i].y+\",\"+Objetos[i].zoom+\",\"+Objetos[i].angulo+\",\"+PaginaID+\",\"+Objetos[i].tipo+\",\"+CuentoID+\")\";\n tx.executeSql(sql);\n }\n }\n\n function errorinsertObject(tx, err) {\n alert(\"Error al guardar objeto de pagina: \"+err);\n }\n\n function successinsertObject() {\n \t//alert(\"Guardo el Objeto bien\");\n }\n\n\n}", "function GuardarFondoPagina(){\n\n var Pagina;\n\n $('.actual').each(function () {\n var id = $(this)[0].id.split('_')[1];\n Pagina = {ID:parseInt($(this)[0].id.split('_')[1]),CuentoID:parseInt(CuentoActual.ID.split('_')[1]), Fondo:parseInt(getFondo($(this)[0].id).split('_')[1])};\n });\n\n db.transaction(InsertFondo,errorinsertFondo, successinsertFondo);\n\n var sql = \"INSERT OR REPLACE INTO `Fondos`(`ID_Cuento`, `ID_Paginas`, `Tipo_Fondo`)\";\n sql += \" VALUES (\" + Pagina.CuentoID + \",\" + Pagina.ID + \",\" + Pagina.Fondo + \") \";\n \n function InsertFondo(tx) {\n tx.executeSql(sql);\n }\n\n function errorinsertFondo(tx, err) {\n alert(\"Error al guardar fondo: \"+err);\n }\n\n function successinsertFondo() {\n }\n}", "function majNiveaux() {\n // on ouvre la base, et on déclare les listeners\n var request = indexedDB.open(\"spacelash2\", 1);\n request.onerror = errorOpen;\n request.onupgradeneeded = createDatabase;\n\n request.onsuccess = function(event) {\n var db = event.target.result;\n\n // on ouvre une transaction qui permettra d'effectuer la suppression\n var transaction = db.transaction([\"niveaux\"], \"readwrite\");\n transaction.oncomplete = function(event) {};\n transaction.onerror = function(event) {\n window.alert('erreur de transaction suppression');\n };\n\n var niveauxStore = transaction.objectStore(\"niveaux\");\n var reqVider = niveauxStore.clear();\n reqVider.onsuccess = function(event) {\n }\n reqVider.onerror = function(event) {\n window.alert('erreur suppression');\n }\n\t\t\n\t\tvar majNiveaux=transaction.objectStore(\"niveaux\");\n\t\tfor (var i in parametrageNiveau) {\n majNiveaux.add(parametrageNiveau[i]); \n\t\t}\n\t\t\n\t\t\n }\n}", "function addItemUsuario(codigo,nombre_usuario,cedula,nombre,apellido,correo,rol) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO usuario (k_codusuario, n_usuario, o_cedula, n_nombre, n_apellido, o_correo, o_rol, contrasena) VALUES (?,?,?,?,?,?,?,?)\";\n tx.executeSql(query, [codigo, nombre_usuario, cedula, nombre, apellido, correo, rol, cedula], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n });\n}", "async save(isCreated){\n \n let sql = '';\n // insert\n if(isCreated){\n \n sql = `INSERT INTO ${this.tableName} (tenTheLoai,moTa) VALUES ('${this.columns.tenTheLoai}','${this.columns.moTa}')`;\n try {\n let results = await database.excute(sql);\n this.id = results.insertId;\n } catch (error) {\n throw error;\n }\n }\n\n // update\n else{\n sql = `UPDATE ${this.tableName} SET moTa='${this.columns.moTa}',tenTheLoai='${this.columns.tenTheLoai}' `+\n `WHERE id = ${this.id}`;\n try {\n let rs = await database.excute(sql);\n this.id = rs.id; \n } catch (error) {\n throw error;\n }\n }\n }", "function salidaPersonal() {\n //check to ensure the mydb object has been created\n if (mydb) {\n //Get all the personal from the database with a select statement, set outputPersonalList as the callback function for the executeSql command\n mydb.transaction(function (t) {\n t.executeSql(\"SELECT * FROM personal\", [], actualizarPersonal);\n });\n } else {\n // alert(\"¡Tú navegador web/browser no soporta WebSQL!\");\n }\n}", "function cargaDatos(){\n\tdb.transaction(cargaRegistros, errorDB);\n}", "async store({ request }) {\n const data = request.only(['ra', 'invitation_id'])\n\n //verifica se exits o estudante\n\n const student = await Database.from('students').where({ra:data.ra})\n if(student.length === 0){\n return {'error': \"don't exist\"};\n } \n\n //verifica se exist o convite\n\n const invitation = await Database.from('invitations').where({id: data.invitation_id})\n if(invitation.length === 0){\n return {'error':\"invitation does not exist\"}\n } \n\n //verifica se o aluno ja tem esse convite\n\n let si = await Database.from('studentInvitations')\n .where({invitation_id: data.invitation_id, ra: data.ra})\n \n if(si.length > 0){\n si = await Database.from('studentInvitations')\n .where({invitation_id: data.invitation_id, ra: data.ra}).del()\n return {si, msg:'delete'}\n }\n\n data.user_id = 1\n \n const si_id = await Database.from('studentInvitations').insert(data)\n\n if(si_id < 0) return {error: 'does not posible insert in the database'}\n\n si = await Database.from('studentInvitations').where({id:si_id})\n /** */\n return si\n }", "function setByDate(date) {\n let request = window.indexedDB.open(\"journalDataBase\", 1),\n db,\n tx,\n store,\n index\n\n request.onupgradeneeded = function (e) {\n let db = request.result,\n store = db.createObjectStore(\"journalStore\", { keyPath: \"date\" })\n }\n\n request.onerror = function (e) {\n console.log(\"Error: \" + e.target.errorCode)\n }\n\n request.onsuccess = function (e) {\n db = request.result\n tx = db.transaction(\"journalStore\", \"readwrite\")\n store = tx.objectStore(\"journalStore\")\n let entry = store.get(date)\n entry.onsuccess = function () {\n let result = entry.result\n if (result == null) {\n console.log('No info in date :' + date)\n document.querySelector(\".pg\").contentWindow.reset()\n document.querySelector(\".pg\").contentWindow.loadingState(false)\n } else {\n let dict = result.dict\n document.querySelector(\".pg\").contentWindow.loadJSON(dict)\n }\n }\n tx.oncomplete = function () {\n db.close()\n }\n }\n}", "async salva_descarregamento_sqlite({ ID, Unidade, Placa, Dia }){\n\n const Atualizado = module.exports.agora();\n\n // Procura um item igual no sqlite\n const db_caminhao = await connection('fDescarregamento')\n .select('*')\n .where( \"ID\", \"=\", ID );\n\n // Se não existir esses caminhões no sqlite ainda, criar um novo\n if ( db_caminhao.length === 0 ) {\n\n await connection('fDescarregamento')\n .insert({\n ID,\n Placa,\n Dia,\n Status: \"Aguardando chegada do veículo\",\n Unidade,\n Atualizado,\n });\n\n // Caso seja a primeira aparição dessa caminhão, inserir seu status na tabela de status\n module.exports.on_status_change({\n ID,\n Status: 'Aguardando chegada do veículo',\n Unidade,\n Placa,\n Dia,\n });\n };\n }", "function uploadTransaction() {\n // open a transaction on your db to read the data\n const transaction = db.transaction(['new_budget'], 'readwrite');\n \n // access your object store\n const budgetObjectStore = transaction.objectStore('new_budget');\n \n // get all records from store and set to a variable\n const getAll = budgetObjectStore.getAll();\n //// the .getAll() method is an asynchronous function that we have to attach an event handler to in order to retrieve the data. Let's add that next\n //.onsuccess is the event handler\n // upon a successful .getAll() execution, run this function\n getAll.onsuccess = function() {\n // if there was data in indexedDb's store, let's send it to the api server\n if (getAll.result.length > 0) {\n fetch('/api/transaction', {\n method: 'POST',\n body: JSON.stringify(getAll.result),\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json'\n }\n })\n .then(response => response.json())\n .then(serverResponse => {\n if (serverResponse.message) {\n throw new Error(serverResponse);\n }\n // open one more transaction\n const transaction = db.transaction(['new_budget'], 'readwrite');\n // access the new_pizza object store\n const budgetObjectStore = transaction.objectStore('new_budget');\n // clear all items in your store\n budgetObjectStore.clear();\n\n alert('All saved transactions have been submitted!');\n })\n .catch(err => {\n console.log(err);\n });\n }\n };\n \n \n}", "static saveRestaurantsIntoIDB(restaurants) {\r\n // const dbPromise = DBHelper.openIDB();\r\n return DBHelper.openIDB().then((db) => {\r\n if(!db) return;\r\n const tx = db.transaction('restaurants', 'readwrite')\r\n const store = tx.objectStore('restaurants');\r\n restaurants.forEach((restaurant) => {\r\n store.put(restaurant);\r\n });\r\n return tx.complete;\r\n });\r\n }", "async salva_descarregamento_sqlite_v2({ ID, Unidade, Placa, Dia, Transportadora, Modal, Nome, Materiais }){\n\n const Atualizado = module.exports.agora();\n\n // Procura um item igual no sqlite\n const db_caminhao = await connection('fDescarregamento')\n .select('*')\n .where( \"ID\", \"=\", ID );\n\n // Se não existir esses caminhões no sqlite ainda, criar um novo\n if ( db_caminhao.length === 0 ) {\n\n await connection('fDescarregamento')\n .insert({\n ID,\n Placa,\n Dia,\n Status: \"Aguardando chegada do veículo\",\n Unidade,\n Atualizado,\n Transportadora,\n Modal,\n Nome,\n Materiais: JSON.stringify(Materiais),\n Assinaturas: JSON.stringify([]),\n Atualizado_sys: Atualizado,\n });\n\n // Caso seja a primeira aparição dessa caminhão, inserir seu status na tabela de status\n module.exports.on_status_change({\n ID,\n Status: 'Aguardando chegada do veículo',\n Unidade,\n Placa,\n Dia\n });\n\n } else {\n\n await connection('fDescarregamento')\n .update({\n Placa,\n Dia,\n Unidade,\n Atualizado,\n Transportadora,\n Modal,\n Nome,\n Materiais: JSON.stringify(Materiais),\n Atualizado_sys: Atualizado\n })\n .where('ID', '=', ID);\n\n };\n }", "async store(aluno_id) {\n try {\n const aluno = await Aluno.findById(aluno_id);\n if (!aluno) {\n return null;\n }\n\n if (!aluno.turma) {\n const turmas = await Turma.find({ datainscricao: { $gte: aluno.createdAt } }).sort({ datainscricao: 1 });\n let turma = turmas[0];\n for (var i = 0, len = turmas.length; i < len; ++i) {\n if (turmas[i].vagas > turmas[i].totalinscritos) {\n turma = turmas[i];\n break;\n }\n }\n turma.totalinscritos += 1;\n await turma.save();\n\n aluno.turma = turma._id;\n await aluno.save();\n\n const alunoturma = await AlunoTurma.create({ aluno: aluno_id, turma: turma._id, estado: \"INSCRITO\", confirmar: turma.confirmar });\n return alunoturma;\n }\n\n const alunoturma = await AlunoTurma.findOne({ aluno: aluno_id, turma: aluno.turma });\n\n return alunoturma;\n } catch (e) {\n console.log(\"InscricaoController:Store \" + e);\n return null;\n }\n }", "function saveRecord(isAdding) {\n\n let nameEl = JSON.stringify(document.querySelector(\"#t-name\").value);\n let amountEl = document.querySelector(\"#t-amount\").value;\n\n if (!isAdding) {\n amountEl *= -1;\n }\n\n let amountString = JSON.stringify(amountEl);\n\n let transactionObject = [ { name: nameEl, value: amountString, date: new Date().toISOString() } ]\n\n const transaction = db.transaction(['transactions'], 'readwrite'); // Create transaction\n const table = transaction.objectStore('transactions'); // Access table\n table.add(transactionObject); // Add data to table\n}", "function NuevoRegistro(tx) {\n\ttx.executeSql('DELETE FROM registro');\n}", "function add(tipo,cidade,bairro,data,horario,tmusicos,torganistas){\n\t\n\n\ndb = window.sqlitePlugin.openDatabase({name: 'DB', location: 'default'});\n\ndb.executeSql('INSERT INTO ensaios (tipo, cidade, bairro, data, horario, tmusicos, torganistas) VALUES (?,?,?,?,?,?,?)', [tipo, cidade, bairro, data, horario, tmusicos, torganistas]);\n\n\nreturn 'ok';\n\n\n}", "function saveRecord(record) {\n //open a new transaction with the database with read and write permission\n const transaction = db.transaction(['new_budget'], 'readwrite');\n\n //access the object store for 'new_budget'\n const budgetObjectStore = transaction.objectStore('new_budget');\n\n //add record to your store with add method\n budgetObjectStore.add(record);\n}", "function saveData() {\n const transaction = db.transaction([\"transactions\"], \"readwrite\");\n const transactionStore = transaction.objectStore(\"transactions\");\n const allData = transactionStore.getAll();\n\n allData.onsuccess = () => {\n if (allData.result.length > 0) {\n fetch(\"/api/transaction/bulk\", {\n method: \"POST\",\n body: JSON.stringify(allData.result),\n headers: {\n Accept: \"application/json, text/plain, */*\",\n \"Content-Type\": \"application/json\",\n },\n })\n .then((response) => {\n return response.json();\n })\n .then(() => {\n const transaction = db.transaction(\n [\"transactions\"],\n \"readwrite\"\n );\n const transactionStore =\n transaction.objectStore(\"transactions\");\n transactionStore.clear();\n });\n }\n };\n}", "function saveData(data) {\n const transaction = db.transaction([\"open\"], \"readwrite\");\n\n const store = transaction.objectStore(\"open\");\n\n store.add(data);\n}", "function saveRecord(record) {\n // open a new transaction with the database with read and write permissions \n const transaction = db.transaction(['new_budget'], 'readwrite');\n \n // access the object store for `new_budget`\n const budgetObjectStore = transaction.objectStore('new_budget');\n \n // add record to your store with add method\n budgetObjectStore.add(record);\n}", "save() {\n if (this._history.length > 9){\n this._history.shift();\n }\n this._history.push(this.internalData);\n // Make the commit to setup the index and the state\n this.commit();\n }", "function consultarQr(){\n //alert(\"Creando transaccion\");\n db.transaction(obtenerQr,errorBD);\n}", "function putIndexedDB(objectStore, item, key) {\r\n let openDB = openIndexedDB();\r\n\r\n openDB.onsuccess = function() {\r\n let db = getStoreIndexedDB(openDB, objectStore);\r\n let putRequest = db.store.put(item, key);\r\n\r\n //console.log(\"The transaction that originated this request is \" + db.tx);\r\n\r\n putRequest.onsuccess = function() {\r\n console.log(\"IndexedDB put() request onSuccess\");\r\n }\r\n\r\n putRequest.onerror = function() {\r\n console.log(\"put request onError\");\r\n }\r\n\r\n }\r\n\r\n}", "function guardar(){\n\n\tif(validateFields()){\n\t\tvar publicacion = new Publicacion(getValue('nombreID'), getValue('contactoID'), \n\t\tgetValue('estadoID'), getValue('ciudadID'), \n\t\tgetValue('shortDesc'), getValue('longDesc'));\n\n\t\tvar item = Object.assign({}, publicacion);\n\t\tdb.collection(COL_ORG).add(item).then(\n\t\tdata => {\n\t\t\talert('Guardado');\n\t\t\tconsole.log(\"Datos guardados exitosamente!!!\", data);\n\t\t\twindow.close();\n\t\t},\n\t\terror => {\n\t\t\talert('Error');\n\t\t\tconsole.error(\"Ocurrio un error al guardar los datos!!!\", error);\n\t\t});\n\t}else{\n\t\talert('Error: llena todos los campos.');\n\t}\n\n\n\t\n}", "async function insertProducto(obj) {\n try {\n // {stock_p : \"palabra\"}\n const rows = await query (\"insert into producto set ?\",obj);\n // undefined insertId es una propiedad que nos devuelve el primary A_I con el que se inserto el ultimo producto de esta peticion. \n\n return rows.insertId;\n } catch(err) {\n console.log(\"Entro al catch del model\")\n throw err;\n // console.log(err);\n }\n}", "function addItemsAscensorItemsFoso(k_coditem_foso,v_item,o_descripcion,v_clasificacion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO ascensor_items_foso (k_coditem_foso, v_item, o_descripcion, v_clasificacion) VALUES (?,?,?,?)\";\n tx.executeSql(query, [k_coditem_foso,v_item,o_descripcion,v_clasificacion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items foso...Espere\");\n });\n}", "save(data) {\n this.db.save(data);\n }", "save() {}", "saveProduct(productData) {\r\n let nuevoProducto = new Product(productData);\r\n let indice = this._checkExist(productData.code);\r\n console.log(indice);\r\n this._inventory[this._inventory.length] = nuevoProducto;\r\n console.log(nuevoProducto);\r\n console.log(this._inventory);\r\n }", "function addItemsAscensorItemsPreliminar(k_coditem_pozo,o_descripcion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO ascensor_items_preliminar (k_coditem_preli, o_descripcion) VALUES (?,?)\";\n tx.executeSql(query, [k_coditem_pozo,o_descripcion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items preliminares...Espere\");\n });\n}", "async save(obj) {\n return this.db.one(\n 'INSERT INTO $1:name($2:name) VALUES($2:list) RETURNING id',\n [this.table, obj],\n )\n .then((data) => data.id)\n .catch((error) => {\n throw error;\n });\n }", "function GuardarBocadillosPagina(){\n var Bocadillos;\n var PaginaID;\n var CuentoID;\n\n $('.actual').each(function () {\n var id = $(this)[0].id.split('_')[1];\n Bocadillos = getBocadillos(id);\n console.log(Bocadillos);\n\n PaginaID= parseInt($(this)[0].id.split('_')[1]);\n CuentoID= parseInt(CuentoActual.ID.split('_')[1]);\n\n });\n\n db.transaction(InsertBocadillos, errorinsertBocadillos, successinsertBocadillos);\n\n\n function InsertBocadillos(tx) {\n for(var i = 0; i < Bocadillos.length; i++) {\n var sql = \"INSERT OR REPLACE INTO `Bocadillos`(`ID`, `Posx`, `Posy`, `Zoom`, `Angulo`, `ID_Paginas`, `ID_Tipo`, `ID_Cuento`)\";\n sql += \" VALUES (\"+Bocadillos[i].id+\",\"+Bocadillos[i].x+\",\"+Bocadillos[i].y+\",\"+Bocadillos[i].zoom+\",\"+Bocadillos[i].angulo+\",\"+PaginaID+\",\"+Bocadillos[i].tipo+\",\"+CuentoID+\")\";\n tx.executeSql(sql);\n }\n }\n\n function errorinsertBocadillos(tx, err) {\n alert(\"Error en guardar Bocadillos processing SQL: \"+err);\n }\n\n function successinsertBocadillos() {\n }\n}", "async save() {\n const options = {\n TableName: process.env.userTableName,\n Item: ddb.prepare(this.toJSON())\n };\n await ddb.call('putItem', options);\n return this.toJSON();\n }", "function saveRecord(record) {\n // open a new transaction with the database readwrite permissions \n const transaction = db.transaction(['new_transaction'], 'readwrite');\n \n // access objectStore \n const budgetObjectStore = transaction.objectStore('new_transaction');\n \n // add record to store with add (method)\n budgetObjectStore.add(record);\n}", "function salvarDadosFirebase(id, nome) {\n\n const dados = {\n id: id,\n nome: nome,\n valor: valor\n }\n\n //bd.collection(\"categorias\").add(dados).then(function() {\n bd.doc(id).set(dados).then(function() {\n\n $(\"#modalAdicionar\").modal(\"hide\")\n removerModalProgress()\n limparCamposAdicionar()\n abrirModalAlerta(\"Sucesso ao salvar Dados\")\n\n }).catch(function(error) {\n\n $(\"#modalProgress\").modal(\"hide\")\n\n removerModalProgress()\n abrirModalAlerta(\"Erro ao Salvar Dados: \" + error)\n })\n }", "async addNewOcjenaAktivnost(){\n await dbAddNewOcjenaAktivnost(this);\n }", "setBusqueda(contexto, nuevaBusqueda) {\r\n contexto.commit(\"SET_BUSQUEDA\", nuevaBusqueda);\r\n console.log(\"ejecuta setBusqueda\");\r\n }", "save() {\n try {\n this._toggleSaveThrobber();\n this._readFromForm();\n this.dao.save();\n\n // make sure the edit input is showing the correct id, reload data from server\n document.getElementById('edit_id').value = this.dao.id;\n this.read();\n \n } catch(e) {\n console.log(e);\n alert(e);\n }\n this._toggleSaveThrobber();\n }", "async save(dbConfig) {\n // TODO inserire try catch\n let db = await sql.connect(dbConfig);\n // per distinguere se è un update o un insert into\n let query = 'INSERT INTO dbo.Events ([Location],[MaxUsers],[StartDate],[EndDate],[CorsoITS],[StudentName]) VALUES ( @Location,@MaxUsers,@StartDate,@EndDate,\\'DAM\\',\\'Mauro Biasutti\\')';\n console.log(query);\n if (this._id) {\n query = 'UPDATE dbo.Events SET [Location]=@Location, [MaxUsers]=@MaxUsers, [StartDate]=@StartDate, [EndDate]=@EndDate WHERE id=@id'\n }\n let EventSaved = await db.request()\n\n .input('Location', sql.NVarChar, this.Location)\n .input('MaxUsers', sql.Int, this.MaxUsers)\n .input('StartDate', sql.NVarChar, this.StartDate)\n .input('EndDate', sql.NVarChar, this.EndDate)\n .input('id', sql.Int, this._id)\n .query(query);\n\n console.log('sto salvando i dati dell\\'evento ');\n sql.close();\n return true;\n\n }", "function insertTemp(x) {\n //code Insertando avances fisicos\n \n \n \n if (APTI && x >= APTI.length) {\n //code\n console.log(\"Cargando datos espere un momento vamos a insertar avances temporales de Obra::: X=\" + x );\n \n insertarTempAvancesObras();\n }\n \n else if (APTI && APTI.length > 0) {\n console.log(\"Cargando datos espere un momento ::: 4 X=\" + x + \" Avances: \"+ APTI.length);\n \n \n \n db.transaction(function(tx) {\n \n tx.executeSql('INSERT INTO TempAvanceProyectos(idAvanceFinanciero, idAvanceFisico, idProyecto)' +\n ' VALUES (?, ?, ?)',\n [APTI.item(x).idAvanceFinanciero, APTI.item(x).idAvanceFisico, APTI.item(x).idProyectoFisico]);\n console.log(\"Avance Temp en Proyectos: \" + APTI.item(x).idProyectoFisico);\n \n \n }, errorCB, function (){\n console.log(\"Se inserto correctamente el avance temporal: \" + APTI.item(x).idProyectoFisico);\n \n x++;\n insertTemp(x);\n \n }); \n \n } else {\n console.log(\"No hay avances temporales de proyecto :::::::::::::::::::::::\");\n // insertarAvanceFinancieroProyectos(0);\n }\n}", "function addItemsEscalerasItemsProteccion(k_coditem,o_descripcion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO escaleras_items_proteccion (k_coditem, o_descripcion) VALUES (?,?)\";\n tx.executeSql(query, [k_coditem,o_descripcion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items protección...Espere\");\n });\n}", "function addLogin(login){\n db.transaction(function(tx){\n tx.executeSql('INSERT INTO login(id, usuario, senha) values (null,\"'+login.usuario+'\",\"'+login.senha+'\")')\n },\n function(err){\n console.log(err);\n },\n function(){\n });\n}", "function saveRecord(record) {\n // open a new transaction with the database with read and write permissions \n const transaction = db.transaction(['new_pizza'], 'readwrite');\n \n // access the object store for `new_pizza`\n const pizzaObjectStore = transaction.objectStore('new_pizza');\n \n // add record to your store with add method\n pizzaObjectStore.add(record);\n }", "async store(req,res){\n let theLoai = new TheLoai();\n theLoai.columns.tenTheLoai = req.body['ten-the-loai'];\n theLoai.columns.moTa = req.body['mt-the-loai'];\n try {\n await theLoai.save(true);\n res.send({complete:true,newTheLoai:theLoai,mess:'Thêm thành công!'});\n } catch (error) {\n res.send({complete:false});\n }\n \n }", "function encolar (elemento){\n\n\t\tthis.dataStore.push(elemento);\n\t}", "function addTemplateToDB(data, key, objectStore) {\n var request = window.indexedDB.open('formsAdministrationDB', 1);\n var data1;\n var formhtml;\n request.onsuccess = function (event) {\n var db = event.target.result;\n var tx = db.transaction(\"administratorTemplate\", 'readwrite');\n var store = tx.objectStore(\"administratorTemplate\");\n data1 = store.get(key);\n data1.onsuccess = function (event) {\n\n store.put(data, key);\n \n }\n\n\n\n\n };\n\n}", "function insertProduct(db, producto) {\n let store = db.transaction('productos', 'readwrite').objectStore('productos');\n let addReq = store.add(producto );\n return new Promise((resolve, reject) => {\n addReq.addEventListener('success', e => resolve(e.target.result)); // Devuelve el producto insertado\n addReq.addEventListener('error', e => reject('No se puede añadir el producto'));\n });\n}", "function addItemsAscensorItemsCabina(k_coditem_cabina,v_item,o_descripcion,v_clasificacion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO ascensor_items_cabina (k_coditem_cabina, v_item, o_descripcion, v_clasificacion) VALUES (?,?,?,?)\";\n tx.executeSql(query, [k_coditem_cabina,v_item,o_descripcion,v_clasificacion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items cabina...Espere\");\n });\n}", "function consultarQrInVal(){\n db.transaction(obtenerQrInVal,errorBD);\n}", "function crearTablaAscensorValoresObservacionFinal(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_valores_finales (k_codusuario,k_codinspeccion,o_observacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores finales...Espere\");\n console.log('transaction creada ok');\n });\n}", "function guardarPedido4() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: PrecioJabonRopaColor,\n Medida: medida,\n NombreProducto: NombreJabonRopaColor.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadJabonRopaColor.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "function guardarPedido2() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: Precio,\n Medida: medida,\n NombreProducto: NombreAmbientador.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadAmbientador.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "function guardarPedido() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: PrecioSuavisante1,\n Medida: medida,\n NombreProducto: NombreSuavisante1.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadSuavisante1.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "function saveObj(object) {\n var search = db.collection('search');\n search.insert(object.data);\n console.log(\"Object was saved successfully!!!\");\n createHistory();\n }", "function saveRecord(record) {\n //open a new transaction with the database with read and write permissions\n const transaction = db.transaction([\"new_transaction\"], \"readwrite\");\n\n //access the object store for \"new_transaction\"\n const transactionObjectStore = transaction.objectStore(\"new_transaction\");\n\n //add record to your store with add method\n transactionObjectStore.add(record);\n}", "function addItemsEscalerasItemsPreliminar(k_coditem,o_descripcion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO escaleras_items_preliminar (k_coditem, o_descripcion) VALUES (?,?)\";\n tx.executeSql(query, [k_coditem,o_descripcion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items preliminares...Espere\");\n });\n}", "function addItemsAscensorItemsProteccion(k_coditem,o_descripcion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO ascensor_items_proteccion (k_coditem, o_descripcion) VALUES (?,?)\";\n tx.executeSql(query, [k_coditem,o_descripcion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items protección...Espere\");\n });\n}", "save () { this.store.saveSync() }", "function createDatabase() {\n\n if (!window.indexedDB) {\n window.alert(\"Your browser doesn't support IndexedDB.\");\n }\n\n // employee data\n var employeeData = [\n { employeeId: 1, name: \"Daniel\", email: \"[email protected]\" },\n { employeeId: 2, name: \"Berta\", email: \"[email protected]\" }\n ];\n\n var dbName = \"EmployeeDB\";\n\n // Open database with version=1. Use integer valueonly ! Not 1.1, 1.2 etc.\n var request = indexedDB.open(dbName, 1);\n\n request.onerror = function (event) {\n console.log(\"request.onerror errcode=\" + event.target.error.name);\n };\n\n request.onupgradeneeded = function (event) {\n console.log(\"request.onupgradeneeded, creating a new version of the database\");\n db = event.target.result;\n\n // Create an objectStore for employees. use unique employeeId as key path\n var objectStore = db.createObjectStore(\"employees\", { keyPath: \"employeeId\" });\n\n // Create index to search employee by name.\n objectStore.createIndex(\"name\", \"name\", { unique: false });\n\n // Create an index to search by email.\n objectStore.createIndex(\"email\", \"email\", { unique: true });\n\n // Store values in objectStore.\n for (var i in employeeData) {\n objectStore.add(employeeData[i]);\n }\n };\n\n request.onsuccess = function (event) {\n // Handle errors.\n console.log(\"request.onsuccess, database opened, now can add / remove / look for data in IndexedDB.\");\n\n // The result is the database itself\n db = event.target.result;\n };\n}", "commit() {\n this.commitCrudStores();\n }", "commit() {\n this.commitCrudStores();\n }", "static saveToDB(restaurants){\r\n const dbPromise = DBHelper.openDB();\r\n dbPromise.then(db => {\r\n if(!db) return ;\r\n const transaction = db.transaction(\"restaurantList\", \"readwrite\");\r\n const store = transaction.objectStore(\"restaurantList\");\r\n restaurants.forEach(restaurant => {\r\n store.put(restaurant);\r\n });\r\n return transaction.complete;\r\n });\r\n }", "function guardarPedido3() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: Precio,\n Medida: medida,\n NombreProducto: NombreJabonManos.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadJabonManos.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "function addItemsAscensorItemsPozo(k_coditem_pozo,v_item,o_descripcion,v_clasificacion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO ascensor_items_pozo (k_coditem_pozo, v_item, o_descripcion, v_clasificacion) VALUES (?,?,?,?)\";\n tx.executeSql(query, [k_coditem_pozo,v_item,o_descripcion,v_clasificacion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items pozo...Espere\");\n });\n}", "function addItemsEscalerasItemsElementos(k_coditem,o_descripcion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO escaleras_items_elementos (k_coditem,o_descripcion) VALUES (?,?)\";\n tx.executeSql(query, [k_coditem,o_descripcion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items elementos...Espere\");\n });\n}", "openConection() {\n if (window.indexedDB) {\n var req = window.indexedDB.open(\"Database\", 1);\n var db;\n req.onupgradeneeded = function(e) {\n var db = e.target.result;\n var store = db.createObjectStore(\"Formular\", { keyPath: \"name\" });\n var store2 = db.createObjectStore(\"Versions\", { keyPath: \"name\" });\n };\n req.onsuccess = function(e) {\n db = e.target.result;\n };\n req.onerror = function(e) {\n console.log(\"Error\" + e);\n };\n }\n }", "static addIndexedDb(type, items) {\n DBHelper.dbPromise().then(function(db) {\n let tx = db.transaction(type, 'readwrite');\n let store = tx.objectStore(type);\n items.forEach((item) => store.put(item));\n return tx.complete.then(() => Promise.resolve(items));\n });\n\n }", "function consultarQrVal(){\n db.transaction(obtenerQrVal,errorBD);\n}", "function storeToIndexedDB(resourceType, uid, dataObject) {\n\tif (iDB == null) {\n\t\tlog('iDB not available');\n\t\treturn;\n\t}\n\t\n\tvar useStorage = resourceType.substring(0, resourceType.length - 1) + 'Storage';\n\tvar dbTransactions = iDB.transaction([useStorage], 'readwrite');\n\tvar dbStorage = dbTransactions.objectStore(useStorage);\n\tvar storeRequest = dbStorage.put(dataObject, uid);\n\tstoreRequest.onsuccess = function(event) {\n\t\tlog(uid + '(' + resourceType + ') stored.');\n\t};\n\tstoreRequest.onerror = function(event) {\n\t\tlog(uid + '(' + resourceType + ') error while put into DB.');\n\t};\n}", "insertarPersona (persona) {\n let valores = `${ persona.getNombre() }, ${ persona.getApellido() }, ${ persona.getDireccion() }, ${ persona.getEdad() }, ${ persona.getTelefono() }, ${ persona.getCorreo() }`;\n let r = this.db.push(valores);\n if (r) {\n console.log( \"PERSONA_INSERTADA\" );\n } else {\n console.log( \"ERROR_PERSONA_INSERTADA\" );\n }\n }", "function saveRecord(record) {\n const transaction = db.transaction([\"BudgetStore\"], \"readwrite\");\n const budgetStore = transaction.objectStore(\"BudgetStore\");\n budgetStore.add(record);\n}", "async save() {\n const priv = privates.get(this);\n const tableName = priv.get(\"tableName\");\n if (tableName) {\n const formData = new FormData(this.form);\n if (formData.get(\"saveDetails\") !== \"on\") {\n return;\n }\n const dataToSave = Object.assign({}, this.data, this.toObject());\n if (!db.isOpen()) {\n await db.open();\n }\n await db[tableName].put(dataToSave);\n this.data = dataToSave;\n }\n }", "function openDb() {\r\n\t\r\n\t\tconsole.log(\"openDb ...\");\r\n\t\t\r\n\t\tdb = window.indexedDB.open(DB_NAME, DB_VERSION);\r\n\t\tdb.onsuccess = function (evt) {\r\n\t\t\tdba = evt.target.result; \r\n\t\t\tconsole.log(\"openDb DONE\");\r\n\r\n\t\t};\r\n\t\t\r\n\t\tdb.onerror = function (evt) {\r\n\t\t\tconsole.log(\"openDb: \" + evt.target.errorCode);\r\n\t\t};\r\n\t\t\r\n\t\t\r\n\t\tdb.onupgradeneeded = function (evt) {\r\n\t\t\tconsole.log(\"openDb.onupgradeneeded\");\r\n\t\t\tdba = evt.target.result;\r\n\t\t\t\r\n\t\t\tvar itensObjectStore = dba.createObjectStore(\"itens\", {\r\n\t\t\t\tkeyPath: \"id\"\r\n\t\t\t}).createIndex(\"Nome\", \"nome\", {\r\n\t\t\t\tunique: false\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tvar bagObjectStore = dba.createObjectStore(\"bag\", {\r\n\t\t\t\tkeyPath: \"id\"\r\n\t\t\t})\r\n\t\t\t\r\n\t\t\tvar equipObjectStore = dba.createObjectStore(\"equip\", {\r\n\t\t\t\tkeyPath: \"id\"\r\n\t\t\t}).createIndex(\"Nome\", \"nome\", {\r\n\t\t\t\tunique: false\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t//console.log (itensObjectStore);\r\n\t\t\titensObjectStore.objectStore.transaction.oncomplete = function(event) {\r\n\t\t\t\r\n\t\t\t// Armazenando valores no novo objectStore.\t\r\n\t\t\t\r\n\t\t\tcreateGItens();\t\r\n\t\t\t};\r\n\t\t}\r\n\t\r\n\t\tdb.onblocked = function(e){\r\n\t\t\tconsole.log(e)\r\n\t\t}\r\n\r\n\t}", "function guardarPedido6() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: PrecioJabonLavadora,\n Medida: medida,\n NombreProducto: NombreJabonLavadora.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadJabonLavadora.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "criaCifraBd(){\n db.execute(`INSERT INTO cifra (nome,musica) VALUES (\"${this.nome}\", \"${this.cifra}\")`)\n }", "function uploadTransaction() {\n // open a transaction on your db\n const transaction = db.transaction(['new_transaction'], 'readwrite');\n \n // access object store\n const budgetObjectStore = transaction.objectStore('new_transaction');\n \n // get transactions from store and set to a variable\n const getAll = budgetObjectStore.getAll();\n \n // if successful .getAll() execution, run this function\n getAll.onsuccess = function() {\n \n // if data in indexDb store, send to the api server\n if (getAll.result.length > 0) {\n fetch('/api/transaction', {\n method: 'POST',\n body: JSON.stringify(getAll.result),\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json'\n }\n })\n .then(response => response.json())\n .then(serverResponse => {\n if (serverResponse.message) {\n throw new Error(serverResponse);\n }\n // open another transaction\n const transaction = db.transaction(['new_transaction'], 'readwrite');\n // access object store\n const budgetObjectStore = transaction.objectStore('new_transaction');\n // clear items in the store\n budgetObjectStore.clear();\n\n alert('All offline transactions have been submitted!');\n })\n .catch(err => {\n console.log(err);\n });\n }\n }\n}", "function crearTablaAscensorValoresFoso(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_valores_foso (k_codusuario,k_codinspeccion,k_coditem,n_calificacion,v_calificacion,o_observacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores foso...Espere\");\n console.log('transaction creada ok');\n });\n}", "function saveRecord(record) {\n //open a connection to the db, access the object store, and use the .add method to add the record to the IndexedDB.\n const transaction = db.transaction(['offline_actions'], 'readwrite');\n const actionsObjectStore = transaction.objectStore('offline_actions');\n actionsObjectStore.add(record);\n}", "async function addIndexedData(data) {\r\n // Open up a transaction as usual\r\n var objectStore = db.transaction(['jobs'], \"readwrite\").objectStore('jobs');\r\n\r\n // Create another request that inserts the item back into the database\r\n var updateTitleRequest = objectStore.put(data, 1);\r\n\r\n // Log the transaction that originated this request\r\n console.log(\"The transaction that originated this request is \" + updateTitleRequest.transaction);\r\n\r\n // When this new request succeeds, run the displayData() function again to update the display\r\n updateTitleRequest.onsuccess = function () {\r\n console.log(\"SUCCESS!!!! WOOOHOOOO\");\r\n };\r\n}", "function addLogin(login) {\n db.transaction(function (tx) {\n tx.executeSql('INSERT INTO login(id, usuario, senha) values (null,\"' + login.usuario + '\",\"' + login.senha + '\")')\n },\n function (err) {\n console.log(err);\n },\n function () {\n });\n}", "function saveRecord(record) {\n const transaction = db.transaction(['new_funds'], 'readwrite');\n\n const fundsObjectStore = transaction.objectStore('new_funds');\n\n fundsObjectStore.add(record);\n\n showModal(false);\n}", "function synchro() {\n document.getElementById(\"weatherForm\").style.display = \"none\";\n\n var licznik = 0;\n\n var obj = db\n .transaction(\"dane_pogodowe\", \"readwrite\")\n .objectStore(\"dane_pogodowe\");\n\n obj.openCursor().onerror = function (event) {\n alert(\"Błąd przy otwieraniu kursora.\");\n };\n\n obj.openCursor().onsuccess = function (event) {\n var cursor = event.target.result;\n\n if (cursor) {\n var dane = {};\n dane.dzien = cursor.value.dzien;\n dane.temp = cursor.value.temp;\n dane.opad = cursor.value.opad;\n\n JSONData = JSON.stringify(dane);\n reqObj = getRequestObject();\n\n reqObj.onreadystatechange = function () {\n if (reqObj.readyState == 4 && reqObj.status == 200) {\n JSONResponse = JSON.parse(reqObj.response);\n if (JSONResponse[\"status\"] == \"ok\") {\n alert(\"Synchronizacja danych zakończona pomyślnie.\");\n }\n }\n };\n reqObj.open(\n \"POST\",\n \"rest/save\",\n true\n );\n reqObj.send(JSONData);\n const del = cursor.delete();\n del.onsuccess = function () {\n //console.log(\"Usunięto rekord, na który wskazywał kursor.\");\n };\n licznik += 1;\n cursor.continue();\n } else if (licznik == 0) {\n alert(\n \"Lokalna baza przeglądarki jest pusta - nie ma czego synchronizować.\"\n );\n }\n // na koniec wyswietlenie danych bazy mongoDB\n display_table_mongo(null);\n };\n}", "function addItemsAscensorItemsElementos(k_coditem,o_descripcion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO ascensor_items_elementos (k_coditem,o_descripcion) VALUES (?,?)\";\n tx.executeSql(query, [k_coditem,o_descripcion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items elementos...Espere\");\n });\n}", "function llenarBD(bd){\n\t//afegir json a la base de dades\n\tvar ind=1;//index per que no es repeteixi cap num que es la keyPath del indexedDB.\n\tvar transaction;\n\tconsole.log(\"aqui llego!\")\n\t$.getJSON('xmljson/json.json', function(data) { //igual que en l'altre javascript, es podria haver fet un per als dos, no hi vaig pensar.\n\t\ttransaction= bd.transaction([\"libros\"],\"readwrite\").objectStore(\"libros\");\n\t\t$.each(data.libros, function(i, f) {\n\t\t\tvar llibre = new Object;//creo un objecte per posar la info del json.\n\t\t\tllibre.num=ind;\n\t\t\tind++;\n\t\t\tllibre.titulo=f.titulo;\n\t\t\tllibre.autor=f.autor;\n\t\t\tllibre.desc=f.descripcion;\n\t\t\tllibre.img=f.img;\n\n\t\t\tvar request=transaction.add(llibre);//proba a afegirlo\n\n\t\t\trequest.onerror=function(e){//Si error costuma a esser per que ja existeix i no es pot repetir.\n\t\t\t\tconsole.log(\"El fichero ha sufrido el siguiente error: \", e.target.error.name);\n\t\t\t};\n\n\t\t\trequest.onsuccess=function(e){\n\t\t\t\tconsole.log(\"Fichero cargado con éxito.\");\n\t\t\t};\n\t\t});\n\t});\n\n\t//afegir xml a la base de dades\n \tvar xmlhttp = new XMLHttpRequest();//Mateix amb xml que en l'altre fitxer js.\n \txmlhttp.onreadystatechange = function() {\n \tif (this.readyState == 4 && this.status == 200) {\n \t transaction= bd.transaction([\"libros\"],\"readwrite\").objectStore(\"libros\");\n \t var xmlDoc = this.responseXML;\n \t\tvar x = xmlDoc.getElementsByTagName(\"libro\");\n \t\tfor (var i = 0; i <x.length; i++) {\n\t\t\tvar llibre2=new Object;\n \t\t\tllibre2.num=ind;\n\t\t\tind++;\n \t\t\tllibre2.titulo=x[i].getElementsByTagName(\"titulo\")[0].childNodes[0].nodeValue;\n\t\t\tllibre2.autor=x[i].getElementsByTagName(\"autor\")[0].childNodes[0].nodeValue;\n \t\t\tllibre2.desc=x[i].getElementsByTagName(\"descripcion\")[0].childNodes[0].nodeValue;\n\t\t\tllibre2.img=x[i].getElementsByTagName(\"img\")[0].childNodes[0].nodeValue;\n\n\t\t\tvar request=transaction.add(llibre2);\n\n\t\t\t\trequest.onerror=function(e){\n\t\t\t\t\tconsole.log(\"El fichero ha sufrido el siguiente error: \", e.target.error.name);\n\t\t\t\t};\n\n\t\t\t\trequest.onsuccess=function(e){\n\t\t\t\t\tconsole.log(\"Fichero xml cargado con éxito.\");\n\t\t\t\t};\n \t\t}\n\t\t}\n \t};\n \txmlhttp.open(\"GET\", \"xmljson/text.xml\", true);\n \txmlhttp.send();\n}", "function saveForLater(team) {\n dbPromised\n .then(function(db) {\n let tx = db.transaction(\"teams\", \"readwrite\");\n let store = tx.objectStore(\"teams\");\n console.log(team);\n store.add(team); //mayerorror\n return tx.complete;\n })\n .then(function() {\n console.log(\"Team ini berhasil di simpan.\");\n });\n}", "function crearTablaEscalerasValoresObservacionFinal(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE escaleras_valores_finales (k_codusuario,k_codinspeccion,o_observacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores finales...Espere\");\n console.log('transaction creada ok');\n });\n}", "function GuardarPersonajesPagina(){\n var Personajes;\n var PaginaID;\n var CuentoID;\n\n $('.actual').each(function () {\n var id = $(this)[0].id.split('_')[1];\n Personajes = getPersonajes(id);\n\n PaginaID= parseInt($(this)[0].id.split('_')[1]);\n CuentoID= parseInt(CuentoActual.ID.split('_')[1]);\n\n });\n\n db.transaction(InsertPersonajes, errorinsertPersonajes, successinsertPersonajes);\n\n\n function InsertPersonajes(tx) {\n for(var i = 0; i < Personajes.length; i++) {\n var sql = \"INSERT OR REPLACE INTO `Personajes`(`ID`, `Posx`, `Posy`, `Zoom`, `Angulo`, `ID_Paginas`, `ID_Tipo`, `ID_Cuento`)\";\n sql += \" VALUES (\"+Personajes[i].id+\",\"+Personajes[i].x+\",\"+Personajes[i].y+\",\"+Personajes[i].zoom+\",\"+Personajes[i].angulo+\",\"+PaginaID+\",\"+Personajes[i].tipo+\",\"+CuentoID+\")\";\n tx.executeSql(sql);\n }\n }\n\n function errorinsertPersonajes(tx, err) {\n alert(\"Error en guardar personaje processing SQL: \"+err);\n }\n\n function successinsertPersonajes() {\n }\n}" ]
[ "0.7209134", "0.6605569", "0.65379083", "0.65260077", "0.64393204", "0.63649654", "0.634962", "0.627919", "0.61195225", "0.61022764", "0.6100517", "0.60938764", "0.6090512", "0.6067234", "0.60637563", "0.6039262", "0.6038369", "0.60263157", "0.6017888", "0.60032165", "0.6000793", "0.6000535", "0.5987394", "0.596043", "0.59533006", "0.5952624", "0.59333754", "0.5931608", "0.5929858", "0.5906082", "0.5894742", "0.58927506", "0.58857864", "0.58790165", "0.5866638", "0.5862019", "0.5846411", "0.58371913", "0.58367866", "0.5831614", "0.58301616", "0.58276093", "0.58066523", "0.58035356", "0.5792137", "0.5787295", "0.57847226", "0.5782776", "0.5781967", "0.57818425", "0.57778627", "0.57671905", "0.57670236", "0.57582784", "0.5750523", "0.5741598", "0.57315147", "0.5731282", "0.57286566", "0.5727018", "0.5726786", "0.572577", "0.57256556", "0.5716057", "0.5714799", "0.57133746", "0.5710671", "0.5703359", "0.57025415", "0.5698822", "0.56956446", "0.56924534", "0.5687954", "0.5687954", "0.5687672", "0.5686158", "0.56857324", "0.5679333", "0.5677954", "0.5676739", "0.5667027", "0.56607515", "0.5659669", "0.5658623", "0.5658154", "0.56556976", "0.5653275", "0.5650856", "0.5646794", "0.5643202", "0.5638016", "0.5637997", "0.56363267", "0.56271017", "0.56256735", "0.5623689", "0.5621672", "0.5615322", "0.56137234", "0.56130576" ]
0.6615429
1
limpa todos os registros do IndexedDb
function removeAllRegistrosIndexedDb() { registros = []; var request = db.transaction([constDbObject], "readwrite") .objectStore(constDbObject) .clear(); request.onsuccess = function(event) { fillTable(registros); drawGraficos(registros); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async index ( where = {} ) {\n const registers = await db[this.model].findAll({ where: { ...where } });\n if(!registers)\n throw Errors.NotFoundException('register not found')\n return registers\n }", "function cargaDatos(){\n\tdb.transaction(cargaRegistros, errorDB);\n}", "function ormarmesto() {\n document.getElementById(\"ourormar\").innerHTML = \"\" ; \n var request = window.indexedDB.open(dbName);\n request.onsuccess = function(event) {\n // Enumerate the entire object store.\n var db = klDB.indexedDB.db;\n var trans = db.transaction(\"nalogstore\", \"readonly\");\n var request = trans.objectStore(\"nalogstore\").openCursor();\n var a = document.createElement(\"a\");\n request.onsuccess = function(event) {\n var cursor = request.result || event.result;\n // If cursor is null then we've completed the enumeration.\n if (!cursor) {\n document.getElementById(\"ourormar\").appendChild(a);\n return;\n }\n\t\t\ta.textContent = cursor.value.interkey;\n\t\t\t a.addEventListener(\"click\", function() {\n klDB.indexedDB.izmeni(cursor.value.interkey);\n }, true);\n // some fun with jquery mobile data attributes\n a.setAttribute(\"href\", \"izmeni.html#outtabela\");\n a.setAttribute(\"data-iconpos\", \"notext\");\n a.setAttribute(\"data-role\", \"button\");\n a.setAttribute(\"data-icon\", \"save\"); \n a.setAttribute(\"data-inline\", \"true\");\n cursor.continue();\n }\n } \n }", "static addIndexedDb(type, items) {\n DBHelper.dbPromise().then(function(db) {\n let tx = db.transaction(type, 'readwrite');\n let store = tx.objectStore(type);\n items.forEach((item) => store.put(item));\n return tx.complete.then(() => Promise.resolve(items));\n });\n\n }", "function eFapsCreateAll() {\n deleteAll();\n createAll();\n\n print(\"############ Reload Cache\");\n reloadCache();\n\n Shell.transactionManager.begin();\n var context = new Context(Shell.transactionManager.getTransaction(), Packages.org.efaps.admin.user.Person.get(\"Administrator\"), null);\n Context.setThreadContext(context);\n Shell.setContext(context);\n _eFapsCreateAllImportDataModel();\n Shell.transactionManager.commit();\n context.close();\n\n print(\"############ Reload Cache\");\n reloadCache();\n\n Shell.transactionManager.begin();\n var context = new Context(Shell.transactionManager.getTransaction(), Packages.org.efaps.admin.user.Person.get(\"Administrator\"), null);\n Context.setThreadContext(context);\n Shell.setContext(context);\n _eFapsCreateAllImportUserInterface();\n Shell.transactionManager.commit();\n context.close();\n\n print(\"############ Reload Cache\");\n reloadCache();\n\n _eFapsCreateAllUpdatePassword();\n}", "function ConsultaItems(tx) {\n\t\ttx.executeSql('select id_empresa,nom_empresa from publicempresa order by nom_empresa', [], ConsultaItemsCarga,errorCB);\n}", "function regist()\n{\n\tthis.elementos= new Array();\n\tthis.validaciones = new Array();\n\tthis.urlRegExp = /get|[0-9]*/g;\n \tthis.primaryKeyRegExp = /[A-Za-z]*/g;\n}", "data2db() {\n\t\tlet tables = ['modules', 'terms']\n\t\treturn this.db.transaction('rw', this.db.tables, () => {\n\t\t\treturn Promise.all(tables.map(t => \n\t\t\t\tthis.db.table(t).clear().then(()=>\n\t\t\t\t\tthis.db.table(t).bulkAdd(this.data[t]))))\n\t\t})\n\t}", "constructor(param){ \n // homologamos variable principal de indexedDB\n // window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;\n // window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction;\n // window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange;\n\n this.db=param.db;\n\n if (!window.indexedDB) {\n console.log(\"Su navegador no soporta una versión estable de indexedDB. Tal y como las características no serán validas\");\n }else{\n this.request = indexedDB.open(param.db, 1, 'base de '+param.db, 2*1024 * 1024);\n\n this.request.onsuccess = (e)=>{\n this.link = this.request.result;\n japp.link = this.request.result;\n }\n\n this.request.onupgradeneeded = ()=>{\n this.link = this.request.result;\n const producto = this.link.createObjectStore('producto', {keyPath: 'codigo'});\n const venta = this.link.createObjectStore('venta', {keyPath: 'tiempo'});\n const categoria = this.link.createObjectStore('categoria', {keyPath: 'nombre'});\n const mesa = this.link.createObjectStore('mesa', {keyPath: 'mesa'});\n const histo = this.link.createObjectStore('histo', {keyPath: 'tiempo'});\n const config = this.link.createObjectStore('config', {keyPath: 'param'});\n this.link.createObjectStore('recetas', {keyPath: 'nombre'});\n\n const AC = this.link.createObjectStore('AC', {keyPath: 'codigo'});\n\n producto.onerror=(e)=>{\n console.log(e);\n }\n\n producto.onsuccess=(e)=>{\n console.log(e);\n \n }\n }\n\n this.request.onerror = (e)=>{\n console.log (\"No fue posible crear el acceso a la base de datos\");\n //console.log ( e.target.errorCode );\n };\n\n }\n\n }", "static async buscarNiveis(req, res) {\n try {\n const consultaNiveis = await //Enquanto executa\n niveisServices.buscarRegistros() /* Método Sequelize para busca de registros */\n\n /*Retorna a consulta do banco no formato JSON */\n return res.status(200).json(consultaNiveis)\n\n } catch (error) {\n\n /*Em caso de erro, retorna o cod. erro (500) e sua mensagem\n em formato JSON */\n return res.status(500).json(error.message)\n }\n }", "_onRestoreDB() {\n this.modulesCollection = this._db.getCollection(this.modulesCollectionName);\n if (!this.modulesCollection) {\n this.modulesCollection = this._db.addCollection(this.modulesCollectionName);\n this._dbInitialized = true;\n } else {\n\n const parseAndRegister = (m) => {\n if (typeof m === 'string') {\n m = JSON.parse(m);\n }\n return this.register(m);\n };\n\n Promise.all(this.modulesCollection.find().map(parseAndRegister))\n .then(() => {\n logger.debug(`Database loaded with, ${this.modulesCollection.count()} modules`);\n this._dbInitialized = true;\n });\n }\n }", "index(req, res) {\n RegistroEstudo.findAll()\n .then(function (registroEstudos) {\n res.status(200).json(registroEstudos);\n })\n .catch(function (error) {\n res.status(500).json(error);\n });\n }", "function majNiveaux() {\n // on ouvre la base, et on déclare les listeners\n var request = indexedDB.open(\"spacelash2\", 1);\n request.onerror = errorOpen;\n request.onupgradeneeded = createDatabase;\n\n request.onsuccess = function(event) {\n var db = event.target.result;\n\n // on ouvre une transaction qui permettra d'effectuer la suppression\n var transaction = db.transaction([\"niveaux\"], \"readwrite\");\n transaction.oncomplete = function(event) {};\n transaction.onerror = function(event) {\n window.alert('erreur de transaction suppression');\n };\n\n var niveauxStore = transaction.objectStore(\"niveaux\");\n var reqVider = niveauxStore.clear();\n reqVider.onsuccess = function(event) {\n }\n reqVider.onerror = function(event) {\n window.alert('erreur suppression');\n }\n\t\t\n\t\tvar majNiveaux=transaction.objectStore(\"niveaux\");\n\t\tfor (var i in parametrageNiveau) {\n majNiveaux.add(parametrageNiveau[i]); \n\t\t}\n\t\t\n\t\t\n }\n}", "function openDatabase() {\n return new Promise((resolve, reject) => {\n let openReq = indexedDB.open('Productos', 1); //OJO CON LA VERSIÓN!!!!\n openReq.addEventListener('upgradeneeded', e => { //No estamos en la versión.\n let db = e.target.result;\n if (!db.objectStoreNames.contains('productos')) { // No existe \"productos\"\n //Creamos el almacén de datos:\n db.createObjectStore('productos', { autoIncrement: true, keyPath: 'id' });\n }\n //resolve(db); //No hace falta ponerlo!!!\n });\n openReq.addEventListener('success', e => { // OK!\n resolve(e.target.result); // Devolvemos la base de datos.\n });\n openReq.addEventListener('error', e => reject('Error al abrir'));\n openReq.addEventListener('blocked', e => reject('BD ya en uso'));\n }); }", "function obtenerClientes() {\n\t\tconst conexion = window.indexedDB.open('crm', 1);\n\n\t\tconexion.onerror = () => console.log('Hubo un error');\n\n\t\tconexion.onsuccess = () => {\n\t\t\tDB = conexion.result;\n\n\t\t\tconst objectStore = DB.transaction('crm').objectStore('crm');\n\n\t\t\tobjectStore.openCursor().onsuccess = (e) => {\n\t\t\t\tconst cursor = e.target.result;\n\n\t\t\t\tif (cursor) {\n\t\t\t\t\tconst { nombre, empresa, email, telefono, id } = cursor.value;\n\n\t\t\t\t\tconst listado = document.querySelector('#listado-clientes');\n\n\t\t\t\t\tlistado.innerHTML += `\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"px-6 py-4 whitespace-no-wrap border-b border-gray-200\">\n\t\t\t\t\t\t\t\t<p class=\"text-sm leading-5 font-medium text-gray-700 text-lg font-bold\"> ${nombre} </p>\n\t\t\t\t\t\t\t\t<p class=\"text-sm leading-10 text-gray-700\"> ${email} </p>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"px-6 py-4 whitespace-no-wrap border-b border-gray-200 \">\n\t\t\t\t\t\t\t\t<p class=\"text-gray-700\">${telefono}</p>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"px-6 py-4 whitespace-no-wrap border-b border-gray-200 leading-5 text-gray-700\">\n\t\t\t\t\t\t\t\t<p class=\"text-gray-600\">${empresa}</p>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"px-6 py-4 whitespace-no-wrap border-b border-gray-200 text-sm leading-5\">\n\t\t\t\t\t\t\t\t<a href=\"editar-cliente.html?id=${id}\" class=\"text-teal-600 hover:text-teal-900 mr-5\">Editar</a>\n\t\t\t\t\t\t\t\t<a href=\"#\" data-cliente=\"${id}\" class=\"text-red-600 hover:text-red-900 eliminar\">Eliminar</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t`;\n\t\t\t\t\tcursor.continue();\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log('No hay más registros');\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t}", "async index(req, res){ // esse objeto [index] sera requisitado em rotas.\n const save = await Save.findAll(); // vai procurar todos os resultados para os parametros recebidos.\n return res.json(save); // vai responder o usuario user, em formato json.\n }", "function listar(ok,error){\n console.log(\"Funcionlistar DAO\")\n helper.query(sql,\"Maestro.SP_SEL_ENTIDAD_FINANCIERA\",[],ok,error)\n}", "function openDb() {\r\n\t\r\n\t\tconsole.log(\"openDb ...\");\r\n\t\t\r\n\t\tdb = window.indexedDB.open(DB_NAME, DB_VERSION);\r\n\t\tdb.onsuccess = function (evt) {\r\n\t\t\tdba = evt.target.result; \r\n\t\t\tconsole.log(\"openDb DONE\");\r\n\r\n\t\t};\r\n\t\t\r\n\t\tdb.onerror = function (evt) {\r\n\t\t\tconsole.log(\"openDb: \" + evt.target.errorCode);\r\n\t\t};\r\n\t\t\r\n\t\t\r\n\t\tdb.onupgradeneeded = function (evt) {\r\n\t\t\tconsole.log(\"openDb.onupgradeneeded\");\r\n\t\t\tdba = evt.target.result;\r\n\t\t\t\r\n\t\t\tvar itensObjectStore = dba.createObjectStore(\"itens\", {\r\n\t\t\t\tkeyPath: \"id\"\r\n\t\t\t}).createIndex(\"Nome\", \"nome\", {\r\n\t\t\t\tunique: false\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tvar bagObjectStore = dba.createObjectStore(\"bag\", {\r\n\t\t\t\tkeyPath: \"id\"\r\n\t\t\t})\r\n\t\t\t\r\n\t\t\tvar equipObjectStore = dba.createObjectStore(\"equip\", {\r\n\t\t\t\tkeyPath: \"id\"\r\n\t\t\t}).createIndex(\"Nome\", \"nome\", {\r\n\t\t\t\tunique: false\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t//console.log (itensObjectStore);\r\n\t\t\titensObjectStore.objectStore.transaction.oncomplete = function(event) {\r\n\t\t\t\r\n\t\t\t// Armazenando valores no novo objectStore.\t\r\n\t\t\t\r\n\t\t\tcreateGItens();\t\r\n\t\t\t};\r\n\t\t}\r\n\t\r\n\t\tdb.onblocked = function(e){\r\n\t\t\tconsole.log(e)\r\n\t\t}\r\n\r\n\t}", "function checkDatabase() {\n const transaction = db.transaction([\"pending\"], \"readwrite\");\n const store = transaction.objectStore(\"pending\");\n const getAll = store.getAll();\n\n getAll.onsuccess = function () {\n if (getAll.result.length > 0) {\n fetch(\"/api/transaction/bulk\", {\n method: \"POST\",\n body: JSON.stringify(getAll.result),\n headers: {\n Accept: \"application/json, text/plain, */*\",\n \"Content-Type\": \"application/json\" \n }\n })\n .then(response => response.json())\n .then(() => {\n // Deletes records in the indexdb if successful \n const transaction = db.transaction([\"pending\"], \"readwrite\");\n const store = transaction.objectStore(\"pending\");\n store.clear();\n });\n }\n };\n}", "function listaLivros() {\n // antes de listar de novo os livros, apagar a tabela exibida...\n limpaTabelaLivros();\n\n // abrir a base de dados e navegar pelos livros um a um...\n var transaction = dbLivros.transaction([\"eLivros\"], \"readwrite\");\n var objectStore = transaction.objectStore('eLivros');\n var dbCursor = objectStore.openCursor();\n dbCursor.onerror = function (event) {\n msgErro(\"Não foi possível obter dados da Base de Dados de Livros\");\n };\n\n dbCursor.onsuccess = function (event) {\n var cursor = event.target.result;\n // fazer algo se ainda tivermos cursor...\n if (cursor) {\n // mostra este elemento na tabela...\n acrescentaLivroTabela(cursor.value);\n // ...e avança para o próximo \n cursor.continue();\n }\n\n };\n}", "function getAllIndexedDB(objectStore, callback) {\r\n let openDB = openIndexedDB();\r\n\r\n openDB.onsuccess = function() {\r\n let db = getStoreIndexedDB(openDB, objectStore);\r\n let items = [];\r\n\r\n db.store.openCursor().onsuccess = function(event) {\r\n let cursor = event.target.result;\r\n\r\n if (cursor) {\r\n items.push(cursor.value);\r\n cursor.continue();\r\n } else {\r\n console.log(\"Retrieved all items from \" + objectStore + \" object store\");\r\n try { callback(items); } catch { callback(); }\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n}", "openConection() {\n if (window.indexedDB) {\n var req = window.indexedDB.open(\"Database\", 1);\n var db;\n req.onupgradeneeded = function(e) {\n var db = e.target.result;\n var store = db.createObjectStore(\"Formular\", { keyPath: \"name\" });\n var store2 = db.createObjectStore(\"Versions\", { keyPath: \"name\" });\n };\n req.onsuccess = function(e) {\n db = e.target.result;\n };\n req.onerror = function(e) {\n console.log(\"Error\" + e);\n };\n }\n }", "function eliminar(){\n\tvar indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // segons el navegador\n\tidb.close();//tanquem la versio que estem utilitzant per evitar bloquejos.\n\tvar openRequest = indexedDB.deleteDatabase(\"DBLibros\",version-1);//versio que es vol elimanr, com em aumentat la variable al crear la base de dades, ara per borrarla es posa version-1\n\topenRequest.onsuccess=function (e){\n\t\tconsole.log(\"Base de datos borrada\");\n\t\tdocument.getElementById(\"DataBase\").innerHTML=\"\";\n\t\tdocument.getElementById(\"content\").style.display=\"none\";\n\t\tdocument.getElementById(\"buttons\").innerHTML=\"<input id=\\\"buttonCrearBD\\\" type=\\\"button\\\" value=\\\"CrearBD\\\" onClick=\\\"abrirIndexDB()\\\">\";\n\t};\n\n\topenRequest.onerror = function () {\n\t\tconsole.log(\"Couldn't delete database\");\n\t};\n\topenRequest.onblocked = function () { //Has d'anar amb molt de compte per que no es bloqueji la base de dades.\n\t\tconsole.log(\"Couldn't delete database due to the operation being blocked\");\n\t};\n}", "function refreshIndex(_index){\n\talgolia.deleteByQuery(\"\", function(err) {\n\t\tif (!err) {\n\t\t\tconsole.log('success deleting all');\n\t\t}\n\t\talgolia.saveObjects(_index, function(err, content) {\n\t\t\tif (!err) {\n\t\t\t\tconsole.log('success indexing all');\n\t\t\t}\n\t\t\tconsole.log(content);\n\t\t});\n\t});\n}", "static openIDB() {\r\n if (!('indexedDB' in window)) {\r\n console.log('This browser does not support IndexedDB');\r\n return;\r\n }\r\n\r\n return idb.open('mws-restaurant-db', 1, upgradeDB => {\r\n upgradeDB.createObjectStore('restaurants', {keyPath: 'id'});\r\n });\r\n }", "static getAll() {\r\n return new Promise((next) => {\r\n db.query('SELECT id, nom FROM outil ORDER BY nom')\r\n .then((result) => next(result))\r\n .catch((err) => next(err))\r\n })\r\n }", "function listarRecursos(callback){\n\tFarola.find({}, null, callback);\n}", "constructor ( nombre, apellido, direccion, edad, telefono, correo ){\n this.db = [];\n this.nombre = nombre;\n this.apellido = apellido;\n this.direccion = direccion;\n this.edad = edad;\n this.telefono = telefono;\n this.correo = correo;\n }", "function init(){\n db = bernApp.Database.open();\n return _createTables();\n }", "function alterarCadastro()\r\n{\r\n\t//checa de o browser consegue trabalhar com indexeDB\r\n\tif(!indexedDB)\r\n\t{\r\n\t\tconsole.log(\"Seu navegador não suporta indexedDB.\");\r\n\t\treturn;\t\t\r\n\t}\r\n\r\n\t//abre o pseudo banco (ou cria, caso não exista)\r\n\tlet request=indexedDB.open(\"usersDB\",2);\r\n\r\n\t//se IndexedDB der erro\r\n\trequest.onerror = (event) => {alert(\"Erro ao utilizar IndexedDB.\");};\r\n\r\n\t//cria o schema do banco\r\n\trequest.onupgradeneeded = (event) => \r\n\t{ \r\n\t\tlet db=request.result;\r\n\t\tlet store=db.createObjectStore(\"users\", {keyPath: \"email\"});\r\n\t};\r\n\t\r\n\t//realiza os operacoes no pseudobanco \r\n\trequest.onsuccess = (event) => \r\n\t{\r\n\t\tlet db=request.result;\r\n\t\tlet tx=db.transaction(\"users\", \"readwrite\");\r\n\t\tlet store=tx.objectStore(\"users\");\t\r\n\t\t\r\n\t\t//se browser suporta storage\r\n\t\tif (typeof(Storage) !== \"undefined\") \r\n\t\t{\r\n\t\t\tlet atualiza = store.openCursor();\t\t\t\t\t//abre cursor para atualizar\r\n\t\t\tatualiza.onsuccess = (event) => \r\n\t\t\t{\r\n\t\t\t\tlet cursor = event.target.result;\r\n\t\t\t\tif(cursor) {\r\n\t\t\t\t\tif(cursor.value.email == logado) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tlet dados = cursor.value;\t\t\t\t//recupera dados no banco\r\n\t\t\t\t\t\t//console.log(dados);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tlet nome=document.getElementById(\"nome\").value;\r\n\t\t\t\t\t\tlet email=document.getElementById(\"email\").value;\r\n\t\t\t\t\t\tlet telefone=document.getElementById(\"telefone\").value;\r\n\t\t\t\t\t\tlet endereco=document.getElementById(\"endereco\").value;\r\n\t\t\t\t\t\tlet cidade=document.getElementById(\"cidade\").value;\r\n\t\t\t\t\t\tlet estado=document.getElementById(\"estado\").value;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//se alguma dos inputs estiverem vazios, nao alterar nada no banco\r\n\t\t\t\t\t\tif(nome!==\"\")\r\n\t\t\t\t\t\t\tdados.nome = nome;\r\n\t\t\t\t\t\t//if(email!==\"\") \r\n\t\t\t\t\t\t//{\r\n\t\t\t\t\t\t\t//dados.email = email;\r\n\t\t\t\t\t\t\t//localStorage.setItem(\"atualLogado\", email); //troca email logado tb\r\n\t\t\t\t\t\t//}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(telefone!==\"\")\r\n\t\t\t\t\t\t\tdados.telefone = telefone;\r\n\t\t\t\t\t\tif(endereco!==\"\")\r\n\t\t\t\t\t\t\tdados.endereco = endereco;\r\n\t\t\t\t\t\tif(cidade!==\"\")\r\n\t\t\t\t\t\t\tdados.cidade = cidade;\r\n\t\t\t\t\t\tif(estado!==\"\")\r\n\t\t\t\t\t\t\tdados.estado = estado;\r\n\t\t\t\t\t\tif(nome==\"\" && (email==\"\" || email == logado) && telefone==\"\" && endereco==\"\" && cidade==\"\" && estado==\"\") \r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\talert(\"Pelo menos um dos campos devem ser preechidos\");\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\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//atualiza banco\r\n\t\t\t\t\t\tconsole.log(\"Novo nome: \"+dados.nome);\r\n\t\t\t\t\t\tlet atualizaBD = cursor.update(dados);\r\n\t\t\t\t\t\tatualizaBD.onsuccess = () => {alert(\"Os dados foram atualizados com sucesso\" + dados.nome);};\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tatualizaBD.onerror = () => {alert(\"Não foi possível atualizar o Banco de Dados\");};\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//nao encontrou ninguem com o email logado, no banco\r\n\t\t\t\t\telse {alert(\"Não foi possível encontrar o usuário do email \"+logado);}\r\n\t\t\t\t}\r\n\t\t\t\t//nao conseguiu reabrir o banco para o update\r\n\t\t\t\telse {alert(\"Não foi possível reabrir o banco;\");}\t\r\n\t\t\t\tcursor.continue();\r\n\t\t\t};\t\t\t\r\n\t\t}\r\n\t\telse {alert(\"Seu navegador não suporte Local Storage\");}\r\n\r\n\t\t//encerra banco\r\n\t\ttx.oncomplete = () => {db.close();}\t\r\n\t};\r\n}", "function loadIndexes() {\n // Get search indexes.\n dataService.fetch('get', '/api/admin/indexes').then(\n function (data) {\n $scope.activeIndexes = data;\n // Get mappings configuration.\n dataService.fetch('get', '/api/admin/mappings').then(\n function (mappings) {\n // Reset the scopes variables for mappings.\n $scope.activeMappings = {};\n $scope.inActiveMappings = {};\n\n // Filter out active indexes.\n for (var index in mappings) {\n if (!$scope.activeIndexes.hasOwnProperty(index)) {\n $scope.inActiveMappings[index] = mappings[index];\n }\n else {\n $scope.activeMappings[index] = mappings[index];\n }\n }\n },\n function (reason) {\n $scope.message = reason.message;\n $scope.messageClass = 'alert-danger';\n }\n );\n },\n function (reason) {\n $scope.message = reason.message;\n $scope.messageClass = 'alert-danger';\n }\n );\n }", "function createRegistry(){\n // Create new instance of Todo\n var instance = new Report({\n country: \"país\",\n city: \"ciudad\",\n address: \"dirección\",\n photo: \"Foto\",\n done: true\n });\n \n // Persist the object to StackMob\n instance.create({\n success: function(model, result, options) { \n // console.debug(model.toJSON()); \n document.getElementById(\"statusSave\").innerHTML = \"OK\"; },\n error: function(model, error, options) {\n console.debug(error.error); \n document.getElementById(\"statusSave\").innerHTML = error.error; }\n });\n}", "function RegistryDatabase(db) {\n this.db = db;\n}", "connection() {\n console.log('Estableciendo coneccion...');\n SQLite.openDatabase({ name: NAME_DB, location: LOCATION }, (db) => { \n console.log( 'Success: ', db );\n db.transaction((tx)=>{\n tx.executeSql(SQL_CREATE_TODO, [], (tx, results) =>{\n console.log('create db results' + results);\n this.getAllItems();\n })\n })\n }, (error) => {\n console.log( 'Error: ', success );\n } )\n }", "static async findAllActive(req, res){\n try {\n const pessoas = await pessoasServices.findActiveRegisters();\n return res.status(200).send(pessoas);\n } catch (error) {\n return res.status(500).json(error.message);\n }\n \n }", "function listAll(res){\n factoryStore.list(function(err, factories) {\n if (err) throw err;\n res.json(factories);\n });\n}", "async SyncDB() { // Sincroniza com as tabelas, colunas e todos os elementos do Banco de Dados\n await mysql.sync();\n }", "async index() {\n const { ctx, service } = this;\n const res = await service.user.crud({\n type: 'readAll',\n });\n console.log('res_user_index-------', res);\n ctx.body = res;\n }", "function listaModelos(){\n return new Promise((resolve,reject) => {\n let qry = `\n select \n usuarioCadastro, tbinfoveiculo.id, nomemodelo, tbmontadoras.nome, anofabricacao, cores, tipochassi, suspensaodianteira, suspensaotraseira, pneusdianteiro, pneutraseiro, freiodianteiro, freiotraseiro, tipodofreio,\n qtdcilindros, diametro, curso, cilindrada, potenciamaxima, torquemaximo, sistemadepartida, tipodealimentacao, combustivel, sistemadetransmissao, cambio, bateria, \n taxadecompessao, comprimento, largura, altura, distanciaentreeixos, distanciadosolo, alturadoassento, tanquedecombustivel, peso, arqFoto\n from tbInfoVeiculo inner join tbmontadoras on tbinfoveiculo.idmontadora = tbmontadoras.id\n `\n db.all(qry, (err,data) => {\n if(err) {\n reject(err);\n }\n resolve(data);\n })\n })\n}", "function getTypesComplains(req, res) {\n var connection = dbConnection();\n connection.query(\"SELECT * FROM tipo_queja\", function(err, result, fields) {\n if (err) return res.status(500).send({ message: `Error al realizar la consulta : ${err}` });\n if (result == \"\") return res.status(404).send({ message: `No hay quejas guardadas` });\n res.status(200).send({ message: result });\n connection.destroy();\n });\n}", "function qtdRegistro(){\n\tfirebase.database().ref('/registro/').once('value').then(function(snapshot){\n\t\tvar PostObject = snapshot.val();\n\t\tvar keys = Object.keys(PostObject);\n\t\tqtdListaReg = keys.length;\n\t\t\n\t});\n\t\n}", "connect() {\r\n return new Promise((res, rej) => {\r\n const request = indexedDB.open(\"toDoAppDatabase\", 1)\r\n request.onupgradeneeded = e => {\r\n console.log(\"Creating a new version of database...\");\r\n\r\n let db = request.result\r\n if (!db.objectStoreNames.contains(\"groups\")) {\r\n db.createObjectStore(\"groups\", { keyPath: 'id', autoIncrement: true });\r\n }\r\n if (!db.objectStoreNames.contains(\"notes\")) {\r\n db.createObjectStore(\"notes\", { keyPath: 'id', autoIncrement: true });\r\n\r\n }\r\n\r\n }\r\n\r\n\r\n request.onsuccess = e => {\r\n // console.log(\"We successfully connected to the database.\");\r\n res(request.result)\r\n }\r\n\r\n request.onerror = e => {\r\n rej(request.error)\r\n }\r\n\r\n request.onerror = e => {\r\n console.log(\"Storage is blocked\");\r\n }\r\n });\r\n }", "connect() {\r\n return new Promise((res, rej) => {\r\n const request = indexedDB.open(\"toDoAppDatabase\", 1)\r\n request.onupgradeneeded = e => {\r\n console.log(\"Creating a new version of database...\");\r\n\r\n let db = request.result\r\n if (!db.objectStoreNames.contains(\"groups\")) {\r\n db.createObjectStore(\"groups\", { keyPath: 'id', autoIncrement: true });\r\n }\r\n if (!db.objectStoreNames.contains(\"notes\")) {\r\n db.createObjectStore(\"notes\", { keyPath: 'id', autoIncrement: true });\r\n }\r\n\r\n }\r\n\r\n\r\n request.onsuccess = e => {\r\n // console.log(\"We successfully connected to the database.\");\r\n res(request.result)\r\n }\r\n\r\n request.onerror = e => {\r\n rej(request.error)\r\n }\r\n\r\n request.onerror = e => {\r\n console.log(\"Storage is blocked\");\r\n }\r\n });\r\n }", "function findKeys() {\n if (!precheck()) { return }\n var request = window.indexedDB.open(\"WebCA\", dbVersion);\n request.onerror = cb_errorDB;\n request.onupgradeneeded = cb_prepareDB;\n request.onsuccess = cb_findKeys;\n}", "function getAllRegistrants() { // retrieve only\n ajaxHelper(registrantsUri, 'GET', self.error).done(function (data) {\n self.registrants(data);\n });\n }", "function getEntries() {\r\n db.transaction(queryDB,dbErrorHandler);\r\n}", "static saveRestaurantsIntoIDB(restaurants) {\r\n // const dbPromise = DBHelper.openIDB();\r\n return DBHelper.openIDB().then((db) => {\r\n if(!db) return;\r\n const tx = db.transaction('restaurants', 'readwrite')\r\n const store = tx.objectStore('restaurants');\r\n restaurants.forEach((restaurant) => {\r\n store.put(restaurant);\r\n });\r\n return tx.complete;\r\n });\r\n }", "function getEntries() {\n\n //\talert(\"getEntries\");\n dbShell.transaction(function (tx) {\n tx.executeSql(\"CREATE TABLE IF NOT EXISTS autos (id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT NOT NULL, Poliza TEXT NOT NULL, Inciso TEXT NOT NULL, Asegurado TEXT NOT NULL)\");\n tx.executeSql(\"SELECT * FROM autos\", [], renderEntries, dbErrorHandler);\n }, dbErrorHandler);\n}", "function register_event_handlers()\r\n {\r\n /* priemra pantalla: inicio */\r\n $(document).on(\"click\", \"#inicio\", function(evt)\r\n {\r\n\t\tactivate_subpage(\"#page_100_31\");\r\n });\r\n \r\n \r\n /* button #mainButton */\r\n $(document).on(\"click\", \"#mainButton\", function(evt)\r\n { \r\n uib_sb.toggle_sidebar($(\".uib_w_7\")); \r\n });\r\n \r\n\r\n /* button #gohome */\r\n $(document).on(\"click\", \"#gohome\", function(evt)\r\n {\r\n activate_subpage(\"#page_100_31\"); \r\n });\r\n \r\n \r\n /* button #buttadd */\r\n $(document).on(\"click\", \"#buttadd\", function(evt)\r\n {\r\n insert();\r\n });\r\n \r\n \r\n ///////comprobar que podemos ejecutar HTML5\r\n function getopenDb() { \r\n try {\r\n if (window.openDatabase) { \r\n return window.openDatabase; \r\n } else {\r\n window.alert('Creo que el problema es un navegador raro: No HTML5 support');\r\n return undefined;\r\n }\r\n }\r\n catch (e) {\r\n window.alert(e);\r\n return undefined;\r\n } \r\n}//fin comprobar\r\n \r\n \r\n ////\r\n\tvar db = createTable();\r\n\tvar db_entidad = tabla_entidades();\r\n //createTable();\r\n /////crearla\r\n function createTable() {\r\n\t\tvar res = document.getElementById(\"main\");\r\n\t\tres.innerHTML = '<div>entrando en la funcion</div>';\r\n var openDB = JSON.parse(localStorage.getItem('conrestapi'));\r\n\t\tif(!openDB){ \r\n\t\t\twindow.alert('creando db');\r\n\t\t\tvar rootURL = 'http://agenda.happyroadgirl.com/';\t\r\n\t\t\tres.innerHTML = '<div>Conectando para sincronizar con ' + rootURL + '</div>';\r\n\t\t\t\r\n\t\t\t\t\t$.ajax({\r\n\t\t\t\t\ttype: 'GET',\r\n\t\t\t\t\turl: rootURL + '/wp-json/wp/v2/contacto',\r\n\t\t\t\t\tdataType: 'json',\r\n\t\t\t\t\tsuccess: function(data){\r\n\t\t\t\t\t\t$.each(data, function(index, value) {\r\n\t\t\t\t\t\t\t\topenDB = JSON.parse(localStorage.getItem('conrestapi')) || [];\r\n\t\t\t\t\t\t\t\topenDB.push(new Contact({ \"nombre\": data[index].nombre, \"apellidos\": data[index].apellidos, \"cargo\": data[index].cargo, \"entidad\": data[index].entidad.nombre, \"telf\": data[index].telf, \"email\": \"[email protected]\", \"city\": \"London\",\"picguid\" :data[index].imagen.post_title }));\r\n\t\t\t\t\t\t\t\tlocalStorage.setItem('conrestapi', JSON.stringify(openDB));\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t});//each\r\n }//success\r\n\t\t\t\t\t}); //fin de conexion \r\n\t\t}else{window.alert('db estaba creada');} \r\n\r\n\t\tselRows();\r\n}\r\n \r\n /////actualizarla\r\n function update(id_ext,nombre,apellidos,telf) {\r\n if(!db)\r\n { \r\n window.alert('no hay db al actualizar');\r\n return; \r\n }\r\n}//fin actualizar\r\n \r\n \r\n /////rellenarla\r\n function insert() {\r\n}\r\n\r\n /////seleccionar\r\n function selRows() {\r\n var el = document.getElementById(\"main\");\r\n el.innerHTML = \"<h3>Listado Completo</h3>\";\r\n var f7Contacts = localStorage.getItem(\"conrestapi\");\r\n\t\tvar data = JSON.parse(f7Contacts); // ? JSON.parse(f7Contacts) : tempInitializeStorage();\r\n\t\t\r\n\t\tvar parcial_card = '';\r\n\t\tvar select_cargos = '';\r\n\t\tvar div_indice ='';\r\n\t\t\r\n\t\t$.each(data, function(i, item) {\r\n\t\t\t\r\n parcial_card += '<div class=\"panel\" title=\"picguid'+i+'\" id=\"item' + data[i].id + '\" data-footer=\"none\">';\r\n\t\t\tif(data[i].picguid)parcial_card += '<div class=\"item-media\" style=\"float:left\"><img src=\"images/'+data[i].picguid+'.png\" width=\"103\"></div>';\r\n\t\t\tparcial_card += '<p>' +data[i].nombre + ' ' +data[i].apellidos + '<br>';\r\n\t\t\tif(data[i].entidad)parcial_card += data[i].entidad;\r\n\t\t\tif(data[i].cargo)parcial_card += ': ' +data[i].cargo;\r\n\t\t\tparcial_card += '<br><a href=\"tel:' +data[i].telf+ '\">' +data[i].telf+ '</a><br><a href=\"mailto:' +data[i].email1+ '\">' +data[i].email1+ '</a></p></div>';\r\n\t\t\t//window.alert(data[i].entidad.nombre);\r\n\t\t\tselect_cargos += '<option value=\"'+data[i].cargo+'\">'+data[i].cargo+'</option>';\r\n\t\t\t\r\n\t\t});\r\n\t\t\r\n\t\tmuestra_lista(data);\r\n\t\t$( parcial_card ).insertAfter( \"#item1007\" );\r\n\t\t//window.alert('relleno select de cargos');\r\n\t\t$('#sel_cargos').html(select_cargos);\r\n}//fin seleccionar\r\n\t \r\n\t///////////////////////ahora las entidades\r\n\t/////crearla\r\n function tabla_entidades() {\r\n\t\tvar res = document.getElementById(\"main\");\r\n\t\tres.innerHTML = '<div>entrando en la funcion de entidades</div>';\r\n var openDB = JSON.parse(localStorage.getItem('entidades'));\r\n\t\tif(!openDB){ \r\n\t\t\twindow.alert('creando db entidades');\r\n\t\t\tvar rootURL = 'http://agenda.happyroadgirl.com/';\t\r\n\t\t\tres.innerHTML = '<div>Conectando para rellenar desde ' + rootURL + '</div>';\r\n\t\t\t\r\n\t\t\t\t\t$.ajax({\r\n\t\t\t\t\ttype: 'GET',\r\n\t\t\t\t\turl: rootURL + '/wp-json/wp/v2/entidad',\r\n\t\t\t\t\tdataType: 'json',\r\n\t\t\t\t\tsuccess: function(data){\r\n\t\t\t\t\t\t$.each(data, function(index, value) {\r\n\t\t\t\t\t\t\t\topenDB = JSON.parse(localStorage.getItem('entidades')) || [];\r\n\t\t\t\t\t\t\t\topenDB.push(new Entidad({ \"nombre\": data[index].nombre, \"direccion\": data[index].direccion }));\r\n\t\t\t\t\t\t\t\tlocalStorage.setItem('entidades', JSON.stringify(openDB));\r\n\t\t\t\t\t\t\t});//each\r\n }//success\r\n\t\t\t\t\t}); //fin de conexion \r\n\t\t}else{window.alert('db entidades estaba creada');} \r\n\r\n\t\tfill_indice();\r\n}\r\n\t \r\n\t \r\n\tfunction fill_indice(){\r\n\t\tvar tabla_entidades = localStorage.getItem(\"entidades\");\r\n\t\tvar data = JSON.parse(tabla_entidades); // ? JSON.parse(f7Contacts) : tempInitializeStorage();\r\n\t\r\n\t\tvar div_indice ='';\r\n\t\t\r\n\t\t$.each(data, function(i, item) {\r\n\t\t\tdiv_indice += '<a class=\"button widget uib_w_27 but_indice\" data-uib=\"app_framework/button\" data-ver=\"1\" style=\"border-top-right-radius: 0px; border-top-left-radius: 0px; border-bottom-right-radius: 6px; border-bottom-left-radius: 6px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(102, 102, 102);\">'+data[i].nombre + '</a>';\r\n\t\t\t\r\n\t\t});\r\n\t\t\r\n\t\t$( div_indice ).insertAfter( \"#div_indice\" );\r\n\t\t//window.alert();\r\n\r\n\t}//fin fill_indice\r\n\r\n\t/////muestra_lista\r\n function muestra_lista(data) {\r\n\t\tvar parcial = '<ul class=\"list\">';\r\n\t\t$.each(data, function(i, item) {\r\n parcial += '<li><a href=\"#item' + data[i].id + '\">';\r\n\t\t\tif(data[i].picguid)parcial += '<div class=\"item-media\" style=\"float:left\"><img src=\"images/'+ data[i].picguid +'.png\" width=\"44\"></div>';\r\n\t\t\tparcial += '<p>' + data[i].nombre + ' ' + data[i].apellidos + '</p>';\r\n\t\t\tparcial +='</a><br>';\r\n\t\t\tif(data[i].cargo)parcial += data[i].cargo;\r\n\t\t\t//parcial += '<a href=\"tel:' +data[i].telf+ '\">' +data[i].telf+ '</a>';\r\n\t\t\tparcial += '</li>';\r\n\t\t});\r\n\t\tparcial += '</ul>';\r\n\t\t$('#lista').html(parcial);\r\n}//fin muestra_lista\r\n\t \r\n\t \r\n /////buscar\r\n function searchRows(param,search_param) { \r\n\t\tvar re = document.getElementById(\"main\");\r\n re.innerHTML = \"<h3>Buscando \" + search_param + \"</h3>\";\r\n\t\tvar f7Contacts = localStorage.getItem(\"conrestapi\");\r\n\t\tvar data = JSON.parse(f7Contacts); \r\n\t\tvar as=$(data).filter(function (i,n){\r\n\t\t\tswitch(param) {\r\n\t\t\t\tcase 'entidad':\r\n\t\t\t\t\tif(n.entidad){return n.entidad.indexOf(search_param)>=0;}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'cargo':\r\n\t\t\t\t\treturn n.cargo.indexOf(search_param)>=0;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\treturn n.nombre.indexOf(search_param)>=0;\r\n\t\t\t}\r\n\t\t});\r\n\t\tmuestra_lista(as);\r\n}//fin buscar\r\n \r\n\r\n ///modelo objeto de contact\r\n\tfunction Contact(values) {\r\n\t\tvalues = values || {};\r\n\t\tthis.id = values.id || generateGUID();\r\n\t\tthis.picguid = values.picguid;\r\n\t\tthis.createdOn = values.createdOn || new Date();\r\n\r\n\t\tthis.nombre = values.nombre || '';\r\n\t\tthis.apellidos = values.apellidos || '';\r\n\t\tthis.cargo = values.cargo || '';\r\n\t\tthis.entidad = values.entidad || '';\r\n\t\tthis.telf = values.telf || '';\r\n\t\tthis.email1 = values.email1 || '';\r\n\t\tthis.city = values.city || '';\r\n\t\tthis.isFavorite = values.isFavorite || false;\r\n }//fin objeto contact\r\n\t \r\n\t///modelo objeto de entidad\r\n\tfunction Entidad(values) {\r\n\t\tvalues = values || {};\r\n\t\tthis.id = values.id || generateGUID();\r\n\t\tthis.createdOn = values.createdOn || new Date();\r\n\r\n\t\tthis.nombre = values.nombre || '';\r\n\t\tthis.direccion = values.direccion || '';\r\n\t\tthis.telf = values.telf || '';\r\n\t\tthis.email1 = values.email1 || '';\r\n\t\tthis.ciudad = values.ciudad || '';\r\n\t\tthis.isFavorite = values.isFavorite || false;\r\n }//fin objeto entidad\r\n\t \r\n\t\r\n\t//////////generar iud\r\n\tfunction generateGUID(){\r\n\t\tvar d = new Date().getTime();\r\n\t\tvar uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\r\n\t\t\tvar r = (d + Math.random()*16)%16 | 0;\r\n\t\t\td = Math.floor(d/16);\r\n\t\t\treturn (c=='x' ? r : (r&0x7|0x8)).toString(16);\r\n\t\t});\r\n\t\treturn uuid;\r\n\t}//Fin uid\r\n\t\r\n ///////final\r\n \r\n /* button #buscar */\r\n $(document).on(\"click\", \"#buscar\", function(evt)\r\n {\r\n var search_param = document.getElementById(\"param_buscar\").value;\r\n searchRows('nombre',search_param);\r\n });\r\n\t \r\n\t/* button .but_indice */\r\n $(document).on(\"click\", \".but_indice\", function(evt)\r\n {\r\n var search_param = $(this).text();//document.getElementById(\"param_buscar\").value;\r\n\t\t//window.alert($(this).text());\r\n searchRows('entidad',search_param);\r\n\t\tuib_sb.toggle_sidebar($(\".uib_w_7\"));\r\n });\r\n\t \r\n\t/* select de cargos */\r\n\t$(\"#sel_cargos\").change(function(){\r\n\t\t\tsearchRows('cargo',$(this).val());\r\n\t});\r\n \r\n /* button #butsync */\r\n $(document).on(\"click\", \"#butsync\", function(evt)\r\n {\r\n // alert('conectando...');\r\n var res = document.getElementById(\"main\");\r\n var rootURL = 'http://agenda.happyroadgirl.com/';\t\r\n res.innerHTML = '<div>Conectando para sincronizar con ' + rootURL + '</div>';\r\n\tvar nuevoarray = [];\r\n\t\r\n $.ajax({\r\n\ttype: 'GET',\r\n\turl: rootURL + '/wp-json/wp/v2/contacto',\r\n\tdataType: 'json',\r\n\tsuccess: function(data){\r\n $.each(data, function(index, value) {\r\n window.alert('colocando datos en su sitio 8 -> ' + data[index].imagen.post_title);\r\n //update(data[index].id,data[index].nombre,data[index].apellidos,data[index].telf);\r\n\t\t\t\tnuevoarray = JSON.parse(localStorage.getItem('conrestapi')) || [];\r\n\t\t\t\tnuevoarray.push(new Contact({ \"nombre\": data[index].nombre, \"apellidos\": data[index].apellidos, \"cargo\": data[index].cargo, \"telf\": data[index].telf, \"email\": \"[email protected]\", \"city\": \"London\",\"picguid\" :data[index].imagen.post_title }));\r\n\t\t\t\tlocalStorage.setItem('conrestapi', JSON.stringify(nuevoarray));\r\n });//each\r\n }//success\r\n }); //fin de conexion \r\n\t//return JSON.parse(localStorage.getItem(\"conrestapi\"));\r\n selRows();\r\n }); //fin de butsync\r\n \r\n \r\n /* button #gotopage2 */\r\n \r\n \r\n \r\n /* button #goto_add */\r\n $(document).on(\"click\", \"#goto_add\", function(evt)\r\n {\r\n activate_subpage(\"#page_to_add\"); \r\n });\r\n \r\n \r\n /* button #gotopage2 */\r\n $(document).on(\"click\", \"#gotopage2\", function(evt)\r\n {\r\n activate_subpage(\"#page2\"); \r\n });\r\n \r\n }", "function storeDB() {\n localStorage.setItem(KEY_BD, JSON.stringify(registerList));\n}", "function findResc(){\n return db.into('resources');\n}", "initDB(tables) {\n let self = this;\n return new Promise(function (resolve, reject) {\n let req = self.indexDbApi.open(self.dbName, self.dbV);\n let db;\n let tableNames = Object.keys(tables);\n let tableIndexes = Object.values(tables);\n\n req.onerror = function (e) {\n console.log('DB init Error');\n reject(e);\n };\n req.onsuccess = function (e) {\n db = e.target.result;\n console.log('DB init Success');\n setTimeout(function () {\n resolve(db);\n }, 100);\n };\n req.onupgradeneeded = function (e) {\n db = e.target.result;\n let store;\n for (let i = 0; i < tableNames.length; i++) {\n if (!db.objectStoreNames.contains(tableNames[i])) {\n store = db.createObjectStore(tableNames[i], {keyPath: self.keyPath, autoIncrement: false});\n console.log('TABLE ' + tableNames[i] + ' created Success');\n }\n for (let j = 0; j < tableIndexes[i].length; j++) {\n store.createIndex(tableIndexes[i][j][0], tableIndexes[i][j][0], {unique: tableIndexes[i][j][1]});\n }\n }\n console.log(\"onupgradeneeded\");\n };\n });\n\n }", "function initDB() {\n\t /* to remove database, use window.indexedDB.deleteDatabase('_webauthn'); */\n\t\t\t\treturn new Promise(function(resolve,reject) {\n\t\t\t\t\tvar req = indexedDB.open(WEBAUTHN_DB_NAME,WEBAUTHN_DB_VERSION);\n\t\t\t\t\t// wird auf das Request Objekt das upgradeneeded Event gefeuert gibt man hier an was gemacht werden soll\n\t\t\t\t\treq.onupgradeneeded = function() {\n\t\t\t\t\t\t// new database - set up store\n\t\t\t\t\t\tdb = req.result; // this.result oder hier req.result ist die eigentliche DB\n\t\t\t\t\t\t\n\t\t\t\t\t\t/* Es wird ein ObjectStore (~eine Tabelle) in der DB angelegt. Die Einträge werden mit einer ID versehen */\n\t\t\t\t\t\tvar store = db.createObjectStore(WEBAUTHN_ID_TABLE, { keyPath: \"id\"});\n\t\t\t\t\t};\n\t\t\t\t\treq.onsuccess = function() {\n\t\t\t\t\t\tdb = req.result;// db der Variable db zugewiesen\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t};\n\t\t\t\t\treq.onerror = function(e) {\n\t\t\t\t\t\treject(e);\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t}", "getMyGenresFromIndex() {\n\t\tvar query = `\n\t\tSELECT * FROM genres\n\t\t\tLEFT JOIN json USING (json_id)\n\t\t\tWHERE directory=\"data/users/${userAuthAddress}\"\n\t\t\tORDER BY date_added ASC\n\t\t`;\n\t\n\t\treturn this.cmdp(\"dbQuery\", [query]);\n\t}", "function _index(req, res) {\n var registryList = _getRegistryList(req.user);\n\n _respond(req, res, \"index\", {\n user: registry_utils.formatUserId.call({user: req.user}),\n registry: registryList,\n repositoryBaseURL: config.repositoryBaseURL,\n helpURL: config.helpURL\n });\n}", "function deleteAllRecords() {\n // on ouvre la base, et on déclare les listeners\n var request = window.webkitIndexedDB.open(\"BDFlux\", 1);\n request.onerror = errorOpen;\n request.onupgradeneeded = createDatabase;\n\n request.onsuccess = function(event) {\n var db = event.target.result;\n\n // on ouvre une transaction qui permettra d'effectuer la suppression\n var transaction = db.transaction([\"table_flux\"], \"readwrite\");\n transaction.oncomplete = function(event) {displayList(db);};\n transaction.onerror = function(event) {\n window.alert('erreur de transaction suppression');\n };\n\n var fluxStore = transaction.objectStore(\"table_flux\");\n var req = fluxStore.clear();\n req.onsuccess = function(event) {\n }\n req.onerror = function(event) {\n window.alert('erreur suppression');\n }\n }\n}", "register(){\n this.userIsBan();\n this.getAll();\n this.ban();\n this.unban();\n\n this.App.debug(`Registering all apiban routes`, this.prefix)\n }", "static buscarTodos() {\n\n let produtos_db = JSON.parse(localStorage.getItem(\"produtos_db\"))\n if (!produtos_db) return []\n else return produtos_db\n }", "function createExistingIdentities() {\n\n}", "async function initializeDatabases() {\n // const databases = await Promise.all([connect(uri)]);\n const searchbar = await connect(\n connectionString,\n 'searchbar'\n );\n databases.searchbar = searchbar;\n}", "function registrarBaseFactura() {\n localStorage.setItem(\"BASEFACTURA\", JSON.stringify(baseFactura));\n}", "async getAll() {\n try {\n return await this.dbProduto.findAll();\n } catch (error) {\n // mostra o erro no console\n console.log(error.message);\n // gera um erro\n throw new Error({ 'ProdutosService error: ': error.message });\n }\n }", "function readDB() {\n const data = localStorage.getItem(KEY_BD);\n if (data) {\n registerList = JSON.parse(data);\n }\n renderTable();\n}", "function checkDatabase() {\n const transaction = db.transaction([\"BudgetStore\"], \"readwrite\");\n const budgetStore = transaction.objectStore(\"BudgetStore\");\n const getAll = budgetStore.getAll();\n\n getAll.onsuccess = function () {\n if (getAll.result.length > 0) {\n // found in api.js\n fetch(\"/api/transaction/bulk\", {\n method: \"POST\",\n body: JSON.stringify(getAll.result),\n headers: {\n Accept: \"application/json, text/plain, */*\",\n \"Content-Type\": \"application/json\",\n },\n })\n .then((res) => res.json())\n // deleteAll\n .then(() => {\n const transaction = db.transaction([\"BudgetStore\"], \"readwrite\");\n const budgetStore = transaction.objectStore(\"BudgetStore\");\n budgetStore.clear();\n });\n }\n };\n}", "function registerUser() {\r\n let username = document.getElementById('username').value;\r\n let email = document.getElementById('reg-email').value;\r\n let password = document.getElementById('reg-password').value;\r\n let confirmPassword = document.getElementById('confirm-password').value\r\n let req = window.indexedDB.open(USERS_DB_NAME, VERSION);\r\n\r\n if (isValidPassword(password, confirmPassword) && isValidEmail(email)) {\r\n console.log(\"Correct info\");\r\n req.onsuccess = () => {\r\n db = req.result; // setting variables to work with\r\n tx = db.transaction(USERS_DB_NAME, \"readwrite\");\r\n store = tx.objectStore(USERS_DB_NAME);\r\n store.put({\r\n email: email,\r\n username: username,\r\n password: password,\r\n permission: 1, // all registered users are 'user' by default \r\n balance: 500,\r\n rewards: 0,\r\n warning: 0\r\n });\r\n \r\n tx.oncomplete = () => {\r\n alert(\"Registration complete! Please login with your information.\")\r\n console.log(\"User successfully registered.\");\r\n db.close();\r\n };\r\n };\r\n }\r\n else { // throw text errors\r\n document.getElementById('validity-check').innerHTML = \"Please recheck your information.\";\r\n }\r\n}", "static deleteOldDatabase() {\n let DBDeleteRequest = window.indexedDB.deleteDatabase(restaurantsDb);\n DBDeleteRequest.onerror = () => {\n console.log('Error deleting database.');\n };\n DBDeleteRequest.onsuccess = () => {\n console.log('Old db successfully deleted!');\n };\n }", "index(req, res) {\n\t\tUsuario.findAll()\n\t\t\t.then(function (usuarios) {\n\t\t\t\tres.status(200).json(usuarios);\n\t\t\t})\n\t\t\t.catch(function (error) {\n\t\t\t\tres.status(500).json(error);\n\t\t\t});\n\t}", "static createNewDatabase() {\n idb.open(restaurantsDb, 1, upgradeDb => {\n if (!upgradeDb.objectStoreNames.contains(restaurantsTx)) {\n upgradeDb.createObjectStore(restaurantsTx, { keypath: 'id', autoIncrement: true });\n }\n console.log('restaurants-db has been created!');\n });\n }", "function salidaSitio() {\n //check to ensure the mydb object has been created\n if (mydb) {\n //Get all the sitios from the database with a select statement, set outputSitiosList as the callback function for the executeSql command\n mydb.transaction(function (t) {\n t.executeSql(\"SELECT * FROM sitios\", [], actualizarSitio);\n });\n } else {\n // alert(\"¡Tú navegador web/browser no soporta WebSQL!\");\n }\n}", "function createDatabase() {\n\n if (!window.indexedDB) {\n window.alert(\"Your browser doesn't support IndexedDB.\");\n }\n\n // employee data\n var employeeData = [\n { employeeId: 1, name: \"Daniel\", email: \"[email protected]\" },\n { employeeId: 2, name: \"Berta\", email: \"[email protected]\" }\n ];\n\n var dbName = \"EmployeeDB\";\n\n // Open database with version=1. Use integer valueonly ! Not 1.1, 1.2 etc.\n var request = indexedDB.open(dbName, 1);\n\n request.onerror = function (event) {\n console.log(\"request.onerror errcode=\" + event.target.error.name);\n };\n\n request.onupgradeneeded = function (event) {\n console.log(\"request.onupgradeneeded, creating a new version of the database\");\n db = event.target.result;\n\n // Create an objectStore for employees. use unique employeeId as key path\n var objectStore = db.createObjectStore(\"employees\", { keyPath: \"employeeId\" });\n\n // Create index to search employee by name.\n objectStore.createIndex(\"name\", \"name\", { unique: false });\n\n // Create an index to search by email.\n objectStore.createIndex(\"email\", \"email\", { unique: true });\n\n // Store values in objectStore.\n for (var i in employeeData) {\n objectStore.add(employeeData[i]);\n }\n };\n\n request.onsuccess = function (event) {\n // Handle errors.\n console.log(\"request.onsuccess, database opened, now can add / remove / look for data in IndexedDB.\");\n\n // The result is the database itself\n db = event.target.result;\n };\n}", "async function openFavorites() {\n return idb_1.openDB(\"Favorites\", 2, {\n upgrade(db) {\n console.log(\"upgrade\");\n const store = db.createObjectStore(\"favorites\", {\n keyPath: \"id\",\n autoIncrement: true\n });\n store.createIndex(\"by-name\", \"name\");\n }\n });\n}", "function listarInstrutores () {\n instrutorService.listar().then(function (resposta) {\n //recebe e manipula uma promessa(resposta)\n $scope.instrutores = resposta.data;\n })\n instrutorService.listarAulas().then(function (resposta) {\n $scope.aulas = resposta.data;\n })\n }", "function tabla_entidades() {\r\n\t\tvar res = document.getElementById(\"main\");\r\n\t\tres.innerHTML = '<div>entrando en la funcion de entidades</div>';\r\n var openDB = JSON.parse(localStorage.getItem('entidades'));\r\n\t\tif(!openDB){ \r\n\t\t\twindow.alert('creando db entidades');\r\n\t\t\tvar rootURL = 'http://agenda.happyroadgirl.com/';\t\r\n\t\t\tres.innerHTML = '<div>Conectando para rellenar desde ' + rootURL + '</div>';\r\n\t\t\t\r\n\t\t\t\t\t$.ajax({\r\n\t\t\t\t\ttype: 'GET',\r\n\t\t\t\t\turl: rootURL + '/wp-json/wp/v2/entidad',\r\n\t\t\t\t\tdataType: 'json',\r\n\t\t\t\t\tsuccess: function(data){\r\n\t\t\t\t\t\t$.each(data, function(index, value) {\r\n\t\t\t\t\t\t\t\topenDB = JSON.parse(localStorage.getItem('entidades')) || [];\r\n\t\t\t\t\t\t\t\topenDB.push(new Entidad({ \"nombre\": data[index].nombre, \"direccion\": data[index].direccion }));\r\n\t\t\t\t\t\t\t\tlocalStorage.setItem('entidades', JSON.stringify(openDB));\r\n\t\t\t\t\t\t\t});//each\r\n }//success\r\n\t\t\t\t\t}); //fin de conexion \r\n\t\t}else{window.alert('db entidades estaba creada');} \r\n\r\n\t\tfill_indice();\r\n}", "getAll(req, res) {\n // Count the hits\n config.TOTAL_HITS++;\n\n // Try returns all the registers\n CpfsModel.findAll().then(registers => {\n // If it does not return records, it returns error 500\n if (!registers)\n res.status(500).send('Error on find!');\n else if (registers.length == 0)\n // If it does found nothing records, returns 404\n return res.status(404).send('No registers found!');\n \n // Returns the registers and insert the mask in CPF\n for(let i = 0; i < registers.length; i++)\n registers[i].cpf = CPF.mask(registers[i].cpf);\n return res.status(200).json(registers);\n });\n }", "async function crearPasajeroDaoDb(cnxString, dbName, collectionName) {\n\n const client = new MongoClient(cnxString, {\n useNewUrlParser: true,\n useUnifiedTopology: true\n })\n\n //Se conecta a la base de datos que es mongod.exe\n try {\n log('conectandose a mongoDB')\n await client.connect()\n log('conectado!')\n } catch (error) {\n throw crearErrorDeBaseDeDatos(error.message)\n\n }\n\n //Equivalente a usar db.use dbName\n const db = client.db(dbName)\n\n //Equivalente a usar db.collection collectionName\n const collection = db.collection(collectionName)\n\n return {\n add: async (element) => {\n await collection.insertOne(element)\n delete element._id\n },\n deleteById: async (unId) => {\n const { deletedCount } = await collection.deleteOne({ id: unId })\n if (!deletedCount) {\n throw crearErrorRecursoNoEncontrado(' reserva', unId)\n }\n },\n getAll: async () => {\n const registrosEnColeccion = await collection.find({}).toArray()\n //cada elemento de la coleccion lo \"modifica\" y lo devuelve como otro array\n //esto crear reservas nuevas con todos los objetos/registros que tiene la collection\n const reservas = registrosEnColeccion.map(reg => crearPasajero(reg))\n return reservas\n },\n getById: async (unId) => {\n const registrosEnColeccion = await collection.findOne({ id: unId }).toArray()\n const reservas = registrosEnColeccion.map(reg => crearPasajero(reg))\n return reservas\n },\n close: async () => {\n log('cerrando conexion a db')\n await client.close()\n log('conexion cerrada')\n },\n\n }\n\n\n}", "function initDatabase() {\n // console.log(\"Open database \" + DbConst.DB_NAME + \"...\");\n let req;\n try {\n req = indexedDB.open(DbConst.DB_NAME, DbConst.DB_VERSION);\n } catch (ex){\n console.error(\"Error opening database: \" + ex.name + \": \" + ex.message + \"\\nEnabling cookies might resolve this.\");\n }\n req.onsuccess = function (event) {\n // Better use \"this\" than \"req\" to get the result to avoid problems with garbage collection.\n db = event.target.result;\n // db = this.result;\n // console.log(\"Database opened successfully.\");\n };\n req.onerror = function (event) {\n console.error(\"Database open error: \" + event.target.errorCode);\n };\n req.onupgradeneeded = function (event) {\n console.log(\"Database upgrade start...\");\n let db = event.target.result;\n\n // Create an objectStore for this database\n let objStore;\n if (event.oldVersion < 1) {\n objStore = db.createObjectStore(DbConst.DB_STORE_TEXT, {autoIncrement: true});\n objStore.createIndex(DbConst.DB_TEXT_IDX_FIELD, \"fieldkey\", {unique: true});\n objStore.createIndex(DbConst.DB_TEXT_IDX_NAME, \"name\", {unique: false});\n objStore.createIndex(DbConst.DB_TEXT_IDX_LAST, \"last\", {unique: false});\n objStore.createIndex(DbConst.DB_TEXT_IDX_HOST, \"host\", {unique: false});\n objStore.createIndex(DbConst.DB_TEXT_IDX_HOST_NAME, \"host_name\", {unique: false});\n //objStore.createIndex(\"by_uri\", \"uri\", {unique: false});\n\n objStore = db.createObjectStore(DbConst.DB_STORE_ELEM, {autoIncrement: true});\n objStore.createIndex(DbConst.DB_ELEM_IDX_FIELD, \"fieldkey\", {unique: true});\n objStore.createIndex(\"by_saved\", \"saved\", {unique: false});\n //objStore.createIndex(\"by_name\", \"name\", {unique: false});\n }\n\n // if (event.oldVersion < 2) {\n // // Version 2 introduces new index\n // objStore = req.transaction.objectStore(DbConst.DB_STORE_TEXT);\n // objStore.createIndex(\"by_type\", \"type\", {unique: false});\n // }\n // if (event.oldVersion < 3) {\n // // Version 3 rename indexes\n // objStore = req.transaction.objectStore(DbConst.DB_STORE_TEXT);\n // objStore.deleteIndex(\"name\");\n // objStore.createIndex(\"by_name\", \"name\", {unique: false});\n // }\n\n // Use transaction oncomplete to make sure the objStore creation is finished before adding data into it.\n objStore.transaction.oncomplete = function (/*event*/) {\n console.log(\"Database upgrade success.\");\n //doDatabaseTests();\n };\n console.log(\"Database upgrade finished.\");\n };\n}", "list(req, res) {\n return res.status(HTTP_OK).json(simpleDatabase)\n }", "function initializeSuperusers(db) {\r\n tx = db.transaction(USERS_DB_NAME, \"readwrite\");\r\n store = tx.objectStore(USERS_DB_NAME);\r\n\r\n for (let i = 0; i < SUPERUSERS.length; i++){\r\n store.put({\r\n email: SUPERUSERS[i][0],\r\n username: SUPERUSERS[i][1],\r\n password: SUPERUSERS[i][2],\r\n permission: SUPERUSERS[i][3],\r\n balance: SUPERUSERS[i][4],\r\n rewards: SUPERUSERS[i][5],\r\n warning: SUPERUSERS[i][6]\r\n });\r\n }\r\n}", "getAllRegisterProject(id){\n return axios.get(API_URL+ 'all/' + id);\n }", "function showTodos() {\n db.allDocs( { include_docs: true, descending: false } ).then( doc => {\n // redrawTodosUI( doc.rows );\n // console.log(doc.rows);\n doc.rows.forEach( register => {\n console.log(register);\n });\n console.log('--------');\n });\n}", "async index(req, res) {\n\n // Busca por todos os usuarios e retorna eles\n const usersGit = await UserGit.find({})\n res.status(200).json(usersGit)\n }", "function loadAllRegimes() {\n //also get the available regimens here for later\n return conceptService.get(Bahmni.Common.Constants.arvRegimensConvSet).then(function (result) {\n vm.allRegimes = result.data;\n });\n }", "function pruebas(req,res){\n\tres.status(200).send({\n\t\tmessage:'Probando el controlador de componente y la acción pruebas'\n\t});\n}//pruebas", "function dibujarProductos() {\r\n stockProductos.forEach(producto => {\r\n insertarProducto(producto)\r\n })\r\n}", "function dbIndexQuery(index, indexName){\n var tx = dbRequest.result.transaction('task')\n var store = tx.objectStore('task');\n const statusIndex= store.index(index);\n const getStatus=statusIndex.getAll(indexName);\n\n getStatus.onsuccess=(e)=>{\n\n let web= e.target.result\n let webKey=getStatus.key\n web.map((pend)=>{\n createLi(pend.time,pend.task,pend.status,activityDisplay)\n console.log(web)\n\n })\n }\n }", "async fetchExistingRecords () {\n const client = getAlgoliaClient()\n\n // return an empty array if the index does not exist yet\n const { items: indices } = await client.listIndices()\n\n if (!indices.find(index => index.name === this.name)) {\n console.log(`index '${this.name}' does not exist!`)\n return []\n }\n\n const index = client.initIndex(this.name)\n let records = []\n\n await index.browseObjects({\n batch: batch => (records = records.concat(batch))\n })\n\n return records\n }", "function limpiarControles(){ //REVISAR BIEN ESTO\n clearControls(obtenerInputsIdsProducto());\n clearControls(obtenerInputsIdsTransaccion());\n htmlValue('inputEditar', 'CREACION');\n htmlDisable('txtCodigo', false);\n htmlDisable('btnAgregarNuevo', true);\n}", "function escribir(bd){\n\n\t\tvar transaction = bd.transaction(['libros'], \"readonly\");//obre la taula que es vol utilitzar i la manera de treballar, en aques cas nomes lectura.\n\t\tvar store = transaction.objectStore('libros');\n\t\tvar data = [];//array on es guardara els objectes.\n\t\tvar html=\"\";\n\n\t\tvar request = store.openCursor();//obrim un cursor per recorre el indexedDB agafan els objectes.\n\t\trequest.onsuccess = function (event) {\n \t\tvar cursor = event.target.result;\n \t\tif (cursor) {\n\t\t\t\tconsole.log(cursor.value);\n \t\t data.push(cursor.value);\n \t\t cursor.continue();//continue lo que fa es que si existeix un seguent objecte al curos executa el onsucces un altre vegada.\n \t\t} else {\n \t\t for(var i=0;i<data.length;i++){\n\n\t\t\t\t\thtml+=\"<div class=\\\"tablaI\\\"><div class=\\\"indexI\\\">\"+data[i].num+\n\t\t\t\t\t\"</div><div class=\\\"imagenI\\\"><img src=\\\"\" +\n \t\t\t\tdata[i].img +\n \t\t\t\t\"\\\"/></div><div class=\\\"tituloI\\\">\" +\n \t\t\t\tdata[i].titulo +\n\t\t\t\t\t\"</div><div class=\\\"autorI\\\">\" +\n \t\t\t\tdata[i].autor +\n \t\t\t\t\"</div><div class=\\\"descipcionI\\\">\" +\n \t\t\t\tdata[i].desc +\n \t\t\t\t\"</div></div>\";\n\n\t\t\t\t}\n\n\t\t\t\tdocument.getElementById(\"DataBase\").innerHTML=html;\n\t\t\t\tdocument.getElementById(\"content\").style.display=\"block\";//faig visible la zona de deposició de la informació\n\n\t\t\t\tdocument.getElementById(\"buttons\").innerHTML=\"<input id=\\\"buttonCrearBD\\\" type=\\\"button\\\" value=\\\"CrearBD\\\"><input id=\\\"buttonEliminarBD\\\" type=\\\"button\\\" value=\\\"VaciarBD\\\">\";\n\n\t\t\t\tdocument.getElementById(\"buttonEliminarBD\").onclick=eliminar;//conector per al div creat a la instruccio precedent.\n\t\t\t}\n\t\t};\n}", "function load() {\n return Promise.all([storage.getTree(), storage.getTokenIndex(), storage.getEntries()])\n .then(function(result) {\n console.log('load results')\n tree = result[0];\n dbIndex = new Index(result[1]);\n entries = result[2];\n });\n}", "static fetchRestaurantsFromIDB(callback) {\r\n // const dbPromise = DBHelper.openIDB();\r\n return DBHelper.openIDB().then((db) => {\r\n if(!db) return;\r\n\r\n const tx = db.transaction('restaurants');\r\n const store = tx.objectStore('restaurants');\r\n\r\n return store.getAll().then((restaurants) => {\r\n if(restaurants.length) {\r\n callback(null, restaurants);\r\n } else {\r\n const error = 'There is no restaurants in IDB';\r\n callback(error, null);\r\n }\r\n });\r\n }) \r\n }", "function setupKeys() {\n if (!precheck()) { return }\n var request = window.indexedDB.open(\"WebCA\", dbVersion);\n request.onerror = cb_errorDB;\n request.onupgradeneeded = cb_prepareDB;\n request.onsuccess = cb_createKeys;\n}", "function fAgregar(){\n if (cPermisoPag != 1){\n fAlert(\"No tiene Permiso de ejecutar esta acción\");\n return;\n }\n\n if(lBandera == true){\n fAlert(\"No puede efectuar esta operación mientras se encuentre realizando otra transacción\");\n return;\n }\n frm.iCveSistema.value = \"\";\n frm.hdCveModulo.value = \"\";\n frm.iNumReporte.value = \"\";\n\n aDocDisp = FRMListadoA.fGetObjs(0);\n\n for(cont=0;cont < aDocDisp.length;cont++){\n if(aDocDisp[cont]){\n if (frm.iCveSistema.value==\"\") frm.iCveSistema.value=aResTemp[cont][0]; else frm.iCveSistema.value+=\",\"+aResTemp[cont][0];\n if (frm.hdCveModulo.value==\"\") frm.hdCveModulo.value=aResTemp[cont][1]; else frm.hdCveModulo.value += \",\" + aResTemp[cont][1];\n if (frm.iNumReporte.value==\"\" ) frm.iNumReporte.value=aResTemp[cont][2]; else frm.iNumReporte.value+=\",\"+aResTemp[cont][2];\n }\n }\n\n if (frm.iCveSistema.value == \"\"){\n fAlert ('\\nSeleccione al menos un registro para hacer esta operación.');\n return;\n }\n\n\n frm.hdBoton.value = \"Guardar\";\n frm.hdFiltro.value = \"\";\n if(fEngSubmite(\"pgGRLReporteA.jsp\",\"idAgrega\")){\n FRMPanel.fSetTraStatus(\"UpdateComplete\");\n fDisabled(true);\n FRMListado.fSetDisabled(false);\n }\n\n fCargaListadoA();\n}", "function cargarGeneros(req, res) {\n var peticionsql = 'SELECT * FROM genero';\n \n conexionBaseDeDatos.query(peticionsql, function(error, resultado, campos) {\n if(error) {\n console.log('Hubo un error en la consulta', error.message);\n return res.status(500).send('Hubo un error en la consulta');\n };\n res.status(200).send(JSON.stringify(resultado));\n })\n}", "function regStorage(){\r\n var error = 0;\r\n\r\n if(document.getElementById('usernameReg').value == \"\"){\r\n alert(\"El campo Nombre de usuario debe estar completo\");\r\n }\r\n\r\n if(document.getElementById('passwordReg').value == \"\"){\r\n alert(\"El campo Contraseña debe estar completo\");\r\n error++;\r\n }\r\n if(errPass('passwordReg') != \"\"){\r\n alert(\"Contraseña no válida\");\r\n error++;\r\n }\r\n if(document.getElementById('nameReg').value == \"\"){\r\n alert(\"El campo Nombre debe estar completo\");\r\n error++;\r\n }\r\n if(document.getElementById('surnameReg').value == \"\"){\r\n alert(\"El campo Apellidos debe estar completo\");\r\n error++;\r\n }\r\n if(document.getElementById('emailReg').value == \"\"){\r\n alert(\"El campo Correo debe estar completo\");\r\n error++;\r\n }\r\n if(document.getElementById('birthdateReg').value == \"\"){\r\n alert(\"El campo Fecha de nacimiento debe estar completo\");\r\n error++;\r\n }\r\n if(document.getElementById('addressReg').value == \"\"){\r\n alert(\"El campo Dirección debe estar completo\");\r\n error++;\r\n }\r\n if(!document.getElementById('checkboxReg').checked){\r\n alert(\"Debes aceptar las condiciones de uso\");\r\n error++;\r\n }\r\n\r\n if(error==0){\r\n \r\n if(searchStorage('username', 'users', 'Reg') == 1){\r\n if(document.getElementById('usernameReg').value != \"\" || document.getElementById('usernameReg').value == \"none\"){\r\n alert(\"Nombre de usuario ya en uso. Inténtelo con otro diferente\");\r\n }\r\n error++;\r\n }\r\n }\r\n\r\n if(error==0){\r\n \r\n if(searchStorage('email', 'users', 'Reg') == 1){\r\n if(document.getElementById('emailReg').value != \"\"){\r\n alert(\"Cuenta ya registrada con ese correo. Inténtelo de nuevo con otra cuenta de correo\");\r\n }\r\n error++;\r\n }\r\n }\r\n \r\n if(error == 0){\r\n var data = [], reservesArray = [];\r\n data = JSON.parse(localStorage.getItem('users'));\r\n\r\n data[data.length] = {\r\n username: document.getElementById('usernameReg').value,\r\n password: document.getElementById('passwordReg').value,\r\n img: document.getElementById('imgReg').value,\r\n name: document.getElementById('nameReg').value,\r\n surname: document.getElementById('surnameReg').value,\r\n email: document.getElementById('emailReg').value,\r\n address: document.getElementById('addressReg').value,\r\n phone: document.getElementById('phoneReg').value,\r\n birthdate: document.getElementById('birthdateReg').value,\r\n type: document.getElementById('loggedReg').value,\r\n reserves: reservesArray\r\n }\r\n localStorage.setItem('users', JSON.stringify(data));\r\n\r\n var globalVariables = {\r\n logged: document.getElementById('loggedReg').value,\r\n user: document.getElementById('usernameReg').value,\r\n host: 'none'\r\n }\r\n localStorage.setItem('globalVariables', JSON.stringify(globalVariables));\r\n window.location.href = \"index.html\";\r\n }\r\n}", "static fetchRestaurants(callback){\r\n //console.log(\"You have reached IndexedDB\");\r\n dbPromise.then(db => {\r\n const tx = db.transaction('restaurants');\r\n const store = tx.objectStore('restaurants');\r\n //console.log(store);\r\n return store.getAll();\r\n })\r\n .then(restaurants => {\r\n if (restaurants.length !== 0) {\r\n Promise.resolve(restaurants);\r\n }\r\n return DBHelper.getRestaurantsFromIDB(callback);\r\n //callback(null, restaurants);\r\n })\r\n }", "saveList (forms) {\n RealmObject.write(() => {\n let form = forms.status.response;\n if (!forms.status.params.app_uid && !forms.status.params.del_index) {\n RealmObject.create(FormSchema.schema.name, Object.assign({}, form, {\n formContent: JSON.stringify(form.formContent)\n }), true);\n }\n });\n }", "function index(req,res){ \n // busca todos los productos\n Product.find({},(err,productos)=>{\n if(err) return res.status(400).send(err)\n else return res.status(200).send(productos);\n\n });\n \n \n \n \n\n}", "lista(callback) {\n this._db.query('select * from resposta', function(err, recordset) {\n callback(err, recordset);\n });\n }", "function activate(appRegistry) {\n appRegistry.registerRole('Database.Tab', DATABASE_TAB_ROLE);\n appRegistry.registerAction('Database.CollectionsActions', CollectionsAction);\n appRegistry.registerComponent('Database.CollectionsTable', CollectionsTable);\n appRegistry.registerComponent('Database.CreateCollectionCheckbox', CreateCollectionCheckbox);\n appRegistry.registerComponent('Database.CreateCollectionInput', CreateCollectionInput);\n appRegistry.registerComponent('Database.CreateCollectionSizeInput', CreateCollectionSizeInput);\n appRegistry.registerComponent('Database.CreateCollectionDialog', CreateCollectionDialog);\n appRegistry.registerComponent('Database.DropCollectionDialog', DropCollectionDialog);\n appRegistry.registerStore('Database.CollectionsStore', CollectionsStore);\n appRegistry.registerStore('Database.DropCollectionStore', DropCollectionStore);\n appRegistry.registerStore('Database.CreateCollectionStore', CreateCollectionStore);\n}", "function displayList(db) {\n\n // on ouvre une transaction qui permettra d'effectuer\n // la lecture. uniquement de la lecture -> \"readonly\"\n var transaction = db.transaction([\"table_flux\"], \"readonly\");\n transaction.oncomplete = function(event) {};\n transaction.onerror = function(event) {\n window.alert('erreur de transaction lecture ');\n };\n\n \n // récupération de la table html\n var list = document.getElementById(\"listFlux\");\n \n // on y efface tout\n list.innerHTML = '';\n\n // on récupère l'object store que l'on veut lire\n var fluxStore = transaction.objectStore(\"table_flux\");\n\tvar i = 1;\n\t\n fluxStore.openCursor().onsuccess = function (event) {\n\n var cursor = event.target.result;\n\t\n if (cursor) {\n\t\n var _flux = cursor.value; // un enregistrement\n\t\t\t\n // création de la ligne html dans le tableau\n\t\t\tvar tr = document.createElement('tr');\n\t\t\n var tdFluxLink = document.createElement('td');\n tdFluxLink.textContent = _flux.flux_link;\n tr.appendChild(tdFluxLink);\n\n\t\t\tvar tdTitre = document.createElement('td');\n\t\t\ttdTitre.textContent = _flux.titre;\n\t\t\ttr.appendChild(tdTitre);\n\t\t\t\n var tdCategorie = document.createElement('td');\n tdCategorie.textContent = _flux.categorie;\n tr.appendChild(tdCategorie);\n\t\t\t\n\t\t\tvar tdSuppresion=document.createElement('td');\n\t\t\ttdSuppresion.innerHTML='<input type=\"button\" value=\"supprimer\" onclick=\"delete_flux('+_flux.id+');\" />';\n\t\t\ttr.appendChild(tdSuppresion);\n\t\n list.appendChild(tr);\n\t\t\t\n // on avance le curseur -> la callback onsuccess\n // sera appelée à nouveau\n\t\t\ti++;\n cursor.continue();\n }\n }\n\n}" ]
[ "0.5880776", "0.5798108", "0.57289743", "0.56941795", "0.56633705", "0.5647115", "0.56012094", "0.55770797", "0.54943573", "0.5468644", "0.54613817", "0.5458838", "0.54465926", "0.5445279", "0.5422482", "0.54109645", "0.54062253", "0.5398846", "0.5372704", "0.53624684", "0.5360805", "0.53558934", "0.53433704", "0.5331797", "0.53229624", "0.5322918", "0.53065", "0.5296791", "0.5295965", "0.528995", "0.52877486", "0.5286618", "0.5286512", "0.52857345", "0.52851355", "0.5269836", "0.5260304", "0.5258074", "0.5257927", "0.5251775", "0.5247862", "0.524742", "0.52465636", "0.5246482", "0.5229946", "0.52279997", "0.5225687", "0.5222475", "0.522116", "0.52097934", "0.52030843", "0.5200297", "0.519714", "0.5188859", "0.5184683", "0.5184419", "0.51753384", "0.51725507", "0.5169426", "0.51561403", "0.515356", "0.5142697", "0.5136489", "0.51289135", "0.5124127", "0.51111853", "0.5108006", "0.5106716", "0.50986516", "0.5098498", "0.509575", "0.50893813", "0.50880766", "0.5087826", "0.5087695", "0.50868416", "0.5086657", "0.50788397", "0.5075348", "0.50724226", "0.5069403", "0.50516075", "0.50480884", "0.50440824", "0.5041183", "0.5033556", "0.5033502", "0.5030882", "0.5029746", "0.5028968", "0.5027721", "0.5014165", "0.5012889", "0.5012387", "0.5001662", "0.4999715", "0.49982578", "0.4997938", "0.49938092", "0.49910414" ]
0.66978467
0
Table name is the only required property.
static get tableName() { return 'brand'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get tableName() {\n if (this.table !== undefined) {\n return this.table.name\n }\n }", "static get tableName() {\n return '' + PREFIX + 'employees';\n }", "getTableName() {}", "static get tableName() {\n return '' + PREFIX + 'loss_of_consciousness';\n }", "static get tableName() {\n return 'fedland';\n }", "static get tableName() {\n return '' + PREFIX + 'ptw_ppmp_material_doc';\n }", "function _tableName() {\n\tif ( this.tableName ) {\n\t\treturn _.result( this, 'tableName' );\n\t}\n\n\tvar urlAttributeName = this instanceof Backbone.DynamoDB.Model ? 'urlRoot' : 'url',\n\t\ttable = _.result( this, urlAttributeName ).replace( /^\\//, '' );\n\n\treturn table.charAt( 0 ).toUpperCase() + table.substr( 1 );\n}", "static get TABLE_NAME() {\r\n return 'device'\r\n }", "static get tableName() {\n return '' + PREFIX + 'apps_countries';\n }", "tablename(context) {\n switch (context) {\n case \"select\":\n case \"selectOne\":\n return \"(select * from tablename1 join tablename2 on tablename1.id = tablename2.id)\";\n case \"insert\":\n case \"update\":\n case \"delete\":\n return \"tablename1\";\n }\n }", "function Table(name)\n{\n\tthis.name = name;\n}", "static get tableName() {\n return \"doctors\";\n }", "static get tableName() {\n return '' + PREFIX + 'config_confined_paths';\n }", "static get tableName() {\n return \"Game\";\n }", "static get tableName() {\n return 'empresa';\n }", "static get tableName(){\n return \"state\";\n }", "function getTableName(entity) {\n\t\treturn entity.canon$({object:true}).name;\n\t}", "printTableNameinConsole() {\n console.log(this.name);\n }", "static get tableName() {\n return '' + PREFIX + 'asset_equipment_type';\n }", "get table() {\n return this.tableIn;\n }", "function check_table_name ( table_name ) {\n\t'use strict';\n\tvar __FUNCTION__ = \"check_table_name\";\n\tvar tp = find_table ( table_name, model );\n\tvar rv = {};\n\tif ( tp === -1 ) {\n\t\t// crud_info = gen_crud_info ( crud_info, 'predef', table_name, req.params, __FUNCTION__, __FILE__, 17 );\n\t\trv.error = new restify.InvalidArgumentError(\"Error (1801): File: gen_crud_lib.m4.js Line: \"+ 18 +\", The specified table is not configured for access in this software. table_name=(\"+table_name+\")\");\n\t}\n\treturn rv;\n}", "static get tableName() {\n return 'shops';\n }", "get nameWithoutPrefix() {\n if (this.isClosureJunction && this._name)\n return this.entityMetadata.namingStrategy.closureJunctionTableName(this._name);\n // otherwise generate table name from target's name\n const name = this.target instanceof Function ? this.target.name : this.target;\n return this.entityMetadata.namingStrategy.tableName(name, this._name);\n }", "getTableNames(){\n return this.query(\"SELECT name FROM sys.tables;\")\n }", "static get TABLE_NAME() {\r\n return 'firmware'\r\n }", "function table() {\n this.table = null;\n this.opts = {};\n this.table_id = \"\";\n}", "static get tableName() {\n return '' + PREFIX + 'all_roles';\n }", "static get tableName() {\n return '' + PREFIX + 'config_roles';\n }", "static get table() {\n return \"dioceses\";\n }", "static get TABLE_NAME() {\n return \"login_history\";\n }", "static _getTableName(){\n return \"posts\"\n }", "_setTable() {\r\n\r\n\r\n }", "static get tableName() {\n return 'orders';\n }", "function gettable()\n{\n return table;\n}", "getTable() {\n return \"st_application\";\n }", "static get tableName() {\n\t\treturn 'promotion_code';\n\t}", "_table (table, alias = null) {\n alias = alias ? this._sanitizeTableAlias(alias) : alias;\n table = this._sanitizeTable(table);\n\n if (this.options.singleTable) {\n this._tables = [];\n }\n\n this._tables.push({\n table: table,\n alias: alias,\n });\n }", "get table() {\n return this._table;\n }", "static get tableName() {\n return 'spell'\n }", "function Table(database, name) {\n this._afterGenDataFn = function (dataRow) { return dataRow; };\n this.name = name;\n this.database = database;\n this.columns = new named_map_1.NamedMap();\n }", "static get table() {\n return 'profile';\n }", "get table() {\n if (!this[Table]) {\n this[Table] = {\n email: undefined,\n password: undefined,\n name: undefined,\n address: undefined,\n invested: undefined,\n bonus: undefined,\n sspj: undefined,\n ethAddress: undefined,\n ethAddressModifiable: undefined,\n token: undefined,\n auth: undefined,\n createAt: undefined\n };\n }\n\n return this[Table];\n }", "setTable(Table) {\n this.table = Table + '.do';\n }", "get tableType() {\n if (this.table !== undefined) {\n return this.table.tableType\n }\n }", "function userTable() { }", "get LOWER_CASE_TABLE_NAMES() { this._LOWER_CASE_TABLE_NAMES }", "get name() {\n if (this.entityMetadata.tablesPrefix)\n return this.entityMetadata.namingStrategy.prefixTableName(this.entityMetadata.tablesPrefix, this.nameWithoutPrefix);\n return this.nameWithoutPrefix;\n }", "set table(arg){\n\t\tlet obj = Object.create(null);\n\t\tobj.tableName = arg.tableName;\n\t\tobj.array = arg.message;\n\t\tthis.globalTables.push(obj);\n\t}", "constructor() {\n super({ dbName: dbName });\n\n const oThis = this;\n\n oThis.tableName = 'token_redemption_products';\n }", "function get_table_info() {\n ;\n}", "static tableName() {\n\t\treturn 'tasks';\n\t}", "constructor() {\n super({ dbName: dbName });\n\n const oThis = this;\n\n oThis.tableName = 'user_profile_elements';\n }", "static get tableName() {\n return 'Groups';\n }", "constructor() {\n super({ dbName: dbName });\n\n const oThis = this;\n\n oThis.tableName = 'meetings';\n }", "constructor() {\n super({ dbName: dbName });\n\n const oThis = this;\n\n oThis.tableName = 'aux_price_oracles';\n }", "static get tableName() {\n return 'networks';\n }", "function useLowerCaseTableNames() {\n return !config.postgresql.noLowerCaseTableName;\n}", "function createTable(table) {\n if (user.id == table.owner_id) {\n sittedTable = new Table(table.id,true);\n }\n}", "function getTableDataOnlyContextType() {\n\treturn 'table';\n}", "renameTable(tableName, to) {\n this.pushQuery(`rename table ${this.formatter.wrap(tableName)} to ${this.formatter.wrap(to)}`);\n }", "hasTable(tableName) {\n let sql = 'select * from information_schema.tables where table_name = ?';\n const bindings = [tableName];\n\n if (this.schema) {\n sql += ' and table_schema = ?';\n bindings.push(this.schema);\n } else {\n sql += ' and table_schema = current_schema()';\n }\n\n this.pushQuery({\n sql,\n bindings,\n output(resp) {\n return resp.rows.length > 0;\n },\n });\n }", "constructor() {\n super({ dbName: dbName });\n\n const oThis = this;\n\n oThis.tableName = 'latest_transactions';\n }", "hasTable(tableName) {\n let sql = 'select * from information_schema.tables where table_name = ?';\n const bindings = [tableName];\n\n if (this.schema) {\n sql += ' and table_schema = ?';\n bindings.push(this.schema);\n } else {\n sql += ' and table_schema = database()';\n }\n\n this.pushQuery({\n sql,\n bindings,\n output: function output(resp) {\n return resp.length > 0;\n }\n });\n }", "static get tableName() {\n return 'educational_stages';\n }", "function tableCB(table) {\n table.alias = table.name.replace(/_[a-z]/g, (c) => c.substr(1).toUpperCase());\n}", "static get tableName() {\n return 'assigned_clients';\n }", "function Percorrer_Tabela(table) {\n console.log(table);\n}", "static get tableName() { return 'pages' }", "static get tableName() { return 'pages' }", "function userTable(tableName){\n knex.schema.hasTable(tableName).then(function(exists){\n if(!exists){\n return knex.schema.createTable(tableName, function(table){\n table.increments('id').primary;\n table.text('title');\n table.text('blog');\n table.text('imglink');\n });\n }\n })\n}", "static get tableName() {\n return 'tc_forum_prefixes';\n }", "static get tableName () {\n return 'therapist_states';\n }", "function Database(name) \n{\nthis.tables = {};\nthis.name = name;\n}", "function Table() {\r\n}", "static get table() {\n return \"newsletter\";\n }", "constructor() {\n super({ dbName: dbName });\n\n const oThis = this;\n\n oThis.tableName = 'tokens';\n }", "function transactionTable() { }", "constructor() {\n super({ dbName: dbName });\n\n const oThis = this;\n\n oThis.tableName = 'internal_users';\n }", "function TableMapper() {\r\n}", "function getCurrentTable() {\n if (currentTableID != 0) {\n for (var i=0; i < DB.orders.length; i++) {\n if (DB.orders[i].table == currentTableID) {\n return DB.orders[i];\n }\n }\n }\n return \"error\";\n}", "function setLkpTableName(lkpid, tblname) {\n el(lkpid).tblName = tblname;\n}", "constructor() {\n super({ dbName: dbName });\n\n const oThis = this;\n\n oThis.tableName = 'tags';\n }", "getAllTables() {\n return this.execute('SHOW TABLES;').map(item => item[Object.keys(item)[0]]);\n }", "constructor() {\n super({ dbName: dbName });\n\n const oThis = this;\n\n oThis.tableName = 'webhook_endpoints';\n }", "function WOQLTableConfig(){\n\tthis.rules = [];\n\tthis.type = \"table\";\n}", "function _createTable(\n\ttableName\n) {\n\ttry {\n\t\tthis.tables[tableName] = new Table(tableName);\n\t\treturn this.tables[tableName];\n\t}\n\tcatch(error) {\n\t\tconsole.error(error);\n\t\tthrow error;\n\t}\n}", "function departmentTable() { }", "static get table() {\n\t\treturn cache.table( this.name );\n\t}", "changeTable(nextTable) {\n this.setState({\n tableName: nextTable,\n });\n }", "getTable() {\n const eos = Eos();\n eos.getTableRows({\n \"json\": true,\n \"code\": \"{{ cookiecutter.default_account }}\", // contract who owns the table\n \"scope\": \"{{ cookiecutter.default_account }}\", // scope of the table\n \"table\": \"notestruct\", // name of the table as specified by the contract abi\n \"limit\": 100,\n }).then(result => this.setState({ noteTable: result.rows }));\n }", "function consoleTable(table) {\n\t console.table(table);\n\t}", "function consoleTable(table) {\n\t console.table(table);\n\t}", "function consoleTable(table) {\n\t console.table(table);\n\t}", "function getTableAndNonTableContextType() {\n\treturn 'both';\n}", "function getUrlTable() {\r\n return _urlTable;\r\n}", "function getUrlTable() {\r\n return _urlTable;\r\n}", "function list(){\n return knex(\"tables\")\n .select(\"*\")\n .orderBy(\"table_name\")\n}", "function shortName(name, tTable) {\n var back;\n if (back = tTable[name]) {\n\treturn back;\n }\n return name;\n}", "ensureTable() {\n if (!checkedTables[this.settings.tableName])\n checkedTables[this.settings.tableName] = this.tableService.createTableIfNotExistsAsync(this.settings.tableName);\n return checkedTables[this.settings.tableName];\n }", "function getUrlTable() {\n return _urlTable;\n}" ]
[ "0.802687", "0.7789699", "0.7737943", "0.7640535", "0.75245225", "0.73386806", "0.7333709", "0.7221346", "0.7212838", "0.71973014", "0.71959245", "0.7143025", "0.71331924", "0.7093755", "0.7063128", "0.70494354", "0.7035943", "0.6948648", "0.69469297", "0.6933278", "0.6897715", "0.6871637", "0.6843634", "0.68254936", "0.68252885", "0.681872", "0.6800231", "0.67748034", "0.6767726", "0.6741206", "0.6729425", "0.6706417", "0.6691465", "0.6688666", "0.6654992", "0.6633894", "0.6625621", "0.6618561", "0.65754515", "0.6561307", "0.65075034", "0.64909947", "0.6470725", "0.6439947", "0.64373195", "0.64150316", "0.6413537", "0.6410512", "0.6403789", "0.6373769", "0.63528234", "0.63517576", "0.63429075", "0.63395536", "0.6318261", "0.6295225", "0.6290288", "0.6264279", "0.6260277", "0.62459", "0.623746", "0.622073", "0.6208934", "0.62087554", "0.6195105", "0.6175095", "0.61734265", "0.61709696", "0.61709696", "0.6163178", "0.61582196", "0.6153682", "0.61306363", "0.61287695", "0.61218715", "0.61184484", "0.61164486", "0.6105158", "0.6080031", "0.6075503", "0.6071165", "0.60470474", "0.6023216", "0.6020084", "0.5996088", "0.5992738", "0.5991746", "0.5974916", "0.59540886", "0.5898181", "0.58780336", "0.58780336", "0.58780336", "0.58722067", "0.5866371", "0.5866371", "0.5853827", "0.58393973", "0.58311856", "0.58295053" ]
0.715832
11
This object defines the relations to other models.
static get relationMappings() { return { stores: { relation: Model.HasManyRelation, // The related model. This can be either a Model subclass constructor or an // absolute file path to a module that exports one. We use the file path version // here to prevent require loops. modelClass: getModelFile('store'), join: { from: 'brand.id', to: 'store.brand_id' } }, managers: { relation: Model.ManyToManyRelation, modelClass: getModelFile('member'), join: { from: 'brand.id', through: { from: 'brand_manager.brand_id', to: 'brand_manager.member_id' }, to: 'member.id' } }, creator: { relation: Model.BelongsToOneRelation, modelClass: getModelFile('member'), join: { from: 'brand.creator_id', to: 'member.id' } }, foods: { relation: Model.HasManyRelation, modelClass: getModelFile('food'), join: { from: 'brand.id', to: 'food.brand_id' } }, promotionCodes: { relation: Model.HasManyRelation, modelClass: getModelFile('promotion_code'), join: { from: 'brand.id', to: 'promotion_code.brand_id' } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static associate(models) {\n this.lectures = this.hasMany(models.Lecture, { foreignKey: 'lectureId' });\n this.module = this.belongsTo(models.Module, { foreignKey: 'id' });\n this.quiz = this.hasOne(models.Quiz, { foreignKey: 'lectureGroupId' });\n }", "get relations () {\n return {\n 'artist': {\n type: ' hasOne',\n fk : 'artist_id'\n }\n }\n }", "static associate(models) {\n // define association here\n animalList.belongsTo(models.User);\n animalList.hasMany(models.Comment);\n }", "static associate(models) {\n comments.belongsTo(models.users, {\n foreignKey: 'usersId',\n onDelete: \"CASCADE\",\n\n })\n comments.hasMany(models.comments, {as:'Children', foreignKey:'commentsId', onDelete:'CASCADE'})\n comments.belongsTo(models.posts, {\n foreignKey: 'postsId',\n onDelete: \"CASCADE\"\n })\n }", "static associate(models) {\n Reiseberichte.hasMany(models.Reiseindex, {\n foreignKey: {\n name: 'Reisebericht'\n }\n });\n }", "static associate(models) {\n // define association here\n Ronda.hasMany(models.Partida,{foreignKey:'IdRonda',as:'partidas'})\n Ronda.belongsTo(models.Torneo,{foreignKey:'IdTorneo',as:'torneos'})\n }", "static associate(models) {\n this.hasMany(models.Servico, {\n foreignKey: 'idSolicitacao',\n as: 'servicos',\n }),\n this.hasMany(models.Arquivo, {\n foreignKey: 'idSolicitacao',\n targetKey: 'idSolicitacao',\n }),\n // Associação com Pagamento\n this.hasOne(models.Pagamento, {\n foreignKey: 'idSolicitacao',\n targetKey: 'idSolicitacao',\n }),\n // Associação com Servico\n this.hasMany(models.Servico, {\n foreignKey: 'idSolicitacao',\n targetKey: 'idSolicitacao',\n as: 'services',\n }),\n // Associação com Reserva\n this.hasOne(models.Reserva, {\n foreignKey: 'idReserva',\n as: 'reservas',\n });\n // Associação com Membros\n this.hasOne(models.Membro, {\n foreignKey: 'idMembro',\n as: 'membros',\n });\n }", "static associate(models) {\n // define association here\n // this.hasMany(models.StepIngredient);\n this.belongsTo(models.Recipe);\n }", "static associate(models) {\n // define association here\n this.hasMany(models['Orders'], { foreignKey: 'owner', sourceKey: 'id', });\n }", "static associate(models) {\n // define association here\n models.etablissements.hasMany(models.espacevert)\n }", "static associate(models) {\n // define association here\n ListenList.belongsTo(models.user, { foreignKey: { name: 'userId' } });\n }", "get relatesTo() {\n\t\treturn this.__relatesTo;\n\t}", "initRelations(reset) {\n const me = this,\n relations = me.modelClass.relations;\n\n if (reset && me.modelRelations) {\n // reset will reinit all relations, stop listening for store events on existing ones\n me.modelRelations.forEach((relation) => {\n if (relation.storeDetacher) relation.storeDetacher();\n });\n }\n\n if ((!me.modelRelations || me.modelRelations.length === 0 || reset) && relations) {\n me.modelRelations = [];\n\n // foreignKeys is filled when model exposes its properties\n relations &&\n relations.forEach((modelRelationConfig) => {\n const config = Object.assign({}, modelRelationConfig),\n relatedStore = typeof config.store === 'string' ? me[config.store] : config.store;\n\n config.dependentStore = me;\n\n me.modelRelations.push(config);\n\n if (relatedStore) {\n config.storeProperty = config.store;\n config.store = relatedStore; // repeated from initRelationStores, needed if stored is assigned late\n\n const dependentStoreConfigs = relatedStore.dependentStoreConfigs;\n\n // Add link to dependent store\n if (dependentStoreConfigs.has(me)) {\n dependentStoreConfigs.get(me).push(config);\n } else {\n dependentStoreConfigs.set(me, [config]);\n }\n\n // if foreign key specifies collectionName the related store should also be configured\n if (config.collectionName) {\n relatedStore.initRelationCollection(config, me);\n }\n\n if (relatedStore.count > 0) {\n relatedStore.updateDependentStores('dataset', relatedStore.records);\n }\n }\n });\n }\n }", "static associate(models) {\n // define association here\n Module.belongsTo(models.Developer,{\n foreignKey:\"id_developer\",\n });\n\n Module.belongsTo(models.Proyect,{\n foreignKey:\"id_proyect\",\n });\n\n Module.hasMany(models.Chat,{\n foreignKey:\"id_modulo\",\n });\n\n }", "static get relationMappings() {\n return {\n todos: {\n relation: Model.HasManyRelation,\n modelClass: Todo,\n join: {\n from: \"t_author_todos.todo_id\",\n to: \"t_todos.id\"\n }\n }\n };\n }", "static associate (models) {\n // define association here\n models.Stream.belongsTo(models.Streamer)\n models.Stream.belongsTo(models.Game)\n\n models.Stream.hasMany(models.Viewer)\n models.Stream.hasMany(models.Follower)\n }", "static associate(models) {\n // define association here\n models.Comments.belongsTo(models.Users, {\n foreignKey: \"fk_userId\",\n as: \"comments\",\n });\n models.Comments.belongsTo(models.Contents, {\n foreignKey: \"fk_contentId\",\n as: \"commentsContent\",\n });\n }", "static associate(models) {\n this.belongsTo(models.User, { foreignKey: 'user_id', as: 'user' });\n this.belongsTo(models.User, { foreignKey: 'follower_id', as: 'follower' });\n\n }", "static get relationMappings() {\n return {\n categories: {\n relation: Model.HasManyRelation,\n // The related model.\n modelClass: Categories,\n join: {\n from: 'Service.id',\n to: 'Categories.service_id'\n }\n },\n branch: {\n relation: Model.BelongsToOneRelation,\n // The related model.\n modelClass: Branch,\n join: {\n from: 'Service.branch_id',\n to: 'Branch.id'\n }\n }\n }\n }", "static associate(models) {\n this.belongsTo(models.User, {\n foreignKey: 'userId',\n });\n this.belongsTo(models.Property, {\n foreignKey: 'propertyId',\n });\n this.hasMany(models.ReportComment, {\n as: 'receivedCommentReports',\n foreignKey: 'commentId',\n onDelete: 'CASCADE',\n hooks: true,\n });\n }", "static associate(models) {\n Obra.hasMany(models.AvanceObra, { foreignKey: 'idObra' })\n Obra.belongsTo(models.Cliente);\n Obra.belongsToMany(models.Trabajadores, { through: models.Obra_Trabajadores, as: \"trabajadores\",\n foreignKey: \"obraId\", });\n }", "static associate(models) {\n Ad.belongsToMany(models.Realtor, {through: models.RealtorAd})\n Ad.hasMany(models.RealtorAd);\n }", "static associate(models) {\n // define association here\n this.belongsTo(models.Tournament);\n this.belongsTo(models.Person);\n this.hasOne(models.Team,{as: 'Speaker1'});\n this.hasOne(models.Team,{as: 'Speaker2'});\n }", "static associate(models) {\n // define association here\n // Follower.hasMany(models.User, {\n // foreignKey: [\"followeeid\", \"followerid\"],\n // });\n }", "static associate(models) {\n this.belongsTo(models.Assignment, { foreignKey: 'idOrden' });\n this.hasMany(models.PoliceSignNewsReport, { foreignKey: 'numRegistro' });\n }", "static associate(models) {\n // define association here\n this.belongsTo(models.User, {\n foreignKey: \"tenant_id\",\n onDelete: \"CASCADE\",\n });\n this.belongsTo(models.Property, {\n foreignKey: \"property_id\",\n onDelete: \"CASCADE\",\n });\n this.hasMany(models.Application, {\n foreignKey: \"renthistories_id\",\n });\n this.hasMany(models.Ref_request, {\n foreignKey: \"renthistories_id\",\n });\n }", "static associate(models) {\n models.Post.belongsTo(models.User, {\n foreignKey: \"UserId\"\n })// le modèle Post peut avoir plusieur user\n models.Post.hasMany(models.Likes,{ onDelete: 'cascade' }) // le modèle Post peut avoir plusieur like\n models.Post.hasMany(models.Commentary, { onDelete: 'cascade' }) // le modèle Post peut avoir plusieur commentaires\n }", "static associate(models) {\n this.hasMany(Order);\n }", "static associate(models) {\n\t\t\t// define association here\n\t\t\tthis.belongsTo(models.Conversation, {\n\t\t\t\tforeignKey: \"conversationId\",\n\t\t\t\tas: \"conversation\",\n\t\t\t})\n\n\t\t\tthis.belongsTo(models.User, {\n\t\t\t\tforeignKey: \"senderId\",\n\t\t\t\tas: \"sender\",\n\t\t\t})\n\t\t}", "static get relationMappings() {\n // Import models here to prevent require loops.\n const Sticker = require('./Sticker');\n\n return {\n stickers: {\n relation: BaseModel.HasManyRelation,\n // The related model. This can be either a Model\n // subclass constructor or an absolute file path\n // to a module that exports one.\n modelClass: Sticker,\n join: {\n from: StickerGroup.tableName + '.id',\n to: Sticker.tableName + '.stickerGroupId'\n }\n }\n };\n }", "static associate(models) {\n // define association here\n // list belongs to one user\n models.Lists.belongsTo(models.Users, {\n foreignKey: \"user_id\",\n onDelete: \"CASCADE\",\n });\n // list has many items\n models.Lists.hasMany(models.Items, {\n foreignKey: \"list_id\",\n onDelete: \"CASCADE\",\n });\n }", "static associate(models) {\n \n // Route.belongsTo(db.Velouser, { foreignKey: 'userId'});\n // db.Velouser.hasMany(db.Route, { foreignKey: 'userId'});\n }", "static associate(models) {\n this.user = this.belongsTo(models.User, {\n foreignKey: 'user_id',\n });\n this.bid_order = this.belongsTo(models.Order, {\n foreignKey: 'bid_order_id',\n });\n this.ask_order = this.belongsTo(models.Order, {\n foreignKey: 'ask_order_id',\n });\n }", "static associate(models) {\n // define association here\n\t\t\tFeedBack.belongsTo(models.widget, { foreignKey: 'widget_id' });\n\t\t\tFeedBack.hasMany(models.feedback_answer, { foreignKey: 'feedback_id' });\n }", "static associate(models) {\n Pessoas.hasMany(models.Turmas, { \n foreignKey : 'docente_id'\n });\n Pessoas.hasMany(models.Matriculas, { \n foreignKey : 'estudante_id', \n /**\n * Escopo de associacao.\n * Funciona como \"where status = 'confirmado'\"\n */\n scope : { status : 'confirmado' },\n /**\n * Nome do \"mixim\" personalizado \"getAulasMatriculadas()\"\n * Mixins são métodos que podem ser utilizados por \n * outras classes, sem a necessidade de herança direta.\n * Eles existem somente nas intâncias dos modelos\n */\n as : 'aulasMatriculadas'\n });\n }", "static associate(models) {\n Resposible_people.belongsTo(models.Responsible_type, {\n foreignKey: \"responsible_type_id\",\n });\n Resposible_people.belongsTo(models.Transition, {\n foreignKey: \"transition_id\",\n });\n }", "static associate(models) {\n // define association here\n this.OwnTeams = this.hasMany(models.Team, {\n foreignKey: 'ownerId',\n as: 'ownTeams'\n });\n\n this.Members = this.hasMany(models.Member, {\n foreignKey: 'userId',\n as: 'members'\n });\n }", "static exposeRelations() {\n const me = this;\n\n if (me.hasOwnProperty('relationsExposed')) return;\n\n if (me.relationConfig) {\n me.relationsExposed = true;\n me.relations = [];\n\n me.relationConfig.forEach((relation) => {\n me.relations.push(relation);\n\n let name = relation.relationName;\n\n // getter and setter for related object\n if (!Reflect.ownKeys(me.prototype).includes(name)) {\n Object.defineProperty(me.prototype, name, {\n enumerable: true,\n get: function() {\n // noinspection JSPotentiallyInvalidUsageOfClassThis\n return this.getForeign(name);\n },\n set: function(value) {\n // noinspection JSPotentiallyInvalidUsageOfClassThis\n this.setForeign(name, value, relation);\n }\n });\n }\n });\n }\n }", "static associate (models) {\n this.belongsTo(models.UserType, { foreignKey: 'userTypeId' })\n\n this.hasMany(models.Order, { foreignKey: 'playerId' })\n this.hasMany(models.News, { foreignKey: 'userId' })\n this.hasMany(models.Stock, { foreignKey: 'playerId' })\n this.hasMany(models.PlayerCompetition, { foreignKey: 'playerId', as: 'playercompetition' })\n this.hasMany(models.Evaluation, { foreignKey: 'managerId' })\n\n this.hasMany(models.Order, { foreignKey: 'playerId' })\n this.hasMany(models.News, { foreignKey: 'userId' })\n this.hasMany(models.Stock, { foreignKey: 'playerId' })\n this.hasMany(models.PlayerCompetition, { foreignKey: 'playerId' })\n\n this.hasMany(models.Competition, { foreignKey: 'managerId', as: 'competitions' })\n }", "static associate(models) {\n this.belongsTo(models.Usuario, { foreignKey: 'usuarioId', as: 'usuario'});\n this.belongsTo(models.Articulo, { foreignKey: 'articuloId', as: 'articulo'});\n }", "static associate(models) {\n this.belongsTo(models.User, { as: 'Interviewer', foreignKey: 'interviewerId' });\n this.belongsTo(models.User, { as: 'Mentor', foreignKey: 'mentorId' });\n }", "static associate(models) {\n // define association here\n this.belongsTo(models.User, { foreignKey: 'userId' });\n this.belongsTo(models.Question, { foreignKey: 'questionId' });\n }", "static associate(models) {\n // define association here\n Nanny.belongsTo(models.Parent);\n Nanny.belongsTo(models.Agency);\n Nanny.belongsToMany(models.Child, { through: models.NannyChild });\n Nanny.belongsTo(models.Parent, {\n sourceKey: \"id\",\n foreignKey: \"ParentId\",\n });\n Nanny.belongsTo(models.Agency, {\n sourceKey: \"id\",\n foreignKey: \"AgencyId\",\n });\n }", "static associate(models) {\n Pessoas.hasMany(models.Turmas, {\n foreignKey: 'docente_id'\n })\n Pessoas.hasMany(models.Matriculas, {\n foreignKey: 'estudante_id',\n scope: {status: 'confirmado'},\n as: 'aulasMatriculadas'\n })\n }", "static associate(models) {\n // Fund.belongsTo(models.User, { foreignKey: ownerId });\n // Fund.belongsTo(models.Category, { foreignKey: categoryId });\n // Fund.hasMany(models.Exchange, { foreignKey: fundId });\n // Fund.hasMany(models.Contributor, { foreignKey: fundId });\n }", "static associate(models) {\n this.hasMany(models.Nhanvien,{foreignKey:'vitriId'})\n }", "static associate(models) {\n Device.belongsTo(models.Client, { as: 'client', foreignKey: 'clientId' });\n Device.hasMany(models.History, { as: 'history', foreignKey: 'deviceId' })\n }", "static associate(models) {\n this.belongsTo(models.customer);\n this.hasMany(models.itemRental);\n this.hasMany(models.additive);\n }", "static associate(models) {\n // define association here\n models.Nuddge.belongsTo(models.User, {as: 'user', foreignKey: 'user_id'})\n }", "static associate(models) {\r\n this.hasMany(models.Team, {\r\n foreignKey: 'creator',\r\n });\r\n // define association here\r\n }", "static associate(models) {\n this.belongsTo(models.Perfil, { foreignKey: { name: 'COD_PERFIL' } })\n this.hasMany(models.Entrega, { foreignKey: { name: 'COD_USUARIO' } })\n this.belongsToMany(models.Tcc, { through: 'TB_ALUNO_TCC' })\n this.belongsTo(models.Curso, { foreignKey: { name: 'COD_CURSO' } })\n this.hasMany(models.Tcc, { foreignKey: { name: 'COD_PROFESSOR_ORIENTADOR', allowNull: false } })\n }", "static associate(models) {\n this.hasMany(models.Image, {\n foreignKey: \"imageableId\",\n onDelete: \"CASCADE\",\n hooks: true,\n scope: {\n imageableType: \"product\",\n },\n });\n\n this.hasMany(models.Arrival, {\n foreignKey: \"productId\",\n onDelete: \"CASCADE\",\n hooks: true,\n });\n\n this.belongsTo(models.Category, {\n foreignKey: \"categoryId\",\n });\n\n this.belongsToMany(models.Bill, {\n through: \"BillProducts\",\n });\n\n this.belongsToMany(models.Cart, {\n through: \"CartProducts\",\n });\n\n this.belongsToMany(models.Wishlist, {\n through: \"WishlistProducts\",\n });\n }", "static associate(models) {\n // define association here\n this.belongsTo(models.Tipo_tarjeta,{\n foreignKey:'tipo_id'\n })\n this.belongsTo(models.Cliente,{\n foreignKey: 'cliente_id'\n });\n }", "static associate(models) {\n // define association here\n this.belongsTo(models.content, {\n foreignKey: 'contentid'\n });\n this.belongsTo(models.group, {\n foreignKey: 'groupid'\n })\n }", "static associate(models) {\n \n this.belongsTo(models.MentorProgram, {\n foreignKey: \"mentorProgramId\",\n });\n this.belongsTo(models.Student, {\n foreignKey: \"studentId\",\n });\n this.belongsTo(models.Mentor, {\n foreignKey: \"mentorId\",\n });\n this.hasMany(models.Meeting, {\n foreignKey: \"pairId\",\n });\n\n }", "initRelations() {\n const me = this,\n relations = me.constructor.relations;\n\n if (!relations) return;\n\n // TODO: feels strange to have to look at the store for relation config but didn't figure out anything better.\n // TODO: because other option would be to store it on each model instance, not better...\n\n me.stores.forEach((store) => {\n if (!store.modelRelations) store.initRelations();\n\n // TODO: not at all tested for multiple stores, can't imagine it works as is\n const relatedRecords = [];\n\n store.modelRelations &&\n store.modelRelations.forEach((config) => {\n relatedRecords.push({ related: me.initRelation(config), config });\n });\n store.updateRecordRelationCache(me, relatedRecords);\n });\n }", "static associate(models) {\n Document.belongsTo(models.User);\n Document.belongsTo(models.Signalement);\n Document.belongsTo(models.Ref_Doc_Type);\n }", "static associate(models) {\n this.belongsTo(models.Role, { foreignKey: \"roleId\" });\n this.hasMany(models.Students, { as: \"student\", foreignKey: \"user_id\" });\n this.hasMany(models.Teachers, { as: \"teacher\", foreignKey: \"user_id\" });\n }", "static associate(models) {\n // define association here\n this.belongsTo(models.Content_Types, {\n foreignKey: 'id_Content_Type'\n });\n\n this.hasOne(models.Contents, {\n foreignKey: 'id_Content_Rating'\n });\n }", "static associate(models) {\n cd.belongsTo(models.list);\n // define association here\n }", "static associate(models) {\n // define association here\n Reimbursment.belongsTo(models.Employee, {foreignKey: 'employee_id', targetKey: 'id'})\n }", "static associate(models) {\n User.hasMany(models.Comment)\n User.hasMany(models.Story)\n }", "static associate(models) {\n models.comment.belongsToMany(models.users, { through: 'likes', foreignKey: 'commentId', sourceKey: 'id' });\n\n models.comment.belongsTo(models.users, { foreignKey: 'userId', sourceKey: 'id', onDelete: 'cascade' });\n models.comment.belongsTo(models.items, { foreignKey: 'itemId', sourceKey: 'id', onDelete: 'cascade' });\n // define association here\n }", "static associate(models) {\n // define association here\n Entreprise.belongsTo(models.Client)\n Entreprise.belongsToMany(models.Paper, {through: models.PaperAdvancement})\n }", "static associate(models) {\n \n this.belongsTo(models.Pedido, {\n foreignKey: \"idPedido\",\n as: 'Pedido'\n });\n }", "static associate(models) {\n Question.hasMany(models.QuestionOption, {foreignKey:'questionId',\n as: 'options'\n });\n Question.belongsTo(models.Category, {\n foreignKey: \"categoryId\",\n allowNull: false,\n as: 'category'\n });\n Question.hasMany(models.Language, {\n foreignKey: 'questionId',\n as: \"languages\"\n });\n }", "static associate(models) {\n // define association here\n Order.belongsTo(models.User, { foreignKey: 'orderedBy' });\n Order.hasMany(models.Transaction, {\n foreignKey: 'order_id',\n onDelete: 'CASCADE',\n onUpdate: 'CASCADE'\n });\n }", "static associate(models) {\n Polls.hasMany(models.PollQuestions, {\n as:'questions',\n foreignKey: 'poll_id'\n });\n Polls.belongsTo(models.Users, {\n foreignKey: 'user_id'\n });\n }", "static exposeRelations() {\n const me = this;\n if (me.hasOwnProperty('relationsExposed')) return;\n\n if (me.relationConfig) {\n me.relationsExposed = true;\n me.relations = [];\n me.relationConfig.forEach(relation => {\n me.relations.push(relation);\n const name = relation.relationName; // getter and setter for related object\n\n if (!Reflect.ownKeys(me.prototype).includes(name)) {\n Object.defineProperty(me.prototype, name, {\n enumerable: true,\n get: function () {\n // noinspection JSPotentiallyInvalidUsageOfClassThis\n return this.getForeign(name);\n },\n set: function (value) {\n // noinspection JSPotentiallyInvalidUsageOfClassThis\n this.setForeign(name, value, relation);\n }\n });\n }\n });\n }\n }", "static associate(models) {\n // define association here\n TodoList.belongsTo(models.User)\n }", "static associate(models) {\n this.belongsTo(models.Autor, {\n as: 'autors',\n foreignKey: 'autor_id'\n })\n }", "static associate(models) {\n\t\t// define association here\n\t\tmodels.Message.belongsTo(models.User, {\n\t\t\tforeignKey: {\n\t\t\t\tname: \"userId\",\n\t\t\t\tallowNull: false,\n\t\t\t}\n\t\t}),\n\t\tmodels.Message.hasMany(models.Comment)\n\t}", "static associate(models) {\n // define association here\n UserDonations.belongsTo(models.Users)\n UserDonations.belongsTo(models.Campaigns)\n\n }", "static associate(models) {\n // define association here\n ProductCategory.hasMany(models.Product)\n ProductCategory.hasMany(models.ProductCategory, {\n foreignKey: 'parentId',\n })\n }", "static associate(models) {\n Denuncias.belongsToMany(models.Curso, {\n through: models.Denuncia_curso,\n foreignKey: 'id_denuncia'\n })\n Denuncias.belongsTo(models.Usuario_pcd, {\n foreignKey: 'id_usuario_pcd'\n }) \n }", "static associate(models) {\n Turmas.belongsTo(models.Cursos, {\n foreignKey: 'id_cursos'\n })\n Turmas.hasMany(models.Materias, {\n foreignKey: 'id_turmas'\n })\n Turmas.belongsTo(models.Alunos, {\n foreignKey: 'id_turmas'\n })\n }", "static associate(models) {\n models.Trip.hasMany(models.Comment, { as: 'comments', foreignKey: 'tripId'})\n }", "static associate(models) {\n this.belongsTo(models.User, {\n as: 'buyerUser',\n foreignKey: 'buyerId',\n });\n this.belongsTo(models.User, {\n as: 'sellerUser',\n foreignKey: 'sellerId',\n });\n this.belongsTo(models.Property, {\n foreignKey: 'propertyId',\n });\n }", "static associate(models) {\n // define association here\n RoomUsage.belongsTo(models.Rooms)\n RoomUsage.belongsTo(models.Client)\n }", "static associate(models) {\n // define association here\n Bairro.belongsTo(models.Cidade, { foreignKey: 'cidadeId' });\n Bairro.hasMany(models.Faculdade, { foreignKey: 'bairroId' });\n }", "static associate(models) {\n models.topic.belongsTo(models.user, { foreignKey: 'userId'})\n models.topic.hasMany(models.reply, { foreignKey: 'topicId' });\n }", "static associate(models) {\n this.channelId = this.belongsTo(models.Order, {\n foreignKey: 'id',\n onDelete: 'CASCADE'\n });\n }", "static associate(models) {\n // define association here\n Destination.belongsTo(models.User, { foreignKey: 'authorId' })\n Destination.belongsTo(models.Category, { foreignKey: 'categoryId' })\n Destination.belongsToMany(models.User, { through: 'Wishlist', foreignKey: 'DestinationId' })\n }", "static associate(models) {\n this.hasMany(models.MedicalRecord);\n this.belongsTo(models.Member, {\n foreignKey: 'member_id',\n });\n }", "static associate(models) {\n this.hasMany(models['Brand'], { foreignKey: 'supplier_id' });\n }", "static associate(models) {\n Lecturer.hasMany(models.Subject, {\n foreignKey: 'lecturerId'\n })\n }", "static associate(models) {\n // define association here\n Comment.belongsTo(models.User, {foreignKey: 'userId'})\n Comment.belongsTo(models.Post, {foreignKey: 'postId'})\n Comment.hasMany(models.Liking, {foreignKey: 'id'})\n }", "static associate(models) {\n // define association here\n this.hasMany(models.Friendship, { foreignKey: \"user_1\" });\n this.hasMany(models.Friendship, { foreignKey: \"user_2\" });\n this.hasMany(models.Post, { foreignKey: \"userId\" });\n this.hasMany(models.Likes, { foreignKey: \"userId\" });\n this.belongsToMany(models.Chat, {\n through: \"ChatUser\",\n foreignKey: \"userId\",\n });\n this.hasMany(models.ChatUser, { foreignKey: \"userId\" });\n this.hasMany(models.Message, { foreignKey: \"fromUserId\" });\n this.hasMany(models.LastReadMessage, { foreignKey: \"chatId\" });\n }", "static associate(models) {\n this.belongsTo(models.User, {\n foreignKey: { allowNull: false },\n });\n this.belongsToMany(models.Template, { through: models.TemplatePlans });\n this.belongsToMany(models.Group, { through: models.GroupPlans });\n }", "static associate(models) {\n Stop.hasOne(models.Watcher, { foreignKey: 'stopId', as: 'watcher' })\n Stop.hasMany(models.Answer, { foreignKey: 'stopId', as: 'answers' })\n }", "static associate(models) {\n // define association here\n models.producto.belongsToMany(models.lista_producto, {through: this, foreignKey: 'productoId'})\n models.lista_producto.belongsToMany(models.producto, {through: this, foreignKey: 'listaId'})\n }", "static associate(models) {\n // define association here\n this.belongsTo(models.credential, { foreignKey: 'credential_id' })\n this.belongsTo(models.destination_package, { foreignKey: 'package_id' })\n }", "static associate(models) {\n // define association here\n Commande.belongsTo(models.User)\n Commande.belongsTo(models.UserAdresse)\n Commande.belongsTo(models.Plan)\n Commande.belongsToMany(models.CartItem, {\n through: models.OrderItem,\n foreignKey: 'commandeId',\n otherKey: 'cartItemId'\n })\n Commande.hasOne(models.Facture)\n Commande.hasMany(models.Contrat)\n Commande.hasMany(models.Livraison)\n Commande.belongsToMany(models.CompteParrainage,\n {\n through: models.OrderParrain\n })\n\n }", "static associate(models) {\n this.belongsTo(models.User)\n this.belongsTo(models.Tenant)\n this.belongsTo(models.Group)\n }", "static associate(models) {\n // define association here\n room.hasMany(models.scene);\n }", "static associate(models) {\n // define association here\n User.hasMany(models.Order)\n }", "static associate(models) {\n review.belongsTo(models.user);\n review.belongsTo(models.study);\n }", "static associate(models) {\n // define association here\n models.Product.hasMany(models.ProductSubImage, {\n foreignKey: 'productId',\n });\n models.Product.hasMany(models.ProductDescription, {\n foreignKey: 'productId',\n });\n models.Product.hasMany(models.Auction, {\n foreignKey: 'productId',\n });\n }", "initRelations() {\n const me = this,\n relations = me.constructor.relations;\n if (!relations) return; // TODO: feels strange to have to look at the store for relation config but didn't figure out anything better.\n // TODO: because other option would be to store it on each model instance, not better...\n\n me.stores.forEach(store => {\n if (!store.modelRelations) store.initRelations(); // TODO: not at all tested for multiple stores, can't imagine it works as is\n\n const relatedRecords = [];\n store.modelRelations && store.modelRelations.forEach(config => {\n relatedRecords.push({\n related: me.initRelation(config),\n config\n });\n });\n store.updateRecordRelationCache(me, relatedRecords);\n });\n }", "static associate(models) {\n // define association here\n this.hasMany(models.Tags , { foreignKey:'tag_id', as:'tags' });\n\n }", "static associate (models) {\n Observador.belongsTo(models.Estacion)\n Observador.hasOne(models.Estacion, { as: 'Jefe', constraints: false })\n Observador.belongsTo(models.User)\n }" ]
[ "0.6739632", "0.67277414", "0.6565137", "0.65439147", "0.6532572", "0.64931107", "0.6490322", "0.64894485", "0.648", "0.6471423", "0.646265", "0.6460769", "0.645274", "0.6448185", "0.6434868", "0.64329445", "0.6419785", "0.641965", "0.6417124", "0.6396574", "0.63895756", "0.6388196", "0.63871396", "0.6379923", "0.6379422", "0.6377251", "0.6369487", "0.63665473", "0.6356122", "0.63476497", "0.6343632", "0.6342533", "0.634135", "0.63405675", "0.6339085", "0.6335423", "0.63292724", "0.63220865", "0.63193643", "0.63112986", "0.63106227", "0.63078", "0.6303886", "0.630166", "0.62963605", "0.62926733", "0.6289249", "0.6288709", "0.62876225", "0.62861705", "0.6284707", "0.6283142", "0.62824476", "0.62792885", "0.62728506", "0.6270916", "0.62646264", "0.6258806", "0.625761", "0.6255199", "0.62508273", "0.62481207", "0.62464494", "0.6238008", "0.62376636", "0.6235444", "0.6235378", "0.62342983", "0.6233532", "0.6224928", "0.6221509", "0.6218618", "0.6215258", "0.6215171", "0.6210693", "0.6207141", "0.6206633", "0.6203635", "0.6201681", "0.62009686", "0.61971825", "0.61959153", "0.6195514", "0.6194028", "0.6189767", "0.61894697", "0.61868405", "0.6186688", "0.61827546", "0.61783427", "0.6176253", "0.6176161", "0.6160503", "0.61594355", "0.61592865", "0.6158292", "0.6156482", "0.61563855", "0.6155906", "0.6151596", "0.6151458" ]
0.0
-1
Signature a la souris
initMouse() { this.canvas.addEventListener("mousedown", (e) => this.start(this.getPositionSouris(e))); this.canvas.addEventListener("mouseup", (e) => this.stop()); this.canvas.addEventListener("mousemove", (e) => this.move(this.getPositionSouris(e))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeSignature(params) {\n\tif (!params) return \"()\";\n\tvar signature = \"(\"\n\t+\n\tparams.filter(\n\t\tfunction($) {\n\t\t\treturn $.name.indexOf(\".\") == -1; // don't show config params in signature\n\t\t}\n\t).map(\n\t\tfunction($) {\n\t\t\treturn $.name;\n\t\t}\n\t).join(\", \")\n\t+\n\t\")\";\n\treturn signature;\n}", "static get signature () {\n return `make:auth`\n }", "function getSignature() {\r\n var encode = \"\"\r\n for(var i = 0; i < arguments.length; i++) {\r\n encode += arguments[i]\r\n }\r\n encode += secret\r\n return Qt.md5(encode)\r\n}", "function getSignature() {\n var encode = \"\"\n for(var i = 0; i < arguments.length; i++) {\n encode += arguments[i]\n }\n encode += secret\n return Qt.md5(encode)\n}", "function check_go_signature() {\n\tif(action == 'pick-up' || action == 'delivered') {\n\t\tshow('page-signature');\n\t} else {\n\t\tcheck_go_image_pod();\n\t}\n}", "function test(){\n\tassert.ok(ostatus.salmon.verify_signature(me, key));\n}", "function signSha(swc, options) {\n var pars = [];\n var host = url.parse(swc.config.market.huobi.baseUrl).host;\n for (let item in options.body) {\n pars.push(item + \"=\" + encodeURIComponent(options.body[item]));\n }\n var p = pars.sort().join(\"&\");\n var meta = [options.method, host, options.path, p].join('\\n');\n var hash = HmacSHA256(meta, swc.config.market.huobi.secretKey);\n var Signature = encodeURIComponent(CryptoJS.enc.Base64.stringify(hash));\n // console.log(`Signature: ${Signature}`);\n p += `&Signature=${Signature}`;\n // console.log(p);\n return p;\n}", "function collectCustomHooksForSignature(type) {\n {\n var signature = allSignaturesByType.get(type);\n if (signature !== undefined) {\n computeFullKey(signature);\n }\n }\n }", "function signTheFile() {\n var plaintext = document.querySelector('.output').value\n // initialize\n var sig = new KJUR.crypto.Signature({\"alg\": \"SHA1withRSA\"});\n // initialize for signature generation\n sig.init(object_2.private_key); // rsaPrivateKey of RSAKey object\n // update data\n sig.updateString(plaintext)\n // calculate signature\n signature = sig.sign()\n alert(\"signature signed.If you will make any changes in given signature it will become invalid\");\n } // end of signTheFile click handler", "function collectCustomHooksForSignature(type) {\n var signature = allSignaturesByType.get(type);\n if (signature !== undefined) computeFullKey(signature);\n }", "function makeSignature(obj, binanceSecret) {\n //console.log(\"makeSignature\", obj, binanceSecret);\n let s = \"\",\n res;\n Object.keys(obj).forEach((e) => {\n s = s + e + \"=\" + obj[e] + \"&\";\n });\n //console.log(s.slice(0, s.length - 1));\n const hmac = crypto.createHmac(\"sha256\", binanceSecret);\n hmac.update(s.slice(0, s.length - 1));\n res = hmac.digest(\"hex\");\n return { qs: s, signature: res };\n}", "function getSignature()\n{\n var timeStamp = Math.floor((new Date()).getTime()/1000);\n return (md5(api_key+shared_secret+timeStamp));\n}", "_generateSignature(opc) {\n if (this._apiToken) {\n opc.headers.Authorization = `${this._apiToken}`;\n }\n if (this._mustSign) {\n let timestamp = new Date().getTime();\n opc.headers['x-logtrust-apikey'] = this._apiKey;\n opc.headers['x-logtrust-timestamp'] = timestamp;\n const body = opc.body ? JSON.stringify(opc.body) : ''\n const signMsg = this._apiKey + body + timestamp;\n opc.headers['x-logtrust-sign'] =\n HmacSHA256(signMsg, this._apiSecret).toString();\n }\n }", "signature (sigOrTitle) {\n const signatures = this.signatures;\n // if given a title for an existing signature, returns it\n if (signatures.hasOwnProperty(sigOrTitle)) return signatures[sigOrTitle];\n // constructs a new signature or uses an existing one (if an existing one was passed in)\n const signature = (sigOrTitle instanceof Signature ? sigOrTitle : new Signature(sigOrTitle, this));\n return signatures[signature.title] = signature;\n }", "function getFunctionSignature(which){\n var sigs = {};\n sigs.connect = {\n spec : \"WOQLClient.connect(surl, key)\",\n descr : \"\\n\\nConnect to a Terminus server at the given URI with an API key\"\n + \"Stores the terminus:ServerCapability document returned in the connection register\"\n + \"which stores, the url, key, capabilities, and database meta-data for the connected server\"\n + \"If the curl argument is false or null, the this.server will be used if present,\"\n + \" or the promise will be rejected.\"\n + \"\\n1)The first (surl) argument: {string} argument it is the Server Url\"\n + \"\\n2)The second(key) argument: {string} argument contains an API key\",\n result : \"HTTP 200 on success, 409 for already existing database, otherwise error code\",\n args : {server_url : 'url', key: 'Api key'},\n options: { title: \"\", description: \"\" }\n };\n sigs.create = {\n spec : \"WOQLClient.createDatabase(dburl, details, key)\",\n descr : \"\\n\\nCreate a Terminus Database\"\n + \"\\n1)The first (dburl) argument:{string}, it is a terminusDB Url or a terminusDB Id \"\n + \"\\n2)The second(details) argument:{object}, details which is the payload\"\n + \"\\n which included information of the new database to be created\"\n + \"\\n3)The third (key) argument:{string}, contains an API key \",\n result : \"HTTP 200 on success, 409 for already existing database, otherwise error code\",\n args : {database_url : 'url', details: '', key: ' Api key'},\n options: { title: \"\", description: \"\" }\n };\n sigs.delete = {\n spec : \"WOQLClient.deleteDatabase(dburl, key)\",\n descr : \"\\n\\nDeletes a Database\"\n + \"\\n1)The first (dburl) argument: {string}, it is a terminusDB Url or a terminusDB Id \"\n + \"\\n2)The second(key) argument: {string}, contains an API key\",\n result: \"HTTP 200 on success, otherwise error code\",\n };\n sigs.getSchema = {\n spec : \"WOQLClient.getSchema(surl, options)\",\n descr : \"\\n\\nGets the schema of a database.\"\n +\"\\n1)The first (surl) argument: {string}, it is a dbUrl/schema\"\n + \"\\n2)The second(key) argument: {string}, contains an API key\",\n result : \"Ontology Document on success (HTTP 200), 409 for already existing database, otherwise error code\",\n options: { format: \"turtle\" }\n };\n sigs.getClassFrames = {\n spec : \"WOQLClient.getClassFrame = function(cfurl, cls, opts)\",\n descr : \"\\n\\nRetrieves a WOQL query on the specified database which updates the state and returns the results\"\n + \"\\nThe first (cfurl) argument can be\"\n + \"\\n1) a valid URL of a terminus database or\"\n + \"\\n2) omitted - the current database will be used\"\n + \"\\nthe second argument (cls) is the URL / ID of a document class that exists in the database schema\"\n + \"\\nthe third argument (opts) is an options json - opts.key is an optional API key\",\n result : \"Ontology Document on success (HTTP 200), 409 for already existing database, otherwise error code\",\n options: { format: \"turtle\" }\n };\n sigs.updateSchema = {\n spec : \"WOQLClient.updateSchema(schurl, docs, options)\",\n descr : \"\\n\\nUpdates the Schema of the specified database\"\n +\"\\n1)The first (surl) argument :{string}, is a dbUrl/schema\"\n + \"\\n2)The second(docs) argument:{object}, is a valid owl ontology (new schema to be updated) in turtle format\"\n + \"\\n3)The third (key) argument:{string}, contains an API key\",\n result : \"Ontology Document on success (HTTP 200), 409 for already existing database, otherwise error code\",\n args : {document : 'doc'},\n options: { format: \"turtle\", editmode: \"replace\"}\n };\n sigs.createDocument = {\n spec : \"WOQLClient.createDocument(docurl, document, options)\",\n descr : \"\\n\\nCreates a new document in the specified database\"\n + \"\\n1)The first (docurl) argument: {string}, is a dbUrl/document/document_id\"\n + \"\\n2)The second(document) argument: {object}, is a valid document in json-ld\"\n + \"\\n3)The third (key) argument:{string}, contains an API key\",\n result : \"Created Document on success (HTTP 200), Violation Report Otherwise (HTTP 400+)\",\n args : {document_url : 'url', document: \"doc\"},\n options: { format: \"turtle\", fail_on_id_denied: false}\n };\n sigs.viewDocument = {\n spec : \"WOQLClient.getDocument(docurl, options)\",\n descr : \"\\n\\nRetrieves a document from the specified database\"\n + \"\\n1)The first (docurl) argument: {string}, is a dbUrl/document/document_id\"\n + \"\\n2)The second (key) argument: {string}, contains an API key\",\n result : \"Document (HTTP 200), Violation Report Otherwise (HTTP 400+)\",\n args : {document_url : 'url'},\n options: { format: \"turtle\"}\n };\n sigs.updateDocument = {\n spec : \"WOQLClient.updateDocument(docurl, document, options)\",\n descr : \"\\n\\nUpdates a document in the specified database with a new version\"\n + \"\\n1)The first (docurl) argument: {string}, is a dbUrl/document/document_id\"\n + \"\\n2)The second(document) argument: {object}, is a valid document in json-ld\"\n + \"\\n3)The third (key) argument:{string} argument contains an API key\",\n result : \"Ontology Document on success (HTTP 200), 409 for already existing database, otherwise error code\",\n args : {document_url : 'url', document: \"doc\"},\n options: { format: \"turtle\", editmode: \"replace\"}\n };\n sigs.deleteDocument = {\n spec : \"WOQLClient.deleteDocument(docurl, key)\",\n descr : \"\\n\\nDeletes a document from the specified database\"\n + \"\\n1)The first (docurl) argument: {string},is a dbUrl/document/document_id\"\n + \"\\n2)The second (key) argument: {string}, contains an API key\",\n result: \"Ontology Document on success (HTTP 200), 409 for already existing database, otherwise error code\",\n args : {document_url : 'url'},\n };\n sigs.select = {\n spec: \"WOQLClient.select(dburl, query, options)\",\n descr: \"\\n\\nExecutes a read-only WOQL query on the specified database and returns the results\"\n + \"\\n1)The first (docurl) argument: {string}, is a terminusDB Url or a terminusDB Id\"\n + \"\\n2)The second (query) argument: {object}, a valid query in json-ld format \"\n + \"\\n3)The third (key) argument:{string}, contains an API key\",\n result: \"WOQL Result (HTTP 200), otherwise error code\",\n args: {woql: 'woql'},\n };\n sigs.update = {\n spec : \"WOQLClient.update(dburl, query, options)\",\n descr : \"\\n\\nExecutes a WOQL query on the specified database which updates the state and returns the results\"\n + \"\\n1)The first (dburl) argument: {string}, is a terminusDB Url or a terminusDB Id\"\n + \"\\n2)The second (query) argument: {object}, a valid query in json-ld format \"\n + \"\\n3)The third (key) argument:{string}, contains an API key\",\n result: \"WOQL Result (HTTP 200), otherwise error code\",\n args : {woql: 'woql'},\n };\n sigs.lookup = {\n spec: \"WOQLClient.lookup(database_url, woql, options)\",\n result: \"WOQL Result (HTTP 200), otherwise error code\",\n args: {class: 'url', term: 'string'},\n };\n sigs.map = {\n spec: \"WOQLClient.lookup(source, target, woql, options)\",\n result: \"WOQL Result (HTTP 200), otherwise error code\",\n args: {source: 'json', target: \"json\", woql: 'json'},\n };\n sigs.getClassFrame = {\n spec: \"WOQLClient.getClassFrame(class, options)\",\n result: \"WOQL Result (HTTP 200), otherwise error code\",\n args: {class: 'url'},\n };\n sigs.getPropertyFrame = {\n spec: \"WOQLClient.getPropertyFrame(class, property, options)\",\n result: \"WOQL Result (HTTP 200), otherwise error code\",\n args: {class: 'url', property: 'url'},\n };\n sigs.getFilledPropertyFrame = {\n spec: \"WOQLClient.getPropertyFrame(document_url, property, options)\",\n result: \"WOQL Result (HTTP 200), otherwise error code\",\n args: {document_url: 'url', property: 'url'},\n };\n sigs.getSubClasses = {\n spec: \"WOQLClient.getSubClasses(class, options)\",\n result: \"WOQL Result (HTTP 200), otherwise error code\",\n args: {class: 'url'},\n };\n return sigs[which];\n}//getFunctionSignature", "function prepareTwitterOauthSignatureForListBySlug(verb, url, timestamp, nonceValue, \n ownerScreenName, slug, userAuthToken, userAuthTokenSecret){\n\n var parameters = {\n oauth_consumer_key : twitterConfig.oauth_consumer_key,\n oauth_nonce : nonceValue,\n oauth_signature_method : 'HMAC-SHA1',\n oauth_timestamp : timestamp,\n oauth_token : userAuthToken,\n oauth_version : '1.0',\n owner_screen_name : ownerScreenName,\n slug : slug\n };\n var consumerSecret = twitterConfig.oauth_consumer_secret;\n var tokenSecret = userAuthTokenSecret;\n // generates a RFC 3986 encoded, BASE64 encoded HMAC-SHA1 hash\n console.log('list by slug endpoint: parameters sent to the oath_signature.generator = ' + JSON.stringify(parameters)); \n var oauthSignatureValue = oauth_signature.generate(verb, url, parameters, consumerSecret, tokenSecret,{ encodeSignature: true});\n \n return oauthSignatureValue;\n\n }", "static sign(secret, req) {\n const now = req.timestamp ? req.timestamp : Date.now();\n const payload = [req.method, req.url, now];\n // Check if should sign body as well\n if ((req.body && req.method.toUpperCase() === \"POST\") || req.method.toUpperCase() === \"PUT\") {\n payload.push(req.body);\n }\n // Generate signature using HMAC SHA 256\n const signature = CryptoJS.HmacSHA256(payload.join(\",\"), secret);\n return {\n \"X-Request-Signature\": signature.toString(),\n \"X-Request-Timestamp\": now.toString()\n };\n }", "get signature() {\n return this.payload['signature'];\n }", "get signature() {\n\t\treturn this.__signature;\n\t}", "getSignature (config, query, url) {\n // Create hmac instance from your token\n const hmac = crypto.createHmac(\"sha256\", this.token);\n\n // Join white list headers (date, tb-content-sha256) into a single string\n const headers = config.headers;\n const header = [\n `date:${headers.date}`.trim(),\n `tb-content-sha256:${headers['tb-content-sha256']}`.trim()\n ];\n const headerString = header.join('\\n');\n\n // Create a string from hmac encoding\n let string = `${config.method.toUpperCase()}\\n`;\n string = `${string}/api/v1${url.trim()}\\n${query.trim()}\\n${headerString.trim()}\\n${headers['tb-content-sha256'].trim()}`;\n\n hmac.write(string);\n hmac.end();\n\n // Return Authorization header signature\n const signature = hmac.read().toString('hex');\n return `TB1-HMAC-SHA256 ${this.partnerId}:${signature}`;\n }", "function getSignature(payload, secret) {\n const hmac = crypto.createHmac('sha1', secret)\n hmac.update(payload, 'utf-8')\n return `sha1=${hmac.digest('hex')}`\n}", "function getFunctionSignature(name, fcn, params, isStatic) {\n var fcnSig = isStatic ? 'public static' : 'public';\n fcnSig += \" \" + name + \"(\" +\n params.map(function(param) {\n var paramName = fixIdentifier(param.name);\n // Make each param type a union type if multiple types.\n return paramName + (param.optional ? \"?\" : \"\") + \": \" + (param.types.map(function(type) { return getType(type); }).join(\" | \"));\n }).join(', ') + \"): \";\n var returnType = fcn.return ? getType(fcn.return.type) : \"void\";\n if (fcn.isAsync) {\n returnType = \"PromiseLike<\" + returnType + \">\";\n }\n return fcnSig + returnType + \";\"\n }", "function prepareTwitterOauthSignatureForLists(verb, url, timestamp, nonceValue, \n alias, userAuthToken, userAuthTokenSecret){\n var parameters = {\n oauth_consumer_key : twitterConfig.oauth_consumer_key,\n oauth_nonce : nonceValue,\n oauth_signature_method : 'HMAC-SHA1',\n oauth_timestamp : timestamp,\n oauth_token : userAuthToken,\n oauth_version : '1.0',\n 'screen-name':alias\n };\n var consumerSecret = twitterConfig.oauth_consumer_secret;\n var tokenSecret = userAuthTokenSecret;\n // generates a RFC 3986 encoded, BASE64 encoded HMAC-SHA1 hash \n console.log('lists endpoint: parameters sent to the oath_signature.generator = ' + JSON.stringify(parameters));\n var oauthSignatureValue = oauth_signature.generate(verb, url, parameters, consumerSecret, tokenSecret,{ encodeSignature: true});\n \n return oauthSignatureValue;\n\n }", "sign(url, request, consumerSecret, tokenSecret) {\n let params = Object.assign({}, this.parameters, request.params.toObject());\n\n this.signature = oauthSignature.generate(\n request.method,\n url,\n params,\n consumerSecret,\n tokenSecret,\n );\n }", "function setHeaders(apiKey, secret, path, method_, body, headers) {\n var strBody = stringifyOption(body);\n var timestamp = String(floor(Date.now() / 1000.0));\n var hmac = CryptoJs.HmacSHA256(methodName(method_) + (timestamp + (path + strBody)), secret);\n var signature = EncBase64.stringify(hmac);\n headers[\"X-Swp-Api-Key\"] = apiKey;\n headers[\"X-Swp-Signature\"] = signature;\n headers[\"X-Swp-Timestamp\"] = timestamp;\n return /* () */0;\n}", "function SigV4Utils() { }", "function rsassaPssSignFn(name) {\n var md = name.replace(\"PS\", \"SHA\").toLowerCase(),\n hash = name.replace(\"PS\", \"SHA-\");\n\n return function(key, pdata) {\n // create the digest\n var digest = forge.md[md].create();\n digest.start();\n digest.update(pdata);\n\n // setup padding\n var pss = forge.pss.create({\n md: forge.md[md].create(),\n mgf: forge.mgf.mgf1.create(forge.md[md].create()),\n saltLength: CONSTANTS.HASHLENGTH[hash] / 8\n });\n\n // sign it\n var pki = rsaUtil.convertToForge(key, false);\n var sig = pki.sign(digest, pss);\n sig = new Buffer(sig, \"binary\");\n\n return Promise.resolve({\n data: pdata,\n mac: sig\n });\n };\n}", "get signature() {\n return this._signature;\n }", "get signature() {\n return this._signature;\n }", "function takeShurikenHandler() {\n \ttakeShurikens(1);\n }", "function generateSignedURL(actionName, form, accessKeyId, secretKey, endpoint, version) {\n var url = endpoint + \"?SignatureVersion=1&Action=\" + actionName + \"&Version=\" + encodeURIComponent(version) + \"&\";\n for (var i = 0; i < form.elements.length;++ i) {\n var elementName = form.elements[i].name;\n \n var elementValue = null;\n \n if (form.elements[i].type == 'text') {\n elementValue = form.elements[i].value;\n } else if (form.elements[i].type == 'select-one') {\n elementValue = form.elements[i].options[form.elements[i].selectedIndex].value;\n }\n if (elementValue) {\n url += elementName;\n url += \"=\";\n url += encodeURIComponent(elementValue);\n url += \"&\";\n }\n }\n var timestamp = getNowTimeStamp();\n url += \"Timestamp=\" + encodeURIComponent(timestamp);\n \n url += \"&AWSAccessKeyId=\" + encodeURIComponent(accessKeyId);\n var signature = generateV1Signature(url, secretKey);\n url += \"&Signature=\" + encodeURIComponent(signature);\n \n return url;\n}", "function makeSignature(s) {\n if (typeof s !== \"string\")\n throw Error(`vbios.makeSignature(): Signature must be a string, not '${typeof s}'`);\n\n if (s.length < 2 || s.length > 4)\n throw Error(`vbios.makeSignature(): Signature size must be between 2-4 characters, not '${s.length}'`);\n\n const a = s.charCodeAt(0);\n const b = s.charCodeAt(1);\n const c = s.charCodeAt(2) || 0;\n const d = s.charCodeAt(3) || 0;\n return (d << 24) | (c << 16) | (b << 8) | a;\n}", "function getHashEventSignature(evt){\n return web3.sha3(evt)\n}", "getPublicKeyThumbprint() {\n throw new Error(\"Method not implemented.\");\n }", "static isCallSignature(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.CallSignature;\r\n }", "function tryAddCosSignature({ cosSdkInstance, url }) {\n const { host, pathname, searchParams } = new URL(url);\n if (/^([^.]*)\\.cos\\.([^.]*)\\.myqcloud\\.com$/.test(host)) {\n // if url already has signature, return url\n if (searchParams.has('q-signature')) {\n return url;\n }\n const { 1: Bucket, 2: Region } = host.match(/^([^.]*)\\.cos\\.([^.]*)\\.myqcloud\\.com$/);\n const Key = decodeURIComponent(pathname.slice(1));\n return cosSdkInstance.getObjectUrl({\n Bucket,\n Region,\n Key,\n Sign: true,\n Expires: 24 * 60 * 60,\n });\n }\n return url;\n}", "function FunctionOwnershipVisitor() {\r\n}", "function getSignature(username, secretKey) {\n\treturn hashstring(joinNameAndDate(username, formatDate), secretKey)\n}", "function getSignature(url, params, headers, secretKey) {\n // To remove references, objects are passed by references in JS\n const message = JSON.parse(JSON.stringify(params));\n\n // We are passing the extra key values pairs before serializing our request params\n message['X-NONCE'] = headers['X-NONCE'];\n message['X-RECV-WINDOW'] = headers['X-RECV-WINDOW'];\n\n if (Object.keys(params).length === 0)\n message['X-REQUEST-URL'] = url;\n\n else\n message['X-REQUEST-URL'] = `${url}?${qs.stringify(params)}`;\n\n const messageSorted = sortObjectAlphabetically(message);\n\n console.log('messageSorted', messageSorted);\n\n const messageString = JSON.stringify(messageSorted);\n\n const signature = CryptoJS.HmacSHA256(messageString, secretKey).toString();\n\n console.log('signature', signature);\n\n return signature;\n}", "fetch () {\n return Api().get('signatures/');\n }", "static isSignatured(structure) {\r\n switch (structure.kind) {\r\n case StructureKind_1.StructureKind.Constructor:\r\n case StructureKind_1.StructureKind.ConstructorOverload:\r\n case StructureKind_1.StructureKind.GetAccessor:\r\n case StructureKind_1.StructureKind.Method:\r\n case StructureKind_1.StructureKind.MethodOverload:\r\n case StructureKind_1.StructureKind.SetAccessor:\r\n case StructureKind_1.StructureKind.Function:\r\n case StructureKind_1.StructureKind.FunctionOverload:\r\n case StructureKind_1.StructureKind.CallSignature:\r\n case StructureKind_1.StructureKind.ConstructSignature:\r\n case StructureKind_1.StructureKind.MethodSignature:\r\n return true;\r\n default:\r\n return false;\r\n }\r\n }", "function addSignature()\r\n{\r\n var storedObject = GM_getValue(\"SGNSignatureObject\");\r\n var scriptElement = document.createElement('script');\r\n scriptElement.type = 'text/javascript';\r\n scriptElement.innerHTML = 'function addSignature() { if(vB_Editor.vB_Editor_001 != undefined){ var element = vB_Editor.vB_Editor_001.editor.getData(); vB_Editor.vB_Editor_001.editor.setData(element+\"\\\\n\\\\n\"+\"'+storedObject+'\"); }else{ var element = vB_Editor.vB_Editor_QR.editor.getData(); vB_Editor.vB_Editor_QR.editor.setData(element+\"\\\\n\\\\n\"+\"'+storedObject+'\"); } }';\r\n unsafeWindow.document.getElementsByTagName(\"head\")[0].appendChild(scriptElement);\r\n}", "async function signature({platforms, debug, version}) {\n if (!platforms[PLATFORM.FIREFOX_MV2] || debug) {\n throw new Error('Only Firefox builds support signed packages for now.');\n }\n\n const infoPath = `./integrity/firefox/${version}/info.json`;\n const {type, order, manifest} = await readJSON(infoPath);\n await createHashes(type, version, order, manifest);\n\n const destDir = getDestDir({debug, platform: 'firefox'});\n const rsa = `./integrity/firefox/${version}/mozilla.rsa`;\n const rsaDest = `${destDir}/META-INF/mozilla.rsa`;\n const sig = `./integrity/firefox/${version}/cose.sig`;\n const sigDest = `${destDir}/META-INF/cose.sig`;\n const recommendation = `./integrity/firefox/${version}/mozilla-recommendation.json`;\n const recommendationDest = `${destDir}/mozilla-recommendation.json`;\n await copyFile(rsa, rsaDest);\n try {\n await copyFile(sig, sigDest);\n } catch (e) {\n // Do nothing\n }\n try {\n await copyFile(recommendation, recommendationDest);\n } catch (e) {\n // Do nothing\n }\n}", "function SaveHash() { }", "getSignatureDigest() {\n const buffer = new Serialize.SerialBuffer({\n textEncoder: this.textEncoder,\n textDecoder: this.textDecoder,\n });\n // protocol version + utf8 \"request\"\n buffer.pushArray([this.version, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74]);\n buffer.pushArray(this.getData());\n return sha256(buffer.asUint8Array());\n }", "function sf(){}", "static createSignature(method, endPoint, headerParameters, bodyParameters, secretKey, tokenSecret) {\n if(typeof jsSHA !== 'undefined') {\n let headerAndBodyParameters = angular.copy(headerParameters);\n let bodyParameterKeys = Object.keys(bodyParameters);\n for(let i = 0; i < bodyParameterKeys.length; i++) {\n headerAndBodyParameters[bodyParameterKeys[i]] = encodeURIComponent(bodyParameters[bodyParameterKeys[i]]);\n }\n let signatureBaseString = method + '&' + encodeURIComponent(endPoint) + '&';\n let headerAndBodyParameterKeys = (Object.keys(headerAndBodyParameters)).sort();\n for(i = 0; i < headerAndBodyParameterKeys.length; i++) {\n if(i == headerAndBodyParameterKeys.length - 1) {\n signatureBaseString += encodeURIComponent(headerAndBodyParameterKeys[i] + '=' + headerAndBodyParameters[headerAndBodyParameterKeys[i]]);\n } else {\n signatureBaseString += encodeURIComponent(headerAndBodyParameterKeys[i] + '=' + headerAndBodyParameters[headerAndBodyParameterKeys[i]] + '&');\n }\n }\n let oauthSignatureObject = new jsSHA(signatureBaseString, 'TEXT');\n\n let encodedTokenSecret = '';\n if (tokenSecret) {\n encodedTokenSecret = encodeURIComponent(tokenSecret);\n }\n\n headerParameters.oauth_signature = encodeURIComponent(oauthSignatureObject.getHMAC(encodeURIComponent(secretKey) + '&' + encodedTokenSecret, 'TEXT', 'SHA-1', 'B64'));\n let headerParameterKeys = Object.keys(headerParameters);\n let authorizationHeader = 'OAuth ';\n for(i = 0; i < headerParameterKeys.length; i++) {\n if(i == headerParameterKeys.length - 1) {\n authorizationHeader += headerParameterKeys[i] + '='' + headerParameters[headerParameterKeys[i]] + ''';\n } else {\n authorizationHeader += headerParameterKeys[i] + '='' + headerParameters[headerParameterKeys[i]] + '',';\n }\n }\n return { signature_base_string: signatureBaseString, authorization_header: authorizationHeader, signature: headerParameters.oauth_signature };\n } else {\n return 'Missing jsSHA JavaScript library';\n }\n }", "function Shot() {}", "static isMethodSignature(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.MethodSignature;\r\n }", "function TrackByFunction(){}", "function sign(params) {\n params.key = key;\n params.timestamp = Math.round(new Date().getTime());\n params.signature = crypto.createHmac('sha256', secret).update(params.key + params.timestamp).digest('hex');\n return params;\n}", "function verifyRequestSignature(req, res, buf) {\n let signature = req.headers[\"x-hub-signature\"];\n if (!signature) {\n //console.error(\"[verifyRequestSignature] La request no contiene la firma de la aplicacion(APP_SECRET).\");\n throw new Error(\"La request no contiene en el encabezado la firma de la aplicacion(APP_SECRET).\");\n }\n console.trace(\"[verifyRequestSignature] Verificando la firma de la aplicacion(APP_SECRET). signature:\", signature);\n\n let elements = signature.split('=');\n // GLOZADA: desuso\n //let method = elements[0];\n let signatureHash = elements[1];\n let expectedHash = crypto.createHmac('sha1', APP_SECRET)\n .update(buf)\n .digest('hex');\n if (signatureHash != expectedHash) {\n //console.error(\"[verifyRequestSignature] La firma de la aplicacion(APP_SECRET) presente en la request no es valida.\");\n throw new Error(\"La firma de la aplicacion(APP_SECRET) presente en la request no es valida.\");\n }\n}", "function serializeSignature(writeStream, object) {\r\n if (object.type === IEd25519Signature_1.ED25519_SIGNATURE_TYPE) {\r\n serializeEd25519Signature(writeStream, object);\r\n }\r\n else {\r\n throw new Error(`Unrecognized signature type ${object.type}`);\r\n }\r\n}", "sign(signatureProvider) {\n const message = this.getSignatureDigest();\n this.signature = signatureProvider.sign(Serialize.arrayToHex(message));\n }", "#secret(){\n console.log(\"this is a secret\")\n }", "static saltUri(uri) {\r\n // straight-up change the input param on this.\r\n if (uri.indexOf('?') === -1) {\r\n uri = uri + '?'\r\n }\r\n else {\r\n uri = uri + '&'\r\n }\r\n\r\n uri = uri + 'gimmeyou=' + (new Date()).getTime();\r\n\r\n return uri;\r\n }", "function checkSignature({ hash, ...userData }) {\n // create a hash of a secret that both you and Telegram know. In this case, it is your bot token\n const secretKey = createHash('sha256')\n .update(CONFIG.BOT_TOKEN)\n .digest();\n\n // this is the data to be authenticated i.e. telegram user id, first_name, last_name etc.\n const dataCheckString = Object.keys(userData)\n .sort()\n .map(key => (`${key}=${userData[key]}`))\n .join('\\n');\n\n // run a cryptographic hash function over the data to be authenticated and the secret\n const hmac = createHmac('sha256', secretKey)\n .update(dataCheckString)\n .digest('hex');\n\n // compare the hash that you calculate on your side (hmac) with what Telegram sends you (hash) and return the result\n return hmac === hash;\n}", "function methodAbiToFunctionSignature(methodAbi) {\n const method = utils_1.AbiEncoder.createMethod(methodAbi.name, methodAbi.inputs);\n return method.getSignature();\n}", "function signature() {\r\n\tvar r = \"\", t, v;\r\n\tfor (var i = 0; i < arguments.length; i++) {\r\n\t\tv = arguments[i];\r\n\t\tt = typeof v;\r\n\t\tif (i) {\r\n\t\t\tr += ',';\r\n\t\t}\r\n\t\tr += t === 'object' ? (v ? identifier(v.constructor) : '') : t;\r\n\t}\r\n\treturn r;\r\n}", "function Pythia() {}", "verifyRequestSignature( req, res, buf ) {\n var signature = req.headers[ \"x-hub-signature\" ];\n\n if ( !signature ) {\n // For testing, let's log an error. In production, you should throw an\n // error.\n console.error( \"Couldn't validate the signature.\" );\n } else {\n var elements = signature.split( '=' );\n var method = elements[ 0 ];\n var signatureHash = elements[ 1 ];\n\n var expectedHash = crypto.createHmac( 'sha1', envVars.APP_SECRET )\n .update( buf )\n .digest( 'hex' );\n\n if ( signatureHash != expectedHash ) {\n throw new Error( \"Couldn't validate the request signature.\" );\n }\n }\n }", "function Hash() {\r\n}", "function fechaserver() {\n}", "function SignatureParams() {\n this.prefix = \"\";\n }", "function saludarArgumentos(referencia){\n console.log(arguments);\n}", "function Visitor(q,v){function y(a){function c(a,d,c){c=c?c+=\"|\":c;return c+(a+\"=\"+encodeURIComponent(d))}for(var b=\"\",e=0,f=a.length;e<f;e++){var g=a[e],h=g[0],g=g[1];g!=i&&g!==t&&(b=c(h,g,b))}return function(a){var d=(new Date).getTime(),a=a?a+=\"|\":a;return a+(\"TS=\"+d)}(b)}if(!q)throw\"Visitor requires Adobe Marketing Cloud Org ID\";var a=this;a.version=\"1.9.1\";var m=window,l=m.Visitor;l.version=a.version;m.s_c_in||(m.s_c_il=[],m.s_c_in=0);a._c=\"Visitor\";a._il=m.s_c_il;a._in=m.s_c_in;a._il[a._in]=a;m.s_c_in++;a.ja={Fa:[]};var u=m.document,i=l.Cb;i||(i=null);var E=l.Db;E||(E=void 0);var j=l.Oa;j||(j=!0);var k=l.Ma;k||(k=!1);a.fa=function(a){var c=0,b,e;if(a)for(b=0;b<a.length;b++)e=a.charCodeAt(b),c=(c<<5)-c+e,c&=c;return c};a.s=function(a,c){var b=\"0123456789\",e=\"\",f=\"\",g,h,i=8,k=10,l=10;c===n&&(w.isClientSideMarketingCloudVisitorID=j);if(1==a){b+=\"ABCDEF\";for(g=0;16>g;g++)h=Math.floor(Math.random()*i),e+=b.substring(h,h+1),h=Math.floor(Math.random()*i),f+=b.substring(h,h+1),i=16;return e+\n\"-\"+f}for(g=0;19>g;g++)h=Math.floor(Math.random()*k),e+=b.substring(h,h+1),0==g&&9==h?k=3:(1==g||2==g)&&10!=k&&2>h?k=10:2<g&&(k=10),h=Math.floor(Math.random()*l),f+=b.substring(h,h+1),0==g&&9==h?l=3:(1==g||2==g)&&10!=l&&2>h?l=10:2<g&&(l=10);return e+f};a.Ra=function(){var a;!a&&m.location&&(a=m.location.hostname);if(a)if(/^[0-9.]+$/.test(a))a=\"\";else{var c=a.split(\".\"),b=c.length-1,e=b-1;1<b&&2>=c[b].length&&(2==c[b-1].length||0>\",ac,ad,ae,af,ag,ai,al,am,an,ao,aq,ar,as,at,au,aw,ax,az,ba,bb,be,bf,bg,bh,bi,bj,bm,bo,br,bs,bt,bv,bw,by,bz,ca,cc,cd,cf,cg,ch,ci,cl,cm,cn,co,cr,cu,cv,cw,cx,cz,de,dj,dk,dm,do,dz,ec,ee,eg,es,et,eu,fi,fm,fo,fr,ga,gb,gd,ge,gf,gg,gh,gi,gl,gm,gn,gp,gq,gr,gs,gt,gw,gy,hk,hm,hn,hr,ht,hu,id,ie,im,in,io,iq,ir,is,it,je,jo,jp,kg,ki,km,kn,kp,kr,ky,kz,la,lb,lc,li,lk,lr,ls,lt,lu,lv,ly,ma,mc,md,me,mg,mh,mk,ml,mn,mo,mp,mq,mr,ms,mt,mu,mv,mw,mx,my,na,nc,ne,nf,ng,nl,no,nr,nu,nz,om,pa,pe,pf,ph,pk,pl,pm,pn,pr,ps,pt,pw,py,qa,re,ro,rs,ru,rw,sa,sb,sc,sd,se,sg,sh,si,sj,sk,sl,sm,sn,so,sr,st,su,sv,sx,sy,sz,tc,td,tf,tg,th,tj,tk,tl,tm,tn,to,tp,tr,tt,tv,tw,tz,ua,ug,uk,us,uy,uz,va,vc,ve,vg,vi,vn,vu,wf,ws,yt,\".indexOf(\",\"+\nc[b]+\",\"))&&e--;if(0<e)for(a=\"\";b>=e;)a=c[b]+(a?\".\":\"\")+a,b--}return a};a.cookieRead=function(a){var a=encodeURIComponent(a),c=(\";\"+u.cookie).split(\" \").join(\";\"),b=c.indexOf(\";\"+a+\"=\"),e=0>b?b:c.indexOf(\";\",b+1);return 0>b?\"\":decodeURIComponent(c.substring(b+2+a.length,0>e?c.length:e))};a.cookieWrite=function(d,c,b){var e=a.cookieLifetime,f,c=\"\"+c,e=e?(\"\"+e).toUpperCase():\"\";b&&\"SESSION\"!=e&&\"NONE\"!=e?(f=\"\"!=c?parseInt(e?e:0,10):-60)?(b=new Date,b.setTime(b.getTime()+1E3*f)):1==b&&(b=new Date,f=b.getYear(),b.setYear(f+2+(1900>f?1900:0))):b=0;return d&&\"NONE\"!=e?(u.cookie=encodeURIComponent(d)+\"=\"+encodeURIComponent(c)+\"; path=/;\"+(b?\" expires=\"+b.toGMTString()+\";\":\"\")+(a.cookieDomain?\" domain=\"+a.cookieDomain+\";\":\"\"),a.cookieRead(d)==c):0};a.h=i;a.J=function(a,c){try{\"function\"==typeof a?a.apply(m,c):a[1].apply(a[0],c)}catch(b){}};a.Xa=function(d,c){c&&(a.h==i&&(a.h={}),a.h[d]==E&&(a.h[d]=[]),a.h[d].push(c))};a.r=function(d,c){if(a.h!=i){var b=a.h[d];if(b)for(;0<b.length;)a.J(b.shift(),c)}};a.v=function(a,c,b,e){b=encodeURIComponent(c)+\"=\"+encodeURIComponent(b);c=x.vb(a);a=x.mb(a);if(-1===a.indexOf(\"?\"))return a+\"?\"+b+c;var f=a.split(\"?\"),a=f[0]+\"?\",e=x.$a(f[1],b,e);return a+e+c};a.Qa=function(a,c){var b=RegExp(\"[\\\\?&#]\"+c+\"=([^&#]*)\").exec(a);if(b&&b.length)return decodeURIComponent(b[1])};a.Wa=function(){var d=i,c=m.location.href;try{var b=a.Qa(c,r.Z);if(b)for(var d={},e=b.split(\"|\"),c=0,f=e.length;c<f;c++){var g=e[c].split(\"=\");d[g[0]]=decodeURIComponent(g[1])}return d}catch(h){}};a.ba=function(){var d=a.Wa();if(d&&d.TS&&!(((new Date).getTime()-d.TS)/6E4>r.Ka||d[I]!==q)){var c=d[n],b=a.setMarketingCloudVisitorID;c&&c.match(r.u)&&b(c);a.j(s,-1);d=d[p];c=a.setAnalyticsVisitorID;d&&d.match(r.u)&&c(d)}};a.Va=function(d){function c(d){x.pb(d)&&a.setCustomerIDs(d)}function b(d){d=d||{};a._supplementalDataIDCurrent=d.supplementalDataIDCurrent||\"\";a._supplementalDataIDCurrentConsumed=d.supplementalDataIDCurrentConsumed||{};a._supplementalDataIDLast=d.supplementalDataIDLast||\"\";a._supplementalDataIDLastConsumed=d.supplementalDataIDLastConsumed||{}}d&&d[a.marketingCloudOrgID]&&(d=d[a.marketingCloudOrgID],c(d.customerIDs),b(d.sdid))};a.l=i;a.Ta=function(d,c,b,e){c=a.v(c,\"d_fieldgroup\",d,1);e.url=a.v(e.url,\"d_fieldgroup\",d,1);e.m=a.v(e.m,\"d_fieldgroup\",d,1);w.d[d]=j;e===Object(e)&&e.m&&\"XMLHttpRequest\"===a.la.C.D?a.la.ib(e,b,d):a.useCORSOnly||a.ia(d,c,b)};a.ia=function(d,c,b){var e=0,f=0,g;if(c&&u){for(g=0;!e&&2>g;){try{e=(e=u.getElementsByTagName(0<g?\"HEAD\":\"head\"))&&0<e.length?e[0]:0}catch(h){e=0}g++}if(!e)try{u.body&&(e=u.body)}catch(k){e=0}if(e)for(g=0;!f&&2>g;){try{f=u.createElement(0<g?\"SCRIPT\":\"script\")}catch(l){f=0}g++}}!c||!e||!f?b&&b():(f.type=\"text/javascript\",f.src=c,e.firstChild?e.insertBefore(f,e.firstChild):e.appendChild(f),e=a.loadTimeout,o.d[d]={requestStart:o.o(),url:c,ta:e,ra:o.ya(),sa:0},b&&(a.l==i&&(a.l={}),a.l[d]=setTimeout(function(){b(j)},e)),a.ja.Fa.push(c))};a.Pa=function(d){a.l!=i&&a.l[d]&&(clearTimeout(a.l[d]),a.l[d]=0)};a.ga=k;a.ha=k;a.isAllowed=function(){if(!a.ga&&(a.ga=j,a.cookieRead(a.cookieName)||a.cookieWrite(a.cookieName,\"T\",1)))a.ha=j;return a.ha};a.b=i;a.c=i;var F=l.Ub;F||(F=\"MC\");var n=l.ac;n||(n=\"MCMID\");var I=l.Yb;I||(I=\"MCORGID\");var H=l.Vb;H||(H=\"MCCIDH\");var L=l.Zb;L||(L=\"MCSYNCS\");var J=l.$b;J||(J=\"MCSYNCSOP\");var K=l.Wb;K||(K=\"MCIDTS\");var B=l.Xb;B||(B=\"MCOPTOUT\");var D=l.Sb;D||(D=\"A\");var p=l.Pb;p||(p=\"MCAID\");var C=l.Tb;C||(C=\"AAM\");var A=l.Rb;A||(A=\"MCAAMLH\");var s=l.Qb;s||(s=\"MCAAMB\");var t=l.bc;t||(t=\"NONE\");a.L=0;a.ea=function(){if(!a.L){var d=a.version;a.audienceManagerServer&&(d+=\"|\"+a.audienceManagerServer);a.audienceManagerServerSecure&&(d+=\"|\"+a.audienceManagerServerSecure);a.L=a.fa(d)}return a.L};a.ka=k;a.f=function(){if(!a.ka){a.ka=j;var d=a.ea(),c=k,b=a.cookieRead(a.cookieName),e,f,g,h,l=new Date;a.b==i&&(a.b={});if(b&&\"T\"!=b){b=b.split(\"|\");b[0].match(/^[\\-0-9]+$/)&&(parseInt(b[0],10)!=d&&(c=j),b.shift());1==b.length%2&&b.pop();for(d=0;d<b.length;d+=2)if(e=b[d].split(\"-\"),f=e[0],g=b[d+1],1<e.length?(h=parseInt(e[1],10),e=0<e[1].indexOf(\"s\")):(h=0,e=k),c&&(f==H&&(g=\"\"),0<h&&(h=l.getTime()/1E3-60)),f&&g&&(a.e(f,g,1),0<h&&(a.b[\"expire\"+f]=h+(e?\"s\":\"\"),l.getTime()>=1E3*h||e&&!a.cookieRead(a.sessionCookieName))))a.c||(a.c={}),a.c[f]=j}c=a.loadSSL?!!a.trackingServerSecure:!!a.trackingServer;if(!a.a(p)&&c&&(b=a.cookieRead(\"s_vi\")))b=b.split(\"|\"),1<b.length&&0<=b[0].indexOf(\"v1\")&&(g=b[1],d=g.indexOf(\"[\"),0<=d&&(g=g.substring(0,d)),g&&g.match(r.u)&&a.e(p,g))}};a.Za=function(){var d=a.ea(),c,b;for(c in a.b)!Object.prototype[c]&&a.b[c]&&\"expire\"!=c.substring(0,6)&&(b=a.b[c],d+=(d?\"|\":\"\")+c+(a.b[\"expire\"+c]?\"-\"+a.b[\"expire\"+c]:\"\")+\"|\"+b);a.cookieWrite(a.cookieName,d,1)};a.a=function(d,c){return a.b!=i&&(c||!a.c||!a.c[d])?a.b[d]:i};a.e=function(d,c,b){a.b==i&&(a.b={});a.b[d]=c;b||a.Za()};a.Sa=function(d,c){var b=a.a(d,c);return b?b.split(\"*\"):i};a.Ya=function(d,c,b){a.e(d,c?c.join(\"*\"):\"\",b)};a.Jb=function(d,c){var b=a.Sa(d,c);if(b){var e={},f;for(f=0;f<b.length;f+=2)e[b[f]]=b[f+1];return e}return i};a.Lb=function(d,c,b){var e=i,f;if(c)for(f in e=[],c)Object.prototype[f]||(e.push(f),e.push(c[f]));a.Ya(d,e,b)};a.j=function(d,c,b){var e=new Date;e.setTime(e.getTime()+1E3*c);a.b==i&&(a.b={});a.b[\"expire\"+d]=Math.floor(e.getTime()/1E3)+(b?\"s\":\"\");0>c?(a.c||(a.c={}),a.c[d]=j):a.c&&(a.c[d]=k);b&&(a.cookieRead(a.sessionCookieName)||a.cookieWrite(a.sessionCookieName,\"1\"))};a.da=function(a){if(a&&(\"object\"==typeof a&&(a=a.d_mid?a.d_mid:a.visitorID?a.visitorID:a.id?a.id:a.uuid?a.uuid:\"\"+a),a&&(a=a.toUpperCase(),\"NOTARGET\"==a&&(a=t)),!a||a!=t&&!a.match(r.u)))a=\"\";return a};a.k=function(d,c){a.Pa(d);a.i!=i&&(a.i[d]=k);o.d[d]&&(o.d[d].Ab=o.o(),o.I(d));w.d[d]&&w.Ha(d,k);if(d==F){w.isClientSideMarketingCloudVisitorID!==j&&(w.isClientSideMarketingCloudVisitorID=k);var b=a.a(n);if(!b||a.overwriteCrossDomainMCIDAndAID){b=\"object\"==typeof c&&c.mid?c.mid:a.da(c);if(!b){if(a.B){a.getAnalyticsVisitorID(i,k,j);return}b=a.s(0,n)}a.e(n,b)}if(!b||b==t)b=\"\";\"object\"==typeof c&&((c.d_region||c.dcs_region||c.d_blob||c.blob)&&a.k(C,c),a.B&&c.mid&&a.k(D,{id:c.id}));a.r(n,[b])}if(d==C&&\"object\"==typeof c){b=604800;c.id_sync_ttl!=E&&c.id_sync_ttl&&(b=parseInt(c.id_sync_ttl,10));var e=a.a(A);e||((e=c.d_region)||(e=c.dcs_region),e&&(a.j(A,b),a.e(A,e)));e||(e=\"\");a.r(A,[e]);e=a.a(s);if(c.d_blob||c.blob)(e=c.d_blob)||(e=c.blob),a.j(s,b),a.e(s,e);e||(e=\"\");a.r(s,[e]);!c.error_msg&&a.A&&a.e(H,a.A)}if(d==D){b=a.a(p);if(!b||a.overwriteCrossDomainMCIDAndAID)(b=a.da(c))?b!==t&&a.j(s,-1):b=t,a.e(p,b);if(!b||b==t)b=\"\";a.r(p,[b])}a.idSyncDisableSyncs?z.za=j:(z.za=k,b={},b.ibs=c.ibs,b.subdomain=c.subdomain,z.wb(b));if(c===Object(c)){var f;a.isAllowed()&&(f=a.a(B));f||(f=t,c.d_optout&&c.d_optout instanceof Array&&(f=c.d_optout.join(\",\")),b=parseInt(c.d_ottl,10),isNaN(b)&&(b=7200),a.j(B,b,j),a.e(B,f));a.r(B,[f])}};a.i=i;a.t=function(d,c,b,e,f){var g=\"\",h,k=x.ob(d);if(a.isAllowed()&&(a.f(),g=a.a(d,M[d]===j),a.disableThirdPartyCalls&&!g&&(d===n?(g=a.s(0,n),a.setMarketingCloudVisitorID(g)):d===p&&!k&&(g=\"\",a.setAnalyticsVisitorID(g))),(!g||a.c&&a.c[d])&&(!a.disableThirdPartyCalls||k)))if(d==n||d==B?h=F:d==A||d==s?h=C:d==p&&(h=D),h){if(c&&(a.i==i||!a.i[h]))a.i==i&&(a.i={}),a.i[h]=j,a.Ta(h,c,function(c,b){if(!a.a(d))if(o.d[h]&&(o.d[h].timeout=o.o(),o.d[h].nb=!!c,o.I(h)),b===Object(b)&&!a.useCORSOnly)a.ia(h,b.url,b.G);else{c&&w.Ha(h,j);var e=\"\";d==n?e=a.s(0,n):h==C&&(e={error_msg:\"timeout\"});a.k(h,e)}},f);if(g)return g;a.Xa(d,b);c||a.k(h,{id:t});return\"\"}if((d==n||d==p)&&g==t)g=\"\",e=j;b&&(e||a.disableThirdPartyCalls)&&a.J(b,[g]);return g};a._setMarketingCloudFields=function(d){a.f();a.k(F,d)};a.setMarketingCloudVisitorID=function(d){a._setMarketingCloudFields(d)};a.B=k;a.getMarketingCloudVisitorID=function(d,c){if(a.isAllowed()){a.marketingCloudServer&&0>a.marketingCloudServer.indexOf(\".demdex.net\")&&(a.B=j);var b=a.z(\"_setMarketingCloudFields\");return a.t(n,b.url,d,c,b)}return\"\"};a.Ua=function(){a.getAudienceManagerBlob()};l.AuthState={UNKNOWN:0,AUTHENTICATED:1,LOGGED_OUT:2};a.w={};a.ca=k;a.A=\"\";a.setCustomerIDs=function(d){if(a.isAllowed()&&d){a.f();var c,b;for(c in d)if(!Object.prototype[c]&&(b=d[c]))if(\"object\"==typeof b){var e={};b.id&&(e.id=b.id);b.authState!=E&&(e.authState=b.authState);a.w[c]=e}else a.w[c]={id:b};var d=a.getCustomerIDs(),e=a.a(H),f=\"\";e||(e=0);for(c in d)Object.prototype[c]||(b=d[c],f+=(f?\"|\":\"\")+c+\"|\"+(b.id?b.id:\"\")+(b.authState?b.authState:\"\"));a.A=a.fa(f);a.A!=e&&(a.ca=j,a.Ua())}};a.getCustomerIDs=function(){a.f();var d={},c,b;for(c in a.w)Object.prototype[c]||(b=a.w[c],d[c]||(d[c]={}),b.id&&(d[c].id=b.id),d[c].authState=b.authState!=E?b.authState:l.AuthState.UNKNOWN);return d};a._setAnalyticsFields=function(d){a.f();a.k(D,d)};a.setAnalyticsVisitorID=function(d){a._setAnalyticsFields(d)};a.getAnalyticsVisitorID=function(d,c,b){if(a.isAllowed()){var e=\"\";b||(e=a.getMarketingCloudVisitorID(function(){a.getAnalyticsVisitorID(d,j)}));if(e||b){var f=b?a.marketingCloudServer:a.trackingServer,g=\"\";a.loadSSL&&(b?a.marketingCloudServerSecure&&(f=a.marketingCloudServerSecure):a.trackingServerSecure&&(f=a.trackingServerSecure));var h={};if(f){var f=\"http\"+(a.loadSSL?\"s\":\"\")+\"://\"+f+\"/id\",e=\"d_visid_ver=\"+\na.version+\"&mcorgid=\"+encodeURIComponent(a.marketingCloudOrgID)+(e?\"&mid=\"+encodeURIComponent(e):\"\")+(a.idSyncDisable3rdPartySyncing?\"&d_coppa=true\":\"\"),i=[\"s_c_il\",a._in,\"_set\"+(b?\"MarketingCloud\":\"Analytics\")+\"Fields\"],g=f+\"?\"+e+\"&callback=s_c_il%5B\"+a._in+\"%5D._set\"+(b?\"MarketingCloud\":\"Analytics\")+\"Fields\";h.m=f+\"?\"+e;h.oa=i}h.url=g;return a.t(b?n:p,g,d,c,h)}}return\"\"};a._setAudienceManagerFields=function(d){a.f();a.k(C,d)};a.z=function(d){var c=a.audienceManagerServer,b=\"\",e=a.a(n),f=a.a(s,j),g=a.a(p),g=g&&g!=t?\"&d_cid_ic=AVID%01\"+encodeURIComponent(g):\"\";a.loadSSL&&a.audienceManagerServerSecure&&(c=a.audienceManagerServerSecure);if(c){var b=a.getCustomerIDs(),h,i;if(b)for(h in b)Object.prototype[h]||(i=b[h],g+=\"&d_cid_ic=\"+encodeURIComponent(h)+\"%01\"+encodeURIComponent(i.id?i.id:\"\")+(i.authState?\"%01\"+i.authState:\"\"));d||(d=\"_setAudienceManagerFields\");c=\"http\"+(a.loadSSL?\"s\":\"\")+\"://\"+c+\"/id\";e=\"d_visid_ver=\"+a.version+\"&d_rtbd=json&d_ver=2\"+(!e&&a.B?\"&d_verify=1\":\"\")+\"&d_orgid=\"+encodeURIComponent(a.marketingCloudOrgID)+\n\"&d_nsid=\"+(a.idSyncContainerID||0)+(e?\"&d_mid=\"+encodeURIComponent(e):\"\")+(a.idSyncDisable3rdPartySyncing?\"&d_coppa=true\":\"\")+(f?\"&d_blob=\"+encodeURIComponent(f):\"\")+g;f=[\"s_c_il\",a._in,d];b=c+\"?\"+e+\"&d_cb=s_c_il%5B\"+a._in+\"%5D.\"+d;return{url:b,m:c+\"?\"+e,oa:f}}return{url:b}};a.getAudienceManagerLocationHint=function(d,c){if(a.isAllowed()&&a.getMarketingCloudVisitorID(function(){a.getAudienceManagerLocationHint(d,j)})){var b=a.a(p);b||(b=a.getAnalyticsVisitorID(function(){a.getAudienceManagerLocationHint(d,j)}));if(b)return b=a.z(),a.t(A,b.url,d,c,b)}return\"\"};a.getLocationHint=a.getAudienceManagerLocationHint;a.getAudienceManagerBlob=function(d,c){if(a.isAllowed()&&a.getMarketingCloudVisitorID(function(){a.getAudienceManagerBlob(d,j)})){var b=a.a(p);b||(b=a.getAnalyticsVisitorID(function(){a.getAudienceManagerBlob(d,j)}));if(b){var b=a.z(),e=b.url;a.ca&&a.j(s,-1);return a.t(s,e,d,c,b)}}return\"\"};a._supplementalDataIDCurrent=\"\";a._supplementalDataIDCurrentConsumed={};a._supplementalDataIDLast=\"\";a._supplementalDataIDLastConsumed={};a.getSupplementalDataID=function(d,c){!a._supplementalDataIDCurrent&&!c&&(a._supplementalDataIDCurrent=a.s(1));var b=a._supplementalDataIDCurrent;a._supplementalDataIDLast&&!a._supplementalDataIDLastConsumed[d]?(b=a._supplementalDataIDLast,a._supplementalDataIDLastConsumed[d]=j):b&&(a._supplementalDataIDCurrentConsumed[d]&&(a._supplementalDataIDLast=a._supplementalDataIDCurrent,a._supplementalDataIDLastConsumed=a._supplementalDataIDCurrentConsumed,a._supplementalDataIDCurrent=b=!c?a.s(1):\"\",a._supplementalDataIDCurrentConsumed={}),b&&(a._supplementalDataIDCurrentConsumed[d]=j));return b};l.OptOut={GLOBAL:\"global\"};a.getOptOut=function(d,c){if(a.isAllowed()){var b=a.z(\"_setMarketingCloudFields\");return a.t(B,b.url,d,c,b)}return\"\"};a.isOptedOut=function(d,c,b){return a.isAllowed()?(c||(c=l.OptOut.GLOBAL),(b=a.getOptOut(function(b){a.J(d,[b==l.OptOut.GLOBAL||0<=b.indexOf(c)])},b))?b==l.OptOut.GLOBAL||0<=b.indexOf(c):i):k};a.appendVisitorIDsTo=function(d){var c=r.Z,b=y([[n,a.a(n)],[p,a.a(p)],[I,a.marketingCloudOrgID]]);try{return a.v(d,c,b)}catch(e){return d}};var r={q:!!m.postMessage,La:1,aa:864E5,Z:\"adobe_mc\",u:/^[0-9a-fA-F\\-]+$/,Ka:5};a.Eb=r;a.na={postMessage:function(a,c,b){var e=1;c&&(r.q?b.postMessage(a,c.replace(/([^:]+:\\/\\/[^\\/]+).*/,\"$1\")):c&&(b.location=c.replace(/#.*$/,\"\")+\"#\"+ +new Date+e++ +\"&\"+a))},U:function(a,c){var b;try{if(r.q)if(a&&(b=function(b){if(\"string\"===typeof c&&b.origin!==c||\"[object Function]\"===Object.prototype.toString.call(c)&&!1===c(b.origin))return!1;a(b)}),window.addEventListener)window[a?\"addEventListener\":\"removeEventListener\"](\"message\",b,!1);else window[a?\"attachEvent\":\"detachEvent\"](\"onmessage\",b)}catch(e){}}};var x={M:function(){if(u.addEventListener)return function(a,c,b){a.addEventListener(c,function(a){\"function\"===typeof b&&b(a)},k)};if(u.attachEvent)return function(a,c,b){a.attachEvent(\"on\"+c,function(a){\"function\"===typeof b&&b(a)})}}(),map:function(a,c){if(Array.prototype.map)return a.map(c);if(void 0===a||a===i)throw new TypeError;var b=Object(a),e=b.length>>>0;if(\"function\"!==typeof c)throw new TypeError;for(var f=Array(e),g=0;g<e;g++)g in b&&(f[g]=c.call(c,b[g],g,b));return f},va:function(a,c){return this.map(a,function(a){return encodeURIComponent(a)}).join(c)},vb:function(a){var c=a.indexOf(\"#\");return 0<c?a.substr(c):\"\"},mb:function(a){var c=a.indexOf(\"#\");return 0<c?a.substr(0,c):a},$a:function(a,c,b){a=a.split(\"&\");b=b!=i?b:a.length;a.splice(b,0,c);return a.join(\"&\")},ob:function(d,c,b){if(d!==p)return k;c||(c=a.trackingServer);b||(b=a.trackingServerSecure);d=a.loadSSL?b:c;return\"string\"===typeof d&&d.length?0>d.indexOf(\"2o7.net\")&&0>d.indexOf(\"omtrdc.net\"):k},pb:function(a){return Boolean(a&&a===Object(a))}};a.Kb=x;var N={C:function(){var a=\"none\",c=j;\"undefined\"!==typeof XMLHttpRequest&&XMLHttpRequest===Object(XMLHttpRequest)&&(\"withCredentials\"in new XMLHttpRequest?a=\"XMLHttpRequest\":(new Function(\"/*@cc_on return /^10/.test(@_jscript_version) @*/\"))()?a=\"XMLHttpRequest\":\"undefined\"!==typeof XDomainRequest&&XDomainRequest===Object(XDomainRequest)&&(c=k),0<Object.prototype.toString.call(window.Bb).indexOf(\"Constructor\")&&(c=k));return{D:a,Nb:c}}(),jb:function(){return\"none\"===this.C.D?i:new window[this.C.D]},ib:function(d,c,b){var e=this;c&&(d.G=c);try{var f=this.jb();f.open(\"get\",d.m+\"&ts=\"+(new Date).getTime(),j);\"XMLHttpRequest\"===this.C.D&&(f.withCredentials=j,f.timeout=a.loadTimeout,f.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\"),f.onreadystatechange=function(){if(4===this.readyState&&200===this.status)a:{var a;try{if(a=JSON.parse(this.responseText),a!==Object(a)){e.n(d,i,\"Response is not JSON\");break a}}catch(c){e.n(d,c,\"Error parsing response as JSON\");break a}try{for(var b=d.oa,f=window,g=0;g<b.length;g++)f=f[b[g]];f(a)}catch(j){e.n(d,j,\"Error forming callback function\")}}});f.onerror=function(a){e.n(d,a,\"onerror\")};f.ontimeout=function(a){e.n(d,a,\"ontimeout\")};f.send();o.d[b]={requestStart:o.o(),url:d.m,ta:f.timeout,ra:o.ya(),sa:1};a.ja.Fa.push(d.m)}catch(g){this.n(d,g,\"try-catch\")}},n:function(d,c,b){a.CORSErrors.push({Ob:d,error:c,description:b});d.G&&(\"ontimeout\"===b?d.G(j):d.G(k,d))}};a.la=N;var z={Na:3E4,$:649,Ja:k,id:i,T:[],Q:i,xa:function(a){if(\"string\"===typeof a)return a=a.split(\"/\"),a[0]+\"//\"+a[2]},g:i,url:i,kb:function(){var d=\"http://fast.\",c=\"?d_nsid=\"+a.idSyncContainerID+\"#\"+encodeURIComponent(u.location.href);this.g||(this.g=\"nosubdomainreturned\");a.loadSSL&&(d=a.idSyncSSLUseAkamai?\"https://fast.\":\"https://\");d=d+this.g+\".demdex.net/dest5.html\"+c;this.Q=this.xa(d);this.id=\"destination_publishing_iframe_\"+this.g+\"_\"+a.idSyncContainerID;return d},cb:function(){var d=\"?d_nsid=\"+a.idSyncContainerID+\"#\"+encodeURIComponent(u.location.href);\"string\"===typeof a.K&&a.K.length&&(this.id=\"destination_publishing_iframe_\"+(new Date).getTime()+\"_\"+a.idSyncContainerID,this.Q=this.xa(a.K),this.url=a.K+d)},za:i,ua:k,W:k,F:i,cc:i,ub:i,dc:i,V:k,H:[],sb:[],tb:[],Ba:r.q?15:100,R:[],qb:[],pa:j,Ea:k,Da:function(){return!a.idSyncDisable3rdPartySyncing&&(this.ua||a.Gb)&&this.g&&\"nosubdomainreturned\"!==this.g&&this.url&&!this.W},O:function(){function a(){e=document.createElement(\"iframe\");e.sandbox=\"allow-scripts allow-same-origin\";e.title=\"Adobe ID Syncing iFrame\";e.id=b.id;e.style.cssText=\"display: none; width: 0; height: 0;\";e.src=b.url;b.ub=j;c();document.body.appendChild(e)}function c(){x.M(e,\"load\",function(){e.className=\"aamIframeLoaded\";b.F=j;b.p()})}this.W=j;var b=this,e=document.getElementById(this.id);e?\"IFRAME\"!==e.nodeName?(this.id+=\"_2\",a()):\"aamIframeLoaded\"!==e.className?c():(this.F=j,this.Aa=e,this.p()):a();this.Aa=e},p:function(d){var c=this;d===Object(d)&&(this.R.push(d),this.xb(d));if((this.Ea||!r.q||this.F)&&this.R.length)this.I(this.R.shift()),this.p();!a.idSyncDisableSyncs&&this.F&&this.H.length&&!this.V&&(this.Ja||(this.Ja=j,setTimeout(function(){c.Ba=r.q?15:150},this.Na)),this.V=j,this.Ga())},xb:function(a){var c,b,e;if((c=a.ibs)&&c instanceof Array&&(b=c.length))for(a=0;a<b;a++)e=c[a],e.syncOnPage&&this.qa(e,\"\",\"syncOnPage\")},I:function(a){var c=encodeURIComponent,b,e,f,g,h;if((b=a.ibs)&&b instanceof Array&&(e=b.length))for(f=0;f<e;f++)g=b[f],h=[c(\"ibs\"),c(g.id||\"\"),c(g.tag||\"\"),x.va(g.url||[],\",\"),c(g.ttl||\"\"),\"\",\"\",g.fireURLSync?\"true\":\"false\"],g.syncOnPage||(this.pa?this.N(h.join(\"|\")):g.fireURLSync&&this.qa(g,h.join(\"|\")));this.qb.push(a)},qa:function(d,c,b){var e=(b=\"syncOnPage\"===b?j:k)?J:L;a.f();var f=a.a(e),g=k,h=k,i=Math.ceil((new Date).getTime()/r.aa);f?(f=f.split(\"*\"),h=this.yb(f,d.id,i),g=h.gb,h=h.hb,(!g||!h)&&this.wa(b,d,c,f,e,i)):(f=[],this.wa(b,d,c,f,e,i))},yb:function(a,c,b){var e=k,f=k,g,h,i;for(h=0;h<a.length;h++)g=a[h],i=parseInt(g.split(\"-\")[1],10),g.match(\"^\"+c+\"-\")?(e=j,b<i?f=j:(a.splice(h,1),h--)):b>=i&&(a.splice(h,1),h--);return{gb:e,hb:f}},rb:function(a){if(a.join(\"*\").length>this.$)for(a.sort(function(a,b){return parseInt(a.split(\"-\")[1],10)-parseInt(b.split(\"-\")[1],10)});a.join(\"*\").length>this.$;)a.shift()},wa:function(d,c,b,e,f,g){var h=this;if(d){if(\"img\"===c.tag){var d=c.url,b=a.loadSSL?\"https:\":\"http:\",j,k,l;for(e=0,j=d.length;e<j;e++){k=d[e];l=/^\\/\\//.test(k);var m=new Image;x.M(m,\"load\",function(b,c,d,e){return function(){h.T[b]=i;a.f();var g=a.a(f),j=[];if(g){var g=g.split(\"*\"),k,l,m;for(k=0,l=g.length;k<l;k++)m=g[k],m.match(\"^\"+c.id+\"-\")||j.push(m)}h.Ia(j,c,d,e)}}(this.T.length,c,f,g));m.src=(l?b:\"\")+k;this.T.push(m)}}}else this.N(b),this.Ia(e,c,f,g)},N:function(d){var c=encodeURIComponent;this.H.push((a.Hb?c(\"---destpub-debug---\"):c(\"---destpub---\"))+d)},Ia:function(d,c,b,e){d.push(c.id+\"-\"+(e+Math.ceil(c.ttl/60/24)));this.rb(d);a.e(b,d.join(\"*\"))},Ga:function(){var d=this,c;this.H.length?(c=this.H.shift(),a.na.postMessage(c,this.url,this.Aa.contentWindow),this.sb.push(c),setTimeout(function(){d.Ga()},this.Ba)):this.V=k},U:function(a){var c=/^---destpub-to-parent---/;\"string\"===typeof a&&c.test(a)&&(c=a.replace(c,\"\").split(\"|\"),\"canSetThirdPartyCookies\"===c[0]&&(this.pa=\"true\"===c[1]?j:k,this.Ea=j,this.p()),this.tb.push(a))},wb:function(d){if(this.url===i||d.subdomain&&\"nosubdomainreturned\"===this.g)this.g=\"string\"===typeof a.ma&&a.ma.length?a.ma:d.subdomain||\"\",this.url=this.kb();d.ibs instanceof Array&&d.ibs.length&&(this.ua=j);this.Da()&&(a.idSyncAttachIframeOnWindowLoad?(l.Y||\"complete\"===u.readyState||\"loaded\"===u.readyState)&&this.O():this.ab());\"function\"===typeof a.idSyncIDCallResult?a.idSyncIDCallResult(d):this.p(d);\"function\"===typeof a.idSyncAfterIDCallResult&&a.idSyncAfterIDCallResult(d)},bb:function(d,c){return a.Ib||!d||c-d>r.La},ab:function(){function a(){c.W||(document.body?c.O():setTimeout(a,30))}var c=this;a()}};a.Fb=z;a.timeoutMetricsLog=[];var o={fb:window.performance&&window.performance.timing?1:0,Ca:window.performance&&window.performance.timing?window.performance.timing:i,X:i,P:i,d:{},S:[],send:function(d){if(a.takeTimeoutMetrics&&d===Object(d)){var c=[],b=encodeURIComponent,e;for(e in d)d.hasOwnProperty(e)&&c.push(b(e)+\"=\"+b(d[e]));d=\"http\"+(a.loadSSL?\"s\":\"\")+\"://dpm.demdex.net/event?d_visid_ver=\"+a.version+\"&d_visid_stg_timeout=\"+a.loadTimeout+\"&\"+c.join(\"&\")+\"&d_orgid=\"+b(a.marketingCloudOrgID)+\"&d_timingapi=\"+this.fb+\"&d_winload=\"+this.lb()+\"&d_ld=\"+this.o();(new Image).src=d;a.timeoutMetricsLog.push(d)}},lb:function(){this.P===i&&(this.P=this.Ca?this.X-this.Ca.navigationStart:this.X-l.eb);return this.P},o:function(){return(new Date).getTime()},I:function(a){var c=this.d[a],b={};b.d_visid_stg_timeout_captured=c.ta;b.d_visid_cors=c.sa;b.d_fieldgroup=a;b.d_settimeout_overriden=c.ra;c.timeout?c.nb?(b.d_visid_timedout=1,b.d_visid_timeout=c.timeout-c.requestStart,b.d_visid_response=-1):(b.d_visid_timedout=\"n/a\",b.d_visid_timeout=\"n/a\",b.d_visid_response=\"n/a\"):(b.d_visid_timedout=0,b.d_visid_timeout=-1,b.d_visid_response=c.Ab-c.requestStart);b.d_visid_url=c.url;l.Y?this.send(b):this.S.push(b);delete this.d[a]},zb:function(){for(var a=0,c=this.S.length;a<c;a++)this.send(this.S[a])},ya:function(){return\"function\"===typeof setTimeout.toString?-1<setTimeout.toString().indexOf(\"[native code]\")?0:1:-1}};a.Mb=o;var w={isClientSideMarketingCloudVisitorID:i,MCIDCallTimedOut:i,AnalyticsIDCallTimedOut:i,AAMIDCallTimedOut:i,d:{},Ha:function(a,c){switch(a){case F:c===k?this.MCIDCallTimedOut!==j&&(this.MCIDCallTimedOut=k):this.MCIDCallTimedOut=c;break;case D:c===k?this.AnalyticsIDCallTimedOut!==j&&(this.AnalyticsIDCallTimedOut=k):this.AnalyticsIDCallTimedOut=c;break;case C:c===k?this.AAMIDCallTimedOut!==j&&(this.AAMIDCallTimedOut=k):this.AAMIDCallTimedOut=c}}};a.isClientSideMarketingCloudVisitorID=function(){return w.isClientSideMarketingCloudVisitorID};a.MCIDCallTimedOut=function(){return w.MCIDCallTimedOut};a.AnalyticsIDCallTimedOut=function(){return w.AnalyticsIDCallTimedOut};a.AAMIDCallTimedOut=function(){return w.AAMIDCallTimedOut};a.idSyncGetOnPageSyncInfo=function(){a.f();return a.a(J)};a.idSyncByURL=function(d){var c,b=d||{};c=b.minutesToLive;var e=\"\";a.idSyncDisableSyncs&&(e=e?e:\"Error: id syncs have been disabled\");if(\"string\"!==typeof b.dpid||!b.dpid.length)e=e?e:\"Error: config.dpid is empty\";if(\"string\"!==typeof b.url||!b.url.length)e=e?e:\"Error: config.url is empty\";if(\"undefined\"===typeof c)c=20160;else if(c=parseInt(c,10),isNaN(c)||0>=c)e=e?e:\"Error: config.minutesToLive needs to be a positive number\";c={error:e,ec:c};if(c.error)return c.error;var e=d.url,f=encodeURIComponent,b=z,g,e=e.replace(/^https:/,\"\").replace(/^http:/,\"\");g=x.va([\"\",d.dpid,d.dpuuid||\"\"],\",\");d=[\"ibs\",f(d.dpid),\"img\",f(e),c.ttl,\"\",g];b.N(d.join(\"|\"));b.p();return\"Successfully queued\"};a.idSyncByDataSource=function(d){if(d!==Object(d)||\"string\"!==typeof d.dpuuid||!d.dpuuid.length)return\"Error: config or config.dpuuid is empty\";d.url=\"//dpm.demdex.net/ibs:dpid=\"+d.dpid+\"&dpuuid=\"+d.dpuuid;return a.idSyncByURL(d)};0>q.indexOf(\"@\")&&(q+=\"@AdobeOrg\");a.marketingCloudOrgID=q;a.cookieName=\"AMCV_\"+q;a.sessionCookieName=\"AMCVS_\"+q;a.cookieDomain=a.Ra();a.cookieDomain==m.location.hostname&&(a.cookieDomain=\"\");a.loadSSL=0<=m.location.protocol.toLowerCase().indexOf(\"https\");a.loadTimeout=3E4;a.CORSErrors=[];a.marketingCloudServer=a.audienceManagerServer=\"dpm.demdex.net\";var M={};M[A]=j;M[s]=j;if(v&&\"object\"==typeof v){for(var G in v)!Object.prototype[G]&&(a[G]=v[G]);a.idSyncContainerID=a.idSyncContainerID||0;a.ba();a.f();N=a.a(K);G=Math.ceil((new Date).getTime()/\nr.aa);!a.idSyncDisableSyncs&&z.bb(N,G)&&(a.j(s,-1),a.e(K,G));a.getMarketingCloudVisitorID();a.getAudienceManagerLocationHint();a.getAudienceManagerBlob();a.Va(a.serverState)}else a.ba();if(!a.idSyncDisableSyncs){z.cb();x.M(window,\"load\",function(){l.Y=j;o.X=o.o();o.zb();var a=z;a.Da()&&a.O()});try{a.na.U(function(a){z.U(a.data)},z.Q)}catch(O){}}}", "function SHA256() {\n\n}", "function es1(params) {\n \n}", "function GraFlicUtil(paramz){\n\t\n}", "getSignedUrl( endpoint, params ) {\n let crypto = window.CryptoJS || null;\n let recvWindow = 100000;\n let timestamp = Date.now() - ( recvWindow / 2 );\n let qstr = this._ajax.serializeData( Object.assign( { recvWindow, timestamp }, params ) );\n let signature = crypto ? crypto.HmacSHA256( qstr, this._apisecret ).toString( crypto.enc.Hex ) : '';\n return this._apiurl + endpoint + '?' + qstr + '&signature=' + signature;\n }", "callWithSignature(keypair) {\n this.checkFilter();\n var config = this._getRequestConfig(this.url, keypair);\n return this._sendNormalRequest(this.url, config)\n .then(r => this._parseResponse(r));\n}", "function Xuice() {\r\n}", "function TrackByFunction() {}", "function TrackByFunction() {}", "function TrackByFunction() {}", "function findTheSign() {\n \t\tspotify.search({ type:\"track\", query:\"The Sign\" }, function(err, data) {\n \t\t\tvar firstStep = data.tracks;\n \t\t\tvar secondStep = data.tracks.items;\n \t\t\tfor (var i = 0; i < secondStep.length; i++) {\n \t \t\t\tif (firstStep.items[i].artists[0].name === \"Ace of Base\") {\n\t \t\t\t\tif (firstStep.items[i].album.name != \"Greatest Hits\") {\n\t \t\t\t\t\tconsole.log(firstStep.items[i].artists[0].name);\n\t\t\t\t\t\tconsole.log(firstStep.items[i].name);\n\t\t\t\t\t\tconsole.log(firstStep.items[i].preview_url);\n\t\t\t\t\t\tconsole.log(firstStep.items[i].album.name);\n\t\t\t\t\t}\n\t \t\t\t}\n \t\t\t}\n \t\t});\t\t\t\n\t}", "function buildSignature(searchUrl, cacheSearchResults,\n disableCachedGets) {\n // Cast to boolean.\n cacheSearchResults = !!cacheSearchResults;\n disableCachedGets = !!disableCachedGets;\n\n return {\n 'create': {\n method: 'POST'\n },\n 'get': {\n method: 'GET',\n cache: !disableCachedGets\n },\n 'update': {\n method: 'PUT'\n },\n 'delete': {\n method: 'DELETE'\n },\n 'browse': {\n method: 'GET',\n isArray: true,\n responseType: 'json',\n cache: cacheSearchResults\n },\n 'search': {\n method: 'GET',\n url: searchUrl,\n isArray: true,\n responseType: 'json',\n cache: cacheSearchResults\n }\n };\n }", "function serializeEd25519Signature(writeStream, object) {\r\n writeStream.writeByte(\"ed25519Signature.type\", object.type);\r\n writeStream.writeFixedHex(\"ed25519Signature.publicKey\", ed25519_1.Ed25519.PUBLIC_KEY_SIZE, object.publicKey);\r\n writeStream.writeFixedHex(\"ed25519Signature.signature\", ed25519_1.Ed25519.SIGNATURE_SIZE, object.signature);\r\n}", "function TrackByFunction() { }", "function TrackByFunction() { }", "set signature(signature) {\n if (signature)\n this._signature = signature;\n }", "function show_signature_static_page() {\n\tif (checksameurl(location.href, checkoutpage) == false) {\t// We discard the checkout\n\t\tif (selected_language == 'en') {\n\t\t\tdocument.write('<br/>' + company_name + ' ' + translate_sentence('team') + '.<br/><br/>');\n\t\t} else {\n\t\t\tdocument.write('<br/>' + translate_sentence('team') + ' ' + company_name + '.<br/><br/>');\n\t\t}\n\t}\n}", "static uploadPoPFile() {\n return `purchase/payment-methods/regular-eft/payment-proof/upload`\n }", "function userInfo(){\n\n}", "function uploadSignatureBase(filePath, upload)\n{ \n var apiFuncPath = '';\n if($('#USER_SIG_FILE'))\n {\n var spf = document.getElementById('USER_SIG_FILE');\n \n if(upload)\n {\n $('#userSigFileInput').val(spf.value.replace(/^.*[\\\\\\/]/, ''));\n apiFuncPath= \"/api/1/flash/uploadProjectSigFile\";\n }\n else//clear\n {\n $('#userSigFileInput').val('');\n apiFuncPath = \"/api/1/flash/deleteProjectSigFile\";\n }\n \n uploadSignature(spf.files, filePath, apiFuncPath);\n }\n}", "function checkSignature(id, regexp, obj, args) {\r\n\tvar types = signature.apply(this, [obj].concat(args));\r\n\tif (!regexp.exec(types)) {\r\n\t\tthrow new TypeError(\"Sermat.checkSignature: Wrong arguments for construction of \"+ id\r\n\t\t\t+\" (\"+ types +\")!\");\r\n\t}\r\n\treturn true;\r\n}", "function karinaFaarNotifikation() {\n\n\n\n}", "function verify_webhook_sig(sig, secret, body)\n{\n var hmac = crypto.createHmac('sha1', secret);\n hmac.update(body);\n var digest = hmac.digest('hex');\n return sig == digest;\n}", "function buildSignatureHeader(self, ws) {\n ws.authorization = 'AWS4-HMAC-SHA256 ' +\n 'Credential=' + self.config.accessKeyId + '/' + ws.credentialScope + ', ' +\n 'SignedHeaders=' + ws.signedHeaders + ', ' +\n 'Signature=' + ws.signature\n}", "static scratchjr_choosecamera(body) {\n WebUtils.log(\"Web.scratchjr_choosecamera({0})\".format(body));\n }", "function nameFromUrl(url, method, body) {\n var hash = crypto.createHash('md5');\n hash.update(url + method);\n if (body && body.length > 0) { hash.update(body) }\n return hash.digest('hex');\n }", "function verifyRequestSignature(req, res, buf) {\n var signature = req.headers[\"x-hub-signature\"];\n if (!signature) {\n // For testing, let's log an error. In production, you should throw an \n // error.\n console.error(\"Couldn't validate the signature.\");\n } else {\n //console.error(\"APP_SECRET\", APP_SECRET);\n //console.error(\"PAGE_ACCESS_TOKEN\", PAGE_ACCESS_TOKEN);\n var elements = signature.split('=');\n var method = elements[0];\n var signatureHash = elements[1];\n var expectedHash = crypto.createHmac('sha1', APP_SECRET)\n .update(buf)\n .digest('hex');\n //console.error(\"expectedHash\", expectedHash);\n //console.error(\"signatureHash\", signatureHash);\n //if (signatureHash != expectedHash) {\n // throw new Error(\"Couldn't validate the request signature.\");\n //}\n }\n}", "function saludar(referencia){\n console.log('Hola ' + referencia);\n}", "function Sref() {\r\n}", "function Transform$7() {}", "function kp() {\n $log.debug(\"TODO\");\n }", "function Shlock(kind, method, url ) {\n this.kind = kind;\n this.method = method;\n this.url = url;\n this.time = new Date().toJSON();\n}", "moe() {\r\n console.log('I am digesting')\r\n }", "function verifyRequestSignature(req, res, buf) {\n try {\n var signature = req.headers[\"x-hub-signature\"];\n if (!signature) {\n throw new Error(\"Could not find a signature.\");\n } else {\n var elements = signature.split('=');\n var method = elements[0];\n var signatureHash = elements[1];\n var expectedHash = crypto.createHmac('sha1', APP_SECRET).update(buf).digest('hex');\n if (signatureHash != expectedHash) {\n throw new Error(\"Unexpected signature found.\");\n }\n }\n } catch (err) {\n console.error(err);\n throw new Error(err);\n }\n}", "function sign( file, key, publish, paymentIn, feeIn ){\n\n\tcheckForMissingArg( file, \"file\" );\n\tcheckForMissingArg( key, \"key\" );\n\n\tvar payment = (paymentIn == undefined) ? minimumPayment : paymentIn;\n\tvar fee = (feeIn == undefined) ? minimumFee : feeIn;\n\n\treturn send( key, file, payment, fee, publish );\n}", "function verifyRequestSignature(req, res, buf) {\n var signature = req.headers[\"x-hub-signature\"];\n\n if (!signature) {\n throw new Error(\"Couldn't validate the signature.\");\n } else {\n var elements = signature.split('=');\n var method = elements[0];\n var signatureHash = elements[1];\n\n var expectedHash = crypto.createHmac('sha1', constants.APP_SECRET)\n .update(buf)\n .digest('hex');\n\n if (signatureHash != expectedHash) {\n throw new Error(\"Couldn't validate the request signature.\");\n }\n }\n}" ]
[ "0.60013825", "0.5757865", "0.5516237", "0.5448629", "0.5257952", "0.5255334", "0.52219224", "0.52197003", "0.5188639", "0.5185372", "0.5144719", "0.51335114", "0.51055086", "0.50911427", "0.5061742", "0.5001347", "0.4997836", "0.49959144", "0.4950724", "0.49175897", "0.4916245", "0.49148345", "0.49045554", "0.48759896", "0.48686025", "0.48211858", "0.48098898", "0.4808067", "0.4808067", "0.47977194", "0.47902542", "0.47856122", "0.47820726", "0.4776925", "0.47503063", "0.47449192", "0.47396758", "0.47265217", "0.4724298", "0.47233626", "0.4708685", "0.46973097", "0.4692778", "0.46908638", "0.4682893", "0.46773317", "0.46538854", "0.46523595", "0.46504053", "0.46495083", "0.4648106", "0.4647074", "0.46426365", "0.4640917", "0.4637767", "0.4636019", "0.46349555", "0.46345314", "0.46314517", "0.46309948", "0.46292838", "0.46260765", "0.46248254", "0.46147695", "0.46094736", "0.46050683", "0.46027908", "0.4597706", "0.458208", "0.45808598", "0.45751825", "0.45657307", "0.4562207", "0.4562207", "0.4562207", "0.45619458", "0.45613137", "0.4559928", "0.45598224", "0.45598224", "0.45500082", "0.45478308", "0.453223", "0.45307747", "0.4529638", "0.452718", "0.45163056", "0.45112023", "0.45103776", "0.45099247", "0.4497274", "0.4494377", "0.44891682", "0.4476094", "0.44735232", "0.4473323", "0.44713184", "0.44684976", "0.4461263", "0.44596604", "0.44558465" ]
0.0
-1
Recuperation de la position du curseur par rapport au Canvas
getPosition(pos) { //getBoundingClientRect() renvoie la taille du canvas et sa position par rapport au viewport. const canvas = this.canvas.getBoundingClientRect(); const x = (pos.x - canvas.left) / (canvas.right - canvas.left) * this.canvas.width; //récupère la position exacte de la souris (position X) const y = (pos.y - canvas.top) / (canvas.bottom - canvas.top) * this.canvas.height; return { x, y }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCurPos() {\n let xPos = event.offsetX;\n let yPos = event.offsetY;\n //for each selected==true ? card chang its position : nothing\n player.cards.onHand.forEach(element => {\n if (element.selected) {\n element.speaking = false;\n let distanceX = element.width / 2;\n let distanceY = element.height / 2;\n element.x = xPos - distanceX;\n element.y = yPos - distanceY;\n }\n });\n}", "dibujar(canvas, ctx) {\n // const x = map(this.posX() - 10, 0, this.tablero.ancho, 0, canvas.width);\n // const y = map(this.posY() - 10, 0, this.tablero.alto, 0, canvas.height);\n const x = (this.tablero.vista.ancho * this.posX() / this.tablero.ancho) | 0;\n const y = (this.tablero.vista.alto * this.posY() / this.tablero.alto) | 0;\n ctx.strokeStyle = '#0f';\n ctx.fillStyle = this.color;\n ctx.beginPath();\n ctx.arc(x , y, this.tablero.anchoCelda / 2, 0, (Math.PI / 180) * 360);\n ctx.fill();\n // ctx.beginPath();\n // ctx.strokeRect(x - this.tablero.vista.anchoCelda / 2, y - this.tablero.vista.anchoCelda / 2, this.tablero.anchoCelda, this.tablero.anchoCelda);\n // ctx.stroke();\n }", "setPosition(e) {\n\n this.mouseIsDown = true;\n this.ctx.beginPath();\n this.ctx.moveTo(e.offsetX, e.offsetY);\n\n // Ajouter un event pour commencer à dessiner lorsq'on deplace la souris //\n this.carte.signElt.addEventListener('mousemove', (e) => { this.draw(e) });\n\n }", "function clicCanvas(e){\n\t// position de la souris / document\n\tvar xSourisDocument = e.pageX; \n var ySourisDocument = e.pageY;\n\t// position du canvas / document\n\tvar xCanvas = monCanvas.offsetLeft;\n\tvar yCanvas = monCanvas.offsetTop;\n\t// position du clic / canvas\n\txSourisCanvas = xSourisDocument - xCanvas;\n\tySourisCanvas = ySourisDocument - yCanvas;\n\t// test si un cercle est cliqué\n\tfor (var idx = 0; idx < listeBalles.length; idx++) {\n var R = listeTailles[listeBalles[idx][2]][0];\n if(Math.abs(listeBalles[idx][3]-xSourisCanvas) < R && Math.abs(listeBalles[idx][5]-ySourisCanvas) < R){\n\t\t\tlisteBalles[idx][6] = 0;\n\t\t}\t\n\t}\n}", "findxy(res, e) \n {\n let offLeft = 0, offTop = 0, el = this.canvas.current;\n while(el)\n {\n offLeft += el.offsetLeft;\n offTop += el.offsetTop;\n el = el.offsetParent;\n }\n let scaleWidth = this.canvas.current.clientWidth, scaleHeight = this.canvas.current.clientHeight;\n let actualWidth = this.canvas.current.width, actualHeight = this.canvas.current.height;\n if (res === 'down') {\n this.setState({prevX: this.state.currX,\n prevY: this.state.currY, \n currX: (e.clientX - offLeft + document.documentElement.scrollLeft)*actualWidth/scaleWidth, //Scaling the co-ordinates \n currY: (e.clientY - offTop + document.documentElement.scrollTop)*actualHeight/scaleHeight, // of mouse pointer.\n flag: true\n });\n this.state.ctx.beginPath(); \n this.state.ctx.strokeStyle = this.state.x;\n this.state.ctx.lineWidth = this.state.y-1;\n this.state.ctx.rect(this.state.currX, this.state.currY, this.state.y-1, this.state.y-1);\n this.state.ctx.stroke();\n }\n if (res === 'up' || res === \"out\"){\n this.setState({flag: false});\n }\n if (res === 'move') {\n if (this.state.flag) {\n this.setState({prevX: this.state.currX, \n prevY: this.state.currY, \n currX: (e.clientX - offLeft + document.documentElement.scrollLeft)*actualWidth/scaleWidth,\n currY: (e.clientY - offTop + document.documentElement.scrollTop)*actualHeight/scaleHeight,\n });\n this.draw();\n }\n }\n }", "function posicion_mouse_sobre_canvas(canvas,e) {\r\n\r\n\tvar curleft = 0, curtop = 0;\r\n\tvar x;\r\n var y;\r\n\tvar xTotal =0;\r\n var yTotal =0;\r\n\tvar posiciones= new Array();\r\n if (canvas.offsetParent) {\r\n do {\r\n curleft += canvas.offsetLeft;\r\n curtop += canvas.offsetTop;\r\n } while (canvas = canvas.offsetParent);\r\n \r\n \t \r\n if (e.pageX || e.pageY)\r\n {\r\n x = e.pageX;\r\n y = e.pageY;\r\n }\r\n else {\r\n x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;\r\n y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;\r\n }\r\n \r\n xTotal= x - curleft;\r\n yTotal= y - curtop;\r\n\r\nposiciones[0]=xTotal;\r\nposiciones[1]=yTotal;\r\n\r\n\t\r\n}else{\r\n\t\r\n\tposiciones[0]=0;\r\n\tposiciones[1]=0;\r\n}\r\n \r\n \r\nreturn posiciones;\r\n}", "function ConnectedPosition() { }", "function draw() {\n cenas[cenaAtual].draw();\n}", "draw(ctx){\n ctx.save()\n ctx.beginPath()\n ctx.strokeStyle = this.strokeColor\n ctx.lineWidth = this.strokeWidth\n\n const MAX_HEAD = 80\n let new_y = (this.pesanteur) ? window.innerHeight - this.height - MAX_HEAD : this.y\n ctx.rect(this.x, new_y, this.width, this.height)\n\n ctx.fillStyle = this.fillColor\n\n ctx.closePath()\n ctx.fill()\n ctx.stroke()\n ctx.restore() \n \n\n }", "display(){\n if(this.speed != -1){ //On dit qu'une balle sortie du jeu a une vitesse de -1\n this.updatePos();\n var ctx = this.gameboard.disp.getContext(\"2d\");\n ctx.beginPath();\n ctx.arc(this.posx, this.posy, this.size, 0, 2 * Math.PI);\n ctx.fillStyle = \"white\";\n ctx.fill();\n ctx.stroke();\n ctx.closePath();\n }\n }", "function determineDrawPos(){\n let pos ={\n x: 0,\n y: 0\n }\n arms.forEach(function(index){\n let indexPos = findXY(index.radius,degToRad(index.direction))\n\n pos.x += indexPos.x\n\n pos.y += indexPos.y\n })\n\n return pos\n}", "getCanvasPosition( canvasID ) {\n let rect = canvasID.getBoundingClientRect()\n this.setState({\n canvasPosition: { left: rect.left, right: rect.right, top: rect.top, bottom: rect.bottom }\n })\n }", "drawCones(){\r\n // might be place where we add the x and y coords to the canvas to draw the cones\r\n for (let i = 0; i < this.numCones; i++)\r\n {\r\n cones[i].x = ((this.coneLoc[i].x));\r\n cones[i].y = (this.coneLoc[i].y);\r\n }\r\n }", "function TimelinePosCur() {\n var pos = null;\n for (var i = 0, len = tw.timeline.length; i < len; i++) {\n if (tw.timeline[i].time > tw.tCur) {\n pos = i - 1;\n break;\n }\n }\n // Case: no any value when get value-end in Timeline array[]\n if (pos === null)\n pos = tw.timeline.length - 1;\n // Store position of Animation\n tw.timePosCur = pos;\n }", "function viewPositionMetrics(){\n\t\t\t\t$(\"canvas\").mousedown(function(event){\n\t\t\t\t\tvar canvasOffsetX = $(this).position().left;\n\t\t\t\t\tvar canvasOffsetY = $(this).position().top;\n\n\t\t\t\t\tvar clickedX = Math.floor(event.pageX - canvasOffsetX);\n\t\t\t\t\tvar clickedY = Math.floor(event.pageY - canvasOffsetY);\n\t\t\t\t\tconsole.log(clickedX, clickedY);\n\t\t\t\t\tswitch (event.which){\n\t\t\t\t\t\tcase 1: \n\t\t\t\t\t\t\t//co-ords from click listener are able to progress the game\n\t\t\t\t\t\t\tif(!isGameOver){\n\t\t\t\t\t\t\t\tstartRound(clickedX, clickedY); \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\n\n\t\t\t\t\t\tcase 3: \n\t\t\t\t\t\t\tif(!isGameOver){\n\t\t\t\t\t\t\t\tplaceFlag(clickedX, clickedY);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\talert(\"error, something seems to be wrong..\");\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}", "function clickCanvas(e){\n if(cerrado == false){\n var eX = e.layerX;\n var eY = e.layerY;\n let circulo = new Circulo(eX, eY, 10, \"0\", \"100%\", 50, false);\n circulo.dibujarCirculo();\n poligono.addCirculo(circulo);\n poligono.trazarLinea(eX, eY);\n console.log(\"Coordenada en x: \" + eX);\n console.log(\"Coordenada en y: \" + eY);\n}\n}", "drawCanvas() {\n\n\t}", "function Vaisseau(x,y,size=5,couleur=\"blue\",orientation=\"bas\"){\r\n\t/* Fonction dessinant le vaisseau */\r\n\tvar i = -1\r\n\tif(orientation==\"haut\"){\r\n\t\t\r\n\t\ti = 1;\r\n\t}\r\n\tvar canvas = document.getElementById('game_area');\r\n\tvar vaisseau = canvas.getContext(\"2d\");\r\n\tvaisseau.strokeStyle = couleur;\r\n\tvaisseau.lineCap = \"round\";\r\n\tvaisseau.lineWidth = 2;\r\n\tvaisseau.beginPath();\r\n\tvaisseau.moveTo(x,y);\r\n\t\t\r\n\tvaisseau.lineTo(x+size*i,y+size*i);\r\n\tvaisseau.lineTo(x+size*i,y+(size+5)*i);\r\n\tvaisseau.lineTo(x+size*i,y+size*i);\r\n\t\t\r\n\tvaisseau.lineTo(x-size*i,y+size*i);\r\n\tvaisseau.lineTo(x-size*i,y+(size+5)*i);\r\n\tvaisseau.lineTo(x-size*i,y+size*i);\r\n\t\t\r\n\tvaisseau.lineTo(x,y);\r\n\tvaisseau.stroke();\r\n}", "draw(ctx){\r\n ctx.save()\r\n ctx.beginPath()\r\n ctx.strokeStyle = this.strokeColor\r\n ctx.lineWidth = this.strokeWidth\r\n\r\n const MAX_HEAD = 80\r\n let new_y = (this.pesanteur) ? window.innerHeight - this.height - MAX_HEAD : this.y\r\n ctx.rect(this.x, new_y, this.width, this.height)\r\n\r\n ctx.fillStyle = this.fillColor\r\n\r\n ctx.closePath()\r\n ctx.fill()\r\n ctx.stroke()\r\n ctx.restore()\r\n }", "function renderCanvas() {\n if (drawing) {\n ctx.moveTo(lastPos.x, lastPos.y);\n ctx.lineTo(mousePos.x, mousePos.y);\n ctx.stroke();\n lastPos = mousePos;\n }\n }", "function initPos_criar(){\n\t\n\tambNum = new createjs.Text( contador + \" / 10\", \"20px CCCLTS\", \"#000000\");\n\tambNum.x = 710;\n\tambNum.y = 540;\n\tambNum.textBaseline = \"alphabetic\";\n\t\n\tretornar_bttn.x = 120;\n\tretornar_bttn.y = 100;\n\t\n\tcriarVoltar_bttn.x = 670;\n\tcriarVoltar_bttn.y = 535;\n\t\n\tavcCriar_bttn.x = 800;\n\tavcCriar_bttn.y = 535;\n\t\n\timprimeBttn = new createjs.Shape();\n\timprimeBttn.graphics.beginFill(\"black\").rect(0,0,70,70);\n\timprimeBttn.alpha = 0.01;\n\timprimeBttn.id = \"imprimeBttn\";\n\timprimeBttn.x = 93;\n\timprimeBttn.y = 583;\n\t\n\tsalvaBttn = new createjs.Shape();\n\tsalvaBttn.graphics.beginFill(\"black\").rect(0,0,70,70);\n\tsalvaBttn.alpha = 0.01;\n\tsalvaBttn.id = \"salvaBttn\";\n\tsalvaBttn.x = 188;\n\tsalvaBttn.y = 583;\n\t\n\tcrpUp.x = 419; crpUp.y = 185;\n\traboUp.x = 314; raboUp.y = 185;\n\tcbaUp.x = 523; cbaUp.y = 185;\n\t\n\tcrpDown.y = 335; crpDown.x = crpUp.x;\n\tcbaDown.y = 335; cbaDown.x = cbaUp.x;\n\traboDown.y = 335; raboDown.x = raboUp.x;\n\t\n\tanimal_montando.y = -5;\n\t\n\t//Funcoes que chamam o callback do click nos botoes EXCLUSIVO DO CRIAR MEU BICHO\n\tretornar_bttn.onPress = \n\t\tcriarVoltar_bttn.onPress =\n\t\t\tavcCriar_bttn.onPress =\n\t\t\t\timprimeBttn.onPress = \n\t\t\t\t\tsalvaBttn.onPress = handleClick_criar;\n\t\n\tcrpDown.onPress = crpUp.onPress =\n\t\tcbaDown.onPress = cbaUp.onPress =\n\t\t\traboDown.onPress = raboUp.onPress = handleClick;\n\t\t\t\n\t\n\t\n}", "function getPosition(e) { \n restbound = 0.03;\n restime = 6500;\n fire =true;\n mouseX = e.x - canvas.offsetLeft;\n mouseY = e.y - canvas.offsetTop;\n chat.server.send(mouseX / W, mouseY / H);\n push = true; \n }", "draw(){\n canCon.beginPath();\n canCon.rect(this.x, this.y, this.width, this.height);\n canCon.fillStyle = 'blue';\n canCon.fill();\n}", "setpos(x, y) {\n let disX = x - this.w / 2;\n let disY = y - this.h / 2;\n if (disX < 0)\n disX = 0;\n else if (disX > canvas.width - this.w)\n disX = canvas.width - this.w;\n if (disY < 0)\n disY = 0;\n else if (disY > canvas.height - this.w)\n disY = canvas.height - this.w;\n this.x = disX;\n this.y = disY;\n }", "function dibujar_diente_sellante_realizado (canvas,px,py,num){\r\n\t\r\n\t\r\n\tif (canvas.getContext) {\r\n\t\t var ctx = canvas.getContext('2d');\r\n\t\t var k = (39*num);\r\n\t\t// cambiamos el color de llenado del contexto\r\n\t\t //ctx.fillStyle = \"#1975D1\";\r\n\t\t ctx.fillStyle = \"blue\";\r\n\t\t \r\n\t\t // asignamos al contexto el tipo de letra, tamaño y posicion inicial\r\n\t\t ctx.font = 'bold 35px sans-serif';\r\n\t\t ctx.textBaseline = 'top';\r\n\t\t \r\n\t\t // dibujamos el texto\r\n\t\t ctx.fillText('S', px+k, py); // fillText(texto, x, y);\r\n\t\t\r\n\t\t \r\n\t\t }\r\n\t}", "begin() {\n this.ctx.beginPath();\n this.ctx.moveTo(this.position[0], this.position[1]);\n }", "function getCanvasPos(canvas, x, y) {\n var rect = canvas.getBoundingClientRect();\n return {x: x - rect.left - 5, y: y - rect.top - 5}; //subtract 5 for border\n }", "function getCursorInCanvas(point){\n var rect = point.target.getBoundingClientRect();\n newLifeX = Math.floor((point.clientX-rect.left)/cellSide);\n newLifeY = Math.floor((point.clientY-rect.top)/cellSide);\n return [newLifeY,newLifeX];\n}", "function getRealPosition( index ) {\n var stage = app.getDrawStage();\n return { 'x': stage.offset().x + index.x / stage.scale().x,\n 'y': stage.offset().y + index.y / stage.scale().y };\n }", "function draw(){\r\n drawFusee(\"white\");\r\n if (leftPressed && x_fusee > (hauteur_fusee)){\r\n x_fusee -= 7;\r\n }\r\n if (rightPressed && x_fusee < canvas.width-(hauteur_fusee*3)){\r\n x_fusee += 7;\r\n }\r\n if (upPressed && y_fusee > (hauteur_fusee)){\r\n y_fusee -= 7;\r\n }\r\n if (downPressed && y_fusee < canvas.height-(hauteur_fusee*2)){\r\n y_fusee += 7;\r\n }\r\n drawFusee(\"blue\");\r\n}", "function getPos(e) {\n var r = canvas.getBoundingClientRect();\n return { x: e.clientX - r.left, y: e.clientY - r.top };\n }", "function initDraw(canvass) {\n \n // setMousePosition: (e) => void\n // e: mouse event\n // Adjusts the cursor position\n function setMousePosition(e) {\n var ev = e || window.event; //Moz || IE\n if (ev.pageX) { //Moz\n mouse.x = ev.pageX + window.pageXOffset;\n mouse.y = ev.pageY + window.pageYOffset;\n } else if (ev.clientX) { //IE\n mouse.x = ev.clientX + document.body.scrollLeft;\n mouse.y = ev.clientY + document.body.scrollTop;\n }\n };\n\n var mouse = {\n x: 0,\n y: 0,\n startX: 0,\n startY: 0\n };\n var element = null;\n var initialOffset = 0\n\n canvass.onmousemove = function (e) {\n setMousePosition(e);\n if (element !== null) {\n element.style.width = Math.abs(mouse.x - mouse.startX) + 'px';\n element.style.height = Math.abs(mouse.y - window.pageYOffset + initialOffset - mouse.startY) + 'px';\n element.style.left = (mouse.x - mouse.startX < 0) ? mouse.x + 'px' : mouse.startX + 'px';\n element.style.top = (mouse.y - mouse.startY < 0) ? mouse.y - window.pageYOffset + 'px' : mouse.startY - initialOffset + 'px';\n }\n }\n\n canvass.onclick = function (e) {\n if (element !== null) {\n element = null;\n canvass.style.cursor = \"default\";\n boxes = [mouse.x/canvas.width * 100, (mouse.y - window.pageYOffset)/canvas.height * 100, mouse.startX/canvas.width * 100, (mouse.startY - initialOffset)/canvas.height * 100];\n console.log(boxes);\n } else {\n mouse.startX = mouse.x;\n mouse.startY = mouse.y;\n initialOffset = window.pageYOffset;\n element = document.createElement('div');\n element.className = 'rectangle';\n element.style.left = mouse.x + 'px';\n element.style.top = (mouse.y - window.pageYOffset) + 'px';\n if(canvass.firstChild){\n canvass.removeChild(canvass.firstChild);\n }\n canvass.appendChild(element)\n canvass.style.cursor = \"crosshair\";\n }\n }\n}", "draw(){\n this.ctx.strokeStyle = this.getStrokeColor();\n this.ctx.lineWidth = 2;\n this.ctx.beginPath()\n this.ctx.moveTo(this.prevx, this.prevy);\n this.ctx.lineTo(this.x, this.y)\n this.ctx.stroke()\n this.ctx.fill();\n }", "function renderCanvas() {\n if (drawing) {\n ctx.moveTo(lastPos.x, lastPos.y);\n ctx.lineTo(mousePos.x, mousePos.y);\n ctx.stroke();\n lastPos = mousePos;\n }\n }", "function dessineBriques() {\n\n for (let i = 0; i < nbRow; i++) {\n for (let j = 0; j < nbCol; j++) {\n\n if (briques[i][j].statut === 1) {\n\n let briqueX = (j * (largeurBrique + 10) + 35); // (j * (75 + 10(espace entre les cases)) + 35(espace gauche-droite) )\n let briqueY = (i * (hauteurBrique + 10) + 30);\n\n console.log(briqueX, briqueY);\n\n // Positionner\n briques[i][j].x = briqueX;\n briques[i][j].y = briqueY;\n\n // Dessiner\n ctx.beginPath();\n ctx.rect(briqueX, briqueY, largeurBrique, hauteurBrique);\n ctx.fillStyle = '#333';\n ctx.fill();\n\n } \n } \n }\n}", "function calcola() {\n\n var dt = 0.3;\n\n // muovi la posizione\n x = x + vx*dt;\n y = y + vy*dt;\n\n // limiti nel movimento:\n var x0 = r,\n x1 = canvas.width - r,\n y0 = r,\n y1 = canvas.height - r;\n\n // gestisce i rimbalzi orizzontali\n if(x>x1) { x = x1 - (x-x1); vx = -vx; }\n else if(x<x0) { x = x0 + (x0-x); vx = -vx; }\n\n // gestisce i rimbalzi verticali\n if(y>y1) { y = y1 - (y-y1); vy = -vy; }\n else if(y<y0) { y = y0 + (y0-y); vy = -vy; }\n\n}", "function getPosition( evt, canvas ) {\n\n\t\tvar rect = canvas.getBoundingClientRect();\n\n\t\tvar scaleX = canvas.width / rect.width;\n\t\tvar scaleY = canvas.height / rect.height;\n\n\t\treturn {\n\t\t\tx: ( evt.clientX - rect.left ) * scaleX,\n\t\t\ty: ( evt.clientY - rect.top ) * scaleY\n\t\t};\n\t}", "function renderCanvas() {\n if (drawing) {\n ctx.moveTo(lastPos.x, lastPos.y);\n ctx.lineTo(mousePos.x, mousePos.y);\n ctx.stroke();\n lastPos = mousePos;\n }\n }", "function findxy(res, e) {\n if (res == 'down') {\n prevX = currX;\n prevY = currY;\n currX = e.clientX - canvas.offsetLeft;\n currY = e.clientY - canvas.offsetTop;\n\n flag = true;\n dot_flag = true;\n if (dot_flag) {\n ctx.beginPath();\n ctx.fillStyle = x;\n ctx.fillRect(currX, currY, 2, 2);\n ctx.closePath();\n dot_flag = false;\n }\n }\n if (res == 'up' || res == \"out\") {\n flag = false;\n }\n if (res == 'move') {\n \n if (flag) {\n prevX = currX;\n prevY = currY;\n currX = e.clientX - canvas.offsetLeft;\n currY = e.clientY - canvas.offsetTop;\n draw(prevX , prevY , currX , currY , x , y);\n }\n }\n}", "function getCursorPosition(canvas, event) {\n if (down) {\n const rect = canvas.getBoundingClientRect();\n mouseX = event.clientX - rect.left;\n mouseY = event.clientY - rect.top;\n context.fillRect(mouseX, mouseY, 1, 1);\n }\n}", "function OverlayConnectionPosition() { }", "get canvasRow() { return Math.round(this.y / game.canvasRowHeight); }", "getCurrentRect(canvasRect) {\n let clientRect = this.nativeElement.getBoundingClientRect();\n return {\n bottom: this._currentPosition[1] + clientRect.height + ((canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.top) || 0),\n left: this._currentPosition[0] + ((canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.left) || 0),\n height: clientRect.height,\n width: clientRect.width,\n right: this._currentPosition[0] + clientRect.width + ((canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.left) || 0),\n top: this._currentPosition[1] + ((canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.top) || 0)\n };\n }", "trackToCoords(_c) {\r\n\t\t\t\tthis.x = _c.x - (SCREEN_WIDTH*0.5)|0;\r\n\t\t\t\tthis.y = _c.y - (SCREEN_HEIGHT*0.5)|0;\r\n\t\t\t}", "function select() {\n let xPos = event.offsetX;\n let yPos = event.offsetY;\n player.cards.onHand.forEach(element => {\n if (\n yPos > element.y &&\n yPos < element.y + element.height &&\n xPos > element.x &&\n xPos < element.x + element.width\n ) {\n console.log(\"we got ya\");\n element.selected = true;\n element.degrees = 0;\n console.log(element);\n //than create event listener\n myDom.canvas3.addEventListener(\"mousemove\", getCurPos, false);\n }\n });\n}", "function correr(){\n requestAnimationFrame(correr); //inicalizador del timer\n actividad(); //actualizamos la actividad de los elementos del canvas(Lienzo)\n pintar(ctx); //pintamos los elementos en el lienzo\n\n //inicializamos los controladores de los botones del raton en cada iteracion\n ultinaPresion=null;\n ultimaliberacion=null;\n}", "draw() {\n\t\tlet width = 30;\n\n\t\tinfo.context.beginPath();\n\t\tinfo.context.rect(this.position.x - width/2, this.position.y - width/2, width, width);\n\t\tinfo.context.fillStyle = this.color;\n\t\tinfo.context.fill();\n\t}", "function dibujar_diente_sellante_indicado (canvas,px,py,num){\r\n\t\r\n\tif (canvas.getContext) {\r\n\t\t var ctx = canvas.getContext('2d');\r\n\t\t var k = (39*num);\r\n\t\t// cambiamos el color de llenado del contexto\r\n\t\t ctx.fillStyle = \"red\";\r\n\t\t \r\n\t\t \r\n\t\t // asignamos al contexto el tipo de letra, tamaño y posicion inicial\r\n\t\t ctx.font = 'bold 35px sans-serif';\r\n\t\t ctx.textBaseline = 'top';\r\n\t\t \r\n\t\t // dibujamos el texto\r\n\t\t ctx.fillText('S', px+k, py); // fillText(texto, x, y);\r\n\t\t\r\n\t\t \r\n\t\t }\r\n\t}", "function drawCanyon(t_canyon)\n{\n\n fill(153,27,0)\n rect(t_canyon.x_pos + 80, 430, t_canyon.width - 75,200)\n \n fill (102,178,255)\n rect(t_canyon.x_pos + 105,430, t_canyon.width - 35,200) \n \n fill(153,27,0)\n rect(t_canyon.x_pos + 150,430, t_canyon.width - 75,200) \n \n}", "getCanvasRelativePosition(event) {\n const rect = canvas.getBoundingClientRect();\n return {\n x: event.clientX - rect.left,\n y: event.clientY - rect.top,\n };\n }", "function getCanvasXY (map, current_position) {\n var scale = Math.pow(2, map.getZoom());\n console.log(scale);\n var nw = new google.maps.LatLng(\n map.getBounds().getNorthEast().lat(),\n map.getBounds().getSouthWest().lng()\n );\n var world_coordinate_nw = map.getProjection().fromLatLngToPoint(nw);\n var world_coordinate = map.getProjection().fromLatLngToPoint(current_position);\n var position_offset = new google.maps.Point(\n Math.floor((world_coordinate.x - world_coordinate_nw.x) * scale),\n Math.floor((world_coordinate.y - world_coordinate_nw.y) * scale)\n );\n return position_offset;\n// console.log(nw);\n// console.log(world_coordinate_nw);\n }", "function setPosition(e) {\n var rect = canvas.getBoundingClientRect();\n pos.x = e.clientX - rect.left;\n pos.y = e.clientY - rect.top;\n }", "function principal(){\n\n borraCanvas();\n\n console.log(ratonX + ' - ' + ratonY);\n\n for(i=0; i<numParticulas;i++){\n particulas[i].actualiza();\n }\n\n}", "function findxy(res, e) {\n debug_update(prevX, prevY, currX, currY, e.clientX, e.clientY);\n if (res == 'down') {\n prevX = currX;\n prevY = currY;\n currX = e.clientX - canvas.offsetLeft + document.body.scrollLeft;\n currY = e.clientY - canvas.offsetTop + document.body.scrollTop;\n prevX = currX;\n prevY = currY;\n\t\t\n\t\tconsole.log(lastIter[currY-currY%pixelSize][currX-currX%pixelSize]);\n\t\tctx.fillRect(currX-currX%pixelSize,currY-currY%pixelSize,pixelSize,pixelSize);\n\t\tpixArr[currX-currX%pixelSize][currY-currY%pixelSize] = 1;\n\t\tlastIter[currY-currY%pixelSize][currX-currX%pixelSize] = 1;\n\t\tconsole.log(lastIter[currY-currY%pixelSize][currX-currX%pixelSize]);\n flag = true;\n }\n if (res == 'up' || res == \"out\") {\n flag = false;\n }\n if (res == 'move') {\n\t\tconsole.log(flag);\n if (flag) {\n currX = e.clientX - canvas.offsetLeft + document.body.scrollLeft;\n currY = e.clientY - canvas.offsetTop + document.body.scrollTop;\n prevX = currX;\n prevY = currY;\n\t\t\tctx.fillRect(currX-currX%pixelSize,currY-currY%pixelSize,pixelSize,pixelSize);\n\t\t\tpixArr[currY-currY%pixelSize][currX-currX%pixelSize] = 1;\n\t\t\tlastIter[currY-currY%pixelSize][currX-currX%pixelSize] = 1;\n }\n }\n}", "draw(){\r\n ctx.beginPath();\r\n ctx.rect(this.x, this.y, this.width, this.height);\r\n //console.log(this.x)\r\n ctx.fillStyle = D_color;\r\n ctx.fill();\r\n ctx.closePath();\r\n }", "function dispMouseCoord(){\t\t\t\t\t//used for debugging, put in main function\n\tctx.font = \"12px Arial\";\n\tctx.fillStyle = \"black\";\n\tctx.textAlign = \"left\";\n\tctx.fillText(`x: ${mousePos.x}, y: ${mousePos.y}`, 16, 16);\n}", "function actividad(){\n //asignacion del la posicion del raton a una variable puntero\n puntero.x=raton.x;\n puntero.y=raton.y;\n \n //limites del canvas(lienzo)\n if(puntero.x<0)\n puntero.x=0;\n if(puntero.x>canvas.width)\n puntero.x=canvas.width;\n if(puntero.y<0)\n puntero.y=0;\n if(puntero.y>canvas.height)\n puntero.y=canvas.height;\n\n //si se ha precionado el boton del raton(el click)\n if(ultinaPresion===1){\n for (i=0, l = arrastrables.length;i<l; i++){\n //si existe colicion entre los circulos(nodos) y puntero\n if(arrastrables[i].distancia(puntero)<0){\n //si el control de llamadas esta activo\n if(control){\n tposiciones.push(i); //agrega el indice del arreglo de circulos(nodos) al arreglo posiciones\n var pos=tposiciones.length; //calculo de la cantidad de elementos con que cuenta el arrglo tposiciones\n //si el siguiente click es par \n if(tposiciones.length%2 == 0){\n pos=tposiciones.length; //actualiza la la cantidad de elementos del arreglo tposicines\n var f = pregunta21();\n if( arrastrables[tposiciones[pos-2]] != arrastrables[tposiciones[pos -1]]){ //variable en que se almacena la capaciadad de los nodos que interactuan\n lineas.push(new Linea(arrastrables[tposiciones[pos-2]],arrastrables[tposiciones[pos-1]],f.f,f.cf)); //agregar las nuevas lineas con sus posiciones respectivas\n break; //termino las iteraciones del for\n }\n }\n }\n //si no esta activo el control de llamdas\n else{\n arrastrando=i; //guardar el indice del el circulo(nodo) seleccionado\n break; //salir de las iteraciones for\n }\n }\n }\n }\n //si se ha dejado de precionar el boton del raton \n else if(ultimaliberacion === 1){\n arrastrando = null; //eliminar el indice guardado del circulo(nodo) seleccionado anteriormente\n }\n\n //si existe el indice guardado para mover circulo(nodo) seleccionado \n if(arrastrando !== null){\n //actualizar la posicion del esfera arrastrada. Asimismo, las lineas asiganadas a ellas\n arrastrables[arrastrando].x = puntero.x;\n arrastrables[arrastrando].y = puntero.y;\n }\n}", "function draw() {\n\n //Aqui se esta borrando y repintando toda la pantalla\n ctx.fillRect(0, 0, WIDTH, HEIGHT);\n ctx.save();\n ctx.fillStyle = \"#fff\";\n\n //Aqui van mis draws\t\t \n miRectangulo.draw();\n\n\n ctx.restore();\n}", "function getCanvasLoc(event, canvas) {\n var x = event.clientX;\n var y = event.clientY;\n var rect = canvas.getBoundingClientRect();\n x -= rect.left;\n y -= rect.top;\n return {x: x, y: y};\n}", "function coordonnees() {\n // code fictif\n return { x:25, y:12.5 };\n}", "function mouseXY(e){\r\n var rect = canvas.getBoundingClientRect();\r\n mouseX = e.x - rect.left;\r\n mouseY = e.y - rect.top;\r\n\r\n}", "function renderCanvas()\n {\n if (drawing)\n {\n context.moveTo(lastPos.x, lastPos.y);\n context.lineTo(mousePos.x, mousePos.y);\n context.stroke();\n lastPos = mousePos;\n }\n }", "draw(ctx){\n saveMatrix();\n ctx.save();\n translate(0,0);\n\n if (this.extended) {\n this.dockPointsReq.forEach((value) => {\n value.draw(ctx);\n });\n this.dockPointsDev.forEach((value) => {\n value.draw(ctx);\n });\n }\n\n ctx.strokeRect(this.x,this.y+this.margin_top,this.width,this.height);\n restoreMatrix();\n ctx.restore();\n }", "function getCoords(e) {\t\t\n\t\treturn { x: e.pageX - theCanvas.offsetLeft, y: e.pageY - theCanvas.offsetTop };\n\t }", "function drawReticula(argument) {\n for (var i = 1; i <= canvasWidth-1; i++) {\n //verticales\n ctx.beginPath();\n ctx.moveTo(i*factorAumento, factorAumento);\n ctx.lineTo(i*factorAumento, canvasHeight*factorAumento-factorAumento);\n ctx.stroke();\n //horozontales\n ctx.beginPath();\n ctx.moveTo(factorAumento, i*factorAumento);\n ctx.lineTo(canvasHeight*factorAumento-factorAumento, i*factorAumento);\n ctx.stroke();\n console.log(\"reticula : \" );\n }\n}", "function getPosition() { //------------------------ start \"getPosition()\"\n var myClcokWidth = myClock.width(),\n myClcokHeight = myClock.height();\n // positioning parts and set size\n myHourHand.css({\n 'width' : myClcokWidth * 0.065 + 'px',\n 'height' : myClcokWidth * 0.25 + 'px'\n });\n \n var myHourHandWidth = myHourHand.width(),\n myHousrHandHeight = myHourHand.height();\n \n myHourHand.css({\n 'left' : (myClcokWidth - myHourHandWidth)/2 + 'px',\n 'top' : (myClcokHeight/2) - myHousrHandHeight + 'px'\n });\n \n myMinuteHand.css({\n 'width' : myClcokWidth * 0.03 + 'px',\n 'height' : myClcokWidth * 0.35 + 'px'\n });\n \n var myMinuteHandWidth = myMinuteHand.width(),\n myMinuteHandHeight = myMinuteHand.height();\n \n myMinuteHand.css({ \n 'left' : (myClcokWidth - myMinuteHandWidth)/2 + 'px',\n 'top' : (myClcokHeight/2) - myMinuteHandHeight + 'px'\n });\n \n mySecondHand.css({\n 'width' : myClcokWidth * 0.01 + 'px',\n 'height' : myClcokWidth * 0.4 + 'px'\n });\n \n var mySecondHandWidth = mySecondHand.width(),\n mySecondHandHeight = mySecondHand.height();\n \n mySecondHand.css({\n 'left' : (myClcokWidth - mySecondHandWidth)/2 + 'px',\n 'top' : (myClcokHeight/2) - mySecondHandHeight + 'px'\n });\n\n} //-------------------------------------------------------- end \"getPosition()\"", "function renderCanvas() {\n if (drawing) {\n ctx.beginPath();\n ctx.moveTo(lastPos.x, lastPos.y);\n ctx.lineTo(mousePos.x, mousePos.y);\n ctx.closePath();\n ctx.stroke();\n\n lastPos = mousePos;\n }\n}", "function renderCanvas() {\n\t\tif (drawing) {\n\t\t\tctx.moveTo(lastPos.x, lastPos.y);\n\t\t\tctx.lineTo(mousePos.x, mousePos.y);\n\t\t\tctx.stroke();\n\t\t\tlastPos = mousePos;\n\t\t}\n\t}", "function renderCanvas() {\n\t\tif (drawing) {\n\t\t\tctx.moveTo(lastPos.x, lastPos.y);\n\t\t\tctx.lineTo(mousePos.x, mousePos.y);\n\t\t\tctx.stroke();\n\t\t\tlastPos = mousePos;\n\t\t}\n\t}", "function renderCanvas() {\n\t\tif (drawing) {\n\t\t\tctx.moveTo(lastPos.x, lastPos.y);\n\t\t\tctx.lineTo(mousePos.x, mousePos.y);\n\t\t\tctx.stroke();\n\t\t\tlastPos = mousePos;\n\t\t}\n\t}", "function renderCanvas() {\n\t\tif (drawing) {\n\t\t\tctx.moveTo(lastPos.x, lastPos.y);\n\t\t\tctx.lineTo(mousePos.x, mousePos.y);\n\t\t\tctx.stroke();\n\t\t\tlastPos = mousePos;\n\t\t}\n\t}", "function yOnCanvas(y){\r\n\treturn sciMonk.CanvasHeight - (sciMonk.CanvasHeight/sciMonk.Height)*y;\r\n}", "function dibujaPiedra(lapiz = pincel, pos = 0){\n\n\t\tlapiz.beginPath();\n\t\tlapiz.font = \"bold 22px sans-serif\";\n\t\tlapiz.fillText(\"PIEDRA\",330-pos,150);\n\t}", "draw(canvas) {\n this.canvas = canvas;\n this.keyRect = canvas.rect(this.width, this.height)\n .radius(2)\n .stroke({color: 'grey', width: 1})\n .fill(this.displayOptions.color)\n .move(this.x, this.y)\n .mouseover(() => {\n this.keyRect.fill(this.displayOptions.hoverColor);\n })\n .mouseout(ø => this.noteOff())\n .mousedown(ø => this.noteOn())\n .mouseup(ø => this.noteOff());\n\n if (!this.isNatural) this.keyRect.front();\n else this.keyRect.back();\n\n if (this.pitchName == 'C') {\n this.text = this.canvas.text(pitchName(this.pitch, true))\n .font(style.editorText)\n this.text\n .font({size: this.textSize})\n .x(this.textX)\n .y(this.textY)\n .addClass(\"mouse-disabled\")\n }\n }", "function getPosYCanvas() {\n return canvas.offsetTop;\n }", "rtnStartPos() {\n this.x = this.plyrSrtPosX;\n this.y = this.plyrSrtPosY;\n}", "function updateOffset() {\n canvasBounding = canvas.getBoundingClientRect();\n offsetX = canvasBounding.left;\n offsetY = canvasBounding.top;\n}", "startOver() {\n //x cordinates\n this.x = this.beginX;\n //y cordinates\n this.y = this.beginY;\n }", "getPosicionXYRel(): Posicion {\n const delta = gameConfig.deltaSep;\n const sizeCM = gameCacheSize.getSizeCM();\n\n const x = (this.getPosicionRC().c - 1) * (sizeCM + gameConfig.wDivision) + delta;\n const y = (this.getPosicionRC().r - 1) * (sizeCM + gameConfig.wDivision) + delta;\n\n return new Posicion(x, y);\n }", "function drawCompWin(){\n\n}", "currentPointerPosition(e) {\n const [x, y] = Mouse.rel(e);\n return this.positionToSequence({\n xPos: x,\n yPos: y,\n });\n }", "function getCursorPositionXY(e) {\n const rect = canvas.getBoundingClientRect();\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n cursorXPosition = x;\n cursorYPosition = y;\n}", "function sendCurrentXY(){\n\tvar value = addZeroes(currX)+\"\"+addZeroes(currY);\n\tsend(\"DrawMessage\", value);\n}", "pintar(){\r\n this.app.ellipseMode(this.app.CORNER);\r\n this.gif.position(this.x-17, this.y-17);\r\n }", "function game() {\n document.getElementById(\"pontos\").innerText = pontos;\n head_x += vel_x; //x e y são incrementados de acordo com vel_x e vel_y\n head_y += vel_y; //fazendo com que sua posição varie\n\n if(head_x < 0) { // Se a cobra passar das paredes do canvas, ela aparecerá na parede oposta\n head_x = quant_p - 1;\n }\n if(head_x > quant_p - 1) {\n head_x = 0;\n }\n if(head_y < 0) {\n head_y = quant_p - 1;\n }\n if(head_y > quant_p - 1) {\n head_y = 0;\n }\n \n ctx.clearRect(0, 0, cnv.width, cnv.height); //Limpa a tela.\n\n ctx.fillStyle = \"red\"; //troca a cor do renderizador para Vermelho para desenhar a comida.\n ctx.fillRect(comida_x*tam_p, comida_y*tam_p, tam_p, tam_p); //Desenha a comida\n\n ctx.fillStyle = \"black\"; //Troca a cor do renderizador para Preto para desenhar o corpo da cobra.\n for(var i = 0; i < rastro.length; i++) { \n ctx.fillRect(rastro[i].x*tam_p, rastro[i].y*tam_p, tam_p, tam_p); //Desenha a cobra\n if(rastro[i].x == head_x && rastro[i].y == head_y) { //analisa a colisão com a cauda\n vel_x = vel_y = 0; //Perdeu o jogo\n if(cauda > 2) {\n vel = 0;\n document.getElementById(\"restart\").setAttribute(\"style\", \"display: block;\");\n document.getElementById(\"restart\").setAttribute(\"href\", \"game.html\");\n } \n }\n }\n\n rastro.push({ //Acrescenda a posição da cabeça ao rastro, pois quando a cabeça se mover\n x:head_x, //Sua posição será ocupada pela próxima posição do rastro\n y:head_y\n })\n while(rastro.length > cauda) { //Retira a ultima posição do rastro, pois a mesma já não faz parte do corpo da cobra\n rastro.shift();\n }\n \n if(comida_x == head_x && comida_y == head_y) { //Aumenta o tamanho quando encontra a comida.\n cauda++;\n pontos++;\n comida_x = Math.floor(Math.random()*quant_p); //gera uma comida em um local aleatório.\n comida_y = Math.floor(Math.random()*quant_p);\n }\n }", "draw() {\n\t\tlet width = 30;\n\n\t\tinfo.context.beginPath();\n\t\tinfo.context.moveTo(this.position.x - width/2, this.position.y + width/2);\n\t\tinfo.context.lineTo(this.position.x + width/2, this.position.y + width/2);\n\t\tinfo.context.lineTo(this.position.x, this.position.y - width/2);\n\t\tinfo.context.closePath();\n\t\tinfo.context.fillStyle = this.color;\n\t\tinfo.context.fill();\n\t}", "function calculateRealPosition( objLevel )\n{\n objLevel.mMucuvinhaPosX = objLevel.mConfig.mCoordX * objLevel.IMG_WIDTH / objLevel.mImageFundo.getWidth();\n objLevel.mMucuvinhaPosX += objLevel.IMG_POS_X;\n \n objLevel.mMucuvinhaPosY = objLevel.mConfig.mCoordY * objLevel.IMG_HEIGHT / objLevel.mImageFundo.getHeight();\n objLevel.mMucuvinhaPosY += objLevel.IMG_POS_Y;\n \n //alert( objLevel.mMucuvinhaPosX );\n}", "trace() {\n const x = this.penx, y = this.peny;\n console.log(Math.round(x * 10) / 10 + this.ox, Math.round(y * 10) / 10 + this.oy);\n // assume path\n // has begun\n this.context.moveTo(x - 5, y);\n this.context.lineTo(x + 5, y);\n this.context.moveTo(x, y + 5);\n this.context.lineTo(x, y - 5);\n this.context.moveTo(x, y);\n return {x,y};\n }", "getMousePos() {\n let g = this,\n _main = window._main,\n cxt = g.context,\n cards = _main.cards,\n x = g.mouseX,\n y = g.mouseY;\n // Mouse movement to draw plants\n if (g.canDrawMousePlant) {\n g.mousePlantCallback(x, y);\n }\n }", "draw() {\n //Blütenstiel\n Aufgabe8_Bienen.crc2.beginPath();\n Aufgabe8_Bienen.crc2.moveTo(this.x, this.y);\n Aufgabe8_Bienen.crc2.arcTo(this.x, this.y - 20, this.x + 5, (this.y - 40) * this.scale, 120 * this.scale);\n Aufgabe8_Bienen.crc2.lineWidth = 3 * this.scale;\n Aufgabe8_Bienen.crc2.strokeStyle = \"#57e60f\";\n Aufgabe8_Bienen.crc2.stroke();\n Aufgabe8_Bienen.crc2.closePath();\n //Blüte aus Halbkreis und gezeichneten Spitzen\n Aufgabe8_Bienen.crc2.beginPath();\n Aufgabe8_Bienen.crc2.arc(this.x + 5 * this.scale, this.y - 44 * this.scale, 12 * this.scale, 0, Math.PI, false);\n Aufgabe8_Bienen.crc2.fillStyle = \"#9401be\";\n Aufgabe8_Bienen.crc2.fill();\n Aufgabe8_Bienen.crc2.closePath();\n Aufgabe8_Bienen.crc2.beginPath();\n Aufgabe8_Bienen.crc2.moveTo(this.x - 7 * this.scale, this.y - 43 * this.scale);\n Aufgabe8_Bienen.crc2.lineTo(this.x - 6 * this.scale, this.y - 60 * this.scale);\n Aufgabe8_Bienen.crc2.lineTo(this.x + 1 * this.scale, this.y - 50 * this.scale);\n Aufgabe8_Bienen.crc2.lineTo(this.x + 6 * this.scale, this.y - 60 * this.scale);\n Aufgabe8_Bienen.crc2.lineTo(this.x + 9 * this.scale, this.y - 50 * this.scale);\n Aufgabe8_Bienen.crc2.lineTo(this.x + 16 * this.scale, this.y - 60 * this.scale);\n Aufgabe8_Bienen.crc2.lineTo(this.x + 17 * this.scale, this.y - 43 * this.scale);\n Aufgabe8_Bienen.crc2.closePath();\n Aufgabe8_Bienen.crc2.fill();\n }", "draw() { }", "draw() { }", "draw() { }", "GetCursorPos()\n {\n let win = this.getCurrentWindowRead();\n return new Vec2(win.DC.CursorPos.x - win.Pos.x + win.Scroll.x,\n win.DC.CursorPos.y - win.Pos.y + win.Scroll.y);\n }", "function positionButtonsInCanvasResponsively() {\n $(\".leaveRoom\").css({\n // \"position\": \"relative\",\n position: \"absolute\",\n // \"display\": \"block\",\n bottom: \"0\",\n left:\n document.getElementsByClassName(\"whiteboard\")[0].offsetLeft -\n document.getElementsByClassName(\"whiteboard\")[0].offsetWidth / 2 +\n \"px\",\n \"z-index\": \"10\",\n });\n\n $(\".clearCanvas\").css({\n // \"position\": \"relative\",\n // \"display\": \"block\",\n right:\n document.getElementsByClassName(\"whiteboard\")[0].offsetLeft -\n document.getElementsByClassName(\"whiteboard\")[0].offsetWidth / 2 +\n \"px\",\n \"z-index\": \"10\",\n });\n\n $(\".colors\").css({\n left:\n document.getElementsByClassName(\"whiteboard\")[0].offsetLeft -\n document.getElementsByClassName(\"whiteboard\")[0].offsetWidth / 2 +\n \"px\",\n bottom: \"30px \",\n // \"display\": \"block\",\n transform: \"translate(-0%, 0%)\",\n });\n\n $(\".canvas-container\").css({\n // \"margin-top\": $(\".leaveRoom\").outerHeight() + \"px\"\n });\n}", "getCursorPos(){\n let posVector = {\n \"x\":this.activePointer.x,\n \"y\":this.activePointer.y\n }\n return posVector;\n }", "function dessiner_joueur1() {\n\tctx.save();\n\txplayer1 = (xplayer1 + vitesseplayer1);\n\tctx.translate(xplayer1*CoordJeux[0]/100,yplayer1*CoordJeux[1]/100);\n\tctx.beginPath();\n\tctx.arc(0,0,rayon*CoordJeux[1]/100,0,2*Math.PI,false);\n\tctx.fillStyle = 'blue';\n\tctx.fill();\n\tctx.restore();\n\n}", "function lynked_findPos(obj) {\n\tvar curtop = 0;\n\tlynked_windowHeight = Math.round(window.innerHeight);\n\tlynked_windowCenter = lynked_windowHeight / 2;\n\tif (obj.offsetParent) {\n\t\tdo {\n\t\t\tcurtop += obj.offsetTop;\n\t\t} while (obj = obj.offsetParent);\n\tcurtop = Math.round(curtop) - lynked_windowCenter;\n\tlynked_selectedCont.push(curtop);\n//\t//console.log(\"curleft,curtop----\"+curtop)\n\t}\n}", "draw(){\r\n //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n // Compute Position\r\n const thumb_h = 16;\r\n const thumb_w = 15;\r\n const track_h = 10;\r\n const on_color = \"#c8cad0\";\r\n\r\n\t\tlet p = this.pos;\r\n let h = this.height * 0.5;\r\n let h0 = h - thumb_h;\r\n let h1 = h + thumb_h;\r\n\r\n if( p < this.x_min + thumb_w ) p = this.x_min + thumb_w;\r\n if( p > this.x_max - thumb_w ) p = this.x_max - thumb_w;\r\n\r\n //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n // Drawing\r\n this.ctx.clearRect( 0, 0, this.width, this.height );\r\n \r\n // Draw Track\r\n this.draw_line( this.x_min, h, this.x_max, h, track_h, \"gray\", \"round\" );\r\n this.draw_line( this.x_min, h, p, h, track_h, on_color, \"round\" );\r\n\r\n // Draw Thumbs\r\n this.draw_line( p-thumb_w, h, p+thumb_w, h, thumb_h, on_color, \"round\", true );\r\n this.draw_text( this.value.toFixed(2), p, h, -1, \"black\" );\r\n }", "display(){\n rect(this.x, 100, 50, 25);\n }" ]
[ "0.6795464", "0.64519906", "0.63844967", "0.62826693", "0.62710536", "0.6181002", "0.6123499", "0.6112078", "0.61080563", "0.60826063", "0.60665166", "0.60447335", "0.6027969", "0.60250103", "0.6000614", "0.59977883", "0.5997622", "0.59800065", "0.5978483", "0.5959708", "0.5956675", "0.59516644", "0.594394", "0.59365076", "0.5916046", "0.5911679", "0.5896662", "0.5893925", "0.5892626", "0.5892535", "0.5884144", "0.58701736", "0.58625627", "0.5859922", "0.58597153", "0.5858608", "0.5853945", "0.58512497", "0.58504045", "0.5845792", "0.58429587", "0.58362895", "0.5828107", "0.5823691", "0.58223283", "0.58138096", "0.58127755", "0.5801482", "0.5799342", "0.57933736", "0.5783111", "0.57778376", "0.57754743", "0.57735264", "0.5772052", "0.5769619", "0.57659656", "0.57658345", "0.5765227", "0.57646286", "0.5764071", "0.5762768", "0.57615376", "0.5760355", "0.5757518", "0.5749259", "0.57475185", "0.5744267", "0.5744267", "0.5744267", "0.5744267", "0.57378006", "0.5727911", "0.57260966", "0.57241225", "0.57199717", "0.5713238", "0.5712127", "0.5699605", "0.56985956", "0.5686299", "0.5683932", "0.5680303", "0.5679775", "0.5674897", "0.567335", "0.5672476", "0.5671233", "0.5663769", "0.5660421", "0.5656825", "0.5656825", "0.5656825", "0.565128", "0.5650404", "0.56488615", "0.56476194", "0.56422675", "0.56410563", "0.56388694" ]
0.62642866
5
Effacement de la Signature
clearCanvas() { this.effacerButton.addEventListener('click', (e) => { e.preventDefault(); this.validerButton.style.display = 'none'; //0 = décalage gauche Canvas, 0 = décalage Top idem, width && height du rectangle a effacer this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function signTheFile() {\n var plaintext = document.querySelector('.output').value\n // initialize\n var sig = new KJUR.crypto.Signature({\"alg\": \"SHA1withRSA\"});\n // initialize for signature generation\n sig.init(object_2.private_key); // rsaPrivateKey of RSAKey object\n // update data\n sig.updateString(plaintext)\n // calculate signature\n signature = sig.sign()\n alert(\"signature signed.If you will make any changes in given signature it will become invalid\");\n } // end of signTheFile click handler", "function getSignature()\n{\n var timeStamp = Math.floor((new Date()).getTime()/1000);\n return (md5(api_key+shared_secret+timeStamp));\n}", "function getSignature() {\r\n var encode = \"\"\r\n for(var i = 0; i < arguments.length; i++) {\r\n encode += arguments[i]\r\n }\r\n encode += secret\r\n return Qt.md5(encode)\r\n}", "function getSignature() {\n var encode = \"\"\n for(var i = 0; i < arguments.length; i++) {\n encode += arguments[i]\n }\n encode += secret\n return Qt.md5(encode)\n}", "get signature() {\n return this._signature;\n }", "get signature() {\n return this._signature;\n }", "function applySignature2(spouseSigValue,code){\n //isInside();\n var spouseSigObject = JSON.parse(spouseSigValue);\n var tempCanvas = document.getElementById('outputPane');\n var tempOutputPad = new SignaturePad(tempCanvas);\n tempOutputPad.off();\n\n var canvasImage = document.getElementById(\"spouseOutputImage\");\n \n //var temp = returnData();\n //console.log(temp);\n \n var image = new Image();\n tempOutputPad.fromData(spouseSigObject);\n image.onload = function(){\n \n canvasImage.width = image.width;\n canvasImage.height = image.height;\n\n console.log(\"canvasimage width and height\" + canvasImage.width + \" \" + canvasImage.height);\n console.log(\"image width and height \" + image.width + \" \" + image.height);\n \n var ctx = canvasImage.getContext('2d');\n \n ctx.drawImage(image,0,0, image.width, image.height, 0,0, canvasImage.width, canvasImage.height);\n console.log(\"drawing complete\");\n }\n image.src = tempOutputPad.toDataURL();\n console.log(\"sending to imageDrawFunction\");\n\n console.log(\"Printing the current date to spouse form\")\n dateHandler(true);\n}", "get signature() {\n return this.payload['signature'];\n }", "async getSignatureSigner() {\n var h = this.state.cert_hash;\n var s = this.state.cert_signature;\n console.log(\"hs \" + h);\n console.log(\"sign :\" + s);\n //this part will work when you provide this with valid signature and its returns signer address\n try {\n var singner_account_add = EthSigUtil.recoverPersonalSignature({\n data: String(h),\n sig: s\n });\n } catch (e) {\n console.log(e);\n }\n\n //\"0x5ec74ed675a04c5752bb92ccf80d43eeabfe984a\";//account address will be something like this\n console.log(\"signer :\" + singner_account_add);\n this.setState({\n signature_signer_add: singner_account_add\n });\n console.log(\"signer :\" + this.state.signature_signer_add);\n this.increment();\n await this.getSignerNamer();\n }", "getSignatureDigest() {\n const buffer = new Serialize.SerialBuffer({\n textEncoder: this.textEncoder,\n textDecoder: this.textDecoder,\n });\n // protocol version + utf8 \"request\"\n buffer.pushArray([this.version, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74]);\n buffer.pushArray(this.getData());\n return sha256(buffer.asUint8Array());\n }", "sign (m) {\n const sig = new exports.Signature()\n const stack = mod.Runtime.stackSave()\n const secPos = mod.Runtime.stackAlloc(this.a_.length * 4)\n const sigPos = mod.Runtime.stackAlloc(sig.a_.length * 4)\n mod.HEAP32.set(this.a_, secPos / 4)\n mod.blsSign(sigPos, secPos, m)\n copyToUint32Array(sig.a_, sigPos)\n mod.Runtime.stackRestore(stack)\n return sig\n }", "returnOriginalSignatureSource() {\n return this.type.toString() + \"000\" + this.amt.toString();\n }", "function onSignatureStarted(err, restRes, body) {\n\n if (restPki.checkResponse(err, restRes, body, next)) {\n\n // Read PEM-encoded private-key file for (\"Pierre de Fermat\")\n var pkey = fs.readFileSync('./resources/fermat-pkey.pem', 'binary');\n\n // Get signature algorithm from the digestAlgorithmOid. It will be used by the crypto library\n // to perform the signature.\n var signatureAlgorithm;\n switch(restRes.body.digestAlgorithmOid) {\n case '1.2.840.113549.2.5':\n signatureAlgorithm = 'RSA-MD5';\n break;\n case '1.3.14.3.2.26':\n signatureAlgorithm = 'RSA-SHA1';\n break;\n case '2.16.840.1.101.3.4.2.1':\n signatureAlgorithm = 'RSA-SHA256';\n break;\n case '2.16.840.1.101.3.4.2.2':\n signatureAlgorithm = 'RSA-SHA384';\n break;\n case '2.16.840.1.101.3.4.2.3':\n signatureAlgorithm = 'RSA-SHA512';\n break;\n default:\n signatureAlgorithm = null;\n }\n\n // Create a new signature, setting the algorithm that will be used\n var sign = crypto.createSign(signatureAlgorithm);\n\n // Set the data that will be signed\n sign.write(new Buffer(restRes.body.toSignData, 'base64')); \n sign.end();\n\n // Perform the signature and receiving Base64-enconding of the signature\n var signature = sign.sign({ key: pkey, passphrase: '1234' }, 'base64');\n\n // Call the action POST Api/CadesSignatures/{token}/SignedBytes on REST PKI, which finalizes the signature process and \n // returns the signed PDF\n request.post(client.endpoint + 'Api/CadesSignatures/' + restRes.body.token + '/SignedBytes', {\n \n json: true,\n headers: { 'Authorization': 'Bearer ' + client.accessToken},\n body: { 'signature': signature }\n \n }, onSignatureCompleted);\n }\n }", "function sign(params) {\n params.key = key;\n params.timestamp = Math.round(new Date().getTime());\n params.signature = crypto.createHmac('sha256', secret).update(params.key + params.timestamp).digest('hex');\n return params;\n}", "function test(){\n\tassert.ok(ostatus.salmon.verify_signature(me, key));\n}", "get signature() {\n\t\treturn this.__signature;\n\t}", "function saveEvent() {\r\n if (isClear === true) {\r\n alert(\"Signature is not signed\");\r\n } else {\r\n var canvas = $('canvas')[0];\r\n var data = canvas.toDataURL('image/png').replace(/data:image\\/png;base64,/, '');\r\n\r\n var iname = 'signature_' + randomString(5) + '.png'; \r\n\r\n $.ajax({\r\n type: \"POST\",\r\n url: \"php-src/upload.php\",\r\n data: { \r\n iname: iname,\r\n data: data\r\n }\r\n }).done(function(e) {\r\n });\r\n }\r\n}", "function showSignature() {\r\n print(\"Showing signature\");\r\n window.sigCtl.GetSignature(onGetSignature);\r\n function onGetSignature(sigCtlV, sigObjV, status) {\r\n if (window.sdkPtr.ResponseStatus.OK == status) {\r\n var outputFlags = window.sdkPtr.RBFlags.RenderOutputPicture | window.sdkPtr.RBFlags.RenderColor24BPP;\r\n var sigObj = sigObjV;\r\n sigObj.RenderBitmap(SigCaptX_Globals_1.BITMAP_IMAGEFORMAT, sigcaptx_1.HTMLTags.imageBox.clientWidth, sigcaptx_1.HTMLTags.imageBox.clientHeight, SigCaptX_Globals_1.BITMAP_INKWIDTH, SigCaptX_Globals_1.BITMAP_INKCOLOR, SigCaptX_Globals_1.BITMAP_BACKGROUNDCOLOR, outputFlags, SigCaptX_Globals_1.BITMAP_PADDING_X, SigCaptX_Globals_1.BITMAP_PADDING_Y, onRenderBitmap);\r\n }\r\n else {\r\n print(\"Error retrieving signature\");\r\n }\r\n }\r\n function onRenderBitmap(sigObjV, bmpObj, status) {\r\n if (callbackStatusOK(\"Signature Render Bitmap\", status)) {\r\n if (null == sigcaptx_1.HTMLTags.imageBox.firstChild) {\r\n sigcaptx_1.HTMLTags.imageBox.appendChild(bmpObj.image);\r\n }\r\n else {\r\n sigcaptx_1.HTMLTags.imageBox.replaceChild(bmpObj.image, sigcaptx_1.HTMLTags.imageBox.firstChild);\r\n }\r\n if (sigcaptx_1.HTMLTags.chkSigText.checked) {\r\n sigObjV.GetSigText(onGetSigText);\r\n }\r\n else {\r\n SigCaptX_WizSessionCtrl_1.WizardEventController.stop();\r\n }\r\n }\r\n }\r\n // Displays the SigText string in the text box on the HTML document\r\n function onGetSigText(sigObjV, text, status) {\r\n if (callbackStatusOK(\"Signature Render Bitmap\", status)) {\r\n print(\"Sig text successfully obtained: \" + text);\r\n // At this point you can send the contents of \"text\" to the server \r\n // and then validate it at the server end\r\n print(\"Stopping script\");\r\n SigCaptX_WizSessionCtrl_1.WizardEventController.stop();\r\n }\r\n }\r\n }", "sign(signatureProvider) {\n const message = this.getSignatureDigest();\n this.signature = signatureProvider.sign(Serialize.arrayToHex(message));\n }", "signatureExport (obj, sig) {\n const sigR = sig.subarray(0, 32)\n const sigS = sig.subarray(32, 64)\n if (new BN(sigR).cmp(ecparams.n) >= 0) return 1\n if (new BN(sigS).cmp(ecparams.n) >= 0) return 1\n\n const { output } = obj\n\n // Prepare R\n let r = output.subarray(4, 4 + 33)\n r[0] = 0x00\n r.set(sigR, 1)\n\n let lenR = 33\n let posR = 0\n for (; lenR > 1 && r[posR] === 0x00 && !(r[posR + 1] & 0x80); --lenR, ++posR);\n\n r = r.subarray(posR)\n if (r[0] & 0x80) return 1\n if (lenR > 1 && (r[0] === 0x00) && !(r[1] & 0x80)) return 1\n\n // Prepare S\n let s = output.subarray(6 + 33, 6 + 33 + 33)\n s[0] = 0x00\n s.set(sigS, 1)\n\n let lenS = 33\n let posS = 0\n for (; lenS > 1 && s[posS] === 0x00 && !(s[posS + 1] & 0x80); --lenS, ++posS);\n\n s = s.subarray(posS)\n if (s[0] & 0x80) return 1\n if (lenS > 1 && (s[0] === 0x00) && !(s[1] & 0x80)) return 1\n\n // Set output length for return\n obj.outputlen = 6 + lenR + lenS\n\n // Output in specified format\n // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]\n output[0] = 0x30\n output[1] = obj.outputlen - 2\n output[2] = 0x02\n output[3] = r.length\n output.set(r, 4)\n output[4 + lenR] = 0x02\n output[5 + lenR] = s.length\n output.set(s, 6 + lenR)\n\n return 0\n }", "function Signature(name = i18n(\"optionsSignatureNewName\"), text = \"\", html = \"\", autoSwitch = \"\") {\n this.id = uuidv4();\n this.name = name;\n this.text = text;\n this.html = html;\n this.autoSwitch = autoSwitch;\n}", "function getComputedSignature(token, payload) {\n var hash = crypto\n .createHmac(\"sha1\", token)\n .update(JSON.stringify(payload), \"utf8\")\n .digest(\"hex\");\n return hash;\n}", "function getSignature(action, signatureTime) {\n if (action === \"getTime\") {\n return Math.round(new Date().getTime() / 1000);\n } else {\n var hash = CryptoJS.HmacSHA256(signatureTime.toString(), appSecretKey);\n return CryptoJS.enc.Base64.stringify(hash);\n }\n}", "signatureExport(obj, sig) {\n const sigR = sig.subarray(0, 32);\n const sigS = sig.subarray(32, 64);\n if (new BN(sigR).cmp(ecparams.n) >= 0) return 1;\n if (new BN(sigS).cmp(ecparams.n) >= 0) return 1;\n const {\n output\n } = obj; // Prepare R\n\n let r = output.subarray(4, 4 + 33);\n r[0] = 0x00;\n r.set(sigR, 1);\n let lenR = 33;\n let posR = 0;\n\n for (; lenR > 1 && r[posR] === 0x00 && !(r[posR + 1] & 0x80); --lenR, ++posR);\n\n r = r.subarray(posR);\n if (r[0] & 0x80) return 1;\n if (lenR > 1 && r[0] === 0x00 && !(r[1] & 0x80)) return 1; // Prepare S\n\n let s = output.subarray(6 + 33, 6 + 33 + 33);\n s[0] = 0x00;\n s.set(sigS, 1);\n let lenS = 33;\n let posS = 0;\n\n for (; lenS > 1 && s[posS] === 0x00 && !(s[posS + 1] & 0x80); --lenS, ++posS);\n\n s = s.subarray(posS);\n if (s[0] & 0x80) return 1;\n if (lenS > 1 && s[0] === 0x00 && !(s[1] & 0x80)) return 1; // Set output length for return\n\n obj.outputlen = 6 + lenR + lenS; // Output in specified format\n // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]\n\n output[0] = 0x30;\n output[1] = obj.outputlen - 2;\n output[2] = 0x02;\n output[3] = r.length;\n output.set(r, 4);\n output[4 + lenR] = 0x02;\n output[5 + lenR] = s.length;\n output.set(s, 6 + lenR);\n return 0;\n }", "function signatureUploadSign() {\r\n if (this.files && this.files[0]) {\r\n if (this.files[0].type === 'image/jpeg' || this.files[0].type === 'image/png') {\r\n let reader = new FileReader(),\r\n container = this.parentElement,\r\n overlay = container.querySelector('.overlay'),\r\n img;\r\n container.classList.add('loading');\r\n if (!container.querySelector('img')) {\r\n img = document.createElement('img');\r\n img.className = 'img-fluid';\r\n } else {\r\n container.classList.remove('active');\r\n img = container.querySelector('img');\r\n }\r\n reader.onload = function(e) {\r\n globalObj.status.signature = false;\r\n // Approve button status\r\n approveBtnStatus();\r\n img.src = e.target.result;\r\n container.appendChild(img);\r\n container.classList.add('active');\r\n setTimeout(function() {\r\n overlay.classList.add('active');\r\n setTimeout(function() {\r\n container.classList.add('loading2');\r\n globalObj.status.signature = true;\r\n setTimeout(function() {\r\n container.classList.remove('loading');\r\n container.classList.remove('loading2');\r\n overlay.classList.remove('active');\r\n // Approve button status\r\n approveBtnStatus();\r\n }, 260);\r\n }, 500);\r\n }, 1000);\r\n }\r\n reader.readAsDataURL(this.files[0]);\r\n }\r\n }\r\n}", "signature (sigOrTitle) {\n const signatures = this.signatures;\n // if given a title for an existing signature, returns it\n if (signatures.hasOwnProperty(sigOrTitle)) return signatures[sigOrTitle];\n // constructs a new signature or uses an existing one (if an existing one was passed in)\n const signature = (sigOrTitle instanceof Signature ? sigOrTitle : new Signature(sigOrTitle, this));\n return signatures[signature.title] = signature;\n }", "async function getSigData(sigVer, privKey, noteValue, adnMessage) {\n let sigString = ''\n sigString += adnMessage.text.trim()\n sigString += noteValue.timestamp\n if (noteValue.quote) {\n sigString += noteValue.quote.id\n sigString += noteValue.quote.author\n sigString += noteValue.quote.text.trim()\n if (adnMessage.reply_to) {\n sigString += adnMessage.reply_to\n }\n }\n /*\n sigString += [...attachmentAnnotations, ...previewAnnotations]\n .map(data => data.id || data.image.id)\n .sort()\n .join();\n */\n sigString += sigVer\n const sigData = Buffer.from(bb.wrap(sigString, 'utf8').toArrayBuffer())\n // symKey\n const sig = await libsignal.curve.calculateSignature(privKey, sigData)\n // const sig = makeSymmetricKey(privKey, sigData)\n return sig.toString('hex')\n}", "function signRequest(data, sign_key) {\n console.time('signing_time');\n var signature = curve.sign.detached(json2buf(data, encoding='ascii'), sign_key);\n signature = Buffer.from(signature).toString('base64');\n console.timeEnd('signing_time');\n\n return signature;\n}", "async function addSignature(key, data) {\n return CryptoJS.HmacSHA256(data, key).toString(CryptoJS.enc.Hex);\n}", "function saveSigning() {\t\n saveToServer();\n}", "static compute(message, privkey) {\n const sig = ecc.sign(message, privkey.scalar);\n return new Signature(sig.r, sig.s);\n }", "async sign(message) {\n let resp = await this.config.rpc.sendJsonRequest(\"sign\", {data: message});\n return resp.result.signature;\n }", "sign(digest) {\n assertArgument(dataLength(digest) === 32, \"invalid digest length\", \"digest\", digest);\n const [sigDer, recid] = secp256k1.signSync(getBytesCopy(digest), getBytesCopy(this.#privateKey), {\n recovered: true,\n canonical: true\n });\n const sig = secp256k1.Signature.fromHex(sigDer);\n return Signature.from({\n r: toBeHex(\"0x\" + sig.r.toString(16), 32),\n s: toBeHex(\"0x\" + sig.s.toString(16), 32),\n v: (recid ? 0x1c : 0x1b)\n });\n }", "getSignatureData() {\n if (!this.signature) {\n return new Uint8Array(0);\n }\n const buffer = new Serialize.SerialBuffer({\n textEncoder: this.textEncoder,\n textDecoder: this.textDecoder,\n });\n const type = AbiTypes.get('request_signature');\n type.serialize(buffer, this.signature);\n return buffer.asUint8Array();\n }", "function setupSignaturePad() {\n var signaturePad = new SignaturePad(_signature_pad[0], {\n penColor: '#0000ff',\n onEnd: function() {\n _sig = signaturePad.toDataURL();\n _form_signature.val(_sig);\n }\n });\n signaturePad.fromDataURL(_form_signature.val());\n }", "function addSignature()\r\n{\r\n var storedObject = GM_getValue(\"SGNSignatureObject\");\r\n var scriptElement = document.createElement('script');\r\n scriptElement.type = 'text/javascript';\r\n scriptElement.innerHTML = 'function addSignature() { if(vB_Editor.vB_Editor_001 != undefined){ var element = vB_Editor.vB_Editor_001.editor.getData(); vB_Editor.vB_Editor_001.editor.setData(element+\"\\\\n\\\\n\"+\"'+storedObject+'\"); }else{ var element = vB_Editor.vB_Editor_QR.editor.getData(); vB_Editor.vB_Editor_QR.editor.setData(element+\"\\\\n\\\\n\"+\"'+storedObject+'\"); } }';\r\n unsafeWindow.document.getElementsByTagName(\"head\")[0].appendChild(scriptElement);\r\n}", "function makeSignature(obj, binanceSecret) {\n //console.log(\"makeSignature\", obj, binanceSecret);\n let s = \"\",\n res;\n Object.keys(obj).forEach((e) => {\n s = s + e + \"=\" + obj[e] + \"&\";\n });\n //console.log(s.slice(0, s.length - 1));\n const hmac = crypto.createHmac(\"sha256\", binanceSecret);\n hmac.update(s.slice(0, s.length - 1));\n res = hmac.digest(\"hex\");\n return { qs: s, signature: res };\n}", "_generateSignature(opc) {\n if (this._apiToken) {\n opc.headers.Authorization = `${this._apiToken}`;\n }\n if (this._mustSign) {\n let timestamp = new Date().getTime();\n opc.headers['x-logtrust-apikey'] = this._apiKey;\n opc.headers['x-logtrust-timestamp'] = timestamp;\n const body = opc.body ? JSON.stringify(opc.body) : ''\n const signMsg = this._apiKey + body + timestamp;\n opc.headers['x-logtrust-sign'] =\n HmacSHA256(signMsg, this._apiSecret).toString();\n }\n }", "function getSignature(payload, secret) {\n const hmac = crypto.createHmac('sha1', secret)\n hmac.update(payload, 'utf-8')\n return `sha1=${hmac.digest('hex')}`\n}", "function makeSignature(s) {\n if (typeof s !== \"string\")\n throw Error(`vbios.makeSignature(): Signature must be a string, not '${typeof s}'`);\n\n if (s.length < 2 || s.length > 4)\n throw Error(`vbios.makeSignature(): Signature size must be between 2-4 characters, not '${s.length}'`);\n\n const a = s.charCodeAt(0);\n const b = s.charCodeAt(1);\n const c = s.charCodeAt(2) || 0;\n const d = s.charCodeAt(3) || 0;\n return (d << 24) | (c << 16) | (b << 8) | a;\n}", "function getHashEventSignature(evt){\n return web3.sha3(evt)\n}", "function onSignatureCompleted(err, restRes, body) {\n \n if (restPki.checkResponse(err, restRes, body, next)) {\n\n // At this point, you'd typically store the signed PDF on your database. For demonstration purposes, we'll\n // store the PDF on a temporary folder publicly accessible and render a link to it.\n var signedContent = new Buffer(restRes.body.cms, 'base64');\n var filename = uuid.v4() + '.p7s';\n var appDataPath = appRoot + '/public/app-data/';\n if (!fs.existsSync(appDataPath)) {\n fs.mkdirSync(appDataPath);\n }\n fs.writeFileSync(appDataPath + filename, signedContent);\n\n res.render('cades-signature-complete', {\n signedFileName: filename,\n signerCert: restRes.body.certificate\n });\n\n }\n }", "function SignatureParams() {\n this.prefix = \"\";\n }", "sign(msg) {\n return sodium.crypto_auth_hmacsha256(msg, this.key);\n }", "function editSignatures(formdata, callback) {\n var pubKey = formdata.pubKey;\n var oldPubKey = formdata.oldPubKey;\n var hashedPubKey = keccak_256(pubKey);\n var oldHashedPubKey = keccak_256(oldPubKey);\n var signature = formdata.signature;\n var k = 0;\n var l = 0;\n var time = new Date();\n var msg = formdata.msg;\n var blockchainID = keccak_256(chain);\n //these 2 vars seem to not work atm\n var blockNumber = 0;\n var blockHash = 0;\n //var recoverySig = \"recoverysig\";\n var sync = true;//was causing invalid jump from bigchain without it\n\n //get the signature of the recovery app a.k.a the eris account\n createSignature('0r1e2c3o4v5e6r7y8', function (recoverySig, recoveryPubKey, recoveryHash) {\n theNotifier.getSignatures(oldPubKey, function (sigFile) {\n if (sigFile != undefined) {\n console.log(\"Signature file:\\n\" + JSON.stringify(sigFile));\n //loop through all assets that contain the old signature\n //ADD asset name and owner pubkey to signature files\n console.log(\"sigF length: \" + sigFile.length);\n for (var j = 0; j < sigFile.length; j++) {\n sync = true;\n //get file from original owners digital twin(not the person being recovered)\n theNotifier.GetAsset(sigFile[j].owner, sigFile[j].assetId + '.json', 0, function (asset) {\n console.log(\"signed asset:\\n\" + JSON.stringify(asset)); l++;\n //asset.validatorSigs[1].splice(4,1);asset.validatorSigs.splice(0,1);//testing only\n for (var y = 0; y < asset.validatorSigs.length; y++) {\n\n if (asset.validatorSigs[y][2] == oldPubKey && asset.validatorSigs[y][4] != 'recovered') {\n //copy signature object from array, label new object as recovered/invalid,edit old signature with new signature\n var newSigObj = JSON.parse(JSON.stringify(asset.validatorSigs[y]));\n console.log(\"newsig \\n\" + JSON.stringify(newSigObj));\n newSigObj[4] = 'recovered';\n\n asset.validatorSigs.push(newSigObj);\n asset.validatorSigs[y][2] = pubKey;\n asset.validatorSigs[y][1] = signature;\n asset.validatorSigs[y][0] = msg;\n var expiration = asset.validatorSigs[y][3];\n console.log(\"\\n\\nL: \" + l);\n console.log(\"Vsigs: \" + JSON.stringify(asset.validatorSigs));\n //write changes to bigchain, digital twin asset folder, and digital twin attestations folder\n //bigchainPost(sigFile[l - 1].proposal_id, asset, blockNumber, blockHash, blockchainID, time.getTime(), asset.validatorSigs, recoverySig, function (result, theId, theHash) {\n theNotifier.bcPreRequest(asset.pubKey, sigFile[l - 1].proposalId, asset, blockNumber, blockHashVal, blockchainID, time.getTime(), asset.validatorSigs, recoverySig, asset.bigchainID, asset.bigchainHash, function (result, theId, theHash) {\n asset.bigchainID = theId;\n asset.bigchainHash = theHash;\n theNotifier.attestIcaFile(pubKey, sigFile[k].proposal_id, \"recovery\", time.getTime(), asset.gatekeeperAddr, expiration, theId, asset.assetID);\n writeAllAssets(asset, function () {\n sync = false;\n console.log(\"Write All Signatures\")\n k++;\n if (k >= sigFile.length) { callback(recoverySig, recoveryPubKey, recoveryHash); }\n })\n }, asset.bigchainID, asset.bigchainHash)\n }//if\n //else{if( y >= asset.validatorSigs.length-1){callback(recoverySig, recoveryPubKey, recoveryHash);}}//only testing\n }//for\n })//notifier\n while (sync) { require('deasync').sleep(10000); }// may not be needed if all signed assets have to be different asset files\n }//for\n } else { callback(recoverySig, recoveryPubKey, recoveryHash); }\n })//getsig\n })//end create signature\n }//end edit sigs", "set signature(signature) {\n if (signature)\n this._signature = signature;\n }", "sign(dataHash) {\n return this.keyPair.sign(dataHash);\n }", "function getSignatureKey(key, dateStamp, regionName, serviceName) {\n\tvar kDate = crypto.createHmac('sha256', 'AWS4'+key).update(dateStamp).digest('binary');\n\tvar kRegion = crypto.createHmac('sha256', kDate).update(regionName).digest('binary');\n\tvar kService = crypto.createHmac('sha256', kRegion).update(serviceName).digest('binary');\n\tvar kSigning = crypto.createHmac('sha256', kService).update('aws4_request').digest('hex');\n\treturn kSigning;\n}", "setSignature(signer, signature) {\n this.signature = { signer, signature };\n }", "signatureImport(output, sig) {\n if (sig.length < 8) return 1;\n if (sig.length > 72) return 1;\n if (sig[0] !== 0x30) return 1;\n if (sig[1] !== sig.length - 2) return 1;\n if (sig[2] !== 0x02) return 1;\n const lenR = sig[3];\n if (lenR === 0) return 1;\n if (5 + lenR >= sig.length) return 1;\n if (sig[4 + lenR] !== 0x02) return 1;\n const lenS = sig[5 + lenR];\n if (lenS === 0) return 1;\n if (6 + lenR + lenS !== sig.length) return 1;\n if (sig[4] & 0x80) return 1;\n if (lenR > 1 && sig[4] === 0x00 && !(sig[5] & 0x80)) return 1;\n if (sig[lenR + 6] & 0x80) return 1;\n if (lenS > 1 && sig[lenR + 6] === 0x00 && !(sig[lenR + 7] & 0x80)) return 1;\n let sigR = sig.subarray(4, 4 + lenR);\n if (sigR.length === 33 && sigR[0] === 0x00) sigR = sigR.subarray(1);\n if (sigR.length > 32) return 1;\n let sigS = sig.subarray(6 + lenR);\n if (sigS.length === 33 && sigS[0] === 0x00) sigS = sigS.slice(1);\n if (sigS.length > 32) throw new Error('S length is too long');\n let r = new BN(sigR);\n if (r.cmp(ecparams.n) >= 0) r = new BN(0);\n let s = new BN(sig.subarray(6 + lenR));\n if (s.cmp(ecparams.n) >= 0) s = new BN(0);\n output.set(r.toArrayLike(Uint8Array, 'be', 32), 0);\n output.set(s.toArrayLike(Uint8Array, 'be', 32), 32);\n return 0;\n }", "function signature(text)\n { \n var sig = 0, len = text.length\n if(len > magic)\n len = magic\n for(var tdx = 0; tdx < len; ++tdx) \n {\n sig <<= 8\n sig += char(text, tdx)\n }\n return sig\n }", "function createSignature(nonHashedMessage, callback) {\n //make message hash\n var hash = crypto.createHash('sha256').update(nonHashedMessage).digest('hex')\n var pubKey = chainConfig.primaryAccount.pubKey;\n var privKey = chainConfig.primaryAccount.privKey;\n\n var keyPair = { \"publicKey\": new Buffer(pubKey, \"hex\"), \"privateKey\": new Buffer(privKey, \"hex\") }\n\n var signature = ed25519.Sign(new Buffer(hash), keyPair)\n\n signature = signature.toString('hex')\n\n var result = { \"signature\": signature, \"pubKey\": pubKey, \"msg\": hash }\n\n callback(signature, pubKey, hash)\n }", "verifySignature(reqq){\n\tif(reqq.address && reqq.signature){\n\t\tlet memdata=this.mempool.get(reqq.address); \n\t\tconsole.log(memdata.message);\n\t let response= bitcoinmsg.verify(memdata.message, reqq.address, reqq.signature);\n\t return response;\n\t}return false;\n}", "sign(data) {\n\t\treturn this.keyPair.sign(cryptoHash(data));\n\t}", "function verifySignature(msg, signature, pub_key) {\n //return curve.sign.detached.verify(str2buf(msg, 'ascii'), str2buf(signature, 'base64'), pub_key);\n return curve.sign.detached.verify(msg, str2buf(signature, 'base64'), pub_key);\n}", "function serializeSignature(writeStream, object) {\r\n if (object.type === IEd25519Signature_1.ED25519_SIGNATURE_TYPE) {\r\n serializeEd25519Signature(writeStream, object);\r\n }\r\n else {\r\n throw new Error(`Unrecognized signature type ${object.type}`);\r\n }\r\n}", "handleSign() {\n this.setState({\n isSigning: true\n });\n\n const {file} = this.props;\n // We assume we have a valid genesis ID and the associated block\n // else an error will be displayed before letting the user sign\n const {genesisID, block} = this.state;\n\n const servers = StatusService.getAvailableRoster().map(r => r.server);\n\n const signFile = new SignatureFile();\n signFile.setFileName(file.name);\n signFile.setGenesisID(genesisID);\n signFile.setBlockID(block.Hash);\n signFile.setOfflineServers(StatusService.getOfflineRoster().map(r => r.server.address));\n\n this._signPromise = new Promise((resolve, reject) => {\n // Check if more than 2/3 of the servers are available\n if (servers.length / block.Roster.list.length <= 2 / 3) {\n reject(\"Not enough available servers\");\n return;\n }\n\n hashFile(file)\n .then(\n (hash) => {\n signFile.setHash(hash);\n const address = tcp2ws(servers[0].address);\n\n if (address.length > 0) {\n CothorityWebsocket.getSignature(hash, address, servers)\n .then(\n (response) => {\n const signature = (response.signature || []).slice(0, 64);\n signFile.setSignature(signature);\n\n signFile.save();\n this._triggerOnBack();\n\n resolve();\n }\n )\n .catch(() => {\n reject('Oops, something went wrong...');\n })\n }\n }\n );\n });\n\n // We want to display the error message if it occurs\n this._signPromise.catch(e => this.setState({error: e}));\n }", "sign(message,key = this.seckey){\n return ticCommon.sign(message,key)\n }", "static sign(secret, req) {\n const now = req.timestamp ? req.timestamp : Date.now();\n const payload = [req.method, req.url, now];\n // Check if should sign body as well\n if ((req.body && req.method.toUpperCase() === \"POST\") || req.method.toUpperCase() === \"PUT\") {\n payload.push(req.body);\n }\n // Generate signature using HMAC SHA 256\n const signature = CryptoJS.HmacSHA256(payload.join(\",\"), secret);\n return {\n \"X-Request-Signature\": signature.toString(),\n \"X-Request-Timestamp\": now.toString()\n };\n }", "function sign() {\n\n // Block the UI while we perform the signature.\n $.blockUI();\n\n // Get the thumbprint of the selected certificate.\n var selectedCertThumbprint = selectElement.val();\n\n // Call signWithRestPki() on the Web PKI component passing the token received from REST PKI\n // and the certificate selected by the user.\n pki.signWithRestPki({\n token: token,\n thumbprint: selectedCertThumbprint\n }).success(function() {\n // Once the operation is completed, we submit the form.\n formElement.submit();\n });\n }", "function qll_utility_article_signature()\r\n{\r\n\tcontent=document.getElementById('article_comment');\r\n\tcontent.value=content.value+ '\\n' + GM_getValue(\"QLLMenuArticleSignature:content\",\"\");\r\n}", "function sign() {\n\n // Block the UI while we perform the signature\n $.blockUI({ message: 'Signing ...' });\n\n // Get the value attribute of the option selected on the dropdown. Since we placed the \"thumbprint\"\n // property on the value attribute of each item (see function loadCertificates above), we're actually\n // retrieving the thumbprint of the selected certificate.\n var selectedCertThumbprint = formElements.certificateSelect.val();\n\n // Call the readCertificate() function on the Web PKI component passing the selected certificate's\n // thumbprint. This retrieves the certificate's encoding.\n pki.readCertificate(selectedCertThumbprint).success(function (certEncoded) {\n\n // Place the certificate encoding in a hidden input field on the page's form\n formElements.certContentField.val(certEncoded);\n\n // Call the signHash() function on the Web PKI component passing:\n\t\t // - The thumbprint of the certificate\n\t\t // - The \"to-sign-hash\" and digest algorithm given by the server\n pki.signHash({\n thumbprint: selectedCertThumbprint,\n hash: formElements.toSignHashField.val(),\n digestAlgorithm: formElements.digestAlgorithmField.val()\n }).success(function (signature) {\n // Place the signature in a hidden input field on the page's form\n formElements.signatureField.val(signature);\n // Submit the form\n formElements.form.submit();\n });\n });\n }", "async lavaPacketSignatureBurned(packetData,env){\n\n\n var params = lavaUtils.getLavaParamsFromData(packetData.from,packetData.to,packetData.walletAddress,packetData.tokenAddress,packetData.tokenAmount,packetData.relayerReward,packetData.expires,packetData.nonce)\n\n var msgParams = {data: params}\n\n var msgHash = ethSigUtil.typedSignatureHash(msgParams.data)\n\n\n console.log('sig was burned?' , msgHash )\n\n var burnedStatus = 0;\n\n try{\n burnedStatus = await ContractInterface.getWalletContract(this.web3,env).methods.signatureBurnStatus(msgHash).call()\n //var burnedStatus= 0;\n console.log('sig was burned: ',burnedStatus )\n }catch(e)\n {\n console.error(e)\n }\n\n return (burnedStatus != 0);\n\n\n }", "function sign (keys, msg) {\n if(isString(msg))\n msg = new Buffer(msg)\n if(!isBuffer(msg))\n throw new Error('msg should be buffer')\n var curve = getCurve(keys)\n\n return curves[curve]\n .sign(u.toBuffer(keys.private || keys), msg)\n .toString('base64')+'.sig.'+curve\n\n}", "function onAcceptClick() {\n var sigImg = paintView.toImage();\n $.trigger('promptSignature:accept_signature', {\n image : sigImg\n });\n}", "signatureImport (output, sig) {\n if (sig.length < 8) return 1\n if (sig.length > 72) return 1\n if (sig[0] !== 0x30) return 1\n if (sig[1] !== sig.length - 2) return 1\n if (sig[2] !== 0x02) return 1\n\n const lenR = sig[3]\n if (lenR === 0) return 1\n if (5 + lenR >= sig.length) return 1\n if (sig[4 + lenR] !== 0x02) return 1\n\n const lenS = sig[5 + lenR]\n if (lenS === 0) return 1\n if ((6 + lenR + lenS) !== sig.length) return 1\n\n if (sig[4] & 0x80) return 1\n if (lenR > 1 && (sig[4] === 0x00) && !(sig[5] & 0x80)) return 1\n\n if (sig[lenR + 6] & 0x80) return 1\n if (lenS > 1 && (sig[lenR + 6] === 0x00) && !(sig[lenR + 7] & 0x80)) return 1\n\n let sigR = sig.subarray(4, 4 + lenR)\n if (sigR.length === 33 && sigR[0] === 0x00) sigR = sigR.subarray(1)\n if (sigR.length > 32) return 1\n\n let sigS = sig.subarray(6 + lenR)\n if (sigS.length === 33 && sigS[0] === 0x00) sigS = sigS.slice(1)\n if (sigS.length > 32) throw new Error('S length is too long')\n\n let r = new BN(sigR)\n if (r.cmp(ecparams.n) >= 0) r = new BN(0)\n\n let s = new BN(sig.subarray(6 + lenR))\n if (s.cmp(ecparams.n) >= 0) s = new BN(0)\n\n output.set(r.toArrayLike(Uint8Array, 'be', 32), 0)\n output.set(s.toArrayLike(Uint8Array, 'be', 32), 32)\n\n return 0\n }", "function initSignature() {\n var signatureNode = document.body.querySelector(GMAIL_SIGNATURE_SELECTOR);\n var signatureHolder\n = document.body.querySelector('div.' + SIGNATURE_HOLDER);\n if (!signatureNode && signatureHolder.innerHTML != '') {\n setSignature(signatureHolder.innerHTML);\n }\n}", "function appxApplyStylesSignature() {\r\n /*\r\n **This code is duplicated in appx-client-localos.js function appxreceivefilehandler due\r\n **to it being possible to request a signature directly from the engine instead of using\r\n **a widget or button.\r\n */\r\n try {\r\n $(\".signature\").click(function signature_click() {\r\n appx_session.signaturePadID = $(this).attr(\"id\");\r\n /*On click create pop up dialog that contains the signature pad*/\r\n var fd = $(\"<div>\").addClass(\"appxsignaturedialog\").css({\r\n \"z-index\": 200000\r\n });\r\n var $canvas = $(\"<canvas>\").addClass(\"signaturepad\");\r\n $(fd).append($canvas);\r\n $(\"body\").append(fd);\r\n $.each($(\".appxsignaturedialog\"), function $_each(i, el) {\r\n $(el).dialog({\r\n open: function $_dialog_open(event, ui) {\r\n $(this).parent().addClass(\"appx-signature-dialog-parent\").position({\r\n my: \"center\",\r\n at: \"center\",\r\n of: \"#box_0\"\r\n });\r\n $(this).addClass(\"appx-signature-dialog\");\r\n /*Creating global so button clicks have access to signature pad*/\r\n appx_session.signaturePad = new SignaturePad($(\".signaturepad\")[0]);\r\n //const data = appx_session.signaturePad.toData();\r\n setTimeout(function () {\r\n var ratio = Math.max(window.devicePixelRatio || 1, 1);\r\n $(\".signaturepad\")[0].width = $(\".signaturepad\")[0].offsetWidth * ratio;\r\n $(\".signaturepad\")[0].height = $(\".signaturepad\")[0].offsetHeight * ratio;\r\n $(\".signaturepad\")[0].getContext(\"2d\").scale(ratio, ratio);\r\n appx_session.signaturePad.clear();\r\n }, 0);\r\n },\r\n close: function $_dialog_close() {\r\n appx_session.signaturePadID = null;\r\n this.remove();\r\n }\r\n });\r\n $(el).dialog(\"open\");\r\n });\r\n\r\n $(fd).append($(\"<input id='submitsignature' type='button' value='\" + appx_session.language.buttons.submit + \"'>\").click(function $_click() {\r\n if (!appx_session.signaturePad.isEmpty()) {\r\n /*Block the screen with message while uploading files*/\r\n $(\"#main\").block({\r\n message: \"<h1>Uploading file to temporary storage, please wait...</h1>\",\r\n baseZ: 999999,\r\n fadeIn: 0,\r\n });\r\n\r\n function createBlob(callback) {\r\n if (HTMLCanvasElement.prototype.toBlob !== undefined) {\r\n /*toBlob for all browsers except IE/Edge... Microsoft likes to create their own standards.*/\r\n $(\".signaturepad\")[0].toBlob(function (blob) {\r\n appx_session.sigBlob = blob;\r\n callback(blob);\r\n });\r\n } else {\r\n /*IE/Edge version*/\r\n callback($(\".signaturepad\")[0].msToBlob());\r\n }\r\n\r\n }\r\n createBlob(function (fileBlob) {\r\n /*Need slight delay to let blob get built.*/\r\n var fileName = \"signature.png\" + Date.now();\r\n uploadFileToMongo(fileBlob, fileName, function () {\r\n $(\"#\" + appx_session.signaturePadID).val(\"$(sendFile)\\\\\" + fileName);\r\n $(\"#\" + appx_session.signaturePadID).addClass(\"appxitem dirty\");\r\n appx_session.signaturePad.off();\r\n $(\".appxsignaturedialog\").dialog(\"close\");\r\n });\r\n });\r\n }\r\n\r\n }));\r\n\r\n /*Clear signature pad*/\r\n $(fd).append($(\"<input id='clearsignature' type='button' value='\" + appx_session.language.buttons.clearSignature + \"'>\").click(function $_click() {\r\n appx_session.signaturePad.clear();\r\n }));\r\n\r\n $(fd).append($(\"<input id='cancelsignature' type='button' value='\" + appx_session.language.buttons.cancel + \"'>\").click(function $_click() {\r\n appx_session.signaturePad.off();\r\n $(\".appxsignaturedialog\").dialog(\"close\");\r\n }));\r\n });\r\n } catch (ex) {\r\n console.log(\"Signature Pad Error: \" + ex);\r\n console.log(ex.stack);\r\n }\r\n}", "function makeSignature(params) {\n\tif (!params) return \"()\";\n\tvar signature = \"(\"\n\t+\n\tparams.filter(\n\t\tfunction($) {\n\t\t\treturn $.name.indexOf(\".\") == -1; // don't show config params in signature\n\t\t}\n\t).map(\n\t\tfunction($) {\n\t\t\treturn $.name;\n\t\t}\n\t).join(\", \")\n\t+\n\t\")\";\n\treturn signature;\n}", "async verifySignatures() {\n try {\n let addons = await this.getAddonList(a => true);\n\n let changes = {\n enabled: [],\n disabled: [],\n };\n\n for (let addon of addons) {\n // The add-on might have vanished, we'll catch that on the next startup\n if (!addon._sourceBundle.exists())\n continue;\n\n let signedState = await verifyBundleSignedState(addon._sourceBundle, addon);\n\n if (signedState != addon.signedState) {\n addon.signedState = signedState;\n AddonManagerPrivate.callAddonListeners(\"onPropertyChanged\",\n addon.wrapper,\n [\"signedState\"]);\n }\n\n let disabled = await this.updateAddonDisabledState(addon);\n if (disabled !== undefined)\n changes[disabled ? \"disabled\" : \"enabled\"].push(addon.id);\n }\n\n this.saveChanges();\n\n Services.obs.notifyObservers(null, \"xpi-signature-changed\", JSON.stringify(changes));\n } catch (err) {\n logger.error(\"XPI_verifySignature: \" + err);\n }\n }", "function VerifySignature(message) {\n var cipher = message[0]; //TEMP: message components are stored in array\n var signature = message[1];\n var publicSigningKey = message[2];\n console.log(publicSigningKey.verify(cipher, signature));\n}", "function generateSignedURL(actionName, form, accessKeyId, secretKey, endpoint, version) {\n var url = endpoint + \"?SignatureVersion=1&Action=\" + actionName + \"&Version=\" + encodeURIComponent(version) + \"&\";\n for (var i = 0; i < form.elements.length;++ i) {\n var elementName = form.elements[i].name;\n \n var elementValue = null;\n \n if (form.elements[i].type == 'text') {\n elementValue = form.elements[i].value;\n } else if (form.elements[i].type == 'select-one') {\n elementValue = form.elements[i].options[form.elements[i].selectedIndex].value;\n }\n if (elementValue) {\n url += elementName;\n url += \"=\";\n url += encodeURIComponent(elementValue);\n url += \"&\";\n }\n }\n var timestamp = getNowTimeStamp();\n url += \"Timestamp=\" + encodeURIComponent(timestamp);\n \n url += \"&AWSAccessKeyId=\" + encodeURIComponent(accessKeyId);\n var signature = generateV1Signature(url, secretKey);\n url += \"&Signature=\" + encodeURIComponent(signature);\n \n return url;\n}", "verifySignature(metadata) {\n const signature = metadata.signatures[this.keyID];\n if (!signature)\n throw new error_1.UnsignedMetadataError('no signature for key found in metadata');\n if (!this.keyVal.public)\n throw new error_1.UnsignedMetadataError('no public key found');\n const publicKey = (0, key_1.getPublicKey)({\n keyType: this.keyType,\n scheme: this.scheme,\n keyVal: this.keyVal.public,\n });\n const signedData = metadata.signed.toJSON();\n try {\n if (!utils_1.crypto.verifySignature(signedData, publicKey, signature.sig)) {\n throw new error_1.UnsignedMetadataError(`failed to verify ${this.keyID} signature`);\n }\n }\n catch (error) {\n if (error instanceof error_1.UnsignedMetadataError) {\n throw error;\n }\n throw new error_1.UnsignedMetadataError(`failed to verify ${this.keyID} signature`);\n }\n }", "function getSignature(url, params, headers, secretKey) {\n // To remove references, objects are passed by references in JS\n const message = JSON.parse(JSON.stringify(params));\n\n // We are passing the extra key values pairs before serializing our request params\n message['X-NONCE'] = headers['X-NONCE'];\n message['X-RECV-WINDOW'] = headers['X-RECV-WINDOW'];\n\n if (Object.keys(params).length === 0)\n message['X-REQUEST-URL'] = url;\n\n else\n message['X-REQUEST-URL'] = `${url}?${qs.stringify(params)}`;\n\n const messageSorted = sortObjectAlphabetically(message);\n\n console.log('messageSorted', messageSorted);\n\n const messageString = JSON.stringify(messageSorted);\n\n const signature = CryptoJS.HmacSHA256(messageString, secretKey).toString();\n\n console.log('signature', signature);\n\n return signature;\n}", "function signDigest () {\n // Find the sign-file program in the ML SDK.\n // Also search for mldb. This is not strictly necessary, although\n // it is a useful validation for the location of the ML SDK root.\n const mabuPath = which.sync('mabu');\n const mlsdkRoot = path.dirname(mabuPath);\n const exeExt = process.platform === 'win32' ? '.exe' : '';\n const mldbPath = path.resolve(mlsdkRoot, 'tools/mldb/mldb' + exeExt);\n fs.accessSync(mldbPath, fs.constants.X_OK);\n const signFilePath = path.resolve(mlsdkRoot, 'tools/signer/sign-file' + exeExt);\n fs.accessSync(signFilePath, fs.constants.X_OK);\n\n // Find the certification file and the private key file.\n const mlCertPath = process.env['MLCERT'];\n if (!mlCertPath) {\n throw 'missing $MLCERT';\n }\n fs.accessSync(mlCertPath, fs.constants.F_OK);\n const mlPrivKeyPath = path.resolve(\n path.dirname(mlCertPath),\n path.basename(mlCertPath, '.cert') + '.privkey'\n );\n fs.accessSync(mlPrivKeyPath, fs.constants.F_OK);\n function signFile () {\n // Sign DIGEST_PATH.\n trace('signing digest file');\n execFile(\n signFilePath,\n ['-f', 'sha512', mlPrivKeyPath, mlCertPath, DIGEST_PATH],\n (error, stdout, stderr) => {\n if (error) {\n throw error;\n }\n }\n );\n }\n if (!argv.debug) {\n signFile();\n return;\n }\n let python = path.join(mlsdkRoot,\n process.platform === 'win32'\n ? '/tools/python3/python.exe'\n : '/tools/python3/bin/python3.5'\n );\n let script = path.join(mlsdkRoot, '/tools/mabu/src/taildata_v3.py');\n let tailDataCommand = `${python} ${script} --sbox USER --debuggable ${DIGEST_PATH}`;\n console.info('Adding tail data');\n exec(tailDataCommand, (err, stdout, stderr) => {\n console.log(stdout);\n if (err) {\n console.error('Error Adding tail data:', err);\n }\n if (stderr) {\n console.error('Error Adding tail data:', err);\n }\n signFile();\n });\n}", "function uploadSignatureBase(filePath, upload)\n{ \n var apiFuncPath = '';\n if($('#USER_SIG_FILE'))\n {\n var spf = document.getElementById('USER_SIG_FILE');\n \n if(upload)\n {\n $('#userSigFileInput').val(spf.value.replace(/^.*[\\\\\\/]/, ''));\n apiFuncPath= \"/api/1/flash/uploadProjectSigFile\";\n }\n else//clear\n {\n $('#userSigFileInput').val('');\n apiFuncPath = \"/api/1/flash/deleteProjectSigFile\";\n }\n \n uploadSignature(spf.files, filePath, apiFuncPath);\n }\n}", "function sign (str, key) {\n return crypto.createHmac('sha256', key).update(str).digest('base64');\n}", "function check_go_signature() {\n\tif(action == 'pick-up' || action == 'delivered') {\n\t\tshow('page-signature');\n\t} else {\n\t\tcheck_go_image_pod();\n\t}\n}", "sign(url, request, consumerSecret, tokenSecret) {\n let params = Object.assign({}, this.parameters, request.params.toObject());\n\n this.signature = oauthSignature.generate(\n request.method,\n url,\n params,\n consumerSecret,\n tokenSecret,\n );\n }", "function sign(key, message) {\n var hash = magicHash(message)\n var sig = ecdsa.parseSig(key.sign(hash))\n var i = ecdsa.calcPubKeyRecoveryParam(key.pub.Q, sig.r, sig.s, hash)\n\n i += 27\n if (key.pub.compressed) {\n i += 4\n }\n\n var rB = sig.r.toBuffer(32)\n var sB = sig.s.toBuffer(32)\n\n return Buffer.concat([new Buffer([i]), rB, sB], 65)\n}", "function signatureTx (state, tx, context) {\n let { signatoryIndex, signatures } = tx\n let { signingTx, signatoryKeys } = state\n\n if (signingTx == null) {\n throw Error('No pending outgoing transaction')\n }\n if (signingTx.signatures[signatoryIndex] != null) {\n throw Error('Signatures for this signatory already exist')\n }\n\n if (!Number.isInteger(signatoryIndex)) {\n throw Error('Invalid signatory index')\n }\n if (!Array.isArray(signatures)) {\n throw Error('\"signatures\" should be an array')\n }\n if (signatures.length !== signingTx.inputs.length) {\n throw Error('Incorrect signature count')\n }\n for (let signature of signatures) {\n if (!Buffer.isBuffer(signature)) {\n throw Error('Invalid signature')\n }\n }\n\n let signatorySet = getSignatorySet(context.validators)\n let signatory = signatorySet[signatoryIndex]\n if (signatory == null) {\n throw Error('Invalid signatory index')\n }\n let signatoryKey = signatoryKeys[signatory.validatorKey]\n\n // compute hashes that should have been signed\n let bitcoinTx = buildOutgoingTx(signingTx, context.validators, signatoryKeys)\n // TODO: handle dynamic signatory sets\n let p2ss = createWitnessScript(context.validators, signatoryKeys)\n let sigHashes = signingTx.inputs.map((input, i) =>\n bitcoinTx.hashForWitnessV0(i, p2ss, input.amount, bitcoin.Transaction.SIGHASH_ALL))\n\n // verify each signature against its corresponding sighash\n for (let i = 0; i < sigHashes.length; i++) {\n let sigHash = sigHashes[i]\n let signatureDER = signatures[i]\n let signature = secp256k1.signatureImport(signatureDER)\n if (!secp256k1.verify(sigHash, signature, signatoryKey)) {\n throw Error('Invalid signature')\n }\n }\n\n // sigs are valid, update signing state\n signingTx.signatures[signatoryIndex] = signatures\n signingTx.signedVotingPower += signatory.votingPower\n let votingPowerThreshold = getVotingPowerThreshold(signatorySet)\n if (signingTx.signedVotingPower >= votingPowerThreshold) {\n // done signing, now the tx is valid and can be relayed\n state.prevSignedTx = state.signedTx\n state.signedTx = signingTx\n state.signingTx = null\n\n // add change output to our UTXOs\n let txHash = bitcoinTx.getHash()\n let changeIndex = bitcoinTx.outs.length - 1\n let changeOutput = bitcoinTx.outs[changeIndex]\n state.utxos.push({\n txid: txHash,\n index: changeIndex,\n amount: changeOutput.value\n })\n state.processedTxs[txHash.toString('base64')] = true\n }\n }", "verifyTrxSignature() {\n const publicKey = this.data.publicKey;\n const publicKeyBuffer = Buffer.from(publicKey, 'hex'); // Need to use a JS buffer object for Crypto's verify function\n const serial = this.serialize(this.data);\n return pubcrypto.verifySignature(serial, this.signature, publicKeyBuffer);\n }", "toSign(type, data) {\n const t = enums.signature;\n\n switch (type) {\n case t.binary:\n if (data.text !== null) {\n return util.encodeUtf8(data.getText(true));\n }\n return data.getBytes(true);\n\n case t.text: {\n const bytes = data.getBytes(true);\n // normalize EOL to \\r\\n\n return util.canonicalizeEOL(bytes);\n }\n case t.standalone:\n return new Uint8Array(0);\n\n case t.certGeneric:\n case t.certPersona:\n case t.certCasual:\n case t.certPositive:\n case t.certRevocation: {\n let packet;\n let tag;\n\n if (data.userId) {\n tag = 0xB4;\n packet = data.userId;\n } else if (data.userAttribute) {\n tag = 0xD1;\n packet = data.userAttribute;\n } else {\n throw new Error('Either a userId or userAttribute packet needs to be ' +\n 'supplied for certification.');\n }\n\n const bytes = packet.write();\n\n return util.concat([this.toSign(t.key, data),\n new Uint8Array([tag]),\n util.writeNumber(bytes.length, 4),\n bytes]);\n }\n case t.subkeyBinding:\n case t.subkeyRevocation:\n case t.keyBinding:\n return util.concat([this.toSign(t.key, data), this.toSign(t.key, {\n key: data.bind\n })]);\n\n case t.key:\n if (data.key === undefined) {\n throw new Error('Key packet is required for this signature.');\n }\n return data.key.writeForHash(this.version);\n\n case t.keyRevocation:\n return this.toSign(t.key, data);\n case t.timestamp:\n return new Uint8Array(0);\n case t.thirdParty:\n throw new Error('Not implemented');\n default:\n throw new Error('Unknown signature type.');\n }\n }", "function verifyRequestSignature(req, res, buf) {\n let signature = req.headers[\"x-hub-signature\"];\n if (!signature) {\n //console.error(\"[verifyRequestSignature] La request no contiene la firma de la aplicacion(APP_SECRET).\");\n throw new Error(\"La request no contiene en el encabezado la firma de la aplicacion(APP_SECRET).\");\n }\n console.trace(\"[verifyRequestSignature] Verificando la firma de la aplicacion(APP_SECRET). signature:\", signature);\n\n let elements = signature.split('=');\n // GLOZADA: desuso\n //let method = elements[0];\n let signatureHash = elements[1];\n let expectedHash = crypto.createHmac('sha1', APP_SECRET)\n .update(buf)\n .digest('hex');\n if (signatureHash != expectedHash) {\n //console.error(\"[verifyRequestSignature] La firma de la aplicacion(APP_SECRET) presente en la request no es valida.\");\n throw new Error(\"La firma de la aplicacion(APP_SECRET) presente en la request no es valida.\");\n }\n}", "function verifySignatureBox(signature, pub_key) {\n return curve.sign.open(str2buf(signature, 'base64'), pub_key);\n}", "function createSignature(data) {\n return (\n <div className={styles.footer_bottom_inner_wrapper}>\n <small\n className=\"text--xs-subtitle-two \"\n dangerouslySetInnerHTML={{\n __html: data.signature,\n }}\n />\n <small className=\"text--xxs-caption\">\n © {new Date().getFullYear()} Jose Saravia. All Rights Reserved.\n </small>\n </div>\n )\n}", "function _sign(funcParamObj,onExecuteComplete){\r\n\r\n /** default object content of an operation */\r\n var operationObj = funcParamObj.operationRef;\r\n var data = funcParamObj.payload;\r\n\r\n /** get expire difference */\r\n var expire = operationObj.conf['params.expire'];\r\n var fromfield = operationObj.conf['params.payload.from'];\r\n var tofield = operationObj.conf['params.payload.to'];\r\n\r\n try {\r\n\r\n // create payload to sign\r\n var toBeSigned = data;\r\n if(fromfield){\r\n toBeSigned = {fromfield:toBeSigned[fromfield]};\r\n }\r\n\r\n\r\n // sign\r\n var jwtToken = _getSecurityService().signToken(\r\n toBeSigned,\r\n null, // no secret == default app secret,\r\n expire\r\n );\r\n\r\n // push back\r\n if(tofield){\r\n funcParamObj.payload[tofield] = jwtToken;\r\n }else{\r\n funcParamObj.payload = jwtToken;\r\n }\r\n\r\n // send\r\n onExecuteComplete(null,funcParamObj);\r\n\r\n\r\n }catch(error){\r\n\r\n /** dispatch the error to the next op in chain */\r\n onExecuteComplete(error,funcParamObj);\r\n }\r\n}", "update(newSignature) {\n if (!newSignature) {\n throw new Error(\"shared access signature must be a non-empty string\");\n }\n this._signature = newSignature;\n }", "update(newSignature) {\n if (!newSignature) {\n throw new Error(\"shared access signature must be a non-empty string\");\n }\n this._signature = newSignature;\n }", "async function generateSignatureKey (signature) {\n const hash = await Crypto.createHash('sha256').update(signature).digest();\n\n return new CryptographyKey(hash);\n}", "function App() {\n const classes = useStyles();\n const [sigCaptured, setSigCaptured] = useState(null);\n\n listener()\n\n const handleSig = () => {\n\n }\n\n const handleSigCapture = (sig) => {\n let image = new Image();\n image.src = 'data:image/png;base64,' + sig;\n setSigCaptured({image, sig})\n }\n\n\n\n return (\n <div className=\"App\">\n <header className=\"App-header\">\n <Card\n className={classes.card}\n align='center'\n >\n <CardHeader title='Capture Signature' />\n <Divider/>\n <CardContent>\n <Box p={5}>\n <canvas id=\"cnv\" name=\"cnv\" width=\"500\" height=\"100\" />\n </Box>\n <form action=\"#\" name=\"FORM1\">\n {!sigCaptured?\n <Button \n onClick={() => {\n startTablet(handleSigCapture);\n }}\n >\n Sign\n </Button>\n : \n <Button \n onClick={() => {\n handleSig();\n }}\n >\n Done\n </Button>\n }\n <Typography variant='body1'>\n Please have customer sign signature pad.\n </Typography>\n <Box p={2}>\n <Typography>\n SigString:\n </Typography>\n <TextField className={classes.textField} name=\"sigString\" rows='20' multiline/>\n </Box>\n <Box p={2}>\n <Typography>\n ImgData:\n </Typography>\n <TextField className={classes.textField} name='imgData' rows='20' multiline value={sigCaptured?.image.src}/>\n </Box>\n <Box p={2}>\n <Typography>\n Image:\n </Typography>\n <img src={sigCaptured?.image.src}/>\n </Box>\n </form>\n </CardContent>\n </Card>\n </header>\n </div>\n );\n}", "function normalizeSignature(signature) {\n // strip 0x\n signature = signature.substr(2);\n\n // increase v by 27...\n return \"0x\" + signature.substr(0, 128) + (parseInt(signature.substr(128), 16) + 27).toString(16);\n }", "function testSign(data) {\n return arCrypt.sign(orgSignKey,data);\n}", "sign(accountKey) {\n const block = this.params;\n if(!('type' in block) || !(block.type in TYPES))\n throw new FieldError('type');\n\n const fields = Object.keys(REQUIRED_FIELDS).reduce((out, param) => {\n if(REQUIRED_FIELDS[param].types.indexOf(TYPES[block.type]) !== -1) out.push(param);\n return out;\n }, []);\n\n const header = Uint8Array.from([\n 0x52, // magic number\n 0x43, // 43 for mainnet, 41 for testnet\n 0x05, // version max\n 0x05, // version using\n 0x01, // version min\n 0x03, // type (3 = publish)\n 0x00, // extensions 16-bits\n TYPES[block.type], // extensions 16-bits ( block type )\n ]);\n\n const values = concat_uint8(fields.map(field => {\n if(!(field in block))\n throw new FieldError(field)\n\n const value = hex_uint8(valueForHash(field, block[field]));\n if(value.length !== REQUIRED_FIELDS[field].length)\n throw new FieldError(field);\n\n return value;\n }));\n\n const context = blake2bInit(32, null);\n blake2bUpdate(context, values);\n const hash = blake2bFinal(context);\n\n const signature = nacl.sign.detached(hash, hex_uint8(accountKey));\n const work = hex_uint8(block.work).reverse();\n\n return {\n msg: [ header, values, signature, work ].map(part => uint8_hex(part)).join(''),\n hash: uint8_hex(hash)\n };\n }", "async signData(privateKey, data) {\n const hash = createKeccakHash('keccak256').update(data).digest()\n \n const sig = EllipticCurve.sign(hash, ethUtil.toBuffer(\"0x\" + privateKey)); \n return [...sig.signature, sig.recovery + 27];\n }", "function sign (opts, pwd) {\n fs.readFile(opts.sourceFile, (err, message) => {\n if (err) throw err\n fs.readFile(opts.SKfile, (err, SK) => {\n if (err) throw err\n var parsedSK = minisign.parseSecretKey(SK)\n var SKinfo = minisign.extractSecretKey(pwd, parsedSK)\n\n var signedOutput = minisign.signContent(message, SKinfo, opts)\n var stringOutput = signedOutput.outputBuf.toString()\n\n fs.writeFile(opts.sigFile, stringOutput, (err) => {\n if (err) throw err\n console.log('signature saved to', path.relative(cwd, opts.sigFile))\n process.exit()\n })\n })\n })\n}", "constructor(\n deposit /* : Deposit*/,\n redemptionDetails /* : RedemptionDetails?*/\n ) {\n this.deposit = deposit\n this.withdrawnEmitter = new EventEmitter()\n\n this.redemptionDetails = this.getLatestRedemptionDetails(redemptionDetails)\n\n this.unsignedTransactionDetails = this.redemptionDetails.then(details => {\n const outputValue = details.utxoSize.sub(details.requestedFee)\n const unsignedTransaction = BitcoinHelpers.Transaction.constructOneInputOneOutputWitnessTransaction(\n details.outpoint.replace(\"0x\", \"\"),\n // We set sequence to `0` to be able to replace by fee. It reflects\n // bitcoin-spv:\n // https://github.com/summa-tx/bitcoin-spv/blob/2a9d594d9b14080bdbff2a899c16ffbf40d62eef/solidity/contracts/CheckBitcoinSigs.sol#L154\n 0,\n outputValue.toNumber(),\n EthereumHelpers.bytesToRaw(details.redeemerOutputScript)\n )\n\n return {\n hex: unsignedTransaction,\n digest: details.digest\n }\n })\n\n this.signedTransaction = this.unsignedTransactionDetails.then(\n async unsignedTransactionDetails => {\n console.debug(\n `Looking up latest redemption details for deposit ` +\n `${this.deposit.address}...`\n )\n const redemptionDigest = (await this.redemptionDetails).digest\n\n console.debug(\n `Finding or waiting for transaction signature for deposit ` +\n `${this.deposit.address}...`\n )\n const signatureEvent = await EthereumHelpers.getEvent(\n this.deposit.keepContract,\n \"SignatureSubmitted\",\n { digest: redemptionDigest }\n )\n const { r, s, recoveryID } = signatureEvent.returnValues\n const publicKeyPoint = await this.deposit.publicKeyPoint\n\n // If needed, submit redemption signature to the deposit.\n if (\n (await this.deposit.getCurrentState()) !=\n this.deposit.factory.State.AWAITING_WITHDRAWAL_PROOF\n ) {\n // A constant in the Ethereum ECDSA signature scheme, used for public key recovery [1]\n // Value is inherited from Bitcoin's Electrum wallet [2]\n // [1] https://bitcoin.stackexchange.com/questions/38351/ecdsa-v-r-s-what-is-v/38909#38909\n // [2] https://github.com/ethereum/EIPs/issues/155#issuecomment-253810938\n const ETHEREUM_ECDSA_RECOVERY_V = toBN(27)\n const v = toBN(recoveryID).add(ETHEREUM_ECDSA_RECOVERY_V)\n\n await EthereumHelpers.sendSafely(\n this.deposit.contract.methods.provideRedemptionSignature(\n v.toString(),\n r.toString(),\n s.toString()\n )\n )\n }\n\n const signedTransaction = BitcoinHelpers.Transaction.addWitnessSignature(\n unsignedTransactionDetails.hex,\n 0,\n r.replace(\"0x\", \"\"),\n s.replace(\"0x\", \"\"),\n BitcoinHelpers.publicKeyPointToPublicKeyString(\n publicKeyPoint.x,\n publicKeyPoint.y\n )\n )\n\n return signedTransaction\n }\n )\n }", "function serializeEd25519Signature(writeStream, object) {\r\n writeStream.writeByte(\"ed25519Signature.type\", object.type);\r\n writeStream.writeFixedHex(\"ed25519Signature.publicKey\", ed25519_1.Ed25519.PUBLIC_KEY_SIZE, object.publicKey);\r\n writeStream.writeFixedHex(\"ed25519Signature.signature\", ed25519_1.Ed25519.SIGNATURE_SIZE, object.signature);\r\n}", "function signRequestBox(data, sign_key) {\n return Buffer.from(curve.sign(data, sign_key)).toString('base64');\n}", "function accSign(hash, acc) {\n return new Promise((resolve, reject) => {\n acc.sign(PASSWD, hash, (err,_sign) => {\n if (err) { console.log(err); reject(err) }\n else { console.log(_sign); resolve(_sign) }\n })\n })\n}", "function _getSignatureInputByString(sHead, sPayload) {\r\n\treturn utf8tob64u(sHead) + \".\" + utf8tob64u(sPayload);\r\n }" ]
[ "0.7144011", "0.6511781", "0.64675677", "0.64249206", "0.6360391", "0.6360391", "0.6338543", "0.6315056", "0.6257392", "0.62405246", "0.62196976", "0.6171038", "0.6154192", "0.6133014", "0.6122558", "0.61215657", "0.60978734", "0.6096518", "0.60953677", "0.6091026", "0.60824245", "0.60793376", "0.6057316", "0.60442656", "0.6033903", "0.60160244", "0.59729403", "0.59484935", "0.59329647", "0.5921731", "0.5889013", "0.58841246", "0.5884066", "0.58793044", "0.58721673", "0.58585453", "0.5837157", "0.58262044", "0.5807834", "0.5797505", "0.5788568", "0.57708436", "0.5750922", "0.57353014", "0.57135206", "0.57059765", "0.5693607", "0.56767803", "0.5667647", "0.56651247", "0.56596875", "0.56541365", "0.5643317", "0.5641195", "0.5618635", "0.5605179", "0.5605122", "0.55982596", "0.5593342", "0.55840456", "0.5579153", "0.55640477", "0.55514437", "0.5550895", "0.55360115", "0.5532144", "0.55265224", "0.55254865", "0.551294", "0.55115163", "0.5501698", "0.54956394", "0.54899025", "0.5482101", "0.54594517", "0.5449241", "0.5425173", "0.5418828", "0.54065645", "0.540412", "0.54034984", "0.53952", "0.53950155", "0.53922105", "0.5384644", "0.5380587", "0.53789836", "0.53749734", "0.53749734", "0.5351608", "0.53487754", "0.5345123", "0.5343089", "0.5336397", "0.5329763", "0.5323666", "0.53181607", "0.53089744", "0.5306344", "0.53054905", "0.52976704" ]
0.0
-1
This function analyzes the type of a boolean expression node and checks if it is allowed. It can recurse when checking nested logical operators, so that only the outermost expressions are reported.
function checkNode(node, isRoot = false) { // prevent checking the same node multiple times if (checkedNodes.has(node)) { return false; } checkedNodes.add(node); // for logical operator, we also check its operands if (node.type === experimental_utils_1.AST_NODE_TYPES.LogicalExpression && node.operator !== '??') { let hasError = false; if (checkNode(node.left)) { hasError = true; } if (!options.ignoreRhs) { if (checkNode(node.right)) { hasError = true; } } // if this logical operator is not the root of a logical expression // we only check its operands and return if (!isRoot) { return hasError; } // if this is the root of a logical expression // we want to check its resulting type too else { // ...unless there already was an error, we exit so we don't double-report if (hasError) { return true; } } } const tsNode = service.esTreeNodeToTSNodeMap.get(node); const type = util.getConstrainedTypeAtLocation(checker, tsNode); let messageId; const types = inspectVariantTypes(tsutils.unionTypeParts(type)); const is = (...wantedTypes) => types.size === wantedTypes.length && wantedTypes.every(type => types.has(type)); // boolean if (is('boolean')) { // boolean is always okay return false; } // never if (is('never')) { // never is always okay return false; } // nullish else if (is('nullish')) { // condition is always false messageId = 'conditionErrorNullish'; } // nullable boolean else if (is('nullish', 'boolean')) { if (!options.allowNullable) { messageId = 'conditionErrorNullableBoolean'; } } // string else if (is('string')) { messageId = 'conditionErrorString'; } // nullable string else if (is('nullish', 'string')) { messageId = 'conditionErrorNullableString'; } // number else if (is('number')) { messageId = 'conditionErrorNumber'; } // nullable number else if (is('nullish', 'number')) { messageId = 'conditionErrorNullableNumber'; } // object else if (is('object')) { // condition is always true if (!options.allowSafe) { messageId = 'conditionErrorObject'; } } // nullable object else if (is('nullish', 'object')) { if (!options.allowSafe || !options.allowNullable) { messageId = 'conditionErrorNullableObject'; } } // boolean/object else if (is('boolean', 'object')) { if (!options.allowSafe) { messageId = 'conditionErrorOther'; } } // nullable boolean/object else if (is('nullish', 'boolean', 'object')) { if (!options.allowSafe || !options.allowNullable) { messageId = 'conditionErrorOther'; } } // any else if (is('any')) { messageId = 'conditionErrorAny'; } // other else { messageId = 'conditionErrorOther'; } if (messageId != null) { context.report({ node, messageId }); return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseBooleanExpr() {\n CST.addBranchNode(\"BooleanExpression\");\n if (match([\"T_openList\"], false, false)) {\n parseExpr();\n if (match([\"T_boolop\"], false, false)) {\n parseExpr();\n if (match([\"T_closeList\"], false, false)) {\n log(\"Boolean Expression\");\n }\n else {\n errorlog(\"Parse Error - Expected ')' to close boolean expression, got \" + tokens[currentToken].tokenName);\n }\n }\n else {\n errorlog(\"Parse Error - Missing boolean operator like == or !=, got instead \" + tokens[currentToken].tokenName);\n }\n }\n else if (match([\"T_boolTrue\"], false, false) || match([\"T_boolFalse\"], false, false)) {\n log(\"Boolean Expression\");\n }\n else {\n errorlog(\"Parse Error - Expected boolean expression, got \" + tokens[currentToken].tokenName);\n }\n CST.backtrack();\n}", "function parse_BooleanExpr() {\n tree.addNode('BooleanExpr', 'branch');\n if (foundTokensCopy[parseCounter][0] == '(') {\n match('(', parseCounter);\n parseCounter++;\n parse_Expr();\n //tree.endChildren();\n\n parse_boolop();\n //tree.endChildren();\n\n parse_Expr();\n //tree.endChildren();\n\n match(')', parseCounter);\n parseCounter++;\n } else {\n parse_boolval();\n //tree.endChildren();\n\n\n }\n tree.endChildren();\n\n}", "function isBooleanExpression(_x11) {\n var _left;\n\n var _again2 = true;\n\n _function2: while (_again2) {\n var node = _x11;\n _again2 = false;\n\n if (node.type === 'BinaryExpression' && BOOLEAN_BINARY_OPERATORS.indexOf(node.operator) > -1) {\n return true;\n } else if (node.type === 'LogicalExpression') {\n if (!(_left = isBooleanExpression(node.left))) {\n return _left;\n }\n\n _x11 = node.right;\n _again2 = true;\n continue _function2;\n } else {\n return false;\n }\n }\n }", "boolean_expr() {\n const startToken = this.currentToken;\n\n // boolean_expr : boolean_term ((AND | OR | XOR) boolean_term)*\n try {\n return this.binaryProduction(this.expr, OperatorsBooleanExpr);\n } catch (e) {\n throw new ParserException('Error processing BOOLEAN_EXPR', startToken, e);\n }\n }", "static parseBoolExpr(parseTokens) {\n _Functions.log(\"PARSER - parseBoolExpr()\");\n CSTTree.addNode(\"BooleanExpr\", \"branch\");\n //ASTTree.addNode(\"BooleanExpr\", \"branch\");\n //If match parenthesis = true: (expr boolop expr)\n if (parseTokens[tokenPointer] == \"(\" || parseTokens[tokenPointer] == \")\") {\n this.parseParen(parseTokens);\n //Add AST node depending on if it is checking isEqual or isNotEqual.\n if (parseTokens[tokenPointer + 1] == \"==\") {\n ASTTree.addNode(\"isEqual\", \"branch\");\n }\n else if (parseTokens[tokenPointer + 1] == \"!=\") {\n ASTTree.addNode(\"isNotEqual\", \"branch\");\n }\n this.parseExpr(parseTokens);\n this.parseBoolOp(parseTokens);\n this.parseExpr(parseTokens);\n this.parseParen(parseTokens);\n }\n //Boolean value.\n else {\n ASTTree.addNode(\"BooleanExpr\", \"branch\");\n this.parseBoolVal(parseTokens);\n }\n CSTTree.climbTree();\n ASTTree.climbTree();\n }", "function evalBoolExpr(node, sTable) {\n Log.GenMsg(\"Evaulating Bool_Expr...\");\n let expr1 = node.children[0];\n let boolOp = node.children[1];\n let expr2 = node.children[2];\n let addr = null;\n let addr2 = null;\n if (expr1.name === \"BOOL_EXPR\") {\n addr = evalStoreBool(expr1, sTable);\n }\n if (expr2.name === \"BOOL_EXPR\") {\n addr2 = evalStoreBool(expr2, sTable);\n }\n //Check there are no strings literals in expression\n //TODO: Implement string literal comparison\n /*\n if (expr1.name === \"CHARLIST\" || expr2.name === \"CHARLIST\") {\n throw error(\"String literals comparison not currently supported.\");\n }\n */\n if (addr === null && addr2 === null) {\n //No nested boolExpr, carry on as usual\n if (/^[0-9]$/.test(expr1.name)) {\n loadX(expr1, sTable);\n addr = getSetMem(expr2, sTable);\n }\n else {\n addr = getSetMem(expr1, sTable);\n loadX(expr2, sTable);\n }\n }\n else {\n if (addr === null) {\n //Expr1 is not a boolExpr, load its value into X\n loadX(expr1, sTable);\n if (addr2 === null) {\n addr = getSetMem(expr2, sTable);\n }\n else {\n addr = addr2;\n }\n }\n else {\n if (addr2 === null) {\n //Expr1 is a BoolExpr, but not Expr2\n loadX(expr2, sTable);\n }\n else {\n //Both Exprs are BoolExprs\n //Load result of second BoolExpr into X from memory\n byteCode.push(\"AE\", addr2[0], addr2[1]);\n }\n //Allow result of sub-boolean expressions to be overwrriten\n memManager.allowOverwrite(addr);\n }\n //Allow result of sub-boolean expressions to be overwrriten\n memManager.allowOverwrite(addr2);\n }\n //Compare X and memory location, setting Z with answer\n byteCode.push(\"EC\", addr[0], addr[1]);\n //Return if the boolOperation was \"equals\" (otherwise \"not equals\")\n return boolOp.name === \"==\";\n }", "function evaluateBooleanLiteral({ node, typescript }) {\n return node.kind === typescript.SyntaxKind.TrueKeyword;\n}", "_code_gen_boolean_comparison(boolean_expression_node, current_scope_table) {\n let left_child_value = boolean_expression_node.children_nodes[0].name;\n let right_child_value = boolean_expression_node.children_nodes[1].name;\n // Left child is not an expression\n if (left_child_value !== AST_NODE_NAME_BOOLEAN_EQUALS || left_child_value !== AST_NODE_NAME_BOOLEAN_NOT_EQUALS) {\n // Child is a variable\n if (new RegExp(\"^[a-z]$\").test(left_child_value)) {\n // Find scope with the identifier\n let scope_table_with_identifier = this._get_scope_table_with_identifier(left_child_value, current_scope_table); // _get_scope_table_with_identifier\n // Get start location of string in heap\n let id_static_data = this._get_identifier_static_data(left_child_value, scope_table_with_identifier); // _get_identifier_static_data\n // Get int value from static area or pointer to string in heap\n this._load_x_register_from_memory(id_static_data.temp_address_leading_hex, id_static_data.temp_address_trailing_hex); // _load_x_register_from_memory\n } // if\n // Child is an integer value \n else if (new RegExp(\"^[0-9]$\").test(left_child_value)) {\n this._load_x_register_with_constant(this._convert_decimal_to_one_byte_hex(parseInt(left_child_value, 10)));\n } // else if\n // Child is a boolean false\n else if (left_child_value === NODE_NAME_FALSE) {\n this._load_x_register_with_constant(this._current_program.get_false_address().toString(16).toUpperCase());\n } // else-if\n // Child is boolean true\n else if (left_child_value === NODE_NAME_TRUE) {\n this._load_x_register_with_constant(this._current_program.get_true_address().toString(16).toUpperCase());\n } // else-if\n // Child is a string expression\n else if (left_child_value.startsWith(\"\\\"\")) {\n this._load_register_with_string_pointer(left_child_value, (hex_pair) => this._load_x_register_with_constant(hex_pair)); // this._load_register_with_string_pointer\n } // else-if\n // Child is a int expression\n else if (left_child_value === AST_NODE_NAME_INT_OP) {\n let memory_address_of_sum = this._code_gen_int_expression(boolean_expression_node.children_nodes[0], null, current_scope_table); // _code_gen_int_expression\n // Load the X register with the sum of the integer expression\n this._load_x_register_from_memory(memory_address_of_sum.temp_address_leading_hex, memory_address_of_sum.temp_address_trailing_hex); // _load_x_register_from_memory\n } // else-if\n // Throw error\n else {\n throw Error(`Code Gen Boolean Comparison --> Expected [ID, Int | Boolean Value | StringExpr | IntExpr | BooleanExpr], but got ${left_child_value}`);\n } // else\n } // else\n // Right child is not an expression\n if (right_child_value !== AST_NODE_NAME_BOOLEAN_EQUALS || right_child_value !== AST_NODE_NAME_BOOLEAN_NOT_EQUALS) {\n // Child is a variable\n if (new RegExp(\"^[a-z]$\").test(right_child_value)) {\n // Find scope with the identifier\n let scope_table_with_identifier = this._get_scope_table_with_identifier(right_child_value, current_scope_table); // _get_scope_table_with_identifier\n // Get start location of string in heap\n let id_static_data = this._get_identifier_static_data(right_child_value, scope_table_with_identifier); // _get_identifier_static_data\n // Get int value from static area or pointer to string in heap\n this._compare_x_register_to_memory(id_static_data.temp_address_leading_hex, id_static_data.temp_address_trailing_hex); // _load_x_register_from_memory\n } // if\n // Child is an integer value \n else if (new RegExp(\"^[0-9]$\").test(right_child_value)) {\n this._load_accumulator_with_constant(this._convert_decimal_to_one_byte_hex(parseInt(right_child_value, 10)));\n let anonymous_address_static_data = this._get_anonymous_address();\n this._store_accumulator_to_memory(anonymous_address_static_data.temp_address_leading_hex, anonymous_address_static_data.temp_address_trailing_hex); // store_accumulator_to_memory\n this._compare_x_register_to_memory(anonymous_address_static_data.temp_address_leading_hex, anonymous_address_static_data.temp_address_trailing_hex); // compare_x_register_to_memory\n } // else if\n // Child is a boolean false\n else if (right_child_value === NODE_NAME_FALSE || right_child_value === NODE_NAME_TRUE) {\n let memory_address_of_boolean_result = this._get_anonymous_address();\n if (right_child_value === NODE_NAME_FALSE) {\n this._load_accumulator_with_constant(this._current_program.get_false_address().toString(16).toUpperCase());\n } // if\n else {\n this._load_accumulator_with_constant(this._current_program.get_true_address().toString(16).toUpperCase());\n } // else\n this._store_accumulator_to_memory(memory_address_of_boolean_result.temp_address_leading_hex, memory_address_of_boolean_result.temp_address_trailing_hex); // _store_accumulator_to_memory\n this._compare_x_register_to_memory(memory_address_of_boolean_result.temp_address_leading_hex, memory_address_of_boolean_result.temp_address_trailing_hex); // _load_x_register_from_memory\n } // else-if\n // Child is a string expression\n else if (right_child_value.startsWith(\"\\\"\")) {\n this._load_register_with_string_pointer(right_child_value, (str_pointer) => {\n let anonymous_address = this._get_anonymous_address();\n this._load_accumulator_with_constant(str_pointer);\n this._store_accumulator_to_memory(anonymous_address.temp_address_leading_hex, anonymous_address.temp_address_trailing_hex); // _store_accumulator_to_memory\n this._compare_x_register_to_memory(anonymous_address.temp_address_leading_hex, anonymous_address.temp_address_trailing_hex); // _compare_x_register_to_memory\n }); // _load_register_with_string_pointer\n } // else-if\n // Child is a int expression\n else if (right_child_value === AST_NODE_NAME_INT_OP) {\n let memory_address_of_sum = this._code_gen_int_expression(boolean_expression_node.children_nodes[1], null, current_scope_table); // _code_gen_int_expression\n // Load the X register with the sum of the integer expression\n this._compare_x_register_to_memory(memory_address_of_sum.temp_address_leading_hex, memory_address_of_sum.temp_address_trailing_hex); // _compare_x_register_to_memory\n } // else-if\n // Throw error\n else {\n throw Error(`Code Gen Boolean Comparison --> Expected [ID, Int | Boolean Value | StringExpr | IntExpr | BooleanExpr], but got ${right_child_value}`);\n } // else\n } // else\n // Store the boolean result in memory and return its address\n return this._store_boolean_result(boolean_expression_node);\n }", "_code_gen_boolean_expression(boolean_expression_node, current_scope_table) {\n let left_node_val = boolean_expression_node.children_nodes[0].name;\n let right_node_val = boolean_expression_node.children_nodes[1].name;\n let left_result = null;\n let right_result = null;\n // left and right node are two comparable values\n if (![AST_NODE_NAME_BOOLEAN_EQUALS, AST_NODE_NAME_BOOLEAN_NOT_EQUALS].includes(left_node_val)\n && ![AST_NODE_NAME_BOOLEAN_EQUALS, AST_NODE_NAME_BOOLEAN_NOT_EQUALS].includes(boolean_expression_node.children_nodes[1].name)) {\n return this._code_gen_boolean_comparison(boolean_expression_node, current_scope_table);\n } // if\n // Go down as far left as possible\n if ([AST_NODE_NAME_BOOLEAN_EQUALS, AST_NODE_NAME_BOOLEAN_NOT_EQUALS].includes(left_node_val)) {\n left_result = this._code_gen_boolean_expression(boolean_expression_node.children_nodes[0], current_scope_table);\n } // if\n // Store single value in memory\n else {\n left_result = this._store_single_value_in_memory(left_node_val, boolean_expression_node.children_nodes[0], current_scope_table);\n } // else\n // Go down as far right as possible\n if ([AST_NODE_NAME_BOOLEAN_EQUALS, AST_NODE_NAME_BOOLEAN_NOT_EQUALS].includes(right_node_val)) {\n right_result = this._code_gen_boolean_expression(boolean_expression_node.children_nodes[1], current_scope_table);\n } // if\n // Store single value in memory\n else {\n right_result = this._store_single_value_in_memory(right_node_val, boolean_expression_node.children_nodes[1], current_scope_table);\n } // else\n // Compare results\n if (left_result !== null && right_result !== null) {\n // LDX [left result]\n this._load_x_register_from_memory(left_result.temp_address_leading_hex, left_result.temp_address_trailing_hex); // _load_x_register_from_memory\n // CPX [right result]\n this._compare_x_register_to_memory(right_result.temp_address_leading_hex, right_result.temp_address_trailing_hex);\n // Free up memory \n left_result.isUsable = true;\n right_result.isUsable = false;\n // Store answer\n // Return the boolean expression result’s location in memory\n return this._store_boolean_result(boolean_expression_node);\n } // if\n else if (left_result === null) {\n return right_result;\n } // else if\n else if (right_result == null) {\n return left_result;\n } // else if\n else {\n return null;\n } // else\n }", "function parse_boolval() {\n tree.addNode('boolval', 'branch');\n if (foundTokensCopy[parseCounter][1] == 'false') {\n match('false', parseCounter);\n parseCounter++;\n } else if (foundTokensCopy[parseCounter][1] == 'true') {\n match('true', parseCounter);\n parseCounter++;\n }\n tree.endChildren();\n}", "function isBooleanLiteral(node, typescript) {\n return node.kind === typescript.SyntaxKind.TrueKeyword || node.kind === typescript.SyntaxKind.FalseKeyword;\n}", "function is_kinda_truthy(bool) {\n return bool === false || bool === 0 || bool;\n }", "function is_kinda_truthy(bool) {\n return bool === false || bool === 0 || bool;\n }", "function is_kinda_truthy(bool) {\n return bool === false || bool === 0 || bool;\n }", "function is_kinda_truthy(bool) {\r\n\t\t\t\t\treturn bool === false || bool === 0 || bool;\r\n\t\t\t\t}", "function sc_isBoolean(b) {\n return (b === true) || (b === false);\n}", "function isLogicalOrOperator(node) {\n return (node.type === ts_estree_1.AST_NODE_TYPES.LogicalExpression && node.operator === '||');\n}", "eval_bool(input) {\n const rs = this.evaluate(input);\n return (rs && rs.length === 1 && rs[0] === true)\n }", "function _boolean($a) {\n if ((0, _xvseq._isEmpty)($a)) return false;\n var a = (0, _xvseq._first)($a);\n if ($a.size > 1 && !_isNode(a)) {\n throw (0, _xverr.error)(\"err:FORG0006\");\n }\n return !!a.valueOf();\n}", "function checkExpressionAnalysisMode(node) {\n return t.ifStatement(\n markMemberToNotBeRewritten(t.memberExpression(\n nonRewritableIdentifier('self'),\n nonRewritableIdentifier('__expressionAnalysisMode__')\n )),\n t.expressionStatement(node)\n // ,t.unaryExpression(\"void\", t.numericLiteral(0), true)\n );\n }", "function isBoolean(obj) {\n\treturn obj === TRUE\n\t || obj === FALSE\n\t || typeOf(obj, \"boolean\")\n\t// || toString.call(obj) == '[object Boolean]'\n\t;\n}", "function isLogicalOrOperator(node) {\n return (node.type === experimental_utils_1.AST_NODE_TYPES.LogicalExpression && node.operator === '||');\n}", "function isBoolean(obj) {\n return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n }", "function isBoolean(obj) {\n return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n }", "function isBoolean(obj) {\n return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n }", "function isBoolean(obj) {\n return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n }", "function isBoolean(obj) {\n return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n }", "function isBoolean(obj) {\n return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n }", "function isBoolean(obj) {\n return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n }", "function isBoolean(obj) {\n return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n }", "function isBoolean(obj) {\n return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n }", "function booWho(bool) {\n /* if(bool === ture | bool === false) {\n return ture;\n } return false */\n return typeof bool === 'boolean';\n}", "function isBoolean(x) {\n return typeof x === \"boolean\";\n}", "function isBoolean(a) {\r\n return typeof a == 'boolean';\r\n}", "static validateUnaryBoolean(expression) {\n FunctionUtils.validateOrder(expression, undefined, returnType_1.ReturnType.Boolean);\n }", "function utilIsBoolean(obj) {\n\t\treturn typeof obj === 'boolean' || typeof obj === 'string' && (obj === 'true' || obj === 'false');\n\t}", "function rewriteTrueFalse(node, state) {\n if (!node.prefix || node.operator !== \"!\" || node.argument.type !== \"Literal\") return\n if (node.argument.value === 0) {\n node.type = \"Literal\"\n node.value = true\n }\n if (node.argument.value === 1) {\n node.type = \"Literal\"\n node.value = false\n }\n}", "function booWho(bool) {\n return typeof bool === 'boolean'\n}", "function Binary(node, parent) {\n if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) {\n return true;\n }\n\n if (t.isUnaryLike(parent)) {\n return true;\n }\n\n if (t.isMemberExpression(parent) && parent.object === node) {\n return true;\n }\n\n if (t.isBinary(parent)) {\n var parentOp = parent.operator;\n var parentPos = PRECEDENCE[parentOp];\n\n var nodeOp = node.operator;\n var nodePos = PRECEDENCE[nodeOp];\n\n if (parentPos > nodePos) {\n return true;\n }\n\n // Logical expressions with the same precedence don't need parens.\n if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent)) {\n return true;\n }\n }\n}", "_store_boolean_result(boolean_expression_node) {\n // Branch on not equal\n this._branch_on_zero(\"0C\"); // Skip 12 bytes\n // Z-flag was 1 and node was \"==\".\n //\n // Meaning the two values were equal and the \n // intended comparison was equal so store result as true\n if (boolean_expression_node.name === AST_NODE_NAME_BOOLEAN_EQUALS) {\n this._load_accumulator_with_constant(this._current_program.get_true_address().toString(16).toUpperCase()); // 2\n } // if\n // Z-flag was 1 and node was \"!=\".\n //\n // Meaning the two values were equal and the \n // intended comparison was not equal so store result as false\n else {\n this._load_accumulator_with_constant(this._current_program.get_false_address().toString(16).toUpperCase()); // 2\n } // else\n // Make an anoymous address entry in the static table, for later backtracking\n let anonymous_address_static_data = this._get_anonymous_address();\n // Store answer in memory\n this._store_accumulator_to_memory(anonymous_address_static_data.temp_address_leading_hex, anonymous_address_static_data.temp_address_trailing_hex); // _store_accumulator_to_memory // 3\n // Force branch out of current branch to skip storing true in memory\n // By setting up an always true condition, comparing \"f\" to \"f\"\n this._load_x_register_with_constant(\"FF\"); // \"f\", 2\n this._compare_x_register_to_memory(\"00\", this._current_program.get_false_address().toString(16).toUpperCase()); // \"f\", 3\n this._branch_on_zero(\"05\"); // 2\n // Z-flag was 0 and node was \"==\".\n //\n // Meaning the two values were not equal and the \n // intended comparison was equal so store result as false\n if (boolean_expression_node.name === AST_NODE_NAME_BOOLEAN_EQUALS) {\n this._load_accumulator_with_constant(this._current_program.get_false_address().toString(16).toUpperCase()); // 2\n } // if\n // Z-flag was 0 and node was \"!=\".\n //\n // Meaning the two values were not equal and the \n // intended comparison was not equal so store result as true\n else {\n this._load_accumulator_with_constant(this._current_program.get_true_address().toString(16).toUpperCase()); // 2\n } // else\n this._store_accumulator_to_memory(anonymous_address_static_data.temp_address_leading_hex, anonymous_address_static_data.temp_address_trailing_hex); // _store_accumulator_to_memory // 3\n // Return the boolean expression result’s location in memory\n return anonymous_address_static_data;\n }", "function boolean (data) {\n return data === false || data === true;\n }", "function isTruthy(bool) {\n return ((bool) || (!bool)) == true;\n }", "function matchBool() {\n\t\tvar pattern = /^(true|false)/;\n\t\tvar x = lexString.match(pattern);\n\t\tif(x !== null){\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "function uncompressBooleans(ast) {\n // BEFORE: a = !0; b = !1;\n // AFTER: a = true; b = false;\n query(ast, 'UnaryExpression[prefix][operator=\"!\"][argument.type=\"Literal\"]').forEach(function (node) {\n if (!node.prefix) console.log(node);\n node.type = \"Literal\";\n node.value = !node.argument.value;\n });\n}", "function Booleanissubclassable() {\n class C extends Boolean {}\n var c = new C(true);\n return c instanceof Boolean\n && c == true;\n}", "function myNestedIf(boolean1, boolean2) {\n return boolean1 && boolean2;\n}", "function isBoolean(bool) {\n return typeof bool === 'boolean';\n }", "function isBoolean(bool) {\n return typeof bool === 'boolean';\n }", "function ConditionalExpression(node, parent) {\n if (t.isUnaryLike(parent)) {\n return true;\n }\n\n if (t.isBinary(parent)) {\n return true;\n }\n\n if (t.isCallExpression(parent) || t.isNewExpression(parent)) {\n if (parent.callee === node) {\n return true;\n }\n }\n\n if (t.isConditionalExpression(parent) && parent.test === node) {\n return true;\n }\n\n if (t.isMemberExpression(parent) && parent.object === node) {\n return true;\n }\n\n return false;\n}", "function isTrue(bool){\n \n return (Object.is(true,bool));\n\n }", "function booWho(bool) {\n return typeof bool === \"boolean\";\n}", "function Binary(node, parent) {\n\t if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) {\n\t return true;\n\t }\n\n\t if (t.isUnaryLike(parent)) {\n\t return true;\n\t }\n\n\t if (t.isMemberExpression(parent) && parent.object === node) {\n\t return true;\n\t }\n\n\t if (t.isBinary(parent)) {\n\t var parentOp = parent.operator;\n\t var parentPos = PRECEDENCE[parentOp];\n\n\t var nodeOp = node.operator;\n\t var nodePos = PRECEDENCE[nodeOp];\n\n\t if (parentPos > nodePos) {\n\t return true;\n\t }\n\n\t // Logical expressions with the same precedence don't need parens.\n\t if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent)) {\n\t return true;\n\t }\n\t }\n\t}", "function isBoolean(o) {\n return toString.call(o) == '[object Boolean]';\n}", "function _isBoolean(v) {\n return (typeof v === 'boolean' ||\n Object.prototype.toString.call(v) === '[object Boolean]');\n}", "function _isBoolean(v) {\n return (typeof v === 'boolean' ||\n Object.prototype.toString.call(v) === '[object Boolean]');\n}", "function _isBoolean(v) {\n return (typeof v === 'boolean' ||\n Object.prototype.toString.call(v) === '[object Boolean]');\n}", "function _isBoolean(v) {\n return (typeof v === 'boolean' ||\n Object.prototype.toString.call(v) === '[object Boolean]');\n}", "function _isBoolean(v) {\n return (typeof v === 'boolean' ||\n Object.prototype.toString.call(v) === '[object Boolean]');\n}", "function bool(x) {\n\treturn (x === 1 || x === '1' || x === true || x === 'true');\n}", "static truthy (value) {\n let result\n switch (typeof value) {\n case \"boolean\":\n result = value\n break\n case \"number\":\n result = (value !== 0 && !isNaN(value))\n break\n case \"string\":\n result = (value !== \"\")\n break\n case \"object\":\n result = false\n if (value !== null) {\n result = true\n if (value instanceof Array)\n result = value.length > 0\n }\n break\n default:\n result = false\n }\n return result\n }", "function boolean (data) {\n return data === false || data === true;\n }", "function _verifyExpressionsType(operatorType, expressions) {\n\n let allowedTypes;\n if (expressions.length === 1) {\n allowedTypes = UNARY_OPERATOR_ALLOWED_TYPES[operatorType];\n } else if (expressions.length === 2) {\n allowedTypes = BINARY_OPERATOR_ALLOWED_TYPES[operatorType];\n } else {\n // Internal programmer error.\n throw new Error(`_verifyExpressionsType called with invalid number ${expressions.length} of expressions.`);\n }\n\n for (const currentType of allowedTypes) {\n if (expressions.every(\n (expression) => {\n if (currentType === 'nullableString') {\n return (expression === null || typeof expression === 'string');\n } else {\n return typeof expression === currentType; // eslint-disable-line\n }\n }\n )) {\n return true;\n }\n }\n\n const expressionTypes =\n expressions.map((expression) => {\n return expression == null ? 'null' : typeof expression;\n });\n\n throw new Error(`The operator ${operatorType} cannot be used with ${expressionTypes}. It can only be used with the types: ${allowedTypes}`);\n}", "function boolean_boolean(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (Object(util[\"e\" /* isEmptyValue */])(value) && !rule.required) {\n return callback();\n }\n es_rule.required(rule, value, source, errors, options);\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}", "function isBoolean(bool) {\n return typeof bool === 'boolean';\n}", "function booWho(bool) {\n return typeof bool === 'boolean';\n}", "isBoolean(value) {\n return [true, false].includes(value);\n }", "function ConditionalExpression(node, parent) {\n\t if (t.isUnaryLike(parent)) {\n\t return true;\n\t }\n\n\t if (t.isBinary(parent)) {\n\t return true;\n\t }\n\n\t if (t.isCallExpression(parent) || t.isNewExpression(parent)) {\n\t if (parent.callee === node) {\n\t return true;\n\t }\n\t }\n\n\t if (t.isConditionalExpression(parent) && parent.test === node) {\n\t return true;\n\t }\n\n\t if (t.isMemberExpression(parent) && parent.object === node) {\n\t return true;\n\t }\n\n\t return false;\n\t}", "function ConditionalExpression(node, parent) {\n\t if (t.isUnaryLike(parent)) {\n\t return true;\n\t }\n\n\t if (t.isBinary(parent)) {\n\t return true;\n\t }\n\n\t if (t.isCallExpression(parent) || t.isNewExpression(parent)) {\n\t if (parent.callee === node) {\n\t return true;\n\t }\n\t }\n\n\t if (t.isConditionalExpression(parent) && parent.test === node) {\n\t return true;\n\t }\n\n\t if (t.isMemberExpression(parent) && parent.object === node) {\n\t return true;\n\t }\n\n\t return false;\n\t}", "function isExpression(node) {\n return node != null && EXPRESSIONS.indexOf(node.type) >= 0;\n}", "function boolean_boolean(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n es_rule.required(rule, value, source, errors, options);\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}", "function boolean_boolean(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n es_rule.required(rule, value, source, errors, options);\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}", "function boolean_boolean(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n es_rule.required(rule, value, source, errors, options);\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}", "function boolean_boolean(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n es_rule.required(rule, value, source, errors, options);\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}", "function boolean_boolean(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n es_rule.required(rule, value, source, errors, options);\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}", "function isBoolean(bool) {\n return typeof bool === 'boolean';\n }", "function isBoolean(bool) {\n return typeof bool === 'boolean';\n }", "function boolean_boolean(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n\n es_rule.required(rule, value, source, errors, options);\n\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n\n callback(errors);\n}", "function parse_PtgBool(blob) {\n blob.l++;\n return blob.read_shift(1) !== 0;\n }", "function isCheckable(elem) {\n var type = elem.type, nodeName = elem.nodeName;\n return nodeName && \"input\" === nodeName.toLowerCase() && (\"checkbox\" === type || \"radio\" === type);\n}", "function myBooleanizer(v) {\r\n\t\treturn Boolean(v === 'true' | v);\r\n\t}", "function parseBoolean (str) {\r\n return ((typeof (str) == 'boolean' && str) || (typeof(str) == 'string' && str && str !== 'false'));\r\n}", "function isBoolean(boolean)\n{\n return typeof boolean == 'boolean';\n}", "function canEvaluateToEpsilon(parserDescription, symbol, dontCheck) {\n\tif(typeof dontCheck === \"undefined\") {\n\t\tdontCheck = [];\n\t}\n\n\t// Check the productions on this symbol.\n\t// If we find one that is epsilon, then we're done\n\tfor(var p in parserDescription.productions[symbol]) {\n\t\tif(parserDescription.productions[symbol][p].length === 0) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t// If we didn't find one directly above, look for productions with only non-terminals\n\tfor(var p in parserDescription.productions[symbol]) {\n\t\tvar production = parserDescription.productions[symbol][p];\n\n\t\tvar foundTerminal = false;\n\t\tfor(var s in production) {\n\t\t\tif(parserDescription.symbols[production[s]].terminal === true) {\n\t\t\t\tfoundTerminal = true;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t}\n\t\tif(foundTerminal) {\n\t\t\tcontinue ;\n\t\t}\n\n\t\t// Now we know there are no terminals in this production,\n\t\t// we need each symbol to be able to evaluate to epsilon in order to return true.\n\t\tvar ok = true;\n\t\tfor(var s in production) {\n\t\t\tif(dontCheck.indexOf(production[s]) < 0) {\n\t\t\t\tok = ok && canEvaluateToEpsilon(parserDescription, production[s], dontCheck.concat([symbol]));\n\t\t\t} else {\n\t\t\t\tok = false;\n\t\t\t}\n\t\t\tif(ok === false) {\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t}\n\n\t\tif(ok === true) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}", "function isValidBoolean(value) {\n return _.isBoolean(value) || value === 'true' || value === 'false';\n }", "function isBoolean (value) {\n var n = typeof (value)\n if (n === 'boolean') {\n console.log(true)\n } else {\n console.log(false)\n }\n}", "function isCheckable(elem) {\n var type = elem.type;\n var nodeName = elem.nodeName;\n return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');\n}", "function isCheckable(elem) {\n var type = elem.type;\n var nodeName = elem.nodeName;\n return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');\n}", "function isCheckable(elem) {\n var type = elem.type;\n var nodeName = elem.nodeName;\n return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');\n}", "function isCheckable(elem) {\n var type = elem.type;\n var nodeName = elem.nodeName;\n return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');\n}", "function isCheckable(elem) {\n var type = elem.type;\n var nodeName = elem.nodeName;\n return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');\n}", "function isCheckable(elem) {\n var type = elem.type;\n var nodeName = elem.nodeName;\n return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');\n}", "function isTrue(boolean){\n return boolean == 1;\n}", "function isBoolean(item){\n\treturn typeof item === 'boolean';\n}", "function lua_true(op) {\n return op != null && op !== false;\n}", "function notNot(bool) {\n return !!(bool);\n }", "function myNestedIf(boolean1, boolean2) {\n if (boolean1) {\n if (boolean2) {\n return true;\n }\n return false;\n }\n return false;\n}", "function forceBooleanContext(stx, loc, boolExpr){\n stx = new literal(new types.string(stx.toString())); // turn the stx object into a string literal\n var verifyCall = new symbolExpr(\"verify-boolean-branch-value\"),\n stxQuote = new quotedExpr(stx),\n locQuote = new quotedExpr(loc.toVector()),\n boolLocQuote= new quotedExpr(boolExpr.location.toVector()),\n runtimeCall = new callExpr(verifyCall\n , [stxQuote, locQuote, boolExpr, boolLocQuote]);\n runtimeCall.location = verifyCall.location = boolExpr.location;\n stxQuote.location=locQuote.location=boolLocQuote.location = boolExpr.location;\n// tagApplicationOperator_Module(runtimeCall, 'moby/runtime/kernel/misc');\n return runtimeCall;\n }", "function isTrue(input) {\n\treturn input === true || input == \"true\";\n}", "function schemaRequiresTrueValue(schema) {\n // Check if const is a truthy value\n if (schema[\"const\"]) {\n return true;\n } // Check if an enum has a single value of true\n\n\n if (schema[\"enum\"] && schema[\"enum\"].length === 1 && schema[\"enum\"][0] === true) {\n return true;\n } // If anyOf has a single value, evaluate the subschema\n\n\n if (schema.anyOf && schema.anyOf.length === 1) {\n return schemaRequiresTrueValue(schema.anyOf[0]);\n } // If oneOf has a single value, evaluate the subschema\n\n\n if (schema.oneOf && schema.oneOf.length === 1) {\n return schemaRequiresTrueValue(schema.oneOf[0]);\n } // Evaluate each subschema in allOf, to see if one of them requires a true\n // value\n\n\n if (schema.allOf) {\n return schema.allOf.some(schemaRequiresTrueValue);\n }\n}", "function isBoolean(value) {\n return value instanceof Boolean || typeof value === 'boolean';\n}" ]
[ "0.7288744", "0.6997681", "0.6723497", "0.662752", "0.6444368", "0.62344176", "0.6067088", "0.60571134", "0.6034402", "0.5916351", "0.58508396", "0.57930696", "0.57920396", "0.57920396", "0.5711017", "0.55161", "0.5497234", "0.54703325", "0.5462327", "0.53916526", "0.5377291", "0.5368265", "0.53660196", "0.53660196", "0.53660196", "0.53660196", "0.53660196", "0.53660196", "0.53660196", "0.53660196", "0.53660196", "0.53599465", "0.53320265", "0.53292584", "0.52878106", "0.5275776", "0.5249877", "0.5224952", "0.52048796", "0.519948", "0.5187328", "0.5184192", "0.5180491", "0.5169036", "0.51663357", "0.5151736", "0.51384556", "0.51384556", "0.5110375", "0.510557", "0.5100162", "0.50993884", "0.50935805", "0.5081041", "0.5081041", "0.5081041", "0.5081041", "0.5081041", "0.5079208", "0.50768673", "0.5074714", "0.5059717", "0.50526136", "0.5051656", "0.5044433", "0.50240195", "0.50222784", "0.50222784", "0.50124276", "0.5008699", "0.5008699", "0.5008699", "0.5008699", "0.5008699", "0.50083065", "0.50083065", "0.49970025", "0.49887162", "0.4986368", "0.49861604", "0.4969741", "0.49671793", "0.49637058", "0.4961946", "0.49592862", "0.49583247", "0.49583247", "0.49583247", "0.49583247", "0.49583247", "0.49583247", "0.49537674", "0.4953714", "0.49511564", "0.4949149", "0.49465713", "0.49432418", "0.4939357", "0.49367166", "0.4933083" ]
0.7363708
0
Check union variants for the types we care about
function inspectVariantTypes(types) { const variantTypes = new Set(); if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike))) { variantTypes.add('nullish'); } if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.BooleanLike))) { variantTypes.add('boolean'); } if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.StringLike))) { variantTypes.add('string'); } if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.NumberLike))) { variantTypes.add('number'); } if (types.some(type => !tsutils.isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike | ts.TypeFlags.BooleanLike | ts.TypeFlags.StringLike | ts.TypeFlags.NumberLike | ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.Never))) { variantTypes.add('object'); } if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.Any | ts.TypeFlags.Unknown))) { variantTypes.add('any'); } if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.Never))) { variantTypes.add('never'); } return variantTypes; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function containsUnion( pwf ) {\n if( typeof pwf == 'number' ) {\n return false;\n } else {\n return (('op' in pwf) && (pwf.op == 'U')) || containsUnion( pwf.op1 ) || containsUnion( pwf.op2 );\n }\n }", "function extractUnionInfo(ctx, idlType, errPrefix) {\n const seen = {\n sequenceLike: null,\n record: null,\n get dictionaryLike() {\n return this.dictionary !== null || this.record !== null || this.callbackInterface !== null;\n },\n ArrayBuffer: false,\n ArrayBufferViews: new Set(),\n get BufferSource() {\n return this.ArrayBuffer || this.ArrayBufferViews.size > 0;\n },\n object: false,\n string: null,\n numeric: null,\n boolean: null,\n callbackFunction: null,\n dictionary: null,\n callbackInterface: null,\n interfaces: new Set(),\n get interfaceLike() {\n return this.interfaces.size > 0 || this.BufferSource;\n },\n unknown: false\n };\n for (const item of idlType.idlType) {\n if (item.generic === \"sequence\" || item.generic === \"FrozenArray\") {\n if (seen.sequenceLike) {\n error(\"There can only be one sequence-like type in a union type\");\n }\n seen.sequenceLike = item;\n } else if (item.generic === \"record\") {\n if (seen.object) {\n error(\"Dictionary-like types are not distinguishable with object type\");\n }\n if (seen.callbackFunction) {\n error(\"Dictionary-like types are not distinguishable with callback functions\");\n }\n if (seen.dictionaryLike) {\n error(\"There can only be one dictionary-like type in a union type\");\n }\n seen.record = item;\n } else if (item.generic === \"Promise\") {\n error(\"Promise types are not supported in union types\");\n } else if (item.generic) {\n error(`Unknown generic type ${item.generic}`);\n } else if (item.idlType === \"any\") {\n error(\"any type is not allowed in a union type\");\n } else if (item.idlType === \"ArrayBuffer\") {\n if (seen.object) {\n error(\"ArrayBuffer is not distinguishable with object type\");\n }\n seen.ArrayBuffer = true;\n } else if (arrayBufferViewTypes.has(item.idlType)) {\n if (seen.object) {\n error(`${item.idlType} is not distinguishable with object type`);\n }\n seen.ArrayBufferViews.add(item.idlType);\n } else if (stringTypes.has(item.idlType) || ctx.enumerations.has(item.idlType)) {\n if (seen.string) {\n error(\"There can only be one string type in a union type\");\n }\n seen.string = item;\n } else if (numericTypes.has(item.idlType)) {\n if (seen.numeric) {\n error(\"There can only be one numeric type in a union type\");\n }\n seen.numeric = item;\n } else if (item.idlType === \"object\") {\n if (seen.interfaceLike) {\n error(\"Object type is not distinguishable with interface-like types\");\n }\n if (seen.callbackFunction) {\n error(\"Object type is not distinguishable with callback functions\");\n }\n if (seen.dictionaryLike) {\n error(\"Object type is not distinguishable with dictionary-like types\");\n }\n if (seen.sequenceLike) {\n error(\"Object type is not distinguishable with sequence-like types\");\n }\n seen.object = true;\n } else if (item.idlType === \"boolean\") {\n seen.boolean = item;\n } else if (ctx.callbackFunctions.has(item.idlType)) {\n if (seen.object) {\n error(\"Callback functions are not distinguishable with object type\");\n }\n if (seen.dictionaryLike) {\n error(\"Callback functions are not distinguishable with dictionary-like types\");\n }\n seen.callbackFunction = item.idlType;\n } else if (ctx.dictionaries.has(item.idlType)) {\n if (seen.object) {\n error(\"Dictionary-like types are not distinguishable with object type\");\n }\n if (seen.callbackFunction) {\n error(\"Dictionary-like types are not distinguishable with callback functions\");\n }\n if (seen.dictionaryLike) {\n error(\"There can only be one dictionary-like type in a union type\");\n }\n seen.dictionary = item;\n } else if (ctx.callbackInterfaces.has(item.idlType)) {\n if (seen.object) {\n error(\"Dictionary-like types are not distinguishable with object type\");\n }\n if (seen.callbackFunction) {\n error(\"Dictionary-like types are not distinguishable with callback functions\");\n }\n if (seen.dictionaryLike) {\n error(\"There can only be one dictionary-like type in a union type\");\n }\n seen.callbackInterface = item.idlType;\n } else if (ctx.interfaces.has(item.idlType)) {\n if (seen.object) {\n error(\"Interface types are not distinguishable with object type\");\n }\n seen.interfaces.add(item.idlType);\n } else {\n seen.unknown = true;\n }\n }\n return seen;\n\n function error(msg) {\n throw new Error(`${msg}\\n When compiling \"${eval(errPrefix)}\"`); // eslint-disable-line no-eval\n }\n}", "parseUnionMemberTypes() {\n return this.expectOptionalToken(TokenKind.EQUALS)\n ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType)\n : [];\n }", "static taggedUnion(...types) {\n return async function typeFn(message, phrase) {\n for (let entry of types) {\n entry = Argument.tagged(entry);\n const res = await Argument.cast(entry, this.handler.resolver, message, phrase);\n if (!Argument.isFailure(res))\n return res;\n }\n return null;\n };\n }", "function parseUnionMemberTypes(lexer) {\n var types = [];\n\n if (expectOptionalToken(lexer, _tokenKind__WEBPACK_IMPORTED_MODULE_4__[\"TokenKind\"].EQUALS)) {\n // Optional leading pipe\n expectOptionalToken(lexer, _tokenKind__WEBPACK_IMPORTED_MODULE_4__[\"TokenKind\"].PIPE);\n\n do {\n types.push(parseNamedType(lexer));\n } while (expectOptionalToken(lexer, _tokenKind__WEBPACK_IMPORTED_MODULE_4__[\"TokenKind\"].PIPE));\n }\n\n return types;\n}", "function parseUnionMemberTypes(lexer) {\n var types = [];\n\n if (expectOptionalToken(lexer, _lexer__WEBPACK_IMPORTED_MODULE_4__[\"TokenKind\"].EQUALS)) {\n // Optional leading pipe\n expectOptionalToken(lexer, _lexer__WEBPACK_IMPORTED_MODULE_4__[\"TokenKind\"].PIPE);\n\n do {\n types.push(parseNamedType(lexer));\n } while (expectOptionalToken(lexer, _lexer__WEBPACK_IMPORTED_MODULE_4__[\"TokenKind\"].PIPE));\n }\n\n return types;\n}", "function parseUnionMemberTypes(lexer) {\n var types = [];\n\n if (expectOptionalToken(lexer, _lexer__WEBPACK_IMPORTED_MODULE_4__[\"TokenKind\"].EQUALS)) {\n // Optional leading pipe\n expectOptionalToken(lexer, _lexer__WEBPACK_IMPORTED_MODULE_4__[\"TokenKind\"].PIPE);\n\n do {\n types.push(parseNamedType(lexer));\n } while (expectOptionalToken(lexer, _lexer__WEBPACK_IMPORTED_MODULE_4__[\"TokenKind\"].PIPE));\n }\n\n return types;\n}", "function parseUnionType() {\n var elements, startIndex = index - 1;\n consume(Token.LPAREN, 'UnionType should start with (');\n elements = [];\n if (token !== Token.RPAREN) {\n while (true) {\n elements.push(parseTypeExpression());\n if (token === Token.RPAREN) {\n break;\n }\n expect(Token.PIPE);\n }\n }\n consume(Token.RPAREN, 'UnionType should end with )');\n return maybeAddRange({\n type: Syntax.UnionType,\n elements: elements\n }, [startIndex, previous]);\n }", "function parseUnionMemberTypes(lexer) {\n var types = [];\n\n if (expectOptionalToken(lexer, TokenKind.EQUALS)) {\n // Optional leading pipe\n expectOptionalToken(lexer, TokenKind.PIPE);\n\n do {\n types.push(parseNamedType(lexer));\n } while (expectOptionalToken(lexer, TokenKind.PIPE));\n }\n\n return types;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var typesRemovedFromUnion = [];\n\n var _arr10 = Object.keys(oldTypeMap);\n\n for (var _i10 = 0; _i10 < _arr10.length; _i10++) {\n var typeName = _arr10[_i10];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(newType)) {\n continue;\n }\n\n var typeNamesInNewUnion = Object.create(null);\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = newType.getTypes()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var type = _step3.value;\n typeNamesInNewUnion[type.name] = true;\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = oldType.getTypes()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var _type = _step4.value;\n\n if (!typeNamesInNewUnion[_type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: \"\".concat(_type.name, \" was removed from union type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n }\n\n return typesRemovedFromUnion;\n}", "function parseUnionMemberTypes(lexer) {\n var types = [];\n\n if (skip(lexer, _lexer__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].EQUALS)) {\n // Optional leading pipe\n skip(lexer, _lexer__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PIPE);\n\n do {\n types.push(parseNamedType(lexer));\n } while (skip(lexer, _lexer__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PIPE));\n }\n\n return types;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var typesRemovedFromUnion = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n\t return;\n\t }\n\t var typeNamesInNewUnion = Object.create(null);\n\t newType.getTypes().forEach(function (type) {\n\t typeNamesInNewUnion[type.name] = true;\n\t });\n\t oldType.getTypes().forEach(function (type) {\n\t if (!typeNamesInNewUnion[type.name]) {\n\t typesRemovedFromUnion.push({\n\t type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n\t description: type.name + ' was removed from union type ' + typeName + '.'\n\t });\n\t }\n\t });\n\t });\n\t return typesRemovedFromUnion;\n\t}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesRemovedFromUnion = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInNewUnion = Object.create(null);\n newType.getTypes().forEach(function (type) {\n typeNamesInNewUnion[type.name] = true;\n });\n oldType.getTypes().forEach(function (type) {\n if (!typeNamesInNewUnion[type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: type.name + ' was removed from union type ' + typeName + '.'\n });\n }\n });\n });\n return typesRemovedFromUnion;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesRemovedFromUnion = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInNewUnion = Object.create(null);\n newType.getTypes().forEach(function (type) {\n typeNamesInNewUnion[type.name] = true;\n });\n oldType.getTypes().forEach(function (type) {\n if (!typeNamesInNewUnion[type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: type.name + ' was removed from union type ' + typeName + '.'\n });\n }\n });\n });\n return typesRemovedFromUnion;\n}", "function isTypeSubTypeOf(_x3, _x4) {\n var _again2 = true;\n\n _function2: while (_again2) {\n var maybeSubType = _x3,\n superType = _x4;\n _again2 = false;\n\n // Equivalent type is a valid subtype\n if (maybeSubType === superType) {\n return true;\n }\n\n // If superType is non-null, maybeSubType must also be nullable.\n if (superType instanceof _typeDefinition.GraphQLNonNull) {\n if (maybeSubType instanceof _typeDefinition.GraphQLNonNull) {\n _x3 = maybeSubType.ofType;\n _x4 = superType.ofType;\n _again2 = true;\n continue _function2;\n }\n return false;\n } else if (maybeSubType instanceof _typeDefinition.GraphQLNonNull) {\n // If superType is nullable, maybeSubType may be non-null.\n _x3 = maybeSubType.ofType;\n _x4 = superType;\n _again2 = true;\n continue _function2;\n }\n\n // If superType type is a list, maybeSubType type must also be a list.\n if (superType instanceof _typeDefinition.GraphQLList) {\n if (maybeSubType instanceof _typeDefinition.GraphQLList) {\n _x3 = maybeSubType.ofType;\n _x4 = superType.ofType;\n _again2 = true;\n continue _function2;\n }\n return false;\n } else if (maybeSubType instanceof _typeDefinition.GraphQLList) {\n // If superType is not a list, maybeSubType must also be not a list.\n return false;\n }\n\n // If superType type is an abstract type, maybeSubType type may be a currently\n // possible object type.\n if ((0, _typeDefinition.isAbstractType)(superType) && maybeSubType instanceof _typeDefinition.GraphQLObjectType && superType.isPossibleType(maybeSubType)) {\n return true;\n }\n\n // Otherwise, the child type is not a valid subtype of the parent type.\n return false;\n }\n}", "function parseUnionTypeDefinition(lexer) {\n\t var start = lexer.token;\n\t expectKeyword(lexer, 'union');\n\t var name = parseName(lexer);\n\t var directives = parseDirectives(lexer);\n\t expect(lexer, _lexer.TokenKind.EQUALS);\n\t var types = parseUnionMembers(lexer);\n\t return {\n\t kind: _kinds.UNION_TYPE_DEFINITION,\n\t name: name,\n\t directives: directives,\n\t types: types,\n\t loc: loc(lexer, start)\n\t };\n\t}", "function parseUnionMemberTypes(lexer) {\n var types = [];\n if (skip(lexer, _lexer.TokenKind.EQUALS)) {\n // Optional leading pipe\n skip(lexer, _lexer.TokenKind.PIPE);\n do {\n types.push(parseNamedType(lexer));\n } while (skip(lexer, _lexer.TokenKind.PIPE));\n }\n return types;\n}", "function parseUnionMemberTypes(lexer) {\n var types = [];\n if (skip(lexer, _lexer.TokenKind.EQUALS)) {\n // Optional leading pipe\n skip(lexer, _lexer.TokenKind.PIPE);\n do {\n types.push(parseNamedType(lexer));\n } while (skip(lexer, _lexer.TokenKind.PIPE));\n }\n return types;\n}", "function parseUnionMemberTypes(lexer) {\n var types = [];\n if (skip(lexer, _lexer.TokenKind.EQUALS)) {\n // Optional leading pipe\n skip(lexer, _lexer.TokenKind.PIPE);\n do {\n types.push(parseNamedType(lexer));\n } while (skip(lexer, _lexer.TokenKind.PIPE));\n }\n return types;\n}", "function parseUnionMemberTypes(lexer) {\n var types = [];\n if (skip(lexer, _lexer.TokenKind.EQUALS)) {\n // Optional leading pipe\n skip(lexer, _lexer.TokenKind.PIPE);\n do {\n types.push(parseNamedType(lexer));\n } while (skip(lexer, _lexer.TokenKind.PIPE));\n }\n return types;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n\t // So flow is aware this is constant\n\t var _typeB = typeB;\n\n\t // Equivalent types overlap\n\t if (typeA === _typeB) {\n\t return true;\n\t }\n\n\t if (typeA instanceof _definition.GraphQLInterfaceType || typeA instanceof _definition.GraphQLUnionType) {\n\t if (_typeB instanceof _definition.GraphQLInterfaceType || _typeB instanceof _definition.GraphQLUnionType) {\n\t // If both types are abstract, then determine if there is any intersection\n\t // between possible concrete types of each.\n\t return schema.getPossibleTypes(typeA).some(function (type) {\n\t return schema.isPossibleType(_typeB, type);\n\t });\n\t }\n\t // Determine if the latter type is a possible concrete type of the former.\n\t return schema.isPossibleType(typeA, _typeB);\n\t }\n\n\t if (_typeB instanceof _definition.GraphQLInterfaceType || _typeB instanceof _definition.GraphQLUnionType) {\n\t // Determine if the former type is a possible concrete type of the latter.\n\t return schema.isPossibleType(_typeB, typeA);\n\t }\n\n\t // Otherwise the types do not overlap.\n\t return false;\n\t}", "function findTypesAddedToUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var typesAddedToUnion = [];\n\n var _arr11 = Object.keys(newTypeMap);\n\n for (var _i11 = 0; _i11 < _arr11.length; _i11++) {\n var typeName = _arr11[_i11];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(newType)) {\n continue;\n }\n\n var typeNamesInOldUnion = Object.create(null);\n var _iteratorNormalCompletion5 = true;\n var _didIteratorError5 = false;\n var _iteratorError5 = undefined;\n\n try {\n for (var _iterator5 = oldType.getTypes()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {\n var type = _step5.value;\n typeNamesInOldUnion[type.name] = true;\n }\n } catch (err) {\n _didIteratorError5 = true;\n _iteratorError5 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion5 && _iterator5.return != null) {\n _iterator5.return();\n }\n } finally {\n if (_didIteratorError5) {\n throw _iteratorError5;\n }\n }\n }\n\n var _iteratorNormalCompletion6 = true;\n var _didIteratorError6 = false;\n var _iteratorError6 = undefined;\n\n try {\n for (var _iterator6 = newType.getTypes()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {\n var _type2 = _step6.value;\n\n if (!typeNamesInOldUnion[_type2.name]) {\n typesAddedToUnion.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: \"\".concat(_type2.name, \" was added to union type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError6 = true;\n _iteratorError6 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion6 && _iterator6.return != null) {\n _iterator6.return();\n }\n } finally {\n if (_didIteratorError6) {\n throw _iteratorError6;\n }\n }\n }\n }\n\n return typesAddedToUnion;\n}", "function doTypesConflict(type1, type2) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type1)) {\n return Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type1)) {\n return Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type1) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function doTypesConflict(type1, type2) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type1) || Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function doTypesConflict(type1, type2) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type1) || Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function doTypesConflict(type1, type2) {\n if ((0, _definition.isListType)(type1)) {\n return (0, _definition.isListType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isListType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isNonNullType)(type1)) {\n return (0, _definition.isNonNullType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isNonNullType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isLeafType)(type1) || (0, _definition.isLeafType)(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function doTypesConflict(type1, type2) {\n if ((0, _definition.isListType)(type1)) {\n return (0, _definition.isListType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isListType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isNonNullType)(type1)) {\n return (0, _definition.isNonNullType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isNonNullType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isLeafType)(type1) || (0, _definition.isLeafType)(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function parseUnionMemberTypes(lexer) {\n var types = [];\n\n if (skip(lexer, _lexer.TokenKind.EQUALS)) {\n // Optional leading pipe\n skip(lexer, _lexer.TokenKind.PIPE);\n\n do {\n types.push(parseNamedType(lexer));\n } while (skip(lexer, _lexer.TokenKind.PIPE));\n }\n\n return types;\n}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer);\n expect(lexer, _lexer.TokenKind.EQUALS);\n var types = parseUnionMembers(lexer);\n return {\n kind: _kinds.UNION_TYPE_DEFINITION,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer);\n expect(lexer, _lexer.TokenKind.EQUALS);\n var types = parseUnionMembers(lexer);\n return {\n kind: _kinds.UNION_TYPE_DEFINITION,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer);\n expect(lexer, _lexer.TokenKind.EQUALS);\n var types = parseUnionMembers(lexer);\n return {\n kind: _kinds.UNION_TYPE_DEFINITION,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer);\n expect(lexer, _lexer.TokenKind.EQUALS);\n var types = parseUnionMembers(lexer);\n return {\n kind: _kinds.UNION_TYPE_DEFINITION,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer);\n expect(lexer, _lexer.TokenKind.EQUALS);\n var types = parseUnionMembers(lexer);\n return {\n kind: _kinds.UNION_TYPE_DEFINITION,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer);\n expect(lexer, _lexer.TokenKind.EQUALS);\n var types = parseUnionMembers(lexer);\n return {\n kind: _kinds.UNION_TYPE_DEFINITION,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "parseUnionTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('union');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const types = this.parseUnionMemberTypes();\n return this.node(start, {\n kind: Kind.UNION_TYPE_DEFINITION,\n description,\n name,\n directives,\n types,\n });\n }", "function findTypesAddedToUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesAddedToUnion = [];\n Object.keys(newTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInOldUnion = Object.create(null);\n oldType.getTypes().forEach(function (type) {\n typeNamesInOldUnion[type.name] = true;\n });\n newType.getTypes().forEach(function (type) {\n if (!typeNamesInOldUnion[type.name]) {\n typesAddedToUnion.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: type.name + ' was added to union type ' + typeName + '.'\n });\n }\n });\n });\n return typesAddedToUnion;\n}", "function isTypeSubTypeOf(_x3, _x4) {\n\t var _again2 = true;\n\n\t _function2: while (_again2) {\n\t var maybeSubType = _x3,\n\t superType = _x4;\n\t _again2 = false;\n\n\t // Equivalent type is a valid subtype\n\t if (maybeSubType === superType) {\n\t return true;\n\t }\n\n\t // If superType is non-null, maybeSubType must also be nullable.\n\t if (superType instanceof _typeDefinition.GraphQLNonNull) {\n\t if (maybeSubType instanceof _typeDefinition.GraphQLNonNull) {\n\t _x3 = maybeSubType.ofType;\n\t _x4 = superType.ofType;\n\t _again2 = true;\n\t continue _function2;\n\t }\n\t return false;\n\t } else if (maybeSubType instanceof _typeDefinition.GraphQLNonNull) {\n\t // If superType is nullable, maybeSubType may be non-null.\n\t _x3 = maybeSubType.ofType;\n\t _x4 = superType;\n\t _again2 = true;\n\t continue _function2;\n\t }\n\n\t // If superType type is a list, maybeSubType type must also be a list.\n\t if (superType instanceof _typeDefinition.GraphQLList) {\n\t if (maybeSubType instanceof _typeDefinition.GraphQLList) {\n\t _x3 = maybeSubType.ofType;\n\t _x4 = superType.ofType;\n\t _again2 = true;\n\t continue _function2;\n\t }\n\t return false;\n\t } else if (maybeSubType instanceof _typeDefinition.GraphQLList) {\n\t // If superType is not a list, maybeSubType must also be not a list.\n\t return false;\n\t }\n\n\t // If superType type is an abstract type, maybeSubType type may be a currently\n\t // possible object type.\n\t if ((0, _typeDefinition.isAbstractType)(superType) && maybeSubType instanceof _typeDefinition.GraphQLObjectType && superType.isPossibleType(maybeSubType)) {\n\t return true;\n\t }\n\n\t // Otherwise, the child type is not a valid subtype of the parent type.\n\t return false;\n\t }\n\t}", "function parseUnionTypeDefinition(lexer) {\n\t var start = lexer.token;\n\t var description = parseDescription(lexer);\n\t expectKeyword(lexer, 'union');\n\t var name = parseName(lexer);\n\t var directives = parseDirectives(lexer, true);\n\t var types = parseMemberTypesDefinition(lexer);\n\t return {\n\t kind: _kinds.UNION_TYPE_DEFINITION,\n\t description: description,\n\t name: name,\n\t directives: directives,\n\t types: types,\n\t loc: loc(lexer, start)\n\t };\n\t}", "function UnionType(schema, opts) {\n Type.call(this);\n\n if (!Array.isArray(schema)) {\n throw new Error(f('non-array union schema: %j', schema));\n }\n if (!schema.length) {\n throw new Error('empty union');\n }\n this.types = Object.freeze(schema.map(function (obj) {\n return Type.forSchema(obj, opts);\n }));\n\n this._branchIndices = {};\n this.types.forEach(function (type, i) {\n if (Type.isType(type, 'union')) {\n throw new Error('unions cannot be directly nested');\n }\n var branch = type.branchName;\n if (this._branchIndices[branch] !== undefined) {\n throw new Error(f('duplicate union branch name: %j', branch));\n }\n this._branchIndices[branch] = i;\n }, this);\n}", "function UnionType(schema, opts) {\n Type$2.call(this);\n\n if (!Array.isArray(schema)) {\n throw new Error(f('non-array union schema: %j', schema));\n }\n if (!schema.length) {\n throw new Error('empty union');\n }\n this.types = Object.freeze(schema.map(function (obj) {\n return Type$2.forSchema(obj, opts);\n }));\n\n this._branchIndices = {};\n this.types.forEach(function (type, i) {\n if (Type$2.isType(type, 'union')) {\n throw new Error('unions cannot be directly nested');\n }\n var branch = type.branchName;\n if (this._branchIndices[branch] !== undefined) {\n throw new Error(f('duplicate union branch name: %j', branch));\n }\n this._branchIndices[branch] = i;\n }, this);\n}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n var description = parseDescription(lexer);\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n return {\n kind: _kinds__WEBPACK_IMPORTED_MODULE_6__[\"Kind\"].UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function checkInconsistentFieldTypes(fields, layers) {\n fields.forEach(function(key) {\n var types = findFieldTypes(key, layers);\n if (types.length > 1) {\n stop(\"Inconsistent data types in \\\"\" + key + \"\\\" field:\", types.join(', '));\n }\n });\n }", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n var description = parseDescription(lexer);\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n return {\n kind: _kinds__WEBPACK_IMPORTED_MODULE_4__[\"Kind\"].UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n var description = parseDescription(lexer);\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n return {\n kind: _kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n var description = parseDescription(lexer);\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n return {\n kind: _kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "static unionType(...typeChoices) {\n return new Union(this.typesOrStrings(typeChoices));\n }", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n var description = parseDescription(lexer);\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n return {\n kind: _kinds.Kind.UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n var description = parseDescription(lexer);\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n return {\n kind: _kinds.Kind.UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n var description = parseDescription(lexer);\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n return {\n kind: _kinds.Kind.UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n var description = parseDescription(lexer);\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n return {\n kind: _kinds.Kind.UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n var description = parseDescription(lexer);\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n return {\n kind: _kinds.Kind.UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeDefinition(parser) {\n\t var start = parser.token.start;\n\t expectKeyword(parser, 'union');\n\t var name = parseName(parser);\n\t expect(parser, _lexer.TokenKind.EQUALS);\n\t var types = parseUnionMembers(parser);\n\t return {\n\t kind: _kinds.UNION_TYPE_DEFINITION,\n\t name: name,\n\t types: types,\n\t loc: loc(parser, start)\n\t };\n\t}", "function parseUnionTypeDefinition(lexer) {\n var start = lexer.token;\n var description = parseDescription(lexer);\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n return {\n kind: Kind.UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeDefinition(parser) {\n var start = parser.token.start;\n expectKeyword(parser, 'union');\n var name = parseName(parser);\n expect(parser, _lexer.TokenKind.EQUALS);\n var types = parseUnionMembers(parser);\n return {\n kind: _kinds.UNION_TYPE_DEFINITION,\n name: name,\n types: types,\n loc: loc(parser, start)\n };\n}", "choiceSupportsValueX(choice) {\n // TODO: This assumes choice options don't have their own cardinality. This isn't true in SHR today, but\n // we're restricting it in SHR in the future. No use going through the trouble of supporting it if it's going away.\n for (const opt of choice.aggregateOptions) {\n if (opt instanceof mdls.TBD) {\n continue;\n } else if (opt instanceof mdls.IdentifiableValue) {\n if (!opt.effectiveIdentifier.isPrimitive) {\n const map = this._specs.maps.findByTargetAndIdentifier(this._target, opt.effectiveIdentifier);\n if (map === undefined) {\n return false;\n }\n }\n } else {\n //13053 , 'Unsupported value type: ${valueType1}. ' , 'Unknown' , 'errorNumber'\n logger.error({valueType1 : opt.constructor.name }, '13053' );\n return false;\n }\n }\n\n return true;\n }", "function parseUnionTypeDefinition(lexer$$1) {\n var start = lexer$$1.token;\n var description = parseDescription(lexer$$1);\n expectKeyword(lexer$$1, 'union');\n var name = parseName(lexer$$1);\n var directives = parseDirectives(lexer$$1, true);\n var types = parseMemberTypesDefinition(lexer$$1);\n return {\n kind: kinds.UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer$$1, start)\n };\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeA)) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isPossibleType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isPossibleType(typeA, typeB);\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isPossibleType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function doTypesOverlap(typeA, typeB) {\n\t // So flow is aware this is constant\n\t var _typeB = typeB;\n\n\t // Equivalent types overlap\n\t if (typeA === _typeB) {\n\t return true;\n\t }\n\n\t if (typeA instanceof _typeDefinition.GraphQLInterfaceType || typeA instanceof _typeDefinition.GraphQLUnionType) {\n\t if (_typeB instanceof _typeDefinition.GraphQLInterfaceType || _typeB instanceof _typeDefinition.GraphQLUnionType) {\n\t // If both types are abstract, then determine if there is any intersection\n\t // between possible concrete types of each.\n\t return typeA.getPossibleTypes().some(function (type) {\n\t return _typeB.isPossibleType(type);\n\t });\n\t }\n\t // Determine if the latter type is a possible concrete type of the former.\n\t return typeA.isPossibleType(_typeB);\n\t }\n\n\t if (_typeB instanceof _typeDefinition.GraphQLInterfaceType || _typeB instanceof _typeDefinition.GraphQLUnionType) {\n\t // Determine if the former type is a possible concrete type of the latter.\n\t return _typeB.isPossibleType(typeA);\n\t }\n\n\t // Otherwise the types do not overlap.\n\t return false;\n\t}", "function union() {\n var typeSpec = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n typeSpec[_i] = arguments[_i];\n }\n return new TUnion(typeSpec.map(function (t) { return parseSpec(t); }));\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeA)) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isSubType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isSubType(typeA, typeB);\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isSubType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeA)) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isSubType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isSubType(typeA, typeB);\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isSubType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function $Teiw$export$isOneOf(a, b) {\n if (b === void 0) {\n b = [];\n }\n\n return b.some(function (v) {\n return a === v;\n });\n} //# sourceMappingURL=is-one-of.js.map", "function UnwrappedUnionType(schema, opts) {\n UnionType.call(this, schema, opts);\n\n this._dynamicBranches = null;\n this._bucketIndices = {};\n this.types.forEach(function (type, index) {\n if (Type$2.isType(type, 'abstract', 'logical')) {\n if (!this._dynamicBranches) {\n this._dynamicBranches = [];\n }\n this._dynamicBranches.push({index: index, type: type});\n } else {\n var bucket = getTypeBucket(type);\n if (this._bucketIndices[bucket] !== undefined) {\n throw new Error(f('ambiguous unwrapped union: %j', this));\n }\n this._bucketIndices[bucket] = index;\n }\n }, this);\n\n Object.freeze(this);\n}", "function dataTypeChecker(arr) {\n let dataType = typeof arr[0];\n let same = true;\n for (let i = 0; i < arr.length; i++) {\n if (dataType !== typeof arr[i]) {\n return (same = false);\n }\n }\n return same;\n}", "function doTypesOverlap(typeA, typeB) {\n // So flow is aware this is constant\n var _typeB = typeB;\n\n // Equivalent types overlap\n if (typeA === _typeB) {\n return true;\n }\n\n if (typeA instanceof _typeDefinition.GraphQLInterfaceType || typeA instanceof _typeDefinition.GraphQLUnionType) {\n if (_typeB instanceof _typeDefinition.GraphQLInterfaceType || _typeB instanceof _typeDefinition.GraphQLUnionType) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return typeA.getPossibleTypes().some(function (type) {\n return _typeB.isPossibleType(type);\n });\n }\n // Determine if the latter type is a possible concrete type of the former.\n return typeA.isPossibleType(_typeB);\n }\n\n if (_typeB instanceof _typeDefinition.GraphQLInterfaceType || _typeB instanceof _typeDefinition.GraphQLUnionType) {\n // Determine if the former type is a possible concrete type of the latter.\n return _typeB.isPossibleType(typeA);\n }\n\n // Otherwise the types do not overlap.\n return false;\n}", "function UnwrappedUnionType(schema, opts) {\n UnionType.call(this, schema, opts);\n\n this._dynamicBranches = null;\n this._bucketIndices = {};\n this.types.forEach(function (type, index) {\n if (Type.isType(type, 'abstract', 'logical')) {\n if (!this._dynamicBranches) {\n this._dynamicBranches = [];\n }\n this._dynamicBranches.push({index: index, type: type});\n } else {\n var bucket = getTypeBucket(type);\n if (this._bucketIndices[bucket] !== undefined) {\n throw new Error(f('ambiguous unwrapped union: %j', this));\n }\n this._bucketIndices[bucket] = index;\n }\n }, this);\n\n Object.freeze(this);\n}", "function _determineActualTypes(\n env, // :: Array Type\n seen, // :: Array Object\n values // :: Array Any\n ) {\n var expandUnknown4 = expandUnknown (env);\n\n function refine(types, value) {\n var seen$;\n if (typeof value === 'object' && value != null ||\n typeof value === 'function') {\n // Abort if a circular reference is encountered; add the current\n // object to the array of seen objects otherwise.\n if (seen.indexOf (value) >= 0) return [];\n seen$ = Z.concat (seen, [value]);\n } else {\n seen$ = seen;\n }\n var expandUnknown2 = expandUnknown4 (seen$) (value);\n return Z.chain (function(t) {\n return (\n (t.validate (env) (value)).isLeft ?\n [] :\n t.type === UNARY ?\n Z.map (fromUnaryType (t),\n expandUnknown2 (t.extractors.$1) (t.types.$1)) :\n t.type === BINARY ?\n Z.lift2 (fromBinaryType (t),\n expandUnknown2 (t.extractors.$1) (t.types.$1),\n expandUnknown2 (t.extractors.$2) (t.types.$2)) :\n // else\n [t]\n );\n }, types);\n }\n\n return isEmpty (values) ?\n [Unknown] :\n or (Z.reduce (refine, env, values), [Inconsistent]);\n }", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if ((0, _definition.isAbstractType)(typeA)) {\n if ((0, _definition.isAbstractType)(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isSubType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isSubType(typeA, typeB);\n }\n\n if ((0, _definition.isAbstractType)(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isSubType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if ((0, _definition.isAbstractType)(typeA)) {\n if ((0, _definition.isAbstractType)(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isSubType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isSubType(typeA, typeB);\n }\n\n if ((0, _definition.isAbstractType)(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isSubType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // So flow is aware this is constant\n var _typeB = typeB;\n\n // Equivalent types overlap\n if (typeA === _typeB) {\n return true;\n }\n\n if ((0, _definition.isAbstractType)(typeA)) {\n if ((0, _definition.isAbstractType)(_typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isPossibleType(_typeB, type);\n });\n }\n // Determine if the latter type is a possible concrete type of the former.\n return schema.isPossibleType(typeA, _typeB);\n }\n\n if ((0, _definition.isAbstractType)(_typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isPossibleType(_typeB, typeA);\n }\n\n // Otherwise the types do not overlap.\n return false;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // So flow is aware this is constant\n var _typeB = typeB;\n\n // Equivalent types overlap\n if (typeA === _typeB) {\n return true;\n }\n\n if ((0, _definition.isAbstractType)(typeA)) {\n if ((0, _definition.isAbstractType)(_typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isPossibleType(_typeB, type);\n });\n }\n // Determine if the latter type is a possible concrete type of the former.\n return schema.isPossibleType(typeA, _typeB);\n }\n\n if ((0, _definition.isAbstractType)(_typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isPossibleType(_typeB, typeA);\n }\n\n // Otherwise the types do not overlap.\n return false;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // So flow is aware this is constant\n var _typeB = typeB;\n\n // Equivalent types overlap\n if (typeA === _typeB) {\n return true;\n }\n\n if ((0, _definition.isAbstractType)(typeA)) {\n if ((0, _definition.isAbstractType)(_typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isPossibleType(_typeB, type);\n });\n }\n // Determine if the latter type is a possible concrete type of the former.\n return schema.isPossibleType(typeA, _typeB);\n }\n\n if ((0, _definition.isAbstractType)(_typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isPossibleType(_typeB, typeA);\n }\n\n // Otherwise the types do not overlap.\n return false;\n}", "async checkType(value) {\n\t\t\t//C check against each datatype\n\t\t\tfor (let i = 0; i < this.dataTypes.length; i++) {\n\t\t\t\tif (\n\t\t\t\t\t// Quick hack for replacing isType which checks against custom types like 'array' and 'integer'\n\t\t\t\t\ttypeof value === this.dataTypes[i] ||\n\t\t\t\t\t(this.dataTypes[i] === 'array' && Array.isArray(value)) ||\n\t\t\t\t\t(this.dataTypes[i] === 'integer' && Number.isInteger(value))\n\t\t\t\t) {\n\t\t\t\t\treturn new Success({\n\t\t\t\t\t\torigin: `${this.origin}.checkType()`,\n\t\t\t\t\t\tmessage: 'validated data type',\n\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t//C parse strings for numbers\n\t\t\t\tif (typeof value === 'string') {\n\t\t\t\t\tlet parsed = Number.parseFloat(value);\n\t\t\t\t\tif (this.dataTypes[i] === 'number' && !Number.isNaN(parsed) \n\t\t\t\t\t|| this.dataTypes[i] === 'integer' && Number.isInteger(parsed)) {\n\t\t\t\t\t\treturn new Success({\n\t\t\t\t\t\t\torigin: `${this.origin}.checkType()`,\n\t\t\t\t\t\t\tmessage: 'validated data type',\n\t\t\t\t\t\t\tcontent: parsed,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t//TODO parse strings for boolean & symbols & other?\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//C throw if no matches\n\t\t\tthrow new Err({\n\t\t\t\tlog: true,\n\t\t\t\torigin: `${this.origin}.checkType()`,\n\t\t\t\tmessage: `${this.valueName} must be a ${this.dataTypes.join(' or ')}`,\n\t\t\t\tcontent: value,\n\t\t\t});\n\t\t}", "function parseUnionMembers(lexer) {\n var members = [];\n do {\n members.push(parseNamedType(lexer));\n } while (skip(lexer, _lexer.TokenKind.PIPE));\n return members;\n}", "function parseUnionMembers(lexer) {\n var members = [];\n do {\n members.push(parseNamedType(lexer));\n } while (skip(lexer, _lexer.TokenKind.PIPE));\n return members;\n}", "function parseUnionTypeExtension(lexer) {\n\t var start = lexer.token;\n\t expectKeyword(lexer, 'extend');\n\t expectKeyword(lexer, 'union');\n\t var name = parseName(lexer);\n\t var directives = parseDirectives(lexer, true);\n\t var types = parseMemberTypesDefinition(lexer);\n\t if (directives.length === 0 && types.length === 0) {\n\t throw unexpected(lexer);\n\t }\n\t return {\n\t kind: _kinds.UNION_TYPE_EXTENSION,\n\t name: name,\n\t directives: directives,\n\t types: types,\n\t loc: loc(lexer, start)\n\t };\n\t}", "function parseUnionTypeExtension(lexer) {\n var start = lexer.token;\n expectKeyword(lexer, 'extend');\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n\n if (directives.length === 0 && types.length === 0) {\n throw unexpected(lexer);\n }\n\n return {\n kind: _kinds__WEBPACK_IMPORTED_MODULE_6__[\"Kind\"].UNION_TYPE_EXTENSION,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function UnionType() {\n // Copy arguments object as an array:\n this.types = [].slice.call(arguments).sort();\n }", "checkTypes(args, parameters) {\n for (let i = 0; i < args.length; i++) {\n if (args[i].type != parameters[i]) {\n return {\n valid: false,\n invalidType: args[i].type,\n expected: parameters[i]\n };\n }\n }\n return { valid: true };\n }", "function uutype(search, // @param Mix: search literal/object\r\n match) { // @param Number(= 0): match types\r\n // @return Boolean/Number: true is match,\r\n // false is unmatch,\r\n // Number is matched bits\r\n var rv = uutype._TYPEOF[typeof search] ||\r\n uutype._TYPEOF[Object.prototype.toString.call(search)] ||\r\n (!search ? uutype.NULL : search.nodeType ? uutype.NODE :\r\n \"length\" in search ? uutype.FAKEARRAY : uutype.HASH);\r\n\r\n return match ? !!(match & rv) : rv;\r\n} // [OPTIMIZED]", "monomorph(args) {\n return (false\n // TODO: Maybe use non primitive types first?\n || this.overloads.get(Typer.asConcreteTypes(args))\n || this.overloads.get(Typer.asTermTypes(args))\n || this.overloads.get(Typer.asGenericTerms(args)));\n }", "function parseUnionTypeExtension(lexer) {\n var start = lexer.token;\n expectKeyword(lexer, 'extend');\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n\n if (directives.length === 0 && types.length === 0) {\n throw unexpected(lexer);\n }\n\n return {\n kind: _kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].UNION_TYPE_EXTENSION,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeExtension(lexer) {\n var start = lexer.token;\n expectKeyword(lexer, 'extend');\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n\n if (directives.length === 0 && types.length === 0) {\n throw unexpected(lexer);\n }\n\n return {\n kind: _kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].UNION_TYPE_EXTENSION,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "function parseUnionTypeExtension(lexer) {\n var start = lexer.token;\n expectKeyword(lexer, 'extend');\n expectKeyword(lexer, 'union');\n var name = parseName(lexer);\n var directives = parseDirectives(lexer, true);\n var types = parseUnionMemberTypes(lexer);\n\n if (directives.length === 0 && types.length === 0) {\n throw unexpected(lexer);\n }\n\n return {\n kind: _kinds__WEBPACK_IMPORTED_MODULE_4__[\"Kind\"].UNION_TYPE_EXTENSION,\n name: name,\n directives: directives,\n types: types,\n loc: loc(lexer, start)\n };\n}", "parseUnionTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('union');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const types = this.parseUnionMemberTypes();\n\n if (directives.length === 0 && types.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.UNION_TYPE_EXTENSION,\n name,\n directives,\n types,\n });\n }", "function getUnionType(types, subtypeReduction, aliasSymbol, aliasTypeArguments) {\n if (types.length === 0) {\n return neverType;\n }\n if (types.length === 1) {\n return types[0];\n }\n var typeSet = [];\n addTypesToUnion(typeSet, types);\n if (typeSet.containsAny) {\n return anyType;\n }\n if (subtypeReduction) {\n removeSubtypes(typeSet);\n }\n if (typeSet.length === 0) {\n return typeSet.containsNull ? typeSet.containsNonWideningType ? nullType : nullWideningType :\n typeSet.containsUndefined ? typeSet.containsNonWideningType ? undefinedType : undefinedWideningType :\n neverType;\n }\n return getUnionTypeFromSortedList(typeSet, aliasSymbol, aliasTypeArguments);\n }", "static union(...types) {\n return async function typeFn(message, phrase) {\n for (let entry of types) {\n if (typeof entry === \"function\")\n entry = entry.bind(this);\n const res = await Argument.cast(entry, this.handler.resolver, message, phrase);\n if (!Argument.isFailure(res))\n return res;\n }\n return null;\n };\n }", "function checkSelectPropTypes(props) {\n checkControlledValueProps('select', props);\n for(var i = 0; i < valuePropNames.length; i++){\n var propName = valuePropNames[i];\n if (props[propName] == null) continue;\n var isArray = Array.isArray(props[propName]);\n if (props.multiple && !isArray) error(\"The `%s` prop supplied to <select> must be an array if `multiple` is true.%s\", propName, getDeclarationErrorAddendum());\n else if (!props.multiple && isArray) error(\"The `%s` prop supplied to <select> must be a scalar value if `multiple` is false.%s\", propName, getDeclarationErrorAddendum());\n }\n }", "function checkSelectPropTypes(inst, props) {\n\t\t var owner = inst._currentElement._owner;\n\t\t LinkedValueUtils.checkPropTypes('select', props, owner);\n\t\t\n\t\t for (var i = 0; i < valuePropNames.length; i++) {\n\t\t var propName = valuePropNames[i];\n\t\t if (props[propName] == null) {\n\t\t continue;\n\t\t }\n\t\t if (props.multiple) {\n\t\t process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;\n\t\t } else {\n\t\t process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;\n\t\t }\n\t\t }\n\t\t}", "function parseUnionMembers(lexer) {\n // Optional leading pipe\n skip(lexer, _lexer.TokenKind.PIPE);\n var members = [];\n do {\n members.push(parseNamedType(lexer));\n } while (skip(lexer, _lexer.TokenKind.PIPE));\n return members;\n}", "function parseUnionMembers(lexer) {\n // Optional leading pipe\n skip(lexer, _lexer.TokenKind.PIPE);\n var members = [];\n do {\n members.push(parseNamedType(lexer));\n } while (skip(lexer, _lexer.TokenKind.PIPE));\n return members;\n}", "function parseUnionMembers(lexer) {\n // Optional leading pipe\n skip(lexer, _lexer.TokenKind.PIPE);\n var members = [];\n do {\n members.push(parseNamedType(lexer));\n } while (skip(lexer, _lexer.TokenKind.PIPE));\n return members;\n}", "function parseUnionMembers(lexer) {\n // Optional leading pipe\n skip(lexer, _lexer.TokenKind.PIPE);\n var members = [];\n do {\n members.push(parseNamedType(lexer));\n } while (skip(lexer, _lexer.TokenKind.PIPE));\n return members;\n}", "function parseUnionMembers(parser) {\n var members = [];\n do {\n members.push(parseNamedType(parser));\n } while (skip(parser, _lexer.TokenKind.PIPE));\n return members;\n}", "function compareTypes(a, b) {\n var result = void 0;\n\n if (a === b) {\n return 0;\n }\n\n if (b instanceof TypeAlias || b instanceof TypeParameter || b instanceof TypeParameterApplication || b instanceof TypeTDZ) {\n b = b.unwrap();\n }\n\n if (a instanceof TypeAlias) {\n result = a.compareWith(b);\n } else if (a instanceof FlowIntoType || a instanceof TypeParameter || b instanceof FlowIntoType) {\n result = a.compareWith(b);\n } else if (a instanceof AnyType || a instanceof ExistentialType || a instanceof MixedType) {\n return 1;\n } else {\n result = a.compareWith(b);\n }\n\n if (b instanceof AnyType) {\n // Note: This check cannot be moved higher in the scope,\n // as this would prevent types from being propagated upwards.\n return 1;\n } else {\n return result;\n }\n}", "typeMatches(inspectedType) {\n if (this.exactTypeMatches(inspectedType)) {\n return true;\n }\n const baseTypes = inspectedType.getBaseTypes() || [];\n return baseTypes.some(base => this.exactTypeMatches(base));\n }", "function union(...typeSpec) {\n return new TUnion(typeSpec.map((t) => parseSpec(t)));\n}", "function checkType(type, value) {\n\t\t\t\tif (type) {\n\t\t\t\t\tif (typeof type == 'string' && type != 'any' && (type == 'null' ? value !== null : (typeof value === 'undefined' ? 'undefined' : _typeof(value)) != type) && !(value instanceof Array && type == 'array') && !(value instanceof Date && type == 'date') && !(type == 'integer' && value % 1 === 0)) {\n\t\t\t\t\t\treturn [{ property: path, message: (typeof value === 'undefined' ? 'undefined' : _typeof(value)) + \" value found, but a \" + type + \" is required\" }];\n\t\t\t\t\t}\n\t\t\t\t\tif (type instanceof Array) {\n\t\t\t\t\t\tvar unionErrors = [];\n\t\t\t\t\t\tfor (var j = 0; j < type.length; j++) {\n\t\t\t\t\t\t\t// a union type\n\t\t\t\t\t\t\tif (!(unionErrors = checkType(type[j], value)).length) {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (unionErrors.length) {\n\t\t\t\t\t\t\treturn unionErrors;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if ((typeof type === 'undefined' ? 'undefined' : _typeof(type)) == 'object') {\n\t\t\t\t\t\tvar priorErrors = errors;\n\t\t\t\t\t\terrors = [];\n\t\t\t\t\t\tcheckProp(value, type, path);\n\t\t\t\t\t\tvar theseErrors = errors;\n\t\t\t\t\t\terrors = priorErrors;\n\t\t\t\t\t\treturn theseErrors;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn [];\n\t\t\t}", "function getUnionSignatures(types, kind) {\n var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); });\n var result = undefined;\n for (var i = 0; i < signatureLists.length; i++) {\n for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) {\n var signature = _a[_i];\n // Only process signatures with parameter lists that aren't already in the result list\n if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true)) {\n var unionSignatures = findMatchingSignatures(signatureLists, signature, i);\n if (unionSignatures) {\n var s = signature;\n // Union the result types when more than one signature matches\n if (unionSignatures.length > 1) {\n s = cloneSignature(signature);\n if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) {\n var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return getTypeOfSymbol(sig.thisParameter) || anyType; }), /*subtypeReduction*/ true);\n s.thisParameter = createTransientSymbol(signature.thisParameter, thisType);\n }\n // Clear resolved return type we possibly got from cloneSignature\n s.resolvedReturnType = undefined;\n s.unionSignatures = unionSignatures;\n }\n (result || (result = [])).push(s);\n }\n }\n }\n }\n return result || emptyArray;\n }", "function parseUnionMembers(lexer) {\n\t var members = [];\n\t do {\n\t members.push(parseNamedType(lexer));\n\t } while (skip(lexer, _lexer.TokenKind.PIPE));\n\t return members;\n\t}" ]
[ "0.64827573", "0.62005866", "0.6098891", "0.5889174", "0.58012545", "0.57996345", "0.57996345", "0.5683944", "0.56431204", "0.56211275", "0.5612902", "0.55170196", "0.5504773", "0.5504773", "0.5487926", "0.5476923", "0.5476866", "0.5476866", "0.5476866", "0.5476866", "0.547354", "0.5471995", "0.5464543", "0.54504454", "0.54504454", "0.5449417", "0.5449417", "0.5444725", "0.54352665", "0.54352665", "0.54352665", "0.54352665", "0.54352665", "0.54352665", "0.5410499", "0.53808373", "0.5362327", "0.53420967", "0.53409743", "0.53213656", "0.5306932", "0.5298071", "0.52933997", "0.52931744", "0.52931744", "0.5272576", "0.526706", "0.526706", "0.526706", "0.526706", "0.526706", "0.5263363", "0.5254983", "0.52179044", "0.5206863", "0.5206491", "0.519496", "0.5192033", "0.5179163", "0.5178518", "0.5178518", "0.5159507", "0.5158564", "0.51506096", "0.514383", "0.5141257", "0.5119004", "0.5118443", "0.5118443", "0.50982654", "0.50982654", "0.50982654", "0.5092225", "0.50873935", "0.50873935", "0.50820726", "0.50805014", "0.5079924", "0.5074804", "0.50738126", "0.50677365", "0.50675005", "0.50675005", "0.5065006", "0.50470746", "0.5044465", "0.5039612", "0.50346893", "0.5029969", "0.50267905", "0.50267905", "0.50267905", "0.50267905", "0.502425", "0.5022322", "0.5021977", "0.5021803", "0.5013802", "0.50065184", "0.49959365" ]
0.70339906
0
Write a function isPalindrome(x) that returns true if x is a palindrome, otherwise false. Palindromes are words that are the same going forwards and backwards. Examples: i dod meeteem TrickirT
function isPalindrome(string){ return string === string.split('').reverse().join(''); //I DID IT BY MYSELF!! }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isPalindrome(x) {\n return x.toLowerCase() === x.toLowerCase().split('').slice().reverse().join('') ? true : false;\n}", "function isPalindrome(x) {\n let rev=x.toLowerCase().split('').reverse().join('');\n return x.toLowerCase()===rev? true:false;\n}", "function isPalindrome(x) {\r\n // your code here\r\n x = x.toLowerCase();\r\n x = x.replace(/\\W/g, \"\");\r\n return (\r\n x ===\r\n x\r\n .split(\"\")\r\n .reverse()\r\n .join(\"\")\r\n );\r\n}", "function isPalindrome(word) {\n const reverse = word\n .split(\"\")\n .reverse()\n .join(\"\");\n return word === reverse;\n}", "function isPalindrome (x) {\n\tvar reverse = '';\n\tvar reverseString = function (x) {\n\t\tfor (var i = x.length - 1; i >= 0; i--) {\n\t\t\treverse += x[i];\n\t\t}\n\t\treturn reverse;\n\t}\n\tif (reverseString(x) === reverse) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function checkForPalindrome(word) {\r\n if (word === reverseString(word)) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n}", "function isPalindrome(word) {\n if(word.length <= 1) return true;\n return Boolean(Number(\n word[0] == word[word.length-1]) * isPalindrome(word.slice(1, word.length-1)\n ))\n}", "function isPalindrome(str) {\n\n}", "function isPalindrome(x) {\n if(x < 0) return false;\n const str = x.toString();\n for(let i = 0; i < Math.floor(str.length / 2); i++) {\n if(str[i] !== str[str.length - 1 - i]) {\n return false\n }\n }\n return true\n}", "function isPalindrome(s) {\n var str = s.replace(/[^a-zA-Z0-9]/g, '').toLowerCase()\n var half = Math.floor(str.length / 2)\n var lastIndex = str.length - 1\n for (var i = 0; i < half; i++) {\n if (str[i] !== str[lastIndex - i]) {\n return false\n }\n }\n\n return true\n}", "function isPalindrome(s) {\n var pal = s.split('').reverse().join('');\n return s == pal;\n}", "function isPalindrome(x){\n let char = x.toString();\n let i = 0;\n let j = char.length - 1;\n while(i <= j){\n if(!(char[i++] === char[j--])){\n return false;\n }\n }\n return true;\n}", "function isPalindrome(str) {\n // const revString = str\n // .split(\"\") // turn a string into an array\n // .reverse() // reverse, duh\n // .join(\"\"); // method returns the array as a string.\n // return revString === str;\n}", "function isPalindrome(string) {\n\n function reverse() {\n return string.split('').reverse().join('')\n }\n\n return string === reverse();\n}", "function palindrome(str) {\n return true;\n}", "function isPalindrome(string) {\n var reversedString = string.split('').reverse().join('');\n return reversedString === string;\n}", "function palindrome(input) {\n let cleanedInput = input.split(\" \").join(\"\");\n let reversedCleanedInput = cleanedInput.split(\"\").reverse().join(\"\")\n if (cleanedInput == reversedCleanedInput) {\n return true\n } else {\n return false\n }\n}", "function isPalindrome(s) {\n\tvar str = s.replace(/\\W/g,\"\").toLowerCase();\n\treturn str == str.split(\"\").reverse().join(\"\")\n}", "function palindrome(string) {\n return string.toLowerCase() === reverse(string.toLowerCase());\n}", "function palindrome(string) {\n let processedContent = string.toLowerCase();\n return processedContent() === reverse(this.processedContent());\n}", "function isPalendrome(word) {\n // palendrom is same forward and backwards\n // take in word as is\n // create new word that is the reverse\n // compare and return\n let reverseWord = word.split(\"\").reverse().join(\"\");\n //console.log('Word', word)\n //console.log('Reverse', reverseWord);\n return reverseWord === word ? true : false;\n}", "function isPalindrome(str){\n var forwardStr = str.toLowerCase().replace(/ /g, '');\n var chars = forwardStr.split('');\n var length = chars.length;\n var reverseStr = '';\n for(var i = length-1; i >= 0; i--){\n if (chars[i] != ' '){\n reverseStr += chars[i];\n }\n }\n if(forwardStr === reverseStr){\n return true;\n }\n return false;\n}", "function palindrome(string) {\n let processedContent = string.toLowerCase();\n return processedContent === reverse(processedContent);\n}", "function isPalindrome(str) {\n return str.split('').reverse().join('') === str\n}", "function palindrome(str) {\r\n // Good luck!\r\n return true;\r\n}", "function isPalindrome(string) {\n let reverseString = string.split(\"\").reverse().join(\"\");\n return reverseString === string;\n}", "function isPalindrome(str){\n//base case\nif (str.length === 1) return true;\nif (str.length === 2) return str[0] === str[1] //boolean\n\nif (str[0] === str.slice(-1)) return isPalindrome(str.slice(1, -1)) //.slice(-1) is the end of the word \n\nreturn false \n\n}", "function isPalindrome (n) {\n n = n.toString()\n\n var parts = split(n)\n\n return parts[0] === reverse(parts[1])\n}", "function checkPalindrome(word) {\n let isPalindrome;\n let reverseWord = reverse(word);\n\n if(word === reverseWord) {\n isPalindrome = true;\n } else {\n isPalindrome = false;\n }\n\n return isPalindrome;\n}", "function isPalindrome(palindrome) {\n palindrome = uniformString(palindrome);\n\tfor ( var i=0; i <palindrome.length/2; i++) {\n\t\treturn (palindrome.charAt(i) === palindrome.charAt(palindrome.length-1));\n //Compares characters starting at both ends of the String\n\t}\n}", "function isPalindrome(s) {\n s = s.replace(/( |[^a-zA-Z0-9])/g, '').toLowerCase()\n var i = 0\n var j = s.length - 1\n\n while (i < j){\n if (s[i] === s[j]) {\n i++\n j--\n } else {\n return false\n }\n }\n\n return true\n}", "function palindrome(word) {\n var ln = word.length;\n for (var i = 0; i <= ln / 2;)\n if (word[i++] !== word[ln - i]) return false;\n return true\n}", "function isPalindrome(text){\n if (text === undefined){\n return;\n }\n /* Store original formatted string using regex to strip all symbols and whitespace */\n var originalString = text.toLowerCase().replace(/[^\\w]|_/g, \"\");\n\n /* Store formatted reversed string */\n var reversedString = text.toLowerCase().replace(/[^\\w]|_/g, \"\").split(\"\").reverse().join(\"\");\n\n /* If the two strings are equal to each other, it is a palindrome */\n if (originalString == reversedString){\n return 'is-palindrome';\n } else{\n return 'not-palindrome';\n }\n}", "function isPalindrome(str) {\n return (\n str ===\n str\n .split(\"\")\n .reverse()\n .join(\"\")\n );\n}", "function isPalindrome(str) {\n const revString = str.split('').reverse().join('');\n return str === revString;\n}", "function palindrome(str) {\n \n // pre-process\n str = str.toLowerCase();\n \n // find unwanted characters and replace\n const re = /[^a-z\\d]+/g;\n\tstr = str.replace(re, '');\n\t\n // for reversing a string\n function reverseString(txt) {\n return txt.split('').reverse().join('');\n\t}\n\n\t// A question of symmetry:\n // find length & middle, split and reverse one piece\n // then check for equality\n \n\t// even if odd length string, this will give us enough to\n\t// check two halves are palindromic\n\tconst half = Math.floor(str.length / 2);\n\t\n\tconst flipped = reverseString(str.substring(str.length - half));\n\t\n\treturn str.substring(0, half) === flipped;\n \n}", "function isPalindrome (inputStr) {\n\treturn inputStr.split('').reverse().join('') === inputStr ? true : false; \n}", "function palindromeCheck(str) {\n if (str.length === 1) { // if the length of a word is only 1 character, \n return false; // take it out because a palindrome cannot be created. \n }\n\n str = str.toLowerCase(); // make lower case to make sure algo accounts for all characters in string\n\n let reverseStr = ''; // instantiate blank palindrome holder; \n\n for (let i = str.length - 1; i >= 0; i--) { // loop through string backwards and see what comes out as a palindrome. \n reverseStr += str[i]; // count the number of times a palindrome was able to be found and with what words in string. \n }\n\n return reverseStr === str; // return all palindromes that are the same as the existing words in the string.\n}", "function palindrome(word){\n var long=word.length;\t\nfor(var i=0; i<word.length;i++)\t{\n\tif(word[i] !=word[long-1-i]){\n return false;\n\t}\n }\n return true;\n}", "function isPalindrome(str) {\n return str.split('').reverse().join('').toLocaleLowerCase() === str.toLocaleLowerCase();\n}", "function palindrome(word) {\n for (i=0; i<word.length/2; i++) {\n if (word.charAt(i) != word.charAt(word.length - i - 1)) {\n return false;\n }\n } return true;\n}", "function palindrome(string) {\n let lower = string.toLowerCase();\n return lower === reverse(lower);\n}", "function isPalindrome(str) {\n str = str.toLowerCase();\n // loop to replace spaces\n while (str.includes(' ')) str = str.replace(' ', '');\n for (var i = 0; i < Math.floor(str.length / 2); i++) {\n if (str.charAt(i) !== str.charAt(str.length - i - 1)) return false;\n }\n return true;\n}", "function palindromeChecker(text) {\n const reversedText = text.toLowerCase().split(\"\").reverse().join(\"\")\n return text === reversedText\n}", "function isPalindrome(name) {\n let word = name.split(\"\").reverse.().join(\"\");\n if (word === name) {\n return true:\n }\n else {\n return false;\n }\n}", "function isPalindrome(string) {\n let leftIdx = 0;\n let rightIdx = string.length - 1;\n while (leftIdx < rightIdx) {\n if (string[leftIdx] !== string[rightIdx]) return false;\n leftIdx++;\n rightIdx--\n }\n return true\n}", "function isPalindrome(str) {\n var re = /[^A-Za-z0-9]/g; //set up our regular expression that will do a global(g modifier) search for the character-span that is not from A-Z, a-z, and 0-9;\n var myString = str.toLowerCase().replace(re, \"\"); //set our string to lower case and remove anything that is not from A-Z, a-z, and 0-9 replace with an empty quotation mark(\"\");\n var reverseString = myString.split(\"\").reverse().join(\"\"); //split our string, reverses it and join back together for comparsion;\n return myString === reverseString; //check to see if our string is palindrome, returns true or false value;\n}", "function isPalindrome(str) {\n\n //str = str.toString().replace(/[^a-z0-9]/gi, '').toLowerCase()\n str = str.replace(/[^a-z0-9]/gi, '').toLowerCase()\n\n let x = 0\n let y = str.length - 1\n\n if (str[x] != str[y]) {\n return false\n }\n x += 1\n y -= 1\n\n return true\n}", "function isPalindrome2(string){\n string = string.toLowerCase(); //case insensitive\n var charactersArr = string.split('');\n var validCharacters = 'abcdefghijklmnopqrstuvwxyz'.split('');\n\n var lettersArr = [];\n charactersArr.forEach(function(char){ // for each character\n if (validCharacters.indexOf(char) > -1) lettersArr.push(char); //get rid of the character if it's not in the list of eligible chars\n });\n\n return lettersArr.join('') === lettersArr.reverse().join(''); // return result of comparing the word with the reverse version of it\n}", "function isPalindrome(str) {\r\n if(str === reverseString(str))\r\n return true;\r\n return false;\r\n}", "function isPalindrome(str) {\r\n if (str === reverseString(str)) {\r\n return true;\r\n }\r\n return false;\r\n}", "function isPalindrome(someStr) {\r\n \r\n thePalin = someStr.split('').reverse().join('');\r\n if (thePalin == someStr)\r\n return true;\r\n else\r\n return false;\r\n \r\n}", "function isPalindrome(str) {\n // NOTE Reverse the string\n const reversed = str\n .split(\"\")\n .reverse()\n .join(\"\");\n // NOTE Check if reversed string matches the original\n\n if (reversed === str) {\n return true;\n } else {\n return false;\n }\n // NOTE This returns the same.\n //return reversed === str;\n}", "function isPalindrome(inputthe_palindrome) {\n\n var reversedthe_palindrome = reversethe_palindrome(inputthe_palindrome);\n\n //this will perform the punctuation elimination on both the_palindromes\n\n return (reversedthe_palindrome == reversethe_palindrome(reversedthe_palindrome));\n\n}", "function isPalindrome(text) {\n if (!text) {\n return false;\n }\n\n text = text.replace(/[^\\w]/g, \"\"); //remove all characters except a-z\n text = text.toLowerCase();\n if (text.length === 0) {\n return false;\n }\n\n return text == text.split('').reverse().join('');\n}", "function palindrome(str) {\n // Compare if original string is equal with reversed string\n return str === reverse(str)\n}", "function isPalindrome1(string) {\n const compareString = \n string.split('')\n .reverse()\n .join('')\n if(string === compareString) return true;\n else return false\n}", "function isPalindrome(string) {\n const reversedChars = [];\n for (let i = string.length - 1; i >= 0; i--) {\n reversedChars.push(string[i])\n }\n return string === reversedChars.join(\"\");\n}", "function isPalindrome (string) {\n var halfString = Math.floor(string.length / 2);\n for (var i = 0; i < halfString; i++)\n if (string[i] !== string[string.length - i - 1])\n return false;\n return true;\n}", "function isPalindrome(str) {\n var toLower = str.toLowerCase();\n var noSpace = toLower.replace(\" \", \"\");\n var letterArray = noSpace.split(\"\");\n var reversed = letterArray.reverse();\n var final = reversed.join(\"\");\n\n return str.toLowerCase() === final;\n}", "function isPalindrome(str)\n{\n var reverse = reverseStr(str);\n if(str === reverse)\n {\n return true;\n }\n return false;\n\n}", "function palindrome(str){\r\n return reverseString(str) === str;\r\n}", "function isPalindrome(str){\n var noPuncStr = str.replace(/[\\.,-\\/#!$%\\^&\\*;:{}=\\-_`~()]/g,\"\");\n var newStr = noPuncStr.toLowerCase().replace(/ /g, '');\n var reverseStr = newStr.split('').reverse().join('');\n\n if (newStr === reverseStr){\n return true;\n } else {\n return false;\n }\n}", "function palindrome(str) {\n return str.toLowerCase().split('').reverse().join('') === str.toLowerCase();\n}", "function palindrome(string) {\n // reverse string\n const reversed = string\n .split(\"\")\n .reverse()\n .join(\"\");\n return string === reversed;\n}", "function isPalindrome(str) {\n const copy = str.split('').reverse().join('');\n return copy === str;\n}", "function isPalindrome(phrase){\r\n return true;\r\n}", "function isPalindrome(string) {\r\n left = 0\r\n right = string.length - 1\r\n while (left < right) {\r\n if (string[left] != string[right]) return false\r\n left++\r\n right--\r\n }\r\n return true\r\n}", "function isPalindrome_V2(str){\n if(str.split('').reverse().join('')==str){\n return true;\n }\n return false;\n \n}", "function isPalindrome(str) {\n str = str.replace(/\\W/g, '').toLowerCase();\n return (str == str.split('').reverse().join(''));\n}", "function palindrome(str) {\n if (str === str.split(\"\").reverse().join(\"\")) {\n return true;\n } else {\n return false;\n }\n}", "function isPalindrome(str) {\r\n return str === str.split('').reverse().join('');\r\n}", "function palindrome(str) {\n\t// Array.prototype.every -- is used to do a boolean check on every element within an array\n\t// arr.every((val) => val > 5);\n\t// If any function returns false, then the overall expression returns false as well\n\treturn str.split('').every((char,i) => {\n\t\treturn char === str[str.length -i -1]; // mirrored element\n\t});\n}", "function isPalindrome(inputData) {\n let initialWord = inputData.toLowerCase();\n let initialWordReversed = initialWord.toString().split('').reverse().join('');\n\n //compares initial word to the same word in reverse, definition of a palindrome\n return initialWord == initialWordReversed ? true : false;\n \n }", "function isPalindrome(str){\n const revString = str.split('').reverse().join(''); \n return revString === str; // will give true or false\n \n}", "function isPalindrome (str) {\n // 步驟一:將所有的單字轉成小寫,拆成陣列,並且排除非英文單字\n str = str.toLowerCase()\n\n charactersArr = str.split('').filter(character => {\n return /[a-z]/.test(character)\n })\n\n // 步驟二:如果正著寫和反轉過來寫的內容都一樣,則回傳 true,否則 false\n return charactersArr.join('') === charactersArr.reverse().join('')\n}", "function isPalindrome(str) {\n var re = /[^A-Za-z0-9]/g; //set up our regular expression that will do a global(g modifier) search for the character-span that is not from A-Z, a-z, and 0-9;\n str = str.toLowerCase().replace(re, \"\"); //set our string to lower case and remove anything that is not from A-Z, a-z, and 0-9 replace with an empty quotation mark(\"\");\n var strLength = str.length; //use .lenth to get the length of our string;\n for (var i= 0; i< strLength/2; i++ ){ //divide the string length in half for faster calculation against large string;\n if(str[i] !== str[strLength - 1 - i]){ //compare each letter, strLength-1 is because index is different than length, index starts from 0 while .length counts from 1; \n return false; //return false once the character don't match and exit the loop;\n }\n }\n return true;\n}", "function Palindrome(str) {\n return str.split(' ').join('') === str.split('').reverse().join('').replace(/ /g,''); \n}", "function checkIsPalindrome(inputString) {\n\n if (typeof inputString !== \"string\") {\n return \"no\";\n }\n\n // checking palindromes is kind of weird.\n // take the length of the string.\n // grab string [0] and string [n]; compare for sameness\n // iterate until floor(n/2), I guess\n // as long as the bit is true, it's a palindrome?\n\n let wordArr = inputString.split('');\n for (let i = 0; i < wordArr.length / 2; i++) {\n if (wordArr[i] !== wordArr[wordArr.length - i - 1]) {\n return \"no\";\n }\n }\n return \"yes\";\n\n}", "function palindrome(str) {\n const rev = str.split('').reverse().join('');\n return str === rev;\n}", "function isPalindrome(string) {\n let revIdx = string.length - 1\n let idx = 0\n\n while (idx < revIdx) {\n if (string[revIdx] !== string[idx]) {\n return false\n }\n idx += 1\n revIdx -= 1\n } \n return true\n }", "function isPalindrome(str) {\n return str == str.split('').reverse().join('');\n}", "function palindrome(string) {\n\n}", "function palindrome(word){\n \n}", "function palindrome(str) {\n const string = str.toLowerCase().replace(/[^0-9a-z]/gi, '').trim(),\n reversed = string.split('').reverse().join('');\n\n if (reversed === string) {\n return true;\n }\n\n return false;\n}", "function palindrome2(str) {\n str = str.match(/[A-Za-z0-9]/gi).join(\"\").toLowerCase();\n var polindromo = str.split('').reverse().join('');\n return polindromo === str;\n}", "function isPalindrome(x) {\n if (x < 0) {\n return false;\n }\n\n if (x === 0) {\n return true;\n }\n\n // edge case that leds to incorrect comparisons because of initial zero\n if (x % 10 === 0) {\n return false;\n }\n\n let reverseX = 0;\n while (x) {\n const digit = x % 10;\n reverseX = reverseX * 10 + digit;\n\n // check for not even digit numbers\n if (reverseX === x) {\n return true;\n }\n\n x = (x - digit) / 10;\n\n // check for even digit numbers\n if (reverseX === x) {\n return true;\n }\n\n if (reverseX > x) {\n return false;\n }\n }\n\n return false;\n}", "function palindrome(word){\r\n\t\t\t\tvar middle=Math.ceil(word.length/2), i;\r\n\r\n\t\t\t\tfor (i=0; i<=middle; ++i){\r\n\t\t\t\t\tif (word[i]!== word[(word.length-1)-i]){\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}", "function palindrome(string){\n var newWord='';\n for (var i=string.length-1; i>=0; i--){\n newWord+=string[i];\n \n }\n if (newWord===string){\n return string +' is a palindrome'\n \n } else{\n return string +' is not a palindrome'\n }\n \n }", "function palindrome(str) {}", "function Palindrome(str) {\n\n return str.replace(/[\\s]/g, \"\").toLowerCase() == str.replace(/[\\s]/g, \"\").toLowerCase().split(\"\").reverse().join(\"\");\n}", "function isPalindrome(string) {\n string = string.toLowerCase();\n var charactersArr = string.split(\"\");\n var validCharacters = \"abcdefghijklmnopqrstuvwxyz\".split(\"\");\n\n var lettersArr = [];\n charactersArr.forEach(char => {\n if (validCharacters.indexOf(char) > -1) lettersArr.push(char);\n });\n\n if (lettersArr.join(\"\") === lettersArr.reverse().join(\"\")) return true;\n else return false;\n}", "function checkPalindrome(str) {\n const sanitized = str.replace(/\\W/g, '')\n const reversed = sanitized\n .split('')\n .reverse()\n .join('')\n\n return sanitized === reversed\n}", "function validPalindrome(s) {\n // only have alphanumeric\n s = s.replace(/[^0-9a-zA-Z]+/gim, \"\")\n s = s.toLowerCase()\n\n // using two pointer\n // one starts at the beginning\n // one at end of s\n let l = 0\n let r = s.length - 1\n // while 0 < length - 1\n while (l <= r) {\n // if char doesn't match return false right away\n if (s[l] !== s[r]) {\n return false\n }\n // else increment the pointer\n l++\n r--\n }\n // once all string has been traversed return true\n return true\n}", "function isPalindrome(string){\n for (var i = 0; i < string.length / 2; i++){\n if (string[i] !== string[string.length - 1 -i]) {\n return false\n }\n }\n return true\n }", "function isRealPalindrome(string) {\n string = string.replace(/[^a-z0-9]/gi,\"\").toLowerCase();\n return isPalindrome(string);\n}", "function isPalindrome(str) {\n const len = str.length;\n\n for (let i = 0; i < len / 2; i++) {\n if (str[i] !== str[len - 1 - i]) {\n return false;\n }\n }\n\n return true;\n}", "function isPalindrome(str){\r\n // add whatever parameters you deem necessary - good luck!\r\n \r\n function reverse(str){\r\n //console.log(\"STR: \"+str);\r\n if(str === ''){ \r\n return '';\r\n }\r\n \r\n return str.charAt(str.length-1)+reverse(str.substr(0,str.length-1));\r\n }\r\n \r\n return str === reverse(str) ? true : false;\r\n \r\n }", "function isPalindromic(string) {\n var i;\n var stringMinusSpaces = '';\n for (i = 0; i < string.length; i++) {\n if (string[i] !== ' ') {\n stringMinusSpaces += string[i];\n }\n }\n var stringInReverse = '';\n for (i = stringMinusSpaces.length - 1; i >= 0; i = i - 1) {\n stringInReverse += stringMinusSpaces[i];\n }\n if (stringInReverse === stringMinusSpaces) {\n return true;\n } else {\n return false;\n }\n}", "function isPalindrome(string) {\n // Write your code here.\n\tconst reversedChars = [];\n\tfor (let i = string.length - 1; i >= 0; i--) {\n\t\treversedChars.push(string[i])\n\t}\n\treturn string === reversedChars.join('')\n}" ]
[ "0.8707449", "0.8652421", "0.851809", "0.8503428", "0.8499106", "0.83536744", "0.8281187", "0.82747406", "0.82653", "0.8261718", "0.8256508", "0.82184976", "0.82108533", "0.8184576", "0.8183864", "0.8180094", "0.8171553", "0.8139814", "0.8135522", "0.8132781", "0.81213015", "0.8116024", "0.81134725", "0.8108426", "0.8105918", "0.80986756", "0.8095648", "0.809404", "0.8092027", "0.8086341", "0.8084346", "0.806831", "0.80538887", "0.80448496", "0.8041258", "0.8032588", "0.8029899", "0.8022771", "0.80188566", "0.8018287", "0.801218", "0.8008381", "0.8005582", "0.7995451", "0.7989109", "0.79886234", "0.798501", "0.79814464", "0.7979353", "0.79789025", "0.7974757", "0.79724663", "0.7965012", "0.79625463", "0.7961532", "0.79603535", "0.79475206", "0.7939531", "0.79377943", "0.7935113", "0.79194236", "0.7919037", "0.79188055", "0.79185134", "0.7916949", "0.79134387", "0.79085547", "0.7906978", "0.7904889", "0.7903913", "0.7902498", "0.78977996", "0.7896677", "0.7896206", "0.7890053", "0.78838134", "0.78817856", "0.78749", "0.7867893", "0.7845686", "0.78445834", "0.78388983", "0.78336686", "0.7832631", "0.783209", "0.7831218", "0.7830688", "0.78303677", "0.7829271", "0.78278565", "0.7816919", "0.78143966", "0.78127825", "0.77980274", "0.7796883", "0.7793694", "0.77929175", "0.7792678", "0.7790826", "0.7788478" ]
0.7831775
85
We're using the apply function on test2 and giving it the argument of confusing, confusing is given the array of ['foo', 'bar']. 1. Create a simple constructor function called `Foo` and create a new instance from it called `foo`. DONE
function Foo(){ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function applyNew(args){\n\t\t// create an object with ctor's prototype but without\n\t\t// calling ctor on it.\n\t\tvar ctor = args.callee, t = forceNew(ctor);\n\t\t// execute the real constructor on the new object\n\t\tctor.apply(t, args);\n\t\treturn t;\n\t}", "function applyNew(args){\n\t\t// create an object with ctor's prototype but without\n\t\t// calling ctor on it.\n\t\tvar ctor = args.callee, t = forceNew(ctor);\n\t\t// execute the real constructor on the new object\n\t\tctor.apply(t, args);\n\t\treturn t;\n\t}", "function applyNew(args){\n\t\t// create an object with ctor's prototype but without\n\t\t// calling ctor on it.\n\t\tvar ctor = args.callee, t = forceNew(ctor);\n\t\t// execute the real constructor on the new object\n\t\tctor.apply(t, args);\n\t\treturn t;\n\t}", "function Item(fun,array){this.fun=fun;this.array=array}", "function xnew(thexPersonConstructor){\n\t//1. create a new object\n\tvar xobject ={}\n\t//2. Set the prototype\n\tObject.setPrototypeOf(xobject, thexPersonConstructor.prototype)\n\n\t//\"arguments\" key word returns the arguments you've added within a function\n\tconsole.log(arguments)//{ '0': [Function: Xperson], '1': 'I love dogs' }\n\n\t//This turns arguments into an array and gives you access to the slice prototype\n\tvar argsArray =Array.prototype.slice.apply(arguments)\n\tconsole.log(argsArray)//[ [Function: Xperson], 'I love dogs' ]\n\n\tconsole.log(argsArray.slice(1))//[ 'I love dogs' ]\n\t\n\t//3. execute constructor with \"this\" keyword (in this example the constructor is Xperson)\n\t//apply is similar to bind but it executs the function immediately\n\t//apply's first argument is the object you want to set as this (in this example it's xobj)\n\t//apply's second argument is an array of the arguments you want to use in the function\n\t//thexPersonConstructor.apply(xobject,['I love dogs'])\n\tthexPersonConstructor.apply(xobject, argsArray.slice(1))\n\t//4. return the created object\n\treturn xobject\n\n}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function Item(fun,array){this.fun=fun;this.array=array;}", "function new2() {\n const constructor = arguments[0];\n const args = [].slice.call(arguments, 1);\n const obj = new Object();\n obj.__proto__ = constructor.prototype;\n const ret = constructor.apply(obj, [...args]);\n if (ret && (typeof ret === 'object' || typeof ret === 'function')) {\n return ret;\n }\n return obj;\n}", "function fakeNew2(F, ...args) {\n let obj = null;\n try {\n obj = Object.create(F.prototype);\n } catch (_err) {\n obj = Object.create(Object.prototype, {\n constructor: {\n value: F,\n writable: true,\n enumerable: false,\n configurable: true\n }\n });\n }\n\n let returnValue = F(...args);\n if (returnValue && typeof returnValue === 'object') {\n return returnValue;\n }\n\n F.call(obj, ...args);\n return obj;\n}", "function Item(fun,array){this.fun = fun;this.array = array;}", "function arrayMethodFix(fn){ // 809\n return function(){ // 810\n return fn.apply($.ES5Object(this), arguments); // 811\n } // 812\n} // 813", "function newFoo(a1, a2) {\n /*\n this is dangerous\n do not use 'arguments' keyword!\n */\n console.log('arguments -> ', arguments)\n\n /*\n analogues\n */\n\n console.log(Array.from(arguments))\n}", "function s(e,t){this.fun=e,this.array=t}", "static create(...args /* :Array<*> */) {\n\t\treturn new this(...args)\n\t}", "construct (target, args) {\n return new target(...args)\n }", "function conform(args, apply){\n\tif (args.length === 2){\n\t\tif (typeof args[0] == \"string\"){\n\t\t\t// SIGNATURE (classic): string, function\n\t\t\treturn {should: args[0], func: args[1], self: {name: args[0]} };\n\t\t} else {\n\t\t\t// SIGNATURE: object, function\n\t\t\treturn {should: apply(args[0]), func: args[1], self: args[0]};\n\t\t}\n\t} else {\n\t\t// SIGNATURE: string, object, function\n\t\targs[1].name = args[0];\n\t\treturn {should: apply(args[1]), func: args[2], self: args[1]};\n\t}\n}", "function myNew(func, ...arg) {\n let obj = {};\n obj.__proto__ = func.prototype;\n let res = func.apply(obj, arg);\n return res instanceof Object? res: obj;\n}", "function fakeNew(F, ...args) {\n const obj = Object.create(F.prototype); // prototype inheritance\n F.call(obj, ...args); // mixin\n return obj; // prototype + mixin is how js emulate class-based paradigm\n}", "function mynew(fn,args){\n var obj =new Object()\n obj.__proto__ = fn.prototype\n var result = fn.apply(obj)\n return typeof result =='Object'?reslut:obj\n}", "function example2 () {\n function Animal(name) {\n this.name = name;\n this.speed = 0;\n }\n\n function Rabbit(name) {\n this.name = name;\n this.speed = 0;\n }\n\n //better\n function Rabbit (argument) {\n Animal.apply(this, arguments)\n }\n}", "function Item(fun, array) { // 59\n this.fun = fun; // 60\n this.array = array; // 61\n} // 62", "function test(arg0, arg1) {\n this.prop0 = arg0;\n}", "function applyToConstructor(constructor, argArray) {\n var args = [null].concat(argArray);\n var factoryFunction = constructor.bind.apply(constructor, args);\n return new factoryFunction();\n}", "function applyToConstructor(constructor, argArray) {\n var args = [null].concat(argArray);\n var factoryFunction = constructor.bind.apply(constructor, args);\n return new factoryFunction();\n}", "function applyToConstructor(constructor, argArray) {\n var args = [null].concat(argArray);\n var factoryFunction = constructor.bind.apply(constructor, args);\n return new factoryFunction();\n}", "function applyToConstructor(constructor, argArray) {\n var args = [null].concat(argArray);\n var factoryFunction = constructor.bind.apply(constructor, args);\n return new factoryFunction();\n}", "function applyToConstructor(constructor, argArray) {\n var args = [null].concat(argArray);\n var factoryFunction = constructor.bind.apply(constructor, args);\n return new factoryFunction();\n}", "function tempCtor() {}", "functionCall(array, filters) {\n test = this.testMethod(array, filters);\n console.log(test);\n }", "function createObjectFromArray(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};return a.reduce(function(a,c,d){return a[c]=b(c,d),a},c)}", "apply () {}", "function init() {\n objectTest();\n arrayTest();\n}", "function m(e,t){this.fun=e,this.array=t}", "function test() {\n Function().apply(1,Array(10000));\n print('still here');\n}", "function MyClass(...arr) {\n SuperClass.call(this, ...arr);\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n }", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n }", "function functionConstructorTest() {\n var f;\n\n /* Properties. */\n\n print('prototype' in Function, Function.prototype === Function.prototype);\n print('length' in Function, Function.length);\n\n /* Test Function() called both as a function and as a constructor. */\n\n f = Function('print(\"no args\");');\n f('foo', 'bar', 'quux');\n f = new Function('print(\"no args\");');\n f('foo', 'bar', 'quux');\n\n f = Function('x', 'print(\"one arg\", x);');\n f('foo', 'bar', 'quux');\n f = new Function('x', 'print(\"one arg\", x);');\n f('foo', 'bar', 'quux');\n\n f = Function('x', 'y', 'print(\"two args\", x, y);');\n f('foo', 'bar', 'quux');\n f = new Function('x', 'y', 'print(\"two args\", x, y);');\n f('foo', 'bar', 'quux');\n\n f = Function('a', 'b', 'c', 'd', 'e', 'f', 'g', 'print(\"seven args\", a, b, c, d, e, f, g);');\n f('foo', 'bar', 'quux');\n f = new Function('a', 'b', 'c', 'd', 'e', 'f', 'g', 'print(\"seven args\", a, b, c, d, e, f, g);');\n f('foo', 'bar', 'quux');\n\n /* Example from specification (E5.1, Section 15.3.2.1, NOTE at bottom). */\n\n f = new Function(\"a\", \"b\", \"c\", \"return a+b+c\");\n print(f('foo', 'bar', 'quux', 'baz'));\n f = new Function(\"a, b, c\", \"return a+b+c\");\n print(f('foo', 'bar', 'quux', 'baz'));\n f = new Function(\"a,b\", \"c\", \"return a+b+c\");\n print(f('foo', 'bar', 'quux', 'baz'));\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}", "function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}" ]
[ "0.52865493", "0.52865493", "0.52865493", "0.5154802", "0.5129642", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5093455", "0.5092894", "0.5082975", "0.50206167", "0.5006351", "0.49842173", "0.4978241", "0.49765006", "0.49459842", "0.49085352", "0.49043483", "0.48373324", "0.48369327", "0.4830344", "0.4815919", "0.48108324", "0.48091382", "0.48091382", "0.48091382", "0.48091382", "0.48091382", "0.4793261", "0.47929752", "0.47898692", "0.4782694", "0.4780106", "0.47769845", "0.47532496", "0.47410193", "0.4731592", "0.4731592", "0.473152", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705", "0.47124705" ]
0.0
-1