1/** 2 * jQuery Comments list plugin 3 */ 4 5; 6(function($) { 7 /** 8 * commentsList set function. 9 * @param options map settings for the comments list. Availablel options are as follows: 10 * - deleteConfirmString 11 * - approveConfirmString 12 */ 13 $.fn.commentsList = function(options) { 14 return this.each(function(){ 15 var settings = $.extend({}, $.fn.commentsList.defaults, options || {}); 16 var $this = $(this); 17 var id = $this.attr('id'); 18 $.fn.commentsList.settings[id] = settings; 19 $.fn.commentsList.initDialog(id); 20 $this 21/* .delegate('.delete', 'click', function(){ 22 var id = $($(this).parents('.comment-widget')[0]).attr("id"); 23 if(confirm($.fn.commentsList.settings[id]['deleteConfirmString'])) 24 { 25 $.post($(this).attr('href')) 26 .success(function(data){ 27 data = $.parseJSON(data); 28 if(data["code"] === "success") 29 { 30 $("#comment-"+data["deletedID"]).remove(); 31 } 32 }); 33 } 34 return false; 35 }) 36 .delegate('.approve', 'click', function(){ 37 var id = $($(this).parents('.comment-widget')[0]).attr("id"); 38 if(confirm($.fn.commentsList.settings[id]['deleteConfirmString'])) 39 { 40 $.post($(this).attr('href')) 41 .success(function(data){ 42 data = $.parseJSON(data); 43 if(data["code"] === "success") 44 { 45 $("#comment-"+data["approvedID"]+" > .admin-panel > .approve").remove(); 46 } 47 }); 48 } 49 return false; 50 })*/ 51 .delegate('.add-comment', 'click', function(){ 52 var id = $($(this).parents('.comment-widget')[0]).attr("id"); 53 $dialog = $("#addCommentDialog-"+id); 54 var commentID = $(this).attr('rel'); 55 if(commentID) 56 $('.parent_comment_id', $dialog).val(commentID); 57 $dialog.dialog("open"); 58 return false; 59 }); 60 }); 61 }; 62 63 $.fn.commentsList.defaults = { 64 dialogTitle: 'ÐобавиÑÑ ÐºÐ¾Ð¼Ð¼ÐµÐ½ÑаÑий', 65// deleteConfirmString: 'Delete this comment?', 66// approveConfirmString: 'Approve this comment?', 67 postButton: 'ÐобавиÑÑ ÐºÐ¾Ð¼Ð¼ÐµÐ½ÑаÑий', 68 cancelButton: 'ÐÑмена' 69 }; 70 71 $.fn.commentsList.settings = {}; 72 73 $.fn.commentsList.initDialog = function(id){ 74 var $dialog = $('#addCommentDialog-'+id); 75 $dialog.data('widgetID', id); 76 $dialog.dialog({ 77 'title':$.fn.commentsList.settings[id]['dialogTitle'], 78 'autoOpen':false, 79 'width':'auto', 80 'height':'auto', 81 'background':'none', 82 'resizable':false, 83 'modal':true, 84 'buttons':[ 85 { 86 text: $.fn.commentsList.settings[id]['postButton'], 87 click: function(){ 88 $.fn.commentsList.postComment($(this)); 89 } 90 }, 91 { 92 text: $.fn.commentsList.settings[id]['cancelButton'], 93 click: function(){ 94 $(this).dialog("close"); 95 return false; 96 } 97 } 98 ] 99 }); 100 } 101 102 $.fn.commentsList.postComment = function($dialog){ 103 var $form = $("form", $dialog); 104 $.post( 105 $form.attr("action"), 106 $form.serialize() 107 ).success(function(data){ 108 data = $.parseJSON(data); 109 $dialog.html(data["form"]); 110 if(data["code"] == "success") 111 { 112 alert('ÐаÑа запиÑÑ ÑÑпеÑно добавлена и бÑÐ´ÐµÑ Ð¾Ð¿Ñбликована поÑле пÑовеÑки!'); 113// var id = $dialog.data('widgetID'); 114// $('#'+id).html($(data["list"]).html()); 115 $dialog.dialog("close"); 116 } 117 }); 118 } 119 120})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.