aboutsummaryrefslogtreecommitdiff
path: root/js/document/views
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-06-01 11:53:57 -0700
committerJose Antonio Marquez2012-06-01 11:53:57 -0700
commit86837d69186bc4d1d6f54fc893c523de0972a0b9 (patch)
tree7121d2178839086a30effefa8d7417de94b13122 /js/document/views
parente09e4a8e24e5daf899d24314d0ffc218bbb2a97d (diff)
downloadninja-86837d69186bc4d1d6f54fc893c523de0972a0b9.tar.gz
Creating template mediator class
This is to simplify code, more to be changed and added.
Diffstat (limited to 'js/document/views')
-rwxr-xr-xjs/document/views/design.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/js/document/views/design.js b/js/document/views/design.js
index dedfe8b6..02e78e6e 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -159,7 +159,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
159 this._observer.body = new WebKitMutationObserver(this.insertBannerContent.bind(this)); 159 this._observer.body = new WebKitMutationObserver(this.insertBannerContent.bind(this));
160 this._observer.body.observe(this._bodyFragment, {childList: true}); 160 this._observer.body.observe(this._bodyFragment, {childList: true});
161 //Inserting <body> HTML and parsing URLs via mediator method 161 //Inserting <body> HTML and parsing URLs via mediator method
162 this._bodyFragment.innerHTML = '<ninjaloadinghack></ninjaloadinghack>'+(this.content.body.replace(/\b(href|src)\s*=\s*"([^"]*)"/g, this.application.ninja.ioMediator.getNinjaPropUrlRedirect.bind(this.application.ninja.ioMediator))).replace(/url\(([^"]*)(.+?)\1\)/g, this.application.ninja.ioMediator.getNinjaPropUrlRedirect.bind(this.application.ninja.ioMediator)); 162 this._bodyFragment.innerHTML = '<ninjaloadinghack></ninjaloadinghack>'+(this.content.body.replace(/\b(href|src)\s*=\s*"([^"]*)"/g, this.application.ninja.ioMediator.tmplt.getNinjaPropUrlRedirect.bind(this.application.ninja.ioMediator.tmplt))).replace(/url\(([^"]*)(.+?)\1\)/g, this.application.ninja.ioMediator.tmplt.getNinjaPropUrlRedirect.bind(this.application.ninja.ioMediator.tmplt));
163 } 163 }
164 } else { 164 } else {
165 //Creating temp code fragement to load head 165 //Creating temp code fragement to load head
@@ -168,12 +168,12 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
168 this._observer.head = new WebKitMutationObserver(this.insertHeadContent.bind(this)); 168 this._observer.head = new WebKitMutationObserver(this.insertHeadContent.bind(this));
169 this._observer.head.observe(this._headFragment, {childList: true}); 169 this._observer.head.observe(this._headFragment, {childList: true});
170 //Inserting <head> HTML and parsing URLs via mediator method 170 //Inserting <head> HTML and parsing URLs via mediator method
171 this._headFragment.innerHTML = (this.content.head.replace(/\b(href|src)\s*=\s*"([^"]*)"/g, this.application.ninja.ioMediator.getNinjaPropUrlRedirect.bind(this.application.ninja.ioMediator))).replace(/url\(([^"]*)(.+?)\1\)/g, this.application.ninja.ioMediator.getNinjaPropUrlRedirect.bind(this.application.ninja.ioMediator)); 171 this._headFragment.innerHTML = (this.content.head.replace(/\b(href|src)\s*=\s*"([^"]*)"/g, this.application.ninja.ioMediator.tmplt.getNinjaPropUrlRedirect.bind(this.application.ninja.ioMediator.tmplt))).replace(/url\(([^"]*)(.+?)\1\)/g, this.application.ninja.ioMediator.tmplt.getNinjaPropUrlRedirect.bind(this.application.ninja.ioMediator.tmplt));
172 //Adding event listener to know when the body is ready and make callback (using HTML5 new DOM Mutation Events) 172 //Adding event listener to know when the body is ready and make callback (using HTML5 new DOM Mutation Events)
173 this._observer.body = new WebKitMutationObserver(this.bodyContentLoaded.bind(this)); 173 this._observer.body = new WebKitMutationObserver(this.bodyContentLoaded.bind(this));
174 this._observer.body.observe(this.document.body, {childList: true}); 174 this._observer.body.observe(this.document.body, {childList: true});
175 //Inserting <body> HTML and parsing URLs via mediator method 175 //Inserting <body> HTML and parsing URLs via mediator method
176 this.document.body.innerHTML += '<ninjaloadinghack></ninjaloadinghack>'+(this.content.body.replace(/\b(href|src)\s*=\s*"([^"]*)"/g, this.application.ninja.ioMediator.getNinjaPropUrlRedirect.bind(this.application.ninja.ioMediator))).replace(/url\(([^"]*)(.+?)\1\)/g, this.application.ninja.ioMediator.getNinjaPropUrlRedirect.bind(this.application.ninja.ioMediator)); 176 this.document.body.innerHTML += '<ninjaloadinghack></ninjaloadinghack>'+(this.content.body.replace(/\b(href|src)\s*=\s*"([^"]*)"/g, this.application.ninja.ioMediator.tmplt.getNinjaPropUrlRedirect.bind(this.application.ninja.ioMediator.tmplt))).replace(/url\(([^"]*)(.+?)\1\)/g, this.application.ninja.ioMediator.tmplt.getNinjaPropUrlRedirect.bind(this.application.ninja.ioMediator.tmplt));
177 //Copying attributes to maintain same properties as the <body> 177 //Copying attributes to maintain same properties as the <body>
178 for (var n in this.content.document.body.attributes) { 178 for (var n in this.content.document.body.attributes) {
179 if (this.content.document.body.attributes[n].value) { 179 if (this.content.document.body.attributes[n].value) {