PluginProbe ʕ •ᴥ•ʔ
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More / 2.11.0
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More v2.11.0
2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.7 2.6.8 2.6.5 2.6.4 2.6.3 2.6.2 2.6.0 2.5.5 2.5.4 2.5.3 2.5.2 trunk 1.0 1.0.1 1.0.2 1.0.3 1.1 1.1.1 1.1.2 1.2.0 2.0 2.1.0 2.1.1 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5.0 2.5.1
reviews-feed / assets / admin / js / forms-integration.js
reviews-feed / assets / admin / js Last commit date
forms-integration.js 1 week ago jquery.tooltipster.min.js 1 week ago tooltip-wizard.js 1 week ago
forms-integration.js
109 lines
1 /**
2 * Misc Methods for form integrations
3 *
4 * @since 1.6
5 */
6 'use strict';
7 var SBRFormIntegrationManager = window.SBRFormIntegrationManager || ( function( document, window, $ ) {
8 const app = {
9
10 /**
11 * Init App
12 *
13 * @since 1.6
14 */
15 init: () => {
16 $( window ).on( 'load', function() {
17 if ( $.isFunction( $.ready.then ) ) {
18 $.ready.then( app.load );
19 } else {
20 app.load();
21 }
22 } );
23 },
24
25 /**
26 * App Load
27 *
28 * @since 1.6
29 */
30 load: () => {
31 app.initWpFormsSearch()
32 app.initFormidableFormsSearch()
33 },
34 /**
35 * Check Page URL to init Form Searchs
36 *
37 * @since 1.6
38 */
39 checkPageUrlParams: (params = []) => {
40 if (params?.length === 0) {
41 return false;
42 }
43 const pageURL = new URL(window.location.href);
44
45 const searchParams = params?.filter((param) => {
46 return pageURL.searchParams.has(param?.name) &&
47 pageURL.searchParams.get(param?.name) === param?.value;
48 });
49 return searchParams.length === params.length;
50 },
51
52 /**
53 * Init WP Forms Search
54 *
55 * @since 1.6
56 */
57 initWpFormsSearch: () => {
58 if (window?.WPFormsFormTemplates !== undefined) {
59 const params = [
60 {
61 name : 'page',
62 value : 'wpforms-builder'
63 },
64 {
65 name : 'sbrfeeds',
66 value : 'reviews'
67 }
68 ];
69 const searchParams = app.checkPageUrlParams(params);
70 if (searchParams === true) {
71 document.getElementById("wpforms-setup-template-search").value = "User Review";
72 window.WPFormsFormTemplates.performSearch("User Review");
73 }
74 }
75 },
76
77 /**
78 * Init Formidable Search
79 *
80 * @since 1.6
81 */
82 initFormidableFormsSearch: () => {
83 if (window?.frmFormTemplatesVars !== undefined) {
84 const params = [
85 {
86 name : 'page',
87 value : 'formidable-form-templates'
88 },
89 {
90 name : 'sbrfeeds',
91 value : 'reviews'
92 }
93 ];
94 const searchParams = app.checkPageUrlParams(params);
95 if (searchParams === true) {
96 document.getElementById("template-search-input").value = "User Review";
97 document.getElementById("template-search-input").dispatchEvent(new Event('change'))
98 }
99 }
100 },
101
102
103
104 }
105 return app;
106 }( document, window, jQuery ) );
107
108 SBRFormIntegrationManager.init();
109