mirror of
https://github.com/vacp2p/libp2p-website.git
synced 2026-01-08 23:08:08 -05:00
rmv unused bundles logic (#160)
This commit is contained in:
123
js/bundles.js
123
js/bundles.js
@@ -1,123 +0,0 @@
|
||||
var $ = require('jquery')
|
||||
var initPage = require('./lib/init-page')
|
||||
|
||||
initPage()
|
||||
|
||||
$(function () {
|
||||
$('nav a', 'article').on('click', function (e) {
|
||||
e.preventDefault()
|
||||
var mobile = $(window).innerWidth() <= 767
|
||||
var $nav = $(this)
|
||||
var $parentNav = $nav.closest('nav')
|
||||
var $parent = $nav.closest('section')
|
||||
var showUl = $nav.data('info')
|
||||
|
||||
$parentNav.children('a').each(function () {
|
||||
$(this).removeClass('active')
|
||||
})
|
||||
$nav.addClass('active')
|
||||
|
||||
$('ul', $parent).each(function () {
|
||||
$(this).removeClass('show')
|
||||
})
|
||||
$('ul' + '.' + showUl, $parent).addClass('show')
|
||||
alignment()
|
||||
|
||||
if (mobile) {
|
||||
$parentNav.css('display', 'none')
|
||||
}
|
||||
$parent.find('.active-link span').text($nav.text())
|
||||
})
|
||||
|
||||
function alignment () {
|
||||
$('ul.calc-col.show').each(function () {
|
||||
var $ul = $(this)
|
||||
var ulWidth = $ul.outerWidth()
|
||||
var liCount = $ul[0].childElementCount
|
||||
var colCount = 0
|
||||
|
||||
if (liCount > 0 && liCount <= 5) {
|
||||
colCount = 1
|
||||
$ul.addClass('one-col')
|
||||
} else if (liCount <= 10) {
|
||||
colCount = 2
|
||||
$ul.addClass('two-col')
|
||||
} else {
|
||||
colCount = 3
|
||||
$ul.addClass('three-col')
|
||||
}
|
||||
|
||||
var maxWidth = 0
|
||||
$ul.children('li').each(function () {
|
||||
var $li = $(this)
|
||||
$li.css({'min-width': '0', 'width': 'auto'})
|
||||
|
||||
if ($li.width() > maxWidth) maxWidth = $li.width()
|
||||
})
|
||||
$ul.children('li').css({'min-width': '100px', 'max-width': maxWidth + 15 + 'px', 'width': '100%'})
|
||||
|
||||
if (colCount === 2) {
|
||||
var pad = (ulWidth - (((maxWidth + 15) * 2) + 60)) / 2
|
||||
$ul.css({'padding-left': pad + 'px', 'padding-right': pad + 'px'})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$(window).on('load resize', function () {
|
||||
alignment()
|
||||
})
|
||||
|
||||
$('a.scroll').on('click', function (e) {
|
||||
e.preventDefault()
|
||||
var scrollToId = $(this).attr('href')
|
||||
var $scrollTo = $(scrollToId)
|
||||
$('html, body').animate({scrollTop: $scrollTo.offset().top - 100}, 500, 'swing')
|
||||
|
||||
var mobile = $(window).innerWidth() <= 767
|
||||
if (mobile) {
|
||||
var $columns = $(this).closest('.columns')
|
||||
var $links = $columns.closest('.links')
|
||||
$columns.css('display', 'none')
|
||||
$links.find('.active-link .copy-block').html($(this).html())
|
||||
}
|
||||
})
|
||||
|
||||
$('.active-link', 'aside.left').on('click', function (e) {
|
||||
e.preventDefault()
|
||||
var $link = $(this)
|
||||
var $parent = $link.closest('aside.left')
|
||||
var $nav = $parent.find('nav')
|
||||
|
||||
if ($nav.css('display') === 'flex') {
|
||||
$nav.css('display', 'none')
|
||||
} else {
|
||||
$nav.css('display', 'flex')
|
||||
}
|
||||
})
|
||||
|
||||
$('.active-link', '.links').on('click', function (e) {
|
||||
e.preventDefault()
|
||||
var $link = $(this)
|
||||
var $parent = $link.closest('.links')
|
||||
var $columns = $parent.find('.columns')
|
||||
|
||||
if ($columns.css('display') === 'flex') {
|
||||
$columns.css('display', 'none')
|
||||
} else {
|
||||
$columns.css('display', 'flex')
|
||||
}
|
||||
})
|
||||
|
||||
$(window).on('click', function (e) {
|
||||
var $elem = e.target
|
||||
var mobile = $(window).innerWidth() <= 767
|
||||
if (mobile) {
|
||||
if (!$($elem.closest('aside.left')).length) {
|
||||
$('aside.left nav:visible').css('display', 'none')
|
||||
}
|
||||
if (!$($elem.closest('.links')).length) {
|
||||
$('.columns', '.links').css('display', 'none')
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -1,42 +0,0 @@
|
||||
<section id="{{ .id }}">
|
||||
<aside class="left">
|
||||
<div class="active-link">
|
||||
<span>Transport</span><i class="fa fa-angle-down" aria-hidden="true"></i>
|
||||
</div>
|
||||
<nav>
|
||||
{{ range $index, $element := .categories }}
|
||||
<a href="#" {{ if eq $index 0 }}class="active"{{end}} data-info="{{ .id }}" style="text-transform: capitalize;">
|
||||
{{if isset . "name"}}
|
||||
{{ .name }}
|
||||
{{else}}
|
||||
{{ humanize .id }}
|
||||
{{end}}
|
||||
</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
</aside>
|
||||
<div class="content">
|
||||
<div class="title">
|
||||
<div class="wrapper">
|
||||
<div class="img">
|
||||
<img src="{{ .image }}" alt="{{ .name }}" title="{{ .name }}">
|
||||
</div>
|
||||
<a class="btn-interface" target="_blank" href="{{ .github }}">GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info">
|
||||
{{ range $index, $element := .categories }}
|
||||
<ul class="{{ .id }} calc-col one-col {{if eq $index 0}}show{{end}}">
|
||||
{{ range .modules }}
|
||||
<li style="min-width: 100px; width: 100%; max-width: 168px;">
|
||||
<a href="{{ .url }}">
|
||||
{{ partial "status-icon" . }}
|
||||
<span>{{ .id }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
Reference in New Issue
Block a user