Is there a RegExp that can identify a custom CSS property with a color/background-image and font-size?

I’m creating a custom CSS property text, which acts as a shorthand for the color and font-size properties. In addition, it can accept a background-image in place of a color – things like gradients and url() images. It can also have only a color/background-image or just a font-size. Here’s some examples of what it looks like:

text: black;
text: 2rem;
text: black 2rem;
text: linear-gradient(to right, blue, red) 2rem;
text: url("/image.png") 2rem;
text: black xx-small;

I need a JavaScript function that can parse through a CSS document for these, and then extract the color/background-image and font-size from each, so I can then use replace() to compile to vanilla CSS in my plugin.

So far, I’ve tried using RegEx with two capturing groups to attempt to extract them. Here’s a similar RegEx that I used for another custom property, this one a shorthand for width and height:

/size:s*([d.]+(?:%|px|em|rem|vh|vw)?)(?:s+([d.]+(?:%|px|em|rem|vh|vw)?))?;/g

The problem with the text property is that the first capturing group needs to identify colors, gradients, and url()s, which can get quite complicated and is unreliable.

how can i solve the Bootstrap install problem?

when I install bootstrap in react I face a problem every time. The problem is “NPX audit fix –force”. when I run NPX audit fix –force the problem is not fix. why the problem is show and how can I fix this problem?

please someone gave me a suggestion/solutions.

ReferenceError When Using dependOn in Webpack

Fairly new to webpack (sorry if this is kind of basic). From some searching, my understanding is that import declarations are unnecessary if you have the required packages in your dependOn in your webpack configuration. However, I get a ReferenceError: ReactDOM is not defined with the following config.

What am I doing wrong?

webpack.config.js

module.exports = {
    entry: {
        reactVendors: ['react', 'react-dom'],
        home: { import: path.join(__dirname, 'src', 'index.js'), dependOn: 'reactVendors' }
    }
}

In my index.js

// removed import React from 'react' and import ReactDOM from 'react-dom' up here;

ReactDOM.render(<p>Hello</p>, document.getElementById('demo'));

How to create a Font Awesome Icon Search Selection (like fontawesome.com)?

I would like to create a searchable list of icons using Font Awesome’s Icon Font like the one they have on Font Awesome’s Website [Link].

In order to do this I will need the following properties from each icon:

  • Hash Code (for displaying the icon)
  • Font Family (for displaying icon variants)
  • Name (to describe each icon)
  • List/Array of Tags or Alieses (to help with search)

What would be the best way to get a list or array with the following information so that I don’t have to manually add every icon that comes in the Font Awesome Font?

Creating Google Sheets Functions [closed]

I do not know coding, and I’m struggling to put together something I need in Google Sheets. I want to create a function that automatically emails me based on the text in a cell. For example, if a cell states “Maintenance Needed” I want it to email me a short message.

I’ve looked up a few basic things, but I have no clue on how to customize it for my purposes.

invalid Token in Java Script

I have a problem with my Script, because the “:” doesn´t work. Im working in replit ans it says that I have to delete this Token.

My script:

GalgenratenBild = CustomTools.loadImage(gemeinsameKonstante.IMAGE_PATH);
    GalgenratenBild.setBounds(x: 0, y: 0, GalgenratenBild.getPreferredSize().width, GalgenratenBild.getPreferredSize().height)); --> "syntax error on token ":", invalid AssignmentOperator."

I tried to Debug it with the replit Debugger but if I delete it, the x,y would be also invalid and undefined.

input value returning undefined in javascript

So what’s going on here is this is code for a web app that keeps track of how many times you have lost. The main problem though is in the log function when I get the value it returns undefined.

Whenever I call the username variable it returns undefined.

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>The Game Logger</title>
    <link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
    <script src=".js"></script>
    <h1 style="margin-bottom: 5px;font-size: 60px;"><b>The Game</b></h1>
    <forum class="signin" id ="signin">
        
        <input class="username" id="username" type="text" placeholder="Username">
        <input class="password" id="password" type="password" placeholder="Password">
    </forum>
    <div class="logger" id="logger">
        <center><button class="gameLoss" id="gameLoss">Log Game Loss</button></center>
        <div id="gamesLogged" class="gamesLogged">
            <center><h1 id="test">Games Lost</h1></center>
            <hr>
        </div>  
        <p class="escapemessage">Press ESC to go back</p>
    </div>
