How to change iframe src with click event from another component in Angular 10

I want to change an iframe src when you click the menu bar. My menu bar is in another component, on which you are able to change the language in a dropdown menu. I want to change the iframe src depending on which language was clicked.

Here is my HTML menu wth a function named ‘updateSrc()’:

<nav>

<div class="select-box">
                      <div class="select-box__current" tabindex="1">
                        <div class="select-box__value" (click)="updateSrc(first_url)">
                          <input class="select-box__input" type="radio" id="0" value="1" name="Ben" checked="checked"/>
                          <p class="select-box__input-text">Es</p>
                        </div>
                        <div class="select-box__value" (click)="updateSrc(second_url)">
                          <input class="select-box__input" type="radio" id="1" value="2" name="Ben"/>
                          <p class="select-box__input-text">En</p>
                        </div>
                        <div class="select-box__value">
                          <input class="select-box__input" type="radio" id="2" value="3" name="Ben"/>
                          <p class="select-box__input-text">It</p>
                        </div>
                        <img class="select-box__icon" src="http://cdn.onlinewebfonts.com/svg/img_295694.svg" alt="Arrow Icon" aria-hidden="true"/>
                      </div>

                      <ul class="select-box__list">
                        <li>
                          <label class="select-box__option" for="0" aria-hidden="aria-hidden">Es</label>
                        </li>
                        <li>
                          <label class="select-box__option" for="1" aria-hidden="aria-hidden">En</label>
                        </li>
                        <li>
                          <a href="https://esourcecapital.it/">
                          <label class="select-box__option" aria-hidden="aria-hidden">It</label>
                          </a>
                        </li>
                      </ul>
                    </div> 

</nav>

Here is my TS file:

import { Component, OnInit } from '@angular/core';
import { DomSanitizer, SafeResourceUrl, SafeUrl } from '@angular/platform-browser';

@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.scss']
})
export class HeaderComponent implements OnInit {

  menu:boolean = false;

  constructor(private translate: TranslateService,
              private sanitizer: DomSanitizer)
    {  }

  ngOnInit(): void {

  }

  first_url = "https://www.youtube.com/embed/4oP20QZxahk";
  second_url = "https://www.youtube.com/embed/Q_ZPBqVF0_8";
  current_url: SafeUrl;

  updateSrc(url) {
    this.current_url=this.sanitizer.bypassSecurityTrustResourceUrl(url);
  }


}

And also the iframe I want to change is in another component as I said before:


<div class="center">
                            <iframe width="640" height="360" id="frame" frameborder="0" src="https://www.youtube.com/embed/4oP20QZxahk" [src]="current_url" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

<!--                            <div class="pairs">
                                <button md-button (click)="updateSrc(first_url)" id="first" class="top-link">Video en español</button>
                                <button md-button (click)="updateSrc(second_url)" id="second" class="top-link">Video in english</button>
                            </div> -->
                        </div>


if everything were in the same component it would work, but the menu is in one component and the iframe tag in another.

How to get the querystring parameters with Asto

