NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Replace Sign Up by Sign In // @author Schimon Jehudah, Adv. // @copyright 2022, Schimon Jehudah (http://schimon.i2p) // @license AGPL-3.0-only; https://www.gnu.org/licenses/agpl-3.0.en.html // @namespace org.openuserjs.sjehuda.replacesignup // @description Replace button Sign Up by button Sign In // @include https://github.com/* // @version 1.0.0 // @grant none // ==/UserScript== logo = document.querySelector('a > svg'); logo.remove() try{ menu = document.querySelector('div.flex-1.flex-order-2.text-right > button'); menu.remove() } catch(error){ // User is logged in. Nothing to do. //console.info("Menu was not removed") } snup = document.querySelector('div.d-flex.flex-justify-between.flex-items-center.width-full.width-lg-auto > div:nth-child(2) > a'); snin = document.querySelector('div > div.position-relative.mr-lg-3.d-lg-inline-block > a'); try{ snup.innerText = "Login"; snup.href = snin.href; } catch(error){ // User is logged in. Nothing to do. //console.info("Link was not found") } // HELP NEEDED // The original order was Sign In button, Search bar, and Sign Up button. // Due to the website complexity, I didn't do so and the search bar was too wide. // You're welcome to take over this program. // relevant element //sin = document.querySelector('div.position-relative.mr-lg-3.d-lg-inline-block > a'); //sin.className = 'd-inline-block d-lg-none flex-order-1 f5 no-underline border color-border-default rounded-2 px-2 py-1 color-fg-inherit' //sin = sin.href; //let sin_new = document.createElement("a"); //sin_new.href = sin; //sin_new.innerHTML = "Sign in"; //sin_new.className = "HeaderMenu-link no-underline px-0 px-lg-2 py-3 py-lg-2 d-block d-lg-inline-block"; //let sin_div = document.createElement("div"); //sin_div.appendChild(sin_new); //sin_div.className = "flex-1"; //sin_mnu = document.querySelector('nav > ul > li:nth-child(4) > a'); //sin_mnu.replaceWith(sin_new); //sup = document.querySelector('div.d-flex.flex-justify-between.flex-items-center.width-full.width-lg-auto > div:nth-child(2) > a'); //sup.innerText = sin.innerText; //sup.href = sin.href; //let sup_new = document.createElement("a"); //sup_new.href = sup; //sup_new.innerHTML = "Sign up"; //sup_new.className = "HeaderMenu-link no-underline px-0 px-lg-2 py-3 py-lg-2 d-block d-lg-inline-block"; //let sup_div = document.createElement("div"); //sup_div.appendChild(sup_new); //sup_div.className = "flex-1" //sup_mnu = document.querySelector('nav > ul > li:nth-child(2) > button'); //sup_mnu.replaceWith(sup_new); // locate search bar //sea = document.querySelector('div.d-lg-flex.min-width-0.mb-2.mb-lg-0 > div'); //let new_ele = document.createElement("header"); //new_ele.appendChild(sup_div); //new_ele.appendChild(sin_div); //new_ele.style.left = 0; //new_ele.style.right = 0; //new_ele.style.top = 0; //ele = document.querySelector('header'); //ele.remove(); //ele.replaceWith(new_ele); //head = document.querySelector('body > div.logged-out.env-production.page-responsive > div.position-relative.js-header-wrapper > header'); //head.appendChild(sea); //head.appendChild(sin_new); //head.appendChild(sup_new); //head.appendChild(sin_div); //head.appendChild(sup_div); // irrelevant elements // locate logo //logo = document.querySelector('div.d-flex.flex-justify-between.flex-items-center.width-full.width-lg-auto > a'); //logo.replaceWith(snup); // locate navigation bar //nbar = document.querySelector('div.HeaderMenu--logged-out.p-responsive.height-fit.position-lg-relative.d-lg-flex.flex-column.flex-auto.pt-7.pb-4.top-0 > div > nav'); //nbar.remove(); // locate menu //mbar = document.querySelector('div.flex-1.flex-order-2.text-right > button'); //mbar.remove(); //mbar.replaceWith(sin_div); // replace menu with link //mbar.replaceWith(link); // locate search placeholder //rbar = document.querySelector('div > div > div.d-lg-flex.min-width-0.mb-2.mb-lg-0'); //rbar.append(snup); // locate navigation bar placeholder //nbar = document.querySelector('div.HeaderMenu--logged-out.p-responsive.height-fit.position-lg-relative.d-lg-flex.flex-column.flex-auto.pt-7.pb-4.top-0'); //nbar.append(sbar); //nbar.replaceWith(sbar); // locate right placeholder //sin_bar = document.querySelector('div.flex-1.flex-order-2.text-right'); //sin_bar.replaceWith(sin_div);