diff options
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/document-html.js | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js index ad82c371..6ace440f 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js | |||
@@ -23,6 +23,11 @@ exports.HtmlDocument = Montage.create(Component, { | |||
23 | model: { | 23 | model: { |
24 | value: null | 24 | value: null |
25 | }, | 25 | }, |
26 | //////////////////////////////////////////////////////////////////// | ||
27 | // | ||
28 | loaded: { | ||
29 | value: {callback: null, context: null} | ||
30 | }, | ||
26 | //////////////////////////////////////////////////////////////////// | 31 | //////////////////////////////////////////////////////////////////// |
27 | // | 32 | // |
28 | _document: { | 33 | _document: { |
@@ -54,6 +59,9 @@ exports.HtmlDocument = Montage.create(Component, { | |||
54 | // | 59 | // |
55 | init: { | 60 | init: { |
56 | value:function(file, context, callback, view) { | 61 | value:function(file, context, callback, view) { |
62 | // | ||
63 | this.loaded.callback = callback; | ||
64 | this.loaded.context = context; | ||
57 | //Creating instance of HTML Document Model | 65 | //Creating instance of HTML Document Model |
58 | this.model = Montage.create(HtmlDocumentModel,{ | 66 | this.model = Montage.create(HtmlDocumentModel,{ |
59 | file: {value: file}, | 67 | file: {value: file}, |
@@ -74,8 +82,7 @@ exports.HtmlDocument = Montage.create(Component, { | |||
74 | this.model.views.design.content = this.model.file.content; | 82 | this.model.views.design.content = this.model.file.content; |
75 | // | 83 | // |
76 | this.model.views.design.render(function () { | 84 | this.model.views.design.render(function () { |
77 | //Setting opacity to be viewable after load | 85 | |
78 | this.model.views.design.iframe.style.opacity = 1; | ||
79 | 86 | ||
80 | 87 | ||
81 | 88 | ||
@@ -84,19 +91,18 @@ exports.HtmlDocument = Montage.create(Component, { | |||
84 | this._document = this.model.views.design.document; | 91 | this._document = this.model.views.design.document; |
85 | //TODO: Check for needed | 92 | //TODO: Check for needed |
86 | this.documentRoot = this.model.views.design.document.body; | 93 | this.documentRoot = this.model.views.design.document.body; |
87 | // | 94 | //TODO: Why is this needed? |
88 | this._liveNodeList = this.documentRoot.getElementsByTagName('*'); | 95 | this._liveNodeList = this.documentRoot.getElementsByTagName('*'); |
89 | // | 96 | // |
90 | document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body"); | 97 | document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body"); |
91 | 98 | //TODO: Figure out why timeout is needed | |
92 | |||
93 | |||
94 | |||
95 | this.hack = {callback: callback, context: context}; | ||
96 | |||
97 | setTimeout(function () { | 99 | setTimeout(function () { |
98 | //Making callback after view is loaded | 100 | //Making callback after view is loaded |
99 | this.hack.callback.call(this.hack.context, this); | 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); | ||
100 | }.bind(this), 1000); | 106 | }.bind(this), 1000); |
101 | 107 | ||
102 | 108 | ||