Last active
November 27, 2015 02:45
-
-
Save alex-kinokon/bc3b2fd90c08cb96e55b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Instant | |
// @description Preloads GitHub content on link hover. CC0 Public Domain. | |
// @version 1.0 | |
// @author Alex Mattrick | |
// @match https://github.com/* | |
// @match https://gist.github.com/* | |
// @icon https://assets-cdn.github.com/favicon.ico | |
// @require https://cdnjs.cloudflare.com/ajax/libs/instantclick/3.0.1/instantclick.min.js | |
// @grant none | |
// @grant GM_addStyle | |
// ==/UserScript== | |
function cleanup(body) { | |
var jQ = $(body); | |
jQ.find('.header, script, .btn-danger, .dangerzone, .file-navigation-option').attr('data-no-instant', ''); | |
jQ.find('a.header-logo-invertocat, ul.header-nav.left, .header a.dropdown-item').attr('data-instant', ''); | |
} | |
cleanup(document.body); | |
GM_addStyle('#instantclick { display: none; }'); | |
InstantClick.init(); | |
InstantClick.on('receive', function (url, body, title) { | |
cleanup(body); | |
return { body: body }; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment