Permalink
Browse files

Move prop functions

  • Loading branch information...
1 parent ea87771 commit cee20406c3545f109b5c8ecaab3961759ed90b1a @ebryn ebryn committed Jul 24, 2011
Showing with 21 additions and 21 deletions.
  1. +21 −21 wot.html
View
42 wot.html
@@ -103,6 +103,27 @@ <h1 {{^ifProps}}class='no-props'{{/ifProps}}><span>{{type}}{{^ifProps}} (none){{
}
});
+ function simpleProp(klassProp) {
+ var buffer = "<li><span class='prop-name'>" + klassProp.name + "</span>: ";
+ buffer += "<span class='prop-value'>" + klassProp.value + "</span></li>";
+ return buffer;
+ }
+
+ function arrayProp(klassProp) {
+ var propArray, buffer = "";
+
+ if (klassProp.value === "[]") { return simpleProp(klassProp); }
+
+ propArray = klassProp.value.replace(/^\[|\]$/g, '').split(',');
+ buffer += "<li class='array'><span class='prop-name'>" + klassProp.name + "</span>: ";
+ buffer += "[<ol class='array'>";
+ for (var i = 0; i < propArray.length; i++) {
+ buffer += "<li><span class='prop-value'>" + propArray[i] + "</span></li>";
+ }
+ buffer += "</ol><div style='clear: left;'></div>]</li>";
+ return buffer;
+ }
+
webInspector.panels.elements.onSelectionChanged.addListener(function() {
webInspector.inspectedWindow.eval("SproutQueryExtension.properties(SC.View.views[$0.id])", function(result) {
result = JSON.parse(result);
@@ -134,27 +155,6 @@ <h1 {{^ifProps}}class='no-props'{{/ifProps}}><span>{{type}}{{^ifProps}} (none){{
buffer = buffer + "<ul class='monospace'>";
- function simpleProp(klassProp) {
- var buffer = "<li><span class='prop-name'>" + klassProp.name + "</span>: ";
- buffer += "<span class='prop-value'>" + klassProp.value + "</span></li>";
- return buffer;
- }
-
- function arrayProp(klassProp) {
- var propArray, buffer = "";
-
- if (klassProp.value === "[]") { return simpleProp(klassProp); }
-
- propArray = klassProp.value.replace(/^\[|\]$/g, '').split(',');
- buffer += "<li class='array'><span class='prop-name'>" + klassProp.name + "</span>: ";
- buffer += "[<ol class='array'>";
- for (var i = 0; i < propArray.length; i++) {
- buffer += "<li><span class='prop-value'>" + propArray[i] + "</span></li>";
- }
- buffer += "</ol><div style='clear: left;'></div>]</li>";
- return buffer;
- }
-
for (prop in klass.properties) {
klassProp = klass.properties[prop];
isArrayProp = klassProp.value.charAt(0) === '[' && klassProp.value.substring(0, 7) !== '[object';

0 comments on commit cee2040

Please sign in to comment.