Endchan Plus

Small improvements for users.

Verze ze dne 20. 03. 2019. Zobrazit nejnovější verzi.

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         Endchan Plus
// @namespace    https://greasyfork.org/en/scripts/380490-endchan-plus
// @version      0.3
// @description  Small improvements for users.
// @author       Doc
// @include      https://endchan.xyz/*
// @match https://endchan.org/*/*
// @match https://endchan.net/*/*
// @match https://endchan.xyz/*/*
// @grant        none
// ==/UserScript==



var old = '';
var preview = document.createElement('div');
preview.style = 'position:absolute;right:0px;';

var latch = false;
setInterval(function(){
    if (JSON.stringify(selectedFiles) != old){
        old = JSON.stringify(selectedFiles);
        makethumbs();
    };
    if (latch){return};
    if (document.querySelector('nav')){
        document.querySelector('nav').appendChild(preview);
        latch = true;
        go();
    }
}, 200);

function makethumbs(){
    if (window.FileReader) {
        preview.innerHTML = '';
        for (var i = 0; i < selectedFiles.length; i++) {
            var Reader = new FileReader();
            var file = selectedFiles[i];
            if (file.type.indexOf("video") > -1) {
                Reader.onload = function (event) {
                    var t = document.createElement('video');
                    t.autoplay = true;
                    t.muted = true;
                    t.style = "max-height:150px;margin-left:2px;";
                    t.src = event.target.result;
                    preview.appendChild(t);
                };
                Reader.readAsDataURL(file);

            } else {

                Reader.onload = function (event) {
                    var t = document.createElement('img');
                    t.style = "max-height:150px;margin-left:2px;";
                    t.src = event.target.result;
                    preview.appendChild(t);
                };
                Reader.readAsDataURL(file);

            };
        }
    } else {
        alert('no filereader');
    }

};

//nameLabel
function go(){



    var hover = document.createElement('img');
    var vhover = document.createElement('video');
    vhover.autoplay = true;
    vhover.muted = true;
    document.body.appendChild(vhover);
    document.body.appendChild(hover);
    var s = 'position:fixed;max-height:90vh;top:0px;right:0px;pointer-events:none;';
    hover.style = s;
    vhover.style = s;

    document.addEventListener('mouseover', function (e) {
        if (e.target.nodeName == 'IMG') {
            if (e.target.parentNode.className == 'imgLink' && e.target.className != 'imgExpanded') {
                hover.src = e.target.parentNode.href;
            };
            if (e.target.src.indexOf('video') != -1) {
                vhover.src = e.target.src.replace('t_', '') + '.' + e.target.src.split('video')[1]
            }
        } else {
            hover.src = '';
            vhover.src = '';
        }
    });

        console.log('go');

    //if (window.location.href.indexOf('rapport') != -1){document.querySelector('#fieldName').value = "Doc";document.querySelector('#qrname').value = "Doc"};
   // document.querySelector('#qrbutton').addEventListener('click', function(){this.value = "Posting..."; setTimeout(() => this.value = "New Reply", 2000); })
   // document.querySelector('#jsButton').addEventListener('click', function(){this.value = "Posting..."; setTimeout(() => this.value = "New Reply", 2000); })
};