| @@ -2,10 +2,8 @@ | ||
| 2 | 2 | * Handles replacing the bottom row |
| 3 | 3 | * of the card with customized content. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -/* global frmPlugSearch */ | |
| 7 | - | |
| 8 | 6 | let FormidablePSH = {}; |
| 9 | 7 | |
| 10 | 8 | function frmPS() { |
| 11 | 9 | FormidablePSH = { |
| @@ -15,9 +13,9 @@ | ||
| 15 | 13 | * Get parent search hint element. |
| 16 | 14 | * |
| 17 | 15 | * @return {Element|null} The parent search hint element. |
| 18 | 16 | */ |
| 19 | - getCard: function() { | |
| 17 | + getCard() { | |
| 20 | 18 | return document.querySelector( '.plugin-card-frm-plugin-search' ); |
| 21 | 19 | }, |
| 22 | 20 | |
| 23 | 21 | /** |
| @@ -22,17 +20,13 @@ | ||
| 22 | 20 | |
| 23 | 21 | /** |
| 24 | 22 | * Replace bottom row of the card to insert logo, text and link to dismiss the card. |
| 25 | 23 | */ |
| 26 | - replaceCardBottom: function() { | |
| 24 | + replaceCardBottom() { | |
| 27 | 25 | const hint = FormidablePSH.getCard(); |
| 28 | 26 | if ( 'object' === typeof hint && null !== hint ) { |
| 29 | 27 | hint.querySelector( '.plugin-card-bottom' ).outerHTML = |
| 30 | - '<div class="plugin-card-bottom frm-plugin-search__bottom">' + | |
| 31 | - '<p class="frm-plugin-search__text">' + | |
| 32 | - frmPlugSearch.legend + | |
| 33 | - '</p>' + | |
| 34 | - '</div>'; | |
| 28 | + `<div class="plugin-card-bottom frm-plugin-search__bottom"><p class="frm-plugin-search__text">${ frmPlugSearch.legend }</p></div>`; | |
| 35 | 29 | |
| 36 | 30 | // Remove link and parent li from action links and move it to bottom row |
| 37 | 31 | const dismissLink = document.querySelector( '.frm-plugin-search__dismiss' ); |
| 38 | 32 | dismissLink.parentNode.remove(); |
| @@ -44,9 +38,9 @@ | ||
| 44 | 38 | * Check if plugin card list nodes changed. If there's a Formidable PSH card, replace the title and the bottom row. |
| 45 | 39 | * |
| 46 | 40 | * @param {Array} mutationsList |
| 47 | 41 | */ |
| 48 | - replaceOnNewResults: function( mutationsList ) { | |
| 42 | + replaceOnNewResults( mutationsList ) { | |
| 49 | 43 | mutationsList.forEach( function( mutation ) { |
| 50 | 44 | if ( |
| 51 | 45 | 'childList' === mutation.type && |
| 52 | 46 | 1 === document.querySelectorAll( '.plugin-card-frm-plugin-search' ).length |
| @@ -58,9 +52,9 @@ | ||
| 58 | 52 | |
| 59 | 53 | /** |
| 60 | 54 | * Start suggesting. |
| 61 | 55 | */ |
| 62 | - init: function() { | |
| 56 | + init() { | |
| 63 | 57 | if ( FormidablePSH.$pluginFilter === null ) { |
| 64 | 58 | return; |
| 65 | 59 | } |
| 66 | 60 | |