</body>
</html>

JavaScript

document.addEventListener('DOMContentLoaded', function () {
    let focusPass = false;
    let focusUsername = false;
    let toggleLogger = true; // all good here
    const logButton = document.getElementById("gameLoss"); 
    const usernameField = document.getElementById("username");
    const passwordField = document.getElementById("password");
    const signin = document.getElementById("signin");
    const logger = document.getElementById("logger");
    const gamesLogged = document.getElementById("gamesLogged");
    var username;
    var password;

    passwordField.addEventListener("focus", function () {
        focusPass = true;
    });

    passwordField.addEventListener("focusout", function () {
        focusPass = false;
    });

    usernameField.addEventListener("focus", function () {
        focusUsername = true;
    });

    usernameField.addEventListener("focusout", function () {
        focusUsername = false;
    });

    logButton.addEventListener("click", function (event) {
        event.target.style.background="red";
        log();
    });

    function toggleDisplay() {
        if (toggleLogger) {
            signin.style.display = "none";
            logger.style.display = "block";
            toggleLogger = false;
            return;
        }
        if (!toggleLogger) {
            signin.style.display = "block";
            logger.style.display = "none";
            toggleLogger = true;
            return;
        }
        return;
    }

    function getUsernamePassword(){
        globalThis.username = document.getElementById("username").Value;
        globalThis.password = document.getElementById("password").Value;
        return;
    }   
    
    function log(){
        
        let log = document.createElement("p");
        log.innerHTML = `${document.getElementById("username").Value}, ${new Date().toLocaleTimeString({'hour12': false})}`
        gamesLogged.appendChild(log);
    }
    
    document.addEventListener('keydown', function (event) {

        var name = event.key;
        
        if (focusPass || focusUsername) {
            if (name === 'Enter') {
                getUsernamePassword();
                logButton.innerHTML = username;
                toggleDisplay();
                focusPass = false;
                focusUsername = false;
                return;
            }
        }

        if (name === "Escape"){
            if (!toggleLogger){
                toggleDisplay();
                return;
            }
        }

    });


});

CSS:

body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 3;
    flex-direction: column;
    font-family: Arial, Helvetica, sans-serif; 
    background-color: aliceblue;
}

.signin {
    text-align: center;
    background-color: rgb(29, 112, 163);
    border-radius: 5px;
}

input {
    display: block;
    margin: 5px;
    padding: 5px;
    width: 3in;
    outline:none;
    border-radius: 5px;
    font-size:15px;
    background-color: aliceblue;
}

input:focus {
    background-color: lightblue;
}

.logger {
    border: brown solid 4px;
    border-radius: 40px;
    display:none;
    width: 40%;
    max-height: 50%;

}

.gamesLogged {
    border: black solid 4px;
    
    margin: 0px 15px 15px 15px;
    max-height: 80%;
    overflow-y: scroll;
    overflow-x: hidden;
}

.test{
    text-align: center;
}

.gameLoss{
    margin-top: 10px;
    margin-bottom: 10px;
}

.escapemessage{
    text-align: center;
}

hr {
    width:85%;
    margin-top: 5px;
}

In this code I made many attempts at solving the issue. In one attempt I made a function that defines the variable when that function is called.

slider of https://www.patreon.com/

With which library is this slider built, and how can I implement it, especially at the top of the screen? When you hover over the slider, a transparent circle appears, revealing the second slide underneath.

I searched a lot the Google but found nothing.

Need to create a dynamically updating tube with Three.js

I am working on a project requiring a dynamically updating 3D tube. I have successfully set up a cylinder that is dynamically updated with the GUI, but need help turning this into a tube with CSG.

Example of tube
The idea is that both the outer cylinder and the inner cylinder (which is subtracted from the outer) are both controllable so that a user can set the outer diameter and the inner diameter.

