FOSCommentBundle功能包:挂接到JS代码

Step 13: Hooking into the JS code

The FOSCommentBundle Js code fires events on the thread container object.These events are triggered, for example, when users cancel a comment or reply to a comment.

FOSCommentBundle功能包的Js代码触发线索容器对象中的事件。举个例子,当用户忽略或回复评论时,这些事件将被触发。

fos_comment_before_load_thread( identifier )

Triggered before getting the comments of a thread and placing them in the thread holder.

在得到评论线索之前被触发,并将它们放置在线索保持器中。

  • identifier: unique identifier url for the thread comments

  • 标识符:线索评论的唯一标识

fos_comment_new_comment( data )

Triggered if the request about a new comment submission succeeds.

在请求提交新评论成功时被触发。

  • data: data sent to the server with the request.

  • 数据:和请求一起发送到服务器的数据。

fos_comment_submitted_form( statusCode )

Triggered when the request about a new comment submission is completed.

当请求提交新评论完成时被触发。

  • statusCode: status of the server response

  • 状态码:服务器回覆的状况

fos_comment_submitting_form(  )

Triggered before posting the new comment form.

在发送新评论表单之前触发。


Preventing the default action will cancel the submission of the comment.

防止缺省Action取消评论提交。

fos_comment_show_form( data )

Triggered when the reply form is inserted into the DOM tree.

当回复表单被插入到 DOM树时被触发。

  • data: the reply form content

  • 数据:回复表单内容

fos_comment_cancel_form(  )

Triggered when the comment reply is closed.

当评论回复关闭时触发。


Preventing the default action will cancel closing the form.

防止缺省Action取消正在关闭的表单。

fos_comment_edit_comment( data )

Triggered if the request about editing a comment succeeds.

当请求编辑评论成功时触发。

  • data: data sent to the server with the request.

  • 数据:和请求一起发送到服务器的数据。

fos_comment_vote_comment( data )

Triggered when the the request about voting a comment succeeds.

当请求对一个评论投票成功时触发。

  • data: data sent to the server with the request.

  • 数据:和请求一起发送到服务器的数据。

fos_comment_add_comment( commentHtml )

Triggered when the comment is inserted into the DOM tree.

当评论被插入DOM树时触发。

  • commentHtml: jQuery object to insert into the DOM tree.

  • commentHtml: 插入到DOM树中的jQuery对象

fos_comment_removing_comment(  )

Triggered before a comment delete action.

在评论删除操作之前触发。

Preventing the default action will cancel the removal.

防止缺省操作取消删除。

fos_comment_show_edit_form( data )

Triggered when the edit form is inserted into the DOM tree.

当编辑表单被接入DOM树时触发。

  • data: the edit form content

  • 数据:编辑表单内容

Example:(示例)

$(document)
    .on('fos_comment_show_form', '.fos_comment_comment_reply_show_form', function (event, data) {
        // do stuffs
    });

That is it!

Return to the index.

返回到指南索引页



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值