Thread:Mathmagician/@comment-93604-20120509230753/@comment-4674838-20120512101404


 * Thanks for the explanation about using array notation for accessing object properties.
 * Separating the button logic from the application logic as you put it makes sense to me now. I stared at the code for about half an hour, but I think I finally get it!
 * .on, .click, .data and .trigger are jQuery methods that can be found in the API
 * $('.threadButton', '#article-comments-ul') is a list of DOM elements wrapped in jQuery object.
 * You set the "on" property in it using the .data method.
 * You set the handler for the onclick event with .click. .click itself calls an anonymous function which handles the button logic, and then uses .trigger to call a custom 'toggle' handler.
 * In the section below that, you use .on to bind an actual definition to the 'toggle' handler, so that 'toggle' actual does something when called.
 * Note to self: .trigger('toggle'); calls the toggle method even though it's not written as toggle -- this works because functions ARE objects in JavaScript so you can call them without specifying the parameter list -- and you probably wouldn't want to write toggle because that would call the function immediately, possibly before it's been given a definition.

Note:
 * Buttons still are not visible for me at all in Monobook. I think they need to be added to a different location in the DOM for Monobook.