Ex124OJ

Extend 124OJ!

目前為 2023-08-25 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Ex124OJ
// @namespace    http://tampermonkey.net/
// @version      1.0.2
// @description  Extend 124OJ!
// @author       Sukwants
// @license      MIT
// @match        http://124.221.194.184/*
// @icon         https://ex124oj.pond.ink/images/icon.png
// @grant        GM_addElement
// @grant        GM_addStyle
// @grant        GM_setClipboard
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_deleteValue
// @grant        GM_listValues
// @grant        GM_xmlhttpRequest
// @connect      ex124oj.pond.ink
// ==/UserScript==


/******/ (() => { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ({

/***/ 579:
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.exAnnouncements = void 0;
function exAnnouncements() {
    var PostsExp = /<body[\s\S]*?>([\s\S]*?)<\/body>/;
    var WrittenByExp = /^by (.*)$/;
    var DateTimeExp = /^(.*?) .*$/;
    if (document.getElementsByClassName('uoj-content')[0].children[0].children[0].children[0]) {
        GM_xmlhttpRequest({
            method: "GET",
            url: "https://ex124oj.pond.ink/categories/Announcements/",
            revalidate: true,
            onload: function (data) {
                var Announcements = document.querySelector('div.uoj-content > div.card.card-default > div.card-body > div.row > div:first-child > table');
                if (Announcements) {
                    Announcements.querySelector('thead > tr').innerHTML = '<th style="width:30%">公告</th><th style="width:10%"></th><th style="width:10%"></th><th style="width:30%">Ex 公告</th><th style="width:10%"></th><th style="width:10%"></th>';
                    var trs = Announcements.querySelectorAll('tbody > tr');
                    for (var tr = 0; tr < trs.length - 1; ++tr) {
                        if (trs[tr].innerHTML) {
                            trs[tr].innerHTML = (trs[tr].children.length > 2 ? trs[tr].innerHTML : '<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>') + '<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>';
                            if (WrittenByExp.test(trs[tr].children[1] && trs[tr].children[1].innerHTML)) {
                                trs[tr].children[1].innerHTML = trs[tr].children[1].innerHTML.match(WrittenByExp)[1];
                            }
                            if (DateTimeExp.test(trs[tr].children[2] && trs[tr].children[2].innerHTML)) {
                                trs[tr].children[2].innerHTML = '<small>' + trs[tr].children[2].textContent.match(DateTimeExp)[1] + '</small>';
                            }
                        }
                    }
                    trs[trs.length - 1].innerHTML = '<td class="text-right" colspan="3"><a href="/announcements">所有公告……</a></td><td class="text-right" colspan="3"><a href="https://ex124oj.pond.ink/categories/Announcements/">所有公告……</a></td>';
                    var PostsPage = (new DOMParser()).parseFromString(data.response, 'text/html');
                    var Posts = PostsPage.querySelectorAll('article');
                    for (var i = 0; i < Posts.length && i < 5; ++i) {
                        var title = Posts[i].querySelector('a.post-title-link');
                        Announcements.querySelector('tbody').children[i].children[3].innerHTML = "<a href=\"https://ex124oj.pond.ink".concat(title.getAttribute('href'), "\">").concat(title.innerText, "</a>");
                        Announcements.querySelector('tbody').children[i].children[4].innerHTML = '<a class="uoj-username" href="https://ex124oj.pond.ink/" style="color:rgb(40,173,202)">Ex124OJ</a>';
                        var date = Posts[i].querySelector('time');
                        Announcements.querySelector('tbody').children[i].children[5].innerHTML = '<small>' + date.getAttribute('content') + '</small>';
                    }
                }
            }
        });
    }
}
exports.exAnnouncements = exAnnouncements;


/***/ }),

/***/ 690:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.changeIcon = exports.Background = void 0;
var variables_1 = __webpack_require__(449);
function Background() {
    if (variables_1.BackgroundImage) {
        document.getElementsByClassName('navbar-brand')[0].innerHTML = '<img src="/images/logo_small.png" alt="Logo" class="img-rounded" style="width:39px; height:39px;">';
        var container = document.getElementsByClassName('container')[0];
        if (container) {
            var firstChild = container.children[0];
            if (firstChild && firstChild.children.length >= 2) {
                var innerHTML = firstChild.children[1].innerHTML;
                var matchResult = innerHTML.match(/(.*> ){0,1}(.*)/);
                if (matchResult) {
                    var newInnerHTML = matchResult[2];
                    firstChild.children[1].innerHTML = newInnerHTML;
                }
            }
        }
        GM_addStyle("body {\n    background: url(\"' + BackgroundImage + '\");\n    background-repeat: no-repeat;\n    background-attachment: fixed;\n    background-position: 50% 50%;\n    background-size: cover;\n}\n.uoj-content {\n    background-color: #fff;\n    margin: 16px -16px;\n    padding: 16px 16px;\n    opacity: 0.85;\n    border-radius: 8px;\n}\n.navbar {\n    margin: 16px -16px;\n    padding: 8px 16px;\n    opacity: 0.85;\n    border-radius: 8px;\n}\n.giscus {\n    opacity: 0.85;\n}");
    }
}
exports.Background = Background;
function getIcon() {
    if (variables_1.SiteIconImage)
        return variables_1.SiteIconImage;
    else
        return '/images/logo.png';
}
function getIconSmall() {
    if (variables_1.SiteIconSmallImage)
        return variables_1.SiteIconSmallImage;
    else
        return getIcon();
}
function changeIcon() {
    var LogoURLRegExp = /^.*\/images\/logo(_small){0,1}.png$/;
    var Links = document.getElementsByTagName('link');
    for (var link in Links) {
        if (Links[link] && Links[link].nodeType && Links[link].getAttribute('rel') == 'shortcut icon') {
            Links[link].setAttribute('href', getIconSmall());
        }
    }
    var Icons = document.getElementsByTagName('img');
    for (var icon in Icons) {
        if (Icons[icon] instanceof Element && Icons[icon].nodeType === Node.ELEMENT_NODE) {
            var srcAttribute = Icons[icon].getAttribute('src');
            if (srcAttribute !== null && LogoURLRegExp.test(srcAttribute)) {
                if (!Icons[icon].getAttribute('style')) {
                    Icons[icon].setAttribute('src', getIcon());
                    Icons[icon].setAttribute('style', 'width:100%;height:auto;object-fit:cover');
                }
                else {
                    Icons[icon].setAttribute('src', getIconSmall());
                }
            }
        }
    }
}
exports.changeIcon = changeIcon;


/***/ }),

