Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大白技术控
yanglr2010
提交
9c06aa42
Y
yanglr2010
项目概览
大白技术控
/
yanglr2010
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yanglr2010
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9c06aa42
编写于
8月 24, 2019
作者:
EvanOne(文一)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: Add quicklink support
上级
d09c08e6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
64 addition
and
0 deletion
+64
-0
_config.yml
_config.yml
+36
-0
layout/_third-party/quicklink.pug
layout/_third-party/quicklink.pug
+28
-0
未找到文件。
_config.yml
浏览文件 @
9c06aa42
...
...
@@ -558,6 +558,36 @@ lazyload:
# Available values: gif | block
placeholder
:
gif
# Quicklink support
# See: https://github.com/GoogleChromeLabs/quicklink/
quicklink
:
enable
:
false
# Quicklink (quicklink.umd.js script) is loaded on demand.
# Add `quicklink: true` in Front-matter of the page or post you need.
# Home page and archive page can be controlled through home and archive options below.
home
:
true
archive
:
true
# Initialize quicklink after the load event fires.
delay
:
true
# Custom a time in milliseconds by which the browser must execute prefetching.
timeout
:
10000
# Enable fetch() or falls back to XHR.
priority
:
true
# For more flexibility you can add some patterns (RegExp, Function, or Array) to ignores.
# See: https://github.com/GoogleChromeLabs/quicklink#custom-ignore-patterns
# ! ---------------------------------------------------------------
# ! Leave "ignores" as empty if you don't understand what it means.
# ! ---------------------------------------------------------------
# Example:
# ignores:
# - /\/api\/?/
# - uri => uri.includes('.zip')
# - (uri, el) => el.hasAttribute('nofollow')
ignores
:
# Google AdSense
google_adsense
:
enable
:
false
...
...
@@ -710,3 +740,9 @@ cdn:
# Example:
# lazyload: //cdn.jsdelivr.net/npm/lazyload@2.0.0-rc.2/lazyload.min.js
lazyload
:
# # Using version: latest
# See: https://github.com/GoogleChromeLabs/quicklink/
# Example:
# quicklink: //cdn.jsdelivr.net/npm/quicklink@latest/dist/quicklink.umd.js
quicklink
:
layout/_third-party/quicklink.pug
0 → 100644
浏览文件 @
9c06aa42
if theme.quicklink.enable
-
var quicklink_js = "https://cdn.jsdelivr.net/npm/quicklink@1.0.1/dist/quicklink.umd.js"
if (theme.cdn.quicklink) quicklink_js = theme.cdn.quicklink
var loadQuicklink = false
if is_home() && theme.quicklink.home
- loadQuicklink = true
if is_archive() && theme.quicklink.archive
- loadQuicklink = true
if loadQuicklink || ((page && page.quicklink) || (post && post.quicklink))
script(src=quicklink_js)
script.
function initQuicklink() {
quicklink({
timeout: '!{ theme.quicklink.timeout }',
priority: '!{ theme.quicklink.priority }',
ignores: [uri => uri.includes('#'), uri => uri === '!{ url.replace("index.html", '') }', !{ theme.quicklink.ignores }]
});
}
if (!{theme.quicklink.delay}) {
window.addEventListener('load', initQuicklink);
} else {
initQuicklink();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录