http://git-wip-us.apache.org/repos/asf/mahout/blob/ac56b551/website/front/assets_bu/themes/retro-mahout/js/search.js
----------------------------------------------------------------------
diff --git a/website/front/assets_bu/themes/retro-mahout/js/search.js 
b/website/front/assets_bu/themes/retro-mahout/js/search.js
new file mode 100644
index 0000000..58249ad
--- /dev/null
+++ b/website/front/assets_bu/themes/retro-mahout/js/search.js
@@ -0,0 +1,21 @@
+function initSearch(){
+    var methods = {
+        defaultValueActsAsHint: function(element){
+            element = $(element);
+            element._default = element.value;
+            return element.observe('focus', function(){
+                if(element._default != element.value) return;
+                element.removeClassName('hint').value = '';
+            }).observe('blur', function(){
+                if(element.value.strip() != '') return;
+                element.addClassName('hint').value = element._default;
+            }).addClassName('hint');
+        }
+    };
+    $w('input textarea').each(function(tag){ Element.addMethods(tag, methods) 
});
+}
+initSearch();
+
+document.observe('dom:loaded', function(){
+    $('searchDocs').defaultValueActsAsHint();
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mahout/blob/ac56b551/website/front/assets_bu/themes/retro-mahout/js/slides.js
----------------------------------------------------------------------
diff --git a/website/front/assets_bu/themes/retro-mahout/js/slides.js 
b/website/front/assets_bu/themes/retro-mahout/js/slides.js
new file mode 100644
index 0000000..004d5ee
--- /dev/null
+++ b/website/front/assets_bu/themes/retro-mahout/js/slides.js
@@ -0,0 +1,109 @@
+var Slides = Class.create({
+
+       initialize: function(element, options) {                
+               this.options = {
+               Duration: 1,
+                       Delay: 10.0,
+                       Random: true,
+                       Slideshow:true,
+                       Controls:true
+       }
+               Object.extend(this.options, options || {});
+
+       this.element        = $(element);
+               this.slides                     = this.element.childElements();
+               this.num_slides         = this.slides.length;           
+               this.current_slide      = (this.options.Random) ? 
(Math.floor(Math.random()*this.num_slides)) : 0;
+               this.end_slide          = this.num_slides - 1;
+               
+               this.slides.invoke('hide');
+               this.slides[this.current_slide].show();
+                               
+               if (this.options.Slideshow) { 
+                       this.startSlideshow();
+               }                               
+               if (this.options.Controls) {
+                       this.addControls();
+               }               
+       },
+       
+       addControls: function() {
+               this.btn_previous       = $('previous');
+               this.btn_next           = $('next');
+               this.btn_start          = $('start');
+               this.btn_stop           = $('stop');
+               
+               this.btn_previous.observe('click', 
this.moveToPrevious.bindAsEventListener(this));
+               this.btn_next.observe('click', 
this.moveToNext.bindAsEventListener(this));
+               this.btn_start.observe('click', 
this.startSlideshow.bindAsEventListener(this));
+               this.btn_stop.observe('click', 
this.stopSlideshow.bindAsEventListener(this));
+       },
+
+       startSlideshow: function(event) {
+               if (event) { Event.stop(event); }
+               if (!this.running)      {
+                       this.fadeStartBtn();
+                       this.executer = new PeriodicalExecuter(function(){
+                               this.updateSlide(this.current_slide+1);
+                       }.bind(this),this.options.Delay);
+                       this.running=true;
+               }
+               
+       },
+       
+       fadeStartBtn: function() {
+               var startBtn = $('start');
+               var stopBtn = $('stop');
+               Effect.Fade(startBtn, { duration: 0.3 }),
+               Effect.Appear(stopBtn, { duration: 0.3 }) 
+       },
+       
+       stopSlideshow: function(event) {        
+               if (event) { Event.stop(event); } 
+               if (this.executer) {
+                       this.fadeStopBtn();
+                       this.executer.stop();
+                       this.running=false;
+               }        
+       },
+       
+       fadeStopBtn: function() {
+               var startBtn = $('start');
+               var stopBtn = $('stop');
+               Effect.Fade(stopBtn, { duration: 0.3 }),
+               Effect.Appear(startBtn, { duration: 0.3 }) 
+       },
+
+       moveToPrevious: function (event) {
+               if (event) { Event.stop(event); }
+               //this.stopSlideshow();
+               this.updateSlide(this.current_slide-1);
+       },
+
+       moveToNext: function (event) {
+               if (event) { Event.stop(event); }
+               //this.stopSlideshow();
+               this.updateSlide(this.current_slide+1);
+       },
+       
+       updateSlide: function(next_slide) {
+               if (next_slide > this.end_slide) { 
+                               next_slide = 0; 
+               } 
+               else if ( next_slide == -1 ) {
+                               next_slide = this.end_slide;
+               }
+               
+               this.fadeInOut(next_slide, this.current_slide);         
+       },
+
+       fadeInOut: function (next, current) {           
+               new Effect.Parallel([
+                       new Effect.Fade(this.slides[current], { sync: true }),
+                       new Effect.Appear(this.slides[next], { sync: true }) 
+               ], { duration: this.options.Duration });
+               
+               this.current_slide = next;              
+       }
+
+});
\ No newline at end of file

Reply via email to