Last active
April 24, 2023 18:26
-
-
Save spetterman66/cbde7bb074f174b7c79beade33a406ca to your computer and use it in GitHub Desktop.
Fix github releases in TenFourFox, SeaMonkey, InterWebPPC, etc etc etc... (requires Greasemonkey 3.11)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Github Fix | |
// @version 1 | |
// @grant none | |
// @run-at document-start | |
// @include https://github.com/*/releases* | |
// ==/UserScript== | |
void function(){ | |
var includeFragment=1; | |
document.head.insertAdjacentHTML('afterbegin','<style>\ | |
.hx_avatar_stack_commit .AvatarStack .avatar {max-height: 24px; max-width: 24px}\ | |
.dropdown-menu{background-color:white; border:1px solid black}\ | |
/*details:not([open])>summary~*{display:none}*/\ | |
</style>'); | |
document.addEventListener('DOMContentLoaded', function(ev){ | |
function toggle(el){el[el.attributes.getNamedItem('open') ? 'removeAttribute': 'setAttribute']('open','')}; | |
var el=document.querySelector('[data-action^="toggle:get-repo"]'); | |
el && el.addEventListener('click', function(ev){toggle(this)}); | |
var list=document.querySelectorAll('details > summary'); | |
for (var i=0, el; el=list[i++];) el.addEventListener('click', function(ev){toggle(this.parentNode); ev.stopPropagation()}); | |
function load(el) { | |
var src = el.dataset.baseSrc || el.getAttribute('src'), accept = el.getAttribute('accept'); | |
var id = el.previousElementSibling && el.previousElementSibling.id; | |
if (!src || id!='files' && !src.match(/tree-commit|file-list|contributors_list|expanded_assets/)) return; | |
console.log('include-fragment', el); | |
var xhr = new XMLHttpRequest(); xhr.open('GET', src); | |
xhr.onload = function(){if (this.status==200 && this.response) el.outerHTML=this.response}; | |
xhr.send(); | |
}; | |
if (includeFragment) for (var i=0, list=document.querySelectorAll('include-fragment'), el; el=list[i++];) load(el); | |
}); | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment