Skip to content

Commit

Permalink
refactor: 图标加载速度优化
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Dec 7, 2021
1 parent 70399b3 commit 5a74b19
Show file tree
Hide file tree
Showing 20 changed files with 198 additions and 140 deletions.
2 changes: 1 addition & 1 deletion build/scriptcat/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "ScriptCat",
"version": "0.7.4",
"version": "0.7.5",
"description": "脚本猫,一个用户脚本的框架,可编写脚本每天帮你自动处理事务.",
"background": {
"page": "background.html"
Expand Down
17 changes: 2 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "scriptcat",
"version": "0.7.4",
"version": "0.7.5",
"description": "脚本猫,一个可以执行用户脚本的浏览器扩展,万物皆可脚本化,让你的浏览器可以做更多的事情!",
"scripts": {
"test": "jest",
Expand Down Expand Up @@ -43,7 +43,6 @@
"@babel/preset-env": "^7.13.10",
"@babel/preset-typescript": "^7.13.0",
"@babel/register": "^7.13.8",
"@mdi/font": "^5.9.55",
"@mdi/js": "^5.9.55",
"@types/adm-zip": "^0.4.34",
"@types/chrome": "0.0.127",
Expand Down
1 change: 0 additions & 1 deletion public/confirm.html
Expand Up @@ -8,7 +8,6 @@
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
</head>

<body>
Expand Down
1 change: 0 additions & 1 deletion public/import.html
Expand Up @@ -8,7 +8,6 @@
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
</head>

<body>
Expand Down
1 change: 0 additions & 1 deletion public/install.html
Expand Up @@ -8,7 +8,6 @@
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
</head>

<body>
Expand Down
52 changes: 25 additions & 27 deletions public/options.html
@@ -1,30 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<link
href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css"
rel="stylesheet"
/>
</head>

<body>
<div id="app"></div>
<iframe src="sandbox.html" name="sandbox" sandbox="allow-scripts" style="display: none;"></iframe>
</body>
<style>
html,
body {
margin: 0;
padding: 0;
border: 0;
height: 100%;
overflow: hidden;
}
</style>
</html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
</head>

<body>
<div id="app"></div>
<iframe src="sandbox.html" name="sandbox" sandbox="allow-scripts" style="display: none;"></iframe>
</body>
<style>
html,
body {
margin: 0;
padding: 0;
border: 0;
height: 100%;
overflow: hidden;
}
</style>

</html>
58 changes: 28 additions & 30 deletions public/popup.html
@@ -1,33 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<link
href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css"
rel="stylesheet"
/>
</head>

<body>
<div id="app"></div>
</body>
<style>
html,
body {
margin: 0;
padding: 0;
border: 0;
width: 450px;
/* height: 500px; */
min-height: 150px;
max-height: 500px;
/* overflow-y: auto; */
/* overflow: hidden; */
}
</style>
</html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
</head>

<body>
<div id="app"></div>
</body>
<style>
html,
body {
margin: 0;
padding: 0;
border: 0;
width: 450px;
/* height: 500px; */
min-height: 150px;
max-height: 500px;
/* overflow-y: auto; */
/* overflow: hidden; */
}
</style>

</html>
2 changes: 1 addition & 1 deletion src/apps/config.ts
@@ -1,4 +1,4 @@
export const ExtVersion = "0.7.4";
export const ExtVersion = "0.7.5";

export const Server = process.env.NODE_ENV == "production" ? "https://sc.icodef.com/" : "http://localhost:8080/";

Expand Down
1 change: 0 additions & 1 deletion src/popup.ts
Expand Up @@ -2,7 +2,6 @@ import "reflect-metadata";
import Vue from "vue";

import "vuetify/dist/vuetify.min.css";

import App from "@App/views/pages/Popup/index.vue";
import { migrate } from "./model/migrate";
import { i18n, vuetify } from "../i18n/i18n";
Expand Down
9 changes: 7 additions & 2 deletions src/views/components/BgCloud.vue
@@ -1,7 +1,9 @@
<template>
<v-dialog transition="dialog-bottom-transition" max-width="600">
<template v-slot:activator="{ on, attrs }">
<v-icon small v-bind="attrs" v-on="on"> mdi-cloud-upload </v-icon>
<v-icon small v-bind="attrs" v-on="on"
>{{ icons.mdiCloudUpload }}
</v-icon>
</template>
<template v-slot:default="dialog">
<v-card>
Expand All @@ -10,7 +12,7 @@
<v-spacer></v-spacer>
<v-toolbar-items>
<v-btn icon dark @click="dialog.value = false" right>
<v-icon>mdi-close</v-icon>
<v-icon>{{ icons.mdiClose }}</v-icon>
</v-btn>
</v-toolbar-items>
</v-toolbar>
Expand Down Expand Up @@ -77,9 +79,12 @@ import { ExportModel } from "@App/model/export";
import { Value } from "@App/model/do/value";
import { Export, EXPORT_DEST_LOCAL } from "@App/model/do/export";
import { v4 as uuidv4 } from "uuid";
import { mdiCloudUpload, mdiClose } from "@mdi/js";
import { ExtVersion } from "@App/apps/config";
@Component({})
export default class BgCloud extends Vue {
icons = { mdiCloudUpload, mdiClose };
@Prop()
script!: Script;
exportConfig: Export = {
Expand Down
5 changes: 4 additions & 1 deletion src/views/components/Tab/CloseButton.vue
@@ -1,13 +1,16 @@
<template>
<v-icon @click.stop="onClick" small>mdi-close</v-icon>
<v-icon @click.stop="onClick" small>{{ icons.mdiClose }}</v-icon>
</template>

<script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
import TabPane from "./TabPane";
import { mdiClose } from "@mdi/js";
@Component({})
export default class CloseButton extends Vue {
icons = { mdiClose };
@Prop() tab!: TabPane;
@Prop() index!: number;
Expand Down
10 changes: 8 additions & 2 deletions src/views/components/UserMenu.vue
Expand Up @@ -3,7 +3,9 @@
<template v-slot:activator="{ on }">
<v-btn icon x-large v-on="on">
<v-avatar dark size="36">
<v-icon dark v-if="!user.avatar"> mdi-account-circle </v-icon>
<v-icon dark v-if="!user.avatar">
{{ icons.mdiAccountCircle }}
</v-icon>
<img v-else :src="server + user.avatar" :alt="user.username" />
</v-avatar>
</v-btn>
Expand All @@ -12,7 +14,9 @@
<v-list-item-content class="justify-center">
<div class="mx-auto text-center">
<v-avatar color="#1296db" dark>
<v-icon dark v-if="!user.avatar"> mdi-account-circle </v-icon>
<v-icon dark v-if="!user.avatar">{{
icons.mdiAccountCircle
}}</v-icon>
<img v-else :src="server + user.avatar" :alt="user.username" />
</v-avatar>
<h3 style="margin-top: 10px">{{ user.username }}</h3>
Expand All @@ -37,9 +41,11 @@ import { Server } from "@App/apps/config";
import { Vue, Component, Watch } from "vue-property-decorator";
import { userModule } from "@App/views/pages/Option/store/user";
import { UserController } from "@App/apps/user/controller";
import { mdiAccountCircle } from "@mdi/js";
@Component({})
export default class Snackbar extends Vue {
icons = { mdiAccountCircle };
user = userModule.userinfo;
server = Server.substring(0, Server.length - 1);
Expand Down
2 changes: 1 addition & 1 deletion src/views/pages/Option/index.tsx
Expand Up @@ -48,7 +48,7 @@ export default class App extends Vue {

// return {
// tabKey,
// icon: <VIcon dense>mdi-plus</VIcon>,
// icon: <VIcon dense>mdiPlus</VIcon>,
// content: (
// <div
// style={{
Expand Down

0 comments on commit 5a74b19

Please sign in to comment.