Make WordPress Core

Changeset 7919


Ignore:
Timestamp:
05/12/2008 07:08:39 PM (17 years ago)
Author:
ryan
Message:

Quick post bookmarklet. First cut. see #6813

Location:
trunk
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r7907 r7919  
    190190<?php do_action('post_relatedlinks_list'); ?>
    191191</ul>
     192
     193<h5><?php _e('Shortcuts') ?></h5>
     194<p><?php _e('Drag-and-drop the following link to your bookmarks bar or right click it and add it to your favorites for a posting shortcut.') ?>  <a href="<?php echo get_shortcut_link(); ?>" title="<?php echo attribute_escape(__('Press This')) ?>"><?php _e('Press This') ?></a></p>
    192195</div>
    193196
  • trunk/wp-includes/link-template.php

    r7747 r7919  
    743743}
    744744
     745function get_shortcut_link() {
     746    $link = "javascript:
     747                        var imgstr='';
     748                        var reg=new RegExp('&');
     749            for(i=0;i<document.images.length;i++){
     750              if(! reg.test(document.images[i].src)){
     751              imgstr = imgstr + document.images[i].src + ',';
     752              }
     753            }
     754            var d=document;
     755            var w=window;
     756            var e=w.getSelection;
     757            var k=d.getSelection;
     758            var x=d.selection;
     759            var s=(e?e():(k)?k():(x?x.createRange().text:0));
     760            var f='" . get_settings('siteurl') . '/wp-admin/quick-post.php' . "';
     761            var l=d.location;
     762            var e=encodeURIComponent;
     763            var p='?imagez='+imgstr;
     764            var u= '&u=' + e(l.href);
     765            var t= '&t=' + e(d.title);
     766            var s= '&s=' + e(s);
     767            var g= f+p+u+t+s;
     768
     769            function a(){
     770              if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=700,height=500')){
     771                l.href=g;
     772              }
     773            }
     774            if(/Firefox/.test(navigator.userAgent)){
     775              setTimeout(a,0);
     776            }else{
     777              a();
     778            }
     779            void(0);";
     780
     781    return apply_filters('shortcut_link', $link);
     782}
    745783?>
Note: See TracChangeset for help on using the changeset viewer.