File manager - Edit - /home/infoilmg/public_html/wp-content/plugins/fs-poster/App/Pages/Accounts/Assets/js/fsp-accounts.js
Back
'use strict'; (function ($) { let doc = $( document ); doc.ready( function () { let currentComponent; doc.on( 'click', '.fsp-tab[data-component]', function () { let _this = $( this ); let filter_by = FSPObject.filter_by; currentComponent = _this.data( 'component' ); if ( currentComponent ) { if ( $( '#fspSelectMode' ).data( 'mode' ) === 'select' ) { $( '.fsp-account-selectbox:checked' ).click(); $( '#fspSelectMode' ).click(); } $( '.fsp-tab.fsp-is-active' ).removeClass( 'fsp-is-active' ); _this.addClass( 'fsp-is-active' ); FSPoster.ajax( 'get_accounts', { name: currentComponent }, function (res) { $( '#fspComponent' ).html( FSPoster.htmlspecialchars_decode( res[ 'html' ] ) ); $( '.fsp-accounts-add-button > span' ).text( res[ 'extra' ][ 'button_text' ] ); let fspAccountsCount = FSPObject.accountsCount; let loadModal = FSPObject.modalURL; _this.find( '.fsp-tab-all' ).text( fspAccountsCount ); $( '.fsp-accounts-add-button' ).attr( 'data-load-modal', loadModal ); if ( $( '.fsp-account-checkbox > .fsp-is-checked, .fsp-account-checkbox > .fsp-is-checked-conditionally' ).length > 0 ) { $( '.fsp-tab.fsp-is-active > .fsp-tab-badges' ).addClass( 'fsp-has-active-accounts' ); } else { $( '.fsp-tab.fsp-is-active > .fsp-tab-badges' ).removeClass( 'fsp-has-active-accounts' ); } filterAccounts( filter_by ); } ); window.history.pushState( {}, '', `?page=fs-poster-accounts&tab=${ currentComponent }&filter_by=${ filter_by }` ); } } ).on( 'click', function (e) { if ( ! $( e.target ).is( '.fsp-account-checkbox, .fsp-account-checkbox > i' ) ) { $( '#fspActivateMenu' ).hide(); } if ( ! $( e.target ).is( '.fsp-account-more, .fsp-account-more > i' ) ) { $( '#fspMoreMenu' ).hide(); } } ).on( 'click', '.fsp-modal-option', function () { let _this = $( this ); let step = _this.data( 'step' ); $( '.fsp-modal-option.fsp-is-selected' ).removeClass( 'fsp-is-selected' ); _this.addClass( 'fsp-is-selected' ); if ( step ) { if ( $( `#fspModalStep_${ step }` ).length ) { $( '.fsp-modal-step' ).addClass( 'fsp-hide' ); $( `#fspModalStep_${ step }` ).removeClass( 'fsp-hide' ); } } } ).on( 'click', '.fspjs-refetch-account', function () { let accountID = $( this ).data( 'id' ); FSPoster.ajax( 'refetch_account', { 'account_id': accountID }, function () { $( '.fsp-tab.fsp-is-active' ).click(); } ); } ).on( 'change', '#fspUseProxy', function () { let checked = ! ($( this ).is( ':checked' )); $( '#fspProxy' ).val( '' ); $( '#fspProxyContainer' ).toggleClass( 'fsp-hide', checked ); } ).on( 'click', function () { let checkedAccounts = $( '.fsp-account-selectbox:checked' ); let checkedAccountsLength = checkedAccounts.length; $( '#fspSelectedAccountsAction option:first' ).text( `Select an action (${ checkedAccountsLength })` ); if ( checkedAccountsLength > 0 ) { $( '#fspSelectedAccountsAction' ).prop( 'disabled', false ); $( '#fspToggleSelectboxes' ).text( fsp__( 'UNSELECT ALL' ) ); } else { $( '#fspSelectedAccountsAction' ).prop( 'disabled', true ); $( '#fspToggleSelectboxes' ).text( fsp__( 'SELECT ALL' ) ); } } ).on( 'click', '.fspjs-hide-account', function () { let _this = $( this ); let menuDiv = _this.parent(); let id = menuDiv.data( 'id' ); let type = menuDiv.data( 'type' ) === 'account' ? 'account' : 'node'; let hidden = menuDiv.data( 'hidden' ) ? 0 : 1; FSPoster.ajax( `hide_unhide_${ type }`, { id, hidden }, function () { $( '.fsp-tab.fsp-is-active' ).click(); } ); } ); $( '.fsp-tab.fsp-is-active' ).click(); let component = $( '#fspComponent' ); component.on( 'click', '.fsp-account-more', function () { let _this = $( this ); let accountDiv = _this.parent().parent(); let id = accountDiv.data( 'id' ); let type = accountDiv.data( 'type' ) ? accountDiv.data( 'type' ) : 'account'; let hidden = accountDiv.data( 'hidden' ) ? 1 : 0; if ( hidden ) { $( '#fspMoreMenu > [data-type="hide"]' ).addClass( 'fsp-hide' ); $( '#fspMoreMenu > [data-type="unhide"]' ).removeClass( 'fsp-hide' ); } else { $( '#fspMoreMenu > [data-type="hide"]' ).removeClass( 'fsp-hide' ); $( '#fspMoreMenu > [data-type="unhide"]' ).addClass( 'fsp-hide' ); } if ( accountDiv.find( '.fsp-account-is-public' ).hasClass( 'fsp-hide' ) ) { $( '#fspMoreMenu > [data-type="public"]' ).removeClass( 'fsp-hide' ); $( '#fspMoreMenu > [data-type="private"]' ).addClass( 'fsp-hide' ); } else { $( '#fspMoreMenu > [data-type="public"]' ).addClass( 'fsp-hide' ); $( '#fspMoreMenu > [data-type="private"]' ).removeClass( 'fsp-hide' ); } let top = _this.offset().top + 25 - $( window ).scrollTop(); let left = _this.offset().left - ($( '#fspMoreMenu' ).width()) + 10; $( '#fspMoreMenu' ).data( 'hidden', hidden ).data( 'id', id ).data( 'type', type ).css( { top: top, left: left } ).show(); } ).on( 'click', '.fsp-account-checkbox', function () { let _this = $( this ); let accountDiv = _this.parent().parent(); let id = accountDiv.data( 'id' ); let type = accountDiv.data( 'type' ) ? _this.parent().parent().data( 'type' ) : 'account'; if ( accountDiv.data( 'active' ) ) { $( '#fspActivatesDiv' ).hide(); $( '#fspDeactivatesDiv' ).show(); } else { $( '#fspActivatesDiv' ).show(); $( '#fspDeactivatesDiv' ).hide(); } let top = _this.offset().top + 25 - $( window ).scrollTop(); let left = _this.offset().left - ($( '#fspActivateMenu' ).width()) + 10; $( '#fspActivateMenu' ).data( 'id', id ).data( 'type', type ).css( { top: top, left: left } ).show(); } ).on( 'click', '.fsp-account-caret', function () { let _this = $( this ); let nodesDiv = _this.parent().parent().parent().find( '.fsp-account-nodes-container' ); if ( nodesDiv.css( 'display' ) === 'none' ) { nodesDiv.slideDown(); _this.addClass( 'fsp-is-rotated' ); } else { nodesDiv.slideUp(); _this.removeClass( 'fsp-is-rotated' ); } } ); $( '#fspActivateMenu > #fspActivateConditionally' ).on( 'click', function () { let _this = $( this ); let menuDiv = _this.parent(); let id = menuDiv.data( 'id' ); let type = menuDiv.data( 'type' ) === 'community' ? 'node' : 'account'; FSPoster.loadModal( 'activate_with_condition', { id, type } ); if ( $( '.fsp-account-checkbox > .fsp-is-checked, .fsp-account-checkbox > .fsp-is-checked-conditionally' ).length > 0 ) { $( '.fsp-tab.fsp-is-active > .fsp-tab-badges' ).addClass( 'fsp-has-active-accounts' ); } else { $( '.fsp-tab.fsp-is-active > .fsp-tab-badges' ).removeClass( 'fsp-has-active-accounts' ); } } ); $( '#fspActivateMenu #fspActivate' ).on( 'click', function () { let _this = $( this ); let menuDiv = _this.parent().parent(); let id = menuDiv.data( 'id' ); let type = menuDiv.data( 'type' ); let ajaxType = type === 'community' ? 'settings_node_activity_change' : 'account_activity_change'; let accountDiv = $( `.fsp-account-item[data-id=${ id }][data-type="${ type }"]` ); FSPoster.ajax( ajaxType, { id, checked: 1 } ); accountDiv.find( '.fsp-account-checkbox > i' ).removeClass( 'far' ).addClass( 'fas fsp-is-checked' ); accountDiv.data( 'active', 1 ); if ( $( '.fsp-account-checkbox > .fsp-is-checked, .fsp-account-checkbox > .fsp-is-checked-conditionally' ).length > 0 ) { $( '.fsp-tab.fsp-is-active > .fsp-tab-badges' ).addClass( 'fsp-has-active-accounts' ); } else { $( '.fsp-tab.fsp-is-active > .fsp-tab-badges' ).removeClass( 'fsp-has-active-accounts' ); } } ); $( '#fspActivateMenu #fspActivateForAll' ).on( 'click', function () { let _this = $( this ); let menuDiv = _this.parent().parent(); let id = menuDiv.data( 'id' ); let type = menuDiv.data( 'type' ); let ajaxType = type === 'community' ? 'settings_node_activity_change' : 'account_activity_change'; let accountDiv = $( `.fsp-account-item[data-id=${ id }][data-type="${ type }"]` ); FSPoster.ajax( ajaxType, { id, checked: 1, for_all: 1 } ); accountDiv.find( '.fsp-account-checkbox > i' ).removeClass( 'far' ).addClass( 'fas fsp-is-checked' ); accountDiv.data( 'active', 1 ); if ( $( '.fsp-account-checkbox > .fsp-is-checked, .fsp-account-checkbox > .fsp-is-checked-conditionally' ).length > 0 ) { $( '.fsp-tab.fsp-is-active > .fsp-tab-badges' ).addClass( 'fsp-has-active-accounts' ); } else { $( '.fsp-tab.fsp-is-active > .fsp-tab-badges' ).removeClass( 'fsp-has-active-accounts' ); } let ajaxAction = type === 'community' ? 'settings_node_make_public' : 'make_account_public'; FSPoster.ajax( ajaxAction, { id, checked: 1 }, function () { accountDiv.find( '.fsp-account-is-public' ).removeClass( 'fsp-hide' ); } ); } ); $( '#fspActivateMenu #fspDeactivate' ).on( 'click', function () { let _this = $( this ); let menuDiv = _this.parent().parent(); let id = menuDiv.data( 'id' ); let type = menuDiv.data( 'type' ); let ajaxAction = type === 'community' ? 'settings_node_activity_change' : 'account_activity_change'; let accountDiv = $( `.fsp-account-item[data-id=${ id }][data-type="${ type }"]` ); FSPoster.ajax( ajaxAction, { id, checked: 0 } ); accountDiv.find( '.fsp-account-checkbox > i' ).removeClass( 'fas fsp-is-checked fsp-is-checked-conditionally' ).addClass( 'far' ); accountDiv.data( 'active', 0 ); if ( $( '.fsp-account-checkbox > .fsp-is-checked, .fsp-account-checkbox > .fsp-is-checked-conditionally' ).length > 0 ) { $( '.fsp-tab.fsp-is-active > .fsp-tab-badges' ).addClass( 'fsp-has-active-accounts' ); } else { $( '.fsp-tab.fsp-is-active > .fsp-tab-badges' ).removeClass( 'fsp-has-active-accounts' ); } } ); $( '#fspActivateMenu #fspDeactivateForAll' ).on( 'click', function () { let _this = $( this ); let menuDiv = _this.parent().parent(); let id = menuDiv.data( 'id' ); let type = menuDiv.data( 'type' ); let ajaxAction = type === 'community' ? 'settings_node_activity_change' : 'account_activity_change'; let accountDiv = $( `.fsp-account-item[data-id=${ id }][data-type="${ type }"]` ); FSPoster.ajax( ajaxAction, { id, checked: 0, for_all: 1 } ); accountDiv.find( '.fsp-account-checkbox > i' ).removeClass( 'fas fsp-is-checked fsp-is-checked-conditionally' ).addClass( 'far' ); accountDiv.data( 'active', 0 ); if ( $( '.fsp-account-checkbox > .fsp-is-checked, .fsp-account-checkbox > .fsp-is-checked-conditionally' ).length > 0 ) { $( '.fsp-tab.fsp-is-active > .fsp-tab-badges' ).addClass( 'fsp-has-active-accounts' ); } else { $( '.fsp-tab.fsp-is-active > .fsp-tab-badges' ).removeClass( 'fsp-has-active-accounts' ); } ajaxAction = type === 'community' ? 'settings_node_make_public' : 'make_account_public'; FSPoster.ajax( ajaxAction, { id, checked: 0 }, function () { accountDiv.find( '.fsp-account-is-public' ).addClass( 'fsp-hide' ); } ); } ); $( '#fspMoreMenu > .fsp-make-public' ).on( 'click', function () { let _this = $( this ); let menuDiv = _this.parent(); let id = menuDiv.data( 'id' ); let type = menuDiv.data( 'type' ); let accountDiv = $( `.fsp-account-item[data-id=${ id }][data-type="${ type }"]` ); let isChecked = ! accountDiv.find( '.fsp-account-is-public' ).hasClass( 'fsp-hide' ); let ajaxAction = type === 'community' ? 'settings_node_make_public' : 'make_account_public'; FSPoster.ajax( ajaxAction, { id, checked: isChecked ? 0 : 1 }, function () { if ( isChecked ) { accountDiv.find( '.fsp-account-is-public' ).addClass( 'fsp-hide' ); } else { accountDiv.find( '.fsp-account-is-public' ).removeClass( 'fsp-hide' ); } } ); } ); $( '#fspMoreMenu > #fspDelete' ).on( 'click', function () { let _this = $( this ); let menuDiv = _this.parent(); let id = menuDiv.data( 'id' ); let type = menuDiv.data( 'type' ); let accountDiv = $( `.fsp-account-item[data-id=${ id }][data-type="${ type }"]` ); FSPoster.confirm( fsp__( 'Are you sure you want to delete?' ), function () { let ajaxAction = type === 'community' ? 'settings_node_delete' : 'delete_account'; FSPoster.ajax( ajaxAction, { id }, function () { if ( type === 'community' ) { $( '.fsp-tab.fsp-is-active' ).click(); } else { $( '.fsp-tab.fsp-is-active' ).click(); } } ); } ); } ); $( '#fspSelectMode' ).on( 'click', function () { let _this = $( this ); let currentMode = $( this ).data( 'mode' ); let accountsCount = $( '.fsp-account-selectbox' ).length; if ( currentMode === 'ui' && accountsCount > 0 ) // select mode choosed { $( '#fspSelectedAccountsActionContainer, #fspToggleSelectboxes' ).removeClass( 'fsp-hide' ); $( '.fsp-account-inline.fsp-is-buttons-container' ).hide(); $( '.fsp-account-inline.fsp-is-select-container' ).show(); _this.data( 'mode', 'select' ); $( '.fsp-account-nodes-container' ).attr( 'style', 'overflow-y: visible !important; max-height: unset;' ); _this.html( `<i class="fas fa-undo"></i> <span>${ fsp__( 'EXIT BULK ACTION' ) }</span>` ); } else { let checkedAccounts = $( '.fsp-account-selectbox:checked' ); let exit = function () { $( '#fspSelectedAccountsActionContainer, #fspToggleSelectboxes' ).addClass( 'fsp-hide' ); $( '.fsp-account-inline.fsp-is-select-container' ).hide(); $( '.fsp-account-inline.fsp-is-buttons-container' ).show(); _this.data( 'mode', 'ui' ); $( '.fsp-account-nodes-container' ).attr( 'style', 'overflow-y: auto !important; max-height: 200px;' ); _this.html( `<i class="far fa-clone"></i> <span>${ fsp__( 'BULK ACTION' ) }</span>` ); } if ( checkedAccounts.length > 0 ) { FSPoster.confirm( fsp__( 'Are you sure you want to exit without applying any action for the selected accounts?' ), function () { exit(); checkedAccounts.click(); }, 'fas fa-exclamation-triangle', fsp__( 'YES, EXIT' ) ); } else { exit(); } } } ); $( '#fspToggleSelectboxes' ).on( 'click', function () { let checkedAccounts = $( '.fsp-account-selectbox:checked' ); if ( checkedAccounts.length > 0 ) { checkedAccounts.click(); } else { $( '.fsp-account-selectbox:not(:checked)' ).click(); } } ); $( '#fspSelectedAccountsAction' ).on( 'change', function () { let _this = $( this ); let act = _this.val(); let actText = _this.find( 'option:selected' ).data( 'text' ); let ids = []; $( '.fsp-account-selectbox:checked' ).each( function () { let id = $( this ).data( 'id' ); let type = $( this ).data( 'type' ); ids.push( { id, type } ); } ); if ( act !== '' ) { if ( act === 'activate_condition' ) { FSPoster.loadModal( 'activate_with_condition', { ids } ); } else { FSPoster.confirm( actText, function () { FSPoster.ajax( 'bulk_account_action', { ids, act }, function () { $( '.fsp-tab.fsp-is-active' ).click(); } ); }, 'fas fa-question', `YES, CONTINUE` ); } } _this.val( '' ); } ); $( '#fspAccountsFilterSelector' ).on( 'change', function () { let filter_by = $( this ).val(); let url = window.location.href; filterAccounts( filter_by ); if ( url.indexOf( 'filter_by' ) > -1 ) { url = url.replace( /filter_by=([a-zA-Z]+)/, `filter_by=${ filter_by }` ); } else { url += `${ (url.indexOf( '?' ) > -1 ? '&' : '?') }filter_by=${ filter_by }` } if ( $( '#fspSelectMode' ).data( 'mode' ) === 'ui' ) { window.history.pushState( '', '', url ); $.get( url ); FSPObject.filter_by = filter_by; } } ); $( '#fspCollapseAccounts' ).on( 'click', function () { $( '.fsp-account-caret.fsp-is-rotated' ).click(); } ); $( '#fspExpandAccounts' ).on( 'click', function () { $( '.fsp-account-caret:not(.fsp-is-rotated)' ).click(); } ); } ); })( jQuery ); function accountAdded () { if ( typeof jQuery !== 'undefined' ) { $ = jQuery; } let modalBody = $( '.fsp-modal-body' ); if ( modalBody.length ) { $( '.fsp-modal-footer' ).remove(); modalBody.html( `<div class="fsp-modal-succeed"><div class="fsp-modal-succeed-image"><img src="${ FSPoster.asset( 'Base', 'img/success.svg' ) }"></div><div class="fsp-modal-succeed-text">${ fsp__( 'Account has been added successfully!' ) }</div><div class="fsp-modal-succeed-button"><button class="fsp-button" data-modal-close="true">${ fsp__( 'CLOSE' ) }</button></div></div>` ); $( '.fsp-tab.fsp-is-active' ).click(); } } function filterAccounts (filter_by = 'all') { if ( typeof jQuery !== 'undefined' ) { $ = jQuery; } if ( filter_by === 'all' ) { $( '.fsp-account-item' ).show(); } else if ( filter_by === 'active' ) { $( '.fsp-account-item[data-active=1]' ).show(); $( '.fsp-account-item[data-active=0]' ).slideUp( 100 ); } else if ( filter_by === 'inactive' ) { $( '.fsp-account-item[data-active=0]' ).show(); $( '.fsp-account-item[data-active=1]' ).hide(); } else if ( filter_by === 'visible' ) { $( '.fsp-account-item[data-hidden=0]' ).show(); $( '.fsp-account-item[data-hidden=1]' ).hide(); } else if ( filter_by === 'hidden' ) { $( '.fsp-account-item[data-hidden=1]' ).show(); $( '.fsp-account-item[data-hidden=0]' ).hide(); } else if ( filter_by === 'failed' ) { $( '.fsp-account-item[data-failed=1]' ).show(); $( '.fsp-account-item[data-failed=0]' ).hide(); } setTimeout( function () { if ( $( '.fsp-account-item:visible' ).length === 0 ) { $( '.fsp-emptiness' ).removeClass( 'fsp-hide' ); } else { $( '.fsp-emptiness' ).addClass( 'fsp-hide' ); } }, 200 ); }
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Generation time: 0.05 |
proxy
|
phpinfo
|
Settings