diff options
Diffstat (limited to 'js/document/views/design.js')
-rwxr-xr-x | js/document/views/design.js | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/js/document/views/design.js b/js/document/views/design.js index b3887fdf..c7313708 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js | |||
@@ -69,6 +69,30 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
69 | }, | 69 | }, |
70 | //////////////////////////////////////////////////////////////////// | 70 | //////////////////////////////////////////////////////////////////// |
71 | // | 71 | // |
72 | _liveNodeList: { | ||
73 | value: null | ||
74 | }, | ||
75 | //////////////////////////////////////////////////////////////////// | ||
76 | // | ||
77 | getLiveNodeList: { | ||
78 | value: function(useFilter) { | ||
79 | if(useFilter) { | ||
80 | var filteredNodes = [], | ||
81 | childNodes = Array.prototype.slice.call(this._liveNodeList, 0); | ||
82 | |||
83 | childNodes.forEach(function(item) { | ||
84 | if( (item.nodeType === 1) && (item.nodeName !== "STYLE") && (item.nodeName !== "SCRIPT")) { | ||
85 | filteredNodes.push(item); | ||
86 | } | ||
87 | }); | ||
88 | return filteredNodes; | ||
89 | } else { | ||
90 | return Array.prototype.slice.call(this._liveNodeList, 0); | ||
91 | } | ||
92 | } | ||
93 | }, | ||
94 | //////////////////////////////////////////////////////////////////// | ||
95 | // | ||
72 | initialize: { | 96 | initialize: { |
73 | value: function (parent) { | 97 | value: function (parent) { |
74 | //Creating iFrame for view | 98 | //Creating iFrame for view |
@@ -87,7 +111,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
87 | render: { | 111 | render: { |
88 | value: function (callback, template) { | 112 | value: function (callback, template) { |
89 | //TODO: Remove, this is a temp patch for webRequest API gate | 113 | //TODO: Remove, this is a temp patch for webRequest API gate |
90 | this.application.ninja.documentController._hackRootFlag = false; | 114 | this.application.ninja.documentController.redirectRequests = false; |
91 | //Storing callback for dispatch ready | 115 | //Storing callback for dispatch ready |
92 | this._callback = callback; | 116 | this._callback = callback; |
93 | this._template = template; | 117 | this._template = template; |
@@ -105,7 +129,8 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
105 | // | 129 | // |
106 | onTemplateLoad: { | 130 | onTemplateLoad: { |
107 | value: function (e) { | 131 | value: function (e) { |
108 | this.application.ninja.documentController._hackRootFlag = true; | 132 | //console.log(this.iframe.contentWindow); |
133 | this.application.ninja.documentController.redirectRequests = true; | ||
109 | //TODO: Add support to constructing URL with a base HREF | 134 | //TODO: Add support to constructing URL with a base HREF |
110 | var basetag = this.content.document.getElementsByTagName('base'); | 135 | var basetag = this.content.document.getElementsByTagName('base'); |
111 | //Removing event | 136 | //Removing event |
@@ -189,9 +214,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
189 | this._bodyFragment = null; | 214 | this._bodyFragment = null; |
190 | //Calling standard method to finish opening document | 215 | //Calling standard method to finish opening document |
191 | this.bodyContentLoaded(null); | 216 | this.bodyContentLoaded(null); |
192 | //TODO: Move this to be set via the controller | ||
193 | this.application.ninja.stage.documentOffsetLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2); | ||
194 | this.application.ninja.stage.documentOffsetTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2); | ||
195 | } | 217 | } |
196 | }, | 218 | }, |
197 | //////////////////////////////////////////////////////////////////// | 219 | //////////////////////////////////////////////////////////////////// |
@@ -256,6 +278,16 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
256 | } else { | 278 | } else { |
257 | //Else there is not data to parse | 279 | //Else there is not data to parse |
258 | } | 280 | } |
281 | //TODO: Verify appropiate location for this operation | ||
282 | if (this._template && this._template.type === 'banner') { | ||
283 | this.model.documentRoot = this.document.body.getElementsByTagName('ninja-content')[0]; | ||
284 | } else { | ||
285 | this.model.documentRoot = this.document.body; | ||
286 | } | ||
287 | //Storing node list for reference (might need to store in the model) | ||
288 | this._liveNodeList = this.model.documentRoot.getElementsByTagName('*'); | ||
289 | //Initiliazing document model | ||
290 | document.application.njUtils.makeElementModel(this.model.documentRoot, "Body", "body"); | ||
259 | //Makign callback if specified | 291 | //Makign callback if specified |
260 | if (this._callback) this._callback(); | 292 | if (this._callback) this._callback(); |
261 | } | 293 | } |