Last active
July 2, 2021 00:52
-
-
Save kobachi/de2ca23051696fbbf7d0f5e53382999b to your computer and use it in GitHub Desktop.
Android Gradle Dependency Formatter
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
// ==UserScript== | |
// @name Android Gradle Dependency Formatter | |
// @description Re-format mvnrepository.com's Gradle dependency for Android Gradle | |
// @namespace kobachi.dev | |
// @version 1.0 | |
// @include https://mvnrepository.com/artifact/* | |
// ==/UserScript== | |
(function () { | |
var textarea = document.querySelector("#gradle-div > textarea"); | |
if (textarea != null) { | |
var timer = setInterval(() => { | |
var code = textarea.value; | |
if (code) { | |
var format = /implementation group: '([^']+)', name: '([^']+)', version: '([^']+)'/; | |
if (format.test(code)) { | |
textarea.value = code.replace(format, "implementation: '$1:$2:$3'"); | |
clearInterval(timer); | |
} | |
} | |
}, 100); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this link to install this user script.