提交 029866dc 编写于 作者: B baiy 提交者: ninecents

优化统计

上级 ca014ff7
{
"name": "chrome-tool",
"version": "0.0.4",
"version": "0.0.9",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......@@ -3636,8 +3636,7 @@
"decode-uri-component": {
"version": "0.2.0",
"resolved": "http://registry.npm.taobao.org/decode-uri-component/download/decode-uri-component-0.2.0.tgz",
"integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
"dev": true
"integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU="
},
"deep-equal": {
"version": "1.0.1",
......@@ -7329,6 +7328,19 @@
"prepend-http": "^2.0.0",
"query-string": "^5.0.1",
"sort-keys": "^2.0.0"
},
"dependencies": {
"query-string": {
"version": "5.1.1",
"resolved": "https://registry.npm.taobao.org/query-string/download/query-string-5.1.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fquery-string%2Fdownload%2Fquery-string-5.1.1.tgz",
"integrity": "sha1-p4wBK3HBfgXy4/ojGd0zBoLvs8s=",
"dev": true,
"requires": {
"decode-uri-component": "^0.2.0",
"object-assign": "^4.1.0",
"strict-uri-encode": "^1.0.0"
}
}
}
},
"schema-utils": {
......@@ -7341,6 +7353,12 @@
"ajv-errors": "^1.0.0",
"ajv-keywords": "^3.1.0"
}
},
"strict-uri-encode": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/strict-uri-encode/download/strict-uri-encode-1.1.0.tgz",
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
"dev": true
}
}
},
......@@ -9128,14 +9146,13 @@
"dev": true
},
"query-string": {
"version": "5.1.1",
"resolved": "https://registry.npm.taobao.org/query-string/download/query-string-5.1.1.tgz",
"integrity": "sha1-p4wBK3HBfgXy4/ojGd0zBoLvs8s=",
"dev": true,
"version": "6.6.0",
"resolved": "https://registry.npm.taobao.org/query-string/download/query-string-6.6.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fquery-string%2Fdownload%2Fquery-string-6.6.0.tgz",
"integrity": "sha1-prff1XrWfjRrFD0DPfKx5M+2tTo=",
"requires": {
"decode-uri-component": "^0.2.0",
"object-assign": "^4.1.0",
"strict-uri-encode": "^1.0.0"
"split-on-first": "^1.0.0",
"strict-uri-encode": "^2.0.0"
}
},
"querystring": {
......@@ -10210,6 +10227,11 @@
}
}
},
"split-on-first": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/split-on-first/download/split-on-first-1.1.0.tgz",
"integrity": "sha1-9hCv7uOxK84dDDBCXnY5i3gkml8="
},
"split-string": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/split-string/download/split-string-3.1.0.tgz",
......@@ -10336,10 +10358,9 @@
"dev": true
},
"strict-uri-encode": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/strict-uri-encode/download/strict-uri-encode-1.1.0.tgz",
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
"dev": true
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/strict-uri-encode/download/strict-uri-encode-2.0.0.tgz",
"integrity": "sha1-ucczDHBChi9rFC3CdLvMWGbONUY="
},
"string-width": {
"version": "2.1.1",
......
{
"name": "chrome-tool",
"version": "0.0.7",
"version": "0.0.9",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --port 8081",
......@@ -21,6 +21,7 @@
"phparr": "^0.2.0",
"qrcode": "^1.3.3",
"qrcode-parser": "^1.2.0",
"query-string": "^6.6.0",
"radix.js": "0.0.1",
"serialize-php": "^1.1.2",
"vue": "^2.6.10",
......
import {stringify as queryStringify} from "query-string"
export const trim = function (str, char, type) {
if (char) {
if (type === 'left') {
......@@ -22,3 +24,21 @@ export const openTab = function (url) {
}
chrome.tabs.create({url: url, selected: true});
};
export const stat = function (action, data = {}) {
try {
let img = new Image(1, 1);
img.src = 'https://www.baiy.org/chrome_tool/stat/?' + queryStringify(
Object.assign(
{
v: process['chromeTool']['version'],
a: action,
r: Math.random()
},
data
)
);
} catch (e) {
// todo
}
};
\ No newline at end of file
......@@ -12,5 +12,4 @@
</div>
<div id="clipboard"></div>
</body>
<script src="<%= htmlWebpackPlugin.options.stat %>"></script>
</html>
import Vue from 'vue'
import Router from 'vue-router'
import {trim} from "./helper";
import {trim,stat} from "./helper";
// 路由配置
const routes = [
......@@ -31,4 +32,10 @@ Vue.use(Router);
const router = new Router({routes});
stat('index');
router.afterEach(to => {
stat('tool',{tool:to.name})
});
export default router
\ No newline at end of file
......@@ -4,9 +4,16 @@ const config = {
index: {
entry: 'src/main.js',
template: 'src/index.html',
stat: "https://www.baiy.org/chrome_tool/stat.php?version=" + process.env.npm_package_version
},
}
},
chainWebpack: config => {
config.plugin('define').tap(args => {
args[0]['process.chromeTool'] = JSON.stringify({
version: process.env.npm_package_version,
});
return args
})
},
};
let fs = require('fs');
fs.readFile('./src/manifest.json', 'utf8', function (err, files) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册