NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name 通天塔只保留翻译结果 // @namespace https://openuserjs.org/users/mikecoding // @version 0.1 // @description 通天塔只保留中文翻译结果 // @author mikecoding // @match https://tongtianta.site/paper/* // @copyright 2021, mikecoding (https://openuserjs.org/users/mikecoding) // @require http://code.jquery.com/jquery-1.11.0.min.js // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; jQuery.fn.wait = function (selector, func, times, interval) { var _times = times || -1, //100次 _interval = interval || 20, //20毫秒每次 _self = this, _selector = selector, //选择器 _iIntervalID; //定时器id if (this.length) { //如果已经获取到了,就直接执行函数 func && func.call(this); } else { _iIntervalID = setInterval(function () { if (!_times) { //是0就退出 clearInterval(_iIntervalID); } _times <= 0 || _times--; //如果是正数就 -- _self = $(_selector); //再次选择 if (_self.length) { //判断是否取到 func && func.call(_self); clearInterval(_iIntervalID); } }, _interval); } return this; } $(".row").wait(".row", function () { console.log("class otc-trade-list 加载成功"); $('<a href="javascript:;" class="chinese"> 只保留中文</a>').appendTo($("div[class^='paper_feedback']")); $(".chinese").click(function () { for (var i = 0; i < document.getElementsByClassName("row").length; i++) { document.getElementsByClassName("row")[i].childNodes[0].style.display = "none" } }); }) })();