« first day (437 days earlier)      last day (4736 days later) » 

02:00
You know, I think about it, and the last line really is simple. But to get to the point of thinking like that? That's the hard part. Programming isn't about what comes out...it's the process, it's the mentality.
</philosophyMoment>
@Zirak On the subject of process, is there a reason you went with gEBCN instead of gEBTN("img")?
Future proofing and it made more sense
If it was a byTagName call, you would have to second-guess what these images are. The class names already describe them.
Plus, if they ever change the image tag to something else, all you have to do is change the inner function, and not the inner function and the byTagName call
I guess so. The number at the end of the class name just made me a little suspicious. That seems like it would be more likely to change
GGG
GGG
it's the size
it does change when lots of people are in the room i think
You're right
You can select the parent div instead
Yea, its 23px on the All rooms page
[].map.call( document.getElementById('present-users').getElementsByClassName('avatar'), function ( wrapper ) {
    return wrapper.children[ 0 ].title;
}).sort()
@island205 You already accepted an answer, how can we help any further?
this is probably awful
It's already light-years ahead of some DOM processing snippets I've seen
in fact i could skip the whole array stuff
just append to the body in that first loop
02:11
I don't get the toPush array though
Why not just push an object?
@Zirak i accepted the answer because i thank he for long explian. but the answer does.t get the point.
@island205 you usually accept an answer when it has answered your question :P
now he'll be devastated to see he's lost 15 rep when you accept another answer
@island205 It's simple. this in the browser, assuming nothing else, is the global scope. In Node it isn't.
Questions?
@Purmou if you give a more right answer i would accept your answer
@Zirak detail please
oh, and if an answer doesn't answer your question, don't accept it because the answerer smells nice.
02:15
never worked with node.js
so can't answer :P
@Zirak ok
@Zirak i want to know the excute process
How can I be any more detailed? Do you want an explanation on how this is resolved in js? On what the global scope is? I don't know much about node, but I do know this part of js
2
A: Does jQuery do some magic with the `this` variable?