Here is a code pen with my approach to creating the outer cylinder, if anyone could give me any tips for using CSG to get the desired result, or if there is a better approach to the desired end product, I would greatly appreciate it!

    var BoxGeometry,
    gui,
                BufferGeometry,
                CapsuleGeometry,
                CircleGeometry,
                Color,
                ConeGeometry,
                Curve,
                CylinderGeometry,
                DirectionalLight,
                DodecahedronGeometry,
                DoubleSide,
                ExtrudeGeometry,
                Float32BufferAttribute,
                Group,
                IcosahedronGeometry,
                LatheGeometry,
                LineSegments,
                LineBasicMaterial,
                Mesh,
                MeshPhongMaterial,
                OctahedronGeometry,
                PerspectiveCamera,
                PlaneGeometry,
                RingGeometry,
                Scene,
                Shape,
                ShapeGeometry,
                SphereGeometry,
                TetrahedronGeometry,
                TorusGeometry,
                TorusKnotGeometry,
                TubeGeometry,
                Vector2,
                Vector3,
                WireframeGeometry,
                WebGLRenderer,
        ThreeBSP;




    const twoPi = Math.PI * 2;
    function updateGroupGeometry( mesh, geometry ) {

                mesh.children[ 0 ].geometry.dispose();
                mesh.children[ 1 ].geometry.dispose();

                mesh.children[ 0 ].geometry = new THREE.WireframeGeometry( geometry );
                mesh.children[ 1 ].geometry = geometry;

                // these do not update nicely together if shared

            }
    const guis = {

    CylinderGeometry: function( mesh ) {

                    const data = {
                        radiusTop: 5,
                        radiusBottom: 5,
                        height: 10,
                        radialSegments:40,
                        heightSegments: 1,
                        openEnded: false,
                        thetaStart: 0,
                        thetaLength: twoPi
                    };

                    function generateGeometry() {
          
                        updateGroupGeometry( mesh,
                            new THREE.CylinderGeometry(
                                data.radiusTop,
                                data.radiusTop,
                                data.height,
                                data.radialSegments,
                                data.heightSegments,
                                data.openEnded,
                                data.thetaStart,
                                data.thetaLength
                            )
                        );
                    }

                    const folder = gui.addFolder( 'THREE.CylinderGeometry' );

                    folder.add( data, 'radiusTop', 0, 30 ).onChange( generateGeometry     );
                    
                    folder.add( data, 'height', 1, 50 ).onChange( generateGeometry );
                    


                    generateGeometry();

                },
     }
  
     function chooseFromHash( mesh ) {

                const selectedGeometry = 'CylinderGeometry';
       

                if ( guis[ selectedGeometry ] !== undefined ) {

                    guis[ selectedGeometry ]( mesh );
          

                }

            }


    gui = new dat.GUI();

            const scene = new THREE.Scene();
            scene.background = new THREE.Color( 0x444444 );

            const camera = new THREE.PerspectiveCamera( 75, window.innerWidth /      window.innerHeight, 0.1, 50 );
            camera.position.z = 30;

            const renderer = new THREE.WebGLRenderer( { antialias: true } );
            renderer.setPixelRatio( window.devicePixelRatio );
            renderer.setSize( window.innerWidth, window.innerHeight );
            document.body.appendChild( renderer.domElement );

            const orbit = new THREE.OrbitControls( camera, renderer.domElement );
            orbit.enableZoom = false;

            const lights = [];
            lights[ 0 ] = new THREE.DirectionalLight( 0xffffff, 3 );
            lights[ 1 ] = new THREE.DirectionalLight( 0xffffff, 3 );
            lights[ 2 ] = new THREE.DirectionalLight( 0xffffff, 3 );

            lights[ 0 ].position.set( 0, 200, 0 );
            lights[ 1 ].position.set( 100, 200, 100 );
            lights[ 2 ].position.set( - 100, - 200, - 100 );

            scene.add( lights[ 0 ] );
            scene.add( lights[ 1 ] );
            scene.add( lights[ 2 ] );

            const group = new THREE.Group();


            const geometry = new THREE.BufferGeometry();
      
            geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( [], 3 ) );


            const lineMaterial = new THREE.LineBasicMaterial( { color: 0xffffff, transparent:   true, opacity: 0.5 } );
            const meshMaterial = new THREE.MeshPhongMaterial( { color: 0x156289, emissive:   0x072534, flatShading: true } );

            group.add( new THREE.LineSegments( geometry, lineMaterial ) );
            group.add( new THREE.Mesh( geometry, meshMaterial ) );


            
    chooseFromHash( group );



            scene.add( group );
            // scene.add(group2)

            function render() {

                requestAnimationFrame( render );

                //group.rotation.x += 0.005;
                //group.rotation.y += 0.005;

                renderer.render( scene, camera );

            }

            window.addEventListener( 'resize', function () {

                camera.aspect = window.innerWidth / window.innerHeight;
                camera.updateProjectionMatrix();

                renderer.setSize( window.innerWidth, window.innerHeight );

            }, false );

            render();

