kandi background
Explore Kits

mist | use Ðapps on the Ethereum network | Cryptocurrency library

 by   ethereum JavaScript Version: v0.11.1 License: GPL-3.0

 by   ethereum JavaScript Version: v0.11.1 License: GPL-3.0

Download this library from

kandi X-RAY | mist Summary

mist is a JavaScript library typically used in Financial Services, Fintech, Blockchain, Cryptocurrency, Ethereum, React, Electron, Meteor applications. mist has no bugs, it has no vulnerabilities, it has a Strong Copyleft License and it has medium support. You can install using 'npm i rue-mist-interface' or download it from GitHub, npm.
Mist and Ethereum Wallet have been deprecated. See the announcement and view the migration guide. The Mist browser is the tool of choice to browse and use Ðapps. For the Mist API see MISTAPI.md. This repository is also the Electron host for the Meteor-based wallet dapp.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • mist has a medium active ecosystem.
  • It has 7347 star(s) with 2008 fork(s). There are 733 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 779 open issues and 2335 have been closed. On average issues are closed in 161 days. There are 5 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of mist is v0.11.1
mist Support
Best in #Cryptocurrency
Average in #Cryptocurrency
mist Support
Best in #Cryptocurrency
Average in #Cryptocurrency

quality kandi Quality

  • mist has 0 bugs and 0 code smells.
mist Quality
Best in #Cryptocurrency
Average in #Cryptocurrency
mist Quality
Best in #Cryptocurrency
Average in #Cryptocurrency

securitySecurity

  • mist has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • mist code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
mist Security
Best in #Cryptocurrency
Average in #Cryptocurrency
mist Security
Best in #Cryptocurrency
Average in #Cryptocurrency

license License

  • mist is licensed under the GPL-3.0 License. This license is Strong Copyleft.
  • Strong Copyleft licenses enforce sharing, and you can use them when creating open source projects.
mist License
Best in #Cryptocurrency
Average in #Cryptocurrency
mist License
Best in #Cryptocurrency
Average in #Cryptocurrency

buildReuse

  • mist releases are available to install and integrate.
  • Deployable package is available in npm.
  • Installation instructions, examples and code snippets are available.
mist Reuse
Best in #Cryptocurrency
Average in #Cryptocurrency
mist Reuse
Best in #Cryptocurrency
Average in #Cryptocurrency
Top functions reviewed by kandi - BETA

Coming Soon for all Libraries!

Currently covering the most popular Java, JavaScript and Python libraries. See a SAMPLE HERE.
kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.

mist Key Features

[DEPRECATED] Mist. Browse and use Ðapps on the Ethereum network.

Installation

copy iconCopydownload iconDownload
apt-get install libgconf2-4

Dependencies

copy iconCopydownload iconDownload
$ curl https://install.meteor.com/ | sh
$ curl -o- -L https://yarnpkg.com/install.sh | bash

Initialization

copy iconCopydownload iconDownload
$ git clone https://github.com/ethereum/mist.git
$ cd mist
$ git submodule update --init --recursive
$ yarn

Run Mist

copy iconCopydownload iconDownload
$ yarn dev:meteor

Run the Wallet

copy iconCopydownload iconDownload
$ yarn dev:meteor

Connect your own node

copy iconCopydownload iconDownload
$ yarn dev:electron --rpc path/to/geth.ipc

Passing options to Geth

copy iconCopydownload iconDownload
$ yarn dev:electron --mode mist --node-rpcport 19343 --node-networkid 2

Creating a local private net

copy iconCopydownload iconDownload
geth --dev

Deployment

copy iconCopydownload iconDownload
$ yarn build:mist

Testing

copy iconCopydownload iconDownload
$ yarn build:mist

Discord.js "undefined" before first array object in embed

copy iconCopydownload iconDownload
let { localroad, routeroad, privateplace, publicplace } = ``;
let localroad, routeroad, privateplace, publicplace
localroad = routeroad = privateplace = publicplace = ""
let localroad = citydb["roads-local"].join("")
let routeroad = citydb["roads-route"].join("")
let privateplace = citydb["places-private"].join("")
let publicplace = citydb["places-public"].join("")
-----------------------
let { localroad, routeroad, privateplace, publicplace } = ``;
let localroad, routeroad, privateplace, publicplace
localroad = routeroad = privateplace = publicplace = ""
let localroad = citydb["roads-local"].join("")
let routeroad = citydb["roads-route"].join("")
let privateplace = citydb["places-private"].join("")
let publicplace = citydb["places-public"].join("")
-----------------------
let { localroad, routeroad, privateplace, publicplace } = ``;
let localroad, routeroad, privateplace, publicplace
localroad = routeroad = privateplace = publicplace = ""
let localroad = citydb["roads-local"].join("")
let routeroad = citydb["roads-route"].join("")
let privateplace = citydb["places-private"].join("")
let publicplace = citydb["places-public"].join("")

How can I define my Solidity contract as a javascript object?

copy iconCopydownload iconDownload
<!DOCTYPE html>
<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.3.5/web3.min.js" integrity="sha512-S/O+gH5szs/+/dUylm15Jp/JZJsIoWlpSVMwT6yAS4Rh7kazaRUxSzFBwnqE2/jBphcr7xovTQJaopiEZAzi+A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
        
        <script type="text/javascript">
            
            let web3js;
 ---------> var newContract;
            function startApp() {            
                var address = "...";
                const jsoninterface = [
                
                    {
                        "inputs": [
                            {
                                "internalType": "string",
                                "name": "_newMessage",
                                "type": "string"
                            }
                        ],
                        "name": "setMessage",
                        "outputs": [],
                        "stateMutability": "nonpayable",
                        "type": "function"
                    },
                   
                    {
                        "inputs": [],
                        "name": "message",
                        "outputs": [
                            {
                                "internalType": "string",
                                "name": "",
                                "type": "string"
                            }
                        ],
                        "stateMutability": "view",
                        "type": "function"
                    }
                ]
  ---------> window.newContract = new web3js.eth.Contract(jsoninterface, address);
                if (typeof newContract === 'object' && typeof newContract !== 'undefined' && newContract !== null){
                    console.log("contract created")
                } else {
                    console.log("contract not created")
                }
            }
            window.addEventListener('load', function() {

                // Checking if Web3 has been injected by the browser (Mist/MetaMask)
                if (typeof web3 !== 'undefined') {
                // Use Mist/MetaMask's provider
                web3js = new Web3(web3.currentProvider);
                } else {
                    alert("Please install Metamask to continue");
                // Handle the case where the user doesn't have Metamask installed
                // Probably show them a message prompting them to install Metamask
                }

                // Now you can start your app & access web3 freely:
                startApp();
                console.log('startapp finished')
            })

            function showMessage(){
                var retval = window.newContract.methods.message().call();
                console.log(retval);
            }

        </script>
    </head>
    <body>
        <!-- the content goes here -->
        <button onclick="showMessage()">click here</button>
    </body>
</html>

I have an image gallery and i want to open each image using modal when click on each

copy iconCopydownload iconDownload
var img = document.querySelectorAll(".column img");
img.forEach((imgA)=>{
    imgA.onclick = function(){
      modal.style.display = "block";
      modalImg.src = this.src;
      captionText.innerHTML = this.alt;
    }
});
// Get the modal
var modal = document.getElementById("myModal");
// Get the image and insert it inside the modal - use its "alt" text as a caption
var img = document.querySelectorAll(".column img");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption-gallery-fu-sc");

img.forEach((imgA)=>{
    imgA.onclick = function(){
  modal.style.display = "block";
  modalImg.src = this.src;
  captionText.innerHTML = this.alt;
}
});

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close-gallery-fu-sc")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() { 
  modal.style.display = "none";
}
.row {
  display: -ms-flexbox; /* IE 10 */
  display: flex;
  -ms-flex-wrap: wrap; /* IE 10 */
  flex-wrap: wrap;
  padding: 0 4px;
}

/* Create two equal columns that sits next to each other */
.column {
  -ms-flex: 50%; /* IE 10 */
  flex: 50%;
  padding: 60px 4px;
}

.column img {
  margin-top: 8px;
  vertical-align: middle;
}
/* Style the Image Used to Trigger the Modal */
#image-gall-1,#image-gall-2,#image-gall-3,#image-gall-4,#image-gall-5,#image-gall-6,#image-gall-7,#image-gall-8,#image-gall-9,#image-gall-10,#image-gall-11,#image-gall-12,#image-gall-13 {
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}
#image-gall-1:hover, #image-gall-2:hover, #image-gall-3:hover, #image-gall-4:hover, #image-gall-5:hover,#image-gall-6:hover, #image-gall-7:hover, #image-gall-8:hover, #image-gall-9:hover, #image-gall-10:hover, #image-gall-11:hover, #image-gall-12:hover, #image-gall-13:hover {opacity: 0.7;}
/* The Modal (background) */
.modal-gallery-fu-sc {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  padding-top: 100px; /* Location of the box */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0,0,0); /* Fallback color */
  background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
