DatPizdiAutoruLZT

Adds a styled button to report bad articles on lolz.live with vertical separation but no line

当前为 2024-08-30 提交的版本,查看 最新版本

// ==UserScript==
// @name         DatPizdiAutoruLZT
// @namespace    http://tampermonkey.net/
// @version      1.8
// @description  Adds a styled button to report bad articles on lolz.live with vertical separation but no line
// @author       Timka251 & eretly
// @match        https://lolz.live/threads/*
// @match        https://zelenka.guru/threads/*
// @icon         https://nztcdn.com/files/f1a0f660-0e67-41aa-bc44-ad644bf1df88.webp
// @grant        none
// @license MIT
// ==/UserScript==
 
(function() {
    'use strict';
 
    // Find the post element by its ID
    const postElement = document.querySelector('li[id^="post-"]'); // Selects the first <li> with an ID starting with "post-"
    if (!postElement) return; // Exit if the element is not found
 
    // Extract the ID from the post element's ID attribute
    const threadId = postElement.id.split('-')[1]; // Splits the ID string and retrieves the number part
 
    // Find the thankAuthorBox element
    const thankAuthorBox = document.querySelector('.thankAuthorBox');
    if (!thankAuthorBox) return; // Exit if element not found
 
    // Create vertical separator container
    const verticalSeparatorContainer = document.createElement('div');
    verticalSeparatorContainer.style.display = 'flex';
    verticalSeparatorContainer.style.flexDirection = 'row';
    verticalSeparatorContainer.style.alignItems = 'flex-start'; // Align items at the top
    verticalSeparatorContainer.style.justifyContent = 'space-between';
 
    // Create and populate left content container
    const leftContentContainer = document.createElement('div');
    leftContentContainer.style.flex = '1';
    while (thankAuthorBox.firstChild) {
        leftContentContainer.appendChild(thankAuthorBox.firstChild);
    }
 
    // Create right content container
    const rightContentContainer = document.createElement('div');
    rightContentContainer.style.flex = '1';
    rightContentContainer.style.marginLeft = '20px';
    rightContentContainer.style.position = 'relative'; // Make it the positioning context
    rightContentContainer.style.padding = '15px 20px'; // Apply padding
 
    // Create new text element with updated styles
    const newTextElement = document.createElement('div');
 
    newTextElement.className = 'thankAuthorTitle';
    newTextElement.style.fontSize = '16px'; // Updated font size
    newTextElement.style.fontWeight = '600'; // Updated font weight
    newTextElement.style.color = '#FFF'; // Updated text color
    newTextElement.textContent = 'Эта статья оказалась хуйнёй?';
    newTextElement.style.position = 'absolute'; // Absolute positioning
    newTextElement.style.top = '0px'; // Align to the top
    newTextElement.style.left = '20px'; // Align to the left (inside padding)
 
    // Create new button element
    const newButtonElement = document.createElement('a');
    newButtonElement.href = `https://lolz.live/posts/${threadId}/report`;
    newButtonElement.style.display = 'inline-flex';
    newButtonElement.style.alignItems = 'center';
    newButtonElement.style.padding = '7.6px';
    newButtonElement.style.backgroundColor = '#333';
    newButtonElement.style.borderRadius = '5px';
    newButtonElement.style.textDecoration = 'none'; // Ensure no underline
    newButtonElement.style.fontSize = '18px';
    newButtonElement.style.marginTop = '10px'; // Margin for separation from text
    newButtonElement.style.position = 'absolute'; // Absolute positioning
    newButtonElement.style.top = '22px'; // Align below the text (15px padding + 16px font size + 10px margin)
    newButtonElement.style.left = '20px'; // Align to the left (inside padding)
 
    // Create and style button icon
    const buttonIcon = document.createElement('img');
    buttonIcon.src = 'https://nztcdn.com/files/f1a0f660-0e67-41aa-bc44-ad644bf1df88.webp';
    buttonIcon.style.width = '20px';
    buttonIcon.style.height = '20px';
    buttonIcon.style.marginRight = '10px';
 
    // Create button text with updated styles
    const buttonText = document.createElement('span');
    buttonText.textContent = 'Дать пизды автору';
    buttonText.style.fontSize = '13px'; // Updated font size
    buttonText.style.color = '#E7F5F5'; // Updated text color
    buttonText.style.textDecoration = 'none'; // Ensure no underline
 
    // Append icon and text to button
    newButtonElement.appendChild(buttonIcon);
    newButtonElement.appendChild(buttonText);
 
    // Append text and button to the right content container
    rightContentContainer.appendChild(newTextElement);
    rightContentContainer.appendChild(newButtonElement);
 
    // Append both containers to vertical separator
    verticalSeparatorContainer.appendChild(leftContentContainer);
    verticalSeparatorContainer.appendChild(rightContentContainer);
 
    // Append vertical separator to thankAuthorBox
    thankAuthorBox.appendChild(verticalSeparatorContainer);
})();