Skip to content

Commit

Permalink
add: variables for CDN
Browse files Browse the repository at this point in the history
  • Loading branch information
MOxFIVE committed Apr 15, 2016
1 parent 456ae19 commit 270bb3a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 190 deletions.
16 changes: 15 additions & 1 deletion _config.yml
Expand Up @@ -218,4 +218,18 @@ github_widget: false
progressBar:
on: true
type: "minimal" # Keep Quotes | 保留引号避免出错
color: blue
color: blue

CDN:
jquery: //cdn.bootcss.com/jquery/1.9.1/jquery.min.js
require: //cdn.bootcss.com/require.js/2.1.22/require.min.js
fontawesome: //cdn.bootcss.com/font-awesome/4.5.0/css/font-awesome.min.css
fancybox_js: //cdn.bootcss.com/fancybox/2.1.5/jquery.fancybox.min.js
fancybox_css: //cdn.bootcss.com/fancybox/2.1.5/jquery.fancybox.min.css
animate_css: //cdn.bootcss.com/animate.css/3.5.0/animate.min.css
jquery_ui_js: //cdn.bootcss.com/jqueryui/1.10.4/jquery-ui.min.js
jquery_ui_css: //cdn.bootcss.com/jqueryui/1.10.4/css/jquery-ui.min.css
pace_js: //cdn.bootcss.com/pace/1.0.2/pace.min.js
clipboard: //cdn.bootcss.com/clipboard.js/1.5.9/clipboard.min.js
mathjax: //cdn.bootcss.com/mathjax/2.6.1/MathJax.js
scrollreveal: //cdn.bootcss.com/scrollReveal.js/3.0.9/scrollreveal.min.js
4 changes: 2 additions & 2 deletions layout/_partial/after-footer.ejs
@@ -1,15 +1,15 @@
<% if (theme.github_widget){ %>
<%- js('js/GithubRepoWidget') %>
<% } %>
<script data-main="<%-config.root%>js/main.js" src="//cdn.bootcss.com/require.js/2.1.22/require.min.js"></script>
<script data-main="<%-config.root%>js/main.js" src="<%- theme.CDN.require %>"></script>
<%- partial('_partial/background') %>
<%- partial('google-analytics') %>
<% if (theme.mathjax){ %>
<%- partial('mathjax') %>
<% } %>
<%- partial('scrolling-button') %>
<% if (theme.jquery_ui){ %>
<script src="//cdn.bootcss.com/jqueryui/1.10.4/jquery-ui.min.js"></script>
<script src="<%- theme.CDN.jquery_ui_js %>"></script>
<% } %>
<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
</script>
16 changes: 9 additions & 7 deletions layout/_partial/head.ejs
Expand Up @@ -29,20 +29,20 @@
<link rel="icon" href="<%- theme.root_url %><%- theme.favicon %>">
<% } %>
<% if (theme.animate){ %>
<%- css('//cdn.bootcss.com/animate.css/3.5.0/animate.min.css') %>
<link href="<%- theme.CDN.animate_css %>" rel="stylesheet">
<% } %>
<% if (theme.jquery_ui){ %>
<link href="//cdn.bootcss.com/jqueryui/1.10.4/css/jquery-ui.min.css" rel="stylesheet">
<link href="<%- theme.CDN.jquery_ui_css %>" rel="stylesheet">
<% } %>
<% if (theme.progressBar.on) { %>
<script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
<script src="<%- theme.CDN.pace_js %>"></script>
<link href="//cdn.bootcss.com/pace/1.0.2/themes/<%= theme.progressBar.color || 'blue'%>/pace-theme-<%= theme.progressBar.type || 'minimal'%>.css" rel="stylesheet">
<% } %>
<%- css('css/style') %>
<% if (is_home() && theme.animate){ %>
<style> .article { opacity: 0;} </style>
<% } %>
<%- css('//cdn.bootcss.com/font-awesome/4.5.0/css/font-awesome.min.css') %>
<link href="<%- theme.CDN.fontawesome %>" rel="stylesheet">
<link rel="apple-touch-icon" href="<%- theme.root_url %>/apple-touch-icon.png">
<% if (is_home()){ %>
<% if (theme.baidu_site) { %>
Expand All @@ -53,10 +53,10 @@
<% } %>
<% } %>
<% if (theme.fancybox){ %>
<%- css('//cdn.bootcss.com/fancybox/2.1.5/jquery.fancybox.min.css') %>
<link href="<%- theme.CDN.fancybox_css %>" rel="stylesheet">
<% } %>
<%- js('//cdn.bootcss.com/jquery/1.9.1/jquery.min') %>
<script src="//cdn.bootcss.com/clipboard.js/1.5.9/clipboard.min.js"></script>
<script src="<%- theme.CDN.jquery %>"></script>
<script src="<%- theme.CDN.clipboard %>"></script>
<script>
var yiliaConfig = {
fancybox: <%=theme.fancybox%>,
Expand All @@ -67,6 +67,8 @@
isTag: <%=is_tag()%>,
isCategory: <%=is_category()%>,
open_in_new: <%=theme.open_in_new%>,
fancybox_js: "<%- theme.CDN.fancybox_js %>",
scrollreveal: "<%- theme.CDN.scrollreveal %>"
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/mathjax.ejs
Expand Up @@ -15,5 +15,5 @@ MathJax.Hub.Queue(function() {
});
</script>

<script src="//cdn.bootcss.com/mathjax/2.6.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
<script src="<%- theme.CDN.mathjax %>?config=TeX-AMS-MML_HTMLorMML">
</script>
7 changes: 0 additions & 7 deletions source/js/clipboard.min.js

This file was deleted.

167 changes: 0 additions & 167 deletions source/js/jquery.lazyload.js

This file was deleted.

7 changes: 2 additions & 5 deletions source/js/main.js
Expand Up @@ -55,7 +55,7 @@ require([], function (){

//是否使用fancybox
if(yiliaConfig.fancybox === true){
require(['//cdn.bootcss.com/fancybox/2.1.5/jquery.fancybox.min.js'], function(pc){
require([yiliaConfig.fancybox_js], function(pc){
var isFancy = $(".isFancy");
if(isFancy.length != 0){
var imgArr = $(".article-inner img");
Expand All @@ -80,10 +80,7 @@ require([], function (){
if(yiliaConfig.isHome === true) {
// 滚动条监听使用scrollreveal.js
// https://github.com/jlmakes/scrollreveal.js
// 使用cdn[//cdn.bootcss.com/scrollReveal.js/3.0.5/scrollreveal.js]
require([
'//cdn.bootcss.com/scrollReveal.js/3.0.5/scrollreveal.js'
], function (ScrollReveal) {
require([yiliaConfig.scrollreveal], function (ScrollReveal) {
// 更多animation:
// http://daneden.github.io/animate.css/
var animationNames = [
Expand Down

0 comments on commit 270bb3a

Please sign in to comment.