Skip to content

Commit

Permalink
添加 medium-zoom 用于查看图片
Browse files Browse the repository at this point in the history
  • Loading branch information
ufologist committed Mar 9, 2017
1 parent adc9ae1 commit f7c74f7
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 9 deletions.
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = function(grunt) {
'js/lib/template.js',
'js/lib/marked.js',
'js/lib/highlight.js',
'js/lib/medium-zoom.js',
'js/boot.js',
'js/pull2refresh.js',
'js/issuelist.js',
Expand Down
14 changes: 7 additions & 7 deletions dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<script src="js/lib/template.js"></script>
<script src="js/lib/marked.js"></script>
<script src="js/lib/highlight.js"></script>
<script src="js/lib/medium-zoom.js"></script>
<script src="js/boot.js"></script>
<script src="js/pull2refresh.js"></script>
<script src="js/issuelist.js"></script>
Expand All @@ -37,19 +38,18 @@
<script>
$.extend(spring.config, {
// my blog title
title: 'Spring',
title: '学前班',
// my blog description
desc: "A blog engine written by GitHub Issues \n[Fork me on GitHub](https://github.com/zhaoda/spring)",
desc: "学前端",
// my github username
owner: 'zhaoda',
owner: 'f2e-journey',
// creator's username
creator: 'zhaoda',
creator: '',
// the repository name on github for writting issues
repo: 'spring',
repo: 'xueqianban',
// custom page
pages: [
{name: 'About Spring', number: 1},
{name: 'Quick Start', number: 2}
// {name: 'About Spring', number: 1}
]
})
</script>
Expand Down
3 changes: 2 additions & 1 deletion dist/main.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<link rel="apple-touch-startup-image" href="img/apple-touch-startup-image-640x920.png" media="(-webkit-min-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="img/apple-touch-startup-image-640x1096.png" media="(device-height: 568px)">
<link rel="stylesheet" href="dist/main.min.css" />
<script src="dist/main.min.js"></script>
<script src="dist/main.min.js?v20170309"></script>
<script>
$.extend(spring.config, {
// my blog title
Expand Down
7 changes: 7 additions & 0 deletions js/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@

var commentsTplCompiled = template.compile(commentsTpl);

var mzoom;

// XXX 将获取数据的逻辑提升到服务层
function getIssueComments(number, callback) {
var url = '/repos/' + spring.config.owner + '/' + spring.config.repo + '/issues/' + number + '/comments';
Expand Down Expand Up @@ -129,6 +131,11 @@
issue = options.issue

$target.html(renderContent(issue))

if (mzoom) {
mzoom.detach()
}
mzoom = mediumZoom('.issues img')
})

$doc.trigger('spa:route', pageLabels)
Expand Down
10 changes: 10 additions & 0 deletions js/lib/medium-zoom.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f7c74f7

Please sign in to comment.