How to solve ‘digital envelope routines::unsupported’ error in Node.js and Vue.js with PrimeVue template?

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (D:workspacemulsan-adminnode_moduleswebpacklibutilcreateHash.js:135:53)
at NormalModule._initBuildHash (D:workspacemulsan-adminnode_moduleswebpacklibNormalModule.js:417:16)
at handleParseError (D:workspacemulsan-adminnode_moduleswebpacklibNormalModule.js:471:10)
at D:workspacemulsan-adminnode_moduleswebpacklibNormalModule.js:503:5
at D:workspacemulsan-adminnode_moduleswebpacklibNormalModule.js:358:12
at D:workspacemulsan-adminnode_modulesloader-runnerlibLoaderRunner.js:373:3
at iterateNormalLoaders (D:workspacemulsan-adminnode_modulesloader-runnerlibLoaderRunner.js:214:10)
at Array. (D:workspacemulsan-adminnode_modulesloader-runnerlibLoaderRunner.js:205:4)
at Storage.finished (D:workspacemulsan-adminnode_modulesenhanced-resolvelibCachedInputFileSystem.js:55:16)
at D:workspacemulsan-adminnode_modulesenhanced-resolvelibCachedInputFileSystem.js:91:9
at D:workspacemulsan-adminnode_modulesgraceful-fsgraceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ],
library: ‘digital envelope routines’,
reason: ‘unsupported’,
code: ‘ERR_OSSL_EVP_UNSUPPORTED’
}

Node.js v18.16.0

HOW TO SOLVE THIS ERROR ?

npm update

latest node version support primevue template

Why does Pyodide only show me its initial output?

I am trying to made a code-editor run a test script, similar to what leet-code would do with a test script that I specify and ace-editor so users can write python code. I use pyodide to interpret and run the test script and so far it works pretty well, however there is one big issue I cant seem to comprehend why it is even happening. Pyodide will only show me the output of the first time it ran the test script. Rather than changing its output (seeing failed tests) when I write the wrong code in editor. I write two files, challenge.py and test.py when a user clicks a button using pyodides virtual file system. writeFile() works perfectly fine in the respect that it will overwrite the contents of the file I specify with the new code so if the code is correct then the test script will run and tell me its passed in developer console. However this is only the case if the code is initially correct, if I run the test script again with the wrong code pyodide will tell me the tests still pass in developer console. Here is the code below that will run Pyodide:



async function runCode(code_to_run) {
    
    if(code_to_run == editor.getValue()){
        console.logs = [];

        let promise = new Promise((resolve, reject) => {
            window.pyodide.runPython(code_to_run)
            resolve(true)
        }).catch(err => {
            console.log(err);
            appendOutput(console.logs.join('n')); 
        });
    
        let result = await promise;
        if (result) { 
            appendOutput(console.logs.join('n')); 
        }
    } else {
        
        console.logs = [];

        var data = editor.getValue(); 
        var testData = code_to_run;
        window.pyodide.FS.writeFile("challenge.py", data);
        window.pyodide.FS.writeFile("test.py", testData);
        let promise = new Promise((resolve, reject) => {
            window.pyodide.runPythonAsync(`exec(open('test.py').read())`)
            resolve(true)
        }).catch(err => {
            console.log(err);
            appendOutput(console.logs.join('n')); 
        });
        
        let result = await promise;
        if (result) { 
            appendOutput(console.logs.join('n')); 
        }
    }
}




document.addEventListener('DOMContentLoaded', (event) => {

    output_pane = document.getElementById("output");
    // Add event listeners for downloading code
    document.getElementById("downloadButton").addEventListener('click', function () {
        saveCode(editor.getValue());
    });

    document.getElementById("runButton").addEventListener('click', function () {
        runCode(editor.getValue());
    });
    
    // Add event listeners for running code
    document.getElementById("run_code").addEventListener('click', function () {
        //Run the getcode function to get the code from the editor
        getCode(testFilePath)
        .then(code => {
            runCode(code);
        }) 
        .catch(error => {
            console.error('Error occurred while opening the code:', error);
        });
    });

    // Capture the output from Pyodide and add it to an array
    console.stdlog = console.log.bind(console);
    console.logs = [];
    console.log = function(){
        console.logs.push(Array.from(arguments));
        console.stdlog.apply(console, arguments);
    }
    
    configEditor();
});

