-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
106 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// 查找字符 tChar 在 str 中第 num 次出现的位置 | ||
|
||
function findChar(str, tChar, num) { | ||
var charPos = str.indexOf(tChar); | ||
num = num - 1; | ||
if (num > 0) { | ||
for (var i = 0; i < num; i++) { | ||
charPos = str.indexOf(tChar, charPos + 1); | ||
} | ||
} | ||
return charPos; | ||
} | ||
|
||
// 返回顶部 | ||
|
||
function toTop() { | ||
document.body.scrollTop = 0; | ||
document.documentElement.scrollTop = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Slinky 插件的设置 // | ||
var SlinkyOption = { | ||
title: true, | ||
speed: 400 | ||
}; | ||
|
||
var ListIDPrefix = '#list_'; // 列表 ID 前缀(自定义) | ||
var ListCount = 0; | ||
var ListCountMax = 17; // 列表总数(自定义) | ||
var FullsSreenText = document.querySelector('.fullscreen-text'); | ||
|
||
// 链接 // | ||
var Links = {}; | ||
|
||
// 设置 target = '_blank' // | ||
function setTarget() { | ||
for (var i = 0; i < LinkList.length; i++) { | ||
if (LinkList[i].href.endsWith('#') == false) { | ||
LinkList[i].target = '_blank'; | ||
/* 自动加图标(暂不使用;可使用 LazyLoad) | ||
var slashPos = findChar(LinkList[i].href, '/', 3); | ||
getFavicon = 'https://www.google.cn/s2/favicons?domain=' + LinkList[i].href.substring(0, slashPos); | ||
var imgTag = '<img src="' + getFavicon + '" />'; | ||
LinkList[i].insertAdjacentHTML('beforeBegin', imgTag); | ||
*/ | ||
} | ||
} | ||
} | ||
|
||
// 显示列表 // | ||
function displayList() { | ||
document.querySelector('main').style.opacity = '1'; | ||
FullsSreenText.style.opacity = '0'; | ||
setTimeout(function () { | ||
document.querySelector('.fullscreen-text').style.display = 'none'; | ||
}, 1000); | ||
} | ||
|
||
// 加载列表 // | ||
function loadList() { | ||
ListCount = ListCount + 1; | ||
$(ListIDPrefix + ListCount).slinky(SlinkyOption); | ||
FullsSreenText.innerHTML = '已加载 ' + ListCount + ' 个分类'; | ||
// 加载完毕 // | ||
if (ListCount == ListCountMax) { | ||
clearInterval(iLoadList); | ||
FullsSreenText.innerHTML = '加载完毕'; | ||
setTarget(); | ||
displayList(); | ||
} | ||
} | ||
var iLoadList = setInterval('loadList()', 100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.