| @@ -1,255 +1,257 @@ | ||
| 1 | -import { initElsTomSelect, searchUserOnListPost } from './init-tom-select.js'; | |
| 2 | -import { AdminUtilsFunctions, Api, Utils } from './utils-admin.js'; | |
| 3 | - | |
| 4 | -( function( $ ) { | |
| 5 | - /** | |
| 6 | - * Callback event for button to creating pages inside error message. | |
| 7 | - * | |
| 8 | - * @param {Event} e | |
| 9 | - */ | |
| 10 | - | |
| 11 | - const createPages = function createPages( e ) { | |
| 12 | - const $button = $( this ).addClass( 'disabled' ); | |
| 13 | - e.preventDefault(); | |
| 14 | - $.post( { | |
| 15 | - url: $button.attr( 'href' ), | |
| 16 | - data: { | |
| 17 | - 'lp-ajax': 'create-pages', | |
| 18 | - }, | |
| 19 | - dataType: 'text', | |
| 20 | - success: function success( res ) { | |
| 21 | - const $message = $button.closest( '.lp-notice' ).html( '<p>' + res + '</p>' ); | |
| 22 | - setTimeout( function() { | |
| 23 | - $message.fadeOut(); | |
| 24 | - }, 2000 ); | |
| 25 | - }, | |
| 26 | - } ); | |
| 27 | - }; | |
| 28 | - | |
| 29 | - const lpMetaboxFileInput = () => { | |
| 30 | - $( '.lp-meta-box__file' ).each( ( i, element ) => { | |
| 31 | - let lpImageFrame; | |
| 32 | - | |
| 33 | - const imageGalleryIds = $( element ).find( '.lp-meta-box__file_input' ); | |
| 34 | - const listImages = $( element ).find( '.lp-meta-box__file_list' ); | |
| 35 | - const btnUpload = $( element ).find( '.btn-upload' ); | |
| 36 | - const isMultil = !! $( element ).data( 'multil' ); | |
| 37 | - | |
| 38 | - $( btnUpload ).on( 'click', ( event ) => { | |
| 39 | - event.preventDefault(); | |
| 40 | - | |
| 41 | - if ( lpImageFrame ) { | |
| 42 | - lpImageFrame.open(); | |
| 43 | - return; | |
| 44 | - } | |
| 45 | - | |
| 46 | - lpImageFrame = wp.media( { | |
| 47 | - states: [ | |
| 48 | - new wp.media.controller.Library( { | |
| 49 | - filterable: 'all', | |
| 50 | - multiple: isMultil, | |
| 51 | - } ), | |
| 52 | - ], | |
| 53 | - } ); | |
| 54 | - | |
| 55 | - lpImageFrame.on( 'select', function() { | |
| 56 | - const selection = lpImageFrame.state().get( 'selection' ); | |
| 57 | - let attachmentIds = imageGalleryIds.val(); | |
| 58 | - | |
| 59 | - selection.forEach( function( attachment ) { | |
| 60 | - attachment = attachment.toJSON(); | |
| 61 | - | |
| 62 | - if ( attachment.id ) { | |
| 63 | - if ( ! isMultil ) { | |
| 64 | - attachmentIds = attachment.id; | |
| 65 | - listImages.empty(); | |
| 66 | - } else { | |
| 67 | - attachmentIds = attachmentIds ? attachmentIds + ',' + attachment.id : attachment.id; | |
| 68 | - } | |
| 69 | - | |
| 70 | - listImages.append( | |
| 71 | - '<li class="lp-meta-box__file_list-item image" data-attachment_id="' + attachment.id + '"><img class="is_file" src="' + attachment.icon + | |
| 72 | - '" /><span>' + attachment.filename + '</span><ul class="actions"><li><a href="#" class="delete"></a></li></ul></li>' | |
| 73 | - ); | |
| 74 | - } | |
| 75 | - } ); | |
| 76 | - | |
| 77 | - delImage(); | |
| 78 | - | |
| 79 | - imageGalleryIds.val( attachmentIds ); | |
| 80 | - } ); | |
| 81 | - | |
| 82 | - lpImageFrame.open(); | |
| 83 | - } ); | |
| 84 | - | |
| 85 | - if ( isMultil ) { | |
| 86 | - listImages.sortable( { | |
| 87 | - items: 'li.image', | |
| 88 | - cursor: 'move', | |
| 89 | - scrollSensitivity: 40, | |
| 90 | - forcePlaceholderSize: true, | |
| 91 | - forceHelperSize: false, | |
| 92 | - helper: 'clone', | |
| 93 | - opacity: 0.65, | |
| 94 | - placeholder: 'lp-metabox-sortable-placeholder', | |
| 95 | - start( event, ui ) { | |
| 96 | - ui.item.css( 'background-color', '#f6f6f6' ); | |
| 97 | - }, | |
| 98 | - stop( event, ui ) { | |
| 99 | - ui.item.removeAttr( 'style' ); | |
| 100 | - }, | |
| 101 | - update() { | |
| 102 | - let attachmentIds = ''; | |
| 103 | - | |
| 104 | - listImages.find( 'li.image' ).css( 'cursor', 'default' ).each( function() { | |
| 105 | - const attachmentId = $( this ).attr( 'data-attachment_id' ); | |
| 106 | - attachmentIds = attachmentIds + attachmentId + ','; | |
| 107 | - } ); | |
| 108 | - | |
| 109 | - delImage(); | |
| 110 | - | |
| 111 | - imageGalleryIds.val( attachmentIds ); | |
| 112 | - }, | |
| 113 | - } ); | |
| 114 | - } | |
| 115 | - | |
| 116 | - const delImage = () => { | |
| 117 | - $( listImages ).find( 'li.image' ).each( ( i, ele ) => { | |
| 118 | - const del = $( ele ).find( 'a.delete' ); | |
| 119 | - | |
| 120 | - del.on( 'click', function() { | |
| 121 | - $( ele ).remove(); | |
| 122 | - | |
| 123 | - if ( isMultil ) { | |
| 124 | - let attachmentIds = ''; | |
| 125 | - | |
| 126 | - $( listImages ).find( 'li.image' ).css( 'cursor', 'default' ).each( function() { | |
| 127 | - const attachmentId = $( this ).attr( 'data-attachment_id' ); | |
| 128 | - attachmentIds = attachmentIds + attachmentId + ','; | |
| 129 | - } ); | |
| 130 | - | |
| 131 | - imageGalleryIds.val( attachmentIds ); | |
| 132 | - } else { | |
| 133 | - imageGalleryIds.val( '' ); | |
| 134 | - } | |
| 135 | - | |
| 136 | - return false; | |
| 137 | - } ); | |
| 138 | - } ); | |
| 139 | - }; | |
| 140 | - | |
| 141 | - delImage(); | |
| 142 | - } ); | |
| 143 | - }; | |
| 144 | - | |
| 145 | - const onReady = function onReady() { | |
| 146 | - lpMetaboxFileInput(); | |
| 147 | - //updateDb(); | |
| 148 | - $( '.learn-press-dropdown-pages' ).LP( 'DropdownPages' ); | |
| 149 | - //$( '.learn-press-advertisement-slider' ).LP( 'Advertisement', 'a', 's' ).appendTo( $( '#wpbody-content' ) ); | |
| 150 | - //$( '.learn-press-toggle-item-preview' ).on( 'change', updateItemPreview ); | |
| 151 | - $( '.learn-press-tip' ).LP( 'QuickTip' ); //$('.learn-press-tabs').LP('AdminTab'); | |
| 152 | - | |
| 153 | - $( document ).on( 'click', '#learn-press-create-pages', createPages ) | |
| 154 | - //.on( 'click', '.lp-upgrade-notice .close-notice', hideUpgradeMessage ) | |
| 155 | - //.on( 'click', '.plugin-action-buttons a', pluginActions ) | |
| 156 | - //.on( 'click', '[data-remove-confirm]', preventDefault ) | |
| 157 | - .on( 'mousedown', '.lp-sortable-handle', function( e ) { | |
| 158 | - $( 'html, body' ).addClass( 'lp-item-moving' ); | |
| 159 | - $( e.target ).closest( '.lp-sortable-handle' ).css( 'cursor', 'inherit' ); | |
| 160 | - } ).on( 'mouseup', function( e ) { | |
| 161 | - $( 'html, body' ).removeClass( 'lp-item-moving' ); | |
| 162 | - $( '.lp-sortable-handle' ).css( 'cursor', '' ); | |
| 163 | - } ); | |
| 164 | - | |
| 165 | - // Scroll to Passing grade when click link final Quiz in Course Setting. | |
| 166 | - if ( window.location.hash ) { | |
| 167 | - const hash = window.location.hash; | |
| 168 | - | |
| 169 | - if ( hash === '#_lp_passing_grade' ) { | |
| 170 | - const ele = document.querySelector( hash ); | |
| 171 | - | |
| 172 | - $( 'html, body' ).animate( { | |
| 173 | - scrollTop: $( hash ).offset().top, | |
| 174 | - }, 900, 'swing' ); | |
| 175 | - | |
| 176 | - ele.parentNode.style.border = '2px solid orangered'; | |
| 177 | - } | |
| 178 | - } | |
| 179 | - | |
| 180 | - // Show/hide meta-box field with type checkbox | |
| 181 | - /*$( 'input' ).on( 'click', function( e ) { | |
| 182 | - const el = $( e.target ); | |
| 183 | - if ( ! el.length ) { | |
| 184 | - return; | |
| 185 | - } | |
| 186 | - | |
| 187 | - const id = el.attr( 'id' ); | |
| 188 | - if ( ! id ) { | |
| 189 | - return; | |
| 190 | - } | |
| 191 | - | |
| 192 | - const classHide = id.replace( 'learn_press_', '' ); | |
| 193 | - const elHide = $( `.show_if_${ classHide }` ); | |
| 194 | - | |
| 195 | - if ( el.is( ':checked' ) ) { | |
| 196 | - elHide.show(); | |
| 197 | - } else { | |
| 198 | - elHide.hide(); | |
| 199 | - } | |
| 200 | - } );*/ | |
| 201 | - }; | |
| 202 | - | |
| 203 | - $( document ).ready( onReady ); | |
| 204 | -}( jQuery ) ); | |
| 205 | - | |
| 206 | -const showHideOptionsDependency = ( e, target ) => { | |
| 207 | - if ( target.tagName === 'INPUT' ) { | |
| 208 | - if ( target.closest( '.forminp ' ) ) { | |
| 209 | - const nameInput = target.name; | |
| 210 | - const classDependency = nameInput.replace( 'learn_press_', '' ); | |
| 211 | - | |
| 212 | - const elClassDependency = document.querySelectorAll( `.show_if_${ classDependency }` ); | |
| 213 | - if ( elClassDependency ) { | |
| 214 | - elClassDependency.forEach( ( el ) => { | |
| 215 | - el.classList.toggle( 'lp-option-disabled' ); | |
| 216 | - } ); | |
| 217 | - } | |
| 218 | - } else if ( target.closest( '.lp-meta-box' ) ) { | |
| 219 | - const elLPMetaBox = target.closest( '.lp-meta-box' ); | |
| 220 | - const nameInput = target.name; | |
| 221 | - | |
| 222 | - const elClassDependency = elLPMetaBox.querySelectorAll( `[data-dependency="${ nameInput }"]` ); | |
| 223 | - if ( elClassDependency ) { | |
| 224 | - elClassDependency.forEach( ( el ) => { | |
| 225 | - el.classList.toggle( 'lp-option-disabled' ); | |
| 226 | - } ); | |
| 227 | - } | |
| 228 | - } | |
| 229 | - } | |
| 230 | -}; | |
| 231 | - | |
| 232 | -// Events | |
| 233 | -document.addEventListener( 'click', ( e ) => { | |
| 234 | - const target = e.target; | |
| 235 | - showHideOptionsDependency( e, target ); | |
| 236 | - // For case click add on Widgets of WordPress. | |
| 237 | - initElsTomSelect(); | |
| 238 | -} ); | |
| 239 | - | |
| 240 | -document.addEventListener( 'DOMContentLoaded', () => { | |
| 241 | - searchUserOnListPost(); | |
| 242 | - // Sure that the TomSelect is loaded if listen can't find elements. | |
| 243 | - initElsTomSelect(); | |
| 244 | -} ); | |
| 245 | - | |
| 246 | -// Listen element select created on DOM. | |
| 247 | -Utils.lpOnElementReady( 'select.lp-tom-select', ( e ) => { | |
| 248 | - initElsTomSelect(); | |
| 249 | -} ); | |
| 250 | - | |
| 251 | -Utils.lpOnElementReady( '#posts-filter', ( e ) => { | |
| 252 | - searchUserOnListPost(); | |
| 253 | -} ); | |
| 254 | - | |
| 255 | -window.lpFindTomSelect = initElsTomSelect; | |
| 1 | +import { initElsTomSelect, searchUserOnListPost } from './init-tom-select.js'; | |
| 2 | +import { AdminUtilsFunctions, Api, Utils } from './utils-admin.js'; | |
| 3 | +import { DropdownPages } from './share/dropdown-pages.js'; | |
| 4 | + | |
| 5 | +( function( $ ) { | |
| 6 | + /** | |
| 7 | + * Callback event for button to creating pages inside error message. | |
| 8 | + * | |
| 9 | + * @param {Event} e | |
| 10 | + */ | |
| 11 | + | |
| 12 | + const createPages = function createPages( e ) { | |
| 13 | + const $button = $( this ).addClass( 'disabled' ); | |
| 14 | + e.preventDefault(); | |
| 15 | + $.post( { | |
| 16 | + url: $button.attr( 'href' ), | |
| 17 | + data: { | |
| 18 | + 'lp-ajax': 'create-pages', | |
| 19 | + }, | |
| 20 | + dataType: 'text', | |
| 21 | + success: function success( res ) { | |
| 22 | + const $message = $button.closest( '.lp-notice' ).html( '<p>' + res + '</p>' ); | |
| 23 | + setTimeout( function() { | |
| 24 | + $message.fadeOut(); | |
| 25 | + }, 2000 ); | |
| 26 | + }, | |
| 27 | + } ); | |
| 28 | + }; | |
| 29 | + | |
| 30 | + const lpMetaboxFileInput = () => { | |
| 31 | + $( '.lp-meta-box__file' ).each( ( i, element ) => { | |
| 32 | + let lpImageFrame; | |
| 33 | + | |
| 34 | + const imageGalleryIds = $( element ).find( '.lp-meta-box__file_input' ); | |
| 35 | + const listImages = $( element ).find( '.lp-meta-box__file_list' ); | |
| 36 | + const btnUpload = $( element ).find( '.btn-upload' ); | |
| 37 | + const isMultil = !! $( element ).data( 'multil' ); | |
| 38 | + | |
| 39 | + $( btnUpload ).on( 'click', ( event ) => { | |
| 40 | + event.preventDefault(); | |
| 41 | + | |
| 42 | + if ( lpImageFrame ) { | |
| 43 | + lpImageFrame.open(); | |
| 44 | + return; | |
| 45 | + } | |
| 46 | + | |
| 47 | + lpImageFrame = wp.media( { | |
| 48 | + states: [ | |
| 49 | + new wp.media.controller.Library( { | |
| 50 | + filterable: 'all', | |
| 51 | + multiple: isMultil, | |
| 52 | + } ), | |
| 53 | + ], | |
| 54 | + } ); | |
| 55 | + | |
| 56 | + lpImageFrame.on( 'select', function() { | |
| 57 | + const selection = lpImageFrame.state().get( 'selection' ); | |
| 58 | + let attachmentIds = imageGalleryIds.val(); | |
| 59 | + | |
| 60 | + selection.forEach( function( attachment ) { | |
| 61 | + attachment = attachment.toJSON(); | |
| 62 | + | |
| 63 | + if ( attachment.id ) { | |
| 64 | + if ( ! isMultil ) { | |
| 65 | + attachmentIds = attachment.id; | |
| 66 | + listImages.empty(); | |
| 67 | + } else { | |
| 68 | + attachmentIds = attachmentIds ? attachmentIds + ',' + attachment.id : attachment.id; | |
| 69 | + } | |
| 70 | + | |
| 71 | + listImages.append( | |
| 72 | + '<li class="lp-meta-box__file_list-item image" data-attachment_id="' + attachment.id + '"><img class="is_file" src="' + attachment.icon + | |
| 73 | + '" /><span>' + attachment.filename + '</span><ul class="actions"><li><a href="#" class="delete"></a></li></ul></li>' | |
| 74 | + ); | |
| 75 | + } | |
| 76 | + } ); | |
| 77 | + | |
| 78 | + delImage(); | |
| 79 | + | |
| 80 | + imageGalleryIds.val( attachmentIds ); | |
| 81 | + } ); | |
| 82 | + | |
| 83 | + lpImageFrame.open(); | |
| 84 | + } ); | |
| 85 | + | |
| 86 | + if ( isMultil ) { | |
| 87 | + listImages.sortable( { | |
| 88 | + items: 'li.image', | |
| 89 | + cursor: 'move', | |
| 90 | + scrollSensitivity: 40, | |
| 91 | + forcePlaceholderSize: true, | |
| 92 | + forceHelperSize: false, | |
| 93 | + helper: 'clone', | |
| 94 | + opacity: 0.65, | |
| 95 | + placeholder: 'lp-metabox-sortable-placeholder', | |
| 96 | + start( event, ui ) { | |
| 97 | + ui.item.css( 'background-color', '#f6f6f6' ); | |
| 98 | + }, | |
| 99 | + stop( event, ui ) { | |
| 100 | + ui.item.removeAttr( 'style' ); | |
| 101 | + }, | |
| 102 | + update() { | |
| 103 | + let attachmentIds = ''; | |
| 104 | + | |
| 105 | + listImages.find( 'li.image' ).css( 'cursor', 'default' ).each( function() { | |
| 106 | + const attachmentId = $( this ).attr( 'data-attachment_id' ); | |
| 107 | + attachmentIds = attachmentIds + attachmentId + ','; | |
| 108 | + } ); | |
| 109 | + | |
| 110 | + delImage(); | |
| 111 | + | |
| 112 | + imageGalleryIds.val( attachmentIds ); | |
| 113 | + }, | |
| 114 | + } ); | |
| 115 | + } | |
| 116 | + | |
| 117 | + const delImage = () => { | |
| 118 | + $( listImages ).find( 'li.image' ).each( ( i, ele ) => { | |
| 119 | + const del = $( ele ).find( 'a.delete' ); | |
| 120 | + | |
| 121 | + del.on( 'click', function() { | |
| 122 | + $( ele ).remove(); | |
| 123 | + | |
| 124 | + if ( isMultil ) { | |
| 125 | + let attachmentIds = ''; | |
| 126 | + | |
| 127 | + $( listImages ).find( 'li.image' ).css( 'cursor', 'default' ).each( function() { | |
| 128 | + const attachmentId = $( this ).attr( 'data-attachment_id' ); | |
| 129 | + attachmentIds = attachmentIds + attachmentId + ','; | |
| 130 | + } ); | |
| 131 | + | |
| 132 | + imageGalleryIds.val( attachmentIds ); | |
| 133 | + } else { | |
| 134 | + imageGalleryIds.val( '' ); | |
| 135 | + } | |
| 136 | + | |
| 137 | + return false; | |
| 138 | + } ); | |
| 139 | + } ); | |
| 140 | + }; | |
| 141 | + | |
| 142 | + delImage(); | |
| 143 | + } ); | |
| 144 | + }; | |
| 145 | + | |
| 146 | + const onReady = function onReady() { | |
| 147 | + lpMetaboxFileInput(); | |
| 148 | + //updateDb(); | |
| 149 | + const dropdownPages = new DropdownPages(); | |
| 150 | + dropdownPages.init(); | |
| 151 | + //$( '.learn-press-advertisement-slider' ).LP( 'Advertisement', 'a', 's' ).appendTo( $( '#wpbody-content' ) ); | |
| 152 | + //$( '.learn-press-toggle-item-preview' ).on( 'change', updateItemPreview ); | |
| 153 | + $( '.learn-press-tip' ).LP( 'QuickTip' ); //$('.learn-press-tabs').LP('AdminTab'); | |
| 154 | + | |
| 155 | + $( document ).on( 'click', '#learn-press-create-pages', createPages ) | |
| 156 | + //.on( 'click', '.lp-upgrade-notice .close-notice', hideUpgradeMessage ) | |
| 157 | + //.on( 'click', '.plugin-action-buttons a', pluginActions ) | |
| 158 | + //.on( 'click', '[data-remove-confirm]', preventDefault ) | |
| 159 | + .on( 'mousedown', '.lp-sortable-handle', function( e ) { | |
| 160 | + $( 'html, body' ).addClass( 'lp-item-moving' ); | |
| 161 | + $( e.target ).closest( '.lp-sortable-handle' ).css( 'cursor', 'inherit' ); | |
| 162 | + } ).on( 'mouseup', function( e ) { | |
| 163 | + $( 'html, body' ).removeClass( 'lp-item-moving' ); | |
| 164 | + $( '.lp-sortable-handle' ).css( 'cursor', '' ); | |
| 165 | + } ); | |
| 166 | + | |
| 167 | + // Scroll to Passing grade when click link final Quiz in Course Setting. | |
| 168 | + if ( window.location.hash ) { | |
| 169 | + const hash = window.location.hash; | |
| 170 | + | |
| 171 | + if ( hash === '#_lp_passing_grade' ) { | |
| 172 | + const ele = document.querySelector( hash ); | |
| 173 | + | |
| 174 | + $( 'html, body' ).animate( { | |
| 175 | + scrollTop: $( hash ).offset().top, | |
| 176 | + }, 900, 'swing' ); | |
| 177 | + | |
| 178 | + ele.parentNode.style.border = '2px solid orangered'; | |
| 179 | + } | |
| 180 | + } | |
| 181 | + | |
| 182 | + // Show/hide meta-box field with type checkbox | |
| 183 | + /*$( 'input' ).on( 'click', function( e ) { | |
| 184 | + const el = $( e.target ); | |
| 185 | + if ( ! el.length ) { | |
| 186 | + return; | |
| 187 | + } | |
| 188 | + | |
| 189 | + const id = el.attr( 'id' ); | |
| 190 | + if ( ! id ) { | |
| 191 | + return; | |
| 192 | + } | |
| 193 | + | |
| 194 | + const classHide = id.replace( 'learn_press_', '' ); | |
| 195 | + const elHide = $( `.show_if_${ classHide }` ); | |
| 196 | + | |
| 197 | + if ( el.is( ':checked' ) ) { | |
| 198 | + elHide.show(); | |
| 199 | + } else { | |
| 200 | + elHide.hide(); | |
| 201 | + } | |
| 202 | + } );*/ | |
| 203 | + }; | |
| 204 | + | |
| 205 | + $( document ).ready( onReady ); | |
| 206 | +}( jQuery ) ); | |
| 207 | + | |
| 208 | +const showHideOptionsDependency = ( e, target ) => { | |
| 209 | + if ( target.tagName === 'INPUT' ) { | |
| 210 | + if ( target.closest( '.forminp ' ) ) { | |
| 211 | + const nameInput = target.name; | |
| 212 | + const classDependency = nameInput.replace( 'learn_press_', '' ); | |
| 213 | + | |
| 214 | + const elClassDependency = document.querySelectorAll( `.show_if_${ classDependency }` ); | |
| 215 | + if ( elClassDependency ) { | |
| 216 | + elClassDependency.forEach( ( el ) => { | |
| 217 | + el.classList.toggle( 'lp-option-disabled' ); | |
| 218 | + } ); | |
| 219 | + } | |
| 220 | + } else if ( target.closest( '.lp-meta-box' ) ) { | |
| 221 | + const elLPMetaBox = target.closest( '.lp-meta-box' ); | |
| 222 | + const nameInput = target.name; | |
| 223 | + | |
| 224 | + const elClassDependency = elLPMetaBox.querySelectorAll( `[data-dependency="${ nameInput }"]` ); | |
| 225 | + if ( elClassDependency ) { | |
| 226 | + elClassDependency.forEach( ( el ) => { | |
| 227 | + el.classList.toggle( 'lp-option-disabled' ); | |
| 228 | + } ); | |
| 229 | + } | |
| 230 | + } | |
| 231 | + } | |
| 232 | +}; | |
| 233 | + | |
| 234 | +// Events | |
| 235 | +document.addEventListener( 'click', ( e ) => { | |
| 236 | + const target = e.target; | |
| 237 | + showHideOptionsDependency( e, target ); | |
| 238 | + // For case click add on Widgets of WordPress. | |
| 239 | + initElsTomSelect(); | |
| 240 | +} ); | |
| 241 | + | |
| 242 | +document.addEventListener( 'DOMContentLoaded', () => { | |
| 243 | + searchUserOnListPost(); | |
| 244 | + // Sure that the TomSelect is loaded if listen can't find elements. | |
| 245 | + initElsTomSelect(); | |
| 246 | +} ); | |
| 247 | + | |
| 248 | +// Listen element select created on DOM. | |
| 249 | +Utils.lpOnElementReady( 'select.lp-tom-select', ( e ) => { | |
| 250 | + initElsTomSelect(); | |
| 251 | +} ); | |
| 252 | + | |
| 253 | +Utils.lpOnElementReady( '#posts-filter', ( e ) => { | |
| 254 | + searchUserOnListPost(); | |
| 255 | +} ); | |
| 256 | + | |
| 257 | +window.lpFindTomSelect = initElsTomSelect; | |