Ticket #2200 (closed enhancement: invalid)

Opened 6 years ago

Last modified 5 years ago

Ability to hide preview

Reported by: hypercubed Owned by: anonymous
Priority: low Milestone:
Component: Administration Version: 2.0
Severity: normal Keywords:
Cc:

Description

I really like the new preview feature in v2.0 but I don't always want to use it. Most of the time I don't need to look at it so it is just a waist of bandwidth and server power. I modified the \wp-admin\post.php file to allow me to view the preview only when I need it. It this is worth of inclusion in the trunk please feel free.

in wp-admin/post.php

Replace line 85 with

	<script type="text/javascript">
	<!--
      function show_preview() {
        var elm = document.getElementById("frm_preview");
        elm.src = "<?php the_permalink(); ?>"
        elm.height = "600"
        return false;
      }
	-->
	</script>
	<a href="#preview-post" onclick="show_preview();">Show Preview</a>
		<iframe id="frm_preview" src="" width="100%" height="10" ></iframe>

Attachments

show-hide-preview.diff Download (1.6 KB) - added by wantmoore 6 years ago.
post.patch Download (694 bytes) - added by hypercubed 5 years ago.
Patch for verson 2.0.5
post.diff Download (938 bytes) - added by hypercubed 5 years ago.
Diff for version 2.1

Change History

  • Keywords 2nd-opinion added
  • Keywords bg|2nd-opinion bg|has-patch added; 2nd-opinion removed

I was missing a couple of semicolons in the javascript:

<script type=“text/javascript”>
<!–
  function show_preview() {
    var elm = document.getElementById("frm_preview");
    elm.src = "<?php the_permalink(); ?>";
    elm.height = "600";
    return false;
  }
–>
</script>
<a href=“#preview-post” onclick=“show_preview();”>Show Preview</a>
<iframe id=“frm_preview” src=“” width=“100%” height=“10″ ></iframe>

Sorry one more time. Some fancy quotes snuck in:

<script type="text/javascript">
<!--
  function show_preview() {
    var elm = document.getElementById("frm_preview");
    elm.src = "<?php the_permalink(); ?>"
    elm.height = "600"
    return false;
  }
-->
</script>
<a href="#preview-post" onclick="show_preview();">Show Preview</a>
<iframe id="frm_preview" src="" width="100%" height="10" ></iframe>
  • Milestone changed from 2.0 to 2.1

Patch created from $wp_version = '2.0.1'; $wp_db_version = 3437;. Was actually at line 83 of my post.php instead of line 85 as noted by hypercubed.

WordPress 2.0.1 changed the preview link. The fifth line in my hack should now be:

    elm.src = "<?php echo add_query_arg('preview', 'true', get_permalink($post->ID)); ?>";
  • Keywords 2nd-opinion has-patch added; bg|2nd-opinion bg|has-patch removed

-1 on this. I use the preview window a lot and I wouldn't like the extra click this imposes on me.

Patch for verson 2.0.5

comment:9   matt5 years ago

  • Milestone changed from 2.1 to 2.2

Not the same fix, but people who want it off altogether can use this:

 http://txfx.net/code/wordpress/clutter-free/

It is now line 72 replaced with:

<script type="text/javascript">
<!--
  function show_preview() {
	var elm = document.getElementById("frm_preview");
	elm.src = "<?php echo attribute_escape(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>";
	elm.height = "600";
	return false;
  }
-->
</script>
<a href="#preview-post" onclick="show_preview();">Show Preview</a>
<iframe id="frm_preview" src="" width="100%" height="10" ></iframe>

Diff for version 2.1

  • Milestone changed from 2.2 to 2.3
  • Keywords 2nd-opinion has-patch removed
  • Status changed from new to closed
  • Resolution set to invalid
  • Milestone 2.3 deleted

Matt just committed changes to make the preview a popup window instead, so this is invalidated.

Note: See TracTickets for help on using tickets.