Greasy Fork

Direct Image Uploader

Directly upload local / rehost remote image(s) to whatever dedicated image host by dropping/pasting them to target field

目前为 2020-05-02 提交的版本。查看 最新版本

// ==UserScript==
// @name         Direct Image Uploader
// @namespace    https://greasyfork.org/users/321857-anakunda
// @version      1.01
// @description  Directly upload local / rehost remote image(s) to whatever dedicated image host by dropping/pasting them to target field
// @author       Anakunda
// @match        https://passthepopcorn.me/*
// @match        https://*/torrents.php?id=*
// @match        https://*/artist.php?id=*
// @match        https://*/artist.php?action=edit&artistid=*
// @match        https://*/reportsv2.php?action=report&id=*
// @match        https://*/forums.php?action=new*
// @match        https://*/forums.php?*action=viewthread*
// @match        https://*/requests.php?action=view*
// @match        https://*/collages.php?id=*
// @match        https://*/collages.php?action=edit&collageid=*
// @match        https://*/collages.php?action=comments&collageid=*
// @match        https://*/collages.php?action=new
// @match        http*://tracker.czech-server.com/upload2.php
// @match        http*://tracker.czech-server.com/edit.php*
// @connect      *
// @grant        GM_xmlhttpRequest
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_deleteValue
// @require      https://greasyfork.org/scripts/401725-globalfetch/code/globalFetch.js
// @require      https://greasyfork.org/scripts/394414-ua-resource/code/UA-resource.js
// @require      https://greasyfork.org/scripts/401726-imagehostuploader/code/imageHostUploader.js
// ==/UserScript==

'use strict';

if (document.domain == 'tracker.czech-server.com') document.querySelectorAll('input[name="urlobr"]').forEach(setInputHandlers);
if (document.URL.includes('/reportsv2.php')) {
  setReportHandlers();
  var reportTypeSelect = document.querySelector('select#type');
  if (reportTypeSelect != null) reportTypeSelect.addEventListener('change', setReportHandlers);
}

function setReportHandlers() {
  setTimeout(function() {
	['input#proofimages', 'input#image'].forEach(selector => { document.querySelectorAll(selector).forEach(setInputHandlers) });
	document.querySelectorAll('textarea#extra').forEach(setTextAreahandlers);
  }, 2000);
}