经常更新集合

[持续更新] 程序猿的油猴有用脚本

2022-02-11  本文已影响0人  逆水寒Stephen

油猴工具墙裂建议使用FeHelper里面的油猴,FeHelper是一个强大的集成插件工具,就一个字,爽!!

FeHelper油猴截图,网址匹配可按自己的来,如果看到网页无效,可用FeHelper里面的正则插件测试好了再填进来

网页猴子名称:个性化修改百度logo,屏蔽百度右边的热搜,避免被干扰
网址匹配规则:/http(s)?://www.baidu.com(.)*/
网页自动刷新:不自动刷新
依赖第三方js:无

效果图,红框处原来有分散精力的热搜,箭头处可换成你自己的个性logo
(() => {
  function hideFun(){
    $('#content_right').delay(1000).hide(0)
  }
  
  $('#s_lg_img').attr('src','https://upload.jianshu.io/users/upload_avatars/11559288/06c82f8c-f29e-4010-b456-bbb1e9b4e46e?imageMogr2/auto-> orient/strip|imageView2/1/w/240/h/240')
  $('#s_lg_img_new').attr('src','https://upload.jianshu.io/users/upload_avatars/11559288/06c82f8c-f29e-4010-b456-bbb1e9b4e46e?imageMogr2/auto-orient/strip|imageView2/1/w/240/h/240')
  $('#s_lg_img_aging').attr('src','https://upload.jianshu.io/users/upload_avatars/11559288/06c82f8c-f29e-4010-b456-bbb1e9b4e46e?imageMogr2/auto-orient/strip|imageView2/1/w/240/h/240')
  $('.index-logo-src').attr('src','https://upload.jianshu.io/users/upload_avatars/11559288/06c82f8c-f29e-4010-b456-bbb1e9b4e46e?imageMogr2/auto-orient/strip|imageView2/1/w/240/h/240')
  $('.index-logo-srcnew').attr('src','https://upload.jianshu.io/users/upload_avatars/11559288/06c82f8c-f29e-4010-b456-bbb1e9b4e46e?imageMogr2/auto-orient/strip|imageView2/1/w/240/h/240')
  $('.index-logo-peak').attr('src','https://upload.jianshu.io/users/upload_avatars/11559288/06c82f8c-f29e-4010-b456-bbb1e9b4e46e?imageMogr2/auto-orient/strip|imageView2/1/w/240/h/240')
  hideFun()
  $('#wrapper').bind("DOMNodeInserted",function(e){
    hideFun()
  })
})();

网页猴子名称:屏蔽简书的感情瓜皮故事和部分讨厌广告
网址匹配规则:/http(s)?://www.jianshu.com(.)*/
网页自动刷新:不自动刷新
依赖第三方js:https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js

效果图,1、2、3原来是有广告处,4原来是有辣鸡故事处
(() => {
    function hideFun(){
      $("h3:contains('热门故事')").delay(1000).hide(0)//去掉感情瓜皮故事
      $("h3:contains('热门故事')").siblings().delay(1000).hide(0)
      $.map($("section"), function(item){//去广告
        if($(item).attr("aria-label") ? -1 != $(item).attr("aria-label").indexOf("-ad") : false)$(item).delay(1000).hide(0)
      });
    }
  
    hideFun()
    $("aside").bind("DOMNodeInserted",function(e){
      hideFun()
    })
})();

网页猴子名称:非常漂亮的自定义光影文字,可插入任何网页中
网址匹配规则:/http(s)?://trace.qeeyou.cn(:)?(\d)*/(zentaopms/www/user-login.html){1}/
网页自动刷新:不自动刷新
依赖第三方js:无

效果图
var txt = " WELCOME STEPHEN ";
var txtH = 150;
var font = "sans-serif";
var bg = "#000";
var rayColor1 = "#e0f7fa";
var rayColor2 = "#18ffff";
var velocity = 10;
 
var canvasMe = document.createElement("canvasMe");
canvasMe.style.width = "800px";
canvasMe.style.height = "500px";
document.body.appendChild(canvasMe);
var canvas = document.createElement("canvas");
canvasMe.appendChild(canvas);
var ctx = canvas.getContext("2d");
var cw = canvas.width = window.innerWidth-200;
var ch = canvas.height = window.innerHeight-300;
 
var w2 = cw/2;
var h2 = ch/2;
var pi = Math.PI;
var pi2 = pi*.5;
 
