Plugin Directory

Changeset 1057184

Timestamp:
12/30/2014 11:06:47 PM (10 years ago)
Author:
alexkingorg
Message:

version 2.0

Location:
fullscreen-preview-button/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • fullscreen-preview-button/trunk/README.txt

    r657138 r1057184  
    1 === Fullscreen Preview Button ===
     1=== Preview Button ===
    22Contributors: alexkingorg
    33Tags: editor, fullscreen, preview
    4 Requires at least: 3.5
    5 Tested up to: 3.5
    6 Stable tag: 1.2
     4Requires at least:
     5Tested up to:
     6Stable tag:
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1212== Description ==
    1313
    14 This plugin adds a "preview" button to the fullscreen (distraction-free) editor.
     14This plugin adds a "preview" button to the editor.
    1515
    1616**Contributing**
     
    5656== Changelog ==
    5757
     58
     59
     60
     61
    5862= 1.2 =
    5963* First release on WordPress.org
     
    6973== Upgrade Notice ==
    7074
    71 = 1.2 =
    72 * First release on WordPress.org
    73 * Compatibility with WordPress 3.5
     75= =
     76*
     77* Compatibility with
  • fullscreen-preview-button/trunk/fullscreen-preview-button.php

    r657138 r1057184  
    22
    33/*
    4 Plugin Name: Fullscreen Preview Button
    5 Description: Add a preview button to the fullscreen editor toolbar.
    6 Version: 1.2
     4Plugin Name: Preview Button
     5Description: Add a preview button to the .
     6Version:
    77Author: Alex King
    88Author URI: http://alexking.org
     
    1414<script type="text/javascript">
    1515;(function($) {
    16     var $preview = $('#post-preview');
    17     $preview.clone()
    18         .removeAttr('id').removeClass('preview').addClass('right')
    19         .css('margin-left', '5px')
    20         .click(function(e) {
    21             $preview.click();
    22             e.preventDefault();
    23         })
    24         .insertBefore('#wp-fullscreen-save input.button-primary');
     16    var $buttons = $('#wp-content-media-buttons');
     17
     18    // add a preview button if one doesn't exist
     19    $(document).on('dfw-on', function() {
     20        var $exists = $buttons.find('#ak-fsp-button');
     21        if ($exists.length == 0) {
     22            $buttons.append('<a href="#" id="ak-fsp-button" class="button"><?php _e('Preview'); ?></a>');
     23        }
     24    });
     25
     26    // when our preview button is clicked, execute the standard preview function
     27    $(document).on('click', '#ak-fsp-button', function(e) {
     28        e.preventDefault();
     29        $('#post-preview').click();
     30        $(this).blur();
     31    });
     32
     33    // remove the preview button when exiting DFW
     34    $(document).on('dfw-off', function() {
     35        $buttons.find('#ak-fsp-button').remove();
     36    });
    2537}(jQuery));
    2638</script>
Note: See TracChangeset for help on using the changeset viewer.