Masnavi Mobile

Makes reading masnavi.net easier on mobile

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Masnavi Mobile
// @description  Makes reading masnavi.net easier on mobile
// @version      1.2
// @grant        none
// @include      http://masnavi.net/*
// @license      MIT
// @namespace https://greasyfork.org/users/1463653
// ==/UserScript==


document.getElementsByClassName("border-container")[0].style.border = "0px" 

const divs = document.querySelectorAll('div');

divs.forEach(div => {
  if (div.style.width === '75%') {
    div.style.width = "100%";
  }
  
  div.style.border = "0px";
});



function replaceDoubleAsterisksWithBr(element) {
  element.childNodes.forEach(node => {
    if (node.nodeType === Node.TEXT_NODE) {
      const parts = node.textContent.split('**');
      if (parts.length > 1) {
        const fragment = document.createDocumentFragment();
        parts.forEach((part, index) => {
          fragment.appendChild(document.createTextNode(part));
          if (index < parts.length - 1) {
            fragment.appendChild(document.createElement('br'));
          }
        });
        node.replaceWith(fragment);
      }
    } else if (node.nodeType === Node.ELEMENT_NODE) {
      replaceDoubleAsterisksWithBr(node);
    }
  });
}

replaceDoubleAsterisksWithBr(document.body);