/* Modal Content (Image) */
.modal-content-gallery-fu-sc {
  padding-top:80px;
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
}
/* Caption of Modal Image (Image Text) - Same Width as the Image */
#caption-gallery-fu-sc {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
  height: 150px;
}
/* Add Animation */
.modal-content-gallery-fu-sc, #caption-gallery-fu-sc {  
  -webkit-animation-name: zoom;
  -webkit-animation-duration: 0.6s;
  animation-name: zoom;
  animation-duration: 0.6s;
}
@-webkit-keyframes zoom {
  from {-webkit-transform:scale(0)} 
  to {-webkit-transform:scale(1)}
}
@keyframes zoom {
  from {transform:scale(0)} 
  to {transform:scale(1)}
}
/* The Close Button */
.close-gallery-fu-sc {
  position: absolute;
  top: 85px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
}
.close-gallery-fu-sc:hover,
.close-gallery-fu-sc:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}
/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
  .modal-content-gallery-fu-sc {
    width: 100%;
  }
}
<div class="container">
<!-- The Modal -->
<div id="myModal" class="modal-gallery-fu-sc">
  <!-- The Close Button -->
  <span class="close-gallery-fu-sc">×</span>
  <!-- Modal Content (The Image) -->
  <img class="modal-content-gallery-fu-sc" id="img01">
  <!-- Modal Caption (Image Text) -->
  <div id="caption-gallery-fu-sc"></div>
</div>

<!-- Photo Grid -->
<div class="row"> 
  <div class="column">
    <img id="image-gall-1" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
    <img id="image-gall-2" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
    <img id="image-gall-3" src="https://www.w3schools.com/w3images/falls2.jpg" alt="falls2" style="width:100%">
    <img id="image-gall-4" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
    <img id="image-gall-5" src="https://www.w3schools.com/w3images/nature.jpg" alt="nature" style="width:100%">
    <img id="image-gall-6" src="https://www.w3schools.com/w3images/mist.jpg" alt="mist" style="width:100%">
    <img id="image-gall-7" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
  </div>
  <div class="column">
    <img id="image-gall-8" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
    <img id="image-gall-9" src="https://www.w3schools.com/w3images/ocean.jpg" alt="ocean" style="width:100%">
    <img id="image-gall-10" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
    <img id="image-gall-11" src="https://www.w3schools.com/w3images/mountainskies.jpg" alt="" style="width:100%">
    <img id="image-gall-12" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
    <img id="image-gall-13" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
  </div>
</div>
</div>
-----------------------
var img = document.querySelectorAll(".column img");
img.forEach((imgA)=>{
    imgA.onclick = function(){
      modal.style.display = "block";
      modalImg.src = this.src;
      captionText.innerHTML = this.alt;
    }
});
// Get the modal
var modal = document.getElementById("myModal");
// Get the image and insert it inside the modal - use its "alt" text as a caption
var img = document.querySelectorAll(".column img");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption-gallery-fu-sc");

img.forEach((imgA)=>{
    imgA.onclick = function(){
  modal.style.display = "block";
  modalImg.src = this.src;
  captionText.innerHTML = this.alt;
}
});

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close-gallery-fu-sc")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() { 
  modal.style.display = "none";
}
.row {
  display: -ms-flexbox; /* IE 10 */
  display: flex;
  -ms-flex-wrap: wrap; /* IE 10 */
  flex-wrap: wrap;
  padding: 0 4px;
}

/* Create two equal columns that sits next to each other */
.column {
  -ms-flex: 50%; /* IE 10 */
  flex: 50%;
  padding: 60px 4px;
}

.column img {
  margin-top: 8px;
  vertical-align: middle;
}
/* Style the Image Used to Trigger the Modal */
#image-gall-1,#image-gall-2,#image-gall-3,#image-gall-4,#image-gall-5,#image-gall-6,#image-gall-7,#image-gall-8,#image-gall-9,#image-gall-10,#image-gall-11,#image-gall-12,#image-gall-13 {
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}
#image-gall-1:hover, #image-gall-2:hover, #image-gall-3:hover, #image-gall-4:hover, #image-gall-5:hover,#image-gall-6:hover, #image-gall-7:hover, #image-gall-8:hover, #image-gall-9:hover, #image-gall-10:hover, #image-gall-11:hover, #image-gall-12:hover, #image-gall-13:hover {opacity: 0.7;}
/* The Modal (background) */
.modal-gallery-fu-sc {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  padding-top: 100px; /* Location of the box */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0,0,0); /* Fallback color */
  background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
/* Modal Content (Image) */
.modal-content-gallery-fu-sc {
  padding-top:80px;
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
}
/* Caption of Modal Image (Image Text) - Same Width as the Image */
#caption-gallery-fu-sc {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
  height: 150px;
}
/* Add Animation */
.modal-content-gallery-fu-sc, #caption-gallery-fu-sc {  
  -webkit-animation-name: zoom;
  -webkit-animation-duration: 0.6s;
  animation-name: zoom;
  animation-duration: 0.6s;
}
@-webkit-keyframes zoom {
  from {-webkit-transform:scale(0)} 
  to {-webkit-transform:scale(1)}
}
@keyframes zoom {
  from {transform:scale(0)} 
  to {transform:scale(1)}
}
/* The Close Button */
.close-gallery-fu-sc {
  position: absolute;
  top: 85px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
}
.close-gallery-fu-sc:hover,
.close-gallery-fu-sc:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}
/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
  .modal-content-gallery-fu-sc {
    width: 100%;
  }
}
<div class="container">
<!-- The Modal -->
<div id="myModal" class="modal-gallery-fu-sc">
  <!-- The Close Button -->
  <span class="close-gallery-fu-sc">×</span>
  <!-- Modal Content (The Image) -->
  <img class="modal-content-gallery-fu-sc" id="img01">
  <!-- Modal Caption (Image Text) -->
  <div id="caption-gallery-fu-sc"></div>
</div>

<!-- Photo Grid -->
<div class="row"> 
  <div class="column">
    <img id="image-gall-1" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
    <img id="image-gall-2" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
    <img id="image-gall-3" src="https://www.w3schools.com/w3images/falls2.jpg" alt="falls2" style="width:100%">
    <img id="image-gall-4" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
    <img id="image-gall-5" src="https://www.w3schools.com/w3images/nature.jpg" alt="nature" style="width:100%">
    <img id="image-gall-6" src="https://www.w3schools.com/w3images/mist.jpg" alt="mist" style="width:100%">
    <img id="image-gall-7" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
  </div>
  <div class="column">
    <img id="image-gall-8" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
    <img id="image-gall-9" src="https://www.w3schools.com/w3images/ocean.jpg" alt="ocean" style="width:100%">
    <img id="image-gall-10" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
    <img id="image-gall-11" src="https://www.w3schools.com/w3images/mountainskies.jpg" alt="" style="width:100%">
    <img id="image-gall-12" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
    <img id="image-gall-13" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
  </div>
</div>
</div>
-----------------------
var img = document.querySelectorAll(".column img");
img.forEach((imgA)=>{
    imgA.onclick = function(){
      modal.style.display = "block";
      modalImg.src = this.src;
      captionText.innerHTML = this.alt;
    }
});
// Get the modal
var modal = document.getElementById("myModal");
// Get the image and insert it inside the modal - use its "alt" text as a caption
var img = document.querySelectorAll(".column img");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption-gallery-fu-sc");

img.forEach((imgA)=>{
    imgA.onclick = function(){
  modal.style.display = "block";
  modalImg.src = this.src;
  captionText.innerHTML = this.alt;
}
});

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close-gallery-fu-sc")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() { 
  modal.style.display = "none";
}
.row {
  display: -ms-flexbox; /* IE 10 */
  display: flex;
  -ms-flex-wrap: wrap; /* IE 10 */
  flex-wrap: wrap;
  padding: 0 4px;
}

/* Create two equal columns that sits next to each other */
.column {
  -ms-flex: 50%; /* IE 10 */
  flex: 50%;
  padding: 60px 4px;
}

.column img {
  margin-top: 8px;
  vertical-align: middle;
}
/* Style the Image Used to Trigger the Modal */
#image-gall-1,#image-gall-2,#image-gall-3,#image-gall-4,#image-gall-5,#image-gall-6,#image-gall-7,#image-gall-8,#image-gall-9,#image-gall-10,#image-gall-11,#image-gall-12,#image-gall-13 {
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}
#image-gall-1:hover, #image-gall-2:hover, #image-gall-3:hover, #image-gall-4:hover, #image-gall-5:hover,#image-gall-6:hover, #image-gall-7:hover, #image-gall-8:hover, #image-gall-9:hover, #image-gall-10:hover, #image-gall-11:hover, #image-gall-12:hover, #image-gall-13:hover {opacity: 0.7;}
/* The Modal (background) */
.modal-gallery-fu-sc {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  padding-top: 100px; /* Location of the box */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0,0,0); /* Fallback color */
  background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
