+
+
+
+
+
+
+
+
Suppressed Errors:
-
-
-
Suppressed Errors:
-
- -
-
-
+
-
+
+
{{message}}
-
-
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
- No. |
- Module |
- Message |
- Type |
- Suppress |
-
-
-
-
- {{$index+1}} |
- {{message.module}} |
- {{message.message || message}} |
- {{message.type.split(' ')[0]}} |
- |
-
-
-
-
-
There are no messages in this category.
-
+
+
+
+ No. |
+ Module |
+ Message |
+ Type |
+ Suppress |
+
+
+
+
+ {{$index + 1}} |
+ {{message.module}} |
+ {{message.message || message}} |
+ {{ message.type.split(' ')[0] }} |
+ |
+
+
+
+
+
There are no messages in this category.
-
+
+
+
+
+
+
+
+
+
+
diff --git a/hint.js b/hint.js
index bcfb35f..760071e 100644
--- a/hint.js
+++ b/hint.js
@@ -6,6 +6,6 @@ var customEvent = document.createEvent('Event');
customEvent.initEvent('myCustomEvent', true, true);
angular.hint.onMessage = function (moduleName, message, messageType) {
- eventProxyElement.innerText = moduleName+'##'+message+'##'+messageType;
+ eventProxyElement.innerText = moduleName + '##' + message + '##' + messageType;
eventProxyElement.dispatchEvent(customEvent);
};
diff --git a/hintApp.js b/hintApp.js
index 85cc419..ce6c5bc 100644
--- a/hintApp.js
+++ b/hintApp.js
@@ -1 +1,134 @@
-angular.module('ngHintUI',[]);
+angular.module('ngHintUI', []).
+
+controller('HintController', ['$scope', 'hintService',
+ function($scope, hintService) {
+
+ //Set the hint service to perform this action when the page is refreshed
+ hintService.onRefresh(function() {
+ $scope.messageData = {
+ 'All' : {
+ 'Error Messages': [],
+ 'Warning Messages': [],
+ 'Suggestion Messages': [],
+ 'All Messages': []
+ }
+ };
+ });
+
+ //Set the hint service to perform this action whenever
+ //a new hint message is received.
+ hintService.onHint(function(msg) {
+ //If there is no scope data, initialize a new data object
+ $scope.messageData = $scope.messageData || {
+ 'All' : {
+ 'Error Messages': [],
+ 'Warning Messages': [],
+ 'Suggestion Messages': [],
+ 'All Messages': []
+ }
+ };
+
+ // Split the hint message into useful information
+ var result = msg.split('##'),
+ modName = result[0],
+ message = result[1],
+ messageType = result[2];
+
+ //If there are no messages for this module, make new arrays for this module's messages
+ if(!$scope.messageData[modName]) {
+ $scope.messageData[modName] = {
+ 'Error Messages': [],
+ 'Warning Messages': [],
+ 'Suggestion Messages': [],
+ 'All Messages': []
+ };
+ }
+
+ $scope.messageData['All']['All Messages'].push({
+ message: message,
+ type: messageType,
+ module: modName
+ });
+
+ if(!$scope.messageData['All'][messageType]) {
+ $scope.messageData['All'][messageType] = [];
+ }
+ $scope.messageData['All'][messageType].push(message);
+ $scope.messageData[modName]['All Messages'].push({message: message, type: messageType});
+ $scope.messageData[modName][messageType].push(message);
+ });
+
+ $scope.suppressedMessages = {};
+ $scope.suppressedMessagesLength = 0;
+
+ $scope.labels = ['All Messages', 'Error Messages', 'Warning Messages', 'Suggestion Messages'];
+
+ $scope.setModule = function(module) {
+ $scope.module = module;
+ };
+
+ $scope.setType = function(type) {
+ $scope.type = type;
+ };
+
+ $scope.setModule('All');
+ $scope.setType('All Messages');
+
+ $scope.isSuppressed = function(message) {
+ message = message.split(' ').slice(6,9).join('');
+ return message in $scope.suppressedMessages;
+ };
+
+ $scope.suppressMessage = function(message) {
+ $scope.suppressedMessagesLength++;
+
+ var key = message.split(' ').slice(6,9).join('');
+ var secondSpace = message.indexOf(' ', message.indexOf(' '));
+ var endInd = 60;
+ while(message.charAt(endInd) !== ' ') {
+ endInd++;
+ if(endInd > 75) {
+ break;
+ }
+ }
+ $scope.suppressedMessages[key] = '...' + message.substr(secondSpace+1,endInd) + '...';
+ };
+
+ $scope.unsuppressMessage = function(messageKey) {
+ $scope.suppressedMessagesLength--;
+
+ delete $scope.suppressedMessages[messageKey];
+ };
+
+}]).
+
+service('hintService', ['$rootScope', function($rootScope) {
+ var onHintCallback,
+ onRefreshCallback;
+
+ this.onHint = function(cb) {
+ onHintCallback = cb;
+ };
+
+ this.onRefresh = function(cb) {
+ onRefreshCallback = cb;
+ };
+
+ var port = chrome.extension.connect();
+ port.postMessage(chrome.devtools.inspectedWindow.tabId);
+ port.onMessage.addListener(function(msg) {
+ $rootScope.$apply(function () {
+ if (msg === 'refresh') {
+ onRefreshCallback();
+ } else {
+ onHintCallback(msg);
+ }
+ });
+ });
+
+ port.onDisconnect.addListener(function (a) {
+ console.log(a);
+ });
+
+}]);
+
diff --git a/hintCtrl.js b/hintCtrl.js
deleted file mode 100644
index d0151de..0000000
--- a/hintCtrl.js
+++ /dev/null
@@ -1,90 +0,0 @@
-angular.module('ngHintUI')
- .controller('HintController', ['$scope', 'hintService',
- function($scope, hintService) {
-
- //Set the hint service to perform this action when the page is refreshed
- hintService.setRefreshFunction(function() {
- $scope.messageData = {
- 'All' : {
- 'Error Messages': [],
- 'Warning Messages': [],
- 'Suggestion Messages': [],
- 'All Messages': []
- }
- };
- });
-
- //Set the hint service to perform this action whenever
- //a new hint message is received.
- hintService.setHintFunction(function(msg) {
- //If there is no scope data, initialize a new data object
- $scope.messageData = $scope.messageData || {
- 'All' : {
- 'Error Messages': [],
- 'Warning Messages': [],
- 'Suggestion Messages': [],
- 'All Messages': []
- }
- };
-
- //Split the hint message into useful information
- var result = msg.split('##'),
- modName = result[0],
- message = result[1],
- messageType = result[2];
-
- //If there are no messages for this module, make new arrays for this module's messages
- if(!$scope.messageData[modName]) {
- $scope.messageData[modName] = {
- 'Error Messages': [],
- 'Warning Messages': [],
- 'Suggestion Messages': [],
- 'All Messages': []
- };
- }
-
- $scope.messageData['All']['All Messages'].push({message: message, type: messageType, module: modName});
- $scope.messageData['All'][messageType].push(message);
- $scope.messageData[modName]['All Messages'].push({message: message, type: messageType});
- $scope.messageData[modName][messageType].push(message);
- $scope.$apply();
- });
-
- $scope.module, $scope.type, $scope.suppressedMessages = {}, $scope.suppressedMessagesLength = 0;
- $scope.labels = ['All Messages', 'Error Messages', 'Warning Messages', 'Suggestion Messages'];
-
- $scope.setModule = function(module) {
- $scope.module = module;
- };
-
- $scope.setType = function(type) {
- $scope.type = type;
- };
-
- $scope.setModule('All');
- $scope.setType('All Messages');
-
- $scope.isSuppressed = function(message) {
- message = message.split(' ').slice(6,9).join('');
- return message in $scope.suppressedMessages;
- };
-
- $scope.suppressMessage = function(message) {
- $scope.suppressedMessagesLength++;
- var key = message.split(' ').slice(6,9).join('');
- var secondSpace = message.indexOf(' ', message.indexOf(' '));
- var endInd = 60;
- while(message.charAt(endInd) !== ' ') {
- endInd++;
- if(endInd > 75) {
- break;
- }
- }
- $scope.suppressedMessages[key] = '...'+message.substring(secondSpace+1,endInd)+'...';
- };
-
- $scope.unsuppressMessage = function(messageKey) {
- $scope.suppressedMessagesLength--;
- delete $scope.suppressedMessages[messageKey];
- }
- }]);
diff --git a/hintService.js b/hintService.js
deleted file mode 100644
index c02a352..0000000
--- a/hintService.js
+++ /dev/null
@@ -1,30 +0,0 @@
-angular.module('ngHintUI').
- service('hintService', function() {
- var onHintFunction, onRefreshFunction;
-
- this.setHintFunction = function(hintFunction) {
- onHintFunction = hintFunction;
- }
-
- this.getHintFunction = function() {
- return onHintFunction;
- }
-
- this.setRefreshFunction = function(refreshFunction) {
- onRefreshFunction = refreshFunction;
- }
-
- this.getRefreshFunction = function() {
- return onRefreshFunction;
- }
-
- var port = chrome.extension.connect();
- port.postMessage(chrome.devtools.inspectedWindow.tabId);
- port.onMessage.addListener(function(msg) {
- msg == 'refresh' ? onRefreshFunction() : onHintFunction(msg);
- });
-
- port.onDisconnect.addListener(function (a) {
- console.log(a);
- });
-});
\ No newline at end of file