mình là người lần trước hỏi bạn ấy, trang mình load rất chậm vì cái này
(function(t, n, e) { "use strict"; function i(n, e) { this.element = n, this.options = t.extend({}, o, e), this._defaults = o, this._name = a, this.init() } var a = "pusher", o = { watch: "a", initialPath: n.location.pathname, before: function(t) { t() }, handler: function() {}, after: function() {}, fail: function() { toastr.error('Lá»—i hoặc Ä‘ang xĂ¢y dá»±ng') }, onStateCreation: function() {} }; i.prototype = { init: function() { var e = this; if (history.pushState) { var i = r({ path: e.options.initialPath }, e.options.onStateCreation); history.replaceState(i, null, i.path), t(e.element).on("click", 'a[rel="async"]', function(n) { n.preventDefault(); var i = r({ path: t(this).attr("href"), elem: t(this) }, e.options.onStateCreation); s(e, i, !0) }), n.addEventListener("popstate", function(t) { s(e, t.state) }) } } }; var r = function(t, n) { var e = {}; return t = t || {}, e.path = t.path, e.time = (new Date).getTime(), n && n(e, t.elem), e }, s = function(n, e, i) { if (e) { var a = { state: e, get: function(t) { return u(a.res, t) }, updateText: function(n) { var e = t(n); this.get(n).each(function(n) { var i = t(this).text(); e.eq(n).text(i) }) }, updateHtml: function(n) { var e = t(n); this.get(n).each(function(n) { var i = t(this).contents(); e.eq(n).html(i) }) } }, o = function() { t.ajax({ type: "GET", url: e.path }).done(function(t) { a.res = t, i && history.pushState(e, null, e.path), n.options.handler.apply(a) }).fail(function() { n.options.fail.apply(a) }).always(function() { n.options.after.apply(a) }) }; n.options.before.apply(a, [o]) } }, u = function(n, e) { var i = t("<root>").html(n), a = i.find(e); return a }; t.fn[a] = function(n) { t.data(e, "plugin_" + a) || t.data(e, "plugin_" + a, new i(this, n)) } })(jQuery, window, document); $(document).pusher({ handler: function() { this.updateText("title"); this.updateHtml("#mainContent"); this.updateHtml("#loadJS"); } });
![[OFF]](/assets/images/off.gif)
![[IMAGE]](http://i.imgur.com/Wpy1rhhh.png)
![[IMAGE]](http://i.imgur.com/IWa68WYh.png)