/* Modal Content (Image) */
.modal-content-gallery-fu-sc {
  padding-top:80px;
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
}
/* Caption of Modal Image (Image Text) - Same Width as the Image */
#caption-gallery-fu-sc {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
  height: 150px;
}
/* Add Animation */
.modal-content-gallery-fu-sc, #caption-gallery-fu-sc {  
  -webkit-animation-name: zoom;
  -webkit-animation-duration: 0.6s;
  animation-name: zoom;
  animation-duration: 0.6s;
}
@-webkit-keyframes zoom {
  from {-webkit-transform:scale(0)} 
  to {-webkit-transform:scale(1)}
}
@keyframes zoom {
  from {transform:scale(0)} 
  to {transform:scale(1)}
}
/* The Close Button */
.close-gallery-fu-sc {
  position: absolute;
  top: 85px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
}
.close-gallery-fu-sc:hover,
.close-gallery-fu-sc:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}
/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
  .modal-content-gallery-fu-sc {
    width: 100%;
  }
}
<div class="container">
<!-- The Modal -->
<div id="myModal" class="modal-gallery-fu-sc">
  <!-- The Close Button -->
  <span class="close-gallery-fu-sc">×</span>
  <!-- Modal Content (The Image) -->
  <img class="modal-content-gallery-fu-sc" id="img01">
  <!-- Modal Caption (Image Text) -->
  <div id="caption-gallery-fu-sc"></div>
</div>

<!-- Photo Grid -->
<div class="row"> 
  <div class="column">
    <img id="image-gall-1" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
    <img id="image-gall-2" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
    <img id="image-gall-3" src="https://www.w3schools.com/w3images/falls2.jpg" alt="falls2" style="width:100%">
    <img id="image-gall-4" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
    <img id="image-gall-5" src="https://www.w3schools.com/w3images/nature.jpg" alt="nature" style="width:100%">
    <img id="image-gall-6" src="https://www.w3schools.com/w3images/mist.jpg" alt="mist" style="width:100%">
    <img id="image-gall-7" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
  </div>
  <div class="column">
    <img id="image-gall-8" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
    <img id="image-gall-9" src="https://www.w3schools.com/w3images/ocean.jpg" alt="ocean" style="width:100%">
    <img id="image-gall-10" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
    <img id="image-gall-11" src="https://www.w3schools.com/w3images/mountainskies.jpg" alt="" style="width:100%">
    <img id="image-gall-12" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
    <img id="image-gall-13" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
  </div>
</div>
</div>
-----------------------
var img = document.querySelectorAll(".column img");
img.forEach((imgA)=>{
    imgA.onclick = function(){
      modal.style.display = "block";
      modalImg.src = this.src;
      captionText.innerHTML = this.alt;
    }
});
// Get the modal
var modal = document.getElementById("myModal");
// Get the image and insert it inside the modal - use its "alt" text as a caption
var img = document.querySelectorAll(".column img");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption-gallery-fu-sc");

img.forEach((imgA)=>{
    imgA.onclick = function(){
  modal.style.display = "block";
  modalImg.src = this.src;
  captionText.innerHTML = this.alt;
}
});

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close-gallery-fu-sc")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() { 
  modal.style.display = "none";
}
.row {
  display: -ms-flexbox; /* IE 10 */
  display: flex;
  -ms-flex-wrap: wrap; /* IE 10 */
  flex-wrap: wrap;
  padding: 0 4px;
}

/* Create two equal columns that sits next to each other */
.column {
  -ms-flex: 50%; /* IE 10 */
  flex: 50%;
  padding: 60px 4px;
}

.column img {
  margin-top: 8px;
  vertical-align: middle;
}
/* Style the Image Used to Trigger the Modal */
#image-gall-1,#image-gall-2,#image-gall-3,#image-gall-4,#image-gall-5,#image-gall-6,#image-gall-7,#image-gall-8,#image-gall-9,#image-gall-10,#image-gall-11,#image-gall-12,#image-gall-13 {
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}
#image-gall-1:hover, #image-gall-2:hover, #image-gall-3:hover, #image-gall-4:hover, #image-gall-5:hover,#image-gall-6:hover, #image-gall-7:hover, #image-gall-8:hover, #image-gall-9:hover, #image-gall-10:hover, #image-gall-11:hover, #image-gall-12:hover, #image-gall-13:hover {opacity: 0.7;}
/* The Modal (background) */
.modal-gallery-fu-sc {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  padding-top: 100px; /* Location of the box */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0,0,0); /* Fallback color */
  background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
/* Modal Content (Image) */
.modal-content-gallery-fu-sc {
  padding-top:80px;
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
}
/* Caption of Modal Image (Image Text) - Same Width as the Image */
#caption-gallery-fu-sc {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
  height: 150px;
}
/* Add Animation */
.modal-content-gallery-fu-sc, #caption-gallery-fu-sc {  
  -webkit-animation-name: zoom;
  -webkit-animation-duration: 0.6s;
  animation-name: zoom;
  animation-duration: 0.6s;
}
@-webkit-keyframes zoom {
  from {-webkit-transform:scale(0)} 
  to {-webkit-transform:scale(1)}
}
@keyframes zoom {
  from {transform:scale(0)} 
  to {transform:scale(1)}
}
/* The Close Button */
.close-gallery-fu-sc {
  position: absolute;
  top: 85px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
}
.close-gallery-fu-sc:hover,
.close-gallery-fu-sc:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}
/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
  .modal-content-gallery-fu-sc {
    width: 100%;
  }
}
<div class="container">
<!-- The Modal -->
<div id="myModal" class="modal-gallery-fu-sc">
  <!-- The Close Button -->
  <span class="close-gallery-fu-sc">×</span>
  <!-- Modal Content (The Image) -->
  <img class="modal-content-gallery-fu-sc" id="img01">
  <!-- Modal Caption (Image Text) -->
  <div id="caption-gallery-fu-sc"></div>
</div>

<!-- Photo Grid -->
<div class="row"> 
  <div class="column">
    <img id="image-gall-1" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
    <img id="image-gall-2" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
    <img id="image-gall-3" src="https://www.w3schools.com/w3images/falls2.jpg" alt="falls2" style="width:100%">
    <img id="image-gall-4" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
    <img id="image-gall-5" src="https://www.w3schools.com/w3images/nature.jpg" alt="nature" style="width:100%">
    <img id="image-gall-6" src="https://www.w3schools.com/w3images/mist.jpg" alt="mist" style="width:100%">
    <img id="image-gall-7" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
  </div>
  <div class="column">
    <img id="image-gall-8" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
    <img id="image-gall-9" src="https://www.w3schools.com/w3images/ocean.jpg" alt="ocean" style="width:100%">
    <img id="image-gall-10" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
    <img id="image-gall-11" src="https://www.w3schools.com/w3images/mountainskies.jpg" alt="" style="width:100%">
    <img id="image-gall-12" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
    <img id="image-gall-13" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
  </div>
</div>
</div>
-----------------------
var img = document.querySelectorAll(".column img");
img.forEach((imgA)=>{
    imgA.onclick = function(){
      modal.style.display = "block";
      modalImg.src = this.src;
      captionText.innerHTML = this.alt;
    }
});
// Get the modal
var modal = document.getElementById("myModal");
// Get the image and insert it inside the modal - use its "alt" text as a caption
var img = document.querySelectorAll(".column img");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption-gallery-fu-sc");

img.forEach((imgA)=>{
    imgA.onclick = function(){
  modal.style.display = "block";
  modalImg.src = this.src;
  captionText.innerHTML = this.alt;
}
});

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close-gallery-fu-sc")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() { 
  modal.style.display = "none";
}
.row {
  display: -ms-flexbox; /* IE 10 */
  display: flex;
  -ms-flex-wrap: wrap; /* IE 10 */
  flex-wrap: wrap;
  padding: 0 4px;
}

/* Create two equal columns that sits next to each other */
.column {
  -ms-flex: 50%; /* IE 10 */
  flex: 50%;
  padding: 60px 4px;
}

.column img {
  margin-top: 8px;
  vertical-align: middle;
}
/* Style the Image Used to Trigger the Modal */
#image-gall-1,#image-gall-2,#image-gall-3,#image-gall-4,#image-gall-5,#image-gall-6,#image-gall-7,#image-gall-8,#image-gall-9,#image-gall-10,#image-gall-11,#image-gall-12,#image-gall-13 {
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}
#image-gall-1:hover, #image-gall-2:hover, #image-gall-3:hover, #image-gall-4:hover, #image-gall-5:hover,#image-gall-6:hover, #image-gall-7:hover, #image-gall-8:hover, #image-gall-9:hover, #image-gall-10:hover, #image-gall-11:hover, #image-gall-12:hover, #image-gall-13:hover {opacity: 0.7;}
/* The Modal (background) */
.modal-gallery-fu-sc {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  padding-top: 100px; /* Location of the box */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0,0,0); /* Fallback color */
  background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
