Helps if one includes the theme along with the site.

This commit is contained in:
James Harton 2019-03-08 15:20:01 +13:00
parent ea00028c2e
commit 277ce9cfe7
44 changed files with 1912 additions and 1 deletions

@ -1 +0,0 @@
Subproject commit 22c396e0290ac2f961101539cff47914961c9d58

8
site/themes/beautiful-hexo/.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
.DS_Store
Thumbs.db
db.json
*.log
node_modules/
public/
.deploy*/
.idea/

View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 twoyao
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,64 @@
# Beautiful-hexo
Beautiful-hexo is a simple elegant hexo theme ported from [Beautiful-jekyll](http://deanattali.com/beautiful-jekyll) which written by [Dean Attali](http://deanattali.com/aboutme). Nice work!
![hexo-preview](images/hexo-preview.png)
### Install
```
hexo init site
cd site
npm install --save hexo-generator-archive hexo-renderer-jade hexo-generator-tag hexo-generator-feed hexo-generator-sitemap hexo-browsersync
git clone --depth 1 https://github.com/twoyao/beautiful-hexo.git themes/beautiful-hexo
```
Modify `_config.yml` change `theme` to `beautiful-hexo` and configure hexo-generator-archive :
```
theme: beautiful-hexo
archive_generator:
per_page: 0
yearly: false
monthly: false
daily: false
```
### Comment
#### netease-gentie
Setup `comment.netease.productKey` in theme's `_config.yml`. For test, you have to ensure your website hostname match settings of netease-gentie.
To do so, add flollowing lines in /etc/hosts:
```
127.0.0.1 notes.example.com
```
And run hexo at 80 port: `sudo hexo s --debug -p 80`. After test, you may revert hosts file.
### Tags page
For displaying a page with all blog tags, create a folder named `tags` at `source` folder with the following `index.md` inside:
```
---
title: "Tags"
layout: "tags"
---
```
Don't forget to update your `navbar-links` at `beautiful-hexo` `_config.yml` file:
```
navbar-links:
...
Tags: /tags
```
Theme config file is brief and clear.
If you have any question, check [hexo online document](https://hexo.io/).

View file

@ -0,0 +1,89 @@
navbar-links:
Archive: /archives
Github: https://github.com/twoyao/beautiful-hexo
About: /about/
avatar: /hexo.png
favicon: /hexo.png
header:
title: "Beautiful Hexo"
motto: Build a beautiful and simple website in minutes
bigimgs:
- src: /bigimgs/01.jpg
desc: beautiful island
- src: /bigimgs/02.jpg
desc: Tropical Fish
- src: /bigimgs/03.jpg
desc: ocean
rss: /atom.xml
googlefonts:
- "Lora:400,700,400italic,700italic"
- "Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800"
highlight:
enable: true
# or use any highlight.js style
# style_path: "//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/styles/default.min.css"
style_path: "/css/highlight.css"
footer:
facebook:
link: # your link e.g. https://...
title: Facebook
icon: fa-facebook
enable: false
weibo:
link: 'http://weibo.com/bisyao?is_all=1'
title: Weibo
icon: fa-weibo
enable: true
github:
link: 'https://github.com/twoyao'
title: GitHub
icon: fa-github
enable: true
rss:
link: '/atom.xml'
title: RSS
icon: fa-rss
enable: true
twitter:
link: 'https://twitter.com/twoyao_'
title: Twitter
icon: fa-twitter
enable: true
mail:
link: 'mailto:bisyao@gmail.com'
title: Email me
icon: fa-envelope
enable: true
linkin:
link: # your link here e.g. http...
title: LinkedIn
icon: fa-linkedin
enable: false
stackoverflow:
link: # your link here e.g. http...
title: StackOverflow
icon: fa-stack-overflow
enable: false
google_analytics:
comment:
# false, disqus, netease or facebook
enable: netease
# disqus user, netease productKey or facebook appid
id: 64d7f0abf9224be3bfdcc6cfb9b83fcf
# [facebook only] plugin language
lang: en_US
# [facebook only] number of posts per load
numposts: 10
# IMPORTANT NOTE [Facebook Plugin]:
# If you are using Facebook Social Plugin and it's not working,
# please go to this URL https://developers.facebook.com/tools/debug/og/object/
# copy the link of your post there and press the button "Fetch new scrape information".
# In that way, you are going to update your post metatags Facebook Open Graph information.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View file

@ -0,0 +1,5 @@
prev: '← Newer Posts'
next: 'Older Posts →'
prev_post: '← Previous Post'
next_post: 'Next Post →'
more: '[Read More]'

View file

@ -0,0 +1,5 @@
prev: '← Últimos artículos'
next: 'Artículos más antiguos →'
prev_post: '← Artículo anterior'
next_post: 'Artículo siguiente →'
more: '[Lea más]'

View file

@ -0,0 +1,5 @@
prev: '← Nuovi Post'
next: 'Vecchi Post →'
prev_post: '← Post Precendete'
next_post: 'Post Successivo →'
more: '[Leggi di più]'

View file

@ -0,0 +1,5 @@
prev: '← 前の記事へ'
next: '次の記事へ →'
prev_post: '← 前の記事へ'
next_post: '次の記事へ →'
more: '[さらに読む]'

View file

@ -0,0 +1,5 @@
prev: '← Publicações Recentes'
next: 'Publicações Antigas →'
prev_post: '← Publicação Anterior'
next_post: 'Próxima Publicação →'
more: '[Leia Mais]'

View file

@ -0,0 +1,5 @@
prev: '← Новые'
next: 'Старые →'
prev_post: '← Пред.'
next_post: 'След. →'
more: '[Читать далее]'

View file

@ -0,0 +1,6 @@
prev: 上一页
next: 下一页
prev_post: 上一篇
next_post: 下一篇
more: 【阅读全文】

View file

@ -0,0 +1,24 @@
extends partial/base
block header
header.header-section
.intro-header.no-img
block content
.container
.row
.col-lg-6.col-lg-offset-3.col-md-10.col-md-offset-1
ul.archive-list
- var prev_year = 0;
- page.posts.each(function(post) {
- var current_year = full_date(post.date, 'YYYY')-0;
if current_year !== prev_year
h2= current_year
- prev_year=current_year;
li.col-lg-offset-1.col-md-offset-1
span.post-meta= full_date(post.date, 'MMM D')
a.post-title(href=url_for(post.path))= post.title
- })

View file

@ -0,0 +1,16 @@
extends partial/base
block header
include partial/index-header
block content
.container
.row
.col-lg-8.col-lg-offset-2.col-md-10.col-md-offset-1
article(role="main", class="blog-post")
!= page.content
include partial/comment

View file

@ -0,0 +1,36 @@
extends partial/base
block header
include partial/index-header
block content
div(class="container", role="main")
.row
.col-lg-8.col-lg-offset-2.col-md-10.col-md-offset-1
.posts-list
- page.posts.each(function (post) {
article.post-preview
a(href=url_for(post.path))
h2.post-title!= post.title
if post.subtitle
h3.post-subtitle!= post.subtitle
include partial/post-meta
+post_meta(post.date, post.tags)
.post-entry!= post.excerpt
a(href=url_for(post.path), class="post-read-more")!= __('more')
- })
ul.pager.main-pager
if page.prev
li.previous
a(href=url_for(page.prev === 1 ? "/" : ("/" + config.pagination_dir + "/" + page.prev)))= __('prev')
if page.next
li.next
a(href=url_for("/" + config.pagination_dir + "/" + page.next))= __('next')

View file

@ -0,0 +1,19 @@
extends partial/base
block header
header.header-section
.intro-header.no-img
.page-heading
h1!= page.title
if page.subtitle
hr.small
span.page-subheading!= page.subtitle
block content
.container
.row
.col-lg-8.col-lg-offset-2.col-md-10.col-md-offset-1
article(role="main", class="blog-post")
!= page.content
include partial/comment

View file

@ -0,0 +1,13 @@
doctype
html(lang=config.language)
head
include head
body
include nav
block header
block content
block comment
include footer
include footer-scripts

View file

@ -0,0 +1,7 @@
if theme.comment.enable && !page.comment_disable
if theme.comment.enable == "netease"
include netease.jade
else if theme.comment.enable == "disqus"
include disqus.jade
else if theme.comment.enable == "facebook"
include facebook-comments.jade

View file

@ -0,0 +1,15 @@
.disqus-comments
.comments
#disqus_thread
script.
var url_parts = window.location.href.split("?");
var disqus_url = url_parts[0];
(function () {
console.log("enter disqus");
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = "//#{theme.comment.id}.disqus.com/embed.js";
(document.head || d.body ).appendChild(dsq);
})();

View file

@ -0,0 +1,18 @@
//- FIXME: rename disqus-comments component to a generic name
.disqus-comments
.comments
#fb-root
script.
var fbc_url_parts = window.location.href.split("?");
var fbc_url = fbc_url_parts[0];
(function () {
var fbc = document.createElement('script');
fbc.type = 'text/javascript';
fbc.async = true;
fbc.src = "//connect.facebook.net/#{theme.comment.lang}/sdk.js#xfbml=1&version=v2.9";
(document.head || d.body ).appendChild(fbc);
//- FIXME: Sharing button should be an option
document.write('<div class="fb-share-button" data-href="' + document.location.href + '" data-layout="button" data-size="large">Share</div>');
document.write('<div class="fb-comments" data-href="' + document.location.href + '" data-width="100%" data-numposts="#{theme.comment.numposts}"></div>');
})();

View file

@ -0,0 +1,9 @@
script(src="//cdn.bootcss.com/jquery/1.11.2/jquery.min.js")
script(src="//cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js")
script(src=url_for("/js/main.js"))
if theme.highlight.enable
script(src="//cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js")
script hljs.initHighlightingOnLoad();
include google_analytics

View file

@ -0,0 +1,19 @@
footer
.container.beautiful-jekyll-footer
.row
.col-lg-8.col-lg-offset-2.col-md-10.col-md-offset-1
ul.list-inline.text-center.footer-links
each item in theme.footer
if item.enable
li
a(href=item.link, title=item.title)
span.fa-stack.fa-lg
i.fa.fa-circle.fa-stack-2x
i.fa.fa-stack-1x.fa-inverse(class=item.icon)
- var year = new Date().getFullYear();
p.copyright.text-muted.
© #{config.author} • #{year} • #[a(href="mailto:" + config.email)= config.email]
p.theme-by.text-muted.
Theme by
#[a(href="https://github.com/twoyao/beautiful-hexo") beautiful-hexo]

View file

@ -0,0 +1,16 @@
if theme.google_analytics
script.
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', '#{theme.google_analytics}', 'auto');
ga('send', 'pageview');

View file

@ -0,0 +1,41 @@
meta(charset="utf-8")
meta(http-equiv="X-UA-Compatible", content="IE=edge")
meta(name="viewport", content="width=device-width, initial-scale=1.0, maximum-scale=1.0")
meta(name="author", content=config.author)
link(rel="icon", href=url_for(theme.favicon))
title
block site_title
= config.title
block description
meta(name="description", content=config.description)
link(rel="alternate", type="application/rss+xml", title=config.title, href=url_for("/atom.xml"))
link(rel="stylesheet", href="//cdn.bootcss.com/font-awesome/4.5.0/css/font-awesome.min.css")
link(rel="stylesheet", href="//cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css")
link(rel="stylesheet", href=url_for("/css/main.css"))
if theme.highlight.enable
link(rel="stylesheet", href=url_for(theme.highlight.style_path))
if theme.googlefonts
each font in theme.googlefonts
link(rel="stylesheet", href="//fonts.googleapis.com/css?family="+font)
//- Facebook OpenGraph tags
//- FIXME: This works only if you are using Facebook comments
if theme.comment.enable == "facebook"
meta(property="og:type", content="website")
//- 966242223397117 is the default fb app_id if you does not have an app at Facebook Developers
meta(property="fb:app_id", content=theme.comment.id ? theme.comment.id : "966242223397117")
//- You can use either config.title or theme.header.title (It's up to you)
meta(property="og:title" content=page.title ? (page.title + " - " + config.title) : config.title)
//- The two meta properties below works for sharing the post on Facebook
//- Remember to set the image that you want at your post header (fb_og_image)!
//- Or you can use your avatar image (or any other image).
meta(property="og:image", content=page.fb_og_image ? page.fb_og_image : href=url_for(theme.avatar))
//- Remember to set the description that you want at your post header (fb_og_description)!
//- Or you can use either config.description or theme.header.motto (It's up to you)
meta(property="og:description", content=page.fb_og_description ? page.fb_og_description : config.description)

View file

@ -0,0 +1,18 @@
- var display_images = theme.header.bigimgs && theme.header.bigimgs.length > 0
if display_images
- var attrs = {'data-num-img': theme.header.bigimgs.length}
- theme.header.bigimgs.forEach(function(val, idx) { var c = idx+1; attrs["data-img-src-"+c]=url_for(val.src); attrs["data-img-desc-"+c]=val.desc;})
#header-big-imgs&attributes(attrs)
header.header-section(class={ 'has-img' : display_images })
.intro-header(class=display_images? 'big-img' : 'no-img')
.container
.row
.col-lg-8.col-lg-offset-2.col-md-10.col-md-offset-1
.page-heading
h1!= theme.header.title
hr.small
span.page-subheading!= theme.header.motto
span.img-desc

View file

@ -0,0 +1,18 @@
nav.navbar.navbar-default.navbar-fixed-top.navbar-custom
.container-fluid
.navbar-header
button(class="navbar-toggle", type="button", data-toggle="collapse", data-target="#main-navbar")
span.sr-only Toggle navigation
span.icon-bar
span.icon-bar
span.icon-bar
a(class="navbar-brand", href=url_for())= config.title
#main-navbar.collapse.navbar-collapse
ul.nav.navbar-nav.navbar-right
each value, key in theme["navbar-links"]
li
a(href=url_for(value))!= key
.avatar-container
.avatar-img-border
a(href=url_for())
img(class="avatar-img", src=url_for(theme.avatar))

View file

@ -0,0 +1,9 @@
#cloud-tie-wrapper.cloud-tie-wrapper
script(src="//img1.cache.netease.com/f2e/tie/yun/sdk/loader.js")
script.
var cloudTieConfig = {
url: document.location.href,
sourceId: "",
productKey: "#{theme.comment.id}",
target: "cloud-tie-wrapper"
};

View file

@ -0,0 +1,10 @@
mixin post_meta(date, tags)
p.post-meta Posted on #{full_date(date, "MMM D YYYY")}
if tags
- tags.each(function(tag) {
= ' · '
a.tag.post-meta(href=url_for(tag.path))= tag.name
- })

View file

@ -0,0 +1,35 @@
extends partial/base
include partial/post-meta
block header
header.header-section
.intro-header.no-img
.container
.row
.col-lg-8.col-lg-offset-2.col-md-10.col-md-offset-1
.post-heading
h1= page.title
if page.subtitle
h2.post-subheading= page.subtitle
+post_meta(page.date, page.tags)
block content
.container
.row
.col-lg-8.col-lg-offset-2.col-md-10.col-md-offset-1
article(role="main", class="blog-post")
!= page.content
ul.pager.blog-pager
if page.prev
li.previous
a(href=url_for(page.prev.path), data-toggle="tooltip", data-placement="top", title=page.prev.title)= __('prev_post')
if page.next
li.next
a(href=url_for(page.next.path), data-toggle="tooltip", data-placement="top", title=page.next.title)= __('next_post')
include partial/comment

View file

@ -0,0 +1,29 @@
extends partial/base
block header
header.header-section
.intro-header.no-img
block content
.container
.row
.col-lg-6.col-lg-offset-3.col-md-10.col-md-offset-1
ul.list-inline.text-center
- site.tags.map(function(tag) {
if tag.posts.length > 0
li
a.badge(href="#"+tag.name, rel=tag.length, style="font-size: 16px; padding: 8px; margin: 5px 5px 5px 5px;")= tag.name
- })
- site.tags.map(function(tag) {
if tag.posts.length > 0
ul.archive-list
span.fa.fa-tag.listing-seperator(id=tag.name, style="font-size: 1.17em;")
span(style="font-size: 1.5em; font-weight: bold; margin-left: 5px;")= tag.name
- tag.posts.map(function(post) {
li.col-lg-offset-1.col-md-offset-1
span.post-meta= full_date(post.date, 'MMM D')
a.post-title(href=url_for(post.path))= post.title
- })
- })

View file

@ -0,0 +1,24 @@
{
"name": "hexo-theme-beautiful-hexo",
"version": "1.0.0",
"description": "A hexo theme migarte from beautiful-jekyll",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/twoyao/beautiful-hexo.git"
},
"keywords": [
"hexo",
"theme",
"beautiful-hexo"
],
"author": "twoyao",
"license": "MIT",
"bugs": {
"url": "https://github.com/twoyao/beautiful-hexo/issues"
},
"homepage": "https://twoyao.github.io/beautiful-hexo/#readme"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

View file

@ -0,0 +1,94 @@
/**
* Tomorrow
* https://raw.githubusercontent.com/isagalaev/highlight.js/master/src/styles/tomorrow.css
*/
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
/* Tomorrow Comment */
.hljs-comment,
.hljs-quote {
color: #8e908c;
}
/* Tomorrow Red */
.hljs-variable,
.hljs-template-variable,
.hljs-tag,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class,
.hljs-regexp,
.hljs-deletion {
color: #c82829;
}
/* Tomorrow Orange */
.hljs-number,
.hljs-built_in,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-params,
.hljs-meta,
.hljs-link {
color: #f5871f;
}
/* Tomorrow Yellow */
.hljs-attribute {
color: #eab700;
}
/* Tomorrow Green */
.hljs-string,
.hljs-symbol,
.hljs-bullet,
.hljs-addition {
color: #718c00;
}
/* Tomorrow Blue */
.hljs-title,
.hljs-section {
color: #4271ae;
}
/* Tomorrow Purple */
.hljs-keyword,
.hljs-selector-tag {
color: #8959a8;
}
.hljs {
display: block;
overflow-x: auto;
/*background: white;*/
color: #4d4d4c;
padding: 0.5em;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
/* --- Custom --- */
pre {
background: url("./blueprint-dark.png") top center #fafbfc;
border-left: 5px solid #558abb;
color: #4d4e53;
font-family: Consolas,Monaco,'Andale Mono',monospace;
font-weight: 400;
-moz-tab-size: 4;
tab-size: 4;
-moz-hyphens: none;
-webkit-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}

View file

@ -0,0 +1,13 @@
.main-content {
padding-bottom: 50px;
}
footer.footer-min {
position: fixed;
bottom: 0;
width: 100%;
padding: 3px;
background-color: #f5f5f5;
border-top: 1px solid #eeeeee;
text-align: center;
}

View file

@ -0,0 +1,587 @@
/*@import url("pygment_highlights.css");*/
/* --- General --- */
body {
font-family: 'Lora', 'Times New Roman', serif;
font-size: 18px;
color: #404040;
position: relative;
background: #FFF;
}
p {
line-height: 1.5;
margin: 30px 0;
}
p a {
/* text-decoration: underline */
color: #008AFF;
}
h1,h2,h3,h4,h5,h6 {
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 800;
}
a {
color: #008AFF;
}
a:hover,
a:focus {
color: #0085a1;
}
blockquote {
color: #808080;
font-style: italic;
}
blockquote p:first-child {
margin-top: 0;
}
hr.small {
max-width: 100px;
margin: 15px auto;
border-width: 4px;
border-color: inherit;
border-radius: 3px;
}
.main-content {
padding-top: 80px;
}
@media only screen and (min-width: 768px) {
.main-content {
padding-top: 130px;
}
}
.main-explain-area {
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 15px inherit;
}
.hideme {
display: none;
}
::-moz-selection {
color: white;
text-shadow: none;
background: #0085a1;
}
::selection {
color: white;
text-shadow: none;
background: #0085a1;
}
img::selection {
color: white;
background: transparent;
}
img::-moz-selection {
color: white;
background: transparent;
}
img {
max-width: 100%;
}
.disqus-comments {
margin-top: 30px;
}
@media only screen and (min-width: 768px) {
.disqus-comments {
margin-top: 40px;
}
}
/* --- Navbar --- */
.navbar-custom {
background: #F5F5F5;
border-bottom: 1px solid #EAEAEA;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.navbar-custom .nav li a {
text-transform: uppercase;
font-size: 12px;
letter-spacing: 1px;
}
.navbar-custom .navbar-brand,
.navbar-custom .nav li a {
font-weight: 800;
color: #404040;
}
.navbar-custom .navbar-brand:hover,
.navbar-custom .navbar-brand:focus ,
.navbar-custom .nav li a:hover,
.navbar-custom .nav li a:focus {
color: #0085a1;
}
@media only screen and (min-width: 768px) {
.navbar-custom {
padding: 20px 0;
-webkit-transition: background .5s ease-in-out,padding .5s ease-in-out;
-moz-transition: background .5s ease-in-out,padding .5s ease-in-out;
transition: background .5s ease-in-out,padding .5s ease-in-out;
}
.navbar-custom.top-nav-short {
padding: 0;
}
}
.navbar-custom .avatar-container {
opacity: 1;
position: absolute;
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
left: 50%;
width: 50px;
margin-top: -25px;
}
.navbar-custom .avatar-container .avatar-img-border {
width: 100%;
border-radius: 50%;
margin-left: -50%;
display: inline-block;
box-shadow: 0 0 8px rgba(0, 0, 0, .8);
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .8);
-moz-box-shadow: 0 0 8px rgba(0, 0, 0, .8);
}
.navbar-custom .avatar-container .avatar-img {
width: 100%;
border-radius: 50%;
display: block;
}
.navbar-custom.top-nav-short .avatar-container{
opacity: 0;
}
.navbar-custom.top-nav-expanded .avatar-container {
display: none;
}
@media only screen and (min-width: 768px) {
.navbar-custom .avatar-container {
width: 100px;
margin-top: -50px;
}
.navbar-custom .avatar-container .avatar-img-border {
width: 100%;
box-shadow: 1px 1px 2px rgba(0, 0, 0, .8);
-webkit-box-shadow: 1px 1px 2px rgba(0, 0, 0, .8);
-moz-box-shadow: 1px 1px 2px rgba(0, 0, 0, .8);
}
.navbar-custom .avatar-container .avatar-img {
width: 100%;
}
}
/* Multi-level navigation links */
.navbar-custom .nav .navlinks-container {
position: relative;
}
.navbar-custom .nav .navlinks-parent:after {
content: " \25BC";
}
.navbar-custom .nav .navlinks-children {
width: 100%;
display: none;
word-break: break-word;
}
.navbar-custom .nav .navlinks-container .navlinks-children a {
display: block;
padding: 10px;
padding-left: 30px;
background: #f5f5f5;
text-decoration: none !important;
border-width: 0 1px 1px 1px;
font-weight: normal;
}
@media only screen and (max-width: 767px) {
.navbar-custom .nav .navlinks-container.show-children {
background: #eee;
}
.navbar-custom .nav .navlinks-container.show-children .navlinks-children {
display: block;
}
}
@media only screen and (min-width: 768px) {
.navbar-custom .nav .navlinks-container {
text-align: center;
}
.navbar-custom .nav .navlinks-container:hover {
background: #eee;
}
.navbar-custom .nav .navlinks-container:hover .navlinks-children {
display: block;
}
.navbar-custom .nav .navlinks-children {
position: absolute;
}
.navbar-custom .nav .navlinks-container .navlinks-children a {
padding-left: 10px;
border: 1px solid #eaeaea;
border-width: 0 1px 1px;
}
}
/* --- Footer --- */
footer {
padding: 30px 0;
background: #F5F5F5;
border-top: 1px #EAEAEA solid;
margin-top: 50px;
font-size: 14px;
}
footer a {
color: #404040;
}
footer .list-inline {
margin: 0;
padding: 0;
}
footer .copyright {
font-family: Open Sans;
text-align: center;
margin-bottom: 0;
}
footer .theme-by {
text-align: center;
margin: 10px 0 0;
}
@media only screen and (min-width: 768px) {
footer {
padding: 50px 0;
}
footer .footer-links {
font-size: 18px;
}
footer .copyright {
font-size: 16px;
}
}
/* --- Post preview --- */
.post-preview {
padding: 20px 0;
border-bottom: 1px solid #eee;
}
@media only screen and (min-width: 768px) {
.post-preview {
padding: 35px 0;
}
}
.post-preview:last-child {
border-bottom: 0;
}
.post-preview a {
text-decoration: none;
color: #404040;
}
.post-preview a:focus,
.post-preview a:hover {
text-decoration: none;
color: #0085a1;
}
.post-preview .post-title {
font-size: 30px;
margin-top: 0;
}
.post-preview .post-subtitle {
margin: 0;
font-weight: 300;
margin-bottom: 10px;
}
.post-preview .post-meta,
.post-heading .post-meta {
color: #808080;
font-size: 18px;
font-style: italic;
margin: 0 0 10px;
}
.post-preview .post-entry {
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.post-preview .post-read-more {
font-weight: 800;
}
@media only screen and (min-width: 768px) {
.post-preview .post-title {
font-size: 36px;
}
}
/* --- Post and page headers --- */
.intro-header {
margin: 80px 0 20px;
position: relative;
}
.intro-header.big-img {
background: no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
margin-top: 51px; /* The small navbar is 50px tall + 1px border */
margin-bottom: 35px;
}
.intro-header.big-img .big-img-transition {
position: absolute;
width: 100%;
height: 100%;
opacity: 0;
background: no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
-webkit-transition: opacity 1s linear;
-moz-transition: opacity 1s linear;
transition: opacity 1s linear;
}
.intro-header .page-heading {
text-align: center;
}
.intro-header.big-img .page-heading,
.intro-header.big-img .post-heading {
padding: 100px 0;
color: #FFF;
text-shadow: 1px 1px 3px #000;
}
.intro-header .page-heading h1 {
margin-top: 0;
font-size: 50px;
}
.intro-header .post-heading h1 {
margin-top: 0;
font-size: 35px;
}
.intro-header .page-heading .page-subheading,
.intro-header .post-heading .post-subheading {
font-size: 27px;
line-height: 1.1;
display: block;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 300;
margin: 10px 0 0;
}
.intro-header .post-heading .post-subheading {
margin-bottom: 20px;
}
.intro-header.big-img .page-heading .page-subheading,
.intro-header.big-img .post-heading .post-subheading {
font-weight: 400;
}
.intro-header.big-img .page-heading hr {
box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
-moz-box-shadow: 1px 1px 3px #000;
}
.intro-header.big-img .post-heading .post-meta {
color: #EEE;
}
.intro-header.big-img .img-desc {
background: rgba(30, 30, 30, 0.6);
position: absolute;
padding: 5px 10px;
font-size: 11px;
color: #EEE;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
right: 0;
bottom: 0;
display: none;
}
@media only screen and (min-width: 768px) {
.intro-header {
margin-top: 130px;
}
.intro-header.big-img {
margin-top: 91px; /* Full navbar is small navbar + 20px padding on each side when expanded */
}
.intro-header.big-img .page-heading,
.intro-header.big-img .post-heading {
padding: 150px 0;
}
.intro-header .page-heading h1 {
font-size: 80px;
}
.intro-header .post-heading h1 {
font-size: 50px;
}
.intro-header.big-img .img-desc {
font-size: 14px;
}
}
.header-section.has-img .no-img {
margin-top: 0;
background: #FCFCFC;
margin: 0 0 40px;
padding: 20px 0;
box-shadow: 0 0 5px #AAA;
}
/* Many phones are 320 or 360px, so make sure images are a proper aspect ratio in those cases */
.header-section.has-img .intro-header.no-img {
display: none;
}
@media only screen and (max-width: 365px) {
.header-section.has-img .intro-header.no-img {
display: block;
}
.intro-header.big-img {
width: 100%;
height: 220px;
}
.intro-header.big-img .page-heading,
.intro-header.big-img .post-heading {
display: none;
}
.header-section.has-img .big-img {
margin-bottom: 0;
}
}
@media only screen and (max-width: 325px) {
.intro-header.big-img {
height: 200px;
}
}
.caption {
text-align: center;
font-size: 14px;
padding: 10px;
font-style: italic;
margin: 0;
display: block;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
}
/* --- Pager --- */
.pager li a {
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
text-transform: uppercase;
font-size: 14px;
font-weight: 800;
letter-spacing: 1px;
padding: 10px 5px;
background: #FFF;
border-radius: 0;
color: #404040;
}
@media only screen and (min-width: 768px) {
.pager li a {
padding: 15px 25px;
}
}
.pager li a:hover,
.pager li a:focus {
color: #FFF;
background: #0085a1;
border: 1px solid #0085a1;
}
.pager {
margin: 10px 0 0;
}
.pager.blog-pager {
margin-top: 0;
}
@media only screen and (min-width: 768px) {
.pager.blog-pager {
margin-top: 10px;
}
}
/* --- Tables --- */
table {
padding: 0;
}
table tr {
border-top: 1px solid #cccccc;
background-color: #ffffff;
margin: 0;
padding: 0;
}
table tr:nth-child(2n) {
background-color: #f8f8f8;
}
table tr th {
font-weight: bold;
border: 1px solid #cccccc;
text-align: left;
margin: 0;
padding: 6px 13px;
}
table tr td {
border: 1px solid #cccccc;
text-align: left;
margin: 0;
padding: 6px 13px;
}
table tr th :first-child,
table tr td :first-child {
margin-top: 0;
}
table tr th :last-child,
table tr td :last-child {
margin-bottom: 0;
}
.archive-list li {
list-style: none;
padding-top: 5px;
padding-bottom: 5px;
overflow: hidden;
}
.archive-list li span {
color: #808080;
margin-right: 25px;
font-style: italic;
}
.tag:focus, .tag:hover {
text-decoration: none;
color: #0085a1
}
figure.highlight>table,
figure.highlight>table .code {
width: 100%;
border: none;
padding: 0;
}
figure.highlight>table tr {
border-top: none;
}
figure.highlight>table .gutter {
display:none;
}

View file

@ -0,0 +1,419 @@
/*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Change the default font family in all browsers (opinionated).
* 2. Prevent adjustments of font size after orientation changes in IE and iOS.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove the margin in all browsers (opinionated).
*/
body {
margin: 0;
}
/* HTML5 display definitions
========================================================================== */
/**
* Add the correct display in IE 9-.
* 1. Add the correct display in Edge, IE, and Firefox.
* 2. Add the correct display in IE.
*/
article,
aside,
details, /* 1 */
figcaption,
figure,
footer,
header,
main, /* 2 */
menu,
nav,
section,
summary { /* 1 */
display: block;
}
/**
* Add the correct display in IE 9-.
*/
audio,
canvas,
progress,
video {
display: inline-block;
}
/**
* Add the correct display in iOS 4-7.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Add the correct display in IE 10-.
* 1. Add the correct display in IE.
*/
template, /* 1 */
[hidden] {
display: none;
}
/* Links
========================================================================== */
/**
* 1. Remove the gray background on active links in IE 10.
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
*/
a {
background-color: transparent; /* 1 */
-webkit-text-decoration-skip: objects; /* 2 */
}
/**
* Remove the outline on focused links when they are also active or hovered
* in all browsers (opinionated).
*/
a:active,
a:hover {
outline-width: 0;
}
/* Text-level semantics
========================================================================== */
/**
* 1. Remove the bottom border in Firefox 39-.
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Prevent the duplicate application of `bolder` by the next rule in Safari 6.
*/
b,
strong {
font-weight: inherit;
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* Add the correct font style in Android 4.3-.
*/
dfn {
font-style: italic;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
* Add the correct background and color in IE 9-.
*/
mark {
background-color: #ff0;
color: #000;
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10-.
*/
img {
border-style: none;
}
/**
* Hide the overflow in IE.
*/
svg:not(:root) {
overflow: hidden;
}
/* Grouping content
========================================================================== */
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
pre,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct margin in IE 8.
*/
figure {
margin: 1em 40px;
}
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/* Forms
========================================================================== */
/**
* 1. Change font properties to `inherit` in all browsers (opinionated).
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
select,
textarea {
font: inherit; /* 1 */
margin: 0; /* 2 */
}
/**
* Restore the font weight unset by the previous rule.
*/
optgroup {
font-weight: bold;
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
}
/**
* 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
* controls in Android 4.
* 2. Correct the inability to style clickable types in iOS and Safari.
*/
button,
html [type="button"], /* 1 */
[type="reset"],
[type="submit"] {
-webkit-appearance: button; /* 2 */
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Change the border, margin, and padding in all browsers (opinionated).
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Remove the default vertical scrollbar in IE.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10-.
* 2. Remove the padding in IE 10-.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding and cancel buttons in Chrome and Safari on OS X.
*/
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Correct the text style of placeholders in Chrome, Edge, and Safari.
*/
::-webkit-input-placeholder {
color: inherit;
opacity: 0.54;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}

View file

@ -0,0 +1 @@
/*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */progress,sub,sup{vertical-align:baseline}button,hr,input{overflow:visible}[type=checkbox],[type=radio],legend{box-sizing:border-box;padding:0}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}svg:not(:root){overflow:hidden}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}button,input,select,textarea{font:inherit;margin:0}optgroup{font-weight:700}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:ButtonText dotted 1px}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{color:inherit;display:table;max-width:100%;white-space:normal}textarea{overflow:auto}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-input-placeholder{color:inherit;opacity:.54}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}

View file

@ -0,0 +1,66 @@
.highlight { background: #ffffff; }
.highlight pre { background-color: #fff; font-size: 16px }
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { font-weight: bold } /* Keyword.Constant */
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d14 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #000080 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
.highlight .sc { color: #d14 } /* Literal.String.Char */
.highlight .sd { color: #d14 } /* Literal.String.Doc */
.highlight .s2 { color: #d14 } /* Literal.String.Double */
.highlight .se { color: #d14 } /* Literal.String.Escape */
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
.highlight .si { color: #d14 } /* Literal.String.Interpol */
.highlight .sx { color: #d14 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d14 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
/* Make line numbers unselectable: excludes line numbers from copy-paste user ops */
.highlight .lineno {color:rgba(0,0,0,0.3);padding: 0 10px;-webkit-user-select: none;-moz-user-select: none; -o-user-select: none;}
.lineno::-moz-selection {background-color: transparent;} /* Mozilla specific */
.lineno::selection {background-color: transparent;} /* Other major browsers */

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,138 @@
// Dean Attali / Beautiful Jekyll 2016
var main = {
bigImgEl : null,
numImgs : null,
init : function() {
// Shorten the navbar after scrolling a little bit down
$(window).scroll(function() {
if ($(".navbar").offset().top > 50) {
$(".navbar").addClass("top-nav-short");
} else {
$(".navbar").removeClass("top-nav-short");
}
});
// On mobile, hide the avatar when expanding the navbar menu
$('#main-navbar').on('show.bs.collapse', function () {
$(".navbar").addClass("top-nav-expanded");
});
$('#main-navbar').on('hidden.bs.collapse', function () {
$(".navbar").removeClass("top-nav-expanded");
});
// On mobile, when clicking on a multi-level navbar menu, show the child links
$('#main-navbar').on("click", ".navlinks-parent", function(e) {
var target = e.target;
$.each($(".navlinks-parent"), function(key, value) {
if (value == target) {
$(value).parent().toggleClass("show-children");
} else {
$(value).parent().removeClass("show-children");
}
});
});
// Ensure nested navbar menus are not longer than the menu header
var menus = $(".navlinks-container");
if (menus.length > 0) {
var navbar = $("#main-navbar ul");
var fakeMenuHtml = "<li class='fake-menu' style='display:none;'><a></a></li>";
navbar.append(fakeMenuHtml);
var fakeMenu = $(".fake-menu");
$.each(menus, function(i) {
var parent = $(menus[i]).find(".navlinks-parent");
var children = $(menus[i]).find(".navlinks-children a");
var words = [];
$.each(children, function(idx, el) { words = words.concat($(el).text().trim().split(/\s+/)); });
var maxwidth = 0;
$.each(words, function(id, word) {
fakeMenu.html("<a>" + word + "</a>");
var width = fakeMenu.width();
if (width > maxwidth) {
maxwidth = width;
}
});
$(menus[i]).css('min-width', maxwidth + 'px')
});
fakeMenu.remove();
}
// show the big header image
main.initImgs();
},
initImgs : function() {
// If the page was large images to randomly select from, choose an image
if ($("#header-big-imgs").length > 0) {
main.bigImgEl = $("#header-big-imgs");
main.numImgs = main.bigImgEl.attr("data-num-img");
// 2fc73a3a967e97599c9763d05e564189
// set an initial image
var imgInfo = main.getImgInfo();
var src = imgInfo.src;
var desc = imgInfo.desc;
main.setImg(src, desc);
// For better UX, prefetch the next image so that it will already be loaded when we want to show it
var getNextImg = function() {
var imgInfo = main.getImgInfo();
var src = imgInfo.src;
var desc = imgInfo.desc;
var prefetchImg = new Image();
prefetchImg.src = src;
// if I want to do something once the image is ready: `prefetchImg.onload = function(){}`
setTimeout(function(){
var img = $("<div></div>").addClass("big-img-transition").css("background-image", 'url(' + src + ')');
$(".intro-header.big-img").prepend(img);
setTimeout(function(){ img.css("opacity", "1"); }, 50);
// after the animation of fading in the new image is done, prefetch the next one
//img.one("transitioned webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(){
setTimeout(function() {
main.setImg(src, desc);
img.remove();
getNextImg();
}, 1000);
//});
}, 6000);
};
// If there are multiple images, cycle through them
if (main.numImgs > 1) {
getNextImg();
}
}
},
getImgInfo : function() {
var randNum = Math.floor((Math.random() * main.numImgs) + 1);
var src = main.bigImgEl.attr("data-img-src-" + randNum);
var desc = main.bigImgEl.attr("data-img-desc-" + randNum);
return {
src : src,
desc : desc
}
},
setImg : function(src, desc) {
$(".intro-header.big-img").css("background-image", 'url(' + src + ')');
if (typeof desc !== typeof undefined && desc !== false) {
$(".img-desc").text(desc).show();
} else {
$(".img-desc").hide();
}
}
};
// 2fc73a3a967e97599c9763d05e564189
document.addEventListener('DOMContentLoaded', main.init);