2 var $dropdown = $('#user-menu-dropdown');
4 $('#user-menu').click(function() {
5 $('.dialog').fadeOut('fast', function() {
8 $dropdown.slideToggle('fast', function() {
9 if ($dropdown.is(':visible')) {
10 $dropdown.one('clickoutside', function() {
11 $dropdown.slideUp('fast')
17 $('.confirm').each(function() {
20 $link.click(function(e) {
21 $dropdown.slideUp('fast');
24 html: messages.confirm,
25 extra_class: 'confirm',
27 yes_callback: function() {
28 window.location = $link.attr('href');
30 yes_text: messages.yes,
39 $('#award-rep-points').click(function(e) {
40 $dropdown.slideUp('fast');
42 var table = '<table><tr><th>' + messages.points + '</th><td><input type="text" id="points-to-award" value="1" /></td></tr>'
43 + '<tr><th>' + messages.message + '</th><td><textarea id="award-message"></textarea></td></tr></table>';
47 extra_class: 'award-rep-points',
49 yes_callback: function($dialog) {
50 var $points_input = $('#points-to-award');
51 var _points = parseInt($points_input.val());
53 if (!isNaN(_points)) {
54 $dialog.fadeOut('fast');
55 var _message = $('#award-message').val();
56 $.post($('#award-rep-points').attr('href'), {points: _points, message: _message}, function(data) {
58 $('#user-reputation').css('background', 'yellow');
59 $('#user-reputation').html(data.reputation);
61 $('#user-reputation').animate({ backgroundColor: "transparent" }, 1000);