/* Modal Content (Image) */
.modal-content-gallery-fu-sc {
  padding-top:80px;
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
}
/* Caption of Modal Image (Image Text) - Same Width as the Image */
#caption-gallery-fu-sc {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
  height: 150px;
}
/* Add Animation */
.modal-content-gallery-fu-sc, #caption-gallery-fu-sc {  
  -webkit-animation-name: zoom;
  -webkit-animation-duration: 0.6s;
  animation-name: zoom;
  animation-duration: 0.6s;
}
@-webkit-keyframes zoom {
  from {-webkit-transform:scale(0)} 
  to {-webkit-transform:scale(1)}
}
@keyframes zoom {
  from {transform:scale(0)} 
  to {transform:scale(1)}
}
/* The Close Button */
.close-gallery-fu-sc {
  position: absolute;
  top: 85px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
}
.close-gallery-fu-sc:hover,
.close-gallery-fu-sc:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}
/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
  .modal-content-gallery-fu-sc {
    width: 100%;
  }
}
<div class="container">
<!-- The Modal -->
<div id="myModal" class="modal-gallery-fu-sc">
  <!-- The Close Button -->
  <span class="close-gallery-fu-sc">×</span>
  <!-- Modal Content (The Image) -->
  <img class="modal-content-gallery-fu-sc" id="img01">
  <!-- Modal Caption (Image Text) -->
  <div id="caption-gallery-fu-sc"></div>
</div>

<!-- Photo Grid -->
<div class="row"> 
  <div class="column">
    <img id="image-gall-1" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
    <img id="image-gall-2" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
    <img id="image-gall-3" src="https://www.w3schools.com/w3images/falls2.jpg" alt="falls2" style="width:100%">
    <img id="image-gall-4" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
    <img id="image-gall-5" src="https://www.w3schools.com/w3images/nature.jpg" alt="nature" style="width:100%">
    <img id="image-gall-6" src="https://www.w3schools.com/w3images/mist.jpg" alt="mist" style="width:100%">
    <img id="image-gall-7" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
  </div>
  <div class="column">
    <img id="image-gall-8" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
    <img id="image-gall-9" src="https://www.w3schools.com/w3images/ocean.jpg" alt="ocean" style="width:100%">
    <img id="image-gall-10" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
    <img id="image-gall-11" src="https://www.w3schools.com/w3images/mountainskies.jpg" alt="" style="width:100%">
    <img id="image-gall-12" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
    <img id="image-gall-13" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
  </div>
</div>
</div>
-----------------------
var images = document.getElementById("image-gall");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption-gallery-fu-sc");    
for (var i = 0; i < images.length; ++i) {
    var img = images[i];
    img.onclick = function() {
        modal.style.display = "block";
        modalImg.src = this.src;
        captionText.innerHTML = this.alt;
    }
}
// Get the modal
var modal = document.getElementById("myModal");
// Get the image and insert it inside the modal - use its "alt" text as a caption
var images = document.getElementsByClassName("image-gall");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption-gallery-fu-sc");    
for (var i = 0; i < images.length; ++i) {
    var img = images[i];
    img.onclick = function() {
        modal.style.display = "block";
        modalImg.src = this.src;
        captionText.innerHTML = this.alt;
    }
}
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close-gallery-fu-sc")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() { 
    modal.style.display = "none";
}
.row {
    display: -ms-flexbox; /* IE 10 */
    display: flex;
    -ms-flex-wrap: wrap; /* IE 10 */
    flex-wrap: wrap;
    padding: 0 4px;
}

/* Create two equal columns that sits next to each other */
.column {
    -ms-flex: 50%; /* IE 10 */
    flex: 50%;
    padding: 60px 4px;
}

.column img {
    margin-top: 8px;
    vertical-align: middle;
}
/* Style the Image Used to Trigger the Modal */
#image-gall-1,#image-gall-2,#image-gall-3,#image-gall-4,#image-gall-5,#image-gall-6,#image-gall-7,#image-gall-8,#image-gall-9,#image-gall-10,#image-gall-11,#image-gall-12,#image-gall-13 {
    border-radius: 5px;
    cursor: pointer;
    transition: 0.3s;
}
#image-gall-1:hover, #image-gall-2:hover, #image-gall-3:hover, #image-gall-4:hover, #image-gall-5:hover,#image-gall-6:hover, #image-gall-7:hover, #image-gall-8:hover, #image-gall-9:hover, #image-gall-10:hover, #image-gall-11:hover, #image-gall-12:hover, #image-gall-13:hover {opacity: 0.7;}
/* The Modal (background) */
.modal-gallery-fu-sc {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    padding-top: 100px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
/* Modal Content (Image) */
.modal-content-gallery-fu-sc {
    padding-top:80px;
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
}
/* Caption of Modal Image (Image Text) - Same Width as the Image */
#caption-gallery-fu-sc {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    height: 150px;
}
/* Add Animation */
.modal-content-gallery-fu-sc, #caption-gallery-fu-sc {  
    -webkit-animation-name: zoom;
    -webkit-animation-duration: 0.6s;
    animation-name: zoom;
    animation-duration: 0.6s;
}
@-webkit-keyframes zoom {
    from {-webkit-transform:scale(0)} 
    to {-webkit-transform:scale(1)}
}
@keyframes zoom {
    from {transform:scale(0)} 
    to {transform:scale(1)}
}
/* The Close Button */
.close-gallery-fu-sc {
    position: absolute;
    top: 85px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}
.close-gallery-fu-sc:hover,
.close-gallery-fu-sc:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}
/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
    .modal-content-gallery-fu-sc {
        width: 100%;
    }
}
<div class="container">
    <!-- The Modal -->
    <div id="myModal" class="modal-gallery-fu-sc">
        <!-- The Close Button -->
        <span class="close-gallery-fu-sc">×</span>
        <!-- Modal Content (The Image) -->
        <img class="modal-content-gallery-fu-sc" id="img01">
        <!-- Modal Caption (Image Text) -->
        <div id="caption-gallery-fu-sc"></div>
    </div>

    <!-- Photo Grid -->
    <div class="row"> 
        <div class="column">
            <img id="image-gall-1" class="image-gall" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
            <img id="image-gall-2" class="image-gall" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
            <img id="image-gall-3" class="image-gall" src="https://www.w3schools.com/w3images/falls2.jpg" alt="falls2" style="width:100%">
            <img id="image-gall-4" class="image-gall" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
            <img id="image-gall-5" class="image-gall" src="https://www.w3schools.com/w3images/nature.jpg" alt="nature" style="width:100%">
            <img id="image-gall-6" class="image-gall" src="https://www.w3schools.com/w3images/mist.jpg" alt="mist" style="width:100%">
            <img id="image-gall-7" class="image-gall" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
        </div>
        <div class="column">
            <img id="image-gall-8" class="image-gall" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
            <img id="image-gall-9" class="image-gall" src="https://www.w3schools.com/w3images/ocean.jpg" alt="ocean" style="width:100%">
            <img id="image-gall-10" class="image-gall" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
            <img id="image-gall-11" class="image-gall" src="https://www.w3schools.com/w3images/mountainskies.jpg" alt="" style="width:100%">
            <img id="image-gall-12" class="image-gall" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
            <img id="image-gall-13" class="image-gall" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
        </div>
    </div>
</div>
-----------------------
var images = document.getElementById("image-gall");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption-gallery-fu-sc");    
for (var i = 0; i < images.length; ++i) {
    var img = images[i];
    img.onclick = function() {
        modal.style.display = "block";
        modalImg.src = this.src;
        captionText.innerHTML = this.alt;
    }
}
// Get the modal
var modal = document.getElementById("myModal");
// Get the image and insert it inside the modal - use its "alt" text as a caption
var images = document.getElementsByClassName("image-gall");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption-gallery-fu-sc");    
for (var i = 0; i < images.length; ++i) {
    var img = images[i];
    img.onclick = function() {
        modal.style.display = "block";
        modalImg.src = this.src;
        captionText.innerHTML = this.alt;
    }
}
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close-gallery-fu-sc")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() { 
    modal.style.display = "none";
}
.row {
    display: -ms-flexbox; /* IE 10 */
    display: flex;
    -ms-flex-wrap: wrap; /* IE 10 */
    flex-wrap: wrap;
    padding: 0 4px;
}

/* Create two equal columns that sits next to each other */
.column {
    -ms-flex: 50%; /* IE 10 */
    flex: 50%;
    padding: 60px 4px;
}

.column img {
    margin-top: 8px;
    vertical-align: middle;
}
/* Style the Image Used to Trigger the Modal */
#image-gall-1,#image-gall-2,#image-gall-3,#image-gall-4,#image-gall-5,#image-gall-6,#image-gall-7,#image-gall-8,#image-gall-9,#image-gall-10,#image-gall-11,#image-gall-12,#image-gall-13 {
    border-radius: 5px;
    cursor: pointer;
    transition: 0.3s;
}
#image-gall-1:hover, #image-gall-2:hover, #image-gall-3:hover, #image-gall-4:hover, #image-gall-5:hover,#image-gall-6:hover, #image-gall-7:hover, #image-gall-8:hover, #image-gall-9:hover, #image-gall-10:hover, #image-gall-11:hover, #image-gall-12:hover, #image-gall-13:hover {opacity: 0.7;}
/* The Modal (background) */
.modal-gallery-fu-sc {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    padding-top: 100px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
/* Modal Content (Image) */
.modal-content-gallery-fu-sc {
    padding-top:80px;
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
}
/* Caption of Modal Image (Image Text) - Same Width as the Image */
#caption-gallery-fu-sc {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    height: 150px;
}
/* Add Animation */
.modal-content-gallery-fu-sc, #caption-gallery-fu-sc {  
    -webkit-animation-name: zoom;
    -webkit-animation-duration: 0.6s;
    animation-name: zoom;
    animation-duration: 0.6s;
}
@-webkit-keyframes zoom {
    from {-webkit-transform:scale(0)} 
    to {-webkit-transform:scale(1)}
}
@keyframes zoom {
    from {transform:scale(0)} 
    to {transform:scale(1)}
}
/* The Close Button */
.close-gallery-fu-sc {
    position: absolute;
    top: 85px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}
