PluginProbe ʕ •ᴥ•ʔ
ShareThis Follow Buttons / 1.4.5
ShareThis Follow Buttons v1.4.5
1.4.7 trunk 1.0.1 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
sharethis-follow-buttons / js / meta-box.js
sharethis-follow-buttons / js Last commit date
admin.js 2 years ago blocks.js 4 years ago meta-box.js 4 years ago set-credentials.js 3 years ago
meta-box.js
87 lines
1 /**
2 * Minute Control.
3 *
4 * @package ShareThisFollowButtons
5 */
6
7 /* exported MinuteControl */
8 var MinuteControl = ( function( $, wp ) {
9 'use strict';
10
11 return {
12 /**
13 * Holds data.
14 */
15 data: {},
16
17 /**
18 * Boot plugin.
19 *
20 * @param data
21 */
22 boot: function( data ) {
23 this.data = data;
24
25 $( document ).ready(
26 function() {
27 this.init();
28 }.bind( this )
29 );
30 },
31
32 /**
33 * Initialize plugin.
34 */
35 init: function() {
36 this.$container = $( '#sharethis-follow-meta-box' );
37
38 this.listen();
39 },
40
41 /**
42 * Initiate listeners.
43 */
44 listen: function() {
45 var self = this;
46
47 // When checking an option in the meta box.
48 this.$container.on(
49 'click',
50 '#sharethis-follow-bottom-post, #sharethis-follow-top-post',
51 function() {
52 var checked = $( this ).prop( 'checked' ),
53 type = $( this ).closest( '.button-setting-wrap' ).attr( 'id' ),
54 placement = $( this ).attr( 'class' );
55
56 self.updateList( type, checked, placement );
57 }
58 );
59 },
60
61 /**
62 * Add / remove post to list.
63 *
64 * @param type
65 * @param checked
66 * @param placement
67 */
68 updateList: function( type, checked, placement ) {
69
70 // Update specifide list per checked.
71 wp.ajax.post(
72 'follow_update_list',
73 {
74 postid: this.data.postid,
75 type: type,
76 checked: checked,
77 placement: placement,
78 nonce: this.data.nonce
79 }
80 ).always(
81 function() {
82 }
83 );
84 }
85 };
86 } )( window.jQuery, window.wp );
87