These are chat archives for MontCode/GeneralChat

21st
Jul 2016
Jonathan Herman
@lantech19446
Jul 21 2016 00:05
was thinking about including some of the animation in my header if it's possible, almost all of the stuff is CSS sometimes slightly modified but I'm not sure how I'd include jquery and I'm pretty new to setting up a room
Lily Romano
@Lilyheart
Jul 21 2016 00:16
Home soon.
Lily Romano
@Lilyheart
Jul 21 2016 00:42
If you are wanting to do it on a subreddit you manage so that everyone can see it, no. Scripting in general is not allowed, css only. You might be able to accomplish some small animations with css only (google css only animation)
Jonathan Herman
@lantech19446
Jul 21 2016 00:43
ok I'll give it a shot, idk why I really want to do it other than a bit of added pizazz
Lily Romano
@Lilyheart
Jul 21 2016 00:43
Nothin’ wrong with css animation!
Lily Romano
@Lilyheart
Jul 21 2016 01:04
woot. used git stash for the first time!
Eric Phy
@SimplyPhy
Jul 21 2016 02:04

https://simplyphy.github.io/P5_NeighborhoodMap/

Getting there! (it’s taking foreverrr)

but i’m 10x the programmer from before I started it

rapidprogress #slowproject

ha no hashtags here xDD
Lily Romano
@Lilyheart
Jul 21 2016 02:59
Could probably fake it @SimplyPhy #slowproject
David Castner
@davidjcastner
Jul 21 2016 12:27
@Lilyheart sorry I wasn't available yesterday. The markdown to slides tool is right up my alley
Eric Phy
@SimplyPhy
Jul 21 2016 19:21
in a situation like this:
var newPlaces = searchBox.getPlaces();

    if (places) {
        updateCheck();            }
        function updateCheck() {
            if (newPlaces[0] == places[0]) {
                setTimeout(function(){
                    newPlaces = searchBox.getPlaces();
                    updateCheck();
                    console.log(newPlaces[0] == places[0]);
                }, 100);
            } else {
                return;
        }
    }

