Skip to content

Commit

Permalink
refactor: fancyBox configuration 代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
MOxFIVE committed Jan 9, 2016
1 parent 5b7c815 commit f0c061c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 47 deletions.
16 changes: 0 additions & 16 deletions layout/_partial/after-footer.ejs
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
<% if (!is_page() && !is_post()){ %>
<script>
var yiliaConfig = {
fancybox: false,
mathjax: <%=theme.mathjax%>,
animate: <%=theme.animate%>,
isHome: <%=is_home()%>,
isPost: <%=is_post()%>,
isArchive: <%=is_archive()%>,
isTag: <%=is_tag()%>,
isCategory: <%=is_category()%>,
open_in_new: <%=theme.open_in_new%>
}
</script>
<% } %>

<%- js('http://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min') %>
<%- js('js/main') %>
<%- partial('_partial/background') %>
Expand Down
37 changes: 6 additions & 31 deletions layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -85,35 +85,10 @@

<%- partial('_partial/post-nav-button') %>

<% if (post.fancybox != false){ %>
<% if (theme.fancybox){ %>
<%- css('fancybox/jquery.fancybox') %>
<script>
var yiliaConfig = {
fancybox: <%=theme.fancybox%>,
mathjax: <%=theme.mathjax%>,
animate: <%=theme.animate%>,
isHome: <%=is_home()%>,
isPost: <%=is_post()%>,
isArchive: <%=is_archive()%>,
isTag: <%=is_tag()%>,
isCategory: <%=is_category()%>,
open_in_new: <%=theme.open_in_new%>
}
</script>
<% } %>
<% } else { %>
<script>
var yiliaConfig = {
fancybox: false,
mathjax: <%=theme.mathjax%>,
animate: <%=theme.animate%>,
isHome: <%=is_home()%>,
isPost: <%=is_post()%>,
isArchive: <%=is_archive()%>,
isTag: <%=is_tag()%>,
isCategory: <%=is_category()%>,
open_in_new: <%=theme.open_in_new%>
}
</script>
<% if (!index) { %>
<script>
<% if (post.fancybox === false){ %>
yiliaConfig.fancybox = false;
<% } %>
</script>
<% } %>
15 changes: 15 additions & 0 deletions layout/_partial/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,19 @@
<meta name="google-site-verification" content="<%- theme.google_site %>" />
<% } %>
<% } %>
<% if (theme.fancybox){ %>
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
<% } %>
<script>
var yiliaConfig = {
fancybox: <%=theme.fancybox%>,
animate: <%=theme.animate%>,
isHome: <%=is_home()%>,
isPost: <%=is_post()%>,
isArchive: <%=is_archive()%>,
isTag: <%=is_tag()%>,
isCategory: <%=is_category()%>,
open_in_new: <%=theme.open_in_new%>
}
</script>
</head>

0 comments on commit f0c061c

Please sign in to comment.