// ==UserScript== // @name 鼠标移动到页面图片显示预览图 // @namespace http://tampermonkey.net/ // @version 0.2 // @description 增加部分的网站小图大图模式 // @description 鼠标移动到页面图片显示预览图,方便网页上小图查看 // @author sgd // @match *://*/* // @require https://code.jquery.com/jquery-3.4.1.min.js // @icon https://www.easyicon.net/api/resizeApi.php?id=501159&size=128 // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; var big = [{ "oldVal":"thumb", "repVal":"original" }]; // 添加样式 var style = document.createElement("style"); style.type = "text/css"; var text = document.createTextNode("#pic {position: fixed;display: none;z-index:99999999;}#pic1 {width: 800px;height: auto;border-radius: 5px;-webkit-box-shadow: 5px 5px 5px 5px hsla(0, 0%, 5%, 1.00);box-shadow: 5px 5px 5px 0px hsla(0, 0%, 5%, 0.3);}"); style.appendChild(text); var head = document.getElementsByTagName("head")[0]; head.appendChild(style); $("img").hover(function() { console.log("hover"); var bigUrl = $(this).attr("src"); $.each(big,function(index,v){ console.log("===="+v.oldVal); bigUrl = bigUrl.replace(v.oldVal, v.repVal); console.log("bigUrl=%s", bigUrl); }); // $(this).parents(".container-item").append("