Merge branch 'develop'

This commit is contained in:
syuilo 2019-04-29 15:26:43 +09:00
commit 42e84b77e1
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
11 changed files with 105 additions and 33 deletions

View file

@ -42,6 +42,16 @@ mongodb:
8. master ブランチに戻す 8. master ブランチに戻す
9. enjoy 9. enjoy
11.6.0 (2019/04/29)
-------------------
### Improvements
* AiScriptにいくつかの文字列操作関数を追加
* ページ編集画面にページへのリンクを表示するように
### Fixes
* MisskeyPagesで数値入力が文字列として扱われる問題を修正
* デザインの調整
11.5.1 (2019/04/29) 11.5.1 (2019/04/29)
------------------- -------------------
### Fixes ### Fixes

View file

@ -1847,6 +1847,7 @@ pages:
are-you-sure-delete: "このページを削除しますか?" are-you-sure-delete: "このページを削除しますか?"
page-deleted: "ページを削除しました" page-deleted: "ページを削除しました"
edit-this-page: "このページを編集" edit-this-page: "このページを編集"
view-page: "ページを見る"
variables: "変数" variables: "変数"
variables-info: "変数を使うことで動的なページを作成できます。テキスト内で <b>{ 変数名 }</b> と書くとそこに変数の値を埋め込めます。例えば <b>Hello { thing } world!</b> というテキストで、変数(thing)の値が <b>ai</b> だった場合、テキストは <b>Hello ai world!</b> になります。" variables-info: "変数を使うことで動的なページを作成できます。テキスト内で <b>{ 変数名 }</b> と書くとそこに変数の値を埋め込めます。例えば <b>Hello { thing } world!</b> というテキストで、変数(thing)の値が <b>ai</b> だった場合、テキストは <b>Hello ai world!</b> になります。"
variables-info2: "変数の評価(値を算出すること)は上から下に行われるので、ある変数の中で自分より下の変数を参照することはできません。例えば上から <b>A、B、C</b> と3つの変数を定義したとき、<b>C</b>の中で<b>A</b>や<b>B</b>を参照することはできますが、<b>A</b>の中で<b>B</b>や<b>C</b>を参照することはできません。" variables-info2: "変数の評価(値を算出すること)は上から下に行われるので、ある変数の中で自分より下の変数を参照することはできません。例えば上から <b>A、B、C</b> と3つの変数を定義したとき、<b>C</b>の中で<b>A</b>や<b>B</b>を参照することはできますが、<b>A</b>の中で<b>B</b>や<b>C</b>を参照することはできません。"
@ -1901,10 +1902,28 @@ pages:
random: "ランダム" random: "ランダム"
value: "値" value: "値"
fn: "関数" fn: "関数"
text: "テキスト操作"
blocks: blocks:
text: "テキスト" text: "テキスト"
multiLineText: "テキスト(複数行)" multiLineText: "テキスト(複数行)"
textList: "テキストのリスト" textList: "テキストのリスト"
_textList:
info: "ひとつひとつを改行で区切ってください"
strLen: "テキストの長さ"
_strLen:
arg1: "テキスト"
strPick: "文字取り出し"
_strPick:
arg1: "テキスト"
arg2: "文字の位置"
strReplace: "テキスト置き換え"
_strReplace:
arg1: "テキスト"
arg2: "置き換え前"
arg3: "置き換え後"
strReverse: "テキストを反転"
_strReverse:
arg1: "テキスト"
add: "+ 足す" add: "+ 足す"
_add: _add:
arg1: "A" arg1: "A"

View file

@ -1,7 +1,7 @@
{ {
"name": "misskey", "name": "misskey",
"author": "syuilo <i@syuilo.com>", "author": "syuilo <i@syuilo.com>",
"version": "11.5.1", "version": "11.6.0",
"codename": "daybreak", "codename": "daybreak",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -65,6 +65,10 @@ const funcDefs = {
lt: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faLessThan, }, lt: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faLessThan, },
gtEq: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faGreaterThanEqual, }, gtEq: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faGreaterThanEqual, },
ltEq: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faLessThanEqual, }, ltEq: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faLessThanEqual, },
strLen: { in: ['string'], out: 'number', category: 'text', icon: faQuoteRight, },
strPick: { in: ['string', 'number'], out: 'string', category: 'text', icon: faQuoteRight, },
strReplace: { in: ['string', 'string', 'string'], out: 'string', category: 'text', icon: faQuoteRight, },
strReverse: { in: ['string'], out: 'string', category: 'text', icon: faQuoteRight, },
rannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, }, rannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
random: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, }, random: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, },
randomPick: { in: [0], out: 0, category: 'random', icon: faDice, }, randomPick: { in: [0], out: 0, category: 'random', icon: faDice, },
@ -413,6 +417,10 @@ export class AiScript {
subtract: (a, b) => a - b, subtract: (a, b) => a - b,
multiply: (a, b) => a * b, multiply: (a, b) => a * b,
divide: (a, b) => a / b, divide: (a, b) => a / b,
strLen: (a) => a.length,
strPick: (a, b) => a[b - 1],
strReplace: (a, b, c) => a.split(b).join(c),
strReverse: (a) => a.split('').reverse().join(''),
random: (probability) => Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * 100) < probability, random: (probability) => Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * 100) < probability,
rannum: (min, max) => min + Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * (max - min + 1)), rannum: (min, max) => min + Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * (max - min + 1)),
randomPick: (list) => list[Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * list.length)], randomPick: (list) => list[Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * list.length)],

