Skip to content

Commit

Permalink
v1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
yscoder committed Nov 29, 2016
1 parent 6862c4c commit 604b4df
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 37 deletions.
1 change: 0 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# hexo-theme-indigo
# https://github.com/yscoder/hexo-theme-indigo
version: 1.3.1

#添加新菜单项遵循以下规则
# menu:
Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@
<link rel="alternative" href="<%- theme.rss %>" title="<%= config.title %>" type="application/atom+xml">
<% } %>
<%- favicon_tag(theme.favicon) %>
<link rel="stylesheet" href="<%= url_for('/css/style.css?v='+ theme.version) %>">
<link rel="stylesheet" href="<%= url_for('/css/style.css?v='+ theme_version()) %>">
</head>
2 changes: 1 addition & 1 deletion layout/_partial/post/duoshuo.ejs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="duoshuo" id="comments">
<div class="ds-thread" data-thread-key="<%=key%>" data-title="<%=title%>" data-url="<%=url.replace(/index\.html$/, '')%>"></div>
</div>
<script src="<%= url_for('/js/embed' + (cache ? '.min': '') + '.js?v=' + theme.version) %>"></script>
<script src="<%= url_for('/js/embed' + (cache ? '.min': '') + '.js?v=' + theme_version()) %>"></script>
<script src="//cdn.bootcss.com/marked/0.3.6/marked.min.js" async="async"></script>
<script>
var duoshuoQuery = {short_name:'<%=theme.duoshuo %>', theme: 'none'}
Expand Down
4 changes: 2 additions & 2 deletions layout/_partial/script.ejs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script src="<%= url_for('/js/main' + (cache ? '.min': '') + '.js?v=' + theme.version) %>"></script>
<script src="<%= url_for('/js/main' + (cache ? '.min': '') + '.js?v=' + theme_version()) %>"></script>

<% if (theme.search){ %>
<%- partial('search') %>
<script src="<%= url_for('/js/search' + (cache ? '.min': '') + '.js?v=' + theme.version) %>"></script>
<script src="<%= url_for('/js/search' + (cache ? '.min': '') + '.js?v=' + theme_version()) %>"></script>
<% } %>

<% if (theme.mathjax){ %>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-material-indigo",
"version": "1.3.1",
"version": "1.3.2",
"description": "Material Design theme for Hexo.",
"keywords": [
"hexo",
Expand Down
3 changes: 3 additions & 0 deletions scripts/plugins.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const version = require('../package.json').version
hexo.extend.helper.register('theme_version', () => version)

function renderImage(src, alt = '', title = '') {
return `<figure class="image-bubble">
<div class="img-lightbox">
Expand Down
7 changes: 7 additions & 0 deletions source/css/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ small {
line-height: 1;
}

main {
display: block
}
template {
display: none
}

img {
max-width: 100%;
border: none;
Expand Down
55 changes: 30 additions & 25 deletions source/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
y: y
};
},
docEl = navigator.userAgent.indexOf('Firefox') !== -1 ? d.documentElement : body;
docEl = !!navigator.userAgent.match(/firefox/i) || navigator.msPointerEnabled ? d.documentElement : body;

var Blog = {
goTop: function (end) {
Expand Down Expand Up @@ -115,7 +115,8 @@
el.addEventListener('click', function (e) {
e.preventDefault();
var top = offset($('[id="' + decodeURIComponent(this.hash).substr(1) + '"]')).y - headerH;
animate(Blog.goTop.bind(Blog, top));
// animate(Blog.goTop.bind(Blog, top));
docEl.scrollTop = top;
})
});

Expand Down Expand Up @@ -271,13 +272,11 @@
this.title = this.$img.title || this.$img.alt || '';
this.isZoom = false;

var naturalW = this.$img.naturalWidth || this.$img.width;
var naturalH = this.$img.naturalHeight || this.$img.height;
var imgRect, docW, docH;
var naturalW, naturalH, imgRect, docW, docH;

this.calcRect = function () {
docW = docEl.clientWidth;
docH = docEl.clientHeight;
docW = body.clientWidth;
docH = body.clientHeight;
var inH = docH - this.margin * 2;
var w = naturalW;
var h = naturalH;
Expand Down Expand Up @@ -317,16 +316,16 @@

// this.updateSize = function () {
// var sw = sh = 1;
// if (docW !== docEl.clientWidth) {
// sw = docEl.clientWidth / docW;
// if (docW !== body.clientWidth) {
// sw = body.clientWidth / docW;
// }

// if (docH !== docEl.clientHeight) {
// sh = docEl.clientHeight / docH;
// if (docH !== body.clientHeight) {
// sh = body.clientHeight / docH;
// }

// docW = docEl.clientWidth;
// docH = docEl.clientHeight;
// docW = body.clientWidth;
// docH = body.clientHeight;
// var rect = this.$img.getBoundingClientRect();
// var w = rect.width * sw;
// var h = rect.height * sh;
Expand Down Expand Up @@ -385,22 +384,29 @@
}, 300);
}

element.addEventListener('click', function (e) {
_this.isZoom ? _this.zoomOut() : e.target.tagName === 'IMG' && _this.zoomIn()
})
this.init = function () {
naturalW = this.naturalWidth || this.width;
naturalH = this.naturalHeight || this.height;

d.addEventListener('scroll', function () {
_this.isZoom && _this.zoomOut()
})
element.addEventListener('click', function (e) {
_this.isZoom ? _this.zoomOut() : e.target.tagName === 'IMG' && _this.zoomIn()
})

w.addEventListener('resize', function () {
// _this.isZoom && _this.updateSize()
_this.isZoom && _this.zoomOut()
})
d.addEventListener('scroll', function () {
_this.isZoom && _this.zoomOut()
})

w.addEventListener('resize', function () {
// _this.isZoom && _this.updateSize()
_this.isZoom && _this.zoomOut()
})
}

this.$img.addEventListener('load', this.init)
}

forEach.call($$('.img-lightbox'), function (el) {
var lightbox = new LightBox(el);
new LightBox(el)
})
})()
};
Expand Down Expand Up @@ -463,7 +469,6 @@
Blog.reward()
}

Blog.docEl = docEl;
Blog.noop = noop;
Blog.even = even;
Blog.$ = $;
Expand Down
Loading

0 comments on commit 604b4df

Please sign in to comment.