wp/wp-includes/js/wp-pointer.js
author ymh <ymh.work@gmail.com>
Mon, 08 Sep 2025 19:44:41 +0200
changeset 23 417f20492bf7
parent 18 be944660c56a
permissions -rw-r--r--
Update Docker configuration and plugin versions - Upgrade MariaDB from 10.6 to 11 with auto-upgrade support - Add WordPress debug environment variable to FPM container - Update PHP-FPM Dockerfile base image - Update Include Mastodon Feed plugin with bug fixes and improvements - Update Portfolio plugin (v2.58) with latest translations and demo data enhancements - Remove old README.md from Mastodon Feed plugin 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
     2
 * @output wp-includes/js/wp-pointer.js
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
     3
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
     4
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
     5
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
     6
 * Initializes the wp-pointer widget using jQuery UI Widget Factory.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
(function($){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
	var identifier = 0,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
		zindex = 9999;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    12
	$.widget('wp.pointer',/** @lends $.widget.wp.pointer.prototype */{
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
		options: {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
			pointerClass: 'wp-pointer',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
			pointerWidth: 320,
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    16
			content: function() {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
				return $(this).text();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
			},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
			buttons: function( event, t ) {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    20
				var button = $('<a class="close" href="#"></a>').text( wp.i18n.__( 'Dismiss' ) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    22
				return button.on( 'click.pointer', function(e) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
					e.preventDefault();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
					t.element.pointer('close');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
				});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
			},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
			position: 'top',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
			show: function( event, t ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
				t.pointer.show();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
				t.opened();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
			},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
			hide: function( event, t ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
				t.pointer.hide();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
				t.closed();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
			},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
			document: document
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    39
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    40
		 * A class that represents a WordPress pointer.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    41
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    42
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    43
		 * @private
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    44
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    45
		 * @constructs $.widget.wp.pointer
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    46
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
		_create: function() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
			var positioning,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
				family;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
			this.content = $('<div class="wp-pointer-content"></div>');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
			this.arrow   = $('<div class="wp-pointer-arrow"><div class="wp-pointer-arrow-inner"></div></div>');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
			family = this.element.parents().add( this.element );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
			positioning = 'absolute';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
			if ( family.filter(function(){ return 'fixed' === $(this).css('position'); }).length )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
				positioning = 'fixed';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
			this.pointer = $('<div />')
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
				.append( this.content )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
				.append( this.arrow )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
				.attr('id', 'wp-pointer-' + identifier++)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
				.addClass( this.options.pointerClass )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
				.css({'position': positioning, 'width': this.options.pointerWidth+'px', 'display': 'none'})
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
				.appendTo( this.options.document.body );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    69
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    70
		 * Sets an option on the pointer instance.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    71
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    72
		 * There are 4 special values that do something extra:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    73
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    74
		 * - `document`     will transfer the pointer to the body of the new document
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    75
		 *                  specified by the value.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    76
		 * - `pointerClass` will change the class of the pointer element.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    77
		 * - `position`     will reposition the pointer.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    78
		 * - `content`      will update the content of the pointer.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    79
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    80
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    81
		 * @private
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    82
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    83
		 * @param {string} key   The key of the option to set.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    84
		 * @param {*}      value The value to set the option to.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    85
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
		_setOption: function( key, value ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
			var o   = this.options,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
				tip = this.pointer;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    90
			// Handle document transfer.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    91
			if ( key === 'document' && value !== o.document ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
				tip.detach().appendTo( value.body );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    94
			// Handle class change.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    95
			} else if ( key === 'pointerClass' ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
				tip.removeClass( o.pointerClass ).addClass( value );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
			// Call super method.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
			$.Widget.prototype._setOption.apply( this, arguments );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   102
			// Reposition automatically.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   103
			if ( key === 'position' ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
				this.reposition();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   106
			// Update content automatically if pointer is open.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   107
			} else if ( key === 'content' && this.active ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
				this.update();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   112
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   113
		 * Removes the pointer element from of the DOM.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   114
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   115
		 * Makes sure that the widget and all associated bindings are destroyed.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   116
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   117
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   118
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
		destroy: function() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
			this.pointer.remove();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
			$.Widget.prototype.destroy.call( this );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   124
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   125
		 * Returns the pointer element.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   126
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   127
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   128
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   129
		 * @return {Object} Pointer The pointer object.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   130
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
		widget: function() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
			return this.pointer;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   135
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   136
		 * Updates the content of the pointer.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   137
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   138
		 * This function doesn't update the content of the pointer itself. That is done
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   139
		 * by the `_update` method. This method will make sure that the `_update` method
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   140
		 * is called with the right content.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   141
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   142
		 * The content in the options can either be a string or a callback. If it is a
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   143
		 * callback the result of this callback is used as the content.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   144
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   145
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   146
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   147
		 * @param {Object} event The event that caused the update.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   148
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   149
		 * @return {Promise} Resolves when the update has been executed.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   150
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
		update: function( event ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
			var self = this,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
				o    = this.options,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
				dfd  = $.Deferred(),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
				content;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
			if ( o.disabled )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
				return;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
			dfd.done( function( content ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
				self._update( event, content );
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   162
			});
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   163
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
			// Either o.content is a string...
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
			if ( typeof o.content === 'string' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
				content = o.content;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
			// ...or o.content is a callback.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
			} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
				content = o.content.call( this.element[0], dfd.resolve, event, this._handoff() );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
			// If content is set, then complete the update.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
			if ( content )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   175
				dfd.resolve( content );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
			return dfd.promise();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   179
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
		/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   181
		 * Updates the content of the pointer.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   182
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   183
		 * Will make sure that the pointer is correctly positioned.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   184
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   185
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   186
		 * @private
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   187
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   188
		 * @param {Object} event   The event that caused the update.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   189
		 * @param {*}      content The content object. Either a string or a jQuery tree.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
		 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
		_update: function( event, content ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
			var buttons,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
				o = this.options;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
			if ( ! content )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
				return;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   198
			// Kill any animations on the pointer.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   199
			this.pointer.stop();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
			this.content.html( content );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
			buttons = o.buttons.call( this.element[0], event, this._handoff() );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
			if ( buttons ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
				buttons.wrap('<div class="wp-pointer-buttons" />').parent().appendTo( this.content );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
			this.reposition();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   210
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   211
		 * Repositions the pointer.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   212
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   213
		 * Makes sure the pointer is the correct size for its content and makes sure it
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   214
		 * is positioned to point to the right element.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   215
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   216
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   217
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
		reposition: function() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
			var position;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
			if ( this.options.disabled )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
				return;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
			position = this._processPosition( this.options.position );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   225
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
			// Reposition pointer.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
			this.pointer.css({
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
				top: 0,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   229
				left: 0,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   230
				zIndex: zindex++ // Increment the z-index so that it shows above other opened pointers.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   231
			}).show().position($.extend({
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
				of: this.element,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   233
				collision: 'fit none'
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   234
			}, position )); // The object comes before this.options.position so the user can override position.of.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   235
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   236
			this.repoint();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   237
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   238
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   239
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   240
		 * Sets the arrow of the pointer to the correct side of the pointer element.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   241
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   242
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   243
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   244
		repoint: function() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   245
			var o = this.options,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   246
				edge;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   247
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   248
			if ( o.disabled )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   249
				return;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   250
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   251
			edge = ( typeof o.position == 'string' ) ? o.position : o.position.edge;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   252
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
			// Remove arrow classes.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   254
			this.pointer[0].className = this.pointer[0].className.replace( /wp-pointer-[^\s'"]*/, '' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   255
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   256
			// Add arrow class.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   257
			this.pointer.addClass( 'wp-pointer-' + edge );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   258
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   259
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   260
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   261
		 * Calculates the correct position based on a position in the settings.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   262
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   263
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   264
		 * @private
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   265
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   266
		 * @param {string|Object} position Either a side of a pointer or an object
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   267
		 *                                 containing a pointer.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   268
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   269
		 * @return {Object} result  An object containing position related data.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   270
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   271
		_processPosition: function( position ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   272
			var opposite = {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   273
					top: 'bottom',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   274
					bottom: 'top',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   275
					left: 'right',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   276
					right: 'left'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   277
				},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   278
				result;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   279
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   280
			// If the position object is a string, it is shorthand for position.edge.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   281
			if ( typeof position == 'string' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   282
				result = {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   283
					edge: position + ''
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   284
				};
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   285
			} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   286
				result = $.extend( {}, position );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   287
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   288
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   289
			if ( ! result.edge )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   290
				return result;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   291
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   292
			if ( result.edge == 'top' || result.edge == 'bottom' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   293
				result.align = result.align || 'left';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   294
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   295
				result.at = result.at || result.align + ' ' + opposite[ result.edge ];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   296
				result.my = result.my || result.align + ' ' + result.edge;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   297
			} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   298
				result.align = result.align || 'top';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   299
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   300
				result.at = result.at || opposite[ result.edge ] + ' ' + result.align;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   301
				result.my = result.my || result.edge + ' ' + result.align;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   302
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   303
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   304
			return result;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   305
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   306
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   307
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   308
		 * Opens the pointer.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   309
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   310
		 * Only opens the pointer widget in case it is closed and not disabled, and
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   311
		 * calls 'update' before doing so. Calling update makes sure that the pointer
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   312
		 * is correctly sized and positioned.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   313
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   314
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   315
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   316
		 * @param {Object} event The event that triggered the opening of this pointer.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   317
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   318
		open: function( event ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   319
			var self = this,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   320
				o    = this.options;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   321
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   322
			if ( this.active || o.disabled || this.element.is(':hidden') )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   323
				return;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   324
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   325
			this.update().done( function() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   326
				self._open( event );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   327
			});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   328
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   329
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   330
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   331
		 * Opens and shows the pointer element.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   332
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   333
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   334
		 * @private
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   335
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   336
		 * @param {Object} event An event object.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   337
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   338
		_open: function( event ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   339
			var self = this,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   340
				o    = this.options;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   341
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   342
			if ( this.active || o.disabled || this.element.is(':hidden') )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   343
				return;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   344
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   345
			this.active = true;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   346
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   347
			this._trigger( 'open', event, this._handoff() );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   348
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   349
			this._trigger( 'show', event, this._handoff({
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   350
				opened: function() {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   351
					self._trigger( 'opened', event, self._handoff() );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   352
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   353
			}));
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   354
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   355
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   356
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   357
		 * Closes and hides the pointer element.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   358
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   359
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   360
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   361
		 * @param {Object} event An event object.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   362
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   363
		close: function( event ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   364
			if ( !this.active || this.options.disabled )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   365
				return;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   366
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   367
			var self = this;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   368
			this.active = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   369
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   370
			this._trigger( 'close', event, this._handoff() );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   371
			this._trigger( 'hide', event, this._handoff({
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   372
				closed: function() {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   373
					self._trigger( 'closed', event, self._handoff() );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   374
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   375
			}));
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   376
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   377
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   378
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   379
		 * Puts the pointer on top by increasing the z-index.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   380
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   381
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   382
		 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   383
		sendToTop: function() {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   384
			if ( this.active )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   385
				this.pointer.css( 'z-index', zindex++ );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   386
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   387
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   388
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   389
		 * Toggles the element between shown and hidden.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   390
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   391
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   392
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   393
		 * @param {Object} event An event object.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   394
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   395
		toggle: function( event ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   396
			if ( this.pointer.is(':hidden') )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   397
				this.open( event );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   398
			else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   399
				this.close( event );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   400
		},
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   401
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   402
		/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   403
		 * Extends the pointer and the widget element with the supplied parameter, which
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   404
		 * is either an element or a function.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   405
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   406
		 * @since 3.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   407
		 * @private
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   408
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   409
		 * @param {Object} extend The object to be merged into the original object.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   410
		 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   411
		 * @return {Object} The extended object.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   412
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   413
		_handoff: function( extend ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   414
			return $.extend({
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   415
				pointer: this.pointer,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   416
				element: this.element
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   417
			}, extend);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   418
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   419
	});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   420
})(jQuery);