Lint file.

This commit is contained in:
FireMasterK 2021-07-04 01:03:59 +05:30
parent 4a10d80804
commit 192c2b82bb
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD

View file

@ -1,9 +1,28 @@
import { createApp } from "vue"; import { createApp } from "vue";
import { library } from "@fortawesome/fontawesome-svg-core"; import { library } from "@fortawesome/fontawesome-svg-core";
import { faThumbsUp, faThumbsDown, faEye, faThumbtack, faCheck, faHeart, faHeadphones } from "@fortawesome/free-solid-svg-icons"; import {
faThumbsUp,
faThumbsDown,
faEye,
faThumbtack,
faCheck,
faHeart,
faHeadphones,
} from "@fortawesome/free-solid-svg-icons";
import { faGithub, faBitcoin, faYoutube } from "@fortawesome/free-brands-svg-icons"; import { faGithub, faBitcoin, faYoutube } from "@fortawesome/free-brands-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
library.add(faThumbsUp, faThumbsDown, faEye, faGithub, faBitcoin, faThumbtack, faCheck, faHeart, faHeadphones, faYoutube); library.add(
faThumbsUp,
faThumbsDown,
faEye,
faGithub,
faBitcoin,
faThumbtack,
faCheck,
faHeart,
faHeadphones,
faYoutube,
);
import("uikit/dist/css/uikit-core.css"); import("uikit/dist/css/uikit-core.css");
import("uikit/dist/js/uikit-core.min"); import("uikit/dist/js/uikit-core.min");
@ -11,7 +30,7 @@ import("uikit/dist/js/uikit-core.min");
import router from "@/router/router"; import router from "@/router/router";
import App from "./App.vue"; import App from "./App.vue";
import DOMPurify from 'dompurify'; import DOMPurify from "dompurify";
import("./registerServiceWorker"); import("./registerServiceWorker");
@ -39,9 +58,9 @@ const mixin = {
const digits = 2; const digits = 2;
const si = [ const si = [
{ value: 1, symbol: "" }, { value: 1, symbol: "" },
{ value: 1E3, symbol: "k" }, { value: 1e3, symbol: "k" },
{ value: 1E6, symbol: "M" }, { value: 1e6, symbol: "M" },
{ value: 1E9, symbol: "B" } { value: 1e9, symbol: "B" },
]; ];
const rx = /\.0+$|(\.[0-9]*[1-9])0+$/; const rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
for (var i = si.length - 1; i > 0; i--) { for (var i = si.length - 1; i > 0; i--) {
@ -52,14 +71,13 @@ const mixin = {
return (num / si[i].value).toFixed(digits).replace(rx, "$1") + si[i].symbol; return (num / si[i].value).toFixed(digits).replace(rx, "$1") + si[i].symbol;
}, },
addCommas(num) { addCommas(num) {
num = parseInt(num) num = parseInt(num);
return num.toLocaleString('en-US') return num.toLocaleString("en-US");
}, },
fetchJson: function(url, params, options) { fetchJson: function(url, params, options) {
if (params) { if (params) {
url = new URL(url); url = new URL(url);
for (var param in params) for (var param in params) url.searchParams.set(param, params[param]);
url.searchParams.set(param, params[param])
} }
return fetch(url, options).then(response => { return fetch(url, options).then(response => {
return response.json(); return response.json();
@ -69,11 +87,14 @@ const mixin = {
return DOMPurify.sanitize(original); return DOMPurify.sanitize(original);
}, },
setPreference(key, value) { setPreference(key, value) {
if (localStorage) localStorage.setItem(key, value) if (localStorage) localStorage.setItem(key, value);
}, },
getPreferenceBoolean(key, defaultVal) { getPreferenceBoolean(key, defaultVal) {
var value; var value;
if ((value = this.$route.query[key]) !== undefined || (localStorage && (value = localStorage.getItem(key)) !== null)) { if (
(value = this.$route.query[key]) !== undefined ||
(localStorage && (value = localStorage.getItem(key)) !== null)
) {
switch (String(value)) { switch (String(value)) {
case "true": case "true":
case "1": case "1":
@ -87,28 +108,31 @@ const mixin = {
}, },
getPreferenceString(key, defaultVal) { getPreferenceString(key, defaultVal) {
var value; var value;
if ((value = this.$route.query[key]) !== undefined || (localStorage && (value = localStorage.getItem(key)) !== null)) { if (
(value = this.$route.query[key]) !== undefined ||
(localStorage && (value = localStorage.getItem(key)) !== null)
) {
return value; return value;
} else return defaultVal; } else return defaultVal;
}, },
}, },
computed: { computed: {
backgroundColor() { backgroundColor() {
return this.getPreferenceString("theme", "dark") === "light" ? "#fff" : "#0b0e0f" return this.getPreferenceString("theme", "dark") === "light" ? "#fff" : "#0b0e0f";
}, },
secondaryBackgroundColor() { secondaryBackgroundColor() {
return this.getPreferenceString("theme", "dark") === "light" ? "#e5e5e5" : "#242727" return this.getPreferenceString("theme", "dark") === "light" ? "#e5e5e5" : "#242727";
}, },
foregroundColor() { foregroundColor() {
return this.getPreferenceString("theme", "dark") === "light" ? "#15191a" : "#0b0e0f" return this.getPreferenceString("theme", "dark") === "light" ? "#15191a" : "#0b0e0f";
}, },
secondaryForegroundColor() { secondaryForegroundColor() {
return this.getPreferenceString("theme", "dark") === "light" ? "#666" : "#393d3d" return this.getPreferenceString("theme", "dark") === "light" ? "#666" : "#393d3d";
}, },
darkMode() { darkMode() {
return this.getPreferenceString("theme", "dark") !== 'light' return this.getPreferenceString("theme", "dark") !== "light";
} },
} },
}; };
const app = createApp(App); const app = createApp(App);