Skip to content

Commit

Permalink
release: v0.24.5
Browse files Browse the repository at this point in the history
  • Loading branch information
asadahimeka committed Sep 8, 2022
1 parent faed413 commit a7f1923
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v0.24.5

- feat: 图片预加载数量配置
- fix: 图片详情翻到最后一张时加载下一页

## v0.24.0

- feat: 添加 NSFW 开关,默认打开
Expand Down
69 changes: 56 additions & 13 deletions dist/yandere-masonry.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @name Yande.re 瀑布流浏览
// @name:en Yande.re Masonry
// @name:zh Yande.re 瀑布流浏览
// @version 0.24.4
// @version 0.24.5
// @description Yande.re/Konachan 中文标签 & 缩略图放大 & 双击翻页 & 瀑布流浏览模式(支持 danbooru/gelbooru/rule34/sakugabooru/lolibooru/safebooru/3dbooru/xbooru 等)
// @description:en Yande.re/Konachan Masonry(Waterfall) Layout. Also support danbooru/gelbooru/rule34/sakugabooru/lolibooru/safebooru/3dbooru/xbooru et cetera.
// @description:zh Yande.re/Konachan 中文标签 & 缩略图放大 & 双击翻页 & 瀑布流浏览模式(支持 danbooru/gelbooru/rule34/sakugabooru/lolibooru/safebooru/3dbooru/xbooru 等)
Expand Down Expand Up @@ -61,7 +61,7 @@ var __publicField = (obj, key, value) => {
(() => {
var ydStyle = 'a.thumb{padding-bottom:5px;border-bottom:2px solid;border-color:#232322}a.thumb:visited{border-color:#ffaaae}#add-to-favs{zoom:1.7;margin:4px 0}li.tag-type-artist a[href^="/post"]:not(.no-browser-link):before{content:"[\\753b\\5e08] "}li.tag-type-copyright a[href^="/post"]:not(.no-browser-link):before{content:"[\\7248\\6743] "}li.tag-type-character a[href^="/post"]:not(.no-browser-link):before{content:"[\\89d2\\8272] "}li.tag-type-circle a[href^="/post"]:not(.no-browser-link):before{content:"[\\793e\\56e2] "}#post-list{display:flex}#post-list .sidebar,#post-popular .sidebar{float:none;width:auto;max-width:240px}#post-list .content,#post-popular .content{float:none;flex:1;padding-right:10px}#post-list ul#post-list-posts,#post-popular ul#post-list-posts{display:block;width:100%;margin:0 auto}#post-popular ul#post-list-posts{width:96vw}#post-list ul#post-list-posts li,#post-popular ul#post-list-posts li{float:none;display:inline-block;margin:0;transition:.2s ease-in-out}#post-list ul#post-list-posts li[data-macy-complete="1"] img.preview,#post-popular ul#post-list-posts li[data-macy-complete="1"] img.preview{max-width:100%}#post-list ul#post-list-posts .inner,#post-popular ul#post-list-posts .inner{width:100%!important;height:auto!important}#post-list img.preview,#post-popular img.preview{width:100%;height:auto;margin-top:0;border-radius:5px;box-sizing:border-box}#post-list a.directlink,#post-popular a.directlink{margin-top:5px}\n';
var knStyle = "#lsidebar{display:none}#post-popular ul#post-list-posts{display:flex;justify-content:center;flex-wrap:wrap}#post-list ul#post-list-posts li,#post-popular ul#post-list-posts li{width:auto!important;margin:0 10px 10px 0;vertical-align:top}\n";
var customStyle = '#loading{height:100%;width:100%;position:fixed;z-index:99999;margin-top:0;top:0}#loading p{margin:100px auto;line-height:100px;font-family:Meiryo UI,MicroHei,Microsoft YaHei UI;font-size:18px;color:#9671d7}#loading-center{width:100%;height:100%;position:relative}#loading-center-absolute{position:absolute;left:50%;top:50%;height:150px;width:150px;margin-top:-75px;margin-left:-50px}.loading-object{width:20px;height:20px;background-color:#9671d7;float:left;margin-right:20px;margin-top:65px;border-radius:50%}#loading-object_one{animation:object_one 1.5s infinite}#loading-object_two{animation:object_two 1.5s infinite;animation-delay:.25s}#loading-object_three{animation:object_three 1.5s infinite;animation-delay:.5s}@keyframes object_one{75%{transform:scale(0)}}@keyframes object_two{75%{transform:scale(0)}}@keyframes object_three{75%{transform:scale(0)}}.img_detail{margin:0;overflow:hidden}.img_detail_loading{position:absolute;display:flex;justify-content:center;align-items:center;width:100%;height:100%;margin:0;backdrop-filter:blur(2px)}.img_detail.v-dialog:not(.v-dialog--fullscreen){max-height:98%}.img_detail .v-image{max-height:calc(100vh - 10px)}.img_detail_scale_on{width:auto!important;max-width:100vw!important;max-height:100vh!important;margin:0;padding:0;border-radius:0;overflow:auto}.img_detail_scale_on .v-image{display:block;max-height:100vh;margin:0 auto}.img_detail_scale_on .v-responsive__sizer,.img_detail_scale_on .v-image__image{display:none}.img_detail_scale_on .v-responsive__content{position:relative;width:auto!important;max-width:100vw!important;max-height:100vh;margin:0!important}.img_scale_scroll{display:none}.img_scale_scroll img{display:block;margin:0 auto}.img_detail_scale_on .img_scale_scroll{display:block;max-width:100vw;max-height:100vh;overflow:auto}::-webkit-scrollbar{width:0px}.nav_drawer .v-navigation-drawer__content::-webkit-scrollbar,.img_scale_scroll::-webkit-scrollbar{width:10px!important;height:10px!important}.img_scale_scroll::-webkit-scrollbar-track{background:#e6e6e6;border-left:1px solid #dadada}.nav_drawer .v-navigation-drawer__content::-webkit-scrollbar-thumb{background:#b0b0b0;border:solid 3px #fff;border-radius:7px}.theme--dark .nav_drawer .v-navigation-drawer__content::-webkit-scrollbar-thumb{border:solid 3px #363636}.img_scale_scroll::-webkit-scrollbar-thumb{background:#b0b0b0;border:solid 3px #e6e6e6;border-radius:7px}.nav_drawer .v-navigation-drawer__content::-webkit-scrollbar-thumb:hover,.img_scale_scroll::-webkit-scrollbar-thumb:hover{background:black}.theme--dark .nav_drawer .v-navigation-drawer__content::-webkit-scrollbar-thumb:hover{background:#ddd}.v-date-picker-table>table>thead>tr>th{padding:0}.v-date-picker-table>table>thead>tr>th:nth-child(1):before{content:"\\65e5"}.v-date-picker-table>table>thead>tr>th:nth-child(2):before{content:"\\4e00"}.v-date-picker-table>table>thead>tr>th:nth-child(3):before{content:"\\4e8c"}.v-date-picker-table>table>thead>tr>th:nth-child(4):before{content:"\\4e09"}.v-date-picker-table>table>thead>tr>th:nth-child(5):before{content:"\\56db"}.v-date-picker-table>table>thead>tr>th:nth-child(6):before{content:"\\4e94"}.v-date-picker-table>table>thead>tr>th:nth-child(7):before{content:"\\516d"}.poa_left_center{position:absolute;left:10px;top:50%;transform:translateY(-50%)}.poa_right_center{position:absolute;right:10px;top:50%;transform:translateY(-50%)}.v-list-item__title.title{line-height:1.2!important}.blacklist_combobox [role=combobox]{padding:0!important}.blacklist_combobox .v-chip{margin-bottom:4px!important}\n';
var customStyle = '#loading{height:100%;width:100%;position:fixed;z-index:99999;margin-top:0;top:0}#loading p{margin:100px auto;line-height:100px;font-family:Meiryo UI,MicroHei,Microsoft YaHei UI;font-size:18px;color:#9671d7}#loading-center{width:100%;height:100%;position:relative}#loading-center-absolute{position:absolute;left:50%;top:50%;height:150px;width:150px;margin-top:-75px;margin-left:-50px}.loading-object{width:20px;height:20px;background-color:#9671d7;float:left;margin-right:20px;margin-top:65px;border-radius:50%}#loading-object_one{animation:object_one 1.5s infinite}#loading-object_two{animation:object_two 1.5s infinite;animation-delay:.25s}#loading-object_three{animation:object_three 1.5s infinite;animation-delay:.5s}@keyframes object_one{75%{transform:scale(0)}}@keyframes object_two{75%{transform:scale(0)}}@keyframes object_three{75%{transform:scale(0)}}.img_detail{margin:0;overflow:hidden}.img_detail_loading{position:absolute;display:flex;justify-content:center;align-items:center;width:100%;height:100%;margin:0;backdrop-filter:blur(2px)}.img_detail.v-dialog:not(.v-dialog--fullscreen){max-height:98%}.img_detail .v-image{max-height:calc(100vh - 10px)}.img_detail_scale_on{width:auto!important;max-width:100vw!important;max-height:100vh!important;margin:0;padding:0;border-radius:0;overflow:auto}.img_detail_scale_on .v-image{display:block;max-height:100vh;margin:0 auto}.img_detail_scale_on .v-responsive__sizer,.img_detail_scale_on .v-image__image{display:none}.img_detail_scale_on .v-responsive__content{position:relative;width:auto!important;max-width:100vw!important;max-height:100vh;margin:0!important}.img_scale_scroll{display:none}.img_scale_scroll img{display:block;margin:0 auto}.img_detail_scale_on .img_scale_scroll{display:block;max-width:100vw;max-height:100vh;overflow:auto}::-webkit-scrollbar{width:0px}.nav_drawer .v-navigation-drawer__content::-webkit-scrollbar,.img_scale_scroll::-webkit-scrollbar{width:10px!important;height:10px!important}.img_scale_scroll::-webkit-scrollbar-track{background:#e6e6e6;border-left:1px solid #dadada}.nav_drawer .v-navigation-drawer__content::-webkit-scrollbar-thumb{background:#b0b0b0;border:solid 3px #fff;border-radius:7px}.theme--dark .nav_drawer .v-navigation-drawer__content::-webkit-scrollbar-thumb{border:solid 3px #363636}.img_scale_scroll::-webkit-scrollbar-thumb{background:#b0b0b0;border:solid 3px #e6e6e6;border-radius:7px}.nav_drawer .v-navigation-drawer__content::-webkit-scrollbar-thumb:hover,.img_scale_scroll::-webkit-scrollbar-thumb:hover{background:black}.theme--dark .nav_drawer .v-navigation-drawer__content::-webkit-scrollbar-thumb:hover{background:#ddd}.v-date-picker-table>table>thead>tr>th{padding:0}.v-date-picker-table>table>thead>tr>th:nth-child(1):before{content:"\\65e5"}.v-date-picker-table>table>thead>tr>th:nth-child(2):before{content:"\\4e00"}.v-date-picker-table>table>thead>tr>th:nth-child(3):before{content:"\\4e8c"}.v-date-picker-table>table>thead>tr>th:nth-child(4):before{content:"\\4e09"}.v-date-picker-table>table>thead>tr>th:nth-child(5):before{content:"\\56db"}.v-date-picker-table>table>thead>tr>th:nth-child(6):before{content:"\\4e94"}.v-date-picker-table>table>thead>tr>th:nth-child(7):before{content:"\\516d"}.poa_left_center{position:absolute;left:10px;top:50%;transform:translateY(-50%)}.poa_right_center{position:absolute;right:10px;top:50%;transform:translateY(-50%)}.v-list-item__title.title{line-height:1.2!important}.blacklist_combobox [role=combobox]{padding:0!important}.blacklist_combobox .v-chip{margin-bottom:4px!important}.preload_num{width:32px;height:30px;margin:0;padding-left:4px;border:1px solid #bbb;color:inherit;appearance:none!important;-webkit-appearance:none!important;-moz-appearance:textfield}\n';
async function prepareApp(callback) {
if (doNotRun())
return;
Expand Down Expand Up @@ -373,6 +373,7 @@ var __publicField = (obj, key, value) => {
showNSFWContents: localStorage.getItem("__showNSFW") !== "0",
isListenWheelEvent: localStorage.getItem("__listenWheel") !== "0",
isFullImgPreload: !!localStorage.getItem("__fullImgPreload"),
imgPreloadNum: Number(localStorage.getItem("__imgPreloadNum")) || 1,
isFullscreen: false,
toggleDrawer() {
store.showDrawer = !store.showDrawer;
Expand Down Expand Up @@ -3822,6 +3823,18 @@ var __publicField = (obj, key, value) => {
localStorage.setItem("__fullImgPreload", val ? "1" : "");
location.reload();
};
const onPreloadNumBlur = (ev) => {
const input = ev.target;
if (input.validationMessage) {
input.value = "1";
store.imgPreloadNum = 1;
localStorage.setItem("__imgPreloadNum", "1");
} else {
const num = Number(input.value) || 1;
store.imgPreloadNum = num;
localStorage.setItem("__imgPreloadNum", num.toString());
}
};
VueCompositionAPI2.onMounted(async () => {
if (store.isYKSite) {
const name = await getUsername();
Expand Down Expand Up @@ -3851,7 +3864,8 @@ var __publicField = (obj, key, value) => {
nsfwValue,
onNSFWSwitchChange,
onWheelSwitchChange,
onImgPreloadChange
onImgPreloadChange,
onPreloadNumBlur
};
};
var render$6 = function() {
Expand Down Expand Up @@ -4047,7 +4061,22 @@ var __publicField = (obj, key, value) => {
},
expression: "store.isFullImgPreload"
}
})], 1)], 1)], 1), _c2("v-list", {
})], 1)], 1), _vm.store.isFullImgPreload ? _c2("v-list-item", [_c2("v-list-item-content", [_c2("v-list-item-title", [_vm._v("\u56FE\u7247\u9884\u52A0\u8F7D\u6570\u91CF")]), _c2("v-list-item-subtitle", [_vm._v("\u5B9E\u9A8C\u6027/\u4E0D\u4FDD\u8BC1\u53EF\u7528")])], 1), _c2("v-list-item-action", {
staticClass: "pl-1"
}, [_c2("input", {
staticClass: "text-center rounded preload_num",
attrs: {
"type": "number",
"min": "0",
"max": "5"
},
domProps: {
"value": _vm.store.imgPreloadNum
},
on: {
"blur": _vm.onPreloadNumBlur
}
})])], 1) : _vm._e()], 1), _c2("v-list", {
attrs: {
"dense": "",
"nav": ""
Expand Down Expand Up @@ -4279,17 +4308,28 @@ var __publicField = (obj, key, value) => {
};
}
};
const preload = new Image();
const preloadNextImg = () => {
const preloadImgEl = new Image();
const preloadImg = (src) => {
console.log("preloadImg: ", src);
return new Promise((resolve, reject) => {
preloadImgEl.src = src;
preloadImgEl.onload = resolve;
preloadImgEl.onerror = reject;
});
};
const preloadNextImg = async () => {
if (!store.isFullImgPreload)
return;
if (isVideo.value)
return;
const next = store.imageList[store.imageSelectedIndex + 1];
if (!next)
return;
const imgSrc2 = (scaleOn.value ? next.jpegUrl : next.sampleUrl) || next.fileUrl;
preload.src = imgSrc2 || "";
for (let index = 1; index <= store.imgPreloadNum; index++) {
console.log("index: ", index);
const next = store.imageList[store.imageSelectedIndex + index];
if (!next)
break;
const imgSrc2 = (scaleOn.value ? next.jpegUrl : next.sampleUrl) || next.fileUrl;
await preloadImg(imgSrc2 || "");
}
};
const showPrevPost = async () => {
if (store.imageSelectedIndex == 0)
Expand All @@ -4299,8 +4339,11 @@ var __publicField = (obj, key, value) => {
await setPostDetail();
};
const showNextPost = async () => {
if (store.imageSelectedIndex >= store.imageList.length - 1)
return;
if (store.imageSelectedIndex >= store.imageList.length - 1) {
if (store.requestState || store.requestStop)
return;
await searchPosts();
}
imgLoading.value = true;
store.imageSelectedIndex++;
await setPostDetail();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yandere-masonry",
"version": "0.24.4",
"version": "0.24.5",
"private": true,
"description": "Yande.re/Konachan Waterfall Layout.",
"author": "asadahimeka",
Expand Down

0 comments on commit a7f1923

Please sign in to comment.