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:(示例)

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

That is it!

Return to the index.

返回到指南索引页




本文转自 firehare 51CTO博客,原文链接:http://blog.51cto.com/firehare/1259603,如需转载请自行联系原作者
相关文章
|
13天前
|
JavaScript 前端开发
js实现点击音频实现播放功能
js实现点击音频实现播放功能
|
13天前
|
前端开发 JavaScript
使用JavaScript实现复杂功能:构建一个自定义的拖拽功能
使用JavaScript实现复杂功能:构建一个自定义的拖拽功能
|
16天前
|
JSON JavaScript 前端开发
JavaScript原生代码处理JSON的一些高频次方法合集
JavaScript原生代码处理JSON的一些高频次方法合集
|
6天前
|
JavaScript 安全 前端开发
|
12天前
|
JavaScript 前端开发
如何用JS实现选项卡功能
如何用JS实现选项卡功能
13 0
|
13天前
|
存储 前端开发 JavaScript
使用JavaScript实现复杂功能——一个交互式音乐播放器
使用JavaScript实现复杂功能——一个交互式音乐播放器
|
13天前
|
存储 JavaScript 前端开发
JavaScript复杂功能实现:实时数据可视化图表
JavaScript复杂功能实现:实时数据可视化图表
|
20天前
|
JavaScript 前端开发
JavaScript数组的功能内置类型
数组是JavaScript的内置类型,JavaScript数组的功能特别强大。下面简单介绍一下JavaScript数组。
|
1月前
|
JSON 前端开发 JavaScript
16个重要的JavaScript代码
16个重要的JavaScript代码
32 1
|
1月前
|
JavaScript
当当网新用户注册界面——JS代码
当当网新用户注册界面——JS代码
7 0