您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Tpad小助手
// ==UserScript== // @name Tapd小助手 // @namespace tapd // @version 0.1.1 // @description Tpad小助手 // @author yaxinliu // @include *://tapd.oa.com/* // @include *://tapd.woa.com/* // @icon http://tapd.oa.com/favicon.ico // @grant none // @run-at document-body // @license Private // ==/UserScript== (function($) { 'use strict'; class DOMNode { constructor (selector) { this.selector = selector this.timmer = null this.triggered = false } onReady(callback) { const self = this document.addEventListener("DOMSubtreeModified", function(event) { const target = event.target if (self.triggered) { return } if (target !== document.querySelector(self.selector)) { return } if (self.timmer) { clearTimeout(self.timmer) } self.timmer = setTimeout(() => { self.triggered = true callback() }, 100) }) } } const className = ".iteration_gird #div_tabs .member-bar" const dom = new DOMNode(className) dom.onReady(function() { const $elem = $(`<div class="member-left-block" style="float: left; margin-top: 10px;"> <div> <a class="font font-unfold fold-operation unfold-all" style="user-select:none;"> 全部展开</a> </div> </div>`) $(className).append($elem) $elem.click(function() { const $this = $(this).find(".fold-operation") console.log($this) // 全部展开 if ($this.hasClass("unfold-all")) { unfoldAll() $this.removeClass("unfold-all font-unfold") .addClass("fold-all font-fold") .html(" 全部折叠") return } // 折叠 foldAll() $this.removeClass("fold-all font-fold") .addClass("unfold-all font-unfold") .html(" 全部展开") }) }) function unfoldAll() { $(".iteration_gird #div_tabs #member_content .member_area .font-unfold").trigger("click") // .each(function(idx, elem) { // console.log(elem) // const code = $(elem).attr("onclick").replace(")", ").bind(elem)()") // eval(code) // }) } function foldAll() { $(".iteration_gird #div_tabs #member_content .member_area .font-fold").trigger("click") } })(window.jQuery);