mirror of
https://github.com/Physton/sd-webui-prompt-all-in-one.git
synced 2026-01-26 19:29:56 +00:00
Merge branch 'preview'
Former-commit-id: 1cc2293d41d6ea704fa140d1ce4fe10eba9b60a5
This commit is contained in:
@@ -1 +1 @@
|
||||
7a8fa4c6bf57d607e9d7bcd29aabe94360120f14
|
||||
f76ac9bbd2793f2cbb0d397a7b452428baf29fb9
|
||||
@@ -1 +0,0 @@
|
||||
706592d31f4f3646416dfce090ebae74c34b077e
|
||||
@@ -1 +0,0 @@
|
||||
03ddcd9a096c97f3cad381aebab30a9b7e3a0a0f
|
||||
@@ -58,7 +58,7 @@ class storage:
|
||||
def __set(self, key, data):
|
||||
file_path = self.__get_data_filename(key)
|
||||
with open(file_path, 'w') as f:
|
||||
json.dump(data, f, indent=4, ensure_ascii=False)
|
||||
json.dump(data, f, indent=4, ensure_ascii=True)
|
||||
|
||||
def set(self, key, data):
|
||||
while self.__is_locked(key):
|
||||
|
||||
110
src/src/App.vue
110
src/src/App.vue
@@ -461,113 +461,5 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@import "toastr/build/toastr.min.css";
|
||||
@import "tippy.js/dist/tippy.css";
|
||||
|
||||
.hover-scale-120 {
|
||||
animation: all 0.3s;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
}
|
||||
|
||||
.hover-scale-140 {
|
||||
animation: all 0.3s;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.4);
|
||||
}
|
||||
}
|
||||
|
||||
.physton-paste-popup {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 2000;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
|
||||
.paste-popup-main {
|
||||
width: 700px;
|
||||
height: auto;
|
||||
padding: 20px;
|
||||
margin: 0;
|
||||
box-shadow: 0 0 3px 0 #4a54ff;
|
||||
border-radius: 6px 6px 4px 4px;
|
||||
background-color: rgba(30, 30, 30, .9);
|
||||
transition: height .1s ease-in-out, width .1s ease-in-out;
|
||||
color: #fff;
|
||||
position: relative;
|
||||
|
||||
.paste-popup-close {
|
||||
display: block;
|
||||
padding: 4px;
|
||||
position: absolute;
|
||||
right: -14px;
|
||||
top: -14px;
|
||||
background: #ffffffe6;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0px 1px 5px 0px #d81e06;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: #d81e06;
|
||||
}
|
||||
}
|
||||
|
||||
.paste-popup-title {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
word-break: keep-all;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.paste-popup-body {
|
||||
.paste-content {
|
||||
background: rgba(30, 30, 30, .9);
|
||||
border: 1px solid #3c3c3c;
|
||||
padding: 4px;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
resize: none;
|
||||
height: 400px;
|
||||
box-sizing: border-box;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: #4A54FF;
|
||||
}
|
||||
}
|
||||
|
||||
.paste-submit {
|
||||
background: center center #4A54FF;
|
||||
background-image: linear-gradient(315deg, #6772FF 0, #00F9E5 100%);
|
||||
background-size: 104% 104%;
|
||||
color: #1d1d1d;
|
||||
border-radius: 10px;
|
||||
padding: 10px;
|
||||
margin-top: 10px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 0 14px #4a54ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@import "@/main.less";
|
||||
</style>
|
||||
|
||||
@@ -4,10 +4,13 @@
|
||||
<div class="favorite-content">
|
||||
<div class="favorite-detail" v-show="currentItem && currentItem.tags">
|
||||
<div class="favorite-item-tags">
|
||||
<div class="favorite-item-tag" v-for="(tag, index) in currentItem.tags" :key="index">
|
||||
<div class="item-tag-value">{{ tag.value }}</div>
|
||||
<div class="item-tag-local-value">{{ tag.localValue }}</div>
|
||||
</div>
|
||||
<template v-for="(tag, index) in currentItem.tags" :key="index">
|
||||
<div v-if="tag.type && tag.type === 'wrap'" class="favorite-item-wrap"></div>
|
||||
<div v-else class="favorite-item-tag">
|
||||
<div class="item-tag-value">{{ tag.value }}</div>
|
||||
<div class="item-tag-local-value">{{ tag.localValue }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="favorite-list" v-show="favorites.length > 0" :style="{height: defaultHeight + 'px'}">
|
||||
@@ -238,173 +241,4 @@ export default {
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.physton-prompt-favorite {
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
width: 0;
|
||||
height: 0;
|
||||
padding: 0;
|
||||
box-shadow: 0 0 3px 0 #4a54ff;
|
||||
border-radius: 6px 6px 4px 4px;
|
||||
background-color: rgba(30, 30, 30, .9);
|
||||
transition: height .1s ease-in-out, width .1s ease-in-out;
|
||||
top: -9999px;
|
||||
left: -9999px;
|
||||
|
||||
.favorite-content {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.favorite-detail {
|
||||
position: absolute;
|
||||
right: -404px;
|
||||
top: 0;
|
||||
width: 400px;
|
||||
z-index: 1000;
|
||||
background: center center #4A54FF;
|
||||
background-image: linear-gradient(315deg, #6772FF 0, #00F9E5 100%);
|
||||
background-size: 104% 104%;
|
||||
box-shadow: 0 0 3px 0 #4a54ff;
|
||||
border-radius: 6px 6px 4px 4px;
|
||||
background-color: rgba(30, 30, 30, .9);
|
||||
padding: 10px;
|
||||
color: #1d1d1d;
|
||||
|
||||
.favorite-item-tags {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.favorite-item-tag {
|
||||
margin-right: 5px;
|
||||
margin-bottom: 5px;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.item-tag-value {
|
||||
padding: 4px 6px;
|
||||
border-radius: 5px;
|
||||
background: rgba(30, 30, 30, .9);
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.item-tag-local-value {
|
||||
font-size: 12px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.favorite-list {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
|
||||
.favorite-item {
|
||||
padding: 6px 10px;
|
||||
border-bottom: 1px solid #3c3c3c;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: center center #4A54FF;
|
||||
background-image: linear-gradient(315deg, #6772FF 0, #00F9E5 100%);
|
||||
background-size: 104% 104%;
|
||||
|
||||
.favorite-item-prompt {
|
||||
overflow: visible;
|
||||
white-space: normal;
|
||||
color: #1d1d1d;
|
||||
}
|
||||
}
|
||||
|
||||
.favorite-item-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.item-header-left, .item-header-right {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
|
||||
> div {
|
||||
margin-right: 10px;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-header-left {
|
||||
.item-header-index {
|
||||
background: #4A54FF;
|
||||
padding: 2px 0;
|
||||
width: 32px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.item-header-time {
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
.item-header-name {
|
||||
.header-name-input {
|
||||
background: transparent;
|
||||
border: 1px solid #3c3c3c;
|
||||
height: 20px;
|
||||
padding: 0 4px;
|
||||
width: 210px;
|
||||
font-size: 12px;
|
||||
color: #00F9E5;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: #4A54FF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-header-right {
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.favorite-item-prompt {
|
||||
margin-top: 5px;
|
||||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
color: #fff;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.favorite-empty {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
span {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</script>
|
||||
@@ -4,10 +4,13 @@
|
||||
<div class="history-content">
|
||||
<div class="history-detail" v-show="currentItem && currentItem.tags">
|
||||
<div class="history-item-tags">
|
||||
<div class="history-item-tag" v-for="(tag, index) in currentItem.tags" :key="index">
|
||||
<div class="item-tag-value">{{ tag.value }}</div>
|
||||
<div class="item-tag-local-value">{{ tag.localValue }}</div>
|
||||
</div>
|
||||
<template v-for="(tag, index) in currentItem.tags" :key="index">
|
||||
<div v-if="tag.type && tag.type === 'wrap'" class="history-item-wrap"></div>
|
||||
<div v-else class="history-item-tag">
|
||||
<div class="item-tag-value">{{ tag.value }}</div>
|
||||
<div class="item-tag-local-value">{{ tag.localValue }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="history-list" v-show="histories.length > 0" :style="{height: defaultHeight + 'px'}">
|
||||
@@ -263,193 +266,4 @@ export default {
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.physton-prompt-history {
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
width: 0;
|
||||
height: 0;
|
||||
padding: 0;
|
||||
box-shadow: 0 0 3px 0 #4a54ff;
|
||||
border-radius: 6px 6px 4px 4px;
|
||||
background-color: rgba(30, 30, 30, .9);
|
||||
transition: height .1s ease-in-out, width .1s ease-in-out;
|
||||
top: -9999px;
|
||||
left: -9999px;
|
||||
|
||||
.history-content {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.history-detail {
|
||||
position: absolute;
|
||||
right: -404px;
|
||||
top: 0;
|
||||
width: 400px;
|
||||
z-index: 1000;
|
||||
background: center center #4A54FF;
|
||||
background-image: linear-gradient(315deg, #6772FF 0, #00F9E5 100%);
|
||||
background-size: 104% 104%;
|
||||
box-shadow: 0 0 3px 0 #4a54ff;
|
||||
border-radius: 6px 6px 4px 4px;
|
||||
background-color: rgba(30, 30, 30, .9);
|
||||
padding: 10px;
|
||||
color: #1d1d1d;
|
||||
|
||||
.history-item-tags {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.history-item-tag {
|
||||
margin-right: 5px;
|
||||
margin-bottom: 5px;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.item-tag-value {
|
||||
padding: 4px 6px;
|
||||
border-radius: 5px;
|
||||
background: rgba(30, 30, 30, .9);
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.item-tag-local-value {
|
||||
font-size: 12px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.history-list {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
position: relative;
|
||||
|
||||
.history-clear {
|
||||
background: rgba(30, 30, 30, .9);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
padding: 10px 10px;
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid #4A54FF; // 6772FF
|
||||
color: #ff4a4a;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
&:hover {
|
||||
border-bottom: 1px solid #ff4a4a;
|
||||
background: center center #4A54FF;
|
||||
}
|
||||
}
|
||||
|
||||
.history-item {
|
||||
padding: 6px 10px;
|
||||
border-bottom: 1px solid #3c3c3c;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: center center #4A54FF;
|
||||
background-image: linear-gradient(315deg, #6772FF 0, #00F9E5 100%);
|
||||
background-size: 104% 104%;
|
||||
|
||||
.history-item-prompt {
|
||||
overflow: visible;
|
||||
white-space: normal;
|
||||
color: #1d1d1d;
|
||||
}
|
||||
}
|
||||
|
||||
.history-item-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.item-header-left, .item-header-right {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
|
||||
> div {
|
||||
margin-right: 10px;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-header-left {
|
||||
.item-header-index {
|
||||
background: #4A54FF;
|
||||
padding: 2px 0;
|
||||
width: 32px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.item-header-time {
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
.item-header-name {
|
||||
.header-name-input {
|
||||
background: transparent;
|
||||
border: 1px solid #3c3c3c;
|
||||
height: 20px;
|
||||
padding: 0 4px;
|
||||
width: 210px;
|
||||
font-size: 12px;
|
||||
color: #00F9E5;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: #4A54FF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-header-right {
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.history-item-prompt {
|
||||
margin-top: 5px;
|
||||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
color: #fff;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.history-empty {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
span {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</script>
|
||||
28
src/src/components/icons/iconWrap.vue
Executable file
28
src/src/components/icons/iconWrap.vue
Executable file
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<div class="icon-svg" :style="{width: width + 'px', height: height + 'px'}">
|
||||
<svg t="1684120692315" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
p-id="4885" :width="width" :height="height" :style="{fill: color}">
|
||||
<path d="M64 64h704v192H64z m-1.28 700.416H960V960H62.72z" p-id="4886"></path>
|
||||
<path d="M895.872 64v403.904H320.128v-68.416L191.872 501.504 320.128 608v-72.832h639.744V64z" p-id="4887"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'IconWrap',
|
||||
props: {
|
||||
width: {
|
||||
type: Number,
|
||||
default: 16,
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 16,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '#02b7fd',
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1 +1 @@
|
||||
4c5ee0546c54fd170de9a016b9cb3ec0dbb8e267
|
||||
16c40c887c81266e2766e0dc90fbc6a3c46bf906
|
||||
@@ -59,68 +59,4 @@ export default {
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
.physton-prompt-select-language {
|
||||
position: fixed;
|
||||
z-index: 2000;
|
||||
margin-top: 5px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
|
||||
.language-main {
|
||||
height: 70%;
|
||||
position: relative;
|
||||
|
||||
.language-close {
|
||||
display: block;
|
||||
padding: 4px;
|
||||
position: absolute;
|
||||
right: -14px;
|
||||
top: -14px;
|
||||
background: #ffffffe6;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0px 1px 5px 0px #d81e06;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
|
||||
&:hover {
|
||||
background: #d81e06;
|
||||
}
|
||||
}
|
||||
|
||||
.language-list {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
display: block;
|
||||
position: relative;
|
||||
box-shadow: 0 0 3px #4a54ff;
|
||||
border-radius: 6px 6px 4px 4px;
|
||||
background-color: #1e1e1ee6;
|
||||
transition: height .1s ease-in-out, width .1s ease-in-out;
|
||||
position: relative;
|
||||
|
||||
.language-item {
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
padding: 10px;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover, &.selected {
|
||||
background: center center #4A54FF;
|
||||
background-image: linear-gradient(315deg, #6772FF 0, #00F9E5 100%);
|
||||
background-size: 104% 104%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</script>
|
||||
@@ -187,163 +187,4 @@ Github: Physton/sd-webui-prompt-all-in-one`,
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
.physton-prompt-translate-setting {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 2000;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
|
||||
.translate-setting-main {
|
||||
width: 700px;
|
||||
height: auto;
|
||||
padding: 20px;
|
||||
margin: 0;
|
||||
box-shadow: 0 0 3px 0 #4a54ff;
|
||||
border-radius: 6px 6px 4px 4px;
|
||||
background-color: rgba(30, 30, 30, .9);
|
||||
transition: height .1s ease-in-out, width .1s ease-in-out;
|
||||
color: #fff;
|
||||
|
||||
.setting-line {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.line-title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
width: 150px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.line-content {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
|
||||
span {
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.api-name {
|
||||
display: inline-block;
|
||||
background: center center #4A54FF;
|
||||
background-image: linear-gradient(315deg, #6772FF 0, #00F9E5 100%);
|
||||
background-size: 104% 104%;
|
||||
color: #1d1d1d;
|
||||
border-radius: 2px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
input, textarea, select {
|
||||
background: rgba(30, 30, 30, .9);
|
||||
border: 1px solid #3c3c3c;
|
||||
padding: 4px;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
resize: none;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: #4A54FF;
|
||||
}
|
||||
}
|
||||
|
||||
.test-input {
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
.test-btn {
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
padding: 0 40px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
color: #fff;
|
||||
background: #108bb5;
|
||||
border-radius: 4px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.translate-error {
|
||||
color: #ff4a4a;
|
||||
font-size: 14px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.help-list {
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
|
||||
.help-item {
|
||||
margin-bottom: 10px;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
a {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
border-bottom: 1px solid #fff;
|
||||
padding-bottom: 4px;
|
||||
|
||||
&:hover {
|
||||
color: #108bb5;
|
||||
border-bottom-color: #108bb5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.setting-btns {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
|
||||
.translate-save {
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
padding: 0 40px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
color: #fff;
|
||||
background: center center #4A54FF;
|
||||
background-image: linear-gradient(315deg, #6772FF 0, #00F9E5 100%);
|
||||
background-size: 104% 104%;
|
||||
border-radius: 4px;
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.translate-close {
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
padding: 0 40px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
color: #4A54FF;
|
||||
background: transparent;
|
||||
border: 1px solid #4A54FF;
|
||||
border-radius: 4px;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</script>
|
||||
1103
src/src/main.less
Normal file
1103
src/src/main.less
Normal file
File diff suppressed because it is too large
Load Diff
@@ -117,38 +117,46 @@ export default {
|
||||
* @returns {string[]}
|
||||
*/
|
||||
splitTags(tags) {
|
||||
if (tags === null || tags === undefined || tags === false || tags === "") return []
|
||||
if (tags === null || tags === undefined || tags === false || tags === "" || tags.trim() === "") return []
|
||||
|
||||
// 替换
|
||||
tags = tags.replace(/,/g, ',') // 中文逗号
|
||||
tags = tags.replace(/。/g, ',') // 中文句号
|
||||
tags = tags.replace(/、/g, ',') // 中文顿号
|
||||
tags = tags.replace(/;/g, ',') // 中文分号
|
||||
tags = tags.replace(/./g, ',') // 日文句号
|
||||
tags = tags.replace(/;/g, ',') // 英文分号
|
||||
tags = tags.replace(/\t/g, ',') // 制表符
|
||||
tags = tags.replace(/\n/g, ',') // 换行符
|
||||
tags = tags.replace(/\r/g, ',') // 回车符
|
||||
tags = tags.trim()
|
||||
tags = tags.replace(/\t/g, '\n') // 制表符
|
||||
// tags = tags.replace(/\n/g, '\n') // 换行符
|
||||
tags = tags.replace(/\r/g, '\n') // 回车符
|
||||
tags = tags.replace(/\n+/g, '\n') // 连续换行符
|
||||
|
||||
const replace = '----====physton====----'
|
||||
const replaceRex = new RegExp(replace, 'g')
|
||||
for (const regex of this.dontSplitRegexes) {
|
||||
// 将其中的逗号替换为:<++++----====****>
|
||||
tags = tags.replace(regex, (match) => {
|
||||
return match.replace(/,/g, replace)
|
||||
})
|
||||
}
|
||||
|
||||
// 分割
|
||||
tags = tags.split(',')
|
||||
let list = []
|
||||
for (let tag of tags) {
|
||||
tag = tag.trim()
|
||||
if (tag === '') continue
|
||||
// 把逗号替换回来
|
||||
tag = tag.replace(replaceRex, ',')
|
||||
list.push(tag)
|
||||
}
|
||||
const lines = tags.split("\n")
|
||||
const lineCount = lines.length
|
||||
lines.forEach((line, index) => {
|
||||
line = line.trim()
|
||||
if (line === '') return
|
||||
// 替换
|
||||
line = line.replace(/,/g, ',') // 中文逗号
|
||||
line = line.replace(/。/g, ',') // 中文句号
|
||||
line = line.replace(/、/g, ',') // 中文顿号
|
||||
line = line.replace(/;/g, ',') // 中文分号
|
||||
line = line.replace(/./g, ',') // 日文句号
|
||||
line = line.replace(/;/g, ',') // 英文分号
|
||||
const replace = '----====physton====----'
|
||||
const replaceRex = new RegExp(replace, 'g')
|
||||
for (const regex of this.dontSplitRegexes) {
|
||||
// 将其中的逗号替换掉
|
||||
line = line.replace(regex, (match) => {
|
||||
return match.replace(/,/g, replace)
|
||||
})
|
||||
}
|
||||
line.split(",").forEach((tag, index) => {
|
||||
tag = tag.trim()
|
||||
if (tag === '') return
|
||||
// 把逗号替换回来
|
||||
tag = tag.replace(replaceRex, ',')
|
||||
list.push(tag)
|
||||
})
|
||||
if (index < lineCount - 1) {
|
||||
list.push('\n')
|
||||
}
|
||||
})
|
||||
return list
|
||||
},
|
||||
|
||||
@@ -158,10 +166,13 @@ export default {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
canTranslate(text) {
|
||||
// 如果为空,不翻译
|
||||
if (text.trim() === '') return false
|
||||
// 如果<>包裹,不翻译
|
||||
if (text[0] === '<' && text[text.length - 1] === '>') return false
|
||||
// 如果是数字、标点符号,不翻译
|
||||
if (/^[0-9,.\s!"#$%&'()*+,-./:;<=>?@\[\]^_`{|}~]+$/.test(text)) return false
|
||||
const regex = /^[0-9`~!@#$%^&*()_+\-=\[\]{}\\|;:'",.\/<>?]+$/
|
||||
if (regex.test(text)) return false
|
||||
// 如果是单个英文字母,不翻译
|
||||
if (/^[a-zA-Z]$/.test(text)) return false
|
||||
return true
|
||||
|
||||
1
style.css.REMOVED.git-id
Normal file
1
style.css.REMOVED.git-id
Normal file
@@ -0,0 +1 @@
|
||||
84f9bebc4528c585af698943d319f3228c919149
|
||||
Reference in New Issue
Block a user