Steloization

제 2의 Steloize!

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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;
    }
  }
}