/***/ 480:
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CodeBlock = void 0;
function CodeBlock() {
    GM_addStyle("@import url(https://cdn.jsdelivr.net/npm/[email protected]/distr/fira_code.css);\ncode {\n    font-family: \"Fira Code\";\n}\ncode.sh_cpp>span {\n    font-style: normal !important;\n    font-weight: 400 !important;\n}\ncode.sh_cpp>span.sh_preproc,\ncode.sh_cpp>span.sh_keyword,\ncode.sh_cpp>span.sh_type {\n    color: #8959a8;\n}\ncode.sh_cpp>span.sh_string {\n    color: #718c00;\n}\ncode.sh_cpp>span.sh_cbracket {\n    color: #4d4d4c;\n}\ncode.sh_cpp>span.sh_symbol {\n    color: #3e999f;\n}\ncode.sh_cpp>span.sh_number {\n    color: #f5871f;\n}\ncode.sh_cpp>span.sh_function {\n    color: #4271ae;\n}\ncode.sh_cpp>span.sh_comment {\n    color: #8e908c;\n}\n.copybutton {\n    font-size: 1.1em;\n    width: 2.2em;\n    height: 2.2em;\n    padding: 0;\n    position: absolute;\n    top: 0;\n    right: 0;\n    background-color: rgb(0,0,0,.1);\n    border: 0 solid transparent;\n    border-bottom-left-radius: .28571429rem;\n}\n.copybutton:hover {\n    background-color: rgb(0,0,0,.2);\n}\n.copybutton:focus {\n    outline: none;\n}");
    if (!(/^.*\/manage\/statement(\?.*){0,1}$/).test(window.location.href)) {
        var CodeBlocks = document.getElementsByTagName('pre');
        var _loop_1 = function (cb) {
            if (CodeBlocks[cb] && CodeBlocks[cb].nodeType) {
                var Content_1 = CodeBlocks[cb].innerText;
                CodeBlocks[cb].style.position = 'relative';
                var CopyButton_1 = document.createElement('button');
                CodeBlocks[cb].insertBefore(CopyButton_1, CodeBlocks[cb].children[0]);
                CopyButton_1.setAttribute('class', 'copybutton');
                CopyButton_1.setAttribute('id', "copybutton".concat(cb));
                CopyButton_1.innerHTML = '<i class="fa-solid fa-copy"></i>';
                CopyButton_1.onclick = function () {
                    GM_setClipboard(Content_1, 'text');
                    CopyButton_1.innerHTML = '<i class="fa-solid fa-check"></i>';
                    setTimeout(function () { CopyButton_1.innerHTML = '<i class="fa-solid fa-copy"></i>'; }, 500);
                };
            }
        };
        for (var cb in CodeBlocks) {
            _loop_1(cb);
        }
    }
}
exports.CodeBlock = CodeBlock;


/***/ }),

