HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux vm8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: afleverb (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //var/www/mussarq_bak2/wp-content/themes/wpnull24/framework/admin/js/media-views.js
window.wp = window.wp || {};

( function( $ ) {

	var media = wp.media,
		curAttachmentsBrowser = media.view.AttachmentsBrowser;

	media.view.AttachmentFilters.Taxonomy = media.view.AttachmentFilters.extend( {
		tagName: 'select',
		createFilters: function() {
			var filters = {},
				that = this;

			_.each( that.options.termList || {}, function( term, key ) {
				var term_id = term[ 'term_id' ],
					term_name = $( '<div/>' ).html( term[ 'term_name' ] ).text();

				filters[ term_id ] = {
					text: term_name,
					priority: key + 2
				};

				filters[ term_id ][ 'props' ] = {};
				filters[ term_id ][ 'props' ][ that.options.taxonomy ] = term_id;
			} );

			filters.all = {
				text: that.options.termListTitle,
				priority: 1
			};

			filters[ 'all' ][ 'props' ] = {};
			filters[ 'all' ][ 'props' ][ that.options.taxonomy ] = null;

			this.filters = filters;
		}
	} );

	media.view.AttachmentsBrowser = media.view.AttachmentsBrowser.extend( {
		createToolbar: function() {
			var that = this,
				i = 1,
				filters = that.options.filters;

			curAttachmentsBrowser.prototype.createToolbar.apply( this, arguments );

			$.each( us_media_categories_taxonomies, function( taxonomy, values ) {
				if ( values.term_list && filters ) {
					that.toolbar.set( taxonomy + '-filter', new media.view.AttachmentFilters.Taxonomy( {
						controller: that.controller,
						model: that.collection.props,
						priority: - 80 + 10 * i ++,
						taxonomy: taxonomy,
						termList: values.term_list,
						termListTitle: values.list_title,
						className: 'attachment-taxonomy-filters'
					} ).render() );
				}
			} );
		}
	} );
	// Relocate the new dropdown
	//	$( document ).ready( function() {
	//		$( '.media-toolbar.wp-filter .delete-selected-button' ).before( $('.media-toolbar.wp-filter
	// .select-mode-toggle-button' ) ); } );


	$.extend( wp.Uploader.prototype, {
		success: function( file_attachment ) {
			var category = $( ".attachment-taxonomy-filters" ).val();
			var data = {
				action: 'us_ajax_set_category_on_upload',
				post_id: file_attachment.attributes.id,
				category: category,
			};

			jQuery.post( ajaxurl, data, function( response ) {

			} );

		}
	} );

} )( jQuery );