| 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. |
| 82 |
} |
} |
| 83 |
|
|
| 84 |
Drupal.tribune.postsReloaded = function() { |
Drupal.tribune.postsReloaded = function() { |
|
Drupal.tribune.setOnHovers(); |
|
| 85 |
Drupal.tribune.endReloading(); |
Drupal.tribune.endReloading(); |
| 86 |
} |
} |
| 87 |
|
|
| 131 |
} |
} |
| 132 |
} |
} |
| 133 |
} |
} |
| 134 |
|
|
| 135 |
|
Drupal.tribune.setOnHovers(); |
| 136 |
} |
} |
| 137 |
|
|
| 138 |
Drupal.tribune.postsReloaded(); |
Drupal.tribune.postsReloaded(); |
| 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 { |