I’m using quite a new technology called Astro (https://astro.build/) to build a completely static, server side rendered page, shipping zero JS.

I have a page with a form that is a simple text input, when the user fills this in and clicks the submit button, it sends a GET request to an astro page. The url will look something like this ….

/?search=1234

What I want to be able to do is get access to that querystring parameter in order to redirect my user to another static page /1234.

I am trying to access the quesrystring parameter with Astro.request, but the object, including the parameters attribute is completely empty.

Is there anyway to access the querystring parameters from a .astro page/file?

Create subtraction with multiple equal values

<input type="number" name="as[0][qnt1]" class="form-control valid" aria-invalid="false">
<input type="number" name="as[0][qnt2]" class="form-control valid" aria-invalid="false">
<input type="number" name="as[0][tot]" class="form-control valid" aria-invalid="false" disabled>

<input type="number" name="as[1][qnt1]" class="form-control valid" aria-invalid="false">
<input type="number" name="as[1][qnt2]" class="form-control valid" aria-invalid="false">
<input type="number" name="as[1][tot]" class="form-control valid" aria-invalid="false" disabled>

ecc

Question:

how can I go about creating a subtraction between the two fields?

How to create own api key? [closed]

I create an library for my REST API and want to send for my customers to use it, but before it I want to create an API KEY (which must be generated in main app) which must be pass to my library in the main class constructor. And right now i have a question, what is the best way to generate API KEY? Right now i create this key as JWT like below:

return jwt.sign(payload, "SECRET KEY");

but JWT is very very long, and I want to create key which will be much shorter that JWT. How is the best approach to generate KEYS? How for example Github generate API KEY for his REST API?

thanks for any help!

“Contact Microⸯⸯsoft Support 🍔‍ +1877⚧947⚧7788 🍔🍔‍ ❝Help❞❞.Microsoft.com Talk to a Person

This Help.microsoft.com +1-877-947-7788 rebuilds the data utility but doesn’t fix the help.microsoft.com. This is often a complicated issue and has required fixing as soon as possible. When this Help.microsoft.comoccurs users generally get the message, ‘Recover data file’ or ‘Your HELP.MICROSOFT.COMisn’t working. For this help.microsoft.com, the HELP.MICROSOFT.COMfile must fix and recovered. To stop this Help.microsoft.comfrom doing any damage, restore a backup copy, and then condense the company file. It’s a really Support software issue that needs immediate HELP.MICROSOFT.COMmention and will be fixed as soon as possible. How does HELP.MICROSOFT.COM +1-877-947-7788 Support Number affect? As mentioned earlier they skipped 111 Help.microsoft.comis one of the most occuCOIN.BASEing help.microsoft.coms in MS OFFICE. So it means the business or user is at constant risk of Contact of HELP.MICROSOFT.COMSupport Number HELP.MICROSOFT.COMSupport Phone Number mostly occurs within the application system because of file damage. The file must be repaired by either restoration or by replacing it with an earlier saved backup copy of the stored data. HELP.MICROSOFT.COMTECHNICAL Support phone number – However, this is often HELP.MICROSOFT.COMCustomer Support phone number software within the end and that’s why HELP.MICROSOFT.COMCustomer Support phone number sometimes it does face issues affecting the business operations of its users. An issue that’s quite common has the HELP.MICROSOFT.COM +1-877-947-7788 Support Phone Number. This Help.microsoft.comcode recovers the data that has been founded and again rebuilds the data section. losing their financial and operational data. Then they need storing in MS OFFICE. It’s imperative to make a backup of the data to stop problems in the future. Steps to resolve HELP.MICROSOFT.COMCustomer Support Phone Number Wherever there’s a problem there’s always a resolution. A similar is that the case with HELP.MICROSOFT.COM +1-877-947-7788 Support Number. Below mentioned are some steps that may help to repair can pass few tests and if your file passes these tests, then the backup of the file has automatically been created in the ADR folder. After this, the logging program of ADR transactions will invoice all the transactions quickly also as automatically. It’ll invoice all the transactions that have integrated with the file from a specific instance on HELP.MICROSOFT.COM +1-877-947-7788 Software. Once the recovering process is complete, HELP.MICROSOFT.COMaccounting software will create a duplicate of that file. But if your application is open, you’d not find any backup created. This may produce two backup duplicates and also the latest one would be 12 hours old while another would be 24 hours old. This way the oldest file would get deleted.

Uncaught SyntaxError: Unexpected identifier ? + Uncaught ReferenceError: ElementPart is not defined at HTMLButtonElement

I have 2 js files:
utils.js:

class ElementPart
{
    constructor(text)
    {
        this.text = text;
    }
}

elem.js

const btn = document.querySelector('.elem_btn');

btn.addEventListener("click", () =>
{
    const p = new ElementPart("aaaa");
    console.log(p);
})

When I load the page I get the following error:

Uncaught SyntaxError: Unexpected identifier utils.js:1

And when I click on the button:

Uncaught ReferenceError: ElementPart is not defined
    at HTMLButtonElement.<anonymous> (elem.js:5)
(anonymous) @ elem.js:5

I load the files on the html file like this:

 <script src="/utils.js"></script>
 <script src="/createelem.js"></script>

Function in React to check which component should be returned

I currently have the following code:

const renderModal = location.state?.modal ?? isModal ?? false;

const FormComponent = renderModal ? FormModal : Default;

which checks if renderAsModal is true & then returns the Modal component if so (if not, default component)

But now I have another possible modal, which I can check for like so:

const renderCustomModal: boolean =
   location.state?.modal ?? isModal ?? form.key === "UniqueKey" ?? false;

How can I update my FormComponent assignment to check for renderCustomModal as well so my CustomModal can be included in the 3 React components that can be returned? Any helpful links/ best practises would be really appreciated.

“Contact Micro··soft Support ㍐ ☎️‍ ░1877☑947☑7788░ ☎️☎️‍ ㍐㍐ ❝Support❞❞ Microsoft

This Help.microsoft.com +1-877-947-7788 rebuilds the data utility but doesn’t fix the help.microsoft.com. This is often a complicated issue and has required fixing as soon as possible. When this Help.microsoft.comoccurs users generally get the message, ‘Recover data file’ or ‘Your HELP.MICROSOFT.COMisn’t working. For this help.microsoft.com, the HELP.MICROSOFT.COMfile must fix and recovered. To stop this Help.microsoft.comfrom doing any damage, restore a backup copy, and then condense the company file. It’s a really Support software issue that needs immediate HELP.MICROSOFT.COMmention and will be fixed as soon as possible. How does HELP.MICROSOFT.COM +1-877-947-7788 Support Number affect? As mentioned earlier they skipped 111 Help.microsoft.comis one of the most occuCOIN.BASEing help.microsoft.coms in MS OFFICE. So it means the business or user is at constant risk of Contact of HELP.MICROSOFT.COMSupport Number HELP.MICROSOFT.COMSupport Phone Number mostly occurs within the application system because of file damage. The file must be repaired by either restoration or by replacing it with an earlier saved backup copy of the stored data. HELP.MICROSOFT.COMTECHNICAL Support phone number – However, this is often HELP.MICROSOFT.COMCustomer Support phone number software within the end and that’s why HELP.MICROSOFT.COMCustomer Support phone number sometimes it does face issues affecting the business operations of its users. An issue that’s quite common has the HELP.MICROSOFT.COM +1-877-947-7788 Support Phone Number. This Help.microsoft.comcode recovers the data that has been founded and again rebuilds the data section. losing their financial and operational data. Then they need storing in MS OFFICE. It’s imperative to make a backup of the data to stop problems in the future. Steps to resolve HELP.MICROSOFT.COMCustomer Support Phone Number Wherever there’s a problem there’s always a resolution. A similar is that the case with HELP.MICROSOFT.COM +1-877-947-7788 Support Number. Below mentioned are some steps that may help to repair can pass few tests and if your file passes these tests, then the backup of the file has automatically been created in the ADR folder. After this, the logging program of ADR transactions will invoice all the transactions quickly also as automatically. It’ll invoice all the transactions that have integrated with the file from a specific instance on HELP.MICROSOFT.COM +1-877-947-7788 Software. Once the recovering process is complete, HELP.MICROSOFT.COMaccounting software will create a duplicate of that file. But if your application is open, you’d not find any backup created. This may produce two backup duplicates and also the latest one would be 12 hours old while another would be 24 hours old. This way the oldest file would get deleted.

Problem with transform-translate property while i was doing the burger menu

I was trying to do the burger menu and faced some kind of ‘bug’. Burger menu shows up at width less than 780px and when ever it reaches that point all works good exept one thing.

Property transform:translate triggers every time you reach needed width and menu goes back on initial place. Hard to explain, just check the snippet and resize the width. Any suggestions?

let burgerBtn = document.querySelector(".menu_burger");
let menu = document.querySelector(".list");

burgerBtn.addEventListener('click', function() {
    burgerBtn.classList.toggle('active');
    menu.classList.toggle('active');
});
@import url(https://fonts.googleapis.com/css?family=Heebo:regular,500,700,900&display=swap);
* {
  margin: 0;
  padding: 0;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
}

a {
  text-decoration: none;
}

.container {
  max-width: 856px;
  margin: 0 auto;
}

@media (max-width: 868px) {
  .container {
    max-width: 970px;
  }
}

@media (max-width: 991.98px) {
  .container {
    max-width: none;
    padding: 0 10px;
  }
}

.header_wrap {
  max-width: 1052px;
  margin: 0 auto;
  padding: 0 10px;
}

.list {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  list-style-type: none;
  -webkit-box-pack: end;
      -ms-flex-pack: end;
          justify-content: flex-end;
  height: 70px;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  padding: 10px 0;
  margin: 0;
}

.list_link {
  font-size: 20px;
  font-weight: 500;
  color: black;
  font-family: Heebo;
  margin: 0 0 0 40px;
}

@media (min-width: 991.98px) {
  .list_link:hover {
    color: #FF6464;
    border-bottom: solid 1px #FF6464;
    -webkit-transition: 0.3s ease;
    transition: 0.3s ease;
  }
}

.menu_burger {
  display: none;
}

@media (max-width: 767px) {
  .header_wrap {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: end;
        -ms-flex-pack: end;
            justify-content: flex-end;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    height: 70px;
    padding: 0 10px 0 10px;
  }
  .list {
    position: fixed;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    left: 0;
    top: 0;
    background: rgba(205, 214, 219, 0.5);
    height: 100%;
    width: 100%;
    overflow: auto;
    -webkit-transform: translateY(-100%);
            transform: translateY(-100%);
    -webkit-transition: -webkit-transform 0.5s;
    transition: -webkit-transform 0.5s;
    transition: transform 0.5s;
    transition: transform 0.5s, -webkit-transform 0.5s;
  }
  .list.active {
    -webkit-transform: translateY(0);
            transform: translateY(0);
  }
  .list_link {
    font-size: 2.5rem;
    margin: 20px 0 20px 0;
    letter-spacing: 2px;
  }
  .menu_burger {
    display: block;
    width: 30px;
    height: 20px;
    position: relative;
    overflow: hidden;
  }
  .menu_burger span {
    width: 30px;
    height: 3px;
    top: 50%;
    left: 50%;
    position: absolute;
    background-color: black;
    -webkit-transform: translate(-50%, -50%);
            transform: translate(-50%, -50%);
    z-index: 5;
    -webkit-transition: ease 0.5s;
    transition: ease 0.5s;
  }
  .menu_burger span:nth-of-type(2) {
    top: calc(50% - 5px);
  }
  .menu_burger span:nth-of-type(3) {
    top: calc(50% + 5px);
  }
  .menu_burger.active span:first-of-type {
    -webkit-transform: translateX(100%);
            transform: translateX(100%);
  }
  .menu_burger.active span:nth-of-type(2) {
    top: 50%;
    -webkit-transform: translate(-50%, -50%) rotate(45deg);
            transform: translate(-50%, -50%) rotate(45deg);
  }
  .menu_burger.active span:nth-of-type(3) {
    top: 50%;
    -webkit-transform: translate(-50%, -50%) rotate(-45deg);
            transform: translate(-50%, -50%) rotate(-45deg);
  }
}
/*# sourceMappingURL=style.css.map */
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Homepage</title>
    <link rel="stylesheet" href="./scss/style.css">
</head>

<body>
    <div class="wrapper">
        <header class="header">
            <div class="header_wrap">
                
                <ul class="list ">
                    <li><a class="list_link" href="">Works</a></li>
                    <li><a class="list_link" href="">Blog</a></li>
                    <li><a class="list_link" href="">Contact</a></li>
                </ul>
                <div class="menu_burger">
                    <span></span>
                    <span></span>
                    <span></span>
                    
                </div>
            </div>
        </header>
        <main>

        </main>
    </div>
    <script src="/app.js" ></script>
</body>

</html>

How can i write the basic tests for this function with react testing library?

This is the function


import { FormikHelpers } from 'formik';
import { v4 as uuid } from 'uuid';

import { Option } from '@pro4all/shared/ui';

export function splitAndAddToValues(
  name: string,
  value: string,
  currentRecipients?: Option[],
  setFieldValue?: FormikHelpers<unknown>['setFieldValue'],
  setFieldTouched?: FormikHelpers<unknown>['setFieldTouched']
) {
  if (!/[ ,;]/.test(value)) return;

  // Return true if address already exists in field
  const findDuplicate = (address: string) =>
    currentRecipients.find((recipient) => recipient.inputValue === address);

  // Remove duplicates from pasted text
  const toUniqueArray = (addresses: string[]) => [...new Set(addresses)];

  // Pasted text is parsed as addresses delimited by whitespace, semi colon or comma
  const uniqueAddresses = toUniqueArray(
    value
      ?.split(/[s;,]+/)
      .filter(Boolean)
      .filter((address) => !findDuplicate(address))
  );

  const nextRecipients: Option[] = uniqueAddresses.map((address) => ({
    id: uuid(),
    inputValue: address,
    label: address,
  }));

  // Force the state updates to the form/components to the end of the browser's
  // event loop.
  setTimeout(() => {
    // As long as we setValue() in a timed callback, the change triggered in the input will hide and clear autocomplete
    setFieldValue(name, [...currentRecipients, ...nextRecipients]);

    // Touch to trigger validation
    setFieldTouched(name);
  }, 0);
}

And this is the basic test.

import { splitAndAddToValues } from './splitAndAddToValues';

    const name = 'admins';
    const singleValue = '[email protected]';
    const multipleValues = '[email protected] [email protected]';
    test('Return one value if there is no comma, semicolon or space', () => {
    expect(splitAndAddToValues(name, singleValue)).toHaveLength(2);
});

The problem is that if i call my fn with one value it returns undefined.
And if i call it with 2 values it tells me that the param address is not recognized, but the value is called below…
i don’t know if it is a hoisting problem
or a setTimeOut problem…i am kind of lost here

I’m trying to work with notifications but I’m getting a text that contains my localhost wrapped in element and I don’t know where it’s coming from

I have the following function which creates a notification:

displayNotification(title: string, msg: string, avatarUrl: string, room: Room) {
    const notifBody = {
        body: msg,
    };
    if (avatarUrl) notifBody['icon'] = avatarUrl;
    const notification = new window.Notification(title, notifBody);

    notification.onclick = function() {
        dis.dispatch({
            action: 'view_room',
            room_id: room.roomId,
        });
        window.focus();
        notification.close();
    };

    return notification;
}

As you can see, when I’m creating the notification I pass a title and body to it. The title contains Bozhidar3 and the body contains Test Message so I expect the notification to only have these 2 fields alongside an icon. What actually happens is that I see this:

enter image description here

I can see my localhost wrapped around <a></a> tag and I have no idea where is it coming from. I went through all the notification instance properties here – https://developer.mozilla.org/en-US/docs/Web/API/notification but I couldn’t figure out what might this be. Does anyone have an educated guess where this might be coming from?I’m using Chrome on Linux.

How can I properly encode a GLTF while also preserving the encoding of other meshes and textures?

I’m building a web ar app that allows users to wear GLTF head models. (https://www.head5.camera/) In order to get the correct lighting on the GLTF, I have set renderer.outputEncoding = THREE.sRGBEncoding and this works great BUT it also adjusts the lighting of my THREE.VideoTexture from my video stream. Is there a way to encode just the GLTF but preserve the LinearEncoding? of the rest of the scene. Any help is much appreciated.

Here’s an example of what I mean:

Head5 photo with light background

The background is lighter than it is supposed to be because it is also being encoded.