Ticket #17578: auto-detect-img.patch
| File auto-detect-img.patch, 2.4 KB (added by , 15 years ago) |
|---|
-
wp-admin/includes/media.php
1456 1456 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 1457 1457 <?php wp_nonce_field('media-form'); ?> 1458 1458 1459 <h3 class="media-title"><?php _e(' Add media file from URL'); ?></h3>1459 <h3 class="media-title"><?php _e('Insert media from another web site'); ?></h3> 1460 1460 1461 1461 <script type="text/javascript"> 1462 //<![CDATA[ 1462 1463 1463 var addExtImage = { 1464 1464 1465 1465 width : '', … … 1505 1505 1506 1506 t.width = t.height = ''; 1507 1507 document.getElementById('go_button').style.color = '#bbb'; 1508 if ( ! document.forms[0].src.value ) 1509 document.getElementById('status_img').innerHTML = '*'; 1510 else document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/no.png' ) ); ?>" alt="" />'; 1508 document.getElementById('status_img').innerHTML = '*'; 1511 1509 }, 1512 1510 1513 1511 updateImageData : function() { … … 1522 1520 getImageData : function() { 1523 1521 var t = addExtImage, src = document.forms[0].src.value; 1524 1522 1525 if ( ! src || jQuery('table.describe').hasClass('not-image') ) { 1523 if ( src && src.match(/\.(?:jpe?g|png|gif)(?:\?|$)/i) ) { 1524 jQuery('table.describe').removeClass('not-image'); 1525 } else { 1526 jQuery('table.describe').addClass('not-image'); 1526 1527 t.resetImageData(); 1527 1528 return false; 1528 1529 } … … 1534 1535 t.preloadImg.src = src; 1535 1536 } 1536 1537 } 1537 1538 jQuery(document).ready( function($) {1539 $('.media-types input').click( function() {1540 $('table.describe').toggleClass('not-image', $('#not-image').prop('checked') );1541 });1542 });1543 1544 //]]>1545 1538 </script> 1546 1539 1547 1540 <div id="media-items"> … … 1890 1883 } 1891 1884 1892 1885 return ' 1893 <h4 class="media-sub-title">' . __('Insert media from another web site') . '</h4> 1894 <p class="media-types"><label><input type="radio" name="media_type" value="image" id="image-only"' . checked( 'image-only', $view, false ) . ' /> ' . __( 'Images' ) . '</label> <label><input type="radio" name="media_type" value="generic" id="not-image"' . checked( 'not-image', $view, false ) . ' /> ' . __( 'Audio, Video, or Files' ) . '</label></p> 1895 <table class="describe ' . $table_class . '"><tbody> 1886 <table class="describe not-image"><tbody> 1896 1887 <tr> 1897 1888 <th valign="top" scope="row" class="label" style="width:130px;"> 1898 1889 <span class="alignleft"><label for="src">' . __('URL') . '</label></span>