2015-09-10 23:45:24 +02:00
< ? php
/**
* WordPress Options Administration API .
*
* @ package WordPress
* @ subpackage Administration
* @ since 4.4 . 0
*/
/**
* Output JavaScript to toggle display of additional settings if avatars are disabled .
*
* @ since 4.2 . 0
*/
function options_discussion_add_js () {
2018-08-17 03:51:36 +02:00
?>
2015-09-10 23:45:24 +02:00
< script >
( function ( $ ){
var parent = $ ( '#show_avatars' ),
children = $ ( '.avatar-settings' );
2021-01-22 13:32:03 +01:00
parent . on ( 'change' , function (){
2015-09-10 23:45:24 +02:00
children . toggleClass ( 'hide-if-js' , ! this . checked );
});
})( jQuery );
</ script >
2018-08-17 03:51:36 +02:00
< ? php
2015-09-10 23:45:24 +02:00
}
/**
* Display JavaScript on the page .
*
* @ since 3.5 . 0
*/
function options_general_add_js () {
2018-08-17 03:51:36 +02:00
?>
2015-09-10 23:45:24 +02:00
< script type = " text/javascript " >
External Libraries: Further fix jQuery deprecations in WordPress core.
Follow-up to [50001], [50270], [50367], [50383], [50410], [50420], [50429], [50547].
Props chaion07, Clorith, costdev, desrosj, malthert, peterwilsoncc, presskopp, promz, sabernhardt, SergeyBiryukov, toro_unit, wpnomad.
Fixes #51519.
Built from https://develop.svn.wordpress.org/trunk@52285
git-svn-id: http://core.svn.wordpress.org/trunk@51877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 18:18:01 +01:00
jQuery ( function ( $ ) {
2015-09-10 23:45:24 +02:00
var $siteName = $ ( '#wp-admin-bar-site-name' ) . children ( 'a' ) . first (),
homeURL = ( < ? php echo wp_json_encode ( get_home_url () ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' );
$ ( '#blogname' ) . on ( 'input' , function () {
var title = $ . trim ( $ ( this ) . val () ) || homeURL ;
// Truncate to 40 characters.
if ( 40 < title . length ) {
title = title . substring ( 0 , 40 ) + '\u2026' ;
}
$siteName . text ( title );
});
2021-01-22 13:32:03 +01:00
$ ( 'input[name="date_format"]' ) . on ( 'click' , function () {
2020-05-16 20:42:12 +02:00
if ( 'date_format_custom_radio' !== $ ( this ) . attr ( 'id' ) )
2017-11-09 04:55:46 +01:00
$ ( 'input[name="date_format_custom"]' ) . val ( $ ( this ) . val () ) . closest ( 'fieldset' ) . find ( '.example' ) . text ( $ ( this ) . parent ( 'label' ) . children ( '.format-i18n' ) . text () );
2015-09-10 23:45:24 +02:00
});
2020-05-16 20:42:12 +02:00
2017-05-02 22:03:42 +02:00
$ ( 'input[name="date_format_custom"]' ) . on ( 'click input' , function () {
2015-09-10 23:45:24 +02:00
$ ( '#date_format_custom_radio' ) . prop ( 'checked' , true );
});
2021-01-22 13:32:03 +01:00
$ ( 'input[name="time_format"]' ) . on ( 'click' , function () {
2020-05-16 20:42:12 +02:00
if ( 'time_format_custom_radio' !== $ ( this ) . attr ( 'id' ) )
2017-11-09 04:55:46 +01:00
$ ( 'input[name="time_format_custom"]' ) . val ( $ ( this ) . val () ) . closest ( 'fieldset' ) . find ( '.example' ) . text ( $ ( this ) . parent ( 'label' ) . children ( '.format-i18n' ) . text () );
2015-09-10 23:45:24 +02:00
});
2019-02-20 23:56:50 +01:00
2017-05-02 22:03:42 +02:00
$ ( 'input[name="time_format_custom"]' ) . on ( 'click input' , function () {
2015-09-10 23:45:24 +02:00
$ ( '#time_format_custom_radio' ) . prop ( 'checked' , true );
});
2019-02-20 23:56:50 +01:00
$ ( 'input[name="date_format_custom"], input[name="time_format_custom"]' ) . on ( 'input' , function () {
2017-11-09 04:55:46 +01:00
var format = $ ( this ),
fieldset = format . closest ( 'fieldset' ),
example = fieldset . find ( '.example' ),
spinner = fieldset . find ( '.spinner' );
2019-02-20 23:56:50 +01:00
// Debounce the event callback while users are typing.
clearTimeout ( $ . data ( this , 'timer' ) );
$ ( this ) . data ( 'timer' , setTimeout ( function () {
// If custom date is not empty.
if ( format . val () ) {
spinner . addClass ( 'is-active' );
2017-11-09 04:55:46 +01:00
2019-02-20 23:56:50 +01:00
$ . post ( ajaxurl , {
2020-05-16 20:42:12 +02:00
action : 'date_format_custom' === format . attr ( 'name' ) ? 'date_format' : 'time_format' ,
2019-02-20 23:56:50 +01:00
date : format . val ()
}, function ( d ) { spinner . removeClass ( 'is-active' ); example . text ( d ); } );
}
}, 500 ) );
} );
2015-09-10 23:45:24 +02:00
var languageSelect = $ ( '#WPLANG' );
2021-01-22 13:32:03 +01:00
$ ( 'form' ) . on ( 'submit' , function () {
2015-09-10 23:45:24 +02:00
// Don't show a spinner for English and installed languages,
// as there is nothing to download.
if ( ! languageSelect . find ( 'option:selected' ) . data ( 'installed' ) ) {
2017-05-07 14:01:42 +02:00
$ ( '#submit' , this ) . after ( '<span class="spinner language-install-spinner is-active" />' );
2015-09-10 23:45:24 +02:00
}
});
External Libraries: Further fix jQuery deprecations in WordPress core.
Follow-up to [50001], [50270], [50367], [50383], [50410], [50420], [50429], [50547].
Props chaion07, Clorith, costdev, desrosj, malthert, peterwilsoncc, presskopp, promz, sabernhardt, SergeyBiryukov, toro_unit, wpnomad.
Fixes #51519.
Built from https://develop.svn.wordpress.org/trunk@52285
git-svn-id: http://core.svn.wordpress.org/trunk@51877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 18:18:01 +01:00
} );
2015-09-10 23:45:24 +02:00
</ script >
2018-08-17 03:51:36 +02:00
< ? php
2015-09-10 23:45:24 +02:00
}
/**
* Display JavaScript on the page .
*
* @ since 3.5 . 0
*/
function options_reading_add_js () {
2018-08-17 03:51:36 +02:00
?>
2015-09-10 23:45:24 +02:00
< script type = " text/javascript " >
External Libraries: Further fix jQuery deprecations in WordPress core.
Follow-up to [50001], [50270], [50367], [50383], [50410], [50420], [50429], [50547].
Props chaion07, Clorith, costdev, desrosj, malthert, peterwilsoncc, presskopp, promz, sabernhardt, SergeyBiryukov, toro_unit, wpnomad.
Fixes #51519.
Built from https://develop.svn.wordpress.org/trunk@52285
git-svn-id: http://core.svn.wordpress.org/trunk@51877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 18:18:01 +01:00
jQuery ( function ( $ ) {
2015-09-10 23:45:24 +02:00
var section = $ ( '#front-static-pages' ),
staticPage = section . find ( 'input:radio[value="page"]' ),
selects = section . find ( 'select' ),
check_disabled = function (){
selects . prop ( 'disabled' , ! staticPage . prop ( 'checked' ) );
};
check_disabled ();
2021-01-22 13:32:03 +01:00
section . find ( 'input:radio' ) . on ( 'change' , check_disabled );
External Libraries: Further fix jQuery deprecations in WordPress core.
Follow-up to [50001], [50270], [50367], [50383], [50410], [50420], [50429], [50547].
Props chaion07, Clorith, costdev, desrosj, malthert, peterwilsoncc, presskopp, promz, sabernhardt, SergeyBiryukov, toro_unit, wpnomad.
Fixes #51519.
Built from https://develop.svn.wordpress.org/trunk@52285
git-svn-id: http://core.svn.wordpress.org/trunk@51877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 18:18:01 +01:00
} );
2015-09-10 23:45:24 +02:00
</ script >
2018-08-17 03:51:36 +02:00
< ? php
2015-09-10 23:45:24 +02:00
}
/**
2016-01-28 04:35:27 +01:00
* Render the site charset setting .
2015-09-10 23:45:24 +02:00
*
* @ since 3.5 . 0
*/
function options_reading_blog_charset () {
echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr ( get_option ( 'blog_charset' ) ) . '" class="regular-text" />' ;
2019-07-26 00:45:57 +02:00
echo '<p class="description">' . __ ( 'The <a href="https://wordpress.org/support/article/glossary/#character-set">character encoding</a> of your site (UTF-8 is recommended)' ) . '</p>' ;
2016-01-28 04:35:27 +01:00
}