// ==UserScript== // @name 起点中文网/百度去除推荐/搜索热点列表插件 // @namespace https://greasyfork.org/ // @version 0.2.1 // @description 点击按钮屏蔽百度首页及搜索页面的新闻、热点;屏蔽起点中文网的书籍推荐。 // @author sanjie27 // @match https://book.qidian.com/*/* // @match https://www.qidian.com/ // @match https://www.baidu.com/* // @run-at document_start // @grant unsafeWindow // @grant GM_setClipboard // @grant GM_addStyle // @grant GM_getResourceText // @require https://code.jquery.com/jquery-1.8.2.min.js // @resource http://jqueryui.com/resources/demos/style.css // @resource customCSS https://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; var newCSS = GM_getResourceText ("customCSS"); GM_addStyle (newCSS); //创建按钮并插入 var mybutton = document.createElement("button"); mybutton.innerHTML = ''; $("div:first").before(mybutton); //点击按钮切换 $("button").toggle( function(){ $("li").hide();$("tb").hide();$("h2").hide(); mybutton.innerHTML = ''; $("button").css("background-color","yellow");}, function(){ $("li").show();$("tb").show();$("h2").show(); mybutton.innerHTML = ''; $("button").css("background-color","#c0c0c0");}, ); //创建日期选择框 //var date = ''; //$("div:first").after(date); //$( "#datepicker" ).datepicker(); //实现鼠标点击特效 var html = document.getElementsByTagName("html")[0]; var body = document.getElementsByTagName("body")[0]; html.onclick = function(e) { var $elem = document.createElement("h3"); $elem.style.color = "#87CEEB"; $elem.style.position = "absolute"; var x = e.pageX; var y = e.pageY; $elem.style.left = (x - 10) + "px";//e.pageX是控制位置的 $elem.style.top = (y - 20) + "px"; $elem.innerText = "Great!";//可以自定义显示内容 var increase = 0; setTimeout(function() { var anim = setInterval(function() { if (increase == 150) {//这个是控制去掉elem的时间 clearInterval(anim); body.removeChild($elem); } else{ increase++; $elem.style.opacity = (150 - increase) / 90;//透明度 $elem.style.top = y - 30 - increase + "px";//控制往上面的距离 } }, 5);//控制函数调用的速度,单位是毫妙 }, 70);//给定的毫秒后再调用setInternal函数 body.appendChild($elem); }; })();