Make WordPress Core

Opened 18 years ago

Closed 17 years ago

#2200 closed enhancement (invalid)

Ability to hide preview

Reported by: hypercubed's profile hypercubed Owned by:
Milestone: Priority: low
Severity: normal Version: 2.0
Component: Administration Keywords:
Focuses: 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 (3)

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

Download all attachments as: .zip

Change History (16)

#1 @hypercubed
18 years ago

  • Keywords 2nd-opinion added

#2 @davidhouse
18 years ago

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

#3 @hypercubed
18 years ago

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>

#4 @hypercubed
18 years ago

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>

#5 @skeltoac
18 years ago

  • Milestone changed from 2.0 to 2.1

#6 @wantmoore
18 years ago

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.

#7 @hypercubed
18 years ago

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)); ?>";

#8 @Nazgul
17 years ago

  • 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.

@hypercubed
17 years ago

Patch for verson 2.0.5

#9 @matt
17 years ago

  • Milestone changed from 2.1 to 2.2

#10 @markjaquith
17 years ago

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

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

#11 @hypercubed
17 years ago

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>

@hypercubed
17 years ago

Diff for version 2.1

#12 @foolswisdom
17 years ago

  • Milestone changed from 2.2 to 2.3

#13 @rob1n
17 years ago

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

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

Note: See TracTickets for help on using tickets.