enhance(client): RSSティッカーで表示順序をシャッフルできるように
This commit is contained in:
@@ -26,6 +26,7 @@ import { GetFormResultType } from '@/scripts/form';
|
||||
import * as os from '@/os';
|
||||
import MkContainer from '@/components/ui/container.vue';
|
||||
import { useInterval } from '@/scripts/use-interval';
|
||||
import { shuffle } from '@/scripts/shuffle';
|
||||
|
||||
const name = 'rssTicker';
|
||||
|
||||
@@ -34,6 +35,10 @@ const widgetPropsDef = {
|
||||
type: 'string' as const,
|
||||
default: 'http://feeds.afpbb.com/rss/afpbb/afpbbnews',
|
||||
},
|
||||
shuffle: {
|
||||
type: 'boolean' as const,
|
||||
default: true,
|
||||
},
|
||||
refreshIntervalSec: {
|
||||
type: 'number' as const,
|
||||
default: 60,
|
||||
@@ -80,6 +85,9 @@ let key = $ref(0);
|
||||
const tick = () => {
|
||||
fetch(`/api/fetch-rss?url=${widgetProps.url}`, {}).then(res => {
|
||||
res.json().then(feed => {
|
||||
if (widgetProps.shuffle) {
|
||||
shuffle(feed.items);
|
||||
}
|
||||
items.value = feed.items;
|
||||
fetching.value = false;
|
||||
key++;
|
||||
|
Reference in New Issue
Block a user