Best JavaScript code snippet using argos
htmlIndex.js
Source:htmlIndex.js
1const fs = require("fs");2const Constants = require("./htmlConstants.js");3let newRawDataIndex = Constants.rawData;4// newRawDataIndex.sort(function (a, b) {5// if (parseInt(a.num) < parseInt(b.num)) return -1;6// else if (parseInt(a.num) > parseInt(b.num)) return 1;7// return 0;8// });9const writeFile = (lang, langValues, page, defaultHead, metaTags, defaultNav, nav4, defaultFooter) => {10 let writeStream = fs.createWriteStream(lang + "/" + page + ".html");11 defaultHead.forEach((heads) => {12 writeStream.write(heads);13 });14 metaTags.forEach((tags) => {15 writeStream.write(tags);16 });17 defaultNav.forEach((navs) => {18 writeStream.write(navs);19 });20 writeStream.write("<h1 class='truncate'>" + langValues["homeHeader"] + "</h1>");21 nav4.forEach((navs) => {22 writeStream.write(navs);23 });24 function getElement(num, className) {25 let element = newRawDataIndex[num];26 return (27 "<td id='ele" +28 (num - -1) +29 "' class='eleTD'><a href='element-" +30 element.num +31 "' id='element" +32 element.num +33 "' class='elements " +34 className +35 "'><div class='eleNum'>" +36 element.num +37 "</div><div class='eleSym'>" +38 element.sym +39 "</div><div class='eleNm'>" +40 langValues[element.nme] +41 "</div><div class='eleWt'>" +42 element.aWt +43 "</div></a></td>"44 );45 }46 writeStream.write("<div id='headerwrap'>");47 writeStream.write("<table id='ptable' class='table square margin-bottom-20'>");48 writeStream.write("<tbody class='justify-start'>");49 writeStream.write("<tr class='text-center'>");50 writeStream.write(51 "<td id='groupPeriod'><span id='groupHeader'>" +52 langValues.group +53 " â</span> <br /><span id='periodHeader'>â " +54 langValues.period +55 "</span></td>"56 );57 writeStream.write("<td id='c1' class='groups unselectable c1'>1</td>");58 writeStream.write("<td id='c2' class='groups unselectable c2'>2</td>");59 writeStream.write("<td id='c3' class='groups unselectable c3'>3</td>");60 writeStream.write("<td id='c4' class='groups unselectable c4'>4</td>");61 writeStream.write("<td id='c5' class='groups unselectable c5'>5</td>");62 writeStream.write("<td id='c6' class='groups unselectable c6'>6</td>");63 writeStream.write("<td id='c7' class='groups unselectable c7'>7</td>");64 writeStream.write("<td id='c8' class='groups unselectable c8'>8</td>");65 writeStream.write("<td id='c9' class='groups unselectable c9'>9</td>");66 writeStream.write("<td id='c10' class='groups unselectable c10'>10</td>");67 writeStream.write("<td id='c11' class='groups unselectable c11'>11</td>");68 writeStream.write("<td id='c12' class='groups unselectable c12'>12</td>");69 writeStream.write("<td id='c13' class='groups unselectable c13'>13</td>");70 writeStream.write("<td id='c14' class='groups unselectable c14'>14</td>");71 writeStream.write("<td id='c15' class='groups unselectable c15'>15</td>");72 writeStream.write("<td id='c16' class='groups unselectable c16'>16</td>");73 writeStream.write("<td id='c17' class='groups unselectable c17'>17</td>");74 writeStream.write("<td id='c18' class='groups unselectable c18'>18</td>");75 writeStream.write("<td id='c19' class='groups unselectable' />");76 writeStream.write("</tr>");77 writeStream.write("<tr>");78 writeStream.write("<td id='r1' class='periods unselectable r1 text-center'>1</td>");79 writeStream.write(getElement(0, "otherNonmetals r1 c1"));80 writeStream.write("<td />");81 writeStream.write("<td id='snippetDetails' colspan='10' rowspan='3'>");82 writeStream.write("<div class='innerSnippet'>");83 writeStream.write("<div id='snippet' class='square'>");84 writeStream.write("<div id='snippetNum'></div>");85 writeStream.write("<div id='snippetSym' class='text-center'></div>");86 writeStream.write("<div id='snippetWt' class='text-right'></div>");87 writeStream.write("</div>");88 writeStream.write("<div id='details' class='square justify-start'>");89 writeStream.write("<div id='detailRow1' class='text-upper detailRow1' colspan='2'></div>");90 writeStream.write("<div id='detailRow2'>" + langValues.discovered + "</div>");91 writeStream.write("<div id='valueRow2'></div>");92 writeStream.write("<div id='detailRow3'>" + langValues.labelMeltingMain + "</div>");93 writeStream.write("<div id='valueRow3'></div>");94 writeStream.write("<div id='detailRow4'>" + langValues.labelBoilingMain + "</div>");95 writeStream.write("<div id='valueRow4'></div>");96 writeStream.write("<div id='detailRow5'>" + langValues.labelElectronsMain + "</div>");97 writeStream.write("<div id='valueRow5' class='ltrText justify-start'></div>");98 writeStream.write("<div id='detailRow6'>" + langValues.labelConfigMain + "</div>");99 writeStream.write("<div id='valueRow6' class='ltrText justify-start'></div>");100 writeStream.write("</div>");101 writeStream.write("</div>");102 writeStream.write("</td>");103 writeStream.write("<td colspan='5' />");104 writeStream.write(getElement(1, "nobleGases r1 c18"));105 // console.log(getElement(1, "nobleGases r1 c18"));106 // writeStream.write("<Element {langValue} name={langValues[Constants[1].nme]} num='1' className='nobleGases r1 c18' />");107 writeStream.write("</tr>");108 writeStream.write("<tr>");109 writeStream.write("<td id='r2' class='periods unselectable r2 text-center'>2</td>");110 writeStream.write(getElement(2, "alkaliMetals r2 c1"));111 writeStream.write(getElement(3, "alkalineEarthMetals r2 c2"));112 writeStream.write(getElement(4, "metalloids r2 c13"));113 writeStream.write(getElement(5, "otherNonmetals r2 c14"));114 writeStream.write(getElement(6, "otherNonmetals r2 c15"));115 writeStream.write(getElement(7, "otherNonmetals r2 c16"));116 writeStream.write(getElement(8, "halogens r2 c17"));117 writeStream.write(getElement(9, "nobleGases r2 c18"));118 writeStream.write("</tr>");119 writeStream.write("<tr>");120 writeStream.write("<td id='r3' class='periods unselectable r3 text-center'>3</td>");121 writeStream.write(getElement(10, "alkaliMetals r3 c1"));122 writeStream.write(getElement(11, "alkalineEarthMetals r3 c2"));123 writeStream.write(getElement(12, "postTransitionMetals r3 c13"));124 writeStream.write(getElement(13, "metalloids r3 c14"));125 writeStream.write(getElement(14, "otherNonmetals r3 c15"));126 writeStream.write(getElement(15, "otherNonmetals r3 c16"));127 writeStream.write(getElement(16, "halogens r3 c17"));128 writeStream.write(getElement(17, "nobleGases r3 c18"));129 writeStream.write("</tr>");130 writeStream.write("<tr>");131 writeStream.write("<td id='r4' class='periods unselectable r4 text-center'>4</td>");132 writeStream.write(getElement(18, "alkaliMetals r4 c1"));133 writeStream.write(getElement(19, "alkalineEarthMetals r4 c2"));134 writeStream.write(getElement(20, "transitionMetals r4 c3"));135 writeStream.write(getElement(21, "transitionMetals r4 c4"));136 writeStream.write(getElement(22, "transitionMetals r4 c5"));137 writeStream.write(getElement(23, "transitionMetals r4 c6"));138 writeStream.write(getElement(24, "transitionMetals r4 c7"));139 writeStream.write(getElement(25, "transitionMetals r4 c8"));140 writeStream.write(getElement(26, "transitionMetals r4 c9"));141 writeStream.write(getElement(27, "transitionMetals r4 c10"));142 writeStream.write(getElement(28, "transitionMetals r4 c11"));143 writeStream.write(getElement(29, "transitionMetals r4 c12"));144 writeStream.write(getElement(30, "postTransitionMetals r4 c13"));145 writeStream.write(getElement(31, "metalloids r4 c14"));146 writeStream.write(getElement(32, "metalloids r4 c15"));147 writeStream.write(getElement(33, "otherNonmetals r4 c16"));148 writeStream.write(getElement(34, "halogens r4 c17"));149 writeStream.write(getElement(35, "nobleGases r4 c18"));150 writeStream.write("</tr>");151 writeStream.write("<tr>");152 writeStream.write("<td id='r5' class='periods unselectable r5 text-center'>5</td>");153 writeStream.write(getElement(36, "alkaliMetals r5 c1"));154 writeStream.write(getElement(37, "alkalineEarthMetals r5 c2"));155 writeStream.write(getElement(38, "transitionMetals r5 c3"));156 writeStream.write(getElement(39, "transitionMetals r5 c4"));157 writeStream.write(getElement(40, "transitionMetals r5 c5"));158 writeStream.write(getElement(41, "transitionMetals r5 c6"));159 writeStream.write(getElement(42, "transitionMetals r5 c7"));160 writeStream.write(getElement(43, "transitionMetals r5 c8"));161 writeStream.write(getElement(44, "transitionMetals r5 c9"));162 writeStream.write(getElement(45, "transitionMetals r5 c10"));163 writeStream.write(getElement(46, "transitionMetals r5 c11"));164 writeStream.write(getElement(47, "transitionMetals r5 c12"));165 writeStream.write(getElement(48, "postTransitionMetals r5 c13"));166 writeStream.write(getElement(49, "postTransitionMetals r5 c14"));167 writeStream.write(getElement(50, "metalloids r5 c15"));168 writeStream.write(getElement(51, "metalloids r5 c16"));169 writeStream.write(getElement(52, "halogens r5 c17"));170 writeStream.write(getElement(53, "nobleGases r5 c18"));171 writeStream.write("</tr>");172 writeStream.write("<tr>");173 writeStream.write("<td id='r6' class='periods unselectable r6 text-center'>6</td>");174 writeStream.write(getElement(54, "alkaliMetals r6 c1"));175 writeStream.write(getElement(55, "alkalineEarthMetals r6 c2"));176 writeStream.write("<td id='star1' class='text-center'>*</td>");177 writeStream.write(getElement(71, "transitionMetals r6 c4"));178 writeStream.write(getElement(72, "transitionMetals r6 c5"));179 writeStream.write(getElement(73, "transitionMetals r6 c6"));180 writeStream.write(getElement(74, "transitionMetals r6 c7"));181 writeStream.write(getElement(75, "transitionMetals r6 c8"));182 writeStream.write(getElement(76, "transitionMetals r6 c9"));183 writeStream.write(getElement(77, "transitionMetals r6 c10"));184 writeStream.write(getElement(78, "transitionMetals r6 c11"));185 writeStream.write(getElement(79, "transitionMetals r6 c12"));186 writeStream.write(getElement(80, "postTransitionMetals r6 c13"));187 writeStream.write(getElement(81, "postTransitionMetals r6 c14"));188 writeStream.write(getElement(82, "postTransitionMetals r6 c15"));189 writeStream.write(getElement(83, "metalloids r6 c16"));190 writeStream.write(getElement(84, "halogens r6 c17"));191 writeStream.write(getElement(85, "nobleGases r6 c18"));192 writeStream.write("</tr>");193 writeStream.write("<tr>");194 writeStream.write("<td id='r7' class='periods unselectable r7 text-center'>7</td>");195 writeStream.write(getElement(86, "alkaliMetals r7 c1"));196 writeStream.write(getElement(87, "alkalineEarthMetals r7 c2"));197 writeStream.write("<td id='star2' class='text-center'>**</td>");198 writeStream.write(getElement(103, "transitionMetals r7 c4"));199 writeStream.write(getElement(104, "transitionMetals r7 c5"));200 writeStream.write(getElement(105, "transitionMetals r7 c6"));201 writeStream.write(getElement(106, "transitionMetals r7 c7"));202 writeStream.write(getElement(107, "transitionMetals r7 c8"));203 writeStream.write(getElement(108, "transitionMetals r7 c9"));204 writeStream.write(getElement(109, "transitionMetals r7 c10"));205 writeStream.write(getElement(110, "transitionMetals r7 c11"));206 writeStream.write(getElement(111, "transitionMetals r7 c12"));207 writeStream.write(getElement(112, "postTransitionMetals r7 c13"));208 writeStream.write(getElement(113, "postTransitionMetals r7 c14"));209 writeStream.write(getElement(114, "postTransitionMetals r7 c15"));210 writeStream.write(getElement(115, "postTransitionMetals r7 c16"));211 writeStream.write(getElement(116, "halogens r7 c17"));212 writeStream.write(getElement(117, "nobleGases r7 c18"));213 writeStream.write("</tr>");214 writeStream.write("<tr>");215 writeStream.write("<td class='gap' />");216 writeStream.write("</tr>");217 writeStream.write("<tr>");218 writeStream.write("<td />");219 writeStream.write("<td colspan='2' id='lanthanidesMain' class='justify-start'>* " + langValues.lanthanides + "</td>");220 writeStream.write(getElement(56, "lanthanides r6"));221 writeStream.write(getElement(57, "lanthanides r6"));222 writeStream.write(getElement(58, "lanthanides r6"));223 writeStream.write(getElement(59, "lanthanides r6"));224 writeStream.write(getElement(60, "lanthanides r6"));225 writeStream.write(getElement(61, "lanthanides r6"));226 writeStream.write(getElement(62, "lanthanides r6"));227 writeStream.write(getElement(63, "lanthanides r6"));228 writeStream.write(getElement(64, "lanthanides r6"));229 writeStream.write(getElement(65, "lanthanides r6"));230 writeStream.write(getElement(66, "lanthanides r6"));231 writeStream.write(getElement(67, "lanthanides r6"));232 writeStream.write(getElement(68, "lanthanides r6"));233 writeStream.write(getElement(69, "lanthanides r6"));234 writeStream.write(getElement(70, "lanthanides r6"));235 writeStream.write("</tr>");236 writeStream.write("<tr>");237 writeStream.write("<td />");238 writeStream.write("<td colspan='2' id='actinidesMain' class='justify-start'>** " + langValues.actinides + "</td>");239 writeStream.write(getElement(88, "actinides r7"));240 writeStream.write(getElement(89, "actinides r7"));241 writeStream.write(getElement(90, "actinides r7"));242 writeStream.write(getElement(91, "actinides r7"));243 writeStream.write(getElement(92, "actinides r7"));244 writeStream.write(getElement(93, "actinides r7"));245 writeStream.write(getElement(94, "actinides r7"));246 writeStream.write(getElement(95, "actinides r7"));247 writeStream.write(getElement(96, "actinides r7"));248 writeStream.write(getElement(97, "actinides r7"));249 writeStream.write(getElement(98, "actinides r7"));250 writeStream.write(getElement(99, "actinides r7"));251 writeStream.write(getElement(100, "actinides r7"));252 writeStream.write(getElement(101, "actinides r7"));253 writeStream.write(getElement(102, "actinides r7"));254 writeStream.write("</tr>");255 writeStream.write("<tr>");256 writeStream.write("<td class='gap' />");257 writeStream.write("</tr>");258 writeStream.write("<tr>");259 writeStream.write("<td />");260 writeStream.write("<td colspan='18'>");261 writeStream.write("<div class='flex text-center margin-bottom-20 width-100'>");262 writeStream.write("<div id='alkaliMetals' class='flex-auto category alkaliMetals unselectable'>" + langValues.cat1 + "</div>");263 writeStream.write("<div id='alkalineEarthMetals' class='flex-auto category alkalineEarthMetals unselectable'>" + langValues.cat2 + "</div>");264 writeStream.write("<div id='transitionMetals' class='flex-auto category transitionMetals unselectable'>" + langValues.cat3 + "</div>");265 writeStream.write("<div id='postTransitionMetals' class='flex-auto category postTransitionMetals unselectable'>" + langValues.cat4 + "</div>");266 writeStream.write("<div id='otherNonmetals' class='flex-auto category otherNonmetals unselectable'>" + langValues.cat5 + "</div>");267 writeStream.write("<div id='metalloids' class='flex-auto category metalloids unselectable'>" + langValues.cat6 + "</div>");268 writeStream.write("<div id='halogens' class='flex-auto category halogens unselectable'>" + langValues.cat7 + "</div>");269 writeStream.write("<div id='nobleGases' class='flex-auto category nobleGases unselectable'>" + langValues.cat8 + "</div>");270 writeStream.write("<div id='lanthanides' class='flex-auto category lanthanides unselectable'>" + langValues.lanthanides + "</div>");271 writeStream.write("<div id='actinides' class='flex-auto category actinides unselectable'>" + langValues.actinides + "</div>");272 writeStream.write("</div>");273 writeStream.write("</td>");274 writeStream.write("</tr>");275 writeStream.write("<tr />");276 writeStream.write("</tbody>");277 writeStream.write("</table>");278 writeStream.write("</div>");279 defaultFooter.forEach((footers) => {280 writeStream.write(footers);281 });282 writeStream.write("<script>");283 writeStream.write("let bc= '" + langValues["BC"] + "';");284 writeStream.write("</script>");285 // the finish event is emitted when all data has been flushed from the stream286 writeStream.on("finish", () => {287 console.log("Created " + lang + "-" + page);288 });289 // close the stream290 writeStream.end();291};...
htmlReactivity.js
Source:htmlReactivity.js
1const fs = require("fs");2const writeFile = (lang, langValues, page, defaultHead, metaTags, defaultNav, nav4, defaultFooter) => {3 let writeStream = fs.createWriteStream(lang + "/" + page + ".html");4 defaultHead.forEach((heads) => {5 writeStream.write(heads);6 });7 metaTags.forEach((tags) => {8 writeStream.write(tags);9 });10 defaultNav.forEach((navs) => {11 writeStream.write(navs);12 });13 writeStream.write("<h1 class='truncate'>" + langValues.reactivitySeries + "</h1>");14 nav4.forEach((navs) => {15 writeStream.write(navs);16 });17 writeStream.write("<section class='content-wrapper'>");18 writeStream.write("<div class='container'>");19 writeStream.write("<h1 class='py-8 text-upper text-center grayText'>");20 writeStream.write(langValues.reactivitySeries + "</h1>");21 writeStream.write("<div id='solubilityHeader' class='row text-upper aboutHeader text-center heavyFont'></div>");22 writeStream.write("<div>");23 writeStream.write("<div class='grid-container'>");24 writeStream.write("<div class='reactivity-grid'>");25 writeStream.write("<div class='grid-col grid-col--fixed-left'>");26 writeStream.write("<div id='gridTopLeft' class='grid-item grid-item--header'><p></p></div>");27 writeStream.write("<div class='grid-item'>" + langValues.caesium + "</div>");28 writeStream.write("<div class='grid-item'>" + langValues.francium + "</div>");29 writeStream.write("<div class='grid-item'>" + langValues.rubidium + "</div>");30 writeStream.write("<div class='grid-item'>" + langValues.potassium + "</div>");31 writeStream.write("<div class='grid-item'>" + langValues.sodium + "</div>");32 writeStream.write("<div class='grid-item'>" + langValues.lithium + "</div>");33 writeStream.write("<div class='grid-item'>" + langValues.barium + "</div>");34 writeStream.write("<div class='grid-item'>" + langValues.radium + "</div>");35 writeStream.write("<div class='grid-item'>" + langValues.strontium + "</div>");36 writeStream.write("<div class='grid-item'>" + langValues.calcium + "</div>");37 writeStream.write("<div class='grid-item'>" + langValues.magnesium + "</div>");38 writeStream.write("<div class='grid-item'>" + langValues.aluminium + "</div>");39 writeStream.write("<div class='grid-item'>" + langValues.titanium + "</div>");40 writeStream.write("<div class='grid-item'>" + langValues.manganese + "</div>");41 writeStream.write("<div class='grid-item'>" + langValues.zinc + "</div>");42 writeStream.write("<div class='grid-item'>" + langValues.chromium + "</div>");43 writeStream.write("<div class='grid-item'>" + langValues.iron + "</div>");44 writeStream.write("<div class='grid-item'>" + langValues.cadmium + "</div>");45 writeStream.write("<div class='grid-item'>" + langValues.cobalt + "</div>");46 writeStream.write("<div class='grid-item'>" + langValues.nickel + "</div>");47 writeStream.write("<div class='grid-item'>" + langValues.tin + "</div>");48 writeStream.write("<div class='grid-item'>" + langValues.lead + "</div>");49 writeStream.write("<div class='grid-item'>" + langValues.hydrogen + "</div>");50 writeStream.write("<div class='grid-item'>" + langValues.antimony + "</div>");51 writeStream.write("<div class='grid-item'>" + langValues.bismuth + "</div>");52 writeStream.write("<div class='grid-item'>" + langValues.copper + "</div>");53 writeStream.write("<div class='grid-item'>" + langValues.tungsten + "</div>");54 writeStream.write("<div class='grid-item'>" + langValues.mercury + "</div>");55 writeStream.write("<div class='grid-item'>" + langValues.silver + "</div>");56 writeStream.write("<div class='grid-item'>" + langValues.gold + "</div>");57 writeStream.write("<div class='grid-item'>" + langValues.platinum + "</div>");58 writeStream.write("</div>");59 writeStream.write("<div class='grid-col'>");60 writeStream.write("<div class='grid-item grid-item--header'>" + langValues.coldWater + "</div>");61 writeStream.write("<div class='grid-item violentReaction'>" + langValues.violentReaction + "</div>");62 writeStream.write("<div class='grid-item violentReaction'>" + langValues.violentReaction + "</div>");63 writeStream.write("<div class='grid-item violentReaction'>" + langValues.violentReaction + "</div>");64 writeStream.write("<div class='grid-item violentReaction'>" + langValues.violentReaction + "</div>");65 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");66 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");67 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");68 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");69 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");70 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");71 writeStream.write("<div class='grid-item verySlowReaction'>" + langValues.verySlowReaction + "</div>");72 writeStream.write("<div class='grid-item'></div>");73 writeStream.write("<div class='grid-item'></div>");74 writeStream.write("<div class='grid-item'></div>");75 writeStream.write("<div class='grid-item'></div>");76 writeStream.write("<div class='grid-item'></div>");77 writeStream.write("<div class='grid-item'></div>");78 writeStream.write("<div class='grid-item'></div>");79 writeStream.write("<div class='grid-item'></div>");80 writeStream.write("<div class='grid-item'></div>");81 writeStream.write("<div class='grid-item'></div>");82 writeStream.write("<div class='grid-item'></div>");83 writeStream.write("<div class='grid-item nonMetal'>" + langValues.nonMetal + "</div>");84 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");85 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");86 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");87 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");88 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");89 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");90 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");91 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");92 writeStream.write("</div>");93 writeStream.write("<div class='grid-col'>");94 writeStream.write("<div class='grid-item grid-item--header'>" + langValues.hotWater + "</div>");95 writeStream.write("<div class='grid-item'></div>");96 writeStream.write("<div class='grid-item'></div>");97 writeStream.write("<div class='grid-item'></div>");98 writeStream.write("<div class='grid-item'></div>");99 writeStream.write("<div class='grid-item strongReaction'>" + langValues.strongReaction + "</div>");100 writeStream.write("<div class='grid-item strongReaction'>" + langValues.strongReaction + "</div>");101 writeStream.write("<div class='grid-item strongReaction'>" + langValues.strongReaction + "</div>");102 writeStream.write("<div class='grid-item strongReaction'>" + langValues.strongReaction + "</div>");103 writeStream.write("<div class='grid-item strongReaction'>" + langValues.strongReaction + "</div>");104 writeStream.write("<div class='grid-item strongReaction'>" + langValues.strongReaction + "</div>");105 writeStream.write("<div class='grid-item strongReaction'>" + langValues.strongReaction + "</div>");106 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");107 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");108 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");109 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");110 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");111 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");112 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");113 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");114 writeStream.write("<div class='grid-item'></div>");115 writeStream.write("<div class='grid-item'></div>");116 writeStream.write("<div class='grid-item'></div>");117 writeStream.write("<div class='grid-item nonMetal'>" + langValues.forComparison + "</div>");118 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");119 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");120 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");121 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");122 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");123 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");124 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");125 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");126 writeStream.write("</div>");127 writeStream.write("<div class='grid-col'>");128 writeStream.write("<div class='grid-item grid-item--header'>" + langValues.diluteAcids + "</div>");129 writeStream.write("<div class='grid-item'></div>");130 writeStream.write("<div class='grid-item'></div>");131 writeStream.write("<div class='grid-item'></div>");132 writeStream.write("<div class='grid-item'></div>");133 writeStream.write("<div class='grid-item'></div>");134 writeStream.write("<div class='grid-item'></div>");135 writeStream.write("<div class='grid-item'></div>");136 writeStream.write("<div class='grid-item'></div>");137 writeStream.write("<div class='grid-item'></div>");138 writeStream.write("<div class='grid-item'></div>");139 writeStream.write("<div class='grid-item'></div>");140 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");141 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");142 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");143 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");144 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");145 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");146 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");147 writeStream.write("<div class='grid-item moderateReaction'>" + langValues.moderateReaction + "</div>");148 writeStream.write("<div class='grid-item slowReaction'>" + langValues.slowReaction + "</div>");149 writeStream.write("<div class='grid-item slowReaction'>" + langValues.slowReaction + "</div>");150 writeStream.write("<div class='grid-item slowReaction'>" + langValues.slowReaction + "</div>");151 writeStream.write("<div class='grid-item'></div>");152 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");153 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");154 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");155 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");156 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");157 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");158 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");159 writeStream.write("<div class='grid-item noReaction'>" + langValues.noReaction + "</div>");160 writeStream.write("</div>");161 writeStream.write("</div>");162 writeStream.write("</div>");163 writeStream.write("</div>");164 writeStream.write("</div>");165 writeStream.write("</section>");166 defaultFooter.forEach((footers) => {167 writeStream.write(footers);168 });169 // the finish event is emitted when all data has been flushed from the stream170 writeStream.on("finish", () => {171 console.log("Created " + lang + "-" + page);172 });173 // close the stream174 writeStream.end();175};...
htmlManifest.js
Source:htmlManifest.js
1const fs = require("fs");2const writeFile = (lang, langValues, page) => {3 let writeStream = fs.createWriteStream(lang + "/manifest.json");4 writeStream.write("{\n");5 writeStream.write(' "short_name": "' + langValues.homeHeader + '",\n');6 writeStream.write(' "name": "' + langValues.homeHeader + '",\n');7 writeStream.write(' "background_color": "#0078d7",\n');8 writeStream.write(' "theme_color": "#0078d7",\n');9 writeStream.write(' "display": "standalone",\n');10 writeStream.write(' "dir": "' + (lang === "ar" || lang === "fa" || lang === "he" ? "rtl" : "ltr") + '",\n');11 writeStream.write(' "lang": "' + lang + '",\n');12 writeStream.write(' "iarc_rating_id": "e84b072d-71b3-4d3e-86ae-31a8ce4e53b7",\n');13 writeStream.write(' "orientation": "any",\n');14 writeStream.write(' "categories": ["education", "books"],\n');15 writeStream.write(' "description": "' + langValues.line1 + " " + langValues.line2 + '",\n');16 writeStream.write(' "shortcuts": [\n');17 writeStream.write(" {\n");18 writeStream.write(' "name": "' + langValues.list + '",\n');19 writeStream.write(' "short_name": "' + langValues.list + '",\n');20 writeStream.write(' "description": "' + langValues.feature4 + '",\n');21 writeStream.write(' "url": "/list",\n');22 writeStream.write(' "icons": [{ "src": "/images/icons/list.png", "sizes": "192x192" }]\n');23 writeStream.write(" },\n");24 writeStream.write(" {\n");25 writeStream.write(' "name": "' + langValues.compare + '",\n');26 writeStream.write(' "short_name": "' + langValues.compare + '",\n');27 writeStream.write(' "description": "' + langValues.feature6 + '",\n');28 writeStream.write(' "url": "/compare",\n');29 writeStream.write(' "icons": [{ "src": "/images/icons/compare.png", "sizes": "192x192" }]\n');30 writeStream.write(" },\n");31 writeStream.write(" {\n");32 writeStream.write(' "name": "' + langValues.printables + '",\n');33 writeStream.write(' "short_name": "' + langValues.printables + '",\n');34 writeStream.write(' "description": "' + langValues.printables + '",\n');35 writeStream.write(' "url": "/printables",\n');36 writeStream.write(' "icons": [{ "src": "/images/icons/printables.png", "sizes": "192x192" }]\n');37 writeStream.write(" }\n");38 writeStream.write(" ],\n");39 writeStream.write(' "icons": [\n');40 writeStream.write(" {\n");41 writeStream.write(' "src": "/images/icons/android-chrome-36x36.png",\n');42 writeStream.write(' "sizes": "36x36",\n');43 writeStream.write(' "type": "image/png",\n');44 writeStream.write(' "purpose": "any"\n');45 writeStream.write(" },\n");46 writeStream.write(" {\n");47 writeStream.write(' "src": "/images/icons/android-chrome-48x48.png",\n');48 writeStream.write(' "sizes": "48x48",\n');49 writeStream.write(' "type": "image/png",\n');50 writeStream.write(' "purpose": "any"\n');51 writeStream.write(" },\n");52 writeStream.write(" {\n");53 writeStream.write(' "src": "/images/icons/android-chrome-72x72.png",\n');54 writeStream.write(' "sizes": "72x72",\n');55 writeStream.write(' "type": "image/png",\n');56 writeStream.write(' "purpose": "any"\n');57 writeStream.write(" },\n");58 writeStream.write(" {\n");59 writeStream.write(' "src": "/images/icons/android-chrome-96x96.png",\n');60 writeStream.write(' "sizes": "96x96",\n');61 writeStream.write(' "type": "image/png",\n');62 writeStream.write(' "purpose": "any"\n');63 writeStream.write(" },\n");64 writeStream.write(" {\n");65 writeStream.write(' "src": "/images/icons/android-chrome-144x144.png",\n');66 writeStream.write(' "sizes": "144x144",\n');67 writeStream.write(' "type": "image/png",\n');68 writeStream.write(' "purpose": "any"\n');69 writeStream.write(" },\n");70 writeStream.write(" {\n");71 writeStream.write(' "src": "/images/icons/apple-touch-icon-152x152.png",\n');72 writeStream.write(' "sizes": "152x152",\n');73 writeStream.write(' "type": "image/png",\n');74 writeStream.write(' "purpose": "any"\n');75 writeStream.write(" },\n");76 writeStream.write(" {\n");77 writeStream.write(' "src": "/images/icons/android-chrome-192x192.png",\n');78 writeStream.write(' "sizes": "192x192",\n');79 writeStream.write(' "type": "image/png",\n');80 writeStream.write(' "purpose": "any"\n');81 writeStream.write(" },\n");82 writeStream.write(" {\n");83 writeStream.write(' "src": "/images/icons/android-chrome-256x256.png",\n');84 writeStream.write(' "sizes": "256x256",\n');85 writeStream.write(' "type": "image/png",\n');86 writeStream.write(' "purpose": "any"\n');87 writeStream.write(" },\n");88 writeStream.write(" {\n");89 writeStream.write(' "src": "/images/icons/android-chrome-384x384.png",\n');90 writeStream.write(' "sizes": "384x384",\n');91 writeStream.write(' "type": "image/png",\n');92 writeStream.write(' "purpose": "any"\n');93 writeStream.write(" },\n");94 writeStream.write(" {\n");95 writeStream.write(' "src": "/images/icons/android-chrome-512x512.png",\n');96 writeStream.write(' "sizes": "512x512",\n');97 writeStream.write(' "type": "image/png",\n');98 writeStream.write(' "purpose": "any"\n');99 writeStream.write(" },\n");100 writeStream.write(" {\n");101 writeStream.write(' "src": "/images/icons/maskable_icon_x512.png",\n');102 writeStream.write(' "sizes": "512x512",\n');103 writeStream.write(' "type": "image/png",\n');104 writeStream.write(' "purpose": "maskable"\n');105 writeStream.write(" }\n");106 writeStream.write(" ],\n");107 writeStream.write(' "screenshots": [\n');108 writeStream.write(" {\n");109 writeStream.write(' "src": "/screenshots/Phone-1.png",\n');110 writeStream.write(' "sizes": "1200x2400",\n');111 writeStream.write(' "type": "image/png"\n');112 writeStream.write(" },\n");113 writeStream.write(" {\n");114 writeStream.write(' "src": "/screenshots/Phone-2.png",\n');115 writeStream.write(' "sizes": "1200x2400",\n');116 writeStream.write(' "type": "image/png"\n');117 writeStream.write(" },\n");118 writeStream.write(" {\n");119 writeStream.write(' "src": "/screenshots/Phone-3.png",\n');120 writeStream.write(' "sizes": "1200x2400",\n');121 writeStream.write(' "type": "image/png"\n');122 writeStream.write(" },\n");123 writeStream.write(" {\n");124 writeStream.write(' "src": "/screenshots/Phone-4.png",\n');125 writeStream.write(' "sizes": "1200x2400",\n');126 writeStream.write(' "type": "image/png"\n');127 writeStream.write(" },\n");128 writeStream.write(" {\n");129 writeStream.write(' "src": "/screenshots/Phone-5.png",\n');130 writeStream.write(' "sizes": "1200x2400",\n');131 writeStream.write(' "type": "image/png"\n');132 writeStream.write(" },\n");133 writeStream.write(" {\n");134 writeStream.write(' "src": "/screenshots/Phone-6.png",\n');135 writeStream.write(' "sizes": "1200x2400",\n');136 writeStream.write(' "type": "image/png"\n');137 writeStream.write(" },\n");138 writeStream.write(" {\n");139 writeStream.write(' "src": "/screenshots/Phone-7.png",\n');140 writeStream.write(' "sizes": "1200x2400",\n');141 writeStream.write(' "type": "image/png"\n');142 writeStream.write(" },\n");143 writeStream.write(" {\n");144 writeStream.write(' "src": "/screenshots/Phone-8.png",\n');145 writeStream.write(' "sizes": "1200x2400",\n');146 writeStream.write(' "type": "image/png"\n');147 writeStream.write(" }\n");148 writeStream.write(" ],\n");149 writeStream.write(' "start_url": "index.html"\n');150 writeStream.write("}\n");151 // the finish event is emitted when all data has been flushed from the stream152 writeStream.on("finish", () => {153 console.log("Created " + lang + "-" + page);154 });155 // close the stream156 writeStream.end();157};...
Using AI Code Generation
1var argosy = require('argosy')2var through = require('through2')3var fs = require('fs')4var service = argosy()5service.pipe(through.obj(function (msg, enc, cb) {6 console.log('got message', msg)7 cb()8})).pipe(service)9var writeStream = service.writeStream('writeStream')10writeStream.write('hello world')11writeStream.write('he
Using AI Code Generation
1var argosy = require('argosy')2var writeStream = require('argosy-pattern-write-stream')3var through = require('through2')4var pump = require('pump')5var writeStreamPattern = writeStream({6 write: function (chunk, encoding, callback) {7 console.log(chunk)8 callback()9 }10})11var service = argosy()12service.accept(writeStreamPattern)13service.listen(8000)14var argosy = require('argosy')15var writeStream = require('argosy-pattern-write-stream')16var through = require('through2')17var pump = require('pump')18var writeStreamPattern = writeStream({19})20var service = argosy()21service.accept(writeStreamPattern)22service.listen(8000)23var argosy = require('argosy')24var writeStream = require('argosy-pattern-write-stream')25var through = require('through2')26var pump = require('pump')27var writeStreamPattern = writeStream({28 write: function (chunk, encoding, callback) {29 console.log(chunk)30 callback()31 }32})33var service = argosy()34service.accept(writeStreamPattern)35service.listen(8000)36var argosy = require('argosy')37var writeStream = require('argosy-pattern-write-stream')38var through = require('through2')39var pump = require('pump')40var writeStreamPattern = writeStream({41})42var service = argosy()43service.accept(writeStreamPattern)44service.listen(8000)45var argosy = require('argosy')46var writeStream = require('argosy-pattern-write-stream')47var through = require('through2')48var pump = require('pump')49var writeStreamPattern = writeStream({50 write: function (chunk, encoding, callback) {51 console.log(chunk)52 callback()53 }54})55var service = argosy()56service.accept(writeStreamPattern)57service.listen(8000)
Using AI Code Generation
1var fs = require('fs');2var path = require('path');3var argosy = require('argosy');4var argosyPattern = require('argosy-pattern');5var writeStream = require('argosy-write-stream');6var service = argosy()7 .use('write', writeStream({8 path: path.join(__dirname, 'test.txt')9 }))10 .accept({11 }, function (msg, callback) {12 this.write(msg.data, function (err) {13 callback(err, { success: !err });14 });15 });16service.listen(8000);17var argosy = require('argosy');18var argosyPattern = require('argosy-pattern');19var writeStream = require('argosy-write-stream');20var service = argosy();21 .use('write', writeStream())22 .accept({23 }, function (msg, callback) {24 this.write(msg.data, function (err) {25 callback(err, { success: !err });26 });27 });28service.listen(8000);29var client = argosy().connect(8000);30 .act({31 }, function (err, response) {32 console.log(response);33 });
Using AI Code Generation
1var fs = require('fs');2var argosy = require('argosy');3var argosyStream = require('argosy-stream');4var stream = fs.createWriteStream('test.txt');5var service = argosy();6service.pipe(argosyStream.writeStream(stream)).pipe(service.accept({}));7service.on('error', function (err) {8 console.log(err);9});10service.accept({ sayHello: 'hello' }, function (err, result) {11 if (err) return console.log(err);12 console.log(result);13});14var fs = require('fs');15var argosy = require('argosy');16var argosyStream = require('argosy-stream');17var stream = fs.createReadStream('test.txt');18var service = argosy();19service.accept({ sayHello: 'hello' }, argosyStream.readStream(stream)).pipe(service);20service.on('error', function (err) {21 console.log(err);22});23service.request({ sayHello: 'hello' }, function (err, result) {24 if (err) return console.log(err);25 console.log(result);26});
Using AI Code Generation
1var argosy = require('argosy')2var writeStream = require('argosy-write-stream')3var through = require('through2')4var fs = require('fs')5var pump = require('pump')6var argosyPattern = {7}8var argosyService = argosy()9argosyService.pipe(writeStream(argosyPattern, function (stream, cb) {10 var fileStream = fs.createWriteStream('test.txt')11 pump(stream, fileStream, function (err) {12 cb(err)13 })14})).pipe(argosyService)15argosyService.accept({16}).on('data', function (msg) {17 msg.stream.pipe(through(function (chunk, enc, cb) {18 console.log(chunk.toString())19 cb(null, chunk)20 }))21})22argosyService.on('error', function (err) {23 console.log(err)24})25argosyService.listen(8000)26var argosy = require('argosy')27var writeStream = require('argosy-write-stream')28var through = require('through2')29var fs = require('fs')30var pump = require('pump')31var argosyPattern = {32}33var argosyService = argosy()34argosyService.pipe(writeStream(argosyPattern, function (stream, cb) {35 var fileStream = fs.createWriteStream('test.txt')36 pump(stream, fileStream, function (err) {37 cb(err)38 })39})).pipe(argosyService)40argosyService.accept({41}).on('data', function (msg) {42 msg.stream.pipe(through(function (chunk, enc, cb) {43 console.log(chunk.toString())44 cb(null, chunk)45 }))46})47argosyService.on('error', function (err) {48 console.log(err)49})50argosyService.listen(8000)
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!