Javascript Search to Loop and Display Objects one at a time

I am very new to Javascript so please give the question if easy.

I have created a Google Sheet. I have used the first tab called Form, to create a data entry form, this data is then saved, using javascript to another tab called, Removal_list. All works fine.
I have added a search function to recall the data from the Removal_list to Form using names. What I cannot work out is how to show not just the first object that meets the criteria. Example, I will have a list of names (column B in the sheet), which can be duplicated. When I search it will only return the first occurence. What I would like is the search to allow me to see each occurrence, one at a time. So if John Smith is in my list five times, the first occurrence will populate (as it does now), if this is not the one I want to see then, I somehow, move on to the next occurrence…

Thank you in advance.

// search values

var SEARCH_COL_IDX = 1
function Search() {

var ss = SpreadsheetApp.getActiveSpreadsheet();

var formS = ss.getSheetByName(“Form”);

var valuesFound = false;

var str = formS.getRange(“D18”).getValue();

var values = ss.getSheetByName(“Removal_list”).getDataRange().getValues();

for (var i = 0; i < values.length; i++) {
var row = values[i];

  if (row[SEARCH_COL_IDX] == str) {
    

             formS.getRange("B5").setValue(row[0]);
             formS.getRange("B7").setValue(row[1]);
             formS.getRange("B9").setValue(row[2]);
             formS.getRange("B11").setValue(row[3]);
             formS.getRange("B13").setValue(row[4]);
             formS.getRange("B15").setValue(row[5]);
             formS.getRange("E5").setValue(row[6]);
             formS.getRange("E7").setValue(row[7]);
             formS.getRange("E9").setValue(row[8]);
             formS.getRange("E11").setValue(row[9]);
             formS.getRange("E13").setValue(row[10]);
             formS.getRange("E15").setValue(row[11]);
             formS.getRange("G9").setValue(row[12]);
             formS.getRange("G11").setValue(row[13]);
             formS.getRange("G14").setValue(row[14]);
             valuesFound=true;
             return;
 

}
if(valueFound=false){

        var ui=SpreadsheetApp.getUi();

        ui.alert("No record found");

      }

}}

Trying to Append search list to my search input

I am new to HTML ,JavaScript and jQuery. I am currently doing a search box, when I start to type text on the search input the search list must appear and able to click the search list name and append it to search input, and close the search list and left with search input and current text that I clicked on the search list.

var $block = $('.no-results');

$(".personsMenu").hide();

$(".my-textbox").keyup(function() {
  var textbox = document.getElementById("textboxEmp");
  var val = $(this).val();
  var isMatch = false;
  var nameAp = document.getElementsByClassName("name12");
  
  $(".personsMenu").show();

  if (textbox.value == 0) {
    $(".personsMenu").hide();
  }
  
  $(".personsMenu div").each(function() {
    var content = $(this).html();
    if ((content.toLowerCase().indexOf(val) == -1) && (content.toUpperCase().indexOf(val) == -1)) {
      $(this).hide();
    } else {
      isMatch = true;
      $(this).show();

    }
  });
  
  $block.toggle(!isMatch);
});

