aboutsummaryrefslogtreecommitdiff
path: root/js/document/document-html.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-05-02 11:25:32 -0700
committerJose Antonio Marquez2012-05-02 11:25:32 -0700
commitba7946e8b41430eda7e2956ee4c82fa1f1ee9507 (patch)
tree741769d92ae2550d519d39fff71100ca0f92322d /js/document/document-html.js
parentdf3f96beb749951162bb60ec88363340e3ef6d95 (diff)
downloadninja-ba7946e8b41430eda7e2956ee4c82fa1f1ee9507.tar.gz
Preliminary Open File (new template)
Added basic open file functionality, does not parse document for URLs.
Diffstat (limited to 'js/document/document-html.js')
-rwxr-xr-xjs/document/document-html.js74
1 files changed, 51 insertions, 23 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index 6ace440f..b169e046 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -82,43 +82,71 @@ exports.HtmlDocument = Montage.create(Component, {
82 this.model.views.design.content = this.model.file.content; 82 this.model.views.design.content = this.model.file.content;
83 // 83 //
84 this.model.views.design.render(function () { 84 this.model.views.design.render(function () {
85
86
87
88
89
90 //TODO: Identify and remove usage of '_document' 85 //TODO: Identify and remove usage of '_document'
91 this._document = this.model.views.design.document; 86 this._document = this.model.views.design.document;
92 //TODO: Check for needed 87 //TODO: Check for needed
93 this.documentRoot = this.model.views.design.document.body; 88 this.documentRoot = this.model.views.design.document.body;
94 //TODO: Why is this needed? 89 //TODO: Why is this needed?
95 this._liveNodeList = this.documentRoot.getElementsByTagName('*'); 90 this._liveNodeList = this.documentRoot.getElementsByTagName('*');
96 // 91 //Initiliazing document model
97 document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body"); 92 document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body");
98 //TODO: Figure out why timeout is needed 93 //Adding event to know when template is ready
99 setTimeout(function () { 94 this.model.views.design.document.head.addEventListener('DOMSubtreeModified', this.handleTemplateReady.bind(this), false);
100 //Making callback after view is loaded
101 this.loaded.callback.call(this.loaded.context, this);
102 //Setting opacity to be viewable after load
103 setTimeout(function () {
104 this.model.views.design.iframe.style.opacity = 1;
105 }.bind(this), 1000);
106 }.bind(this), 1000);
107
108
109
110
111
112
113
114 }.bind(this)); 95 }.bind(this));
115 } else { 96 } else {
116 //TODO: Identify default view (probably code) 97 //TODO: Identify default view (probably code)
117 } 98 }
118 } 99 }
119 }, 100 },
120 //////////////////////////////////////////////////////////////////// 101 ////////////////////////////////////////////////////////////////////
121 // 102 //
103 handleTemplateReady: {
104 value: function (e) {
105 //Removing event listener, a must for this type of event
106 this.model.views.design.document.head.removeEventListener('DOMSubtreeModified', this.handleTemplateReady.bind(this), false);
107 //Making callback after view is loaded
108 this.loaded.callback.call(this.loaded.context, this);
109 //Setting opacity to be viewable after load
110 this.model.views.design.iframe.style.opacity = 1;
111 }
112 },
113 ////////////////////////////////////////////////////////////////////
114 ////////////////////////////////////////////////////////////////////
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
122 handleWebTemplateLoad: { 150 handleWebTemplateLoad: {
123 value: function(event) { 151 value: function(event) {
124 //TODO: Remove, also for prototyping 152 //TODO: Remove, also for prototyping