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-04-25 提交的版本。查看 最新版本

// ==UserScript==
// @name         Direct Image Uploader
// @namespace    https://greasyfork.org/users/321857-anakunda
// @version      1.00
// @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://*/reportsv2.php?action=report&id=*
// @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';

[
  'ptpimg_api_key', 'catbox_userhash',
  'malzo_uid', 'malzo_password',
  'imgbb_uid', 'imgbb_password',
  'imagevenue_uid', 'imagevenue_password',
  'imgbox_uid', 'imgbox_password',
  'empornium_uid', 'empornium_password',
].forEach(propName => { if (!GM_getValue(propName)) GM_setValue(propName, '') });

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