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.
yarn install
Command | Output Dir |
---|---|
yarn dev |
build/dev |
yarn beta |
build/beta |
yarn release |
build/release |
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
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.
const LOCALES = ['en', 'ru'];
arrayyarn locales:download
to download translationsyarn locales:upload
to update current tranlations in Crowdinyarn test
./tests
import './path-to-your-file'
in index.test.js
yarn lint