Greasy Fork is available in English.

Samlib Reader

Делает самиздатовские текста более читабельными: смена фона на тёмный, смена шрифта на verdana, смена цвета текста на светлый, текст выровнен по ширине строки, добавлен автоматический перенос слов

Versione datata 11/01/2021. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name Samlib Reader
// @description Делает самиздатовские текста более читабельными: смена фона на тёмный, смена шрифта на verdana, смена цвета текста на светлый, текст выровнен по ширине строки, добавлен автоматический перенос слов
// @copyright 2019, Angens (https://openuserjs.org/users/angens)
// @license MIT
// @version 2.0.3
// @match http://samlib.ru/*/*/*.shtml
// @exclude http://samlib.ru/*/*/index*.shtml
// @exclude http://samlib.ru/*/*/stat.shtml
// @grant none
// @namespace https://greasyfork.org/users/386214
// ==/UserScript==
//
// ==OpenUserJS==
// @author angens
// ==/OpenUserJS==



function changer(){

  document.querySelector("body").setAttribute("lang", "ru");
  document.querySelector("body").setAttribute("style", "-moz-hyphens: auto; -webkit-hyphens: auto; -ms-hyphens: auto; white-space: unset;");

  let treeWalker = document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, null, false);
  let description = document.createElement('div');
  description.id = "SamLibReaderDescription";
  let commnts = [];
  
  // Блок работы с комментариями
  //Ищем последний комментарий
  while (treeWalker.nextNode()){
    if (treeWalker.currentNode.nodeType === 8) 
      commnts.push(treeWalker.currentNode);
    if (commnts.length == 16) //Когда нужный комментарий найден, собираем дочерние элементы(это должно быть описание)
      //desc_nodes.push(treeWalker.currentNode);
      while(treeWalker.currentNode.nextSibling){
        description.append(treeWalker.currentNode.nextSibling);
      }
  }
  
  // Блок работы с произведением
  let nodes = document.querySelectorAll("dd, p");

  let new_element = document.createElement('div');

  new_element.id = "SamLibReader";
  new_element.style.color = "wheat";
  new_element.style.fontSize = "18px";
  new_element.style.fontFamily = "verdana";
  new_element.style.backgroundColor = "#212127";
  new_element.style.paddingTop = "5%";
  new_element.style.paddingLeft = "5%";
  new_element.style.paddingRight = "5%";
  new_element.style.marginLeft = "25%";
  new_element.style.marginRight = "25%";
  new_element.style.textAlign = "justify";
  
  if(nodes[0])
    nodes[0].parentElement.insertBefore(new_element, nodes[0]);

  for (let i = 0; i < nodes.length; i++){
    new_element.append(nodes[i]);
  }
  
  
  document.body.append(description);
}


document.addEventListener("DOMContentLoaded", changer());