diff options
author | Jonathan Duran | 2012-06-26 08:13:49 -0700 |
---|---|---|
committer | Jonathan Duran | 2012-06-26 08:13:49 -0700 |
commit | 1bc2fb4441387877bc6b1aef78e4e466f526f60f (patch) | |
tree | eef16b66f6771862efac72aaeaa692c9e322c161 /js/document | |
parent | 616ade06c8f669d18c27d27c3ee46a9c844a54ca (diff) | |
parent | d2e88bb251efb29f13911942f1f91101715c727e (diff) | |
download | ninja-1bc2fb4441387877bc6b1aef78e4e466f526f60f.tar.gz |
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/helpers/url-parser.js | 2 | ||||
-rwxr-xr-x | js/document/mediators/template.js | 9 | ||||
-rwxr-xr-x | js/document/views/design.js | 7 |
3 files changed, 17 insertions, 1 deletions
diff --git a/js/document/helpers/url-parser.js b/js/document/helpers/url-parser.js index 5e71d148..7bded27d 100755 --- a/js/document/helpers/url-parser.js +++ b/js/document/helpers/url-parser.js | |||
@@ -53,7 +53,7 @@ exports.UrlParser = Montage.create(Component, { | |||
53 | //Getting file URI (not URL since we must load through I/O API) | 53 | //Getting file URI (not URL since we must load through I/O API) |
54 | var css = {}, file; | 54 | var css = {}, file; |
55 | css.cssUrl = href.split(this.application.ninja.coreIoApi.rootUrl)[1]; | 55 | css.cssUrl = href.split(this.application.ninja.coreIoApi.rootUrl)[1]; |
56 | css.fileUri = this.application.ninja.coreIoApi.cloudData.root + css.cssUrl; | 56 | css.fileUri = this.application.ninja.coreIoApi.cloudData.root + unescape(css.cssUrl); |
57 | //Loading data from CSS file | 57 | //Loading data from CSS file |
58 | file = this.application.ninja.coreIoApi.readFile({uri: css.fileUri}); | 58 | file = this.application.ninja.coreIoApi.readFile({uri: css.fileUri}); |
59 | //Checking for file to be writable on disk | 59 | //Checking for file to be writable on disk |
diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js index c5b46c3a..f43b1a2c 100755 --- a/js/document/mediators/template.js +++ b/js/document/mediators/template.js | |||
@@ -158,6 +158,15 @@ exports.TemplateDocumentMediator = Montage.create(Component, { | |||
158 | ninjaContentTagDoc.removeAttribute('style'); | 158 | ninjaContentTagDoc.removeAttribute('style'); |
159 | ninjaContentTagDoc.removeAttribute('data-ninja-style'); | 159 | ninjaContentTagDoc.removeAttribute('data-ninja-style'); |
160 | } | 160 | } |
161 | // TODO - clean up into single method | ||
162 | ninjaContentTagMem = template.document.getElementsByTagName('ninja-viewport')[0], ninjaContentTagDoc = template.file.content.document.getElementsByTagName('ninja-viewport')[0]; | ||
163 | if (ninjaContentTagMem && ninjaContentTagMem.getAttribute('data-ninja-style') !== null) { | ||
164 | ninjaContentTagDoc.setAttribute('style', ninjaContentTagMem.getAttribute('data-ninja-style')); | ||
165 | ninjaContentTagDoc.removeAttribute('data-ninja-style'); | ||
166 | } else if (ninjaContentTagMem && ninjaContentTagMem.getAttribute('data-ninja-style') === null) { | ||
167 | ninjaContentTagDoc.removeAttribute('style'); | ||
168 | ninjaContentTagDoc.removeAttribute('data-ninja-style'); | ||
169 | } | ||
161 | } else { | 170 | } else { |
162 | if (template.body && template.body.getAttribute('data-ninja-style') !== null) { | 171 | if (template.body && template.body.getAttribute('data-ninja-style') !== null) { |
163 | template.file.content.document.body.setAttribute('style', template.body.getAttribute('data-ninja-style')); | 172 | template.file.content.document.body.setAttribute('style', template.body.getAttribute('data-ninja-style')); |
diff --git a/js/document/views/design.js b/js/document/views/design.js index 44c61617..d5c5c6c4 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js | |||
@@ -281,6 +281,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
281 | this.document.body.removeChild(this.document.getElementsByTagName('ninjaloadinghack')[0]); | 281 | this.document.body.removeChild(this.document.getElementsByTagName('ninjaloadinghack')[0]); |
282 | //Getting style and link tags in document | 282 | //Getting style and link tags in document |
283 | var htags = this.document.getElementsByTagName('html'), | 283 | var htags = this.document.getElementsByTagName('html'), |
284 | bannerWrapper, | ||
284 | userStyles, | 285 | userStyles, |
285 | stags = this.document.getElementsByTagName('style'), | 286 | stags = this.document.getElementsByTagName('style'), |
286 | ltags = this.document.getElementsByTagName('link'), i, orgNodes, | 287 | ltags = this.document.getElementsByTagName('link'), i, orgNodes, |
@@ -326,6 +327,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
326 | //TODO: Verify appropiate location for this operation | 327 | //TODO: Verify appropiate location for this operation |
327 | if (this._template && this._template.type === 'banner') { | 328 | if (this._template && this._template.type === 'banner') { |
328 | this.documentRoot = this.document.body.getElementsByTagName('ninja-content')[0]; | 329 | this.documentRoot = this.document.body.getElementsByTagName('ninja-content')[0]; |
330 | bannerWrapper = this.documentRoot.parentNode; | ||
329 | } else { | 331 | } else { |
330 | this.documentRoot = this.document.body; | 332 | this.documentRoot = this.document.body; |
331 | } | 333 | } |
@@ -349,6 +351,11 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
349 | this.documentRoot.setAttribute('data-ninja-style', userStyles); | 351 | this.documentRoot.setAttribute('data-ninja-style', userStyles); |
350 | } | 352 | } |
351 | } | 353 | } |
354 | if(bannerWrapper) { | ||
355 | if(userStyles = bannerWrapper.getAttribute('style')) { | ||
356 | bannerWrapper.setAttribute('data-ninja-style', userStyles); | ||
357 | } | ||
358 | } | ||
352 | //Making callback if specified | 359 | //Making callback if specified |
353 | if (this._callback) this._callback(); | 360 | if (this._callback) this._callback(); |
354 | } | 361 | } |