leandocument 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -4,14 +4,21 @@
4
4
 
5
5
  > gem install leandocument
6
6
 
7
- Not support currentry.
8
-
9
7
  ## Usage
10
8
 
11
9
  > $ cd **LEANDOCUMENT_DIR**
10
+
11
+ or
12
+ > $ git clone https://github.com/LeanDocument/README.git
13
+ > $ cd README
14
+
15
+ and
16
+
12
17
  > $ leandocument
13
18
 
14
- Open http://localhost:4567/
19
+ > open http://localhost:4567/
20
+
21
+ ![Index](https://dl.dropbox.com/u/49508/leandocument/index.png)
15
22
 
16
23
  ## LICENSE
17
24
 
@@ -19,4 +26,4 @@ MIT License
19
26
 
20
27
  ## Developer
21
28
 
22
- Atsushi Nakatsugawa
29
+ [Atsushi Nakatsugawa](https://github.com/moongift)
@@ -1,3 +1,3 @@
1
1
  module Leandocument
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,18 +1,51 @@
1
1
  $(function(){
2
- $('#toc').toc()
2
+ $('#toc').toc();
3
+ var $window = $(window);
4
+ $('.bs-docs-sidenav').affix({
5
+ offset: {
6
+ top: function () { return $window.width() <= 980 ? 90 : 80 }
7
+ , bottom: 270
8
+ }
9
+ })
3
10
  });
4
11
 
5
12
  $.extend($.fn,{
6
13
  toc: function(){
7
14
  toc = $(this);
8
- $("h2,h3,h4,h5,h6").each(function(){
15
+ $("h2,h3,h4,h5,h6").each(function(i){
9
16
  var indent = $(this).get()[0].localName.replace("h", "");
10
17
  var target = $(this);
11
- li = $("<li style='text-indent:"+(indent-2)+"em;'></li>");
12
- li.html($('<a>'+$(this).text()+'</a>').click(function(){
18
+ target.attr("id", "data-index-"+i);
19
+ li = $("<li style='text-indent:"+((indent-2)/1.5)+"em;' data-index='"+i+"' data-indent='"+indent+"'></li>");
20
+ li.html($('<span class="anchor">'+$(this).text()+'</span>').click(function(){
13
21
  $('html,body').animate({scrollTop: target.offset().top - 40},400);
22
+ }).hover(function(){
23
+ $(this).addClass("pointer");
24
+ }, function(){
25
+ $(this).removeClass("pointer");
14
26
  }));
15
27
  li.appendTo($(toc));
28
+ if (indent > 2 && li.prev().attr("data-indent") != indent) {
29
+ icon = $("<i class='icon-minus'></i>").click(function(){
30
+ open = $(this).hasClass("icon-plus")
31
+ if (open) {
32
+ $(this).addClass("icon-minus").removeClass("icon-plus");
33
+ }else{
34
+ $(this).addClass("icon-plus").removeClass("icon-minus");
35
+ }
36
+ parent = $(this).parent();
37
+ last = $(this).parent();
38
+ while (true && last.length > 0){
39
+ next = last.next();
40
+ if (parent.attr("data-indent") >= next.attr("data-indent")) {
41
+ break;
42
+ }
43
+ open ? next.slideDown() : next.slideUp();
44
+ last = next;
45
+ }
46
+ });
47
+ icon.prependTo(li.prev())
48
+ }
16
49
  });
17
50
  }
18
51
  });
@@ -164,6 +164,7 @@ body {
164
164
  line-height: 20px;
165
165
  color: #333333;
166
166
  background-color: #ffffff;
167
+ position: relative;
167
168
  }
168
169
 
169
170
  a {
@@ -5772,3 +5773,24 @@ a.badge:hover {
5772
5773
  .affix {
5773
5774
  position: fixed;
5774
5775
  }
5776
+ .bs-docs-sidenav.affix {
5777
+ top: 50px;
5778
+ }
5779
+
5780
+ .bs-docs-sidenav.affix-bottom {
5781
+ position: absolute;
5782
+ top: auto;
5783
+ bottom: 300px;
5784
+ }
5785
+
5786
+ span.anchor {
5787
+ color: #0088cc;
5788
+ text-decoration: none;
5789
+ font-size: 1.1em;
5790
+ margin-bottom: 0.2em;
5791
+ }
5792
+
5793
+ span.pointer {
5794
+ cursor: pointer;
5795
+ text-decoration: underline;
5796
+ }
data/views/layout.erb CHANGED
@@ -57,7 +57,7 @@
57
57
  <div class="container-fluid">
58
58
  <div class="row-fluid">
59
59
  <div class="span3">
60
- <div class="well sidebar-nav">
60
+ <div class="well sidebar-nav bs-docs-sidenav">
61
61
  <ul class="nav nav-list" id="toc">
62
62
  <li class="nav-header">Table of Contents</li>
63
63
  </ul>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leandocument
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-14 00:00:00.000000000 Z
12
+ date: 2012-10-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: slop