PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 7.2.2
Jetpack – WP Security, Backup, Speed, & Growth v7.2.2
16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 All 503 releases
jetpack / modules / widgets / milestone / milestone.js

milestone.js in Jetpack – WP Security, Backup, Speed, & Growth 7.2.2, at modules/widgets/milestone/milestone.js

53 lines 1012 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* global MilestoneConfig */
2
3 var Milestone = ( function( $ ) {
4 var Milestone = function ( args ) {
5 var $widget = $( '#' + args.id ),
6 id = args.id,
7 refresh = args.refresh * 1000;
8
9 this.timer = function() {
10 var instance = this;
11
12 $.ajax( {
13 url: MilestoneConfig.api_root + 'jetpack/v4/widgets/' + id,
14 success: function( result ) {
15 $widget.find( '.milestone-countdown' ).replaceWith( result.message );
16 refresh = result.refresh * 1000;
17
18 if ( ! refresh ) {
19 return;
20 }
21
22 setTimeout(
23 function() {
24 instance.timer();
25 },
26 refresh
27 );
28 }
29 } );
30
31 };
32
33 if ( refresh > 0 ) {
34 this.timer();
35 }
36 };
37 return function ( args ) {
38 return new Milestone( args );
39 };
40 } )( jQuery );
41
42 ( function() {
43 var i, MilestoneInstances = {};
44
45 if ( typeof( MilestoneConfig ) === 'undefined' ) {
46 return;
47 }
48
49 for ( i = 0; i < MilestoneConfig.instances.length; i++ ) {
50 MilestoneInstances[i] = new Milestone( MilestoneConfig.instances[i] );
51 }
52 } )();
53