diff --git a/CHANGELOG.md b/CHANGELOG.md index fabd490..2b39bf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +- Fixed: ``currentUrlFullReload`` option now works +- Fixed: ``this.reload`` is now a Function + ([#65](https://github.com/MoOx/pjax/issues/65)) + # 0.2.2 - 2016-03-12 - Fixed: added back standalone version in `./pjax.js` diff --git a/example/example.js b/example/example.js index 9f62b32..9441179 100644 --- a/example/example.js +++ b/example/example.js @@ -19,8 +19,8 @@ document.addEventListener("pjax:success", function() { document.addEventListener("DOMContentLoaded", function() { var pjax = new Pjax({ - selectors: [".body"] + selectors: [".body"], + // currentUrlFullReload: true, }) console.log("Pjax initialized.", pjax) }) - diff --git a/example/index.html b/example/index.html index 806338f..8e259b9 100644 --- a/example/index.html +++ b/example/index.html @@ -9,7 +9,9 @@

Index

- hello. Go to Page 2 and view your console to see Pjax events. + Hello. + Go to Page 2 and view your console to see Pjax events. + Clicking on this page will just reload the page entierly.
diff --git a/index.js b/index.js index 460d045..a548998 100644 --- a/index.js +++ b/index.js @@ -51,6 +51,8 @@ Pjax.prototype = { refresh: require("./lib/proto/refresh.js"), + reload: require("./lib/reload.js"), + attachLink: require("./lib/proto/attach-link.js"), forEachSelectors: function(cb, context, DOMcontext) { diff --git a/lib/proto/attach-link.js b/lib/proto/attach-link.js index 647558d..73e6986 100644 --- a/lib/proto/attach-link.js +++ b/lib/proto/attach-link.js @@ -43,7 +43,10 @@ var linkAction = function(el, event) { event.preventDefault() // don’t do "nothing" if user try to reload the page by clicking the same link twice - if (el.href === window.location.href.split("#")[0]) { + if ( + this.options.currentUrlFullReload && + el.href === window.location.href.split("#")[0] + ) { el.setAttribute(attrClick, "reload") this.reload() return