Skip to content

Instantly share code, notes, and snippets.

@ozgurg
Last active September 30, 2023 16:11
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozgurg/c5e9c0c60ddf6a415bde4bc6b6cc8f06 to your computer and use it in GitHub Desktop.
Save ozgurg/c5e9c0c60ddf6a415bde4bc6b6cc8f06 to your computer and use it in GitHub Desktop.
teknoseyir.com'da yorum veya gönderi yazarken yapıştırdığınızda panodaki görseli yorum veya gönderi görseli olarak ekler
// ==UserScript==
// @name teknoseyir-paste-to-file-input
// @namespace https://github.com/ozgurg
// @version 1.0.0
// @description teknoseyir.com'da yorum veya gönderi yazarken yapıştırdığınızda panodaki görseli yorum veya gönderi görseli olarak ekler
// @author @ozgurg
// @match https://teknoseyir.com/*
// @grant none
// ==/UserScript==
(() => {
"use strict";
window.addEventListener("paste", event => {
const activeElement = $(document.activeElement);
if (activeElement.is("#comment")) {
const fileInput = activeElement.parents("[data-object_id]").find("#comment_pic");
fileInput.get(0).files = event.clipboardData.files;
fileInput.trigger("change");
} else if (activeElement.is("#post_content")) {
const fileInput = activeElement.parents("#post_form").find("#post_pic:last-child"); // :last-child for multiple image support
fileInput.get(0).files = event.clipboardData.files;
fileInput.trigger("change");
}
});
})();
@yhackup
Copy link

yhackup commented Jan 24, 2022

bless your hands

@cryingcherry
Copy link

adam ya geldi adam adam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment