From 99ea8b52258e5064e246d91946b5ecfd29695e9a Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Mon, 4 Aug 2014 15:42:58 -0700 Subject: [PATCH] wip --- bower.json | 3 ++- hint.js | 24 +++++++++++++++++++++++- inject.js | 17 +++++++---------- manifest.json | 3 +++ 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/bower.json b/bower.json index f27cbab..93eabc2 100644 --- a/bower.json +++ b/bower.json @@ -3,7 +3,8 @@ "version": "0.5.0", "dependencies": { "angular": "~1.2.20", - "d3": "~3.2.6" + "d3": "~3.2.6", + "angular-loader": "~1.2.20" }, "devDependencies": { "angular-mocks": "~1.2.20" diff --git a/hint.js b/hint.js index bd1a571..d195ef1 100644 --- a/hint.js +++ b/hint.js @@ -1 +1,23 @@ -var hint = require('angular-hint'); + +require('./bower_components/angular-loader/angular-loader.js'); +require('angular-hint'); + +// afterThisGetsDefined(window, 'angular', function () { +// afterThisGetsDefined(angular, 'module', function () { +// require('angular-hint'); +// }); +// }); + +// function afterThisGetsDefined(obj, prop, fn) { +// Object.defineProperty(obj, prop, { +// set: function (val) { +// Object.defineProperty(obj, prop, { +// configurable: true, +// writable: true +// }); +// obj[prop] = val; +// fn(); +// }, +// configurable: true +// }); +// } diff --git a/inject.js b/inject.js index f00eb02..1230836 100644 --- a/inject.js +++ b/inject.js @@ -1,13 +1,10 @@ // inject into the application context from the content script context -var inject = function () { - var script = window.document.createElement('script'); - script.src = chrome.extension.getURL('hint.bundle.js'); - document.head.appendChild(script); -}; - -// only inject if cookie is set -if (document.cookie.indexOf('__ngDebug=true') != -1) { - document.addEventListener('DOMContentLoaded', inject); -} + +var script = window.document.createElement('script'); +script.src = chrome.extension.getURL('hint.bundle.js'); +var html = document.getElementsByTagName('html')[0]; +html.setAttribute('ng-hint', ''); + +html.appendChild(script); diff --git a/manifest.json b/manifest.json index be64c84..a90d1b9 100644 --- a/manifest.json +++ b/manifest.json @@ -15,5 +15,8 @@ "run_at": "document_start" } ], + "web_accessible_resources": [ + "hint.bundle.js" + ], "minimum_chrome_version": "21.0.1180.57" }