2 days agoMerge pull request #3 from Wowfunhappy/patch-1 master
Ben Tasker []
Merge pull request #3 from Wowfunhappy/patch-1

Recheck links after "more" button press

2 days agoRecheck links after "more" button press
Jonathan []
Recheck links after "more" button press

Previously, if the user clicked the "more" button to load additional search results, the new results would still be AMP'd. To fix this, we need to recheck all links after the additional results have been added to the page.

Clicking "more" results in many fires of the `DOMNodeInserted` event. This commit re-runs the AMP check after such an event, with a 500ms debounce.

8 days agoBump version number in user-script metadata v1.4.1
Ben Tasker []
Bump version number in user-script metadata

8 days agoRevert "MISC-29 Add slightly snarky and very temporary iframe detection to try and work around AMP detection issues on Safari when hitting Google's cache (see #2)"
Ben Tasker []
Revert "MISC-29 Add slightly snarky and very temporary iframe detection to try and work around AMP detection issues on Safari when hitting Google's cache (see #2)"

This reverts commit 51400177ebdc778364be15fc06f2cc3b6c3629e3.

Further testing has identified the cause of the issues in Safari/Google Search, and this detection won't help with that.

Might be useful in the long run, but as it was thrown together quite quickly I don't feel it's been adequately tested so should be removed for now

8 days agoMISC-29 Hacky hack fix to work around Google's behaviour
Ben Tasker []
MISC-29 Hacky hack fix to work around Google's behaviour

On an AMP compatible device, when the user clicks a link in Google's search results, they'll append {{&ampcf=1}} to the URL (presumably because they expect it to go via their ping page instead of direct).

This makes sure that ends up in the querystring rather than the url path.

Longer term, might be better to rewrite the ping url rather than just overriding href though

8 days agoOops, change the name
Ben Tasker []
Oops, change the name

8 days agoMISC-29 Create new greasemonkey script
Ben Tasker []
MISC-29 Create new greasemonkey script

This basically just dumps the script created in that issue into a greasemonkey script - may very well not work (just easier to transfer to the Mac by putting into the repo).

In *theory* it should prevent Google using their own Amp caches (without a page reload) or even sending the user to an Amp page in the first place. Liable to be a bit fragile though...

11 days agoMISC-29 Add slightly snarky and very temporary iframe detection to try and work around AMP detection issues on Safari when hitting Google's cache (see #2) v1.4.1a
B Tasker []
MISC-29 Add slightly snarky and very temporary iframe detection to try and work around AMP detection issues on Safari when hitting Google's cache (see #2)

This involves doing a scan of the DOM, so might be quite expensive at times. The aim is to try and replace this once I've laid hands on a Mac to be able to repro the issue and troubleshoot it.

13 days agoUpdate Greasemonkey hook to reference v1.4 v1.4
B Tasker []
Update Greasemonkey hook to reference v1.4

Means we should auto-roll out the changes made for MISC-27

13 days agoMISC-29 Search for Canonical and trigger redirect on Google AMP cache pages (see Github #2)
B Tasker []
MISC-29 Search for Canonical and trigger redirect on Google AMP cache pages (see Github #2)

We need to do this because Google's cache doesn't properly declare that the resource is AMP.

15 months agoAdjust README
B Tasker []
Adjust README

15 months agoAdjust script to only run once per page-load v1.3
B Tasker []
Adjust script to only run once per page-load

Without this change, every time there's an AJAX request the script will re-run, which is a tad battery hungry on mobile.

Have also adjusted the payload script to make sure we're only running the check once, as an old call was left in

15 months agoProvide link to test page
B Tasker []
Provide link to test page

15 months agoUpdate README to reflect latest changes. Consider this V1.2 v1.2
B Tasker []
Update README to reflect latest changes. Consider this V1.2

15 months agoMISC-25 Switch to using TM/GM's require directive
B Tasker []
MISC-25 Switch to using TM/GM's require directive

This allows TamperMonkey to run the script even on pages with a strict Content-Security-Policy (as TM supports adding itself into any CSP headers which are present).

It also results in faster trigger times, and means my CDN's logs now won't contain referrer strings showing peoples browsing history (which is a win for both them and me)

15 months agoCreate README v1.1
B Tasker []
Create README

15 months agoEnsure function returns after pushing redirect (MISC-25)
B Tasker []
Ensure function returns after pushing redirect (MISC-25)

Otherwise, if the browser is slow to follow the redirect we'll still write subsequent console.log calls to console. Might make troubleshooting tricky at some point in the future.

15 months agoAdd version information and download URL in
B Tasker []
Add version information and download URL in

15 months agoCreates greasemonkey script for STGNG-7
Ben Tasker []
Creates greasemonkey script for STGNG-7

I had originally planned to load the anti-amp Javascript direct from Github (using raw.) but unfortunately the browser refuses to run it because the content-type is returned as text/plain rather than application/javascript

Instead, we serve it via my CDN.

When adding the script anchor, we include a SubResourceIntegrity (SRI) hash to minimise the chances of a MITM (or compromise of my system) buggering anyone.

15 months agoSee STGNG-7
Ben Tasker []
See STGNG-7

Adjusts the anti-AMP script to write more to console so that we can track whether it's firing.

Also deals with the fact that Google decided rather than just using ASCII attributes, you can also use ⚡ to denotate that something is in AMP format.

Automatic redirect has been re-enabled now that the fallback functionality has been tested

15 months agoDelay triggering of the checks
Ben Tasker []
Delay triggering of the checks

15 months agoImplement initial version of AMP bypasser. See STGNG-7
Ben Tasker []
Implement initial version of AMP bypasser. See STGNG-7

15 months agoInitial commit
Ben Tasker []
Initial commit