File manager - Edit - /home/infoilmg/public_html/wp-content/plugins/fs-poster/App/Pages/Share/Assets/js/fsp-share.js
Back
'use strict'; ( function ( $ ) { let doc = $( document ); doc.ready( function () { let frame = wp.media( { title: fsp__( 'Select or upload image' ), button: { text: fsp__( 'Use this media' ) }, multiple: false, library: { type: 'image' } } ); let saveID = FSPObject.saveID; frame.on( 'select', function () { var attachment = frame.state().get( 'selection' ).first().toJSON(); $( '#imageID' ).val( attachment.id ); $( '#imageShow' ).removeClass( 'fsp-hide' ).data( 'id', attachment.id ).children( 'img' ).attr( 'src', attachment.url ); $( '#wpMediaBtn, #fspShareURL' ).addClass( 'fsp-hide' ); } ); $( '#wpMediaBtn' ).click( function ( event ) { frame.open(); } ); $( '.saveBtn' ).click( function () { savePost( false, function () { FSPoster.toast( 'Saved successfully!', 'success' ); } ); } ); $( '#closeImg' ).click( function () { $( '#imageShow' ).addClass( 'fsp-hide' ).children( 'img' ).attr( 'src', '' ).data( 'id', 0 ); $( '#wpMediaBtn, #fspShareURL' ).removeClass( 'fsp-hide' ); } ); function savePost ( tmp, callback ) { var link = $( '.link_url' ).val().trim(), message = $( '.message_box' ).val().trim(), image = $( '#imageShow' ).data( 'id' ); FSPoster.ajax( 'manual_share_save', { 'id': saveID, 'link': link, 'message': message, 'image': image, 'tmp': tmp ? 1 : 0 }, function ( result ) { saveID = result[ 'id' ]; var url = window.location.href; if ( url.indexOf( 'post_id=' ) > -1 ) { url = url.replace( /post_id\=([0-9]+)/, 'post_id=' + saveID, url ); } else { url += ( url.indexOf( '?' ) > -1 ? '&' : '?' ) + 'post_id=' + saveID; } window.history.pushState( '', '', url ); if ( typeof callback === 'function' ) { callback(); } } ); } // direct share tab shcedule button $( '.schedule_button' ).click( function () { savePost( false, function () { let nodes = []; $( '.fsp-metabox-accounts input[name="share_on_nodes[]"]' ).each( function () { nodes.push( $( this ).val() ); } ); FSPoster.loadModal( 'add_schedule', { 'post_ids': saveID, 'nodes': nodes, 'not_include_js': 1 } ); } ); } ); $( '.shareNowBtn' ).click( function () { savePost( true, function () { var nodes = []; $( '.fsp-metabox-accounts input[name=\'share_on_nodes[]\']' ).each( function () { nodes.push( $( this ).val() ); } ); if ( nodes.length == 0 ) { FSPoster.toast( fsp__( 'No selected account!' ), 'warning' ); return; } FSPoster.ajax( 'share_saved_post', { 'post_id': saveID, 'nodes': nodes, 'background': 0 }, function () { FSPoster.loadModal( 'share_feeds', { 'post_id': saveID }, true ); } ); } ); } ); $( '.delete_post_btn' ).click( function () { var tr = $( this ).closest( '.fsp-share-post' ), post_id = tr.data( 'id' ); FSPoster.confirm( 'Are you sure you want to delete?', function () { FSPoster.ajax( 'manual_share_delete', { 'id': post_id }, function () { tr.fadeOut( 500, function () { if ( post_id === saveID ) { window.location.href = '?page=fs-poster-share'; } $( this ).remove(); } ); } ); } ); } ); $( '.message_box' ).on( 'input, keyup', function () { $( '#fspShareCharCount' ).text( $( this ).val().length ); } ).trigger( 'keyup' ); $( '#fspClearSavedPosts' ).on( 'click', function () { FSPoster.confirm( fsp__( 'Are you sure you want to clear saved posts?' ), function () { FSPoster.ajax( 'fs_clear_saved_posts', {}, function () { window.location.reload(); } ); } ); } ); } ); } )( jQuery );
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Generation time: 0.06 |
proxy
|
phpinfo
|
Settings