Commit 96288880 authored by Vivek's avatar Vivek

wip

parent 7219176a
......@@ -110,25 +110,27 @@
<head>\n
</head>\n
<body>\n
<h4>interface1</h4>\n
<h1>interface1</h1>\n
<h3>description of interface1</h3>\n
<dl>\n
<dt>method1</dt>\n
<dd>description of method1</dd>\n
<dl>\n
<dt>param1</dt>\n
<dd>description of param1</dd>\n
<dt>param2</dt>\n
<dd>description of param2</dd>\n
</dl>\n
<dl>\n
<dt class="required" type="int">param1</dt>\n
<dd>description of param1</dd>\n
<dt class="optional">param2</dt>\n
<dd>description of param2</dd>\n
</dl>\n
<dt>method2</dt>\n
<dd>description of method2</dd>\n
<dl>\n
<dt>param1</dt>\n
<dd>description of param1</dd>\n
</dl>\n
<dl>\n
<dt class="required" type="boolean">param1</dt>\n
<dd>description of param1</dd>\n
</dl>\n
</dd>\n
<dt>method3</dt>\n
<dd>description of method3</dd>\n
<dl></dl> \n
</dl> \n
</body>\n
</html>
......@@ -268,7 +270,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.13112.12198.45124</string> </value>
<value> <string>944.17297.14978.38758</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -286,7 +288,7 @@
</tuple>
<state>
<tuple>
<float>1436192235.83</float>
<float>1436446773.66</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -288,7 +288,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.15689.51638.7082</string> </value>
<value> <string>944.17439.65022.59426</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -306,7 +306,7 @@
</tuple>
<state>
<tuple>
<float>1436347422.24</float>
<float>1436452642.01</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -123,15 +123,17 @@
})\n
\n
.declareMethod("method1", function (param1, param2) {\n
console.log("RJS IDemo JS: declareMethod: method1");\n
return;\n
})\n
.declareMethod("method2", function (param1) {\n
console.log("RJS IDemo JS: declareMethod: method2");\n
return;\n
})\n
.declareMethod("method3", function () {\n
return;\n
})\n
\n
\n
.declareMethod("render", function () {\n
var gadget = this;\n
return new RSVP.Queue()\n
......@@ -152,6 +154,15 @@
gadget.props.content_element.innerHTML =\n
gadget.props.interface_list_template(parameter);\n
$(gadget.props.element).trigger("create");\n
return parameter.interface_item;\n
})\n
.push(function (interface_items) {\n
// testing getInterfaceData.\n
return gadget.getInterfaceData(interface_items[0].interface_name);\n
})\n
.push(function (interface_data) {\n
console.log("interface_data", interface_data);\n
console.log("getPath", gadget.getPath());\n
});\n
});\n
\n
......@@ -290,7 +301,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.15705.41379.358</string> </value>
<value> <string>944.17453.1344.10683</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -308,7 +319,7 @@
</tuple>
<state>
<tuple>
<float>1436347953.17</float>
<float>1436453615.05</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -112,11 +112,13 @@
<meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>Interfaces Gadget</title>\n
\n
<script src="renderjs.js"></script>\n
<script src="rsvp.js"></script>\n
<script src="rsvp.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n
<script src="handlebars.js" type="text/javascript"></script>\n
<script src="jquery.js" type="text/javascript"></script>\n
\n
<!-- custom script -->\n
<script src="gadget_interfaces.js"></script>\n
<script src="gadget_interfaces.js" type="text/javascript"></script>\n
\n
</head>\n
<body></body>\n
......@@ -257,7 +259,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.13142.48800.18295</string> </value>
<value> <string>944.17351.42412.2389</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -275,7 +277,7 @@
</tuple>
<state>
<tuple>
<float>1436257154.99</float>
<float>1436452859.83</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -101,9 +101,54 @@
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*global window, rJS, RSVP */\n
;/*\n
* DOMParser HTML extension\n
* 2012-09-04\n
*\n
* By Eli Grey, http://eligrey.com\n
* Public domain.\n
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n
*/\n
/*! @source https://gist.github.com/1129031 */\n
(function (DOMParser) {\n
"use strict";\n
var DOMParser_proto = DOMParser.prototype,\n
real_parseFromString = DOMParser_proto.parseFromString;\n
\n
// Firefox/Opera/IE throw errors on unsupported types\n
try {\n
// WebKit returns null on unsupported types\n
if ((new DOMParser()).parseFromString("", "text/html")) {\n
// text/html parsing is natively supported\n
return;\n
}\n
} catch (ignore) {}\n
\n
DOMParser_proto.parseFromString = function (markup, type) {\n
var result, doc, doc_elt, first_elt;\n
if (/^\\s*text\\/html\\s*(?:;|$)/i.test(type)) {\n
doc = document.implementation.createHTMLDocument("");\n
doc_elt = doc.documentElement;\n
\n
doc_elt.innerHTML = markup;\n
first_elt = doc_elt.firstElementChild;\n
\n
if (doc_elt.childElementCount === 1\n
&& first_elt.localName.toLowerCase() === "html") {\n
doc.replaceChild(first_elt, doc_elt);\n
}\n
\n
result = doc;\n
} else {\n
result = real_parseFromString.apply(this, arguments);\n
}\n
return result;\n
};\n
}(DOMParser));\n
\n
;/*global window, rJS, RSVP */\n
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
(function (window, rJS, Handlebars, $, RSVP, loopEventListener) {\n
(function (window, rJS, Handlebars, $, RSVP, loopEventListener, DOMParser) {\n
"use strict";\n
\n
function verifyInterfaceDeclaration (gadget) {\n
......@@ -132,28 +177,68 @@
name: "",\n
description: "",\n
methods: []\n
},\n
method = {\n
name: "",\n
description: "",\n
argument_list: []\n
};\n
if (window.File && window.FileReader && window.FileList && window.Blob) {\n
return "Great success! All the File APIs are supported.";\n
} else {\n
return "The File APIs are not fully supported in this browser.";\n
} \n
return RSVP.Queue()\n
.push(function() {\n
return jQuery.get(interface_name);\n
})\n
.push(function(file_data) {\n
var doc = (new DOMParser()).parseFromString(file_data, \'text/html\').body,\n
dl_list = doc.getElementsByTagName(\'dl\'),\n
dt_list = doc.getElementsByTagName(\'dt\'),\n
dd_list = doc.getElementsByTagName(\'dd\'),\n
method_len = dl_list.length - 1,\n
dt_count = 0, \n
dl_count = 1;\n
interface_data.name = doc.getElementsByTagName(\'h1\')[0].innerText;\n
interface_data.description = doc.getElementsByTagName(\'h3\')[0].innerText;\n
\n
for (var i=0; i<method_len; i+=1) {\n
var method = {\n
name: "",\n
description: "",\n
argument_list: []\n
};\n
method.name = dt_list[dt_count].innerText;\n
method.description = dd_list[dt_count].innerText;\n
var argument_len = dl_list[dl_count].getElementsByTagName(\'dt\').length;\n
dt_count += 1;\n
dl_count += 1;\n
for (var j=0; j<argument_len; j+=1) {\n
var argument_item = {\n
name: "",\n
description: "",\n
required: true,\n
type: ""\n
};\n
if(dt_list[dt_count].getAttribute("class") == "optional") {\n
argument_item.required = false;\n
}\n
argument_item.type = dt_list[dt_count].getAttribute("type");\n
argument_item.name = dt_list[dt_count].innerText;\n
argument_item.description = dd_list[dt_count].innerText;\n
dt_count += 1;\n
method.argument_list.push(argument_item);\n
}\n
interface_data.methods.push(method);\n
}\n
return interface_data;\n
});\n
\n
})\n
\n
.declareMethod("getDefinedInterfaceMethods", function (interface_name) {\n
return;\n
return this.getInterfaceData(interface_name)\n
.push(function(interface_data) {\n
return interface_data.methods;\n
});\n
})\n
\n
.declareMethod("verifyInterfaceImplementation", function (gadget, interface_name) {\n
return;\n
});\n
\n
}(window, rJS, Handlebars, jQuery, RSVP, loopEventListener));
}(window, rJS, Handlebars, jQuery, RSVP, loopEventListener, DOMParser));
]]></string> </value>
</item>
......@@ -290,7 +375,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.15705.12035.31027</string> </value>
<value> <string>944.17466.54680.49015</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -308,7 +393,7 @@
</tuple>
<state>
<tuple>
<float>1436347895.72</float>
<float>1436453641.0</float>
<string>GMT</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment