Skip to content

Commit

Permalink
Don't prefill empty input field. Fixes #1716.
Browse files Browse the repository at this point in the history
No need to use a jQuery fallback, by the way.
  • Loading branch information
ozh committed Oct 24, 2014
1 parent 700b6e6 commit 7346eb2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions includes/functions-html.php
Expand Up @@ -166,12 +166,11 @@ function yourls_html_footer() {
* @param string $keyword Keyword to prefill the input with
*/
function yourls_html_addnew( $url = '', $keyword = '' ) {
$url = $url ? $url : 'http://';
?>
<div id="new_url">
<div>
<form id="new_url_form" action="" method="get">
<div><strong><?php yourls_e( 'Enter the URL' ); ?></strong>:<input type="text" id="add-url" name="url" value="<?php echo $url; ?>" class="text" size="80" />
<div><strong><?php yourls_e( 'Enter the URL' ); ?></strong>:<input type="text" id="add-url" name="url" value="<?php echo $url; ?>" class="text" size="80" placeholder="http://" />
<?php yourls_e( 'Optional '); ?>: <strong><?php yourls_e('Custom short URL'); ?></strong>:<input type="text" id="add-keyword" name="keyword" value="<?php echo $keyword; ?>" class="text" size="8" />
<?php yourls_nonce_field( 'add_url', 'nonce-add' ); ?>
<input type="button" id="add-button" name="add-button" value="<?php yourls_e( 'Shorten The URL' ); ?>" class="button" onclick="add_link();" /></div>
Expand Down
2 changes: 1 addition & 1 deletion js/insert.js
Expand Up @@ -176,7 +176,7 @@ function zebra_table() {

// Ready to add another URL
function add_link_reset() {
$('#add-url').val('http://').focus();
$('#add-url').val('').focus();
$('#add-keyword').val('');
}

Expand Down

0 comments on commit 7346eb2

Please sign in to comment.