/***/ 992:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DiscussionCard = void 0;
var variables_1 = __webpack_require__(449);
function DiscussionCard() {
    var footer = document.querySelector('div.uoj-footer');
    if (footer) {
        var discrd = document.createElement('div');
        discrd.setAttribute('class', 'giscus');
        footer.insertBefore(discrd, footer.firstChild);
        GM_addElement('script', {
            'src': 'https://giscus.app/client.js',
            'data-repo': 'Sukwants/Ex124OJ-discussions',
            'data-repo-id': 'R_kgDOImiZLA',
            'data-category': 'Ideas',
            'data-category-id': 'DIC_kwDOImiZLM4CTCIj',
            'data-mapping': 'pathname',
            'data-strict': '0',
            'data-reactions-enabled': '1',
            'data-emit-metadata': '0',
            'data-input-position': 'top',
            'data-theme': 'preferred_color_scheme',
            'data-lang': 'zh-CN',
            'data-loading': 'lazy',
            'crossorigin': 'anonymous',
            'async': ''
        });
        GM_addStyle(".giscus {\n    display: ".concat((variables_1.Academic == true ? 'none' : 'unset'), ";\n}\n.giscus-frame {\n    margin-top: 20px;\n}"));
    }
}
exports.DiscussionCard = DiscussionCard;


/***/ }),

/***/ 400:
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.FontAwesome = void 0;
function FontAwesome() {
    GM_addElement('link', {
        href: 'https://cdn.bootcdn.net/ajax/libs/font-awesome/6.2.1/css/fontawesome.css',
        rel: 'stylesheet'
    });
    GM_addElement('link', {
        href: 'https://cdn.bootcdn.net/ajax/libs/font-awesome/6.2.1/css/brands.css',
        rel: 'stylesheet'
    });
    GM_addElement('link', {
        href: 'https://cdn.bootcdn.net/ajax/libs/font-awesome/6.2.1/css/solid.css',
        rel: 'stylesheet'
    });
}
exports.FontAwesome = FontAwesome;


/***/ }),

/***/ 18:
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.changeGravatarURL = void 0;
function changeGravatarURL() {
    var GravatarURLRegExp = /\/\/cn.gravatar.com\/avatar\/(.*)/;
    var Gravatars = document.querySelectorAll('img');
    for (var i in Gravatars) {
        if (Gravatars[i] && Gravatars[i].nodeType
            && GravatarURLRegExp.test(Gravatars[i].getAttribute('src'))
            && Gravatars[i].getAttribute('alt').toLowerCase().includes('avatar')) {
            Gravatars[i].setAttribute('src', '//cravatar.cn/avatar/' + Gravatars[i].getAttribute('src').match(GravatarURLRegExp)[1]);
        }
    }
}
exports.changeGravatarURL = changeGravatarURL;


/***/ }),