.close-gallery-fu-sc:hover,
.close-gallery-fu-sc:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}
/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
    .modal-content-gallery-fu-sc {
        width: 100%;
    }
}
<div class="container">
    <!-- The Modal -->
    <div id="myModal" class="modal-gallery-fu-sc">
        <!-- The Close Button -->
        <span class="close-gallery-fu-sc">×</span>
        <!-- Modal Content (The Image) -->
        <img class="modal-content-gallery-fu-sc" id="img01">
        <!-- Modal Caption (Image Text) -->
        <div id="caption-gallery-fu-sc"></div>
    </div>

    <!-- Photo Grid -->
    <div class="row"> 
        <div class="column">
            <img id="image-gall-1" class="image-gall" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
            <img id="image-gall-2" class="image-gall" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
            <img id="image-gall-3" class="image-gall" src="https://www.w3schools.com/w3images/falls2.jpg" alt="falls2" style="width:100%">
            <img id="image-gall-4" class="image-gall" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
            <img id="image-gall-5" class="image-gall" src="https://www.w3schools.com/w3images/nature.jpg" alt="nature" style="width:100%">
            <img id="image-gall-6" class="image-gall" src="https://www.w3schools.com/w3images/mist.jpg" alt="mist" style="width:100%">
            <img id="image-gall-7" class="image-gall" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
        </div>
        <div class="column">
            <img id="image-gall-8" class="image-gall" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
            <img id="image-gall-9" class="image-gall" src="https://www.w3schools.com/w3images/ocean.jpg" alt="ocean" style="width:100%">
            <img id="image-gall-10" class="image-gall" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
            <img id="image-gall-11" class="image-gall" src="https://www.w3schools.com/w3images/mountainskies.jpg" alt="" style="width:100%">
            <img id="image-gall-12" class="image-gall" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
            <img id="image-gall-13" class="image-gall" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
        </div>
    </div>
</div>
-----------------------
var images = document.getElementById("image-gall");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption-gallery-fu-sc");    
for (var i = 0; i < images.length; ++i) {
    var img = images[i];
    img.onclick = function() {
        modal.style.display = "block";
        modalImg.src = this.src;
        captionText.innerHTML = this.alt;
    }
}
// Get the modal
var modal = document.getElementById("myModal");
// Get the image and insert it inside the modal - use its "alt" text as a caption
var images = document.getElementsByClassName("image-gall");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption-gallery-fu-sc");    
for (var i = 0; i < images.length; ++i) {
    var img = images[i];
    img.onclick = function() {
        modal.style.display = "block";
        modalImg.src = this.src;
        captionText.innerHTML = this.alt;
    }
}
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close-gallery-fu-sc")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() { 
    modal.style.display = "none";
}
.row {
    display: -ms-flexbox; /* IE 10 */
    display: flex;
    -ms-flex-wrap: wrap; /* IE 10 */
    flex-wrap: wrap;
    padding: 0 4px;
}

/* Create two equal columns that sits next to each other */
.column {
    -ms-flex: 50%; /* IE 10 */
    flex: 50%;
    padding: 60px 4px;
}

.column img {
    margin-top: 8px;
    vertical-align: middle;
}
/* Style the Image Used to Trigger the Modal */
#image-gall-1,#image-gall-2,#image-gall-3,#image-gall-4,#image-gall-5,#image-gall-6,#image-gall-7,#image-gall-8,#image-gall-9,#image-gall-10,#image-gall-11,#image-gall-12,#image-gall-13 {
    border-radius: 5px;
    cursor: pointer;
    transition: 0.3s;
}
#image-gall-1:hover, #image-gall-2:hover, #image-gall-3:hover, #image-gall-4:hover, #image-gall-5:hover,#image-gall-6:hover, #image-gall-7:hover, #image-gall-8:hover, #image-gall-9:hover, #image-gall-10:hover, #image-gall-11:hover, #image-gall-12:hover, #image-gall-13:hover {opacity: 0.7;}
/* The Modal (background) */
.modal-gallery-fu-sc {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    padding-top: 100px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
/* Modal Content (Image) */
.modal-content-gallery-fu-sc {
    padding-top:80px;
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
}
/* Caption of Modal Image (Image Text) - Same Width as the Image */
#caption-gallery-fu-sc {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    height: 150px;
}
/* Add Animation */
.modal-content-gallery-fu-sc, #caption-gallery-fu-sc {  
    -webkit-animation-name: zoom;
    -webkit-animation-duration: 0.6s;
    animation-name: zoom;
    animation-duration: 0.6s;
}
@-webkit-keyframes zoom {
    from {-webkit-transform:scale(0)} 
    to {-webkit-transform:scale(1)}
}
@keyframes zoom {
    from {transform:scale(0)} 
    to {transform:scale(1)}
}
/* The Close Button */
.close-gallery-fu-sc {
    position: absolute;
    top: 85px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}
.close-gallery-fu-sc:hover,
.close-gallery-fu-sc:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}
/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
    .modal-content-gallery-fu-sc {
        width: 100%;
    }
}
<div class="container">
    <!-- The Modal -->
    <div id="myModal" class="modal-gallery-fu-sc">
        <!-- The Close Button -->
        <span class="close-gallery-fu-sc">×</span>
        <!-- Modal Content (The Image) -->
        <img class="modal-content-gallery-fu-sc" id="img01">
        <!-- Modal Caption (Image Text) -->
        <div id="caption-gallery-fu-sc"></div>
    </div>

    <!-- Photo Grid -->
    <div class="row"> 
        <div class="column">
            <img id="image-gall-1" class="image-gall" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
            <img id="image-gall-2" class="image-gall" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
            <img id="image-gall-3" class="image-gall" src="https://www.w3schools.com/w3images/falls2.jpg" alt="falls2" style="width:100%">
            <img id="image-gall-4" class="image-gall" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
            <img id="image-gall-5" class="image-gall" src="https://www.w3schools.com/w3images/nature.jpg" alt="nature" style="width:100%">
            <img id="image-gall-6" class="image-gall" src="https://www.w3schools.com/w3images/mist.jpg" alt="mist" style="width:100%">
            <img id="image-gall-7" class="image-gall" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
        </div>
        <div class="column">
            <img id="image-gall-8" class="image-gall" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
            <img id="image-gall-9" class="image-gall" src="https://www.w3schools.com/w3images/ocean.jpg" alt="ocean" style="width:100%">
            <img id="image-gall-10" class="image-gall" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
            <img id="image-gall-11" class="image-gall" src="https://www.w3schools.com/w3images/mountainskies.jpg" alt="" style="width:100%">
            <img id="image-gall-12" class="image-gall" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
            <img id="image-gall-13" class="image-gall" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
        </div>
    </div>
</div>
-----------------------
var images = document.getElementById("image-gall");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption-gallery-fu-sc");    
for (var i = 0; i < images.length; ++i) {
    var img = images[i];
    img.onclick = function() {
        modal.style.display = "block";
        modalImg.src = this.src;
        captionText.innerHTML = this.alt;
    }
}
// Get the modal
var modal = document.getElementById("myModal");
// Get the image and insert it inside the modal - use its "alt" text as a caption
var images = document.getElementsByClassName("image-gall");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption-gallery-fu-sc");    
for (var i = 0; i < images.length; ++i) {
    var img = images[i];
    img.onclick = function() {
        modal.style.display = "block";
        modalImg.src = this.src;
        captionText.innerHTML = this.alt;
    }
}
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close-gallery-fu-sc")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() { 
    modal.style.display = "none";
}
.row {
    display: -ms-flexbox; /* IE 10 */
    display: flex;
    -ms-flex-wrap: wrap; /* IE 10 */
    flex-wrap: wrap;
    padding: 0 4px;
}

/* Create two equal columns that sits next to each other */
.column {
    -ms-flex: 50%; /* IE 10 */
    flex: 50%;
    padding: 60px 4px;
}

