var/www/html/servotec-doerpen/wp-admin/js | uid:33
link.js [X]
/**
 * @output wp-admin/js/link.js
 */

/* global postboxes, deleteUserSetting, setUserSetting, getUserSetting */

jQuery( function($) {

	var newCat, noSyncChecks = false, syncChecks, catAddAfter;

	$('#link_name').trigger( 'focus' );
	// Postboxes.
	postboxes.add_postbox_toggles('link');

	/**
	 * Adds event that opens a particular category tab.
	 *
	 * @ignore
	 *
	 * @return {boolean} Always returns false to prevent the default behavior.
	 */
	$('#category-tabs a').on( 'click keyup keydown', function( event ){
		var t = $(this).attr('href');
		if ( event.type === 'keydown' && event.key === ' ' ) {
			event.preventDefault();
		}
		if ( ( event.type === 'keyup' && event.key === ' ' ) || ( event.type === 'keydown' && event.key === 'Enter' ) || event.type === 'click' ) {
			event.preventDefault();
			$('#category-tabs a').removeAttr( 'aria-selected' ).attr( 'tabindex', '-1' );
			$(this).attr( 'aria-selected', 'true' ).removeAttr( 'tabindex' );
			$(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
			$('.tabs-panel').hide();
			$(t).show();
			if ( '#categories-all' == t ) {
				deleteUserSetting('cats');
			} else {
				setUserSetting('cats','pop');
			}
			return false;
		}
		if ( event.type === 'keyup' && ( event.key === 'ArrowRight' || event.key === 'ArrowLeft' ) ) {
			$(this).attr( 'tabindex', '-1' );
			let next = $(this).parent('li').next();
			let prev = $(this).parent('li').prev();
			if ( next.length > 0 ) {
				next.find('a').removeAttr( 'tabindex');
				next.find('a').trigger( 'focus' );
			} else {
				prev.find('a').removeAttr( 'tabindex');
				prev.find('a').trigger( 'focus' );
			}
		}
	});
	if ( getUserSetting('cats') )
		$('#category-tabs a[href="#categories-pop"]').trigger( 'click' );

	// Ajax Cat.
	newCat = $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ); } );

	/**
	 * After adding a new category, focus on the category add input field.
	 *
	 * @return {void}
	 */
	$('#link-category-add-submit').on( 'click', function() { newCat.focus(); } );

	/**
	 * Synchronize category checkboxes.
	 *
	 * This function makes sure that the checkboxes are synced between the all
	 * categories tab and the most used categories tab.
	 *
	 * @since 2.5.0
	 *
	 * @return {void}
	 */
	syncChecks = function() {
		if ( noSyncChecks )
			return;
		noSyncChecks = true;
		var th = $(this), c = th.is(':checked'), id = th.val().toString();
		$('#in-link-category-' + id + ', #in-popular-link_category-' + id).prop( 'checked', c );
		noSyncChecks = false;
	};

	/**
	 * Adds event listeners to an added category.
	 *
	 * This is run on the addAfter event to make sure the correct event listeners
	 * are bound to the DOM elements.
	 *
	 * @since 2.5.0
	 *
	 * @param {string} r Raw XML response returned from the server after adding a
	 *                   category.
	 * @param {Object} s List manager configuration object; settings for the Ajax
	 *                   request.
	 *
	 * @return {void}
	 */
	catAddAfter = function( r, s ) {
		$(s.what + ' response_data', r).each( function() {
			var t = $($(this).text());
			t.find( 'label' ).each( function() {
				var th = $(this),
					val = th.find('input').val(),
					id = th.find('input')[0].id,
					name = th.text().trim(),
					o;
				$('#' + id).on( 'change', syncChecks );
				o = $( '<option value="' +  parseInt( val, 10 ) + '"></option>' ).text( name );
			} );
		} );
	};

	/*
	 * Instantiates the list manager.
	 *
	 * @see js/_enqueues/lib/lists.js
	 */
	$('#categorychecklist').wpList( {
		// CSS class name for alternate styling.
		alt: '',

		// The type of list.
		what: 'link-category',

		// ID of the element the parsed Ajax response will be stored in.
		response: 'category-ajax-response',

		// Callback that's run after an item got added to the list.
		addAfter: catAddAfter
	} );

	// All categories is the default tab, so we delete the user setting.
	$('a[href="#categories-all"]').on( 'click', function(){deleteUserSetting('cats');});

	// Set a preference for the popular categories to cookies.
	$('a[href="#categories-pop"]').on( 'click', function(){setUserSetting('cats','pop');});

	if ( 'pop' == getUserSetting('cats') )
		$('a[href="#categories-pop"]').trigger( 'click' );

	/**
	 * Adds event handler that shows the interface controls to add a new category.
	 *
	 * @ignore
	 *
	 * @param {Event} event The event object.
	 * @return {boolean} Always returns false to prevent regular link
	 *                   functionality.
	 */
	$('#category-add-toggle').on( 'click', function() {
		$(this).parents('div:first').toggleClass( 'wp-hidden-children' );
		$('#category-tabs a[href="#categories-all"]').trigger( 'click' );
		$('#newcategory').trigger( 'focus' );
		return false;
	} );

	$('.categorychecklist :checkbox').on( 'change', syncChecks ).filter( ':checked' ).trigger( 'change' );
});
widgets/-O R D
accordion.js2.9KV E R D
accordion.min.js758V E R D
auth-app.min.js2KV E R D
code-editor.js17.5KV E R D
code-editor.min.js3.5KV E R D
color-picker.js9.5KV E R D
color-picker.min.js3.4KV E R D
custom-background.min.js1.2KV E R D
customize-nav-menus.min.js47.1KV E R D
edit-comments.js37.2KV E R D
edit-comments.min.js15.2KV E R D
editor.js44KV E R D
gallery.js5.4KV E R D
gallery.min.js3.7KV E R D
inline-edit-post.min.js9.4KV E R D
inline-edit-tax.js7.6KV E R D
inline-edit-tax.min.js2.9KV E R D
language-chooser.min.js423V E R D
link.js4.8KV E R D
media-gallery.js1.3KV E R D
media-gallery.min.js611V E R D
media-upload.min.js1.1KV E R D
media.js6.6KV E R D
media.min.js2.4KV E R D
nav-menu.min.js30.1KV E R D
password-strength-meter.min.js1.1KV E R D
plugin-install.js6.9KV E R D
post.min.js19KV E R D
postbox.min.js6.6KV E R D
revisions.js33.9KV E R D
revisions.min.js18KV E R D
set-post-thumbnail.min.js620V E R D
site-health.js13.6KV E R D
site-health.min.js6.3KV E R D
site-icon.js6.1KV E R D
site-icon.min.js2.2KV E R D
svg-painter.js3.2KV E R D
svg-painter.min.js1.5KV E R D
tags-box.js10.9KV E R D
tags-box.min.js3KV E R D
tags-suggest.js5.6KV E R D
tags-suggest.min.js2.2KV E R D
tags.js6KV E R D
tags.min.js2.4KV E R D
theme-plugin-editor.js25.6KV E R D
theme-plugin-editor.min.js11.8KV E R D
user-profile.js17.9KV E R D
user-suggest.min.js676V E R D
word-count.js7.5KV E R D
xfn.js740V E R D
xfn.min.js458V E R D