diff options
author | Valerio Virgillito | 2012-05-14 17:28:00 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-14 17:28:00 -0700 |
commit | 8009663c4f1bbf5ae457393fb8a3454df2625071 (patch) | |
tree | 65ece2e94092cc5a177f830858008478df09d6d9 /js/document | |
parent | 8f8eb57f4506987942745c3325492e939ed3caa8 (diff) | |
parent | 6fe05fc4f518000cf9a7af3c34381af16579a6d6 (diff) | |
download | ninja-8009663c4f1bbf5ae457393fb8a3454df2625071.tar.gz |
Merge branch 'dom-architecture' of github.com:Motorola-Mobility/ninja-internal into dom-architecture
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/document-html.js | 7 | ||||
-rwxr-xr-x | js/document/templates/banner/index.html | 46 | ||||
-rwxr-xr-x | js/document/views/design.js | 8 |
3 files changed, 38 insertions, 23 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js index 7e1f1806..9bbea4c9 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js | |||
@@ -100,15 +100,14 @@ exports.HtmlDocument = Montage.create(Component, { | |||
100 | this._document = this.model.views.design.document; | 100 | this._document = this.model.views.design.document; |
101 | //TODO: Remove usage, seems as not needed | 101 | //TODO: Remove usage, seems as not needed |
102 | if (template && template.type === 'banner') { | 102 | if (template && template.type === 'banner') { |
103 | //this.documentRoot = this.model.views.design.document.body; | 103 | this.documentRoot = this.model.views.design.document.body.getElementsByTagName('ninja-content')[0]; |
104 | this.documentRoot = this.model.views.design.document.body.getElementsByTagName('ninja-banner')[0]; | ||
105 | } else { | 104 | } else { |
106 | this.documentRoot = this.model.views.design.document.body; | 105 | this.documentRoot = this.model.views.design.document.body; |
107 | } | 106 | } |
108 | //TODO: Why is this needed? | 107 | //TODO: Why is this needed? |
109 | this._liveNodeList = this.model.views.design.document.body.getElementsByTagName('*'); | 108 | this._liveNodeList = this.documentRoot.getElementsByTagName('*'); |
110 | //Initiliazing document model | 109 | //Initiliazing document model |
111 | document.application.njUtils.makeElementModel(this.model.views.design.document.body, "Body", "body"); | 110 | document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body"); |
112 | //Adding observer to know when template is ready | 111 | //Adding observer to know when template is ready |
113 | this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this)); | 112 | this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this)); |
114 | this._observer.observe(this.model.views.design.document.head, {childList: true}); | 113 | this._observer.observe(this.model.views.design.document.head, {childList: true}); |
diff --git a/js/document/templates/banner/index.html b/js/document/templates/banner/index.html index 2cd82f51..91ef06de 100755 --- a/js/document/templates/banner/index.html +++ b/js/document/templates/banner/index.html | |||
@@ -27,8 +27,6 @@ | |||
27 | margin: 0; | 27 | margin: 0; |
28 | padding: 0; | 28 | padding: 0; |
29 | position: absolute; | 29 | position: absolute; |
30 | -webkit-transform-style: preserve-3d; | ||
31 | -webkit-transform: perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); | ||
32 | } | 30 | } |
33 | 31 | ||
34 | html { | 32 | html { |
@@ -40,10 +38,6 @@ | |||
40 | height: 100%; | 38 | height: 100%; |
41 | background: #666; | 39 | background: #666; |
42 | } | 40 | } |
43 | |||
44 | ninjaloadinghack { | ||
45 | display: none; | ||
46 | } | ||
47 | 41 | ||
48 | .active-element-outline { | 42 | .active-element-outline { |
49 | outline: #adff2f solid 2px; | 43 | outline: #adff2f solid 2px; |
@@ -53,16 +47,29 @@ | |||
53 | -webkit-transition: all 450ms linear !important; | 47 | -webkit-transition: all 450ms linear !important; |
54 | } | 48 | } |
55 | 49 | ||
56 | ninja-banner { | 50 | ninjaloadinghack { |
51 | display: none; | ||
52 | } | ||
53 | |||
54 | ninja-viewport, ninja-content { | ||
57 | display: block; | 55 | display: block; |
58 | margin: 0; | 56 | margin: 0; |
59 | padding: 0; | 57 | padding: 0; |
60 | border: 0; | 58 | border: 0; |
61 | position: absolute; | 59 | position: absolute; |
62 | overflow: visible; | 60 | overflow: visible; |
63 | top: 50%; | 61 | top: 0; |
64 | left: 50%; | 62 | left: 0; |
65 | background: #FFF; | 63 | background: transparent; |
64 | } | ||
65 | |||
66 | ninja-viewport { | ||
67 | background: #FFF; | ||
68 | } | ||
69 | |||
70 | ninja-content { | ||
71 | -webkit-transform-style: preserve-3d; | ||
72 | -webkit-transform: perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); | ||
66 | } | 73 | } |
67 | </style> | 74 | </style> |
68 | 75 | ||
@@ -87,8 +94,15 @@ | |||
87 | </head> | 94 | </head> |
88 | 95 | ||
89 | <body> | 96 | <body> |
97 | |||
90 | <ninjaloadinghack></ninjaloadinghack> | 98 | <ninjaloadinghack></ninjaloadinghack> |
91 | <ninja-banner></ninja-banner> | 99 | |
100 | <ninja-viewport> | ||
101 | |||
102 | <ninja-content></ninja-content> | ||
103 | |||
104 | </ninja-viewport> | ||
105 | |||
92 | </body> | 106 | </body> |
93 | 107 | ||
94 | </html> \ No newline at end of file | 108 | </html> \ No newline at end of file |
diff --git a/js/document/views/design.js b/js/document/views/design.js index e838dd49..4c91ff39 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js | |||
@@ -159,8 +159,9 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
159 | insertBannerContent: { | 159 | insertBannerContent: { |
160 | value: function (e) { | 160 | value: function (e) { |
161 | //Getting first element in DOM (assumes it's root) | 161 | //Getting first element in DOM (assumes it's root) |
162 | var banner = this._bodyFragment.getElementsByTagName('*')[1], | 162 | //TODO: Ensure wrapper logic is proper |
163 | ninjaBanner = this.document.body.getElementsByTagName('ninja-banner')[0]; | 163 | var banner = this._bodyFragment.getElementsByTagName('*')[2], |
164 | ninjaBanner = this.document.body.getElementsByTagName('ninja-content')[0]; | ||
164 | //Copying attributes to maintain same properties as the banner root | 165 | //Copying attributes to maintain same properties as the banner root |
165 | for (var n in banner.attributes) { | 166 | for (var n in banner.attributes) { |
166 | if (banner.attributes[n].value) { | 167 | if (banner.attributes[n].value) { |
@@ -168,7 +169,8 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
168 | } | 169 | } |
169 | } | 170 | } |
170 | //Adjusting margin per size of document | 171 | //Adjusting margin per size of document |
171 | this.document.head.getElementsByTagName('style')[0].innerHTML += '\n ninja-banner {margin-top: -'+Math.floor(this._template.size.height/2)+'px; margin-left: -'+Math.floor(this._template.size.width/2)+'px}'; | 172 | //this.document.head.getElementsByTagName('style')[0].innerHTML += '\n ninja-banner {overflow: visible !important; margin-top: -'+Math.floor(this._template.size.height/2)+'px; margin-left: -'+Math.floor(this._template.size.width/2)+'px}'; |
173 | this.document.head.getElementsByTagName('style')[0].innerHTML += '\n ninja-content {overflow: visible !important;} ninja-content, ninja-viewport {width: ' + this._template.size.width + 'px; height: ' + this._template.size.height + 'px;}'; | ||
172 | //Setting content in template | 174 | //Setting content in template |
173 | ninjaBanner.innerHTML = banner.innerHTML; | 175 | ninjaBanner.innerHTML = banner.innerHTML; |
174 | //Garbage collection | 176 | //Garbage collection |