Ex124OJ

Extend 124OJ!

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

  1. // ==UserScript==
  2. // @name Ex124OJ
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.10
  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. line.children[j].style.backgroundColor = ({ 'rgba(0, 0, 0, 0)': 'rgb(255, 255, 255)', 'rgba(0, 0, 0, 0.05)': 'rgb(242.25, 242.25, 242.25)' })[window.getComputedStyle(lines[i]).backgroundColor] || 'rgb(255, 255, 255)';
  240. x = x + parseFloat(window.getComputedStyle(line.children[j]).width);
  241. }
  242. }
  243. }
  244. var ContestHomepage;
  245. function ProblemTitles() {
  246. var solve = function () {
  247. var lines = document.querySelectorAll('div#standings > div.table-responsive > table tr');
  248. var problems = {};
  249. var rows = ContestHomepage.querySelectorAll('table > tbody > tr');
  250. for (var i = 0; i < rows.length; i++) {
  251. if (rows[i].children.length >= 2) {
  252. var id = rows[i].children[0].textContent, title = rows[i].children[1].textContent;
  253. if (id && title) {
  254. problems[id] = "".concat(id, ". ").concat(title);
  255. }
  256. }
  257. }
  258. for (var i = 0; i < lines.length; i++) {
  259. var line = lines[i];
  260. for (var j = 3; j < line.children.length; j++) {
  261. var title = lines[0].children[j].querySelector('a');
  262. if (title && title.textContent && problems[title.textContent]) {
  263. line.children[j].title = problems[title.textContent];
  264. }
  265. }
  266. }
  267. };
  268. if (ContestHomepage) {
  269. solve();
  270. }
  271. else {
  272. GM_xmlhttpRequest({
  273. method: "GET",
  274. url: "/contest/".concat(contest_id),
  275. revalidate: true,
  276. onload: function (data) {
  277. ContestHomepage = (new DOMParser()).parseFromString(data.response, 'text/html');
  278. solve();
  279. }
  280. });
  281. }
  282. }
  283. var Problemchecked = [];
  284. function ShowStandings() {
  285. PinLineHeader();
  286. ProblemTitles();
  287. var headline = document.querySelector('div#standings > div.table-responsive > table tr');
  288. if (!headline) {
  289. return;
  290. }
  291. var sum = 0;
  292. var _loop_1 = function (i) {
  293. if (Problemchecked[i - 3]) {
  294. headline.children[i].classList.add('checked');
  295. sum++;
  296. }
  297. headline.children[i].addEventListener('click', function (event) {
  298. var target = event.target;
  299. if (target.tagName === 'A') {
  300. return;
  301. }
  302. Problemchecked[i - 3] = !Problemchecked[i - 3];
  303. displayStandings();
  304. });
  305. };
  306. for (var i = 3; i < headline.children.length; i++) {
  307. _loop_1(i);
  308. }
  309. if (sum == 0) {
  310. return;
  311. }
  312. var scores = document.querySelectorAll('div#standings > div.table-responsive > table > tbody > tr > td:nth-child(3) > div > span.uoj-score');
  313. for (var i = 0; i < scores.length; i++) {
  314. scores[i].style.color = getColOfScore(standings[i][0] / sum);
  315. }
  316. }
  317. function displayStandings(initial) {
  318. var standingsArea = document.querySelector('div#standings');
  319. if (!standingsArea) {
  320. return;
  321. }
  322. var lines = standingsArea.querySelectorAll('div.table-responsive > table tr');
  323. var headline = lines[0];
  324. var Problemsum = headline.children.length - 3;
  325. var Usersum = lines.length - 1;
  326. // let checked = false;
  327. // for (let i = 0; i < Problemsum; i++) {
  328. // checked = checked || Problemchecked[i];
  329. // }
  330. for (var i = 0; i < Usersum; i++) {
  331. var name_2 = standings[i][2][0];
  332. standings[i][0] = standings[i][1] = 0;
  333. for (var j = 0; j < Problemsum; j++) {
  334. if ((Problemchecked[j] /* || !checked*/) && score[name_2][j] !== undefined) {
  335. standings[i][0] += score[name_2][j][0], standings[i][1] += score[name_2][j][1];
  336. }
  337. }
  338. }
  339. standings.sort(function (a, b) {
  340. return a[0] != b[0] ? b[0] - a[0] : a[1] - b[1];
  341. });
  342. for (var i = 0; i < Usersum; i++) {
  343. if (!i || standings[i][0] != standings[i - 1][0] || standings[i][1] != standings[i - 1][1]) {
  344. standings[i][3] = i + 1;
  345. }
  346. else {
  347. standings[i][3] = standings[i - 1][3];
  348. }
  349. }
  350. var tableBefore = document.querySelector('div.table-responsive');
  351. if (tableBefore && tableBefore.children[0]) {
  352. var ScrollRight = parseInt(window.getComputedStyle(tableBefore.children[0]).width) - tableBefore.scrollLeft;
  353. showStandings();
  354. if (!initial) {
  355. (0, name_1.NameColor)(standingsArea);
  356. (0, name_1.NameBadge)(standingsArea);
  357. }
  358. ShowStandings();
  359. var tableAfter = document.querySelector('div.table-responsive');
  360. if (tableAfter && tableAfter.children[0]) {
  361. tableAfter.scrollLeft = parseInt(window.getComputedStyle(tableAfter.children[0]).width) - ScrollRight;
  362. }
  363. }
  364. }
  365. function NavBar(ProblemSum) {
  366. var navtabs = document.querySelector('div.uoj-content ul[role=tablist]');
  367. if (!navtabs) {
  368. return;
  369. }
  370. var navbar = document.createElement('div');
  371. navtabs.before(navbar);
  372. navbar.setAttribute('style', 'border-bottom: 1px solid #dee2e6;');
  373. var floatright = document.createElement('div');
  374. navbar.appendChild(floatright);
  375. floatright.setAttribute('class', 'float-right');
  376. var unselectall = document.createElement('a');
  377. floatright.appendChild(unselectall);
  378. unselectall.setAttribute('class', 'btn btn-info btn-sm');
  379. unselectall.setAttribute('target', '_blank');
  380. unselectall.style.color = '#fff';
  381. unselectall.style.cursor = 'pointer';
  382. unselectall.addEventListener('click', function () {
  383. Problemchecked = new Array(ProblemSum).fill(true);
  384. displayStandings();
  385. });
  386. unselectall.innerHTML = '全选';
  387. var selectall = document.createElement('a');
  388. floatright.appendChild(selectall);
  389. selectall.setAttribute('class', 'btn btn-primary btn-sm');
  390. selectall.setAttribute('target', '_blank');
  391. selectall.style.color = '#fff';
  392. selectall.style.cursor = 'pointer';
  393. selectall.addEventListener('click', function () {
  394. Problemchecked = new Array(ProblemSum).fill(false);
  395. displayStandings();
  396. });
  397. selectall.innerHTML = '全不选';
  398. navbar.appendChild(navtabs);
  399. navtabs.setAttribute('style', 'border-bottom: none');
  400. }
  401. function ContestStandings() {
  402. GM_addStyle("\ndiv#standings > div.table-responsive > table > thead > tr > th:nth-child(n+4) {\n cursor: pointer;\n}\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+3)::after {\n content: \"\";\n position: absolute;\n top: 100%;\n left: 0;\n width: 100%;\n height: 2px;\n background-color: #00cc00;\n}\ndiv#standings > div.table-responsive > table > thead > tr > th:nth-child(n+4).checked {\n border-bottom-color: #00cc00;\n}\n");
  403. var ProblemSum = document.querySelectorAll('div#standings > div.table-responsive > table > thead > tr > th').length - 3;
  404. Problemchecked = new Array(ProblemSum).fill(true);
  405. displayStandings(true);
  406. NavBar(ProblemSum);
  407. }
  408. exports.ContestStandings = ContestStandings;
  409.  
  410.  
  411. /***/ }),
  412.  
  413. /***/ 992:
  414. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  415.  
  416.  
  417. Object.defineProperty(exports, "__esModule", ({ value: true }));
  418. exports.DiscussionCard = void 0;
  419. var variables_1 = __webpack_require__(449);
  420. function DiscussionCard() {
  421. var footer = document.querySelector('div.uoj-footer');
  422. if (footer) {
  423. var discrd = document.createElement('div');
  424. discrd.setAttribute('class', 'giscus');
  425. footer.insertBefore(discrd, footer.firstChild);
  426. GM_addElement('script', {
  427. 'src': 'https://giscus.app/client.js',
  428. 'data-repo': 'Sukwants/Ex124OJ-discussions',
  429. 'data-repo-id': 'R_kgDOImiZLA',
  430. 'data-category': 'Ideas',
  431. 'data-category-id': 'DIC_kwDOImiZLM4CTCIj',
  432. 'data-mapping': 'pathname',
  433. 'data-strict': '0',
  434. 'data-reactions-enabled': '1',
  435. 'data-emit-metadata': '0',
  436. 'data-input-position': 'top',
  437. 'data-theme': 'light',
  438. 'data-lang': 'zh-CN',
  439. 'data-loading': 'lazy',
  440. 'crossorigin': 'anonymous',
  441. 'async': ''
  442. });
  443. GM_addStyle(".giscus {\n display: ".concat((variables_1.Academic == true ? 'none' : 'unset'), ";\n}\n.giscus-frame {\n margin-top: 20px;\n}"));
  444. }
  445. }
  446. exports.DiscussionCard = DiscussionCard;
  447.  
  448.  
  449. /***/ }),
  450.  
  451. /***/ 400:
  452. /***/ ((__unused_webpack_module, exports) => {
  453.  
  454.  
  455. Object.defineProperty(exports, "__esModule", ({ value: true }));
  456. exports.FontAwesome = void 0;
  457. function FontAwesome() {
  458. GM_addElement('link', {
  459. href: 'https://cdn.bootcdn.net/ajax/libs/font-awesome/6.2.1/css/fontawesome.css',
  460. rel: 'stylesheet'
  461. });
  462. GM_addElement('link', {
  463. href: 'https://cdn.bootcdn.net/ajax/libs/font-awesome/6.2.1/css/brands.css',
  464. rel: 'stylesheet'
  465. });
  466. GM_addElement('link', {
  467. href: 'https://cdn.bootcdn.net/ajax/libs/font-awesome/6.2.1/css/solid.css',
  468. rel: 'stylesheet'
  469. });
  470. }
  471. exports.FontAwesome = FontAwesome;
  472.  
  473.  
  474. /***/ }),
  475.  
  476. /***/ 18:
  477. /***/ ((__unused_webpack_module, exports) => {
  478.  
  479.  
  480. Object.defineProperty(exports, "__esModule", ({ value: true }));
  481. exports.changeGravatarURL = void 0;
  482. function changeGravatarURL() {
  483. var GravatarURLRegExp = /\/\/cn.gravatar.com\/avatar\/(.*)/;
  484. var Gravatars = document.querySelectorAll('img');
  485. for (var i in Gravatars) {
  486. if (Gravatars[i] && Gravatars[i].nodeType
  487. && GravatarURLRegExp.test(Gravatars[i].getAttribute('src'))
  488. && Gravatars[i].getAttribute('alt').toLowerCase().includes('avatar')) {
  489. Gravatars[i].setAttribute('src', '//cravatar.cn/avatar/' + Gravatars[i].getAttribute('src').match(GravatarURLRegExp)[1]);
  490. }
  491. }
  492. }
  493. exports.changeGravatarURL = changeGravatarURL;
  494.  
  495.  
  496. /***/ }),
  497.  
  498. /***/ 819:
  499. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  500.  
  501.  
  502. Object.defineProperty(exports, "__esModule", ({ value: true }));
  503. exports.NameBadge = exports.NameColor = void 0;
  504. var variables_1 = __webpack_require__(449);
  505. function NameColor(where) {
  506. if (!where) {
  507. where = document;
  508. }
  509. var Names = where.querySelectorAll('.uoj-username, .uoj-honor');
  510. for (var i in Names) {
  511. if (Names[i].innerHTML && variables_1.NameColorList[Names[i].innerHTML]) {
  512. Names[i].style.color = variables_1.NameColorList[Names[i].innerHTML][0];
  513. var resN = '';
  514. for (var char = 1; char < variables_1.NameColorList[Names[i].innerHTML].length; ++char) {
  515. resN = resN + "<font style=\"color:".concat(variables_1.NameColorList[Names[i].innerHTML][char], "\">").concat(Names[i].innerHTML.substring(char - 1, char), "</font>");
  516. }
  517. Names[i].innerHTML = resN + Names[i].innerHTML.substring(variables_1.NameColorList[Names[i].innerHTML].length - 1);
  518. }
  519. }
  520. }
  521. exports.NameColor = NameColor;
  522. function NameBadge(where) {
  523. var _a;
  524. if (!where) {
  525. where = document;
  526. }
  527. 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>"); };
  528. 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>"); };
  529. var Names = where.querySelectorAll('.uoj-username, .uoj-honor');
  530. for (var i in Names) {
  531. var name_1 = Names[i].textContent;
  532. if (!name_1 || ((_a = Names[i].parentElement) === null || _a === void 0 ? void 0 : _a.getAttribute('class')) == 'legendLabel')
  533. continue;
  534. if (variables_1.CCFBadgeList[name_1]) {
  535. for (var j in variables_1.CCFBadgeList[name_1]) {
  536. Names[i].innerHTML += " ".concat(ccfbadgecode(variables_1.CCFBadgeList[name_1][j]));
  537. }
  538. }
  539. if (variables_1.TagBadgeList[name_1]) {
  540. for (var j in variables_1.TagBadgeList[name_1]) {
  541. Names[i].innerHTML += " ".concat(tagbadgecode(variables_1.TagBadgeList[name_1][j].color, variables_1.TagBadgeList[name_1][j].text));
  542. }
  543. }
  544. }
  545. }
  546. exports.NameBadge = NameBadge;
  547.  
  548.  
  549. /***/ }),
  550.  
  551. /***/ 823:
  552. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  553.  
  554.  
  555. Object.defineProperty(exports, "__esModule", ({ value: true }));
  556. exports.downloadData = void 0;
  557. var utils_1 = __webpack_require__(593);
  558. function downloadData() {
  559. GM_addStyle(".partly-hidden {\n transition: opacity 125ms;\n}\n.partly-hidden:not(:hover) {\n opacity: 0;\n}");
  560. var tabcontent = document.querySelector('div.tab-content');
  561. if (tabcontent) {
  562. var navbar = document.createElement('div');
  563. tabcontent.before(navbar);
  564. navbar.setAttribute('style', 'border-bottom: 1px solid #dee2e6;');
  565. var statisticsButton = document.querySelector('div.uoj-content > a[role=button]');
  566. if (statisticsButton)
  567. navbar.appendChild(statisticsButton);
  568. var DownloadTag = document.createElement('a');
  569. navbar.appendChild(DownloadTag);
  570. DownloadTag.setAttribute('role', 'button');
  571. DownloadTag.setAttribute('class', 'btn btn-primary float-right partly-hidden');
  572. DownloadTag.setAttribute('href', '/download.php?type=problem&id=' + (0, utils_1.isProblem)()[1]);
  573. DownloadTag.setAttribute('target', '_blank');
  574. DownloadTag.innerHTML = '<span class="glyphicon glyphicon-download-alt"></span> 下载数据';
  575. var navtabs = document.querySelector('div.uoj-content > ul[role=tablist]');
  576. if (navtabs) {
  577. navbar.appendChild(navtabs);
  578. navtabs.setAttribute('style', 'border-bottom: none');
  579. var TJTag = document.createElement('li');
  580. navtabs.insertBefore(TJTag, null);
  581. TJTag.setAttribute('class', 'nav-item partly-hidden');
  582. var TJInnerTag = document.createElement('a');
  583. TJTag.appendChild(TJInnerTag);
  584. TJInnerTag.setAttribute('role', 'tab');
  585. TJInnerTag.setAttribute('class', 'nav-link');
  586. TJInnerTag.setAttribute('href', '/download.php?type=tj&id=' + (0, utils_1.isProblem)()[1]);
  587. TJInnerTag.innerHTML = '<span class="glyphicon glyphicon-book"></span> 题解';
  588. }
  589. }
  590. }
  591. exports.downloadData = downloadData;
  592.  
  593.  
  594. /***/ }),
  595.  
  596. /***/ 310:
  597. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  598.  
  599.  
  600. Object.defineProperty(exports, "__esModule", ({ value: true }));
  601. exports.Settings = void 0;
  602. var variables_1 = __webpack_require__(449);
  603. function Settings() {
  604. 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}");
  605. var HomepageEntrance = document.createElement('li');
  606. var NavBarTablist = document.querySelector('div[role=main] > div > ul[role=tablist]');
  607. NavBarTablist.insertBefore(HomepageEntrance, NavBarTablist.firstChild);
  608. HomepageEntrance.setAttribute('class', 'nav-item');
  609. 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>';
  610. HomepageEntrance.onclick = function () {
  611. document.body.setAttribute('class', 'settings-popup-active');
  612. };
  613. var SettingsOverlay = document.createElement('div');
  614. document.body.insertBefore(SettingsOverlay, document.body.firstChild);
  615. SettingsOverlay.setAttribute('class', 'settings-overlay');
  616. var SettingsPopup = document.createElement('div');
  617. SettingsOverlay.appendChild(SettingsPopup);
  618. SettingsPopup.setAttribute('class', 'settings-popup');
  619. var SettingsTitlebar = document.createElement('div');
  620. SettingsPopup.appendChild(SettingsTitlebar);
  621. SettingsTitlebar.setAttribute('class', 'row settings-titlebar');
  622. 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>';
  623. var SettingsCloseButton = document.createElement('span');
  624. SettingsPopup.appendChild(SettingsCloseButton);
  625. SettingsCloseButton.setAttribute('style', 'position: fixed;right: 20px;top:20px;cursor: pointer');
  626. SettingsCloseButton.setAttribute('onclick', 'document.body.setAttribute(\'class\', \'\');');
  627. SettingsCloseButton.innerHTML = '<h4><i class="fa fa-xmark"></i></h4>';
  628. var background = document.createElement('div');
  629. SettingsPopup.appendChild(background);
  630. background.setAttribute('class', 'row');
  631. var backgroundImageLabel = document.createElement('strong');
  632. background.appendChild(backgroundImageLabel);
  633. backgroundImageLabel.setAttribute('style', 'font-size: 1.25em');
  634. backgroundImageLabel.innerHTML = '背景图片&emsp;&emsp;&emsp;&emsp;';
  635. var backgroundImageInput = document.createElement('input');
  636. background.appendChild(backgroundImageInput);
  637. backgroundImageInput.setAttribute('style', 'flex-grow: 1; height: 2em; width: initial');
  638. backgroundImageInput.setAttribute('class', 'form-control');
  639. var siteIcon = document.createElement('div');
  640. SettingsPopup.appendChild(siteIcon);
  641. siteIcon.setAttribute('class', 'row');
  642. var siteIconImageLabel = document.createElement('strong');
  643. siteIcon.appendChild(siteIconImageLabel);
  644. siteIconImageLabel.setAttribute('style', 'font-size: 1.25em');
  645. siteIconImageLabel.innerHTML = '网站图标&emsp;&emsp;&emsp;&emsp;';
  646. var siteIconImageInput = document.createElement('input');
  647. siteIcon.appendChild(siteIconImageInput);
  648. siteIconImageInput.setAttribute('style', 'flex-grow: 1; height: 2em; width: initial');
  649. siteIconImageInput.setAttribute('class', 'form-control');
  650. var siteIconSmall = document.createElement('div');
  651. SettingsPopup.appendChild(siteIconSmall);
  652. siteIconSmall.setAttribute('class', 'row');
  653. var siteIconSmallImageLabel = document.createElement('strong');
  654. siteIconSmall.appendChild(siteIconSmallImageLabel);
  655. siteIconSmallImageLabel.setAttribute('style', 'font-size: 1.25em');
  656. siteIconSmallImageLabel.innerHTML = '网站图标(小)&emsp;';
  657. var siteIconSmallImageInput = document.createElement('input');
  658. siteIconSmall.appendChild(siteIconSmallImageInput);
  659. siteIconSmallImageInput.setAttribute('style', 'flex-grow: 1; height: 2em; width: initial');
  660. siteIconSmallImageInput.setAttribute('class', 'form-control');
  661. var Switchs = document.createElement('div');
  662. SettingsPopup.appendChild(Switchs);
  663. Switchs.setAttribute('class', 'row');
  664. var academic = document.createElement('div');
  665. Switchs.appendChild(academic);
  666. // academic.setAttribute('style', 'vertical-align: middle');
  667. var academicLabel = document.createElement('strong');
  668. academic.appendChild(academicLabel);
  669. academicLabel.setAttribute('style', 'font-size: 1.25em; vertical-align: middle;');
  670. academicLabel.innerHTML = '学术模式&emsp;&emsp;&emsp;&emsp;';
  671. var academicSwitch = document.createElement('label');
  672. academicSwitch.className = 'switch';
  673. academic.appendChild(academicSwitch);
  674. academicSwitch.innerHTML = '<input type="checkbox" id="AcademicSwitch" style="display: none;">\n<i id="AcademicSwitchIcon" class="slider"></i>';
  675. {
  676. var space = document.createElement('p');
  677. Switchs.appendChild(space);
  678. space.innerHTML = '&emsp;&emsp;&emsp;&emsp;';
  679. }
  680. var ligatures = document.createElement('div');
  681. Switchs.appendChild(ligatures);
  682. // academic.setAttribute('style', 'vertical-align: middle');
  683. var ligaturesLabel = document.createElement('strong');
  684. ligatures.appendChild(ligaturesLabel);
  685. ligaturesLabel.setAttribute('style', 'font-size: 1.25em; vertical-align: middle;');
  686. ligaturesLabel.innerHTML = '代码连字&emsp;&emsp;&emsp;&emsp;';
  687. var ligaturesSwitch = document.createElement('label');
  688. ligaturesSwitch.className = 'switch';
  689. ligatures.appendChild(ligaturesSwitch);
  690. ligaturesSwitch.innerHTML = '<input type="checkbox" id="LigaturesSwitch" style="display: none;">\n<i id="LigaturesSwitchIcon" class="slider"></i>';
  691. backgroundImageInput.value = variables_1.BackgroundImage;
  692. siteIconImageInput.value = variables_1.SiteIconImage;
  693. siteIconSmallImageInput.value = variables_1.SiteIconSmallImage;
  694. document.getElementById('AcademicSwitch').checked = variables_1.Academic;
  695. document.getElementById('LigaturesSwitch').checked = variables_1.Ligatures;
  696. var FooterRow = document.createElement('div');
  697. FooterRow.setAttribute('class', 'settings-footerbar');
  698. SettingsPopup.appendChild(FooterRow);
  699. var Ok = document.createElement('button');
  700. FooterRow.appendChild(Ok);
  701. Ok.setAttribute('class', 'btn btn-search btn-outline-primary float-right');
  702. Ok.innerHTML = '保存';
  703. Ok.onclick = function () {
  704. GM_setValue('BackgroundImage', backgroundImageInput.value);
  705. GM_setValue('SiteIconImage', siteIconImageInput.value);
  706. GM_setValue('SiteIconSmallImage', siteIconSmallImageInput.value);
  707. GM_setValue('Academic', document.getElementById('AcademicSwitch').checked);
  708. GM_setValue('Ligatures', document.getElementById('LigaturesSwitch').checked);
  709. location.reload();
  710. };
  711. var Clear = document.createElement('button');
  712. FooterRow.appendChild(Clear);
  713. Clear.setAttribute('class', 'btn btn-search btn-outline-primary float-right');
  714. Clear.innerHTML = '恢复默认';
  715. Clear.onclick = function () {
  716. var values = GM_listValues();
  717. for (var value in values) {
  718. GM_deleteValue(values[value]);
  719. }
  720. location.reload();
  721. };
  722. }
  723. exports.Settings = Settings;
  724.  
  725.  
  726. /***/ }),
  727.  
  728. /***/ 978:
  729. /***/ ((__unused_webpack_module, exports) => {
  730.  
  731.  
  732. Object.defineProperty(exports, "__esModule", ({ value: true }));
  733. exports.SubmissionCard = void 0;
  734. function SubmissionCard() {
  735. var _a;
  736. 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}");
  737. var content = document.querySelector('div.uoj-content');
  738. if (content && content.children.length > 1) {
  739. var TabList = document.createElement('ul');
  740. content.insertBefore(TabList, content.children[1]);
  741. TabList.setAttribute('class', 'nav nav-tabs');
  742. TabList.setAttribute('role', 'tablist');
  743. var TabContent = document.createElement('div');
  744. content.insertBefore(TabContent, content.children[2]);
  745. TabContent.setAttribute('class', 'tab-content');
  746. TabContent.style.marginBottom = '20px';
  747. var counter = 0;
  748. for (var i = 3; i < content.children.length; i++, counter++) {
  749. var classlist = content.children[i].getAttribute('class');
  750. if (classlist && classlist.includes('card')) {
  751. var isActive = !counter;
  752. var title = document.createElement('li');
  753. TabList.appendChild(title);
  754. title.setAttribute('class', 'nav-item');
  755. var titleText = (_a = content.children[i].querySelector('h4.card-title')) === null || _a === void 0 ? void 0 : _a.textContent;
  756. if (titleText) {
  757. titleText = titleText.charAt(0).toUpperCase() + titleText.slice(1);
  758. title.innerHTML = "<a class=\"nav-link".concat(isActive ? ' active' : '', "\" href=\"#card").concat(counter, "\" role=\"tab\" data-toggle=\"tab\" aria-selected=\"true\">").concat(titleText, "</a>");
  759. }
  760. var card = document.createElement('div');
  761. TabContent.appendChild(card);
  762. card.setAttribute('class', "tab-pane card".concat(isActive ? ' active' : ''));
  763. card.setAttribute('id', "card".concat(counter));
  764. var card_body = content.children[i].querySelector('div.card-body');
  765. if (card_body)
  766. card.appendChild(card_body);
  767. var card_footer = content.children[i].querySelector('div.card-footer');
  768. if (card_footer)
  769. card.appendChild(card_footer);
  770. content.removeChild(content.children[i]);
  771. i--;
  772. }
  773. }
  774. }
  775. }
  776. exports.SubmissionCard = SubmissionCard;
  777.  
  778.  
  779. /***/ }),
  780.  
  781. /***/ 900:
  782. /***/ ((__unused_webpack_module, exports) => {
  783.  
  784.  
  785. Object.defineProperty(exports, "__esModule", ({ value: true }));
  786. exports.TableStyle = void 0;
  787. function TableStyle() {
  788. var Tables = document.getElementsByTagName('table');
  789. for (var table in Tables) {
  790. if (Tables[table].nodeType) {
  791. var parentNode = Tables[table].parentNode;
  792. var parentClass = parentNode.getAttribute('class');
  793. var classList = Tables[table].classList;
  794. if (parentClass !== 'legend' && classList.length === 0) {
  795. Tables[table].classList.add('table', 'table-bordered');
  796. }
  797. }
  798. }
  799. var ths = document.getElementsByTagName('th');
  800. for (var th in ths) {
  801. if (ths[th].nodeType && ths[th].getAttribute('align')) {
  802. ths[th].setAttribute('style', 'text-align:' + ths[th].getAttribute('align'));
  803. }
  804. }
  805. }
  806. exports.TableStyle = TableStyle;
  807.  
  808.  
  809. /***/ }),
  810.  
  811. /***/ 720:
  812. /***/ ((__unused_webpack_module, exports) => {
  813.  
  814.  
  815. Object.defineProperty(exports, "__esModule", ({ value: true }));
  816. exports.RandomProblem = void 0;
  817. function RandomProblem() {
  818. var SearchBox = document.getElementById('form-search-problem');
  819. if (SearchBox) {
  820. var RandomButton = document.createElement('div');
  821. RandomButton.setAttribute('class', 'input-group-append');
  822. RandomButton.innerHTML = '<button class="btn btn-search btn-outline-primary" style="height: calc(1.5em + 0.75rem + 2px);" onclick="randomProblem();">随机跳题</button>';
  823. var RandomScript = document.createElement('script');
  824. RandomScript.innerHTML =
  825. "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}";
  826. SearchBox.after(RandomButton);
  827. RandomButton.after(RandomScript);
  828. }
  829. }
  830. exports.RandomProblem = RandomProblem;
  831.  
  832.  
  833. /***/ }),
  834.  
  835. /***/ 593:
  836. /***/ ((__unused_webpack_module, exports) => {
  837.  
  838.  
  839. Object.defineProperty(exports, "__esModule", ({ value: true }));
  840. exports.isBlog = exports.isUserProfile = exports.isProblem = exports.isStandings = exports.isContests = exports.isSubmission = exports.isHomepage = void 0;
  841. var HomepageRegExp = /^http:\/\/124.221.194.184(\/)?(\?.*)?$/;
  842. function isHomepage() {
  843. return window.location.href.match(HomepageRegExp);
  844. }
  845. exports.isHomepage = isHomepage;
  846. var submissionRegExp = /^http:\/\/124.221.194.184\/submission\/\d+(\?.*)?$/;
  847. function isSubmission() {
  848. return window.location.href.match(submissionRegExp);
  849. }
  850. exports.isSubmission = isSubmission;
  851. var ContestsRegExp = /^http:\/\/124.221.194.184\/contests(\/)?(\?.*)?$/;
  852. function isContests() {
  853. return window.location.href.match(ContestsRegExp);
  854. }
  855. exports.isContests = isContests;
  856. var StandingsRegExp = /^http:\/\/124.221.194.184\/contest\/(\d+)\/standings(\/)?(\?.*)?$/;
  857. function isStandings() {
  858. return window.location.href.match(StandingsRegExp);
  859. }
  860. exports.isStandings = isStandings;
  861. var ProblemRegExp = /^http:\/\/124.221.194.184.*\/problem\/(\d+)(\?.*)?$/;
  862. function isProblem() {
  863. return window.location.href.match(ProblemRegExp);
  864. }
  865. exports.isProblem = isProblem;
  866. var UserProfileRegExp = /^http:\/\/124.221.194.184\/user\/profile\/.+(\?.*)?$/;
  867. function isUserProfile() {
  868. return window.location.href.match(UserProfileRegExp);
  869. }
  870. exports.isUserProfile = isUserProfile;
  871. var BlogRegExp = /^http:\/\/124.221.194.184\/blog\/.+(\?.*)?$/;
  872. function isBlog() {
  873. return window.location.href.match(BlogRegExp);
  874. }
  875. exports.isBlog = isBlog;
  876.  
  877.  
  878. /***/ }),
  879.  
  880. /***/ 449:
  881. /***/ ((__unused_webpack_module, exports) => {
  882.  
  883.  
  884. Object.defineProperty(exports, "__esModule", ({ value: true }));
  885. exports.getVariables = exports.TagBadgeList = exports.CCFBadgeList = exports.NameColorList = exports.Ligatures = exports.Academic = exports.SiteIconSmallImage = exports.SiteIconImage = exports.BackgroundImage = exports.version = void 0;
  886. exports.version = "1.0.10";
  887. function getRandomColorCode() {
  888. var letters = '0123456789ABCDEF';
  889. var colorCode = '#';
  890. for (var i = 0; i < 6; i++) {
  891. colorCode += letters[Math.floor(Math.random() * 16)];
  892. }
  893. return colorCode;
  894. }
  895. function getVariables(callback) {
  896. exports.BackgroundImage = GM_getValue('BackgroundImage', '');
  897. exports.SiteIconImage = GM_getValue('SiteIconImage', '');
  898. exports.SiteIconSmallImage = GM_getValue('SiteIconSmallImage', '');
  899. exports.Academic = GM_getValue('Academic', false);
  900. exports.Ligatures = GM_getValue('Ligatures', true);
  901. GM_xmlhttpRequest({
  902. method: "GET",
  903. url: "https://ex124oj.pond.ink/public/variables.json",
  904. revalidate: true,
  905. onload: function (data) {
  906. var variables = JSON.parse(data.response);
  907. var randomcolor = getRandomColorCode();
  908. exports.NameColorList = variables.NameColorList;
  909. for (var i in exports.NameColorList) {
  910. for (var j = 0; j < exports.NameColorList[i].length; j++) {
  911. if (exports.NameColorList[i][j] == 'rand') {
  912. exports.NameColorList[i][j] = randomcolor;
  913. }
  914. }
  915. }
  916. exports.CCFBadgeList = variables.CCFBadgeList;
  917. for (var i in exports.CCFBadgeList) {
  918. for (var j = 0; j < exports.CCFBadgeList[i].length; j++) {
  919. if (exports.CCFBadgeList[i][j] == 'rand') {
  920. exports.CCFBadgeList[i][j] = randomcolor;
  921. }
  922. }
  923. }
  924. exports.TagBadgeList = variables.TagBadgeList;
  925. for (var i in exports.TagBadgeList) {
  926. for (var j = 0; j < exports.TagBadgeList[i].length; j++) {
  927. if (exports.TagBadgeList[i][j].color == 'rand') {
  928. exports.TagBadgeList[i][j].color = randomcolor;
  929. }
  930. }
  931. }
  932. callback();
  933. }
  934. });
  935. }
  936. exports.getVariables = getVariables;
  937.  
  938.  
  939. /***/ })
  940.  
  941. /******/ });
  942. /************************************************************************/
  943. /******/ // The module cache
  944. /******/ var __webpack_module_cache__ = {};
  945. /******/
  946. /******/ // The require function
  947. /******/ function __webpack_require__(moduleId) {
  948. /******/ // Check if module is in cache
  949. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  950. /******/ if (cachedModule !== undefined) {
  951. /******/ return cachedModule.exports;
  952. /******/ }
  953. /******/ // Create a new module (and put it into the cache)
  954. /******/ var module = __webpack_module_cache__[moduleId] = {
  955. /******/ // no module.id needed
  956. /******/ // no module.loaded needed
  957. /******/ exports: {}
  958. /******/ };
  959. /******/
  960. /******/ // Execute the module function
  961. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  962. /******/
  963. /******/ // Return the exports of the module
  964. /******/ return module.exports;
  965. /******/ }
  966. /******/
  967. /************************************************************************/
  968. var __webpack_exports__ = {};
  969. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  970. (() => {
  971. var exports = __webpack_exports__;
  972. var __webpack_unused_export__;
  973.  
  974. /// <reference path="index.d.ts" />
  975. __webpack_unused_export__ = ({ value: true });
  976. var utils_1 = __webpack_require__(593);
  977. var variables_1 = __webpack_require__(449);
  978. var settings_1 = __webpack_require__(310);
  979. var name_1 = __webpack_require__(819);
  980. var fontawesome_1 = __webpack_require__(400);
  981. var appearance_1 = __webpack_require__(690);
  982. var discussion_1 = __webpack_require__(992);
  983. var contest_1 = __webpack_require__(103);
  984. var code_1 = __webpack_require__(480);
  985. var table_1 = __webpack_require__(900);
  986. var toolbar_1 = __webpack_require__(720);
  987. var announcement_1 = __webpack_require__(579);
  988. var submission_1 = __webpack_require__(978);
  989. var problem_1 = __webpack_require__(823);
  990. var gravatar_1 = __webpack_require__(18);
  991. (function () {
  992. 'use strict';
  993. (0, variables_1.getVariables)(function () {
  994. (0, settings_1.Settings)();
  995. (0, name_1.NameColor)();
  996. (0, name_1.NameBadge)();
  997. });
  998. (0, fontawesome_1.FontAwesome)();
  999. (0, appearance_1.Background)();
  1000. (0, appearance_1.changeIcon)();
  1001. (0, discussion_1.DiscussionCard)();
  1002. (0, code_1.CodeBlock)();
  1003. (0, table_1.TableStyle)();
  1004. (0, toolbar_1.RandomProblem)();
  1005. if ((0, utils_1.isHomepage)())
  1006. (0, announcement_1.exAnnouncements)();
  1007. if ((0, utils_1.isSubmission)())
  1008. (0, submission_1.SubmissionCard)();
  1009. if ((0, utils_1.isContests)())
  1010. (0, contest_1.ContestsCard)();
  1011. if ((0, utils_1.isStandings)())
  1012. (0, contest_1.ContestStandings)();
  1013. if ((0, utils_1.isProblem)())
  1014. (0, problem_1.downloadData)();
  1015. if ((0, utils_1.isUserProfile)() || (0, utils_1.isBlog)())
  1016. (0, gravatar_1.changeGravatarURL)();
  1017. })();
  1018.  
  1019. })();
  1020.  
  1021. /******/ })()
  1022. ;