Greasy Fork

Greasy Fork is available in English.

知乎、掘金外链直转

2023/9/20 21:55:23

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        知乎、掘金外链直转
// @namespace   https://github.com/jin-lin0/tampermonkey-demo
// @version     0.5
// @description 2023/9/20 21:55:23
// @author      logyes
// @license MIT

// @run-at       document-start

// @match       *://link.zhihu.com/*
// @match       *://link.juejin.cn/*
// @grant       none

// ==/UserScript==

(function () {
  "use strict";
  const targetUrl = document.URL.split("target=")[1];
  let decodeTargetUrl = decodeURIComponent(targetUrl);
  window.location.href = decodeTargetUrl;

  let loadingElement = document.createElement("div");
  loadingElement.classList.add("loading");

  document.body.innerHTML = "";
  document.body.appendChild(loadingElement);

  let styleElement = document.createElement("style");
  styleElement.innerHTML = `
    body{
        display: flex;
        justify-content: center;
    }

    .loading{
        width: 100px;
        height: 100px;
        background: 
        radial-gradient( closest-side circle, royalblue 99%, transparent 100%) center top/25% 25% no-repeat,
        conic-gradient(transparent 10%, royalblue 90%);
        -webkit-mask: radial-gradient( closest-side circle, transparent 50%, red 51% 99%, transparent 100%);
        animation: rotate 1s linear infinite;
    }

    @keyframes rotate{
        to{
            transform: rotate(360deg);
        }
    }
  `;
  document.head.appendChild(styleElement);
})();