cancelBtn

取消离线包图片选中态!

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         cancelBtn
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  取消离线包图片选中态!
// @author       You
// @match        https://yoda.corp.kuaishou.com/*
// @icon         https://www.google.com/s2/favicons?domain=kuaishou.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let cancelBtn = document.createElement('div');
    cancelBtn.innerHTML = "取消图片";
    cancelBtn.className = "yh_cancelBtn";
    cancelBtn.onclick = function(){
        // 模拟点击页面展开符
        const pages = document.querySelectorAll('.tree-checkbox-selection > ul > li > i');
        pages.forEach((item) => {
            item.click();
        });
        // 模拟点击success展开符
        const success = document.querySelectorAll('.tree-checkbox-selection > ul > li > ul > li > i');
        success.forEach((item) => {
            item.click();
        });
        // 模拟点击img展开符
        const imgsTree = document.querySelectorAll('.tree-checkbox-selection > ul > li > ul > li > ul > li:nth-child(4) > .tree-selected');
        imgsTree.forEach((item) => {
            item.children[0].click();
        });
    }
    document.body.appendChild(cancelBtn);
    let style = document.createElement('style');
    style.type = "text/css";
    let styleCon = document.createTextNode(".yh_cancelBtn{position: fixed; right: 0; top: calc(50% - 22px); width: 85px; height: 44px; font-size: 13px; background-color: #ff976a; border-radius: 2px; line-height: 44px; text-align: center; color: #fff;cursor: pointer;}")
    style.appendChild(styleCon);
    let head = document.getElementsByTagName('head')[0];
    head.appendChild(style);
})();