DPRA-ify

Singing praises to our Beloved Sun of the Rocky Mountains, Donald J. Trump, Supreme Leader to the Democratic People's Republic of America.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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.

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.

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

// ==UserScript==
// @name        DPRA-ify
// @namespace   io.github.poneyclairdelune.dpra
// @match       https://whitehouse.gov/*
// @match       https://www.whitehouse.gov/*
// @run-at      document-idle
// @grant       none
// @version     0.0.3
// @author      Lumière Élevé
// @homepageURL https://github.com/PoneyClairDeLune/DPRA-ify
// @supportURL  https://github.com/PoneyClairDeLune/DPRA-ify/issues
// @description Singing praises to our Beloved Sun of the Rocky Mountains, Donald J. Trump, Supreme Leader to the Democratic People's Republic of America.
// @license     WTFPL
// ==/UserScript==
"use strict";(()=>{let h=class{isMatch=!1;pos=0;data;constructor(e,a,t){this.isMatch=e,this.pos=a,this.data=t}},m=class extends Array{constructor(...e){super(...e)}static sorter(e,a){return e.pos-a.pos}sort(e){e||(e=m.sorter),super.sort(e)}},M=class{static buildMatchCache(e){let a={};for(let t of e)a[t]=!0;return a}static match(e,a){let t=new m;for(let s in a){let r=0,n=0,p=-1;do{let d=e.substring(r).indexOf(s),c=d+r;if(d===-1)break;if(c==p)break;t.push(new h(!0,c,s)),r+=d+s.length,p=c,n++}while(r>=0&&r<e.length&&n<16)}t.sort();let o=t.length,l=0;for(let s=0;s<o;s++){let r=t[s];t.push(new h(!1,l,e.substring(l,r.pos))),l=r.pos+r.data.length}return l+1!==e.length&&t.push(new h(!1,l,e.substring(l))),t.sort(),t}},g=M;let x=`p>span.dpra-text,li>span.dpra-text{font-size:1.5rem;font-weight:550;text-decoration:underline 2px}strong>span.dpra-text{font-size:1.5rem}
`;let i={"Donald ":"Donald","J. ":"J.","Trump ":"Trump","Vice ":"Second to","US ":"DPRA","U.S. ":"D.P.R.A.","United States ":"Democratic People's Republic","United States of America ":"Democratic People's Republic of America","President ":[["","Our"],["","Great","Supreme","Beloved","Dear","Glorious","Graceful","Selfless","Strong-willed"],["","Great","Supreme","Beloved","Dear","Glorious","Graceful","Selfless","Strong-willed"],["Leader","Comrade","General","Commander","Marshal","Sun of Mt. Paektu","Rising Sun of the Rocky Mountains","Shining Star of the Appalachian Mountains","Child of God","God","Saviour"]]};let b=[];for(let e in i)b.push(e);for(let e of b)switch(e){case"US ":case"U.S. ":case"Donald ":case"J. ":case"Trump ":break;case"President ":{i[e.toUpperCase()]=i[e];break}default:i[e.toUpperCase()]=i[e],i[e.toLowerCase()]=i[e]}let w=(e,a=1)=>{switch(typeof i[e]){case"string":return i[e];case"object":{let t=[],o=Math.floor(Math.random()*a);for(let l=0;l<=o;l++){let s=[];for(let r of i[e]){let n=r[Math.floor(Math.random()*r.length)];n?.length>0&&s.push(n)}t.push(s.join(" "))}return t.join(", ")}}};(()=>{let e=document.createElement("style");e.classList.add("dpra-css"),e.innerHTML=x,document.head.append(e)})();let S=async()=>{let e=[];for(let a of document.querySelectorAll("p, a, h1, h2, h3, h4, h5, h6, li, strong")){let t=!1;for(let o of a.childNodes){if(o.nodeType===3){for(let l in i)if(o.data.indexOf(l)!==-1&&(t=!0),t)break}if(t)break}t&&e.push(a)}for(let a of e){let t=[];for(let o of a.childNodes)t.push(o);for(;a.childNodes.length>0;)a.childNodes[0].remove();for(let o of t)if(o.nodeType===3){let l=g.match(o.data,i);for(let s of l)if(s.isMatch){let r=document.createElement("span");switch(location.href.indexOf("/articles/")!==-1&&r.classList.add("dpra-text"),s.data){case"President ":case"PRESIDENT ":{r.append(`${w(s.data,4)} `);break}default:r.append(`${w(s.data)} `)}a.append(r)}else a.append(document.createTextNode(s.data))}else a.append(o)}};S();let u=0,f=0,O=setInterval(async()=>{if(u>0)u--;else return;if(f>0){f--;return}else f=4;await S()},200);document.body.addEventListener("mouseup",async e=>{switch(e.srcElement.localName){case"a":{u=4;break}}});})();