.column img {
    margin-top: 8px;
    vertical-align: middle;
}
/* Style the Image Used to Trigger the Modal */
#image-gall-1,#image-gall-2,#image-gall-3,#image-gall-4,#image-gall-5,#image-gall-6,#image-gall-7,#image-gall-8,#image-gall-9,#image-gall-10,#image-gall-11,#image-gall-12,#image-gall-13 {
    border-radius: 5px;
    cursor: pointer;
    transition: 0.3s;
}
#image-gall-1:hover, #image-gall-2:hover, #image-gall-3:hover, #image-gall-4:hover, #image-gall-5:hover,#image-gall-6:hover, #image-gall-7:hover, #image-gall-8:hover, #image-gall-9:hover, #image-gall-10:hover, #image-gall-11:hover, #image-gall-12:hover, #image-gall-13:hover {opacity: 0.7;}
/* The Modal (background) */
.modal-gallery-fu-sc {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    padding-top: 100px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
/* Modal Content (Image) */
.modal-content-gallery-fu-sc {
    padding-top:80px;
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
}
/* Caption of Modal Image (Image Text) - Same Width as the Image */
#caption-gallery-fu-sc {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    height: 150px;
}
/* Add Animation */
.modal-content-gallery-fu-sc, #caption-gallery-fu-sc {  
    -webkit-animation-name: zoom;
    -webkit-animation-duration: 0.6s;
    animation-name: zoom;
    animation-duration: 0.6s;
}
@-webkit-keyframes zoom {
    from {-webkit-transform:scale(0)} 
    to {-webkit-transform:scale(1)}
}
@keyframes zoom {
    from {transform:scale(0)} 
    to {transform:scale(1)}
}
/* The Close Button */
.close-gallery-fu-sc {
    position: absolute;
    top: 85px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}
.close-gallery-fu-sc:hover,
.close-gallery-fu-sc:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}
/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
    .modal-content-gallery-fu-sc {
        width: 100%;
    }
}
<div class="container">
    <!-- The Modal -->
    <div id="myModal" class="modal-gallery-fu-sc">
        <!-- The Close Button -->
        <span class="close-gallery-fu-sc">×</span>
        <!-- Modal Content (The Image) -->
        <img class="modal-content-gallery-fu-sc" id="img01">
        <!-- Modal Caption (Image Text) -->
        <div id="caption-gallery-fu-sc"></div>
    </div>

    <!-- Photo Grid -->
    <div class="row"> 
        <div class="column">
            <img id="image-gall-1" class="image-gall" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
            <img id="image-gall-2" class="image-gall" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
            <img id="image-gall-3" class="image-gall" src="https://www.w3schools.com/w3images/falls2.jpg" alt="falls2" style="width:100%">
            <img id="image-gall-4" class="image-gall" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
            <img id="image-gall-5" class="image-gall" src="https://www.w3schools.com/w3images/nature.jpg" alt="nature" style="width:100%">
            <img id="image-gall-6" class="image-gall" src="https://www.w3schools.com/w3images/mist.jpg" alt="mist" style="width:100%">
            <img id="image-gall-7" class="image-gall" src="https://www.w3schools.com/w3images/paris.jpg" alt="paris" style="width:100%">
        </div>
        <div class="column">
            <img id="image-gall-8" class="image-gall" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
            <img id="image-gall-9" class="image-gall" src="https://www.w3schools.com/w3images/ocean.jpg" alt="ocean" style="width:100%">
            <img id="image-gall-10" class="image-gall" src="https://www.w3schools.com/w3images/wedding.jpg" alt="wedding" style="width:100%">
            <img id="image-gall-11" class="image-gall" src="https://www.w3schools.com/w3images/mountainskies.jpg" alt="" style="width:100%">
            <img id="image-gall-12" class="image-gall" src="https://www.w3schools.com/w3images/rocks.jpg" alt="rocks" style="width:100%">
            <img id="image-gall-13" class="image-gall" src="https://www.w3schools.com/w3images/underwater.jpg" alt="underwater" style="width:100%">
        </div>
    </div>
</div>

PyQt5 Build Menus in a Loop

copy iconCopydownload iconDownload
for i in range(2):
    button = getattr(self, "inputPb_{}".format(i))
    menu = QMenu()
    menu.triggered.connect(lambda action, button=button: button.setText(action.text()))
    self.add_menu(self.inputs, menu)
    button.setMenu(menu)

How can I take a value from an input tag in a TSX component, and use that value in a Node JS file in a different directory?

