Endchan Plus

Small improvements for users.

Από την 20/03/2019. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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