diff options
author | Jose Antonio Marquez | 2012-02-17 00:19:48 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-17 00:19:48 -0800 |
commit | 66af1dd3e5aa80b257ba711600d112752ecaf655 (patch) | |
tree | d7c0799adce17ba2ad2e956e956ef1ad11a85ceb | |
parent | e404c691b84ca8fd1ab17fc6187bccb3f94258fb (diff) | |
download | ninja-66af1dd3e5aa80b257ba711600d112752ecaf655.tar.gz |
Adding Chrome webRequest intercept
Need to add logic to resolve file's actual URL dynamically.
-rwxr-xr-x | js/controllers/document-controller.js | 25 | ||||
-rwxr-xr-x | js/document/html-document.js | 6 | ||||
-rw-r--r-- | manifest.json | 4 |
3 files changed, 32 insertions, 3 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index b1a22c1b..9785d824 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -56,12 +56,37 @@ DocumentController = exports.DocumentController = Montage.create(Component, { | |||
56 | this.eventManager.addEventListener("executeSave", this, false); | 56 | this.eventManager.addEventListener("executeSave", this, false); |
57 | 57 | ||
58 | this.eventManager.addEventListener("recordStyleChanged", this, false); | 58 | this.eventManager.addEventListener("recordStyleChanged", this, false); |
59 | |||
60 | |||
61 | |||
59 | } | 62 | } |
60 | }, | 63 | }, |
64 | |||
65 | |||
66 | handleWebRequest: { | ||
67 | value: function (request) { | ||
68 | if (request.url.indexOf('js/document/templates/montage-html') !== -1) { | ||
69 | |||
70 | console.log(request); | ||
71 | |||
72 | //TODO: Figure out why active document is not available here | ||
73 | |||
74 | /* | ||
75 | if (request.url.indexOf('calculator.css') !== -1) { | ||
76 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+'/calculator/components/calculator.reel/calculator.css'}; | ||
77 | } | ||
78 | */ | ||
79 | } | ||
80 | } | ||
81 | }, | ||
82 | |||
61 | 83 | ||
62 | handleAppLoaded: { | 84 | handleAppLoaded: { |
63 | value: function() { | 85 | value: function() { |
64 | // | 86 | // |
87 | |||
88 | chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: ["<all_urls>"]}, ["blocking"]); | ||
89 | |||
65 | } | 90 | } |
66 | }, | 91 | }, |
67 | 92 | ||
diff --git a/js/document/html-document.js b/js/document/html-document.js index a5483f40..16595d14 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -355,13 +355,15 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
355 | }, | 355 | }, |
356 | 356 | ||
357 | 357 | ||
358 | |||
359 | |||
360 | |||
358 | 361 | ||
359 | //////////////////////////////////////////////////////////////////// | 362 | //////////////////////////////////////////////////////////////////// |
360 | // | 363 | // |
361 | handleEvent: { | 364 | handleEvent: { |
362 | value: function(event){ | 365 | value: function(event){ |
363 | //console.log('end'); | 366 | |
364 | //console.log('file content start'); | ||
365 | //TODO: Clean up, using for prototyping save | 367 | //TODO: Clean up, using for prototyping save |
366 | this._templateDocument = {}; | 368 | this._templateDocument = {}; |
367 | this._templateDocument.head = this.iframe.contentWindow.document.getElementById("userHead");; | 369 | this._templateDocument.head = this.iframe.contentWindow.document.getElementById("userHead");; |
diff --git a/manifest.json b/manifest.json index 12a5d8b7..2754c71e 100644 --- a/manifest.json +++ b/manifest.json | |||
@@ -12,7 +12,9 @@ | |||
12 | }, | 12 | }, |
13 | "permissions": [ | 13 | "permissions": [ |
14 | "unlimitedStorage", | 14 | "unlimitedStorage", |
15 | "notifications" | 15 | "notifications", |
16 | "webRequestBlocking", | ||
17 | "webRequest" | ||
16 | ], | 18 | ], |
17 | "requirements": { | 19 | "requirements": { |
18 | "3D": { | 20 | "3D": { |