bgneal@312: $(document).ready(function() { bgneal@312: var bday = $('#id_birthday'); bgneal@312: // jquery ui may not always be loaded bgneal@312: if (bday.length) { bgneal@312: bday.datepicker({changeMonth: true, bgneal@312: changeYear: true, bgneal@312: dateFormat: 'yy-mm-dd', bgneal@312: defaultDate: '-30y', bgneal@312: minDate: new Date(1909, 0, 1), bgneal@312: maxDate: new Date(), bgneal@312: yearRange: '-100:+0'}); bgneal@312: } bgneal@312: $('a.profile-flag').click(function() { bgneal@312: var id = this.id; bgneal@312: if (id.match(/fp-(\d+)/)) { bgneal@312: id = RegExp.$1; bgneal@312: if (confirm('Only report a profile if you feel it is spam, abuse, ' + bgneal@312: 'violates site rules, or is not appropriate. ' + bgneal@312: 'A moderator will be notified and will review the profile. ' + bgneal@312: 'Are you sure you want to report this profile?')) { bgneal@312: $.ajax({ bgneal@312: url: '/profile/flag/' + id + '/', bgneal@312: type: 'POST', bgneal@312: dataType: 'text', bgneal@312: success: function (response, textStatus) { bgneal@312: alert(response); bgneal@312: }, bgneal@312: error: function (xhr, textStatus, ex) { bgneal@312: alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText); bgneal@312: } bgneal@312: }); bgneal@312: } bgneal@312: } bgneal@312: return false; bgneal@312: }); bgneal@312: });