Steloization

제 2의 Steloize!

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Steloization
// @namespace    https://tampermonkey.net/
// @version      1.1
// @description  제 2의 Steloize!
// @author       You
// @match        https://openuserjs.org/user/add/scripts/new
// @icon         https://www.google.com/s2/favicons?domain=openuserjs.org
// @grant        none
// @copyright    2021, 나무스튜
// @license      MIT
// @include      *://*/*
// ==/UserScript==

fetch("https://szmanager.prnm789.repl.co/fontface")
.then(function(res){
    return res.text();
})
.then(function(data){
    var newstyletag = document.createElement("style");
    var newstyle = document.createTextNode(data);
    newstyletag.appendChild(newstyle);
    document.body.appendChild(newstyletag);
});

setInterval(load, 500);

function load() {
  var elems = document.querySelectorAll(".se-text-paragraph > span, p:not(.se-text-paragraph), h2, h3, strong.tit, strong.title, a.tit, a.article > span.inner, span.tx > span");
  var reg = /(\|\|)(.+?)(\|)(.+?)(\|\|)/;

  for (let elem of elems) {
    if (reg.test(elem.innerText)) {
      let oldtext = elem.innerText;
      let font = oldtext.match(/(\|\|)(.+?)(\|)/)[0].substr(2).slice(0, -1);
      let newtext = oldtext.replace(/(\|\|)(.+?)(\|)/, '<span style="font-family: \'' + font + '\', sans-serif">');
      newtext = newtext.replace('||', '</span>');
      elem.innerHTML = newtext;
    }
  }
}