Changeset 19424 for trunk/wp-admin/press-this.php
- Timestamp:
- 11/23/2011 08:32:21 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/press-this.php
r19381 r19424 140 140 }); 141 141 jQuery('.select').click(function() { 142 image_selector( );142 image_selector(this); 143 143 }); 144 144 /* ]]> */ … … 147 147 <div class="titlediv"> 148 148 <div class="titlewrap"> 149 <input id="tb_this_photo_description" name="photo_description" class="tb title text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo esc_attr($title);?>"/>149 <input id="tb_this_photo_description" name="photo_description" class="tb_this_photo_description tbtitle text" onkeypress="if(event.keyCode==13) image_selector(this);" value="<?php echo esc_attr($title);?>"/> 150 150 </div> 151 151 </div> 152 152 153 153 <p class="centered"> 154 <input type="hidden" name="this_photo" value="<?php echo esc_attr($image); ?>" id="tb_this_photo" />154 <input type="hidden" name="this_photo" value="<?php echo esc_attr($image); ?>" id="tb_this_photo" class="tb_this_photo" /> 155 155 <a href="#" class="select"> 156 156 <img src="<?php echo esc_url($image); ?>" alt="<?php echo esc_attr(__('Click to insert.')); ?>" title="<?php echo esc_attr(__('Click to insert.')); ?>" /> … … 271 271 } 272 272 273 function image_selector() { 274 var desc = jQuery('#tb_this_photo_description').val() || '', src = jQuery('#tb_this_photo').val() || ''; 273 function image_selector(el) { 274 var desc, src, parent = jQuery(el).closest('#photo-add-url-div'); 275 276 if ( parent.length ) { 277 desc = parent.find('input.tb_this_photo_description').val() || ''; 278 src = parent.find('input.tb_this_photo').val() || '' 279 } else { 280 desc = jQuery('#tb_this_photo_description').val() || ''; 281 src = jQuery('#tb_this_photo').val() || '' 282 } 275 283 276 284 tb_remove(); … … 369 377 jQuery('.close').click(function() { 370 378 jQuery('#extra-fields').hide(); 379 jQuery('body').append( jQuery('#photo-add-url-div') ); 371 380 jQuery('#extra-fields').html(''); 372 381 }); 373 382 jQuery('.refresh').click(function() { 374 383 photostorage = false; 384 jQuery('body').append( jQuery('#photo-add-url-div') ); 375 385 show('photo'); 376 386 }); 377 387 jQuery('#photo-add-url').click(function(){ 378 var form = jQuery('#photo-add-url-div').clone(); 379 jQuery('#img_container').empty().append( form.show() ); 388 var container = jQuery('#img_container'); 389 390 if ( container.children('#photo-add-url-div:visible').length ) { 391 container.children('a').show(); 392 jQuery('#photo-add-url-div').hide(); 393 } else { 394 container.children('a').hide(); 395 container.append( jQuery('#photo-add-url-div').show() ); 396 } 380 397 }); 381 398 jQuery('#waiting').hide(); … … 626 643 <table><tr> 627 644 <td><label for="this_photo"><?php _e('URL') ?></label></td> 628 <td><input type="text" id="this_photo" name="this_photo" class="tb title text" onkeypress="if(event.keyCode==13) image_selector();" /></td>645 <td><input type="text" id="this_photo" name="this_photo" class="tb_this_photo text" onkeypress="if(event.keyCode==13) image_selector(this);" /></td> 629 646 </tr><tr> 630 647 <td><label for="this_photo_description"><?php _e('Description') ?></label></td> 631 <td><input type="text" id="this_photo_description" name="photo_description" class="tb title text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo esc_attr($title);?>"/></td>648 <td><input type="text" id="this_photo_description" name="photo_description" class="tb_this_photo_description text" onkeypress="if(event.keyCode==13) image_selector(this);" value="<?php echo esc_attr($title);?>"/></td> 632 649 </tr><tr> 633 <td><input type="button" class="button" onclick="image_selector( )" value="<?php esc_attr_e('Insert Image'); ?>" /></td>650 <td><input type="button" class="button" onclick="image_selector(this)" value="<?php esc_attr_e('Insert Image'); ?>" /></td> 634 651 </tr></table> 635 652 </div>
Note: See TracChangeset
for help on using the changeset viewer.