PluginProbe ʕ •ᴥ•ʔ
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress / 2.17.1
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress v2.17.1
4.8.1 trunk 1.0 1.1 1.12.1 1.2.3 1.2.4 1.2.5 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.5 1.5.1 1.5.2 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.4.1 1.6.5 1.6.5.1 1.6.6 1.6.6.1 1.6.6.2 1.6.6.3 1.6.7 1.6.7.1 1.6.8 1.6.8.1 1.6.8.2 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.9.0 1.9.1 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.8.1 1.9.9 1.9.9.1 1.9.9.2 1.9.9.3 2.0 2.0.1 2.1 2.1.1 2.1.2 2.1.3 2.10 2.11 2.11.1 2.12 2.12.1 2.12.2 2.12.3 2.12.4 2.13 2.14 2.14.1 2.15 2.15.1 2.16 2.16.1 2.17 2.17.1 2.18 2.18.1 2.18.2 2.18.3 2.19 2.19.1 2.19.2 2.19.3 2.2 2.2.1 2.3 2.3.1 2.3.10 2.3.2 2.3.3 2.3.4 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.1.1 2.4.1.2 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5 2.5.1 2.5.2 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.7 2.7.1 2.7.2 2.8 2.9 2.9.1 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.1 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.7.5 4.7.6 4.7.7
custom-facebook-feed / js / admin-notifications.js
custom-facebook-feed / js Last commit date
admin-notifications.js 5 years ago cff-admin-scripts.js 5 years ago cff-blocks.js 6 years ago cff-scripts.js 5 years ago cff-scripts.min.js 6 years ago jquery.matchHeight-min.js 6 years ago
admin-notifications.js
209 lines
1 /**
2 * CFF Admin Notifications.
3 *
4 * @since 2.18
5 */
6
7 'use strict';
8
9 var CFFAdminNotifications = window.CFFAdminNotifications || ( function( document, window, $ ) {
10
11 /**
12 * Elements holder.
13 *
14 * @since 2.18
15 *
16 * @type {object}
17 */
18 var el = {
19
20 $notifications: $( '#cff-notifications' ),
21 $nextButton: $( '#cff-notifications .navigation .next' ),
22 $prevButton: $( '#cff-notifications .navigation .prev' ),
23 $adminBarCounter: $( '#wp-admin-bar-wpforms-menu .cff-menu-notification-counter' ),
24 $adminBarMenuItem: $( '#wp-admin-bar-cff-notifications' ),
25
26 };
27
28 /**
29 * Public functions and properties.
30 *
31 * @since 2.18
32 *
33 * @type {object}
34 */
35 var app = {
36
37 /**
38 * Start the engine.
39 *
40 * @since 2.18
41 */
42 init: function() {
43 el.$notifications.find( '.messages a').each(function() {
44 if ($(this).attr('href').indexOf('dismiss=') > -1 ) {
45 $(this).addClass('button-dismiss');
46 }
47 })
48
49 $( app.ready );
50 },
51
52 /**
53 * Document ready.
54 *
55 * @since 2.18
56 */
57 ready: function() {
58
59 app.updateNavigation();
60 app.events();
61 },
62
63 /**
64 * Register JS events.
65 *
66 * @since 2.18
67 */
68 events: function() {
69
70 el.$notifications
71 .on( 'click', '.dismiss', app.dismiss )
72 .on( 'click', '.button-dismiss', app.buttonDismiss )
73 .on( 'click', '.next', app.navNext )
74 .on( 'click', '.prev', app.navPrev );
75 },
76
77 /**
78 * Click on a dismiss button.
79 *
80 * @since 2.18
81 */
82 buttonDismiss: function( event ) {
83 event.preventDefault();
84 app.dismiss();
85 },
86
87 /**
88 * Click on the Dismiss notification button.
89 *
90 * @since 2.18
91 *
92 * @param {object} event Event object.
93 */
94 dismiss: function( event ) {
95
96 if ( el.$currentMessage.length === 0 ) {
97 return;
98 }
99
100 // Update counter.
101 var count = parseInt( el.$adminBarCounter.text(), 10 );
102 if ( count > 1 ) {
103 --count;
104 el.$adminBarCounter.html( '<span>' + count + '</span>' );
105 } else {
106 el.$adminBarCounter.remove();
107 el.$adminBarMenuItem.remove();
108 }
109
110 // Remove notification.
111 var $nextMessage = el.$nextMessage.length < 1 ? el.$prevMessage : el.$nextMessage,
112 messageId = el.$currentMessage.data( 'message-id' );
113
114 if ( $nextMessage.length === 0 ) {
115 el.$notifications.remove();
116 } else {
117 el.$currentMessage.remove();
118 $nextMessage.addClass( 'current' );
119 app.updateNavigation();
120 }
121
122 // AJAX call - update option.
123 var data = {
124 action: 'cff_dashboard_notification_dismiss',
125 nonce: cff_admin.nonce,
126 id: messageId,
127 };
128
129 $.post( cff_admin.ajax_url, data, function( res ) {
130
131 if ( ! res.success ) {
132 //CFFAdmin.debug( res );
133 }
134 } ).fail( function( xhr, textStatus, e ) {
135
136 //CFFAdmin.debug( xhr.responseText );
137 } );
138 },
139
140 /**
141 * Click on the Next notification button.
142 *
143 * @since 2.18
144 *
145 * @param {object} event Event object.
146 */
147 navNext: function( event ) {
148
149 if ( el.$nextButton.hasClass( 'disabled' ) ) {
150 return;
151 }
152
153 el.$currentMessage.removeClass( 'current' );
154 el.$nextMessage.addClass( 'current' );
155
156 app.updateNavigation();
157 },
158
159 /**
160 * Click on the Previous notification button.
161 *
162 * @since 2.18
163 *
164 * @param {object} event Event object.
165 */
166 navPrev: function( event ) {
167
168 if ( el.$prevButton.hasClass( 'disabled' ) ) {
169 return;
170 }
171
172 el.$currentMessage.removeClass( 'current' );
173 el.$prevMessage.addClass( 'current' );
174
175 app.updateNavigation();
176 },
177
178 /**
179 * Update navigation buttons.
180 *
181 * @since 2.18
182 */
183 updateNavigation: function() {
184
185 el.$currentMessage = el.$notifications.find( '.message.current' );
186 el.$nextMessage = el.$currentMessage.next( '.message' );
187 el.$prevMessage = el.$currentMessage.prev( '.message' );
188
189 if ( el.$nextMessage.length === 0 ) {
190 el.$nextButton.addClass( 'disabled' );
191 } else {
192 el.$nextButton.removeClass( 'disabled' );
193 }
194
195 if ( el.$prevMessage.length === 0 ) {
196 el.$prevButton.addClass( 'disabled' );
197 } else {
198 el.$prevButton.removeClass( 'disabled' );
199 }
200 },
201 };
202
203 return app;
204
205 }( document, window, jQuery ) );
206
207 // Initialize.
208 CFFAdminNotifications.init();
209