View file

@ -1,7 +1,7 @@
<template> <template>
<div class="felqjxyj" :class="{ splash }"> <div class="felqjxyj" :class="{ splash }">
<div class="bg" ref="bg" @click="onBgClick"></div> <div class="bg" ref="bg" @click="onBgClick"></div>
<div class="main" ref="main"> <div class="main" ref="main" :class="{ round: $store.state.device.roundedCorners }">
<template v-if="type == 'signin'"> <template v-if="type == 'signin'">
<mk-signin/> <mk-signin/>
</template> </template>
@ -229,10 +229,12 @@ export default Vue.extend({
width calc(100% - 32px) width calc(100% - 32px)
text-align center text-align center
background var(--face) background var(--face)
border-radius 8px
color var(--faceText) color var(--faceText)
opacity 0 opacity 0
&.round
border-radius 8px
> .icon > .icon
font-size 32px font-size 32px

View file

@ -43,6 +43,13 @@ export default Vue.extend({
created() { created() {
if (this.value.name == null) Vue.set(this.value, 'name', ''); if (this.value.name == null) Vue.set(this.value, 'name', '');
if (this.value.inputType == null) Vue.set(this.value, 'inputType', 'string'); if (this.value.inputType == null) Vue.set(this.value, 'inputType', 'string');
this.$watch('value.inputType', t => {
if (this.value.default != null) {
if (t === 'number') this.value.default = parseInt(this.value.default, 10);
if (t === 'string') this.value.default = this.value.default.toString();
}
});
}, },
}); });
</script> </script>

View file

@ -16,8 +16,8 @@
<section v-else-if="value.type === 'multiLineText'" class="tbwccoaw"> <section v-else-if="value.type === 'multiLineText'" class="tbwccoaw">
<textarea v-model="value.value"></textarea> <textarea v-model="value.value"></textarea>
</section> </section>
<section v-else-if="value.type === 'textList'" class="frvuzvoi"> <section v-else-if="value.type === 'textList'" class="tbwccoaw">
<ui-textarea v-model="value.value"></ui-textarea> <textarea v-model="value.value" :placeholder="$t('script.blocks._textList.info')"></textarea>
</section> </section>
<section v-else-if="value.type === 'number'" class="tbwccoaw"> <section v-else-if="value.type === 'number'" class="tbwccoaw">
<input v-model="value.value" type="number"/> <input v-model="value.value" type="number"/>

View file

