Ex124OJ

Extend 124OJ!

当前为 2023-09-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Ex124OJ
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.12
  5. // @description Extend 124OJ!
  6. // @author Sukwants
  7. // @license MIT
  8. // @match http://124.221.194.184/*
  9. // @icon https://ex124oj.pond.ink/images/icon.png
  10. // @grant GM_addElement
  11. // @grant GM_addStyle
  12. // @grant GM_setClipboard
  13. // @grant GM_getValue
  14. // @grant GM_setValue
  15. // @grant GM_deleteValue
  16. // @grant GM_listValues
  17. // @grant GM_xmlhttpRequest
  18. // @connect ex124oj.pond.ink
  19. // ==/UserScript==
  20.  
  21.  
  22. /******/ (() => { // webpackBootstrap
  23. /******/ "use strict";
  24. /******/ var __webpack_modules__ = ({
  25.  
  26. /***/ 579:
  27. /***/ ((__unused_webpack_module, exports) => {
  28.  
  29.  
  30. Object.defineProperty(exports, "__esModule", ({ value: true }));
  31. exports.exAnnouncements = void 0;
  32. function exAnnouncements() {
  33. var PostsExp = /<body[\s\S]*?>([\s\S]*?)<\/body>/;
  34. var WrittenByExp = /^by (.*)$/;
  35. var DateTimeExp = /^(.*?) .*$/;
  36. if (document.getElementsByClassName('uoj-content')[0].children[0].children[0].children[0]) {
  37. GM_xmlhttpRequest({
  38. method: "GET",
  39. url: "https://ex124oj.pond.ink/categories/Announcements/",
  40. revalidate: true,
  41. onload: function (data) {
  42. var Announcements = document.querySelector('div.uoj-content > div.card.card-default > div.card-body > div.row > div:first-child > table');
  43. if (Announcements) {
  44. 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>';
  45. var trs = Announcements.querySelectorAll('tbody > tr');
  46. for (var tr = 0; tr < trs.length - 1; ++tr) {
  47. if (trs[tr].innerHTML) {
  48. 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>';
  49. if (WrittenByExp.test(trs[tr].children[1] && trs[tr].children[1].innerHTML)) {
  50. trs[tr].children[1].innerHTML = trs[tr].children[1].innerHTML.match(WrittenByExp)[1];
  51. }
  52. if (DateTimeExp.test(trs[tr].children[2] && trs[tr].children[2].innerHTML)) {
  53. trs[tr].children[2].innerHTML = '<small>' + trs[tr].children[2].textContent.match(DateTimeExp)[1] + '</small>';
  54. }
  55. }
  56. }
  57. 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>';
  58. var PostsPage = (new DOMParser()).parseFromString(data.response, 'text/html');
  59. var Posts = PostsPage.querySelectorAll('article');
  60. for (var i = 0; i < Posts.length && i < 5; ++i) {
  61. var title = Posts[i].querySelector('a.post-title-link');
  62. Announcements.querySelector('tbody').children[i].children[3].innerHTML = "<a href=\"https://ex124oj.pond.ink".concat(title.getAttribute('href'), "\">").concat(title.innerText, "</a>");
  63. 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>';
  64. var date = Posts[i].querySelector('time');
  65. Announcements.querySelector('tbody').children[i].children[5].innerHTML = '<small>' + date.getAttribute('content') + '</small>';
  66. }
  67. }
  68. }
  69. });
  70. }
  71. }
  72. exports.exAnnouncements = exAnnouncements;
  73.  
  74.  
  75. /***/ }),
  76.  
  77. /***/ 690:
  78. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  79.  
  80.  
  81. Object.defineProperty(exports, "__esModule", ({ value: true }));
  82. exports.changeIcon = exports.Background = void 0;
  83. var variables_1 = __webpack_require__(449);
  84. function Background() {
  85. if (variables_1.BackgroundImage) {
  86. document.getElementsByClassName('navbar-brand')[0].innerHTML = '<img src="/images/logo_small.png" alt="Logo" class="img-rounded" style="width:39px; height:39px;">';
  87. var container = document.getElementsByClassName('container')[0];
  88. if (container) {
  89. var firstChild = container.children[0];
  90. if (firstChild && firstChild.children.length >= 2) {
  91. var innerHTML = firstChild.children[1].innerHTML;
  92. var matchResult = innerHTML.match(/(.*> ){0,1}(.*)/);
  93. if (matchResult) {
  94. var newInnerHTML = matchResult[2];
  95. firstChild.children[1].innerHTML = newInnerHTML;
  96. }
  97. }
  98. }
  99. 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}");
  100. }
  101. }
  102. exports.Background = Background;
  103. function getIcon() {
  104. if (variables_1.SiteIconImage)
  105. return variables_1.SiteIconImage;
  106. else
  107. return '/images/logo.png';
  108. }
  109. function getIconSmall() {
  110. if (variables_1.SiteIconSmallImage)
  111. return variables_1.SiteIconSmallImage;
  112. else
  113. return getIcon();
  114. }
  115. function changeIcon() {
  116. var LogoURLRegExp = /^.*\/images\/logo(_small){0,1}.png$/;
  117. var Links = document.getElementsByTagName('link');
  118. for (var link in Links) {
  119. if (Links[link] && Links[link].nodeType && Links[link].getAttribute('rel') == 'shortcut icon') {
  120. Links[link].setAttribute('href', getIconSmall());
  121. }
  122. }
  123. var Icons = document.getElementsByTagName('img');
  124. for (var icon in Icons) {
  125. if (Icons[icon] instanceof Element && Icons[icon].nodeType === Node.ELEMENT_NODE) {
  126. var srcAttribute = Icons[icon].getAttribute('src');
  127. if (srcAttribute !== null && LogoURLRegExp.test(srcAttribute)) {
  128. if (!Icons[icon].getAttribute('style')) {
  129. Icons[icon].setAttribute('src', getIcon());
  130. Icons[icon].setAttribute('style', 'width:100%;height:auto;object-fit:cover');
  131. }
  132. else {
  133. Icons[icon].setAttribute('src', getIconSmall());
  134. }
  135. }
  136. }
  137. }
  138. }
  139. exports.changeIcon = changeIcon;
  140.  
  141.  
  142. /***/ }),
  143.  
  144. /***/ 480:
  145. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  146.  
  147.  
  148. Object.defineProperty(exports, "__esModule", ({ value: true }));
  149. exports.CodeBlock = void 0;
  150. var variables_1 = __webpack_require__(449);
  151. function CodeBlock() {
  152. GM_addStyle("@import url(https://cdn.jsdelivr.net/npm/firacode@6.2.0/distr/fira_code.css);\ncode {\n font-family: \"Fira Code\";\n ".concat(variables_1.Ligatures ? '' : 'font-variant-ligatures: none;', "\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}"));
  153. if (!(/^.*\/manage\/statement(\?.*){0,1}$/).test(window.location.href)) {
  154. var CodeBlocks = document.getElementsByTagName('pre');
  155. var _loop_1 = function (cb) {
  156. if (CodeBlocks[cb] && CodeBlocks[cb].nodeType) {
  157. var Content_1 = CodeBlocks[cb].innerText;
  158. CodeBlocks[cb].style.position = 'relative';
  159. var CopyButton_1 = document.createElement('button');
  160. CodeBlocks[cb].insertBefore(CopyButton_1, CodeBlocks[cb].children[0]);
  161. CopyButton_1.setAttribute('class', 'copybutton');
  162. CopyButton_1.setAttribute('id', "copybutton".concat(cb));
  163. CopyButton_1.innerHTML = '<i class="fa-solid fa-copy"></i>';
  164. CopyButton_1.onclick = function () {
  165. GM_setClipboard(Content_1, 'text');
  166. CopyButton_1.innerHTML = '<i class="fa-solid fa-check"></i>';
  167. setTimeout(function () { CopyButton_1.innerHTML = '<i class="fa-solid fa-copy"></i>'; }, 500);
  168. };
  169. }
  170. };
  171. for (var cb in CodeBlocks) {
  172. _loop_1(cb);
  173. }
  174. }
  175. }
  176. exports.CodeBlock = CodeBlock;
  177.  
  178.  
  179. /***/ }),
  180.  
  181. /***/ 103:
  182. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  183.  
  184.  
  185. Object.defineProperty(exports, "__esModule", ({ value: true }));
  186. exports.ContestStandings = exports.ContestsCard = void 0;
  187. var name_1 = __webpack_require__(819);
  188. function ContestsCard() {
  189. var content = document.querySelector('div.uoj-content');
  190. if (content && content.children.length > 1) {
  191. var TabList = document.createElement('ul');
  192. content.insertBefore(TabList, content.children[0]);
  193. TabList.setAttribute('class', 'nav nav-tabs');
  194. TabList.setAttribute('role', 'tablist');
  195. var TabContent = document.createElement('div');
  196. content.insertBefore(TabContent, content.children[1]);
  197. TabContent.setAttribute('class', 'tab-content');
  198. TabContent.style.marginBottom = '20px';
  199. TabContent.style.marginTop = '20px';
  200. var counter = 0;
  201. for (var i = 2; i < content.children.length; i++) {
  202. console.log(content.children[i].tagName);
  203. if (content.children[i].tagName.toUpperCase() == 'H4') {
  204. var isActive = !counter;
  205. var title = document.createElement('li');
  206. TabList.appendChild(title);
  207. title.setAttribute('class', 'nav-item');
  208. var titleText = content.children[i].textContent;
  209. if (titleText) {
  210. titleText = titleText.charAt(0).toUpperCase() + titleText.slice(1);
  211. title.innerHTML = "<a class=\"nav-link".concat(isActive ? ' active' : '', "\" href=\"#card").concat(counter, "\" role=\"tab\" data-toggle=\"tab\" aria-selected=\"true\">").concat(titleText, "</a>");
  212. }
  213. var card = document.createElement('div');
  214. TabContent.appendChild(card);
  215. card.setAttribute('class', "tab-pane".concat(isActive ? ' active' : ''));
  216. card.setAttribute('id', "card".concat(counter));
  217. content.removeChild(content.children[i]);
  218. counter++;
  219. }
  220. else if (counter) {
  221. TabContent.children[counter - 1].appendChild(content.children[i]);
  222. }
  223. else {
  224. content.removeChild(content.children[i]);
  225. }
  226. i--;
  227. }
  228. }
  229. }
  230. exports.ContestsCard = ContestsCard;
  231. function PinLineHeader() {
  232. var lines = document.querySelectorAll('div#standings > div.table-responsive > table tr');
  233. for (var i = 0; i < lines.length; i++) {
  234. var line = lines[i];
  235. var x = 0;
  236. for (var j = 0; j < line.children.length && j < 3; j++) {
  237. line.children[j].style.position = 'sticky';
  238. line.children[j].style.left = x + 'px';
  239. console.log(window.getComputedStyle(lines[i]).backgroundColor);
  240. line.children[j].style.backgroundColor = ({ 'rgba(0, 0, 0, 0)': '#E8F8F5', 'rgba(0, 0, 0, 0.05)': '#E0F0ED' })[window.getComputedStyle(lines[i]).backgroundColor] || 'rgb(255, 255, 255)';
  241. x = x + parseFloat(window.getComputedStyle(line.children[j]).width);
  242. }
  243. }
  244. }
  245. var ContestHomepage;
  246. function ProblemTitles() {
  247. var solve = function () {
  248. var lines = document.querySelectorAll('div#standings > div.table-responsive > table tr');
  249. var problems = {};
  250. var rows = ContestHomepage.querySelectorAll('table > tbody > tr');
  251. for (var i = 0; i < rows.length; i++) {
  252. if (rows[i].children.length >= 2) {
  253. var id = rows[i].children[0].textContent, title = rows[i].children[1].textContent;
  254. if (id && title) {
  255. problems[id] = "".concat(id, ". ").concat(title);
  256. }
  257. }
  258. }
  259. for (var i = 0; i < lines.length; i++) {
  260. var line = lines[i];
  261. for (var j = 3; j < line.children.length; j++) {
  262. var title = lines[0].children[j].querySelector('a');
  263. if (title && title.textContent && problems[title.textContent]) {
  264. line.children[j].title = problems[title.textContent];
  265. }
  266. }
  267. }
  268. };
  269. if (ContestHomepage) {
  270. solve();
  271. }
  272. else {
  273. GM_xmlhttpRequest({
  274. method: "GET",
  275. url: "/contest/".concat(contest_id),
  276. revalidate: true,
  277. onload: function (data) {
  278. ContestHomepage = (new DOMParser()).parseFromString(data.response, 'text/html');
  279. solve();
  280. }
  281. });
  282. }
  283. }
  284. var Problemchecked = [];
  285. function ShowStandings() {
  286. PinLineHeader();
  287. ProblemTitles();
  288. var lines = document.querySelectorAll('div#standings > div.table-responsive > table tr');
  289. if (!lines.length) {
  290. return;
  291. }
  292. var sum = 0;
  293. for (var k = 0; k < lines.length; k++) {
  294. var _loop_1 = function (i) {
  295. if (Problemchecked[i - 3]) {
  296. lines[k].children[i].classList.add('checked');
  297. if (k == 0)
  298. sum++;
  299. }
  300. lines[k].children[i].addEventListener('click', function (event) {
  301. var target = event.target;
  302. if (target.tagName === 'A') {
  303. return;
  304. }
  305. Problemchecked[i - 3] = !Problemchecked[i - 3];
  306. displayStandings();
  307. });
  308. };
  309. for (var i = 3; i < lines[k].children.length; i++) {
  310. _loop_1(i);
  311. }
  312. }
  313. if (sum == 0) {
  314. return;
  315. }
  316. var scores = document.querySelectorAll('div#standings > div.table-responsive > table > tbody > tr > td:nth-child(3) > div > span.uoj-score');
  317. for (var i = 0; i < scores.length; i++) {
  318. scores[i].style.color = getColOfScore(standings[i][0] / sum);
  319. }
  320. }
  321. function displayStandings(initial) {
  322. var standingsArea = document.querySelector('div#standings');
  323. if (!standingsArea) {
  324. return;
  325. }
  326. var lines = standingsArea.querySelectorAll('div.table-responsive > table tr');
  327. var headline = lines[0];
  328. var Problemsum = headline.children.length - 3;
  329. var Usersum = lines.length - 1;
  330. // let checked = false;
  331. // for (let i = 0; i < Problemsum; i++) {
  332. // checked = checked || Problemchecked[i];
  333. // }
  334. for (var i = 0; i < Usersum; i++) {
  335. var name_2 = standings[i][2][0];
  336. standings[i][0] = standings[i][1] = 0;
  337. for (var j = 0; j < Problemsum; j++) {
  338. if ((Problemchecked[j] /* || !checked*/) && score[name_2][j] !== undefined) {
  339. standings[i][0] += score[name_2][j][0], standings[i][1] += score[name_2][j][1];
  340. }
  341. }
  342. }
  343. standings.sort(function (a, b) {
  344. return a[0] != b[0] ? b[0] - a[0] : a[1] - b[1];
  345. });
  346. for (var i = 0; i < Usersum; i++) {
  347. if (!i || standings[i][0] != standings[i - 1][0] || standings[i][1] != standings[i - 1][1]) {
  348. standings[i][3] = i + 1;
  349. }
  350. else {
  351. standings[i][3] = standings[i - 1][3];
  352. }
  353. }
  354. var tableBefore = document.querySelector('div.table-responsive');
  355. if (tableBefore && tableBefore.children[0]) {
  356. var ScrollRight = parseInt(window.getComputedStyle(tableBefore.children[0]).width) - tableBefore.scrollLeft;
  357. showStandings();
  358. if (!initial) {
  359. (0, name_1.NameColor)(standingsArea);
  360. (0, name_1.NameBadge)(standingsArea);
  361. }
  362. ShowStandings();
  363. var tableAfter = document.querySelector('div.table-responsive');
  364. if (tableAfter && tableAfter.children[0]) {
  365. tableAfter.scrollLeft = parseInt(window.getComputedStyle(tableAfter.children[0]).width) - ScrollRight;
  366. }
  367. }
  368. }
  369. function NavBar(ProblemSum) {
  370. var navtabs = document.querySelector('div.uoj-content ul[role=tablist]');
  371. if (!navtabs) {
  372. return;
  373. }
  374. var navbar = document.createElement('div');
  375. navtabs.before(navbar);
  376. navbar.setAttribute('style', 'border-bottom: 1px solid #dee2e6;');
  377. var floatright = document.createElement('div');
  378. navbar.appendChild(floatright);
  379. floatright.setAttribute('class', 'float-right');
  380. var unselectall = document.createElement('a');
  381. floatright.appendChild(unselectall);
  382. unselectall.setAttribute('class', 'btn btn-info btn-sm');
  383. unselectall.setAttribute('target', '_blank');
  384. unselectall.style.color = '#fff';
  385. unselectall.style.cursor = 'pointer';
  386. unselectall.addEventListener('click', function () {
  387. Problemchecked = new Array(ProblemSum).fill(true);
  388. displayStandings();
  389. });
  390. unselectall.innerHTML = '全选';
  391. var selectall = document.createElement('a');
  392. floatright.appendChild(selectall);
  393. selectall.setAttribute('class', 'btn btn-primary btn-sm');
  394. selectall.setAttribute('target', '_blank');
  395. selectall.style.color = '#fff';
  396. selectall.style.cursor = 'pointer';
  397. selectall.addEventListener('click', function () {
  398. Problemchecked = new Array(ProblemSum).fill(false);
  399. displayStandings();
  400. });
  401. selectall.innerHTML = '全不选';
  402. navbar.appendChild(navtabs);
  403. navtabs.setAttribute('style', 'border-bottom: none');
  404. }
  405. function ContestStandings() {
  406. GM_addStyle("\ndiv#standings > div.table-responsive > table > thead > tr > th:nth-child(-n+3)::before,\ndiv#standings > div.table-responsive > table > tbody > tr > td:nth-child(-n+3)::before {\n content: \"\";\n position: absolute;\n top: 0;\n right: 100%;\n width: 1px;\n height: 100%;\n background-color: #dee2e6;\n}\ndiv#standings > div.table-responsive > table > thead > tr > th:nth-child(n+4).checked,\ndiv#standings > div.table-responsive > table > tbody > tr:nth-of-type(even) > td:nth-child(n+4).checked {\n background-color: #E8F8F5;\n}\ndiv#standings > div.table-responsive > table > tbody > tr:nth-of-type(odd) > td:nth-child(n+4).checked {\n background-color: #E0F0ED;\n}\n");
  407. var ProblemSum = document.querySelectorAll('div#standings > div.table-responsive > table > thead > tr > th').length - 3;
  408. Problemchecked = new Array(ProblemSum).fill(true);
  409. displayStandings(true);
  410. NavBar(ProblemSum);
  411. }
  412. exports.ContestStandings = ContestStandings;
  413.  
  414.  
  415. /***/ }),
  416.  
  417. /***/ 992:
  418. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  419.  
  420.  
  421. Object.defineProperty(exports, "__esModule", ({ value: true }));
  422. exports.DiscussionCard = void 0;
  423. var variables_1 = __webpack_require__(449);
  424. function DiscussionCard() {
  425. var _a;
  426. var footer = document.querySelector('div.uoj-footer');
  427. if (footer) {
  428. var discrd = document.createElement('div');
  429. discrd.setAttribute('class', 'giscus');
  430. footer.insertBefore(discrd, footer.firstChild);
  431. GM_addElement('script', {
  432. 'src': 'https://giscus.app/client.js',
  433. 'data-repo': 'Sukwants/Ex124OJ-discussions',
  434. 'data-repo-id': 'R_kgDOImiZLA',
  435. 'data-category': 'Ideas',
  436. 'data-category-id': 'DIC_kwDOImiZLM4CTCIj',
  437. 'data-mapping': 'pathname',
  438. 'data-strict': '0',
  439. 'data-reactions-enabled': '1',
  440. 'data-emit-metadata': '0',
  441. 'data-input-position': 'top',
  442. 'data-theme': 'light',
  443. 'data-lang': 'zh-CN',
  444. 'data-loading': 'lazy',
  445. 'crossorigin': 'anonymous',
  446. 'async': ''
  447. });
  448. GM_addStyle(".giscus {\n display: ".concat((variables_1.Academic == true ? 'none' : 'unset'), ";\n}\n.giscus-frame {\n margin-top: 20px;\n}"));
  449. var lanButton = document.getElementsByClassName('btn-group dropright mb-3')[0];
  450. var blankLine = document.createElement('div');
  451. blankLine.style.marginTop = '20px';
  452. (_a = lanButton.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(blankLine, lanButton);
  453. }
  454. }
  455. exports.DiscussionCard = DiscussionCard;
  456.  
  457.  
  458. /***/ }),
  459.  
  460. /***/ 400:
  461. /***/ ((__unused_webpack_module, exports) => {
  462.  
  463.  
  464. Object.defineProperty(exports, "__esModule", ({ value: true }));
  465. exports.FontAwesome = void 0;
  466. function FontAwesome() {
  467. GM_addElement('link', {
  468. href: 'https://cdn.bootcdn.net/ajax/libs/font-awesome/6.2.1/css/fontawesome.css',
  469. rel: 'stylesheet'
  470. });
  471. GM_addElement('link', {
  472. href: 'https://cdn.bootcdn.net/ajax/libs/font-awesome/6.2.1/css/brands.css',
  473. rel: 'stylesheet'
  474. });
  475. GM_addElement('link', {
  476. href: 'https://cdn.bootcdn.net/ajax/libs/font-awesome/6.2.1/css/solid.css',
  477. rel: 'stylesheet'
  478. });
  479. }
  480. exports.FontAwesome = FontAwesome;
  481.  
  482.  
  483. /***/ }),
  484.  
  485. /***/ 18:
  486. /***/ ((__unused_webpack_module, exports) => {
  487.  
  488.  
  489. Object.defineProperty(exports, "__esModule", ({ value: true }));
  490. exports.changeGravatarURL = void 0;
  491. function changeGravatarURL() {
  492. var GravatarURLRegExp = /\/\/cn.gravatar.com\/avatar\/(.*)/;
  493. var Gravatars = document.querySelectorAll('img');
  494. for (var i in Gravatars) {
  495. if (Gravatars[i] && Gravatars[i].nodeType
  496. && GravatarURLRegExp.test(Gravatars[i].getAttribute('src'))
  497. && Gravatars[i].getAttribute('alt').toLowerCase().includes('avatar')) {
  498. Gravatars[i].setAttribute('src', '//cravatar.cn/avatar/' + Gravatars[i].getAttribute('src').match(GravatarURLRegExp)[1]);
  499. }
  500. }
  501. }
  502. exports.changeGravatarURL = changeGravatarURL;
  503.  
  504.  
  505. /***/ }),
  506.  
  507. /***/ 819:
  508. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  509.  
  510.  
  511. Object.defineProperty(exports, "__esModule", ({ value: true }));
  512. exports.NameBadge = exports.NameColor = void 0;
  513. var variables_1 = __webpack_require__(449);
  514. function NameColor(where) {
  515. if (!where) {
  516. where = document;
  517. }
  518. var Names = where.querySelectorAll('.uoj-username, .uoj-honor');
  519. for (var i in Names) {
  520. if (Names[i].innerHTML && variables_1.NameColorList[Names[i].innerHTML]) {
  521. Names[i].style.color = variables_1.NameColorList[Names[i].innerHTML][0];
  522. var resN = '';
  523. for (var char = 1; char < variables_1.NameColorList[Names[i].innerHTML].length; ++char) {
  524. resN = resN + "<font style=\"color:".concat(variables_1.NameColorList[Names[i].innerHTML][char], "\">").concat(Names[i].innerHTML.substring(char - 1, char), "</font>");
  525. }
  526. Names[i].innerHTML = resN + Names[i].innerHTML.substring(variables_1.NameColorList[Names[i].innerHTML].length - 1);
  527. }
  528. }
  529. }
  530. exports.NameColor = NameColor;
  531. function NameBadge(where) {
  532. var _a;
  533. if (!where) {
  534. where = document;
  535. }
  536. var ccfbadgecode = function (color) { return "<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(color, ";--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>"); };
  537. var tagbadgecode = function (color, text) { return "<span style=\"background-color:".concat(color, ";padding:0.2em 0.6em;border-radius:.2em;color:#fff;font-size:0.7em;font-weight:bold;display:inline-block\">").concat(text, "</span>"); };
  538. var Names = where.querySelectorAll('.uoj-username, .uoj-honor');
  539. for (var i in Names) {
  540. var name_1 = Names[i].textContent;
  541. if (!name_1 || ((_a = Names[i].parentElement) === null || _a === void 0 ? void 0 : _a.getAttribute('class')) == 'legendLabel')
  542. continue;
  543. if (variables_1.CCFBadgeList[name_1]) {
  544. for (var j in variables_1.CCFBadgeList[name_1]) {
  545. Names[i].innerHTML += " ".concat(ccfbadgecode(variables_1.CCFBadgeList[name_1][j]));
  546. }
  547. }
  548. if (variables_1.TagBadgeList[name_1]) {
  549. for (var j in variables_1.TagBadgeList[name_1]) {
  550. Names[i].innerHTML += " ".concat(tagbadgecode(variables_1.TagBadgeList[name_1][j].color, variables_1.TagBadgeList[name_1][j].text));
  551. }
  552. }
  553. }
  554. }
  555. exports.NameBadge = NameBadge;
  556.  
  557.  
  558. /***/ }),
  559.  
  560. /***/ 823:
  561. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  562.  
  563.  
  564. Object.defineProperty(exports, "__esModule", ({ value: true }));
  565. exports.downloadData = void 0;
  566. var utils_1 = __webpack_require__(593);
  567. function downloadData() {
  568. GM_addStyle(".partly-hidden {\n transition: opacity 125ms;\n}\n.partly-hidden:not(:hover) {\n opacity: 0;\n}");
  569. var tabcontent = document.querySelector('div.tab-content');
  570. if (tabcontent) {
  571. var navbar = document.createElement('div');
  572. tabcontent.before(navbar);
  573. navbar.setAttribute('style', 'border-bottom: 1px solid #dee2e6;');
  574. var statisticsButton = document.querySelector('div.uoj-content > a[role=button]');
  575. if (statisticsButton)
  576. navbar.appendChild(statisticsButton);
  577. var DownloadTag = document.createElement('a');
  578. navbar.appendChild(DownloadTag);
  579. DownloadTag.setAttribute('role', 'button');
  580. DownloadTag.setAttribute('class', 'btn btn-primary float-right partly-hidden');
  581. DownloadTag.setAttribute('href', '/download.php?type=problem&id=' + (0, utils_1.isProblem)()[1]);
  582. DownloadTag.setAttribute('target', '_blank');
  583. DownloadTag.innerHTML = '<span class="glyphicon glyphicon-download-alt"></span> 下载数据';
  584. var navtabs = document.querySelector('div.uoj-content > ul[role=tablist]');
  585. if (navtabs) {
  586. navbar.appendChild(navtabs);
  587. navtabs.setAttribute('style', 'border-bottom: none');
  588. var TJTag = document.createElement('li');
  589. navtabs.insertBefore(TJTag, null);
  590. TJTag.setAttribute('class', 'nav-item partly-hidden');
  591. var TJInnerTag = document.createElement('a');
  592. TJTag.appendChild(TJInnerTag);
  593. TJInnerTag.setAttribute('role', 'tab');
  594. TJInnerTag.setAttribute('class', 'nav-link');
  595. TJInnerTag.setAttribute('href', '/download.php?type=tj&id=' + (0, utils_1.isProblem)()[1]);
  596. TJInnerTag.innerHTML = '<span class="glyphicon glyphicon-book"></span> 题解';
  597. }
  598. }
  599. }
  600. exports.downloadData = downloadData;
  601.  
  602.  
  603. /***/ }),
  604.  
  605. /***/ 310:
  606. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  607.  
  608.  
  609. Object.defineProperty(exports, "__esModule", ({ value: true }));
  610. exports.Settings = void 0;
  611. var variables_1 = __webpack_require__(449);
  612. function Settings() {
  613. 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-popup .row * {\n margin-bottom: 0;\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}\n.switch {\n position: relative;\n vertical-align: middle;\n width: 60px;\n height: 28px;\n}\n.switch input {\n opacity: 0;\n width: 0;\n height: 0;\n}\n.settings-popup-active .slider {\n position: absolute;\n visibility: visible;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #ccc;\n transition: background-color .4s;\n transition: visiblility 0s;\n border-radius: 28px;\n}\n.settings-popup-active .slider:before {\n position: absolute;\n visibility: visible;\n content: \"\";\n height: 20px;\n width: 20px;\n left: 4px;\n bottom: 4px;\n background-color: white;\n transition: .4s;\n border-radius: 50%;\n}\ninput:checked + .slider {\n background-color: #28ADCA;\n}\ninput:checked + .slider:before {\n transform: translateX(32px);\n}");
  614. var HomepageEntrance = document.createElement('li');
  615. var NavBarTablist = document.querySelector('div[role=main] > div > ul[role=tablist]');
  616. NavBarTablist.insertBefore(HomepageEntrance, NavBarTablist.firstChild);
  617. HomepageEntrance.setAttribute('class', 'nav-item');
  618. 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>';
  619. HomepageEntrance.onclick = function () {
  620. document.body.setAttribute('class', 'settings-popup-active');
  621. };
  622. var SettingsOverlay = document.createElement('div');
  623. document.body.insertBefore(SettingsOverlay, document.body.firstChild);
  624. SettingsOverlay.setAttribute('class', 'settings-overlay');
  625. var SettingsPopup = document.createElement('div');
  626. SettingsOverlay.appendChild(SettingsPopup);
  627. SettingsPopup.setAttribute('class', 'settings-popup');
  628. var SettingsTitlebar = document.createElement('div');
  629. SettingsPopup.appendChild(SettingsTitlebar);
  630. SettingsTitlebar.setAttribute('class', 'row settings-titlebar');
  631. 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>';
  632. var SettingsCloseButton = document.createElement('span');
  633. SettingsPopup.appendChild(SettingsCloseButton);
  634. SettingsCloseButton.setAttribute('style', 'position: fixed;right: 20px;top:20px;cursor: pointer');
  635. SettingsCloseButton.setAttribute('onclick', 'document.body.setAttribute(\'class\', \'\');');
  636. SettingsCloseButton.innerHTML = '<h4><i class="fa fa-xmark"></i></h4>';
  637. var background = document.createElement('div');
  638. SettingsPopup.appendChild(background);
  639. background.setAttribute('class', 'row');
  640. var backgroundImageLabel = document.createElement('strong');
  641. background.appendChild(backgroundImageLabel);
  642. backgroundImageLabel.setAttribute('style', 'font-size: 1.25em');
  643. backgroundImageLabel.innerHTML = '背景图片&emsp;&emsp;&emsp;&emsp;';
  644. var backgroundImageInput = document.createElement('input');
  645. background.appendChild(backgroundImageInput);
  646. backgroundImageInput.setAttribute('style', 'flex-grow: 1; height: 2em; width: initial');
  647. backgroundImageInput.setAttribute('class', 'form-control');
  648. var siteIcon = document.createElement('div');
  649. SettingsPopup.appendChild(siteIcon);
  650. siteIcon.setAttribute('class', 'row');
  651. var siteIconImageLabel = document.createElement('strong');
  652. siteIcon.appendChild(siteIconImageLabel);
  653. siteIconImageLabel.setAttribute('style', 'font-size: 1.25em');
  654. siteIconImageLabel.innerHTML = '网站图标&emsp;&emsp;&emsp;&emsp;';
  655. var siteIconImageInput = document.createElement('input');
  656. siteIcon.appendChild(siteIconImageInput);
  657. siteIconImageInput.setAttribute('style', 'flex-grow: 1; height: 2em; width: initial');
  658. siteIconImageInput.setAttribute('class', 'form-control');
  659. var siteIconSmall = document.createElement('div');
  660. SettingsPopup.appendChild(siteIconSmall);
  661. siteIconSmall.setAttribute('class', 'row');
  662. var siteIconSmallImageLabel = document.createElement('strong');
  663. siteIconSmall.appendChild(siteIconSmallImageLabel);
  664. siteIconSmallImageLabel.setAttribute('style', 'font-size: 1.25em');
  665. siteIconSmallImageLabel.innerHTML = '网站图标(小)&emsp;';
  666. var siteIconSmallImageInput = document.createElement('input');
  667. siteIconSmall.appendChild(siteIconSmallImageInput);
  668. siteIconSmallImageInput.setAttribute('style', 'flex-grow: 1; height: 2em; width: initial');
  669. siteIconSmallImageInput.setAttribute('class', 'form-control');
  670. var Switchs = document.createElement('div');
  671. SettingsPopup.appendChild(Switchs);
  672. Switchs.setAttribute('class', 'row');
  673. var academic = document.createElement('div');
  674. Switchs.appendChild(academic);
  675. // academic.setAttribute('style', 'vertical-align: middle');
  676. var academicLabel = document.createElement('strong');
  677. academic.appendChild(academicLabel);
  678. academicLabel.setAttribute('style', 'font-size: 1.25em; vertical-align: middle;');
  679. academicLabel.innerHTML = '学术模式&emsp;&emsp;&emsp;&emsp;';
  680. var academicSwitch = document.createElement('label');
  681. academicSwitch.className = 'switch';
  682. academic.appendChild(academicSwitch);
  683. academicSwitch.innerHTML = '<input type="checkbox" id="AcademicSwitch" style="display: none;">\n<i id="AcademicSwitchIcon" class="slider"></i>';
  684. {
  685. var space = document.createElement('p');
  686. Switchs.appendChild(space);
  687. space.innerHTML = '&emsp;&emsp;&emsp;&emsp;';
  688. }
  689. var ligatures = document.createElement('div');
  690. Switchs.appendChild(ligatures);
  691. // academic.setAttribute('style', 'vertical-align: middle');
  692. var ligaturesLabel = document.createElement('strong');
  693. ligatures.appendChild(ligaturesLabel);
  694. ligaturesLabel.setAttribute('style', 'font-size: 1.25em; vertical-align: middle;');
  695. ligaturesLabel.innerHTML = '代码连字&emsp;&emsp;&emsp;&emsp;';
  696. var ligaturesSwitch = document.createElement('label');
  697. ligaturesSwitch.className = 'switch';
  698. ligatures.appendChild(ligaturesSwitch);
  699. ligaturesSwitch.innerHTML = '<input type="checkbox" id="LigaturesSwitch" style="display: none;">\n<i id="LigaturesSwitchIcon" class="slider"></i>';
  700. backgroundImageInput.value = variables_1.BackgroundImage;
  701. siteIconImageInput.value = variables_1.SiteIconImage;
  702. siteIconSmallImageInput.value = variables_1.SiteIconSmallImage;
  703. document.getElementById('AcademicSwitch').checked = variables_1.Academic;
  704. document.getElementById('LigaturesSwitch').checked = variables_1.Ligatures;
  705. var FooterRow = document.createElement('div');
  706. FooterRow.setAttribute('class', 'settings-footerbar');
  707. SettingsPopup.appendChild(FooterRow);
  708. var Ok = document.createElement('button');
  709. FooterRow.appendChild(Ok);
  710. Ok.setAttribute('class', 'btn btn-search btn-outline-primary float-right');
  711. Ok.innerHTML = '保存';
  712. Ok.onclick = function () {
  713. GM_setValue('BackgroundImage', backgroundImageInput.value);
  714. GM_setValue('SiteIconImage', siteIconImageInput.value);
  715. GM_setValue('SiteIconSmallImage', siteIconSmallImageInput.value);
  716. GM_setValue('Academic', document.getElementById('AcademicSwitch').checked);
  717. GM_setValue('Ligatures', document.getElementById('LigaturesSwitch').checked);
  718. location.reload();
  719. };
  720. var Clear = document.createElement('button');
  721. FooterRow.appendChild(Clear);
  722. Clear.setAttribute('class', 'btn btn-search btn-outline-primary float-right');
  723. Clear.innerHTML = '恢复默认';
  724. Clear.onclick = function () {
  725. var values = GM_listValues();
  726. for (var value in values) {
  727. GM_deleteValue(values[value]);
  728. }
  729. location.reload();
  730. };
  731. }
  732. exports.Settings = Settings;
  733.  
  734.  
  735. /***/ }),
  736.  
  737. /***/ 978:
  738. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  739.  
  740.  
  741. Object.defineProperty(exports, "__esModule", ({ value: true }));
  742. exports.Submission = void 0;
  743. var utils_1 = __webpack_require__(593);
  744. function SubmissionCrack() {
  745. GM_xmlhttpRequest({
  746. method: "GET",
  747. url: "https://ex124oj.pond.ink/api/submission/".concat((0, utils_1.isSubmission)()[1]),
  748. revalidate: true,
  749. onload: function (data) {
  750. if (data.status == 200) {
  751. SubmissionCard(JSON.parse(data.response));
  752. }
  753. else {
  754. SubmissionCard({});
  755. }
  756. }
  757. });
  758. }
  759. function SubmissionCard(data) {
  760. var _a;
  761. GM_addStyle("div.tab-content > div.tab-pane.card {\n border-top: none;\n border-top-right-radius: 0;\n border-top-left-radius: 0;\n}");
  762. var content = document.querySelector('div.uoj-content');
  763. if (content && content.children.length) {
  764. var TabList = document.createElement('ul');
  765. content.insertBefore(TabList, content.children[1]);
  766. TabList.setAttribute('class', 'nav nav-tabs');
  767. TabList.setAttribute('role', 'tablist');
  768. var TabContent = document.createElement('div');
  769. content.insertBefore(TabContent, content.children[2]);
  770. TabContent.setAttribute('class', 'tab-content');
  771. TabContent.style.marginBottom = '20px';
  772. var counter = 0, cardtitle = void 0;
  773. var flag = { answer: false, details: false };
  774. for (var i = 3; i < content.children.length; i++, counter++) {
  775. var classlist = content.children[i].getAttribute('class');
  776. if (classlist && classlist.includes('card')) {
  777. var isActive = !counter;
  778. var title = document.createElement('li');
  779. TabList.appendChild(title);
  780. title.setAttribute('class', 'nav-item');
  781. var titleText = (_a = content.children[i].querySelector('h4.card-title')) === null || _a === void 0 ? void 0 : _a.textContent;
  782. if (titleText) {
  783. cardtitle = titleText.charAt(0).toUpperCase() + titleText.slice(1);
  784. title.innerHTML = "<a class=\"nav-link".concat(isActive ? ' active' : '', "\" href=\"#card").concat(counter, "\" role=\"tab\" data-toggle=\"tab\" aria-selected=\"true\">").concat(cardtitle, "</a>");
  785. if (cardtitle == 'Answer') {
  786. flag.answer = true;
  787. }
  788. else if (cardtitle == '详细' || cardtitle == 'Details') {
  789. flag.details = true;
  790. }
  791. }
  792. var card = document.createElement('div');
  793. TabContent.appendChild(card);
  794. card.setAttribute('class', "tab-pane card".concat(isActive ? ' active' : ''));
  795. card.setAttribute('id', "card".concat(counter));
  796. var card_body = content.children[i].querySelector('div.card-body');
  797. if (cardtitle == 'Answer' && data.answer && data.answer.body) {
  798. card_body = document.createElement('div');
  799. card_body.classList.add('card-body');
  800. card_body.innerHTML = data.answer.body;
  801. }
  802. else if ((cardtitle == '详细' || cardtitle == 'Details') && data.details && data.details.body) {
  803. card_body = document.createElement('div');
  804. card_body.classList.add('card-body');
  805. card_body.innerHTML = data.details.body;
  806. }
  807. if (card_body) {
  808. card.appendChild(card_body);
  809. }
  810. var card_footer = content.children[i].querySelector('div.card-footer');
  811. if (card_footer) {
  812. card.appendChild(card_footer);
  813. }
  814. if (cardtitle == 'Answer' && data.answer && data.answer.footer) {
  815. card_footer.innerHTML = data.answer.footer;
  816. }
  817. content.removeChild(content.children[i]);
  818. i--;
  819. }
  820. }
  821. if (!flag.answer && data.answer) {
  822. var isActive = !counter;
  823. var title = document.createElement('li');
  824. TabList.appendChild(title);
  825. title.setAttribute('class', 'nav-item');
  826. title.innerHTML = "<a class=\"nav-link".concat(isActive ? ' active' : '', "\" href=\"#card").concat(counter, "\" role=\"tab\" data-toggle=\"tab\" aria-selected=\"true\">Answer</a>");
  827. var card = document.createElement('div');
  828. TabContent.appendChild(card);
  829. card.setAttribute('class', "tab-pane card".concat(isActive ? ' active' : ''));
  830. card.setAttribute('id', "card".concat(counter));
  831. if (data.answer.body) {
  832. var card_body = document.createElement('div');
  833. card_body.classList.add('card-body');
  834. card_body.innerHTML = data.answer.body;
  835. card.appendChild(card_body);
  836. }
  837. if (data.answer.footer) {
  838. var card_body = document.createElement('div');
  839. card_body.classList.add('card-footer');
  840. card_body.innerHTML = data.answer.footer;
  841. card.appendChild(card_body);
  842. }
  843. counter++;
  844. }
  845. if (!flag.details) {
  846. var isActive = !counter;
  847. var title = document.createElement('li');
  848. TabList.appendChild(title);
  849. title.setAttribute('class', 'nav-item');
  850. title.innerHTML = "<a class=\"nav-link".concat(isActive ? ' active' : '', "\" href=\"#card").concat(counter, "\" role=\"tab\" data-toggle=\"tab\" aria-selected=\"true\">\u8BE6\u7EC6</a>");
  851. var card = document.createElement('div');
  852. TabContent.appendChild(card);
  853. card.setAttribute('class', "tab-pane card".concat(isActive ? ' active' : ''));
  854. card.setAttribute('id', "card".concat(counter));
  855. if (data.details.body) {
  856. var card_body = document.createElement('div');
  857. card_body.classList.add('card-body');
  858. card_body.innerHTML = data.details.body;
  859. card.appendChild(card_body);
  860. }
  861. counter++;
  862. }
  863. sh_highlightDocument();
  864. }
  865. }
  866. function Submission() {
  867. SubmissionCrack();
  868. }
  869. exports.Submission = Submission;
  870.  
  871.  
  872. /***/ }),
  873.  
  874. /***/ 900:
  875. /***/ ((__unused_webpack_module, exports) => {
  876.  
  877.  
  878. Object.defineProperty(exports, "__esModule", ({ value: true }));
  879. exports.TableStyle = void 0;
  880. function TableStyle() {
  881. var Tables = document.getElementsByTagName('table');
  882. for (var table in Tables) {
  883. if (Tables[table].nodeType) {
  884. var parentNode = Tables[table].parentNode;
  885. var parentClass = parentNode.getAttribute('class');
  886. var classList = Tables[table].classList;
  887. if (parentClass !== 'legend' && classList.length === 0) {
  888. Tables[table].classList.add('table', 'table-bordered');
  889. }
  890. }
  891. }
  892. var ths = document.getElementsByTagName('th');
  893. for (var th in ths) {
  894. if (ths[th].nodeType && ths[th].getAttribute('align')) {
  895. ths[th].setAttribute('style', 'text-align:' + ths[th].getAttribute('align'));
  896. }
  897. }
  898. }
  899. exports.TableStyle = TableStyle;
  900.  
  901.  
  902. /***/ }),
  903.  
  904. /***/ 720:
  905. /***/ ((__unused_webpack_module, exports) => {
  906.  
  907.  
  908. Object.defineProperty(exports, "__esModule", ({ value: true }));
  909. exports.RandomProblem = void 0;
  910. function RandomProblem() {
  911. var SearchBox = document.getElementById('form-search-problem');
  912. if (SearchBox) {
  913. var RandomButton = document.createElement('div');
  914. RandomButton.setAttribute('class', 'input-group-append');
  915. RandomButton.innerHTML = '<button class="btn btn-search btn-outline-primary" style="height: calc(1.5em + 0.75rem + 2px);" onclick="randomProblem();">随机跳题</button>';
  916. var RandomScript = document.createElement('script');
  917. RandomScript.innerHTML =
  918. "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}";
  919. SearchBox.after(RandomButton);
  920. RandomButton.after(RandomScript);
  921. }
  922. }
  923. exports.RandomProblem = RandomProblem;
  924.  
  925.  
  926. /***/ }),
  927.  
  928. /***/ 593:
  929. /***/ ((__unused_webpack_module, exports) => {
  930.  
  931.  
  932. Object.defineProperty(exports, "__esModule", ({ value: true }));
  933. exports.isBlog = exports.isUserProfile = exports.isProblem = exports.isStandings = exports.isContests = exports.isSubmission = exports.isHomepage = void 0;
  934. var HomepageRegExp = /^http:\/\/124.221.194.184(\/)?(\?.*)?$/;
  935. function isHomepage() {
  936. return window.location.href.match(HomepageRegExp);
  937. }
  938. exports.isHomepage = isHomepage;
  939. var submissionRegExp = /^http:\/\/124.221.194.184\/submission\/(\d+)(\?.*)?$/;
  940. function isSubmission() {
  941. return window.location.href.match(submissionRegExp);
  942. }
  943. exports.isSubmission = isSubmission;
  944. var ContestsRegExp = /^http:\/\/124.221.194.184\/contests(\?.*)?$/;
  945. function isContests() {
  946. return window.location.href.match(ContestsRegExp);
  947. }
  948. exports.isContests = isContests;
  949. var StandingsRegExp = /^http:\/\/124.221.194.184\/contest\/(\d+)\/standings(\?.*)?$/;
  950. function isStandings() {
  951. return window.location.href.match(StandingsRegExp);
  952. }
  953. exports.isStandings = isStandings;
  954. var ProblemRegExp = /^http:\/\/124.221.194.184.*\/problem\/(\d+)(\?.*)?$/;
  955. function isProblem() {
  956. return window.location.href.match(ProblemRegExp);
  957. }
  958. exports.isProblem = isProblem;
  959. var UserProfileRegExp = /^http:\/\/124.221.194.184\/user\/profile\/.+(\?.*)?$/;
  960. function isUserProfile() {
  961. return window.location.href.match(UserProfileRegExp);
  962. }
  963. exports.isUserProfile = isUserProfile;
  964. var BlogRegExp = /^http:\/\/124.221.194.184\/blog\/.+(\?.*)?$/;
  965. function isBlog() {
  966. return window.location.href.match(BlogRegExp);
  967. }
  968. exports.isBlog = isBlog;
  969.  
  970.  
  971. /***/ }),
  972.  
  973. /***/ 449:
  974. /***/ ((__unused_webpack_module, exports) => {
  975.  
  976.  
  977. Object.defineProperty(exports, "__esModule", ({ value: true }));
  978. exports.getVariables = exports.TagBadgeList = exports.CCFBadgeList = exports.NameColorList = exports.Ligatures = exports.Academic = exports.SiteIconSmallImage = exports.SiteIconImage = exports.BackgroundImage = exports.version = void 0;
  979. exports.version = "1.0.12";
  980. function getRandomColorCode() {
  981. var letters = '0123456789ABCDEF';
  982. var colorCode = '#';
  983. for (var i = 0; i < 6; i++) {
  984. colorCode += letters[Math.floor(Math.random() * 16)];
  985. }
  986. return colorCode;
  987. }
  988. function getVariables(callback) {
  989. exports.BackgroundImage = GM_getValue('BackgroundImage', '');
  990. exports.SiteIconImage = GM_getValue('SiteIconImage', '');
  991. exports.SiteIconSmallImage = GM_getValue('SiteIconSmallImage', '');
  992. exports.Academic = GM_getValue('Academic', false);
  993. exports.Ligatures = GM_getValue('Ligatures', true);
  994. GM_xmlhttpRequest({
  995. method: "GET",
  996. url: "https://ex124oj.pond.ink/public/variables.json",
  997. revalidate: true,
  998. onload: function (data) {
  999. var variables = JSON.parse(data.response);
  1000. var randomcolor = getRandomColorCode();
  1001. exports.NameColorList = variables.NameColorList;
  1002. for (var i in exports.NameColorList) {
  1003. for (var j = 0; j < exports.NameColorList[i].length; j++) {
  1004. if (exports.NameColorList[i][j] == 'rand') {
  1005. exports.NameColorList[i][j] = randomcolor;
  1006. }
  1007. }
  1008. }
  1009. exports.CCFBadgeList = variables.CCFBadgeList;
  1010. for (var i in exports.CCFBadgeList) {
  1011. for (var j = 0; j < exports.CCFBadgeList[i].length; j++) {
  1012. if (exports.CCFBadgeList[i][j] == 'rand') {
  1013. exports.CCFBadgeList[i][j] = randomcolor;
  1014. }
  1015. }
  1016. }
  1017. exports.TagBadgeList = variables.TagBadgeList;
  1018. for (var i in exports.TagBadgeList) {
  1019. for (var j = 0; j < exports.TagBadgeList[i].length; j++) {
  1020. if (exports.TagBadgeList[i][j].color == 'rand') {
  1021. exports.TagBadgeList[i][j].color = randomcolor;
  1022. }
  1023. }
  1024. }
  1025. callback();
  1026. }
  1027. });
  1028. }
  1029. exports.getVariables = getVariables;
  1030.  
  1031.  
  1032. /***/ })
  1033.  
  1034. /******/ });
  1035. /************************************************************************/
  1036. /******/ // The module cache
  1037. /******/ var __webpack_module_cache__ = {};
  1038. /******/
  1039. /******/ // The require function
  1040. /******/ function __webpack_require__(moduleId) {
  1041. /******/ // Check if module is in cache
  1042. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  1043. /******/ if (cachedModule !== undefined) {
  1044. /******/ return cachedModule.exports;
  1045. /******/ }
  1046. /******/ // Create a new module (and put it into the cache)
  1047. /******/ var module = __webpack_module_cache__[moduleId] = {
  1048. /******/ // no module.id needed
  1049. /******/ // no module.loaded needed
  1050. /******/ exports: {}
  1051. /******/ };
  1052. /******/
  1053. /******/ // Execute the module function
  1054. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  1055. /******/
  1056. /******/ // Return the exports of the module
  1057. /******/ return module.exports;
  1058. /******/ }
  1059. /******/
  1060. /************************************************************************/
  1061. var __webpack_exports__ = {};
  1062. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  1063. (() => {
  1064. var exports = __webpack_exports__;
  1065. var __webpack_unused_export__;
  1066.  
  1067. /// <reference path="index.d.ts" />
  1068. __webpack_unused_export__ = ({ value: true });
  1069. var utils_1 = __webpack_require__(593);
  1070. var variables_1 = __webpack_require__(449);
  1071. var settings_1 = __webpack_require__(310);
  1072. var name_1 = __webpack_require__(819);
  1073. var fontawesome_1 = __webpack_require__(400);
  1074. var appearance_1 = __webpack_require__(690);
  1075. var discussion_1 = __webpack_require__(992);
  1076. var code_1 = __webpack_require__(480);
  1077. var table_1 = __webpack_require__(900);
  1078. var toolbar_1 = __webpack_require__(720);
  1079. var announcement_1 = __webpack_require__(579);
  1080. var submission_1 = __webpack_require__(978);
  1081. var contest_1 = __webpack_require__(103);
  1082. var problem_1 = __webpack_require__(823);
  1083. var gravatar_1 = __webpack_require__(18);
  1084. (function () {
  1085. 'use strict';
  1086. (0, variables_1.getVariables)(function () {
  1087. (0, settings_1.Settings)();
  1088. (0, name_1.NameColor)();
  1089. (0, name_1.NameBadge)();
  1090. });
  1091. (0, fontawesome_1.FontAwesome)();
  1092. (0, appearance_1.Background)();
  1093. (0, appearance_1.changeIcon)();
  1094. (0, discussion_1.DiscussionCard)();
  1095. (0, code_1.CodeBlock)();
  1096. (0, table_1.TableStyle)();
  1097. (0, toolbar_1.RandomProblem)();
  1098. if ((0, utils_1.isHomepage)())
  1099. (0, announcement_1.exAnnouncements)();
  1100. if ((0, utils_1.isSubmission)())
  1101. (0, submission_1.Submission)();
  1102. if ((0, utils_1.isContests)())
  1103. (0, contest_1.ContestsCard)();
  1104. if ((0, utils_1.isStandings)())
  1105. (0, contest_1.ContestStandings)();
  1106. if ((0, utils_1.isProblem)())
  1107. (0, problem_1.downloadData)();
  1108. if ((0, utils_1.isUserProfile)() || (0, utils_1.isBlog)())
  1109. (0, gravatar_1.changeGravatarURL)();
  1110. })();
  1111.  
  1112. })();
  1113.  
  1114. /******/ })()
  1115. ;