/***/ 819:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.NameBadge = exports.NameColor = void 0;
var variables_1 = __webpack_require__(449);
function NameColor() {
    var _a;
    var Names = document.getElementsByClassName('uoj-username');
    var NeedsRepeat = false;
    for (var i in Names) {
        if (Names[i].innerHTML && variables_1.NameColorList[Names[i].innerHTML]) {
            Names[i].style.color = variables_1.NameColorList[Names[i].innerHTML][0];
            var resN = '';
            for (var charN = 1; charN < variables_1.NameColorList[Names[i].innerHTML].length; ++charN) {
                resN = resN + "<font style=\"color:".concat(variables_1.NameColorList[Names[i].innerHTML][charN], "\">").concat(Names[i].innerHTML.substring(charN - 1, charN), "</font>");
            }
            Names[i].innerHTML = resN + Names[i].innerHTML.substring(variables_1.NameColorList[Names[i].innerHTML].length - 1);
            if (((_a = Names[i].parentElement) === null || _a === void 0 ? void 0 : _a.getAttribute('class')) === 'legendLabel') {
                NeedsRepeat = true;
            }
        }
    }
    if (NeedsRepeat) {
        setInterval(function () {
            var _a;
            var Names = document.getElementsByClassName('uoj-username');
            for (var i in Names) {
                if (Names[i].innerHTML && ((_a = Names[i].parentElement) === null || _a === void 0 ? void 0 : _a.getAttribute('class')) === 'legendLabel' && variables_1.NameColorList[Names[i].innerHTML]) {
                    Names[i].style.color = variables_1.NameColorList[Names[i].innerHTML][0];
                    var resN = '';
                    for (var charN = 1; charN < variables_1.NameColorList[Names[i].innerHTML].length; ++charN) {
                        resN = resN + "<font style=\"color:".concat(variables_1.NameColorList[Names[i].innerHTML][charN], "\">").concat(Names[i].innerHTML.substring(charN - 1, charN), "</font>");
                    }
                    Names[i].innerHTML = resN + Names[i].innerHTML.substring(variables_1.NameColorList[Names[i].innerHTML].length - 1);
                }
            }
        }, 200);
    }
    var Honors = document.getElementsByClassName('uoj-honor');
    for (var j in Honors) {
        if (Honors[j].innerHTML && variables_1.NameColorList[Honors[j].innerHTML]) {
            Honors[j].style.color = variables_1.NameColorList[Honors[j].innerHTML][0];
            var resH = '';
            for (var charH = 1; charH < variables_1.NameColorList[Honors[j].innerHTML].length; ++charH) {
                resH = resH + "<font style=\"color:".concat(variables_1.NameColorList[Honors[j].innerHTML][charH], "\">").concat(Honors[j].innerHTML.substring(charH - 1, charH), "</font>");
            }
            Honors[j].innerHTML = resH + Honors[j].innerHTML.substring(variables_1.NameColorList[Honors[j].innerHTML].length - 1);
        }
    }
}
exports.NameColor = NameColor;
function NameBadge() {
    var _a, _b;
    var Names = document.getElementsByClassName('uoj-username');
    for (var i in Names) {
        if (!Names[i].innerHTML)
            continue;
        var name_1 = Names[i].textContent;
        if (variables_1.CCFBadgeList[name_1] && ((_a = Names[i].parentElement) === null || _a === void 0 ? void 0 : _a.getAttribute('class')) !== 'legendLabel') {
            Names[i].innerHTML = Names[i].innerHTML + " <svg width=\"1em\" height=\"1em\" data-v-303bbf52=\"\" aria-hidden=\"true\" focusable=\"false\" data-prefix=\"fad\" data-icon=\"badge-check\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" style=\"margin-bottom:.25em!important;bottom:10px;--fa-primary-color:#fff;--fa-secondary-color:".concat(variables_1.CCFBadgeList[name_1], ";--fa-secondary-opacity:1;\"><g data-v-303bbf52=\"\" class=\"fa-group\"><path data-v-303bbf52=\"\" fill=\"var(--fa-secondary-color)\" d=\"M512 256a88 88 0 0 0-57.1-82.4A88 88 0 0 0 338.4 57.1a88 88 0 0 0-164.8 0A88 88 0 0 0 57.1 173.6a88 88 0 0 0 0 164.8 88 88 0 0 0 116.5 116.5 88 88 0 0 0 164.8 0 88 88 0 0 0 116.5-116.5A88 88 0 0 0 512 256zm-144.8-44.25l-131 130a11 11 0 0 1-15.55-.06l-75.72-76.33a11 11 0 0 1 .06-15.56L171 224a11 11 0 0 1 15.56.06l42.15 42.49 97.2-96.42a11 11 0 0 1 15.55.06l25.82 26a11 11 0 0 1-.08 15.56z\" class=\"fa-secondary\"></path></g></svg>");
        }
        if (variables_1.TagBadgeList[name_1] && ((_b = Names[i].parentElement) === null || _b === void 0 ? void 0 : _b.getAttribute('class')) !== 'legendLabel') {
            Names[i].innerHTML = Names[i].innerHTML + " <span style=\"background-color:".concat(variables_1.TagBadgeList[name_1][0], ";padding:0.2em 0.6em;border-radius:.2em;color:#fff;font-size:0.7em;font-weight:bold;display:inline-block\">").concat(variables_1.TagBadgeList[name_1][1], "</span>");
        }
    }
    var Honors = document.getElementsByClassName('uoj-honor');
    for (var j in Honors) {
        if (!Honors[j].innerHTML)
            continue;
        var honor = Honors[j].textContent;
        if (variables_1.CCFBadgeList[honor]) {
            Honors[j].innerHTML = Honors[j].innerHTML + " <svg width=\"1em\" height=\"1em\" data-v-303bbf52=\"\" aria-hidden=\"true\" focusable=\"false\" data-prefix=\"fad\" data-icon=\"badge-check\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" style=\"margin-bottom:.25em!important;bottom:10px;--fa-primary-color:#fff;--fa-secondary-color:".concat(variables_1.CCFBadgeList[honor], ";--fa-secondary-opacity:1;\"><g data-v-303bbf52=\"\" class=\"fa-group\"><path data-v-303bbf52=\"\" fill=\"var(--fa-secondary-color)\" d=\"M512 256a88 88 0 0 0-57.1-82.4A88 88 0 0 0 338.4 57.1a88 88 0 0 0-164.8 0A88 88 0 0 0 57.1 173.6a88 88 0 0 0 0 164.8 88 88 0 0 0 116.5 116.5 88 88 0 0 0 164.8 0 88 88 0 0 0 116.5-116.5A88 88 0 0 0 512 256zm-144.8-44.25l-131 130a11 11 0 0 1-15.55-.06l-75.72-76.33a11 11 0 0 1 .06-15.56L171 224a11 11 0 0 1 15.56.06l42.15 42.49 97.2-96.42a11 11 0 0 1 15.55.06l25.82 26a11 11 0 0 1-.08 15.56z\" class=\"fa-secondary\"></path></g></svg>");
        }
        if (variables_1.TagBadgeList[honor]) {
            Honors[j].innerHTML = Honors[j].innerHTML + " <span style=\"background-color:".concat(variables_1.TagBadgeList[honor][0], ";padding:0.2em 0.6em;border-radius:.2em;color:#fff;font-size:0.7em;font-weight:bold;display:inline-block\">").concat(variables_1.TagBadgeList[honor][1], "</span>");
        }
    }
}
exports.NameBadge = NameBadge;


