Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Feuerwache.net 411 Fix XMLHttpRequest
- // @namespace Feuerwache.net
- // @version 8.0
- // @description Behebt leere POST Requests direkt am Browser-Transport
- // @match https://www.feuerwache.net/*
- // @grant none
- // ==/UserScript==
- (function () {
- 'use strict';
- function status(text) {
- let box =
- document.getElementById("fw411-status");
- if (!box) {
- box = document.createElement("div");
- box.id = "fw411-status";
- box.style.position = "fixed";
- box.style.top = "10px";
- box.style.right = "10px";
- box.style.background = "green";
- box.style.color = "white";
- box.style.padding = "8px";
- box.style.zIndex = "999999";
- document.body.appendChild(box);
- }
- box.innerHTML = text;
- }
- status("🔥 Feuerwache 411 Fix 8.0 aktiv");
- const oldSend =
- XMLHttpRequest.prototype.send;
- XMLHttpRequest.prototype.send =
- function(body) {
- let url =
- this._fw_url || "";
- if (
- this._fw_method === "POST" &&
- (!body || body === "")
- ) {
- console.log(
- "411 Fix aktiv:",
- url
- );
- status(
- "🔧 Leerer POST repariert"
- );
- body =
- "fix=1";
- }
- return oldSend.call(
- this,
- body
- );
- };
- const oldOpen =
- XMLHttpRequest.prototype.open;
- XMLHttpRequest.prototype.open =
- function(method,url) {
- this._fw_method =
- method.toUpperCase();
- this._fw_url =
- url;
- return oldOpen.apply(
- this,
- arguments
- );
- };
- })();
Advertisement
Add Comment
Please, Sign In to add comment