兼容性调整
This commit is contained in:
parent
e7c6945df4
commit
9fa331206c
@ -11,9 +11,6 @@
|
|||||||
<div class="article-entry" itemprop="articleBody">
|
<div class="article-entry" itemprop="articleBody">
|
||||||
<% if (post.excerpt && index){ %>
|
<% if (post.excerpt && index){ %>
|
||||||
<%- post.excerpt %>
|
<%- post.excerpt %>
|
||||||
<% if (theme.excerpt_link) { %>
|
|
||||||
<a class="article-more-a" href="<%- url_for(post.path) %>#more"><%= theme.excerpt_link %> >></a>
|
|
||||||
<% } %>
|
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<%- post.content %>
|
<%- post.content %>
|
||||||
<% } %>
|
<% } %>
|
||||||
@ -78,24 +75,7 @@
|
|||||||
<% } %>
|
<% } %>
|
||||||
<%- partial('_partial/aside') %>
|
<%- partial('_partial/aside') %>
|
||||||
|
|
||||||
|
|
||||||
<% if (!index && post.comments){ %>
|
<% if (!index && post.comments){ %>
|
||||||
<% if (theme.duoshuo){ %>
|
|
||||||
<%- partial('post/duoshuo', {
|
|
||||||
key: post.slug,
|
|
||||||
title: post.title,
|
|
||||||
url: config.url+url_for(post.path)
|
|
||||||
}) %>
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
<% if (theme.wangyiyun){ %>
|
|
||||||
<%- partial('post/wangyiyun', {
|
|
||||||
key: post.slug,
|
|
||||||
title: post.title,
|
|
||||||
url: config.url+url_for(post.path)
|
|
||||||
}) %>
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
<% if (theme.changyan_appid && theme.changyan_conf){ %>
|
<% if (theme.changyan_appid && theme.changyan_conf){ %>
|
||||||
<%- partial('post/changyan', {
|
<%- partial('post/changyan', {
|
||||||
key: post.slug,
|
key: post.slug,
|
||||||
|
|||||||
@ -15,12 +15,8 @@
|
|||||||
<% if (theme.subtitle){ %>
|
<% if (theme.subtitle){ %>
|
||||||
<p class="header-subtitle"><i class="icon icon-quo-left"></i><%=theme.subtitle%><i class="icon icon-quo-right"></i></p>
|
<p class="header-subtitle"><i class="icon icon-quo-left"></i><%=theme.subtitle%><i class="icon icon-quo-right"></i></p>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% var count = 0%>
|
<% var count = Object.keys(theme.menu).length
|
||||||
<% for (var i in theme.menu){ %>
|
var ulWidth = count > 2 ? '70%' : '50%' %>
|
||||||
<% count++ %>
|
|
||||||
<% } %>
|
|
||||||
<% var ulWidth = count > 2 ? '70%' : '50%' %>
|
|
||||||
|
|
||||||
<nav class="header-nav">
|
<nav class="header-nav">
|
||||||
<div class="social">
|
<div class="social">
|
||||||
<% for (var i in theme.subnav){ %>
|
<% for (var i in theme.subnav){ %>
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
<div id="cloud-tie-wrapper" class="cloud-tie-wrapper"></div>
|
|
||||||
<script>
|
|
||||||
var cloudTieConfig = {
|
|
||||||
url: "<%=url%>",
|
|
||||||
sourceId: "<%=key%>",
|
|
||||||
productKey: "<%=theme.wangyiyun%>",
|
|
||||||
target: "cloud-tie-wrapper"
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<script src="//img1.cache.netease.com/f2e/tie/yun/sdk/loader.js"></script>
|
|
||||||
@ -1 +1 @@
|
|||||||
<%- js('js/mobile.04379a910e1ff32f2a41.js') %> <%- js('js/slider.a725c75e59c2eeae98e0.js') %> <%- js('js/main.254cebd259c4777bdd2e.js') %>
|
<%- js('js/mobile.ea63a7925e7ff5c87e64.js') %> <%- js('js/slider.6142a9af4c6883a7d429.js') %> <%- js('js/main.361198a3fa95601c34df.js') %>
|
||||||
@ -121,7 +121,7 @@
|
|||||||
<%if(hasAboutme){%>
|
<%if(hasAboutme){%>
|
||||||
<section class="tools-section tools-section-me" v-show="aboutme">
|
<section class="tools-section tools-section-me" v-show="aboutme">
|
||||||
<%if(theme.aboutme){%>
|
<%if(theme.aboutme){%>
|
||||||
<div class="aboutme-wrap" id="js-aboutme"><%=theme.aboutme%></div>
|
<div class="aboutme-wrap" id="js-aboutme"><%-theme.aboutme%></div>
|
||||||
<%}%>
|
<%}%>
|
||||||
</section>
|
</section>
|
||||||
<%}%>
|
<%}%>
|
||||||
|
|||||||
@ -89,7 +89,4 @@ function init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default { init }
|
||||||
module.exports = {
|
|
||||||
init: init
|
|
||||||
}
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
var browser = {
|
export default {
|
||||||
versions: function() {
|
versions: function() {
|
||||||
var u = window.navigator.userAgent;
|
var u = window.navigator.userAgent;
|
||||||
return {
|
return {
|
||||||
@ -16,5 +16,3 @@ var browser = {
|
|||||||
};
|
};
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = browser
|
|
||||||
@ -21,19 +21,10 @@ function init() {
|
|||||||
// 目录序号
|
// 目录序号
|
||||||
if (yiliaConfig && yiliaConfig.toc_hide_index) {
|
if (yiliaConfig && yiliaConfig.toc_hide_index) {
|
||||||
let $a = document.querySelectorAll(('.toc-number'))
|
let $a = document.querySelectorAll(('.toc-number'))
|
||||||
$a.forEach(($em) => {
|
Array.prototype.forEach.call($a, function($em){
|
||||||
$em.style.display = 'none';
|
$em.style.display = 'none';
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// about me 转义
|
|
||||||
var $aboutme = document.querySelector('#js-aboutme')
|
|
||||||
if ($aboutme && $aboutme.length !== 0) {
|
|
||||||
$aboutme.innerHTML = $aboutme.innerText
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
export default { init }
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
init: init
|
|
||||||
}
|
|
||||||
@ -1,7 +1,5 @@
|
|||||||
// 样式
|
// 样式
|
||||||
import '../css/main.scss'
|
import '../css/main.scss'
|
||||||
// 上报
|
|
||||||
// import './report'
|
|
||||||
// 图片查看器
|
// 图片查看器
|
||||||
import Viewer from './viewer'
|
import Viewer from './viewer'
|
||||||
// 分享
|
// 分享
|
||||||
@ -9,9 +7,9 @@ import Share from './share'
|
|||||||
// 边缘
|
// 边缘
|
||||||
import Aside from './aside'
|
import Aside from './aside'
|
||||||
|
|
||||||
import {addLoadEvent} from './util'
|
import Util from './util'
|
||||||
|
|
||||||
addLoadEvent(function() {
|
Util.addLoadEvent(function() {
|
||||||
Share.init()
|
Share.init()
|
||||||
Viewer.init()
|
Viewer.init()
|
||||||
Aside.init()
|
Aside.init()
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import Browser from './browser'
|
|||||||
// fix hexo 不支持的配置
|
// fix hexo 不支持的配置
|
||||||
import Fix from './fix'
|
import Fix from './fix'
|
||||||
|
|
||||||
import {addLoadEvent} from './util'
|
import Util from './util'
|
||||||
|
|
||||||
function isPathMatch(path, href) {
|
function isPathMatch(path, href) {
|
||||||
let reg = /\/|index.html/g
|
let reg = /\/|index.html/g
|
||||||
@ -16,13 +16,11 @@ function isPathMatch(path, href) {
|
|||||||
function tabActive() {
|
function tabActive() {
|
||||||
let $tabs = document.querySelectorAll('.js-header-menu li a')
|
let $tabs = document.querySelectorAll('.js-header-menu li a')
|
||||||
let path = window.location.pathname
|
let path = window.location.pathname
|
||||||
|
Array.prototype.forEach.call($tabs, function($tab, i){
|
||||||
for (var i = 0, len = $tabs.length; i < len; i++) {
|
|
||||||
let $tab = $tabs[i]
|
|
||||||
if (isPathMatch(path, $tab.getAttribute('href'))) {
|
if (isPathMatch(path, $tab.getAttribute('href'))) {
|
||||||
addClass($tab, 'active')
|
addClass($tab, 'active')
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getElementLeft(element) {
|
function getElementLeft(element) {
|
||||||
@ -99,6 +97,6 @@ function init() {
|
|||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
addLoadEvent(function() {
|
Util.addLoadEvent(function() {
|
||||||
Fix.init()
|
Fix.init()
|
||||||
})
|
})
|
||||||
@ -57,8 +57,7 @@ let init = function() {
|
|||||||
if ((sPic !== '') && !/^(http:|https:)?\/\//.test(sPic)) {
|
if ((sPic !== '') && !/^(http:|https:)?\/\//.test(sPic)) {
|
||||||
sPic = window.location.origin + sPic
|
sPic = window.location.origin + sPic
|
||||||
}
|
}
|
||||||
|
Array.prototype.forEach.call($sns, ($em) => {
|
||||||
$sns.forEach(($em) => {
|
|
||||||
$em.onclick = (e) => {
|
$em.onclick = (e) => {
|
||||||
let type = $em.getAttribute('data-type')
|
let type = $em.getAttribute('data-type')
|
||||||
handleClick(type, {
|
handleClick(type, {
|
||||||
@ -69,11 +68,8 @@ let init = function() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
document.querySelector('.mask').onclick = hideWX
|
document.querySelector('.mask').onclick = hideWX
|
||||||
document.querySelector('.js-modal-close').onclick = hideWX
|
document.querySelector('.js-modal-close').onclick = hideWX
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
export default { init }
|
||||||
init: init
|
|
||||||
}
|
|
||||||
@ -15,7 +15,7 @@ function fixzero(str) {
|
|||||||
|
|
||||||
function setScrollZero() {
|
function setScrollZero() {
|
||||||
let $sct = document.querySelectorAll('.tools-section')
|
let $sct = document.querySelectorAll('.tools-section')
|
||||||
$sct.forEach((em) => {
|
Array.prototype.forEach.call($sct, (em) => {
|
||||||
em.scrollTop = 0
|
em.scrollTop = 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
var e = function() {
|
const Util = (function(){
|
||||||
function r(e, r, n) {
|
function r(e, r, n) {
|
||||||
return r || n ? String.fromCharCode(r || n) : u[e] || e
|
return r || n ? String.fromCharCode(r || n) : u[e] || e
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ var e = function() {
|
|||||||
},
|
},
|
||||||
addLoadEvent: function(func){
|
addLoadEvent: function(func){
|
||||||
var oldonload = window.onload;
|
var oldonload = window.onload;
|
||||||
if (typeof window.onload!="function") {
|
if (typeof window.onload !== "function") {
|
||||||
window.onload = func;
|
window.onload = func;
|
||||||
} else {
|
} else {
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
@ -84,6 +84,6 @@ var e = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}();
|
})();
|
||||||
|
|
||||||
module.exports = e
|
export default Util
|
||||||
@ -10,14 +10,12 @@ window.PhotoSwipeUI_Default = PhotoSwipeUI_Default
|
|||||||
function init() {
|
function init() {
|
||||||
let pswpElement = document.querySelectorAll('.pswp')[0];
|
let pswpElement = document.querySelectorAll('.pswp')[0];
|
||||||
let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))
|
let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))
|
||||||
|
Array.prototype.forEach.call($imgArr, ($em, i) => {
|
||||||
$imgArr.forEach(($em, i) => {
|
|
||||||
$em.onclick = () => {
|
$em.onclick = () => {
|
||||||
// slider展开状态
|
// slider展开状态
|
||||||
// todo: 这样不好,后面改成状态
|
|
||||||
if (document.querySelector('.left-col.show')) return
|
if (document.querySelector('.left-col.show')) return
|
||||||
let items = []
|
let items = []
|
||||||
$imgArr.forEach(($em2, i2) => {
|
Array.prototype.forEach.call($imgArr, ($em2, i2) => {
|
||||||
let img = $em2.getAttribute('data-idx', i2)
|
let img = $em2.getAttribute('data-idx', i2)
|
||||||
let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
|
let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
|
||||||
let title = $em2.getAttribute('alt')
|
let title = $em2.getAttribute('alt')
|
||||||
@ -40,6 +38,4 @@ function init() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
export default { init }
|
||||||
init: init
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user