Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 45 additions & 7 deletions lib/data/compat-grant.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { CompatMap, VersionAssertion } from './version-assertion';

// Documentation:
// - Scriptcat: https://docs.scriptcat.org/en/docs/dev/api/
// - Tampermonkey: https://www.tampermonkey.net/documentation.php#_grant
// - Violentmonkey: https://violentmonkey.github.io/api/gm
// - Greasemonkey: https://wiki.greasespot.net/Greasemonkey_Manual:API
Expand All @@ -21,6 +22,7 @@ export const compatMap: CompatMap = {
],
GM_addStyle: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.6.1.4 <4' }
Expand All @@ -29,11 +31,15 @@ export const compatMap: CompatMap = {
{ type: 'tampermonkey', versionConstraint: '>=4.5' }
],
GM_addValueChangeListener: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.3.2607' },
{ type: 'violentmonkey', versionConstraint: '>=2.12.0' }
],
'GM.cookie': [{ type: 'tampermonkey', versionConstraint: '>=4.8' }],
GM_cookie: [{ type: 'tampermonkey', versionConstraint: '>=4.8' }],
GM_cookie: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=4.8' }
],
'GM.deleteValue': [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=4.5' },
Expand All @@ -42,14 +48,19 @@ export const compatMap: CompatMap = {
],
GM_deleteValue: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.8.20090123.1 <4' }
],
'GM.deleteValues': [{ type: 'tampermonkey', versionConstraint: '>=5.3' }],
GM_deleteValues: [{ type: 'tampermonkey', versionConstraint: '>=5.3' }],
GM_deleteValues: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=5.3' }
],
'GM.download': [{ type: 'tampermonkey', versionConstraint: '>=4.5' }],
GM_download: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=3.8' },
{ type: 'violentmonkey', versionConstraint: '>=2.9.5' }
],
Expand All @@ -65,6 +76,7 @@ export const compatMap: CompatMap = {
],
GM_getResourceURL: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.8.20080609.0 <4' }
Expand All @@ -76,9 +88,15 @@ export const compatMap: CompatMap = {
{ type: 'greasemonkey', versionConstraint: '>=4.0' }
],
'GM.getTab': [{ type: 'tampermonkey', versionConstraint: '>=4.5' }],
GM_getTab: [{ type: 'tampermonkey', versionConstraint: '>=4.0.10' }],
GM_getTab: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=4.0.10' }
],
'GM.getTabs': [{ type: 'tampermonkey', versionConstraint: '>=4.5' }],
GM_getTabs: [{ type: 'tampermonkey', versionConstraint: '>=4.0.10' }],
GM_getTabs: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=4.0.10' }
],
'GM.getValue': [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=4.5' },
Expand All @@ -87,12 +105,16 @@ export const compatMap: CompatMap = {
],
GM_getValue: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.3-beta <4' }
],
'GM.getValues': [{ type: 'tampermonkey', versionConstraint: '>=5.3' }],
GM_getValues: [{ type: 'tampermonkey', versionConstraint: '>=5.3' }],
GM_getValues: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=5.3' }
],
'GM.info': [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=4.5' },
Expand All @@ -101,6 +123,7 @@ export const compatMap: CompatMap = {
],
GM_info: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.4.2718' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.9.16 <4' }
Expand All @@ -123,6 +146,7 @@ export const compatMap: CompatMap = {
],
GM_log: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.3-beta <4' }
Expand All @@ -134,6 +158,7 @@ export const compatMap: CompatMap = {
{ type: 'greasemonkey', versionConstraint: '>=4' }
],
GM_notification: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.0.2344' },
{ type: 'violentmonkey', versionConstraint: '>=2.5.0' }
],
Expand All @@ -145,6 +170,7 @@ export const compatMap: CompatMap = {
],
GM_openInTab: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.5-beta <4' }
Expand All @@ -155,6 +181,7 @@ export const compatMap: CompatMap = {
{ type: 'greasemonkey', versionConstraint: '>=4.11' }
],
GM_registerMenuCommand: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.2.5 <4' }
Expand All @@ -163,11 +190,15 @@ export const compatMap: CompatMap = {
{ type: 'tampermonkey', versionConstraint: '>=4.5' }
],
GM_removeValueChangeListener: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.3.2607' },
{ type: 'violentmonkey', versionConstraint: '>=2.12.0' }
],
'GM.saveTab': [{ type: 'tampermonkey', versionConstraint: '>=4.5' }],
GM_saveTab: [{ type: 'tampermonkey', versionConstraint: '>=4.0.10' }],
GM_saveTab: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=4.0.10' }
],
'GM.setClipboard': [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=4.5' },
Expand All @@ -176,6 +207,7 @@ export const compatMap: CompatMap = {
],
GM_setClipboard: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.6.2767' },
{ type: 'violentmonkey', versionConstraint: '>=2.5.0' },
{ type: 'greasemonkey', versionConstraint: '>=1.10 <4' }
Expand All @@ -188,23 +220,29 @@ export const compatMap: CompatMap = {
],
GM_setValue: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.3-beta <4' }
],
'GM.setValues': [{ type: 'tampermonkey', versionConstraint: '>=5.3' }],
GM_setValues: [{ type: 'tampermonkey', versionConstraint: '>=5.3' }],
GM_setValues: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=5.3' }
],
'GM.unregisterMenuCommand': [
{ type: 'tampermonkey', versionConstraint: '>=4.5' }
],
GM_unregisterMenuCommand: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=3.6.3737' },
{ type: 'violentmonkey', versionConstraint: '>=2.9.4' }
],
'GM.webRequest': [{ type: 'tampermonkey', versionConstraint: '>=4.5 <=5.2' }],
GM_webRequest: [{ type: 'tampermonkey', versionConstraint: '>=4.4 <=5.2' }],
GM_xmlhttpRequest: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.2.5 <4' }
Expand Down
26 changes: 26 additions & 0 deletions lib/data/compat-headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ export const compatMap: {
localized: {
name: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=3.9' },
{ type: 'violentmonkey', versionConstraint: '>=2.1.6.8' },
{ type: 'greasemonkey', versionConstraint: '>=2.2 <4 || >=4.11' }
],
description: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=3.9' },
{ type: 'violentmonkey', versionConstraint: '>=2.1.6.8' },
{ type: 'greasemonkey', versionConstraint: '>=2.2 <4 || >=4.11' }
Expand All @@ -31,47 +33,55 @@ export const compatMap: {
unlocalized: {
include: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '*' }
],
exclude: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '*' }
],
'exclude-match': [{ type: 'violentmonkey', versionConstraint: '>=2.6.2' }],
version: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.9.0' }
],
'run-at': [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=1.1.2190' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.9.8' }
],
'run-in': [
{ type: 'scriptcat', versionConstraint: '*' },
// 5.3.6209 beta
{ type: 'tampermonkey', versionConstraint: '>=5.3' }
],
resource: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.8.20080609.0' }
],
require: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.8.20080609.0' }
],
match: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=1.1.2190' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.9.8' }
Expand All @@ -84,18 +94,21 @@ export const compatMap: {
],
grant: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=3.0.3389' },
{ type: 'violentmonkey', versionConstraint: '>=2.1.6.1' },
{ type: 'greasemonkey', versionConstraint: '>=1' }
],
noframes: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '>=2.8.17' },
{ type: 'greasemonkey', versionConstraint: '>=2.3' },
{ type: 'tampermonkey', versionConstraint: '>=2.0.2355' }
],
connect: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=4.0' },
{ type: 'violentmonkey', versionConstraint: '>=2.12.10' }
],
Expand All @@ -116,17 +129,20 @@ export const compatMap: {
nonFunctional: {
name: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '*' }
],
description: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '*' }
],
author: [
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '*' },
{ type: 'violentmonkey', versionConstraint: '*' }
],
Expand All @@ -141,24 +157,29 @@ export const compatMap: {
license: [{ type: 'tampermonkey', versionConstraint: '*' }],
icon: [
{ type: 'adguard', versionConstraint: '*'},
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.0.2359' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.9.0' }
],
defaulticon: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.0.2359' }
],
icon64: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.0.2359' }
],
iconURL: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.0.2359' }
],
icon64URL: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.0.2359' }
],
homepage: [
Expand All @@ -168,27 +189,32 @@ export const compatMap: {
],
homepageURL: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.0.2395' },
{ type: 'violentmonkey', versionConstraint: '>=2.1.5' }
],
website: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.0.2395' },
{ type: 'violentmonkey', versionConstraint: '>=2.13.1.2' }
],
source: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.0.2395' },
{ type: 'violentmonkey', versionConstraint: '>=2.13.1.2' }
],
downloadURL: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.5.64' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.9.14' }
],
updateURL: [
{ type: 'adguard', versionConstraint: '*' },
{ type: 'scriptcat', versionConstraint: '*' },
{ type: 'tampermonkey', versionConstraint: '>=2.5.64' },
{ type: 'violentmonkey', versionConstraint: '*' },
{ type: 'greasemonkey', versionConstraint: '>=0.9.12' }
Expand Down
7 changes: 6 additions & 1 deletion lib/data/version-assertion.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
export type VersionAssertion = {
type: 'adguard' | 'tampermonkey' | 'violentmonkey' | 'greasemonkey';
type:
| 'adguard'
| 'greasemonkey'
| 'scriptcat'
| 'tampermonkey'
| 'violentmonkey';
versionConstraint: string;
};

Expand Down
8 changes: 7 additions & 1 deletion tests/lib/data/compat-grant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ function validateCompatibilityData(compatabilityData: VersionAssertion[]) {
compatabilityAssertion.should.have
.property('type')
.a.String()
.equalOneOf(['adguard', 'tampermonkey', 'greasemonkey', 'violentmonkey']);
.equalOneOf([
'adguard',
'greasemonkey',
'scriptcat',
'tampermonkey',
'violentmonkey'
]);
compatabilityAssertion.should.have.property('versionConstraint').a.String;
}
);
Expand Down
Loading