diff --git a/CHANGELOG.md b/CHANGELOG.md index abc27e2..c67dd00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,20 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic [Keep a Changelog]: https://keepachangelog.com/en/1.0.0/ [Semantic Versioning]: https://semver.org/spec/v2.0.0.html -## [1.0.51] - 2024-10-23 +## [1.0.52] - 2024-10-28 + +### Added + +- AMP handling on WordPress sites. + +### Fixed + +- Infinite reloading on innogyan.in [#103]. + +[1.0.52]: https://github.com/AdguardTeam/Scriptlets/compare/v1.0.51...v1.0.52 +[#103]: https://github.com/AdguardTeam/DisableAMP/issues/103 + +## [1.0.51] - 2024-10-24 ### Added diff --git a/meta.template.js b/meta.template.js index 44f4b2b..8a72431 100644 --- a/meta.template.js +++ b/meta.template.js @@ -26,6 +26,7 @@ // @include https://*/*?amp=1* // @include https://*/amp-*/* // @include https://*/ampNews/* +// @include https://*/*/?noamp=* // @exclude // @run-at document-end // ==/UserScript== diff --git a/src/google-amp.js b/src/google-amp.js index adce776..20f02d1 100644 --- a/src/google-amp.js +++ b/src/google-amp.js @@ -28,7 +28,10 @@ export const cleanAmpLink = () => { * Redirects amp version to normal */ export const ampRedirect = () => { - const canonicalLink = document.querySelector('head > link[rel="canonical"]'); + // html links stores inside amp-mobile-version-switcher or inside canonical link tag + const canonicalLink = document.querySelector('#amp-mobile-version-switcher > a') + || document.querySelector('head > link[rel="canonical"]'); + if (!canonicalLink) { return; } @@ -37,7 +40,7 @@ export const ampRedirect = () => { return; } - // iframe do not have this marker + // additional marker to check if the page is amp const ampMarker = document.querySelector('script[src^="https://cdn.ampproject.org/"]'); if (!ampMarker) { return;