(function(n, i, k) { i.infinitescroll = function y(C, E, D) { this.element = i(D); this._create(C, E); }; i.infinitescroll.defaults = { loading: { finished: k, finishedMsg: "Congratulations, you've reached the end of the internet.", img: "http://www.infinite-scroll.com/loading.gif", msg: null, msgText: "Loading the next set of posts...", selector: null, speed: "fast", errormsg: "
未加载成功
", start: k }, state: { isDuringAjax: false, isInvalidPage: false, isDestroyed: false, isDone: false, isPaused: false, currPage: 1, oldpage: 1, havanext: 1 }, callback: k, debug: false, behavior: k, binder: i(n), nextSelector: "div.navigation a:first", navSelector: "div.navigation", contentSelector: null, extraScrollPx: 150, itemSelector: "div.post", animate: false, pathParse: k, dataType: "html", appendCallback: true, bufferPx: 500, show_excerpt_bufferPx: 1000, show_list_bufferPx: 300, show_grid_bufferPx: 300, show_all_bufferPx: 1000, errorCallback: function() {}, infid: 0, pixelsFromNavToBottom: k, path: k }; i.infinitescroll.prototype = { _binding: function g(E) { var C = this, D = C.options; if ( !! D.behavior && this["_binding_" + D.behavior] !== k) { this["_binding_" + D.behavior].call(this); return; } if (E !== "bind" && E !== "unbind") { this._debug("Binding value " + E + " not valid"); return false; } if (E == "unbind") { (this.options.binder).unbind("smartscroll.infscr." + C.options.infid); } else { (this.options.binder)[E]("smartscroll.infscr." + C.options.infid, function() { C.scroll(); }); } this._debug("Binding", E); }, _create: function s(C, G) { if (!this._validate(C)) { return false; } var D = this.options = i.extend(true, {}, i.infinitescroll.defaults, C), F = /(.*?\/\/).*?(\/.*)/, E = i(D.nextSelector).attr("href"); D.contentSelector = D.contentSelector || this.element; D.loading.selector = D.loading.selector || D.contentSelector; D.state.havanext = i("#have_next") ? 1 : 0; if (!E) { this._debug("Navigation selector not found"); return; } D.path = this._determinepath(E); D.loading.msg = i('
' + D.loading.msgText + "
"); (new Image()).src = D.loading.img; D.pixelsFromNavToBottom = i(document).height() - i(D.navSelector).offset().top; D.loading.start = D.loading.start || function() { i(D.navSelector).hide(); D.loading.msg.appendTo(D.loading.selector).show(D.loading.speed, function() { beginAjax(D); }); }; D.loading.finished = D.loading.finished || function() { D.loading.msg.fadeOut("normal"); }; D.callback = function(H, I) { if ( !! D.behavior && H["_callback_" + D.behavior] !== k) { H["_callback_" + D.behavior].call(i(D.contentSelector)[0], I); } if (G) { G.call(i(D.contentSelector)[0], I); } }; this._setup(); }, _debug: function p() { if (this.options.debug) {} }, _determinepath: function z(D) { var C = this.options; if ( !! C.behavior && this["_determinepath_" + C.behavior] !== k) { this["_determinepath_" + C.behavior].call(this, D); return; } if ( !! C.pathParse) { this._debug("pathParse manual"); return C.pathParse; } else { if (D.match(/^(.*?)\b2\b(.*?$)/)) { D = D.match(/^(.*?)\b2\b(.*?$)/).slice(1); } else { if (D.match(/^(.*?)2(.*?$)/)) { if (D.match(/^(.*?page=)2(\/.*|$)/)) { D = D.match(/^(.*?page=)2(\/.*|$)/).slice(1); return D; } D = D.match(/^(.*?)2(.*?$)/).slice(1); } else { if (D.match(/^(.*?page=)1(\/.*|$)/)) { D = D.match(/^(.*?page=)1(\/.*|$)/).slice(1); return D; } else { this._debug("Sorry, we couldn't parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com."); C.state.isInvalidPage = true; } } } } this._debug("determinePath", D); return D; }, _error: function u(D) { var C = this.options; if ( !! C.behavior && this["_error_" + C.behavior] !== k) { this["_error_" + C.behavior].call(this, D); return; } if (D !== "destroy" && D !== "end") { D = "unknown"; } this._debug("Error", D); if (D == "end" && C.state.havanext != 0) { this._showerrormsg(); } else { if (D == "end" && C.state.havanext == 0) { this._showdonemsg(); } } C.state.isDone = true; C.state.currPage = 1; C.state.isPaused = false; this._binding("unbind"); }, _loadcallback: function c(F, E) { var C = this.options, I = this.options.callback, M = (C.state.isDone) ? "done": (!C.appendCallback) ? "no-append": "append", J; if ( !! C.behavior && this["_loadcallback_" + C.behavior] !== k) { this["_loadcallback_" + C.behavior].call(this, F, E); return; } switch (M) { case "done": this._showdonemsg(); return false; break; case "no-append": if (C.dataType == "html") { E = "
" + E + "
"; E = i(E).find(C.itemSelector); } break; case "append": var D = F.children(); if (D.length == 0) { return this._error("end"); } var K = E.indexOf("have_next"); if (K < 0) { C.state.havanext = 0; } J = document.createDocumentFragment(); while (F[0].firstChild) { J.appendChild(F[0].firstChild); } this._debug("contentSelector", i(C.contentSelector)[0]); i(C.contentSelector)[0].appendChild(J); E = D.get(); var H = C.state.currPage + 1; var L = C.path.join(H); i("div.loadBg a:first").attr("href", L); break; } C.loading.finished.call(i(C.contentSelector)[0], C); if (C.animate) { var G = i(n).scrollTop() + i("#infscr-loading").height() + C.extraScrollPx + "px"; i("html,body").animate({ scrollTop: G }, 800, function() { C.state.isDuringAjax = false; }); } if (!C.animate) { C.state.isDuringAjax = false; } I(this, E); }, _nearbottom: function t() { var F = this.options, D = 0 + i(document).height() - (F.binder.scrollTop()) - i(n).height(); if ( !! F.behavior && this["_nearbottom_" + F.behavior] !== k) { this["_nearbottom_" + F.behavior].call(this); return; } this._debug("math:", D, F.pixelsFromNavToBottom); var C = getCookie("left_side_class"); if (C == "left_main") { var E = F.show_all_bufferPx; } else { if (C == "left_summary") { var E = F.show_excerpt_bufferPx; } else { if (C == "left_list") { var E = F.show_list_bufferPx; } else { if (C == "left_box") { var E = F.show_grid_bufferPx; } else { var E = F.bufferPx; } } } } return (D - E < F.pixelsFromNavToBottom); }, _pausing: function l(D) { var C = this.options; if ( !! C.behavior && this["_pausing_" + C.behavior] !== k) { this["_pausing_" + C.behavior].call(this, D); return; } if (D !== "pause" && D !== "resume" && D !== null) { this._debug("Invalid argument. Toggling pause value instead"); } D = (D && (D == "pause" || D == "resume")) ? D: "toggle"; switch (D) { case "pause": C.state.isPaused = true; break; case "resume": C.state.isPaused = false; break; case "toggle": C.state.isPaused = !C.state.isPaused; break; } this._debug("Paused", C.state.isPaused); return false; }, _setup: function q() { var C = this.options; if ( !! C.behavior && this["_setup_" + C.behavior] !== k) { this["_setup_" + C.behavior].call(this); return; } this._binding("bind"); return false; }, _showdonemsg: function a() { var C = this.options; if ( !! C.behavior && this["_showdonemsg_" + C.behavior] !== k) { this["_showdonemsg_" + C.behavior].call(this); return; } i("div.loadBg").hide(); C.loading.msg.find("img").hide().parent().html(C.loading.finishedMsg).animate({ opacity: 1 }, 2000, function() {}); C.errorCallback.call(i(C.contentSelector)[0], "done"); }, _showerrormsg: function A() { var D = this.options; if ( !! D.behavior && this["_showdonemsg_" + D.behavior] !== k) { this["_showdonemsg_" + D.behavior].call(this); return; } var C = D.path.join(D.state.currPage); i("div.loadBg a:first").attr("href", C); D.loading.msg.find("img").hide().parent().html("
未加载成功
").animate({ opacity: 1 }, 2000, function() {}); D.errorCallback.call(i(D.contentSelector)[0], "done"); }, _validate: function v(D) { for (var C in D) { if (C.indexOf && C.indexOf("Selector") > -1 && i(D[C]).length === 0) { this._debug("Your " + C + " found no elements."); return false; } return true; } }, bind: function o() { this._binding("bind"); }, destroy: function B() { this.options.state.isDestroyed = true; return this._error("destroy"); }, pause: function e() { this._pausing("pause"); }, resume: function h() { this._pausing("resume"); }, retrieve: function b(K) { var L = this, D = L.options, N = D.path, G, M, O, C, E, K = K || null, J = ( !! K) ? K: D.state.currPage; D.state.oldpage = J; if (J % 3 == 0) { i("div.loadBg").hide(); var F = i("#index_max_page").val(); var I = J; if (I <= 0) { I = 1; } i(".page a").each(function(P) { if (P > 0 && P < 6 + 1 && P <= F) { i(this).removeClass(); var R = i(this).html(); if (I == R) { var Q = I; i(this).addClass("one"); i(".pageup").attr("href", i("#indexpage_" + (Q - 1)).attr("href")); i(".pagedown").attr("href", i("#indexpage_" + (Q + 1)).attr("href")); } } }); D.state.isDestroyed = true; return false; } beginAjax = function H(R) { R.state.currPage++; L._debug("heading into ajax", N); G = i(R.contentSelector).is("table") ? i("") : i("
"); O = N.join(R.state.currPage); C = (R.dataType == "html" || R.dataType == "json") ? R.dataType: "html+callback"; if (R.appendCallback && R.dataType == "html") { C += "+callback"; } switch (C) { case "html+callback": L._debug("Using HTML via .load() method"); G.load(O + " " + R.itemSelector, null, function S(T) { L._loadcallback(G, T); }); var Q = i("#index_max_page").val(); var P = R.state.currPage - 1; if (P <= 0) { P = 1; } i(".page a").each(function(T) { if (T > 0 && T < 6 + 1 && T <= Q) { i(this).removeClass(); var V = i(this).html(); if (P == V) { var U = P; i(this).addClass("one"); i(".pageup").attr("href", i("#indexpage_" + (U - 1)).attr("href")); i(".pagedown").attr("href", i("#indexpage_" + (U + 1)).attr("href")); } } }); break; case "html": } }; if ( !! D.behavior && this["retrieve_" + D.behavior] !== k) { this["retrieve_" + D.behavior].call(this, K); return; } if (D.state.isDestroyed) { this._debug("Instance is destroyed"); return false; } D.state.isDuringAjax = true; D.loading.start.call(i(D.contentSelector)[0], D); }, scroll: function f() { var C = this.options, D = C.state; if ( !! C.behavior && this["scroll_" + C.behavior] !== k) { this["scroll_" + C.behavior].call(this); return; } if (D.isDuringAjax || D.isInvalidPage || D.isDone || D.isDestroyed || D.isPaused) { return; } if (!this._nearbottom()) { return; } this.retrieve(); }, toggle: function x() { this._pausing(); }, unbind: function m() { this._binding("unbind"); }, update: function j(C) { if (i.isPlainObject(C)) { this.options = i.extend(true, this.options, C); } } }; i.fn.infinitescroll = function d(E, F) { var D = typeof E; switch (D) { case "string": var C = Array.prototype.slice.call(arguments, 1); this.each(function() { var G = i.data(this, "infinitescroll"); if (!G) { return false; } if (!i.isFunction(G[E]) || E.charAt(0) === "_") { return false; } G[E].apply(G, C); }); break; case "object": this.each(function() { var G = i.data(this, "infinitescroll"); if (G) { G.update(E); } else { i.data(this, "infinitescroll", new i.infinitescroll(E, F, this)); } }); break; } return this; }; var w = i.event, r; w.special.smartscroll = { setup: function() { i(this).bind("scroll", w.special.smartscroll.handler); }, teardown: function() { i(this).unbind("scroll", w.special.smartscroll.handler); }, handler: function(F, C) { var E = this, D = arguments; F.type = "smartscroll"; if (r) { clearTimeout(r); } r = setTimeout(function() { i.event.handle.apply(E, D); }, C === "execAsap" ? 0 : 100); } }; i.fn.smartscroll = function(C) { return C ? this.bind("smartscroll", C) : this.trigger("smartscroll", ["execAsap"]); }; })(window, jQuery); //We leave a function outside the infinite-scroll area so that it works with older jQuery versions function infinite_scroll_callback(newElements, data) { $.getScript("http://bdimg.share.baidu.com/static/js/bds_s_v2.js?cdnversion=" + new Date().getMinutes()); if (is_am) { show_post_edit_btn(); } init_lazyload(); show_excerpt_handle(); set_post_collect_status(); scroll_post_ratings_handle(); exc_after_infinite_scroll(); } jQuery(document).ready(function($) { // Infinite Scroll jQuery+Wordpress plugin // Now we're inside, we should be able to use $ again $("#content").infinitescroll({ debug: true, loading: { img: "https://www.quansenlin.com/static/images/ajax-loader.gif", msgText: "\"\"", finishedMsg: "
恭喜您,您已经走到了互联网的尽头
" }, state: { currPage: "3" }, behavior: "undefined", nextSelector: "div.navigation a:first", navSelector: "div.navigation", contentSelector: "#content", itemSelector: "#content div.perContentBox", bufferPx: 200, pathParse: ["https://www.quansenlin.com/index.php?tese=&catid=0&s=&page=", ""] }, function(newElements, data) { window.setTimeout(function() { infinite_scroll_callback(newElements, data) }, 1); }); });