Image File Viewer

open image file with viewer.min.js

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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() {
        },
    });
})();