去除python123复制出来的多余字符

清理python123拉的屎

目前為 2023-04-11 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         去除python123复制出来的多余字符
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  清理python123拉的屎
// @author       4532
// @match        http://python123.io/student/courses/*/choices*
// @match        https://python123.io/student/courses/*/choices*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
  //创建按钮
    var button = document.createElement("button");
    button.innerText = "移除多余字符";
    button.style.position = "fixed";
    button.style.top = "50%";
    button.style.width = "100px";
    //button.style.height = "50px";
    button.style.left = "80%";
    button.style.transform = "translate(-50%, -50%)";
    button.style.zIndex = "9999";
    document.body.appendChild(button);
  //移除代码
    button.addEventListener("click", function() {
        var watermarkClass = "water-mark is-text-white";
        var elements = document.getElementsByClassName(watermarkClass);
        for (var i = 0; i < elements.length; i++) {
            var element = elements[i];
            element.innerText = "";
        }
    });
 //拖动代码
    var isDragging = false;
    var startX, startY, mouseX, mouseY;
    button.addEventListener("mousedown", function(event) {
        startX = event.clientX;
        startY = event.clientY;
        isDragging = true;
        button.classList.add("dragging");
    });
    button.addEventListener("mouseup", function(event) {
        isDragging = false;
        button.classList.remove("dragging");
    });
    document.addEventListener("mousemove", function(event) {
        if (isDragging) {
            mouseX = event.clientX;
            mouseY = event.clientY;
            var deltaX = mouseX - startX;
            var deltaY = mouseY - startY;
            var left = button.offsetLeft + deltaX;
            var top = button.offsetTop + deltaY;
            button.style.left = left + "px";
            button.style.top = top + "px";
            startX = mouseX;
            startY = mouseY;
        }
    });
})();