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

Very nice interface, and I do agree with pretty much all the points you made. Unfortunately you've dropped Monobook support though. I do have a few questions about your code, if you don't mind:

This object can be used with a couple different notations. What the difference? var buttonTexts = { toggleComment: { true: 'Hide Post', false: 'Show Post' },   toggleUser: { true: 'Hide User', false: 'Show User' },   toggleThread: { true: 'Hide Thread', false: 'Show Thread' } };

// (thinking from a Java or C perspective) // looks like accessing an element in a 2D array // ...except the indices aren't integers console.log( buttonTexts['toggleComment'][true] );

// looks like accessing member toggleComment of object // buttonTexts and then accessing member true of toggleComment console.log( buttonTexts.toggleComment.true );

Can you give a detailed explanation of what's happening in this block? I think return $(toHtml(className)).insertBefore($(this)) is adding in the buttons, but beyond that I'm a little lost. Also, $.fn is the prototype of the jQuery object, right? Is there a good tutorial on that somewhere? $.fn.extend({   threadButton: function (className) {        return $(toHtml(className))        .insertBefore($(this))        .data({ on: true, })       .click(function  { var on = !$(this).data('on'); $(this).data('on', on) .text(function {                for (var i in buttonTexts) {                    if ($(this).hasClass(i)) {                        return buttonTexts[i][on];                    }                }            }) .trigger('toggle'); });   } })