Why is this the case? How come pyodide will only show me its first output rather than updating itself when I write the files again in the filesystem? How can I fix this?

I tried using syncfs to see if there was a syncing issue but it did not work, I verified that the file content was changing which left me even more confused as to why I keep seeing the same output no matter what.

Dynamic home page/ index.html on Cordova

I have a Cordova project for Android. The case is that I want to have two index.html files that can be switched through a button because they represent two different home screens. In principle, this is very easy, but the problem is that if the user chooses, for example, index_2.html, this change won’t be saved when they exit the app or restart their phone. Is it possible to do this and have the app start where the user chooses? Thank you in advance.

I don’t know any way to do this in Cordova, honestly.I know that changes for the app’s home screen are made in index.xml, but I don’t know how to manipulate this file dynamically with the already compiled app.

Axios and Fetch doesnt sending cookies to api in browset

i developed a spring boot api using jwt auth, i got and endpoint
'http://localhost:8080/api/signin' and if the login is successfull it returns a JSESSIONID which is a jwtToken. Until there, it’s all good, but i can get other methods from API in the browser because the cookies are not being passed in the req body.

The cookie generated by jwt looks like:JSESSIONID=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImlhdCI6MTY4NTE1Mzk5NSwiZXhwIjoxNjg1MjQwMzk1fQ.9jxHyzDJKVra8IryxbH8se0xSl4_DkapNsKmjRCvlJs_R8M3x3RBMeo-1VPAJv6YSQwC6ukJutRwGEyfeYrGwQ; Path=/; HttpOnly; Expires=Sun, 28 May 2023 02:38:33 GMT;

For example:
If i do

curl --location 'http://localhost:8080/user/admin/all' --header 'Cookie: JSESSIONID=mycookie' 

it goes all good and returns me the json i want, but when i run it on browser, inside my js script from my frontend

axios
  .get("http://localhost:8080/user/admin/all", {
    headers: {
      Cookie:
        "JSESSIONID=mycookie",
    },
  })
  .then((response) => {
    console.log(response.headers);
    console.log(response.data);
  })
  .catch((error) => {
    console.error("Erro:", error);
  });

I get this error:

GET http://localhost:8080/user/admin/all 401

The cookie is not being setted. I tried so many things that i almost losing my mind. Do you guys have any idea of what it can be??

Strict toNumber in Javascript

Is there a more strict built-in javascript function that will tell me if a string input is a number or not? For example:

// for both of the following it should produce a non-value (nan or undefined or whatever)
> parseFloat('2xa');
2
> parseInt('1ddd')
1

Currently I’m using a regex to do it:

const test_values = [
  // [value, expected]
  ['2.4', 2.4],
  ['1e2', 1e2],
  ['1f', null],
  ['0.28', 0.28],
  ['1e+7', 1e+7],
  ['1e+7.1', null]
]
for (let [val, expected] of test_values) {
  let m = val.match(/^(-?d*(.d+)|d+)([eE][+-]?d*)?$/);
  let res = m? parseFloat(m[0]) : null;
  console.log(res === expected? 'OK' : 'ERROR', res);
}

Is there a way to click on a button in a window opened using google colab/javascript

One of my daily work includes going to a webpage, sourcing for the product and clicking “Add to cart”.

However, I have a list of products and I am trying out a way to simulate this using google colab.

I understand that I can only use javascript in colab to open the URL in a new tab. However, I do not know how to click on a particular button e.g. “Add to cart” button once I have opened the URL.

Is there a way to do this using google colab/javascript?

from IPython.display import Javascript
def automate():
    url = 'https://www.sigmaaldrich.com/SG/en/product/sigald/s9888'
    display(Javascript('window.open("{url}");'.format(url=url)))
    display(Javascript('document.getElementById("P&A-row-quantity-SIGALD-S9888-500G-increment").click();')) 
automate()

Bootstrap DataTables not working properly in my website

Error when using data tables, sources order

Hi, I’m making a website with boostrap 5 and I’m trying to make a dataTable type table, only the options that data tables have in boostrap don’t work. For a moment it worked fine but I don’t really remember what I did that stopped looking good hahha.
index.html

