Halo Editor To Rtl

ئاساسلىقى Halo رامكىسىنىڭ سۈكۈتتىكى تەھرىرلىگۈچىنى ئۇيغۇرچىغا ماسلاشتۇرۇش ئۈچۈن ئىشلىتىتلىدۇ.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Halo Editor To Rtl
// @namespace    editorRtl
// @version      1.0.0
// @description  ئاساسلىقى Halo رامكىسىنىڭ سۈكۈتتىكى تەھرىرلىگۈچىنى ئۇيغۇرچىغا ماسلاشتۇرۇش ئۈچۈن ئىشلىتىتلىدۇ.
// @author       ئابدۇكېرېم غۇجابدۇللا
// @homepage     https://www.darwish.top/
// @match       */console/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant        none
// @license      AGPL-3.0-or-later
// ==/UserScript==

(function() {
    // Function to toggle button text and append ID
    function toggleTextAndId() {
        var button = document.getElementById('myButton');
        var targetElement = document.querySelector('.editor.border-t');
        var contentElement = document.querySelector('.editor-content.markdown-body.flex-1.relative.bg-white.overflow-y-auto');
        var bgWhiteElement = document.querySelector('.h-full.border-l.bg-white');

        if (button.textContent === 'RTL') {
            button.textContent = 'LTR';
            // Append 'ugStyle' to the existing ID of the target element
            targetElement.id += 'ugStyle';
            // Add font-family rule to the content element
            contentElement.style.fontFamily = "'UKIJ Ekran'";
            // Change border width property
            bgWhiteElement.style.borderRightWidth = '1px';
            bgWhiteElement.style.borderLeftWidth = '0'; // Reset border-left-width
        } else {
            button.textContent = 'RTL';
            // Remove 'ugStyle' from the ID of the target element
            targetElement.id = targetElement.id.replace('ugStyle', '').trim();
            // Remove font-family rule from the content element
            contentElement.style.fontFamily = '';
            // Reset border width property
            bgWhiteElement.style.borderLeftWidth = '1px';
            bgWhiteElement.style.borderRightWidth = '0'; // Reset border-right-width
        }
    }

    // Create a link element for the main stylesheet
    var mainLink = document.createElement('link');
    mainLink.rel = 'stylesheet';
    mainLink.type = 'text/css';
    mainLink.href = 'https://www.darwish.top/themes/theme-Joe3/assets/css/ugStyle.css';
    document.head.appendChild(mainLink);

    // Create a style element for additional CSS rules
    var style = document.createElement('style');
    var css = '#myButton { padding:10px 15px;color:#ffffff; position: fixed; bottom: 20px; right: 20px; z-index: 9999;background-color: #056b00;border-radius: 22px; }';
    style.appendChild(document.createTextNode(css));
    document.head.appendChild(style);

    // Create a button element
    var button = document.createElement('button');
    button.textContent = 'RTL';
    button.id = 'myButton';
    button.onclick = toggleTextAndId; // Add event listener to toggle button text and ID
    document.body.appendChild(button);
})();