// ==UserScript==
// @name hitomi.la_zh-TW
// @namespace hitomi.la TW
// @description 這是在 hitomi.la 網站上運作的腳本,主要是將網頁中的類型、語言、分類標籤和系列英語部分換成中文,以便於了解作品的資訊。
// @version 12.5
// @include *://hitomi.la/*
// @compatible chrome
// @icon https://ltn.hitomi.la/apple-touch-icon-57x57.png
// ==/UserScript==
const TranslatioDataURL = "https://api.myjson.com/bins/1764q8";
let topbar = {},
booktypes = {},
lang = {},
bookseries = {},
booktags = {},
// 修改 Daily 的值能夠改變更新翻譯數據的頻率
// 預設值 7
Daily = 7,
nowTime = (new Date).getTime(),
TimeD = 0,
url = location.pathname;
// 變數 url 設成當前網址路徑部分
let regex, h3, engTxt, chtTxt;
let toplangtext, Title_h3, weburl, langtext, typetext, seriestext, tagtext, topbartext;
const tEng = {
// 將標題轉成網址格式
h3ToURL: (str) => {
str = str.toLocaleLowerCase();
str = (str == "recently added") ? "index" : encodeURIComponent(str).replace(/\./g, "%2E").replace(/\-/g, "%2D").replace(/\s+/g, "%20");
return str;
},
// 簡單判斷翻譯工作區
tocht: (chgThis, txt, cht) => {
if (chgThis.html().match(txt)) {
chgThis.attr("title", txt).text(cht);
}
},
// 用於 頂部分類類型
topbar: (topbar_obj) => {
topbartext = topbar_obj.text();
if (topbar[topbartext]) topbar_obj.attr("title", topbartext).text(topbar[topbartext]);
},
//用於 頂部語言
//
//var lang = {
// lang_eng: {
// "cht": lang_cht,
// "url": lang_url
// },
//}
//
topbarLang: (lang_obj) => {
toplangtext = lang_obj.text();
Title_h3 = $("h3").text();
weburl = url.match("\/galleries\/");
if (lang_obj.html().match(lang[toplangtext].url) || lang_obj.html().match(toplangtext)) {
if (lang_obj.attr("href").match(tEng.h3ToURL(Title_h3) + "-" + lang[toplangtext].url + "-1.html") || weburl) {
lang_obj.attr("title", toplangtext + " \( " + lang[toplangtext].url + " \)").text(lang[toplangtext].cht);
}
}
},
//用於 語言
lang: (lang_obj) => {
langtext = lang_obj.text();
if (lang[langtext]) lang_obj.attr("title", langtext + " \(" + lang[langtext].url + "\)").text(lang[langtext].cht);
},
//用於 類型
types: (types_obj) => {
typetext = types_obj.text().replace(/(^\s+)|(\s+$)/g, "");
if (booktypes[typetext]) types_obj.attr("title", typetext).text(booktypes[typetext]);
},
//用於 系列
series: (series_obj) => {
seriestext = series_obj.text();
if (bookseries[seriestext]) series_obj.attr("title", seriestext).text(bookseries[seriestext]);
},
//用於 標籤
tags: (tags_obj) => {
tagtext = tags_obj.text();
if (booktags[tagtext]) tags_obj.attr("title", tagtext).text(booktags[tagtext]);
}
};
// 簡易檢查是否有綁定事件
const CheckOnEvent = (oID, oEvent) => {
oEvent = oEvent || "click";
const chk = document.querySelector(oID);
const he = (chk) ? $._data(chk, 'events') : undefined;
const heE = (he) ? he[oEvent] : undefined;
return (typeof heE !== 'undefined') ? true : false;
}
(function () {
"use strict";
localStorage.setItem("hitomi.la_zh-TW", "loading");
// 只要有任何一個不存在就重新下載 json 檔
if (!localStorage.hasOwnProperty("LastUpdata") || !localStorage.hasOwnProperty("topbar") || !localStorage.hasOwnProperty("booktypes") || !localStorage.hasOwnProperty("lang") || !localStorage.hasOwnProperty("bookseries") || !localStorage.hasOwnProperty("booktags")) {
// 缺少
gtd(true);
} else {
// 完整
TimeD = (nowTime - localStorage.getItem("LastUpdata")) / 1000;
Daily = Daily * 24 * 3600;
if (TimeD > Daily) {
// 完整 但 到更新時間
gtd(true);
} else {
topbar = JSON.parse(localStorage.getItem("topbar"));
booktypes = JSON.parse(localStorage.getItem("booktypes"));
lang = JSON.parse(localStorage.getItem("lang"));
bookseries = JSON.parse(localStorage.getItem("bookseries"));
booktags = JSON.parse(localStorage.getItem("booktags"));
_TopBottom();
}
}
function gtd(autoUpdata) {
localStorage.setItem("LastUpdata", nowTime);
$.getJSON(TranslatioDataURL)
.done((data) => {
localStorage.setItem("topbar", JSON.stringify(data.topbar));
localStorage.setItem("booktypes", JSON.stringify(data.booktypes));
localStorage.setItem("lang", JSON.stringify(data.lang));
localStorage.setItem("bookseries", JSON.stringify(data.bookseries));
localStorage.setItem("booktags", JSON.stringify(data.booktags));
topbar = JSON.parse(localStorage.getItem("topbar"));
booktypes = JSON.parse(localStorage.getItem("booktypes"));
lang = JSON.parse(localStorage.getItem("lang"));
bookseries = JSON.parse(localStorage.getItem("bookseries"));
booktags = JSON.parse(localStorage.getItem("booktags"));
localStorage.setItem("nowSeriesNum", Object.keys(bookseries).length);
localStorage.setItem("nowTagsNum", Object.keys(booktags).length);
if (autoUpdata) {
console.log("資料更新成功");
_TopBottom();
} else {
console.log("手動資料更新成功");
$(".navbar nav").append("<div id=\"Notice\"><span>翻譯資料更新成功</span></div><style>#Notice{background-color:rgba(204, 255, 255, 0.9);border-radius:10px;border-top-right-radius:0;border-top-left-radius:0;position:fixed;top:-50px;left:50%;transform:translate(-50%,0);animation:Notice 1s linear}#Notice span{color:#666;display:block;font-weight:bold;margin:10px 63px}@keyframes Notice {0%{top:-50px}35%{top:0}85%{top:0}100%{top:-50px}}</style>");
}
})
.fail(() => {
console.log("資料取得失敗");
$(".navbar nav").append("<div id=\"Notice\"><span>資料取得失敗</span></div><style>#Notice{background-color:rgba(255, 204, 204, 0.9);border-radius:10px;border-top-right-radius:0;border-top-left-radius:0;position:fixed;top:-50px;left:50%;transform:translate(-50%,0);animation:Notice 2s linear}#Notice span{color:#666;display:block;font-weight:bold;margin:10px 63px}@keyframes Notice {0%{top:-50px}35%{top:0}85%{top:0}100%{top:-50px}}</style>");
});
}
// 變數 LoadingStatus 0 為正在載入
// 1 為載入完成
// let LoadingStatus = 0;
// 是否在"全部系列"
let inallsatc = false;
// WaitLoad() 等待載入
function WaitLoad() {
if ($("#loader-content").length == 1) {
if ($("#loader-content").attr("style") == "display: none;" && $(".gallery-content").children().length > 0) {
window.setTimeout(RunTranslation, 100);
} else {
Timeout();
}
} else {
window.setTimeout(RunTranslation, 150);
}
}
// Timeout()
// 正規表達式 /all(tags|artists|series|characters)|reader/ (在字串中搜索"all"、"reader"字串)
// 若 hitomi.la 為"全部"和"閱讀"頁面則一百五十毫秒後呼叫 RunTranslation()
// 若是則二百毫秒後呼叫 WaitLoad()
function Timeout() {
// 變數 regex 用來儲存正規表示式
regex = /all(tags|artists|series|characters)|reader/;
if (url.match(regex)) {
window.setTimeout(RunTranslation, 100);
} else {
window.setTimeout(WaitLoad, 200);
}
}
// RunTranslation()
// 依序呼叫 _ModifyCSS() _ADremove() _HotKey()
let YouPosition;
function RunTranslation() {
$(".navbar").append("<a id=\"TIMER\" style=\"color: rgb(255, 255, 255);font-weight: bold;\"></a>");
YouPosition = url.split("\/")[1].split(/\-|\./);
switch (YouPosition[0]) {
case "galleries": {
console.log("=========畫廊資訊區=========");
setTimeout(() => {
_TranslationH3();
$(".tags:last-of-type")[1].parentNode.classList.add("relatedtags");
_TranslatioGalleries();
_TranslatioGalleriesInfo();
}, 50);
break;
}
case "reader": {
console.log("=========畫廊閱讀區=========");
setTimeout(() => {
_TranslationReader();
}, 10);
break;
}
case "alltags": {
console.log("=========全部-標籤=========");
_TranslationAll();
break;
}
case "allartists": {
console.log("=========全部-畫家=========");
_TranslationAll();
break;
}
case "allseries": {
console.log("=========全部-系列=========");
_TranslationAll();
_TranslationAllSeries();
break;
}
case "allcharacters": {
console.log("=========全部-角色=========");
_TranslationAll();
break;
}
case "search": {
console.log("=========搜索區=========");
setTimeout(() => {
_TranslationSearchH3();
_TranslatioGalleries();
_TranslationSearch();
_HotKey();
}, 10);
break;
}
default: {
console.log("=========♥♥♥♥♥=========");
setTimeout(() => {
_TranslationH3();
_TranslationOrderBy();
_TranslatioGalleries();
}, 10);
}
}
if (url.search("reader") < 0) _ModifyCSS();
_ADremove();
if (url.search("search") < 0) _HotKey();
localStorage.setItem("hitomi.la_zh-TW", "success");
}
function _TopBottom() {
_TranslationTopInfo();
if (url.search("reader") < 0) {
$(".container").append("<style>div#lang-drop{width:135px;padding-top:13px;}ul#lang-list a{display:block}</style>");
$(".navbar>nav>ul").append("<li id=\"cht_help\"><a title=\"hitomi.la_zh-TW\">腳本問題 <img src=\"//ltn.hitomi.la/down-arrow.png\"></a><div id=\"cht_help_drop\"><ul id=\"cht_help_list\"><li><span>系列翻譯數:" + localStorage.getItem("nowSeriesNum") + "</span></li><li><span>標籤翻譯數:" + localStorage.getItem("nowTagsNum") + "</span></li><li><a id=\"update\">手動更新數據</a></li><li><a href=\"https://goo.gl/iurbA6\" target=\"_blank\">中文化問題</a></li><li><hr></li><li><a href=\"https://greasyfork.org/zh-TW/scripts/23864-hitomi-la-zh-tw\" target=\"_blank\"><img src=\"https://greasyfork.org/assets/blacklogo16-bc64b9f7afdc9be4cbfa58bdd5fc2e5c098ad4bca3ad513a27b15602083fd5bc.png\" alt=\"greasyfork icon\" >Greasy Fork</a></li><li><a href=\"https://zxc129567142.neocities.org/hitomi_la_zh_tw/index.html\" target=\"_blank\"><svg xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" width=\"20\" height=\"20\" viewBox=\"0 0 50 50\" style=\"fill:#aaa;vertical-align:bottom;\"><g><path d=\"M 7 2 L 7 48 L 43 48 L 43 14.59375 L 42.71875 14.28125 L 30.71875 2.28125 L 30.40625 2 Z M 9 4 L 29 4 L 29 16 L 41 16 L 41 46 L 9 46 Z M 31 5.4375 L 39.5625 14 L 31 14 Z \"></path></g></svg>Neocities</a></li></ul></div></li>");
$(".navbar>nav").append("<style>#cht_help_drop{display:none;position:absolute;margin:0px;padding:0px 15px;padding-top:13px;z-index:99999;background-color:#29313d;left:0px;right:0px;max-height:500px;width:155px;}#cht_help:hover #cht_help_drop{display:block;}#cht_help_list li{color:#aaa;display:block;position:relative;margin-bottom:10px;}#cht_help_list a,#cht_help_list span{color:inherit;display:block;padding:0px;text-decoration:none;text-transform:none;font-weight:normal;}#cht_help_list a{cursor:pointer;}#cht_help_list a:hover{color:#fff;font-weight:bold;}#cht_help_list span{cursor:default;}#cht_help_list img{vertical-align:middle;margin-right:5px;width:20px;}#cht_help_list svg{margin-right:5px;}</style>");
}
_TranslationBottomDonate();
$("#update").one('click', () => {
gtd(false);
});
Timeout();
}
//翻譯上方的導覽列
function _TranslationTopInfo() {
//頂部分類類型
$(".navbar a").each((i, v) => {
tEng.topbar($(v));
});
//頂部語言
if ($("li#lang>a").text().match("language")) $("li#lang>a").html("語言 <img src='//ltn.hitomi.la/down-arrow.png'>");
$("#lang-list a").each((i, v) => {
tEng.topbarLang($(v));
});
//頂部搜尋
if ($(".header-table").length > 0) {
$("button#search-button").text("搜尋");
$(".search-input#search").attr("title", `你可以使用組合條件 "female:yuri -female:futanari",此範例會尋找含有 "yuri" 但不含 "futanari" 。當要輸入帶有空白的標籤使用 "_" 字符。`);
}
}
//翻譯畫廊相關
function _TranslatioGalleries() {
//分類
$("tr td:nth-of-type(1)").each((i, v) => {
const _this = $(v);
switch (_this.text()) {
case "Series": {
_this.attr("title", "Series").text("系列");
_this.parent().find("ul").attr("class", "comma-list");
break;
}
case "Type": {
_this.attr("title", "Type").text("類型");
break;
}
case "Language": {
_this.attr("title", "Language").text("語言");
break;
}
case "Tags": {
_this.attr("title", "Tags").text("標籤");
break;
}
case "Group": {
_this.attr("title", "Group").text("群組");
break;
}
case "Characters": {
_this.attr("title", "Characters").text("角色");
break;
}
default: {
console.log("例外 分類");
}
}
});
//語言
$("tr:nth-of-type(3) td:nth-of-type(2) a").each((i, v) => {
tEng.lang($(v));
});
//類型
$("tr:nth-child(2) td:nth-child(2) a").each((i, v) => {
tEng.types($(v));
});
//系列
if ($("table .comma-list a").length > 0) {
$("table .comma-list a").each((i, v) => {
tEng.series($(v));
});
}
//標籤
if ($(".relatedtags a").length > 0) {
$(".relatedtags a").each((i, v) => {
tEng.tags($(v));
});
}
//日期改為中文
if ($("[class*=-date].date,span.date").length > 0) {
$("[class*=-date].date,span.date").each(function (i, v) {
const dj_date = v.innerText;
const nD = new Date(dj_date);
if (!isNaN(new Date(nD)) || new Date(nD) == "Invalid Date") {
v.innerText = `${nD.getFullYear()}年${(nD.getMonth() + 1)}月${nD.getDate()}日 ${nD.getHours()}點${nD.getMinutes()}分`;
}
});
}
//當群組、系列、語言為"N/A"
$("tr:not(:last-of-type) td:nth-of-type(2)").each((i, v) => {
tEng.tocht($(v), "N/A", "無");
});
//當作者名為"N/A"
$("div.artist-list").each((i, v) => {
tEng.tocht($(v), "N/A", "無");
});
}
//翻譯畫廊資訊頁面
function _TranslatioGalleriesInfo() {
//資訊頁面作者名為"N/A"
$("h2").each((i, v) => {
tEng.tocht($(v), "N/A", "無");
});
//資訊頁面
$(".cover-column h1").each((i, v) => {
if ($(v).text() == "Download") $(v).text("下載");
if ($(v).text() == "Read Online") $(v).text("線上閱讀");
});
}
//翻譯h3標題
function _TranslationH3() {
//區塊h3標題
h3 = $("div.list-title h3");
switch (h3.text()) {
case "Recently Added": {
tEng.tocht(h3, "Recently Added", "最近更新");
break;
}
case "Popular": {
tEng.tocht(h3, "Popular", "熱門度");
break;
}
case "Related Galleries": {
tEng.tocht(h3, "Related Galleries", "相關畫廊");
break;
}
default: {
console.log(h3.text());
}
}
}
//翻譯搜尋頁h3標題
function _TranslationSearchH3() {
//區塊h3標題
h3 = $("div.list-title h3");
engTxt = h3.text();
chtTxt = engTxt.replace("Results", "個結果");
h3.attr("title", engTxt).text(chtTxt);
}
//翻譯搜尋頁
function _TranslationSearch() {
if ($(".page-top a").length > 0) {
$(".page-top a").one("click", () => {
window.setTimeout(function _Search() {
if ($("#loader-content").length == 1) {
if ($("#loader-content").attr("style") == "display: none;" && $(".gallery-content").children().length > 0) {
_TranslatioGalleries();
_ModifyCSS();
_HotKey();
_TranslationSearch();
} else {
window.setTimeout(_Search, 150);
}
}
}, 50);
});
} else {
if ($(".gallery-content .search-message").text() == "No results") $(".gallery-content .search-message").text("無結果");
}
}
//翻譯"全部"頁面
function _TranslationAll() {
//"全部"頁面大標題
let satc = [
["tags", "artists", "series", "characters"],
["標籤", "畫家", "系列", "角色"]
],
atoz = ["123", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"],
allh3 = $("div.list-title h3");
inallsatc = true;
for (let S = 0; S < satc[0].length; S++) {
if (allh3.text().match(satc[0][S]) == satc[0][S]) {
for (let A = 0; A < atoz.length; A++) {
if (allh3.text().substr(-1) == atoz[A].substr(-1) && allh3.text().substr(0, 3) === "All") {
allh3.text("全部字首 " + atoz[A] + " 的" + satc[1][S]);
}
}
}
}
}
//翻譯"全部"系列
function _TranslationAllSeries() {
//"全部"系列
if ($("ul.posts a").length > 0 && url.search("allseries") > 0) {
$("ul.posts a").each((i, v) => {
tEng.series($(v));
});
}
}
//翻譯閱讀頁面
function _TranslationReader() {
$(".brand").each((i, v) => {
tEng.tocht($(v), "Gallery Info", "畫廊資訊");
});
$(".input-medium option").each((i, v) => {
tEng.tocht($(v), $(v).html(), "第 " + $(v).val() + " 頁");
});
$(".navbar-nav a").each((i, v) => {
if ($(v).text().match("Next")) $(v).html("<i class='icon-chevron-left icon-white'></i>下一頁");
if ($(v).text().match("Prev")) $(v).html("上一頁<i class='icon-chevron-right icon-whitee'></i>");
if ($(v).text().match("Fullscreen")) $(v).html("<i class='icon-fullscreen icon-white'></i>全螢幕");
if ($(v).text().match("Full Spread")) $(v).html("<i class='icon-pause icon-white'></i>全頁");
if ($(v).text().match("Single Page")) $(v).html("<i class='icon-stop icon-white'></i>單頁");
if ($(v).attr("id") == "fitVertical") $(v).html("切合<i class='icon-resize-vertical icon-white'></i>");
if ($(v).attr("id") == "fitHorizontal") $(v).html("切合<i class='icon-resize-horizontal icon-white'></i>");
});
}
//翻譯底部官方贊助
function _TranslationBottomDonate() {
//底部贊助
$("div.donate").each((i, v) => {
let cloneRSS = "";
if ($(v).find(".rss-icon").html()) cloneRSS = $(v).html().replace($(v).text(), "");
if ($(v).html().match("Donate BTC")) $(v).html(cloneRSS + "贊助 BTC: 14ko11NvcemFm2q5NpjpGiTbPhmB8pfnpC");
});
}
//翻譯排序方式
function _TranslationOrderBy() {
$("div.header-sort-select option").each((i, v) => {
tEng.tocht($(v), "Order by:", "排序方式");
tEng.tocht($(v), "Date Added", "日期");
tEng.tocht($(v), "Popularity", "熱門度");
});
}
//修改CSS
function _ModifyCSS() {
if (inallsatc) {
$(".container").append("<style>h3{margin-top:5px;margin-bottom:5px;padding-left:0px;}div.top-content{padding-top:20px}.page-content ul{color:#d47972}</style>");
// 預計將 不翻譯 打上星號
// a.NO_Tan::after {
// content: "(部翻譯)";
// font-size: 0.1em;
// }
//$("body").append("<style>.wrapper::before {content:\"*\";}</style>");
} else {
$(".container").append("<style>h3{margin-bottom:5px;padding-left:80px;}div.top-content{padding-top:15px}</style>");
}
$("div.gallery-info").find("tr").children("td:first-child").css("width", "50px");
$("div.dj-content").each((i, v) => {
if ($(v).parent().children("h1").find("a").attr("href") == $(v).find("a").last().attr("href")) $(v).find("a").last().css("display", "none");
$(v).find("li.hidden-list-item").removeClass("hidden-list-item");
$(v).find("tr").children("td:first-child").css("width", "50px");
});
}
//額外-廣告
function _ADremove() {
$("div[class*='hitomi'],div[id*='hitomi'],div[style*='z-index'],div[style*='position'],iframe").remove();
}
// 額外-熱鍵
// 參考:Danbooru(https://danbooru.donmai.us/static/keyboard_shortcuts)
// 重複執行
function _HotKey() {
let page = $("html, body"),
pageIndex = 0,
First_page = 1,
End_page = 0,
Previous_pageIndex = 0,
Next_pageIndex = 0,
Scroll_Length = 50,
Break_HotKey = false;
// 在搜尋頁換頁會有問題
if (url.search("search") > 0) {
// 搜尋頁面
pageIndex = parseInt($(".page-top ul li:not(:has(a))").text().replace(/[.]+/g, ""));
localStorage.setItem("pageIndex", pageIndex);
End_page = parseInt($(".page-top ul li:last-child").text());
Previous_pageIndex = (pageIndex > First_page) ? $(".page-top a[href='#" + (pageIndex - 1) + "']").attr("class", "Previous_pageIndex") : First_page;
Next_pageIndex = (pageIndex < End_page) ? $(".page-top a[href='#" + (pageIndex + 1) + "']").attr("class", "Next_pageIndex") : End_page;
} else {
// 其他頁面
pageIndex = parseInt($(".page-container li:not(:has(a))").text().replace(/[.]+/g, ""));
localStorage.setItem("pageIndex", pageIndex);
End_page = parseInt($(".page-container li:last-child").text());
Previous_pageIndex = (pageIndex > First_page) ? $(".page-container a[href$='-" + (pageIndex - 1) + ".html']").attr("class", "Previous_pageIndex") : First_page;
Next_pageIndex = (pageIndex < End_page) ? $(".page-container a[href$='-" + (pageIndex + 1) + ".html']").attr("class", "Next_pageIndex") : End_page;
}
if (!CheckOnEvent("body", "keyup")) {
$("body").keyup(function handle(e) {
let _pI = localStorage.getItem("pageIndex")
if ($("#query-input:focus").length > 0) Break_HotKey = true;
switch (e.key) {
case "ContextMenu":
case "Control":
case "Shift":
case "Alt":
case "Tab":
case "Meta":
Break_HotKey = true;
return false;
case "D":
case "d":
case "ArrowRight": //下一頁
if (End_page > _pI && $(".page-container a").length > 0 && !Break_HotKey) {
$("a.Next_pageIndex")[0].click();
}
Break_HotKey = false;
break;
case "A":
case "a":
case "ArrowLeft": //上一頁
if (First_page < _pI && $(".page-container a").length > 0 && !Break_HotKey) {
$("a.Previous_pageIndex")[0].click();
}
Break_HotKey = false;
break;
case "W":
case "w":
case "S":
case "s":
Scroll_Length = 50;
Break_HotKey = false;
break;
case "H":
case "h": //回首頁
if (!Break_HotKey) {
$("div#logo a")[0].click();
}
Break_HotKey = false;
break;
case "Q":
case "q": //搜索
if (!url.match("(\/reader\/)") && !Break_HotKey) {
page.stop().animate({
scrollTop: 0,
}, 200, "linear", () => {
$("#query-input").focus();
});
}
Break_HotKey = false;
break;
default:
Break_HotKey = false;
}
});
}
if (!CheckOnEvent("body", "keydown")) {
$("body").keydown(function (e) {
if ($("#query-input:focus").length > 0) Break_HotKey = true;
switch (e.key) {
case "ContextMenu":
case "Control":
case "Shift":
case "Alt":
case "Tab":
case "Meta":
Break_HotKey = true;
return false;
case "W":
case "w": //向上滾動
if (page.scrollTop() > 0 && !Break_HotKey) {
page.stop().animate({
scrollTop: page.scrollTop() - Scroll_Length,
}, 100, "linear");
Scroll_Length += 5;
} else { //網頁到頂
break;
}
Break_HotKey = false;
break;
case "S":
case "s": //向下滾動
if (page.scrollTop() + $(window).height() < page.outerHeight() && !Break_HotKey) {
page.stop().animate({
scrollTop: page.scrollTop() + Scroll_Length,
}, 100, "linear");
Scroll_Length += 5;
} else { //網頁到底
break;
}
Break_HotKey = false;
break;
default:
Break_HotKey = false;
}
});
}
}
})();