ImageViewer

ImageViewer for Chrome/Edge, 增强图片查看效果

Tính đến 08-07-2021. Xem phiên bản mới nhất.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         ImageViewer
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  ImageViewer for Chrome/Edge, 增强图片查看效果
// @author       Jack.Chan ([email protected])
// @match        *://*/*
// ==/UserScript==

(function() {
    'use strict';
    var reg = /\.(jpg|jpeg|gif|png|svg|webp|bmp)$/;
    var pathname = location.pathname;
    if (reg.test(pathname)) {
        document.documentElement.style.backgroundImage = 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjUwODBCOTRFREZCNDExRUI5ODVFQkZDMUFFOUU5Q0FBIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjUwODBCOTRGREZCNDExRUI5ODVFQkZDMUFFOUU5Q0FBIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NTA4MEI5NENERkI0MTFFQjk4NUVCRkMxQUU5RTlDQUEiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NTA4MEI5NERERkI0MTFFQjk4NUVCRkMxQUU5RTlDQUEiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4S9mZgAAAAY0lEQVR42uzYUQkAIAxFURUDLMr6p1oEU0wUzg0wOLy/zcwcnVVV6/01Pg8AAAAAAAAAAAAAAAAAAAAAAAAAAADgfrv7fx8RFgAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4qyPAAIoqBuJ7WIoBAAAAAElFTkSuQmCC)';
        document.documentElement.style.boxSizing = 'border-box';
        document.documentElement.style.padding = '10px';
        document.documentElement.style.position = 'absolute';
        document.documentElement.style.top = '50%';
        document.documentElement.style.left = '50%';
        document.documentElement.style.width = 'auto';
        document.documentElement.style.height = 'auto';
        document.documentElement.style.maxWidth = '100%';
        document.documentElement.style.maxHeight = '100%';
        document.documentElement.style.transform = 'translate(-50%, -50%)';
    }
})();