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 / oembeds.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
oembeds.js
219 lines
1 var oembeds_data = {
2 nonce: cff_oembeds.nonce,
3 genericText: cff_oembeds.genericText,
4 images: cff_oembeds.images,
5 modal: cff_oembeds.modal,
6 links: cff_oembeds.links,
7 supportPageUrl: cff_oembeds.supportPageUrl,
8 socialWallActivated: cff_oembeds.socialWallActivated,
9 socialWallLinks: cff_oembeds.socialWallLinks,
10 facebook: cff_oembeds.facebook,
11 instagram: cff_oembeds.instagram,
12 connectionURL: cff_oembeds.connectionURL,
13 isIntagramActivated: cff_oembeds.instagram.active,
14 instagramInstallBtnText: null,
15 fboEmbedLoader: false,
16 fboEmbedError: null,
17 instaoEmbedLoader: false,
18 openInstaInstaller: false,
19 loaderSVG: cff_oembeds.loaderSVG,
20 checkmarkSVG: cff_oembeds.checkmarkSVG,
21 installerStatus: null,
22 isSetupPage : false
23 }
24
25 var cffoEmbeds = new Vue({
26 el: "#cff-oembeds",
27 http: {
28 emulateJSON: true,
29 emulateHTTP: true
30 },
31 data: oembeds_data,
32 methods: {
33 openInstallModal: function() {
34 this.openInstaInstaller = true
35 },
36 closeModal: function() {
37 this.openInstaInstaller = false
38 },
39 isoEmbedsEnabled: function() {
40 if ( this.facebook.doingOembeds && this.instagram.doingOembeds ) {
41 return true;
42 }
43 return;
44 },
45 InstagramShouldInstallOrEnable: function() {
46 // if the plugin is activated and installed then just enable oEmbed
47 if( this.isIntagramActivated ) {
48 this.enableFboEmbed();
49 return;
50 }
51 // if the plugin is not activated and installed then open the modal to install and activate the plugin
52 if( !this.isIntagramActivated ) {
53 this.openInstallModal();
54 return;
55 }
56 },
57 installInstagram: function() {
58 this.installerStatus = 'loading';
59 let data = new FormData();
60 data.append( 'action', cff_oembeds.instagram.installer.action );
61 data.append( 'nonce', cff_oembeds.nonce );
62 data.append( 'plugin', cff_oembeds.instagram.installer.plugin );
63 data.append( 'type', 'plugin' );
64 fetch(cff_oembeds.ajax_handler, {
65 method: "POST",
66 credentials: 'same-origin',
67 body: data
68 })
69 .then(response => response.json())
70 .then(data => {
71 if( data.success == false ) {
72 this.installerStatus = 'error'
73 }
74 if( data.success == true ) {
75 this.isIntagramActivated = true;
76 this.installerStatus = 'success'
77 }
78 this.instagramInstallBtnText = data.data.msg;
79 setTimeout(function() {
80 this.installerStatus = null;
81 }.bind(this), 3000);
82 return;
83 });
84 },
85 enableFboEmbed: function() {
86 this.fboEmbedLoader = true;
87 this.fboEmbedError = null;
88
89 let oembedConnectUrl = this.connectionURL.connect,
90 appendURL = this.connectionURL.stateURL;
91
92 const urlParams = {
93 'cff_con' : this.connectionURL.cff_con,
94 'state': "{'{url=" + appendURL + "}'}"
95 }
96
97 let form = document.createElement('form');
98 form.setAttribute('method', 'post');
99 form.setAttribute('action', oembedConnectUrl);
100
101 for (const key in urlParams) {
102 if (urlParams.hasOwnProperty(key)) {
103 let hiddenField = document.createElement('input');
104 hiddenField.setAttribute('type', 'hidden');
105 hiddenField.setAttribute('name', key);
106 hiddenField.setAttribute('value', urlParams[key]);
107 form.appendChild(hiddenField);
108 }
109 }
110 document.body.appendChild(form);
111
112 // Record that this user started a connect before leaving the site. The connect
113 // service returns no parameters of ours, so this marker is what authorises the
114 // inbound cff_access_token in CFF_oEmbeds::processCffOembedAccessToken().
115 let initData = new FormData();
116 initData.append( 'action', 'cff_oembed_connect_init' );
117 initData.append( 'nonce', this.nonce );
118 fetch(cff_oembeds.ajax_handler, {
119 method: "POST",
120 credentials: 'same-origin',
121 body: initData
122 })
123 .then(response => response.json())
124 .then(data => {
125 if ( ! data || ! data.success ) {
126 throw new Error( 'connect marker was not set' );
127 }
128 form.submit();
129 })
130 .catch(err => {
131 // Do not submit. Without the marker the token is refused on return, so the
132 // user would complete the whole Facebook flow only to land back here with
133 // nothing enabled and no explanation.
134 console.error( 'CFF: could not record oEmbed connect start', err );
135 this.fboEmbedLoader = false;
136 this.fboEmbedError = this.genericText.connectError;
137 });
138 },
139 enableInstagramOembed: function() {
140 this.instaoEmbedLoader = true;
141 window.location = this.connectionURL;
142 return;
143 },
144 disableFboEmbed: function() {
145 this.fboEmbedLoader = true;
146 let data = new FormData();
147 data.append( 'action', 'disable_facebook_oembed' );
148 data.append( 'nonce', this.nonce );
149 fetch(cff_oembeds.ajax_handler, {
150 method: "POST",
151 credentials: 'same-origin',
152 body: data
153 })
154 .then(response => response.json())
155 .then(data => {
156 if( data.success == true ) {
157 this.fboEmbedLoader = false;
158 this.facebook.doingOembeds = false;
159 // get the updated connection URL after disabling oEmbed
160 this.connectionURL = data.data.connectionUrl;
161 }
162 return;
163 });
164 },
165 disableInstaoEmbed: function() {
166 this.instaoEmbedLoader = true;
167 let data = new FormData();
168 data.append( 'action', 'disable_instagram_oembed' );
169 data.append( 'nonce', this.nonce );
170 fetch(cff_oembeds.ajax_handler, {
171 method: "POST",
172 credentials: 'same-origin',
173 body: data
174 })
175 .then(response => response.json())
176 .then(data => {
177 if( data.success == true ) {
178 this.instaoEmbedLoader = false;
179 this.instagram.doingOembeds = false;
180 // get the updated connection URL after disabling oEmbed
181 this.connectionURL = data.data.connectionUrl;
182 }
183 return;
184 });
185 },
186 installButtonText: function( buttonText = null ) {
187 if ( buttonText ) {
188 return buttonText;
189 } else if ( this.instagram.installer.nextStep == 'free_install' ) {
190 return this.modal.install;
191 } else if ( this.instagram.installer.nextStep == 'free_activate' ) {
192 return this.modal.activate;
193 }
194 },
195 installIcon: function() {
196 if ( this.isIntagramActivated ) {
197 return;
198 }
199 if( this.installerStatus == null ) {
200 return this.modal.plusIcon;
201 } else if( this.installerStatus == 'loading' ) {
202 return this.loaderSVG;
203 } else if( this.installerStatus == 'success' ) {
204 return this.checkmarkSVG;
205 } else if( this.installerStatus == 'error' ) {
206 return `<i class="fa fa-times-circle"></i>`;
207 }
208 },
209 },
210 created() {
211 // Display the "Install" button text on modal depending on condition
212 if ( this.instagram.installer.nextStep == 'free_install' ) {
213 this.instagramInstallBtnText = this.modal.install;
214 } else if ( this.instagram.installer.nextStep == 'free_activate' || this.instagram.installer.nextStep == 'pro_activate' ) {
215 this.instagramInstallBtnText = this.modal.activate;
216 }
217 }
218 })
219