[洛谷]美化

洛谷美化指南

\(\color{pink}\mathbf{大家好,相比很多洛谷党都觉得洛谷的界面特别单一(丑陋)。 }\)

\(\color{red}\mathbf{那我们就可以借助一下这个东西:Tampermonkey。(注:在扩展商店里搜索英文名)}\)

1.安装“篡改猴Tampermonkey”

网址:Tampermonkey

2.安装脚本:氢洛谷

下载脚本:氢洛谷脚本

如果无法打开,使用一下代码复制到篡改猴的添加脚本(兼容性差)

// ==UserScript==
// @name          氢洛谷
// @namespace     http://userstyles.org
// @description	  洛谷美化
// @author        陈春昊
// @homepage      https://userstyles.org/styles/174057
// @run-at        document-start
// @version       0.20190922030246
// ==/UserScript==
(function() {var css = "";
if (false || (new RegExp("^https://www\\.luogu(\\.org|\\.com\\.cn)/(?!blog).*$")).test(document.location.href))
	css += [
		".main-container .lfe-body {",
		"    background-image: url(https://s1.ax1x.com/2018/02/25/9w99XR.jpg);",
		"    background-repeat: no-repeat;",
		"    background-size: cover;",
		"    background-position: center;",
		"    background-attachment: fixed;",
		"}",
		"",
		"#app > .lfe-body > a {",
		"    color: rgb(55, 152, 255) !important;",
		"    height: 3.7em;",
		"    margin-top: 3px;",
		"}",
		"#app > .lfe-body > a > .icon {",
		"    line-height: 2.4em;",
		"    font-size: 20px;",
		"    width: 100%;",
		"    margin: 0 !important;",
		"    transition: all 0.3s ease;",
		"}",
		"#app > .lfe-body > a > .text {",
		"    opacity: 0;",
		"    margin-top: -1em;",
		"    display: block;",
		"    transition: all 0.3s ease;",
		"}",
		"#app > .lfe-body > a:hover > .icon {",
		"    line-height: 1.5em;",
		"    font-size: 17px;",
		"}",
		"#app > .lfe-body > a:hover > .text {",
		"    opacity: 1;",
		"    margin-top: 0.2em;",
		"}",
		"",
		".am-input-group {",
		"    transition: box-shadow .15s ease;",
		"    border: none;",
		"    border-radius: .5rem !important;",
		"}",
		".am-form-field {",
		"    border: none;",
		"    border-radius: .5rem !important;",
		"    box-shadow: 0 1px 3px rgba(50, 50, 93, .15), 0 1px 0 rgba(0, 0, 0, .02);",
		"}",
		".am-form-field:focus {",
		"    box-shadow: 0 4px 6px rgba(50, 50, 93, .08), 0 1px 3px rgba(0, 0, 0, .05) !important;",
		"}",
		".am-input-group-sm > .am-form-field,",
		".am-input-group-sm > .am-input-group-btn > .am-btn,",
		".am-input-group-sm > .am-input-group-label {",
		"    font-size: 1.35rem!important;",
		"}",
		".am-input-group-label {",
		"    background: transparent;",
		"    border: none;",
		"}",
		".am-input-group-danger,",
		".am-input-group-primary {",
		"    box-shadow: none;",
		"}",
		".am-input-group-danger > .am-input-group-label,",
		".am-input-group-primary > .am-input-group-label {",
		"    border-radius: .5rem !important;",
		"    outline: none !important;",
		"    letter-spacing: .05em;",
		"    transition: all .15s ease;",
		"    box-shadow: 0 4px 6px rgba(50, 50, 93, .11), 0 1px 3px rgba(0, 0, 0, .08);",
		"    color: #fff !important;",
		"    margin-bottom: 6px;",
		"    height: 33.4px;",
		"}",
		".am-input-group-danger > .am-input-group-label:hover,",
		".am-input-group-primary > .am-input-group-label:hover {",
		"    box-shadow: 0 7px 14px rgba(50, 50, 93, .1), 0 3px 6px rgba(0, 0, 0, .08);",
		"}",
		".am-input-group-danger > .am-input-group-label:active,",
		".am-input-group-primary > .am-input-group-label:active {",
		"    box-shadow: none;",
		"}",
		".am-input-group-danger > .am-input-group-label {",
		"    border-color: #f5365c;",
		"    background-color: #ec0c38;",
		"}",
		".am-input-group-primary > .am-input-group-label {",
		"    border-color: #5e72e4;",
		"    background-color: #5e72e4;",
		"    border-radius: .5rem !important;",
		"}",
		"textarea {",
		"    box-shadow: 0 1px 3px rgba(50, 50, 93, .15), 0 1px 0 rgba(0, 0, 0, .02);",
		"    border: none !important;",
		"}",
		"textarea:focus {",
		"    box-shadow: 0 4px 6px rgba(50, 50, 93, .08), 0 1px 3px rgba(0, 0, 0, .05) !important;",
		"}",
		".lg-input-title {",
		"    margin-bottom: 5px;",
		"    border-radius: 5px;",
		"    border-color: #ddd;",
		"}",
		"",
		"#topbar-search-text {",
		"    border-radius: .5rem 0 0 .5em !important;",
		"}",
		"#topbar-search {",
		"    border-radius: 0 .5rem .5em 0 !important;",
		"    border-color: #5e72e4;",
		"    background-color: #5e72e4;",
		"}",
		"",
		".lg-article,",
		".lg-summary,",
		".lg-article-sub {",
		"    transition: all .15s ease;",
		"    box-shadow: 0 5px 15px rgba(50, 50, 93, .1), 0 5px 8px rgba(0, 0, 0, .07)!important;",
		"    word-wrap: break-word;",
		"    border-radius: .25rem;",
		"}",
		".lg-article:hover,",
		".lg-summary:hover,",
		".lg-article-sub:hover {",
		"    box-shadow: 0 10px 30px rgba(50, 50, 93, .1), 0 5px 15px rgba(0, 0, 0, .07)!important;",
		"}",
		"",
		".am-btn {",
		"    outline: none !important;",
		"    border: none !important;",
		"    letter-spacing: .05em;",
		"    padding: 8px 18px;",
		"    transition: all .15s ease;",
		"    box-shadow: 0 4px 6px rgba(50, 50, 93, .11), 0 1px 3px rgba(0, 0, 0, .08);",
		"    color: #fff !important;",
		"    margin-bottom: 6px;",
		"}",
		".lg-main-content.solution-block {",
		"    margin-top: 0 !important;",
		"}",
		".am-btn:hover {",
		"    box-shadow: 0 7px 14px rgba(50, 50, 93, .1), 0 3px 6px rgba(0, 0, 0, .08);",
		"    transform: translateY(-1px);",
		"}",
		".am-btn:active {",
		"    box-shadow: none;",
		"}",
		".am-btn-danger,",
		".am-btn-danger:hover,",
		".am-btn-danger:active,",
		".am-btn-danger:focus,",
		".am-btn-danger:visited {",
		"    border-color: #f5365c;",
		"    background-color: #ec0c38;",
		"}",
		".am-btn-primary,",
		".am-btn-primary:hover,",
		".am-btn-primary:active,",
		".am-btn-primary:focus,",
		"a.am-btn-primary:visited {",
		"    border-color: #5e72e4;",
		"    background-color: #5e72e4;",
		"}",
		".am-btn-success,",
		".am-btn-success:hover,",
		".am-btn-success:active,",
		".am-btn-success:focus,",
		"a.am-btn-success:visited {",
		"    border-color: #2dce89;",
		"    background-color: #2dce89;",
		"}",
		".am-btn-warning,",
		".am-btn-warning:hover,",
		".am-btn-warning:active,",
		".am-btn-warning:focus,",
		"a.am-btn-warning:visited {",
		"    border-color: #fb6340;",
		"    background-color: #fb6340;",
		"}",
		"",
		".am-badge {",
		"    border-radius: 50px !important;",
		"    padding-left: 10px;",
		"    padding-right: 10px;",
		"    padding-top: 4px;",
		"    padding-bottom: 4px;",
		"    transition: all .15s;",
		"}",
		".am-badge:hover {",
		"    transform: translateY(-1px);",
		"    box-shadow: 0 4px 6px rgba(50, 50, 93, .11), 0 1px 3px rgba(0, 0, 0, .08);",
		"}",
		".am-badge.lg-bg-red {",
		"    background-color: #f80031;",
		"}",
		".am-badge.lg-bg-orange {",
		"    background-color: #ff471d;",
		"}",
		".am-badge.lg-bg-yellow {",
		"    background-color: #ff9d09;",
		"}",
		".am-badge.lg-bg-green {",
		"    background-color: #1aae6f;",
		"}",
		".am-badge.lg-bg-bluelight {",
		"    background-color: #03acca;",
		"}",
		".am-badge.lg-bg-purple {",
		"    background-color: #8e44ad;",
		"}",
		".am-badge.lg-bg-bluedark {",
		"    background-color: #001277;",
		"}",
		".am-badge.am-badge-warning {",
		"    background-color: #fb6340;",
		"}"
	].join("\n");
if (false || (new RegExp("^https://www\\.luogu(\\.org|\\.com\\.cn)/(?!blog).*$")).test(document.location.href))
	css += [
		".lg-article {",
		"    background-color: rgba(255, 255, 255, 0.85);",
		"}",
		".lfe-form-sz-middle {",
		"    transition: 0.2s;",
		"}",
		".copy-btn:hover {",
		"    color: white !important;",
		"    background-color: rgb(52, 152, 219) !important;",
		"}",
		"a {",
		"    transition: 0.3s;",
		"}",
		".card {",
		"    transition: 0.3s;",
		"    opacity: 0.85;",
		"    border-radius: 5px;",
		"}",
		".lg-contact-right:hover {",
		"    background-color: rgba(255, 255, 255, 0);",
		"}",
		".lg-contact-right a:hover,",
		".lg-contact-right span:hover,",
		".lg-contact-left:hover {",
		"    background-color: rgba(255, 255, 255, 0);",
		"}",
		".am-table-striped>tbody>tr:nth-child(odd)>td,",
		".am-table-striped>tbody>tr:nth-child(odd)>th {",
		"    background-color: rgba(255, 255, 255, 0.7);",
		"}",
		"#app > .lfe-body > div:first-child {",
		"    background-color: rgb(55, 152, 255) !important;",
		"}",
		"#app > .lfe-body {",
		"    background-color: white !important;",
		"}",
		".popup-button {",
		"    color: rgb(55, 152, 255) !important;",
		"}",
		".lfe-caption {",
		"    border-radius: 10px !important;",
		"    transition: 0.3s;",
		"}",
		".lfe-caption:hover {",
		"    transform: translate(0, -2px);",
		"}",
		".items li {",
		"    transition: background-color 0.3s !important;",
		"}",
		".items li:hover {",
		"    background-color: rgb(55, 152, 255);",
		"    color: white;",
		"}",
		"button {",
		"    transition: 0.3s;",
		"}",
		".test-case {",
		"    border-radius: 5px;",
		"    transition: 0.3s;",
		"}",
		".test-case:hover {",
		"    transform: translate(0, -3px);",
		"}",
		"a[data-v-a580f5e6] {",
		"    padding: 0 0 !important;",
		"}"
	].join("\n");
if (typeof GM_addStyle != "undefined") {
	GM_addStyle(css);
} else if (typeof PRO_addStyle != "undefined") {
	PRO_addStyle(css);
} else if (typeof addStyle != "undefined") {
	addStyle(css);
} else {
	var node = document.createElement("style");
	node.type = "text/css";
	node.appendChild(document.createTextNode(css));
	var heads = document.getElementsByTagName("head");
	if (heads.length > 0) {
		heads[0].appendChild(node);
	} else {
		// no head yet, stick it whereever
		document.documentElement.appendChild(node);
	}
}
})();

