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