Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Some extra overhaul on the docs styles and layout.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheeaun committed Mar 22, 2009
1 parent f365398 commit c660220
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 16 deletions.
23 changes: 20 additions & 3 deletions Docs/assets/docs.css
Expand Up @@ -10,20 +10,37 @@ title{
}

#container{
width: 70em;
width: 80em;
margin: auto;
}

#menu{
float: left;
width: 15em;
width: 13em;
}

#docs{
margin-left: 16em;
float: left;
margin-left: 2em;
width: 49em;
overflow: hidden;
}

#methods{
margin-left: 66em;
}

#methods ul{
list-style: none;
margin: 0;
padding: 0;
}

#methods ul ul{
list-style-type: disc;
margin: 1em;
}

h1{
border-bottom: 3px solid #ccc;
}
Expand Down
50 changes: 37 additions & 13 deletions Docs/assets/docs.js
Expand Up @@ -5,23 +5,18 @@ var Docs = {
'MooEditable/MooEditable.Extras.md',
'MooEditable/MooEditable.Group.md'
],
currentDoc: '',

start: function(){
Docs.generateMenu();

var hashdoc = function(){
var href = window.location.hash.slice(1);
if (Docs.currentDoc && href == Docs.currentDoc) return;
if (!href || !/(\.md)/.test(href)){
href = Docs.urls[0];
window.location.hash = href;
}
Docs.getContent(href, Docs.parse);
Docs.currentDoc = href;
};
var href = window.location.hash.slice(1);
if (href && /(\.md)/.test(href)) Docs.getContent(href, Docs.parse);

hashdoc.periodical(25);
document.addEvent('click', function(e){
if (e.target.tagName.toLowerCase() != 'a') return;
var href = e.target.href.split('#')[1];
if (!href || !/(\.md)/.test(href)) return;
Docs.getContent(href, Docs.parse);
});
},

generateMenu: function(){
Expand Down Expand Up @@ -78,9 +73,38 @@ var Docs = {
h.innerHTML = h.innerHTML.replace(anchor, '');
});

// hash methods list
var headings = sd.getElements('h1');
var methods = sd.getElements('h2');

var html = '<ul>';
headings.each(function(heading){
var href = heading.get('id');
var text = heading.get('text').split(':')[1].trim();
html += '<li><a href="#' + href + '"><strong>' + text + '</strong></a>';
html += '<ul>';
methods.filter('[id^=' + href + ':]').each(function(method){
var href = method.get('id');
var text = href.split(':')[1];
html += '<li><a href="#' + href + '">' + text + '</a></li>';
});
html += '</ul></li>';
});
html += '</ul>';
$('methods').set('html', html);

// hack some links
sd.getElements('a[href^=/]').each(function(a){
var href = '#' + a.href.replace('file:///', '') + '.md';
a.href = href;
});

// prettify code
sd.getElements('pre').addClass('prettyprint');
prettyPrint();

// scroll to top
window.scrollTo(0, 0);
},

disposeIframes: function(){
Expand Down
1 change: 1 addition & 0 deletions Docs/index.html
Expand Up @@ -10,4 +10,5 @@
<div id="container">
<div id="menu"></div>
<div id="docs"></div>
<div id="methods"></div>
</div>

0 comments on commit c660220

Please sign in to comment.