PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.1
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | js/plugin-search.js +22 -17 6.335.1 View file →
@@ -2,10 +2,12 @@
2 2 * Handles replacing the bottom row
3 3 * of the card with customized content.
4 4 */
5 5
6 -let FormidablePSH = {};
6 +/* global frmPlugSearch, JSON */
7 7
8 +var FormidablePSH = {};
9 +
8 10 function frmPS() {
9 11 FormidablePSH = {
10 12 $pluginFilter: document.getElementById( 'plugin-filter' ),
11 13
@@ -10,12 +12,11 @@
10 12 $pluginFilter: document.getElementById( 'plugin-filter' ),
11 13
12 14 /**
13 15 * Get parent search hint element.
14 - *
15 - * @return {Element|null} The parent search hint element.
16 + * @returns {Element | null}
16 17 */
17 - getCard() {
18 + getCard: function () {
18 19 return document.querySelector( '.plugin-card-frm-plugin-search' );
19 20 },
20 21
21 22 /**
@@ -20,28 +21,32 @@
20 21
21 22 /**
22 23 * Replace bottom row of the card to insert logo, text and link to dismiss the card.
23 24 */
24 - replaceCardBottom() {
25 - const hint = FormidablePSH.getCard();
25 + replaceCardBottom: function () {
26 + var hint = FormidablePSH.getCard();
26 27 if ( 'object' === typeof hint && null !== hint ) {
27 28 hint.querySelector( '.plugin-card-bottom' ).outerHTML =
28 - `<div class="plugin-card-bottom frm-plugin-search__bottom"><p class="frm-plugin-search__text">${ frmPlugSearch.legend }</p></div>`;
29 + '<div class="plugin-card-bottom frm-plugin-search__bottom">' +
30 + '<p class="frm-plugin-search__text">' +
31 + frmPlugSearch.legend +
32 + '</p>' +
33 + '</div>';
29 34
30 35 // Remove link and parent li from action links and move it to bottom row
31 - const dismissLink = document.querySelector( '.frm-plugin-search__dismiss' );
32 - dismissLink.parentNode.remove();
33 - document.querySelector( '.frm-plugin-search__bottom' ).append( dismissLink );
36 + var dismissLink = document.querySelector( '.frm-plugin-search__dismiss' );
37 + dismissLink.parentNode.parentNode.removeChild( dismissLink.parentNode );
38 + document.querySelector( '.frm-plugin-search__bottom' ).appendChild( dismissLink );
34 39 }
35 40 },
36 41
42 +
37 43 /**
38 44 * Check if plugin card list nodes changed. If there's a Formidable PSH card, replace the title and the bottom row.
39 - *
40 - * @param {Array} mutationsList
45 + * @param {array} mutationsList
41 46 */
42 - replaceOnNewResults( mutationsList ) {
43 - mutationsList.forEach( function( mutation ) {
47 + replaceOnNewResults: function ( mutationsList ) {
48 + mutationsList.forEach( function ( mutation ) {
44 49 if (
45 50 'childList' === mutation.type &&
46 51 1 === document.querySelectorAll( '.plugin-card-frm-plugin-search' ).length
47 52 ) {
@@ -52,9 +57,9 @@
52 57
53 58 /**
54 59 * Start suggesting.
55 60 */
56 - init() {
61 + init: function () {
57 62 if ( FormidablePSH.$pluginFilter === null ) {
58 63 return;
59 64 }
60 65
@@ -61,9 +66,9 @@
61 66 // Replace PSH bottom row on page load
62 67 FormidablePSH.replaceCardBottom();
63 68
64 69 // Listen for changes in plugin search results
65 - const resultsObserver = new MutationObserver( FormidablePSH.replaceOnNewResults );
70 + var resultsObserver = new MutationObserver( FormidablePSH.replaceOnNewResults );
66 71 resultsObserver.observe( FormidablePSH.$pluginFilter, { childList: true } );
67 72 },
68 73 };
69 74
@@ -68,5 +73,5 @@
68 73 };
69 74
70 75 FormidablePSH.init();
71 76 }
72 -FormidablePS = frmPS(); //eslint-disable-line sonarjs/no-use-of-empty-return-value
77 +FormidablePS = frmPS();