diff --git a/package.json b/package.json index 19d79b2..2b3793c 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "ini": "^1.3.5", "js-base64": "^2.5.1", "nprogress": "^0.2.0", - "pjax-api": "^3.31.2", + "pjax-api": "^3.33.0", "react": "^17.0.1", "react-dom": "^17.0.1", "react-use": "^13.8.0", diff --git a/scripts/fix-pjax-api.js b/scripts/fix-pjax-api.js index 492a9d6..b3ac6c7 100644 --- a/scripts/fix-pjax-api.js +++ b/scripts/fix-pjax-api.js @@ -13,7 +13,8 @@ function modify(source = '', pairs = [], loose = true) { throw new Error(`More than one original string found`, JSON.stringify(original)) } } else { - if (!loose) throw new Error(`Original string not found`, JSON.stringify(original)) + if (loose) console.log(`Skipped missing snippet`, original) + else throw new Error(`Original string not found`, JSON.stringify(original)) } } @@ -29,17 +30,19 @@ async function fixPJAXAPI(loose) { ], // Firefox [ - `this.document = this.xhr.responseType === 'document' ? this.xhr.responseXML.cloneNode(true) : html_1.parse(this.xhr.responseText).extract();`, - `this.document = this.xhr.responseType === 'document' ? this.xhr.responseXML : html_1.parse(this.xhr.responseText).extract();`, + `this.document = this.xhr.responseXML.cloneNode(true);`, + `this.document = this.xhr.responseXML;`, ], // Chrome: modifying cross-context history state causes troubles // Scroll position can still be restored without this function [ ` function savePosition() { + var _a; void window.history.replaceState({ ...window.history.state, position: { + ...(_a = window.history.state) === null || _a === void 0 ? void 0 : _a.position, top: window.pageYOffset, left: window.pageXOffset } diff --git a/yarn.lock b/yarn.lock index 6ed3ebd..c46409b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8454,10 +8454,10 @@ pirates@^4.0.1: dependencies: node-modules-regexp "^1.0.0" -pjax-api@^3.31.2: - version "3.31.2" - resolved "https://registry.yarnpkg.com/pjax-api/-/pjax-api-3.31.2.tgz#909d31a7238cb2555f5f3aefbbf17e7fb47ee0fc" - integrity sha512-g46QnbcQxdzyuD2QX4b/OL+szsjWF0UQ3rKZOHZ6Xno8On8E6D68HWGjFo9LnSmB4C/li9/4x/BWdSlvjEm65g== +pjax-api@^3.33.0: + version "3.33.0" + resolved "https://registry.yarnpkg.com/pjax-api/-/pjax-api-3.33.0.tgz#90e1c4d725b51d7efe17514a534f5329dfc2b15e" + integrity sha512-E0o1NNa2ebOeKICq5efWcc9Od6CtKC1jiUPl4MWpNEuAOpEQ3381TQq8/nSyw4+biqBK5JQdb6+i0wVGhIHnJQ== pkg-dir@^3.0.0: version "3.0.0"