WordPress.org

Make WordPress Core

Ticket #41547: bookmarklet.diff

File bookmarklet.diff, 1.3 KB (added by andizer, 2 years ago)
  • src/wp-admin/js/bookmarklet.js

    diff --git src/wp-admin/js/bookmarklet.js src/wp-admin/js/bookmarklet.js
    index fe8e74a..b1d1a58 100644
     
     1/**
     2 * @summary Creates a form with a URL, title, and content based on the current opened URL and the content of the associated web page.
     3 *
     4 * @since 4.2.0
     5 *
     6 * @param {window} window The window.
     7 * @param {document} document The document.
     8 * @param {string} href The current opened URL.
     9 * @param {string} pt_url The URL to post the content to.
     10 *
     11 * @returns {void}
     12 */
    113( function( window, document, href, pt_url ) {
    214        var encURI = window.encodeURIComponent,
    315                form = document.createElement( 'form' ),
     
    1325
    1426        if ( href.match( /^https?:/ ) ) {
    1527                pt_url += '&u=' + encURI( href );
     28                // Check whether the unencoded url and the encoded url use the same protocol.
    1629                if ( href.match( /^https:/ ) && pt_url.match( /^http:/ ) ) {
    1730                        canPost = false;
    1831                }
     
    5265                return;
    5366        }
    5467
     68        /**
     69         * @summary Creates a hidden input field and sets its name and value.
     70         *
     71         * @since 4.2.0
     72         *
     73         * @param name The input field name.
     74         * @param value The input field value.
     75         *
     76         * @returns {void}
     77         */
    5578        function add( name, value ) {
    5679                if ( typeof value === 'undefined' ) {
    5780                        return;