From 43e5ec3bdd20f05f0198b633ea437a3635911f93 Mon Sep 17 00:00:00 2001 From: 667 <667@june07.com> Date: Thu, 19 Jan 2017 12:25:27 -0800 Subject: [PATCH] Version 0.9.3 --- LICENSE | 2 +- background.js | 17 ++++++++++++++++- manifest.json | 13 +++++++++++-- package.json | 2 +- popup.js | 10 +++++++++- 5 files changed, 38 insertions(+), 6 deletions(-) diff --git a/LICENSE b/LICENSE index 25a9202..23ef929 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 Continuation Labs +Copyright (c) 2016-2017 June07 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/background.js b/background.js index 0fe60ec..b973366 100644 --- a/background.js +++ b/background.js @@ -125,7 +125,11 @@ ngApp responseType: "json" }) .then(function openDevToolsFrontend(json) { - var url = json.data[0].devtoolsFrontendUrl.replace("127.0.0.1:9229", host + ":" + port).replace("localhost:9229", host + ":" + port); + var url = json.data[0].devtoolsFrontendUrl + .replace("127.0.0.1:9229", host + ":" + port) + .replace("localhost:9229", host + ":" + port) + .replace("127.0.0.1:" + port, host + ":" + port) // In the event that remote debugging is being used and the infoUrl port (by default 80) is not forwarded. + .replace("localhost:" + port, host + ":" + port) // A check for just the port change must be made. if ($scope.settings.localDevTools) url = url.replace('https://chrome-devtools-frontend.appspot.com', 'chrome-devtools://devtools/remote'); var websocketId = json.data[0].id; @@ -250,4 +254,15 @@ ngApp if (devToolsSession.id === tabId) return true; }), 1); }); + chrome.commands.onCommand.addListener(function(command) { + switch (command) { + case "open-devtools": + $scope.save("host"); + $scope.save("port"); + $scope.openTab($scope.settings.host, $scope.settings.port, function (result) { + $scope.message += '
' + result + '.'; + }); + $window._gaq.push(['_trackEvent', 'User Event', 'OpenDevTools', 'Keyboard Shortcut Used', '', true]); break; + } + }); }]); diff --git a/manifest.json b/manifest.json index 17b5cc5..ed34099 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "__MSG_appName__", "short_name": "__MSG_appShortName__", - "version": "0.9.2", + "version": "0.9.3", "default_locale": "en", "description": "__MSG_appDescription__", "author": "June07 <667@june07.com> (http://june07.com/)", @@ -32,5 +32,14 @@ "background": { "page": "background.html" }, - "content_security_policy": "script-src 'self' https://www.google-analytics.com https://ssl.google-analytics.com; object-src 'self' https://www.google-analytics.com https://ssl.google-analytics.com;" + "content_security_policy": "script-src 'self' https://www.google-analytics.com https://ssl.google-analytics.com; object-src 'self' https://www.google-analytics.com https://ssl.google-analytics.com;", + "commands": { + "open-devtools": { + "suggested_key": { + "default": "Ctrl+I", + "mac": "Command+I" + }, + "description": "Open the DevTools Window" + } + } } diff --git a/package.json b/package.json index 39817f9..81c7bc0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NIM", - "version": "0.9.2", + "version": "0.9.3", "description": "Monitor the integrated Node V8 inspector and auto open Chrome DevTools", "main": "nim.js", "dependencies": { diff --git a/popup.js b/popup.js index 7151c07..e2650ef 100644 --- a/popup.js +++ b/popup.js @@ -42,7 +42,6 @@ ngApp $scope.track = function (url) { $window._gaq.push(['_trackPageview', url]); }; - function trackInputClick(e) { $window._gaq.push(['_trackEvent', e.target.id, 'clicked']); } @@ -51,7 +50,16 @@ ngApp function trackInputClickListener(event) { trackInputClick(event); } + function keypressHandler(event) { + if (event.keyCode === 13) { + event.preventDefault(); + $scope.clickHandler(); + $window._gaq.push(['_trackEvent', 'User Event', 'OpenDevTools', 'Enter Key Pressed', '', true]); + } + } for (var i = 0; i < userInputs.length; i++) { userInputs[i].addEventListener('click', trackInputClickListener); + if (userInputs[i].id === "port" || userInputs[i].id === "hostname") + userInputs[i].addEventListener('keypress', keypressHandler); } }]);