/***/ }),

/***/ 823:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.downloadData = void 0;
var utils_1 = __webpack_require__(593);
function downloadData() {
    var DownloadTag = document.createElement('a');
    document.querySelector('div.uoj-content > a[role=button]').after(DownloadTag);
    DownloadTag.setAttribute('role', 'button');
    DownloadTag.setAttribute('class', 'btn btn-primary float-right');
    DownloadTag.setAttribute('href', '/download.php?type=problem&id=' + (0, utils_1.isProblem)()[1]);
    DownloadTag.setAttribute('target', '_blank');
    DownloadTag.innerHTML = '<span class="glyphicon glyphicon-download-alt"></span> 下载数据';
    var navtabs = document.querySelector('div.uoj-content > ul[role=tablist]');
    if (navtabs) {
        var TJTag = document.createElement('li');
        navtabs.insertBefore(TJTag, null);
        TJTag.setAttribute('class', 'nav-item');
        var TJInnerTag = document.createElement('a');
        TJTag.appendChild(TJInnerTag);
        TJInnerTag.setAttribute('role', 'tab');
        TJInnerTag.setAttribute('class', 'nav-link');
        TJInnerTag.setAttribute('href', '/download.php?type=tj&id=' + (0, utils_1.isProblem)()[1]);
        TJInnerTag.innerHTML = '<span class="glyphicon glyphicon-book"></span> 题解';
    }
}
exports.downloadData = downloadData;


/***/ }),

