Skip to content

Commit

Permalink
AG-37151 Add additional condition to find html link. #103.
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 1e7124f
Author: Slava Leleka <[email protected]>
Date:   Mon Oct 28 19:28:51 2024 +0300

    CHANGELOG.md edited online with Bitbucket

commit 0099771
Merge: f547a4d 25c12e9
Author: jellizaveta <[email protected]>
Date:   Fri Oct 25 19:40:29 2024 +0300

    update version

commit f547a4d
Author: jellizaveta <[email protected]>
Date:   Fri Oct 25 19:39:54 2024 +0300

    update version

commit 25c12e9
Author: Slava Leleka <[email protected]>
Date:   Fri Oct 25 18:29:09 2024 +0300

    CHANGELOG.md edited online with Bitbucket

commit c685723
Author: jellizaveta <[email protected]>
Date:   Fri Oct 25 17:30:52 2024 +0300

    fix indent

commit 322660f
Author: jellizaveta <[email protected]>
Date:   Fri Oct 25 17:29:34 2024 +0300

    update changelog

commit 7f314e6
Author: jellizaveta <[email protected]>
Date:   Fri Oct 25 16:37:29 2024 +0300

    update changelog

commit feee0c2
Author: jellizaveta <[email protected]>
Date:   Fri Oct 25 16:25:13 2024 +0300

    AG-37151 Add additional condition to find html link. #103
  • Loading branch information
jellizaveta committed Oct 28, 2024
1 parent bdf6b74 commit 5559bd4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions meta.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
// @include https://*/*?amp=1*
// @include https://*/amp-*/*
// @include https://*/ampNews/*
// @include https://*/*/?noamp=*
// @exclude
// @run-at document-end
// ==/UserScript==
7 changes: 5 additions & 2 deletions src/google-amp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down

0 comments on commit 5559bd4

Please sign in to comment.