删除一些无用的代码

This commit is contained in:
xu_yanfeng 2025-01-08 18:44:26 +08:00
parent fdcb8ae1fb
commit 1907e59ba1
56 changed files with 2 additions and 14455 deletions

2
.gitignore vendored
View File

@ -9,3 +9,5 @@ cc-inspector/yalc.lock
cc-inspector/chrome/ cc-inspector/chrome/
cc-inspector/dist/ cc-inspector/dist/
cc-inspector/yarn-error.log cc-inspector/yarn-error.log
cc-inspector/chrome.zip
cc-inspector/chrome.crx

View File

@ -1,8 +0,0 @@
# 翻版
在该版本中对项目结构进行了梳理,更加容易理解,同样适用webpack进行了自动编译操作
具体使用方式,在`CocosCreatorInspector`目录执行
- 个人开发过程中使用的node版本为:`11.6.0`,建议使用该node版本
- 安装依赖: `npm i`
- 编译插件: `npm run build-new`, 此时插件会生成到`src/build/`目录下
- 打开chrome插件开发者模式,加载`src/build`目录即可

View File

@ -1,53 +0,0 @@
## 注入脚本收集的数据结构
节点树数据结构
```json
{
"scene": {
"type":"1",// 类型
"uuid": "scene-uuid",
"name": "scene-name",
"children": [
{
"uuid": "node-uuid",
"name": "node-name",
"type": "cc_Node",
"x": 960.48,
"y": 540,
"zIndex": 0,
"width": 1920.96,
"height": 1080,
"active": true,
"color": "#ffffff",
"opacity": 255,
"rotation": 0,
"rotationX": 0,
"rotationY": 0,
"anchorX": 0.5,
"anchorY": 0.5,
"scaleX": 1,
"scaleY": 1,
"skewX": 0,
"skewY": 0,
"childrenCount": 5,
"children": []
},
{
"uuid":"..."
}
]
}
}
```
缓存游戏真实的内存结构,window.inspectorGameMemoryStorage
```json
{
"node-uuid":"node-memory"
}
```
在遍历节点树的同时,会存储游戏实际的内存数据到inspectorGameMemoryStorage
## 获取某个节点信息
```
window.getNodeInfo
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
cc-inspector/doc/scene1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

BIN
cc-inspector/doc/scene2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

View File

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

23
source/.gitignore vendored
View File

@ -1,23 +0,0 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@ -1,58 +0,0 @@
{
"name": "cc-inspector",
"version": "2.0.3",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build-dev": "vue-cli-service build --mode dev --watch",
"build-prod": "vue-cli-service build -mode prod",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"element-ui": "^2.15.1",
"fs-extra": "^9.1.0",
"less": "^4.1.1",
"less-loader": "^7.3.0",
"universal-analytics": "^0.4.23",
"vue": "^2.6.11",
"vue-class-component": "^7.2.3",
"vue-property-decorator": "^9.1.2"
},
"devDependencies": {
"babel-eslint": "^10.1.0",
"@types/fs-extra": "^9.0.9",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-typescript": "^7.0.0",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^6.2.2",
"lint-staged": "^9.5.0",
"prettier": "^2.2.1",
"typescript": "~4.1.5",
"vue-cli-plugin-browser-extension": "latest",
"vue-template-compiler": "^2.6.11"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
],
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,vue,ts,tsx}": [
"vue-cli-service lint",
"git add"
]
}
}

View File

@ -1,45 +0,0 @@
const Fs = require("fs");
const Path = require("path");
const FsExtra = require("fs-extra");
class ChromeManifest {
constructor(options) {
this.options = options;
}
apply(compiler) {
compiler.plugin("done", function (compilation, callback) {
const {manifest} = this.options;
if (manifest) {
if (Fs.existsSync(manifest)) {
// 生成manifest.json
let data = require(manifest);
let distPath = compilation.compilation.options.output.path;
let outFile = Path.join(distPath, "manifest.json");
Fs.writeFileSync(outFile, JSON.stringify(data, null, 4));
console.log(`生成manifest文件: ${outFile}`);
// 复制图片
const manifestDir = Path.dirname(manifest);
if (data.icons) {
for (let key in data.icons) {
let icon = data.icons[key];
let iconPath = Path.join(manifestDir, icon);
if (Fs.existsSync(iconPath)) {
FsExtra.copySync(iconPath, Path.join(distPath, icon), {overwrite: true});
console.log(`copy res: ${icon}`);
}
}
}
} else {
console.error(`manifest文件不存在${manifest}`);
}
} else {
console.log("缺少插件的manifest信息");
}
}.bind(this));
}
}
module.exports = ChromeManifest;

View File

@ -1,31 +0,0 @@
const Fs = require("fs");
const Path = require("path");
const FsExtra = require("fs-extra");
class Copy {
constructor(options) {
this.options = options;
}
apply(compiler) {
compiler.plugin("done", (compilation, callback) => {
const cfg = this.options;
if (cfg && cfg.length > 0) {
cfg.forEach(({src, dest}) => {
let fullSrc = Path.join(compilation.compilation.options.context, src);
if (Fs.existsSync(fullSrc)) {
let distPath = compilation.compilation.options.output.path;
let outFile = Path.join(distPath, dest);
FsExtra.ensureFileSync(outFile);
FsExtra.copyFileSync(fullSrc, outFile);
} else {
console.error(`manifest文件不存在${src}`);
}
});
}
});
}
}
module.exports = Copy;

View File

@ -1,63 +0,0 @@
{
"manifest_version": 2,
"version": "2.0.1",
"name": "Cocos Creator Inspector",
"description": "Cocos Creator Inspector",
"permissions": [
"activeTab",
"<all_urls>",
"*://*/*",
"tabs",
"http://*/*",
"https://*/*",
"audio",
"system.cpu",
"clipboardRead",
"clipboardWrite",
"system.memory",
"processes",
"tabs",
"storage",
"nativeMessaging",
"contextMenus",
"notifications"
],
"icons": {
"48": "icons/48.png"
},
"devtools_page": "devtools.html",
"background": {
"scripts": [
"js/background.js"
],
"persistent": false
},
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": [
"js/content.js"
],
"run_at": "document_end",
"all_frames": true
}
],
"options_ui": {
"page": "options.html",
"browser_style": true
},
"browser_action": {
"default_popup": "popup.html",
"default_title": "CC-Inspector",
"default_icon": {
"48": "icons/48.png"
}
},
"web_accessible_resources": [
"*/*",
"*"
],
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
}

View File

@ -1,61 +0,0 @@
const Copy = require("./plugins/copy");
const Path = require("path");
const TerserPlugin = require("terser-webpack-plugin");
console.log("***env: ", process.env.NODE_ENV);
let configureWebpack = {};
switch (process.env.NODE_ENV) {
case "development": {
configureWebpack = {
mode: "development",
devtool: "#source-map",
};
break;
}
case "production": {
configureWebpack = {
mode: "production",
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
drop_console: true, // 移除console
}
}
})
]
}
};
break;
}
}
module.exports = {
publicPath: "/",
outputDir: "dist",
pages: {
popup: "src/popup/index.ts",
options: "src/options/index.ts",
devtools: "src/devtools/index.ts",
},
pluginOptions: {
browserExtension: {
components: {
background: true,
contentScripts: true,
},
componentOptions: {
contentScripts: {
entries: {
content: "src/content.ts",
inject: "src/inject/index.ts",
},
},
background: {
entry: "src/background.ts",
}
}
}
},
configureWebpack,
};

View File

@ -1,18 +0,0 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-runtime"],
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["istanbul"]
}
}
}

View File

@ -1,5 +0,0 @@
core/*.js
core/**/*.js
build/*.js
src/**/*.*

View File

@ -1,32 +0,0 @@
// https://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
globals: {
"chrome": true
// chrome: true
},
env: {
browser: true,
},
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
extends: 'standard',
// required to lint *.vue files
plugins: [
'html'
],
// add your custom rules here
rules: {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'indent': ['error', 'tab'],
}
}

12
template/.gitignore vendored
View File

@ -1,12 +0,0 @@
# IDE
.vscode
# dependencies
node_modules
# logs
npm-debug.log
yarn.lock
# Backpack build
build

View File

@ -1,8 +0,0 @@
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
"plugins": {
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}

View File

@ -1,24 +0,0 @@
### 特别注意:
项目使用的node版本为8.+,否则会遇到这个问题:
https://github.com/YuraDev/vue-chrome-extension-template/issues/19
我使用的是8.4.0
## 怎么切换node版本
切换完版本之后,记得删除node_modules目录,从新`npm i`
`mac`
> 安装`n`扩展包: sudo npm i n -g
![](../docs/about/7f59e923.png)
> 安装指定版本node: sudo n 8.4.0
![](../docs/about/6db62665.png)
> 切换版本: sudo n
![](../docs/about/bc372062.png)
> 验证node版本: node -v
![](../docs/about/098511ee.png)
`win`
- 补充...

View File

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><%= htmlWebpackPlugin.options.title %></title>
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' rel="stylesheet" type="text/css">
</head>
<body>
<div id="root"></div>
</body>
</html>

View File

@ -1,60 +0,0 @@
const path = require('path')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
exports.htmlPage = (title, filename, chunks, template) => new HtmlWebpackPlugin({
title,
hash: true,
cache: true,
inject: 'body',
filename: './pages/' + filename + '.html',
template: template || path.resolve(__dirname, './page.ejs'),
appMountId: 'app',
chunks
})
exports.cssLoaders = (options = {}) => {
let loaders = {}
let prePprocessors = {
css: {},
postcss: {},
less: { loader: 'less'},
sass: { loader:'sass', options: { indentedSyntax: true } },
scss: { loader:'sass' },
stylus: { loader: 'stylus' },
styl: { loader: 'stylus' }
}
for(let key in prePprocessors) {
let loader = [{
loader: 'css-loader',
options: {
minimize: process.env.NODE_ENV === 'production'
}
}]
if (prePprocessors[key].loader) {
loader.push({
loader: prePprocessors[key].loader + '-loader',
options: Object.assign({}, prePprocessors[key].options, { sourceMap: options.sourceMap })
})
}
if (options.extract) {
loaders[key] = ExtractTextPlugin.extract({ use: loader, fallback: 'vue-style-loader' })
} else {
loaders[key] = ['vue-style-loader'].concat(loader)
}
}
return loaders;
}
exports.styleLoaders = function (options) {
const output = []
const loaders = exports.cssLoaders(options)
for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
})
}
return output
}

View File

@ -1,107 +0,0 @@
const path = require('path')
const webpack = require('webpack')
const ChromeReloadPlugin = require('wcer')
const {cssLoaders, htmlPage} = require('./tools')
const CopyWebpackPlugin = require('copy-webpack-plugin')
let resolve = dir => path.join(__dirname, '..', 'src', dir)
module.exports = {
entry: {
tab: resolve('./tab'),
popup: resolve('./popup'),
options: resolve('./options'),
content: resolve('./content'),
devtools: resolve('./devtools'),
background: resolve('./backend'),
panel: resolve('./devtools/panel'),
inject: resolve('./content/inject'),
},
output: {
path: path.join(__dirname, '..', 'build'),
publicPath: '/',
filename: 'js/[name].js',
chunkFilename: 'js/[id].[name].js?[hash]',
library: '[name]'
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src')
}
},
module: {
rules: [
{
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [path.join(__dirname, '..', 'src'), path.join(__dirname, '..', 'test')],
options: {
formatter: require('eslint-friendly-formatter')
}
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
extractCSS: true,
loaders: {
...cssLoaders(),
js: { loader: 'babel-loader' }
},
transformToRequire: {
video: 'src',
source: 'src',
img: 'src',
image: 'xlink:href'
}
}
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [path.join(__dirname, '..', 'src'), path.join(__dirname, '..', 'test')],
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: 'img/[name].[hash:7].[ext]'
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: 'media/[name].[hash:7].[ext]'
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: 'fonts/[name].[hash:7].[ext]'
}
}
]
},
plugins: [
htmlPage('home', 'tap', ['tab']),
htmlPage('popup', 'popup', ['popup']),
htmlPage('panel', 'panel', ['panel']),
htmlPage('devtools', 'devtools', ['devtools']),
htmlPage('options', 'options', ['options']),
htmlPage('background', 'background', ['background']),
new CopyWebpackPlugin([{ from: path.join(__dirname, '..', 'static') }]),
new ChromeReloadPlugin({
port: 9090,
manifest: path.join(__dirname, '..', 'src', 'manifest.js')
}),
],
performance: { hints: false },
}

View File

@ -1,108 +0,0 @@
const path = require('path')
const webpack = require('webpack')
const CleanWebpackPlugin = require("clean-webpack-plugin")
const {cssLoaders, htmlPage} = require('./tools')
const CopyWebpackPlugin = require('copy-webpack-plugin')
let resolve = dir => path.join(__dirname, '..', 'src', dir)
module.exports = {
entry: {
tab: resolve('./tab'),
popup: resolve('./popup'),
options: resolve('./options'),
content: resolve('./content'),
devtools: resolve('./devtools'),
background: resolve('./backend'),
panel: resolve('./devtools/panel'),
inject: resolve('./content/inject'),
},
output: {
path: path.join(__dirname, '..', 'build'),
publicPath: '/',
filename: 'js/[name].js',
chunkFilename: 'js/[id].[name].js?[hash]',
library: '[name]'
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src')
}
},
module: {
rules: [
{
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [path.join(__dirname, '..', 'src'), path.join(__dirname, '..', 'test')],
options: {
formatter: require('eslint-friendly-formatter')
}
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
extractCSS: true,
loaders: {
...cssLoaders(),
js: { loader: 'babel-loader' }
},
transformToRequire: {
video: 'src',
source: 'src',
img: 'src',
image: 'xlink:href'
}
}
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [path.join(__dirname, '..', 'src'), path.join(__dirname, '..', 'test')],
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: 'img/[name].[hash:7].[ext]'
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: 'media/[name].[hash:7].[ext]'
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: 'fonts/[name].[hash:7].[ext]'
}
}
]
},
plugins: [
new CleanWebpackPlugin(['../build/*.*']),
htmlPage('home', 'tap', ['tab']),
htmlPage('popup', 'popup', ['popup']),
htmlPage('panel', 'panel', ['panel']),
htmlPage('devtools', 'devtools', ['devtools']),
htmlPage('options', 'options', ['options']),
htmlPage('background', 'background', ['background']),
new CopyWebpackPlugin([{ from: path.join(__dirname, '..', 'static') }]),
],
devServer: {
contentBase: "./build",
},
performance: { hints: false },
}

View File

@ -1,21 +0,0 @@
const webpack = require('webpack')
const merge = require('webpack-merge')
const baseWebpack = require('./webpack.base')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const {styleLoaders} = require('./tools')
module.exports = merge(baseWebpack, {
// cheap-module-eval-source-map быстрее для разработки
watch: true,
module: {
rules: styleLoaders({ sourceMap: false })
},
devtool: '#cheap-module-eval-source-map',
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"development"'
}),
new FriendlyErrorsPlugin()
]
})

View File

@ -1,47 +0,0 @@
const fs = require('fs')
const path = require('path')
const webpack = require('webpack')
const merge = require('webpack-merge')
const baseWebpack = require('./webpack.base')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const {styleLoaders} = require('./tools')
module.exports = merge(baseWebpack, {
devtool: '#cheap-module-eval-source-map',
module: {
rules: styleLoaders({ extract: true, sourceMap: true })
},
plugins: [
new CleanWebpackPlugin(['build/*.*']),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new OptimizeCSSPlugin({
cssProcessorOptions: {
safe: true
}
}),
new ExtractTextPlugin({
filename: 'css/[name].[contenthash].css'
}),
new webpack.HashedModuleIdsPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: function (module) {
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 0
)
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
chunks: ['vendor']
})
]
})

13295
template/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,71 +0,0 @@
{
"name": "vue-chrome-extension-template",
"version": "0.0.1",
"description": "vue.js chrome extension template (wcer)",
"author": "works.yura@gmail.com",
"license": "MIT",
"private": false,
"dependencies": {
"axios": "^0.17.0",
"element-ui": "^2.0.1",
"lodash": "^4.17.4",
"vue": "^2.5.2",
"vue-meta": "^1.2.0",
"vue-pouch": "^0.0.22",
"vue-router": "^3.0.1",
"vuex": "^3.0.0"
},
"scripts": {
"lint": "eslint --ext .js,.vue src",
"dev": "webpack --config ./core/webpack.dev.js --hide-modules",
"dev-info": "webpack --config ./core/webpack.dev.js",
"build": "webpack --config ./core/webpack.prod.js -p --progress --hide-modules --colors",
"webpack": "webpack --config ./core/webpack.config.js --watch"
},
"devDependencies": {
"archiver": "^2.1.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.1",
"babel-loader": "^7.1.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-2": "^6.24.1",
"babel-register": "^6.26.0",
"buble": "^0.16.0",
"buble-loader": "^0.4.1",
"clean-webpack-plugin": "^0.1.19",
"copy-webpack-plugin": "^4.2.0",
"cross-env": "^5.1.0",
"css-loader": "^0.28.7",
"enhanced-resolve": "^3.4.1",
"eslint": "^4.9.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.9.0",
"eslint-plugin-html": "^3.2.2",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue-libs": "^1.2.1",
"extract-text-webpack-plugin": "^3.0.1",
"file-loader": "^1.1.5",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"node-sass": "^4.5.3",
"nodemon": "^1.12.1",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"pug": "^2.0.0-rc.4",
"pug-loader": "^2.3.0",
"sass-loader": "^6.0.6",
"url-loader": "^0.6.2",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.3",
"vue-template-compiler": "^2.5.2",
"wcer": "^1.0.2",
"webpack": "^3.8.1",
"webpack-dev-server": "^2.9.3",
"webpack-merge": "^4.1.0",
"ws": "^3.2.0"
}
}

View File

@ -1,4 +0,0 @@
chrome.runtime.onMessage.addEventListener(function (req, sender, callback) {
callback("hi ,i am background!")
})
console.log("background inited!");

View File

@ -1,4 +0,0 @@
console.log('content-script!')
// chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
// })
chrome.runtime.sendMessage({msg: "content msg"})

View File

@ -1,9 +0,0 @@
var content = chrome.extension.getURL('js/content.js')
var script = document.createElement('script')
script.setAttribute('type', 'text/javascript')
script.setAttribute('src', content)
script.onload = function () {
// 注入脚本执行完后移除掉
this.parentNode.removeChild(this);
}
document.body.appendChild(script)

View File

@ -1,12 +0,0 @@
chrome.devtools.panels.create('cc-inspector', 'img/logo.png', 'pages/panel.html', function (panel) {
panel.onShown.addListener(function (window) {
console.log("panel show");
});
panel.onHidden.addListener(function (window) {
console.log("panel hide");
});
panel.onSearch.addListener(function (action, query) {
console.log("panel search!");
return false;
});
})

View File

@ -1,12 +0,0 @@
import Vue from 'vue'
import root from './root.vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#root',
render: h => h(root)
})

View File

@ -1,38 +0,0 @@
<template lang="html">
<div>
<span>{{tips}}</span>
<el-button size="mini" @click="onClickTest"> 检测</el-button>
</div>
</template>
<script>
export default {
data: () => ({
tips: "",
}),
computed: {},
created() {
},
mounted() {
},
methods: {
onClickTest() {
this.tips = "";
console.log("onClickTest")
let views = chrome.extension.getViews({type: 'popup'});
if (views.length > 0) {
this.tips = "找到popup";
console.log(views[0].location.href);
} else {
this.tips = "未找到popup";
}
}
}
}
</script>
<style lang="scss">
div {
color: blue
}
</style>

View File

@ -1,22 +0,0 @@
export default {
get (key) {
try {
return JSON.parse(localStorage.getItem(key))
} catch (e) {}
},
set (key, val) {
try {
localStorage.setItem(key, JSON.stringify(val))
} catch (e) {}
},
remove (key) {
try {
localStorage.removeItem(key)
} catch (e) {}
},
clear () {
try {
localStorage.clear()
} catch (e) {}
}
}

View File

@ -1,47 +0,0 @@
module.exports = {
name: 'CC-Inspector',
version: '1.0.0',
description: 'cocos creator inspector',
author: 'xu_yanfeng',
manifest_version: 2,
icons: {'16': 'icons/16.png', '128': 'icons/128.png'},
// 权限申请
permissions: [
'<all_urls>',
'*://*/*',
'activeTab',
'tabs',// 标签
'cookies',
'background',
'contextMenus',// 右键菜单
'unlimitedStorage',
'storage',// 本地存储
'notifications',// 通知
'identity',
'identity.email',
"http://*/*",
"https://*/*",
"*://*/*",
"system.cpu",
"nativeMessaging"
],
browser_action: {
default_title: 'title',
default_popup: 'pages/popup.html'
},
background: {
persistent: false,
page: 'pages/background.html'
},
devtools_page: 'pages/devtools.html',
options_page: 'pages/options.html',
// 需要直接注入页面的js
content_scripts: [{
js: ['js/inject.js'],
run_at: 'document_end',// 代码注入时间: "document_start", "document_end", or "document_idle"
matches: ['<all_urls>'],// 匹配所有地址
all_frames: true
}],
content_security_policy: "script-src 'self' 'unsafe-eval'; object-src 'self' allow-modals ",
web_accessible_resources: ['panel.html', 'js/content.js']
}

View File

@ -1,12 +0,0 @@
import Vue from 'vue'
import root from './root.vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#root',
render: h => h(root)
})

View File

@ -1,19 +0,0 @@
<template lang="pug">
div options
</template>
<script>
export default {
data: () => ({}),
computed: {},
created() {
},
mounted() {
},
methods: {}
}
</script>
<style>
div {
color: blue
}
</style>

View File

@ -1,12 +0,0 @@
import Vue from 'vue'
import root from './root.vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)
Vue.config.productionTip = true
/* eslint-disable no-new */
new Vue({
el: '#root',
render: h => h(root)
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -1,69 +0,0 @@
<template>
<div>
<div style="display: flex;flex-direction: row;align-items: center;">
<h3>{{title}}</h3>
<div style="flex: 1"></div>
<el-button size="mini" @click="tab">设置</el-button>
<el-button size="mini" @click="onMsgToBg">To-Bg</el-button>
</div>
<div style="text-align: center;width: 100%; color: #6d6d6d;">
<span>支持作者</span>
</div>
<br/>
<div style="margin:0 auto;width:100%;">
<div style="width: 200px; margin: 0 auto;" v-show="isShowMoneyPng">
<img style="width: 100%;height: auto;" src="./popup/money.jpg">
</div>
</div>
<br/>
<div id="foot" style="height: 30px;">
<span style="font-size: 14px;float: left;text-align: center;line-height: 30px;color: #6d6d6d;">联系方式:</span>
<div style="height: 100%;float: right;margin-right: 10px;">
<a href="https://github.com/tidys/CocosCreatorPlugins/tree/master/CocosCreatorInspector"
target="_blank">
<img src="./popup/github.png" style="height: 100%;">
</a>
</div>
<div style="height: 100%;float: right;margin-right: 10px;">
<a href="https://jq.qq.com/?_wv=1027&k=5SdPdy2" target="_blank">
<img src="./popup/qq.png" style="height: 100%;">
</a>
</div>
<div style="height: 100%;float: right;margin-right: 10px;">
<a href="http://forum.cocos.com/t/chrome-creator/55669" target="_blank">
<img src="./popup/tiezi.png" style="height: 100%;">
</a>
</div>
</div>
</div>
</template>
<script>
export default {
data: () => ({
title: "cc-inspector",
isShowMoneyPng: true,
}),
computed: {},
created() {
},
mounted() {
},
methods: {
tab() {
chrome.tabs.create({url: 'pages/tap.html'})
},
onMsgToBg(){
debugger
let bg = chrome.extension.getBackgroundPage();
if(bg){
bg.test();
}
}
}
}
</script>
<style lang="scss">
div {
color: blue
}
</style>

View File

@ -1,12 +0,0 @@
import Vue from 'vue'
import root from './root.vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#root',
render: h => h(root)
})

View File

@ -1,22 +0,0 @@
<template>
<div>
<span>选项</span>
<el-button size="mini">222</el-button>
</div>
</template>
<script>
export default {
data: () => ({}),
computed: {},
created() {
},
mounted() {
},
methods: {}
}
</script>
<style lang="scss">
div {
color: blue
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB