aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-17 00:19:48 -0800
committerJose Antonio Marquez2012-02-17 00:19:48 -0800
commit66af1dd3e5aa80b257ba711600d112752ecaf655 (patch)
treed7c0799adce17ba2ad2e956e956ef1ad11a85ceb /js
parente404c691b84ca8fd1ab17fc6187bccb3f94258fb (diff)
downloadninja-66af1dd3e5aa80b257ba711600d112752ecaf655.tar.gz
Adding Chrome webRequest intercept
Need to add logic to resolve file's actual URL dynamically.
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/document-controller.js25
-rwxr-xr-xjs/document/html-document.js6
2 files changed, 29 insertions, 2 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 /*
75if (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");;