/***/ 310:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Settings = void 0;
var variables_1 = __webpack_require__(449);
function Settings() {
    GM_addStyle(".settings-overlay {\n    position: fixed;\n    height: 100%;\n    width: 100%;\n    transition: visibility 0.4s, background 0.4s;\n    top: 0;\n    left: 0;\n    visibility: hidden;\n    z-index: 229;\n}\n.settings-popup-active .settings-overlay {\n    background: rgb(0,0,0,.3);\n    visibility: visible;\n}\n.settings-popup {\n    width: 60%;\n    position: relative;\n    transform: translate(-50%, -50%);\n    top: 50%;\n    left: 50%;\n    visibility: hidden;\n    border-radius: .5rem;\n    padding: 20px 20px;\n}\n.settings-popup-active .settings-overlay .settings-popup {\n    background: #ffffff;\n    visibility: visible;\n}\n.settings-popup .row {\n    padding: 0 30px 30px;\n}\n.settings-titlebar {\n    padding: 10px 20px 30px 20px !important;\n}\n.settings-titlebar h4 {\n    position: relative;\n    top: 50%;\n    left: 0;\n    transform: translate(0, -50%);\n}\n.settings-footerbar {\n    height: 60px;\n    padding: 20px 20px;\n}");
    var HomepageEntrance = document.createElement('li');
    var NavBarTablist = document.querySelector('div[role=main] > div > ul[role=tablist]');
    NavBarTablist.insertBefore(HomepageEntrance, NavBarTablist.firstChild);
    HomepageEntrance.setAttribute('class', 'nav-item');
    HomepageEntrance.innerHTML = '<span style="padding: 0.5rem 1rem; cursor:pointer"><span style="background-color: #28adca;padding:0.2em 0.6em;border-radius: 1em;color:#fff;font-size: 0.7em;font-weight:bold;display:inline-block;position: relative;top: 50%;transform: translate(0,-50%);">Ex124OJ</span></span>';
    HomepageEntrance.onclick = function () {
        document.body.setAttribute('class', 'settings-popup-active');
    };
    var SettingsOverlay = document.createElement('div');
    document.body.insertBefore(SettingsOverlay, document.body.firstChild);
    SettingsOverlay.setAttribute('class', 'settings-overlay');
    var SettingsPopup = document.createElement('div');
    SettingsOverlay.appendChild(SettingsPopup);
    SettingsPopup.setAttribute('class', 'settings-popup');
    var SettingsTitlebar = document.createElement('div');
    SettingsPopup.appendChild(SettingsTitlebar);
    SettingsTitlebar.setAttribute('class', 'row settings-titlebar');
    SettingsTitlebar.innerHTML = '<h3 style="width:100%;height:3.5rem"><img src="https://ex124oj.pond.ink/images/icon.png" style="height:3.5rem;width:3.5rem;margin-right:10px"><span style="vertical-align:middle"> Ex124OJ 控制面板</span> <span style="vertical-align:middle;cursor:pointer;margin:0 10px" onclick="window.open(\'https://ex124oj.pond.ink/\');"><span style="height:1.75rem;line-height:3.5rem;vertical-align:middle;padding:0 .5rem;background-color:#28adca;border-radius:1em;color:#fff;font-size:1.2rem;font-weight:bold">Ex124OJ</span></span><span style="color:#7f7f7f;line-height:3.5rem;vertical-align:middle;font-size:1.2rem">' + variables_1.version + '</span></h3>';
    var SettingsCloseButton = document.createElement('span');
    SettingsPopup.appendChild(SettingsCloseButton);
    SettingsCloseButton.setAttribute('style', 'position: fixed;right: 20px;top:20px;cursor: pointer');
    SettingsCloseButton.setAttribute('onclick', 'document.body.setAttribute(\'class\', \'\');');
    SettingsCloseButton.innerHTML = '<h4><i class="fa fa-xmark"></i></h4>';
    var background = document.createElement('div');
    SettingsPopup.appendChild(background);
    background.setAttribute('class', 'row');
    var backgroundImageLabel = document.createElement('strong');
    background.appendChild(backgroundImageLabel);
    backgroundImageLabel.setAttribute('style', 'font-size: 1.25em');
    backgroundImageLabel.innerHTML = '背景图片&emsp;&emsp;&emsp;&emsp;';
    var backgroundImageInput = document.createElement('input');
    background.appendChild(backgroundImageInput);
    backgroundImageInput.setAttribute('style', 'flex-grow: 1; height: 2em; width: initial');
    backgroundImageInput.setAttribute('class', 'form-control');
    var siteIcon = document.createElement('div');
    SettingsPopup.appendChild(siteIcon);
    siteIcon.setAttribute('class', 'row');
    var siteIconImageLabel = document.createElement('strong');
    siteIcon.appendChild(siteIconImageLabel);
    siteIconImageLabel.setAttribute('style', 'font-size: 1.25em');
    siteIconImageLabel.innerHTML = '网站图标&emsp;&emsp;&emsp;&emsp;';
    var siteIconImageInput = document.createElement('input');
    siteIcon.appendChild(siteIconImageInput);
    siteIconImageInput.setAttribute('style', 'flex-grow: 1; height: 2em; width: initial');
    siteIconImageInput.setAttribute('class', 'form-control');
    var siteIconSmall = document.createElement('div');
    SettingsPopup.appendChild(siteIconSmall);
    siteIconSmall.setAttribute('class', 'row');
    var siteIconSmallImageLabel = document.createElement('strong');
    siteIconSmall.appendChild(siteIconSmallImageLabel);
    siteIconSmallImageLabel.setAttribute('style', 'font-size: 1.25em');
    siteIconSmallImageLabel.innerHTML = '网站图标(小)&emsp;';
    var siteIconSmallImageInput = document.createElement('input');
    siteIconSmall.appendChild(siteIconSmallImageInput);
    siteIconSmallImageInput.setAttribute('style', 'flex-grow: 1; height: 2em; width: initial');
    siteIconSmallImageInput.setAttribute('class', 'form-control');
    var academic = document.createElement('div');
    SettingsPopup.appendChild(academic);
    academic.setAttribute('class', 'row');
    academic.setAttribute('style', 'line-height: 2.5em;vertical-align: middle');
    var academicLabel = document.createElement('strong');
    academic.appendChild(academicLabel);
    academicLabel.setAttribute('style', 'font-size: 1.25em');
    academicLabel.innerHTML = '学术模式&emsp;&emsp;&emsp;&emsp;';
    var academicOff = document.createElement('div');
    academic.appendChild(academicOff);
    academicOff.innerHTML = '<input type="radio" id="AcademicOff"> 关闭&emsp;';
    var academicOn = document.createElement('div');
    academic.appendChild(academicOn);
    academicOn.innerHTML = '<input type="radio" id="AcademicOn"> 开启&emsp;';
    document.getElementById('AcademicOff').onclick = function () {
        document.getElementById('AcademicOn').checked = false;
    };
    document.getElementById('AcademicOn').onclick = function () {
        document.getElementById('AcademicOff').checked = false;
    };
    backgroundImageInput.value = variables_1.BackgroundImage;
    siteIconImageInput.value = variables_1.SiteIconImage;
    siteIconSmallImageInput.value = variables_1.SiteIconSmallImage;
    document.getElementById('AcademicOff').checked = !variables_1.Academic;
    document.getElementById('AcademicOn').checked = variables_1.Academic;
    var FooterRow = document.createElement('div');
    FooterRow.setAttribute('class', 'settings-footerbar');
    SettingsPopup.appendChild(FooterRow);
    var Ok = document.createElement('button');
    FooterRow.appendChild(Ok);
    Ok.setAttribute('class', 'btn btn-search btn-outline-primary float-right');
    Ok.innerHTML = '保存';
    Ok.onclick = function () {
        GM_setValue('BackgroundImage', backgroundImageInput.value);
        GM_setValue('SiteIconImage', siteIconImageInput.value);
        GM_setValue('SiteIconSmallImage', siteIconSmallImageInput.value);
        GM_setValue('Academic', document.getElementById('AcademicOn').checked);
        location.reload();
    };
    var Clear = document.createElement('button');
    FooterRow.appendChild(Clear);
    Clear.setAttribute('class', 'btn btn-search btn-outline-primary float-right');
    Clear.innerHTML = '恢复默认';
    Clear.onclick = function () {
        var values = GM_listValues();
        for (var value in values) {
            GM_deleteValue(values[value]);
        }
        location.reload();
    };
}
exports.Settings = Settings;


