« first day (3931 days earlier)      last day (1018 days later) » 

1:53 AM
superb commenting by @JBis from a couple years ago
Array.from(body["adult_tickets"]); // convert it to an array
also this beauty for compatibility with old links after switching from php to node
router.get('/list.php', async function (req, res, next) {
 
@coding4532 Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
@coding4532 Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
1 message moved to Trash can
 
user6499132
How do you format code before sending a message?
 
> hit Ctrl+K before sending
 
user6499132
I need help changing this to vanilla javascript.

Is there anyone on here who can help?

jsfiddle.net/c7or0vgp

 $('.curtain').click(function() {
      $('.fadeout').delay(500).fadeOut(3000, function() {
          $(this).remove();
      });
  });
 
|| mdn element remmove
 
@coding4532 read all those links, then post your attempt
 
user6499132
2:40 AM
Is this something that is difficult to do? For someone who does not have a lot of experience in coding?
 
it depends what your experience is, but basic knowledge of HTML, CSS, and JS should be adequate (with a little googling of course)
Start with $('.curtain'). Convert that to vanilla.
 
user6499132
@JBis This? document.querySelectorAll(".curtain").
 
Good. Do you have more than one element with the class of .curtain?
 
user6499132
It is going to end up going in this code. jsfiddle.net/c9r1uL4t Curtain is only there 1 time.
 
user6499132
I should remove the all?
 
user6499132
2:53 AM
If I added the same fade out to another element, I would then use all?
 
@coding4532 querySelectorAll selects all matching elements, querySelector selects the first matched element. If you only have one, then just use querySelector.
So we have document.querySelector('.curtain'). Next is .click. What does that do? How can we replicate it in vanilla?
 
user6499132
It's going to be added to this:

(function iife() {
  "use strict";

  function show(el) {
    el.classList.remove("hide");

  }

  function hide(el) {
    el.classList.add("hide");
  }

  function coverClickHandler(evt) {
    const cover = evt.currentTarget;
    hide(cover);
    const curtain = document.querySelector(".curtain");
    curtain.classList.add("slide");
    const thewrap = curtain.parentElement.querySelector(".container");
    show(thewrap);
  }

  const cover = document.querySelector(".jacketa");
 
user6499132
This then? document.querySelector(".curtain").addEventListener("click", coverClickHandler);
 
user6499132
or would I be writing it a different way?
 
3:12 AM
coverClickHandler isn't exactly equivalent and its a bit all over the place but that's fine if its what you want
@coding4532 Yes. You could also use an arrow function.
document.querySelector(".curtain").addEventListener("click", (e) => {
   // your handler here
});
@coding4532 did you write this part?
 
user6499132
I had help with the code if that is what you mean.
 
I'd suggest continuing with above
The next part is ` $('.fadeout').delay(500).fadeOut`. This is a bit more complicated and there are multiple ways to do it.
start with creating two css classes, one where the element is 100% visible and the other where it is 0% visible (but still exists within the dom)
 
user6499132
3:31 AM
This: jsfiddle.net/fsg79axb

.visible {}

.hidden {
  display: none;
}
 
user6499132
This way?

.curtain.visible {}

.curtain.hidden {
  display: none;
}
 
user6499132
Here the 2nd one. jsfiddle.net/fsg79axb
 
@coding4532 unfortunately you can't animate over display. Try a different property.
Think about what fading is.
 
user6499132
block?
 
user6499132
.hidden{
  display:block;
}
 
3:42 AM
Can't use display
 
user6499132
transition.
 
|| mdn css opacity
 
user6499132
opacity
 
take a look at that then make your classes
 
user6499132
3:45 AM
wouldn't I be adding this? fadeOut(3000, to the javascript? That does the fading stuff.
 
You can do it using pure js (that's what jquery does) but the proper way is using css
If you wanted to use js you would basically just run a loop and change the opacity via js
But then you run into the issue of the event loop, blocking ui thread, and a million other issues. So just use css for now.
 
 
1 hour later…
user6499132
4:59 AM
Is this good?

jsfiddle.net/ytp2a4f8/1

.fadeout {
  opacity: 1;
  transition: all 3s;
}

.fade {
  opacity: 0;
}

document.querySelector('.curtain').addEventListener('click', function(e) {
  let f = document.querySelector('.fadeout')
  setTimeout(function() {
    f.classList.add('fade')
  }, 500);
  setTimeout(function() {
    f.parentNode.removeChild(f)
  }, 3500);
});
 
user6499132
5:17 AM
@JBis How do I fix this? --- Uncaught TypeError: Cannot read property 'removeChild' of null" jsfiddle.net/jastobhr
 
user6499132
After the play image is clicked I receive that error message.
 
@coding4532 f.remove()
 
user6499132
5:32 AM
Is that supposed to go somewhere in the code?
 
user6499132
If so. where do I place it?
 
user6499132
Like this? document.querySelector('.curtain').addEventListener('click', function(e) {
  let f = document.querySelector('.fadeout');
  setTimeout(function() {
    f.classList.add('fade');
  }, 500);
  setTimeout(function() {
    f.parentNode.removeChild(f)
  }, 3500);
  f.remove();
});
 
user6499132
no, that looks wrong.
 
user6499132
What am I supposed to do?
 
user6499132
How is it fixed?
 
user6499132
6:26 AM
How do you add a delay to a css transition? Does anyone know?
 
7:48 AM
@coding4532 transition-delay, just fucking google it
 
8:26 AM
you can even paste this question literally into google to get that answer ;x
 
user6499132
8:39 AM
It's not working in the code.
 
user6499132
Can I share with you the code I am working on and you can see if you can get it to work?
 
user6499132
I have it set up differently from what you see above.
 
user6499132
9:22 AM
I am having trouble centering a div class in the middle using absolute positioning.
 
11:22 AM
I actually hope that's just for the meme @coding4532
 
@SebastianCiocarlan Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
 
1 hour later…
12:33 PM
Hey
 
12:51 PM
@coding4532 read what it does then think where it should go
 
1:39 PM
@Marc Ye, you probably need to write your own if you realy want a plugin system like that. It's more common to build a plugin system in a single process and it's pretty simple to do so too. Going multiprocess means you need to coordinate (child)processes and being able to communicate between them introducing typical multiprocess problems.
You could also change your architecture into a plugin host model and mix it with more common stuff like Worker Processes (f.e. NodeJS Cluster). Meaning each process is a plugin host (with separate manager) and can handle a request/response with the needed plugin chain. The primary NodeJS handles startup/shutdown and such.
Or.. build it single process and use multiple NodeJS instances with a balancer in front.
 
2:22 PM
        const [testData, setTestData] = useState({postId: null, postBody: null})
    posts.map(post => {
                    console.log(post.id)
                    setTestData({postId: post.id, postBody: post.body})
                })

What am I doing wrong?
 
@Richard Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
 
 
4 hours later…
6:19 PM
I have always this annoyance with test code: there is really neat code. Yet tests are ugly as hell, with a lot of code burried behind setup variables for mocking data...
 
6:51 PM
posted on July 21, 2021 by Harry Souders

Hi, everyone! We've released Chrome Beta 93 (93.0.4577.8) for iOS: it'll become available on App Store in next few days. You can see a partial list of the changes in the Git log. If you find a new issue, please let us know by filing a bug. Harry Souders Google Chrome

 
7:45 PM
posted on July 21, 2021 by Prudhvikumar Bommana

 The Dev channel has been updated to 93.0.4577.8 for Windows, Linux and Mac. A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Prudhvikumar Bommana Google Chrome

 
 
2 hours later…
9:40 PM
I trying to build a function expression tree in infix order like the following example If(And(A,B), Or(C,D), UUID()). Each node can have a function i.e if, And, Or etc, a variable or a literal(leaf nodes can be either or these two). A function can be bounded with limited number of parameters or none or unbounded(indefinite number of parameters i.e And() function).
I know that the general approach is to use a stack and traverse the tree in a dfs like manner. I'm trying to do this in a iterative approach.
 
1. what does If(And(A,B), Or(C,D), UUID()) mean?
2. I don't understand your question
@LuisAverhoff
 
@JBis It is suppose to be function expression string in infix form that is constructed by a query filter tree. I should mention that this is an nary tree.
 
in english, what does it mean
 
It is suppose to be a query.
 
Maybe third time is the charm. Convert "If(And(A,B), Or(C,D), UUID())" to english.
e.g. if ((a AND b) and (c OR D))...
What does UUID function mean?
 
9:56 PM
is it a function that returns a unique identidier.
 
And within the context of an if function what does it do?
 
So this is similar to what we are building
 
Alright
whats the question?
 
I trying to transform the query filter tree containing the functions, variables and literals that the user has chosen into a string that is infix notation.
 
Alright...
How is it currently being represented?
 
10:02 PM
In order words I need to transform a query filter tree like this.

```js
if
And
A
B
Or
C
D
UUID
```js
to `If(And(A,B), Or(C,D), UUID())`
 
Is

"if
And
A
..."

a string and is `If(And(A,B), Or(C,D), UUID())` a string?
 
No it is suppose to be in a tree format but it didn't indent it properly to make it look like a tree.
 
But how is it stored? Is it string? an object?
 
The tree is stored as an object containing an array of children.
 
And how do you want If(And(A,B), Or(C,D), UUID()) to be stored?
 
10:06 PM
As a string
 
can you paste the output of json.stringify(tree)?
 
Doing JSON.stringify on the tree gives incorrect output so I resorted to just console.log the tree.
 
where are the arguments for and, or?
 
And, or are unbounded functions. In my application, this means a function that can have 0 or more arguments. In the console.log for the tree, I didn't add any arguments for them.
 
ok, so what are you asking about? you could probably use recursion for something like this
I have something sorta similar I built
 
10:17 PM
I know but I'm trying to do strictly iterative.
 
any reason why? recursion seems perfect for this
 
Just to assure that no stackoverflow occurs.
 
Is this a hypothetical or is it likely to happen? Seems like premature optimization.
I used recursion for a very similar situation for @JamesBot github.com/jbis9051/JamesSOBot/blob/master/packages/plugins/src/…
 
Possibly

I just imagining a user creating a query that is very deep.
 
It would have to be extremely deep to cause a SO. And at that point the query would be probably too large and complex to execute.
Honestly most js engines probably optimize away the recursion anyway
I'd write it recursively, if you start getting SO errors, then you can figure out to write it iteratively or implement it in a different language and compile to wasm.
 
10:26 PM
Alright man, thanks for the discussion.
 
Good luck
 
10:44 PM
||> REPLACERS
 
@JBis 'ReferenceError: REPLACERS is not defined' Logged: [ ] Took: 0ms
 
||> replacer
 
@JBis 'ReferenceError: replacer is not defined' Logged: [ ] Took: 0ms
 
interesting, i thought it would leak
 
Does anyone know if it's possible to have some sort of "shallow" class? Basically, I want to do

obj = new testClass(5)

and then I can do things like

console.log(obj)

and have it return 5.
 
10:54 PM
@Jack Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
11:24 PM
@Jack theres a bunch of ways to do that
||> class testClass extends Number {
}

obj = new testClass(5)
console.log(obj)
 
@JBis undefined Logged: [ '5' ] Took: 0ms
@JBis undefined Logged: [ '{"val":5}' ] Took: 0ms
 
Prefect. On your first example is there a way to alter the value with a sort of poxy before it's returned.
 
@JBis undefined Logged: [ '"[object Object]"' ] Took: 0ms
@JBis undefined Logged: [ '{"val":5}' ] Took: 0ms
 
@Jack you can do it in the constructor
there's also a way to use valueOf function, tho i'm too lazy to figure how to do it
|| mdn valueOf
 
11:31 PM
^ read that
 
Cool, thanks!
 

« first day (3931 days earlier)      last day (1018 days later) »