da userblogs abgeschafft wurden, und Ich auf JSP fremde seiten in meiner sig nicht linken darf (?), hier das aktuelle userscript das mit den ""designverbesserungen"" wieder funktioniert.
am ende des posts wie gewohnt als pastebin.
gerne konstruktiv diskutieren oder bugs direkt hier im thread melden.
lg kathi
Code
// ==UserScript==
// @name dpuqb - d2jsp Post und Query Blocker / Lapdance http://forums.d2jsp.org/topic.php?t=70135916&f=149&o=60
// @version 2.1.0
// @namespace postblocker
// @match http://forums.d2jsp.org/topic.php?t=*&f=*
// @match https://forums.d2jsp.org/topic.php?t=*&f=*
// @match http://forums.d2jsp.org/topic.php?t=*
// @match https://forums.d2jsp.org/topic.php?t=*
// @match http://forums.d2jsp.org/forum.php?f=*
// @match https://forums.d2jsp.org/forum.php?f=*
// @match http://forums.d2jsp.org/track.php
// @match https://forums.d2jsp.org/track.php
// @match http://forums.d2jsp.org/guild.php?t=*
// @match https://forums.d2jsp.org/guild.php?t=*
// @author Lapdance => Prophets
// @description Remove all posts and quotes from users on d2jsp
// @homepage https://forums.d2jsp.org/topic.php?t=70135916&f=149
// @icon http://i.imgur.com/lt2jblX.png
// @grant GM_deleteValue
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_listValues
// ==/UserScript==
//changelog
/*
v2.1.0
stoopid ui update forced adjustments
also rewrite the whole shebang once more cause why not
v2.0.5
remove notification and body changing styles
v2.0.4
remove notification-display, thanks njag..
v2.0.3
added body width 100vw style, thanks njag..
v2.0.2
alter includes, get specific here, add https includes
credit to 0x00 ( http://forums.d2jsp.org/user.php?i=1081064 )
v2.0.1
init
*/
var gmKick = GM_listValues();
console.log("blocked users:", gmKick);
//dont use docready! just do it.
addBlockLinks();
addStyles();
kickPosts();
kickThreads();
buildOptions();
function addBlockLinks() {
let posts = document.querySelectorAll("body > form > dl > dd > .ppc");
//console.log("posts", posts);
posts.forEach(post => {
let userColumn = post.querySelector(".pU");
let userLink = userColumn.querySelector("div > a");
let userLinkContainer = userLink.closest("div");
let userLinkWithId = userLink.getAttribute('href');
let userName = userLink.text;
//console.log(userLink, userLinkWithId);
let blockThread = document.createElement("a");
blockThread.classList.add("blockUserInThread");
blockThread.text = "--thread";
blockThread.addEventListener("click", () => { blockUser(userLinkWithId, userName, getLocation()); });
let blockGlobal = document.createElement("a");
blockGlobal.classList.add("blockUserGlobal");
blockGlobal.addEventListener("click", () => { blockUser(userLinkWithId, userName); });
blockGlobal.text = "--global";
let blockContainer = document.createElement("div");
blockContainer.classList.add("blockContainer");
blockContainer.append(blockThread);
blockContainer.append(document.createElement("div").text = " / ");
blockContainer.append(blockGlobal);
userLinkContainer.append(blockContainer);
});
}
function addStyles() {
var s = document.createElement("style");
var css = "" +
".blockContainer { margin: 4px; padding: 4px; font-size: 10px; }" +
".optionsContainer { display: none; position: fixed; padding: 20px; width: 750px; max-width: 80vw; height: 500px; max-height: 80vh; left: 50%; top: 0; overflow-y: auto; background-color: #ddd; color: #333; z-index: 9001; border-top: none; border-bottom-right-radius: 10px; border-bottom-left-radius: 10px; border: 1px solid #333; transform: translate(-50%); }" +
".optionsContainer.show { display: block; } " +
".closeOptions { position: absolute; right: 0; top: 0; padding: 8px; font-size: 16px; cursor: pointer; }" +
".unblockUser { display: inline-block; margin: 8px; padding: 4px; border: 1px solid black; border-radius: 2px; cursor: pointer; }" +
"";
s.innerHTML = css;
document.querySelector("head").append(s);
}
function getLocation() {
var loc = window.location.href;
if (loc.indexOf("&o=") > -1) {
loc = loc.split("&o=")[0];
}
return loc;
}
function blockUser(userLinkWidthId, userName, location = undefined) {
if(location) {
if(confirm("Block " + userName + "@" + location + "?")) {
_blockUser(userLinkWidthId, userName, location);
}
} else {
if(confirm("Block " + userName + "?")) {
_blockUser(userLinkWidthId, userName, location);
}
}
}
function _blockUser(userLinkWithId, userName, location) {
if(location) {
GM_setValue(userName + "@" + location, 1);
window.location.reload();
return;
}
GM_setValue(userName, 1);
window.location.reload();
}
function kickPosts() {
if(gmKick.indexOf("chkremovePosts") < 0) {
return;
}
gmKick.forEach(entry => {
if(entry.indexOf("@") > -1) {
// location blocker
if(window.location.href.indexOf(entry.split("@")[1]) > -1) {
_kickPostsForUser(entry.split("@")[0])
}
} else {
// global blocker
_kickPostsForUser(entry)
}
});
}
function _kickPostsForUser(userName) {
let postUserLinks = document.querySelectorAll("body > form > dl > dd > .ppc > .pU > div > a");
postUserLinks.forEach(post => {
if(post.text == userName) {
post.closest("dl").remove();
}
});
}
function kickThreads() {
if(gmKick.indexOf("chkremoveThreads") < 0) {
console.log("chkremoveThreads -1");
return;
}
gmKick.forEach(entry => {
if(entry.indexOf("@") > -1) {
return;
}
let threadsUserLinks = document.querySelectorAll("body > dl > dd > table > tbody > tr > td:nth-child(3) > a");
console.log(threadsUserLinks);
threadsUserLinks.forEach(thread => {
if(thread.text == entry) {
thread.closest('tr').remove();
}
});
});
}
function buildOptions() {
//
let toggleOptions = document.createElement("li");
let toggleOptionsA = document.createElement("a");
toggleOptionsA.classList.add("showOptions");
toggleOptionsA.innerHTML = "Postblocker";
toggleOptionsA.addEventListener("click", () => { _showBlocklist(); });
toggleOptions.append(toggleOptionsA);
document.querySelector(".hbR").prepend(toggleOptions);
//
let hiddenDiv = document.createElement("div");
hiddenDiv.classList.add("optionsContainer");
//
let closeHiddenDiv = document.createElement("div");
closeHiddenDiv.classList.add("closeOptions");
closeHiddenDiv.innerHTML = "X";
closeHiddenDiv.addEventListener("click", () => { _hideBlocklist(); });
hiddenDiv.append(closeHiddenDiv);
//
let options = document.createElement("ul");
options.classList.add("dqupb-options");
[
"chkremovePosts", "chkremoveThreads",
//"chkenableToggleRemovedQuotes", "chkPassAufDasKartenhausVonAndreasAuf", "chkDubs"
].forEach(optn => {
let optnElement = document.createElement("li");
let optnElementCheckbox = document.createElement("label");
optnElementCheckbox.setAttribute("for", optn);
optnElementCheckbox.innerHTML = optn;
let _optnElementCheckbox = document.createElement("input");
_optnElementCheckbox.id = optn;
_optnElementCheckbox.type = "checkbox";
_optnElementCheckbox.checked = gmKick.indexOf(optn) > -1;
_optnElementCheckbox.addEventListener("change", (event) => {
if(event.target.checked) {
GM_setValue(optn, 1);
} else {
GM_deleteValue(optn);
}
});
optnElementCheckbox.prepend(_optnElementCheckbox);
optnElement.append(optnElementCheckbox);
options.append(optnElement);
});
hiddenDiv.append(options);
//
let msg = document.createElement("div");
msg.innerHTML = "click to remove";
hiddenDiv.append(msg);
//
let optionsDiv = document.createElement("div");
optionsDiv.classList.add("optionsDiv");
gmKick.forEach(entry => {
if (
entry != "chkremovePosts" &&
entry != "chkremoveThreads" &&
entry != "chkenableToggleRemovedQuotes" &&
entry != "chkPassAufDasKartenhausVonAndreasAuf" &&
entry != "chkDubs"
) {
let entryDiv = document.createElement("div");
entryDiv.classList.add("unblockUser");
entryDiv.innerHTML = entry;
entryDiv.id = "qpuqb-" + muuid();
entryDiv.addEventListener("click", () => { _unblockUser(entry, entryDiv.id); });
optionsDiv.append(entryDiv);
}
});
hiddenDiv.append(optionsDiv);
document.querySelector("body").append(hiddenDiv);
}
function _unblockUser(entry, id) {
GM_deleteValue(entry, 0);
document.querySelector("#" + id).remove();
}
function _showBlocklist() {
document.querySelector(".optionsContainer").classList.add("show");
};
function _hideBlocklist() {
document.querySelector(".optionsContainer").classList.remove("show");
document.location.reload();
}
function muuid() {
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));
}
https://pastebin.com/9Z8uHbGP