notifications.js
53 lines
| 1 | ( function ( $ ) { |
| 2 | 'use strict'; |
| 3 | $( document ).ready( function () { |
| 4 | $.each( $( '.sp-notification-item-content' ), function ( i, el ) { |
| 5 | var $wrap = $( el ).closest( '.sp-notification-item' ); |
| 6 | if ( el.offsetWidth < el.scrollWidth ) { |
| 7 | $wrap |
| 8 | .find( '.sp-notification-item-content-show-more svg' ) |
| 9 | .css( 'display', 'flex' ); |
| 10 | } |
| 11 | } ); |
| 12 | |
| 13 | $( document ).on( |
| 14 | 'click', |
| 15 | '.sp-notification-item-content-show-more svg', |
| 16 | function ( e ) { |
| 17 | e.preventDefault(); |
| 18 | |
| 19 | jQuery( this ) |
| 20 | .closest( '.sp-notification-item-content-show-more' ) |
| 21 | .toggleClass( 'show-more' ) |
| 22 | .closest( '.sp-notification-item' ) |
| 23 | .find( '.sp-notification-item-content' ) |
| 24 | .toggleClass( 'show-more' ); |
| 25 | } |
| 26 | ); |
| 27 | |
| 28 | $( document ).on( |
| 29 | 'click', |
| 30 | '.sp-notification-view-add-review-open-popup', |
| 31 | function ( e ) { |
| 32 | e.preventDefault(); |
| 33 | var $this = $( this ), |
| 34 | $id = $this.attr( 'href' ); |
| 35 | |
| 36 | $( $id ).addClass( 'open' ); |
| 37 | $( $id ).fadeIn(); |
| 38 | } |
| 39 | ); |
| 40 | |
| 41 | $( document ).on( |
| 42 | 'click', |
| 43 | '.sp-notification-view-add-review-close-popup', |
| 44 | function () { |
| 45 | $( this ) |
| 46 | .closest( '.sp-notification-view-add-review-popup' ) |
| 47 | .removeClass( 'open' ) |
| 48 | .fadeOut(); |
| 49 | } |
| 50 | ); |
| 51 | } ); |
| 52 | } )( jQuery ); |
| 53 |