Skip to content

Instantly share code, notes, and snippets.

@lorenzos
Last active June 1, 2017 13:17
Show Gist options
  • Save lorenzos/6cb3856ea6951ae36045c0aee6cc12fc to your computer and use it in GitHub Desktop.
Save lorenzos/6cb3856ea6951ae36045c0aee6cc12fc to your computer and use it in GitHub Desktop.
Better Mootools docs - User script & user styles
@-moz-document url-prefix("http://mootools.net/core/docs/"), url-prefix("http://mootools.net/more/docs/"), url-prefix("https://mootools.net/core/docs/"), url-prefix("https://mootools.net/more/docs/") {
#global-bar {
padding-bottom: 10px;
padding-top: 10px;
}
#logo p img {
width: auto;
height: 20px;
padding: 0;
}
#global-bar div.wrapper div.right {
bottom: -1px;
}
#global-bar ul li a {
font-size: 0.8em;
padding: 0.2em 0.5em 0.1em;
}
#search input {
margin: -0.1em 0;
padding: 0.2em 0.5em;
}
.core > #header, .more > #header {
display: none;
}
.docs .versions {
display: none;
}
.overview {
padding-top: 5em;
}
.docs .toc {
bottom: 20px;
float: left;
overflow: auto;
position: fixed;
top: 60px;
width: 280px;
}
.docs .toc ul {
padding: 0.3em 1em 1em;
}
#footer.wrapper {
display: none;
}
.main.clearfix > hr {
border: none;
}
.docs .content h1,
.docs .content h2 {
overflow: hidden;
}
.docs .content h1 a,
.docs .content h2 a {
margin-top: -2.7em;
padding-top: 2.7em;
}
.docs .content h1 a:focus, .docs .content h1 a:active {
background-color: transparent !important;
color: #7d8aa5 !important;
}
.docs .content h2 a:focus, .docs .content h2 a:active {
background-color: transparent !important;
color: white !important;
}
}
// ==UserScript==
// @name Better Mootools docs
// @description Better Mootools docs
// @namespace http://userscripts.org/user
// @version 1
// @grant none
// @include http://mootools.net/*/docs/*
// @include https://mootools.net/*/docs/*
// ==/UserScript==
function ready(fn) {
if (document.readyState != 'loading'){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
ready(function() {
$$('#main-header a[href="/core/"]').set('href', '/core/docs/');
$$('#main-header a[href="/more/"]').set('href', '/more/docs/');
var openedMenu = $$('.docs .toc ul li:not(.small) ul')[0];
if (openedMenu) {
var openedMenuPosition = openedMenu.getPosition($$('.docs .toc ul')[0]).y;
$$('.docs .toc')[0].scrollTo(0, openedMenuPosition + 2)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment