jekyll-theme-open-project 1.3.4 → 2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,11 +16,11 @@
16
16
 
17
17
  @mixin wide-container() {
18
18
  @media screen and (min-width: $bigscreen-breakpoint) {
19
- padding: 0;
20
- width: $bigscreen-breakpoint - $gutter * 2;
19
+ padding: 0 2em;
20
+ width: $bigscreen-breakpoint - $gutter * 8;
21
21
  }
22
22
  @media screen and (min-width: $widescreen-breakpoint) {
23
- width: $widescreen-breakpoint - $gutter * 2;
23
+ width: $widescreen-breakpoint - $gutter * 8;
24
24
  }
25
25
  }
26
26
 
@@ -319,6 +319,93 @@
319
319
  }
320
320
  }
321
321
 
322
+ @mixin item-external-links($onDark: false) {
323
+ ul.nav-items {
324
+ @include reset-list();
325
+ }
326
+
327
+ > .nav-items > li {
328
+ flex-basis: 50%;
329
+ width: 50%;
330
+ max-width: 200px;
331
+
332
+ &:first-child {
333
+ a {
334
+ margin-left: 1px;
335
+ }
336
+ }
337
+
338
+ > a {
339
+ @if $onDark == true {
340
+ @include static-link-color(white);
341
+ background-color: rgba(black, 0.7);
342
+ } @else {
343
+ @include static-link-color(#444);
344
+ background-color: rgba(black, 0.08);
345
+ }
346
+
347
+ display: block;
348
+ font-weight: bold;
349
+ padding: .5em 1em .5em 1.5em;
350
+
351
+ margin: 1px 1px 1px 0;
352
+
353
+ display: flex;
354
+ flex-flow: row nowrap;
355
+
356
+ .lbl {
357
+ white-space: nowrap;
358
+ text-overflow: ellipsis;
359
+ overflow: hidden;
360
+ flex: 1;
361
+ }
362
+ .ico {
363
+ flex-shrink: 0;
364
+ width: 32px;
365
+ }
366
+ .ico-ext {
367
+ flex-shrink: 0;
368
+ text-align: right;
369
+ width: 32px;
370
+ }
371
+ }
372
+
373
+ &.featured {
374
+ > a {
375
+ @if $onDark == true {
376
+ @include static-link-color($primary-color);
377
+ background-color: white;
378
+ } @else {
379
+ @include static-link-color(white);
380
+ background-color: $primary-dark-color;
381
+ }
382
+ }
383
+ }
384
+ }
385
+ }
386
+
387
+ @mixin item-nav-toc() {
388
+ // Used for ToC on software item’s landing and elsewhere,
389
+ // (though not in docs sidebar)
390
+
391
+ ul.nav-items {
392
+ @include reset-list;
393
+ font-size: 15px;
394
+ }
395
+
396
+ > ul.nav-items > li {
397
+ > .item-title {
398
+ font-size: 18px;
399
+ font-weight: bold;
400
+ margin: 0;
401
+ line-height: 1.8;
402
+ }
403
+ ul {
404
+ line-height: 2;
405
+ }
406
+ }
407
+ }
408
+
322
409
  @mixin docs-page($primary-dark-color) {
323
410
  > header.documentation-header,
324
411
  > section.documentation {
@@ -332,25 +419,11 @@
332
419
  align-items: center;
333
420
  padding: 0 0 0 2em;
334
421
  position: fixed;
335
- left: 0;
336
422
  right: 0;
337
423
  z-index: 4;
338
424
 
339
425
  transition: background .1s linear, border-bottom .1s linear, transform .1s linear;
340
426
 
341
- .section-title {
342
- flex: 1;
343
- flex-grow: 0;
344
-
345
- flex-grow: 1;
346
- transition: transform .2s ease-out;
347
- opacity: 1;
348
- overflow: hidden;
349
-
350
- text-overflow: ellipsis;
351
- font-weight: bold;
352
- }
353
-
354
427
  .nav-header {
355
428
  padding: 10px 2em 10px 2em;
356
429
  display: flex;
@@ -416,13 +489,6 @@
416
489
  box-shadow: rbga(white, 0.9) 0 20px 30px;
417
490
  }
418
491
 
419
- &.headroom--top {
420
- .section-title {
421
- transform: translateY(-5em);
422
- transition: none; // To avoid flashing on initial page open
423
- }
424
- }
425
-
426
492
  &.unpinned {
427
493
  .item-type, .subsection {
428
494
  display: inline-block;
@@ -431,8 +497,6 @@
431
497
  }
432
498
 
433
499
  > section.documentation {
434
- $external-links-side-margin: 16px; // for external links
435
-
436
500
  flex: 1;
437
501
 
438
502
  @media screen and (min-width: $bigscreen-breakpoint) {
@@ -483,7 +547,7 @@
483
547
  max-width: calc(#{$navFlexShare} - #{$sidePadding});
484
548
  }
485
549
 
486
- li.item {
550
+ li {
487
551
  font-size: 15px;
488
552
  font-weight: normal;
489
553
 
@@ -507,7 +571,7 @@
507
571
  a { @include static-link-color(#444); }
508
572
  }
509
573
 
510
- > li.item {
574
+ > li {
511
575
  > .item-title {
512
576
  font-size: 20px;
513
577
  margin: 0;
@@ -537,7 +601,7 @@
537
601
  ul {
538
602
  padding: 0;
539
603
  }
540
- li.item {
604
+ li {
541
605
  font-size: 13px;
542
606
  line-height: 1.5;
543
607
 
@@ -607,9 +671,7 @@
607
671
  flex-flow: row nowrap;
608
672
  }
609
673
 
610
- border-bottom: 2px solid $primary-dark-color;
611
674
  padding-top: 70px;
612
- padding-bottom: 20px;
613
675
 
614
676
  > .logo-container {
615
677
  margin-right: 22px;
@@ -642,67 +704,34 @@
642
704
  .docs-nav,
643
705
  &.docs-landing > article > header {
644
706
  .external-links {
645
- margin-left: -$external-links-side-margin;
646
-
647
- ul.nav-items {
648
- @include reset-list();
649
- }
650
-
651
- > .nav-items > .item {
652
- margin-bottom: 10px;
653
- margin-right: 16px;
654
-
655
- > a {
656
- @include static-link-color(#444);
657
- background-color: #F7F7F7;
658
-
659
- display: block;
660
- font-weight: bold;
661
- padding: 4px 0 4px 0;
662
- border-radius: 10px;
663
-
664
- display: flex;
665
- flex-flow: row wrap;
666
-
667
- .lbl {
668
- white-space: nowrap;
669
- text-overflow: ellipsis;
670
- overflow: hidden;
671
- }
672
- .lbl:first-child {
673
- // First child means no icon present
674
- margin-left: 16px;
675
- }
676
- .ico {
677
- flex-shrink: 0;
678
- text-align: right;
679
- width: 32px;
680
- padding-right: 10px;
681
- }
682
- .ico-ext {
683
- flex-shrink: 0;
684
- text-align: right;
685
- width: 32px;
686
- padding-left: 10px;
687
- padding-right: 10px;
688
- }
689
- }
690
- }
707
+ @include item-external-links();
691
708
  }
692
709
  }
693
710
 
694
711
  .docs-nav {
695
712
  .external-links {
696
- > .nav-items > .item {
697
- margin-bottom: 0;
698
- margin-right: -$external-links-side-margin;
713
+ margin-bottom: .5em;
714
+
715
+ > .nav-items > li {
716
+ flex-basis: unset;
717
+ width: 100%;
718
+ a {
719
+ padding: 0;
720
+ background: none;
721
+ }
722
+ &.featured {
723
+ a {
724
+ background: none;
725
+ @include static-link-color($main-font-color);
726
+ }
727
+ }
699
728
  }
700
729
  }
701
730
  }
702
731
 
703
732
  &.docs-landing > article {
704
733
  > header {
705
- .external-links > .nav-items > .item > a {
734
+ .external-links > .nav-items > li > a {
706
735
  @include static-link-color(#fff);
707
736
  background-color: $primary-dark-color;
708
737
  }
@@ -713,22 +742,7 @@
713
742
  }
714
743
  }
715
744
 
716
- ul.nav-items {
717
- @include reset-list;
718
- font-size: 15px;
719
- }
720
-
721
- > ul.nav-items > li {
722
- > .item-title {
723
- font-size: 20px;
724
- font-weight: bold;
725
- margin: 0;
726
- line-height: 1.8;
727
- }
728
- ul {
729
- line-height: 2;
730
- }
731
- }
745
+ @include item-nav-toc();
732
746
  }
733
747
 
734
748
  @media screen and (min-width: $bigscreen-breakpoint) {
@@ -2,12 +2,9 @@
2
2
  ---
3
3
 
4
4
  $primary-color: #05C7DF;
5
- $primary-dark-color: #0446CC;
6
5
  $accent-color: #FF6357;
7
6
 
8
- $header-background: linear-gradient(135deg, #0446CC 0%, #2864DD 100%);
9
- $hero-background: linear-gradient(135deg, #0446CC 0%, #2864DD 100%);
10
- $superhero-background: linear-gradient(135deg, #0446CC 0%, #2864DD 100%);
7
+ $main-background: linear-gradient(135deg, #0446CC 0%, #2864DD 100%);
11
8
 
12
9
  @import 'jekyll-theme-open-project';
13
10
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  const HEADER_TAGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
4
4
  const IN_PAGE_NAV_HTML_CLASS = 'in-page-toc';
5
+ const SCROLLABLE_NAV_CONTAINER_SELECTOR = 'ul.nav-items';
5
6
 
6
7
  /* Given a container of AsciiDoc .sectN elementss,
7
8
  * returns an object containing navigation structure like this:
@@ -47,10 +48,13 @@
47
48
  }
48
49
 
49
50
  function highlightSelected(headerId, itemPath) {
51
+ let selectedItemEl;
52
+
50
53
  for (const itemEl of document.querySelectorAll(`.${IN_PAGE_NAV_HTML_CLASS} li`)) {
51
54
  const link = (itemEl.firstChild || {}).firstChild;
52
55
  if (link && link.getAttribute('href') == itemPath) {
53
56
  itemEl.classList.add('highlighted');
57
+ selectedItemEl = itemEl;
54
58
  } else {
55
59
  itemEl.classList.remove('highlighted');
56
60
  }
@@ -62,6 +66,8 @@
62
66
  }
63
67
  const selectedHeaderEl = document.getElementById(headerId);
64
68
  selectedHeaderEl.classList.add('highlighted');
69
+
70
+ return selectedItemEl;
65
71
  }
66
72
 
67
73
  /* Given a list of navigation items, returns an <ul> containing items recursively
@@ -103,7 +109,7 @@
103
109
  }
104
110
 
105
111
  const articleBody = document.querySelector('main section article .body');
106
- const selectedItem = document.querySelector('main .docs-nav .nav-items .item.selected');
112
+ const selectedItem = document.querySelector('main .docs-nav .nav-items li.selected');
107
113
 
108
114
  if (articleBody && selectedItem) {
109
115
  const items = getAdocTocItems(articleBody);
@@ -121,4 +127,49 @@
121
127
  }
122
128
  }
123
129
 
130
+ if (articleBody && window.location.hash) {
131
+ // Do things that need to be done if the page was opened
132
+ // with hash component in address bar.
133
+ // - After initial scroll to anchor, scroll up a bit
134
+ // to ensure header is in view accounting for top bar.
135
+ // - Select in-page doc nav item corresponding to the hash.
136
+
137
+ const SCROLL_COMPENSATION_AMOUNT_PX = 0 - document.querySelector('body > .underlay.header > header').offsetHeight - 10;
138
+
139
+ function _scrollUp(evt) {
140
+ window.scrollBy(0, SCROLL_COMPENSATION_AMOUNT_PX);
141
+ window.removeEventListener('scroll', _scrollUp);
142
+ };
143
+
144
+ function _selectInitialItem() {
145
+ const hash = window.location.hash.substring(1);
146
+ const anchorEl = document.getElementById(hash);
147
+
148
+ var selectedLinkId;
149
+
150
+ if (anchorEl.tagName === 'A') {
151
+ // We were selected by <a> anchor, not by <hX[id]>.
152
+ // We want to highlight selected item in the nav
153
+ // according to the nearest header upwards from anchor.
154
+ var curEl = anchorEl;
155
+ while (true) {
156
+ var curEl = curEl.parentNode;
157
+ var nearestHeaderEl = curEl.querySelector('h2');
158
+ if (nearestHeaderEl && nearestHeaderEl.hasAttribute('id')) {
159
+ selectedLinkId = nearestHeaderEl.getAttribute('id');
160
+ break;
161
+ }
162
+ }
163
+ } else {
164
+ selectedLinkId = hash;
165
+ }
166
+
167
+ const selectedItemEl = highlightSelected(selectedLinkId, `./#${selectedLinkId}`);
168
+ window.setTimeout(function () { selectedItemEl.scrollIntoView(); }, 200);
169
+ };
170
+
171
+ _selectInitialItem();
172
+ window.addEventListener('scroll', _scrollUp);
173
+ }
174
+
124
175
  }());
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-open-project
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: '2.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-15 00:00:00.000000000 Z
11
+ date: 2019-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -72,28 +72,28 @@ dependencies:
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 1.3.4
75
+ version: '2.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 1.3.4
82
+ version: '2.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.16'
89
+ version: '2.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.16'
96
+ version: '2.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -161,6 +161,10 @@ files:
161
161
  - README.md
162
162
  - _config.yml
163
163
  - _includes/_nav-item.html
164
+ - _includes/external-link.html
165
+ - _includes/featured_posts.html
166
+ - _includes/featured_software.html
167
+ - _includes/featured_specs.html
164
168
  - _includes/home-hero.html
165
169
  - _includes/home-hub.html
166
170
  - _includes/home-project.html
@@ -232,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
236
  version: '0'
233
237
  requirements: []
234
238
  rubyforge_project:
235
- rubygems_version: 2.7.6
239
+ rubygems_version: 2.5.2.3
236
240
  signing_key:
237
241
  specification_version: 4
238
242
  summary: Open Project Jekyll theme