From fbe830fabe497d01f4f2eaddb867161a8187c101 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 9 Feb 2012 23:42:04 -0800 Subject: Adding download cloud app UI --- js/mediators/io-mediator.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'js/mediators/io-mediator.js') diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index 630b0aa2..2f286e5e 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js @@ -86,16 +86,17 @@ exports.IoMediator = Montage.create(Component, { case 204: //Creating and formatting result object for callbak result = read.file.details; - //TODO: Add handling for converting HTML to Ninja format + //Checking for type of content to returns if (result.extension !== 'html' && result.extension !== 'htm') { + //Simple string result.content = read.file.content; } else { - // + //Object to be used by Ninja Template result.content = this.parseHtmlToNinjaTemplate(read.file.content); } - + //Status of call result.status = read.status; - // + //Calling back with result if (callback) callback(result); break; case 404: @@ -143,7 +144,7 @@ exports.IoMediator = Montage.create(Component, { // fileSaveAs: { enumerable: false, - value: function (file, copy, callback) { + value: function (copyTo, copyFrom, callback) { // } }, @@ -152,13 +153,12 @@ exports.IoMediator = Montage.create(Component, { parseHtmlToNinjaTemplate: { enumerable: false, value: function (html) { + //Creating temp object to mimic HTML var doc = window.document.implementation.createHTMLDocument(), template; - // + //Setting content to temp doc.getElementsByTagName('html')[0].innerHTML = html; - template = {head: doc.head, body: doc.body, document: doc}; - doc = null; - // - return template; + //Creating return object + return {head: doc.head.innerHTML, body: doc.body.innerHTML, document: doc}; } } //////////////////////////////////////////////////////////////////// -- cgit v1.2.3