WordPress.org

Make WordPress Core

Ticket #2200: show-hide-preview.diff

File show-hide-preview.diff, 1.6 KB (added by wantmoore, 16 years ago)
  • wp-admin/post.php

     
    7474       
    7575        if ($post->post_status == 'static')
    7676                include('edit-page-form.php');
    77         elseif ($post->post_status == 'attachment')
    78                 include('edit-attachment-form.php');
    7977        else
    8078                include('edit-form-advanced.php');
    8179
    8280        ?>
    8381        <div id='preview' class='wrap'>
    8482        <h2 id="preview-post"><?php _e('Post Preview (updated when post is saved)'); ?> <small class="quickjump"><a href="#write-post"><?php _e('edit &uarr;'); ?></a></small></h2>
    85                 <iframe src="<?php the_permalink(); ?>" width="100%" height="600" ></iframe>
    86         </div>
     83        <script type="text/javascript">
     84        <!--
     85      function show_preview() {
     86        var elm = document.getElementById("frm_preview");
     87        elm.src = "<?php the_permalink(); ?>"
     88        elm.height = "600"
     89        return false;
     90      }
     91        -->
     92        </script>
     93        <a href="#preview-post" onclick="show_preview();">Show Preview</a>
     94                <iframe id="frm_preview" src="" width="100%" height="10" ></iframe>     
     95</div>
    8796        <?php
    8897        break;
    8998
     
    202211        echo "<input type='hidden' name='noredir' value='1' />\n";
    203212        echo "<input type='submit' value='" . __('Yes') . "' />";
    204213        echo "&nbsp;&nbsp;";
    205         echo "<input type='button' value='" . __('No') . "' onclick='self.location='". get_settings('siteurl') ."/wp-admin/edit.php?p=$p&amp;c=1#comments';' />\n";
     214        echo "<input type='button' value='" . __('No') . "' onclick=\"self.location='". get_settings('siteurl') ."/wp-admin/edit.php?p=$p&amp;c=1#comments';\" />\n";
    206215        echo "</form>\n";
    207216        echo "</div>\n";
    208217