var txtCanvas = document.createElement("canvas");
var txtCtx = txtCanvas.getContext("2d");
txtCtx.font = txtH + "px " + font;
txtCtx.textBaseline = "middle";
var txtW = Math.floor(txtCtx.measureText(txt).width);
txtCanvas.width = txtW;
txtCanvas.height = txtH*1.5;
 
var gradient = ctx.createRadialGradient(w2, h2, 0, w2, h2, txtW);
gradient.addColorStop(0, rayColor2);
gradient.addColorStop(1, rayColor1);
ctx.strokeStyle = gradient;
 
txtCtx.fillStyle = gradient;
txtCtx.font = txtH + "px " + font;
txtCtx.textBaseline = "middle";
txtCtx.fillText(txt,0,txtH*.5);
 
//dirty adjust for descends
txtH *= 1.5;
 
var bufferCanvas = document.createElement("canvas");
bufferCanvas.width = txtW;
bufferCanvas.height = txtH;
var buffer = bufferCanvas.getContext("2d");
 
//text start position
var sx = (cw-txtW)*0.5
var sy = (ch-txtH)*0.5
 
var rays = [];
var txtData = txtCtx.getImageData(0,0,txtW,txtH);
for (var i = 0; i < txtData.data.length; i+=4) {
  var ii = i/4;
  var row = Math.floor(ii/txtW)
  var col = ii%txtW
  var alpha = txtData.data[i+3]
  if(alpha !== 0){
    var c = "rgba("
    c += [txtData.data[i],txtData.data[i+1],txtData.data[i+2], alpha/255 ]
    c += ")";
    rays.push(new Ray(Math.floor(ii/txtW), ii%txtW, c));
  }
}
 
var current = 1;
//start animation
tick();
 
function tick() {
  ctx.clearRect(0,0,cw,ch)
  ctx.drawImage(bufferCanvas, 0, 0, current, txtH, sx, sy, current, txtH)
  ctx.save()
  ctx.globalAlpha = .07;
  ctx.globalCompositeOperation = "lighter";
  if(drawRays(current)){
    current+=velocity;
    current = Math.min(current, txtW)
    window.requestAnimationFrame(tick)
  }else{
    fadeOut()
  }
  ctx.restore()
}
 
function fadeOut(){
  ctx.clearRect(0,0,cw,ch)
  ctx.globalAlpha *= .95;
  ctx.drawImage(bufferCanvas, 0, 0, current, txtH, sx, sy, current, txtH)
  if(ctx.globalAlpha > .01){
   window.requestAnimationFrame(fadeOut)
  }else{
    window.setTimeout(restart, 500)
  }
}
function restart(){
  for(var i = 0; i < rays.length; i++){
    rays[i].reset()
  }
  ctx.globalAlpha = 1
  buffer.clearRect(0,0,txtW,txtH)
  current = 1;
  tick();
}
function drawRays(c){
  var count = 0;
  ctx.beginPath()
  for(var i = 0; i < rays.length; i++){
    var ray = rays[i];
    if(ray.col < c){
      count += ray.draw()
    }
  }
  ctx.stroke()
  return count !== rays.length;
}
 
function filterRays(r){
  return Boolean(r);
}
 
function Ray(row, col, f){
  this.col = col;
  this.row = row;
 
  var xp = sx + col;
  var yp = sy + row;
  var fill = f;
 
  var ath = (txtH/1.5)
 
  var a = pi2 * (this.row - ath*.5) / ath;
  if(a === 0){
    a = (Math.random() - .5) * pi2;
  }
  var da = .02 * Math.sign(a);
  da += (Math.random() - .5) * .005;
  var l = 0;
  var dl = Math.random()*2 + 2;
 
  var buffered = false;
  this.reset = function(){
    a = pi2 * (this.row - ath*.5) / ath;
    if(a === 0){
      a = -pi2*.5;
    }
    l = 0;
    buffered = false
  }
  this.draw = function(){
    if(l < 0){
      if(!buffered){
        buffer.fillStyle = fill;
        buffer.fillRect(this.col, this.row, 1, 1);
        buffered = true
      }
      return 1;
    }else{
      ctx.moveTo(xp, yp)
      ctx.lineTo(xp + Math.cos(a) * l, yp + Math.sin(a) * l);
      a += da;
      l += Math.cos(a)*dl;
      return 0;
    }
  }
}

网页猴子名称:非常漂亮的自定义3D光球,可插入任何网页中,不影响操作
网址匹配规则:/http(s)?://trace.qeeyou.cn(:)?(\d)*/(zentaopms/www/(?!user-login.html)){1}/
网页自动刷新:不自动刷新

