Permalink
Browse files

Merge branch 'master' of https://github.com/seekshiva/Festember12

  • Loading branch information...
2 parents 286489d + 9a8ffca commit 43ab06f0a0967415e5be0ad928935f4cad992592 @deepak1556 deepak1556 committed Sep 18, 2012
Showing with 1,279 additions and 166 deletions.
  1. +1,183 −166 js/event_content.js
  2. 0 js/form.js
  3. +76 −0 js/test.js
  4. +20 −0 test.html
View
1,349 js/event_content.js
1,183 additions, 166 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
0 js/form.js 100644 → 100755
File mode changed.
View
76 js/test.js
@@ -0,0 +1,76 @@
+var i, str = "", x = Event();
+
+function displayEvents(x) {
+ var j, str = "";
+ for(j = 0; j < x.length; ++j) {
+ var k;
+ //console.log (x[j].title);
+ str += '<div class="eventx">';
+ str += '<div class="ev_title">' + x[j].title + "</div>";
+ if(x[j].description !== undefined)
+ str += '<div class="ev_description">' + x[j].description + "</div>";
+
+ if(x[j].prize !== undefined && x[j].prize[0] !== "")
+ str += '<div class="ev_prize">Prize Money: ' + x[j].prize + " INR.</div>";
+
+ if (x[j]["children"] !== undefined)
+ str += displayEvents(x[j]["children"]);
+
+ if(x[j]["rules"] !== undefined) {
+ str += '<div class="ev_sub_head">Rules: </div>';
+ str += '<div class="ev_rules"><ul>';
+ for (k = 0; k < x[j]["rules"].length; ++k)
+ str += '<li>' + x[j].rules[k] + '</li>';
+ str += "</ul></div>";
+ }
+ str += "</div>";
+ }
+ return str;
+}
+
+
+function displayEventList(x) {
+ var str = "";
+ for(i in x) {
+ var j;
+ str += "<h3>" + i + "</h3>";
+ if(x[i].constructor == Array) {
+ str += displayEvents(x[i]);
+ }
+ else {
+ str += displayEventList(x[i]);
+ }
+ }
+ return str;
+}
+
+str = displayEventList(x);
+document.getElementById("root").innerHTML = str;
+
+
+
+str = "";
+
+function getList(x) {
+ var str = "", i, j;
+ for(i in x) {
+ str += "<h3>" + i + "</h3><ul>";
+ if(x[i].constructor == Array) {
+ for(j = 0; j < x[i].length; j++) {
+ str += '<li>' + x[i][j].title + '</li>';
+ }
+ }
+ else {
+ str += getList(x[i]);
+ console.log("Got list for ");
+ console.log(x[i]);
+ }
+ str += "</ul>";
+ }
+
+ return str;
+}
+
+str += getList(x);
+
+document.getElementById("list").innerHTML = str;
View
20 test.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+ <head>
+ <title>SOmthien</title>
+ <style>
+ .eventx { margin-left: 20px; }
+ .ev_title { font-weight: bold; }
+ .ev_prize { color: red; font-weight: bold; }
+ .ev_sub_head { font-weight: bold; font-size: 80%; }
+ .eventx ul { margin-top: 0; }
+ </style>
+ </head>
+ <body>
+ <div id="list"></div>
+ <hr />
+ <div id="root"></div>
+ <script src="./js/event_content.js"></script>
+ <script src="./js/test.js"></script>
+ </body>
+</html>

0 comments on commit 43ab06f

Please sign in to comment.