这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 | 上一修订版 两侧同时换到之后的修订记录 | ||
zblogphp:development:features:1.5:zbpjf [2016/11/29 09:31] yszm [介绍] |
zblogphp:development:features:1.5:zbpjf [2016/11/29 09:47] yszm |
||
---|---|---|---|
行 3: | 行 3: | ||
这是一个旨在规范Z-BlogPHP前端代码接口而推出的框架,用于处理之前前端代码无序的局面。 | 这是一个旨在规范Z-BlogPHP前端代码接口而推出的框架,用于处理之前前端代码无序的局面。 | ||
- | ZBPJF引入接口开发机制,将为应用开发者提供便利。通过ZBPJF可以方便的自定义系统js事件处理,或注册新事件。在ZBP1.5+版本中,开发者将不再需要引入从前100+KB的zb_system/script/common.js了,你可以更加自由引用所需要的JS组件了,你的主题头部JS引用可以是这样的 | ||
- | <code html> | ||
- | <!--- cdn 引入自定义jq版本 ---> | ||
- | <script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js" type="text/javascript"></script> | ||
- | <!--- 引入ZBPJF ---> | ||
- | <script src="{$host}zb_system/script/zblogphp.js" type="text/javascript"></script> | ||
- | <!--- 引入系统动态 JS ---> | ||
- | <script src="{$host}zb_system/script/c_html_js_add.php" type="text/javascript"></script> | ||
- | <!--- 引入主题自定义 JS ---> | ||
- | <script src="{$host}zb_users/theme/{$theme}/script/common.js" type="text/javascript"></script> | ||
- | </code> | ||
- | |||
- | 在'' zb_users/theme/THEMEID/script/common.js ''中你只需绑定需要的事件进行个性化即可,如 | ||
- | <code javascript> | ||
- | //解绑系统事件 | ||
- | zbp.plugin.unbind("comment.reply", "system"); | ||
- | //绑定评论回复事件,点击回复按钮执行 | ||
- | zbp.plugin.on("comment.reply", "THEMEID", function(i) { | ||
- | if ($("#inpRevID").val() != 0) return false; | ||
- | |||
- | $("#inpRevID").val(i); | ||
- | $("#AjaxComment" + i).next().after("<dl id=\"reply\">" + $("#postcmt").html() + "</dl>"); | ||
- | $("#postcmt").hide("slow").html(""); | ||
- | $("#cancel-reply").show().bind("click", function() { | ||
- | $("#inpRevID").val(0); | ||
- | $(this).hide().prev().show(); | ||
- | $("#postcmt").html($("#reply").html()).show("slow"); | ||
- | $("#reply").remove(); | ||
- | window.location.hash = "#comment"; | ||
- | return false; | ||
- | }).prev().hide(); | ||
- | $("#reply").show("slow"); | ||
- | window.location.hash = "#reply"; | ||
- | }); | ||
- | //绑定回复成功事件,成功发表后取消回复状态 | ||
- | zbp.plugin.on("comment.postsuccess", "THEMEID", function () { | ||
- | $("#cancel-reply").click(); | ||
- | }); | ||
- | </code> | ||
代码示例:https://github.com/zblogcn/zblogphp/blob/master/zb_users/plugin/ZBPJFExample/zbpjfexample.js | 代码示例:https://github.com/zblogcn/zblogphp/blob/master/zb_users/plugin/ZBPJFExample/zbpjfexample.js | ||