/
home
/
techb158
/
public_html
/
wp-content
/
plugins
/
meta-box
/
js
/
/home/techb158/public_html/wp-content/plugins/meta-box/js
mkdir
upload
Name
Size
Mode
Actions
block-editor/
-
0755
rm
jqueryui/
-
0755
rm
leaflet/
-
0755
rm
select2/
-
0755
rm
validation/
-
0755
rm
wp-color-picker-alpha/
-
0755
rm
autocomplete.js
1660
0666
edit
dl
rm
autosave.js
595
0666
edit
dl
rm
block-bindings.js
811
0666
edit
dl
rm
button-group.js
1018
0666
edit
dl
rm
clone.js
9413
0666
edit
dl
rm
color.js
1358
0666
edit
dl
rm
date.js
2532
0666
edit
dl
rm
datetime.js
2942
0666
edit
dl
rm
file-input.js
1913
0666
edit
dl
rm
file-upload.js
5622
0666
edit
dl
rm
file.js
3974
0666
edit
dl
rm
icon.js
795
0666
edit
dl
rm
image-advanced.js
2272
0666
edit
dl
rm
image-upload.js
1116
0666
edit
dl
rm
input-list.js
1091
0666
edit
dl
rm
link.js
2794
0666
edit
dl
rm
map-frontend.js
2057
0666
edit
dl
rm
map.js
8842
0666
edit
dl
rm
media.js
18301
0666
edit
dl
rm
modal.js
4222
0666
edit
dl
rm
oembed.js
880
0666
edit
dl
rm
osm-frontend.js
1259
0666
edit
dl
rm
osm.js
8032
0666
edit
dl
rm
password.js
672
0666
edit
dl
rm
post.js
1257
0666
edit
dl
rm
range.js
475
0666
edit
dl
rm
script.js
751
0666
edit
dl
rm
select-advanced.js
3759
0666
edit
dl
rm
select-tree.js
1663
0666
edit
dl
rm
select.js
536
0666
edit
dl
rm
slider.js
922
0666
edit
dl
rm
taxonomy.js
1244
0666
edit
dl
rm
time.js
1540
0666
edit
dl
rm
user.js
1467
0666
edit
dl
rm
video.js
2793
0666
edit
dl
rm
wysiwyg.js
5486
0666
edit
dl
rm
Edit:
/home/techb158/public_html/wp-content/plugins/meta-box/js/select-advanced.js
(3759B)
( function ( $, rwmb ) { 'use strict'; // Cache ajax requests: https://github.com/select2/select2/issues/110#issuecomment-419247158 var cache = {}; /** * Reorder selected values in correct order that they were selected. * @param $select2 jQuery element of the select2. */ function reorderSelected( $select2 ) { var selected = $select2.data( 'selected' ); if ( !selected ) { return; } selected.forEach( function ( value ) { var option = $select2.children( '[value="' + value + '"]' ); option.detach(); $select2.append( option ); } ); $select2.trigger( 'change' ); } /** * Transform select fields into beautiful dropdown with select2 library. */ function transform() { var $this = $( this ), options = $this.data( 'options' ); $this.removeClass( 'select2-hidden-accessible' ).removeAttr( 'data-select2-id' ); $this.siblings( '.select2-container' ).remove(); $this.find( 'option' ).removeAttr( 'data-select2-id' ); if ( options.ajax_data ) { options.ajax.dataType = 'json'; options.ajax.data = function ( params ) { return Object.assign( options.ajax_data, params ); }; options.ajax.processResults = function ( response ) { var items = response.data.items.map( function ( item ) { return { id: item.value, text: _.unescape( item.label ), }; } ); var results = { results: items }; if ( response.data.hasOwnProperty( 'more' ) ) { results.pagination = { more: true }; } return results; }; options.ajax.transport = function ( params, success, failure ) { if ( params.data._type === 'query' ) { delete params.data.page; } // Create cache key from ajax params from only necessary keys to make cache available for multiple fields. var data = $.extend( true, {}, params.data ); delete data.field.id; delete data.action; if ( !data.term ) { delete data.term; } var key = JSON.stringify( data ); if ( cache[ key ] ) { success( cache[ key ] ); return; } var actions = { 'post': 'rwmb_get_posts', 'taxonomy': 'rwmb_get_terms', 'taxonomy_advanced': 'rwmb_get_terms', 'user': 'rwmb_get_users' }; params.data.action = actions[ params.data.field.type ]; params.method = 'POST'; return $.ajax( params ).then( function ( data ) { cache[ key ] = data; return data; } ).then( success ).fail( failure ); }; } $this.show(); if ( $this.hasClass( 'rwmb-icon' ) ) { // Initialize select2 with icons for icon field. $this.trigger( 'init_icon_field', [ options ] ); } else { // Initialize select2 normally. $this.select2( options ); } if ( !$this.attr( 'multiple' ) ) { return; } reorderSelected( $this ); /** * Preserve the order that options are selected. * @see https://github.com/select2/select2/issues/3106#issuecomment-255492815 */ $this.on( 'select2:select', function ( event ) { var option = $this.children( '[value="' + event.params.data.id + '"]' ); option.detach(); $this.append( option ).trigger( 'change' ); } ); } function init( e ) { $( e.target ).find( '.rwmb-select_advanced, .rwmb-icon' ).each( transform ); } function fixDropdownPosition( e ) { if ( $( "#wpadminbar" ).length === 0 ) { return; } if ( rwmbSelect2.isAdmin == 1 ) { $( 'body > .select2-container--open .select2-dropdown--above' ).css( 'top', 0 ); return; } $( 'body > .select2-container:last-child > .select2-dropdown' ).css( 'top', $( document.body ).offset().top ); }; rwmb.$document .on( 'mb_ready', init ) .on( 'clone', '.rwmb-select_advanced, .rwmb-icon', transform ) .on( 'select2:open', fixDropdownPosition ); } )( jQuery, rwmb );
Save
cmd:
run