How to reload page on language change in google translate for html / Reactjs?

Coding Used for Google Script in Our Program

<script src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit" async> </script>

<script type="text/javascript">

  function googleTranslateElementInit() {
    new google.translate.TranslateElement(
      {
        pageLanguage: "en",
        
         includedLanguages : 'ta,te,hi,ml,kn,en',

        layout: window.google.translate.TranslateElement.InlineLayout.SIMPLE,

        

      }, 
      'google_translate_element'  
    );
  } 
 
</script>
 

———- Using Below Code —– To Display the Dropdown value or HTML / Reactjs ——

<div id="google_translate_element">

function not written right

I need to fine tune this function if the conditions in the where clause are true. I’m new at functions so this should be easy for those of you who know them well…Ultimately, if the statement is true, I need it to execute a call to yet another function.

function get_log_contentaging( $user_id, $ref , $ref_id = null ) {

global $wpdb, $logsource;
$request = "SELECT creds FROM {$logsource->log_table} WHERE user_id = '$user_id' AND ref= 'published_content' AND time > strtotime('-2 day', time())";

if ( ! empty( $ref_id ) ) {
    $request .= " AND ref_id = '$ref_id'";
}

return $wpdb->get_var( $request );}/* if the select statement for the user ID is true, then execute this- new Controller({'minDelay':3000, 'minCount':2, 'maxCount':25, 'mouseOver':'fly'});*/

EJS template engine

I’m doing a node.js project and I’ve an ejs template file which further uses templates for header and footer.

template.ejs looks like this:

<%- include(header) %>
main html body
<%- include(footer) %>

<script type='text/javascript'>
...
...
...
</script>

when I run the server, the script embedded between the script tags becomes clearly visible. How do I hide this part from the page rendered by the node server.

Using a constant random variable in a randomly generated component

I am building a solar system app that automatically generates stars. My stars are a React component that accept a couple of props. When the user clicks the star, I need the system state to update and also I want the navlink to point to the same value.

