-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f40cfbf
commit dabbd4c
Showing
6 changed files
with
310 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AUTO_RELOAD=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.debug("This script is for development purposes only."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "Auto hide next up card for Amazon Prime Video", | ||
"namespace": "http://tampermonkey.net/", | ||
"version": null, | ||
"description": "Hide next up card and other obtrusive elements of Amazon Prime Video.", | ||
"author": "ryo-fujinone", | ||
"match": [ | ||
"https://*.amazon.co.jp/*", | ||
"https://*.amazon.com/*", | ||
"https://*.amazon.ae/*", | ||
"https://*.amazon.co.uk/*", | ||
"https://*.amazon.it/*", | ||
"https://*.amazon.in/*", | ||
"https://*.amazon.eg/*", | ||
"https://*.amazon.com.au/*", | ||
"https://*.amazon.nl/*", | ||
"https://*.amazon.ca/*", | ||
"https://*.amazon.sa/*", | ||
"https://*.amazon.sg/*", | ||
"https://*.amazon.se/*", | ||
"https://*.amazon.es/*", | ||
"https://*.amazon.de/*", | ||
"https://*.amazon.com.tr/*", | ||
"https://*.amazon.com.br/*", | ||
"https://*.amazon.fr/*", | ||
"https://*.amazon.com.be/*", | ||
"https://*.amazon.pl/*", | ||
"https://*.amazon.com.mx/*", | ||
"https://*.amazon.cn/*", | ||
"https://*.primevideo.com/*" | ||
], | ||
"license": "MIT; https://github.com/ryo-fujinone/auto-hide-next-up-card-for-amazon-prime-video/blob/main/LICENSE" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import { readFileSync } from "fs"; | ||
import { autoReload } from "rollup-plugin-auto-reload"; | ||
import { userscriptMetadataGenerator } from "userscript-metadata-generator"; | ||
|
||
const createDevMetadata = (metadata, scriptUrl) => { | ||
const requires = []; | ||
|
||
if (typeof metadata.requires === "string") { | ||
requires.push(metadata.requires); | ||
} else if (Array.isArray(metadata.requires)) { | ||
requires.push(...metadata.requires); | ||
} | ||
|
||
requires.push(scriptUrl); | ||
return { | ||
...metadata, | ||
name: `[dev] ${metadata.name}`, | ||
require: requires, | ||
}; | ||
}; | ||
|
||
const createUpdatableScriptMetadata = (metadata) => { | ||
return { | ||
...metadata, | ||
downloadURL: | ||
"https://update.greasyfork.org/scripts/478102/Auto%20hide%20next%20up%20card%20for%20Amazon%20Prime%20Video.user.js", | ||
updateURL: | ||
"https://update.greasyfork.org/scripts/478102/Auto%20hide%20next%20up%20card%20for%20Amazon%20Prime%20Video.meta.js", | ||
}; | ||
}; | ||
|
||
const createRollupOptions = () => { | ||
const metadata = JSON.parse( | ||
readFileSync("misc/userscript.meta.json", "utf-8") | ||
); | ||
const pkgMetadata = JSON.parse(readFileSync("package.json", "utf-8")); | ||
|
||
const pkgVersion = pkgMetadata.version; | ||
metadata.version = pkgVersion; | ||
|
||
const rootDir = process.cwd(); | ||
const inputPath = "src/main.js"; | ||
const scriptName = `auto-hide-next-up-card_${pkgVersion}`; | ||
|
||
const userscriptPath = `dist/userscript/${scriptName}.user.js`; | ||
const userscriptUrl = `file://${rootDir}/${userscriptPath}`; | ||
|
||
const devPath = `dist/userscript/${scriptName}.dev.user.js`; | ||
const devMetadata = createDevMetadata(metadata, userscriptUrl); | ||
|
||
const updatableScriptPath = `dist/userscript/${scriptName}.updatable.user.js`; | ||
const updatableScriptMetadata = createUpdatableScriptMetadata(metadata); | ||
|
||
const mainOptions = { | ||
input: inputPath, | ||
output: { | ||
file: userscriptPath, | ||
format: "iife", | ||
banner: () => `${userscriptMetadataGenerator(metadata)}\n`, | ||
}, | ||
plugins: [], | ||
}; | ||
|
||
const devOptions = { | ||
input: "misc/dev.js", | ||
output: { | ||
file: devPath, | ||
format: "iife", | ||
banner: () => `${userscriptMetadataGenerator(devMetadata)}\n`, | ||
}, | ||
}; | ||
|
||
const updatableScriptOptions = { | ||
input: inputPath, | ||
output: { | ||
file: updatableScriptPath, | ||
format: "iife", | ||
banner: () => `${userscriptMetadataGenerator(updatableScriptMetadata)}\n`, | ||
}, | ||
}; | ||
|
||
if (process.env.AUTO_RELOAD === "true") { | ||
mainOptions.plugins.push(autoReload()); | ||
} | ||
|
||
return [mainOptions, devOptions, updatableScriptOptions]; | ||
}; | ||
|
||
const options = createRollupOptions(); | ||
|
||
export default options; |