百度搜索结果 百度百科图标不要播放视频

百度搜索结果 百度百科图标不要播放视频,还改回弹出百度百科页面

目前为 2020-05-08 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 百度搜索结果 百度百科图标不要播放视频
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4
  5. // @description 百度搜索结果 百度百科图标不要播放视频,还改回弹出百度百科页面
  6. // @author 别问我是谁请叫我雷锋
  7. // @license BSD-3-Clause https://opensource.org/licenses/BSD-3-Clause
  8. // @match https://www.baidu.com/*
  9. // @match https://baike.baidu.com/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. 'use strict';
  14. if (location.host != "baike.baidu.com") {
  15.  
  16. jQuery.fn.wait = function (func, times, interval) {
  17. var _times = times || -1, //100次
  18. _interval = interval || 20, //20毫秒每次
  19. _self = this,
  20. _selector = this.selector, //选择器
  21. _iIntervalID; //定时器id
  22. if( this.length ){ //如果已经获取到了,就直接执行函数
  23. func && func.call(this);
  24. } else {
  25. _iIntervalID = setInterval(function() {
  26. if(!_times) { //是0就退出
  27. clearInterval(_iIntervalID);
  28. }
  29. _times <= 0 || _times--; //如果是正数就 --
  30.  
  31. _self = $(_selector); //再次选择
  32. if( _self.length ) { //判断是否取到
  33. func && func.call(_self);
  34. clearInterval(_iIntervalID);
  35. }
  36. }, _interval);
  37. }
  38. return this;
  39. }
  40.  
  41. $(".op-bk-polysemy-icon").wait(function () {
  42. let div = $(".op-bk-polysemy-icon").parent().clone();
  43. let url = $(".op-bk-polysemy-icon").parent().attr("data-url");
  44. if ($(".op-bk-polysemy-icon").prev().length > 0) {
  45. div.css("pointer-events", "none");
  46. div.html("<img src='" + $(".op-bk-polysemy-icon").prev().css("background").substring($(".op-bk-polysemy-icon").prev().css("background").indexOf("\""), $(".op-bk-polysemy-icon").prev().css("background").lastIndexOf("\"")).replace('"', '') + "' />");
  47. $(".op-bk-polysemy-icon").parent().parent().html("<a href='" + url + "' target='_blank' >" + div.prop("outerHTML") + "</a>");
  48. }
  49. })
  50.  
  51. $("#wrapper_wrapper").bind("DOMSubtreeModified" , function () {
  52. let div = $(".op-bk-polysemy-icon").parent().clone();
  53. let url = $(".op-bk-polysemy-icon").parent().attr("data-url");
  54. if ($(".op-bk-polysemy-icon").prev().length > 0) {
  55. div.css("pointer-events", "none");
  56. div.html("<img src='" + $(".op-bk-polysemy-icon").prev().css("background").substring($(".op-bk-polysemy-icon").prev().css("background").indexOf("\""), $(".op-bk-polysemy-icon").prev().css("background").lastIndexOf("\"")).replace('"', '') + "' />");
  57. $(".op-bk-polysemy-icon").parent().parent().html("<a href='" + url + "' target='_blank' >" + div.prop("outerHTML") + "</a>");
  58. }
  59. })
  60.  
  61.  
  62.  
  63. } else {
  64. if (location.search.lastIndexOf("secondId") > 0) { location.href = location.href.substring(0, location.href.lastIndexOf('?')) }
  65. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址