var QnA = { // hide all the 'close' and 'best' buttons for this question // @fixme: Should use ID close: function(closeButt) { notice = $(closeButt).closest('li.hentry.notice.question'); notice.find('input[name=best],[name=close]').hide(); notice.find('textarea').hide(); notice.find('li.notice-answer-placeholder').hide(); notice.find('#answer-form').hide(); }, init: function() { var that = this; QnA.NoticeInlineAnswerSetup(); $('input[name=close]').live('click', function() { that.close(this); }); $('input[name=best]').live('click', function() { that.close(this); }); }, /** * Open up a question's inline answer box. * * @param {jQuery} notice: jQuery object containing one notice */ NoticeInlineAnswerTrigger: function(notice) { console.log('NoticeInlineAnswerTrigger - begin'); // Find the question notice we're answering... var id = $($('.notice_id', notice)[0]).text(); console.log("parent notice id = " + id); var parentNotice = notice; // See if the form's already there... var answerForm = $('#answer-form', parentNotice); if (answerForm) { console.log("Found the answer form."); } else { console.log("Did not find the answer form."); } var placeholder = parentNotice.find('li.notice-answer-placeholder'); // Pull the parents threaded list and we'll add on the end of it. var list = $('ul.threaded-replies', notice); if (list) { console.log("Found the " + list.length + " notice place holders."); } else { console.log("Found the notice answer placeholder"); } if (list.length == 0) { console.log("list length = 0 adding