/[drupal]/contributions/modules/tribune/tribune.ajax.js
ViewVC logotype

Diff of /contributions/modules/tribune/tribune.ajax.js

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

revision 1.22, Thu Jun 12 16:35:56 2008 UTC revision 1.23, Tue Jun 17 10:46:32 2008 UTC
# Line 4  if (typeof(Drupal) == "undefined" || !Dr Line 4  if (typeof(Drupal) == "undefined" || !Dr
4     Drupal.tribune = {};     Drupal.tribune = {};
5  }  }
6    
7    Drupal.tribune.isElementVisible = function (jq) {
8        element = jq.get(0);
9    
10        var scrollY = 0;
11        if (window.pageYOffset) {
12            scrollY = window.pageYOffset;
13        } else if (document.body && document.body.scrollTop) {
14            scrollY = document.body.scrollTop;
15        } else if (document.documentElement && document.documentElement.scrollTop) {
16            scrollY = document.documentElement.scrollTop;
17        }
18    
19        var posY = 0;
20        if (element.offsetParent) {
21            for (var posY = 0 ; element.offsetParent ; element = element.offsetParent) {
22                posY += element.offsetTop;
23            }
24        } else {
25            posY = element.y;
26        }
27    
28        return posY < scrollY;
29    }
30    
31  /*  /*
32   * Submit comment with javascript.   * Submit comment with javascript.
# Line 59  Drupal.tribune.loadPostsData = function( Line 82  Drupal.tribune.loadPostsData = function(
82  }  }
83    
84  Drupal.tribune.postsReloaded = function() {  Drupal.tribune.postsReloaded = function() {
         Drupal.tribune.setOnHovers();  
85      Drupal.tribune.endReloading();      Drupal.tribune.endReloading();
86  }  }
87    
# Line 109  Drupal.tribune.loadJSONPosts = function( Line 131  Drupal.tribune.loadJSONPosts = function(
131                                          }                                          }
132                                  }                                  }
133              }              }
134    
135                Drupal.tribune.setOnHovers();
136          }          }
137    
138          Drupal.tribune.postsReloaded();          Drupal.tribune.postsReloaded();
# Line 213  Drupal.tribune.setSelectionRange = funct Line 237  Drupal.tribune.setSelectionRange = funct
237  }  }
238    
239  Drupal.tribune.showPreview = function(node) {  Drupal.tribune.showPreview = function(node) {
240          if (node.length) {          if (node.length && Drupal.tribune.isElementVisible(node)) {
241                  Drupal.tribune.message_preview_element.html(node.html());                  Drupal.tribune.message_preview_element.html(node.html());
242                  Drupal.tribune.message_preview_element.addClass('displayed');                  Drupal.tribune.message_preview_element.addClass('displayed');
243          } else {          } else {

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.2