1jQuery(document).ready(function( $ ){ 2 3 4 /* 5 * 6 * highstand_options_upload function 7 * Adds media upload functionality to the page 8 * 9 */ 10 11 $('.king-upload-image').on( 'click', function(e){ 12 e.preventDefault(); 13 $( this ).closest('.king-upload-wrp').find('.king-upload-button').trigger('click'); 14 return false; 15 }); 16 17 $('.king-upload-button-remove').on( 'click', function(e){ 18 e.preventDefault(); 19 $( this ).closest('.king-upload-wrp').find('.king-upload-input').val( '' ); 20 $( this ).closest('.king-upload-wrp').find('.king-upload-image').attr({ src : '' }).hide(); 21 $( this ).closest('.king-upload-wrp').find('.king-upload-button-remove').hide(); 22 return false; 23 }); 24 25 $('.king-upload-button').on( 'click', function(e){ 26 27 e.preventDefault(); 28 29 document.king_uploader_elm = this; 30 31 //If the uploader object has already been created, reopen the dialog 32 if ( document.king_uploader ) { 33 document.king_uploader.open(); 34 return; 35 } 36 37 //Extend the wp.media object 38 document.king_uploader = wp.media.frames.file_frame = wp.media({ 39 title: 'Choose Image', 40 button: { 41 text: 'Choose Image' 42 }, 43 multiple: false, 44 editing: true, 45 allowLocalEdits: true, 46 displaySettings: true, 47 displayUserSettings: true, 48 49 }); 50 51 document.king_uploader.on('select', function() { 52 53 attachments = document.king_uploader.state().get('selection'); 54 attachments.map( function( attachment ) { 55 attachment = attachment.toJSON(); 56 var elm = document.king_uploader_elm; 57 $( elm ).closest('.king-upload-wrp').find('.king-upload-input').val( attachment.url.replace( SITE_URI, '%SITE_URI%' ) ); 58 $( elm ).closest('.king-upload-wrp').find('.king-upload-image').attr({ src : attachment.url }).show(); 59 $( elm ).closest('.king-upload-wrp').find('.king-upload-button-remove').show(); 60 }); 61 62 }); 63 64 //Open the uploader dialog 65 document.king_uploader.open(); 66 67 }) 68 69});
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.