Skip to content

Commit

Permalink
v1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
050644zf committed Aug 14, 2023
1 parent 0f2f0ba commit 44e9fd8
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 41 deletions.
21 changes: 21 additions & 0 deletions reader/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) [2023] [Nightsky a.k.a 050644zf, and ASTR Contributors]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 6 additions & 0 deletions reader/src/ASTRv2/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ var hideName = window.localStorage.getItem('hideName');
var wversion = window.localStorage.getItem('wversion');
// var showbg = window.localStorage.getItem('showbg');
var bgMode = window.localStorage.getItem('bgMode');
var inited = window.localStorage.getItem('inited');
var mirror = window.localStorage.getItem('mirror');
var storyFile = urlParams.get('f');
var storyData = {eventName: "Loading..."};
var isOldversion = false;
Expand All @@ -25,6 +27,8 @@ if(!hidetip){hidetip = false};
if(!showDelay){showDelay = 'y'};
if(!hideName){hideName = 'n'};
if(!bgMode){bgMode = 'stripe'};
if(!inited){inited = false};
if(!mirror){mirror = 'origin'};
if(!wversion||wversion<currentwversion){wversion = currentwversion; window.localStorage.setItem('wversion',wversion);isOldversion = true};


Expand All @@ -39,6 +43,8 @@ export default {
bgMode: bgMode,
bgModes: bgModes,
hideName: hideName,
inited: inited,
mirror: mirror,
storyFile: storyFile,
storyData: storyData,
intermezzi: ['act9d0', 'act18d0', 'act18d3','act17side','act25side'],
Expand Down
3 changes: 2 additions & 1 deletion reader/src/ASTRv2/i18n.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"server": {"zh_CN":"简中服(CN)","en_US":"Global Server(EN)","ja_JP":"日本サーバー(JP)","ko_KR":"한국 서버(KR)", "zh_TW":"繁中服(TW)"},
"currentLang": {"zh_CN":"当前语言","en_US":"Current Language","ja_JP":"現在の言語","ko_KR":"현재 언어", "zh_TW":"當前語言"},
"currentLang": {"zh_CN":"UI语言","en_US":"UI Language","ja_JP":"UIの言語","ko_KR":"현재 언어", "zh_TW":"UI語言"},
"selectStory": {"zh_CN":"请从目录中选择故事查看",
"en_US":"Select the story you wanna view from the menu",
"ja_JP":"閲覧したいストーリーをメニューから選んでください",
Expand All @@ -21,6 +21,7 @@
"clear":{"zh_CN":"重置所有设置","en_US":"Reset All Settings","ja_JP":"全ての設定を初期化","ko_KR":"모든 설정 초기화", "zh_TW":"重置所有设置"},
"dr":{"zh_CN":"博士称呼","en_US":"Doctor's Name","ja_JP":"ドクターの名前","ko_KR":"박사의 이름", "zh_TW":"博士稱呼"},
"showDelay":{"zh_CN":"显示空白分割行","en_US":"Show Blank Seperation Line","ja_JP":"空行を表示する","ko_KR":"공백 구분선 표시", "zh_TW":"顯示空白分割行"},
"mirror":{"zh_CN":"使用镜像加速(Beta,内地访问建议勾选)","en_US":"Use Mirror Resources(Beta)","ja_JP":"ミラーのリソースを使用する(Beta)","ko_KR":"미러 리소스 사용(Beta)", "zh_TW":"使用鏡像資源(Beta)"},
"showbg":{"zh_CN":"显示背景","en_US":"Show Background","ja_JP":"背景を表示する","ko_KR":"배경 표시", "zh_TW":"顯示背景"},
"save":{"zh_CN":"应用设置","en_US":"Apply Setting","ja_JP":"設定を適用","ko_KR":"설정 적용", "zh_TW":"应用设置"},
"home":{"zh_CN":"返回目录","en_US":"Return to Menu","ja_JP":"メニューに戻る","ko_KR":"메뉴로 돌아가기", "zh_TW":"返回目錄"},
Expand Down
18 changes: 12 additions & 6 deletions reader/src/ASTRv2/menupage/homepage.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<template>
<n-space vertical class="homepage" justify="center">
<!-- <n-alert type="error" title="ASTR 已停止更新 / ASTR has stopped updating">
由于数据资源 <n-a href="https://github.com/Kengxxiao/ArknightsGameData">Kengxxiao/ArknightsGameData</n-a> 已经停止更新,ASTR数据将不再更新直到找到新可用数据源。<br/>
如果有新可用数据源欢迎在 github issue 中反馈!感谢大家的支持!<br/><br/>
Due to the archiving of game datasource <n-a href="https://github.com/Kengxxiao/ArknightsGameData">Kengxxiao/ArknightsGameData</n-a>, ASTR will not be updated until a new datasource is found. <br/>
If you find a new datasource, please submit an issue on github! Thank you for your support!
</n-alert> -->
<n-alert type="info" title="协议更新声明 / Declaration of License Update">
由于版权意识上的欠缺,自四年前发布以来,ASTR一直以无协议也即开放领域的形式开源。然而近日发现某些项目在没有任何注明署名和来源的情况下,复制粘贴ASTR的代码。为了保护ASTR贡献者的权益,从本次提交起ASTR将采用MIT协议开源。以往代码仍然保留在无协议的形式,但是从本提交开始的代码将采用MIT协议授权。<br/>
<n-text type="warning">在MIT协议下,您可对ASTR的代码进行任意修改和使用,但是您必须在您的项目中包含原始的MIT协议和版权声明。</n-text>
<br/><br/>
Due to lack of copyright awareness, ASTR has been released without any license in open domain for 4 years. However, recently we found some project copypasting code from ASTR without any credit and source listed. To protect ASTR contributors' rights, from this commit, ASTR will be released under MIT license. The previous code will still be in open domain, but the code from this and future commits are released under MIT license.<br/>
<n-text type="warning">Under MIT license, you can modify and use the code of ASTR in any way you want, but you must include the original MIT license and the copyright statement in your project.</n-text>
</n-alert>
<br/>
<n-h1 prefix="bar">
欢迎访问明日方舟剧情文本阅读器!<br />
Expand Down Expand Up @@ -79,6 +80,11 @@
<template #header>
点击展开 / Click to Unfold
</template>
<n-h4>wv 1.4.1</n-h4>
<n-oi>
<n-li>Add initialization guidance when launch ASTR first time.</n-li>
<n-li>Add mirror accerlation support. Currently support Source serif loading.</n-li>
</n-oi>
<n-h4>wv 1.4</n-h4>
<n-oi>
<n-li>Using Source Han Serif in the content of ASTR.</n-li>
Expand Down
61 changes: 37 additions & 24 deletions reader/src/ASTRv2/server.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<router-view v-slot="{ Component }" style="min-height: 80vh">
<transition name="fade">
<component :is="Component" v-if="isDataLoaded"
:class="[server=='ja_JP'?'jp-font':'',server=='zh_CN'?'sc-font':'',server=='zh_TW'?'tc-font':'',server=='ko_KR'?'kr-font':'']"/>
class="font"/>
<n-layout-content v-else >
<n-space vertical align="center" class="loading" item-style="display:flex;" justify="center">
<n-spin size="large" style="padding:5px"/>
Expand Down Expand Up @@ -34,7 +34,9 @@ export default {
i18n: i18n,
isDataLoaded: false,
loadingProgress: 0,
isError: false
isError: false,
inited: func.inited,
mirror: func.mirror,
};
},
metaInfo(){
Expand All @@ -52,7 +54,9 @@ export default {
},
created(){
this.isDataLoaded = false;
this.initServerData();
if(this.inited){
this.initServerData();
}
this.$watch(
() => this.$route.params,
(toParams, previousParams) => {
Expand Down Expand Up @@ -84,7 +88,7 @@ export default {
this.loadingbar.start();
this.loadingProgress = 0;
try{
await this.loadFont();
this.loadFont();
let menudata = await fetch('https://raw.githubusercontent.com/Kengxxiao/ArknightsGameData/master/'+this.server+'/gamedata/excel/story_review_table.json').then(res => {this.loadingProgress = 10;return res.json()});
let chardict = await fetch('https://raw.githubusercontent.com/050644zf/ArknightsStoryJson/main/'+this.server+'/chardict.json').then(res => {this.loadingProgress = 20;return res.json()});
let infodata = await fetch('https://raw.githubusercontent.com/050644zf/ArknightsStoryJson/main/'+this.server+'/storyinfo.json').then(res => {this.loadingProgress = 30;return res.json()});
Expand Down Expand Up @@ -175,17 +179,33 @@ export default {
return chapterdata;
},
async loadFont(){
return (function(d) {
var config = {
kitId: 'hsd6rxj',
scriptTimeout: 3000,
async: true
},
h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
})(document);
var l = this.server[3] + this.server[4];
if(l == 'US') l = 'CN';
const mirror = {
origin:"https://raw.githubusercontent.com/adobe-fonts/source-han-serif/release/",
mirror: "https://mirrors.sustech.edu.cn/adobe-fonts/source-han-serif/"
};
// Create a new @font-face rule
var fontFaceRule = "@font-face {\n" +
" font-family: 'source-serif-l';\n" +
" font-display: block;\n" +
" src: url('"+mirror[this.mirror]+"Variable/WOFF2/OTF/Subset/SourceHanSerif"+l+"-VF.otf.woff2') format('woff');\n" +
"}";
// Get the document's stylesheets
var styleSheets = document.styleSheets;
// Find the first stylesheet
var styleSheet = styleSheets[0];
// Insert the @font-face rule
styleSheet.insertRule(fontFaceRule, styleSheet.cssRules.length);
}
}
};
}
</script>

<style>
Expand All @@ -194,16 +214,9 @@ export default {
margin: 2% 15%;
min-height: 90vh;
}
.jp-font{
font-family: "source-han-serif-japanese", sans-serif;
}
.sc-font{
font-family: "source-han-serif-sc", sans-serif;
}
.tc-font{
font-family: "source-han-serif-tc", sans-serif;
}
.kr-font{
font-family: "source-han-serif-korean", sans-serif;
.font{
font-family: "source-serif-l", sans-serif;
}
</style>
28 changes: 18 additions & 10 deletions reader/src/ASTRv2/settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<SettingsIcon/>
</n-icon>
</n-button>
<n-drawer v-model:show="showsettings" placement="top" height="300">
<n-drawer-content closable >
<n-drawer v-model:show="showsettings" placement="top" height="400">
<n-drawer-content :closable="inited" >
<template #header>
<n-space item-style="display:flex;" align="center">
<n-icon>
Expand All @@ -27,6 +27,15 @@
</n-radio-button>
</n-radio-group>
</n-space>

<n-space item-style="display:flex;" align="center">
<n-icon>
<MirrorIcon/>
</n-icon>
{{i18n.mirror[currentLang]}}:
<n-switch v-model:value="mirror" checked-value="mirror" unchecked-value="origin"/>
</n-space>

<n-space item-style="display:flex;" align="center">
<n-icon>
<DrNameIcon/>
Expand Down Expand Up @@ -84,7 +93,7 @@
</template>

<script>
import { SettingsOutlined, PublicFilled, DriveFileRenameOutlineRound, VerticalDistributeOutlined, SaveAltOutlined, DeleteOutlineFilled, WallpaperOutlined } from "@vicons/material";
import { SettingsOutlined, PublicFilled, DriveFileRenameOutlineRound, VerticalDistributeOutlined, SaveAltOutlined, DeleteOutlineFilled, WallpaperOutlined,LibraryAddOutlined } from "@vicons/material";
import i18n from './i18n.json';
import func from './func.js';
export default {
Expand All @@ -95,17 +104,13 @@ export default {
langOpts: func.langList,
doctor: func.doctor,
showDelay: func.showDelay,
mirror: func.mirror,
hideName: func.hideName,
bgMode: func.bgMode,
bgModes: func.bgModes
bgModes: func.bgModes,
showsettings: !func.inited,
}
},
props:{
showsettings: {
type: Boolean,
default: false,
},
},
components:{
SettingsIcon: SettingsOutlined,
LangIcon: PublicFilled,
Expand All @@ -114,11 +119,14 @@ export default {
SaveIcon: SaveAltOutlined,
ResetIcon: DeleteOutlineFilled,
BGIcon: WallpaperOutlined,
MirrorIcon: LibraryAddOutlined,
},
methods:{
save(){
window.localStorage.setItem('inited',true);
window.localStorage.setItem('doctor',this.doctor);
window.localStorage.setItem('showDelay', this.showDelay);
window.localStorage.setItem('mirror', this.mirror);
window.localStorage.setItem('hideName', this.hideName);
window.localStorage.setItem('lang', this.currentLang);
window.localStorage.setItem('bgMode', this.bgMode);
Expand Down

0 comments on commit 44e9fd8

Please sign in to comment.