USO - add USOa button on userstyle page

Add a link to the copy of the current userstyle on uso.kkx.one

اعتبارا من 03-10-2022. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         USO - add USOa button on userstyle page
// @namespace    github.com/Procyon-b
// @version      0.2.2
// @description  Add a link to the copy of the current userstyle on uso.kkx.one
// @author       Achernar
// @match        https://userstyles.org/styles/*
// @grant        none
// ==/UserScript==

(function() {
"use strict";

var b=document.querySelector('#top-buttons > .left');

const obs=new MutationObserver(function(muts){
  for (let mut of muts) {
    for (let n of mut.addedNodes) {
      b=n && n.querySelector && n.querySelector('#top-buttons > .left');
      if (b) {
        this.disconnect();
        setTimeout(addLink,0);
        return;
        }
      }
    }
  });

if (b) addLink();
else obs.observe(document.body, {attributes: false, subtree: true, childList: true });

function addLink() {
  var L='https://uso.kkx.one/style/'+location.pathname.split('/')[2];
  var e=document.createElement('style');
  b.appendChild(e);
  e.innerText='#USOa {background: #39c739; color: white; text-align: center; order: 9;}';
  e=document.createElement('a');
  b.appendChild(e);
  e.outerHTML='<a href="'+L+'" target="_blank" class="customize_button uninstall_stylish_style_button" id="USOa"><div>Install from USO archive</div></a>';
}

})();