{"id":14988980,"url":"https://github.com/foso/gtvmonkey-scripts","last_synced_at":"2025-04-12T00:41:21.973Z","repository":{"id":44338465,"uuid":"304823336","full_name":"Foso/gtvmonkey-scripts","owner":"Foso","description":"This a template project that helps you write Greasemonkey/Tampermonkey/ViolentMonkey scripts with KotlinJs","archived":false,"fork":false,"pushed_at":"2025-02-26T07:47:56.000Z","size":171,"stargazers_count":18,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T20:22:13.302Z","etag":null,"topics":["greasemonkey","kotlin","kotlinjs","tampermonkey","userscripts","violentmonkey"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Foso.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-17T07:34:14.000Z","updated_at":"2025-02-26T07:48:00.000Z","dependencies_parsed_at":"2025-02-20T12:41:55.896Z","dependency_job_id":null,"html_url":"https://github.com/Foso/gtvmonkey-scripts","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foso%2Fgtvmonkey-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foso%2Fgtvmonkey-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foso%2Fgtvmonkey-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foso%2Fgtvmonkey-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Foso","download_url":"https://codeload.github.com/Foso/gtvmonkey-scripts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501960,"owners_count":21114681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["greasemonkey","kotlin","kotlinjs","tampermonkey","userscripts","violentmonkey"],"created_at":"2024-09-24T14:17:31.713Z","updated_at":"2025-04-12T00:41:21.946Z","avatar_url":"https://github.com/Foso.png","language":"Kotlin","readme":"# Grease/Tamper/Violent-Monkey scripts with KotlinJs\n\nThis a template project that helps you write Greasemonkey/Tampermonkey/ViolentMonkey scripts with KotlinJs\n\n### Show some :heart: and star the repo to support the project\n\n[![GitHub stars](https://img.shields.io/github/stars/Foso/gtvmonkey-scripts.svg?style=social\u0026label=Star)](https://github.com/Foso/gtvmonkey-scripts) [![GitHub forks](https://img.shields.io/github/forks/Foso/gtvmonkey-scripts.svg?style=social\u0026label=Fork)](https://github.com/Foso/gtvmonkey-scripts/fork)  [![Twitter Follow](https://img.shields.io/twitter/follow/jklingenberg_.svg?style=social)](https://twitter.com/jklingenberg_)\n\n## How does it work?\n\n### Gradle\nI configured a Gradle task [**buildUserScript**](https://github.com/Foso/gtvmonkey-scripts/blob/2ae1766cad85e847c93ae4cab894898115f191e4/build.gradle.kts#L32) that will generate a userscript file.\nThe task will concat the script metadata from \u003ckbd\u003emain/resources/metadata.txt\u003c/kbd\u003e, the **kotlin.js** and your generated javascript file. \nThen it will append **main();** to the script, which will execute the main() of your Kotlin Code.\n\nThe script will be outputed to \u003ckbd\u003e/build/distributions/$NAMEOFYOURGRADLEPROJECT.user.js\u003c/kbd\u003e\n\nThe gradle task will be triggered after every Gradle **build** task\n\n### Metadata\nYou can configure the metadata of your userscript inside [/src/main/resources/metadata.txt](https://github.com/Foso/gtvmonkey-scripts/blob/master/src/main/resources/metadata.txt)\n\n## Kotlin\nWrite your Kotlin Code inside **src/main/kotlin**. The **main()** will be executed first by the userscript.\n\n## Hot Reload\nWhen you use **gradle -t build** inside your project folder, Gradle will detect all changes to your Kotlin Code and metadata.txt file, and will compile and generate a new userscript on every change. The detection of changes on the userscript depends on your used addon. E.g. Violentmonkey supports tracking of file changes in Chrome (https://violentmonkey.github.io/posts/how-to-edit-scripts-with-your-favorite-editor/) and it can detect changes on a new generated userscript.\n\n## Example\nLet's create a script thats alerts \"Hello GitHub\" on every page of GitHub.\n\nAdd this inside your /main/resources/metadata.txt\n\n```kotlin\n// ==UserScript==\n// @name        MyNew script - KotlinJs\n// @namespace   GtvMonkey Scripts\n// @grant       none\n// @version     1.0\n// @author      -\n// @description 10/16/2020, 9:43:07 PM\n// @include     https://github.com/*\n// ==/UserScript==\n```\nYou can find out more about the Metadata section [HERE](https://wiki.greasespot.net/Metadata_Block)\n\nThis is your Kotlin Code\n```kotlin\nfun main() {\n    window.alert(\"Hello Github!\")\n}\n```\n\nRun the **build** task of Gradle and you will find a *.user.js inside /build/distributions.\nAdd this file to your wanted userscript browser addon and you are done.\n\n## 📜 License\n\nThis project is licensed under the Apache License, Version 2.0 - see the [LICENSE.md](https://github.com/Foso/gtvmonkey-scripts/blob/master/LICENSE) file for details\n\n-------\n\n    Copyright 2020 Jens Klingenberg\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoso%2Fgtvmonkey-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoso%2Fgtvmonkey-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoso%2Fgtvmonkey-scripts/lists"}