依赖第三方js:https://res.cloudinary.com/losrodriguez/raw/upload/v1591943363/three.min_ofoalz.js

效果图
var camera, scene, renderer, mesh;
var mouseX = 0, mouseY = 0;

var windowHalfX = window.innerWidth / 2;
var windowHalfY = window.innerHeight / 2;

var colors = ["#D98E04","#F2E205","#7F25D9","#5C12A6","#2F0459"];

function init() {
  camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000);
  camera.position.z = -100;
  camera.position.y = -100;
  // 
  var imgs = textToTexture("逆水寒");
  var texture = new THREE.CubeTextureLoader().load(imgs);
  texture.mapping = THREE.CubeRefractionMapping;

  scene = new THREE.Scene();
  //scene.background = texture;

  var ambient = new THREE.AmbientLight(0xffffff);
  scene.add(ambient);

  var geometry = new THREE.IcosahedronGeometry(50, 1);
  var material = new THREE.MeshPhongMaterial({
    envMap: texture,
    refractionRatio: 0.85
  });

  mesh = new THREE.Mesh(geometry, material);
  scene.add(mesh);

  renderer = new THREE.WebGLRenderer({
    antialias: true,
    alpha: true
  });
  renderer.setPixelRatio(window.devicePixelRatio);
  renderer.setSize(window.innerWidth, window.innerHeight);
  renderer.domElement.style.position = "absolute"
  renderer.domElement.style.left = "0px"
  renderer.domElement.style.top = "0px"
  renderer.domElement.style.pointerEvents = "none"
  document.body.appendChild(renderer.domElement);

  document.addEventListener('mousemove', onDocumentMouseMove, false);
  document.addEventListener('touchmove', onDocumentMouseMove, false);
  window.addEventListener('resize', onWindowResize, false);
}

function onWindowResize() {
  windowHalfX = window.innerWidth / 2;
  windowHalfY = window.innerHeight / 2;
  camera.aspect = window.innerWidth / window.innerHeight;
  camera.updateProjectionMatrix();
  renderer.setSize(window.innerWidth, window.innerHeight);
}

function onDocumentMouseMove(event) {
  if (event.touches) event = event.touches[0];
  mouseX = (event.clientX - windowHalfX) / 4;
  mouseY = (event.clientY - windowHalfY) / 4;
}

function animate() {
  requestAnimationFrame(animate);
  render();
}

function render() {
  camera.position.x += (mouseX - camera.position.x) * 0.05;
  camera.position.y += (-mouseY - camera.position.y) * 0.05;
  camera.lookAt(mesh.position);
  renderer.render(scene, camera);
}

function textToTexture(text) {
  if (text === undefined) text = "Hello Stephen";
  var canvas = document.createElement('canvas');
  var tile_size = 1024;
  var fontSize = 50;
  // 
  canvas.width = tile_size * 4;
  canvas.height = tile_size;
  // 
  var ctx = canvas.getContext('2d');
  ctx.font = fontSize + "px Rubik Mono One, Helvetica";
  var fillColor = colors[Math.floor(Math.random()*colors.length)];
  document.body.style.backgroundColor = fillColor;
  ctx.fillStyle = fillColor;
  ctx.fillRect(0, 0, canvas.width, canvas.height);
  var text_width = ctx.measureText(text).width;
  var text_height = fontSize * 0.8;
  var repetitions_x = Math.ceil(canvas.width / text_width);
  var repetitions_y = Math.ceil(canvas.height / text_height);
  var index = 0;
  for (var y = 0; y < canvas.height; y += text_height) {
    for (var x = 0; x < canvas.width; x += text_width) {
      ctx.fillStyle = colors[Math.floor(Math.random()*colors.length)];
      var _x = index % 2 == 0 ? x : x - (text_width/2);
      ctx.fillText(text, _x, y);
    }
    index += 1;
  }
  var tileFromCanvas = function(index) {
    var img_canvas = document.createElement('canvas');
    img_canvas.width = tile_size;
    img_canvas.height = tile_size;
    var context = img_canvas.getContext("2d");
    context.drawImage(canvas, -tile_size * index, 0);
    return img_canvas.toDataURL();
  }
  var imgs = [];
  imgs.push(tileFromCanvas(0));
  imgs.push(tileFromCanvas(1));
  imgs.push(tileFromCanvas(4)); // blank_space
  imgs.push(tileFromCanvas(4)); // blank_space
  imgs.push(tileFromCanvas(2));
  imgs.push(tileFromCanvas(3));
  return imgs;
}

init();
animate();
上一篇下一篇

猜你喜欢

热点阅读