@ -11,6 +11,8 @@
</header> </header>
<section> <section>
<a class="view" v-if="pageId" :href="`/@${ $store.state.i.username }/pages/${ currentName }`" target="_blank"><fa :icon="faExternalLinkSquareAlt"/> {{ $t('view-page') }}</a>
<ui-input v-model="title"> <ui-input v-model="title">
<span>{{ $t('title') }}</span> <span>{{ $t('title') }}</span>
</ui-input> </ui-input>
@ -84,7 +86,7 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import i18n from '../../../../i18n'; import i18n from '../../../../i18n';
import { faICursor, faPlus, faSquareRootAlt, faCog } from '@fortawesome/free-solid-svg-icons'; import { faICursor, faPlus, faSquareRootAlt, faCog, faExternalLinkSquareAlt } from '@fortawesome/free-solid-svg-icons';
import { faSave, faStickyNote, faTrashAlt } from '@fortawesome/free-regular-svg-icons'; import { faSave, faStickyNote, faTrashAlt } from '@fortawesome/free-regular-svg-icons';
import XVariable from './page-editor.script-block.vue'; import XVariable from './page-editor.script-block.vue';
import XBlock from './page-editor.block.vue'; import XBlock from './page-editor.block.vue';
@ -110,6 +112,7 @@ export default Vue.extend({
data() { data() {
return { return {
pageId: null, pageId: null,
currentName: null,
title: '', title: '',
summary: null, summary: null,
name: Date.now().toString(), name: Date.now().toString(),
@ -123,7 +126,7 @@ export default Vue.extend({
showOptions: false, showOptions: false,
moreDetails: false, moreDetails: false,
url, url,
faPlus, faICursor, faSave, faStickyNote, faSquareRootAlt, faCog, faTrashAlt faPlus, faICursor, faSave, faStickyNote, faSquareRootAlt, faCog, faTrashAlt, faExternalLinkSquareAlt
}; };
}, },
@ -157,6 +160,7 @@ export default Vue.extend({
this.pageId = page.id; this.pageId = page.id;
this.title = page.title; this.title = page.title;
this.name = page.name; this.name = page.name;
this.currentName = page.name;
this.summary = page.summary; this.summary = page.summary;
this.font = page.font; this.font = page.font;
this.alignCenter = page.alignCenter; this.alignCenter = page.alignCenter;
@ -194,6 +198,7 @@ export default Vue.extend({
variables: this.variables, variables: this.variables,
eyeCatchingImageId: this.eyeCatchingImageId, eyeCatchingImageId: this.eyeCatchingImageId,
}).then(page => { }).then(page => {
this.currentName = this.name.trim();
this.$root.dialog({ this.$root.dialog({
type: 'success', type: 'success',
text: this.$t('page-updated') text: this.$t('page-updated')
@ -211,6 +216,7 @@ export default Vue.extend({
eyeCatchingImageId: this.eyeCatchingImageId, eyeCatchingImageId: this.eyeCatchingImageId,
}).then(page => { }).then(page => {
this.pageId = page.id; this.pageId = page.id;
this.currentName = this.name.trim();
this.$root.dialog({ this.$root.dialog({
type: 'success', type: 'success',
text: this.$t('page-created') text: this.$t('page-created')
@ -427,6 +433,10 @@ export default Vue.extend({
@media (max-width 500px) @media (max-width 500px)
padding 0 16px 16px 16px padding 0 16px 16px 16px
> .view
display inline-block
margin 16px 0 0 0
> .content > .content
margin-bottom 16px margin-bottom 16px

View file

@ -1,7 +1,7 @@
<template> <template>
<component class="dmtdnykelhudezerjlfpbhgovrgnqqgr" <component class="dmtdnykelhudezerjlfpbhgovrgnqqgr"
:is="link ? 'a' : 'button'" :is="link ? 'a' : 'button'"
:class="{ inline, primary, wait }" :class="{ inline, primary, wait, round: $store.state.device.roundedCorners }"
:type="type" :type="type"
@click="$emit('click')" @click="$emit('click')"
@mousedown="onMousedown" @mousedown="onMousedown"
@ -116,7 +116,6 @@ export default Vue.extend({
font-size 16px font-size 16px
line-height 24px line-height 24px
border none border none
border-radius 6px
outline none outline none
box-shadow none box-shadow none
text-decoration none text-decoration none
@ -124,6 +123,9 @@ export default Vue.extend({
color var(--text) color var(--text)
background var(--buttonBg) background var(--buttonBg)
&.round
border-radius 6px
&:not(:disabled):hover &:not(:disabled):hover
background var(--buttonHoverBg) background var(--buttonHoverBg)
@ -157,6 +159,8 @@ export default Vue.extend({
bottom -5px bottom -5px
left -5px left -5px
border 2px solid var(--primaryAlpha03) border 2px solid var(--primaryAlpha03)
&.round:focus:after
border-radius 10px border-radius 10px
&:not(.inline) + .dmtdnykelhudezerjlfpbhgovrgnqqgr &:not(.inline) + .dmtdnykelhudezerjlfpbhgovrgnqqgr
@ -197,7 +201,6 @@ export default Vue.extend({
left 0 left 0
width 100% width 100%
height 100% height 100%
border-radius 6px
overflow hidden overflow hidden
>>> div >>> div
@ -210,6 +213,9 @@ export default Vue.extend({
transform scale(1) transform scale(1)
transition all 0.5s cubic-bezier(0, .5, .5, 1) transition all 0.5s cubic-bezier(0, .5, .5, 1)
&.round > .ripples
border-radius 6px
&.primary > .ripples >>> div &.primary > .ripples >>> div
background rgba(0, 0, 0, 0.15) background rgba(0, 0, 0, 0.15)

View file

@ -184,7 +184,11 @@ export default Vue.extend({
this.v = v; this.v = v;
}, },
v(v) { v(v) {
if (this.type === 'number') {
this.$emit('input', parseInt(v, 10));
} else {
this.$emit('input', v); this.$emit('input', v);
}
if (this.withPasswordMeter) { if (this.withPasswordMeter) {
if (v == '') { if (v == '') {

View file

@ -1,5 +1,5 @@
<template> <template>
<div> <div class="hkcxmtwj">
<ui-switch v-model="v">{{ value.text }}</ui-switch> <ui-switch v-model="v">{{ value.text }}</ui-switch>
</div> </div>
</template> </template>
@ -31,3 +31,9 @@ export default Vue.extend({
} }
}); });
</script> </script>
<style lang="stylus" scoped>
.hkcxmtwj
display inline-block
margin 16px auto
</style>