I think I have a mistake in the order of my head and where the data table goes.

HTML

<!DOCTYPE html>
<html lang="es">
  <head>

  <title>Tutorial API JavaScript</title>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  <link rel="stylesheet" href= "https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css">

  <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
  <script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
  <script src="../final/script.js"></script>
  </head>
  <body>
      <h1 class="text-center pt-5 pb-4">Resultados de COVID-19 en Estados Unidos por dia</h1>
      <div id="contenedor" class="container">
        <table id="data-table" class="table table-striped" style="width:100%">
          <thead>
            <tr>
              <th>Id</th>
              <th>Fecha</th>
              <th>Casos positivos</th>
              <th>Casos negativos</th>
              <th>Muertes</th>
              <th>Total de pruebas</th>
            </tr>
          </thead>

          <tbody></tbody>
        </table>

      </div>
    <script>
      $(document).ready(function () {
        $('#data-table').DataTable();
    });
    </script>
  </body>


</html>

JS

const apiUrl = 'https://api.covidtracking.com/v1/us/daily.json'; 
fetch(apiUrl)
  .then(response => response.json())
  .then(data => {
    const tableBody = document.querySelector('#data-table tbody');
    let count = 0;
    data.forEach(item => {
      count++;
      const row = document.createElement('tr');
      
      const idCell = document.createElement('td');
      idCell.textContent = count;
      row.appendChild(idCell);

      const dateCell = document.createElement('td');
      dateCell.textContent = item.dateChecked;
      row.appendChild(dateCell); //fecha

      const posCell = document.createElement('td');
      posCell.textContent = item.positive;
      row.appendChild(posCell); //positivo

      const negCell = document.createElement('td');
      negCell.textContent = item.negative;
      row.appendChild(negCell);//negativo

      const deadCell = document.createElement('td');
      deadCell.textContent = item.death;
      row.appendChild(deadCell); //muertes

      const resCell = document.createElement('td');
      resCell.textContent = item.totalTestResults;
      row.appendChild(resCell);//tests

      tableBody.appendChild(row);
    });
  })
  .catch(error => {
    console.log('Error al obtener los datos:', error);
  });

How do I get the result of finding string with regex?

So I have a string and I want to take a part of the string, that it matches. For example:
stringToFind:
"<html><head><script src="http://example.com"></script>..."
I need to get the source of the script tag. I need to find all instances of the script tag in the string, and get the url of the source.

I was going to use String.prototype.replace(), that uses regular expressions, but you have to replace it with something and the result is the whole string.

javascript error [object HTMLInputElement]

I am practicing java script code but I have the following issue with this code.

1pt
2pt

The issue with that is it is not happening what is should have and I get that error.

When I open inspect in the browser it also says I have incorrect use of .
“The label’s for attribute doesn’t match any element id. This might prevent the browser from correctly autofilling the form and accessibility tools from working correctly.
To fix this issue, make sure the label’s for attribute references the correct id of a form field.”

I do not know what to do.

Send info via webhook in JavaScript

I am using Google Forms, and when I send the answer, I want for the answer to be sent via webhook. Here is my current code:

var POST_URL = "my webhook url";
function onSubmit(e) {
    var form = FormApp.getActiveForm();
    var allResponses = form.getResponses();
    var latestResponse = allResponses[allResponses.length - 1];
    var response = latestResponse.getItemResponses();
    var payload = {};
    for (var i = 0; i < response.length; i++) {
        var question = response[i].getItem().getTitle();
        var answer = response[i].getResponse();
        payload[question] = answer;
    }
  
    var options = {
        "method": "post",
        "contentType": "application/json",
        "payload": JSON.stringify(payload)
    };
    UrlFetchApp.fetch(POST_URL, options);
};

It gives me this error as soon as I run it:

Exception: Request failed for https://WEBHOOK WEBSTIE returned code 400. Truncated server response: {"message": "Cannot send an empty message", "code": 50006} (use muteHttpExceptions option to examine full response)

I .logged options, and it was not empty.
I have little no experience with JS, as I want to use it for webhook only.

Console telling me my element Id is not defined