3.安装脚本:洛谷点击特效

将一下代码复制到篡改猴的添加脚本

// ==UserScript==
// @name         鼠标点击特效
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.luogu.com.cn/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    // Your code here...
function clickEffect() {
  let balls = [];
  let longPressed = false;
  let longPress;
  let multiplier = 0;
  let width, height;
  let origin;
  let normal;
  let ctx;
  const colours = ["#F73859", "#14FFEC", "#00E0FF", "#FF99FE", "#FAF15D"];
  const canvas = document.createElement("canvas");
  document.body.appendChild(canvas);
  canvas.setAttribute("style", "width: 100%; height: 100%; top: 0; left: 0; z-index: 99999; position: fixed; pointer-events: none;");
  const pointer = document.createElement("span");
  pointer.classList.add("pointer");
  document.body.appendChild(pointer);

  if (canvas.getContext && window.addEventListener) {
    ctx = canvas.getContext("2d");
    updateSize();
    window.addEventListener('resize', updateSize, false);
    loop();
    window.addEventListener("mousedown", function(e) {
      pushBalls(randBetween(10, 20), e.clientX, e.clientY);
      document.body.classList.add("is-pressed");
      longPress = setTimeout(function(){
        document.body.classList.add("is-longpress");
        longPressed = true;
      }, 500);
    }, false);
    window.addEventListener("mouseup", function(e) {
      clearInterval(longPress);
      if (longPressed == true) {
        document.body.classList.remove("is-longpress");
        pushBalls(randBetween(50 + Math.ceil(multiplier), 100 + Math.ceil(multiplier)), e.clientX, e.clientY);
        longPressed = false;
      }
      document.body.classList.remove("is-pressed");
    }, false);
    window.addEventListener("mousemove", function(e) {
      let x = e.clientX;
      let y = e.clientY;
      pointer.style.top = y + "px";
      pointer.style.left = x + "px";
    }, false);
  } else {
    console.log("canvas or addEventListener is unsupported!");
  }


  function updateSize() {
    canvas.width = window.innerWidth * 2;
    canvas.height = window.innerHeight * 2;
    canvas.style.width = window.innerWidth + 'px';
    canvas.style.height = window.innerHeight + 'px';
    ctx.scale(2, 2);
    width = (canvas.width = window.innerWidth);
    height = (canvas.height = window.innerHeight);
    origin = {
      x: width / 2,
      y: height / 2
    };
    normal = {
      x: width / 2,
      y: height / 2
    };
  }
  class Ball {
    constructor(x = origin.x, y = origin.y) {
      this.x = x;
      this.y = y;
      this.angle = Math.PI * 2 * Math.random();
      if (longPressed == true) {
        this.multiplier = randBetween(14 + multiplier, 15 + multiplier);
      } else {
        this.multiplier = randBetween(6, 12);
      }
      this.vx = (this.multiplier + Math.random() * 0.5) * Math.cos(this.angle);
      this.vy = (this.multiplier + Math.random() * 0.5) * Math.sin(this.angle);
      this.r = randBetween(8, 12) + 3 * Math.random();
      this.color = colours[Math.floor(Math.random() * colours.length)];
    }
    update() {
      this.x += this.vx - normal.x;
      this.y += this.vy - normal.y;
      normal.x = -2 / window.innerWidth * Math.sin(this.angle);
      normal.y = -2 / window.innerHeight * Math.cos(this.angle);
      this.r -= 0.3;
      this.vx *= 0.9;
      this.vy *= 0.9;
    }
  }

  function pushBalls(count = 1, x = origin.x, y = origin.y) {
    for (let i = 0; i < count; i++) {
      balls.push(new Ball(x, y));
    }
  }

  function randBetween(min, max) {
    return Math.floor(Math.random() * max) + min;
  }

  function loop() {
    ctx.fillStyle = "rgba(255, 255, 255, 0)";
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    for (let i = 0; i < balls.length; i++) {
      let b = balls[i];
      if (b.r < 0) continue;
      ctx.fillStyle = b.color;
      ctx.beginPath();
      ctx.arc(b.x, b.y, b.r, 0, Math.PI * 2, false);
      ctx.fill();
      b.update();
    }
    if (longPressed == true) {
      multiplier += 0.2;
    } else if (!longPressed && multiplier >= 0) {
      multiplier -= 0.4;
    }
    removeBall();
    requestAnimationFrame(loop);
  }

  function removeBall() {
    for (let i = 0; i < balls.length; i++) {
      let b = balls[i];
      if (b.x + b.r < 0 || b.x - b.r > width || b.y + b.r < 0 || b.y - b.r > height || b.r < 0) {
        balls.splice(i, 1);
      }
    }
  }
}
clickEffect();//调用特效函数


})();

长按有惊喜

posted @ 2024-01-28 11:42  橙子来了吖  阅读(1350)  评论(0)    收藏  举报