ex124OJ

Extend 124OJ!

当前为 2022-12-02 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name ex124OJ
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.6.1
  5. // @description Extend 124OJ!
  6. // @author Sukwants
  7. // @license MIT
  8. // @match http://124.221.194.184
  9. // @match http://124.221.194.184/*
  10. // @icon https://www.imageoss.com/images/2022/11/29/ex124OJba563861978a769d.png
  11. // @grant GM_addStyle
  12. // ==/UserScript==
  13.  
  14.  
  15. /* ==User Settings== */
  16.  
  17. // Special Period
  18. const WhenMourn = true;
  19. // Change Page Background. (Image URL, Opacity)
  20. const BackgroundSettings = [];
  21. // Change Site Icon. (Image URL)
  22. const SiteIconImage = 'https://www.imageoss.com/images/2022/11/29/ex124OJba563861978a769d.png';
  23. // Change username color.
  24. const NameColorList = {'Sukwants':['#8e44ad'],'Star32':['#e74c3c'],'2745518585':['#996600'],'syysongyuyang':['#e67e22'],'zsq147258369':['#52c41a'],'zhouchuan':['#e74c3c','#000000']};
  25. // Add CCF level badge.
  26. const CCFBadgeList = {'zsq147258369':'#52c41a'};
  27. // Add name tag badge.
  28. const TagBadgeList = {'Sukwants':['#8e44ad','旅客'],'Star32':['#e74c3c','陌生人'],'2745518585':['#996600','作弊者'],'syysongyuyang':['#e67e22','原批'],'zsq147258369':['#52c41a','boring'],'zhouchuan':['#e74c3c','Feyn']};
  29.  
  30.  
  31. const HomepageRegExp = /^http:\/\/124.221.194.184(\/){0,1}(\?.*){0,1}$/;
  32. function isHomepage() {
  33. return HomepageRegExp.test(window.location.href);
  34. }
  35. const submissionRegExp = /^http:\/\/124.221.194.184\/submission\/\d{1,}/;
  36. function isSubmission() {
  37. return submissionRegExp.test(window.location.href);
  38. }
  39. const ProblemRegExp = /^http:\/\/124.221.194.184.*\/problem\/(\d{1,})(\?.*){0,1}$/;
  40. function isProblem() {
  41. return ProblemRegExp.test(window.location.href);
  42. }
  43. const UserProfileRegExp = /^http:\/\/124.221.194.184\/user\/profile\/.{1,}/;
  44. function isUserProfile() {
  45. return UserProfileRegExp.test(window.location.href);
  46. }
  47. const BlogRegExp = /^http:\/\/124.221.194.184\/blog\/.{1,}/;
  48. function isBlog() {
  49. return BlogRegExp.test(window.location.href);
  50. }
  51.  
  52. function whenMourn() {
  53. if (WhenMourn && isHomepage()) {
  54. GM_addStyle('\
  55. html {\
  56. -webkit-filter: grayscale(100%);\
  57. -moz-filter: grayscale(100%);\
  58. -ms-filter: grayscale(100%);\
  59. -o-filter: grayscale(100%);\
  60. filter: grayscale(100%);\
  61. filter: gray;\
  62. }');
  63. }
  64. }
  65.  
  66. const TrollingArticle = ['巨大的灰色乌云笼罩在灰色的、各式各样的建筑之上,炫目的LED灯管被竖直放置于C市的各个角落。深灰的马路上粉刷着浅灰的虚线和实线,引导着川流不息、来来往往的车辆与人群。\n\
  67. C市的一天,便这样开始了。',
  68. '2050年,地球环境进一步恶化,人类生存资源濒临枯竭,即使科技再高速发展也无济于事。但此时,人类的基因已经完全破译,每个区段每一对碱基对控制着什么形状早已能够被识别、控制与修改。为了维护社会秩序,掌管C市的P党在该技术萌芽时便花重金将专利从相关公司手中买下,垄断了这一技术。所以,这达成了P党内部核心人员一个心照不宣的秘密。',
  69. '15年前。巨大的双链DNA模型在房间内投影出来,右旋的优美轮廓让在场的所有科学家都赞叹不已。喧哗声中,一个人走上演讲台,调试好麦克风,开始了它的发言。\n\
  70. “大家好。正如大家所知,人的眼睛是根据所看见光的波长来识别颜色的,而可见光谱中的大部分颜色可以由三种基本色光红、绿、蓝按不同比例混合而成,形成了连续的可视光谱。人类肉眼能区分其中的几百万至一千万种。经过十余年的研究,我们发现人类基因中关于色彩识别的区段较为冗长;为降低生活成本,我代表P党在此宣布自今年1100:00起将C市所有居民基因中的色彩识别区段删除,仅保留黑白两种基本色光。同时,相关政策也将陆续实施,感谢各位的理解与支持。”\n\
  71. ……',
  72. '20341231日,23:58。此时,C市的广大人民群众还不知道他们即将面临什么,有的已早早入睡,有的还在五彩斑斓的繁华都市中享受着绚烂多彩的生活。市中心高楼上的始终嘀嗒,分针逐渐指向了12的正下方。\n\
  73. 00:00\n\
  74. 所有还醒着的人们的记忆模块被完全刷新。\n\
  75. “这是一个非黑即白的世界。”\n\
  76. “灰色由不同比例的黑白色组成,是最常见的一种颜色。”\n\
  77. “自古以来便是这样。”\n\
  78. 所以,这场历史性的革命在悄无声息中圆满完成了。没有骚动,没有恐慌。',
  79. '与此同时,电子课本、电子词典被同步刷新。颜料标签被迅速替换。文字与影像资料被大幅度删改,相关学科被取消。红、黄、绿灯依次换为圆形、方形、三角形灯。颜色引导标识改为黑白点线面组合引导标识。\n\
  80. ……\n\
  81. 一切的一切,归零。\n\
  82. 生活照常。',
  83. '2030年,C市成为E国少数几个未通过《全可视区段色彩使用法案》的国家。P党声称此法案与C市传统颜色阶级制度价值观不符,不利于人口增长,可能引发社会混乱。此前,C市已出现多次因争取全区段可视色彩使用权而导致舆论风波的现象,重重封锁也无济于事。同时,其声称外部势力也在对C市青少年以各种潜移默化的方式渗透色彩多元化共存理论,造成了巨大影响。为了彻底解决这一问题,P党最后做出了取消色彩可视化这一决定,才有了这场看似荒谬的颜色革命。',
  84. '雨后,晴空。天边罕见地出现了一道彩虹,只是再也无法被C市的孩子们看见了。但他们还从课本上了解过这一自然景观,它被称为“灰虹”,天空中呈现了七种不同深浅的黑白色条带,蔚为壮观。\n\
  85. 小朋友们发出天真无邪的笑声,在浅灰的草坪上和父母一起欣赏美丽的灰虹。\n\
  86. 风也轻轻。\n\
  87. ……',
  88. '但那无法被看见色彩的彩虹,它还存在着啊。幸好,C市的科学还没有发展到能将彩虹粉刷为黑白的地步,幸好,它改变的只是我们人类本身。不论你是否承认彩虹的赤橙黄绿青蓝紫,它都存在着,从古至今。只是对C市的人来说,看不见了罢。\n\
  89. 带着无色的双眼去看待这个世界,世界当然是没有颜色的啊。',
  90. '或许会问,为什么那些所谓的“外部势力”没有到C市来宣传呢?\n\
  91. 因为C市早已故步自封了呢。C市早已在城郊筑好了高墙,外部势力很难进入,内部民众也难以出去。大家的梯子都被没收了,那可是违法的啊。\n\
  92. 从前,颜色是有阶级限制的,P党内部核心人员身穿黄色,大官穿紫色,小吏穿青绿色,平民穿灰白色。倘若僭越,是要遭来杀身之祸的。现在可好,民主、自由、平等,大家都一样,没人管你穿什么颜色,只是深深浅浅罢了。果然,社会进步,百姓安康。',
  93. '深夜,高楼。P党那位发表演讲的科学家站在窗边,望着依旧五光十色的建筑,冷笑一声,又走进无边的黑暗。\n\
  94. ……\n\
  95. “又经过几年的研究,我们发现人类基因中关于色彩识别的区段没有其存在的必要性。为进一步降低生活生产成本,我代表P党在此宣布自今年1100:00起将C市所有居民基因中色彩识别区段全部删除。同时,相关政策也将陆续实施。”“感谢各位的理解与支持。”',
  96. '00:00\n\
  97. C市的人全都瞎了。\n\
  98. 没有骚动,没有恐慌。'];
  99. function trollForAmusement() {
  100. console.log(TrollingArticle[Math.floor(Math.random() * TrollingArticle.length)]);
  101. }
  102.  
  103. function getBackground() {
  104. if (BackgroundSettings[0]) return BackgroundSettings[0];
  105. else return '';
  106. }
  107. function getOpacity() {
  108. if (BackgroundSettings[1]) return BackgroundSettings[1];
  109. else return '0.85';
  110. }
  111. function BackgroundImage() {
  112. if (BackgroundSettings[0]) {
  113. document.getElementsByClassName('navbar-brand')[0].innerHTML = '<img src="http://124.221.194.184/images/logo_small.png" alt="Logo" class="img-rounded" style="width:39px; height:39px;">';
  114. document.getElementsByClassName('container')[0].children[0].children[1].innerHTML = document.getElementsByClassName('container')[0].children[0].children[1].innerHTML.match(/(.*> ){0,1}(.*)/)[2];
  115. GM_addStyle('\
  116. body {\
  117. background: url("' + getBackground() + '");\
  118. background-repeat: no-repeat;\
  119. background-attachment: fixed;\
  120. background-position: 50% 50%;\
  121. background-size: cover;\
  122. }\
  123. .uoj-content {\
  124. background-color: #fff;\
  125. margin: 16px -16px;\
  126. padding: 16px 16px;\
  127. opacity: ' + getOpacity() + ';\
  128. border-radius: 8px;\
  129. }\
  130. .navbar {\
  131. margin: 16px -16px;\
  132. padding: 8px 16px;\
  133. opacity: ' + getOpacity() + ';\
  134. border-radius: 8px;\
  135. }');
  136. }
  137. }
  138.  
  139. function getIcon() {
  140. if (SiteIconImage) return SiteIconImage;
  141. else return '/images/logo.png';
  142. }
  143. const LogoURLExp = /^.*\/images\/logo(_small){0,1}.png$/;
  144. function changeIcon() {
  145. var Links = document.getElementsByTagName('link');
  146. for (var link in Links) {
  147. if (Links[link] && Links[link].nodeType && Links[link].getAttribute('rel') == 'shortcut icon') {
  148. Links[link].setAttribute('href', getIcon());
  149. }
  150. }
  151. var Icons = document.getElementsByTagName('img');
  152. for (var icon in Icons) {
  153. if (Icons[icon] && Icons[icon].nodeType && LogoURLExp.test(Icons[icon].getAttribute('src'))) {
  154. Icons[icon].setAttribute('src', getIcon());
  155. }
  156. }
  157. }
  158.  
  159. const ManageStatementExp = /^.*\/manage\/statement(\?.*){0,1}$/
  160. function CodeBlock() {
  161. GM_addStyle('\
  162. @import url(https://cdn.jsdelivr.net/npm/firacode@6.2.0/distr/fira_code.css);\
  163. code {\
  164. font-family: "Fira Code";\
  165. }\
  166. code.sh_cpp>span {\
  167. font-style: normal !important;\
  168. font-weight: 400 !important;\
  169. }\
  170. code.sh_cpp>span.sh_preproc,\
  171. code.sh_cpp>span.sh_keyword,\
  172. code.sh_cpp>span.sh_type {\
  173. color: #8959a8;\
  174. }\
  175. code.sh_cpp>span.sh_string {\
  176. color: #718c00;\
  177. }\
  178. code.sh_cpp>span.sh_cbracket {\
  179. color: #4d4d4c;\
  180. }\
  181. code.sh_cpp>span.sh_symbol {\
  182. color: #3e999f;\
  183. }\
  184. code.sh_cpp>span.sh_number {\
  185. color: #f5871f;\
  186. }\
  187. code.sh_cpp>span.sh_function {\
  188. color: #4271ae;\
  189. }\
  190. code.sh_cpp>span.sh_comment {\
  191. color: #8e908c;\
  192. }\
  193. .copybutton {\
  194. float: right;\
  195. background-color: rgb(0,0,0,.1);\
  196. padding: .25em .625em;\
  197. border: 0 solid transparent;\
  198. border-radius: .28571429rem;\
  199. }\
  200. .copybutton:hover {\
  201. background-color: rgb(0,0,0,.2);\
  202. }\
  203. .copybutton:focus {\
  204. background-color: rgb(0,0,0,.2);\
  205. outline: none;\
  206. }');
  207. if (!ManageStatementExp.test(window.location.href)) {
  208. setTimeout(function(){
  209. var CodeBlocks = document.getElementsByTagName('pre');
  210. for (var cb in CodeBlocks) {
  211. if (CodeBlocks[cb] && CodeBlocks[cb].nodeType) {
  212. var Content = CodeBlocks[cb].textContent;
  213. var InputId = Math.round(Math.random() * 998244353);
  214. var ButtonId = Math.round(Math.random() * 998244353);
  215. CodeBlocks[cb].innerHTML = '<button class="copybutton" id = "' + ButtonId + '" onclick="\
  216. var ib = document.getElementById(\'' + InputId + '\');\
  217. ib.setAttribute(\'style\', \'display:initial\');\
  218. ib.value = \'' + Content.replace(/\\/g, '\\\\').replace(/\n/g, '\\n').replace(/'/g, '\\&#39;').replace(/"/g, '&#34;') + '\';\
  219. ib.select();\
  220. document.execCommand(\'copy\');\
  221. ib.setAttribute(\'style\', \'display:none\');\
  222. var ic = document.getElementById(\'' + ButtonId + '\');\
  223. ic.innerHTML = \'已复制\';\
  224. setTimeout(function() { ic.innerHTML = \'复制\'; }, 500);">复制</button>' + CodeBlocks[cb].innerHTML;
  225. var InputBox = document.createElement('textarea');
  226. InputBox.setAttribute('id', InputId);
  227. InputBox.setAttribute('style', 'display:none');
  228. CodeBlocks[cb].appendChild(InputBox);
  229. }
  230. }
  231.  
  232. }, 30);
  233. }
  234. }
  235.  
  236. function NameColor() {
  237. var Names = document.getElementsByClassName('uoj-username');
  238. var NeedsRepeat = false;
  239. for (var i in Names) {
  240. if (Names[i].innerHTML && NameColorList[Names[i].innerHTML]) {
  241. Names[i].style = 'color:' + NameColorList[Names[i].innerHTML][0];
  242. var resN = '';
  243. for (var charN = 1; charN < NameColorList[Names[i].innerHTML].length; ++charN) {
  244. resN = resN + '<font style="color:' + NameColorList[Names[i].innerHTML][charN] + '">' + Names[i].innerHTML.substring(charN - 1, charN) + '</font>';
  245. }
  246. Names[i].innerHTML = resN + Names[i].innerHTML.substring(NameColorList[Names[i].innerHTML].length - 1);
  247. if (Names[i].parentElement.getAttribute('class') == 'legendLabel') {
  248. NeedsRepeat = true;
  249. }
  250. }
  251. }
  252. if (NeedsRepeat) {
  253. setInterval(function(){
  254. var Names = document.getElementsByClassName('uoj-username');
  255. for (var i in Names) {
  256. if (Names[i].innerHTML && Names[i].parentElement.getAttribute('class') == 'legendLabel' && NameColorList[Names[i].innerHTML]) {
  257. Names[i].style = 'color:' + NameColorList[Names[i].innerHTML][0];
  258. var resN = '';
  259. for (var charN = 1; charN < NameColorList[Names[i].innerHTML].length; ++charN) {
  260. resN = resN + '<font style="color:' + NameColorList[Names[i].innerHTML][charN] + '">' + Names[i].innerHTML.substring(charN - 1, charN) + '</font>';
  261. }
  262. Names[i].innerHTML = resN + Names[i].innerHTML.substring(NameColorList[Names[i].innerHTML].length - 1);
  263. }
  264. }
  265. }, 200);
  266. }
  267. var Honors = document.getElementsByClassName('uoj-honor');
  268. for (var j in Honors) {
  269. if (Honors[j].innerHTML && NameColorList[Honors[j].innerHTML]) {
  270. Honors[j].style = 'color:' + NameColorList[Honors[j].innerHTML][0];
  271. var resH = '';
  272. for (var charH = 1; charH < NameColorList[Honors[j].innerHTML].length; ++charH) {
  273. resH = resH + '<font style="color:' + NameColorList[Honors[j].innerHTML][charH] + '">' + Honors[j].innerHTML.substring(charH - 1, charH) + '</font>';
  274. }
  275. Honors[j].innerHTML = resH + Honors[j].innerHTML.substring(NameColorList[Honors[j].innerHTML].length - 1);
  276. }
  277. }
  278. }
  279.  
  280. const NameExp = /^(.{1,}?)( .*){0,1}$/;
  281. function CCFBadge() {
  282. var Names = document.getElementsByClassName('uoj-username');
  283. for (var i in Names) {
  284. if (!Names[i].innerHTML || !NameExp.test(Names[i].textContent)) continue;
  285. var name = Names[i].textContent.match(NameExp)[1];
  286. if (CCFBadgeList[name] && Names[i].parentElement.getAttribute('class') != 'legendLabel') {
  287. Names[i].innerHTML = Names[i].innerHTML + ' <svg width="1em" height="1em" data-v-303bbf52="" aria-hidden="true" focusable="false" data-prefix="fad" data-icon="badge-check" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="margin-bottom:.25em!important;bottom:10px;--fa-primary-color:#fff;--fa-secondary-color:' + CCFBadgeList[name] + ';--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>';
  288. }
  289. }
  290. var Honors = document.getElementsByClassName('uoj-honor');
  291. for (var j in Honors) {
  292. if (!Honors[j].innerHTML || !NameExp.test(Honors[j].textContent)) continue;
  293. var honor = Honors[j].textContent.match(NameExp)[1];
  294. if (CCFBadgeList[honor]) {
  295. Honors[j].innerHTML = Honors[j].innerHTML + ' <svg width="1em" height="1em" data-v-303bbf52="" aria-hidden="true" focusable="false" data-prefix="fad" data-icon="badge-check" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="margin-bottom:.25em!important;bottom:10px;--fa-primary-color:#fff;--fa-secondary-color:' + CCFBadgeList[honor] + ';--fa-secondary-opacity:1;"><g data-v-303bbf52="" class="fa-group"><path data-v-303bbf52="" fill="var(--fa-secondary-color)" d="M512 256a88 88 0 0 0-57.1-82.4A88 88 0 0 0 338.4 57.1a88 88 0 0 0-164.8 0A88 88 0 0 0 57.1 173.6a88 88 0 0 0 0 164.8 88 88 0 0 0 116.5 116.5 88 88 0 0 0 164.8 0 88 88 0 0 0 116.5-116.5A88 88 0 0 0 512 256zm-144.8-44.25l-131 130a11 11 0 0 1-15.55-.06l-75.72-76.33a11 11 0 0 1 .06-15.56L171 224a11 11 0 0 1 15.56.06l42.15 42.49 97.2-96.42a11 11 0 0 1 15.55.06l25.82 26a11 11 0 0 1-.08 15.56z" class="fa-secondary"></path></g></svg>';
  296. }
  297. }
  298. }
  299. function TagBadge() {
  300. var Names = document.getElementsByClassName('uoj-username');
  301. for (var i in Names) {
  302. if (!Names[i].innerHTML || !NameExp.test(Names[i].textContent)) continue;
  303. var name = Names[i].textContent.match(NameExp)[1];
  304. if (TagBadgeList[name] && Names[i].parentElement.getAttribute('class') != 'legendLabel') {
  305. Names[i].innerHTML = Names[i].innerHTML + ' <span style="background-color:' + TagBadgeList[name][0] + ';padding:0.2em 0.6em;border-radius:.2em;color:#fff;font-size:0.7em;font-weight:bold;display:inline-block">' + TagBadgeList[name][1] + '</span>';
  306. }
  307. }
  308. var Honors = document.getElementsByClassName('uoj-honor');
  309. for (var j in Honors) {
  310. if (!Honors[j].innerHTML || !NameExp.test(Honors[j].textContent)) continue;
  311. var honor = Honors[j].textContent.match(NameExp)[1];
  312. if (TagBadgeList[honor]) {
  313. Honors[j].innerHTML = Honors[j].innerHTML + ' <span style="background-color:' + TagBadgeList[honor][0] + ';padding:0.2em 0.6em;border-radius:.2em;color:#fff;font-size:0.7em;font-weight:bold;display:inline-block">' + TagBadgeList[honor][1] + '</span>';
  314. }
  315. }
  316. }
  317.  
  318. function TableStyle() {
  319. var Tables = document.getElementsByTagName('table');
  320. for (var table in Tables) {
  321. if (Tables[table].nodeType && Tables[table].parentNode.getAttribute('class') != 'legend' && !Tables[table].classList.length) {
  322. Tables[table].classList.add('table', 'table-bordered');
  323. }
  324. }
  325. var ths = document.getElementsByTagName('th');
  326. for (var th in ths) {
  327. if (ths[th].nodeType && ths[th].getAttribute('align')) {
  328. ths[th].setAttribute('style', 'text-align:' + ths[th].getAttribute('align'));
  329. }
  330. }
  331. }
  332.  
  333. function SubmissionCard() {
  334. setTimeout(function() {
  335. var Content = document.getElementsByClassName('uoj-content')[0];
  336. if (Content.childElementCount == 3) {
  337. var Table = Content.children[0];
  338. var TabList = document.createElement('ul');
  339. TabList.setAttribute('class', 'nav nav-tabs');
  340. TabList.setAttribute('role', 'tablist');
  341. TabList.innerHTML = '<li class="nav-item"><a class="nav-link active" href="#test-cases" role="tab" data-toggle="tab" aria-selected="true"><span class="glyphicon glyphicon-check"></span> 测试点信息</a></li><li class="nav-item"><a class="nav-link" href="#source" role="tab" data-toggle="tab" aria-selected="false"><span class="glyphicon glyphicon-file"></span> 源代码</a></li>';
  342. var TabContent = document.createElement('div');
  343. TabContent.setAttribute('class', 'tab-content');
  344. TabContent.innerHTML = '<div class="tab-pane card active" id="test-cases"><div class="card-body">' + Content.children[2].children[1].innerHTML + '</div></div><div class="tab-pane card" id="source"><div class="card-body">' + Content.children[1].children[1].innerHTML + '</div></div>';
  345. Content.innerHTML = "";
  346. Content.appendChild(Table);
  347. Content.appendChild(TabList);
  348. Content.appendChild(TabContent);
  349. }
  350. }, 50);
  351. }
  352.  
  353. function downloadData() {
  354. var DownloadTag = document.createElement('a');
  355. DownloadTag.setAttribute('role', 'button');
  356. DownloadTag.setAttribute('class', 'btn btn-primary float-right');
  357. DownloadTag.setAttribute('href', '/download.php?type=problem&id=' + window.location.href.match(ProblemRegExp)[1]);
  358. DownloadTag.setAttribute('target', '_blank');
  359. DownloadTag.innerHTML = '<span class="glyphicon glyphicon-download-alt"></span> 下载数据';
  360. document.getElementsByClassName("btn btn-info float-right")[0].after(DownloadTag);
  361. }
  362.  
  363. const GravatarURLRegExp = /\/\/cn.gravatar.com\/avatar\/(.*)$/;
  364. function changeGravatarURL() {
  365. var Gravatar = document.getElementsByClassName('img-thumbnail')[0];
  366. if (Gravatar && Gravatar.nodeType){
  367. console.log(Gravatar);
  368. Gravatar.setAttribute('src', '//gravatar.loli.net/avatar/' + Gravatar.getAttribute('src').match(GravatarURLRegExp)[1]);
  369. }
  370. var Gravatars = document.getElementsByClassName('img-rounded');
  371. for (var gravatar in Gravatars) {
  372. if (Gravatars[gravatar] && Gravatars[gravatar].nodeType && GravatarURLRegExp.test(Gravatars[gravatar].getAttribute('src'))) {
  373. Gravatars[gravatar].setAttribute('src', '//gravatar.loli.net/avatar/' + Gravatars[gravatar].getAttribute('src').match(GravatarURLRegExp)[1]);
  374. }
  375. }
  376. }
  377.  
  378. (function() {
  379. 'use strict';
  380. whenMourn();
  381. trollForAmusement()
  382. BackgroundImage();
  383. changeIcon();
  384. CodeBlock();
  385. NameColor();
  386. CCFBadge();
  387. TagBadge();
  388. TableStyle();
  389. if (isSubmission()) SubmissionCard();
  390. if (isProblem()) downloadData();
  391. if (isUserProfile() || isBlog()) changeGravatarURL();
  392. })();