Element Id is not defined for some reason and all the code looks fine.

function qm() {
  var imgsiz = Math.floor(Math.random() * (100 - 1)) + 1 
  console.log(imgsiz)
  if (imgsiz=="1"){
    document.getElementById("image").innerHTML = "<img src=1.jpg>"
  } else if (imgsiz=="2"){
    document.getElementById("image").innerHTML = "<img src=2.jpeg>"
  } else if (imgsiz=="3"){
    document.getElementById("image").innerHTML = "<img src=3.jpg>"
  } else if (imgsiz=="4"){
    document.getElementById("image").innerHTML = "<img src=4.jpg>"
  } else if (imgsiz=="5"){
    document.getElementById("image").innerHTML = "<img src=5.jpg>"
  } else if (imgsiz=="6"){
    document.getElementById("image").innerHTML = "<img src=6.jpeg>"
  } else if (imgsiz=="7"){
    document.getElementById("image").innerHTML = "<img src=7.jpg>"
  } else if (imgsiz=="8"){
    document.getElementById("image").innerHTML = "<img src=8.jpg>"
  } else if (imgsiz=="9"){
    document.getElementById("image").innerHTML = "<img src=9.jpg>"
  } else if (imgsiz=="10"){
    document.getElementById("image").innerHTML = "<img src=10.jpg>"
  } else if (imgsiz=="11"){
    document.getElementById("image").innerHTML = "<img src=11.jpeg>"
  } else if (imgsiz=="12"){
    document.getElementById("image").innerHTML = "<img src=12.jpg>"
  } else if (imgsiz=="13"){
    document.getElementById("image").innerHTML = "<img src=13.jpg>"
  } else if (imgsiz=="14"){
    document.getElementById("image").innerHTML = "<img src=14.jpeg>"
  } else if (imgsiz=="15"){
    document.getElementById("image").innerHTML = "<img src=15.jpeg>"
  } else if (imgsiz=="16"){
    document.getElementById("image").innerHTML = "<img src=16.jpeg>"
  } else if (imgsiz=="17"){
    document.getElementById("image").innerHTML = "<img src=1.jpg>"
  }
  var fonts = [ '1','2','1','2','3','4','5','6','5','6','7','8'];
  var font = fonts[Math.floor(Math.random()*fonts.length)];
  if (font=="1"){
    document.getElementById("quote")
    quote.style.fontFamily = "arial"
  } else if (font=="2"){
    document.getElementById("quote")
    quote.style.fontFamily = "tahoma"
  } else if (font=="3"){
    document.getElementById("quote")
    quote.style.fontFamily = "trebuchet"
  } else if (font=="4"){
    document.getElementById("quote")
    quote.style.fontFamily = "times new roman"
  } else if (font=="5"){
    document.getElementById("quote")
    quote.style.fontFamily = "georgia"
  } else if (font=="6"){
    document.getElementById("quote")
    quote.style.fontFamily = "garamond"
  } else if (font=="7"){
    document.getElementById("quote")
    quote.style.fontFamily = "courier new"
  } else if (font=="8"){
    document.getElementById("quote")
    quote.style.fontFamily = "brush script mt"
  }
  var rndoInt = Math.floor(Math.random() * (25 - 15)) + 15 
  console.log(rndoInt)
  document.getElementById("quote");
  quote.style.fontSize =  rndoInt + "px";
  var nouns = [' time ' , ' year ' , ' device ' , ' way ' , ' day ' , ' man ' , ' thing ' , ' woman ' , ' life ' , ' child ' , ' world ' , ' school ' , ' state ' , ' family ' , ' student ' , ' group ' , ' country ' , ' problem ' , ' hand ' , ' part ' , ' place ' , ' self ' , ' week ' , ' company ' , ' system ' , ' program ' , ' question ' , ' food ' , ' government ' , ' number ' , ' night ' , ' point ' , ' home ' , ' water ' , ' room ' , ' mother ' , ' area ' , ' money ' , ' story ' , ' bone ' , ' month ' , ' furniture ' , ' right ' , ' study ' , ' book ' , ' eye ' , ' job ' , ' word ' , ' business ' , ' issue ' , ' side ' , ' kind ' , ' head ' , ' house ' , ' service ' , ' friend ' , ' father ' , ' power ' , ' hour ' , ' game ' , ' line ' , ' clothing ' , ' member ' , ' law ' , ' car ' , ' city ' , ' community ' , ' name ' , ' president ' , ' team ' , ' minute ' , ' idea ' , ' kid ' , ' body ' , ' information ' , ' back ' , ' parent ' , ' face ' , ' innocent ' , ' level ' , ' office ' , ' door ' , ' health ' , ' person ' , ' life ' , ' war ' , ' history ' , ' party ' , ' dog ' , ' change ' , ' morning ' , ' partner ' , ' funeral ' , ' girl ' , ' guy ' , ' moment ' , ' air ' , ' teacher ' , ' force ' , ' educator' ];
  var noun = nouns[Math.floor(Math.random()*nouns.length)];
  var pnouns = [' times ' , ' years ' , ' devices ' , ' ways ' , ' days ' , ' men ' , ' things ' , ' women ' , ' lives ' , ' children ' , ' worlds ' , ' schools ' , ' states ' , ' families ' , ' students ' , ' groups ' , ' countries ' , ' problems ' , ' hands ' , ' parts ' , ' places ' , ' selves ' , ' weeks ' , ' companies ' , ' systems ' , ' programs ' , ' questions ' , ' food ' , ' governments ' , ' numbers ' , ' nights ' , ' points ' , ' homes ' , ' waters ' , ' rooms ' , ' mothers ' , ' areas ' , ' money ' , ' stories ' , ' bones ' , ' months ' , ' furniture ' , ' rights ' , ' studies ' , ' books ' , ' eyes ' , ' jobs ' , ' words ' , ' business ' , ' issues ' , ' sides ' , ' people ' , ' heads ' , ' houses ' , ' services ' , ' friends ' , ' fathers ' , ' powers ' , ' hours ' , ' games ' , ' lines ' , ' clothing ' , ' members ' , ' laws ' , ' cars ' , ' cities ' , ' communities ' , ' names ' , ' presidents ' , ' teams ' , ' minutes ' , ' ideas ' , ' kids ' , ' bodies ' , ' information ' , ' backs ' , ' parents ' , ' faces ' , ' innocents ' , ' levels ' , ' offices ' , ' doors ' , ' health ' , ' people ' , ' lives ' , ' wars ' , ' histories ' , ' parties ' , ' dogs ' , ' changes ' , ' mornings ' , ' partners ' , ' funerals ' , ' girls ' , ' guys ' , ' moments ' , ' airs ' , ' teachers ' , ' forces ' , ' educators ' ];
  var pnoun = pnouns[Math.floor(Math.random()*pnouns.length)];
  var adverbs = [' bashfully ' , ' beautifully ' , ' bitterly ' , ' bleakly ' , ' blindly ' , ' blissfully ' , ' boastfully ' , ' boldly ' , ' bravely ' , ' briefly ' , ' brightly ' , ' briskly ' , ' broadly ' , ' busily ' , ' calmly ' , ' carefully ' , ' carelessly ' , ' cautiously ' , ' certainly ' , ' cheerfully ' , ' clearly ' , ' cleverly ' , ' closely ' , ' coaxingly ' , ' colorfully ' , ' commonly ' , ' continually ' , ' coolly ' , ' correctly ' , ' courageously ' , ' crossly ' , ' cruelly ' , ' curiously ' , ' daily ' , ' daintily ' , ' dearly ' , ' deceivingly ' , ' deeply ' , ' defiantly ' , ' deliberately ' , ' delightfully ' , ' diligently ' , ' dimly ' , ' doubtfully ' , ' dreamily ' , ' easily ' , ' elegantly ' , ' energetically ' , ' enormously ' , ' enthusiastically ' , ' equally ' , ' especially ' , ' evenly ' , ' fortunately ' , ' frankly ' , ' frantically ' , ' freely ' , ' frenetically ' , ' hopelessly ' , ' shrilly ' , ' shyly ' , ' silently ' , ' sleepily ' , ' slowly ' , ' smoothly ' , ' publicly ' , ' solemnly ' , ' solidly ' , ' sometimes ' , ' rapidly ' , ' speedily ' , ' stealthily ' , ' sternly ' , ' strictly ' , ' unaccountably ' , ' unbearably ' , ' unethically ' , ' unexpectedly ' , ' unfortunately ' , ' unimpressively ' , ' unnaturally ' , ' unnecessarily ' , ' angrily ' , ' equally ' , ' blissfully ' , ' purposefully ' , ' vainly ' , ' valiantly ' , ' vastly ' , ' verbally ' , ' upsettingly ' , ' viciously ' , ' victoriously ' , ' violently ' , ' weakly ' , ' wearily ' , ' deppresingly ' , ' wetly ' , ' fully ' , ' wildly '];
  var adverb = adverbs[Math.floor(Math.random()*adverbs.length)];
  var verbs = [ ' be ' , ' keep ' , ' understand ' , ' shoot ' , ' beat ' , ' watch ' , ' do ' , ' begin ' , ' follow ' , ' say ' , ' devour ' , ' stop ' , ' abolish ' , ' help ' , ' create ' , ' suck ' , ' drown ' , ' speak ' , ' get ' , ' fight ' , ' read ' , ' choke ' , ' start ' , ' escape ' , ' make ' , ' trust ' , ' add ' , ' know ' , ' show ' , ' spend ' , ' steal ' , ' hear ' , ' grow ' , ' think ' , ' misuse ' , ' open ' , ' take ' , ' run ' , ' release ' , ' see ' , ' move ' , ' win ' , ' punch ' , ' like ' , ' offer ' , ' obliterate ' , ' live ' , ' remember ' , ' want ' , ' believe ' , ' love ' , ' steal ' , ' hold ' , ' consider ' , ' use ' , ' bring ' , ' find ' , ' break ' , ' accept ' , ' buy ' , ' give ' , ' rejoin ' , ' attend ' , ' tell ' , ' write ' , ' serve ' , ' work ' , ' provide ' , ' detonate ' , ' end ' , ' trust ' , ' deport ' , ' start ' , ' burn ' , ' expect ' , ' call ' , ' lose ' , ' build ' , ' try ' , ' pay ' , ' like ' , ' rob ' , ' meet ' , ' fail ' , ' need ' , ' include ' , ' cut ' , ' feel ' , ' sell ' , ' reach ' , ' become ' , ' blow ' , ' kill ' , ' leave ' , ' learn ' , ' ruin ' , ' bury ' , ' change ' , ' bully ' , ' lead '];
  var verb = verbs[Math.floor(Math.random()*verbs.length)];  
  var fronttexts = ['Always ','Never ','You only live once, ','Life is short ','Trust people that ','Dont trust people who ','Occasionally ','If you ever feel sad, ','If you are feeling up to it, ',''];
  var fronttext = fronttexts[Math.floor(Math.random()*fronttexts.length)];
  var adjectives = [' other ' , ' new ' , ' good ' , ' high ' , ' old ' , ' great ' , ' big ' , ' American ' , ' small ' , ' large ' , ' national ' , ' young ' , ' different ' , ' black ' , ' long ' , ' little ' , ' important ' , ' political ' , ' bad ' , ' white ' , ' real ' , ' best ' , ' right ' , ' senile ' , ' dead ' , ' public ' , ' sure ' , ' low ' , ' early ' , ' able ' , ' human ' , ' local ' , ' late ' , ' hard ' , ' major ' , ' better ' , ' economic ' , ' strong ' , ' possible ' , ' whole ' , ' free ' , ' military ' , ' true ' , ' federal ' , ' international ' , ' full ' , ' special ' , ' easy ' , ' clear ' , ' recent ' , ' certain ' , ' personal ' , ' open ' , ' red ' , ' difficult ' , ' available ' , ' likely ' , ' short ' , ' single ' , ' medical ' , ' current ' , ' wrong ' , ' private ' , ' past ' , ' foreign ' , ' fine ' , ' common ' , ' poor ' , ' natural ' , ' significant ' , ' similar ' , ' hot ' , ' dead ' , ' central ' , ' happy ' , ' serious ' , ' ready ' , ' simple ' , ' left ' , ' physical ' , ' general ' , ' environmental ' , ' financial ' , ' blue ' , ' democratic ' , ' dark ' , ' various ' , ' entire ' , ' close ' , ' legal ' , ' religious ' , ' cold ' , ' final ' , ' main ' , ' green ' , ' nice ' , ' huge ' , ' popular ' , ' traditional ' , '  cultural '];
  var adjective = adjectives[Math.floor(Math.random()*adjectives.length)];
  var presets = [ '1','2','1','2','3','4','5','6','5','6','7','8','9','10','11','12','11','12','13','14','15','16'];
  var preset = presets[Math.floor(Math.random()*presets.length)];
  if (preset == "1"){
    document.getElementById("quote").innerHTML = ""+fronttext+verb+"your"+noun+"."
  } else if (preset == "2"){
    document.getElementById("quote").innerHTML = ""+fronttext+verb+"a"+noun+"."
  } else if (preset == "3"){
    document.getElementById("quote").innerHTML = ""+fronttext+adverb+verb+"your"+noun+"."
  } else if (preset == "4"){
    document.getElementById("quote").innerHTML = ""+fronttext+adverb+verb+"a"+noun+"."
  } else if (preset == "5"){
    document.getElementById("quote").innerHTML = ""+fronttext+verb+"your"+pnoun+"."
  } else if (preset == "6"){
    document.getElementById("quote").innerHTML = ""+fronttext+verb+pnoun+"."
  } else if (preset == "7"){
    document.getElementById("quote").innerHTML = ""+fronttext+adverb+verb+"your"+pnoun+"."
  } else if (preset == "8"){
    document.getElementById("quote").innerHTML = ""+fronttext+adverb+verb+pnoun+"."
  } else if (preset == "9"){
    document.getElementById("quote").innerHTML = ""+fronttext+verb+"your"+adjective+pnoun+"."
  } else if (preset == "10"){
    document.getElementById("quote").innerHTML = ""+fronttext+verb+adjective+pnoun+"."
  } else if (preset == "11"){
    document.getElementById("quote").innerHTML = ""+fronttext+verb+"your"+adjective+noun+"."
  } else if (preset == "12"){
    document.getElementById("quote").innerHTML = ""+fronttext+verb+"a"+adjective+noun+"."
  } else if (preset == "13"){
    document.getElementById("quote").innerHTML = ""+fronttext+adverb+verb+"your"+adjective+noun+"."
  } else if (preset == "14"){
    document.getElementById("quote").innerHTML = ""+fronttext+adverb+verb+"a"+adjective+noun+"."
  } else if (preset == "15"){
    document.getElementById("quote").innerHTML = ""+fronttext+adverb+verb+adjective+pnoun+"."
  } else if (preset == "16"){
    document.getElementById("quote").innerHTML = ""+fronttext+adverb+verb+"your"+adjective+pnoun+"."
  }
};
html {
    height: 100%;
    width: 100%;
}
button {
    height : 100px;
    width : 100px;
    position : fixed;
    top: 100px;
    left: 50px;
}  
img {
    width: 150px; 
    height: 150px; 
    object-fit: cover;
    object-position: 25% 25%
}
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Inspirtaitonal quotesd genbaerator</title>
  <link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
  <script src="script.js"></script>

  <div id="image">
    
  <p id="quote"></p>
  <button onclick="qm()">Make a quote</button>
