NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name COFUN_EDITOR
// @namespace http://tampermonkey.net/
// @version 0.1
// @license GPL-3.0-only
// @description MAKE COFUN LOWER!
// @author gregtaoo
// @match *://59.61.219.58:81/*
// @match *://192.168.4.252:81/*
// @require https://unpkg.com/jquery@3.6.0/dist/jquery.min.js
// @require https://unpkg.com/codemirror@5.65.3/lib/codemirror.js
// @require https://unpkg.com/codemirror@5.65.3/mode/clike/clike.js
// @require https://unpkg.com/codemirror@5.65.3/addon/edit/closebrackets.js
// @icon https://www.google.com/s2/favicons?sz=64&domain=219.58
// @grant none
// ==/UserScript==
(function() {
'use strict';
function addcss(url) {
$('head').append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + url + "\">");
}
function addjs(url) {
$('head').append("<script src=\"" + url + "\"></script>");
}
addjs('https://unpkg.com/codemirror@5.65.3/lib/codemirror.js');
addjs('https://unpkg.com/codemirror@5.65.3/mode/clike/clike.js');
addjs('https://unpkg.com/codemirror@5.65.3/addon/edit/closebrackets.js');
addcss('https://unpkg.com/codemirror@5.65.3/lib/codemirror.css');
addcss('https://unpkg.com/codemirror@5.65.3/theme/solarized.css');
setTimeout(function() {
$("textarea[name='SubmitCode']").attr("id","codemirror");
let cm = $("#codemirror");
cm.val("// " + (new Date().toLocaleString()) + "\n");
if (cm.length > 0) {
let editor = CodeMirror.fromTextArea(document.getElementById("codemirror"),{
mode:"text/x-c++src",
theme:'solarized',
matchBrackets: true,
autoCloseBrackets: true,
lineNumbers:true
});
editor.setSize('auto','400px');
$('head').append("<style>.CodeMirror{font-family:consolas !important;font-size:16px;}</style>");
}
},20);
})();