Merge remote-tracking branch 'refs/remotes/misskey-original/develop' into develop
# Conflicts: # packages/frontend/src/components/MkAbuseReport.vue # packages/frontend/src/components/MkMention.vue # packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts
This commit is contained in:
commit
1a8d91355d
29 changed files with 458 additions and 108 deletions
|
|
@ -48,7 +48,7 @@ import MkInput from '@/components/MkInput.vue';
|
|||
import MkSelect from '@/components/MkSelect.vue';
|
||||
import { useRouter } from '@/router/supplier.js';
|
||||
|
||||
const PRESET_DEFAULT = `/// @ 0.16.0
|
||||
const PRESET_DEFAULT = `/// @ 0.18.0
|
||||
|
||||
var name = ""
|
||||
|
||||
|
|
@ -60,13 +60,13 @@ Ui:render([
|
|||
Ui:C:button({
|
||||
text: "Hello"
|
||||
onClick: @() {
|
||||
Mk:dialog(null \`Hello, {name}!\`)
|
||||
Mk:dialog(null, \`Hello, {name}!\`)
|
||||
}
|
||||
})
|
||||
])
|
||||
`;
|
||||
|
||||
const PRESET_OMIKUJI = `/// @ 0.16.0
|
||||
const PRESET_OMIKUJI = `/// @ 0.18.0
|
||||
// ユーザーごとに日替わりのおみくじのプリセット
|
||||
|
||||
// 選択肢
|
||||
|
|
@ -81,11 +81,11 @@ let choices = [
|
|||
"大凶"
|
||||
]
|
||||
|
||||
// シードが「ユーザーID+今日の日付」である乱数生成器を用意
|
||||
let random = Math:gen_rng(\`{USER_ID}{Date:year()}{Date:month()}{Date:day()}\`)
|
||||
// シードが「PlayID+ユーザーID+今日の日付」である乱数生成器を用意
|
||||
let random = Math:gen_rng(\`{THIS_ID}{USER_ID}{Date:year()}{Date:month()}{Date:day()}\`)
|
||||
|
||||
// ランダムに選択肢を選ぶ
|
||||
let chosen = choices[random(0 (choices.len - 1))]
|
||||
let chosen = choices[random(0, (choices.len - 1))]
|
||||
|
||||
// 結果のテキスト
|
||||
let result = \`今日のあなたの運勢は **{chosen}** です。\`
|
||||
|
|
@ -109,7 +109,7 @@ Ui:render([
|
|||
])
|
||||
`;
|
||||
|
||||
const PRESET_SHUFFLE = `/// @ 0.16.0
|
||||
const PRESET_SHUFFLE = `/// @ 0.18.0
|
||||
// 巻き戻し可能な文字シャッフルのプリセット
|
||||
|
||||
let string = "ペペロンチーノ"
|
||||
|
|
@ -123,13 +123,13 @@ var cursor = 0
|
|||
|
||||
@do() {
|
||||
if (cursor != 0) {
|
||||
results = results.slice(0 (cursor + 1))
|
||||
results = results.slice(0, (cursor + 1))
|
||||
cursor = 0
|
||||
}
|
||||
|
||||
let chars = []
|
||||
for (let i, length) {
|
||||
let r = Math:rnd(0 (length - 1))
|
||||
let r = Math:rnd(0, (length - 1))
|
||||
chars.push(string.pick(r))
|
||||
}
|
||||
let result = chars.join("")
|
||||
|
|
@ -163,11 +163,11 @@ var cursor = 0
|
|||
text: "←"
|
||||
disabled: !(results.len > 1 && (results.len - cursor) > 1)
|
||||
onClick: back
|
||||
} {
|
||||
}, {
|
||||
text: "→"
|
||||
disabled: !(results.len > 1 && cursor > 0)
|
||||
onClick: forward
|
||||
} {
|
||||
}, {
|
||||
text: "引き直す"
|
||||
onClick: do
|
||||
}]
|
||||
|
|
@ -188,27 +188,27 @@ var cursor = 0
|
|||
do()
|
||||
`;
|
||||
|
||||
const PRESET_QUIZ = `/// @ 0.16.0
|
||||
const PRESET_QUIZ = `/// @ 0.18.0
|
||||
let title = '地理クイズ'
|
||||
|
||||
let qas = [{
|
||||
q: 'オーストラリアの首都は?'
|
||||
choices: ['シドニー' 'キャンベラ' 'メルボルン']
|
||||
choices: ['シドニー', 'キャンベラ', 'メルボルン']
|
||||
a: 'キャンベラ'
|
||||
aDescription: '最大の都市はシドニーですが首都はキャンベラです。'
|
||||
} {
|
||||
}, {
|
||||
q: '国土面積2番目の国は?'
|
||||
choices: ['カナダ' 'アメリカ' '中国']
|
||||
choices: ['カナダ', 'アメリカ', '中国']
|
||||
a: 'カナダ'
|
||||
aDescription: '大きい順にロシア、カナダ、アメリカ、中国です。'
|
||||
} {
|
||||
}, {
|
||||
q: '二重内陸国ではないのは?'
|
||||
choices: ['リヒテンシュタイン' 'ウズベキスタン' 'レソト']
|
||||
choices: ['リヒテンシュタイン', 'ウズベキスタン', 'レソト']
|
||||
a: 'レソト'
|
||||
aDescription: 'レソトは(一重)内陸国です。'
|
||||
} {
|
||||
}, {
|
||||
q: '閘門がない運河は?'
|
||||
choices: ['キール運河' 'スエズ運河' 'パナマ運河']
|
||||
choices: ['キール運河', 'スエズ運河', 'パナマ運河']
|
||||
a: 'スエズ運河'
|
||||
aDescription: 'スエズ運河は高低差がないので閘門はありません。'
|
||||
}]
|
||||
|
|
@ -244,9 +244,9 @@ each (let qa, qas) {
|
|||
})
|
||||
Ui:C:container({
|
||||
children: []
|
||||
} \`{qa.id}:a\`)
|
||||
}, \`{qa.id}:a\`)
|
||||
]
|
||||
} qa.id))
|
||||
}, qa.id))
|
||||
}
|
||||
|
||||
@finish() {
|
||||
|
|
@ -296,12 +296,12 @@ qaEls.push(Ui:C:container({
|
|||
onClick: finish
|
||||
})
|
||||
]
|
||||
} 'footer'))
|
||||
}, 'footer'))
|
||||
|
||||
Ui:render(qaEls)
|
||||
`;
|
||||
|
||||
const PRESET_TIMELINE = `/// @ 0.16.0
|
||||
const PRESET_TIMELINE = `/// @ 0.18.0
|
||||
// APIリクエストを行いローカルタイムラインを表示するプリセット
|
||||
|
||||
@fetch() {
|
||||
|
|
@ -315,7 +315,7 @@ const PRESET_TIMELINE = `/// @ 0.16.0
|
|||
])
|
||||
|
||||
// タイムライン取得
|
||||
let notes = Mk:api("notes/local-timeline" {})
|
||||
let notes = Mk:api("notes/local-timeline", {})
|
||||
|
||||
// それぞれのノートごとにUI要素作成
|
||||
let noteEls = []
|
||||
|
|
|
|||
|
|
@ -15,11 +15,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkAsUi v-if="root" :component="root" :components="components"/>
|
||||
</div>
|
||||
<div class="actions _panel">
|
||||
<MkButton v-if="flash.isLiked" v-tooltip="i18n.ts.unlike" asLike class="button" rounded primary @click="unlike()"><i class="ti ti-heart"></i><span v-if="flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
|
||||
<MkButton v-else v-tooltip="i18n.ts.like" asLike class="button" rounded @click="like()"><i class="ti ti-heart"></i><span v-if="flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
|
||||
<MkButton v-tooltip="i18n.ts.shareWithNote" class="button" rounded @click="shareWithNote"><i class="ti ti-repeat ti-fw"></i></MkButton>
|
||||
<MkButton v-tooltip="i18n.ts.copyLink" class="button" rounded @click="copyLink"><i class="ti ti-link ti-fw"></i></MkButton>
|
||||
<MkButton v-if="isSupportShare()" v-tooltip="i18n.ts.share" class="button" rounded @click="share"><i class="ti ti-share ti-fw"></i></MkButton>
|
||||
<div class="items">
|
||||
<MkButton v-tooltip="i18n.ts.reload" class="button" rounded @click="reset"><i class="ti ti-reload"></i></MkButton>
|
||||
</div>
|
||||
<div class="items">
|
||||
<MkButton v-if="flash.isLiked" v-tooltip="i18n.ts.unlike" asLike class="button" rounded primary @click="unlike()"><i class="ti ti-heart"></i><span v-if="flash?.likedCount && flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
|
||||
<MkButton v-else v-tooltip="i18n.ts.like" asLike class="button" rounded @click="like()"><i class="ti ti-heart"></i><span v-if="flash?.likedCount && flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
|
||||
<MkButton v-tooltip="i18n.ts.copyLink" class="button" rounded @click="copyLink"><i class="ti ti-link ti-fw"></i></MkButton>
|
||||
<MkButton v-tooltip="i18n.ts.share" class="button" rounded @click="share"><i class="ti ti-share ti-fw"></i></MkButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else :class="$style.ready">
|
||||
|
|
@ -49,7 +53,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkA v-if="$i && $i.id === flash.userId" :to="`/play/${flash.id}/edit`" style="color: var(--accent);">{{ i18n.ts._play.editThisPage }}</MkA>
|
||||
<MkAd :prefer="['horizontal', 'horizontal-big']"/>
|
||||
</div>
|
||||
<MkError v-else-if="error" @retry="fetchPage()"/>
|
||||
<MkError v-else-if="error" @retry="fetchFlash()"/>
|
||||
<MkLoading v-else/>
|
||||
</Transition>
|
||||
</MkSpacer>
|
||||
|
|
@ -94,12 +98,33 @@ function fetchFlash() {
|
|||
});
|
||||
}
|
||||
|
||||
function share(ev: MouseEvent) {
|
||||
if (!flash.value) return;
|
||||
|
||||
os.popupMenu([
|
||||
{
|
||||
text: i18n.ts.shareWithNote,
|
||||
icon: 'ti ti-pencil',
|
||||
action: shareWithNote,
|
||||
},
|
||||
...(isSupportShare() ? [{
|
||||
text: i18n.ts.share,
|
||||
icon: 'ti ti-share',
|
||||
action: shareWithNavigator,
|
||||
}] : []),
|
||||
], ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
function copyLink() {
|
||||
if (!flash.value) return;
|
||||
|
||||
copyToClipboard(`${url}/play/${flash.value.id}`);
|
||||
os.success();
|
||||
}
|
||||
|
||||
function share() {
|
||||
function shareWithNavigator() {
|
||||
if (!flash.value) return;
|
||||
|
||||
navigator.share({
|
||||
title: flash.value.title,
|
||||
text: flash.value.summary,
|
||||
|
|
@ -108,21 +133,28 @@ function share() {
|
|||
}
|
||||
|
||||
function shareWithNote() {
|
||||
if (!flash.value) return;
|
||||
|
||||
os.post({
|
||||
initialText: `${flash.value.title} ${url}/play/${flash.value.id}`,
|
||||
initialText: `${flash.value.title}\n${url}/play/${flash.value.id}`,
|
||||
instant: true,
|
||||
});
|
||||
}
|
||||
|
||||
function like() {
|
||||
if (!flash.value) return;
|
||||
|
||||
os.apiWithDialog('flash/like', {
|
||||
flashId: flash.value.id,
|
||||
}).then(() => {
|
||||
flash.value.isLiked = true;
|
||||
flash.value.likedCount++;
|
||||
flash.value!.isLiked = true;
|
||||
flash.value!.likedCount++;
|
||||
});
|
||||
}
|
||||
|
||||
async function unlike() {
|
||||
if (!flash.value) return;
|
||||
|
||||
const confirm = await os.confirm({
|
||||
type: 'warning',
|
||||
text: i18n.ts.unlikeConfirm,
|
||||
|
|
@ -131,8 +163,8 @@ async function unlike() {
|
|||
os.apiWithDialog('flash/unlike', {
|
||||
flashId: flash.value.id,
|
||||
}).then(() => {
|
||||
flash.value.isLiked = false;
|
||||
flash.value.likedCount--;
|
||||
flash.value!.isLiked = false;
|
||||
flash.value!.likedCount--;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -152,6 +184,7 @@ function start() {
|
|||
|
||||
async function run() {
|
||||
if (aiscript.value) aiscript.value.abort();
|
||||
if (!flash.value) return;
|
||||
|
||||
aiscript.value = new Interpreter({
|
||||
...createAiScriptEnv({
|
||||
|
|
@ -193,12 +226,17 @@ async function run() {
|
|||
}
|
||||
}
|
||||
|
||||
onDeactivated(() => {
|
||||
function reset() {
|
||||
if (aiscript.value) aiscript.value.abort();
|
||||
started.value = false;
|
||||
}
|
||||
|
||||
onDeactivated(() => {
|
||||
reset();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (aiscript.value) aiscript.value.abort();
|
||||
reset();
|
||||
});
|
||||
|
||||
const headerActions = computed(() => []);
|
||||
|
|
@ -265,11 +303,19 @@ definePageMetadata(() => ({
|
|||
}
|
||||
|
||||
> .actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
margin-top: 16px;
|
||||
padding: 16px;
|
||||
|
||||
> .items {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
padding: 16px;
|
||||
border-bottom: 1px solid var(--divider);
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ import MkSwitch from '@/components/MkSwitch.vue';
|
|||
import { deepClone } from '@/scripts/clone.js';
|
||||
import { useInterval } from '@/scripts/use-interval.js';
|
||||
import { signinRequired } from '@/account.js';
|
||||
import { url } from '@/config.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { userPage } from '@/filters/user.js';
|
||||
|
|
@ -442,7 +443,7 @@ function autoplay() {
|
|||
|
||||
function share() {
|
||||
os.post({
|
||||
initialText: `#MisskeyReversi ${location.href}`,
|
||||
initialText: `#MisskeyReversi\n${url}/reversi/g/${game.value.id}`,
|
||||
instant: true,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue