Skip to content

Instantly share code, notes, and snippets.

@alketii
Created June 18, 2015 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alketii/2728a4ecf487b93095d1 to your computer and use it in GitHub Desktop.
Save alketii/2728a4ecf487b93095d1 to your computer and use it in GitHub Desktop.
// Copyright alket@megaglest.org CC0 Universal
// ==UserScript==
// @name QupZilla Github Fix
// @namespace qupzilla_github_fix
// @include https://github.com/*
// @version 0.1
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js
// ==/UserScript==
var html_list = "";
var item_title = "";
var item_href = "";
GM_addStyle(".select-menu-filters {max-height:400px;overflow-y:scroll;}#qpf-list li { list-style-type:none;} #qpf-list li a {display:block;padding:6px;text-decoration:none;color:#666;} #qpf-list a:hover {background:#4078C0;color:#fff;}#qpf-list .selected{font-weight:bold;color:#4078C0;} .qpf-span {padding:6px;font-weight:bold;color:#000;}");
$(document).ready(function() {
html_list += '<span class="qpf-span">Branches</span><ul id="qpf-list">';
$('*[data-tab-filter="branches"] a').each(function( index ) {
item_title = $(this).text();
item_title = item_title.replace(/\s/g, '');
item_href = $(this).attr("href");
if ( $( this ).hasClass("selected")) {
html_list += '<li><a class="selected" href="'+item_href+'">'+item_title+'</a></li>';
} else {
html_list += '<li><a href="'+item_href+'">'+item_title+'</a></li>';
}
});
html_list += "</ul>";
html_list += '<span class="qpf-span">Tags</span><ul id="qpf-list">';
$('*[data-tab-filter="tags"] a').each(function( index ) {
item_title = $(this).text();
item_title = item_title.replace(/\s/g, '');
item_href = $(this).attr("href");
if ( $( this ).parent().hasClass("selected")) {
html_list += '<li><a class="selected" href="'+item_href+'">'+item_title+'</a></li>';
} else {
html_list += '<li><a href="'+item_href+'">'+item_title+'</a></li>';
}
});
html_list += "</ul>";
$('.select-menu-filters').html(html_list);
});
@nowrep
Copy link

nowrep commented Jun 18, 2015

This script is incorrect, you shouldn't use $(document).ready(function() instead you should set @run-at document-end (http://wiki.greasespot.net/Metadata_Block#.40run-at).

@alketii
Copy link
Author

alketii commented Jun 18, 2015

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment