add shuffle and repeat toggle
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import Vue from 'vue'
|
||||
import {
|
||||
BIcon,
|
||||
BIconArrowRepeat,
|
||||
BIconBoxArrowUpRight,
|
||||
BIconBroadcast,
|
||||
BIconCardText,
|
||||
@@ -17,6 +18,7 @@
|
||||
BIconList,
|
||||
BIconPlayFill,
|
||||
BIconPauseFill,
|
||||
BIconShuffle,
|
||||
BIconSkipStartFill,
|
||||
BIconSkipEndFill,
|
||||
BIconPlus,
|
||||
@@ -30,6 +32,7 @@
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
BIcon,
|
||||
BIconArrowRepeat,
|
||||
BIconBoxArrowUpRight,
|
||||
BIconBroadcast,
|
||||
BIconCardText,
|
||||
@@ -42,6 +45,7 @@
|
||||
BIconList,
|
||||
BIconPlayFill,
|
||||
BIconPauseFill,
|
||||
BIconShuffle,
|
||||
BIconSkipStartFill,
|
||||
BIconSkipEndFill,
|
||||
BIconPlus,
|
||||
|
||||
@@ -9,6 +9,14 @@ export function randomString(): string {
|
||||
return String.fromCharCode.apply(null, Array.from(arr))
|
||||
}
|
||||
|
||||
export function shuffle(a: any[]) {
|
||||
for (let i = a.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[a[i], a[j]] = [a[j], a[i]]
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
export function md5(str: string): string {
|
||||
return MD5.hash(str)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user