Ticket #4807: 4807.diff

File 4807.diff, 3.3 KB (added by mdawaffe, 5 years ago)
  • wp-includes/script-loader.php

     
    142142                                'saveText' => attribute_escape(__('Save »')), 
    143143                                'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.") 
    144144                        ) ); 
     145                        $this->add( 'word-count', '/wp-admin/js/word-count.js', array( 'jquery' ), '20070823' ); 
    145146                } 
    146147        } 
    147148 
  • wp-admin/wp-admin.css

     
    626626        margin-bottom: 3px; 
    627627} 
    628628 
     629#quicktags .wp-word-count { 
     630        position: relative; 
     631        padding: 3px; 
     632        margin: 4px 4px 3px; 
     633        top: -2px; 
     634} 
     635 
    629636#title { 
    630637        font-size: 1.7em; 
    631638        padding: 4px 3px; 
     
    13481355 
    13491356.plugin-update { 
    13501357        text-align: left; 
    1351 } 
    1352  No newline at end of file 
     1358} 
  • wp-admin/js/word-count.js

     
     1jQuery( function($) { 
     2        var w = $("<span class='wp-word-count'><a href='#'>Count&nbsp;words</a><span id='word-count'></span></span>").appendTo('#ed_toolbar'); 
     3        if ( $.browser.safari ) { w.css( 'top', 0 ); } // Lame 
     4        else if ( $.browser.msie ) { w.css( 'top', '-8px' ); } 
     5 
     6        var wc = function(text) { var t = $.trim(text); w.children('span').html( ':&nbsp;' + ( t ? $("<div>" + t + "</div>").text().split( /\b[^\w']+\b/ ).length.toString() : '0' ) ); }; 
     7 
     8        $('a', w).click( function() { 
     9                if ( 'undefined' != typeof tinyMCE && $.isFunction(tinyMCE.getContent) ) { 
     10                        var t = tinyMCE.getContent(); 
     11                        if ( t ) { wc( t ); tinyMCE.selectedInstance.getWin().focus(); return false; } 
     12                } 
     13                wc( $('#content').focus().val() ); 
     14                return false; 
     15        } ).click(); 
     16 
     17        if ( 'undefined' == typeof tinyMCE ) { return; } 
     18        w.removeClass().addClass( 'mceStatusbarPathText' ).css( 'border-right', '1px solid #ccc' ).insertBefore('#mce_editor_0_path'); 
     19 
     20        if ( 'undefined' == typeof TinyMCE_wordpressPlugin ) { return; } 
     21        var cl = TinyMCE_wordpressPlugin.cleanup; 
     22        TinyMCE_wordpressPlugin.cleanup = function(t,c,i) { 
     23                if ( 'submit_content' == t ) 
     24                        w.removeClass().addClass( 'wp-word-count' ).css( 'border-right', 'none' ).appendTo('#ed_toolbar'); 
     25                else if ( 'setup_content_dom' == t ) 
     26                        w.removeClass().addClass( 'mceStatusbarPathText' ).css( 'border-right', '1px solid #ccc' ).insertBefore('#mce_editor_0_path'); 
     27                return cl(t,c,i); 
     28        }; 
     29} ); 
  • wp-admin/admin-header.php

     
    22@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); 
    33if (!isset($_GET["page"])) require_once('admin.php'); 
    44if ( $editing ) { 
    5         wp_enqueue_script( array('dbx-admin-key?pagenow=' . attribute_escape($pagenow),'admin-custom-fields') ); 
     5        wp_enqueue_script( array('dbx-admin-key?pagenow=' . attribute_escape($pagenow),'admin-custom-fields', 'word-count') ); 
    66        if ( current_user_can('manage_categories') ) 
    77                wp_enqueue_script( 'ajaxcat' ); 
    88        if ( user_can_richedit() )