提交 083012f3 编写于 作者: EvanOne(文一)'s avatar EvanOne(文一)

refactor: Add rel='noopener' attr to external link & format code

上级 79b73bf6
......@@ -28,13 +28,11 @@ script.
shortcuts: {
switch_post: !{ theme.shortcuts.switch_post.enable }
},
back2top: {
enable: !{ theme.back2top.enable },
animation: !{ theme.back2top.icon.animation }
},
sidebar: {
offsetTop: '!{ theme.sidebar.offsetTop }'
},
back2top: !{ theme.back2top.enable },
back2top_animation: !{ theme.back2top.icon.animation },
reward: !{ theme.reward.enable }
};
......
......@@ -22,7 +22,7 @@ footer#footer
span= footer.copyright.text || config.author + "."
if footer.copyright.enable && footer.beian.enable
span.footer-separator |
span.footer-separator= "|"
if footer.beian.enable
span!= footer.beian.icp
......@@ -31,17 +31,19 @@ footer#footer
div
if footer.powered.enable
span.footer-powered
!= _p("footer.powered", link_to("http://hexo.io/", "hexo", {external: true}))
- let HEXO_URL = "http://hexo.io/";
!= _p("footer.powered", link_to(HEXO_URL, "hexo", { external: true }))
if footer.powered.version
span= " v" + hexo_env("version") + "."
if footer.powered.enable && footer.theme.enable
span.footer-separator |
span.footer-separator= "|"
if footer.theme.enable
span= _p("footer.theme") + " - "
!= link_to("https://github.com/liuyib/hexo-theme-stun/", "stun", {external: true})
- let STUN_URL = "https://github.com/liuyib/hexo-theme-stun/";
!= link_to(STUN_URL, "stun", { external: true })
if footer.theme.version
span= " v" + stun_env("version") + "."
......
......@@ -28,7 +28,7 @@ aside#sidebar
- let socialLinkPath = _.trim(_.get(socialItem, '[0]'))
- let socialLinkIcon = _.trim(_.get(socialItem, '[1]'))
span.sidebar-social-item
a(href=socialLinkPath target="_blank"
a(href=socialLinkPath target="_blank" rel="noopener"
data-popover=_p(`social.${name}`) data-popover-pos="up")
if socialLinkIcon && socialLinkIcon.match("origin:")
......@@ -45,7 +45,7 @@ aside#sidebar
- let feedEmail = theme.feed.email
if feedEmail
span.sidebar-feed-email
a(href=feedEmail target="_blank")
a(href=feedEmail target="_blank" rel="noopener")
i.fa.fa-envelope.sidebar-feed-icon
span Email
span= _p("sidebar.subscribe")
......@@ -53,7 +53,7 @@ aside#sidebar
- let feedRSS = theme.feed.rss
if feedRSS
span.sidebar-feed-rss
a(href=url_for(feedRSS) target="_blank")
a(href=url_for(feedRSS) target="_blank" rel="noopener")
i.fa.fa-rss.sidebar-feed-icon
span RSS
span= _p("sidebar.subscribe")
......@@ -85,7 +85,7 @@ aside#sidebar
- let ccLanguage = (themeCC.language && themeCC.language.toLowerCase()) || "en"
- let ccURL = `https://creativecommons.org/licenses/${ccLicense}/4.0/deed.${ccLanguage}`
div.sidebar-cc
a(href=ccURL target="_blank"
a(href=ccURL target="_blank" rel="noopener"
data-popover="Creative Commons" data-popover-pos="up")
img(src=url_for(`/${theme.images}/cc-${ccLicense}.svg`) alt="creative commons")
......
......@@ -9,7 +9,7 @@ div.busuanzi
span#busuanzi_value_site_uv
if theme.busuanzi.site.uv.enable && theme.busuanzi.site.pv.enable
span.separator |
span.separator= "|"
if theme.busuanzi.site.pv.enable
span.busuanzi-pv
......
div#back-top
div.back-top-inner(data-popover=_p("back2top")
data-popover-pos="up")
div(data-popover=_p("back2top") data-popover-pos="up").back-top-inner
i(class=`fa fa-${theme.back2top.icon.name}`)
div(data-popover=_p("post.sticky")
data-popover-pos="up").sticky-top
div(data-popover=_p("post.sticky") data-popover-pos="up").sticky-top
i(class=`fa fa-${theme.stick_top.icon}`)
......@@ -17,7 +17,7 @@ mixin postHeader(post)
if !theme.post_meta.icon_only
span= _p("post.posted") + " "
span= post.date ? full_date(post.date, "YYYY-MM-DD") : 'none'
span= full_date(post.date, "YYYY-MM-DD")
if theme.post_meta.updated.enable
span.post-meta-update
......@@ -25,7 +25,7 @@ mixin postHeader(post)
if !theme.post_meta.icon_only
span= _p("post.updated") + " "
span= post.updated ? full_date(post.updated, "YYYY-MM-DD") : 'none'
span= full_date(post.updated, "YYYY-MM-DD")
if theme.post_meta.word_count.enable
span.post-meta-word-count
......@@ -42,7 +42,8 @@ mixin postHeader(post)
if !theme.post_meta.icon_only
span= _p("post.reading_time") + " "
span= min2read(post.content, {cn: postReadingTime.speed.zh, en: postReadingTime.speed.en}) + " m"
- let READING_TIME_UNIT = "m";
span= min2read(post.content, {cn: postReadingTime.speed.zh, en: postReadingTime.speed.en}) + READING_TIME_UNIT
if theme.valine && theme.valine.enable && theme.valine.visitor
span(id=url_for(post.path) data-flag-title=post.title).leancloud_visitors
......
......@@ -14,7 +14,7 @@ mixin articleSort(posts)
time.article-sort-item__time= full_date(post.date, "MM-DD")
h2.article-sort-item__title
if post.link
a(href=url_for(post.link) target="_blank")= post.title || post.link
a(href=url_for(post.link) target="_blank" rel="noopener")= post.title || post.link
else
a(href=url_for(post.path))= post.title || _p('post.untitled')
......
......@@ -10,17 +10,14 @@ block content
- let start_color = theme.tag_cloud ? theme.tag_cloud.start_color : "#a4d8fa"
- let end_color = theme.tag_cloud ? theme.tag_cloud.end_color : "#1b9ef3"
div.tag-cloud-item!= tagcloud({min_font: min_font, max_font: max_font, amount: theme.tag_cloud.max_amount, color: true, start_color, end_color})
else if (page.title === "categories")
div.category.main-content
div.category-title= _p("page.categories") + " - "
span.category-num= site.categories.length
!= list_categories()
else if (page.title === "about")
div.about.main-content.code-highlight
!= page.content
else
div.about.main-content.code-highlight
!= page.content
$(document).ready(function () {
CONFIG.shortcuts.switch_post && Stun.utils.registerSwitchPost();
CONFIG.back2top.enable && Stun.utils.back2Top();
CONFIG.back2top && Stun.utils.back2Top();
CONFIG.reward && Stun.utils.registerShowReward();
});
......@@ -184,7 +184,7 @@ Stun.utils = Stun.$u = {
$('#back-top').click(function () {
$('body').velocity('stop').velocity('scroll');
if (CONFIG.back2top.animation) {
if (CONFIG.back2top_animation) {
$('#back-top')
.velocity({ translateY: '-100vh' }, { duration: 500 })
.velocity('reverse', { duration: 10 });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册