</body>
  
</html>

I have image files in the replit, for those who are wondering what I am making, I amd creating a “inspirational” quote generator, its meant to be a funny strange quote generator. I have not yet added all of the images in (there are 100) so if that is the issue that would help but I dont beleive it is because the files are not used anywhere else.

How can I prevent ‘Buy it now’ button to redirect to the checkout page?

In my Shopify app I want to perform a couple of tasks before the “Buy It Now” button redirects to the checkout page. In my theme app extension, I selected the button as a dom element and tried the preventDefault function, but it’s still redirecting. How can I stop redirecting?

var paymentButton = document.querySelector('.shopify-payment-button');

  if (paymentButton) {
   
    paymentButton.addEventListener('click', function(event) {
      event.preventDefault();
      event.stopPropagation();


      // things I want to do
    });
  }

D3.js – person polygon – generate premade polygons, position, change color on click – return clicked on polygons and color

I am interested in making a biomedical type d3.js app – where a polygon person is made. — The user clicks on the parts which indicate a wound — red – severe, – amber – mild —- I want to create a polygon “maker”/renderer — that also has 2 color palletes to allow the user to click – clicking again deselects/removes the color.

enter image description here

then a button at the end that fetches the d3.js clicked on changed color states – I image each polygon would have codes

so returned data look something like

