Skip to content

Commit

Permalink
分页js使用局部变量,防止污染全局变量(#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
HCLonely committed Jan 3, 2022
2 parents 48e5dc0 + 619ab56 commit d5bff19
Show file tree
Hide file tree
Showing 5 changed files with 1,061 additions and 1,095 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ bangumi: # 追番设置
title: '追番列表'
quote: '生命不息,追番不止!'
show: 1
lazyload: true
loading:
metaColor:
color:
Expand All @@ -39,9 +40,10 @@ cinema: # 追剧设置
enable: true
path:
vmid:
title: '追番列表'
quote: '生命不息,追番不止'
title: '追剧列表'
quote: '生命不息,追剧不止'
show: 1
lazyload: true
loading:
metaColor:
color:
Expand All @@ -57,7 +59,8 @@ cinema: # 追剧设置
- **title**: 该页面的标题
- **quote**: 写在页面开头的一段话,支持 html 语法,可留空。
- **show**: 初始显示页面:`0: 想看`, `1: 在看`, `2: 看过`,默认为`1`
- **loading**: 图片加载完成前的 loading 图片
- **lazyload**: 是否启用图片懒加载,如果与主题的懒加载冲突请关闭,默认`true`
- **loading**: 图片加载完成前的 loading 图片,需启用图片懒加载
- **metaColor**: meta 部分(简介上方)字体颜色
- **color**: 简介字体颜色
- **webp**: 番剧封面使用`webp`格式(此格式在`safari`浏览器下不显示,但是图片大小可以缩小 100 倍左右), 默认`true`
Expand Down
3 changes: 2 additions & 1 deletion lib/bangumi-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var log = require('hexo-log')({

module.exports = /*#__PURE__*/function () {
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(locals) {
var _config$type, _config$type2;
var _config$type, _config$type$lazyload, _config$type2;

var type,
config,
Expand Down Expand Up @@ -114,6 +114,7 @@ module.exports = /*#__PURE__*/function () {
loading: config[type].loading,
metaColor: config[type].metaColor ? "style=\"color:".concat(config[type].metaColor, "\"") : '',
color: config[type].color ? "style=\"color:".concat(config[type].color, "\"") : '',
lazyload: (_config$type$lazyload = config[type].lazyload) !== null && _config$type$lazyload !== void 0 ? _config$type$lazyload : true,
wantWatch: wantWatch,
watched: watched,
watching: watching,
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/template.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="bangumi-item">
<div class="bangumi-picture"><img src="<%= loading || "https://cdn.jsdelivr.net/npm/[email protected]/lib/img/loading.gif" %>" data-src="<%= item.cover %>" referrerPolicy="no-referrer" width="110" style="width:110px;margin:10px auto;" />
<div class="bangumi-picture"><img src="<%= lazyload ? (loading || "https://cdn.jsdelivr.net/npm/[email protected]/lib/img/loading.gif") : item.cover %>" <%- lazyload ? ` data-src="${item.cover}"` : '' %> referrerPolicy="no-referrer" width="110" style="width:110px;margin:10px auto;" />
</div>
<div class="bangumi-info">
<div class="bangumi-title">
Expand Down
Loading

0 comments on commit d5bff19

Please sign in to comment.