Browser image viewer enhancement

When you looking at image in a separate tab, transparency marked by gray color. Now it's fixed by the script

目前為 2021-01-31 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Browser image viewer enhancement
// @description  When you looking at image in a separate tab, transparency marked by gray color. Now it's fixed by the script
// @version      1.0.0
// @include      *
// @author       Konf
// @namespace    https://gf.qytechs.cn/users/424058
// @compatible   Chrome
// @compatible   Opera
// @compatible   Firefox
// @run-at       document-start
// @grant        none
// @noframes
// ==/UserScript==

/* jshint esversion: 6 */

(function() {
  'use strict';

  if (
    !document.head ||
    !document.body ||
    document.body.childElementCount !== 1 ||
    document.body.childNodes[0].tagName !== 'IMG'
  ) return;

  const transparency = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org"+
  "/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' pres"+
  "erveAspectRatio='xMidYMid meet' viewBox='0 0 640 640' width='16' height="+
  "'16'%3E%3Cdefs%3E%3Cpath d='M320 0L640 0L640 320L320 320L320 0Z' id='b6D"+
  "WnM2ePn'/%3E%3Cpath d='M0 320L320 320L320 640L0 640L0 320Z' id='ganUJTlX"+
  "G'/%3E%3Cpath d='M0 0L320 0L320 320L0 320L0 0Z' id='aHdoSdhJb'/%3E%3Cpat"+
  "h d='M320 320L640 320L640 640L320 640L320 320Z' id='a3CbarKBKc'/%3E%3C/d"+
  "efs%3E%3Cg%3E%3Cg%3E%3Cuse xlink:href='%23b6DWnM2ePn' opacity='1' fill='"+
  "%23cccccc' fill-opacity='1'/%3E%3C/g%3E%3Cg%3E%3Cuse xlink:href='%23ganU"+
  "JTlXG' opacity='1' fill='%23cccccc' fill-opacity='1'/%3E%3C/g%3E%3Cg%3E%"+
  "3Cuse xlink:href='%23aHdoSdhJb' opacity='1' fill='%23ffffff' fill-opacit"+
  "y='1'/%3E%3C/g%3E%3Cg%3E%3Cuse xlink:href='%23a3CbarKBKc' opacity='1' fi"+
  "ll='%23ffffff' fill-opacity='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E";

  const styleEl = document.createElement("style");
  document.head.appendChild(styleEl);
  styleEl.innerText = 'img { background: url("' + transparency + '") !important; }';
})();

QingJ © 2025

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