[{“code”: “BR234”, “state”: “severe”}, {“code”: “TDR234”, “state”: “amber”}]

enter image description here
current code — but I am unsure how to position the polygons correctly – but also easily draw them from a reference – if there ways to draw half a person – then mirror the needed polygons with math?

http://jsfiddle.net/cky0n4o3/12/

<script>
  

$(document).ready(function() {

   
  var vis = d3.select("body").append("svg")
    .attr("width", 1000)
    .attr("height", 667);

  var  scaleX = d3.scale.linear()
    .domain([-30, 30])
    .range([0, 600]);

  var  scaleY = d3.scale.linear()
    .domain([0, 50])
    .range([500, 0]);

  var data = [{"code":"BR23", "points": "191,23.5625,274,37.5625,319,101.5625,274,156.5625,170,149.5625,138,81.5625"}, {"code":"FR23", "points": "139,17.5625,324,0.5625,336,77.5625,160,105.5625"}];

    vis.selectAll("polygon")
    .data(data)
    .enter().append("polygon")
    .attr("points", function(d, i) {return d.points})
    .attr("fill", "grey")
    .attr("stroke", "red")
    .attr("stroke-width", 2)
   .on("click", function(d, i) {
      console.log("d", d);
      d3.select(this).style("fill", "blue");
    });


 
});



