// ==UserScript== // @name old.reddit.com login form redirection fix // @namespace http://tampermonkey.net/ // @version 1.2 // @description Adds a login form to the top right of old reddit and preserves the current page after login. // @match https://old.reddit.com/* // @license MIT // @grant none // @downloadURL https://update.greasyfork.icu/scripts/494004/oldredditcom%20login%20form%20redirection%20fix.user.js // @updateURL https://update.greasyfork.icu/scripts/494004/oldredditcom%20login%20form%20redirection%20fix.meta.js // ==/UserScript== (function() { 'use strict'; // Check if an element with class "logout" exists if (document.querySelector('.logout') === null) { // Capture the current URL const currentURL = window.location.href; // Prepare the HTML form const formHTML = `

Login


`; // Find the element with the class "side" and prepend the form const sideElement = document.querySelector('.side'); if (sideElement) { sideElement.insertAdjacentHTML('afterbegin', formHTML); } // Insert CSS styles into the document head const style = document.createElement('style'); style.innerHTML = ` #login .c-alert { display: none; font-size: 11px; } .c-alert-danger { background-color: #f9e7e6; border-color: #f7dfdd; color: #b73129 !important; } .c-alert { padding: 15px; margin: 8px 0 19px; border: 1px solid transparent; border-radius: 2px; } #login { padding: 15px; border: 1px solid #fff; margin-top: 15px; margin-bottom: 15px; } `; document.head.appendChild(style); } })();