/***/ }),

/***/ 978:
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.SubmissionCard = void 0;
function SubmissionCard() {
    var _a;
    var content = document.querySelector('div.uoj-content');
    if (content && content.children.length > 1) {
        var TabList = document.createElement('ul');
        content.insertBefore(TabList, content.children[1]);
        TabList.setAttribute('class', 'nav nav-tabs');
        TabList.setAttribute('role', 'tablist');
        var TabContent = document.createElement('div');
        content.insertBefore(TabContent, content.children[2]);
        TabContent.setAttribute('class', 'tab-content');
        TabContent.style.marginBottom = '20px';
        var counter = 0;
        for (var i = 3; i < content.children.length; i++, counter++) {
            var classlist = content.children[i].getAttribute('class');
            if (classlist && classlist.includes('card')) {
                var isActive = !counter;
                var title = document.createElement('li');
                TabList.appendChild(title);
                title.setAttribute('class', 'nav-item');
                var titleText = (_a = content.children[i].querySelector('h4.card-title')) === null || _a === void 0 ? void 0 : _a.textContent;
                if (titleText) {
                    titleText = titleText.charAt(0).toUpperCase() + titleText.slice(1);
                    title.innerHTML = "<a class=\"nav-link".concat(isActive ? ' active' : '', "\" href=\"#card").concat(counter, "\" role=\"tab\" data-toggle=\"tab\" aria-selected=\"true\">").concat(titleText, "</a>");
                }
                var card = document.createElement('div');
                TabContent.appendChild(card);
                card.setAttribute('class', "tab-pane card".concat(isActive ? ' active' : ''));
                card.setAttribute('id', "card".concat(counter));
                var card_body = content.children[i].querySelector('div.card-body');
                if (card_body)
                    card.appendChild(card_body);
                var card_footer = content.children[i].querySelector('div.card-footer');
                if (card_footer)
                    card.appendChild(card_footer);
                content.removeChild(content.children[i]);
                i--;
            }
        }
    }
}
exports.SubmissionCard = SubmissionCard;


/***/ }),

/***/ 900:
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TableStyle = void 0;
function TableStyle() {
    var Tables = document.getElementsByTagName('table');
    for (var table in Tables) {
        if (Tables[table].nodeType) {
            var parentNode = Tables[table].parentNode;
            var parentClass = parentNode.getAttribute('class');
            var classList = Tables[table].classList;
            if (parentClass !== 'legend' && classList.length === 0) {
                Tables[table].classList.add('table', 'table-bordered');
            }
        }
    }
    var ths = document.getElementsByTagName('th');
    for (var th in ths) {
        if (ths[th].nodeType && ths[th].getAttribute('align')) {
            ths[th].setAttribute('style', 'text-align:' + ths[th].getAttribute('align'));
        }
    }
}
exports.TableStyle = TableStyle;


/***/ }),

/***/ 720:
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.RandomProblem = void 0;
function RandomProblem() {
    var SearchBox = document.getElementById('form-search-problem');
    if (SearchBox) {
        var RandomButton = document.createElement('div');
        RandomButton.setAttribute('class', 'input-group-append');
        RandomButton.innerHTML = '<button class="btn btn-search btn-outline-primary" style="height: calc(1.5em + 0.75rem + 2px);" onclick="randomProblem();">随机跳题</button>';
        var RandomScript = document.createElement('script');
        RandomScript.innerHTML =
            "function randomProblem() {\n    const randomProblemId = Math.ceil(Math.random() * 3000);\n    ($.get('/problem/' + randomProblemId, (data, status) => {\n        if (status == 'success') {\n            window.location.href = '/problem/' + randomProblemId;\n        } else {\n            randomProblem();\n        }\n    })).error(() => {\n        randomProblem();\n    })\n}";
        SearchBox.after(RandomButton);
        RandomButton.after(RandomScript);
    }
}
exports.RandomProblem = RandomProblem;


