1jQuery(document).ready(function ($) { 2 var $form = $('#divi-framework-ultimate-gravityforms'); 3 4 // import. 5 $form.find('#import-ult-gf').change(function(e){ 6 $form.append('<input type="hidden" name="form-action" value="import"/>'); 7 $form.find('#divi-framework-ultimate-gravityforms').remove(); 8 $form.submit(); 9 }); 10 11 // tabs 12 $('#divi-framework-ultimate-gravityforms .idTabs li a').on('click', function(e){ 13 e.preventDefault(); 14 var id = $(this).attr('data-id'); 15 id = id.replace('#', ''); 16 17 $('#divi-framework-ultimate-gravityforms .idTabs li').removeClass('ui-tabs-active'); 18 $(this).parent().addClass('ui-tabs-active'); 19 20 $form.find('.tab-content').hide(); 21 22 $form.find('#' + id).show(); 23 24 25 }); 26 27 // Loop each option 28 $form.find('.epanel-box').each(function(){ 29 var $field = $(this), 30 type = $field.attr('data-type'), 31 $input, 32 $reset_button, 33 et_divi_100_file_frame; 34 35 switch( type ) { 36 case "color": 37 $input = $field.find('input.colorpicker'); 38 39 $reset_button = $field.find( '.reset-color' ); 40 41 // Setup colorpicker 42 $input.iris({ 43 hide : false, 44 width : 350, 45 palettes : true 46 }); 47 48 // Reset color 49 $reset_button.click( function(e) { 50 e.preventDefault(); 51 $input.iris( 'color', $input.attr( 'data-default' ) ); 52 }); 53 54 break; 55 case "select": 56 $input = $field.find( 'select' ); 57 58 // Update preview whenever select is changed 59 $input.change( function() { 60 var $select = $(this), 61 preview_prefix = $select.attr( 'data-preview-prefix' ), 62 $selected_option = $select.find('option:selected'), 63 selected_value = $selected_option.val(), 64 preview_height = parseInt( $input.attr('data-preview-height') ), 65 preview_file = preview_prefix + selected_value, 66 $preview_wrapper = $select.parents('.box-content').find('.option-preview'), 67 $preview; 68 69 if( selected_value !== '' ) { 70 $preview = $('<img />', { 71 src : et_divi_100_js_params.preview_dir_url + preview_file + '.gif' 72 }); 73 74 $preview_wrapper.css({ 'minHeight' : preview_height }).html( $preview ); 75 } else { 76 $preview_wrapper.css({ 'minHeight' : '' }).empty(); 77 } 78 }); 79 break; 80 case "toggle": 81 var $input = $field.find( 'select' ), 82 $toggle = $field.find( '.et_pb_yes_no_button' ); 83 84 $toggle.on( 'click', '.et_pb_value_text, .et_pb_button_slider', function(){ 85 var input_value = $input.find('option:selected').val() === 'on' ? 'on' : 'off', 86 toggle_state = input_value === 'on', 87 toggle_new_state = toggle_state ? false : true, 88 input_new_value = toggle_new_state ? 'on' : 'off', 89 toggle_state_class = 'et_pb_' + input_new_value + '_state'; 90 91 $input.val( input_new_value ); 92 $toggle.removeClass('et_pb_on_state et_pb_off_state').addClass( toggle_state_class ); 93 }); 94 95 break; 96 case "upload": 97 var $input_src = $field.find('.input-src'), 98 $input_id = $field.find('.input-id'), 99 $button_upload = $field.find('.button-upload'), 100 $button_remove = $field.find('.button-remove'), 101 button_upload_active_text = $button_upload.attr('data-button-active-text'), 102 button_upload_inactive_text = $button_upload.attr('data-button-inactive-text'), 103 media_uploader_title = $button_upload.attr('data-media-uploader-title'), 104 media_uploader_button_text = $button_upload.attr('data-media-uploader-button-text'), 105 $preview = $field.find('.option-preview'); 106 107 // Check background image status 108 if ( $input_src.val() !== '' ) { 109 $button_upload.text( button_upload_active_text); 110 $button_remove.show(); 111 } 112 113 // Upload background image button 114 $button_upload.on( 'click', function( event ){ 115 event.preventDefault(); 116 117 // If the media frame already exists, reopen it. 118 if ( et_divi_100_file_frame ) { 119 120 // Open frame 121 et_divi_100_file_frame.open(); 122 123 return; 124 } else { 125 126 // Create the media frame. 127 et_divi_100_file_frame = wp.media.frames.et_divi_100_file_frame = wp.media({ 128 title: media_uploader_title, 129 button: { 130 text: media_uploader_button_text 131 }, 132 multiple: false, 133 library : { 134 type: 'image' 135 } 136 });
137 138 // When an image is selected, run a callback. 139 et_divi_100_file_frame.on( 'select', function() { 140 // We set multiple to false so only get one image from the uploader 141 attachment = et_divi_100_file_frame.state().get('selection').first().toJSON(); 142 143 // Update input fields 144 $input_src.val( attachment.url ); 145 146 $input_id.val( attachment.id ); 147 148 // Update Previewer 149 $preview.html( $( '<img />', { 150 src : attachment.url, 151 style : 'max-width: 100%;' 152 } ) ); 153 154 // Update button text 155 $button_upload.text( button_upload_active_text ); 156 $button_remove.show(); 157 }); 158 159 // Finally, open the modal 160 et_divi_100_file_frame.open(); 161 } 162 }); 163 164 // Remove background image 165 $button_remove.on( 'click', function( event ) { 166 event.preventDefault(); 167 168 // Remove input 169 $input_src.val(''); 170 $input_id.val(''); 171 172 // Remove preview 173 $preview.empty(); 174 175 // Update button text 176 $button_upload.text( button_upload_inactive_text ); 177 $button_remove.hide(); 178 }); 179 break; 180 } 181 }); 182 183 // Top button 184 $('#epanel-save-top').click(function(e){ 185 e.preventDefault(); 186 187 $('#epanel-save').trigger('click'); 188 }); 189 190 // Help box 191 $(".box-description").click(function(){ 192 var descheading = $(this).parent('.epanel-box').find(".box-title h3").html(); 193 var desctext = $(this).parent('.epanel-box').find(".box-title .box-descr").html(); 194 195 $('body').append("<div id='custom-lbox'><div class='box-desc'><div class='box-desc-top'>"+ et_divi_100_js_params.help_label +"</div><div class='box-desc-content'><h3>"+descheading+"</h3>"+desctext+"<div class='lightboxclose'></div> </div> <div class='box-desc-bottom'></div> </div></div>"); 196 197 $( '.lightboxclose' ).click( function() { 198 et_pb_close_modal( $( '#custom-lbox' ) ); 199 }); 200 }); 201 202 function et_pb_close_modal( $overlay, no_overlay_remove ) { 203 var $modal_container = $overlay; 204 205 // add class to apply the closing animation to modal 206 $modal_container.addClass( 'et_pb_modal_closing' ); 207 208 //remove the modal with overlay when animation complete 209 setTimeout( function() { 210 if ( 'no_remove' !== no_overlay_remove ) { 211 $modal_container.remove(); 212 } 213 }, 600 ); 214 } 215});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.