File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11< script type ="text/javascript ">
22 ( function ( ) {
3+ function isElementInViewport ( aEl ) {
4+ if ( aEl instanceof jQuery ) {
5+ aEl = aEl [ 0 ] ;
6+ }
37
4- setTimeout ( function ( ) {
5- $ ( '.reminders .alert .close' ) . each ( function ( ) {
6- this . click ( ) ;
7- } ) ;
8- } , 7000 ) ;
8+ var rect = aEl . getBoundingClientRect ( ) ;
9+
10+ return (
11+ rect . top >= 0 &&
12+ rect . left >= 0 &&
13+ rect . bottom <= ( window . innerHeight || document . documentElement . clientHeight ) && /*or $(window).height() */
14+ rect . right <= ( window . innerWidth || document . documentElement . clientWidth ) /*or $(window).width() */
15+ ) ;
16+ }
17+
18+ var hasShownReminders = false ;
19+ function callback ( aEl ) {
20+ if ( ! hasShownReminders ) {
21+ hasShownReminders = true ;
22+
23+ setTimeout ( function ( ) {
24+ $ ( '.reminders .alert .close' ) . each ( function ( ) {
25+ this . click ( ) ;
26+ } ) ;
27+ } , 7000 ) ;
28+ }
29+ }
30+
31+ function fireIfElementVisible ( aEl , aCallback ) {
32+ return function ( ) {
33+ if ( isElementInViewport ( aEl ) ) {
34+ aCallback ( aEl ) ;
35+ }
36+ }
37+ }
38+
39+ var handler = fireIfElementVisible ( $ ( '.reminders' ) , callback ) ;
40+
41+ $ ( window ) . on ( 'DOMContentLoaded load resize scroll' , handler ) ;
942
1043 } ) ( ) ;
1144</ script >
You can’t perform that action at this time.
0 commit comments