places = searchBox.getPlaces();
whoops..
Eric Phy
@SimplyPhy
Jul 21 2016 19:54
forget the above; i can’t delete it xD
@davidjcastner @Lilyheart is there a way to get one user event (e.g. “click”) to trigger a custom event from an api (e.g. “places_changed” from google maps places api)?
David Castner
@davidjcastner
Jul 21 2016 19:57
yes that's what event listeners are for
Eric Phy
@SimplyPhy
Jul 21 2016 19:57
the problem for me is, when places_changed is triggered, it waits for the response from a background ajax request. when i try to run the same function from a click response, it doesn’t wait for the request, and so often gets the wrong result.
basically i want a click event to mimic the places_changed event
David Castner
@davidjcastner
Jul 21 2016 19:59
this is what callbacks are for
Eric Phy
@SimplyPhy
Jul 21 2016 19:59
right, i’m using the same callback for each
they just respond differently
also: you’re probably right, and i just don’t understand
David Castner
@davidjcastner
Jul 21 2016 20:00
hold on
are you using jquery ajax?
Eric Phy
@SimplyPhy
Jul 21 2016 20:02
it’s not my ajax request, the ajax is built into the places_changed event
it’s a part of the api
David Castner
@davidjcastner
Jul 21 2016 20:03
link to api?
all i’m trying to do is get a button to take the input from my searchBox and have it do the same thing as when the user selects an item from the google search pulldown that’s built into the searchbox
problem:
click -> functionA doesn’t wait for the search response, while
places_changed -> functionA does :cry:
David Castner
@davidjcastner
Jul 21 2016 20:09
okay what is the search response you are talking about, I'm not seeing it in their example
searchBox.getPlaces();?
Eric Phy
@SimplyPhy
Jul 21 2016 20:10
yeah
actually maybe that’s the ajax request
is there a way to make click automatically do something like buttonDown ? That might be the requirement for this to work...
David Castner
@davidjcastner
Jul 21 2016 20:16
This message was deleted
Screenshot from 2016-07-21 16-16-37.png
looks like getPlaces is only meant to be used with the places_changed evetn
normally I would to see if a function like this accepts a callback as an argument, but it's built into google maps api and does not accept one
there are two work arounds
Eric Phy
@SimplyPhy
Jul 21 2016 20:19
yeah i figured that, i was hoping there was some way to just make click == places_changed, or for click to check places_changed
David Castner
@davidjcastner
Jul 21 2016 20:19
hacky way is use setTimeout
Eric Phy
@SimplyPhy
Jul 21 2016 20:19
yeah i tried that, but it’s buggy
David Castner
@davidjcastner
Jul 21 2016 20:19
and wait for response, but this is unreliable
Eric Phy
@SimplyPhy
Jul 21 2016 20:20
that function i posted at 15:21 was one version of my attempt to get this to work
David Castner
@davidjcastner
Jul 21 2016 20:20
second way to build a async => sync queue runner, I've done this before I'll see if I can find an example
Eric Phy
@SimplyPhy
Jul 21 2016 20:20
if it’s difficult to find, don’t sweat it
i don’t actually need the button, i just figured it wouldn’t be so difficult to implement
David Castner
@davidjcastner
Jul 21 2016 20:21
actually nevermind can't use that her, that's when you create the async function yourself
don't have access to the getPlaces function
Eric Phy
@SimplyPhy
Jul 21 2016 20:22
yeah
so basically you can’t just point one user event to another?
David Castner
@davidjcastner
Jul 21 2016 20:22
this comes down to google's api not anything on your part, I'm sure google has a good reason for not allowing people to use callbacks
Eric Phy
@SimplyPhy
Jul 21 2016 20:22
right
David Castner
@davidjcastner
Jul 21 2016 20:23
hmm I'm not sure if that's possible
Eric Phy
@SimplyPhy
Jul 21 2016 20:23
usually it wouldn’t matter, because the function is usually the important part of the functionality
David Castner
@davidjcastner
Jul 21 2016 20:24
you might be able to trigger a place_change, not necessarily point it to the event
Eric Phy
@SimplyPhy
Jul 21 2016 20:26
yeah, oh well
David Castner
@davidjcastner
Jul 21 2016 20:26
nah I dont that would even work
Eric Phy
@SimplyPhy
Jul 21 2016 20:26
i’ll just remove the button
David Castner
@davidjcastner
Jul 21 2016 20:26
sorry that your out of luck
Eric Phy
@SimplyPhy
Jul 21 2016 20:26
i was hoping it was just my lack of knowledge
just learning the limits of the language :D
thanks @davidjcastner
David Castner
@davidjcastner
Jul 21 2016 20:27
the best option would be to dig around in the google maps reference and try to figure out the inner working of SearchBox class
David Castner
@davidjcastner
Jul 21 2016 20:37
@SimplyPhy had an idea one sec
Eric Phy
@SimplyPhy
Jul 21 2016 20:38
it’s okay, i just removed the button and all of it’s associated elements
i’m not that concerned with it, i was more interested in what i could learn about javascript through that challenge
Eric Phy
@SimplyPhy
Jul 21 2016 20:46
here’s another, hopefully easy one:
if ( viewModel.filterSearchInput() && typeof viewModel.filterRadiusInput() == "number") {
    return true;
} else {
    return false;
}
anything specifically wrong there?
David Castner
@davidjcastner
Jul 21 2016 20:48
here use this: searchBox.__e3_.places_changed[17].b.call()
use that in your click listener as long as you have the event listener for place_changed set up it will copy that
so it would be:
document.getElementById("myBtn").addEventListener("click", function(){
    searchBox.__e3_.places_changed[17].b.call()
});
David Castner
@davidjcastner
Jul 21 2016 20:53
i don't see anything wrong with that statement
Eric Phy
@SimplyPhy
Jul 21 2016 20:53
me neither :(
just doesn’t work..something to do with how i’m using knockout
ha, how did you find that? google api or did you configure it via epic powers?
David Castner
@davidjcastner
Jul 21 2016 20:56
chrome debugger
i'm not sure if that's the exact functionality you want, but it goes back to the previous selected spot
Eric Phy
@SimplyPhy
Jul 21 2016 20:58
ha nice
quite the hack :D
i need to get on your level xD
so wait, in your example, would i just put the rest of the function after the searchBox.__e3_.places_changed[17].b.call() ?
Eric Phy
@SimplyPhy
Jul 21 2016 21:01
like:
searchBox.__e3_.places_changed[17].b.call();
var happy = “something”;
// do a bunch of stuff, etc
David Castner
@davidjcastner
Jul 21 2016 21:03
it just runs whatever function you have in searchBox.addListener('places_changed', function() {});
Eric Phy
@SimplyPhy
Jul 21 2016 21:05
haha that’s awesome
great job man, i’m not competent enough with dev tools to find something like that
David Castner
@davidjcastner
Jul 21 2016 21:07
let me know if it works, I'm curious because it's quite a hack
Eric Phy
@SimplyPhy
Jul 21 2016 21:10
just finishing another feature real quick, ill give it a go in a sec