Spaces:
Running
Running
fix uncomfortable scrolling problem
Browse files- frontend/dist/index.html +1 -1
- frontend/dist/js/app.413041e4.js +1 -0
- frontend/dist/js/app.accbaf15.js +0 -1
- frontend/public/index.html +1 -0
- frontend/src/App.vue +1 -1
frontend/dist/index.html
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<!DOCTYPE html><html lang="en" style="overflow-y: auto"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>日语歌词生成器</title><link rel="stylesheet" href="font/roboto.css"><link rel="stylesheet" href="font/materialdesignicons.min.css"><link href="css/chunk-vendors.db3e6b3f.css" rel="preload" as="style"><link href="js/app.
|
|
|
1 |
+
<!DOCTYPE html><html lang="en" style="overflow-y: auto"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>日语歌词生成器</title><link rel="stylesheet" href="font/roboto.css"><link rel="stylesheet" href="font/materialdesignicons.min.css"><script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js" integrity="sha512-qw2bX9KUhi7HLuUloyRsvxRlWJvj0u0JWVegc5tf7qsw47T0pwXZIk1Kyc0utTH3NlrpHtLa4HYTVUyHBr9Ufg==" crossorigin="anonymous"></script><link href="css/chunk-vendors.db3e6b3f.css" rel="preload" as="style"><link href="js/app.413041e4.js" rel="preload" as="script"><link href="js/chunk-vendors.f5ab6a81.js" rel="preload" as="script"><link href="css/chunk-vendors.db3e6b3f.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but lyric-generator doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.f5ab6a81.js"></script><script src="js/app.413041e4.js"></script></body></html>
|
frontend/dist/js/app.413041e4.js
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
(function(t){function e(e){for(var r,o,i=e[0],l=e[1],c=e[2],p=0,_=[];p<i.length;p++)o=i[p],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&_.push(n[o][0]),n[o]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(t[r]=l[r]);u&&u(e);while(_.length)_.shift()();return s.push.apply(s,c||[]),a()}function a(){for(var t,e=0;e<s.length;e++){for(var a=s[e],r=!0,i=1;i<a.length;i++){var l=a[i];0!==n[l]&&(r=!1)}r&&(s.splice(e--,1),t=o(o.s=a[0]))}return t}var r={},n={app:0},s=[];function o(e){if(r[e])return r[e].exports;var a=r[e]={i:e,l:!1,exports:{}};return t[e].call(a.exports,a,a.exports,o),a.l=!0,a.exports}o.m=t,o.c=r,o.d=function(t,e,a){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},o.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(o.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(a,r,function(e){return t[e]}.bind(null,r));return a},o.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="";var i=window["webpackJsonp"]=window["webpackJsonp"]||[],l=i.push.bind(i);i.push=e,i=i.slice();for(var c=0;c<i.length;c++)e(i[c]);var u=l;s.push([0,"chunk-vendors"]),a()})({0:function(t,e,a){t.exports=a("56d7")},"56d7":function(t,e,a){"use strict";a.r(e);a("e260"),a("e6cf"),a("cca6"),a("a79d");var r=a("2b0e"),n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("v-app",[a("v-app-bar",{attrs:{app:"",dark:"",color:"primary"}},[a("v-toolbar-title",[t._v(t._s(t.i18n.title))]),a("v-spacer"),a("v-select",{staticStyle:{"max-width":"10rem"},attrs:{items:["English","Chinese"],"prepend-icon":"mdi-web","hide-details":""},on:{change:function(e){return t.set_locale(t.locale_name)}},model:{value:t.locale_name,callback:function(e){t.locale_name=e},expression:"locale_name"}})],1),a("v-main",[a("v-row",{staticClass:"mx-3"},[a("div",{staticClass:"col-12 offset-0 col-sm-8 offset-sm-2 col-md-8 offset-md-2 col-lg-6 offset-lg-3 col-xl-6 offset-xl-3 mt-8"},[a("v-textarea",{attrs:{label:t.i18n.input_title_label,disabled:t.loading,rows:"1","prepend-icon":"mdi-comment",hint:t.i18n.input_title_hint,"no-resize":""},model:{value:t.prompt_title,callback:function(e){t.prompt_title=e},expression:"prompt_title"}}),a("v-textarea",{attrs:{label:t.i18n.input_text_label,disabled:t.loading,rows:"2","prepend-icon":"mdi-comment",hint:t.i18n.input_text_hint,"no-resize":""},model:{value:t.prompt_text,callback:function(e){t.prompt_text=e},expression:"prompt_text"}}),a("v-row",[a("v-checkbox",{staticClass:"col-6",attrs:{disabled:t.loading,label:t.i18n.show_romaji},on:{change:function(e){t.show_type=t.show_romaji?0:1}},model:{value:t.show_romaji,callback:function(e){t.show_romaji=e},expression:"show_romaji"}}),a("v-scroll-x-transition",[t.show_romaji?a("v-select",{staticClass:"col-6",attrs:{disabled:t.loading,items:t.romaji_systems,hint:t.i18n.romaji_system},model:{value:t.romaji_system,callback:function(e){t.romaji_system=e},expression:"romaji_system"}}):t._e()],1)],1),a("v-row",{staticClass:"mt-n8"},[a("v-checkbox",{staticClass:"col-6",attrs:{disabled:t.loading,label:t.i18n.use_translate},on:{change:function(e){t.show_type=t.use_trans?1:0}},model:{value:t.use_trans,callback:function(e){t.use_trans=e},expression:"use_trans"}}),a("v-scroll-x-transition",[t.use_trans?a("v-select",{staticClass:"col-6",attrs:{disabled:t.loading,items:t.google_supported_languages,hint:t.i18n.target_lang},model:{value:t.trans_target_lang,callback:function(e){t.trans_target_lang=e},expression:"trans_target_lang"}}):t._e()],1)],1),a("v-btn",{staticClass:"mb-10",attrs:{color:"primary",elevation:"5",loading:t.loading,text:"",block:"",large:"",tile:""},on:{click:function(e){return t.do_gen()}}},[t._v(t._s(t.i18n.generate))]),a("v-expand-transition",[0!==t.lyric.length?a("v-simple-table",{staticClass:"py-5",attrs:{dense:""},scopedSlots:t._u([{key:"default",fn:function(){return[a("thead",[a("tr",[a("th",[t._v(t._s(t.i18n.lyric)),a("v-btn",{staticClass:"ml-2",attrs:{elevation:"0",fab:"","x-small":""},on:{click:function(e){return t.copy_lyric("s")}}},[a("v-icon",[t._v("mdi-content-copy")])],1)],1),a("v-scroll-x-transition",[t.use_trans||t.show_romaji?a("th",[t.show_romaji&&!t.use_trans?a("span",[t._v(t._s(t.i18n.romaji))]):t._e(),!t.show_romaji&&t.use_trans?a("span",[t._v(t._s(t.i18n.translation))]):t._e(),t.use_trans&&t.show_romaji?a("v-btn",{staticClass:"mr-n2",attrs:{elevation:"0",text:"",small:""},on:{click:function(e){t.show_type=0===t.show_type?1:0}}},[t.show_romaji?a("span",{class:{"grey--text":1===t.show_type}},[t._v(t._s(t.i18n.romaji_s))]):t._e(),t._v("/"),t.use_trans?a("span",{class:{"grey--text":0===t.show_type}},[t._v(t._s(t.i18n.translation_s))]):t._e()]):t._e(),a("v-btn",{staticClass:"ml-2",attrs:{elevation:"0",fab:"","x-small":""},on:{click:function(e){return t.copy_lyric(0===t.show_type?"r":"t")}}},[a("v-icon",[t._v("mdi-content-copy")])],1)],1):t._e()])],1)]),a("tbody",{staticStyle:{"word-break":"break-word","word-wrap":"break-word"}},t._l(t.lyric,(function(e,r){return a("tr",{key:r,on:{mouseenter:function(e){t.hover=r},mouseleave:function(e){t.hover=-1}}},[a("td",{class:{"text-h6":0===r,"text-center":!e.is_lyric}},[t._v(" "+t._s(e.s)+" "),t.tts_support?a("v-scroll-x-transition",[t.tts_loading||""===e.s||t.speaking!==r&&(-1!==t.speaking||t.hover!==r)?t._e():a("v-btn",{class:{"mr-n9":!0,"blue--text":t.speaking===r},attrs:{icon:"",small:""},on:{click:function(e){return t.ja_tts(r)}}},[a("v-icon",[t._v("mdi-volume-high")])],1)],1):t._e(),t.tts_support&&t.speaking===r&&t.tts_loading?a("v-progress-circular",{staticClass:"mr-n9",attrs:{indeterminate:"",size:"20",width:"2",color:"primary"}}):t._e()],1),a("v-scroll-x-transition",[t.use_trans||t.show_romaji?a("td",{class:{"text-center":!e.is_lyric}},[t._v(t._s(0===t.show_type?e.r:e.t))]):t._e()])],1)})),0)]},proxy:!0}],null,!1,3397400449)}):t._e()],1)],1)]),a("v-snackbar",{attrs:{dark:"",timeout:2e3},scopedSlots:t._u([{key:"action",fn:function(e){var r=e.attrs;return[a("v-btn",t._b({attrs:{color:"blue",text:""},on:{click:function(e){t.snackbar=!1}}},"v-btn",r,!1),[t._v(" Close ")])]}}]),model:{value:t.snackbar,callback:function(e){t.snackbar=e},expression:"snackbar"}},[t._v(" "+t._s(t.snackbar_msg)+" ")])],1),a("v-footer",[a("v-row",{staticClass:"ma-0"},[a("div",{staticClass:"text-center caption col-12 pa-0"},[t._v(t._s(t.i18n.footer))]),a("div",{staticClass:"text-center caption col-12 pa-0"},[t._v("© 2022 SkyTNT")])])],1)],1)},s=[],o=a("1da1"),i=(a("96cf"),a("498a"),a("ac1f"),a("5319"),a("00b4"),a("99af"),a("1276"),a("d3b7"),a("bc3a")),l=a.n(i);function c(){return/(iPhone|iPad|iPod|iOS|Android|Windows Phone)/i.test(navigator.userAgent)}String.prototype.trim||(String.prototype.trim=function(){return this.triml().trimr()},String.prototype.triml=function(){return this.replace(/^[\s\n\t]+/g,"")},String.prototype.trimr=function(){return this.replace(/[\s\n\t]+$/g,"")});var u={name:"App",data:function(){return{locale_name:"English",i18n:{},use_trans:!1,google_supported_languages:["af","sq","am","ar","hy","az","eu","be","bn","bs","bg","my","ca","ca","ceb","co","cs","da","nl","nl","en","eo","et","fi","fr","fy","ka","de","gd","gd","ga","gl","el","gu","ht","ht","ha","haw","he","hi","hr","hu","ig","is","id","it","jw","ja","kn","kk","km","ky","ky","ko","ku","lo","la","lv","lt","lb","lb","mk","ml","mi","mr","ms","mg","mt","mn","ne","no","ny","ny","ny","or","pa","pa","fa","pl","pt","ps","ps","ro","ro","ro","ru","si","si","sk","sl","sm","sn","sd","so","st","es","es","sr","su","sw","sv","ta","te","tg","tl","th","tr","ug","ug","uk","ur","uz","vi","cy","xh","yi","yo","zu","zh-CN","zh-TW"],trans_target_lang:"zh-CN",show_romaji:!1,show_type:0,romaji_systems:["hepburn","kunrei","nippon"],romaji_system:"hepburn",prompt_title:"桜",prompt_text:"",loading:!1,lyric:[],tts_cache:{},tts_loading:!1,tts_support:!1,speaking:-1,hover:-1,snackbar:!1,snackbar_msg:""}},mounted:function(){this.locale_name="zh-CN"===(navigator.language||navigator.userLanguage)?"Chinese":"English","English"===this.locale_name&&(this.trans_target_lang="en"),this.set_locale(this.locale_name),this.loads()},methods:{set_locale:function(t){var e="English"===t?"en":"zh",a={en:{title:"Japanese Lyric Generator",loading:"Loading",input_title_label:"Title (can be empty)",input_text_label:"Beginning (can be empty)",input_title_hint:"Generate lyric for a given title",input_text_hint:"The generator continues with this text",show_romaji:"Show romaji",romaji_system:"Romaji system",use_translate:"Translate",target_lang:"Target language",generate:"Generate!",lyric:"Lyric",romaji:"Romaji",romaji_s:"R",translation:"Translation",translation_s:"T",footer:"The generated content can be used as you like, please share this site if you like.",copy_successful:"Copy successful",error:"Error",error_network:"Network error",error_failed_load_kuromoji:"Failed to load romaji converter",error_failed_covert_romaji:"Failed to convert lyric to romaji",error_failed_translate:"Failed to translate lyric",error_copy:"Copy failed, browser does not support"},zh:{title:"日语歌词生成器",loading:"加载中",input_title_label:"歌词标题(可不填)",input_text_label:"歌词开头(可不填)",input_title_hint:"给定标题生成歌词",input_text_hint:"生成器以这段文本进行续写",show_romaji:"显示罗马音",romaji_system:"罗马音系统",use_translate:"是否进行翻译",target_lang:"目标语言",generate:"生成!",lyric:"歌词",romaji:"罗马音",romaji_s:"音",translation:"翻译",translation_s:"译",footer:"生成的内容可以随意使用,喜欢的话就请分享本网站",copy_successful:"复制成功",error:"错误",error_network:"网络错误",error_failed_load_kuromoji:"罗马音转换器加载失败",error_failed_covert_romaji:"转换罗马音错误",error_failed_translate:"翻译出错",error_copy:"复制失败,浏览器不支持"}};this.i18n=a[e]},loads:function(){return Object(o["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(c()){t.next=6;break}return t.t0=eval,t.next=4,l.a.get("https://l2d.fab.moe/js/autoload.js");case 4:t.t1=t.sent.data,(0,t.t0)(t.t1);case 6:case"end":return t.stop()}}),t)})))()},do_gen:function(){var t=this;return Object(o["a"])(regeneratorRuntime.mark((function e(){var a,r,n,s,o,i,c,u,p,_,m;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return a=t.prompt_title.trim(),r=t.prompt_text.trim(),t.loading=!0,t.lyric=[],t.tts_cache={},e.prev=5,e.next=8,l.a.post("gen",{title:a,text:r});case 8:for(i in n=e.sent,s="".concat(n.data.title,"\n\n").concat(n.data.lyric),o=s.split("\n"),o)c=o[i].trim().replace(/ /g," "),t.lyric.push({s:c,r:"",t:"",is_lyric:"---end---"!==c});return t.lyric[0].is_lyric=!1,e.prev=13,e.next=16,l.a.post("romaji",{system:t.romaji_system,text:s});case 16:for(p in u=e.sent.data.romaji,u=u.split("\n"),u)t.lyric[p].r=u[p];e.next=24;break;case 21:e.prev=21,e.t0=e["catch"](13),t.show_snackbar(t.i18n.error_failed_covert_romaji+":"+e.t0.message);case 24:if(!t.use_trans){e.next=29;break}return e.next=27,t.google_translate(s);case 27:if(_=e.sent,""!==_)for(m in _=_.split("\n"),_)t.lyric[m].t=_[m].trim().replace(/ /g," ");case 29:t.loading=!1,e.next=37;break;case 32:e.prev=32,e.t1=e["catch"](5),console.log(e.t1),t.show_snackbar(t.i18n.error+":"+e.t1.message),t.loading=!1;case 37:case"end":return e.stop()}}),e,null,[[5,32],[13,21]])})))()},google_translate:function(t){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function a(){var r,n,s,o,i;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:return r={client:"gtx",dt:"t",sl:"ja",tl:e.trans_target_lang,q:t},a.prev=1,a.next=4,l.a.get("https://translate.googleapis.com/translate_a/single",{params:r});case 4:for(i in n=a.sent,s="",o=n.data[0],o)s+=o[i][0];return a.abrupt("return",s);case 11:a.prev=11,a.t0=a["catch"](1),e.show_snackbar(e.i18n.error_failed_translate+":"+a.t0.message);case 14:return a.abrupt("return","");case 15:case"end":return a.stop()}}),a,null,[[1,11]])})))()},ja_tts:function(t){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function a(){var r,n,s,o,i,c;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:if(r=e.lyric[t].s,-1===e.speaking&&""!==r){a.next=3;break}return a.abrupt("return");case 3:if(e.speaking=t,a.prev=4,n=new AudioContext,s=n.createGain(),s.gain.value=2,void 0!==e.tts_cache[r]){a.next=20;break}return e.tts_loading=!0,a.next=12,l.a.post("https://voicevox-skytnt.cloud.okteto.net/audio_query",null,{params:{speaker:4,text:r}});case 12:return o=a.sent.data,a.next=15,l.a.post("https://voicevox-skytnt.cloud.okteto.net/synthesis",o,{params:{speaker:4},responseType:"arraybuffer"});case 15:return i=a.sent.data,e.tts_loading=!1,a.next=19,n.decodeAudioData(i);case 19:e.tts_cache[r]=a.sent;case 20:return c=n.createBufferSource(),c.buffer=e.tts_cache[r],c.loop=!1,c.connect(s),s.connect(n.destination),a.next=27,new Promise((function(t){c.onended=function(){t()},c.start(0)}));case 27:a.next=32;break;case 29:a.prev=29,a.t0=a["catch"](4),e.show_snackbar(e.i18n.error+":"+a.t0.message);case 32:e.speaking=-1,e.tts_loading=!1;case 34:case"end":return a.stop()}}),a,null,[[4,29]])})))()},copy_lyric:function(t){var e="";for(var a in this.lyric)e+=this.lyric[a][t]+"\n";e=e.trim(),this.copy(e)},copy:function(t){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function a(){var r,n;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,navigator.clipboard.writeText(t);case 3:e.show_snackbar(e.i18n.copy_successful),a.next=18;break;case 6:a.prev=6,a.t0=a["catch"](0),r=document.createElement("textarea"),r.style.position="fixed",r.style.top="-10000px",r.style.zIndex="-999",document.body.appendChild(r),console.log("input",r),r.value=t,r.focus(),r.select();try{n=document.execCommand("copy"),n&&"unsuccessful"!==n?e.show_snackbar(e.i18n.copy_successful):e.show_snackbar(e.i18n.error_copy)}catch(s){e.show_snackbar(e.i18n.error_copy)}finally{document.body.removeChild(r)}case 18:case"end":return a.stop()}}),a,null,[[0,6]])})))()},show_snackbar:function(t){this.snackbar=!0,this.snackbar_msg=t}}},p=u,_=a("2877"),m=a("6544"),d=a.n(m),h=a("7496"),f=a("40dc"),g=a("8336"),v=a("ac7c"),b=a("0789"),y=a("553a"),k=a("132d"),x=a("f6c4"),w=a("490a"),j=a("0fd9"),C=a("b974"),S=a("1f4f"),T=a("2db4"),O=a("2fa4"),V=a("a844"),R=a("2a7f"),z=Object(_["a"])(p,n,s,!1,null,null,null),P=z.exports;d()(z,{VApp:h["a"],VAppBar:f["a"],VBtn:g["a"],VCheckbox:v["a"],VExpandTransition:b["a"],VFooter:y["a"],VIcon:k["a"],VMain:x["a"],VProgressCircular:w["a"],VRow:j["a"],VScrollXTransition:b["d"],VSelect:C["a"],VSimpleTable:S["a"],VSnackbar:T["a"],VSpacer:O["a"],VTextarea:V["a"],VToolbarTitle:R["a"]});var E=a("f309");r["a"].use(E["a"]);var A=new E["a"]({}),M=a("8c4f");r["a"].use(M["a"]);var N=[],B=new M["a"]({routes:N}),F=B;r["a"].config.productionTip=!1,new r["a"]({vuetify:A,router:F,render:function(t){return t(P)}}).$mount("#app")}});
|
frontend/dist/js/app.accbaf15.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
(function(t){function e(e){for(var a,o,i=e[0],l=e[1],c=e[2],p=0,_=[];p<i.length;p++)o=i[p],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&_.push(n[o][0]),n[o]=0;for(a in l)Object.prototype.hasOwnProperty.call(l,a)&&(t[a]=l[a]);u&&u(e);while(_.length)_.shift()();return s.push.apply(s,c||[]),r()}function r(){for(var t,e=0;e<s.length;e++){for(var r=s[e],a=!0,i=1;i<r.length;i++){var l=r[i];0!==n[l]&&(a=!1)}a&&(s.splice(e--,1),t=o(o.s=r[0]))}return t}var a={},n={app:0},s=[];function o(e){if(a[e])return a[e].exports;var r=a[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=t,o.c=a,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)o.d(r,a,function(e){return t[e]}.bind(null,a));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="";var i=window["webpackJsonp"]=window["webpackJsonp"]||[],l=i.push.bind(i);i.push=e,i=i.slice();for(var c=0;c<i.length;c++)e(i[c]);var u=l;s.push([0,"chunk-vendors"]),r()})({0:function(t,e,r){t.exports=r("56d7")},"56d7":function(t,e,r){"use strict";r.r(e);r("e260"),r("e6cf"),r("cca6"),r("a79d");var a=r("2b0e"),n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("v-app",{style:{"max-height":t.$vuetify.breakpoint.height+"px","overflow-y":"scroll"}},[r("v-app-bar",{attrs:{app:"",dark:"",color:"primary"}},[r("v-toolbar-title",[t._v(t._s(t.i18n.title))]),r("v-spacer"),r("v-select",{staticStyle:{"max-width":"10rem"},attrs:{items:["English","Chinese"],"prepend-icon":"mdi-web","hide-details":""},on:{change:function(e){return t.set_locale(t.locale_name)}},model:{value:t.locale_name,callback:function(e){t.locale_name=e},expression:"locale_name"}})],1),r("v-main",[r("v-row",{staticClass:"mx-3"},[r("div",{staticClass:"col-12 offset-0 col-sm-8 offset-sm-2 col-md-8 offset-md-2 col-lg-6 offset-lg-3 col-xl-6 offset-xl-3 mt-8"},[r("v-textarea",{attrs:{label:t.i18n.input_title_label,disabled:t.loading,rows:"1","prepend-icon":"mdi-comment",hint:t.i18n.input_title_hint,"no-resize":""},model:{value:t.prompt_title,callback:function(e){t.prompt_title=e},expression:"prompt_title"}}),r("v-textarea",{attrs:{label:t.i18n.input_text_label,disabled:t.loading,rows:"2","prepend-icon":"mdi-comment",hint:t.i18n.input_text_hint,"no-resize":""},model:{value:t.prompt_text,callback:function(e){t.prompt_text=e},expression:"prompt_text"}}),r("v-row",[r("v-checkbox",{staticClass:"col-6",attrs:{disabled:t.loading,label:t.i18n.show_romaji},on:{change:function(e){t.show_type=t.show_romaji?0:1}},model:{value:t.show_romaji,callback:function(e){t.show_romaji=e},expression:"show_romaji"}}),r("v-scroll-x-transition",[t.show_romaji?r("v-select",{staticClass:"col-6",attrs:{disabled:t.loading,items:t.romaji_systems,hint:t.i18n.romaji_system},model:{value:t.romaji_system,callback:function(e){t.romaji_system=e},expression:"romaji_system"}}):t._e()],1)],1),r("v-row",{staticClass:"mt-n8"},[r("v-checkbox",{staticClass:"col-6",attrs:{disabled:t.loading,label:t.i18n.use_translate},on:{change:function(e){t.show_type=t.use_trans?1:0}},model:{value:t.use_trans,callback:function(e){t.use_trans=e},expression:"use_trans"}}),r("v-scroll-x-transition",[t.use_trans?r("v-select",{staticClass:"col-6",attrs:{disabled:t.loading,items:t.google_supported_languages,hint:t.i18n.target_lang},model:{value:t.trans_target_lang,callback:function(e){t.trans_target_lang=e},expression:"trans_target_lang"}}):t._e()],1)],1),r("v-btn",{staticClass:"mb-10",attrs:{color:"primary",elevation:"5",loading:t.loading,text:"",block:"",large:"",tile:""},on:{click:function(e){return t.do_gen()}}},[t._v(t._s(t.i18n.generate))]),r("v-expand-transition",[0!==t.lyric.length?r("v-simple-table",{staticClass:"py-5",attrs:{dense:""},scopedSlots:t._u([{key:"default",fn:function(){return[r("thead",[r("tr",[r("th",[t._v(t._s(t.i18n.lyric)),r("v-btn",{staticClass:"ml-2",attrs:{elevation:"0",fab:"","x-small":""},on:{click:function(e){return t.copy_lyric("s")}}},[r("v-icon",[t._v("mdi-content-copy")])],1)],1),r("v-scroll-x-transition",[t.use_trans||t.show_romaji?r("th",[t.show_romaji&&!t.use_trans?r("span",[t._v(t._s(t.i18n.romaji))]):t._e(),!t.show_romaji&&t.use_trans?r("span",[t._v(t._s(t.i18n.translation))]):t._e(),t.use_trans&&t.show_romaji?r("v-btn",{staticClass:"mr-n2",attrs:{elevation:"0",text:"",small:""},on:{click:function(e){t.show_type=0===t.show_type?1:0}}},[t.show_romaji?r("span",{class:{"grey--text":1===t.show_type}},[t._v(t._s(t.i18n.romaji_s))]):t._e(),t._v("/"),t.use_trans?r("span",{class:{"grey--text":0===t.show_type}},[t._v(t._s(t.i18n.translation_s))]):t._e()]):t._e(),r("v-btn",{staticClass:"ml-2",attrs:{elevation:"0",fab:"","x-small":""},on:{click:function(e){return t.copy_lyric(0===t.show_type?"r":"t")}}},[r("v-icon",[t._v("mdi-content-copy")])],1)],1):t._e()])],1)]),r("tbody",{staticStyle:{"word-break":"break-word","word-wrap":"break-word"}},t._l(t.lyric,(function(e,a){return r("tr",{key:a,on:{mouseenter:function(e){t.hover=a},mouseleave:function(e){t.hover=-1}}},[r("td",{class:{"text-h6":0===a,"text-center":!e.is_lyric}},[t._v(" "+t._s(e.s)+" "),t.tts_support?r("v-scroll-x-transition",[t.tts_loading||""===e.s||t.speaking!==a&&(-1!==t.speaking||t.hover!==a)?t._e():r("v-btn",{class:{"mr-n9":!0,"blue--text":t.speaking===a},attrs:{icon:"",small:""},on:{click:function(e){return t.ja_tts(a)}}},[r("v-icon",[t._v("mdi-volume-high")])],1)],1):t._e(),t.tts_support&&t.speaking===a&&t.tts_loading?r("v-progress-circular",{staticClass:"mr-n9",attrs:{indeterminate:"",size:"20",width:"2",color:"primary"}}):t._e()],1),r("v-scroll-x-transition",[t.use_trans||t.show_romaji?r("td",{class:{"text-center":!e.is_lyric}},[t._v(t._s(0===t.show_type?e.r:e.t))]):t._e()])],1)})),0)]},proxy:!0}],null,!1,3397400449)}):t._e()],1)],1)]),r("v-snackbar",{attrs:{dark:"",timeout:2e3},scopedSlots:t._u([{key:"action",fn:function(e){var a=e.attrs;return[r("v-btn",t._b({attrs:{color:"blue",text:""},on:{click:function(e){t.snackbar=!1}}},"v-btn",a,!1),[t._v(" Close ")])]}}]),model:{value:t.snackbar,callback:function(e){t.snackbar=e},expression:"snackbar"}},[t._v(" "+t._s(t.snackbar_msg)+" ")])],1),r("v-footer",[r("v-row",{staticClass:"ma-0"},[r("div",{staticClass:"text-center caption col-12 pa-0"},[t._v(t._s(t.i18n.footer))]),r("div",{staticClass:"text-center caption col-12 pa-0"},[t._v("© 2022 SkyTNT")])])],1)],1)},s=[],o=r("1da1"),i=(r("96cf"),r("498a"),r("ac1f"),r("5319"),r("00b4"),r("99af"),r("1276"),r("d3b7"),r("bc3a")),l=r.n(i);function c(){return/(iPhone|iPad|iPod|iOS|Android|Windows Phone)/i.test(navigator.userAgent)}String.prototype.trim||(String.prototype.trim=function(){return this.triml().trimr()},String.prototype.triml=function(){return this.replace(/^[\s\n\t]+/g,"")},String.prototype.trimr=function(){return this.replace(/[\s\n\t]+$/g,"")});var u={name:"App",data:function(){return{locale_name:"English",i18n:{},use_trans:!1,google_supported_languages:["af","sq","am","ar","hy","az","eu","be","bn","bs","bg","my","ca","ca","ceb","co","cs","da","nl","nl","en","eo","et","fi","fr","fy","ka","de","gd","gd","ga","gl","el","gu","ht","ht","ha","haw","he","hi","hr","hu","ig","is","id","it","jw","ja","kn","kk","km","ky","ky","ko","ku","lo","la","lv","lt","lb","lb","mk","ml","mi","mr","ms","mg","mt","mn","ne","no","ny","ny","ny","or","pa","pa","fa","pl","pt","ps","ps","ro","ro","ro","ru","si","si","sk","sl","sm","sn","sd","so","st","es","es","sr","su","sw","sv","ta","te","tg","tl","th","tr","ug","ug","uk","ur","uz","vi","cy","xh","yi","yo","zu","zh-CN","zh-TW"],trans_target_lang:"zh-CN",show_romaji:!1,show_type:0,romaji_systems:["hepburn","kunrei","nippon"],romaji_system:"hepburn",prompt_title:"桜",prompt_text:"",loading:!1,lyric:[],tts_cache:{},tts_loading:!1,tts_support:!1,speaking:-1,hover:-1,snackbar:!1,snackbar_msg:""}},mounted:function(){this.locale_name="zh-CN"===(navigator.language||navigator.userLanguage)?"Chinese":"English","English"===this.locale_name&&(this.trans_target_lang="en"),this.set_locale(this.locale_name),this.loads()},methods:{set_locale:function(t){var e="English"===t?"en":"zh",r={en:{title:"Japanese Lyric Generator",loading:"Loading",input_title_label:"Title (can be empty)",input_text_label:"Beginning (can be empty)",input_title_hint:"Generate lyric for a given title",input_text_hint:"The generator continues with this text",show_romaji:"Show romaji",romaji_system:"Romaji system",use_translate:"Translate",target_lang:"Target language",generate:"Generate!",lyric:"Lyric",romaji:"Romaji",romaji_s:"R",translation:"Translation",translation_s:"T",footer:"The generated content can be used as you like, please share this site if you like.",copy_successful:"Copy successful",error:"Error",error_network:"Network error",error_failed_load_kuromoji:"Failed to load romaji converter",error_failed_covert_romaji:"Failed to convert lyric to romaji",error_failed_translate:"Failed to translate lyric",error_copy:"Copy failed, browser does not support"},zh:{title:"日语歌词生成器",loading:"加载中",input_title_label:"歌词标题(可不填)",input_text_label:"歌词开头(可不填)",input_title_hint:"给定标题生成歌词",input_text_hint:"生成器以这段文本进行续写",show_romaji:"显示罗马音",romaji_system:"罗马音系统",use_translate:"是否进行翻译",target_lang:"目标语言",generate:"生成!",lyric:"歌词",romaji:"罗马音",romaji_s:"音",translation:"翻译",translation_s:"译",footer:"生成的内容可以随意使用,喜欢的话就请分享本网站",copy_successful:"复制成功",error:"错误",error_network:"网络错误",error_failed_load_kuromoji:"罗马音转换器加载失败",error_failed_covert_romaji:"转换罗马音错误",error_failed_translate:"翻译���错",error_copy:"复制失败,浏览器不支持"}};this.i18n=r[e]},loads:function(){return Object(o["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(c()){t.next=6;break}return t.t0=eval,t.next=4,l.a.get("https://l2d.fab.moe/js/autoload.js");case 4:t.t1=t.sent.data,(0,t.t0)(t.t1);case 6:case"end":return t.stop()}}),t)})))()},do_gen:function(){var t=this;return Object(o["a"])(regeneratorRuntime.mark((function e(){var r,a,n,s,o,i,c,u,p,_,m;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return r=t.prompt_title.trim(),a=t.prompt_text.trim(),t.loading=!0,t.lyric=[],t.tts_cache={},e.prev=5,e.next=8,l.a.post("gen",{title:r,text:a});case 8:for(i in n=e.sent,s="".concat(n.data.title,"\n\n").concat(n.data.lyric),o=s.split("\n"),o)c=o[i].trim().replace(/ /g," "),t.lyric.push({s:c,r:"",t:"",is_lyric:"---end---"!==c});return t.lyric[0].is_lyric=!1,e.prev=13,e.next=16,l.a.post("romaji",{system:t.romaji_system,text:s});case 16:for(p in u=e.sent.data.romaji,u=u.split("\n"),u)t.lyric[p].r=u[p];e.next=24;break;case 21:e.prev=21,e.t0=e["catch"](13),t.show_snackbar(t.i18n.error_failed_covert_romaji+":"+e.t0.message);case 24:if(!t.use_trans){e.next=29;break}return e.next=27,t.google_translate(s);case 27:if(_=e.sent,""!==_)for(m in _=_.split("\n"),_)t.lyric[m].t=_[m].trim().replace(/ /g," ");case 29:t.loading=!1,e.next=37;break;case 32:e.prev=32,e.t1=e["catch"](5),console.log(e.t1),t.show_snackbar(t.i18n.error+":"+e.t1.message),t.loading=!1;case 37:case"end":return e.stop()}}),e,null,[[5,32],[13,21]])})))()},google_translate:function(t){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function r(){var a,n,s,o,i;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return a={client:"gtx",dt:"t",sl:"ja",tl:e.trans_target_lang,q:t},r.prev=1,r.next=4,l.a.get("https://translate.googleapis.com/translate_a/single",{params:a});case 4:for(i in n=r.sent,s="",o=n.data[0],o)s+=o[i][0];return r.abrupt("return",s);case 11:r.prev=11,r.t0=r["catch"](1),e.show_snackbar(e.i18n.error_failed_translate+":"+r.t0.message);case 14:return r.abrupt("return","");case 15:case"end":return r.stop()}}),r,null,[[1,11]])})))()},ja_tts:function(t){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function r(){var a,n,s,o,i,c;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:if(a=e.lyric[t].s,-1===e.speaking&&""!==a){r.next=3;break}return r.abrupt("return");case 3:if(e.speaking=t,r.prev=4,n=new AudioContext,s=n.createGain(),s.gain.value=2,void 0!==e.tts_cache[a]){r.next=20;break}return e.tts_loading=!0,r.next=12,l.a.post("https://voicevox-skytnt.cloud.okteto.net/audio_query",null,{params:{speaker:4,text:a}});case 12:return o=r.sent.data,r.next=15,l.a.post("https://voicevox-skytnt.cloud.okteto.net/synthesis",o,{params:{speaker:4},responseType:"arraybuffer"});case 15:return i=r.sent.data,e.tts_loading=!1,r.next=19,n.decodeAudioData(i);case 19:e.tts_cache[a]=r.sent;case 20:return c=n.createBufferSource(),c.buffer=e.tts_cache[a],c.loop=!1,c.connect(s),s.connect(n.destination),r.next=27,new Promise((function(t){c.onended=function(){t()},c.start(0)}));case 27:r.next=32;break;case 29:r.prev=29,r.t0=r["catch"](4),e.show_snackbar(e.i18n.error+":"+r.t0.message);case 32:e.speaking=-1,e.tts_loading=!1;case 34:case"end":return r.stop()}}),r,null,[[4,29]])})))()},copy_lyric:function(t){var e="";for(var r in this.lyric)e+=this.lyric[r][t]+"\n";e=e.trim(),this.copy(e)},copy:function(t){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function r(){var a,n;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,navigator.clipboard.writeText(t);case 3:e.show_snackbar(e.i18n.copy_successful),r.next=18;break;case 6:r.prev=6,r.t0=r["catch"](0),a=document.createElement("textarea"),a.style.position="fixed",a.style.top="-10000px",a.style.zIndex="-999",document.body.appendChild(a),console.log("input",a),a.value=t,a.focus(),a.select();try{n=document.execCommand("copy"),n&&"unsuccessful"!==n?e.show_snackbar(e.i18n.copy_successful):e.show_snackbar(e.i18n.error_copy)}catch(s){e.show_snackbar(e.i18n.error_copy)}finally{document.body.removeChild(a)}case 18:case"end":return r.stop()}}),r,null,[[0,6]])})))()},show_snackbar:function(t){this.snackbar=!0,this.snackbar_msg=t}}},p=u,_=r("2877"),m=r("6544"),d=r.n(m),h=r("7496"),f=r("40dc"),g=r("8336"),v=r("ac7c"),y=r("0789"),b=r("553a"),k=r("132d"),x=r("f6c4"),w=r("490a"),j=r("0fd9"),C=r("b974"),S=r("1f4f"),T=r("2db4"),O=r("2fa4"),V=r("a844"),R=r("2a7f"),z=Object(_["a"])(p,n,s,!1,null,null,null),P=z.exports;d()(z,{VApp:h["a"],VAppBar:f["a"],VBtn:g["a"],VCheckbox:v["a"],VExpandTransition:y["a"],VFooter:b["a"],VIcon:k["a"],VMain:x["a"],VProgressCircular:w["a"],VRow:j["a"],VScrollXTransition:y["d"],VSelect:C["a"],VSimpleTable:S["a"],VSnackbar:T["a"],VSpacer:O["a"],VTextarea:V["a"],VToolbarTitle:R["a"]});var E=r("f309");a["a"].use(E["a"]);var A=new E["a"]({}),M=r("8c4f");a["a"].use(M["a"]);var N=[],B=new M["a"]({routes:N}),F=B;a["a"].config.productionTip=!1,new a["a"]({vuetify:A,router:F,render:function(t){return t(P)}}).$mount("#app")}});
|
|
|
|
frontend/public/index.html
CHANGED
@@ -8,6 +8,7 @@
|
|
8 |
<title>日语歌词生成器</title>
|
9 |
<link rel="stylesheet" href="font/roboto.css">
|
10 |
<link rel="stylesheet" href="font/materialdesignicons.min.css">
|
|
|
11 |
</head>
|
12 |
<body>
|
13 |
<noscript>
|
|
|
8 |
<title>日语歌词生成器</title>
|
9 |
<link rel="stylesheet" href="font/roboto.css">
|
10 |
<link rel="stylesheet" href="font/materialdesignicons.min.css">
|
11 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js" integrity="sha512-qw2bX9KUhi7HLuUloyRsvxRlWJvj0u0JWVegc5tf7qsw47T0pwXZIk1Kyc0utTH3NlrpHtLa4HYTVUyHBr9Ufg==" crossorigin="anonymous"></script>
|
12 |
</head>
|
13 |
<body>
|
14 |
<noscript>
|
frontend/src/App.vue
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<template>
|
2 |
-
<v-app
|
3 |
<v-app-bar app dark color="primary">
|
4 |
<v-toolbar-title>{{i18n.title}}</v-toolbar-title>
|
5 |
<v-spacer></v-spacer>
|
|
|
1 |
<template>
|
2 |
+
<v-app>
|
3 |
<v-app-bar app dark color="primary">
|
4 |
<v-toolbar-title>{{i18n.title}}</v-toolbar-title>
|
5 |
<v-spacer></v-spacer>
|