MCHSL / sane-github

Less bad UI for GitHub.
11 stars 2 forks source link

Github has gone back to insanity #18

Closed CaydendW closed 2 years ago

CaydendW commented 2 years ago

The languages, README and license bar is on the left. Is there any way to fix this?

CaydendW commented 2 years ago

I am not sure that there is a way to fix this with CSS. It's buggy but I got a javascript script that can be used. Be careful it is not perfect

  document.getElementById("repo-content-pjax-container").prepend(document.getElementsByClassName("Layout-sidebar")[0]);
  document.getElementsByClassName("Layout-sidebar")[0].setAttribute("style", "width:"+document.getElementsByClassName("Layout-main")[0].offsetWidth+"px");

You can inject this using your favourite JS injector. Qutebrowser's default greasemonkey does well. Using this in combination with the CSS makes it work perfectly!

CaydendW commented 2 years ago

Just to help anyone in need, here is the full greasemonkey script after a little tampering. It's unneat but it works. I would appreciate feedback and help in making it a little less sucky

// ==UserScript==
// @name         Sane
// @version      1.4.1
// @description  Make github sane again!
// @author       me
// @match        *://*.github.com/*
// @exclude      *://*.github.com/*/issues/*
// @exclude      *://*.github.com/*/pull/*
// ==/UserScript==

(function (old) {
  window.history.pushState = function () {
    old.apply(window.history, arguments);
    history.go(0);
  }
})(window.history.pushState); 

unsafeWindow.onpopstate = function(event) {
  var exis = document.getElementsByClassName("Layout-sidebar")[0];
  if (typeof(exis) != 'undefined' && exis != null) {
    document.getElementById("repo-content-pjax-container").prepend(document.getElementsByClassName("Layout-sidebar")[0]);
    document.getElementsByClassName("Layout-sidebar")[0].setAttribute("style", "width:"+document.getElementsByClassName("Layout-main")[0].offsetWidth+"px"); 
  }
};

var exis = document.getElementsByClassName("Layout-sidebar")[0];
if (typeof(exis) != 'undefined' && exis != null) {
  document.getElementById("repo-content-pjax-container").prepend(document.getElementsByClassName("Layout-sidebar")[0]);
  document.getElementsByClassName("Layout-sidebar")[0].setAttribute("style", "width:"+document.getElementsByClassName("Layout-main")[0].offsetWidth+"px"); 
}
CaydendW commented 2 years ago

Upon further tinkering, I got some CSS to work. It kinda stuffs up the issues and pulls pages so any changes that make this work would be appreciated. Just add this CSS to the normal other CSS.

.Layout-main {
  position: relative;
  padding-top: 250px;
}

.Layout-sidebar {
  position: absolute;
  left: 50;
  bottom: 75;
}

.Layout-sidebar,
.Layout-main {
  width: 60vw;
}