Docs: improve JS docs for `bookmarklet.js`

Props andizer, ireneyoast.
Fixes #41547.

Built from https://develop.svn.wordpress.org/trunk@41313


git-svn-id: http://core.svn.wordpress.org/trunk@41144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2017-08-24 17:55:45 +00:00
parent 33f0b56134
commit 4557e0d292
2 changed files with 24 additions and 1 deletions

View File

@ -1,3 +1,15 @@
/**
* @summary Creates a form with a URL, title, and content based on the current opened URL and the content of the associated web page.
*
* @since 4.2.0
*
* @param {window} window The window.
* @param {document} document The document.
* @param {string} href The current opened URL.
* @param {string} pt_url The URL to post the content to.
*
* @returns {void}
*/
( function( window, document, href, pt_url ) {
var encURI = window.encodeURIComponent,
form = document.createElement( 'form' ),
@ -13,6 +25,7 @@
if ( href.match( /^https?:/ ) ) {
pt_url += '&u=' + encURI( href );
// Check whether the unencoded url and the encoded url use the same protocol.
if ( href.match( /^https:/ ) && pt_url.match( /^http:/ ) ) {
canPost = false;
}
@ -52,6 +65,16 @@
return;
}
/**
* @summary Creates a hidden input field and sets its name and value.
*
* @since 4.2.0
*
* @param name The input field name.
* @param value The input field value.
*
* @returns {void}
*/
function add( name, value ) {
if ( typeof value === 'undefined' ) {
return;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41312';
$wp_version = '4.9-alpha-41313';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.