j1m_toc 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cf0c1f309fc1c8982b7ef6ffaa685cd7ceecd149
4
+ data.tar.gz: 60528d02be38368bf5260d506afdb138effc5e40
5
+ SHA512:
6
+ metadata.gz: 9fbbdefd274c74ad7e48f306711ec51e8484d33ea48e916abf495b442c903158240f448423105d620a671c23d353b259d9cfd3cbd6ad88f56f37bb753650212a
7
+ data.tar.gz: dad8730924252f3441177884cc0eef683f28f47d5480bb105e890672c5c925004f19be3ded5c40931b5ed3fae5faf54454afd870ae6cb6003dcf2e3910f053ba
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Juergen Adams
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # J1mNav
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/j1m_nav`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'j1m_nav'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install j1m_nav
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/j1m_nav.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
@@ -0,0 +1,165 @@
1
+ # ------------------------------------------------------------------------------
2
+ # J1: ~/_data/modules/j1_tocbot.yml
3
+ # J1 Tocbot specific configuration data (TOC Module)
4
+ #
5
+ # Copyright (C) 2016 Juergen Adams
6
+ #
7
+ # J1 Template is licensed under the MIT License.
8
+ # For details, see https://jekyll.one
9
+ #
10
+ # ------------------------------------------------------------------------------
11
+
12
+ # -------------------------------------------------------------------------
13
+ # GENERAL settings
14
+ #
15
+ # version
16
+ # --------------------------------------------------------------------
17
+ # Current version of the module
18
+ #
19
+ # values: string
20
+ # default: no defaults
21
+ #
22
+ # log
23
+ # -------------------------------------------------------------------
24
+ # Setting the log option to true enables the current option
25
+ # settings to be written to the JavaScript console so you can
26
+ # inspect the settings.
27
+ #
28
+ # values: boolean (true|false)
29
+ # default: false
30
+ #
31
+ version: 0.0.1
32
+ log: false
33
+
34
+ # -------------------------------------------------------------------------
35
+ # MODULE settings
36
+ #
37
+ # tocSelector
38
+ # -------------------------------------------------------------------
39
+ # Specifies the <div> element where to render the table of
40
+ # contents.
41
+ #
42
+ # type: string (HTML class)
43
+ # values: any HTML class
44
+ # default: .js-toc
45
+ #
46
+ # headingSelector
47
+ # -------------------------------------------------------------------
48
+ # Which headings to grab inside of the contentSelector element
49
+ # to build the table of contents.
50
+ #
51
+ # type: string (HTML class)
52
+ # values: any HTML heading element class
53
+ # default: "h1, h2, h3"
54
+ #
55
+ # ignoreSelector
56
+ # -------------------------------------------------------------------
57
+ # Headings that match the ignoreSelector will be skipped
58
+ # and ignored. Use this HTML class to exclude a heading
59
+ # from TOC.
60
+ #
61
+ # type: string (HTML class)
62
+ # values: any HTML class
63
+ # default: .notoc
64
+ #
65
+ # contentSelector
66
+ # -------------------------------------------------------------------
67
+ # Specifies the <div> element, typiclly your contet area,
68
+ # from which the headings are taken to calculate the TOC.
69
+ #
70
+ # type: string (HTML class)
71
+ # default: .js-toc-content
72
+ #
73
+ # activeLinkColor
74
+ # -------------------------------------------------------------------
75
+ # Color of the TOC element that is marked as selected
76
+ # (active).
77
+ #
78
+ # type: string (color)
79
+ # default: "#204A87"
80
+ #
81
+ # collapseDepth
82
+ # -------------------------------------------------------------------
83
+ # Specifies how many heading levels should NOT collapsed
84
+ # (displayed). For example, a value of 6 will show everything
85
+ # (since there are only 6 heading levels (H1 .. H6) and a
86
+ # value of 1 will collapse all. Hidden sections opened and
87
+ # closed (accordion effect) as the content is being scrolled
88
+ # down.
89
+ #
90
+ # type: integer ( [1..6] )
91
+ # default: 2
92
+ #
93
+ # throttleTimeout
94
+ # -------------------------------------------------------------------
95
+ # Timeout between events firing to make sure it's not too
96
+ # rapid (for performance reasons).
97
+ #
98
+ # type: integer
99
+ # default: 50
100
+ #
101
+ # scrollOptions
102
+ # -------------------------------------------------------------------
103
+ # smooth-scroll options object, see more details at:
104
+ # https://github.com/cferdinandi/smooth-scroll
105
+ #
106
+ # values
107
+ #
108
+ # easing
109
+ # ------------------------------------------------------------
110
+ # Type|Speed of the scroll effect the heading|section
111
+ # (of the content) is scrolled to if a toc element has
112
+ # been selected:
113
+ #
114
+ # Linear, moves at the same speed from start to finish.
115
+ # EaseIn, gradually increases in speed.
116
+ # EaseOut, gradually decreases in speed.
117
+ # EaseInOut, gradually increases in speed, peaks, and then
118
+ # gradually slows down.
119
+ #
120
+ # values: Linear|
121
+ # easeInQuad|easeInCubic|easeInQuart|easeInQuint
122
+ # easeOutQuad|easeOutCubic|easeOutQuart|easeOutQuint
123
+ # easeInOutQuad|easeInOutCubic|easeInOutQuart|easeInOutQuint
124
+ #
125
+ # default: easeInOutCubic
126
+ #
127
+ # offset
128
+ # ------------------------------------------------------------
129
+ # Amount of space (calculated as pixels) between the top
130
+ # of page and the selected table of contents item after
131
+ # the page has been scrolled.
132
+ #
133
+ # values: integer
134
+ # default: 0
135
+ #
136
+ # speed
137
+ # ------------------------------------------------------------
138
+ # Overall time (measured in milliseconds) to complete
139
+ # the scroll.
140
+ #
141
+ # values: integer
142
+ # default: 300
143
+ #
144
+ # updateURL
145
+ # ------------------------------------------------------------
146
+ # ...
147
+ #
148
+ # values: boolean (true|false)
149
+ # default: true
150
+ #
151
+ defaults:
152
+ tocSelector: .js-toc
153
+ headingSelector: "h2, h3, h4, h5"
154
+ ignoreSelector: .notoc
155
+ contentSelector: .js-toc-content
156
+ activeLinkColor: "#204A87"
157
+ collapseDepth: 2
158
+ throttleTimeout: 50
159
+ includeHtml: false
160
+ scrollOptions:
161
+ easing: easeInOutCubic
162
+ offset: 100
163
+ speed: 300
164
+ updateURL: true
165
+
@@ -0,0 +1,24 @@
1
+
2
+ # -------------------------------------------------------------
3
+ # Tocbot (TOC Module)
4
+ #
5
+ - resource:
6
+ enabled: true
7
+ version: 0.0.1
8
+ id: j1_tocbot
9
+ comment: Resources for Tocbot
10
+ layout: [ page, post ]
11
+ region: head
12
+ required: always
13
+ script_load: defer
14
+ data:
15
+ css: [
16
+ tocbot/css/tocbot
17
+ ]
18
+ files: [
19
+ j1/js/adapters/tocbot.js
20
+ ]
21
+ js: [
22
+ tocbot/js/tocbot
23
+ ]
24
+ init_function: J1Tocbot.init
@@ -0,0 +1,161 @@
1
+ ---
2
+ ---
3
+
4
+ {% capture j1_cache %}
5
+
6
+ {% comment %}
7
+ # -----------------------------------------------------------------------------
8
+ # J1: ~/assets/themes/j1/j1/js/adapters/tocbot.js
9
+ # JS/Liquid template to create the J1 Adapter for J1 Tocbot
10
+ #
11
+ # Product/Info:
12
+ # https://jekyll.one
13
+ # https://tscanlin.github.io/tocbot
14
+ #
15
+ # Copyright (C) 2016 Juergen Adams
16
+ #
17
+ # J1 Template is licensed under the MIT License.
18
+ # For details, see https://jekyll.one
19
+ # Tocbot is licensed under under the MIT License.
20
+ # For details, see https://tscanlin.github.io/tocbot
21
+ #
22
+ # -----------------------------------------------------------------------------
23
+ {% endcomment %}
24
+
25
+ /*
26
+ # -----------------------------------------------------------------------------
27
+ # J1: ~/assets/themes/j1/j1/js/adapters/tocbot.js
28
+ # JS Adapter for for J1 Tocbot
29
+ #
30
+ # Product/Info:
31
+ # https://jekyll.one
32
+ # https://tscanlin.github.io/tocbot
33
+ #
34
+ # Copyright (C) 2016 Juergen Adams
35
+ #
36
+ # J1 Template is licensed under the MIT License.
37
+ # For details, see https://jekyll.one
38
+ # Tocbot is licensed under under the MIT License.
39
+ # For details, see https://tscanlin.github.io/tocbot
40
+ #
41
+ # -----------------------------------------------------------------------------
42
+ # Adapter generated: {{site.time}}
43
+ # -----------------------------------------------------------------------------
44
+ */
45
+
46
+ {% assign config_tocbot = site.data.modules.j1_tocbot %}
47
+
48
+ var J1Tocbot = function () {
49
+ "use strict";
50
+ return {
51
+ // Initialize
52
+ init: function ( options ) {
53
+
54
+ this.settings = $.extend({}, options);
55
+
56
+ if ( this.settings.collapseDepth === undefined ) {
57
+ this.settings.collapseDepth = {{config_tocbot.defaults.collapseDepth}};
58
+ }
59
+
60
+ if ( this.settings.scrollOptions === undefined ) {
61
+ this.settings.scrollOffset = {{config_tocbot.defaults.scrollOptions.offset}};
62
+ }
63
+
64
+ if ( this.settings.enabled === undefined ) {
65
+ this.settings.enabled = true;
66
+ }
67
+
68
+ if ( this.settings.enabled == true) {
69
+ this.tocbotInit();
70
+ this.initAffix();
71
+ this.setTop();
72
+ }
73
+
74
+ },
75
+ // ---------------------------------------------------------------------
76
+ // Set Tocbot options
77
+ // ---------------------------------------------------------------------
78
+ tocbotInit: function () {
79
+ tocbot.init({
80
+ log: {{ config_tocbot.log | json }},
81
+ tocSelector: {{ config_tocbot.defaults.tocSelector | json }},
82
+ headingSelector: {{ config_tocbot.defaults.headingSelector | json }},
83
+ ignoreSelector: {{ config_tocbot.defaults.ignoreSelector | json }},
84
+ contentSelector: {{ config_tocbot.defaults.contentSelector | json }},
85
+ collapseDepth: this.settings.collapseDepth,
86
+ throttleTimeout: {{ config_tocbot.defaults.throttleTimeout | json }},
87
+ smoothScrollOptions: {
88
+ easing: {{ config_tocbot.defaults.scrollOptions.easing | json }},
89
+ offset: this.settings.scrollOffset,
90
+ speed: {{ config_tocbot.defaults.scrollOptions.speed | json }},
91
+ updateURL: {{ config_tocbot.defaults.scrollOptions.updateURL | json }}
92
+ },
93
+ includeHtml: "false",
94
+ headingsOffset: -1,
95
+ linkClass: "toc-link",
96
+ extraLinkClasses: "",
97
+ activeLinkClass: "is-active-link",
98
+ listClass: "toc-list",
99
+ extraListClasses: "",
100
+ isCollapsedClass: "is-collapsed",
101
+ collapsibleClass: "is-collapsible",
102
+ listItemClass: "toc-list-item",
103
+ positionFixedSelector: "",
104
+ positionFixedClass: "is-position-fixed",
105
+ fixedSidebarOffset: "auto"
106
+ });
107
+
108
+ if (tocbot.options.log == true) {
109
+ // Writes all of the current option settings to JS console
110
+ console.log( tocbot.options );
111
+ }
112
+ },
113
+ // ---------------------------------------------------------------------
114
+ // Calculate|Set Affix offset Top|Bottom
115
+ // ---------------------------------------------------------------------
116
+ // ToDo: Calculation for top-position should use the id #j1-pagehead
117
+ // instead of the class .j1-pagehead
118
+ initAffix: function () {
119
+ var sidebar = $("#j1-sidebar"),
120
+ header = $(".j1-pagehead");
121
+ $(sidebar).affix({
122
+ offset: {
123
+ top: function() {
124
+ var c = $(sidebar).offset().top,
125
+ e = $('.nav').height(),
126
+ h = $(header).height(),
127
+ z = c - e;
128
+ return this.top = c - e
129
+ },
130
+ bottom: function () {
131
+ var footer_offset = 100;
132
+ return ( this.bottom = $("#j1-footer").outerHeight(true) + footer_offset )
133
+ }
134
+ }
135
+ });
136
+ },
137
+ // ---------------------------------------------------------------------
138
+ // Calculate|Set Top position of the Tocbot menu
139
+ // ---------------------------------------------------------------------
140
+ setTop: function () {
141
+ $(window).scroll(function(event){
142
+ var navbar = $("nav.navbar.bootsnav"),
143
+ pagehead = $(".j1-pagehead"),
144
+ m = parseInt(pagehead.css("margin-bottom"), 10),
145
+ n = navbar.outerHeight(),
146
+ o = n + m;
147
+ if( navbar.hasClass("navbar-fixed")){
148
+ $("#j1-sidebar.affix").css("top", o);
149
+ } else {
150
+ $("#j1-sidebar.affix").css("top", m);
151
+ }
152
+ });
153
+ }
154
+ }; // end return
155
+
156
+ }();
157
+
158
+ {% endcapture %}
159
+
160
+ {{ j1_cache | strip_empty_lines }}
161
+ {% assign j1_cache = nil %}
@@ -0,0 +1,101 @@
1
+ ---
2
+ regenerate: false
3
+ ---
4
+
5
+ {% capture cache %}
6
+
7
+ /*
8
+ # -----------------------------------------------------------------------------
9
+ # J1: ~/assets/themes/j1/tocbot/css/tocbot.css
10
+ # Provides base styles for the toc navigation based on
11
+ # Tim Scanlin's Tocbot
12
+ #
13
+ # Product/Info:
14
+ # https://jekyll.one
15
+ # https://tscanlin.github.io/tocbot
16
+ #
17
+ # Copyright (C) 2016 Tim Scanlin
18
+ # Copyright (C) 2017 Juergen Adams
19
+ #
20
+ # J1 Template is licensed under the MIT License.
21
+ # For details, see https://jekyll.one
22
+ # Tocbot: Licensed under Open Source Iniative MIT.
23
+ # For details, see http://opensource.org/licenses/MIT
24
+ #
25
+ # -----------------------------------------------------------------------------
26
+ # Test data:
27
+ # liquid_var: {{ liquid_var | debug }}
28
+ #
29
+ # -----------------------------------------------------------------------------
30
+ # CSS file generated: {{site.time}}
31
+ # -----------------------------------------------------------------------------
32
+ */
33
+
34
+ {% assign active_link_color_default = '#204A87' %}
35
+ {% assign config_tocbot = site.data.modules.j1_tocbot %}
36
+ {% assign active_link_color = config_tocbot.activeLinkColor %}
37
+
38
+
39
+
40
+ .toc {
41
+ overflow-y: auto;
42
+ }
43
+
44
+ /* jadams 2016-10-02: added list-style, list-style-type - set to none */
45
+ .toc ul {
46
+ overflow: hidden;
47
+ position: relative;
48
+ list-style: none;
49
+ list-style-type: none !important;
50
+ }
51
+
52
+ .toc-list {
53
+ margin: 0;
54
+ padding-left: 10px;
55
+ }
56
+
57
+ a.toc-link {
58
+ color: currentColor;
59
+ height: 100%;
60
+ font-size: 14px;
61
+ text-decoration: none !important;
62
+ }
63
+
64
+ .is-collapsible {
65
+ max-height: 1000px;
66
+ overflow: hidden;
67
+ transition: all 300ms ease-in-out;
68
+ }
69
+
70
+ .is-collapsed {
71
+ max-height: 0;
72
+ }
73
+
74
+ .is-position-fixed {
75
+ position: fixed !important;
76
+ top: 0;
77
+ }
78
+
79
+ .is-active-link {
80
+ font-weight: 700;
81
+ }
82
+
83
+ .toc-link::before {
84
+ background-color: #EEE;
85
+ content: ' ';
86
+ display: inline-block;
87
+ height: inherit;
88
+ left: 0;
89
+ margin-top: -1px;
90
+ position: absolute;
91
+ width: 2px;
92
+ }
93
+
94
+ .is-active-link::before {
95
+ background-color: {{ active_link_color }};
96
+ }
97
+
98
+ {% endcapture %}
99
+
100
+ {{ cache | strip_empty_lines }}
101
+ {% assign cache = nil %}