diff --git a/inject.js b/inject.js index e953365..6a98559 100644 --- a/inject.js +++ b/inject.js @@ -904,7 +904,7 @@ function injectfunc(e, window) { var toggle = true if (e["config-hook-alt-w"]) { - document.onkeydown = function(event){ + document.onkeydown = e.logtogglefunc = function(event){ if (event.key == 'w' && event.altKey){ toggle = !toggle e["config-hook-domobj"] = toggle @@ -1317,6 +1317,9 @@ chrome.extension.onMessage.addListener(function(msg, sender, sendResponse) { inject_script(`console.error(${JSON.stringify(msg.action.info)})`) } if (msg.action.type == 'addlistener'){ - inject_script(`v_log_env()`) + inject_script(`try{v_log_env()}catch(e){debugger;alert('请打开调试总开关,同时将dom挂钩全部选中后,再刷新页面点击代码生成按钮。')}`) + } + if (msg.action.type == 'logtoggle'){ + inject_script(`globalConfig.logtogglefunc({key:'w',altKey:true})`) } }); \ No newline at end of file diff --git a/manifest.json b/manifest.json index 8b41397..d87be2f 100644 --- a/manifest.json +++ b/manifest.json @@ -44,6 +44,7 @@ "page": "background.html", "persistent": true }, + "devtools_page": "devtools.html", "content_scripts": [ { "matches": [ "file:///*", "http://*/*", "https://*/*" ], diff --git a/popup.html b/popup.html index f83fd3d..38e9791 100644 --- a/popup.html +++ b/popup.html @@ -87,6 +87,32 @@ opacity: 1; right: 0; } + + .button2 { + display: inline-block; + padding: 10px; + font-size: 15px; + cursor: pointer; + text-align: center; + text-decoration: none; + outline: none; + width: 160px; + transition: all 0.5s; + margin: 5px; + color: #fff; + background-color: #f4511e; + border: none; + border-radius: 4px; + box-shadow: 0 3px #999; + } + + .button2:hover {background-color: #b62f04} + + .button2:active { + background-color: #3e8e41; + box-shadow: 0 5px #666; + transform: translateY(4px); + } @@ -97,7 +123,8 @@