These are chat archives for niallobrien/IrishDevs

15th
Jan 2015
Niall O'Brien
@niallobrien
Jan 15 2015 08:02
Morning all, what's everyone working on?
Aaron Sinnott
@aaronsnig501
Jan 15 2015 09:25
Javascript event handling...
Niall O'Brien
@niallobrien
Jan 15 2015 10:04
Having fun?
Aaron Sinnott
@aaronsnig501
Jan 15 2015 10:07
Hate it with a fiery passion haha
Chrome apps won't allow for any inline JS so I can't even <body onload="init()"></body> and such
So adding onclick events to dynamically generated elements is rather arduous haha
Niall O'Brien
@niallobrien
Jan 15 2015 10:11
Use $(document).ready()
Once the page’s fully loaded you can then bind to whatever elements you want
Aaron Sinnott
@aaronsnig501
Jan 15 2015 10:17
All the content is pulled from an API. I have an onload event that pulls in a JSON array of media types (movies, tv shows and audio). They then need to be appended. to a <ul> so that when a user clicks on, say, movies, it will make another API request to retrieve the movies
And so on
Its probably not as complicated as I believe it to be haha
Niall O'Brien
@niallobrien
Jan 15 2015 10:40
@aaronsnig501 There’s two ways to do this easily afaik
$(document).on("click", “.movie", function (e) {...};
Or after you’ve added the movies to the DOM, attach an event handler function to them. See: http://api.jquery.com/on/
@tjFogarty What do you think?
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:12
Using .on() might work actually. I'll give it a shot :)
Niall O'Brien
@niallobrien
Jan 15 2015 11:13
They’d both work - depends which you prefer really.
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:15
.on seems to be working like a charm :D
Cheers!
Niall O'Brien
@niallobrien
Jan 15 2015 11:16
Np, glad it worked. bind() and live() are older methods, .on() should do the trick for most cases. :)
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:23
I'm probably gonna end as a JavaScript virtuoso by the time this project is finished haha
Niall O'Brien
@niallobrien
Jan 15 2015 11:23
Lol, so is the client-side jQuery kinda stuff?
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:26
The client-side is jQuery stuff, but I also have a library that's written in old-school JavaScript and for the tests I'm using a combination of Mocha, Sinon, Chai and PhantomJS
Niall O'Brien
@niallobrien
Jan 15 2015 11:26
Ah nice, you’re doing testing too! :)
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:27
Yup. Its a nightmare doing them for Chrome apps though haha. UI is Foundation also
Niall O'Brien
@niallobrien
Jan 15 2015 11:27
Check out Browserify, it really helps when using the revealing module pattern with JS.
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:28
Can I use Browserify to require a non-NodeJS Javascript file on the back-end?
Niall O'Brien
@niallobrien
Jan 15 2015 11:29
A non-NodeJS Javascript file? Just wrap it in a module and export its public methods. Then require that file.
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:30
The JavaScript file needs to be a stand-alone file. A developer needs to import it as a library just like jQuery
Niall O'Brien
@niallobrien
Jan 15 2015 11:31
On the front-end?
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:31
Yep
Niall O'Brien
@niallobrien
Jan 15 2015 11:31
Yeah, you can write modules that will run on both the front and back-end. Browserify will certainly help here.
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:32
Awesome. I'll take a look when I get back to testing so!
Niall O'Brien
@niallobrien
Jan 15 2015 11:32
In terms of being able to require() the file on either the front or backend
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:35
What are you working on these days?
Niall O'Brien
@niallobrien
Jan 15 2015 11:36
Gotta get the President’s site out the door before I finish up at the end of next week.
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:36
How likely is that looking?
Niall O'Brien
@niallobrien
Jan 15 2015 11:37
Getting there - see for yourself: http://217.78.5.157
First image is very pixelated :P
Niall O'Brien
@niallobrien
Jan 15 2015 11:39
It’s cuz they uploaded a tiny image and its being upscaled, click through the image to see. :P
If you notice any bugs, please do let me know.
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:44
Yeah, that's very small. I'll do my best to have a gander!
Niall O'Brien
@niallobrien
Jan 15 2015 11:44
Cheers dude!
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:44
Any news on the moving to London front?
Niall O'Brien
@niallobrien
Jan 15 2015 11:45
Nothing yet, emailed them this morning as I need an accommodation list. Reckon I’ll be cutting it pretty close.
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:48
I'd imagine so all right. And you're gonna be there for 2 months?
Niall O'Brien
@niallobrien
Jan 15 2015 11:55
Yeah, hopefully shorter but I guess it depends on accommodation etc.
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:55
Any joy finding an office?
Niall O'Brien
@niallobrien
Jan 15 2015 11:55
Got tickets to a meetup in Kent on the night of my birthday so might catch that.
There's offices around the corner from where I am atm, but I've to wait until next week when the main guy is back from holidays.
Aaron Sinnott
@aaronsnig501
Jan 15 2015 11:59
That cold get awkward :P
*could
Niall O'Brien
@niallobrien
Jan 15 2015 12:02
Shur Aaron’s already being awkward with me, barely saying a word to me and has thrown me the odd evil look.
Aaron Sinnott
@aaronsnig501
Jan 15 2015 12:03
He's probably gonna chain you to the desk and bring in a bucket of fish heads for you every morning!
Niall O'Brien
@niallobrien
Jan 15 2015 12:06
Lol! He’s just being weird is all. Like “OMG, Niall’s leaving - don’t tell him shit and give him funny looks!” lol
Aaron Sinnott
@aaronsnig501
Jan 15 2015 12:07
That's kinda creepy...
Niall O'Brien
@niallobrien
Jan 15 2015 12:07
It’s just sad imo.
Aaron Sinnott
@aaronsnig501
Jan 15 2015 12:07
Indeed haha
Its rather petulant haha
Niall O'Brien
@niallobrien
Jan 15 2015 12:13
It’ll get him a dig if he crosses me, lol
Aaron Sinnott
@aaronsnig501
Jan 15 2015 12:15
I know you're leaving there soon but...
Aaron Sinnott
@aaronsnig501
Jan 15 2015 16:44
You can only see half of the president's head in some of the images in the carousel on the homepage :P
Niall O'Brien
@niallobrien
Jan 15 2015 16:50
Out of my control for the most part.
I blame the design! :P
Aaron Sinnott
@aaronsnig501
Jan 15 2015 16:51
Yeah, yeah...!
Niall O'Brien
@niallobrien
Jan 15 2015 18:42
Heads up lads, room is public and indexed by Google. I'm gonna delete this room later & figure out something else. Will invite you all to something else. Thanks.