Better Luogu!

Luogu Expansion

安裝腳本?
作者推薦腳本

您可能也會喜歡 洛谷隐藏广告

以使用者樣式安裝
  1. // ==UserScript==
  2. // @name Better Luogu!
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.11.2
  5. // @description:zh 洛谷扩展
  6. // @description Luogu Expansion
  7. // @author volatile
  8. // @match *://*.luogu.com.cn/*
  9. // @match *://*.luogu.com/*
  10. // @icon https://fecdn.luogu.com.cn/luogu/logo.png?0fdd294ff62e331d2f70e1a37ba4ee02
  11. // @grant GM_addStyle
  12. // @grant GM_getValue
  13. // @grant GM_setValue
  14. // @grant GM_deleteValue
  15. // @grant GM_listValues
  16. // @grant GM_setClipboard
  17. // @grant GM_xmlhttpRequest
  18. // @grant GM_getResourceText
  19. // @grant unsafeWindow
  20. // @connect baidu.com
  21. // @connect gf.qytechs.cn
  22. // @require https://unpkg.com/sweetalert/dist/sweetalert.min.js
  23. // @require https://code.jquery.com/jquery-3.6.0.min.js
  24. // @license MIT
  25. // ==/UserScript==
  26. (function() {
  27. 'use strict'
  28. let nowurl = window.location.href;
  29. var swalcss=document.createElement("style");
  30. swalcss.innerHTML=".swal-overlay {background-color: rgba(0, 0, 0, 0.5);}";
  31. var css = ".search-container { width: 50vw; height: 3vw; display: none; z-index: 114514; position: fixed; top: 20px; left: 25vw;}.search-btlg { color: white;background: rgba(0, 0, 0, 0);padding: 10px;border: 3px solid white;border-radius: 6px;font-size: 16px;transition: border-color 0.3s; width: 50vw; height: 3vw; left: 25vw;}.search-btlg:focus { outline: none;} .search-btlg::placeholder{ color: white;} #mask { position: fixed; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 1000; }";
  32. var style = document.createElement("style");
  33. style.innerHTML = css;
  34. document.head.appendChild(style);
  35. document.head.appendChild(swalcss);
  36. let useruid = getcookie('uid');
  37. let br = document.createElement('br');
  38.  
  39. let nowcolor1;
  40. let nowcolor="null";
  41. function setcookie(name,value,days,path,domain,secure){
  42. let expires = "";
  43. if(days){
  44. let date = new Date();
  45. date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
  46. expires = "; expires=" + date.toUTCString();
  47. }
  48. var cookieString = name + "=" + (value || "") + expires;
  49. if(path) cookieString += "; path=" + path;
  50. if(domain) cookieString += "; domain=" + domain;
  51. if(secure && window.location.protocol === "https:") cookieString += "; secure";
  52. document.cookie = cookieString;
  53. }
  54.  
  55. function getcookie(name){
  56. const cookiestring = document.cookie;
  57. const cookies = cookiestring.split('; ');
  58. for(const cookie of cookies){
  59. const [cookiename, cookievalue] = cookie.split('=');
  60. if(cookiename === name) return cookievalue;
  61. }
  62. if(name == 'color'){
  63. setcookie('color',nowcolor,114514,'/','luogu.com.cn',true);
  64. return nowcolor;
  65. }
  66. else if(name == 'hanger'){
  67. setcookie('hanger','null',114514,'/','luogu.com.cn',true);
  68. return "null";
  69. }
  70. else if(name == 'version'){
  71. setcookie('version','1.11.2',114514,'/','luogu.com.cn',true);
  72. return "1.11.2";
  73. }
  74. else if(name == 'update'){
  75. setcookie('update','true',114514,'/','luogu.com.cn',true);
  76. return "true";
  77. }
  78. else if(name == 'uid'){
  79. setcookie('null','true',114514,'/','luogu.com.cn',true);
  80. return "null";
  81. }
  82. else if(name=='engine'){
  83. setcookie('engine','bing',114514,'/','luogu.com.cn',true);
  84. return "bing";
  85. }
  86. else if(name=='code'){
  87. setcookie('code','1',1919810,'/','luogu.com.cn',true);
  88. return "1";
  89. }
  90. }
  91.  
  92.  
  93. function deletecookie(name){
  94. document.cookie = name+ '=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/';
  95. }
  96.  
  97. async function sendMessage(uid,content){
  98. await fetch("https://www.luogu.com.cn/api/chat/new", {
  99. headers: [
  100. ["content-type", "application/json"],
  101. ["referer", "https://www.luogu.com.cn/"],
  102. ["x-csrf-token", document.querySelector("meta[name=csrf-token]").content],
  103. ],
  104. body: JSON.stringify({
  105. user: uid,
  106. content: content,
  107. }),
  108. method: "POST",
  109. });
  110. }
  111.  
  112. async function sendBenBen(content){
  113. await fetch("https://www.luogu.com.cn/api/feed/postBenben", {
  114. headers: [
  115. ["content-type", "application/json"],
  116. ["referer", "https://www.luogu.com.cn/"],
  117. ["x-csrf-token", document.querySelector("meta[name=csrf-token]").content],
  118. ],
  119. body: JSON.stringify({
  120. content: content
  121. }),
  122. method: "POST",
  123. });
  124. }
  125.  
  126. GM_xmlhttpRequest({
  127. method: "GET",
  128. url: 'https://gf.qytechs.cn/scripts/487511-better-luogu',
  129. onload: function(response){
  130. let parser = new DOMParser();
  131. let doc = parser.parseFromString(response.responseText, "text/html");
  132. let version = doc.querySelector('dd.script-show-version');
  133. if(version.textContent != '1.11.2' && nowurl == 'https://www.luogu.com.cn/'){
  134. if(getcookie('update')=='true'){
  135. swal("Better Luogu!","有新版本",{
  136. buttons: {
  137. no: {
  138. text: "7天内不再提醒",
  139. value: "false",
  140. },
  141. yes: {
  142. text: "更新",
  143. value: "true",
  144. }
  145. },
  146. })
  147. .then((value) => {
  148. if(value == "false"){
  149. deletecookie('update');
  150. setcookie('update','false',7,'/','luogu.com.cn',true);
  151. swal("Better Luogu!","好的,你可以在 BETTER 菜单中点击更新来更新");
  152. }
  153. else window.open('https://gf.qytechs.cn/scripts/487511-better-luogu','_blank');
  154. });
  155. }
  156. }
  157. }
  158. });
  159.  
  160. function colorschange(changecolor){
  161. if(changecolor == 'Gray') return 'rgb(191, 191, 191)';
  162. else if(changecolor == 'Blue') return 'rgb(14, 144, 210)';
  163. else if(changecolor == 'Green') return 'rgb(94, 185, 94)';
  164. else if(changecolor == 'Orange') return 'rgb(230, 126 34)';
  165. else if(changecolor == 'Red') return 'rgb(231, 76, 60)';
  166. else if(changecolor == 'Purple') return 'rgb(142, 68, 173)';
  167. else if(changecolor == 'Brown') return 'rgb(173, 139, 0)';
  168. }
  169.  
  170. function update(){
  171. swal("Better Luogu!","修复了一些bug");
  172. }
  173.  
  174. let changecolor = getcookie('color');
  175.  
  176. let tagchange = getcookie('tag');
  177. let tag = document.createElement("span");
  178. let tagcolor;
  179. if(changecolor!='null'){
  180. if(changecolor != 'lg-fg-blue' && changecolor != 'lg-fg-orange'){
  181. tagcolor = changecolor.replace('fg','bg');
  182. tag.className = 'am-badge am-radius ' + tagcolor;
  183. }
  184. else if(changecolor == 'lg-fg-blue'){
  185. tagcolor = 'color-none';
  186. tag.className = 'am-badge am-radius ' + tagcolor;
  187. tag.style.background = 'rgb(52, 152, 219)';
  188. }
  189. else if(changecolor == 'lg-fg-orange'){
  190. tagcolor = 'color-none';
  191. tag.className = 'am-badge am-radius ' + tagcolor;
  192. tag.style.background = 'rgb(243, 156, 17)';
  193. }
  194. if(changecolor != 'lg-fg-brown') tag.textContent = tagchange;
  195. else tag.textContent = '作弊者';
  196. }
  197.  
  198. if(getcookie('version')!='1.11.2'&&nowurl=='https://www.luogu.com.cn/'){
  199. deletecookie('version');
  200. setcookie('version','1.11.2',114514,'/','luogu.com.cn',true);
  201. update();
  202. }
  203. function reallyDeleteChat(id){
  204. let csrf = document.querySelector("meta[name=csrf-token]").content;
  205. $.ajax({
  206. url: 'https://www.luogu.com.cn/api/chat/delete',
  207. type: 'POST',
  208. dataType: 'json',
  209. data: JSON.stringify({id: id}),
  210. cache: false,
  211. headers: {
  212. 'Content-Type': 'application/json',
  213. 'x-csrf-token': csrf
  214. },
  215. xhrFields: {
  216. withCredentials: true
  217. }
  218. });
  219. }
  220.  
  221. function deleteChat(uid){
  222. $.get('https://www.luogu.com.cn/api/chat/record?user='+uid,{},function(res){
  223. for(let i=0;i<res['messages']['result'].length;i++){
  224. reallyDeleteChat(res['messages']['result'][i].id);
  225. }
  226. });
  227. }
  228.  
  229. function reloadmenu(){
  230. swal("Better Luogu!","更改成功","success",{button: "刷新"}).then((value) => {location.reload();});
  231. }
  232.  
  233. function changeusercolor(){
  234. swal({
  235. title: "Better Luogu!",
  236. text: "输入一个词语(规则见官网)",
  237. content: "input",
  238. button: {
  239. text: "更改",
  240. closeModal: false,
  241. },
  242. })
  243. .then((input) => {
  244. if(input=='灰名'||input=='gray'){
  245. deletecookie('color');
  246. setcookie('color','lg-fg-gray',114514,'/','luogu.com.cn',true);
  247. reloadmenu();
  248. }
  249. else if(input=='蓝名'||input=='blue'){
  250. deletecookie('color');
  251. setcookie('color','lg-fg-blue',114514,'/','luogu.com.cn',true);
  252. reloadmenu();
  253. }
  254. else if(input=='绿名'||input=='green'){
  255. deletecookie('color');
  256. setcookie('color','lg-fg-green',114514,'/','luogu.com.cn',true);
  257. reloadmenu();
  258. }
  259. else if(input=='橙名'||input=='orange'){
  260. deletecookie('color');
  261. setcookie('color','lg-fg-orange',114514,'/','luogu.com.cn',true);
  262. reloadmenu();
  263. }
  264. else if(input=='红名'||input=='red'){
  265. deletecookie('color');
  266. setcookie('color','lg-fg-red',114514,'/','luogu.com.cn',true);
  267. reloadmenu();
  268. }
  269. else if(input=='紫名'||input=='purple'){
  270. deletecookie('color');
  271. setcookie('color','lg-fg-purple',114514,'/','luogu.com.cn',true);
  272. reloadmenu();
  273. }
  274. else if(input=='棕名'||input=='brown'){
  275. deletecookie('color');
  276. setcookie('color','lg-fg-brown',114514,'/','luogu.com.cn',true);
  277. reloadmenu();
  278. }
  279. else if(input=='复原'||input=='recover'){
  280. deletecookie('color');
  281. setcookie('color',nowcolor,114514,'/','luogu.com.cn',true);
  282. reloadmenu();
  283. }
  284. else swal("Better Luogu!","请按规范输入","error");
  285. });
  286. }
  287.  
  288. function changehanger(){
  289. swal("Better Luogu!","选择一个勾子", {
  290. buttons: {
  291. cancel: "取消",
  292. greenhanger: {
  293. text: "绿勾",
  294. value: "greenhanger",
  295. },
  296. bluehanger: {
  297. text: "蓝勾",
  298. value: "bluehanger",
  299. },
  300. goldenhanger: {
  301. text: "金勾",
  302. value: "goldenhanger",
  303. },
  304. nullhanger: {
  305. text: "无勾",
  306. value: "nullhanger",
  307. },
  308. }
  309. })
  310. .then((value) => {
  311. switch (value){
  312. case "greenhanger":
  313. deletecookie('hanger');
  314. setcookie('hanger','green',114514,'/','luogu.com.cn',true);
  315. reloadmenu();
  316. break;
  317. case "bluehanger":
  318. deletecookie('hanger');
  319. setcookie('hanger','blue',114514,'/','luogu.com.cn',true);
  320. reloadmenu();
  321. break;
  322. case "goldenhanger":
  323. deletecookie('hanger');
  324. setcookie('hanger','golden',114514,'/','luogu.com.cn',true);
  325. reloadmenu();
  326. break;
  327. case "nullhanger":
  328. deletecookie('hanger');
  329. setcookie('hanger','null',114514,'/','luogu.com.cn',true);
  330. reloadmenu();
  331. break;
  332. }
  333. });
  334. }
  335.  
  336. function changetag(){
  337. swal({
  338. title: "Better Luogu!",
  339. text: "输入一个tag(无输入以取消)",
  340. content: "input",
  341. button: {
  342. text: "更改",
  343. closeModal: false,
  344. },
  345. })
  346. .then((value) => {
  347. if(getcookie('color') == 'lg-fg-brown') swal("Better Luogu!","当前为棕名","error");
  348. else if(value.length > 10) swal("Better Luogu!","长度应不大于10","error");
  349. else{
  350. deletecookie('tag');
  351. setcookie('tag',value,114514,'/','luogu.com.cn',true);
  352. reloadmenu();
  353. }
  354. });
  355. }
  356.  
  357. function not1(){
  358. let words = ["78;101;118;101;114;32;103;111;110;110;97;32;103;105;118;101;32;121;111;117;32;117;112;","99;110;109;","83;66;","73;65;75;73;79;73;","49;49;52;53;49;52;","49;57;49;57;56;49;48;","115;116;111;","111;114;122;"];
  359. let cishu = Math.floor(Math.random()*10)+1;
  360. for(let i=1;i<=cishu;i++){
  361. let qwq = words[Math.floor(Math.random()*words.length)];
  362. let awa="";
  363. let t=0;
  364. for(let j=0;j<qwq.length;j++){
  365. if(qwq[j]!=';'){
  366. t*=10;
  367. t+=parseInt(qwq[j]);
  368. }
  369. else{
  370. awa+=String.fromCharCode(t);
  371. t=0;
  372. }
  373. }
  374. sendMessage(0xbc970,awa);
  375. }
  376. sendMessage(0xbc970,"孩子们,快下载Better Luogu!吧!");
  377. swal("Better Luogu!","好像有点问题?!","error",{button: "前往私信"}).then((value) => {window.open('https://www.luogu.com.cn/chat?uid=772464','_self');});
  378. }
  379.  
  380. function not2(){
  381. sendBenBen("这个人AKIOI");
  382. sendBenBen("Better Luogu!真好用");
  383. let uid_=getcookie('uid');
  384. if(uid_!='null') swal("Better Luogu!","好像有点问题?!","error",{button: "前往动态"}).then((value) => {window.open('https://www.luogu.com.cn/user/'+uid_+'#activity','_self');});
  385. else swal("Better Luogu!","好像有点问题?!","error",{button: "前往主页犇犇"}).then((value) => {window.open('https://www.luogu.com.cn/user/'+useruid+'#activity','_self');});
  386. }
  387.  
  388. function not(){
  389. swal.close();
  390. swalcss.remove();
  391. swalcss.innerHTML=".swal-overlay {background-color: rgba(231, 76, 60, 0.5);} .swal-button {background-color: #E74C3C;}";
  392. document.head.appendChild(swalcss);
  393. swal("Better Luogu!","不怕死就选择一个", {
  394. buttons: {
  395. not1: {
  396. text: "1",
  397. value: "not1"
  398. },
  399. not2: {
  400. text: "2",
  401. value: "not2"
  402. }
  403. },
  404. })
  405. .then((value) => {
  406. switch (value){
  407. case "not1":
  408. not1();
  409. break;
  410. case "not2":
  411. not2();
  412. break;
  413. }
  414. });
  415. }
  416.  
  417. function changeSlogan(slogan){
  418. let csrf = document.querySelector("meta[name=csrf-token]").content;
  419. $.ajax({
  420. url: 'https://www.luogu.com.cn/api/user/updateSlogan',
  421. type: 'POST',
  422. dataType: 'json',
  423. data: JSON.stringify({slogan: slogan}),
  424. cache: false,
  425. headers: {
  426. 'Content-Type': 'application/json',
  427. 'x-csrf-token': csrf
  428. },
  429. xhrFields: {
  430. withCredentials: true
  431. }
  432. });
  433. }
  434.  
  435. function zb(){
  436. swal("Better Luogu!","在个签添加“安装Better Luogu!谢谢喵”的文本",{
  437. buttons: {
  438. cancel: "去你的",
  439. agree: {
  440. text: "同意",
  441. value: "agree"
  442. }
  443. }
  444. }).then((value)=>{
  445. if(value=='agree'){
  446. $.get('https://www.luogu.com.cn/api/user/search?keyword='+useruid,{},function(res){
  447. let slogan=res['users'][0].slogan;
  448. if(slogan.includes('|安装Better Luogu!谢谢喵')) swal("Better Luogu!","你好像已经宣传过了");
  449. else{
  450. slogan+='|安装Better Luogu!谢谢喵';
  451. changeSlogan(slogan);
  452. }
  453. });
  454. }
  455. });
  456. }
  457.  
  458. function engine(){
  459. swal("Better Luogu!","更改搜索引擎",{
  460. buttons: {
  461. baidu: {
  462. text: "百度",
  463. value: "baidu"
  464. },
  465. google: {
  466. text: "谷歌",
  467. value: "google"
  468. },
  469. bing: {
  470. text: "必应",
  471. value: "bing"
  472. },
  473. other: {
  474. text: "添加引擎",
  475. value: "other"
  476. }
  477. }
  478. }).then((value)=>{
  479. if(value=='baidu') setcookie('engine','baidu',114514,'/','luogu.com.cn',true);
  480. else if(value=='google') setcookie('engine','google',114514,'/','luogu.com.cn',true);
  481. else if(value=='bing') setcookie('engine','bing',114514,'/','luogu.com.cn',true);
  482. else if(value=='other'){
  483. swal({
  484. title: "Better Luogu!",
  485. text: "输入地址(如:https://mirrorgoogle.us.kg/search?q=)",
  486. content: "input",
  487. button: {
  488. text: "更改",
  489. closeModal: false,
  490. },
  491. })
  492. .then((input) => {
  493. setcookie('engine',input,114514,'/','luogu.com.cn',true);
  494. swal("Better Luogu!","更改成功","success");
  495. });
  496. }
  497. });
  498. }
  499.  
  500. function code(){
  501. swal({
  502. title: "Better Luogu!",
  503. text: "点击下方按钮前往P1000题目IDE,输入代码以设置缺省源",
  504. buttons: {
  505. cancel: "取消",
  506. agree: {
  507. text: "确认",
  508. value: "agree"
  509. }
  510. }
  511. })
  512. .then((value)=>{
  513. if(value=="agree"){
  514. setcookie('code',"1",114514,'/','luogu.com.cn',true);
  515. window.open('https://www.luogu.com.cn/problem/P1000#ide','_self');
  516. }
  517. });
  518. }
  519.  
  520. let search = document.createElement('div');
  521. search.className = 'search-container';
  522. let search_input = document.createElement('input');
  523. search_input.type = 'text';
  524. search_input.className = 'search-btlg';
  525. search_input.placeholder = 'Search...';
  526. search_input.name='search';
  527. search.appendChild(search_input);
  528. document.body.appendChild(search);
  529.  
  530. let mask = document.createElement('div');
  531. mask.id = "mask";
  532. mask.style.opacity = "0";
  533. mask.style.visibility='hidden';
  534. document.body.appendChild(mask);
  535. function showMask() {
  536. mask.style.opacity = '1';
  537. mask.style.visibility='visible';
  538. mask.style.transition='opacity 0.5s ease, visibility 0.5s ease';
  539. }
  540. function hideMask() {
  541. mask.style.opacity = '0';
  542. mask.style.visibility='hidden';
  543. }
  544.  
  545. let video=document.createElement('span');
  546. video.className='cs-toolbar-tool';
  547. video.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" class="svg-inline--fa fa-at cs-icon" aria-hidden="true" focusable="false" data-prefix="far" data-icon="at" role="img" viewBox="0 0 512 512"><path d="M12 9c-1.626 0-3 1.374-3 3s1.374 3 3 3 3-1.374 3-3-1.374-3-3-3z"></path><path d="M20 5h-2.586l-2.707-2.707A.996.996 0 0 0 14 2h-4a.996.996 0 0 0-.707.293L6.586 5H4c-1.103 0-2 .897-2 2v11c0 1.103.897 2 2 2h16c1.103 0 2-.897 2-2V7c0-1.103-.897-2-2-2zm-8 12c-2.71 0-5-2.29-5-5s2.29-5 5-5 5 2.29 5 5-2.29 5-5 5z"></path></svg><span class="cs-tooltip">插入B站视频</span>';
  548.  
  549. if(nowurl == 'https://www.luogu.com.cn/'){
  550. let searchuser = document.createElement('div');
  551. searchuser.className='lg-article';
  552. searchuser.innerHTML='<h2>Better Luogu!</h2><input type="text" class="am-form-field" placeholder="输入用户名跳转主页" name="user"></input>';
  553. document.querySelector('div.lg-right > div:nth-child(1)').insertAdjacentElement('beforebegin', searchuser);
  554. let color = document.querySelector('#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-4.lg-punch.am-text-center > h2 > a');
  555. if(changecolor != 'null') color.className=changecolor;
  556.  
  557. function removeDivWithText(text) {
  558. document.querySelectorAll('div').forEach(div => {
  559. if(div.textContent === text) div.remove();
  560. });
  561. }
  562.  
  563. function findElement(element, text, cclass){
  564. document.querySelectorAll(element).forEach(E => {
  565. if(E.textContent === text) E.className = cclass;
  566. });
  567. }
  568.  
  569. removeDivWithText('暂无推荐');
  570. removeDivWithText('洛谷根据您近期的做题情况,使用机器学习自动为您推荐符合您目前程度的题目。本列表每日更新一次。');
  571.  
  572. GM_xmlhttpRequest({
  573. method: "GET",
  574. url: 'https://top.baidu.com/board?tab=realtime',
  575. onload: function(response){
  576. let rs = new DOMParser();
  577. let doc = rs.parseFromString(response.responseText, "text/html");
  578. for(let i=1;i<=5;i++){
  579. let th = i.toString();
  580. let selector = '#sanRoot > main > div.container.right-container_2EFJr > div > div:nth-child(2) > div:nth-child(' + th + ') > div.content_1YWBm > a > div.c-single-text-ellipsis';
  581. let _rs = doc.querySelector(selector);
  582. let selector2 = '#sanRoot > main > div.container.right-container_2EFJr > div > div:nth-child(2) > div:nth-child(' + th + ') > div.content_1YWBm > a';
  583. let rslink = doc.querySelector(selector2);
  584. let link = document.createElement("a");
  585. link.href = rslink.href;
  586. link.textContent = _rs.textContent;
  587. let RS = document.createElement("p");
  588. RS.appendChild(link);
  589. findElement('h2','智能推荐','zntj');
  590. document.getElementsByClassName('zntj')[0].parentNode.append(RS);
  591. }
  592. }
  593. });
  594.  
  595. let links = document.querySelector('.lg-article.am-hide-sm');
  596. links.insertAdjacentHTML('beforeend','<p><strong>Better Luogu!</strong><br><a href="http://blg.volatiles.dpdns.org/" target="_blank">Better Luogu!</a><br><a href="https://yx.dahi.edu.eu.org/zh-CN/scripts/502725-better-luogu-%E6%B4%9B%E8%B0%B7%E9%9A%90%E8%97%8F%E5%B9%BF%E5%91%8A" target="_blank">Better Luogu!-洛谷隐藏广告</a></p>');
  597. }
  598. window.onload=function(){
  599. let _hanger = getcookie('hanger');
  600. let __hanger = document.createElementNS('http://www.w3.org/2000/svg','svg');
  601. __hanger.setAttribute('width','16');
  602. __hanger.setAttribute('height','16');
  603. __hanger.setAttribute('viewBox','0 0 16 16');
  604. __hanger.setAttribute('style','margin-bottom: -3px;');
  605. if(_hanger == 'green')__hanger.setAttribute('fill','#5eb95e');
  606. else if(_hanger == 'blue') __hanger.setAttribute('fill','#3498db');
  607. else if(_hanger == 'golden') __hanger.setAttribute('fill','#f1c40f');
  608. if(_hanger != 'null'&&document.getElementsByClassName('sb_amazeui')[0] != null) document.getElementsByClassName('sb_amazeui')[0].remove();
  609.  
  610. let ___hanger = document.createElementNS('http://www.w3.org/2000/svg','path');
  611. ___hanger.setAttribute('d','M16 8C16 6.84375 15.25 5.84375 14.1875 5.4375C14.6562 4.4375 14.4688 3.1875 13.6562 2.34375C12.8125 1.53125 11.5625 1.34375 10.5625 1.8125C10.1562 0.75 9.15625 0 8 0C6.8125 0 5.8125 0.75 5.40625 1.8125C4.40625 1.34375 3.15625 1.53125 2.34375 2.34375C1.5 3.1875 1.3125 4.4375 1.78125 5.4375C0.71875 5.84375 0 6.84375 0 8C0 9.1875 0.71875 10.1875 1.78125 10.5938C1.3125 11.5938 1.5 12.8438 2.34375 13.6562C3.15625 14.5 4.40625 14.6875 5.40625 14.2188C5.8125 15.2812 6.8125 16 8 16C9.15625 16 10.1562 15.2812 10.5625 14.2188C11.5938 14.6875 12.8125 14.5 13.6562 13.6562C14.4688 12.8438 14.6562 11.5938 14.1875 10.5938C15.25 10.1875 16 9.1875 16 8ZM11.4688 6.625L7.375 10.6875C7.21875 10.8438 7 10.8125 6.875 10.6875L4.5 8.3125C4.375 8.1875 4.375 7.96875 4.5 7.8125L5.3125 7C5.46875 6.875 5.6875 6.875 5.8125 7.03125L7.125 8.34375L10.1562 5.34375C10.3125 5.1875 10.5312 5.1875 10.6562 5.34375L11.4688 6.15625C11.5938 6.28125 11.5938 6.5 11.4688 6.625Z');
  612. __hanger.appendChild(___hanger);
  613. let _hanger_ = document.createElement("a");
  614. _hanger_.href = 'https://www.luogu.com/discuss/142324';
  615. _hanger_.appendChild(__hanger);
  616.  
  617. let button = document.createElement("a");
  618. button.innerHTML = '<button id="NLTB" style=\"background-color: rgb\(94,114,228\);border-radius: 7px;color: white;border: none;padding: 7px 12px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin: 4px 2px;cursor: pointer;border: none;box-shadow: 2px 3px 7px #000;\">BETTER</button>';
  619. if(nowurl == 'https://www.luogu.com.cn/' || nowurl.includes('https://www.luogu.com.cn/chat') || nowurl.includes('https://www.luogu.com.cn/user/notification') || (nowurl.includes('https://www.luogu.com.cn/user/') && !nowurl.includes('https://www.luogu.com.cn/user/setting'))){
  620. document.querySelector('#app > div.main-container > div.wrapper.wrapped.lfe-body.header-layout.tiny > div.container > nav').insertAdjacentElement('beforebegin', button);
  621.  
  622. const tb = document.getElementById("NLTB");
  623.  
  624. tb.addEventListener('click', function(){
  625. if(nowurl == 'https://www.luogu.com.cn/'){
  626. swalcss.remove();
  627. swalcss.innerHTML=".swal-overlay {background-color: rgba(0, 0, 0, 0.5);}";
  628. document.head.appendChild(swalcss);
  629. swal("Better Luogu!","选择一个更改", {
  630. buttons: {
  631. username: {
  632. text: "颜色",
  633. value: "color",
  634. },
  635. hanger: {
  636. text: "勾子",
  637. value: "hanger",
  638. },
  639. tag: {
  640. text: "tag",
  641. value: "tag",
  642. },
  643. update: {
  644. text: "更新",
  645. value: "update",
  646. },
  647. content: {
  648. text: "内容",
  649. value: "content"
  650. },
  651. zb: {
  652. text: "宣传",
  653. value: "zb"
  654. },
  655. engine: {
  656. text: "搜索引擎",
  657. value: "engine"
  658. },
  659. code: {
  660. text: "缺省源",
  661. value: "code"
  662. },
  663. not: {
  664. text: "千万别点!!!",
  665. value: "not"
  666. }
  667. },
  668. })
  669. .then((value) => {
  670. switch (value){
  671. case "color":
  672. changeusercolor();
  673. break;
  674. case "hanger":
  675. changehanger();
  676. break;
  677. case "tag":
  678. changetag();
  679. break;
  680. case "update":
  681. deletecookie('update');
  682. setcookie('update','true',114514,'/','luogu.com.cn',true);
  683. window.open('https://gfork.zh-tw.eu.org/zh-hans/scripts/487511','_self');
  684. break;
  685. case "content":
  686. update();
  687. break;
  688. case "zb":
  689. zb();
  690. break;
  691. case "engine":
  692. engine();
  693. break;
  694. case "code":
  695. code();
  696. break;
  697. case "not": not();
  698. }
  699. });
  700. }
  701. });
  702. }
  703.  
  704. let nowuid=getcookie('uid');
  705.  
  706. if(nowurl == 'https://www.luogu.com.cn/'){
  707. if(getcookie('hanger')!='null'){
  708. document.querySelector('#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-4.lg-punch.am-text-center > h2 > a').innerHTML += '&nbsp;';
  709. document.querySelector('#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-4.lg-punch.am-text-center > h2 > a').appendChild(_hanger_);
  710. }
  711. if(getcookie('tag')!=''){
  712. document.querySelector('#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-4.lg-punch.am-text-center > h2 > a').innerHTML += '&nbsp;';
  713. document.querySelector('#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-4.lg-punch.am-text-center > h2 > a').appendChild(tag);
  714. }
  715. $('input[name="user"]').keydown(function(e){
  716. if(e.which===13){
  717. let searchusr=$('input[name="user"]').val();
  718. $.get('https://www.luogu.com.cn/api/user/search?keyword=' + searchusr, {}, function (res) {
  719. var users = res['users'];
  720. if(users[0]!=null){
  721. window.open('https://www.luogu.com.cn/user/'+users[0]['uid'].toString(),'_self');
  722. }
  723. });
  724. }
  725. });
  726. }
  727. else if(nowurl.includes('https://www.luogu.com.cn/user/')&&!nowurl.includes('https://www.luogu.com.cn/user/setting')){
  728. let nowurluid='';
  729. for(let i=0;i<nowurl.length;i++){
  730. if(nowurl[i]>='0'&&nowurl[i]<='9') nowurluid+=nowurl[i];
  731. }
  732. let sm=document.querySelector('#app > div.main-container > main > div > div.full-container > section.main > div > div:nth-child(2)');
  733. if(sm!=null){
  734. if(sm.innerHTML.includes('系统维护,该内容暂不可见。')) sm.remove();
  735. }
  736. let jieshao = document.querySelector('#app > div.main-container > main > div > div.full-container > section.main > div > div.introduction.marked');
  737. if(jieshao!=null){
  738. if(jieshao.style.display == 'none') jieshao.removeAttribute('style');
  739. }
  740. let index=document;
  741. const observer = new MutationObserver((mutations) => {
  742. mutations.forEach((mutation) => {
  743. if (mutation.type === 'attributes'){
  744. let sm=document.querySelector('#app > div.main-container > main > div > div.full-container > section.main > div > div:nth-child(2)');
  745. if(sm!=null){
  746. if(sm.innerHTML.includes('系统维护,该内容暂不可见。')) sm.remove();
  747. }
  748. let jieshao = document.querySelector('#app > div.main-container > main > div > div.full-container > section.main > div > div.introduction.marked');
  749. if(jieshao!=null){
  750. if(jieshao.style.display == 'none') jieshao.removeAttribute('style');
  751. }
  752. }
  753. });
  754. });
  755. const config = {
  756. attributes: true,
  757. characterData: true,
  758. childList: true,
  759. subtree: true,
  760. attributeOldValue: true,
  761. characterDataOldValue: true
  762. };
  763. observer.observe(index,config);
  764. }
  765. else if(nowurl.includes('?contestId=')){
  766. let contestID = "";
  767. let contest = nowurl.toString();
  768. for(let i=contest.length-1;i>=0;i--){
  769. if(!(contest[i]>='0'&&contest[i]<='9')) break;
  770. contestID = contest[i] + contestID;
  771. }
  772. let backlist = 'https://www.luogu.com.cn/contest/'+contestID+'#problems';
  773. let backbtn = document.createElement('a');
  774. backbtn.href = backlist;
  775. backbtn.className = 'color-default';
  776. backbtn.innerHTML = '<svg data-v-5a5fcbaa="" data-v-0640126c="" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="right-from-bracket" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-right-from-bracket"><path data-v-5a5fcbaa="" data-v-0640126c="" fill="currentColor" d="M377.9 105.9L500.7 228.7c7.2 7.2 11.3 17.1 11.3 27.3s-4.1 20.1-11.3 27.3L377.9 406.1c-6.4 6.4-15 9.9-24 9.9c-18.7 0-33.9-15.2-33.9-33.9l0-62.1-128 0c-17.7 0-32-14.3-32-32l0-64c0-17.7 14.3-32 32-32l128 0 0-62.1c0-18.7 15.2-33.9 33.9-33.9c9 0 17.6 3.6 24 9.9zM160 96L96 96c-17.7 0-32 14.3-32 32l0 256c0 17.7 14.3 32 32 32l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-64 0c-53 0-96-43-96-96L0 128C0 75 43 32 96 32l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32z" class=""></path></svg>返回题目列表';
  777. let a=document.querySelector('#app > div.main-container > main > div > div > div.side > div:nth-child(2)');
  778. if(a!=null){
  779. a.appendChild(br);
  780. a.appendChild(backbtn);
  781. }
  782.  
  783. }
  784. else if(nowurl.includes('https://www.luogu.com.cn/discuss/')||nowurl.includes('https://www.luogu.com/discuss/')){
  785. let discussID = "";
  786. let flag=1;
  787. let discuss = nowurl.toString();
  788. for(let i=0;i<discuss.length;i++){
  789. if(!(discuss[i]>='0'&&discuss[i]<='9')){
  790. if(flag) continue;
  791. else break;
  792. }
  793. discussID += discuss[i];
  794. flag=0;
  795. }
  796. if(discussID != ""){
  797. let dis = document.createElement('a');
  798. dis.href = 'https://lglg.top/'+discussID;
  799. dis.innerHTML = '<button data-v-505b6a97="" data-v-17e7c5b0="" class="solid lform-size-middle" type="button">在保存站打开</button>';
  800. document.querySelector('#app > div.main-container.lside-nav > main > div > div > div.side > div.l-card > div.btn-actions').appendChild(dis);
  801. }
  802. }
  803. else if(nowurl.includes('https://www.luogu.com.cn/chat')){
  804. let index=document;
  805. let once = true;
  806. let menu = document.createElement('button');
  807. menu.className = 'menu';
  808. menu.style.backgroundColor = 'transparent';
  809. menu.style.border = 'none';
  810. menu.style.float = 'right';
  811. menu.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" style="fill: rgba(0, 0, 0, 1);transform: ;msFilter:;"><path d="M4 6h16v2H4zm0 5h16v2H4zm0 5h16v2H4z"></path></svg>';
  812. const observer = new MutationObserver((mutations) => {
  813. mutations.forEach((mutation) => {
  814. if (mutation.type === 'attributes'){
  815. if(once && document.querySelector('#app > div.main-container > main > div > div.card.wrapper.padding-none > div.main > div > div.top-container > div.title')!=null){
  816. once=false;
  817. document.querySelector('#app > div.main-container > main > div > div.card.wrapper.padding-none > div.main > div > div.top-container > div.title').appendChild(menu);
  818. }
  819. }
  820. });
  821. });
  822. const config = {
  823. attributes: true,
  824. characterData: true,
  825. childList: true,
  826. subtree: true,
  827. attributeOldValue: true,
  828. characterDataOldValue: true
  829. };
  830. observer.observe(index,config);
  831. menu.addEventListener('click', function(){
  832. let chatuser = document.querySelector('#app > div.main-container > main > div > div.card.wrapper.padding-none > div.main > div > div.top-container > div.title > span > span > a > span').textContent;
  833. let chatuid=document.querySelector('#app > div.main-container > main > div > div.card.wrapper.padding-none > div.main > div > div.top-container > div.title > span > span > a').href;
  834. let uid='';
  835. for(let i=chatuid.length-1;i>=0;i--){
  836. if(chatuid[i]>='0'&&chatuid[i]<='9') uid=chatuid[i]+uid;
  837. else break;
  838. }
  839. swal("Better Luogu!",chatuser,{
  840. buttons: {
  841. delete: {
  842. text: "清空私信",
  843. value: "delete"
  844. },
  845. quxiao: {
  846. text: "取消",
  847. value: "cancel"
  848. }
  849. }
  850. })
  851. .then((value)=>{
  852. switch(value){
  853. case 'delete':
  854. deleteChat(uid);
  855. break;
  856. }
  857. });
  858. });
  859. }
  860. else if(nowurl.includes('solution')){
  861. document.querySelector('#app > div.main-container.lside-bar > main > div > div > div.side').remove();
  862. let index=document;
  863. const config = {
  864. attributes: true,
  865. characterData: true,
  866. childList: true,
  867. subtree: true,
  868. attributeOldValue: true,
  869. characterDataOldValue: true
  870. };
  871. const observer = new MutationObserver((mutations) => {
  872. mutations.forEach((mutation) => {
  873. if (mutation.type === 'attributes'){
  874. document.querySelector('#app > div.main-container.lside-bar > main > div > div > div.side').remove();
  875. }
  876. });
  877. });
  878. observer.observe(index,config);
  879. }
  880. document.addEventListener('keydown', function(event){
  881. if(event.altKey && event.key == 's'){
  882. if(search.style.display == 'none'){
  883. search.style.display = 'flex';
  884. showMask();
  885. }
  886. else{
  887. search.style.display = 'none';
  888. search_input.value='';
  889. hideMask();
  890. }
  891. }
  892. });
  893. mask.addEventListener('click',function(){
  894. search.style.display = 'none';
  895. search_input.value='';
  896. hideMask();
  897. });
  898. $('input[name="search"]').keydown(function(e){
  899. if(e.which===13){
  900. let sc=$('input[name="search"]').val();
  901. if(sc!=""){
  902. if(getcookie('engine')=='baidu') window.open('https://www.baidu.com/s?wd=' + sc,'_blank');
  903. else if(getcookie('engine')=='google') window.open('https://mirrorgoogle.us.kg/search?q=' + sc,'_blank');
  904. else if(getcookie('engine')=='bing') window.open('https://cn.bing.com/search?q=' + sc,'_blank');
  905. else window.open(getcookie('engine')+'='+sc,'_blank');
  906. }
  907. }
  908. });
  909. if(document.querySelector('#app > div.main-container.lside-drawer > main > div > div > div.main > div.l-card.reply-editor > div.casket.cs-main.textarea > div.cs-header > div > div:nth-child(1)')!=null){
  910. document.querySelector('#app > div.main-container.lside-drawer > main > div > div > div.main > div.l-card.reply-editor > div.casket.cs-main.textarea > div.cs-header > div > div:nth-child(1)').appendChild(video);
  911. }
  912. if(nowurl.includes('https://www.luogu.com.cn/problem/')&&nowurl.includes('#ide')){
  913. let sfcode=getcookie('code');
  914. if(sfcode=="1"){
  915. let cgqsy=document.createElement('span');
  916. cgqsy.setAttribute('data-v-db920be0','');
  917. cgqsy.setAttribute('data-v-715ac623','');
  918. cgqsy.innerHTML='<span title="更改缺省源" data-v-db920be0=""><span data-v-715ac623="" data-v-db920be0-s="" class="v-popper--has-tooltip" style="cursor: pointer; margin-left: 0.3em;"><svg data-v-715ac623="" data-v-db920be0-s="" class="svg-inline--fa fa-gear" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="gear" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path class="" fill="currentColor" d="M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"></path></svg></span></span>';
  919. let codenav=document.querySelector('#app > div.main-container.lside-nav > div > div.panel.panel-b > div > div.panel.panel-a > div.ide-toolbar > div');
  920. codenav.insertBefore(cgqsy,codenav.firstChild);
  921. cgqsy.addEventListener('click',function(){
  922. let nowcode=document.querySelector('#app > div.main-container.lside-nav > div > div.panel.panel-b > div > div.panel.panel-a > div:nth-child(2) > div > div > div.cm-scroller > div.cm-content.cm-lineWrapping').innerHTML;
  923. localStorage.setItem('code', nowcode);
  924. setcookie('code','0',1919810,'/','luogu.com.cn',true);
  925. swal("Better Luogu!","更改成功","success");
  926. cgqsy.remove();
  927. });
  928. }
  929. else{
  930. let t=document.querySelector('#app > div.main-container > div > div.panel.panel-b > div > div.panel.panel-a > div:nth-child(2) > div > div > div.cm-scroller > div.cm-content.cm-lineWrapping');
  931. let nowcode;
  932. if(t!=null) nowcode=t.innerHTML;
  933. let index=document;
  934. const config = {
  935. attributes: true,
  936. characterData: true,
  937. childList: true,
  938. subtree: true,
  939. attributeOldValue: true,
  940. characterDataOldValue: true
  941. };
  942. const observer = new MutationObserver((mutations) => {
  943. mutations.forEach((mutation) => {
  944. if (mutation.type === 'attributes'){
  945. nowcode=t.innerHTML;
  946. }
  947. });
  948. });
  949. observer.observe(index,config);
  950. if(nowcode=='<div class="cm-activeLine cm-line"><br></div>'){
  951. let incode=localStorage.getItem('code');
  952. document.querySelector('#app > div.main-container > div > div.panel.panel-b > div > div.panel.panel-a > div:nth-child(2) > div > div > div.cm-scroller > div.cm-content.cm-lineWrapping').innerHTML=incode;
  953. }
  954. }
  955. }
  956. let toolbar=document.getElementsByClassName('cs-toolbar-group')[2];
  957. if(toolbar!=null){
  958. let zdk=document.createElement('span');
  959. zdk.className='cs-toolbar-tool';
  960. zdk.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g><path d="M0 0H24V24H0z" fill="none"/><path d="M21 18v2H3v-2h18zM6.596 3.904L8.01 5.318 4.828 8.5l3.182 3.182-1.414 1.414L2 8.5l4.596-4.596zM21 11v2h-9v-2h9zm0-7v2h-9V4h9z"/></g></svg><span class="cs-tooltip">折叠框</span>';
  961. toolbar.appendChild(zdk);
  962. let epigraph=document.createElement('span');
  963. epigraph.className='cs-toolbar-tool';
  964. epigraph.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" fill="none" height="24" viewBox="0 0 24 24" width="24"><path d="M22 18.0048C22 18.5544 21.5544 19 21.0048 19H12.9952C12.4456 19 12 18.5544 12 18.0048C12 17.4552 12.4456 17.0096 12.9952 17.0096H21.0048C21.5544 17.0096 22 17.4552 22 18.0048Z" fill="currentColor"/><path d="M22 12.0002C22 12.5499 21.5544 12.9954 21.0048 12.9954H2.99519C2.44556 12.9954 2 12.5499 2 12.0002C2 11.4506 2.44556 11.0051 2.99519 11.0051H21.0048C21.5544 11.0051 22 11.4506 22 12.0002Z" fill="currentColor"/><path d="M21.0048 6.99039C21.5544 6.99039 22 6.54482 22 5.99519C22 5.44556 21.5544 5 21.0048 5H8.99519C8.44556 5 8 5.44556 8 5.99519C8 6.54482 8.44556 6.99039 8.99519 6.99039H21.0048Z" fill="currentColor"/></svg><span class="cs-tooltip">epigraph</span>'
  965. toolbar.appendChild(epigraph);
  966. let center=document.createElement('span');
  967. center.className='cs-toolbar-tool';
  968. center.innerHTML='<?xml version="1.0"?><svg viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg"><rect fill="none" height="256" width="256"/><path d="M40,76H216a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Z"/><path d="M64,100a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Z"/><path d="M216,140H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"/><path d="M192,180H64a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Z"/></svg><span class="cs-tooltip">居中</span>';
  969. toolbar.appendChild(center);
  970. let right=document.createElement('span');
  971. right.className='cs-toolbar-tool';
  972. right.innerHTML='<?xml version="1.0"?><svg fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M20 5C20.5523 5 21 5.44772 21 6C21 6.55228 20.5523 7 20 7H4C3.44772 7 3 6.55228 3 6C3 5.44772 3.44772 5 4 5H20Z" fill="currentColor"/><path d="M20 9C20.5523 9 21 9.44772 21 10C21 10.5523 20.5523 11 20 11H12C11.4477 11 11 10.5523 11 10C11 9.44772 11.4477 9 12 9H20Z" fill="currentColor"/><path d="M21 14C21 13.4477 20.5523 13 20 13H4C3.44772 13 3 13.4477 3 14C3 14.5523 3.44772 15 4 15H20C20.5523 15 21 14.5523 21 14Z" fill="currentColor"/><path d="M20 17C20.5523 17 21 17.4477 21 18C21 18.5523 20.5523 19 20 19H12C11.4477 19 11 18.5523 11 18C11 17.4477 11.4477 17 12 17H20Z" fill="currentColor"/></svg><span class="cs-tooltip">居右</span>';
  973. toolbar.appendChild(right);
  974. let mb=document.querySelector('body > div.casket');
  975. let p=document.createElement('div');
  976. p.className='cs-dialog-container';
  977. p.innerHTML='<div class="cs-dialog"><div class=""><div class="cs-dialog-header">插入折叠框<div class="cs-close-container"><svg class="svg-inline--fa fa-xmark cs-icon" aria-hidden="true" focusable="false" data-prefix="far" data-icon="xmark" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path class="" fill="currentColor" d="M345 137c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-119 119L73 103c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l119 119L39 375c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l119-119L311 409c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-119-119L345 137z"></path></svg></div></div><div><div class="cs-dialog-item"><div class="cs-dialog-item-label">折叠框类型</div><select class="cs-dialog-item-content"><option value="info">信息</option><option value="warning">警告</option><option value="success">成功</option><option value="error">错误</option></select></div><!----><div class="cs-dialog-submit-area"><button class="cs-dialog-button cs-dialog-button-info">开启自动打开</button><button class="cs-dialog-button cs-dialog-button-info">确认</button><button class="cs-dialog-button cs-dialog-button-info">取消</button></div></div></div><!----></div>';
  978. zdk.addEventListener('click',function(){
  979. mb.appendChild(p);
  980. let close1=document.querySelector('body > div.casket > div > div > div > div.cs-dialog-header > div');
  981. let close2=document.querySelector('body > div.casket > div > div > div > div:nth-child(2) > div.cs-dialog-submit-area > button:nth-child(3)');
  982. let yes=document.querySelector('body > div.casket > div > div > div > div:nth-child(2) > div.cs-dialog-submit-area > button:nth-child(2)');
  983. let autoOpen=document.querySelector('body > div.casket > div > div > div > div:nth-child(2) > div.cs-dialog-submit-area > button:nth-child(1)');
  984. close1.addEventListener('click',function(){p.remove();});
  985. close2.addEventListener('click',function(){p.remove();});
  986. let ao=false;
  987. autoOpen.addEventListener('click',function(){
  988. ao=!ao;
  989. if(ao==true) autoOpen.innerText='关闭自动打开';
  990. else autoOpen.innerText='开启自动打开';
  991. });
  992. yes.addEventListener('click',function(){
  993. let zdklist=document.querySelector('body > div.casket > div > div > div > div:nth-child(2) > div.cs-dialog-item > select');
  994. let zdktype=zdklist.options[zdklist.selectedIndex].value;
  995. p.remove();
  996. let nowline=document.getElementsByClassName('cm-activeLine')[0];
  997. let fline=document.createElement('div');
  998. fline.className='cm-line';
  999. fline.innerText='::::'+zdktype+'[标题]';
  1000. if(ao) fline.innerText+='{open}';
  1001. let sline=document.createElement('div'),tline=document.createElement('div');
  1002. sline.innerText='内容';
  1003. tline.innerText='::::';
  1004. nowline.after(tline);
  1005. nowline.after(sline);
  1006. nowline.after(fline);
  1007. });
  1008. });
  1009. epigraph.addEventListener('click',function(){
  1010. let nowline=document.getElementsByClassName('cm-activeLine')[0];
  1011. let fline=document.createElement('div');
  1012. fline.className='cm-line';
  1013. fline.innerText=':::epigraph[]';
  1014. let sline=document.createElement('div');
  1015. sline.innerText=':::';
  1016. nowline.after(sline);
  1017. nowline.after(fline);
  1018. });
  1019. center.addEventListener('click',function(){
  1020. let nowline=document.getElementsByClassName('cm-activeLine')[0];
  1021. let fline=document.createElement('div');
  1022. fline.className='cm-line';
  1023. fline.innerText=':::align{center}';
  1024. let sline=document.createElement('div');
  1025. sline.innerText=':::';
  1026. nowline.after(sline);
  1027. nowline.after(fline);
  1028. });
  1029. right.addEventListener('click',function(){
  1030. let nowline=document.getElementsByClassName('cm-activeLine')[0];
  1031. let fline=document.createElement('div');
  1032. fline.className='cm-line';
  1033. fline.innerText=':::align{right}';
  1034. let sline=document.createElement('div');
  1035. sline.innerText=':::';
  1036. nowline.after(sline);
  1037. nowline.after(fline);
  1038. });
  1039. }
  1040. }
  1041. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址