调整
BIN
source/src/assets/logo.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
1
source/src/content.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
console.log('11')
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
@ -5,7 +5,7 @@ module.exports = {
|
|||||||
browser_action: {
|
browser_action: {
|
||||||
default_title: "CC-Inspector",
|
default_title: "CC-Inspector",
|
||||||
default_icon: "icon/icon48.png",
|
default_icon: "icon/icon48.png",
|
||||||
default_popup: "pages/popup.html"
|
default_popup: "popup.html"
|
||||||
},
|
},
|
||||||
icons: {
|
icons: {
|
||||||
48: "icon/icon48.png"
|
48: "icon/icon48.png"
|
||||||
@ -14,20 +14,20 @@ module.exports = {
|
|||||||
content_scripts: [
|
content_scripts: [
|
||||||
{
|
{
|
||||||
matches: ["<all_urls>"],
|
matches: ["<all_urls>"],
|
||||||
js: ["js/content.js"],
|
js: ["content.common.js"],
|
||||||
run_at: "document_end",
|
run_at: "document_end",
|
||||||
all_frames: true
|
all_frames: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
background: {
|
background: {
|
||||||
scripts: ["js/background.js"],
|
scripts: ["background.js"],
|
||||||
persistent: false,// 需要时开启
|
persistent: false,// 需要时开启
|
||||||
},
|
},
|
||||||
// optionsV1的写法
|
// optionsV1的写法
|
||||||
options_page: "pages/options.html",
|
options_page: "options.html",
|
||||||
// optionsV2的写法
|
// optionsV2的写法
|
||||||
options_ui: {
|
options_ui: {
|
||||||
page: "pages/options.html",
|
page: "options.html",
|
||||||
// 添加一些默认的样式,推荐使用
|
// 添加一些默认的样式,推荐使用
|
||||||
chrome_style: true,
|
chrome_style: true,
|
||||||
},
|
},
|
10
source/src/options/index.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import Vue from "vue";
|
||||||
|
import App from "./index.vue";
|
||||||
|
import "element-ui/lib/theme-chalk/index.css"
|
||||||
|
import ElementUI from "element-ui";
|
||||||
|
|
||||||
|
Vue.config.productionTip = false;
|
||||||
|
Vue.use(ElementUI, {size: "mini"});
|
||||||
|
new Vue({
|
||||||
|
render: (h) => h(App),
|
||||||
|
}).$mount("#app");
|
22
source/src/options/index.vue
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<template>
|
||||||
|
<el-button @click="onClickTest">1111</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import {Component, Vue} from "vue-property-decorator";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
components: {},
|
||||||
|
})
|
||||||
|
export default class Index extends Vue {
|
||||||
|
name: string = "index";
|
||||||
|
|
||||||
|
onClickTest() {
|
||||||
|
console.log(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
17
source/src/popup/HelloWorld.vue
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<div class="hello">
|
||||||
|
<h1>{{ msg }}</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import {Component, Prop, Vue} from "vue-property-decorator";
|
||||||
|
|
||||||
|
@Component
|
||||||
|
export default class HelloWorld extends Vue {
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
|
||||||
|
</style>
|
9
source/src/popup/index.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import Vue from "vue";
|
||||||
|
import App from "./index.vue";
|
||||||
|
import ElementUI from "element-ui";
|
||||||
|
|
||||||
|
Vue.config.productionTip = false;
|
||||||
|
Vue.use(ElementUI, {size: "mini"});
|
||||||
|
new Vue({
|
||||||
|
render: (h) => h(App),
|
||||||
|
}).$mount("#app");
|
@ -1,11 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="popup">
|
<div id="popup">
|
||||||
<div style="display: flex;flex-direction: row;align-items: center;">
|
<div style="display: flex;flex-direction: row;align-items: center;">
|
||||||
<h3 v-show="false"> title </h3>
|
<h3 v-show="false">title</h3>
|
||||||
<div style="flex: 1"></div>
|
<div style="flex: 1"></div>
|
||||||
<el-button size="mini" @click="onClickOptions">设置</el-button>
|
<el-button @click="onClickOptions">设置</el-button>
|
||||||
<el-button size="mini" @click="onMsgToBg">To-Bg</el-button>
|
<el-button @click="onMsgToBg">To-Bg</el-button>
|
||||||
<el-button size="mini" @click="onSendMsg">Msg</el-button>
|
<el-button @click="onSendMsg">Msg</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align: center;width: 100%; color: #6d6d6d;">
|
<div style="text-align: center;width: 100%; color: #6d6d6d;">
|
||||||
<span>支持作者</span>
|
<span>支持作者</span>
|
||||||
@ -21,40 +21,35 @@
|
|||||||
<span style="font-size: 14px;float: left;text-align: center;line-height: 30px;color: #6d6d6d;">联系方式:</span>
|
<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;">
|
<div style="height: 100%;float: right;margin-right: 10px;">
|
||||||
<a href="https://github.com/tidys/CocosCreatorPlugins/tree/master/CocosCreatorInspector" target="_blank">
|
<a href="https://github.com/tidys/CocosCreatorPlugins/tree/master/CocosCreatorInspector" target="_blank">
|
||||||
<img v-show="false" src="./res/github.png" style="height: 100%;">
|
<img src="./res/github.png" style="height: 100%;">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div style="height: 100%;float: right;margin-right: 10px;">
|
<div style="height: 100%;float: right;margin-right: 10px;">
|
||||||
<a href="https://jq.qq.com/?_wv=1027&k=5SdPdy2" target="_blank">
|
<a href="https://jq.qq.com/?_wv=1027&k=5SdPdy2" target="_blank">
|
||||||
<img v-show="false" src="./res/qq.png" style="height: 100%;">
|
<img src="./res/qq.png" style="height: 100%;">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div style="height: 100%;float: right;margin-right: 10px;">
|
<div style="height: 100%;float: right;margin-right: 10px;">
|
||||||
<a href="http://forum.cocos.com/t/chrome-creator/55669" target="_blank">
|
<a href="http://forum.cocos.com/t/chrome-creator/55669" target="_blank">
|
||||||
<img v-show="false" src="./res/tiezi.png" style="height: 100%;">
|
<img src="./res/tiezi.png" style="height: 100%;">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue'
|
import {Component, Vue} from "vue-property-decorator";
|
||||||
import 'vue-awesome/icons/flag'
|
import HelloWorld from "./HelloWorld.vue";
|
||||||
import 'vue-awesome/icons'
|
|
||||||
import Icon from 'vue-awesome/components/Icon'
|
|
||||||
import {Component} from 'vue-property-decorator'
|
|
||||||
import chrome from 'chrome'
|
|
||||||
import {Button} from 'element-ui'
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
Icon,
|
HelloWorld,
|
||||||
Button,
|
},
|
||||||
}
|
|
||||||
})
|
})
|
||||||
export default class Index extends Vue {
|
export default class App extends Vue {
|
||||||
longConn: chrome.runtime.Port = false
|
longConn: chrome.runtime.Port | null = null
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -72,20 +67,24 @@ export default class Index extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onClickOptions() {
|
onClickOptions() {
|
||||||
chrome.tabs.create({url: 'pages/options.html'})
|
if (chrome && chrome.tabs) {
|
||||||
|
chrome.tabs.create({url: "pages/options.html"})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_initLongConn() {
|
_initLongConn() {
|
||||||
if (!this.longConn) {
|
if (!this.longConn) {
|
||||||
console.log("[popup] 初始化长连接");
|
console.log("[popup] 初始化长连接");
|
||||||
|
if (chrome && chrome.runtime) {
|
||||||
this.longConn = chrome.runtime.connect({name: "popup"});
|
this.longConn = chrome.runtime.connect({name: "popup"});
|
||||||
this.longConn.onMessage.addListener(function (data, sender) {
|
this.longConn.onMessage.addListener((data: any, sender: any) => {
|
||||||
this._onLongConnMsg(data, sender);
|
this._onLongConnMsg(data, sender);
|
||||||
}.bind(this))
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_onLongConnMsg(data, sender) {
|
_onLongConnMsg(data: string, sender: any) {
|
||||||
// console.log(this.title);
|
// console.log(this.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,24 +93,25 @@ export default class Index extends Vue {
|
|||||||
// chrome.extension.getBackgroundPage();
|
// chrome.extension.getBackgroundPage();
|
||||||
|
|
||||||
// 发送消息到background.js
|
// 发送消息到background.js
|
||||||
chrome.runtime.sendMessage('content msg', function (data) {
|
if (chrome && chrome.runtime) {
|
||||||
|
chrome.runtime.sendMessage("content msg", function (data: any) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onSendMsg() {
|
onSendMsg() {
|
||||||
if (this.longConn) {
|
if (this.longConn) {
|
||||||
this.longConn.postMessage({send: "hello"});
|
this.longConn.postMessage({send: "hello"});
|
||||||
//@import "../index.less";
|
//@import "../index.less";
|
||||||
//#popup{
|
|
||||||
// width: auto;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
#popup {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 140 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
4
source/src/shims-chrome.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
declare module "*.chrome" {
|
||||||
|
import chrome from "chrome";
|
||||||
|
export default chrome;
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import Vue, { VNode } from 'vue';
|
import Vue, { VNode } from "vue";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
namespace JSX {
|
namespace JSX {
|
4
source/src/shims-vue.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
declare module "*.vue" {
|
||||||
|
import Vue from "vue";
|
||||||
|
export default Vue;
|
||||||
|
}
|
8
source/src/test/index.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import Vue from "vue";
|
||||||
|
import App from "./index.vue";
|
||||||
|
|
||||||
|
Vue.config.productionTip = false;
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
render: (h) => h(App),
|
||||||
|
}).$mount("#app");
|
19
source/src/test/index.vue
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<template>
|
||||||
|
<div id="app">test</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import {Component, Vue} from "vue-property-decorator";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
components: {},
|
||||||
|
})
|
||||||
|
export default class Index extends Vue {
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#app {
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|