PluginProbe ʕ •ᴥ•ʔ
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress / 4.12.0
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress v4.12.0
4.12.0 4.10.0 4.9.0 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 / admin / assets / js / admin-notifications.js
custom-facebook-feed / admin / assets / js Last commit date
about.js 2 weeks ago admin-notifications.js 2 weeks ago builders-preview-handler.js 2 weeks ago callout.js 2 weeks ago cff-admin-scripts.js 2 weeks ago divi-handler.min.js 2 weeks ago extensions.js 2 weeks ago oembeds.js 2 weeks ago settings.js 2 weeks ago smash-usage-session.js 2 weeks ago support.js 2 weeks ago vue.min.js 2 weeks ago
admin-notifications.js
208 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 if ( ! res.success ) {
131 //CFFAdmin.debug( res );
132 }
133 } ).fail( function( xhr, textStatus, e ) {
134
135 //CFFAdmin.debug( xhr.responseText );
136 } );
137 },
138
139 /**
140 * Click on the Next notification button.
141 *
142 * @since 2.18
143 *
144 * @param {object} event Event object.
145 */
146 navNext: function( event ) {
147
148 if ( el.$nextButton.hasClass( 'disabled' ) ) {
149 return;
150 }
151
152 el.$currentMessage.removeClass( 'current' );
153 el.$nextMessage.addClass( 'current' );
154
155 app.updateNavigation();
156 },
157
158 /**
159 * Click on the Previous notification button.
160 *
161 * @since 2.18
162 *
163 * @param {object} event Event object.
164 */
165 navPrev: function( event ) {
166
167 if ( el.$prevButton.hasClass( 'disabled' ) ) {
168 return;
169 }
170
171 el.$currentMessage.removeClass( 'current' );
172 el.$prevMessage.addClass( 'current' );
173
174 app.updateNavigation();
175 },
176
177 /**
178 * Update navigation buttons.
179 *
180 * @since 2.18
181 */
182 updateNavigation: function() {
183
184 el.$currentMessage = el.$notifications.find( '.message.current' );
185 el.$nextMessage = el.$currentMessage.next( '.message' );
186 el.$prevMessage = el.$currentMessage.prev( '.message' );
187
188 if ( el.$nextMessage.length === 0 ) {
189 el.$nextButton.addClass( 'disabled' );
190 } else {
191 el.$nextButton.removeClass( 'disabled' );
192 }
193
194 if ( el.$prevMessage.length === 0 ) {
195 el.$prevButton.addClass( 'disabled' );
196 } else {
197 el.$prevButton.removeClass( 'disabled' );
198 }
199 },
200 };
201
202 return app;
203
204 }( document, window, jQuery ) );
205
206 // Initialize.
207 CFFAdminNotifications.init();
208