flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mamsel...@apache.org
Subject svn commit: r1552376 - /flex/site/trunk/content/js/showcase.js
Date Thu, 19 Dec 2013 17:42:25 GMT
Author: mamsellem
Date: Thu Dec 19 17:42:24 2013
New Revision: 1552376

URL: http://svn.apache.org/r1552376
Log:
IN PROGRESS - FLEX-33907 Showcase section in web site
ajax implementation (test2)

Modified:
    flex/site/trunk/content/js/showcase.js

Modified: flex/site/trunk/content/js/showcase.js
URL: http://svn.apache.org/viewvc/flex/site/trunk/content/js/showcase.js?rev=1552376&r1=1552375&r2=1552376&view=diff
==============================================================================
--- flex/site/trunk/content/js/showcase.js (original)
+++ flex/site/trunk/content/js/showcase.js Thu Dec 19 17:42:24 2013
@@ -1,127 +1,124 @@
 /* helper function to create the showcase
-*  props:
-*  title: app title
-*  author: string
-*  description: app description
-*  [ website: url  ]
-*  [dev : string ]
-*  links : [( "linkTyp", "url " ) + ]
-*  [ videos: url   ]
-*  imgDir: subdirectory for images
-*  images:  Array of file names
-* */
-
- function addShowcaseEntry( props) {
-     var i;
-
-     // TITLE
-    var entry = '<div class="headline"><h4>'+props.title+'</h4></div>'
+
-      ' <ul class="arrow_list">' +
-        '<li><span class="sc_header">Summary:</span>&nbsp;&nbsp;'+props.description+'
 </li>'  +
-        '<li><span class="sc_header">Author:</span>&nbsp;&nbsp;'+props.author+'
</li>' ;
-    if (props.dev){
+ *  props:
+ *  title: app title
+ *  author: string
+ *  description: app description
+ *  [ website: url  ]
+ *  [dev : string ]
+ *  links : [( "linkTyp", "url " ) + ]
+ *  [ videos: url   ]
+ *  imgDir: subdirectory for images
+ *  images:  Array of file names
+ * */
+
+function addShowcaseEntry(props) {
+    var i;
+
+    // TITLE
+    var entry = '<div class="headline"><h4>' + props.title + '</h4></div>'
+
+        ' <ul class="arrow_list">' +
+        '<li><span class="sc_header">Summary:</span>&nbsp;&nbsp;'
+ props.description + '  </li>' +
+        '<li><span class="sc_header">Author:</span>&nbsp;&nbsp;'
+ props.author + ' </li>';
+    if (props.dev) {
         entry += '<li><span class="sc_header">Dev details:</span>&nbsp;&nbsp;'
+ props.dev + '</li>';
     }
-     if (props.website) {
-         entry += '<li><span class="sc_header">Web site:</span>&nbsp;&nbsp;<A
href="'+ props.website+'" target="_blank">' + props.website + '</A></li>';
-     }
-     var links = props.links;
-     if (links){
-         for (i=0; i < links.length; i+= 2){
-             entry += '<li> <span class="sc_header">'+links[i]+':</span>&nbsp;&nbsp;<A
href="' + links[i+1] + '" target="_blank">' + links[i+1] + '</A></li>';
-         }
-     }
-     entry += '</ul>'    ;
+    if (props.website) {
+        entry += '<li><span class="sc_header">Web site:</span>&nbsp;&nbsp;<A
href="' + props.website + '" target="_blank">' + props.website + '</A></li>';
+    }
+    var links = props.links;
+    if (links) {
+        for (i = 0; i < links.length; i += 2) {
+            entry += '<li> <span class="sc_header">' + links[i] + ':</span>&nbsp;&nbsp;<A
href="' + links[i + 1] + '" target="_blank">' + links[i + 1] + '</A></li>';
+        }
+    }
+    entry += '</ul>';
 
     // image gallery
     var imgs = props.images;
 
     var img;
     var imgPath;
-    if (imgs){
-        entry+="<div class='gallery_strip'>";
+    if (imgs) {
+        entry += "<div class='gallery_strip'>";
         for (i = 0; i < imgs.length; i++) {
             img = imgs[i];
-            imgPath = "images/showcase/"+ props.imgDir + "/"
-            entry += '<a class="gallery" rel="'+ props.imgDir +'" href="'+ imgPath + img
+ '" title="' + img + '">'
-                + '<img class="showcase" src="' + imgPath + 'prev/' + img +  '"/>';
+            imgPath = "images/showcase/" + props.imgDir + "/"
+            entry += '<a class="gallery" rel="' + props.imgDir + '" href="' + imgPath
+ img + '" title="' + img + '">'
+                + '<img class="showcase" src="' + imgPath + 'prev/' + img + '"/>';
         }
-        entry+="</div>";
+        entry += "</div>";
     }
 
     var entryDiv = document.createElement("div");
-     entryDiv.innerHTML = entry ;
+    entryDiv.innerHTML = entry;
     var showcaseContainer = document.getElementById("showcaseContainer");
     showcaseContainer.appendChild(entryDiv);
 
 }
 
-  $(document).ready(function () {
+$(document).ready(function () {
 
-      if (!document.getElementById("showcaseContainer"))
-            return;
+    if (!document.getElementById("showcaseContainer"))
+        return;
 
     $("a.gallery").fancybox({ cyclic: false});
 
-     alert("showcase-ready 3");
-     // retrieve showcase XML file
-   //   $.get("data/showcase.xml", "false", processShowcaseXML,"xml")   ;
-
-      $.ajax({ url: "showcase/data/showcase.xml", type: "GET", dataType: "xml",
-          complete: function (result, state) {
-              if (state == "success"){
-                  alert("complete" );
-                  processShowcaseXML(result.responseXML) ;
-              }
-          },
-          error: function (result, state, error) {
-              alert("http://localhost/BB_WEBSERVICES_5/showcase/showcase.xml file is not
reachable:" + error)
-          }
-      });
+    // retrieve showcase XML file
+    //   $.get("data/showcase.xml", "false", processShowcaseXML,"xml")   ;
 
+    $.ajax({ url: "showcase/data/showcase.xml", type: "GET", dataType: "xml",
+        complete: function (result, state) {
+            if (state == "success") {
+                processShowcaseXML(result.responseXML);
+            }
+        },
+        error: function (result, state, error) {
+            alert("showcase/data/showcase.xml file is not reachable:" + error)
+        }
+    });
 });
 
 /**
  *
  * @param xmlData  == document
  */
-function processShowcaseXML( xmlDoc)   {
-      var items = xmlDoc.getElementsByTagName("app");
-     var i;
+function processShowcaseXML(xmlDoc) {
+    var items = xmlDoc.getElementsByTagName("app");
+    var i;
     var item;
 
-      for (i = 0; i < items.length; i++){
-          item = items[i];
-          // build links Array
-          var linksXML = item.getElementsByTagName("link") ;
-          var j;
-          var links = [];
-          for ( j=0; j < linksXML.length;j++){
-              links.push(linksXML[j].getAttribute("header")) ;
-              links.push(linksXML[j].getAttribute("url"));
-          }
-          // builds images array
-          var imagesRootXML = item.getElementsByTagName("images") ;
-          var images = [];
-          if (imagesRootXML.length > 0 ){
-              imagesRootXML = imagesRootXML[0] ;
-              var imgBaseDir = imagesRootXML.getAttribute("baseDir");
-              var imagesXML = imagesRootXML.getElementsByTagName("image");
-              for (j = 0; j < imagesXML.length; j++) {
-                  images.push(imagesXML[j].getAttribute("file"));
-              }
-          }
-
-          addShowcaseEntry({
-              title: item.getAttribute("title") ,
-              description: item.getElementsByTagName("description")[0].textContent,
-              author: item.getAttribute("author"),
-              website: item.getAttribute("website") ,
-              dev: item.getAttribute("dev"),
-              links: links,
-              imgDir: imgBaseDir,
-              images: images
-          });
-      }
+    for (i = 0; i < items.length; i++) {
+        item = items[i];
+        // build links Array
+        var linksXML = item.getElementsByTagName("link");
+        var j;
+        var links = [];
+        for (j = 0; j < linksXML.length; j++) {
+            links.push(linksXML[j].getAttribute("header"));
+            links.push(linksXML[j].getAttribute("url"));
+        }
+        // builds images array
+        var imagesRootXML = item.getElementsByTagName("images");
+        var images = [];
+        if (imagesRootXML.length > 0) {
+            imagesRootXML = imagesRootXML[0];
+            var imgBaseDir = imagesRootXML.getAttribute("baseDir");
+            var imagesXML = imagesRootXML.getElementsByTagName("image");
+            for (j = 0; j < imagesXML.length; j++) {
+                images.push(imagesXML[j].getAttribute("file"));
+            }
+        }
+
+        addShowcaseEntry({
+            title: item.getAttribute("title"),
+            description: item.getElementsByTagName("description")[0].textContent,
+            author: item.getAttribute("author"),
+            website: item.getAttribute("website"),
+            dev: item.getAttribute("dev"),
+            links: links,
+            imgDir: imgBaseDir,
+            images: images
+        });
+    }
 
 }



Mime
View raw message