Image File Viewer

open image file with viewer.min.js

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Image File Viewer
// @namespace    https://greasyfork.org/zh-CN/scripts/418823-image-file-viewer
// @version      0.2
// @description  open image file with viewer.min.js
// @description:zh  用viewer.min.js打开图片(本地,网络)
// @match             *://*/*.jpg
// @match             *://*/*.png
// @grant        GM_addStyle
// @require    https://cdnjs.cloudflare.com/ajax/libs/viewerjs/1.8.0/viewer.min.js
// @license MIT
// ==/UserScript==

(function(){
    GM_addStyle("body{overflow: hidden}");

    var link = document.createElement("link");
    link.rel = "stylesheet";
    link.type = "text/css";
    link.href = "https://cdnjs.cloudflare.com/ajax/libs/viewerjs/1.8.0/viewer.min.css";
    document.getElementsByTagName("head")[0].appendChild(link);

    var img = document.getElementsByTagName('img');
    if(img.length === 0) return;
    img[0].hidden = true;

    const viewer = new Viewer(img[0], {
        inline: true,
      button:false,
      tooltip:false,
        backdrop: false,
        toolbar: {
            zoomIn: 4,
            zoomOut: 4,
            oneToOne: 4,
            reset: 4,
            prev: 0,
            play: {
                show: 0,
                size: 'large',
            },
            next: 0,
            rotateLeft: 4,
            rotateRight: 4,
            flipHorizontal: 4,
            flipVertical: 4,
        },
        title: 0,
        navbar: 0,
        //    minWidth: ,
        //    minHeight: ,
        viewed() {
        },
    });
})();