</script>

make polygons with coordinates?
Proper format for drawing polygon data in D3

draw each segment out – how to do curved paths?

https://jsfiddle.net/7pwaLfth/

Como se puede verificar un numero de whatsapp (con codigo)

Tengo en mente desarrollar un sistema, y en una de las partes del mismo debería poder el usuario ingresar su numero de whatsapp (o celular) y el mismo ser verificado a través de un código que le llegue al celular. Existe algun sistema que pueda usar para esto? digo, para el ENVIO de un código que confirme que ese número le pertenece, algo similar a lo que hace la verificación de dos pasos.

-ENG-
Hello! I have in mind to develop a system, and in one of the parts of it the user should be able to enter their WhatsApp number (or cell phone) and be verified through a code that reaches the cell phone. Is there a system I can use for this? I mean, for SENDING a code that confirms that this number belongs to you, something similar to what two-step verification does.

Busque en diferentes lugares pero no encontré nada. Solo verificación por sms (pero con precio por mensaje).

-ENG-
I looked in different places but couldn’t find anything. SMS verification only (but priced per message).

Change the state of a element

I have mapped an image. By default “fill” is red with “opacity = 0”.I am accessing an api to get the following json:

{
"documents": [
    {
        "_id": "646fd0fbe269fac6c8374c9e",
        "id": "gid://Product/7592907636921",
        "status": false,
        "url": "https://www.store.com/products/link1"
    }
]
}

I would like some help, if when the url matches my mapped “href” and the status is false, the opacity is changed to 1 so that the box is marked red. And if possible, instead of completely covering it with red, cross out the square with an X.

enter image description here

<style>
.table_number{
fill: red;
opacity: 0;
}
</style>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 540 159">
<image width="540" height="159" xlink:href="https://cdn.shopify.com/s/files/1/0573/4478/6617/files/tables_number.png"></image>
<a xlink:href="https://www.store.com/products/link1">
    <rect class="table_number" x="46" y="54" width="86" height="70"></rect>
</a>
<a xlink:href="https://www.store.com/products/link2">
    <rect class="table_number" x="171" y="56" width="84" height="69"></rect>
</a>
<a xlink:href="https://www.store.com/products/link3">
    <rect class="table_number" x="292" y="59" width="82" height="65"></rect>
</a>
<a xlink:href="https://www.store.com/products/link4">
    <rect class="table_number" x="408" y="59" width="85" height="70"></rect>
</a>
</svg>
<script>
getData();

async function getData(){
const response= await fetch('myurl')
console.log(response);

//Help here

}