Codepen

onclick attr item inside an iframe, not working in some pages

So I am buildning a html devtools for mobile.

this i do by injecting script and an iframe into the page, and it work fine.

I encounter some odd issue.
Ihave this code which work on all pages except google and webnovel gor some reason.

tagStart.el.setAttribute(
             "onclick",
             "window.event.stopImmediatePropagation();this.classList.toggle('readmode');this.querySelector('emchild>.emtext').classList.toggle('readmode')"
             );

this element exist inside an iframe, any reason why it dose not click when i am on some pages.

the i frame and its container have max zindex

How to merge rows that have the same values on my dynamic table with some conditions using JavaScript

My goal is to merge rows for the first 3 columns of my table but if the first column has a different value, my second column should not merge.

To visualize better here is my current table:

https://imgur.com/uGcr54O

And I want to make it look like this:

https://imgur.com/8ibuvoU

As you can see on the first image, BBB1 is merged 4x because it appeared on my query 4x, but since it has a different value on the first column, I need to merge it like it shows on the 2nd image.

Here’s my current code:

<script>
            var table = document.getElementById('myTable');
            function mergeCells(table, startIndex) {
              var headerCell = null;

                for (var row of table.rows) {
                var firstCell = row.cells[startIndex];

                if (headerCell === null || firstCell.innerText !== headerCell.innerText) {
                  headerCell = firstCell;
 
                } else {
                  headerCell.rowSpan++;
                  firstCell.parentElement.removeChild(firstCell);
                
                }
              }
            }
              mergeCells(table, 2);
              mergeCells(table, 1);
              mergeCells(table, 0);
 </script>

Nuxt 3 + Vue 3, micro frontend with vite-plugin-federation. Why 500 error?

I have 2 applications, the first is on Vue (micro frontend module), the second is on nuxt(host app).

First application vite config:

import { fileURLToPath, URL } from "node:url"

import { defineConfig } from "vite"
import federation from "@originjs/vite-plugin-federation"
import vue from "@vitejs/plugin-vue"

export default defineConfig({
  preview: {
    port: 5005
  },
  plugins: [
    vue(),
    federation({
      name: "app1",
      filename: "app1Remote.js",
      exposes: {
        "./App": "./src/App.vue"
      },
      shared: ["vue"]
    })
  ],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url))
    }
  },
  build: {
    minify: false,
    cssCodeSplit: false,
    target: "esnext"
  }
})

Nuxt app config:

import federation from "@originjs/vite-plugin-federation";
export default defineNuxtConfig({
  devtools: { enabled: true },
  vite: {
    plugins: [
      federation({
        name: 'host-app',
        remotes: {
          remote_app: `http://127.0.0.1:5005/assets/app1Remote.js`,
        },
        shared: ['vue']
      })
    ],
  }
})

Then, I start my first app on vue with vite preview command

And in the second application I get this error:

nuxt application 500 error

BUT, if I open http://127.0.0.1:5005/assets/app1Remote.js, i’ll see app1Remote.js file

enter image description here

Connect Api GPT-3.5 to internet

Could you explain to me step by step how to establish a connection between the GPT-3.5 API and the Internet to allow it to search online and rephrase the information it gets? I would like this process to be as simple as possible. I plan on using either Python or JavaScript for this, so I would appreciate if your help could be geared towards either of these programming languages.

Persist selection after markjs instance.mark(tx)

I am using markjs.io to highlight content on my page on-demand – but I want to retain any range selections once the marks are added – currently it’s inconsistent between double-clicking on a word verses selecting a word using mousedown-move-up … both seemingly random in their result

enter image description here

I am marking the selections using the following javascript:

const selection = window.getSelection();
let findtx = selection.toString().trim();
var instance = new Mark(document.querySelector('#container'));
nstance.mark(findtx, {
    done: function() {
      instance.mark(findtx, {
        caseSensitive: false,
        separateWordSearch: false
      });
    }
  });

Runtime example available on https://jsfiddle.net/Abeeee/9guLs35w/20/