%PDF- %PDF-
| Direktori : /home/gachan/www/wp-content/plugins/jekas_extensions/meta-box/js/ |
| Current File : /home/gachan/www/wp-content/plugins/jekas_extensions/meta-box/js/rwmb-icon.js |
/**
* Created by admin on 31/07/15.
*/
jQuery( function ( $ )
{
'use strict';
/**
* Turn select field into beautiful dropdown with select2 library
* This function is called when document ready and when clone button is clicked (to update the new cloned field)
*
* @return void
*/
function update()
{
var $this = $( this ),
options ={
formatResult: addIcon,
formatSelection: addIcon,
escapeMarkup: function( m ) { return m;}
};
$this.siblings( '.rwmb-icon' ).remove();
$this.show().select2( options );
rwmbSelect.bindEvents( $this );
}
function addIcon(icon){
if(icon.text != false)
return "<span ><i class='" + icon.text + " fa-2x'></i>" + " " + icon.text + "</span>";
return '';
}
$( ':input.rwmb-icon' ).each( update );
$( '.rwmb-input' ).on( 'clone', ':input.rwmb-icon', update );
} );