MediaWiki:NewUserIdentityBox/dropdown.js

function ProfileDropdown(items, config){ this.items = items; this.target = '.tabs-container'; this.name = 'More'; if (typeof config == 'object'){ this.theme = config.theme || ''; this.name = config.name || 'More'; this.id = config.id; }   this.create; }

ProfileDropdown.prototype.create = function create{ var $target = $(this.target), _t = this, $tab_dropdown = $('') .html([               $('')                    .html(this.name + ' &#x25BE;')                    .on('click', function(event){ event.preventDefault; }),                $('')                    .html(Object.keys(this.items).map(function(item){                        var lh = _t.items[item],                            $item =                                $('')                                .html(function{ var $link = $(''); switch (typeof lh){ case 'string': $link.attr('href', lh).text(item); break; case 'function': $link.attr('href', '#UserIdentityBox').on('click', function(event){                                               event.preventDefault;                                                Function.prototype.apply.call(lh, window, [event]);                                            }).text(item); break; default: return false; }                               });                        return $item;                    }))            ]); if (typeof this.theme == 'string') $tab_dropdown.addClass(this.theme); $target.append($tab_dropdown); };