Assembla home | Assembla project page
 

Changeset 10 for trunk/rails/public

Show
Ignore:
Timestamp:
06/15/08 16:22:05 (7 months ago)
Author:
battlehorse
Message:

Fixes #18 : tags browsing

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/rails/public/javascripts/application.js

    r4 r10  
    11// Place your application-specific JavaScript functions and classes here 
    22// This file is automatically included by javascript_include_tag :defaults 
     3 
     4var Slideshow = Class.create({ 
     5        initialize: function(placeholder, messageholder, flickr_users_url, imgs, opt_random_order) { 
     6                this.placeholder = $(placeholder); 
     7                this.messageholder = $(messageholder); 
     8                this.flickr_users_url = flickr_users_url; 
     9                this.imgs = imgs; 
     10                this.random_order = opt_random_order; 
     11                this.curImgNum = 0; 
     12                this.curImg = null; 
     13        }, 
     14         
     15        open_user: function(imgnum) { 
     16          this.messageholder.innerHTML = "Loading photosets from the requested user..." 
     17          location.href = this.flickr_users_url + this.imgs[this.curImgNum].owner;               
     18        }, 
     19         
     20        show: function() { 
     21          var imgEl = new Element('img', {src: this.imgs[this.curImgNum].src, id: "coverFlowImageId" }); 
     22          var a = new Element('a', { style: "cursor:pointer"}); 
     23          a.appendChild(imgEl); 
     24          this.placeholder.update(a); 
     25          Event.observe(a, 'click', this.open_user.bind(this, this.curImgNum));          
     26          cvi_reflex.add(document.getElementById("coverFlowImageId"), { tilt: "right", distance: 5, border: 10, transparency: 80,color: "#ffffff" }); 
     27          Effect.Appear(this.placeholder, {duration: 0.5}); 
     28          setTimeout(this.load_next_image.bind(this),5000);        
     29        }, 
     30         
     31        fade_and_show: function() { 
     32          Effect.Fade(this.placeholder, { duration: 0.5, afterFinish: this.show.bind(this)}); 
     33        }, 
     34         
     35        load_next_image: function() { 
     36          if (this.random_order) { 
     37                this.curImgNum = Math.floor(Math.random()*this.imgs.length); 
     38    } else { 
     39      this.curImgNum += 1; 
     40      if (this.curImgNum == this.imgs.length) { 
     41        this.curImgNum = 0; 
     42      } 
     43    } 
     44          this.curImg = new Image ; 
     45          this.curImg.onload = this.fade_and_show.bind(this); 
     46          this.curImg.src = this.imgs[this.curImgNum].src; 
     47        }, 
     48         
     49        start: function() { 
     50                this.load_next_image(); 
     51        } 
     52}); 
  • trunk/rails/public/stylesheets/scaffold.css

    r4 r10  
    8989} 
    9090 
     91div.tagSelector { 
     92        cursor: pointer; 
     93        border: 1px solid transparent; 
     94        width: 250px; 
     95} 
     96 
     97div.tagSelector:hover { 
     98        background-color: #FFEDDD; 
     99        border-top: 1px solid #999; 
     100        border-left: 1px solid #999; 
     101        border-bottom: 1px solid #fff; 
     102        border-right: 1px solid #fff;    
     103} 
     104