/***/ }),

/***/ 593:
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isBlog = exports.isUserProfile = exports.isProblem = exports.isSubmission = exports.isHomepage = void 0;
var HomepageRegExp = /^http:\/\/124.221.194.184(\/)?(\?.*)?$/;
function isHomepage() {
    return window.location.href.match(HomepageRegExp);
}
exports.isHomepage = isHomepage;
var submissionRegExp = /^http:\/\/124.221.194.184\/submission\/\d+(\?.*)?$/;
function isSubmission() {
    return window.location.href.match(submissionRegExp);
}
exports.isSubmission = isSubmission;
var ProblemRegExp = /^http:\/\/124.221.194.184.*\/problem\/(\d+)(\?.*)?$/;
function isProblem() {
    return window.location.href.match(ProblemRegExp);
}
exports.isProblem = isProblem;
var UserProfileRegExp = /^http:\/\/124.221.194.184\/user\/profile\/.+(\?.*)?$/;
function isUserProfile() {
    return window.location.href.match(UserProfileRegExp);
}
exports.isUserProfile = isUserProfile;
var BlogRegExp = /^http:\/\/124.221.194.184\/blog\/.+(\?.*)?$/;
function isBlog() {
    return window.location.href.match(BlogRegExp);
}
exports.isBlog = isBlog;


/***/ }),

/***/ 449:
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getVariables = exports.TagBadgeList = exports.CCFBadgeList = exports.NameColorList = exports.Academic = exports.SiteIconSmallImage = exports.SiteIconImage = exports.BackgroundImage = exports.version = void 0;
exports.version = "1.0.2";
function getVariables(callback) {
    exports.BackgroundImage = GM_getValue('BackgroundImage', '');
    exports.SiteIconImage = GM_getValue('SiteIconImage', '');
    exports.SiteIconSmallImage = GM_getValue('SiteIconSmallImage', '');
    exports.Academic = GM_getValue('Academic', false);
    GM_xmlhttpRequest({
        method: "GET",
        url: "https://ex124oj.pond.ink/public/variables.json",
        revalidate: true,
        onload: function (data) {
            var variables = JSON.parse(data.response);
            exports.NameColorList = variables.NameColorList;
            GM_setValue('NameColorList', exports.NameColorList);
            exports.CCFBadgeList = variables.CCFBadgeList;
            GM_setValue('CCFBadgeList', exports.CCFBadgeList);
            exports.TagBadgeList = variables.TagBadgeList;
            GM_setValue('TagBadgeList', exports.TagBadgeList);
            callback();
        }
    });
}
exports.getVariables = getVariables;


/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
var exports = __webpack_exports__;
var __webpack_unused_export__;

/// <reference path="index.d.ts" />
__webpack_unused_export__ = ({ value: true });
var utils_1 = __webpack_require__(593);
var variables_1 = __webpack_require__(449);
var settings_1 = __webpack_require__(310);
var name_1 = __webpack_require__(819);
var fontawesome_1 = __webpack_require__(400);
var appearance_1 = __webpack_require__(690);
var announcement_1 = __webpack_require__(579);
var toolbar_1 = __webpack_require__(720);
var discussion_1 = __webpack_require__(992);
var code_1 = __webpack_require__(480);
var table_1 = __webpack_require__(900);
var submission_1 = __webpack_require__(978);
var problem_1 = __webpack_require__(823);
var gravatar_1 = __webpack_require__(18);
(function () {
    'use strict';
    (0, variables_1.getVariables)(function () {
        (0, settings_1.Settings)();
        (0, name_1.NameColor)();
        (0, name_1.NameBadge)();
    });
    (0, fontawesome_1.FontAwesome)();
    (0, appearance_1.Background)();
    (0, appearance_1.changeIcon)();
    (0, discussion_1.DiscussionCard)();
    (0, code_1.CodeBlock)();
    (0, table_1.TableStyle)();
    (0, toolbar_1.RandomProblem)();
    if ((0, utils_1.isHomepage)())
        (0, announcement_1.exAnnouncements)();
    if ((0, utils_1.isSubmission)())
        (0, submission_1.SubmissionCard)();
    if ((0, utils_1.isProblem)())
        (0, problem_1.downloadData)();
    if ((0, utils_1.isUserProfile)() || (0, utils_1.isBlog)())
        (0, gravatar_1.changeGravatarURL)();
})();

})();

/******/ })()
;