diff --git a/thrones/src/main/webapp/static/lib/forum/jForum.js b/thrones/src/main/webapp/static/lib/forum/jForum.js index ce6bfcedb95f9d9606f4324f1f6decfc2e784a88..b7e1078d15ee9577d285f068c964becb33e7a4a2 100644 --- a/thrones/src/main/webapp/static/lib/forum/jForum.js +++ b/thrones/src/main/webapp/static/lib/forum/jForum.js @@ -44,26 +44,24 @@ define('jForum', [ var extEle = $('#page_another_navigation'); extEle.find(pnSelector).remove(); extEle.append(pageHtmlStruct); + }, + jsonCallback: function (jsonArray) { + if ($.isEmptyObject(jsonArray)) { + return; + } + var fn = template[rawdata.callFun]; + if (typeof fn === "function") { + fn.call(this, jsonArray); + } + }, + deferCallback: function(){ + var deferFun = xhrDefer[rawdata.defFun]; + if (typeof deferFun === "function") { + deferFun.call(this, xhr, template); + } } }; - paginationFunction(_pn, option).done(function (jsonArray) { - if (jQuery.isEmptyObject(jsonArray)) { - return; - } - var jsonCallFun = template[rawdata.callFun]; - if (typeof jsonCallFun === "function") { - jsonCallFun.call(this, jsonArray); - } else { - console.log('[page_navigation]json callback function:' + jsonCallFun + ' is not function or jForumXhrDefer not module'); - } - }).done(function () { - var deferFun = xhrDefer[rawdata.defFun]; - if (typeof deferFun === "function") { - deferFun.call(this, xhr, template); - } else { - console.log('[page_navigation]defer callback function:' + deferFun + ' is not function or jForumXhrDefer not module'); - } - }).fail(function () { + paginationFunction(_pn, option).fail(function () { console.log('[page_navigation] execute fail'); }); }).trigger('initDataEvent'); diff --git a/thrones/src/main/webapp/static/lib/forum/jForum.pagination.js b/thrones/src/main/webapp/static/lib/forum/jForum.pagination.js index 1f3a5199d7597ba803e2ab47ab54cc87b34662d3..519b11bd698401a3139e6b0d592edfbc97d59548 100644 --- a/thrones/src/main/webapp/static/lib/forum/jForum.pagination.js +++ b/thrones/src/main/webapp/static/lib/forum/jForum.pagination.js @@ -63,6 +63,9 @@ define('jForumPagination', [ // a=总页数 var b = _curIns._calc(response.page, a); _curIns.render(b.start, b.end, response.page, a, jqEle); + if ($.isFunction(_curIns.config.jsonCallback)) { + _curIns.config.jsonCallback(response.result); + } //滚动到顶部 $('html, body').animate({ scrollTop: 0 }, 500); _curIns.defer.resolve(response.result); @@ -84,6 +87,9 @@ define('jForumPagination', [ } //记入历史 recordHistory(page, postData.pageSize); + if ($.isFunction(_curIns.config.deferCallback)) { + _curIns.config.deferCallback(); + } console.log('[pagination] ajax is complete'); }; $.ajax(formatAjaxParams); @@ -242,4 +248,4 @@ define('jForumPagination', [ return Page; })(); return jForumPagination; -}); \ No newline at end of file +});