Skip to content

AdguardTeam/DisableAMP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Atlassian Bamboo
Sep 21, 2021
3c49eaa · Sep 21, 2021
Jul 21, 2021
Nov 2, 2020
Sep 21, 2021
Oct 14, 2020
May 25, 2020
Jan 26, 2021
Nov 2, 2020
Jun 28, 2019
Oct 15, 2020
Jul 31, 2019
Aug 13, 2019
Jul 31, 2019
Sep 21, 2021
Sep 21, 2021
Sep 21, 2021
Aug 1, 2019
Jul 7, 2020
Jul 21, 2021

Repository files navigation

Disable AMP by AdGuard

This is a very simple userscript that disables AMP pages on the Google search results page. Open Google search results on a mobile phone, click on the link marked as AMP. This link should be opened without AMP.

How to install

How to build

yarn install

Command Output Dir
yarn dev build/dev
yarn beta build/beta
yarn release build/release

Metadata

Placeholder - string in format [PLACEHOLDER_NAME] which will be replaced with metadata field.

Field or Metadata field - result string of metadata, e.g:

// @description:en Userscript description text  

How to change?

Remove, add or replace placeholders in file meta.template.js.

To specify the data for placeholders change the meta.settings.js.

// meta.settings.js file structure

const releaseChannels = {
    common: options,
    dev: options,
    beta: options,
    release: options,
};

common - object with options which will be applied for all builds, you can redefine these options for specific release channel.

dev, beta, release - contains options for corresponding builds.

options

filename - the name of userscript metadata file, plugin creates new file in format [filename].meta.js.

postfix - string , default '', you can specify postfix for some fields (requires usePostfix:true flag for fieldOptions).

metadataTemplate - default metadata.template.js, relative path to template of metadata.

localesDir - default ./locales, relative path to directorty with locales.

fields - the object, where key is the name of placeholder and value is a string or fieldOptions object.

fieldOptions

If the data for field should be taken from translation, you need to use fieldOptions

const releaseChannels = {
    ...
        dev: {
            filename: 'userscript-boilerplate',
            postfix: 'Dev',
            localesDir: './_locales',
            fields: {
                URL: 'http:example.org',

                // fieldOptions
                USERSCRIPT_NAME: {
                    messageKey: 'some_name',
                    metaName: 'name',
                    usePostfix: true,
                }
            }
        },
    ...
}

messageKey - string, key in translation file for this field.

metaName - string, name of field in output metadata file.

usePostfix - boolean, default false, use postfix for this field.


Translations

  • add needed locales codes to const LOCALES = ['en', 'ru']; array
  • run yarn locales:download to download translations
  • run yarn locales:upload to update current tranlations in Crowdin

Run tests

yarn test

How to add new one?

  • Add new file with tests in directory ./tests
  • Add import './path-to-your-file' in index.test.js

Run linter

yarn lint


TODO:

  • Fix AMP on Google images