catbox.moe paste

follow /denali999 on twitch!

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         catbox.moe paste
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  follow /denali999 on twitch!
// @author       (osu! denali) (twitch /denali999)
// @match        https://catbox.moe/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=catbox.moe
// @grant        none
// @run-at document-body
// ==/UserScript==

(function() {
    'use strict';
    var dz;
    Dropzone.options.dropzoneUpload.init = function() {
		this.on("success", function(file, responseText) {

			var para = document.createElement("div");
			var textHolder = document.createElement("span");
			var t = document.createTextNode(responseText);
			para.appendChild(textHolder);
			textHolder.appendChild(t);
			para.className = "responseText";
			textHolder.className = "textHolder";

			file.previewTemplate.appendChild(para);
			file.previewTemplate.style.borderColor = "#23B748";
			file.previewTemplate.childNodes[3].childNodes[0].style.backgroundColor = "#23B748";

			$(file.previewTemplate).find("span.textHolder").on('click', function(event) {


				if (event.which === 2 && !$(this).hasClass('disabled')) {

					window.open($(this).text(),'_blank');
					$(this).removeClass('disabled');
					return;

				} else if (event.which === 1 && !$(this).hasClass('disabled')) {

					var selection = window.getSelection();
					var range = document.createRange();
					range.selectNodeContents(textHolder);
					selection.removeAllRanges();
					selection.addRange(range);

					document.execCommand('copy');

					var oldtext = $(this).text();
					$(this).text("Copied!");

					$(this).fadeTo("slow", 0, function() {
						$(this).text(oldtext);
						$(this).fadeTo(0, 1);
						$(this).removeClass('disabled');
					});
				}

				$(this).addClass('disabled');

			});

		});

		this.on("error", function(file, responseText) {
			file.previewTemplate.childNodes[3].childNodes[0].style.backgroundColor = "#FF5C5C";
		});

        dz = this;
	};
    addEventListener("paste", (event) => {
        const items = (event.clipboardData || event.originalEvent.clipboardData).items;
        if (items.length == 1) {
            var item = items[0]
            if (item.kind === 'file') {
                // adds the file to your dropzone instance
                dz.addFile(item.getAsFile())
            }
        }
    })
})();