diff --git a/reader/LICENSE b/reader/LICENSE new file mode 100644 index 0000000..31d2bca --- /dev/null +++ b/reader/LICENSE @@ -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. \ No newline at end of file diff --git a/reader/src/ASTRv2/func.js b/reader/src/ASTRv2/func.js index f0a712d..fb1f7e8 100644 --- a/reader/src/ASTRv2/func.js +++ b/reader/src/ASTRv2/func.js @@ -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; @@ -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 - + + 由于版权意识上的欠缺,自四年前发布以来,ASTR一直以无协议也即开放领域的形式开源。然而近日发现某些项目在没有任何注明署名和来源的情况下,复制粘贴ASTR的代码。为了保护ASTR贡献者的权益,从本次提交起ASTR将采用MIT协议开源。以往代码仍然保留在无协议的形式,但是从本提交开始的代码将采用MIT协议授权。
+ 在MIT协议下,您可对ASTR的代码进行任意修改和使用,但是您必须在您的项目中包含原始的MIT协议和版权声明。 +

+ 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.
+ 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. +

欢迎访问明日方舟剧情文本阅读器!
@@ -79,6 +80,11 @@ + wv 1.4.1 + + Add initialization guidance when launch ASTR first time. + Add mirror accerlation support. Currently support Source serif loading. + wv 1.4 Using Source Han Serif in the content of ASTR. diff --git a/reader/src/ASTRv2/server.vue b/reader/src/ASTRv2/server.vue index d319723..eeedcdf 100644 --- a/reader/src/ASTRv2/server.vue +++ b/reader/src/ASTRv2/server.vue @@ -3,7 +3,7 @@ + class="font"/> @@ -34,7 +34,9 @@ export default { i18n: i18n, isDataLoaded: false, loadingProgress: 0, - isError: false + isError: false, + inited: func.inited, + mirror: func.mirror, }; }, metaInfo(){ @@ -52,7 +54,9 @@ export default { }, created(){ this.isDataLoaded = false; - this.initServerData(); + if(this.inited){ + this.initServerData(); + } this.$watch( () => this.$route.params, (toParams, previousParams) => { @@ -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()}); @@ -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); } } -}; +} \ No newline at end of file diff --git a/reader/src/ASTRv2/settings.vue b/reader/src/ASTRv2/settings.vue index e5f740e..92ff382 100644 --- a/reader/src/ASTRv2/settings.vue +++ b/reader/src/ASTRv2/settings.vue @@ -4,8 +4,8 @@ - - + +