copy iconCopydownload iconDownload
function queryOnClick() {
  // applies percent-encoding to special characters
  const search = encodeURIComponent(searchString);
  const url = `http://localhost:4000/news-api?search=${search}`;
  fetch(url, {
...
import React, { useState } from "react";

function SearchButton({ onClick }: { onClick: () => void }) {
  return (
    <button
      className="search__button padding-1 margin-1 margin-left-6"
      onClick={onClick}
    >
      Click to search
    </button>
  );
}

interface SearchBarProps {
  searchNews: () => void;
  searchString: string;
  setSearchString: (s: string) => void;
}

function SearchBar({ searchNews, searchString, setSearchString }: SearchBarProps) {
  const handleKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {
    if (e.key === "Enter" && searchString !== "") {
      e.preventDefault();
      e.stopPropagation();
      searchNews();
    }
  };

  const onSearchTextChange = (e: React.ChangeEvent<HTMLInputElement>) => {
    setSearchString(e.target.value.trim());
  };

  return (
    <div>
      <form>
        <div>
          <input
            id="search"
            type="search"
            value={searchString}
            onChange={onSearchTextChange}
            onKeyPress={handleKeyPress}
            placeholder="Search"
          />
        </div>
      </form>
    </div>
  );
}


interface Article {
  title: string;
  author: string;
  content: string;
  url: string;
}

interface NewsResponse {
  articles: Article[];
}

function ArticleList({ articles }: NewsResponse) {
  return (
    <div className="results__container padding-2 theme--mist">
      {articles.map((article) => (
        <div className="article__container box-shadow padding-2 margin-4 margin-left-6 margin-right-6 theme--white">
          <h2 className="article__title padding-bottom-2 margin-bottom-2">
            {article.title}
          </h2>
          <h3 className="article__author padding-bottom-2 margin-bottom-2">
            Written by: {article.author || "An uncredited author"}
          </h3>
          <p className="article__content">
            {article.content.length > 150
              ? `${article.content.substring(
                  0,
                  150
                )}... [Article shortened - Click the URL below to read more]`
              : article.content}
          </p>
          <div className="article__url margin-top-2">
            <p>
              <p>Source:</p>
              <a href={article.url}>{article.url}</a>
            </p>
          </div>
        </div>
      ))}
    </div>
  );
}

function SearchPage() {
  const [newsResponse, setNewsResponse] = useState<NewsResponse | null>(null);

  const [searchString, setSearchString] = useState("");

  function queryOnClick() {
    // applies percent-encoding to special characters
    const search = encodeURIComponent(searchString);
    const url = `http://localhost:4000/news-api?search=${search}`;
    fetch(url, {
      headers: { "Content-Type": "application/json" }
    })
      .then((response) => response.json())
      .then((result) => {
        console.log("result:", result);
        setNewsResponse(result);
      })
      .catch((ex) => {
        console.log("error:", ex);
      });
  }

  return (
    <div className="theme--white">
      <SearchBar
        searchNews={queryOnClick}
        searchString={searchString}
        setSearchString={setSearchString}
      />
      <SearchButton onClick={queryOnClick} />

      {newsResponse && newsResponse.articles ? (
        <ArticleList articles={newsResponse.articles} />
      ) : null}
    </div>
  );
}

export default SearchPage;
app.get('/news-api', function (req, res) {
  const searchQuery = req.params.search || "Bitcoin";
  fetch(`https://newsapi.org/v2/everything?q=${searchQuery}&sortBy=${SORT_BY}&pageSize=${PAGE_SIZE}&apiKey=${API_KEY}`, {
...
-----------------------
function queryOnClick() {
  // applies percent-encoding to special characters
  const search = encodeURIComponent(searchString);
  const url = `http://localhost:4000/news-api?search=${search}`;
  fetch(url, {
...
import React, { useState } from "react";

function SearchButton({ onClick }: { onClick: () => void }) {
  return (
    <button
      className="search__button padding-1 margin-1 margin-left-6"
      onClick={onClick}
    >
      Click to search
    </button>
  );
}

interface SearchBarProps {
  searchNews: () => void;
  searchString: string;
  setSearchString: (s: string) => void;
}

function SearchBar({ searchNews, searchString, setSearchString }: SearchBarProps) {
  const handleKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {
    if (e.key === "Enter" && searchString !== "") {
      e.preventDefault();
      e.stopPropagation();
      searchNews();
    }
  };

  const onSearchTextChange = (e: React.ChangeEvent<HTMLInputElement>) => {
    setSearchString(e.target.value.trim());
  };

  return (
    <div>
      <form>
        <div>
          <input
            id="search"
            type="search"
            value={searchString}
            onChange={onSearchTextChange}
            onKeyPress={handleKeyPress}
            placeholder="Search"
          />
        </div>
      </form>
    </div>
  );
}


interface Article {
  title: string;
  author: string;
  content: string;
  url: string;
}

interface NewsResponse {
  articles: Article[];
}

function ArticleList({ articles }: NewsResponse) {
  return (
    <div className="results__container padding-2 theme--mist">
      {articles.map((article) => (
        <div className="article__container box-shadow padding-2 margin-4 margin-left-6 margin-right-6 theme--white">
          <h2 className="article__title padding-bottom-2 margin-bottom-2">
            {article.title}
          </h2>
          <h3 className="article__author padding-bottom-2 margin-bottom-2">
            Written by: {article.author || "An uncredited author"}
          </h3>
          <p className="article__content">
            {article.content.length > 150
              ? `${article.content.substring(
                  0,
                  150
                )}... [Article shortened - Click the URL below to read more]`
              : article.content}
          </p>
          <div className="article__url margin-top-2">
            <p>
              <p>Source:</p>
              <a href={article.url}>{article.url}</a>
            </p>
          </div>
        </div>
      ))}
    </div>
  );
}

function SearchPage() {
  const [newsResponse, setNewsResponse] = useState<NewsResponse | null>(null);

  const [searchString, setSearchString] = useState("");

  function queryOnClick() {
    // applies percent-encoding to special characters
    const search = encodeURIComponent(searchString);
    const url = `http://localhost:4000/news-api?search=${search}`;
    fetch(url, {
      headers: { "Content-Type": "application/json" }
    })
      .then((response) => response.json())
      .then((result) => {
        console.log("result:", result);
        setNewsResponse(result);
      })
      .catch((ex) => {
        console.log("error:", ex);
      });
  }

  return (
    <div className="theme--white">
      <SearchBar
        searchNews={queryOnClick}
        searchString={searchString}
        setSearchString={setSearchString}
      />
      <SearchButton onClick={queryOnClick} />

      {newsResponse && newsResponse.articles ? (
        <ArticleList articles={newsResponse.articles} />
      ) : null}
    </div>
  );
}

export default SearchPage;
app.get('/news-api', function (req, res) {
  const searchQuery = req.params.search || "Bitcoin";
  fetch(`https://newsapi.org/v2/everything?q=${searchQuery}&sortBy=${SORT_BY}&pageSize=${PAGE_SIZE}&apiKey=${API_KEY}`, {
...
-----------------------
function queryOnClick() {
  // applies percent-encoding to special characters
  const search = encodeURIComponent(searchString);
  const url = `http://localhost:4000/news-api?search=${search}`;
  fetch(url, {
...
import React, { useState } from "react";

function SearchButton({ onClick }: { onClick: () => void }) {
  return (
    <button
      className="search__button padding-1 margin-1 margin-left-6"
      onClick={onClick}
    >
      Click to search
    </button>
  );
}

interface SearchBarProps {
  searchNews: () => void;
  searchString: string;
  setSearchString: (s: string) => void;
}

function SearchBar({ searchNews, searchString, setSearchString }: SearchBarProps) {
  const handleKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {
    if (e.key === "Enter" && searchString !== "") {
      e.preventDefault();
      e.stopPropagation();
      searchNews();
    }
  };

  const onSearchTextChange = (e: React.ChangeEvent<HTMLInputElement>) => {
    setSearchString(e.target.value.trim());
  };

  return (
    <div>
      <form>
        <div>
          <input
            id="search"
            type="search"
            value={searchString}
            onChange={onSearchTextChange}
            onKeyPress={handleKeyPress}
            placeholder="Search"
          />
        </div>
      </form>
    </div>
  );
}


interface Article {
  title: string;
  author: string;
  content: string;
  url: string;
}

interface NewsResponse {
  articles: Article[];
}

function ArticleList({ articles }: NewsResponse) {
  return (
    <div className="results__container padding-2 theme--mist">
      {articles.map((article) => (
        <div className="article__container box-shadow padding-2 margin-4 margin-left-6 margin-right-6 theme--white">
          <h2 className="article__title padding-bottom-2 margin-bottom-2">
            {article.title}
          </h2>
          <h3 className="article__author padding-bottom-2 margin-bottom-2">
            Written by: {article.author || "An uncredited author"}
          </h3>
          <p className="article__content">
            {article.content.length > 150
              ? `${article.content.substring(
                  0,
                  150
                )}... [Article shortened - Click the URL below to read more]`
              : article.content}
          </p>
          <div className="article__url margin-top-2">
            <p>
              <p>Source:</p>
              <a href={article.url}>{article.url}</a>
            </p>
          </div>
        </div>
      ))}
    </div>
  );
}

function SearchPage() {
  const [newsResponse, setNewsResponse] = useState<NewsResponse | null>(null);

  const [searchString, setSearchString] = useState("");

  function queryOnClick() {
    // applies percent-encoding to special characters
    const search = encodeURIComponent(searchString);
    const url = `http://localhost:4000/news-api?search=${search}`;
    fetch(url, {
      headers: { "Content-Type": "application/json" }
    })
      .then((response) => response.json())
      .then((result) => {
        console.log("result:", result);
        setNewsResponse(result);
      })
      .catch((ex) => {
        console.log("error:", ex);
      });
  }

  return (
    <div className="theme--white">
      <SearchBar
        searchNews={queryOnClick}
        searchString={searchString}
        setSearchString={setSearchString}
      />
      <SearchButton onClick={queryOnClick} />

      {newsResponse && newsResponse.articles ? (
        <ArticleList articles={newsResponse.articles} />
      ) : null}
    </div>
  );
}

export default SearchPage;
app.get('/news-api', function (req, res) {
  const searchQuery = req.params.search || "Bitcoin";
  fetch(`https://newsapi.org/v2/everything?q=${searchQuery}&sortBy=${SORT_BY}&pageSize=${PAGE_SIZE}&apiKey=${API_KEY}`, {
...

Xamarin.Forms - Frame expanding when Image inside it loaded multiple times

copy iconCopydownload iconDownload
<Frame Grid.Column="0"
    HeightRequest="200"
    WidthRequest="50"
    BorderColor="White"
    Margin="10,0,5,0"
    CornerRadius="10"
    BackgroundColor="Transparent">
HeightRequest="{Binding heightOfFrame}"
WidthRequest="{Binding widthOfFrame}"
public partial class MainPage : ContentPage
{

    public Double heightOfFrame { get; set; }
    public Double widthOfFrame { get; set; }

    public MainPage()
    {
        InitializeComponent();

        Double screenHeigth = DeviceDisplay.MainDisplayInfo.Height / DeviceDisplay.MainDisplayInfo.Density;
        Double screenWidth = DeviceDisplay.MainDisplayInfo.Width / DeviceDisplay.MainDisplayInfo.Density;
        
        //This will set the height and width to half of your screen's height and width
        heightOfFrame = screenHeigth/2; //set this as you would like it to be
        widthOfFrame = screenWidth/2; //set this as you would like it to be

        BindingContext = this;
    }
}
-----------------------
<Frame Grid.Column="0"
    HeightRequest="200"
    WidthRequest="50"
    BorderColor="White"
    Margin="10,0,5,0"
    CornerRadius="10"
    BackgroundColor="Transparent">
HeightRequest="{Binding heightOfFrame}"
WidthRequest="{Binding widthOfFrame}"
public partial class MainPage : ContentPage
{

    public Double heightOfFrame { get; set; }
    public Double widthOfFrame { get; set; }

    public MainPage()
    {
        InitializeComponent();

        Double screenHeigth = DeviceDisplay.MainDisplayInfo.Height / DeviceDisplay.MainDisplayInfo.Density;
        Double screenWidth = DeviceDisplay.MainDisplayInfo.Width / DeviceDisplay.MainDisplayInfo.Density;
        
        //This will set the height and width to half of your screen's height and width
        heightOfFrame = screenHeigth/2; //set this as you would like it to be
        widthOfFrame = screenWidth/2; //set this as you would like it to be

        BindingContext = this;
    }
}
-----------------------
<Frame Grid.Column="0"
    HeightRequest="200"
    WidthRequest="50"
    BorderColor="White"
    Margin="10,0,5,0"
    CornerRadius="10"
    BackgroundColor="Transparent">
HeightRequest="{Binding heightOfFrame}"
WidthRequest="{Binding widthOfFrame}"
public partial class MainPage : ContentPage
{

    public Double heightOfFrame { get; set; }
    public Double widthOfFrame { get; set; }

    public MainPage()
    {
        InitializeComponent();

        Double screenHeigth = DeviceDisplay.MainDisplayInfo.Height / DeviceDisplay.MainDisplayInfo.Density;
        Double screenWidth = DeviceDisplay.MainDisplayInfo.Width / DeviceDisplay.MainDisplayInfo.Density;
        
        //This will set the height and width to half of your screen's height and width
        heightOfFrame = screenHeigth/2; //set this as you would like it to be
        widthOfFrame = screenWidth/2; //set this as you would like it to be

        BindingContext = this;
    }
}

How to set opacity on BackgroundImageSource in c# code using xamarin

copy iconCopydownload iconDownload
  <Grid>
    <Image
        Aspect="AspectFill"
        Opacity="0.3"
        Source="pink.jpg" />
    <StackLayout Padding="15">
        <Image
            Aspect="AspectFit"
            HeightRequest="100"
            Source="truck_black.png"
            WidthRequest="130" />
    </StackLayout>
    <ScrollView>
        <StackLayout Spacing="0">
            <StackLayout Padding="15,7,15,15" VerticalOptions="StartAndExpand">
                <StackLayout VerticalOptions="StartAndExpand">
                    <Label
                        FontSize="14"
                        Text="Company Code"
                        TextColor="Black" />
                    <Entry
                        x:Name="companyCodeEntry"
                        FontSize="14"
                        Text=""
                        TextColor="Black" />
                    <Label
                        FontSize="14"
                        Text="Username"
                        TextColor="Black" />
                    <Entry
                        x:Name="usernameEntry"
                        FontSize="14"
                        Text=""
                        TextColor="Black" />
                    <Label
                        FontSize="14"
                        Text="Password"
                        TextColor="Black" />
                    <Entry
                        x:Name="passwordEntry"
                        FontSize="14"
                        IsPassword="true"
                        Text=""
                        TextColor="Black" />
                </StackLayout>
            </StackLayout>
        </StackLayout>
    </ScrollView>
</Grid>

Zoom On Hover Image Gallery Overlapping

copy iconCopydownload iconDownload
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.header {
}

.row {
  display: -ms-flexbox; /* IE 10 */
  display: flex;
  -ms-flex-wrap: wrap; /* IE 10 */
  flex-wrap: wrap;
  padding: 0 4px;
  overflow: hidden;
}


/* Create two equal columns that sits next to each other */
.column {
  height:100%;
  -ms-flex: 50%; /* IE 10 */
  flex: 50%;
  padding: 0 4px;
  overflow: hidden;
}

.column img {
  /*margin-top: 8px;*/
  vertical-align: middle;
  transition: transform .5s ease;
}


.column img:hover {
  transform: scale(1.5);
}

.img-parent {overflow: hidden; margin-top: 8px}


</style>
</head>
<body>

<!-- Photo Grid -->
<div class="row"> 
  <div class="column">
    <div class="img-parent">
      <img src="https://www.gettyimages.com/gi-resources/images/500px/983703508.jpg" style="width:100%">
    </div>
    <div class="img-parent">
      <img src="https://www.gettyimages.com/gi-resources/images/500px/983703508.jpg" style="width:100%">
    </div>        <div class="img-parent">
      <img src="https://www.gettyimages.com/gi-resources/images/500px/983703508.jpg" style="width:100%">
    </div>
  </div>
  <div class="column">
    <div class="img-parent">
      <img src="https://www.gettyimages.com/gi-resources/images/500px/983703508.jpg" style="width:100%">
    </div>        <div class="img-parent">
      <img src="https://www.gettyimages.com/gi-resources/images/500px/983703508.jpg" style="width:100%">
    </div>        <div class="img-parent">
      <img src="https://www.gettyimages.com/gi-resources/images/500px/983703508.jpg" style="width:100%">
    </div>
  </div>  


</div>

<script>
// Get the elements with class="column"
var elements = document.getElementsByClassName("column");

// Declare a loop variable
var i;


// Two images side by side
function two() {
  for (i = 0; i < elements.length; i++) {
    elements[i].style.msFlex = "50%";  // IE10
    elements[i].style.flex = "50%";
  }
}


</script>

</body>
</html>

Python regex extract lines between substrings that start with certain criteria

copy iconCopydownload iconDownload
commentary = [re.findall(r'--+(.*)(.\s)', i) 
     for i in re.findall('\),\s{2,}(.*?)as\s\(',qry,flags=re.S)]

Discord.js add roles if argument is from array

copy iconCopydownload iconDownload
const list = [
  'Eliminaries', //Eliminaries
  'Myth', //Myth
  'Squad of Skilled', //Squad of Skilled
  'Brazil Printer Mafia', //Brazil Printer Mafia
  'Communist Party of Nevada', //Communist Party Of Nevada
  'Sando Gang', //Sando Gang
  'Century Street Gang', //Century Street Gang
  'Liberators', //Liberators
  'Celestial Blue', //Celestial Blue
  'Gang Of The Mists', //Gang Of The Mists
  'Phoenix Core', //Phoenix Core
  'Crimson', //Crimson
];

// args[0] is the role name provided by the user
const roleName = list.find((item) => item.toLowerCase() === args[0].toLowerCase());

if (!roleName)
  return message.channel.send(`It looks like \`${args[0]}\` is not a valid role name`);

const role = message.guild.roles.cache.find((role) => role.name === roleName);

if (!role)
  return message.channel.send(`Role \`${args[0]}\` looks like a valid role name but it does not exist`);

message.member.roles
  .add(role.id)
  .then((updatedMember) => {
    message.channel.send(`Role \`${roleName}\` is added to ${message.author}`);
  })
  .catch((err) => {
    console.log(err);
    message.channel.send('Oops, there was an error adding the role');
  });

Community Discussions

Trending Discussions on mist
  • Discord.js &quot;undefined&quot; before first array object in embed
  • How can I define my Solidity contract as a javascript object?
  • I have an image gallery and i want to open each image using modal when click on each
  • PyQt5 Build Menus in a Loop
  • How can I take a value from an input tag in a TSX component, and use that value in a Node JS file in a different directory?
  • Xamarin.Forms - Frame expanding when Image inside it loaded multiple times
  • How to set opacity on BackgroundImageSource in c# code using xamarin
  • Zoom On Hover Image Gallery Overlapping
  • Python regex extract lines between substrings that start with certain criteria
  • Discord.js add roles if argument is from array
Trending Discussions on mist

QUESTION

Discord.js &quot;undefined&quot; before first array object in embed

Asked 2021-Jun-02 at 00:22

I am making a Discord bot command where you can build a city. There is a list command I am trying to make which lists all of the roads and places made in the city. Both of them keep having "undefined" before the first line in the value place. Here is what I get in my embed: the places, the roads

Here is my code for both of the commands:

const citydb = require("city.json")
client.on("message", message => {
    let { localroad, routeroad, privateplace, publicplace } = ``;

    for (var i = 0; i < citydb["roads-local"].length; i++) {localroad += citydb["roads-local"][i]}
    for (var i = 0; i < citydb["roads-route"].length; i++) {routeroad += citydb["roads-route"][i]}
    for (var i = 0; i < citydb["places-private"].length; i++) {privateplace += citydb["places-private"][i]}
    for (var i = 0; i < citydb["places-public"].length; i++) {publicplace += citydb["places-public"][i]}

    if (message.content === config.pfx+"city-listroads") {
        let roadlist = new MessageEmbed()
            .setTitle("Moth City Roads Registry")
            .setDescription("A list of roads created in Moth City.")
            .setColor("#2C3E50")
            .addFields(
                { name: "Local Roads", value: localroad, inline: true },
                { name: "Routes", value: routeroad, inline: true }
            )
        message.channel.send(roadlist)
    } else if (message.content === config.pfx+"city-listplaces") {
        let placelist = new MessageEmbed()
            .setTitle("Moth City Places Registry")
            .setDescription("A list of places created in Moth City.")
            .setColor("#2C3E50")
            .addFields(
                { name: "Homes", value: privateplace, inline: false },
                { name: "Places", value: publicplace, inline: false }
            )
        message.channel.send(placelist)
    }
});

And here is my data in the JSON file:

{"roads-route": ["MR 1 \n","MR 40 \n","MR 66 \n","MR 166 \n","MR 29 \n"],"roads-local":["Mist Parkway \n","Swagith Highway \n","Lepid Avenue \n","Wings Street \n","N Indigo Highway\n","S Indigo Highway\n"],"places-private":["7253 Lepid Avenue - Zak's House \n","9446 Mist Parkway - Sqmapi's House \n"],"places-public":["6030 Wings Street - Mountain Top Cake Shop \n"]}

I don't know what I am doing wrong. Any help is appreciated. Thank you.

ANSWER

Answered 2021-Jun-02 at 00:22

The following line is trying to use destructuring to set all these variables, but none of their names is a key of ``:

let { localroad, routeroad, privateplace, publicplace } = ``;

If you want to set several variables to the same initial value, the syntax is different:

let localroad, routeroad, privateplace, publicplace
localroad = routeroad = privateplace = publicplace = ""

There is a simpler way of joining the data together, though:

let localroad = citydb["roads-local"].join("")
let routeroad = citydb["roads-route"].join("")
let privateplace = citydb["places-private"].join("")
let publicplace = citydb["places-public"].join("")

Going beyond that, if you change join("") to join("\n") in each of those cases, you can leave out the \n at the end of each entry in your JSON files.

Source https://stackoverflow.com/questions/67796147

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install mist

If you want to install the app from a pre-built version on the release page, you can simply run the executable after download. For updating, simply download the new version and copy it over the old one (keep a backup of the old one if you want to be sure).

Support

In order to get help regarding Mist or Ethereum Wallet:.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Consider Popular Cryptocurrency Libraries
Compare Cryptocurrency Libraries with Highest Support
Compare Cryptocurrency Libraries with Highest Quality
Compare Cryptocurrency Libraries with Highest Security
Compare Cryptocurrency Libraries with Highest Reuse
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.