油猴脚本,优化json格式化页面
// ==UserScript==
// @name 去除jc页面多余部分
// @namespace https://gitee.com/jasmine
// @version 1.0.0
// @description 去除json.cn页面多余部分以及广告
// @author jasmine
// @match https://www.json.cn/
// @grant none
// ==/UserScript==
(function() {
'use strict';
console.log("...人类清除计划,开始!...");
window.onload = function(){
console.log("111");
var element = document.body;
//删除方法一、将元素设置成none
document.getElementsByClassName("header")[0].style.display="none";
//删除方法二、父元素直接removeChild
element.removeChild(document.getElementsByClassName("container")[0]);
console.log("222");
//删除方法三、先找自己,然以在找父元素,调用removeChild
var delToolAd = document.getElementsByClassName("tool")[0].getElementsByTagName("ul")[0];
var delToolAdParent = delToolAd.parentElement;
delToolAdParent.removeChild(delToolAd);
//删除页脚
var delFootAd = document.getElementsByClassName("container")[0];
var delFootAdParent = delFootAd.parentElement;
delFootAdParent.removeChild(delFootAd);
console.log("333");
//修改json显示区域的paddingTop
//document.getElementById("#right-box").style.paddingTop="0px";
//console.log("444");
//去掉页脚
document.getElementsByTagName("main")[0].style.height="-webkit-fill-available";
console.log("555");
}
})();
关闭手机号弹窗
// ==UserScript==
// @name dohko关闭手机号弹窗
// @namespace https://gitee.com/jasmine
// @version 1.0.0
// @description dohko关闭手机号弹窗
// @author jasmine
// @match -
// @icon -
// @grant none
// ==/UserScript==
(function() {
'use strict';
console.log("...人类清除计划,开始!...");
window.onload = function(){
//延时2s执行
setTimeout(function(){
var phoneDialog = document.getElementsByClass("ant-modal-mask")[0].parentElement;
var phoneDialogParent = phoneDialog.parentElement;
phoneDialogParent.removeChild(phoneDialog);
},"2000");
}
})();
bing搜索批量打开检索结果
首先得设置浏览器,设置==》安全==》网站设置==》弹窗重定向==》允许发送弹出式窗口并使用重定向,中添加 https://cn.bing.com
// ==UserScript==
// @name 批量打开bing检索链接
// @namespace https://gitee.com/jasmine
// @version 0.1
// @description 批量打开bing检索链接
// @author jasmine
// @match https://cn.bing.com/search*
// @grant none
// @require http://code.jquery.com/jquery-3.x-git.min.js
/* globals jQuery, $, waitForKeyElements */
// ==/UserScript==
(function() {
'use strict';
console.log("...人类清除计划,开始!...");
const f = () => {
var pil = document.createElement('input');
pil.id="btn_sjn";
pil.type="button";
pil.value="打开全部";
let org = document.getElementById('sb_form')
org.appendChild(pil)
}
f()
document.getElementById('btn_sjn').onclick = function(){
var list = [...document.getElementsByClassName("b_algo")];
for (let i = 0; i < list.length; i++) {
if(list[i].querySelector('a')!=null){
(function(){
window.open(list[i].querySelector('a').href)
})(i)
}
}
}
})();
百度版本
// ==UserScript==
// @name 批量打开百度检索链接
// @namespace https://gitee.com/jasmine
// @version 0.1
// @description 批量打开百度检索链接
// @author jasmine
// @match https://www.baidu.com/s*
// @grant none
// @require http://code.jquery.com/jquery-3.x-git.min.js
/* globals jQuery, $, waitForKeyElements */
// ==/UserScript==
(function() {
'use strict';
console.log("...人类清除计划,开始!...");
const f = () => {
var pil = document.createElement('input');
pil.id="btn_sjn";
pil.type="button";
pil.value="打开全部";
let org = document.getElementById('form')
org.appendChild(pil)
}
f()
document.getElementById('btn_sjn').onclick = function(){
var list = [...document.getElementsByClassName("tts-title")];
for (let i = 0; i < list.length; i++) {
if(list[i].querySelector('a')!=null){
(function(){
window.open(list[i].querySelector('a').href)
})(i)
}
}
}
})();