function mySelect() {
  $(".name12").appendTo($(".my-textbox"));
  $(".personsMenu").hide();
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<div class="cover">
  <div name="selected">
    <i class="mdi-account-search mdi"></i><input class="my-textbox" id="textboxEmp" autofocus="autofocus" placeholder="search staff member" />
  </div>
  <div class="personsMenu">
    <ul class="infor">
      <div class="nm1" name="selected">
        <li class="name12" onclick="mySelect()">Malubane Nyikiwe</li>
        <li>[email protected]</li>
      </div>
      <div class="no-results">no employee found by that name</div>
      <div class="nm1" name="selected">
        <li class="name12" onclick="mySelect()">Chamano Sydney</li>
        <li>[email protected]</li>
      </div>
      <div class="nm1" name="selected">
        <li class="name12" onclick="mySelect()">Diphofa Tumelo</li>
        <li>[email protected]</li>
      </div>
    </ul>
  </div>
</div>

Quickest way to repackage a React component library?

I’m trying to build an npm package to standardize my layout components that use geist components at their core. At first, I tried to use the npm package as if it was a local component but it throws a webpack loader error when it tries to read the component for example:

Module parse failed: Unexpected token (6:8)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| const Badged = ({ content }) => {
|     return (
>         <Badge>
|             <b>{content}</b>
|         </Badge>

After reading around a bit it seems I need something like webpack or rollup to build everything to a dist folder in my npm package. How can I set up a pipeline to consume the type data from the source package and build my components to a dist folder?

How to show only Max Window Icon in ReactJS?

I want to ask how to display the Sample Title Bar in the Icon Window Max section only and this is my coding.

import React from 'react'
import { TitleBar } from 'react-desktop/windows';

export default function App() {
  return (
    <div style={{
      display: 'block', width: 400, paddingLeft: 30
    }}>
      <h4>React Desktop Windows TitleBar Component</h4>
      <TitleBar
        title="Sample TitleBar"
        controls
        isMaximized="true"
        background="orange"
      />
    </div>
  );
}

And want to show the Icon Window Max
before:
enter image description here

after:
enter image description here

Here is the code I got the link coding from: Link

rgb to greyscale converter

Is there a function that converts rgb colours into their greyscale form?

function rgbToGrayscale(r, g, b) {
    let gray = []

    /* complicated conversion code */

    return gray // [121, 121, 121]
}



const RGB = [20, 150, 240]
const GRAY = rgbToGrayscale(RGB)

Set CommandButton Value on Javascript – salesforce

I tried to make button checkall and it will change value of selectlist to be true,
after that, the value of button will be changed to uncheckall, but its not works.
anyone know how to make it works?
thanks

this is my code now

function toggleCheck() {
      var btn = document.getElementsByClassName("toggle_check")[0];
      var checkboxes = document.getElementsByTagName("input");
      alert('Btn '+ btn.value);
      console.log('Test Btn ' + btn.value);
      if (btn.value === "check all") {
        for (var i = 0; i < checkboxes.length; i++) {
          var check= document.getElementsByClassName("checkOpex")[i].value = 'True';
        }
        btn.value = 'uncheck all';
      } else {
        for (var j = 0; j < checkboxes.length; j++) {
          var check= document.getElementsByClassName("checkOpex")[i].value = 'False';
        }
        btn.value = 'uncheck all';
      }
}

<apex:column headerValue="Action" >
                    <apex:facet name="header">
                        <apex:commandButton styleClass="toggle_check" onclick="toggleCheck()" value="check all">
                            <apex:actionSupport event="onchange"/>
                        </apex:commandButton>
                    </apex:facet>
                    <apex:selectList id="inputId" value="{!acc.Opex__c}" styleClass="checkOpex" size="1">
                        <apex:selectOption itemValue="True" itemLabel="Checked" />
                        <apex:selectOption itemValue="False" itemLabel="Unchecked"/>
                        <apex:actionSupport event="onchange"/>
                    </apex:selectList>
                </apex:column>

Call variable value to get img source value

So I’m new with PUG and programming. I want to get img source and print it depending on the variable name. What I want to do is:

- var values = ['car', 'space', 'plants', 'rock', 'chair', 'phone', 'television'];

Then I’ll do a for to iterate over this array and print random unplash depending on the word, something like:

each val in values.length ? values : ['There are no values']
  img(src="https://source.unsplash.com/featured/1200x900?"+val alt=val loading="lazy")

I have tried different ways but can’t seem to know how to call and print pictures using PUG. I tried to call it using:

img(src="https://source.unsplash.com/featured/1200x900?values[0]", alt="random")

But only works if I just say:

img(src="https://source.unsplash.com/featured/1200x900?car", alt="random")

How to stop HTTrack from changing inline script when mirroring a website?

I am using HTTrack to mirror a website. This website is basically a simple slideshow. Each slide is either an image, video or HTML. Now I added some functionality to HTML-slides with a simple inline script within each slide. The script calls an API to get a new rendering of itself and then swapping the slide. In the mirrored version of the website the content of the HTML-slides gets changed:

<div class="rendered-slide">
    <div class="slide-content" id="containerId">
       ...
    </div>
    <script>
    function refresh(containerId) {
        const refreshTimer = 1000 * 60 * 30; // half an hour
        const url = "http://my.ip.add.ress/my/api/endpoint"; // here
        const xhttp = new XMLHttpRequest();
        xhttp.onreadystatechange = function() {
            if(this.readyState === 4) {
                const json = JSON.parse(this.responseText);
                if(this.status === 200 && json.html) {
                    const html = new DOMParser().parseFromString(json.html, 'text/html');
                    const container = document.getElementById(containerId);
                    const newContent = html.getElementById(containerId).innerHTML;
                    container.innerHTML = newContent;
                }
                setTimeout(refresh, refreshTimer , containerId);
            }
        };
        
        xhttp.open("POST", url, true); // and here
        xhttp.send();
    }
    document.addEventListener("DOMContentLoaded", function() {
        refresh('containerId');
    });
    </script>
</div>

After HTTrack saved the file these two lines read:

const url = "../../../my/api/endpoint.json"; // IP Address changed and .json added
xhttp.open("POST.html", url, true); // .html added

I found the following workaround:

const url = "http://my.ip" + ".add.ress/my/api/endpoint"; // splitting the string within the IP
const method = "POST";
xhttp.open(method, url, true); // and using a constant for the method

Why is HTTrack changing these entries and how can I prevent that?

PhotoSwipe | create Title Element | Responsive

i want to add an Title Element below my Image Gallery created with PhotoSwipe.
But my Title Element sticks not under the Image. It sticks to fast in the Image when Browser rescaling vertically.

JS to create the Element:

            lightbox.pswp.ui.registerElement({
                name: 'werkInformationen',
                className: 'smallWerkInformationen',
                appendTo: 'wrapper',
                onInit: (el, pswp) => {
                    var wrapDiv = document.createElement('div');
                    wrapDiv.className = 'wrapDiv';

                    var popUp = document.createElement('div');
                    popUp.className = 'popUpWerkInformationenTitle';
                    popUp.id = 'popUpWerkInformationenTitle';

                    var span = document.createElement('span');
                    span.className = 'child';
                    span.id = 'popUpWerkInformationenTitleSpan';
                    
                    wrapDiv.appendChild(popUp);
                    popUp.appendChild(span);

                    el.appendChild(wrapDiv);

                    pswp.on('change', (a,) => {
                        var paramsFromCurrentWerk = new URLSearchParams(lightbox.pswp.currSlide["data"]["src"]);
                        document.getElementById("popUpWerkInformationenTitleSpan").innerHTML = paramsFromCurrentWerk.get('id') + " | " + paramsFromCurrentWerk.get('werkName') + " | " + paramsFromCurrentWerk.get('material') + " | " + paramsFromCurrentWerk.get('kuenstler');
                    });
                }
            });

Output to HTML:

<div class="smallWerkInformationen pswp__hide-on-close">
    <div class="wrapDiv">
        <div class="popUpWerkInformationenTitle">
            <span class="child">PLACEHOLDER TEXT</span>
        </div>
    </div>
</div>

CSS:

.wrapDiv {
    min-width: 600px;
}

.smallWerkInformationen {
    position: relative;
}

#popUpWerkInformationenTitle {
    font-size: 12px;
    position: fixed;
    bottom: 0;
    width: 100%;
    text-align: center;
    margin-bottom: 30px;
}

#popUpWerkInformationenTitleSpan {
    text-align: center;
    background-color: black;
    color: #fff;
    border-radius: 5px;
    margin-left: 15px;
    margin-right: 15px;
    margin-top: 15px;
    font-size: 1rem !important;
    padding: 5px;
}

Expected Result until there is no space:
Expected Result until there is no space

My Result:
There is enough Space to fit the Text Element below but it goes in the Image.

My Result

Handle BLE beacon requests

Hy everyone. I am receiving /post data from bluetooth gateway. Gateway sends data (beacon MACs) x times in a second. Is this the best way to handle request? I want to save unique MACs and in some interval send data to some server.

app.post('/api', function(req, res) {
    const body = req.body;
    const objct = body.obj;
    let gtw = body.gmac;
    for (var prop in objct) {
        beaconi.add(objct[prop].dmac);
    }

    res.set('Content-Type', 'text/plain');
    res.send('Data was received');
})

setInterval(() => {

    axios
        .post('https://www.domain.app/beacon/api/getData.php', {
            data: {
                tagovi: Array.from(beaconi)
            },
        })
        .then(res => {
            console.log(`statusText: ${res.statusText}`);
            console.log('BIKONI', Array.from(beaconi));
            beaconi.clear();

        })

}, 15000);

app.listen(8080, function(err) {
    if (err) {
        throw err
    }

    console.log('Server at 8080');
})

how can i use readline() function in javascript?

Question:Write a JavaScript program that takes a number of inputs and displays the sum of them in the output.
i answer :

var n = parseInt(readline());
var a = readline().split(' ');
var result = 0;
for (var i = 0 ; i < n ; i++)
{
    result += parseInt(a[i]);
}
console.log(result);

but I get an error:Uncaught ReferenceError: readline is not defined

how can I fix that and how can I solve this question in javascript??

Atom language-jenkins plugin to support Jenkinsfile name with wildcard?

The Atom editor plugin language-jenkins highlights the syntax for Jenkinsfile.

However, my Jenkinsfiles are not always named Jenkinsfile, but usually have extension: Jenkinsfile-x86, Jenkinsfile-arm, Jenkinsfile-test, etc.

How would I need to modify the Atom plugin source code in order to support any file name starting with Jenkinsfile*?

This poor man’s solution works, but…:

'fileTypes': [
  'Jenkinsfile',
  'Jenkinsfile-x86',
  'Jenkinsfile-arm',
  'Jenkinsfile-test'
]