Greasy Fork自动勾选"对编辑器启用语法高亮"

Greasy Fork发布、更新脚本时自动勾选"对编辑器启用语法高亮"

// ==UserScript==
// @name                Greasy Fork自动勾选"对编辑器启用语法高亮"
// @description         Greasy Fork发布、更新脚本时自动勾选"对编辑器启用语法高亮"
// @namespace           https://github.com/linkwanggo
// @version             1.0.0
// @author              linkwanggo
// @copyright           2023, linkwanggo (https://github.com/linkwanggo)
// @match               *://greasyfork.org/*/*versions/new
// @icon                https://greasyfork.org/vite/assets/blacklogo16.bc64b9f7.png
// @compatible          chrome
// @compatible          firefox
// @compatible          edge
// @license             MIT
// @run-at              document-end
// ==/UserScript==

(function() {
    'use strict';
    function clickEnableSourceEditorCode() {
        try {
            const aceEditor = document.querySelector('#ace-editor')
            if (!aceEditor) {
                document.querySelector('#enable-source-editor-code').click()
            }
        } catch (e) {
            console.error(e)
        }
    }
    window.setTimeout(clickEnableSourceEditorCode, 500)
})();