/[drupal]/contributions/modules/ticketyboo/ticketyboo.js
ViewVC logotype

Diff of /contributions/modules/ticketyboo/ticketyboo.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Tue Aug 26 15:34:14 2008 UTC revision 1.2, Thu Sep 4 17:55:24 2008 UTC
# Line 1  Line 1 
1    // ticketyboo Ticker
2    
3  var ticketyboo = new Array();  var ticketyboo = new Array();
4  var ticketyseconds = new Array();  var ticketyseconds = new Array();
# Line 6  var ticketytop = new Array(); Line 7  var ticketytop = new Array();
7  var ticketytimer = new Array();  var ticketytimer = new Array();
8  var ticketypause = new Array();  var ticketypause = new Array();
9  var ticketylast = new Array();  var ticketylast = new Array();
10    var ticketydir = new Array();
11    
12  function ticketyboo_init(id, seconds, nodes) {  // initialise a ticker
13    function ticketyboo_init(id, seconds, nodes, direction) {
14     // initial values     // initial values
15     ticketyboo[id] = 0;     ticketyboo[id] = 0;
16     ticketylast[id] = 0;     ticketylast[id] = 0;
17     ticketyseconds[id] = seconds;     ticketyseconds[id] = seconds;
18     ticketynodes[id] = nodes;     ticketynodes[id] = nodes;
19     ticketypause[id] = false;     ticketypause[id] = false;
20       ticketydir[id] = direction;
21    
22     // activate the first content     // activate the first content
23     var key = "ticketyboo_" + id + "_" + ticketyboo[id];     var key = "ticketyboo_" + id + "_" + ticketyboo[id];
# Line 24  function ticketyboo_init(id, seconds, no Line 28  function ticketyboo_init(id, seconds, no
28     window.setInterval('ticketyboo_tick(' + id + ')', seconds * 1000);     window.setInterval('ticketyboo_tick(' + id + ')', seconds * 1000);
29  }  }
30    
31    // perform the tick
32  function ticketyboo_tick(id) {  function ticketyboo_tick(id) {
33     if (!ticketypause[id]) {     if (!ticketypause[id]) {
34    
# Line 36  function ticketyboo_tick(id) { Line 41  function ticketyboo_tick(id) {
41        ticketyboo[id] = next;        ticketyboo[id] = next;
42        ticketylast[id] = last;        ticketylast[id] = last;
43    
44        ticketytop[id] = 70;        ticketytop[id] = 75;
45        ticketytimer[id] = window.setInterval('ticketyboo_slide(' + id + ')', 40);        ticketytimer[id] = window.setInterval('ticketyboo_slide(' + id + ')', 40);
46    
47     }     }
48  }  }
49    
50    // animate the change
51  function ticketyboo_slide(id) {  function ticketyboo_slide(id) {
52     var top = +ticketytop[id]-2;     var top = +ticketytop[id]-2;
53     ticketytop[id] = top;     ticketytop[id] = top;
54     var next = ticketyboo[id];     var next = ticketyboo[id];
55     var last = ticketylast[id];     var last = ticketylast[id];
56       var dir = ticketydir[id];
57    
58     if (last != 0) {     if (last != 0) {
59        var key = "ticketyboo_" + id + "_" + last;        var key = "ticketyboo_" + id + "_" + last;
# Line 54  function ticketyboo_slide(id) { Line 61  function ticketyboo_slide(id) {
61     }     }
62    
63     key = "ticketyboo_" + id + "_" + next;     key = "ticketyboo_" + id + "_" + next;
64     document.getElementById(key).style.marginTop = top + "%";     if (dir == 'vertical' || dir == 'diagonal') {
65          document.getElementById(key).style.marginTop = top + "%";
66       }
67       if (dir == 'horizontal' || dir == 'diagonal') {
68          document.getElementById(key).style.marginLeft = top + "%";
69       }
70     document.getElementById(key).style.display = "block";     document.getElementById(key).style.display = "block";
71    
72     if (top <= 0) {     if (top <= 0) {

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2