diff --git a/p0weruser.dev.user.js b/p0weruser.dev.user.js index 04a6f47..accec3a 100644 --- a/p0weruser.dev.user.js +++ b/p0weruser.dev.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name p0weruser - Rel0aded [Dev] // @namespace https://github.com/Scarwolf/p0weruser/ -// @version 2.10.2-dev-1718130314332 +// @version 2.10.3-dev-1718130609184 // @author PoTTii - Created by Florian Maak // @description A modularized userScript for pr0gramm.com - Developed by FlorianMaak, Modified by Scarwolf // @license GPL-3.0; http://www.gnu.org/licenses/gpl-3.0.txt @@ -96,7 +96,7 @@ var Es=Object.defineProperty;var Ss=(ae,J,se)=>J in ae?Es(ae,J,{enumerable:!0,co `,Mi=`#inbox-link{position:relative}#inbox-link.active{color:var(--theme-main-color)}#notification-center{display:none;position:absolute;top:52px;right:0px;z-index:100;border:3px solid #2a2e31;background-color:#161618;box-shadow:2px 0 10px #000;min-width:300px;max-height:50vh;flex-direction:column;overflow-y:scroll}#notification-center.visible{display:flex}#notification-center>div{padding:10px;text-align:center;border-top:1px solid #252525}#notification-center #new-messages{padding-left:10px;margin:0}#notification-center #new-messages.loading{text-align:center;justify-content:center;padding:10px}#notification-center #new-messages.loading .fa-spin{font-size:24px}#notification-center #new-messages .simplebar-scrollbar{background:#2a2e31;right:0;border-radius:0}#notification-center #new-messages .simplebar-scrollbar.visible{opacity:1}#notification-center #new-messages li{align-items:center;justify-content:center;display:flex;opacity:.5}#notification-center #new-messages li:not(:last-child){border-bottom:1px solid #252525}#notification-center #new-messages li:hover{opacity:1}#notification-center #new-messages li:hover .headline{color:var(--theme-main-color)}#notification-center #new-messages li.new{opacity:1}#notification-center #new-messages li.new .message:before{content:"\\f0e0"}#notification-center #new-messages li.no-notifications{text-align:center;width:100%;padding:10px}#notification-center #new-messages li .headline{color:#fff;font-weight:700}#notification-center #new-messages li .comment-thumb{height:42px;width:42px}#notification-center #new-messages li .content{padding:10px;flex-grow:1}#notification-center #new-messages li .content small{display:block;font-size:12px;font-weight:400;color:#666}#notification-center #new-messages li .content .time{float:right}#notification-center #new-messages li .content .text{text-overflow:ellipsis;max-width:200px;color:#666;white-space:nowrap;overflow:hidden}#notification-center #new-messages li .content span{font-size:12px}#notification-center #new-messages li .message{width:42px;margin-left:4px;font-size:34px;margin-right:-4px} `;class rt{constructor(){d(this,"id","NotificationCenter");d(this,"name","Nachrichten Schnellzugriff");d(this,"description","\xD6ffnet neue Benachrichtigungen in einem kleinen Men\xFC");d(this,"showUnreadMessages",x.get("NotificationCenter.settings.show_unread_messages"));d(this,"menuOpen",!1);d(this,"icon",$("#inbox-link"));d(this,"elem",document.createElement("div"));d(this,"messageContainer",null)}static getTitle(n){return n.thumb===null?"Private Nachricht":"Kommentar"}async load(){this.elem.innerHTML=Ai,this.elem.id="notification-center",document.querySelectorAll(".user-info.user-only")[0].appendChild(this.elem),this.messageContainer=document.getElementById("new-messages"),this.addListener(),j(Mi)}getSettings(){return[{id:"show_unread_messages",title:"Ungelesene Nachrichten Anzeigen",description:"Zeigt auch ungelesene Nachrichten an, es werden allerdings nur gelesene hervorgehoben",type:"checkbox"}]}addListener(){this.icon.unbind("click"),this.icon[0].addEventListener("click",n=>{n.preventDefault(),n.stopPropagation(),this.toggleMenu()}),window.addEventListener("click",n=>{this.menuOpen&&($(n.target).parents("#notification-center")[0]||(n.preventDefault(),this.toggleMenu()))})}toggleMenu(){this.menuOpen=!this.menuOpen,this.icon[0].classList.toggle("active"),this.elem.classList.toggle("visible");const n=this.messageContainer;n&&(n.innerHTML='',n.classList.add("loading"),this.getNotifications(!0).then(t=>{let i=t.messages,o=i.filter(a=>!a.read).length;if(n.innerHTML="",n.classList.remove("loading"),p.user.setInboxLink({notifications:0,mentions:0,messages:0,comments:0,follows:0,digests:0}),o<=0){let a=document.createElement("li");if(a.innerText="Keine neuen Benachrichtigungen!",a.className="no-notifications",n.appendChild(a),!this.showUnreadMessages)return!1}i.filter(a=>a.message!==null).forEach(a=>{this.addEntry(rt.getTitle(a),a.name,a.created,a.thumb,a.mark,a.itemId,a.id,a.message,a.read)})}))}getNotifications(n=!1){return new Promise((t,i)=>{p.api.get(n?"inbox.all":"inbox.conversations",{},t,i)})}addEntry(n,t,i,o,a,c,s,m,r){var g;const l=document.createElement("li");l.id=`notification-${s}`;let b='';const h=t===null,f=o?`/new/${c}:comment${s}`:h?"/inbox/notifications":`/inbox/messages/${t}`;o?b=b.replace("##THUMB",o):b='',h&&(n="Systembenachrichtigung",t="Systembenachrichtigung"),l.innerHTML=Ni.replace("##TITLE##",n).replace("##USER##",t).replace("##TIME##",new Intl.DateTimeFormat("de-DE",{dateStyle:"medium",timeStyle:"short"}).format(new Date(i*1e3))).replace("##THUMB##",b).replace("##URL##",f).replace("##MARK##",a).replace("##TEXT##",G.escapeHtml(m)),$(l).on("click",I=>{I.preventDefault();const _=$(I.target).closest("a").first().attr("href");_&&(this.menuOpen&&this.toggleMenu(),p.navigateTo(_.substring(1)))}),r||l.classList.add("new"),(g=this.messageContainer)==null||g.appendChild(l)}}const $i=`.repost-link{margin-left:15px}.repost-link .fa{color:#f2f5f4;margin-right:5px}.rep0sts{width:33vw;background-color:#161618;border-left:3px solid #2a2e31;overflow-y:auto;overflow-x:clip;height:100%}.rep0sts .sidebar-head{display:flex;align-items:center;background-color:#2a2e31;text-align:left;padding:10px;transition:width .2s ease-out;z-index:400;width:30vw;margin-left:-10px}.rep0sts .sidebar-head .sidebar-label{margin-left:5px}.rep0sts .sidebar-head .close{cursor:pointer;position:fixed;right:10px}.rep0sts a{display:block;margin-bottom:5px;position:relative}.rep0sts a img{max-width:100%}.rep0sts a span{position:absolute;left:5px;bottom:10px;text-shadow:1px 1px 0px black;color:#f2f5f4}.rep0sts a span:hover{color:#75c0c7}.item-container .loader{font-size:45px;margin-top:30px;width:15vw}.probability{position:absolute;top:5px;right:5px;font-weight:700;color:red}.probability:hover{color:#fff;background-color:#2a2e31;border-radius:10px;padding:2px 10px} -`;class Bi{constructor(){d(this,"closeBtn",{});d(this,"id","Rep0st");d(this,"name","Rep0st Check");d(this,"description","Frage rene8888, ob es sich um einen rep0st handelt.");d(this,"visible",!1);d(this,"$loader")}async load(){let n=this;p.View.Stream.Item=p.View.Stream.Item.extend({show:function(t,i,o,a){this.parent(t,i,o,a),n.addButton(this.$container)},remove:function(){this.parent(),n.visible=!1}}),G.addVideoConstants(),j($i)}addButton(n){const t=n.find('.item-image-actual:not([src*=".gif"])');if(this.$loader=$(''),t[0]&&t[0].tagName!=="VIDEO"){const i=$(' rep0st?');n.find(".item-details .user").after(i),i[0].addEventListener("click",()=>{this.visible||this.checkImage(n,t)})}}checkImage(n,t){let i=new FormData,o=$("
"),a=$('
'),c=$(''),s=$('');c.append(s),a.append(c),a.append(this.$loader),n.find(".image-main").after(a),s[0].addEventListener("click",()=>{this.visible=!1,a.remove()}),i.append("image",new Blob([],{type:"application/octet-stream"}),""),i.append("url",t[0].src);let m=p.user.flagsName.split("+");m=m.indexOf("all")!==-1?["sfw","nsfw","nsfl","nsfp","pol"]:m;for(const r of m)i.append("flag",r);at({url:"https://rep0st.rene8888.at/",method:"POST",headers:{"cache-control":"no-cache","Upgrade-Insecure-Requests":"1",Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"},overrideMimeType:"multipart/form-data",data:i,onload:r=>{let l=[];this.visible=!0,this.$loader.remove(),o.html(r.responseText);const b=o.find(".search-results a");let h=this.getCurrentPostId();for(let f=1;f${i.probability}`;n.append($(`${o}`)).find(`a[href='${i.url}'] > .fa.fa-comment`)[0].addEventListener("click",s=>{s.preventDefault();let m=$(document.body);const r=`Re: ${i.url}`;let l=m.find(".comment:not(.reply)"),b=m.find(".tag-form");l[0].value=r,l.parent().find('input[type="submit"]')[0].click(),b.find(".item-tagsinput")[0].value="repost",b.find('input[type="submit"]').click()})}}}class ct{constructor(){d(this,"id","RepostMarker");d(this,"name","Repost Markierung");d(this,"description","Markiert Reposts in der \xDCbersicht")}static markRepost(n){let t=document.getElementById("item-"+n);t&&t.classList.add("repost")}async load(){}async loadReposts(n){const t=await new Promise((i,o)=>{p.api.get("items.get",{...n,tags:"repost"},i,o)});for(const i of t.items)ct.markRepost(i.id)}}class Fi{constructor(){d(this,"id","StatisticsLinkInNavbar");d(this,"name","Link to Statistics");d(this,"description","(Pr0mium) Verlinkt in der Navigation-Bar rechts oben auf die neue Statistik-Seite");d(this,"target",document.getElementsByClassName("user-info user-only")[0])}async load(){this.addStatsLink()}addStatsLink(){let n=document.createElement("a"),t=document.createTextNode("Statistiken");n.classList.add("head-link"),n.id="user-link-stats",n.appendChild(t),n.setAttribute("href","https://pr0gramm.com/userstats"),n.setAttribute("style","margin-left: 8px"),this.target.appendChild(n)}}const Di=`.transparent#head{width:100%!important;display:flex;justify-content:center;background-color:#000000e6}@supports (backdrop-filter: blur()){.transparent#head{background-color:#00000094!important;backdrop-filter:blur(30px)}}.transparent#head #head-content{background-color:transparent;width:1052px} +`;class Bi{constructor(){d(this,"closeBtn",{});d(this,"id","Rep0st");d(this,"name","Rep0st Check");d(this,"description","Frage rene8888, ob es sich um einen rep0st handelt.");d(this,"visible",!1);d(this,"$loader")}async load(){let n=this;p.View.Stream.Item=p.View.Stream.Item.extend({show:function(t,i,o,a){this.parent(t,i,o,a),n.addButton(this.$container)},remove:function(){this.parent(),n.visible=!1}}),G.addVideoConstants(),j($i)}addButton(n){const t=n.find('.item-image-actual:not([src*=".gif"])');if(this.$loader=$(''),t[0]&&t[0].tagName!=="VIDEO"){const i=$(' rep0st?');n.find(".item-details .user").after(i),i[0].addEventListener("click",()=>{this.visible||this.checkImage(n,t)})}}checkImage(n,t){let i=new FormData,o=$("
"),a=$('
'),c=$(''),s=$('');c.append(s),a.append(c),a.append(this.$loader),n.find(".image-main").after(a),s[0].addEventListener("click",()=>{this.visible=!1,a.remove()}),i.append("image",new Blob([],{type:"application/octet-stream"}),""),i.append("url",t[0].src);let m=p.user.flagsName.split("+");m=m.indexOf("all")!==-1?["sfw","nsfw","nsfl","nsfp","pol"]:m;for(const r of m)i.append("flags",r);at({url:"https://rep0st.rene8888.at/",method:"POST",headers:{"cache-control":"no-cache","Upgrade-Insecure-Requests":"1",Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"},overrideMimeType:"multipart/form-data",data:i,onload:r=>{let l=[];this.visible=!0,this.$loader.remove(),o.html(r.responseText);const b=o.find(".search-results a");let h=this.getCurrentPostId();for(let f=1;f${i.probability}`;n.append($(`${o}`)).find(`a[href='${i.url}'] > .fa.fa-comment`)[0].addEventListener("click",s=>{s.preventDefault();let m=$(document.body);const r=`Re: ${i.url}`;let l=m.find(".comment:not(.reply)"),b=m.find(".tag-form");l[0].value=r,l.parent().find('input[type="submit"]')[0].click(),b.find(".item-tagsinput")[0].value="repost",b.find('input[type="submit"]').click()})}}}class ct{constructor(){d(this,"id","RepostMarker");d(this,"name","Repost Markierung");d(this,"description","Markiert Reposts in der \xDCbersicht")}static markRepost(n){let t=document.getElementById("item-"+n);t&&t.classList.add("repost")}async load(){}async loadReposts(n){const t=await new Promise((i,o)=>{p.api.get("items.get",{...n,tags:"repost"},i,o)});for(const i of t.items)ct.markRepost(i.id)}}class Fi{constructor(){d(this,"id","StatisticsLinkInNavbar");d(this,"name","Link to Statistics");d(this,"description","(Pr0mium) Verlinkt in der Navigation-Bar rechts oben auf die neue Statistik-Seite");d(this,"target",document.getElementsByClassName("user-info user-only")[0])}async load(){this.addStatsLink()}addStatsLink(){let n=document.createElement("a"),t=document.createTextNode("Statistiken");n.classList.add("head-link"),n.id="user-link-stats",n.appendChild(t),n.setAttribute("href","https://pr0gramm.com/userstats"),n.setAttribute("style","margin-left: 8px"),this.target.appendChild(n)}}const Di=`.transparent#head{width:100%!important;display:flex;justify-content:center;background-color:#000000e6}@supports (backdrop-filter: blur()){.transparent#head{background-color:#00000094!important;backdrop-filter:blur(30px)}}.transparent#head #head-content{background-color:transparent;width:1052px} `;class Ri{constructor(){d(this,"id","StyleCustomization");d(this,"name","Stilisierung");d(this,"description","Einzelne Styleanpassungen");d(this,"isTransparentNavbarEnabled",x.get(`${this.id}.settings.transparent_navbar`));d(this,"hideBenis",x.get(`${this.id}.settings.hide_benis`,!1))}async load(){var n;if(this.isTransparentNavbarEnabled===!0&&((n=document.getElementById("head"))==null||n.classList.add("transparent")),j(Di),this.hideBenis===!0){const t=document.createElement("style");t.innerText=` .score, .user-score { color: transparent;