let randomTypeVariable = starList[Math.floor(Math.random() * 6 + 1)];
      return (
        <NavLink
          to={`/${randomTypeVariable}`}
          onClick={() => props.setSystem(`${randomTypeVariable}`)}
          className="starWrapper"
        >

However at the moment the to= prop and the onClick function are giving different results. I know that this is because the randomTypeVariable is running each time and giving different results.

These components are being randomly generated so I cannot have the variable be a constant value.
How can I assign both of these properties to be the same randomly generated variable?

For context here is the full star component

let randomTypeVariable = starList[Math.floor(Math.random() * 6 + 1)];
  const makeStars = (Count = 5) => {
    if (Count > 0) {
      return (
        <NavLink
          to={`/${randomTypeVariable}`}
          onClick={() => props.setSystem(`${randomTypeVariable}`)}
          className="starWrapper"
        >
          <Star
            starName={`${makeStarName()}`}
            starPosition={positionList[Math.floor(Math.random() * 9 + 1)]}
            starType={`${starList[Math.floor(Math.random() * 6 + 2)]}`}
          ></Star>
          {makeStars(Count - 1)}
        </NavLink>
      );
    }
  };

How to extract token from Authorization header response using Fetch API?

I have a react app that makes a post request using the Fetch API and receives a Response that has a token in the Authorization header. I want to store that on the client-side in the cookies. And when I make a different request I will get that token from the cookies and send it through the header. How do I go about extracting this token from the header and storing it in cookies?

Get Api value and put in a const – VUE

i’m inserting recaptcha invisible at one system, but i need to get the secrets from database.

I have one method getting the value, but i need to save it in a const and pass to recaptcha method.
what i did, is not working.

how is working:

RecaptchaSiteKeyApi.js – Getting the key from backend api – here is working.

import { api } from './ApiConfig'

export default {

listaSiteKey: () =>
        api.get(`recaptcha-site-key`,
            {
            headers: { Authentication: window.localStorage.getItem('token'), "Content-Type": "application/json" },
            transformResponse: [function (data) {
                const result = data ? JSON.parse(data) : null;
                return result.nmSite;
            }]
        }),

    }

RecaptchaSiteKey.js – to save the result from Api in a const and send to LoginPage –here is not working the value from listasitekey() not apear.

import RecaptchaSiteKeyApi from './RecaptchaSiteKeyApi';

const CHAVE_RECAPTCHA = {
    key: null
}

export function carregarChaveCaptcha() {
    if(CHAVE_RECAPTCHA.key==null){
        CHAVE_RECAPTCHA.key = RecaptchaSiteKeyApi.listaSiteKey();
    }    
    return CHAVE_RECAPTCHA.key;
}

Login.vue – here is the recaptcha method
i need to pass the value to these component:

          <RecaptchaEnterprise 
            :data-sitekey="constKey()"  <------- need to put the value key here
            :data-validate="validate"
            :data-callback="callback"  
              data-badge=""           
             >Acessar
            </RecaptchaEnterprise>
            </v-btn> 

export default {
  components: {   
    RecaptchaEnterprise 
  },
  data() {
    return {
      key: null,

            
    };
  },

  methods: {

    constKey(){
      const Key = carregarChaveCaptcha();
      return Key
    },

Debug:
RecaptchaSiteKey – not get the value from SiteKeyApi
RecaptchaSiteKeyApi – is getting the value from database

i have vue app and it says This dependency was not found: * core-js/fn/object/create in ./src/main.js

here is my dependencies
“dependencies”: {
“axios”: “^0.25.0”,
“bootstrap”: “^5.1.3”,
“bootstrap-vue”: “^2.21.2”,
“core-js”: “^3.20.3”,
“vue”: “^2.6.11”,
“vue-router”: “^4.0.12”
},
“devDependencies”: {
“@vue/cli-plugin-babel”: “~4.5.0”,
“@vue/cli-plugin-eslint”: “~4.5.0”,
“@vue/cli-service”: “~4.5.0”,
“babel-eslint”: “^10.1.0”,
“eslint”: “^6.7.2”,
“eslint-plugin-vue”: “^6.2.2”,
“node-sass”: “^7.0.1”,
“sass-loader”: “^12.4.0”,
“vue-template-compiler”: “^2.6.11”
},

javascript – unable to get response from promise.all()

I find that I cannot get the response when using promise.all.

The orders below should be an array

Promise.all(promises).then(function (orders) {
  console.log(orders); // nothing logged
});

Full code

let promises = markets.map(async (mkt) => {
  return new Promise(async function (resolve, reject) {
    return functionA(paramA)
      .then(resA => {
        return res.functionB()
          .then((resB) => {
            if (resB.length > 0) {
              return functionC()
                .then(resC => {
                  console.log(resC); // successfully logged
                  return resC;
                });
            }
          });
      })
      .catch(err => console.log(err));
  });
});
Promise.all(promises).then(function (orders) {
  console.log(orders); // nothing logged
});

How can I fix?

Run This Script On Every Tab Except “Main” Tab

I have this script working well, but I’m uncertain how to make it run on every tab not labeled “Main”. Thanks in advance!

function hideRows() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getSheetByName("Dude");       // Enter sheet name

var row = s.getRange('A2:A').getValues();  // Enter column letter that has the text "hide" and  "unhide"
var cell = s.getRange('A1').getValue();

s.showRows(1, s.getMaxRows());
for(var i=0; i < row.length; i++){ if(row[i] != cell) { s.hideRows(i+2, 1); }   // Value to hide
     
}
}

Jerome

EXCEL custom functions can use ajax?

What do I want to achieve:
I want to call the interface in a custom function,Use the data returned by the interface to calculate.

actual result:
Custom functions cannot compute the correct result,always get 0.

This is my function.js code:

function add(first, second) {
  ajax_web({
    api: API_ENTITY.LOGIN,
    data: {
      domain: '01',
      user: 'dev',
      pass: 'shijinimda',
    },
  }).then(function (data) {
    return first + second;
  })
}

Did I do something wrong?If you need more documents, please ask me.

thanks a lot

How to export a JavaScript function that gets the results from an eventListenerClick?

I have a javascript file where I let the user set some values as an exported function looks something like this setValues(1,'test'). In this set call I set an eventlistener on a button to call a function document.querySelector('#spinner').addEventListener('click', spin); this calls the function spin(). I would like to get the results back from this and have the user be able to call getResults() and the user would be able to view the results from spin().

I am aiming to export both setValues() and getResults() so the user can import the module and use the functions. How can I get it so getResults will properly show the user the values?

Load a react component on button onClick

I have the following code for a button in my ReactApp to open a new window with specific size:

<button
   type="button"
   style={{ height: '20px', width: '50px' }}
   className="btn btn-primary"
   onClick={() => {
   window.open(
   "",
   "Popup",
   "width=975, height=92, top=30"
       );
     }}
 />

I want to load another component when user clicks on the button. How can I achieve that? I have tried to load the component and then use it like the following, but didn’t work:

import component from "./component"

    <button
       type="button"
       style={{ height: '20px', width: '50px' }}
       className="btn btn-primary"
       onClick={() => {
       window.open(
       "{<component />}",
       "Popup",
       "width=975, height=92, top=30"
           );
         }}
     />

What would be the best way to do this?