You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by al...@apache.org on 2011/01/30 23:40:44 UTC

svn commit: r1065411 - /myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/resources/META-INF/resources/org.apache.myfaces.html5/slide.js

Author: aliok
Date: Sun Jan 30 22:40:44 2011
New Revision: 1065411

URL: http://svn.apache.org/viewvc?rev=1065411&view=rev
Log:
Html5
Added goBySlideId functionality to SlideView JS side

Modified:
    myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/resources/META-INF/resources/org.apache.myfaces.html5/slide.js

Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/resources/META-INF/resources/org.apache.myfaces.html5/slide.js
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/resources/META-INF/resources/org.apache.myfaces.html5/slide.js?rev=1065411&r1=1065410&r2=1065411&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/resources/META-INF/resources/org.apache.myfaces.html5/slide.js (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/resources/META-INF/resources/org.apache.myfaces.html5/slide.js Sun Jan 30 22:40:44 2011
@@ -36,13 +36,17 @@ if(myfaces.html5.slide == undefined || m
 
     myfaces.html5.slide.SlideView = function(_root, _navigateOnArrowKeys, _navigateOnMouseWheel){
         this.slides = new Array();
+        this.slideIndexes = new Array();
 
         for(var i=0; i<_root.children.length; i++)
         {
             var obj = _root.children[i];
             if(obj.tagName == "DIV"){
-                this.slideCount++;
                 this.slides.push(new myfaces.html5.slide.Slide(obj));
+                if(obj.id){
+                    this.slideIndexes[obj.id] = this.slideCount;
+                }
+                this.slideCount++;
             }
         }
 
@@ -68,6 +72,7 @@ if(myfaces.html5.slide == undefined || m
 
     myfaces.html5.slide.SlideView.prototype = {
         slides : [],
+        //slideIndexes : [],
         currentIndex : 0,
         slideCount : 0,
 
@@ -133,6 +138,12 @@ if(myfaces.html5.slide == undefined || m
             this.addTransition();
         },
 
+        goBySlideId : function(slideId){
+            if(this.slideIndexes[slideId]){
+                this.goto(this.slideIndexes[slideId]);
+            }
+        },
+
         handleKeyDown: function(e) {
             if(e.target.nodeName == 'INPUT' || e.target.nodeName == 'TEXTAREA')
                 return;