ZirakTrimmed and rephrased from source to match your usage: jQuery.each = jQuery.fn.each = function( object, callback ) { for ( var i = 0, length = object.length ; i < length; i++ ) { if ( callback.call( object[ i ], i, object[ i ] ) === false ) { break; } } ...

Related, very very related. Ignore the parts where I speak about jQuery
It's a detailed explanation of how this is set
@Zirak oh, i know scope in js too. but i can't explian why output is undefined with js knowledge.
Do you what the global scope is?
@Zirak yeah
02:19
Then it doesn't exist in Node.
Does that answer your question?
removes the list in a better way too, i think
Nicely done
@Purmou I was gonna suggest that way of removing the list - nice
being in this room does help
@Zirak but when i excute console.log(this) in Node's top-level module scope, i get {}. what is this?
02:21
it's like stuff is embedded subconsciously, i love it
i'm learning a lot by just being here
It's the current scope
hmm
Like the global scope, just not global. It isn't shared amongst everything, just amidst your file
does document.createElement("br") work?
@Purmou Yep :D
GGG
GGG
02:22
!Zirak /learn {"name":"link","input":".*","output":"<a href='http://www.google.com/search?btnI=I&q=$0'>$0</a>"}
Yes it does, but jsfiddle has a CSS reset so you might not @GGG Command link learned
see the effect
GGG
GGG
sry
It's okay
i'll uncheck normalized CSS
I should really do something about it
GGG
GGG
02:23
!Zirak /link jquery animate
ohhhh
@GGG &lt;a href=&#39;http://www.google.com/search?btnI=I&q=jquery animate&#39;&gt;jquery animate&lt;/a&gt;
GGG
GGG
FUUUUU
i was about to append the br tot he a
how do i add the element after in JS?
What did you expect? :D
02:23
(and i'm trying so friggen hard not to use jQuery right now xD)
!Zirak /mdn element.insertAfter
insertAfter
GGG
GGG
there must be a way
02:24
i remembered the second after you said it
I think that was it
lol
for instance
var setName;
setName = function (name) {
return this.name = name;
};
setName("LuLu");

when `setName("LuLU")` called, what is `this` refer to,a new excute context but not the top-level module scope?
Apparently not...
GGG
GGG
!Zirak /learn {"name":"link","input":".*","output":"[$0`]``(http://www.google.com/search?btn‌​I=I&q=$0)`"}
02:25
@island205 Each file @GGG Command link learned
GGG
GGG
D:
@Zirak so this is answer.
Each file as a local "global" object
@island205 No, I was talking about something else, and by Odin's beard the pinging noise is driving me insane
@island205 Each file in Node has a local "global" object. Functions called like you did do not create their own special this object, so it's defaulted to: (1)in the browser, the global object, (2)in Node, the file local "global" object
can i use for(var elem in elems)?
GGG
GGG
no
use for (var i=elems.length; i--;)
02:28
You can, but for traversing an array a regular for loop is faster
:2209629 not the file local "global" object.
var setName;
var that=this;
setName = function (name) {
    that==this; //false
    return this.name = name;
};
setName("LuLu");
but getElementsByClassName returns an array-like object, not an array, right?
I don't know what kind of special crap these this objects come with. Maybe it shows you {} because it doesn't actually exist, but does exist for some executions
GGG
GGG
it has a length property
@Purmou It's a NodeList
!Zirak /mdn NodeList
02:29
i'll just stick with the for loop anyways
WOAH WOAH WOAH
did you see that
while Zirak was editing his comment
it inserted the link
GGG
GGG
neat
!Zirak /mdn NodeList
Yes, because it simply appends the output to the textarea
GGG
GGG
don't use for..in on things with length.
yeah, it probably won't work on that, sorry...
@island205 Anyway...the fact is
It is the one and the same thing. Node is javascript. The difference is the global object.
EOD
GGG
GGG
02:31
!Zirak /learn {"name":"link","input":".*","output":"$0: google.com/search?btn‌​I=I&q=$0"}
@GGG Command link learned
GGG
GGG
!Zirak /link jquery+animate
@GGG jquery+animate: google.com/search?btn‌​I=I&q=jquery+animate
user986408
how would i iterate trough nodes ? i've an HTML_UL_object with many LI_objects
user986408
var friends = ulbox.childNodes;
02:33
Do a getElementsByTagName
GGG
GGG
why not just iterate through child nodes?
user986408
wouldn't this return me ALL il s on the whole page ?
@ThatWebNerd You can use ulbox.children, which will skip the whitespace text nodes
Also, childNodes << children
@ThatWebNerd parentNode.getElementsByTagName
user986408
ah
user986408
02:34
right, thanks ^.^
user986408
wait no
user986408
i already have the children
user986408
i want to do something with every one
user986408
i need a loop or something :o
Use a for loop, or [].forEach.call( nodeList, cb );
!Zirak /mdn Array.forEach
GGG
GGG
for (var i=children.length; i--;) console.log(children[i]);
user986408
wew so many responses at once :D thanks guys
@Dennis we made a command for that
!Zirak /lmgtfy for+loop
02:36
@GGG var i = children.length; while ( i --> 0 ) {} super-secret "@Purmou lmgtfy.com/?q=for+loop
Haha, we keep screwing up Zirak's messages
...super secret "going to" operator saves the day!
i know
let's kill it for now :P
GGG
GGG
omg
nah, it's okay
GGG
GGG
02:37
hahah it does look like a "going to"
--> is my favourite operator, by far. It's not well known, but still awesome
GGG
GGG
someone will think you can do var i = 0; while ( i --> children.length )
No, that's just silly
Oh, do you know the fireworks operator? i --=> 0
GGG
GGG
lol
user986408
lol
02:38
insertAfter had no effect...just put them in parent divs
GGG
GGG
.~^~.~^~--=>
unleeeeess
how can i remove the parent node but retain the child node? :P
@Purmou Oh right, forgot to tell you that there's no native insertAfter but I've got a hack for it
let's see it
i'd rather not go through the trouble of that :P
GGG
GGG
what are you trying to do
02:40
insert a <br> after the <a>
GGG
GGG
why
just set the a to display:block or something
because <a> is inline
Element.prototype.insertAfter = function ( target ) {
    return this.parentNode.insertBefore( this, target.nextSibling );
};
that's exactly what I don't want to do
because if we're putting this in the command list
then it doesn't have support for styles, does it? :P
GGG
GGG
what is the point of this command though
you can already see the userlist
02:41
@Zirak I saw that online, i was like wtf
!Zirak /mdn Node.insertBefore
do you see names?
Well, for one, you can't have the bot display html, and why not have it display the names separated by comas? (or commas if you don't like vegetables in your lists)
GGG
GGG
why can't you have the bot display html?
Because I don't have a death wish. You forget that this is stuff that's executed in my browser
You add html you basically expose me to every XSS attack known to man kind
And no, I won't sanitize html input
GGG
GGG
02:44
doesn't SO filter stuff out
Even better, since you'll see it as pure text, and only I get the attack
GGG
GGG
or can i do like img onload="hacks()"
but you are never loading it as html are you
it's just a string that you pass to the server?
huh, point taken
I still won't do it. You write the html -> markdown converter
GGG
GGG
just don't escape the html!
@Zirak will my function currently work as a command?
02:46
I don't, SO chat does
GGG
GGG
i can write html with single quotes
@Purmou No
GGG
GGG
instead of md
what needs to be done?
1 hour ago, by Zirak
It's simple. The command function receives two arguments: Command arguments given in string form and the username. It should return the response, in string form, that'll be replied to the user.
02:48
hmm
do a tags work on SO chats?
//so your command looks like:
function ( args, usr ) {
    return output;
}
GGG
GGG
!Zirak /learn {"name":"link","input":".*","output":"<a href='http://www.google.com/search?btnI=I&q=$0'>$0</a>"}
You can probably have it send mark@GGG Command link learned
markdown
GGG
GGG
!Zirak /link stuff
@GGG &lt;a href=&#39;http://www.google.com/search?btnI=I&q=stuff&#39;&gt;stuff&lt;/a&gt;
GGG
GGG
02:49
D,:
can't u just not escape that
I don't, SO chat does
GGG
GGG
<a href='http://www.google.com/search?btnI=I&q=$0'>$0</a>
aw son of a bitch
<a href="http://www.google.com/search?btnI=I&q=$0">$0</a>
really if json input goes away this won't be a problem
!Zirak /learn {
"name" : "linky",
"input" : "(~w+), (.+)",
"output" : "[$1]($2)"
}
GGG
GGG
...
!Zirak /learn {"name" : "linky","input" : "(~w+), (.+)","output" : "[$1]($2)"}
@Zirak Command linky learned
!Zirak /linky owned, nya.cat
@Zirak owned
Would've been better if I typed the url right, but you get the point
GGG
GGG
02:53
yeah i can't type the markdown into this chat without it getting converted =/
I could
GGG
GGG
!Zirak /learn {"name" : "linky","input" : "(~w+), (.+)","output" : "[$1]($2)"}
@GGG Command linky learned
GGG
GGG
oh wow
huh
!Zirak /learn {"name":"link","input":".*","output":"$0"}
gahhh
@GGG Unexpected token h
@GGG Could not process input. Error: Unexpected token h
I just love trolling you
GGG
GGG
02:55
:(
If it looks like a valid url, the markdown parser will treat it as such :)
GGG
GGG
it doesnt work
i know
http://www.google.com/search?btnI=I&q=0 seems legit to me
GGG
GGG
it's not the markdown parser catching it
it's the autolinker
@Zirak link me tot he command git again
02:57
!Zirak /learn {"name":"link","input":".*","output":"[google.com/search?btnI=I&q=0]($0)"}
@Dennis you almost had it
GGG
GGG
!Zirak /learn {"name":"link","input":".*","output":"[http://www.google.com/search?btnI=I&q=$‌​0]($0)"}
@GGG Command link learned
GGG
GGG
!Zirak /link balls
02:58
@GGG <code>&#91;</code>http://www.google.com/search?btnI=I&q=$&zwnj;&#8203;0](balls)
hahahahahahaha
GGG
GGG
!Zirak /learn {"name":"link","input":".*","output":"[http://www.google.com/search?btnI=I&q=0‌​]($0)"}
@GGG Command link learned
GGG
GGG
!Zirak /link balls
@GGG [<code>h</code>ttp://www.google.com/search?btnI=I&q=0&zwnj;&#8203;](balls)
GGG
GGG
02:59
lol

« first day (437 days earlier)      last day (4736 days later) »