mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
Update src/main.js
This commit is contained in:
parent
76b5494523
commit
a1b58a2ff0
1 changed files with 0 additions and 54 deletions
54
src/main.js
54
src/main.js
|
@ -1,57 +1,4 @@
|
|||
import { createApp } from "vue";
|
||||
|
||||
import router from "@/router/router.js";
|
||||
import App from "./App.vue";
|
||||
|
||||
import TimeAgo from "javascript-time-ago";
|
||||
|
||||
import en from "javascript-time-ago/locale/en";
|
||||
|
||||
TimeAgo.addDefaultLocale(en);
|
||||
|
||||
import { createI18n } from "vue-i18n";
|
||||
import enLocale from "@/locales/en.json";
|
||||
import "@unocss/reset/tailwind.css";
|
||||
import "uno.css";
|
||||
|
||||
const timeAgo = new TimeAgo("en-US");
|
||||
|
||||
import("./registerServiceWorker");
|
||||
|
||||
const mixin = {
|
||||
methods: {
|
||||
timeFormat: function (duration) {
|
||||
var pad = function (num, size) {
|
||||
return ("000" + num).slice(size * -1);
|
||||
};
|
||||
|
||||
var time = parseFloat(duration).toFixed(3),
|
||||
hours = Math.floor(time / 60 / 60),
|
||||
minutes = Math.floor(time / 60) % 60,
|
||||
seconds = Math.floor(time - minutes * 60);
|
||||
|
||||
var str = "";
|
||||
|
||||
if (hours > 0) str += hours + ":";
|
||||
|
||||
str += pad(minutes, 2) + ":" + pad(seconds, 2);
|
||||
|
||||
return str;
|
||||
},
|
||||
numberFormat(num) {
|
||||
var loc = `${this.getPreferenceString("hl")}-${this.getPreferenceString("region")}`;
|
||||
|
||||
try {
|
||||
Intl.getCanonicalLocales(loc);
|
||||
} catch {
|
||||
loc = undefined;
|
||||
}
|
||||
|
||||
const formatter = Intl.NumberFormat(loc, {
|
||||
notation: "compact",
|
||||
});
|
||||
return formatter.format(num);
|
||||
},
|
||||
addCommas(num) {
|
||||
num = parseInt(num);
|
||||
return num.toLocaleString("en-US");
|
||||
|
@ -531,5 +478,4 @@ window.i18n = i18n;
|
|||
const app = createApp(App);
|
||||
app.use(i18n);
|
||||
app.use(router);
|
||||
app.mixin(mixin);
|
||||
app.mount("#app");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue